What is this error? How to correct it?
Canister called `ic0.trap` with message: 'losing precision'.
Suspected code:
switch(await CyclesLedger.icrc1_transfer({
to = {owner = Principal.fromActor(this); subaccount = null};
fee = null;
memo = null;
from_subaccount = ?(Principal.toBlob(user));
created_at_time = ?(Nat64.fromNat(Int.abs(Time.now())));
amount = Int.abs(Float.toInt(Float.fromInt(amountToMove) * (1.0 - env.revenueShare)));
})) {
case (#Err e) {
Debug.trap("transfer failed: " # debug_show(e));
};
case (#Ok _) {};
};
// Pay to the vendor (TODO: Ensure no double fee later.)
switch(await CyclesLedger.icrc1_transfer({
to = {owner = revenueRecipient; subaccount = null};
fee = null;
memo = null;
from_subaccount = ?(Principal.toBlob(user));
created_at_time = ?(Nat64.fromNat(Int.abs(Time.now())));
amount = Int.abs(Float.toInt(Float.fromInt(amountToMove) * env.revenueShare));
})) {
case (#Err e) {
Debug.trap("transfer failed: " # debug_show(e));
};
case (#Ok _) {};
};
env.revenueShare == 0.05
.