Check market validity

Check market validity on Pendle

Ethereum
Ethereum
Base
Base

Reads onchain state

Ready to run on Base

Asks a Pendle market factory whether it deployed a given market. The factory is the trusted root: a genuine market attests by membership, while a contract merely imitating a market's read surface does not. A market is valid only on the factory generation that deployed it, so the version must match. Reach for it to authenticate a market address the plug did not author, such as one proposed by a solver, requiring the result is true before any step approves or deposits into it.

Plug lets you combine onchain actions like this one into a single transaction, without writing a smart contract. Use in App opens a new plug with this action already in it.

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 parameter that drives the whole rollover.

  2. 2·Get expiry

    Reading the named market's expiry gives the maturity timestamp that gates the actions below.

  3. 3·Get current timestamp

    Block time is fetched as Unix seconds for comparison against that maturity.

  4. 4·Predicate

    Requiring the current timestamp be greater than or equal to the expiry confirms the named market has already matured.

  5. 5·Get tokens

    SY, PT, and YT token addresses of the matured market are read for later token checks.

  6. 6·Expect witness

    A bytes32 witness hole is opened; the solver will supply a Morpho market id, judged inside this block.

  7. 7·Get market parameters

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

  8. 8·Predicate

    Requiring the market's collateral token equal the matured market's PT ties the id to the position being unwound.

  9. 9·Get account data

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

  10. 10·Predicate

    Testing the position's collateral figure greater than 0 confirms an open position exists.

  11. 11·End block

    The witness block closes, having verified the source market and its position.

  12. 12·Expect witness

    An address witness hole is opened; the solver supplies the destination Pendle market, judged inside this block.

  13. 13·Check market validity

    The candidate destination market is checked against the Pendle v6 factory.

  14. 14·Predicate

    Requiring that validity check equal true rejects any market the v6 factory did not deploy.

  15. 15·Get tokens

    SY, PT, and YT token addresses of the destination market are read.

  16. 16·Predicate

    Requiring the destination SY equal the source SY confirms both markets share the same underlying yield token.

  17. 17·Get expiry

    The destination market's expiry is read.

  18. 18·Predicate

    Requiring that expiry be greater than the source maturity ensures the rollover moves into a later-dated market.

  19. 19·End block

    The address witness block closes, having verified the destination market.

  20. 20·Expect witness

    A second bytes32 witness hole is opened; the solver supplies the destination Morpho market id, judged here.

  21. 21·Get market parameters

    Immutable parameters of the destination Morpho market are read.

  22. 22·Predicate

    Requiring its collateral token equal the destination PT ties the id to the new position.

  23. 23·Predicate

    Requiring its loan token equal the source market's loan token keeps the borrowed asset consistent across the roll.

  24. 24·Check oracle provenance

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

  25. 25·Predicate

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

  26. 26·Get oracle feeds

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

  27. 27·Get oracle

    Pendle's 900-second TWAP PT-to-asset oracle for the destination market is looked up.

  28. 28·Predicate

    Requiring the verified Morpho oracle equal the Pendle TWAP oracle confirms the Morpho market prices PT off Pendle's feed.

  29. 29·End block

    The destination witness block closes, all markets and oracles verified.

  30. 30·Flash loan

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

  31. 31·Repay

    The borrowed loan token repays the debt to the source Morpho market from the socket's balance.

  32. 32·Withdraw Collateral

    Collateral is withdrawn for the position's supplied-assets amount in the source PT back to the socket.

  33. 33·Redeem

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

  34. 34·Buy

    That SY buys destination PT on the destination market, accepting any amount out.

  35. 35·Supply Collateral

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

  36. 36·Borrow

    The loan token is borrowed from the destination market to settle the flash loan.

  37. 37·End block

    The outer block closes, 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

More plugs on Base

Earn yield on Base · 12 plugs

Posts · 3

More on Pendle · 20