Skip to content

Commit 49e7fa7

Browse files
committed
updated README
1 parent 480bfa3 commit 49e7fa7

File tree

1 file changed

+29
-19
lines changed

1 file changed

+29
-19
lines changed

README.md

Lines changed: 29 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ The migration system consists of two main components:
3636
- **Framework**: Foundry, with Hardhat for deployments
3737
- **Proxy Pattern**: OpenZeppelin Transparent Upgradeable Proxy
3838
- **Verification Mechanism**: Merkle Tree for secure, gas-efficient verification
39-
- **Security**: OpenZeppelin contract libraries
4039

4140
## Contract Details
4241

@@ -46,7 +45,7 @@ The MigrationLocker contract is responsible for allowing users to lock their PUS
4645

4746
**Key Features:**
4847
- Token locking mechanism with unique identifier generation
49-
- Safety toggles to prevent/allow locking
48+
- Safety toggles to prevent/allow locking - Owner Controlled
5049
- Proper access control with Ownable2Step pattern
5150
- Token burning capability for migrated tokens
5251
- Emergency fund recovery functionality
@@ -66,6 +65,8 @@ The MigrationLocker contract is responsible for allowing users to lock their PUS
6665

6766
The MigrationLocker contract uses an epoch-based system to organize token locks into time periods for efficient Merkle Tree generation.
6867

68+
It should be noted, however, that epochs are owner-controlled.
69+
6970
**How it Works:**
7071
- Each epoch represents a specific time period for token locking
7172
- 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
7576

7677
This system ensures organized processing of token locks across different time periods.
7778

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+
---
7887
### MigrationRelease.sol
7988

8089
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
8695
- Fair and transparent distribution mechanism
8796
- Fund recovery safety mechanism
8897

89-
## Important Constants
98+
## Important Constants and Params
9099

91100
- `VESTING_PERIOD`: 90 days
92101
- `INSTANT_RATIO`: 75 (interpreted as 7.5x)
93102
- `VESTING_RATIO`: 75 (interpreted as 7.5x)
94103

95104
**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.
99113

100114
**Main Functions:**
101115
- `releaseInstant(address _recipient, uint _amount, uint _epoch, bytes32[] calldata _merkleProof)`: Claims instant portion
@@ -125,7 +139,14 @@ The system uses a Merkle Tree for efficient and secure verification of eligible
125139

126140
### Technical Implementation
127141

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`:
129150

130151
- `hashLeaf(address, amount, epochId)`: Creates hashed leaves for the Merkle Tree
131152
- `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:
154175
- `script/deploy/DeployLocker.s.sol`: Deploys the MigrationLocker contract
155176
- `script/deploy/DeployRelease.s.sol`: Deploys the MigrationRelease contract and sets the Merkle root
156177

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
167-
168178
## Usage Instructions
169179

170180
### Building the Project
171181

172182
```shell
173-
npx hardhat compile
183+
forge build
174184
```
175185

176186
### Testing the Project

0 commit comments

Comments
 (0)