Skip to main content

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​

NameTypeDescription
asset_contract IERC20The address of the OverlayerWrap token.
initialRewarder_addressThe address of the initial rewarder.
admin_addressThe 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​

NameTypeDescription
amount_uint256The 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​

NameTypeDescription
target_addressThe address to blacklist.
isFullBlacklisting_boolSoft 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​

NameTypeDescription
target_addressThe address to un-blacklist.
isFullBlacklisting_boolSoft or full blacklisting level.

setBlackListTime​

function setBlackListTime(uint256 time_) external

Sets the blacklist time.

Disables blakclist if time is zero.

Parameters​

NameTypeDescription
time_uint256The starting timestamp.

setRedistributionTime​

function setRedistributionTime(uint256 time_) external

Sets the redistribution time.

Disables redistribution if time is zero.

Parameters​

NameTypeDescription
time_uint256The 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​

NameTypeDescription
backing_addressThe 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​

NameTypeDescription
token_addressAddress of the token to rescue, or address(0) for native.
amount_uint256Amount to rescue.
to_addressRecipient address.

redistributeLockedAmount​

function redistributeLockedAmount(address from_, address to_) external

Burns the full restricted user amount and mints to the desired owner address.

Parameters​

NameTypeDescription
from_addressThe address to burn the entire balance, with the WHOLE_RESTRICTED_ROLE
to_addressThe 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​

NameTypeDescription
role_bytes32The role to grant
account_addressThe 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​

NameTypeDescription
role_bytes32The role to revoke
account_addressThe 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​

NameTypeDescription
caller_addresssender of assets
receiver_addresswhere to send shares
assets_uint256assets to deposit
shares_uint256shares to mint

_withdraw​

function _withdraw(address caller_, address receiver_, address sharesOwner_, uint256 assets_, uint256 shares_) internal

Withdraw/redeem common workflow.

Parameters​

NameTypeDescription
caller_addresstx sender
receiver_addresswhere to send assets
sharesOwner_addresswhere to burn shares from
assets_uint256asset amount to transfer out
shares_uint256shares 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​

NameTypeDescription
from_addressSource address
to_addressDestination address
value_uint256Amount to transfer