Search Apps Documentation Source Content File Folder Download Copy Actions Download State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

emission state

Back to all declarations

assertValidDistributionTarget

func(target int)

assertValidDistributionTarget panics if the given distribution target is invalid.

Open
OID
0e7aa4…52b8:3
assertValidDistributionTarget details

Inspect func

assertValidDistributionPct

func(liquidityStakerPct int64, devOpsPct int64, communityPoolPct int64, govStakerPct int64)

assertValidDistributionPct ensures the sum of all distribution percentages equals 10000 (100%). Panics if the sum does not equal exactly 10000 basis points.

Open
OID
0e7aa4…52b8:5
assertValidDistributionPct details

Inspect func

LIQUIDITY_STAKER

int

Value

1

DEVOPS

int

Value

2

COMMUNITY_POOL

int

Value

3

GOV_STAKER

int

Value

4

distributionBpsPct

map[int]int64
Open
OID
0e7aa4…52b8:65
distributionBpsPct details

Inspect map

distributedToStaker

int64

// can be cleared by staker contract

Value

172410098073

distributedToDevOps

int64

Value

45976026114

distributedToCommunityPool

int64

Value

11494006472

distributedToGovStaker

int64

// can be cleared by governance staker

Value

0

accuDistributedToStaker

int64

Value

172410098073

accuDistributedToDevOps

int64

Value

45976026114

accuDistributedToCommunityPool

int64

Value

11494006472

accuDistributedToGovStaker

int64

Value

0

ChangeDistributionPct

func(liquidityStakerPct int64, devOpsPct int64, communityPoolPct int64, govStakerPct int64)

