Skip to content

Commit 0afcc7d

Browse files
authored
fix: fix default next class ids of x/collection (#960)
* Fix default next class ids * Update CHANGELOG.md * Update CHANGELOG.md * Add unit test
1 parent b842111 commit 0afcc7d

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
5555
* (x/collection) [\#954](https://github.com/line/lbm-sdk/pull/954) Remove duplicated events in x/collection Msg/Modify
5656
* (x/collection) [\#955](https://github.com/line/lbm-sdk/pull/955) Return nil where the parent not exists in x/collection Query/Parent
5757
* (x/collection) [\#959](https://github.com/line/lbm-sdk/pull/959) Revert #955 and add Query/HasParent into x/collection
58+
* (x/collection) [\#960](https://github.com/line/lbm-sdk/pull/960) Fix default next class ids of x/collection
5859

5960
### Removed
6061

x/collection/collection.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ func (x LegacyPermission) String() string {
2828
func DefaultNextClassIDs(contractID string) NextClassIDs {
2929
return NextClassIDs{
3030
ContractId: contractID,
31-
Fungible: sdk.NewUint(0),
32-
NonFungible: sdk.NewUint(1 << 28), // "10000000"
31+
Fungible: sdk.NewUint(1),
32+
NonFungible: sdk.NewUint(1 << 28).Incr(), // "10000000 + 1"
3333
}
3434
}
3535

x/collection/collection_test.go

+11
Original file line numberDiff line numberDiff line change
@@ -171,3 +171,14 @@ func TestParseCoins(t *testing.T) {
171171
})
172172
}
173173
}
174+
175+
func TestDefaultNextClassIDs(t *testing.T) {
176+
contractID := "deadbeef"
177+
require.Equal(t, collection.NextClassIDs{
178+
ContractId: contractID,
179+
Fungible: sdk.NewUint(1),
180+
NonFungible: sdk.NewUint(1 << 28).Incr(), // "10000000 + 1"
181+
},
182+
collection.DefaultNextClassIDs(contractID),
183+
)
184+
}

0 commit comments

Comments
 (0)