🏛️AF2.0 Repurchasing Guide
Last updated
Last updated
Note: Anyone can become a repurchaser. No whitelisting is required.
Once the money market sub-account is underwater, the account is publicly open to be repurchased.
To determine if the sub-account is underwater, the sub-account’s borrowing power (risk-adjusted collateral value) must be less than used borrowing power (risked-adjusted borrowed value).
To easily retrieve the data of the sub-account, you can call our view-only contract using the signature as follow:
moneyMarketReader: 0x4913DEC75cC0e061Ba78ebbDb2584905760be4C6
mmDiamond: 0x7389aaf2e32872cABD766D0CEB384220e8F2A590
mmAccountManager: 0xD20B887654dB8dC476007bdca83d22Fa51e93407
The SubAccountSummary struct is as follow
The close factor determines how much used borrowing power can be removed from the sub-account by repurchasing.
Example: Given
close factor = 50%,
USDC borrow factor = 0.9
BUSD borrow factor = 0.8
USDC debt = $500
BUSD debt = $1000
Used borrowing power = (1000 / 0.9) + (500 / 0.8) = 1736.1111111111
The maximum used borrowing power that can be removed = 1736.1111111111 / 2 = 868.05555555555
BUSD can only be repurchased 868.05555555555 * 0.9 => 781.249999999995
USDC can only be repurchased 868.05555555555 * 0.8 => 694.44444444444
Since USDC debt is only $500, all of it can be repurchased
In order to initiate the repurchase process, the repurchaser will need to call the following function @ 0x… (MMDiamond)
Repurchaser need to specify the debt token to be repaid in exchange of which collateral token.
By using the aforementioned example,
Given:
close factor = 50%
USDC borrow factor = 0.9
BUSD borrow factor = 0.8
USDC debt = $500
BUSD debt = $1000
ibBNB collateral factor = 0.8
ibBNB priced at 300
4 ibBNB were posed as collaterals
Repurchase reward rate = 5%
Repurchaser can repurchase 600 BUSD debt, which equivalent to 2 ibBNB by calling
Expecting to get 2 ibBNB * 105% = 2.10 ibBNB in return.
In order to withdraw the ibToken from AF2.0, the repurchaser can call the following function @ 0x… (AccountManager)