Maple
Search…
⌃K

Stake Locker

StakeLocker holds custody of stakeAsset tokens for a given Pool and earns revenue from interest.

Constructor

constructor(
address _stakeAsset,
address _liquidityAsset,
address _pool
);

Parameters:

Index
Name
Type
Internal Type
Description
0
_stakeAsset
address
address
1
_liquidityAsset
address
address
2
_pool
address
address

Functions

accumulativeFundsOf

Returns the amount of funds that an account has earned in total. accumulativeFundsOf(_owner) = withdrawableFundsOf(_owner) + withdrawnFundsOf(_owner) = (pointsPerShare * balanceOf(_owner) + pointsCorrection[_owner]) / pointsMultiplier
function accumulativeFundsOf(
address _owner
)
view
returns (
uint256
);

Parameters:

Index
Name
Type
Internal Type
Description
0
_owner
address
address
The address of a token holder.

Return Values:

Index
Name
Type
Internal Type
Description
0
uint256
uint256
The amount of funds that `_owner` has earned in total.

accumulativeLossesOf

Returns the amount of losses that an account has earned in total. accumulativeLossesOf(_owner) = recognizableLossesOf(_owner) + recognizedLossesOf(_owner) = (lossesPerShare * balanceOf(_owner) + lossesCorrection[_owner]) / pointsMultiplier
function accumulativeLossesOf(
address _owner
)
view
returns (
uint256
);

Parameters:

Index
Name
Type
Internal Type
Description
0
_owner
address
address
The address of a token holder.

Return Values:

Index
Name
Type
Internal Type
Description
0
uint256
uint256
The amount of losses that `_owner` has earned in total.

allowance

Returns the remaining number of tokens that `spender` will be allowed to spend on behalf of `owner` through {transferFrom}. This is zero by default. This value changes when {approve} or {transferFrom} are called.
function allowance(
address owner,
address spender
)
view
returns (
uint256
);

Parameters:

Index
Name
Type
Internal Type
Description
0
owner
address
address
1
spender
address
address

Return Values:

Index
Name
Type
Internal Type
Description
0
uint256
uint256

allowed [state variable]

function allowed(
address account
)
view
returns (
bool
);

Parameters:

Index
Name
Type
Internal Type
Description
0
account
address
address
The address of a Staker.

Return Values:

Index
Name
Type
Internal Type
Description
0
bool
bool
Whether `account` is allowed.

approve

Sets `amount` as the allowance of `spender` over the caller's tokens. Returns a boolean value indicating whether the operation succeeded. IMPORTANT: Beware that changing an allowance with this method brings the risk that someone may use both the old and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 Emits an {Approval} event. Requirements: - `spender` cannot be the zero address.
function approve(
address spender,
uint256 amount
)
nonpayable
returns (
bool
);

Parameters:

Index
Name
Type
Internal Type
Description
0
spender
address
address
1
amount
uint256
uint256

Return Values:

Index
Name
Type
Internal Type
Description
0
bool
bool

balanceOf

Returns the amount of tokens owned by `account`.
function balanceOf(
address account
)
view
returns (
uint256
);

Parameters:

Index
Name
Type
Internal Type
Description
0
account
address
address

Return Values:

Index
Name
Type
Internal Type
Description
0
uint256
uint256

bptLosses

The sum of all unrecognized losses.
function bptLosses()
view
returns (
uint256
);

Return Values:

Index
Name
Type
Internal Type
Description
0
uint256
uint256

cancelUnstake

Cancels an initiated unstake by resetting the calling account's unstake cooldown. It emits a `Cooldown` event.
function cancelUnstake()
nonpayable;

custodyAllowance [state variable]

function custodyAllowance(
address account,
address custodian
)
view
returns (
uint256
);

Parameters:

Index
Name
Type
Internal Type
Description
0
account
address
address
The address of an account.
1
custodian
address
address
The address of a custodian.

Return Values:

Index
Name
Type
Internal Type
Description
0
uint256
uint256
The amount of StakeLockerFDTs of `account` that are "locked" at `custodian`.

fundsToken

The ERC-2222 Funds Token.
function fundsToken()
view
returns (
address
);

Return Values:

Index
Name
Type
Internal Type
Description
0
address
address

fundsTokenBalance

The amount of `fundsToken` (Liquidity Asset) currently present and accounted for in this contract.
function fundsTokenBalance()
view
returns (
uint256
);

Return Values:

Index
Name
Type
Internal Type
Description
0
uint256
uint256

increaseCustodyAllowance

Increases the custody allowance for a given Custodian corresponding to the account (`msg.sender`).It emits a `CustodyAllowanceChanged` event.It emits a `TotalCustodyAllowanceUpdated` event.
function increaseCustodyAllowance(
address custodian,
uint256 amount
)
nonpayable;

Parameters:

Index
Name
Type
Internal Type
Description
0
custodian
address
address
The address which will act as Custodian of a given amount for an account.
1
amount
uint256
uint256
The number of additional FDTs to be custodied by the Custodian.

intendToUnstake

Activates the cooldown period to unstake. It can't be called if the account is not staking. It emits a `Cooldown` event.
function intendToUnstake()
nonpayable;

isReceiveAllowed

Returns if an account is allowed to receive a transfer. This is only possible if they have zero cooldown or they are past their unstake window.
function isReceiveAllowed(
uint256 _unstakeCooldown
)
view
returns (
bool
);

