From 8c89e3c011be5277c5fcdb3f3dd6742a58fa1481 Mon Sep 17 00:00:00 2001 From: AntonAndell Date: Thu, 30 May 2024 09:08:22 +0200 Subject: [PATCH] fix: Allow deposits to be to any networkAddress --- .../cw-asset-manager/src/contract.rs | 16 ++-------------- .../token-contracts/cw-hub-bnusd/src/contract.rs | 3 --- 2 files changed, 2 insertions(+), 17 deletions(-) diff --git a/contracts/core-contracts/cw-asset-manager/src/contract.rs b/contracts/core-contracts/cw-asset-manager/src/contract.rs index 33624a8..7f23806 100644 --- a/contracts/core-contracts/cw-asset-manager/src/contract.rs +++ b/contracts/core-contracts/cw-asset-manager/src/contract.rs @@ -135,13 +135,7 @@ pub fn execute( ); let recipient: NetworkAddress = match to { - Some(to_address) => { - let nw_addr = NetworkAddress::from_str(&to_address).unwrap(); - if !nw_addr.validate_foreign_addresses() { - return Err(ContractError::InvalidRecipientAddress); - } - nw_addr - } + Some(to_address) => NetworkAddress::from_str(&to_address).unwrap(), // if `to` is not provided, sender address is used as recipient None => depositor, }; @@ -175,13 +169,7 @@ pub fn execute( ensure!(!amount.is_zero(), ContractError::InvalidAmount); let recipient: NetworkAddress = match to { - Some(to_address) => { - let nw_addr = NetworkAddress::from_str(&to_address).unwrap(); - if !nw_addr.validate_foreign_addresses() { - return Err(ContractError::InvalidRecipientAddress); - } - nw_addr - } + Some(to_address) => NetworkAddress::from_str(&to_address).unwrap(), // if `to` is not provided, sender address is used as recipient None => depositor, }; diff --git a/contracts/token-contracts/cw-hub-bnusd/src/contract.rs b/contracts/token-contracts/cw-hub-bnusd/src/contract.rs index b61b520..578f99f 100644 --- a/contracts/token-contracts/cw-hub-bnusd/src/contract.rs +++ b/contracts/token-contracts/cw-hub-bnusd/src/contract.rs @@ -295,9 +295,6 @@ mod execute { amount: u128, data: Vec, ) -> Result { - if !to.validate_foreign_addresses() { - return Err(ContractError::InvalidNetworkAddress); - } ensure!(amount > 0, ContractError::InvalidAmount); let funds = info.funds.clone();