← Back to Realms

Realm

gno.land/r/gnoswap/gov/staker

Overview

Realm Path
gno.land/r/gnoswap/gov/staker
Exported Functions
57
State Entries
41
Source Files
23
Total Package Entries
107

Exported Functions

57 exported functions

State

41 state entries

Source Code

FILES
counter.gno
go
1package staker
2
3type Counter struct {
4	id int64
5}
6
7// NewCounter creates a counter initialized before the first allocated identifier.
8//
9// Returns:
10//   - *Counter: counter whose current identifier is zero.
11func NewCounter() *Counter {
12	return &Counter{id: 0}
13}
14
15// Get returns the counter's current identifier without incrementing it.
16//
17// Returns:
18//   - int64: most recently allocated identifier, or zero for a new counter.
19func (c *Counter) Get() int64 { return c.id }
20
21// Next increments the counter and returns the newly allocated identifier.
22//
23// Returns:
24//   - int64: next identifier after incrementing the counter by one.
25func (c *Counter) Next() int64 {
26	c.id++
27	return c.id
28}
29

Raw Package Data

Raw JSON data