ESE
ESE
Implementation of the {IERC20} interface with automatic vesting mechanism and EIP-2612 permit.
Beneficiary
struct Beneficiary {
uint256 amount;
address addr;
}
VestingParams
struct VestingParams {
uint256 amount;
uint128 cliff;
uint128 duration;
mapping(address => uint256) amounts;
}
ConstructorVestingParams
struct ConstructorVestingParams {
uint32 cliff;
uint32 duration;
uint16 TGEMintShare;
}
vestingStages
mapping(uint256 => struct ESE.VestingParams) vestingStages
Vesting parameters. Mappings are more gas efficient than arrays.
vestingStagesLength
uint256 vestingStagesLength
Info on how many vesting stages there are in total.
TGE
uint256 TGE
Token generation event.
Initialize
event Initialize(uint256 TGE)
AddVestingBeneficiary
event AddVestingBeneficiary(uint256 stage, address beneficiary, uint256 vestingAmount, uint256 TGEAmount)
addVestingBeneficiaries
function addVestingBeneficiaries(uint256 stage, struct ESE.Beneficiary[] beneficiaries) external
_Adds new vesting beneficiaries to {vestingStages}. Mints new tokens according to {TGEMintShares} variable. Emits {AddVestingBeneficiary} event for each beneficiary.
Parameters
stage
uint256
- vestingStages index to add beneficiaries for.
beneficiaries
struct ESE.Beneficiary[]
- Beneficiary structs containing beneficiaries's addresses and vesting amounts.
Note: Can only be called in an unitialized state by {_initializer}.
initialize
function initialize(uint256 _TGE) external
Initializes this contract. Token transfers are not available until TGE timestamp. Emits {Initialize} event.
Parameters
_TGE
uint256
- Token generation timestamp in the future. Set to 0 to initialize immediately.
Note: Can only be called in an unitialized state by {_initializer}.
totalVestedAmount
function totalVestedAmount(uint256 stage) external view returns (uint256)
Info on how many tokens have already been vested during the specified stage in total.
vestedAmount
function vestedAmount(uint256 stage, address account) external view returns (uint256)
Info on how many tokens have already been vested during the specified stage for account.
totalSupply
function totalSupply() public view returns (uint256)
See {IERC20-totalSupply}.
balanceOf
function balanceOf(address account) public view returns (uint256)
See {IERC20-balanceOf}.
Inherited from ERC20Burnable
burn
function burn(uint256 amount) public virtual
_Destroys amount
tokens from the caller.
See {ERC20-burn}.
burnFrom
function burnFrom(address account, uint256 amount) public virtual
_Destroys amount
tokens from account
, deducting from the caller's allowance.
See {ERC20-_burn} and {ERC20-allowance}.
Requirements:
the caller must have allowance for
accounts
's tokens of at leastamount
._
Inherited from ERC20Permit
permit
function permit(address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public virtual
_Sets value
as the allowance of spender
over owner
's tokens, given owner
's signed approval.
IMPORTANT: The same issues {IERC20-approve} has related to transaction ordering also apply here.
Emits an {Approval} event.
Requirements:
spender
cannot be the zero address.deadline
must be a timestamp in the future.v
,r
ands
must be a validsecp256k1
signature fromowner
over the EIP712-formatted function arguments.the signature must use
owner
's current nonce (see {nonces}).
For more information on the signature format, see the https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP section].
CAUTION: See Security Considerations above._
nonces
function nonces(address owner) public view virtual returns (uint256)
_Returns the current nonce for owner
. This value must be included whenever a signature is generated for {permit}.
Every successful call to {permit} increases owner
's nonce by one. This prevents a signature from being used multiple times._
DOMAIN_SEPARATOR
function DOMAIN_SEPARATOR() external view returns (bytes32)
Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
Inherited from EIP712
eip712Domain
function eip712Domain() public view virtual returns (bytes1 fields, string name, string version, uint256 chainId, address verifyingContract, bytes32 salt, uint256[] extensions)
_See {EIP-5267}.
Available since v4.9._
Inherited from IERC5267
EIP712DomainChanged
event EIP712DomainChanged()
MAY be emitted to signal that the domain could have changed.
Inherited from ERC20
name
function name() public view virtual returns (string)
Returns the name of the token.
symbol
function symbol() public view virtual returns (string)
Returns the symbol of the token, usually a shorter version of the name.
decimals
function decimals() public view virtual returns (uint8)
_Returns the number of decimals used to get its user representation. For example, if decimals
equals 2
, a balance of 505
tokens should be displayed to a user as 5.05
(505 / 10 ** 2
).
Tokens usually opt for a value of 18, imitating the relationship between Ether and Wei. This is the default value returned by this function, unless it's overridden.
NOTE: This information is only used for display purposes: it in no way affects any of the arithmetic of the contract, including {IERC20-balanceOf} and {IERC20-transfer}._
transfer
function transfer(address to, uint256 amount) public virtual returns (bool)
_See {IERC20-transfer}.
Requirements:
to
cannot be the zero address.the caller must have a balance of at least
amount
._
allowance
function allowance(address owner, address spender) public view virtual returns (uint256)
See {IERC20-allowance}.
approve
function approve(address spender, uint256 amount) public virtual returns (bool)
_See {IERC20-approve}.
NOTE: If amount
is the maximum uint256
, the allowance is not updated on transferFrom
. This is semantically equivalent to an infinite approval.
Requirements:
spender
cannot be the zero address._
transferFrom
function transferFrom(address from, address to, uint256 amount) public virtual returns (bool)
_See {IERC20-transferFrom}.
Emits an {Approval} event indicating the updated allowance. This is not required by the EIP. See the note at the beginning of {ERC20}.
NOTE: Does not update the allowance if the current allowance is the maximum uint256
.
Requirements:
from
andto
cannot be the zero address.from
must have a balance of at leastamount
.the caller must have allowance for
from
's tokens of at leastamount
._
increaseAllowance
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool)
_Atomically increases the allowance granted to spender
by the caller.
This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}.
Emits an {Approval} event indicating the updated allowance.
Requirements:
spender
cannot be the zero address._
decreaseAllowance
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool)
_Atomically decreases the allowance granted to spender
by the caller.
This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}.
Emits an {Approval} event indicating the updated allowance.
Requirements:
spender
cannot be the zero address.spender
must have allowance for the caller of at leastsubtractedValue
._
Inherited from IERC20
Transfer
event Transfer(address from, address to, uint256 value)
_Emitted when value
tokens are moved from one account (from
) to another (to
).
Note that value
may be zero._
Approval
event Approval(address owner, address spender, uint256 value)
Emitted when the allowance of a spender
for an owner
is set by a call to {approve}. value
is the new allowance.
Last updated