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

v0 state

Back to all declarations

assertIsNotHalted

func(operations []string)

assertIsNotHalted rejects the call while any of operations is halted for DCA orders in gno.land/r/gnoswap/order/halt.

Open
OID
0782ac…7c8d:3
assertIsNotHalted details

Inspect func

haltedOperation

func(operations []string) (string, bool)

haltedOperation returns the first of operations halted for DCA orders.

Open
OID
0782ac…7c8d:5
haltedOperation details

Inspect func

assertIsAuthorizedKeeper

func(target string, caller .uverse.address)

assertIsAuthorizedKeeper rejects callers that gno.land/r/gnoswap/order/keeper does not allow to run rounds on target, the DCA proxy package path. ExecuteGroup is assigned to DCAKeeperRole at deployment; admin or governance grants it to keepers or reassigns the selector.

Open
OID
0782ac…7c8d:6
assertIsAuthorizedKeeper details

Inspect func

isAdminOrGovernance

func(caller .uverse.address) bool

isAdminOrGovernance reports whether caller is the GnoSwap admin or governance.

Open
OID
0782ac…7c8d:7
isAdminOrGovernance details

Inspect func

assertIsValidPair

func(inputToken string, outputToken string)

assertIsValidPair checks that inputToken and outputToken differ and that at least one whitelisted direct pool connects them.

Open
OID
0782ac…7c8d:8
assertIsValidPair details

Inspect func

assertHasPairPriceLimit

func(pairPriceLimits *v0.BPTree, inputToken string, outputToken string)

assertHasPairPriceLimit checks that the pair direction has a price limit, without which its rounds cannot trade.

Open
OID
0782ac…7c8d:9
assertHasPairPriceLimit details

Inspect func

assertIsAllowedInterval

func(config *v0.Config, interval int64)

assertIsAllowedInterval checks that new orders may use interval.

Open
OID
0782ac…7c8d:10
assertIsAllowedInterval details

Inspect func

assertIsAllowedSlot

func(config *v0.Config, interval int64, slotOffset int64)

assertIsAllowedSlot checks that new orders may use slotOffset at interval.

Open
OID
0782ac…7c8d:11
assertIsAllowedSlot details

Inspect func

assertIsValidOrderSize

func(config *v0.Config, minAmountPerExecution int64, amountPerExecution int64, executionCount int64)

assertIsValidOrderSize checks the order against the configured limits; minAmountPerExecution is the effective minimum of the input token (see minAmountPerExecution).

Open
OID
0782ac…7c8d:12
assertIsValidOrderSize details

Inspect func

assertIsOrderOwner

func(order *v0.Order, caller .uverse.address)

assertIsOrderOwner checks that caller owns the order.

Open
OID
0782ac…7c8d:13
assertIsOrderOwner details

Inspect func

assertIsQuotedAmountIn

func(group *v0.Group, expectedAmountIn int64, amountOutMin int64)

assertIsQuotedAmountIn checks that the round sells the input amountOutMin was quoted for. A floor quoted for a larger input would keep that trade's price impact, which is looser than the smaller round needs, so a changed orderAmount needs a new quote instead of a rescaled floor. Passing 0 for both skips the check.

Open
OID
0782ac…7c8d:14
assertIsQuotedAmountIn details

Inspect func

groupOrdersClaimResult

type

groupOrdersClaimResult describes one page of claimGroupOrders.

Value

v0.groupOrdersClaimResult

dcaBPTreeFanOut

int

Value

16

maxExecutionCountLimit

int64

Value

10000

minAllowedInterval

int64

Value

60

maxAllowedInterval

int64

Value

31536000

maxClaimBatchSizeLimit

int64

Value

500

minOrderAmountOutFloor

int64

Value

1

defaultMinAmountPerExecution

int64

Value

1

defaultMaxExecutionCount

int64

Value

1000

defaultMaxClaimBatchSize

int64

Value

50

defaultExecutionFeeRate

int64

// basis points

Value

15

defaultMinExecutionGapRate

int64

Value

5000

defaultMaxPoolPriceDeviationRate

int64

Value

2000

defaultMaxPairPriceLimitAge

int64

Value

3600

minMaxPairPriceLimitAge

int64

Value

60

maxMaxPairPriceLimitAge

int64

Value

604800

intervalMinute

int64

Intervals new orders may use after deployment, in seconds. A month is a fixed 30 days, so every round in a group has the same length.

Value

60

intervalHour

int64

Intervals new orders may use after deployment, in seconds. A month is a fixed 30 days, so every round in a group has the same length.

Value

3600

intervalDay

int64

Intervals new orders may use after deployment, in seconds. A month is a fixed 30 days, so every round in a group has the same length.

Value

86400

intervalWeek

int64

Intervals new orders may use after deployment, in seconds. A month is a fixed 30 days, so every round in a group has the same length.

Value

604800

intervalMonth

int64

Intervals new orders may use after deployment, in seconds. A month is a fixed 30 days, so every round in a group has the same length.

Value

2592000

defaultAllowedIntervals

func() []int64

defaultAllowedIntervals returns the initial allowed intervals, ascending.

Open
OID
0782ac…7c8d:15
defaultAllowedIntervals details

Inspect func

defaultSlotSteps

func() map[int64]int64

defaultSlotSteps returns the initial slot step of the intervals split into several slots: daily orders pick an hour, weekly and 30-day orders a day. A 30-day slot is a day of the 30-day cycle counted from the unix epoch, not a calendar date. Minute and hourly orders keep a single slot, offset 0: finer slots would split liquidity for little gain. Each slot is its own group, so the steps bound the groups per pair.

Open
OID
0782ac…7c8d:17
defaultSlotSteps details

Inspect func

emitGroupCreated

func(prevAddr .uverse.address, prevRealm string, group *v0.Group)
Open
OID
0782ac…7c8d:18
emitGroupCreated details

Inspect func

emitOrderCreated

