1- # MultiRootVesting Integration Guide
2-
3- ## Prerequisites
4-
5- 1 . The Gang ERC20 token contract address
6- 2 . NFT collection addresses for Cat, Rat, Dog, Pigeon, and Crab collections
7- 3 . Merkle roots for all supported collection types:
8- - NFT Collections (Cat, Rat, Dog, Pigeon, Crab)
9- - Team
10- - SeedRound
11- - StrategicRound
12- - CommunityPresale
13- - Ecosystem
14- - Apechain
15- - Liquidity
1+ ## Working with GangVesting
162
17- ## Contract Deployment
3+ GangVesting is a simpler version with a single merkle root for all vesting schedules.
184
19- ### Step 1: Deploy Gang Token
20- First, deploy the Gang token contract. The deployer will receive the total supply of 1 billion GANG tokens (with 18 decimals).
5+ ### Deployment
216
22- ### Step 2: Deploy MultiRootVesting
23- The MultiRootVesting contract requires the following constructor parameters:
7+ Deploy the GangVesting contract with the following constructor parameters:
248``` solidity
25- constructor(
26- Collection[] memory collections,
27- bytes32[] memory roots,
28- address[] memory nftAddresses,
29- address _vestingToken
30- )
9+ constructor(bytes32 _merkleRoot, address _vestingToken)
3110```
3211
3312Required setup:
34- 1 . ` collections ` : Array of Collection enum values for initial setup
35- 2 . ` roots ` : Corresponding merkle roots for each collection
36- 3 . ` nftAddresses ` : Exactly 5 NFT collection addresses (Cat, Rat, Dog, Pigeon, Crab)
37- 4 . ` _vestingToken ` : Address of the deployed Gang token
13+ 1 . ` _merkleRoot ` : The merkle root for all vesting schedules
14+ 2 . ` _vestingToken ` : Address of the deployed Gang token
3815
39- ## Post-Deployment Setup
16+ ### Post-Deployment Setup
4017
41- 1 . Transfer required Gang tokens to the MultiRootVesting contract
18+ 1 . Transfer required Gang tokens to the GangVesting contract
42192 . Set ecosystem address using ` setEcosystemAddress() `
43- 3 . Update any merkle roots if needed using ` updateMerkleRoot() `
44- 4 . Once configuration is final, call ` lockRoots ()` to permanently lock the setup
20+ 3 . Update the merkle root if needed using ` updateMerkleRoot() `
21+ 4 . Once configuration is final, call ` lockRoot ()` to permanently lock the setup
4522
46- ## Integration Points
23+ ### Claiming Vested Tokens
4724
48- ### 1. Claiming Vested Tokens
4925Users can claim their vested tokens using:
5026``` solidity
5127function claim(
5228 bytes32[] calldata proof,
5329 Collection collection,
54- uint256 tokenId,
5530 address recipient,
5631 uint256 totalClaim,
5732 uint32 start,
5833 uint32 end
5934) external
6035```
61-
6236Key considerations:
6337- Generate valid merkle proofs for each claim
64- - For NFT collections (0-4), the actual recipient will be the current NFT owner
6538- Claims must be made within the vesting period plus 69-day expiry window
6639- Tokens vest linearly between start and end times
6740- Minimum 1 day between claims
6841
69- ### 2. Ecosystem Claims
42+ ### Ecosystem Claims
7043After the 69-day expiry window, unclaimed tokens can be recovered:
7144``` solidity
7245function claimEcosystemFunds(bytes32 leaf) external
7346```
7447
75- ### 3. Vesting Queries
48+ ### Vesting Queries
7649Check vesting details and claimable amounts:
7750``` solidity
7851function getVesting(
@@ -85,42 +58,6 @@ function getVesting(
8558) external view returns (Vesting memory, uint256 amount)
8659```
8760
88- ## Working with GangVesting
89-
90- GangVesting is a simpler version with a single merkle root for all vesting schedules.
91-
92- ### Deployment
93-
94- Deploy the GangVesting contract with the following constructor parameters:
95- ``` solidity
96- constructor(bytes32 _merkleRoot, address _vestingToken)
97- ```
98-
99- Required setup:
100- 1 . ` _merkleRoot ` : The merkle root for all vesting schedules
101- 2 . ` _vestingToken ` : Address of the deployed Gang token
102-
103- ### Post-Deployment Setup
104-
105- 1 . Transfer required Gang tokens to the GangVesting contract
106- 2 . Set ecosystem address using ` setEcosystemAddress() `
107- 3 . Update the merkle root if needed using ` updateMerkleRoot() `
108- 4 . Once configuration is final, call ` lockRoot() ` to permanently lock the setup
109-
110- ### Claiming Vested Tokens
111-
112- Users can claim their vested tokens using:
113- ``` solidity
114- function claim(
115- bytes32[] calldata proof,
116- Collection collection,
117- address recipient,
118- uint256 totalClaim,
119- uint32 start,
120- uint32 end
121- ) external
122- ```
123-
12461### Generating Merkle Trees
12562
12663Use the provided JavaScript example to generate merkle trees for GangVesting:
@@ -156,26 +93,6 @@ const merkleTree = new MerkleTree(leaves, keccak256, { sortPairs: true });
15693const merkleRoot = merkleTree .getHexRoot ();
15794```
15895
159- ### Contract Verification
160-
161- Verify the GangVesting contract on Blockscout:
162-
163- ``` bash
164- forge verify-contract \
165- --chain-id 33111 \
166- --verifier blockscout \
167- --verifier-url https://curtis.explorer.caldera.xyz/api \
168- --rpc-url https://curtis.rpc.caldera.xyz/http \
169- CONTRACT_ADDRESS \
170- src/GangVesting.sol:GangVesting \
171- --constructor-args $( cast abi-encode " constructor(bytes32,address)" " MERKLE_ROOT" " ERC20_TOKEN_ADDRESS" )
172- ```
173-
174- Replace:
175- - ` CONTRACT_ADDRESS ` with the deployed contract address
176- - ` MERKLE_ROOT ` with your merkle root value
177- - ` ERC20_TOKEN_ADDRESS ` with the Gang token address
178-
17996## Testing
18097
18198### Running Tests
0 commit comments