Claiming (Basics)
How to claim LP proceeds/recover funds from MYSO v1 pools
Claiming is an essential mechanism for liquidity providers to reap benefits from participating in a lending market such as MYSO, as they need to claim pool proceeds to earn yield and to recover their pro-rata share of lent funds.
To keep track of available loans, each liquidity pool comes with a global loanIdx counter, which is incremented after each new loan to keep track of loans for which a LP can claim. Whenever a LP adds/removes liquidity, the given pool stores the loanIdx value at which this occurs. This presents a system of tracking of the loans for which a LP can claim.
When a borrower decides to repay a loan or to simply leave their collateral, it becomes available for liquidity providers to claim. A LP can call either one of the below functions to claim their pro-rata share of the loan proceeds:
claim()— LPs are able to claim individual loan proceeds one-by-one on a per-loan basis. To call this function, LPs need to specify a loan or set of loan indices they want to claim on. Theclaim()function then iterates over the given loan(s) and checks whether the LP is entitled to these repayments/left collateral amounts. If they are, the LPs can claim the corresponding pro-rata proceed amounts from the pool.claimFromAggregated()— If a LP has a large number of loans from which they can claim proceeds, using this claiming function is recommended to save on gas fees. This function allows LPs to claim over a whole range of loan indices, referred to as buckets. When a new pool is created, the deployer must set a parameter calledbaseAggrBucketSize, which defines the aggregate bucket size for that given pool. This allows LPs to claim over a pre-definedloanIdxrange in one transaction; fromloanIdx = 1toloanIdx = 100, for example.
Last updated