GNSStaking

Staking contract for GNS token to earn in multiple reward tokens from fees generated on gTrade.

Methods

accDaiPerToken

function accDaiPerToken() external view returns (uint128)

Returns

NameTypeDescription

_0

uint128

undefined

acceptOwnership

function acceptOwnership() external nonpayable

The new owner accepts the ownership transfer.

addRewardToken

function addRewardToken(address _token) external nonpayable

Forwards call to {_addRewardToken}. Only callable by owner.

Parameters

NameTypeDescription

_token

address

undefined

claimUnlockedGns

function claimUnlockedGns(uint256[] _ids) external nonpayable

Claims caller's unlocked GNS from vests _ids.

Parameters

NameTypeDescription

_ids

uint256[]

undefined

createUnlockSchedule

function createUnlockSchedule(IGNSStaking.UnlockScheduleInput _schedule, address _staker) external nonpayable

Parameters

NameTypeDescription

_schedule

IGNSStaking.UnlockScheduleInput

undefined

_staker

address

undefined

dai

function dai() external view returns (contract IERC20)

Returns

NameTypeDescription

_0

contract IERC20

undefined

distributeReward

function distributeReward(address _token, uint256 _amountToken) external nonpayable

Transfers _amountToken of _token (valid reward token) from caller to this contract and updates accRewardPerGns.Note: accRewardPerGns is normalized to 1e18 for all reward tokens (even those with less than 18 decimals) Emits {RewardDistributed}

Parameters

NameTypeDescription

_token

address

undefined

_amountToken

uint256

undefined

getRewardTokens

function getRewardTokens() external view returns (address[])

Returns the address of all supported reward tokens

Returns

NameTypeDescription

_0

address[]

undefined

getUnlockSchedules

function getUnlockSchedules(address _staker, uint256 _index) external view returns (struct IGNSStaking.UnlockSchedule)

Returns _staker's vest at _index'

Parameters

NameTypeDescription

_staker

address

undefined

_index

uint256

undefined

Returns

NameTypeDescription

_0

IGNSStaking.UnlockSchedule

undefined

getUnlockSchedules

function getUnlockSchedules(address _staker) external view returns (struct IGNSStaking.UnlockSchedule[])

Returns all _staker's vests.

Parameters

NameTypeDescription

_staker

address

undefined

Returns

NameTypeDescription

_0

IGNSStaking.UnlockSchedule[]

undefined

gns

function gns() external view returns (contract IERC20)

Returns

NameTypeDescription

_0

contract IERC20

undefined

gnsBalance

function gnsBalance() external view returns (uint128)

Returns

NameTypeDescription

_0

uint128

undefined

harvestAll

function harvestAll(uint256[] _ids) external nonpayable

Harvests the caller's regular pending rewards and pending rewards for vests _ids for all supported reward tokens (+ old DAI rewards).

Parameters

NameTypeDescription

_ids

uint256[]

undefined

harvestDai

function harvestDai() external nonpayable

Harvests caller's old regular dai rewards.

harvestDaiAll

function harvestDaiAll(uint256[] _ids) external nonpayable

Harvests caller's old regular dai rewards and old dai rewards of vests _ids.

Parameters

NameTypeDescription

_ids

uint256[]

undefined

harvestDaiFromUnlock

function harvestDaiFromUnlock(uint256[] _ids) external nonpayable

Harvests caller's old dai rewards for vests _ids.

Parameters

NameTypeDescription

_ids

uint256[]

undefined

harvestToken

function harvestToken(address _token) external nonpayable

Harvests the caller's regular pending _token rewards. _token must be a valid reward token.

Parameters

NameTypeDescription

_token

address

undefined

harvestTokenAll

function harvestTokenAll(address _token, uint256[] _ids) external nonpayable

Harvests the caller's regular pending _token rewards and pending rewards for vests _ids.

Parameters

NameTypeDescription

_token

address

undefined

_ids

uint256[]

undefined

harvestTokenFromUnlock

function harvestTokenFromUnlock(address _token, uint256[] _ids) external nonpayable

Harvests the caller's pending _token rewards for vests _ids. _token must be a valid reward token.

Parameters

NameTypeDescription

_token

address

undefined

_ids

uint256[]

undefined

harvestTokens

function harvestTokens() external nonpayable

Harvests the caller's regular pending rewards for all supported reward tokens.

harvestTokensAll

function harvestTokensAll(uint256[] _ids) external nonpayable

Harvests the caller's regular pending rewards and pending rewards of vests _ids for all supported reward tokens.

Parameters

NameTypeDescription

_ids

uint256[]

undefined

harvestTokensFromUnlock

function harvestTokensFromUnlock(uint256[] _ids) external nonpayable

Harvests the caller's pending rewards of vests _ids for all supported reward tokens.

Parameters

NameTypeDescription

_ids

uint256[]

undefined

initialize

function initialize(address _owner, contract IERC20 _gns, contract IERC20 _dai) external nonpayable

Sets owner and initializes dai and gns state variables

