Search Apps Documentation Source Content File Folder Download Copy Actions Download

emission package

Overview

Package emission manages GNS token emission and distribution for GnoSwap. The emission system controls creation and distribution of new GNS tokens with a deflationary model featuring periodic halvings over 12 years. Emission Schedule: - Year 1-2: 100% emission rate (225,000,000 GNS/year) - Year 3-4: 50% emission rate (112,500,000 GNS/year) - Year 5-6: 25% emission rate (56,250,000 GNS/year) - Year 7-8: 12.5% emission rate (28,125,000 GNS/year) - Year 9-12: 6.25% emission rate (14,062,500 GNS/year) Distribution Targets (configurable via governance): - LIQUIDITY\_STAKER: Rewards for LP providers (default 75%) - DEVOPS: Development and operations fund (default 20%) - COMMUNITY\_POOL: Community-governed treasury (default 5%) - GOV\_STAKER: GNS staking rewards (default 0%) Key Functions: - MintAndDistributeGns: Mints and distributes GNS per emission schedule - SetDistributionStartTime: One-time setup of emission start timestamp - ChangeDistributionPct: Updates distribution percentages - ClearDistributedToStaker/GovStaker: Resets pending distribution amounts

Functions

AccumulateDistributedInfo

func AccumulateDistributedInfo() (toStaker, toDevOps, toCommunityPool, toGovStaker int64)

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/emission.AccumulateDistributedInfo()"

Result

ChangeDistributionPct

