EeseeStaking
EeseeStaking
ESE
contract IERC20 ESE
ESE token to use in staking.
volumeUpdaters
mapping(address => bool) volumeUpdaters
Addresses that can update volume. It can be useful to us to have multiple volume updaters.
volume
mapping(address => uint256) volume
Volume for each user on Eesee marketplace.
userInfo
mapping(bool => mapping(address => struct IEeseeStaking.UserInfo)) userInfo
Maps isLocked bool to user to struct containing user data.
totalDeposits
uint96 totalDeposits
Total ESE staked in this contract (not including rewards).
duration
uint32 duration
Min locked staking duration.
rewardID
uint32 rewardID
The number of negative reward rate updates.
deposit
function deposit(uint96 amount, uint32 lockDuration, uint32 expectedRewardID, bytes permit) external
Stakes ESE tokens. If {lockDuration} == 0, the user can withdraw tokens anytime. Else, the user can withdraw their tokens after {duration} seconds.
Parameters
amount
uint96
- Amount of ESE tokens to stake.
lockDuration
uint32
- If lockDuration == 0, stakes tokens using Flexible scheme. If lockDuration == duration stakes tokens using Locked scheme.
expectedRewardID
uint32
- Frontrunning protection for reward rates. If reward rates are negatively changed before the transaction execution, reverts it. Can be set to any value for Flexible scheme.
permit
bytes
- Abi-encoded ESE permit data containing approveAmount, deadline, v, r and s. Set to empty bytes to skip permit.
withdraw
function withdraw(bool isLocked, uint96 amount, address recipient) external returns (uint96 ESEReceived)
Withdraws staked ESE tokens, collects rewards and sends them to {recipient}. Pass 0 to {amount} to only receive rewards. In case reward rates are negatively changed during Locked staker's staking period, they are able to withdraw their funds.
Parameters
isLocked
bool
- Set to true to withdraw from locked scheme. Can only be done if the stake has unlocked (block.timestamp < user.unlockTime).
amount
uint96
- Amount of ESE tokens to unstake.
recipient
address
- ESE receiver.
Return Values
ESEReceived
uint96
- Amount of ESE tokens sent.
Note: If there are not enough tokens in the contract, only part of pending tokens will be sent.
The other tokens will be available after the balance of this contract has increased. |
addVolume
function addVolume(uint96 _volume, address _address) external
_Adds {_volume} to an {address}'es volume. Emits {AddVolume} event.
Parameters
_volume
uint96
- Volume to add.
_address
address
- Address to update.
Note: This function can only be called by volumeUpdater.
updateRewardRates
function updateRewardRates(uint64[] rewardRatesFlexible, uint64[] rewardRatesLocked) external
Changes the reward rates for all staking schemes and tiers.
Parameters
rewardRatesFlexible
uint64[]
- New reward per token per second for flexible scheme.
rewardRatesLocked
uint64[]
- New reward per token per second for locked scheme.
Note: This function rewardRatesLocked only be called by ADMIN_ROLE.
changeDuration
function changeDuration(uint32 _duration) external
Changes duration for locked staking. Emits {ChangeDuration} event.
Parameters
_duration
uint32
- New duration.
Note: This function can only be called by ADMIN_ROLE.
grantVolumeUpdater
function grantVolumeUpdater(address _address) external
_Grants rights to update volume to {address}. Emits {GrantVolumeUpdater} event.
Parameters
_address
address
- New volumeUpdater.
Note: This function can only be called by ADMIN_ROLE.
revokeVolumeUpdater
function revokeVolumeUpdater(address _address) external
_Revokes rights to update volume from {address}. Emits {RevokeVolumeUpdater} event.
Parameters
_address
address
- Address to revoke volumeUpdater from.
Note: This function can only be called by ADMIN_ROLE.
pendingReward
function pendingReward(bool isLocked, address _user) external view returns (uint96)
_Returns ESE tokens earned by {user}. Note: Does not take unlockTime or current contract reward balance into account.
Parameters
isLocked
bool
_user
address
- Address to check.
Return Values
[0]
uint96
uint96 - Amount of ESE tokens ready to be collected.
tierInfo
function tierInfo(uint256 _tier) external view returns (struct IEeseeStaking._TierData _tierData)
Returns the info on specified tier.
Parameters
_tier
uint256
- Tier to get info for.
Return Values
_tierData
struct IEeseeStaking._TierData
- uint256 volumeBreakpoint, uint64 rewardRateFlexible, uint64 rewardRateLocked.
tier
function tier(uint256 _volume) public view returns (uint256)
Returns the tier from volume.
Parameters
_volume
uint256
- Volume to check tier for.
Return Values
[0]
uint256
uint256 - Tier ID.
Inherited from EeseeRoleHandler
Inherited from ERC2771Context
isTrustedForwarder
function isTrustedForwarder(address forwarder) public view virtual returns (bool)
Inherited from IEeseeStaking
ESE
function ESE() external view returns (contract IERC20)
volumeUpdaters
function volumeUpdaters(address) external view returns (bool)
volume
function volume(address) external view returns (uint256)
userInfo
function userInfo(bool isLocked, address user) external view returns (uint96 amount, uint96 reward, uint32 unlockTime, uint32 rewardRateID, uint256 rewardDebt)
totalDeposits
function totalDeposits() external view returns (uint96)
duration
function duration() external view returns (uint32)
DepositFlexible
event DepositFlexible(address user, uint96 amount)
DepositLocked
event DepositLocked(address user, uint96 amount, uint32 unlockTime)
WithdrawFlexible
event WithdrawFlexible(address sender, address recipient, uint96 amount)
WithdrawLocked
event WithdrawLocked(address sender, address recipient, uint96 amount)
AddVolume
event AddVolume(address volumeUpdater, address user, uint96 amount)
UpdateRewardRates
event UpdateRewardRates(uint64[] rewardRatesFlexible, uint64[] rewardRatesLocked)
ChangeDuration
event ChangeDuration(uint32 previousDuration, uint32 newDuration)
GrantVolumeUpdater
event GrantVolumeUpdater(address account)
RevokeVolumeUpdater
event RevokeVolumeUpdater(address account)
Last updated