Skip to content
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

payment processor added to upgrade #1724

Merged
merged 1 commit into from
Dec 22, 2022
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
2 changes: 1 addition & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -838,7 +838,7 @@ func (app *PylonsApp) setupUpgradeHandlers() {
// v1.1.2 mainnet upgrade handler
app.UpgradeKeeper.SetUpgradeHandler(
v1.UpgradeName,
v1.CreateUpgradeHandler(app.mm, app.configurator, app.BankKeeper, &app.AccountKeeper, &app.StakingKeeper),
v1.CreateUpgradeHandler(app.mm, app.configurator, app.BankKeeper, &app.AccountKeeper, &app.StakingKeeper, &app.PylonsKeeper),
)
}

Expand Down
25 changes: 25 additions & 0 deletions app/upgrades/mainnet/v1/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package v1

import (
"cosmossdk.io/math"
"github.com/Pylons-tech/pylons/x/pylons/keeper"
"github.com/Pylons-tech/pylons/x/pylons/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
Expand All @@ -23,13 +24,15 @@ func CreateUpgradeHandler(
bankKeeper bankkeeper.Keeper,
accKeeper *authkeeper.AccountKeeper,
staking *stakingkeeper.Keeper,
keeper *keeper.Keeper,
) upgradetypes.UpgradeHandler {
return func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {
// logger := ctx.Logger()

bankBaseKeeper, _ := bankKeeper.(bankkeeper.BaseKeeper)
if types.IsMainnet(ctx.ChainID()) {
BurnToken(ctx, accKeeper, &bankBaseKeeper, staking)
SetParams(ctx, *keeper)
}

vm, err := mm.RunMigrations(ctx, configurator, fromVM)
Expand Down Expand Up @@ -90,3 +93,25 @@ func BurnCoins(ctx sdk.Context, bank *bankkeeper.BaseKeeper, acc string, amount
panic(err)
}
}

func SetParams(ctx sdk.Context, k keeper.Keeper) {
oldParams := k.GetParams(ctx)
newParams := getParamsPaymentProcessor(oldParams)
k.SetParams(ctx, newParams)
}

func getParamsPaymentProcessor(params types.Params) types.Params {
paymentProcessor := []types.PaymentProcessor{}
processorPercentage, _ := sdk.NewDecFromStr("0.000000000000000000")
validatorPercentage, _ := sdk.NewDecFromStr("0.003000000000000000")
processor := types.PaymentProcessor{
CoinDenom: "ustripeusd",
PubKey: "JgxPJ/hZe0nZ019iSmL+gIPM/pO8i3s8AsikLjoJAJs=",
ProcessorPercentage: processorPercentage,
ValidatorsPercentage: validatorPercentage,
Name: "Pylons_Inc",
}
paymentProcessor = append(paymentProcessor, processor)
params.PaymentProcessors = paymentProcessor
return params
}
9 changes: 9 additions & 0 deletions networks/pylons-mainnet-1/genesis.json
Original file line number Diff line number Diff line change
Expand Up @@ -512578,6 +512578,15 @@
}
],
"distr_epoch_identifier": "day",
"payment_processors": [
{
"coin_denom": "ustripeusd",
"pub_key": "JgxPJ/hZe0nZ019iSmL+gIPM/pO8i3s8AsikLjoJAJs=",
"processor_percentage": "0.000000000000000000",
"validators_percentage": "0.003000000000000000",
"name": "Pylons_Inc"
}
],
"engine_version": "0",
"item_transfer_fee_percentage": "0.100000000000000000",
"max_transfer_fee": "10000",
Expand Down