func(prevAddr .uverse.address, prevRealm string, order *v0.Order, group *v0.Group, depositAmount int64, referenceAmountOut int64)

emitOrderCreated reports a new order. executionFeeRate is the rate the order snapshotted. referenceAmountOut is the output of selling the whole deposit at once when the order was placed, net of the order's execution fee (see quoteReferenceAmountOut), 0 when no pool could absorb it.

Open
OID
0782ac…7c8d:20
emitOrderCreated details

Inspect func

emitGroupExecuted

func(prevAddr .uverse.address, prevRealm string, group *v0.Group, result v0.groupRoundResult)

emitGroupExecuted reports a round. executedAmountOut, the output credited to the orders, equals swapAmountOut: orders pay their execution fees when paid out.

Open
OID
0782ac…7c8d:21
emitGroupExecuted details

Inspect func

emitGroupOrdersClaimed

func(prevAddr .uverse.address, prevRealm string, groupID string, examinedOrderCount int, claimedOrderCount int, releasedExecutionLogCount int64, nextCursor uint64)
Open
OID
0782ac…7c8d:22
emitGroupOrdersClaimed details

Inspect func

emitOrderClaimed

func(prevAddr .uverse.address, prevRealm string, order *v0.Order, group *v0.Group, payout v0.orderPayout, status v0.OrderStatus)

emitOrderClaimed reports a payout. grossAmount is the accrued output paid out, executionFeeAmount the order's fee on it, and claimedAmount the rest, sent to the owner; the totals are the order's lifetime values.

Open
OID
0782ac…7c8d:23
emitOrderClaimed details

Inspect func

emitOrderCancelled

func(prevAddr .uverse.address, prevRealm string, order *v0.Order, group *v0.Group, payout v0.orderPayout, refundedAmount int64)
Open
OID
0782ac…7c8d:24
emitOrderCancelled details

Inspect func

emitPayoutExecutionFee

func(prevAddr .uverse.address, prevRealm string, group *v0.Group, executionFeeAmount int64, pendingAmount int64)

emitPayoutExecutionFee reports the execution fee a payout of the group's orders charged and kept as pending, if any.

Open
OID
0782ac…7c8d:25
emitPayoutExecutionFee details

Inspect func

emitExecutionFeeCollected

func(prevAddr .uverse.address, prevRealm string, groupID string, tokenPath string, round uint64, executionFeeAmount int64, forwardedAmount int64, pendingAmount int64)

emitExecutionFeeCollected reports execution fees of tokenPath. executionFeeAmount is the fee payouts charged (0 for a round or CollectPendingExecutionFee), forwardedAmount what was sent to the protocol fee realm, and pendingAmount what this realm still holds. groupId is empty and round 0 for CollectPendingExecutionFee.

Open
OID
0782ac…7c8d:26
emitExecutionFeeCollected details

Inspect func

emitExecutionFeeRateChanged

func(prevAddr .uverse.address, prevRealm string, previousExecutionFeeRate int64, executionFeeRate int64)
Open
OID
0782ac…7c8d:27
emitExecutionFeeRateChanged details

Inspect func

emitSlotStepChanged

func(prevAddr .uverse.address, prevRealm string, interval int64, previousSlotStep int64, slotStep int64)
Open
OID
0782ac…7c8d:28
emitSlotStepChanged details

Inspect func

emitExecutionLogsReleased

func(prevAddr .uverse.address, prevRealm string, order *v0.Order, group *v0.Group, releasedExecutionLogCount int64)
Open
OID
0782ac…7c8d:29
emitExecutionLogsReleased details

Inspect func

emitConfigUpdated

func(prevAddr .uverse.address, prevRealm string, key string, previousValue int64, value int64)
Open
OID
0782ac…7c8d:30
emitConfigUpdated details

Inspect func

emitAllowedIntervalUpdated

func(prevAddr .uverse.address, prevRealm string, interval int64, allowed bool)
Open
OID
0782ac…7c8d:31
emitAllowedIntervalUpdated details

Inspect func

emitOrderForceCancelled

func(prevAddr .uverse.address, prevRealm string, order *v0.Order, group *v0.Group, payout v0.orderPayout, refundedAmount int64, reason string)

emitOrderForceCancelled reports an order closed by a keeper with ForceCancelOrder. It carries the fields of DCAOrderCancelled and the reason the order blocked its group (see ForceCancelOrder); the order's status is cancelled, and its output and refund went to the owner.

Open
OID
0782ac…7c8d:32
emitOrderForceCancelled details

Inspect func

emitTokenMinAmountPerExecutionUpdated

func(prevAddr .uverse.address, prevRealm string, tokenPath string, previousMinAmountPerExecution int64, minAmountPerExecution int64)
Open
OID
0782ac…7c8d:33
emitTokenMinAmountPerExecutionUpdated details

Inspect func

emitPairPriceLimitUpdated

func(prevAddr .uverse.address, prevRealm string, inputToken string, outputToken string, previousMinOutputPerInputX128 string, minOutputPerInputX128 string, updatedAt int64)

emitPairPriceLimitUpdated reports a pair price limit change; minOutputPerInputX128 "0" and updatedAt 0 mean the limit was removed.

Open
OID
0782ac…7c8d:34
emitPairPriceLimitUpdated details

Inspect func

errInvalidPool

untyped string

Value

"[GNOSWAP-ORDER-DCA-001] invalid pool"

errInvalidToken

untyped string

Value

"[GNOSWAP-ORDER-DCA-002] invalid token"

errInvalidInterval

untyped string

Value

"[GNOSWAP-ORDER-DCA-003] invalid interval"

errInvalidAmount

untyped string

Value

"[GNOSWAP-ORDER-DCA-004] invalid amount"

errInvalidExecutionCount

untyped string

Value

"[GNOSWAP-ORDER-DCA-005] invalid number of executions"

errOrderNotFound

untyped string

Value

"[GNOSWAP-ORDER-DCA-006] order not found"

