Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: support x/collection migration on old chains #1106

Merged
merged 3 commits into from
Sep 4, 2023
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
* (ostracon) [\#1099](https://github.com/Finschia/finschia-sdk/pull/1099) feat!: remove libsodium vrf library.
* (x/collection) [\#1102](https://github.com/finschia/finschia-sdk/pull/1102) Reject modifying NFT class with token index filled in MsgModify
* (x/collection) [\#1105](https://github.com/Finschia/finschia-sdk/pull/1105) Add minted coins to balance in x/collection MsgMintFT
* (x/collection) [\#1106](https://github.com/Finschia/finschia-sdk/pull/1106) Support x/collection migration on old chains

### Build, CI
* (build,ci) [\#1043](https://github.com/Finschia/finschia-sdk/pull/1043) Update golang version to 1.20
Expand Down
5 changes: 4 additions & 1 deletion x/collection/keeper/migrations/v2/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,9 @@ func updateContractFTStatistics(store storetypes.KVStore, contractID string, sup
return err
}

for intClassID := uint64(1); intClassID < nextClassIDs.Fungible.Uint64(); intClassID++ {
// In the old chains, classID of fungible tokens starts from zero
// In the new chains, it starts from one, but it does not hurts because amount of zero is not set to the store.
for intClassID := uint64(0); intClassID < nextClassIDs.Fungible.Uint64(); intClassID++ {
classID := fmt.Sprintf("%08x", intClassID)

// update supply
Expand All @@ -104,6 +106,7 @@ func updateContractFTStatistics(store storetypes.KVStore, contractID string, sup
}
store.Set(supplyKey, bz)
} else {
supply = sdk.ZeroInt()
store.Delete(supplyKey)
}

Expand Down
Loading