or
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up
Syntax | Example | Reference | |
---|---|---|---|
# Header | Header | 基本排版 | |
- Unordered List |
|
||
1. Ordered List |
|
||
- [ ] Todo List |
|
||
> Blockquote | Blockquote |
||
**Bold font** | Bold font | ||
*Italics font* | Italics font | ||
~~Strikethrough~~ | |||
19^th^ | 19th | ||
H~2~O | H2O | ||
++Inserted text++ | Inserted text | ||
==Marked text== | Marked text | ||
[link text](https:// "title") | Link | ||
 | Image | ||
`Code` | Code |
在筆記中貼入程式碼 | |
```javascript var i = 0; ``` |
|
||
:smile: | ![]() |
Emoji list | |
{%youtube youtube_id %} | Externals | ||
$L^aT_eX$ | LaTeX | ||
:::info This is a alert area. ::: |
This is a alert area. |
On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?
Please give us some advice and help us improve HackMD.
Do you want to remove this version name and description?
Syncing
xxxxxxxxxx
Background
Sometimes, you don't want a transaction to be sent right away. For example, there might be an NFT mint that starts tomorrow at 7AM, but you don't want to wake up at 7AM to mint the NFT. With fun.xyz's automated actions, you can schedule a transaction at 7AM, pre-sign it, and make sure it only executes when the NFT mint opens.
This document explains the design decisions and the architecture of Automated Actions. This includes smart contract design, sdk changes, server changes, storage changes(dynamoDB), and a new service that simulates transactions and sends them to bundler.
Tenets
Availability: When an automated action is scheduled, it should be executed as soon as the validation condition is true
Scalability: We want to minimize the costs are are paying to aws, dynamoDB, our api server, and the cost of rpcs for simulation
Customer Experience
Creating an Automated Action
Each automated action is based off of a module, which is a smart contract that plugs into funwallet.sol. Each automated action module has two functions
validate(bytes calldata data)
andexecute(bytes calldata data)
The validate function will repeatedly be called, and the execute will be called as soon as validate returns true for that specific
data
.Sending an Automated Action
Automated Actions are sent from the SDK. When sending a transaction, a user can specify
automatedAction=true
in {Insert correct function from sdk here} and the transaction will be sent to the automated actions database instead of to the bundlerThe Automated Action being executed
The automated action userOp will sit in the database and the corresponding
validate()
function will be called. When validate returns true, the userOp will be sent to the bundler.Architecture
Api Server Changes
/createAutomatedAction
Parameters:
Creates an entry in the FunWalletAction DynamoDB
returns actionId
/deleteAutomatedAction
Deletes an entry in the FunWalletAction DynamoDB
We could also just use the existing delete method
/executeAutomatedAction
Database Schema
We are using the same database
FunWalletAction
as the one being used in M of N transactions.Might need to add a some key that lets us only query the actions that are relevant to automatedActions
Cron Job
Tbh not sure what aws service to use here, but essentially we would:
SDK
First class action vs sendTxLater
Implementation Plan
Do we every verify nonces in useroperations? If so, do we just check that the nonce has not been used in the past? If we check that the nonce > previous nonce + 1, automated actions will only be able to work in the order that you create automated actions in. If not, this might be a security issue, but not for automated actions
Is the dynamoDB live?
What do we use sendTxLater for? if that is true, can we just send the automated action to the database?