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
  • upgrade.gnogno
    1package protocol_fee23import (4	"gno.land/r/gnoswap/access/v1"5)67// RegisterInitializer registers a new protocol fee implementation version.8

    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 ↗
    // This function is called by each version (v1, v2, etc.) during initialization
    9// to register their implementation with the proxy system.
    10//
    11// The initializer function creates a new instance of the implementation
    12// using the provided protocolFeeStore interface. It receives a realm value
    13// that resolves to the protocol_fee proxy realm — the only address with
    14// write permission on the shared KV store — so any per-version store
    15// bootstrapping performed inside the initializer passes the proxy's
    16// authorization check.
    17//
    18// Security: Only contracts within the domain path can register initializers.
    19// Each package path can only register once to prevent duplicate registrations.
    20//
    21// Parameters:
    22// - cur: Current realm context; callers use cross(cur) when crossing into this realm.
    23// - initializer: callback that receives the proxy realm context and protocol-fee store, initializes version-specific state, and returns the implementation instance
    24func RegisterInitializer(cur realm, initializer func(_ int, rlm realm, protocolFeeStore IProtocolFeeStore) IProtocolFee) {
    25 // `cur` captured here is the protocol_fee crossing frame. The wrapping
    26 // closure forwards it to the v1 initializer so any store writes the
    27 // initializer performs run under the proxy's identity rather than the
    28 // version package's, which would fail the kvStore ACL.
    29 initializerFunc := func(_ int, rlm realm, domainStore any) any {
    30 access.AssertIsRlmCurrent(0, rlm)
    31
    32 currentProtocolFeeStore, ok := domainStore.(IProtocolFeeStore)
    33 if !ok {
    34 panic("domainStore is not an IProtocolFeeStore")
    35 }
    36
    37 return initializer(0, rlm, currentProtocolFeeStore)
    38 }
    39
    40 err := versionManager.RegisterInitializer(0, cur, initializerFunc)
    41 if err != nil {
    42 panic(err)
    43 }
    44
    45 err = updateImplementation()
    46 if err != nil {
    47 panic(err)
    48 }
    49}
    50
    51// UpgradeImpl switches the active protocol fee implementation to a different version.
    52// This function allows seamless upgrades from one version to another without
    53// data migration or downtime.
    54//
    55// Security: Only admin or governance can perform upgrades.
    56// The new implementation must have been previously registered via RegisterInitializer.
    57//
    58// Parameters:
    59// - cur: Current realm context; callers use cross(cur) when crossing into this realm.
    60// - packagePath: registered implementation package path to activate
    61func UpgradeImpl(cur realm, packagePath string) {
    62 // Ensure only admin or governance can perform upgrades
    63 prev := cur.Previous()
    64 access.AssertIsAdminOrGovernance(prev.Address())
    65
    66 err := versionManager.ChangeImplementation(0, cur, packagePath)
    67 if err != nil {
    68 panic(err)
    69 }
    70
    71 err = updateImplementation()
    72 if err != nil {
    73 panic(err)
    74 }
    75}
    76
    77// GetImplementationPackagePath returns the package path of the currently active implementation.
    78//
    79// Returns:
    80// - packagePath: package path of the active implementation
    81func GetImplementationPackagePath() string {
    82 return versionManager.GetCurrentPackagePath()
    83}
    84

    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.