diff --git a/bridge-token-factory/Cargo.lock b/bridge-token-factory/Cargo.lock index 2d1301d5..a9cf6290 100644 --- a/bridge-token-factory/Cargo.lock +++ b/bridge-token-factory/Cargo.lock @@ -471,7 +471,7 @@ dependencies = [ [[package]] name = "bridge-token-factory" -version = "0.2.2" +version = "0.2.3" dependencies = [ "anyhow", "bridge-common", diff --git a/bridge-token-factory/Cargo.toml b/bridge-token-factory/Cargo.toml index 8b29877b..449e7a47 100644 --- a/bridge-token-factory/Cargo.toml +++ b/bridge-token-factory/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bridge-token-factory" -version = "0.2.2" +version = "0.2.3" authors = ["Near Inc "] edition = "2021" publish = false diff --git a/bridge-token-factory/src/lib.rs b/bridge-token-factory/src/lib.rs index b9c7d7fc..e2c30150 100644 --- a/bridge-token-factory/src/lib.rs +++ b/bridge-token-factory/src/lib.rs @@ -508,18 +508,30 @@ impl BridgeTokenFactory { ) } - /// Pause or unpause the withdraw method in the bridge token contract. + /// Pause the withdraw method in the bridge token contract. /// /// # Arguments /// /// * `address`: Ethereum address of the token ERC20 contract, in hexadecimal format without `0x`. - /// * `paused`: `true` to pause the withdraw method in the bridge token contract, `false` to unpause. /// #[access_control_any(roles(Role::DAO, Role::PauseManager))] - pub fn set_paused_withdraw(&mut self, address: String, paused: bool) -> Promise { + pub fn pause_withdraw(&mut self, address: String) -> Promise { ext_bridge_token::ext(self.get_bridge_token_account_id(address)) .with_static_gas(SET_PAUSED_GAS) - .set_paused(paused) + .set_paused(true) + } + + /// Unpause the withdraw method in the bridge token contract. + /// + /// # Arguments + /// + /// * `address`: Ethereum address of the token ERC20 contract, in hexadecimal format without `0x`. + /// + #[access_control_any(roles(Role::DAO, Role::PauseManager))] + pub fn unpause_withdraw(&mut self, address: String) -> Promise { + ext_bridge_token::ext(self.get_bridge_token_account_id(address)) + .with_static_gas(SET_PAUSED_GAS) + .set_paused(false) } pub fn get_bridge_token_account_id(&self, address: String) -> AccountId { diff --git a/bridge-token-factory/tests/token_transfer.rs b/bridge-token-factory/tests/token_transfer.rs index bb08bacd..3f804e02 100644 --- a/bridge-token-factory/tests/token_transfer.rs +++ b/bridge-token-factory/tests/token_transfer.rs @@ -14,7 +14,8 @@ const FACTORY_WASM_PATH: &str = "../res/bridge_token_factory.wasm"; const FACTORY_WASM_PATH_V_0_1_6: &str = "res/bridge_token_factory_v0.1.6.wasm"; const BRIDGE_TOKEN_WASM_PATH: &str = "../res/bridge_token.wasm"; const MOCK_PROVER_WASM_PATH: &str = "../res/mock_prover.wasm"; - +const LAST_FACTORY_VERSION: &str = env!("CARGO_PKG_VERSION"); +const LAST_BRIDGE_TOKEN_VERSION: &str = "0.2.2"; const DEFAULT_DEPOSIT: u128 = ONE_NEAR; async fn create_contract(factory_wasm_path: &str) -> (Account, Contract, Worker) { @@ -534,7 +535,7 @@ async fn test_upgrade() { // Verify the factory version let factory_version: String = factory.view("version").await.unwrap().json().unwrap(); - assert_eq!(factory_version, "0.2.2"); + assert_eq!(factory_version, LAST_FACTORY_VERSION); // Set alice as super admin let result = factory @@ -582,7 +583,7 @@ async fn test_upgrade() { .unwrap() .json() .unwrap(); - assert_eq!(token_version, "0.2.2"); + assert_eq!(token_version, LAST_BRIDGE_TOKEN_VERSION); // Upgrade the bridge token over factory (redeploy the same version) let result = alice @@ -605,7 +606,7 @@ async fn test_upgrade() { .unwrap() .json() .unwrap(); - assert_eq!(token_version, "0.2.2"); + assert_eq!(token_version, LAST_BRIDGE_TOKEN_VERSION); // Grant alice the `PauseManager` role let result = alice @@ -627,9 +628,9 @@ async fn test_upgrade() { // Pause bridge token withdraw let result = alice - .call(factory.id(), "set_paused_withdraw") + .call(factory.id(), "pause_withdraw") .args( - json!({"address": DAI_ADDRESS.to_string(), "paused": true}) + json!({"address": DAI_ADDRESS.to_string()}) .to_string() .into_bytes(), ) diff --git a/res/bridge_token_factory.wasm b/res/bridge_token_factory.wasm index 8b20952b..685b0b06 100755 Binary files a/res/bridge_token_factory.wasm and b/res/bridge_token_factory.wasm differ