SECONDS_IN_YEAR
untyped bigintValue
(31536000 <untyped> bigint)
HALVING_START_YEAR
int64Value
1
HALVING_END_YEAR
int64Value
12
halvingAmountsPerYear
[12]int64MUST BE IMMUTABLE, DO NOT MODIFY. Annual halving amount - maximum issuance per year
- OID
- 0d2890…5437:4
halvingAmountsPerYear details
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.
- OID
- 0d2890…5437:5
InitEmissionState details
emissionState
*gns.EmissionState- OID
- 0d2890…5437:6949
emissionState details
init.6
func()- OID
- 0d2890…5437:8
init.6 details
EmissionState
typeEmissionState 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.EmissionStateNewEmissionState 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.
- OID
- 0d2890…5437:10
NewEmissionState details
getEmissionState
func() *gns.EmissionStategetEmissionState returns the singleton emission state instance.
- OID
- 0d2890…5437:11
getEmissionState details
errInvalidYear
untyped stringValue
"[GNOSWAP-GNS-001] invalid year"
errTooManyEmission
untyped stringValue
"[GNOSWAP-GNS-002] too many emission reward"
errInvalidEmissionAmount
untyped stringValue
"[GNOSWAP-GNS-003] invalid emission amount"
makeErrorWithDetails
func(message string, details string) .uverse.error- OID
- 0d2890…5437:12
makeErrorWithDetails details
GetMaxEmissionAmount
func() int64GetMaxEmissionAmount returns the configured lifetime GNS emission cap in base units. Returns: - maxAmount: maximum number of GNS base units available for emission
- OID
- 0d2890…5437:14
GetMaxEmissionAmount details
GetMaximumSupply
func() int64GetMaximumSupply returns the maximum possible GNS token supply in base units. Returns: - maximumSupply: configured total supply cap, including the initial mint and emissions
- OID
- 0d2890…5437:16
GetMaximumSupply details
GetInitialMintAmount
func() int64GetInitialMintAmount returns the initial GNS allocation minted before emissions. Returns: - initialAmount: number of GNS base units in the initial mint
- OID
- 0d2890…5437:17
GetInitialMintAmount details
IsEmissionInitialized
func() boolIsEmissionInitialized reports whether the emission state has non-zero creation height and start timestamp. Returns: - initialized: true when both initialization fields are set; false otherwise
- OID
- 0d2890…5437:18
IsEmissionInitialized details
IsEmissionActive
func() boolIsEmissionActive 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
- OID
- 0d2890…5437:19
IsEmissionActive details
IsEmissionEnded
func() boolIsEmissionEnded 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
- OID
- 0d2890…5437:20
IsEmissionEnded details
GetHalvingYear
func(timestamp int64) int64GetHalvingYear 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
- OID
- 0d2890…5437:21
GetHalvingYear details
GetCurrentYear
func() int64GetCurrentYear 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
- OID
- 0d2890…5437:22
GetCurrentYear details
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
- OID
- 0d2890…5437:23
GetEmissionAmountPerSecondInRange details
GetEmissionAmountPerSecondByTimestamp
func(timestamp int64) int64GetEmissionAmountPerSecondByTimestamp 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
- OID
- 0d2890…5437:24
GetEmissionAmountPerSecondByTimestamp details
GetEmissionLeftAmountByTimestamp
func(timestamp int64) int64GetEmissionLeftAmountByTimestamp 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
- OID
- 0d2890…5437:25
GetEmissionLeftAmountByTimestamp details
GetEmissionAccumulatedAmountByTimestamp
func(timestamp int64) int64GetEmissionAccumulatedAmountByTimestamp 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
- OID
- 0d2890…5437:26
GetEmissionAccumulatedAmountByTimestamp details
GetHalvingYearStartTimestamp
func(year int64) int64GetHalvingYearStartTimestamp 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
- OID
- 0d2890…5437:27
GetHalvingYearStartTimestamp details
GetHalvingYearEndTimestamp
func(year int64) int64GetHalvingYearEndTimestamp 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
- OID
- 0d2890…5437:28
GetHalvingYearEndTimestamp details
GetHalvingYearMaxAmount
func(year int64) int64GetHalvingYearMaxAmount 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
- OID
- 0d2890…5437:29
GetHalvingYearMaxAmount details
GetHalvingYearLeftAmount
func(year int64) int64GetHalvingYearLeftAmount 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
- OID
- 0d2890…5437:30
GetHalvingYearLeftAmount details
GetHalvingYearMintedAmount
func(year int64) int64GetHalvingYearMintedAmount 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
- OID
- 0d2890…5437:31
GetHalvingYearMintedAmount details
GetAmountPerSecondPerHalvingYear
func(year int64) int64GetAmountPerSecondPerHalvingYear 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
- OID
- 0d2890…5437:32
GetAmountPerSecondPerHalvingYear details
GetHalvingAmountsPerYear
func(year int64) int64GetHalvingAmountsPerYear 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
- OID
- 0d2890…5437:33
GetHalvingAmountsPerYear details
GetEmissionCreatedHeight
func() int64GetEmissionCreatedHeight returns the blockchain height recorded when the emission schedule was created. Returns: - height: schedule creation height, or the uninitialized state's stored value
- OID
- 0d2890…5437:34
GetEmissionCreatedHeight details
GetEmissionStartTimestamp
func() int64GetEmissionStartTimestamp returns the inclusive Unix timestamp at which the configured emission schedule begins. Returns: - timestamp: schedule start timestamp
- OID
- 0d2890…5437:35
GetEmissionStartTimestamp details
GetEmissionEndTimestamp
func() int64GetEmissionEndTimestamp returns the inclusive Unix timestamp at which the configured emission schedule ends. Returns: - timestamp: schedule end timestamp
- OID
- 0d2890…5437:36
GetEmissionEndTimestamp details
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
- OID
- 0d2890…5437:37
GetHalvingYearInfo details
GetHalvingInfo
func() *gns.HalvingDataGetHalvingInfo 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
- OID
- 0d2890…5437:38
GetHalvingInfo details
CalculateMintGnsAmount
func(fromTimestamp int64, toTimestamp int64) int64CalculateMintGnsAmount 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
- OID
- 0d2890…5437:39
CalculateMintGnsAmount details
tokenID
untyped bigintValue
(0 <untyped> bigint)
MAXIMUM_SUPPLY
int64Value
1000000000000000
INITIAL_MINT_AMOUNT
int64Value
100000000000000
MAX_EMISSION_AMOUNT
int64// MAXIMUM\_SUPPLY - INITIAL\_MINT\_AMOUNT
Value
900000000000000
token
*v0.Token- OID
- 0d2890…5437:88
token details
privateLedger
*v0.PrivateLedger- OID
- 0d2890…5437:90
privateLedger details
userTeller
*v0.fnTeller- OID
- 0d2890…5437:94
userTeller details
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
init.49
func()- OID
- 0d2890…5437:46
init.49 details
Name
func() stringName returns the name of the GNS token. Returns: - name: token name
- OID
- 0d2890…5437:48
Name details
Symbol
func() stringSymbol returns the symbol of the GNS token. Returns: - symbol: token symbol
- OID
- 0d2890…5437:49
Symbol details
Decimals
func() intDecimals returns the number of decimal places for GNS token. Returns: - decimals: number of decimal places
- OID
- 0d2890…5437:50
Decimals details
TotalSupply
func() int64TotalSupply returns the total supply of GNS tokens in circulation. Returns: - supply: total token supply
- OID
- 0d2890…5437:51
TotalSupply details
KnownAccounts
func() intKnownAccounts returns the number of addresses that have held GNS. Returns: - count: number of known accounts
- OID
- 0d2890…5437:52
KnownAccounts details
BalanceOf
func(owner .uverse.address) int64BalanceOf returns the GNS balance of a specific address. Parameters: - owner: address to check balance for Returns: - balance: token balance
- OID
- 0d2890…5437:53
BalanceOf details
Allowance
func(owner .uverse.address, spender .uverse.address) int64Allowance 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
- OID
- 0d2890…5437:54
Allowance details
MintGns
func(address .uverse.address) int64MintGns 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.
- OID
- 0d2890…5437:55
MintGns details
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
- OID
- 0d2890…5437:56
Transfer details
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
- OID
- 0d2890…5437:57
Approve details
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
- OID
- 0d2890…5437:58
TransferFrom details
Render
func(path string) stringRender returns token information for web interface. Parameters: - path: render path for specific views Returns: - output: formatted token information
- OID
- 0d2890…5437:59
Render details
checkErr
func(err .uverse.error)checkErr panics if error is not nil.
- OID
- 0d2890…5437:60
checkErr details
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.
- OID
- 0d2890…5437:61
calculateAmountToMint details
LastMintedTimestamp
func() int64LastMintedTimestamp returns the timestamp of the last GNS emission mint. Returns: - timestamp: last minted timestamp
- OID
- 0d2890…5437:62
LastMintedTimestamp details
LeftEmissionAmount
func() int64LeftEmissionAmount returns the remaining GNS tokens available for emission. Returns: - amount: remaining emission amount
- OID
- 0d2890…5437:63
LeftEmissionAmount details
MintedEmissionAmount
func() int64MintedEmissionAmount returns the total GNS tokens minted through emission, excluding the initial mint amount. Returns: - amount: total minted emission amount
- OID
- 0d2890…5437:64
MintedEmissionAmount details
setLastMintedTimestamp
func(timestamp int64)setLastMintedTimestamp sets the timestamp of the last emission mint.
- OID
- 0d2890…5437:65
setLastMintedTimestamp details
setLeftEmissionAmount
func(amount int64)setLeftEmissionAmount sets the remaining emission amount.
- OID
- 0d2890…5437:66
setLeftEmissionAmount details
setMintedEmissionAmount
func(amount int64)setMintedEmissionAmount sets the total minted emission amount.
- OID
- 0d2890…5437:67
setMintedEmissionAmount details
HalvingData
typeHalvingData 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.HalvingDataNewHalvingData 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
- OID
- 0d2890…5437:68
NewHalvingData details
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.
- OID
- 0d2890…5437:70
setupPreMint details
validYear
func(year int64) .uverse.errorvalidYear validates that year is within halving period range (1-12). Returns error if year is outside the valid range.
- OID
- 0d2890…5437:72
validYear details
validEmissionAmount
func(amount int64) .uverse.errorvalidEmissionAmount validates that the emission amount does not exceed maximum. Returns error if minting the amount would exceed MAX\_EMISSION\_AMOUNT.
- OID
- 0d2890…5437:74
validEmissionAmount details
i64Min
func(x int64, y int64) int64i64Min returns the smaller of two int64 values.
- OID
- 0d2890…5437:75