
Aave · Reads onchain state
Reads an Aave reserve's live rates and token addresses, with supply and borrow APYs. The pool's reserve data comes back whole: the current supply and variable borrow rates in ray, the last update timestamp, the aToken and variable debt token addresses, and isolation-mode debt. The per-second rates are compounded over a year on-chain into supplyApy and borrowApy at 18 decimals, so the yield figure is exactly what the pool accrues at this block. Reach for it when a strategy chooses between markets by yield, gates a supply on a minimum APY, or needs the aToken or debt token address to read a balance in the next step.
Supply if a Token Balance Is 0



1·Take
Declaring a caller-supplied parameter named supply_token, this reserves the asset to be provided at execution time.
2·Take
Also taking a caller-supplied parameter named aave_market, this reserves the market address the run will act against.
3·Get asset data
Reading Aave reserve data for the supply_token in the aave_market, this surfaces its live rates and token addresses.
4·Take
A third parameter named holder_wallet is taken from the caller, reserving the address whose position gets checked.
5·Get token balance
Using the aToken address wired from the reserve in slot 2.1.8, the balance held by holder_wallet is read.
6·Compare two values
Comparing that measured aToken balance against 0 with an equality operator, this returns true when the balance is zero.
7·Predicate
A predicate opens on the comparison being true, so the following branch runs only when the aToken balance is zero.
8·Take
Another caller parameter named supply_amount is taken, reserving how much of the asset to supply.
9·Supply
On that branch, supply_amount of supply_token is supplied to aave_market, minting aTokens to the socket.
10·End block
Closing the innermost open block, this ends the branch opened above.
On other protocols · 2