Pool
typePool represents a liquidity pool for token A / token B
Value
dex.Pool
SwapResult
typeSwapResult represents the result of a swap
Value
dex.SwapResult
pool
*dex.Pool- OID
- 02a5d5…f752:17
pool details
feeBps
untyped bigintFee in basis points (0.3% = 30 bps)
Value
(30 <untyped> bigint)
init.4
func()- OID
- 02a5d5…f752:4
init.4 details
AddLiquidity
func(amountA int64, amountB int64) int64AddLiquidity adds token A and B to the pool, returns LP shares
- OID
- 02a5d5…f752:6
AddLiquidity details
RemoveLiquidity
func(shares int64) (int64, int64)RemoveLiquidity removes liquidity and returns token amounts
- OID
- 02a5d5…f752:7
RemoveLiquidity details
SwapAForB
func(amountIn int64) int64SwapAForB swaps token A for token B
- OID
- 02a5d5…f752:8
SwapAForB details
SwapBForA
func(amountIn int64) int64SwapBForA swaps token B for token A
- OID
- 02a5d5…f752:9
SwapBForA details
GetReserves
func() (int64, int64)GetReserves returns current pool reserves
- OID
- 02a5d5…f752:10
GetReserves details
GetPrice
func() stringGetPrice returns the price of A in terms of B
- OID
- 02a5d5…f752:11
GetPrice details
GetLPShares
func(addr string) int64GetLPShares returns LP shares for an address
- OID
- 02a5d5…f752:12
GetLPShares details
TotalLiquidity
func() int64TotalLiquidity returns total LP shares
- OID
- 02a5d5…f752:13
TotalLiquidity details
GetAmountOut
func(amountIn int64, isAForB bool) int64GetAmountOut calculates expected output for a given input (read-only)
- OID
- 02a5d5…f752:14
GetAmountOut details
Render
func(string) string- OID
- 02a5d5…f752:15
Render details
sqrtApprox
func(n int64) int64sqrtApprox returns an approximate square root using Newton's method
- OID
- 02a5d5…f752:16
sqrtApprox details
Pool
:
type
=dex.Pool
SwapResult
:
type
=dex.SwapResult
pool : *dex.Pool Inspect
feeBps
:
untyped bigint
=(30 <untyped> bigint)