VestingToken
This contract stores the core logic for locking tokens and releasing them, while also allowing transfers and maintaining an accurate count of the locked and unlocked tokens being transferred.
ERC20Upgradeable
: ERC20 token with the constructor logic in the__ERC20_init
function.IVestingToken
: to storeMilestone
s and provide a function to initialize them.
The ERC20 token that this contract will be locking and vesting.
The manager that deployed this contract which controls the values for
fee
and feeCollector
.An array of Milestones describing the times and behaviour of the rules to release the vested tokens.
name (string)
: This ERC20 token name.symbol (string)
: This ERC20 token symbol.underlyingTokenAddress (address)
: The ERC20 token that will be held by this contract.milestonesArray (Milestone[])
: Array of allMilestone
s for this contract's lifetime.
Initializes the contract by setting up the ERC20 variables, the
underlyingToken
, and the milestonesArray
information.TheRamp
of the firstMilestone
in themilestonesArray
will always act as aCliff
since it doesn't have a previousmilestone
.
recipient (address)
: The address that will receive the newly mintedvestingToken
.amount (uint256)
: The amount ofunderlyingToken
to be vested.
Vests an
amount
of underlyingToken
and mints vestingToken
s for a recipient
.recipients (address[])
: Array of addresses that will receive the newly mintedvestingToken
s.amounts (uint256[])
: Array of amounts ofunderlyingToken
to be vested.
Vests multiple
amounts
of underlyingToken
and mints vestingToken
s for multiple recipients
.recipient (address)
: The address that will receive the newly mintedvestingToken
.amount (uint256)
: The amount ofunderlyingToken
to be vested.claimableAmountOfImport (uint256)
: The amount ofunderlyingToken
from this transaction that should be considered claimable.unlocked (uint256)
: The unlocked percentage value at the time of the export of this transaction.
Behaves as
addRecipient
but provides the ability to set the initial state of the recipient's metadata. This functionality is included in order to allow users to restart an allocation on a different chain and keeping the inner state as close as possible to the original.TheclaimedAmountAfterTransfer
value for the recipient is inferred from the parameters.
TheclaimedBalance
value for the recipient is lost in the transfer and will start from 0 in this new contract.
In the rare case where the contract and it's users are migrated after the last milestone has been reached, theclaimedSupply
value for the whole contract is lost in the transfer.
recipients (address[])
:amounts (uint256[])
:claimableAmountsOfImport (uint256[])
:unlocked (uint256)
:
Behaves as
addRecipient
but provides the ability to set the initial state of the recipient's metadata. This functionality is included in order to allow users to restart an allocation on a different chain and keeping the inner state as close as possible to the original.TheclaimedAmountAfterTransfer
value for each recipient is inferred from the parameters.
TheclaimedBalance
value for each recipient is lost in the transfer and will start from 0 in this new contract.
In the rare case where the contract and it's users are migrated after the last milestone has been reached, theclaimedAmountAfterTransfer
can't be inferred and theclaimedSupply
value for the whole contract is lost in the transfer.
recipient (address)
: The address that will be exported.
Returns the arguments to use in a call
importRecipient
on a different contract to migrate the recipient
's metadata.recipients (address[])
: Array of addresses that will be exported.
The arguments to use in a call
importRecipients
on a different contract to migrate the recipients
' metadata.The percentage of
underlyingToken
that users could claim.The amount of
underlyingToken
that were held in this contract and have been claimed.The amount of
underlyingToken
being held in this contract and that can be claimed.The amount of
underlyingToken
being held in this contract that can't be claimed yet.account (address)
: The address whose tokens are being queried.
The amount of
underlyingToken
that were held in this contract and this account
already claimed.account (address)
: The address whose tokens are being queried.
The amount of
underlyingToken
that this account
owns and can claim.account (address)
: The address whose tokens are being queried.
The amount of
underlyingToken
that this account
owns but can't claim yet.This function transfers the claimable amount of
underlyingToken
and transfers it to msg.sender
.emits a Claim event with themsg.sender
as theclaimer
and theclaimableAmount
as theamount
.
to (address)
: Address of recipient.amount (uint256)
: Amount of tokens.
Calculates and transfers the fee before executing a normal ERC20 transfer.
With each transfer not only the amount of tokens is transferred but also the amounts oflocked
andclaimable
balances are updated.
from (address)
: Address of sender.to (address)
: Address of recipient.amount (uint256)
: Amount of tokens.
Calculates and transfers the fee before executing a normal ERC20 transferFrom.
With each transfer not only the amount of tokens is transferred but also the amounts oflocked
andclaimable
balances are updated.
Last modified 8mo ago