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

dca 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"

ErrUpgradeWhileExecuting

untyped string

ErrUpgradeWhileExecuting is raised by UpgradeImpl during a group swap.

Value

"cannot upgrade while a group execution is in progress"

ErrInvalidSwapCallback

untyped string

ErrInvalidSwapCallback is returned by a round's swap callback for a call it must not pay: not from the pool, outside a round, a second payment, or a delta that is not the round's exact input (e.g. a pool without liquidity owes nothing).

Value

"invalid swap callback"

errImplNotInitialized

untyped string

Value

"implementation is not initialized"

errInvalidImpl

untyped string

Value

"impl is not an IDCAOrder"

errInvalidDomainStore

untyped string

Value

"domainStore is not an IDCAOrderStore"

errNilConfig

untyped string

Value

"config is nil"

errNilValue

untyped string

Value

"%s is nil"

errInvalidConfigType

untyped string

Value

"failed to cast config: %T"

makeErrorWithDetails

func(message string, details string) .uverse.error
Open
OID
08e7a5…954e:3
makeErrorWithDetails details

Inspect func

GetConfig

func() *v0.Config

GetConfig returns a copy of the configuration. Returns: - \*pdca.Config: copy of the stored configuration

Open
OID
08e7a5…954e:5
GetConfig details

Inspect func

GetExecutionFeeRate

func() int64

GetExecutionFeeRate returns the execution fee rate new orders snapshot: the share of an order's output sent to the protocol fee realm. An existing order's rate is pdca.Order.ExecutionFeeRate (see GetOrder). Returns: - int64: execution fee rate, in basis points

Open
OID
08e7a5…954e:7
GetExecutionFeeRate details

Inspect func

GetMaxPoolPriceDeviationRate

func() int64

GetMaxPoolPriceDeviationRate returns how far, in basis points of price, a pool's price may sit on the favorable side of its swap price limit and still be quoted (see SetMaxPoolPriceDeviationRate); 0 means the check is off. Returns: - int64: rate in basis points

Open
OID
08e7a5…954e:8
GetMaxPoolPriceDeviationRate details

Inspect func

GetMaxPairPriceLimitAge

func() int64

GetMaxPairPriceLimitAge returns how long, in seconds, a pair price limit stays usable after it was set (see SetMaxPairPriceLimitAge). Returns: - int64: maximum age in seconds

Open
OID
08e7a5…954e:9
GetMaxPairPriceLimitAge details

Inspect func

GetMaxExecutionCount

func() int64

GetMaxExecutionCount returns the maximum executions of a new order. Returns: - int64: maximum executionCount

Open
OID
08e7a5…954e:10
GetMaxExecutionCount details

Inspect func

GetAllowedIntervals

func() []int64

GetAllowedIntervals returns the intervals new orders may use. Returns: - \[]int64: allowed intervals in seconds, ascending

Open
OID
08e7a5…954e:11
GetAllowedIntervals details

Inspect func

IsAllowedInterval

func(interval int64) bool

IsAllowedInterval reports whether new orders may use interval. Parameters: - interval: round interval, in seconds Returns: - bool: true when interval is allowed

Open
OID
08e7a5…954e:12
IsAllowedInterval details

Inspect func

GetSlotStep

func(interval int64) int64

GetSlotStep returns the spacing of the slot offsets new orders may use at interval. Parameters: - interval: round interval, in seconds Returns: - int64: slot step in seconds; 0 when interval is not allowed

Open
OID
08e7a5…954e:13
GetSlotStep details

Inspect func

GetMinExecutionGapRate

func() int64

GetMinExecutionGapRate returns the minimum gap between a group's executions. Returns: - int64: minimum gap, in basis points of the group interval

Open
OID
08e7a5…954e:14
GetMinExecutionGapRate details

Inspect func

GetMaxClaimBatchSize

func() int64

GetMaxClaimBatchSize returns the most orders one ClaimGroupOrders call examines. Returns: - int64: maximum claim batch size

Open
OID
08e7a5…954e:15
GetMaxClaimBatchSize details

Inspect func

GetNextOrderID

func() uint64

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

Open
OID
08e7a5…954e:16
GetNextOrderID details

Inspect func

ExistsOrder

func(orderID uint64) bool

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

Open
OID
08e7a5…954e:17
ExistsOrder details

Inspect func

GetOrder

func(orderID uint64) (*v0.Order, .uverse.error)

GetOrder returns a copy of an active order. Finished orders are deleted and return an error. Parameters: - orderID: order to look up Returns: - \*pdca.Order: copy of the order - error: non-nil when the order is not active

Open
OID
08e7a5…954e:18
GetOrder details

Inspect func

GetOrders

func() *v0.ReadOnlyTree

GetOrders returns a read-only view of active orders. Returns: - \*rotree.ReadOnlyTree: pdca.OrderKey(orderID) -> \*pdca.Order; each order read from the view is a copy

Open
OID
08e7a5…954e:19
GetOrders details

Inspect func

GetOrdersByOwner

func() *v0.ReadOnlyTree

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

Open
OID
08e7a5…954e:20
GetOrdersByOwner details

Inspect func

GetOrderIDsByOwner

func(owner .uverse.address, startAfterID uint64, count int) []uint64

GetOrderIDsByOwner returns up to count active order IDs of owner, ascending and greater than startAfterID (0 starts from the first). Page by passing the last returned ID. Parameters: - owner: order owner - startAfterID: exclusive lower bound of the returned IDs - count: maximum number of IDs returned Returns: - \[]uint64: active order IDs, ascending

Open
OID
08e7a5…954e:21
GetOrderIDsByOwner details

Inspect func

GetClaimableAmount

func(orderID uint64) int64

GetClaimableAmount returns the output an order can claim now, net of the order's execution fee. Parameters: - orderID: order to look up Returns: - int64: output the next Claim pays the owner; 0 when the order is not active

Open
OID
08e7a5…954e:22
GetClaimableAmount details

Inspect func

GetOrderExecutionLogs

func(orderID uint64, count int) ([]*v0.ExecutionLog, .uverse.error)

