Repeat

Repeat on Time

Ethereum
Ethereum
Base
Base

Acts onchain

Ready to run on Base

Limits how many times this plug can execute within a time interval. The current interval's start is combined with the plug's hash to key a counter in socket storage; the action reverts once the count reaches the limit and otherwise increments it. Intervals are hour, day, week, fortnight, month, quarter, and year. Reach for it to rate-limit a scheduled plug, such as at most one rebalance per day or three purchases per week, so a runaway trigger cannot execute it more often than intended.

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.

Daily 20 USDC Into ETH Under 1600 on Chainlink

time
chainlink
boolean
7actions
  1. 1·Repeat

    Capping cadence, this rate limit permits at most one run every day, so the schedule advances no more than once in that interval.

  2. 2·Get price

    Reading Chainlink, this pulls the latest ETH price quoted in USD, normalized to 18 decimals.

  3. 3·Predicate

    Comparing that price against 1600 with a less than operator, this proceeds only when ETH trades below that figure.

  4. 4·Multiply then divide

    Calculating 20 times 1 divided by the ETH price and rounding down, this derives how much ETH 20 USDC buys at the quoted rate.

  5. 5·Multiply then divide

    Taking 99 percent of that derived amount and rounding down, this sets a figure one percent below it to serve as a minimum.

  6. 6·Swap tokens

    On each run, 20 USDC is swapped for at least that discounted amount in ETH through the solver.

  7. 7·End block

    Closing the innermost open block, this ends the conditional branch.

Repeat up to x every
Get price of in
Calculate times divided by rounded
Calculate times divided by rounded
Swap for at least
End block

More plugs on Base

Dollar-cost average on Base · 4 plugs

Posts · 4

More on Time · 7