EspTokenV2
Inherits: EspToken
Title: EspTokenV2
Upgrades EspToken to allow minting by the RewardClaim contract
Upgradeability & storage layout (frozen-inheritance pattern)
We intentionally do not use __gap slots. Once a version is deployed,
its storage layout is frozen and never modified. New state variables are
added only in a new child contract (V2, V3, …) that inherits from the
previous version and appends fields at the end. This preserves slot order
across upgrades without relying on gaps. (Note: upstream OZ parents may
include their own gaps—those remain untouched.)
State Variables
rewardClaim
Address of the RewardClaim contract authorized to mint tokens
Can only be set once, during initialization.
address public rewardClaim
Functions
constructor
constructor() ;
initializeV2
Initializes the V2 upgrade with the RewardClaim contract address
function initializeV2(address _rewardClaim) public onlyOwner reinitializer(2);
Parameters
| Name | Type | Description |
|---|---|---|
_rewardClaim | address | Address of the RewardClaim contract |
mint
Mints new tokens to a specified address
Only the RewardClaim contract can mint new tokens
function mint(address to, uint256 amount) public;
Parameters
| Name | Type | Description |
|---|---|---|
to | address | Address to receive the minted tokens |
amount | uint256 | Number of tokens to mint |
getVersion
Returns the contract version
function getVersion()
public
pure
virtual
override
returns (uint8 majorVersion, uint8 minorVersion, uint8 patchVersion);
Returns
| Name | Type | Description |
|---|---|---|
majorVersion | uint8 | Major version number |
minorVersion | uint8 | Minor version number |
patchVersion | uint8 | Patch version number |
Errors
OnlyRewardClaim
A non-RewardClaim address attempts to mint
error OnlyRewardClaim();
ZeroRewardClaimAddress
RewardClaim address cannot be zero
error ZeroRewardClaimAddress();