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

gns state

Back to all declarations

SECONDS_IN_YEAR

untyped bigint

Value

(31536000 <untyped> bigint)

HALVING_START_YEAR

int64

Value

1

HALVING_END_YEAR

int64

Value

12

halvingAmountsPerYear

[12]int64

MUST BE IMMUTABLE, DO NOT MODIFY. Annual halving amount - maximum issuance per year

Open
OID
0d2890…5437:4
halvingAmountsPerYear details

Inspect array

InitEmissionState

func(createdHeight int64, startTimestamp int64)

InitEmissionState initializes the emission schedule. It creates the 12-year schedule with two-year halving periods. Parameters: - cur: Current realm context; callers use cross(cur) when crossing into this realm. - createdHeight: block height when the schedule is initialized - startTimestamp: Unix timestamp when emission begins Only callable by the emission contract.

Open
OID
0d2890…5437:5
InitEmissionState details

Inspect func

EmissionState

type

EmissionState manages emission state and halving data. Tracks emission timing, status, and halving year information for 12-year schedule.

Value

gns.EmissionState

NewEmissionState

func(createdHeight int64, startTimestamp int64) *gns.EmissionState

NewEmissionState creates an emission state and its 12-year halving schedule. Parameters: - createdHeight: blockchain height recorded as the schedule's creation height. - startTimestamp: Unix timestamp at which the first halving year begins. Returns: - state: newly allocated emission state with an end timestamp and initialized halving data.

Open
OID
0d2890…5437:10
NewEmissionState details

Inspect func

getEmissionState

func() *gns.EmissionState

getEmissionState returns the singleton emission state instance.

Open
OID
0d2890…5437:11
getEmissionState details

Inspect func

errInvalidYear

untyped string

Value

"[GNOSWAP-GNS-001] invalid year"

errTooManyEmission

untyped string

Value

"[GNOSWAP-GNS-002] too many emission reward"

errInvalidEmissionAmount

untyped string

Value

"[GNOSWAP-GNS-003] invalid emission amount"

makeErrorWithDetails

func(message string, details string) .uverse.error
Open
OID
0d2890…5437:12
makeErrorWithDetails details

Inspect func

GetMaxEmissionAmount

func() int64

GetMaxEmissionAmount returns the configured lifetime GNS emission cap in base units. Returns: - maxAmount: maximum number of GNS base units available for emission

Open
OID
0d2890…5437:14
GetMaxEmissionAmount details

Inspect func

GetMaximumSupply

func() int64

GetMaximumSupply returns the maximum possible GNS token supply in base units. Returns: - maximumSupply: configured total supply cap, including the initial mint and emissions

Open
OID
0d2890…5437:16
GetMaximumSupply details

Inspect func

GetInitialMintAmount

func() int64

GetInitialMintAmount returns the initial GNS allocation minted before emissions. Returns: - initialAmount: number of GNS base units in the initial mint

Open
OID
0d2890…5437:17
GetInitialMintAmount details

Inspect func

IsEmissionInitialized

func() bool

IsEmissionInitialized reports whether the emission state has non-zero creation height and start timestamp. Returns: - initialized: true when both initialization fields are set; false otherwise

Open
OID
0d2890…5437:18
IsEmissionInitialized details

Inspect func

IsEmissionActive

func() bool

IsEmissionActive reports whether emission is initialized and the current Unix time lies within the inclusive emission schedule. Returns: - active: true during the configured schedule, including its endpoints; false otherwise

Open
OID
0d2890…5437:19
IsEmissionActive details

Inspect func

IsEmissionEnded

func() bool

IsEmissionEnded reports whether the current Unix time is after the emission end timestamp. Returns: - ended: true after the configured schedule's end; false at or before that timestamp

Open
OID
0d2890…5437:20
IsEmissionEnded details

Inspect func

GetHalvingYear

func(timestamp int64) int64

