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

protocol_fee package

Overview

Package protocol_fee manages fee collection and distribution for GnoSwap protocol operations.

This contract collects authorized fees from protocol operations such as swaps, pool creation, withdrawals, and staking claims, then accounts for their distribution to DevOps and GovStaker according to configurable percentages.

Distribution Targets:

  • DevOps: Development and operations fund (default 0%)
  • GovStaker: Governance-staker destination (default 100%)

Accounting:

  • reservedTokens tracks token paths with collected fees awaiting distribution.
  • Per-token allocation accumulators and distribution-history trees distinguish amounts allocated from amounts actually transferred.
  • GovStaker allocations are bucketed by token path and accrual epoch.

Key Functions:

  • DistributeProtocolFee: Distributes accumulated fees to recipients
  • SetDevOpsPct/SetGovStakerPct: Configure distribution percentages
  • AddToProtocolFee: Pulls an approved fee into the distribution queue

The contract uses a version manager pattern for upgradeable implementations.

Function

GetAccrualBuckets

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

GetAccrualBuckets returns up to limit of the oldest pending buckets of tokenPath without clearing them. A limit of zero or less returns every pending bucket.

Parameters:

  • tokenPath: token contract path whose pending GovStaker accrual buckets are queried
  • limit: maximum number of oldest buckets to return; zero or negative returns all pending buckets

Returns:

  • epochs: selected accrual epoch numbers in ascending epoch order
  • amounts: GovStaker fee amounts corresponding positionally to epochs, in token base units

Params

Command

gnokey query vm/qeval -remote "http://127.0.0.1:26657" -data "gno.land/r/gnoswap/protocol_fee.GetAccrualBuckets(,)"

Result