GetOrderExecutionLogs returns copies of up to count of an active order's unreleased execution logs, oldest first: each covers up to three rounds, \[FirstRound, LastRound], and the input the order sells in each. A log is released once all of its rounds executed and the order is claimed; the rounds' swap results are in the DCAGroupExecuted events. Parameters: - orderID: order to look up - count: maximum number of logs returned Returns: - \[]\*pdca.ExecutionLog: copies of the order's unreleased logs - error: non-nil when the order is not active

Open
OID
08e7a5…954e:23
GetOrderExecutionLogs details

Inspect func

GetExecutionLogs

func() *v0.ReadOnlyTree

GetExecutionLogs returns the read-only index of unreleased execution logs. Iterate the \[pdca.ExecutionLogPrefix(orderID), pdca.PrefixEnd(prefix)) range for one order's logs; the key suffix decodes to the first round. Returns: - \*rotree.ReadOnlyTree: pdca.ExecutionLogKey(orderID, firstRound) -> uint64 lastRound

Open
OID
08e7a5…954e:24
GetExecutionLogs details

Inspect func

ExistsGroup

func(groupID string) bool

ExistsGroup reports whether a group is stored. Parameters: - groupID: pdca.MakeGroupID(inputToken, outputToken, interval, slotOffset) Returns: - bool: true when the group exists

Open
OID
08e7a5…954e:25
ExistsGroup details

Inspect func

GetGroup

func(groupID string) (*v0.Group, .uverse.error)

GetGroup returns a copy of a group without its round marks. The copy's round mark tree is empty; read the marks through GetGroupRoundMarks. Parameters: - groupID: group to look up Returns: - \*pdca.Group: copy of the group's fields - error: non-nil when the group does not exist

Open
OID
08e7a5…954e:26
GetGroup details

Inspect func

GetGroups

func() *v0.ReadOnlyTree

GetGroups returns a read-only view of every group. Returns: - \*rotree.ReadOnlyTree: groupID -> \*pdca.Group; each group read from the view is a copy without its round marks, as GetGroup returns

Open
OID
08e7a5…954e:27
GetGroups details

Inspect func

GetGroupRoundMarks

func(groupID string) *v0.ReadOnlyTree

GetGroupRoundMarks returns a read-only view of a group's round marks: one per round at which an unfinalized order ends. Parameters: - groupID: group to look up Returns: - \*rotree.ReadOnlyTree: pdca.RoundKey(round) -> \*pdca.RoundMark; each mark read from the view is a copy. nil when the group does not exist

Open
OID
08e7a5…954e:28
GetGroupRoundMarks details

Inspect func

GetOrdersByGroup

func() *v0.ReadOnlyTree

GetOrdersByGroup returns the read-only group index of active orders. Iterate the \[pdca.GroupOrderPrefix(groupID), pdca.PrefixEnd(prefix)) range for one group's orders in ID order. Returns: - \*rotree.ReadOnlyTree: pdca.GroupOrderKey(groupID, orderID) -> uint64 orderID

Open
OID
08e7a5…954e:29
GetOrdersByGroup details

Inspect func

GetOrderAmountsByGroup

func() *v0.ReadOnlyTree

GetOrderAmountsByGroup returns the read-only group index of orders by executionFeeRate, then amountPerExecution, which a round reads for the smallest order of each fee rate. Iterate the \[pdca.GroupOrderPrefix(groupID), pdca.PrefixEnd(prefix)) range for one group's orders by ascending executionFeeRate, amountPerExecution, then ID, or the \[pdca.GroupOrderFeeRatePrefix(groupID, rate), pdca.PrefixEnd(prefix)) range for the orders of one fee rate. A finished order's entry stays until the order is paid out or a later round of its group removes it. Returns: - \*rotree.ReadOnlyTree: pdca.GroupOrderAmountKey(groupID, executionFeeRate, amountPerExecution, orderID) -> uint64 endRound

Open
OID
08e7a5…954e:30
GetOrderAmountsByGroup details

Inspect func

GetOrderIDsByGroup

func(groupID string, startAfterID uint64, count int) []uint64

GetOrderIDsByGroup returns up to count active order IDs of a group, ascending and greater than startAfterID. Page as GetOrderIDsByOwner. Parameters: - groupID: group to look up - startAfterID: exclusive lower bound of the returned IDs - count: maximum number of IDs returned Returns: - \[]uint64: active order IDs, ascending

Open
OID
08e7a5…954e:31
GetOrderIDsByGroup details

Inspect func

GetScheduledGroups

func() *v0.ReadOnlyTree

GetScheduledGroups returns the read-only schedule of groups with input to sell, ordered by next execution timestamp, then group ID. pdca.ScheduleKeyTimestamp decodes a key's timestamp. Returns: - \*rotree.ReadOnlyTree: pdca.ScheduleKey(nextExecutionTimestamp, groupID) -> string groupID

Open
OID
08e7a5…954e:32
GetScheduledGroups details

Inspect func

GetExecutableGroups

func(cursor string, count int) ([]*v0.Group, .uverse.error)

GetExecutableGroups returns copies of up to count groups due now, oldest first. Paging: start with cursor "", then pass pdca.FormatScheduleCursor of the last group back until fewer than count groups return. The cursor is a fixed schedule position, so groups executed between pages do not shift it. Parameters: - cursor: "" or "\<nextExecutionTimestamp>|\<groupID>" of the last group seen - count: maximum number of groups returned Returns: - \[]\*pdca.Group: copies of due groups without their round marks; empty while execution is halted - error: non-nil when cursor is malformed

Open
OID
08e7a5…954e:33
GetExecutableGroups details

Inspect func

GetExecutionQuote

func(groupID string) string

GetExecutionQuote returns, as JSON, how the group's next round would trade now: its input, the selected pool, the expected pool output, an estimate of the orders' execution fees on that output and of what is left for the orders, and every candidate pool's quote or ineligibility reason. Orders pay their own snapshotted fee rates when paid out, each rounding its own cumulative fee. The fee and order output totals instead charge executionFeeRate, the highest rate of the orders the round sells (0 when none does), once on the whole output, so they are estimates, not bounds: the fees the orders pay can exceed expectedExecutionFeeAmount by rounding. minAmountsByExecutionFeeRate lists, by ascending fee rate, the smallest order of each rate the round sells. The round reverts unless every listed order is credited at least max(1, minOrderAmountOut) net of its rate; expectedMinOrderAmountOut is the least such output at expectedAmountOut, and minAmountPerExecution the smallest order overall. Keepers set amountOutMin from expectedAmountOut and pass amountIn as expectedAmountIn. Parameters: - groupID: group to quote Returns: - string: JSON quote; "" when the group does not exist