GetHalvingYear returns the halving year containing timestamp. Parameters: - timestamp: Unix timestamp to classify against the inclusive 12-year emission schedule Returns: - year: halving year in \[1, 12], or 0 when timestamp is before the start or after the end

Open
OID
0d2890…5437:21
GetHalvingYear details

Inspect func

GetCurrentYear

func() int64

GetCurrentYear returns the halving year containing the current Unix time. Returns: - year: current halving year in \[1, 12], or 0 when the current time is outside the schedule

Open
OID
0d2890…5437:22
GetCurrentYear details

Inspect func

GetEmissionAmountPerSecondInRange

func(fromTime int64, toTime int64) ([]int64, []int64)

GetEmissionAmountPerSecondInRange returns paired emission-rate change points whose timestamps fall within the requested range. Parameters: - fromTime: inclusive Unix timestamp lower bound - toTime: inclusive Unix timestamp upper bound; a lower value yields nil slices Returns: - timestamps: schedule timestamps in the range where the rate changes, including the post-end zero-rate point when applicable - amounts: GNS base units emitted per second at each corresponding timestamp; same length and order as timestamps

Open
OID
0d2890…5437:23
GetEmissionAmountPerSecondInRange details

Inspect func

GetEmissionAmountPerSecondByTimestamp

func(timestamp int64) int64

GetEmissionAmountPerSecondByTimestamp returns the configured GNS emission rate for the halving year containing timestamp. Parameters: - timestamp: Unix timestamp whose schedule rate is queried Returns: - amount: GNS base units emitted per second for timestamp's halving year, or 0 outside the schedule

Open
OID
0d2890…5437:24
GetEmissionAmountPerSecondByTimestamp details

Inspect func

GetEmissionLeftAmountByTimestamp

func(timestamp int64) int64

GetEmissionLeftAmountByTimestamp returns the stored unminted allocation for the halving year containing timestamp. Parameters: - timestamp: Unix timestamp used to select a halving year Returns: - amount: remaining GNS base units recorded for that halving year, or 0 outside the schedule

Open
OID
0d2890…5437:25
GetEmissionLeftAmountByTimestamp details

Inspect func

GetEmissionAccumulatedAmountByTimestamp

func(timestamp int64) int64

GetEmissionAccumulatedAmountByTimestamp returns the stored minted allocation for the halving year containing timestamp. Parameters: - timestamp: Unix timestamp used to select a halving year Returns: - amount: minted GNS base units recorded for that halving year, or 0 outside the schedule

Open
OID
0d2890…5437:26
GetEmissionAccumulatedAmountByTimestamp details

Inspect func

GetHalvingYearStartTimestamp

func(year int64) int64

GetHalvingYearStartTimestamp returns the inclusive start Unix timestamp for a configured halving year. Parameters: - year: halving year number in \[1, 12] Returns: - timestamp: inclusive start timestamp for year, or 0 when year is invalid

Open
OID
0d2890…5437:27
GetHalvingYearStartTimestamp details

Inspect func

GetHalvingYearEndTimestamp

func(year int64) int64

GetHalvingYearEndTimestamp returns the inclusive end Unix timestamp for a configured halving year. Parameters: - year: halving year number in \[1, 12] Returns: - timestamp: inclusive end timestamp for year, or 0 when year is invalid

Open
OID
0d2890…5437:28
GetHalvingYearEndTimestamp details

Inspect func

GetHalvingYearMaxAmount

func(year int64) int64

GetHalvingYearMaxAmount returns the maximum GNS allocation for a halving year. Parameters: - year: halving year number in \[1, 12] Returns: - amount: maximum GNS base units allocated to year, or 0 when year is invalid

Open
OID
0d2890…5437:29
GetHalvingYearMaxAmount details

Inspect func

GetHalvingYearLeftAmount

func(year int64) int64

GetHalvingYearLeftAmount returns the remaining GNS allocation recorded for a halving year. Parameters: - year: halving year number in \[1, 12] Returns: - amount: unminted GNS base units for year, or 0 when year is invalid