errNotOrderOwner

untyped string

Value

"[GNOSWAP-ORDER-DCA-007] caller is not the order owner"

errGroupNotFound

untyped string

Value

"[GNOSWAP-ORDER-DCA-008] group not found"

errGroupNotExecutable

untyped string

Value

"[GNOSWAP-ORDER-DCA-009] group is not executable"

errSwapMismatch

untyped string

Value

"[GNOSWAP-ORDER-DCA-010] swap result mismatch"

errInvalidConfig

untyped string

Value

"[GNOSWAP-ORDER-DCA-011] invalid config"

errInvalidState

untyped string

Value

"[GNOSWAP-ORDER-DCA-012] invalid accounting state"

errOverflow

untyped string

Value

"[GNOSWAP-ORDER-DCA-013] overflow"

errReentrant

untyped string

Value

"[GNOSWAP-ORDER-DCA-014] reentrant call during group execution"

errInvalidCursor

untyped string

Value

"[GNOSWAP-ORDER-DCA-015] invalid cursor"

errNotKeeper

untyped string

Value

"[GNOSWAP-ORDER-DCA-016] caller is not an authorized keeper"

errNoEligiblePool

untyped string

Value

"[GNOSWAP-ORDER-DCA-017] no eligible pool"

errInvalidExecutionFeeRate

untyped string

Value

"[GNOSWAP-ORDER-DCA-018] invalid execution fee rate"

errInvalidSlotOffset

untyped string

Value

"[GNOSWAP-ORDER-DCA-019] invalid slot offset"

errInvalidSlotStep

untyped string

Value

"[GNOSWAP-ORDER-DCA-020] invalid slot step"

errHalted

untyped string

Value

"[GNOSWAP-ORDER-DCA-021] operation halted"

errAmountInMismatch

untyped string

Value

"[GNOSWAP-ORDER-DCA-022] round input does not match the quote"

errInsufficientOrderOutput

untyped string

Value

"[GNOSWAP-ORDER-DCA-024] insufficient output per order"

errInsufficientSwapOutput

untyped string

Value

"[GNOSWAP-ORDER-DCA-025] swap output below amountOutMin"

errInvalidPriceLimit

untyped string

Value

"[GNOSWAP-ORDER-DCA-026] invalid price limit"

errMissingPriceLimit

untyped string

Value

"[GNOSWAP-ORDER-DCA-027] missing price limit"

errOrderNotBlocking

untyped string

Value

"[GNOSWAP-ORDER-DCA-028] order does not block its group"

makeErrorWithDetails

func(message string, details string) .uverse.error
Open
OID
0782ac…7c8d:35
makeErrorWithDetails details

Inspect func

groupRoundResult

type

groupRoundResult describes one executed round.

Value

v0.groupRoundResult

getPendingExecutionFeeAmount

func(pendingExecutionFees *v0.BPTree, tokenPath string) int64

getPendingExecutionFeeAmount returns the execution fee of tokenPath held by this realm, 0 if none.

Open
OID
0782ac…7c8d:37
getPendingExecutionFeeAmount details

Inspect func

calculateClaimableAmount

func(order *v0.Order, group *v0.Group) (int64, .uverse.error)

calculateClaimableAmount returns what the next Claim pays the owner, net of the order's execution fee.

Open
OID
0782ac…7c8d:39
calculateClaimableAmount details

Inspect func

isGroupExecutable

func(group *v0.Group, currentTimestamp int64) bool

isGroupExecutable reports whether the schedule and the halts allow the group's next round now. Pools are not quoted here.

Open
OID
0782ac…7c8d:41
isGroupExecutable details

Inspect func

isExecutionHalted

func() bool

isExecutionHalted reports whether execute or withdraw is halted, matching the checks ExecuteGroup makes before running a round.

Open
OID
0782ac…7c8d:42
isExecutionHalted details

Inspect func

marshal

func(fields map[string]*v0.Node) string
Open
OID
0782ac…7c8d:43
marshal details

Inspect func

cloneOrderEntry

func(value interface{...}) interface{...}
Open
OID
0782ac…7c8d:45
cloneOrderEntry details

Inspect func

cloneGroupEntry

func(value interface{...}) interface{...}
Open
OID
0782ac…7c8d:46
cloneGroupEntry details

Inspect func

clonePairPriceLimitEntry

func(value interface{...}) interface{...}
Open
OID
0782ac…7c8d:47
clonePairPriceLimitEntry details

Inspect func

registerDCAOrderImpl

func()
Open
OID
0782ac…7c8d:50
registerDCAOrderImpl details

Inspect func

initStoreData

func(int, rlm .uverse.realm, s v0.IDCAOrderStore) .uverse.error
Open
OID
0782ac…7c8d:51
initStoreData details

Inspect func

dcaOrderImpl

type

Value

v0.dcaOrderImpl

NewDCAOrderImpl

func(dcaStore v0.IDCAOrderStore) v0.IDCAOrder

NewDCAOrderImpl creates the implementation over the shared store.

Open
OID
0782ac…7c8d:52
NewDCAOrderImpl details

Inspect func

getTokenMinAmountPerExecution

func(s v0.IDCAOrderStore, tokenPath string) int64

getTokenMinAmountPerExecution returns the minimum input per execution set for tokenPath, or 0 if none is set.

Open
OID
0782ac…7c8d:54
getTokenMinAmountPerExecution details

Inspect func

forceCancelBelowMinAmount

untyped string

Reasons ForceCancelOrder accepts, reported by DCAOrderForceCancelled.

Value

"below_min_amount"

forceCancelNoOrderOutput

untyped string

Reasons ForceCancelOrder accepts, reported by DCAOrderForceCancelled.

Value

"no_order_output"

forceCancelExceedsPoolCapacity

untyped string

Reasons ForceCancelOrder accepts, reported by DCAOrderForceCancelled.

Value

"exceeds_pool_capacity"

