From 9a8d82ffb83a06780ffab7419fb4b23915c36bdd Mon Sep 17 00:00:00 2001 From: Robert Zaremba Date: Thu, 16 Nov 2023 11:07:07 +0100 Subject: [PATCH 01/21] bank: rename UMEE token to UX --- app/modules.go | 7 +++---- app/params/app_settings.go | 8 +++++++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/app/modules.go b/app/modules.go index 71dc2eef5a..31a706459b 100644 --- a/app/modules.go +++ b/app/modules.go @@ -44,13 +44,12 @@ func (BankModule) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { Denom: appparams.BondDenom, Exponent: 0, Aliases: []string{ - "microumee", + "microumee", appparams.DefaultBaseDenom, }, - }, - { + }, { Denom: appparams.DisplayDenom, Exponent: 6, - Aliases: []string{}, + Aliases: []string{appparams.LegacyDisplayDenom}, }, }, } diff --git a/app/params/app_settings.go b/app/params/app_settings.go index 22787ac353..4b8a9180a0 100644 --- a/app/params/app_settings.go +++ b/app/params/app_settings.go @@ -11,10 +11,16 @@ const ( Name = "umee" // BondDenom defines the native staking token denomination. + // NOTE: it is used by IBC, and must not change to avoid token migration in all IBC chains. BondDenom = "uumee" + DefaultBaseDenom = "uux" + // DisplayDenom defines the name, symbol, and display value of the umee token. - DisplayDenom = "UMEE" + DisplayDenom = "UX" + + // Old dispaly name. We renamed UMEE to UX. + LegacyDisplayDenom = "UMEE" // DefaultGasLimit - set to the same value as cosmos-sdk flags.DefaultGasLimit // this value is currently only used in tests. From e1c9319c55ca758922190d4d814a8f7c5a050060 Mon Sep 17 00:00:00 2001 From: Robert Zaremba Date: Thu, 16 Nov 2023 11:39:18 +0100 Subject: [PATCH 02/21] migration --- app/modules.go | 11 +++++++---- app/upgrades.go | 6 ++++++ 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/app/modules.go b/app/modules.go index 31a706459b..d68bbb9026 100644 --- a/app/modules.go +++ b/app/modules.go @@ -31,11 +31,10 @@ type BankModule struct { bank.AppModuleBasic } -// DefaultGenesis returns custom Umee x/bank module genesis state. -func (BankModule) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { - umeeMetadata := banktypes.Metadata{ +func umeeTokenMetadata() banktypes.Metadata { + return banktypes.Metadata{ Description: "The native staking token of the Umee network.", - Base: appparams.BondDenom, + Base: appparams.BondDenom, // NOTE: must not change Name: appparams.DisplayDenom, Display: appparams.DisplayDenom, Symbol: appparams.DisplayDenom, @@ -53,7 +52,11 @@ func (BankModule) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { }, }, } +} +// DefaultGenesis returns custom Umee x/bank module genesis state. +func (BankModule) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { + umeeMetadata := umeeTokenMetadata() genState := banktypes.DefaultGenesisState() genState.DenomMetadata = append(genState.DenomMetadata, umeeMetadata) diff --git a/app/upgrades.go b/app/upgrades.go index 47e504e426..e8154c93c0 100644 --- a/app/upgrades.go +++ b/app/upgrades.go @@ -115,6 +115,11 @@ func (app *UmeeApp) registerUpgrade6_2(upgradeInfo upgradetypes.Plan) { if err != nil { return fromVM, err } + + // migration UMEE -> UX token metadata + app.BankKeeper.SetDenomMetaData(ctx, umeeTokenMetadata()) + + // Initialize a new Cosmos SDK 0.47 parameter: MinInitialDepositRatio govParams := app.GovKeeper.GetParams(ctx) govParams.MinInitialDepositRatio = sdk.NewDecWithPrec(1, 1).String() err = app.GovKeeper.SetParams(ctx, govParams) @@ -126,6 +131,7 @@ func (app *UmeeApp) registerUpgrade6_2(upgradeInfo upgradetypes.Plan) { uIBCKeeper := app.UIbcQuotaKeeperB.Keeper(&ctx) uIBCKeeper.MigrateTotalOutflowSum() err = uIBCKeeper.SetParams(uibc.DefaultParams()) + return fromVM, err }, ) From bfc47d264b33517995dd85d012a1d742b84a91ca Mon Sep 17 00:00:00 2001 From: Robert Zaremba Date: Thu, 16 Nov 2023 12:01:50 +0100 Subject: [PATCH 03/21] use new token BaseName and introduce IBCBaseName --- app/inflation/inflation_test.go | 4 +-- app/modules.go | 14 +++++------ app/params/app_settings.go | 10 +++++--- app/test_helpers.go | 12 ++++----- app/wasm/test/cw20_base_test.go | 4 +-- app/wasm/test/umee_cw_test.go | 16 ++++++------ sdkclient/tx/wasm.go | 2 +- tests/e2e/e2e_ibc_test.go | 10 ++++---- tests/e2e/e2e_leverage_test.go | 18 ++++++------- tests/e2e/setup/accounts.go | 6 ++--- tests/e2e/setup/setup.go | 4 +-- tests/e2e/setup/utils.go | 2 +- util/coin/fixtures.go | 4 +-- x/incentive/client/tests/tests.go | 10 ++++---- x/leverage/client/tests/tests.go | 18 ++++++------- x/leverage/keeper/exchange_rate_test.go | 2 +- x/leverage/keeper/grpc_query_test.go | 2 +- x/leverage/keeper/interest_test.go | 32 ++++++++++++------------ x/leverage/keeper/invariants_test.go | 8 +++--- x/leverage/keeper/oracle_test.go | 22 ++++++++-------- x/leverage/keeper/reserves_test.go | 2 +- x/leverage/keeper/suite_test.go | 4 +-- x/leverage/simulation/operations_test.go | 18 ++++++------- x/leverage/types/keys_test.go | 6 ++--- x/leverage/types/token.go | 2 +- x/oracle/abci_test.go | 2 +- x/oracle/keeper/hooks_test.go | 2 +- x/oracle/keeper/keeper_test.go | 4 +-- x/oracle/types/asset.go | 2 +- x/oracle/types/keys_test.go | 2 +- x/ugov/inflation_params.go | 2 +- x/ugov/keeper/params_test.go | 2 +- x/uibc/quota/keeper/intest/suite_test.go | 4 +-- 33 files changed, 127 insertions(+), 125 deletions(-) diff --git a/app/inflation/inflation_test.go b/app/inflation/inflation_test.go index 2d08de0f36..5b068fe189 100644 --- a/app/inflation/inflation_test.go +++ b/app/inflation/inflation_test.go @@ -81,7 +81,7 @@ func TestInflationRate(t *testing.T) { mintParams := minttypes.DefaultParams() mockMinter := minttypes.NewMinter(sdk.MustNewDecFromStr("0.15"), sdk.NewDec(0)) mockInflationParams := ugov.InflationParams{ - MaxSupply: coin.New(appparams.BondDenom, 100000000), + MaxSupply: coin.New(appparams.BaseDenom, 100000000), InflationCycle: time.Hour * 1, InflationReductionRate: bpmath.FixedBP(2500), } @@ -187,7 +187,7 @@ func TestInflationRate(t *testing.T) { return mintParams }, inflationParams: func(ip ugov.InflationParams) ugov.InflationParams { - ip.MaxSupply = coin.New(appparams.BondDenom, 1149885) + ip.MaxSupply = coin.New(appparams.BaseDenom, 1149885) return ip }, bondedRatio: sdk.NewDecWithPrec(20, 2), diff --git a/app/modules.go b/app/modules.go index d68bbb9026..d14db18cf9 100644 --- a/app/modules.go +++ b/app/modules.go @@ -34,16 +34,16 @@ type BankModule struct { func umeeTokenMetadata() banktypes.Metadata { return banktypes.Metadata{ Description: "The native staking token of the Umee network.", - Base: appparams.BondDenom, // NOTE: must not change + Base: appparams.IBCBaseDenom, // NOTE: do not change Name: appparams.DisplayDenom, Display: appparams.DisplayDenom, Symbol: appparams.DisplayDenom, DenomUnits: []*banktypes.DenomUnit{ { - Denom: appparams.BondDenom, + Denom: appparams.BaseDenom, Exponent: 0, Aliases: []string{ - "microumee", appparams.DefaultBaseDenom, + "microumee", appparams.BaseDenom, }, }, { Denom: appparams.DisplayDenom, @@ -72,7 +72,7 @@ type StakingModule struct { // DefaultGenesis returns custom Umee x/staking module genesis state. func (StakingModule) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { p := stakingtypes.DefaultParams() - p.BondDenom = appparams.BondDenom + p.BondDenom = appparams.BaseDenom return cdc.MustMarshalJSON(&stakingtypes.GenesisState{ Params: p, }) @@ -87,7 +87,7 @@ type CrisisModule struct { // DefaultGenesis returns custom Umee x/crisis module genesis state. func (CrisisModule) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { return cdc.MustMarshalJSON(&crisistypes.GenesisState{ - ConstantFee: sdk.NewCoin(appparams.BondDenom, sdk.NewInt(1000)), + ConstantFee: sdk.NewCoin(appparams.BaseDenom, sdk.NewInt(1000)), }) } @@ -100,7 +100,7 @@ type MintModule struct { // DefaultGenesis returns custom Umee x/mint module genesis state. func (MintModule) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { genState := minttypes.DefaultGenesisState() - genState.Params.MintDenom = appparams.BondDenom + genState.Params.MintDenom = appparams.BaseDenom return cdc.MustMarshalJSON(genState) } @@ -113,7 +113,7 @@ type GovModule struct { // DefaultGenesis returns custom Umee x/gov module genesis state. func (GovModule) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { - minDeposit := sdk.NewCoins(sdk.NewCoin(appparams.BondDenom, govv1.DefaultMinDepositTokens)) + minDeposit := sdk.NewCoins(sdk.NewCoin(appparams.BaseDenom, govv1.DefaultMinDepositTokens)) genState := govv1.DefaultGenesisState() genState.Params.MinDeposit = minDeposit diff --git a/app/params/app_settings.go b/app/params/app_settings.go index 4b8a9180a0..fae8b81961 100644 --- a/app/params/app_settings.go +++ b/app/params/app_settings.go @@ -8,13 +8,15 @@ import ( const ( // Name defines the application name of the Umee network. + // NOTE: do not change this. Name = "umee" - // BondDenom defines the native staking token denomination. + // IBC denom is the base denom for IBC and Metadata.Base. // NOTE: it is used by IBC, and must not change to avoid token migration in all IBC chains. - BondDenom = "uumee" + IBCBaseDenom = "uumee" - DefaultBaseDenom = "uux" + // BaseDenom defines the native staking an d fee token denom. + BaseDenom = "uux" // DisplayDenom defines the name, symbol, and display value of the umee token. DisplayDenom = "UX" @@ -30,7 +32,7 @@ const ( // ProtocolMinGasPrice is a consensus controlled gas price. Each validator must set his // `minimum-gas-prices` in app.toml config to value above ProtocolMinGasPrice. // Transactions with gas-price smaller than ProtocolMinGasPrice will fail during DeliverTx. -var ProtocolMinGasPrice = sdk.NewDecCoinFromDec(BondDenom, sdk.MustNewDecFromStr("0.00")) +var ProtocolMinGasPrice = sdk.NewDecCoinFromDec(BaseDenom, sdk.MustNewDecFromStr("0.00")) func init() { // XXX: If other upstream or external application's depend on any of Umee's diff --git a/app/test_helpers.go b/app/test_helpers.go index 7647e3242e..2eec3577a0 100644 --- a/app/test_helpers.go +++ b/app/test_helpers.go @@ -81,7 +81,7 @@ func Setup(t *testing.T) *UmeeApp { acc := authtypes.NewBaseAccount(senderPrivKey.PubKey().Address().Bytes(), senderPrivKey.PubKey(), 0, 0) balance := banktypes.Balance{ Address: acc.GetAddress().String(), - Coins: sdk.NewCoins(sdk.NewCoin(params.BondDenom, sdk.NewInt(10000000000000000))), + Coins: sdk.NewCoins(sdk.NewCoin(params.BaseDenom, sdk.NewInt(10000000000000000))), } app := SetupWithGenesisValSet(t, valSet, []authtypes.GenesisAccount{acc}, balance) @@ -177,7 +177,7 @@ func GenesisStateWithValSet(codec codec.Codec, genesisState map[string]json.RawM defaultStParams.MaxValidators, defaultStParams.MaxEntries, defaultStParams.HistoricalEntries, - params.BondDenom, + params.BaseDenom, defaultStParams.MinCommissionRate, ) // set validators and delegations @@ -192,13 +192,13 @@ func GenesisStateWithValSet(codec codec.Codec, genesisState map[string]json.RawM for range delegations { // add delegated tokens to total supply - totalSupply = totalSupply.Add(sdk.NewCoin(params.BondDenom, bondAmt)) + totalSupply = totalSupply.Add(sdk.NewCoin(params.BaseDenom, bondAmt)) } // add bonded amount to bonded pool module account balances = append(balances, banktypes.Balance{ Address: authtypes.NewModuleAddress(stakingtypes.BondedPoolName).String(), - Coins: sdk.Coins{sdk.NewCoin(params.BondDenom, bondAmt)}, + Coins: sdk.Coins{sdk.NewCoin(params.BaseDenom, bondAmt)}, }) // update total supply @@ -250,7 +250,7 @@ func IntegrationTestNetworkConfig() network.Config { panic(err) } leverageGenState.Registry = []leveragetypes.Token{ - fixtures.Token(params.BondDenom, params.DisplayDenom, 6), + fixtures.Token(params.BaseDenom, params.DisplayDenom, 6), } bz, err := cdc.MarshalJSON(&leverageGenState) @@ -307,7 +307,7 @@ func IntegrationTestNetworkConfig() network.Config { cfg.LegacyAmino = encCfg.Amino cfg.InterfaceRegistry = encCfg.InterfaceRegistry cfg.GenesisState = appGenState - cfg.BondDenom = params.BondDenom + cfg.BondDenom = params.BaseDenom cfg.MinGasPrices = params.ProtocolMinGasPrice.String() return cfg diff --git a/app/wasm/test/cw20_base_test.go b/app/wasm/test/cw20_base_test.go index b684bfdcb5..c299be6ef3 100644 --- a/app/wasm/test/cw20_base_test.go +++ b/app/wasm/test/cw20_base_test.go @@ -53,7 +53,7 @@ var ( valAddr2 = sdk.ValAddress(pubKey2.Address()) initTokens = sdk.TokensFromConsensusPower(initialPower, sdk.DefaultPowerReduction) - initCoins = sdk.NewCoins(sdk.NewCoin(appparams.BondDenom, initTokens)) + initCoins = sdk.NewCoins(sdk.NewCoin(appparams.BaseDenom, initTokens)) ) type cw20InitMsg struct { @@ -270,7 +270,7 @@ func (s *IntegrationTestSuite) cw20InitiateCode(sender sdk.AccAddress, init inte Sender: sender.String(), CodeID: s.codeID, Label: cw20Label, - Funds: sdk.Coins{sdk.NewCoin(appparams.BondDenom, sdk.NewIntFromUint64(10))}, + Funds: sdk.Coins{sdk.NewCoin(appparams.BaseDenom, sdk.NewIntFromUint64(10))}, Msg: initBz, Admin: sender.String(), } diff --git a/app/wasm/test/umee_cw_test.go b/app/wasm/test/umee_cw_test.go index f319bd108a..0d97fc6a2d 100644 --- a/app/wasm/test/umee_cw_test.go +++ b/app/wasm/test/umee_cw_test.go @@ -53,7 +53,7 @@ func (s *IntegrationTestSuite) TestLeverageQueries() { Name: "query registered token", CQ: s.genCustomQuery(wq.UmeeQuery{ RegisteredTokens: &lvtypes.QueryRegisteredTokens{ - BaseDenom: appparams.BondDenom, + BaseDenom: appparams.BaseDenom, }, }), ResponseCheck: func(data []byte) { @@ -61,14 +61,14 @@ func (s *IntegrationTestSuite) TestLeverageQueries() { err := json.Unmarshal(data, &rr) assert.NilError(s.T, err) assert.Equal(s.T, true, len(rr.Registry) > 0) - assert.Equal(s.T, appparams.BondDenom, rr.Registry[0].BaseDenom) + assert.Equal(s.T, appparams.BaseDenom, rr.Registry[0].BaseDenom) }, }, { Name: "market summary", CQ: s.genCustomQuery(wq.UmeeQuery{ MarketSummary: &lvtypes.QueryMarketSummary{ - Denom: appparams.BondDenom, + Denom: appparams.BaseDenom, }, }), ResponseCheck: func(data []byte) { @@ -95,7 +95,7 @@ func (s *IntegrationTestSuite) TestLeverageQueries() { CQ: s.genCustomQuery(wq.UmeeQuery{ MaxWithdraw: &lvtypes.QueryMaxWithdraw{ Address: addr.String(), - Denom: appparams.BondDenom, + Denom: appparams.BaseDenom, }, }), ResponseCheck: func(data []byte) { @@ -111,7 +111,7 @@ func (s *IntegrationTestSuite) TestLeverageQueries() { CQ: s.genCustomQuery(wq.UmeeQuery{ MaxBorrow: &lvtypes.QueryMaxBorrow{ Address: addr.String(), - Denom: appparams.BondDenom, + Denom: appparams.BaseDenom, }, }), ResponseCheck: func(data []byte) { @@ -223,7 +223,7 @@ func (s *IntegrationTestSuite) TestStargateQueries() { name: "stargate: leverage market summary", sq: func() StargateQuery { data := lvtypes.QueryMarketSummary{ - Denom: appparams.BondDenom, + Denom: appparams.BaseDenom, } d, err := data.Marshal() assert.NilError(s.T, err) @@ -258,7 +258,7 @@ func (s *IntegrationTestSuite) TestStargateQueries() { func (s *IntegrationTestSuite) TestLeverageTxs() { accAddr := sdk.MustAccAddressFromBech32(s.contractAddr) - err := s.app.BankKeeper.SendCoinsFromModuleToAccount(s.ctx, minttypes.ModuleName, accAddr, sdk.NewCoins(sdk.NewCoin(appparams.BondDenom, sdk.NewInt(100000)))) + err := s.app.BankKeeper.SendCoinsFromModuleToAccount(s.ctx, minttypes.ModuleName, accAddr, sdk.NewCoins(sdk.NewCoin(appparams.BaseDenom, sdk.NewInt(100000)))) assert.NilError(s.T, err) txTests := []struct { Name string @@ -269,7 +269,7 @@ func (s *IntegrationTestSuite) TestLeverageTxs() { Msg: s.genCustomTx(wm.UmeeMsg{ Supply: &lvtypes.MsgSupply{ Supplier: s.contractAddr, - Asset: sdk.NewCoin(appparams.BondDenom, sdk.NewInt(700)), + Asset: sdk.NewCoin(appparams.BaseDenom, sdk.NewInt(700)), }, }), }, diff --git a/sdkclient/tx/wasm.go b/sdkclient/tx/wasm.go index 5ae083ca3a..5bd34614e4 100644 --- a/sdkclient/tx/wasm.go +++ b/sdkclient/tx/wasm.go @@ -24,7 +24,7 @@ func (c *Client) WasmDeployContract(contractPath string) (*sdk.TxResponse, error func (c *Client) WasmInitContract(storeCode uint64, initMsg []byte) (*sdk.TxResponse, error) { fromIdx := 0 - amount := sdk.NewCoins(sdk.NewCoin(appparams.BondDenom, sdk.NewInt(1))) + amount := sdk.NewCoins(sdk.NewCoin(appparams.BaseDenom, sdk.NewInt(1))) msg := types.MsgInstantiateContract{ Sender: c.KeyringAddress(fromIdx).String(), CodeID: storeCode, diff --git a/tests/e2e/e2e_ibc_test.go b/tests/e2e/e2e_ibc_test.go index f41ca7bcac..4c9d943e08 100644 --- a/tests/e2e/e2e_ibc_test.go +++ b/tests/e2e/e2e_ibc_test.go @@ -135,7 +135,7 @@ func (s *E2ETest) TestIBCTokenTransfer() { s.Require().NoError(err) s.Require().True(umeePrice.GT(sdk.MustNewDecFromStr("0.001")), "umee price should be non zero, and expecting higher than 0.001, got: %s", umeePrice) - umeeQuota := sdk.NewCoin(appparams.BondDenom, + umeeQuota := sdk.NewCoin(appparams.BaseDenom, sdk.NewDecFromInt(tokenQuota).Quo(umeePrice).Mul(powerReduction).RoundInt(), ) @@ -159,7 +159,7 @@ func (s *E2ETest) TestIBCTokenTransfer() { sendUmee := mulCoin(umeeQuota, "0.9") s.SendIBC(s.Chain.ID, setup.GaiaChainID, "", sendUmee, false, fmt.Sprintf( "sending %s (less than token quota) ", sendUmee.String())) - s.checkOutflows(umeeAPIEndpoint, appparams.BondDenom, true, sdk.NewDecFromInt(sendUmee.Amount), appparams.Name) + s.checkOutflows(umeeAPIEndpoint, appparams.BaseDenom, true, sdk.NewDecFromInt(sendUmee.Amount), appparams.Name) s.checkSupply(gaiaAPIEndpoint, umeeIBCHash, sendUmee.Amount) // << BELOW TOKEN QUOTA 40$ but ATOM_QUOTA (40$)+ UMEE_QUOTA(90$) >= TOTAL QUOTA (120$) >> @@ -194,12 +194,12 @@ func (s *E2ETest) TestIBCTokenTransfer() { s.T().Logf("waiting until quota reset, basically it will take around 300 seconds to do quota reset") s.Require().Eventually( func() bool { - amount, err := s.QueryOutflows(umeeAPIEndpoint, appparams.BondDenom) + amount, err := s.QueryOutflows(umeeAPIEndpoint, appparams.BaseDenom) if err != nil { return false } if amount.IsZero() { - s.T().Logf("quota is reset : %s is 0", appparams.BondDenom) + s.T().Logf("quota is reset : %s is 0", appparams.BaseDenom) return true } return false @@ -239,7 +239,7 @@ func (s *E2ETest) TestIBCTokenTransfer() { // Check the outflows s.Require().Eventually( func() bool { - a, err := s.QueryOutflows(umeeAPIEndpoint, appparams.BondDenom) + a, err := s.QueryOutflows(umeeAPIEndpoint, appparams.BaseDenom) if err != nil { return false } diff --git a/tests/e2e/e2e_leverage_test.go b/tests/e2e/e2e_leverage_test.go index 26b38229f3..0f490a4d01 100644 --- a/tests/e2e/e2e_leverage_test.go +++ b/tests/e2e/e2e_leverage_test.go @@ -88,7 +88,7 @@ func (s *E2ETest) leverageLeveragedLiquidate(accountIndex, targetIndex int, repa } func (s *E2ETest) TestLeverageBasics() { - umeeNoMedians := fixtures.Token(appparams.BondDenom, "UMEE", 6) + umeeNoMedians := fixtures.Token(appparams.BaseDenom, "UMEE", 6) umeeNoMedians.HistoricMedians = 0 updateTokens := []leveragetypes.Token{ umeeNoMedians, @@ -107,33 +107,33 @@ func (s *E2ETest) TestLeverageBasics() { s.Run( "initial leverage supply", func() { - s.leverageSupply(0, appparams.BondDenom, 100_000_000) + s.leverageSupply(0, appparams.BaseDenom, 100_000_000) }, ) s.Run( "initial leverage withdraw", func() { - s.leverageWithdraw(0, "u/"+appparams.BondDenom, 10_000_000) + s.leverageWithdraw(0, "u/"+appparams.BaseDenom, 10_000_000) }, ) s.Run( "initial leverage collateralize", func() { - s.leverageCollateralize(0, "u/"+appparams.BondDenom, 80_000_000) + s.leverageCollateralize(0, "u/"+appparams.BaseDenom, 80_000_000) }, ) s.Run( "initial leverage borrow", func() { - s.leverageBorrow(0, appparams.BondDenom, 12_000_000) + s.leverageBorrow(0, appparams.BaseDenom, 12_000_000) }, ) s.Run( "initial leverage repay", func() { - s.leverageRepay(0, appparams.BondDenom, 2_000_000) + s.leverageRepay(0, appparams.BaseDenom, 2_000_000) }, ) s.Run( "too high leverage borrow", func() { asset := sdk.NewCoin( - appparams.BondDenom, + appparams.BaseDenom, sdk.NewIntFromUint64(30_000_000), ) s.mustFailTx( @@ -148,8 +148,8 @@ func (s *E2ETest) TestLeverageBasics() { pairs := []leveragetypes.SpecialAssetPair{ { // a set allowing UMEE to borrow more of itself - Borrow: appparams.BondDenom, - Collateral: appparams.BondDenom, + Borrow: appparams.BaseDenom, + Collateral: appparams.BaseDenom, CollateralWeight: sdk.MustNewDecFromStr("0.75"), LiquidationThreshold: sdk.MustNewDecFromStr("0.8"), }, diff --git a/tests/e2e/setup/accounts.go b/tests/e2e/setup/accounts.go index d5a210a7e2..5750776f80 100644 --- a/tests/e2e/setup/accounts.go +++ b/tests/e2e/setup/accounts.go @@ -21,7 +21,7 @@ type testAccount struct { var ( // Initial coins to give to each validator valCoins = sdk.NewCoins( - coin.New(appparams.BondDenom, 1_000000_000000), + coin.New(appparams.BaseDenom, 1_000000_000000), ) // Number of test accounts to initialize in chain.TestAccounts @@ -29,13 +29,13 @@ var ( // Initial coins to give to each test account. testAccountCoins = sdk.NewCoins( - coin.New(appparams.BondDenom, 100000_000000), + coin.New(appparams.BaseDenom, 100000_000000), coin.New(PhotonDenom, 100000_000000), coin.New(mocks.USDTBaseDenom, 100000_000000), ) // initial validator stakes (before delegation from test account 0) - stakeAmountCoin = coin.New(appparams.BondDenom, 1_000000) + stakeAmountCoin = coin.New(appparams.BaseDenom, 1_000000) ) // create a test account, which is an address with a mnemonic stored only in memory, to be used with the network. diff --git a/tests/e2e/setup/setup.go b/tests/e2e/setup/setup.go index a1b8fcf222..b5ec98d1d7 100644 --- a/tests/e2e/setup/setup.go +++ b/tests/e2e/setup/setup.go @@ -215,7 +215,7 @@ func (s *E2ETestSuite) initGenesis() { s.Require().NoError(s.cdc.UnmarshalJSON(appGenState[leveragetypes.ModuleName], &leverageGenState)) leverageGenState.Registry = append(leverageGenState.Registry, - fixtures.Token(appparams.BondDenom, appparams.DisplayDenom, 6), + fixtures.Token(appparams.BaseDenom, appparams.DisplayDenom, 6), fixtures.Token(ATOMBaseDenom, ATOM, uint32(ATOMExponent)), ) @@ -248,7 +248,7 @@ func (s *E2ETestSuite) initGenesis() { votingPeriod := 5 * time.Second govGenState.Params.VotingPeriod = &votingPeriod - govGenState.Params.MinDeposit = sdk.NewCoins(sdk.NewCoin(appparams.BondDenom, sdk.NewInt(100))) + govGenState.Params.MinDeposit = sdk.NewCoins(sdk.NewCoin(appparams.BaseDenom, sdk.NewInt(100))) bz, err = s.cdc.MarshalJSON(&govGenState) s.Require().NoError(err) diff --git a/tests/e2e/setup/utils.go b/tests/e2e/setup/utils.go index 1ede526653..41f4455cec 100644 --- a/tests/e2e/setup/utils.go +++ b/tests/e2e/setup/utils.go @@ -50,7 +50,7 @@ func (s *E2ETestSuite) Delegate(testAccount, valIndex int, amount uint64) error } valOperAddr := sdk.ValAddress(valAddr) - asset := sdk.NewCoin(appparams.BondDenom, sdk.NewIntFromUint64(amount)) + asset := sdk.NewCoin(appparams.BaseDenom, sdk.NewIntFromUint64(amount)) msg := stakingtypes.NewMsgDelegate(addr, valOperAddr, asset) return s.BroadcastTxWithRetry(msg, s.AccountClient(testAccount)) } diff --git a/util/coin/fixtures.go b/util/coin/fixtures.go index ac02855dff..f831c8be76 100644 --- a/util/coin/fixtures.go +++ b/util/coin/fixtures.go @@ -6,7 +6,7 @@ import ( appparams "github.com/umee-network/umee/v6/app/params" ) -const umee = appparams.BondDenom +const umee = appparams.BaseDenom // common coins used in tests var ( @@ -44,7 +44,7 @@ func UmeeCoins(amount int64) sdk.Coins { // UmeeDec creates a Umee (uumee) DecCoin with given amount func UmeeDec(amount string) sdk.DecCoin { - return Dec(appparams.BondDenom, amount) + return Dec(appparams.BaseDenom, amount) } // Utoken creates a uToken Coin. diff --git a/x/incentive/client/tests/tests.go b/x/incentive/client/tests/tests.go index faa1a2ac70..b0f4f28ebe 100644 --- a/x/incentive/client/tests/tests.go +++ b/x/incentive/client/tests/tests.go @@ -105,7 +105,7 @@ func (s *IntegrationTests) TestIncentiveScenario() { Name: "query total bonded - specific denom", Command: cli.QueryTotalBonded(), Args: []string{ - "u/" + appparams.BondDenom, + "u/" + appparams.BaseDenom, }, Response: &incentive.QueryTotalBondedResponse{}, ExpectedResponse: &incentive.QueryTotalBondedResponse{ @@ -125,7 +125,7 @@ func (s *IntegrationTests) TestIncentiveScenario() { Name: "query total unbonding - specific denom", Command: cli.QueryTotalUnbonding(), Args: []string{ - "u/" + appparams.BondDenom, + "u/" + appparams.BaseDenom, }, Response: &incentive.QueryTotalUnbondingResponse{}, ExpectedResponse: &incentive.QueryTotalUnbondingResponse{ @@ -136,11 +136,11 @@ func (s *IntegrationTests) TestIncentiveScenario() { Name: "query current rates (zero)", Command: cli.QueryCurrentRates(), Args: []string{ - "u/" + appparams.BondDenom, + "u/" + appparams.BaseDenom, }, Response: &incentive.QueryCurrentRatesResponse{}, ExpectedResponse: &incentive.QueryCurrentRatesResponse{ - ReferenceBond: sdk.NewInt64Coin("u/"+appparams.BondDenom, 1), + ReferenceBond: sdk.NewInt64Coin("u/"+appparams.BaseDenom, 1), Rewards: sdk.NewCoins(), }, ErrMsg: "", @@ -149,7 +149,7 @@ func (s *IntegrationTests) TestIncentiveScenario() { Name: "query actual rates (zero)", Command: cli.QueryActualRates(), Args: []string{ - "u/" + appparams.BondDenom, + "u/" + appparams.BaseDenom, }, Response: &incentive.QueryActualRatesResponse{}, ExpectedResponse: &incentive.QueryActualRatesResponse{ diff --git a/x/leverage/client/tests/tests.go b/x/leverage/client/tests/tests.go index 1420923060..b5c6280844 100644 --- a/x/leverage/client/tests/tests.go +++ b/x/leverage/client/tests/tests.go @@ -91,7 +91,7 @@ func (s *IntegrationTests) TestLeverageScenario() { Response: &types.QueryRegisteredTokensResponse{}, ExpectedResponse: &types.QueryRegisteredTokensResponse{ Registry: []types.Token{ - fixtures.Token(appparams.BondDenom, appparams.DisplayDenom, 6), + fixtures.Token(appparams.BaseDenom, appparams.DisplayDenom, 6), }, }, ErrMsg: "", @@ -109,11 +109,11 @@ func (s *IntegrationTests) TestLeverageScenario() { { Name: "query registered token info by base_denom", Command: cli.QueryRegisteredTokens(), - Args: []string{appparams.BondDenom}, + Args: []string{appparams.BaseDenom}, Response: &types.QueryRegisteredTokensResponse{}, ExpectedResponse: &types.QueryRegisteredTokensResponse{ Registry: []types.Token{ - fixtures.Token(appparams.BondDenom, appparams.DisplayDenom, 6), + fixtures.Token(appparams.BaseDenom, appparams.DisplayDenom, 6), }, }, ErrMsg: "", @@ -122,7 +122,7 @@ func (s *IntegrationTests) TestLeverageScenario() { Name: "query market summary - zero supply", Command: cli.QueryMarketSummary(), Args: []string{ - appparams.BondDenom, + appparams.BaseDenom, }, Response: &types.QueryMarketSummaryResponse{}, ExpectedResponse: &types.QueryMarketSummaryResponse{ @@ -306,13 +306,13 @@ func (s *IntegrationTests) TestLeverageScenario() { Response: &types.QueryAccountBalancesResponse{}, ExpectedResponse: &types.QueryAccountBalancesResponse{ Supplied: sdk.NewCoins( - sdk.NewInt64Coin(appparams.BondDenom, 1001), + sdk.NewInt64Coin(appparams.BaseDenom, 1001), ), Collateral: sdk.NewCoins( - sdk.NewInt64Coin(coin.ToUTokenDenom(appparams.BondDenom), 1000), + sdk.NewInt64Coin(coin.ToUTokenDenom(appparams.BaseDenom), 1000), ), Borrowed: sdk.NewCoins( - sdk.NewInt64Coin(appparams.BondDenom, 251), + sdk.NewInt64Coin(appparams.BaseDenom, 251), ), }, ErrMsg: "", @@ -383,10 +383,10 @@ func (s *IntegrationTests) TestLeverageScenario() { Response: &types.QueryAccountBalancesResponse{}, ExpectedResponse: &types.QueryAccountBalancesResponse{ Supplied: sdk.NewCoins( - sdk.NewInt64Coin(appparams.BondDenom, 201), // slightly increased uToken exchange rate + sdk.NewInt64Coin(appparams.BaseDenom, 201), // slightly increased uToken exchange rate ), Collateral: sdk.NewCoins( - sdk.NewInt64Coin(coin.ToUTokenDenom(appparams.BondDenom), 100), + sdk.NewInt64Coin(coin.ToUTokenDenom(appparams.BaseDenom), 100), ), Borrowed: sdk.NewCoins(), }, diff --git a/x/leverage/keeper/exchange_rate_test.go b/x/leverage/keeper/exchange_rate_test.go index 7f828fd45e..8608a2e4c2 100644 --- a/x/leverage/keeper/exchange_rate_test.go +++ b/x/leverage/keeper/exchange_rate_test.go @@ -28,6 +28,6 @@ func (s *IntegrationTestSuite) TestDeriveExchangeRate() { // = 2.7 // get derived exchange rate - rate := app.LeverageKeeper.DeriveExchangeRate(ctx, appparams.BondDenom) + rate := app.LeverageKeeper.DeriveExchangeRate(ctx, appparams.BaseDenom) require.Equal(sdk.MustNewDecFromStr("2.7"), rate) } diff --git a/x/leverage/keeper/grpc_query_test.go b/x/leverage/keeper/grpc_query_test.go index 41057ba60c..b04241575a 100644 --- a/x/leverage/keeper/grpc_query_test.go +++ b/x/leverage/keeper/grpc_query_test.go @@ -30,7 +30,7 @@ func (s *IntegrationTestSuite) TestQuerier_RegisteredTokens() { { "valid: get the registered token info by base_denom", "", - types.QueryRegisteredTokens{BaseDenom: appparams.BondDenom}, + types.QueryRegisteredTokens{BaseDenom: appparams.BaseDenom}, 1, }, { diff --git a/x/leverage/keeper/interest_test.go b/x/leverage/keeper/interest_test.go index e02fedcda0..9921a9692e 100644 --- a/x/leverage/keeper/interest_test.go +++ b/x/leverage/keeper/interest_test.go @@ -16,11 +16,11 @@ func (s *IntegrationTestSuite) TestAccrueZeroInterest() { s.collateralize(addr, coin.New("u/"+umeeDenom, 1000_000000)) // user borrows 40 umee - s.borrow(addr, coin.New(appparams.BondDenom, 40_000000)) + s.borrow(addr, coin.New(appparams.BaseDenom, 40_000000)) // verify user's loan amount (40 umee) - loanBalance := app.LeverageKeeper.GetBorrow(ctx, addr, appparams.BondDenom) - require.Equal(coin.New(appparams.BondDenom, 40_000000), loanBalance) + loanBalance := app.LeverageKeeper.GetBorrow(ctx, addr, appparams.BaseDenom) + require.Equal(coin.New(appparams.BaseDenom, 40_000000), loanBalance) // Because no time has passed since genesis (due to test setup) this will not // increase borrowed amount. @@ -28,18 +28,18 @@ func (s *IntegrationTestSuite) TestAccrueZeroInterest() { require.NoError(err) // verify user's loan amount (40 umee) - loanBalance = app.LeverageKeeper.GetBorrow(ctx, addr, appparams.BondDenom) - require.Equal(coin.New(appparams.BondDenom, 40_000000), loanBalance) + loanBalance = app.LeverageKeeper.GetBorrow(ctx, addr, appparams.BaseDenom) + require.Equal(coin.New(appparams.BaseDenom, 40_000000), loanBalance) // borrow APY at utilization = 4% // when kink utilization = 80%, and base/kink APY are 0.02 and 0.22 - borrowAPY := app.LeverageKeeper.DeriveBorrowAPY(ctx, appparams.BondDenom) + borrowAPY := app.LeverageKeeper.DeriveBorrowAPY(ctx, appparams.BaseDenom) require.Equal(sdk.MustNewDecFromStr("0.03"), borrowAPY) // supply APY when borrow APY is 3% // and utilization is 4%, and reservefactor is 20%, and OracleRewardFactor is 1% // 0.03 * 0.04 * (1 - 0.21) = 0.000948 - supplyAPY := app.LeverageKeeper.DeriveSupplyAPY(ctx, appparams.BondDenom) + supplyAPY := app.LeverageKeeper.DeriveSupplyAPY(ctx, appparams.BaseDenom) require.Equal(sdk.MustNewDecFromStr("0.000948"), supplyAPY) } @@ -52,35 +52,35 @@ func (s *IntegrationTestSuite) TestDynamicInterest() { s.collateralize(addr, coin.New("u/"+umeeDenom, 1000_000000)) // Base interest rate (0% utilization) - rate := app.LeverageKeeper.DeriveBorrowAPY(ctx, appparams.BondDenom) + rate := app.LeverageKeeper.DeriveBorrowAPY(ctx, appparams.BaseDenom) require.Equal(sdk.MustNewDecFromStr("0.02"), rate) // user borrows 200 umee, utilization 200/1000 - s.borrow(addr, coin.New(appparams.BondDenom, 200_000000)) + s.borrow(addr, coin.New(appparams.BaseDenom, 200_000000)) // Between base interest and kink (20% utilization) - rate = app.LeverageKeeper.DeriveBorrowAPY(ctx, appparams.BondDenom) + rate = app.LeverageKeeper.DeriveBorrowAPY(ctx, appparams.BaseDenom) require.Equal(sdk.MustNewDecFromStr("0.07"), rate) // user borrows 600 more umee (ignores collateral), utilization 800/1000 - s.forceBorrow(addr, coin.New(appparams.BondDenom, 600_000000)) + s.forceBorrow(addr, coin.New(appparams.BaseDenom, 600_000000)) // Kink interest rate (80% utilization) - rate = app.LeverageKeeper.DeriveBorrowAPY(ctx, appparams.BondDenom) + rate = app.LeverageKeeper.DeriveBorrowAPY(ctx, appparams.BaseDenom) require.Equal(sdk.MustNewDecFromStr("0.22"), rate) // user borrows 100 more umee (ignores collateral), utilization 900/1000 - s.forceBorrow(addr, coin.New(appparams.BondDenom, 100_000000)) + s.forceBorrow(addr, coin.New(appparams.BaseDenom, 100_000000)) // Between kink interest and max (90% utilization) - rate = app.LeverageKeeper.DeriveBorrowAPY(ctx, appparams.BondDenom) + rate = app.LeverageKeeper.DeriveBorrowAPY(ctx, appparams.BaseDenom) require.Equal(sdk.MustNewDecFromStr("0.87"), rate) // user borrows 100 more umee (ignores collateral), utilization 1000/1000 - s.forceBorrow(addr, coin.New(appparams.BondDenom, 100_000000)) + s.forceBorrow(addr, coin.New(appparams.BaseDenom, 100_000000)) // Max interest rate (100% utilization) - rate = app.LeverageKeeper.DeriveBorrowAPY(ctx, appparams.BondDenom) + rate = app.LeverageKeeper.DeriveBorrowAPY(ctx, appparams.BaseDenom) require.Equal(sdk.MustNewDecFromStr("1.52"), rate) } diff --git a/x/leverage/keeper/invariants_test.go b/x/leverage/keeper/invariants_test.go index 9ab878b9e6..e0e23219a5 100644 --- a/x/leverage/keeper/invariants_test.go +++ b/x/leverage/keeper/invariants_test.go @@ -10,7 +10,7 @@ func (s *IntegrationTestSuite) TestReserveAmountInvariant() { app, ctx, require := s.app, s.ctx, s.Require() // artificially set reserves - s.setReserves(coin.New(appparams.BondDenom, 300_000000)) + s.setReserves(coin.New(appparams.BaseDenom, 300_000000)) // check invariants _, broken := keeper.ReserveAmountInvariant(app.LeverageKeeper)(ctx) @@ -29,7 +29,7 @@ func (s *IntegrationTestSuite) TestCollateralAmountInvariant() { _, broken := keeper.InefficientCollateralAmountInvariant(app.LeverageKeeper)(ctx) require.False(broken) - uTokenDenom := coin.ToUTokenDenom(appparams.BondDenom) + uTokenDenom := coin.ToUTokenDenom(appparams.BaseDenom) // withdraw the supplied umee in the initBorrowScenario s.withdraw(addr, coin.New(uTokenDenom, 1000_000000)) @@ -48,7 +48,7 @@ func (s *IntegrationTestSuite) TestBorrowAmountInvariant() { s.collateralize(addr, coin.New("u/"+umeeDenom, 1000_000000)) // user borrows 20 umee - s.borrow(addr, coin.New(appparams.BondDenom, 20_000000)) + s.borrow(addr, coin.New(appparams.BaseDenom, 20_000000)) // check invariant _, broken := keeper.InefficientBorrowAmountInvariant(app.LeverageKeeper)(ctx) @@ -56,7 +56,7 @@ func (s *IntegrationTestSuite) TestBorrowAmountInvariant() { // user repays 30 umee, actually only 20 because is the min between // the amount borrowed and the amount repaid - _, err := app.LeverageKeeper.Repay(ctx, addr, coin.New(appparams.BondDenom, 30_000000)) + _, err := app.LeverageKeeper.Repay(ctx, addr, coin.New(appparams.BaseDenom, 30_000000)) require.NoError(err) // check invariant diff --git a/x/leverage/keeper/oracle_test.go b/x/leverage/keeper/oracle_test.go index 7383f3b560..99433cc76b 100644 --- a/x/leverage/keeper/oracle_test.go +++ b/x/leverage/keeper/oracle_test.go @@ -94,7 +94,7 @@ func (m *mockOracleKeeper) Reset() { func (s *IntegrationTestSuite) TestOracle_TokenPrice() { app, ctx, require := s.app, s.ctx, s.Require() - p, e, err := app.LeverageKeeper.TokenPrice(ctx, appparams.BondDenom, types.PriceModeSpot) + p, e, err := app.LeverageKeeper.TokenPrice(ctx, appparams.BaseDenom, types.PriceModeSpot) require.NoError(err) require.Equal(sdk.MustNewDecFromStr("4.21"), p) require.Equal(uint32(6), e) @@ -121,7 +121,7 @@ func (s *IntegrationTestSuite) TestOracle_TokenPrice() { // Now with historic = true - p, e, err = app.LeverageKeeper.TokenPrice(ctx, appparams.BondDenom, types.PriceModeHistoric) + p, e, err = app.LeverageKeeper.TokenPrice(ctx, appparams.BaseDenom, types.PriceModeHistoric) require.NoError(err) require.Equal(sdk.MustNewDecFromStr("4.21"), p) require.Equal(uint32(6), e) @@ -179,7 +179,7 @@ func (s *IntegrationTestSuite) TestOracle_TokenValue() { app, ctx, require := s.app, s.ctx, s.Require() // 2.4 UMEE * $4.21 - v, err := app.LeverageKeeper.TokenValue(ctx, coin.New(appparams.BondDenom, 2_400000), types.PriceModeSpot) + v, err := app.LeverageKeeper.TokenValue(ctx, coin.New(appparams.BaseDenom, 2_400000), types.PriceModeSpot) require.NoError(err) require.Equal(sdk.MustNewDecFromStr("10.104"), v) @@ -200,7 +200,7 @@ func (s *IntegrationTestSuite) TestOracle_TokenValue() { // Now with historic = true // 2.4 UMEE * $4.21 - v, err = app.LeverageKeeper.TokenValue(ctx, coin.New(appparams.BondDenom, 2_400000), types.PriceModeHistoric) + v, err = app.LeverageKeeper.TokenValue(ctx, coin.New(appparams.BaseDenom, 2_400000), types.PriceModeHistoric) require.NoError(err) require.Equal(sdk.MustNewDecFromStr("10.104"), v) @@ -253,7 +253,7 @@ func (s *IntegrationTestSuite) TestOracle_TotalTokenValue() { v, err := app.LeverageKeeper.TotalTokenValue( ctx, sdk.NewCoins( - coin.New(appparams.BondDenom, 2_400000), + coin.New(appparams.BaseDenom, 2_400000), coin.New(atomDenom, 4_700000), ), types.PriceModeSpot, @@ -265,7 +265,7 @@ func (s *IntegrationTestSuite) TestOracle_TotalTokenValue() { v, err = app.LeverageKeeper.TotalTokenValue( ctx, sdk.NewCoins( - coin.New(appparams.BondDenom, 2_400000), + coin.New(appparams.BaseDenom, 2_400000), coin.New(atomDenom, 4_700000), coin.New("foo", 4_700000), ), @@ -278,7 +278,7 @@ func (s *IntegrationTestSuite) TestOracle_TotalTokenValue() { v, err = app.LeverageKeeper.TotalTokenValue( ctx, sdk.NewCoins( - coin.New(appparams.BondDenom, 2_400000), + coin.New(appparams.BaseDenom, 2_400000), coin.New(atomDenom, 4_700000), coin.New("foo", 4_700000), coin.New(dumpDenom, 2_000000), @@ -316,17 +316,17 @@ func (s *IntegrationTestSuite) TestOracle_TotalTokenValue() { func (s *IntegrationTestSuite) TestOracle_PriceRatio() { app, ctx, require := s.app, s.ctx, s.Require() - r, err := app.LeverageKeeper.PriceRatio(ctx, appparams.BondDenom, atomDenom, types.PriceModeSpot) + r, err := app.LeverageKeeper.PriceRatio(ctx, appparams.BaseDenom, atomDenom, types.PriceModeSpot) require.NoError(err) // $4.21 / $39.38 at same exponent require.Equal(sdk.MustNewDecFromStr("0.106907059421025901"), r) - r, err = app.LeverageKeeper.PriceRatio(ctx, appparams.BondDenom, daiDenom, types.PriceModeSpot) + r, err = app.LeverageKeeper.PriceRatio(ctx, appparams.BaseDenom, daiDenom, types.PriceModeSpot) require.NoError(err) // $4.21 / $1.00 at a difference of 12 exponent require.Equal(sdk.MustNewDecFromStr("4210000000000"), r) - r, err = app.LeverageKeeper.PriceRatio(ctx, daiDenom, appparams.BondDenom, types.PriceModeSpot) + r, err = app.LeverageKeeper.PriceRatio(ctx, daiDenom, appparams.BaseDenom, types.PriceModeSpot) require.NoError(err) // $1.00 / $4.21 at a difference of -12 exponent require.Equal(sdk.MustNewDecFromStr("0.000000000000237530"), r) @@ -334,7 +334,7 @@ func (s *IntegrationTestSuite) TestOracle_PriceRatio() { _, err = app.LeverageKeeper.PriceRatio(ctx, "foo", atomDenom, types.PriceModeSpot) require.ErrorIs(err, types.ErrNotRegisteredToken) - _, err = app.LeverageKeeper.PriceRatio(ctx, appparams.BondDenom, "foo", types.PriceModeSpot) + _, err = app.LeverageKeeper.PriceRatio(ctx, appparams.BaseDenom, "foo", types.PriceModeSpot) require.ErrorIs(err, types.ErrNotRegisteredToken) // current price of volatile assets diff --git a/x/leverage/keeper/reserves_test.go b/x/leverage/keeper/reserves_test.go index fff545d720..03dfeaa5eb 100644 --- a/x/leverage/keeper/reserves_test.go +++ b/x/leverage/keeper/reserves_test.go @@ -15,7 +15,7 @@ func (s *IntegrationTestSuite) TestSetReserves() { // artificially reserve 200 umee s.setReserves(coin.New(umeeDenom, 200_000000)) // get new reserves - reserves = app.LeverageKeeper.GetReserves(ctx, appparams.BondDenom) + reserves = app.LeverageKeeper.GetReserves(ctx, appparams.BaseDenom) require.Equal(coin.New(umeeDenom, 200_000000), reserves) } diff --git a/x/leverage/keeper/suite_test.go b/x/leverage/keeper/suite_test.go index 1101b000fa..b5beea2d57 100644 --- a/x/leverage/keeper/suite_test.go +++ b/x/leverage/keeper/suite_test.go @@ -22,7 +22,7 @@ import ( ) const ( - umeeDenom = appparams.BondDenom + umeeDenom = appparams.BaseDenom atomDenom = fixtures.AtomDenom daiDenom = fixtures.DaiDenom pumpDenom = "upump" @@ -80,7 +80,7 @@ func (s *IntegrationTestSuite) SetupTest() { // override DefaultGenesis token registry with fixtures.Token leverage.InitGenesis(ctx, app.LeverageKeeper, *types.DefaultGenesis()) - require.NoError(app.LeverageKeeper.SetTokenSettings(ctx, newToken(appparams.BondDenom, "UMEE", 6))) + require.NoError(app.LeverageKeeper.SetTokenSettings(ctx, newToken(appparams.BaseDenom, "UMEE", 6))) require.NoError(app.LeverageKeeper.SetTokenSettings(ctx, newToken(atomDenom, "ATOM", 6))) daiToken := newToken(daiDenom, "DAI", 18) // high exponent token will need bigger maxSupply for testing daiToken.MaxSupply = daiToken.MaxSupply.Mul(sdk.NewInt(1_000_000_000_000)) diff --git a/x/leverage/simulation/operations_test.go b/x/leverage/simulation/operations_test.go index 9793a1bcf7..a2557f2b1b 100644 --- a/x/leverage/simulation/operations_test.go +++ b/x/leverage/simulation/operations_test.go @@ -142,7 +142,7 @@ func (s *SimTestSuite) TestSimulateMsgSupply() { func (s *SimTestSuite) TestSimulateMsgWithdraw() { r := rand.New(rand.NewSource(1)) - supplyToken := sdk.NewCoin(appparams.BondDenom, sdk.NewInt(10_000000)) + supplyToken := sdk.NewCoin(appparams.BaseDenom, sdk.NewInt(10_000000)) accs := s.getTestingAccounts(r, 3, func(fundedAccount simtypes.Account) { _, err := s.app.LeverageKeeper.Supply(s.ctx, fundedAccount.Address, supplyToken) @@ -165,7 +165,7 @@ func (s *SimTestSuite) TestSimulateMsgWithdraw() { func (s *SimTestSuite) TestSimulateMsgBorrow() { r := rand.New(rand.NewSource(8)) - supplyToken := sdk.NewCoin(appparams.BondDenom, sdk.NewInt(10_000000)) + supplyToken := sdk.NewCoin(appparams.BaseDenom, sdk.NewInt(10_000000)) accs := s.getTestingAccounts(r, 3, func(fundedAccount simtypes.Account) { uToken, err := s.app.LeverageKeeper.Supply(s.ctx, fundedAccount.Address, supplyToken) @@ -190,7 +190,7 @@ func (s *SimTestSuite) TestSimulateMsgBorrow() { func (s *SimTestSuite) TestSimulateMsgCollateralize() { r := rand.New(rand.NewSource(1)) - supplyToken := sdk.NewInt64Coin(appparams.BondDenom, 10_000000) + supplyToken := sdk.NewInt64Coin(appparams.BaseDenom, 10_000000) accs := s.getTestingAccounts(r, 3, func(fundedAccount simtypes.Account) { _, err := s.app.LeverageKeeper.Supply(s.ctx, fundedAccount.Address, supplyToken) @@ -212,7 +212,7 @@ func (s *SimTestSuite) TestSimulateMsgCollateralize() { func (s *SimTestSuite) TestSimulateMsgDecollateralize() { r := rand.New(rand.NewSource(1)) - supplyToken := sdk.NewInt64Coin(appparams.BondDenom, 10_000000) + supplyToken := sdk.NewInt64Coin(appparams.BaseDenom, 10_000000) accs := s.getTestingAccounts(r, 3, func(fundedAccount simtypes.Account) { uToken, err := s.app.LeverageKeeper.Supply(s.ctx, fundedAccount.Address, supplyToken) @@ -235,8 +235,8 @@ func (s *SimTestSuite) TestSimulateMsgDecollateralize() { func (s *SimTestSuite) TestSimulateMsgRepay() { r := rand.New(rand.NewSource(1)) - supplyToken := sdk.NewInt64Coin(appparams.BondDenom, 10_000000) - borrowToken := sdk.NewInt64Coin(appparams.BondDenom, 1_000000) + supplyToken := sdk.NewInt64Coin(appparams.BaseDenom, 10_000000) + borrowToken := sdk.NewInt64Coin(appparams.BaseDenom, 1_000000) accs := s.getTestingAccounts(r, 3, func(fundedAccount simtypes.Account) { uToken, err := s.app.LeverageKeeper.Supply(s.ctx, fundedAccount.Address, supplyToken) @@ -260,9 +260,9 @@ func (s *SimTestSuite) TestSimulateMsgRepay() { func (s *SimTestSuite) TestSimulateMsgLiquidate() { r := rand.New(rand.NewSource(1)) - supplyToken := sdk.NewCoin(appparams.BondDenom, sdk.NewInt(10_000000)) - uToken := sdk.NewCoin("u/"+appparams.BondDenom, sdk.NewInt(10_000000)) - borrowToken := sdk.NewCoin(appparams.BondDenom, sdk.NewInt(1_000000)) + supplyToken := sdk.NewCoin(appparams.BaseDenom, sdk.NewInt(10_000000)) + uToken := sdk.NewCoin("u/"+appparams.BaseDenom, sdk.NewInt(10_000000)) + borrowToken := sdk.NewCoin(appparams.BaseDenom, sdk.NewInt(1_000000)) accs := s.getTestingAccounts(r, 3, func(fundedAccount simtypes.Account) { _, err := s.app.LeverageKeeper.Supply(s.ctx, fundedAccount.Address, supplyToken) diff --git a/x/leverage/types/keys_test.go b/x/leverage/types/keys_test.go index 5fee44e9ac..9bcacced30 100644 --- a/x/leverage/types/keys_test.go +++ b/x/leverage/types/keys_test.go @@ -13,7 +13,7 @@ import ( func TestAddressFromKey(t *testing.T) { address := sdk.AccAddress([]byte("addr________________")) - key := types.KeyAdjustedBorrow(address, appparams.BondDenom) + key := types.KeyAdjustedBorrow(address, appparams.BaseDenom) expectedAddress := types.AddressFromKey(key, types.KeyPrefixAdjustedBorrow) assert.DeepEqual(t, address, expectedAddress) @@ -27,7 +27,7 @@ func TestAddressFromKey(t *testing.T) { func TestDenomFromKeyWithAddress(t *testing.T) { address := sdk.AccAddress([]byte("addr________________")) - denom := appparams.BondDenom + denom := appparams.BaseDenom key := types.KeyAdjustedBorrow(address, denom) expectedDenom := types.DenomFromKeyWithAddress(key, types.KeyPrefixAdjustedBorrow) @@ -41,7 +41,7 @@ func TestDenomFromKeyWithAddress(t *testing.T) { } func TestDenomFromKey(t *testing.T) { - denom := appparams.BondDenom + denom := appparams.BaseDenom key := types.KeyReserveAmount(denom) expectedDenom := types.DenomFromKey(key, types.KeyPrefixReserveAmount) diff --git a/x/leverage/types/token.go b/x/leverage/types/token.go index 3959efddd2..96de4076b0 100644 --- a/x/leverage/types/token.go +++ b/x/leverage/types/token.go @@ -139,7 +139,7 @@ func (t Token) BorrowFactor() sdk.Dec { func defaultUmeeToken() Token { return Token{ - BaseDenom: appparams.BondDenom, + BaseDenom: appparams.BaseDenom, SymbolDenom: "UMEE", Exponent: 6, EnableMsgSupply: true, diff --git a/x/oracle/abci_test.go b/x/oracle/abci_test.go index d9b07fcc84..9529f8afb2 100644 --- a/x/oracle/abci_test.go +++ b/x/oracle/abci_test.go @@ -25,7 +25,7 @@ import ( const ( displayDenom string = appparams.DisplayDenom - bondDenom string = appparams.BondDenom + bondDenom string = appparams.BaseDenom ) type IntegrationTestSuite struct { diff --git a/x/oracle/keeper/hooks_test.go b/x/oracle/keeper/hooks_test.go index 514704685c..f534a556bf 100644 --- a/x/oracle/keeper/hooks_test.go +++ b/x/oracle/keeper/hooks_test.go @@ -11,7 +11,7 @@ func (s *IntegrationTestSuite) TestHooks_AfterTokenRegistered() { // require that an existing token does not change the accept list h.AfterTokenRegistered(s.ctx, leveragetypes.Token{ - BaseDenom: appparams.BondDenom, + BaseDenom: appparams.BaseDenom, SymbolDenom: appparams.DisplayDenom, Exponent: 6, }) diff --git a/x/oracle/keeper/keeper_test.go b/x/oracle/keeper/keeper_test.go index e8ce168892..f7f8d26d69 100644 --- a/x/oracle/keeper/keeper_test.go +++ b/x/oracle/keeper/keeper_test.go @@ -29,7 +29,7 @@ import ( const ( displayDenom string = appparams.DisplayDenom - bondDenom string = appparams.BondDenom + bondDenom string = appparams.BaseDenom initialPower = int64(10000000000) ) @@ -48,7 +48,7 @@ var ( valAddr2 = sdk.ValAddress(pubKey2.Address()) initTokens = sdk.TokensFromConsensusPower(initialPower, sdk.DefaultPowerReduction) - initCoins = sdk.NewCoins(sdk.NewCoin(appparams.BondDenom, initTokens)) + initCoins = sdk.NewCoins(sdk.NewCoin(appparams.BaseDenom, initTokens)) ) type IntegrationTestSuite struct { diff --git a/x/oracle/types/asset.go b/x/oracle/types/asset.go index 526e143bf2..4616b7280b 100644 --- a/x/oracle/types/asset.go +++ b/x/oracle/types/asset.go @@ -7,7 +7,7 @@ import ( ) const ( - UmeeDenom = appparams.BondDenom + UmeeDenom = appparams.BaseDenom UmeeSymbol = "umee" UmeeExponent = uint32(6) USDDenom = "USD" diff --git a/x/oracle/types/keys_test.go b/x/oracle/types/keys_test.go index e2f0c527c6..9a4eb046b7 100644 --- a/x/oracle/types/keys_test.go +++ b/x/oracle/types/keys_test.go @@ -17,7 +17,7 @@ func TestKeyExchangeRate(t *testing.T) { }{ { // converts uumee to UUMEE - denom: appparams.BondDenom, + denom: appparams.BaseDenom, expectedKey: []byte{0x1, 0x55, 0x55, 0x4d, 0x45, 0x45, 0x0}, }, { diff --git a/x/ugov/inflation_params.go b/x/ugov/inflation_params.go index 34eb057ccc..a9861134cd 100644 --- a/x/ugov/inflation_params.go +++ b/x/ugov/inflation_params.go @@ -12,7 +12,7 @@ import ( func DefaultInflationParams() InflationParams { return InflationParams{ - MaxSupply: coin.New(appparams.BondDenom, 21_000_000_000_000000), // 21 Billion Maximum + MaxSupply: coin.New(appparams.BaseDenom, 21_000_000_000_000000), // 21 Billion Maximum InflationCycle: time.Hour * 24 * 365 * 2, // 2 years for default inflation cycle InflationReductionRate: bpmath.FixedBP(2500), // 25% reduction rate for inflation cyle } diff --git a/x/ugov/keeper/params_test.go b/x/ugov/keeper/params_test.go index 90d412ddb9..0423040dfe 100644 --- a/x/ugov/keeper/params_test.go +++ b/x/ugov/keeper/params_test.go @@ -50,7 +50,7 @@ func TestLiquidationParams(t *testing.T) { k.SetInflationParams(dip) p := k.InflationParams() require.Equal(dip, p) - require.Equal(dip.MaxSupply.GetDenom(), appparams.BondDenom) + require.Equal(dip.MaxSupply.GetDenom(), appparams.BaseDenom) } func TestInflationCycleEnd(t *testing.T) { diff --git a/x/uibc/quota/keeper/intest/suite_test.go b/x/uibc/quota/keeper/intest/suite_test.go index a9612ac3d1..9fe526112e 100644 --- a/x/uibc/quota/keeper/intest/suite_test.go +++ b/x/uibc/quota/keeper/intest/suite_test.go @@ -29,7 +29,7 @@ import ( const ( displayDenom string = appparams.DisplayDenom - bondDenom string = appparams.BondDenom + bondDenom string = appparams.BaseDenom initialPower = int64(10000000000) ) @@ -48,7 +48,7 @@ var ( valAddr2 = sdk.ValAddress(pubKey2.Address()) initTokens = sdk.TokensFromConsensusPower(initialPower, sdk.DefaultPowerReduction) - initCoins = sdk.NewCoins(sdk.NewCoin(appparams.BondDenom, initTokens)) + initCoins = sdk.NewCoins(sdk.NewCoin(appparams.BaseDenom, initTokens)) sampleOutflow = sdk.NewDecCoin("utest", sdk.NewInt(1111)) ) From 06762bd7d9e59a19147889a72cb02db764dc5654 Mon Sep 17 00:00:00 2001 From: Robert Zaremba Date: Fri, 17 Nov 2023 22:03:25 +0100 Subject: [PATCH 04/21] Revert "use new token BaseName and introduce IBCBaseName" This reverts commit bfc47d264b33517995dd85d012a1d742b84a91ca. --- app/inflation/inflation_test.go | 4 +-- app/modules.go | 14 +++++------ app/params/app_settings.go | 10 +++----- app/test_helpers.go | 12 ++++----- app/wasm/test/cw20_base_test.go | 4 +-- app/wasm/test/umee_cw_test.go | 16 ++++++------ sdkclient/tx/wasm.go | 2 +- tests/e2e/e2e_ibc_test.go | 10 ++++---- tests/e2e/e2e_leverage_test.go | 18 ++++++------- tests/e2e/setup/accounts.go | 6 ++--- tests/e2e/setup/setup.go | 4 +-- tests/e2e/setup/utils.go | 2 +- util/coin/fixtures.go | 4 +-- x/incentive/client/tests/tests.go | 10 ++++---- x/leverage/client/tests/tests.go | 18 ++++++------- x/leverage/keeper/exchange_rate_test.go | 2 +- x/leverage/keeper/grpc_query_test.go | 2 +- x/leverage/keeper/interest_test.go | 32 ++++++++++++------------ x/leverage/keeper/invariants_test.go | 8 +++--- x/leverage/keeper/oracle_test.go | 22 ++++++++-------- x/leverage/keeper/reserves_test.go | 2 +- x/leverage/keeper/suite_test.go | 4 +-- x/leverage/simulation/operations_test.go | 18 ++++++------- x/leverage/types/keys_test.go | 6 ++--- x/leverage/types/token.go | 2 +- x/oracle/abci_test.go | 2 +- x/oracle/keeper/hooks_test.go | 2 +- x/oracle/keeper/keeper_test.go | 4 +-- x/oracle/types/asset.go | 2 +- x/oracle/types/keys_test.go | 2 +- x/ugov/inflation_params.go | 2 +- x/ugov/keeper/params_test.go | 2 +- x/uibc/quota/keeper/intest/suite_test.go | 4 +-- 33 files changed, 125 insertions(+), 127 deletions(-) diff --git a/app/inflation/inflation_test.go b/app/inflation/inflation_test.go index 5b068fe189..2d08de0f36 100644 --- a/app/inflation/inflation_test.go +++ b/app/inflation/inflation_test.go @@ -81,7 +81,7 @@ func TestInflationRate(t *testing.T) { mintParams := minttypes.DefaultParams() mockMinter := minttypes.NewMinter(sdk.MustNewDecFromStr("0.15"), sdk.NewDec(0)) mockInflationParams := ugov.InflationParams{ - MaxSupply: coin.New(appparams.BaseDenom, 100000000), + MaxSupply: coin.New(appparams.BondDenom, 100000000), InflationCycle: time.Hour * 1, InflationReductionRate: bpmath.FixedBP(2500), } @@ -187,7 +187,7 @@ func TestInflationRate(t *testing.T) { return mintParams }, inflationParams: func(ip ugov.InflationParams) ugov.InflationParams { - ip.MaxSupply = coin.New(appparams.BaseDenom, 1149885) + ip.MaxSupply = coin.New(appparams.BondDenom, 1149885) return ip }, bondedRatio: sdk.NewDecWithPrec(20, 2), diff --git a/app/modules.go b/app/modules.go index d14db18cf9..d68bbb9026 100644 --- a/app/modules.go +++ b/app/modules.go @@ -34,16 +34,16 @@ type BankModule struct { func umeeTokenMetadata() banktypes.Metadata { return banktypes.Metadata{ Description: "The native staking token of the Umee network.", - Base: appparams.IBCBaseDenom, // NOTE: do not change + Base: appparams.BondDenom, // NOTE: must not change Name: appparams.DisplayDenom, Display: appparams.DisplayDenom, Symbol: appparams.DisplayDenom, DenomUnits: []*banktypes.DenomUnit{ { - Denom: appparams.BaseDenom, + Denom: appparams.BondDenom, Exponent: 0, Aliases: []string{ - "microumee", appparams.BaseDenom, + "microumee", appparams.DefaultBaseDenom, }, }, { Denom: appparams.DisplayDenom, @@ -72,7 +72,7 @@ type StakingModule struct { // DefaultGenesis returns custom Umee x/staking module genesis state. func (StakingModule) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { p := stakingtypes.DefaultParams() - p.BondDenom = appparams.BaseDenom + p.BondDenom = appparams.BondDenom return cdc.MustMarshalJSON(&stakingtypes.GenesisState{ Params: p, }) @@ -87,7 +87,7 @@ type CrisisModule struct { // DefaultGenesis returns custom Umee x/crisis module genesis state. func (CrisisModule) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { return cdc.MustMarshalJSON(&crisistypes.GenesisState{ - ConstantFee: sdk.NewCoin(appparams.BaseDenom, sdk.NewInt(1000)), + ConstantFee: sdk.NewCoin(appparams.BondDenom, sdk.NewInt(1000)), }) } @@ -100,7 +100,7 @@ type MintModule struct { // DefaultGenesis returns custom Umee x/mint module genesis state. func (MintModule) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { genState := minttypes.DefaultGenesisState() - genState.Params.MintDenom = appparams.BaseDenom + genState.Params.MintDenom = appparams.BondDenom return cdc.MustMarshalJSON(genState) } @@ -113,7 +113,7 @@ type GovModule struct { // DefaultGenesis returns custom Umee x/gov module genesis state. func (GovModule) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { - minDeposit := sdk.NewCoins(sdk.NewCoin(appparams.BaseDenom, govv1.DefaultMinDepositTokens)) + minDeposit := sdk.NewCoins(sdk.NewCoin(appparams.BondDenom, govv1.DefaultMinDepositTokens)) genState := govv1.DefaultGenesisState() genState.Params.MinDeposit = minDeposit diff --git a/app/params/app_settings.go b/app/params/app_settings.go index fae8b81961..4b8a9180a0 100644 --- a/app/params/app_settings.go +++ b/app/params/app_settings.go @@ -8,15 +8,13 @@ import ( const ( // Name defines the application name of the Umee network. - // NOTE: do not change this. Name = "umee" - // IBC denom is the base denom for IBC and Metadata.Base. + // BondDenom defines the native staking token denomination. // NOTE: it is used by IBC, and must not change to avoid token migration in all IBC chains. - IBCBaseDenom = "uumee" + BondDenom = "uumee" - // BaseDenom defines the native staking an d fee token denom. - BaseDenom = "uux" + DefaultBaseDenom = "uux" // DisplayDenom defines the name, symbol, and display value of the umee token. DisplayDenom = "UX" @@ -32,7 +30,7 @@ const ( // ProtocolMinGasPrice is a consensus controlled gas price. Each validator must set his // `minimum-gas-prices` in app.toml config to value above ProtocolMinGasPrice. // Transactions with gas-price smaller than ProtocolMinGasPrice will fail during DeliverTx. -var ProtocolMinGasPrice = sdk.NewDecCoinFromDec(BaseDenom, sdk.MustNewDecFromStr("0.00")) +var ProtocolMinGasPrice = sdk.NewDecCoinFromDec(BondDenom, sdk.MustNewDecFromStr("0.00")) func init() { // XXX: If other upstream or external application's depend on any of Umee's diff --git a/app/test_helpers.go b/app/test_helpers.go index 2eec3577a0..7647e3242e 100644 --- a/app/test_helpers.go +++ b/app/test_helpers.go @@ -81,7 +81,7 @@ func Setup(t *testing.T) *UmeeApp { acc := authtypes.NewBaseAccount(senderPrivKey.PubKey().Address().Bytes(), senderPrivKey.PubKey(), 0, 0) balance := banktypes.Balance{ Address: acc.GetAddress().String(), - Coins: sdk.NewCoins(sdk.NewCoin(params.BaseDenom, sdk.NewInt(10000000000000000))), + Coins: sdk.NewCoins(sdk.NewCoin(params.BondDenom, sdk.NewInt(10000000000000000))), } app := SetupWithGenesisValSet(t, valSet, []authtypes.GenesisAccount{acc}, balance) @@ -177,7 +177,7 @@ func GenesisStateWithValSet(codec codec.Codec, genesisState map[string]json.RawM defaultStParams.MaxValidators, defaultStParams.MaxEntries, defaultStParams.HistoricalEntries, - params.BaseDenom, + params.BondDenom, defaultStParams.MinCommissionRate, ) // set validators and delegations @@ -192,13 +192,13 @@ func GenesisStateWithValSet(codec codec.Codec, genesisState map[string]json.RawM for range delegations { // add delegated tokens to total supply - totalSupply = totalSupply.Add(sdk.NewCoin(params.BaseDenom, bondAmt)) + totalSupply = totalSupply.Add(sdk.NewCoin(params.BondDenom, bondAmt)) } // add bonded amount to bonded pool module account balances = append(balances, banktypes.Balance{ Address: authtypes.NewModuleAddress(stakingtypes.BondedPoolName).String(), - Coins: sdk.Coins{sdk.NewCoin(params.BaseDenom, bondAmt)}, + Coins: sdk.Coins{sdk.NewCoin(params.BondDenom, bondAmt)}, }) // update total supply @@ -250,7 +250,7 @@ func IntegrationTestNetworkConfig() network.Config { panic(err) } leverageGenState.Registry = []leveragetypes.Token{ - fixtures.Token(params.BaseDenom, params.DisplayDenom, 6), + fixtures.Token(params.BondDenom, params.DisplayDenom, 6), } bz, err := cdc.MarshalJSON(&leverageGenState) @@ -307,7 +307,7 @@ func IntegrationTestNetworkConfig() network.Config { cfg.LegacyAmino = encCfg.Amino cfg.InterfaceRegistry = encCfg.InterfaceRegistry cfg.GenesisState = appGenState - cfg.BondDenom = params.BaseDenom + cfg.BondDenom = params.BondDenom cfg.MinGasPrices = params.ProtocolMinGasPrice.String() return cfg diff --git a/app/wasm/test/cw20_base_test.go b/app/wasm/test/cw20_base_test.go index c299be6ef3..b684bfdcb5 100644 --- a/app/wasm/test/cw20_base_test.go +++ b/app/wasm/test/cw20_base_test.go @@ -53,7 +53,7 @@ var ( valAddr2 = sdk.ValAddress(pubKey2.Address()) initTokens = sdk.TokensFromConsensusPower(initialPower, sdk.DefaultPowerReduction) - initCoins = sdk.NewCoins(sdk.NewCoin(appparams.BaseDenom, initTokens)) + initCoins = sdk.NewCoins(sdk.NewCoin(appparams.BondDenom, initTokens)) ) type cw20InitMsg struct { @@ -270,7 +270,7 @@ func (s *IntegrationTestSuite) cw20InitiateCode(sender sdk.AccAddress, init inte Sender: sender.String(), CodeID: s.codeID, Label: cw20Label, - Funds: sdk.Coins{sdk.NewCoin(appparams.BaseDenom, sdk.NewIntFromUint64(10))}, + Funds: sdk.Coins{sdk.NewCoin(appparams.BondDenom, sdk.NewIntFromUint64(10))}, Msg: initBz, Admin: sender.String(), } diff --git a/app/wasm/test/umee_cw_test.go b/app/wasm/test/umee_cw_test.go index 0d97fc6a2d..f319bd108a 100644 --- a/app/wasm/test/umee_cw_test.go +++ b/app/wasm/test/umee_cw_test.go @@ -53,7 +53,7 @@ func (s *IntegrationTestSuite) TestLeverageQueries() { Name: "query registered token", CQ: s.genCustomQuery(wq.UmeeQuery{ RegisteredTokens: &lvtypes.QueryRegisteredTokens{ - BaseDenom: appparams.BaseDenom, + BaseDenom: appparams.BondDenom, }, }), ResponseCheck: func(data []byte) { @@ -61,14 +61,14 @@ func (s *IntegrationTestSuite) TestLeverageQueries() { err := json.Unmarshal(data, &rr) assert.NilError(s.T, err) assert.Equal(s.T, true, len(rr.Registry) > 0) - assert.Equal(s.T, appparams.BaseDenom, rr.Registry[0].BaseDenom) + assert.Equal(s.T, appparams.BondDenom, rr.Registry[0].BaseDenom) }, }, { Name: "market summary", CQ: s.genCustomQuery(wq.UmeeQuery{ MarketSummary: &lvtypes.QueryMarketSummary{ - Denom: appparams.BaseDenom, + Denom: appparams.BondDenom, }, }), ResponseCheck: func(data []byte) { @@ -95,7 +95,7 @@ func (s *IntegrationTestSuite) TestLeverageQueries() { CQ: s.genCustomQuery(wq.UmeeQuery{ MaxWithdraw: &lvtypes.QueryMaxWithdraw{ Address: addr.String(), - Denom: appparams.BaseDenom, + Denom: appparams.BondDenom, }, }), ResponseCheck: func(data []byte) { @@ -111,7 +111,7 @@ func (s *IntegrationTestSuite) TestLeverageQueries() { CQ: s.genCustomQuery(wq.UmeeQuery{ MaxBorrow: &lvtypes.QueryMaxBorrow{ Address: addr.String(), - Denom: appparams.BaseDenom, + Denom: appparams.BondDenom, }, }), ResponseCheck: func(data []byte) { @@ -223,7 +223,7 @@ func (s *IntegrationTestSuite) TestStargateQueries() { name: "stargate: leverage market summary", sq: func() StargateQuery { data := lvtypes.QueryMarketSummary{ - Denom: appparams.BaseDenom, + Denom: appparams.BondDenom, } d, err := data.Marshal() assert.NilError(s.T, err) @@ -258,7 +258,7 @@ func (s *IntegrationTestSuite) TestStargateQueries() { func (s *IntegrationTestSuite) TestLeverageTxs() { accAddr := sdk.MustAccAddressFromBech32(s.contractAddr) - err := s.app.BankKeeper.SendCoinsFromModuleToAccount(s.ctx, minttypes.ModuleName, accAddr, sdk.NewCoins(sdk.NewCoin(appparams.BaseDenom, sdk.NewInt(100000)))) + err := s.app.BankKeeper.SendCoinsFromModuleToAccount(s.ctx, minttypes.ModuleName, accAddr, sdk.NewCoins(sdk.NewCoin(appparams.BondDenom, sdk.NewInt(100000)))) assert.NilError(s.T, err) txTests := []struct { Name string @@ -269,7 +269,7 @@ func (s *IntegrationTestSuite) TestLeverageTxs() { Msg: s.genCustomTx(wm.UmeeMsg{ Supply: &lvtypes.MsgSupply{ Supplier: s.contractAddr, - Asset: sdk.NewCoin(appparams.BaseDenom, sdk.NewInt(700)), + Asset: sdk.NewCoin(appparams.BondDenom, sdk.NewInt(700)), }, }), }, diff --git a/sdkclient/tx/wasm.go b/sdkclient/tx/wasm.go index 5bd34614e4..5ae083ca3a 100644 --- a/sdkclient/tx/wasm.go +++ b/sdkclient/tx/wasm.go @@ -24,7 +24,7 @@ func (c *Client) WasmDeployContract(contractPath string) (*sdk.TxResponse, error func (c *Client) WasmInitContract(storeCode uint64, initMsg []byte) (*sdk.TxResponse, error) { fromIdx := 0 - amount := sdk.NewCoins(sdk.NewCoin(appparams.BaseDenom, sdk.NewInt(1))) + amount := sdk.NewCoins(sdk.NewCoin(appparams.BondDenom, sdk.NewInt(1))) msg := types.MsgInstantiateContract{ Sender: c.KeyringAddress(fromIdx).String(), CodeID: storeCode, diff --git a/tests/e2e/e2e_ibc_test.go b/tests/e2e/e2e_ibc_test.go index 4c9d943e08..f41ca7bcac 100644 --- a/tests/e2e/e2e_ibc_test.go +++ b/tests/e2e/e2e_ibc_test.go @@ -135,7 +135,7 @@ func (s *E2ETest) TestIBCTokenTransfer() { s.Require().NoError(err) s.Require().True(umeePrice.GT(sdk.MustNewDecFromStr("0.001")), "umee price should be non zero, and expecting higher than 0.001, got: %s", umeePrice) - umeeQuota := sdk.NewCoin(appparams.BaseDenom, + umeeQuota := sdk.NewCoin(appparams.BondDenom, sdk.NewDecFromInt(tokenQuota).Quo(umeePrice).Mul(powerReduction).RoundInt(), ) @@ -159,7 +159,7 @@ func (s *E2ETest) TestIBCTokenTransfer() { sendUmee := mulCoin(umeeQuota, "0.9") s.SendIBC(s.Chain.ID, setup.GaiaChainID, "", sendUmee, false, fmt.Sprintf( "sending %s (less than token quota) ", sendUmee.String())) - s.checkOutflows(umeeAPIEndpoint, appparams.BaseDenom, true, sdk.NewDecFromInt(sendUmee.Amount), appparams.Name) + s.checkOutflows(umeeAPIEndpoint, appparams.BondDenom, true, sdk.NewDecFromInt(sendUmee.Amount), appparams.Name) s.checkSupply(gaiaAPIEndpoint, umeeIBCHash, sendUmee.Amount) // << BELOW TOKEN QUOTA 40$ but ATOM_QUOTA (40$)+ UMEE_QUOTA(90$) >= TOTAL QUOTA (120$) >> @@ -194,12 +194,12 @@ func (s *E2ETest) TestIBCTokenTransfer() { s.T().Logf("waiting until quota reset, basically it will take around 300 seconds to do quota reset") s.Require().Eventually( func() bool { - amount, err := s.QueryOutflows(umeeAPIEndpoint, appparams.BaseDenom) + amount, err := s.QueryOutflows(umeeAPIEndpoint, appparams.BondDenom) if err != nil { return false } if amount.IsZero() { - s.T().Logf("quota is reset : %s is 0", appparams.BaseDenom) + s.T().Logf("quota is reset : %s is 0", appparams.BondDenom) return true } return false @@ -239,7 +239,7 @@ func (s *E2ETest) TestIBCTokenTransfer() { // Check the outflows s.Require().Eventually( func() bool { - a, err := s.QueryOutflows(umeeAPIEndpoint, appparams.BaseDenom) + a, err := s.QueryOutflows(umeeAPIEndpoint, appparams.BondDenom) if err != nil { return false } diff --git a/tests/e2e/e2e_leverage_test.go b/tests/e2e/e2e_leverage_test.go index 0f490a4d01..26b38229f3 100644 --- a/tests/e2e/e2e_leverage_test.go +++ b/tests/e2e/e2e_leverage_test.go @@ -88,7 +88,7 @@ func (s *E2ETest) leverageLeveragedLiquidate(accountIndex, targetIndex int, repa } func (s *E2ETest) TestLeverageBasics() { - umeeNoMedians := fixtures.Token(appparams.BaseDenom, "UMEE", 6) + umeeNoMedians := fixtures.Token(appparams.BondDenom, "UMEE", 6) umeeNoMedians.HistoricMedians = 0 updateTokens := []leveragetypes.Token{ umeeNoMedians, @@ -107,33 +107,33 @@ func (s *E2ETest) TestLeverageBasics() { s.Run( "initial leverage supply", func() { - s.leverageSupply(0, appparams.BaseDenom, 100_000_000) + s.leverageSupply(0, appparams.BondDenom, 100_000_000) }, ) s.Run( "initial leverage withdraw", func() { - s.leverageWithdraw(0, "u/"+appparams.BaseDenom, 10_000_000) + s.leverageWithdraw(0, "u/"+appparams.BondDenom, 10_000_000) }, ) s.Run( "initial leverage collateralize", func() { - s.leverageCollateralize(0, "u/"+appparams.BaseDenom, 80_000_000) + s.leverageCollateralize(0, "u/"+appparams.BondDenom, 80_000_000) }, ) s.Run( "initial leverage borrow", func() { - s.leverageBorrow(0, appparams.BaseDenom, 12_000_000) + s.leverageBorrow(0, appparams.BondDenom, 12_000_000) }, ) s.Run( "initial leverage repay", func() { - s.leverageRepay(0, appparams.BaseDenom, 2_000_000) + s.leverageRepay(0, appparams.BondDenom, 2_000_000) }, ) s.Run( "too high leverage borrow", func() { asset := sdk.NewCoin( - appparams.BaseDenom, + appparams.BondDenom, sdk.NewIntFromUint64(30_000_000), ) s.mustFailTx( @@ -148,8 +148,8 @@ func (s *E2ETest) TestLeverageBasics() { pairs := []leveragetypes.SpecialAssetPair{ { // a set allowing UMEE to borrow more of itself - Borrow: appparams.BaseDenom, - Collateral: appparams.BaseDenom, + Borrow: appparams.BondDenom, + Collateral: appparams.BondDenom, CollateralWeight: sdk.MustNewDecFromStr("0.75"), LiquidationThreshold: sdk.MustNewDecFromStr("0.8"), }, diff --git a/tests/e2e/setup/accounts.go b/tests/e2e/setup/accounts.go index 5750776f80..d5a210a7e2 100644 --- a/tests/e2e/setup/accounts.go +++ b/tests/e2e/setup/accounts.go @@ -21,7 +21,7 @@ type testAccount struct { var ( // Initial coins to give to each validator valCoins = sdk.NewCoins( - coin.New(appparams.BaseDenom, 1_000000_000000), + coin.New(appparams.BondDenom, 1_000000_000000), ) // Number of test accounts to initialize in chain.TestAccounts @@ -29,13 +29,13 @@ var ( // Initial coins to give to each test account. testAccountCoins = sdk.NewCoins( - coin.New(appparams.BaseDenom, 100000_000000), + coin.New(appparams.BondDenom, 100000_000000), coin.New(PhotonDenom, 100000_000000), coin.New(mocks.USDTBaseDenom, 100000_000000), ) // initial validator stakes (before delegation from test account 0) - stakeAmountCoin = coin.New(appparams.BaseDenom, 1_000000) + stakeAmountCoin = coin.New(appparams.BondDenom, 1_000000) ) // create a test account, which is an address with a mnemonic stored only in memory, to be used with the network. diff --git a/tests/e2e/setup/setup.go b/tests/e2e/setup/setup.go index b5ec98d1d7..a1b8fcf222 100644 --- a/tests/e2e/setup/setup.go +++ b/tests/e2e/setup/setup.go @@ -215,7 +215,7 @@ func (s *E2ETestSuite) initGenesis() { s.Require().NoError(s.cdc.UnmarshalJSON(appGenState[leveragetypes.ModuleName], &leverageGenState)) leverageGenState.Registry = append(leverageGenState.Registry, - fixtures.Token(appparams.BaseDenom, appparams.DisplayDenom, 6), + fixtures.Token(appparams.BondDenom, appparams.DisplayDenom, 6), fixtures.Token(ATOMBaseDenom, ATOM, uint32(ATOMExponent)), ) @@ -248,7 +248,7 @@ func (s *E2ETestSuite) initGenesis() { votingPeriod := 5 * time.Second govGenState.Params.VotingPeriod = &votingPeriod - govGenState.Params.MinDeposit = sdk.NewCoins(sdk.NewCoin(appparams.BaseDenom, sdk.NewInt(100))) + govGenState.Params.MinDeposit = sdk.NewCoins(sdk.NewCoin(appparams.BondDenom, sdk.NewInt(100))) bz, err = s.cdc.MarshalJSON(&govGenState) s.Require().NoError(err) diff --git a/tests/e2e/setup/utils.go b/tests/e2e/setup/utils.go index 41f4455cec..1ede526653 100644 --- a/tests/e2e/setup/utils.go +++ b/tests/e2e/setup/utils.go @@ -50,7 +50,7 @@ func (s *E2ETestSuite) Delegate(testAccount, valIndex int, amount uint64) error } valOperAddr := sdk.ValAddress(valAddr) - asset := sdk.NewCoin(appparams.BaseDenom, sdk.NewIntFromUint64(amount)) + asset := sdk.NewCoin(appparams.BondDenom, sdk.NewIntFromUint64(amount)) msg := stakingtypes.NewMsgDelegate(addr, valOperAddr, asset) return s.BroadcastTxWithRetry(msg, s.AccountClient(testAccount)) } diff --git a/util/coin/fixtures.go b/util/coin/fixtures.go index f831c8be76..ac02855dff 100644 --- a/util/coin/fixtures.go +++ b/util/coin/fixtures.go @@ -6,7 +6,7 @@ import ( appparams "github.com/umee-network/umee/v6/app/params" ) -const umee = appparams.BaseDenom +const umee = appparams.BondDenom // common coins used in tests var ( @@ -44,7 +44,7 @@ func UmeeCoins(amount int64) sdk.Coins { // UmeeDec creates a Umee (uumee) DecCoin with given amount func UmeeDec(amount string) sdk.DecCoin { - return Dec(appparams.BaseDenom, amount) + return Dec(appparams.BondDenom, amount) } // Utoken creates a uToken Coin. diff --git a/x/incentive/client/tests/tests.go b/x/incentive/client/tests/tests.go index b0f4f28ebe..faa1a2ac70 100644 --- a/x/incentive/client/tests/tests.go +++ b/x/incentive/client/tests/tests.go @@ -105,7 +105,7 @@ func (s *IntegrationTests) TestIncentiveScenario() { Name: "query total bonded - specific denom", Command: cli.QueryTotalBonded(), Args: []string{ - "u/" + appparams.BaseDenom, + "u/" + appparams.BondDenom, }, Response: &incentive.QueryTotalBondedResponse{}, ExpectedResponse: &incentive.QueryTotalBondedResponse{ @@ -125,7 +125,7 @@ func (s *IntegrationTests) TestIncentiveScenario() { Name: "query total unbonding - specific denom", Command: cli.QueryTotalUnbonding(), Args: []string{ - "u/" + appparams.BaseDenom, + "u/" + appparams.BondDenom, }, Response: &incentive.QueryTotalUnbondingResponse{}, ExpectedResponse: &incentive.QueryTotalUnbondingResponse{ @@ -136,11 +136,11 @@ func (s *IntegrationTests) TestIncentiveScenario() { Name: "query current rates (zero)", Command: cli.QueryCurrentRates(), Args: []string{ - "u/" + appparams.BaseDenom, + "u/" + appparams.BondDenom, }, Response: &incentive.QueryCurrentRatesResponse{}, ExpectedResponse: &incentive.QueryCurrentRatesResponse{ - ReferenceBond: sdk.NewInt64Coin("u/"+appparams.BaseDenom, 1), + ReferenceBond: sdk.NewInt64Coin("u/"+appparams.BondDenom, 1), Rewards: sdk.NewCoins(), }, ErrMsg: "", @@ -149,7 +149,7 @@ func (s *IntegrationTests) TestIncentiveScenario() { Name: "query actual rates (zero)", Command: cli.QueryActualRates(), Args: []string{ - "u/" + appparams.BaseDenom, + "u/" + appparams.BondDenom, }, Response: &incentive.QueryActualRatesResponse{}, ExpectedResponse: &incentive.QueryActualRatesResponse{ diff --git a/x/leverage/client/tests/tests.go b/x/leverage/client/tests/tests.go index b5c6280844..1420923060 100644 --- a/x/leverage/client/tests/tests.go +++ b/x/leverage/client/tests/tests.go @@ -91,7 +91,7 @@ func (s *IntegrationTests) TestLeverageScenario() { Response: &types.QueryRegisteredTokensResponse{}, ExpectedResponse: &types.QueryRegisteredTokensResponse{ Registry: []types.Token{ - fixtures.Token(appparams.BaseDenom, appparams.DisplayDenom, 6), + fixtures.Token(appparams.BondDenom, appparams.DisplayDenom, 6), }, }, ErrMsg: "", @@ -109,11 +109,11 @@ func (s *IntegrationTests) TestLeverageScenario() { { Name: "query registered token info by base_denom", Command: cli.QueryRegisteredTokens(), - Args: []string{appparams.BaseDenom}, + Args: []string{appparams.BondDenom}, Response: &types.QueryRegisteredTokensResponse{}, ExpectedResponse: &types.QueryRegisteredTokensResponse{ Registry: []types.Token{ - fixtures.Token(appparams.BaseDenom, appparams.DisplayDenom, 6), + fixtures.Token(appparams.BondDenom, appparams.DisplayDenom, 6), }, }, ErrMsg: "", @@ -122,7 +122,7 @@ func (s *IntegrationTests) TestLeverageScenario() { Name: "query market summary - zero supply", Command: cli.QueryMarketSummary(), Args: []string{ - appparams.BaseDenom, + appparams.BondDenom, }, Response: &types.QueryMarketSummaryResponse{}, ExpectedResponse: &types.QueryMarketSummaryResponse{ @@ -306,13 +306,13 @@ func (s *IntegrationTests) TestLeverageScenario() { Response: &types.QueryAccountBalancesResponse{}, ExpectedResponse: &types.QueryAccountBalancesResponse{ Supplied: sdk.NewCoins( - sdk.NewInt64Coin(appparams.BaseDenom, 1001), + sdk.NewInt64Coin(appparams.BondDenom, 1001), ), Collateral: sdk.NewCoins( - sdk.NewInt64Coin(coin.ToUTokenDenom(appparams.BaseDenom), 1000), + sdk.NewInt64Coin(coin.ToUTokenDenom(appparams.BondDenom), 1000), ), Borrowed: sdk.NewCoins( - sdk.NewInt64Coin(appparams.BaseDenom, 251), + sdk.NewInt64Coin(appparams.BondDenom, 251), ), }, ErrMsg: "", @@ -383,10 +383,10 @@ func (s *IntegrationTests) TestLeverageScenario() { Response: &types.QueryAccountBalancesResponse{}, ExpectedResponse: &types.QueryAccountBalancesResponse{ Supplied: sdk.NewCoins( - sdk.NewInt64Coin(appparams.BaseDenom, 201), // slightly increased uToken exchange rate + sdk.NewInt64Coin(appparams.BondDenom, 201), // slightly increased uToken exchange rate ), Collateral: sdk.NewCoins( - sdk.NewInt64Coin(coin.ToUTokenDenom(appparams.BaseDenom), 100), + sdk.NewInt64Coin(coin.ToUTokenDenom(appparams.BondDenom), 100), ), Borrowed: sdk.NewCoins(), }, diff --git a/x/leverage/keeper/exchange_rate_test.go b/x/leverage/keeper/exchange_rate_test.go index 8608a2e4c2..7f828fd45e 100644 --- a/x/leverage/keeper/exchange_rate_test.go +++ b/x/leverage/keeper/exchange_rate_test.go @@ -28,6 +28,6 @@ func (s *IntegrationTestSuite) TestDeriveExchangeRate() { // = 2.7 // get derived exchange rate - rate := app.LeverageKeeper.DeriveExchangeRate(ctx, appparams.BaseDenom) + rate := app.LeverageKeeper.DeriveExchangeRate(ctx, appparams.BondDenom) require.Equal(sdk.MustNewDecFromStr("2.7"), rate) } diff --git a/x/leverage/keeper/grpc_query_test.go b/x/leverage/keeper/grpc_query_test.go index b04241575a..41057ba60c 100644 --- a/x/leverage/keeper/grpc_query_test.go +++ b/x/leverage/keeper/grpc_query_test.go @@ -30,7 +30,7 @@ func (s *IntegrationTestSuite) TestQuerier_RegisteredTokens() { { "valid: get the registered token info by base_denom", "", - types.QueryRegisteredTokens{BaseDenom: appparams.BaseDenom}, + types.QueryRegisteredTokens{BaseDenom: appparams.BondDenom}, 1, }, { diff --git a/x/leverage/keeper/interest_test.go b/x/leverage/keeper/interest_test.go index 9921a9692e..e02fedcda0 100644 --- a/x/leverage/keeper/interest_test.go +++ b/x/leverage/keeper/interest_test.go @@ -16,11 +16,11 @@ func (s *IntegrationTestSuite) TestAccrueZeroInterest() { s.collateralize(addr, coin.New("u/"+umeeDenom, 1000_000000)) // user borrows 40 umee - s.borrow(addr, coin.New(appparams.BaseDenom, 40_000000)) + s.borrow(addr, coin.New(appparams.BondDenom, 40_000000)) // verify user's loan amount (40 umee) - loanBalance := app.LeverageKeeper.GetBorrow(ctx, addr, appparams.BaseDenom) - require.Equal(coin.New(appparams.BaseDenom, 40_000000), loanBalance) + loanBalance := app.LeverageKeeper.GetBorrow(ctx, addr, appparams.BondDenom) + require.Equal(coin.New(appparams.BondDenom, 40_000000), loanBalance) // Because no time has passed since genesis (due to test setup) this will not // increase borrowed amount. @@ -28,18 +28,18 @@ func (s *IntegrationTestSuite) TestAccrueZeroInterest() { require.NoError(err) // verify user's loan amount (40 umee) - loanBalance = app.LeverageKeeper.GetBorrow(ctx, addr, appparams.BaseDenom) - require.Equal(coin.New(appparams.BaseDenom, 40_000000), loanBalance) + loanBalance = app.LeverageKeeper.GetBorrow(ctx, addr, appparams.BondDenom) + require.Equal(coin.New(appparams.BondDenom, 40_000000), loanBalance) // borrow APY at utilization = 4% // when kink utilization = 80%, and base/kink APY are 0.02 and 0.22 - borrowAPY := app.LeverageKeeper.DeriveBorrowAPY(ctx, appparams.BaseDenom) + borrowAPY := app.LeverageKeeper.DeriveBorrowAPY(ctx, appparams.BondDenom) require.Equal(sdk.MustNewDecFromStr("0.03"), borrowAPY) // supply APY when borrow APY is 3% // and utilization is 4%, and reservefactor is 20%, and OracleRewardFactor is 1% // 0.03 * 0.04 * (1 - 0.21) = 0.000948 - supplyAPY := app.LeverageKeeper.DeriveSupplyAPY(ctx, appparams.BaseDenom) + supplyAPY := app.LeverageKeeper.DeriveSupplyAPY(ctx, appparams.BondDenom) require.Equal(sdk.MustNewDecFromStr("0.000948"), supplyAPY) } @@ -52,35 +52,35 @@ func (s *IntegrationTestSuite) TestDynamicInterest() { s.collateralize(addr, coin.New("u/"+umeeDenom, 1000_000000)) // Base interest rate (0% utilization) - rate := app.LeverageKeeper.DeriveBorrowAPY(ctx, appparams.BaseDenom) + rate := app.LeverageKeeper.DeriveBorrowAPY(ctx, appparams.BondDenom) require.Equal(sdk.MustNewDecFromStr("0.02"), rate) // user borrows 200 umee, utilization 200/1000 - s.borrow(addr, coin.New(appparams.BaseDenom, 200_000000)) + s.borrow(addr, coin.New(appparams.BondDenom, 200_000000)) // Between base interest and kink (20% utilization) - rate = app.LeverageKeeper.DeriveBorrowAPY(ctx, appparams.BaseDenom) + rate = app.LeverageKeeper.DeriveBorrowAPY(ctx, appparams.BondDenom) require.Equal(sdk.MustNewDecFromStr("0.07"), rate) // user borrows 600 more umee (ignores collateral), utilization 800/1000 - s.forceBorrow(addr, coin.New(appparams.BaseDenom, 600_000000)) + s.forceBorrow(addr, coin.New(appparams.BondDenom, 600_000000)) // Kink interest rate (80% utilization) - rate = app.LeverageKeeper.DeriveBorrowAPY(ctx, appparams.BaseDenom) + rate = app.LeverageKeeper.DeriveBorrowAPY(ctx, appparams.BondDenom) require.Equal(sdk.MustNewDecFromStr("0.22"), rate) // user borrows 100 more umee (ignores collateral), utilization 900/1000 - s.forceBorrow(addr, coin.New(appparams.BaseDenom, 100_000000)) + s.forceBorrow(addr, coin.New(appparams.BondDenom, 100_000000)) // Between kink interest and max (90% utilization) - rate = app.LeverageKeeper.DeriveBorrowAPY(ctx, appparams.BaseDenom) + rate = app.LeverageKeeper.DeriveBorrowAPY(ctx, appparams.BondDenom) require.Equal(sdk.MustNewDecFromStr("0.87"), rate) // user borrows 100 more umee (ignores collateral), utilization 1000/1000 - s.forceBorrow(addr, coin.New(appparams.BaseDenom, 100_000000)) + s.forceBorrow(addr, coin.New(appparams.BondDenom, 100_000000)) // Max interest rate (100% utilization) - rate = app.LeverageKeeper.DeriveBorrowAPY(ctx, appparams.BaseDenom) + rate = app.LeverageKeeper.DeriveBorrowAPY(ctx, appparams.BondDenom) require.Equal(sdk.MustNewDecFromStr("1.52"), rate) } diff --git a/x/leverage/keeper/invariants_test.go b/x/leverage/keeper/invariants_test.go index e0e23219a5..9ab878b9e6 100644 --- a/x/leverage/keeper/invariants_test.go +++ b/x/leverage/keeper/invariants_test.go @@ -10,7 +10,7 @@ func (s *IntegrationTestSuite) TestReserveAmountInvariant() { app, ctx, require := s.app, s.ctx, s.Require() // artificially set reserves - s.setReserves(coin.New(appparams.BaseDenom, 300_000000)) + s.setReserves(coin.New(appparams.BondDenom, 300_000000)) // check invariants _, broken := keeper.ReserveAmountInvariant(app.LeverageKeeper)(ctx) @@ -29,7 +29,7 @@ func (s *IntegrationTestSuite) TestCollateralAmountInvariant() { _, broken := keeper.InefficientCollateralAmountInvariant(app.LeverageKeeper)(ctx) require.False(broken) - uTokenDenom := coin.ToUTokenDenom(appparams.BaseDenom) + uTokenDenom := coin.ToUTokenDenom(appparams.BondDenom) // withdraw the supplied umee in the initBorrowScenario s.withdraw(addr, coin.New(uTokenDenom, 1000_000000)) @@ -48,7 +48,7 @@ func (s *IntegrationTestSuite) TestBorrowAmountInvariant() { s.collateralize(addr, coin.New("u/"+umeeDenom, 1000_000000)) // user borrows 20 umee - s.borrow(addr, coin.New(appparams.BaseDenom, 20_000000)) + s.borrow(addr, coin.New(appparams.BondDenom, 20_000000)) // check invariant _, broken := keeper.InefficientBorrowAmountInvariant(app.LeverageKeeper)(ctx) @@ -56,7 +56,7 @@ func (s *IntegrationTestSuite) TestBorrowAmountInvariant() { // user repays 30 umee, actually only 20 because is the min between // the amount borrowed and the amount repaid - _, err := app.LeverageKeeper.Repay(ctx, addr, coin.New(appparams.BaseDenom, 30_000000)) + _, err := app.LeverageKeeper.Repay(ctx, addr, coin.New(appparams.BondDenom, 30_000000)) require.NoError(err) // check invariant diff --git a/x/leverage/keeper/oracle_test.go b/x/leverage/keeper/oracle_test.go index 99433cc76b..7383f3b560 100644 --- a/x/leverage/keeper/oracle_test.go +++ b/x/leverage/keeper/oracle_test.go @@ -94,7 +94,7 @@ func (m *mockOracleKeeper) Reset() { func (s *IntegrationTestSuite) TestOracle_TokenPrice() { app, ctx, require := s.app, s.ctx, s.Require() - p, e, err := app.LeverageKeeper.TokenPrice(ctx, appparams.BaseDenom, types.PriceModeSpot) + p, e, err := app.LeverageKeeper.TokenPrice(ctx, appparams.BondDenom, types.PriceModeSpot) require.NoError(err) require.Equal(sdk.MustNewDecFromStr("4.21"), p) require.Equal(uint32(6), e) @@ -121,7 +121,7 @@ func (s *IntegrationTestSuite) TestOracle_TokenPrice() { // Now with historic = true - p, e, err = app.LeverageKeeper.TokenPrice(ctx, appparams.BaseDenom, types.PriceModeHistoric) + p, e, err = app.LeverageKeeper.TokenPrice(ctx, appparams.BondDenom, types.PriceModeHistoric) require.NoError(err) require.Equal(sdk.MustNewDecFromStr("4.21"), p) require.Equal(uint32(6), e) @@ -179,7 +179,7 @@ func (s *IntegrationTestSuite) TestOracle_TokenValue() { app, ctx, require := s.app, s.ctx, s.Require() // 2.4 UMEE * $4.21 - v, err := app.LeverageKeeper.TokenValue(ctx, coin.New(appparams.BaseDenom, 2_400000), types.PriceModeSpot) + v, err := app.LeverageKeeper.TokenValue(ctx, coin.New(appparams.BondDenom, 2_400000), types.PriceModeSpot) require.NoError(err) require.Equal(sdk.MustNewDecFromStr("10.104"), v) @@ -200,7 +200,7 @@ func (s *IntegrationTestSuite) TestOracle_TokenValue() { // Now with historic = true // 2.4 UMEE * $4.21 - v, err = app.LeverageKeeper.TokenValue(ctx, coin.New(appparams.BaseDenom, 2_400000), types.PriceModeHistoric) + v, err = app.LeverageKeeper.TokenValue(ctx, coin.New(appparams.BondDenom, 2_400000), types.PriceModeHistoric) require.NoError(err) require.Equal(sdk.MustNewDecFromStr("10.104"), v) @@ -253,7 +253,7 @@ func (s *IntegrationTestSuite) TestOracle_TotalTokenValue() { v, err := app.LeverageKeeper.TotalTokenValue( ctx, sdk.NewCoins( - coin.New(appparams.BaseDenom, 2_400000), + coin.New(appparams.BondDenom, 2_400000), coin.New(atomDenom, 4_700000), ), types.PriceModeSpot, @@ -265,7 +265,7 @@ func (s *IntegrationTestSuite) TestOracle_TotalTokenValue() { v, err = app.LeverageKeeper.TotalTokenValue( ctx, sdk.NewCoins( - coin.New(appparams.BaseDenom, 2_400000), + coin.New(appparams.BondDenom, 2_400000), coin.New(atomDenom, 4_700000), coin.New("foo", 4_700000), ), @@ -278,7 +278,7 @@ func (s *IntegrationTestSuite) TestOracle_TotalTokenValue() { v, err = app.LeverageKeeper.TotalTokenValue( ctx, sdk.NewCoins( - coin.New(appparams.BaseDenom, 2_400000), + coin.New(appparams.BondDenom, 2_400000), coin.New(atomDenom, 4_700000), coin.New("foo", 4_700000), coin.New(dumpDenom, 2_000000), @@ -316,17 +316,17 @@ func (s *IntegrationTestSuite) TestOracle_TotalTokenValue() { func (s *IntegrationTestSuite) TestOracle_PriceRatio() { app, ctx, require := s.app, s.ctx, s.Require() - r, err := app.LeverageKeeper.PriceRatio(ctx, appparams.BaseDenom, atomDenom, types.PriceModeSpot) + r, err := app.LeverageKeeper.PriceRatio(ctx, appparams.BondDenom, atomDenom, types.PriceModeSpot) require.NoError(err) // $4.21 / $39.38 at same exponent require.Equal(sdk.MustNewDecFromStr("0.106907059421025901"), r) - r, err = app.LeverageKeeper.PriceRatio(ctx, appparams.BaseDenom, daiDenom, types.PriceModeSpot) + r, err = app.LeverageKeeper.PriceRatio(ctx, appparams.BondDenom, daiDenom, types.PriceModeSpot) require.NoError(err) // $4.21 / $1.00 at a difference of 12 exponent require.Equal(sdk.MustNewDecFromStr("4210000000000"), r) - r, err = app.LeverageKeeper.PriceRatio(ctx, daiDenom, appparams.BaseDenom, types.PriceModeSpot) + r, err = app.LeverageKeeper.PriceRatio(ctx, daiDenom, appparams.BondDenom, types.PriceModeSpot) require.NoError(err) // $1.00 / $4.21 at a difference of -12 exponent require.Equal(sdk.MustNewDecFromStr("0.000000000000237530"), r) @@ -334,7 +334,7 @@ func (s *IntegrationTestSuite) TestOracle_PriceRatio() { _, err = app.LeverageKeeper.PriceRatio(ctx, "foo", atomDenom, types.PriceModeSpot) require.ErrorIs(err, types.ErrNotRegisteredToken) - _, err = app.LeverageKeeper.PriceRatio(ctx, appparams.BaseDenom, "foo", types.PriceModeSpot) + _, err = app.LeverageKeeper.PriceRatio(ctx, appparams.BondDenom, "foo", types.PriceModeSpot) require.ErrorIs(err, types.ErrNotRegisteredToken) // current price of volatile assets diff --git a/x/leverage/keeper/reserves_test.go b/x/leverage/keeper/reserves_test.go index 03dfeaa5eb..fff545d720 100644 --- a/x/leverage/keeper/reserves_test.go +++ b/x/leverage/keeper/reserves_test.go @@ -15,7 +15,7 @@ func (s *IntegrationTestSuite) TestSetReserves() { // artificially reserve 200 umee s.setReserves(coin.New(umeeDenom, 200_000000)) // get new reserves - reserves = app.LeverageKeeper.GetReserves(ctx, appparams.BaseDenom) + reserves = app.LeverageKeeper.GetReserves(ctx, appparams.BondDenom) require.Equal(coin.New(umeeDenom, 200_000000), reserves) } diff --git a/x/leverage/keeper/suite_test.go b/x/leverage/keeper/suite_test.go index b5beea2d57..1101b000fa 100644 --- a/x/leverage/keeper/suite_test.go +++ b/x/leverage/keeper/suite_test.go @@ -22,7 +22,7 @@ import ( ) const ( - umeeDenom = appparams.BaseDenom + umeeDenom = appparams.BondDenom atomDenom = fixtures.AtomDenom daiDenom = fixtures.DaiDenom pumpDenom = "upump" @@ -80,7 +80,7 @@ func (s *IntegrationTestSuite) SetupTest() { // override DefaultGenesis token registry with fixtures.Token leverage.InitGenesis(ctx, app.LeverageKeeper, *types.DefaultGenesis()) - require.NoError(app.LeverageKeeper.SetTokenSettings(ctx, newToken(appparams.BaseDenom, "UMEE", 6))) + require.NoError(app.LeverageKeeper.SetTokenSettings(ctx, newToken(appparams.BondDenom, "UMEE", 6))) require.NoError(app.LeverageKeeper.SetTokenSettings(ctx, newToken(atomDenom, "ATOM", 6))) daiToken := newToken(daiDenom, "DAI", 18) // high exponent token will need bigger maxSupply for testing daiToken.MaxSupply = daiToken.MaxSupply.Mul(sdk.NewInt(1_000_000_000_000)) diff --git a/x/leverage/simulation/operations_test.go b/x/leverage/simulation/operations_test.go index a2557f2b1b..9793a1bcf7 100644 --- a/x/leverage/simulation/operations_test.go +++ b/x/leverage/simulation/operations_test.go @@ -142,7 +142,7 @@ func (s *SimTestSuite) TestSimulateMsgSupply() { func (s *SimTestSuite) TestSimulateMsgWithdraw() { r := rand.New(rand.NewSource(1)) - supplyToken := sdk.NewCoin(appparams.BaseDenom, sdk.NewInt(10_000000)) + supplyToken := sdk.NewCoin(appparams.BondDenom, sdk.NewInt(10_000000)) accs := s.getTestingAccounts(r, 3, func(fundedAccount simtypes.Account) { _, err := s.app.LeverageKeeper.Supply(s.ctx, fundedAccount.Address, supplyToken) @@ -165,7 +165,7 @@ func (s *SimTestSuite) TestSimulateMsgWithdraw() { func (s *SimTestSuite) TestSimulateMsgBorrow() { r := rand.New(rand.NewSource(8)) - supplyToken := sdk.NewCoin(appparams.BaseDenom, sdk.NewInt(10_000000)) + supplyToken := sdk.NewCoin(appparams.BondDenom, sdk.NewInt(10_000000)) accs := s.getTestingAccounts(r, 3, func(fundedAccount simtypes.Account) { uToken, err := s.app.LeverageKeeper.Supply(s.ctx, fundedAccount.Address, supplyToken) @@ -190,7 +190,7 @@ func (s *SimTestSuite) TestSimulateMsgBorrow() { func (s *SimTestSuite) TestSimulateMsgCollateralize() { r := rand.New(rand.NewSource(1)) - supplyToken := sdk.NewInt64Coin(appparams.BaseDenom, 10_000000) + supplyToken := sdk.NewInt64Coin(appparams.BondDenom, 10_000000) accs := s.getTestingAccounts(r, 3, func(fundedAccount simtypes.Account) { _, err := s.app.LeverageKeeper.Supply(s.ctx, fundedAccount.Address, supplyToken) @@ -212,7 +212,7 @@ func (s *SimTestSuite) TestSimulateMsgCollateralize() { func (s *SimTestSuite) TestSimulateMsgDecollateralize() { r := rand.New(rand.NewSource(1)) - supplyToken := sdk.NewInt64Coin(appparams.BaseDenom, 10_000000) + supplyToken := sdk.NewInt64Coin(appparams.BondDenom, 10_000000) accs := s.getTestingAccounts(r, 3, func(fundedAccount simtypes.Account) { uToken, err := s.app.LeverageKeeper.Supply(s.ctx, fundedAccount.Address, supplyToken) @@ -235,8 +235,8 @@ func (s *SimTestSuite) TestSimulateMsgDecollateralize() { func (s *SimTestSuite) TestSimulateMsgRepay() { r := rand.New(rand.NewSource(1)) - supplyToken := sdk.NewInt64Coin(appparams.BaseDenom, 10_000000) - borrowToken := sdk.NewInt64Coin(appparams.BaseDenom, 1_000000) + supplyToken := sdk.NewInt64Coin(appparams.BondDenom, 10_000000) + borrowToken := sdk.NewInt64Coin(appparams.BondDenom, 1_000000) accs := s.getTestingAccounts(r, 3, func(fundedAccount simtypes.Account) { uToken, err := s.app.LeverageKeeper.Supply(s.ctx, fundedAccount.Address, supplyToken) @@ -260,9 +260,9 @@ func (s *SimTestSuite) TestSimulateMsgRepay() { func (s *SimTestSuite) TestSimulateMsgLiquidate() { r := rand.New(rand.NewSource(1)) - supplyToken := sdk.NewCoin(appparams.BaseDenom, sdk.NewInt(10_000000)) - uToken := sdk.NewCoin("u/"+appparams.BaseDenom, sdk.NewInt(10_000000)) - borrowToken := sdk.NewCoin(appparams.BaseDenom, sdk.NewInt(1_000000)) + supplyToken := sdk.NewCoin(appparams.BondDenom, sdk.NewInt(10_000000)) + uToken := sdk.NewCoin("u/"+appparams.BondDenom, sdk.NewInt(10_000000)) + borrowToken := sdk.NewCoin(appparams.BondDenom, sdk.NewInt(1_000000)) accs := s.getTestingAccounts(r, 3, func(fundedAccount simtypes.Account) { _, err := s.app.LeverageKeeper.Supply(s.ctx, fundedAccount.Address, supplyToken) diff --git a/x/leverage/types/keys_test.go b/x/leverage/types/keys_test.go index 9bcacced30..5fee44e9ac 100644 --- a/x/leverage/types/keys_test.go +++ b/x/leverage/types/keys_test.go @@ -13,7 +13,7 @@ import ( func TestAddressFromKey(t *testing.T) { address := sdk.AccAddress([]byte("addr________________")) - key := types.KeyAdjustedBorrow(address, appparams.BaseDenom) + key := types.KeyAdjustedBorrow(address, appparams.BondDenom) expectedAddress := types.AddressFromKey(key, types.KeyPrefixAdjustedBorrow) assert.DeepEqual(t, address, expectedAddress) @@ -27,7 +27,7 @@ func TestAddressFromKey(t *testing.T) { func TestDenomFromKeyWithAddress(t *testing.T) { address := sdk.AccAddress([]byte("addr________________")) - denom := appparams.BaseDenom + denom := appparams.BondDenom key := types.KeyAdjustedBorrow(address, denom) expectedDenom := types.DenomFromKeyWithAddress(key, types.KeyPrefixAdjustedBorrow) @@ -41,7 +41,7 @@ func TestDenomFromKeyWithAddress(t *testing.T) { } func TestDenomFromKey(t *testing.T) { - denom := appparams.BaseDenom + denom := appparams.BondDenom key := types.KeyReserveAmount(denom) expectedDenom := types.DenomFromKey(key, types.KeyPrefixReserveAmount) diff --git a/x/leverage/types/token.go b/x/leverage/types/token.go index 96de4076b0..3959efddd2 100644 --- a/x/leverage/types/token.go +++ b/x/leverage/types/token.go @@ -139,7 +139,7 @@ func (t Token) BorrowFactor() sdk.Dec { func defaultUmeeToken() Token { return Token{ - BaseDenom: appparams.BaseDenom, + BaseDenom: appparams.BondDenom, SymbolDenom: "UMEE", Exponent: 6, EnableMsgSupply: true, diff --git a/x/oracle/abci_test.go b/x/oracle/abci_test.go index 9529f8afb2..d9b07fcc84 100644 --- a/x/oracle/abci_test.go +++ b/x/oracle/abci_test.go @@ -25,7 +25,7 @@ import ( const ( displayDenom string = appparams.DisplayDenom - bondDenom string = appparams.BaseDenom + bondDenom string = appparams.BondDenom ) type IntegrationTestSuite struct { diff --git a/x/oracle/keeper/hooks_test.go b/x/oracle/keeper/hooks_test.go index f534a556bf..514704685c 100644 --- a/x/oracle/keeper/hooks_test.go +++ b/x/oracle/keeper/hooks_test.go @@ -11,7 +11,7 @@ func (s *IntegrationTestSuite) TestHooks_AfterTokenRegistered() { // require that an existing token does not change the accept list h.AfterTokenRegistered(s.ctx, leveragetypes.Token{ - BaseDenom: appparams.BaseDenom, + BaseDenom: appparams.BondDenom, SymbolDenom: appparams.DisplayDenom, Exponent: 6, }) diff --git a/x/oracle/keeper/keeper_test.go b/x/oracle/keeper/keeper_test.go index f7f8d26d69..e8ce168892 100644 --- a/x/oracle/keeper/keeper_test.go +++ b/x/oracle/keeper/keeper_test.go @@ -29,7 +29,7 @@ import ( const ( displayDenom string = appparams.DisplayDenom - bondDenom string = appparams.BaseDenom + bondDenom string = appparams.BondDenom initialPower = int64(10000000000) ) @@ -48,7 +48,7 @@ var ( valAddr2 = sdk.ValAddress(pubKey2.Address()) initTokens = sdk.TokensFromConsensusPower(initialPower, sdk.DefaultPowerReduction) - initCoins = sdk.NewCoins(sdk.NewCoin(appparams.BaseDenom, initTokens)) + initCoins = sdk.NewCoins(sdk.NewCoin(appparams.BondDenom, initTokens)) ) type IntegrationTestSuite struct { diff --git a/x/oracle/types/asset.go b/x/oracle/types/asset.go index 4616b7280b..526e143bf2 100644 --- a/x/oracle/types/asset.go +++ b/x/oracle/types/asset.go @@ -7,7 +7,7 @@ import ( ) const ( - UmeeDenom = appparams.BaseDenom + UmeeDenom = appparams.BondDenom UmeeSymbol = "umee" UmeeExponent = uint32(6) USDDenom = "USD" diff --git a/x/oracle/types/keys_test.go b/x/oracle/types/keys_test.go index 9a4eb046b7..e2f0c527c6 100644 --- a/x/oracle/types/keys_test.go +++ b/x/oracle/types/keys_test.go @@ -17,7 +17,7 @@ func TestKeyExchangeRate(t *testing.T) { }{ { // converts uumee to UUMEE - denom: appparams.BaseDenom, + denom: appparams.BondDenom, expectedKey: []byte{0x1, 0x55, 0x55, 0x4d, 0x45, 0x45, 0x0}, }, { diff --git a/x/ugov/inflation_params.go b/x/ugov/inflation_params.go index a9861134cd..34eb057ccc 100644 --- a/x/ugov/inflation_params.go +++ b/x/ugov/inflation_params.go @@ -12,7 +12,7 @@ import ( func DefaultInflationParams() InflationParams { return InflationParams{ - MaxSupply: coin.New(appparams.BaseDenom, 21_000_000_000_000000), // 21 Billion Maximum + MaxSupply: coin.New(appparams.BondDenom, 21_000_000_000_000000), // 21 Billion Maximum InflationCycle: time.Hour * 24 * 365 * 2, // 2 years for default inflation cycle InflationReductionRate: bpmath.FixedBP(2500), // 25% reduction rate for inflation cyle } diff --git a/x/ugov/keeper/params_test.go b/x/ugov/keeper/params_test.go index 0423040dfe..90d412ddb9 100644 --- a/x/ugov/keeper/params_test.go +++ b/x/ugov/keeper/params_test.go @@ -50,7 +50,7 @@ func TestLiquidationParams(t *testing.T) { k.SetInflationParams(dip) p := k.InflationParams() require.Equal(dip, p) - require.Equal(dip.MaxSupply.GetDenom(), appparams.BaseDenom) + require.Equal(dip.MaxSupply.GetDenom(), appparams.BondDenom) } func TestInflationCycleEnd(t *testing.T) { diff --git a/x/uibc/quota/keeper/intest/suite_test.go b/x/uibc/quota/keeper/intest/suite_test.go index 9fe526112e..a9612ac3d1 100644 --- a/x/uibc/quota/keeper/intest/suite_test.go +++ b/x/uibc/quota/keeper/intest/suite_test.go @@ -29,7 +29,7 @@ import ( const ( displayDenom string = appparams.DisplayDenom - bondDenom string = appparams.BaseDenom + bondDenom string = appparams.BondDenom initialPower = int64(10000000000) ) @@ -48,7 +48,7 @@ var ( valAddr2 = sdk.ValAddress(pubKey2.Address()) initTokens = sdk.TokensFromConsensusPower(initialPower, sdk.DefaultPowerReduction) - initCoins = sdk.NewCoins(sdk.NewCoin(appparams.BaseDenom, initTokens)) + initCoins = sdk.NewCoins(sdk.NewCoin(appparams.BondDenom, initTokens)) sampleOutflow = sdk.NewDecCoin("utest", sdk.NewInt(1111)) ) From c9bedd9b15aaa4566a07ddf35ea36ca2b7c32bf9 Mon Sep 17 00:00:00 2001 From: Robert Zaremba Date: Fri, 17 Nov 2023 22:11:00 +0100 Subject: [PATCH 05/21] rename --- app/modules.go | 2 +- app/params/app_settings.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/modules.go b/app/modules.go index d68bbb9026..e34f9e8f01 100644 --- a/app/modules.go +++ b/app/modules.go @@ -43,7 +43,7 @@ func umeeTokenMetadata() banktypes.Metadata { Denom: appparams.BondDenom, Exponent: 0, Aliases: []string{ - "microumee", appparams.DefaultBaseDenom, + "microumee", appparams.BaseExtraDenom, }, }, { Denom: appparams.DisplayDenom, diff --git a/app/params/app_settings.go b/app/params/app_settings.go index 4b8a9180a0..c4fee09057 100644 --- a/app/params/app_settings.go +++ b/app/params/app_settings.go @@ -14,7 +14,7 @@ const ( // NOTE: it is used by IBC, and must not change to avoid token migration in all IBC chains. BondDenom = "uumee" - DefaultBaseDenom = "uux" + BaseExtraDenom = "uux" // DisplayDenom defines the name, symbol, and display value of the umee token. DisplayDenom = "UX" From e3ec745272b2e800a2250be01c2570fc7822ef3a Mon Sep 17 00:00:00 2001 From: Robert Zaremba Date: Fri, 17 Nov 2023 22:17:17 +0100 Subject: [PATCH 06/21] typo --- app/params/app_settings.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/params/app_settings.go b/app/params/app_settings.go index c4fee09057..d88d25ebfe 100644 --- a/app/params/app_settings.go +++ b/app/params/app_settings.go @@ -19,7 +19,7 @@ const ( // DisplayDenom defines the name, symbol, and display value of the umee token. DisplayDenom = "UX" - // Old dispaly name. We renamed UMEE to UX. + // Old display name. We renamed UMEE to UX. LegacyDisplayDenom = "UMEE" // DefaultGasLimit - set to the same value as cosmos-sdk flags.DefaultGasLimit From 942bb8e5435adf337f55b0067213469cbf05e72a Mon Sep 17 00:00:00 2001 From: Robert Zaremba Date: Fri, 17 Nov 2023 23:16:22 +0100 Subject: [PATCH 07/21] update denom validation regexp --- app/params/app_settings.go | 5 +++++ app/params/app_settings_test.go | 17 +++++++++++++++++ app/params/prefix.go | 1 + 3 files changed, 23 insertions(+) create mode 100644 app/params/app_settings_test.go diff --git a/app/params/app_settings.go b/app/params/app_settings.go index d88d25ebfe..fe7610548a 100644 --- a/app/params/app_settings.go +++ b/app/params/app_settings.go @@ -42,4 +42,9 @@ func init() { if AccountAddressPrefix != Name { log.Fatal("AccountAddresPrefix must equal Name") } + + sdk.SetCoinDenomRegex(func() string { + // allow "ux" token. Default regexp requires denom to be at least 3 characters long. + return `[a-zA-Z][a-zA-Z0-9/:._-]{1,127}` + }) } diff --git a/app/params/app_settings_test.go b/app/params/app_settings_test.go new file mode 100644 index 0000000000..a2af99bdfb --- /dev/null +++ b/app/params/app_settings_test.go @@ -0,0 +1,17 @@ +package params + +import ( + "testing" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/assert" +) + +func TestDenoms(t *testing.T) { + assert := assert.New(t) + + assert.NoError(sdk.ValidateDenom(BondDenom)) + assert.NoError(sdk.ValidateDenom(BaseExtraDenom)) + assert.NoError(sdk.ValidateDenom(DisplayDenom)) + assert.NoError(sdk.ValidateDenom(LegacyDisplayDenom)) +} diff --git a/app/params/prefix.go b/app/params/prefix.go index db75fd93e6..cbb9145f70 100644 --- a/app/params/prefix.go +++ b/app/params/prefix.go @@ -5,6 +5,7 @@ import ( ) // AccountAddressPrefix defines the Umee network's Bech32 address prefix. +// NOTE: this must not be changed. const AccountAddressPrefix = "umee" // Account specific Bech32 prefixes. From 169f1c5273936669ed276c9b88ecc45995b16724 Mon Sep 17 00:00:00 2001 From: Robert Zaremba Date: Mon, 20 Nov 2023 15:24:00 +0100 Subject: [PATCH 08/21] rollback UX symbol to UMEE --- app/modules.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/modules.go b/app/modules.go index e34f9e8f01..14794b3e74 100644 --- a/app/modules.go +++ b/app/modules.go @@ -37,7 +37,7 @@ func umeeTokenMetadata() banktypes.Metadata { Base: appparams.BondDenom, // NOTE: must not change Name: appparams.DisplayDenom, Display: appparams.DisplayDenom, - Symbol: appparams.DisplayDenom, + Symbol: appparams.LegacyDisplayDenom, DenomUnits: []*banktypes.DenomUnit{ { Denom: appparams.BondDenom, From 51bd4b148d5ff5264b78ee4973ea9cde85c410bd Mon Sep 17 00:00:00 2001 From: Robert Zaremba Date: Wed, 3 Jan 2024 17:57:38 +0100 Subject: [PATCH 09/21] updates --- CHANGELOG.md | 6 ++++++ app/params/app_settings.go | 6 ++---- app/upgrades.go | 13 +++++++++++++ 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9c169a7d36..d83ebf669e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -46,6 +46,12 @@ Ref: https://keepachangelog.com/en/1.0.0/ ## Unreleased +### Features + +### Improvements + +- [2328](https://github.com/umee-network/umee/pull/2328) Add UX and `uux` denom aliases for UMEE. + ## v6.3.0 - 2024-01-03 ### Improvements diff --git a/app/params/app_settings.go b/app/params/app_settings.go index fe7610548a..e60dc06781 100644 --- a/app/params/app_settings.go +++ b/app/params/app_settings.go @@ -12,13 +12,11 @@ const ( // BondDenom defines the native staking token denomination. // NOTE: it is used by IBC, and must not change to avoid token migration in all IBC chains. - BondDenom = "uumee" - + BondDenom = "uumee" BaseExtraDenom = "uux" // DisplayDenom defines the name, symbol, and display value of the umee token. DisplayDenom = "UX" - // Old display name. We renamed UMEE to UX. LegacyDisplayDenom = "UMEE" @@ -44,7 +42,7 @@ func init() { } sdk.SetCoinDenomRegex(func() string { - // allow "ux" token. Default regexp requires denom to be at least 3 characters long. + // allow "ux" token. Modify the default regexp to allow 2 character long denoms. return `[a-zA-Z][a-zA-Z0-9/:._-]{1,127}` }) } diff --git a/app/upgrades.go b/app/upgrades.go index a8e98e2bfe..0185744480 100644 --- a/app/upgrades.go +++ b/app/upgrades.go @@ -60,6 +60,19 @@ func (app UmeeApp) RegisterUpgradeHandlers() { app.registerOutdatedPlaceholderUpgrade("v6.1") app.registerUpgrade6_2(upgradeInfo) app.registerUpgrade("v6.3", upgradeInfo) + + app.registerUpgrade6_4(upgradeInfo) +} + +func (app *UmeeApp) registerUpgrade6_4(upgradeInfo upgradetypes.Plan) { + app.UpgradeKeeper.SetUpgradeHandler("v6.4", + func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { + printPlanName(plan.Name, ctx.Logger()) + // Add UX denom aliases to metadata + app.BankKeeper.SetDenomMetaData(ctx, umeeTokenMetadata()) + return app.mm.RunMigrations(ctx, app.configurator, fromVM) + }, + ) } func (app *UmeeApp) registerUpgrade6_2(upgradeInfo upgradetypes.Plan) { From 14dcc13017c3e81517e03d384f6ecb2a695f14c9 Mon Sep 17 00:00:00 2001 From: Robert Zaremba Date: Wed, 3 Jan 2024 18:03:04 +0100 Subject: [PATCH 10/21] lint --- app/upgrades.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/upgrades.go b/app/upgrades.go index 0185744480..83edfc4958 100644 --- a/app/upgrades.go +++ b/app/upgrades.go @@ -64,7 +64,7 @@ func (app UmeeApp) RegisterUpgradeHandlers() { app.registerUpgrade6_4(upgradeInfo) } -func (app *UmeeApp) registerUpgrade6_4(upgradeInfo upgradetypes.Plan) { +func (app *UmeeApp) registerUpgrade6_4(_ upgradetypes.Plan) { app.UpgradeKeeper.SetUpgradeHandler("v6.4", func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { printPlanName(plan.Name, ctx.Logger()) From 964d8a28d8d04bc1eb092f959cb5a366311c6c74 Mon Sep 17 00:00:00 2001 From: Robert Zaremba Date: Wed, 3 Jan 2024 19:03:18 +0100 Subject: [PATCH 11/21] lint --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d83ebf669e..81dba2b410 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -50,7 +50,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Improvements -- [2328](https://github.com/umee-network/umee/pull/2328) Add UX and `uux` denom aliases for UMEE. +- [2328](https://github.com/umee-network/umee/pull/2328) Add UX and `uux` denom aliases for UMEE. ## v6.3.0 - 2024-01-03 From 35b76ab4fecb3affee41e14747f7e08c2ecb5dbd Mon Sep 17 00:00:00 2001 From: Robert Zaremba Date: Thu, 8 Feb 2024 18:54:55 +0100 Subject: [PATCH 12/21] use DeepEquals --- app/upgrades.go | 2 +- tests/cli/suite.go | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/upgrades.go b/app/upgrades.go index 216d5da89e..f00b04295c 100644 --- a/app/upgrades.go +++ b/app/upgrades.go @@ -60,7 +60,7 @@ func (app *UmeeApp) registerUpgrade6_4(_ upgradetypes.Plan) { // Add UX denom aliases to metadata app.BankKeeper.SetDenomMetaData(ctx, umeeTokenMetadata()) - // migrate leverage token seettings + // migrate leverage token settings tokens := app.LeverageKeeper.GetAllRegisteredTokens(ctx) for _, token := range tokens { // this will allow existing interest rate curves to pass new Token validation diff --git a/tests/cli/suite.go b/tests/cli/suite.go index 42e1972437..2993c96119 100644 --- a/tests/cli/suite.go +++ b/tests/cli/suite.go @@ -63,7 +63,8 @@ func (s *E2ESuite) RunQuery(tq TestQuery) { err = clientCtx.Codec.UnmarshalJSON(out.Bytes(), tq.Response) assert.NilError(s.T, err, tq.Name) - assert.Equal(s.T, tq.ExpectedResponse.String(), tq.Response.String(), tq.Name) + s.T.Log("query test name: ", tq.Name) + assert.DeepEqual(s.T, tq.ExpectedResponse, tq.Response) } } From f62e63a965c75530c88b24669229da6367c89a14 Mon Sep 17 00:00:00 2001 From: Robert Zaremba Date: Thu, 8 Feb 2024 22:57:58 +0100 Subject: [PATCH 13/21] fix leverage tests --- app/modules.go | 25 +------------------------ app/params/app_settings.go | 25 +++++++++++++++++++++++++ app/test_helpers.go | 8 +++++--- app/upgrades.go | 3 ++- tests/e2e/setup/setup.go | 3 ++- x/leverage/client/tests/tests.go | 8 ++++---- x/leverage/types/token.go | 5 +++-- x/oracle/abci_test.go | 2 +- 8 files changed, 43 insertions(+), 36 deletions(-) diff --git a/app/modules.go b/app/modules.go index 14794b3e74..861a20b1f8 100644 --- a/app/modules.go +++ b/app/modules.go @@ -31,32 +31,9 @@ type BankModule struct { bank.AppModuleBasic } -func umeeTokenMetadata() banktypes.Metadata { - return banktypes.Metadata{ - Description: "The native staking token of the Umee network.", - Base: appparams.BondDenom, // NOTE: must not change - Name: appparams.DisplayDenom, - Display: appparams.DisplayDenom, - Symbol: appparams.LegacyDisplayDenom, - DenomUnits: []*banktypes.DenomUnit{ - { - Denom: appparams.BondDenom, - Exponent: 0, - Aliases: []string{ - "microumee", appparams.BaseExtraDenom, - }, - }, { - Denom: appparams.DisplayDenom, - Exponent: 6, - Aliases: []string{appparams.LegacyDisplayDenom}, - }, - }, - } -} - // DefaultGenesis returns custom Umee x/bank module genesis state. func (BankModule) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { - umeeMetadata := umeeTokenMetadata() + umeeMetadata := appparams.UmeeTokenMetadata() genState := banktypes.DefaultGenesisState() genState.DenomMetadata = append(genState.DenomMetadata, umeeMetadata) diff --git a/app/params/app_settings.go b/app/params/app_settings.go index e60dc06781..530f82c253 100644 --- a/app/params/app_settings.go +++ b/app/params/app_settings.go @@ -4,6 +4,7 @@ import ( "log" sdk "github.com/cosmos/cosmos-sdk/types" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" ) const ( @@ -46,3 +47,27 @@ func init() { return `[a-zA-Z][a-zA-Z0-9/:._-]{1,127}` }) } + +// UmeeTokenMetadata creates bank Metadata for the UX token +func UmeeTokenMetadata() banktypes.Metadata { + return banktypes.Metadata{ + Description: "The native staking token of the Umee network.", + Base: BondDenom, // NOTE: must not change + Name: DisplayDenom, + Display: DisplayDenom, + Symbol: LegacyDisplayDenom, + DenomUnits: []*banktypes.DenomUnit{ + { + Denom: BondDenom, + Exponent: 0, + Aliases: []string{ + "microumee", BaseExtraDenom, + }, + }, { + Denom: DisplayDenom, + Exponent: 6, + Aliases: []string{LegacyDisplayDenom}, + }, + }, + } +} diff --git a/app/test_helpers.go b/app/test_helpers.go index 7647e3242e..b638baee7e 100644 --- a/app/test_helpers.go +++ b/app/test_helpers.go @@ -37,6 +37,7 @@ import ( stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" "github.com/umee-network/umee/v6/app/params" + appparams "github.com/umee-network/umee/v6/app/params" "github.com/umee-network/umee/v6/x/leverage/fixtures" leveragetypes "github.com/umee-network/umee/v6/x/leverage/types" oracletypes "github.com/umee-network/umee/v6/x/oracle/types" @@ -249,8 +250,9 @@ func IntegrationTestNetworkConfig() network.Config { if err := cdc.UnmarshalJSON(appGenState[leveragetypes.ModuleName], &leverageGenState); err != nil { panic(err) } + um := appparams.UmeeTokenMetadata() leverageGenState.Registry = []leveragetypes.Token{ - fixtures.Token(params.BondDenom, params.DisplayDenom, 6), + fixtures.Token(um.Base, um.Symbol, 6), } bz, err := cdc.MarshalJSON(&leverageGenState) @@ -269,12 +271,12 @@ func IntegrationTestNetworkConfig() network.Config { // are not running a price-feeder. oracleGenState.Params.VotePeriod = 1000 oracleGenState.ExchangeRates = append(oracleGenState.ExchangeRates, oracletypes.NewDenomExchangeRate( - params.DisplayDenom, sdk.MustNewDecFromStr("34.21"), time.Now())) + params.LegacyDisplayDenom, sdk.MustNewDecFromStr("34.21"), time.Now())) // Set mock historic medians to satisfy leverage module's 24 median requirement for i := 1; i <= 24; i++ { median := oracletypes.Price{ ExchangeRateTuple: oracletypes.NewExchangeRateTuple( - params.DisplayDenom, + params.LegacyDisplayDenom, sdk.MustNewDecFromStr("34.21"), ), BlockNum: uint64(i), diff --git a/app/upgrades.go b/app/upgrades.go index f00b04295c..52cc376a06 100644 --- a/app/upgrades.go +++ b/app/upgrades.go @@ -18,6 +18,7 @@ import ( stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" + appparams "github.com/umee-network/umee/v6/app/params" "github.com/umee-network/umee/v6/util" leveragetypes "github.com/umee-network/umee/v6/x/leverage/types" ) @@ -58,7 +59,7 @@ func (app *UmeeApp) registerUpgrade6_4(_ upgradetypes.Plan) { func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { printPlanName(planName, ctx.Logger()) // Add UX denom aliases to metadata - app.BankKeeper.SetDenomMetaData(ctx, umeeTokenMetadata()) + app.BankKeeper.SetDenomMetaData(ctx, appparams.UmeeTokenMetadata()) // migrate leverage token settings tokens := app.LeverageKeeper.GetAllRegisteredTokens(ctx) diff --git a/tests/e2e/setup/setup.go b/tests/e2e/setup/setup.go index a1b8fcf222..6df7a637c0 100644 --- a/tests/e2e/setup/setup.go +++ b/tests/e2e/setup/setup.go @@ -214,8 +214,9 @@ func (s *E2ETestSuite) initGenesis() { var leverageGenState leveragetypes.GenesisState s.Require().NoError(s.cdc.UnmarshalJSON(appGenState[leveragetypes.ModuleName], &leverageGenState)) + tm := appparams.UmeeTokenMetadata() leverageGenState.Registry = append(leverageGenState.Registry, - fixtures.Token(appparams.BondDenom, appparams.DisplayDenom, 6), + fixtures.Token(tm.Base, tm.Symbol, 6), fixtures.Token(ATOMBaseDenom, ATOM, uint32(ATOMExponent)), ) diff --git a/x/leverage/client/tests/tests.go b/x/leverage/client/tests/tests.go index 1420923060..86373ffd49 100644 --- a/x/leverage/client/tests/tests.go +++ b/x/leverage/client/tests/tests.go @@ -91,7 +91,7 @@ func (s *IntegrationTests) TestLeverageScenario() { Response: &types.QueryRegisteredTokensResponse{}, ExpectedResponse: &types.QueryRegisteredTokensResponse{ Registry: []types.Token{ - fixtures.Token(appparams.BondDenom, appparams.DisplayDenom, 6), + fixtures.Token(appparams.BondDenom, appparams.LegacyDisplayDenom, 6), }, }, ErrMsg: "", @@ -113,7 +113,7 @@ func (s *IntegrationTests) TestLeverageScenario() { Response: &types.QueryRegisteredTokensResponse{}, ExpectedResponse: &types.QueryRegisteredTokensResponse{ Registry: []types.Token{ - fixtures.Token(appparams.BondDenom, appparams.DisplayDenom, 6), + fixtures.Token(appparams.BondDenom, appparams.LegacyDisplayDenom, 6), }, }, ErrMsg: "", @@ -126,12 +126,12 @@ func (s *IntegrationTests) TestLeverageScenario() { }, Response: &types.QueryMarketSummaryResponse{}, ExpectedResponse: &types.QueryMarketSummaryResponse{ - SymbolDenom: "UMEE", + SymbolDenom: appparams.LegacyDisplayDenom, Exponent: 6, OraclePrice: &oracleSymbolPrice, OracleHistoricPrice: &oracleSymbolPrice, UTokenExchangeRate: sdk.OneDec(), - // Borrow rate * (1.52 - ReserveFactor - OracleRewardFactor) + // Borrow rate * (1 - ReserveFactor - OracleRewardFactor) // 1.52 * (1 - 0.2 - 0.01) = 1.2008 Supply_APY: sdk.MustNewDecFromStr("1.2008"), // This is an edge case technically - when effective supply, meaning diff --git a/x/leverage/types/token.go b/x/leverage/types/token.go index 07620dd800..1cd22fd63d 100644 --- a/x/leverage/types/token.go +++ b/x/leverage/types/token.go @@ -159,9 +159,10 @@ func (t Token) BorrowFactor() sdk.Dec { } func defaultUmeeToken() Token { + tm := appparams.UmeeTokenMetadata() return Token{ - BaseDenom: appparams.BondDenom, - SymbolDenom: "UMEE", + BaseDenom: tm.Base, + SymbolDenom: tm.Symbol, // SymbolDenom should not change Exponent: 6, EnableMsgSupply: true, EnableMsgBorrow: true, diff --git a/x/oracle/abci_test.go b/x/oracle/abci_test.go index d9b07fcc84..da74a15d2a 100644 --- a/x/oracle/abci_test.go +++ b/x/oracle/abci_test.go @@ -24,7 +24,7 @@ import ( ) const ( - displayDenom string = appparams.DisplayDenom + displayDenom string = appparams.LegacyDisplayDenom bondDenom string = appparams.BondDenom ) From 1621e952999e50eba021f8ef8cfd637d56d3028e Mon Sep 17 00:00:00 2001 From: Robert Zaremba Date: Thu, 8 Feb 2024 22:59:08 +0100 Subject: [PATCH 14/21] fix oracle cli tests --- x/oracle/client/tests/suite.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/oracle/client/tests/suite.go b/x/oracle/client/tests/suite.go index 949f389804..88c73750a8 100644 --- a/x/oracle/client/tests/suite.go +++ b/x/oracle/client/tests/suite.go @@ -177,7 +177,7 @@ func (s *IntegrationTestSuite) TestQueryExchangeRates() { s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), &res)) s.Require().Len(res.ExchangeRates, 1) - s.Require().Equal(res.ExchangeRates[0].Denom, appparams.DisplayDenom) + s.Require().Equal(res.ExchangeRates[0].Denom, appparams.LegacyDisplayDenom) s.Require().False(res.ExchangeRates[0].Amount.IsZero()) } From c54c3beff5cca894171b6cc556afa5df01b70810 Mon Sep 17 00:00:00 2001 From: Robert Zaremba Date: Thu, 8 Feb 2024 23:02:22 +0100 Subject: [PATCH 15/21] fix oracle tests --- x/oracle/keeper/keeper_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/oracle/keeper/keeper_test.go b/x/oracle/keeper/keeper_test.go index e8ce168892..e4082a6ceb 100644 --- a/x/oracle/keeper/keeper_test.go +++ b/x/oracle/keeper/keeper_test.go @@ -28,7 +28,7 @@ import ( ) const ( - displayDenom string = appparams.DisplayDenom + displayDenom string = appparams.LegacyDisplayDenom bondDenom string = appparams.BondDenom initialPower = int64(10000000000) ) From 8ac99780c48500624a5f7cc4bf64ae6a531ff65a Mon Sep 17 00:00:00 2001 From: Robert Zaremba Date: Thu, 8 Feb 2024 23:03:07 +0100 Subject: [PATCH 16/21] lint --- x/oracle/keeper/keeper_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/x/oracle/keeper/keeper_test.go b/x/oracle/keeper/keeper_test.go index e4082a6ceb..c44a849646 100644 --- a/x/oracle/keeper/keeper_test.go +++ b/x/oracle/keeper/keeper_test.go @@ -28,9 +28,9 @@ import ( ) const ( - displayDenom string = appparams.LegacyDisplayDenom - bondDenom string = appparams.BondDenom - initialPower = int64(10000000000) + displayDenom = appparams.LegacyDisplayDenom + bondDenom = appparams.BondDenom + initialPower = int64(10000000000) ) // Test addresses From 2f31a7918a157487bd3fd8ca385d366d498d8e75 Mon Sep 17 00:00:00 2001 From: Robert Zaremba Date: Thu, 8 Feb 2024 23:12:29 +0100 Subject: [PATCH 17/21] lint --- app/test_helpers.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/test_helpers.go b/app/test_helpers.go index b638baee7e..05cc83a0ab 100644 --- a/app/test_helpers.go +++ b/app/test_helpers.go @@ -37,7 +37,6 @@ import ( stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" "github.com/umee-network/umee/v6/app/params" - appparams "github.com/umee-network/umee/v6/app/params" "github.com/umee-network/umee/v6/x/leverage/fixtures" leveragetypes "github.com/umee-network/umee/v6/x/leverage/types" oracletypes "github.com/umee-network/umee/v6/x/oracle/types" @@ -250,7 +249,7 @@ func IntegrationTestNetworkConfig() network.Config { if err := cdc.UnmarshalJSON(appGenState[leveragetypes.ModuleName], &leverageGenState); err != nil { panic(err) } - um := appparams.UmeeTokenMetadata() + um := params.UmeeTokenMetadata() leverageGenState.Registry = []leveragetypes.Token{ fixtures.Token(um.Base, um.Symbol, 6), } From 587266ed732fc57bf5f225475c43ebad1dbd4f3d Mon Sep 17 00:00:00 2001 From: Robert Zaremba Date: Thu, 8 Feb 2024 23:26:40 +0100 Subject: [PATCH 18/21] lint --- .revive.toml | 2 +- app/upgrades.go | 8 ++++---- app/wasm/query/whitelist.go | 2 +- x/leverage/simulation/operations.go | 14 +++++++------- x/oracle/simulations/operations.go | 6 +++--- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/.revive.toml b/.revive.toml index 9e28bbaa97..0b071d03e8 100644 --- a/.revive.toml +++ b/.revive.toml @@ -29,7 +29,7 @@ confidence = 0 [rule.time-naming] [rule.unexported-return] [rule.unreachable-code] -[rule.unused-parameter] +#[rule.unused-parameter] [rule.var-declaration] [rule.var-naming] diff --git a/app/upgrades.go b/app/upgrades.go index 52cc376a06..0ada73f083 100644 --- a/app/upgrades.go +++ b/app/upgrades.go @@ -56,7 +56,7 @@ func (app *UmeeApp) registerUpgrade6_4(_ upgradetypes.Plan) { planName := "v6.4" app.UpgradeKeeper.SetUpgradeHandler(planName, - func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { + func(ctx sdk.Context, _ upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { printPlanName(planName, ctx.Logger()) // Add UX denom aliases to metadata app.BankKeeper.SetDenomMetaData(ctx, appparams.UmeeTokenMetadata()) @@ -85,7 +85,7 @@ func (app *UmeeApp) registerUpgrade6_0(upgradeInfo upgradetypes.Plan) { util.Panic(err) app.UpgradeKeeper.SetUpgradeHandler(planName, - func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { + func(ctx sdk.Context, _ upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { printPlanName(planName, ctx.Logger()) if err := app.LeverageKeeper.SetParams(ctx, leveragetypes.DefaultParams()); err != nil { return fromVM, err @@ -106,7 +106,7 @@ func (app *UmeeApp) registerUpgrade4_3(upgradeInfo upgradetypes.Plan) { const planName = "v4.3" app.UpgradeKeeper.SetUpgradeHandler(planName, onlyModuleMigrations(app, planName)) app.UpgradeKeeper.SetUpgradeHandler(planName, - func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { + func(ctx sdk.Context, _ upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { ctx.Logger().Info("Upgrade handler execution", "name", planName) // set the ICS27 consensus version so InitGenesis is not run @@ -151,7 +151,7 @@ func (app *UmeeApp) registerUpgrade4_3(upgradeInfo upgradetypes.Plan) { } func onlyModuleMigrations(app *UmeeApp, planName string) upgradetypes.UpgradeHandler { - return func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { + return func(ctx sdk.Context, _ upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { printPlanName(planName, ctx.Logger()) ctx.Logger().Info("-----------------------------\n-----------------------------") ctx.Logger().Info("Upgrade handler execution", "name", planName) diff --git a/app/wasm/query/whitelist.go b/app/wasm/query/whitelist.go index 710808291f..e87aa935c2 100644 --- a/app/wasm/query/whitelist.go +++ b/app/wasm/query/whitelist.go @@ -168,7 +168,7 @@ func setWhitelistedQuery(queryPath string, protoType codec.ProtoMarshaler) { func GetStargateWhitelistedPaths() (keys []string) { // Iterate over the map and collect the keys - stargateWhitelist.Range(func(key, value interface{}) bool { + stargateWhitelist.Range(func(key, _ interface{}) bool { keyStr, ok := key.(string) if !ok { panic("key is not a string") diff --git a/x/leverage/simulation/operations.go b/x/leverage/simulation/operations.go index 0c02ad6d95..3412e329a4 100644 --- a/x/leverage/simulation/operations.go +++ b/x/leverage/simulation/operations.go @@ -123,7 +123,7 @@ func WeightedOperations( func SimulateMsgSupply(ak simulation.AccountKeeper, bk bankkeeper.Keeper) simtypes.Operation { return func( r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, - accs []simtypes.Account, chainID string, + accs []simtypes.Account, _ string, ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { from, c, skip := randomSupplyFields(r, ctx, accs, bk) if skip { @@ -141,7 +141,7 @@ func SimulateMsgSupply(ak simulation.AccountKeeper, bk bankkeeper.Keeper) simtyp func SimulateMsgWithdraw(ak simulation.AccountKeeper, bk bankkeeper.Keeper, lk keeper.Keeper) simtypes.Operation { return func( r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, - accs []simtypes.Account, chainID string, + accs []simtypes.Account, _ string, ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { from, withdrawUToken, skip := randomWithdrawFields(r, ctx, accs, bk, lk) if skip { @@ -159,7 +159,7 @@ func SimulateMsgWithdraw(ak simulation.AccountKeeper, bk bankkeeper.Keeper, lk k func SimulateMsgBorrow(ak simulation.AccountKeeper, bk bankkeeper.Keeper, lk keeper.Keeper) simtypes.Operation { return func( r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, - accs []simtypes.Account, chainID string, + accs []simtypes.Account, _ string, ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { from, token, skip := randomBorrowFields(r, ctx, accs, lk) if skip { @@ -180,7 +180,7 @@ func SimulateMsgCollateralize( ) simtypes.Operation { return func( r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, - accs []simtypes.Account, chainID string, + accs []simtypes.Account, _ string, ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { from, collateral, skip := randomCollateralizeFields(r, ctx, accs, bk) if skip { @@ -202,7 +202,7 @@ func SimulateMsgDecollateralize( ) simtypes.Operation { return func( r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, - accs []simtypes.Account, chainID string, + accs []simtypes.Account, _ string, ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { from, collateral, skip := randomDecollateralizeFields(r, ctx, accs, lk) if skip { @@ -220,7 +220,7 @@ func SimulateMsgDecollateralize( func SimulateMsgRepay(ak simulation.AccountKeeper, bk bankkeeper.Keeper, lk keeper.Keeper) simtypes.Operation { return func( r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, - accs []simtypes.Account, chainID string, + accs []simtypes.Account, _ string, ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { from, repayToken, skip := randomRepayFields(r, ctx, accs, lk) if skip { @@ -238,7 +238,7 @@ func SimulateMsgRepay(ak simulation.AccountKeeper, bk bankkeeper.Keeper, lk keep func SimulateMsgLiquidate(ak simulation.AccountKeeper, bk bankkeeper.Keeper, lk keeper.Keeper) simtypes.Operation { return func( r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, - accs []simtypes.Account, chainID string, + accs []simtypes.Account, _ string, ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { liquidator, borrower, repaymentToken, rewardDenom, skip := randomLiquidateFields(r, ctx, accs, lk) if skip { diff --git a/x/oracle/simulations/operations.go b/x/oracle/simulations/operations.go index 64c832aee2..6598ed52c4 100644 --- a/x/oracle/simulations/operations.go +++ b/x/oracle/simulations/operations.go @@ -111,7 +111,7 @@ func SimulateMsgAggregateExchangeRatePrevote( voteHashMap map[string]string, ) simtypes.Operation { return func( - r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, + r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, _ string, ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { simAccount := accs[1] // , _ := simtypes.RandomAcc(r, accs) address := sdk.ValAddress(simAccount.Address) @@ -155,7 +155,7 @@ func SimulateMsgAggregateExchangeRateVote( voteHashMap map[string]string, ) simtypes.Operation { return func( - r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, + r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, _ string, ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { simAccount, _ := simtypes.RandomAcc(r, accs) address := sdk.ValAddress(simAccount.Address) @@ -197,7 +197,7 @@ func SimulateMsgAggregateExchangeRateVote( // SimulateMsgDelegateFeedConsent generates a MsgDelegateFeedConsent with random values. func SimulateMsgDelegateFeedConsent(ak types.AccountKeeper, bk bankkeeper.Keeper, k keeper.Keeper) simtypes.Operation { return func( - r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, + r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, _ string, ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { simAccount, _ := simtypes.RandomAcc(r, accs) delegateAccount, _ := simtypes.RandomAcc(r, accs) From d32e6c8144ef877626f121b296310771783a47b6 Mon Sep 17 00:00:00 2001 From: Robert Zaremba Date: Fri, 9 Feb 2024 00:09:34 +0100 Subject: [PATCH 19/21] update linter settings --- .golangci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.golangci.yml b/.golangci.yml index a5442d8097..e2c3a5c6bf 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -95,6 +95,6 @@ linters-settings: - name: time-naming - name: unexported-return - name: unreachable-code - - name: unused-parameter + # - name: unused-parameter - name: var-declaration - name: var-naming From 99f7f16fdf1f55302eb54a196ac07b5ec4a69d92 Mon Sep 17 00:00:00 2001 From: Robert Zaremba Date: Fri, 9 Feb 2024 00:31:50 +0100 Subject: [PATCH 20/21] test --- app/params/app_settings.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/params/app_settings.go b/app/params/app_settings.go index 530f82c253..02ea328170 100644 --- a/app/params/app_settings.go +++ b/app/params/app_settings.go @@ -64,9 +64,9 @@ func UmeeTokenMetadata() banktypes.Metadata { "microumee", BaseExtraDenom, }, }, { - Denom: DisplayDenom, + Denom: LegacyDisplayDenom, Exponent: 6, - Aliases: []string{LegacyDisplayDenom}, + Aliases: []string{DisplayDenom}, }, }, } From 8458588186f208a22b40da94ae4dbc7b7e19d177 Mon Sep 17 00:00:00 2001 From: Robert Zaremba Date: Fri, 9 Feb 2024 00:39:14 +0100 Subject: [PATCH 21/21] oracle tests: use LegacyDisplayDenom --- app/params/app_settings.go | 4 ++-- x/oracle/keeper/grpc_query_test.go | 2 +- x/oracle/keeper/hooks_test.go | 2 +- x/uibc/quota/intest/suite_test.go | 1 - 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/app/params/app_settings.go b/app/params/app_settings.go index 02ea328170..530f82c253 100644 --- a/app/params/app_settings.go +++ b/app/params/app_settings.go @@ -64,9 +64,9 @@ func UmeeTokenMetadata() banktypes.Metadata { "microumee", BaseExtraDenom, }, }, { - Denom: LegacyDisplayDenom, + Denom: DisplayDenom, Exponent: 6, - Aliases: []string{DisplayDenom}, + Aliases: []string{LegacyDisplayDenom}, }, }, } diff --git a/x/oracle/keeper/grpc_query_test.go b/x/oracle/keeper/grpc_query_test.go index 88672b8ef0..ea0228e235 100644 --- a/x/oracle/keeper/grpc_query_test.go +++ b/x/oracle/keeper/grpc_query_test.go @@ -118,7 +118,7 @@ func (s *IntegrationTestSuite) TestQuerier_AggregatePrevotes() { func (s *IntegrationTestSuite) TestQuerier_AggregateVote() { var tuples types.ExchangeRateTuples tuples = append(tuples, types.ExchangeRateTuple{ - Denom: appparams.DisplayDenom, + Denom: appparams.LegacyDisplayDenom, ExchangeRate: sdk.ZeroDec(), }) diff --git a/x/oracle/keeper/hooks_test.go b/x/oracle/keeper/hooks_test.go index 514704685c..0e9c3bdfbc 100644 --- a/x/oracle/keeper/hooks_test.go +++ b/x/oracle/keeper/hooks_test.go @@ -12,7 +12,7 @@ func (s *IntegrationTestSuite) TestHooks_AfterTokenRegistered() { // require that an existing token does not change the accept list h.AfterTokenRegistered(s.ctx, leveragetypes.Token{ BaseDenom: appparams.BondDenom, - SymbolDenom: appparams.DisplayDenom, + SymbolDenom: appparams.LegacyDisplayDenom, Exponent: 6, }) s.Require().Len(s.app.OracleKeeper.AcceptList(s.ctx), 1) diff --git a/x/uibc/quota/intest/suite_test.go b/x/uibc/quota/intest/suite_test.go index c8369845bd..0c7cfc9e78 100644 --- a/x/uibc/quota/intest/suite_test.go +++ b/x/uibc/quota/intest/suite_test.go @@ -28,7 +28,6 @@ import ( ) const ( - displayDenom string = appparams.DisplayDenom bondDenom string = appparams.BondDenom initialPower = int64(10000000000) )