Parameters

NameTypeDescription

_owner

address

undefined

_gns

contract IERC20

undefined

_dai

contract IERC20

undefined

initializeV2

function initializeV2() external nonpayable

Add dai as a reward token (old stakers.debtDai, unlockSchedules.debtDai and accDaiPerToken are deprecacted now) Necessary to call right after contract is updated because otherwise distributeRewardDai() reverts.

isRewardToken

function isRewardToken(address _token) external view returns (bool)

Returns whether _token is a listed reward token.

Parameters

NameTypeDescription

_token

address

undefined

Returns

NameTypeDescription

_0

bool

undefined

owner

function owner() external view returns (address)

Returns the owner of the contract.

Returns

NameTypeDescription

_0

address

undefined

pendingOwner

function pendingOwner() external view returns (address)

Returns the address of the pending owner.

Returns

NameTypeDescription

_0

address

undefined

pendingRewardDai

function pendingRewardDai(address _staker) external view returns (uint128)

Returns _staker's pending old dai rewards (1e18 precision).

Parameters

NameTypeDescription

_staker

address

undefined

Returns

NameTypeDescription

_0

uint128

undefined

pendingRewardDaiFromUnlocks

function pendingRewardDaiFromUnlocks(address _staker, uint256[] _ids) external view returns (uint128 pending)

Returns _staker's pending old dai rewards (1e18 precision) from vests _ids.

Parameters

NameTypeDescription

_staker

address

undefined

_ids

uint256[]

undefined

Returns

NameTypeDescription

pending

uint128

undefined

pendingRewardToken

function pendingRewardToken(address _staker, address _token) external view returns (uint128)

Returns the pending _token rewards (precision depends on token) for _staker.

Parameters

NameTypeDescription

_staker

address

undefined

_token

address

undefined

Returns

NameTypeDescription

_0

uint128

undefined

pendingRewardTokens

function pendingRewardTokens(address _staker) external view returns (uint128[] pendingTokens)

Returns an array of _staker's pending rewards (precision depends on token) for all supported tokens.

Parameters

NameTypeDescription

_staker

address

undefined

Returns

NameTypeDescription

pendingTokens

uint128[]

undefined

pendingRewardTokensFromUnlocks

function pendingRewardTokensFromUnlocks(address _staker, uint256[] _ids) external view returns (uint128[] pendingTokens)

Returns an array of _staker's pending rewards (precision depends on token) from vests _ids for all supported tokens.

Parameters

NameTypeDescription

_staker

address

undefined

_ids

uint256[]

undefined

Returns

NameTypeDescription

pendingTokens

uint128[]

undefined

releasableGns

function releasableGns(IGNSStaking.UnlockSchedule _schedule, uint48 _timestamp) external pure returns (uint128)

Parameters

NameTypeDescription

_schedule

IGNSStaking.UnlockSchedule

undefined

_timestamp

uint48

undefined

Returns

NameTypeDescription

_0

uint128

undefined

renounceOwnership

function renounceOwnership() external nonpayable

Leaves the contract without owner. It will not be possible to call onlyOwner functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner.

revokeUnlockSchedule

function revokeUnlockSchedule(address _staker, uint256 _id) external nonpayable

Revokes vest _id for _staker. Sends the unlocked GNS to _staker and sends the remaining locked GNS to owner. Only callable by owner. Emits {UnlockScheduleRevoked}

Parameters

NameTypeDescription

_staker

address

undefined

_id

uint256

undefined

rewardTokenState

function rewardTokenState(address) external view returns (uint128 accRewardPerGns, uint128 precisionDelta)

Parameters

NameTypeDescription

_0

address

undefined

Returns

NameTypeDescription

accRewardPerGns

uint128

undefined

precisionDelta

uint128

undefined

rewardTokens

function rewardTokens(uint256) external view returns (address)

Parameters

NameTypeDescription

_0

uint256

undefined

Returns

NameTypeDescription

_0

address

undefined

setDelegatee

function setDelegatee(address _token, address _delegatee) external nonpayable

Attempts to set the delegatee of _token to _delegatee. _token must be a valid reward token.

Parameters

NameTypeDescription

_token

address

undefined

_delegatee

address

undefined

setUnlockManager

function setUnlockManager(address _manager, bool _authorized) external nonpayable

Sets whether _manager is _authorized to create vests for other users. Emits {UnlockManagerUpdated}

Parameters

NameTypeDescription

_manager

address

undefined

_authorized

bool

undefined

stakeGns

function stakeGns(uint128 _amountGns) external nonpayable

Stakes non-vested _amountGns from caller. Emits {GnsStaked}

Parameters

NameTypeDescription

_amountGns

uint128

undefined

stakers

function stakers(address) external view returns (uint128 stakedGns, uint128 debtDai)

Parameters

NameTypeDescription

_0

address

undefined

Returns

NameTypeDescription

stakedGns

uint128

undefined

debtDai

uint128

undefined

totalGnsStaked

function totalGnsStaked(address _staker) external view returns (uint128)

