This repository shows usage of Web3 Actions running with a simple multisig wallet.
The Web3 Action multisig
is ran when a transaction emits one of following events:
- TxSubmission: run a simulation on a fork and send a message to Discord about the results
- TxConfirmation: send a message to Discord
- ExecuteTransaction: send a message to Discord
- Tenderly CLI installed and logged in via CLI.
The Web3 Actions code is located in web3-actions
folder. You can specify this when running tenderly actions init
.
To run the example, you can either use pre-deployed and Tenderly-verified contracts or spare some time to deploy your own contracts. Follow the rest of instructions to run the example.
Before you run the examples, you need to change the REPLACE_ME
placeholders with your own values.
yarn
cd web3-actions && yarn && cd ..
Note: The Web3 Actions project is an NPM project.
To save some time and to manually run Web 3 Actions from Tenderly Dashboard, you can use pre-deployed contracts listed below.
These include a single approved and executed transaction you can use for running Web3 Actions.
The contracts are deployed on Ropsten at the follwing addresses:
Contract | Address |
---|---|
MultisigWallet | 0x6794b4635e094982ed890f8b5fd57a45227d4a98 |
Token | 0x945b7c7178abd5936db09186b58a789d8308b876 |
Transactions executed on these contracts:
Action | TX Hash |
---|---|
Submit | 0xa71c273fd5e3b92b4ade35d284995504aed53fb3e6673fe4f5fcec045c75e77a |
Confirm 1 | 0x6f08c6803a470039b73072a9dc34d69dcd0261fab29ac4cbcb02bb87daf96aa9 |
Confirm 2 | 0xf4c527efb784ac58b8c7a4483f00a07a687ecc4b8f38c6cbf9f95dd0f695cfb5 |
Execute | 0x9ae0ec902fa209c60ffa10ecaf0446dbccd36a02e33d18f16bc182e57de94ac4 |
You can use these TX hashes to run Web3 Actions manually from the Dashboard. Skip to Deploying Web3 Actions.
Note: since the contracts are deployed with a pre-defined list of owners, you can simulate transactions, but you can't submit, approve or execute any of these transactions on Ropsten.
If you want to run Web3 Actions on your own contracts, you can deploy them manually. For this example, we will use the Ropsten testnet.
▶️ Action: Set up a hardhat project .env file and replace placeholders. Source the demo-setup-scripts/init-env-hardhat.sh script and replace the placeholders.
source demo-setup-scripts/init-env-hardhat.sh
▶️ Action: Deploy the Contracts to Ropsten. Use shorthand scriptyarn deploy:ropsten
. Hardhat project is set up with Tenderly Hardhat Plugin automatic contract verification so your contracts are verified automatically as they're deployed▶️ Action: Run a first set of transactions: submit 1 tx to multisig, do two approvals and optionally execute it. Use the scriptyarn multisig-play:ropsten
.▶️ Action: Copy the address of Multisig from deployment step (also found indeployments.json
) and paste it intotenderly.yaml
in place ofMULTISIG_ADDRESS
placeholder.
Before deploying the action to Tenderly, you can test it out locally.
source demo-setup-scripts/init-env-hardhat.sh
yarn multisig-local
👾 You should get several Discord messages and see some meaningful output. If all went well, you can go on and deploy the action to Tenderly.
The file web3-actions/multisig-local.js
is a simple script that runs Web3 Actions locally,
using @tenderly/actions-test.
It requires Transaction payload to be passed as an argument. In the web3-actions/payload directory you'll find JSON file corresponding to an example transactions that submit, approve and execute a multisig transaction. For running locally, it's fine to use the provided ones.
tenderly.yaml
and replace placeholders with your Username
and Project Slug.
TENDERLY_ACCESS_KEY
following these instructions.multisig.DISCORD_URL
You can either use contract addresses of pre-deployed contracts or your own
tenderly.yaml
(the root of this example project), run
tenderly actions deploy
- open the
multisig
action - click Manual Run
- copy TX hash either from Tenderly Dashboard or from the table in 1A: Using pre-deployed contracts
- paste the hash of transaction
- select Copy on write storage option
- click ⚡️ Trigger button at the bottom of the page. Your Web3 Action should run, your Discord should receive a message
If you deployed your own contracts in step 1B: Deploy your own contracts, you can run
the multisig-play
script. Your Web3 Actions should pick up on the new transactions and run accordingly.
tenderly actions multisig-play:ropsten
- the
deployments.json
keeps track of deployed contracts so these can be easier to find in run scripts:multisig-play.ts
. - When re-deploying, clean the
deployments.json
so the array is empty:
{
"latest": []
}