hasPartialFill

func(candidates []*v0.poolCandidate) bool

hasPartialFill reports whether a candidate pool fills only part of the round within the price limit, with some output, so that a smaller round may fill. A pool that swaps nothing, such as one without liquidity, also reports codePartialFill but cannot fill any smaller round.

Open
OID
0782ac…7c8d:56
hasPartialFill details

Inspect func

orderCancelResult

type

orderCancelResult describes a closed order.

Value

v0.orderCancelResult

poolCandidate

type

poolCandidate is one pool of the pair and its evaluation for a round.

Value

v0.poolCandidate

poolWhitelist

type

poolWhitelist is the read-only membership contract used by pool selection. Production passes the common whitelist realm's read-only view; focused selection tests use an in-memory tree.

Value

v0.poolWhitelist

getCandidatePools

func(whitelistedPools v0.poolWhitelist, inputToken string, outputToken string) []*v0.poolCandidate

getCandidatePools returns the whitelisted pools of the pair, ordered by fee tier.

Open
OID
0782ac…7c8d:58
getCandidatePools details

Inspect func

selectPool

func(whitelistedPools v0.poolWhitelist, limit *v0.PairPriceLimit, maxDeviationRate int64, maxLimitAge int64, inputToken string, outputToken string, amountIn int64, quoteAll bool) (*v0.poolCandidate, []*v0.poolCandidate)

selectPool evaluates the pair's whitelisted pools for a round of amountIn under limit, the pair price limit (nil if none is set), and maxDeviationRate (Config.MaxPoolPriceDeviationRate), and maxLimitAge (Config.MaxPairPriceLimitAge), and returns the chosen pool (nil if none can fill it) with all candidates. quoteAll quotes every pool, even when the pair has only one.

Open
OID
0782ac…7c8d:60
selectPool details

Inspect func

quoteReferenceAmountOut

func(whitelistedPools v0.poolWhitelist, limit *v0.PairPriceLimit, maxDeviationRate int64, maxLimitAge int64, inputToken string, outputToken string, amountIn int64) int64

quoteReferenceAmountOut quotes selling amountIn at once, now, on the pair's best whitelisted pool within the pair price limit: what a one-off swap of the whole order would return. Order fills are measured against it. It is 0 when no pool can absorb the whole amount within the limit.

Open
OID
0782ac…7c8d:61
quoteReferenceAmountOut details

Inspect func

selectRoundPool

func(whitelistedPools v0.poolWhitelist, limit *v0.PairPriceLimit, maxDeviationRate int64, maxLimitAge int64, group *v0.Group, amountIn int64) (*v0.poolCandidate, .uverse.error)

selectRoundPool is selectPool for execution. When no pool can fill the round, it returns an error listing each candidate's reason. A pair without a whitelisted pool has no candidates.

Open
OID
0782ac…7c8d:62
selectRoundPool details

Inspect func

quoteExactIn

func(inputToken string, outputToken string, fee uint32, sqrtPriceLimitX96 string, amountIn int64) (int64, string, .uverse.error)

quoteExactIn simulates selling amountIn on the pair's pool of fee tier fee, down to sqrtPriceLimitX96, and returns the pool output. It fails unless the whole input is consumed within the limit, and then also returns the ineligibility code of the failure. A partial fill (codePartialFill) returns the output of the input it consumed, 0 when the pool swapped nothing, such as one without liquidity; every other failure returns 0.

Open
OID
0782ac…7c8d:63
quoteExactIn details

Inspect func

minSqrtRatioPlusOne

untyped string

Sqrt price bounds a swap price limit is clamped to; the pool requires a limit strictly inside (MIN\_SQRT\_RATIO, MAX\_SQRT\_RATIO).

Value

"4295128740"

maxSqrtRatioMinusOne

untyped string

Sqrt price bounds a swap price limit is clamped to; the pool requires a limit strictly inside (MIN\_SQRT\_RATIO, MAX\_SQRT\_RATIO).

Value

"1461446703485210103287273052203988822378723970341"

poolFeeDenominator

uint64

poolFeeDenominator is the denominator of pool fee tiers (3000 is 0.3%).

Value

1000000

q96Shift

uint

Value

96

codeNoPriceLimit

untyped string

// the pair direction has no limit

Value

"no_price_limit"

codePriceLimitStale

untyped string

// the limit is older than its maximum age

Value

"price_limit_stale"

codePricePastLimit

untyped string

// the pool price is already past the limit

Value

"price_past_limit"

codePriceDisplaced

untyped string

// the pool price is too far on the favorable side

Value

"price_displaced"

codePriceUnavailable

untyped string

// the pool price could not be read

Value

"price_unavailable"

codePartialFill

untyped string

// the quote fills only part of the input

Value

"partial_fill"

codeNoOutput

untyped string

// the quote returns no output

Value

"no_output"

codeQuoteFailed

untyped string

// the pool rejected the quote

Value

"quote_failed"

reasonNoPriceLimit

untyped string

Value

"no price limit for the pair"

reasonPriceLimitStale

untyped string

Value

"pair price limit is older than its maximum age"

reasonInvalidLimitAge

untyped string

Value

"invalid max pair price limit age"

reasonPricePastLimit

untyped string

Value

"pool price is past the pair price limit"

reasonPriceDisplaced

untyped string

Value

"pool price deviates too far from the pair price limit"

reasonPoolPriceAbsent

untyped string

Value

"pool price unavailable"

reasonInvalidDeviation

untyped string

Value

"invalid max pool price deviation rate"

getPairPriceLimit

func(pairPriceLimits *v0.BPTree, inputToken string, outputToken string) *v0.PairPriceLimit

getPairPriceLimit returns the price limit of selling inputToken for outputToken, or nil if none is set.

Open
OID
0782ac…7c8d:64
getPairPriceLimit details

Inspect func

calculateSqrtPriceLimitX96

