Skip to content

docs: Simplify claim contracts local deployment step-by-step guide #1723

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: testnet
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions claim_contracts/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,19 @@ calldata-pause: ## 💾 Calldata for the method `pause` to use in a transaction

# Deployments

# Requires MERKLE_ROOT, TIMESTAMP
# CONFIG, RPC_URL, DEPLOYER_PRIVATE_KEY are optional
deploy-example: deploy-token-local deploy-claimable-local claimable-update-root claimable-update-timestamp approve-claimable claimable-unpause

RPC_URL?=http://localhost:8545
DEPLOYER_PRIVATE_KEY?=0x5de4111afa1a4b94908f83103eb1f1706367c2e68ca870fc3fb9a804cdab365a
CONFIG?=example
deploy-token: ## 🚀 Deploy the token contract
deploy-token-local: ## 🚀 Deploy the token contract
cd script && \
forge script DeployAlignedToken.s.sol \
--sig "run(string)" \
$(CONFIG) \
--sig "run(string)" example \
--private-key $(DEPLOYER_PRIVATE_KEY) \
--rpc-url $(RPC_URL) \
--rpc-url http://localhost:8545 \
--broadcast \
--verbosity 3

Expand Down Expand Up @@ -186,6 +189,3 @@ OWNER_PRIVATE_KEY?=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f
test-airdrop:
cast call $(AIRDROP) "paused()(bool)" --rpc-url $(RPC_URL)
cast call $(AIRDROP) "owner()(address)" --rpc-url $(RPC_URL)

# Requires MERKLE_ROOT, TIMESTAMP
deploy-example: deploy-token deploy-claimable-local claimable-update-root claimable-update-timestamp approve-claimable claimable-unpause
77 changes: 37 additions & 40 deletions claim_contracts/README.md
Original file line number Diff line number Diff line change
@@ -1,48 +1,44 @@
#
# Aligned Token Claim Contracts

## Local
## How to run locally

### Requisites

- Foundry

### Run

1. Run anvil in one terminal:
```
anvil
```
2. Deploy the token
```
make deploy-token
```
3. Write down the token proxy address that is printed in the console output. Do this in the `config.example.json` file, under the `tokenProxy` key.
4. Deploy the claimable contract
```
make deploy-claimable-local
```
5. Write down the claimable contract proxy address that is printed in the console output.

## Testnet (Sepolia)

### Requisites
> [!IMPORTANT]
> Foundry must be installed and running.

1. Run `anvil` in one terminal.
2. Get your local **foundation** and **token distributor** wallet addresses and write them down in the `claim_contracts/script-config/config.example.json` file. **Only the `foundation` and `tokenDistributor` fields should be modified in this step**.
3. Run `make deploy-token-local DEPLOYER_PRIVATE_KEY=<deployer_private_key>` in another terminal.
4. Write down the forge script's output (the addresses of the token proxy and its admin preferably).
5. From the output of the previous step, complete the `claim_contracts/script-config/config.example.json` file with the token proxy address. **Only the `tokenProxy` field should be modified in this step**.
6. Run `make deploy-claimable DEPLOYER_PRIVATE_KEY=<deployer_private_key>`.
7. Write down the forge script's output (the addresses of the claimable proxy and its admin preferably).
8. From the output of the previous step, complete the `claim_contracts/script-config/config.example.json` file with the claimable proxy address. **Only the `claimableProxy` field should be modified in this step**.
9. Run `make claimable-update-root RPC_URL=http://localhost:8545 OWNER_PRIVATE_KEY=<foundation_private_key> AIRDROP=<claimable_proxy_address> MERKLE_ROOT=<merkle_root>`.
10. Run `make claimable-update-timestamp RPC_URL=http://localhost:8545 OWNER_PRIVATE_KEY=<foundation_private_key> AIRDROP=<claimable_proxy_address> TIMESTAMP=2733427549`.
11. Run `make approve-claimable RPC_URL=http://localhost:8545 DISTRIBUTOR_PRIVATE_KEY=<token_distributor_private_key> TOKEN=<token_proxy_address> AIRDROP=<claimable_proxy_address>`.
12. Run `make claimable-unpause RPC_URL=http://localhost:8545 OWNER_PRIVATE_KEY=<foundation_private_key> AIRDROP=<claimable_proxy_address>`.

