Token
Token Contract Address: inj1v3a4zznudwpukpr8y987pu5gnh4xuf7v36jhva
The Token Contract is a core component of the Neptune Protocol, responsible for managing the NEPT token. It handles token minting, bonding, unbonding, and various queries related to token state and user interactions.
Query Messages
The Token Contract supports several queries to retrieve information about the token state, user stakes, and unlock schedules.
1. Get Params
Query: get_params
Purpose: Returns the current state of the token contract variables
Query Input:
Query Response:
emission_rate
string (uint256)
The rate at which tokens are emitted and allocated to staking rewards
bond_duration_settings
array
Array contain staking pool parameters
bond_duration_settings.[].[]
integer (uint64)
The duration of the staking pool bonding period in nanoseconds
reward_weight
string (decimal256)
The weight assigned to rewards for the given bond duration
gov_weight
string (decimal256)
The weight assigned to governance power for the given bond duration
health_weight
string (decimal256)
The weight assigned to health calculations for the given bond duration
flash_loan_weight
string (decimal256)
The weight assigned to flashloan calculations for the given bond duration
tokens_per_weight
integer (uint64)
The number of tokens assigned per weight unit, used in staking calculations
This table provides a structured overview of the parameters found in the JSON, including their types and descriptions.
2. Get State
Query: get_state
Purpose: Returns the current state of the token contract variables
Query Input:
Query Response:
bonded
array
Array of the available staking pools
bonded.[].[0]
integer (uint64)
Duration of bond for the staking pool in nanoseconds
bonded.[].[1]
string (uint256)
Amount of NEPT tokens staked to pool
stake_acc
string (decimal256)
The accumulated stake value
time_last_distributed
string (uint64)
The timestamp of the last emissions distribution event
total_issued
string (uint256)
The total number of NEPT tokens that have been issued
total_claimed
string (uint256)
The total number of tokens that have been claimed
total_locked
string (uint256)
The total number of NEPT tokens that are currently locked
total_supply
string (uint256)
The total supply of NEPT tokens
3. Get User Token Unlocks
Query: get_user_token_unlocks
Purpose: Retrieves token unlock schedules and their claimable amounts for a user, if any apply.
Query Input:
Query Response:
token_unlocks
array
An array of objects, each representing a token unlock schedule with details
amount
string (uint256)
The amount of tokens scheduled to be unlocked
start
string (uint64)
The start time of the unlock schedule, unix epoch in nanoseconds
last_claim
string (uint64)
The timestamp of the last claim made, unix epoch in nanoseconds
expiration
string (uint64)
The expiration time of the unlock schedule, unix epoch in nanoseconds
schedule
UnlockSchedule
Either "lump_sum" or {"linear": {"duration": uint64}}
admin
object
An object containing administrative details related to the unlock schedule
admin.addr
string
The address of the admin responsible for the unlock schedule
admin.reclaimed
boolean
A flag indicating whether the unlock schedule has been reclaimed
claimable_unlocks
string (uint256)
The amount of tokens that are currently claimable from the unlock schedule
4. Get User Staked
Query: get_user_staked
Purpose: Retrieves staking data for a user, including bonded tokens, unbonding tokens, unclaimed rewards, and claimable rewards.
Query Input:
Query Response:
bonded
array
An array of objects, each representing a bond with details about account index, duration, and bonded tokens
bonded.[].
account_index
u64
The index of a users margin account associated with the token bond
bonded.[].
duration
u64 (nanoseconds)
The duration of the staking pool bond in nanoseconds
bonded.[].
bonded
array
An array of objects representing individual bond details
bonded.[].
bonded.
cooldown
null
or string
The cooldown (unlock) period for the bond, null if not applicable
bonded.[].
bonded.
cascade
boolean
A flag indicating whether the cooldown is part of a cascade operation
bonded.[].
bonded.
last_stake_acc
string (u64)
The last recorded stake accumulator value for the bond.
bonded.[].
bonded.
amount
string (u64)
The amount of tokens bonded.
unbonding
array
An array representing tokens that are in the process of unbonding.
unclaimed
string (u64)
The amount of staking rewards that have been accumulated but not yet claimed
claimable_rewards
string (u64)
The amount of staking rewards that are currently claimable
claimable_unbonding
string (u64)
The amount of unbonding tokens that are currently claimable
5. Get Health Weighted Stake
Query: get_health_weighted_stake
Purpose: Calculates the health-weighted stake for a specific staking position, used by the market contract for account health calculations.
Query Input:
Query Response:
response
string (uint256)
The health-weighted stake for the specified account address and index
5. Get Gov Weighted Stake
Query: get_gov_weighted_stake
Purpose: Calculates the governance-weighted stake for a user, determining voting power in protocol governance.
Query Input:
Query Response:
response
string (uint256)
The governance weight for a given address
6. Get Flash Loan Weighted Stake
Query: get_flash_loan_weighted_stake
Purpose: Calculates the flashloan-weighted stake for a user, used in flashloan operations to determine the amount of assets a user can borrow in a flashloan.
Query Input:
Query Response:
response
string (uint256)
The flashloan weight staked used to calculate the amount a user can flashloan from the market
7. Get Health Weighted Stake Range
Query: get_health_weighted_stake_range
Purpose: Retrieves the health-weighted stake for a range of account positions.
Query Input:
Query Response:
[]
array
Array of account indexes and their health weighted stakes
[].[].[1]
string (uint256)
Health weighted stake value
8. Get Cascade
Query: get_cascade
Purpose: Checks if there are any pending cascade operations. Cascading is used to transition bonds from one duration phase to another.
Query Input:
Query Response:
response
boolean
Returns true
if at least one cascade entry exists, false
otherwise
Execute Messages
The Token Contract supports several execute messages for managing token bonding, unbonding, rewards, and token unlocks.
1. Bond
Execute: bond
Purpose: Bonds (stakes) NEPT tokens to a specified staking pool for a specified duration, enabling participation in protocol governance and earning staking rewards.
Execute Input:
account_index
integer (uint8)
The index of the margin account to associate with the bond
duration
integer (uint64)
The duration to bond tokens for, must match one of the durations in bond_duration_settings
Note: This message must be sent with exactly one non-zero amount of NEPT tokens to bond.
2. Unbond
Execute: unbond
Purpose: Initiates the unbonding of staked NEPT tokens, starting the cooldown period before tokens can be claimed.
Execute Input:
account_index
integer (uint8)
The index of the margin account to unbond from
amount
string (uint256)
The amount of NEPT tokens to unbond
duration
integer (uint64)
The duration pool to unbond from
3. Rebond
Execute: rebond
Purpose: Rebonds tokens that are currently unbonding back into a staking position, optionally enabling cascading.
Execute Input:
account_index
integer (uint8)
The index of the margin account to rebond to
amount
string (uint256)
The amount of NEPT tokens to rebond
duration
integer (uint64)
The duration to rebond for
cascade
boolean
Whether to enable cascading for this bond
4. Claim Unbonded
Execute: claim_unbonded
Purpose: Claims NEPT tokens that have completed their unbonding period.
Execute Input:
5. Claim Rewards
Execute: claim_rewards
Purpose: Claims accumulated staking rewards from all bonded positions.
Execute Input:
6. Claim Token Unlock
Execute: claim_token_unlock
Purpose: Claims tokens that have been unlocked according to the unlock schedule.
Execute Input:
7. Reclaim Token Unlock
Execute: reclaim_token_unlock
Purpose: Allows an admin to reclaim tokens from an unlock schedule they control.
Execute Input:
addr
string
The address that owns the unlock schedule
index
integer (uint64)
The index of the unlock schedule to reclaim
recipient
string
Optional recipient address for the reclaimed tokens
8. Cascade
Execute: cascade
Purpose: Processes bonds that are ready to cascade to lower duration pools.
Execute Input:
limit
integer (uint16)
Maximum number of cascade entries to process
9. Create Token Unlock
Execute: create_token_unlock
Purpose: Creates a new token unlock schedule for gradual or lump-sum token distribution.
Execute Input:
addr
string
The address that will receive the unlocked tokens
start
string (uint64)
The timestamp when the unlock schedule begins
expiration
string (uint64)
Optional timestamp when the unlock schedule expires
schedule
UnlockSchedule
Either "lump_sum" or {"linear": {"duration": uint64}}
admin
string
Optional admin address that can reclaim tokens
Note: This message must be sent with the NEPT tokens to be unlocked.
10. Set Params
Execute: set_params
Purpose: Updates the contract parameters, including emission rate and bond duration settings.
Execute Input:
emission_rate
string (uint256)
The new emission rate of NEPT tokens per year
bond_duration_settings
array
Array of duration and weight settings
Note: Cannot modify governance or reward weights for existing durations.
Last updated