func(minOutputPerInputX128 *v1.Uint, fee uint32, zeroForOne bool) *v1.Uint

calculateSqrtPriceLimitX96 converts minOutputPerInputX128 into the sqrt price limit of a swap on a pool of fee tier fee in the given direction, clamped to the range the pool accepts. The pool takes its fee from the input, so the marginal rate of a unit of input is P\*(1-fee) selling token0 (P = token1 per token0) and (1-fee)/P selling token1. Requiring that rate to stay at or above L gives: zeroForOne: P >= L/(1-fee), a lower bound, rounded up oneForZero: P <= (1-fee)/L, an upper bound, rounded down so the rounding never loosens the limit.

Open
OID
0782ac…7c8d:66
calculateSqrtPriceLimitX96 details

Inspect func

sqrtX128ToSqrtX96

func(priceX128 *v1.Uint, roundUp bool) *v1.Uint

sqrtX128ToSqrtX96 returns sqrt(priceX128 / 2^128) \* 2^96, that is sqrt(priceX128 \* 2^64), rounded up when roundUp is set. A priceX128 too large to shift by 64 bits is shifted by 64-2k bits and the root by k bits instead, which keeps the result within one part in 2^96.

Open
OID
0782ac…7c8d:67
sqrtX128ToSqrtX96 details

Inspect func

sqrtUint256

func(x *v1.Uint) *v1.Uint

sqrtUint256 returns floor(sqrt(x)) by Newton's method.

Open
OID
0782ac…7c8d:68
sqrtUint256 details

Inspect func

poolSqrtPriceLimit

func(poolPath string, fee uint32, zeroForOne bool, limit *v0.PairPriceLimit, maxDeviationRate int64, maxLimitAge int64) (string, string, string)

poolSqrtPriceLimit returns the sqrt price limit of selling on poolPath under limit, or why the pool cannot trade under it. maxDeviationRate, in basis points of price, bounds how far the pool's price may sit on the favorable side of the limit (see isDisplacedPool); 0 disables that check. maxLimitAge, in seconds, is how old the limit may be (see isStalePriceLimit). It returns the limit, or the ineligibility code and reason.

Open
OID
0782ac…7c8d:69
poolSqrtPriceLimit details

Inspect func

isStalePriceLimit

func(limit *v0.PairPriceLimit, maxLimitAge int64, currentTimestamp int64) (bool, .uverse.error)

isStalePriceLimit reports whether limit was set more than maxLimitAge seconds before currentTimestamp. A non-positive maxLimitAge is invalid: a stored config without the age fails closed instead of disabling the check.

Open
OID
0782ac…7c8d:70
isStalePriceLimit details

Inspect func

isDisplacedPool

func(currentSqrtPriceX96 *v1.Uint, sqrtPriceLimitX96 *v1.Uint, zeroForOne bool, maxDeviationRate int64) (bool, .uverse.error)

isDisplacedPool reports whether the pool price sits more than maxDeviationRate, in basis points of price, on the favorable side of the swap price limit; 0 disables the check. Prices are compared through their square roots: P\_current / P\_limit > 1 + rate \<=> sqrtCurrent > sqrtLimit \* sqrt(1 + rate) when selling token0, and the reciprocal when selling token1.

Open
OID
0782ac…7c8d:71
isDisplacedPool details

Inspect func

parseMinOutputPerInputX128

func(value string) (*v1.Uint, .uverse.error)

parseMinOutputPerInputX128 parses a decimal Q128 price limit.

Open
OID
0782ac…7c8d:72
parseMinOutputPerInputX128 details

Inspect func

swapDirection

func(inputToken string, outputToken string) (zeroForOne bool, token0 string, token1 string)

swapDirection returns the pool direction of selling inputToken for outputToken and the pool's token order.

Open
OID
0782ac…7c8d:73
swapDirection details

Inspect func

swapExactIn

func(int, rlm .uverse.realm, group *v0.Group, fee uint32, sqrtPriceLimitX96 string, amountIn int64, amountOutMin int64) (int64, .uverse.error)

swapExactIn sells amountIn on the pair's pool of fee tier fee, down to sqrtPriceLimitX96 (see calculateSqrtPriceLimitX96), and returns the output received by the escrow. A pool that reaches the limit before selling the whole input fails the round. The pool sends the output first, then calls the escrow's swap callback, which pays the input from the escrow without any allowance (see dca.NewSwapCallback). The pool result is checked against the escrow's balance changes: the whole input must be sold, and the output must reach amountOutMin (0 disables it).

Open
OID
0782ac…7c8d:75
swapExactIn details

Inspect func

calculatePayout

func(amountPerExecution int64, endAccumulatedX128 *v1.Uint, debtX128 *v1.Uint) (int64, .uverse.error)

calculatePayout wraps pdca.CalculatePayout, reporting a backwards accumulator as invalid state.

Open
OID
0782ac…7c8d:76
calculatePayout details

Inspect func

orderPayout

type

orderPayout is one payout of an order's accrued output.

Value

v0.orderPayout

calculateOrderPayout

func(order *v0.Order, endAccumulatedX128 *v1.Uint) (v0.orderPayout, .uverse.error)

calculateOrderPayout returns the payout of the output the order accrued up to endAccumulatedX128, with the order's execution fee deducted on its cumulative gross output (see pdca.CalculatePayoutExecutionFeeAmount).

Open
OID
0782ac…7c8d:78
calculateOrderPayout details

Inspect func

recordOrderPayout

func(order *v0.Order, payout v0.orderPayout)

recordOrderPayout adds a payout to the order's lifetime claimed amount and execution fee.

Open
OID
0782ac…7c8d:79
recordOrderPayout details

Inspect func

calculateDebtX128AfterPayout

func(amountPerExecution int64, debtX128 *v1.Uint, payoutAmount int64) (*v1.Uint, .uverse.error)

calculateDebtX128AfterPayout wraps pdca.CalculateDebtX128AfterPayout, reporting an invalid payout as invalid state.

