Testing DeFi applications that revolve around yield-bearing tokens is a significant technical challenge for developers. Tokens such as stETH, aUSDC, and rETH use complex rebalancing mechanisms where actual token balances are derived from mathematical formulas that involve shares, exchange rates, and rebase indices rather than simple storage mappings (token(address) → balance).
As a workaround, you typically have to hunt for and impersonate whale addresses that have these tokens and set up isolated environments so you can test staking scenarios. However, aside from bringing an unnecessary manual overhead, this workaround also limits your testing capabilities.
Instead, you can now top up yield-bearing tokens using a simple RPC method on Tenderly Virtual TestNets – tenderly_setErc20MaxBalance. With the industry-first unlimited faucet for yield-bearing tokens, you can fund your test accounts instantly while maintaining your complex internal accounting. This way, you can test comprehensive DeFi integrations, time-dependent yield scenarios, rebase events, and cross-protocol compositions that were previously impossible in isolated testing environments.
What are the different types of yield-bearing tokens?
Based on different token behaviors and yield collection strategies, you can distinguish between several types of yield-bearing tokens. Complex DeFi strategies typically involve multiple types, which is why testing them is essential for preventing potentially critical errors.
1. Lending tokens (like aUSDC from Aave)
The idea: Lend stablecoins to a protocol and get some of the borrowing fees as a reward.
You deposit stablecoins, such as USDC, into a lending protocol. The protocol lends them out to people who need to borrow. The borrowers pay interest that automatically goes to you.
2. Staking tokens (like stETH)
The idea: Lock in your assets in return for rewards.
You have ETH, but you decide not to use it actively. Instead, you give it to someone to "stake" it, which locks it up to help secure a blockchain. In return, you receive stETH. Over time, stETH becomes worth more than ETH because it's earning rewards.
3. Liquidity Provider (LP) tokens
The idea: Supply a combination of tokens to a lending pool. With every trade, you get rewards based on the part of the pool you own.
For example, you deposit two tokens, such as ETH and USDC, into a pool. When other people trade, they pay a small fee. You get your share of those fees because you own a part of the pool.
4. Vault (ERC-4626) tokens
The idea: Put your tokens inside a smart vault that regulates the investment of your assets by following predetermined vault rules.
You deposit tokens into a smart vault contract. The vault autonomously moves your assets through different protocols so you can earn the best interest. Typically, you can deposit the earned rewards into the vault again to earn even more rewards.
Why testing yield-bearing tokens used to be challenging
Up until now, running tests with staking tokens has been difficult primarily because standard top-up methods cannot easily override balances for these tokens. Most top-up algorithms work on the presumption that the balance of a token is stored in a simple mapping.
For instance, standard ERC-20 tokens store balance directly in a simple mapping, such as:
mapping(address => uint256) balances;
balance[user] = amount; *// Direct storage write*However, yield-bearing tokens store balance values in a more complex manner, causing these standard methods to revert and making them impossible to test properly. They calculate the balance at runtime dynamically using this formula:
balance[user] = shares[user] × (exchangeRate)
*// Where exchangeRate = totalAssets / totalShares*This challenge particularly affects development workflows for protocols that integrate with major DeFi primitives, including Lido, Aave, and Rocket Pool.
While Tenderly Virtual TestNets and Transaction Simulator do offer this functionality, testing different staking scenarios brought some limitations.
What the process used to look like on Virtual TestNets
Virtual TestNets come with custom RPC methods for overriding token balances – tenderly_addErc20balance and tenderly_setErc20Balance. You can use these methods to set custom balances for a given address. For example:
{
"jsonrpc": "2.0",
"method": "tenderly_setErc20Balance",
"params": [
"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", // ERC20 Token address
"0xb5f45E52649123117C175B2016Ed3fCd26f9bE06", // Wallet address
"0xDE0B6B3A7640000" // Balance ammount
],
"id": 1
}However, funding a wallet with a yield-bearing token using the standard setErc20Balance wasn’t previously possible. For instance, you could try running the following:
{
"id": 0,
"jsonrpc": "2.0",
"method": "tenderly_setErc20Balance",
"params": [
"0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84",
"0xb5f45E52649123117C175B2016Ed3fCd26f9bE06",
"0x40BdB4497614bAe1A67061EE20AAdE3c2067AC9a"
]
}But you would get the following error:
{
"id": 0,
"jsonrpc": "2.0",
"error": {
"code": 3,
"message": "execution reverted",
"data": "0x"
}
}Instead, to test strategies with yield-bearing tokens on Virtual TestNets, you had to find a whale address that holds a significant amount of these tokens. Next, you had to fork a specific network using Virtual TestNets and set up an environment where you can initiate an automatically signed transfer. Since Virtual TestNets enable you to impersonate public accounts without private keys, you had to transfer the tokens to your account address so you could test a particular staking strategy.
However, this process is now much faster and more efficient thanks to Tenderly’s industry-first faucet for yield-bearing tokens – tenderly_setMaxErc20Balance.
How to use Tenderly’s industry-first faucet for yield-bearing tokens
You can now test staking scenarios by using Tenderly's custom tenderly_setMaxErc20Balance method on Virtual TestNets. Using this industry-first solution, you can use the unlimited faucet to top up a full spectrum of yield-bearing tokens that calculate balances dynamically through share-based mechanisms or rebase formulas rather than direct storage.
These include:
- Liquid staking derivatives (stETH, wstETH, rETH, cbETH)
- Elastic supply/rebase tokens (AMPL, DIGG)
- Interest-bearing lending tokens (Aave's aUSDC/aWETH, Compound's cTokens)
- Yield-bearing stablecoins (USDM, sDAI, sFRAX)
- Emerging liquid restaking tokens from the EigenLayer ecosystem
To top up your test accounts with these yield-bearing tokens, simply send the RPC call to your Virtual TestNet endpoint:
{
"id": 0,
"jsonrpc": "2.0",
"method": "tenderly_setMaxErc20Balance",
"params": [
"0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84", // Yield-bearing token
"0xb5f45E52649123117C175B2016Ed3fCd26f9bE06" // Wallet address
]
}Once done, you get the result – the hash of the faucet transaction executed to top up your wallet:
{
"id": 0,
"jsonrpc": "2.0",
"result": "0x8fb202d4612be9f6e96b955b4e5bd002cde4d79bec8a6d1b7d35976f124636a4" // Tops up with the maximum value possible calculated from the algorithm
}How to do stETH wrapping using the yield-bearing faucet
As an example for testing with tenderly_setErc20MaxBalance, let’s do a basic wrapping of stETH. First, head over to your Virtual TestNet environment to send a wrap transaction:

