Skip to content

Commit

Permalink
multiple amount by 100mio
Browse files Browse the repository at this point in the history
  • Loading branch information
luxeave committed Aug 9, 2024
1 parent 474bba7 commit 223e782
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/icp_subaccount_indexer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1120,9 +1120,14 @@ async fn sweep_subaccount(subaccountid_hex: String, amount: u64) -> Result<u64,
message: "Subaccount not found".to_string(),
})?;

// Convert amount to e8s, checking for overflow
let amount_e8s = amount.checked_mul(100_000_000).ok_or_else(|| Error {
message: "Amount overflow occurred".to_string(),
})?;

let transfer_args = TransferArgs {
memo: Memo(0),
amount: Tokens::from_e8s(amount),
amount: Tokens::from_e8s(amount_e8s),
fee: Tokens::from_e8s(10_000),
from_subaccount: Some(subaccount),
to: custodian_id,
Expand Down

0 comments on commit 223e782

Please sign in to comment.