Scale receiver balance.

This commit is contained in:
chriseth 2023-01-10 12:44:58 +01:00
parent 287666fa05
commit a57514ce8c

View file

@ -29,8 +29,9 @@ impl Safe {
let amount = (receiver.balance(&receiver.token_address)
* U256::from(trust_percentage as u128))
/ U256::from(100);
let scaled_receiver_balance = receiver_balance; // * U256::from((100 - trust_percentage) as u128) / U256::from(100);
if amount < scaled_receiver_balance {
let scaled_receiver_balance =
receiver_balance * U256::from((100 - trust_percentage) as u128) / U256::from(100);
if amount < receiver_balance {
U256::from(0)
} else {
// TODO it should not be "min" - the second constraint