Skip to content

Commit

Permalink
fix: fix default next class ids of x/collection (#960)
Browse files Browse the repository at this point in the history
* Fix default next class ids

* Update CHANGELOG.md

* Update CHANGELOG.md

* Add unit test
  • Loading branch information
0Tech authored Apr 11, 2023
1 parent b842111 commit 0afcc7d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
* (x/collection) [\#954](https://github.com/line/lbm-sdk/pull/954) Remove duplicated events in x/collection Msg/Modify
* (x/collection) [\#955](https://github.com/line/lbm-sdk/pull/955) Return nil where the parent not exists in x/collection Query/Parent
* (x/collection) [\#959](https://github.com/line/lbm-sdk/pull/959) Revert #955 and add Query/HasParent into x/collection
* (x/collection) [\#960](https://github.com/line/lbm-sdk/pull/960) Fix default next class ids of x/collection

### Removed

Expand Down
4 changes: 2 additions & 2 deletions x/collection/collection.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ func (x LegacyPermission) String() string {
func DefaultNextClassIDs(contractID string) NextClassIDs {
return NextClassIDs{
ContractId: contractID,
Fungible: sdk.NewUint(0),
NonFungible: sdk.NewUint(1 << 28), // "10000000"
Fungible: sdk.NewUint(1),
NonFungible: sdk.NewUint(1 << 28).Incr(), // "10000000 + 1"
}
}

Expand Down
11 changes: 11 additions & 0 deletions x/collection/collection_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,3 +171,14 @@ func TestParseCoins(t *testing.T) {
})
}
}

func TestDefaultNextClassIDs(t *testing.T) {
contractID := "deadbeef"
require.Equal(t, collection.NextClassIDs{
ContractId: contractID,
Fungible: sdk.NewUint(1),
NonFungible: sdk.NewUint(1 << 28).Incr(), // "10000000 + 1"
},
collection.DefaultNextClassIDs(contractID),
)
}

0 comments on commit 0afcc7d

Please sign in to comment.