Open
OID
0d2890…5437:30
GetHalvingYearLeftAmount details

Inspect func

GetHalvingYearMintedAmount

func(year int64) int64

GetHalvingYearMintedAmount returns the minted GNS allocation recorded for a halving year. Parameters: - year: halving year number in \[1, 12] Returns: - amount: minted GNS base units for year, or 0 when year is invalid

Open
OID
0d2890…5437:31
GetHalvingYearMintedAmount details

Inspect func

GetAmountPerSecondPerHalvingYear

func(year int64) int64

GetAmountPerSecondPerHalvingYear returns the configured GNS emission rate for a halving year. Parameters: - year: halving year number in \[1, 12] Returns: - amountPerSecond: GNS base units emitted per second in year, or 0 when year is invalid

Open
OID
0d2890…5437:32
GetAmountPerSecondPerHalvingYear details

Inspect func

GetHalvingAmountsPerYear

func(year int64) int64

GetHalvingAmountsPerYear returns the total GNS allocation configured for a halving year. Parameters: - year: halving year number in \[1, 12] Returns: - amount: total GNS base units allocated to year, or 0 when year is invalid

Open
OID
0d2890…5437:33
GetHalvingAmountsPerYear details

Inspect func

GetEmissionCreatedHeight

func() int64

GetEmissionCreatedHeight returns the blockchain height recorded when the emission schedule was created. Returns: - height: schedule creation height, or the uninitialized state's stored value

Open
OID
0d2890…5437:34
GetEmissionCreatedHeight details

Inspect func

GetEmissionStartTimestamp

func() int64

GetEmissionStartTimestamp returns the inclusive Unix timestamp at which the configured emission schedule begins. Returns: - timestamp: schedule start timestamp

Open
OID
0d2890…5437:35
GetEmissionStartTimestamp details

Inspect func

GetEmissionEndTimestamp

func() int64

GetEmissionEndTimestamp returns the inclusive Unix timestamp at which the configured emission schedule ends. Returns: - timestamp: schedule end timestamp

Open
OID
0d2890…5437:36
GetEmissionEndTimestamp details

Inspect func

GetHalvingYearInfo

func(timestamp int64) (int64, int64, int64)

GetHalvingYearInfo returns the configured halving interval containing timestamp. Parameters: - timestamp: Unix timestamp to classify against the inclusive emission schedule Returns: - year: halving year in \[1, 12], or 0 outside the schedule - startTimestamp: inclusive start timestamp of year, or 0 when timestamp is outside the schedule - endTimestamp: inclusive end timestamp of year, or 0 when timestamp is outside the schedule

Open
OID
0d2890…5437:37
GetHalvingYearInfo details

Inspect func

GetHalvingInfo

func() *gns.HalvingData

GetHalvingInfo returns an independent copy of the configured 12-year halving schedule. Returns: - halvingData: deep copy of schedule timestamps, allocations, minted amounts, remaining amounts, and rates

Open
OID
0d2890…5437:38
GetHalvingInfo details

Inspect func

CalculateMintGnsAmount

func(fromTimestamp int64, toTimestamp int64) int64

CalculateMintGnsAmount calculates the GNS base units allocated over an inclusive timestamp range without mutating the live emission state. Parameters: - fromTimestamp: inclusive Unix timestamp at which allocation begins - toTimestamp: inclusive Unix timestamp at which allocation ends Returns: - amount: GNS base units allocated in the overlapping schedule interval, or 0 for an invalid or non-overlapping range

Open
OID
0d2890…5437:39
CalculateMintGnsAmount details

Inspect func

tokenID

untyped bigint

Value

(0 <untyped> bigint)

MAXIMUM_SUPPLY

int64

Value

1000000000000000

INITIAL_MINT_AMOUNT

int64

Value

100000000000000

MAX_EMISSION_AMOUNT

int64

// MAXIMUM\_SUPPLY - INITIAL\_MINT\_AMOUNT

Value

900000000000000

leftEmissionAmount

