Skip to content

Commit 72e5737

Browse files
authored
docs: token deploy instructions (#1629)
1 parent dc613d9 commit 72e5737

File tree

1 file changed

+71
-0
lines changed

1 file changed

+71
-0
lines changed

claim_contracts/README.md

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,74 @@ Then run the following script:
3434
```
3535
./deployClaim.sh
3636
```
37+
38+
## Production
39+
40+
This is a series of steps to deploy the token to production and upgrade it if necessary.
41+
42+
### Safe wallet creation
43+
44+
First we create a wallet in [Safe](https://app.safe.global/) to represent the foundation. We assume this is done by the user. This safe will:
45+
- Receive part of the deployed tokens.
46+
- Own the proxy admin contract. This is the contract that can upgrade the token contract.
47+
- Own the proxy contract. This will point to the current implementation of the contract. All users and the safe itself will interact with this contract to mint, transfer, burn, and other erc20 operations.
48+
49+
### Configuration
50+
51+
There is an example configuration file in `script-config/config.example.json`. Before deploying to production, we need to create a `config.mainnet.json` file in the same folder with the same contents as the example, but we need to change a couple of fields:
52+
53+
- `foundation`: this is the address of the safe that was created in the previous step.
54+
- `claimSupplier`: this is the address of a different safe that will provide the funds for the claim contract when it is deployed.
55+
- `deployer`: The address of the deterministic create2 deployer as specified in the [official repo](https://github.com/Arachnid/deterministic-deployment-proxy). The address should be `0x4e59b44847b379578588920ca78fbf26c0b4956c`.
56+
- `salt`: An arbitrary value provided by the sender. This is a 32-bytes hex string. We default to 0.
57+
58+
### Deployment of the Token (proxy and implementation)
59+
60+
```bash
61+
make deploy-token PRIVATE_KEY=<private_key> RPC_URL=<rpc_url> CONFIG=<config>
62+
```
63+
64+
This make target internally executes a forge script that:
65+
66+
1. Deploys the token implementation that will be used only for its logic.
67+
2. Deploys the Transparent Proxy, which also deploys the proxy admin. In this step the safe is set as the owner of both the owner of the proxy admin and the proxy (token).
68+
69+
The private key does NOT correspond to the safe, it needs to represent an account with sufficient funds to deploy the token.
70+
71+
Arguments (env variables):
72+
- `PRIVATE_KEY`: the private key of the deployer account. This is NOT the foundation safe, just any account with enough eth for the deployment. This operation consumes approximately `3935470` gas units. As of Dec 16 2024, the gas price for a high priority is 16 gwei, which means around `0.063` eth.
73+
- `RPC_URL`: a gateway or node that allows for rpc calls.
74+
- `CONFIG`: the name of the configuration file. For `config.example.json` the name would be `example`. For `config.mainnet.json`, this would be `mainnet`.
75+
76+
The output of the deployment will look something like this:
77+
78+
```
79+
== Logs ==
80+
Aligned Token Proxy deployed at address: 0x9eDC342ADc2B73B2E36d0e77475bCF2103F09a22 with proxy admin: 0x51D94AdA2FFBFED637e6446CC991D8C65B93e167 and owner: 0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC
81+
82+
...
83+
84+
##### sepolia
85+
✅ [Success]Hash: 0x6b58e061e0c37209bf7e33a4a4705706b5accd13b8964ecf2ae919fe01f41da1
86+
Contract Address: 0xDC1dc4e84b0FB522DBa3a14C909b90c96496830C
87+
Block: 7293558
88+
Paid: 0.008478255653505184 ETH (1850587 gas * 4.581387232 gwei)
89+
```
90+
91+
As a sanity check, we can call the following make target with the address of the deployed proxy contract.
92+
93+
```bash
94+
make test-token ADDRESS=0x9eDC342ADc2B73B2E36d0e77475bCF2103F09a22
95+
```
96+
97+
This calls functions to get the name, symbol and total supply in the deploy contract and displays them on the screen.
98+
99+
### Contract Verification in explorer
100+
101+
We can also verify the implementation contract in Etherscan, which is useful for other applications like wallets to recognize the ABI.
102+
103+
```
104+
forge verify-contract 0xDC1dc4e84b0FB522DBa3a14C909b90c96496830C --rpc-url $RPC_URL --etherscan-api-key $ETHERSCAN_API_KEY
105+
```
106+
107+
In this case we pass the implementation contract address.

0 commit comments

Comments
 (0)