github.com/InjectiveLabs/sdk-go@v1.53.0/chain/exchange/types/events.go (about) 1 package types 2 3 import ( 4 "github.com/ethereum/go-ethereum/common" 5 ) 6 7 // Event type and attribute constants 8 9 func (e *EventOrderFail) AddOrderFail(orderHash common.Hash, cid string, flag uint32) { 10 e.Hashes = append(e.Hashes, orderHash.Bytes()) 11 e.Flags = append(e.Flags, flag) 12 13 if cid != "" { 14 e.Cids = append(e.Cids, cid) 15 } 16 } 17 18 func (e *EventOrderFail) IsEmpty() bool { 19 return len(e.Flags) == 0 && len(e.Hashes) == 0 && len(e.Cids) == 0 20 } 21 22 func NewEventOrderCancelFail(marketID, subaccountID common.Hash, orderHash, cid string, err error) *EventOrderCancelFail { 23 ev := &EventOrderCancelFail{ 24 MarketId: marketID.Hex(), 25 SubaccountId: subaccountID.Hex(), 26 OrderHash: orderHash, 27 Cid: cid, 28 } 29 if err != nil { 30 ev.Description = err.Error() 31 } 32 return ev 33 }