-
Notifications
You must be signed in to change notification settings - Fork 41
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
feat: ASI manifest #353
feat: ASI manifest #353
Changes from 3 commits
5432f3c
0c3c386
da14860
34c3ce6
9952c0b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -19,9 +19,16 @@ type ASIUpgradeTransfers struct { | |||||||||||||
To string `json:"to"` | ||||||||||||||
} | ||||||||||||||
|
||||||||||||||
type ASIUpgradeSupplyMint struct { | ||||||||||||||
LandingAddress string `json:"landing_address"` | ||||||||||||||
Amount types.Coins `json:"amount"` | ||||||||||||||
NewSupplyTotal types.Coins `json:"new_supply_total"` | ||||||||||||||
} | ||||||||||||||
|
||||||||||||||
type ASIUpgradeManifest struct { | ||||||||||||||
IBC *ASIUpgradeTransfers `json:"ibc,omitempty"` | ||||||||||||||
Reconciliation *ASIUpgradeTransfers `json:"reconciliation,omitempty"` | ||||||||||||||
SupplyMint []ASIUpgradeSupplyMint `json:"supply_mint"` | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||
IBC *ASIUpgradeTransfers `json:"ibc,omitempty"` | ||||||||||||||
Reconciliation *ASIUpgradeTransfers `json:"reconciliation,omitempty"` | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||
} | ||||||||||||||
|
||||||||||||||
func SaveASIManifest(manifest *ASIUpgradeManifest, config *config2.Config) error { | ||||||||||||||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -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) | ||||||
|
@@ -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) | ||||||
|
@@ -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 | ||||||
mintRecord := ASIUpgradeSupplyMint{ | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit pick - feel free to ignore.
Suggested change
|
||||||
LandingAddress: supplyInfo.UpdatedSupplyOverflowAddr, | ||||||
Amount: sdk.NewCoins(additionalSupplyCoin), | ||||||
NewSupplyTotal: sdk.NewCoins(newSupplyCoins), | ||||||
} | ||||||
manifest.SupplyMint = append(manifest.SupplyMint, mintRecord) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As per my inline comments above:
Suggested change
|
||||||
|
||||||
// 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) | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest to rename data members: