StakedOverlayerWrapCore
Base contract for staking OverlayerWrap tokens with vesting and blacklisting functionality
This contract is intended to be inherited in order to define custom vesting (cooldowns) policies
BLACKLIST_ACTIVATION_TIME
uint256 BLACKLIST_ACTIVATION_TIME
Time delay for blacklisting to be activated
REDISTRIBUTION_ACTIVATION_TIME
uint256 REDISTRIBUTION_ACTIVATION_TIME
Time delay for asset redistribution to be activated
BACKING_CHANGE_DELAY
uint256 BACKING_CHANGE_DELAY
Time delay before overlayerWrap backing change can be executed
blacklistActivationTime
uint256 blacklistActivationTime
The timestamp of the last blacklist activation request
redistributionActivationTime
uint256 redistributionActivationTime
The timestamp of the last redistribution activation request
overlayerWrapBacking
address overlayerWrapBacking
OverlayerWrap backing contract
proposedOverlayerWrapBacking
address proposedOverlayerWrapBacking
Proposed overlayerWrap backing contract
proposedOverlayerWrapBackingTime
uint256 proposedOverlayerWrapBackingTime
Timestamp at which overlayerWrap backing change was proposed
notZero
modifier notZero(uint256 amount_)
Ensure input amount nonzero
notOwner
modifier notOwner(address target_)
Ensures blacklist target is not owner
blacklistAllowed
modifier blacklistAllowed()
Ensures blacklist is on
redistributionAllowed
modifier redistributionAllowed()
Ensures redistribution is on
constructor
constructor(contract IERC20 asset_, address initialRewarder_, address admin_) internal
Constructor for StakedOverlayerWrapCore contract.
Parameters
| Name | Type | Description |
|---|---|---|
| asset_ | contract IERC20 | The address of the OverlayerWrap token. |
| initialRewarder_ | address | The address of the initial rewarder. |
| admin_ | address | The address of the admin role. |
transferInRewards
function transferInRewards(uint256 amount_) external
Allows the owner to transfer rewards from the controller contract into this contract.
Parameters
| Name | Type | Description |
|---|---|---|
| amount_ | uint256 | The amount of rewards to transfer. |
addToBlacklist
function addToBlacklist(address target_, bool isFullBlacklisting_) external
Allows the owner (DEFAULT_ADMIN_ROLE) and blacklist managers to blacklist addresses.
Parameters
| Name | Type | Description |
|---|---|---|
| target_ | address | The address to blacklist. |
| isFullBlacklisting_ | bool | Soft or full blacklisting level. |
removeFromBlacklist
function removeFromBlacklist(address target_, bool isFullBlacklisting_) external
Allows the owner (DEFAULT_ADMIN_ROLE) and blacklist managers to un-blacklist addresses.
Parameters
| Name | Type | Description |
|---|---|---|
| target_ | address | The address to un-blacklist. |
| isFullBlacklisting_ | bool | Soft or full blacklisting level. |
setBlackListTime
function setBlackListTime(uint256 time_) external
Sets the blacklist time.
Disables blakclist if time is zero.
Parameters
| Name | Type | Description |
|---|---|---|
| time_ | uint256 | The starting timestamp. |
setRedistributionTime
function setRedistributionTime(uint256 time_) external
Sets the redistribution time.
Disables redistribution if time is zero.
Parameters
| Name | Type | Description |
|---|---|---|
| time_ | uint256 | The starting timestamp. |
proposeOverlayerWrapBacking
function proposeOverlayerWrapBacking(address backing_) external
Proposes a new overlayerWrap backing contract, starts the timelock delay
Zero address not allowed. When current backing is address(0) (initial setup), execute can be called immediately.
Parameters
| Name | Type | Description |
|---|---|---|
| backing_ | address | The proposed overlayerWrap backing contract |
executeOverlayerWrapBackingChange
function executeOverlayerWrapBackingChange() external
Executes the previously proposed backing change after BACKING_CHANGE_DELAY
When overlayerWrapBacking is address(0) (initial setup), delay is skipped
cancelProposedOverlayerWrapBacking
function cancelProposedOverlayerWrapBacking() external
Cancels a pending overlayerWrap backing proposal
receive
receive() external payable
Fallback function to receive ether
rescue
function rescue(address token_, uint256 amount_, address to_) external
Rescue assets accidentally sent to the contract (native or ERC20).
Parameters
| Name | Type | Description |
|---|---|---|
| token_ | address | Address of the token to rescue, or address(0) for native. |
| amount_ | uint256 | Amount to rescue. |
| to_ | address | Recipient address. |
redistributeLockedAmount
function redistributeLockedAmount(address from_, address to_) external
Burns the full restricted user amount and mints to the desired owner address.
Parameters
| Name | Type | Description |
|---|---|---|
| from_ | address | The address to burn the entire balance, with the WHOLE_RESTRICTED_ROLE |
| to_ | address | The address to mint the entire balance of "from" parameter. |
totalAssets
function totalAssets() public view returns (uint256)
See {IERC4626-totalAssets}.
decimals
function decimals() public pure returns (uint8)
Necessary because both ERC20 (from ERC20Permit) and ERC4626 declare decimals()
renounceRole
function renounceRole(bytes32, address) public virtual
Remove renounce role access from AccessControl, to prevent users to resign roles.
grantRole
function grantRole(bytes32 role_, address account_) public virtual
Prevents direct grant of blacklist roles; use addToBlacklist() instead
Parameters
| Name | Type | Description |
|---|---|---|
| role_ | bytes32 | The role to grant |
| account_ | address | The account to grant the role to |
revokeRole
function revokeRole(bytes32 role_, address account_) public virtual
Prevents direct revoke of blacklist roles; use removeFromBlacklist() instead
Parameters
| Name | Type | Description |
|---|---|---|
| role_ | bytes32 | The role to revoke |
| account_ | address | The account to revoke the role from |
_checkMinShares
function _checkMinShares() internal view
Ensures a small non-zero amount of shares does not remain, exposing to donation attack
_deposit
function _deposit(address caller_, address receiver_, uint256 assets_, uint256 shares_) internal
Deposit/mint common workflow.
Parameters
| Name | Type | Description |
|---|---|---|
| caller_ | address | sender of assets |
| receiver_ | address | where to send shares |
| assets_ | uint256 | assets to deposit |
| shares_ | uint256 | shares to mint |
_withdraw
function _withdraw(address caller_, address receiver_, address sharesOwner_, uint256 assets_, uint256 shares_) internal
Withdraw/redeem common workflow.
Parameters
| Name | Type | Description |
|---|---|---|
| caller_ | address | tx sender |
| receiver_ | address | where to send assets |
| sharesOwner_ | address | where to burn shares from |
| assets_ | uint256 | asset amount to transfer out |
| shares_ | uint256 | shares to burn |
_update
function _update(address from_, address to_, uint256 value_) internal virtual
Override of ERC20 transfer logic to handle restricted accounts
Prevents transfers involving accounts with WHOLE_RESTRICTED_ROLE
Parameters
| Name | Type | Description |
|---|---|---|
| from_ | address | Source address |
| to_ | address | Destination address |
| value_ | uint256 | Amount to transfer |