v1 source realm
package v1 collects and distributes protocol fees from swaps.
View source
Protocol Fee
Fee collection and distribution for protocol operations.
Overview
Protocol Fee contract collects fees from various protocol operations and distributes them to xGNS holders and DevOps.
Configuration
- Router Fee: 0.15% of swap amount
- Pool Creation Fee: 100 GNS
- Withdrawal Fee: 1% of LP fees claimed
- Unstaking Fee: 1% of staking rewards
- Distribution: 100% to xGNS holders (default)
Fee Sources
- Swaps: 0.15% fee on all trades
- Pool Creation: 100 GNS per new pool
- LP Withdrawals: 1% of collected fees
- Staking Claims: 1% of rewards
Key Functions
DistributeProtocolFee
Distributes accumulated fees to recipients.
SetDevOpsPct
Sets DevOps funding percentage.
SetGovStakerPct
Sets xGNS holder percentage.
AddToProtocolFee
Adds fees to distribution queue.
Usage
1// Distribute accumulated fees
2tokenAmounts := DistributeProtocolFee()
3
4// Configure distribution
5SetDevOpsPct(2000) // 20% to DevOps
6SetGovStakerPct(8000) // 80% to xGNS holders
7
8// View tokens reserved for the next distribution
9GetReservedTokens()
Security
- Admin-only configuration changes
- Automatic fee accumulation
- Multi-token support
- Transparent distribution tracking
package v1 collects and distributes protocol fees from swaps.
This contract accumulates fees generated from trading activity and distributes them to devOps and governance stakers according to configurable percentages set through governance.
2
func NewProtocolFeeStateBy
Action1func NewProtocolFeeStateBy(protocolFeeStore protocol_fee.IProtocolFeeStore) *protocolFeeStateNewProtocolFeeState creates a new instance of protocolFeeState with initialized values
11
- chain stdlib
- errors stdlib
- gno.land/p/gnoswap/gnsmath package
- gno.land/p/gnoswap/rbac package
- gno.land/p/nt/bptree/v0 package
- gno.land/p/nt/ufmt/v0 package
- gno.land/r/gnoswap/access realm
- gno.land/r/gnoswap/common realm
- gno.land/r/gnoswap/halt realm
- gno.land/r/gnoswap/protocol_fee realm
- strconv stdlib