Skip to content

Commit a95b006

Browse files
committed
chore: add final changes missed
1 parent 7eb5081 commit a95b006

File tree

4 files changed

+108
-10
lines changed

4 files changed

+108
-10
lines changed

.env.example

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ export PRIVATE_KEY=
1919
# WEB3_ALCHEMY_PROJECT_ID: Your Alchemy project ID used as the default provider by bot.py with the ape-alchemy plugin.
2020
export WEB3_ALCHEMY_PROJECT_ID=
2121

22-
# GNOSISSCAN_API_KEY: API key for Gnosisscan, which lets bot.py automatically fetch and cache ABIs for contracts with ape-etherscan plugin.
23-
export GNOSISSCAN_API_KEY=
22+
# ETHERSCAN_API_KEY: API key for Gnosisscan, which lets bot.py automatically fetch and cache ABIs for contracts with ape-etherscan plugin.
23+
export ETHERSCAN_API_KEY=
2424

2525
# CHAIN_ID: The chain ID required by smart-contract-infra for deploying and configuring agent-safe components.
2626
export CHAIN_ID=

README.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@
99
[license]: https://opensource.org/licenses/MIT
1010
[license-badge]: https://img.shields.io/badge/License-MIT-yellow.svg
1111

12-
Welcome to **Moozilla x Kong**
13-
Your project description goes here...
14-
1512
## Development Prerequisites
1613

1714
- **[Bun](https://bun.sh)** `v1.1.31`
@@ -56,7 +53,7 @@ Each variable is explained in the `.env.example` file. Be sure to copy `.env.exa
5653
- **Web3 Variables:**
5754
- `PRIVATE_KEY`
5855
- `WEB3_ALCHEMY_PROJECT_ID`
59-
- `GNOSISSCAN_API_KEY`
56+
- `ETHERSCAN_API_KEY`
6057
- `CHAIN_ID`
6158
- `SAFE_ADDRESS` (optional)
6259
- `TRADING_MODULE_ADDRESS` (optional)

smart-contract-infra/README.md

Lines changed: 102 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,102 @@
1-
## Smart Contract Infrastructure
1+
# Smart Contract Infrastructure
2+
3+
This repository provides the deployment scripts and tooling for smart contracts and governance processes. It covers
4+
one-off deploys (via Foundry) for core contracts—such as the token allowlist, CoWSwapGuard, and TradingModule
5+
mastercopy—as well as day-to-day operations for users and agents.
6+
7+
## Getting Started
8+
9+
1. **Install dependencies:**
10+
11+
```bash
12+
bun i
13+
```
14+
15+
2. **Compile Smart Contracts:**
16+
17+
```bash
18+
bun run build
19+
```
20+
21+
## Smart Contracts Overview
22+
23+
- **TokenAllowlist ([TokenAllowlist.sol](./src/TokenAllowlist.sol)):**
24+
Enables the contract owner to manage a list of approved tokens. It provides functions to add or remove tokens and
25+
check if a token is allowed, ensuring that trading is confined to community-vetted assets.
26+
27+
- **TradingModule ([TradingModule.sol](./src/TradingModule.sol)):**
28+
A Zodiac Guardable Module that allows an AI trading agent to transact on behalf of a Safe. It enforces trading rules
29+
by verifying that only tokens on the allowlist are used and that trades execute exclusively on CoWSwap. Additionally,
30+
it sets a pre-signature on orders to make them tradeable and includes a pause mechanism—letting the owner disable
31+
trading when needed.
32+
33+
- **CoWSwapGuard ([CoWSwapGuard.sol](./src/CoWSwapGuard.sol)):**
34+
Implements guard checks to ensure that trades adhere to community-defined rules. It restricts trading to approved
35+
token pairs and parameters, acting as an additional security layer to prevent unauthorized or unsafe trading actions.
36+
37+
## Deployment Overview
38+
39+
### Foundry Deploy Scripts (One-Off Deploys)
40+
41+
These scripts deploy core contracts per chain. For example, on Gnosis Chain, the following addresses have been deployed:
42+
43+
- **Allowlist:** `0xE0CBa604f8be035a80D21b49C67BdcE59Bba9d76`
44+
- **Guard:** `0xF67966246d72fC124d19B7F2d03DD690B756De88`
45+
- **TradingModule MasterCopy:** `0xDdd11DC80A25563Cb416647821f3BC5Ad75fF1BA`
46+
47+
Foundry deploy scripts include:
48+
49+
- `script/01_Deploy_Allowlist.s.sol`
50+
- `script/02_Deploy_CoWSwapGuard.s.sol`
51+
- `script/03_Deploy_MasterCopy.s.sol`
52+
53+
**Token Configuration Script:**
54+
55+
- `script/01A_AddTokens_Allowlist.s.sol`
56+
This script configures the allowlist with the GNO, WXDAI, and COW tokens.
57+
58+
### Bun Deploy Scripts for Users/Agents
59+
60+
These scripts provide two deployment options:
61+
62+
- **Bring Your Own (BYO) Safe and TradingModule Proxy:** If you already have a Safe and proxy deployed, set the required
63+
environment variables and run:
64+
65+
```bash
66+
bun run script/safe/module-config.ts
67+
bun run script/safe/enable-module.ts
68+
```
69+
70+
These commands will:
71+
72+
- Enable the module on your existing Safe.
73+
- Configure the module by setting the required guard.
74+
- Register your account (private key) as an allowed trader.
75+
76+
- **Deploy a New Safe and TradingModule Proxy:** If you don't have a Safe and TradingModule already deployed, run:
77+
```bash
78+
bun run script/safe/deploy-all.ts
79+
```
80+
This deploys a new Safe, a new TradingModule proxy, and then automatically configures them as above.
81+
82+
## Additional Information
83+
84+
- **Configuration Files:**
85+
This repo includes configuration files for Prettier, Solhint, Foundry, and others to streamline development and
86+
deployment.
87+
88+
- **Contract Address Resolution:**
89+
Contract addresses can be configured through environment variables. If not set, the scripts will default to values
90+
from the deployments (Foundry) configuration.
91+
92+
## Safety
93+
94+
This software is experimental and provided on an "as-is" and "as available" basis. The team makes no warranties, express
95+
or implied, and will not be liable for any losses or damages incurred through its use. It is crucial that you perform
96+
your own thorough tests to ensure compatibility and correct behavior with your code.
97+
98+
## Future Work
99+
100+
- Develop a helper script to build Tenderly transactions for the CoW DAO Governance mechanism.
101+
- Implement a comprehensive test suite based on the Branching Tree Technique
102+
([BTT](https://github.com/paulber19/branching-tree-testing)).

smart-contract-infra/deployments/contracts.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
"safe": "0x0000000000000000000000000000000000000000"
1010
},
1111
"100": {
12-
"allowlist": "0xE0CBa604f8be035a80D21b49C67BdcE59Bba9d76",
13-
"guard": "0xF67966246d72fC124d19B7F2d03DD690B756De88",
14-
"tradingModuleMasterCopy": "0x0000000000000000000000000000000000000000",
12+
"allowlist": "0x98a4351d926e6274829c3807f39D9a7037462589",
13+
"guard": "0xcab68170145d593F15BF398670876CcCBFe173e2",
14+
"tradingModuleMasterCopy": "0xDdd11DC80A25563Cb416647821f3BC5Ad75fF1BA",
1515
"tradingModuleProxy": "0xF11bC1ff8Ab8Cc297e5a1f1A51B8d1792E99D648",
1616
"safe": "0xbc3c7818177dA740292659b574D48B699Fdf0816"
1717
},

0 commit comments

Comments
 (0)