1package protocol_fee23import (4 prbac "gno.land/p/gnoswap/rbac/v1"5 ufmt "gno.land/p/nt/ufmt/v0"67 "gno.land/r/gnoswap/access/v1"8)910// assertIsPoolOrPositionOrRouterOrStaker panics if the caller is not the pool, router, or staker contract.11func assertIsPoolOrPositionOrRouterOrStaker(caller address) {12 if access.IsAuthorized(prbac.ROLE_POOL.String(), caller) ||13 access.IsAuthorized(prbac.ROLE_POSITION.String(), caller) ||14 access.IsAuthorized(prbac.ROLE_ROUTER.String(), caller) ||15 access.IsAuthorized(prbac.ROLE_STAKER.String(), caller) {16 return17 }1819 panic(ufmt.Errorf("unauthorized: caller %s is not pool or position or router or staker", caller))20}2122// assertIsAdminOrGovStaker panics if the caller is not admin or gov/staker.23func assertIsAdminOrGovStaker(caller address) {24 if access.IsAuthorized(prbac.ROLE_ADMIN.String(), caller) {25 return26 }2728 if access.IsAuthorized(prbac.ROLE_GOV_STAKER.String(), caller) {29 return30 }3132 panic(ufmt.Errorf("unauthorized: caller %s is not admin or gov/staker", caller))33}3435// assertIsValidPercent panics if the percentage is invalid (not between 0-10000).36func assertIsValidPercent(pct int64) {37 if pct > 10000 {38 panic(makeErrorWithDetail(39 errInvalidPct,40 ufmt.Sprintf("pct(%d) should not be bigger than 10000", pct),41 ))42 }4344 if pct < 0 {45 panic(makeErrorWithDetail(46 errInvalidPct,47 ufmt.Sprintf("pct(%d) should not be smaller than 0", pct),48 ))49 }50}5152func assertNotImplementYet() {53 panic("NotImplementYet")54}55NewProtocolFeeStateBy(protocolFeeStore 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}) *gno.land/r/gnoswap/protocol_fee/v1.protocolFeeState
NewProtocolFeeV1(protocolFeeStore 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}) interface {AddToProtocolFee func(int, .uverse.realm, string, int64) .uverse.error; AdvanceAccrualEpoch func(int, .uverse.realm) int64; ConsumeAccrualBuckets func(int, .uverse.realm, string, int) ([]int64, []int64); DistributeProtocolFee func(int, .uverse.realm); DistributeProtocolFeeByTokenPath func(int, .uverse.realm, string); GetAccrualBuckets func(string, int) ([]int64, []int64); GetAccrualEpoch func() int64; GetAccrualPendingTokens func() []string; GetAccuTransferToDevOpsByTokenPath func(string) int64; GetAccuTransferToGovStakerByTokenPath func(string) int64; GetAccuTransfersToDevOps func() map[string]int64; GetAccuTransfersToGovStaker func() map[string]int64; GetActualDistributedToDevOps func() map[string]int64; GetActualDistributedToDevOpsByTokenPath func(string) int64; GetActualDistributedToGovStaker func() map[string]int64; GetActualDistributedToGovStakerByTokenPath func(string) int64; GetDevOpsPct func() int64; GetGovStakerPct func() int64; GetReservedTokens func() []string; Render func(string) string; SetDevOpsPct func(int, .uverse.realm, int64); SetGovStakerPct func(int, .uverse.realm, int64)}
Signatures reconstructed verbatim from vm/qfuncs — interface params keep their inline definitions.
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.