Open
OID
08e7a5…954e:34
GetExecutionQuote details

Inspect func

GetTokenMinAmountPerExecution

func(tokenPath string) int64

GetTokenMinAmountPerExecution returns the minimum input per execution the manager set for tokenPath (see SetTokenMinAmountPerExecution). Parameters: - tokenPath: input token path Returns: - int64: minimum in raw token units; 0 when none is set

Open
OID
08e7a5…954e:35
GetTokenMinAmountPerExecution details

Inspect func

GetMinAmountPerExecution

func(tokenPath string) int64

GetMinAmountPerExecution returns the minimum input per execution a new order selling tokenPath needs: the larger of GetConfig().MinAmountPerExecution() and GetTokenMinAmountPerExecution(tokenPath). Parameters: - tokenPath: input token path Returns: - int64: effective minimum, in raw token units

Open
OID
08e7a5…954e:36
GetMinAmountPerExecution details

Inspect func

GetTokenMinAmountsPerExecution

func() *v0.ReadOnlyTree

GetTokenMinAmountsPerExecution returns the read-only index of per-token minimums, in key order. Returns: - \*rotree.ReadOnlyTree: tokenPath -> int64

Open
OID
08e7a5…954e:37
GetTokenMinAmountsPerExecution details

Inspect func

GetPairPriceLimit

func(inputToken string, outputToken string) (string, int64)

GetPairPriceLimit returns the price limit of selling inputToken for outputToken (see SetPairPriceLimit). Parameters: - inputToken, outputToken: the pair direction Returns: - string: minOutputPerInputX128, decimal Q128; "0" when none is set - int64: unix time the limit was set; 0 when none is set

Open
OID
08e7a5…954e:38
GetPairPriceLimit details

Inspect func

GetPairPriceLimits

func() *v0.ReadOnlyTree

GetPairPriceLimits returns a read-only view of the pair price limits, in key order. Entries are copies. Returns: - \*rotree.ReadOnlyTree: "inputToken:outputToken" -> \*pdca.PairPriceLimit

Open
OID
08e7a5…954e:39
GetPairPriceLimits details

Inspect func

GetPendingExecutionFeeAmount

func(tokenPath string) int64

GetPendingExecutionFeeAmount returns the execution fee of tokenPath held by this realm: fees payouts charged, and fees the protocol fee realm could not accept yet. It is forwarded by the next round whose output token is tokenPath, or by CollectPendingExecutionFee. Parameters: - tokenPath: fee token path Returns: - int64: pending execution fee, in raw token units

Open
OID
08e7a5…954e:40
GetPendingExecutionFeeAmount details

Inspect func

GetPendingExecutionFees

func() *v0.ReadOnlyTree

GetPendingExecutionFees returns the read-only index of pending execution fees. A token whose pending fee was forwarded keeps its entry at 0. Returns: - \*rotree.ReadOnlyTree: tokenPath -> int64 pending amount

Open
OID
08e7a5…954e:41
GetPendingExecutionFees details

Inspect func

CreateOrder

func(inputToken string, outputToken string, interval int64, slotOffset int64, amountPerExecution int64, executionCount int64) uint64

CreateOrder creates an order that sells amountPerExecution of inputToken for outputToken every interval seconds, executionCount times, and returns its ID. The caller must first approve Address() for amountPerExecution\*executionCount. amountPerExecution must be at least GetMinAmountPerExecution(inputToken), and the pair direction needs a price limit (see SetPairPriceLimit). The order snapshots the execution fee rate in effect (see GetExecutionFeeRate) for its lifetime: the fee is that share of the order's output, deducted when the output is paid out. Later rate changes apply only to orders created afterwards. Orders with the same inputToken, outputToken, interval, and slotOffset share one group and execute together. Each round trades on the pair's best whitelisted pool, chosen at execution time (see GetExecutionQuote). The caller also pays the storage deposit of the order's execution logs, one per three rounds; each is refunded to whoever releases it after all of its rounds execute (see ClaimGroupOrders). Parameters: - inputToken, outputToken: at least one whitelisted direct pool must connect them (see gno.land/r/gnoswap/order/whitelist.AddWhitelistedPool). - interval: one of GetConfig().AllowedIntervals(). - slotOffset: seconds after each interval boundary of the unix epoch at which rounds run, a multiple of GetConfig().SlotStep(interval) in \[0, interval). Boundaries are UTC midnights for daily intervals; weekly boundaries fall on Thursdays 00:00 UTC (1970-01-01 was one), so a Monday slot is 4 days. The first round waits for the next slot, or runs now if it is due. Reverts while the execute operation is halted for DCA in gno.land/r/gnoswap/order/halt.

Open
OID
08e7a5…954e:42
CreateOrder details

Inspect func

CancelOrder

func(orderID uint64) (int64, int64)

CancelOrder pays accrued output, refunds unsold input, and closes the order. It returns the refunded input and the output paid by this call. Owner only. Reverts while the withdraw operation is halted.

Open
OID
08e7a5…954e:44
CancelOrder details

Inspect func

Claim

func(orderID uint64) int64

Claim pays accrued output to the order owner and returns the amount. Anyone may call it, e.g. a keeper delivering output; proceeds always go to the owner. The order's execution logs whose rounds all executed are released, and their storage deposit is refunded to the caller. Reverts while the withdraw operation is halted.

Open
OID
08e7a5…954e:45
Claim details

Inspect func

ExecuteGroup

func(groupID string, expectedAmountIn int64, amountOutMin int64, minOrderAmountOut int64) (int64, int64)

