Approvals/Periphery Contracts

Overview of third-party approvals on MYSO v1

MYSO v1 allows users to approve other addresses to call certain functions on their behalf. This enables functional extensibility through peripheral contracts, while also keeping the MYSO v1 core lean and maintaining a good separation of concerns.

A third-party address can be approved by users calling the setApprovals() function and specifying which functions the given third party shall be allowed to call on their behalf. Users can approve the following functions:

  • Adding liquidity: an approved third party can add liquidity on behalf of the given LP. This means the third party pays the liquidity contribution amount but the LP is credited with a corresponding amount of LP shares. Naturally, this approval is rather low risk because in the worst case, one can receive LP shares for free. Nonetheless, LPs should carefully assess the to-be-approved address because adding liquidity on their behalf can prolong their liquidity provisioning lock-up

  • Claiming: an approved third party can claim loan proceeds on behalf of a LP. LPs should carefully assess the to-be-approved address as it will have control over all unclaimed loan proceeds the LP is entitled to. Even if the third party is a non-custodial vault contract, it nonetheless is vital to assess the correctness of the corresponding contract to prevent any damage from potential ill claiming

  • Removing liquidity: an approved third party can remove liquidity on behalf of a LP. Users should be very cautious to provide this approval as the third party will essentially have full control over the LP’s removable liquidity contribution.

  • Borrowing: an approved third party can pledge collateral on behalf of the approving address. To be more specific, the approved party can then pay the collateral amount and receive the loan amount but the approving address will be registered as the loan holder and be able to repay and reclaim the pledged collateral. Generally speaking, this approval is rather low risk because worst case the third party pays the collateral amount and receives the loan, while the approving address obtains a free option on the underlying collateral.

  • Repaying: an approved third party can repay on behalf of the approving address. In this case, the third party pays the repayment amount and the collateral is sent to a recipientaddress that must either be the approved third party or the original loan owner

  • Rolling Over: an approved third party can roll over a loan on behalf of the approving address. In this case, the third party pays the rollover cost and a new loan is taken out on behalf of the original loan owner. This means that the original loan owner retains their option to reclaim their previously pledged collateral; however, at a new repayment amount

Example of how a peripheral contract could be constructed to automatically remove liquidity on behalf of a LP depending on some off-chain price data

Last updated