File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed
Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -189,7 +189,23 @@ func (k BaseKeeper) setSupply(ctx sdk.Context, supply sdk.Coins) {
189189 store := ctx .KVStore (k .storeKey )
190190 supplyStore := prefix .NewStore (store , types .SupplyKey )
191191
192- for i := range supply {
192+ var newSupply []sdk.Coin
193+ storeSupply := k .GetTotalSupply (ctx )
194+
195+ // update supply for coins which have non zero amount
196+ for _ , coin := range storeSupply {
197+ if supply .AmountOf (coin .Denom ).IsZero () {
198+ zeroCoin := & sdk.Coin {
199+ Denom : coin .Denom ,
200+ Amount : sdk .NewInt (0 ),
201+ }
202+ bz := k .cdc .MustMarshalBinaryBare (zeroCoin )
203+ supplyStore .Set ([]byte (coin .Denom ), bz )
204+ }
205+ }
206+ newSupply = append (newSupply , supply ... )
207+
208+ for i := range newSupply {
193209 bz := k .cdc .MustMarshalBinaryBare (& supply [i ])
194210 supplyStore .Set ([]byte (supply [i ].Denom ), bz )
195211 }
You can’t perform that action at this time.
0 commit comments