-
Notifications
You must be signed in to change notification settings - Fork 802
/
settlement.go
36 lines (33 loc) · 971 Bytes
/
settlement.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"
)
type SudoSettlementMsg struct {
Settlement Settlements `json:"settlement"`
}
func NewSettlementEntry(
ctx sdk.Context,
orderID uint64,
account string,
direction PositionDirection,
priceDenom string,
assetDenom string,
quantity sdk.Dec,
executionCostOrProceed sdk.Dec,
expectedCostOrProceed sdk.Dec,
orderType OrderType,
) *SettlementEntry {
return &SettlementEntry{
OrderId: orderID,
PositionDirection: GetContractPositionDirection(direction),
PriceDenom: priceDenom,
AssetDenom: assetDenom,
Quantity: quantity,
ExecutionCostOrProceed: executionCostOrProceed,
ExpectedCostOrProceed: expectedCostOrProceed,
Account: account,
OrderType: GetContractOrderType(orderType),
Timestamp: uint64(ctx.BlockTime().Unix()),
Height: uint64(ctx.BlockHeight()),
}
}