
Pendle · Reads onchain state
Reads the expiry timestamp of a Pendle market. At expiry PT redeems one-to-one for the underlying and YT stops accruing yield, so the timestamp defines the market's fixed-rate horizon. Reach for it to compute time to maturity against the current timestamp, to schedule a redemption on expiry, or to require enough time remains before buying PT for a fixed rate.
Pendle Leveraged PT Auto Rollover



1·Take
The caller supplies the expiring Pendle market at slot 0.0, declared here as a named parameter resolved at execution time.
2·Get expiry
Pendle returns the expiry timestamp of that named market so later comparisons know when it matures.
3·Get current timestamp
Block time is read as Unix seconds for use against the maturity check.
4·Predicate
Requiring the current timestamp be greater than or equal to the market's expiry, this proceeds only once the source market has matured.
5·Get tokens
Reads the SY, PT, and YT token addresses of the source market for later matching.
6·Expect witness
Opens a witness expecting a 32-byte key, a hole the solver fills with a Morpho market id that the block must judge before use.
7·Get market parameters
Morpho returns the source market's immutable parameters from that witness id: loan token, collateral token, oracle, and fixed fields.
8·Predicate
Requiring the witness market's collateral token equal the source Pendle market's PT, tying the Morpho market to the PT being unwound.
9·Get account data
Fetches your position in that Morpho market: shares, collateral, debt, and health figures.
10·Predicate
Confirming an open borrow exists by requiring your debt figure be greater than 0.
11·End block
Closes the first witness block, having verified the source Morpho market.
12·Expect witness
Opens a second witness expecting an address, a hole the solver fills with the destination Pendle market.
13·Check market validity
Asks the Pendle V6 factory whether it deployed that candidate market.
14·Predicate
Requiring the factory answer equal true, so only a genuine V6 market advances.
15·Get tokens
Reads the SY, PT, and YT token addresses of the destination market.
16·Predicate
Requiring the destination SY equal the source SY, keeping both markets on the same underlying.
17·Get expiry
Pendle returns the destination market's expiry timestamp.
18·Predicate
Requiring the destination expiry be greater than the source expiry, so the roll moves into a later-maturing market.
19·End block
Closes the destination-market witness block.
20·Expect witness
Opens a third witness expecting a 32-byte key, the destination Morpho market id.
21·Get market parameters
Morpho returns the destination market's immutable parameters: loan token, collateral token, oracle, and fixed fields.
22·Predicate
Requiring the destination collateral token equal the destination market's PT.
23·Predicate
Requiring the destination loan token equal the source loan token, so debt stays in the same asset.
24·Check oracle provenance
Asks the Morpho Chainlink oracle factory whether it deployed the destination market's oracle.
25·Predicate
Requiring that provenance answer equal true, admitting only a factory-deployed oracle.
26·Get oracle feeds
Reads the destination oracle's composition: its two base feeds, two quote feeds, and base and quote vaults.
27·Get oracle
Looks up Pendle's 900-second TWAP PT-to-asset oracle for the destination market.
28·Predicate
Requiring the oracle provenance result equal the Pendle TWAP oracle lookup, binding the Morpho oracle to Pendle's PT feed.
29·End block
Closes the destination Morpho witness block.
30·Flash loan
Takes a fee-free Morpho flash loan of your borrow-assets amount in the destination loan token, repaid within this transaction.
31·Repay
Repays that borrow-assets amount of loan-token debt to the source Morpho market from the socket.
32·Withdraw Collateral
Withdraws your collateral figure of the source PT collateral from the source market back to the socket.
33·Redeem
Redeems that PT amount in the source Pendle market for SY.
34·Buy
Buys destination PT with the redeemed SY on the destination market, accepting at least 0 out.
35·Supply Collateral
Supplies the bought PT as collateral to the destination Morpho market.
36·Borrow
Borrows the flash-loan repayment amount of the loan asset from the destination market against the new collateral.
37·End block
Closes the flash-loan body, completing the rollover into the later market.