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

limit state

Back to all declarations

ErrSpoofedRealm

untyped string

ErrSpoofedRealm is returned when a store write gets a non-current realm.

Value

"spoofed realm"

ErrNilInitializer

untyped string

ErrNilInitializer is raised by RegisterInitializer for a nil factory.

Value

"nil initializer"

errImplNotInitialized

untyped string

Value

"implementation is not initialized"

errInvalidImpl

untyped string

Value

"impl is not an ILimitOrder"

errInvalidDomainStore

untyped string

Value

"domainStore is not an ILimitOrderStore"

errNilConfig

untyped string

Value

"config is nil"

errImplDoesNotSupportTargetedCleanup

untyped string

Value

"implementation does not support targeted expired-order cleanup"

errImplDoesNotSupportFeeCollection

untyped string

Value

"implementation does not support pending execution fee collection"

errInvalidSwapCallback

untyped string

Value

"invalid swap callback"

errNilValue

untyped string

Value

"%s is nil"

errInvalidConfigType

untyped string

Value

"failed to cast config: %T"

GetConfig

func() *v0.Config

GetConfig returns a detached copy of the current global configuration. Returns: - \*plimit.Config: copy of the stored configuration

Open
OID
0a3476…6398:3
GetConfig details

Inspect func

GetExecutionFeeRate

func() int64

GetExecutionFeeRate returns the execution fee rate snapshotted into new orders. Returns: - int64: execution fee rate, in basis points of gross output

Open
OID
0a3476…6398:5
GetExecutionFeeRate details

Inspect func

GetMaxSlippageBps

func() int64

GetMaxSlippageBps returns the slippage cap for new orders. Returns: - int64: maximum slippage, in basis points

Open
OID
0a3476…6398:6
GetMaxSlippageBps details

Inspect func

GetMinMakingAmount

func() int64

GetMinMakingAmount returns the minimum input amount for new orders. Returns: - int64: minimum makingAmount, in raw token units

Open
OID
0a3476…6398:7
GetMinMakingAmount details

Inspect func

GetOrderDeadlines

func() (int64, int64)

GetOrderDeadlines returns the allowed order duration range for new orders. Returns: - int64: shortest allowed expiresAt - createdAt, in seconds - int64: longest allowed expiresAt - createdAt, in seconds

Open
OID
0a3476…6398:8
GetOrderDeadlines details

Inspect func

GetMaxCleanupBatchSize

func() int64

GetMaxCleanupBatchSize returns the most orders one CleanupExpiredOrders call examines. Returns: - int64: maximum cleanup batch size

Open
OID
0a3476…6398:9
GetMaxCleanupBatchSize details

Inspect func

GetNextOrderID

func() uint64

GetNextOrderID returns the ID the next created order receives. Returns: - uint64: next order ID

Open
OID
0a3476…6398:10
GetNextOrderID details

Inspect func

ExistsOrder

func(orderID uint64) bool

ExistsOrder reports whether an order is pending. Settled orders are deleted. Parameters: - orderID: order to look up Returns: - bool: true while the order is pending

Open
OID
0a3476…6398:11
ExistsOrder details

Inspect func

GetOrder

func(orderID uint64) *v0.Order

GetOrder returns a detached pending order, or nil after it is settled. Parameters: - orderID: order to look up Returns: - \*plimit.Order: copy of the order; nil when it is not pending

Open
OID
0a3476…6398:12
GetOrder details

Inspect func

GetOrders

func() *v0.ReadOnlyTree

GetOrders returns a live read-only view of pending orders. Returns: - \*rotree.ReadOnlyTree: plimit.OrderKey(orderID) -> \*plimit.Order; each order read from the view is detached from stored state

Open
OID
0a3476…6398:13
GetOrders details

Inspect func

GetOrdersByOwner

func() *v0.ReadOnlyTree

GetOrdersByOwner returns the read-only owner index of pending orders. Iterate the \[plimit.OwnerOrderPrefix(owner), plimit.PrefixEnd(prefix)) range for one owner's orders in ID order, choosing the page size. Returns: - \*rotree.ReadOnlyTree: plimit.OwnerOrderKey(owner, orderID) -> uint64 orderID

Open
OID
0a3476…6398:14
GetOrdersByOwner details

Inspect func

GetPendingExecutionFeeAmount

func(tokenPath string) int64

GetPendingExecutionFeeAmount returns execution fees held for tokenPath until the protocol fee realm accepts them. A later fill with the same output token retries collection. Parameters: - tokenPath: fee token path Returns: - int64: pending execution fee, in raw token units

