Check temporal state
Check temporal state

Time · Reads onchain state

Checks whether a timestamp is in the past or the future relative to block time. The chosen direction is compared against the current block timestamp and a boolean returned. Reach for it to gate a step on a deadline or a maturity: require an expiry is still in the future before buying PT, or branch to a claim once a stored unlock time is in the past.

Morpho Pendle Expiry Deleveraging

pendle
time
boolean
27actions
  1. 1·Get expiry

    The caller names the Pendle market at slot 0.0, USDat-27AUG2026, and Pendle returns its expiry timestamp for the maturity checks that follow.

  2. 2·Check temporal state

    Block time is compared against that expiry to decide whether the timestamp already sits in the past.

  3. 3·Predicate

    Requiring the past check equal true, the plug advances only after the source market has matured.

  4. 4·Get total supplied and borrowed

    A witness Morpho market id is opened and Morpho returns its totals: supplied and borrowed assets and shares.

  5. 5·Get account data

    Your position in that same witness market is read next, giving shares, collateral, debt, and health figures denominated in USDC.

  6. 6·Compare two values

    Testing that your debt figure exceeds 0 confirms an open borrow exists to deleverage.

  7. 7·Predicate

    Requiring the account read equal the past-check truth binds the position read to the matured-market branch before proceeding.

  8. 8·Get market parameters

    Morpho returns the witness market's immutable parameters: loan token, collateral token, oracle, and fixed fields.

  9. 9·Use

    A nested plug, Morpho Borrow Shares to Borrow Assets, runs to convert your borrow shares into a borrow-assets amount.

  10. 10·Set

    The converted borrow-assets amount is stored as user_borrow_assets_amount for the flash loan and repayment steps.

  11. 11·Set

    Your collateral figure from the position read is saved as user_supply_assets_amount for the withdrawal step.

  12. 12·Flash loan

    A fee-free Morpho flash loan of the borrow-assets amount is taken in the market's loan token, repaid inside this transaction.

  13. 13·Repay

    That borrowed amount of loan-token debt is repaid to the witness market from the socket's balance.

  14. 14·Withdraw Collateral

    Withdrawing the saved supply-assets amount of collateral pulls the position's collateral back to the socket.

  15. 15·Get price

    Morpho reads the market oracle's price of the collateral in the loan asset.

  16. 16·Calculate

    Dividing the saved supply-assets amount by that oracle price yields the collateral quantity needed to cover the flash loan.

  17. 17·Set

    That quotient is stored as collateral_needed_to_repay_flashloan for the transfer.

  18. 18·Get address

    The Solver address is fetched as a named value for routing the collateral.

  19. 19·Get token balance

    Balance of the loan token held by 0x581B...CD9A is read before routing, establishing a baseline.

  20. 20·Transfer tokens

    The collateral_needed_to_repay_flashloan amount of collateral is transferred to the Solver address.

  21. 21·Get solution

    The solution hands the routed tokens to the solver and verifies the outcome.

  22. 22·Get token balance

    Balance of the loan token held by the same address is read again after routing.

  23. 23·Calculate

    Subtracting the pre-routing baseline from the post-routing balance yields the loan tokens the solver returned.

  24. 24·Compare two values

    That delta is checked to be greater than or equal to the saved supply-assets amount figure.

  25. 25·Predicate

    Requiring the greater-than-or-equal result equal true blocks settlement unless enough came back.

  26. 26·End block

    The innermost open block is closed.

  27. 27·End block

    The remaining open block is closed, ending the transaction.

Get expiry of
Is in the
Get total supplied and borrowed in
Get account data in of
Is
Get market parameters of
Use where
borrow_sharesis
total_borrow_assetsis
total_borrow_sharesis
Set to
Set to
Flash loan
Repay to
Withdraw collateral from
Get price of in
Calculate
Set to
Get
Get balance of held by
Transfer to
Get solution
Get balance of held by
Calculate
Is
End block
End block
  • Morpho Pendle Expiry Deleveraging

    pendle
    time
    boolean