int64

// amount of GNS can be minted for emission

Value

898143072254299

mintedEmissionAmount

int64

// amount of GNS that has been minted for emission

Value

1856927745701

lastMintedTimestamp

int64

// last block time that gns was minted for emission

Value

1789825066

Name

func() string

Name returns the name of the GNS token. Returns: - name: token name

Open
OID
0d2890…5437:48
Name details

Inspect func

Symbol

func() string

Symbol returns the symbol of the GNS token. Returns: - symbol: token symbol

Open
OID
0d2890…5437:49
Symbol details

Inspect func

Decimals

func() int

Decimals returns the number of decimal places for GNS token. Returns: - decimals: number of decimal places

Open
OID
0d2890…5437:50
Decimals details

Inspect func

TotalSupply

func() int64

TotalSupply returns the total supply of GNS tokens in circulation. Returns: - supply: total token supply

Open
OID
0d2890…5437:51
TotalSupply details

Inspect func

KnownAccounts

func() int

KnownAccounts returns the number of addresses that have held GNS. Returns: - count: number of known accounts

Open
OID
0d2890…5437:52
KnownAccounts details

Inspect func

BalanceOf

func(owner .uverse.address) int64

BalanceOf returns the GNS balance of a specific address. Parameters: - owner: address to check balance for Returns: - balance: token balance

Open
OID
0d2890…5437:53
BalanceOf details

Inspect func

Allowance

func(owner .uverse.address, spender .uverse.address) int64

Allowance returns the amount of GNS that a spender is allowed to transfer from an owner. Parameters: - owner: token owner address - spender: spender address Returns: - allowance: approved amount

Open
OID
0d2890…5437:54
Allowance details

Inspect func

MintGns

func(address .uverse.address) int64

MintGns mints new GNS tokens according to the emission schedule. Parameters: - cur: Current realm context; callers use cross(cur) when crossing into this realm. - address: recipient address for minted tokens Returns: - amount: GNS minted for the current timestamp; zero when emission is already processed for that timestamp or the schedule has ended Only callable by emission contract. Note: Halt check is performed by the caller (emission.MintAndDistributeGns) to allow graceful handling. This function assumes caller has already verified halt status before invoking.

Open
OID
0d2890…5437:55
MintGns details

Inspect func

Transfer

func(to .uverse.address, amount int64)

Transfer transfers GNS tokens from caller to recipient. Parameters: - cur: Current realm context; callers use cross(cur) when crossing into this realm. - to: recipient address - amount: number of GNS base units to transfer

Open
OID
0d2890…5437:56
Transfer details

Inspect func

Approve

func(spender .uverse.address, amount int64)

Approve allows spender to transfer GNS tokens from caller's account. Parameters: - cur: Current realm context; callers use cross(cur) when crossing into this realm. - spender: address authorized to spend - amount: maximum number of GNS base units spender can transfer

Open
OID
0d2890…5437:57
Approve details

Inspect func

TransferFrom

func(from .uverse.address, to .uverse.address, amount int64)

TransferFrom transfers GNS tokens on behalf of owner. Parameters: - cur: Current realm context; callers use cross(cur) when crossing into this realm. - from: token owner address - to: recipient address - amount: number of GNS base units to transfer

Open
OID
0d2890…5437:58
TransferFrom details

Inspect func

Render

func(path string) string

Render returns token information for web interface. Parameters: - path: render path for specific views Returns: - output: formatted token information

Open
OID
0d2890…5437:59
Render details

Inspect func

checkErr

func(err .uverse.error)

checkErr panics if error is not nil.

Open
OID
0d2890…5437:60
checkErr details

Inspect func

calculateAmountToMint

func(state *gns.EmissionState, fromTimestamp int64, toTimestamp int64) (int64, .uverse.error)

calculateAmountToMint calculates and allocates GNS tokens to mint for given timestamp range. This function has side effects: it updates the accumulated and remaining amounts for each halving year in the emission state.

