Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions x/dex/types/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,20 +36,20 @@ func (cs ContractState) Validate() error {
return fmt.Errorf("empty contract addr")
}
// Check for duplicated ID in shortBook
longBookIDMap := make(map[uint64]bool)
longBookIDMap := make(map[uint64]struct{})
for _, elem := range cs.LongBookList {
if _, ok := longBookIDMap[elem.Price.BigInt().Uint64()]; ok {
return fmt.Errorf("duplicated price for longBook")
}
longBookIDMap[elem.Price.BigInt().Uint64()] = true
longBookIDMap[elem.Price.BigInt().Uint64()] = struct{}{}
}
// Check for duplicated ID in shortBook
shortBookIDMap := make(map[uint64]bool)
shortBookIDMap := make(map[uint64]struct{})
for _, elem := range cs.ShortBookList {
if _, ok := shortBookIDMap[elem.Price.BigInt().Uint64()]; ok {
return fmt.Errorf("duplicated price for shortBook")
}
shortBookIDMap[elem.Price.BigInt().Uint64()] = true
shortBookIDMap[elem.Price.BigInt().Uint64()] = struct{}{}
}
return nil
}
4 changes: 2 additions & 2 deletions x/dex/types/wasm/block_hooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ func NewContractOrderResult(contractAddr string) ContractOrderResult {

func PopulateOrderPlacementResults(contractAddr string, orders []*types.Order, cancellations []*types.Cancellation, resultMap map[string]ContractOrderResult) {
// get cancelled order ids
cancels := make(map[uint64]bool)
cancels := make(map[uint64]struct{})
for _, cancel := range cancellations {
cancels[cancel.Id] = true
cancels[cancel.Id] = struct{}{}
}

for _, order := range orders {
Expand Down