Check temporal state

Check temporal state on Time

Ethereum
Ethereum
Base
Base

Reads onchain state

Ready to run on Base

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.

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.

Morpho Pendle Expiry Deleveraging

pendle
time
boolean
27actions
  1. 1·Get expiry

    The caller names an expiring Pendle market at slot 0.0, and reading its expiry yields the maturity timestamp that gates everything below.

  2. 2·Check temporal state

    Block time is tested against that maturity to determine whether the market's expiry sits in the past.

  3. 3·Predicate

    Requiring that past check hold true confirms the named Pendle market has already matured before any unwinding proceeds.

  4. 4·Get total supplied and borrowed

    Totals supplied and borrowed are read from the Morpho market the solver supplies at slot 3.0, pinned at 91.5% LLTV.

  5. 5·Get account data

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

  6. 6·Compare two values

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

  7. 7·Predicate

    Requiring the earlier past result equal the matured flag ties the control flow to a market that has truly expired.

  8. 8·Get market parameters

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

  9. 9·Use

    A nested plug converts the position's borrow shares into a borrow-assets amount in the loan token.

  10. 10·Set

    The resulting borrow-assets figure is stored as user_borrow_assets_amount for the flash loan and repay steps.

  11. 11·Set

    The position's supplied-assets figure is stored as user_supply_assets_amount for the collateral withdrawal.

  12. 12·Flash loan

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

  13. 13·Repay

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

  14. 14·Withdraw Collateral

    Collateral is withdrawn for the supplied-assets amount in the market's collateral token back to the socket.

  15. 15·Get price

    The market's oracle price of that collateral in the loan asset is read for the conversion below.

  16. 16·Calculate

    Dividing the supplied-assets figure by that oracle price gives 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 that follows.

  18. 18·Get address

    The solver address is held as a named value for the token routing handoff.

  19. 19·Get token balance

    Your wallet's balance of the loan token is read before routing, to measure what changes.

  20. 20·Transfer tokens

    The collateral_needed_to_repay_flashloan amount of collateral is sent to the solver for routing.

  21. 21·Get solution

    The solver is handed the transferred collateral and returns loan-token proceeds, with the outcome verified.

  22. 22·Get token balance

    Your wallet's loan-token balance is read again after the solver returns its solution.

  23. 23·Calculate

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

  24. 24·Compare two values

    That delta is compared against the supplied-assets figure to check it reaches at least that amount.

  25. 25·Predicate

    Requiring that comparison equal true aborts unless the routed proceeds cover the needed amount.

  26. 26·End block

    The inner block closes.

  27. 27·End block

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

More plugs on Base

Dollar-cost average on Base · 4 plugs

Posts · 1

More on Time · 7