Open
OID
0a3476…6398:15
GetPendingExecutionFeeAmount details

Inspect func

GetPendingExecutionFees

func() *v0.ReadOnlyTree

GetPendingExecutionFees returns the read-only index of pending execution fees. Returns: - \*rotree.ReadOnlyTree: tokenPath -> int64 pending amount

Open
OID
0a3476…6398:16
GetPendingExecutionFees details

Inspect func

expiredOrderCleanup

type

Value

limit.expiredOrderCleanup

pendingExecutionFeeCollector

type

Value

limit.pendingExecutionFeeCollector

CreateOrder

func(tokenIn string, tokenOut string, makingAmount int64, takingAmount int64, slippageBps int64, expiresAt int64, baseToken string) uint64

CreateOrder escrows makingAmount of tokenIn for takingAmount of tokenOut. Each fill supplies its pool fee tier and price limit. slippageBps=0 enforces the making/taking ratio or better. expiresAt must be positive and within the configured duration bounds. The execution fee rate is snapshotted into each new order. baseToken must be tokenIn (Sell) or tokenOut (Buy); it is emitted only as creation metadata and does not affect the order's execution terms. The caller must first approve Address() for makingAmount. Reverts while execution is halted for Limit orders.

Open
OID
0a3476…6398:17
CreateOrder details

Inspect func

CancelOrder

func(orderID uint64) int64

CancelOrder refunds the remaining input and removes the order from the indexes. A past-deadline refund uses the expired event. It returns the refunded input. Owner only. Reverts while withdrawals are halted for limit orders.

Open
OID
0a3476…6398:19
CancelOrder details

Inspect func

ExecuteOrder

func(orderID uint64, maxAmountIn int64, poolFee uint32, sqrtPriceLimitX96 string) (int64, int64)

ExecuteOrder fills up to maxAmountIn through the order's token pair at poolFee. A nonzero sqrtPriceLimitX96 stops at that pool price and may leave input unspent in escrow. Zero requires maxAmountIn to be consumed in full. The order's minimum owner-net output is enforced on the actual input. Returns actual input and pool output before the order's execution fee; the owner is paid immediately after that fee is deducted. The immediate caller must be authorized for ExecuteOrder by the shared keeper policy. Reverts while execution or withdrawals are halted for limit orders.

Open
OID
0a3476…6398:20
ExecuteOrder details

Inspect func

CollectPendingExecutionFee

func(tokenPath string) (int64, int64)

CollectPendingExecutionFee forwards fees pending for tokenPath to the protocol fee realm without another fill. Anyone may call it; the caller receives nothing. Returns the amount forwarded and the amount left pending. Reverts while withdrawals are halted for Limit orders.

Open
OID
0a3476…6398:21
CollectPendingExecutionFee details

Inspect func

CleanupExpiredOrders

func(startAfterOrderID uint64, maxOrders int) (int, uint64)

CleanupExpiredOrders refunds pending orders after their deadline. Anyone may call it. One call examines at most min(maxOrders, maxCleanupBatchSize) orders after startAfterOrderID, in ID order. It returns the number of orders expired and the cursor for the next call; repeat until the cursor is 0. Reverts while withdrawals are halted for limit orders.

Open
OID
0a3476…6398:22
CleanupExpiredOrders details

Inspect func

CleanupExpiredOrdersByIDs

func(orderIDs string) (int, string)

CleanupExpiredOrdersByIDs refunds only the named expired orders. orderIDs is a strictly increasing comma-separated list of positive decimal order IDs. Existing unexpired or underfunded orders are returned for retry. Reverts while withdrawals are halted for limit orders.

Open
OID
0a3476…6398:23
CleanupExpiredOrdersByIDs details

Inspect func

SetExecutionFeeRate

func(executionFeeRate int64)

SetExecutionFeeRate sets the execution fee rate snapshotted into new orders, in basis points of gross output. Admin or governance only.

Open
OID
0a3476…6398:24
SetExecutionFeeRate details

Inspect func

SetMinMakingAmount

func(minMakingAmount int64)

SetMinMakingAmount sets the minimum input amount for new orders, in raw token units. Existing orders are unaffected. Admin or governance only.

Open
OID
0a3476…6398:25
SetMinMakingAmount details

Inspect func

SetOrderDeadlines

func(minDuration int64, maxDuration int64)

SetOrderDeadlines sets the allowed order duration range for new orders, in seconds. Admin or governance only.

Open
OID
0a3476…6398:26
SetOrderDeadlines details

Inspect func

SetMaxCleanupBatchSize

