Closed GopherJ closed 2 years ago
TBD
LoansPalletId: Get\<PalletId>
unstake(Origin, liquid_amoun: BalanceOf
amount = liquid_amount * exchangeRate * (1 - FastUnstakeFee)
unlock_amount = liquid_amount * exchangeRate
mint_amount = unlock_amount / collateral_factor
repay_amount = ?
Note:
amount < repay_amount < unlock_amount
unlock_amount
to matching_pool.totalUnstakeAmountunlock_amount
to unlockings, key is LoansPalletIdliquid_amount
s<DOT|KSM> mint mint_amount
<DOT|KSM>/U into module accountunlock_amount
<DOT|KSM>/U` in loansamount
and pay to unstakerclaim_for
repay_amount
then redeem mint_amount
<DOT|KSM>/U and burn ityes, a little bit difficult to calc repay_amount
. we may need some storage for(
for whom at which block borrow how much DOT with DOT/U) and not mixed up with dot debt from other collaterals.
maybe we can derivate a special borrower account from some tuple structure like (borrower,block_number,dot_u_asset_id,amount) which is unique and diffrent from normal account and then repay_amount
could be calculated with current current_borrow_balance
without change
Option 1:
fee should be around 0.6% + penalty 0.1%