At Time Intervals
For this example let’s say you’re terrible with remembering birthdays 😬 so you want to set up automatic on-chain reminders. Let’s write a smart contract that will emit an event to remind you:
Now, let’s say you want to remind yourself about your friend Alice’s birthday. Simply construct an Instruction that uses the Call
Action to call your BirthdayReminder
contract one week before Alice’s birthday every year. Let’s break this down:
-
set
Instruction.action
to the address of theCall
Action -
set
Instruction.arguments
to encoded calldata specifying:-
set
Schedule.startAt
to a Unix timestamp that’s about one week before Alice’s next birthday -
set
Schedule.interval
to one year in seconds -
the address of your
BirthdayReminder
contract -
the function selector for
remind
-
the encoded arguments
name = "Alice"
,month = 1
, andday = 1
-
These steps might look intimidating, but never fear, the Otim App will walk you through this process and abstract away these low-level details.
Now, activate this Instruction and you’ll never forget Alice’s birthday again!