Skip to content

Commit

Permalink
Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
MissingNO57 committed Oct 21, 2024
1 parent f1c0e78 commit f65b208
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 19 deletions.
7 changes: 3 additions & 4 deletions app/upgrade_cudos_distribution.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ func aggregateRewards(distributionInfo *DistributionInfo, validators *OrderedMap
validator := validators.MustGet(validatorOperatorAddr)

// Get initial outstanding reward
outstandingReward := distributionInfo.OutstandingRewards.MustGet(validatorOperatorAddr)
outstandingRewards := distributionInfo.OutstandingRewards.MustGet(validatorOperatorAddr)

endingPeriod := UpdateValidatorData(distributionInfo, validator)

Expand All @@ -277,8 +277,7 @@ func aggregateRewards(distributionInfo *DistributionInfo, validators *OrderedMap
delegatorRewards, _ := distributionInfo.Rewards.GetOrSetDefault(delegatorAddr, NewOrderedMap[string, sdk.DecCoins]())
delegatorRewards.SetNew(validatorOperatorAddr, rewardsRaw)

rewards := rewardsRaw.Intersect(outstandingReward)
outstandingReward = outstandingReward.Sub(rewards)
outstandingRewards = outstandingRewards.Sub(rewardsRaw.Intersect(outstandingRewards))

}

Expand All @@ -287,7 +286,7 @@ func aggregateRewards(distributionInfo *DistributionInfo, validators *OrderedMap
return err
}

distributionInfo.ValidatorRewards.Set(validatorAccountAddress, outstandingReward)
distributionInfo.ValidatorRewards.Set(validatorAccountAddress, outstandingRewards)

}

Expand Down
24 changes: 9 additions & 15 deletions app/upgrade_v_11_4_manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,21 +189,15 @@ type UpgradeAccountCreation struct {
}

type UpgradeBalances struct {
Address string `json:"address"`
BankBalance types.Coins `json:"bank_balance"`
VestedBalance types.Coins `json:"vested_balance,omitempty"`
BondedStakingBalance types.Coins `json:"bonded_staking_balance,omitempty"`
UnbondedStakingBalance types.Coins `json:"unbonded_staking_balance,omitempty"`
UnbondingStakingBalance types.Coins `json:"unbonding_staking_balance,omitempty"`
DelegatorRewards types.Coins `json:"delegator_rewards,omitempty"`
ValidatorRewards types.Coins `json:"validator_rewards,omitempty"`
Memo string `json:"memo,omitempty"`
}

// app.UpgradeKeeper.GetUpgradeInfoPath()
// if upgradeFilePath, err = app.UpgradeKeeper.GetUpgradeInfoPath(); err != nil {
// return "", err
// }
Address string `json:"address"`
BankBalance types.Coins `json:"bank_balance"`
VestedBalance types.Coins `json:"vested_balance,omitempty"`
BondedStakingBalancesAggr types.Coins `json:"bonded_staking_balances_aggr,omitempty"`
UnbondedStakingBalancesAggr types.Coins `json:"unbonded_staking_balances_aggr,omitempty"`
UnbondingStakingBalancesAggr types.Coins `json:"unbonding_staking_balances_aggr,omitempty"`
DelegatorRewardsAggr types.Coins `json:"delegator_rewards_aggr,omitempty"`
ValidatorRewards types.Coins `json:"validator_rewards,omitempty"`
}

func getManifestFilePath(app *App, prefix string) (string, error) {
var upgradeFilePath string
Expand Down

0 comments on commit f65b208

Please sign in to comment.