
Aave · Reads onchain state
Reads the price the market's own oracle assigns to an asset. Every Aave market prices assets through its own oracle, and that number is the one the pool uses when it decides what your collateral is worth and when it liquidates. Reading it here gives you the exact figure the protocol is about to act on, inside the same transaction that acts on it, not a screenshot from a price site or a number that was true a block ago. Reach for it whenever a strategy has to convert between a dollar amount and a token amount before it does something: sizing a supply so it lands at a target health factor, capping a repay at what the debt is actually worth, deciding whether a position has drifted far enough to rebalance. Anywhere the words "worth" or "value" appear in a plan, this is the read that makes the rest of the plan arithmetic.
Value to Token Amount



1·Take
The plug takes the token it should price, so the same logic runs for any asset a market lists.
2·Take
It takes the Aave market to read against: the oracle is the market's, so the price is the one that market will enforce.
3·Get price
One oracle read: what the market says one unit of the token is worth right now.
4·Take
It takes the dollar value the caller wants to convert into tokens.
5·Calculate
Value divided by price is the token amount, done onchain, in the same transaction, on the price just read.
6·Set
The result is written to a named slot so later steps can refer to it by name.
7·Bubble
And bubbled out, so any plug that uses this one gets the token amount as an output it can wire straight into a supply or a repay.
On other protocols · 8