ExecuteGroup runs the next round of a group once it is due. Only accounts holding the DCA keeper role in gno.land/r/gnoswap/order/keeper may call it: the ExecuteGroup selector is assigned to DCAKeeperRole at deployment, and admin or governance grants the role or reassigns it. It returns the round input and the output credited to the orders, before their execution fees, which each order pays when paid out. Parameters: - groupID: see GetExecutableGroups. - amountOutMin: minimum pool output, before the execution fee; 0 disables it. - expectedAmountIn: the group orderAmount amountOutMin was quoted for. The round reverts if the orderAmount differs; 0 is accepted only with amountOutMin 0. - minOrderAmountOut: the least output every order of the round must be credited after its own execution fee rate (see GetExecutionQuote), in the output token's smallest unit; 0 means 1. The round reverts when its smallest order would receive less. Pool selection: among the pair's whitelisted pools (one per fee tier), the pool with the best quote for the full round is used. The round swaps on that pool directly through gno.land/r/gnoswap/pool, without the router, so no router fee is charged. The swap's price limit comes from the pair price limit (see SetPairPriceLimit), so no unit of input is sold below it, whatever amountOutMin is. The round reverts when no whitelisted pool can fill it within the limit. Reverts while the execute or withdraw operation is halted.

Open
OID
08e7a5…954e:46
ExecuteGroup details

Inspect func

ClaimGroupOrders

func(groupID string, startAfterOrderID uint64, maxOrderCount int) (int, uint64)

ClaimGroupOrders pays accrued output to the owners of a group's active orders, as Claim does, so owners receive output without claiming. Anyone may call it; output always goes to the order owner. One call examines at most min(maxOrderCount, maxClaimBatchSize) orders after startAfterOrderID, in ID order. It returns the number of orders paid or completed and the cursor for the next call; repeat until the cursor is 0. Each order's execution logs whose rounds all executed are released and finished orders are deleted; the freed storage deposit is refunded to the caller, so the reward grows with the orders and rounds claimed. Reverts while the withdraw operation is halted.

Open
OID
08e7a5…954e:47
ClaimGroupOrders details

Inspect func

ForceCancelOrder

func(orderID uint64) (int64, int64)

ForceCancelOrder closes an order that blocks its group's rounds. As with CancelOrder, accrued output and unsold input go to the order owner; the caller receives nothing but the freed storage deposit of the order's execution logs. It returns the refunded input and the output paid. The order must have rounds left and be, as checked on-chain: - below the minimum per execution a new order of its token needs now (reason below\_min\_amount), or - in a due round that, as quoted now, credits it less than one output unit after its execution fee (no\_order\_output), or - the largest order (by amountPerExecution, ties included) of a due round that no pool can fill as quoted now while a pool fills part of it, with some output, within the price limit (exceeds\_pool\_capacity). A round that needs several orders gone is shrunk one largest order per call. Any other order reverts with "order does not block its group". DCAOrderForceCancelled reports the reason. Only accounts holding the role assigned to the ForceCancelOrder selector in gno.land/r/gnoswap/order/keeper (DCAKeeperRole at deployment). Reverts while the withdraw operation is halted.

Open
OID
08e7a5…954e:48
ForceCancelOrder details

Inspect func

CollectPendingExecutionFee

func(tokenPath string) (int64, int64)

CollectPendingExecutionFee forwards the execution fee pending for tokenPath (see GetPendingExecutionFeeAmount) to the protocol fee realm and returns the amount forwarded and the amount left pending. Payouts keep each order's execution fee as pending, and every round forwards the pending fee of its output token; this forwards it when no round of that output token runs. If the protocol fee realm rejects it, for example while its collection is halted, the fee stays pending. Anyone may call it: the fee only moves to the protocol fee realm. Reverts while the withdraw operation is halted.

Open
OID
08e7a5…954e:49
CollectPendingExecutionFee details

Inspect func

SetExecutionFeeRate

func(executionFeeRate int64)

SetExecutionFeeRate sets the share of an order's output, in basis points (0 to 1000, at most 10%), sent to the protocol fee realm. Orders created afterwards snapshot it; existing orders keep their rate. Admin or governance only.

Open
OID
08e7a5…954e:50
SetExecutionFeeRate details

Inspect func

SetOrderLimits

func(minAmountPerExecution int64, maxExecutionCount int64)

SetOrderLimits sets the minimum input per execution and the maximum executions per order. Admin or governance only.

Open
OID
08e7a5…954e:51
SetOrderLimits details

Inspect func

AddAllowedInterval

func(interval int64)

AddAllowedInterval allows new orders to use interval, in seconds (one minute to one year). The interval starts with a single slot, offset 0 (see SetSlotStep). Admin or governance only.

Open
OID
08e7a5…954e:52
AddAllowedInterval details

Inspect func

RemoveAllowedInterval

func(interval int64)

RemoveAllowedInterval stops new orders from using interval. Existing orders and groups of that interval keep running until they finish; its slot step is dropped, and re-adding it starts from a single slot. At least one interval must stay allowed. Admin or governance only.

Open
OID
08e7a5…954e:53
RemoveAllowedInterval details

Inspect func

SetMinExecutionGapRate

func(minExecutionGapRate int64)

SetMinExecutionGapRate sets the minimum gap between two executions of a group, in basis points of its interval (0 to 10000), so a late execution is not followed right away by the next one. Admin or governance only.

Open
OID
08e7a5…954e:54
SetMinExecutionGapRate details

Inspect func

SetMaxClaimBatchSize

func(maxClaimBatchSize int64)

SetMaxClaimBatchSize caps the orders one ClaimGroupOrders call examines, bounding its gas. Admin or governance only.

Open
OID
08e7a5…954e:55
SetMaxClaimBatchSize details

Inspect func

SetMaxPoolPriceDeviationRate

func(maxPoolPriceDeviationRate int64)

SetMaxPoolPriceDeviationRate sets how far, in basis points of price, a pool's price may sit on the favorable side of its swap price limit (see SetPairPriceLimit) and still be quoted, 0 to 10000; 0 disables the check. A pool further away is ineligible without a quote: its quote or swap would walk every tick between its price and the limit, which an empty or manipulated pool far from the oracle price makes unbounded. v0 starts at 2000 (20%). Admin or governance only.

