router source realm
Package router provides swap routing and execution across GnoSwap liquidity pools.
View source
Router
Swap routing engine for optimal trade execution across pools.
Overview
Router handles swap execution across multiple pools, finding optimal paths and managing slippage protection for traders.
Gnoweb
The root Render("") delegates to the active implementation. It exposes separate
status and read-only swap-fee sections. Native Gnoweb execution forms show
one user-facing swap action per page:
"":ExactInSingleSwapRoute"swap/exact-in":ExactInSwapRoute"swap/exact-out-single":ExactOutSingleSwapRoute"swap/exact-out":ExactOutSwapRoute
Input placeholders show token-key, route, and percentage examples without
separate explanatory paragraphs. Token amounts are integer base units.
Set amountOutMin or amountInMax for slippage
protection, use a future Unix deadline, and set multi-route quoteArr
percentages to sum to 100. Approve each input GRC20 token for the router realm
before swapping. The single-route price limit accepts sqrtPriceLimitX96 as a
base-10 Q64.96 square-root price; 0 disables it.
No privileged fee-setting form, guidance route, or navigation link is exposed.
SetSwapFee itself is unchanged. No internal callback form is exposed.
Unsupported render paths, including "fee", return 404.
Configuration
- Router Fee: 15 bps (0.15%) by default on output tokens; configurable by admin/governance from 0 through 1000 bps (0–10%)
- Max Hops: 3 pools per route
- Deadline Buffer: 5-30 minutes recommended for live swaps
Core Functions
ExactInSwapRoute
Swaps an exact input amount for output, subject to a minimum net output.
- Fixed input, variable output
- The returned output is after the router fee
- Reverts if output < amountOutMin
- Supports multi-hop routing
ExactOutSwapRoute
Swaps for a requested final user output amount with maximum input. The
amountOut target is post-router-fee: the router requests the corresponding
gross pool output, deducts the fee, then validates and transfers the net output.
- With no single-hop price limit, targets the requested post-fee output within the implementation's small per-hop rounding tolerance
- A nonzero single-hop price limit may stop early and return a partial output
- Reverts if input > amountInMax
- Calculates path backwards
DrySwapRoute
Simulates a swap without execution.
- Frontend price quotes
- Slippage calculation
- Path validation
- No deadline check or token transfer
Technical Details
Route Format vs Pool Format - IMPORTANT DISTINCTION
Route Format (Swap Direction)
Routes in the router follow swap direction ordering: tokenIn:tokenOut:fee
- First token = Input token (what you're swapping FROM)
- Second token = Output token (what you're swapping TO)
- This represents the actual flow of the swap
Example for swapping GNS to WUGNOT:
gno.land/r/gnoswap/gns.GNS:gno.land/r/gnoland/wugnot.wugnot:3000
Pool Format (Alphabetical)
Pools are identified using alphabetical ordering: token0:token1:fee
- token0 < token1 (lexicographically sorted)
- This is the canonical pool identifier
Example pool identifier (same pool as above):
gno.land/r/gnoland/wugnot.wugnot:gno.land/r/gnoswap/gns.GNS:3000 # gnoland/wugnot < gnoswap/gns alphabetically
Key Difference
- Router routes: Follow your swap direction (BAR→BAZ means bar:baz in route)
- Pool identifiers: Always alphabetically sorted (might be bar:baz or baz:bar)
- The router automatically handles the conversion between these formats
Native Token Route Specification
IMPORTANT: Router swap functions do not accept native ugnot directly.
- Token Parameters: Use token keys (
pkgPath.SYMBOL) such as"gno.land/r/gnoland/wugnot.wugnot" - Route Paths: Also use token keys (
pkgPath.SYMBOL) such as"gno.land/r/gnoland/wugnot.wugnot"
This matches the current implementation:
- Pools operate on token contract paths, including wrapped GNOT (
wugnot) - Router swap entrypoints reject native-coin handling
- Native-token refund and unwrap flows are not part of the current router implementation
Route String Format
Single-hop format:
tokenIn:tokenOut:fee
Multi-hop format (using POOL separator):
tokenIn:tokenB:fee1*POOL*tokenB:tokenC:fee2*POOL*tokenC:tokenOut:fee3
Single-hop example:
# Swapping GNS to WUGNOT
Route: gno.land/r/gnoswap/gns.GNS:gno.land/r/gnoland/wugnot.wugnot:3000
# Router interprets: tokenIn=gns, tokenOut=wugnot, fee=3000
Multi-hop example (GNS → WUGNOT → TOKEN_C):
# Each segment follows swap direction, connected by *POOL*
gno.land/r/gnoswap/gns.GNS:gno.land/r/gnoland/wugnot.wugnot:3000*POOL*gno.land/r/gnoland/wugnot.wugnot:gno.land/r/<namespace>/token_c.TOKEN_C:500
Quote Distribution
Split large trades across routes to minimize impact:
quoteArr: positive percentage per route, with one quote for each route- Quotes must sum to 100; at most 7 routes are accepted
- Example: "30,70" = 30% route1, 70% route2
Native Token Handling
The current router implementation does not handle native ugnot directly. It rejects native-coin handling and routes swaps only through token keys (pkgPath.SYMBOL) such as wrapped GNOT (wugnot).
Token Identifier Requirements
- Use token keys (
pkgPath.SYMBOL) such asgno.land/r/gnoland/wugnot.wugnotfor both inputs/outputs and route specifications. - Do not pass
"ugnot"asinputTokenoroutputTokento router swap functions.
Approval and Transfer Requirements
- Approve the router to spend the token contract you are swapping from.
- If you want wrapped GNOT exposure, use the
wugnottoken contract path directly. - Native-token refund and unwrap flows are not part of the current router implementation.
Example with Wrapped GNOT
Examples in this document call the public domain proxy from a realm function with a current cur token.
Import the proxy package and qualify its function names in integrating code.
1// 1. Approve WUGNOT spending for the router
2wugnot.Approve(cross(cur), routerAddress, 1000000)
3
4// 2. Call swap function with wrapped GNOT paths
5amountIn, amountOut := ExactInSwapRoute(
6 cross(cur),
7 "gno.land/r/gnoland/wugnot.wugnot", // input token
8 "gno.land/r/gnoswap/gns.GNS", // output token
9 "1000000", // amount in wrapped token units
10 "gno.land/r/gnoland/wugnot.wugnot:gno.land/r/gnoswap/gns.GNS:3000",
11 "100", // 100% through route
12 "950000", // min output
13 time.Now().Unix() + 300, // deadline
14 "", // no referrer
15)
For live liquidity-changing swaps:
- Set
amountOutMin = expected * (1 - slippage%) - 0.5-1% for stable pairs
- 1-3% for volatile pairs
- Reverts if the net output is below the minimum
Usage
Basic Token Swaps
1// Simple exact input swap
2amountIn, amountOut := ExactInSwapRoute(
3 cross(cur),
4 "gno.land/r/gnoswap/gns.GNS", // input token
5 "gno.land/r/gnoland/wugnot.wugnot", // output token
6 "1000000", // amount (6 decimals)
7 "gno.land/r/gnoswap/gns.GNS:gno.land/r/gnoland/wugnot.wugnot:3000", // route
8 "100", // 100% through route
9 "950000", // min output
10 time.Now().Unix() + 300, // deadline
11 "g1referrer...", // referral
12)
13
14// Multi-hop swap
15ExactInSwapRoute(
16 cross(cur),
17 "gno.land/r/gnoswap/gns.GNS",
18 "gno.land/r/<namespace>/token_c.TOKEN_C",
19 "1000000",
20 "gno.land/r/gnoswap/gns.GNS:gno.land/r/gnoland/wugnot.wugnot:3000*POOL*gno.land/r/gnoland/wugnot.wugnot:gno.land/r/<namespace>/token_c.TOKEN_C:3000",
21 "100",
22 "900000",
23 deadline,
24 "",
25)
26
27// Split route for large trades
28ExactInSwapRoute(
29 cross(cur),
30 "gno.land/r/gnoswap/gns.GNS",
31 "gno.land/r/gnoland/wugnot.wugnot",
32 "10000000000",
33 "gno.land/r/gnoswap/gns.GNS:gno.land/r/gnoland/wugnot.wugnot:500,gno.land/r/gnoswap/gns.GNS:gno.land/r/gnoland/wugnot.wugnot:3000",
34 "60,40", // 60% through 0.05%, 40% through 0.3%
35 "9500000000",
36 deadline,
37 "",
38)
Single-hop functions support partial execution through a nonzero
sqrtPriceLimitX96:
1// Partial swap with price limit - may not consume full input amount
2amountIn, amountOut := ExactInSingleSwapRoute(
3 cross(cur),
4 "gno.land/r/gnoswap/gns.GNS", // input token
5 "gno.land/r/gnoland/wugnot.wugnot", // output token
6 "1000000", // max amount to swap
7 "gno.land/r/gnoswap/gns.GNS:gno.land/r/gnoland/wugnot.wugnot:3000", // single route
8 "950000", // min output
9 "1000000000000000000", // sqrtPriceLimitX96 (price limit)
10 deadline,
11 "",
12)
13// If the price limit is reached, only a partial amount is swapped. For exact-in
14// this can consume less input; exact-out can deliver less than its target.
15// amountOutMin or amountInMax remains enforced, respectively.
Important Developer Notes
Common Integration Pitfalls
-
Native Token Assumptions: Passing
"ugnot"to router swap functions will fail because router entrypoints reject native-coin handling. -
Route vs Token Identifier Confusion: Using
"ugnot"in route strings instead of"gno.land/r/gnoland/wugnot.wugnot"will cause transactions to fail since no pools exist for the"ugnot"identifier. -
Wrong Token Path:
- Use
gno.land/r/gnoland/wugnot.wugnotwhen swapping wrapped GNOT - Do not pass native
ugnotto router swap functions - Route strings must stay in swap-direction order and use token contract paths
- Use
Frontend Integration Checklist
- Implement WUGNOT approval before wrapped-GNOT swaps
- Use token keys (
pkgPath.SYMBOL) such as"gno.land/r/gnoland/wugnot.wugnot"for both parameters and routes - Test both partial and full swap scenarios
- Implement proper error handling for failed approvals
Both single-hop functions support partial execution when
sqrtPriceLimitX96 is nonzero:
- Exact-in may consume less than the specified input amount
- Exact-out may deliver less than the requested post-fee output
- The relevant amount limit (
amountOutMinoramountInMax) still applies - Remaining input tokens stay with the user because the router uses token contract transfers
- A zero limit uses the global tick-math boundary and preserves full exact semantics
Security
- Path validation checks syntax, endpoints, hop continuity, and pool existence; it does not reject circular routes
- Deadline prevents stale live transactions
- Slippage limits protect against unfavorable execution
- The router fee rate is configurable; the current rate is fixed during one execution
- WUGNOT approval requirement prevents unauthorized token transfers
Package router provides swap routing and execution across GnoSwap liquidity pools.
Router domain proxy for single-hop and multi-hop exact-in, exact-out, and dry-route operations.
Live exact-in and exact-out calls validate a deadline and the corresponding amount limit (minimum output or maximum input). DrySwapRoute is a read-only quote path with no deadline or token transfer.
The router fee is charged on output tokens. It defaults to 15 bps (0.15%) and is configurable by admin/governance from 0 through 1000 bps (0–10%); the current rate is fixed for each individual execution.
The router acts as a proxy to version-specific implementations, currently routing to v1 for all swap operations.
1
14
func DrySwapRoute
ActionDrySwapRoute simulates a swap route without changing state.
Parameters:
- inputToken: input token path
- outputToken: output token path
- specifiedAmount: exact input or output amount
- swapTypeStr: `EXACT_IN` or `EXACT_OUT`
- strRouteArr: encoded route
- quoteArr: encoded quotes
- tokenAmountLimit: minimum output or maximum input amount
Returns:
- amountIn: estimated input amount
- amountOut: estimated output amount
- err: non-nil when route validation or simulation fails
func ExactInSingleSwapRoute
crossing Action1func ExactInSingleSwapRoute(cur realm, inputToken string, outputToken string, amountIn string, routeArr string, amountOutMin string, sqrtPriceLimitX96 string, deadline int64, referrer string) (string, string)ExactInSingleSwapRoute executes a single-hop swap for an exact input amount.
Parameters:
- cur: current realm context; callers use cross(cur) when crossing into this realm
- inputToken: input token path
- outputToken: output token path
- amountIn: exact input amount
- routeArr: encoded route
- amountOutMin: minimum output amount
- sqrtPriceLimitX96: Q64.96 price limit
- deadline: transaction deadline
- referrer: referral address
Returns:
- amountIn: input amount consumed (a nonzero price limit may stop early)
- amountOut: net output amount delivered after the router fee
Halt check: reverts while the Router halt scope is active.
func ExactInSwapRoute
crossing Action1func ExactInSwapRoute(cur realm, inputToken string, outputToken string, amountIn string, routeArr string, quoteArr string, amountOutMin string, deadline int64, referrer string) (string, string)ExactInSwapRoute executes a multi-hop swap for an exact input amount.
Parameters:
- cur: current realm context; callers use cross(cur) when crossing into this realm
- inputToken: input token path
- outputToken: output token path
- amountIn: exact input amount
- routeArr: encoded route
- quoteArr: encoded quotes
- amountOutMin: minimum output amount
- deadline: transaction deadline
- referrer: referral address
Returns:
- amountIn: input amount consumed
- amountOut: net output amount delivered after the router fee
Halt check: reverts while the Router halt scope is active.
func ExactOutSingleSwapRoute
crossing Action1func ExactOutSingleSwapRoute(cur realm, inputToken string, outputToken string, amountOut string, routeArr string, amountInMax string, sqrtPriceLimitX96 string, deadline int64, referrer string) (string, string)ExactOutSingleSwapRoute executes a single-hop swap for a requested post-fee output target.
Parameters:
- cur: current realm context; callers use cross(cur) when crossing into this realm
- inputToken: input token path
- outputToken: output token path
- amountOut: requested net output target
- routeArr: encoded route
- amountInMax: maximum input amount
- sqrtPriceLimitX96: Q64.96 price limit
- deadline: transaction deadline
- referrer: referral address
Returns:
- amountIn: input amount consumed (a nonzero price limit may stop early)
- amountOut: net output delivered after the router fee; it may be below the requested target when the limit is reached
Halt check: reverts while the Router halt scope is active.
func ExactOutSwapRoute
crossing Action1func ExactOutSwapRoute(cur realm, inputToken string, outputToken string, amountOut string, routeArr string, quoteArr string, amountInMax string, deadline int64, referrer string) (string, string)ExactOutSwapRoute executes a multi-hop swap for a requested post-fee output target.
Parameters:
- cur: current realm context; callers use cross(cur) when crossing into this realm
- inputToken: input token path
- outputToken: output token path
- amountOut: requested net output target
- routeArr: encoded route
- quoteArr: encoded quotes
- amountInMax: maximum input amount
- deadline: transaction deadline
- referrer: referral address
Returns:
- amountIn: input amount consumed
- amountOut: net output delivered after the router fee
Halt check: reverts while the Router halt scope is active.
func GetImplementationPackagePath
ActionGetImplementationPackagePath returns the package path of the currently active implementation.
Returns:
- packagePath: package path of the active implementation
func GetPendingProtocolFees
ActionGetPendingProtocolFees returns a copy of uncollected protocol fees by token.
Returns:
- fees: pending protocol fee amount keyed by token path
func GetSwapFee
ActionGetSwapFee returns the current router fee rate.
Returns:
- fee: fee rate in basis points
func RegisterInitializer
crossing Action1func RegisterInitializer(cur realm, initializer func(_ int, rlm realm, routerStore IRouterStore) IRouter)RegisterInitializer registers a new router implementation version. Each implementation package calls it during initialization before it can be selected.
Parameters:
- cur: current realm context; callers use cross(cur) when crossing into this realm
- initializer: callback that receives the propagated realm context and router store, then constructs the IRouter implementation
func Render
Render delegates web rendering to the active implementation.
func SetSwapFee
crossing ActionSetSwapFee sets the router fee rate.
Parameters:
- cur: current realm context; callers use cross(cur) when crossing into this realm
- fee: fee rate in basis points
Halt check: reverts while the Router or ProtocolFee halt scope is active.
func SwapCallback
crossing Action1func SwapCallback(cur realm, token0Path string, token1Path string, amount0Delta int64, amount1Delta int64, payer address) errorSwapCallback transfers amounts owed by a pool during a swap.
Parameters:
- cur: current realm context; callers use cross(cur) when crossing into this realm
- token0Path: token0 path
- token1Path: token1 path
- amount0Delta: token0 amount owed to or by the pool
- amount1Delta: token1 amount owed to or by the pool
- payer: address that supplies positive deltas
Returns:
- err: non-nil when payment validation or transfer fails
Halt check: reverts while the Router halt scope is active.
func UpgradeImpl
crossing ActionUpgradeImpl switches the active router implementation to a different registered version.
Parameters:
- cur: current realm context; callers use cross(cur) when crossing into this realm
- packagePath: package path of the previously registered implementation to activate
func NewRouterStore
ActionNewRouterStore creates a router store backed by the provided KV store.
Parameters:
- kvStore: persistent key-value store used for router fee and pending-fee data
Returns:
- routerStore: router storage implementation using kvStore
3
type IRouter
interface 1type IRouter interface {
2 // ExactInSwapRoute executes a multi-hop exact-input swap.
3 //
4 // Parameters:
5 // - _: leading implementation discriminator; callers pass 0
6 // - rlm: propagated current realm context used for swap validation and transfers
7 // - inputToken: input token contract path
8 // - outputToken: output token contract path
9 // - amountIn: exact input amount encoded as a decimal string
10 // - routeArr: comma-separated route paths, each with up to three pool hops
11 // - quoteArr: comma-separated route allocation percentages summing to 100
12 // - amountOutMin: minimum net output amount encoded as a decimal string
13 // - deadline: Unix timestamp after which the swap is rejected
14 // - referrer: optional referral address used for registration
15 //
16 // Returns:
17 // - amountIn: actual input amount consumed, encoded as a decimal string
18 // - amountOut: net output amount after router fee, encoded as a decimal string
19 ExactInSwapRoute(_ int, rlm realm, inputToken string, outputToken string, amountIn string, routeArr string, quoteArr string, amountOutMin string, deadline int64, referrer string) (string, string)
20 // ExactInSingleSwapRoute executes an exact-input swap through one pool.
21 //
22 // Parameters:
23 // - _: leading implementation discriminator; callers pass 0
24 // - rlm: propagated current realm context used for swap validation and transfers
25 // - inputToken: input token contract path
26 // - outputToken: output token contract path
27 // - amountIn: exact input amount encoded as a decimal string
28 // - routeArr: single-hop route path
29 // - amountOutMin: minimum net output amount encoded as a decimal string
30 // - sqrtPriceLimitX96: optional Q64.96 square-root price limit encoded as a decimal string
31 // - deadline: Unix timestamp after which the swap is rejected
32 // - referrer: optional referral address used for registration
33 //
34 // Returns:
35 // - amountIn: actual input amount consumed, encoded as a decimal string
36 // - amountOut: net output amount after router fee, encoded as a decimal string
37 ExactInSingleSwapRoute(_ int, rlm realm, inputToken string, outputToken string, amountIn string, routeArr string, amountOutMin string, sqrtPriceLimitX96 string, deadline int64, referrer string) (string, string)
38
39 // ExactOutSwapRoute executes a multi-hop swap for a requested net output.
40 //
41 // Parameters:
42 // - _: leading implementation discriminator; callers pass 0
43 // - rlm: propagated current realm context used for swap validation and transfers
44 // - inputToken: input token contract path
45 // - outputToken: output token contract path
46 // - amountOut: requested net output amount encoded as a decimal string
47 // - routeArr: comma-separated route paths, each with up to three pool hops
48 // - quoteArr: comma-separated route allocation percentages summing to 100
49 // - amountInMax: maximum input amount encoded as a decimal string
50 // - deadline: Unix timestamp after which the swap is rejected
51 // - referrer: optional referral address used for registration
52 //
53 // Returns:
54 // - amountIn: actual input amount consumed, encoded as a decimal string
55 // - amountOut: net output amount after router fee, encoded as a decimal string
56 ExactOutSwapRoute(_ int, rlm realm, inputToken string, outputToken string, amountOut string, routeArr string, quoteArr string, amountInMax string, deadline int64, referrer string) (string, string)
57 // ExactOutSingleSwapRoute executes an exact-output swap through one pool.
58 //
59 // Parameters:
60 // - _: leading implementation discriminator; callers pass 0
61 // - rlm: propagated current realm context used for swap validation and transfers
62 // - inputToken: input token contract path
63 // - outputToken: output token contract path
64 // - amountOut: requested net output amount encoded as a decimal string
65 // - routeArr: single-hop route path
66 // - amountInMax: maximum input amount encoded as a decimal string
67 // - sqrtPriceLimitX96: optional Q64.96 square-root price limit encoded as a decimal string
68 // - deadline: Unix timestamp after which the swap is rejected
69 // - referrer: optional referral address used for registration
70 //
71 // Returns:
72 // - amountIn: actual input amount consumed, encoded as a decimal string
73 // - amountOut: net output amount after router fee, encoded as a decimal string
74 ExactOutSingleSwapRoute(_ int, rlm realm, inputToken string, outputToken string, amountOut string, routeArr string, amountInMax string, sqrtPriceLimitX96 string, deadline int64, referrer string) (string, string)
75
76 // DrySwapRoute simulates a route without writing state or transferring tokens.
77 //
78 // Parameters:
79 // - inputToken: input token contract path
80 // - outputToken: output token contract path
81 // - specifiedAmount: exact input or output amount encoded as a decimal string
82 // - swapTypeStr: swap type string, either EXACT_IN or EXACT_OUT
83 // - strRouteArr: comma-separated encoded route paths
84 // - quoteArr: comma-separated route allocation percentages summing to 100
85 // - tokenAmountLimit: minimum output for EXACT_IN or maximum input for EXACT_OUT
86 //
87 // Returns:
88 // - amountIn: simulated input amount encoded as a decimal string
89 // - amountOut: simulated net output amount encoded as a decimal string
90 // - err: nil on success; validation, liquidity, or slippage error on failure
91 DrySwapRoute(inputToken, outputToken, specifiedAmount, swapTypeStr, strRouteArr, quoteArr, tokenAmountLimit string) (string, string, error)
92 // SwapCallback pays a pool's positive input delta during a swap.
93 //
94 // Parameters:
95 // - _: leading callback discriminator; callers pass 0
96 // - rlm: propagated current realm context; implementation verifies it is current
97 // - token0Path: token-0 contract path in canonical pool order
98 // - token1Path: token-1 contract path in canonical pool order
99 // - amount0Delta: signed token-0 delta; positive means the pool is owed tokens
100 // - amount1Delta: signed token-1 delta; positive means the pool is owed tokens
101 // - payer: address whose balance supplies the positive delta
102 //
103 // Returns:
104 // - err: nil after payment; error when realm, liquidity delta, or transfer validation fails
105 SwapCallback(_ int, rlm realm, token0Path string, token1Path string, amount0Delta int64, amount1Delta int64, payer address) error
106 // GetSwapFee reads the router fee rate.
107 //
108 // Returns:
109 // - fee: router fee in basis points
110 GetSwapFee() uint64
111 // SetSwapFee updates the router fee rate.
112 //
113 // Parameters:
114 // - _: leading call discriminator; callers pass 0
115 // - rlm: propagated current realm context used for authorized storage writes
116 // - fee: router fee in basis points
117 SetSwapFee(_ int, rlm realm, fee uint64)
118 // GetPendingProtocolFees reads pending protocol fees keyed by token path.
119 //
120 // Returns:
121 // - fees: token-path to pending-fee amount map
122 GetPendingProtocolFees() map[string]int64
123 Render(path string) string
124}type IRouterStore
interface 1type IRouterStore interface {
2 // HasSwapFeeKey reports whether a stored router fee exists.
3 //
4 // Returns:
5 // - exists: true when the swap-fee key is present
6 HasSwapFeeKey() bool
7 // GetSwapFee reads the stored router fee.
8 //
9 // Returns:
10 // - fee: configured router fee in basis points
11 GetSwapFee() uint64
12 // SetSwapFee persists the router fee.
13 //
14 // Parameters:
15 // - _: leading call discriminator; callers pass 0
16 // - rlm: propagated current realm context; storage validates current-frame status
17 // - fee: router fee in basis points
18 //
19 // Returns:
20 // - err: nil on success; storage or realm-validation error otherwise
21 SetSwapFee(_ int, rlm realm, fee uint64) error
22 // HasPendingProtocolFeesKey reports whether a stored pending-fees map exists.
23 //
24 // Returns:
25 // - exists: true when the pending-fees key is present
26 HasPendingProtocolFeesKey() bool
27 // GetPendingProtocolFees reads all pending protocol fees.
28 //
29 // Returns:
30 // - fees: token-path to pending-fee amount map
31 GetPendingProtocolFees() map[string]int64
32 // SetPendingProtocolFees replaces all pending protocol fees.
33 //
34 // Parameters:
35 // - _: leading call discriminator; callers pass 0
36 // - rlm: propagated current realm context; storage validates current-frame status
37 // - fees: token-path to pending-fee amount map to persist
38 //
39 // Returns:
40 // - err: nil on success; storage or realm-validation error otherwise
41 SetPendingProtocolFees(_ int, rlm realm, fees map[string]int64) error
42 // GetPendingProtocolFee reads one token's pending fee.
43 //
44 // Parameters:
45 // - tokenPath: token contract path to query
46 //
47 // Returns:
48 // - amount: pending amount for tokenPath, or zero if absent
49 GetPendingProtocolFee(tokenPath string) int64
50 // SetPendingProtocolFee updates one token's pending fee.
51 //
52 // Parameters:
53 // - _: leading call discriminator; callers pass 0
54 // - rlm: propagated current realm context; storage validates current-frame and write authorization
55 // - tokenPath: token contract path to update
56 // - amount: pending amount to record
57 //
58 // Returns:
59 // - err: nil on success; realm or storage authorization error otherwise
60 SetPendingProtocolFee(_ int, rlm realm, tokenPath string, amount int64) error
61 // RemovePendingProtocolFee deletes one token's pending fee.
62 //
63 // Parameters:
64 // - _: leading call discriminator; callers pass 0
65 // - rlm: propagated current realm context; storage validates current-frame and write authorization
66 // - tokenPath: token contract path to remove
67 //
68 // Returns:
69 // - err: nil on success; realm or storage authorization error otherwise
70 RemovePendingProtocolFee(_ int, rlm realm, tokenPath string) error
71}