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 USDat-27AUG2026 at slot 0.0, and Pendle returns its expiry timestamp for the maturity checks ahead.

  2. 2·Check temporal state

    Block time is compared against [the expiry timestamp] to decide whether that timestamp lies in the past.

  3. 3·Predicate

    Requiring the past-check equal true, the plug advances only once the named market has matured.

  4. 4·Get total supplied and borrowed

    Totals for the source Morpho market at 91.5% LLTV are read: supplied and borrowed assets and shares.

  5. 5·Get account data

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

  6. 6·Compare two values

    Testing your debt figure at slot 4.11.1 greater than 0 establishes an open borrow exists to unwind.

  7. 7·Predicate

    Confirming the position read succeeded equal to the earlier true result gates the rest on a valid read.

  8. 8·Get market parameters

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

  9. 9·Use

    A nested plug, Morpho Borrow Shares to Borrow Assets, is composed to convert your borrow shares into a loan-asset amount.

  10. 10·Set

    Storing that converted figure, user_borrow_assets_amount holds the debt to repay.

  11. 11·Set

    Storing your collateral figure from slot 4.11.2, user_supply_assets_amount holds the collateral to withdraw.

  12. 12·Flash loan

    A fee-free Morpho flash loan is taken for user_borrow_assets_amount in the source market's loan token, repaid within this transaction.

  13. 13·Repay

    That flashed amount repays your loan-token debt to the source market at 91.5% LLTV from the socket's balance.

  14. 14·Withdraw Collateral

    Your collateral of user_supply_assets_amount is withdrawn from the source market back to the socket in its collateral token.

  15. 15·Get price

    Reading the source market's oracle gives the price of the collateral token in the loan asset.

  16. 16·Calculate

    Dividing your collateral figure by that price yields the collateral needed to cover the flash loan.

  17. 17·Set

    Storing that quotient, collateral_needed_to_repay_flashloan holds the amount to route.

  18. 18·Get address

    The solver address is fetched as a named value for the transfer ahead.

  19. 19·Get token balance

    The loan token balance held by 0x581B...CD9A is read before routing.

  20. 20·Transfer tokens

    collateral_needed_to_repay_flashloan of the collateral token is transferred to the solver address.

  21. 21·Get solution

    Tokens already transferred are handed to the solver for routing, then the outcome is verified.

  22. 22·Get token balance

    The loan token balance held by 0x581B...CD9A is read again after routing.

  23. 23·Calculate

    Subtracting the pre-routing balance from the post-routing balance yields the loan tokens received.

  24. 24·Compare two values

    Testing that received amount greater than or equal to your collateral figure checks the routing covered the flash loan.

  25. 25·Predicate

    Requiring that coverage check equal true reverts if routing returned too little to repay.

  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 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