PathrockNetwork Gno Explorer
HomeBlocksTransactionsRealmsPackagesValidatorsAnalytics

PathrockNetwork Gno Explorer — an independent explorer for Gno.land Mainnet (gnoland-1), operated by PathrockNetwork. Not an official Gno.land service.

gnowebarchive RPC

gno.land/r/gnoswap/protocol_fee

Realm
Open in gnoweb ↗

Overview

Kind
Realm (renderable)
Name
protocol_fee
Namespace
gnoswap
Files
11 (README)(gnomod.toml)
Exported functions
29
Module
gno.land/r/gnoswap/protocol_fee
gno
0.9

Files (11)

  • README.mdmarkdown
  • gnomod.tomltoml
  • doc.gnogno
  • getter_utils.gnogno
  • getter.gnogno
  • proxy.gnogno
  • render.gnogno
  • state.gnogno
  • store.gnogno
  • types.gnogno
  • upgrade.gnogno
README.mdPreviewRaw
# Protocol Fee

Fee collection and distribution for protocol operations.

## Overview

The protocol-fee contract collects authorized fees from protocol operations and
distributes them to GovStaker and DevOps according to configured percentages.

## Gnoweb

The root `Render("")` delegates to the active implementation and shows realm identity, distribution allocations in basis points, recipient addresses, the accrual epoch, and halt flags.

Rendering reads fixed configuration without aggregating balances across tokens. Unsupported paths return `404`.

## Configuration

- **Router Fee (initial/default)**: 0.15% of the swap amount; configured by the router, with an admin-or-governance range of 0–10%
- **Pool Creation Fee (initial/default)**: 100 GNS; configured by the pool and modifiable through governance
- **Withdrawal Fee (initial/default)**: 1% of LP fees claimed; configured by the pool and modifiable through governance
- **Unstaking Fee (initial/default)**: 1% of staking rewards; configured by the staker and modifiable by admin or governance
- **Distribution (default)**: 100% to GovStaker and 0% to DevOps

The operation-specific fees above are configured in their owning modules; they
are not protocol-fee distribution percentages.

## Fee Sources

1. **Swaps**: The router applies its configured swap fee (0.15% initially).
2. **Pool Creation**: The pool charges its configured creation fee (100 GNS initially).
3. **LP Withdrawals**: The pool charges its configured withdrawal fee (1% initially).
4. **Staking Claims**: The staker charges its configured unstaking fee (1% initially).

## Key Functions

### `DistributeProtocolFee`
Distributes accumulated fees to recipients.

### `SetDevOpsPct`
Sets the DevOps funding percentage.

### `SetGovStakerPct`
Sets the GovStaker funding percentage.

### `AddToProtocolFee`
Adds an approved fee amount to the distribution queue.

### `AdvanceAccrualEpoch`
Closes the accrual epoch in force and returns the new one. Called by gov/staker on every stake change, so fees are attributed to the stake distribution live when they arrived.

### `ConsumeAccrualBuckets`
Returns and clears up to `limit` of the oldest pending buckets of one token, as parallel epoch and amount slices. Called by gov/staker when that token is collected.

## Usage

```go
// Distribute accumulated fees
DistributeProtocolFee(cross(cur))

// Configure distribution
SetDevOpsPct(cross(cur), 2000)     // 20% to DevOps
SetGovStakerPct(cross(cur), 8000)  // 80% to GovStaker

// View tokens reserved for the next distribution
GetReservedTokens()

// View what gov/staker has not folded yet
GetAccrualEpoch()
GetAccrualPendingTokens()
GetAccrualBuckets(tokenPath, 0)
```

## Security

- Configuration changes are restricted to admin or governance; distribution is restricted to admin or gov/staker
- Automatic fee accumulation
- Multi-token support
- Transparent distribution tracking

