TIMESTAMP_90DAYS
int64Value
7776000
TIMESTAMP_180DAYS
int64Value
15552000
TIMESTAMP_365DAYS
int64Value
31536000
MAX_UNIX_EPOCH_TIME
untyped bigint// 9999-12-31 23:59:59
Value
(253402300799 <untyped> bigint)
assertIsValidAmount
func(amount int64)assertIsValidAmount ensures the amount is non-negative.
- OID
- 02d577…ffec:3
assertIsValidAmount details
assertIsValidRewardAmountFormat
func(rewardAmountStr string)assertIsValidRewardAmountFormat ensures the reward amount string is formatted as "tokenPath:amount".
- OID
- 02d577…ffec:5
assertIsValidRewardAmountFormat details
assertIsDepositor
func(s *v1.stakerV1, caller .uverse.address, positionId uint64)assertIsDepositor ensures the caller is the owner of the deposit.
- OID
- 02d577…ffec:6
assertIsDepositor details
assertIsNotStaked
func(s *v1.stakerV1, positionId uint64)assertIsNotStaked ensures the position is not already staked.
- OID
- 02d577…ffec:7
assertIsNotStaked details
assertIsPoolExists
func(s *v1.stakerV1, poolPath string)assertIsPoolExists ensures the pool exists.
- OID
- 02d577…ffec:8
assertIsPoolExists details
assertIsValidPoolTier
func(tier uint64)assertIsValidPoolTier ensures the tier is within valid range.
- OID
- 02d577…ffec:9
assertIsValidPoolTier details
assertIsGreaterThanMinimumRewardAmount
func(s *v1.stakerV1, rewardToken string, rewardAmount int64)assertIsGreaterThanMinimumRewardAmount ensures the reward amount meets minimum requirements.
- OID
- 02d577…ffec:10
assertIsGreaterThanMinimumRewardAmount details
assertIsAllowedForExternalReward
func(s *v1.stakerV1, poolPath string, tokenPath string)assertIsAllowedForExternalReward ensures the token is allowed for external rewards.
- OID
- 02d577…ffec:11
assertIsAllowedForExternalReward details
maxUnstakingFee
uint64// 10%
Value
1000
assertIsValidFeeRate
func(fee uint64)assertIsValidFeeRate ensures the fee rate is within valid range (0-1000 basis points).
- OID
- 02d577…ffec:12
assertIsValidFeeRate details
assertIsValidIncentiveStartTime
func(startTimestamp int64)assertIsValidIncentiveStartTime ensures the incentive starts at midnight of a future date.
- OID
- 02d577…ffec:13
assertIsValidIncentiveStartTime details
assertIsValidIncentiveEndTime
func(endTimestamp int64)assertIsValidIncentiveEndTime ensures the end timestamp is within valid epoch range.
- OID
- 02d577…ffec:14
assertIsValidIncentiveEndTime details
assertIsValidIncentiveDuration
func(externalDuration int64)assertIsValidIncentiveDuration ensures the duration is 90, 180, or 365 days.
- OID
- 02d577…ffec:15
assertIsValidIncentiveDuration details
assertIsValidAddress
func(addr .uverse.address)AssertIsValidAddress panics if the provided address is invalid.
- OID
- 02d577…ffec:16
assertIsValidAddress details
isMidnight
func(startTime time.Time) boolisMidnight checks if a time represents midnight (00:00:00).
- OID
- 02d577…ffec:17
isMidnight details
assertIsPositionOwner
func(owner .uverse.address, caller .uverse.address)assertIsPositionOwner validates that the caller has permission to operate the token.
- OID
- 02d577…ffec:18
assertIsPositionOwner details
Reward
typeReward is a struct for storing reward for a position. Internal reward is the GNS reward, external reward is the reward for other incentives. Penalties are the amount that is deducted from the reward due to the position's warmup.
Value
v1.Reward
CalcPositionRewardParam
typeCalcPositionRewardParam is a struct for calculating position reward
Value
v1.CalcPositionRewardParam
getInitialCollectTime
func(deposit *staker.Deposit, incentive *staker.ExternalIncentive) int64getInitialCollectTime determines the initial collection time for an incentive by taking the maximum of the deposit's stake time and the incentive's start time. This ensures rewards are only calculated from when both conditions are met: - The position must be staked (deposit.stakeTime) - The incentive must be active (incentive.startTimestamp) This function is used for lazy initialization when a position collects from an incentive for the first time, avoiding the need to iterate through all deposits when a new incentive is created.
- OID
- 02d577…ffec:19
getInitialCollectTime details
GNS_TOKEN_KEY
stringValue
"gno.land/r/gnoswap/gns.GNS"
WUGNOT_TOKEN_KEY
stringValue
"gno.land/r/gnoland/wugnot.wugnot"
emitSetPoolTier
func(prevAddr string, prevRealm string, poolPath string, tier uint64, rewardPerSecond int64, tierRewards map[uint64]int64, counts [4]uint64, currentTime int64)- OID
- 02d577…ffec:21
emitSetPoolTier details
errNoPermission
untyped stringValue
"[GNOSWAP-STAKER-001] caller has no permission"
errPoolNotFound
untyped stringValue
"[GNOSWAP-STAKER-002] pool not found"
errNotAvailableUpdateCollectTime
untyped stringValue
"[GNOSWAP-STAKER-003] not available to update collect time"
errInvalidInput
untyped stringValue
"[GNOSWAP-STAKER-004] invalid input data"
errInvalidUnstakingFee
untyped stringValue
"[GNOSWAP-STAKER-005] invalid unstaking fee"
errAlreadyStaked
untyped stringValue
"[GNOSWAP-STAKER-006] already staked position"
errNonIncentivizedPool
untyped stringValue
"[GNOSWAP-STAKER-007] pool is not incentivized"
errCannotEndIncentive
untyped stringValue
"[GNOSWAP-STAKER-008] cannot end incentive"
errInvalidIncentiveStartTime
untyped stringValue
"[GNOSWAP-STAKER-009] invalid incentive start time"
errDefaultExternalToken
untyped stringValue
"[GNOSWAP-STAKER-010] cannot delete default external token"
errInvalidPoolPath
untyped stringValue
"[GNOSWAP-STAKER-011] invalid pool path"
errInvalidPoolTier
untyped stringValue
"[GNOSWAP-STAKER-012] invalid pool tier"
errDataNotFound
untyped stringValue
"[GNOSWAP-STAKER-013] requested data not found"
errCalculationError
untyped stringValue
"[GNOSWAP-STAKER-014] unexpected calculation error"
errZeroLiquidity
untyped stringValue
"[GNOSWAP-STAKER-015] zero liquidity"
errInvalidIncentiveDuration
untyped stringValue
"[GNOSWAP-STAKER-016] invalid incentive duration"
errNotAllowedForExternalReward
untyped stringValue
"[GNOSWAP-STAKER-017] not allowed for external reward"
errIncentiveAlreadyExists
untyped stringValue
"[GNOSWAP-STAKER-018] incentive already exists"
errOverflow
untyped stringValue
"[GNOSWAP-STAKER-019] overflow"
errAddExistingToken
untyped stringValue
"[GNOSWAP-STAKER-020] cannot add existing token"
errInvalidAddress
untyped stringValue
"[GNOSWAP-STAKER-021] invalid address"
errIsNotEndedIncentive
untyped stringValue
"[GNOSWAP-STAKER-022] incentive is not ended yet"
errSpoofedRealm
untyped stringValue
"[GNOSWAP-STAKER-023] rlm does not match the current crossing frame"
makeErrorWithDetails
func(message string, details string) .uverse.error- OID
- 02d577…ffec:23
makeErrorWithDetails details
tickCrossEventInfo
typeValue
v1.tickCrossEventInfo
NewTickCrossEventInfo
func(tickID int32, stakedLiquidityGross *uint256.Uint, stakedLiquidityDelta *int256.Int, outsideAccumulation *uint256.Uint) *v1.tickCrossEventInfo- OID
- 02d577…ffec:25
NewTickCrossEventInfo details
checkCannotAddDefaultToken
func(tokenPath string) .uverse.error- OID
- 02d577…ffec:27
checkCannotAddDefaultToken details
checkCannotRemoveDefaultToken
func(tokenPath string) .uverse.error- OID
- 02d577…ffec:29
checkCannotRemoveDefaultToken details
defaultDepositGnsAmount
int64Value
1000000000
defaultMinimumRewardAmount
int64Value
1000000000
defaultUnstakingFee
uint64// 1%
Value
100
defaultInitialPoolTierPath
untyped stringValue
"gno.land/r/gnoland/wugnot.wugnot:gno.land/r/gnoswap/gns.GNS:3000"
init.58
func()- OID
- 02d577…ffec:30
init.58 details
registerStakerV1
func()- OID
- 02d577…ffec:32
registerStakerV1 details
initStoreData
func(int, rlm .uverse.realm, stakerStore staker.IStakerStore, emissionAccessor staker.EmissionAccessor) .uverse.error- OID
- 02d577…ffec:33
initStoreData details
initializePoolTier
func(stakerStore staker.IStakerStore) (*v1.PoolTier, *v1.Pools, int64, map[uint64]int64)- OID
- 02d577…ffec:34
initializePoolTier details
stakerV1
typeValue
v1.stakerV1
NewStakerV1
func(stakerStore staker.IStakerStore, poolAccessor staker.PoolAccessor, emissionAccessor staker.EmissionAccessor, nftAccessor staker.NFTAccessor) *v1.stakerV1- OID
- 02d577…ffec:35
NewStakerV1 details
NOT_EMISSION_TARGET_TIER
uint64Value
0
pctToIndex
func(pct int64) intpctToIndex converts percentage to warmup index.
- OID
- 02d577…ffec:37
pctToIndex details
IncentivesResolver
typeValue
v1.IncentivesResolver
NewIncentivesResolver
func(incentives *staker.Incentives) *v1.IncentivesResolver- OID
- 02d577…ffec:39
NewIncentivesResolver details
retrieveIncentive
func(tree *v0.BPTree, id string) (*staker.ExternalIncentive, bool)- OID
- 02d577…ffec:41
retrieveIncentive details
calculateUnClaimableDuration
func(unclaimableStart int64, unclaimableEnd int64, incentiveStartTimestamp int64, incentiveEndTimestamp int64) int64calculateUnClaimableDuration calculates the duration of overlap between an unclaimable period and incentive period
- OID
- 02d577…ffec:42
calculateUnClaimableDuration details
q128
*uint256.Uint- OID
- 02d577…ffec:44
q128 details
Pools
typePools represents the global pool storage
Value
v1.Pools
NewPools
func() *v1.Pools- OID
- 02d577…ffec:46
NewPools details
PoolResolver
typeValue
v1.PoolResolver
NewPoolResolver
func(pool *staker.Pool) *v1.PoolResolverNewPool creates a new pool with the given poolPath and currentHeight.
- OID
- 02d577…ffec:48
NewPoolResolver details
RewardState
typeRewardState is a struct for storing the intermediate state for reward calculation.
Value
v1.RewardState
AllTierCount
untyped bigint// 0, 1, 2, 3
Value
(4 <untyped> bigint)
Tier1
untyped bigintValue
(1 <untyped> bigint)
Tier2
untyped bigintValue
(2 <untyped> bigint)
Tier3
untyped bigintValue
(3 <untyped> bigint)
TierRatioFromCounts
func(tier1Count uint64, tier2Count uint64, tier3Count uint64) staker.TierRatioTierRatioFromCounts calculates the ratio distribution for each tier based on pool counts. Parameters: - tier1Count (uint64): Number of pools in tier 1. - tier2Count (uint64): Number of pools in tier 2. - tier3Count (uint64): Number of pools in tier 3. Returns: - TierRatio: The ratio distribution across tier 1, 2, and 3, scaled up by 100.
- OID
- 02d577…ffec:49
TierRatioFromCounts details
PoolTier
typePoolTier manages pool counts, ratios, and rewards for different tiers. Fields: - membership: Tracks which tier a pool belongs to (poolPath -> blockNumber -> tier). Methods: - CurrentCount: Returns the current count of pools in a tier at a specific timestamp. - CurrentRatio: Returns the current ratio for a tier at a specific timestamp. - CurrentTier: Returns the tier of a specific pool at a given timestamp. - CurrentReward: Retrieves the reward for a tier at a specific timestamp. - changeTier: Updates the tier of a pool and recalculates ratios.
Value
v1.PoolTier
NewPoolTier
func(pools *v1.Pools, currentTime int64, initialPoolPath string, getEmission func(...), getHalvingBlocksInRange func(...)) *v1.PoolTierNewPoolTier creates a new PoolTier instance with single initial 1 tier pool. Parameters: - pools: The pool collection. - currentTime: The current block time. - initialPoolPath: The path of the initial pool. - getEmission: A function that returns the current emission to the staker contract. - getHalvingBlocksInRange: A function that returns a list of halving blocks within the interval \[start, end) in ascending order. Returns: - \*PoolTier: The new PoolTier instance.
- OID
- 02d577…ffec:51
NewPoolTier details
NewPoolTierBy
func(membership *v0.BPTree, tierRatio staker.TierRatio, counts [4]uint64, lastRewardCacheTimestamp int64, currentEmission int64, getEmission func(...), getHalvingBlocksInRange func(...)) *v1.PoolTier- OID
- 02d577…ffec:52
NewPoolTierBy details
calculatePoolReward
func(emission int64, tierRatio int64, tierCount int64) int64calculatePoolReward calculates the reward for a pool based on the emission, tier ratio, and tier count. Parameters: - emission: The emission for the pool. - tierRatio: The tier ratio for the pool. - tierCount: The tier count for the pool. Returns: - int64: The reward for the pool.
- OID
- 02d577…ffec:53
calculatePoolReward details
TickResolver
typeValue
v1.TickResolver
NewTickResolver
func(tick *staker.Tick) *v1.TickResolver- OID
- 02d577…ffec:54
NewTickResolver details
EncodeUint
func(num uint64) stringEncodeUint converts a uint64 number into a zero-padded 20-character string. Parameters: - num (uint64): The number to encode. Returns: - string: A zero-padded string representation of the number. Example: Input: 12345 Output: "00000000000000012345"
- OID
- 02d577…ffec:56
EncodeUint details
EncodeInt64
func(num int64) string- OID
- 02d577…ffec:58
EncodeInt64 details
DecodeUint
func(s string) uint64DecodeUint converts a zero-padded string back into a uint64 number. Parameters: - s (string): The zero-padded string. Returns: - uint64: The decoded number. Panics: - If the string cannot be parsed into a uint64. Example: Input: "00000000000000012345" Output: 12345
- OID
- 02d577…ffec:59
DecodeUint details
DecodeInt64
func(s string) int64- OID
- 02d577…ffec:60
DecodeInt64 details
maxDurationOneYear
int64// 31,536,000 seconds
Value
31536000
modifyWarmup
func(warmupTemplate []staker.Warmup, index int, timeDuration int64) []staker.Warmupexpected to be called by governance
- OID
- 02d577…ffec:61
modifyWarmup details
instantiateWarmup
func(warmupTemplate []staker.Warmup, currentTime int64) []staker.Warmup- OID
- 02d577…ffec:63
instantiateWarmup details
applyWarmup
func(warmup staker.Warmup, poolReward int64, positionLiquidity *uint256.Uint, stakedLiquidity *uint256.Uint) (int64, int64)applyWarmup applies the warmup to the rewards and calculate penalties.
- OID
- 02d577…ffec:64
applyWarmup details
safeAddTime
func(currentTime int64, duration int64) int64safeAddTime performs safe addition with overflow protection
- OID
- 02d577…ffec:65
safeAddTime details
ZERO_ADDRESS
.uverse.addressValue
<gnolang.StringValue>
Deposits
typeDeposits manages all staked positions.
Value
v1.Deposits
NewDeposits
func() *v1.DepositsNewDeposits creates a new Deposits instance.
- OID
- 02d577…ffec:66
NewDeposits details
retrieveDeposit
func(data interface{...}) *staker.DepositretrieveDeposit safely casts data to Deposit type.
- OID
- 02d577…ffec:68
retrieveDeposit details
ExternalIncentives
typeExternalIncentives manages external incentive programs.
Value
v1.ExternalIncentives
NewExternalIncentives
func() *v1.ExternalIncentivesNewExternalIncentives creates a new ExternalIncentives instance.
- OID
- 02d577…ffec:69
NewExternalIncentives details
tokenHasLiquidity
func(positionId uint64) .uverse.errortokenHasLiquidity checks if the target positionId has non-zero liquidity
- OID
- 02d577…ffec:70
tokenHasLiquidity details
getLiquidity
func(positionId uint64) *uint256.Uint- OID
- 02d577…ffec:71
getLiquidity details
getTickOf
func(positionId uint64) (int32, int32)- OID
- 02d577…ffec:72
getTickOf details
ExternalIncentiveResolver
typeValue
v1.ExternalIncentiveResolver
NewExternalIncentiveResolver
func(externalIncentive *staker.ExternalIncentive) *v1.ExternalIncentiveResolverNewExternalIncentive creates a new external incentive
- OID
- 02d577…ffec:73
NewExternalIncentiveResolver details
DepositResolver
typeValue
v1.DepositResolver
NewDepositResolver
func(deposit *staker.Deposit) *v1.DepositResolver- OID
- 02d577…ffec:75
NewDepositResolver details
poolPathDivide
func(poolPath string) (string, string, string)poolPathDivide splits a pool path into token addresses and fee tier.
- OID
- 02d577…ffec:76
poolPathDivide details
positionIdFrom
func(positionId uint64) grc721.TokenIDpositionIdFrom converts a uint64 position ID to grc721.TokenID.
- OID
- 02d577…ffec:78
positionIdFrom details
contains
func(slice []string, item string) boolcontains checks if a string exists in a slice.
- OID
- 02d577…ffec:79