Skip to content

Commit

Permalink
fix: Allow deposits to be to any networkAddress
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonAndell committed May 30, 2024
1 parent 0dc3649 commit 8c89e3c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 17 deletions.
16 changes: 2 additions & 14 deletions contracts/core-contracts/cw-asset-manager/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down Expand Up @@ -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,
};
Expand Down
3 changes: 0 additions & 3 deletions contracts/token-contracts/cw-hub-bnusd/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -295,9 +295,6 @@ mod execute {
amount: u128,
data: Vec<u8>,
) -> Result<Response, ContractError> {
if !to.validate_foreign_addresses() {
return Err(ContractError::InvalidNetworkAddress);
}
ensure!(amount > 0, ContractError::InvalidAmount);

let funds = info.funds.clone();
Expand Down

0 comments on commit 8c89e3c

Please sign in to comment.