Open
OID
08e7a5…954e:56
SetMaxPoolPriceDeviationRate details

Inspect func

SetMaxPairPriceLimitAge

func(maxPairPriceLimitAge int64)

SetMaxPairPriceLimitAge sets how long, in seconds, a pair price limit stays usable after the pool manager set it (see SetPairPriceLimit), 60 to 604800. Under an older limit every pool is ineligible (code price\_limit\_stale), so rounds stop until the limit is refreshed instead of trading at a stale price. v0 starts at 3600 (one hour). Admin or governance only.

Open
OID
08e7a5…954e:57
SetMaxPairPriceLimitAge details

Inspect func

SetSlotStep

func(interval int64, slotStep int64)

SetSlotStep sets the spacing, in seconds, of the slot offsets new orders may use at interval: slotStep must divide the interval, and the interval then has interval/slotStep slots. slotStep == interval allows offset 0 only. Existing groups keep their slot, even one the new step no longer allows; only new orders are checked. Finer steps split each pair's orders into more groups, so each round sells less in more swaps. Admin or governance only.

Open
OID
08e7a5…954e:58
SetSlotStep details

Inspect func

SetTokenMinAmountPerExecution

func(tokenPath string, minAmountPerExecution int64)

SetTokenMinAmountPerExecution sets the minimum input per execution of new orders selling tokenPath, in raw token units, applied on top of the global minimum (see SetOrderLimits); 0 removes it. The pool manager derives it from an oracle price, so every order is worth a set value per round whatever the token's decimals. Existing orders are unaffected. Admin, governance, or accounts holding the role assigned to the SetTokenMinAmountPerExecution selector in gno.land/r/gnoswap/order/keeper (PoolManagerRole at deployment).

Open
OID
08e7a5…954e:59
SetTokenMinAmountPerExecution details

Inspect func

SetPairPriceLimit

func(inputToken string, outputToken string, minOutputPerInputX128 string)

SetPairPriceLimit sets the least pool output, before the execution fee, that rounds selling inputToken for outputToken accept per unit of input: minOutputPerInputX128 is raw outputToken units per raw inputToken unit, in Q128 fixed point, as a decimal string. "0" removes the limit. Every quote and round of the pair direction passes the limit to the pool as its swap price limit, adjusted for the pool's fee tier, so each unit of input fills at a rate of at least the limit and a swap crosses only the ticks up to it. A pool whose price is past the limit is skipped, and a round that cannot be filled within it reverts. A pair direction without a limit cannot be quoted, executed, or receive new orders. The limit applies from the next quote or round, to existing orders too. Its update time is recorded but not checked on-chain. Admin, governance, or accounts holding the role assigned to the SetPairPriceLimit selector in gno.land/r/gnoswap/order/keeper (PoolManagerRole at deployment).

Open
OID
08e7a5…954e:60
SetPairPriceLimit details

Inspect func

currentAddress

.uverse.address

Value

<gnolang.StringValue>

initializeDomainStore

func(int, rlm .uverse.realm, kvStore v1.KVStore) interface{...}
Open
OID
08e7a5…954e:67
initializeDomainStore details

Inspect func

getImplementation

func() v0.IDCAOrder
Open
OID
08e7a5…954e:69
getImplementation details

Inspect func

updateImplementation

func() .uverse.error
Open
OID
08e7a5…954e:70
updateImplementation details

Inspect func

NewBPTreeN

func(fanout int) *v0.BPTree

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

Open
OID
08e7a5…954e:71
NewBPTreeN details

Inspect func

StoreKey

type

StoreKey is a key of the DCA KV store.

Value

dca.StoreKey

StoreKeyOrders

dca.StoreKey

Store layout. Tree keys are built by the pdca key helpers. orders OrderKey -> *Order ordersByOwner OwnerOrderKey -> orderID groups groupID -> *Group scheduledGroups ScheduleKey -> groupID, groups with orderAmount > 0 only nextOrderID uint64 config *Config executing true while ExecuteGroup is inside its pool swap ordersByGroup GroupOrderKey -> orderID, active orders only pendingExecutionFees tokenPath -> int64, fees not yet sent to protocol_fee executionLogs ExecutionLogKey -> lastRound uint64, unreleased logs of active orders orderAmountsByGroup GroupOrderAmountKey -> endRound, orders by executionFeeRate, then amountPerExecution tokenMinAmountsPerExecution tokenPath -> int64, per-token minimum input per execution pairPriceLimits PairKey -> *PairPriceLimit, minimum pool output per input of a pair direction

Value

<gnolang.StringValue>

StoreKeyOrdersByOwner

dca.StoreKey

Store layout. Tree keys are built by the pdca key helpers. orders OrderKey -> *Order ordersByOwner OwnerOrderKey -> orderID groups groupID -> *Group scheduledGroups ScheduleKey -> groupID, groups with orderAmount > 0 only nextOrderID uint64 config *Config executing true while ExecuteGroup is inside its pool swap ordersByGroup GroupOrderKey -> orderID, active orders only pendingExecutionFees tokenPath -> int64, fees not yet sent to protocol_fee executionLogs ExecutionLogKey -> lastRound uint64, unreleased logs of active orders orderAmountsByGroup GroupOrderAmountKey -> endRound, orders by executionFeeRate, then amountPerExecution tokenMinAmountsPerExecution tokenPath -> int64, per-token minimum input per execution pairPriceLimits PairKey -> *PairPriceLimit, minimum pool output per input of a pair direction

Value

<gnolang.StringValue>

StoreKeyGroups

dca.StoreKey

Store layout. Tree keys are built by the pdca key helpers. orders OrderKey -> *Order ordersByOwner OwnerOrderKey -> orderID groups groupID -> *Group scheduledGroups ScheduleKey -> groupID, groups with orderAmount > 0 only nextOrderID uint64 config *Config executing true while ExecuteGroup is inside its pool swap ordersByGroup GroupOrderKey -> orderID, active orders only pendingExecutionFees tokenPath -> int64, fees not yet sent to protocol_fee executionLogs ExecutionLogKey -> lastRound uint64, unreleased logs of active orders orderAmountsByGroup GroupOrderAmountKey -> endRound, orders by executionFeeRate, then amountPerExecution tokenMinAmountsPerExecution tokenPath -> int64, per-token minimum input per execution pairPriceLimits PairKey -> *PairPriceLimit, minimum pool output per input of a pair direction