func(maxCleanupBatchSize int64)

SetMaxCleanupBatchSize caps the orders one CleanupExpiredOrders call examines, bounding its gas. Admin or governance only.

Open
OID
0a3476…6398:27
SetMaxCleanupBatchSize details

Inspect func

SetMaxSlippageBps

func(maxSlippageBps int64)

SetMaxSlippageBps sets the slippage cap for new orders in \[0, 10000] bps. Existing orders keep their slippage. Admin or governance only.

Open
OID
0a3476…6398:28
SetMaxSlippageBps details

Inspect func

currentAddress

.uverse.address

Value

<gnolang.StringValue>

initializeDomainStore

func(int, .uverse.realm, kvStore v1.KVStore) interface{...}
Open
OID
0a3476…6398:35
initializeDomainStore details

Inspect func

getImplementation

func() v0.ILimitOrder
Open
OID
0a3476…6398:37
getImplementation details

Inspect func

updateImplementation

func() .uverse.error
Open
OID
0a3476…6398:38
updateImplementation details

Inspect func

NewBPTreeN

func(fanout int) *v0.BPTree

NewBPTreeN allocates an empty B+tree in the order/limit realm. Implementations create the store trees through it, so the trees are owned by the realm that stores them.

Open
OID
0a3476…6398:39
NewBPTreeN details

Inspect func

StoreKey

type

StoreKey is a key of the limit order KV store.

Value

limit.StoreKey

StoreKeyOrders

limit.StoreKey

Store layout. Tree keys are built by the plimit key helpers. orders OrderKey -> *Order, pending orders only ordersByOwner OwnerOrderKey -> orderID, pending orders only pendingExecutionFees tokenPath -> int64, held until the protocol fee collector accepts them nextOrderID uint64 config *Config

Value

<gnolang.StringValue>

StoreKeyOrdersByOwner

limit.StoreKey

Store layout. Tree keys are built by the plimit key helpers. orders OrderKey -> *Order, pending orders only ordersByOwner OwnerOrderKey -> orderID, pending orders only pendingExecutionFees tokenPath -> int64, held until the protocol fee collector accepts them nextOrderID uint64 config *Config

Value

<gnolang.StringValue>

StoreKeyPendingExecutionFees

limit.StoreKey

Store layout. Tree keys are built by the plimit key helpers. orders OrderKey -> *Order, pending orders only ordersByOwner OwnerOrderKey -> orderID, pending orders only pendingExecutionFees tokenPath -> int64, held until the protocol fee collector accepts them nextOrderID uint64 config *Config

Value

<gnolang.StringValue>

StoreKeyNextOrderID

limit.StoreKey

Store layout. Tree keys are built by the plimit key helpers. orders OrderKey -> *Order, pending orders only ordersByOwner OwnerOrderKey -> orderID, pending orders only pendingExecutionFees tokenPath -> int64, held until the protocol fee collector accepts them nextOrderID uint64 config *Config

Value

<gnolang.StringValue>

StoreKeyConfig

limit.StoreKey

Store layout. Tree keys are built by the plimit key helpers. orders OrderKey -> *Order, pending orders only ordersByOwner OwnerOrderKey -> orderID, pending orders only pendingExecutionFees tokenPath -> int64, held until the protocol fee collector accepts them nextOrderID uint64 config *Config

Value

<gnolang.StringValue>

limitOrderStore

type

Value

limit.limitOrderStore

NewLimitOrderStore

func(kvStore v1.KVStore) v0.ILimitOrderStore

NewLimitOrderStore wraps the domain KV store.

Open
OID
0a3476…6398:41
NewLimitOrderStore details

Inspect func

NewSwapCallback

func(int, rlm .uverse.realm, tokenIn string, zeroForOne bool, maxAmountIn int64) func(...)

NewSwapCallback binds payment to this proxy's custody, the order's input token and its input budget. Only code already executing in the proxy's current realm context can create it. The closure is declared here so pool callbacks retain proxy custody rather than paying from an implementation realm.

Open
OID
0a3476…6398:42
NewSwapCallback details

Inspect func

RegisterInitializer

func(initializer func(...))

RegisterInitializer registers an implementation version. Each version calls it from init with a factory that receives the shared store. Only packages under this realm's path may register, and the first registration becomes active. A nil initializer is rejected before its version path is registered.

Open
OID
0a3476…6398:44
RegisterInitializer details

Inspect func

UpgradeImpl

func(packagePath string)

UpgradeImpl activates a previously registered version by package path. Admin or governance only.

Open
OID
0a3476…6398:46
UpgradeImpl details

