Kind Realm (renderable)
Name protocol_fee
Namespace gnoswap
Exported functions 29
Module gno.land/r/gnoswap/protocol_fee
gno 0.9 proxy.gno gno
⧉
1 package protocol_fee 2 3 // DistributeProtocolFee distributes accumulated protocol fees to DevOps and 4 // GovStaker, subject to the implementation's caller authorization and halt checks. 5 // 6 // Parameters: 7 // - cur: Current realm context; callers use cross(cur) when crossing into this realm. 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.
8
//
9 // Halt check: returns without distributing while the Withdraw halt scope is active.
10 func DistributeProtocolFee(cur realm) {
11 getImplementation().DistributeProtocolFee( 0 , cur)
12 }
13
14 // DistributeProtocolFeeByTokenPath distributes accumulated protocol fees reserved
15 // for one token path; an unreserved path has nothing to distribute.
16 //
17 // Parameters:
18 // - cur: Current realm context; callers use cross(cur) when crossing into this realm.
19 // - tokenPath: token contract path whose reserved fee balance should be distributed
20 //
21 // Halt check: returns without distributing while the Withdraw halt scope is active.
22 func DistributeProtocolFeeByTokenPath(cur realm, tokenPath string ) {
23 getImplementation().DistributeProtocolFeeByTokenPath( 0 , cur, tokenPath)
24 }
25
26 // SetDevOpsPct sets the share of protocol fees allocated to DevOps.
27 //
28 // Parameters:
29 // - cur: Current realm context; callers use cross(cur) when crossing into this realm.
30 // - pct: DevOps allocation in basis-point units, from 0 through 10000 inclusive (10000 = 100%)
31 //
32 // Halt check: reverts while the ProtocolFee halt scope is active.
33 func SetDevOpsPct(cur realm, pct int64 ) {
34 getImplementation().SetDevOpsPct( 0 , cur, pct)
35 }
36
37 // SetGovStakerPct sets the share of protocol fees allocated to GovStaker.
38 //
39 // Parameters:
40 // - cur: Current realm context; callers use cross(cur) when crossing into this realm.
41 // - pct: GovStaker allocation in basis-point units, from 0 through 10000 inclusive (10000 = 100%)
42 //
43 // Halt check: reverts while the ProtocolFee halt scope is active.
44 func SetGovStakerPct(cur realm, pct int64 ) {
45 getImplementation().SetGovStakerPct( 0 , cur, pct)
46 }
47
48 // AddToProtocolFee pulls an approved fee amount from an authorized protocol caller
49 // into protocol-fee accounting. Authorized callers are pool, position, router,
50 // and staker realms; direct transfers to this address do not register a fee.
51 //
52 // Parameters:
53 // - cur: Current realm context; callers use cross(cur) when crossing into this realm.
54 // - tokenPath: token contract path whose fee is being collected
55 // - amount: non-negative fee amount in the token's base units; zero performs no transfer
56 //
57 // Returns:
58 // - err: nil on success; errSpoofedRealm for a spoofed-realm call; errProtocolFeeHalted when protocol-fee collection is halted
59 //
60 // Halt check: returns errProtocolFeeHalted without transferring while the ProtocolFee halt scope is active.
61 func AddToProtocolFee(cur realm, tokenPath string , amount int64 ) error {
62 return getImplementation().AddToProtocolFee( 0 , cur, tokenPath, amount)
63 }
64
65 // AdvanceAccrualEpoch closes the current accrual epoch and returns the new one. Fees
66 // arriving from now on are bucketed under the returned epoch. Only gov/staker may call
67 // it, on every stake change.
68 //
69 // Parameters:
70 // - cur: Current realm context; callers use cross(cur) when crossing into this realm.
71 //
72 // Returns:
73 // - epoch: newly active non-negative accrual epoch used for subsequently collected GovStaker fees
74 func AdvanceAccrualEpoch(cur realm) int64 {
75 return getImplementation().AdvanceAccrualEpoch( 0 , cur)
76 }
77
78 // ConsumeAccrualBuckets returns and clears up to limit of the oldest pending buckets
79 // of tokenPath as parallel epoch and amount slices. A limit of zero or less consumes
80 // every pending bucket. Only gov/staker may call it.
81 //
82 // Parameters:
83 // - cur: Current realm context; callers use cross(cur) when crossing into this realm.
84 // - tokenPath: token contract path whose pending GovStaker accrual buckets are consumed
85 // - limit: maximum number of oldest buckets to consume; zero or negative consumes all pending buckets
86 //
87 // Returns:
88 // - epochs: consumed accrual epoch numbers in ascending epoch order
89 // - amounts: GovStaker fee amounts corresponding positionally to epochs, in token base units
90 func ConsumeAccrualBuckets(cur realm, tokenPath string , limit int ) ([] int64 , [] int64 ) {
91 return getImplementation().ConsumeAccrualBuckets( 0 , cur, tokenPath, limit)
92 }
93
94 // GetDevOpsPct returns the DevOps fee allocation in basis-point units.
95 //
96 // Returns:
97 // - pct: configured DevOps allocation from 0 through 10000 (10000 = 100%)
98 func GetDevOpsPct() int64 {
99 return getImplementation().GetDevOpsPct()
100 }
101
102 // GetGovStakerPct returns the GovStaker fee allocation in basis-point units.
103 //
104 // Returns:
105 // - pct: configured GovStaker allocation from 0 through 10000 (10000 = 100%)
106 func GetGovStakerPct() int64 {
107 return getImplementation().GetGovStakerPct()
108 }
109
110 // GetAccrualEpoch returns the accrual epoch fees are currently bucketed under.
111 //
112 // Returns:
113 // - epoch: current non-negative accrual epoch assigned to newly collected GovStaker fees
114 func GetAccrualEpoch() int64 {
115 return getImplementation().GetAccrualEpoch()
116 }
117
118 // GetAccrualPendingTokens returns the token paths that still own pending accrual buckets.
119 //
120 // Returns:
121 // - tokenPaths: token contract paths with at least one pending GovStaker accrual bucket
122 func GetAccrualPendingTokens() [] string {
123 return cloneStringSlice(getImplementation().GetAccrualPendingTokens())
124 }
125
126 // GetAccrualBuckets returns up to limit of the oldest pending buckets of tokenPath
127 // without clearing them. A limit of zero or less returns every pending bucket.
128 //
129 // Parameters:
130 // - tokenPath: token contract path whose pending GovStaker accrual buckets are queried
131 // - limit: maximum number of oldest buckets to return; zero or negative returns all pending buckets
132 //
133 // Returns:
134 // - epochs: selected accrual epoch numbers in ascending epoch order
135 // - amounts: GovStaker fee amounts corresponding positionally to epochs, in token base units
136 func GetAccrualBuckets(tokenPath string , limit int ) ([] int64 , [] int64 ) {
137 epochs, amounts := getImplementation().GetAccrualBuckets(tokenPath, limit)
138 return cloneInt64Slice(epochs), cloneInt64Slice(amounts)
139 }
140
141 // GetReservedTokens returns token paths reserved for distribution.
142 //
143 // Returns:
144 // - tokenPaths: token paths reserved for distribution
145 func GetReservedTokens() [] string {
146 return cloneStringSlice(getImplementation().GetReservedTokens())
147 }
148
149 // GetAccuTransfersToGovStaker returns accumulated transfers to GovStaker.
150 //
151 // Returns:
152 // - transfers: map of token paths to accumulated amounts
153 func GetAccuTransfersToGovStaker() map [ string ] int64 {
154 return cloneStringInt64Map(getImplementation().GetAccuTransfersToGovStaker())
155 }
156
157 // GetAccuTransfersToDevOps returns accumulated transfers to DevOps.
158 //
159 // Returns:
160 // - transfers: map of token paths to accumulated amounts
161 func GetAccuTransfersToDevOps() map [ string ] int64 {
162 return cloneStringInt64Map(getImplementation().GetAccuTransfersToDevOps())
163 }
164
165 // GetAccuTransferToGovStakerByTokenPath returns accumulated GovStaker transfer for a token.
166 //
167 // Parameters:
168 // - tokenPath: path of the token
169 //
170 // Returns:
171 // - amount: accumulated transfer amount
172 func GetAccuTransferToGovStakerByTokenPath(tokenPath string ) int64 {
173 return getImplementation().GetAccuTransferToGovStakerByTokenPath(tokenPath)
174 }
175
176 // GetAccuTransferToDevOpsByTokenPath returns accumulated DevOps transfer for a token.
177 //
178 // Parameters:
179 // - tokenPath: path of the token
180 //
181 // Returns:
182 // - amount: accumulated transfer amount
183 func GetAccuTransferToDevOpsByTokenPath(tokenPath string ) int64 {
184 return getImplementation().GetAccuTransferToDevOpsByTokenPath(tokenPath)
185 }
186
187 // GetActualDistributedToGovStaker returns actual transfers completed to GovStaker.
188 //
189 // Returns:
190 // - transfers: map of token paths to actual distributed amounts
191 func GetActualDistributedToGovStaker() map [ string ] int64 {
192 return cloneStringInt64Map(getImplementation().GetActualDistributedToGovStaker())
193 }
194
195 // GetActualDistributedToDevOps returns actual transfers completed to DevOps.
196 //
197 // Returns:
198 // - transfers: map of token paths to actual distributed amounts
199 func GetActualDistributedToDevOps() map [ string ] int64 {
200 return cloneStringInt64Map(getImplementation().GetActualDistributedToDevOps())
201 }
202
203 // GetActualDistributedToGovStakerByTokenPath returns actual GovStaker transfer for a token.
204 //
205 // Parameters:
206 // - tokenPath: path of the token
207 //
208 // Returns:
209 // - amount: actual distributed amount for the token
210 func GetActualDistributedToGovStakerByTokenPath(tokenPath string ) int64 {
211 return getImplementation().GetActualDistributedToGovStakerByTokenPath(tokenPath)
212 }
213
214 // GetActualDistributedToDevOpsByTokenPath returns actual DevOps transfer for a token.
215 //
216 // Parameters:
217 // - tokenPath: path of the token
218 //
219 // Returns:
220 // - amount: actual distributed amount for the token
221 func GetActualDistributedToDevOpsByTokenPath(tokenPath string ) int64 {
222 return getImplementation().GetActualDistributedToDevOpsByTokenPath(tokenPath)
223 }
224
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.