IV1Migrator
Inherits: IEnabler, IVersioned
Title: IV1Migrator
forge-lint: disable-start(mixed-case-function,mixed-case-variable)
Interface for the V1Migrator policy that allows GVI v1 holders to migrate to GVI v2 via merkle proof verification
Functions
gviV1
The GVI v1 token contract
function gviV1() external view returns (IERC20 gviV1_);
Returns
| Name | Type | Description |
|---|---|---|
gviV1_ | IERC20 | The GVI v1 token |
gviV2
The GVI v2 token contract
function gviV2() external view returns (IERC20 gviV2_);
Returns
| Name | Type | Description |
|---|---|---|
gviV2_ | IERC20 | The GVI v2 token |
gGVI
The gGVI token contract used for conversion calculations
Used to calculate GVI v2 amount via balanceTo/balanceFrom to match production flow
function gGVI() external view returns (address gGVI_);
Returns
| Name | Type | Description |
|---|---|---|
gGVI_ | address | The gGVI token |
merkleRoot
The current merkle root for verifying eligible claims
function merkleRoot() external view returns (bytes32 merkleRoot_);
Returns
| Name | Type | Description |
|---|---|---|
merkleRoot_ | bytes32 | The current merkle root |
migratedAmounts
The amount a user has migrated under the current root
function migratedAmounts(address account_) external view returns (uint256 migratedAmount_);
Parameters
| Name | Type | Description |
|---|---|---|
account_ | address | The account to check |
Returns
| Name | Type | Description |
|---|---|---|
migratedAmount_ | uint256 | The amount migrated by the user |
remainingMintApproval
The remaining amount of GVI that can be minted by this contract
Returns the actual MINTR mint approval, not a stored value. This is the remaining amount available for migration and is always in sync with MINTR state.
function remainingMintApproval() external view returns (uint256 remaining_);
Returns
| Name | Type | Description |
|---|---|---|
remaining_ | uint256 | The remaining GVI that can be minted |
totalMigrated
The total amount of GVI v1 migrated so far
function totalMigrated() external view returns (uint256 totalMigrated_);
Returns
| Name | Type | Description |
|---|---|---|
totalMigrated_ | uint256 | The total migrated amount |
previewMigrate
Preview the GVI v2 amount that will be received for a given GVI v1 amount
Performs the same gGVI conversion as migrate() without state changes. Users migrating multiple times will lose dust on each transaction. Recommended: migrate full allocation in one transaction.
function previewMigrate(uint256 amount_) external view returns (uint256 gviV2Amount_);
Parameters
| Name | Type | Description |
|---|---|---|
amount_ | uint256 | The amount of GVI v1 to preview (9 decimals) |
Returns
| Name | Type | Description |
|---|---|---|
gviV2Amount_ | uint256 | The amount of GVI v2 that would be received (9 decimals), or 0 if conversion rounds to zero |
migrate
Migrate GVI v1 to GVI v2
User must approve this contract to transfer their GVI v1 Users can migrate any amount up to their allocated amount in multiple transactions
function migrate(uint256 amount_, bytes32[] calldata proof_, uint256 allocatedAmount_) external;
Parameters
| Name | Type | Description |
|---|---|---|
amount_ | uint256 | The amount of GVI v1 to migrate (9 decimals) |
proof_ | bytes32[] | The merkle proof proving the user is eligible |
allocatedAmount_ | uint256 | The user's allocated amount from the merkle tree |
setMerkleRoot
Update the merkle root for eligible claims
function setMerkleRoot(bytes32 merkleRoot_) external;
Parameters
| Name | Type | Description |
|---|---|---|
merkleRoot_ | bytes32 | The new merkle root |
setRemainingMintApproval
Set the remaining MINTR mint approval for migration
This sets the remaining amount that can be minted, NOT a lifetime total. If you want 1000 GVI v2 to be available for migration and 600 has already been minted, call this with 1000 (not 400). Queries the current MINTR approval and adjusts it to the target approval.
function setRemainingMintApproval(uint256 approval_) external;
Parameters
| Name | Type | Description |
|---|---|---|
approval_ | uint256 | The target remaining mint approval (9 decimals) |
rescue
Rescue accidentally sent tokens
Only callable by admin or legacy migration admin. Sweeps entire balance to caller.
function rescue(IERC20 token_) external;
Parameters
| Name | Type | Description |
|---|---|---|
token_ | IERC20 | The ERC20 token to rescue |
verifyClaim
Verify if a claim is valid for a given account and allocated amount
function verifyClaim(address account_, uint256 allocatedAmount_, bytes32[] calldata proof_)
external
view
returns (bool valid_);
Parameters
| Name | Type | Description |
|---|---|---|
account_ | address | The account to verify |
allocatedAmount_ | uint256 | The allocated amount to verify |
proof_ | bytes32[] | The merkle proof |
Returns
| Name | Type | Description |
|---|---|---|
valid_ | bool | True if the claim is valid |
Events
Migrated
Emitted when a user successfully migrates GVI v1 to GVI v2
event Migrated(address indexed user, uint256 gviV1Amount, uint256 gviV2Amount);
Parameters
| Name | Type | Description |
|---|---|---|
user | address | The address of the user migrating |
gviV1Amount | uint256 | The amount of GVI v1 burned |
gviV2Amount | uint256 | The amount of GVI v2 minted |
MerkleRootUpdated
Emitted when the merkle root is updated
event MerkleRootUpdated(bytes32 indexed newRoot, address indexed updater);
Parameters
| Name | Type | Description |
|---|---|---|
newRoot | bytes32 | The new merkle root |
updater | address | The address that updated the root |
RemainingMintApprovalUpdated
Emitted when the remaining mint approval is updated
event RemainingMintApprovalUpdated(uint256 indexed newApproval, uint256 indexed oldApproval);
Parameters
| Name | Type | Description |
|---|---|---|
newApproval | uint256 | The new remaining mint approval |
oldApproval | uint256 | The old remaining mint approval |
Rescued
Emitted when tokens are rescued from the contract
event Rescued(address indexed token, address indexed to, uint256 amount);
Parameters
| Name | Type | Description |
|---|---|---|
token | address | The rescued token address |
to | address | The recipient address |
amount | uint256 | The amount rescued |
Errors
InvalidProof
Thrown when the provided merkle proof is invalid
error InvalidProof();
AmountExceedsAllowance
Thrown when the amount exceeds the user's allocation
error AmountExceedsAllowance(uint256 requested, uint256 allocated, uint256 migrated);
Parameters
| Name | Type | Description |
|---|---|---|
requested | uint256 | The amount requested to migrate |
allocated | uint256 | The user's allocated amount from the merkle tree |
migrated | uint256 | The amount already migrated by the user |
CapExceeded
Thrown when the migration cap would be exceeded
error CapExceeded(uint256 amount, uint256 remaining);
Parameters
| Name | Type | Description |
|---|---|---|
amount | uint256 | The amount requested to migrate |
remaining | uint256 | The remaining MINTR approval for the migrator contract |
ZeroAmount
Thrown when the GVI v2 amount after gGVI conversion is zero
This can happen when the input GVI v1 amount is very small and gGVI conversion rounds down to zero
error ZeroAmount();
ZeroAddress
Thrown when an address parameter is zero
error ZeroAddress();
SameMerkleRoot
Thrown when attempting to set the same merkle root that is already set
error SameMerkleRoot();