PathrockNetwork Gno Explorer
HomeBlocksTransactionsTokensRealmsPackagesValidatorsAnalytics

PathrockNetwork Gno Explorer — an independent explorer for Gno.land Mainnet (gnoland-1), operated by PathrockNetwork. Not an official Gno.land service.

gnowebarchive RPC

gno.land/r/gnoswap/router/v1

Realm
Open in gnoweb ↗

Overview

Kind
Realm (renderable)
Name
v1
Namespace
gnoswap / router
Files
21 (README)(gnomod.toml)
Exported functions
7
Module
gno.land/r/gnoswap/router/v1
gno
0.9

Files (21)

  • README.mdmarkdown
  • gnomod.tomltoml
  • assert.gnogno
  • base.gnogno
  • consts.gnogno
  • doc.gnogno
  • errors.gnogno
  • exact_in.gnogno
  • exact_out.gnogno
  • init.gnogno
  • instance.gnogno
  • protocol_fee_swap.gnogno
  • render.gnogno
  • router_dry.gnogno
  • router.gnogno
  • swap_callback.gnogno
  • swap_inner.gnogno
  • swap_multi.gnogno
  • swap_single.gnogno
  • type.gnogno
  • utils.gnogno
  • errors.gnogno
    1package router23import (4	ufmt "gno.land/p/nt/ufmt/v0"5)67const (8	errSlippage               = "[GNOSWAP-ROUTER-001] slippage check failed"9	errInvalidRoutesAndQuotes = "[GNOSWAP-ROUTER-002] invalid routes and quotes"10	errExpired                = "[GNOSWAP-ROUTER-003] transaction expired"11	errInvalidInput           = "[GNOSWAP-ROUTER-004] invalid input data"12	errInvalidPoolFeeTier     = "[GNOSWAP-ROUTER-005] invalid pool fee tier"13	errInvalidSwapFee         = "[GNOSWAP-ROUTER-006] invalid swap fee"14	errInvalidSwapType        = "[GNOSWAP-ROUTER-007] invalid swap type"15	errInvalidPoolPath        = "[GNOSWAP-ROUTER-008] invalid pool path"16	errUnAuthorizedCaller     = "[GNOSWAP-ROUTER-009] unauthorized caller"17	errHopsOutOfRange         = "[GNOSWAP-ROUTER-010] number of hops must be 1~3"18	errSameTokenSwap          = "[GNOSWAP-ROUTER-011] cannot swap same token"19	errInvalidRoutePath       = "[GNOSWAP-ROUTER-013] invalid route path"20	errInvalidRouteFirstToken = "[GNOSWAP-ROUTER-014] invalid route first token"21	errInvalidRouteLastToken  = "[GNOSWAP-ROUTER-015] invalid route last token"22	errInvalidSwapAmount      = "[GNOSWAP-ROUTER-016] invalid swap amount"23	errRouteHopDisconnected   = "[GNOSWAP-ROUTER-017] route hop disconnected"24	errInsufficientBalance    = "[GNOSWAP-ROUTER-018] insufficient balance for swap"25	errSpoofedRealm           = "[GNOSWAP-ROUTER-019] rlm does not match the current crossing frame"26	errInsufficientLiquidity  = "[GNOSWAP-ROUTER-020] insufficient liquidity for swap"27)2829// addDetailToError adds detail to an error message.30func addDetailToError(message string, detail string) string {31	finalErr := ufmt.Errorf("%s || %s", message, detail)32	return finalErr.Error()33}3435// makeErrorWithDetails creates an error with additional context.36func makeErrorWithDetails(message string, detail string) error {37	return ufmt.Errorf("%s || %s", message, detail)38}39

    Functions

    • BuildSingleHopRoutePath(tokenA string, tokenB string, fee uint32) string

    • NewExactInParams(baseParams struct{InputToken string; OutputToken string; RouteArr string; QuoteArr string; SqrtPriceLimitX96 *gno.land/p/gnoswap/uint256/v1.Uint; Deadline int64}, amountIn int64, amountOutMin int64) struct{BaseSwapParams gno.land/r/gnoswap/router/v1.BaseSwapParams; AmountIn int64; AmountOutMin int64}

    • NewExactInSwapOperation(r *gno.land/r/gnoswap/router/v1.routerV1, pp struct{BaseSwapParams gno.land/r/gnoswap/router/v1.BaseSwapParams; AmountIn int64; AmountOutMin int64}) *gno.land/r/gnoswap/router/v1.ExactInSwapOperation

    • NewExactOutParams(baseParams struct{InputToken string; OutputToken string; RouteArr string; QuoteArr string; SqrtPriceLimitX96 *gno.land/p/gnoswap/uint256/v1.Uint; Deadline int64}, amountOut int64, amountInMax int64) struct{BaseSwapParams gno.land/r/gnoswap/router/v1.BaseSwapParams; AmountOut int64; AmountInMax int64}

    • NewExactOutSwapOperation(r *gno.land/r/gnoswap/router/v1.routerV1, pp struct{BaseSwapParams gno.land/r/gnoswap/router/v1.BaseSwapParams; AmountOut int64; AmountInMax int64}) *gno.land/r/gnoswap/router/v1.ExactOutSwapOperation

    • NewRouteParser() *gno.land/r/gnoswap/router/v1.RouteParser

    • NewRouterV1(routerStore 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}) interface {DrySwapRoute func(string, string, string, string, string, string, string) (string, string, .uverse.error); ExactInSingleSwapRoute func(int, .uverse.realm, string, string, string, string, string, string, int64, string) (string, string); ExactInSwapRoute func(int, .uverse.realm, string, string, string, string, string, string, int64, string) (string, string); ExactOutSingleSwapRoute func(int, .uverse.realm, string, string, string, string, string, string, int64, string) (string, string); ExactOutSwapRoute func(int, .uverse.realm, string, string, string, string, string, string, int64, string) (string, string); GetPendingProtocolFees func() map[string]int64; GetSwapFee func() uint64; Render func(string) string; SetSwapFee func(int, .uverse.realm, uint64); SwapCallback func(int, .uverse.realm, string, string, int64, int64, .uverse.address) .uverse.error}

    Signatures reconstructed verbatim from vm/qfuncs — interface params keep their inline definitions.

    Rendered

    RenderedRawgnoweb ↗
    This realm does not provide renderable output (vm/qrender → NoRenderDeclError). View on gnoweb ↗

    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.