ChangeDistributionPct changes distribution percentages for emission targets. This function redistributes how newly minted GNS tokens are allocated across protocol components. Before applying new ratios, it distributes any accumulated emissions using the current ratios, ensuring emissions are distributed according to the ratios in effect when they were generated. This prevents retroactive application of new ratios to past emissions. Parameters: - liquidityStakerPct: Percentage for liquidity stakers in basis points (100 = 1%, 10000 = 100%) - devOpsPct: Percentage for devops in basis points - communityPoolPct: Percentage for community pool in basis points - govStakerPct: Percentage for governance stakers in basis points Requirements: - Percentages must sum to exactly 10000 (100%) - Each percentage must be 0-10000 Example: ChangeDistributionPct( 7000, // 70% to liquidity stakers 2000, // 20% to devops 1000, // 10% to community pool 0, // 0% to governance stakers ) Only callable by admin or governance.

Open
OID
0e7aa4…52b8:17
ChangeDistributionPct details

Inspect func

changeDistributionPcts

func(liquidityStakerPct int64, devOpsPct int64, communityPoolPct int64, govStakerPct int64)

changeDistributionPcts updates the distribution percentages for all targets.

Open
OID
0e7aa4…52b8:18
changeDistributionPcts details

Inspect func

calculateDistributableAmounts

func(amount int64) (map[int]int64, int64)
Open
OID
0e7aa4…52b8:19
calculateDistributableAmounts details

Inspect func

calculateAmount

func(amount int64, bptPct int64) int64

calculateAmount converts basis points to actual token amount.

Open
OID
0e7aa4…52b8:20
calculateAmount details

Inspect func

applyDistribution

func(targets map[int]int64) (map[.uverse.address]int64, .uverse.error)
Open
OID
0e7aa4…52b8:21
applyDistribution details

Inspect func

transferToTarget

func(int, rlm .uverse.realm, targets map[.uverse.address]int64) .uverse.error
Open
OID
0e7aa4…52b8:22
transferToTarget details

Inspect func

GetDistributionBpsPct

func(target int) int64

GetDistributionBpsPct returns the distribution percentage in basis points for a specific target.

Open
OID
0e7aa4…52b8:23
GetDistributionBpsPct details

Inspect func

GetDistributedToStaker

func() int64

GetDistributedToStaker returns pending GNS for liquidity stakers.

Open
OID
0e7aa4…52b8:24
GetDistributedToStaker details

Inspect func

GetDistributedToDevOps

func() int64

GetDistributedToDevOps returns accumulated GNS for DevOps.

Open
OID
0e7aa4…52b8:25
GetDistributedToDevOps details

Inspect func

GetDistributedToCommunityPool

func() int64

GetDistributedToCommunityPool returns the amount of GNS distributed to Community Pool.

Open
OID
0e7aa4…52b8:26
GetDistributedToCommunityPool details

Inspect func

GetDistributedToGovStaker

func() int64

GetDistributedToGovStaker returns the amount of GNS distributed to governance stakers since last clear.

Open
OID
0e7aa4…52b8:27
GetDistributedToGovStaker details

Inspect func

AccumulateDistributedInfo

func() (toStaker int64, toDevOps int64, toCommunityPool int64, toGovStaker int64)
Open
OID
0e7aa4…52b8:28
AccumulateDistributedInfo details

Inspect func

GetAccuDistributedToStaker

func() int64

GetAccuDistributedToStaker returns the total historical GNS distributed to liquidity stakers.

Open
OID
0e7aa4…52b8:29
GetAccuDistributedToStaker details

Inspect func

GetAccuDistributedToDevOps

func() int64

GetAccuDistributedToDevOps returns the total historical GNS distributed to DevOps.

Open
OID
0e7aa4…52b8:30
GetAccuDistributedToDevOps details

Inspect func

GetAccuDistributedToCommunityPool

func() int64

GetAccuDistributedToCommunityPool returns the total historical GNS distributed to Community Pool.

Open
OID
0e7aa4…52b8:31
GetAccuDistributedToCommunityPool details

Inspect func

GetAccuDistributedToGovStaker

func() int64

GetAccuDistributedToGovStaker returns the total historical GNS distributed to governance stakers.

Open
OID
0e7aa4…52b8:32
GetAccuDistributedToGovStaker details

Inspect func

GetEmissionAmountPerSecondBy

func(timestamp int64, distributionPct int64) int64

GetEmissionAmountPerSecondBy returns the emission amount per second for a given timestamp and distribution percentage.

Open
OID
0e7aa4…52b8:33
GetEmissionAmountPerSecondBy details

Inspect func

GetStakerEmissionAmountPerSecond

func() int64

GetStakerEmissionAmountPerSecond returns the current per-second emission amount allocated to liquidity stakers.

Open
OID
0e7aa4…52b8:34
GetStakerEmissionAmountPerSecond details

Inspect func

GetStakerEmissionAmountPerSecondInRange

func(start int64, end int64) ([]int64, []int64)

GetStakerEmissionAmountPerSecondInRange returns emission amounts allocated to liquidity stakers for a time range.

Open
OID
0e7aa4…52b8:35
GetStakerEmissionAmountPerSecondInRange details

Inspect func

ClearDistributedToStaker

func()

ClearDistributedToStaker resets the pending distribution amount for liquidity stakers. Only callable by staker contract.

Open
OID
0e7aa4…52b8:36
ClearDistributedToStaker details

Inspect func

ClearDistributedToGovStaker

func()

ClearDistributedToGovStaker resets the pending distribution amount for governance stakers. Only callable by governance staker contract.

Open
OID
0e7aa4…52b8:37
ClearDistributedToGovStaker details

Inspect func

setDistributionBpsPct

func(target int, pct int64)

setDistributionBpsPct changes percentage of each target for how much GNS it will get by emission. Creates new map if nil.

Open
OID
0e7aa4…52b8:38
setDistributionBpsPct details

Inspect func

targetToStr

func(target int) string

targetToStr converts target constant to string representation.

Open
OID
0e7aa4…52b8:39
targetToStr details

Inspect func

totalDistributionDuration

untyped bigint

// 12 years

Value

(378432000 <untyped> bigint)

leftGNSAmount

int64

Value

1

lastExecutedTimestamp

int64

Value

1784987157

emissionAddr

.uverse.address

Value

<gnolang.StringValue>

distributionStartTimestamp

int64

Value

1784954938

onDistributionPctChangeCallback

func(emissionAmountPerSecond int64)
Open
OID
0742c3…b8af:250
onDistributionPctChangeCallback details

Inspect func

setLeftGNSAmount

func(amount int64)

setLeftGNSAmount updates the undistributed GNS token amount

Open
OID
0e7aa4…52b8:47
setLeftGNSAmount details

Inspect func

setLastExecutedTimestamp

func(timestamp int64)

setLastExecutedTimestamp updates the timestamp of the last emission distribution execution.

Open
OID
0e7aa4…52b8:48
setLastExecutedTimestamp details

Inspect func

MintAndDistributeGns

func() (int64, bool)

MintAndDistributeGns mints and distributes GNS tokens according to the emission schedule. This function is called automatically by protocol contracts during user interactions to trigger periodic GNS emission. It mints new tokens based on elapsed time since last distribution and distributes them to predefined targets (staker, devops, etc.). Returns: - int64: Total amount of GNS distributed in this call Note: Distribution only occurs if start timestamp is set and reached. Any undistributed tokens from previous calls are carried forward.

Open
OID
0e7aa4…52b8:49
MintAndDistributeGns details

Inspect func

SetDistributionStartTime

func(startTimestamp int64)

SetDistributionStartTime sets the timestamp when emission distribution starts. This function controls when GNS emission begins. Once set and reached, the protocol starts minting GNS tokens according to the emission schedule. The timestamp can only be set before distribution starts - it becomes immutable once active. Parameters: - startTimestamp: Unix timestamp when emission should begin Requirements: - Must be called before distribution starts (one-time setup) - Timestamp must be in the future - Cannot be negative Effects: - Sets global distribution start time - Initializes GNS emission state if not already started - Emission begins automatically when timestamp is reached Only callable by admin or governance.

Open
OID
0e7aa4…52b8:50
SetDistributionStartTime details

Inspect func

SetOnDistributionPctChangeCallback

func(callback func(...))

SetOnDistributionPctChangeCallback sets a callback function to be called when distribution percentages change. This allows external contracts (like staker) to update their internal caches when governance changes emission rates. Only callable by the staker contract.

Open
OID
0e7aa4…52b8:51
SetOnDistributionPctChangeCallback details

Inspect func

errInvalidEmissionTarget

untyped string

Value

"[GNOSWAP-EMISSION-001] invalid emission target"

errInvalidEmissionPct

untyped string

Value

"[GNOSWAP-EMISSION-002] invalid emission percentage"

errDuplicateTarget

untyped string

Value

"[GNOSWAP-EMISSION-003] duplicate emission target"

errDistributionAddressNotFound

untyped string

Value

"[GNOSWAP-EMISSION-004] distribution address not found"

makeErrorWithDetails

func(message string, detail string) .uverse.error

makeErrorWithDetails creates a new error by combining a base error with additional details.

Open
OID
0e7aa4…52b8:52
makeErrorWithDetails details

Inspect func

GetLeftGNSAmount

func() int64

GetLeftGNSAmount returns the amount of undistributed GNS tokens from previous distributions.

Open
OID
0e7aa4…52b8:54
GetLeftGNSAmount details

Inspect func

GetDistributionStartTimestamp

func() int64

GetDistributionStartTimestamp returns the timestamp when emission distribution started. Returns 0 if distribution has not been started yet.

Open
OID
0e7aa4…52b8:56
GetDistributionStartTimestamp details

Inspect func

GetLastExecutedTimestamp

func() int64

GetLastExecutedTimestamp returns the timestamp of the last emission distribution execution.

Open
OID
0e7aa4…52b8:57
GetLastExecutedTimestamp details

Inspect func

GetAllDistributionBpsPct

func() map[int]int64

GetAllDistributionBpsPct returns all distribution percentages in basis points.

Open
OID
0e7aa4…52b8:58
GetAllDistributionBpsPct details

Inspect func

GetTotalAccuDistributed

func() int64

GetTotalAccuDistributed returns the total accumulated distributed GNS amount.

Open
OID
0e7aa4…52b8:59
GetTotalAccuDistributed details

Inspect func

GetTotalDistributed

func() int64

GetTotalDistributed returns the total pending distributed GNS amount.

Open
OID
0e7aa4…52b8:60
GetTotalDistributed details

Inspect func

GetDistributionEndTimestamp

func() int64

GetDistributionEndTimestamp returns the timestamp when emission distribution ends. Returns 0 if distribution has not been started yet.

Open
OID
0e7aa4…52b8:61
GetDistributionEndTimestamp details

Inspect func

GetDistributableAmount

func(amount int64, timestamp int64) (map[int]int64, int64)

GetDistributableAmount returns distribution amounts by target and the remainder. If timestamp is outside the distribution window, it returns an empty map and the full amount as left.

Open
OID
0e7aa4…52b8:62
GetDistributableAmount details

Inspect func
assertValidDistributionTarget : func(target int) Inspect
assertValidDistributionPct : func(liquidityStakerPct int64, devOpsPct int64, communityPoolPct int64, govStakerPct int64) Inspect
LIQUIDITY_STAKER : int =1
DEVOPS : int =2
COMMUNITY_POOL : int =3
GOV_STAKER : int =4
distributionBpsPct : map[int]int64 Inspect
distributedToStaker : int64 =172410098073
distributedToDevOps : int64 =45976026114
distributedToCommunityPool : int64 =11494006472
distributedToGovStaker : int64 =0
accuDistributedToStaker : int64 =172410098073
accuDistributedToDevOps : int64 =45976026114
accuDistributedToCommunityPool : int64 =11494006472
accuDistributedToGovStaker : int64 =0
init.15 : func() Inspect
ChangeDistributionPct : func(liquidityStakerPct int64, devOpsPct int64, communityPoolPct int64, govStakerPct int64) Inspect
changeDistributionPcts : func(liquidityStakerPct int64, devOpsPct int64, communityPoolPct int64, govStakerPct int64) Inspect
calculateDistributableAmounts : func(amount int64) (map[int]int64, int64) Inspect
calculateAmount : func(amount int64, bptPct int64) int64 Inspect
applyDistribution : func(targets map[int]int64) (map[.uverse.address]int64, .uverse.error) Inspect
transferToTarget : func(int, rlm .uverse.realm, targets map[.uverse.address]int64) .uverse.error Inspect
GetDistributionBpsPct : func(target int) int64 Inspect
GetDistributedToStaker : func() int64 Inspect
GetDistributedToDevOps : func() int64 Inspect
GetDistributedToCommunityPool : func() int64 Inspect
GetDistributedToGovStaker : func() int64 Inspect
AccumulateDistributedInfo : func() (toStaker int64, toDevOps int64, toCommunityPool int64, toGovStaker int64) Inspect
GetAccuDistributedToStaker : func() int64 Inspect
GetAccuDistributedToDevOps : func() int64 Inspect
GetAccuDistributedToCommunityPool : func() int64 Inspect
GetAccuDistributedToGovStaker : func() int64 Inspect
GetEmissionAmountPerSecondBy : func(timestamp int64, distributionPct int64) int64 Inspect
GetStakerEmissionAmountPerSecond : func() int64 Inspect
GetStakerEmissionAmountPerSecondInRange : func(start int64, end int64) ([]int64, []int64) Inspect
ClearDistributedToStaker : func() Inspect
ClearDistributedToGovStaker : func() Inspect
setDistributionBpsPct : func(target int, pct int64) Inspect
targetToStr : func(target int) string Inspect
totalDistributionDuration : untyped bigint =(378432000 <untyped> bigint)
leftGNSAmount : int64 =1
lastExecutedTimestamp : int64 =1784987157
emissionAddr : .uverse.address =<gnolang.StringValue>
distributionStartTimestamp : int64 =1784954938
onDistributionPctChangeCallback : func(emissionAmountPerSecond int64) Inspect
init.45 : func() Inspect
setLeftGNSAmount : func(amount int64) Inspect
setLastExecutedTimestamp : func(timestamp int64) Inspect
MintAndDistributeGns : func() (int64, bool) Inspect
SetDistributionStartTime : func(startTimestamp int64) Inspect
SetOnDistributionPctChangeCallback : func(callback func(...)) Inspect
errInvalidEmissionTarget : untyped string ="[GNOSWAP-EMISSION-001] invalid emission target"
errInvalidEmissionPct : untyped string ="[GNOSWAP-EMISSION-002] invalid emission percentage"
errDuplicateTarget : untyped string ="[GNOSWAP-EMISSION-003] duplicate emission target"
errDistributionAddressNotFound : untyped string ="[GNOSWAP-EMISSION-004] distribution address not found"
makeErrorWithDetails : func(message string, detail string) .uverse.error Inspect
GetLeftGNSAmount : func() int64 Inspect
GetDistributionStartTimestamp : func() int64 Inspect
GetLastExecutedTimestamp : func() int64 Inspect
GetAllDistributionBpsPct : func() map[int]int64 Inspect
GetTotalAccuDistributed : func() int64 Inspect
GetTotalDistributed : func() int64 Inspect
GetDistributionEndTimestamp : func() int64 Inspect
GetDistributableAmount : func(amount int64, timestamp int64) (map[int]int64, int64) Inspect