This PR contains Fee Implementation for Deposit and Withdrawal flows for tokens transfer using Rainbow Bridge (Business requirement).
Specification:
Deposit and withdrawal can have separate fee percentages.
The fee collected is locked in the same contract that the owner could claim using the function claim_fee.
All the fee setters are only callable by the accounts that have the role Role::FeeSetter.
The fee_amount has lower and upper bounds.
If the the calculated fee_amount is higher than the withdraw/deposit amount then charge the full amount as a fee and don't transfer anything to the recipient.
The fee is set in 6 decimal precision 10% = 0.1 * 10e6 = 100_000
It is possible to set a particular fee for silos on deposit and withdrawal. The silo is just a NEAR account, so as a side effect, it is possible to set a specific fee to any NEAR account.
It is possible not just to set a particular fee for a particular token for the silo, but also a default fee for this silo.
Migration:
The migration is needed due to the added fields deposit_fee, withdraw_fee, withdraw_fee_per_silo, deposit_fee_per_silo to the contract structure. To migrate the storage we need to call:
pub fn migrate() -> Self
Description
This PR contains Fee Implementation for Deposit and Withdrawal flows for tokens transfer using Rainbow Bridge (Business requirement).
Specification:
claim_fee
.Role::FeeSetter
.fee_amount
has lower and upper bounds.fee_amount
is higher than thewithdraw/deposit amount
then charge the full amount as a fee and don't transfer anything to the recipient.10% = 0.1 * 10e6 = 100_000
Added public function:
Migration: The migration is needed due to the added fields
deposit_fee, withdraw_fee, withdraw_fee_per_silo, deposit_fee_per_silo
to the contract structure. To migrate the storage we need to call:pub fn migrate() -> Self