Skip to content Search Apps Documentation Source Content File Folder Download Copy Actions State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

types.gno

27.86 Kb · 649 lines
  1package staker
  2
  3import (
  4	"gno.land/p/gnoswap/uint256/v1"
  5	rotree "gno.land/p/nt/bptree/rotree/v0"
  6	bptree "gno.land/p/nt/bptree/v0"
  7)
  8
  9// Main interface that combines all sub-interfaces
 10type IGovStaker interface {
 11	IGovStakerDelegation
 12	IGovStakerReward
 13	IGovStakerGetter
 14	IGovStakerAdmin
 15	Render(path string) string
 16}
 17
 18// Delegation operations interface
 19//
 20// Mutating methods take `_ int, rlm realm` so the realm token is threaded
 21// from the proxy entry points down to the cross-realm token transfers and
 22// store writes performed inside each implementation. The `_ int` sentinel
 23// surfaces at every call site as a literal `0`, making the realm threading
 24// visible to readers.
 25type IGovStakerDelegation interface {
 26	// Main delegation operations
 27	// Delegate moves GNS into delegation and assigns the corresponding xGNS voting power.
 28	//
 29	// Parameters:
 30	//   - _: leading realm-call discriminator; callers pass 0 for the forwarded implementation call
 31	//   - rlm: propagated current realm context validated before token transfers and state updates
 32	//   - to: address that receives the delegated voting power
 33	//   - amount: positive GNS amount to delegate
 34	//   - referrer: optional referral identifier associated with the delegation
 35	//
 36	// Returns:
 37	//   - int64: amount delegated and represented as xGNS
 38	Delegate(_ int, rlm realm, to address, amount int64, referrer string) int64
 39	// Undelegate removes voting power from an existing delegatee and starts the
 40	// undelegation lockup for the returned GNS.
 41	//
 42	// Parameters:
 43	//   - _: leading realm-call discriminator; callers pass 0 for the forwarded implementation call
 44	//   - rlm: propagated current realm context validated before token and state updates
 45	//   - from: delegatee address from which the caller removes delegation
 46	//   - amount: positive xGNS amount to undelegate
 47	//
 48	// Returns:
 49	//   - int64: amount moved from active delegation into undelegation lockup
 50	Undelegate(_ int, rlm realm, from address, amount int64) int64
 51	// Redelegate moves voting power from one delegatee to another without a
 52	// user-facing undelegation lockup.
 53	//
 54	// Parameters:
 55	//   - _: leading realm-call discriminator; callers pass 0 for the forwarded implementation call
 56	//   - rlm: propagated current realm context validated before token and state updates
 57	//   - delegatee: current delegatee address whose delegation is reduced
 58	//   - newDelegatee: destination address that receives the redelegated amount
 59	//   - amount: positive xGNS amount to move between delegatees
 60	//
 61	// Returns:
 62	//   - int64: amount moved from the current delegatee to the new delegatee
 63	Redelegate(_ int, rlm realm, delegatee, newDelegatee address, amount int64) int64
 64	// CollectUndelegatedGns releases GNS whose undelegation lockup has expired.
 65	//
 66	// Parameters:
 67	//   - _: leading realm-call discriminator; callers pass 0 for the forwarded implementation call
 68	//   - rlm: propagated current realm context validated before token and state updates
 69	//
 70	// Returns:
 71	//   - int64: amount of unlocked GNS collected by the caller
 72	CollectUndelegatedGns(_ int, rlm realm) int64
 73}
 74
 75// Reward management interface
 76type IGovStakerReward interface {
 77	// Reward collection
 78	// CollectReward settles the caller's GNS emission and all known protocol-fee
 79	// token rewards.
 80	//
 81	// Parameters:
 82	//   - _: leading realm-call discriminator; callers pass 0 for the forwarded implementation call
 83	//   - rlm: propagated current realm context validated before reward transfers and state updates
 84	CollectReward(_ int, rlm realm)
 85	// CollectEmissionReward settles only the caller's accumulated GNS emission reward.
 86	//
 87	// Parameters:
 88	//   - _: leading realm-call discriminator; callers pass 0 for the forwarded implementation call
 89	//   - rlm: propagated current realm context validated before reward transfer and state updates
 90	CollectEmissionReward(_ int, rlm realm)
 91	// CollectProtocolFeeReward settles one registered protocol-fee token reward
 92	// for the caller.
 93	//
 94	// Parameters:
 95	//   - _: leading realm-call discriminator; callers pass 0 for the forwarded implementation call
 96	//   - rlm: propagated current realm context validated before reward transfer and state updates
 97	//   - tokenPath: registered token path whose accumulated reward is settled
 98	CollectProtocolFeeReward(_ int, rlm realm, tokenPath string)
 99	// CollectRewardFromLaunchPad settles both reward streams for a registered
100	// launchpad project wallet.
101	//
102	// Parameters:
103	//   - _: leading realm-call discriminator; callers pass 0 for the forwarded implementation call
104	//   - rlm: propagated current realm context validated before launchpad authorization and reward transfers
105	//   - to: registered launchpad project wallet that receives the rewards
106	CollectRewardFromLaunchPad(_ int, rlm realm, to address)
107	// CollectEmissionRewardFromLaunchPad settles only the emission reward for a
108	// registered launchpad project wallet.
109	//
110	// Parameters:
111	//   - _: leading realm-call discriminator; callers pass 0 for the forwarded implementation call
112	//   - rlm: propagated current realm context validated before launchpad authorization and reward transfer
113	//   - to: registered launchpad project wallet that receives the emission reward
114	CollectEmissionRewardFromLaunchPad(_ int, rlm realm, to address)
115	// CollectProtocolFeeRewardFromLaunchPad settles one protocol-fee token reward
116	// for a registered launchpad project wallet.
117	//
118	// Parameters:
119	//   - _: leading realm-call discriminator; callers pass 0 for the forwarded implementation call
120	//   - rlm: propagated current realm context validated before launchpad authorization and reward transfer
121	//   - to: registered launchpad project wallet that receives the token reward
122	//   - tokenPath: registered token path whose accumulated reward is settled
123	CollectProtocolFeeRewardFromLaunchPad(_ int, rlm realm, to address, tokenPath string)
124	// SetAmountByProjectWallet adjusts the launchpad-backed stake amount and
125	// corresponding xGNS balance for a project wallet.
126	//
127	// Parameters:
128	//   - _: leading realm-call discriminator; callers pass 0 for the forwarded implementation call
129	//   - rlm: propagated current realm context validated before launchpad authorization and state updates
130	//   - addr: project wallet address whose launchpad-backed stake is adjusted
131	//   - amount: stake amount delta passed to the launchpad reward accounting
132	//   - add: true to add stake and mint xGNS; false to remove stake and burn xGNS
133	SetAmountByProjectWallet(_ int, rlm realm, addr address, amount int64, add bool)
134}
135
136// Getter interface for read operations
137type IGovStakerGetter interface {
138	// Store data getters
139	// GetUnDelegationLockupPeriod returns the configured undelegation cooldown.
140	//
141	// Returns:
142	//   - int64: undelegation lockup duration in seconds
143	GetUnDelegationLockupPeriod() int64
144
145	// Delegation getters
146	// GetTotalxGnsSupply returns total xGNS supply, including xGNS held by the
147	// launchpad.
148	//
149	// Returns:
150	//   - int64: total xGNS supply used as the governance quorum base
151	GetTotalxGnsSupply() int64
152	// GetTotalDelegated returns the amount currently delegated for governance
153	// voting power.
154	//
155	// Returns:
156	//   - int64: total active delegated xGNS amount
157	GetTotalDelegated() int64
158	// GetTotalLockedAmount returns GNS held by the staker contract for active
159	// delegations and not-yet-collected undelegations.
160	//
161	// Returns:
162	//   - int64: total locked GNS amount
163	GetTotalLockedAmount() int64
164	// GetDelegations returns a read-only tree of all delegations keyed by their
165	// decimal-string IDs.
166	//
167	// Returns:
168	//   - *rotree.ReadOnlyTree: read-only delegation index whose entries are cloned for callers
169	GetDelegations() *rotree.ReadOnlyTree
170	// ExistsDelegation checks whether a delegation record exists.
171	//
172	// Parameters:
173	//   - delegationID: unique delegation identifier to look up
174	//
175	// Returns:
176	//   - bool: true when delegationID has a stored record; false otherwise
177	ExistsDelegation(delegationID int64) bool
178	// GetDelegatorDelegations returns a read-only tree for one delegator, keyed
179	// by delegatee address.
180	//
181	// Parameters:
182	//   - delegator: address whose delegatee mappings are requested
183	//
184	// Returns:
185	//   - *rotree.ReadOnlyTree: delegatee-to-delegation-ID tree, or nil when the delegator has no delegations
186	GetDelegatorDelegations(delegator address) *rotree.ReadOnlyTree
187	// GetUserDelegationIDs returns delegation IDs for one delegator-delegatee
188	// pair.
189	//
190	// Parameters:
191	//   - delegator: address that owns the delegation
192	//   - delegatee: address receiving the delegation
193	//
194	// Returns:
195	//   - []int64: stored delegation IDs for the pair, or an empty list when none exist
196	GetUserDelegationIDs(delegator address, delegatee address) []int64
197	// HasDelegationSnapshotsKey reports whether total delegation history has
198	// been initialized in storage.
199	//
200	// Returns:
201	//   - bool: true when the total delegation history store key exists; false otherwise
202	HasDelegationSnapshotsKey() bool
203	// GetTotalDelegationAmountAtSnapshot finds the latest total delegation
204	// history value at or before a Unix timestamp.
205	//
206	// Parameters:
207	//   - snapshotTime: Unix timestamp at which to resolve historical total delegation
208	//
209	// Returns:
210	//   - int64: total delegated amount from the latest qualifying history entry
211	//   - bool: true when a qualifying history entry exists; false when history has no such entry
212	GetTotalDelegationAmountAtSnapshot(snapshotTime int64) (int64, bool)
213	// GetUserDelegationAmountAtSnapshot finds one user's latest delegation
214	// history value at or before a Unix timestamp.
215	//
216	// Parameters:
217	//   - userAddr: user's address whose delegation history is searched
218	//   - snapshotTime: Unix timestamp at which to resolve the user's historical delegation
219	//
220	// Returns:
221	//   - int64: user's delegated amount from the latest qualifying history entry
222	//   - bool: true when a qualifying history entry exists; false otherwise
223	GetUserDelegationAmountAtSnapshot(userAddr address, snapshotTime int64) (int64, bool)
224
225	// Reward getters
226	// GetClaimableRewardByAddress computes current claimable emission and
227	// protocol-fee rewards for an address reward ID.
228	//
229	// Parameters:
230	//   - addr: staker address whose reward ID is queried
231	//
232	// Returns:
233	//   - int64: claimable GNS emission reward amount
234	//   - map[string]int64: claimable protocol-fee amounts keyed by token path
235	//   - error: nil when both reward streams are computed; otherwise the reward-accounting error
236	GetClaimableRewardByAddress(addr address) (int64, map[string]int64, error)
237	// GetClaimableRewardByLaunchpad computes rewards for a launchpad project
238	// wallet's launchpad-specific reward ID.
239	//
240	// Parameters:
241	//   - addr: registered launchpad project wallet address
242	//
243	// Returns:
244	//   - int64: claimable GNS emission reward amount
245	//   - map[string]int64: claimable protocol-fee amounts keyed by token path
246	//   - error: nil when both reward streams are computed; otherwise the reward-accounting error
247	GetClaimableRewardByLaunchpad(addr address) (int64, map[string]int64, error)
248	// GetClaimableRewardByRewardID computes current rewards for an explicit
249	// reward identifier.
250	//
251	// Parameters:
252	//   - rewardID: staker or launchpad reward-state identifier
253	//
254	// Returns:
255	//   - int64: claimable GNS emission reward amount
256	//   - map[string]int64: claimable protocol-fee amounts keyed by token path
257	//   - error: nil when both reward streams are computed; otherwise the reward-accounting error
258	GetClaimableRewardByRewardID(rewardID string) (int64, map[string]int64, error)
259
260	// Launchpad getters
261	// GetLaunchpadProjectDeposit returns a project's recorded launchpad deposit.
262	//
263	// Parameters:
264	//   - projectAddr: project address identifier used to derive the launchpad reward key
265	//
266	// Returns:
267	//   - int64: stored project deposit amount
268	//   - bool: true when a deposit record exists for projectAddr; false otherwise
269	GetLaunchpadProjectDeposit(projectAddr string) (int64, bool)
270
271	// Withdraw getters
272	// GetDelegationWithdrawCount returns the number of pending withdrawal
273	// records attached to a delegation.
274	//
275	// Parameters:
276	//   - delegationID: delegation whose withdrawal list is counted
277	//
278	// Returns:
279	//   - int: number of withdrawal records, or 0 when the delegation is absent
280	GetDelegationWithdrawCount(delegationID int64) int
281	// GetDelegationWithdraws returns a slice of a delegation's withdrawal list.
282	//
283	// Parameters:
284	//   - delegationID: delegation whose withdrawals are requested
285	//   - offset: non-negative zero-based starting index in the withdrawal list
286	//   - count: non-negative maximum number of withdrawals to include
287	//
288	// Returns:
289	//   - []DelegationWithdraw: withdrawals in the requested range, or an empty slice when the delegation or range is absent
290	//   - error: nil when the lookup completes; an unknown delegation yields an empty slice
291	GetDelegationWithdraws(delegationID int64, offset, count int) ([]DelegationWithdraw, error)
292	// GetCollectableWithdrawAmount sums all withdrawal amounts currently
293	// collectable for a delegation.
294	//
295	// Parameters:
296	//   - delegationID: delegation whose expired withdrawals are summed
297	//
298	// Returns:
299	//   - int64: total GNS amount collectable now, or 0 when none is collectable
300	GetCollectableWithdrawAmount(delegationID int64) int64
301
302	// Protocol fee reward getters
303	// GetProtocolFeeAccumulatedX128PerStake returns the per-stake protocol-fee
304	// accumulator for a token path, scaled by 2^128.
305	//
306	// Parameters:
307	//   - tokenPath: registered token path whose accumulator is queried
308	//
309	// Returns:
310	//   - *uint256.Uint: Q128-scaled accumulated fee per stake, zero when the token has no folded fee
311	GetProtocolFeeAccumulatedX128PerStake(tokenPath string) *uint256.Uint
312	// GetProtocolFeeAmount returns the total protocol fee folded for a token
313	// path.
314	//
315	// Parameters:
316	//   - tokenPath: registered token path whose folded fee amount is queried
317	//
318	// Returns:
319	//   - int64: total folded protocol-fee amount, or 0 when the token has no accumulator
320	GetProtocolFeeAmount(tokenPath string) int64
321	// GetProtocolFeeAccumulatedTimestamp returns the last timestamp at which
322	// protocol-fee accrual state advanced.
323	//
324	// Returns:
325	//   - int64: Unix timestamp of the latest protocol-fee accumulation update
326	GetProtocolFeeAccumulatedTimestamp() int64
327
328	// Emission reward getters
329	// GetEmissionAccumulatedX128PerStake returns the accumulated GNS emission
330	// reward per stake, scaled by 2^128.
331	//
332	// Returns:
333	//   - *uint256.Uint: Q128-scaled accumulated emission per stake
334	GetEmissionAccumulatedX128PerStake() *uint256.Uint
335	// GetEmissionDistributedAmount returns the total GNS emission distributed
336	// through the staker reward manager.
337	//
338	// Returns:
339	//   - int64: cumulative distributed GNS emission amount
340	GetEmissionDistributedAmount() int64
341	// GetEmissionAccumulatedTimestamp returns the last timestamp at which
342	// emission reward accrual state advanced.
343	//
344	// Returns:
345	//   - int64: Unix timestamp of the latest emission accumulation update
346	GetEmissionAccumulatedTimestamp() int64
347}
348
349// Admin interface for administrative functions
350type IGovStakerAdmin interface {
351	// CleanStakerDelegationSnapshotByAdmin removes delegation-history entries
352	// older than a validated timestamp cutoff.
353	//
354	// Parameters:
355	//   - _: leading realm-call discriminator; callers pass 0 for the forwarded implementation call
356	//   - rlm: propagated current realm context validated before administrative state updates
357	//   - snapshotTime: Unix timestamp cutoff before which eligible history entries are removed
358	//   - target: address whose user delegation history is cleaned
359	CleanStakerDelegationSnapshotByAdmin(_ int, rlm realm, snapshotTime int64, target address)
360	// SetUnDelegationLockupPeriodByAdmin updates the duration used by future
361	// undelegation withdrawals.
362	//
363	// Parameters:
364	//   - _: leading realm-call discriminator; callers pass 0 for the forwarded implementation call
365	//   - rlm: propagated current realm context validated before the administrative store write
366	//   - period: non-negative undelegation lockup duration in seconds
367	SetUnDelegationLockupPeriodByAdmin(_ int, rlm realm, period int64)
368}
369
370// IGovStakerStore mirrors the mutating-method realm-threading convention used
371// by the public IGovStaker* interfaces above. Setters take `_ int, rlm realm`
372// so KV-store writes execute under the proxy realm — the only address with
373// write access to the shared store.
374type IGovStakerStore interface {
375	// Basic configuration
376	// HasUnDelegationLockupPeriodStoreKey reports whether the lockup duration is initialized.
377	//
378	// Returns:
379	//   - bool: true when the undelegation lockup period store key exists
380	HasUnDelegationLockupPeriodStoreKey() bool
381	// GetUnDelegationLockupPeriod returns the persisted undelegation lockup duration.
382	//
383	// Returns:
384	//   - int64: configured lockup duration in seconds
385	GetUnDelegationLockupPeriod() int64
386	// SetUnDelegationLockupPeriod persists the undelegation lockup duration.
387	//
388	// Parameters:
389	//   - _: leading realm-call discriminator; callers pass 0 for the forwarded store write
390	//   - rlm: propagated current realm context required by the KV store
391	//   - period: lockup duration in seconds
392	//
393	// Returns:
394	//   - error: nil when stored; otherwise the KV-store error, including a spoofed realm context
395	SetUnDelegationLockupPeriod(_ int, rlm realm, period int64) error
396
397	// HasTotalDelegatedAmountStoreKey reports whether total active delegation is initialized.
398	//
399	// Returns:
400	//   - bool: true when the total delegated amount store key exists
401	HasTotalDelegatedAmountStoreKey() bool
402	// GetTotalDelegatedAmount returns the persisted total active delegation amount.
403	//
404	// Returns:
405	//   - int64: total delegated xGNS amount
406	GetTotalDelegatedAmount() int64
407	// SetTotalDelegatedAmount persists the total active delegation amount.
408	//
409	// Parameters:
410	//   - _: leading realm-call discriminator; callers pass 0 for the forwarded store write
411	//   - rlm: propagated current realm context required by the KV store
412	//   - amount: total active delegated xGNS amount to store
413	//
414	// Returns:
415	//   - error: nil when stored; otherwise the KV-store error, including a spoofed realm context
416	SetTotalDelegatedAmount(_ int, rlm realm, amount int64) error
417
418	// HasTotalLockedAmountStoreKey reports whether total locked GNS is initialized.
419	//
420	// Returns:
421	//   - bool: true when the total locked amount store key exists
422	HasTotalLockedAmountStoreKey() bool
423	// GetTotalLockedAmount returns the persisted total GNS held by the staker.
424	//
425	// Returns:
426	//   - int64: total locked GNS amount
427	GetTotalLockedAmount() int64
428	// SetTotalLockedAmount persists the total locked GNS amount.
429	//
430	// Parameters:
431	//   - _: leading realm-call discriminator; callers pass 0 for the forwarded store write
432	//   - rlm: propagated current realm context required by the KV store
433	//   - amount: total locked GNS amount to store
434	//
435	// Returns:
436	//   - error: nil when stored; otherwise the KV-store error, including a spoofed realm context
437	SetTotalLockedAmount(_ int, rlm realm, amount int64) error
438
439	// Delegation management
440	// HasDelegation reports whether a delegation record exists for an ID.
441	//
442	// Parameters:
443	//   - id: delegation identifier to look up
444	//
445	// Returns:
446	//   - bool: true when a delegation is stored under id; false otherwise
447	HasDelegation(id int64) bool
448	// GetDelegation retrieves one delegation record.
449	//
450	// Parameters:
451	//   - id: delegation identifier to look up
452	//
453	// Returns:
454	//   - *Delegation: stored delegation pointer, or nil when id is absent
455	//   - bool: true when a delegation record exists and has the expected type; false otherwise
456	GetDelegation(id int64) (*Delegation, bool)
457	// SetDelegation stores a delegation under its identifier.
458	//
459	// Parameters:
460	//   - _: leading realm-call discriminator; callers pass 0 for the forwarded store write
461	//   - rlm: propagated current realm context required by the KV store
462	//   - id: delegation identifier used as the storage key
463	//   - delegation: delegation record to store
464	//
465	// Returns:
466	//   - error: nil when stored; otherwise the KV-store error, including a spoofed realm context
467	SetDelegation(_ int, rlm realm, id int64, delegation *Delegation) error
468	// RemoveDelegation deletes a delegation record and its storage entry.
469	//
470	// Parameters:
471	//   - _: leading realm-call discriminator; callers pass 0 for the forwarded store write
472	//   - rlm: propagated current realm context required by the KV store
473	//   - id: delegation identifier to remove
474	//
475	// Returns:
476	//   - error: nil when the store write succeeds; otherwise the KV-store error, including a spoofed realm context
477	RemoveDelegation(_ int, rlm realm, id int64) error
478
479	// HasDelegationsStoreKey reports whether the all-delegations tree is initialized.
480	//
481	// Returns:
482	//   - bool: true when the delegations store key exists
483	HasDelegationsStoreKey() bool
484	// SetDelegations replaces the persisted all-delegations tree.
485	//
486	// Parameters:
487	//   - _: leading realm-call discriminator; callers pass 0 for the forwarded store write
488	//   - rlm: propagated current realm context required by the KV store
489	//   - delegations: BPTree containing delegation records keyed by delegation ID
490	//
491	// Returns:
492	//   - error: nil when stored; otherwise the KV-store error, including a spoofed realm context
493	SetDelegations(_ int, rlm realm, delegations *bptree.BPTree) error
494	// GetAllDelegations returns the persisted tree containing every delegation.
495	//
496	// Returns:
497	//   - *bptree.BPTree: all-delegations tree keyed by decimal-string delegation ID
498	GetAllDelegations() *bptree.BPTree
499
500	// HasDelegationCounterStoreKey reports whether the next-delegation-ID counter is initialized.
501	//
502	// Returns:
503	//   - bool: true when the delegation counter store key exists
504	HasDelegationCounterStoreKey() bool
505	// GetDelegationCounter returns the persisted counter used to allocate delegation IDs.
506	//
507	// Returns:
508	//   - *Counter: mutable delegation-ID counter
509	GetDelegationCounter() *Counter
510	// SetDelegationCounter persists the delegation-ID counter.
511	//
512	// Parameters:
513	//   - _: leading realm-call discriminator; callers pass 0 for the forwarded store write
514	//   - rlm: propagated current realm context required by the KV store
515	//   - counter: delegation-ID counter to store
516	//
517	// Returns:
518	//   - error: nil when stored; otherwise the KV-store error, including a spoofed realm context
519	SetDelegationCounter(_ int, rlm realm, counter *Counter) error
520
521	// Total delegation history (timestamp -> int64)
522	// HasTotalDelegationHistoryStoreKey reports whether cumulative total delegation history is initialized.
523	//
524	// Returns:
525	//   - bool: true when the total-delegation-history store key exists
526	HasTotalDelegationHistoryStoreKey() bool
527	// GetTotalDelegationHistory returns timestamp-keyed cumulative total delegation history.
528	//
529	// Returns:
530	//   - *UintTree: total delegation history tree mapping Unix timestamps to int64 amounts
531	GetTotalDelegationHistory() *UintTree
532	// SetTotalDelegationHistory persists timestamp-keyed cumulative total delegation history.
533	//
534	// Parameters:
535	//   - _: leading realm-call discriminator; callers pass 0 for the forwarded store write
536	//   - rlm: propagated current realm context required by the KV store
537	//   - history: timestamp-to-total-delegation tree to store
538	//
539	// Returns:
540	//   - error: nil when stored; otherwise the KV-store error, including a spoofed realm context
541	SetTotalDelegationHistory(_ int, rlm realm, history *UintTree) error
542
543	// User delegation history (address -> *UintTree[timestamp -> int64])
544	// HasUserDelegationHistoryStoreKey reports whether per-user delegation history is initialized.
545	//
546	// Returns:
547	//   - bool: true when the user-delegation-history store key exists
548	HasUserDelegationHistoryStoreKey() bool
549	// GetUserDelegationHistory returns the composite-keyed per-user delegation history tree.
550	//
551	// Returns:
552	//   - *bptree.BPTree: history tree keyed by address and timestamp
553	GetUserDelegationHistory() *bptree.BPTree
554	// SetUserDelegationHistory persists the composite-keyed per-user delegation history tree.
555	//
556	// Parameters:
557	//   - _: leading realm-call discriminator; callers pass 0 for the forwarded store write
558	//   - rlm: propagated current realm context required by the KV store
559	//   - history: address-and-timestamp delegation history tree to store
560	//
561	// Returns:
562	//   - error: nil when stored; otherwise the KV-store error, including a spoofed realm context
563	SetUserDelegationHistory(_ int, rlm realm, history *bptree.BPTree) error
564
565	// Manager states
566	// HasEmissionRewardManagerStoreKey reports whether the emission reward manager is initialized.
567	//
568	// Returns:
569	//   - bool: true when the emission reward manager store key exists
570	HasEmissionRewardManagerStoreKey() bool
571	// GetEmissionRewardManager returns the persisted emission reward manager.
572	//
573	// Returns:
574	//   - *EmissionRewardManager: emission reward accounting manager
575	GetEmissionRewardManager() *EmissionRewardManager
576	// SetEmissionRewardManager persists the emission reward manager.
577	//
578	// Parameters:
579	//   - _: leading realm-call discriminator; callers pass 0 for the forwarded store write
580	//   - rlm: propagated current realm context required by the KV store
581	//   - manager: emission reward manager state to store
582	//
583	// Returns:
584	//   - error: nil when stored; otherwise the KV-store error, including a spoofed realm context
585	SetEmissionRewardManager(_ int, rlm realm, manager *EmissionRewardManager) error
586
587	// HasProtocolFeeRewardManagerStoreKey reports whether protocol-fee reward state is initialized.
588	//
589	// Returns:
590	//   - bool: true when the protocol-fee reward manager store key exists
591	HasProtocolFeeRewardManagerStoreKey() bool
592	// GetProtocolFeeRewardManager returns the persisted protocol-fee reward manager.
593	//
594	// Returns:
595	//   - *ProtocolFeeRewardManager: protocol-fee reward accounting manager
596	GetProtocolFeeRewardManager() *ProtocolFeeRewardManager
597	// SetProtocolFeeRewardManager persists the protocol-fee reward manager.
598	//
599	// Parameters:
600	//   - _: leading realm-call discriminator; callers pass 0 for the forwarded store write
601	//   - rlm: propagated current realm context required by the KV store
602	//   - manager: protocol-fee reward manager state to store
603	//
604	// Returns:
605	//   - error: nil when stored; otherwise the KV-store error, including a spoofed realm context
606	SetProtocolFeeRewardManager(_ int, rlm realm, manager *ProtocolFeeRewardManager) error
607
608	// HasDelegationManagerStoreKey reports whether delegation-manager state is initialized.
609	//
610	// Returns:
611	//   - bool: true when the delegation manager store key exists
612	HasDelegationManagerStoreKey() bool
613	// GetDelegationManager returns the persisted delegation manager.
614	//
615	// Returns:
616	//   - *DelegationManager: delegation-to-address index manager
617	GetDelegationManager() *DelegationManager
618	// SetDelegationManager persists the delegation manager.
619	//
620	// Parameters:
621	//   - _: leading realm-call discriminator; callers pass 0 for the forwarded store write
622	//   - rlm: propagated current realm context required by the KV store
623	//   - manager: delegation manager state to store
624	//
625	// Returns:
626	//   - error: nil when stored; otherwise the KV-store error, including a spoofed realm context
627	SetDelegationManager(_ int, rlm realm, manager *DelegationManager) error
628
629	// HasLaunchpadProjectDepositsStoreKey reports whether launchpad project deposits are initialized.
630	//
631	// Returns:
632	//   - bool: true when the launchpad-project-deposits store key exists
633	HasLaunchpadProjectDepositsStoreKey() bool
634	// GetLaunchpadProjectDeposits returns the persisted launchpad project deposit state.
635	//
636	// Returns:
637	//   - *LaunchpadProjectDeposits: project-address-to-deposit state
638	GetLaunchpadProjectDeposits() *LaunchpadProjectDeposits
639	// SetLaunchpadProjectDeposits persists launchpad project deposit state.
640	//
641	// Parameters:
642	//   - _: leading realm-call discriminator; callers pass 0 for the forwarded store write
643	//   - rlm: propagated current realm context required by the KV store
644	//   - deposits: launchpad project deposit state to store
645	//
646	// Returns:
647	//   - error: nil when stored; otherwise the KV-store error, including a spoofed realm context
648	SetLaunchpadProjectDeposits(_ int, rlm realm, deposits *LaunchpadProjectDeposits) error
649}