MigrationProposalHelper
Inherits: Owned
forge-lint: disable-start(mixed-case-function,mixed-case-variable)
Single-use contract to execute GVI v1 migration to GVI v2 and burn
State Variables
TREASURY
address public constant TREASURY = 0x31F8Cc382c9898b273eff4e0b7626a6987C846E8
MIGRATOR
address public constant MIGRATOR = 0x184f3FAd8618a6F458C16bae63F70C426fE784B3
STAKING
address public constant STAKING = 0xB63cac384247597756545b500253ff8E607a8020
GGVI
address public constant GGVI = 0x0ab87046fBb341D058F17CBC4c1133F25a20a52f
GVIV1
address public constant GVIV1 = 0x383518188C0C6d7730D91b2c03a03C837814a899
GVIV2
address public constant GVIV2 = 0x64aa3364F17a4D01c6f1751Fd97C2BD3D7e7f1D5
BURNER
address public immutable BURNER
TEMPGVI
address public immutable TEMPGVI
ADMIN
Admin address that can update the GVI v1 migration limit
address public immutable ADMIN
GVIv1ToMigrate
Maximum amount of GVI v1 to migrate (1e9 decimals)
uint256 public GVIv1ToMigrate
MIGRATION_CATEGORY
bytes32 public constant MIGRATION_CATEGORY = "migration"
isActivated
True if the activation has been performed
bool public isActivated = false
Functions
constructor
constructor(address owner_, address admin_, address burner_, address tempGVI_, uint256 GVIv1ToMigrate_)
Owned(owner_);
_onlyOwnerOrAdmin
function _onlyOwnerOrAdmin() internal view;
onlyOwnerOrAdmin
Modifier to restrict access to owner or admin
modifier onlyOwnerOrAdmin() ;
setGVIv1ToMigrate
Set the maximum GVI v1 to migrate
Only callable by owner or admin. Updates the migration limit.
function setGVIv1ToMigrate(uint256 maxGVIv1_) external onlyOwnerOrAdmin;
Parameters
| Name | Type | Description |
|---|---|---|
maxGVIv1_ | uint256 | The new maximum GVI v1 amount (1e9 decimals) |
rescue
Rescue accidentally sent tokens
Only callable by owner or admin. Sweeps entire token balance to caller.
function rescue(IERC20 token_) external onlyOwnerOrAdmin;
Parameters
| Name | Type | Description |
|---|---|---|
token_ | IERC20 | The ERC20 token to rescue |
getTempGVIToDeposit
Calculate the amount of tempGVI to deposit
This is based on the GVIv1ToMigrate amount, converted to 1e18 decimals
function getTempGVIToDeposit() public view returns (uint256);
activate
Executes the migration process
This function assumes:
- The "burner_admin" role has been granted to this contract
- The caller (owner) has approved tempGVI to this contract
- The caller (owner) has tempGVI balance Any tempGVI in excess of GVIv1ToMigrate * 1e9 will be burned. This is intentional: tempGVI has no utility after migration completes. This function reverts if:
- The caller is not the owner
- The function has already been run
function activate() external onlyOwner;
_depositTempGVIToTreasury
Transfer all tempGVI from owner and deposit the calculated amount to treasury
Transfers ALL tempGVI from owner but deposits only getTempGVIToDeposit(). Excess is burned by _burnExcess() (tempGVI has no post-migration utility).
function _depositTempGVIToTreasury() internal returns (uint256 gviV1Minted);
Returns
| Name | Type | Description |
|---|---|---|
gviV1Minted | uint256 | The amount of GVI v1 minted from the deposit |
_migrateGVIv1ToGGVI
Migrate GVIv1 to gGVI via migrator
function _migrateGVIv1ToGGVI(uint256 gviV1Amount) internal;
Parameters
| Name | Type | Description |
|---|---|---|
gviV1Amount | uint256 | The amount of GVI v1 to migrate |
_burnExcess
Burn any excess tempGVI and GVI v1 remaining after migration
Intentional cleanup: tempGVI has no utility after gGVI migration. Also burns any GVI v1 left from partial migration failures.
function _burnExcess() internal;
_unstakeAndBurn
Unstake gGVI to GVIv2 and burn
function _unstakeAndBurn() internal;
Events
Activated
event Activated(address caller);
GVIv1ToMigrateUpdated
event GVIv1ToMigrateUpdated(uint256 newMax);
Rescued
event Rescued(address indexed token, address indexed to, uint256 amount);
Errors
AlreadyActivated
error AlreadyActivated();
InvalidParams
error InvalidParams(string reason);
Unauthorized
error Unauthorized();