Kind Realm (renderable)
Name router
Namespace gnoswap
Exported functions 14
Module gno.land/r/gnoswap/router
gno 0.9 proxy.gno gno
⧉
1 package router 2 3 // ExactInSwapRoute executes a multi-hop swap for an exact input amount. 4 // 5 // Parameters: 6 // - cur: current realm context; callers use cross(cur) when crossing into this realm 7 // - inputToken: input token path 8 DrySwapRoute (inputToken string, outputToken string, specifiedAmount string, swapTypeStr string, strRouteArr string, quoteArr string, tokenAmountLimit string) (string, string, interface {Error func() string})
ExactInSingleSwapRoute (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}, inputToken string, outputToken string, amountIn string, routeArr string, amountOutMin string, sqrtPriceLimitX96 string, deadline int64, referrer string) (string, string)
ExactInSwapRoute (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}, inputToken string, outputToken string, amountIn string, routeArr string, quoteArr string, amountOutMin string, deadline int64, referrer string) (string, string)
ExactOutSingleSwapRoute (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}, inputToken string, outputToken string, amountOut string, routeArr string, amountInMax string, sqrtPriceLimitX96 string, deadline int64, referrer string) (string, string)
ExactOutSwapRoute (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}, inputToken string, outputToken string, amountOut string, routeArr string, quoteArr string, amountInMax string, deadline int64, referrer string) (string, string)
GetImplementationPackagePath () string
GetPendingProtocolFees () map[string]int64
GetSwapFee () uint64
NewRouterStore (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 {GetPendingProtocolFee func(string) int64; GetPendingProtocolFees func() map[string]int64; GetSwapFee func() uint64; HasPendingProtocolFeesKey func() bool; HasSwapFeeKey func() bool; RemovePendingProtocolFee func(int, .uverse.realm, string) .uverse.error; SetPendingProtocolFee func(int, .uverse.realm, string, int64) .uverse.error; SetPendingProtocolFees func(int, .uverse.realm, map[string]int64) .uverse.error; SetSwapFee func(int, .uverse.realm, uint64) .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/router.IRouterStore) gno.land/r/gnoswap/router.IRouter)
Render (path string) string
SetSwapFee (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}, fee uint64)
SwapCallback (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}, token0Path string, token1Path string, amount0Delta int64, amount1Delta int64, payer string) interface {Error func() string}
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.
// - outputToken: output token path
9 // - amountIn: exact input amount
10 // - routeArr: encoded route
11 // - quoteArr: encoded quotes
12 // - amountOutMin: minimum output amount
13 // - deadline: transaction deadline
14 // - referrer: referral address
15 //
16 // Returns:
17 // - amountIn: input amount consumed
18 // - amountOut: net output amount delivered after the router fee
19 //
20 // Halt check: reverts while the Router halt scope is active.
21 func ExactInSwapRoute(cur realm, inputToken string , outputToken string , amountIn string , routeArr string , quoteArr string , amountOutMin string , deadline int64 , referrer string ) ( string , string ) {
22 return getImplementation().ExactInSwapRoute( 0 , cur, inputToken, outputToken, amountIn, routeArr, quoteArr, amountOutMin, deadline, referrer)
23 }
24
25 // ExactInSingleSwapRoute executes a single-hop swap for an exact input amount.
26 //
27 // Parameters:
28 // - cur: current realm context; callers use cross(cur) when crossing into this realm
29 // - inputToken: input token path
30 // - outputToken: output token path
31 // - amountIn: exact input amount
32 // - routeArr: encoded route
33 // - amountOutMin: minimum output amount
34 // - sqrtPriceLimitX96: Q64.96 price limit
35 // - deadline: transaction deadline
36 // - referrer: referral address
37 //
38 // Returns:
39 // - amountIn: input amount consumed (a nonzero price limit may stop early)
40 // - amountOut: net output amount delivered after the router fee
41 //
42 // Halt check: reverts while the Router halt scope is active.
43 func ExactInSingleSwapRoute(cur realm, inputToken string , outputToken string , amountIn string , routeArr string , amountOutMin string , sqrtPriceLimitX96 string , deadline int64 , referrer string ) ( string , string ) {
44 return getImplementation().ExactInSingleSwapRoute( 0 , cur, inputToken, outputToken, amountIn, routeArr, amountOutMin, sqrtPriceLimitX96, deadline, referrer)
45 }
46
47 // ExactOutSwapRoute executes a multi-hop swap for a requested post-fee output
48 // target.
49 //
50 // Parameters:
51 // - cur: current realm context; callers use cross(cur) when crossing into this realm
52 // - inputToken: input token path
53 // - outputToken: output token path
54 // - amountOut: requested net output target
55 // - routeArr: encoded route
56 // - quoteArr: encoded quotes
57 // - amountInMax: maximum input amount
58 // - deadline: transaction deadline
59 // - referrer: referral address
60 //
61 // Returns:
62 // - amountIn: input amount consumed
63 // - amountOut: net output delivered after the router fee
64 //
65 // Halt check: reverts while the Router halt scope is active.
66 func ExactOutSwapRoute(cur realm, inputToken string , outputToken string , amountOut string , routeArr string , quoteArr string , amountInMax string , deadline int64 , referrer string ) ( string , string ) {
67 return getImplementation().ExactOutSwapRoute( 0 , cur, inputToken, outputToken, amountOut, routeArr, quoteArr, amountInMax, deadline, referrer)
68 }
69
70 // ExactOutSingleSwapRoute executes a single-hop swap for a requested post-fee
71 // output target.
72 //
73 // Parameters:
74 // - cur: current realm context; callers use cross(cur) when crossing into this realm
75 // - inputToken: input token path
76 // - outputToken: output token path
77 // - amountOut: requested net output target
78 // - routeArr: encoded route
79 // - amountInMax: maximum input amount
80 // - sqrtPriceLimitX96: Q64.96 price limit
81 // - deadline: transaction deadline
82 // - referrer: referral address
83 //
84 // Returns:
85 // - amountIn: input amount consumed (a nonzero price limit may stop early)
86 // - amountOut: net output delivered after the router fee; it may be below
87 // the requested target when the limit is reached
88 //
89 // Halt check: reverts while the Router halt scope is active.
90 func ExactOutSingleSwapRoute(cur realm, inputToken string , outputToken string , amountOut string , routeArr string , amountInMax string , sqrtPriceLimitX96 string , deadline int64 , referrer string ) ( string , string ) {
91 return getImplementation().ExactOutSingleSwapRoute( 0 , cur, inputToken, outputToken, amountOut, routeArr, amountInMax, sqrtPriceLimitX96, deadline, referrer)
92 }
93
94 // DrySwapRoute simulates a swap route without changing state.
95 //
96 // Parameters:
97 // - inputToken: input token path
98 // - outputToken: output token path
99 // - specifiedAmount: exact input or output amount
100 // - swapTypeStr: `EXACT_IN` or `EXACT_OUT`
101 // - strRouteArr: encoded route
102 // - quoteArr: encoded quotes
103 // - tokenAmountLimit: minimum output or maximum input amount
104 //
105 // Returns:
106 // - amountIn: estimated input amount
107 // - amountOut: estimated output amount
108 // - err: non-nil when route validation or simulation fails
109 func DrySwapRoute(
110 inputToken, outputToken string ,
111 specifiedAmount string ,
112 swapTypeStr string ,
113 strRouteArr, quoteArr string ,
114 tokenAmountLimit string ,
115 ) ( string , string , error ) {
116 return getImplementation().DrySwapRoute(inputToken, outputToken, specifiedAmount, swapTypeStr, strRouteArr, quoteArr, tokenAmountLimit)
117 }
118
119 // SwapCallback transfers amounts owed by a pool during a swap.
120 //
121 // Parameters:
122 // - cur: current realm context; callers use cross(cur) when crossing into this realm
123 // - token0Path: token0 path
124 // - token1Path: token1 path
125 // - amount0Delta: token0 amount owed to or by the pool
126 // - amount1Delta: token1 amount owed to or by the pool
127 // - payer: address that supplies positive deltas
128 //
129 // Returns:
130 // - err: non-nil when payment validation or transfer fails
131 //
132 // Halt check: reverts while the Router halt scope is active.
133 func SwapCallback(cur realm, token0Path string , token1Path string , amount0Delta int64 , amount1Delta int64 , payer address) error {
134 return getImplementation().SwapCallback( 0 , cur, token0Path, token1Path, amount0Delta, amount1Delta, payer)
135 }
136
137 // GetSwapFee returns the current router fee rate.
138 //
139 // Returns:
140 // - fee: fee rate in basis points
141 func GetSwapFee() uint64 {
142 return getImplementation().GetSwapFee()
143 }
144
145 // SetSwapFee sets the router fee rate.
146 //
147 // Parameters:
148 // - cur: current realm context; callers use cross(cur) when crossing into this realm
149 // - fee: fee rate in basis points
150 //
151 // Halt check: reverts while the Router or ProtocolFee halt scope is active.
152 func SetSwapFee(cur realm, fee uint64 ) {
153 getImplementation().SetSwapFee( 0 , cur, fee)
154 }
155
156 // GetPendingProtocolFees returns a copy of uncollected protocol fees by token.
157 //
158 // Returns:
159 // - fees: pending protocol fee amount keyed by token path
160 func GetPendingProtocolFees() map [ string ] int64 {
161 return cloneStringInt64Map(getImplementation().GetPendingProtocolFees())
162 }
163
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.