-
Notifications
You must be signed in to change notification settings - Fork 0
/
pool.go
36 lines (33 loc) · 1.48 KB
/
pool.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package types
import (
sdk "github.com/cosmos/cosmos-sdk/types"
proto "github.com/gogo/protobuf/proto"
)
// PoolI defines an interface for pools that hold tokens.
type PoolI interface {
proto.Message
GetAddress() sdk.AccAddress
String() string
GetId() uint64
// GetSwapFee returns the pool's swap fee, based on the current state.
// Pools may choose to make their swap fees dependent upon state
// (prior TWAPs, network downtime, other pool states, etc.)
// hence Context is provided as an argument.
GetSwapFee(ctx sdk.Context) sdk.Dec
// GetExitFee returns the pool's exit fee, based on the current state.
// Pools may choose to make their exit fees dependent upon state.
GetExitFee(ctx sdk.Context) sdk.Dec
// Returns whether the pool has swaps enabled at the moment
IsActive(ctx sdk.Context) bool
// GetTotalShares returns the total number of LP shares in the pool
GetTotalShares() sdk.Int
// GetTotalPoolLiquidity returns the coins in the pool owned by all LPs
GetTotalPoolLiquidity(ctx sdk.Context) sdk.Coins
// Returns the spot price of the 'base asset' in terms of the 'quote asset' in the pool,
// errors if either baseAssetDenom, or quoteAssetDenom does not exist.
// For example, if this was a UniV2 50-50 pool, with 2 ETH, and 8000 UST
// pool.SpotPrice(ctx, "eth", "ust") = 4000.00
SpotPrice(ctx sdk.Context, quoteAssetDenom string, baseAssetDenom string) (sdk.Dec, error)
// GetType returns the type of the pool (Balancer, Stableswap, Concentrated, etc.)
GetType() PoolType
}