Open
OID
0d2890…5437:61
calculateAmountToMint details

Inspect func

LastMintedTimestamp

func() int64

LastMintedTimestamp returns the timestamp of the last GNS emission mint. Returns: - timestamp: last minted timestamp

Open
OID
0d2890…5437:62
LastMintedTimestamp details

Inspect func

LeftEmissionAmount

func() int64

LeftEmissionAmount returns the remaining GNS tokens available for emission. Returns: - amount: remaining emission amount

Open
OID
0d2890…5437:63
LeftEmissionAmount details

Inspect func

MintedEmissionAmount

func() int64

MintedEmissionAmount returns the total GNS tokens minted through emission, excluding the initial mint amount. Returns: - amount: total minted emission amount

Open
OID
0d2890…5437:64
MintedEmissionAmount details

Inspect func

setLastMintedTimestamp

func(timestamp int64)

setLastMintedTimestamp sets the timestamp of the last emission mint.

Open
OID
0d2890…5437:65
setLastMintedTimestamp details

Inspect func

setLeftEmissionAmount

func(amount int64)

setLeftEmissionAmount sets the remaining emission amount.

Open
OID
0d2890…5437:66
setLeftEmissionAmount details

Inspect func

setMintedEmissionAmount

func(amount int64)

setMintedEmissionAmount sets the total minted emission amount.

Open
OID
0d2890…5437:67
setMintedEmissionAmount details

Inspect func

HalvingData

type

HalvingData stores emission data for each halving period. Contains timestamps, amounts, and rates for the 12-year emission schedule.

Value

gns.HalvingData

NewHalvingData

func(startTimestamp int64) *gns.HalvingData

NewHalvingData creates a 12-year HalvingData emission schedule starting at startTimestamp. Each year receives configured timestamps, allocation, zero minted amount, remaining allocation, and an integer-truncated per-second rate. Parameters: - startTimestamp: Unix timestamp at which halving year 1 begins Returns: - halvingData: initialized schedule with years \[1, 12] and their derived values

Open
OID
0d2890…5437:68
NewHalvingData details

Inspect func

setupPreMint

func()

setupPreMint mints the initial GNS supply to fixed recipients at realm init. Generated by scripts/patch-gns-premint.sh from GNS\_PRE\_MINT. It replaces the upstream role-based recipient (rbac ADMIN) with the addresses listed below.

Open
OID
0d2890…5437:70
setupPreMint details

Inspect func

validYear

func(year int64) .uverse.error

validYear validates that year is within halving period range (1-12). Returns error if year is outside the valid range.

Open
OID
0d2890…5437:72
validYear details

Inspect func

validEmissionAmount

func(amount int64) .uverse.error

validEmissionAmount validates that the emission amount does not exceed maximum. Returns error if minting the amount would exceed MAX\_EMISSION\_AMOUNT.

Open
OID
0d2890…5437:74
validEmissionAmount details

Inspect func

i64Min

func(x int64, y int64) int64

i64Min returns the smaller of two int64 values.

Open
OID
0d2890…5437:75
i64Min details

