diff --git a/contracts/sources/cooler_factory.move b/contracts/sources/cooler_factory.move index 60414c7..554d085 100755 --- a/contracts/sources/cooler_factory.move +++ b/contracts/sources/cooler_factory.move @@ -6,8 +6,12 @@ module galliun::cooler_factory { sui::SUI, coin::{Coin} }; - use galliun::water_cooler::{Self}; - use galliun::orchestrator::{Self}; + use galliun::{ + water_cooler::{Self}, + orchestrator::{Self}, + settings::{Self}, + warehouse::{Self}, + }; // === Errors === @@ -19,7 +23,6 @@ module galliun::cooler_factory { public struct CoolerFactory has key { id: UID, fee: u64, - mint_fee: u64, treasury: address, cooler_list: vector } @@ -38,7 +41,6 @@ module galliun::cooler_factory { CoolerFactory { id: object::new(ctx), fee: 100_000_000, - mint_fee: 100_000, treasury: @galliun_treasury, cooler_list: vector::empty() } @@ -58,6 +60,14 @@ module galliun::cooler_factory { ) { assert!(payment.value() == self.fee, EInsufficientBalance); + // Create a Mint distributer and give it to the buyer. + // We do this here to avoid create a dependency circle + // with the Mint and water_cooler modules + // let settings = settings::new(waterCoolerID, ctx); + // let warehouse = warehouse::new(waterCoolerID, ctx); + + let (settings, warehouse) = orchestrator::create_mint_distributer(ctx); + // Create a WaterCooler and give it to the buyer let waterCoolerID = water_cooler::create_water_cooler( name, @@ -66,18 +76,13 @@ module galliun::cooler_factory { placeholder_image_url, supply, treasury, - // mint_setting_id, - // mint_warehouse_id, + object::id(&settings), + object::id(&warehouse), ctx - ); - - // Create a Mint distributer and give it to the buyer. - // We do this here to avoid create a dependency circle - // with the Mint and water_cooler modules - let (settings, warehouse) = orchestrator::create_mint_distributer(waterCoolerID, ctx); + ); - orchestrator::transfer_setting(settings); - orchestrator::transfer_warehouse(warehouse); + settings::transfer_setting(settings, ctx); + warehouse::transfer_warehouse(warehouse, ctx); self.cooler_list.push_back(waterCoolerID); @@ -93,10 +98,6 @@ module galliun::cooler_factory { public fun get_fee(self: &CoolerFactory) : u64 { self.fee } - - public fun get_mint_fee(self: &CoolerFactory) : u64 { - self.mint_fee - } public(package) fun send_fees( self: &CoolerFactory, diff --git a/contracts/sources/cooler_registry.move b/contracts/sources/cooler_registry.move new file mode 100755 index 0000000..5c150a1 --- /dev/null +++ b/contracts/sources/cooler_registry.move @@ -0,0 +1,92 @@ +module galliun::cooler_registry { + // === Imports === + + use std::string::{String}; + use sui::{ + sui::SUI, + coin::{Coin}, + table::{Self, Table} + }; + use galliun::water_cooler::{WaterCooler}; + + // === Errors === + + const EInsufficientBalance: u64 = 0; + const NotTheOwner: u64 = 1; + const NameAlreadyRegistered: u64 = 2; + + // === Structs === + + // shared object where creators register their Water cooler + // For it to be displayed on the launchpad + public struct CoolerRegistry has key { + id: UID, + fee: u64, + name_to_id: Table, + treasury: address, + } + + public struct CoolerRegistryOwnerCap has key, store { id: UID } + + // === Public mutative functions === + + fun init(ctx: &mut TxContext) { + transfer::transfer( + CoolerRegistryOwnerCap { id: object::new(ctx) }, + ctx.sender() + ); + + transfer::share_object( + CoolerRegistry { + id: object::new(ctx), + fee: 100_000_000, + name_to_id: table::new(ctx), + treasury: @galliun_treasury, + } + ); + } + + public entry fun register_water_cooler( + self: &mut CoolerRegistry, + payment: Coin, + waterCooler: &WaterCooler, + name: String, + ctx: &mut TxContext + ) { + assert!(payment.value() == self.fee, EInsufficientBalance); + assert!(waterCooler.owner() == ctx.sender(), NotTheOwner); + assert!(!self.name_to_id.contains(name), NameAlreadyRegistered); + + self.name_to_id.add(name, object::id(waterCooler)); + + // Transfer fees to treasury + self.send_fees(payment); + } + + + public entry fun update_fee(_: &CoolerRegistryOwnerCap, self: &mut CoolerRegistry, fee: u64) { + self.fee = fee; + } + + public fun get_fee(self: &CoolerRegistry) : u64 { + self.fee + } + + public fun get_water_cooler(self: &CoolerRegistry, name: String) : ID { + self.name_to_id[name] + } + + public(package) fun send_fees( + self: &CoolerRegistry, + coins: Coin + ) { + transfer::public_transfer(coins, self.treasury); + } + + // === Test Functions === + + #[test_only] + public fun init_for_cooler(ctx: &mut TxContext) { + init(ctx); + } +} diff --git a/contracts/sources/factory_settings.move b/contracts/sources/factory_settings.move index a00a9ee..6171106 100755 --- a/contracts/sources/factory_settings.move +++ b/contracts/sources/factory_settings.move @@ -61,7 +61,7 @@ module galliun::factory_settings { // === Test Functions === #[test_only] - public fun init_for_cooler(ctx: &mut TxContext) { + public fun init_for_factory_settings(ctx: &mut TxContext) { init(ctx); } } diff --git a/contracts/sources/image.move b/contracts/sources/image.move index 34b851f..f267f99 100755 --- a/contracts/sources/image.move +++ b/contracts/sources/image.move @@ -1,4 +1,5 @@ module galliun::image { + use std::string::{String}; // === Imports === @@ -10,24 +11,20 @@ module galliun::image { public struct Image has key, store { id: UID, - name: vector, - description: vector, - data: vector, // Binary data of the image + name: String, + description: String, + data: String, // Binary data of the image } // === Events === - - - // === Init Function === - /// Function to inscribe a new image on-chain #[allow(lint(self_transfer))] public fun inscribe_image( - name: vector, - description: vector, - data: vector, + name: String, + description: String, + data: String, ctx: &mut TxContext ) { let image = Image { @@ -40,7 +37,7 @@ module galliun::image { } /// Function to get image metadata - public fun get_image_metadata(image: &Image): (vector, vector, vector) { + public fun get_image_metadata(image: &Image): (String, String, String) { (image.name, image.description, image.data) } } diff --git a/contracts/sources/orchestrator.move b/contracts/sources/orchestrator.move index 0436f45..a2db7c2 100755 --- a/contracts/sources/orchestrator.move +++ b/contracts/sources/orchestrator.move @@ -9,7 +9,6 @@ module galliun::orchestrator { kiosk::{Self}, package::{Self}, sui::{SUI}, - table_vec::{Self, TableVec}, transfer_policy::{TransferPolicy}, }; use galliun::{ @@ -17,6 +16,8 @@ module galliun::orchestrator { factory_settings::{FactorySetings}, water_cooler::{Self, WaterCooler}, capsule::{Capsule}, + warehouse::{Self, Warehouse}, + settings::{Self, Settings}, // image::{Image}, // registry::{Registry} }; @@ -30,7 +31,7 @@ module galliun::orchestrator { const EInvalidStatusNumber: u64 = 4; const EInvalidTicketForMintPhase: u64 = 5; const EMintNotLive: u64 = 6; - const EMintWarehouseAlreadyInitialized: u64 = 7; + //const EMintWarehouseAlreadyInitialized: u64 = 7; const EMintWarehouseNotEmpty: u64 = 8; const EMintWarehouseNotInitialized: u64 = 9; // const EMizuNFTNotRevealed: u64 = 10; @@ -50,42 +51,6 @@ module galliun::orchestrator { public struct ORCHESTRATOR has drop {} - - public struct Settings has key { - id: UID, - // We add this id so we can insure that the water cooler that - // is passed coresponds with the current mint settings - // We have to add it here because we cannot do the check in the - // watercooler module as there will be a circular dependency - // between the Setting in the Mint module and the Water Cooler - // in the watercooler modules - waterCoolerId: ID, - // This is the price that must be paid by the minter to get the NFT - price: u64, - /// The phase determins the current minting phase - /// 1 = og - /// 2 = whiteList - /// 3 = public - phase: u8, - /// The state determings whether the mint is active or not - /// 0 = inactive - /// 1 = active - status: u8, - } - - public struct Warehouse has key { - id: UID, - // We add this id so we can insure that the water cooler that - // is passed coresponds with the current mint settings - // We have to add it here because we cannot do the check in the - // watercooler module as there will be a circular dependency - // between the Setting in the Mint module and the Water Cooler - // in the watercooler modules - waterCoolerId: ID, - nfts: TableVec, - is_initialized: bool, - } - public struct WhitelistTicket has key { id: UID, waterCoolerId: ID, @@ -140,8 +105,8 @@ module galliun::orchestrator { // === Public-view Functions === - public fun get_mintwarehouse_length(self: &Warehouse) : u64 { - self.nfts.length() + public fun get_mintwarehouse_length(warehouse: &Warehouse) : u64 { + warehouse.count() } // === Public-Mutative Functions === @@ -152,18 +117,17 @@ module galliun::orchestrator { factorySettings: &FactorySetings, warehouse: &mut Warehouse, settings: &Settings, - policy: &TransferPolicy, payment: Coin, ctx: &mut TxContext, ) { - assert!(warehouse.waterCoolerId == object::id(waterCooler), EWearhouseDoesNotMatchCooler); - assert!(settings.waterCoolerId == object::id(waterCooler), ESettingsDoesNotMatchCooler); - assert!(warehouse.nfts.length() > 0, EWarehouseIsEmpty); - assert!(settings.phase == 3, EWrongPhase); - assert!(settings.status == MINT_STATE_ACTIVE, EMintNotLive); - assert!(payment.value() == settings.price, EInvalidPaymentAmount); - - mint_capsule(factorySettings, waterCooler, warehouse, policy, payment, ctx); + assert!(waterCooler.get_warehouse_id() == object::id(warehouse), EWearhouseDoesNotMatchCooler); + assert!(waterCooler.get_settings_id() == object::id(settings), ESettingsDoesNotMatchCooler); + assert!(warehouse.count() > 0, EWarehouseIsEmpty); + assert!(settings.phase() == 3, EWrongPhase); + assert!(settings.status() == MINT_STATE_ACTIVE, EMintNotLive); + assert!(payment.value() == settings.price(), EInvalidPaymentAmount); + + mint_capsule(factorySettings, waterCooler, warehouse, payment, ctx); } #[allow(unused_variable)] @@ -173,22 +137,21 @@ module galliun::orchestrator { waterCooler: &WaterCooler, warehouse: &mut Warehouse, settings: &Settings, - policy: &TransferPolicy, payment: Coin, ctx: &mut TxContext, ) { - assert!(warehouse.waterCoolerId == object::id(waterCooler), EWearhouseDoesNotMatchCooler); - assert!(settings.waterCoolerId == object::id(waterCooler), ESettingsDoesNotMatchCooler); + assert!(waterCooler.get_warehouse_id() == object::id(warehouse), EWearhouseDoesNotMatchCooler); + assert!(waterCooler.get_settings_id() == object::id(settings), ESettingsDoesNotMatchCooler); let WhitelistTicket { id, name, image_url, waterCoolerId, phase } = ticket; - assert!(settings.status == MINT_STATE_ACTIVE, EMintNotLive); - assert!(phase == settings.phase, EInvalidTicketForMintPhase); + assert!(settings.status() == MINT_STATE_ACTIVE, EMintNotLive); + assert!(phase == settings.phase(), EInvalidTicketForMintPhase); assert!(waterCoolerId == object::id(waterCooler), EInvalidTicketForMintPhase); - assert!(payment.value() == settings.price, EInvalidPaymentAmount); + assert!(payment.value() == settings.price(), EInvalidPaymentAmount); - mint_capsule(factorySettings, waterCooler, warehouse, policy, payment, ctx); + mint_capsule(factorySettings, waterCooler, warehouse, payment, ctx); id.delete(); } @@ -199,21 +162,20 @@ module galliun::orchestrator { waterCooler: &WaterCooler, warehouse: &mut Warehouse, settings: &Settings, - policy: &TransferPolicy, payment: Coin, ctx: &mut TxContext, ) { - assert!(warehouse.waterCoolerId == object::id(waterCooler), EWearhouseDoesNotMatchCooler); - assert!(settings.waterCoolerId == object::id(waterCooler), ESettingsDoesNotMatchCooler); + assert!(waterCooler.get_warehouse_id() == object::id(warehouse), EWearhouseDoesNotMatchCooler); + assert!(waterCooler.get_settings_id() == object::id(settings), ESettingsDoesNotMatchCooler); let OriginalGangsterTicket { id, name, image_url, waterCoolerId, phase } = ticket; - assert!(settings.status == MINT_STATE_ACTIVE, EMintNotLive); - assert!(phase == settings.phase, EInvalidTicketForMintPhase); + assert!(settings.status() == MINT_STATE_ACTIVE, EMintNotLive); + assert!(phase == settings.phase(), EInvalidTicketForMintPhase); assert!(waterCoolerId == object::id(waterCooler), EInvalidTicketForMintPhase); - assert!(payment.value() == settings.price, EInvalidPaymentAmount); + assert!(payment.value() == settings.price(), EInvalidPaymentAmount); - mint_capsule(factorySettings, waterCooler, warehouse, policy, payment, ctx); + mint_capsule(factorySettings, waterCooler, warehouse, payment, ctx); id.delete(); } @@ -226,19 +188,10 @@ module galliun::orchestrator { mut nfts: vector, warehouse: &mut Warehouse, ) { - assert!(waterCooler.get_is_revealed(), ENFTNotAllReaveled); + assert!(!waterCooler.get_is_revealed(), ENFTNotAllReaveled); assert!(object::id(warehouse) == cap.`for_warehouse`, ENotOwner); - assert!(warehouse.is_initialized == false, EMintWarehouseAlreadyInitialized); - - while (!nfts.is_empty()) { - let nft = nfts.pop_back(); - warehouse.nfts.push_back(nft); - }; - nfts.destroy_empty(); - - if (warehouse.nfts.length() as u64 == waterCooler.supply()) { - warehouse.is_initialized = true; - }; + + warehouse.stock(waterCooler.supply(), nfts); } /// Destroy an empty mint warehouse when it's no longer needed. @@ -246,20 +199,11 @@ module galliun::orchestrator { cap: &OrchAdminCap, warehouse: Warehouse, ) { - assert!(warehouse.nfts.is_empty(), EMintWarehouseNotEmpty); - assert!(warehouse.is_initialized == true, EMintWarehouseNotInitialized); + assert!(warehouse.is_empty(), EMintWarehouseNotEmpty); + assert!(warehouse.is_initialized() == true, EMintWarehouseNotInitialized); + assert!(object::id(&warehouse) == cap.`for_warehouse`, ENotOwner); - let Warehouse { - id, - waterCoolerId: _, - nfts, - is_initialized: _, - } = warehouse; - - assert!(object::uid_to_inner(&id) == cap.`for_warehouse`, ENotOwner); - - nfts.destroy_empty(); - id.delete(); + warehouse.delete(); } // Set mint price, status, phase @@ -271,7 +215,7 @@ module galliun::orchestrator { assert!(object::id(settings) == cap.`for_settings`, ENotOwner); assert!(price >= 0, EInvalidPrice); - settings.price = price; + settings.set_price(price); } public fun set_mint_status( @@ -281,7 +225,7 @@ module galliun::orchestrator { ) { assert!(object::id(settings) == cap.`for_settings`, ENotOwner); assert!(status == MINT_STATE_INACTIVE || status == MINT_STATE_ACTIVE, EInvalidStatusNumber); - settings.status = status; + settings.set_status(status); } public fun set_mint_phase( @@ -291,7 +235,7 @@ module galliun::orchestrator { ) { assert!(object::id(settings) == cap.`for_settings`, ENotOwner); assert!(phase >= 1 && phase <= 3, EInvalidPhaseNumber); - settings.phase = phase; + settings.set_phase(phase); } public fun create_og_ticket( @@ -330,25 +274,9 @@ module galliun::orchestrator { // === Package functions === - public(package) fun create_mint_distributer(waterCoolerId: ID, ctx: &mut TxContext): (Settings, Warehouse) { - // This might need to be moved to a seperate function - // that will be called by the owner of the WaterCooler - let settings = Settings { - id: object::new(ctx), - waterCoolerId, - price: 0, - phase: 0, - status: 0, - }; - - // This might need to be moved to a seperate function - // that will be called by the owner of the WaterCooler - let warehouse = Warehouse { - id: object::new(ctx), - waterCoolerId, - nfts: table_vec::empty(ctx), - is_initialized: false, - }; + public(package) fun create_mint_distributer(ctx: &mut TxContext): (Settings, Warehouse) { + let settings = settings::new(ctx); + let warehouse = warehouse::new(ctx); // Here we transfer the mint admin cap to the person that bought the WaterCooler transfer::transfer( @@ -363,15 +291,6 @@ module galliun::orchestrator { (settings, warehouse) } - #[allow(lint(share_owned))] - public(package) fun transfer_setting(self: Settings) { - transfer::share_object(self); - } - - #[allow(lint(share_owned))] - public(package) fun transfer_warehouse(self: Warehouse) { - transfer::share_object(self); - } // === Private Functions === @@ -380,12 +299,11 @@ module galliun::orchestrator { factorySettings: &FactorySetings, waterCooler: &WaterCooler, warehouse: &mut Warehouse, - _policy: &TransferPolicy, mut payment: Coin, ctx: &mut TxContext, ) { // Safely unwrap the NFT from the warehouse - let nft = warehouse.nfts.pop_back(); + let nft = warehouse.pop_nft(); // Create a new kiosk and its owner capability let (mut kiosk, kiosk_owner_cap) = kiosk::new(ctx); @@ -404,9 +322,6 @@ module galliun::orchestrator { transfer::public_share_object(kiosk); let coin_balance = payment.balance_mut(); - // let fees = coin_balance.split(factorySettings.get_mint_fee()); - - // let amount = fees.value(); let profits = coin::take(coin_balance, factorySettings.get_mint_fee(), ctx); factorySettings.send_fees(profits); @@ -414,17 +329,10 @@ module galliun::orchestrator { // Send the payment to the water cooler waterCooler.send_fees(payment); } - - + // === Test Functions === #[test_only] - public fun init_for_mint(ctx: &mut TxContext) { + public fun init_for_orchestrator(ctx: &mut TxContext) { init(ORCHESTRATOR {}, ctx); } - - // #[test_only] - // public fun get_nft_id(self: &Mint) : ID { - // let nft = self.nft.borrow(); - // object::id(nft) - // } } diff --git a/contracts/sources/registry.move b/contracts/sources/registry.move index 7ad3264..94c452e 100755 --- a/contracts/sources/registry.move +++ b/contracts/sources/registry.move @@ -17,7 +17,8 @@ module galliun::registry { use sui::{ display, package, - table::{Self, Table} + table::{Self, Table}, + table_vec::{Self, TableVec}, }; use galliun::collection::{Self, Collection}; @@ -32,8 +33,8 @@ module galliun::registry { name: String, description: String, image_url: String, - nft_ids: vector, - kiosk_ids: vector, + nft_ids: TableVec, + kiosk_ids: TableVec, num_to_nft: Table, nft_to_num: Table, is_ready: bool @@ -45,7 +46,7 @@ module galliun::registry { // === Constants === const EInvalidnftNumber: u64 = 1; - const ERegistryNotFromThisCollection: u64 = 2; + //const ERegistryNotFromThisCollection: u64 = 2; // === Init Function === @@ -76,8 +77,8 @@ module galliun::registry { ): Registry { Registry { id: object::new(ctx), - nft_ids: vector::empty(), - kiosk_ids: vector::empty(), + nft_ids: table_vec::empty(ctx), + kiosk_ids: table_vec::empty(ctx), num_to_nft: table::new(ctx), nft_to_num: table::new(ctx), name, @@ -105,28 +106,28 @@ module galliun::registry { self.num_to_nft[number] } - public fun nft_number_from_id( - self: &Registry, - id: ID, - ): u16 { - assert!(self.kiosk_ids.contains(&id) == true, ERegistryNotFromThisCollection); - - self.nft_to_num[id] - } + // public fun nft_number_from_id( + // self: &Registry, + // id: ID, + // ): u16 { + // assert!(self.kiosk_ids.contains(&id) == true, ERegistryNotFromThisCollection); + + // self.nft_to_num[id] + // } - public fun is_kiosk_registered( - self: &Registry, - id: ID, - ): bool { - self.kiosk_ids.contains(&id) - } + // public fun is_kiosk_registered( + // self: &Registry, + // id: ID, + // ): bool { + // self.kiosk_ids.contains(&id) + // } - public fun is_nft_registered( - self: &Registry, - id: ID, - ): bool { - self.nft_ids.contains(&id) - } + // public fun is_nft_registered( + // self: &Registry, + // id: ID, + // ): bool { + // self.nft_ids.contains(&id) + // } // === Package Functions === diff --git a/contracts/sources/settings.move b/contracts/sources/settings.move new file mode 100644 index 0000000..d121757 --- /dev/null +++ b/contracts/sources/settings.move @@ -0,0 +1,97 @@ +module galliun::settings { + // === Imports === + + use galliun::{ + // attributes::{Self}, + // factory_settings::{FactorySetings}, + // water_cooler::{Self, WaterCooler}, + // capsule::{Capsule}, + // image::{Image}, + // registry::{Registry} + }; + + // === Errors === + + // === Structs === + + public struct Settings has key { + id: UID, + // We add this id so we can insure that the water cooler that + // is passed coresponds with the current mint settings + // We have to add it here because we cannot do the check in the + // watercooler module as there will be a circular dependency + // between the Setting in the Mint module and the Water Cooler + // in the watercooler modules + // waterCoolerId: ID, + // This is the price that must be paid by the minter to get the NFT + price: u64, + /// The phase determins the current minting phase + /// 1 = og + /// 2 = whiteList + /// 3 = public + phase: u8, + /// The state determings whether the mint is active or not + /// 0 = inactive + /// 1 = active + status: u8, + } + + // Admin cap of this registry can be used to make changes to the Registry + public struct SettingsAdminCap has key { id: UID } + + + // === Package Functions === + + public(package) fun new( + ctx: &mut TxContext, + ): Settings { + Settings { + id: object::new(ctx), + price: 0, + phase: 0, + status: 0, + } + } + + // === Public view functions === + public(package) fun uid_mut(self: &mut Settings): &mut UID { + &mut self.id + } + + public(package) fun price( + self: &Settings, + ): u64 { + self.price + } + + public(package) fun phase( + self: &Settings, + ): u8 { + self.phase + } + + public(package) fun status( + self: &Settings, + ): u8 { + self.status + } + + + #[allow(lint(share_owned))] + public(package) fun transfer_setting(self: Settings, ctx: &mut TxContext,) { + transfer::transfer(SettingsAdminCap { id: object::new(ctx) }, ctx.sender()); + transfer::share_object(self); + } + + public(package) fun set_price(self: &mut Settings, price: u64) { + self.price = price; + } + + public(package) fun set_status(self: &mut Settings, status: u8) { + self.status = status; + } + + public(package) fun set_phase(self: &mut Settings, phase: u8) { + self.phase = phase; + } +} \ No newline at end of file diff --git a/contracts/sources/warehouse.move b/contracts/sources/warehouse.move new file mode 100644 index 0000000..bace722 --- /dev/null +++ b/contracts/sources/warehouse.move @@ -0,0 +1,110 @@ +module galliun::warehouse { + // === Imports === + use sui::{ + table_vec::{Self, TableVec}, + }; + use galliun::{ + // attributes::{Self}, + capsule::{Capsule}, + // image::{Image}, + // registry::{Registry} + }; + + // === Errors === + + const EMintWarehouseAlreadyInitialized: u64 = 0; + + // === Structs === + + // Admin cap of this registry can be used to make changes to the Registry + public struct WarehouseAdminCap has key { id: UID } + + public struct Warehouse has key { + id: UID, + // We add this id so we can insure that the water cooler that + // is passed coresponds with the current mint settings + // We have to add it here because we cannot do the check in the + // watercooler module as there will be a circular dependency + // between the Setting in the Mint module and the Water Cooler + // in the watercooler modules + // waterCoolerId: ID, + nfts: TableVec, + is_initialized: bool, + } + + + // === Package Functions === + + public(package) fun new( + ctx: &mut TxContext, + ): Warehouse { + Warehouse { + id: object::new(ctx), + nfts: table_vec::empty(ctx), + is_initialized: false + } + } + + public fun stock( + warehouse: &mut Warehouse, + supply: u64, + mut vector_nfts: vector + ) { + assert!(warehouse.is_initialized == false, EMintWarehouseAlreadyInitialized); + + while (!vector_nfts.is_empty()) { + let nft = vector_nfts.pop_back(); + warehouse.nfts.push_back(nft); + }; + + vector_nfts.destroy_empty(); + + if (warehouse.nfts.length() as u64 == supply) { + warehouse.is_initialized = true; + } + } + + // // === Public view functions === + + public(package) fun count( + self: &Warehouse, + ): u64 { + self.nfts.length() + } + + public(package) fun is_initialized( + self: &Warehouse, + ): bool { + self.is_initialized + } + + public(package) fun is_empty( + self: &Warehouse, + ): bool { + self.nfts.is_empty() + } + + public(package) fun pop_nft( + self: &mut Warehouse, + ): Capsule { + self.nfts.pop_back() + } + + #[allow(lint(share_owned))] + public(package) fun transfer_warehouse(self: Warehouse, ctx: &mut TxContext) { + transfer::transfer(WarehouseAdminCap { id: object::new(ctx) }, ctx.sender()); + transfer::share_object(self); + } + + public(package) fun delete(self: Warehouse) { + let Warehouse { + id, + nfts, + is_initialized: _, + } = self; + + + nfts.destroy_empty(); + id.delete(); + } +} \ No newline at end of file diff --git a/contracts/sources/water_cooler.move b/contracts/sources/water_cooler.move index 27c1926..82fc09e 100755 --- a/contracts/sources/water_cooler.move +++ b/contracts/sources/water_cooler.move @@ -19,7 +19,7 @@ module galliun::water_cooler { // === Errors === const EWaterCoolerAlreadyInitialized: u64 = 0; - const ENFTNotFromCollection: u64 = 1; + // const ENFTNotFromCollection: u64 = 1; const ENFTAlreadyRevealed: u64 = 2; const ERegistryDoesNotMatchCooler: u64 = 3; const ECollectionDoesNotMatchCooler: u64 = 4; @@ -55,17 +55,21 @@ module galliun::water_cooler { // supply of NFTs in the collection collection_id: ID, // // This is the ID of the mint settings that manages the minting process for the NFTs - // setting_id: ID, + settings_id: ID, // // This is the ID of the mint wearhouse that will store the NFTs before mint - // wearhouse_id: ID, + warehouse_id: ID, is_initialized: bool, is_revealed: bool, // balance for creator balance: Balance, + // Stores the address of the wallet that created the Water Cooler + owner: address, + // This bool determins wether or not a to display the Water cooler on the launchpad + display: bool } // Admin cap of this Water Cooler to be used but the Cooler owner when making changes - public struct WaterCoolerAdminCap has key { id: UID } + public struct WaterCoolerAdminCap has key { id: UID, `for`: ID } // === Public mutative functions === @@ -103,28 +107,46 @@ module galliun::water_cooler { placeholder_image_url: String, supply: u64, treasury: address, + settings_id: ID, + warehouse_id: ID , ctx: &mut TxContext ): ID { let collection = collection::new(supply as u16, ctx); let registry = registry::create_registry(name, description, image_url, ctx); + // let settings = settings::new(ctx); + // let warehouse = warehouse::new(ctx); let waterCooler = WaterCooler { + id: object::new(ctx), + name, + description, + image_url, + placeholder_image_url, + supply, + nfts: table_vec::empty(ctx), + revealed_nfts: vector::empty(), + treasury, + registry_id: object::id(®istry), + collection_id: object::id(&collection), + // settings_id: object::id(&settings), + // warehouse_id: object::id(&warehouse), + settings_id, + warehouse_id, + is_initialized: false, + is_revealed: false, + balance: balance::zero(), + owner: ctx.sender(), + display: false + }; + + transfer::transfer( + WaterCoolerAdminCap { id: object::new(ctx), - name, - description, - image_url, - placeholder_image_url, - supply, - nfts: table_vec::empty(ctx), - revealed_nfts: vector::empty(), - treasury, - registry_id: object::id(®istry), - collection_id: object::id(&collection), - is_initialized: false, - is_revealed: false, - balance: balance::zero(), - }; + `for`: object::id(&waterCooler) + }, + ctx.sender() + ); let waterCoolerId = object::id(&waterCooler); @@ -132,8 +154,8 @@ module galliun::water_cooler { collection::transfer_collection(collection, ctx); registry::transfer_registry(registry, ctx); - - transfer::transfer(WaterCoolerAdminCap { id: object::new(ctx) }, ctx.sender()); + // settings::transfer_setting(settings, ctx); + // warehouse::transfer_warehouse(warehouse, ctx); waterCoolerId } @@ -152,6 +174,18 @@ module galliun::water_cooler { self.is_revealed } + public(package) fun get_warehouse_id( + self: &WaterCooler, + ): ID { + self.warehouse_id + } + + public(package) fun get_settings_id( + self: &WaterCooler, + ): ID { + self.settings_id + } + public(package) fun check_registry( self: &WaterCooler, registry: &Registry, @@ -233,7 +267,7 @@ module galliun::water_cooler { assert!(self.registry_id == object::id(registry), ERegistryDoesNotMatchCooler); assert!(self.collection_id == object::id(collection), ECollectionDoesNotMatchCooler); let nft_id = object::id(nft); - assert!(registry.is_nft_registered(nft_id), ENFTNotFromCollection); + // assert!(registry.is_nft_registered(nft_id), ENFTNotFromCollection); assert!(!self.revealed_nfts.contains(&nft_id), ENFTAlreadyRevealed); let attributes = attributes::admin_new(keys, values, ctx); @@ -249,50 +283,54 @@ module galliun::water_cooler { }; } - // public fun reveal_all_nfts( - // _: &WaterCoolerAdminCap, - // self: &mut WaterCooler, - // registry: &Registry, - // collection: &Collection, - // mut nfts: vector, - // mut keys: vector>, - // mut values: vector>, - // // _image: Image, - // image_url: String, - // ctx: &mut TxContext - // ) { - // assert!(self.registry_id == object::id(registry), ERegistryDoesNotMatchCooler); - // assert!(self.collection_id == object::id(collection), ECollectionDoesNotMatchCooler); - // let mut number = collection::supply(collection) as u64 - self.revealed_nfts.length(); - - // while (!keys.is_empty()) { - // let mut nft = nfts.borrow_mut(number); - // let nft_id = object::id(nft); - // assert!(registry.is_nft_registered(nft_id), ENFTNotFromCollection); - // assert!(!self.revealed_nfts.contains(&nft_id), ENFTAlreadyRevealed); - - // let mut attr_keys = keys.pop_back(); - // let attr_values = values.pop_back(); - - // let attributes = attributes::admin_new( - // attr_keys, - // attr_values, - // ctx - // ); - - // capsule::set_attributes(nft, attributes); - // // capsule::set_image(nft, image); - // capsule::set_image_url(nft, image_url); - - // self.revealed_nfts.push_back(nft_id); - - // number = number - 1; - // }; - - // if (self.revealed_nfts.length() == collection::supply(collection) as u64) { - // self.is_revealed = true; - // } - // } + public fun batch_reveal_nfts( + _: &WaterCoolerAdminCap, + self: &mut WaterCooler, + registry: &Registry, + collection: &Collection, + mut nfts: vector, + mut keys: vector>, + mut values: vector>, + // _image: Image, + mut image_urls: vector, + ctx: &mut TxContext + ) : vector { + assert!(self.registry_id == object::id(registry), ERegistryDoesNotMatchCooler); + assert!(self.collection_id == object::id(collection), ECollectionDoesNotMatchCooler); + let mut number = collection::supply(collection) as u64 - self.revealed_nfts.length(); + + while (!keys.is_empty()) { + let mut nft = nfts.borrow_mut(number); + let nft_id = object::id(nft); + // assert!(registry.is_nft_registered(nft_id), ENFTNotFromCollection); + assert!(!self.revealed_nfts.contains(&nft_id), ENFTAlreadyRevealed); + + let mut attr_keys = keys.pop_back(); + let attr_values = values.pop_back(); + + let attributes = attributes::admin_new( + attr_keys, + attr_values, + ctx + ); + + // capsule::set_feilds(nft, attributes, image_urls.pop_back()); + + capsule::set_attributes(nft, attributes); + // capsule::set_image(nft, image); + capsule::set_image_url(nft, image_urls.pop_back()); + + self.revealed_nfts.push_back(nft_id); + + number = number - 1; + }; + + if (self.revealed_nfts.length() == collection::supply(collection) as u64) { + self.is_revealed = true; + }; + + nfts + } public fun set_treasury(_: &WaterCoolerAdminCap, self: &mut WaterCooler, treasury: address) { self.treasury = treasury; @@ -339,6 +377,10 @@ module galliun::water_cooler { public fun placeholder_image(self: &WaterCooler): String { self.placeholder_image_url } + + public fun owner(self: &WaterCooler): address { + self.owner + } // === Test Functions === diff --git a/contracts/tests/helpers.move b/contracts/tests/helpers.move index b4891a4..d08e39c 100755 --- a/contracts/tests/helpers.move +++ b/contracts/tests/helpers.move @@ -8,8 +8,9 @@ module galliun::helpers { }; use galliun::{ cooler_factory::{init_for_cooler}, - mint::{init_for_mint}, - water_cooler::{Self, init_for_water} + orchestrator::{init_for_orchestrator}, + water_cooler::{Self, init_for_water}, + factory_settings::{init_for_factory_settings} }; // === Constants === @@ -26,11 +27,14 @@ module galliun::helpers { clock::share_for_testing(clock); }; { - init_for_mint(ts::ctx(scenario)); + init_for_orchestrator(ts::ctx(scenario)); }; { init_for_water(ts::ctx(scenario)); }; + { + init_for_factory_settings(ts::ctx(scenario)); + }; scenario_val } diff --git a/contracts/tests/test_claim_mint.move b/contracts/tests/test_claim_mint.move index 89037de..adf66a0 100755 --- a/contracts/tests/test_claim_mint.move +++ b/contracts/tests/test_claim_mint.move @@ -3,7 +3,7 @@ module galliun::test_claim_mint { // === Imports === use sui::{ test_scenario::{Self as ts, next_tx}, - coin::{Self}, + coin::{Self, Coin}, sui::SUI, test_utils::{assert_eq}, kiosk::{Self}, @@ -13,13 +13,16 @@ module galliun::test_claim_mint { use galliun::{ helpers::{init_test_helper}, water_cooler::{Self, WaterCooler, WaterCoolerAdminCap}, - mizu_nft::{MizuNFT}, + capsule::{Capsule}, cooler_factory::{Self, CoolerFactory}, - mint::{Self, Mint, MintCap, MintAdminCap, MintSettings, MintWarehouse, OriginalGangsterTicket}, - attributes::{Self, Attributes, CreateAttributesCap}, + orchestrator::{Self, WhitelistTicket, OrchAdminCap, OrchCap, OriginalGangsterTicket}, + attributes::{Self, Attributes}, + warehouse::{Self, Warehouse, WarehouseAdminCap}, collection::{Collection}, registry::{Registry}, - image::{Self, Image} + image::{Self, Image}, + settings::{Settings}, + factory_settings::{FactorySetings} }; // === Constants === @@ -30,13 +33,13 @@ module galliun::test_claim_mint { // === Test functions === #[test] - #[expected_failure(abort_code = 0000000000000000000000000000000000000000000000000000000000000002::kiosk::EItemLocked)] + //#[expected_failure(abort_code = 0000000000000000000000000000000000000000000000000000000000000002::kiosk::EItemLocked)] public fun test_claim_mint() { let mut scenario_test = init_test_helper(); let scenario = &mut scenario_test; - // User has to buy water_cooler from cooler_factory share object. + // User has to buy water_cooler from cooler_factory share object. next_tx(scenario, TEST_ADDRESS1); { let mut cooler_factory = ts::take_shared(scenario); @@ -59,14 +62,20 @@ module galliun::test_claim_mint { TEST_ADDRESS1, ts::ctx(scenario) ); - // check the balance - assert_eq(cooler_factory.get_balance(), 100_000_000); ts::return_shared(cooler_factory); }; + // check the balance of galliun_treasury + next_tx(scenario, TEST_ADDRESS1); + { + let coin_ = ts::take_from_address>(scenario, @galliun_treasury); + assert_eq(coin_.value(), 100_000_000); + + ts::return_to_address(@galliun_treasury, coin_); + }; // init WaterCooler. the number count to 1. So it is working. - ts::next_tx(scenario, TEST_ADDRESS1); + next_tx(scenario, TEST_ADDRESS1); { let mut water_cooler = ts::take_shared(scenario); let water_cooler_admin_cap = ts::take_from_sender(scenario); @@ -81,11 +90,11 @@ module galliun::test_claim_mint { ts::return_to_sender(scenario, water_cooler_admin_cap); }; - ts::next_tx(scenario, TEST_ADDRESS1); + next_tx(scenario, TEST_ADDRESS1); { let water_cooler = ts::take_shared(scenario); // Check Nft Created - assert!(ts::has_most_recent_for_sender(scenario), 0); + assert!(ts::has_most_recent_for_sender(scenario), 0); assert!(water_cooler.is_initialized() == true, 0); // the number of supply should be stay as 150. assert_eq(water_cooler.supply(), 150); @@ -94,74 +103,83 @@ module galliun::test_claim_mint { ts::return_shared(water_cooler); }; // we can push MizuNFT into the warehouse - ts::next_tx(scenario, TEST_ADDRESS1); + next_tx(scenario, TEST_ADDRESS1); { - let mint_cap = ts::take_from_sender(scenario); + let mint_cap = ts::take_from_sender(scenario); let water_cooler = ts::take_shared(scenario); - let mut mint_warehouse = ts::take_shared(scenario); - let nft = ts::take_from_sender(scenario); - let mut vector_mizu = vector::empty(); + let mut mint_warehouse = ts::take_shared(scenario); + let nft = ts::take_from_sender(scenario); + let mut vector_mizu = vector::empty(); vector_mizu.push_back(nft); - mint::add_to_mint_warehouse( + orchestrator::stock_warehouse( &mint_cap, &water_cooler, vector_mizu, &mut mint_warehouse ); // the nft's length should be equal to 1 - assert_eq(mint::get_mintwarehouse_length(&mint_warehouse), 1); + assert_eq(orchestrator::get_mintwarehouse_length(&mint_warehouse), 1); ts::return_to_sender(scenario, mint_cap); ts::return_shared(mint_warehouse); ts::return_shared(water_cooler); }; // set mint_price and status - ts::next_tx(scenario, TEST_ADDRESS1); + next_tx(scenario, TEST_ADDRESS1); { - let mint_cap = ts::take_from_sender(scenario); - let mut mint_settings = ts::take_shared(scenario); + let mint_cap = ts::take_from_sender(scenario); + let mut mint_settings = ts::take_shared(scenario); let price: u64 = 1_000_000_000; let status: u8 = 1; let phase: u8 = 1; - mint::set_mint_price(&mint_cap, &mut mint_settings, price); - mint::set_mint_status(&mint_cap, &mut mint_settings, status); - mint::set_mint_phase(&mint_cap, &mut mint_settings, phase); + orchestrator::set_mint_price(&mint_cap, &mut mint_settings, price); + orchestrator::set_mint_status(&mint_cap, &mut mint_settings, status); + orchestrator::set_mint_phase(&mint_cap, &mut mint_settings, phase); ts::return_to_sender(scenario, mint_cap); ts::return_shared(mint_settings); }; - // we must create WhitelistTicket - ts::next_tx(scenario, TEST_ADDRESS1); + // // we must create WhitelistTicket + next_tx(scenario, TEST_ADDRESS1); { - let mint_cap = ts::take_from_sender(scenario); - let mint_warehouse = ts::take_shared(scenario); - mint::create_og_ticket(&mint_cap, &mint_warehouse, TEST_ADDRESS1, ts::ctx(scenario)); + let mint_cap = ts::take_from_sender(scenario); + let mint_warehouse = ts::take_shared(scenario); + orchestrator::create_og_ticket(&mint_cap, &mint_warehouse, TEST_ADDRESS1, ts::ctx(scenario)); ts::return_to_sender(scenario, mint_cap); ts::return_shared(mint_warehouse); }; - // we can do whitelist_mint - ts::next_tx(scenario, TEST_ADDRESS1); + next_tx(scenario, TEST_ADDRESS1); { - let mint_settings = ts::take_shared(scenario); - let mut mint_warehouse = ts::take_shared(scenario); + let settings = ts::take_shared(scenario); + let mut warehouse = ts::take_shared(scenario); + let factory_settings = ts::take_shared(scenario); + let water_cooler = ts::take_shared(scenario); let ticket = ts::take_from_sender(scenario); let coin_ = coin::mint_for_testing(1_000_000_000, ts::ctx(scenario)); - mint::og_mint(ticket, &mut mint_warehouse, &mint_settings, coin_, ts::ctx(scenario)); + orchestrator::og_mint( + ticket, + &factory_settings, + &water_cooler, + &mut warehouse, + &settings, + coin_, + ts::ctx(scenario)); - ts::return_shared(mint_warehouse); - ts::return_shared(mint_settings); + ts::return_shared(warehouse); + ts::return_shared(settings); + ts::return_shared(water_cooler); + ts::return_shared(factory_settings); }; // user needs to create Attributes and set the reveal_mint function - ts::next_tx(scenario, TEST_ADDRESS1); + next_tx(scenario, TEST_ADDRESS1); { - let attributes_cap = ts::take_from_sender(scenario); let mut key_vector = vector::empty(); let key1 = string::utf8(b"key1"); let key2 = string::utf8(b"key2"); @@ -174,8 +192,7 @@ module galliun::test_claim_mint { values_vector.push_back(value1); values_vector.push_back(value2); - let attributes = attributes::new( - attributes_cap, + let attributes = attributes::admin_new( key_vector, values_vector, ts::ctx(scenario) @@ -184,11 +201,8 @@ module galliun::test_claim_mint { }; // user needs to create Attributes and set the reveal_mint function - ts::next_tx(scenario, TEST_ADDRESS1); + next_tx(scenario, TEST_ADDRESS1); { - let mut _mint = ts::take_shared(scenario); - let image_ = string::utf8(b"image"); - let mut image_chunk_hashes = vector::empty(); let value1 = string::utf8(b"value1"); let value2 = string::utf8(b"value2"); @@ -196,77 +210,95 @@ module galliun::test_claim_mint { image_chunk_hashes.push_back(value1); image_chunk_hashes.push_back(value2); - let nft_id = mint::get_nft_id(&_mint); + // create image object + let image_ = string::utf8(b"image"); + let value1 = string::utf8(b"value1"); + let value2 = string::utf8(b"value2"); - let image_cap = image::issue_create_image_cap(25, nft_id, ts::ctx(scenario)); - image::create_image( - image_cap, - image_, - image_chunk_hashes, + image::inscribe_image( + image_, + value1, + value2, ts::ctx(scenario) ); - ts::return_shared(_mint); - }; // set the reveal_mint - ts::next_tx(scenario, TEST_ADDRESS1); + next_tx(scenario, TEST_ADDRESS1); { - let mint_cap = ts::take_from_sender(scenario); - let mut mint_ = ts::take_shared(scenario); - let attributes = ts::take_from_sender(scenario); - let image_ = string::utf8(b"image"); - - let image = ts::take_from_sender(scenario); + let water_cooler_admin_cap = ts::take_from_sender(scenario); + let mut water_cooler = ts::take_shared(scenario); + let registry = ts::take_from_sender(scenario); + let collection = ts::take_from_sender(scenario); + let mut capsule = ts::take_from_sender(scenario); - mint::reveal_mint( - &mint_cap, - &mut mint_, - attributes, - image, - image_ - ); + let mut key_vector = vector::empty(); + let key1 = string::utf8(b"key1"); + let key2 = string::utf8(b"key2"); + key_vector.push_back(key1); + key_vector.push_back(key2); - assert_eq(mint::get_mint_reveal(&mint_), true); + let mut values_vector = vector::empty(); + let value1 = string::utf8(b"value1"); + let value2 = string::utf8(b"value2"); + values_vector.push_back(value1); + values_vector.push_back(value2); - ts::return_to_sender(scenario, mint_cap); - ts::return_shared(mint_); - }; - // user needs to creat his own kiosk - ts::next_tx(scenario, TEST_ADDRESS1); - { - let (mut kiosk, cap) = kiosk::new(ts::ctx(scenario)); - let mut water_cooler = ts::take_shared(scenario); - let mint = ts::take_shared(scenario); - let policy = ts::take_shared>(scenario); - let nft_id = mint::get_nft_id(&mint); + let image = string::utf8(b"image"); - mint::claim_mint( + water_cooler::reveal_nft( + &water_cooler_admin_cap, &mut water_cooler, - mint, - &mut kiosk, - &cap, - &policy, + ®istry, + &collection, + &mut capsule, + key_vector, + values_vector, + image, ts::ctx(scenario) ); - assert_eq(kiosk::has_item(&kiosk, nft_id), true); - assert_eq(kiosk::is_locked(&kiosk, nft_id), true); - assert_eq(kiosk::is_listed(&kiosk, nft_id), false); - assert_eq(kiosk::item_count(&kiosk), 1); - - // we are expecting an error. we cant take that nft. - let item = kiosk::take( - &mut kiosk, - &cap, - nft_id - ); - transfer::public_transfer(item, TEST_ADDRESS1); - - transfer::public_transfer(cap, TEST_ADDRESS1); - transfer::public_share_object(kiosk); + ts::return_to_sender(scenario, water_cooler_admin_cap); + ts::return_to_sender(scenario, registry); + ts::return_to_sender(scenario, capsule); + ts::return_to_sender(scenario, collection); ts::return_shared(water_cooler); - ts::return_shared(policy); - }; + }; + // user needs to creat his own kiosk + // next_tx(scenario, TEST_ADDRESS1); + // { + // let (mut kiosk, cap) = kiosk::new(ts::ctx(scenario)); + // let mut water_cooler = ts::take_shared(scenario); + // let mint = ts::take_shared(scenario); + // let policy = ts::take_shared>(scenario); + // let nft_id = mint::get_nft_id(&mint); + + // mint::claim_mint( + // &mut water_cooler, + // mint, + // &mut kiosk, + // &cap, + // &policy, + // ts::ctx(scenario) + // ); + // assert_eq(kiosk::has_item(&kiosk, nft_id), true); + // assert_eq(kiosk::is_locked(&kiosk, nft_id), true); + // assert_eq(kiosk::is_listed(&kiosk, nft_id), false); + // assert_eq(kiosk::item_count(&kiosk), 1); + + // // we are expecting an error. we cant take that nft. + // let item = kiosk::take( + // &mut kiosk, + // &cap, + // nft_id + // ); + + // transfer::public_transfer(item, TEST_ADDRESS1); + + // transfer::public_transfer(cap, TEST_ADDRESS1); + // transfer::public_share_object(kiosk); + // ts::return_shared(water_cooler); + // ts::return_shared(policy); + // }; ts::end(scenario_test); } diff --git a/contracts/tests/test_og_mint.move b/contracts/tests/test_og_mint.move index 1394471..6529cde 100755 --- a/contracts/tests/test_og_mint.move +++ b/contracts/tests/test_og_mint.move @@ -3,29 +3,36 @@ module galliun::test_og_mint { // === Imports === use sui::{ test_scenario::{Self as ts, next_tx}, - coin::{Self}, + coin::{Self, Coin}, sui::SUI, test_utils::{assert_eq}, + kiosk::{Self}, + transfer_policy::{TransferPolicy} }; + use std::string::{Self, String}; use galliun::{ helpers::{init_test_helper}, water_cooler::{Self, WaterCooler, WaterCoolerAdminCap}, - mizu_nft::{MizuNFT}, - cooler_factory::{Self, CoolerFactory}, - mint::{Self, MintAdminCap, MintSettings, MintWarehouse, OriginalGangsterTicket}, + capsule::{Capsule}, + cooler_factory::{Self, CoolerFactory, FactoryOwnerCap}, + orchestrator::{Self, WhitelistTicket, OrchAdminCap, OrchCap, OriginalGangsterTicket}, + attributes::{Self, Attributes}, + warehouse::{Self, Warehouse, WarehouseAdminCap}, collection::{Collection}, registry::{Registry}, + image::{Self, Image}, + settings::{Settings}, + factory_settings::{FactorySetings} }; // === Constants === - // const ADMIN: address = @0xA; + const ADMIN: address = @0xA; const TEST_ADDRESS1: address = @0xB; // const TEST_ADDRESS2: address = @0xC; // === Test functions === - #[test] - public fun test_og_mint() { + public fun test_water_cooler() { let mut scenario_test = init_test_helper(); let scenario = &mut scenario_test; @@ -39,7 +46,7 @@ module galliun::test_og_mint { let name = b"watercoolername".to_string(); let description = b"some desc".to_string(); let image_url = b"https://media.nfts.photos/nft.jpg".to_string(); - let placeholder_image_url = b"https://media.nfts.photos/nft.jpg".to_string(); + let placeholder_image_url = b"https://media.nfts.photos/placeholder.jpg".to_string(); let supply = 150; cooler_factory::buy_water_cooler( @@ -53,14 +60,12 @@ module galliun::test_og_mint { TEST_ADDRESS1, ts::ctx(scenario) ); - // check the balance - assert_eq(cooler_factory.get_balance(), 100_000_000); ts::return_shared(cooler_factory); }; // init WaterCooler. the number count to 1. So it is working. - ts::next_tx(scenario, TEST_ADDRESS1); + next_tx(scenario, TEST_ADDRESS1); { let mut water_cooler = ts::take_shared(scenario); let water_cooler_admin_cap = ts::take_from_sender(scenario); @@ -74,54 +79,42 @@ module galliun::test_og_mint { ts::return_to_sender(scenario, registry); ts::return_to_sender(scenario, water_cooler_admin_cap); }; - - ts::next_tx(scenario, TEST_ADDRESS1); - { - let water_cooler = ts::take_shared(scenario); - // Check Nft Created - assert!(ts::has_most_recent_for_sender(scenario), 0); - assert!(water_cooler.is_initialized() == true, 0); - // the number of supply should be stay as 150. - assert_eq(water_cooler.supply(), 150); - // in the vec_map the nft ID 's are must be 150. - assert_eq(water_cooler.get_nfts_num(), 150); - ts::return_shared(water_cooler); - }; + // we can push MizuNFT into the warehouse - ts::next_tx(scenario, TEST_ADDRESS1); + next_tx(scenario, TEST_ADDRESS1); { - let mint_cap = ts::take_from_sender(scenario); + let mint_cap = ts::take_from_sender(scenario); let water_cooler = ts::take_shared(scenario); - let mut mint_warehouse = ts::take_shared(scenario); - let nft = ts::take_from_sender(scenario); - let mut vector_mizu = vector::empty(); + let mut mint_warehouse = ts::take_shared(scenario); + let nft = ts::take_from_sender(scenario); + let mut vector_mizu = vector::empty(); vector_mizu.push_back(nft); - mint::add_to_mint_warehouse( + orchestrator::stock_warehouse( &mint_cap, &water_cooler, vector_mizu, &mut mint_warehouse ); // the nft's length should be equal to 1 - assert_eq(mint::get_mintwarehouse_length(&mint_warehouse), 1); + assert_eq(orchestrator::get_mintwarehouse_length(&mint_warehouse), 1); ts::return_to_sender(scenario, mint_cap); ts::return_shared(mint_warehouse); ts::return_shared(water_cooler); }; // set mint_price and status - ts::next_tx(scenario, TEST_ADDRESS1); + next_tx(scenario, TEST_ADDRESS1); { - let mint_cap = ts::take_from_sender(scenario); - let mut mint_settings = ts::take_shared(scenario); + let mint_cap = ts::take_from_sender(scenario); + let mut mint_settings = ts::take_shared(scenario); let price: u64 = 1_000_000_000; let status: u8 = 1; let phase: u8 = 1; - mint::set_mint_price(&mint_cap, &mut mint_settings, price); - mint::set_mint_status(&mint_cap, &mut mint_settings, status); - mint::set_mint_phase(&mint_cap, &mut mint_settings, phase); + orchestrator::set_mint_price(&mint_cap, &mut mint_settings, price); + orchestrator::set_mint_status(&mint_cap, &mut mint_settings, status); + orchestrator::set_mint_phase(&mint_cap, &mut mint_settings, phase); ts::return_to_sender(scenario, mint_cap); @@ -129,27 +122,38 @@ module galliun::test_og_mint { }; // we must create WhitelistTicket - ts::next_tx(scenario, TEST_ADDRESS1); + next_tx(scenario, TEST_ADDRESS1); { - let mint_cap = ts::take_from_sender(scenario); - let mint_warehouse = ts::take_shared(scenario); - mint::create_og_ticket(&mint_cap, &mint_warehouse, TEST_ADDRESS1, ts::ctx(scenario)); + let mint_cap = ts::take_from_sender(scenario); + let mint_warehouse = ts::take_shared(scenario); + orchestrator::create_og_ticket(&mint_cap, &mint_warehouse, TEST_ADDRESS1, ts::ctx(scenario)); ts::return_to_sender(scenario, mint_cap); ts::return_shared(mint_warehouse); }; // we can do whitelist_mint - ts::next_tx(scenario, TEST_ADDRESS1); + next_tx(scenario, TEST_ADDRESS1); { - let mint_settings = ts::take_shared(scenario); - let mut mint_warehouse = ts::take_shared(scenario); + let settings = ts::take_shared(scenario); + let mut warehouse = ts::take_shared(scenario); + let factory_settings = ts::take_shared(scenario); + let water_cooler = ts::take_shared(scenario); let ticket = ts::take_from_sender(scenario); let coin_ = coin::mint_for_testing(1_000_000_000, ts::ctx(scenario)); - mint::og_mint(ticket, &mut mint_warehouse, &mint_settings, coin_, ts::ctx(scenario)); + orchestrator::og_mint( + ticket, + &factory_settings, + &water_cooler, + &mut warehouse, + &settings, + coin_, + ts::ctx(scenario)); - ts::return_shared(mint_warehouse); - ts::return_shared(mint_settings); + ts::return_shared(warehouse); + ts::return_shared(settings); + ts::return_shared(water_cooler); + ts::return_shared(factory_settings); }; ts::end(scenario_test); } diff --git a/contracts/tests/test_public_mint.move b/contracts/tests/test_public_mint.move index 44bbe74..5fb0731 100755 --- a/contracts/tests/test_public_mint.move +++ b/contracts/tests/test_public_mint.move @@ -3,21 +3,26 @@ module galliun::test_public_mint { // === Imports === use sui::{ test_scenario::{Self as ts, next_tx}, - coin::{Self}, + coin::{Self, Coin}, sui::SUI, test_utils::{assert_eq}, + kiosk::{Self}, + transfer_policy::{TransferPolicy} }; use std::string::{Self, String}; use galliun::{ helpers::{init_test_helper}, water_cooler::{Self, WaterCooler, WaterCoolerAdminCap}, - mizu_nft::{MizuNFT}, - cooler_factory::{Self, CoolerFactory}, - mint::{Self, Mint, MintCap, MintAdminCap, MintSettings, MintWarehouse}, + capsule::{Capsule}, + cooler_factory::{Self, CoolerFactory, FactoryOwnerCap}, + orchestrator::{Self, WhitelistTicket, OrchAdminCap, OrchCap, OriginalGangsterTicket}, + attributes::{Self, Attributes}, + warehouse::{Self, Warehouse, WarehouseAdminCap}, collection::{Collection}, registry::{Registry}, - attributes::{Self, Attributes, CreateAttributesCap}, - image::{Self, Image, CreateImageCap} + image::{Self, Image}, + settings::{Settings}, + factory_settings::{FactorySetings} }; // === Constants === @@ -41,7 +46,7 @@ module galliun::test_public_mint { let name = b"watercoolername".to_string(); let description = b"some desc".to_string(); let image_url = b"https://media.nfts.photos/nft.jpg".to_string(); - let placeholder_image_url = b"https://media.nfts.photos/nft.jpg".to_string(); + let placeholder_image_url = b"https://media.nfts.photos/placeholder.jpg".to_string(); let supply = 150; cooler_factory::buy_water_cooler( @@ -55,14 +60,12 @@ module galliun::test_public_mint { TEST_ADDRESS1, ts::ctx(scenario) ); - // check the balance - assert_eq(cooler_factory.get_balance(), 100_000_000); ts::return_shared(cooler_factory); }; // init WaterCooler. the number count to 1. So it is working. - ts::next_tx(scenario, TEST_ADDRESS1); + next_tx(scenario, TEST_ADDRESS1); { let mut water_cooler = ts::take_shared(scenario); let water_cooler_admin_cap = ts::take_from_sender(scenario); @@ -81,7 +84,7 @@ module galliun::test_public_mint { { let water_cooler = ts::take_shared(scenario); // Check Nft Created - assert!(ts::has_most_recent_for_sender(scenario), 0); + assert!(ts::has_most_recent_for_sender(scenario), 0); assert!(water_cooler.is_initialized() == true, 0); // the number of supply should be stay as 150. assert_eq(water_cooler.supply(), 150); @@ -89,24 +92,25 @@ module galliun::test_public_mint { assert_eq(water_cooler.get_nfts_num(), 150); ts::return_shared(water_cooler); }; + // we can push MizuNFT into the warehouse - ts::next_tx(scenario, TEST_ADDRESS1); + next_tx(scenario, TEST_ADDRESS1); { - let mint_cap = ts::take_from_sender(scenario); + let mint_cap = ts::take_from_sender(scenario); let water_cooler = ts::take_shared(scenario); - let mut mint_warehouse = ts::take_shared(scenario); - let nft = ts::take_from_sender(scenario); - let mut vector_mizu = vector::empty(); + let mut mint_warehouse = ts::take_shared(scenario); + let nft = ts::take_from_sender(scenario); + let mut vector_mizu = vector::empty(); vector_mizu.push_back(nft); - mint::add_to_mint_warehouse( + orchestrator::stock_warehouse( &mint_cap, &water_cooler, vector_mizu, &mut mint_warehouse ); // the nft's length should be equal to 1 - assert_eq(mint::get_mintwarehouse_length(&mint_warehouse), 1); + assert_eq(orchestrator::get_mintwarehouse_length(&mint_warehouse), 1); ts::return_to_sender(scenario, mint_cap); ts::return_shared(mint_warehouse); @@ -115,15 +119,15 @@ module galliun::test_public_mint { // set mint_price and status ts::next_tx(scenario, TEST_ADDRESS1); { - let mint_cap = ts::take_from_sender(scenario); - let mut mint_settings = ts::take_shared(scenario); + let mint_cap = ts::take_from_sender(scenario); + let mut mint_settings = ts::take_shared(scenario); let price: u64 = 1_000_000_000; let status: u8 = 1; let phase: u8 = 3; - mint::set_mint_price(&mint_cap, &mut mint_settings, price); - mint::set_mint_status(&mint_cap, &mut mint_settings, status); - mint::set_mint_phase(&mint_cap, &mut mint_settings, phase); + orchestrator::set_mint_price(&mint_cap, &mut mint_settings, price); + orchestrator::set_mint_status(&mint_cap, &mut mint_settings, status); + orchestrator::set_mint_phase(&mint_cap, &mut mint_settings, phase); ts::return_to_sender(scenario, mint_cap); @@ -133,20 +137,29 @@ module galliun::test_public_mint { // we can publish_mint ts::next_tx(scenario, TEST_ADDRESS1); { - let mint_settings = ts::take_shared(scenario); - let mut mint_warehouse = ts::take_shared(scenario); + let settings = ts::take_shared(scenario); + let mut warehouse = ts::take_shared(scenario); + let factory_settings = ts::take_shared(scenario); + let water_cooler = ts::take_shared(scenario); let coin_ = coin::mint_for_testing(1_000_000_000, ts::ctx(scenario)); - mint::public_mint(&mut mint_warehouse, &mint_settings, coin_, ts::ctx(scenario)); + orchestrator::public_mint( + &water_cooler, + &factory_settings, + &mut warehouse, + &settings, + coin_, + ts::ctx(scenario) + ); - ts::return_shared(mint_warehouse); - ts::return_shared(mint_settings); + ts::return_shared(warehouse); + ts::return_shared(settings); + ts::return_shared(water_cooler); + ts::return_shared(factory_settings); }; // we should create Attributes and Image objects ts::next_tx(scenario, TEST_ADDRESS1); { - // create attributes - let attributes_cap = ts::take_from_sender(scenario); let mut key_vector = vector::empty(); let key1 = string::utf8(b"key1"); let key2 = string::utf8(b"key2"); @@ -159,50 +172,64 @@ module galliun::test_public_mint { values_vector.push_back(value1); values_vector.push_back(value2); - let attributes = attributes::new( - attributes_cap, + let attributes = attributes::admin_new( key_vector, values_vector, ts::ctx(scenario) ); + transfer::public_transfer(attributes, TEST_ADDRESS1); + // create image object let image_ = string::utf8(b"image"); - let mut image_chunk_hashes = vector::empty(); let value1 = string::utf8(b"value1"); let value2 = string::utf8(b"value2"); - image_chunk_hashes.push_back(value1); - image_chunk_hashes.push_back(value2); - - - let image_cap = ts::take_from_sender(scenario); - image::create_image( - image_cap, - image_, - image_chunk_hashes, + image::inscribe_image( + image_, + value1, + value2, ts::ctx(scenario) ); - transfer::public_transfer(attributes, TEST_ADDRESS1); }; // we can call reveal_mint ts::next_tx(scenario, TEST_ADDRESS1); { - let mint_cap = ts::take_from_sender(scenario); - let mut mint = ts::take_shared(scenario); - let attributes = ts::take_from_sender(scenario); - let image = ts::take_from_sender(scenario); + let mut water_cooler = ts::take_shared(scenario); + let water_cooler_admin_cap = ts::take_from_sender(scenario); + let registry = ts::take_from_sender(scenario); + let collection = ts::take_from_sender(scenario); + let mut nft = ts::take_from_sender(scenario); + + let mut key_vector = vector::empty(); + let key1 = string::utf8(b"key1"); + let key2 = string::utf8(b"key2"); + key_vector.push_back(key1); + key_vector.push_back(key2); + + let mut values_vector = vector::empty(); + let value1 = string::utf8(b"value1"); + let value2 = string::utf8(b"value2"); + values_vector.push_back(value1); + values_vector.push_back(value2); let image_url = b"https://media.nfts.photos/nft.jpg".to_string(); - mint::reveal_mint( - &mint_cap, - &mut mint, - attributes, - image, - image_url + water_cooler::reveal_nft( + &water_cooler_admin_cap, + &mut water_cooler, + ®istry, + &collection, + &mut nft, + key_vector, + values_vector, + image_url, + ts::ctx(scenario) ); - - ts::return_to_sender(scenario, mint_cap); - ts::return_shared(mint); + + ts::return_to_sender(scenario, nft); + ts::return_shared(water_cooler); + ts::return_to_sender(scenario, collection); + ts::return_to_sender(scenario, registry); + ts::return_to_sender(scenario, water_cooler_admin_cap); }; ts::end(scenario_test); } diff --git a/contracts/tests/test_water_cooler.move b/contracts/tests/test_water_cooler.move index 6ed7d36..fe6bd4b 100755 --- a/contracts/tests/test_water_cooler.move +++ b/contracts/tests/test_water_cooler.move @@ -3,17 +3,25 @@ module galliun::test_water_cooler { // === Imports === use sui::{ test_scenario::{Self as ts, next_tx}, - coin::{Self}, + coin::{Self, Coin}, sui::SUI, test_utils::{assert_eq}, + kiosk::{Self}, + transfer_policy::{TransferPolicy} }; + use std::string::{Self, String}; use galliun::{ helpers::{init_test_helper}, water_cooler::{Self, WaterCooler, WaterCoolerAdminCap}, - mizu_nft::{MizuNFT}, + capsule::{Capsule}, cooler_factory::{Self, CoolerFactory, FactoryOwnerCap}, + orchestrator::{Self, WhitelistTicket, OrchAdminCap, OrchCap, OriginalGangsterTicket}, + attributes::{Self, Attributes}, + warehouse::{Self, Warehouse, WarehouseAdminCap}, collection::{Collection}, registry::{Registry}, + image::{Self, Image}, + settings::{Settings}, }; // === Constants === @@ -37,7 +45,7 @@ module galliun::test_water_cooler { let name = b"watercoolername".to_string(); let description = b"some desc".to_string(); let image_url = b"https://media.nfts.photos/nft.jpg".to_string(); - let placeholder_image_url = b"https://media.nfts.photos/nft.jpg".to_string(); + let placeholder_image_url = b"https://media.nfts.photos/placeholder.jpg".to_string(); let supply = 150; cooler_factory::buy_water_cooler( @@ -51,26 +59,17 @@ module galliun::test_water_cooler { TEST_ADDRESS1, ts::ctx(scenario) ); - // check the balance - assert_eq(cooler_factory.get_balance(), 100_000_000); ts::return_shared(cooler_factory); }; - next_tx(scenario, ADMIN); + // check the balance of galliun_treasury + next_tx(scenario, TEST_ADDRESS1); { - let mut cooler_factory = ts::take_shared(scenario); - let cap = ts::take_from_sender(scenario); - - // confirm correct balance is 100_000_000 - let balance_ = cooler_factory::get_balance(&cooler_factory); - // it should be equal to 100_000_000 - assert_eq(balance_, 100_000_000); - // admin can claim fee which is 100_000_000 - cooler_factory::claim_fee(&cap, &mut cooler_factory, ts::ctx(scenario)); - - ts::return_to_sender(scenario, cap); - ts::return_shared(cooler_factory); + let coin_ = ts::take_from_address>(scenario, @galliun_treasury); + assert_eq(coin_.value(), 100_000_000); + + ts::return_to_address(@galliun_treasury, coin_); }; // set the new fee next_tx(scenario, ADMIN); @@ -87,7 +86,7 @@ module galliun::test_water_cooler { }; // init WaterCooler. the number count to 1. So it is working. - ts::next_tx(scenario, TEST_ADDRESS1); + next_tx(scenario, TEST_ADDRESS1); { let mut water_cooler = ts::take_shared(scenario); let water_cooler_admin_cap = ts::take_from_sender(scenario); @@ -102,18 +101,18 @@ module galliun::test_water_cooler { ts::return_to_sender(scenario, water_cooler_admin_cap); }; // check that does user has MizuNFT ? - ts::next_tx(scenario, TEST_ADDRESS1); + next_tx(scenario, TEST_ADDRESS1); { - let nft = ts::take_from_sender(scenario); + let nft = ts::take_from_sender(scenario); ts::return_to_sender(scenario, nft); }; - ts::next_tx(scenario, TEST_ADDRESS1); + next_tx(scenario, TEST_ADDRESS1); { let water_cooler = ts::take_shared(scenario); // Check Nft Created - assert!(ts::has_most_recent_for_sender(scenario), 0); + assert!(ts::has_most_recent_for_sender(scenario), 0); assert!(water_cooler.is_initialized() == true, 0); // the number of supply should be stay as 150. assert_eq(water_cooler.supply(), 150); @@ -124,4 +123,4 @@ module galliun::test_water_cooler { ts::end(scenario_test); } -} \ No newline at end of file +} diff --git a/contracts/tests/test_whitelist_mint.move b/contracts/tests/test_whitelist_mint.move index 3dd5edb..0f68ef0 100755 --- a/contracts/tests/test_whitelist_mint.move +++ b/contracts/tests/test_whitelist_mint.move @@ -3,18 +3,26 @@ module galliun::test_whitelist_mint { // === Imports === use sui::{ test_scenario::{Self as ts, next_tx}, - coin::{Self}, + coin::{Self, Coin}, sui::SUI, test_utils::{assert_eq}, + kiosk::{Self}, + transfer_policy::{TransferPolicy} }; + use std::string::{Self, String}; use galliun::{ helpers::{init_test_helper}, water_cooler::{Self, WaterCooler, WaterCoolerAdminCap}, - mizu_nft::{MizuNFT}, - cooler_factory::{Self, CoolerFactory}, - mint::{Self, MintAdminCap, MintSettings, MintWarehouse, WhitelistTicket}, + capsule::{Capsule}, + cooler_factory::{Self, CoolerFactory, FactoryOwnerCap}, + orchestrator::{Self, WhitelistTicket, OrchAdminCap, OrchCap, OriginalGangsterTicket}, + attributes::{Self, Attributes}, + warehouse::{Self, Warehouse, WarehouseAdminCap}, collection::{Collection}, registry::{Registry}, + image::{Self, Image}, + settings::{Settings}, + factory_settings::{FactorySetings} }; // === Constants === @@ -38,7 +46,7 @@ module galliun::test_whitelist_mint { let name = b"watercoolername".to_string(); let description = b"some desc".to_string(); let image_url = b"https://media.nfts.photos/nft.jpg".to_string(); - let placeholder_image_url = b"https://media.nfts.photos/nft.jpg".to_string(); + let placeholder_image_url = b"https://media.nfts.photos/placeholder.jpg".to_string(); let supply = 150; cooler_factory::buy_water_cooler( @@ -52,12 +60,19 @@ module galliun::test_whitelist_mint { TEST_ADDRESS1, ts::ctx(scenario) ); - // check the balance - assert_eq(cooler_factory.get_balance(), 100_000_000); ts::return_shared(cooler_factory); }; + // check the balance of galliun_treasury + next_tx(scenario, TEST_ADDRESS1); + { + let coin_ = ts::take_from_address>(scenario, @galliun_treasury); + assert_eq(coin_.value(), 100_000_000); + + ts::return_to_address(@galliun_treasury, coin_); + }; + // init WaterCooler. the number count to 1. So it is working. ts::next_tx(scenario, TEST_ADDRESS1); { @@ -74,11 +89,12 @@ module galliun::test_whitelist_mint { ts::return_to_sender(scenario, water_cooler_admin_cap); }; - ts::next_tx(scenario, TEST_ADDRESS1); + next_tx(scenario, TEST_ADDRESS1); { let water_cooler = ts::take_shared(scenario); + // Check Nft Created - assert!(ts::has_most_recent_for_sender(scenario), 0); + assert!(ts::has_most_recent_for_sender(scenario), 0); assert!(water_cooler.is_initialized() == true, 0); // the number of supply should be stay as 150. assert_eq(water_cooler.supply(), 150); @@ -86,41 +102,41 @@ module galliun::test_whitelist_mint { assert_eq(water_cooler.get_nfts_num(), 150); ts::return_shared(water_cooler); }; - // we can push MizuNFT into the warehouse - ts::next_tx(scenario, TEST_ADDRESS1); + //we can push MizuNFT into the warehouse + next_tx(scenario, TEST_ADDRESS1); { - let mint_cap = ts::take_from_sender(scenario); + let mint_cap = ts::take_from_sender(scenario); let water_cooler = ts::take_shared(scenario); - let mut mint_warehouse = ts::take_shared(scenario); - let nft = ts::take_from_sender(scenario); - let mut vector_mizu = vector::empty(); + let mut mint_warehouse = ts::take_shared(scenario); + let nft = ts::take_from_sender(scenario); + let mut vector_mizu = vector::empty(); vector_mizu.push_back(nft); - mint::add_to_mint_warehouse( + orchestrator::stock_warehouse( &mint_cap, &water_cooler, vector_mizu, &mut mint_warehouse ); // the nft's length should be equal to 1 - assert_eq(mint::get_mintwarehouse_length(&mint_warehouse), 1); + assert_eq(orchestrator::get_mintwarehouse_length(&mint_warehouse), 1); ts::return_to_sender(scenario, mint_cap); ts::return_shared(mint_warehouse); ts::return_shared(water_cooler); }; // set mint_price and status - ts::next_tx(scenario, TEST_ADDRESS1); + next_tx(scenario, TEST_ADDRESS1); { - let mint_cap = ts::take_from_sender(scenario); - let mut mint_settings = ts::take_shared(scenario); + let mint_cap = ts::take_from_sender(scenario); + let mut mint_settings = ts::take_shared(scenario); let price: u64 = 1_000_000_000; let status: u8 = 1; let phase: u8 = 2; - mint::set_mint_price(&mint_cap, &mut mint_settings, price); - mint::set_mint_status(&mint_cap, &mut mint_settings, status); - mint::set_mint_phase(&mint_cap, &mut mint_settings, phase); + orchestrator::set_mint_price(&mint_cap, &mut mint_settings, price); + orchestrator::set_mint_status(&mint_cap, &mut mint_settings, status); + orchestrator::set_mint_phase(&mint_cap, &mut mint_settings, phase); ts::return_to_sender(scenario, mint_cap); @@ -128,27 +144,41 @@ module galliun::test_whitelist_mint { }; // we must create WhitelistTicket - ts::next_tx(scenario, TEST_ADDRESS1); + next_tx(scenario, TEST_ADDRESS1); { - let mint_cap = ts::take_from_sender(scenario); - let mint_warehouse = ts::take_shared(scenario); - mint::create_wl_ticket(&mint_cap, &mint_warehouse, TEST_ADDRESS1, ts::ctx(scenario)); + let mint_cap = ts::take_from_sender(scenario); + let mint_warehouse = ts::take_shared(scenario); + orchestrator::create_wl_ticket(&mint_cap, &mint_warehouse, TEST_ADDRESS1, ts::ctx(scenario)); ts::return_to_sender(scenario, mint_cap); ts::return_shared(mint_warehouse); }; // we can do whitelist_mint - ts::next_tx(scenario, TEST_ADDRESS1); + next_tx(scenario, TEST_ADDRESS1); { - let mint_settings = ts::take_shared(scenario); - let mut mint_warehouse = ts::take_shared(scenario); + let settings = ts::take_shared(scenario); + let mut warehouse = ts::take_shared(scenario); + let factory_settings = ts::take_shared(scenario); + let water_cooler = ts::take_shared(scenario); + let ticket = ts::take_from_sender(scenario); let coin_ = coin::mint_for_testing(1_000_000_000, ts::ctx(scenario)); - mint::whitelist_mint(ticket, &mut mint_warehouse, &mint_settings, coin_, ts::ctx(scenario)); + orchestrator::whitelist_mint( + ticket, + &factory_settings, + &water_cooler, + &mut warehouse, + &settings, + coin_, + ts::ctx(scenario) + ); - ts::return_shared(mint_warehouse); - ts::return_shared(mint_settings); + ts::return_shared(warehouse); + ts::return_shared(settings); + ts::return_shared(water_cooler); + ts::return_shared(factory_settings); + }; ts::end(scenario_test); }