Skip to content

Commit

Permalink
Fix: Cudos account movements same address fix (#409)
Browse files Browse the repository at this point in the history
  • Loading branch information
MissingNO57 authored Oct 24, 2024
1 parent b211056 commit 2d56bb7
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions app/upgrade_cudos.go
Original file line number Diff line number Diff line change
Expand Up @@ -2249,16 +2249,22 @@ func MigrateGenesisAccounts(genesisData *GenesisData, ctx sdk.Context, app *App,
func DoGenesisAccountMovements(genesisData *GenesisData, cudosCfg *CudosMergeConfig, manifest *UpgradeManifest) error {

for _, accountMovement := range cudosCfg.Config.MovedAccounts {
// Skip if source and destination address is the same
if accountMovement.SourceAddress == accountMovement.DestinationAddress {
registerManifestBalanceMovement(accountMovement.SourceAddress, accountMovement.DestinationAddress, nil, "movement_to_itself_skipping", manifest)
continue
}

fromAcc, exists := genesisData.Accounts.Get(accountMovement.SourceAddress)

if !exists {
registerManifestBalanceMovement(accountMovement.SourceAddress, accountMovement.DestinationAddress, nil, "non_existing_from_account", manifest)
return nil
registerManifestBalanceMovement(accountMovement.SourceAddress, accountMovement.DestinationAddress, nil, "non_existing_from_account_skipping", manifest)
continue
}

if fromAcc.Balance.IsZero() {
registerManifestBalanceMovement(accountMovement.SourceAddress, accountMovement.DestinationAddress, nil, "nothing_to_move_err", manifest)
return nil
registerManifestBalanceMovement(accountMovement.SourceAddress, accountMovement.DestinationAddress, nil, "no_source_balance_to_move_skipping", manifest)
continue
}

fromAccTokensAmount := fromAcc.Balance.AmountOfNoDenomValidation(genesisData.BondDenom)
Expand Down

0 comments on commit 2d56bb7

Please sign in to comment.