forked from forbole/callisto
-
Notifications
You must be signed in to change notification settings - Fork 0
/
types.go
81 lines (69 loc) · 2.96 KB
/
types.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
package types
import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/faddat/bdjuno/x/liquidity"
)
type MatchType int
type MatchResult struct {
OrderExpiryHeight int64
OrderMsgIndex uint64
OrderPrice sdk.Dec
OfferCoinAmt sdk.Dec
TransactedCoinAmt sdk.Dec
ExchangedDemandCoinAmt sdk.Dec
OfferCoinFeeAmt sdk.Dec
ExchangedCoinFeeAmt sdk.Dec
BatchMsg *SwapMsgState
}
type Order struct {
Price sdk.Dec
BuyOfferAmt sdk.Int
SellOfferAmt sdk.Int
SwapMsgStates []*SwapMsgState
}
type Pool struct {
Id uint64 // index of this liquidity pool
TypeId uint32 // pool type of this liquidity pool
ReserveCoinDenoms []string // list of reserve coin denoms for this liquidity pool
ReserveAccountAddress string // reserve account address for this liquidity pool to store reserve coins
PoolCoinDenom string // denom of pool coin for this liquidity pool
}
type DepositMsgState struct {
MsgHeight uint64 // height where this message is appended to the batch
MsgIndex uint64 // index of this deposit message in this liquidity pool
Executed bool // true if executed on this batch, false if not executed yet
Succeeded bool // true if executed successfully on this batch, false if failed
ToBeDelete bool // true if ready to be deleted on kvstore, false if not ready to be deleted
Msg MsgDepositWithinBatch
}
type WithdrawMsgState struct {
MsgHeight uint64 // height where this message is appended to the batch
MsgIndex uint64 // index of this withdraw message in this liquidity pool
Executed bool // true if executed on this batch, false if not executed yet
Succeeded bool // true if executed successfully on this batch, false if failed
ToBeDelete bool // true if ready to be deleted on kvstore, false if not ready to be deleted
Msg MsgWithdrawWithinBatch
}
type SwapMsgState struct {
MsgHeight uint64 // height where this message is appended to the batch
MsgIndex uint64 // index of this swap message in this liquidity pool
Executed bool // true if executed on this batch, false if not executed yet
Succeeded bool // true if executed successfully on this batch, false if failed
ToBeDelete bool // true if ready to be deleted on kvstore, false if not ready to be deleted
OrderExpiryHeight int64 // swap orders are cancelled when current height is equal or higher than ExpiryHeight
ExchangedOfferCoin sdk.Coin // offer coin exchanged until now
RemainingOfferCoin sdk.Coin // offer coin currently remaining to be exchanged
Msg MsgSwapWithinBatch
}
type BatchResult struct {
MatchType MatchType
PriceDirection PriceDirection
SwapPrice sdk.Dec
EX sdk.Dec
EY sdk.Dec
OriginalEX sdk.Int
OriginalEY sdk.Int
PoolX sdk.Dec
PoolY sdk.Dec
TransactAmt sdk.Dec
}