View Source: contracts/governance/Staking/interfaces/IStaking.sol
struct Checkpoint {
uint32 fromBlock,
uint96 stake
}
Events
event VestingStakeSet(uint256 lockedTS, uint96 value);
- addAdmin(address _admin)
- removeAdmin(address _admin)
- addPauser(address _pauser)
- removePauser(address _pauser)
- pauseUnpause(bool _pause)
- freezeUnfreeze(bool _freeze)
- setFeeSharing(address _feeSharing)
- setWeightScaling(uint96 _weightScaling)
- setNewStakingContract(address _newStakingContract)
- migrateToNewStakingContract()
- getPriorTotalVotingPower(uint32 blockNumber, uint256 time)
- getCurrentVotes(address account)
- getPriorVotes(address account, uint256 blockNumber, uint256 date)
- getPriorStakeByDateForDelegatee(address account, uint256 date, uint256 blockNumber)
- getPriorTotalStakesForDate(uint256 date, uint256 blockNumber)
- delegate(address delegatee, uint256 lockDate)
- delegateBySig(address delegatee, uint256 lockDate, uint256 nonce, uint256 expiry, uint8 v, bytes32 r, bytes32 s)
- stake(uint96 amount, uint256 until, address stakeFor, address delegatee)
- stakeWithApproval(address sender, uint96 amount, uint256 until, address stakeFor, address delegatee)
- receiveApproval(address _sender, uint256 _amount, address _token, bytes _data)
- extendStakingDuration(uint256 previousLock, uint256 until)
- stakesBySchedule(uint256 amount, uint256 cliff, uint256 duration, uint256 intervalLength, address stakeFor, address delegatee)
- stakeBySchedule(uint256 amount, uint256 cliff, uint256 duration, uint256 intervalLength, address stakeFor, address delegatee)
- balanceOf(address account)
- getCurrentStakedUntil(uint256 lockedTS)
- getStakes(address account)
- timestampToLockDate(uint256 timestamp)
- getStorageMaxDurationToStakeTokens()
- getStorageMaxVotingWeight()
- getStorageWeightFactor()
- getStorageDefaultWeightScaling()
- getStorageRangeForWeightScaling()
- getStorageDomainTypehash()
- getStorageDelegationTypehash()
- getStorageName()
- kickoffTS()
- SOVToken()
- delegates(address staker, uint256 until)
- allUnlocked()
- newStakingContract()
- totalStakingCheckpoints(uint256 date, uint32 index)
- numTotalStakingCheckpoints(uint256 date)
- delegateStakingCheckpoints(address delagatee, uint256 date, uint32 index)
- numDelegateStakingCheckpoints(address delegatee, uint256 date)
- userStakingCheckpoints(address user, uint256 date, uint32 index)
- numUserStakingCheckpoints(address user, uint256 date)
- nonces(address user)
- feeSharing()
- weightScaling()
- vestingWhitelist(address isWhitelisted)
- admins(address isAdmin)
- vestingCodeHashes(bytes32 vestingLogicCodeHash)
- vestingCheckpoints(uint256 date, uint32 index)
- numVestingCheckpoints(uint256 date)
- vestingRegistryLogic()
- pausers(address isPauser)
- paused()
- frozen()
- isVestingContract(address stakerAddress)
- removeContractCodeHash(address vesting)
- addContractCodeHash(address vesting)
- getPriorVestingStakeByDate(uint256 date, uint256 blockNumber)
- weightedVestingStakeByDate(uint256 date, uint256 startDate, uint256 blockNumber)
- getPriorVestingWeightedStake(uint256 blockNumber, uint256 date)
- getPriorUserStakeByDate(address account, uint256 date, uint256 blockNumber)
- setVestingStakes(uint256[] lockedDates, uint96[] values)
- setVestingRegistry(address _vestingRegistryProxy)
- withdraw(uint96 amount, uint256 until, address receiver)
- governanceWithdraw(uint96 amount, uint256 until, address receiver)
- governanceWithdrawVesting(address vesting, address receiver)
- getWithdrawAmounts(uint96 amount, uint256 until)
- unlockAllTokens()
- getPriorWeightedStake(address account, uint256 blockNumber, uint256 date)
- weightedStakeByDate(address account, uint256 date, uint256 startDate, uint256 blockNumber)
- computeWeightByDate(uint256 date, uint256 startDate)
- MAX_DURATION()
- owner()
- isOwner()
- transferOwnership(address newOwner)
- cancelTeamVesting(address vesting, address receiver, uint256 startFrom)
- getMaxVestingWithdrawIterations()
- setMaxVestingWithdrawIterations(uint256 maxIterations)
Add account to Admins ACL.
function addAdmin(address _admin) external nonpayable
Arguments
Name | Type | Description |
---|---|---|
_admin | address | The addresses of the account to grant permissions. |
Source Code
function addAdmin(address _admin) external;
Remove account from Admins ACL.
function removeAdmin(address _admin) external nonpayable
Arguments
Name | Type | Description |
---|---|---|
_admin | address | The addresses of the account to revoke permissions. |
Source Code
function removeAdmin(address _admin) external;
Add account to pausers ACL.
function addPauser(address _pauser) external nonpayable
Arguments
Name | Type | Description |
---|---|---|
_pauser | address | The address to grant pauser permissions. |
Source Code
function addPauser(address _pauser) external;
Remove account from pausers ACL.
function removePauser(address _pauser) external nonpayable
Arguments
Name | Type | Description |
---|---|---|
_pauser | address | The address to grant pauser permissions. |
Source Code
function removePauser(address _pauser) external;
Pause/unpause contract
function pauseUnpause(bool _pause) external nonpayable
Arguments
Name | Type | Description |
---|---|---|
_pause | bool | true when pausing, false when unpausing |
Source Code
function pauseUnpause(bool _pause) external;
Freeze contract - disable all functions
function freezeUnfreeze(bool _freeze) external nonpayable
Arguments
Name | Type | Description |
---|---|---|
_freeze | bool | true when freezing, false when unfreezing |
Source Code
function freezeUnfreeze(bool _freeze) external;
Allows the owner to set a fee sharing proxy contract. We need it for unstaking with slashing.
function setFeeSharing(address _feeSharing) external nonpayable
Arguments
Name | Type | Description |
---|---|---|
_feeSharing | address | The address of FeeSharingCollectorProxy contract. |
Source Code
function setFeeSharing(address _feeSharing) external;
Allow the owner to set weight scaling. We need it for unstaking with slashing.
function setWeightScaling(uint96 _weightScaling) external nonpayable
Arguments
Name | Type | Description |
---|---|---|
_weightScaling | uint96 | The weight scaling. |
Source Code
function setWeightScaling(uint96 _weightScaling) external;
Allow the owner to set a new staking contract. As a consequence it allows the stakers to migrate their positions to the new contract.
function setNewStakingContract(address _newStakingContract) external nonpayable
Arguments
Name | Type | Description |
---|---|---|
_newStakingContract | address | The address of the new staking contract. |
Source Code
function setNewStakingContract(address _newStakingContract) external;
Allow a staker to migrate his positions to the new staking contract.
function migrateToNewStakingContract() external nonpayable
Source Code
function migrateToNewStakingContract() external;
Compute the total voting power at a given time.
function getPriorTotalVotingPower(uint32 blockNumber, uint256 time) external view
returns(uint96)
Arguments
Name | Type | Description |
---|---|---|
blockNumber | uint32 | The block number, needed for checkpointing. |
time | uint256 | The timestamp for which to calculate the total voting power. |
Returns
The total voting power at the given time.
Source Code
function getPriorTotalVotingPower(uint32 blockNumber, uint256 time)
external
view
returns (uint96);
Get the current votes balance for a user account.
function getCurrentVotes(address account) external view
returns(uint96)
Arguments
Name | Type | Description |
---|---|---|
account | address | The address to get votes balance. |
Returns
The number of current votes for a user account.
Source Code
function getCurrentVotes(address account) external view returns (uint96);
Determine the prior number of votes for a delegatee as of a block number. Iterate through checkpoints adding up voting power.
function getPriorVotes(address account, uint256 blockNumber, uint256 date) external view
returns(uint96)
Arguments
Name | Type | Description |
---|---|---|
account | address | The address of the account to check. |
blockNumber | uint256 | The block number to get the vote balance at. |
date | uint256 | The staking date to compute the power for. |
Returns
The number of votes the delegatee had as of the given block.
Source Code
function getPriorVotes(
address account,
uint256 blockNumber,
uint256 date
) external view returns (uint96);
Determine the prior number of stake for an account as of a block number.
function getPriorStakeByDateForDelegatee(address account, uint256 date, uint256 blockNumber) external view
returns(uint96)
Arguments
Name | Type | Description |
---|---|---|
account | address | The address of the account to check. |
date | uint256 | The staking date to compute the power for. |
blockNumber | uint256 | The block number to get the vote balance at. |
Returns
The number of votes the account had as of the given block.
Source Code
function getPriorStakeByDateForDelegatee(
address account,
uint256 date,
uint256 blockNumber
) external view returns (uint96);
Determine the prior number of stake for an unlocking date as of a block number.
function getPriorTotalStakesForDate(uint256 date, uint256 blockNumber) external view
returns(uint96)
Arguments
Name | Type | Description |
---|---|---|
date | uint256 | The date to check the stakes for. |
blockNumber | uint256 | The block number to get the vote balance at. |
Returns
The number of votes the account had as of the given block.
Source Code
function getPriorTotalStakesForDate(uint256 date, uint256 blockNumber)
external
view
returns (uint96);
Delegate votes from msg.sender
which are locked until lockDate to delegatee
.
function delegate(address delegatee, uint256 lockDate) external nonpayable
Arguments
Name | Type | Description |
---|---|---|
delegatee | address | The address to delegate votes to. |
lockDate | uint256 | the date if the position to delegate. |
Source Code
function delegate(address delegatee, uint256 lockDate) external;
Delegates votes from signatory to a delegatee account. Voting with EIP-712 Signatures. * Voting power can be delegated to any address, and then can be used to vote on proposals. A key benefit to users of by-signature functionality is that they can create a signed vote transaction for free, and have a trusted third-party spend rBTC(or ETH) on gas fees and write it to the blockchain for them. * The third party in this scenario, submitting the SOV-holder’s signed transaction holds a voting power that is for only a single proposal. The signatory still holds the power to vote on their own behalf in the proposal if the third party has not yet published the signed transaction that was given to them. *
function delegateBySig(address delegatee, uint256 lockDate, uint256 nonce, uint256 expiry, uint8 v, bytes32 r, bytes32 s) external nonpayable
Arguments
Name | Type | Description |
---|---|---|
delegatee | address | The address to delegate votes to. |
lockDate | uint256 | The date until which the position is locked. |
nonce | uint256 | The contract state required to match the signature. |
expiry | uint256 | The time at which to expire the signature. |
v | uint8 | The recovery byte of the signature. |
r | bytes32 | Half of the ECDSA signature pair. |
s | bytes32 | Half of the ECDSA signature pair. |
Source Code
nction delegateBySig(
address delegatee,
uint256 lockDate,
uint256 nonce,
uint256 expiry,
uint8 v,
bytes32 r,
bytes32 s
) external;
Stake the given amount for the given duration of time.
function stake(uint96 amount, uint256 until, address stakeFor, address delegatee) external nonpayable
Arguments
Name | Type | Description |
---|---|---|
amount | uint96 | The number of tokens to stake. |
until | uint256 | Timestamp indicating the date until which to stake. |
stakeFor | address | The address to stake the tokens for or 0x0 if staking for oneself. |
delegatee | address | The address of the delegatee or 0x0 if there is none. |
Source Code
nction stake(
uint96 amount,
uint256 until,
address stakeFor,
address delegatee
) external;
Stake the given amount for the given duration of time.
function stakeWithApproval(address sender, uint96 amount, uint256 until, address stakeFor, address delegatee) external nonpayable
Arguments
Name | Type | Description |
---|---|---|
sender | address | The sender of SOV.approveAndCall |
amount | uint96 | The number of tokens to stake. |
until | uint256 | Timestamp indicating the date until which to stake. |
stakeFor | address | The address to stake the tokens for or 0x0 if staking for oneself. |
delegatee | address | The address of the delegatee or 0x0 if there is none. |
Source Code
nction stakeWithApproval(
address sender,
uint96 amount,
uint256 until,
address stakeFor,
address delegatee
) external;
Receives approval from SOV token.
function receiveApproval(address _sender, uint256 _amount, address _token, bytes _data) external nonpayable
Arguments
Name | Type | Description |
---|---|---|
_sender | address | |
_amount | uint256 | |
_token | address | |
_data | bytes | The data will be used for low level call. |
Source Code
nction receiveApproval(
address _sender,
uint256 _amount,
address _token,
bytes calldata _data
) external;
Extend the staking duration until the specified date.
function extendStakingDuration(uint256 previousLock, uint256 until) external nonpayable
Arguments
Name | Type | Description |
---|---|---|
previousLock | uint256 | The old unlocking timestamp. |
until | uint256 | The new unlocking timestamp in seconds. |
Source Code
nction extendStakingDuration(uint256 previousLock, uint256 until) external;
DO NOT USE this misspelled function. Use stakeBySchedule function instead. This function cannot be deprecated while we have non-upgradeable vesting contracts.
function stakesBySchedule(uint256 amount, uint256 cliff, uint256 duration, uint256 intervalLength, address stakeFor, address delegatee) external nonpayable
Arguments
Name | Type | Description |
---|---|---|
amount | uint256 | |
cliff | uint256 | |
duration | uint256 | |
intervalLength | uint256 | |
stakeFor | address | |
delegatee | address |
Source Code
nction stakesBySchedule(
uint256 amount,
uint256 cliff,
uint256 duration,
uint256 intervalLength,
address stakeFor,
address delegatee
) external;
Stake tokens according to the vesting schedule.
function stakeBySchedule(uint256 amount, uint256 cliff, uint256 duration, uint256 intervalLength, address stakeFor, address delegatee) external nonpayable
Arguments
Name | Type | Description |
---|---|---|
amount | uint256 | The amount of tokens to stake. |
cliff | uint256 | The time interval to the first withdraw. |
duration | uint256 | The staking duration. |
intervalLength | uint256 | The length of each staking interval when cliff passed. |
stakeFor | address | The address to stake the tokens for or 0x0 if staking for oneself. |
delegatee | address | The address of the delegatee or 0x0 if there is none. |
Source Code
nction stakeBySchedule(
uint256 amount,
uint256 cliff,
uint256 duration,
uint256 intervalLength,
address stakeFor,
address delegatee
) external;
Get the number of staked tokens held by the user account.
function balanceOf(address account) external view
returns(balance uint96)
Arguments
Name | Type | Description |
---|---|---|
account | address | The address of the account to get the balance of. |
Returns
The number of tokens held.
Source Code
nction balanceOf(address account) external view returns (uint96 balance);
Get the current number of tokens staked for a day.
function getCurrentStakedUntil(uint256 lockedTS) external view
returns(uint96)
Arguments
Name | Type | Description |
---|---|---|
lockedTS | uint256 | The timestamp to get the staked tokens for. |
Source Code
nction getCurrentStakedUntil(uint256 lockedTS) external view returns (uint96);
Get list of stakes for a user account.
function getStakes(address account) external view
returns(dates uint256[], stakes uint96[])
Arguments
Name | Type | Description |
---|---|---|
account | address | The address to get stakes. |
Returns
The arrays of dates and stakes.
Source Code
nction getStakes(address account)
external
view
returns (uint256[] memory dates, uint96[] memory stakes);
Unstaking is possible every 2 weeks only. This means, to calculate the key value for the staking checkpoints, we need to map the intended timestamp to the closest available date.
function timestampToLockDate(uint256 timestamp) external view
returns(uint256)
Arguments
Name | Type | Description |
---|---|---|
timestamp | uint256 | The unlocking timestamp. |
Returns
The actual unlocking date (might be up to 2 weeks shorter than intended).
Source Code
nction timestampToLockDate(uint256 timestamp) external view returns (uint256);
The maximum duration to stake tokens
function getStorageMaxDurationToStakeTokens() external pure
returns(uint256)
Source Code
nction getStorageMaxDurationToStakeTokens() external pure returns (uint256);
The maximum possible voting weight before adding +1 (actually 10, but need 9 for computation).
function getStorageMaxVotingWeight() external pure
returns(uint256)
Source Code
nction getStorageMaxVotingWeight() external pure returns (uint256);
weight is multiplied with this factor (for allowing decimals, like 1.2x).
function getStorageWeightFactor() external pure
returns(uint256)
Source Code
nction getStorageWeightFactor() external pure returns (uint256);
function getStorageDefaultWeightScaling() external pure
returns(uint256)
Source Code
nction getStorageDefaultWeightScaling() external pure returns (uint256);
return (uint256(MIN_WEIGHT_SCALING), uint256(MAX_WEIGHT_SCALING))
function getStorageRangeForWeightScaling() external pure
returns(minWeightScaling uint256, maxWeightScaling uint256)
Source Code
nction getStorageRangeForWeightScaling()
external
pure
returns (uint256 minWeightScaling, uint256 maxWeightScaling);
The EIP-712 typehash for the contract's domain.
function getStorageDomainTypehash() external pure
returns(uint256)
Source Code
nction getStorageDomainTypehash() external pure returns (uint256);
The EIP-712 typehash for the delegation struct used by the contract.
function getStorageDelegationTypehash() external pure
returns(uint256)
Source Code
nction getStorageDelegationTypehash() external pure returns (uint256);
function getStorageName() external view
returns(string)
Source Code
nction getStorageName() external view returns (string memory);
The timestamp of contract creation. Base for the staking period calculation.
function kickoffTS() external view
returns(uint256)
Source Code
nction kickoffTS() external view returns (uint256);
The token to be staked
function SOVToken() external view
returns(address)
Source Code
nction SOVToken() external view returns (address);
Stakers delegated voting power
function delegates(address staker, uint256 until) external view
returns(_delegate address)
Arguments
Name | Type | Description |
---|---|---|
staker | address | - the delegating address |
until | uint256 | - delegated voting |
Returns
_delegate - voting power delegated to address
Source Code
nction delegates(address staker, uint256 until) external view returns (address _delegate);
If this flag is set to true, all tokens are unlocked immediately see function unlockAllTokens() for details
function allUnlocked() external view
returns(bool)
Source Code
nction allUnlocked() external view returns (bool);
Used for stake migrations to a new staking contract with a different storage structure
function newStakingContract() external view
returns(address)
Source Code
nction newStakingContract() external view returns (address);
A record of tokens to be unstaked at a given time in total. For total voting power computation. Voting weights get adjusted bi-weekly.
function totalStakingCheckpoints(uint256 date, uint32 index) external view
returns(struct IStaking.Checkpoint)
Arguments
Name | Type | Description |
---|---|---|
date | uint256 | |
index | uint32 |
Source Code
nction totalStakingCheckpoints(uint256 date, uint32 index)
external
view
returns (Checkpoint memory);
The number of total staking checkpoints for each date.
function numTotalStakingCheckpoints(uint256 date) external view
returns(checkpointsQty bytes32)
Arguments
Name | Type | Description |
---|---|---|
date | uint256 |
Source Code
nction numTotalStakingCheckpoints(uint256 date)
external
view
returns (bytes32 checkpointsQty);
A record of tokens to be unstaked at a given time which were delegated to a certain address. For delegatee voting power computation. Voting weights get adjusted bi-weekly.
function delegateStakingCheckpoints(address delagatee, uint256 date, uint32 index) external view
returns(struct IStaking.Checkpoint)
Arguments
Name | Type | Description |
---|---|---|
delagatee | address | |
date | uint256 | |
index | uint32 |
Source Code
nction delegateStakingCheckpoints(
address delagatee,
uint256 date,
uint32 index
) external view returns (Checkpoint memory);
The number of total staking checkpoints for each date per delegate.
function numDelegateStakingCheckpoints(address delegatee, uint256 date) external view
returns(checkpointsQty bytes32)
Arguments
Name | Type | Description |
---|---|---|
delegatee | address | |
date | uint256 |
Source Code
nction numDelegateStakingCheckpoints(address delegatee, uint256 date)
external
view
returns (bytes32 checkpointsQty);
A record of tokens to be unstaked at a given time which per user address (address -> lockDate -> stake checkpoint)
function userStakingCheckpoints(address user, uint256 date, uint32 index) external view
returns(struct IStaking.Checkpoint)
Arguments
Name | Type | Description |
---|---|---|
user | address | |
date | uint256 | |
index | uint32 |
Source Code
nction userStakingCheckpoints(
address user,
uint256 date,
uint32 index
) external view returns (Checkpoint memory);
The number of total staking checkpoints for each date per user.
function numUserStakingCheckpoints(address user, uint256 date) external view
returns(checkpointsQty uint32)
Arguments
Name | Type | Description |
---|---|---|
user | address | |
date | uint256 |
Source Code
nction numUserStakingCheckpoints(address user, uint256 date)
external
view
returns (uint32 checkpointsQty);
A record of states for signing / validating signatures
function nonces(address user) external view
returns(nonce uint256)
Arguments
Name | Type | Description |
---|---|---|
user | address |
Source Code
nction nonces(address user) external view returns (uint256 nonce);
the address of FeeSharingCollectorProxy contract, we need it for unstaking with slashing.
function feeSharing() external view
returns(address)
Source Code
nction feeSharing() external view returns (address);
used for weight scaling when unstaking with slashing.
function weightScaling() external view
returns(uint96)
Source Code
nction weightScaling() external view returns (uint96);
List of vesting contracts, tokens for these contracts won't be slashed if unstaked by governance.
function vestingWhitelist(address isWhitelisted) external view
returns(bool)
Arguments
Name | Type | Description |
---|---|---|
isWhitelisted | address |
Source Code
nction vestingWhitelist(address isWhitelisted) external view returns (bool);
user => flag whether user has admin role.
function admins(address isAdmin) external view
returns(bool)
Arguments
Name | Type | Description |
---|---|---|
isAdmin | address |
Source Code
nction admins(address isAdmin) external view returns (bool);
vesting contract code hash => flag whether it's registered code hash
function vestingCodeHashes(bytes32 vestingLogicCodeHash) external view
returns(bool)
Arguments
Name | Type | Description |
---|---|---|
vestingLogicCodeHash | bytes32 |
Source Code
nction vestingCodeHashes(bytes32 vestingLogicCodeHash) external view returns (bool);
A record of tokens to be unstaked from vesting contract at a given time (lockDate -> vest checkpoint)
function vestingCheckpoints(uint256 date, uint32 index) external view
returns(struct IStaking.Checkpoint)
Arguments
Name | Type | Description |
---|---|---|
date | uint256 | |
index | uint32 |
Source Code
nction vestingCheckpoints(uint256 date, uint32 index)
external
view
returns (Checkpoint memory);
The number of total vesting checkpoints for each date.
function numVestingCheckpoints(uint256 date) external view
returns(checkpointsQty uint32)
Arguments
Name | Type | Description |
---|---|---|
date | uint256 |
Source Code
nction numVestingCheckpoints(uint256 date) external view returns (uint32 checkpointsQty);
vesting registry contract PROXY address
function vestingRegistryLogic() external view
returns(address)
Source Code
nction vestingRegistryLogic() external view returns (address);
user => flag whether user has pauser role.
function pausers(address isPauser) external view
returns(bool)
Arguments
Name | Type | Description |
---|---|---|
isPauser | address |
Source Code
nction pausers(address isPauser) external view returns (bool);
Staking contract is paused
function paused() external view
returns(bool)
Source Code
nction paused() external view returns (bool);
Staking contract is frozen
function frozen() external view
returns(bool)
Source Code
nction frozen() external view returns (bool);
Return flag whether the given address is a registered vesting contract.
function isVestingContract(address stakerAddress) external view
returns(bool)
Arguments
Name | Type | Description |
---|---|---|
stakerAddress | address | the address to check |
Source Code
nction isVestingContract(address stakerAddress) external view returns (bool);
Remove vesting contract's code hash to a map of code hashes.
function removeContractCodeHash(address vesting) external nonpayable
Arguments
Name | Type | Description |
---|---|---|
vesting | address | The address of Vesting contract. |
Source Code
nction removeContractCodeHash(address vesting) external;
Add vesting contract's code hash to a map of code hashes.
function addContractCodeHash(address vesting) external nonpayable
Arguments
Name | Type | Description |
---|---|---|
vesting | address | The address of Vesting contract. |
Source Code
nction addContractCodeHash(address vesting) external;
Determine the prior number of vested stake for an account until a certain lock date as of a block number.
function getPriorVestingStakeByDate(uint256 date, uint256 blockNumber) external view
returns(uint96)
Arguments
Name | Type | Description |
---|---|---|
date | uint256 | The lock date. |
blockNumber | uint256 | The block number to get the vote balance at. |
Returns
The number of votes the account had as of the given block.
Source Code
nction getPriorVestingStakeByDate(uint256 date, uint256 blockNumber)
external
view
returns (uint96);
Compute the voting power for a specific date. Power = stake * weight
function weightedVestingStakeByDate(uint256 date, uint256 startDate, uint256 blockNumber) external view
returns(power uint96)
Arguments
Name | Type | Description |
---|---|---|
date | uint256 | The staking date to compute the power for. Adjusted to the next valid lock date, if necessary. |
startDate | uint256 | The date for which we need to know the power of the stake. |
blockNumber | uint256 | The block number, needed for checkpointing. |
Returns
The stacking power.
Source Code
nction weightedVestingStakeByDate(
uint256 date,
uint256 startDate,
uint256 blockNumber
) external view returns (uint96 power);
Determine the prior weighted vested amount for an account as of a block number. Iterate through checkpoints adding up voting power.
function getPriorVestingWeightedStake(uint256 blockNumber, uint256 date) external view
returns(votes uint96)
Arguments
Name | Type | Description |
---|---|---|
blockNumber | uint256 | The block number to get the vote balance at. |
date | uint256 | The staking date to compute the power for. |
Returns
The weighted stake the account had as of the given block.
Source Code
nction getPriorVestingWeightedStake(uint256 blockNumber, uint256 date)
external
view
returns (uint96 votes);
Determine the prior number of stake for an account until a certain lock date as of a block number.
function getPriorUserStakeByDate(address account, uint256 date, uint256 blockNumber) external view
returns(uint96)
Arguments
Name | Type | Description |
---|---|---|
account | address | The address of the account to check. |
date | uint256 | The lock date. |
blockNumber | uint256 | The block number to get the vote balance at. |
Returns
The number of votes the account had as of the given block.
Source Code
nction getPriorUserStakeByDate(
address account,
uint256 date,
uint256 blockNumber
) external view returns (uint96);
Sets the users' vesting stakes for a giving lock dates and writes checkpoints.
function setVestingStakes(uint256[] lockedDates, uint96[] values) external nonpayable
Arguments
Name | Type | Description |
---|---|---|
lockedDates | uint256[] | The arrays of lock dates. |
values | uint96[] | The array of values to add to the staked balance. |
Source Code
nction setVestingStakes(uint256[] calldata lockedDates, uint96[] calldata values) external;
sets vesting registry
function setVestingRegistry(address _vestingRegistryProxy) external nonpayable
Arguments
Name | Type | Description |
---|---|---|
_vestingRegistryProxy | address | the address of vesting registry proxy contract |
Source Code
nction setVestingRegistry(address _vestingRegistryProxy) external;
Withdraw the given amount of tokens if they are unlocked.
function withdraw(uint96 amount, uint256 until, address receiver) external nonpayable
Arguments
Name | Type | Description |
---|---|---|
amount | uint96 | The number of tokens to withdraw. |
until | uint256 | The date until which the tokens were staked. |
receiver | address | The receiver of the tokens. If not specified, send to the msg.sender |
Source Code
nction withdraw(
uint96 amount,
uint256 until,
address receiver
) external;
Withdraw the given amount of tokens.
function governanceWithdraw(uint96 amount, uint256 until, address receiver) external nonpayable
Arguments
Name | Type | Description |
---|---|---|
amount | uint96 | The number of tokens to withdraw. |
until | uint256 | The date until which the tokens were staked. |
receiver | address | The receiver of the tokens. If not specified, send to the msg.sender |
Source Code
nction governanceWithdraw(
uint96 amount,
uint256 until,
address receiver
) external;
Withdraw tokens for vesting contract.
function governanceWithdrawVesting(address vesting, address receiver) external nonpayable
Arguments
Name | Type | Description |
---|---|---|
vesting | address | The address of Vesting contract. |
receiver | address | The receiver of the tokens. If not specified, send to the msg.sender |
Source Code
nction governanceWithdrawVesting(address vesting, address receiver) external;
Get available and punished amount for withdrawing.
function getWithdrawAmounts(uint96 amount, uint256 until) external view
returns(uint96, uint96)
Arguments
Name | Type | Description |
---|---|---|
amount | uint96 | The number of tokens to withdraw. |
until | uint256 | The date until which the tokens were staked. |
Source Code
nction getWithdrawAmounts(uint96 amount, uint256 until)
external
view
returns (uint96, uint96);
Allow the owner to unlock all tokens in case the staking contract is going to be replaced Note: Not reversible on purpose. once unlocked, everything is unlocked. The owner should not be able to just quickly unlock to withdraw his own tokens and lock again.
function unlockAllTokens() external nonpayable
Source Code
nction unlockAllTokens() external;
Determine the prior weighted stake for an account as of a block number. Iterate through checkpoints adding up voting power.
function getPriorWeightedStake(address account, uint256 blockNumber, uint256 date) external view
returns(priorWeightedStake uint96)
Arguments
Name | Type | Description |
---|---|---|
account | address | The address of the account to check. |
blockNumber | uint256 | The block number to get the vote balance at. |
date | uint256 | The date/timestamp of the unstaking time. |
Returns
The weighted stake the account had as of the given block.
Source Code
nction getPriorWeightedStake(
address account,
uint256 blockNumber,
uint256 date
) external view returns (uint96 priorWeightedStake);
Compute the voting power for a specific date. Power = stake * weight TODO: WeightedStaking::weightedStakeByDate should probably better be internal instead of a public function.
function weightedStakeByDate(address account, uint256 date, uint256 startDate, uint256 blockNumber) external view
returns(power uint96)
Arguments
Name | Type | Description |
---|---|---|
account | address | The user address. |
date | uint256 | The staking date to compute the power for. |
startDate | uint256 | The date for which we need to know the power of the stake. |
blockNumber | uint256 | The block number, needed for checkpointing. |
Returns
The stacking power.
Source Code
nction weightedStakeByDate(
address account,
uint256 date,
uint256 startDate,
uint256 blockNumber
) external view returns (uint96 power);
Compute the weight for a specific date.
function computeWeightByDate(uint256 date, uint256 startDate) external pure
returns(weight uint96)
Arguments
Name | Type | Description |
---|---|---|
date | uint256 | The unlocking date. |
startDate | uint256 | We compute the weight for the tokens staked until 'date' on 'startDate'. |
Returns
The weighted stake the account had as of the given block.
Source Code
nction computeWeightByDate(uint256 date, uint256 startDate)
external
pure
returns (uint96 weight);
Returns public constant MAX_DURATION preserved for backwards compatibility Use getStorageMaxDurationToStakeTokens()
function MAX_DURATION() external view
returns(uint256)
Source Code
nction MAX_DURATION() external view returns (uint256);
Returns the address of the current owner.
function owner() external view
returns(address)
Source Code
nction owner() external view returns (address);
Returns true if the caller is the current owner.
function isOwner() external view
returns(bool)
Source Code
nction isOwner() external view returns (bool);
Transfers ownership of the contract to a new account (newOwner
).
Can only be called by the current owner.
function transferOwnership(address newOwner) external nonpayable
Arguments
Name | Type | Description |
---|---|---|
newOwner | address |
Source Code
nction transferOwnership(address newOwner) external;
Governance withdraw vesting directly through staking contract. This direct withdraw vesting solves the out of gas issue when there are too many iterations when withdrawing. This function only allows cancelling vesting contract of the TeamVesting type. *
function cancelTeamVesting(address vesting, address receiver, uint256 startFrom) external nonpayable
Arguments
Name | Type | Description |
---|---|---|
vesting | address | The vesting address. |
receiver | address | The receiving address. |
startFrom | uint256 | The start value for the iterations. |
Source Code
nction cancelTeamVesting(
address vesting,
address receiver,
uint256 startFrom
) external;
Max iteration for direct withdrawal from staking to prevent out of gas issue. *
function getMaxVestingWithdrawIterations() external view
returns(uint256)
Source Code
nction getMaxVestingWithdrawIterations() external view returns (uint256);
set max withdraw iterations. *
function setMaxVestingWithdrawIterations(uint256 maxIterations) external nonpayable
Arguments
Name | Type | Description |
---|---|---|
maxIterations | uint256 | new max iterations value. |
Source Code
nction setMaxVestingWithdrawIterations(uint256 maxIterations) external;
}
- Address
- Administered
- AdminRole
- AdvancedToken
- AdvancedTokenStorage
- Affiliates
- AffiliatesEvents
- ApprovalReceiver
- BProPriceFeed
- CheckpointsShared
- Constants
- Context
- DevelopmentFund
- DummyContract
- EnumerableAddressSet
- EnumerableBytes32Set
- EnumerableBytes4Set
- ERC20
- ERC20Detailed
- ErrorDecoder
- Escrow
- EscrowReward
- FeedsLike
- FeesEvents
- FeeSharingCollector
- FeeSharingCollectorProxy
- FeeSharingCollectorStorage
- FeesHelper
- FourYearVesting
- FourYearVestingFactory
- FourYearVestingLogic
- FourYearVestingStorage
- GenericTokenSender
- GovernorAlpha
- GovernorVault
- IApproveAndCall
- IChai
- IContractRegistry
- IConverterAMM
- IERC1820Registry
- IERC20_
- IERC20
- IERC777
- IERC777Recipient
- IERC777Sender
- IFeeSharingCollector
- IFourYearVesting
- IFourYearVestingFactory
- IFunctionsList
- ILiquidityMining
- ILiquidityPoolV1Converter
- ILoanPool
- ILoanToken
- ILoanTokenLogicBeacon
- ILoanTokenLogicModules
- ILoanTokenLogicProxy
- ILoanTokenModules
- ILoanTokenWRBTC
- ILockedSOV
- IMoCState
- IModulesProxyRegistry
- Initializable
- InterestUser
- IPot
- IPriceFeeds
- IPriceFeedsExt
- IProtocol
- IRSKOracle
- ISovryn
- ISovrynSwapNetwork
- IStaking
- ISwapsImpl
- ITeamVesting
- ITimelock
- IV1PoolOracle
- IVesting
- IVestingFactory
- IVestingRegistry
- IWrbtc
- IWrbtcERC20
- LenderInterestStruct
- LiquidationHelper
- LiquidityMining
- LiquidityMiningConfigToken
- LiquidityMiningProxy
- LiquidityMiningStorage
- LoanClosingsEvents
- LoanClosingsLiquidation
- LoanClosingsRollover
- LoanClosingsShared
- LoanClosingsWith
- LoanClosingsWithoutInvariantCheck
- LoanInterestStruct
- LoanMaintenance
- LoanMaintenanceEvents
- LoanOpenings
- LoanOpeningsEvents
- LoanParamsStruct
- LoanSettings
- LoanSettingsEvents
- LoanStruct
- LoanToken
- LoanTokenBase
- LoanTokenLogicBeacon
- LoanTokenLogicLM
- LoanTokenLogicProxy
- LoanTokenLogicStandard
- LoanTokenLogicStorage
- LoanTokenLogicWrbtc
- LoanTokenSettingsLowerAdmin
- LockedSOV
- MarginTradeStructHelpers
- Medianizer
- ModuleCommonFunctionalities
- ModulesCommonEvents
- ModulesProxy
- ModulesProxyRegistry
- MultiSigKeyHolders
- MultiSigWallet
- Mutex
- Objects
- OrderStruct
- OrigingVestingCreator
- OriginInvestorsClaim
- Ownable
- Pausable
- PausableOz
- PreviousLoanToken
- PreviousLoanTokenSettingsLowerAdmin
- PriceFeedRSKOracle
- PriceFeeds
- PriceFeedsLocal
- PriceFeedsMoC
- PriceFeedV1PoolOracle
- ProtocolAffiliatesInterface
- ProtocolLike
- ProtocolSettings
- ProtocolSettingsEvents
- ProtocolSettingsLike
- ProtocolSwapExternalInterface
- ProtocolTokenUser
- Proxy
- ProxyOwnable
- ReentrancyGuard
- RewardHelper
- RSKAddrValidator
- SafeERC20
- SafeMath
- SafeMath96
- setGet
- SharedReentrancyGuard
- SignedSafeMath
- SOV
- sovrynProtocol
- StakingAdminModule
- StakingGovernanceModule
- StakingInterface
- StakingProxy
- StakingRewards
- StakingRewardsProxy
- StakingRewardsStorage
- StakingShared
- StakingStakeModule
- StakingStorageModule
- StakingStorageShared
- StakingVestingModule
- StakingWithdrawModule
- State
- SwapsEvents
- SwapsExternal
- SwapsImplLocal
- SwapsImplSovrynSwap
- SwapsUser
- TeamVesting
- Timelock
- TimelockHarness
- TimelockInterface
- TokenSender
- UpgradableProxy
- USDTPriceFeed
- Utils
- VaultController
- Vesting
- VestingCreator
- VestingFactory
- VestingLogic
- VestingRegistry
- VestingRegistry2
- VestingRegistry3
- VestingRegistryLogic
- VestingRegistryProxy
- VestingRegistryStorage
- VestingStorage
- WeightedStakingModule
- WRBTC