Skip to content

Commit

Permalink
chore(e2e) update v14.x genesis for #4244 (#4309)
Browse files Browse the repository at this point in the history
  • Loading branch information
p0mvn committed Feb 14, 2023
1 parent 96635bc commit 4d4583f
Showing 1 changed file with 38 additions and 6 deletions.
44 changes: 38 additions & 6 deletions tests/e2e/initialization/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,16 @@ import (
tmjson "github.com/tendermint/tendermint/libs/json"

epochtypes "github.com/osmosis-labs/osmosis/v14/x/epochs/types"
"github.com/osmosis-labs/osmosis/v14/x/gamm/pool-models/balancer"
gammtypes "github.com/osmosis-labs/osmosis/v14/x/gamm/types"
incentivestypes "github.com/osmosis-labs/osmosis/v14/x/incentives/types"
minttypes "github.com/osmosis-labs/osmosis/v14/x/mint/types"
poolitypes "github.com/osmosis-labs/osmosis/v14/x/pool-incentives/types"
twaptypes "github.com/osmosis-labs/osmosis/v14/x/twap/types"
txfeestypes "github.com/osmosis-labs/osmosis/v14/x/txfees/types"

types1 "github.com/cosmos/cosmos-sdk/codec/types"

"github.com/osmosis-labs/osmosis/v14/tests/e2e/util"
)

Expand All @@ -51,6 +54,7 @@ const (
AtomDenom = "uatom"
OsmoIBCDenom = "ibc/ED07A3391A112B175915CD8FAF43A2DA8E4790EDE12566649D0C2F97716B8518"
StakeIBCDenom = "ibc/C053D637CCA2A2BA030E2C5EE1B28A16F71CCB0E45E8BE52766DC1B241B7787"
E2EFeeToken = "e2e-default-feetoken"
MinGasPrice = "0.000"
IbcSendAmount = 3300000000
ValidatorWalletName = "val"
Expand All @@ -61,11 +65,13 @@ const (
StakeBalanceA = 110000000000
StakeAmountA = 100000000000
// chainB
ChainBID = "osmo-test-b"
OsmoBalanceB = 500000000000
IonBalanceB = 100000000000
StakeBalanceB = 440000000000
StakeAmountB = 400000000000
ChainBID = "osmo-test-b"
OsmoBalanceB = 500000000000
IonBalanceB = 100000000000
StakeBalanceB = 440000000000
StakeAmountB = 400000000000
GenesisFeeBalance = 100000000000
WalletFeeBalance = 100000000

EpochDuration = time.Second * 60
TWAPPruningKeepPeriod = EpochDuration / 4
Expand All @@ -83,6 +89,7 @@ var (
StakeToken = sdk.NewInt64Coin(StakeDenom, IbcSendAmount) // 3,300ustake
tenOsmo = sdk.Coins{sdk.NewInt64Coin(OsmoDenom, 10_000_000)}
fiftyOsmo = sdk.Coins{sdk.NewInt64Coin(OsmoDenom, 50_000_000)}
WalletFeeTokens = sdk.NewCoin(E2EFeeToken, sdk.NewInt(WalletFeeBalance))
)

func addAccount(path, moniker, amountStr string, accAddr sdk.AccAddress, forkHeight int) error {
Expand All @@ -96,6 +103,7 @@ func addAccount(path, moniker, amountStr string, accAddr sdk.AccAddress, forkHei
if err != nil {
return fmt.Errorf("failed to parse coins: %w", err)
}
coins = coins.Add(sdk.NewCoin(E2EFeeToken, sdk.NewInt(GenesisFeeBalance)))

balances := banktypes.Balance{Address: accAddr.String(), Coins: coins.Sort()}
genAccount := authtypes.NewBaseAccount(accAddr, nil, 0, 0)
Expand Down Expand Up @@ -159,7 +167,6 @@ func addAccount(path, moniker, amountStr string, accAddr sdk.AccAddress, forkHei
return genutil.ExportGenesisFile(genDoc, genFile)
}

//nolint:typecheck
func updateModuleGenesis[V proto.Message](appGenState map[string]json.RawMessage, moduleName string, protoVal V, updateGenesis func(V)) error {
if err := util.Cdc.UnmarshalJSON(appGenState[moduleName], protoVal); err != nil {
return err
Expand Down Expand Up @@ -342,10 +349,35 @@ func updateMintGenesis(mintGenState *minttypes.GenesisState) {

func updateTxfeesGenesis(txfeesGenState *txfeestypes.GenesisState) {
txfeesGenState.Basedenom = OsmoDenom
txfeesGenState.Feetokens = []txfeestypes.FeeToken{
{Denom: E2EFeeToken, PoolID: 1},
}
}

func updateGammGenesis(gammGenState *gammtypes.GenesisState) {
gammGenState.Params.PoolCreationFee = tenOsmo
// setup fee pool, between "e2e_default_fee_token" and "uosmo"
feePoolParams := balancer.NewPoolParams(sdk.MustNewDecFromStr("0.01"), sdk.ZeroDec(), nil)
feePoolAssets := []balancer.PoolAsset{
{
Weight: sdk.NewInt(100),
Token: sdk.NewCoin("uosmo", sdk.NewInt(100000000000)),
},
{
Weight: sdk.NewInt(100),
Token: sdk.NewCoin(E2EFeeToken, sdk.NewInt(100000000000)),
},
}
pool1, err := balancer.NewBalancerPool(1, feePoolParams, feePoolAssets, "", time.Unix(0, 0))
if err != nil {
panic(err)
}
anyPool, err := types1.NewAnyWithValue(&pool1)
if err != nil {
panic(err)
}
gammGenState.Pools = []*types1.Any{anyPool}
gammGenState.NextPoolNumber = 2
}

func updateEpochGenesis(epochGenState *epochtypes.GenesisState) {
Expand Down

0 comments on commit 4d4583f

Please sign in to comment.