Skip to main content

IV1Migrator

Git Source

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

NameTypeDescription
gviV1_IERC20The GVI v1 token

gviV2

The GVI v2 token contract

function gviV2() external view returns (IERC20 gviV2_);

Returns

NameTypeDescription
gviV2_IERC20The 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

NameTypeDescription
gGVI_addressThe gGVI token

merkleRoot

The current merkle root for verifying eligible claims

function merkleRoot() external view returns (bytes32 merkleRoot_);

Returns

NameTypeDescription
merkleRoot_bytes32The current merkle root

migratedAmounts

The amount a user has migrated under the current root

function migratedAmounts(address account_) external view returns (uint256 migratedAmount_);

Parameters

NameTypeDescription
account_addressThe account to check

Returns

NameTypeDescription
migratedAmount_uint256The 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

NameTypeDescription
remaining_uint256The remaining GVI that can be minted

totalMigrated

The total amount of GVI v1 migrated so far

function totalMigrated() external view returns (uint256 totalMigrated_);

Returns

NameTypeDescription
totalMigrated_uint256The 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

NameTypeDescription
amount_uint256The amount of GVI v1 to preview (9 decimals)

Returns

NameTypeDescription
gviV2Amount_uint256The 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

NameTypeDescription
amount_uint256The amount of GVI v1 to migrate (9 decimals)
proof_bytes32[]The merkle proof proving the user is eligible
allocatedAmount_uint256The user's allocated amount from the merkle tree

setMerkleRoot

Update the merkle root for eligible claims

function setMerkleRoot(bytes32 merkleRoot_) external;

Parameters

NameTypeDescription
merkleRoot_bytes32The 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

NameTypeDescription
approval_uint256The 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

NameTypeDescription
token_IERC20The 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

NameTypeDescription
account_addressThe account to verify
allocatedAmount_uint256The allocated amount to verify
proof_bytes32[]The merkle proof

Returns

NameTypeDescription
valid_boolTrue 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

NameTypeDescription
useraddressThe address of the user migrating
gviV1Amountuint256The amount of GVI v1 burned
gviV2Amountuint256The amount of GVI v2 minted

MerkleRootUpdated

Emitted when the merkle root is updated

event MerkleRootUpdated(bytes32 indexed newRoot, address indexed updater);

Parameters

NameTypeDescription
newRootbytes32The new merkle root
updateraddressThe address that updated the root

RemainingMintApprovalUpdated

Emitted when the remaining mint approval is updated

event RemainingMintApprovalUpdated(uint256 indexed newApproval, uint256 indexed oldApproval);

Parameters

NameTypeDescription
newApprovaluint256The new remaining mint approval
oldApprovaluint256The old remaining mint approval

Rescued

Emitted when tokens are rescued from the contract

event Rescued(address indexed token, address indexed to, uint256 amount);

Parameters

NameTypeDescription
tokenaddressThe rescued token address
toaddressThe recipient address
amountuint256The 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

NameTypeDescription
requesteduint256The amount requested to migrate
allocateduint256The user's allocated amount from the merkle tree
migrateduint256The amount already migrated by the user

CapExceeded

Thrown when the migration cap would be exceeded

error CapExceeded(uint256 amount, uint256 remaining);

Parameters

NameTypeDescription
amountuint256The amount requested to migrate
remaininguint256The 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();