Get tokens
Get tokens

Pendle · Reads onchain state

Reads the SY, PT, and YT token addresses of a Pendle market. The market's readTokens returns all three, tagged as tokens. Reach for it when the market is chosen at runtime and later steps need the concrete addresses to approve, transfer, or read balances of.

Pendle Leveraged PT Auto Rollover

plug
pendle
time
37actions
  1. 1·Take

    The caller names an expiring Pendle market at slot 0.0, declaring the market this rollover acts on at execution time.

  2. 2·Get expiry

    Pendle returns that named market's expiry timestamp, the maturity value the checks ahead compare against.

  3. 3·Get current timestamp

    Block time is read as Unix seconds for the maturity comparison.

  4. 4·Predicate

    Requiring the current timestamp be greater than or equal to the expiry, the plug advances only once the named market has matured.

  5. 5·Get tokens

    Reading the named market's tokens gives its SY, PT, and YT addresses.

  6. 6·Expect witness

    A bytes32 witness hole opens for the source Morpho market id the solver will supply, judged inside this block before use.

  7. 7·Get market parameters

    Immutable parameters of that source Morpho market are read: loan token, collateral token, oracle, and fixed fields.

  8. 8·Predicate

    Testing the source market's collateral token equal to the named market's PT ties the position to the matured PT.

  9. 9·Get account data

    Your wallet's position in that source market is read, giving shares, collateral, debt, and health.

  10. 10·Predicate

    Confirming your debt figure is greater than 0 establishes an open borrow exists to unwind.

  11. 11·End block

    This closes the source-market witness block once its judgments hold.

  12. 12·Expect witness

    An address witness hole opens for the destination Pendle market the solver will supply, judged inside this block.

  13. 13·Check market validity

    Pendle's V6 factory is asked whether it deployed the candidate destination market.

  14. 14·Predicate

    Requiring that factory answer equal true rejects any market the V6 factory did not deploy.

  15. 15·Get tokens

    Reading the destination market's tokens gives its SY, PT, and YT addresses.

  16. 16·Predicate

    Matching the destination market's SY against the source market's SY confirms both markets share the same SY asset.

  17. 17·Get expiry

    Pendle returns the destination market's expiry timestamp.

  18. 18·Predicate

    Requiring that destination expiry be greater than the source expiry ensures the roll targets a later maturity.

  19. 19·End block

    This closes the destination-market witness block.

  20. 20·Expect witness

    A bytes32 witness hole opens for the destination Morpho market id the solver will supply, judged inside this block.

  21. 21·Get market parameters

    Immutable parameters of that destination Morpho market are read.

  22. 22·Predicate

    Matching the destination Morpho collateral token against the destination market's PT confirms the new market takes the new PT as collateral.

  23. 23·Predicate

    Matching the destination Morpho loan token against the source market's loan token keeps the borrow asset the same across the roll.

  24. 24·Check oracle provenance

    The destination market's oracle is checked against the Morpho Chainlink oracle factory for provenance.

  25. 25·Predicate

    Requiring that provenance answer equal true rejects any oracle that factory did not deploy.

  26. 26·Get oracle feeds

    The destination oracle's composition is read: its two base feeds, two quote feeds, and base and quote vaults.

  27. 27·Get oracle

    Pendle's oracle factory is queried for the 900 second TWAP PT-to-asset oracle of the destination market.

  28. 28·Predicate

    Requiring the provenance-true result equal that Pendle oracle ties the destination oracle to the expected PT TWAP feed.

  29. 29·End block

    This closes the destination Morpho witness block.

  30. 30·Flash loan

    A fee-free Morpho flash loan is taken in the destination loan token for the borrow-assets amount, repaid within this transaction.

  31. 31·Repay

    That borrowed amount is repaid as loan-token debt to the source Morpho market from the socket's balance.

  32. 32·Withdraw Collateral

    Your collateral is withdrawn from the source market back to the socket in the source market's collateral token.

  33. 33·Redeem

    The withdrawn PT is redeemed in the named source market for SY.

  34. 34·Buy

    Redeemed SY buys PT on the destination market with no minimum out enforced.

  35. 35·Supply Collateral

    The bought PT is supplied as collateral to the destination Morpho market.

  36. 36·Borrow

    Loan asset equal to the Pendle oracle amount is borrowed from the destination market against the new collateral.

  37. 37·End block

    The remaining open block is closed, ending the transaction.

Take
Get expiry of
Get current timestamp
Get tokens of
Expect
Get market parameters of
Get data in of
End block
Expect
Is a valid market
Get tokens of
Get expiry of
End block
Expect
Get market parameters of
Is a Morpho Chainlink oracle
Get the feeds of
Get the second TWAP oracle for
End block
Flash loan
Repay to
Withdraw collateral from
Redeem in for
Buy with on for at least
Supply as collateral to
Borrow from
End block
  • Pendle Leveraged PT Auto Rollover

    plug
    pendle
    time

On other protocols · 5