Functions

  • AddToProtocolFee(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}, tokenPath string, amount int64) interface {Error func() string}

  • AdvanceAccrualEpoch(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}) int64

  • ConsumeAccrualBuckets(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}, tokenPath string, limit int) ([]int64, []int64)

  • DistributeProtocolFee(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string})

  • DistributeProtocolFeeByTokenPath(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}, tokenPath string)

  • GetAccrualBuckets(tokenPath string, limit int) ([]int64, []int64)

  • GetAccrualEpoch() int64

  • GetAccrualPendingTokens() []string

  • GetAccuTransfersToDevOps() map[string]int64

  • GetAccuTransfersToGovStaker() map[string]int64

  • GetAccuTransferToDevOpsByTokenPath(tokenPath string) int64

  • GetAccuTransferToGovStakerByTokenPath(tokenPath string) int64

  • GetActualDistributedToDevOps() map[string]int64

  • GetActualDistributedToDevOpsByTokenPath(tokenPath string) int64

  • GetActualDistributedToGovStaker() map[string]int64

  • GetActualDistributedToGovStakerByTokenPath(tokenPath string) int64

  • GetDevOpsPct() int64

  • GetDomainPath() string

  • GetGovStakerPct() int64

  • GetImplementationPackagePath() string

  • GetReservedTokens() []string

  • GetVersionPackagePath() string

  • NewBPTreeN(fanout int) *gno.land/p/nt/bptree/v0.BPTree

  • NewProtocolFeeStore(kvStore interface {AddAuthorizedCaller func(int, .uverse.realm, .uverse.address, gno.land/p/gnoswap/store/v1.Permission) .uverse.error; Delete func(int, .uverse.realm, string) .uverse.error; Get func(string) (interface {}, .uverse.error); GetAddress func(string) (.uverse.address, .uverse.error); GetAllKeys func() ([]string, .uverse.error); GetAuthorizedCallers func() (map[.uverse.address]gno.land/p/gnoswap/store/v1.Permission, .uverse.error); GetBPTree func(string) (*gno.land/p/nt/bptree/v0.BPTree, .uverse.error); GetBool func(string) (bool, .uverse.error); GetDomainAddress func() .uverse.address; GetInt64 func(string) (int64, .uverse.error); GetString func(string) (string, .uverse.error); GetUint64 func(string) (uint64, .uverse.error); Has func(string) bool; IsWriteAuthorized func(.uverse.address) bool; RemoveAuthorizedCaller func(int, .uverse.realm, .uverse.address) .uverse.error; Set func(int, .uverse.realm, string, interface {}) .uverse.error; UpdateAuthorizedCaller func(int, .uverse.realm, .uverse.address, gno.land/p/gnoswap/store/v1.Permission) .uverse.error}) interface {AddAccrualBucket func(int, .uverse.realm, string, int64, int64) .uverse.error; AddAccrualPendingToken func(int, .uverse.realm, string) .uverse.error; AddReservedToken func(int, .uverse.realm, string) .uverse.error; GetAccrualBuckets func(string, int) ([]int64, []int64); GetAccrualEpoch func() int64; GetAccrualPendingTokens func() []string; GetAccuToDevOps func() *gno.land/p/nt/bptree/v0.BPTree; GetAccuToDevOpsItem func(string) (int64, bool); GetAccuToGovStaker func() *gno.land/p/nt/bptree/v0.BPTree; GetAccuToGovStakerItem func(string) (int64, bool); GetDevOpsPct func() int64; GetDistributedToDevOpsHistory func() *gno.land/p/nt/bptree/v0.BPTree; GetDistributedToDevOpsHistoryItem func(string) (int64, bool); GetDistributedToGovStakerHistory func() *gno.land/p/nt/bptree/v0.BPTree; GetDistributedToGovStakerHistoryItem func(string) (int64, bool); GetReservedTokens func() []string; HasAccrualBucketsStoreKey func() bool; HasAccrualEpochStoreKey func() bool; HasAccrualPendingTokensStoreKey func() bool; HasAccuToDevOpsStoreKey func() bool; HasAccuToGovStakerStoreKey func() bool; HasDevOpsPctStoreKey func() bool; HasDistributedToDevOpsHistoryStoreKey func() bool; HasDistributedToGovStakerHistoryStoreKey func() bool; HasReservedToken func(string) bool; HasReservedTokensStoreKey func() bool; InitializeAccrualBuckets func(int, .uverse.realm) .uverse.error; InitializeAccrualEpoch func(int, .uverse.realm) .uverse.error; InitializeAccrualPendingTokens func(int, .uverse.realm) .uverse.error; InitializeAccuToDevOps func(int, .uverse.realm) .uverse.error; InitializeAccuToGovStaker func(int, .uverse.realm) .uverse.error; InitializeDevOpsPct func(int, .uverse.realm) .uverse.error; InitializeDistributedToDevOpsHistory func(int, .uverse.realm) .uverse.error; InitializeDistributedToGovStakerHistory func(int, .uverse.realm) .uverse.error; InitializeReservedTokens func(int, .uverse.realm) .uverse.error; RemoveAccrualBuckets func(int, .uverse.realm, string, []int64) .uverse.error; RemoveAccrualPendingToken func(int, .uverse.realm, string) .uverse.error; RemoveReservedToken func(int, .uverse.realm, string) .uverse.error; SetAccrualEpoch func(int, .uverse.realm, int64) .uverse.error; SetAccuToDevOpsItem func(int, .uverse.realm, string, int64) .uverse.error; SetAccuToGovStakerItem func(int, .uverse.realm, string, int64) .uverse.error; SetDevOpsPct func(int, .uverse.realm, int64) .uverse.error; SetDistributedToDevOpsHistoryItem func(int, .uverse.realm, string, int64) .uverse.error; SetDistributedToGovStakerHistoryItem func(int, .uverse.realm, string, int64) .uverse.error}

  • RegisterInitializer(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}, initializer func(int, .uverse.realm, gno.land/r/gnoswap/protocol_fee.IProtocolFeeStore) gno.land/r/gnoswap/protocol_fee.IProtocolFee)

  • Render(path string) string

  • SetDevOpsPct(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}, pct int64)

  • SetGovStakerPct(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}, pct int64)

  • UpgradeImpl(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}, packagePath string)

Signatures reconstructed verbatim from vm/qfuncs — interface params keep their inline definitions.

Rendered

RenderedRawgnoweb ↗

vm/qrender output, sanitized (docs/render-security.md) and displayed in an empty-sandbox iframe — scripts, forms and popups cannot run. Links stay inert in-preview; right-click to open.