Value

<gnolang.StringValue>

StoreKeyScheduledGroups

dca.StoreKey

Store layout. Tree keys are built by the pdca key helpers. orders OrderKey -> *Order ordersByOwner OwnerOrderKey -> orderID groups groupID -> *Group scheduledGroups ScheduleKey -> groupID, groups with orderAmount > 0 only nextOrderID uint64 config *Config executing true while ExecuteGroup is inside its pool swap ordersByGroup GroupOrderKey -> orderID, active orders only pendingExecutionFees tokenPath -> int64, fees not yet sent to protocol_fee executionLogs ExecutionLogKey -> lastRound uint64, unreleased logs of active orders orderAmountsByGroup GroupOrderAmountKey -> endRound, orders by executionFeeRate, then amountPerExecution tokenMinAmountsPerExecution tokenPath -> int64, per-token minimum input per execution pairPriceLimits PairKey -> *PairPriceLimit, minimum pool output per input of a pair direction

Value

<gnolang.StringValue>

StoreKeyNextOrderID

dca.StoreKey

Store layout. Tree keys are built by the pdca key helpers. orders OrderKey -> *Order ordersByOwner OwnerOrderKey -> orderID groups groupID -> *Group scheduledGroups ScheduleKey -> groupID, groups with orderAmount > 0 only nextOrderID uint64 config *Config executing true while ExecuteGroup is inside its pool swap ordersByGroup GroupOrderKey -> orderID, active orders only pendingExecutionFees tokenPath -> int64, fees not yet sent to protocol_fee executionLogs ExecutionLogKey -> lastRound uint64, unreleased logs of active orders orderAmountsByGroup GroupOrderAmountKey -> endRound, orders by executionFeeRate, then amountPerExecution tokenMinAmountsPerExecution tokenPath -> int64, per-token minimum input per execution pairPriceLimits PairKey -> *PairPriceLimit, minimum pool output per input of a pair direction

Value

<gnolang.StringValue>

StoreKeyConfig

dca.StoreKey

Store layout. Tree keys are built by the pdca key helpers. orders OrderKey -> *Order ordersByOwner OwnerOrderKey -> orderID groups groupID -> *Group scheduledGroups ScheduleKey -> groupID, groups with orderAmount > 0 only nextOrderID uint64 config *Config executing true while ExecuteGroup is inside its pool swap ordersByGroup GroupOrderKey -> orderID, active orders only pendingExecutionFees tokenPath -> int64, fees not yet sent to protocol_fee executionLogs ExecutionLogKey -> lastRound uint64, unreleased logs of active orders orderAmountsByGroup GroupOrderAmountKey -> endRound, orders by executionFeeRate, then amountPerExecution tokenMinAmountsPerExecution tokenPath -> int64, per-token minimum input per execution pairPriceLimits PairKey -> *PairPriceLimit, minimum pool output per input of a pair direction

Value

<gnolang.StringValue>

StoreKeyExecuting

dca.StoreKey

Store layout. Tree keys are built by the pdca key helpers. orders OrderKey -> *Order ordersByOwner OwnerOrderKey -> orderID groups groupID -> *Group scheduledGroups ScheduleKey -> groupID, groups with orderAmount > 0 only nextOrderID uint64 config *Config executing true while ExecuteGroup is inside its pool swap ordersByGroup GroupOrderKey -> orderID, active orders only pendingExecutionFees tokenPath -> int64, fees not yet sent to protocol_fee executionLogs ExecutionLogKey -> lastRound uint64, unreleased logs of active orders orderAmountsByGroup GroupOrderAmountKey -> endRound, orders by executionFeeRate, then amountPerExecution tokenMinAmountsPerExecution tokenPath -> int64, per-token minimum input per execution pairPriceLimits PairKey -> *PairPriceLimit, minimum pool output per input of a pair direction

Value

<gnolang.StringValue>

StoreKeyOrdersByGroup

dca.StoreKey

Store layout. Tree keys are built by the pdca key helpers. orders OrderKey -> *Order ordersByOwner OwnerOrderKey -> orderID groups groupID -> *Group scheduledGroups ScheduleKey -> groupID, groups with orderAmount > 0 only nextOrderID uint64 config *Config executing true while ExecuteGroup is inside its pool swap ordersByGroup GroupOrderKey -> orderID, active orders only pendingExecutionFees tokenPath -> int64, fees not yet sent to protocol_fee executionLogs ExecutionLogKey -> lastRound uint64, unreleased logs of active orders orderAmountsByGroup GroupOrderAmountKey -> endRound, orders by executionFeeRate, then amountPerExecution tokenMinAmountsPerExecution tokenPath -> int64, per-token minimum input per execution pairPriceLimits PairKey -> *PairPriceLimit, minimum pool output per input of a pair direction

Value

<gnolang.StringValue>

StoreKeyPendingExecutionFees

dca.StoreKey

Store layout. Tree keys are built by the pdca key helpers. orders OrderKey -> *Order ordersByOwner OwnerOrderKey -> orderID groups groupID -> *Group scheduledGroups ScheduleKey -> groupID, groups with orderAmount > 0 only nextOrderID uint64 config *Config executing true while ExecuteGroup is inside its pool swap ordersByGroup GroupOrderKey -> orderID, active orders only pendingExecutionFees tokenPath -> int64, fees not yet sent to protocol_fee executionLogs ExecutionLogKey -> lastRound uint64, unreleased logs of active orders orderAmountsByGroup GroupOrderAmountKey -> endRound, orders by executionFeeRate, then amountPerExecution tokenMinAmountsPerExecution tokenPath -> int64, per-token minimum input per execution pairPriceLimits PairKey -> *PairPriceLimit, minimum pool output per input of a pair direction

Value

<gnolang.StringValue>

StoreKeyExecutionLogs

dca.StoreKey

