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 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.

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 a new EmissionState with specified start height and timestamp. Calculates emission end time based on 12-year schedule and initializes 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 maximum amount of emission allowed.

Open
OID
0d2890…5437:14
GetMaxEmissionAmount details

Inspect func

GetMaximumSupply

func() int64

GetMaximumSupply returns the maximum supply of gns tokens.

Open
OID
0d2890…5437:16
GetMaximumSupply details

Inspect func

GetInitialMintAmount

func() int64

GetInitialMintAmount returns the initial amount of gns tokens to be minted.

Open
OID
0d2890…5437:17
GetInitialMintAmount details

Inspect func

IsEmissionInitialized

func() bool

IsEmissionInitialized returns true if emission schedule has been initialized.

Open
OID
0d2890…5437:18
IsEmissionInitialized details

Inspect func

IsEmissionActive

func() bool

IsEmissionActive returns true if emission is currently active based on current time.

Open
OID
0d2890…5437:19
IsEmissionActive details

Inspect func

IsEmissionEnded

func() bool

IsEmissionEnded returns true if emission schedule has completed.

Open
OID
0d2890…5437:20
IsEmissionEnded details

Inspect func

GetHalvingYear

func(timestamp int64) int64

GetHalvingYear returns the halving year (1-12) for a given timestamp.

Open
OID
0d2890…5437:21
GetHalvingYear details

Inspect func

GetCurrentYear

func() int64

GetCurrentYear returns the current halving year (1-12) or 0 if emission is not active.

Open
OID
0d2890…5437:22
GetCurrentYear details

Inspect func

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.

Open
OID
0d2890…5437:23
GetEmissionAmountPerSecondInRange details

Inspect func

GetEmissionAmountPerSecondByTimestamp

func(timestamp int64) int64

GetEmissionAmountPerSecondByTimestamp returns the emission rate per second for a given timestamp. Returns 0 if timestamp is outside emission period.

Open
OID
0d2890…5437:24
GetEmissionAmountPerSecondByTimestamp details

Inspect func

GetEmissionLeftAmountByTimestamp

func(timestamp int64) int64

GetEmissionLeftAmountByTimestamp returns the remaining emission amount for the halving year at given timestamp. Returns 0 if timestamp is outside emission period.

Open
OID
0d2890…5437:25
GetEmissionLeftAmountByTimestamp details

Inspect func

GetEmissionAccumulatedAmountByTimestamp

func(timestamp int64) int64

GetEmissionAccumulatedAmountByTimestamp returns the accumulated emission amount for the halving year at given timestamp. Returns 0 if timestamp is outside emission period.

Open
OID
0d2890…5437:26
GetEmissionAccumulatedAmountByTimestamp details

Inspect func

GetHalvingYearStartTimestamp

func(year int64) int64

GetHalvingYearStartTimestamp returns the start timestamp for the specified halving year.

Open
OID
0d2890…5437:27
GetHalvingYearStartTimestamp details

Inspect func

GetHalvingYearEndTimestamp

func(year int64) int64

GetHalvingYearEndTimestamp returns the end timestamp for the specified halving year.

Open
OID
0d2890…5437:28
GetHalvingYearEndTimestamp details

Inspect func

GetHalvingYearMaxAmount

func(year int64) int64

GetHalvingYearMaxAmount returns the maximum token issuance for the specified halving year.

Open
OID
0d2890…5437:29
GetHalvingYearMaxAmount details

Inspect func

GetHalvingYearMintAmount

func(year int64) int64

GetHalvingYearMintAmount returns the amount of tokens minted for the specified halving year.

Open
OID
0d2890…5437:30
GetHalvingYearMintAmount details

Inspect func

GetHalvingYearLeftAmount

func(year int64) int64

GetHalvingYearLeftAmount returns the remaining token issuance for the specified halving year.

Open
OID
0d2890…5437:31
GetHalvingYearLeftAmount details

Inspect func

GetHalvingYearAccuAmount

func(year int64) int64

GetHalvingYearAccuAmount returns the accumulated token issuance for the specified halving year.

Open
OID
0d2890…5437:32
GetHalvingYearAccuAmount details

Inspect func

GetAmountPerSecondPerHalvingYear

func(year int64) int64

GetAmountPerSecondPerHalvingYear returns the emission rate per second for the specified halving year.

Open
OID
0d2890…5437:33
GetAmountPerSecondPerHalvingYear details

Inspect func

GetHalvingAmountsPerYear

func(year int64) int64

GetHalvingAmountsPerYear returns the total emission amount allocated for the specified year. Returns 0 if year is outside the valid range (1-12).

Open
OID
0d2890…5437:34
GetHalvingAmountsPerYear details

Inspect func

GetEmissionCreatedHeight

func() int64

GetEmissionCreatedHeight returns the block height when emission schedule was created.

Open
OID
0d2890…5437:35
GetEmissionCreatedHeight details

