
Chainlink · Reads onchain state
Reads the latest Chainlink price of a base asset in a quote asset, normalized to 18 decimals. The feed registry's latestRoundData is fetched for the pair, and the answer is rescaled from the feed's own decimals to 18 so every pair compares alike. The round's timestamps come back alongside, so staleness can be checked. Reach for it whenever a strategy needs a reference price independent of any pool: compare a DEX quote against it to bound slippage, convert a dollar target into a token amount, or coil the updated-at timestamp into a predicate that requires the feed is fresh.
Get Chainlink Price (USD)


1·Take
Step one declares a named parameter called token, whose value the caller supplies when the plug runs, so nothing is fixed in advance here.
2·Get price
Reading from Chainlink, this step takes the token in slot 0.0 and fetches its latest price quoted in 0x0000000000000000000000000000000000000348, which denotes USD, normalized to 18 decimals.
3·Bubble
Surfacing the value from slot 1.7 makes the fetched price an output of this plug so callers can read it.
4·Use
Composing another plug named swap inside this one lets its actions run as part of this transaction.
On other protocols · 8