Open
OID
0782ac…7c8d:80
calculateDebtX128AfterPayout details

Inspect func

getOrderEndAccumulatedOutputPerAmountX128

func(order *v0.Order, group *v0.Group) (*v1.Uint, bool, .uverse.error)

getOrderEndAccumulatedOutputPerAmountX128 returns the accumulator an order is paid against, and whether all of its rounds have executed.

Open
OID
0782ac…7c8d:81
getOrderEndAccumulatedOutputPerAmountX128 details

Inspect func

releaseRoundMark

func(group *v0.Group, round uint64) .uverse.error

releaseRoundMark drops one order reference from its end-round mark, removing the mark once no order references it.

Open
OID
0782ac…7c8d:82
releaseRoundMark details

Inspect func

feeRateMinAmount

type

feeRateMinAmount is the smallest amountPerExecution of the orders with one execution fee rate that sell in a round.

Value

v0.feeRateMinAmount

minAmountPerExecutionOf

func(minAmounts []v0.feeRateMinAmount) int64

minAmountPerExecutionOf returns the smallest amountPerExecution of minAmounts, or 0 when it is empty.

Open
OID
0782ac…7c8d:83
minAmountPerExecutionOf details

Inspect func

maxExecutionFeeRateOf

func(minAmounts []v0.feeRateMinAmount) int64

maxExecutionFeeRateOf returns the highest execution fee rate of minAmounts, or 0 when it is empty.

Open
OID
0782ac…7c8d:84
maxExecutionFeeRateOf details

Inspect func

calculateMinOrderAmountOut

func(minAmount v0.feeRateMinAmount, outputPerAmountX128 *v1.Uint) (int64, .uverse.error)

calculateMinOrderAmountOut returns the output, net of its own execution fee rate, the order of minAmount is credited at outputPerAmountX128.

Open
OID
0782ac…7c8d:85
calculateMinOrderAmountOut details

Inspect func

getScheduleKey

func(group *v0.Group) string
Open
OID
0782ac…7c8d:86
getScheduleKey details

Inspect func

validateOrderOutput

func(group *v0.Group, minAmounts []v0.feeRateMinAmount, minOrderAmountOut int64, outputPerAmountX128 *v1.Uint, executedAmountOut int64, orderAmount int64) .uverse.error

validateOrderOutput checks that the round credits the smallest order of each execution fee rate at least minOrderAmountOut of output net of that rate, computed as its payout is. Within one rate an order's net payout only grows with amountPerExecution, so every order of the round then receives at least that much net of its own fee.

Open
OID
0782ac…7c8d:87
validateOrderOutput details