Store layout. Tree keys are built by the pdca key helpers. orders OrderKey -> *Order ordersByOwner OwnerOrderKey -> orderID groups groupID -> *Group scheduledGroups ScheduleKey -> groupID, groups with orderAmount > 0 only nextOrderID uint64 config *Config executing true while ExecuteGroup is inside its pool swap ordersByGroup GroupOrderKey -> orderID, active orders only pendingExecutionFees tokenPath -> int64, fees not yet sent to protocol_fee executionLogs ExecutionLogKey -> lastRound uint64, unreleased logs of active orders orderAmountsByGroup GroupOrderAmountKey -> endRound, orders by executionFeeRate, then amountPerExecution tokenMinAmountsPerExecution tokenPath -> int64, per-token minimum input per execution pairPriceLimits PairKey -> *PairPriceLimit, minimum pool output per input of a pair direction

Value

<gnolang.StringValue>

StoreKeyOrderAmountsByGroup

dca.StoreKey

Store layout. Tree keys are built by the pdca key helpers. orders OrderKey -> *Order ordersByOwner OwnerOrderKey -> orderID groups groupID -> *Group scheduledGroups ScheduleKey -> groupID, groups with orderAmount > 0 only nextOrderID uint64 config *Config executing true while ExecuteGroup is inside its pool swap ordersByGroup GroupOrderKey -> orderID, active orders only pendingExecutionFees tokenPath -> int64, fees not yet sent to protocol_fee executionLogs ExecutionLogKey -> lastRound uint64, unreleased logs of active orders orderAmountsByGroup GroupOrderAmountKey -> endRound, orders by executionFeeRate, then amountPerExecution tokenMinAmountsPerExecution tokenPath -> int64, per-token minimum input per execution pairPriceLimits PairKey -> *PairPriceLimit, minimum pool output per input of a pair direction

Value

<gnolang.StringValue>

StoreKeyTokenMinAmountsPerExecution

dca.StoreKey

Store layout. Tree keys are built by the pdca key helpers. orders OrderKey -> *Order ordersByOwner OwnerOrderKey -> orderID groups groupID -> *Group scheduledGroups ScheduleKey -> groupID, groups with orderAmount > 0 only nextOrderID uint64 config *Config executing true while ExecuteGroup is inside its pool swap ordersByGroup GroupOrderKey -> orderID, active orders only pendingExecutionFees tokenPath -> int64, fees not yet sent to protocol_fee executionLogs ExecutionLogKey -> lastRound uint64, unreleased logs of active orders orderAmountsByGroup GroupOrderAmountKey -> endRound, orders by executionFeeRate, then amountPerExecution tokenMinAmountsPerExecution tokenPath -> int64, per-token minimum input per execution pairPriceLimits PairKey -> *PairPriceLimit, minimum pool output per input of a pair direction

Value

<gnolang.StringValue>

StoreKeyPairPriceLimits

dca.StoreKey

Store layout. Tree keys are built by the pdca key helpers. orders OrderKey -> *Order ordersByOwner OwnerOrderKey -> orderID groups groupID -> *Group scheduledGroups ScheduleKey -> groupID, groups with orderAmount > 0 only nextOrderID uint64 config *Config executing true while ExecuteGroup is inside its pool swap ordersByGroup GroupOrderKey -> orderID, active orders only pendingExecutionFees tokenPath -> int64, fees not yet sent to protocol_fee executionLogs ExecutionLogKey -> lastRound uint64, unreleased logs of active orders orderAmountsByGroup GroupOrderAmountKey -> endRound, orders by executionFeeRate, then amountPerExecution tokenMinAmountsPerExecution tokenPath -> int64, per-token minimum input per execution pairPriceLimits PairKey -> *PairPriceLimit, minimum pool output per input of a pair direction

Value

<gnolang.StringValue>

dcaOrderStore

type

Value

dca.dcaOrderStore

NewDCAOrderStore

func(kvStore v1.KVStore) v0.IDCAOrderStore

NewDCAOrderStore wraps the domain KV store.

Open
OID
08e7a5…954e:73
NewDCAOrderStore details

Inspect func

NewSwapCallback

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

NewSwapCallback returns the callback of one round's pool.Swap. It pays the pool the round input, at most maxAmountIn of tokenIn, from the escrow. The callback is declared in this realm, so it transfers as the escrow itself: the escrow never grants an allowance for a swap. That makes the callback a payment capability, so it is guarded on creation and on use: - only the escrow's own current realm can create one, so only code the proxy hands its realm to (the active implementation) can; - only the pool can invoke it (cur.Previous()); the pool's swap lock admits no other swap while a round's swap runs; - it pays only while a round is executing, once, and only an exact-input delta of the sold token: positive input, no positive output, at most maxAmountIn. zeroForOne is the swap direction: it selects which pool delta is tokenIn.

Open
OID
08e7a5…954e:74
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 here, instead of panicking later when the version is activated.

Open
OID
08e7a5…954e:76
RegisterInitializer details

Inspect func

UpgradeImpl

func(packagePath string)

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

Open
OID
08e7a5…954e:78
UpgradeImpl details

Inspect func

GetImplementationPackagePath

func() string

GetImplementationPackagePath returns the active implementation path.

Open
OID
08e7a5…954e:79
GetImplementationPackagePath details

