IRISxiaowang / substrate-bank

MIT No Attribution
0 stars 0 forks source link

Adds interest payment #7

Closed syan095 closed 10 months ago

syan095 commented 1 year ago

This ticket introduces the Per type, as well as associated arithmatics.

Adds interest rate, modifiable only by Manager role. You should use the "Permill" or "Perbill" type as internal storage and calculation.

For the extrinsic that Managers use to set the interest rate, the input type should be a u32, in "basis point".

Adds periodic interest rate payment, which pays out the interest amount every "x" number of blocks, defined as "Config". This should happen in the "on_initialized" hook.

Only funds in the "reserved" funds are paid interest. Unlocking and free balances do not get paid interest.

Stake is no longer instantaneous, but will cause the funds to be locked for some time (set in Config). This lock can only expire.

Adds integrity checks that ensure "interest payout interval" < "redeem period", as well as "staking period" to prevent exploiting the system.