Technical Overview of the Yield Source Contract
Last updated
Last updated
We have introduced the IYieldSource interface as a standardized approach to managing yield sources. The interface acts as a conduit between the SIV and the actual yield source. Typically, the IYieldSource operates on behalf of the SIV; hence, it's crucial for the SIV to hold ownership of the IYieldSource implementation.
One critical feature of the IYieldSource implementation is the ability to convert the generated yield into a payment token and transfer it back to the SIV. Our goal is to give developers flexibility in managing this implementation. They can choose suitable yield aggregators and determine the allocation of yield for insurance purchases.
Example implementation: Stargate LP staking rewards
yieldToken
address of reward token
sourceToken
address of yield-bearing asset
function pendingYield()
returns the pending yield, which is the amount of yieldToken
currently available to be claimed by the contract.
function pendingYieldInToken(address outToken)
estimates the amount of outToken that can be obtained by harvesting the yield.
function totalDeposit()
retrieves the total amount of sourceToken
currently deposited.
function deposit(uint256 amount)
is used to transfer sourceToken
from the SIV to the Yield Source contract, where yield strategy can be implemented like staking
.
function withdraw(uint256 amount, bool claim, address to)
can only be called by owner
(SIV), used to withdraw sourceToken
.
function claimAndConvert( address outToken, uint256 amount)
is used to claim yield and execute yield harvesting strategy and then transferred to the SIV.