diff --git a/locked-asset/factory/Cargo.toml b/locked-asset/factory/Cargo.toml index 6c8c075f6..e8661676b 100644 --- a/locked-asset/factory/Cargo.toml +++ b/locked-asset/factory/Cargo.toml @@ -20,6 +20,9 @@ path = "../../common/modules/token_merge" version = "=0.36.1" features = [ "esdt-token-payment-legacy-decode" ] +[dependencies.elrond-wasm-modules] +version = "=0.36.1" + [dev-dependencies.elrond-wasm-debug] version = "=0.36.1" diff --git a/locked-asset/factory/src/lib.rs b/locked-asset/factory/src/lib.rs index 6295b241b..a758faa50 100644 --- a/locked-asset/factory/src/lib.rs +++ b/locked-asset/factory/src/lib.rs @@ -42,9 +42,12 @@ pub trait LockedAssetFactory: + events::EventsModule + attr_ex_helper::AttrExHelper + migration::LockedTokenMigrationModule + + elrond_wasm_modules::pause::PauseModule { #[init] - fn init(&self) {} + fn init(&self) { + self.set_paused(true); + } #[only_owner] #[endpoint] @@ -68,6 +71,8 @@ pub trait LockedAssetFactory: start_epoch: Epoch, unlock_period: UnlockPeriod, ) -> OldEsdtTokenPayment { + self.require_not_paused(); + let caller = self.blockchain().get_caller(); require!( self.whitelisted_contracts().contains(&caller), @@ -103,6 +108,8 @@ pub trait LockedAssetFactory: address: ManagedAddress, start_epoch: Epoch, ) -> OldEsdtTokenPayment { + self.require_not_paused(); + let caller = self.blockchain().get_caller(); require!( self.whitelisted_contracts().contains(&caller), @@ -139,6 +146,8 @@ pub trait LockedAssetFactory: #[payable("*")] #[endpoint(unlockAssets)] fn unlock_assets(&self) { + self.require_not_paused(); + let (token_id, token_nonce, amount) = self.call_value().single_esdt().into_tuple(); let locked_token_id = self.locked_asset_token_id().get(); require!(token_id == locked_token_id, "Bad payment token"); diff --git a/locked-asset/factory/wasm/Cargo.lock b/locked-asset/factory/wasm/Cargo.lock index 9de6c8556..af5048f61 100644 --- a/locked-asset/factory/wasm/Cargo.lock +++ b/locked-asset/factory/wasm/Cargo.lock @@ -109,6 +109,15 @@ dependencies = [ "syn", ] +[[package]] +name = "elrond-wasm-modules" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "868f3dd7ae064f23b626cb197c83caa3bdadadd9cbc58d5a8ceff99942d04a47" +dependencies = [ + "elrond-wasm", +] + [[package]] name = "elrond-wasm-node" version = "0.36.1" @@ -141,6 +150,7 @@ dependencies = [ "common_errors", "common_structs", "elrond-wasm", + "elrond-wasm-modules", "token_merge", ] diff --git a/locked-asset/factory/wasm/src/lib.rs b/locked-asset/factory/wasm/src/lib.rs index 1ac075bf7..955c3b071 100644 --- a/locked-asset/factory/wasm/src/lib.rs +++ b/locked-asset/factory/wasm/src/lib.rs @@ -18,11 +18,14 @@ elrond_wasm_node::wasm_endpoints! { getLockedAssetTokenId getUnlockScheduleForSFTNonce getWhitelistedContracts + isPaused + pause removeWhitelist setBurnRoleForAddress setNewFactoryAddress setTransferRoleForAddress unlockAssets + unpause unsetTransferRoleForAddress whitelist )