From 8fc06442903068b973deff4eba163a2ec18bcc4d Mon Sep 17 00:00:00 2001 From: Youngtaek Yoon Date: Fri, 1 Sep 2023 22:08:11 +0900 Subject: [PATCH 1/3] Support old chains --- x/collection/keeper/migrations/v2/store.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/x/collection/keeper/migrations/v2/store.go b/x/collection/keeper/migrations/v2/store.go index 2ed0bb456b..5847c7a17e 100644 --- a/x/collection/keeper/migrations/v2/store.go +++ b/x/collection/keeper/migrations/v2/store.go @@ -91,7 +91,7 @@ func updateContractFTStatistics(store storetypes.KVStore, contractID string, sup return err } - for intClassID := uint64(1); intClassID < nextClassIDs.Fungible.Uint64(); intClassID++ { + for intClassID := uint64(0); intClassID < nextClassIDs.Fungible.Uint64(); intClassID++ { classID := fmt.Sprintf("%08x", intClassID) // update supply @@ -104,6 +104,7 @@ func updateContractFTStatistics(store storetypes.KVStore, contractID string, sup } store.Set(supplyKey, bz) } else { + supply = sdk.ZeroInt() store.Delete(supplyKey) } From beb10ced4fbc6e79ef5e1db6d0aa58d2fdb103bc Mon Sep 17 00:00:00 2001 From: Youngtaek Yoon Date: Fri, 1 Sep 2023 23:50:32 +0900 Subject: [PATCH 2/3] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0cc28f74e9..653f972260 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 From a7790c867c5e78201e08443f453fffe56920e8ef Mon Sep 17 00:00:00 2001 From: Youngtaek Yoon Date: Mon, 4 Sep 2023 17:48:32 +0900 Subject: [PATCH 3/3] Add comment --- x/collection/keeper/migrations/v2/store.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/x/collection/keeper/migrations/v2/store.go b/x/collection/keeper/migrations/v2/store.go index 5847c7a17e..d045c12290 100644 --- a/x/collection/keeper/migrations/v2/store.go +++ b/x/collection/keeper/migrations/v2/store.go @@ -91,6 +91,8 @@ func updateContractFTStatistics(store storetypes.KVStore, contractID string, sup return err } + // 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)