← Back to Realms

Realm

gno.land/r/gnoswap/launchpad

Overview

Realm Path
gno.land/r/gnoswap/launchpad
Exported Functions
71
State Entries
25
Source Files
18
Total Package Entries
101

Exported Functions

71 exported functions

State

25 state entries

Source Code

FILES
counter.gno
go
1package launchpad
2
3// Counter manages unique incrementing IDs.
4type Counter struct {
5	id int64
6}
7
8// NewCounter creates a new Counter starting at zero.
9//
10// Returns:
11//   - counter: counter initialized with current ID zero.
12func NewCounter() *Counter {
13	return &Counter{
14		id: 0,
15	}
16}
17
18// Next increments the counter and returns the next unique ID.
19//
20// Returns:
21//   - id: incremented counter value.
22func (c *Counter) Next() int64 {
23	c.id++
24
25	return c.id
26}
27
28// Get returns the current counter ID without incrementing it.
29//
30// Returns:
31//   - id: current counter value.
32func (c *Counter) Get() int64 {
33	return c.id
34}
35

Raw Package Data

Raw JSON data