Inspect func
ErrSpoofedRealm : untyped string ="spoofed realm"
ErrNilInitializer : untyped string ="nil initializer"
ErrUpgradeWhileExecuting : untyped string ="cannot upgrade while a group execution is in progress"
ErrInvalidSwapCallback : untyped string ="invalid swap callback"
errImplNotInitialized : untyped string ="implementation is not initialized"
errInvalidImpl : untyped string ="impl is not an IDCAOrder"
errInvalidDomainStore : untyped string ="domainStore is not an IDCAOrderStore"
errNilConfig : untyped string ="config is nil"
errNilValue : untyped string ="%s is nil"
errInvalidConfigType : untyped string ="failed to cast config: %T"
makeErrorWithDetails : func(message string, details string) .uverse.error Inspect
GetConfig : func() *v0.Config Inspect
GetExecutionFeeRate : func() int64 Inspect
GetMaxPoolPriceDeviationRate : func() int64 Inspect
GetMaxPairPriceLimitAge : func() int64 Inspect
GetMaxExecutionCount : func() int64 Inspect
GetAllowedIntervals : func() []int64 Inspect
IsAllowedInterval : func(interval int64) bool Inspect
GetSlotStep : func(interval int64) int64 Inspect
GetMinExecutionGapRate : func() int64 Inspect
GetMaxClaimBatchSize : func() int64 Inspect
GetNextOrderID : func() uint64 Inspect
ExistsOrder : func(orderID uint64) bool Inspect
GetOrder : func(orderID uint64) (*v0.Order, .uverse.error) Inspect
GetOrders : func() *v0.ReadOnlyTree Inspect
GetOrdersByOwner : func() *v0.ReadOnlyTree Inspect
GetOrderIDsByOwner : func(owner .uverse.address, startAfterID uint64, count int) []uint64 Inspect
GetClaimableAmount : func(orderID uint64) int64 Inspect
GetOrderExecutionLogs : func(orderID uint64, count int) ([]*v0.ExecutionLog, .uverse.error) Inspect
GetExecutionLogs : func() *v0.ReadOnlyTree Inspect
ExistsGroup : func(groupID string) bool Inspect
GetGroup : func(groupID string) (*v0.Group, .uverse.error) Inspect
GetGroups : func() *v0.ReadOnlyTree Inspect
GetGroupRoundMarks : func(groupID string) *v0.ReadOnlyTree Inspect
GetOrdersByGroup : func() *v0.ReadOnlyTree Inspect
GetOrderAmountsByGroup : func() *v0.ReadOnlyTree Inspect
GetOrderIDsByGroup : func(groupID string, startAfterID uint64, count int) []uint64 Inspect
GetScheduledGroups : func() *v0.ReadOnlyTree Inspect
GetExecutableGroups : func(cursor string, count int) ([]*v0.Group, .uverse.error) Inspect
GetExecutionQuote : func(groupID string) string Inspect
GetTokenMinAmountPerExecution : func(tokenPath string) int64 Inspect
GetMinAmountPerExecution : func(tokenPath string) int64 Inspect
GetTokenMinAmountsPerExecution : func() *v0.ReadOnlyTree Inspect
GetPairPriceLimit : func(inputToken string, outputToken string) (string, int64) Inspect
GetPairPriceLimits : func() *v0.ReadOnlyTree Inspect
GetPendingExecutionFeeAmount : func(tokenPath string) int64 Inspect
GetPendingExecutionFees : func() *v0.ReadOnlyTree Inspect
CreateOrder : func(inputToken string, outputToken string, interval int64, slotOffset int64, amountPerExecution int64, executionCount int64) uint64 Inspect
CancelOrder : func(orderID uint64) (int64, int64) Inspect
Claim : func(orderID uint64) int64 Inspect
ExecuteGroup : func(groupID string, expectedAmountIn int64, amountOutMin int64, minOrderAmountOut int64) (int64, int64) Inspect
ClaimGroupOrders : func(groupID string, startAfterOrderID uint64, maxOrderCount int) (int, uint64) Inspect
ForceCancelOrder : func(orderID uint64) (int64, int64) Inspect
CollectPendingExecutionFee : func(tokenPath string) (int64, int64) Inspect
SetExecutionFeeRate : func(executionFeeRate int64) Inspect
SetOrderLimits : func(minAmountPerExecution int64, maxExecutionCount int64) Inspect
AddAllowedInterval : func(interval int64) Inspect
RemoveAllowedInterval : func(interval int64) Inspect
SetMinExecutionGapRate : func(minExecutionGapRate int64) Inspect
SetMaxClaimBatchSize : func(maxClaimBatchSize int64) Inspect
SetMaxPoolPriceDeviationRate : func(maxPoolPriceDeviationRate int64) Inspect
SetMaxPairPriceLimitAge : func(maxPairPriceLimitAge int64) Inspect
SetSlotStep : func(interval int64, slotStep int64) Inspect
SetTokenMinAmountPerExecution : func(tokenPath string, minAmountPerExecution int64) Inspect
SetPairPriceLimit : func(inputToken string, outputToken string, minOutputPerInputX128 string) Inspect
currentAddress : .uverse.address =<gnolang.StringValue>
kvStore : *v1.kvStore Inspect
versionManager : *v1.versionManager Inspect
implementation : *v0.dcaOrderImpl Inspect
init.69 : func() Inspect
initializeDomainStore : func(int, rlm .uverse.realm, kvStore v1.KVStore) interface{...} Inspect
Address : func() .uverse.address Inspect
getImplementation : func() v0.IDCAOrder Inspect
updateImplementation : func() .uverse.error Inspect
NewBPTreeN : func(fanout int) *v0.BPTree Inspect
StoreKey : type =dca.StoreKey
StoreKeyOrders : dca.StoreKey =<gnolang.StringValue>
StoreKeyOrdersByOwner : dca.StoreKey =<gnolang.StringValue>
StoreKeyGroups : dca.StoreKey =<gnolang.StringValue>
StoreKeyScheduledGroups : dca.StoreKey =<gnolang.StringValue>
StoreKeyNextOrderID : dca.StoreKey =<gnolang.StringValue>
StoreKeyConfig : dca.StoreKey =<gnolang.StringValue>
StoreKeyExecuting : dca.StoreKey =<gnolang.StringValue>
StoreKeyOrdersByGroup : dca.StoreKey =<gnolang.StringValue>
StoreKeyPendingExecutionFees : dca.StoreKey =<gnolang.StringValue>
StoreKeyExecutionLogs : dca.StoreKey =<gnolang.StringValue>
StoreKeyOrderAmountsByGroup : dca.StoreKey =<gnolang.StringValue>
StoreKeyTokenMinAmountsPerExecution : dca.StoreKey =<gnolang.StringValue>
StoreKeyPairPriceLimits : dca.StoreKey =<gnolang.StringValue>
dcaOrderStore : type =dca.dcaOrderStore
NewDCAOrderStore : func(kvStore v1.KVStore) v0.IDCAOrderStore 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