SaplingStakerContext

SaplingStakerContext

Provides staker access control, and a basic close functionality.

Close functionality is implemented in the same fashion as Openzeppelin's Pausable.

staker

address staker

Staker address

_closed

bool _closed

Flag indicating whether or not the pool is closed

Closed

event Closed(address account)

Event for when the contract is closed

Opened

event Opened(address account)

Event for when the contract is reopened

StakerSet

event StakerSet(address prevAddress, address newAddress)

Event for when a new staker is set

onlyStaker

modifier onlyStaker()

A modifier to limit access only to the staker

onlyUser

modifier onlyUser()

A modifier to limit access only to users without roles

whenNotClosed

modifier whenNotClosed()

Modifier to limit function access to when the contract is not closed

whenClosed

modifier whenClosed()

Modifier to limit function access to when the contract is closed

__SaplingStakerContext_init

function __SaplingStakerContext_init(address _accessControl, address _stakerAddress) internal

Create a new SaplingStakerContext.

Addresses must not be 0.

setStaker

function setStaker(address _staker) external

Designates a new staker for the pool.

Caller must be the governance. There can only be one staker in the pool. Staked funds remain staked in the pool and will be owned by the new staker.

close

function close() external

Close the pool.

_Only the functions using whenClosed and whenNotClosed modifiers will be affected by close. Caller must have the staker role. Pool must be open.

 Staker must have access to close function as the ability to unstake and withdraw all staked funds is
 only guaranteed when the pool is closed and all outstanding loans resolved._

open

function open() external

Open the pool for normal operations.

Only the functions using whenClosed and whenNotClosed modifiers will be affected by open. Caller must have the staker role. Pool must be closed.

closed

function closed() public view returns (bool)

Indicates whether or not the contract is closed.

isNonUserAddress

function isNonUserAddress(address party) internal view returns (bool)

Verify if an address has any non-user/management roles

Overrides the same function in SaplingContext

canClose

function canClose() internal view virtual returns (bool)

Indicates whether or not the contract can be closed in it's current state.

A hook for the extending contract to implement.

canOpen

function canOpen() internal view virtual returns (bool)

Indicates whether or not the contract can be opened in it's current state.

A hook for the extending contract to implement.

__gap

uint256[49] __gap

Slots reserved for future state variables

Last updated