Returns _staker's total non-vested and vested GNS staked (1e18 precision)

Parameters

NameTypeDescription

_staker

address

undefined

Returns

NameTypeDescription

_0

uint128

undefined

transferOwnership

function transferOwnership(address newOwner) external nonpayable

Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one. Can only be called by the current owner.

Parameters

NameTypeDescription

newOwner

address

undefined

unlockManagers

function unlockManagers(address) external view returns (bool)

Parameters

NameTypeDescription

_0

address

undefined

Returns

NameTypeDescription

_0

bool

undefined

unlockedGns

function unlockedGns(IGNSStaking.UnlockSchedule _schedule, uint48 _timestamp) external pure returns (uint128)

Parameters

NameTypeDescription

_schedule

IGNSStaking.UnlockSchedule

undefined

_timestamp

uint48

undefined

Returns

NameTypeDescription

_0

uint128

undefined

unstakeGns

function unstakeGns(uint128 _amountGns) external nonpayable

Unstakes non-vested _amountGns from caller. Emits {GnsUnstaked}

Parameters

NameTypeDescription

_amountGns

uint128

undefined

userTokenRewards

function userTokenRewards(address, address) external view returns (uint128 debtToken, uint128 __placeholder)

Parameters

NameTypeDescription

_0

address

undefined

_1

address

undefined

Returns

NameTypeDescription

debtToken

uint128

undefined

__placeholder

uint128

undefined

userTokenUnlockRewards

function userTokenUnlockRewards(address, address, uint256) external view returns (uint128 debtToken, uint128 __placeholder)

Parameters

NameTypeDescription

_0

address

undefined

_1

address

undefined

_2

uint256

undefined

Returns

NameTypeDescription

debtToken

uint128

undefined

__placeholder

uint128

undefined

Events

DaiHarvested

event DaiHarvested(address indexed staker, uint128 amountDai)

Parameters

NameTypeDescription

staker indexed

address

undefined

amountDai

uint128

undefined

Delegated

event Delegated(address indexed asset, address indexed delegatee, bool success)

Parameters

NameTypeDescription

asset indexed

address

undefined

delegatee indexed

address

undefined

success

bool

undefined

GnsClaimed

event GnsClaimed(address indexed staker, uint256[] ids, uint128 amountGns)

Parameters

NameTypeDescription

staker indexed

address

undefined

ids

uint256[]

undefined

amountGns

uint128

undefined

GnsStaked

event GnsStaked(address indexed staker, uint128 amountGns)

Parameters

NameTypeDescription

staker indexed

address

undefined

amountGns

uint128

undefined

GnsUnstaked

event GnsUnstaked(address indexed staker, uint128 amountGns)

Parameters

NameTypeDescription

staker indexed

address

undefined

amountGns

uint128

undefined

Initialized

event Initialized(uint8 version)

Triggered when the contract has been initialized or reinitialized.

Parameters

NameTypeDescription

version

uint8

undefined

OwnershipTransferStarted

event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner)

Parameters

NameTypeDescription

previousOwner indexed

address

undefined

newOwner indexed

address

undefined

OwnershipTransferred

event OwnershipTransferred(address indexed previousOwner, address indexed newOwner)

Parameters

NameTypeDescription

previousOwner indexed

address

undefined

newOwner indexed

address

undefined

RewardDistributed

event RewardDistributed(address indexed token, uint256 amount)

Parameters

NameTypeDescription

token indexed

address

undefined

amount

uint256

undefined

RewardHarvested

event RewardHarvested(address indexed staker, address indexed token, uint128 amountToken)

Parameters

NameTypeDescription

staker indexed

address

undefined

token indexed

address

undefined

amountToken

uint128

undefined

RewardHarvestedFromUnlock

event RewardHarvestedFromUnlock(address indexed staker, address indexed token, bool isOldDai, uint256[] ids, uint128 amountToken)

Parameters

NameTypeDescription

staker indexed

address

undefined

token indexed

address

undefined

isOldDai

bool

undefined

ids

uint256[]

undefined

amountToken

uint128

undefined

RewardTokenAdded

event RewardTokenAdded(address token, uint256 index, uint128 precisionDelta)

Parameters

NameTypeDescription

token

address

undefined

index

uint256

undefined

precisionDelta

uint128

undefined

UnlockManagerUpdated

event UnlockManagerUpdated(address indexed manager, bool authorized)

Parameters

NameTypeDescription

manager indexed

address

undefined

authorized

bool

undefined

UnlockScheduleRevoked

event UnlockScheduleRevoked(address indexed staker, uint256 indexed index)

Parameters

NameTypeDescription

staker indexed

address

undefined

index indexed

uint256

undefined

UnlockScheduled

event UnlockScheduled(address indexed staker, uint256 indexed index, IGNSStaking.UnlockSchedule schedule)

Parameters

NameTypeDescription

staker indexed

address

undefined

index indexed

uint256

undefined

schedule

IGNSStaking.UnlockSchedule

undefined