Inspect func

GetEmissionStartTimestamp

func() int64

GetEmissionStartTimestamp returns the timestamp when emission schedule begins.

Open
OID
0d2890…5437:36
GetEmissionStartTimestamp details

Inspect func

GetEmissionEndTimestamp

func() int64

GetEmissionEndTimestamp returns the timestamp when emission schedule ends.

Open
OID
0d2890…5437:37
GetEmissionEndTimestamp details

Inspect func

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.

Open
OID
0d2890…5437:38
GetHalvingYearInfo details

Inspect func

GetHalvingInfo

func() *gns.HalvingData

GetHalvingInfo returns a clone of the halving data.

Open
OID
0d2890…5437:39
GetHalvingInfo details

Inspect func

CalculateMintGnsAmount

func(fromTimestamp int64, toTimestamp int64) int64

CalculateMintGnsAmount returns the amount of GNS that would be minted for the given timestamp range.

Open
OID
0d2890…5437:40
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

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

Name

func() string

Name returns the name of the GNS token.

Open
OID
0d2890…5437:49
Name details

Inspect func

Symbol

func() string

Symbol returns the symbol of the GNS token.

Open
OID
0d2890…5437:50
Symbol details

Inspect func

Decimals

func() int

Decimals returns the number of decimal places for GNS token.

Open
OID
0d2890…5437:51
Decimals details

Inspect func

TotalSupply

func() int64

TotalSupply returns the total supply of GNS tokens in circulation.

Open
OID
0d2890…5437:52
TotalSupply details

Inspect func

KnownAccounts

func() int

KnownAccounts returns the number of addresses that have held GNS.

Open
OID
0d2890…5437:53
KnownAccounts details

Inspect func

BalanceOf

func(owner .uverse.address) int64

BalanceOf returns the GNS balance of a specific address.

Open
OID
0d2890…5437:54
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.

Open
OID
0d2890…5437:55
Allowance details

Inspect func

MintGns

func(address .uverse.address) int64

MintGns 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.

Open
OID
0d2890…5437:56
MintGns details

Inspect func

Transfer

func(to .uverse.address, amount int64)

Transfer transfers GNS tokens from caller to recipient. Parameters: - to: recipient address - amount: amount to transfer

Open
OID
0d2890…5437:57
Transfer details

Inspect func

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

Open
OID
0d2890…5437:58
Approve details

Inspect func

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

Open
OID
0d2890…5437:59
TransferFrom details

Inspect func

Render

func(path string) string

Render returns token information for web interface.

Open
OID
0d2890…5437:60
Render details

Inspect func

checkErr

func(err .uverse.error)

checkErr panics if error is not nil.

Open
OID
0d2890…5437:61
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:62
calculateAmountToMint details

Inspect func

LastMintedTimestamp

func() int64

LastMintedTimestamp returns the timestamp of the last GNS emission mint.

Open
OID
0d2890…5437:63
LastMintedTimestamp details

Inspect func

LeftEmissionAmount

func() int64

LeftEmissionAmount returns the remaining GNS tokens available for emission.

Open
OID
0d2890…5437:64
LeftEmissionAmount details

Inspect func

MintedEmissionAmount

func() int64

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

Open
OID
0d2890…5437:65
MintedEmissionAmount details

Inspect func

setLastMintedTimestamp

func(timestamp int64)

setLastMintedTimestamp sets the timestamp of the last emission mint.

Open
OID
0d2890…5437:66
setLastMintedTimestamp details

Inspect func

setLeftEmissionAmount

func(amount int64)

setLeftEmissionAmount sets the remaining emission amount.

Open
OID
0d2890…5437:67
setLeftEmissionAmount details

Inspect func

setMintedEmissionAmount

func(amount int64)

setMintedEmissionAmount sets the total minted emission amount.

Open
OID
0d2890…5437:68
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 new HalvingData instance with emission schedule. Initializes 12 years of halving periods with timestamps, amounts, and rates based on startTimestamp.

Open
OID
0d2890…5437:69
NewHalvingData 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:71
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:73
validEmissionAmount details

Inspect func

i64Min

func(x int64, y int64) int64

i64Min returns the smaller of two int64 values.

Open
OID
0d2890…5437:74
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
GetHalvingYearMintAmount : func(year int64) int64 Inspect
GetHalvingYearLeftAmount : func(year int64) int64 Inspect
GetHalvingYearAccuAmount : 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 : *grc20.Token Inspect
privateLedger : *grc20.PrivateLedger Inspect
userTeller : *grc20.fnTeller Inspect
leftEmissionAmount : int64 =899770119869340
mintedEmissionAmount : int64 =229880130660
lastMintedTimestamp : int64 =1784987157
init.50 : 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
validYear : func(year int64) .uverse.error Inspect
validEmissionAmount : func(amount int64) .uverse.error Inspect
i64Min : func(x int64, y int64) int64 Inspect