Skip to content

Commit

Permalink
ref: validate amount sent and recipient addresses in execute_transfer…
Browse files Browse the repository at this point in the history
…_virtual_balance
  • Loading branch information
joemonem committed Oct 3, 2024
1 parent 5e04ae3 commit 61f088b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions contracts/liquidity/factory/src/execute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -946,6 +946,14 @@ pub fn execute_transfer_virtual_balance(
recipient_addresses: Vec<CrossChainUserWithLimit>,
timeout: Option<u64>,
) -> Result<Response, ContractError> {
// The transfer amount should be greater than zero
ensure!(!amount.is_zero(), ContractError::ZeroAssetAmount {});

// Validate recipient addresses
for recipient_address in recipient_addresses.iter() {
recipient_address.user.validate()?;
}

let state = STATE.load(deps.storage)?;

let channel = HUB_CHANNEL.load(deps.storage)?;
Expand Down

0 comments on commit 61f088b

Please sign in to comment.