Introduction
Dynamic has partnered with Morpho to bring yield capabilities directly into your app. Earn also supports Aave lending markets on EVM chains and vaults on Solana. Your users can deposit stablecoins into a vault, withdraw at any time, and track their position in real time without leaving your app. Each vault is served by a provider, which is the DeFi protocol that lends out the deposited funds. Every vault has avaultId and a provider field, and all providers use the same Earn functions. A few features depend on what the provider offers, as described in Provider support.
What you can offer your users
- Deposit and withdraw assets into yield vaults with a seamless in-app experience
- Earn yield in the same asset your users deposit: deposit USDC, earn USDC
- Track positions with real-time holdings and accrued yield
Supported chains
Earn vaults run on EVM chains and on Solana. Morpho and Aave vaults are EVM vaults, available on Ethereum, Base, Arbitrum, Optimism, Polygon, Monad, and Stable. Other vaults run on Solana. The chains a vault runs on depend on its provider, so readchainId and chainName from listYieldVaults rather than assuming a vault exists on every chain.
Every Earn action needs a wallet account on the vault’s chain family, so an EVM vault takes an EVM wallet account and a Solana vault takes a Solana wallet account. The API rejects a wallet account from the other chain family with an HTTP 400 error.
Default vaults
These vaults are enabled by default and returned bylistYieldVaults, which also returns each vault’s live netApy and tvlUsd. These numbers change continuously, so the table omits them.
Other vaults can be enabled for your environment. Contact us to have one added.
Key concepts
You don’t need a DeFi background to build with Earn. These are the only ideas you need:Provider support
Listing vaults, reading vault details, depositing, withdrawing, and reading a position work the same way for every provider. Earnings, performance, and rewards depend on what the provider reports or offers:getYieldEarningscovers one chain at a time and needs a wallet account on that chain’s family: an EVM wallet account for Morpho and Aave positions, a Solana wallet account for Kamino positions. Its profit and loss fields arenullfor a provider that does not report a cost basis, and those positions add nothing tototalPnlUsd.roeisnullfor Kamino and Aave, which report no time-weighted return.getYieldPerformance,getYieldRewards, andclaimYieldRewardswork only for the providers in the table. For a vault from any other provider, the call rejects with an HTTP 400 error.
provider field from listYieldVaults or getYieldDetails to decide which features to show for it.
Solana vaults
Solana vaults use the same Earn functions as every other vault, but Solana changes a few behaviors that your UI needs to account for:- Several transactions per action. A Solana deposit or withdrawal is split into up to three Solana transactions, such as the deposit itself and a step that stakes the deposited shares in the vault’s farm. The SDK signs, sends, and confirms them one at a time, in order, so the user may approve more than one signature for a single action.
- A short signing window. All of an action’s transactions are built against the same blockhash, which stays valid only briefly. If the user takes too long to approve, the remaining transactions expire and the action stops partway.
- Partial completion. When a later transaction fails or expires, the earlier ones have already confirmed on-chain. Read the wallet’s position with
getYieldPositionbefore retrying, because repeating the whole action could apply the earlier steps twice. - No separate receiver. Solana vaults credit shares and return tokens to the depositor’s own accounts, so
receiverAddressmust be omitted or equal to the wallet’s own address. - Network fees. The user pays SOL network fees unless you opt in to gas sponsorship for the action by passing
sponsored: true, which is available for Dynamic embedded wallets when SVM gas sponsorship is enabled for your project. Unlike EVM vaults, Solana vault actions are never sponsored by default. - Positions include staked shares.
getYieldPositioncounts shares staked in the vault’s farm, so the position stays the same size when the farm step runs.
Using the Earn functions
This is the full lifecycle:listYieldVaults: see which vaults are enabled for your environment.getYieldDetails: get a specific vault’s asset, decimals, and other metadata.depositToYieldVault: deposit a wallet’s funds into a vault.getYieldPosition: read a wallet’s currentassetsbalance in a vault. This is the number to show a user, and it grows on its own as yield accrues.getYieldRewardsandclaimYieldRewards: check for and claim bonus token rewards, if the vault runs a campaign.withdrawFromYieldVault: withdraw a wallet’s position, in whole or in part.
Do your own research when selecting a vault or lending market. APY is variable and not guaranteed. Review the protocol documentation and understand the risks before depositing funds.