IAsset
The IAsset interface makes it easy for developers to build custom support for any asset token protocol.
All asset adapters must inherit from and adhere to the IAsset
interface.
hold
hold
Gets the interest-bearing, asset tokens
parameter:
amount
, the number underlying tokens to lend in order to receive and hold corresponding asset tokensreturns: the number of asset tokens received
This function is called hold
so that it is appropriate both for interest-bearing assets (which are typically acquired by depositing an underlying token such as DAI or USDC in an interest-generating protocol) as well as for non-interest-bearing assets such as WETH or UNI who's value a saver may way to protect with insurance.
getCostOfAsset
getCostOfAsset
Calculates the amount of underlying tokens needed to receive and hold a certain amount
of asset tokens
parameter:
amount
, the number of asset tokens for which the underlying token cost will be calculatedreturns: the number of underlying tokens needed to receive and hold a certain
amount
of asset tokens
This function will typically only apply to interest-bearing assets, where the cost is the amount of underlying token (such as DAI or USDC) needed to deposit into the interest-generating protocol in order to receive the amount
of interest-bearing tokens.
withdraw
withdraw
Withdraws underlying tokens in exchange for the asset tokens.
parameter:
amount
, the number of asset tokens to redeem in exchange for the underlying tokensreturns: the amount of underlying tokens withdrawn
withdrawReward
withdrawReward
Withdraws rewards or governance tokens that have been yielded from the adapter's lending protocol (e.g., COMP
tokens yielded from lending to the Compound protocol via the CompoundAdapter
).
returns: the number of rewards or governance tokens withdrawn
getRewardsBalance
getRewardsBalance
Returns the balance of rewards or governance tokens that have been yielded from the adapter's lending protocol (e.g., COMP
tokens yielded from lending to the Compound protocol via the CompoundAdapter
).
returns: the balance of rewards or governance tokens that have accrued
transfer
transfer
Handles transferring the asset tokens from a rewards farmer proxy to a recipient's rewards farmer proxy in the event a SaveToken holder wishes to transfer
their SaveTokens.
parameter:
recipient
, The address receiving the asset tokens in their rewards farmer proxyparameter:
amount
, The number of asset tokens to transferreturns: true if executed successfully
transferFrom
transferFrom
Handles transferring the asset tokens from a rewards farmer proxy to a recipient's rewards farmer proxy in the event a SaveToken holder wishes to transferFrom
their SaveTokens
parameter:
sender
, The address sending the asset tokens from their rewards farmer proxyparameter:
recipient
, The address receiving the asset tokens in their rewards farmer proxyparameter:
amount
, The number of asset tokens to transferreturns: true if executed successfully
Last updated