Inspect func

GetImplementationPackagePath

func() string

GetImplementationPackagePath returns the active implementation path.

Open
OID
0a3476…6398:47
GetImplementationPackagePath details

Inspect func
ErrSpoofedRealm : untyped string ="spoofed realm"
ErrNilInitializer : untyped string ="nil initializer"
errImplNotInitialized : untyped string ="implementation is not initialized"
errInvalidImpl : untyped string ="impl is not an ILimitOrder"
errInvalidDomainStore : untyped string ="domainStore is not an ILimitOrderStore"
errNilConfig : untyped string ="config is nil"
errImplDoesNotSupportTargetedCleanup : untyped string ="implementation does not support targeted expired-order cleanup"
errImplDoesNotSupportFeeCollection : untyped string ="implementation does not support pending execution fee collection"
errInvalidSwapCallback : untyped string ="invalid swap callback"
errNilValue : untyped string ="%s is nil"
errInvalidConfigType : untyped string ="failed to cast config: %T"
GetConfig : func() *v0.Config Inspect
GetExecutionFeeRate : func() int64 Inspect
GetMaxSlippageBps : func() int64 Inspect
GetMinMakingAmount : func() int64 Inspect
GetOrderDeadlines : func() (int64, int64) Inspect
GetMaxCleanupBatchSize : func() int64 Inspect
GetNextOrderID : func() uint64 Inspect
ExistsOrder : func(orderID uint64) bool Inspect
GetOrder : func(orderID uint64) *v0.Order Inspect
GetOrders : func() *v0.ReadOnlyTree Inspect
GetOrdersByOwner : func() *v0.ReadOnlyTree Inspect
GetPendingExecutionFeeAmount : func(tokenPath string) int64 Inspect
GetPendingExecutionFees : func() *v0.ReadOnlyTree Inspect
expiredOrderCleanup : type =limit.expiredOrderCleanup
pendingExecutionFeeCollector : type =limit.pendingExecutionFeeCollector
CreateOrder : func(tokenIn string, tokenOut string, makingAmount int64, takingAmount int64, slippageBps int64, expiresAt int64, baseToken string) uint64 Inspect
CancelOrder : func(orderID uint64) int64 Inspect
ExecuteOrder : func(orderID uint64, maxAmountIn int64, poolFee uint32, sqrtPriceLimitX96 string) (int64, int64) Inspect
CollectPendingExecutionFee : func(tokenPath string) (int64, int64) Inspect
CleanupExpiredOrders : func(startAfterOrderID uint64, maxOrders int) (int, uint64) Inspect
CleanupExpiredOrdersByIDs : func(orderIDs string) (int, string) Inspect
SetExecutionFeeRate : func(executionFeeRate int64) Inspect
SetMinMakingAmount : func(minMakingAmount int64) Inspect
SetOrderDeadlines : func(minDuration int64, maxDuration int64) Inspect
SetMaxCleanupBatchSize : func(maxCleanupBatchSize int64) Inspect
SetMaxSlippageBps : func(maxSlippageBps int64) Inspect
currentAddress : .uverse.address =<gnolang.StringValue>
kvStore : *v1.kvStore Inspect
versionManager : *v1.versionManager Inspect
implementation : *v0.limitOrderImpl Inspect
init.41 : func() Inspect
initializeDomainStore : func(int, .uverse.realm, kvStore v1.KVStore) interface{...} Inspect
Address : func() .uverse.address Inspect
getImplementation : func() v0.ILimitOrder Inspect
updateImplementation : func() .uverse.error Inspect
NewBPTreeN : func(fanout int) *v0.BPTree Inspect
StoreKey : type =limit.StoreKey
StoreKeyOrders : limit.StoreKey =<gnolang.StringValue>
StoreKeyOrdersByOwner : limit.StoreKey =<gnolang.StringValue>
StoreKeyPendingExecutionFees : limit.StoreKey =<gnolang.StringValue>
StoreKeyNextOrderID : limit.StoreKey =<gnolang.StringValue>
StoreKeyConfig : limit.StoreKey =<gnolang.StringValue>
limitOrderStore : type =limit.limitOrderStore
NewLimitOrderStore : func(kvStore v1.KVStore) v0.ILimitOrderStore Inspect
NewSwapCallback : func(int, rlm .uverse.realm, tokenIn string, zeroForOne bool, maxAmountIn int64) func(...) Inspect
RegisterInitializer : func(initializer func(...)) Inspect
UpgradeImpl : func(packagePath string) Inspect
GetImplementationPackagePath : func() string Inspect