Inspect func
assertIsNotHalted : func(operations []string) Inspect
haltedOperation : func(operations []string) (string, bool) Inspect
assertIsAuthorizedKeeper : func(target string, caller .uverse.address) Inspect
isAdminOrGovernance : func(caller .uverse.address) bool Inspect
assertIsValidPair : func(inputToken string, outputToken string) Inspect
assertHasPairPriceLimit : func(pairPriceLimits *v0.BPTree, inputToken string, outputToken string) Inspect
assertIsAllowedInterval : func(config *v0.Config, interval int64) Inspect
assertIsAllowedSlot : func(config *v0.Config, interval int64, slotOffset int64) Inspect
assertIsValidOrderSize : func(config *v0.Config, minAmountPerExecution int64, amountPerExecution int64, executionCount int64) Inspect
assertIsOrderOwner : func(order *v0.Order, caller .uverse.address) Inspect
assertIsQuotedAmountIn : func(group *v0.Group, expectedAmountIn int64, amountOutMin int64) Inspect
groupOrdersClaimResult : type =v0.groupOrdersClaimResult
dcaBPTreeFanOut : int =16
maxExecutionCountLimit : int64 =10000
minAllowedInterval : int64 =60
maxAllowedInterval : int64 =31536000
maxClaimBatchSizeLimit : int64 =500
minOrderAmountOutFloor : int64 =1
defaultMinAmountPerExecution : int64 =1
defaultMaxExecutionCount : int64 =1000
defaultMaxClaimBatchSize : int64 =50
defaultExecutionFeeRate : int64 =15
defaultMinExecutionGapRate : int64 =5000
defaultMaxPoolPriceDeviationRate : int64 =2000
defaultMaxPairPriceLimitAge : int64 =3600
minMaxPairPriceLimitAge : int64 =60
maxMaxPairPriceLimitAge : int64 =604800
intervalMinute : int64 =60
intervalHour : int64 =3600
intervalDay : int64 =86400
intervalWeek : int64 =604800
intervalMonth : int64 =2592000
defaultAllowedIntervals : func() []int64 Inspect
defaultSlotSteps : func() map[int64]int64 Inspect
emitGroupCreated : func(prevAddr .uverse.address, prevRealm string, group *v0.Group) Inspect
emitOrderCreated : func(prevAddr .uverse.address, prevRealm string, order *v0.Order, group *v0.Group, depositAmount int64, referenceAmountOut int64) Inspect
emitGroupExecuted : func(prevAddr .uverse.address, prevRealm string, group *v0.Group, result v0.groupRoundResult) Inspect
emitGroupOrdersClaimed : func(prevAddr .uverse.address, prevRealm string, groupID string, examinedOrderCount int, claimedOrderCount int, releasedExecutionLogCount int64, nextCursor uint64) Inspect
emitOrderClaimed : func(prevAddr .uverse.address, prevRealm string, order *v0.Order, group *v0.Group, payout v0.orderPayout, status v0.OrderStatus) Inspect
emitOrderCancelled : func(prevAddr .uverse.address, prevRealm string, order *v0.Order, group *v0.Group, payout v0.orderPayout, refundedAmount int64) Inspect
emitPayoutExecutionFee : func(prevAddr .uverse.address, prevRealm string, group *v0.Group, executionFeeAmount int64, pendingAmount int64) Inspect
emitExecutionFeeCollected : func(prevAddr .uverse.address, prevRealm string, groupID string, tokenPath string, round uint64, executionFeeAmount int64, forwardedAmount int64, pendingAmount int64) Inspect
emitExecutionFeeRateChanged : func(prevAddr .uverse.address, prevRealm string, previousExecutionFeeRate int64, executionFeeRate int64) Inspect
emitSlotStepChanged : func(prevAddr .uverse.address, prevRealm string, interval int64, previousSlotStep int64, slotStep int64) Inspect
emitExecutionLogsReleased : func(prevAddr .uverse.address, prevRealm string, order *v0.Order, group *v0.Group, releasedExecutionLogCount int64) Inspect
emitConfigUpdated : func(prevAddr .uverse.address, prevRealm string, key string, previousValue int64, value int64) Inspect
emitAllowedIntervalUpdated : func(prevAddr .uverse.address, prevRealm string, interval int64, allowed bool) Inspect
emitOrderForceCancelled : func(prevAddr .uverse.address, prevRealm string, order *v0.Order, group *v0.Group, payout v0.orderPayout, refundedAmount int64, reason string) Inspect
emitTokenMinAmountPerExecutionUpdated : func(prevAddr .uverse.address, prevRealm string, tokenPath string, previousMinAmountPerExecution int64, minAmountPerExecution int64) Inspect
emitPairPriceLimitUpdated : func(prevAddr .uverse.address, prevRealm string, inputToken string, outputToken string, previousMinOutputPerInputX128 string, minOutputPerInputX128 string, updatedAt int64) Inspect
errInvalidPool : untyped string ="[GNOSWAP-ORDER-DCA-001] invalid pool"
errInvalidToken : untyped string ="[GNOSWAP-ORDER-DCA-002] invalid token"
errInvalidInterval : untyped string ="[GNOSWAP-ORDER-DCA-003] invalid interval"
errInvalidAmount : untyped string ="[GNOSWAP-ORDER-DCA-004] invalid amount"
errInvalidExecutionCount : untyped string ="[GNOSWAP-ORDER-DCA-005] invalid number of executions"
errOrderNotFound : untyped string ="[GNOSWAP-ORDER-DCA-006] order not found"
errNotOrderOwner : untyped string ="[GNOSWAP-ORDER-DCA-007] caller is not the order owner"
errGroupNotFound : untyped string ="[GNOSWAP-ORDER-DCA-008] group not found"
errGroupNotExecutable : untyped string ="[GNOSWAP-ORDER-DCA-009] group is not executable"
errSwapMismatch : untyped string ="[GNOSWAP-ORDER-DCA-010] swap result mismatch"
errInvalidConfig : untyped string ="[GNOSWAP-ORDER-DCA-011] invalid config"
errInvalidState : untyped string ="[GNOSWAP-ORDER-DCA-012] invalid accounting state"
errOverflow : untyped string ="[GNOSWAP-ORDER-DCA-013] overflow"
errReentrant : untyped string ="[GNOSWAP-ORDER-DCA-014] reentrant call during group execution"
errInvalidCursor : untyped string ="[GNOSWAP-ORDER-DCA-015] invalid cursor"
errNotKeeper : untyped string ="[GNOSWAP-ORDER-DCA-016] caller is not an authorized keeper"
errNoEligiblePool : untyped string ="[GNOSWAP-ORDER-DCA-017] no eligible pool"
errInvalidExecutionFeeRate : untyped string ="[GNOSWAP-ORDER-DCA-018] invalid execution fee rate"
errInvalidSlotOffset : untyped string ="[GNOSWAP-ORDER-DCA-019] invalid slot offset"
errInvalidSlotStep : untyped string ="[GNOSWAP-ORDER-DCA-020] invalid slot step"
errHalted : untyped string ="[GNOSWAP-ORDER-DCA-021] operation halted"
errAmountInMismatch : untyped string ="[GNOSWAP-ORDER-DCA-022] round input does not match the quote"
errInsufficientOrderOutput : untyped string ="[GNOSWAP-ORDER-DCA-024] insufficient output per order"
errInsufficientSwapOutput : untyped string ="[GNOSWAP-ORDER-DCA-025] swap output below amountOutMin"
errInvalidPriceLimit : untyped string ="[GNOSWAP-ORDER-DCA-026] invalid price limit"
errMissingPriceLimit : untyped string ="[GNOSWAP-ORDER-DCA-027] missing price limit"
errOrderNotBlocking : untyped string ="[GNOSWAP-ORDER-DCA-028] order does not block its group"
makeErrorWithDetails : func(message string, details string) .uverse.error Inspect
groupRoundResult : type =v0.groupRoundResult
getPendingExecutionFeeAmount : func(pendingExecutionFees *v0.BPTree, tokenPath string) int64 Inspect
calculateClaimableAmount : func(order *v0.Order, group *v0.Group) (int64, .uverse.error) Inspect
isGroupExecutable : func(group *v0.Group, currentTimestamp int64) bool Inspect
isExecutionHalted : func() bool Inspect
marshal : func(fields map[string]*v0.Node) string Inspect
intNode : func(v int64) *v0.Node Inspect
cloneOrderEntry : func(value interface{...}) interface{...} Inspect
cloneGroupEntry : func(value interface{...}) interface{...} Inspect
clonePairPriceLimitEntry : func(value interface{...}) interface{...} Inspect
init.88 : func() Inspect
registerDCAOrderImpl : func() Inspect
initStoreData : func(int, rlm .uverse.realm, s v0.IDCAOrderStore) .uverse.error Inspect
dcaOrderImpl : type =v0.dcaOrderImpl
NewDCAOrderImpl : func(dcaStore v0.IDCAOrderStore) v0.IDCAOrder Inspect
getTokenMinAmountPerExecution : func(s v0.IDCAOrderStore, tokenPath string) int64 Inspect
forceCancelBelowMinAmount : untyped string ="below_min_amount"
forceCancelNoOrderOutput : untyped string ="no_order_output"
forceCancelExceedsPoolCapacity : untyped string ="exceeds_pool_capacity"
hasPartialFill : func(candidates []*v0.poolCandidate) bool Inspect
orderCancelResult : type =v0.orderCancelResult
poolCandidate : type =v0.poolCandidate
poolWhitelist : type =v0.poolWhitelist
getCandidatePools : func(whitelistedPools v0.poolWhitelist, inputToken string, outputToken string) []*v0.poolCandidate Inspect
selectPool : func(whitelistedPools v0.poolWhitelist, limit *v0.PairPriceLimit, maxDeviationRate int64, maxLimitAge int64, inputToken string, outputToken string, amountIn int64, quoteAll bool) (*v0.poolCandidate, []*v0.poolCandidate) Inspect
quoteReferenceAmountOut : func(whitelistedPools v0.poolWhitelist, limit *v0.PairPriceLimit, maxDeviationRate int64, maxLimitAge int64, inputToken string, outputToken string, amountIn int64) int64 Inspect
selectRoundPool : func(whitelistedPools v0.poolWhitelist, limit *v0.PairPriceLimit, maxDeviationRate int64, maxLimitAge int64, group *v0.Group, amountIn int64) (*v0.poolCandidate, .uverse.error) Inspect
quoteExactIn : func(inputToken string, outputToken string, fee uint32, sqrtPriceLimitX96 string, amountIn int64) (int64, string, .uverse.error) Inspect
minSqrtRatioPlusOne : untyped string ="4295128740"
maxSqrtRatioMinusOne : untyped string ="1461446703485210103287273052203988822378723970341"
poolFeeDenominator : uint64 =1000000
q96Shift : uint =96
codeNoPriceLimit : untyped string ="no_price_limit"
codePriceLimitStale : untyped string ="price_limit_stale"
codePricePastLimit : untyped string ="price_past_limit"
codePriceDisplaced : untyped string ="price_displaced"
codePriceUnavailable : untyped string ="price_unavailable"
codePartialFill : untyped string ="partial_fill"
codeNoOutput : untyped string ="no_output"
codeQuoteFailed : untyped string ="quote_failed"
reasonNoPriceLimit : untyped string ="no price limit for the pair"
reasonPriceLimitStale : untyped string ="pair price limit is older than its maximum age"
reasonInvalidLimitAge : untyped string ="invalid max pair price limit age"
reasonPricePastLimit : untyped string ="pool price is past the pair price limit"
reasonPriceDisplaced : untyped string ="pool price deviates too far from the pair price limit"
reasonPoolPriceAbsent : untyped string ="pool price unavailable"
reasonInvalidDeviation : untyped string ="invalid max pool price deviation rate"
getPairPriceLimit : func(pairPriceLimits *v0.BPTree, inputToken string, outputToken string) *v0.PairPriceLimit Inspect
calculateSqrtPriceLimitX96 : func(minOutputPerInputX128 *v1.Uint, fee uint32, zeroForOne bool) *v1.Uint Inspect
sqrtX128ToSqrtX96 : func(priceX128 *v1.Uint, roundUp bool) *v1.Uint Inspect
sqrtUint256 : func(x *v1.Uint) *v1.Uint Inspect
poolSqrtPriceLimit : func(poolPath string, fee uint32, zeroForOne bool, limit *v0.PairPriceLimit, maxDeviationRate int64, maxLimitAge int64) (string, string, string) Inspect
isStalePriceLimit : func(limit *v0.PairPriceLimit, maxLimitAge int64, currentTimestamp int64) (bool, .uverse.error) Inspect
isDisplacedPool : func(currentSqrtPriceX96 *v1.Uint, sqrtPriceLimitX96 *v1.Uint, zeroForOne bool, maxDeviationRate int64) (bool, .uverse.error) Inspect
parseMinOutputPerInputX128 : func(value string) (*v1.Uint, .uverse.error) Inspect
swapDirection : func(inputToken string, outputToken string) (zeroForOne bool, token0 string, token1 string) Inspect
swapExactIn : func(int, rlm .uverse.realm, group *v0.Group, fee uint32, sqrtPriceLimitX96 string, amountIn int64, amountOutMin int64) (int64, .uverse.error) Inspect
calculatePayout : func(amountPerExecution int64, endAccumulatedX128 *v1.Uint, debtX128 *v1.Uint) (int64, .uverse.error) Inspect
orderPayout : type =v0.orderPayout
calculateOrderPayout : func(order *v0.Order, endAccumulatedX128 *v1.Uint) (v0.orderPayout, .uverse.error) Inspect
recordOrderPayout : func(order *v0.Order, payout v0.orderPayout) Inspect
calculateDebtX128AfterPayout : func(amountPerExecution int64, debtX128 *v1.Uint, payoutAmount int64) (*v1.Uint, .uverse.error) Inspect
getOrderEndAccumulatedOutputPerAmountX128 : func(order *v0.Order, group *v0.Group) (*v1.Uint, bool, .uverse.error) Inspect
releaseRoundMark : func(group *v0.Group, round uint64) .uverse.error Inspect
feeRateMinAmount : type =v0.feeRateMinAmount
minAmountPerExecutionOf : func(minAmounts []v0.feeRateMinAmount) int64 Inspect
maxExecutionFeeRateOf : func(minAmounts []v0.feeRateMinAmount) int64 Inspect
calculateMinOrderAmountOut : func(minAmount v0.feeRateMinAmount, outputPerAmountX128 *v1.Uint) (int64, .uverse.error) Inspect
getScheduleKey : func(group *v0.Group) string Inspect
validateOrderOutput : func(group *v0.Group, minAmounts []v0.feeRateMinAmount, minOrderAmountOut int64, outputPerAmountX128 *v1.Uint, executedAmountOut int64, orderAmount int64) .uverse.error Inspect