- Foundry
- Etherscan API key
> [!NOTE]
> You can do the previous steps in one run with `make deploy-example MERKLE_ROOT=<merkle_root> TIMESTAMP=2733427549`.
> Remember to write down the addresses of the proxies and their admins.

### Run
## How to run in Sepolia testnet

1. Create a file `script-config/config.sepolia.json` following the example in `script-config/config.sepolia.example.json`.
2. Deploy the token
```
make deploy-token-testnet RPC_URL=<sepolia-rpc-url> PRIVATE_KEY=<sepolia-funded-account-private-key>
```
3. Write down the `token-proxy-address` that is printed in the console output. Do this in the `config.sepolia.json` file, under the `tokenProxy` key.
4. Deploy the claimable contract
```
make deploy-claimable-testnet RPC_URL=<sepolia-rpc-url> DEPLOYER_PRIVATE_KEY=<sepolia-funded-account-private-key> ETHERSCAN_API_KEY=<etherscan-api-key>
```
5. Write down the `claimable-proxy-address` that is printed in the console output.
> [!IMPORTANT]
> Foundry must be installed and running.
> You must have an Etherscan API key.

1. Get your **foundation** and **token distributor** wallet addresses and write them down in the `claim_contracts/script-config/config.sepolia.json` file (as it is done in the `claim_contracts/script-config/config.example.json` file). **Only the `foundation` and `tokenDistributor` fields should be modified in this step**.
2. Run `make deploy-token-testnet DEPLOYER_PRIVATE_KEY=<deployer_private_key> RPC_URL=<sepolia_rpc_url> ETHERSCAN_API_KEY=<your_etherscan_api_key>`.
3. Write down the forge script's output (the addresses of the token proxy and its admin preferably).
4. From the output of the previous step, complete the `claim_contracts/script-config/config.sepolia.json` file with the token proxy address. **Only the `tokenProxy` field should be modified in this step**.
5. Run `make deploy-claimable-testnet DEPLOYER_PRIVATE_KEY=<deployer_private_key> RPC_URL=<sepolia_rpc_url> ETHERSCAN_API_KEY=<your_etherscan_api_key>`.
6. Write down the forge script's output (the addresses of the claimable proxy and its admin preferably).
7. From the output of the previous step, complete the `claim_contracts/script-config/config.sepolia.json` file with the claimable proxy address. **Only the `claimableProxy` field should be modified in this step**.
8. Run `make claimable-update-root RPC_URL=<sepolia_rpc_url> OWNER_PRIVATE_KEY=<foundation_private_key> AIRDROP=<claimable_proxy_address> MERKLE_ROOT=<merkle_root>`.
9. Run `make claimable-update-timestamp RPC_URL=<sepolia_rpc_url> OWNER_PRIVATE_KEY=<foundation_private_key> AIRDROP=<claimable_proxy_address> TIMESTAMP=2733427549`.
10. Run `make approve-claimable RPC_URL=<sepolia_rpc_url> DISTRIBUTOR_PRIVATE_KEY=<token_distributor_private_key> TOKEN=<token_proxy_address> AIRDROP=<claimable_proxy_address>`.
11. Run `make claimable-unpause RPC_URL=<sepolia_rpc_url> OWNER_PRIVATE_KEY=<foundation_private_key> AIRDROP=<claimable_proxy_address>`.

## Enabling Claimability

Expand All @@ -56,6 +52,7 @@
> - Step 3 must be done by the token distributor multisig as it is the one that has the tokens to be claimed.

> [!WARNING]
>
> - Double-check the data you passing into the commands, any mistake can lead to undesired behavior.

1. Update the merkle root
Expand Down