You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-**Verification Mechanism**: Merkle Tree for secure, gas-efficient verification
39
-
-**Security**: OpenZeppelin contract libraries
40
39
41
40
## Contract Details
42
41
@@ -46,7 +45,7 @@ The MigrationLocker contract is responsible for allowing users to lock their PUS
46
45
47
46
**Key Features:**
48
47
- Token locking mechanism with unique identifier generation
49
-
- Safety toggles to prevent/allow locking
48
+
- Safety toggles to prevent/allow locking - Owner Controlled
50
49
- Proper access control with Ownable2Step pattern
51
50
- Token burning capability for migrated tokens
52
51
- Emergency fund recovery functionality
@@ -66,6 +65,8 @@ The MigrationLocker contract is responsible for allowing users to lock their PUS
66
65
67
66
The MigrationLocker contract uses an epoch-based system to organize token locks into time periods for efficient Merkle Tree generation.
68
67
68
+
It should be noted, however, that epochs are owner-controlled.
69
+
69
70
**How it Works:**
70
71
- Each epoch represents a specific time period for token locking
71
72
- The current epoch is recorded when users lock tokens via the `Locked` event
@@ -75,6 +76,14 @@ The MigrationLocker contract uses an epoch-based system to organize token locks
75
76
76
77
This system ensures organized processing of token locks across different time periods.
77
78
79
+
**Expected Workflow**
80
+
1. Owner initiates LOCKING with `initiateNewEpoch()`, i.e., Epoch-1
81
+
2. Duration for how long EPOCH-1 will run is flexible and decided by owner, hence owner-controlled.
82
+
3. Users starts locking token in EPOCH-1. All such locks emit out `Locked(msg.sender, _recipient, _amount, 1)`. These event and params will be used for merkle proof creation.
83
+
4. After 30 days, for example, owner initiates pause() and triggers `initiateNewEpoch(). i.e., EPOCH-2.
84
+
5. Same locking cycle starts again, but now locks emits out `Locked(msg.sender, _recipient, _amount, 2)`.
85
+
86
+
---
78
87
### MigrationRelease.sol
79
88
80
89
The MigrationRelease contract manages the release of migrated tokens to eligible users based on Merkle proofs.
@@ -86,16 +95,21 @@ The MigrationRelease contract manages the release of migrated tokens to eligible
86
95
- Fair and transparent distribution mechanism
87
96
- Fund recovery safety mechanism
88
97
89
-
## Important Constants
98
+
## Important Constants and Params
90
99
91
100
-`VESTING_PERIOD`: 90 days
92
101
-`INSTANT_RATIO`: 75 (interpreted as 7.5x)
93
102
-`VESTING_RATIO`: 75 (interpreted as 7.5x)
94
103
95
104
**Release Model:**
96
-
-**Instant Release**: 50% of the locked amount is immediately available
97
-
-**Vested Release**: Additional 50% of the locked amount is available after a 90-day vesting period
98
-
- Total migration ratio: 1:15 (locked:received)
105
+
-**Instant Release**:
106
+
a. As users provide proof of their fund-lock, 50% of the locked amount is immediately released.
107
+
b. Once released, we record the timestamp of instant release.
108
+
c. Only after 90 days of this timestamp, users can unlock their vested release.
109
+
110
+
-**Vested Release**:
111
+
a. Vested release is the release that takes place 90 days after instant release.
112
+
b. Merkle proof is still required but the 90 days check is additionally imposed.
@@ -125,7 +139,14 @@ The system uses a Merkle Tree for efficient and secure verification of eligible
125
139
126
140
### Technical Implementation
127
141
128
-
The Merkle Tree implementation in `script/utils/merkle.js` provides these key functions:
142
+
The utility scripts in the `script/utils` folder handle the Merkle tree generation process:
143
+
144
+
-**merkle.js**: Core Merkle tree implementation with functions to hash leaves, generate roots, create proofs, and verify claims using the (address, amount, epoch) format.
145
+
-**fetchAndStoreEvents.js**: Fetches all "Locked" events from the MigrationLocker contract, groups them by address and epoch, combines amounts for duplicate addresses within the same epoch, and saves the processed claims.
146
+
-**getRoot.js**: Simple utility that loads processed claims and generates the Merkle root for deployment to the MigrationRelease contract.
147
+
-**config.js**: Contains configuration settings for contract addresses, ABIs, and file paths used by the utility scripts.
148
+
149
+
Key functions in `merkle.js`:
129
150
130
151
-`hashLeaf(address, amount, epochId)`: Creates hashed leaves for the Merkle Tree
131
152
-`getRoot(claims)`: Generates the Merkle root from an array of claims
@@ -154,23 +175,12 @@ The system uses the following security measures for claims verification:
154
175
-`script/deploy/DeployLocker.s.sol`: Deploys the MigrationLocker contract
155
176
-`script/deploy/DeployRelease.s.sol`: Deploys the MigrationRelease contract and sets the Merkle root
156
177
157
-
## Utility Scripts
158
-
159
-
The project includes several utility scripts for managing the migration process:
160
-
161
-
-`script/utils/fetchAndStoreEvents.js`: Fetches lock events from the MigrationLocker contract
162
-
-`script/utils/merkle.js`: Contains functions for Merkle Tree generation and verification
163
-
-`script/utils/getRoot.js`: Computes the Merkle root from claims data
164
-
-`script/testUtils/getPoof.js`: Generates proofs for individual claims
165
-
-`script/testUtils/verify.js`: Verifies claims against the Merkle Tree
166
-
-`script/testUtils/proofArray.js`: Generates proofs for multiple claims
0 commit comments