func ChangeDistributionPct( cur realm, target01 int, pct01 int64, target02 int, pct02 int64, target03 int, pct03 int64, target04 int, pct04 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: - target01-04: Target identifiers (1=LIQUIDITY\_STAKER, 2=DEVOPS, 3=COMMUNITY\_POOL, 4=GOV\_STAKER) - pct01-04: Percentage in basis points (100 = 1%, 10000 = 100%) Requirements: - All four targets must be specified (use current values if unchanged) - Percentages must sum to exactly 10000 (100%) - Each percentage must be 0-10000 - Targets must be unique (no duplicates) Example: ChangeDistributionPct( 1, 7000, // 70% to liquidity stakers 2, 2000, // 20% to devops 3, 1000, // 10% to community pool 4, 0 // 0% to governance stakers ) Only callable by admin or governance.

Params

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/gnoswap/emission" -func "ChangeDistributionPct" -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" -broadcast -chainid "test11" -remote "https://rpc.test11.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.test11.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/gnoswap/emission" -func "ChangeDistributionPct" -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "test11" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.test11.testnets.gno.land" call.tx
  

ClearDistributedToGovStaker

func ClearDistributedToGovStaker(cur realm)

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

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/gnoswap/emission" -func "ClearDistributedToGovStaker" -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" -broadcast -chainid "test11" -remote "https://rpc.test11.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.test11.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/gnoswap/emission" -func "ClearDistributedToGovStaker" -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "test11" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.test11.testnets.gno.land" call.tx
  

ClearDistributedToStaker

func ClearDistributedToStaker(cur realm)

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

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/gnoswap/emission" -func "ClearDistributedToStaker" -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" -broadcast -chainid "test11" -remote "https://rpc.test11.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.test11.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/gnoswap/emission" -func "ClearDistributedToStaker" -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "test11" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.test11.testnets.gno.land" call.tx
  

GetAccuDistributedToCommunityPool

func GetAccuDistributedToCommunityPool() int64

GetAccuDistributedToCommunityPool returns the total historical GNS distributed to Community Pool.

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/emission.GetAccuDistributedToCommunityPool()"

Result

GetAccuDistributedToDevOps

func GetAccuDistributedToDevOps() int64

GetAccuDistributedToDevOps returns the total historical GNS distributed to DevOps.

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/emission.GetAccuDistributedToDevOps()"

Result

GetAccuDistributedToGovStaker

func GetAccuDistributedToGovStaker() int64

GetAccuDistributedToGovStaker returns the total historical GNS distributed to governance stakers.

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/emission.GetAccuDistributedToGovStaker()"

Result

GetAccuDistributedToStaker

func GetAccuDistributedToStaker() int64

GetAccuDistributedToStaker returns the total historical GNS distributed to liquidity stakers.

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/emission.GetAccuDistributedToStaker()"

Result

GetAllDistributionBpsPct

func GetAllDistributionBpsPct() map[int]int64

GetAllDistributionBpsPct returns all distribution percentages in basis points.

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/emission.GetAllDistributionBpsPct()"

Result

GetDistributableAmount

func GetDistributableAmount(amount, 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.

Params

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/emission.GetDistributableAmount(,)"

Result

GetDistributedToCommunityPool

func GetDistributedToCommunityPool() int64

GetDistributedToCommunityPool returns the amount of GNS distributed to Community Pool.

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/emission.GetDistributedToCommunityPool()"

Result

GetDistributedToDevOps

func GetDistributedToDevOps() int64

GetDistributedToDevOps returns accumulated GNS for DevOps.

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/emission.GetDistributedToDevOps()"

Result

GetDistributedToGovStaker

func GetDistributedToGovStaker() int64

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

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/emission.GetDistributedToGovStaker()"

Result

GetDistributedToStaker

func GetDistributedToStaker() int64

GetDistributedToStaker returns pending GNS for liquidity stakers.

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/emission.GetDistributedToStaker()"

Result

GetDistributionBpsPct

func GetDistributionBpsPct(target int) int64

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

Param

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/emission.GetDistributionBpsPct()"

Result

GetDistributionEndTimestamp

func GetDistributionEndTimestamp() int64

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

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/emission.GetDistributionEndTimestamp()"

Result

GetDistributionStartTimestamp

func GetDistributionStartTimestamp() int64

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

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/emission.GetDistributionStartTimestamp()"

Result

GetEmissionAmountPerSecondBy

func GetEmissionAmountPerSecondBy(timestamp, distributionPct int64) int64

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

Params

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/emission.GetEmissionAmountPerSecondBy(,)"

Result

GetLastExecutedTimestamp

func GetLastExecutedTimestamp() int64

GetLastExecutedTimestamp returns the timestamp of the last emission distribution execution.

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/emission.GetLastExecutedTimestamp()"

Result

GetLeftGNSAmount

func GetLeftGNSAmount() int64

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

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/emission.GetLeftGNSAmount()"

Result

GetStakerEmissionAmountPerSecond

func GetStakerEmissionAmountPerSecond() int64

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

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/emission.GetStakerEmissionAmountPerSecond()"

Result

GetStakerEmissionAmountPerSecondInRange

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

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

Params

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/emission.GetStakerEmissionAmountPerSecondInRange(,)"

Result

GetTotalAccuDistributed

func GetTotalAccuDistributed() int64

GetTotalAccuDistributed returns the total accumulated distributed GNS amount.

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/emission.GetTotalAccuDistributed()"

Result

GetTotalDistributed

func GetTotalDistributed() int64

GetTotalDistributed returns the total pending distributed GNS amount.

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/emission.GetTotalDistributed()"

Result

MintAndDistributeGns

func MintAndDistributeGns(cur realm) (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.

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/gnoswap/emission" -func "MintAndDistributeGns" -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" -broadcast -chainid "test11" -remote "https://rpc.test11.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.test11.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/gnoswap/emission" -func "MintAndDistributeGns" -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "test11" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.test11.testnets.gno.land" call.tx
  

SetDistributionStartTime

func SetDistributionStartTime(cur realm, 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.

Param

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/gnoswap/emission" -func "SetDistributionStartTime" -args $'' -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" -broadcast -chainid "test11" -remote "https://rpc.test11.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.test11.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/gnoswap/emission" -func "SetDistributionStartTime" -args $'' -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "test11" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.test11.testnets.gno.land" call.tx
  

SetOnDistributionPctChangeCallback

func SetOnDistributionPctChangeCallback(cur realm, callback func(int64))

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.

Param

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/gnoswap/emission" -func "SetOnDistributionPctChangeCallback" -args $'' -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" -broadcast -chainid "test11" -remote "https://rpc.test11.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.test11.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/gnoswap/emission" -func "SetOnDistributionPctChangeCallback" -args $'' -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "test11" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.test11.testnets.gno.land" call.tx