Parameters:

Index
Name
Type
Internal Type
Description
0
_unstakeCooldown
uint256
uint256

Return Values:

Index
Name
Type
Internal Type
Description
0
bool
bool

isUnstakeAllowed

Returns if the unstake cooldown period has passed for `msg.sender` and if they are in the unstake window.
function isUnstakeAllowed(
address from
)
view
returns (
bool
);

Parameters:

Index
Name
Type
Internal Type
Description
0
from
address
address

Return Values:

Index
Name
Type
Internal Type
Description
0
bool
bool

liquidityAsset [state variable]

The Liquidity Asset for the Pool as well as the dividend token for StakeLockerFDT interest.
function liquidityAsset()
view
returns (
address
);

Return Values:

Index
Name
Type
Internal Type
Description
0
address
address

lockupPeriod [state variable]

The number of seconds for which unstaking is not allowed.
function lockupPeriod()
view
returns (
uint256
);

Return Values:

Index
Name
Type
Internal Type
Description
0
uint256
uint256

lossesBalance

The amount of losses present and accounted for in this contract.
function lossesBalance()
view
returns (
uint256
);

Return Values:

Index
Name
Type
Internal Type
Description
0
uint256
uint256

openStakeLockerToPublic

Sets the StakeLocker as open to the public. Only the Pool Delegate can call this function. It emits a `StakeLockerOpened` event.
function openStakeLockerToPublic()
nonpayable;

openToPublic

function openToPublic()
view
returns (
bool
);

Return Values:

Index
Name
Type
Internal Type
Description
0
bool
bool

pause

Triggers paused state. Halts functionality for certain functions. Only the Pool Delegate or a Pool Admin can call this function.
function pause()
nonpayable;

pool [state variable]

The parent Pool.
function pool()
view
returns (
address
);

Return Values:

Index
Name
Type
Internal Type
Description
0
address
address

pull

Transfers an amount of Stake Asset to a destination account. Only the Pool can call this function.
function pull(
address dst,
uint256 amt
)
nonpayable;

Parameters:

Index
Name
Type
Internal Type
Description
0
dst
address
address
The destination to transfer Stake Asset to.
1
amt
uint256
uint256
The amount of Stake Asset to transfer.

recognizableLossesOf

Returns the amount of losses that an account can withdraw.
function recognizableLossesOf(
address _owner
)
view
returns (
uint256
);

Parameters:

Index
Name
Type
Internal Type
Description
0
_owner
address
address
The address of a token holder.

Return Values:

Index
Name
Type
Internal Type
Description
0
uint256
uint256
The amount of losses that `_owner` can withdraw.

recognizedLossesOf

Returns the amount of losses that an account has recognized.
function recognizedLossesOf(
address _owner
)
view
returns (
uint256
);

Parameters:

Index
Name
Type
Internal Type
Description
0
_owner
address
address
The address of a token holder.

Return Values:

Index
Name
Type
Internal Type
Description
0
uint256
uint256
The amount of losses that `_owner` has recognized.

setAllowlist

Updates Staker status on the allowlist. Only the Pool Delegate can call this function. It emits an `AllowListUpdated` event.
function setAllowlist(
address staker,
bool status
)
nonpayable;

Parameters:

Index
Name
Type
Internal Type
Description
0
staker
address
address
The address of the Staker to set status for.
1
status
bool
bool
The status of the Staker on allowlist.

setLockupPeriod

Sets the lockup period. Only the Pool Delegate can call this function. It emits a `LockupPeriodUpdated` event.
function setLockupPeriod(
uint256 newLockupPeriod
)
nonpayable;

Parameters:

Index
Name
Type
Internal Type
Description
0
newLockupPeriod
uint256
uint256
New lockup period used to restrict unstaking.

stake

Handles a Staker's depositing of an amount of Stake Asset, minting them StakeLockerFDTs. It emits a `StakeDateUpdated` event. It emits a `Stake` event. It emits a `Cooldown` event. It emits a `BalanceUpdated` event.
function stake(
uint256 amt
)
nonpayable;

Parameters:

Index
Name
Type
Internal Type
Description
0
amt
uint256
uint256
The amount of Stake Asset (BPTs) to deposit.

stakeAsset [state variable]

The asset deposited by Stakers into this contract, for liquidation during defaults.
function stakeAsset()
view
returns (
address
);

Return Values:

Index
Name
Type
Internal Type
Description
0
address
address

stakeDate [state variable]

function stakeDate(
address account
)
nonpayable
returns (
uint256
);

Parameters:

Index
Name
Type
Internal Type
Description
0
account
address
address
The address of a Staker.

Return Values:

Index
Name
Type
Internal Type
Description
0
uint256
uint256
The effective stake date of `account`.

totalCustodyAllowance [state variable]

function totalCustodyAllowance(
address account
)
view
returns (
uint256
);

Parameters:

Index
Name
Type
Internal Type
Description
0
account
address
address
The address of an account.

Return Values:

Index
Name
Type
Internal Type
Description
0
uint256
uint256
The total amount of StakeLockerFDTs that are "locked" for a given account, cannot be greater than balance.

totalSupply

Returns the amount of tokens in existence.
function totalSupply()
view
returns (
uint256
);

Return Values:

Index
Name
Type
Internal Type
Description
0
uint256
uint256