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 emission schedule with start timestamp. Only callable by emission contract. Sets up 12-year emission schedule with halving every 2 years. Panics if caller is not emission contract.
- OID
- 0d2890…5437:5
InitEmissionState details
emissionState
*gns.EmissionState- OID
- 0d2890…5437:129
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 a new EmissionState with specified start height and timestamp. Calculates emission end time based on 12-year schedule and initializes 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 maximum amount of emission allowed.
- OID
- 0d2890…5437:14
GetMaxEmissionAmount details
GetMaximumSupply
func() int64GetMaximumSupply returns the maximum supply of gns tokens.
- OID
- 0d2890…5437:16
GetMaximumSupply details
GetInitialMintAmount
func() int64GetInitialMintAmount returns the initial amount of gns tokens to be minted.
- OID
- 0d2890…5437:17
GetInitialMintAmount details
IsEmissionInitialized
func() boolIsEmissionInitialized returns true if emission schedule has been initialized.
- OID
- 0d2890…5437:18
IsEmissionInitialized details
IsEmissionActive
func() boolIsEmissionActive returns true if emission is currently active based on current time.
- OID
- 0d2890…5437:19
IsEmissionActive details
IsEmissionEnded
func() boolIsEmissionEnded returns true if emission schedule has completed.
- OID
- 0d2890…5437:20
IsEmissionEnded details
GetHalvingYear
func(timestamp int64) int64GetHalvingYear returns the halving year (1-12) for a given timestamp.
- OID
- 0d2890…5437:21
GetHalvingYear details
GetCurrentYear
func() int64GetCurrentYear returns the current halving year (1-12) or 0 if emission is not active.
- OID
- 0d2890…5437:22
GetCurrentYear details
GetEmissionAmountPerSecondInRange
func(fromTime int64, toTime int64) ([]int64, []int64)GetEmissionAmountPerSecondInRange returns halving timestamps and emission rates for the given time range. Returns two slices: timestamps when halving periods start and corresponding emission rates per second.
- OID
- 0d2890…5437:23
GetEmissionAmountPerSecondInRange details
GetEmissionAmountPerSecondByTimestamp
func(timestamp int64) int64GetEmissionAmountPerSecondByTimestamp returns the emission rate per second for a given timestamp. Returns 0 if timestamp is outside emission period.
- OID
- 0d2890…5437:24
GetEmissionAmountPerSecondByTimestamp details
GetEmissionLeftAmountByTimestamp
func(timestamp int64) int64GetEmissionLeftAmountByTimestamp returns the remaining emission amount for the halving year at given timestamp. Returns 0 if timestamp is outside emission period.
- OID
- 0d2890…5437:25
GetEmissionLeftAmountByTimestamp details
GetEmissionAccumulatedAmountByTimestamp
func(timestamp int64) int64GetEmissionAccumulatedAmountByTimestamp returns the accumulated emission amount for the halving year at given timestamp. Returns 0 if timestamp is outside emission period.
- OID
- 0d2890…5437:26
GetEmissionAccumulatedAmountByTimestamp details
GetHalvingYearStartTimestamp
func(year int64) int64GetHalvingYearStartTimestamp returns the start timestamp for the specified halving year.
- OID
- 0d2890…5437:27
GetHalvingYearStartTimestamp details
GetHalvingYearEndTimestamp
func(year int64) int64GetHalvingYearEndTimestamp returns the end timestamp for the specified halving year.
- OID
- 0d2890…5437:28
GetHalvingYearEndTimestamp details
GetHalvingYearMaxAmount
func(year int64) int64GetHalvingYearMaxAmount returns the maximum token issuance for the specified halving year.
- OID
- 0d2890…5437:29
GetHalvingYearMaxAmount details
GetHalvingYearMintAmount
func(year int64) int64GetHalvingYearMintAmount returns the amount of tokens minted for the specified halving year.
- OID
- 0d2890…5437:30
GetHalvingYearMintAmount details
GetHalvingYearLeftAmount
func(year int64) int64GetHalvingYearLeftAmount returns the remaining token issuance for the specified halving year.
- OID
- 0d2890…5437:31
GetHalvingYearLeftAmount details
GetHalvingYearAccuAmount
func(year int64) int64GetHalvingYearAccuAmount returns the accumulated token issuance for the specified halving year.
- OID
- 0d2890…5437:32
GetHalvingYearAccuAmount details
GetAmountPerSecondPerHalvingYear
func(year int64) int64GetAmountPerSecondPerHalvingYear returns the emission rate per second for the specified halving year.
- OID
- 0d2890…5437:33
GetAmountPerSecondPerHalvingYear details
GetHalvingAmountsPerYear
func(year int64) int64GetHalvingAmountsPerYear returns the total emission amount allocated for the specified year. Returns 0 if year is outside the valid range (1-12).
- OID
- 0d2890…5437:34
GetHalvingAmountsPerYear details
GetEmissionCreatedHeight
func() int64GetEmissionCreatedHeight returns the block height when emission schedule was created.
- OID
- 0d2890…5437:35
GetEmissionCreatedHeight details
GetEmissionStartTimestamp
func() int64GetEmissionStartTimestamp returns the timestamp when emission schedule begins.
- OID
- 0d2890…5437:36
GetEmissionStartTimestamp details
GetEmissionEndTimestamp
func() int64GetEmissionEndTimestamp returns the timestamp when emission schedule ends.
- OID
- 0d2890…5437:37
GetEmissionEndTimestamp details
GetHalvingYearInfo
func(timestamp int64) (int64, int64, int64)GetHalvingYearInfo returns the halving year, start timestamp, and end timestamp for a given timestamp. Returns (year, startTimestamp, endTimestamp). Year is 0 if outside emission period.
- OID
- 0d2890…5437:38
GetHalvingYearInfo details
GetHalvingInfo
func() *gns.HalvingDataGetHalvingInfo returns a clone of the halving data.
- OID
- 0d2890…5437:39
GetHalvingInfo details
CalculateMintGnsAmount
func(fromTimestamp int64, toTimestamp int64) int64CalculateMintGnsAmount returns the amount of GNS that would be minted for the given timestamp range.
- OID
- 0d2890…5437:40
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
*grc20.Token- OID
- 0d2890…5437:88
token details
privateLedger
*grc20.PrivateLedger- OID
- 0d2890…5437:90
privateLedger details
userTeller
*grc20.fnTeller- OID
- 0d2890…5437:96
userTeller details
leftEmissionAmount
int64// amount of GNS can be minted for emission
Value
899770119869340
mintedEmissionAmount
int64// amount of GNS that has been minted for emission
Value
229880130660
lastMintedTimestamp
int64// last block time that gns was minted for emission
Value
1784987157
init.50
func()- OID
- 0d2890…5437:47
init.50 details
Name
func() stringName returns the name of the GNS token.
- OID
- 0d2890…5437:49
Name details
Symbol
func() stringSymbol returns the symbol of the GNS token.
- OID
- 0d2890…5437:50
Symbol details
Decimals
func() intDecimals returns the number of decimal places for GNS token.
- OID
- 0d2890…5437:51
Decimals details
TotalSupply
func() int64TotalSupply returns the total supply of GNS tokens in circulation.
- OID
- 0d2890…5437:52
TotalSupply details
KnownAccounts
func() intKnownAccounts returns the number of addresses that have held GNS.
- OID
- 0d2890…5437:53
KnownAccounts details
BalanceOf
func(owner .uverse.address) int64BalanceOf returns the GNS balance of a specific address.
- OID
- 0d2890…5437:54
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.
- OID
- 0d2890…5437:55
Allowance details
MintGns
func(address .uverse.address) int64MintGns mints new GNS tokens according to the emission schedule. Parameters: - address: recipient address for minted tokens Returns amount minted. 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:56
MintGns details
Transfer
func(to .uverse.address, amount int64)Transfer transfers GNS tokens from caller to recipient. Parameters: - to: recipient address - amount: amount to transfer
- OID
- 0d2890…5437:57
Transfer details
Approve
func(spender .uverse.address, amount int64)Approve allows spender to transfer GNS tokens from caller's account. Parameters: - spender: address authorized to spend - amount: maximum amount spender can transfer
- OID
- 0d2890…5437:58
Approve details
TransferFrom
func(from .uverse.address, to .uverse.address, amount int64)TransferFrom transfers GNS tokens on behalf of owner. Parameters: - from: token owner address - to: recipient address - amount: amount to transfer
- OID
- 0d2890…5437:59
TransferFrom details
Render
func(path string) stringRender returns token information for web interface.
- OID
- 0d2890…5437:60
Render details
checkErr
func(err .uverse.error)checkErr panics if error is not nil.
- OID
- 0d2890…5437:61
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:62
calculateAmountToMint details
LastMintedTimestamp
func() int64LastMintedTimestamp returns the timestamp of the last GNS emission mint.
- OID
- 0d2890…5437:63
LastMintedTimestamp details
LeftEmissionAmount
func() int64LeftEmissionAmount returns the remaining GNS tokens available for emission.
- OID
- 0d2890…5437:64
LeftEmissionAmount details
MintedEmissionAmount
func() int64MintedEmissionAmount returns the total GNS tokens minted through emission, excluding the initial mint amount.
- OID
- 0d2890…5437:65
MintedEmissionAmount details
setLastMintedTimestamp
func(timestamp int64)setLastMintedTimestamp sets the timestamp of the last emission mint.
- OID
- 0d2890…5437:66
setLastMintedTimestamp details
setLeftEmissionAmount
func(amount int64)setLeftEmissionAmount sets the remaining emission amount.
- OID
- 0d2890…5437:67
setLeftEmissionAmount details
setMintedEmissionAmount
func(amount int64)setMintedEmissionAmount sets the total minted emission amount.
- OID
- 0d2890…5437:68
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 new HalvingData instance with emission schedule. Initializes 12 years of halving periods with timestamps, amounts, and rates based on startTimestamp.
- OID
- 0d2890…5437:69
NewHalvingData 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:71
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:73
validEmissionAmount details
i64Min
func(x int64, y int64) int64i64Min returns the smaller of two int64 values.
- OID
- 0d2890…5437:74