However, if you have no stETH in your wallet on Mainnet, this transaction will fail:

So, you need to top up your account with stETH. To do this, simply run the tenderly_setErc20MaxBalance method.

{
"id": 0,
"jsonrpc": "2.0",
"method": "tenderly_setMaxErc20Balance",
"params": [
"0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84", "0xb5f45E52649123117C175B2016Ed3fCd26f9bE06"
]
}First, make sure to approve the wstETH contract address to be able to wrap some of your stETH by running the following transaction:

Once the transaction is executed, you should get the following overview:

Finally, you can wrap some of your freshly topped-up stETH to wstETH.

Thanks to the available balance, your wrapping transaction should execute successfully:

After wrapping some of your topped-up stETH to wstETH, how you decide to use your yield-bearing tokens depends on your investment strategy.
What are some token limitations?
While the yield-bearing faucet method on Virtual TestNets enables you to fund 99% of tokens, some tokens still cannot be funded due to their unique balance calculation logic. In that case, you may come across the following error message when trying to top up your balance for these particular tokens:
{
"id": 0,
"jsonrpc": "2.0",
"error": {
"code": -32006,
"message": "ERC20 Funding not possible"
}
}Fund yield-bearing tokens on Virtual TestNets instantly
Testing staking strategies is critical for ensuring their proper execution and protecting user assets. Having a simple way to top up balances for yield-bearing tokens not only speeds up your testing process but also ensures you quickly uncover potential errors that could compromise the validity of your pools or yield strategies.
With Tenderly Virtual TestNets, you now have an instant way to top up and test strategies that involve yield-bearing tokens while still having all the onchain data to test realistic execution. To get started, head over to Virtual TestNets to fund yield-bearing tokens.