errors.gno
2.56 Kb · 47 lines
1package pool
2
3import (
4 ufmt "gno.land/p/nt/ufmt/v0"
5)
6
7// Error definitions for pool operations
8const (
9 errUnsupportedFeeTier = "[GNOSWAP-POOL-001] unsupported fee tier"
10 errPoolAlreadyExists = "[GNOSWAP-POOL-002] pool already created"
11 errOutOfRange = "[GNOSWAP-POOL-003] out of range for numeric value"
12 errInvalidInput = "[GNOSWAP-POOL-004] invalid input data"
13 errDataNotFound = "[GNOSWAP-POOL-005] requested data not found"
14 errLiquidityCalculation = "[GNOSWAP-POOL-006] invalid liquidity calculated"
15 errZeroLiquidity = "[GNOSWAP-POOL-007] zero liquidity"
16 errDuplicateTokenInPool = "[GNOSWAP-POOL-008] same token used in single pool"
17 errTickLowerInvalid = "[GNOSWAP-POOL-009] tickLower is invalid"
18 errTickUpperInvalid = "[GNOSWAP-POOL-010] tickUpper is invalid"
19 errInvalidSwapAmount = "[GNOSWAP-POOL-011] invalid swap amount"
20 errInvalidProtocolFeePct = "[GNOSWAP-POOL-012] invalid protocol fee percentage"
21 errInvalidWithdrawalFeePct = "[GNOSWAP-POOL-013] invalid withdrawal fee percentage"
22 errLockedPool = "[GNOSWAP-POOL-014] cannot modify pool while locked"
23 errPriceOutOfRange = "[GNOSWAP-POOL-015] swap price out of range"
24 errTransferFailed = "[GNOSWAP-POOL-016] token transfer failed"
25 errInvalidTickAndTickSpacing = "[GNOSWAP-POOL-017] invalid tick and tick spacing requested"
26 errInvalidTickRange = "[GNOSWAP-POOL-018] tickLower is greater than or equal to tickUpper"
27 errUnderflow = "[GNOSWAP-POOL-019] underflow"
28 errOverflow = "[GNOSWAP-POOL-020] overflow"
29 errBalanceUpdateFailed = "[GNOSWAP-POOL-021] balance update failed"
30 errInvalidPayer = "[GNOSWAP-POOL-022] invalid payer"
31 errNotAccessEOA = "[GNOSWAP-POOL-023] not access EOA"
32 errInsufficientPayment = "[GNOSWAP-POOL-024] insufficient payment"
33 errNotInitializedObservation = "[GNOSWAP-POOL-025] not initialized observation"
34 errObservationTooOld = "[GNOSWAP-POOL-026] target timestamp before oldest observation"
35 errSpoofedRealm = "[GNOSWAP-POOL-027] rlm does not match the current crossing frame"
36)
37
38// newErrorWithDetail adds detail to an error message.
39func newErrorWithDetail(message string, detail string) string {
40 finalErr := ufmt.Errorf("%s || %s", message, detail)
41 return finalErr.Error()
42}
43
44// makeErrorWithDetails creates an error with additional context.
45func makeErrorWithDetails(message string, details string) error {
46 return ufmt.Errorf("%s || %s", message, details)
47}