Inspect func
SECONDS_IN_YEAR : untyped bigint =(31536000 <untyped> bigint)
HALVING_START_YEAR : int64 =1
HALVING_END_YEAR : int64 =12
halvingAmountsPerYear : [12]int64 Inspect
InitEmissionState : func(createdHeight int64, startTimestamp int64) Inspect
emissionState : *gns.EmissionState Inspect
init.6 : func() Inspect
EmissionState : type =gns.EmissionState
NewEmissionState : func(createdHeight int64, startTimestamp int64) *gns.EmissionState Inspect
getEmissionState : func() *gns.EmissionState Inspect
errInvalidYear : untyped string ="[GNOSWAP-GNS-001] invalid year"
errTooManyEmission : untyped string ="[GNOSWAP-GNS-002] too many emission reward"
errInvalidEmissionAmount : untyped string ="[GNOSWAP-GNS-003] invalid emission amount"
makeErrorWithDetails : func(message string, details string) .uverse.error Inspect
GetMaxEmissionAmount : func() int64 Inspect
GetMaximumSupply : func() int64 Inspect
GetInitialMintAmount : func() int64 Inspect
IsEmissionInitialized : func() bool Inspect
IsEmissionActive : func() bool Inspect
IsEmissionEnded : func() bool Inspect
GetHalvingYear : func(timestamp int64) int64 Inspect
GetCurrentYear : func() int64 Inspect
GetEmissionAmountPerSecondInRange : func(fromTime int64, toTime int64) ([]int64, []int64) Inspect
GetEmissionAmountPerSecondByTimestamp : func(timestamp int64) int64 Inspect
GetEmissionLeftAmountByTimestamp : func(timestamp int64) int64 Inspect
GetEmissionAccumulatedAmountByTimestamp : func(timestamp int64) int64 Inspect
GetHalvingYearStartTimestamp : func(year int64) int64 Inspect
GetHalvingYearEndTimestamp : func(year int64) int64 Inspect
GetHalvingYearMaxAmount : func(year int64) int64 Inspect
GetHalvingYearLeftAmount : func(year int64) int64 Inspect
GetHalvingYearMintedAmount : func(year int64) int64 Inspect
GetAmountPerSecondPerHalvingYear : func(year int64) int64 Inspect
GetHalvingAmountsPerYear : func(year int64) int64 Inspect
GetEmissionCreatedHeight : func() int64 Inspect
GetEmissionStartTimestamp : func() int64 Inspect
GetEmissionEndTimestamp : func() int64 Inspect
GetHalvingYearInfo : func(timestamp int64) (int64, int64, int64) Inspect
GetHalvingInfo : func() *gns.HalvingData Inspect
CalculateMintGnsAmount : func(fromTimestamp int64, toTimestamp int64) int64 Inspect
tokenID : untyped bigint =(0 <untyped> bigint)
MAXIMUM_SUPPLY : int64 =1000000000000000
INITIAL_MINT_AMOUNT : int64 =100000000000000
MAX_EMISSION_AMOUNT : int64 =900000000000000
token : *v0.Token Inspect
privateLedger : *v0.PrivateLedger Inspect
userTeller : *v0.fnTeller Inspect
leftEmissionAmount : int64 =898143072254299
mintedEmissionAmount : int64 =1856927745701
lastMintedTimestamp : int64 =1789825066
init.49 : func() Inspect
Name : func() string Inspect
Symbol : func() string Inspect
Decimals : func() int Inspect
TotalSupply : func() int64 Inspect
KnownAccounts : func() int Inspect
BalanceOf : func(owner .uverse.address) int64 Inspect
Allowance : func(owner .uverse.address, spender .uverse.address) int64 Inspect
MintGns : func(address .uverse.address) int64 Inspect
Transfer : func(to .uverse.address, amount int64) Inspect
Approve : func(spender .uverse.address, amount int64) Inspect
TransferFrom : func(from .uverse.address, to .uverse.address, amount int64) Inspect
Render : func(path string) string Inspect
checkErr : func(err .uverse.error) Inspect
calculateAmountToMint : func(state *gns.EmissionState, fromTimestamp int64, toTimestamp int64) (int64, .uverse.error) Inspect
LastMintedTimestamp : func() int64 Inspect
LeftEmissionAmount : func() int64 Inspect
MintedEmissionAmount : func() int64 Inspect
setLastMintedTimestamp : func(timestamp int64) Inspect
setLeftEmissionAmount : func(amount int64) Inspect
setMintedEmissionAmount : func(amount int64) Inspect
HalvingData : type =gns.HalvingData
NewHalvingData : func(startTimestamp int64) *gns.HalvingData Inspect
setupPreMint : func() Inspect
validYear : func(year int64) .uverse.error Inspect
validEmissionAmount : func(amount int64) .uverse.error Inspect
i64Min : func(x int64, y int64) int64 Inspect