Skip to content
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
7 changes: 7 additions & 0 deletions cmd/fetchd/cmd/gen_asi_upgrade_manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,14 @@ type ASIUpgradeTransfers struct {
To string `json:"to"`
}

type ASIUpgradeSupply struct {
LandingAddress string `json:"landing_address"`
MintedAmount types.Coins `json:"minted_amount"`
ResultingSupplyTotal types.Coins `json:"resulting_supply_total"`
}

type ASIUpgradeManifest struct {
Supply *ASIUpgradeSupply `json:"supply,omitempty"`
IBC *ASIUpgradeTransfers `json:"ibc,omitempty"`
Reconciliation *ASIUpgradeTransfers `json:"reconciliation,omitempty"`
}
Expand Down
12 changes: 10 additions & 2 deletions cmd/fetchd/cmd/genesis-asi-upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ func ASIGenesisUpgradeCmd(defaultNodeHome string) *cobra.Command {
ASIGenesisUpgradeReplaceDenom(jsonData, networkConfig)

// supplement the genesis supply
ASIGenesisUpgradeASISupply(jsonData, networkConfig)
ASIGenesisUpgradeASISupply(jsonData, networkConfig, &manifest)

// replace addresses across the genesis file
ASIGenesisUpgradeReplaceAddresses(jsonData, networkConfig)
Expand Down Expand Up @@ -453,7 +453,7 @@ func ASIGenesisUpgradeWithdrawReconciliationBalances(jsonData map[string]interfa
return nil
}

func ASIGenesisUpgradeASISupply(jsonData map[string]interface{}, networkInfo NetworkConfig) {
func ASIGenesisUpgradeASISupply(jsonData map[string]interface{}, networkInfo NetworkConfig, manifest *ASIUpgradeManifest) {
denomInfo := networkInfo.DenomInfo
supplyInfo := networkInfo.SupplyInfo
additionalSupply, ok := sdk.NewIntFromString(supplyInfo.SupplyToMint)
Expand Down Expand Up @@ -496,6 +496,14 @@ func ASIGenesisUpgradeASISupply(jsonData map[string]interface{}, networkInfo Net
// add the additional coins to the overflow address balance
overflowAddressBalanceCoins = overflowAddressBalanceCoins.Add(additionalSupplyCoin)

// add the new supply mint record to the manifest
supplyRecord := ASIUpgradeSupply{
LandingAddress: supplyInfo.UpdatedSupplyOverflowAddr,
MintedAmount: sdk.NewCoins(additionalSupplyCoin),
ResultingSupplyTotal: sdk.NewCoins(newSupplyCoins),
}
manifest.Supply = &supplyRecord

// update the supply in the bank module
supply[curSupplyIdx].(map[string]interface{})["amount"] = newSupplyCoins.Amount.String()
balances[(*balancesMap)[supplyInfo.UpdatedSupplyOverflowAddr]].(map[string]interface{})["coins"] = getInterfaceSliceFromCoins(overflowAddressBalanceCoins)
Expand Down