diff --git a/claim_contracts/Makefile b/claim_contracts/Makefile index d1f5ab351..8f0233b52 100644 --- a/claim_contracts/Makefile +++ b/claim_contracts/Makefile @@ -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 @@ -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 diff --git a/claim_contracts/README.md b/claim_contracts/README.md index 65c2ba6a1..9798ccb89 100644 --- a/claim_contracts/README.md +++ b/claim_contracts/README.md @@ -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=` 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=`. +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= AIRDROP= MERKLE_ROOT=`. +10. Run `make claimable-update-timestamp RPC_URL=http://localhost:8545 OWNER_PRIVATE_KEY= AIRDROP= TIMESTAMP=2733427549`. +11. Run `make approve-claimable RPC_URL=http://localhost:8545 DISTRIBUTOR_PRIVATE_KEY= TOKEN= AIRDROP=`. +12. Run `make claimable-unpause RPC_URL=http://localhost:8545 OWNER_PRIVATE_KEY= AIRDROP=`. -- Foundry -- Etherscan API key +> [!NOTE] +> You can do the previous steps in one run with `make deploy-example 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= 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= DEPLOYER_PRIVATE_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= RPC_URL= 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= RPC_URL= 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= OWNER_PRIVATE_KEY= AIRDROP= MERKLE_ROOT=`. +9. Run `make claimable-update-timestamp RPC_URL= OWNER_PRIVATE_KEY= AIRDROP= TIMESTAMP=2733427549`. +10. Run `make approve-claimable RPC_URL= DISTRIBUTOR_PRIVATE_KEY= TOKEN= AIRDROP=`. +11. Run `make claimable-unpause RPC_URL= OWNER_PRIVATE_KEY= AIRDROP=`. ## Enabling Claimability @@ -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