Vault Account
The Vault Account is a struct used for accounting in the Fraxlend Pair:
The Vault Account contains two elements:
amount
- represents a total amountshares
- represents claims against the amount
Lending Accounting
In lending, amount
represents the total amount of assets deposited and the interest accrued.
When lenders deposit assets, the amount of assets deposited increases amount
, the shares
value is also increased by an amount such that the ratio between amount
/shares
remains unchanged.
When interest is accrued, amount
is increased and shares
remains the same. Each lender's share of the underlying assets are measured in shares.
When lenders remove liquidity, they redeem shares for the underlying asset. The shares
amount will be decreased by the number of shares redeemed, the amount
will be decreased such that the ratio between amount
/shares
remains unchanged.
Borrow Accounting
In borrowing, amount
represents the total amount of assets borrowed and the interest accrued.
When borrowers receive assets, the number of tokens received increases amount
, the shares
value is also increased by an amount such that the ratio between amount
/shares
remains unchanged.
When interest is accrued, amount
is increased and shares
remains the same. Each borrower's debt is measured in shares.
When borrower's repay debt, amount
is decremented by the amount of assets returned, shares
is decreased by an amount such that the ratio of amount
/shares
remain unchanged. An individual borrowers shares balance is decremented by this number of shares.
Last updated