diff --git a/app/_sim_test.go b/app/_sim_test.go index 0b75637fd1..b413eece98 100644 --- a/app/_sim_test.go +++ b/app/_sim_test.go @@ -11,9 +11,9 @@ import ( "github.com/stretchr/testify/require" - dbm "github.com/cometbft/cometbft-db" + "cosmossdk.io/log" abci "github.com/cometbft/cometbft/abci/types" - "github.com/cometbft/cometbft/libs/log" + dbm "github.com/cosmos/cosmos-db" "cosmossdk.io/simapp" "github.com/cosmos/cosmos-sdk/baseapp" diff --git a/app/ante/ante.go b/app/ante/ante.go index abc1db32b1..45d0b43e75 100644 --- a/app/ante/ante.go +++ b/app/ante/ante.go @@ -5,14 +5,14 @@ import ( "runtime/debug" errorsmod "cosmossdk.io/errors" - tmlog "github.com/cometbft/cometbft/libs/log" + tmlog "cosmossdk.io/log" + txsigning "cosmossdk.io/x/tx/signing" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" authante "github.com/cosmos/cosmos-sdk/x/auth/ante" - authsigning "github.com/cosmos/cosmos-sdk/x/auth/signing" vesting "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" - ibcante "github.com/cosmos/ibc-go/v7/modules/core/ante" - ibckeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper" + ibcante "github.com/cosmos/ibc-go/v8/modules/core/ante" + ibckeeper "github.com/cosmos/ibc-go/v8/modules/core/keeper" evmante "github.com/evmos/ethermint/app/ante" evmtypes "github.com/evmos/ethermint/x/evm/types" ) @@ -25,7 +25,7 @@ type HandlerOptions struct { IBCKeeper *ibckeeper.Keeper EvmKeeper evmante.EVMKeeper FeegrantKeeper authante.FeegrantKeeper - SignModeHandler authsigning.SignModeHandler + SignModeHandler *txsigning.HandlerMap SigGasConsumer authante.SignatureVerificationGasConsumer FeeMarketKeeper evmtypes.FeeMarketKeeper MaxTxGasWanted uint64 diff --git a/app/ante/ante_test.go b/app/ante/ante_test.go index fd4af13f18..744f987fdf 100644 --- a/app/ante/ante_test.go +++ b/app/ante/ante_test.go @@ -6,10 +6,10 @@ import ( "testing" "time" + "cosmossdk.io/log" sdkmath "cosmossdk.io/math" - tmdb "github.com/cometbft/cometbft-db" abci "github.com/cometbft/cometbft/abci/types" - "github.com/cometbft/cometbft/libs/log" + tmdb "github.com/cosmos/cosmos-db" "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/codec" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" @@ -129,12 +129,13 @@ func TestAppAnteHandler_AuthorizedMempool(t *testing.T) { txBytes, err := encodingConfig.TxConfig.TxEncoder()(stdTx) require.NoError(t, err) - res := tApp.CheckTx( - abci.RequestCheckTx{ + res, err := tApp.CheckTx( + &abci.RequestCheckTx{ Tx: txBytes, Type: abci.CheckTxType_New, }, ) + require.NoError(t, err) if tc.expectPass { require.Zero(t, res.Code, res.Log) @@ -166,13 +167,13 @@ func newBep3GenStateMulti(cdc codec.JSONCodec, deputyAddress sdk.AccAddress) app SupplyLimit: bep3types.SupplyLimit{ Limit: sdkmath.NewInt(350000000000000), TimeLimited: false, - TimeBasedLimit: sdk.ZeroInt(), + TimeBasedLimit: sdkmath.ZeroInt(), TimePeriod: time.Hour, }, Active: true, DeputyAddress: deputyAddress, FixedFee: sdkmath.NewInt(1000), - MinSwapAmount: sdk.OneInt(), + MinSwapAmount: sdkmath.OneInt(), MaxSwapAmount: sdkmath.NewInt(1000000000000), MinBlockLock: bep3types.DefaultMinBlockLock, MaxBlockLock: bep3types.DefaultMaxBlockLock, @@ -181,10 +182,10 @@ func newBep3GenStateMulti(cdc codec.JSONCodec, deputyAddress sdk.AccAddress) app }, Supplies: bep3types.AssetSupplies{ bep3types.NewAssetSupply( - sdk.NewCoin("bnb", sdk.ZeroInt()), - sdk.NewCoin("bnb", sdk.ZeroInt()), - sdk.NewCoin("bnb", sdk.ZeroInt()), - sdk.NewCoin("bnb", sdk.ZeroInt()), + sdk.NewCoin("bnb", sdkmath.ZeroInt()), + sdk.NewCoin("bnb", sdkmath.ZeroInt()), + sdk.NewCoin("bnb", sdkmath.ZeroInt()), + sdk.NewCoin("bnb", sdkmath.ZeroInt()), time.Duration(0), ), }, @@ -255,20 +256,31 @@ func TestAppAnteHandler_RejectMsgsInAuthz(t *testing.T) { txBytes, err := encodingConfig.TxConfig.TxEncoder()(stdTx) require.NoError(t, err) - resCheckTx := tApp.CheckTx( - abci.RequestCheckTx{ + resCheckTx, err := tApp.CheckTx( + &abci.RequestCheckTx{ Tx: txBytes, Type: abci.CheckTxType_New, }, ) + require.NoError(t, err) require.Equal(t, resCheckTx.Code, tc.expectedCode, resCheckTx.Log) - resDeliverTx := tApp.DeliverTx( - abci.RequestDeliverTx{ - Tx: txBytes, + //resDeliverTx := tApp.DeliverTx( + // abci.RequestDeliverTx{ + // Tx: txBytes, + // }, + //) + // TODO(boodyvo): validate if this is the correct way to test deliver tx + resDeliverTx, err := tApp.FinalizeBlock( + &abci.RequestFinalizeBlock{ + Txs: [][]byte{txBytes}, }, ) - require.Equal(t, resDeliverTx.Code, tc.expectedCode, resDeliverTx.Log) + require.NoError(t, err) + for _, tx := range resDeliverTx.TxResults { + require.Equal(t, tx.Code, tc.expectedCode, tx.Log) + } + //require.Equal(t, resDeliverTx.Code, tc.expectedCode, resDeliverTx.Log) }) } } diff --git a/app/ante/authorized.go b/app/ante/authorized.go index b9dd1403fb..48c85c605b 100644 --- a/app/ante/authorized.go +++ b/app/ante/authorized.go @@ -1,6 +1,7 @@ package ante import ( + "bytes" errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -31,29 +32,38 @@ func (amd AuthenticatedMempoolDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, if !ok { return ctx, errorsmod.Wrap(sdkerrors.ErrTxDecode, "tx must be sig verifiable tx") } - if !commonAddressesExist(sigTx.GetSigners(), amd.fetchAuthorizedAddresses(ctx)) { + signers, err := sigTx.GetSigners() + if err != nil { + return ctx, errorsmod.Wrap(sdkerrors.ErrUnauthorized, "tx contains no signers") + } + if !commonAddressesExist(signers, amd.fetchAuthorizedAddresses(ctx)) { return ctx, errorsmod.Wrap(sdkerrors.ErrUnauthorized, "tx contains no signers authorized for this mempool") } } return next(ctx, tx, simulate) } -func (amd AuthenticatedMempoolDecorator) fetchAuthorizedAddresses(ctx sdk.Context) []sdk.AccAddress { - addrs := []sdk.AccAddress{} +func (amd AuthenticatedMempoolDecorator) fetchAuthorizedAddresses(ctx sdk.Context) [][]byte { + addrs := make([][]byte, 0) for _, fetch := range amd.addressFetchers { - addrs = append(addrs, fetch(ctx)...) + addresses := fetch(ctx) + for _, addr := range addresses { + addrs = append(addrs, addr.Bytes()) + } } + return addrs } // commonAddressesExist checks if there is any intersection between two lists of addresses -func commonAddressesExist(addresses1, addresses2 []sdk.AccAddress) bool { +func commonAddressesExist(addresses1, addresses2 [][]byte) bool { for _, a1 := range addresses1 { for _, a2 := range addresses2 { - if a1.Equals(a2) { + if bytes.Equal(a1, a2) { return true } } } + return false } diff --git a/app/ante/eip712_test.go b/app/ante/eip712_test.go index 08aa0fb66d..107de20fcd 100644 --- a/app/ante/eip712_test.go +++ b/app/ante/eip712_test.go @@ -86,7 +86,14 @@ func (suite *EIP712TestSuite) createTestEIP712CosmosTxBuilder( fee := legacytx.NewStdFee(gas, gasAmount) accNumber := suite.tApp.GetAccountKeeper().GetAccount(suite.ctx, from).GetAccountNumber() - data := eip712.ConstructUntypedEIP712Data(chainId, accNumber, nonce, 0, fee, msgs, "", nil) + // chainID string, + // accnum, + // sequence, + // timeout uint64, + // fee legacytx.StdFee, + // msgs []sdk.Msg, + // memo string, + data := eip712.ConstructUntypedEIP712Data(chainId, accNumber, nonce, 0, fee, msgs, "") typedData, err := eip712.WrapTxToTypedData(ethChainId, msgs, data, &eip712.FeeDelegationOptions{ FeePayer: from, }, suite.tApp.GetEvmKeeper().GetParams(suite.ctx)) @@ -96,7 +103,7 @@ func (suite *EIP712TestSuite) createTestEIP712CosmosTxBuilder( // Sign typedData keyringSigner := tests.NewSigner(priv) - signature, pubKey, err := keyringSigner.SignByAddress(from, sigHash) + signature, pubKey, err := keyringSigner.SignByAddress(from, sigHash, signing.SignMode_SIGN_MODE_LEGACY_AMINO_JSON) suite.Require().NoError(err) signature[crypto.RecoveryIDOffset] += 27 // Transform V from 0/1 to 27/28 according to the yellow paper @@ -180,13 +187,13 @@ func (suite *EIP712TestSuite) SetupTest() { { Denom: USDCCoinDenom, Type: USDCCDPType, - LiquidationRatio: sdk.MustNewDecFromStr("1.01"), + LiquidationRatio: sdkmath.LegacyMustNewDecFromStr("1.01"), DebtLimit: sdk.NewInt64Coin("usdx", 500000000000), - StabilityFee: sdk.OneDec(), + StabilityFee: sdkmath.LegacyOneDec(), AuctionSize: sdkmath.NewIntFromUint64(10000000000), - LiquidationPenalty: sdk.MustNewDecFromStr("0.05"), + LiquidationPenalty: sdkmath.LegacyMustNewDecFromStr("0.05"), CheckCollateralizationIndexCount: sdkmath.NewInt(10), - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.01"), + KeeperRewardPercentage: sdkmath.LegacyMustNewDecFromStr("0.01"), SpotMarketID: "usdc:usd", LiquidationMarketID: "usdc:usd:30", ConversionFactor: sdkmath.NewInt(18), @@ -199,19 +206,19 @@ func (suite *EIP712TestSuite) SetupTest() { Denom: "usdx", BorrowLimit: hardtypes.BorrowLimit{ HasMaxLimit: true, - MaximumLimit: sdk.MustNewDecFromStr("100000000000"), - LoanToValue: sdk.MustNewDecFromStr("1"), + MaximumLimit: sdkmath.LegacyMustNewDecFromStr("100000000000"), + LoanToValue: sdkmath.LegacyMustNewDecFromStr("1"), }, SpotMarketID: "usdx:usd", ConversionFactor: sdkmath.NewInt(1_000_000), InterestRateModel: hardtypes.InterestRateModel{ - BaseRateAPY: sdk.MustNewDecFromStr("0.05"), - BaseMultiplier: sdk.MustNewDecFromStr("2"), - Kink: sdk.MustNewDecFromStr("0.8"), - JumpMultiplier: sdk.MustNewDecFromStr("10"), + BaseRateAPY: sdkmath.LegacyMustNewDecFromStr("0.05"), + BaseMultiplier: sdkmath.LegacyMustNewDecFromStr("2"), + Kink: sdkmath.LegacyMustNewDecFromStr("0.8"), + JumpMultiplier: sdkmath.LegacyMustNewDecFromStr("10"), }, - ReserveFactor: sdk.MustNewDecFromStr("0.05"), - KeeperRewardPercentage: sdk.ZeroDec(), + ReserveFactor: sdkmath.LegacyMustNewDecFromStr("0.05"), + KeeperRewardPercentage: sdkmath.LegacyZeroDec(), }, } @@ -243,19 +250,19 @@ func (suite *EIP712TestSuite) SetupTest() { { MarketID: "usdx:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("1.00"), + Price: sdkmath.LegacyMustNewDecFromStr("1.00"), Expiry: time.Now().Add(1 * time.Hour), }, { MarketID: "usdc:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("1.00"), + Price: sdkmath.LegacyMustNewDecFromStr("1.00"), Expiry: time.Now().Add(1 * time.Hour), }, { MarketID: "usdc:usd:30", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("1.00"), + Price: sdkmath.LegacyMustNewDecFromStr("1.00"), Expiry: time.Now().Add(1 * time.Hour), }, } @@ -287,7 +294,7 @@ func (suite *EIP712TestSuite) SetupTest() { suite.Require().NoError(err) consAddress := sdk.ConsAddress(consPriv.PubKey().Address()) - ctx := tApp.NewContext(false, tmproto.Header{ + ctx := tApp.NewContextLegacy(false, tmproto.Header{ Height: tApp.LastBlockHeight() + 1, ChainID: ChainID, Time: time.Now().UTC(), @@ -322,7 +329,7 @@ func (suite *EIP712TestSuite) SetupTest() { tApp.GetAccountKeeper().SetAccount(ctx, valAcc) _, testAddresses := app.GeneratePrivKeyAddressPairs(1) valAddr := sdk.ValAddress(testAddresses[0].Bytes()) - validator, err := stakingtypes.NewValidator(valAddr, consPriv.PubKey(), stakingtypes.Description{}) + validator, err := stakingtypes.NewValidator(valAddr.String(), consPriv.PubKey(), stakingtypes.Description{}) suite.Require().NoError(err) err = tApp.GetStakingKeeper().SetValidatorByConsAddr(ctx, validator) suite.Require().NoError(err) @@ -450,15 +457,21 @@ func (suite *EIP712TestSuite) SetupTest() { } func (suite *EIP712TestSuite) Commit() { - _ = suite.tApp.Commit() + _, err := suite.tApp.Commit() + suite.Require().NoError(err) header := suite.ctx.BlockHeader() header.Height += 1 - suite.tApp.BeginBlock(abci.RequestBeginBlock{ - Header: header, + // TODO(boodyvo): validate, as we cannot pass the header in full + suite.tApp.FinalizeBlock(&abci.RequestFinalizeBlock{ + Height: header.Height, + //Header: header, }) + //suite.tApp.BeginBlock(abci.RequestBeginBlock{ + // Header: header, + //}) // update ctx - suite.ctx = suite.tApp.NewContext(false, header) + suite.ctx = suite.tApp.NewContextLegacy(false, header) } func (suite *EIP712TestSuite) deployUSDCERC20(app app.TestApp, ctx sdk.Context) evmutiltypes.InternalEVMAddress { @@ -638,12 +651,13 @@ func (suite *EIP712TestSuite) TestEIP712Tx() { txBytes, err := encodingConfig.TxConfig.TxEncoder()(txBuilder.GetTx()) suite.Require().NoError(err) - resCheckTx := suite.tApp.CheckTx( - abci.RequestCheckTx{ + resCheckTx, err := suite.tApp.CheckTx( + &abci.RequestCheckTx{ Tx: txBytes, Type: abci.CheckTxType_New, }, ) + suite.Require().NoError(err) if !tc.failCheckTx { suite.Require().Equal(resCheckTx.Code, uint32(0), resCheckTx.Log) } else { @@ -651,11 +665,19 @@ func (suite *EIP712TestSuite) TestEIP712Tx() { suite.Require().Contains(resCheckTx.Log, tc.errMsg) } - resDeliverTx := suite.tApp.DeliverTx( - abci.RequestDeliverTx{ - Tx: txBytes, - }, - ) + resDeliverTxs, err := suite.tApp.FinalizeBlock( + &abci.RequestFinalizeBlock{ + Txs: [][]byte{txBytes}, + }) + suite.Require().NoError(err) + //resDeliverTx := suite.tApp.DeliverTx( + // abci.RequestDeliverTx{ + // Tx: txBytes, + // }, + //) + + suite.Require().Len(resDeliverTxs.TxResults, 1) + resDeliverTx := resDeliverTxs.TxResults[0] if tc.errMsg == "" { suite.Require().Equal(resDeliverTx.Code, uint32(0), resDeliverTx.Log) @@ -663,7 +685,7 @@ func (suite *EIP712TestSuite) TestEIP712Tx() { // validate user cosmos erc20/usd balance bk := suite.tApp.GetBankKeeper() amt := bk.GetBalance(suite.ctx, suite.testAddr, USDCCoinDenom) - suite.Require().Equal(sdk.ZeroInt(), amt.Amount) + suite.Require().Equal(sdkmath.ZeroInt(), amt.Amount) // validate cdp cdp, found := suite.tApp.GetCDPKeeper().GetCdpByOwnerAndCollateralType(suite.ctx, suite.testAddr, USDCCDPType) @@ -720,11 +742,18 @@ func (suite *EIP712TestSuite) TestEIP712Tx_DepositAndWithdraw() { ) txBytes, err := encodingConfig.TxConfig.TxEncoder()(txBuilder.GetTx()) suite.Require().NoError(err) - resDeliverTx := suite.tApp.DeliverTx( - abci.RequestDeliverTx{ - Tx: txBytes, - }, - ) + resDeliverTxs, err := suite.tApp.FinalizeBlock( + &abci.RequestFinalizeBlock{ + Txs: [][]byte{txBytes}, + }) + suite.Require().NoError(err) + suite.Require().Len(resDeliverTxs.TxResults, 1) + resDeliverTx := resDeliverTxs.TxResults[0] + //resDeliverTx := suite.tApp.DeliverTx( + // abci.RequestDeliverTx{ + // Tx: txBytes, + // }, + //) suite.Require().Equal(resDeliverTx.Code, uint32(0), resDeliverTx.Log) // validate hard @@ -765,11 +794,18 @@ func (suite *EIP712TestSuite) TestEIP712Tx_DepositAndWithdraw() { ) txBytes, err = encodingConfig.TxConfig.TxEncoder()(txBuilder.GetTx()) suite.Require().NoError(err) - resDeliverTx = suite.tApp.DeliverTx( - abci.RequestDeliverTx{ - Tx: txBytes, - }, - ) + resDeliverTxs, err = suite.tApp.FinalizeBlock( + &abci.RequestFinalizeBlock{ + Txs: [][]byte{txBytes}, + }) + suite.Require().NoError(err) + suite.Require().Len(resDeliverTxs.TxResults, 1) + resDeliverTx = resDeliverTxs.TxResults[0] + //resDeliverTx = suite.tApp.DeliverTx( + // abci.RequestDeliverTx{ + // Tx: txBytes, + // }, + //) suite.Require().Equal(resDeliverTx.Code, uint32(0), resDeliverTx.Log) // validate hard & cdp should be repayed @@ -781,7 +817,7 @@ func (suite *EIP712TestSuite) TestEIP712Tx_DepositAndWithdraw() { // validate user cosmos erc20/usd balance bk := suite.tApp.GetBankKeeper() amt := bk.GetBalance(suite.ctx, suite.testAddr, USDCCoinDenom) - suite.Require().Equal(sdk.ZeroInt(), amt.Amount) + suite.Require().Equal(sdkmath.ZeroInt(), amt.Amount) // validate erc20 balance coinBal, err = suite.evmutilKeeper.QueryERC20BalanceOf(suite.ctx, suite.usdcEVMAddr, suite.testEVMAddr) diff --git a/app/ante/min_gas_filter_test.go b/app/ante/min_gas_filter_test.go index b8f00df3b3..c2e7354537 100644 --- a/app/ante/min_gas_filter_test.go +++ b/app/ante/min_gas_filter_test.go @@ -28,7 +28,7 @@ func TestEvmMinGasFilter(t *testing.T) { tApp := app.NewTestApp() handler := ante.NewEvmMinGasFilter(tApp.GetEvmKeeper()) - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) tApp.GetEvmKeeper().SetParams(ctx, evmtypes.Params{ EvmDenom: "akava", }) @@ -72,7 +72,7 @@ func TestEvmMinGasFilter(t *testing.T) { for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) ctx = ctx.WithMinGasPrices(tc.minGasPrices) mmd := MockAnteHandler{} diff --git a/app/app.go b/app/app.go index 48b99709fd..41b74134e1 100644 --- a/app/app.go +++ b/app/app.go @@ -2,26 +2,29 @@ package app import ( "fmt" + "github.com/cosmos/cosmos-sdk/runtime" + "github.com/spf13/cobra" "io" stdlog "log" "net/http" "os" "path/filepath" - dbm "github.com/cometbft/cometbft-db" + "cosmossdk.io/log" abci "github.com/cometbft/cometbft/abci/types" tmjson "github.com/cometbft/cometbft/libs/json" - tmlog "github.com/cometbft/cometbft/libs/log" + dbm "github.com/cosmos/cosmos-db" "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/client" + tmservice "github.com/cosmos/cosmos-sdk/client/grpc/cmtservice" nodeservice "github.com/cosmos/cosmos-sdk/client/grpc/node" - "github.com/cosmos/cosmos-sdk/client/grpc/tmservice" "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/codec/types" "github.com/cosmos/cosmos-sdk/server/api" "github.com/cosmos/cosmos-sdk/server/config" servertypes "github.com/cosmos/cosmos-sdk/server/types" - storetypes "github.com/cosmos/cosmos-sdk/store/types" + //storetypes "github.com/cosmos/cosmos-sdk/store/types" + storetypes "cosmossdk.io/store/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" "github.com/cosmos/cosmos-sdk/version" @@ -38,9 +41,16 @@ import ( "github.com/cosmos/cosmos-sdk/x/bank" bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - "github.com/cosmos/cosmos-sdk/x/capability" - capabilitykeeper "github.com/cosmos/cosmos-sdk/x/capability/keeper" - capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" + //"github.com/cosmos/cosmos-sdk/x/capability" + //capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" + //capabilitykeeper "github.com/cosmos/cosmos-sdk/x/capability/keeper" + "cosmossdk.io/x/evidence" + evidencekeeper "cosmossdk.io/x/evidence/keeper" + evidencetypes "cosmossdk.io/x/evidence/types" + "cosmossdk.io/x/upgrade" + upgradecli "cosmossdk.io/x/upgrade/client/cli" + upgradekeeper "cosmossdk.io/x/upgrade/keeper" + upgradetypes "cosmossdk.io/x/upgrade/types" consensus "github.com/cosmos/cosmos-sdk/x/consensus" consensusparamkeeper "github.com/cosmos/cosmos-sdk/x/consensus/keeper" consensusparamtypes "github.com/cosmos/cosmos-sdk/x/consensus/types" @@ -50,9 +60,6 @@ import ( distr "github.com/cosmos/cosmos-sdk/x/distribution" distrkeeper "github.com/cosmos/cosmos-sdk/x/distribution/keeper" distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" - "github.com/cosmos/cosmos-sdk/x/evidence" - evidencekeeper "github.com/cosmos/cosmos-sdk/x/evidence/keeper" - evidencetypes "github.com/cosmos/cosmos-sdk/x/evidence/types" "github.com/cosmos/cosmos-sdk/x/genutil" genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" "github.com/cosmos/cosmos-sdk/x/gov" @@ -75,25 +82,24 @@ import ( "github.com/cosmos/cosmos-sdk/x/staking" stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - "github.com/cosmos/cosmos-sdk/x/upgrade" - upgradeclient "github.com/cosmos/cosmos-sdk/x/upgrade/client" - upgradekeeper "github.com/cosmos/cosmos-sdk/x/upgrade/keeper" - upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" - "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/packetforward" - packetforwardkeeper "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/packetforward/keeper" - packetforwardtypes "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/packetforward/types" - transfer "github.com/cosmos/ibc-go/v7/modules/apps/transfer" - ibctransferkeeper "github.com/cosmos/ibc-go/v7/modules/apps/transfer/keeper" - ibctransfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" - ibc "github.com/cosmos/ibc-go/v7/modules/core" - ibcclient "github.com/cosmos/ibc-go/v7/modules/core/02-client" - ibcclientclient "github.com/cosmos/ibc-go/v7/modules/core/02-client/client" - ibcclienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" - ibcporttypes "github.com/cosmos/ibc-go/v7/modules/core/05-port/types" - ibcexported "github.com/cosmos/ibc-go/v7/modules/core/exported" - ibckeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper" - solomachine "github.com/cosmos/ibc-go/v7/modules/light-clients/06-solomachine" - ibctm "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint" + "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v8/packetforward" + packetforwardkeeper "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v8/packetforward/keeper" + packetforwardtypes "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v8/packetforward/types" + "github.com/cosmos/ibc-go/modules/capability" + capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper" + capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" + transfer "github.com/cosmos/ibc-go/v8/modules/apps/transfer" + ibctransferkeeper "github.com/cosmos/ibc-go/v8/modules/apps/transfer/keeper" + ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" + ibc "github.com/cosmos/ibc-go/v8/modules/core" + ibcclient "github.com/cosmos/ibc-go/v8/modules/core/02-client" + ibcclientclient "github.com/cosmos/ibc-go/v8/modules/core/02-client/client/cli" + ibcclienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" + ibcporttypes "github.com/cosmos/ibc-go/v8/modules/core/05-port/types" + ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported" + ibckeeper "github.com/cosmos/ibc-go/v8/modules/core/keeper" + solomachine "github.com/cosmos/ibc-go/v8/modules/light-clients/06-solomachine" + ibctm "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint" "github.com/ethereum/go-ethereum/core/vm" evmante "github.com/evmos/ethermint/app/ante" ethermintconfig "github.com/evmos/ethermint/server/config" @@ -105,6 +111,7 @@ import ( feemarkettypes "github.com/evmos/ethermint/x/feemarket/types" "github.com/gorilla/mux" + addresscodec "github.com/cosmos/cosmos-sdk/codec/address" "github.com/kava-labs/kava/app/ante" kavaparams "github.com/kava-labs/kava/app/params" _ "github.com/kava-labs/kava/precompile/registry" // Ensure precompiles are registered when using the app module @@ -178,6 +185,11 @@ var ( // DefaultNodeHome default home directories for the application daemon DefaultNodeHome string + ac = addresscodec.NewBech32Codec(Bech32MainPrefix) + + LegacyProposalHandler = govclient.NewProposalHandler(func() *cobra.Command { return upgradecli.NewCmdSubmitUpgradeProposal(ac) }) + LegacyCancelProposalHandler = govclient.NewProposalHandler(func() *cobra.Command { return upgradecli.NewCmdSubmitCancelUpgradeProposal(ac) }) + // ModuleBasics manages simple versions of full app modules. // It's used for things such as codec registration and genesis file verification. ModuleBasics = module.NewBasicManager( @@ -189,10 +201,13 @@ var ( distr.AppModuleBasic{}, gov.NewAppModuleBasic([]govclient.ProposalHandler{ paramsclient.ProposalHandler, - upgradeclient.LegacyProposalHandler, - upgradeclient.LegacyCancelProposalHandler, - ibcclientclient.UpdateClientProposalHandler, - ibcclientclient.UpgradeProposalHandler, + LegacyProposalHandler, + LegacyCancelProposalHandler, + //upgradeclient.LegacyProposalHandler, + //upgradeclient.LegacyCancelProposalHandler, + govclient.NewProposalHandler(ibcclientclient.NewTxCmd), + //ibcclientclient.UpdateClientProposalHandler, + //ibcclientclient.UpgradeProposalHandler, kavadistclient.ProposalHandler, committeeclient.ProposalHandler, earnclient.DepositProposalHandler, @@ -368,7 +383,7 @@ func init() { // NewApp returns a reference to an initialized App. func NewApp( - logger tmlog.Logger, + logger log.Logger, db dbm.DB, homePath string, traceStore io.Writer, @@ -385,7 +400,7 @@ func NewApp( bApp.SetVersion(version.Version) bApp.SetInterfaceRegistry(interfaceRegistry) - keys := sdk.NewKVStoreKeys( + keys := storetypes.NewKVStoreKeys( authtypes.StoreKey, banktypes.StoreKey, stakingtypes.StoreKey, distrtypes.StoreKey, slashingtypes.StoreKey, packetforwardtypes.StoreKey, govtypes.StoreKey, paramstypes.StoreKey, ibcexported.StoreKey, @@ -398,8 +413,8 @@ func NewApp( savingstypes.StoreKey, earntypes.StoreKey, minttypes.StoreKey, consensusparamtypes.StoreKey, crisistypes.StoreKey, precisebanktypes.StoreKey, ) - tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey, evmtypes.TransientKey, feemarkettypes.TransientKey) - memKeys := sdk.NewMemoryStoreKeys(capabilitytypes.MemStoreKey) + tkeys := storetypes.NewTransientStoreKeys(paramstypes.TStoreKey, evmtypes.TransientKey, feemarkettypes.TransientKey) + memKeys := storetypes.NewMemoryStoreKeys(capabilitytypes.MemStoreKey) // Authority for gov proposals, using the x/gov module account address govAuthAddr := authtypes.NewModuleAddress(govtypes.ModuleName) @@ -448,9 +463,12 @@ func NewApp( earnSubspace := app.paramsKeeper.Subspace(earntypes.ModuleName) mintSubspace := app.paramsKeeper.Subspace(minttypes.ModuleName) + //authAddr := authtypes.NewModuleAddress(govtypes.ModuleName).String() + //app.ConsensusParamsKeeper = consensusparamkeeper.NewKeeper(appCodec, runtime.NewKVStoreService(keys[consensusparamtypes.StoreKey]), authAddr, runtime.EventService{}) + // set the BaseApp's parameter store - app.consensusParamsKeeper = consensusparamkeeper.NewKeeper(appCodec, keys[consensusparamtypes.StoreKey], govAuthAddrStr) - bApp.SetParamStore(&app.consensusParamsKeeper) + app.consensusParamsKeeper = consensusparamkeeper.NewKeeper(appCodec, runtime.NewKVStoreService(keys[consensusparamtypes.StoreKey]), govAuthAddrStr, runtime.EventService{}) + bApp.SetParamStore(&app.consensusParamsKeeper.ParamsStore) app.capabilityKeeper = capabilitykeeper.NewKeeper(appCodec, keys[capabilitytypes.StoreKey], memKeys[capabilitytypes.MemStoreKey]) scopedIBCKeeper := app.capabilityKeeper.ScopeToModule(ibcexported.ModuleName) @@ -460,35 +478,44 @@ func NewApp( // add keepers app.accountKeeper = authkeeper.NewAccountKeeper( appCodec, - keys[authtypes.StoreKey], + runtime.NewKVStoreService(keys[authtypes.StoreKey]), authtypes.ProtoBaseAccount, mAccPerms, + ac, sdk.GetConfig().GetBech32AccountAddrPrefix(), govAuthAddrStr, ) app.bankKeeper = bankkeeper.NewBaseKeeper( appCodec, - keys[banktypes.StoreKey], + runtime.NewKVStoreService(keys[banktypes.StoreKey]), app.accountKeeper, app.loadBlockedMaccAddrs(), govAuthAddrStr, + logger, ) + + fmt.Println("creating staking keeper") + + // ac = addresscodec.NewBech32Codec(Bech32MainPrefix) app.stakingKeeper = stakingkeeper.NewKeeper( appCodec, - keys[stakingtypes.StoreKey], + runtime.NewKVStoreService(keys[stakingtypes.StoreKey]), app.accountKeeper, app.bankKeeper, govAuthAddrStr, + // TODO(boodyvo): validate which codecs to use. Looks like for validation before it used another codec, using AccAddress + addresscodec.NewBech32Codec(Bech32PrefixValAddr), + addresscodec.NewBech32Codec(Bech32PrefixConsAddr), ) app.authzKeeper = authzkeeper.NewKeeper( - keys[authzkeeper.StoreKey], + runtime.NewKVStoreService(keys[authzkeeper.StoreKey]), appCodec, app.BaseApp.MsgServiceRouter(), app.accountKeeper, ) app.distrKeeper = distrkeeper.NewKeeper( appCodec, - keys[distrtypes.StoreKey], + runtime.NewKVStoreService(keys[distrtypes.StoreKey]), app.accountKeeper, app.bankKeeper, app.stakingKeeper, @@ -498,21 +525,22 @@ func NewApp( app.slashingKeeper = slashingkeeper.NewKeeper( appCodec, app.legacyAmino, - keys[slashingtypes.StoreKey], + runtime.NewKVStoreService(keys[slashingtypes.StoreKey]), app.stakingKeeper, govAuthAddrStr, ) app.crisisKeeper = *crisiskeeper.NewKeeper( appCodec, - keys[crisistypes.StoreKey], + runtime.NewKVStoreService(keys[crisistypes.StoreKey]), options.InvariantCheckPeriod, app.bankKeeper, authtypes.FeeCollectorName, govAuthAddrStr, + ac, ) app.upgradeKeeper = *upgradekeeper.NewKeeper( options.SkipUpgradeHeights, - keys[upgradetypes.StoreKey], + runtime.NewKVStoreService(keys[upgradetypes.StoreKey]), appCodec, homePath, app.BaseApp, @@ -520,9 +548,11 @@ func NewApp( ) app.evidenceKeeper = *evidencekeeper.NewKeeper( appCodec, - keys[evidencetypes.StoreKey], + runtime.NewKVStoreService(keys[evidencetypes.StoreKey]), app.stakingKeeper, app.slashingKeeper, + ac, + runtime.ProvideCometInfoService(), ) app.ibcKeeper = ibckeeper.NewKeeper( @@ -532,6 +562,7 @@ func NewApp( app.stakingKeeper, app.upgradeKeeper, scopedIBCKeeper, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) // Create Ethermint keepers @@ -559,7 +590,9 @@ func NewApp( ) app.evmKeeper = evmkeeper.NewKeeper( - appCodec, keys[evmtypes.StoreKey], tkeys[evmtypes.TransientKey], + appCodec, + keys[evmtypes.StoreKey], + tkeys[evmtypes.TransientKey], govAuthAddr, app.accountKeeper, app.precisebankKeeper, // x/precisebank in place of x/bank @@ -590,10 +623,11 @@ func NewApp( ibctransferSubspace, app.packetForwardKeeper, app.ibcKeeper.ChannelKeeper, - &app.ibcKeeper.PortKeeper, + app.ibcKeeper.PortKeeper, app.accountKeeper, app.bankKeeper, scopedTransferKeeper, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) app.packetForwardKeeper.SetTransferKeeper(app.transferKeeper) transferModule := transfer.NewAppModule(app.transferKeeper) @@ -709,7 +743,7 @@ func NewApp( app.mintKeeper = mintkeeper.NewKeeper( appCodec, - keys[minttypes.StoreKey], + runtime.NewKVStoreService(keys[minttypes.StoreKey]), app.stakingKeeper, app.accountKeeper, app.bankKeeper, @@ -760,8 +794,9 @@ func NewApp( committeeGovRouter. AddRoute(govtypes.RouterKey, govv1beta1.ProposalHandler). AddRoute(communitytypes.RouterKey, community.NewCommunityPoolProposalHandler(app.communityKeeper)). - AddRoute(paramproposal.RouterKey, params.NewParamChangeProposalHandler(app.paramsKeeper)). - AddRoute(upgradetypes.RouterKey, upgrade.NewSoftwareUpgradeProposalHandler(&app.upgradeKeeper)) + AddRoute(paramproposal.RouterKey, params.NewParamChangeProposalHandler(app.paramsKeeper)) + // TODO(boodyvo): check the message updates. Looks like this one if not needed anymore. + //AddRoute(upgradetypes.RouterKey, upgrade.NewSoftwareUpgradeProposalHandler(&app.upgradeKeeper)) // Note: the committee proposal handler is not registered on the committee router. This means committees cannot create or update other committees. // Adding the committee proposal handler to the router is possible but awkward as the handler depends on the keeper which depends on the handler. app.committeeKeeper = committeekeeper.NewKeeper( @@ -793,7 +828,8 @@ func NewApp( govRouter. AddRoute(govtypes.RouterKey, govv1beta1.ProposalHandler). AddRoute(paramproposal.RouterKey, params.NewParamChangeProposalHandler(app.paramsKeeper)). - AddRoute(upgradetypes.RouterKey, upgrade.NewSoftwareUpgradeProposalHandler(&app.upgradeKeeper)). + // TODO(boodyvo): check the message updates. Looks like this one if not needed anymore. + //AddRoute(upgradetypes.RouterKey, upgrade.NewSoftwareUpgradeProposalHandler(&app.upgradeKeeper)). AddRoute(ibcclienttypes.RouterKey, ibcclient.NewClientProposalHandler(app.ibcKeeper.ClientKeeper)). AddRoute(kavadisttypes.RouterKey, kavadist.NewCommunityPoolMultiSpendProposalHandler(app.kavadistKeeper)). AddRoute(earntypes.RouterKey, earn.NewCommunityPoolProposalHandler(app.earnKeeper)). @@ -803,10 +839,11 @@ func NewApp( govConfig := govtypes.DefaultConfig() govKeeper := govkeeper.NewKeeper( appCodec, - keys[govtypes.StoreKey], + runtime.NewKVStoreService(keys[govtypes.StoreKey]), app.accountKeeper, app.bankKeeper, app.stakingKeeper, + app.distrKeeper, app.MsgServiceRouter(), govConfig, govAuthAddrStr, @@ -818,13 +855,17 @@ func NewApp( tallyHandler := NewTallyHandler( app.govKeeper, *app.stakingKeeper, app.savingsKeeper, app.earnKeeper, app.liquidKeeper, app.bankKeeper, + addresscodec.NewBech32Codec(Bech32PrefixValAddr), ) app.govKeeper.SetTallyHandler(tallyHandler) + fmt.Println("going to initialize the module manager") + // create the module manager (Note: Any module instantiated in the module manager that is later modified // must be passed by reference here.) app.mm = module.NewManager( - genutil.NewAppModule(app.accountKeeper, app.stakingKeeper, app.BaseApp.DeliverTx, encodingConfig.TxConfig), + // TODO(boodyvo): deliverTx -> app is in sdk ? + genutil.NewAppModule(app.accountKeeper, app.stakingKeeper, app, encodingConfig.TxConfig), auth.NewAppModule(appCodec, app.accountKeeper, authsims.RandomGenesisAccounts, authSubspace), bank.NewAppModule(appCodec, app.bankKeeper, app.accountKeeper, bankSubspace), capability.NewAppModule(appCodec, *app.capabilityKeeper, false), // todo: confirm if this is okay to not be sealed @@ -833,13 +874,13 @@ func NewApp( gov.NewAppModule(appCodec, &app.govKeeper, app.accountKeeper, app.bankKeeper, govSubspace), params.NewAppModule(app.paramsKeeper), crisis.NewAppModule(&app.crisisKeeper, options.SkipGenesisInvariants, crisisSubspace), - slashing.NewAppModule(appCodec, app.slashingKeeper, app.accountKeeper, app.bankKeeper, app.stakingKeeper, slashingSubspace), + slashing.NewAppModule(appCodec, app.slashingKeeper, app.accountKeeper, app.bankKeeper, app.stakingKeeper, slashingSubspace, app.interfaceRegistry), consensus.NewAppModule(appCodec, app.consensusParamsKeeper), ibc.NewAppModule(app.ibcKeeper), packetforward.NewAppModule(app.packetForwardKeeper, packetforwardSubspace), evm.NewAppModule(app.evmKeeper, app.accountKeeper), feemarket.NewAppModule(app.feeMarketKeeper, feemarketSubspace), - upgrade.NewAppModule(&app.upgradeKeeper), + upgrade.NewAppModule(&app.upgradeKeeper, ac), evidence.NewAppModule(app.evidenceKeeper), transferModule, vesting.NewAppModule(app.accountKeeper, app.bankKeeper), @@ -867,11 +908,15 @@ func NewApp( precisebank.NewAppModule(app.precisebankKeeper, app.bankKeeper, app.accountKeeper), ) + // NOTE: upgrade module is required to be prioritized + app.mm.SetOrderPreBlockers( + // Upgrade begin blocker runs migrations on the first block after an upgrade. It should run before any other module. + upgradetypes.ModuleName, + ) + // Warning: Some begin blockers must run before others. Ensure the dependencies are understood before modifying this list. app.mm.SetOrderBeginBlockers( metricstypes.ModuleName, - // Upgrade begin blocker runs migrations on the first block after an upgrade. It should run before any other module. - upgradetypes.ModuleName, // Capability begin blocker runs non state changing initialization. capabilitytypes.ModuleName, // Committee begin blocker changes module params by enacting proposals. @@ -923,6 +968,8 @@ func NewApp( precisebanktypes.ModuleName, ) + app.SetPreBlocker(app.PreBlocker) + // Warning: Some end blockers must run before others. Ensure the dependencies are understood before modifying this list. app.mm.SetOrderEndBlockers( crisistypes.ModuleName, @@ -969,6 +1016,8 @@ func NewApp( precisebanktypes.ModuleName, ) + fmt.Println("going to set the order init genesis") + // Warning: Some init genesis methods must run before others. Ensure the dependencies are understood before modifying this list app.mm.SetOrderInitGenesis( capabilitytypes.ModuleName, // initialize capabilities, run before any module creating or claiming capabilities in InitGenesis @@ -1014,6 +1063,8 @@ func NewApp( crisistypes.ModuleName, // runs the invariants at genesis, should run after other modules ) + fmt.Println("going to set the order export genesis") + app.mm.RegisterInvariants(&app.crisisKeeper) app.configurator = module.NewConfigurator(app.appCodec, app.MsgServiceRouter(), app.GRPCQueryRouter()) @@ -1074,6 +1125,8 @@ func NewApp( panic(fmt.Sprintf("failed to create antehandler: %s", err)) } + fmt.Println("setting different setters") + app.SetAnteHandler(antehandler) app.SetInitChainer(app.InitChainer) app.SetBeginBlocker(app.BeginBlocker) @@ -1089,6 +1142,8 @@ func NewApp( app.ScopedIBCKeeper = scopedIBCKeeper app.ScopedTransferKeeper = scopedTransferKeeper + fmt.Println("returning app") + return app } @@ -1097,17 +1152,22 @@ func (app *App) RegisterServices(cfg module.Configurator) { } // BeginBlocker contains app specific logic for the BeginBlock abci call. -func (app *App) BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock) abci.ResponseBeginBlock { - return app.mm.BeginBlock(ctx, req) +func (app *App) BeginBlocker(ctx sdk.Context) (sdk.BeginBlock, error) { + return app.mm.BeginBlock(ctx) } // EndBlocker contains app specific logic for the EndBlock abci call. -func (app *App) EndBlocker(ctx sdk.Context, req abci.RequestEndBlock) abci.ResponseEndBlock { - return app.mm.EndBlock(ctx, req) +func (app *App) EndBlocker(ctx sdk.Context) (sdk.EndBlock, error) { + return app.mm.EndBlock(ctx) +} + +// TODO(boodyvo): check what is this and why do we ignore req +func (app *App) PreBlocker(ctx sdk.Context, req *abci.RequestFinalizeBlock) (*sdk.ResponsePreBlock, error) { + return app.mm.PreBlock(ctx) } // InitChainer contains app specific logic for the InitChain abci call. -func (app *App) InitChainer(ctx sdk.Context, req abci.RequestInitChain) abci.ResponseInitChain { +func (app *App) InitChainer(ctx sdk.Context, req *abci.RequestInitChain) (*abci.ResponseInitChain, error) { var genesisState GenesisState if err := tmjson.Unmarshal(req.AppStateBytes, &genesisState); err != nil { panic(err) @@ -1208,8 +1268,8 @@ func (app *App) RegisterTendermintService(clientCtx client.Context) { ) } -func (app *App) RegisterNodeService(clientCtx client.Context) { - nodeservice.RegisterNodeService(clientCtx, app.BaseApp.GRPCQueryRouter()) +func (app *App) RegisterNodeService(clientCtx client.Context, cfg config.Config) { + nodeservice.RegisterNodeService(clientCtx, app.BaseApp.GRPCQueryRouter(), cfg) } // loadBlockedMaccAddrs returns a map indicating the blocked status of each module account address diff --git a/app/app_test.go b/app/app_test.go index 5d503b75b6..802d53acbd 100644 --- a/app/app_test.go +++ b/app/app_test.go @@ -3,22 +3,21 @@ package app import ( "encoding/json" "fmt" - "os" "sort" "testing" "time" - db "github.com/cometbft/cometbft-db" + "cosmossdk.io/log" abci "github.com/cometbft/cometbft/abci/types" - "github.com/cometbft/cometbft/libs/log" + db "github.com/cosmos/cosmos-db" "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/testutil/sims" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx" vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" - solomachine "github.com/cosmos/ibc-go/v7/modules/light-clients/06-solomachine" - ibctm "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint" + solomachine "github.com/cosmos/ibc-go/v8/modules/light-clients/06-solomachine" + ibctm "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint" "github.com/ethereum/go-ethereum/precompile/modules" evmtypes "github.com/evmos/ethermint/x/evm/types" "github.com/stretchr/testify/assert" @@ -28,7 +27,8 @@ import ( func TestNewApp(t *testing.T) { SetSDKConfig() NewApp( - log.NewTMLogger(log.NewSyncWriter(os.Stdout)), + log.NewTestLogger(t), + //log.NewTMLogger(log.NewSyncWriter(os.Stdout)), db.NewMemDB(), DefaultNodeHome, nil, @@ -40,14 +40,17 @@ func TestNewApp(t *testing.T) { func TestExport(t *testing.T) { SetSDKConfig() db := db.NewMemDB() - app := NewApp(log.NewTMLogger(log.NewSyncWriter(os.Stdout)), db, DefaultNodeHome, nil, MakeEncodingConfig(), DefaultOptions, baseapp.SetChainID(TestChainId)) + app := NewApp( + log.NewTestLogger(t), + //log.NewTMLogger(log.NewSyncWriter(os.Stdout)), + db, DefaultNodeHome, nil, MakeEncodingConfig(), DefaultOptions, baseapp.SetChainID(TestChainId)) genesisState := GenesisStateWithSingleValidator(&TestApp{App: *app}, NewDefaultGenesisState()) stateBytes, err := json.Marshal(genesisState) require.NoError(t, err) - initRequest := abci.RequestInitChain{ + initRequest := &abci.RequestInitChain{ Time: time.Date(1998, 1, 1, 0, 0, 0, 0, time.UTC), ChainId: TestChainId, InitialHeight: 1, @@ -58,16 +61,24 @@ func TestExport(t *testing.T) { app.InitChain(initRequest) app.Commit() + fmt.Println("Exporting genesis...") + exportedApp, err := app.ExportAppStateAndValidators(false, []string{}, []string{}) require.NoError(t, err) + fmt.Println("Exported genesis") + // Assume each module is exported correctly, so only check modules in genesis are present in export initialModules, err := unmarshalJSONKeys(initRequest.AppStateBytes) require.NoError(t, err) + + fmt.Println("Initial modules") // note ibctm is only registered in the BasicManager and not module manager so can be ignored initialModules = removeIbcTmModule(initialModules) exportedModules, err := unmarshalJSONKeys(exportedApp.AppState) require.NoError(t, err) + + fmt.Println("Exported modules") assert.ElementsMatch(t, initialModules, exportedModules) assert.Equal(t, initRequest.InitialHeight+1, exportedApp.Height) // app.Commit() increments height diff --git a/app/export.go b/app/export.go index b90f0ce5fe..2174e3504d 100644 --- a/app/export.go +++ b/app/export.go @@ -1,10 +1,11 @@ package app import ( + storetypes "cosmossdk.io/store/types" "encoding/json" - "log" - + "fmt" tmproto "github.com/cometbft/cometbft/proto/tendermint/types" + "log" servertypes "github.com/cosmos/cosmos-sdk/server/types" sdk "github.com/cosmos/cosmos-sdk/types" @@ -18,15 +19,23 @@ func (app *App) ExportAppStateAndValidators(forZeroHeight bool, jailWhiteList [] ) (servertypes.ExportedApp, error) { // as if they could withdraw from the start of the next block // block time is not available and defaults to Jan 1st, 0001 - ctx := app.NewContext(true, tmproto.Header{Height: app.LastBlockHeight()}) + ctx := app.NewContextLegacy(true, tmproto.Header{Height: app.LastBlockHeight()}) + fmt.Println("Exporting genesis 0") height := app.LastBlockHeight() + 1 if forZeroHeight { height = 0 app.prepForZeroHeightGenesis(ctx, jailWhiteList) } - genState := app.mm.ExportGenesisForModules(ctx, app.appCodec, modulesToExport) + fmt.Println("Exporting genesis after zero height...") + + genState, err := app.mm.ExportGenesisForModules(ctx, app.appCodec, modulesToExport) + fmt.Println("Exporting genesis 1: ", genState) + fmt.Println("Exporting genesis 1 err: ", err) + if err != nil { + return servertypes.ExportedApp{}, err + } newAppState, err := json.MarshalIndent(genState, "", " ") if err != nil { return servertypes.ExportedApp{}, err @@ -40,6 +49,7 @@ func (app *App) ExportAppStateAndValidators(forZeroHeight bool, jailWhiteList [] }, err } +// TODO(boodyvo): should we return error here? // prepare for fresh start at zero height // NOTE zero height genesis is a temporary feature which will be deprecated // in favour of export at a block height @@ -68,12 +78,15 @@ func (app *App) prepForZeroHeightGenesis(ctx sdk.Context, jailWhiteList []string // withdraw all validator commission app.stakingKeeper.IterateValidators(ctx, func(_ int64, val stakingtypes.ValidatorI) (stop bool) { - _, _ = app.distrKeeper.WithdrawValidatorCommission(ctx, val.GetOperator()) + _, _ = app.distrKeeper.WithdrawValidatorCommission(ctx, []byte(val.GetOperator())) return false }) // withdraw all delegator rewards - dels := app.stakingKeeper.GetAllDelegations(ctx) + dels, err := app.stakingKeeper.GetAllDelegations(ctx) + if err != nil { + log.Fatal(err) + } for _, delegation := range dels { valAddr, err := sdk.ValAddressFromBech32(delegation.ValidatorAddress) if err != nil { @@ -100,12 +113,16 @@ func (app *App) prepForZeroHeightGenesis(ctx sdk.Context, jailWhiteList []string // reinitialize all validators app.stakingKeeper.IterateValidators(ctx, func(_ int64, val stakingtypes.ValidatorI) (stop bool) { // donate any unwithdrawn outstanding reward fraction tokens to the community pool - scraps := app.distrKeeper.GetValidatorOutstandingRewardsCoins(ctx, val.GetOperator()) + scraps, err := app.distrKeeper.GetValidatorOutstandingRewardsCoins(ctx, []byte(val.GetOperator())) + if err != nil { + // TODO(boodyvo): false or panic? + return false + } feePool := app.distrKeeper.GetFeePool(ctx) feePool.CommunityPool = feePool.CommunityPool.Add(scraps...) app.distrKeeper.SetFeePool(ctx, feePool) - app.distrKeeper.Hooks().AfterValidatorCreated(ctx, val.GetOperator()) + app.distrKeeper.Hooks().AfterValidatorCreated(ctx, []byte(val.GetOperator())) return false }) @@ -149,13 +166,13 @@ func (app *App) prepForZeroHeightGenesis(ctx sdk.Context, jailWhiteList []string // Iterate through validators by power descending, reset bond heights, and // update bond intra-tx counters. store := ctx.KVStore(app.keys[stakingtypes.StoreKey]) - iter := sdk.KVStoreReversePrefixIterator(store, stakingtypes.ValidatorsKey) + iter := storetypes.KVStoreReversePrefixIterator(store, stakingtypes.ValidatorsKey) counter := int16(0) for ; iter.Valid(); iter.Next() { addr := sdk.ValAddress(stakingtypes.AddressFromValidatorsKey(iter.Key())) - validator, found := app.stakingKeeper.GetValidator(ctx, addr) - if !found { + validator, err := app.stakingKeeper.GetValidator(ctx, addr) + if err != nil { panic("expected validator, not found") } @@ -170,7 +187,7 @@ func (app *App) prepForZeroHeightGenesis(ctx sdk.Context, jailWhiteList []string iter.Close() - _, err := app.stakingKeeper.ApplyAndReturnValidatorSetUpdates(ctx) + _, err = app.stakingKeeper.ApplyAndReturnValidatorSetUpdates(ctx) if err != nil { log.Fatal(err) } diff --git a/app/tally_handler.go b/app/tally_handler.go index 5a341c7e34..d81aa42963 100644 --- a/app/tally_handler.go +++ b/app/tally_handler.go @@ -1,6 +1,8 @@ package app import ( + "context" + addresscodec "cosmossdk.io/core/address" sdkmath "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" @@ -18,56 +20,84 @@ var _ govv1.TallyHandler = TallyHandler{} // TallyHandler is the tally handler for kava type TallyHandler struct { - gk govkeeper.Keeper - stk stakingkeeper.Keeper - svk savingskeeper.Keeper - ek earnkeeper.Keeper - lk liquidkeeper.Keeper - bk bankkeeper.Keeper + gk govkeeper.Keeper + stk stakingkeeper.Keeper + svk savingskeeper.Keeper + ek earnkeeper.Keeper + lk liquidkeeper.Keeper + bk bankkeeper.Keeper + validatorAddressCodec addresscodec.Codec } // NewTallyHandler creates a new tally handler. func NewTallyHandler( gk govkeeper.Keeper, stk stakingkeeper.Keeper, svk savingskeeper.Keeper, ek earnkeeper.Keeper, lk liquidkeeper.Keeper, bk bankkeeper.Keeper, + validatorAddressCodec addresscodec.Codec, ) TallyHandler { + if validatorAddressCodec == nil { + panic("validator address codec is nil") + } + return TallyHandler{ - gk: gk, - stk: stk, - svk: svk, - ek: ek, - lk: lk, - bk: bk, + gk: gk, + stk: stk, + svk: svk, + ek: ek, + lk: lk, + bk: bk, + validatorAddressCodec: validatorAddressCodec, } } +// need the method: Tally(context.Context, Proposal) (passes bool, burnDeposits bool, tallyResults TallyResult, err error) +// have the method: Tally(ctx context.Context, proposal govv1.Proposal) (passes bool, burnDeposits bool, tallyResults govv1.TallyResult) + func (th TallyHandler) Tally( - ctx sdk.Context, + ctx context.Context, proposal govv1.Proposal, -) (passes bool, burnDeposits bool, tallyResults govv1.TallyResult) { - results := make(map[govv1.VoteOption]sdk.Dec) - results[govv1.OptionYes] = sdk.ZeroDec() - results[govv1.OptionAbstain] = sdk.ZeroDec() - results[govv1.OptionNo] = sdk.ZeroDec() - results[govv1.OptionNoWithVeto] = sdk.ZeroDec() - - totalVotingPower := sdk.ZeroDec() +) (passes bool, burnDeposits bool, tallyResults govv1.TallyResult, err error) { + results := make(map[govv1.VoteOption]sdkmath.LegacyDec) + results[govv1.OptionYes] = sdkmath.LegacyZeroDec() + results[govv1.OptionAbstain] = sdkmath.LegacyZeroDec() + results[govv1.OptionNo] = sdkmath.LegacyZeroDec() + results[govv1.OptionNoWithVeto] = sdkmath.LegacyZeroDec() + + totalVotingPower := sdkmath.LegacyZeroDec() currValidators := make(map[string]govv1.ValidatorGovInfo) // fetch all the bonded validators, insert them into currValidators th.stk.IterateBondedValidatorsByPower(ctx, func(index int64, validator stakingtypes.ValidatorI) (stop bool) { - currValidators[validator.GetOperator().String()] = govv1.NewValidatorGovInfo( - validator.GetOperator(), + validatorAddr, err := th.validatorAddressCodec.StringToBytes(validator.GetOperator()) + if err != nil { + // TODO(boodyvo): What should we do here: skip or stop? + panic(err) + } + currValidators[validator.GetOperator()] = govv1.NewValidatorGovInfo( + validatorAddr, validator.GetBondedTokens(), validator.GetDelegatorShares(), - sdk.ZeroDec(), + sdkmath.LegacyZeroDec(), govv1.WeightedVoteOptions{}, ) return false }) - th.gk.IterateVotes(ctx, proposal.Id, func(vote govv1.Vote) bool { + // Cannot use 'func(key []byte, value []byte) bool { }' (type func(key []byte, value []byte) bool) as the type Order + iterator, err := th.gk.Votes.Iterate(ctx, nil) + if err != nil { + panic(err) + } + + sdkCtx := sdk.UnwrapSDKContext(ctx) + + for ; iterator.Valid(); iterator.Next() { + vote, err := iterator.Value() + if err != nil { + panic(err) + } + // if validator, just record it in the map voter, err := sdk.AccAddressFromBech32(vote.Voter) @@ -83,7 +113,7 @@ func (th TallyHandler) Tally( // iterate over all delegations from voter, deduct from any delegated-to validators th.stk.IterateDelegations(ctx, voter, func(index int64, delegation stakingtypes.DelegationI) (stop bool) { - valAddrStr := delegation.GetValidatorAddr().String() + valAddrStr := delegation.GetValidatorAddr() if val, ok := currValidators[valAddrStr]; ok { // There is no need to handle the special case that validator address equal to voter address. @@ -95,7 +125,7 @@ func (th TallyHandler) Tally( votingPower := delegation.GetShares().MulInt(val.BondedTokens).Quo(val.DelegatorShares) for _, option := range vote.Options { - subPower := votingPower.Mul(sdk.MustNewDecFromStr(option.Weight)) + subPower := votingPower.Mul(sdkmath.LegacyMustNewDecFromStr(option.Weight)) results[option.Option] = results[option.Option].Add(subPower) } totalVotingPower = totalVotingPower.Add(votingPower) @@ -105,7 +135,7 @@ func (th TallyHandler) Tally( }) // get voter bkava and update total voting power and results - addrBkava := th.getAddrBkava(ctx, voter).toCoins() + addrBkava := th.getAddrBkava(sdkCtx, voter).toCoins() for _, coin := range addrBkava { valAddr, err := liquidtypes.ParseLiquidStakingTokenDenom(coin.Denom) if err != nil { @@ -115,28 +145,110 @@ func (th TallyHandler) Tally( // reduce delegator shares by the amount of voter bkava for the validator valAddrStr := valAddr.String() if val, ok := currValidators[valAddrStr]; ok { - val.DelegatorDeductions = val.DelegatorDeductions.Add(sdk.NewDecFromInt(coin.Amount)) + val.DelegatorDeductions = val.DelegatorDeductions.Add(sdkmath.LegacyNewDecFromInt(coin.Amount)) currValidators[valAddrStr] = val } // votingPower = amount of ukava coin - stakedCoins, err := th.lk.GetStakedTokensForDerivatives(ctx, sdk.NewCoins(coin)) + stakedCoins, err := th.lk.GetStakedTokensForDerivatives(sdkCtx, sdk.NewCoins(coin)) if err != nil { // error is returned only if the bkava denom is incorrect, which should never happen here. panic(err) } - votingPower := sdk.NewDecFromInt(stakedCoins.Amount) + votingPower := sdkmath.LegacyNewDecFromInt(stakedCoins.Amount) for _, option := range vote.Options { - subPower := votingPower.Mul(sdk.MustNewDecFromStr(option.Weight)) + subPower := votingPower.Mul(sdkmath.LegacyMustNewDecFromStr(option.Weight)) results[option.Option] = results[option.Option].Add(subPower) } totalVotingPower = totalVotingPower.Add(votingPower) } - th.gk.DeleteVote(ctx, vote.ProposalId, voter) - return false - }) + // TODO(boodyvo): check here. This one deletes all votes from proposal ID, not just particular one + th.gk.DeleteVote(ctx, vote.ProposalId) + } + + iterator, err = th.gk.Votes.Iterate(ctx, nil) + if err != nil { + panic(err) + } + + for ; iterator.Valid(); iterator.Next() { + vote, err := iterator.Value() + if err != nil { + panic(err) + } + // if validator, just record it in the map + voter, err := sdk.AccAddressFromBech32(vote.Voter) + + if err != nil { + panic(err) + } + + valAddrStr := sdk.ValAddress(voter.Bytes()).String() + if val, ok := currValidators[valAddrStr]; ok { + val.Vote = vote.Options + currValidators[valAddrStr] = val + } + + // iterate over all delegations from voter, deduct from any delegated-to validators + th.stk.IterateDelegations(ctx, voter, func(index int64, delegation stakingtypes.DelegationI) (stop bool) { + valAddrStr := delegation.GetValidatorAddr() + + if val, ok := currValidators[valAddrStr]; ok { + // There is no need to handle the special case that validator address equal to voter address. + // Because voter's voting power will tally again even if there will deduct voter's voting power from validator. + val.DelegatorDeductions = val.DelegatorDeductions.Add(delegation.GetShares()) + currValidators[valAddrStr] = val + + // delegation shares * bonded / total shares + votingPower := delegation.GetShares().MulInt(val.BondedTokens).Quo(val.DelegatorShares) + + for _, option := range vote.Options { + subPower := votingPower.Mul(sdkmath.LegacyMustNewDecFromStr(option.Weight)) + results[option.Option] = results[option.Option].Add(subPower) + } + totalVotingPower = totalVotingPower.Add(votingPower) + } + + return false + }) + + // get voter bkava and update total voting power and results + addrBkava := th.getAddrBkava(sdkCtx, voter).toCoins() + for _, coin := range addrBkava { + valAddr, err := liquidtypes.ParseLiquidStakingTokenDenom(coin.Denom) + if err != nil { + break + } + + // reduce delegator shares by the amount of voter bkava for the validator + valAddrStr := valAddr.String() + if val, ok := currValidators[valAddrStr]; ok { + val.DelegatorDeductions = val.DelegatorDeductions.Add(sdkmath.LegacyNewDecFromInt(coin.Amount)) + currValidators[valAddrStr] = val + } + + // votingPower = amount of ukava coin + stakedCoins, err := th.lk.GetStakedTokensForDerivatives(sdkCtx, sdk.NewCoins(coin)) + if err != nil { + // error is returned only if the bkava denom is incorrect, which should never happen here. + panic(err) + } + votingPower := sdkmath.LegacyNewDecFromInt(stakedCoins.Amount) + + for _, option := range vote.Options { + subPower := votingPower.Mul(sdkmath.LegacyMustNewDecFromStr(option.Weight)) + results[option.Option] = results[option.Option].Add(subPower) + } + totalVotingPower = totalVotingPower.Add(votingPower) + } + + // TODO(boodyvo): check this one. This switch to removed all votes, + //th.gk.DeleteVote(ctx, vote.ProposalId, voter) + th.gk.DeleteVote(ctx, vote.ProposalId) + //return false + } // iterate over the validators again to tally their voting power for _, val := range currValidators { @@ -148,44 +260,56 @@ func (th TallyHandler) Tally( votingPower := sharesAfterDeductions.MulInt(val.BondedTokens).Quo(val.DelegatorShares) for _, option := range val.Vote { - subPower := votingPower.Mul(sdk.MustNewDecFromStr(option.Weight)) + subPower := votingPower.Mul(sdkmath.LegacyMustNewDecFromStr(option.Weight)) results[option.Option] = results[option.Option].Add(subPower) } totalVotingPower = totalVotingPower.Add(votingPower) } - tallyParams := th.gk.GetParams(ctx) + tallyParams, err := th.gk.Params.Get(ctx) + if err != nil { + return false, false, govv1.TallyResult{}, err + } tallyResults = govv1.NewTallyResultFromMap(results) + totalBondedTokens, err := th.stk.TotalBondedTokens(ctx) + if err != nil { + return false, false, tallyResults, err + } // TODO: Upgrade the spec to cover all of these cases & remove pseudocode. // If there is no staked coins, the proposal fails - if th.stk.TotalBondedTokens(ctx).IsZero() { - return false, false, tallyResults + if totalBondedTokens.IsZero() { + // TODO(boodyvo): return particular error + return false, false, tallyResults, nil } // If there is not enough quorum of votes, the proposal fails - percentVoting := totalVotingPower.Quo(sdk.NewDecFromInt(th.stk.TotalBondedTokens(ctx))) - if percentVoting.LT(sdk.MustNewDecFromStr(tallyParams.Quorum)) { - return false, tallyParams.BurnVoteQuorum, tallyResults + percentVoting := totalVotingPower.Quo(sdkmath.LegacyNewDecFromInt(totalBondedTokens)) + if percentVoting.LT(sdkmath.LegacyMustNewDecFromStr(tallyParams.Quorum)) { + // TODO(boodyvo): return particular error + return false, tallyParams.BurnVoteQuorum, tallyResults, nil } // If no one votes (everyone abstains), proposal fails - if totalVotingPower.Sub(results[govv1.OptionAbstain]).Equal(sdk.ZeroDec()) { - return false, false, tallyResults + if totalVotingPower.Sub(results[govv1.OptionAbstain]).Equal(sdkmath.LegacyZeroDec()) { + // TODO(boodyvo): return particular error + return false, false, tallyResults, nil } // If more than 1/3 of voters veto, proposal fails - if results[govv1.OptionNoWithVeto].Quo(totalVotingPower).GT(sdk.MustNewDecFromStr(tallyParams.VetoThreshold)) { - return false, tallyParams.BurnVoteVeto, tallyResults + if results[govv1.OptionNoWithVeto].Quo(totalVotingPower).GT(sdkmath.LegacyMustNewDecFromStr(tallyParams.VetoThreshold)) { + // TODO(boodyvo): return particular error + return false, tallyParams.BurnVoteVeto, tallyResults, nil } // If more than 1/2 of non-abstaining voters vote Yes, proposal passes - if results[govv1.OptionYes].Quo(totalVotingPower.Sub(results[govv1.OptionAbstain])).GT(sdk.MustNewDecFromStr(tallyParams.Threshold)) { - return true, false, tallyResults + if results[govv1.OptionYes].Quo(totalVotingPower.Sub(results[govv1.OptionAbstain])).GT(sdkmath.LegacyMustNewDecFromStr(tallyParams.Threshold)) { + // TODO(boodyvo): return particular error + return true, false, tallyResults, nil } // If more than 1/2 of non-abstaining voters vote No, proposal fails - return false, false, tallyResults + return false, false, tallyResults, nil } // bkavaByDenom a map of the bkava denom and the amount of bkava for that denom. @@ -194,7 +318,7 @@ type bkavaByDenom map[string]sdkmath.Int func (bkavaMap bkavaByDenom) add(coin sdk.Coin) { _, found := bkavaMap[coin.Denom] if !found { - bkavaMap[coin.Denom] = sdk.ZeroInt() + bkavaMap[coin.Denom] = sdkmath.ZeroInt() } bkavaMap[coin.Denom] = bkavaMap[coin.Denom].Add(coin.Amount) } diff --git a/app/tally_handler_test.go b/app/tally_handler_test.go index 6f178396bb..970ffebf43 100644 --- a/app/tally_handler_test.go +++ b/app/tally_handler_test.go @@ -1,6 +1,7 @@ package app import ( + addresscodec "github.com/cosmos/cosmos-sdk/codec/address" "testing" "time" @@ -12,7 +13,6 @@ import ( govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper" govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" - "github.com/cosmos/cosmos-sdk/x/staking" stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" "github.com/stretchr/testify/suite" @@ -21,8 +21,8 @@ import ( liquidtypes "github.com/kava-labs/kava/x/liquid/types" ) -// d is an alias for sdk.MustNewDecFromStr -var d = sdk.MustNewDecFromStr +// d is an alias for sdkmath.LegacyMustNewDecFromStr +var d = sdkmath.LegacyMustNewDecFromStr type tallyHandlerSuite struct { suite.Suite @@ -42,7 +42,7 @@ func (suite *tallyHandlerSuite) SetupTest() { suite.app = NewTestApp() suite.app.InitializeFromGenesisStates() genesisTime := time.Date(1998, 1, 1, 0, 0, 0, 0, time.UTC) - suite.ctx = suite.app.NewContext(false, tmproto.Header{Height: 1, Time: genesisTime}) + suite.ctx = suite.app.NewContextLegacy(false, tmproto.Header{Height: 1, Time: genesisTime}) stakingKeeper := *suite.app.GetStakingKeeper() suite.staking = stakingHelper{stakingKeeper} @@ -55,6 +55,7 @@ func (suite *tallyHandlerSuite) SetupTest() { suite.app.GetEarnKeeper(), suite.app.GetLiquidKeeper(), suite.app.GetBankKeeper(), + addresscodec.NewBech32Codec(Bech32PrefixValAddr), ) } @@ -63,7 +64,7 @@ func (suite *tallyHandlerSuite) TestVotePower_AllSourcesCounted() { validator := suite.delegateToNewBondedValidator(user.GetAddress(), sdkmath.NewInt(1e9)) - derivatives := suite.mintDerivative(user.GetAddress(), validator.GetOperator(), sdkmath.NewInt(500e6)) + derivatives := suite.mintDerivative(user.GetAddress(), sdk.ValAddress(validator.GetOperator()), sdkmath.NewInt(500e6)) suite.allowBKavaEarnDeposits() suite.earnDeposit( @@ -74,11 +75,12 @@ func (suite *tallyHandlerSuite) TestVotePower_AllSourcesCounted() { proposal := suite.createProposal() suite.voteOnProposal(user.GetAddress(), proposal.Id, govv1beta1.OptionYes) - _, _, results := suite.tallier.Tally(suite.ctx, proposal) + _, _, results, err := suite.tallier.Tally(suite.ctx, proposal) + suite.Require().NoError(err) suite.Equal(sdkmath.NewInt(500e6+250e6+250e6).String(), results.YesCount) - suite.Equal(sdk.ZeroInt().String(), results.NoCount) - suite.Equal(sdk.ZeroInt().String(), results.NoWithVetoCount) - suite.Equal(sdk.ZeroInt().String(), results.AbstainCount) + suite.Equal(sdkmath.ZeroInt().String(), results.NoCount) + suite.Equal(sdkmath.ZeroInt().String(), results.NoWithVetoCount) + suite.Equal(sdkmath.ZeroInt().String(), results.AbstainCount) } func (suite *tallyHandlerSuite) TestVotePower_UserOverridesValidator() { @@ -88,7 +90,7 @@ func (suite *tallyHandlerSuite) TestVotePower_UserOverridesValidator() { validator := suite.delegateToNewBondedValidator(user.GetAddress(), delegated) selfDelegated := validator.GetTokens().Sub(delegated) - derivatives := suite.mintDerivative(user.GetAddress(), validator.GetOperator(), sdkmath.NewInt(500e6)) + derivatives := suite.mintDerivative(user.GetAddress(), sdk.ValAddress(validator.GetOperator()), sdkmath.NewInt(500e6)) suite.allowBKavaEarnDeposits() suite.earnDeposit( @@ -99,28 +101,31 @@ func (suite *tallyHandlerSuite) TestVotePower_UserOverridesValidator() { proposal := suite.createProposal() // Validator votes, inheriting user's stake and bkava. - suite.voteOnProposal(validator.GetOperator().Bytes(), proposal.Id, govv1beta1.OptionYes) + // TODO(boodyvo): should be swi + suite.voteOnProposal([]byte(validator.GetOperator()), proposal.Id, govv1beta1.OptionYes) // use wrapped context to discard the state changes readOnlyCtx, _ := suite.ctx.CacheContext() - _, _, results := suite.tallier.Tally(readOnlyCtx, proposal) + _, _, results, err := suite.tallier.Tally(readOnlyCtx, proposal) + suite.Require().NoError(err) userPower := sdkmath.NewInt(500e6 + 250e6 + 250e6) suite.Equal( selfDelegated.Add(userPower).String(), results.YesCount, ) - suite.Equal(sdk.ZeroInt().String(), results.NoCount) - suite.Equal(sdk.ZeroInt().String(), results.NoWithVetoCount) - suite.Equal(sdk.ZeroInt().String(), results.AbstainCount) + suite.Equal(sdkmath.ZeroInt().String(), results.NoCount) + suite.Equal(sdkmath.ZeroInt().String(), results.NoWithVetoCount) + suite.Equal(sdkmath.ZeroInt().String(), results.AbstainCount) // User votes, taking power away from validator. suite.voteOnProposal(user.GetAddress(), proposal.Id, govv1beta1.OptionNo) - _, _, results = suite.tallier.Tally(suite.ctx, proposal) + _, _, results, err = suite.tallier.Tally(suite.ctx, proposal) + suite.Require().NoError(err) suite.Equal(selfDelegated.String(), results.YesCount) suite.Equal(userPower.String(), results.NoCount) - suite.Equal(sdk.ZeroInt().String(), results.NoWithVetoCount) - suite.Equal(sdk.ZeroInt().String(), results.AbstainCount) + suite.Equal(sdkmath.ZeroInt().String(), results.NoWithVetoCount) + suite.Equal(sdkmath.ZeroInt().String(), results.AbstainCount) } func (suite *tallyHandlerSuite) TestTallyOutcomes() { @@ -131,10 +136,12 @@ func (suite *tallyHandlerSuite) TestTallyOutcomes() { v1 := suite.createNewBondedValidator(sdkmath.NewInt(399_999_999)) suite.createNewBondedValidator(sdkmath.NewInt(600_000_001)) + v1Addr, err := suite.tallier.validatorAddressCodec.StringToBytes(v1.GetOperator()) + suite.Require().NoError(err) - suite.voteOnProposal(v1.GetOperator().Bytes(), proposal.Id, govv1beta1.OptionYes) + suite.voteOnProposal(v1Addr, proposal.Id, govv1beta1.OptionYes) - passes, burns, tally := suite.tallier.Tally(suite.ctx, proposal) + passes, burns, tally, err := suite.tallier.Tally(suite.ctx, proposal) suite.Falsef(passes, "expected proposal to fail, tally: %v", tally) suite.Truef(burns, "expected deposit to be burned, tally: %v", tally) }) @@ -146,10 +153,15 @@ func (suite *tallyHandlerSuite) TestTallyOutcomes() { v1 := suite.createNewBondedValidator(sdkmath.NewInt(334_000_001)) v2 := suite.createNewBondedValidator(sdkmath.NewInt(665_999_999)) - suite.voteOnProposal(v1.GetOperator().Bytes(), proposal.Id, govv1beta1.OptionNoWithVeto) - suite.voteOnProposal(v2.GetOperator().Bytes(), proposal.Id, govv1beta1.OptionYes) + v1Addr, err := suite.tallier.validatorAddressCodec.StringToBytes(v1.GetOperator()) + suite.Require().NoError(err) + v2Addr, err := suite.tallier.validatorAddressCodec.StringToBytes(v2.GetOperator()) + suite.Require().NoError(err) + + suite.voteOnProposal(v1Addr, proposal.Id, govv1beta1.OptionNoWithVeto) + suite.voteOnProposal(v2Addr, proposal.Id, govv1beta1.OptionYes) - passes, burns, tally := suite.tallier.Tally(suite.ctx, proposal) + passes, burns, tally, err := suite.tallier.Tally(suite.ctx, proposal) suite.Falsef(passes, "expected proposal to fail, tally: %v", tally) suite.Truef(burns, "expected deposit to be burned, tally: %v", tally) }) @@ -161,12 +173,18 @@ func (suite *tallyHandlerSuite) TestTallyOutcomes() { v1 := suite.createNewBondedValidator(sdkmath.NewInt(900_000_000)) v2 := suite.createNewBondedValidator(sdkmath.NewInt(50_000_001)) v3 := suite.createNewBondedValidator(sdkmath.NewInt(49_999_999)) - - suite.voteOnProposal(v1.GetOperator().Bytes(), proposal.Id, govv1beta1.OptionAbstain) - suite.voteOnProposal(v2.GetOperator().Bytes(), proposal.Id, govv1beta1.OptionYes) - suite.voteOnProposal(v3.GetOperator().Bytes(), proposal.Id, govv1beta1.OptionNo) - - passes, burns, tally := suite.tallier.Tally(suite.ctx, proposal) + v1Addr, err := suite.tallier.validatorAddressCodec.StringToBytes(v1.GetOperator()) + suite.Require().NoError(err) + v2Addr, err := suite.tallier.validatorAddressCodec.StringToBytes(v2.GetOperator()) + suite.Require().NoError(err) + v3Addr, err := suite.tallier.validatorAddressCodec.StringToBytes(v3.GetOperator()) + suite.Require().NoError(err) + + suite.voteOnProposal(v1Addr, proposal.Id, govv1beta1.OptionAbstain) + suite.voteOnProposal(v2Addr, proposal.Id, govv1beta1.OptionYes) + suite.voteOnProposal(v3Addr, proposal.Id, govv1beta1.OptionNo) + + passes, burns, tally, err := suite.tallier.Tally(suite.ctx, proposal) suite.Truef(passes, "expected proposal to pass, tally: %v", tally) suite.Falsef(burns, "expected deposit to not burn, tally: %v", tally) }) @@ -179,11 +197,18 @@ func (suite *tallyHandlerSuite) TestTallyOutcomes() { v2 := suite.createNewBondedValidator(sdkmath.NewInt(49_999_999)) v3 := suite.createNewBondedValidator(sdkmath.NewInt(50_000_001)) - suite.voteOnProposal(v1.GetOperator().Bytes(), proposal.Id, govv1beta1.OptionAbstain) - suite.voteOnProposal(v2.GetOperator().Bytes(), proposal.Id, govv1beta1.OptionYes) - suite.voteOnProposal(v3.GetOperator().Bytes(), proposal.Id, govv1beta1.OptionNo) + v1Addr, err := suite.tallier.validatorAddressCodec.StringToBytes(v1.GetOperator()) + suite.Require().NoError(err) + v2Addr, err := suite.tallier.validatorAddressCodec.StringToBytes(v2.GetOperator()) + suite.Require().NoError(err) + v3Addr, err := suite.tallier.validatorAddressCodec.StringToBytes(v3.GetOperator()) + suite.Require().NoError(err) + + suite.voteOnProposal(v1Addr, proposal.Id, govv1beta1.OptionAbstain) + suite.voteOnProposal(v2Addr, proposal.Id, govv1beta1.OptionYes) + suite.voteOnProposal(v3Addr, proposal.Id, govv1beta1.OptionNo) - passes, burns, tally := suite.tallier.Tally(suite.ctx, proposal) + passes, burns, tally, err := suite.tallier.Tally(suite.ctx, proposal) suite.Falsef(passes, "expected proposal to pass, tally: %v", tally) suite.Falsef(burns, "expected deposit to not burn, tally: %v", tally) }) @@ -195,7 +220,8 @@ func (suite *tallyHandlerSuite) TestTallyOutcomes() { // no stake suite.app.DeleteGenesisValidator(suite.T(), suite.ctx) - passes, burns, tally := suite.tallier.Tally(suite.ctx, proposal) + passes, burns, tally, err := suite.tallier.Tally(suite.ctx, proposal) + suite.Require().NoError(err) suite.Falsef(passes, "expected proposal to pass, tally: %v", tally) suite.Falsef(burns, "expected deposit to not burn, tally: %v", tally) }) @@ -205,23 +231,28 @@ func (suite *tallyHandlerSuite) TestTallyOutcomes() { proposal := suite.createProposal() v1 := suite.createNewBondedValidator(sdkmath.NewInt(1e9)) + v1Addr, err := suite.tallier.validatorAddressCodec.StringToBytes(v1.GetOperator()) + suite.Require().NoError(err) - suite.voteOnProposal(v1.GetOperator().Bytes(), proposal.Id, govv1beta1.OptionAbstain) + suite.voteOnProposal(v1Addr, proposal.Id, govv1beta1.OptionAbstain) - passes, burns, tally := suite.tallier.Tally(suite.ctx, proposal) + passes, burns, tally, err := suite.tallier.Tally(suite.ctx, proposal) + suite.Require().NoError(err) suite.Falsef(passes, "expected proposal to pass, tally: %v", tally) suite.Falsef(burns, "expected deposit to not burn, tally: %v", tally) }) } -func (suite *tallyHandlerSuite) setTallyParams(quorum, threshold, veto sdk.Dec) { - params := suite.app.GetGovKeeper().GetParams(suite.ctx) +func (suite *tallyHandlerSuite) setTallyParams(quorum, threshold, veto sdkmath.LegacyDec) { + params, err := suite.app.GetGovKeeper().Params.Get(suite.ctx) + suite.Require().NoError(err) params.Quorum = quorum.String() params.Threshold = threshold.String() params.VetoThreshold = veto.String() params.BurnVoteQuorum = true - suite.app.GetGovKeeper().SetParams(suite.ctx, params) + err = suite.app.GetGovKeeper().Params.Set(suite.ctx, params) + suite.Require().NoError(err) } func (suite *tallyHandlerSuite) voteOnProposal( @@ -242,7 +273,9 @@ func (suite *tallyHandlerSuite) voteOnProposal( func (suite *tallyHandlerSuite) createProposal() govv1.Proposal { gk := suite.app.GetGovKeeper() - deposit := gk.GetParams(suite.ctx).MinDeposit + govParams, err := gk.Params.Get(suite.ctx) + suite.Require().NoError(err) + deposit := govParams.MinDeposit proposer := suite.createAccount(deposit...) msg, err := govv1beta1.NewMsgSubmitProposal( @@ -259,8 +292,8 @@ func (suite *tallyHandlerSuite) createProposal() govv1.Proposal { res, err := msgServer.SubmitProposal(sdk.WrapSDKContext(suite.ctx), msg) suite.Require().NoError(err) - proposal, found := gk.GetProposal(suite.ctx, res.ProposalId) - if !found { + proposal, err := gk.Proposals.Get(suite.ctx, res.ProposalId) + if err != nil { panic("proposal not found") } return proposal @@ -311,17 +344,21 @@ func (suite *tallyHandlerSuite) delegateToNewBondedValidator(delegator sdk.AccAd validator, err := suite.staking.createUnbondedValidator(suite.ctx, valAcc.GetAddress().Bytes(), sdkmath.NewInt(1e9)) suite.Require().NoError(err) - _, err = suite.staking.delegate(suite.ctx, delegator, validator.GetOperator(), amount) + validatorAddr, err := suite.tallier.validatorAddressCodec.StringToBytes(validator.GetOperator()) + suite.Require().NoError(err) + + _, err = suite.staking.delegate(suite.ctx, delegator, validatorAddr, amount) suite.Require().NoError(err) // bond the validator sk := suite.app.GetStakingKeeper() - staking.EndBlocker(suite.ctx, sk) + suite.staking.keeper.EndBlocker(suite.ctx) - validator, found := sk.GetValidator(suite.ctx, validator.GetOperator()) - if !found { + validator, err = sk.GetValidator(suite.ctx, validatorAddr) + if err != nil { panic("validator not found") } + return validator } @@ -332,10 +369,12 @@ func (suite *tallyHandlerSuite) createNewBondedValidator(selfDelegation sdkmath. // bond the validator sk := suite.app.GetStakingKeeper() - staking.EndBlocker(suite.ctx, sk) + suite.staking.keeper.EndBlocker(suite.ctx) - validator, found := sk.GetValidator(suite.ctx, validator.GetOperator()) - if !found { + validatorAddr, err := sk.ValidatorAddressCodec().StringToBytes(validator.GetOperator()) + suite.Require().NoError(err) + validator, err = sk.GetValidator(suite.ctx, validatorAddr) + if err != nil { panic("validator not found") } return validator @@ -360,11 +399,11 @@ type stakingHelper struct { func (h stakingHelper) createUnbondedValidator(ctx sdk.Context, address sdk.ValAddress, selfDelegation sdkmath.Int) (stakingtypes.ValidatorI, error) { msg, err := stakingtypes.NewMsgCreateValidator( - address, + address.String(), ed25519.GenPrivKey().PubKey(), h.newBondCoin(ctx, selfDelegation), stakingtypes.Description{}, - stakingtypes.NewCommissionRates(sdk.ZeroDec(), sdk.ZeroDec(), sdk.ZeroDec()), + stakingtypes.NewCommissionRates(sdkmath.LegacyZeroDec(), sdkmath.LegacyZeroDec(), sdkmath.LegacyZeroDec()), sdkmath.NewInt(1e6), ) if err != nil { @@ -377,39 +416,49 @@ func (h stakingHelper) createUnbondedValidator(ctx sdk.Context, address sdk.ValA return nil, err } - validator, found := h.keeper.GetValidator(ctx, address) - if !found { + validator, err := h.keeper.GetValidator(ctx, address) + if err != nil { panic("validator not found") } return validator, nil } -func (h stakingHelper) delegate(ctx sdk.Context, delegator sdk.AccAddress, validator sdk.ValAddress, amount sdkmath.Int) (sdk.Dec, error) { +func (h stakingHelper) delegate(ctx sdk.Context, delegator sdk.AccAddress, validator sdk.ValAddress, amount sdkmath.Int) (sdkmath.LegacyDec, error) { msg := stakingtypes.NewMsgDelegate( - delegator, - validator, + delegator.String(), + validator.String(), h.newBondCoin(ctx, amount), ) msgServer := stakingkeeper.NewMsgServerImpl(&h.keeper) _, err := msgServer.Delegate(sdk.WrapSDKContext(ctx), msg) if err != nil { - return sdk.Dec{}, err + return sdkmath.LegacyDec{}, err } - del, found := h.keeper.GetDelegation(ctx, delegator, validator) - if !found { + del, err := h.keeper.GetDelegation(ctx, delegator, validator) + if err != nil { panic("delegation not found") } return del.Shares, nil } func (h stakingHelper) newBondCoin(ctx sdk.Context, amount sdkmath.Int) sdk.Coin { - return sdk.NewCoin(h.keeper.BondDenom(ctx), amount) + bondDenom, err := h.keeper.BondDenom(ctx) + if err != nil { + panic("bond denom not set") + } + return sdk.NewCoin(bondDenom, amount) } func (h stakingHelper) setBondDenom(ctx sdk.Context, denom string) { - params := h.keeper.GetParams(ctx) + params, err := h.keeper.GetParams(ctx) + if err != nil { + panic("params not found") + } params.BondDenom = denom - h.keeper.SetParams(ctx, params) + err = h.keeper.SetParams(ctx, params) + if err != nil { + panic("params not set") + } } diff --git a/app/test_builder.go b/app/test_builder.go index 60b9d9580b..e31c9ddf98 100644 --- a/app/test_builder.go +++ b/app/test_builder.go @@ -106,6 +106,11 @@ func newPeriodicVestingAccount(address sdk.AccAddress, periods vestingtypes.Peri } endTime := firstPeriodStartTimestamp + totalPeriods - baseVestingAccount := vestingtypes.NewBaseVestingAccount(baseAccount, originalVesting, endTime) + baseVestingAccount, err := vestingtypes.NewBaseVestingAccount(baseAccount, originalVesting, endTime) + if err != nil { + // TODO(boodyvo): should return err? + panic(err) + } + return vestingtypes.NewPeriodicVestingAccountRaw(baseVestingAccount, firstPeriodStartTimestamp, periods) } diff --git a/app/test_common.go b/app/test_common.go index 22d3e14882..66febee7b4 100644 --- a/app/test_common.go +++ b/app/test_common.go @@ -8,12 +8,13 @@ import ( "testing" "time" + "cosmossdk.io/log" sdkmath "cosmossdk.io/math" - tmdb "github.com/cometbft/cometbft-db" + storetypes "cosmossdk.io/store/types" abci "github.com/cometbft/cometbft/abci/types" - "github.com/cometbft/cometbft/libs/log" tmproto "github.com/cometbft/cometbft/proto/tendermint/types" tmtypes "github.com/cometbft/cometbft/types" + tmdb "github.com/cosmos/cosmos-db" "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" @@ -21,7 +22,6 @@ import ( "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" - storetypes "github.com/cosmos/cosmos-sdk/store/types" "github.com/cosmos/cosmos-sdk/testutil/mock" sdk "github.com/cosmos/cosmos-sdk/types" authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" @@ -105,6 +105,7 @@ func NewTestAppFromSealed() TestApp { log.NewNopLogger(), db, DefaultNodeHome, nil, encCfg, DefaultOptions, baseapp.SetChainID(TestChainId), ) + return TestApp{App: *app} } @@ -162,6 +163,7 @@ func GenesisStateWithSingleValidator( app *TestApp, genesisState GenesisState, ) GenesisState { + fmt.Println("GenesisStateWithSingleValidator") privVal := mock.NewPV() pubKey, err := privVal.GetPubKey() if err != nil { @@ -212,7 +214,7 @@ func genesisStateWithValSet( bondAmt := sdk.DefaultPowerReduction for _, val := range valSet.Validators { - pk, err := cryptocodec.FromTmPubKeyInterface(val.PubKey) + pk, err := cryptocodec.FromCmtPubKeyInterface(val.PubKey) if err != nil { panic(fmt.Errorf("error converting validator public key: %w", err)) } @@ -228,23 +230,29 @@ func genesisStateWithValSet( Jailed: false, Status: stakingtypes.Bonded, Tokens: bondAmt, - DelegatorShares: sdk.OneDec(), + DelegatorShares: sdkmath.LegacyOneDec(), Description: stakingtypes.Description{ Moniker: "genesis validator", }, UnbondingHeight: int64(0), UnbondingTime: time.Unix(0, 0).UTC(), - Commission: stakingtypes.NewCommission(sdk.ZeroDec(), sdk.ZeroDec(), sdk.ZeroDec()), - MinSelfDelegation: sdk.ZeroInt(), + Commission: stakingtypes.NewCommission(sdkmath.LegacyZeroDec(), sdkmath.LegacyZeroDec(), sdkmath.LegacyZeroDec()), + MinSelfDelegation: sdkmath.ZeroInt(), } validators = append(validators, validator) - delegations = append(delegations, stakingtypes.NewDelegation(genAccs[0].GetAddress(), val.Address.Bytes(), sdk.OneDec())) - + delegations = append(delegations, stakingtypes.NewDelegation(genAccs[0].GetAddress().String(), sdk.ValAddress(val.Address).String(), sdkmath.LegacyOneDec())) } + // set validators and delegations currentStakingGenesis := stakingtypes.GetGenesisStateFromAppState(app.appCodec, genesisState) currentStakingGenesis.Params.BondDenom = "ukava" + fmt.Println("currentStakingGenesis.Params", currentStakingGenesis.Params) + fmt.Println("currentStakingGenesis.Validators", currentStakingGenesis.Validators) + fmt.Println("currentStakingGenesis.Validators only validators", validators) + fmt.Println("currentStakingGenesis.Delegations", currentStakingGenesis.Delegations) + fmt.Println("currentStakingGenesis.Delegations only validators", delegations) + stakingGenesis := stakingtypes.NewGenesisState( currentStakingGenesis.Params, append(currentStakingGenesis.Validators, validators...), @@ -319,6 +327,7 @@ func (tApp TestApp) InitializeFromGenesisStatesWithTimeAndChainIDAndHeight( genesisState := NewDefaultGenesisState() modifiedStates := make(map[string]bool) + fmt.Println("initializing genesis states") for _, state := range genesisStates { for k, v := range state { genesisState[k] = v @@ -334,8 +343,11 @@ func (tApp TestApp) InitializeFromGenesisStatesWithTimeAndChainIDAndHeight( } } + fmt.Println("applying genesis states") + // Add default genesis states for at least 1 validator if addValidator { + fmt.Println("adding default validator") genesisState = GenesisStateWithSingleValidator( &tApp, genesisState, @@ -343,12 +355,14 @@ func (tApp TestApp) InitializeFromGenesisStatesWithTimeAndChainIDAndHeight( } // Initialize the chain - stateBytes, err := json.Marshal(genesisState) + stateBytes, err := json.MarshalIndent(genesisState, "", " ") + //stateBytes, err := json.Marshal(genesisState) if err != nil { panic(err) } + tApp.InitChain( - abci.RequestInitChain{ + &abci.RequestInitChain{ Time: genTime, Validators: []abci.ValidatorUpdate{}, AppStateBytes: stateBytes, @@ -363,12 +377,17 @@ func (tApp TestApp) InitializeFromGenesisStatesWithTimeAndChainIDAndHeight( InitialHeight: initialHeight, }, ) - tApp.Commit() - tApp.BeginBlock(abci.RequestBeginBlock{ - Header: tmproto.Header{ - Height: tApp.LastBlockHeight() + 1, Time: genTime, ChainID: chainID, - }, + _, err = tApp.FinalizeBlock(&abci.RequestFinalizeBlock{ + // Height: app.LastBlockHeight() + 1, + // Hash: app.LastCommitID().Hash, + // NextValidatorsHash: valSet.Hash(), + Height: tApp.LastBlockHeight() + 1, + Hash: tApp.LastCommitID().Hash, + Time: genTime, }) + fmt.Println("block finalized: ", err) + _, err = tApp.Commit() + fmt.Println("chain committed: ", err) return tApp } @@ -379,7 +398,8 @@ func (tApp TestApp) InitializeFromGenesisStatesWithTimeAndChainIDAndHeight( // it must be deleted additional validators are created. func (tApp TestApp) DeleteGenesisValidator(t *testing.T, ctx sdk.Context) { sk := tApp.GetStakingKeeper() - vals := sk.GetAllValidators(ctx) + vals, err := sk.GetAllValidators(ctx) + require.NoError(t, err) var genVal stakingtypes.Validator found := false @@ -393,9 +413,10 @@ func (tApp TestApp) DeleteGenesisValidator(t *testing.T, ctx sdk.Context) { require.True(t, found, "genesis validator not found") - delegations := sk.GetValidatorDelegations(ctx, genVal.GetOperator()) + delegations, err := sk.GetValidatorDelegations(ctx, []byte(genVal.GetOperator())) + require.NoError(t, err) for _, delegation := range delegations { - _, err := sk.Undelegate(ctx, delegation.GetDelegatorAddr(), genVal.GetOperator(), delegation.Shares) + _, _, err := sk.Undelegate(ctx, []byte(delegation.GetDelegatorAddr()), []byte(genVal.GetOperator()), delegation.Shares) require.NoError(t, err) } } @@ -459,12 +480,17 @@ func (tApp TestApp) FundModuleAccount(ctx sdk.Context, recipientMod string, amou // CreateNewUnbondedValidator creates a new validator in the staking module. // New validators are unbonded until the end blocker is run. func (tApp TestApp) CreateNewUnbondedValidator(ctx sdk.Context, valAddress sdk.ValAddress, selfDelegation sdkmath.Int) error { + bondDnom, err := tApp.stakingKeeper.BondDenom(ctx) + if err != nil { + return err + } + msg, err := stakingtypes.NewMsgCreateValidator( - valAddress, + valAddress.String(), ed25519.GenPrivKey().PubKey(), - sdk.NewCoin(tApp.stakingKeeper.BondDenom(ctx), selfDelegation), + sdk.NewCoin(bondDnom, selfDelegation), stakingtypes.Description{}, - stakingtypes.NewCommissionRates(sdk.ZeroDec(), sdk.ZeroDec(), sdk.ZeroDec()), + stakingtypes.NewCommissionRates(sdkmath.LegacyZeroDec(), sdkmath.LegacyZeroDec(), sdkmath.LegacyZeroDec()), sdkmath.NewInt(1e6), ) if err != nil { @@ -476,12 +502,12 @@ func (tApp TestApp) CreateNewUnbondedValidator(ctx sdk.Context, valAddress sdk.V return err } -func (tApp TestApp) SetInflation(ctx sdk.Context, value sdk.Dec) { +func (tApp TestApp) SetInflation(ctx sdk.Context, value sdkmath.LegacyDec) { mk := tApp.GetMintKeeper() mintParams := mk.GetParams(ctx) - mintParams.InflationMax = sdk.ZeroDec() - mintParams.InflationMin = sdk.ZeroDec() + mintParams.InflationMax = sdkmath.LegacyZeroDec() + mintParams.InflationMin = sdkmath.LegacyZeroDec() if err := mintParams.Validate(); err != nil { panic(err) @@ -520,6 +546,7 @@ func RandomAddress() sdk.AccAddress { // NewFundedGenStateWithSameCoins creates a (auth and bank) genesis state populated with accounts from the given addresses and balance. func NewFundedGenStateWithSameCoins(cdc codec.JSONCodec, balance sdk.Coins, addresses []sdk.AccAddress) GenesisState { + fmt.Println("initializing genesis state", balance) builder := NewAuthBankGenesisBuilder() for _, address := range addresses { builder.WithSimpleAccount(address, balance) diff --git a/app/upgrades.go b/app/upgrades.go index cef008252a..d5a488b161 100644 --- a/app/upgrades.go +++ b/app/upgrades.go @@ -1,3 +1,129 @@ package app +//const UpgradeName = "v045-to-v050" +// +//func setupLegacyKeyTables(k *paramskeeper.Keeper) { +// for _, subspace := range k.GetSubspaces() { +// subspace := subspace +// +// var keyTable paramstypes.KeyTable +// switch subspace.Name() { +// case authtypes.ModuleName: +// keyTable = authtypes.ParamKeyTable() //nolint:staticcheck +// case banktypes.ModuleName: +// keyTable = banktypes.ParamKeyTable() //nolint:staticcheck +// case stakingtypes.ModuleName: +// keyTable = stakingtypes.ParamKeyTable() //nolint:staticcheck +// case minttypes.ModuleName: +// keyTable = minttypes.ParamKeyTable() //nolint:staticcheck +// case distrtypes.ModuleName: +// keyTable = distrtypes.ParamKeyTable() //nolint:staticcheck +// case slashingtypes.ModuleName: +// keyTable = slashingtypes.ParamKeyTable() //nolint:staticcheck +// case govtypes.ModuleName: +// keyTable = govv1.ParamKeyTable() //nolint:staticcheck +// case crisistypes.ModuleName: +// keyTable = crisistypes.ParamKeyTable() //nolint:staticcheck +// // wasm +// case ibctransfertypes.ModuleName: +// keyTable = ibctransfertypes.ParamKeyTable() //nolint:staticcheck +// default: +// continue +// } +// +// if !subspace.HasKeyTable() { +// subspace.WithKeyTable(keyTable) +// } +// } +// +// // sdk 47 +// k.Subspace(baseapp.Paramspace). +// WithKeyTable(paramstypes.ConsensusParamsKeyTable()) +//} +// +//func (app App) RegisterUpgradeHandlers() { +// setupLegacyKeyTables(&app.paramsKeeper) +// +// app.upgradeKeeper.SetUpgradeHandler( +// UpgradeName, +// func(ctx context.Context, _ upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { +// return app.mm.RunMigrations(ctx, app.configurator, fromVM) +// }, +// ) +// +// upgradeInfo, err := app.upgradeKeeper.ReadUpgradeInfoFromDisk() +// if err != nil { +// panic(err) +// } +// +// if upgradeInfo.Name == UpgradeName && !app.upgradeKeeper.IsSkipHeight(upgradeInfo.Height) { +// storeUpgrades := storetypes.StoreUpgrades{ +// Added: []string{ +// consensustypes.ModuleName, +// crisistypes.ModuleName, +// capabilitytypes.MemStoreKey, +// nft.ModuleName, +// }, +// } +// +// // configure store loader that checks if version == upgradeHeight and applies store upgrades +// app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &storeUpgrades)) +// } +//} +// +//func (app App) RegisterUpgradeHandlersOld() { +// baseAppLegacySS := app.ParamsKeeper.Subspace(baseapp.Paramspace).WithKeyTable(paramstypes.ConsensusParamsKeyTable()) +// app.UpgradeKeeper.SetUpgradeHandler( +// UpgradeName, +// func(ctx context.Context, _ upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { +// baseapp.MigrateParams(ctx.(sdk.Context), baseAppLegacySS, app.ConsensusParamsKeeper.ParamsStore) +// consensusParams := baseapp.GetConsensusParams(ctx.(sdk.Context), baseAppLegacySS) +// // make sure the consensus params are set +// if consensusParams.Block == nil || consensusParams.Evidence == nil || consensusParams.Validator == nil { +// defaultParams := tmtypes.DefaultConsensusParams().ToProto() +// app.ConsensusParamsKeeper.ParamsStore.Set(ctx.(sdk.Context), defaultParams) +// } +// +// storesvc := runtime.NewKVStoreService(app.GetKey("upgrade")) +// consensuskeeper := consensuskeeper.NewKeeper( +// app.appCodec, +// storesvc, +// app.AccountKeeper.GetAuthority(), +// runtime.EventService{}, +// ) +// +// params, err := consensuskeeper.ParamsStore.Get(ctx) +// if err != nil { +// return nil, err +// } +// +// err = app.ConsensusParamsKeeper.ParamsStore.Set(ctx, params) +// if err != nil { +// return nil, err +// } +// +// return app.ModuleManager.RunMigrations(ctx, app.Configurator(), fromVM) +// }, +// ) +// +// upgradeInfo, err := app.UpgradeKeeper.ReadUpgradeInfoFromDisk() +// if err != nil { +// panic(err) +// } +// +// if upgradeInfo.Name == UpgradeName && !app.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) { +// storeUpgrades := storetypes.StoreUpgrades{ +// Added: []string{ +// consensustypes.ModuleName, +// crisistypes.ModuleName, +// circuittypes.ModuleName, +// ibcfee.ModuleName, +// }, +// } +// +// // configure store loader that checks if version == upgradeHeight and applies store upgrades +// app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &storeUpgrades)) +// } +//} + func (app App) RegisterUpgradeHandlers() {} diff --git a/cli_test/cli_test.go b/cli_test/cli_test.go index 8d16f50c29..915df27bc2 100644 --- a/cli_test/cli_test.go +++ b/cli_test/cli_test.go @@ -476,12 +476,12 @@ func TestKvCLIQueryRewards(t *testing.T) { f := InitFixtures(t) genesisState := f.GenesisState() - inflationMin := sdk.MustNewDecFromStr("1.0") + inflationMin := sdkmath.LegacyMustNewDecFromStr("1.0") var mintData mint.GenesisState f.cdc.UnmarshalJSON(genesisState[mint.ModuleName], &mintData) mintData.Minter.Inflation = inflationMin mintData.Params.InflationMin = inflationMin - mintData.Params.InflationMax = sdk.MustNewDecFromStr("1.0") + mintData.Params.InflationMax = sdkmath.LegacyMustNewDecFromStr("1.0") mintDataBz, err := f.cdc.MarshalJSON(mintData) require.NoError(t, err) genesisState[mint.ModuleName] = mintDataBz @@ -735,12 +735,12 @@ func TestKvCLISubmitCommunityPoolSpendProposal(t *testing.T) { // create some inflation genesisState := f.GenesisState() - inflationMin := sdk.MustNewDecFromStr("1.0") + inflationMin := sdkmath.LegacyMustNewDecFromStr("1.0") var mintData mint.GenesisState f.cdc.UnmarshalJSON(genesisState[mint.ModuleName], &mintData) mintData.Minter.Inflation = inflationMin mintData.Params.InflationMin = inflationMin - mintData.Params.InflationMax = sdk.MustNewDecFromStr("1.0") + mintData.Params.InflationMax = sdkmath.LegacyMustNewDecFromStr("1.0") mintDataBz, err := f.cdc.MarshalJSON(mintData) require.NoError(t, err) genesisState[mint.ModuleName] = mintDataBz diff --git a/client/docs/swagger-ui/swagger.yaml b/client/docs/swagger-ui/swagger.yaml index 8add5e6857..e10885d8de 100644 --- a/client/docs/swagger-ui/swagger.yaml +++ b/client/docs/swagger-ui/swagger.yaml @@ -2807,7 +2807,7 @@ paths: type: string format: uint64 - name: ratio - description: sdk.Dec as a string. + description: sdkmath.LegacyDec as a string. in: query required: false type: string @@ -7962,7 +7962,7 @@ paths: type: string value: type: string - title: sdk.Dec as string + title: sdkmath.LegacyDec as string description: >- BorrowInterestFactorResponse defines an individual borrow interest factor. @@ -8302,7 +8302,7 @@ paths: type: string value: type: string - title: sdk.Dec as string + title: sdkmath.LegacyDec as string description: >- SupplyInterestFactorResponse defines an individual borrow interest factor. @@ -8617,10 +8617,10 @@ paths: type: string borrow_interest_factor: type: string - title: sdk.Dec as String + title: sdkmath.LegacyDec as String supply_interest_factor: type: string - title: sdk.Dec as String + title: sdkmath.LegacyDec as String title: >- InterestFactor is a unique type returned by interest factor queries @@ -8844,10 +8844,10 @@ paths: type: string supply_interest_rate: type: string - title: sdk.Dec as String + title: sdkmath.LegacyDec as String borrow_interest_rate: type: string - title: sdk.Dec as String + title: sdkmath.LegacyDec as String title: >- MoneyMarketInterestRate is a unique type returned by interest rate queries @@ -10032,7 +10032,7 @@ paths: type: string value: type: string - title: sdk.Dec as string + title: sdkmath.LegacyDec as string description: >- BorrowInterestFactorResponse defines an individual borrow interest factor. @@ -10372,7 +10372,7 @@ paths: type: string value: type: string - title: sdk.Dec as string + title: sdkmath.LegacyDec as string description: >- SupplyInterestFactorResponse defines an individual borrow interest factor. @@ -59381,7 +59381,7 @@ definitions: type: string value: type: string - title: sdk.Dec as string + title: sdkmath.LegacyDec as string description: BorrowInterestFactorResponse defines an individual borrow interest factor. kava.hard.v1beta1.BorrowLimit: type: object @@ -59421,7 +59421,7 @@ definitions: type: string value: type: string - title: sdk.Dec as string + title: sdkmath.LegacyDec as string description: >- BorrowInterestFactorResponse defines an individual borrow interest factor. @@ -59456,7 +59456,7 @@ definitions: type: string value: type: string - title: sdk.Dec as string + title: sdkmath.LegacyDec as string description: >- SupplyInterestFactorResponse defines an individual borrow interest factor. @@ -59470,10 +59470,10 @@ definitions: type: string borrow_interest_factor: type: string - title: sdk.Dec as String + title: sdkmath.LegacyDec as String supply_interest_factor: type: string - title: sdk.Dec as String + title: sdkmath.LegacyDec as String title: InterestFactor is a unique type returned by interest factor queries kava.hard.v1beta1.InterestRateModel: type: object @@ -59530,10 +59530,10 @@ definitions: type: string supply_interest_rate: type: string - title: sdk.Dec as String + title: sdkmath.LegacyDec as String borrow_interest_rate: type: string - title: sdk.Dec as String + title: sdkmath.LegacyDec as String title: MoneyMarketInterestRate is a unique type returned by interest rate queries kava.hard.v1beta1.Params: type: object @@ -59833,7 +59833,7 @@ definitions: type: string value: type: string - title: sdk.Dec as string + title: sdkmath.LegacyDec as string description: >- BorrowInterestFactorResponse defines an individual borrow interest factor. @@ -59905,7 +59905,7 @@ definitions: type: string value: type: string - title: sdk.Dec as string + title: sdkmath.LegacyDec as string description: >- SupplyInterestFactorResponse defines an individual borrow interest factor. @@ -59953,10 +59953,10 @@ definitions: type: string borrow_interest_factor: type: string - title: sdk.Dec as String + title: sdkmath.LegacyDec as String supply_interest_factor: type: string - title: sdk.Dec as String + title: sdkmath.LegacyDec as String title: InterestFactor is a unique type returned by interest factor queries description: >- QueryInterestFactorsResponse is the response type for the @@ -59973,10 +59973,10 @@ definitions: type: string supply_interest_rate: type: string - title: sdk.Dec as String + title: sdkmath.LegacyDec as String borrow_interest_rate: type: string - title: sdk.Dec as String + title: sdkmath.LegacyDec as String title: >- MoneyMarketInterestRate is a unique type returned by interest rate queries @@ -60129,7 +60129,7 @@ definitions: type: string value: type: string - title: sdk.Dec as string + title: sdkmath.LegacyDec as string description: >- BorrowInterestFactorResponse defines an individual borrow interest factor. @@ -60201,7 +60201,7 @@ definitions: type: string value: type: string - title: sdk.Dec as string + title: sdkmath.LegacyDec as string description: >- SupplyInterestFactorResponse defines an individual borrow interest factor. @@ -60244,7 +60244,7 @@ definitions: type: string value: type: string - title: sdk.Dec as string + title: sdkmath.LegacyDec as string description: SupplyInterestFactorResponse defines an individual borrow interest factor. kava.incentive.v1beta1.Apy: type: object diff --git a/client/grpc/query/query.go b/client/grpc/query/query.go index ffc83e2554..2ac1268899 100644 --- a/client/grpc/query/query.go +++ b/client/grpc/query/query.go @@ -3,24 +3,24 @@ package query import ( "context" - "github.com/cosmos/cosmos-sdk/client/grpc/tmservice" + evidencetypes "cosmossdk.io/x/evidence/types" + upgradetypes "cosmossdk.io/x/upgrade/types" + tmservice "github.com/cosmos/cosmos-sdk/client/grpc/cmtservice" txtypes "github.com/cosmos/cosmos-sdk/types/tx" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" authz "github.com/cosmos/cosmos-sdk/x/authz" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" consensustypes "github.com/cosmos/cosmos-sdk/x/consensus/types" disttypes "github.com/cosmos/cosmos-sdk/x/distribution/types" - evidencetypes "github.com/cosmos/cosmos-sdk/x/evidence/types" govv1types "github.com/cosmos/cosmos-sdk/x/gov/types/v1" govv1beta1types "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" paramstypes "github.com/cosmos/cosmos-sdk/x/params/types/proposal" slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" - ibctransfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" - ibcclienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" + ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" + ibcclienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" evmtypes "github.com/evmos/ethermint/x/evm/types" feemarkettypes "github.com/evmos/ethermint/x/feemarket/types" diff --git a/cmd/kava/cmd/app.go b/cmd/kava/cmd/app.go index 15d707b9bb..5816d071fa 100644 --- a/cmd/kava/cmd/app.go +++ b/cmd/kava/cmd/app.go @@ -7,16 +7,16 @@ import ( "path/filepath" "strings" + "cosmossdk.io/log" + "cosmossdk.io/store" + "cosmossdk.io/store/snapshots" + snapshottypes "cosmossdk.io/store/snapshots/types" cometbftdb "github.com/cometbft/cometbft-db" - "github.com/cometbft/cometbft/libs/log" tmtypes "github.com/cometbft/cometbft/types" "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/server" servertypes "github.com/cosmos/cosmos-sdk/server/types" - "github.com/cosmos/cosmos-sdk/snapshots" - snapshottypes "github.com/cosmos/cosmos-sdk/snapshots/types" - "github.com/cosmos/cosmos-sdk/store" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/crisis" ethermintflags "github.com/evmos/ethermint/server/flags" diff --git a/cmd/kava/cmd/iavlviewer/root.go b/cmd/kava/cmd/iavlviewer/root.go index ea96e01f24..37e5bbd808 100644 --- a/cmd/kava/cmd/iavlviewer/root.go +++ b/cmd/kava/cmd/iavlviewer/root.go @@ -6,10 +6,10 @@ import ( "strconv" "cosmossdk.io/log" + "cosmossdk.io/store/wrapper" dbm "github.com/cosmos/cosmos-db" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/server" - "github.com/cosmos/cosmos-sdk/store/wrapper" ethermintserver "github.com/evmos/ethermint/server" "github.com/spf13/cobra" diff --git a/cmd/kava/cmd/rocksdb/compact.go b/cmd/kava/cmd/rocksdb/compact.go index a784ada765..42f76c237d 100644 --- a/cmd/kava/cmd/rocksdb/compact.go +++ b/cmd/kava/cmd/rocksdb/compact.go @@ -14,7 +14,7 @@ import ( "syscall" "time" - "github.com/cometbft/cometbft/libs/log" + "cosmossdk.io/log" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/server" "github.com/linxGnu/grocksdb" diff --git a/cmd/kava/cmd/root.go b/cmd/kava/cmd/root.go index 97b4d05941..05e8a494f9 100644 --- a/cmd/kava/cmd/root.go +++ b/cmd/kava/cmd/root.go @@ -5,9 +5,9 @@ import ( "os" "path/filepath" - dbm "github.com/cometbft/cometbft-db" tmcfg "github.com/cometbft/cometbft/config" tmcli "github.com/cometbft/cometbft/libs/cli" + dbm "github.com/cosmos/cosmos-db" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/config" "github.com/cosmos/cosmos-sdk/client/debug" diff --git a/cmd/kava/cmd/shard.go b/cmd/kava/cmd/shard.go index 7a44589b09..3d7fd7d902 100644 --- a/cmd/kava/cmd/shard.go +++ b/cmd/kava/cmd/shard.go @@ -7,13 +7,13 @@ import ( "github.com/kava-labs/kava/app" "github.com/spf13/cobra" - dbm "github.com/cometbft/cometbft-db" + dbm "github.com/cosmos/cosmos-db" + pruningtypes "cosmossdk.io/store/pruning/types" + "cosmossdk.io/store/rootmulti" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/server" - pruningtypes "github.com/cosmos/cosmos-sdk/store/pruning/types" - "github.com/cosmos/cosmos-sdk/store/rootmulti" tmconfig "github.com/cometbft/cometbft/config" "github.com/cometbft/cometbft/node" diff --git a/docs/core/proto-docs.md b/docs/core/proto-docs.md index da9147e5e8..2d930123c8 100644 --- a/docs/core/proto-docs.md +++ b/docs/core/proto-docs.md @@ -1827,7 +1827,7 @@ QueryCdpsRequest is the params for a filtered CDP query, the request type for th | `collateral_type` | [string](#string) | | | | `owner` | [string](#string) | | | | `id` | [uint64](#uint64) | | | -| `ratio` | [string](#string) | | sdk.Dec as a string | +| `ratio` | [string](#string) | | sdkmath.LegacyDec as a string | | `pagination` | [cosmos.base.query.v1beta1.PageRequest](#cosmos.base.query.v1beta1.PageRequest) | | | @@ -4480,7 +4480,7 @@ BorrowInterestFactorResponse defines an individual borrow interest factor. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | | `denom` | [string](#string) | | | -| `value` | [string](#string) | | sdk.Dec as string | +| `value` | [string](#string) | | sdkmath.LegacyDec as string | @@ -4530,8 +4530,8 @@ InterestFactor is a unique type returned by interest factor queries | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | | `denom` | [string](#string) | | | -| `borrow_interest_factor` | [string](#string) | | sdk.Dec as String | -| `supply_interest_factor` | [string](#string) | | sdk.Dec as String | +| `borrow_interest_factor` | [string](#string) | | sdkmath.LegacyDec as String | +| `supply_interest_factor` | [string](#string) | | sdkmath.LegacyDec as String | @@ -4547,8 +4547,8 @@ MoneyMarketInterestRate is a unique type returned by interest rate queries | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | | `denom` | [string](#string) | | | -| `supply_interest_rate` | [string](#string) | | sdk.Dec as String | -| `borrow_interest_rate` | [string](#string) | | sdk.Dec as String | +| `supply_interest_rate` | [string](#string) | | sdkmath.LegacyDec as String | +| `borrow_interest_rate` | [string](#string) | | sdkmath.LegacyDec as String | @@ -4896,7 +4896,7 @@ SupplyInterestFactorResponse defines an individual borrow interest factor. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | | `denom` | [string](#string) | | | -| `value` | [string](#string) | | sdk.Dec as string | +| `value` | [string](#string) | | sdkmath.LegacyDec as string | diff --git a/go.mod b/go.mod index a5cdd699e8..ee952fb524 100644 --- a/go.mod +++ b/go.mod @@ -1,187 +1,205 @@ module github.com/kava-labs/kava -go 1.21 +go 1.21.0 + +toolchain go1.21.9 require ( + cosmossdk.io/api v0.7.5 + cosmossdk.io/core v0.11.1 cosmossdk.io/errors v1.0.1 - cosmossdk.io/log v1.3.1 + cosmossdk.io/log v1.4.1 cosmossdk.io/math v1.3.0 cosmossdk.io/simapp v0.0.0-20231127212628-044ff4d8c015 + cosmossdk.io/store v1.1.1 + cosmossdk.io/x/evidence v0.1.1 + cosmossdk.io/x/tx v0.13.5 + cosmossdk.io/x/upgrade v0.1.4 github.com/Kava-Labs/opendb v0.0.0-20240719173129-a2f11f6d7e51 - github.com/cenkalti/backoff/v4 v4.1.3 - github.com/cometbft/cometbft v0.37.9 - github.com/cometbft/cometbft-db v0.9.1 + github.com/cenkalti/backoff/v4 v4.3.0 + github.com/cometbft/cometbft v1.0.0-rc1.0.20240908111210-ab0be101882f + github.com/cometbft/cometbft-db v0.11.0 github.com/cosmos/cosmos-db v1.0.2 github.com/cosmos/cosmos-proto v1.0.0-beta.5 - github.com/cosmos/cosmos-sdk v0.47.10 + github.com/cosmos/cosmos-sdk v0.50.10 github.com/cosmos/go-bip39 v1.0.0 - github.com/cosmos/gogoproto v1.4.10 + github.com/cosmos/gogoproto v1.7.0 github.com/cosmos/iavl v1.2.0 - github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7 v7.1.3 - github.com/cosmos/ibc-go/v7 v7.4.0 + github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v8 v8.0.2 + github.com/cosmos/ibc-go/modules/capability v1.0.1 + github.com/cosmos/ibc-go/v8 v8.5.1 github.com/ethereum/go-ethereum v1.10.26 - github.com/evmos/ethermint v0.21.0 + github.com/evmos/ethermint v0.0.0-00010101000000-000000000000 github.com/go-kit/kit v0.13.0 github.com/gogo/protobuf v1.3.2 github.com/golang/protobuf v1.5.4 - github.com/gorilla/mux v1.8.0 + github.com/gorilla/mux v1.8.1 github.com/grpc-ecosystem/grpc-gateway v1.16.0 - github.com/linxGnu/grocksdb v1.8.13 - github.com/pelletier/go-toml/v2 v2.1.0 - github.com/prometheus/client_golang v1.14.0 - github.com/spf13/cast v1.6.0 - github.com/spf13/cobra v1.8.0 - github.com/spf13/viper v1.18.2 + github.com/linxGnu/grocksdb v1.9.3 + github.com/pelletier/go-toml/v2 v2.2.3 + github.com/prometheus/client_golang v1.20.4 + github.com/spf13/cast v1.7.0 + github.com/spf13/cobra v1.8.1 + github.com/spf13/viper v1.19.0 github.com/stretchr/testify v1.9.0 github.com/subosito/gotenv v1.6.0 - golang.org/x/crypto v0.22.0 - golang.org/x/exp v0.0.0-20230905200255-921286631fa9 - google.golang.org/genproto/googleapis/api v0.0.0-20240227224415-6ceb2ff114de - google.golang.org/grpc v1.63.2 - google.golang.org/protobuf v1.33.0 + golang.org/x/crypto v0.28.0 + golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8 + google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142 + google.golang.org/grpc v1.67.1 + google.golang.org/protobuf v1.35.1 sigs.k8s.io/yaml v1.4.0 ) require ( - cloud.google.com/go v0.112.0 // indirect - cloud.google.com/go/compute v1.24.0 // indirect - cloud.google.com/go/compute/metadata v0.2.3 // indirect - cloud.google.com/go/iam v1.1.6 // indirect - cloud.google.com/go/storage v1.36.0 // indirect - cosmossdk.io/api v0.3.1 // indirect - cosmossdk.io/core v0.6.1 // indirect - cosmossdk.io/depinject v1.0.0-alpha.4 // indirect - cosmossdk.io/tools/rosetta v0.2.1 // indirect - filippo.io/edwards25519 v1.0.0 // indirect + cloud.google.com/go v0.115.1 // indirect + cloud.google.com/go/auth v0.8.1 // indirect + cloud.google.com/go/auth/oauth2adapt v0.2.3 // indirect + cloud.google.com/go/compute/metadata v0.5.0 // indirect + cloud.google.com/go/iam v1.1.13 // indirect + cloud.google.com/go/storage v1.43.0 // indirect + cosmossdk.io/collections v0.4.0 // indirect + cosmossdk.io/depinject v1.0.0 // indirect + cosmossdk.io/x/feegrant v0.1.1 // indirect + filippo.io/edwards25519 v1.1.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect - github.com/99designs/keyring v1.2.1 // indirect - github.com/ChainSafe/go-schnorrkel v1.0.0 // indirect + github.com/99designs/keyring v1.2.2 // indirect + github.com/DataDog/datadog-go v3.2.0+incompatible // indirect github.com/DataDog/zstd v1.5.5 // indirect + github.com/PuerkitoBio/purell v1.1.1 // indirect + github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect github.com/StackExchange/wmi v1.2.1 // indirect - github.com/VictoriaMetrics/fastcache v1.6.0 // indirect + github.com/VictoriaMetrics/fastcache v1.12.1 // indirect github.com/allegro/bigcache v1.2.1 // indirect - github.com/armon/go-metrics v0.4.1 // indirect - github.com/aws/aws-sdk-go v1.44.203 // indirect + github.com/aws/aws-sdk-go v1.55.5 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect - github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 // indirect - github.com/btcsuite/btcd v0.24.0 // indirect - github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect - github.com/btcsuite/btcd/btcutil v1.1.5 // indirect + github.com/bgentry/speakeasy v0.2.0 // indirect + github.com/bits-and-blooms/bitset v1.8.0 // indirect + github.com/btcsuite/btcd v0.24.2 // indirect + github.com/btcsuite/btcd/btcec/v2 v2.3.4 // indirect + github.com/btcsuite/btcd/btcutil v1.1.6 // indirect github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0 // indirect github.com/cespare/xxhash v1.1.0 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/chzyer/readline v1.5.1 // indirect github.com/cockroachdb/apd/v2 v2.0.2 // indirect - github.com/cockroachdb/errors v1.11.1 // indirect + github.com/cockroachdb/errors v1.11.3 // indirect + github.com/cockroachdb/fifo v0.0.0-20240606204812-0bbfbd93a7ce // indirect github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect - github.com/cockroachdb/pebble v1.1.0 // indirect + github.com/cockroachdb/pebble v1.1.1 // indirect github.com/cockroachdb/redact v1.1.5 // indirect github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect - github.com/coinbase/rosetta-sdk-go v0.7.9 // indirect - github.com/confio/ics23/go v0.9.0 // indirect + github.com/coinbase/rosetta-sdk-go/types v1.0.0 // indirect github.com/cosmos/btcutil v1.0.5 // indirect github.com/cosmos/gogogateway v1.2.0 // indirect - github.com/cosmos/ics23/go v0.10.0 // indirect + github.com/cosmos/ics23/go v0.11.0 // indirect github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect + github.com/cosmos/rosetta v0.50.6 // indirect github.com/cosmos/rosetta-sdk-go v0.10.0 // indirect - github.com/creachadair/taskgroup v0.4.2 // indirect - github.com/danieljoos/wincred v1.1.2 // indirect + github.com/danieljoos/wincred v1.2.1 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/deckarep/golang-set v1.8.0 // indirect - github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect + github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 // indirect github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f // indirect github.com/dgraph-io/badger/v2 v2.2007.4 // indirect - github.com/dgraph-io/ristretto v0.1.1 // indirect + github.com/dgraph-io/ristretto v0.1.2-0.20240116140435-c67e07994f91 // indirect github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect - github.com/dlclark/regexp2 v1.4.1-0.20201116162257-a2a8dda75c91 // indirect - github.com/dop251/goja v0.0.0-20220405120441-9037c2b61cbf // indirect + github.com/dlclark/regexp2 v1.7.0 // indirect + github.com/dop251/goja v0.0.0-20230806174421-c933cf95e127 // indirect github.com/dustin/go-humanize v1.0.1 // indirect github.com/dvsekhvalnov/jose2go v1.6.0 // indirect github.com/edsrzf/mmap-go v1.0.0 // indirect github.com/emicklei/dot v1.6.1 // indirect + github.com/fatih/color v1.16.0 // indirect github.com/felixge/httpsnoop v1.0.4 // indirect github.com/fsnotify/fsnotify v1.7.0 // indirect github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff // indirect github.com/getsentry/sentry-go v0.27.0 // indirect github.com/go-kit/log v0.2.1 // indirect github.com/go-logfmt/logfmt v0.6.0 // indirect - github.com/go-logr/logr v1.4.1 // indirect + github.com/go-logr/logr v1.4.2 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/go-ole/go-ole v1.2.6 // indirect github.com/go-sourcemap/sourcemap v2.1.3+incompatible // indirect github.com/go-stack/stack v1.8.1 // indirect github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect github.com/gogo/googleapis v1.4.1 // indirect - github.com/golang/glog v1.2.0 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/mock v1.6.0 // indirect - github.com/golang/snappy v0.0.4 // indirect - github.com/google/btree v1.1.2 // indirect + github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect + github.com/google/btree v1.1.3 // indirect github.com/google/go-cmp v0.6.0 // indirect github.com/google/orderedcode v0.0.1 // indirect - github.com/google/s2a-go v0.1.7 // indirect + github.com/google/pprof v0.0.0-20230228050547-1710fef4ab10 // indirect + github.com/google/s2a-go v0.1.8 // indirect github.com/google/uuid v1.6.0 // indirect github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect - github.com/googleapis/gax-go/v2 v2.12.0 // indirect - github.com/gorilla/handlers v1.5.1 // indirect - github.com/gorilla/websocket v1.5.0 // indirect - github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect + github.com/googleapis/gax-go/v2 v2.13.0 // indirect + github.com/gorilla/handlers v1.5.2 // indirect + github.com/gorilla/websocket v1.5.3 // indirect + github.com/goware/urlx v0.3.2 // indirect + github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 // indirect github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect - github.com/gtank/merlin v0.1.1 // indirect - github.com/gtank/ristretto255 v0.1.2 // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // indirect - github.com/hashicorp/go-getter v1.7.5 // indirect + github.com/hashicorp/go-getter v1.7.6 // indirect + github.com/hashicorp/go-hclog v1.5.0 // indirect github.com/hashicorp/go-immutable-radix v1.3.1 // indirect + github.com/hashicorp/go-metrics v0.5.3 // indirect + github.com/hashicorp/go-plugin v1.6.0 // indirect github.com/hashicorp/go-safetemp v1.0.0 // indirect - github.com/hashicorp/go-version v1.6.0 // indirect + github.com/hashicorp/go-version v1.7.0 // indirect github.com/hashicorp/golang-lru v1.0.2 // indirect github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect github.com/hashicorp/hcl v1.0.0 // indirect - github.com/hdevalence/ed25519consensus v0.1.0 // indirect + github.com/hashicorp/yamux v0.1.1 // indirect + github.com/hdevalence/ed25519consensus v0.2.0 // indirect github.com/holiman/bloomfilter/v2 v2.0.3 // indirect - github.com/holiman/uint256 v1.2.1 // indirect - github.com/huandu/skiplist v1.2.0 // indirect - github.com/huin/goupnp v1.0.3 // indirect - github.com/iancoleman/orderedmap v0.2.0 // indirect + github.com/holiman/uint256 v1.2.4 // indirect + github.com/huandu/skiplist v1.2.1 // indirect + github.com/huin/goupnp v1.3.0 // indirect + github.com/iancoleman/orderedmap v0.3.0 // indirect + github.com/iancoleman/strcase v0.3.0 // indirect github.com/improbable-eng/grpc-web v0.15.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/jackpal/go-nat-pmp v1.0.2 // indirect github.com/jmespath/go-jmespath v0.4.0 // indirect github.com/jmhodges/levigo v1.0.0 // indirect - github.com/klauspost/compress v1.17.7 // indirect + github.com/klauspost/compress v1.17.9 // indirect github.com/kr/pretty v0.3.1 // indirect github.com/kr/text v0.2.0 // indirect - github.com/lib/pq v1.10.7 // indirect + github.com/lib/pq v1.10.9 // indirect github.com/magiconair/properties v1.8.7 // indirect github.com/manifoldco/promptui v0.9.0 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect - github.com/mattn/go-runewidth v0.0.9 // indirect - github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect - github.com/mimoo/StrobeGo v0.0.0-20210601165009-122bf33a46e0 // indirect - github.com/minio/highwayhash v1.0.2 // indirect + github.com/mattn/go-runewidth v0.0.14 // indirect + github.com/minio/highwayhash v1.0.3 // indirect github.com/mitchellh/go-homedir v1.1.0 // indirect github.com/mitchellh/go-testing-interface v1.14.1 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/mtibben/percent v0.2.1 // indirect + github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect + github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a // indirect + github.com/oklog/run v1.1.0 // indirect github.com/olekukonko/tablewriter v0.0.5 // indirect - github.com/petermattis/goid v0.0.0-20231207134359-e60b3f734c67 // indirect + github.com/petermattis/goid v0.0.0-20240813172612-4fcff4a6cae7 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_model v0.6.1 // indirect - github.com/prometheus/common v0.42.0 // indirect - github.com/prometheus/procfs v0.13.0 // indirect + github.com/prometheus/common v0.60.0 // indirect + github.com/prometheus/procfs v0.15.1 // indirect github.com/prometheus/tsdb v0.7.1 // indirect github.com/rakyll/statik v0.1.7 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect + github.com/rivo/uniseg v0.2.0 // indirect github.com/rjeczalik/notify v0.9.1 // indirect github.com/rogpeppe/go-internal v1.12.0 // indirect - github.com/rs/cors v1.8.3 // indirect - github.com/rs/zerolog v1.32.0 // indirect + github.com/rs/cors v1.11.1 // indirect + github.com/rs/zerolog v1.33.0 // indirect github.com/sagikazarmark/locafero v0.4.0 // indirect github.com/sagikazarmark/slog-shim v0.1.0 // indirect - github.com/sasha-s/go-deadlock v0.3.1 // indirect + github.com/sasha-s/go-deadlock v0.3.5 // indirect github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect github.com/sourcegraph/conc v0.3.0 // indirect github.com/spf13/afero v1.11.0 // indirect @@ -191,60 +209,80 @@ require ( github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect github.com/tendermint/go-amino v0.16.0 // indirect github.com/tidwall/btree v1.7.0 // indirect - github.com/tklauser/go-sysconf v0.3.10 // indirect - github.com/tklauser/numcpus v0.4.0 // indirect + github.com/tklauser/go-sysconf v0.3.12 // indirect + github.com/tklauser/numcpus v0.6.1 // indirect github.com/tyler-smith/go-bip39 v1.1.0 // indirect - github.com/ulikunitz/xz v0.5.11 // indirect + github.com/ulikunitz/xz v0.5.12 // indirect github.com/zondax/hid v0.9.2 // indirect github.com/zondax/ledger-go v0.14.3 // indirect - go.etcd.io/bbolt v1.3.8 // indirect + go.etcd.io/bbolt v1.3.10 // indirect go.opencensus.io v0.24.0 // indirect - go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.47.0 // indirect - go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.47.0 // indirect - go.opentelemetry.io/otel v1.22.0 // indirect - go.opentelemetry.io/otel/metric v1.22.0 // indirect - go.opentelemetry.io/otel/trace v1.22.0 // indirect - go.uber.org/atomic v1.10.0 // indirect - go.uber.org/multierr v1.9.0 // indirect - golang.org/x/net v0.24.0 // indirect - golang.org/x/oauth2 v0.17.0 // indirect - golang.org/x/sync v0.7.0 // indirect - golang.org/x/sys v0.19.0 // indirect - golang.org/x/term v0.19.0 // indirect - golang.org/x/text v0.14.0 // indirect - golang.org/x/time v0.5.0 // indirect - google.golang.org/api v0.162.0 // indirect - google.golang.org/appengine v1.6.8 // indirect - google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240401170217-c3f982113cda // indirect + go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.49.0 // indirect + go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 // indirect + go.opentelemetry.io/otel v1.28.0 // indirect + go.opentelemetry.io/otel/metric v1.28.0 // indirect + go.opentelemetry.io/otel/trace v1.28.0 // indirect + go.uber.org/multierr v1.11.0 // indirect + golang.org/x/net v0.29.0 // indirect + golang.org/x/oauth2 v0.23.0 // indirect + golang.org/x/sync v0.8.0 // indirect + golang.org/x/sys v0.26.0 // indirect + golang.org/x/term v0.25.0 // indirect + golang.org/x/text v0.19.0 // indirect + golang.org/x/time v0.6.0 // indirect + google.golang.org/api v0.192.0 // indirect + google.golang.org/genproto v0.0.0-20240814211410-ddb44dafa142 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240930140551-af27646dc61f // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect gopkg.in/yaml.v3 v3.0.1 // indirect - nhooyr.io/websocket v1.8.6 // indirect + gotest.tools/v3 v3.5.1 // indirect + nhooyr.io/websocket v1.8.10 // indirect pgregory.net/rapid v1.1.0 // indirect ) replace ( + cosmossdk.io/core/comet => cosmossdk.io/core/comet v0.11.0 // Use the cosmos keyring code github.com/99designs/keyring => github.com/cosmos/keyring v1.2.0 // Use cometbft fork of tendermint - github.com/cometbft/cometbft => github.com/kava-labs/cometbft v0.37.9-kava.1 - github.com/cometbft/cometbft-db => github.com/kava-labs/cometbft-db v0.9.1-kava.2 + //github.com/cometbft/cometbft => github.com/kava-labs/cometbft cometbft-patch-test // 8345af773eb9d2fe95656815662f28b0f3b64b46 + github.com/cometbft/cometbft => github.com/kava-labs/cometbft v0.0.0-20241007151334-8345af773eb9 + //github.com/cometbft/cometbft-db => github.com/kava-labs/cometbft-db kava-patched-test b2740b2e4bed1112feb4157b154ce969759b52ce + github.com/cometbft/cometbft-db => github.com/kava-labs/cometbft-db v0.0.0-20241007145430-b2740b2e4bed // Use cosmos-sdk fork with backported fix for unsafe-reset-all, staking transfer events, and custom tally handler support - github.com/cosmos/cosmos-sdk => github.com/kava-labs/cosmos-sdk v0.47.10-iavl-v1-kava.1 + //github.com/cosmos/cosmos-sdk => github.com/kava-labs/cosmos-sdk v0.47.10-iavl-v1-kava.1 + //github.com/cosmos/cosmos-sdk => github.com/kava-labs/cosmos-sdk v0.50.10-test-patch 5f9239e3147358ef034bfc4d19aacb34e5ea2064 + //github.com/cosmos/cosmos-sdk => github.com/kava-labs/cosmos-sdk v0.0.0-20241007153930-5f9239e31473 + //github.com/cosmos/cosmos-sdk => github.com/kava-labs/cosmos-sdk v0.0.0-20241018152705-551d7afde55e + github.com/cosmos/cosmos-sdk => ../cosmos-sdk + + //github.com/cosmos/cosmos-sdk/store => cosmossdk.io/store v1.1.1 + github.com/cosmos/cosmos-sdk/x/evidence => cosmossdk.io/x/evidence v0.1.1 + github.com/cosmos/cosmos-sdk/x/feegrant => cosmossdk.io/x/feegrant v0.1.1 + github.com/cosmos/cosmos-sdk/x/nft => cosmossdk.io/x/nft v0.1.1 + github.com/cosmos/cosmos-sdk/x/upgrade => cosmossdk.io/x/upgrade v0.1.4 // See https://github.com/cosmos/cosmos-sdk/pull/13093 github.com/dgrijalva/jwt-go => github.com/golang-jwt/jwt/v4 v4.4.2 // Tracking kava-labs/go-ethereum kava/release/v1.10 branch // TODO: Tag before release github.com/ethereum/go-ethereum => github.com/Kava-Labs/go-ethereum v1.10.27-0.20240513233504-6e038346780b + // We can also to use wrap over EVM instead of changing this + //github.com/ethereum/go-ethereum => github.com/Kava-Labs/go-ethereum v0.0.0-20241015215028-50a0b049fdc5 // Use ethermint fork that respects min-gas-price with NoBaseFee true and london enabled, and includes eip712 support // Tracking kava-labs/etheremint master branch // TODO: Tag before release - github.com/evmos/ethermint => github.com/kava-labs/ethermint v0.21.1-0.20240802224012-586960857184 + //github.com/evmos/ethermint => github.com/kava-labs/ethermint v0.21.1-0.20240802224012-586960857184 + // first PR + //github.com/evmos/ethermint => github.com/kava-labs/ethermint v0.0.0-20241017145243-770ae9c06817 + // second PR + //github.com/evmos/ethermint => github.com/kava-labs/ethermint v0.0.0-20241018210905-a6216604a483 + github.com/evmos/ethermint => ../ethermint // See https://github.com/cosmos/cosmos-sdk/pull/10401, https://github.com/cosmos/cosmos-sdk/commit/0592ba6158cd0bf49d894be1cef4faeec59e8320 github.com/gin-gonic/gin => github.com/gin-gonic/gin v1.9.0 // Downgraded to avoid bugs in following commits which causes "version does not exist" errors github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 - // Avoid change in slices.SortFunc, see https://github.com/cosmos/cosmos-sdk/issues/20159 - golang.org/x/exp => golang.org/x/exp v0.0.0-20230711153332-06a737ee72cb +// Avoid change in slices.SortFunc, see https://github.com/cosmos/cosmos-sdk/issues/20159 +// Was fixed +//golang.org/x/exp => golang.org/x/exp v0.0.0-20230711153332-06a737ee72cb ) diff --git a/go.sum b/go.sum index 7934ead58c..80a42137de 100644 --- a/go.sum +++ b/go.sum @@ -1,13 +1,11 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= -cloud.google.com/go v0.43.0/go.mod h1:BOSR3VbTLkk6FDC/TcffxP4NF/FFBGA5ku+jvKOP7pg= cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= -cloud.google.com/go v0.51.0/go.mod h1:hWtGJ6gnXH+KgDv+V0zFGDvpi07n3z8ZNj3T1RW0Gcw= cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4= cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M= cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc= @@ -32,8 +30,8 @@ cloud.google.com/go v0.100.2/go.mod h1:4Xra9TjzAeYHrl5+oeLlzbM2k3mjVhZh4UqTZ//w9 cloud.google.com/go v0.102.0/go.mod h1:oWcCzKlqJ5zgHQt9YsaeTY9KzIvjyy0ArmiBUgpQ+nc= cloud.google.com/go v0.102.1/go.mod h1:XZ77E9qnTEnrgEOvr4xzfdX5TRo7fB4T2F4O6+34hIU= cloud.google.com/go v0.104.0/go.mod h1:OO6xxXdJyvuJPcEPBLN9BJPD+jep5G1+2U5B5gkRYtA= -cloud.google.com/go v0.112.0 h1:tpFCD7hpHFlQ8yPwT3x+QeXqc2T6+n6T+hmABHfDUSM= -cloud.google.com/go v0.112.0/go.mod h1:3jEEVwZ/MHU4djK5t5RHuKOA/GbLddgTdVubX1qnPD4= +cloud.google.com/go v0.115.1 h1:Jo0SM9cQnSkYfp44+v+NQXHpcHqlnRJk2qxh6yvxxxQ= +cloud.google.com/go v0.115.1/go.mod h1:DuujITeaufu3gL68/lOFIirVNJwQeyf5UXyi+Wbgknc= cloud.google.com/go/aiplatform v1.22.0/go.mod h1:ig5Nct50bZlzV6NvKaTwmplLLddFx0YReh9WfTO5jKw= cloud.google.com/go/aiplatform v1.24.0/go.mod h1:67UUvRBKG6GTayHKV8DBv2RtR1t93YRu5B1P3x99mYY= cloud.google.com/go/analytics v0.11.0/go.mod h1:DjEWCu41bVbYcKyvlws9Er60YE4a//bK6mnhWvQeFNI= @@ -48,6 +46,10 @@ cloud.google.com/go/asset v1.8.0/go.mod h1:mUNGKhiqIdbr8X7KNayoYvyc4HbbFO9URsjby cloud.google.com/go/assuredworkloads v1.5.0/go.mod h1:n8HOZ6pff6re5KYfBXcFvSViQjDwxFkAkmUFffJRbbY= cloud.google.com/go/assuredworkloads v1.6.0/go.mod h1:yo2YOk37Yc89Rsd5QMVECvjaMKymF9OP+QXWlKXUkXw= cloud.google.com/go/assuredworkloads v1.7.0/go.mod h1:z/736/oNmtGAyU47reJgGN+KVoYoxeLBoj4XkKYscNI= +cloud.google.com/go/auth v0.8.1 h1:QZW9FjC5lZzN864p13YxvAtGUlQ+KgRL+8Sg45Z6vxo= +cloud.google.com/go/auth v0.8.1/go.mod h1:qGVp/Y3kDRSDZ5gFD/XPUfYQ9xW1iI7q8RIRoCyBbJc= +cloud.google.com/go/auth/oauth2adapt v0.2.3 h1:MlxF+Pd3OmSudg/b1yZ5lJwoXCEaeedAguodky1PcKI= +cloud.google.com/go/auth/oauth2adapt v0.2.3/go.mod h1:tMQXOfZzFuNuUxOypHlQEXgdfX5cuhwU+ffUuXRJE8I= cloud.google.com/go/automl v1.5.0/go.mod h1:34EjfoFGMZ5sgJ9EoLsRtdPSNZLcfflJR39VbVNS2M0= cloud.google.com/go/automl v1.6.0/go.mod h1:ugf8a6Fx+zP0D59WLhqgTDsQI9w07o64uf/Is3Nh5p8= cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= @@ -57,7 +59,6 @@ cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUM cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= cloud.google.com/go/bigquery v1.42.0/go.mod h1:8dRTJxhtG+vwBKzE5OseQn/hiydoQN3EedCaOdYmxRA= -cloud.google.com/go/bigtable v1.2.0/go.mod h1:JcVAOl45lrTmQfLj7T6TxyMzIN/3FGGcFm+2xVAli2o= cloud.google.com/go/billing v1.4.0/go.mod h1:g9IdKBEFlItS8bTtlrZdVLWSSdSyFUZKXNS02zKMOZY= cloud.google.com/go/billing v1.5.0/go.mod h1:mztb1tBc3QekhjSgmpf/CV4LzWXLzCArwpLmP2Gm88s= cloud.google.com/go/binaryauthorization v1.1.0/go.mod h1:xwnoWu3Y84jbuHa0zd526MJYmtnVXn0syOjaJgy4+dM= @@ -71,10 +72,8 @@ cloud.google.com/go/compute v1.6.0/go.mod h1:T29tfhtVbq1wvAPo0E3+7vhgmkOYeXjhFvz cloud.google.com/go/compute v1.6.1/go.mod h1:g85FgpzFvNULZ+S8AYq87axRKuf2Kh7deLqV/jJ3thU= cloud.google.com/go/compute v1.7.0/go.mod h1:435lt8av5oL9P3fv1OEzSbSUe+ybHXGMPQHHZWZxy9U= cloud.google.com/go/compute v1.10.0/go.mod h1:ER5CLbMxl90o2jtNbGSbtfOpQKR0t15FOtRsugnLrlU= -cloud.google.com/go/compute v1.24.0 h1:phWcR2eWzRJaL/kOiJwfFsPs4BaKq1j6vnpZrc1YlVg= -cloud.google.com/go/compute v1.24.0/go.mod h1:kw1/T+h/+tK2LJK0wiPPx1intgdAM3j/g3hFDlscY40= -cloud.google.com/go/compute/metadata v0.2.3 h1:mg4jlk7mCAj6xXp9UJ4fjI9VUI5rubuGBW5aJ7UnBMY= -cloud.google.com/go/compute/metadata v0.2.3/go.mod h1:VAV5nSsACxMJvgaAuX6Pk2AawlZn8kiOGuCv6gTkwuA= +cloud.google.com/go/compute/metadata v0.5.0 h1:Zr0eK8JbFv6+Wi4ilXAR8FJ3wyNdpxHKJNPos6LTZOY= +cloud.google.com/go/compute/metadata v0.5.0/go.mod h1:aHnloV2TPI38yx4s9+wAZhHykWvVCfu7hQbF+9CWoiY= cloud.google.com/go/containeranalysis v0.5.1/go.mod h1:1D92jd8gRR/c0fGMlymRgxWD3Qw9C1ff6/T7mLgVL8I= cloud.google.com/go/containeranalysis v0.6.0/go.mod h1:HEJoiEIu+lEXM+k7+qLCci0h33lX3ZqoYFdmPcoO7s4= cloud.google.com/go/datacatalog v1.3.0/go.mod h1:g9svFY6tuR+j+hrTw3J2dNcmI0dzmSiyOzm8kpLq0a0= @@ -112,12 +111,14 @@ cloud.google.com/go/gkehub v0.10.0/go.mod h1:UIPwxI0DsrpsVoWpLB0stwKCP+WFVG9+y97 cloud.google.com/go/grafeas v0.2.0/go.mod h1:KhxgtF2hb0P191HlY5besjYm6MqTSTj3LSI+M+ByZHc= cloud.google.com/go/iam v0.3.0/go.mod h1:XzJPvDayI+9zsASAFO68Hk07u3z+f+JrT2xXNdp4bnY= cloud.google.com/go/iam v0.5.0/go.mod h1:wPU9Vt0P4UmCux7mqtRu6jcpPAb74cP1fh50J3QpkUc= -cloud.google.com/go/iam v1.1.6 h1:bEa06k05IO4f4uJonbB5iAgKTPpABy1ayxaIZV/GHVc= -cloud.google.com/go/iam v1.1.6/go.mod h1:O0zxdPeGBoFdWW3HWmBxJsk0pfvNM/p/qa82rWOGTwI= +cloud.google.com/go/iam v1.1.13 h1:7zWBXG9ERbMLrzQBRhFliAV+kjcRToDTgQT3CTwYyv4= +cloud.google.com/go/iam v1.1.13/go.mod h1:K8mY0uSXwEXS30KrnVb+j54LB/ntfZu1dr+4zFMNbus= cloud.google.com/go/language v1.4.0/go.mod h1:F9dRpNFQmJbkaop6g0JhSBXCNlO90e1KWx5iDdxbWic= cloud.google.com/go/language v1.6.0/go.mod h1:6dJ8t3B+lUYfStgls25GusK04NLh3eDLQnWM3mdEbhI= cloud.google.com/go/lifesciences v0.5.0/go.mod h1:3oIKy8ycWGPUyZDR/8RNnTOYevhaMLqh5vLUXs9zvT8= cloud.google.com/go/lifesciences v0.6.0/go.mod h1:ddj6tSX/7BOnhxCSd3ZcETvtNr8NZ6t/iPhY2Tyfu08= +cloud.google.com/go/longrunning v0.5.11 h1:Havn1kGjz3whCfoD8dxMLP73Ph5w+ODyZB9RUsDxtGk= +cloud.google.com/go/longrunning v0.5.11/go.mod h1:rDn7//lmlfWV1Dx6IB4RatCPenTwwmqXuiP0/RgoEO4= cloud.google.com/go/mediatranslation v0.5.0/go.mod h1:jGPUhGTybqsPQn91pNXw0xVHfuJ3leR1wj37oU3y1f4= cloud.google.com/go/mediatranslation v0.6.0/go.mod h1:hHdBCTYNigsBxshbznuIMFNe5QXEowAuNmmC7h8pu5w= cloud.google.com/go/memcache v1.4.0/go.mod h1:rTOfiGZtJX1AaFUrOgsMHX5kAzaTQ8azHiuDoTPzNsE= @@ -174,8 +175,8 @@ cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9 cloud.google.com/go/storage v1.22.1/go.mod h1:S8N1cAStu7BOeFfE8KAQzmyyLkK8p/vmRq6kuBTW58Y= cloud.google.com/go/storage v1.23.0/go.mod h1:vOEEDNFnciUMhBeT6hsJIn3ieU5cFRmzeLgDvXzfIXc= cloud.google.com/go/storage v1.27.0/go.mod h1:x9DOL8TK/ygDUMieqwfhdpQryTeEkhGKMi80i/iqR2s= -cloud.google.com/go/storage v1.36.0 h1:P0mOkAcaJxhCTvAkMhxMfrTKiNcub4YmmPBtlhAyTr8= -cloud.google.com/go/storage v1.36.0/go.mod h1:M6M/3V/D3KpzMTJyPOR/HU6n2Si5QdaXYEsng2xgOs8= +cloud.google.com/go/storage v1.43.0 h1:CcxnSohZwizt4LCzQHWvBf1/kvtHUn7gk9QERXPyXFs= +cloud.google.com/go/storage v1.43.0/go.mod h1:ajvxEa7WmZS1PxvKRq4bq0tFT3vMd502JwstCcYv0Q0= cloud.google.com/go/talent v1.1.0/go.mod h1:Vl4pt9jiHKvOgF9KoZo6Kob9oV4lwd/ZD5Cto54zDRw= cloud.google.com/go/talent v1.2.0/go.mod h1:MoNF9bhFQbiJ6eFD3uSsg0uBALw4n4gaCaEjBw9zo8g= cloud.google.com/go/videointelligence v1.6.0/go.mod h1:w0DIDlVRKtwPCn/C4iwZIJdvC69yInhW0cfi+p546uU= @@ -187,42 +188,47 @@ cloud.google.com/go/webrisk v1.4.0/go.mod h1:Hn8X6Zr+ziE2aNd8SliSDWpEnSS1u4R9+xX cloud.google.com/go/webrisk v1.5.0/go.mod h1:iPG6fr52Tv7sGk0H6qUFzmL3HHZev1htXuWDEEsqMTg= cloud.google.com/go/workflows v1.6.0/go.mod h1:6t9F5h/unJz41YqfBmqSASJSXccBLtD1Vwf+KmJENM0= cloud.google.com/go/workflows v1.7.0/go.mod h1:JhSrZuVZWuiDfKEFxU0/F1PQjmpnpcoISEXH2bcHC3M= -collectd.org v0.3.0/go.mod h1:A/8DzQBkF6abtvrT2j/AU/4tiBgJWYyh0y/oB/4MlWE= -cosmossdk.io/api v0.3.1 h1:NNiOclKRR0AOlO4KIqeaG6PS6kswOMhHD0ir0SscNXE= -cosmossdk.io/api v0.3.1/go.mod h1:DfHfMkiNA2Uhy8fj0JJlOCYOBp4eWUUJ1te5zBGNyIw= -cosmossdk.io/core v0.6.1 h1:OBy7TI2W+/gyn2z40vVvruK3di+cAluinA6cybFbE7s= -cosmossdk.io/core v0.6.1/go.mod h1:g3MMBCBXtxbDWBURDVnJE7XML4BG5qENhs0gzkcpuFA= -cosmossdk.io/depinject v1.0.0-alpha.4 h1:PLNp8ZYAMPTUKyG9IK2hsbciDWqna2z1Wsl98okJopc= -cosmossdk.io/depinject v1.0.0-alpha.4/go.mod h1:HeDk7IkR5ckZ3lMGs/o91AVUc7E596vMaOmslGFM3yU= +cosmossdk.io/api v0.7.5 h1:eMPTReoNmGUm8DeiQL9DyM8sYDjEhWzL1+nLbI9DqtQ= +cosmossdk.io/api v0.7.5/go.mod h1:IcxpYS5fMemZGqyYtErK7OqvdM0C8kdW3dq8Q/XIG38= +cosmossdk.io/client/v2 v2.0.0-beta.3 h1:+TTuH0DwQYsUq2JFAl3fDZzKq5gQG7nt3dAattkjFDU= +cosmossdk.io/client/v2 v2.0.0-beta.3/go.mod h1:CZcL41HpJPOOayTCO28j8weNBQprG+SRiKX39votypo= +cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= +cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0= +cosmossdk.io/core v0.11.1 h1:h9WfBey7NAiFfIcUhDVNS503I2P2HdZLebJlUIs8LPA= +cosmossdk.io/core v0.11.1/go.mod h1:OJzxcdC+RPrgGF8NJZR2uoQr56tc7gfBKhiKeDO7hH0= +cosmossdk.io/depinject v1.0.0 h1:dQaTu6+O6askNXO06+jyeUAnF2/ssKwrrszP9t5q050= +cosmossdk.io/depinject v1.0.0/go.mod h1:zxK/h3HgHoA/eJVtiSsoaRaRA2D5U4cJ5thIG4ssbB8= cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= -cosmossdk.io/log v1.3.1 h1:UZx8nWIkfbbNEWusZqzAx3ZGvu54TZacWib3EzUYmGI= -cosmossdk.io/log v1.3.1/go.mod h1:2/dIomt8mKdk6vl3OWJcPk2be3pGOS8OQaLUM/3/tCM= +cosmossdk.io/log v1.4.1 h1:wKdjfDRbDyZRuWa8M+9nuvpVYxrEOwbD/CA8hvhU8QM= +cosmossdk.io/log v1.4.1/go.mod h1:k08v0Pyq+gCP6phvdI6RCGhLf/r425UT6Rk/m+o74rU= cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= cosmossdk.io/simapp v0.0.0-20231127212628-044ff4d8c015 h1:ARUqouMWNreV8e5wxPberry+tm+Uk+1eeJDt3KXQEn0= cosmossdk.io/simapp v0.0.0-20231127212628-044ff4d8c015/go.mod h1:VNknW36ZIgwkjKtb6eyA4RZ7x9+ZpKMVCsAUA6bFWnk= -cosmossdk.io/tools/rosetta v0.2.1 h1:ddOMatOH+pbxWbrGJKRAawdBkPYLfKXutK9IETnjYxw= -cosmossdk.io/tools/rosetta v0.2.1/go.mod h1:Pqdc1FdvkNV3LcNIkYWt2RQY6IP1ge6YWZk8MhhO9Hw= -filippo.io/edwards25519 v1.0.0-rc.1/go.mod h1:N1IkdkCkiLB6tki+MYJoSx2JTY9NUlxZE7eHn5EwJns= -filippo.io/edwards25519 v1.0.0 h1:0wAIcmJUqRdI8IJ/3eGi5/HwXZWPujYXXlkrQogz0Ek= -filippo.io/edwards25519 v1.0.0/go.mod h1:N1IkdkCkiLB6tki+MYJoSx2JTY9NUlxZE7eHn5EwJns= -git.sr.ht/~sircmpwn/getopt v0.0.0-20191230200459-23622cc906b3/go.mod h1:wMEGFFFNuPos7vHmWXfszqImLppbc0wEhh6JBfJIUgw= -git.sr.ht/~sircmpwn/go-bare v0.0.0-20210406120253-ab86bc2846d9/go.mod h1:BVJwbDfVjCjoFiKrhkei6NdGcZYpkDkdyCdg1ukytRA= +cosmossdk.io/store v1.1.1 h1:NA3PioJtWDVU7cHHeyvdva5J/ggyLDkyH0hGHl2804Y= +cosmossdk.io/store v1.1.1/go.mod h1:8DwVTz83/2PSI366FERGbWSH7hL6sB7HbYp8bqksNwM= +cosmossdk.io/x/circuit v0.1.1 h1:KPJCnLChWrxD4jLwUiuQaf5mFD/1m7Omyo7oooefBVQ= +cosmossdk.io/x/circuit v0.1.1/go.mod h1:B6f/urRuQH8gjt4eLIXfZJucrbreuYrKh5CSjaOxr+Q= +cosmossdk.io/x/evidence v0.1.1 h1:Ks+BLTa3uftFpElLTDp9L76t2b58htjVbSZ86aoK/E4= +cosmossdk.io/x/evidence v0.1.1/go.mod h1:OoDsWlbtuyqS70LY51aX8FBTvguQqvFrt78qL7UzeNc= +cosmossdk.io/x/feegrant v0.1.1 h1:EKFWOeo/pup0yF0svDisWWKAA9Zags6Zd0P3nRvVvw8= +cosmossdk.io/x/feegrant v0.1.1/go.mod h1:2GjVVxX6G2fta8LWj7pC/ytHjryA6MHAJroBWHFNiEQ= +cosmossdk.io/x/tx v0.13.5 h1:FdnU+MdmFWn1pTsbfU0OCf2u6mJ8cqc1H4OMG418MLw= +cosmossdk.io/x/tx v0.13.5/go.mod h1:V6DImnwJMTq5qFjeGWpXNiT/fjgE4HtmclRmTqRVM3w= +cosmossdk.io/x/upgrade v0.1.4 h1:/BWJim24QHoXde8Bc64/2BSEB6W4eTydq0X/2f8+g38= +cosmossdk.io/x/upgrade v0.1.4/go.mod h1:9v0Aj+fs97O+Ztw+tG3/tp5JSlrmT7IcFhAebQHmOPo= +dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= +filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= +filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 h1:/vQbFIOMbk2FiG/kXiLl8BRyzTWDw7gX/Hz7Dd5eDMs= github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4/go.mod h1:hN7oaIRCjzsZ2dE+yG5k+rsdt3qcwykqK6HVGcKwsw4= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.1/go.mod h1:fBF9PQNqB8scdgpZ3ufzaLntG0AG7C1WjPMsiFOmfHM= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.3/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= -github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v0.3.0/go.mod h1:tPaiy8S5bQ+S5sOiDlINkp7+Ef339+Nz5L5XO+cnOHo= -github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 h1:UQHMgLO+TxOElx5B5HZ4hJQsoJ/PvUvKRhJHDQXO8P8= -github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= +github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 h1:L/gRVlceqvL25UVaW/CKtUDjefjrs0SPonmDGUVOYP0= +github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/BurntSushi/toml v1.1.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= -github.com/ChainSafe/go-schnorrkel v1.0.0 h1:3aDA67lAykLaG1y3AOjs88dMxC88PgUuHRrLeDnvGIM= -github.com/ChainSafe/go-schnorrkel v1.0.0/go.mod h1:dpzHYVxLZcp8pjlV+O+UR8K0Hp/z7vcchBSbMBEhCw4= -github.com/DATA-DOG/go-sqlmock v1.3.3/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= +github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= +github.com/DataDog/datadog-go v3.2.0+incompatible h1:qSG2N4FghB1He/r2mFrWKCaL7dXCilEuNEeAn20fdD4= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= -github.com/DataDog/zstd v1.5.0/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= github.com/DataDog/zstd v1.5.5 h1:oWf5W7GtOLgp6bciQYDmhHHjdhYkALu6S/5Ni9ZgSvQ= github.com/DataDog/zstd v1.5.5/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= github.com/Kava-Labs/go-ethereum v1.10.27-0.20240513233504-6e038346780b h1:gTLS1VJL+6TEcttEmQ9rAmm/UZZw23WlQf6n8R/Xjx0= @@ -236,21 +242,22 @@ github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 h1:TngWCqHvy9oXAN6lEV github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5/go.mod h1:lmUJ/7eu/Q8D7ML55dXQrVaamCz2vxCfdQBasLZfHKk= github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= +github.com/PuerkitoBio/purell v1.1.1 h1:WEQqlqaGbrPkxLJWfBwQmfEAE1Z7ONdDLqrN38tNFfI= +github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= +github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 h1:d+Bc7a5rLufV/sSk/8dngufqelfh6jnri85riMAaF/M= +github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= -github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= github.com/StackExchange/wmi v1.2.1 h1:VIkavFPXSjcnS+O8yTq7NI32k0R5Aj+v39y29VYDOSA= github.com/StackExchange/wmi v1.2.1/go.mod h1:rcmrprowKIVzvc+NUiLncP2uuArMWLCbu9SBzvHz7e8= -github.com/VictoriaMetrics/fastcache v1.6.0 h1:C/3Oi3EiBCqufydp1neRZkqcwmEiuRT9c3fqvvgKm5o= -github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= +github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= +github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= github.com/VividCortex/gohistogram v1.0.0 h1:6+hBz+qvs0JOrrNhhmR7lFxo5sINxBCGXrdtl/UvroE= github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g= -github.com/Zilliqa/gozilliqa-sdk v1.2.1-0.20201201074141-dd0ecada1be6/go.mod h1:eSYp2T6f0apnuW8TzhV3f6Aff2SE8Dwio++U4ha4yEM= github.com/adlio/schema v1.3.3 h1:oBJn8I02PyTB466pZO1UZEn1TV5XLlifBSyMrmHl/1I= github.com/adlio/schema v1.3.3/go.mod h1:1EsRssiv9/Ce2CMzq5DoL7RiMshhuigQxrR4DMV9fHg= github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5/go.mod h1:SkGFH1ia65gfNATL8TAiHDNxPzPdmEL5uirI2Uyuz6c= -github.com/ajstarks/svgo v0.0.0-20180226025133-644b8db467af/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= @@ -259,33 +266,21 @@ github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk5 github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM= github.com/allegro/bigcache v1.2.1 h1:hg1sY1raCwic3Vnsvje6TT7/pnZba83LeFck5NrFKSc= github.com/allegro/bigcache v1.2.1/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM= -github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= -github.com/apache/arrow/go/arrow v0.0.0-20191024131854-af6fa24be0db/go.mod h1:VTxUBvSJ3s3eHAg65PNgrsn5BtqCRPdmyXh6rAfdxN0= github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= github.com/apache/thrift v0.13.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= -github.com/armon/go-metrics v0.4.1 h1:hR91U9KYmb6bLBYLQjyM+3j+rcd/UhE+G78SFnF8gJA= -github.com/armon/go-metrics v0.4.1/go.mod h1:E6amYzXo6aW1tqzoZGT755KkbgrJsSdpwZ+3JqfkOG4= github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/aryann/difflib v0.0.0-20170710044230-e206f873d14a/go.mod h1:DAHtR1m6lCRdSC2Tm3DSWRPvIPr6xNKyeHdqDQSQT+A= github.com/aws/aws-lambda-go v1.13.3/go.mod h1:4UKl9IzQMoD+QF79YdCuzCwp8VbmG4VAQwij/eHl5CU= github.com/aws/aws-sdk-go v1.27.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= github.com/aws/aws-sdk-go v1.44.122/go.mod h1:y4AeaBuwd2Lk+GepC1E9v0qOiTws0MIWAX4oIKwKHZo= -github.com/aws/aws-sdk-go v1.44.203 h1:pcsP805b9acL3wUqa4JR2vg1k2wnItkDYNvfmcy6F+U= -github.com/aws/aws-sdk-go v1.44.203/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI= +github.com/aws/aws-sdk-go v1.55.5 h1:KKUZBfBoyqy5d3swXyiC7Q76ic40rYcbqH7qjh59kzU= +github.com/aws/aws-sdk-go v1.55.5/go.mod h1:eRwEWoyTWFMVYVQzKMNHWP5/RV4xIUGMQfXQHfHkpNU= github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g= -github.com/aws/aws-sdk-go-v2 v1.2.0/go.mod h1:zEQs02YRBw1DjK0PoJv3ygDYOFTre1ejlJWl8FwAuQo= -github.com/aws/aws-sdk-go-v2/config v1.1.1/go.mod h1:0XsVy9lBI/BCXm+2Tuvt39YmdHwS5unDQmxZOYe8F5Y= -github.com/aws/aws-sdk-go-v2/credentials v1.1.1/go.mod h1:mM2iIjwl7LULWtS6JCACyInboHirisUUdkBPoTHMOUo= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.0.2/go.mod h1:3hGg3PpiEjHnrkrlasTfxFqUsZ2GCk/fMUn4CbKgSkM= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.0.2/go.mod h1:45MfaXZ0cNbeuT0KQ1XJylq8A6+OpVV2E5kvY/Kq+u8= -github.com/aws/aws-sdk-go-v2/service/route53 v1.1.1/go.mod h1:rLiOUrPLW/Er5kRcQ7NkwbjlijluLsrIbu/iyl35RO4= -github.com/aws/aws-sdk-go-v2/service/sso v1.1.1/go.mod h1:SuZJxklHxLAXgLTc1iFXbEWkXs7QRTQpCLGaKIprQW0= -github.com/aws/aws-sdk-go-v2/service/sts v1.1.1/go.mod h1:Wi0EBZwiz/K44YliU0EKxqTCJGUfYTWXrrBwkq736bM= -github.com/aws/smithy-go v1.1.0/go.mod h1:EzMw8dbp/YJL4A5/sbhGddag+NPT7q084agLbB9LgIw= +github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= @@ -293,36 +288,30 @@ github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6r github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d h1:xDfNPAt8lFiC1UJrqV3uuy861HCTo708pDMbjHHdCas= github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d/go.mod h1:6QX/PXZ00z/TKoufEY6K/a0k6AhaJrQKdFe6OfVXsa4= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= -github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 h1:41iFGWnSlI2gVpmOtVTJZNodLdLQLn/KsJqFvXwnd/s= -github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= -github.com/bmizerany/pat v0.0.0-20170815010413-6226ea591a40/go.mod h1:8rLXio+WjiTceGBHIoTvn60HIbs7Hm7bcHjyrSqYB9c= -github.com/boltdb/bolt v1.3.1/go.mod h1:clJnj/oiGkjum5o1McbSZDSLxVThjynRyGBgiAx27Ps= -github.com/btcsuite/btcd v0.0.0-20190315201642-aa6e0f35703c/go.mod h1:DrZx5ec/dmnfpw9KyYoQyYo7d0KEvTkk/5M/vbZjAr8= +github.com/bgentry/speakeasy v0.2.0 h1:tgObeVOf8WAvtuAX6DhJ4xks4CFNwPDZiqzGqIHE51E= +github.com/bgentry/speakeasy v0.2.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= +github.com/bits-and-blooms/bitset v1.8.0 h1:FD+XqgOZDUxxZ8hzoBFuV9+cGWY9CslN6d5MS5JVb4c= +github.com/bits-and-blooms/bitset v1.8.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8= github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= -github.com/btcsuite/btcd v0.21.0-beta.0.20201114000516-e9c7a5ac6401/go.mod h1:Sv4JPQ3/M+teHz9Bo5jBpkNcP0x6r7rdihlNL/7tTAs= github.com/btcsuite/btcd v0.22.0-beta.0.20220111032746-97732e52810c/go.mod h1:tjmYdS6MLJ5/s0Fj4DbLgSbDHbEqLJrtnHecBFkdz5M= -github.com/btcsuite/btcd v0.22.1/go.mod h1:wqgTSL29+50LRkmOVknEdmt8ZojIzhuWvgu/iptuN7Y= github.com/btcsuite/btcd v0.23.5-0.20231215221805-96c9fd8078fd/go.mod h1:nm3Bko6zh6bWP60UxwoT5LzdGJsQJaPo6HjduXq9p6A= -github.com/btcsuite/btcd v0.24.0 h1:gL3uHE/IaFj6fcZSu03SvqPMSx7s/dPzfpG/atRwWdo= -github.com/btcsuite/btcd v0.24.0/go.mod h1:K4IDc1593s8jKXIF7yS7yCTSxrknB9z0STzc2j6XgE4= +github.com/btcsuite/btcd v0.24.2 h1:aLmxPguqxza+4ag8R1I2nnJjSu2iFn/kqtHTIImswcY= +github.com/btcsuite/btcd v0.24.2/go.mod h1:5C8ChTkl5ejr3WHj8tkQSCmydiMEPB0ZhQhehpq7Dgg= github.com/btcsuite/btcd/btcec/v2 v2.1.0/go.mod h1:2VzYrv4Gm4apmbVVsSq5bqf1Ec8v56E48Vt0Y/umPgA= github.com/btcsuite/btcd/btcec/v2 v2.1.3/go.mod h1:ctjw4H1kknNJmRN4iP1R7bTQ+v3GJkZBd6mui8ZsAZE= -github.com/btcsuite/btcd/btcec/v2 v2.2.0/go.mod h1:U7MHm051Al6XmscBQ0BoNydpOTsFAn707034b5nY8zU= -github.com/btcsuite/btcd/btcec/v2 v2.3.2 h1:5n0X6hX0Zk+6omWcihdYvdAlGf2DfasC0GMf7DClJ3U= -github.com/btcsuite/btcd/btcec/v2 v2.3.2/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04= +github.com/btcsuite/btcd/btcec/v2 v2.3.4 h1:3EJjcN70HCu/mwqlUsGK8GcNVyLVxFDlWurTXGPFfiQ= +github.com/btcsuite/btcd/btcec/v2 v2.3.4/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04= github.com/btcsuite/btcd/btcutil v1.0.0/go.mod h1:Uoxwv0pqYWhD//tfTiipkxNfdhG9UrLwaeswfjfdF0A= github.com/btcsuite/btcd/btcutil v1.1.0/go.mod h1:5OapHB7A2hBBWLm48mmw4MOHNJCcUBTwmWH/0Jn8VHE= -github.com/btcsuite/btcd/btcutil v1.1.5 h1:+wER79R5670vs/ZusMTF1yTcRYE5GUsFbdjdisflzM8= github.com/btcsuite/btcd/btcutil v1.1.5/go.mod h1:PSZZ4UitpLBWzxGd5VGOrLnmOjtPP/a6HaFo12zMs00= +github.com/btcsuite/btcd/btcutil v1.1.6 h1:zFL2+c3Lb9gEgqKNzowKUPQNb8jV7v5Oaodi/AYFd6c= +github.com/btcsuite/btcd/btcutil v1.1.6/go.mod h1:9dFymx8HpuLqBnsPELrImQeTQfKBQqzqGbbV3jK55aE= github.com/btcsuite/btcd/chaincfg/chainhash v1.0.0/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0 h1:59Kx4K6lzOW5w6nFlA0v5+lk/6sjybR934QNHSJZPTQ= github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= -github.com/btcsuite/btcutil v0.0.0-20190207003914-4c204d697803/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= -github.com/btcsuite/btcutil v1.0.2/go.mod h1:j9HUFwoQRsZL3V4n+qG+CUnEGHOarIxfC3Le2Yhbcts= -github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce/go.mod h1:0DVlHczLPewLcPGEIeUEzfOJhqGPQ0mJJRDBtD307+o= github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg= github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY= github.com/btcsuite/goleveldb v1.0.0/go.mod h1:QiK9vBlgftBg6rWQIj6wFzbPfRjiykIEhBH4obrXJ/I= @@ -330,45 +319,44 @@ github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku github.com/btcsuite/snappy-go v1.0.0/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= -github.com/bufbuild/protocompile v0.4.0 h1:LbFKd2XowZvQ/kajzguUp2DC9UEIQhIq77fZZlaQsNA= -github.com/bufbuild/protocompile v0.4.0/go.mod h1:3v93+mbWn/v3xzN+31nwkJfrEpAUwp+BagBSZWx+TP8= -github.com/bwesterb/go-ristretto v1.2.0/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0= +github.com/bufbuild/protocompile v0.6.0 h1:Uu7WiSQ6Yj9DbkdnOe7U4mNKp58y9WDMKDn28/ZlunY= +github.com/bufbuild/protocompile v0.6.0/go.mod h1:YNP35qEYoYGme7QMtz5SBCoN4kL4g12jTtjuzRNdjpE= github.com/bytedance/sonic v1.5.0/go.mod h1:ED5hyg4y6t3/9Ku1R6dU/4KyJ48DZ4jPhfY1O2AihPM= -github.com/bytedance/sonic v1.8.0 h1:ea0Xadu+sHlu7x5O3gKhRpQ1IKiMrSiHttPF0ybECuA= github.com/bytedance/sonic v1.8.0/go.mod h1:i736AoUSYt75HyZLoJW9ERYxcy6eaN6h4BZXU064P/U= -github.com/c-bata/go-prompt v0.2.2/go.mod h1:VzqtzE2ksDBcdln8G7mk2RX9QyGjH+OVqOCSiVIqS34= github.com/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ= github.com/cenkalti/backoff v2.2.1+incompatible h1:tNowT99t7UNflLxfYYSlKYsBpXdEet03Pg2g16Swow4= github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM= github.com/cenkalti/backoff/v4 v4.1.1/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= -github.com/cenkalti/backoff/v4 v4.1.3 h1:cFAlzYUlVYDysBEH2T5hyJZMh3+5+WCBvSnK6Q8UtC4= -github.com/cenkalti/backoff/v4 v4.1.3/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= +github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8= +github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/cp v0.1.0 h1:SE+dxFebS7Iik5LK0tsi1k9ZCxEaFX4AjQmoyA+1dJk= github.com/cespare/cp v0.1.0/go.mod h1:SOGHArjBr4JWaSDEVpWpo/hNg6RoKrls6Oh40hiwW+s= github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cheggaaa/pb v1.0.27/go.mod h1:pQciLPpbU0oxA0h+VJYYLxO+XeDQb5pZijXscXHm81s= github.com/chenzhuoyu/base64x v0.0.0-20211019084208-fb5309c8db06/go.mod h1:DH46F32mSOjUmXrMHnKwZdA8wcEefY7UVqBKYGjpdQY= -github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 h1:qSGYFH7+jGhDF8vLC+iwCD4WpbV1EBDSzWkJODFLams= github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311/go.mod h1:b583jCggY9gE99b6G5LEC39OIiVsWj+R97kbl5odCEk= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= +github.com/chzyer/logex v1.2.0/go.mod h1:9+9sk7u7pGNWYMkh0hdiL++6OeibzJccyQU4p4MedaY= github.com/chzyer/logex v1.2.1 h1:XHDu3E6q+gdHgsdTPH6ImJMIp436vR6MPtH8gP05QzM= github.com/chzyer/logex v1.2.1/go.mod h1:JLbx6lG2kDbNRFnfkgvh4eRJRPX1QCoOIWomwysCBrQ= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= +github.com/chzyer/readline v1.5.0/go.mod h1:x22KAscuvRqlLoK9CsoYsmxoXZMMFVyOl86cAH8qUic= github.com/chzyer/readline v1.5.1 h1:upd/6fQk4src78LMRzh5vItIt361/o4uq553V8B5sGI= github.com/chzyer/readline v1.5.1/go.mod h1:Eh+b79XXUwfKfcPLepksvw2tcLE/Ct21YObkaSkeBlk= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= +github.com/chzyer/test v0.0.0-20210722231415-061457976a23/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= github.com/chzyer/test v1.0.0 h1:p3BQDXSxOhOG0P9z6/hGnII4LGiEPOYBhs8asl/fC04= github.com/chzyer/test v1.0.0/go.mod h1:2JlltgoNkt4TW/z9V/IzDdFaMTM2JPIi26O1pF38GC8= github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6Dob7S7YxXgwXpfOuvO54S+tGdZdw9fuRZt25Ag= github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I= github.com/clbanning/x2j v0.0.0-20191024224557-825249438eec/go.mod h1:jMjuTZXRI4dUb/I5gc9Hdhagfvm9+RyrPryS/auMzxE= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/cloudflare/cloudflare-go v0.14.0/go.mod h1:EnwdgGMaFOruiPZRFSgn+TsQ3hQ7C/YWzIGLeu5c304= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= @@ -378,33 +366,26 @@ github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWH github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20231128003011-0fa0005c9caa h1:jQCWAUqqlij9Pgj2i/PB79y4KOPYVyFYdROxgaCwdTQ= -github.com/cncf/xds/go v0.0.0-20231128003011-0fa0005c9caa/go.mod h1:x/1Gn8zydmfq8dk6e9PdstVsDgu9RuyIIJqAaF//0IM= github.com/cockroachdb/apd/v2 v2.0.2 h1:weh8u7Cneje73dDh+2tEVLUvyBc89iwepWCD8b8034E= github.com/cockroachdb/apd/v2 v2.0.2/go.mod h1:DDxRlzC2lo3/vSlmSoS7JkqbbrARPuFOGr0B9pvN3Gw= github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= github.com/cockroachdb/datadriven v1.0.3-0.20230413201302-be42291fc80f h1:otljaYPt5hWxV3MUfO5dFPFiOXg9CyG5/kCfayTqsJ4= github.com/cockroachdb/datadriven v1.0.3-0.20230413201302-be42291fc80f/go.mod h1:a9RdTaap04u637JoCzcUoIcDmvwSUtcUFtT/C3kJlTU= -github.com/cockroachdb/errors v1.11.1 h1:xSEW75zKaKCWzR3OfxXUxgrk/NtT4G1MiOv5lWZazG8= -github.com/cockroachdb/errors v1.11.1/go.mod h1:8MUxA3Gi6b25tYlFEBGLf+D8aISL+M4MIpiWMSNRfxw= +github.com/cockroachdb/errors v1.11.3 h1:5bA+k2Y6r+oz/6Z/RFlNeVCesGARKuC6YymtcDrbC/I= +github.com/cockroachdb/errors v1.11.3/go.mod h1:m4UIW4CDjx+R5cybPsNrRbreomiFqt8o1h1wUVazSd8= +github.com/cockroachdb/fifo v0.0.0-20240606204812-0bbfbd93a7ce h1:giXvy4KSc/6g/esnpM7Geqxka4WSqI1SZc7sMJFd3y4= +github.com/cockroachdb/fifo v0.0.0-20240606204812-0bbfbd93a7ce/go.mod h1:9/y3cnZ5GKakj/H4y9r9GTjCvAFta7KLgSHPJJYc52M= github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b h1:r6VH0faHjZeQy818SGhaone5OnYfxFR/+AzdY3sf5aE= github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b/go.mod h1:Vz9DsVWQQhf3vs21MhPMZpMGSht7O/2vFW2xusFUVOs= -github.com/cockroachdb/pebble v1.1.0 h1:pcFh8CdCIt2kmEpK0OIatq67Ln9uGDYY3d5XnE0LJG4= -github.com/cockroachdb/pebble v1.1.0/go.mod h1:sEHm5NOXxyiAoKWhoFxT8xMgd/f3RA6qUqQ1BXKrh2E= +github.com/cockroachdb/pebble v1.1.1 h1:XnKU22oiCLy2Xn8vp1re67cXg4SAasg/WDt1NtcRFaw= +github.com/cockroachdb/pebble v1.1.1/go.mod h1:4exszw1r40423ZsmkG/09AFEG83I0uDgfujJdbL6kYU= github.com/cockroachdb/redact v1.1.5 h1:u1PMllDkdFfPWaNGMyLD1+so+aq3uUItthCFqzwPJ30= github.com/cockroachdb/redact v1.1.5/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg= github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 h1:zuQyyAKVxetITBuuhv3BI9cMrmStnpT18zmgmTxunpo= github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06/go.mod h1:7nc4anLGjupUW/PeY5qiNYsdNXj7zopG+eqsS7To5IQ= github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= -github.com/coinbase/kryptology v1.8.0/go.mod h1:RYXOAPdzOGUe3qlSFkMGn58i3xUA8hmxYHksuq+8ciI= -github.com/coinbase/rosetta-sdk-go v0.7.9 h1:lqllBjMnazTjIqYrOGv8h8jxjg9+hJazIGZr9ZvoCcA= -github.com/coinbase/rosetta-sdk-go v0.7.9/go.mod h1:0/knutI7XGVqXmmH4OQD8OckFrbQ8yMsUZTG7FXCR2M= -github.com/confio/ics23/go v0.9.0 h1:cWs+wdbS2KRPZezoaaj+qBleXgUk5WOQFMP3CQFGTr4= -github.com/confio/ics23/go v0.9.0/go.mod h1:4LPZ2NYqnYIVRklaozjNR1FScgDJ2s5Xrp+e/mYVRak= -github.com/consensys/bavard v0.1.8-0.20210406032232-f3452dc9b572/go.mod h1:Bpd0/3mZuaj6Sj+PqrmIquiOKy397AKGThQPaGzNXAQ= -github.com/consensys/bavard v0.1.8-0.20210915155054-088da2f7f54a/go.mod h1:9ItSMtA/dXMAiL7BG6bqW2m3NdSEObYWoH223nGHukI= -github.com/consensys/gnark-crypto v0.4.1-0.20210426202927-39ac3d4b3f1f/go.mod h1:815PAHg3wvysy0SyIqanF8gZ0Y1wjk/hrDHD/iT88+Q= -github.com/consensys/gnark-crypto v0.5.3/go.mod h1:hOdPlWQV1gDLp7faZVeg8Y0iEPFaOUnCc4XeCCk96p0= +github.com/coinbase/rosetta-sdk-go/types v1.0.0 h1:jpVIwLcPoOeCR6o1tU+Xv7r5bMONNbHU7MuEHboiFuA= +github.com/coinbase/rosetta-sdk-go/types v1.0.0/go.mod h1:eq7W2TMRH22GTW0N0beDnN931DW0/WOI1R2sdHNHG4c= github.com/containerd/continuity v0.3.0 h1:nisirsYROK15TAMVukJOUyGJjz4BNQJBVsNvAXZJ/eg= github.com/containerd/continuity v0.3.0/go.mod h1:wJEAIwKOm/pBZuBd0JmeTvnLquTB1Ag8espWhkykbPM= github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= @@ -419,42 +400,40 @@ github.com/cosmos/cosmos-db v1.0.2 h1:hwMjozuY1OlJs/uh6vddqnk9j7VamLv+0DBlbEXbAK github.com/cosmos/cosmos-db v1.0.2/go.mod h1:Z8IXcFJ9PqKK6BIsVOB3QXtkKoqUOp1vRvPT39kOXEA= github.com/cosmos/cosmos-proto v1.0.0-beta.5 h1:eNcayDLpip+zVLRLYafhzLvQlSmyab+RC5W7ZfmxJLA= github.com/cosmos/cosmos-proto v1.0.0-beta.5/go.mod h1:hQGLpiIUloJBMdQMMWb/4wRApmI9hjHH05nefC0Ojec= -github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= github.com/cosmos/gogogateway v1.2.0 h1:Ae/OivNhp8DqBi/sh2A8a1D0y638GpL3tkmLQAiKxTE= github.com/cosmos/gogogateway v1.2.0/go.mod h1:iQpLkGWxYcnCdz5iAdLcRBSw3h7NXeOkZ4GUkT+tbFI= github.com/cosmos/gogoproto v1.4.2/go.mod h1:cLxOsn1ljAHSV527CHOtaIP91kK6cCrZETRBrkzItWU= -github.com/cosmos/gogoproto v1.4.10 h1:QH/yT8X+c0F4ZDacDv3z+xE3WU1P1Z3wQoLMBRJoKuI= -github.com/cosmos/gogoproto v1.4.10/go.mod h1:3aAZzeRWpAwr+SS/LLkICX2/kDFyaYVzckBDzygIxek= +github.com/cosmos/gogoproto v1.7.0 h1:79USr0oyXAbxg3rspGh/m4SWNyoz/GLaAh0QlCe2fro= +github.com/cosmos/gogoproto v1.7.0/go.mod h1:yWChEv5IUEYURQasfyBW5ffkMHR/90hiHgbNgrtp4j0= github.com/cosmos/iavl v1.2.0 h1:kVxTmjTh4k0Dh1VNL046v6BXqKziqMDzxo93oh3kOfM= github.com/cosmos/iavl v1.2.0/go.mod h1:HidWWLVAtODJqFD6Hbne2Y0q3SdxByJepHUOeoH4LiI= -github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7 v7.1.3 h1:MZGDMETv72suFpTAD6VPGqSIm1FJcChtk2HmVh9D+Bo= -github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7 v7.1.3/go.mod h1:UvDmcGIWJPIytq+Q78/ff5NTOsuX/7IrNgEugTW5i0s= -github.com/cosmos/ibc-go/v7 v7.4.0 h1:8FqYMptvksgMvlbN4UW9jFxTXzsPyfAzEZurujXac8M= -github.com/cosmos/ibc-go/v7 v7.4.0/go.mod h1:L/KaEhzV5TGUCTfGysVgMBQtl5Dm7hHitfpk+GIeoAo= -github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= -github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= +github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v8 v8.0.2 h1:dyLNlDElY6+5zW/BT/dO/3Ad9FpQblfh+9dQpYQodbA= +github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v8 v8.0.2/go.mod h1:82hPO/tRawbuFad2gPwChvpZ0JEIoNi91LwVneAYCeM= +github.com/cosmos/ibc-go/modules/capability v1.0.1 h1:ibwhrpJ3SftEEZRxCRkH0fQZ9svjthrX2+oXdZvzgGI= +github.com/cosmos/ibc-go/modules/capability v1.0.1/go.mod h1:rquyOV262nGJplkumH+/LeYs04P3eV8oB7ZM4Ygqk4E= +github.com/cosmos/ibc-go/v8 v8.5.1 h1:3JleEMKBjRKa3FeTKt4fjg22za/qygLBo7mDkoYTNBs= +github.com/cosmos/ibc-go/v8 v8.5.1/go.mod h1:P5hkAvq0Qbg0h18uLxDVA9q1kOJ0l36htMsskiNwXbo= +github.com/cosmos/ics23/go v0.11.0 h1:jk5skjT0TqX5e5QJbEnwXIS2yI2vnmLOgpQPeM5RtnU= +github.com/cosmos/ics23/go v0.11.0/go.mod h1:A8OjxPE67hHST4Icw94hOxxFEJMBG031xIGF/JHNIY0= github.com/cosmos/keyring v1.2.0 h1:8C1lBP9xhImmIabyXW4c3vFjjLiBdGCmfLUfeZlV1Yo= github.com/cosmos/keyring v1.2.0/go.mod h1:fc+wB5KTk9wQ9sDx0kFXB3A0MaeGHM9AwRStKOQ5vOA= github.com/cosmos/ledger-cosmos-go v0.13.3 h1:7ehuBGuyIytsXbd4MP43mLeoN2LTOEnk5nvue4rK+yM= github.com/cosmos/ledger-cosmos-go v0.13.3/go.mod h1:HENcEP+VtahZFw38HZ3+LS3Iv5XV6svsnkk9vdJtLr8= +github.com/cosmos/rosetta v0.50.6 h1:+Hgog7CUHevZuPxZaoqR8klTs1G3ukAcoVTIMporBmw= +github.com/cosmos/rosetta v0.50.6/go.mod h1:KUnwp2i9W0766Dv78HYNV5YKym+imaKmDvXc2W0Y1wA= github.com/cosmos/rosetta-sdk-go v0.10.0 h1:E5RhTruuoA7KTIXUcMicL76cffyeoyvNybzUGSKFTcM= github.com/cosmos/rosetta-sdk-go v0.10.0/go.mod h1:SImAZkb96YbwvoRkzSMQB6noNJXFgWl/ENIznEoYQI4= github.com/cpuguy83/go-md2man v1.0.10 h1:BSKMNlYxDvnunlTymqtgONjNnaRV1sTpcovwwjF22jk= github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= -github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= -github.com/cpuguy83/go-md2man/v2 v2.0.3 h1:qMCsGGgs+MAzDFyp9LpAe1Lqy/fY/qCovCm0qnXZOBM= -github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= -github.com/creachadair/taskgroup v0.4.2 h1:jsBLdAJE42asreGss2xZGZ8fJra7WtwnHWeJFxv2Li8= -github.com/creachadair/taskgroup v0.4.2/go.mod h1:qiXUOSrbwAY3u0JPGTzObbE3yf9hcXHDKBZ2ZjpCbgM= +github.com/cpuguy83/go-md2man/v2 v2.0.4 h1:wfIWP927BUkWJb2NmU/kNDYIBTh/ziUX91+lVfRxZq4= +github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/cyberdelia/templates v0.0.0-20141128023046-ca7fffd4298c/go.mod h1:GyV+0YP4qX0UQ7r2MoYZ+AvYDp12OF5yg4q8rGnyNh4= -github.com/danieljoos/wincred v1.1.2 h1:QLdCxFs1/Yl4zduvBdcHB8goaYk9RARS2SgLLRuAyr0= -github.com/danieljoos/wincred v1.1.2/go.mod h1:GijpziifJoIBfYh+S7BbkdUTU4LfM+QnGqR5Vl2tAx0= -github.com/dave/jennifer v1.2.0/go.mod h1:fIb+770HOpJ2fmN9EPPKOqm1vMGhB+TwXKMZhrIygKg= +github.com/danieljoos/wincred v1.2.1 h1:dl9cBrupW8+r5250DYkYxocLeZ1Y4vB1kxgtjxw8GQs= +github.com/danieljoos/wincred v1.2.1/go.mod h1:uGaFL9fDn3OLTvzCGulzE+SzjEe5NGlh5FdCcyfPwps= github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -466,36 +445,32 @@ github.com/decred/dcrd/crypto/blake256 v1.0.0/go.mod h1:sQl2p6Y26YV+ZOcSTP6thNdn github.com/decred/dcrd/crypto/blake256 v1.0.1 h1:7PltbUIQB7u/FfZ39+DGa/ShuMyJ5ilcvdfma9wOH6Y= github.com/decred/dcrd/crypto/blake256 v1.0.1/go.mod h1:2OfgNZ5wDpcsFmHmCK5gZTPcCXqlm2ArzUIkw9czNJo= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1/go.mod h1:hyedUtir6IdtD/7lIxGeCxkaw7y45JueMRL4DIyJDKs= -github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 h1:8UrgZ3GkP4i/CLijOJx79Yu+etlyjdBU4sfcs2WYQMs= -github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 h1:rpfIENRNNilwHwZeG5+P150SMrnNEcHYvcCuK6dPZSg= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0= github.com/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218= -github.com/deepmap/oapi-codegen v1.6.0/go.mod h1:ryDa9AgbELGeB+YEXE1dR53yAjHwFvE9iAUlWl9Al3M= -github.com/deepmap/oapi-codegen v1.8.2/go.mod h1:YLgSKSDv/bZQB7N4ws6luhozi3cEdRktEqrX88CvjIw= github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f h1:U5y3Y5UE0w7amNe7Z5G/twsBW0KEalRQXZzf8ufSh9I= github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f/go.mod h1:xH/i4TFMt8koVQZ6WFms69WAsDWr2XsYL3Hkl7jkoLE= github.com/dgraph-io/badger/v2 v2.2007.4 h1:TRWBQg8UrlUhaFdco01nO2uXwzKS7zd+HVdwV/GHc4o= github.com/dgraph-io/badger/v2 v2.2007.4/go.mod h1:vSw/ax2qojzbN6eXHIx6KPKtCSHJN/Uz0X0VPruTIhk= github.com/dgraph-io/ristretto v0.0.3-0.20200630154024-f66de99634de/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E= -github.com/dgraph-io/ristretto v0.0.3/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E= -github.com/dgraph-io/ristretto v0.1.1 h1:6CWw5tJNgpegArSHpNHJKldNeq03FQCwYvfMVWajOK8= -github.com/dgraph-io/ristretto v0.1.1/go.mod h1:S1GPSBCYCIhmVNfcth17y2zZtQT6wzkzgwUve0VDWWA= -github.com/dgryski/go-bitstream v0.0.0-20180413035011-3522498ce2c8/go.mod h1:VMaSuZ+SZcx/wljOQKvp5srsbCiKDEb6K2wC4+PiBmQ= +github.com/dgraph-io/ristretto v0.1.2-0.20240116140435-c67e07994f91 h1:Pux6+xANi0I7RRo5E1gflI4EZ2yx3BGZ75JkAIvGEOA= +github.com/dgraph-io/ristretto v0.1.2-0.20240116140435-c67e07994f91/go.mod h1:swkazRqnUf1N62d0Nutz7KIj2UKqsm/H8tD0nBJAXqM= github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 h1:fAjc9m62+UWV/WAFKLNi6ZS0675eEUC9y3AlwSbQu1Y= github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= -github.com/dlclark/regexp2 v1.4.1-0.20201116162257-a2a8dda75c91 h1:Izz0+t1Z5nI16/II7vuEo/nHjodOg0p7+OiDpjX5t1E= github.com/dlclark/regexp2 v1.4.1-0.20201116162257-a2a8dda75c91/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc= -github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= -github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= -github.com/docker/docker v1.6.2/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/dlclark/regexp2 v1.7.0 h1:7lJfhqlPssTb1WQx4yvTHN0uElPEv52sbaECrAQxjAo= +github.com/dlclark/regexp2 v1.7.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8= github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= -github.com/dop251/goja v0.0.0-20220405120441-9037c2b61cbf h1:Yt+4K30SdjOkRoRRm3vYNQgR+/ZIy0RmeUDZo7Y8zeQ= -github.com/dop251/goja v0.0.0-20220405120441-9037c2b61cbf/go.mod h1:R9ET47fwRVRPZnOGvHxxhuZcbrMCuiqOz3Rlrh4KSnk= +github.com/dop251/goja v0.0.0-20211022113120-dc8c55024d06/go.mod h1:R9ET47fwRVRPZnOGvHxxhuZcbrMCuiqOz3Rlrh4KSnk= +github.com/dop251/goja v0.0.0-20230806174421-c933cf95e127 h1:qwcF+vdFrvPSEUDSX5RVoRccG8a5DhOdWdQ4zN62zzo= +github.com/dop251/goja v0.0.0-20230806174421-c933cf95e127/go.mod h1:QMWlm50DNe14hD7t24KEqZuUdC9sOTy8W6XbCU1mlw4= github.com/dop251/goja_nodejs v0.0.0-20210225215109-d91c329300e7/go.mod h1:hn7BA7c8pLvoGndExHudxTDKZ84Pyvv+90pbBjbTz0Y= +github.com/dop251/goja_nodejs v0.0.0-20211022123610-8dd9abb0616d/go.mod h1:DngW8aVqWbuLRMHItjPUyqdj+HWPvnQe8V8y1nDpIbM= github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= @@ -505,7 +480,6 @@ github.com/dvsekhvalnov/jose2go v1.6.0/go.mod h1:QsHjhyTlD/lAVqn/NSbVZmSCGeDehTB github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= -github.com/eclipse/paho.mqtt.golang v1.2.0/go.mod h1:H9keYFcgq3Qr5OUJm/JZI/i6U7joQ8SYLhZwfeOo6Ts= github.com/edsrzf/mmap-go v1.0.0 h1:CEBF7HpRnUCSJgGUb5h1Gm7e3VkmVDrR8lvWVLtrOFw= github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= github.com/emicklei/dot v1.6.1 h1:ujpDlBkkwgWUY+qPId5IwapRW/xEoligRSYjioR6DFI= @@ -521,17 +495,14 @@ github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.m github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/envoyproxy/protoc-gen-validate v1.0.4 h1:gVPz/FMfvh57HdSJQyvBtF00j8JU4zdyUgIUNhlgg0A= -github.com/envoyproxy/protoc-gen-validate v1.0.4/go.mod h1:qys6tmnRsYrQqIhm2bvKZH4Blx/1gTIZ2UKVY1M+Yew= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= -github.com/felixge/httpsnoop v1.0.1/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= +github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM= +github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE= github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= -github.com/fjl/gencodec v0.0.0-20220412091415-8bb9e558978c/go.mod h1:AzA8Lj6YtixmJWL+wkKoBGsLWy9gFrAzi4g+5bCKwpY= github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5 h1:FtmdgXiUlNeRsoNMFlKLDt+S+6hbjVMEW6RGQ7aUf7c= github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0= -github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k= github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw= github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= github.com/franela/goblin v0.0.0-20200105215937-c9ffbefa60db/go.mod h1:7dvUGVsVBjqR7JHJk0brhHOZYGmfBYOrK0ZhYMEtBr4= @@ -542,28 +513,24 @@ github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMo github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= -github.com/garslo/gogen v0.0.0-20170306192744-1d203ffc1f61/go.mod h1:Q0X6pkwTILDlzrGEckF6HKjXe48EgsY/l7K7vhY4MW8= github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff h1:tY80oXqGNY4FhTFhk+o9oFHGINQ/+vhlm8HFzi6znCI= github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww= -github.com/getkin/kin-openapi v0.53.0/go.mod h1:7Yn5whZr5kJi6t+kShccXS8ae1APpYTW6yheSwk8Yi4= -github.com/getkin/kin-openapi v0.61.0/go.mod h1:7Yn5whZr5kJi6t+kShccXS8ae1APpYTW6yheSwk8Yi4= github.com/getsentry/sentry-go v0.27.0 h1:Pv98CIbtB3LkMWmXi4Joa5OOcwbmnX88sF5qbK3r3Ps= github.com/getsentry/sentry-go v0.27.0/go.mod h1:lc76E2QywIyW8WuBnwl8Lc4bkmQH4+w1gwTf25trprY= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= -github.com/gin-gonic/gin v1.9.0 h1:OjyFBKICoexlu99ctXNR2gg+c5pKrKMuyjgARg9qeY8= github.com/gin-gonic/gin v1.9.0/go.mod h1:W1Me9+hsUSyj3CePGrd1/QrKJMSJ1Tu/0hFEH89961k= -github.com/glycerine/go-unsnap-stream v0.0.0-20180323001048-9f0cb55181dd/go.mod h1:/20jfyN9Y5QPEAprSgKAUr+glWDY39ZiUEAYOEv5dsE= -github.com/glycerine/goconvey v0.0.0-20190410193231-58a59202ab31/go.mod h1:Ogl1Tioa0aV7gstGFO7KhffUsb9M4ydbEbbxpcEDc24= -github.com/go-chi/chi/v5 v5.0.0/go.mod h1:BBug9lr0cqtdAhsu6R4AAdvufI0/XBzAQSsUqJpoZOs= github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA= github.com/go-errors/errors v1.4.2/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og= +github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.10.0/go.mod h1:xUsJbQ/Fp4kEt7AFgCuvyX4a71u8h9jB8tj/ORgOZ7o= github.com/go-kit/kit v0.13.0 h1:OoneCcHKHQ03LfBpoQCUfCluwd2Vt3ohz+kvbJneZAU= github.com/go-kit/kit v0.13.0/go.mod h1:phqEHMMUbyrCFCTgH48JueqrM3md2HcAZ8N3XE4FKDg= +github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= github.com/go-kit/log v0.2.1 h1:MRVx0/zhvdseW+Gza6N9rVzU/IVzaeE1SFI4raAhmBU= github.com/go-kit/log v0.2.1/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= @@ -572,44 +539,32 @@ github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG github.com/go-logfmt/logfmt v0.6.0 h1:wGYYu3uicYdqXVgoYbvnkrPVXkuLM1p1ifugDMEdRi4= github.com/go-logfmt/logfmt v0.6.0/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= -github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= +github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/go-ole/go-ole v1.2.1/go.mod h1:7FAglXiTm7HKlQRDeOQ6ZNUHidzCWXuZWq/1dTyBNF8= github.com/go-ole/go-ole v1.2.5/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY= github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= -github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= -github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= -github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA= github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY= -github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY= github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= -github.com/go-playground/validator/v10 v10.11.2 h1:q3SHpufmypg+erIExEKUmsgmhDTyhcJ38oeKGACXohU= github.com/go-playground/validator/v10 v10.11.2/go.mod h1:NieE624vt4SCTJtD87arVLvdmjPAeV8BQlHtMnw9D7s= github.com/go-sourcemap/sourcemap v2.1.3+incompatible h1:W1iEw64niKVGogNgBN3ePyLFfuisuzeidWPMPWmECqU= github.com/go-sourcemap/sourcemap v2.1.3+incompatible/go.mod h1:F8jJfvm2KbVjc5NqelyYJmf/v5J0dwNLS2mL4sNA1Jg= github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= -github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-stack/stack v1.8.1 h1:ntEHSVwIt7PNXNpgPmVfMrNhLtgjlmnZha2kOpuRiDw= github.com/go-stack/stack v1.8.1/go.mod h1:dcoOX6HbPZSZptuspn9bctJ+N/CnF5gGygcUP3XYfe4= github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 h1:p104kn46Q8WdvHunIJ9dAyjPVtrBPhSr3KT2yUst43I= github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= -github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee h1:s+21KNqlpePfkah2I+gwHF8xmJWRjooY+5248k6m4A0= github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee/go.mod h1:L0fX3K22YWvt/FAX9NnzrNzcI4wNYi9Yku4O0LKYflo= -github.com/gobwas/pool v0.2.0 h1:QEmUOlnSjWtnpRGHF3SauEiOsy82Cup83Vf2LcMlnc8= github.com/gobwas/pool v0.2.0/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6WezmKEw= -github.com/gobwas/ws v1.0.2 h1:CoAavW/wd/kulfZmSIBt6p24n4j7tHgNVCjsfHVNUbo= github.com/gobwas/ws v1.0.2/go.mod h1:szmBTxLgaFppYjEmNtny/v3w89xOydFnnZMcgRRu/EM= -github.com/goccy/go-json v0.10.0 h1:mXKd9Qw4NuzShiRlOXKews24ufknHO7gx30lsDyokKA= github.com/goccy/go-json v0.10.0/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 h1:ZpnhV/YsD2/4cESfV5+Hoeu/iUR3ruzNvZ+yQfO03a0= github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2/go.mod h1:bBOAhwG1umN6/6ZUMtDFBMQR8jRg9O75tm9K00oMsK4= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= -github.com/gofrs/uuid v3.3.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/gogo/googleapis v1.1.0/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s= github.com/gogo/googleapis v1.4.1-0.20201022092350-68b0159b7869/go.mod h1:5YRNX2z1oM5gXdAkurHa942MDgEJyk02w4OecKY87+c= github.com/gogo/googleapis v1.4.1 h1:1Yx4Myt7BxzvUr5ldGSbwYiZG6t9wGBZ+8/fX3Wvtq0= @@ -623,11 +578,7 @@ github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69 github.com/golang-jwt/jwt/v4 v4.3.0 h1:kHL1vqdqWNfATmA0FNMdmZNMyZI1U6O31X4rlIPoBog= github.com/golang-jwt/jwt/v4 v4.3.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg= github.com/golang-jwt/jwt/v4 v4.4.2/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= -github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k= -github.com/golang/geo v0.0.0-20190916061304-5b978397cfec/go.mod h1:QZ0nwyI2jOfgRAoBvP+ab5aRr7c9x7lhGEJrKvBwjWI= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/glog v1.2.0 h1:uCdmnmatrKCgMBlM4rMuJZWOkPDqdbZPnrMXDY4gI68= -github.com/golang/glog v1.2.0/go.mod h1:6AhwSGph0fcJtXVM/PEHPqZlFeoLxhs7/t5UDAwmO+w= github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -666,14 +617,13 @@ github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/golangci/lint-1 v0.0.0-20181222135242-d2cdd8c08219/go.mod h1:/X8TswGSh1pIozq4ZwCfxS0WA5JGXguxk94ar/4c87Y= +github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb h1:PBC98N2aIaM3XXiurYmW7fx4GZkL8feAMVq7nEjURHk= +github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/btree v1.1.2 h1:xf4v41cLI2Z6FxbKm+8Bu+m8ifhj15JuZ9sa0jZCMUU= -github.com/google/btree v1.1.2/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl761Gm4= -github.com/google/flatbuffers v1.11.0/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8= +github.com/google/btree v1.1.3 h1:CVpQJjYgC4VbzxeGVHfvZrv1ctoYCAI8vbl07Fcxlyg= +github.com/google/btree v1.1.3/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl761Gm4= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= @@ -693,7 +643,6 @@ github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/google/gofuzz v1.1.1-0.20200604201612-c04b05f3adfa/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/martian v2.1.0+incompatible h1:/CP5g8u/VJHijgedC/Legn3BAbAaWPgecwXBIDzw5no= @@ -701,8 +650,8 @@ github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXi github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= github.com/google/martian/v3 v3.2.1/go.mod h1:oBOf6HBosgwRXnUGWUB05QECsc6uvmMiJ3+6W4l/CUk= -github.com/google/martian/v3 v3.3.2 h1:IqNFLAmvJOgVlpdEBiQbDc2EwKW77amAycfTuWKdfvw= -github.com/google/martian/v3 v3.3.2/go.mod h1:oBOf6HBosgwRXnUGWUB05QECsc6uvmMiJ3+6W4l/CUk= +github.com/google/martian/v3 v3.3.3 h1:DIhPTQrbPkgs2yJYdXU/eNACCG5DVQjySNRNlflZ9Fc= +github.com/google/martian/v3 v3.3.3/go.mod h1:iEPrYcgCF7jA9OtScMFQyAlZZ4YXTKEtJ1E6RWzmBA0= github.com/google/orderedcode v0.0.1 h1:UzfcAexk9Vhv8+9pNOgRu41f16lHq725vPwnSeiG/Us= github.com/google/orderedcode v0.0.1/go.mod h1:iVyU4/qPKHY5h/wSd6rZZCDcLJNxiWO6dvsYES2Sb20= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= @@ -718,15 +667,15 @@ github.com/google/pprof v0.0.0-20210122040257-d980be63207e/go.mod h1:kpwsk12EmLe github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210601050228-01bbb1931b22/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210609004039-a478d1d731e9/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 h1:K6RDEckDVWvDI9JAJYCmNdQXq6neHJOYx3V6jnqNEec= github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20230207041349-798e818bf904/go.mod h1:uglQLonpP8qtYCYyzA+8c/9qtqgA3qsXGYqCPKARAFg= +github.com/google/pprof v0.0.0-20230228050547-1710fef4ab10 h1:CqYfpuYIjnlNxM3msdyPRKabhXZWbKjf3Q8BWROFBso= +github.com/google/pprof v0.0.0-20230228050547-1710fef4ab10/go.mod h1:79YE0hCXdHag9sBkw2o+N/YnZtTkXi0UT9Nnixa5eYk= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/google/s2a-go v0.1.7 h1:60BLSyTrOV4/haCDW4zb1guZItoSq8foHCXrAnjBo/o= -github.com/google/s2a-go v0.1.7/go.mod h1:50CgR4k1jNlWBu4UfS4AcfhVe1r6pdZPygJ3R8F0Qdw= +github.com/google/s2a-go v0.1.8 h1:zZDs9gcbt9ZPLV0ndSyQk6Kacx2g/X+SKYovpnz3SMM= +github.com/google/s2a-go v0.1.8/go.mod h1:6iNWHTpQ+nfNRN5E00MSdfDwVesa8hhS32PhPO8deJA= github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.2.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= @@ -744,38 +693,34 @@ github.com/googleapis/gax-go/v2 v2.3.0/go.mod h1:b8LNqSzNabLiUpXKkY7HAR5jr6bIT99 github.com/googleapis/gax-go/v2 v2.4.0/go.mod h1:XOTVJ59hdnfJLIP/dh8n5CGryZR2LxK9wbMD5+iXC6c= github.com/googleapis/gax-go/v2 v2.5.1/go.mod h1:h6B0KMMFNtI2ddbGJn3T3ZbwkeT6yqEF02fYlzkUCyo= github.com/googleapis/gax-go/v2 v2.6.0/go.mod h1:1mjbznJAPHFpesgE5ucqfYEscaz5kMdcIDwU/6+DDoY= -github.com/googleapis/gax-go/v2 v2.12.0 h1:A+gCJKdRfqXkr+BIRGtZLibNXf0m1f9E4HG56etFpas= -github.com/googleapis/gax-go/v2 v2.12.0/go.mod h1:y+aIqrI5eb1YGMVJfuV3185Ts/D7qKpsEkdD5+I6QGU= +github.com/googleapis/gax-go/v2 v2.13.0 h1:yitjD5f7jQHhyDsnhKEBU52NdvvdSeGzlAnDPT0hH1s= +github.com/googleapis/gax-go/v2 v2.13.0/go.mod h1:Z/fvTZXF8/uw7Xu5GuslPw+bplx6SS338j1Is2S+B7A= github.com/googleapis/go-type-adapters v1.0.0/go.mod h1:zHW75FOG2aur7gAO2B+MLby+cLsWGBF62rFAi7WjWO4= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= -github.com/gorilla/handlers v1.5.1 h1:9lRY6j8DEeeBT10CvO9hGW0gmky0BprnvDI5vfhUHH4= -github.com/gorilla/handlers v1.5.1/go.mod h1:t8XrUpc4KVXb7HGyJ4/cEnwQiaxrX/hz1Zv/4g96P1Q= +github.com/gorilla/handlers v1.5.2 h1:cLTUSsNkgcwhgRqvCNmdbRWG0A3N4F+M2nWKdScwyEE= +github.com/gorilla/handlers v1.5.2/go.mod h1:dX+xVpaxdSw+q0Qek8SSsl3dfMk3jNddUkMzo0GtH0w= github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= -github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI= -github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= +github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY= +github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ= github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/graph-gophers/graphql-go v1.3.0/go.mod h1:9CQHMSxwO4MprSdzoIEobiHpoLtHm77vfxsvsIN5Vuc= +github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg= +github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/goware/urlx v0.3.2 h1:gdoo4kBHlkqZNaf6XlQ12LGtQOmpKJrR04Rc3RnpJEo= +github.com/goware/urlx v0.3.2/go.mod h1:h8uwbJy68o+tQXCGZNa9D73WN8n0r9OBae5bUnLcgjw= github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= github.com/grpc-ecosystem/go-grpc-middleware v1.2.2/go.mod h1:EaizFBKfUKtMIF5iaDEhniwNedqGo9FuLFzppDr3uwI= -github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 h1:+9834+KizmvFV7pXQGSXQTsaWhq2GjuNUt0aUU0YBYw= -github.com/grpc-ecosystem/go-grpc-middleware v1.3.0/go.mod h1:z0ButlSOZa5vEBq9m2m2hlwIgKw+rp3sdCBRoJY+30Y= +github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 h1:UH//fgunKIs4JdUbpDl1VZCDaL56wXCB/5+wF6uHfaI= +github.com/grpc-ecosystem/go-grpc-middleware v1.4.0/go.mod h1:g5qyo/la0ALbONm6Vbp88Yd8NsDy6rZz+RcrMPxvld8= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c h1:6rhixN/i8ZofjG1Y75iExal34USq5p+wiN1tpie8IrU= github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c/go.mod h1:NMPJylDgVpX0MLRlPy15sqSwOFv/U1GZ2m21JhFfek0= -github.com/gtank/merlin v0.1.1-0.20191105220539-8318aed1a79f/go.mod h1:T86dnYJhcGOh5BjZFCJWTDeTK7XW8uE+E21Cy/bIQ+s= -github.com/gtank/merlin v0.1.1 h1:eQ90iG7K9pOhtereWsmyRJ6RAwcP4tHTDBHXNg+u5is= -github.com/gtank/merlin v0.1.1/go.mod h1:T86dnYJhcGOh5BjZFCJWTDeTK7XW8uE+E21Cy/bIQ+s= -github.com/gtank/ristretto255 v0.1.2 h1:JEqUCPA1NvLq5DwYtuzigd7ss8fwbYay9fi4/5uMzcc= -github.com/gtank/ristretto255 v0.1.2/go.mod h1:Ph5OpO6c7xKUGROZfWVLiJf9icMDwUeIvY4OmlYW69o= github.com/hashicorp/consul/api v1.3.0/go.mod h1:MmDNSzIMUjNpY/mQ398R4bk2FnqQLoPndWW5VkKPlCE= github.com/hashicorp/consul/sdk v0.3.0/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= @@ -785,13 +730,19 @@ github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtng github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ= github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= -github.com/hashicorp/go-getter v1.7.5 h1:dT58k9hQ/vbxNMwoI5+xFYAJuv6152UNvdHokfI5wE4= -github.com/hashicorp/go-getter v1.7.5/go.mod h1:W7TalhMmbPmsSMdNjD0ZskARur/9GJ17cfHTRtXV744= +github.com/hashicorp/go-getter v1.7.6 h1:5jHuM+aH373XNtXl9TNTUH5Qd69Trve11tHIrB+6yj4= +github.com/hashicorp/go-getter v1.7.6/go.mod h1:W7TalhMmbPmsSMdNjD0ZskARur/9GJ17cfHTRtXV744= +github.com/hashicorp/go-hclog v1.5.0 h1:bI2ocEMgcVlz55Oj1xZNBsVi900c7II+fWDyV9o+13c= +github.com/hashicorp/go-hclog v1.5.0/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= github.com/hashicorp/go-immutable-radix v1.3.1 h1:DKHmCUm2hRBK510BaiZlwvpD40f8bJFeZnpfm2KLowc= github.com/hashicorp/go-immutable-radix v1.3.1/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= +github.com/hashicorp/go-metrics v0.5.3 h1:M5uADWMOGCTUNU1YuC4hfknOeHNaX54LDm4oYSucoNE= +github.com/hashicorp/go-metrics v0.5.3/go.mod h1:KEjodfebIOuBYSAe/bHTm+HChmKSxAOXPBieMLYozDE= github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= +github.com/hashicorp/go-plugin v1.6.0 h1:wgd4KxHJTVGGqWBq4QPB1i5BZNEx9BR8+OFmHDmTk8A= +github.com/hashicorp/go-plugin v1.6.0/go.mod h1:lBS5MtSSBZk0SHc66KACcjjlU6WzEVP/8pwz68aMkCI= github.com/hashicorp/go-retryablehttp v0.5.3/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs= github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= github.com/hashicorp/go-safetemp v1.0.0 h1:2HR189eFNrjHQyENnQMMpCiBAsRxzbTMIgBhEyExpmo= @@ -799,15 +750,16 @@ github.com/hashicorp/go-safetemp v1.0.0/go.mod h1:oaerMy3BhqiTbVye6QuFhFtIceqFoD github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/go-uuid v1.0.1 h1:fv1ep09latC32wFoVwnqcnKJGnMSdBanPczbHAYm1BE= github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go-uuid v1.0.2 h1:cfejS+Tpcp13yd5nYHWDI6qVCny6wyX2Mt5SGur2IGE= +github.com/hashicorp/go-uuid v1.0.2/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= -github.com/hashicorp/go-version v1.6.0 h1:feTTfFNnjP967rlCxM/I9g701jU+RN74YKx2mOkIeek= github.com/hashicorp/go-version v1.6.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= +github.com/hashicorp/go-version v1.7.0 h1:5tqGy27NaOTB8yJKUZELlFAS/LTKJkrmONwQKeRZfjY= +github.com/hashicorp/go-version v1.7.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= github.com/hashicorp/golang-lru v1.0.2 h1:dV3g9Z/unq5DpblPpw+Oqcv4dU/1omnb4Ok8iPY6p1c= github.com/hashicorp/golang-lru v1.0.2/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= github.com/hashicorp/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFs4luLUK2k= @@ -818,50 +770,41 @@ github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= -github.com/hdevalence/ed25519consensus v0.1.0 h1:jtBwzzcHuTmFrQN6xQZn6CQEO/V9f7HsjsjeEZ6auqU= -github.com/hdevalence/ed25519consensus v0.1.0/go.mod h1:w3BHWjwJbFU29IRHL1Iqkw3sus+7FctEyM4RqDxYNzo= +github.com/hashicorp/yamux v0.1.1 h1:yrQxtgseBDrq9Y652vSRDvsKCJKOUD+GzTS4Y0Y8pvE= +github.com/hashicorp/yamux v0.1.1/go.mod h1:CtWFDAQgb7dxtzFs4tWbplKIe2jSi3+5vKbgIO0SLnQ= +github.com/hdevalence/ed25519consensus v0.2.0 h1:37ICyZqdyj0lAZ8P4D1d1id3HqbbG1N3iBb1Tb4rdcU= +github.com/hdevalence/ed25519consensus v0.2.0/go.mod h1:w3BHWjwJbFU29IRHL1Iqkw3sus+7FctEyM4RqDxYNzo= github.com/holiman/bloomfilter/v2 v2.0.3 h1:73e0e/V0tCydx14a0SCYS/EWCxgwLZ18CZcZKVu0fao= github.com/holiman/bloomfilter/v2 v2.0.3/go.mod h1:zpoh+gs7qcpqrHr3dB55AMiJwo0iURXE7ZOP9L9hSkA= -github.com/holiman/uint256 v1.2.0/go.mod h1:y4ga/t+u+Xwd7CpDgZESaRcWy0I7XMlTMA25ApIH5Jw= -github.com/holiman/uint256 v1.2.1 h1:XRtyuda/zw2l+Bq/38n5XUoEF72aSOu/77Thd9pPp2o= -github.com/holiman/uint256 v1.2.1/go.mod h1:y4ga/t+u+Xwd7CpDgZESaRcWy0I7XMlTMA25ApIH5Jw= +github.com/holiman/uint256 v1.2.4 h1:jUc4Nk8fm9jZabQuqr2JzednajVmBpC+oiTiXZJEApU= +github.com/holiman/uint256 v1.2.4/go.mod h1:EOMSn4q6Nyt9P6efbI3bueV4e1b3dGlUCXeiRV4ng7E= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/huandu/go-assert v1.1.5 h1:fjemmA7sSfYHJD7CUqs9qTwwfdNAx7/j2/ZlHXzNB3c= github.com/huandu/go-assert v1.1.5/go.mod h1:yOLvuqZwmcHIC5rIzrBhT7D3Q9c3GFnd0JrPVhn/06U= -github.com/huandu/skiplist v1.2.0 h1:gox56QD77HzSC0w+Ws3MH3iie755GBJU1OER3h5VsYw= -github.com/huandu/skiplist v1.2.0/go.mod h1:7v3iFjLcSAzO4fN5B8dvebvo/qsfumiLiDXMrPiHF9w= +github.com/huandu/skiplist v1.2.1 h1:dTi93MgjwErA/8idWTzIw4Y1kZsMWx35fmI2c8Rij7w= +github.com/huandu/skiplist v1.2.1/go.mod h1:7v3iFjLcSAzO4fN5B8dvebvo/qsfumiLiDXMrPiHF9w= github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= -github.com/huin/goupnp v1.0.3 h1:N8No57ls+MnjlB+JPiCVSOyy/ot7MJTqlo7rn+NYSqQ= -github.com/huin/goupnp v1.0.3/go.mod h1:ZxNlw5WqJj6wSsRK5+YfflQGXYfccj5VgQsMNixHM7Y= -github.com/huin/goutil v0.0.0-20170803182201-1ca381bf3150/go.mod h1:PpLOETDnJ0o3iZrZfqZzyLl6l7F3c6L1oWn7OICBi6o= -github.com/iancoleman/orderedmap v0.2.0 h1:sq1N/TFpYH++aViPcaKjys3bDClUEU7s5B+z6jq8pNA= -github.com/iancoleman/orderedmap v0.2.0/go.mod h1:N0Wam8K1arqPXNWjMo21EXnBPOPp36vB07FNRdD2geA= +github.com/huin/goupnp v1.3.0 h1:UvLUlWDNpoUdYzb2TCn+MuTWtcjXKSza2n6CBdQ0xXc= +github.com/huin/goupnp v1.3.0/go.mod h1:gnGPsThkYa7bFi/KWmEysQRf48l2dvR5bxr2OFckNX8= +github.com/iancoleman/orderedmap v0.3.0 h1:5cbR2grmZR/DiVt+VJopEhtVs9YGInGIxAoMJn+Ichc= +github.com/iancoleman/orderedmap v0.3.0/go.mod h1:XuLcCUkdL5owUCQeF2Ue9uuw1EptkJDkXXS7VoV7XGE= +github.com/iancoleman/strcase v0.3.0 h1:nTXanmYxhfFAMjZL34Ov6gkzEsSJZ5DbhxWjvSASxEI= +github.com/iancoleman/strcase v0.3.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= +github.com/ianlancetaylor/demangle v0.0.0-20220319035150-800ac71e25c2/go.mod h1:aYm2/VgdVmcIU8iMfdMvDMsRAQjcfZSKFby6HOFvi/w= github.com/improbable-eng/grpc-web v0.15.0 h1:BN+7z6uNXZ1tQGcNAuaU1YjsLTApzkjt2tzCixLaUPQ= github.com/improbable-eng/grpc-web v0.15.0/go.mod h1:1sy9HKV4Jt9aEs9JSnkWlRJPuPtwNr0l57L4f878wP8= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= -github.com/influxdata/flux v0.65.1/go.mod h1:J754/zds0vvpfwuq7Gc2wRdVwEodfpCFM7mYlOw2LqY= -github.com/influxdata/influxdb v1.8.3/go.mod h1:JugdFhsvvI8gadxOI6noqNeeBHvWNTbfYGtiAn+2jhI= -github.com/influxdata/influxdb-client-go/v2 v2.4.0/go.mod h1:vLNHdxTJkIf2mSLvGrpj8TCcISApPoXkaxP8g9uRlW8= github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= -github.com/influxdata/influxql v1.1.1-0.20200828144457-65d3ef77d385/go.mod h1:gHp9y86a/pxhjJ+zMjNXiQAA197Xk9wLxaz+fGG+kWk= -github.com/influxdata/line-protocol v0.0.0-20180522152040-32c6aa80de5e/go.mod h1:4kt73NQhadE3daL3WhR5EJ/J2ocX0PZzwxQ0gXJ7oFE= -github.com/influxdata/line-protocol v0.0.0-20200327222509-2487e7298839/go.mod h1:xaLFMmpvUxqXtVkUJfg9QmT88cDaCJ3ZKgdZ78oO8Qo= -github.com/influxdata/line-protocol v0.0.0-20210311194329-9aa0e372d097/go.mod h1:xaLFMmpvUxqXtVkUJfg9QmT88cDaCJ3ZKgdZ78oO8Qo= -github.com/influxdata/promql/v2 v2.12.0/go.mod h1:fxOPu+DY0bqCTCECchSRtWfc+0X19ybifQhZoQNF5D8= -github.com/influxdata/roaring v0.4.13-0.20180809181101-fc520f41fab6/go.mod h1:bSgUQ7q5ZLSO+bKBGqJiCBGAl+9DxyW63zLTujjUlOE= -github.com/influxdata/tdigest v0.0.0-20181121200506-bf2b5ad3c0a9/go.mod h1:Js0mqiSBE6Ffsg94weZZ2c+v/ciT8QRHFOap7EKDrR0= -github.com/influxdata/usage-client v0.0.0-20160829180054-6d3895376368/go.mod h1:Wbbw6tYNvwa5dlB6304Sd+82Z3f7PmVZHVKU637d4po= github.com/jackpal/go-nat-pmp v1.0.2 h1:KzKSgb7qkJvOUTqYl9/Hg/me3pWgBmERKrTGD7BdWus= github.com/jackpal/go-nat-pmp v1.0.2/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc= -github.com/jedisct1/go-minisign v0.0.0-20190909160543-45766022959e/go.mod h1:G1CVv03EnqU1wYL2dFwXxW2An0az9JTl/ZsqXQeBlkU= github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= -github.com/jhump/protoreflect v1.15.1 h1:HUMERORf3I3ZdX05WaQ6MIpd/NJ434hTp5YiKgfCL6c= -github.com/jhump/protoreflect v1.15.1/go.mod h1:jD/2GMKKE6OqX8qTjhADU1e6DShO+gavG9e0Q693nKo= +github.com/jhump/protoreflect v1.15.3 h1:6SFRuqU45u9hIZPJAoZ8c28T3nK64BNdp9w6jFonzls= +github.com/jhump/protoreflect v1.15.3/go.mod h1:4ORHmSBmlCW8fh3xHmJMGyul1zNqZK4Elxc8qKP+p1k= github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg= github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= @@ -877,43 +820,28 @@ github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/u github.com/json-iterator/go v1.1.8/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= -github.com/jsternberg/zap-logfmt v1.0.0/go.mod h1:uvPs/4X51zdkcm5jXl5SYoN+4RK21K8mysFmDaM/h+o= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= -github.com/jung-kurt/gofpdf v1.0.3-0.20190309125859-24315acbbda5/go.mod h1:7Id9E/uU8ce6rXgefFLlgrJj/GYY22cpxn+r32jIOes= -github.com/jwilder/encoding v0.0.0-20170811194829-b4e1701a28ef/go.mod h1:Ct9fl0F6iIOGgxJ5npU/IUOhOhqlVrGjyIZc8/MagT0= -github.com/karalabe/usb v0.0.2/go.mod h1:Od972xHfMJowv7NGVDiWVxk2zxnWgjLlJzE+F4F7AGU= -github.com/kava-labs/cometbft v0.37.9-kava.1 h1:0mMsAhpV8p0peD9sabIZ//M4nP6LiiZ0o34gfuHdANY= -github.com/kava-labs/cometbft v0.37.9-kava.1/go.mod h1:j0Q3RqrCd+cztWCugs3obbzC4NyHGBPZZjtm/fWV00I= -github.com/kava-labs/cometbft-db v0.9.1-kava.2 h1:ZQaio886ifvml9XtJB4IYHhlArgA3+/a5Zwidg7H2J8= -github.com/kava-labs/cometbft-db v0.9.1-kava.2/go.mod h1:PvUZbx7zeR7I4CAvtKBoii/5ia5gXskKjDjIVpt7gDw= -github.com/kava-labs/cosmos-sdk v0.47.10-iavl-v1-kava.1 h1:vQwrm3sdAG1pkwrsi2mmCHSGDje5fzUR6vApEux/nVA= -github.com/kava-labs/cosmos-sdk v0.47.10-iavl-v1-kava.1/go.mod h1:OwLYEBcsnijCLE8gYkwQ7jycZZ/Acd+a83pJU+V+MKw= -github.com/kava-labs/ethermint v0.21.1-0.20240802224012-586960857184 h1:MWwCXFnkagXk93QiiD41I+S9wyrHZUQWLRFKo2tXL6A= -github.com/kava-labs/ethermint v0.21.1-0.20240802224012-586960857184/go.mod h1:kbyr3La2Co3Hy3U3N2EvVk7W1srQ2x88JUpgsu2KrXo= +github.com/kava-labs/cometbft v0.0.0-20241007151334-8345af773eb9 h1:EdyFg0j6Q8oVy3EynAEQm/M2CyMhBZrTlFjcORLjw5g= +github.com/kava-labs/cometbft v0.0.0-20241007151334-8345af773eb9/go.mod h1:GPHp3/pehPqgX1930HmK1BpBLZPxB75v/dZg8Viwy+o= +github.com/kava-labs/cometbft-db v0.0.0-20241007145430-b2740b2e4bed h1:3FNJ3fcD9aA9oOwDphrSEJ8u2kBNj9YoYAwl16UKyv4= +github.com/kava-labs/cometbft-db v0.0.0-20241007145430-b2740b2e4bed/go.mod h1:buPRZKyVp+u5fmwN7tDtOk1zc5xA2z9BJJTy61tNnws= github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= -github.com/klauspost/compress v1.4.0/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= github.com/klauspost/compress v1.10.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= github.com/klauspost/compress v1.11.7/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= github.com/klauspost/compress v1.12.3/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg= github.com/klauspost/compress v1.15.11/go.mod h1:QPwzmACJjUTFsnSHH934V6woptycfrDDJnH7hvFVbGM= -github.com/klauspost/compress v1.17.7 h1:ehO88t2UGzQK66LMdE8tibEd1ErmzZjNEqWkjLAKQQg= -github.com/klauspost/compress v1.17.7/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= -github.com/klauspost/cpuid v0.0.0-20170728055534-ae7887de9fa5 h1:2U0HzY8BJ8hVwDKIzp7y4voR9CX/nvcfymLmg2UiOio= -github.com/klauspost/cpuid v0.0.0-20170728055534-ae7887de9fa5/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= -github.com/klauspost/cpuid/v2 v2.0.9 h1:lgaqFMSdTdQYdZ04uHyN2d/eKdOMyi2YLSvlQIBFYa4= +github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA= +github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= -github.com/klauspost/crc32 v0.0.0-20161016154125-cb6bfca970f6/go.mod h1:+ZoRqAPRLkC4NPOvfYeR5KNOrY6TD+/sAC3HXPZgDYg= -github.com/klauspost/pgzip v1.0.2-0.20170402124221-0bf5dcad4ada/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= @@ -926,41 +854,28 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/kylelemons/godebug v0.0.0-20170224010052-a616ab194758/go.mod h1:B69LEHPfb2qLo0BaaOLcbitczOKLWTsrBG9LczfCD4k= +github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/labstack/echo/v4 v4.2.1/go.mod h1:AA49e0DZ8kk5jTOOCKNuPR6oTnBS0dYiM4FW1e6jwpg= -github.com/labstack/gommon v0.3.0/go.mod h1:MULnywXg0yavhxWKc+lOruYdAhDwPK9wf0OL7NoOu+k= -github.com/leanovate/gopter v0.2.9/go.mod h1:U2L/78B+KVFIx2VmW6onHJQzXtFb+p5y3y2Sh+Jxxv8= -github.com/leodido/go-urn v1.2.1 h1:BqpAaACuzVSgi/VLzGZIobT2z4v53pjosyNd9Yv6n/w= github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY= -github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= -github.com/lib/pq v1.10.7 h1:p7ZhMD+KsSRozJr34udlUrhboJwWAgCg34+/ZZNvZZw= -github.com/lib/pq v1.10.7/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= +github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw= +github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM= github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4= -github.com/linxGnu/grocksdb v1.8.13 h1:X3Id7Obhf8qLY9WPc4LmmtIyabmdDf810XSFDnLlW7E= -github.com/linxGnu/grocksdb v1.8.13/go.mod h1:QYiYypR2d4v63Wj1adOOfzglnoII0gLj3PNh4fZkcFA= -github.com/lucasjones/reggen v0.0.0-20180717132126-cdb49ff09d77/go.mod h1:5ELEyG+X8f+meRWHuqUOewBOhvHkl7M76pdGEansxW4= +github.com/linxGnu/grocksdb v1.9.3 h1:s1cbPcOd0cU2SKXRG1nEqCOWYAELQjdqg3RVI2MH9ik= +github.com/linxGnu/grocksdb v1.9.3/go.mod h1:QYiYypR2d4v63Wj1adOOfzglnoII0gLj3PNh4fZkcFA= github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= -github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= -github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/manifoldco/promptui v0.9.0 h1:3V4HzJk1TtXW1MTZMP7mdlwbBpIinw3HztaIlYthEiA= github.com/manifoldco/promptui v0.9.0/go.mod h1:ka04sppxSGFAtxX0qhlYQjISsg9mR4GWtQEhdbn6Pgg= -github.com/matryer/moq v0.0.0-20190312154309-6cfb0558e1bd/go.mod h1:9ELz6aaclSIGnZBoaSLZ3NAl1VTufbOrXBPvtcy6WiQ= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= -github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= -github.com/mattn/go-colorable v0.1.7/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= -github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= +github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= -github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= @@ -969,21 +884,14 @@ github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= -github.com/mattn/go-runewidth v0.0.3/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= -github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0= github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= -github.com/mattn/go-sqlite3 v1.11.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= -github.com/mattn/go-tty v0.0.0-20180907095812-13ff1204f104/go.mod h1:XPvLUNfbS4fJH25nqRHfWLMa1ONC8Amw+mIA639KxkE= +github.com/mattn/go-runewidth v0.0.14 h1:+xnbZSEeDbOIg5/mE6JF0w6n9duR1l3/WmbinWVwUuU= +github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= -github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= -github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643/go.mod h1:43+3pMjjKimDBf5Kr4ZFNGbLql1zKkbImw+fZbw3geM= -github.com/mimoo/StrobeGo v0.0.0-20210601165009-122bf33a46e0 h1:QRUSJEgZn2Snx0EmT/QLXibWjSUDjKWvXIT19NBVp94= -github.com/mimoo/StrobeGo v0.0.0-20210601165009-122bf33a46e0/go.mod h1:43+3pMjjKimDBf5Kr4ZFNGbLql1zKkbImw+fZbw3geM= -github.com/minio/highwayhash v1.0.2 h1:Aak5U0nElisjDCfPSG79Tgzkn2gl66NxOMspRrKnA/g= -github.com/minio/highwayhash v1.0.2/go.mod h1:BQskDq+xkJ12lmlUUi7U0M5Swg3EWR+dLTk+kldvVxY= +github.com/minio/highwayhash v1.0.3 h1:kbnuUMoHYyVl7szWjSxJnxw11k2U709jqFPPmIUyD6Q= +github.com/minio/highwayhash v1.0.3/go.mod h1:GGYsuwP/fPD6Y9hMiXuapVvlIUEhFhMTh0rxU3ik1LQ= github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= @@ -995,29 +903,23 @@ github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS4 github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= -github.com/mitchellh/mapstructure v1.4.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/pointerstructure v1.2.0 h1:O+i9nHnXS3l/9Wu7r4NrEdwA2VFTicjUEN1uBnDo34A= github.com/mitchellh/pointerstructure v1.2.0/go.mod h1:BRAsLI5zgXmw97Lf6s25bs8ohIXc3tViBH44KcwB2g4= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= -github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= -github.com/mschoch/smat v0.0.0-20160514031455-90eadee771ae/go.mod h1:qAyveg+e4CE+eKJXWVjKXM4ck2QobLqTDytGJbLLhJg= github.com/mtibben/percent v0.2.1 h1:5gssi8Nqo8QU/r2pynCm+hBQHpkB/uNK7BJCFogWdzs= github.com/mtibben/percent v0.2.1/go.mod h1:KG9uO+SZkUp+VkRHsCdYQV3XSZrrSpR3O9ibNBTZrns= +github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= +github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f h1:KUppIJq7/+SVif2QVs3tOP0zanoHgBEVAwHxUSIzRqU= github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/mwitkow/grpc-proxy v0.0.0-20181017164139-0f1106ef9c76/go.mod h1:x5OoJHDHqxHS801UIuhqGl6QdSAEJvtausosHSdazIo= -github.com/naoina/go-stringutil v0.1.0/go.mod h1:XJ2SJL9jCtBh+P9q5btrd/Ylo8XwT/h1USek5+NqSA0= -github.com/naoina/toml v0.1.2-0.20170918210437-9fafd6967416/go.mod h1:NBIhNtsFMo3G2szEBne+bO4gS192HuIYRqfvOWb4i1E= github.com/nats-io/jwt v0.3.0/go.mod h1:fRYCDE99xlTsqUzISS1Bi75UBJ6ljOJQOAAu5VglpSg= github.com/nats-io/jwt v0.3.2/go.mod h1:/euKqTS1ZD+zzjYrY7pseZrTtWQSjujC7xjPc8wL6eU= github.com/nats-io/nats-server/v2 v2.1.2/go.mod h1:Afk+wRZqkMQs/p45uXdrVLuab3gwv3Z8C4HTBu8GD/k= @@ -1025,20 +927,22 @@ github.com/nats-io/nats.go v1.9.1/go.mod h1:ZjDU1L/7fJ09jvUSRVBR2e7+RnLiiIQyqyzE github.com/nats-io/nkeys v0.1.0/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= github.com/nats-io/nkeys v0.1.3/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= -github.com/neilotoole/errgroup v0.1.6/go.mod h1:Q2nLGf+594h0CLBs/Mbg6qOr7GtqDK7C2S41udRnToE= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= +github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a h1:dlRvE5fWabOchtH7znfiFCcOvmIYgOeAS5ifBXBlh9Q= +github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a/go.mod h1:hVoHR2EVESiICEMbg137etN/Lx+lSrHPTD39Z/uE+2s= github.com/oklog/oklog v0.3.2/go.mod h1:FCV+B7mhrz4o+ueLpx+KqkyXRGMWOYEvfiXtdGtbWGs= github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= +github.com/oklog/run v1.1.0 h1:GEenZ1cK0+q0+wsJew9qUg/DyD8k3JzYsZAi5gYi2mA= +github.com/oklog/run v1.1.0/go.mod h1:sVPdnTZT1zYwAJeCMu2Th4T21pA3FPOQRfWjQlk7DVU= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.10.3/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= github.com/onsi/ginkgo v1.16.4 h1:29JGrr5oVBm5ulCWet69zQkzWipVXIol6ygQUe/EzNc= @@ -1061,7 +965,6 @@ github.com/opencontainers/runc v1.1.3/go.mod h1:1J5XiS+vdZ3wCyZybsuxXZWGrgSr8fFJ github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492/go.mod h1:Ngi6UdF0k5OKD5t5wlmGhe/EDKPoUM3BXZSSfIuJbis= github.com/opentracing/basictracer-go v1.0.0/go.mod h1:QfBfYuafItcjQuMwinw9GhYKwFXS9KnPs5lxoYwgW74= github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= -github.com/opentracing/opentracing-go v1.0.3-0.20180606204148-bd9c31933947/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= github.com/openzipkin-contrib/zipkin-go-opentracing v0.4.5/go.mod h1:/wsWhb9smxSfWAKL3wpBW7V8scJMt8N8gnaMCS9E/cA= github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJc5AZX7/PBEpw= @@ -1073,19 +976,14 @@ github.com/pact-foundation/pact-go v1.0.4/go.mod h1:uExwJY4kCzNPcHRj+hCR/HBbOOIw github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY= github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= -github.com/paulbellamy/ratecounter v0.2.0/go.mod h1:Hfx1hDpSGoqxkVVpBi/IlYD7kChlfo5C6hzIHwPqfFE= github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pelletier/go-toml/v2 v2.0.6/go.mod h1:eumQOmlWiOPt5WriQQqoM5y18pDHwha2N+QD+EUNTek= -github.com/pelletier/go-toml/v2 v2.1.0 h1:FnwAJ4oYMvbT/34k9zzHuZNrhlz48GB3/s6at6/MHO4= -github.com/pelletier/go-toml/v2 v2.1.0/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc= +github.com/pelletier/go-toml/v2 v2.2.3 h1:YmeHyLY8mFWbdkNWwpr+qIL2bEqT0o95WSdkNHvL12M= +github.com/pelletier/go-toml/v2 v2.2.3/go.mod h1:MfCQTFTvCcUyyvvwm1+G6H/jORL20Xlb6rzQu9GuUkc= github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9iaPbIdPPGyKcA8hKdoy6hAWba7Yac= -github.com/peterh/liner v1.0.1-0.20180619022028-8c1271fcf47f/go.mod h1:xIteQHvHuaLYG9IFj6mSxM0fCKrs34IrEQUhOYuGPHc= -github.com/peterh/liner v1.1.1-0.20190123174540-a2c9a5303de7/go.mod h1:CRroGNssyjTd/qIG2FyxByd2S8JEAZXBl4qUrZf8GS0= -github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCrJTQWu0XVbaOlby/2lO20uSCHEMzzplHXte1o= -github.com/petermattis/goid v0.0.0-20231207134359-e60b3f734c67 h1:jik8PHtAIsPlCRJjJzl4udgEf7hawInF9texMeO2jrU= -github.com/petermattis/goid v0.0.0-20231207134359-e60b3f734c67/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4= -github.com/philhofer/fwd v1.0.0/go.mod h1:gk3iGcWd9+svBvR0sR+KPcfE+RNWozjowpeBVG3ZVNU= +github.com/petermattis/goid v0.0.0-20240813172612-4fcff4a6cae7 h1:Dx7Ovyv/SFnMFw3fD4oEoeorXc6saIiQ23LrGLth0Gw= +github.com/petermattis/goid v0.0.0-20240813172612-4fcff4a6cae7/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4= github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc= github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= github.com/pingcap/errors v0.11.4 h1:lFuQV/oaUMGcD2tqt+01ROSmJs75VG1ToEOkZIZ4nE4= @@ -1096,7 +994,6 @@ github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/profile v1.2.1/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6JUPA= -github.com/pkg/term v0.0.0-20180730021639-bffc007b7fd5/go.mod h1:eCbImbZ95eXtAUIbLAuAVnBnwf83mjf6QIVH8SHYwqQ= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= @@ -1107,8 +1004,8 @@ github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5Fsn github.com/prometheus/client_golang v1.3.0/go.mod h1:hJaj2vgQTGQmVCsAACORcieXFeDPbaTKGT+JTgUa3og= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= -github.com/prometheus/client_golang v1.14.0 h1:nJdhIvne2eSX/XRAFV9PcvFFRbrjbcTUj0VP62TMhnw= -github.com/prometheus/client_golang v1.14.0/go.mod h1:8vpkKitgIVNcqrRBWh1C4TIUQgYNtG/XQE4E/Zae36Y= +github.com/prometheus/client_golang v1.20.4 h1:Tgh3Yr67PaOv/uTqloMsCEdeuFTatm5zIq5+qNN23vI= +github.com/prometheus/client_golang v1.20.4/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= @@ -1120,21 +1017,20 @@ github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQy github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -github.com/prometheus/common v0.6.0/go.mod h1:eBmuwkDJBwy6iBfxCBob6t6dR6ENT/y+J+Zk0j9GMYc= github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA= github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.15.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= -github.com/prometheus/common v0.42.0 h1:EKsfXEYo4JpWMHH5cg+KOUWeuJSov1Id8zGR8eeI1YM= -github.com/prometheus/common v0.42.0/go.mod h1:xBwqVerjNdUDjgODMpudtOMwlOwf2SaTr1yjz4b7Zbc= +github.com/prometheus/common v0.60.0 h1:+V9PAREWNvJMAuJ1x1BaWl9dewMW4YrHZQbx0sJNllA= +github.com/prometheus/common v0.60.0/go.mod h1:h0LYf1R1deLSKtD4Vdg8gy4RuOvENW2J/h19V5NADQw= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= github.com/prometheus/procfs v0.3.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= -github.com/prometheus/procfs v0.13.0 h1:GqzLlQyfsPbaEHaQkO7tbDlriv/4o5Hudv6OXHGKX7o= -github.com/prometheus/procfs v0.13.0/go.mod h1:cd4PFCR54QLnGKPaKGA6l+cfuNXtht43ZKY6tow0Y1g= +github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc= +github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk= github.com/prometheus/tsdb v0.7.1 h1:YZcsG11NqnK4czYLrWd9mpEuAJIHVQLwdrleYfszMAA= github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= github.com/rakyll/statik v0.1.7 h1:OF3QCZUuyPxuGEP7B4ypUa7sB/iHtqOTDYZXGM8KOdQ= @@ -1142,7 +1038,8 @@ github.com/rakyll/statik v0.1.7/go.mod h1:AlZONWzMtEnMs7W4e/1LURLiI49pIMmp6V9Ung github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 h1:N/ElC8H3+5XpJzTSTfLsJV/mx9Q9g7kxmchpfZyxgzM= github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= -github.com/retailnext/hllpp v1.0.1-0.20180308014038-101a6d2f8b52/go.mod h1:RDpi1RftBQPUCDRw6SmxeaREsAaRKnOclghuzp/WRzc= +github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= +github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rjeczalik/notify v0.9.1 h1:CLCKso/QK1snAlnhNR/CNvNiFU2saUtjV0bx3EwNeCE= github.com/rjeczalik/notify v0.9.1/go.mod h1:rKwnCoCGeuQnwBtTSPL9Dad03Vh2n40ePRrjvIXnJho= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= @@ -1154,11 +1051,11 @@ github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/f github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= -github.com/rs/cors v1.8.3 h1:O+qNyWn7Z+F9M0ILBHgMVPuB1xTOucVd5gtaYyXBpRo= -github.com/rs/cors v1.8.3/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= +github.com/rs/cors v1.11.1 h1:eU3gRzXLRK57F5rKMGMZURNdIG4EoAmX8k94r9wXWHA= +github.com/rs/cors v1.11.1/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= -github.com/rs/zerolog v1.32.0 h1:keLypqrlIjaFsbmJOBdB/qvyF8KEtCWHwobLp5l/mQ0= -github.com/rs/zerolog v1.32.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss= +github.com/rs/zerolog v1.33.0 h1:1cU2KZkvPxNyfgEmhHAz/1A9Bz+llsdYzklWFzgp0r8= +github.com/rs/zerolog v1.33.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss= github.com/russross/blackfriday v1.5.2 h1:HyvC0ARfnZBqnXwABFeSZHpKvJHJJfPz81GNueLj0oo= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= @@ -1170,13 +1067,9 @@ github.com/sagikazarmark/locafero v0.4.0/go.mod h1:Pe1W6UlPYUk/+wc/6KFhbORCfqzgY github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE= github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ= github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E= -github.com/sasha-s/go-deadlock v0.3.1 h1:sqv7fDNShgjcaxkO0JNcOAlr8B9+cV5Ey/OB71efZx0= -github.com/sasha-s/go-deadlock v0.3.1/go.mod h1:F73l+cr82YSh10GxyRI6qZiCgK64VaZjwesgfQ1/iLM= +github.com/sasha-s/go-deadlock v0.3.5 h1:tNCOEEDG6tBqrNDOX35j/7hL5FcFViG6awUGROb2NsU= +github.com/sasha-s/go-deadlock v0.3.5/go.mod h1:bugP6EGbdGYObIlx7pUZtWqlvo8k9H6vCBBsiChJQ5U= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= -github.com/segmentio/fasthash v1.0.3/go.mod h1:waKX8l2N8yckOgmSsXJi7x1ZfdKZ4x7KRMzBtS3oedY= -github.com/segmentio/kafka-go v0.1.0/go.mod h1:X6itGqS9L4jDletMsxZ7Dz+JFWxM6JHfPOCvTvk+EJo= -github.com/segmentio/kafka-go v0.2.0/go.mod h1:X6itGqS9L4jDletMsxZ7Dz+JFWxM6JHfPOCvTvk+EJo= -github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible h1:Bn1aCHHRnjv4Bl16T8rcaFjYSrGrIZvpiGO6P3Q4GpU= github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= @@ -1199,21 +1092,20 @@ github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8= github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNoBjkY= github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/cast v1.6.0 h1:GEiTHELF+vaR5dhz3VqZfFSzZjYbgeKDpBxQVS4GYJ0= -github.com/spf13/cast v1.6.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= +github.com/spf13/cast v1.7.0 h1:ntdiHjuueXFgm5nzDRdOS4yfT43P5Fnud6DH50rz/7w= +github.com/spf13/cast v1.7.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= -github.com/spf13/cobra v1.8.0 h1:7aJaZx1B85qltLMc546zn58BxxfZdR/W22ej9CFoEf0= -github.com/spf13/cobra v1.8.0/go.mod h1:WXLWApfZ71AjXPya3WOlMsY9yMs7YeiHhFVlvLyhcho= +github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM= +github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y= github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= -github.com/spf13/viper v1.18.2 h1:LUXCnvUvSM6FXAsj6nnfc8Q2tp1dIgUfY9Kc8GsSOiQ= -github.com/spf13/viper v1.18.2/go.mod h1:EKmWIqdnk5lOcmR72yw6hS+8OPYcwD0jteitLMVB+yk= -github.com/status-im/keycard-go v0.0.0-20190316090335-8537d3370df4/go.mod h1:RZLeN1LMWmRsyYjvAu+I6Dm9QmlDaIIt+Y+4Kd7Tp+Q= +github.com/spf13/viper v1.19.0 h1:RWq5SEjt8o25SROyN3z2OrDB9l7RPd3lwTWU8EcEdcI= +github.com/spf13/viper v1.19.0/go.mod h1:GQUN9bilAbhU/jgc1bKs99f/suXKeUMct8Adx5+Ntkg= github.com/status-im/keycard-go v0.2.0 h1:QDLFswOQu1r5jsycloeQh3bVU8n/NatHHaZobtDnDzA= github.com/status-im/keycard-go v0.2.0/go.mod h1:wlp8ZLbsmrF6g6WjugPAx+IzoLrkdf9+mHxBEeo3Hbg= github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= @@ -1225,7 +1117,6 @@ github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSS github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY= github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= -github.com/stretchr/testify v1.2.0/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= @@ -1241,71 +1132,48 @@ github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsT github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= -github.com/supranational/blst v0.3.8-0.20220526154634-513d2456b344/go.mod h1:jZJtfjgudtNl4en1tzwPIV3KjUnQUvG3/j+w+fVonLw= github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 h1:epCh84lMvA70Z7CTTCmYQn2CKbY8j86K7/FAIr141uY= github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc= github.com/tendermint/go-amino v0.16.0 h1:GyhmgQKvqF82e2oZeuMSp9JTN0N09emoSZlb2lyGa2E= github.com/tendermint/go-amino v0.16.0/go.mod h1:TQU0M1i/ImAo+tYpZi73AU3V/dKeCoMC9Sphe2ZwGME= github.com/tidwall/btree v1.7.0 h1:L1fkJH/AuEh5zBnnBbmTwQ5Lt+bRJ5A8EWecslvo9iI= github.com/tidwall/btree v1.7.0/go.mod h1:twD9XRA5jj9VUQGELzDO4HPQTNJsoWWfYEL+EUQ2cKY= -github.com/tidwall/gjson v1.12.1/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= -github.com/tidwall/gjson v1.14.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= -github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM= -github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= -github.com/tidwall/sjson v1.2.4/go.mod h1:098SZ494YoMWPmMO6ct4dcFnqxwj9r/gF0Etp19pSNM= -github.com/tinylib/msgp v1.0.2/go.mod h1:+d+yLhGm8mzTaHzB+wgMYrodPfmZrzkirds8fDWklFE= -github.com/tklauser/go-sysconf v0.3.5/go.mod h1:MkWzOF4RMCshBAMXuhXJs64Rte09mITnppBXY/rYEFI= -github.com/tklauser/go-sysconf v0.3.10 h1:IJ1AZGZRWbY8T5Vfk04D9WOA5WSejdflXxP03OUqALw= -github.com/tklauser/go-sysconf v0.3.10/go.mod h1:C8XykCvCb+Gn0oNCWPIlcb0RuglQTYaQ2hGm7jmxEFk= -github.com/tklauser/numcpus v0.2.2/go.mod h1:x3qojaO3uyYt0i56EW/VUYs7uBvdl2fkfZFu0T9wgjM= -github.com/tklauser/numcpus v0.4.0 h1:E53Dm1HjH1/R2/aoCtXtPgzmElmn51aOkhCFSuZq//o= -github.com/tklauser/numcpus v0.4.0/go.mod h1:1+UI3pD8NW14VMwdgJNJ1ESk2UnwhAnz5hMwiKKqXCQ= +github.com/tklauser/go-sysconf v0.3.12 h1:0QaGUFOdQaIVdPgfITYzaTegZvdCjmYO52cSFAEVmqU= +github.com/tklauser/go-sysconf v0.3.12/go.mod h1:Ho14jnntGE1fpdOqQEEaiKRpvIavV0hSfmBq8nJbHYI= +github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+Fk= +github.com/tklauser/numcpus v0.6.1/go.mod h1:1XfjsgE2zo8GVw7POkMbHENHzVg3GzmoZ9fESEdAacY= github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= -github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI= github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08= -github.com/tyler-smith/go-bip39 v1.0.1-0.20181017060643-dbb3b84ba2ef/go.mod h1:sJ5fKU0s6JVwZjjcUEX2zFOnvq0ASQ2K9Zr6cf67kNs= -github.com/tyler-smith/go-bip39 v1.0.2/go.mod h1:sJ5fKU0s6JVwZjjcUEX2zFOnvq0ASQ2K9Zr6cf67kNs= github.com/tyler-smith/go-bip39 v1.1.0 h1:5eUemwrMargf3BSLRRCalXT93Ns6pQJIjYQN2nyfOP8= github.com/tyler-smith/go-bip39 v1.1.0/go.mod h1:gUYDtqQw1JS3ZJ8UWVcGTGqqr6YIN3CWg+kkNaLt55U= github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= -github.com/ugorji/go/codec v1.2.9 h1:rmenucSohSTiyL09Y+l2OCk+FrMxGMzho2+tjr5ticU= github.com/ugorji/go/codec v1.2.9/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg= github.com/ulikunitz/xz v0.5.10/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= -github.com/ulikunitz/xz v0.5.11 h1:kpFauv27b6ynzBNT/Xy+1k+fK4WswhN/6PN5WhFAGw8= -github.com/ulikunitz/xz v0.5.11/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= +github.com/ulikunitz/xz v0.5.12 h1:37Nm15o69RwBkXM0J6A5OlE67RZTfzUxTj8fB3dfcsc= +github.com/ulikunitz/xz v0.5.12/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= github.com/urfave/cli v1.22.1 h1:+mkCCcOFKPnCmVYVcURKps1Xe+3zP90gSYGNfRkjoIY= github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= -github.com/urfave/cli/v2 v2.3.0/go.mod h1:LJmUH05zAU44vOAcrfzZQKsZbVcdbOG8rtL3/XcUArI= github.com/urfave/cli/v2 v2.10.2 h1:x3p8awjp/2arX+Nl/G2040AZpOCHS/eMJJ1/a+mye4Y= github.com/urfave/cli/v2 v2.10.2/go.mod h1:f8iq5LtQ/bLxafbdBSLPPNsgaW0l/2fYYEHhAyPlwvo= -github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= -github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8= -github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ= -github.com/vmihailenco/msgpack/v5 v5.3.5/go.mod h1:7xyJ9e+0+9SaZT0Wt1RGleJXzli6Q/V5KbhBonMG9jc= -github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds= -github.com/willf/bitset v1.1.3/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= -github.com/xlab/treeprint v0.0.0-20180616005107-d6fb6747feb6/go.mod h1:ce1O1j6UtZfjr22oyGxGLbauSBp2YVXpARAosm7dHBg= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU= github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8= -github.com/ybbus/jsonrpc v2.1.2+incompatible/go.mod h1:XJrh1eMSzdIYFbM08flv0wp5G35eRniyeGut1z+LSiE= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= -github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/zondax/hid v0.9.2 h1:WCJFnEDMiqGF64nlZz28E9qLVZ0KSJ7xpc5DLEyma2U= github.com/zondax/hid v0.9.2/go.mod h1:l5wttcP0jwtdLjqjMMWFVEE7d1zO0jvSPA9OPZxWpEM= github.com/zondax/ledger-go v0.14.3 h1:wEpJt2CEcBJ428md/5MgSLsXLBos98sBOyxNmCjfUCw= github.com/zondax/ledger-go v0.14.3/go.mod h1:IKKaoxupuB43g4NxeQmbLXv7T9AlQyie1UpHb342ycI= go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= -go.etcd.io/bbolt v1.3.8 h1:xs88BrvEv273UsB79e0hcVrlUWmS0a8upikMFhSyAtA= -go.etcd.io/bbolt v1.3.8/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw= +go.etcd.io/bbolt v1.3.10 h1:+BqfJTcCzTItrop8mq/lbzL8wSGtj94UO/3U31shqG0= +go.etcd.io/bbolt v1.3.10/go.mod h1:bK3UQLPJZly7IlNmV7uVHJDxfe5aK9Ll93e/74Y9oEQ= go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mIZCrds/GIG4ncV9HhK5PX7jPg= go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= @@ -1318,65 +1186,66 @@ go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.47.0 h1:UNQQKPfTDe1J81ViolILjTKPr9WetKW6uei2hFgJmFs= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.47.0/go.mod h1:r9vWsPS/3AQItv3OSlEJ/E4mbrhUbbw18meOjArPtKQ= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.47.0 h1:sv9kVfal0MK0wBMCOGr+HeJm9v803BkJxGrk2au7j08= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.47.0/go.mod h1:SK2UL73Zy1quvRPonmOmRDiWk1KBV3LyIeeIxcEApWw= -go.opentelemetry.io/otel v1.22.0 h1:xS7Ku+7yTFvDfDraDIJVpw7XPyuHlB9MCiqqX5mcJ6Y= -go.opentelemetry.io/otel v1.22.0/go.mod h1:eoV4iAi3Ea8LkAEI9+GFT44O6T/D0GWAVFyZVCC6pMI= -go.opentelemetry.io/otel/metric v1.22.0 h1:lypMQnGyJYeuYPhOM/bgjbFM6WE44W1/T45er4d8Hhg= -go.opentelemetry.io/otel/metric v1.22.0/go.mod h1:evJGjVpZv0mQ5QBRJoBF64yMuOf4xCWdXjK8pzFvliY= -go.opentelemetry.io/otel/sdk v1.21.0 h1:FTt8qirL1EysG6sTQRZ5TokkU8d0ugCj8htOgThZXQ8= -go.opentelemetry.io/otel/sdk v1.21.0/go.mod h1:Nna6Yv7PWTdgJHVRD9hIYywQBRx7pbox6nwBnZIxl/E= -go.opentelemetry.io/otel/trace v1.22.0 h1:Hg6pPujv0XG9QaVbGOBVHunyuLcCC3jN7WEhPx83XD0= -go.opentelemetry.io/otel/trace v1.22.0/go.mod h1:RbbHXVqKES9QhzZq/fE5UnOSILqRt40a21sPw2He1xo= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.49.0 h1:4Pp6oUg3+e/6M4C0A/3kJ2VYa++dsWVTtGgLVj5xtHg= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.49.0/go.mod h1:Mjt1i1INqiaoZOMGR1RIUJN+i3ChKoFRqzrRQhlkbs0= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 h1:jq9TW8u3so/bN+JPT166wjOI6/vQPF6Xe7nMNIltagk= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0/go.mod h1:p8pYQP+m5XfbZm9fxtSKAbM6oIllS7s2AfxrChvc7iw= +go.opentelemetry.io/otel v1.28.0 h1:/SqNcYk+idO0CxKEUOtKQClMK/MimZihKYMruSMViUo= +go.opentelemetry.io/otel v1.28.0/go.mod h1:q68ijF8Fc8CnMHKyzqL6akLO46ePnjkgfIMIjUIX9z4= +go.opentelemetry.io/otel/metric v1.28.0 h1:f0HGvSl1KRAU1DLgLGFjrwVyismPlnuU6JD6bOeuA5Q= +go.opentelemetry.io/otel/metric v1.28.0/go.mod h1:Fb1eVBFZmLVTMb6PPohq3TO9IIhUisDsbJoL/+uQW4s= +go.opentelemetry.io/otel/sdk v1.24.0 h1:YMPPDNymmQN3ZgczicBY3B6sf9n62Dlj9pWD3ucgoDw= +go.opentelemetry.io/otel/sdk v1.24.0/go.mod h1:KVrIYw6tEubO9E96HQpcmpTKDVn9gdv35HoYiQWGDFg= +go.opentelemetry.io/otel/trace v1.28.0 h1:GhQ9cUuQGmNDd5BTCP2dAvv75RdMxEfTmYejp+lkx9g= +go.opentelemetry.io/otel/trace v1.28.0/go.mod h1:jPyXzNPg6da9+38HEwElrQiHlVMTnVfM3/yv2OlIHaI= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= -go.uber.org/atomic v1.10.0 h1:9qC72Qh0+3MqyJbAn8YU5xVq1frD8bn3JtD2oXtafVQ= -go.uber.org/atomic v1.10.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= -go.uber.org/mock v0.2.0 h1:TaP3xedm7JaAgScZO7tlvlKrqT0p7I6OsdGB5YNSMDU= -go.uber.org/mock v0.2.0/go.mod h1:J0y0rp9L3xiff1+ZBfKxlC1fz2+aO16tw0tsDOixfuM= +go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= +go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= +go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU= +go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= -go.uber.org/multierr v1.9.0 h1:7fIwc/ZtS0q++VgcfqFDxSBZVv/Xo49/SYnDFupUwlI= -go.uber.org/multierr v1.9.0/go.mod h1:X2jQV1h+kxSjClGpnseKVIxpmcjrj7MNnI0bnlfKTVQ= +go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= +go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= +go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA= -go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= -golang.org/x/arch v0.0.0-20210923205945-b76863e36670 h1:18EFjUmQOcUvxNYSkA6jO9VAiXCnxFY6NyDX0bHDmkU= +go.uber.org/zap v1.18.1/go.mod h1:xg/QME4nWcxGxrpdeYfq7UvYrLh66cuVKdrbD1XF/NI= golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8= golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190909091759-094676da4a83/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20200115085410-6d4e4cb37c7d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= -golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= -golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= golang.org/x/crypto v0.5.0/go.mod h1:NK/OQwhpMQP3MwtdjgLlYHnH9ebylxKWv3e0fK+mkQU= -golang.org/x/crypto v0.22.0 h1:g1v0xeRhjcugydODzvb3mEM9SQ0HGp9s/nh3COQ/C30= -golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M= -golang.org/x/exp v0.0.0-20230711153332-06a737ee72cb h1:xIApU0ow1zwMa2uL1VDNeQlNVFTWMQxZUZCMDy0Q4Us= -golang.org/x/exp v0.0.0-20230711153332-06a737ee72cb/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc= -golang.org/x/image v0.0.0-20180708004352-c73c2afc3b81/go.mod h1:ux5Hcp/YLpHSI86hEcLt0YII63i6oz57MZXIpbrjZUs= +golang.org/x/crypto v0.28.0 h1:GBDwsMXVQi34v5CCYUm2jkJvu4cbtru2U4TN2PSyQnw= +golang.org/x/crypto v0.28.0/go.mod h1:rmgy+3RHxRZMyY0jjAJShp2zgEdOqj2AO7U0pYmeQ7U= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= +golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= +golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= +golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= +golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= +golang.org/x/exp v0.0.0-20200331195152-e8c3332aa8e5/go.mod h1:4M0jN8W1tt0AVLNr8HDosyJCDCDuyL9N9+3m7wDWgKw= +golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8 h1:yixxcjnhBmY0nkL253HFVIm0JsFHwrHdT3Yh6szTnfY= +golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8/go.mod h1:jj3sYF3dwk5D+ghuXyeI3r5MFf+NT2An6/9dOA95KSI= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= +golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -1389,21 +1258,20 @@ golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPI golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/lint v0.0.0-20210508222113-6edffad5e616/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= +golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= -golang.org/x/mod v0.6.0-dev.0.20211013180041-c96bc1413d57/go.mod h1:3p9vT2HGsQu2K1YbXdKPJLVgG5VJdoTa1poYQBtP1AY= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.6.0/go.mod h1:4mET923SAdbXp2ki8ey+zGs1SLqsuM2Y0uvdZR/fUNI= -golang.org/x/mod v0.11.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc= -golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.18.0 h1:5+9lSbEzPSdWkH32vYPBwEpX8KwDbM52Ud9xBUvNlb0= +golang.org/x/mod v0.18.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180719180050-a680a1efc54d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -1442,20 +1310,16 @@ golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81R golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20210220033124-5f55cee0dc0d/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220325170049-de3da57026de/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= @@ -1470,8 +1334,8 @@ golang.org/x/net v0.0.0-20221014081412-f15817d10f9b/go.mod h1:YDH+HFinaLZZlnHAfS golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws= golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w= -golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8= +golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= +golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -1497,8 +1361,8 @@ golang.org/x/oauth2 v0.0.0-20220822191816-0ebed06d0094/go.mod h1:h4gKUeWbJ4rQPri golang.org/x/oauth2 v0.0.0-20220909003341-f21342109be1/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= golang.org/x/oauth2 v0.1.0/go.mod h1:G9FE4dLTsbXUu90h/Pf85g4w1D+SSAgR+q46nJZ8M4A= -golang.org/x/oauth2 v0.17.0 h1:6m3ZPmLEFdVxKKWnKq4VqZ60gutO35zm+zrAHVmHyDQ= -golang.org/x/oauth2 v0.17.0/go.mod h1:OzPDGQiuQMguemayvdylqddI7qcD9lnSDb+1FiwQ5HA= +golang.org/x/oauth2 v0.23.0 h1:PbgcYx2W7i4LvjJWEbf0ngHV6qJYr86PkAV3bXdLEbs= +golang.org/x/oauth2 v0.23.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -1513,8 +1377,8 @@ golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220929204114-8fcdb60fdcc0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= -golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= +golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -1524,9 +1388,7 @@ golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190130150945-aca44879d564/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1536,10 +1398,10 @@ golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1547,7 +1409,6 @@ golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20191220142924-d4481acd189f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200107162124-548cf772de50/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1567,22 +1428,17 @@ golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200826173525-f9321e4c35a6/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210316164454-77fc1eacc6aa/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210324051608-47abb6519492/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210420205809-ac73e9fd8988/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210514084401-e8d321eab015/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -1592,10 +1448,10 @@ golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210819135213-f52c844e1c1c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210908233432-aa78b53d3365/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211124211545-fe61309f8881/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211210111614-af8b64212486/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -1615,22 +1471,23 @@ golang.org/x/sys v0.0.0-20220624220833-87e55d714810/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20221010170243-090e33056c14/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o= -golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= +golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.4.0/go.mod h1:9P2UbLfCdcvo3p/nzKvsmas4TnlujnuoV9hGgYzW1lQ= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= -golang.org/x/term v0.19.0 h1:+ThwsDv+tYfnJFhF4L8jITxu1tdTWRTZpdsWgEgjL6Q= -golang.org/x/term v0.19.0/go.mod h1:2CuTdWZ7KHSQwUzKva0cbMg6q2DMI3Mmxp+gKJbskEk= +golang.org/x/term v0.25.0 h1:WtHI/ltw4NvSUig5KARz9h521QvRC8RmF/cuYqifU24= +golang.org/x/term v0.25.0/go.mod h1:RPyXicDX+6vLxogjjRxjgD2TKtmAO6NZBsBRfrOLu7M= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1644,25 +1501,22 @@ golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= -golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= +golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20201208040808-7e3f01d25324/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= -golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= +golang.org/x/time v0.6.0 h1:eTDhh4ZXt5Qf0augr54TN6suAUudPcawVZeIAPU7D4U= +golang.org/x/time v0.6.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20180525024113-a5b4c53f6e8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190206041539-40960b6deb8e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= @@ -1671,23 +1525,25 @@ golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBn golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191108193012-7d206e10da11/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191126055441-b0650ceb63d9/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200103221440-774c71fcf114/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200108203644-89082a384178/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= @@ -1714,11 +1570,9 @@ golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.8-0.20211029000441-d6a9af8af023/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.2.0/go.mod h1:y4OqIKeOV/fWJetJ8bXPU1sEVniLMIyDAZWeHdV+NTA= -golang.org/x/tools v0.20.0 h1:hz/CVckiOxybQvFw6h7b/q80NTr9IUQb4s1IIzW7KNY= -golang.org/x/tools v0.20.0/go.mod h1:WvitBU7JJf6A4jOdg4S1tviW9bhUxkgeCui/0JHctQg= +golang.org/x/tools v0.22.0 h1:gqSGLZqv+AI9lIQzniJ0nZDRG5GBPsSi+DRNHWNz6yA= +golang.org/x/tools v0.22.0/go.mod h1:aCwcsjqvq7Yqt6TNyX7QMU2enbQ/Gt0bo6krSeEri+c= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -1726,14 +1580,7 @@ golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20220517211312-f3a8303e98df/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= golang.org/x/xerrors v0.0.0-20220609144429-65e65417b02f/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= -golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 h1:H2TDz8ibqkAF6YGhCdN3jS9O0/s90v0rJh3X/OLHEUk= golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= -gonum.org/v1/gonum v0.0.0-20180816165407-929014505bf4/go.mod h1:Y+Yx5eoAFn32cQvJDxZx5Dpnq+c3wtXuadVZAcxbbBo= -gonum.org/v1/gonum v0.0.0-20181121035319-3f7ecaa7e8ca/go.mod h1:Y+Yx5eoAFn32cQvJDxZx5Dpnq+c3wtXuadVZAcxbbBo= -gonum.org/v1/gonum v0.6.0/go.mod h1:9mxDZsDKxgMAuccQkewq682L+0eCu4dCN2yonUJTCLU= -gonum.org/v1/netlib v0.0.0-20181029234149-ec6d1f5cefe6/go.mod h1:wa6Ws7BG/ESfp6dHfk7C6KdzKA7wR7u/rKwOGE66zvw= -gonum.org/v1/netlib v0.0.0-20190313105609-8cb42192e0e0/go.mod h1:wa6Ws7BG/ESfp6dHfk7C6KdzKA7wR7u/rKwOGE66zvw= -gonum.org/v1/plot v0.0.0-20190515093506-e2840ee46a6b/go.mod h1:Wt8AAjI+ypCyYX3nZBvf6cAIx93T+c/OS2HFAYskSZc= google.golang.org/api v0.3.1/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= @@ -1783,8 +1630,8 @@ google.golang.org/api v0.96.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ google.golang.org/api v0.97.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ13s= google.golang.org/api v0.98.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ13s= google.golang.org/api v0.100.0/go.mod h1:ZE3Z2+ZOr87Rx7dqFsdRQkRBk36kDtp/h+QpHbB7a70= -google.golang.org/api v0.162.0 h1:Vhs54HkaEpkMBdgGdOT2P6F0csGG/vxDS0hWHJzmmps= -google.golang.org/api v0.162.0/go.mod h1:6SulDkfoBIg4NFmCuZ39XeeAgSHCPecfSUuDyYlAHs0= +google.golang.org/api v0.192.0 h1:PljqpNAfZaaSpS+TnANfnNAXKdzHM/B9bKhwRlo7JP0= +google.golang.org/api v0.192.0/go.mod h1:9VcphjvAxPKLmSxVSzPlSRXy/5ARMEw5bf58WoVXafQ= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -1793,8 +1640,6 @@ google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/appengine v1.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAsM= -google.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJffLiz/Ds= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= @@ -1802,7 +1647,6 @@ google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRn google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190530194941-fb225487d101/go.mod h1:z3L6/3dTEVtUr6QSP8miRzeRqwQOioJ9I66odjN4I7s= -google.golang.org/genproto v0.0.0-20190716160619-c506a9f90610/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= @@ -1810,7 +1654,6 @@ google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvx google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200108215221-bd8f9a0ef82f/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA= @@ -1903,12 +1746,12 @@ google.golang.org/genproto v0.0.0-20221010155953-15ba04fc1c0e/go.mod h1:3526vdqw google.golang.org/genproto v0.0.0-20221014173430-6e2ab493f96b/go.mod h1:1vXfmgAz9N9Jx0QA82PqRVauvCz1SGSz739p0f183jM= google.golang.org/genproto v0.0.0-20221014213838-99cd37c6964a/go.mod h1:1vXfmgAz9N9Jx0QA82PqRVauvCz1SGSz739p0f183jM= google.golang.org/genproto v0.0.0-20221025140454-527a21cfbd71/go.mod h1:9qHF0xnpdSfF6knlcsnpzUu5y+rpwgbvsyGAZPBMg4s= -google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de h1:F6qOa9AZTYJXOUEr4jDysRDLrm4PHePlge4v4TGAlxY= -google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de/go.mod h1:VUhTRKeHn9wwcdrk73nvdC9gF178Tzhmt/qyaFcPLSo= -google.golang.org/genproto/googleapis/api v0.0.0-20240227224415-6ceb2ff114de h1:jFNzHPIeuzhdRwVhbZdiym9q0ory/xY3sA+v2wPg8I0= -google.golang.org/genproto/googleapis/api v0.0.0-20240227224415-6ceb2ff114de/go.mod h1:5iCWqnniDlqZHrd3neWVTOwvh/v6s3232omMecelax8= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240401170217-c3f982113cda h1:LI5DOvAxUPMv/50agcLLoo+AdWc1irS9Rzz4vPuD1V4= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240401170217-c3f982113cda/go.mod h1:WtryC6hu0hhx87FDGxWCDptyssuo68sk10vYjF+T9fY= +google.golang.org/genproto v0.0.0-20240814211410-ddb44dafa142 h1:oLiyxGgE+rt22duwci1+TG7bg2/L1LQsXwfjPlmuJA0= +google.golang.org/genproto v0.0.0-20240814211410-ddb44dafa142/go.mod h1:G11eXq53iI5Q+kyNOmCvnzBaxEA2Q/Ik5Tj7nqBE8j4= +google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142 h1:wKguEg1hsxI2/L3hUYrpo1RVi48K+uTyzKqprwLXsb8= +google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142/go.mod h1:d6be+8HhtEtucleCbxpPW9PA9XwISACu8nvpPqF0BVo= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240930140551-af27646dc61f h1:cUMEy+8oS78BWIH9OWazBkzbr090Od9tWBNtZHkOhf0= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240930140551-af27646dc61f/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.0/go.mod h1:chYK+tFQF0nDUGJgXMSgLCQk3phJEuONr2DCgLDdAQM= @@ -1950,8 +1793,8 @@ google.golang.org/grpc v1.48.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACu google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= google.golang.org/grpc v1.50.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= google.golang.org/grpc v1.50.1/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= -google.golang.org/grpc v1.63.2 h1:MUeiw1B2maTVZthpU5xvASfTh3LDbxHd6IJ6QQVU+xM= -google.golang.org/grpc v1.63.2/go.mod h1:WAX/8DgncnokcFUldAxq7GeB5DXHDbMF+lLvDomNkRA= +google.golang.org/grpc v1.67.1 h1:zWnc1Vrcno+lHZCOofnIMvycFcc0QRGIzm9dhnDX68E= +google.golang.org/grpc v1.67.1/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= @@ -1968,8 +1811,8 @@ google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQ google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= -google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA= +google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= @@ -2004,7 +1847,6 @@ gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo= gotest.tools/v3 v3.5.1 h1:EENdUnS3pdur5nybKYIh2Vfgc8IUNBjxDPSjtiJcOzU= gotest.tools/v3 v3.5.1/go.mod h1:isy3WKz7GK6uNw/sbHzfKBLvlvXwUyV06n6brMxxopU= honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= @@ -2015,16 +1857,15 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -honnef.co/go/tools v0.1.3/go.mod h1:NgwopIslSNH47DimFoV78dnkksY2EFtX0ajyb3K/las= -nhooyr.io/websocket v1.8.6 h1:s+C3xAMLwGmlI31Nyn/eAehUlZPwfYZu2JXM621Q5/k= nhooyr.io/websocket v1.8.6/go.mod h1:B70DZP8IakI65RVQ51MsWP/8jndNma26DVA/nFSCgW0= +nhooyr.io/websocket v1.8.10 h1:mv4p+MnGrLDcPlBoWsvPP7XCzTYMXP9F9eIGoKbgx7Q= +nhooyr.io/websocket v1.8.10/go.mod h1:rN9OFWIUwuxg4fR5tELlYC04bXYowCP9GX47ivo2l+c= pgregory.net/rapid v1.1.0 h1:CMa0sjHSru3puNx+J0MIAuiiEV4N0qj8/cMWGBBCsjw= pgregory.net/rapid v1.1.0/go.mod h1:PY5XlDGj0+V1FCq0o192FdRhpKHGTRIWBgqjDBTrq04= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= -rsc.io/tmplfunc v0.0.3/go.mod h1:AG3sTPzElb1Io3Yg4voV9AGZJuleGAwaVRxL9M49PhA= sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E= sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY= diff --git a/migrate/utils/periodic_vesting.go b/migrate/utils/periodic_vesting.go index 5ae6d17e1a..1382ba9470 100644 --- a/migrate/utils/periodic_vesting.go +++ b/migrate/utils/periodic_vesting.go @@ -1,6 +1,7 @@ package utils import ( + sdkmath "cosmossdk.io/math" "time" sdk "github.com/cosmos/cosmos-sdk/types" @@ -38,7 +39,7 @@ func ResetPeriodicVestingAccount(vacc *v040vesting.PeriodicVestingAccount, start // If the new original vesting amount is less than the delegated vesting amount, set delegated vesting // to the new original vesting amount, and add the difference to the delegated free amount for _, delegatedVestingCoin := range vacc.DelegatedVesting { - newDelegatedVestingCoin := sdk.NewCoin(delegatedVestingCoin.Denom, sdk.MinInt(delegatedVestingCoin.Amount, newOriginalVesting.AmountOf(delegatedVestingCoin.Denom))) + newDelegatedVestingCoin := sdk.NewCoin(delegatedVestingCoin.Denom, sdkmath.MinInt(delegatedVestingCoin.Amount, newOriginalVesting.AmountOf(delegatedVestingCoin.Denom))) delegationAdjustment := delegatedVestingCoin.Sub(newDelegatedVestingCoin) if !delegationAdjustment.IsZero() { diff --git a/migrate/utils/periodic_vesting_reset_test.go b/migrate/utils/periodic_vesting_reset_test.go index ad6bbf1b79..9a8d9e6080 100644 --- a/migrate/utils/periodic_vesting_reset_test.go +++ b/migrate/utils/periodic_vesting_reset_test.go @@ -23,7 +23,12 @@ func createVestingAccount(balance sdk.Coins, vestingStart time.Time, vestingPeri originalVesting = originalVesting.Add(vp.Amount...) } - return vestingtypes.NewPeriodicVestingAccount(acc, originalVesting, vestingStart.Unix(), vestingPeriods) + vasting, err := vestingtypes.NewPeriodicVestingAccount(acc, originalVesting, vestingStart.Unix(), vestingPeriods) + if err != nil { + panic(err) + } + + return vasting } func TestResetPeriodVestingAccount_NoVestingPeriods(t *testing.T) { diff --git a/proto/kava/auction/v1beta1/auction.proto b/proto/kava/auction/v1beta1/auction.proto index a5e8c7d886..ff0b767c28 100644 --- a/proto/kava/auction/v1beta1/auction.proto +++ b/proto/kava/auction/v1beta1/auction.proto @@ -92,7 +92,7 @@ message WeightedAddresses { ]; repeated bytes weights = 2 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false ]; } diff --git a/proto/kava/auction/v1beta1/genesis.proto b/proto/kava/auction/v1beta1/genesis.proto index ca6ca79945..c787c35917 100644 --- a/proto/kava/auction/v1beta1/genesis.proto +++ b/proto/kava/auction/v1beta1/genesis.proto @@ -39,17 +39,17 @@ message Params { ]; bytes increment_surplus = 3 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; bytes increment_debt = 4 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; bytes increment_collateral = 5 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; } diff --git a/proto/kava/bep3/v1beta1/bep3.proto b/proto/kava/bep3/v1beta1/bep3.proto index 9b6825c0aa..95a1faf376 100644 --- a/proto/kava/bep3/v1beta1/bep3.proto +++ b/proto/kava/bep3/v1beta1/bep3.proto @@ -35,19 +35,19 @@ message AssetParam { // fixed_fee defines the fee for incoming swaps string fixed_fee = 6 [ (cosmos_proto.scalar) = "cosmos.Int", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false ]; // min_swap_amount defines the minimum amount able to be swapped in a single message string min_swap_amount = 7 [ (cosmos_proto.scalar) = "cosmos.Int", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false ]; // max_swap_amount defines the maximum amount able to be swapped in a single message string max_swap_amount = 8 [ (cosmos_proto.scalar) = "cosmos.Int", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false ]; // min_block_lock defined the minimum blocks to lock @@ -61,7 +61,7 @@ message SupplyLimit { // limit defines the total supply allowed string limit = 1 [ (cosmos_proto.scalar) = "cosmos.Int", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false ]; // time_limited enables or disables time based supply limiting @@ -74,7 +74,7 @@ message SupplyLimit { // time_based_limit defines the maximum supply that can be swapped within time_period string time_based_limit = 4 [ (cosmos_proto.scalar) = "cosmos.Int", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false ]; } diff --git a/proto/kava/cdp/v1beta1/cdp.proto b/proto/kava/cdp/v1beta1/cdp.proto index 1ee21001ba..b1b9adc5f6 100644 --- a/proto/kava/cdp/v1beta1/cdp.proto +++ b/proto/kava/cdp/v1beta1/cdp.proto @@ -26,7 +26,7 @@ message CDP { ]; string interest_factor = 8 [ (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; } diff --git a/proto/kava/cdp/v1beta1/genesis.proto b/proto/kava/cdp/v1beta1/genesis.proto index a993bbaed2..b4bc588fd5 100644 --- a/proto/kava/cdp/v1beta1/genesis.proto +++ b/proto/kava/cdp/v1beta1/genesis.proto @@ -47,22 +47,22 @@ message Params { cosmos.base.v1beta1.Coin global_debt_limit = 3 [(gogoproto.nullable) = false]; string surplus_auction_threshold = 4 [ (cosmos_proto.scalar) = "cosmos.Int", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false ]; string surplus_auction_lot = 5 [ (cosmos_proto.scalar) = "cosmos.Int", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false ]; string debt_auction_threshold = 6 [ (cosmos_proto.scalar) = "cosmos.Int", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false ]; string debt_auction_lot = 7 [ (cosmos_proto.scalar) = "cosmos.Int", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false ]; bool circuit_breaker = 8; @@ -76,12 +76,12 @@ message DebtParam { string reference_asset = 2; string conversion_factor = 3 [ (cosmos_proto.scalar) = "cosmos.Int", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false ]; string debt_floor = 4 [ (cosmos_proto.scalar) = "cosmos.Int", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false ]; } @@ -92,40 +92,40 @@ message CollateralParam { string type = 2; string liquidation_ratio = 3 [ (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; cosmos.base.v1beta1.Coin debt_limit = 4 [(gogoproto.nullable) = false]; string stability_fee = 5 [ (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; string auction_size = 6 [ (cosmos_proto.scalar) = "cosmos.Int", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false ]; string liquidation_penalty = 7 [ (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; string spot_market_id = 8 [(gogoproto.customname) = "SpotMarketID"]; string liquidation_market_id = 9 [(gogoproto.customname) = "LiquidationMarketID"]; string keeper_reward_percentage = 10 [ (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; string check_collateralization_index_count = 11 [ (cosmos_proto.scalar) = "cosmos.Int", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false ]; string conversion_factor = 12 [ (cosmos_proto.scalar) = "cosmos.Int", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false ]; } @@ -139,7 +139,7 @@ message GenesisAccumulationTime { ]; string interest_factor = 3 [ (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; } @@ -149,7 +149,7 @@ message GenesisTotalPrincipal { string collateral_type = 1; string total_principal = 2 [ (cosmos_proto.scalar) = "cosmos.Int", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false ]; } diff --git a/proto/kava/cdp/v1beta1/query.proto b/proto/kava/cdp/v1beta1/query.proto index ec27b84077..e7ffec3c1d 100644 --- a/proto/kava/cdp/v1beta1/query.proto +++ b/proto/kava/cdp/v1beta1/query.proto @@ -86,7 +86,7 @@ message QueryCdpsRequest { string collateral_type = 1; string owner = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; uint64 id = 3 [(gogoproto.customname) = "ID"]; - // sdk.Dec as a string + // sdkmath.LegacyDec as a string string ratio = 4; cosmos.base.query.v1beta1.PageRequest pagination = 5; diff --git a/proto/kava/committee/v1beta1/committee.proto b/proto/kava/committee/v1beta1/committee.proto index b0ab001b82..9ea35c6284 100644 --- a/proto/kava/committee/v1beta1/committee.proto +++ b/proto/kava/committee/v1beta1/committee.proto @@ -24,7 +24,7 @@ message BaseCommittee { // Smallest percentage that must vote for a proposal to pass string vote_threshold = 5 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; @@ -51,7 +51,7 @@ message TokenCommittee { BaseCommittee base_committee = 1 [(gogoproto.embed) = true]; string quorum = 2 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; string tally_denom = 3; diff --git a/proto/kava/committee/v1beta1/query.proto b/proto/kava/committee/v1beta1/query.proto index d99ff7ef2c..2b320da72f 100644 --- a/proto/kava/committee/v1beta1/query.proto +++ b/proto/kava/committee/v1beta1/query.proto @@ -144,27 +144,27 @@ message QueryTallyRequest { message QueryTallyResponse { uint64 proposal_id = 1 [(gogoproto.customname) = "ProposalID"]; string yes_votes = 2 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; string no_votes = 3 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; string current_votes = 4 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; string possible_votes = 5 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; string vote_threshold = 6 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; string quorum = 7 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; } diff --git a/proto/kava/earn/v1beta1/query.proto b/proto/kava/earn/v1beta1/query.proto index 8d788d852b..aba3d9ca22 100644 --- a/proto/kava/earn/v1beta1/query.proto +++ b/proto/kava/earn/v1beta1/query.proto @@ -96,7 +96,7 @@ message VaultResponse { // vault were to be liquidated. string total_value = 6 [ (cosmos_proto.scalar) = "cosmos.Int", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false ]; } diff --git a/proto/kava/earn/v1beta1/vault.proto b/proto/kava/earn/v1beta1/vault.proto index 8b3052d8bf..fd9eac147a 100644 --- a/proto/kava/earn/v1beta1/vault.proto +++ b/proto/kava/earn/v1beta1/vault.proto @@ -57,7 +57,7 @@ message VaultShare { string denom = 1; string amount = 2 [ (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; } diff --git a/proto/kava/evmutil/v1beta1/genesis.proto b/proto/kava/evmutil/v1beta1/genesis.proto index fa0f67222a..a17b89f572 100644 --- a/proto/kava/evmutil/v1beta1/genesis.proto +++ b/proto/kava/evmutil/v1beta1/genesis.proto @@ -31,7 +31,7 @@ message Account { // balance indicates the amount of akava owned by the address. string balance = 2 [ (cosmos_proto.scalar) = "cosmos.Int", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false ]; } diff --git a/proto/kava/evmutil/v1beta1/tx.proto b/proto/kava/evmutil/v1beta1/tx.proto index 93c43f15be..a941a07122 100644 --- a/proto/kava/evmutil/v1beta1/tx.proto +++ b/proto/kava/evmutil/v1beta1/tx.proto @@ -48,7 +48,7 @@ message MsgConvertERC20ToCoin { // ERC20 token amount to convert. string amount = 4 [ (cosmos_proto.scalar) = "cosmos.Int", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false ]; } diff --git a/proto/kava/hard/v1beta1/genesis.proto b/proto/kava/hard/v1beta1/genesis.proto index c2520a4291..86bfb4366d 100644 --- a/proto/kava/hard/v1beta1/genesis.proto +++ b/proto/kava/hard/v1beta1/genesis.proto @@ -47,12 +47,12 @@ message GenesisAccumulationTime { ]; string supply_interest_factor = 3 [ (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; string borrow_interest_factor = 4 [ (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; } diff --git a/proto/kava/hard/v1beta1/hard.proto b/proto/kava/hard/v1beta1/hard.proto index fafcbde7da..83f9656919 100644 --- a/proto/kava/hard/v1beta1/hard.proto +++ b/proto/kava/hard/v1beta1/hard.proto @@ -17,7 +17,7 @@ message Params { string minimum_borrow_usd_value = 2 [ (gogoproto.customname) = "MinimumBorrowUSDValue", (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; } @@ -29,18 +29,18 @@ message MoneyMarket { string spot_market_id = 3 [(gogoproto.customname) = "SpotMarketID"]; string conversion_factor = 4 [ (cosmos_proto.scalar) = "cosmos.Int", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false ]; InterestRateModel interest_rate_model = 5 [(gogoproto.nullable) = false]; string reserve_factor = 6 [ (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; string keeper_reward_percentage = 7 [ (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; } @@ -50,12 +50,12 @@ message BorrowLimit { bool has_max_limit = 1 [(gogoproto.jsontag) = "has_max_limit"]; string maximum_limit = 2 [ (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; string loan_to_value = 3 [ (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; } @@ -65,22 +65,22 @@ message InterestRateModel { string base_rate_apy = 1 [ (gogoproto.customname) = "BaseRateAPY", (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; string base_multiplier = 2 [ (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; string kink = 3 [ (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; string jump_multiplier = 4 [ (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; } @@ -122,7 +122,7 @@ message SupplyInterestFactor { string denom = 1; string value = 2 [ (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; } @@ -132,7 +132,7 @@ message BorrowInterestFactor { string denom = 1; string value = 2 [ (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; } diff --git a/proto/kava/hard/v1beta1/query.proto b/proto/kava/hard/v1beta1/query.proto index 92ef724811..39bf52e7d8 100644 --- a/proto/kava/hard/v1beta1/query.proto +++ b/proto/kava/hard/v1beta1/query.proto @@ -238,7 +238,7 @@ message DepositResponse { // SupplyInterestFactorResponse defines an individual borrow interest factor. message SupplyInterestFactorResponse { string denom = 1; - // sdk.Dec as string + // sdkmath.LegacyDec as string string value = 2; } @@ -258,24 +258,24 @@ message BorrowResponse { // BorrowInterestFactorResponse defines an individual borrow interest factor. message BorrowInterestFactorResponse { string denom = 1; - // sdk.Dec as string + // sdkmath.LegacyDec as string string value = 2; } // MoneyMarketInterestRate is a unique type returned by interest rate queries message MoneyMarketInterestRate { string denom = 1; - // sdk.Dec as String + // sdkmath.LegacyDec as String string supply_interest_rate = 2; - // sdk.Dec as String + // sdkmath.LegacyDec as String string borrow_interest_rate = 3; } // InterestFactor is a unique type returned by interest factor queries message InterestFactor { string denom = 1; - // sdk.Dec as String + // sdkmath.LegacyDec as String string borrow_interest_factor = 2; - // sdk.Dec as String + // sdkmath.LegacyDec as String string supply_interest_factor = 3; } diff --git a/proto/kava/incentive/v1beta1/apy.proto b/proto/kava/incentive/v1beta1/apy.proto index 5b6abf9340..506595265f 100644 --- a/proto/kava/incentive/v1beta1/apy.proto +++ b/proto/kava/incentive/v1beta1/apy.proto @@ -12,7 +12,7 @@ message Apy { string collateral_type = 1; string apy = 2 [ (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; } diff --git a/proto/kava/incentive/v1beta1/claims.proto b/proto/kava/incentive/v1beta1/claims.proto index f9e54906a0..2cafc3ddfa 100644 --- a/proto/kava/incentive/v1beta1/claims.proto +++ b/proto/kava/incentive/v1beta1/claims.proto @@ -42,7 +42,7 @@ message RewardIndex { string collateral_type = 1; bytes reward_factor = 2 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; } diff --git a/proto/kava/incentive/v1beta1/params.proto b/proto/kava/incentive/v1beta1/params.proto index 7571f9a33b..469564c916 100644 --- a/proto/kava/incentive/v1beta1/params.proto +++ b/proto/kava/incentive/v1beta1/params.proto @@ -56,7 +56,7 @@ message Multiplier { int64 months_lockup = 2; bytes factor = 3 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; } diff --git a/proto/kava/issuance/v1beta1/genesis.proto b/proto/kava/issuance/v1beta1/genesis.proto index 4f791de269..9a614487e9 100644 --- a/proto/kava/issuance/v1beta1/genesis.proto +++ b/proto/kava/issuance/v1beta1/genesis.proto @@ -39,7 +39,7 @@ message RateLimit { bool active = 1; bytes limit = 2 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false, (gogoproto.jsontag) = "limit,omitempty" ]; diff --git a/proto/kava/kavadist/v1beta1/params.proto b/proto/kava/kavadist/v1beta1/params.proto index 5c90b71887..2ad131af36 100644 --- a/proto/kava/kavadist/v1beta1/params.proto +++ b/proto/kava/kavadist/v1beta1/params.proto @@ -42,7 +42,7 @@ message CoreReward { ]; string weight = 2 [ (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; option (gogoproto.goproto_stringer) = true; @@ -78,6 +78,6 @@ message Period { // example "1.000000003022265980" - 10% inflation bytes inflation = 3 [ (gogoproto.nullable) = false, - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec" + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec" ]; } diff --git a/proto/kava/liquid/v1beta1/tx.proto b/proto/kava/liquid/v1beta1/tx.proto index 077e2b0b21..147de6862d 100644 --- a/proto/kava/liquid/v1beta1/tx.proto +++ b/proto/kava/liquid/v1beta1/tx.proto @@ -47,7 +47,7 @@ message MsgBurnDerivativeResponse { // received is the number of delegation shares sent to the sender string received = 1 [ (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; } diff --git a/proto/kava/pricefeed/v1beta1/query.proto b/proto/kava/pricefeed/v1beta1/query.proto index eecc9bc846..0555c80e77 100644 --- a/proto/kava/pricefeed/v1beta1/query.proto +++ b/proto/kava/pricefeed/v1beta1/query.proto @@ -134,7 +134,7 @@ message PostedPriceResponse { string market_id = 1 [(gogoproto.customname) = "MarketID"]; string oracle_address = 2; string price = 3 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; google.protobuf.Timestamp expiry = 4 [ @@ -148,7 +148,7 @@ message PostedPriceResponse { message CurrentPriceResponse { string market_id = 1 [(gogoproto.customname) = "MarketID"]; string price = 2 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; } diff --git a/proto/kava/pricefeed/v1beta1/store.proto b/proto/kava/pricefeed/v1beta1/store.proto index ebe0433780..04f92e7b9a 100644 --- a/proto/kava/pricefeed/v1beta1/store.proto +++ b/proto/kava/pricefeed/v1beta1/store.proto @@ -37,7 +37,7 @@ message PostedPrice { (gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress" ]; string price = 3 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; google.protobuf.Timestamp expiry = 4 [ @@ -51,7 +51,7 @@ message PostedPrice { message CurrentPrice { string market_id = 1 [(gogoproto.customname) = "MarketID"]; string price = 2 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; } diff --git a/proto/kava/pricefeed/v1beta1/tx.proto b/proto/kava/pricefeed/v1beta1/tx.proto index 66da318a8e..de6c151e9e 100644 --- a/proto/kava/pricefeed/v1beta1/tx.proto +++ b/proto/kava/pricefeed/v1beta1/tx.proto @@ -22,7 +22,7 @@ message MsgPostPrice { string from = 1; string market_id = 2 [(gogoproto.customname) = "MarketID"]; string price = 3 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; google.protobuf.Timestamp expiry = 4 [ diff --git a/proto/kava/swap/v1beta1/query.proto b/proto/kava/swap/v1beta1/query.proto index 63a0f8fb8d..8e908c8ff8 100644 --- a/proto/kava/swap/v1beta1/query.proto +++ b/proto/kava/swap/v1beta1/query.proto @@ -69,7 +69,7 @@ message PoolResponse { // total_shares represents the total shares of the pool string total_shares = 3 [ (cosmos_proto.scalar) = "cosmos.Int", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false ]; } @@ -107,7 +107,7 @@ message DepositResponse { // shares_owned presents the shares owned by the depositor for the pool string shares_owned = 3 [ (cosmos_proto.scalar) = "cosmos.AddressString", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false ]; // shares_value represents the coin value of the shares_owned diff --git a/proto/kava/swap/v1beta1/swap.proto b/proto/kava/swap/v1beta1/swap.proto index 4e295d8eef..5c9388ca4e 100644 --- a/proto/kava/swap/v1beta1/swap.proto +++ b/proto/kava/swap/v1beta1/swap.proto @@ -19,7 +19,7 @@ message Params { // swap_fee defines the swap fee for all pools string swap_fee = 2 [ (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; } @@ -46,7 +46,7 @@ message PoolRecord { // total_shares is the total distrubuted shares of the pool string total_shares = 4 [ (cosmos_proto.scalar) = "cosmos.Int", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false ]; } @@ -63,7 +63,7 @@ message ShareRecord { // shares_owned represents the number of shares owned by depsoitor for the pool_id string shares_owned = 3 [ (cosmos_proto.scalar) = "cosmos.Int", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false ]; } diff --git a/proto/kava/swap/v1beta1/tx.proto b/proto/kava/swap/v1beta1/tx.proto index 7980b66c3c..aa71e4e826 100644 --- a/proto/kava/swap/v1beta1/tx.proto +++ b/proto/kava/swap/v1beta1/tx.proto @@ -32,7 +32,7 @@ message MsgDeposit { // slippage represents the max decimal percentage price change string slippage = 4 [ (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; // deadline represents the unix timestamp to complete the deposit by @@ -50,7 +50,7 @@ message MsgWithdraw { string from = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // shares represents the amount of shares to withdraw string shares = 2 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false ]; // min_token_a represents the minimum a token to withdraw @@ -77,7 +77,7 @@ message MsgSwapExactForTokens { // slippage represents the maximum change in token_b allowed string slippage = 4 [ (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; // deadline represents the unix timestamp to complete the swap by @@ -102,7 +102,7 @@ message MsgSwapForExactTokens { // slippage represents the maximum change in token_a allowed string slippage = 4 [ (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; // deadline represents the unix timestamp to complete the swap by diff --git a/proto/kava/validatorvesting/v1beta1/query.proto b/proto/kava/validatorvesting/v1beta1/query.proto index 406c071363..1bf70f73fc 100644 --- a/proto/kava/validatorvesting/v1beta1/query.proto +++ b/proto/kava/validatorvesting/v1beta1/query.proto @@ -53,7 +53,7 @@ message QueryCirculatingSupplyRequest {} message QueryCirculatingSupplyResponse { string amount = 1 [ (cosmos_proto.scalar) = "cosmos.Int", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false ]; } @@ -65,7 +65,7 @@ message QueryTotalSupplyRequest {} message QueryTotalSupplyResponse { string amount = 1 [ (cosmos_proto.scalar) = "cosmos.Int", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false ]; } @@ -77,7 +77,7 @@ message QueryCirculatingSupplyHARDRequest {} message QueryCirculatingSupplyHARDResponse { string amount = 1 [ (cosmos_proto.scalar) = "cosmos.Int", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false ]; } @@ -89,7 +89,7 @@ message QueryCirculatingSupplyUSDXRequest {} message QueryCirculatingSupplyUSDXResponse { string amount = 1 [ (cosmos_proto.scalar) = "cosmos.Int", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false ]; } @@ -101,7 +101,7 @@ message QueryCirculatingSupplySWPRequest {} message QueryCirculatingSupplySWPResponse { string amount = 1 [ (cosmos_proto.scalar) = "cosmos.Int", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false ]; } @@ -113,7 +113,7 @@ message QueryTotalSupplyHARDRequest {} message QueryTotalSupplyHARDResponse { string amount = 1 [ (cosmos_proto.scalar) = "cosmos.Int", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false ]; } @@ -125,7 +125,7 @@ message QueryTotalSupplyUSDXRequest {} message QueryTotalSupplyUSDXResponse { string amount = 1 [ (cosmos_proto.scalar) = "cosmos.Int", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false ]; } diff --git a/tests/e2e-ibc/erc20_test.go b/tests/e2e-ibc/erc20_test.go index 642f8829b2..836ae764df 100644 --- a/tests/e2e-ibc/erc20_test.go +++ b/tests/e2e-ibc/erc20_test.go @@ -17,7 +17,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" gov1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" paramsutils "github.com/cosmos/cosmos-sdk/x/params/client/utils" - transfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" + transfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" "github.com/ethereum/go-ethereum/ethclient" @@ -230,7 +230,7 @@ func TestInterchainErc20(t *testing.T) { convertTx := util.KavaMsgRequest{ Msgs: []sdk.Msg{&msg}, GasLimit: 4e5, - FeeAmount: sdk.NewCoins(sdk.NewCoin("ukava", sdk.NewInt(400))), + FeeAmount: sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(400))), Data: "converting sdk coin to erc20", } res := user.SignAndBroadcastKavaTx(convertTx) diff --git a/tests/e2e-ibc/go.mod b/tests/e2e-ibc/go.mod index e5e6c1f156..c50ff6aac8 100644 --- a/tests/e2e-ibc/go.mod +++ b/tests/e2e-ibc/go.mod @@ -11,24 +11,23 @@ require ( ) require ( - github.com/cosmos/cosmos-sdk v0.47.10 + github.com/cosmos/cosmos-sdk v0.53.0 github.com/kava-labs/kava v0.0.0-00010101000000-000000000000 github.com/strangelove-ventures/interchaintest/v7 v7.0.1-0.20240506191732-71a15c29f2b7 ) require ( - cloud.google.com/go v0.112.0 // indirect - cloud.google.com/go/compute v1.24.0 // indirect - cloud.google.com/go/compute/metadata v0.2.3 // indirect - cloud.google.com/go/iam v1.1.6 // indirect - cloud.google.com/go/storage v1.36.0 // indirect - cosmossdk.io/api v0.3.1 // indirect - cosmossdk.io/core v0.6.1 // indirect - cosmossdk.io/depinject v1.0.0-alpha.4 // indirect + cloud.google.com/go v0.115.1 // indirect + cloud.google.com/go/compute v1.27.4 // indirect + cloud.google.com/go/compute/metadata v0.5.0 // indirect + cloud.google.com/go/iam v1.1.13 // indirect + cloud.google.com/go/storage v1.43.0 // indirect + cosmossdk.io/api v0.7.5 // indirect + cosmossdk.io/core v0.12.0 // indirect + cosmossdk.io/depinject v1.0.0 // indirect cosmossdk.io/errors v1.0.1 // indirect - cosmossdk.io/log v1.3.1 // indirect - cosmossdk.io/tools/rosetta v0.2.1 // indirect - filippo.io/edwards25519 v1.0.0 // indirect + cosmossdk.io/log v1.4.1 // indirect + filippo.io/edwards25519 v1.1.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/99designs/keyring v1.2.2 // indirect github.com/BurntSushi/toml v1.3.2 // indirect @@ -42,51 +41,51 @@ require ( github.com/VictoriaMetrics/fastcache v1.12.1 // indirect github.com/armon/go-metrics v0.4.1 // indirect github.com/avast/retry-go/v4 v4.5.0 // indirect - github.com/aws/aws-sdk-go v1.44.203 // indirect + github.com/aws/aws-sdk-go v1.55.5 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect - github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 // indirect - github.com/btcsuite/btcd v0.24.0 // indirect - github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect - github.com/btcsuite/btcd/btcutil v1.1.5 // indirect + github.com/bgentry/speakeasy v0.2.0 // indirect + github.com/btcsuite/btcd v0.24.2 // indirect + github.com/btcsuite/btcd/btcec/v2 v2.3.4 // indirect + github.com/btcsuite/btcd/btcutil v1.1.6 // indirect github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0 // indirect - github.com/cenkalti/backoff/v4 v4.1.3 // indirect + github.com/cenkalti/backoff/v4 v4.3.0 // indirect github.com/cespare/xxhash v1.1.0 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/chzyer/readline v1.5.1 // indirect - github.com/cockroachdb/errors v1.11.1 // indirect + github.com/cockroachdb/errors v1.11.3 // indirect github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect - github.com/cockroachdb/pebble v1.1.0 // indirect + github.com/cockroachdb/pebble v1.1.1 // indirect github.com/cockroachdb/redact v1.1.5 // indirect github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect github.com/coinbase/rosetta-sdk-go/types v1.0.0 // indirect - github.com/cometbft/cometbft v0.37.9 // indirect - github.com/cometbft/cometbft-db v0.9.1 // indirect + github.com/cometbft/cometbft v1.0.0-rc1.0.20240908111210-ab0be101882f // indirect + github.com/cometbft/cometbft-db v0.11.0 // indirect github.com/confio/ics23/go v0.9.0 // indirect github.com/cosmos/btcutil v1.0.5 // indirect github.com/cosmos/cosmos-db v1.0.2 // indirect github.com/cosmos/cosmos-proto v1.0.0-beta.5 // indirect github.com/cosmos/go-bip39 v1.0.0 // indirect github.com/cosmos/gogogateway v1.2.0 // indirect - github.com/cosmos/gogoproto v1.4.10 // indirect + github.com/cosmos/gogoproto v1.7.0 // indirect github.com/cosmos/iavl v1.2.0 // indirect github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7 v7.1.3 // indirect - github.com/cosmos/ibc-go/modules/capability v1.0.0-rc1 // indirect - github.com/cosmos/ics23/go v0.10.0 // indirect + github.com/cosmos/ibc-go/modules/capability v1.0.1 // indirect + github.com/cosmos/ics23/go v0.11.0 // indirect github.com/cosmos/interchain-security/v3 v3.1.1-0.20231102122221-81650a84f989 // indirect github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect github.com/cosmos/rosetta-sdk-go v0.10.0 // indirect github.com/creachadair/taskgroup v0.4.2 // indirect - github.com/danieljoos/wincred v1.1.2 // indirect + github.com/danieljoos/wincred v1.2.1 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/deckarep/golang-set v1.8.0 // indirect github.com/decred/base58 v1.0.4 // indirect github.com/decred/dcrd/crypto/blake256 v1.0.1 // indirect github.com/decred/dcrd/dcrec/secp256k1/v2 v2.0.1 // indirect - github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect + github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 // indirect github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f // indirect github.com/dgraph-io/badger/v2 v2.2007.4 // indirect - github.com/dgraph-io/ristretto v0.1.1 // indirect + github.com/dgraph-io/ristretto v0.1.2-0.20240116140435-c67e07994f91 // indirect github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect github.com/docker/distribution v2.8.2+incompatible // indirect github.com/docker/docker v24.0.7+incompatible // indirect @@ -104,47 +103,47 @@ require ( github.com/go-kit/kit v0.13.0 // indirect github.com/go-kit/log v0.2.1 // indirect github.com/go-logfmt/logfmt v0.6.0 // indirect - github.com/go-logr/logr v1.4.1 // indirect + github.com/go-logr/logr v1.4.2 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/go-ole/go-ole v1.3.0 // indirect github.com/go-stack/stack v1.8.1 // indirect github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect github.com/gogo/googleapis v1.4.1 // indirect github.com/gogo/protobuf v1.3.3 // indirect - github.com/golang/glog v1.2.0 // indirect + github.com/golang/glog v1.2.2 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/mock v1.6.0 // indirect github.com/golang/protobuf v1.5.4 // indirect github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect - github.com/google/btree v1.1.2 // indirect + github.com/google/btree v1.1.3 // indirect github.com/google/go-cmp v0.6.0 // indirect github.com/google/orderedcode v0.0.1 // indirect - github.com/google/s2a-go v0.1.7 // indirect + github.com/google/s2a-go v0.1.8 // indirect github.com/google/uuid v1.6.0 // indirect github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect - github.com/googleapis/gax-go/v2 v2.12.0 // indirect - github.com/gorilla/handlers v1.5.1 // indirect - github.com/gorilla/mux v1.8.0 // indirect - github.com/gorilla/websocket v1.5.0 // indirect + github.com/googleapis/gax-go/v2 v2.13.0 // indirect + github.com/gorilla/handlers v1.5.2 // indirect + github.com/gorilla/mux v1.8.1 // indirect + github.com/gorilla/websocket v1.5.3 // indirect github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 // indirect github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect github.com/gtank/merlin v0.1.1 // indirect github.com/gtank/ristretto255 v0.1.2 // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // indirect - github.com/hashicorp/go-getter v1.7.5 // indirect + github.com/hashicorp/go-getter v1.7.6 // indirect github.com/hashicorp/go-immutable-radix v1.3.1 // indirect github.com/hashicorp/go-safetemp v1.0.0 // indirect - github.com/hashicorp/go-version v1.6.0 // indirect + github.com/hashicorp/go-version v1.7.0 // indirect github.com/hashicorp/golang-lru v1.0.2 // indirect github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect github.com/hashicorp/hcl v1.0.0 // indirect - github.com/hdevalence/ed25519consensus v0.1.0 // indirect + github.com/hdevalence/ed25519consensus v0.2.0 // indirect github.com/holiman/bloomfilter/v2 v2.0.3 // indirect github.com/holiman/uint256 v1.2.4 // indirect - github.com/huandu/skiplist v1.2.0 // indirect + github.com/huandu/skiplist v1.2.1 // indirect github.com/huin/goupnp v1.3.0 // indirect - github.com/iancoleman/orderedmap v0.2.0 // indirect + github.com/iancoleman/orderedmap v0.3.0 // indirect github.com/icza/dyno v0.0.0-20220812133438-f0b6f8a18845 // indirect github.com/improbable-eng/grpc-web v0.15.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect @@ -153,14 +152,14 @@ require ( github.com/jmespath/go-jmespath v0.4.0 // indirect github.com/jmhodges/levigo v1.0.0 // indirect github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect - github.com/klauspost/compress v1.17.7 // indirect + github.com/klauspost/compress v1.17.9 // indirect github.com/klauspost/cpuid/v2 v2.2.4 // indirect github.com/kr/pretty v0.3.1 // indirect github.com/kr/text v0.2.0 // indirect - github.com/lib/pq v1.10.7 // indirect + github.com/lib/pq v1.10.9 // indirect github.com/libp2p/go-buffer-pool v0.1.0 // indirect github.com/libp2p/go-libp2p v0.27.8 // indirect - github.com/linxGnu/grocksdb v1.8.13 // indirect + github.com/linxGnu/grocksdb v1.9.3 // indirect github.com/magiconair/properties v1.8.7 // indirect github.com/manifoldco/promptui v0.9.0 // indirect github.com/mattn/go-colorable v0.1.13 // indirect @@ -168,7 +167,7 @@ require ( github.com/mattn/go-runewidth v0.0.14 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect github.com/mimoo/StrobeGo v0.0.0-20220103164710-9a04d6ca976b // indirect - github.com/minio/highwayhash v1.0.2 // indirect + github.com/minio/highwayhash v1.0.3 // indirect github.com/minio/sha256-simd v1.0.0 // indirect github.com/misko9/go-substrate-rpc-client/v4 v4.0.0 // indirect github.com/mitchellh/go-homedir v1.1.0 // indirect @@ -187,15 +186,15 @@ require ( github.com/opencontainers/go-digest v1.0.0 // indirect github.com/opencontainers/image-spec v1.1.0-rc2 // indirect github.com/pelletier/go-toml v1.9.5 // indirect - github.com/pelletier/go-toml/v2 v2.1.0 // indirect - github.com/petermattis/goid v0.0.0-20231207134359-e60b3f734c67 // indirect + github.com/pelletier/go-toml/v2 v2.2.3 // indirect + github.com/petermattis/goid v0.0.0-20240813172612-4fcff4a6cae7 // indirect github.com/pierrec/xxHash v0.1.5 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/prometheus/client_golang v1.17.0 // indirect + github.com/prometheus/client_golang v1.20.4 // indirect github.com/prometheus/client_model v0.6.1 // indirect - github.com/prometheus/common v0.44.0 // indirect - github.com/prometheus/procfs v0.13.0 // indirect + github.com/prometheus/common v0.60.0 // indirect + github.com/prometheus/procfs v0.15.1 // indirect github.com/prometheus/tsdb v0.7.1 // indirect github.com/rakyll/statik v0.1.7 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect @@ -203,19 +202,19 @@ require ( github.com/rivo/uniseg v0.4.3 // indirect github.com/rjeczalik/notify v0.9.1 // indirect github.com/rogpeppe/go-internal v1.12.0 // indirect - github.com/rs/cors v1.8.3 // indirect - github.com/rs/zerolog v1.32.0 // indirect + github.com/rs/cors v1.11.1 // indirect + github.com/rs/zerolog v1.33.0 // indirect github.com/sagikazarmark/locafero v0.4.0 // indirect github.com/sagikazarmark/slog-shim v0.1.0 // indirect - github.com/sasha-s/go-deadlock v0.3.1 // indirect + github.com/sasha-s/go-deadlock v0.3.5 // indirect github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect github.com/sourcegraph/conc v0.3.0 // indirect github.com/spaolacci/murmur3 v1.1.0 // indirect github.com/spf13/afero v1.11.0 // indirect - github.com/spf13/cast v1.6.0 // indirect - github.com/spf13/cobra v1.8.0 // indirect + github.com/spf13/cast v1.7.0 // indirect + github.com/spf13/cobra v1.8.1 // indirect github.com/spf13/pflag v1.0.5 // indirect - github.com/spf13/viper v1.18.2 // indirect + github.com/spf13/viper v1.19.0 // indirect github.com/status-im/keycard-go v0.2.0 // indirect github.com/subosito/gotenv v1.6.0 // indirect github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect @@ -225,36 +224,36 @@ require ( github.com/tklauser/numcpus v0.6.1 // indirect github.com/tyler-smith/go-bip32 v1.0.0 // indirect github.com/tyler-smith/go-bip39 v1.1.0 // indirect - github.com/ulikunitz/xz v0.5.11 // indirect + github.com/ulikunitz/xz v0.5.12 // indirect github.com/vedhavyas/go-subkey/v2 v2.0.0 // indirect github.com/zondax/hid v0.9.2 // indirect github.com/zondax/ledger-go v0.14.3 // indirect - go.etcd.io/bbolt v1.3.8 // indirect + go.etcd.io/bbolt v1.3.10 // indirect go.opencensus.io v0.24.0 // indirect - go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.47.0 // indirect - go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.47.0 // indirect - go.opentelemetry.io/otel v1.22.0 // indirect - go.opentelemetry.io/otel/metric v1.22.0 // indirect - go.opentelemetry.io/otel/trace v1.22.0 // indirect + go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.49.0 // indirect + go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 // indirect + go.opentelemetry.io/otel v1.28.0 // indirect + go.opentelemetry.io/otel/metric v1.28.0 // indirect + go.opentelemetry.io/otel/trace v1.28.0 // indirect go.uber.org/multierr v1.11.0 // indirect - golang.org/x/crypto v0.22.0 // indirect - golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa // indirect + golang.org/x/crypto v0.28.0 // indirect + golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8 // indirect golang.org/x/mod v0.17.0 // indirect - golang.org/x/net v0.24.0 // indirect - golang.org/x/oauth2 v0.17.0 // indirect - golang.org/x/sync v0.7.0 // indirect - golang.org/x/sys v0.19.0 // indirect - golang.org/x/term v0.19.0 // indirect - golang.org/x/text v0.14.0 // indirect - golang.org/x/time v0.5.0 // indirect - golang.org/x/tools v0.20.0 // indirect - google.golang.org/api v0.162.0 // indirect + golang.org/x/net v0.29.0 // indirect + golang.org/x/oauth2 v0.23.0 // indirect + golang.org/x/sync v0.8.0 // indirect + golang.org/x/sys v0.26.0 // indirect + golang.org/x/term v0.25.0 // indirect + golang.org/x/text v0.19.0 // indirect + golang.org/x/time v0.6.0 // indirect + golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect + google.golang.org/api v0.192.0 // indirect google.golang.org/appengine v1.6.8 // indirect - google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20240227224415-6ceb2ff114de // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240401170217-c3f982113cda // indirect - google.golang.org/grpc v1.63.2 // indirect - google.golang.org/protobuf v1.33.0 // indirect + google.golang.org/genproto v0.0.0-20240814211410-ddb44dafa142 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240930140551-af27646dc61f // indirect + google.golang.org/grpc v1.67.1 // indirect + google.golang.org/protobuf v1.35.1 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect gopkg.in/yaml.v2 v2.4.0 // indirect @@ -270,7 +269,7 @@ require ( modernc.org/sqlite v1.25.0 // indirect modernc.org/strutil v1.1.3 // indirect modernc.org/token v1.0.1 // indirect - nhooyr.io/websocket v1.8.7 // indirect + nhooyr.io/websocket v1.8.10 // indirect pgregory.net/rapid v1.1.0 // indirect sigs.k8s.io/yaml v1.4.0 // indirect ) diff --git a/tests/e2e-ibc/go.sum b/tests/e2e-ibc/go.sum index de6ee7957d..fcb53531b6 100644 --- a/tests/e2e-ibc/go.sum +++ b/tests/e2e-ibc/go.sum @@ -32,6 +32,9 @@ cloud.google.com/go v0.102.1/go.mod h1:XZ77E9qnTEnrgEOvr4xzfdX5TRo7fB4T2F4O6+34h cloud.google.com/go v0.104.0/go.mod h1:OO6xxXdJyvuJPcEPBLN9BJPD+jep5G1+2U5B5gkRYtA= cloud.google.com/go v0.112.0 h1:tpFCD7hpHFlQ8yPwT3x+QeXqc2T6+n6T+hmABHfDUSM= cloud.google.com/go v0.112.0/go.mod h1:3jEEVwZ/MHU4djK5t5RHuKOA/GbLddgTdVubX1qnPD4= +cloud.google.com/go v0.112.1/go.mod h1:+Vbu+Y1UU+I1rjmzeMOb/8RfkKJK2Gyxi1X6jJCZLo4= +cloud.google.com/go v0.115.0/go.mod h1:8jIM5vVgoAEoiVxQ/O4BFTfHqulPZgs/ufEzMcFMdWU= +cloud.google.com/go v0.115.1/go.mod h1:DuujITeaufu3gL68/lOFIirVNJwQeyf5UXyi+Wbgknc= cloud.google.com/go/aiplatform v1.22.0/go.mod h1:ig5Nct50bZlzV6NvKaTwmplLLddFx0YReh9WfTO5jKw= cloud.google.com/go/aiplatform v1.24.0/go.mod h1:67UUvRBKG6GTayHKV8DBv2RtR1t93YRu5B1P3x99mYY= cloud.google.com/go/analytics v0.11.0/go.mod h1:DjEWCu41bVbYcKyvlws9Er60YE4a//bK6mnhWvQeFNI= @@ -70,8 +73,13 @@ cloud.google.com/go/compute v1.7.0/go.mod h1:435lt8av5oL9P3fv1OEzSbSUe+ybHXGMPQH cloud.google.com/go/compute v1.10.0/go.mod h1:ER5CLbMxl90o2jtNbGSbtfOpQKR0t15FOtRsugnLrlU= cloud.google.com/go/compute v1.24.0 h1:phWcR2eWzRJaL/kOiJwfFsPs4BaKq1j6vnpZrc1YlVg= cloud.google.com/go/compute v1.24.0/go.mod h1:kw1/T+h/+tK2LJK0wiPPx1intgdAM3j/g3hFDlscY40= +cloud.google.com/go/compute v1.25.1/go.mod h1:oopOIR53ly6viBYxaDhBfJwzUAxf1zE//uf3IB011ls= +cloud.google.com/go/compute v1.27.1/go.mod h1:UVWm+bWKEKoM+PW2sZycP1Jgk3NhKwR2Iy2Cnp/G40I= +cloud.google.com/go/compute v1.27.4/go.mod h1:7JZS+h21ERAGHOy5qb7+EPyXlQwzshzrx1x6L9JhTqU= cloud.google.com/go/compute/metadata v0.2.3 h1:mg4jlk7mCAj6xXp9UJ4fjI9VUI5rubuGBW5aJ7UnBMY= cloud.google.com/go/compute/metadata v0.2.3/go.mod h1:VAV5nSsACxMJvgaAuX6Pk2AawlZn8kiOGuCv6gTkwuA= +cloud.google.com/go/compute/metadata v0.3.0/go.mod h1:zFmK7XCadkQkj6TtorcaGlCW1hT1fIilQDwofLpJ20k= +cloud.google.com/go/compute/metadata v0.5.0/go.mod h1:aHnloV2TPI38yx4s9+wAZhHykWvVCfu7hQbF+9CWoiY= cloud.google.com/go/containeranalysis v0.5.1/go.mod h1:1D92jd8gRR/c0fGMlymRgxWD3Qw9C1ff6/T7mLgVL8I= cloud.google.com/go/containeranalysis v0.6.0/go.mod h1:HEJoiEIu+lEXM+k7+qLCci0h33lX3ZqoYFdmPcoO7s4= cloud.google.com/go/datacatalog v1.3.0/go.mod h1:g9svFY6tuR+j+hrTw3J2dNcmI0dzmSiyOzm8kpLq0a0= @@ -111,6 +119,8 @@ cloud.google.com/go/iam v0.3.0/go.mod h1:XzJPvDayI+9zsASAFO68Hk07u3z+f+JrT2xXNdp cloud.google.com/go/iam v0.5.0/go.mod h1:wPU9Vt0P4UmCux7mqtRu6jcpPAb74cP1fh50J3QpkUc= cloud.google.com/go/iam v1.1.6 h1:bEa06k05IO4f4uJonbB5iAgKTPpABy1ayxaIZV/GHVc= cloud.google.com/go/iam v1.1.6/go.mod h1:O0zxdPeGBoFdWW3HWmBxJsk0pfvNM/p/qa82rWOGTwI= +cloud.google.com/go/iam v1.1.9/go.mod h1:Nt1eDWNYH9nGQg3d/mY7U1hvfGmsaG9o/kLGoLoLXjQ= +cloud.google.com/go/iam v1.1.13/go.mod h1:K8mY0uSXwEXS30KrnVb+j54LB/ntfZu1dr+4zFMNbus= cloud.google.com/go/language v1.4.0/go.mod h1:F9dRpNFQmJbkaop6g0JhSBXCNlO90e1KWx5iDdxbWic= cloud.google.com/go/language v1.6.0/go.mod h1:6dJ8t3B+lUYfStgls25GusK04NLh3eDLQnWM3mdEbhI= cloud.google.com/go/lifesciences v0.5.0/go.mod h1:3oIKy8ycWGPUyZDR/8RNnTOYevhaMLqh5vLUXs9zvT8= @@ -173,6 +183,9 @@ cloud.google.com/go/storage v1.23.0/go.mod h1:vOEEDNFnciUMhBeT6hsJIn3ieU5cFRmzeL cloud.google.com/go/storage v1.27.0/go.mod h1:x9DOL8TK/ygDUMieqwfhdpQryTeEkhGKMi80i/iqR2s= cloud.google.com/go/storage v1.36.0 h1:P0mOkAcaJxhCTvAkMhxMfrTKiNcub4YmmPBtlhAyTr8= cloud.google.com/go/storage v1.36.0/go.mod h1:M6M/3V/D3KpzMTJyPOR/HU6n2Si5QdaXYEsng2xgOs8= +cloud.google.com/go/storage v1.38.0/go.mod h1:tlUADB0mAb9BgYls9lq+8MGkfzOXuLrnHXlpHmvFJoY= +cloud.google.com/go/storage v1.41.0/go.mod h1:J1WCa/Z2FcgdEDuPUY8DxT5I+d9mFKsCepp5vR6Sq80= +cloud.google.com/go/storage v1.43.0/go.mod h1:ajvxEa7WmZS1PxvKRq4bq0tFT3vMd502JwstCcYv0Q0= cloud.google.com/go/talent v1.1.0/go.mod h1:Vl4pt9jiHKvOgF9KoZo6Kob9oV4lwd/ZD5Cto54zDRw= cloud.google.com/go/talent v1.2.0/go.mod h1:MoNF9bhFQbiJ6eFD3uSsg0uBALw4n4gaCaEjBw9zo8g= cloud.google.com/go/videointelligence v1.6.0/go.mod h1:w0DIDlVRKtwPCn/C4iwZIJdvC69yInhW0cfi+p546uU= @@ -186,22 +199,26 @@ cloud.google.com/go/workflows v1.6.0/go.mod h1:6t9F5h/unJz41YqfBmqSASJSXccBLtD1V cloud.google.com/go/workflows v1.7.0/go.mod h1:JhSrZuVZWuiDfKEFxU0/F1PQjmpnpcoISEXH2bcHC3M= cosmossdk.io/api v0.3.1 h1:NNiOclKRR0AOlO4KIqeaG6PS6kswOMhHD0ir0SscNXE= cosmossdk.io/api v0.3.1/go.mod h1:DfHfMkiNA2Uhy8fj0JJlOCYOBp4eWUUJ1te5zBGNyIw= +cosmossdk.io/api v0.7.5/go.mod h1:IcxpYS5fMemZGqyYtErK7OqvdM0C8kdW3dq8Q/XIG38= cosmossdk.io/core v0.6.1 h1:OBy7TI2W+/gyn2z40vVvruK3di+cAluinA6cybFbE7s= cosmossdk.io/core v0.6.1/go.mod h1:g3MMBCBXtxbDWBURDVnJE7XML4BG5qENhs0gzkcpuFA= +cosmossdk.io/core v0.11.1/go.mod h1:OJzxcdC+RPrgGF8NJZR2uoQr56tc7gfBKhiKeDO7hH0= +cosmossdk.io/core v0.12.0/go.mod h1:LaTtayWBSoacF5xNzoF8tmLhehqlA9z1SWiPuNC6X1w= cosmossdk.io/depinject v1.0.0-alpha.4 h1:PLNp8ZYAMPTUKyG9IK2hsbciDWqna2z1Wsl98okJopc= cosmossdk.io/depinject v1.0.0-alpha.4/go.mod h1:HeDk7IkR5ckZ3lMGs/o91AVUc7E596vMaOmslGFM3yU= +cosmossdk.io/depinject v1.0.0/go.mod h1:zxK/h3HgHoA/eJVtiSsoaRaRA2D5U4cJ5thIG4ssbB8= cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= cosmossdk.io/log v1.3.1 h1:UZx8nWIkfbbNEWusZqzAx3ZGvu54TZacWib3EzUYmGI= cosmossdk.io/log v1.3.1/go.mod h1:2/dIomt8mKdk6vl3OWJcPk2be3pGOS8OQaLUM/3/tCM= +cosmossdk.io/log v1.4.1/go.mod h1:k08v0Pyq+gCP6phvdI6RCGhLf/r425UT6Rk/m+o74rU= cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= cosmossdk.io/simapp v0.0.0-20231127212628-044ff4d8c015 h1:ARUqouMWNreV8e5wxPberry+tm+Uk+1eeJDt3KXQEn0= cosmossdk.io/simapp v0.0.0-20231127212628-044ff4d8c015/go.mod h1:VNknW36ZIgwkjKtb6eyA4RZ7x9+ZpKMVCsAUA6bFWnk= -cosmossdk.io/tools/rosetta v0.2.1 h1:ddOMatOH+pbxWbrGJKRAawdBkPYLfKXutK9IETnjYxw= -cosmossdk.io/tools/rosetta v0.2.1/go.mod h1:Pqdc1FdvkNV3LcNIkYWt2RQY6IP1ge6YWZk8MhhO9Hw= filippo.io/edwards25519 v1.0.0 h1:0wAIcmJUqRdI8IJ/3eGi5/HwXZWPujYXXlkrQogz0Ek= filippo.io/edwards25519 v1.0.0/go.mod h1:N1IkdkCkiLB6tki+MYJoSx2JTY9NUlxZE7eHn5EwJns= +filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 h1:/vQbFIOMbk2FiG/kXiLl8BRyzTWDw7gX/Hz7Dd5eDMs= github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4/go.mod h1:hN7oaIRCjzsZ2dE+yG5k+rsdt3qcwykqK6HVGcKwsw4= github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 h1:UQHMgLO+TxOElx5B5HZ4hJQsoJ/PvUvKRhJHDQXO8P8= @@ -266,6 +283,8 @@ github.com/aws/aws-sdk-go v1.27.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN github.com/aws/aws-sdk-go v1.44.122/go.mod h1:y4AeaBuwd2Lk+GepC1E9v0qOiTws0MIWAX4oIKwKHZo= github.com/aws/aws-sdk-go v1.44.203 h1:pcsP805b9acL3wUqa4JR2vg1k2wnItkDYNvfmcy6F+U= github.com/aws/aws-sdk-go v1.44.203/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI= +github.com/aws/aws-sdk-go v1.44.224/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI= +github.com/aws/aws-sdk-go v1.55.5/go.mod h1:eRwEWoyTWFMVYVQzKMNHWP5/RV4xIUGMQfXQHfHkpNU= github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g= github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= @@ -277,19 +296,23 @@ github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d/go.mod h1:6QX/PXZ github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 h1:41iFGWnSlI2gVpmOtVTJZNodLdLQLn/KsJqFvXwnd/s= github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= +github.com/bgentry/speakeasy v0.2.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= github.com/btcsuite/btcd v0.22.0-beta.0.20220111032746-97732e52810c/go.mod h1:tjmYdS6MLJ5/s0Fj4DbLgSbDHbEqLJrtnHecBFkdz5M= github.com/btcsuite/btcd v0.23.5-0.20231215221805-96c9fd8078fd/go.mod h1:nm3Bko6zh6bWP60UxwoT5LzdGJsQJaPo6HjduXq9p6A= github.com/btcsuite/btcd v0.24.0 h1:gL3uHE/IaFj6fcZSu03SvqPMSx7s/dPzfpG/atRwWdo= github.com/btcsuite/btcd v0.24.0/go.mod h1:K4IDc1593s8jKXIF7yS7yCTSxrknB9z0STzc2j6XgE4= +github.com/btcsuite/btcd v0.24.2/go.mod h1:5C8ChTkl5ejr3WHj8tkQSCmydiMEPB0ZhQhehpq7Dgg= github.com/btcsuite/btcd/btcec/v2 v2.1.0/go.mod h1:2VzYrv4Gm4apmbVVsSq5bqf1Ec8v56E48Vt0Y/umPgA= github.com/btcsuite/btcd/btcec/v2 v2.1.3/go.mod h1:ctjw4H1kknNJmRN4iP1R7bTQ+v3GJkZBd6mui8ZsAZE= github.com/btcsuite/btcd/btcec/v2 v2.3.2 h1:5n0X6hX0Zk+6omWcihdYvdAlGf2DfasC0GMf7DClJ3U= github.com/btcsuite/btcd/btcec/v2 v2.3.2/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04= +github.com/btcsuite/btcd/btcec/v2 v2.3.4/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04= github.com/btcsuite/btcd/btcutil v1.0.0/go.mod h1:Uoxwv0pqYWhD//tfTiipkxNfdhG9UrLwaeswfjfdF0A= github.com/btcsuite/btcd/btcutil v1.1.0/go.mod h1:5OapHB7A2hBBWLm48mmw4MOHNJCcUBTwmWH/0Jn8VHE= github.com/btcsuite/btcd/btcutil v1.1.5 h1:+wER79R5670vs/ZusMTF1yTcRYE5GUsFbdjdisflzM8= github.com/btcsuite/btcd/btcutil v1.1.5/go.mod h1:PSZZ4UitpLBWzxGd5VGOrLnmOjtPP/a6HaFo12zMs00= +github.com/btcsuite/btcd/btcutil v1.1.6/go.mod h1:9dFymx8HpuLqBnsPELrImQeTQfKBQqzqGbbV3jK55aE= github.com/btcsuite/btcd/chaincfg/chainhash v1.0.0/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0 h1:59Kx4K6lzOW5w6nFlA0v5+lk/6sjybR934QNHSJZPTQ= @@ -313,6 +336,7 @@ github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QH github.com/cenkalti/backoff/v4 v4.1.1/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= github.com/cenkalti/backoff/v4 v4.1.3 h1:cFAlzYUlVYDysBEH2T5hyJZMh3+5+WCBvSnK6Q8UtC4= github.com/cenkalti/backoff/v4 v4.1.3/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= +github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/cp v0.1.0 h1:SE+dxFebS7Iik5LK0tsi1k9ZCxEaFX4AjQmoyA+1dJk= github.com/cespare/cp v0.1.0/go.mod h1:SOGHArjBr4JWaSDEVpWpo/hNg6RoKrls6Oh40hiwW+s= @@ -356,10 +380,12 @@ github.com/cockroachdb/datadriven v1.0.3-0.20230413201302-be42291fc80f h1:otljaY github.com/cockroachdb/datadriven v1.0.3-0.20230413201302-be42291fc80f/go.mod h1:a9RdTaap04u637JoCzcUoIcDmvwSUtcUFtT/C3kJlTU= github.com/cockroachdb/errors v1.11.1 h1:xSEW75zKaKCWzR3OfxXUxgrk/NtT4G1MiOv5lWZazG8= github.com/cockroachdb/errors v1.11.1/go.mod h1:8MUxA3Gi6b25tYlFEBGLf+D8aISL+M4MIpiWMSNRfxw= +github.com/cockroachdb/errors v1.11.3/go.mod h1:m4UIW4CDjx+R5cybPsNrRbreomiFqt8o1h1wUVazSd8= github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b h1:r6VH0faHjZeQy818SGhaone5OnYfxFR/+AzdY3sf5aE= github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b/go.mod h1:Vz9DsVWQQhf3vs21MhPMZpMGSht7O/2vFW2xusFUVOs= github.com/cockroachdb/pebble v1.1.0 h1:pcFh8CdCIt2kmEpK0OIatq67Ln9uGDYY3d5XnE0LJG4= github.com/cockroachdb/pebble v1.1.0/go.mod h1:sEHm5NOXxyiAoKWhoFxT8xMgd/f3RA6qUqQ1BXKrh2E= +github.com/cockroachdb/pebble v1.1.1/go.mod h1:4exszw1r40423ZsmkG/09AFEG83I0uDgfujJdbL6kYU= github.com/cockroachdb/redact v1.1.5 h1:u1PMllDkdFfPWaNGMyLD1+so+aq3uUItthCFqzwPJ30= github.com/cockroachdb/redact v1.1.5/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg= github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 h1:zuQyyAKVxetITBuuhv3BI9cMrmStnpT18zmgmTxunpo= @@ -391,16 +417,19 @@ github.com/cosmos/gogogateway v1.2.0/go.mod h1:iQpLkGWxYcnCdz5iAdLcRBSw3h7NXeOkZ github.com/cosmos/gogoproto v1.4.2/go.mod h1:cLxOsn1ljAHSV527CHOtaIP91kK6cCrZETRBrkzItWU= github.com/cosmos/gogoproto v1.4.10 h1:QH/yT8X+c0F4ZDacDv3z+xE3WU1P1Z3wQoLMBRJoKuI= github.com/cosmos/gogoproto v1.4.10/go.mod h1:3aAZzeRWpAwr+SS/LLkICX2/kDFyaYVzckBDzygIxek= +github.com/cosmos/gogoproto v1.7.0/go.mod h1:yWChEv5IUEYURQasfyBW5ffkMHR/90hiHgbNgrtp4j0= github.com/cosmos/iavl v1.2.0 h1:kVxTmjTh4k0Dh1VNL046v6BXqKziqMDzxo93oh3kOfM= github.com/cosmos/iavl v1.2.0/go.mod h1:HidWWLVAtODJqFD6Hbne2Y0q3SdxByJepHUOeoH4LiI= github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7 v7.1.3 h1:MZGDMETv72suFpTAD6VPGqSIm1FJcChtk2HmVh9D+Bo= github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7 v7.1.3/go.mod h1:UvDmcGIWJPIytq+Q78/ff5NTOsuX/7IrNgEugTW5i0s= github.com/cosmos/ibc-go/modules/capability v1.0.0-rc1 h1:BvSKnPFKxL+TTSLxGKwJN4x0ndCZj0yfXhSvmsQztSA= github.com/cosmos/ibc-go/modules/capability v1.0.0-rc1/go.mod h1:A+CxAQdn2j6ihDTbClpEEBdHthWgAUAcHbRAQPY8sl4= +github.com/cosmos/ibc-go/modules/capability v1.0.1/go.mod h1:rquyOV262nGJplkumH+/LeYs04P3eV8oB7ZM4Ygqk4E= github.com/cosmos/ibc-go/v7 v7.4.0 h1:8FqYMptvksgMvlbN4UW9jFxTXzsPyfAzEZurujXac8M= github.com/cosmos/ibc-go/v7 v7.4.0/go.mod h1:L/KaEhzV5TGUCTfGysVgMBQtl5Dm7hHitfpk+GIeoAo= github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= +github.com/cosmos/ics23/go v0.11.0/go.mod h1:A8OjxPE67hHST4Icw94hOxxFEJMBG031xIGF/JHNIY0= github.com/cosmos/interchain-security/v3 v3.1.1-0.20231102122221-81650a84f989 h1:Yk/2X33hHuS0mqjr4rE0ShiwPE/YflXgdyXPIYdwl+Q= github.com/cosmos/interchain-security/v3 v3.1.1-0.20231102122221-81650a84f989/go.mod h1:5B29fgUbUDTpBTqCnEzA2g3gI5rQG0YE/ir4isb2MEw= github.com/cosmos/keyring v1.2.0 h1:8C1lBP9xhImmIabyXW4c3vFjjLiBdGCmfLUfeZlV1Yo= @@ -414,12 +443,14 @@ github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwc github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/cpuguy83/go-md2man/v2 v2.0.3 h1:qMCsGGgs+MAzDFyp9LpAe1Lqy/fY/qCovCm0qnXZOBM= github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creachadair/taskgroup v0.4.2 h1:jsBLdAJE42asreGss2xZGZ8fJra7WtwnHWeJFxv2Li8= github.com/creachadair/taskgroup v0.4.2/go.mod h1:qiXUOSrbwAY3u0JPGTzObbE3yf9hcXHDKBZ2ZjpCbgM= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/danieljoos/wincred v1.1.2 h1:QLdCxFs1/Yl4zduvBdcHB8goaYk9RARS2SgLLRuAyr0= github.com/danieljoos/wincred v1.1.2/go.mod h1:GijpziifJoIBfYh+S7BbkdUTU4LfM+QnGqR5Vl2tAx0= +github.com/danieljoos/wincred v1.2.1/go.mod h1:uGaFL9fDn3OLTvzCGulzE+SzjEe5NGlh5FdCcyfPwps= github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -439,6 +470,7 @@ github.com/decred/dcrd/dcrec/secp256k1/v2 v2.0.1/go.mod h1:XmyzkaXBy7ZvHdrTAlXAj github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1/go.mod h1:hyedUtir6IdtD/7lIxGeCxkaw7y45JueMRL4DIyJDKs= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 h1:8UrgZ3GkP4i/CLijOJx79Yu+etlyjdBU4sfcs2WYQMs= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0= github.com/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218= github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f h1:U5y3Y5UE0w7amNe7Z5G/twsBW0KEalRQXZzf8ufSh9I= github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f/go.mod h1:xH/i4TFMt8koVQZ6WFms69WAsDWr2XsYL3Hkl7jkoLE= @@ -447,6 +479,7 @@ github.com/dgraph-io/badger/v2 v2.2007.4/go.mod h1:vSw/ax2qojzbN6eXHIx6KPKtCSHJN github.com/dgraph-io/ristretto v0.0.3-0.20200630154024-f66de99634de/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E= github.com/dgraph-io/ristretto v0.1.1 h1:6CWw5tJNgpegArSHpNHJKldNeq03FQCwYvfMVWajOK8= github.com/dgraph-io/ristretto v0.1.1/go.mod h1:S1GPSBCYCIhmVNfcth17y2zZtQT6wzkzgwUve0VDWWA= +github.com/dgraph-io/ristretto v0.1.2-0.20240116140435-c67e07994f91/go.mod h1:swkazRqnUf1N62d0Nutz7KIj2UKqsm/H8tD0nBJAXqM= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 h1:fAjc9m62+UWV/WAFKLNi6ZS0675eEUC9y3AlwSbQu1Y= @@ -537,6 +570,7 @@ github.com/go-logfmt/logfmt v0.6.0/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KE github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-ole/go-ole v1.2.5/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= @@ -582,6 +616,7 @@ github.com/golang-jwt/jwt/v4 v4.3.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzw github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/glog v1.2.0 h1:uCdmnmatrKCgMBlM4rMuJZWOkPDqdbZPnrMXDY4gI68= github.com/golang/glog v1.2.0/go.mod h1:6AhwSGph0fcJtXVM/PEHPqZlFeoLxhs7/t5UDAwmO+w= +github.com/golang/glog v1.2.2/go.mod h1:6AhwSGph0fcJtXVM/PEHPqZlFeoLxhs7/t5UDAwmO+w= github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -627,6 +662,7 @@ github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Z github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.1.2 h1:xf4v41cLI2Z6FxbKm+8Bu+m8ifhj15JuZ9sa0jZCMUU= github.com/google/btree v1.1.2/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl761Gm4= +github.com/google/btree v1.1.3/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl761Gm4= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= @@ -677,6 +713,7 @@ github.com/google/pprof v0.0.0-20230405160723-4a4c7d95572b/go.mod h1:79YE0hCXdHa github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/s2a-go v0.1.7 h1:60BLSyTrOV4/haCDW4zb1guZItoSq8foHCXrAnjBo/o= github.com/google/s2a-go v0.1.7/go.mod h1:50CgR4k1jNlWBu4UfS4AcfhVe1r6pdZPygJ3R8F0Qdw= +github.com/google/s2a-go v0.1.8/go.mod h1:6iNWHTpQ+nfNRN5E00MSdfDwVesa8hhS32PhPO8deJA= github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= @@ -698,19 +735,25 @@ github.com/googleapis/gax-go/v2 v2.5.1/go.mod h1:h6B0KMMFNtI2ddbGJn3T3ZbwkeT6yqE github.com/googleapis/gax-go/v2 v2.6.0/go.mod h1:1mjbznJAPHFpesgE5ucqfYEscaz5kMdcIDwU/6+DDoY= github.com/googleapis/gax-go/v2 v2.12.0 h1:A+gCJKdRfqXkr+BIRGtZLibNXf0m1f9E4HG56etFpas= github.com/googleapis/gax-go/v2 v2.12.0/go.mod h1:y+aIqrI5eb1YGMVJfuV3185Ts/D7qKpsEkdD5+I6QGU= +github.com/googleapis/gax-go/v2 v2.12.3/go.mod h1:AKloxT6GtNbaLm8QTNSidHUVsHYcBHwWRvkNFJUQcS4= +github.com/googleapis/gax-go/v2 v2.12.5/go.mod h1:BUDKcWo+RaKq5SC9vVYL0wLADa3VcfswbOMMRmB9H3E= +github.com/googleapis/gax-go/v2 v2.13.0/go.mod h1:Z/fvTZXF8/uw7Xu5GuslPw+bplx6SS338j1Is2S+B7A= github.com/googleapis/go-type-adapters v1.0.0/go.mod h1:zHW75FOG2aur7gAO2B+MLby+cLsWGBF62rFAi7WjWO4= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= github.com/gorilla/handlers v1.5.1 h1:9lRY6j8DEeeBT10CvO9hGW0gmky0BprnvDI5vfhUHH4= github.com/gorilla/handlers v1.5.1/go.mod h1:t8XrUpc4KVXb7HGyJ4/cEnwQiaxrX/hz1Zv/4g96P1Q= +github.com/gorilla/handlers v1.5.2/go.mod h1:dX+xVpaxdSw+q0Qek8SSsl3dfMk3jNddUkMzo0GtH0w= github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI= github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= +github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ= github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= github.com/grpc-ecosystem/go-grpc-middleware v1.2.2/go.mod h1:EaizFBKfUKtMIF5iaDEhniwNedqGo9FuLFzppDr3uwI= github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 h1:UH//fgunKIs4JdUbpDl1VZCDaL56wXCB/5+wF6uHfaI= @@ -737,6 +780,7 @@ github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9n github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= github.com/hashicorp/go-getter v1.7.5 h1:dT58k9hQ/vbxNMwoI5+xFYAJuv6152UNvdHokfI5wE4= github.com/hashicorp/go-getter v1.7.5/go.mod h1:W7TalhMmbPmsSMdNjD0ZskARur/9GJ17cfHTRtXV744= +github.com/hashicorp/go-getter v1.7.6/go.mod h1:W7TalhMmbPmsSMdNjD0ZskARur/9GJ17cfHTRtXV744= github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= github.com/hashicorp/go-immutable-radix v1.3.1 h1:DKHmCUm2hRBK510BaiZlwvpD40f8bJFeZnpfm2KLowc= github.com/hashicorp/go-immutable-radix v1.3.1/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= @@ -755,6 +799,7 @@ github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/b github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/go-version v1.6.0 h1:feTTfFNnjP967rlCxM/I9g701jU+RN74YKx2mOkIeek= github.com/hashicorp/go-version v1.6.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= +github.com/hashicorp/go-version v1.7.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= @@ -770,6 +815,7 @@ github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2p github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= github.com/hdevalence/ed25519consensus v0.1.0 h1:jtBwzzcHuTmFrQN6xQZn6CQEO/V9f7HsjsjeEZ6auqU= github.com/hdevalence/ed25519consensus v0.1.0/go.mod h1:w3BHWjwJbFU29IRHL1Iqkw3sus+7FctEyM4RqDxYNzo= +github.com/hdevalence/ed25519consensus v0.2.0/go.mod h1:w3BHWjwJbFU29IRHL1Iqkw3sus+7FctEyM4RqDxYNzo= github.com/holiman/bloomfilter/v2 v2.0.3 h1:73e0e/V0tCydx14a0SCYS/EWCxgwLZ18CZcZKVu0fao= github.com/holiman/bloomfilter/v2 v2.0.3/go.mod h1:zpoh+gs7qcpqrHr3dB55AMiJwo0iURXE7ZOP9L9hSkA= github.com/holiman/uint256 v1.2.4 h1:jUc4Nk8fm9jZabQuqr2JzednajVmBpC+oiTiXZJEApU= @@ -779,11 +825,13 @@ github.com/huandu/go-assert v1.1.5 h1:fjemmA7sSfYHJD7CUqs9qTwwfdNAx7/j2/ZlHXzNB3 github.com/huandu/go-assert v1.1.5/go.mod h1:yOLvuqZwmcHIC5rIzrBhT7D3Q9c3GFnd0JrPVhn/06U= github.com/huandu/skiplist v1.2.0 h1:gox56QD77HzSC0w+Ws3MH3iie755GBJU1OER3h5VsYw= github.com/huandu/skiplist v1.2.0/go.mod h1:7v3iFjLcSAzO4fN5B8dvebvo/qsfumiLiDXMrPiHF9w= +github.com/huandu/skiplist v1.2.1/go.mod h1:7v3iFjLcSAzO4fN5B8dvebvo/qsfumiLiDXMrPiHF9w= github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= github.com/huin/goupnp v1.3.0 h1:UvLUlWDNpoUdYzb2TCn+MuTWtcjXKSza2n6CBdQ0xXc= github.com/huin/goupnp v1.3.0/go.mod h1:gnGPsThkYa7bFi/KWmEysQRf48l2dvR5bxr2OFckNX8= github.com/iancoleman/orderedmap v0.2.0 h1:sq1N/TFpYH++aViPcaKjys3bDClUEU7s5B+z6jq8pNA= github.com/iancoleman/orderedmap v0.2.0/go.mod h1:N0Wam8K1arqPXNWjMo21EXnBPOPp36vB07FNRdD2geA= +github.com/iancoleman/orderedmap v0.3.0/go.mod h1:XuLcCUkdL5owUCQeF2Ue9uuw1EptkJDkXXS7VoV7XGE= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/icza/dyno v0.0.0-20220812133438-f0b6f8a18845 h1:H+uM0Bv88eur3ZSsd2NGKg3YIiuXxwxtlN7HjE66UTU= @@ -843,6 +891,7 @@ github.com/klauspost/compress v1.12.3/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8 github.com/klauspost/compress v1.15.11/go.mod h1:QPwzmACJjUTFsnSHH934V6woptycfrDDJnH7hvFVbGM= github.com/klauspost/compress v1.17.7 h1:ehO88t2UGzQK66LMdE8tibEd1ErmzZjNEqWkjLAKQQg= github.com/klauspost/compress v1.17.7/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= +github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= github.com/klauspost/cpuid/v2 v2.0.4/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= github.com/klauspost/cpuid/v2 v2.2.4 h1:acbojRNwl3o09bUq+yDCtZFc1aiwaAAxtcn8YkZXnvk= @@ -862,6 +911,7 @@ github.com/leodido/go-urn v1.2.1 h1:BqpAaACuzVSgi/VLzGZIobT2z4v53pjosyNd9Yv6n/w= github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY= github.com/lib/pq v1.10.7 h1:p7ZhMD+KsSRozJr34udlUrhboJwWAgCg34+/ZZNvZZw= github.com/lib/pq v1.10.7/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= +github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/libp2p/go-buffer-pool v0.1.0 h1:oK4mSFcQz7cTQIfqbe4MIj9gLW+mnanjyFtc6cdF0Y8= github.com/libp2p/go-buffer-pool v0.1.0/go.mod h1:N+vh8gMqimBzdKkSMVuydVDq+UV5QTWy5HSiZacSbPg= github.com/libp2p/go-libp2p v0.27.8 h1:IX5x/4yKwyPQeVS2AXHZ3J4YATM9oHBGH1gBc23jBAI= @@ -870,6 +920,8 @@ github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-b github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4= github.com/linxGnu/grocksdb v1.8.13 h1:X3Id7Obhf8qLY9WPc4LmmtIyabmdDf810XSFDnLlW7E= github.com/linxGnu/grocksdb v1.8.13/go.mod h1:QYiYypR2d4v63Wj1adOOfzglnoII0gLj3PNh4fZkcFA= +github.com/linxGnu/grocksdb v1.8.14/go.mod h1:QYiYypR2d4v63Wj1adOOfzglnoII0gLj3PNh4fZkcFA= +github.com/linxGnu/grocksdb v1.9.3/go.mod h1:QYiYypR2d4v63Wj1adOOfzglnoII0gLj3PNh4fZkcFA= github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= @@ -902,6 +954,7 @@ github.com/mimoo/StrobeGo v0.0.0-20220103164710-9a04d6ca976b h1:QrHweqAtyJ9EwCaG github.com/mimoo/StrobeGo v0.0.0-20220103164710-9a04d6ca976b/go.mod h1:xxLb2ip6sSUts3g1irPVHyk/DGslwQsNOo9I7smJfNU= github.com/minio/highwayhash v1.0.2 h1:Aak5U0nElisjDCfPSG79Tgzkn2gl66NxOMspRrKnA/g= github.com/minio/highwayhash v1.0.2/go.mod h1:BQskDq+xkJ12lmlUUi7U0M5Swg3EWR+dLTk+kldvVxY= +github.com/minio/highwayhash v1.0.3/go.mod h1:GGYsuwP/fPD6Y9hMiXuapVvlIUEhFhMTh0rxU3ik1LQ= github.com/minio/sha256-simd v1.0.0 h1:v1ta+49hkWZyvaKwrQB8elexRqm6Y0aMLjCNsrYxo6g= github.com/minio/sha256-simd v1.0.0/go.mod h1:OuYzVNI5vcoYIAmbIvHPl3N3jUzVedXbKy5RFepssQM= github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= @@ -1016,10 +1069,13 @@ github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3v github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pelletier/go-toml/v2 v2.1.0 h1:FnwAJ4oYMvbT/34k9zzHuZNrhlz48GB3/s6at6/MHO4= github.com/pelletier/go-toml/v2 v2.1.0/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc= +github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs= +github.com/pelletier/go-toml/v2 v2.2.3/go.mod h1:MfCQTFTvCcUyyvvwm1+G6H/jORL20Xlb6rzQu9GuUkc= github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9iaPbIdPPGyKcA8hKdoy6hAWba7Yac= github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCrJTQWu0XVbaOlby/2lO20uSCHEMzzplHXte1o= github.com/petermattis/goid v0.0.0-20231207134359-e60b3f734c67 h1:jik8PHtAIsPlCRJjJzl4udgEf7hawInF9texMeO2jrU= github.com/petermattis/goid v0.0.0-20231207134359-e60b3f734c67/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4= +github.com/petermattis/goid v0.0.0-20240813172612-4fcff4a6cae7/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4= github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc= github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= github.com/pierrec/xxHash v0.1.5 h1:n/jBpwTHiER4xYvK3/CdPVnLDPchj8eTJFFLUb4QHBo= @@ -1044,6 +1100,8 @@ github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3O github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= github.com/prometheus/client_golang v1.17.0 h1:rl2sfwZMtSthVU752MqfjQozy7blglC+1SOtjMAMh+Q= github.com/prometheus/client_golang v1.17.0/go.mod h1:VeL+gMmOAxkS2IqfCq0ZmHSL+LjWfWDUmp1mBz9JgUY= +github.com/prometheus/client_golang v1.20.1/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= +github.com/prometheus/client_golang v1.20.4/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= @@ -1061,6 +1119,8 @@ github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB8 github.com/prometheus/common v0.15.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= github.com/prometheus/common v0.44.0 h1:+5BrQJwiBB9xsMygAB3TNvpQKOwlkc25LbISbrdOOfY= github.com/prometheus/common v0.44.0/go.mod h1:ofAIvZbQ1e/nugmZGz4/qCb9Ap1VoSTIO7x0VV9VvuY= +github.com/prometheus/common v0.55.0/go.mod h1:2SECS4xJG1kd8XF9IcM1gMX6510RAEL65zxzNImwdc8= +github.com/prometheus/common v0.60.0/go.mod h1:h0LYf1R1deLSKtD4Vdg8gy4RuOvENW2J/h19V5NADQw= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= @@ -1069,6 +1129,7 @@ github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4O github.com/prometheus/procfs v0.3.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= github.com/prometheus/procfs v0.13.0 h1:GqzLlQyfsPbaEHaQkO7tbDlriv/4o5Hudv6OXHGKX7o= github.com/prometheus/procfs v0.13.0/go.mod h1:cd4PFCR54QLnGKPaKGA6l+cfuNXtht43ZKY6tow0Y1g= +github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk= github.com/prometheus/tsdb v0.7.1 h1:YZcsG11NqnK4czYLrWd9mpEuAJIHVQLwdrleYfszMAA= github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= github.com/rakyll/statik v0.1.7 h1:OF3QCZUuyPxuGEP7B4ypUa7sB/iHtqOTDYZXGM8KOdQ= @@ -1095,9 +1156,11 @@ github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99 github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= github.com/rs/cors v1.8.3 h1:O+qNyWn7Z+F9M0ILBHgMVPuB1xTOucVd5gtaYyXBpRo= github.com/rs/cors v1.8.3/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= +github.com/rs/cors v1.11.1/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= github.com/rs/zerolog v1.32.0 h1:keLypqrlIjaFsbmJOBdB/qvyF8KEtCWHwobLp5l/mQ0= github.com/rs/zerolog v1.32.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss= +github.com/rs/zerolog v1.33.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= github.com/russross/blackfriday v1.6.0 h1:KqfZb0pUVN2lYqZUYRddxF4OR8ZMURnJIG5Y3VRLtww= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= @@ -1111,6 +1174,7 @@ github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWR github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E= github.com/sasha-s/go-deadlock v0.3.1 h1:sqv7fDNShgjcaxkO0JNcOAlr8B9+cV5Ey/OB71efZx0= github.com/sasha-s/go-deadlock v0.3.1/go.mod h1:F73l+cr82YSh10GxyRI6qZiCgK64VaZjwesgfQ1/iLM= +github.com/sasha-s/go-deadlock v0.3.5/go.mod h1:bugP6EGbdGYObIlx7pUZtWqlvo8k9H6vCBBsiChJQ5U= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible h1:Bn1aCHHRnjv4Bl16T8rcaFjYSrGrIZvpiGO6P3Q4GpU= github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= @@ -1136,10 +1200,12 @@ github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNo github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cast v1.6.0 h1:GEiTHELF+vaR5dhz3VqZfFSzZjYbgeKDpBxQVS4GYJ0= github.com/spf13/cast v1.6.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= +github.com/spf13/cast v1.7.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= github.com/spf13/cobra v1.8.0 h1:7aJaZx1B85qltLMc546zn58BxxfZdR/W22ej9CFoEf0= github.com/spf13/cobra v1.8.0/go.mod h1:WXLWApfZ71AjXPya3WOlMsY9yMs7YeiHhFVlvLyhcho= +github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y= github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= @@ -1148,6 +1214,7 @@ github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= github.com/spf13/viper v1.18.2 h1:LUXCnvUvSM6FXAsj6nnfc8Q2tp1dIgUfY9Kc8GsSOiQ= github.com/spf13/viper v1.18.2/go.mod h1:EKmWIqdnk5lOcmR72yw6hS+8OPYcwD0jteitLMVB+yk= +github.com/spf13/viper v1.19.0/go.mod h1:GQUN9bilAbhU/jgc1bKs99f/suXKeUMct8Adx5+Ntkg= github.com/status-im/keycard-go v0.2.0 h1:QDLFswOQu1r5jsycloeQh3bVU8n/NatHHaZobtDnDzA= github.com/status-im/keycard-go v0.2.0/go.mod h1:wlp8ZLbsmrF6g6WjugPAx+IzoLrkdf9+mHxBEeo3Hbg= github.com/strangelove-ventures/interchaintest/v7 v7.0.1-0.20240506191732-71a15c29f2b7 h1:7Qsz/NHs+FqDHvjHB3qLIMU7+/Z8vPI8ZJ2Q0p7x93U= @@ -1203,6 +1270,7 @@ github.com/ugorji/go/codec v1.2.7/go.mod h1:WGN1fab3R1fzQlVQTkfxVtIBhWDRqOviHU95 github.com/ulikunitz/xz v0.5.10/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= github.com/ulikunitz/xz v0.5.11 h1:kpFauv27b6ynzBNT/Xy+1k+fK4WswhN/6PN5WhFAGw8= github.com/ulikunitz/xz v0.5.11/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= +github.com/ulikunitz/xz v0.5.12/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= github.com/urfave/cli v1.22.1 h1:+mkCCcOFKPnCmVYVcURKps1Xe+3zP90gSYGNfRkjoIY= github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= @@ -1227,6 +1295,7 @@ github.com/zondax/ledger-go v0.14.3/go.mod h1:IKKaoxupuB43g4NxeQmbLXv7T9AlQyie1U go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/bbolt v1.3.8 h1:xs88BrvEv273UsB79e0hcVrlUWmS0a8upikMFhSyAtA= go.etcd.io/bbolt v1.3.8/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw= +go.etcd.io/bbolt v1.3.10/go.mod h1:bK3UQLPJZly7IlNmV7uVHJDxfe5aK9Ll93e/74Y9oEQ= go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mIZCrds/GIG4ncV9HhK5PX7jPg= go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= @@ -1241,16 +1310,24 @@ go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.47.0 h1:UNQQKPfTDe1J81ViolILjTKPr9WetKW6uei2hFgJmFs= go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.47.0/go.mod h1:r9vWsPS/3AQItv3OSlEJ/E4mbrhUbbw18meOjArPtKQ= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.49.0/go.mod h1:Mjt1i1INqiaoZOMGR1RIUJN+i3ChKoFRqzrRQhlkbs0= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.47.0 h1:sv9kVfal0MK0wBMCOGr+HeJm9v803BkJxGrk2au7j08= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.47.0/go.mod h1:SK2UL73Zy1quvRPonmOmRDiWk1KBV3LyIeeIxcEApWw= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0/go.mod h1:p8pYQP+m5XfbZm9fxtSKAbM6oIllS7s2AfxrChvc7iw= go.opentelemetry.io/otel v1.22.0 h1:xS7Ku+7yTFvDfDraDIJVpw7XPyuHlB9MCiqqX5mcJ6Y= go.opentelemetry.io/otel v1.22.0/go.mod h1:eoV4iAi3Ea8LkAEI9+GFT44O6T/D0GWAVFyZVCC6pMI= +go.opentelemetry.io/otel v1.24.0/go.mod h1:W7b9Ozg4nkF5tWI5zsXkaKKDjdVjpD4oAt9Qi/MArHo= +go.opentelemetry.io/otel v1.28.0/go.mod h1:q68ijF8Fc8CnMHKyzqL6akLO46ePnjkgfIMIjUIX9z4= go.opentelemetry.io/otel/metric v1.22.0 h1:lypMQnGyJYeuYPhOM/bgjbFM6WE44W1/T45er4d8Hhg= go.opentelemetry.io/otel/metric v1.22.0/go.mod h1:evJGjVpZv0mQ5QBRJoBF64yMuOf4xCWdXjK8pzFvliY= +go.opentelemetry.io/otel/metric v1.24.0/go.mod h1:VYhLe1rFfxuTXLgj4CBiyz+9WYBA8pNGJgDcSFRKBco= +go.opentelemetry.io/otel/metric v1.28.0/go.mod h1:Fb1eVBFZmLVTMb6PPohq3TO9IIhUisDsbJoL/+uQW4s= go.opentelemetry.io/otel/sdk v1.21.0 h1:FTt8qirL1EysG6sTQRZ5TokkU8d0ugCj8htOgThZXQ8= go.opentelemetry.io/otel/sdk v1.21.0/go.mod h1:Nna6Yv7PWTdgJHVRD9hIYywQBRx7pbox6nwBnZIxl/E= go.opentelemetry.io/otel/trace v1.22.0 h1:Hg6pPujv0XG9QaVbGOBVHunyuLcCC3jN7WEhPx83XD0= go.opentelemetry.io/otel/trace v1.22.0/go.mod h1:RbbHXVqKES9QhzZq/fE5UnOSILqRt40a21sPw2He1xo= +go.opentelemetry.io/otel/trace v1.24.0/go.mod h1:HPc3Xr/cOApsBI154IU0OI0HJexz+aw5uPdbs3UCjNU= +go.opentelemetry.io/otel/trace v1.28.0/go.mod h1:jPyXzNPg6da9+38HEwElrQiHlVMTnVfM3/yv2OlIHaI= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= @@ -1289,6 +1366,8 @@ golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5y golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= golang.org/x/crypto v0.22.0 h1:g1v0xeRhjcugydODzvb3mEM9SQ0HGp9s/nh3COQ/C30= golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M= +golang.org/x/crypto v0.26.0/go.mod h1:GY7jblb9wI+FOo5y8/S2oY4zWP07AkOJ4+jxCqdqn54= +golang.org/x/crypto v0.28.0/go.mod h1:rmgy+3RHxRZMyY0jjAJShp2zgEdOqj2AO7U0pYmeQ7U= golang.org/x/exp v0.0.0-20230711153332-06a737ee72cb h1:xIApU0ow1zwMa2uL1VDNeQlNVFTWMQxZUZCMDy0Q4Us= golang.org/x/exp v0.0.0-20230711153332-06a737ee72cb/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -1378,6 +1457,8 @@ golang.org/x/net v0.0.0-20221014081412-f15817d10f9b/go.mod h1:YDH+HFinaLZZlnHAfS golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w= golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8= +golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg= +golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -1405,6 +1486,8 @@ golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783/go.mod h1:h4gKUeWbJ4rQPri golang.org/x/oauth2 v0.1.0/go.mod h1:G9FE4dLTsbXUu90h/Pf85g4w1D+SSAgR+q46nJZ8M4A= golang.org/x/oauth2 v0.17.0 h1:6m3ZPmLEFdVxKKWnKq4VqZ60gutO35zm+zrAHVmHyDQ= golang.org/x/oauth2 v0.17.0/go.mod h1:OzPDGQiuQMguemayvdylqddI7qcD9lnSDb+1FiwQ5HA= +golang.org/x/oauth2 v0.21.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= +golang.org/x/oauth2 v0.23.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -1421,6 +1504,7 @@ golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20220929204114-8fcdb60fdcc0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -1523,11 +1607,16 @@ golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o= golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.19.0 h1:+ThwsDv+tYfnJFhF4L8jITxu1tdTWRTZpdsWgEgjL6Q= golang.org/x/term v0.19.0/go.mod h1:2CuTdWZ7KHSQwUzKva0cbMg6q2DMI3Mmxp+gKJbskEk= +golang.org/x/term v0.23.0/go.mod h1:DgV24QBUrK6jhZXl+20l6UWznPlwAHm1Q1mGHtydmSk= +golang.org/x/term v0.25.0/go.mod h1:RPyXicDX+6vLxogjjRxjgD2TKtmAO6NZBsBRfrOLu7M= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1541,12 +1630,15 @@ golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= +golang.org/x/time v0.6.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -1607,6 +1699,7 @@ golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc golang.org/x/tools v0.2.0/go.mod h1:y4OqIKeOV/fWJetJ8bXPU1sEVniLMIyDAZWeHdV+NTA= golang.org/x/tools v0.20.0 h1:hz/CVckiOxybQvFw6h7b/q80NTr9IUQb4s1IIzW7KNY= golang.org/x/tools v0.20.0/go.mod h1:WvitBU7JJf6A4jOdg4S1tviW9bhUxkgeCui/0JHctQg= +golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -1667,6 +1760,9 @@ google.golang.org/api v0.98.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ google.golang.org/api v0.100.0/go.mod h1:ZE3Z2+ZOr87Rx7dqFsdRQkRBk36kDtp/h+QpHbB7a70= google.golang.org/api v0.162.0 h1:Vhs54HkaEpkMBdgGdOT2P6F0csGG/vxDS0hWHJzmmps= google.golang.org/api v0.162.0/go.mod h1:6SulDkfoBIg4NFmCuZ39XeeAgSHCPecfSUuDyYlAHs0= +google.golang.org/api v0.171.0/go.mod h1:Hnq5AHm4OTMt2BUVjael2CWZFD6vksJdWCWiUAmjC9o= +google.golang.org/api v0.186.0/go.mod h1:hvRbBmgoje49RV3xqVXrmP6w93n6ehGgIVPYrGtBFFc= +google.golang.org/api v0.192.0/go.mod h1:9VcphjvAxPKLmSxVSzPlSRXy/5ARMEw5bf58WoVXafQ= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -1786,10 +1882,17 @@ google.golang.org/genproto v0.0.0-20221014213838-99cd37c6964a/go.mod h1:1vXfmgAz google.golang.org/genproto v0.0.0-20221025140454-527a21cfbd71/go.mod h1:9qHF0xnpdSfF6knlcsnpzUu5y+rpwgbvsyGAZPBMg4s= google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de h1:F6qOa9AZTYJXOUEr4jDysRDLrm4PHePlge4v4TGAlxY= google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de/go.mod h1:VUhTRKeHn9wwcdrk73nvdC9gF178Tzhmt/qyaFcPLSo= +google.golang.org/genproto v0.0.0-20240701130421-f6361c86f094/go.mod h1:Zs4wYw8z1zr6RNF4cwYb31mvN/EGaKAdQjNCF3DW6K4= +google.golang.org/genproto v0.0.0-20240814211410-ddb44dafa142/go.mod h1:G11eXq53iI5Q+kyNOmCvnzBaxEA2Q/Ik5Tj7nqBE8j4= google.golang.org/genproto/googleapis/api v0.0.0-20240227224415-6ceb2ff114de h1:jFNzHPIeuzhdRwVhbZdiym9q0ory/xY3sA+v2wPg8I0= google.golang.org/genproto/googleapis/api v0.0.0-20240227224415-6ceb2ff114de/go.mod h1:5iCWqnniDlqZHrd3neWVTOwvh/v6s3232omMecelax8= +google.golang.org/genproto/googleapis/api v0.0.0-20240318140521-94a12d6c2237/go.mod h1:Z5Iiy3jtmioajWHDGFk7CeugTyHtPvMHA4UTmUkyalE= +google.golang.org/genproto/googleapis/api v0.0.0-20240624140628-dc46fd24d27d/go.mod h1:Od4k8V1LQSizPRUK4OzZ7TBE/20k+jPczUDAEyvn69Y= +google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142/go.mod h1:d6be+8HhtEtucleCbxpPW9PA9XwISACu8nvpPqF0BVo= google.golang.org/genproto/googleapis/rpc v0.0.0-20240401170217-c3f982113cda h1:LI5DOvAxUPMv/50agcLLoo+AdWc1irS9Rzz4vPuD1V4= google.golang.org/genproto/googleapis/rpc v0.0.0-20240401170217-c3f982113cda/go.mod h1:WtryC6hu0hhx87FDGxWCDptyssuo68sk10vYjF+T9fY= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240709173604-40e1e62336c5/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240930140551-af27646dc61f/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.0/go.mod h1:chYK+tFQF0nDUGJgXMSgLCQk3phJEuONr2DCgLDdAQM= @@ -1833,6 +1936,8 @@ google.golang.org/grpc v1.50.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCD google.golang.org/grpc v1.50.1/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= google.golang.org/grpc v1.63.2 h1:MUeiw1B2maTVZthpU5xvASfTh3LDbxHd6IJ6QQVU+xM= google.golang.org/grpc v1.63.2/go.mod h1:WAX/8DgncnokcFUldAxq7GeB5DXHDbMF+lLvDomNkRA= +google.golang.org/grpc v1.64.1/go.mod h1:hiQF4LFZelK2WKaP6W0L92zGHtiQdZxk8CrSdvyjeP0= +google.golang.org/grpc v1.67.1/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= @@ -1851,6 +1956,8 @@ google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqw google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= +google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= @@ -1931,6 +2038,7 @@ modernc.org/z v1.7.3/go.mod h1:Ipv4tsdxZRbQyLq9Q1M6gdbkxYzdlrciF2Hi/lS7nWE= nhooyr.io/websocket v1.8.6/go.mod h1:B70DZP8IakI65RVQ51MsWP/8jndNma26DVA/nFSCgW0= nhooyr.io/websocket v1.8.7 h1:usjR2uOr/zjjkVMy0lW+PPohFok7PCow5sDjLgX4P4g= nhooyr.io/websocket v1.8.7/go.mod h1:B70DZP8IakI65RVQ51MsWP/8jndNma26DVA/nFSCgW0= +nhooyr.io/websocket v1.8.10/go.mod h1:rN9OFWIUwuxg4fR5tELlYC04bXYowCP9GX47ivo2l+c= pgregory.net/rapid v1.1.0 h1:CMa0sjHSru3puNx+J0MIAuiiEV4N0qj8/cMWGBBCsjw= pgregory.net/rapid v1.1.0/go.mod h1:PY5XlDGj0+V1FCq0o192FdRhpKHGTRIWBgqjDBTrq04= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= diff --git a/tests/e2e-ibc/main_test.go b/tests/e2e-ibc/main_test.go index 8d24769a36..a1d7afeff9 100644 --- a/tests/e2e-ibc/main_test.go +++ b/tests/e2e-ibc/main_test.go @@ -7,7 +7,7 @@ import ( "time" "cosmossdk.io/math" - transfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" + transfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/ethclient" diff --git a/tests/e2e/e2e_evm_contracts_test.go b/tests/e2e/e2e_evm_contracts_test.go index 404891a1c3..ce17690f0b 100644 --- a/tests/e2e/e2e_evm_contracts_test.go +++ b/tests/e2e/e2e_evm_contracts_test.go @@ -103,15 +103,15 @@ func (suite *IntegrationTestSuite) TestEip712BasicMessageAuthorization() { Denom: "ukava", }) suite.NoError(err) - suite.Equal(sdk.NewInt(1e3), balRes.Balance.Amount) + suite.Equal(sdkmath.NewInt(1e3), balRes.Balance.Amount) } // Note that this test works because the deployed erc20 is configured in evmutil & cdp params. // This test matches the webapp's "USDT Earn" workflow func (suite *IntegrationTestSuite) TestEip712ConvertToCoinAndDepositToLend() { // cdp requires minimum of $11 collateral - amount := sdk.NewInt(11e6) // 11 USDT - principal := sdk.NewCoin("usdx", sdk.NewInt(10e6)) + amount := sdkmath.NewInt(11e6) // 11 USDT + principal := sdk.NewCoin("usdx", sdkmath.NewInt(10e6)) sdkDenom := suite.DeployedErc20.CosmosDenom // create new funded account diff --git a/tests/e2e/e2e_min_fees_test.go b/tests/e2e/e2e_min_fees_test.go index 0ff51ce8a2..dc74e69ac7 100644 --- a/tests/e2e/e2e_min_fees_test.go +++ b/tests/e2e/e2e_min_fees_test.go @@ -46,7 +46,7 @@ func (suite *IntegrationTestSuite) TestEvmRespectsMinFee() { minGasPrice := minFees.AmountOf("akava").TruncateInt() // attempt tx with less than min gas price (min fee - 1) - tooLowGasPrice := minGasPrice.Sub(sdk.OneInt()).BigInt() + tooLowGasPrice := minGasPrice.Sub(sdkmath.OneInt()).BigInt() req := util.EvmTxRequest{ Tx: ethtypes.NewTransaction(0, randoReceiver, big.NewInt(5e2), 1e5, tooLowGasPrice, nil), Data: "this tx should fail because it's gas price is too low", diff --git a/tests/e2e/e2e_test.go b/tests/e2e/e2e_test.go index 63e63c467b..0a5ff45306 100644 --- a/tests/e2e/e2e_test.go +++ b/tests/e2e/e2e_test.go @@ -10,11 +10,11 @@ import ( "github.com/stretchr/testify/suite" sdkmath "cosmossdk.io/math" - "github.com/cosmos/cosmos-sdk/client/grpc/tmservice" + tmservice "github.com/cosmos/cosmos-sdk/client/grpc/cmtservice" sdk "github.com/cosmos/cosmos-sdk/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - ibctypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" - ibcclienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" + ibctypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" + ibcclienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" ethtypes "github.com/ethereum/go-ethereum/core/types" emtypes "github.com/evmos/ethermint/types" diff --git a/tests/e2e/runner/live.go b/tests/e2e/runner/live.go index ecefd7310f..952f26a928 100644 --- a/tests/e2e/runner/live.go +++ b/tests/e2e/runner/live.go @@ -4,7 +4,7 @@ import ( "context" "fmt" - "github.com/cosmos/cosmos-sdk/client/grpc/tmservice" + tmservice "github.com/cosmos/cosmos-sdk/client/grpc/cmtservice" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" "github.com/kava-labs/kava/client/grpc" diff --git a/tests/util/sdksigner.go b/tests/util/sdksigner.go index 9fdc59efe2..e8440db739 100644 --- a/tests/util/sdksigner.go +++ b/tests/util/sdksigner.go @@ -2,6 +2,7 @@ package util import ( "context" + "cosmossdk.io/api/cosmos/tx/signing/v1beta1" "errors" "fmt" "time" @@ -94,7 +95,7 @@ func (s *KavaSigner) pollAccountState() <-chan authtypes.AccountI { response, err := s.authClient.Account(context.Background(), &request) if err == nil { - var account authtypes.AccountI + var account sdk.AccountI err = s.encodingConfig.InterfaceRegistry.UnpackAny(response.Account, &account) if err == nil { @@ -400,7 +401,8 @@ func Sign( return txBuilder.GetTx(), nil, err } - signBytes, err := txConfig.SignModeHandler().GetSignBytes(signing.SignMode_SIGN_MODE_DIRECT, signerData, txBuilder.GetTx()) + // TEXTTUAL will use context for formatting the sign bytes, other just ignore context + signBytes, err := txConfig.SignModeHandler().GetSignBytes(context.Background(), signingv1beta1.SignMode(signing.SignMode_SIGN_MODE_DIRECT), signerData, txBuilder.GetTx()) if err != nil { return txBuilder.GetTx(), nil, err } diff --git a/third_party/proto/cosmos/base/snapshots/v1beta1/snapshot.proto b/third_party/proto/cosmos/base/snapshots/v1beta1/snapshot.proto index e8f9c2e654..72cfbd9327 100644 --- a/third_party/proto/cosmos/base/snapshots/v1beta1/snapshot.proto +++ b/third_party/proto/cosmos/base/snapshots/v1beta1/snapshot.proto @@ -3,7 +3,7 @@ package cosmos.base.snapshots.v1beta1; import "gogoproto/gogo.proto"; -option go_package = "github.com/cosmos/cosmos-sdk/snapshots/types"; +option go_package = "cosmossdk.io/store/snapshots/types"; // Snapshot contains Tendermint state sync snapshot info. message Snapshot { diff --git a/third_party/proto/cosmos/base/tendermint/v1beta1/query.proto b/third_party/proto/cosmos/base/tendermint/v1beta1/query.proto index 1f17b0a6a3..6de6f2cdbc 100644 --- a/third_party/proto/cosmos/base/tendermint/v1beta1/query.proto +++ b/third_party/proto/cosmos/base/tendermint/v1beta1/query.proto @@ -12,7 +12,7 @@ import "cosmos_proto/cosmos.proto"; import "tendermint/types/block.proto"; import "amino/amino.proto"; -option go_package = "github.com/cosmos/cosmos-sdk/client/grpc/tmservice"; +option go_package = "github.com/cosmos/cosmos-sdk/client/grpc/cmtservice"; // Service defines the gRPC querier service for tendermint queries. service Service { diff --git a/third_party/proto/cosmos/base/tendermint/v1beta1/types.proto b/third_party/proto/cosmos/base/tendermint/v1beta1/types.proto index 6506997bda..624ff41491 100644 --- a/third_party/proto/cosmos/base/tendermint/v1beta1/types.proto +++ b/third_party/proto/cosmos/base/tendermint/v1beta1/types.proto @@ -8,7 +8,7 @@ import "tendermint/version/types.proto"; import "google/protobuf/timestamp.proto"; import "amino/amino.proto"; -option go_package = "github.com/cosmos/cosmos-sdk/client/grpc/tmservice"; +option go_package = "github.com/cosmos/cosmos-sdk/client/grpc/cmtservice"; // Block is tendermint type Block, with the Header proposer address // field converted to bech32 string. diff --git a/third_party/proto/cosmos/distribution/v1beta1/distribution.proto b/third_party/proto/cosmos/distribution/v1beta1/distribution.proto index 226003dab4..3055becaf1 100644 --- a/third_party/proto/cosmos/distribution/v1beta1/distribution.proto +++ b/third_party/proto/cosmos/distribution/v1beta1/distribution.proto @@ -152,7 +152,7 @@ message CommunityPoolSpendProposal { // staking token, and the creation height (to check later on if any slashes have // occurred). NOTE: Even though validators are slashed to whole staking tokens, // the delegators within the validator may be left with less than a full token, -// thus sdk.Dec is used. +// thus sdkmath.LegacyDec is used. message DelegatorStartingInfo { uint64 previous_period = 1; string stake = 2 [ diff --git a/third_party/proto/cosmos/evidence/module/v1/module.proto b/third_party/proto/cosmos/evidence/module/v1/module.proto index fceea7da77..5b2ede6513 100644 --- a/third_party/proto/cosmos/evidence/module/v1/module.proto +++ b/third_party/proto/cosmos/evidence/module/v1/module.proto @@ -7,6 +7,6 @@ import "cosmos/app/v1alpha1/module.proto"; // Module is the config object of the evidence module. message Module { option (cosmos.app.v1alpha1.module) = { - go_import: "github.com/cosmos/cosmos-sdk/x/evidence" + go_import: "cosmossdk.io/x/evidence" }; } \ No newline at end of file diff --git a/third_party/proto/cosmos/evidence/v1beta1/evidence.proto b/third_party/proto/cosmos/evidence/v1beta1/evidence.proto index 8dca3201d0..154510e264 100644 --- a/third_party/proto/cosmos/evidence/v1beta1/evidence.proto +++ b/third_party/proto/cosmos/evidence/v1beta1/evidence.proto @@ -1,7 +1,7 @@ syntax = "proto3"; package cosmos.evidence.v1beta1; -option go_package = "github.com/cosmos/cosmos-sdk/x/evidence/types"; +option go_package = "cosmossdk.io/x/evidence/types"; option (gogoproto.equal_all) = true; import "amino/amino.proto"; diff --git a/third_party/proto/cosmos/evidence/v1beta1/genesis.proto b/third_party/proto/cosmos/evidence/v1beta1/genesis.proto index 199f446f7e..33b354e247 100644 --- a/third_party/proto/cosmos/evidence/v1beta1/genesis.proto +++ b/third_party/proto/cosmos/evidence/v1beta1/genesis.proto @@ -1,7 +1,7 @@ syntax = "proto3"; package cosmos.evidence.v1beta1; -option go_package = "github.com/cosmos/cosmos-sdk/x/evidence/types"; +option go_package = "cosmossdk.io/x/evidence/types"; import "google/protobuf/any.proto"; diff --git a/third_party/proto/cosmos/evidence/v1beta1/query.proto b/third_party/proto/cosmos/evidence/v1beta1/query.proto index 34163dd57f..4949c83246 100644 --- a/third_party/proto/cosmos/evidence/v1beta1/query.proto +++ b/third_party/proto/cosmos/evidence/v1beta1/query.proto @@ -6,7 +6,7 @@ import "gogoproto/gogo.proto"; import "google/protobuf/any.proto"; import "google/api/annotations.proto"; -option go_package = "github.com/cosmos/cosmos-sdk/x/evidence/types"; +option go_package = "cosmossdk.io/x/evidence/types"; // Query defines the gRPC querier service. service Query { diff --git a/third_party/proto/cosmos/evidence/v1beta1/tx.proto b/third_party/proto/cosmos/evidence/v1beta1/tx.proto index f5646e2dec..c0f80a9c6c 100644 --- a/third_party/proto/cosmos/evidence/v1beta1/tx.proto +++ b/third_party/proto/cosmos/evidence/v1beta1/tx.proto @@ -1,7 +1,7 @@ syntax = "proto3"; package cosmos.evidence.v1beta1; -option go_package = "github.com/cosmos/cosmos-sdk/x/evidence/types"; +option go_package = "cosmossdk.io/x/evidence/types"; option (gogoproto.equal_all) = true; import "gogoproto/gogo.proto"; diff --git a/third_party/proto/cosmos/upgrade/module/v1/module.proto b/third_party/proto/cosmos/upgrade/module/v1/module.proto index a4cf580886..6493f5c7ff 100644 --- a/third_party/proto/cosmos/upgrade/module/v1/module.proto +++ b/third_party/proto/cosmos/upgrade/module/v1/module.proto @@ -7,7 +7,7 @@ import "cosmos/app/v1alpha1/module.proto"; // Module is the config object of the upgrade module. message Module { option (cosmos.app.v1alpha1.module) = { - go_import: "github.com/cosmos/cosmos-sdk/x/upgrade" + go_import: "cosmossdk.io/x/upgrade" }; // authority defines the custom module authority. If not set, defaults to the governance module. diff --git a/third_party/proto/cosmos/upgrade/v1beta1/query.proto b/third_party/proto/cosmos/upgrade/v1beta1/query.proto index 870cf9ee6b..2b90a78888 100644 --- a/third_party/proto/cosmos/upgrade/v1beta1/query.proto +++ b/third_party/proto/cosmos/upgrade/v1beta1/query.proto @@ -4,7 +4,7 @@ package cosmos.upgrade.v1beta1; import "google/api/annotations.proto"; import "cosmos/upgrade/v1beta1/upgrade.proto"; -option go_package = "github.com/cosmos/cosmos-sdk/x/upgrade/types"; +option go_package = "cosmossdk.io/x/upgrade/types"; // Query defines the gRPC upgrade querier service. service Query { diff --git a/third_party/proto/cosmos/upgrade/v1beta1/tx.proto b/third_party/proto/cosmos/upgrade/v1beta1/tx.proto index 293bea0216..4a6c9ee11f 100644 --- a/third_party/proto/cosmos/upgrade/v1beta1/tx.proto +++ b/third_party/proto/cosmos/upgrade/v1beta1/tx.proto @@ -8,7 +8,7 @@ import "cosmos/upgrade/v1beta1/upgrade.proto"; import "cosmos/msg/v1/msg.proto"; import "amino/amino.proto"; -option go_package = "github.com/cosmos/cosmos-sdk/x/upgrade/types"; +option go_package = "cosmossdk.io/x/upgrade/types"; // Msg defines the upgrade Msg service. service Msg { diff --git a/third_party/proto/cosmos/upgrade/v1beta1/upgrade.proto b/third_party/proto/cosmos/upgrade/v1beta1/upgrade.proto index 0a96716856..88896732ef 100644 --- a/third_party/proto/cosmos/upgrade/v1beta1/upgrade.proto +++ b/third_party/proto/cosmos/upgrade/v1beta1/upgrade.proto @@ -7,7 +7,7 @@ import "google/protobuf/timestamp.proto"; import "cosmos_proto/cosmos.proto"; import "amino/amino.proto"; -option go_package = "github.com/cosmos/cosmos-sdk/x/upgrade/types"; +option go_package = "cosmossdk.io/x/upgrade/types"; option (gogoproto.goproto_getters_all) = false; // Plan specifies information about a planned upgrade and when it should occur. diff --git a/third_party/proto/ibc/applications/fee/v1/ack.proto b/third_party/proto/ibc/applications/fee/v1/ack.proto index ec1342bbf2..cc12f3b58f 100644 --- a/third_party/proto/ibc/applications/fee/v1/ack.proto +++ b/third_party/proto/ibc/applications/fee/v1/ack.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.applications.fee.v1; -option go_package = "github.com/cosmos/ibc-go/v7/modules/apps/29-fee/types"; +option go_package = "github.com/cosmos/ibc-go/v8/modules/apps/29-fee/types"; import "gogoproto/gogo.proto"; diff --git a/third_party/proto/ibc/applications/fee/v1/fee.proto b/third_party/proto/ibc/applications/fee/v1/fee.proto index 1a025ddca1..4ef626d415 100644 --- a/third_party/proto/ibc/applications/fee/v1/fee.proto +++ b/third_party/proto/ibc/applications/fee/v1/fee.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.applications.fee.v1; -option go_package = "github.com/cosmos/ibc-go/v7/modules/apps/29-fee/types"; +option go_package = "github.com/cosmos/ibc-go/v8/modules/apps/29-fee/types"; import "cosmos/base/v1beta1/coin.proto"; import "gogoproto/gogo.proto"; diff --git a/third_party/proto/ibc/applications/fee/v1/genesis.proto b/third_party/proto/ibc/applications/fee/v1/genesis.proto index 6bba6cff63..245525ca18 100644 --- a/third_party/proto/ibc/applications/fee/v1/genesis.proto +++ b/third_party/proto/ibc/applications/fee/v1/genesis.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.applications.fee.v1; -option go_package = "github.com/cosmos/ibc-go/v7/modules/apps/29-fee/types"; +option go_package = "github.com/cosmos/ibc-go/v8/modules/apps/29-fee/types"; import "gogoproto/gogo.proto"; import "ibc/applications/fee/v1/fee.proto"; diff --git a/third_party/proto/ibc/applications/fee/v1/metadata.proto b/third_party/proto/ibc/applications/fee/v1/metadata.proto index 0c0a72c9ca..8d9879f35f 100644 --- a/third_party/proto/ibc/applications/fee/v1/metadata.proto +++ b/third_party/proto/ibc/applications/fee/v1/metadata.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.applications.fee.v1; -option go_package = "github.com/cosmos/ibc-go/v7/modules/apps/29-fee/types"; +option go_package = "github.com/cosmos/ibc-go/v8/modules/apps/29-fee/types"; import "gogoproto/gogo.proto"; diff --git a/third_party/proto/ibc/applications/fee/v1/query.proto b/third_party/proto/ibc/applications/fee/v1/query.proto index 871cfdac70..7d54bcd018 100644 --- a/third_party/proto/ibc/applications/fee/v1/query.proto +++ b/third_party/proto/ibc/applications/fee/v1/query.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.applications.fee.v1; -option go_package = "github.com/cosmos/ibc-go/v7/modules/apps/29-fee/types"; +option go_package = "github.com/cosmos/ibc-go/v8/modules/apps/29-fee/types"; import "gogoproto/gogo.proto"; import "google/api/annotations.proto"; diff --git a/third_party/proto/ibc/applications/fee/v1/tx.proto b/third_party/proto/ibc/applications/fee/v1/tx.proto index 3a46de74eb..63e591617e 100644 --- a/third_party/proto/ibc/applications/fee/v1/tx.proto +++ b/third_party/proto/ibc/applications/fee/v1/tx.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.applications.fee.v1; -option go_package = "github.com/cosmos/ibc-go/v7/modules/apps/29-fee/types"; +option go_package = "github.com/cosmos/ibc-go/v8/modules/apps/29-fee/types"; import "gogoproto/gogo.proto"; import "ibc/applications/fee/v1/fee.proto"; diff --git a/third_party/proto/ibc/applications/interchain_accounts/controller/v1/controller.proto b/third_party/proto/ibc/applications/interchain_accounts/controller/v1/controller.proto index a505b4637e..0974b9d9b0 100644 --- a/third_party/proto/ibc/applications/interchain_accounts/controller/v1/controller.proto +++ b/third_party/proto/ibc/applications/interchain_accounts/controller/v1/controller.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.applications.interchain_accounts.controller.v1; -option go_package = "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/types"; +option go_package = "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller/types"; import "gogoproto/gogo.proto"; diff --git a/third_party/proto/ibc/applications/interchain_accounts/controller/v1/query.proto b/third_party/proto/ibc/applications/interchain_accounts/controller/v1/query.proto index 8c237a1525..3779ed3872 100644 --- a/third_party/proto/ibc/applications/interchain_accounts/controller/v1/query.proto +++ b/third_party/proto/ibc/applications/interchain_accounts/controller/v1/query.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.applications.interchain_accounts.controller.v1; -option go_package = "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/types"; +option go_package = "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller/types"; import "ibc/applications/interchain_accounts/controller/v1/controller.proto"; import "gogoproto/gogo.proto"; diff --git a/third_party/proto/ibc/applications/interchain_accounts/controller/v1/tx.proto b/third_party/proto/ibc/applications/interchain_accounts/controller/v1/tx.proto index 284ffe7057..11fb3cfdcf 100644 --- a/third_party/proto/ibc/applications/interchain_accounts/controller/v1/tx.proto +++ b/third_party/proto/ibc/applications/interchain_accounts/controller/v1/tx.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.applications.interchain_accounts.controller.v1; -option go_package = "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/types"; +option go_package = "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller/types"; import "gogoproto/gogo.proto"; import "ibc/applications/interchain_accounts/v1/packet.proto"; diff --git a/third_party/proto/ibc/applications/interchain_accounts/genesis/v1/genesis.proto b/third_party/proto/ibc/applications/interchain_accounts/genesis/v1/genesis.proto index 2fed3763ff..f0fd73ede2 100644 --- a/third_party/proto/ibc/applications/interchain_accounts/genesis/v1/genesis.proto +++ b/third_party/proto/ibc/applications/interchain_accounts/genesis/v1/genesis.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.applications.interchain_accounts.genesis.v1; -option go_package = "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/genesis/types"; +option go_package = "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/genesis/types"; import "gogoproto/gogo.proto"; import "ibc/applications/interchain_accounts/controller/v1/controller.proto"; diff --git a/third_party/proto/ibc/applications/interchain_accounts/host/v1/host.proto b/third_party/proto/ibc/applications/interchain_accounts/host/v1/host.proto index 18cc1d13da..2247e2fe0a 100644 --- a/third_party/proto/ibc/applications/interchain_accounts/host/v1/host.proto +++ b/third_party/proto/ibc/applications/interchain_accounts/host/v1/host.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.applications.interchain_accounts.host.v1; -option go_package = "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host/types"; +option go_package = "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/host/types"; import "gogoproto/gogo.proto"; diff --git a/third_party/proto/ibc/applications/interchain_accounts/host/v1/query.proto b/third_party/proto/ibc/applications/interchain_accounts/host/v1/query.proto index b89ed8ed87..6f206a14c8 100644 --- a/third_party/proto/ibc/applications/interchain_accounts/host/v1/query.proto +++ b/third_party/proto/ibc/applications/interchain_accounts/host/v1/query.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.applications.interchain_accounts.host.v1; -option go_package = "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host/types"; +option go_package = "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/host/types"; import "google/api/annotations.proto"; import "ibc/applications/interchain_accounts/host/v1/host.proto"; diff --git a/third_party/proto/ibc/applications/interchain_accounts/v1/account.proto b/third_party/proto/ibc/applications/interchain_accounts/v1/account.proto index d60c27a9c2..85d4e58287 100644 --- a/third_party/proto/ibc/applications/interchain_accounts/v1/account.proto +++ b/third_party/proto/ibc/applications/interchain_accounts/v1/account.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.applications.interchain_accounts.v1; -option go_package = "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/types"; +option go_package = "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/types"; import "cosmos_proto/cosmos.proto"; import "gogoproto/gogo.proto"; diff --git a/third_party/proto/ibc/applications/interchain_accounts/v1/metadata.proto b/third_party/proto/ibc/applications/interchain_accounts/v1/metadata.proto index 9ea7eeca33..5984ba4d69 100644 --- a/third_party/proto/ibc/applications/interchain_accounts/v1/metadata.proto +++ b/third_party/proto/ibc/applications/interchain_accounts/v1/metadata.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.applications.interchain_accounts.v1; -option go_package = "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/types"; +option go_package = "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/types"; import "gogoproto/gogo.proto"; diff --git a/third_party/proto/ibc/applications/interchain_accounts/v1/packet.proto b/third_party/proto/ibc/applications/interchain_accounts/v1/packet.proto index d2dcf518ea..f75a1463e9 100644 --- a/third_party/proto/ibc/applications/interchain_accounts/v1/packet.proto +++ b/third_party/proto/ibc/applications/interchain_accounts/v1/packet.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.applications.interchain_accounts.v1; -option go_package = "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/types"; +option go_package = "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/types"; import "google/protobuf/any.proto"; import "gogoproto/gogo.proto"; diff --git a/third_party/proto/ibc/applications/transfer/v1/authz.proto b/third_party/proto/ibc/applications/transfer/v1/authz.proto index 8b27ac9cf7..df1ee24ed4 100644 --- a/third_party/proto/ibc/applications/transfer/v1/authz.proto +++ b/third_party/proto/ibc/applications/transfer/v1/authz.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.applications.transfer.v1; -option go_package = "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types"; +option go_package = "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types"; import "cosmos_proto/cosmos.proto"; import "gogoproto/gogo.proto"; diff --git a/third_party/proto/ibc/applications/transfer/v1/genesis.proto b/third_party/proto/ibc/applications/transfer/v1/genesis.proto index b3f013e1ee..578c2242e8 100644 --- a/third_party/proto/ibc/applications/transfer/v1/genesis.proto +++ b/third_party/proto/ibc/applications/transfer/v1/genesis.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.applications.transfer.v1; -option go_package = "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types"; +option go_package = "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types"; import "ibc/applications/transfer/v1/transfer.proto"; import "cosmos/base/v1beta1/coin.proto"; diff --git a/third_party/proto/ibc/applications/transfer/v1/query.proto b/third_party/proto/ibc/applications/transfer/v1/query.proto index 66670407a2..788296718f 100644 --- a/third_party/proto/ibc/applications/transfer/v1/query.proto +++ b/third_party/proto/ibc/applications/transfer/v1/query.proto @@ -8,7 +8,7 @@ import "cosmos/base/query/v1beta1/pagination.proto"; import "ibc/applications/transfer/v1/transfer.proto"; import "google/api/annotations.proto"; -option go_package = "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types"; +option go_package = "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types"; // Query provides defines the gRPC querier service. service Query { diff --git a/third_party/proto/ibc/applications/transfer/v1/transfer.proto b/third_party/proto/ibc/applications/transfer/v1/transfer.proto index 2171074799..0c13a48ce9 100644 --- a/third_party/proto/ibc/applications/transfer/v1/transfer.proto +++ b/third_party/proto/ibc/applications/transfer/v1/transfer.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.applications.transfer.v1; -option go_package = "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types"; +option go_package = "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types"; import "gogoproto/gogo.proto"; diff --git a/third_party/proto/ibc/applications/transfer/v1/tx.proto b/third_party/proto/ibc/applications/transfer/v1/tx.proto index 1c67aafb93..02466eab7b 100644 --- a/third_party/proto/ibc/applications/transfer/v1/tx.proto +++ b/third_party/proto/ibc/applications/transfer/v1/tx.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.applications.transfer.v1; -option go_package = "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types"; +option go_package = "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types"; import "gogoproto/gogo.proto"; import "cosmos/base/v1beta1/coin.proto"; diff --git a/third_party/proto/ibc/applications/transfer/v2/packet.proto b/third_party/proto/ibc/applications/transfer/v2/packet.proto index 7dc31347af..bff35bdd6d 100644 --- a/third_party/proto/ibc/applications/transfer/v2/packet.proto +++ b/third_party/proto/ibc/applications/transfer/v2/packet.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.applications.transfer.v2; -option go_package = "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types"; +option go_package = "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types"; // FungibleTokenPacketData defines a struct for the packet payload // See FungibleTokenPacketData spec: diff --git a/third_party/proto/ibc/core/channel/v1/channel.proto b/third_party/proto/ibc/core/channel/v1/channel.proto index 5fbb0d423f..eb073fd18b 100644 --- a/third_party/proto/ibc/core/channel/v1/channel.proto +++ b/third_party/proto/ibc/core/channel/v1/channel.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.core.channel.v1; -option go_package = "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types"; +option go_package = "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types"; import "gogoproto/gogo.proto"; import "ibc/core/client/v1/client.proto"; diff --git a/third_party/proto/ibc/core/channel/v1/genesis.proto b/third_party/proto/ibc/core/channel/v1/genesis.proto index 65cc928aa2..813e98f366 100644 --- a/third_party/proto/ibc/core/channel/v1/genesis.proto +++ b/third_party/proto/ibc/core/channel/v1/genesis.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.core.channel.v1; -option go_package = "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types"; +option go_package = "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types"; import "gogoproto/gogo.proto"; import "ibc/core/channel/v1/channel.proto"; diff --git a/third_party/proto/ibc/core/channel/v1/query.proto b/third_party/proto/ibc/core/channel/v1/query.proto index 2d5bdb2fc8..0170a2aaca 100644 --- a/third_party/proto/ibc/core/channel/v1/query.proto +++ b/third_party/proto/ibc/core/channel/v1/query.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.core.channel.v1; -option go_package = "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types"; +option go_package = "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types"; import "ibc/core/client/v1/client.proto"; import "cosmos/base/query/v1beta1/pagination.proto"; diff --git a/third_party/proto/ibc/core/channel/v1/tx.proto b/third_party/proto/ibc/core/channel/v1/tx.proto index a67a375559..d0918eaffe 100644 --- a/third_party/proto/ibc/core/channel/v1/tx.proto +++ b/third_party/proto/ibc/core/channel/v1/tx.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.core.channel.v1; -option go_package = "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types"; +option go_package = "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types"; import "gogoproto/gogo.proto"; import "ibc/core/client/v1/client.proto"; diff --git a/third_party/proto/ibc/core/client/v1/client.proto b/third_party/proto/ibc/core/client/v1/client.proto index 15b47e5554..b9f6b1ca1f 100644 --- a/third_party/proto/ibc/core/client/v1/client.proto +++ b/third_party/proto/ibc/core/client/v1/client.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.core.client.v1; -option go_package = "github.com/cosmos/ibc-go/v7/modules/core/02-client/types"; +option go_package = "github.com/cosmos/ibc-go/v8/modules/core/02-client/types"; import "gogoproto/gogo.proto"; import "google/protobuf/any.proto"; diff --git a/third_party/proto/ibc/core/client/v1/genesis.proto b/third_party/proto/ibc/core/client/v1/genesis.proto index 7882124416..b09ff1eaf2 100644 --- a/third_party/proto/ibc/core/client/v1/genesis.proto +++ b/third_party/proto/ibc/core/client/v1/genesis.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.core.client.v1; -option go_package = "github.com/cosmos/ibc-go/v7/modules/core/02-client/types"; +option go_package = "github.com/cosmos/ibc-go/v8/modules/core/02-client/types"; import "ibc/core/client/v1/client.proto"; import "gogoproto/gogo.proto"; diff --git a/third_party/proto/ibc/core/client/v1/query.proto b/third_party/proto/ibc/core/client/v1/query.proto index 0d26cf62e6..0032306ec9 100644 --- a/third_party/proto/ibc/core/client/v1/query.proto +++ b/third_party/proto/ibc/core/client/v1/query.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.core.client.v1; -option go_package = "github.com/cosmos/ibc-go/v7/modules/core/02-client/types"; +option go_package = "github.com/cosmos/ibc-go/v8/modules/core/02-client/types"; import "cosmos/base/query/v1beta1/pagination.proto"; import "ibc/core/client/v1/client.proto"; diff --git a/third_party/proto/ibc/core/client/v1/tx.proto b/third_party/proto/ibc/core/client/v1/tx.proto index 23302d5e3a..752718c112 100644 --- a/third_party/proto/ibc/core/client/v1/tx.proto +++ b/third_party/proto/ibc/core/client/v1/tx.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.core.client.v1; -option go_package = "github.com/cosmos/ibc-go/v7/modules/core/02-client/types"; +option go_package = "github.com/cosmos/ibc-go/v8/modules/core/02-client/types"; import "gogoproto/gogo.proto"; import "google/protobuf/any.proto"; diff --git a/third_party/proto/ibc/core/commitment/v1/commitment.proto b/third_party/proto/ibc/core/commitment/v1/commitment.proto index 4840ff3e06..60abc5d1c2 100644 --- a/third_party/proto/ibc/core/commitment/v1/commitment.proto +++ b/third_party/proto/ibc/core/commitment/v1/commitment.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.core.commitment.v1; -option go_package = "github.com/cosmos/ibc-go/v7/modules/core/23-commitment/types"; +option go_package = "github.com/cosmos/ibc-go/v8/modules/core/23-commitment/types"; import "gogoproto/gogo.proto"; import "cosmos/ics23/v1/proofs.proto"; diff --git a/third_party/proto/ibc/core/connection/v1/connection.proto b/third_party/proto/ibc/core/connection/v1/connection.proto index ba367c14d2..2cec817a0f 100644 --- a/third_party/proto/ibc/core/connection/v1/connection.proto +++ b/third_party/proto/ibc/core/connection/v1/connection.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.core.connection.v1; -option go_package = "github.com/cosmos/ibc-go/v7/modules/core/03-connection/types"; +option go_package = "github.com/cosmos/ibc-go/v8/modules/core/03-connection/types"; import "gogoproto/gogo.proto"; import "ibc/core/commitment/v1/commitment.proto"; diff --git a/third_party/proto/ibc/core/connection/v1/genesis.proto b/third_party/proto/ibc/core/connection/v1/genesis.proto index 122c5a4652..830bbe1387 100644 --- a/third_party/proto/ibc/core/connection/v1/genesis.proto +++ b/third_party/proto/ibc/core/connection/v1/genesis.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.core.connection.v1; -option go_package = "github.com/cosmos/ibc-go/v7/modules/core/03-connection/types"; +option go_package = "github.com/cosmos/ibc-go/v8/modules/core/03-connection/types"; import "gogoproto/gogo.proto"; import "ibc/core/connection/v1/connection.proto"; diff --git a/third_party/proto/ibc/core/connection/v1/query.proto b/third_party/proto/ibc/core/connection/v1/query.proto index 3c76b23891..d1e120c922 100644 --- a/third_party/proto/ibc/core/connection/v1/query.proto +++ b/third_party/proto/ibc/core/connection/v1/query.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.core.connection.v1; -option go_package = "github.com/cosmos/ibc-go/v7/modules/core/03-connection/types"; +option go_package = "github.com/cosmos/ibc-go/v8/modules/core/03-connection/types"; import "gogoproto/gogo.proto"; import "cosmos/base/query/v1beta1/pagination.proto"; diff --git a/third_party/proto/ibc/core/connection/v1/tx.proto b/third_party/proto/ibc/core/connection/v1/tx.proto index af8f505c46..d2ef2b9140 100644 --- a/third_party/proto/ibc/core/connection/v1/tx.proto +++ b/third_party/proto/ibc/core/connection/v1/tx.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.core.connection.v1; -option go_package = "github.com/cosmos/ibc-go/v7/modules/core/03-connection/types"; +option go_package = "github.com/cosmos/ibc-go/v8/modules/core/03-connection/types"; import "gogoproto/gogo.proto"; import "google/protobuf/any.proto"; diff --git a/third_party/proto/ibc/core/types/v1/genesis.proto b/third_party/proto/ibc/core/types/v1/genesis.proto index 4e07551f82..51c2279167 100644 --- a/third_party/proto/ibc/core/types/v1/genesis.proto +++ b/third_party/proto/ibc/core/types/v1/genesis.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.core.types.v1; -option go_package = "github.com/cosmos/ibc-go/v7/modules/core/types"; +option go_package = "github.com/cosmos/ibc-go/v8/modules/core/types"; import "gogoproto/gogo.proto"; import "ibc/core/client/v1/genesis.proto"; diff --git a/third_party/proto/ibc/lightclients/localhost/v2/localhost.proto b/third_party/proto/ibc/lightclients/localhost/v2/localhost.proto index ec970eb000..635db85214 100644 --- a/third_party/proto/ibc/lightclients/localhost/v2/localhost.proto +++ b/third_party/proto/ibc/lightclients/localhost/v2/localhost.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.lightclients.localhost.v2; -option go_package = "github.com/cosmos/ibc-go/v7/modules/light-clients/09-localhost;localhost"; +option go_package = "github.com/cosmos/ibc-go/v8/modules/light-clients/09-localhost;localhost"; import "ibc/core/client/v1/client.proto"; import "gogoproto/gogo.proto"; diff --git a/third_party/proto/ibc/lightclients/solomachine/v2/solomachine.proto b/third_party/proto/ibc/lightclients/solomachine/v2/solomachine.proto index 250313319b..fb2f076a47 100644 --- a/third_party/proto/ibc/lightclients/solomachine/v2/solomachine.proto +++ b/third_party/proto/ibc/lightclients/solomachine/v2/solomachine.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.lightclients.solomachine.v2; -option go_package = "github.com/cosmos/ibc-go/v7/modules/core/02-client/migrations/v7"; +option go_package = "github.com/cosmos/ibc-go/v8/modules/core/02-client/migrations/v7"; import "ibc/core/connection/v1/connection.proto"; import "ibc/core/channel/v1/channel.proto"; diff --git a/third_party/proto/ibc/lightclients/solomachine/v3/solomachine.proto b/third_party/proto/ibc/lightclients/solomachine/v3/solomachine.proto index 40e76b722e..38f9328c7c 100644 --- a/third_party/proto/ibc/lightclients/solomachine/v3/solomachine.proto +++ b/third_party/proto/ibc/lightclients/solomachine/v3/solomachine.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.lightclients.solomachine.v3; -option go_package = "github.com/cosmos/ibc-go/v7/modules/light-clients/06-solomachine;solomachine"; +option go_package = "github.com/cosmos/ibc-go/v8/modules/light-clients/06-solomachine;solomachine"; import "gogoproto/gogo.proto"; import "google/protobuf/any.proto"; diff --git a/third_party/proto/ibc/lightclients/tendermint/v1/tendermint.proto b/third_party/proto/ibc/lightclients/tendermint/v1/tendermint.proto index 83fa59c9fa..bb21775dc8 100644 --- a/third_party/proto/ibc/lightclients/tendermint/v1/tendermint.proto +++ b/third_party/proto/ibc/lightclients/tendermint/v1/tendermint.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.lightclients.tendermint.v1; -option go_package = "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint;tendermint"; +option go_package = "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint;tendermint"; import "tendermint/types/validator.proto"; import "tendermint/types/types.proto"; diff --git a/x/auction/genesis.go b/x/auction/genesis.go index f484d7d33a..94a02c13a3 100644 --- a/x/auction/genesis.go +++ b/x/auction/genesis.go @@ -41,7 +41,7 @@ func InitGenesis(ctx sdk.Context, keeper keeper.Keeper, bankKeeper types.BankKee // check module coins match auction coins // Note: Other sdk modules do not check this, instead just using the existing module account coins, or if zero, setting them. - if !maccCoins.IsEqual(totalAuctionCoins) { + if !maccCoins.Equal(totalAuctionCoins) { panic(fmt.Sprintf("total auction coins (%s) do not equal (%s) module account (%s) ", maccCoins, types.ModuleName, totalAuctionCoins)) } } diff --git a/x/auction/genesis_test.go b/x/auction/genesis_test.go index b8d32399c9..7c68c043b8 100644 --- a/x/auction/genesis_test.go +++ b/x/auction/genesis_test.go @@ -1,6 +1,7 @@ package auction_test import ( + "fmt" "sort" "testing" "time" @@ -9,7 +10,6 @@ import ( sdkmath "cosmossdk.io/math" tmproto "github.com/cometbft/cometbft/proto/tendermint/types" - sdk "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "github.com/kava-labs/kava/app" @@ -25,7 +25,7 @@ var ( c("lotdenom", 10), testTime, c("biddenom", 1000), - types.WeightedAddresses{Addresses: testAddrs, Weights: []sdkmath.Int{sdk.OneInt(), sdk.OneInt()}}, + types.WeightedAddresses{Addresses: testAddrs, Weights: []sdkmath.Int{sdkmath.OneInt(), sdkmath.OneInt()}}, c("debt", 1000), ).WithID(3).(types.GenesisAuction) ) @@ -34,7 +34,7 @@ func TestInitGenesis(t *testing.T) { t.Run("valid", func(t *testing.T) { // setup keepers tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1}) // setup module account modBaseAcc := authtypes.NewBaseAccount(authtypes.NewModuleAddress(types.ModuleName), nil, 0, 0) @@ -81,7 +81,7 @@ func TestInitGenesis(t *testing.T) { t.Run("invalid (invalid nextAuctionID)", func(t *testing.T) { // setup keepers tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1}) // setup module account modBaseAcc := authtypes.NewBaseAccount(authtypes.NewModuleAddress(types.ModuleName), nil, 0, 0) @@ -105,7 +105,7 @@ func TestInitGenesis(t *testing.T) { t.Run("invalid (missing mod account coins)", func(t *testing.T) { // setup keepers tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1}) // invalid as there is no module account setup @@ -128,12 +128,18 @@ func TestExportGenesis(t *testing.T) { t.Run("default", func(t *testing.T) { // setup state tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1}) + fmt.Println("tApp created") tApp.InitializeFromGenesisStates() + fmt.Println("tApp initialized") + fmt.Println("tApp minter", tApp.GetMintKeeper().GetMinter(ctx)) + // export gs := auction.ExportGenesis(ctx, tApp.GetAuctionKeeper()) + fmt.Println("exported genesis", gs) + // check state matches defaultGS := types.DefaultGenesisState() require.Equal(t, defaultGS, gs) @@ -141,7 +147,7 @@ func TestExportGenesis(t *testing.T) { t.Run("one auction", func(t *testing.T) { // setup state tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1}) tApp.InitializeFromGenesisStates() tApp.GetAuctionKeeper().SetAuction(ctx, testAuction) diff --git a/x/auction/keeper/auctions.go b/x/auction/keeper/auctions.go index 78af906b5c..4638291ddd 100644 --- a/x/auction/keeper/auctions.go +++ b/x/auction/keeper/auctions.go @@ -178,9 +178,9 @@ func (k Keeper) PlaceBidSurplus(ctx sdk.Context, auction *types.SurplusAuction, return auction, errorsmod.Wrapf(types.ErrInvalidBidDenom, "%s ≠ %s", bid.Denom, auction.Bid.Denom) } minNewBidAmt := auction.Bid.Amount.Add( // new bids must be some % greater than old bid, and at least 1 larger to avoid replacing an old bid at no cost - sdk.MaxInt( + sdkmath.MaxInt( sdkmath.NewInt(1), - sdk.NewDecFromInt(auction.Bid.Amount).Mul(k.GetParams(ctx).IncrementSurplus).RoundInt(), + sdkmath.LegacyNewDecFromInt(auction.Bid.Amount).Mul(k.GetParams(ctx).IncrementSurplus).RoundInt(), ), ) if bid.Amount.LT(minNewBidAmt) { @@ -243,12 +243,12 @@ func (k Keeper) PlaceForwardBidCollateral(ctx sdk.Context, auction *types.Collat panic("cannot place reverse bid on auction in forward phase") } minNewBidAmt := auction.Bid.Amount.Add( // new bids must be some % greater than old bid, and at least 1 larger to avoid replacing an old bid at no cost - sdk.MaxInt( + sdkmath.MaxInt( sdkmath.NewInt(1), - sdk.NewDecFromInt(auction.Bid.Amount).Mul(k.GetParams(ctx).IncrementCollateral).RoundInt(), + sdkmath.LegacyNewDecFromInt(auction.Bid.Amount).Mul(k.GetParams(ctx).IncrementCollateral).RoundInt(), ), ) - minNewBidAmt = sdk.MinInt(minNewBidAmt, auction.MaxBid.Amount) // allow new bids to hit MaxBid even though it may be less than the increment % + minNewBidAmt = sdkmath.MinInt(minNewBidAmt, auction.MaxBid.Amount) // allow new bids to hit MaxBid even though it may be less than the increment % if bid.Amount.LT(minNewBidAmt) { return auction, errorsmod.Wrapf(types.ErrBidTooSmall, "%s < %s%s", bid, minNewBidAmt, auction.Bid.Denom) } @@ -277,7 +277,7 @@ func (k Keeper) PlaceForwardBidCollateral(ctx sdk.Context, auction *types.Collat // Debt coins are sent to liquidator (until there is no CorrespondingDebt left). Amount sent is equal to bidIncrement (or whatever is left if < bidIncrement). if auction.CorrespondingDebt.IsPositive() { - debtAmountToReturn := sdk.MinInt(bidIncrement.Amount, auction.CorrespondingDebt.Amount) + debtAmountToReturn := sdkmath.MinInt(bidIncrement.Amount, auction.CorrespondingDebt.Amount) debtToReturn := sdk.NewCoin(auction.CorrespondingDebt.Denom, debtAmountToReturn) err = k.bankKeeper.SendCoinsFromModuleToModule(ctx, types.ModuleName, auction.Initiator, sdk.NewCoins(debtToReturn)) @@ -325,9 +325,9 @@ func (k Keeper) PlaceReverseBidCollateral(ctx sdk.Context, auction *types.Collat panic("cannot place forward bid on auction in reverse phase") } maxNewLotAmt := auction.Lot.Amount.Sub( // new lot must be some % less than old lot, and at least 1 smaller to avoid replacing an old bid at no cost - sdk.MaxInt( + sdkmath.MaxInt( sdkmath.NewInt(1), - sdk.NewDecFromInt(auction.Lot.Amount).Mul(k.GetParams(ctx).IncrementCollateral).RoundInt(), + sdkmath.LegacyNewDecFromInt(auction.Lot.Amount).Mul(k.GetParams(ctx).IncrementCollateral).RoundInt(), ), ) if lot.Amount.GT(maxNewLotAmt) { @@ -396,16 +396,16 @@ func (k Keeper) PlaceBidDebt(ctx sdk.Context, auction *types.DebtAuction, bidder return auction, errorsmod.Wrapf(types.ErrInvalidLotDenom, "%s ≠ %s", lot.Denom, auction.Lot.Denom) } maxNewLotAmt := auction.Lot.Amount.Sub( // new lot must be some % less than old lot, and at least 1 smaller to avoid replacing an old bid at no cost - sdk.MaxInt( + sdkmath.MaxInt( sdkmath.NewInt(1), - sdk.NewDecFromInt(auction.Lot.Amount).Mul(k.GetParams(ctx).IncrementDebt).RoundInt(), + sdkmath.LegacyNewDecFromInt(auction.Lot.Amount).Mul(k.GetParams(ctx).IncrementDebt).RoundInt(), ), ) if lot.Amount.GT(maxNewLotAmt) { return auction, errorsmod.Wrapf(types.ErrLotTooLarge, "%s > %s%s", lot, maxNewLotAmt, auction.Lot.Denom) } if lot.IsNegative() { - return auction, errorsmod.Wrapf(types.ErrLotTooSmall, "%s ≤ %s%s", lot, sdk.ZeroInt(), auction.Lot.Denom) + return auction, errorsmod.Wrapf(types.ErrLotTooSmall, "%s ≤ %s%s", lot, sdkmath.ZeroInt(), auction.Lot.Denom) } // New bidder pays back old bidder @@ -431,7 +431,7 @@ func (k Keeper) PlaceBidDebt(ctx sdk.Context, auction *types.DebtAuction, bidder // Debt coins are sent to liquidator the first time a bid is placed. Amount sent is equal to min of Bid and amount of debt. if auction.Bidder.Equals(authtypes.NewModuleAddress(auction.Initiator)) { // Handle debt coins for first bid - debtAmountToReturn := sdk.MinInt(auction.Bid.Amount, auction.CorrespondingDebt.Amount) + debtAmountToReturn := sdkmath.MinInt(auction.Bid.Amount, auction.CorrespondingDebt.Amount) debtToReturn := sdk.NewCoin(auction.CorrespondingDebt.Denom, debtAmountToReturn) err := k.bankKeeper.SendCoinsFromModuleToModule(ctx, types.ModuleName, auction.Initiator, sdk.NewCoins(debtToReturn)) diff --git a/x/auction/keeper/bidding_test.go b/x/auction/keeper/bidding_test.go index 5918e62ce4..7780018543 100644 --- a/x/auction/keeper/bidding_test.go +++ b/x/auction/keeper/bidding_test.go @@ -471,7 +471,7 @@ func TestAuctionBidding(t *testing.T) { gs := app.GenesisState{types.ModuleName: moduleGs} tApp.InitializeFromGenesisStates(authGS, gs) - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: someTime}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: someTime}) keeper := tApp.GetAuctionKeeper() bank := tApp.GetBankKeeper() diff --git a/x/auction/keeper/grpc_query.go b/x/auction/keeper/grpc_query.go index be3e7b8c75..d7433761d8 100644 --- a/x/auction/keeper/grpc_query.go +++ b/x/auction/keeper/grpc_query.go @@ -6,8 +6,8 @@ import ( "google.golang.org/grpc/codes" "google.golang.org/grpc/status" + "cosmossdk.io/store/prefix" codectypes "github.com/cosmos/cosmos-sdk/codec/types" - "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/query" diff --git a/x/auction/keeper/grpc_query_test.go b/x/auction/keeper/grpc_query_test.go index 12a25aece5..5cf57a261c 100644 --- a/x/auction/keeper/grpc_query_test.go +++ b/x/auction/keeper/grpc_query_test.go @@ -19,7 +19,7 @@ func TestGrpcAuctionsFilter(t *testing.T) { tApp := app.NewTestApp() tApp.InitializeFromGenesisStates() auctionsKeeper := tApp.GetAuctionKeeper() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1}) _, addrs := app.GeneratePrivKeyAddressPairs(2) auctions := []types.Auction{ diff --git a/x/auction/keeper/invariants.go b/x/auction/keeper/invariants.go index d83ecbc702..5183670ad8 100644 --- a/x/auction/keeper/invariants.go +++ b/x/auction/keeper/invariants.go @@ -1,9 +1,10 @@ package keeper import ( + storetypes "cosmossdk.io/store/types" "fmt" - "github.com/cosmos/cosmos-sdk/store/prefix" + "cosmossdk.io/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" @@ -34,7 +35,7 @@ func ModuleAccountInvariants(k Keeper) sdk.Invariant { }) moduleAccCoins := k.bankKeeper.GetAllBalances(ctx, authtypes.NewModuleAddress(types.ModuleName)) - broken := !moduleAccCoins.IsEqual(totalAuctionCoins) + broken := !moduleAccCoins.Equal(totalAuctionCoins) invariantMessage := sdk.FormatInvariant( types.ModuleName, @@ -93,7 +94,7 @@ func ValidIndexInvariant(k Keeper) sdk.Invariant { // Check all auction IDs in the index are in the auction store store := prefix.NewStore(ctx.KVStore(k.storeKey), types.AuctionKeyPrefix) - indexIterator := sdk.KVStorePrefixIterator(ctx.KVStore(k.storeKey), types.AuctionByTimeKeyPrefix) + indexIterator := storetypes.KVStorePrefixIterator(ctx.KVStore(k.storeKey), types.AuctionByTimeKeyPrefix) defer indexIterator.Close() var indexLength int @@ -112,7 +113,7 @@ func ValidIndexInvariant(k Keeper) sdk.Invariant { } // Check length of auction store matches the length of the index - storeIterator := sdk.KVStorePrefixIterator(ctx.KVStore(k.storeKey), types.AuctionKeyPrefix) + storeIterator := storetypes.KVStorePrefixIterator(ctx.KVStore(k.storeKey), types.AuctionKeyPrefix) defer storeIterator.Close() var storeLength int for ; storeIterator.Valid(); storeIterator.Next() { diff --git a/x/auction/keeper/keeper.go b/x/auction/keeper/keeper.go index de2744baf8..49c2510825 100644 --- a/x/auction/keeper/keeper.go +++ b/x/auction/keeper/keeper.go @@ -4,13 +4,13 @@ import ( "fmt" "time" + "cosmossdk.io/store/prefix" + storetypes "cosmossdk.io/store/types" "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/store/prefix" - storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" - "github.com/cometbft/cometbft/libs/log" + "cosmossdk.io/log" "github.com/kava-labs/kava/x/auction/types" ) @@ -178,7 +178,7 @@ func (k Keeper) IterateAuctionsByTime(ctx sdk.Context, inclusiveCutoffTime time. store := prefix.NewStore(ctx.KVStore(k.storeKey), types.AuctionByTimeKeyPrefix) iterator := store.Iterator( nil, // start at the very start of the prefix store - sdk.PrefixEndBytes(sdk.FormatTimeBytes(inclusiveCutoffTime)), // include any keys with times equal to inclusiveCutoffTime + storetypes.PrefixEndBytes(sdk.FormatTimeBytes(inclusiveCutoffTime)), // include any keys with times equal to inclusiveCutoffTime ) defer iterator.Close() @@ -195,7 +195,7 @@ func (k Keeper) IterateAuctionsByTime(ctx sdk.Context, inclusiveCutoffTime time. // IterateAuctions provides an iterator over all stored auctions. // For each auction, cb will be called. If cb returns true, the iterator will close and stop. func (k Keeper) IterateAuctions(ctx sdk.Context, cb func(auction types.Auction) (stop bool)) { - iterator := sdk.KVStorePrefixIterator(ctx.KVStore(k.storeKey), types.AuctionKeyPrefix) + iterator := storetypes.KVStorePrefixIterator(ctx.KVStore(k.storeKey), types.AuctionKeyPrefix) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { diff --git a/x/auction/keeper/keeper_test.go b/x/auction/keeper/keeper_test.go index 16aab50a0c..13ad20243c 100644 --- a/x/auction/keeper/keeper_test.go +++ b/x/auction/keeper/keeper_test.go @@ -16,7 +16,7 @@ func SetGetDeleteAuction(t *testing.T) { // setup keeper, create auction tApp := app.NewTestApp() keeper := tApp.GetAuctionKeeper() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1}) someTime := time.Date(43, time.January, 1, 0, 0, 0, 0, time.UTC) // need to specify UTC as tz info is lost on unmarshal var id uint64 = 5 @@ -52,7 +52,7 @@ func TestIncrementNextAuctionID(t *testing.T) { // setup keeper tApp := app.NewTestApp() keeper := tApp.GetAuctionKeeper() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1}) // store id var id uint64 = 123456 @@ -71,7 +71,7 @@ func TestIterateAuctions(t *testing.T) { tApp := app.NewTestApp() tApp.InitializeFromGenesisStates() keeper := tApp.GetAuctionKeeper() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1}) auctions := []types.Auction{ types.NewSurplusAuction("sellerMod", c("denom", 12345678), "anotherdenom", time.Date(1998, time.January, 1, 0, 0, 0, 0, time.UTC)).WithID(0), @@ -97,7 +97,7 @@ func TestIterateAuctionsByTime(t *testing.T) { // setup keeper tApp := app.NewTestApp() keeper := tApp.GetAuctionKeeper() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1}) // setup byTime index byTimeIndex := []struct { diff --git a/x/auction/keeper/math.go b/x/auction/keeper/math.go index 032da042ad..a1c8737bf7 100644 --- a/x/auction/keeper/math.go +++ b/x/auction/keeper/math.go @@ -4,7 +4,6 @@ import ( "sort" sdkmath "cosmossdk.io/math" - sdk "github.com/cosmos/cosmos-sdk/types" ) // splitIntIntoWeightedBuckets divides an initial +ve integer among several buckets in proportion to the buckets' weights @@ -47,7 +46,7 @@ func splitIntIntoWeightedBuckets(amount sdkmath.Int, buckets []sdkmath.Int) []sd }) // calculate total left over from remainders - allocated := sdk.ZeroInt() + allocated := sdkmath.ZeroInt() for _, qr := range quotients { allocated = allocated.Add(qr.quo) } @@ -58,8 +57,8 @@ func splitIntIntoWeightedBuckets(amount sdkmath.Int, buckets []sdkmath.Int) []sd for _, qr := range quotients { results[qr.index] = qr.quo if !leftToAllocate.IsZero() { - results[qr.index] = results[qr.index].Add(sdk.OneInt()) - leftToAllocate = leftToAllocate.Sub(sdk.OneInt()) + results[qr.index] = results[qr.index].Add(sdkmath.OneInt()) + leftToAllocate = leftToAllocate.Sub(sdkmath.OneInt()) } } return results @@ -73,7 +72,7 @@ type quoRem struct { // totalInts adds together sdk.Ints func totalInts(is ...sdkmath.Int) sdkmath.Int { - total := sdk.ZeroInt() + total := sdkmath.ZeroInt() for _, i := range is { total = total.Add(i) } diff --git a/x/auction/module.go b/x/auction/module.go index c18b968b27..8adcaab1b0 100644 --- a/x/auction/module.go +++ b/x/auction/module.go @@ -129,11 +129,17 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw } // BeginBlock module begin-block -func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) { +func (am AppModule) BeginBlock(ctx sdk.Context) error { BeginBlocker(ctx, am.keeper) + + return nil } // EndBlock module end-block -func (am AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { - return []abci.ValidatorUpdate{} +func (am AppModule) EndBlock(_ sdk.Context) ([]abci.ValidatorUpdate, error) { + return []abci.ValidatorUpdate{}, nil } + +func (AppModule) IsOnePerModuleType() {} + +func (AppModule) IsAppModule() {} diff --git a/x/auction/spec/02_state.md b/x/auction/spec/02_state.md index 335866e70d..4c3ae962bc 100644 --- a/x/auction/spec/02_state.md +++ b/x/auction/spec/02_state.md @@ -13,9 +13,9 @@ order: 2 type Params struct { MaxAuctionDuration time.Duration `json:"max_auction_duration" yaml:"max_auction_duration"` // max length of auction MaxBidDuration time.Duration `json:"max_bid_duration" yaml:"max_bid_duration"` // additional time added to the auction end time after each bid, capped by the expiry. - IncrementSurplus sdk.Dec `json:"increment_surplus" yaml:"increment_surplus"` // percentage change (of auc.Bid) required for a new bid on a surplus auction - IncrementDebt sdk.Dec `json:"increment_debt" yaml:"increment_debt"` // percentage change (of auc.Lot) required for a new bid on a debt auction - IncrementCollateral sdk.Dec `json:"increment_collateral" yaml:"increment_collateral"` // percentage change (of auc.Bid or auc.Lot) required for a new bid on a collateral auction + IncrementSurplus sdkmath.LegacyDec `json:"increment_surplus" yaml:"increment_surplus"` // percentage change (of auc.Bid) required for a new bid on a surplus auction + IncrementDebt sdkmath.LegacyDec `json:"increment_debt" yaml:"increment_debt"` // percentage change (of auc.Lot) required for a new bid on a debt auction + IncrementCollateral sdkmath.LegacyDec `json:"increment_collateral" yaml:"increment_collateral"` // percentage change (of auc.Bid or auc.Lot) required for a new bid on a collateral auction } ``` diff --git a/x/auction/testutil/suite.go b/x/auction/testutil/suite.go index 104b0a3936..a5ad288d56 100644 --- a/x/auction/testutil/suite.go +++ b/x/auction/testutil/suite.go @@ -1,12 +1,12 @@ package testutil import ( + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" "github.com/stretchr/testify/suite" sdkmath "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" - tmproto "github.com/cometbft/cometbft/proto/tendermint/types" tmtime "github.com/cometbft/cometbft/types/time" authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" @@ -45,7 +45,7 @@ func (suite *Suite) SetupTest(numAddrs int) { sdk.NewCoin("token2", sdkmath.NewInt(100)), ) - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) modName := "liquidator" modBaseAcc := authtypes.NewBaseAccount(authtypes.NewModuleAddress(modName), nil, 0, 0) diff --git a/x/auction/types/auction.pb.go b/x/auction/types/auction.pb.go index 8e7191d103..6c0a012a67 100644 --- a/x/auction/types/auction.pb.go +++ b/x/auction/types/auction.pb.go @@ -4,6 +4,7 @@ package types import ( + cosmossdk_io_math "cosmossdk.io/math" fmt "fmt" _ "github.com/cosmos/cosmos-proto" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" @@ -203,7 +204,7 @@ var xxx_messageInfo_CollateralAuction proto.InternalMessageInfo // WeightedAddresses is a type for storing some addresses and associated weights. type WeightedAddresses struct { Addresses []github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,1,rep,name=addresses,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"addresses,omitempty"` - Weights []github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,2,rep,name=weights,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"weights"` + Weights []cosmossdk_io_math.Int `protobuf:"bytes,2,rep,name=weights,proto3,customtype=cosmossdk.io/math.Int" json:"weights"` } func (m *WeightedAddresses) Reset() { *m = WeightedAddresses{} } @@ -252,49 +253,49 @@ func init() { } var fileDescriptor_b9b5dac2c776ef9e = []byte{ - // 657 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x54, 0xcd, 0x6e, 0xd3, 0x4a, - 0x14, 0xce, 0x24, 0xbd, 0x49, 0x3a, 0xae, 0xee, 0x55, 0xe6, 0x56, 0xc8, 0xad, 0x90, 0x1d, 0xba, - 0x80, 0x80, 0x14, 0x5b, 0x2d, 0x1b, 0xc4, 0x06, 0xd5, 0x2d, 0xd0, 0x6e, 0xba, 0x30, 0x48, 0x48, - 0x6c, 0xcc, 0xd8, 0x33, 0x75, 0x46, 0xb5, 0x3d, 0x91, 0x67, 0x52, 0xd2, 0xb7, 0xe8, 0xc3, 0x74, - 0xc5, 0x1e, 0xa9, 0xa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f3, 0x0b, 0xab, 0xf6, 0xe9, 0xc2, 0xaa, 0xbd, 0xbe, 0x7f, 0x8d, - 0x4e, 0xf5, 0xad, 0x9f, 0xe0, 0x50, 0x14, 0x5f, 0xee, 0xf8, 0xf2, 0x1f, 0xbf, 0x60, 0x0d, 0x9b, - 0xc5, 0x01, 0x3f, 0xfc, 0x11, 0x00, 0x00, 0xff, 0xff, 0x87, 0x6d, 0x9c, 0x17, 0x0e, 0x06, 0x00, - 0x00, + // 664 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x54, 0xcd, 0x6e, 0xd3, 0x40, + 0x10, 0xce, 0x26, 0x25, 0x49, 0xd7, 0x15, 0x28, 0x4b, 0x41, 0x6e, 0x05, 0x76, 0xe8, 0x85, 0x80, + 0x14, 0x5b, 0x2d, 0x07, 0x10, 0x17, 0x54, 0xb7, 0xfc, 0xf4, 0xd2, 0x83, 0x41, 0x42, 0xe2, 0x62, + 0xd6, 0xde, 0xad, 0xb3, 0xaa, 0xed, 0x8d, 0xbc, 0x9b, 0x92, 0xbe, 0x45, 0x1f, 0xa6, 0x27, 0x9e, + 0xa0, 0xaa, 0x84, 0x54, 0x71, 0x42, 0x1c, 0x02, 0xa4, 0x6f, 0xc1, 0x09, 0xad, 0xbd, 0x6e, 0x1b, + 0xd1, 0x43, 0x91, 0xe0, 0xc0, 0x29, 0x9e, 0x6f, 0x67, 0xe6, 0xfb, 0xe6, 0x2f, 0x70, 0x65, 0x17, + 0xef, 0x61, 0x17, 0x8f, 0x22, 0xc9, 0x78, 0xe6, 0xee, 0xad, 0x86, 0x54, 0xe2, 0xd5, 0xca, 0x76, + 0x86, 0x39, 0x97, 0x1c, 0x2d, 0x2a, 0x1f, 0xa7, 0xc2, 0xb4, 0xcf, 0xb2, 0x15, 0x71, 0x91, 0x72, + 0xe1, 0x86, 0x58, 0xd0, 0xb3, 0xc0, 0x88, 0x33, 0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xb5, 0xda, 0x57, 0xbc, 0xb7, 0x66, 0x8a, 0xc7, 0x1e, 0x23, + 0x68, 0x1b, 0x1a, 0x09, 0x97, 0x41, 0x4e, 0xe5, 0x28, 0xcf, 0x44, 0x71, 0x77, 0xc6, 0xda, 0xfd, + 0xcb, 0x0b, 0x7b, 0x4b, 0x59, 0x3c, 0x90, 0x94, 0xe8, 0xcb, 0xa2, 0x42, 0xe7, 0x82, 0x09, 0x97, + 0x7e, 0x99, 0x60, 0xb6, 0x99, 0x87, 0x00, 0x76, 0x7e, 0x0b, 0x42, 0x3b, 0x70, 0x1e, 0x57, 0x86, + 0x09, 0xba, 0x8d, 0xbf, 0x7a, 0xe8, 0xe7, 0xa9, 0xd1, 0x63, 0xd8, 0xfa, 0x50, 0x90, 0x0b, 0xb3, + 0x5e, 0xb0, 0xdc, 0x55, 0x6a, 0xbf, 0x4e, 0xec, 0x5b, 0x65, 0xa0, 0x20, 0xbb, 0x0e, 0xe3, 0x6e, + 0x8a, 0xe5, 0xc0, 0xd9, 0xca, 0xa4, 0x5f, 0x79, 0x7b, 0x2f, 0x8f, 0x7e, 0x58, 0xb5, 0xa3, 0xa9, + 0x05, 0x4e, 0xa6, 0x16, 0xf8, 0x3e, 0xb5, 0xc0, 0xc1, 0xa9, 0x55, 0x3b, 0x39, 0xb5, 0x6a, 0x5f, + 0x4e, 0xad, 0xda, 0xbb, 0x07, 0x17, 0x74, 0xaa, 0x36, 0xf5, 0x13, 0x1c, 0x8a, 0xe2, 0xcb, 0x1d, + 0x9f, 0xfd, 0xc1, 0x17, 0x72, 0xc3, 0x66, 0x71, 0xaf, 0x8f, 0x7e, 0x05, 0x00, 0x00, 0xff, 0xff, + 0x3a, 0x52, 0x1c, 0x68, 0xfd, 0x05, 0x00, 0x00, } func (m *BaseAuction) Marshal() (dAtA []byte, err error) { @@ -1438,7 +1439,7 @@ func (m *WeightedAddresses) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - var v github_com_cosmos_cosmos_sdk_types.Int + var v cosmossdk_io_math.Int m.Weights = append(m.Weights, v) if err := m.Weights[len(m.Weights)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err diff --git a/x/auction/types/auctions.go b/x/auction/types/auctions.go index 73fcb9cf02..0271b6373f 100644 --- a/x/auction/types/auctions.go +++ b/x/auction/types/auctions.go @@ -272,7 +272,7 @@ func (wa WeightedAddresses) Validate() error { return fmt.Errorf("number of addresses doesn't match number of weights, %d ≠ %d", len(wa.Addresses), len(wa.Weights)) } - totalWeight := sdk.ZeroInt() + totalWeight := sdkmath.ZeroInt() for i := range wa.Addresses { if wa.Addresses[i].Empty() { return fmt.Errorf("address %d cannot be empty", i) diff --git a/x/auction/types/auctions_test.go b/x/auction/types/auctions_test.go index 99476bf958..8ea205afec 100644 --- a/x/auction/types/auctions_test.go +++ b/x/auction/types/auctions_test.go @@ -29,7 +29,7 @@ func init() { sdk.GetConfig().SetBech32PrefixForAccount("kava", "kava"+sdk.PrefixPublic) } -func d(amount string) sdk.Dec { return sdk.MustNewDecFromStr(amount) } +func d(amount string) sdkmath.LegacyDec { return sdkmath.LegacyMustNewDecFromStr(amount) } func c(denom string, amount int64) sdk.Coin { return sdk.NewInt64Coin(denom, amount) } func i(n int64) sdkmath.Int { return sdkmath.NewInt(n) } func is(ns ...int64) (is []sdkmath.Int) { diff --git a/x/auction/types/codec.go b/x/auction/types/codec.go index 3e33b9ca8b..47ea8d5680 100644 --- a/x/auction/types/codec.go +++ b/x/auction/types/codec.go @@ -6,7 +6,6 @@ import ( cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/msgservice" - authzcodec "github.com/cosmos/cosmos-sdk/x/authz/codec" ) // RegisterLegacyAminoCodec registers all the necessary types and interfaces for the @@ -61,5 +60,5 @@ func init() { // Register all Amino interfaces and concrete types on the authz Amino codec so that this can later be // used to properly serialize MsgGrant and MsgExec instances - RegisterLegacyAminoCodec(authzcodec.Amino) + RegisterLegacyAminoCodec(codec.NewLegacyAmino()) } diff --git a/x/auction/types/expected_keepers.go b/x/auction/types/expected_keepers.go index b7d65ea439..1272ebc2c2 100644 --- a/x/auction/types/expected_keepers.go +++ b/x/auction/types/expected_keepers.go @@ -1,22 +1,22 @@ package types import ( + "context" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/auth/types" ) // AccountKeeper expected interface for the account keeper (noalias) type AccountKeeper interface { - GetAccount(ctx sdk.Context, addr sdk.AccAddress) types.AccountI - GetModuleAccount(ctx sdk.Context, name string) types.ModuleAccountI + GetAccount(ctx context.Context, addr sdk.AccAddress) sdk.AccountI + GetModuleAccount(ctx context.Context, name string) sdk.ModuleAccountI } // BankKeeper defines the expected interface needed to send coins type BankKeeper interface { - SendCoinsFromModuleToModule(ctx sdk.Context, sender, recipient string, amt sdk.Coins) error - SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error - SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error - BurnCoins(ctx sdk.Context, name string, amt sdk.Coins) error - MintCoins(ctx sdk.Context, name string, amt sdk.Coins) error - GetAllBalances(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins + SendCoinsFromModuleToModule(ctx context.Context, sender, recipient string, amt sdk.Coins) error + SendCoinsFromModuleToAccount(ctx context.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error + SendCoinsFromAccountToModule(ctx context.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error + BurnCoins(ctx context.Context, name string, amt sdk.Coins) error + MintCoins(ctx context.Context, name string, amt sdk.Coins) error + GetAllBalances(ctx context.Context, addr sdk.AccAddress) sdk.Coins } diff --git a/x/auction/types/genesis.pb.go b/x/auction/types/genesis.pb.go index d47b786a80..13c27ec38f 100644 --- a/x/auction/types/genesis.pb.go +++ b/x/auction/types/genesis.pb.go @@ -4,10 +4,10 @@ package types import ( + cosmossdk_io_math "cosmossdk.io/math" fmt "fmt" _ "github.com/cosmos/cosmos-proto" types "github.com/cosmos/cosmos-sdk/codec/types" - github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" github_com_cosmos_gogoproto_types "github.com/cosmos/gogoproto/types" @@ -73,12 +73,12 @@ var xxx_messageInfo_GenesisState proto.InternalMessageInfo // Params defines the parameters for the issuance module. type Params struct { - MaxAuctionDuration time.Duration `protobuf:"bytes,1,opt,name=max_auction_duration,json=maxAuctionDuration,proto3,stdduration" json:"max_auction_duration"` - ForwardBidDuration time.Duration `protobuf:"bytes,6,opt,name=forward_bid_duration,json=forwardBidDuration,proto3,stdduration" json:"forward_bid_duration"` - ReverseBidDuration time.Duration `protobuf:"bytes,7,opt,name=reverse_bid_duration,json=reverseBidDuration,proto3,stdduration" json:"reverse_bid_duration"` - IncrementSurplus github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=increment_surplus,json=incrementSurplus,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"increment_surplus"` - IncrementDebt github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,4,opt,name=increment_debt,json=incrementDebt,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"increment_debt"` - IncrementCollateral github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,5,opt,name=increment_collateral,json=incrementCollateral,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"increment_collateral"` + MaxAuctionDuration time.Duration `protobuf:"bytes,1,opt,name=max_auction_duration,json=maxAuctionDuration,proto3,stdduration" json:"max_auction_duration"` + ForwardBidDuration time.Duration `protobuf:"bytes,6,opt,name=forward_bid_duration,json=forwardBidDuration,proto3,stdduration" json:"forward_bid_duration"` + ReverseBidDuration time.Duration `protobuf:"bytes,7,opt,name=reverse_bid_duration,json=reverseBidDuration,proto3,stdduration" json:"reverse_bid_duration"` + IncrementSurplus cosmossdk_io_math.LegacyDec `protobuf:"bytes,3,opt,name=increment_surplus,json=incrementSurplus,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"increment_surplus"` + IncrementDebt cosmossdk_io_math.LegacyDec `protobuf:"bytes,4,opt,name=increment_debt,json=incrementDebt,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"increment_debt"` + IncrementCollateral cosmossdk_io_math.LegacyDec `protobuf:"bytes,5,opt,name=increment_collateral,json=incrementCollateral,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"increment_collateral"` } func (m *Params) Reset() { *m = Params{} } @@ -124,38 +124,39 @@ func init() { } var fileDescriptor_d0e5cb58293042f7 = []byte{ - // 496 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x93, 0xc1, 0x6e, 0xd3, 0x30, - 0x18, 0xc7, 0x93, 0x35, 0x94, 0xca, 0xed, 0xc6, 0x30, 0x39, 0xa4, 0x13, 0x4a, 0xab, 0x1e, 0xa6, - 0x72, 0xa8, 0xa3, 0x95, 0x1b, 0xb7, 0x85, 0x4a, 0x13, 0x9c, 0x50, 0xa6, 0x5d, 0xe0, 0x10, 0x39, - 0x89, 0x17, 0xa2, 0x25, 0x71, 0x65, 0x3b, 0xa5, 0x7d, 0x0b, 0x8e, 0x3c, 0x08, 0x87, 0x3d, 0x42, - 0xc5, 0x69, 0x47, 0xc4, 0x61, 0x40, 0xfb, 0x22, 0x28, 0x8e, 0x9b, 0x16, 0xd8, 0x65, 0x3b, 0xd5, - 0xfe, 0xbe, 0xff, 0xf7, 0xfb, 0xff, 0xed, 0x3a, 0x60, 0x70, 0x85, 0x67, 0xd8, 0xc1, 0x45, 0x28, - 0x12, 0x9a, 0x3b, 0xb3, 0x93, 0x80, 0x08, 0x7c, 0xe2, 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x29, 0x0e, 0xb8, 0x5c, 0x39, 0xf3, 0xfa, 0x83, 0x96, 0xae, 0x41, 0x53, 0xfe, - 0x49, 0x2f, 0xff, 0x04, 0x00, 0x00, 0xff, 0xff, 0xe6, 0x34, 0x3b, 0x9f, 0xed, 0x03, 0x00, 0x00, + // 504 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x93, 0x4f, 0x6f, 0xd3, 0x3e, + 0x18, 0xc7, 0x93, 0x35, 0xbf, 0xfe, 0x2a, 0xb7, 0x1b, 0x23, 0xe4, 0x90, 0x0e, 0x94, 0x56, 0x45, + 0x42, 0xe5, 0x30, 0x5b, 0x2b, 0x37, 0x6e, 0x0b, 0x95, 0x26, 0x26, 0x0e, 0x53, 0x26, 0x38, 0x70, + 0x89, 0x9c, 0xc4, 0xcb, 0xa2, 0x25, 0x71, 0x65, 0x3b, 0xa5, 0x7d, 0x17, 0xdc, 0xe0, 0x85, 0x70, + 0xe0, 0x25, 0x54, 0x9c, 0x76, 0x44, 0x1c, 0x06, 0xb4, 0x6f, 0x04, 0x25, 0x76, 0xd3, 0xf2, 0xe7, + 0xb0, 0xdd, 0xec, 0xe7, 0xf9, 0x7e, 0x3f, 0xcf, 0xd7, 0x8e, 0x03, 0x06, 0x57, 0x78, 0x8a, 0x11, + 0x2e, 0x42, 0x91, 0xd0, 0x1c, 0x4d, 0x8f, 0x02, 0x22, 0xf0, 0x11, 0x8a, 0x49, 0x4e, 0x78, 0xc2, + 0xe1, 0x84, 0x51, 0x41, 0x4d, 0xab, 0xd4, 0x40, 0xa5, 0x81, 0x4a, 0x73, 0xd0, 0x0d, 0x29, 0xcf, + 0x28, 0xf7, 0x2b, 0x0d, 0x92, 0x1b, 0x69, 0x38, 0xb0, 0x62, 0x1a, 0x53, 0x59, 0x2f, 0x57, 0xaa, + 0xda, 0x8d, 0x29, 0x8d, 0x53, 0x82, 0xaa, 0x5d, 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, 0x1b, 0x7b, + 0x06, 0xee, 0x27, 0x79, 0xc8, 0x48, 0x46, 0x72, 0xe1, 0xf3, 0x82, 0x4d, 0xd2, 0xa2, 0xbc, 0x5e, + 0x7d, 0xd8, 0x71, 0x1f, 0x97, 0xc6, 0x6f, 0x37, 0xbd, 0x87, 0xf2, 0x31, 0xf1, 0xe8, 0x0a, 0x26, + 0x14, 0x65, 0x58, 0x5c, 0xc2, 0x57, 0x24, 0xc6, 0xe1, 0x7c, 0x4c, 0x42, 0x6f, 0xbf, 0x76, 0x9f, + 0x4b, 0xb3, 0x79, 0x0a, 0xf6, 0x36, 0xc4, 0x88, 0x04, 0xc2, 0x36, 0x6e, 0x8f, 0xdb, 0xad, 0xad, + 0x63, 0x12, 0x08, 0xf3, 0x0d, 0xb0, 0x36, 0xac, 0x90, 0xa6, 0x29, 0x16, 0x84, 0xe1, 0xd4, 0xfe, + 0xef, 0xf6, 0xc4, 0x07, 0x35, 0xe0, 0x45, 0xed, 0x3f, 0x35, 0x5a, 0x3b, 0xfb, 0x0d, 0xaf, 0xb3, + 0x7d, 0x91, 0xee, 0xc9, 0xe2, 0xa7, 0xa3, 0x2d, 0x96, 0x8e, 0x7e, 0xbd, 0x74, 0xf4, 0x1f, 0x4b, + 0x47, 0x7f, 0xbf, 0x72, 0xb4, 0xeb, 0x95, 0xa3, 0x7d, 0x5d, 0x39, 0xda, 0xdb, 0xa7, 0x71, 0x22, + 0x2e, 0x8b, 0x00, 0x86, 0x34, 0x43, 0xe5, 0x9b, 0x3d, 0x4c, 0x71, 0xc0, 0xab, 0x15, 0x9a, 0xd5, + 0xff, 0xab, 0x98, 0x4f, 0x08, 0x0f, 0x9a, 0xd5, 0x37, 0x78, 0xf6, 0x2b, 0x00, 0x00, 0xff, 0xff, + 0x30, 0xdb, 0xae, 0xf5, 0xcc, 0x03, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { diff --git a/x/auction/types/genesis_test.go b/x/auction/types/genesis_test.go index 5ab0c182d6..d663ab3183 100644 --- a/x/auction/types/genesis_test.go +++ b/x/auction/types/genesis_test.go @@ -37,7 +37,7 @@ func TestGenesisState_Validate(t *testing.T) { MaxBid: sdk.NewInt64Coin("usdx", 5e4), LotReturns: WeightedAddresses{ Addresses: []sdk.AccAddress{sdk.AccAddress("test return address")}, - Weights: []sdkmath.Int{sdk.OneInt()}, + Weights: []sdkmath.Int{sdkmath.OneInt()}, }, } diff --git a/x/auction/types/params.go b/x/auction/types/params.go index eca7900fb0..c45e4e16e5 100644 --- a/x/auction/types/params.go +++ b/x/auction/types/params.go @@ -1,15 +1,15 @@ package types import ( + sdkmath "cosmossdk.io/math" "errors" "fmt" "time" - sdk "github.com/cosmos/cosmos-sdk/types" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" ) -var emptyDec = sdk.Dec{} +var emptyDec = sdkmath.LegacyDec{} // Defaults for auction params const ( @@ -23,7 +23,7 @@ const ( var ( // DefaultIncrement is the smallest percent change a new bid must have from the old one - DefaultIncrement sdk.Dec = sdk.MustNewDecFromStr("0.05") + DefaultIncrement sdkmath.LegacyDec = sdkmath.LegacyMustNewDecFromStr("0.05") // ParamStoreKeyParams Param store key for auction params KeyForwardBidDuration = []byte("ForwardBidDuration") KeyReverseBidDuration = []byte("ReverseBidDuration") @@ -38,7 +38,7 @@ func NewParams( maxAuctionDuration, forwardBidDuration, reverseBidDuration time.Duration, incrementSurplus, incrementDebt, - incrementCollateral sdk.Dec, + incrementCollateral sdkmath.LegacyDec, ) Params { return Params{ MaxAuctionDuration: maxAuctionDuration, @@ -139,7 +139,7 @@ func validateMaxAuctionDurationParam(i interface{}) error { } func validateIncrementSurplusParam(i interface{}) error { - incrementSurplus, ok := i.(sdk.Dec) + incrementSurplus, ok := i.(sdkmath.LegacyDec) if !ok { return fmt.Errorf("invalid parameter type: %T", i) } @@ -156,7 +156,7 @@ func validateIncrementSurplusParam(i interface{}) error { } func validateIncrementDebtParam(i interface{}) error { - incrementDebt, ok := i.(sdk.Dec) + incrementDebt, ok := i.(sdkmath.LegacyDec) if !ok { return fmt.Errorf("invalid parameter type: %T", i) } @@ -173,7 +173,7 @@ func validateIncrementDebtParam(i interface{}) error { } func validateIncrementCollateralParam(i interface{}) error { - incrementCollateral, ok := i.(sdk.Dec) + incrementCollateral, ok := i.(sdkmath.LegacyDec) if !ok { return fmt.Errorf("invalid parameter type: %T", i) } diff --git a/x/auction/types/query.pb.go b/x/auction/types/query.pb.go index 7a6f901497..bed67c24fd 100644 --- a/x/auction/types/query.pb.go +++ b/x/auction/types/query.pb.go @@ -603,6 +603,7 @@ func _Query_NextAuctionID_Handler(srv interface{}, ctx context.Context, dec func return interceptor(ctx, in, info, handler) } +var Query_serviceDesc = _Query_serviceDesc var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "kava.auction.v1beta1.Query", HandlerType: (*QueryServer)(nil), diff --git a/x/auction/types/tx.pb.go b/x/auction/types/tx.pb.go index 2853a56f9a..dd84a6841c 100644 --- a/x/auction/types/tx.pb.go +++ b/x/auction/types/tx.pb.go @@ -206,6 +206,7 @@ func _Msg_PlaceBid_Handler(srv interface{}, ctx context.Context, dec func(interf return interceptor(ctx, in, info, handler) } +var Msg_serviceDesc = _Msg_serviceDesc var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "kava.auction.v1beta1.Msg", HandlerType: (*MsgServer)(nil), diff --git a/x/bep3/abci_test.go b/x/bep3/abci_test.go index a0a5116309..74d58e4de0 100644 --- a/x/bep3/abci_test.go +++ b/x/bep3/abci_test.go @@ -29,7 +29,7 @@ type ABCITestSuite struct { func (suite *ABCITestSuite) SetupTest() { tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) // Set up auth GenesisState _, addrs := app.GeneratePrivKeyAddressPairs(12) diff --git a/x/bep3/genesis_test.go b/x/bep3/genesis_test.go index c1eb3a158d..78efccdb9d 100644 --- a/x/bep3/genesis_test.go +++ b/x/bep3/genesis_test.go @@ -29,7 +29,7 @@ func (suite *GenesisTestSuite) SetupTest() { app.SetBech32AddressPrefixes(config) tApp := app.NewTestApp() - suite.ctx = tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + suite.ctx = tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) suite.keeper = tApp.GetBep3Keeper() suite.app = tApp @@ -116,7 +116,7 @@ func (suite *GenesisTestSuite) TestGenesisState() { name: "0 deputy fees", genState: func() app.GenesisState { gs := baseGenState(suite.addrs[0]) - gs.Params.AssetParams[0].FixedFee = sdk.ZeroInt() + gs.Params.AssetParams[0].FixedFee = sdkmath.ZeroInt() return app.GenesisState{types.ModuleName: cdc.MustMarshalJSON(&gs)} }, expectPass: true, diff --git a/x/bep3/integration_test.go b/x/bep3/integration_test.go index 332dad7037..183133f843 100644 --- a/x/bep3/integration_test.go +++ b/x/bep3/integration_test.go @@ -26,7 +26,7 @@ var ( ) func i(in int64) sdkmath.Int { return sdkmath.NewInt(in) } -func d(de int64) sdk.Dec { return sdk.NewDec(de) } +func d(de int64) sdkmath.LegacyDec { return sdkmath.LegacyNewDec(de) } func c(denom string, amount int64) sdk.Coin { return sdk.NewInt64Coin(denom, amount) } func cs(coins ...sdk.Coin) sdk.Coins { return sdk.NewCoins(coins...) } func ts(minOffset int) int64 { return tmtime.Now().Add(time.Duration(minOffset) * time.Minute).Unix() } @@ -46,13 +46,13 @@ func baseGenState(deputy sdk.AccAddress) types.GenesisState { SupplyLimit: types.SupplyLimit{ Limit: sdkmath.NewInt(350000000000000), TimeLimited: false, - TimeBasedLimit: sdk.ZeroInt(), + TimeBasedLimit: sdkmath.ZeroInt(), TimePeriod: time.Hour, }, Active: true, DeputyAddress: deputy, FixedFee: sdkmath.NewInt(1000), - MinSwapAmount: sdk.OneInt(), + MinSwapAmount: sdkmath.OneInt(), MaxSwapAmount: sdkmath.NewInt(1000000000000), MinBlockLock: types.DefaultMinBlockLock, MaxBlockLock: types.DefaultMaxBlockLock, @@ -63,13 +63,13 @@ func baseGenState(deputy sdk.AccAddress) types.GenesisState { SupplyLimit: types.SupplyLimit{ Limit: sdkmath.NewInt(100000000000), TimeLimited: false, - TimeBasedLimit: sdk.ZeroInt(), + TimeBasedLimit: sdkmath.ZeroInt(), TimePeriod: time.Hour, }, Active: true, DeputyAddress: deputy, FixedFee: sdkmath.NewInt(1000), - MinSwapAmount: sdk.OneInt(), + MinSwapAmount: sdkmath.OneInt(), MaxSwapAmount: sdkmath.NewInt(1000000000000), MinBlockLock: types.DefaultMinBlockLock, MaxBlockLock: types.DefaultMaxBlockLock, @@ -78,17 +78,17 @@ func baseGenState(deputy sdk.AccAddress) types.GenesisState { }, Supplies: types.AssetSupplies{ types.NewAssetSupply( - sdk.NewCoin("bnb", sdk.ZeroInt()), - sdk.NewCoin("bnb", sdk.ZeroInt()), - sdk.NewCoin("bnb", sdk.ZeroInt()), - sdk.NewCoin("bnb", sdk.ZeroInt()), + sdk.NewCoin("bnb", sdkmath.ZeroInt()), + sdk.NewCoin("bnb", sdkmath.ZeroInt()), + sdk.NewCoin("bnb", sdkmath.ZeroInt()), + sdk.NewCoin("bnb", sdkmath.ZeroInt()), time.Duration(0), ), types.NewAssetSupply( - sdk.NewCoin("inc", sdk.ZeroInt()), - sdk.NewCoin("inc", sdk.ZeroInt()), - sdk.NewCoin("inc", sdk.ZeroInt()), - sdk.NewCoin("inc", sdk.ZeroInt()), + sdk.NewCoin("inc", sdkmath.ZeroInt()), + sdk.NewCoin("inc", sdkmath.ZeroInt()), + sdk.NewCoin("inc", sdkmath.ZeroInt()), + sdk.NewCoin("inc", sdkmath.ZeroInt()), time.Duration(0), ), }, diff --git a/x/bep3/keeper/asset.go b/x/bep3/keeper/asset.go index 983d1999e4..a67d6ca4bd 100644 --- a/x/bep3/keeper/asset.go +++ b/x/bep3/keeper/asset.go @@ -1,6 +1,7 @@ package keeper import ( + sdkmath "cosmossdk.io/math" "time" errorsmod "cosmossdk.io/errors" @@ -147,8 +148,8 @@ func (k Keeper) DecrementOutgoingAssetSupply(ctx sdk.Context, coin sdk.Coin) err // CreateNewAssetSupply creates a new AssetSupply in the store for the input denom func (k Keeper) CreateNewAssetSupply(ctx sdk.Context, denom string) types.AssetSupply { supply := types.NewAssetSupply( - sdk.NewCoin(denom, sdk.ZeroInt()), sdk.NewCoin(denom, sdk.ZeroInt()), - sdk.NewCoin(denom, sdk.ZeroInt()), sdk.NewCoin(denom, sdk.ZeroInt()), time.Duration(0)) + sdk.NewCoin(denom, sdkmath.ZeroInt()), sdk.NewCoin(denom, sdkmath.ZeroInt()), + sdk.NewCoin(denom, sdkmath.ZeroInt()), sdk.NewCoin(denom, sdkmath.ZeroInt()), time.Duration(0)) k.SetAssetSupply(ctx, supply, denom) return supply } @@ -176,7 +177,7 @@ func (k Keeper) UpdateTimeBasedSupplyLimits(ctx sdk.Context) { supply.TimeElapsed = newTimeElapsed } else { supply.TimeElapsed = time.Duration(0) - supply.TimeLimitedCurrentSupply = sdk.NewCoin(asset.Denom, sdk.ZeroInt()) + supply.TimeLimitedCurrentSupply = sdk.NewCoin(asset.Denom, sdkmath.ZeroInt()) } k.SetAssetSupply(ctx, supply, asset.Denom) } diff --git a/x/bep3/keeper/asset_test.go b/x/bep3/keeper/asset_test.go index b4b2446144..86e899fa8d 100644 --- a/x/bep3/keeper/asset_test.go +++ b/x/bep3/keeper/asset_test.go @@ -32,7 +32,7 @@ func (suite *AssetTestSuite) SetupTest() { // Initialize test app and set context tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) // Initialize genesis state deputy, _ := sdk.AccAddressFromBech32(TestDeputy) @@ -635,13 +635,13 @@ func (suite *AssetTestSuite) TestUpdateTimeBasedSupplyLimits() { SupplyLimit: types.SupplyLimit{ Limit: sdkmath.NewInt(350000000000000), TimeLimited: false, - TimeBasedLimit: sdk.ZeroInt(), + TimeBasedLimit: sdkmath.ZeroInt(), TimePeriod: time.Hour, }, Active: true, DeputyAddress: deputy, FixedFee: sdkmath.NewInt(1000), - MinSwapAmount: sdk.OneInt(), + MinSwapAmount: sdkmath.OneInt(), MaxSwapAmount: sdkmath.NewInt(1000000000000), MinBlockLock: types.DefaultMinBlockLock, MaxBlockLock: types.DefaultMaxBlockLock, @@ -658,7 +658,7 @@ func (suite *AssetTestSuite) TestUpdateTimeBasedSupplyLimits() { Active: false, DeputyAddress: deputy, FixedFee: sdkmath.NewInt(1000), - MinSwapAmount: sdk.OneInt(), + MinSwapAmount: sdkmath.OneInt(), MaxSwapAmount: sdkmath.NewInt(1000000000000), MinBlockLock: types.DefaultMinBlockLock, MaxBlockLock: types.DefaultMaxBlockLock, @@ -675,7 +675,7 @@ func (suite *AssetTestSuite) TestUpdateTimeBasedSupplyLimits() { Active: false, DeputyAddress: deputy, FixedFee: sdkmath.NewInt(1000), - MinSwapAmount: sdk.OneInt(), + MinSwapAmount: sdkmath.OneInt(), MaxSwapAmount: sdkmath.NewInt(1000000000000), MinBlockLock: types.DefaultMinBlockLock, MaxBlockLock: types.DefaultMaxBlockLock, diff --git a/x/bep3/keeper/grpc_query.go b/x/bep3/keeper/grpc_query.go index 1012c82ea7..f4103c951c 100644 --- a/x/bep3/keeper/grpc_query.go +++ b/x/bep3/keeper/grpc_query.go @@ -7,7 +7,7 @@ import ( "google.golang.org/grpc/codes" "google.golang.org/grpc/status" - "github.com/cosmos/cosmos-sdk/store/prefix" + "cosmossdk.io/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/query" diff --git a/x/bep3/keeper/integration_test.go b/x/bep3/keeper/integration_test.go index ffe94eb6b8..f11139d84c 100644 --- a/x/bep3/keeper/integration_test.go +++ b/x/bep3/keeper/integration_test.go @@ -46,13 +46,13 @@ func NewBep3GenStateMulti(cdc codec.JSONCodec, deputyAddress sdk.AccAddress) app SupplyLimit: types.SupplyLimit{ Limit: sdkmath.NewInt(350000000000000), TimeLimited: false, - TimeBasedLimit: sdk.ZeroInt(), + TimeBasedLimit: sdkmath.ZeroInt(), TimePeriod: time.Hour, }, Active: true, DeputyAddress: deputyAddress, FixedFee: sdkmath.NewInt(1000), - MinSwapAmount: sdk.OneInt(), + MinSwapAmount: sdkmath.OneInt(), MaxSwapAmount: sdkmath.NewInt(1000000000000), MinBlockLock: types.DefaultMinBlockLock, MaxBlockLock: types.DefaultMaxBlockLock, @@ -69,7 +69,7 @@ func NewBep3GenStateMulti(cdc codec.JSONCodec, deputyAddress sdk.AccAddress) app Active: false, DeputyAddress: deputyAddress, FixedFee: sdkmath.NewInt(1000), - MinSwapAmount: sdk.OneInt(), + MinSwapAmount: sdkmath.OneInt(), MaxSwapAmount: sdkmath.NewInt(100000000000), MinBlockLock: types.DefaultMinBlockLock, MaxBlockLock: types.DefaultMaxBlockLock, @@ -78,17 +78,17 @@ func NewBep3GenStateMulti(cdc codec.JSONCodec, deputyAddress sdk.AccAddress) app }, Supplies: types.AssetSupplies{ types.NewAssetSupply( - sdk.NewCoin("bnb", sdk.ZeroInt()), - sdk.NewCoin("bnb", sdk.ZeroInt()), - sdk.NewCoin("bnb", sdk.ZeroInt()), - sdk.NewCoin("bnb", sdk.ZeroInt()), + sdk.NewCoin("bnb", sdkmath.ZeroInt()), + sdk.NewCoin("bnb", sdkmath.ZeroInt()), + sdk.NewCoin("bnb", sdkmath.ZeroInt()), + sdk.NewCoin("bnb", sdkmath.ZeroInt()), time.Duration(0), ), types.NewAssetSupply( - sdk.NewCoin("inc", sdk.ZeroInt()), - sdk.NewCoin("inc", sdk.ZeroInt()), - sdk.NewCoin("inc", sdk.ZeroInt()), - sdk.NewCoin("inc", sdk.ZeroInt()), + sdk.NewCoin("inc", sdkmath.ZeroInt()), + sdk.NewCoin("inc", sdkmath.ZeroInt()), + sdk.NewCoin("inc", sdkmath.ZeroInt()), + sdk.NewCoin("inc", sdkmath.ZeroInt()), time.Duration(0), ), }, diff --git a/x/bep3/keeper/keeper.go b/x/bep3/keeper/keeper.go index 6a32a81b84..1a1ea1af6e 100644 --- a/x/bep3/keeper/keeper.go +++ b/x/bep3/keeper/keeper.go @@ -4,10 +4,10 @@ import ( "fmt" "time" - "github.com/cometbft/cometbft/libs/log" + "cosmossdk.io/log" + "cosmossdk.io/store/prefix" + storetypes "cosmossdk.io/store/types" "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/store/prefix" - storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" @@ -82,7 +82,7 @@ func (k Keeper) RemoveAtomicSwap(ctx sdk.Context, swapID []byte) { // IterateAtomicSwaps provides an iterator over all stored AtomicSwaps. // For each AtomicSwap, cb will be called. If cb returns true, the iterator will close and stop. func (k Keeper) IterateAtomicSwaps(ctx sdk.Context, cb func(atomicSwap types.AtomicSwap) (stop bool)) { - iterator := sdk.KVStorePrefixIterator(ctx.KVStore(k.key), types.AtomicSwapKeyPrefix) + iterator := storetypes.KVStorePrefixIterator(ctx.KVStore(k.key), types.AtomicSwapKeyPrefix) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { @@ -126,7 +126,7 @@ func (k Keeper) IterateAtomicSwapsByBlock(ctx sdk.Context, inclusiveCutoffTime u store := prefix.NewStore(ctx.KVStore(k.key), types.AtomicSwapByBlockPrefix) iterator := store.Iterator( nil, // start at the very start of the prefix store - sdk.PrefixEndBytes(sdk.Uint64ToBigEndian(inclusiveCutoffTime)), // end of range + storetypes.PrefixEndBytes(sdk.Uint64ToBigEndian(inclusiveCutoffTime)), // end of range ) defer iterator.Close() @@ -167,7 +167,7 @@ func (k Keeper) IterateAtomicSwapsLongtermStorage(ctx sdk.Context, inclusiveCuto store := prefix.NewStore(ctx.KVStore(k.key), types.AtomicSwapLongtermStoragePrefix) iterator := store.Iterator( nil, // start at the very start of the prefix store - sdk.PrefixEndBytes(sdk.Uint64ToBigEndian(inclusiveCutoffTime)), // end of range + storetypes.PrefixEndBytes(sdk.Uint64ToBigEndian(inclusiveCutoffTime)), // end of range ) defer iterator.Close() @@ -205,7 +205,7 @@ func (k Keeper) SetAssetSupply(ctx sdk.Context, supply types.AssetSupply, denom // IterateAssetSupplies provides an iterator over all stored AssetSupplies. func (k Keeper) IterateAssetSupplies(ctx sdk.Context, cb func(supply types.AssetSupply) (stop bool)) { - iterator := sdk.KVStorePrefixIterator(ctx.KVStore(k.key), types.AssetSupplyPrefix) + iterator := storetypes.KVStorePrefixIterator(ctx.KVStore(k.key), types.AssetSupplyPrefix) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { diff --git a/x/bep3/keeper/keeper_test.go b/x/bep3/keeper/keeper_test.go index 529247205b..be91513e68 100644 --- a/x/bep3/keeper/keeper_test.go +++ b/x/bep3/keeper/keeper_test.go @@ -34,7 +34,7 @@ func (suite *KeeperTestSuite) SetupTest() { func (suite *KeeperTestSuite) ResetChain() { tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) keeper := tApp.GetBep3Keeper() suite.app = tApp diff --git a/x/bep3/keeper/msg_server_test.go b/x/bep3/keeper/msg_server_test.go index badad26ce2..d53e0fe63e 100644 --- a/x/bep3/keeper/msg_server_test.go +++ b/x/bep3/keeper/msg_server_test.go @@ -29,7 +29,7 @@ type MsgServerTestSuite struct { func (suite *MsgServerTestSuite) SetupTest() { tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) cdc := tApp.AppCodec() diff --git a/x/bep3/keeper/params_test.go b/x/bep3/keeper/params_test.go index 0f339d4402..3f71a1ee63 100644 --- a/x/bep3/keeper/params_test.go +++ b/x/bep3/keeper/params_test.go @@ -26,7 +26,7 @@ type ParamsTestSuite struct { func (suite *ParamsTestSuite) SetupTest() { tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) _, addrs := app.GeneratePrivKeyAddressPairs(10) tApp.InitializeFromGenesisStates(NewBep3GenStateMulti(tApp.AppCodec(), addrs[0])) suite.keeper = tApp.GetBep3Keeper() diff --git a/x/bep3/keeper/swap.go b/x/bep3/keeper/swap.go index bf3df1937c..d9d21ac225 100644 --- a/x/bep3/keeper/swap.go +++ b/x/bep3/keeper/swap.go @@ -68,6 +68,7 @@ func (k Keeper) CreateAtomicSwap(ctx sdk.Context, randomNumberHash []byte, times direction = types.SWAP_DIRECTION_OUTGOING } + // TODO(boodyvo): this looks strange, as switch/case is redundant here switch direction { case types.SWAP_DIRECTION_INCOMING: // If recipient's account doesn't exist, register it in state so that the address can send diff --git a/x/bep3/keeper/swap_test.go b/x/bep3/keeper/swap_test.go index 056a51476f..2ace6e9e4a 100644 --- a/x/bep3/keeper/swap_test.go +++ b/x/bep3/keeper/swap_test.go @@ -45,7 +45,7 @@ func (suite *AtomicSwapTestSuite) SetupTest() { // Initialize test app and set context tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) cdc := tApp.AppCodec() // Create and load 20 accounts with bnb tokens diff --git a/x/bep3/module.go b/x/bep3/module.go index a2ef32c395..e02ab4ce3d 100644 --- a/x/bep3/module.go +++ b/x/bep3/module.go @@ -133,12 +133,20 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw return cdc.MustMarshalJSON(&gs) } -// BeginBlock returns the begin blocker for the bep3 module. -func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) { - BeginBlocker(ctx, am.keeper) +// BeginBlock returns the beginning blocker for the distribution module. +func (am AppModule) BeginBlock(ctx context.Context) error { + c := sdk.UnwrapSDKContext(ctx) + BeginBlocker(c, am.keeper) + + return nil } -// EndBlock returns the end blocker for the bep3 module. It returns no validator updates. -func (am AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { - return []abci.ValidatorUpdate{} +// EndBlock returns the end blocker for the staking module. It returns no validator +// updates. +func (am AppModule) EndBlock(ctx context.Context) ([]abci.ValidatorUpdate, error) { + return []abci.ValidatorUpdate{}, nil } + +func (AppModule) IsOnePerModuleType() {} + +func (AppModule) IsAppModule() {} diff --git a/x/bep3/types/bep3.pb.go b/x/bep3/types/bep3.pb.go index 5a9c3ab512..13ae60c92f 100644 --- a/x/bep3/types/bep3.pb.go +++ b/x/bep3/types/bep3.pb.go @@ -4,6 +4,7 @@ package types import ( + cosmossdk_io_math "cosmossdk.io/math" fmt "fmt" github_com_cometbft_cometbft_libs_bytes "github.com/cometbft/cometbft/libs/bytes" _ "github.com/cosmos/cosmos-proto" @@ -158,11 +159,11 @@ type AssetParam struct { // deputy_address the kava address of the deputy DeputyAddress github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,5,opt,name=deputy_address,json=deputyAddress,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"deputy_address,omitempty"` // fixed_fee defines the fee for incoming swaps - FixedFee github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,6,opt,name=fixed_fee,json=fixedFee,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"fixed_fee"` + FixedFee cosmossdk_io_math.Int `protobuf:"bytes,6,opt,name=fixed_fee,json=fixedFee,proto3,customtype=cosmossdk.io/math.Int" json:"fixed_fee"` // min_swap_amount defines the minimum amount able to be swapped in a single message - MinSwapAmount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,7,opt,name=min_swap_amount,json=minSwapAmount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"min_swap_amount"` + MinSwapAmount cosmossdk_io_math.Int `protobuf:"bytes,7,opt,name=min_swap_amount,json=minSwapAmount,proto3,customtype=cosmossdk.io/math.Int" json:"min_swap_amount"` // max_swap_amount defines the maximum amount able to be swapped in a single message - MaxSwapAmount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,8,opt,name=max_swap_amount,json=maxSwapAmount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"max_swap_amount"` + MaxSwapAmount cosmossdk_io_math.Int `protobuf:"bytes,8,opt,name=max_swap_amount,json=maxSwapAmount,proto3,customtype=cosmossdk.io/math.Int" json:"max_swap_amount"` // min_block_lock defined the minimum blocks to lock MinBlockLock uint64 `protobuf:"varint,9,opt,name=min_block_lock,json=minBlockLock,proto3" json:"min_block_lock,omitempty"` // min_block_lock defined the maximum blocks to lock @@ -254,13 +255,13 @@ func (m *AssetParam) GetMaxBlockLock() uint64 { // SupplyLimit define the absolute and time-based limits for an assets's supply. type SupplyLimit struct { // limit defines the total supply allowed - Limit github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,1,opt,name=limit,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"limit"` + Limit cosmossdk_io_math.Int `protobuf:"bytes,1,opt,name=limit,proto3,customtype=cosmossdk.io/math.Int" json:"limit"` // time_limited enables or disables time based supply limiting TimeLimited bool `protobuf:"varint,2,opt,name=time_limited,json=timeLimited,proto3" json:"time_limited,omitempty"` // time_period specifies the duration that time_based_limit is evalulated TimePeriod time.Duration `protobuf:"bytes,3,opt,name=time_period,json=timePeriod,proto3,stdduration" json:"time_period"` // time_based_limit defines the maximum supply that can be swapped within time_period - TimeBasedLimit github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,4,opt,name=time_based_limit,json=timeBasedLimit,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"time_based_limit"` + TimeBasedLimit cosmossdk_io_math.Int `protobuf:"bytes,4,opt,name=time_based_limit,json=timeBasedLimit,proto3,customtype=cosmossdk.io/math.Int" json:"time_based_limit"` } func (m *SupplyLimit) Reset() { *m = SupplyLimit{} } @@ -550,79 +551,80 @@ func init() { func init() { proto.RegisterFile("kava/bep3/v1beta1/bep3.proto", fileDescriptor_01a01937d931b013) } var fileDescriptor_01a01937d931b013 = []byte{ - // 1147 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0x4d, 0x6f, 0x1a, 0x57, - 0x17, 0xf6, 0x18, 0x4c, 0xec, 0x03, 0x26, 0xbc, 0xd7, 0xc9, 0x1b, 0xec, 0xa4, 0x40, 0x9c, 0xaa, - 0x42, 0x51, 0x0d, 0xf9, 0x68, 0x77, 0x55, 0x55, 0x06, 0x70, 0x8c, 0xe4, 0x00, 0x1a, 0x6c, 0xf5, - 0x63, 0xd1, 0xe9, 0x9d, 0x99, 0x0b, 0x5c, 0x99, 0x99, 0x3b, 0x9a, 0x3b, 0x24, 0xf8, 0x1f, 0x74, - 0xd1, 0x45, 0xbb, 0xeb, 0xbe, 0xbb, 0x2e, 0xab, 0xfc, 0x88, 0x2c, 0xa3, 0xac, 0xaa, 0x2e, 0x9c, - 0xca, 0xf9, 0x17, 0xd9, 0xb4, 0xba, 0x1f, 0x06, 0x9c, 0xba, 0x15, 0x0b, 0x36, 0xf6, 0x9c, 0xaf, - 0xe7, 0x9c, 0xb9, 0x73, 0x9e, 0xe7, 0x02, 0x77, 0x4e, 0xf0, 0x33, 0x5c, 0x75, 0x48, 0xf8, 0xb8, - 0xfa, 0xec, 0xa1, 0x43, 0x62, 0xfc, 0x50, 0x1a, 0x95, 0x30, 0x62, 0x31, 0x43, 0xff, 0x13, 0xd1, - 0x8a, 0x74, 0xe8, 0xe8, 0x4e, 0xc1, 0x65, 0xdc, 0x67, 0xbc, 0xea, 0x60, 0x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xb6, - 0x84, 0x3b, 0xc0, 0x7c, 0x88, 0xee, 0xc1, 0x26, 0x99, 0x84, 0x34, 0x22, 0xf6, 0x90, 0xd0, 0xc1, - 0x50, 0x49, 0x4a, 0xd2, 0xca, 0x28, 0xe7, 0x81, 0xf4, 0xa1, 0x3b, 0xb0, 0x21, 0x8e, 0x83, 0xc7, - 0xd8, 0x0f, 0xe5, 0xe9, 0x26, 0xac, 0x99, 0x03, 0x7d, 0x07, 0x29, 0x4e, 0x02, 0x8f, 0x44, 0x4b, - 0xd7, 0x0a, 0x8d, 0x8b, 0xfa, 0xb0, 0x11, 0x11, 0x97, 0x86, 0x94, 0x04, 0xb1, 0x14, 0x89, 0x65, - 0x36, 0x99, 0x41, 0xa3, 0x8f, 0x01, 0xa9, 0x8e, 0x36, 0x8b, 0x87, 0x24, 0xb2, 0xdd, 0x21, 0xa6, - 0x81, 0x12, 0x0d, 0x2b, 0xa7, 0x22, 0x1d, 0x11, 0xa8, 0x0b, 0x3f, 0x7a, 0x04, 0x37, 0xa7, 0xa5, - 0x97, 0x0a, 0x24, 0xff, 0xad, 0xad, 0x69, 0x70, 0xae, 0xe6, 0x2e, 0x64, 0xdc, 0x11, 0x13, 0xab, - 0xea, 0x4c, 0x59, 0x9c, 0xb0, 0xd2, 0xca, 0x27, 0x29, 0x8a, 0x3e, 0x85, 0x14, 0x8f, 0x71, 0x3c, - 0xe6, 0x92, 0xbc, 0xd9, 0x2b, 0xaf, 0x1f, 0xb1, 0x83, 0x3d, 0x99, 0x64, 0xe9, 0x64, 0x54, 0x84, - 0xb4, 0x1b, 0x31, 0xce, 0xf5, 0x0c, 0x69, 0x49, 0x38, 0x90, 0x2e, 0xd5, 0xfa, 0x73, 0xd8, 0xf0, - 0x68, 0x44, 0x5c, 0x41, 0xa6, 0x7c, 0x46, 0x42, 0x97, 0xfe, 0x05, 0xba, 0x71, 0x91, 0x67, 0xcd, - 0x4a, 0x76, 0x7f, 0x4a, 0x80, 0xba, 0xe2, 0x94,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0xd4, 0xea, - 0xb4, 0xdf, 0x1b, 0xe0, 0x62, 0xba, 0x59, 0xbc, 0xd5, 0xae, 0x77, 0x9e, 0xb6, 0xda, 0x4f, 0x72, - 0xc6, 0x15, 0xc1, 0xce, 0xf1, 0xd1, 0x93, 0x8e, 0x08, 0xae, 0xaa, 0x86, 0xe6, 0x17, 0x2f, 0xcf, - 0x0b, 0xc6, 0xab, 0xf3, 0x82, 0xf1, 0xe7, 0x79, 0xc1, 0xf8, 0xf1, 0x6d, 0x61, 0xe5, 0xd5, 0xdb, - 0xc2, 0xca, 0xef, 0x6f, 0x0b, 0x2b, 0xdf, 0xcc, 0x2b, 0xbc, 0x58, 0xe8, 0xbd, 0x11, 0x76, 0xb8, - 0x7c, 0xaa, 0x4e, 0xd4, 0x2f, 0x4f, 0xa9, 0x05, 0x4e, 0x4a, 0x9e, 0xeb, 0xe3, 0xbf, 0x03, 0x00, - 0x00, 0xff, 0xff, 0x79, 0xfe, 0xe7, 0xb2, 0x93, 0x0a, 0x00, 0x00, + // 1153 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0x4f, 0x53, 0x1b, 0xc7, + 0x13, 0x65, 0x91, 0x90, 0xa1, 0x25, 0xb0, 0x7e, 0x83, 0xfd, 0xb3, 0xc0, 0x8e, 0x24, 0xe3, 0x54, + 0x4a, 0xe5, 0x84, 0x95, 0xff, 0x24, 0xd7, 0x54, 0xb4, 0x92, 0x30, 0xaa, 0xc2, 0x48, 0xb5, 0x82, + 0x4a, 0x2a, 0x87, 0x6c, 0x66, 0x77, 0x07, 0x69, 0x0a, 0xed, 0xce, 0xd6, 0xce, 0xc8, 0x16, 0xdf, + 0x20, 0x47, 0xe7, 0x96, 0x7b, 0x6e, 0x39, 0xfb, 0x43, 0xf8, 0xe8, 0xf2, 0x29, 0xc9, 0x01, 0xa7, + 0xf0, 0xb7, 0xf0, 0x25, 0xa9,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0xb1, 0x28, 0x5d, 0xb9, 0xbc, 0xde, 0x72, 0x44, 0xe3, 0xfe, 0x53, 0x9c, + 0x34, 0x94, 0x82, 0x12, 0xc5, 0x93, 0x73, 0xa2, 0x8b, 0xff, 0x45, 0x14, 0x4f, 0x66, 0x44, 0x3f, + 0x86, 0x15, 0xd9, 0xa9, 0x3f, 0x62, 0xc1, 0xa1, 0x27, 0x7f, 0x94, 0x96, 0xaa, 0x56, 0x2d, 0xeb, + 0x16, 0x22, 0x1a, 0x3b, 0x32, 0xde, 0x61, 0xc1, 0xa1, 0xaa, 0xc2, 0x93, 0xd9, 0x2a, 0x30, 0x55, + 0x78, 0x72, 0x56, 0xb5, 0xf1, 0x6c, 0x1e, 0xf2, 0x33, 0xef, 0x1a, 0x35, 0x60, 0x41, 0x8f, 0x86, + 0x75, 0xf9, 0x36, 0x35, 0x13, 0xdd, 0x86, 0x82, 0xa0, 0x11, 0xd1, 0x23, 0x46, 0xf4, 0x38, 0x2e, + 0xba, 0x79, 0x89, 0xed, 0x68, 0x08, 0xb5, 0x40, 0x85, 0x5e, 0x42, 0x52, 0xca, 0x42, 0x33, 0x86, + 0x6b, 0xb6, 0x36, 0x9a, 0x7d, 0x6a, 0x34, 0xbb, 0x65, 0x8c, 0xe6, 0x2c, 0xca, 0x36, 0x7e, 0x7a, + 0x5d, 0xb1, 0x5c, 0x90, 0xbc, 0x9e, 0xa2, 0xa1, 0x7d, 0x28, 0x2a, 0x15, 0xe9, 0xf4, 0xd0, 0x4c, + 0x74, 0xf6, 0xf2, 0x6d, 0xaf, 0x48, 0x11, 0x47, 0x6a, 0xa8, 0xf6, 0x36, 0xfe, 0x5c, 0x00, 0x68, + 0x08, 0x16, 0xd1, 0x40, 0xde, 0x39, 0x0a, 0x20, 0x67, 0xde, 0x9c, 0xb6, 0xf3, 0x9a, 0x6d, 0xb8, + 0xf2, 0xd8, 0x33, 0xbf, 0x48, 0xa3, 0x39, 0xf7, 0x8c, 0x95, 0x6b, 0x17, 0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, 0xd9, 0x64, 0xb7, 0xd7, 0xde, 0x2d, 0x5a, + 0x68, 0x0d, 0xae, 0xcf, 0xa2, 0xcd, 0xee, 0xe3, 0xde, 0x4e, 0x7b, 0xaf, 0xdd, 0x2a, 0xce, 0xa3, + 0x1b, 0xb0, 0x3a, 0x9b, 0x6a, 0x7f, 0xd3, 0xeb, 0xb8, 0xed, 0x56, 0x31, 0xb3, 0x9e, 0xfd, 0xe1, + 0xe7, 0xf2, 0xdc, 0x5d, 0x06, 0xcb, 0xe7, 0x46, 0x05, 0x95, 0x61, 0x5d, 0xd5, 0xb7, 0x3a, 0x6e, + 0xbb, 0xb9, 0xd7, 0xe9, 0xee, 0xbe, 0xd3, 0xc0, 0x69, 0x77, 0xd3, 0x7c, 0x67, 0xb7, 0xd9, 0x7d, + 0xdc, 0xd9, 0x7d, 0x54, 0xb4, 0xde, 0x93, 0xec, 0xee, 0xef, 0x3d, 0xea, 0xca, 0xe4, 0xbc, 0x3e, + 0xd0, 0xf9, 0xea, 0xc5, 0x49, 0xd9, 0x7a, 0x79, 0x52, 0xb6, 0xfe, 0x38, 0x29, 0x5b, 0xcf, 0xde, + 0x94, 0xe7, 0x5e, 0xbe, 0x29, 0xcf, 0xfd, 0xfa, 0xa6, 0x3c, 0xf7, 0xed, 0x27, 0x33, 0x7b, 0x40, + 0x0e, 0xf4, 0xe6, 0x08, 0xfb, 0x5c, 0x3d, 0xd5, 0x27, 0xfa, 0x9f, 0x44, 0xb5, 0x0b, 0xfc, 0x9c, + 0xba, 0xd7, 0x87, 0x7f, 0x05, 0x00, 0x00, 0xff, 0xff, 0xfd, 0xd9, 0x54, 0x64, 0x3e, 0x0a, 0x00, + 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { diff --git a/x/bep3/types/codec.go b/x/bep3/types/codec.go index dce4de11a2..071f19a5d5 100644 --- a/x/bep3/types/codec.go +++ b/x/bep3/types/codec.go @@ -6,7 +6,6 @@ import ( cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/msgservice" - authzcodec "github.com/cosmos/cosmos-sdk/x/authz/codec" ) // RegisterLegacyAminoCodec registers all the necessary types and interfaces for the @@ -45,5 +44,5 @@ func init() { // Register all Amino interfaces and concrete types on the authz Amino codec so that this can later be // used to properly serialize MsgGrant and MsgExec instances - RegisterLegacyAminoCodec(authzcodec.Amino) + RegisterLegacyAminoCodec(codec.NewLegacyAmino()) } diff --git a/x/bep3/types/expected_keepers.go b/x/bep3/types/expected_keepers.go index c9d1f7e981..697dfce107 100644 --- a/x/bep3/types/expected_keepers.go +++ b/x/bep3/types/expected_keepers.go @@ -1,26 +1,26 @@ package types import ( + "context" sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) // BankKeeper defines the expected interface needed to retrieve account balances. type BankKeeper interface { - SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error - SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error - BurnCoins(ctx sdk.Context, name string, amt sdk.Coins) error - MintCoins(ctx sdk.Context, name string, amt sdk.Coins) error + SendCoinsFromModuleToAccount(ctx context.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error + SendCoinsFromAccountToModule(ctx context.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error + BurnCoins(ctx context.Context, name string, amt sdk.Coins) error + MintCoins(ctx context.Context, name string, amt sdk.Coins) error } // AccountKeeper defines the expected account keeper type AccountKeeper interface { GetModuleAddress(name string) sdk.AccAddress - GetModuleAccount(ctx sdk.Context, moduleName string) authtypes.ModuleAccountI + GetModuleAccount(ctx context.Context, moduleName string) sdk.ModuleAccountI GetModuleAddressAndPermissions(moduleName string) (sdk.AccAddress, []string) - SetModuleAccount(ctx sdk.Context, macc authtypes.ModuleAccountI) + SetModuleAccount(ctx context.Context, macc sdk.ModuleAccountI) - GetAccount(ctx sdk.Context, addr sdk.AccAddress) authtypes.AccountI - NewAccountWithAddress(ctx sdk.Context, addr sdk.AccAddress) authtypes.AccountI - SetAccount(ctx sdk.Context, acc authtypes.AccountI) + GetAccount(ctx context.Context, addr sdk.AccAddress) sdk.AccountI + NewAccountWithAddress(ctx context.Context, addr sdk.AccAddress) sdk.AccountI + SetAccount(ctx context.Context, acc sdk.AccountI) } diff --git a/x/bep3/types/genesis_test.go b/x/bep3/types/genesis_test.go index 31ecc22eec..f4fb5ebb57 100644 --- a/x/bep3/types/genesis_test.go +++ b/x/bep3/types/genesis_test.go @@ -20,7 +20,7 @@ type GenesisTestSuite struct { } func (suite *GenesisTestSuite) SetupTest() { - coin := sdk.NewCoin("kava", sdk.OneInt()) + coin := sdk.NewCoin("kava", sdkmath.OneInt()) suite.swaps = atomicSwaps(10) supply := types.NewAssetSupply(coin, coin, coin, coin, time.Duration(0)) @@ -67,7 +67,7 @@ func (suite *GenesisTestSuite) TestValidate() { "invalid supply", args{ swaps: types.AtomicSwaps{}, - supplies: types.AssetSupplies{{IncomingSupply: sdk.Coin{Denom: "Invalid", Amount: sdk.ZeroInt()}}}, + supplies: types.AssetSupplies{{IncomingSupply: sdk.Coin{Denom: "Invalid", Amount: sdkmath.ZeroInt()}}}, previousBlockTime: types.DefaultPreviousBlockTime, }, false, diff --git a/x/bep3/types/params.go b/x/bep3/types/params.go index 0ec12dc17c..66bcef0ad1 100644 --- a/x/bep3/types/params.go +++ b/x/bep3/types/params.go @@ -20,7 +20,7 @@ var ( KeyAssetParams = []byte("AssetParams") DefaultBnbDeputyFixedFee sdkmath.Int = sdkmath.NewInt(1000) // 0.00001 BNB - DefaultMinAmount sdkmath.Int = sdk.ZeroInt() + DefaultMinAmount sdkmath.Int = sdkmath.ZeroInt() DefaultMaxAmount sdkmath.Int = sdkmath.NewInt(1000000000000) // 10,000 BNB DefaultMinBlockLock uint64 = 220 DefaultMaxBlockLock uint64 = 270 diff --git a/x/bep3/types/params_test.go b/x/bep3/types/params_test.go index a9de43a6ec..36ecc3d8e4 100644 --- a/x/bep3/types/params_test.go +++ b/x/bep3/types/params_test.go @@ -27,7 +27,7 @@ func (suite *ParamsTestSuite) SetupTest() { supply1 := types.SupplyLimit{ Limit: sdkmath.NewInt(10000000000000), TimeLimited: false, - TimeBasedLimit: sdk.ZeroInt(), + TimeBasedLimit: sdkmath.ZeroInt(), TimePeriod: time.Hour, } supply2 := types.SupplyLimit{ @@ -179,7 +179,7 @@ func (suite *ParamsTestSuite) TestParamValidation() { args: args{ assetParams: types.AssetParams{types.NewAssetParam( "bnb", 714, - types.SupplyLimit{sdkmath.NewInt(-10000000000000), false, time.Hour, sdk.ZeroInt()}, true, + types.SupplyLimit{sdkmath.NewInt(-10000000000000), false, time.Hour, sdkmath.ZeroInt()}, true, suite.addr, sdkmath.NewInt(1000), sdkmath.NewInt(100000000), sdkmath.NewInt(100000000000), types.DefaultMinBlockLock, types.DefaultMaxBlockLock)}, }, diff --git a/x/bep3/types/query.pb.go b/x/bep3/types/query.pb.go index 55eaa12421..e7373e7b7a 100644 --- a/x/bep3/types/query.pb.go +++ b/x/bep3/types/query.pb.go @@ -1008,6 +1008,7 @@ func _Query_AtomicSwaps_Handler(srv interface{}, ctx context.Context, dec func(i return interceptor(ctx, in, info, handler) } +var Query_serviceDesc = _Query_serviceDesc var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "kava.bep3.v1beta1.Query", HandlerType: (*QueryServer)(nil), diff --git a/x/bep3/types/supply_test.go b/x/bep3/types/supply_test.go index cefbf0e822..bcd846300a 100644 --- a/x/bep3/types/supply_test.go +++ b/x/bep3/types/supply_test.go @@ -10,7 +10,7 @@ import ( ) func TestAssetSupplyValidate(t *testing.T) { - coin := sdk.NewCoin("kava", sdk.OneInt()) + coin := sdk.NewCoin("kava", sdkmath.OneInt()) invalidCoin := sdk.Coin{Denom: "Invalid Denom", Amount: sdkmath.NewInt(-1)} testCases := []struct { msg string @@ -60,7 +60,7 @@ func TestAssetSupplyValidate(t *testing.T) { IncomingSupply: coin, OutgoingSupply: coin, CurrentSupply: coin, - TimeLimitedCurrentSupply: sdk.NewCoin("lol", sdk.ZeroInt()), + TimeLimitedCurrentSupply: sdk.NewCoin("lol", sdkmath.ZeroInt()), TimeElapsed: time.Hour, }, false, @@ -78,8 +78,8 @@ func TestAssetSupplyValidate(t *testing.T) { } func TestAssetSupplyEquality(t *testing.T) { - coin := sdk.NewCoin("test", sdk.OneInt()) - coin2 := sdk.NewCoin("other", sdk.OneInt()) + coin := sdk.NewCoin("test", sdkmath.OneInt()) + coin2 := sdk.NewCoin("other", sdkmath.OneInt()) testCases := []struct { name string asset1 AssetSupply @@ -101,7 +101,7 @@ func TestAssetSupplyEquality(t *testing.T) { { name: "not equal coin amount", asset1: NewAssetSupply(coin, coin, coin, coin, time.Duration(0)), - asset2: NewAssetSupply(sdk.NewCoin("test", sdk.ZeroInt()), coin, coin, coin, time.Duration(1)), + asset2: NewAssetSupply(sdk.NewCoin("test", sdkmath.ZeroInt()), coin, coin, coin, time.Duration(1)), expPass: false, }, { diff --git a/x/bep3/types/tx.pb.go b/x/bep3/types/tx.pb.go index 8929798a94..625be2e0c3 100644 --- a/x/bep3/types/tx.pb.go +++ b/x/bep3/types/tx.pb.go @@ -452,6 +452,7 @@ func _Msg_RefundAtomicSwap_Handler(srv interface{}, ctx context.Context, dec fun return interceptor(ctx, in, info, handler) } +var Msg_serviceDesc = _Msg_serviceDesc var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "kava.bep3.v1beta1.Msg", HandlerType: (*MsgServer)(nil), diff --git a/x/cdp/abci.go b/x/cdp/abci.go index 9967bd514d..29fd499191 100644 --- a/x/cdp/abci.go +++ b/x/cdp/abci.go @@ -1,6 +1,7 @@ package cdp import ( + sdkmath "cosmossdk.io/math" "errors" "fmt" "time" @@ -8,15 +9,13 @@ import ( "github.com/cosmos/cosmos-sdk/telemetry" sdk "github.com/cosmos/cosmos-sdk/types" - abci "github.com/cometbft/cometbft/abci/types" - "github.com/kava-labs/kava/x/cdp/keeper" "github.com/kava-labs/kava/x/cdp/types" pricefeedtypes "github.com/kava-labs/kava/x/pricefeed/types" ) // BeginBlocker compounds the debt in outstanding cdps and liquidates cdps that are below the required collateralization ratio -func BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock, k keeper.Keeper) { +func BeginBlocker(ctx sdk.Context, k keeper.Keeper) { defer telemetry.ModuleMeasureSince(types.ModuleName, time.Now(), telemetry.MetricKeyBeginBlocker) params := k.GetParams(ctx) @@ -47,7 +46,7 @@ func BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock, k keeper.Keeper) ctx.Logger().Debug(fmt.Sprintf("running x/cdp SynchronizeInterestForRiskyCDPs and LiquidateCdps for %s", cp.Type)) - err = k.SynchronizeInterestForRiskyCDPs(ctx, sdk.MaxSortableDec, cp) + err = k.SynchronizeInterestForRiskyCDPs(ctx, sdkmath.LegacyMaxSortableDec, cp) if err != nil { panic(err) } diff --git a/x/cdp/abci_test.go b/x/cdp/abci_test.go index eaffaa969d..fc5794c4e7 100644 --- a/x/cdp/abci_test.go +++ b/x/cdp/abci_test.go @@ -11,8 +11,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/simulation" - abci "github.com/cometbft/cometbft/abci/types" - tmproto "github.com/cometbft/cometbft/proto/tendermint/types" tmtime "github.com/cometbft/cometbft/types/time" "github.com/kava-labs/kava/app" @@ -42,7 +40,7 @@ type liquidationTracker struct { func (suite *ModuleTestSuite) SetupTest() { tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) tracker := liquidationTracker{} coins := cs(c("btc", 100000000), c("xrp", 10000000000), c("erc20/usdc", 10000000000)) @@ -63,7 +61,9 @@ func (suite *ModuleTestSuite) SetupTest() { func (suite *ModuleTestSuite) createCdps() { tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + ctx := tApp.NewContextLegacy(true) + ctx.WithBlockHeight(1) + ctx.WithBlockTime(tmtime.Now()) cdps := make(types.CDPs, 100) tracker := liquidationTracker{} @@ -113,7 +113,7 @@ func (suite *ModuleTestSuite) createCdps() { suite.liquidations = tracker } -func (suite *ModuleTestSuite) setPrice(price sdk.Dec, market string) { +func (suite *ModuleTestSuite) setPrice(price sdkmath.LegacyDec, market string) { pfKeeper := suite.app.GetPriceFeedKeeper() _, err := pfKeeper.SetPrice(suite.ctx, sdk.AccAddress{}, market, price, suite.ctx.BlockTime().Add(time.Hour*3)) @@ -134,13 +134,13 @@ func (suite *ModuleTestSuite) TestBeginBlockNewCdpTypeSetsGlobalInterest() { usdcCollateral := types.CollateralParam{ Denom: "erc20/usdc", Type: "erc20-usdc", - LiquidationRatio: sdk.MustNewDecFromStr("1.01"), + LiquidationRatio: sdkmath.LegacyMustNewDecFromStr("1.01"), DebtLimit: sdk.NewInt64Coin("usdx", 500000000000), - StabilityFee: sdk.OneDec(), + StabilityFee: sdkmath.LegacyOneDec(), AuctionSize: sdkmath.NewIntFromUint64(10000000000), - LiquidationPenalty: sdk.MustNewDecFromStr("0.05"), + LiquidationPenalty: sdkmath.LegacyMustNewDecFromStr("0.05"), CheckCollateralizationIndexCount: sdkmath.NewInt(10), - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.01"), + KeeperRewardPercentage: sdkmath.LegacyMustNewDecFromStr("0.01"), SpotMarketID: "usdc:usd", LiquidationMarketID: "usdc:usd", ConversionFactor: sdkmath.NewInt(6), @@ -148,13 +148,13 @@ func (suite *ModuleTestSuite) TestBeginBlockNewCdpTypeSetsGlobalInterest() { usdtCollateral := types.CollateralParam{ Denom: "erc20/usdt", Type: "erc20-usdt", - LiquidationRatio: sdk.MustNewDecFromStr("1.01"), + LiquidationRatio: sdkmath.LegacyMustNewDecFromStr("1.01"), DebtLimit: sdk.NewInt64Coin("usdx", 500000000000), - StabilityFee: sdk.OneDec(), + StabilityFee: sdkmath.LegacyOneDec(), AuctionSize: sdkmath.NewIntFromUint64(10000000000), - LiquidationPenalty: sdk.MustNewDecFromStr("0.05"), + LiquidationPenalty: sdkmath.LegacyMustNewDecFromStr("0.05"), CheckCollateralizationIndexCount: sdkmath.NewInt(10), - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.01"), + KeeperRewardPercentage: sdkmath.LegacyMustNewDecFromStr("0.01"), SpotMarketID: "usdt:usd", LiquidationMarketID: "usdt:usd", ConversionFactor: sdkmath.NewInt(18), @@ -183,7 +183,7 @@ func (suite *ModuleTestSuite) TestBeginBlockNewCdpTypeSetsGlobalInterest() { // ensure begin block does not panic due to no accumulation time or no global interest factor suite.Require().NotPanics(func() { - cdp.BeginBlocker(suite.ctx, abci.RequestBeginBlock{Header: suite.ctx.BlockHeader()}, suite.keeper) + cdp.BeginBlocker(suite.ctx, suite.keeper) }, "expected begin blocker not to panic") // set by accumulate interest (or add cdp above) @@ -199,11 +199,11 @@ func (suite *ModuleTestSuite) TestBeginBlockNewCdpTypeSetsGlobalInterest() { // set for USDC by AddCdp globalInterestFactor, found := suite.keeper.GetInterestFactor(suite.ctx, usdcCollateral.Type) suite.Require().True(found, "expected global interest factor for new collateral to be set") - suite.Equal(sdk.OneDec(), globalInterestFactor, "expected global interest factor to equal 1") + suite.Equal(sdkmath.LegacyOneDec(), globalInterestFactor, "expected global interest factor to equal 1") // not set for USDT since it has no cdps globalInterestFactor, found = suite.keeper.GetInterestFactor(suite.ctx, usdtCollateral.Type) suite.Require().False(found, "expected global interest factor for new collateral to not be set") - suite.Equal(sdk.ZeroDec(), globalInterestFactor, "expected global interest factor to equal 0") + suite.Equal(sdkmath.LegacyZeroDec(), globalInterestFactor, "expected global interest factor to equal 0") } func (suite *ModuleTestSuite) TestBeginBlock() { @@ -236,7 +236,7 @@ func (suite *ModuleTestSuite) TestBeginBlock() { suite.setPrice(d("0.2"), "xrp:usd") // test case 1 execution - cdp.BeginBlocker(suite.ctx, abci.RequestBeginBlock{Header: suite.ctx.BlockHeader()}, suite.keeper) + cdp.BeginBlocker(suite.ctx, suite.keeper) // test case 1 assert acc = ak.GetModuleAccount(suite.ctx, types.ModuleName) @@ -256,7 +256,7 @@ func (suite *ModuleTestSuite) TestBeginBlock() { suite.setPrice(d("6000"), "btc:usd") // btc collateral test case execution - cdp.BeginBlocker(suite.ctx, abci.RequestBeginBlock{Header: suite.ctx.BlockHeader()}, suite.keeper) + cdp.BeginBlocker(suite.ctx, suite.keeper) // btc collateral test case assertion 1 acc = ak.GetModuleAccount(suite.ctx, types.ModuleName) @@ -290,7 +290,7 @@ func (suite *ModuleTestSuite) TestSeizeSingleCdpWithFees() { suite.Equal(i(1000000000), bk.GetBalance(suite.ctx, cdpMacc.GetAddress(), "debt").Amount) for i := 0; i < 100; i++ { suite.ctx = suite.ctx.WithBlockTime(suite.ctx.BlockTime().Add(time.Second * 6)) - cdp.BeginBlocker(suite.ctx, abci.RequestBeginBlock{Header: suite.ctx.BlockHeader()}, suite.keeper) + cdp.BeginBlocker(suite.ctx, suite.keeper) } cdpMacc = ak.GetModuleAccount(suite.ctx, types.ModuleName) @@ -338,7 +338,7 @@ func (suite *ModuleTestSuite) TestCDPBeginBlockerRunsOnlyOnConfiguredInterval() suite.setPrice(d("0.2"), "xrp:usd") // test case 1 execution - cdp.BeginBlocker(suite.ctx, abci.RequestBeginBlock{Header: suite.ctx.BlockHeader()}, suite.keeper) + cdp.BeginBlocker(suite.ctx, suite.keeper) // test case 1 assert acc = ak.GetModuleAccount(suite.ctx, types.ModuleName) @@ -357,7 +357,7 @@ func (suite *ModuleTestSuite) TestCDPBeginBlockerRunsOnlyOnConfiguredInterval() suite.ctx = suite.ctx.WithBlockHeight(2) // test case 2 execution - cdp.BeginBlocker(suite.ctx, abci.RequestBeginBlock{Header: suite.ctx.BlockHeader()}, suite.keeper) + cdp.BeginBlocker(suite.ctx, suite.keeper) // test case 2 assert acc = ak.GetModuleAccount(suite.ctx, types.ModuleName) diff --git a/x/cdp/client/cli/query.go b/x/cdp/client/cli/query.go index dcfe3623e5..4b83fe6187 100644 --- a/x/cdp/client/cli/query.go +++ b/x/cdp/client/cli/query.go @@ -2,6 +2,7 @@ package cli import ( "context" + sdkmath "cosmossdk.io/math" "fmt" "strconv" "strings" @@ -149,7 +150,7 @@ $ kvcli q cdp cdps --page=2 --limit=100 } if len(strRatio) != 0 { - cdpRatio, err := sdk.NewDecFromStr(strRatio) + cdpRatio, err := sdkmath.LegacyNewDecFromStr(strRatio) if err != nil { return fmt.Errorf("cannot parse cdp ratio %s", strRatio) } diff --git a/x/cdp/genesis.go b/x/cdp/genesis.go index c3123b6537..628ce0c97e 100644 --- a/x/cdp/genesis.go +++ b/x/cdp/genesis.go @@ -1,6 +1,7 @@ package cdp import ( + sdkmath "cosmossdk.io/math" "fmt" sdk "github.com/cosmos/cosmos-sdk/types" @@ -112,7 +113,7 @@ func ExportGenesis(ctx sdk.Context, k keeper.Keeper) types.GenesisState { for _, cp := range params.CollateralParams { interestFactor, found := k.GetInterestFactor(ctx, cp.Type) if !found { - interestFactor = sdk.OneDec() + interestFactor = sdkmath.LegacyOneDec() } // Governance param changes happen in the end blocker. If a new collateral type is added and then the chain // is exported before the BeginBlocker can run, previous accrual time won't be found. We can't set it to diff --git a/x/cdp/genesis_test.go b/x/cdp/genesis_test.go index ef9254f076..9b3924cf6d 100644 --- a/x/cdp/genesis_test.go +++ b/x/cdp/genesis_test.go @@ -7,8 +7,6 @@ import ( "testing" "time" - abci "github.com/cometbft/cometbft/abci/types" - tmproto "github.com/cometbft/cometbft/proto/tendermint/types" tmtime "github.com/cometbft/cometbft/types/time" "github.com/stretchr/testify/suite" @@ -34,7 +32,7 @@ type GenesisTestSuite struct { func (suite *GenesisTestSuite) SetupTest() { tApp := app.NewTestApp() suite.genTime = tmtime.Canonical(time.Date(2021, 1, 1, 1, 1, 1, 1, time.UTC)) - suite.ctx = tApp.NewContext(true, tmproto.Header{Height: 1, Time: suite.genTime}) + suite.ctx = tApp.NewContextLegacy(true).WithBlockTime(suite.genTime).WithBlockHeight(1) suite.keeper = tApp.GetCDPKeeper() suite.app = tApp @@ -103,7 +101,7 @@ func (suite *GenesisTestSuite) TestInvalidGenState() { deposits: types.Deposits{}, debtDenom: types.DefaultDebtDenom, govDenom: types.DefaultGovDenom, - genAccumTimes: types.GenesisAccumulationTimes{types.NewGenesisAccumulationTime("bnb-a", time.Time{}, sdk.OneDec().Sub(sdk.SmallestDec()))}, + genAccumTimes: types.GenesisAccumulationTimes{types.NewGenesisAccumulationTime("bnb-a", time.Time{}, sdkmath.LegacyOneDec().Sub(sdkmath.LegacySmallestDec()))}, genTotalPrincipals: types.DefaultGenesisState().TotalPrincipals, }, errArgs: errArgs{ @@ -178,13 +176,13 @@ func (suite *GenesisTestSuite) Test_InitExportGenesis() { Principal: c("usdx", 10000000), AccumulatedFees: c("usdx", 0), FeesUpdated: suite.genTime, - InterestFactor: sdk.NewDec(1), + InterestFactor: sdkmath.LegacyNewDec(1), }, } genTotalPrincipals := types.GenesisTotalPrincipals{ - types.NewGenesisTotalPrincipal("btc-a", sdk.ZeroInt()), - types.NewGenesisTotalPrincipal("xrp-a", sdk.ZeroInt()), + types.NewGenesisTotalPrincipal("btc-a", sdkmath.ZeroInt()), + types.NewGenesisTotalPrincipal("xrp-a", sdkmath.ZeroInt()), } var deposits types.Deposits @@ -215,9 +213,9 @@ func (suite *GenesisTestSuite) Test_InitExportGenesis() { { Denom: "xrp", Type: "xrp-a", - LiquidationRatio: sdk.MustNewDecFromStr("2.0"), + LiquidationRatio: sdkmath.LegacyMustNewDecFromStr("2.0"), DebtLimit: sdk.NewInt64Coin("usdx", 500000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), // 5% apr + StabilityFee: sdkmath.LegacyMustNewDecFromStr("1.000000001547125958"), // 5% apr LiquidationPenalty: d("0.05"), AuctionSize: i(7000000000), SpotMarketID: "xrp:usd", @@ -229,9 +227,9 @@ func (suite *GenesisTestSuite) Test_InitExportGenesis() { { Denom: "btc", Type: "btc-a", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), + LiquidationRatio: sdkmath.LegacyMustNewDecFromStr("1.5"), DebtLimit: sdk.NewInt64Coin("usdx", 500000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000000782997609"), // 2.5% apr + StabilityFee: sdkmath.LegacyMustNewDecFromStr("1.000000000782997609"), // 2.5% apr LiquidationPenalty: d("0.025"), AuctionSize: i(10000000), SpotMarketID: "btc:usd", @@ -254,8 +252,8 @@ func (suite *GenesisTestSuite) Test_InitExportGenesis() { CDPs: cdps, Deposits: deposits, PreviousAccumulationTimes: types.GenesisAccumulationTimes{ - types.NewGenesisAccumulationTime("btc-a", suite.genTime, sdk.OneDec()), - types.NewGenesisAccumulationTime("xrp-a", suite.genTime, sdk.OneDec()), + types.NewGenesisAccumulationTime("btc-a", suite.genTime, sdkmath.LegacyOneDec()), + types.NewGenesisAccumulationTime("xrp-a", suite.genTime, sdkmath.LegacyOneDec()), }, TotalPrincipals: genTotalPrincipals, } @@ -270,7 +268,7 @@ func (suite *GenesisTestSuite) Test_InitExportGenesis() { // We run the BeginBlocker at time.Now() to accumulate interest suite.ctx = suite.ctx.WithBlockTime(time.Now()) - cdp.BeginBlocker(suite.ctx, abci.RequestBeginBlock{}, suite.keeper) + cdp.BeginBlocker(suite.ctx, suite.keeper) expectedGenesis := cdpGenesis diff --git a/x/cdp/integration_test.go b/x/cdp/integration_test.go index 84255c29a7..7df6bf7ca7 100644 --- a/x/cdp/integration_test.go +++ b/x/cdp/integration_test.go @@ -16,11 +16,11 @@ import ( // Avoid cluttering test cases with long function names func i(in int64) sdkmath.Int { return sdkmath.NewInt(in) } -func d(str string) sdk.Dec { return sdk.MustNewDecFromStr(str) } +func d(str string) sdkmath.LegacyDec { return sdkmath.LegacyMustNewDecFromStr(str) } func c(denom string, amount int64) sdk.Coin { return sdk.NewInt64Coin(denom, amount) } func cs(coins ...sdk.Coin) sdk.Coins { return sdk.NewCoins(coins...) } -func NewPricefeedGenState(cdc codec.JSONCodec, asset string, price sdk.Dec) app.GenesisState { +func NewPricefeedGenState(cdc codec.JSONCodec, asset string, price sdkmath.LegacyDec) app.GenesisState { pfGenesis := pricefeedtypes.GenesisState{ Params: pricefeedtypes.Params{ Markets: []pricefeedtypes.Market{ @@ -39,7 +39,7 @@ func NewPricefeedGenState(cdc codec.JSONCodec, asset string, price sdk.Dec) app. return app.GenesisState{pricefeedtypes.ModuleName: cdc.MustMarshalJSON(&pfGenesis)} } -func NewCDPGenState(cdc codec.JSONCodec, asset string, liquidationRatio sdk.Dec) app.GenesisState { +func NewCDPGenState(cdc codec.JSONCodec, asset string, liquidationRatio sdkmath.LegacyDec) app.GenesisState { cdpGenesis := types.GenesisState{ Params: types.Params{ GlobalDebtLimit: sdk.NewInt64Coin("usdx", 1000000000000), @@ -53,7 +53,7 @@ func NewCDPGenState(cdc codec.JSONCodec, asset string, liquidationRatio sdk.Dec) Type: asset + "-a", LiquidationRatio: liquidationRatio, DebtLimit: sdk.NewInt64Coin("usdx", 1000000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), // %5 apr + StabilityFee: sdkmath.LegacyMustNewDecFromStr("1.000000001547125958"), // %5 apr LiquidationPenalty: d("0.05"), AuctionSize: i(1000000000), ConversionFactor: i(6), @@ -75,10 +75,10 @@ func NewCDPGenState(cdc codec.JSONCodec, asset string, liquidationRatio sdk.Dec) GovDenom: types.DefaultGovDenom, CDPs: types.CDPs{}, PreviousAccumulationTimes: types.GenesisAccumulationTimes{ - types.NewGenesisAccumulationTime(asset+"-a", time.Time{}, sdk.OneDec()), + types.NewGenesisAccumulationTime(asset+"-a", time.Time{}, sdkmath.LegacyOneDec()), }, TotalPrincipals: types.GenesisTotalPrincipals{ - types.NewGenesisTotalPrincipal(asset+"-a", sdk.ZeroInt()), + types.NewGenesisTotalPrincipal(asset+"-a", sdkmath.ZeroInt()), }, } return app.GenesisState{types.ModuleName: cdc.MustMarshalJSON(&cdpGenesis)} @@ -96,13 +96,13 @@ func NewPricefeedGenStateMulti(cdc codec.JSONCodec) app.GenesisState { { MarketID: "btc:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("8000.00"), + Price: sdkmath.LegacyMustNewDecFromStr("8000.00"), Expiry: time.Now().Add(1 * time.Hour), }, { MarketID: "xrp:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("0.25"), + Price: sdkmath.LegacyMustNewDecFromStr("0.25"), Expiry: time.Now().Add(1 * time.Hour), }, }, @@ -123,9 +123,9 @@ func NewCDPGenStateMulti(cdc codec.JSONCodec) app.GenesisState { { Denom: "xrp", Type: "xrp-a", - LiquidationRatio: sdk.MustNewDecFromStr("2.0"), + LiquidationRatio: sdkmath.LegacyMustNewDecFromStr("2.0"), DebtLimit: sdk.NewInt64Coin("usdx", 500000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), // %5 apr + StabilityFee: sdkmath.LegacyMustNewDecFromStr("1.000000001547125958"), // %5 apr LiquidationPenalty: d("0.05"), AuctionSize: i(7000000000), SpotMarketID: "xrp:usd", @@ -137,9 +137,9 @@ func NewCDPGenStateMulti(cdc codec.JSONCodec) app.GenesisState { { Denom: "btc", Type: "btc-a", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), + LiquidationRatio: sdkmath.LegacyMustNewDecFromStr("1.5"), DebtLimit: sdk.NewInt64Coin("usdx", 500000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000000782997609"), // %2.5 apr + StabilityFee: sdkmath.LegacyMustNewDecFromStr("1.000000000782997609"), // %2.5 apr LiquidationPenalty: d("0.025"), AuctionSize: i(10000000), SpotMarketID: "btc:usd", @@ -161,12 +161,12 @@ func NewCDPGenStateMulti(cdc codec.JSONCodec) app.GenesisState { GovDenom: types.DefaultGovDenom, CDPs: types.CDPs{}, PreviousAccumulationTimes: types.GenesisAccumulationTimes{ - types.NewGenesisAccumulationTime("btc-a", time.Time{}, sdk.OneDec()), - types.NewGenesisAccumulationTime("xrp-a", time.Time{}, sdk.OneDec()), + types.NewGenesisAccumulationTime("btc-a", time.Time{}, sdkmath.LegacyOneDec()), + types.NewGenesisAccumulationTime("xrp-a", time.Time{}, sdkmath.LegacyOneDec()), }, TotalPrincipals: types.GenesisTotalPrincipals{ - types.NewGenesisTotalPrincipal("btc-a", sdk.ZeroInt()), - types.NewGenesisTotalPrincipal("xrp-a", sdk.ZeroInt()), + types.NewGenesisTotalPrincipal("btc-a", sdkmath.ZeroInt()), + types.NewGenesisTotalPrincipal("xrp-a", sdkmath.ZeroInt()), }, } return app.GenesisState{types.ModuleName: cdc.MustMarshalJSON(&cdpGenesis)} @@ -174,10 +174,10 @@ func NewCDPGenStateMulti(cdc codec.JSONCodec) app.GenesisState { func cdps() (cdps types.CDPs) { _, addrs := app.GeneratePrivKeyAddressPairs(3) - c1 := types.NewCDP(uint64(1), addrs[0], sdk.NewCoin("xrp", sdkmath.NewInt(100000000)), "xrp-a", sdk.NewCoin("usdx", sdkmath.NewInt(8000000)), tmtime.Canonical(time.Now()), sdk.OneDec()) - c2 := types.NewCDP(uint64(2), addrs[1], sdk.NewCoin("xrp", sdkmath.NewInt(100000000)), "xrp-a", sdk.NewCoin("usdx", sdkmath.NewInt(10000000)), tmtime.Canonical(time.Now()), sdk.OneDec()) - c3 := types.NewCDP(uint64(3), addrs[1], sdk.NewCoin("btc", sdkmath.NewInt(1000000000)), "btc-a", sdk.NewCoin("usdx", sdkmath.NewInt(10000000)), tmtime.Canonical(time.Now()), sdk.OneDec()) - c4 := types.NewCDP(uint64(4), addrs[2], sdk.NewCoin("xrp", sdkmath.NewInt(1000000000)), "xrp-a", sdk.NewCoin("usdx", sdkmath.NewInt(50000000)), tmtime.Canonical(time.Now()), sdk.OneDec()) + c1 := types.NewCDP(uint64(1), addrs[0], sdk.NewCoin("xrp", sdkmath.NewInt(100000000)), "xrp-a", sdk.NewCoin("usdx", sdkmath.NewInt(8000000)), tmtime.Canonical(time.Now()), sdkmath.LegacyOneDec()) + c2 := types.NewCDP(uint64(2), addrs[1], sdk.NewCoin("xrp", sdkmath.NewInt(100000000)), "xrp-a", sdk.NewCoin("usdx", sdkmath.NewInt(10000000)), tmtime.Canonical(time.Now()), sdkmath.LegacyOneDec()) + c3 := types.NewCDP(uint64(3), addrs[1], sdk.NewCoin("btc", sdkmath.NewInt(1000000000)), "btc-a", sdk.NewCoin("usdx", sdkmath.NewInt(10000000)), tmtime.Canonical(time.Now()), sdkmath.LegacyOneDec()) + c4 := types.NewCDP(uint64(4), addrs[2], sdk.NewCoin("xrp", sdkmath.NewInt(1000000000)), "xrp-a", sdk.NewCoin("usdx", sdkmath.NewInt(50000000)), tmtime.Canonical(time.Now()), sdkmath.LegacyOneDec()) cdps = append(cdps, c1, c2, c3, c4) return } diff --git a/x/cdp/keeper/auctions.go b/x/cdp/keeper/auctions.go index 7ab0b600b4..2f2cb9bc2d 100644 --- a/x/cdp/keeper/auctions.go +++ b/x/cdp/keeper/auctions.go @@ -1,6 +1,7 @@ package keeper import ( + "context" sdkmath "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" @@ -13,12 +14,13 @@ const ( ) // AuctionCollateral creates auctions from the input deposits which attempt to raise the corresponding amount of debt -func (k Keeper) AuctionCollateral(ctx sdk.Context, deposits types.Deposits, collateralType string, debt sdkmath.Int, bidDenom string) error { +func (k Keeper) AuctionCollateral(ctx context.Context, deposits types.Deposits, collateralType string, debt sdkmath.Int, bidDenom string) error { auctionSize := k.getAuctionSize(ctx, collateralType) totalCollateral := deposits.SumCollateral() + sdkCtx := sdk.UnwrapSDKContext(ctx) for _, deposit := range deposits { - debtCoveredByDeposit := (sdk.NewDecFromInt(deposit.Amount.Amount).Quo(sdk.NewDecFromInt(totalCollateral))).Mul(sdk.NewDecFromInt(debt)).RoundInt() - if err := k.CreateAuctionsFromDeposit(ctx, deposit.Amount, collateralType, deposit.Depositor, debtCoveredByDeposit, auctionSize, bidDenom); err != nil { + debtCoveredByDeposit := (sdkmath.LegacyNewDecFromInt(deposit.Amount.Amount).Quo(sdkmath.LegacyNewDecFromInt(totalCollateral))).Mul(sdkmath.LegacyNewDecFromInt(debt)).RoundInt() + if err := k.CreateAuctionsFromDeposit(sdkCtx, deposit.Amount, collateralType, deposit.Depositor, debtCoveredByDeposit, auctionSize, bidDenom); err != nil { return err } } @@ -50,8 +52,8 @@ func (k Keeper) CreateAuctionsFromDeposit( // if last auction has larger rounding error, then allocate one debt to last auction first // follows the largest remainder method https://en.wikipedia.org/wiki/Largest_remainder_method if lastAuctionError.GT(wholeAuctionError) { - lastAuctionDebt = lastAuctionDebt.Add(sdk.OneInt()) - unallocatedDebt = unallocatedDebt.Sub(sdk.OneInt()) + lastAuctionDebt = lastAuctionDebt.Add(sdkmath.OneInt()) + unallocatedDebt = unallocatedDebt.Sub(sdkmath.OneInt()) } debtDenom := k.GetDebtDenom(ctx) @@ -63,8 +65,8 @@ func (k Keeper) CreateAuctionsFromDeposit( // distribute unallocated debt left over starting with first auction created if unallocatedDebt.IsPositive() { - debtAmount = debtAmount.Add(sdk.OneInt()) - unallocatedDebt = unallocatedDebt.Sub(sdk.OneInt()) + debtAmount = debtAmount.Add(sdkmath.OneInt()) + unallocatedDebt = unallocatedDebt.Sub(sdkmath.OneInt()) } penalty := k.ApplyLiquidationPenalty(ctx, collateralType, debtAmount) @@ -88,8 +90,8 @@ func (k Keeper) CreateAuctionsFromDeposit( // then unallocatedDebt will be zero since we will have already distributed // all of the unallocated debt if unallocatedDebt.IsPositive() { - lastAuctionDebt = lastAuctionDebt.Add(sdk.OneInt()) - unallocatedDebt = unallocatedDebt.Sub(sdk.OneInt()) + lastAuctionDebt = lastAuctionDebt.Add(sdkmath.OneInt()) + unallocatedDebt = unallocatedDebt.Sub(sdkmath.OneInt()) } penalty := k.ApplyLiquidationPenalty(ctx, collateralType, lastAuctionDebt) @@ -105,16 +107,18 @@ func (k Keeper) CreateAuctionsFromDeposit( // NetSurplusAndDebt burns surplus and debt coins equal to the minimum of surplus and debt balances held by the liquidator module account // for example, if there is 1000 debt and 100 surplus, 100 surplus and 100 debt are burned, netting to 900 debt -func (k Keeper) NetSurplusAndDebt(ctx sdk.Context) error { +func (k Keeper) NetSurplusAndDebt(ctx context.Context) error { totalSurplus := k.GetTotalSurplus(ctx, types.LiquidatorMacc) debt := k.GetTotalDebt(ctx, types.LiquidatorMacc) - netAmount := sdk.MinInt(totalSurplus, debt) + netAmount := sdkmath.MinInt(totalSurplus, debt) if netAmount.IsZero() { return nil } + sdkCtx := sdk.UnwrapSDKContext(ctx) + // burn debt coins equal to netAmount - err := k.bankKeeper.BurnCoins(ctx, types.LiquidatorMacc, sdk.NewCoins(sdk.NewCoin(k.GetDebtDenom(ctx), netAmount))) + err := k.bankKeeper.BurnCoins(ctx, types.LiquidatorMacc, sdk.NewCoins(sdk.NewCoin(k.GetDebtDenom(sdkCtx), netAmount))) if err != nil { return err } @@ -123,37 +127,40 @@ func (k Keeper) NetSurplusAndDebt(ctx sdk.Context) error { dp := k.GetParams(ctx).DebtParam liquidatorAcc := k.accountKeeper.GetModuleAccount(ctx, types.LiquidatorMacc) balance := k.bankKeeper.GetBalance(ctx, liquidatorAcc.GetAddress(), dp.Denom).Amount - burnAmount := sdk.MinInt(balance, netAmount) + burnAmount := sdkmath.MinInt(balance, netAmount) return k.bankKeeper.BurnCoins(ctx, types.LiquidatorMacc, sdk.NewCoins(sdk.NewCoin(dp.Denom, burnAmount))) } // GetTotalSurplus returns the total amount of surplus tokens held by the liquidator module account -func (k Keeper) GetTotalSurplus(ctx sdk.Context, accountName string) sdkmath.Int { +func (k Keeper) GetTotalSurplus(ctx context.Context, accountName string) sdkmath.Int { acc := k.accountKeeper.GetModuleAccount(ctx, accountName) dp := k.GetParams(ctx).DebtParam return k.bankKeeper.GetBalance(ctx, acc.GetAddress(), dp.Denom).Amount } // GetTotalDebt returns the total amount of debt tokens held by the liquidator module account -func (k Keeper) GetTotalDebt(ctx sdk.Context, accountName string) sdkmath.Int { +func (k Keeper) GetTotalDebt(ctx context.Context, accountName string) sdkmath.Int { acc := k.accountKeeper.GetModuleAccount(ctx, accountName) - return k.bankKeeper.GetBalance(ctx, acc.GetAddress(), k.GetDebtDenom(ctx)).Amount + sdkCtx := sdk.UnwrapSDKContext(ctx) + return k.bankKeeper.GetBalance(ctx, acc.GetAddress(), k.GetDebtDenom(sdkCtx)).Amount } // RunSurplusAndDebtAuctions nets the surplus and debt balances and then creates surplus or debt auctions if the remaining balance is above the auction threshold parameter -func (k Keeper) RunSurplusAndDebtAuctions(ctx sdk.Context) error { +func (k Keeper) RunSurplusAndDebtAuctions(ctx context.Context) error { if err := k.NetSurplusAndDebt(ctx); err != nil { return err } remainingDebt := k.GetTotalDebt(ctx, types.LiquidatorMacc) params := k.GetParams(ctx) + sdkCtx := sdk.UnwrapSDKContext(ctx) + if remainingDebt.GTE(params.DebtAuctionThreshold) { - debtLot := sdk.NewCoin(k.GetDebtDenom(ctx), params.DebtAuctionLot) + debtLot := sdk.NewCoin(k.GetDebtDenom(sdkCtx), params.DebtAuctionLot) bidCoin := sdk.NewCoin(params.DebtParam.Denom, debtLot.Amount) - initialLot := sdk.NewCoin(k.GetGovDenom(ctx), debtLot.Amount.Mul(sdkmath.NewInt(dump))) + initialLot := sdk.NewCoin(k.GetGovDenom(sdkCtx), debtLot.Amount.Mul(sdkmath.NewInt(dump))) - _, err := k.auctionKeeper.StartDebtAuction(ctx, types.LiquidatorMacc, bidCoin, initialLot, debtLot) + _, err := k.auctionKeeper.StartDebtAuction(sdkCtx, types.LiquidatorMacc, bidCoin, initialLot, debtLot) if err != nil { return err } @@ -165,7 +172,7 @@ func (k Keeper) RunSurplusAndDebtAuctions(ctx sdk.Context) error { return nil } - surplusLot := sdk.NewCoin(params.DebtParam.Denom, sdk.MinInt(params.SurplusAuctionLot, surplus)) - _, err := k.auctionKeeper.StartSurplusAuction(ctx, types.LiquidatorMacc, surplusLot, k.GetGovDenom(ctx)) + surplusLot := sdk.NewCoin(params.DebtParam.Denom, sdkmath.MinInt(params.SurplusAuctionLot, surplus)) + _, err := k.auctionKeeper.StartSurplusAuction(sdkCtx, types.LiquidatorMacc, surplusLot, k.GetGovDenom(sdkCtx)) return err } diff --git a/x/cdp/keeper/auctions_test.go b/x/cdp/keeper/auctions_test.go index ba230542d9..4be1053d70 100644 --- a/x/cdp/keeper/auctions_test.go +++ b/x/cdp/keeper/auctions_test.go @@ -14,7 +14,6 @@ import ( "github.com/stretchr/testify/suite" "github.com/cometbft/cometbft/crypto" - tmproto "github.com/cometbft/cometbft/proto/tendermint/types" tmtime "github.com/cometbft/cometbft/types/time" ) @@ -32,7 +31,7 @@ func (suite *AuctionTestSuite) SetupTest() { app.SetBech32AddressPrefixes(config) tApp := app.NewTestApp() taddr := sdk.AccAddress(crypto.AddressHash([]byte("KavaTestUser1"))) - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) authGS := app.NewFundedGenStateWithSameCoins(tApp.AppCodec(), cs(c("usdx", 21000000000)), []sdk.AccAddress{taddr}) tApp.InitializeFromGenesisStates( authGS, diff --git a/x/cdp/keeper/cdp.go b/x/cdp/keeper/cdp.go index ddd78bf290..918378b0cb 100644 --- a/x/cdp/keeper/cdp.go +++ b/x/cdp/keeper/cdp.go @@ -1,106 +1,124 @@ package keeper import ( + "context" + sdkmath "cosmossdk.io/math" "fmt" "sort" errorsmod "cosmossdk.io/errors" - "github.com/cosmos/cosmos-sdk/store/prefix" + "cosmossdk.io/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/kava-labs/kava/x/cdp/types" ) // AddCdp adds a cdp for a specific owner and collateral type -func (k Keeper) AddCdp(ctx sdk.Context, owner sdk.AccAddress, collateral sdk.Coin, principal sdk.Coin, collateralType string) error { +func (k Keeper) AddCdp(ctx context.Context, owner sdk.AccAddress, collateral sdk.Coin, principal sdk.Coin, collateralType string) error { // validation - err := k.ValidateCollateral(ctx, collateral, collateralType) + fmt.Println("AddCdp", collateralType) + sdkCtx := sdk.UnwrapSDKContext(ctx) + fmt.Println("0", sdkCtx.BlockHeader()) + fmt.Println("AddCdp 0 params: ", k.GetParams(sdkCtx)) + err := k.ValidateCollateral(sdkCtx, collateral, collateralType) + fmt.Println("1", err) if err != nil { return err } - err = k.ValidateBalance(ctx, collateral, owner) + err = k.ValidateBalance(sdkCtx, collateral, owner) + fmt.Println("2", err) if err != nil { return err } _, found := k.GetCdpByOwnerAndCollateralType(ctx, owner, collateralType) + fmt.Println("3", found) if found { return errorsmod.Wrapf(types.ErrCdpAlreadyExists, "owner %s, denom %s", owner, collateral.Denom) } - err = k.ValidatePrincipalAdd(ctx, principal) + err = k.ValidatePrincipalAdd(sdkCtx, principal) + fmt.Println("4", err) if err != nil { return err } - err = k.ValidateDebtLimit(ctx, collateralType, principal) + err = k.ValidateDebtLimit(sdkCtx, collateralType, principal) + fmt.Println("5", err) if err != nil { return err } - err = k.ValidateCollateralizationRatio(ctx, collateral, collateralType, principal, sdk.NewCoin(principal.Denom, sdk.ZeroInt())) + err = k.ValidateCollateralizationRatio(sdkCtx, collateral, collateralType, principal, sdk.NewCoin(principal.Denom, sdkmath.ZeroInt())) + fmt.Println("6", err) if err != nil { return err } // send coins from the owners account to the cdp module - id := k.GetNextCdpID(ctx) + id := k.GetNextCdpID(sdkCtx) interestFactor, found := k.GetInterestFactor(ctx, collateralType) + fmt.Println("7", interestFactor, found) if !found { - interestFactor = sdk.OneDec() + interestFactor = sdkmath.LegacyOneDec() k.SetInterestFactor(ctx, collateralType, interestFactor) } - cdp := types.NewCDP(id, owner, collateral, collateralType, principal, ctx.BlockHeader().Time, interestFactor) + cdp := types.NewCDP(id, owner, collateral, collateralType, principal, sdkCtx.BlockHeader().Time, interestFactor) deposit := types.NewDeposit(cdp.ID, owner, collateral) err = k.bankKeeper.SendCoinsFromAccountToModule(ctx, owner, types.ModuleName, sdk.NewCoins(collateral)) + fmt.Println("8", err) if err != nil { return err } // mint the principal and send to the owners account err = k.bankKeeper.MintCoins(ctx, types.ModuleName, sdk.NewCoins(principal)) + fmt.Println("9", err) if err != nil { panic(err) } err = k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, owner, sdk.NewCoins(principal)) + fmt.Println("10", err) if err != nil { panic(err) } // mint the corresponding amount of debt coins - err = k.MintDebtCoins(ctx, types.ModuleName, k.GetDebtDenom(ctx), principal) + err = k.MintDebtCoins(ctx, types.ModuleName, k.GetDebtDenom(sdkCtx), principal) + fmt.Println("11", err) if err != nil { panic(err) } // update total principal for input collateral type - k.IncrementTotalPrincipal(ctx, collateralType, principal) + k.IncrementTotalPrincipal(sdkCtx, collateralType, principal) // set the cdp, deposit, and indexes in the store - collateralToDebtRatio := k.CalculateCollateralToDebtRatio(ctx, collateral, cdp.Type, principal) + collateralToDebtRatio := k.CalculateCollateralToDebtRatio(sdkCtx, collateral, cdp.Type, principal) err = k.SetCdpAndCollateralRatioIndex(ctx, cdp, collateralToDebtRatio) + fmt.Println("12", err) if err != nil { return err } - k.IndexCdpByOwner(ctx, cdp) + k.IndexCdpByOwner(sdkCtx, cdp) k.SetDeposit(ctx, deposit) - k.SetNextCdpID(ctx, id+1) + k.SetNextCdpID(sdkCtx, id+1) - k.hooks.AfterCDPCreated(ctx, cdp) + k.hooks.AfterCDPCreated(sdkCtx, cdp) // emit events for cdp creation, deposit, and draw - ctx.EventManager().EmitEvent( + sdkCtx.EventManager().EmitEvent( sdk.NewEvent( types.EventTypeCreateCdp, sdk.NewAttribute(types.AttributeKeyCdpID, fmt.Sprintf("%d", cdp.ID)), ), ) - ctx.EventManager().EmitEvent( + sdkCtx.EventManager().EmitEvent( sdk.NewEvent( types.EventTypeCdpDeposit, sdk.NewAttribute(sdk.AttributeKeyAmount, collateral.String()), sdk.NewAttribute(types.AttributeKeyCdpID, fmt.Sprintf("%d", cdp.ID)), ), ) - ctx.EventManager().EmitEvent( + sdkCtx.EventManager().EmitEvent( sdk.NewEvent( types.EventTypeCdpDraw, sdk.NewAttribute(sdk.AttributeKeyAmount, principal.String()), @@ -112,67 +130,73 @@ func (k Keeper) AddCdp(ctx sdk.Context, owner sdk.AccAddress, collateral sdk.Coi } // UpdateCdpAndCollateralRatioIndex updates the state of an existing cdp in the store by replacing the old index values and updating the store to the latest cdp object values -func (k Keeper) UpdateCdpAndCollateralRatioIndex(ctx sdk.Context, cdp types.CDP, ratio sdk.Dec) error { +func (k Keeper) UpdateCdpAndCollateralRatioIndex(ctx context.Context, cdp types.CDP, ratio sdkmath.LegacyDec) error { err := k.removeOldCollateralRatioIndex(ctx, cdp.Type, cdp.ID) if err != nil { return err } - err = k.SetCDP(ctx, cdp) + sdkCtx := sdk.UnwrapSDKContext(ctx) + err = k.SetCDP(sdkCtx, cdp) if err != nil { return err } - k.IndexCdpByCollateralRatio(ctx, cdp.Type, cdp.ID, ratio) + k.IndexCdpByCollateralRatio(sdkCtx, cdp.Type, cdp.ID, ratio) return nil } // DeleteCdpAndCollateralRatioIndex deletes an existing cdp in the store by removing the old index value and deleting the cdp object from the store -func (k Keeper) DeleteCdpAndCollateralRatioIndex(ctx sdk.Context, cdp types.CDP) error { +func (k Keeper) DeleteCdpAndCollateralRatioIndex(ctx context.Context, cdp types.CDP) error { err := k.removeOldCollateralRatioIndex(ctx, cdp.Type, cdp.ID) if err != nil { return err } - return k.DeleteCDP(ctx, cdp) + sdkCtx := sdk.UnwrapSDKContext(ctx) + + return k.DeleteCDP(sdkCtx, cdp) } // SetCdpAndCollateralRatioIndex sets the cdp and collateral ratio index in the store -func (k Keeper) SetCdpAndCollateralRatioIndex(ctx sdk.Context, cdp types.CDP, ratio sdk.Dec) error { - err := k.SetCDP(ctx, cdp) +func (k Keeper) SetCdpAndCollateralRatioIndex(ctx context.Context, cdp types.CDP, ratio sdkmath.LegacyDec) error { + sdkCtx := sdk.UnwrapSDKContext(ctx) + err := k.SetCDP(sdkCtx, cdp) if err != nil { return err } - k.IndexCdpByCollateralRatio(ctx, cdp.Type, cdp.ID, ratio) + k.IndexCdpByCollateralRatio(sdkCtx, cdp.Type, cdp.ID, ratio) return nil } -func (k Keeper) removeOldCollateralRatioIndex(ctx sdk.Context, ctype string, id uint64) error { +func (k Keeper) removeOldCollateralRatioIndex(ctx context.Context, ctype string, id uint64) error { storedCDP, found := k.GetCDP(ctx, ctype, id) if !found { return errorsmod.Wrapf(types.ErrCdpNotFound, "%d", storedCDP.ID) } - oldCollateralToDebtRatio := k.CalculateCollateralToDebtRatio(ctx, storedCDP.Collateral, storedCDP.Type, storedCDP.GetTotalPrincipal()) - k.RemoveCdpCollateralRatioIndex(ctx, storedCDP.Type, storedCDP.ID, oldCollateralToDebtRatio) + + sdkCtx := sdk.UnwrapSDKContext(ctx) + oldCollateralToDebtRatio := k.CalculateCollateralToDebtRatio(sdkCtx, storedCDP.Collateral, storedCDP.Type, storedCDP.GetTotalPrincipal()) + k.RemoveCdpCollateralRatioIndex(sdkCtx, storedCDP.Type, storedCDP.ID, oldCollateralToDebtRatio) return nil } // MintDebtCoins mints debt coins in the cdp module account -func (k Keeper) MintDebtCoins(ctx sdk.Context, moduleAccount string, denom string, principalCoins sdk.Coin) error { +func (k Keeper) MintDebtCoins(ctx context.Context, moduleAccount string, denom string, principalCoins sdk.Coin) error { debtCoins := sdk.NewCoins(sdk.NewCoin(denom, principalCoins.Amount)) return k.bankKeeper.MintCoins(ctx, moduleAccount, debtCoins) } // BurnDebtCoins burns debt coins from the cdp module account -func (k Keeper) BurnDebtCoins(ctx sdk.Context, moduleAccount string, denom string, paymentCoins sdk.Coin) error { +func (k Keeper) BurnDebtCoins(ctx context.Context, moduleAccount string, denom string, paymentCoins sdk.Coin) error { macc := k.accountKeeper.GetModuleAccount(ctx, moduleAccount) maxBurnableAmount := k.bankKeeper.GetBalance(ctx, macc.GetAddress(), denom).Amount // check that the requested burn is not greater than the mod account balance - debtCoins := sdk.NewCoins(sdk.NewCoin(denom, sdk.MinInt(paymentCoins.Amount, maxBurnableAmount))) + debtCoins := sdk.NewCoins(sdk.NewCoin(denom, sdkmath.MinInt(paymentCoins.Amount, maxBurnableAmount))) return k.bankKeeper.BurnCoins(ctx, moduleAccount, debtCoins) } // GetCdpID returns the id of the cdp corresponding to a specific owner and collateral denom -func (k Keeper) GetCdpID(ctx sdk.Context, owner sdk.AccAddress, collateralType string) (uint64, bool) { +func (k Keeper) GetCdpID(ctx context.Context, owner sdk.AccAddress, collateralType string) (uint64, bool) { cdpIDs, found := k.GetCdpIdsByOwner(ctx, owner) if !found { return 0, false @@ -187,8 +211,9 @@ func (k Keeper) GetCdpID(ctx sdk.Context, owner sdk.AccAddress, collateralType s } // GetCdpIdsByOwner returns all the ids of cdps corresponding to a particular owner -func (k Keeper) GetCdpIdsByOwner(ctx sdk.Context, owner sdk.AccAddress) ([]uint64, bool) { - store := prefix.NewStore(ctx.KVStore(k.key), types.CdpIDKeyPrefix) +func (k Keeper) GetCdpIdsByOwner(ctx context.Context, owner sdk.AccAddress) ([]uint64, bool) { + sdkCtx := sdk.UnwrapSDKContext(ctx) + store := prefix.NewStore(sdkCtx.KVStore(k.key), types.CdpIDKeyPrefix) bz := store.Get(owner) if bz == nil { return []uint64{}, false @@ -200,7 +225,7 @@ func (k Keeper) GetCdpIdsByOwner(ctx sdk.Context, owner sdk.AccAddress) ([]uint6 } // GetCdpByOwnerAndCollateralType queries cdps owned by owner and returns the cdp with matching denom -func (k Keeper) GetCdpByOwnerAndCollateralType(ctx sdk.Context, owner sdk.AccAddress, collateralType string) (types.CDP, bool) { +func (k Keeper) GetCdpByOwnerAndCollateralType(ctx context.Context, owner sdk.AccAddress, collateralType string) (types.CDP, bool) { cdpIDs, found := k.GetCdpIdsByOwner(ctx, owner) if !found { return types.CDP{}, false @@ -215,9 +240,10 @@ func (k Keeper) GetCdpByOwnerAndCollateralType(ctx sdk.Context, owner sdk.AccAdd } // GetCDP returns the cdp associated with a particular collateral denom and id -func (k Keeper) GetCDP(ctx sdk.Context, collateralType string, cdpID uint64) (types.CDP, bool) { +func (k Keeper) GetCDP(ctx context.Context, collateralType string, cdpID uint64) (types.CDP, bool) { // get store - store := prefix.NewStore(ctx.KVStore(k.key), types.CdpKeyPrefix) + sdkCtx := sdk.UnwrapSDKContext(ctx) + store := prefix.NewStore(sdkCtx.KVStore(k.key), types.CdpKeyPrefix) _, found := k.GetCollateral(ctx, collateralType) if !found { return types.CDP{}, false @@ -275,7 +301,7 @@ func (k Keeper) GetAllCdpsByCollateralType(ctx sdk.Context, collateralType strin } // GetAllCdpsByCollateralTypeAndRatio returns all cdps of a particular collateral type and below a certain collateralization ratio -func (k Keeper) GetAllCdpsByCollateralTypeAndRatio(ctx sdk.Context, collateralType string, targetRatio sdk.Dec) (cdps types.CDPs) { +func (k Keeper) GetAllCdpsByCollateralTypeAndRatio(ctx sdk.Context, collateralType string, targetRatio sdkmath.LegacyDec) (cdps types.CDPs) { k.IterateCdpsByCollateralRatio(ctx, collateralType, targetRatio, func(cdp types.CDP) bool { cdps = append(cdps, cdp) return false @@ -342,7 +368,7 @@ func (k Keeper) RemoveCdpOwnerIndex(ctx sdk.Context, cdp types.CDP) { } // IndexCdpByCollateralRatio sets the cdp id in the store, indexed by the collateral type and collateral to debt ratio -func (k Keeper) IndexCdpByCollateralRatio(ctx sdk.Context, collateralType string, id uint64, collateralRatio sdk.Dec) { +func (k Keeper) IndexCdpByCollateralRatio(ctx sdk.Context, collateralType string, id uint64, collateralRatio sdkmath.LegacyDec) { store := prefix.NewStore(ctx.KVStore(k.key), types.CollateralRatioIndexPrefix) _, found := k.GetCollateral(ctx, collateralType) if !found { @@ -352,7 +378,7 @@ func (k Keeper) IndexCdpByCollateralRatio(ctx sdk.Context, collateralType string } // RemoveCdpCollateralRatioIndex deletes the cdp id from the store's index of cdps by collateral type and collateral to debt ratio -func (k Keeper) RemoveCdpCollateralRatioIndex(ctx sdk.Context, collateralType string, id uint64, collateralRatio sdk.Dec) { +func (k Keeper) RemoveCdpCollateralRatioIndex(ctx sdk.Context, collateralType string, id uint64, collateralRatio sdkmath.LegacyDec) { store := prefix.NewStore(ctx.KVStore(k.key), types.CollateralRatioIndexPrefix) _, found := k.GetCollateral(ctx, collateralType) if !found { @@ -395,7 +421,9 @@ func (k Keeper) SetGovDenom(ctx sdk.Context, denom string) { // ValidateCollateral validates that a collateral is valid for use in cdps func (k Keeper) ValidateCollateral(ctx sdk.Context, collateral sdk.Coin, collateralType string) error { + fmt.Println("ValidateCollateral", collateralType) cp, found := k.GetCollateral(ctx, collateralType) + fmt.Println("1", cp, found) if !found { return errorsmod.Wrap(types.ErrCollateralNotSupported, collateral.Denom) } @@ -403,10 +431,12 @@ func (k Keeper) ValidateCollateral(ctx sdk.Context, collateral sdk.Coin, collate return errorsmod.Wrapf(types.ErrInvalidCollateral, "collateral type: %s expected denom: %s got: %s", collateralType, cp.Denom, collateral.Denom) } ok := k.GetMarketStatus(ctx, cp.SpotMarketID) + fmt.Println("2", ok) if !ok { return errorsmod.Wrap(types.ErrPricefeedDown, collateral.Denom) } ok = k.GetMarketStatus(ctx, cp.LiquidationMarketID) + fmt.Println("3", ok) if !ok { return errorsmod.Wrap(types.ErrPricefeedDown, collateral.Denom) } @@ -483,11 +513,11 @@ func (k Keeper) ValidateBalance(ctx sdk.Context, amount sdk.Coin, sender sdk.Acc } // CalculateCollateralToDebtRatio returns the collateral to debt ratio of the input collateral and debt amounts -func (k Keeper) CalculateCollateralToDebtRatio(ctx sdk.Context, collateral sdk.Coin, collateralType string, debt sdk.Coin) sdk.Dec { +func (k Keeper) CalculateCollateralToDebtRatio(ctx sdk.Context, collateral sdk.Coin, collateralType string, debt sdk.Coin) sdkmath.LegacyDec { debtTotal := k.convertDebtToBaseUnits(ctx, debt) if debtTotal.IsZero() || debtTotal.GTE(types.MaxSortableDec) { - return types.MaxSortableDec.Sub(sdk.SmallestDec()) + return types.MaxSortableDec.Sub(sdkmath.LegacySmallestDec()) } collateralBaseUnits := k.convertCollateralToBaseUnits(ctx, collateral, collateralType) @@ -515,7 +545,7 @@ func (k Keeper) LoadAugmentedCDP(ctx sdk.Context, cdp types.CDP) types.Augmented } // convert collateral value to debt coin totalDebt := cdp.GetTotalPrincipal().Amount - collateralValueInDebtDenom := sdk.NewDecFromInt(totalDebt).Mul(collateralizationRatio) + collateralValueInDebtDenom := sdkmath.LegacyNewDecFromInt(totalDebt).Mul(collateralizationRatio) collateralValueInDebt := sdk.NewCoin(cdp.Principal.Denom, collateralValueInDebtDenom.RoundInt()) // create new augmuented cdp augmentedCDP := types.NewAugmentedCDP(cdp, collateralValueInDebt, collateralizationRatio) @@ -552,16 +582,16 @@ func (k Keeper) LoadCDPResponse(ctx sdk.Context, cdp types.CDP) types.CDPRespons } // convert collateral value to debt coin totalDebt := cdp.GetTotalPrincipal().Amount - collateralValueInDebtDenom := sdk.NewDecFromInt(totalDebt).Mul(collateralizationRatio) + collateralValueInDebtDenom := sdkmath.LegacyNewDecFromInt(totalDebt).Mul(collateralizationRatio) collateralValueInDebt := sdk.NewCoin(cdp.Principal.Denom, collateralValueInDebtDenom.RoundInt()) // create new cdp response return types.NewCDPResponse(cdp, collateralValueInDebt, collateralizationRatio) } // CalculateCollateralizationRatio returns the collateralization ratio of the input collateral to the input debt plus fees -func (k Keeper) CalculateCollateralizationRatio(ctx sdk.Context, collateral sdk.Coin, collateralType string, principal sdk.Coin, fees sdk.Coin, pfType pricefeedType) (sdk.Dec, error) { +func (k Keeper) CalculateCollateralizationRatio(ctx sdk.Context, collateral sdk.Coin, collateralType string, principal sdk.Coin, fees sdk.Coin, pfType pricefeedType) (sdkmath.LegacyDec, error) { if collateral.IsZero() { - return sdk.ZeroDec(), nil + return sdkmath.LegacyZeroDec(), nil } var marketID string switch pfType { @@ -570,12 +600,12 @@ func (k Keeper) CalculateCollateralizationRatio(ctx sdk.Context, collateral sdk. case liquidation: marketID = k.getliquidationMarketID(ctx, collateralType) default: - return sdk.Dec{}, pfType.IsValid() + return sdkmath.LegacyDec{}, pfType.IsValid() } price, err := k.pricefeedKeeper.GetCurrentPrice(ctx, marketID) if err != nil { - return sdk.Dec{}, err + return sdkmath.LegacyDec{}, err } collateralBaseUnits := k.convertCollateralToBaseUnits(ctx, collateral, collateralType) collateralValue := collateralBaseUnits.Mul(price.Price) @@ -590,7 +620,7 @@ func (k Keeper) CalculateCollateralizationRatio(ctx sdk.Context, collateral sdk. } // CalculateCollateralizationRatioFromAbsoluteRatio takes a coin's denom and an absolute ratio and returns the respective collateralization ratio -func (k Keeper) CalculateCollateralizationRatioFromAbsoluteRatio(ctx sdk.Context, collateralType string, absoluteRatio sdk.Dec, pfType pricefeedType) (sdk.Dec, error) { +func (k Keeper) CalculateCollateralizationRatioFromAbsoluteRatio(ctx sdk.Context, collateralType string, absoluteRatio sdkmath.LegacyDec, pfType pricefeedType) (sdkmath.LegacyDec, error) { // get price of collateral var marketID string switch pfType { @@ -599,12 +629,12 @@ func (k Keeper) CalculateCollateralizationRatioFromAbsoluteRatio(ctx sdk.Context case liquidation: marketID = k.getliquidationMarketID(ctx, collateralType) default: - return sdk.Dec{}, pfType.IsValid() + return sdkmath.LegacyDec{}, pfType.IsValid() } price, err := k.pricefeedKeeper.GetCurrentPrice(ctx, marketID) if err != nil { - return sdk.Dec{}, err + return sdkmath.LegacyDec{}, err } // convert absolute ratio to collateralization ratio respectiveCollateralRatio := absoluteRatio.Quo(price.Price) @@ -640,15 +670,15 @@ func (k Keeper) UpdatePricefeedStatus(ctx sdk.Context, marketID string) (ok bool } // converts the input collateral to base units (ie multiplies the input by 10^(-ConversionFactor)) -func (k Keeper) convertCollateralToBaseUnits(ctx sdk.Context, collateral sdk.Coin, collateralType string) (baseUnits sdk.Dec) { +func (k Keeper) convertCollateralToBaseUnits(ctx sdk.Context, collateral sdk.Coin, collateralType string) (baseUnits sdkmath.LegacyDec) { cp, _ := k.GetCollateral(ctx, collateralType) - return sdk.NewDecFromInt(collateral.Amount).Mul(sdk.NewDecFromIntWithPrec(sdk.OneInt(), cp.ConversionFactor.Int64())) + return sdkmath.LegacyNewDecFromInt(collateral.Amount).Mul(sdkmath.LegacyNewDecFromIntWithPrec(sdkmath.OneInt(), cp.ConversionFactor.Int64())) } // converts the input debt to base units (ie multiplies the input by 10^(-ConversionFactor)) -func (k Keeper) convertDebtToBaseUnits(ctx sdk.Context, debt sdk.Coin) (baseUnits sdk.Dec) { +func (k Keeper) convertDebtToBaseUnits(ctx sdk.Context, debt sdk.Coin) (baseUnits sdkmath.LegacyDec) { dp, _ := k.GetDebtParam(ctx, debt.Denom) - return sdk.NewDecFromInt(debt.Amount).Mul(sdk.NewDecFromIntWithPrec(sdk.OneInt(), dp.ConversionFactor.Int64())) + return sdkmath.LegacyNewDecFromInt(debt.Amount).Mul(sdkmath.LegacyNewDecFromIntWithPrec(sdkmath.OneInt(), dp.ConversionFactor.Int64())) } type pricefeedType string diff --git a/x/cdp/keeper/cdp_test.go b/x/cdp/keeper/cdp_test.go index 9c4b5203bc..e3b97649ec 100644 --- a/x/cdp/keeper/cdp_test.go +++ b/x/cdp/keeper/cdp_test.go @@ -10,7 +10,6 @@ import ( sdkmath "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" - tmproto "github.com/cometbft/cometbft/proto/tendermint/types" tmtime "github.com/cometbft/cometbft/types/time" "github.com/kava-labs/kava/app" @@ -28,7 +27,7 @@ type CdpTestSuite struct { func (suite *CdpTestSuite) SetupTest() { tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) tApp.InitializeFromGenesisStates( NewPricefeedGenStateMulti(tApp.AppCodec()), NewCDPGenStateMulti(tApp.AppCodec()), @@ -134,7 +133,7 @@ func (suite *CdpTestSuite) TestGetNextCdpID() { func (suite *CdpTestSuite) TestGetSetCdp() { _, addrs := app.GeneratePrivKeyAddressPairs(1) - cdp := types.NewCDP(types.DefaultCdpStartingID, addrs[0], c("xrp", 1), "xrp-a", c("usdx", 1), tmtime.Canonical(time.Now()), sdk.OneDec()) + cdp := types.NewCDP(types.DefaultCdpStartingID, addrs[0], c("xrp", 1), "xrp-a", c("usdx", 1), tmtime.Canonical(time.Now()), sdkmath.LegacyOneDec()) err := suite.keeper.SetCDP(suite.ctx, cdp) suite.NoError(err) @@ -150,7 +149,7 @@ func (suite *CdpTestSuite) TestGetSetCdp() { func (suite *CdpTestSuite) TestGetSetCdpId() { _, addrs := app.GeneratePrivKeyAddressPairs(2) - cdp := types.NewCDP(types.DefaultCdpStartingID, addrs[0], c("xrp", 1), "xrp-a", c("usdx", 1), tmtime.Canonical(time.Now()), sdk.OneDec()) + cdp := types.NewCDP(types.DefaultCdpStartingID, addrs[0], c("xrp", 1), "xrp-a", c("usdx", 1), tmtime.Canonical(time.Now()), sdkmath.LegacyOneDec()) err := suite.keeper.SetCDP(suite.ctx, cdp) suite.NoError(err) suite.keeper.IndexCdpByOwner(suite.ctx, cdp) @@ -165,7 +164,7 @@ func (suite *CdpTestSuite) TestGetSetCdpId() { func (suite *CdpTestSuite) TestGetSetCdpByOwnerAndCollateralType() { _, addrs := app.GeneratePrivKeyAddressPairs(2) - cdp := types.NewCDP(types.DefaultCdpStartingID, addrs[0], c("xrp", 1), "xrp-a", c("usdx", 1), tmtime.Canonical(time.Now()), sdk.OneDec()) + cdp := types.NewCDP(types.DefaultCdpStartingID, addrs[0], c("xrp", 1), "xrp-a", c("usdx", 1), tmtime.Canonical(time.Now()), sdkmath.LegacyOneDec()) err := suite.keeper.SetCDP(suite.ctx, cdp) suite.NoError(err) suite.keeper.IndexCdpByOwner(suite.ctx, cdp) @@ -181,17 +180,17 @@ func (suite *CdpTestSuite) TestGetSetCdpByOwnerAndCollateralType() { func (suite *CdpTestSuite) TestCalculateCollateralToDebtRatio() { _, addrs := app.GeneratePrivKeyAddressPairs(1) - cdp := types.NewCDP(types.DefaultCdpStartingID, addrs[0], c("xrp", 3), "xrp-a", c("usdx", 1), tmtime.Canonical(time.Now()), sdk.OneDec()) + cdp := types.NewCDP(types.DefaultCdpStartingID, addrs[0], c("xrp", 3), "xrp-a", c("usdx", 1), tmtime.Canonical(time.Now()), sdkmath.LegacyOneDec()) cr := suite.keeper.CalculateCollateralToDebtRatio(suite.ctx, cdp.Collateral, cdp.Type, cdp.Principal) - suite.Equal(sdk.MustNewDecFromStr("3.0"), cr) - cdp = types.NewCDP(types.DefaultCdpStartingID, addrs[0], c("xrp", 1), "xrp-a", c("usdx", 2), tmtime.Canonical(time.Now()), sdk.OneDec()) + suite.Equal(sdkmath.LegacyMustNewDecFromStr("3.0"), cr) + cdp = types.NewCDP(types.DefaultCdpStartingID, addrs[0], c("xrp", 1), "xrp-a", c("usdx", 2), tmtime.Canonical(time.Now()), sdkmath.LegacyOneDec()) cr = suite.keeper.CalculateCollateralToDebtRatio(suite.ctx, cdp.Collateral, cdp.Type, cdp.Principal) - suite.Equal(sdk.MustNewDecFromStr("0.5"), cr) + suite.Equal(sdkmath.LegacyMustNewDecFromStr("0.5"), cr) } func (suite *CdpTestSuite) TestSetCdpByCollateralRatio() { _, addrs := app.GeneratePrivKeyAddressPairs(1) - cdp := types.NewCDP(types.DefaultCdpStartingID, addrs[0], c("xrp", 3), "xrp-a", c("usdx", 1), tmtime.Canonical(time.Now()), sdk.OneDec()) + cdp := types.NewCDP(types.DefaultCdpStartingID, addrs[0], c("xrp", 3), "xrp-a", c("usdx", 1), tmtime.Canonical(time.Now()), sdkmath.LegacyOneDec()) cr := suite.keeper.CalculateCollateralToDebtRatio(suite.ctx, cdp.Collateral, cdp.Type, cdp.Principal) suite.NotPanics(func() { suite.keeper.IndexCdpByCollateralRatio(suite.ctx, cdp.Type, cdp.ID, cr) }) } @@ -245,11 +244,11 @@ func (suite *CdpTestSuite) TestIterateCdpsByCollateralRatio() { } xrpCdps := suite.keeper.GetAllCdpsByCollateralTypeAndRatio(suite.ctx, "xrp-a", d("1.25")) suite.Equal(0, len(xrpCdps)) - xrpCdps = suite.keeper.GetAllCdpsByCollateralTypeAndRatio(suite.ctx, "xrp-a", d("1.25").Add(sdk.SmallestDec())) + xrpCdps = suite.keeper.GetAllCdpsByCollateralTypeAndRatio(suite.ctx, "xrp-a", d("1.25").Add(sdkmath.LegacySmallestDec())) suite.Equal(1, len(xrpCdps)) - xrpCdps = suite.keeper.GetAllCdpsByCollateralTypeAndRatio(suite.ctx, "xrp-a", d("2.0").Add(sdk.SmallestDec())) + xrpCdps = suite.keeper.GetAllCdpsByCollateralTypeAndRatio(suite.ctx, "xrp-a", d("2.0").Add(sdkmath.LegacySmallestDec())) suite.Equal(2, len(xrpCdps)) - xrpCdps = suite.keeper.GetAllCdpsByCollateralTypeAndRatio(suite.ctx, "xrp-a", d("100.0").Add(sdk.SmallestDec())) + xrpCdps = suite.keeper.GetAllCdpsByCollateralTypeAndRatio(suite.ctx, "xrp-a", d("100.0").Add(sdkmath.LegacySmallestDec())) suite.Equal(3, len(xrpCdps)) suite.NoError(suite.keeper.DeleteCDP(suite.ctx, cdps[0])) @@ -257,7 +256,7 @@ func (suite *CdpTestSuite) TestIterateCdpsByCollateralRatio() { suite.keeper.RemoveCdpOwnerIndex(suite.ctx, cdps[0]) cr := suite.keeper.CalculateCollateralToDebtRatio(suite.ctx, cdps[0].Collateral, cdps[0].Type, cdps[0].Principal) suite.keeper.RemoveCdpCollateralRatioIndex(suite.ctx, cdps[0].Type, cdps[0].ID, cr) - xrpCdps = suite.keeper.GetAllCdpsByCollateralTypeAndRatio(suite.ctx, "xrp-a", d("2.0").Add(sdk.SmallestDec())) + xrpCdps = suite.keeper.GetAllCdpsByCollateralTypeAndRatio(suite.ctx, "xrp-a", d("2.0").Add(sdkmath.LegacySmallestDec())) suite.Equal(1, len(xrpCdps)) } diff --git a/x/cdp/keeper/deposit.go b/x/cdp/keeper/deposit.go index a2edf65df2..894df9a0c8 100644 --- a/x/cdp/keeper/deposit.go +++ b/x/cdp/keeper/deposit.go @@ -1,19 +1,22 @@ package keeper import ( + "context" + storetypes "cosmossdk.io/store/types" "fmt" errorsmod "cosmossdk.io/errors" - "github.com/cosmos/cosmos-sdk/store/prefix" + "cosmossdk.io/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/kava-labs/kava/x/cdp/types" ) // DepositCollateral adds collateral to a cdp -func (k Keeper) DepositCollateral(ctx sdk.Context, owner, depositor sdk.AccAddress, collateral sdk.Coin, collateralType string) error { +func (k Keeper) DepositCollateral(ctx context.Context, owner, depositor sdk.AccAddress, collateral sdk.Coin, collateralType string) error { + sdkCtx := sdk.UnwrapSDKContext(ctx) // check that collateral exists and has a functioning pricefeed - err := k.ValidateCollateral(ctx, collateral, collateralType) + err := k.ValidateCollateral(sdkCtx, collateral, collateralType) if err != nil { return err } @@ -21,11 +24,11 @@ func (k Keeper) DepositCollateral(ctx sdk.Context, owner, depositor sdk.AccAddre if !found { return errorsmod.Wrapf(types.ErrCdpNotFound, "owner %s, collateral %s", owner, collateralType) } - err = k.ValidateBalance(ctx, collateral, depositor) + err = k.ValidateBalance(sdkCtx, collateral, depositor) if err != nil { return err } - k.hooks.BeforeCDPModified(ctx, cdp) + k.hooks.BeforeCDPModified(sdkCtx, cdp) cdp = k.SynchronizeInterest(ctx, cdp) deposit, found := k.GetDeposit(ctx, cdp.ID, depositor) @@ -42,9 +45,9 @@ func (k Keeper) DepositCollateral(ctx sdk.Context, owner, depositor sdk.AccAddre k.SetDeposit(ctx, deposit) cdp.Collateral = cdp.Collateral.Add(collateral) - collateralToDebtRatio := k.CalculateCollateralToDebtRatio(ctx, cdp.Collateral, cdp.Type, cdp.GetTotalPrincipal()) + collateralToDebtRatio := k.CalculateCollateralToDebtRatio(sdkCtx, cdp.Collateral, cdp.Type, cdp.GetTotalPrincipal()) - ctx.EventManager().EmitEvent( + sdkCtx.EventManager().EmitEvent( sdk.NewEvent( types.EventTypeCdpDeposit, sdk.NewAttribute(sdk.AttributeKeyAmount, collateral.String()), @@ -56,8 +59,9 @@ func (k Keeper) DepositCollateral(ctx sdk.Context, owner, depositor sdk.AccAddre } // WithdrawCollateral removes collateral from a cdp if it does not put the cdp below the liquidation ratio -func (k Keeper) WithdrawCollateral(ctx sdk.Context, owner, depositor sdk.AccAddress, collateral sdk.Coin, collateralType string) error { - err := k.ValidateCollateral(ctx, collateral, collateralType) +func (k Keeper) WithdrawCollateral(ctx context.Context, owner, depositor sdk.AccAddress, collateral sdk.Coin, collateralType string) error { + sdkCtx := sdk.UnwrapSDKContext(ctx) + err := k.ValidateCollateral(sdkCtx, collateral, collateralType) if err != nil { return err } @@ -72,10 +76,10 @@ func (k Keeper) WithdrawCollateral(ctx sdk.Context, owner, depositor sdk.AccAddr if collateral.Amount.GT(deposit.Amount.Amount) { return errorsmod.Wrapf(types.ErrInvalidWithdrawAmount, "collateral %s, deposit %s", collateral, deposit.Amount) } - k.hooks.BeforeCDPModified(ctx, cdp) + k.hooks.BeforeCDPModified(sdkCtx, cdp) cdp = k.SynchronizeInterest(ctx, cdp) - collateralizationRatio, err := k.CalculateCollateralizationRatio(ctx, cdp.Collateral.Sub(collateral), cdp.Type, cdp.Principal, cdp.AccumulatedFees, spot) + collateralizationRatio, err := k.CalculateCollateralizationRatio(sdkCtx, cdp.Collateral.Sub(collateral), cdp.Type, cdp.Principal, cdp.AccumulatedFees, spot) if err != nil { return err } @@ -90,7 +94,7 @@ func (k Keeper) WithdrawCollateral(ctx sdk.Context, owner, depositor sdk.AccAddr } cdp.Collateral = cdp.Collateral.Sub(collateral) - collateralToDebtRatio := k.CalculateCollateralToDebtRatio(ctx, cdp.Collateral, cdp.Type, cdp.GetTotalPrincipal()) + collateralToDebtRatio := k.CalculateCollateralToDebtRatio(sdkCtx, cdp.Collateral, cdp.Type, cdp.GetTotalPrincipal()) err = k.UpdateCdpAndCollateralRatioIndex(ctx, cdp, collateralToDebtRatio) if err != nil { return err @@ -104,7 +108,7 @@ func (k Keeper) WithdrawCollateral(ctx sdk.Context, owner, depositor sdk.AccAddr k.SetDeposit(ctx, deposit) } - ctx.EventManager().EmitEvent( + sdkCtx.EventManager().EmitEvent( sdk.NewEvent( types.EventTypeCdpWithdrawal, sdk.NewAttribute(sdk.AttributeKeyAmount, collateral.String()), @@ -116,8 +120,9 @@ func (k Keeper) WithdrawCollateral(ctx sdk.Context, owner, depositor sdk.AccAddr } // GetDeposit returns the deposit of a depositor on a particular cdp from the store -func (k Keeper) GetDeposit(ctx sdk.Context, cdpID uint64, depositor sdk.AccAddress) (deposit types.Deposit, found bool) { - store := prefix.NewStore(ctx.KVStore(k.key), types.DepositKeyPrefix) +func (k Keeper) GetDeposit(ctx context.Context, cdpID uint64, depositor sdk.AccAddress) (deposit types.Deposit, found bool) { + sdkCtx := sdk.UnwrapSDKContext(ctx) + store := prefix.NewStore(sdkCtx.KVStore(k.key), types.DepositKeyPrefix) bz := store.Get(types.DepositKey(cdpID, depositor)) if bz == nil { return deposit, false @@ -127,23 +132,26 @@ func (k Keeper) GetDeposit(ctx sdk.Context, cdpID uint64, depositor sdk.AccAddre } // SetDeposit sets the deposit in the store -func (k Keeper) SetDeposit(ctx sdk.Context, deposit types.Deposit) { - store := prefix.NewStore(ctx.KVStore(k.key), types.DepositKeyPrefix) +func (k Keeper) SetDeposit(ctx context.Context, deposit types.Deposit) { + sdkCtx := sdk.UnwrapSDKContext(ctx) + store := prefix.NewStore(sdkCtx.KVStore(k.key), types.DepositKeyPrefix) bz := k.cdc.MustMarshal(&deposit) store.Set(types.DepositKey(deposit.CdpID, deposit.Depositor), bz) } // DeleteDeposit deletes a deposit from the store -func (k Keeper) DeleteDeposit(ctx sdk.Context, cdpID uint64, depositor sdk.AccAddress) { - store := prefix.NewStore(ctx.KVStore(k.key), types.DepositKeyPrefix) +func (k Keeper) DeleteDeposit(ctx context.Context, cdpID uint64, depositor sdk.AccAddress) { + sdkCtx := sdk.UnwrapSDKContext(ctx) + store := prefix.NewStore(sdkCtx.KVStore(k.key), types.DepositKeyPrefix) store.Delete(types.DepositKey(cdpID, depositor)) } // IterateDeposits iterates over the all the deposits of a cdp and performs a callback function -func (k Keeper) IterateDeposits(ctx sdk.Context, cdpID uint64, cb func(deposit types.Deposit) (stop bool)) { - store := prefix.NewStore(ctx.KVStore(k.key), types.DepositKeyPrefix) - iterator := sdk.KVStorePrefixIterator(store, types.GetCdpIDBytes(cdpID)) +func (k Keeper) IterateDeposits(ctx context.Context, cdpID uint64, cb func(deposit types.Deposit) (stop bool)) { + sdkCtx := sdk.UnwrapSDKContext(ctx) + store := prefix.NewStore(sdkCtx.KVStore(k.key), types.DepositKeyPrefix) + iterator := storetypes.KVStorePrefixIterator(store, types.GetCdpIDBytes(cdpID)) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { @@ -157,7 +165,7 @@ func (k Keeper) IterateDeposits(ctx sdk.Context, cdpID uint64, cb func(deposit t } // GetDeposits returns all the deposits to a cdp -func (k Keeper) GetDeposits(ctx sdk.Context, cdpID uint64) (deposits types.Deposits) { +func (k Keeper) GetDeposits(ctx context.Context, cdpID uint64) (deposits types.Deposits) { k.IterateDeposits(ctx, cdpID, func(deposit types.Deposit) bool { deposits = append(deposits, deposit) return false diff --git a/x/cdp/keeper/deposit_test.go b/x/cdp/keeper/deposit_test.go index 070c50b1d3..d3f2ef2552 100644 --- a/x/cdp/keeper/deposit_test.go +++ b/x/cdp/keeper/deposit_test.go @@ -8,7 +8,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" - tmproto "github.com/cometbft/cometbft/proto/tendermint/types" + _ "github.com/cometbft/cometbft/proto/tendermint/types" tmtime "github.com/cometbft/cometbft/types/time" "github.com/kava-labs/kava/app" @@ -27,7 +27,7 @@ type DepositTestSuite struct { func (suite *DepositTestSuite) SetupTest() { tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) cdc := tApp.AppCodec() _, addrs := app.GeneratePrivKeyAddressPairs(10) diff --git a/x/cdp/keeper/draw.go b/x/cdp/keeper/draw.go index 3b09f470d6..2e187c885c 100644 --- a/x/cdp/keeper/draw.go +++ b/x/cdp/keeper/draw.go @@ -1,6 +1,8 @@ package keeper import ( + "context" + sdkmath "cosmossdk.io/math" "fmt" errorsmod "cosmossdk.io/errors" @@ -71,32 +73,33 @@ func (k Keeper) AddPrincipal(ctx sdk.Context, owner sdk.AccAddress, collateralTy // RepayPrincipal removes debt from the cdp // If all debt is repaid, the collateral is returned to depositors and the cdp is removed from the store -func (k Keeper) RepayPrincipal(ctx sdk.Context, owner sdk.AccAddress, collateralType string, payment sdk.Coin) error { +func (k Keeper) RepayPrincipal(ctx context.Context, owner sdk.AccAddress, collateralType string, payment sdk.Coin) error { + sdkCtx := sdk.UnwrapSDKContext(ctx) // validation cdp, found := k.GetCdpByOwnerAndCollateralType(ctx, owner, collateralType) if !found { return errorsmod.Wrapf(types.ErrCdpNotFound, "owner %s, denom %s", owner, collateralType) } - err := k.ValidatePaymentCoins(ctx, cdp, payment) + err := k.ValidatePaymentCoins(sdkCtx, cdp, payment) if err != nil { return err } - err = k.ValidateBalance(ctx, payment, owner) + err = k.ValidateBalance(sdkCtx, payment, owner) if err != nil { return err } - k.hooks.BeforeCDPModified(ctx, cdp) + k.hooks.BeforeCDPModified(sdkCtx, cdp) cdp = k.SynchronizeInterest(ctx, cdp) // Note: assumes cdp.Principal and cdp.AccumulatedFees don't change during calculations totalPrincipal := cdp.GetTotalPrincipal() // calculate fee and principal payment - feePayment, principalPayment := k.calculatePayment(ctx, totalPrincipal, cdp.AccumulatedFees, payment) + feePayment, principalPayment := k.calculatePayment(sdkCtx, totalPrincipal, cdp.AccumulatedFees, payment) - err = k.validatePrincipalPayment(ctx, cdp, principalPayment) + err = k.validatePrincipalPayment(sdkCtx, cdp, principalPayment) if err != nil { return err } @@ -113,10 +116,10 @@ func (k Keeper) RepayPrincipal(ctx sdk.Context, owner sdk.AccAddress, collateral } // burn the corresponding amount of debt coins - cdpDebt := k.getModAccountDebt(ctx, types.ModuleName) + cdpDebt := k.getModAccountDebt(sdkCtx, types.ModuleName) paymentAmount := feePayment.Add(principalPayment).Amount - debtDenom := k.GetDebtDenom(ctx) + debtDenom := k.GetDebtDenom(sdkCtx) coinsToBurn := sdk.NewCoin(debtDenom, paymentAmount) if paymentAmount.GT(cdpDebt) { @@ -130,7 +133,7 @@ func (k Keeper) RepayPrincipal(ctx sdk.Context, owner sdk.AccAddress, collateral } // emit repayment event - ctx.EventManager().EmitEvent( + sdkCtx.EventManager().EmitEvent( sdk.NewEvent( types.EventTypeCdpRepay, sdk.NewAttribute(sdk.AttributeKeyAmount, feePayment.Add(principalPayment).String()), @@ -152,15 +155,15 @@ func (k Keeper) RepayPrincipal(ctx sdk.Context, owner sdk.AccAddress, collateral // if the debt is fully paid, return collateral to depositors, // and remove the cdp and indexes from the store if cdp.Principal.IsZero() && cdp.AccumulatedFees.IsZero() { - k.ReturnCollateral(ctx, cdp) - k.RemoveCdpOwnerIndex(ctx, cdp) + k.ReturnCollateral(sdkCtx, cdp) + k.RemoveCdpOwnerIndex(sdkCtx, cdp) err := k.DeleteCdpAndCollateralRatioIndex(ctx, cdp) if err != nil { return err } // emit cdp close event - ctx.EventManager().EmitEvent( + sdkCtx.EventManager().EmitEvent( sdk.NewEvent( types.EventTypeCdpClose, sdk.NewAttribute(types.AttributeKeyCdpID, fmt.Sprintf("%d", cdp.ID)), @@ -170,7 +173,7 @@ func (k Keeper) RepayPrincipal(ctx sdk.Context, owner sdk.AccAddress, collateral } // set cdp state and update indexes - collateralToDebtRatio := k.CalculateCollateralToDebtRatio(ctx, cdp.Collateral, cdp.Type, cdp.GetTotalPrincipal()) + collateralToDebtRatio := k.CalculateCollateralToDebtRatio(sdkCtx, cdp.Collateral, cdp.Type, cdp.GetTotalPrincipal()) return k.UpdateCdpAndCollateralRatioIndex(ctx, cdp, collateralToDebtRatio) } @@ -205,8 +208,8 @@ func (k Keeper) ReturnCollateral(ctx sdk.Context, cdp types.CDP) { func (k Keeper) calculatePayment(ctx sdk.Context, owed, fees, payment sdk.Coin) (sdk.Coin, sdk.Coin) { // divides repayment into principal and fee components, with fee payment applied first. - feePayment := sdk.NewCoin(payment.Denom, sdk.ZeroInt()) - principalPayment := sdk.NewCoin(payment.Denom, sdk.ZeroInt()) + feePayment := sdk.NewCoin(payment.Denom, sdkmath.ZeroInt()) + principalPayment := sdk.NewCoin(payment.Denom, sdkmath.ZeroInt()) var overpayment sdk.Coin // return zero value coins if payment amount is invalid if !payment.Amount.IsPositive() { @@ -236,7 +239,7 @@ func (k Keeper) calculatePayment(ctx sdk.Context, owed, fees, payment sdk.Coin) func (k Keeper) validatePrincipalPayment(ctx sdk.Context, cdp types.CDP, payment sdk.Coin) error { proposedBalance := cdp.Principal.Amount.Sub(payment.Amount) dp, _ := k.GetDebtParam(ctx, payment.Denom) - if proposedBalance.GT(sdk.ZeroInt()) && proposedBalance.LT(dp.DebtFloor) { + if proposedBalance.GT(sdkmath.ZeroInt()) && proposedBalance.LT(dp.DebtFloor) { return errorsmod.Wrapf(types.ErrBelowDebtFloor, "proposed %s < minimum %s", sdk.NewCoin(payment.Denom, proposedBalance), dp.DebtFloor) } return nil diff --git a/x/cdp/keeper/draw_test.go b/x/cdp/keeper/draw_test.go index e3d6f9797a..84fc5e7b4b 100644 --- a/x/cdp/keeper/draw_test.go +++ b/x/cdp/keeper/draw_test.go @@ -1,6 +1,7 @@ package keeper_test import ( + sdkmath "cosmossdk.io/math" "errors" "testing" "time" @@ -9,7 +10,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" - tmproto "github.com/cometbft/cometbft/proto/tendermint/types" tmtime "github.com/cometbft/cometbft/types/time" "github.com/kava-labs/kava/app" @@ -28,7 +28,7 @@ type DrawTestSuite struct { func (suite *DrawTestSuite) SetupTest() { tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) cdc := tApp.AppCodec() _, addrs := app.GeneratePrivKeyAddressPairs(3) coins := []sdk.Coins{ @@ -63,7 +63,7 @@ func (suite *DrawTestSuite) TestAddRepayPrincipal() { suite.Equal(d("20.0"), ctd) ts := suite.keeper.GetAllCdpsByCollateralTypeAndRatio(suite.ctx, "xrp-a", d("20.0")) suite.Equal(0, len(ts)) - ts = suite.keeper.GetAllCdpsByCollateralTypeAndRatio(suite.ctx, "xrp-a", d("20.0").Add(sdk.SmallestDec())) + ts = suite.keeper.GetAllCdpsByCollateralTypeAndRatio(suite.ctx, "xrp-a", d("20.0").Add(sdkmath.LegacySmallestDec())) suite.Equal(ts[0], t) tp := suite.keeper.GetTotalPrincipal(suite.ctx, "xrp-a", "usdx") suite.Equal(i(20000000), tp) @@ -95,7 +95,7 @@ func (suite *DrawTestSuite) TestAddRepayPrincipal() { suite.Equal(d("40.0"), ctd) ts = suite.keeper.GetAllCdpsByCollateralTypeAndRatio(suite.ctx, "xrp-a", d("40.0")) suite.Equal(0, len(ts)) - ts = suite.keeper.GetAllCdpsByCollateralTypeAndRatio(suite.ctx, "xrp-a", d("40.0").Add(sdk.SmallestDec())) + ts = suite.keeper.GetAllCdpsByCollateralTypeAndRatio(suite.ctx, "xrp-a", d("40.0").Add(sdkmath.LegacySmallestDec())) suite.Equal(ts[0], t) ak = suite.app.GetAccountKeeper() diff --git a/x/cdp/keeper/grpc_query.go b/x/cdp/keeper/grpc_query.go index c81ac91245..a1436035bc 100644 --- a/x/cdp/keeper/grpc_query.go +++ b/x/cdp/keeper/grpc_query.go @@ -2,6 +2,7 @@ package keeper import ( "context" + sdkmath "cosmossdk.io/math" "sort" errorsmod "cosmossdk.io/errors" @@ -134,7 +135,7 @@ func (s QueryServer) TotalCollateral(c context.Context, req *types.QueryTotalCol for i := len(collateralTypes) - 1; i > 0; i-- { cdps := s.keeper.GetAllCdpsByCollateralType(ctx, collateralTypes[i]) - collateral := sdk.ZeroInt() + collateral := sdkmath.ZeroInt() for _, cdp := range cdps { collateral = collateral.Add(cdp.Collateral.Amount) @@ -258,10 +259,10 @@ func GrpcFilterCDPs(ctx sdk.Context, k Keeper, req types.QueryCdpsRequest) (type } } - ratio := sdk.ZeroDec() + ratio := sdkmath.LegacyZeroDec() if req.Ratio != "" { - ratio, err = sdk.NewDecFromStr(req.Ratio) + ratio, err = sdkmath.LegacyNewDecFromStr(req.Ratio) if err != nil { if err != nil { return nil, status.Errorf(codes.InvalidArgument, "invalid ratio") diff --git a/x/cdp/keeper/grpc_query_test.go b/x/cdp/keeper/grpc_query_test.go index 3c1e06d031..0d17c31dc0 100644 --- a/x/cdp/keeper/grpc_query_test.go +++ b/x/cdp/keeper/grpc_query_test.go @@ -5,7 +5,6 @@ import ( "time" sdkmath "cosmossdk.io/math" - tmprototypes "github.com/cometbft/cometbft/proto/tendermint/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/query" "github.com/kava-labs/kava/app" @@ -31,8 +30,7 @@ func (suite *grpcQueryTestSuite) SetupTest() { NewPricefeedGenStateMulti(suite.tApp.AppCodec()), NewCDPGenStateMulti(suite.tApp.AppCodec()), ) - suite.ctx = suite.tApp.NewContext(true, tmprototypes.Header{}). - WithBlockTime(time.Now().UTC()) + suite.ctx = suite.tApp.NewContextLegacy(true).WithBlockTime(time.Now().UTC()) suite.keeper = suite.tApp.GetCDPKeeper() suite.queryServer = keeper.NewQueryServerImpl(suite.keeper) diff --git a/x/cdp/keeper/integration_test.go b/x/cdp/keeper/integration_test.go index 8f64e3f178..ac3a6a6735 100644 --- a/x/cdp/keeper/integration_test.go +++ b/x/cdp/keeper/integration_test.go @@ -16,11 +16,11 @@ import ( // Avoid cluttering test cases with long function names func i(in int64) sdkmath.Int { return sdkmath.NewInt(in) } -func d(str string) sdk.Dec { return sdk.MustNewDecFromStr(str) } +func d(str string) sdkmath.LegacyDec { return sdkmath.LegacyMustNewDecFromStr(str) } func c(denom string, amount int64) sdk.Coin { return sdk.NewInt64Coin(denom, amount) } func cs(coins ...sdk.Coin) sdk.Coins { return sdk.NewCoins(coins...) } -func NewPricefeedGenState(cdc codec.JSONCodec, asset string, price sdk.Dec) app.GenesisState { +func NewPricefeedGenState(cdc codec.JSONCodec, asset string, price sdkmath.LegacyDec) app.GenesisState { pfGenesis := pricefeedtypes.GenesisState{ Params: pricefeedtypes.Params{ Markets: []pricefeedtypes.Market{ @@ -39,7 +39,7 @@ func NewPricefeedGenState(cdc codec.JSONCodec, asset string, price sdk.Dec) app. return app.GenesisState{pricefeedtypes.ModuleName: cdc.MustMarshalJSON(&pfGenesis)} } -func NewCDPGenState(cdc codec.JSONCodec, asset string, liquidationRatio sdk.Dec) app.GenesisState { +func NewCDPGenState(cdc codec.JSONCodec, asset string, liquidationRatio sdkmath.LegacyDec) app.GenesisState { cdpGenesis := types.GenesisState{ Params: types.Params{ GlobalDebtLimit: sdk.NewInt64Coin("usdx", 1000000000000), @@ -54,7 +54,7 @@ func NewCDPGenState(cdc codec.JSONCodec, asset string, liquidationRatio sdk.Dec) Type: asset + "-a", LiquidationRatio: liquidationRatio, DebtLimit: sdk.NewInt64Coin("usdx", 1000000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), // %5 apr + StabilityFee: sdkmath.LegacyMustNewDecFromStr("1.000000001547125958"), // %5 apr LiquidationPenalty: d("0.05"), AuctionSize: i(100), SpotMarketID: asset + ":usd", @@ -76,10 +76,10 @@ func NewCDPGenState(cdc codec.JSONCodec, asset string, liquidationRatio sdk.Dec) GovDenom: types.DefaultGovDenom, CDPs: types.CDPs{}, PreviousAccumulationTimes: types.GenesisAccumulationTimes{ - types.NewGenesisAccumulationTime(asset+"-a", time.Time{}, sdk.OneDec()), + types.NewGenesisAccumulationTime(asset+"-a", time.Time{}, sdkmath.LegacyOneDec()), }, TotalPrincipals: types.GenesisTotalPrincipals{ - types.NewGenesisTotalPrincipal(asset+"-a", sdk.ZeroInt()), + types.NewGenesisTotalPrincipal(asset+"-a", sdkmath.ZeroInt()), }, } return app.GenesisState{types.ModuleName: cdc.MustMarshalJSON(&cdpGenesis)} @@ -103,49 +103,49 @@ func NewPricefeedGenStateMulti(cdc codec.JSONCodec) app.GenesisState { { MarketID: "btc:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("8000.00"), + Price: sdkmath.LegacyMustNewDecFromStr("8000.00"), Expiry: time.Now().Add(1 * time.Hour), }, { MarketID: "btc:usd:30", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("8000.00"), + Price: sdkmath.LegacyMustNewDecFromStr("8000.00"), Expiry: time.Now().Add(1 * time.Hour), }, { MarketID: "xrp:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("0.25"), + Price: sdkmath.LegacyMustNewDecFromStr("0.25"), Expiry: time.Now().Add(1 * time.Hour), }, { MarketID: "xrp:usd:30", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("0.25"), + Price: sdkmath.LegacyMustNewDecFromStr("0.25"), Expiry: time.Now().Add(1 * time.Hour), }, { MarketID: "bnb:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("17.25"), + Price: sdkmath.LegacyMustNewDecFromStr("17.25"), Expiry: time.Now().Add(1 * time.Hour), }, { MarketID: "bnb:usd:30", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("17.25"), + Price: sdkmath.LegacyMustNewDecFromStr("17.25"), Expiry: time.Now().Add(1 * time.Hour), }, { MarketID: "busd:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.OneDec(), + Price: sdkmath.LegacyOneDec(), Expiry: time.Now().Add(1 * time.Hour), }, { MarketID: "busd:usd:30", OracleAddress: sdk.AccAddress{}, - Price: sdk.OneDec(), + Price: sdkmath.LegacyOneDec(), Expiry: time.Now().Add(1 * time.Hour), }, }, @@ -166,9 +166,9 @@ func NewCDPGenStateMulti(cdc codec.JSONCodec) app.GenesisState { { Denom: "xrp", Type: "xrp-a", - LiquidationRatio: sdk.MustNewDecFromStr("2.0"), + LiquidationRatio: sdkmath.LegacyMustNewDecFromStr("2.0"), DebtLimit: sdk.NewInt64Coin("usdx", 500000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), // %5 apr + StabilityFee: sdkmath.LegacyMustNewDecFromStr("1.000000001547125958"), // %5 apr LiquidationPenalty: d("0.05"), AuctionSize: i(7000000000), SpotMarketID: "xrp:usd", @@ -180,9 +180,9 @@ func NewCDPGenStateMulti(cdc codec.JSONCodec) app.GenesisState { { Denom: "btc", Type: "btc-a", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), + LiquidationRatio: sdkmath.LegacyMustNewDecFromStr("1.5"), DebtLimit: sdk.NewInt64Coin("usdx", 500000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000000782997609"), // %2.5 apr + StabilityFee: sdkmath.LegacyMustNewDecFromStr("1.000000000782997609"), // %2.5 apr LiquidationPenalty: d("0.025"), AuctionSize: i(10000000), SpotMarketID: "btc:usd", @@ -194,9 +194,9 @@ func NewCDPGenStateMulti(cdc codec.JSONCodec) app.GenesisState { { Denom: "bnb", Type: "bnb-a", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), + LiquidationRatio: sdkmath.LegacyMustNewDecFromStr("1.5"), DebtLimit: sdk.NewInt64Coin("usdx", 500000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), // %5 apr + StabilityFee: sdkmath.LegacyMustNewDecFromStr("1.000000001547125958"), // %5 apr LiquidationPenalty: d("0.05"), AuctionSize: i(50000000000), SpotMarketID: "bnb:usd", @@ -210,7 +210,7 @@ func NewCDPGenStateMulti(cdc codec.JSONCodec) app.GenesisState { Type: "busd-a", LiquidationRatio: d("1.01"), DebtLimit: sdk.NewInt64Coin("usdx", 500000000000), - StabilityFee: sdk.OneDec(), // %0 apr + StabilityFee: sdkmath.LegacyOneDec(), // %0 apr LiquidationPenalty: d("0.05"), AuctionSize: i(10000000000), SpotMarketID: "busd:usd", @@ -232,16 +232,16 @@ func NewCDPGenStateMulti(cdc codec.JSONCodec) app.GenesisState { GovDenom: types.DefaultGovDenom, CDPs: types.CDPs{}, PreviousAccumulationTimes: types.GenesisAccumulationTimes{ - types.NewGenesisAccumulationTime("btc-a", time.Time{}, sdk.OneDec()), - types.NewGenesisAccumulationTime("xrp-a", time.Time{}, sdk.OneDec()), - types.NewGenesisAccumulationTime("busd-a", time.Time{}, sdk.OneDec()), - types.NewGenesisAccumulationTime("bnb-a", time.Time{}, sdk.OneDec()), + types.NewGenesisAccumulationTime("btc-a", time.Time{}, sdkmath.LegacyOneDec()), + types.NewGenesisAccumulationTime("xrp-a", time.Time{}, sdkmath.LegacyOneDec()), + types.NewGenesisAccumulationTime("busd-a", time.Time{}, sdkmath.LegacyOneDec()), + types.NewGenesisAccumulationTime("bnb-a", time.Time{}, sdkmath.LegacyOneDec()), }, TotalPrincipals: types.GenesisTotalPrincipals{ - types.NewGenesisTotalPrincipal("btc-a", sdk.ZeroInt()), - types.NewGenesisTotalPrincipal("xrp-a", sdk.ZeroInt()), - types.NewGenesisTotalPrincipal("busd-a", sdk.ZeroInt()), - types.NewGenesisTotalPrincipal("bnb-a", sdk.ZeroInt()), + types.NewGenesisTotalPrincipal("btc-a", sdkmath.ZeroInt()), + types.NewGenesisTotalPrincipal("xrp-a", sdkmath.ZeroInt()), + types.NewGenesisTotalPrincipal("busd-a", sdkmath.ZeroInt()), + types.NewGenesisTotalPrincipal("bnb-a", sdkmath.ZeroInt()), }, } return app.GenesisState{types.ModuleName: cdc.MustMarshalJSON(&cdpGenesis)} @@ -260,9 +260,9 @@ func NewCDPGenStateHighDebtLimit(cdc codec.JSONCodec) app.GenesisState { { Denom: "xrp", Type: "xrp-a", - LiquidationRatio: sdk.MustNewDecFromStr("2.0"), + LiquidationRatio: sdkmath.LegacyMustNewDecFromStr("2.0"), DebtLimit: sdk.NewInt64Coin("usdx", 50000000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), // %5 apr + StabilityFee: sdkmath.LegacyMustNewDecFromStr("1.000000001547125958"), // %5 apr LiquidationPenalty: d("0.05"), AuctionSize: i(7000000000), SpotMarketID: "xrp:usd", @@ -274,9 +274,9 @@ func NewCDPGenStateHighDebtLimit(cdc codec.JSONCodec) app.GenesisState { { Denom: "btc", Type: "btc-a", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), + LiquidationRatio: sdkmath.LegacyMustNewDecFromStr("1.5"), DebtLimit: sdk.NewInt64Coin("usdx", 50000000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000000782997609"), // %2.5 apr + StabilityFee: sdkmath.LegacyMustNewDecFromStr("1.000000000782997609"), // %2.5 apr LiquidationPenalty: d("0.025"), AuctionSize: i(10000000), SpotMarketID: "btc:usd", @@ -298,12 +298,12 @@ func NewCDPGenStateHighDebtLimit(cdc codec.JSONCodec) app.GenesisState { GovDenom: types.DefaultGovDenom, CDPs: types.CDPs{}, PreviousAccumulationTimes: types.GenesisAccumulationTimes{ - types.NewGenesisAccumulationTime("btc-a", time.Time{}, sdk.OneDec()), - types.NewGenesisAccumulationTime("xrp-a", time.Time{}, sdk.OneDec()), + types.NewGenesisAccumulationTime("btc-a", time.Time{}, sdkmath.LegacyOneDec()), + types.NewGenesisAccumulationTime("xrp-a", time.Time{}, sdkmath.LegacyOneDec()), }, TotalPrincipals: types.GenesisTotalPrincipals{ - types.NewGenesisTotalPrincipal("btc-a", sdk.ZeroInt()), - types.NewGenesisTotalPrincipal("xrp-a", sdk.ZeroInt()), + types.NewGenesisTotalPrincipal("btc-a", sdkmath.ZeroInt()), + types.NewGenesisTotalPrincipal("xrp-a", sdkmath.ZeroInt()), }, } return app.GenesisState{types.ModuleName: cdc.MustMarshalJSON(&cdpGenesis)} @@ -311,10 +311,10 @@ func NewCDPGenStateHighDebtLimit(cdc codec.JSONCodec) app.GenesisState { func cdps() (cdps types.CDPs) { _, addrs := app.GeneratePrivKeyAddressPairs(3) - c1 := types.NewCDP(uint64(1), addrs[0], sdk.NewCoin("xrp", sdkmath.NewInt(10000000)), "xrp-a", sdk.NewCoin("usdx", sdkmath.NewInt(8000000)), tmtime.Canonical(time.Now()), sdk.OneDec()) - c2 := types.NewCDP(uint64(2), addrs[1], sdk.NewCoin("xrp", sdkmath.NewInt(100000000)), "xrp-a", sdk.NewCoin("usdx", sdkmath.NewInt(10000000)), tmtime.Canonical(time.Now()), sdk.OneDec()) - c3 := types.NewCDP(uint64(3), addrs[1], sdk.NewCoin("btc", sdkmath.NewInt(1000000000)), "btc-a", sdk.NewCoin("usdx", sdkmath.NewInt(10000000)), tmtime.Canonical(time.Now()), sdk.OneDec()) - c4 := types.NewCDP(uint64(4), addrs[2], sdk.NewCoin("xrp", sdkmath.NewInt(1000000000)), "xrp-a", sdk.NewCoin("usdx", sdkmath.NewInt(500000000)), tmtime.Canonical(time.Now()), sdk.OneDec()) + c1 := types.NewCDP(uint64(1), addrs[0], sdk.NewCoin("xrp", sdkmath.NewInt(10000000)), "xrp-a", sdk.NewCoin("usdx", sdkmath.NewInt(8000000)), tmtime.Canonical(time.Now()), sdkmath.LegacyOneDec()) + c2 := types.NewCDP(uint64(2), addrs[1], sdk.NewCoin("xrp", sdkmath.NewInt(100000000)), "xrp-a", sdk.NewCoin("usdx", sdkmath.NewInt(10000000)), tmtime.Canonical(time.Now()), sdkmath.LegacyOneDec()) + c3 := types.NewCDP(uint64(3), addrs[1], sdk.NewCoin("btc", sdkmath.NewInt(1000000000)), "btc-a", sdk.NewCoin("usdx", sdkmath.NewInt(10000000)), tmtime.Canonical(time.Now()), sdkmath.LegacyOneDec()) + c4 := types.NewCDP(uint64(4), addrs[2], sdk.NewCoin("xrp", sdkmath.NewInt(1000000000)), "xrp-a", sdk.NewCoin("usdx", sdkmath.NewInt(500000000)), tmtime.Canonical(time.Now()), sdkmath.LegacyOneDec()) cdps = append(cdps, c1, c2, c3, c4) return } diff --git a/x/cdp/keeper/interest.go b/x/cdp/keeper/interest.go index fb86d08dd6..c66dd4316c 100644 --- a/x/cdp/keeper/interest.go +++ b/x/cdp/keeper/interest.go @@ -1,11 +1,12 @@ package keeper import ( + "context" "fmt" "math" sdkmath "cosmossdk.io/math" - "github.com/cosmos/cosmos-sdk/store/prefix" + "cosmossdk.io/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/kava-labs/kava/x/cdp/types" @@ -15,15 +16,16 @@ var scalingFactor = 1e18 // AccumulateInterest calculates the new interest that has accrued for the input collateral type based on the total amount of principal // that has been created with that collateral type and the amount of time that has passed since interest was last accumulated -func (k Keeper) AccumulateInterest(ctx sdk.Context, ctype string) error { +func (k Keeper) AccumulateInterest(ctx context.Context, ctype string) error { + sdkCtx := sdk.UnwrapSDKContext(ctx) previousAccrualTime, found := k.GetPreviousAccrualTime(ctx, ctype) if !found { - k.SetPreviousAccrualTime(ctx, ctype, ctx.BlockTime()) + k.SetPreviousAccrualTime(ctx, ctype, sdkCtx.BlockTime()) return nil } timeElapsed := int64(math.RoundToEven( - ctx.BlockTime().Sub(previousAccrualTime).Seconds(), + sdkCtx.BlockTime().Sub(previousAccrualTime).Seconds(), )) if timeElapsed == 0 { return nil @@ -31,30 +33,30 @@ func (k Keeper) AccumulateInterest(ctx sdk.Context, ctype string) error { totalPrincipalPrior := k.GetTotalPrincipal(ctx, ctype, types.DefaultStableDenom) if totalPrincipalPrior.IsZero() || totalPrincipalPrior.IsNegative() { - k.SetPreviousAccrualTime(ctx, ctype, ctx.BlockTime()) + k.SetPreviousAccrualTime(ctx, ctype, sdkCtx.BlockTime()) return nil } interestFactorPrior, foundInterestFactorPrior := k.GetInterestFactor(ctx, ctype) if !foundInterestFactorPrior { - k.SetInterestFactor(ctx, ctype, sdk.OneDec()) + k.SetInterestFactor(ctx, ctype, sdkmath.LegacyOneDec()) // set previous accrual time exit early because interest accumulated will be zero - k.SetPreviousAccrualTime(ctx, ctype, ctx.BlockTime()) + k.SetPreviousAccrualTime(ctx, ctype, sdkCtx.BlockTime()) return nil } borrowRateSpy := k.getFeeRate(ctx, ctype) - if borrowRateSpy.Equal(sdk.OneDec()) { - k.SetPreviousAccrualTime(ctx, ctype, ctx.BlockTime()) + if borrowRateSpy.Equal(sdkmath.LegacyOneDec()) { + k.SetPreviousAccrualTime(ctx, ctype, sdkCtx.BlockTime()) return nil } interestFactor := CalculateInterestFactor(borrowRateSpy, sdkmath.NewInt(timeElapsed)) - interestAccumulated := (interestFactor.Mul(sdk.NewDecFromInt(totalPrincipalPrior))).RoundInt().Sub(totalPrincipalPrior) + interestAccumulated := (interestFactor.Mul(sdkmath.LegacyNewDecFromInt(totalPrincipalPrior))).RoundInt().Sub(totalPrincipalPrior) if interestAccumulated.IsZero() { // in the case accumulated interest rounds to zero, exit early without updating accrual time return nil } - err := k.MintDebtCoins(ctx, types.ModuleName, k.GetDebtDenom(ctx), sdk.NewCoin(types.DefaultStableDenom, interestAccumulated)) + err := k.MintDebtCoins(ctx, types.ModuleName, k.GetDebtDenom(sdkCtx), sdk.NewCoin(types.DefaultStableDenom, interestAccumulated)) if err != nil { return err } @@ -79,7 +81,7 @@ func (k Keeper) AccumulateInterest(ctx sdk.Context, ctype string) error { k.SetTotalPrincipal(ctx, ctype, types.DefaultStableDenom, totalPrincipalNew) k.SetInterestFactor(ctx, ctype, interestFactorNew) - k.SetPreviousAccrualTime(ctx, ctype, ctx.BlockTime()) + k.SetPreviousAccrualTime(ctx, ctype, sdkCtx.BlockTime()) return nil } @@ -87,8 +89,8 @@ func (k Keeper) AccumulateInterest(ctx sdk.Context, ctype string) error { // CalculateInterestFactor calculates the simple interest scaling factor, // which is equal to: (per-second interest rate ** number of seconds elapsed) // Will return 1.000x, multiply by principal to get new principal with added interest -func CalculateInterestFactor(perSecondInterestRate sdk.Dec, secondsElapsed sdkmath.Int) sdk.Dec { - scalingFactorUint := sdk.NewUint(uint64(scalingFactor)) +func CalculateInterestFactor(perSecondInterestRate sdkmath.LegacyDec, secondsElapsed sdkmath.Int) sdkmath.LegacyDec { + scalingFactorUint := sdkmath.NewUint(uint64(scalingFactor)) scalingFactorInt := sdkmath.NewInt(int64(scalingFactor)) // Convert per-second interest rate to a uint scaled by 1e18 @@ -100,19 +102,20 @@ func CalculateInterestFactor(perSecondInterestRate sdk.Dec, secondsElapsed sdkma // Calculate the interest factor as a uint scaled by 1e18 interestFactorMantissa := sdkmath.RelativePow(interestMantissa, secondsElapsedUint, scalingFactorUint) - // Convert interest factor to an unscaled sdk.Dec - return sdk.NewDecFromBigInt(interestFactorMantissa.BigInt()).QuoInt(scalingFactorInt) + // Convert interest factor to an unscaled sdkmath.LegacyDec + return sdkmath.LegacyNewDecFromBigInt(interestFactorMantissa.BigInt()).QuoInt(scalingFactorInt) } // SynchronizeInterest updates the input cdp object to reflect the current accumulated interest, updates the cdp state in the store, // and returns the updated cdp object -func (k Keeper) SynchronizeInterest(ctx sdk.Context, cdp types.CDP) types.CDP { +func (k Keeper) SynchronizeInterest(ctx context.Context, cdp types.CDP) types.CDP { + sdkCtx := sdk.UnwrapSDKContext(ctx) globalInterestFactor, found := k.GetInterestFactor(ctx, cdp.Type) if !found { - k.SetInterestFactor(ctx, cdp.Type, sdk.OneDec()) - cdp.InterestFactor = sdk.OneDec() - cdp.FeesUpdated = ctx.BlockTime() - if err := k.SetCDP(ctx, cdp); err != nil { + k.SetInterestFactor(ctx, cdp.Type, sdkmath.LegacyOneDec()) + cdp.InterestFactor = sdkmath.LegacyOneDec() + cdp.FeesUpdated = sdkCtx.BlockTime() + if err := k.SetCDP(sdkCtx, cdp); err != nil { panic(err) } return cdp @@ -131,7 +134,7 @@ func (k Keeper) SynchronizeInterest(ctx sdk.Context, cdp types.CDP) types.CDP { } // if apy is zero, we need to update FeesUpdated cdp.FeesUpdated = prevAccrualTime - if err := k.SetCDP(ctx, cdp); err != nil { + if err := k.SetCDP(sdkCtx, cdp); err != nil { panic(err) } } @@ -139,7 +142,7 @@ func (k Keeper) SynchronizeInterest(ctx sdk.Context, cdp types.CDP) types.CDP { cdp.AccumulatedFees = cdp.AccumulatedFees.Add(accumulatedInterest) cdp.FeesUpdated = prevAccrualTime cdp.InterestFactor = globalInterestFactor - collateralToDebtRatio := k.CalculateCollateralToDebtRatio(ctx, cdp.Collateral, cdp.Type, cdp.GetTotalPrincipal()) + collateralToDebtRatio := k.CalculateCollateralToDebtRatio(sdkCtx, cdp.Collateral, cdp.Type, cdp.GetTotalPrincipal()) if err := k.UpdateCdpAndCollateralRatioIndex(ctx, cdp, collateralToDebtRatio); err != nil { panic(err) } @@ -148,29 +151,30 @@ func (k Keeper) SynchronizeInterest(ctx sdk.Context, cdp types.CDP) types.CDP { } // CalculateNewInterest returns the amount of interest that has accrued to the cdp since its interest was last synchronized -func (k Keeper) CalculateNewInterest(ctx sdk.Context, cdp types.CDP) sdk.Coin { +func (k Keeper) CalculateNewInterest(ctx context.Context, cdp types.CDP) sdk.Coin { globalInterestFactor, found := k.GetInterestFactor(ctx, cdp.Type) if !found { - return sdk.NewCoin(cdp.AccumulatedFees.Denom, sdk.ZeroInt()) + return sdk.NewCoin(cdp.AccumulatedFees.Denom, sdkmath.ZeroInt()) } cdpInterestFactor := globalInterestFactor.Quo(cdp.InterestFactor) - if cdpInterestFactor.Equal(sdk.OneDec()) { - return sdk.NewCoin(cdp.AccumulatedFees.Denom, sdk.ZeroInt()) + if cdpInterestFactor.Equal(sdkmath.LegacyOneDec()) { + return sdk.NewCoin(cdp.AccumulatedFees.Denom, sdkmath.ZeroInt()) } - accumulatedInterest := sdk.NewDecFromInt(cdp.GetTotalPrincipal().Amount).Mul(cdpInterestFactor).RoundInt().Sub(cdp.GetTotalPrincipal().Amount) + accumulatedInterest := sdkmath.LegacyNewDecFromInt(cdp.GetTotalPrincipal().Amount).Mul(cdpInterestFactor).RoundInt().Sub(cdp.GetTotalPrincipal().Amount) return sdk.NewCoin(cdp.AccumulatedFees.Denom, accumulatedInterest) } // SynchronizeInterestForRiskyCDPs synchronizes the interest for the slice of cdps with the lowest collateral:debt ratio -func (k Keeper) SynchronizeInterestForRiskyCDPs(ctx sdk.Context, targetRatio sdk.Dec, cp types.CollateralParam) error { +func (k Keeper) SynchronizeInterestForRiskyCDPs(ctx context.Context, targetRatio sdkmath.LegacyDec, cp types.CollateralParam) error { + sdkCtx := sdk.UnwrapSDKContext(ctx) debtParam := k.GetParams(ctx).DebtParam - cdpStore := prefix.NewStore(ctx.KVStore(k.key), types.CdpKeyPrefix) - collateralRatioStore := prefix.NewStore(ctx.KVStore(k.key), types.CollateralRatioIndexPrefix) + cdpStore := prefix.NewStore(sdkCtx.KVStore(k.key), types.CdpKeyPrefix) + collateralRatioStore := prefix.NewStore(sdkCtx.KVStore(k.key), types.CollateralRatioIndexPrefix) cdpIDs := make([]uint64, 0, cp.CheckCollateralizationIndexCount.Int64()) - iterator := collateralRatioStore.Iterator(types.CollateralRatioIterKey(cp.Type, sdk.ZeroDec()), types.CollateralRatioIterKey(cp.Type, targetRatio)) + iterator := collateralRatioStore.Iterator(types.CollateralRatioIterKey(cp.Type, sdkmath.LegacyZeroDec()), types.CollateralRatioIterKey(cp.Type, targetRatio)) for ; iterator.Valid(); iterator.Next() { _, id, _ := types.SplitCollateralRatioKey(iterator.Key()) cdpIDs = append(cdpIDs, id) @@ -207,15 +211,15 @@ func (k Keeper) SynchronizeInterestForRiskyCDPs(ctx sdk.Context, targetRatio sdk // // HOOK // - k.hooks.BeforeCDPModified(ctx, cdp) + k.hooks.BeforeCDPModified(sdkCtx, cdp) // // CALC INTEREST // - accumulatedInterest := sdk.ZeroInt() + accumulatedInterest := sdkmath.ZeroInt() cdpInterestFactor := globalInterestFactor.Quo(cdp.InterestFactor) - if !cdpInterestFactor.Equal(sdk.OneDec()) { - accumulatedInterest = sdk.NewDecFromInt(cdp.GetTotalPrincipal().Amount).Mul(cdpInterestFactor).RoundInt().Sub(cdp.GetTotalPrincipal().Amount) + if !cdpInterestFactor.Equal(sdkmath.LegacyOneDec()) { + accumulatedInterest = sdkmath.LegacyNewDecFromInt(cdp.GetTotalPrincipal().Amount).Mul(cdpInterestFactor).RoundInt().Sub(cdp.GetTotalPrincipal().Amount) } if accumulatedInterest.IsZero() { @@ -259,13 +263,13 @@ func (k Keeper) SynchronizeInterestForRiskyCDPs(ctx sdk.Context, targetRatio sdk return nil } -func calculateCollateralRatio(debtParam types.DebtParam, collateralParam types.CollateralParam, cdp types.CDP) sdk.Dec { - debtTotal := sdk.NewDecFromInt(cdp.GetTotalPrincipal().Amount).Mul(sdk.NewDecFromIntWithPrec(sdk.OneInt(), debtParam.ConversionFactor.Int64())) +func calculateCollateralRatio(debtParam types.DebtParam, collateralParam types.CollateralParam, cdp types.CDP) sdkmath.LegacyDec { + debtTotal := sdkmath.LegacyNewDecFromInt(cdp.GetTotalPrincipal().Amount).Mul(sdkmath.LegacyNewDecFromIntWithPrec(sdkmath.OneInt(), debtParam.ConversionFactor.Int64())) if debtTotal.IsZero() || debtTotal.GTE(types.MaxSortableDec) { - return types.MaxSortableDec.Sub(sdk.SmallestDec()) + return types.MaxSortableDec.Sub(sdkmath.LegacySmallestDec()) } else { - collateralBaseUnits := sdk.NewDecFromInt(cdp.Collateral.Amount).Mul(sdk.NewDecFromIntWithPrec(sdk.OneInt(), collateralParam.ConversionFactor.Int64())) + collateralBaseUnits := sdkmath.LegacyNewDecFromInt(cdp.Collateral.Amount).Mul(sdkmath.LegacyNewDecFromIntWithPrec(sdkmath.OneInt(), collateralParam.ConversionFactor.Int64())) return collateralBaseUnits.Quo(debtTotal) } } diff --git a/x/cdp/keeper/interest_test.go b/x/cdp/keeper/interest_test.go index 8be41b8ffc..198fbc43bf 100644 --- a/x/cdp/keeper/interest_test.go +++ b/x/cdp/keeper/interest_test.go @@ -9,7 +9,6 @@ import ( "github.com/stretchr/testify/suite" - tmproto "github.com/cometbft/cometbft/proto/tendermint/types" tmtime "github.com/cometbft/cometbft/types/time" "github.com/kava-labs/kava/app" @@ -27,7 +26,7 @@ type InterestTestSuite struct { func (suite *InterestTestSuite) SetupTest() { tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) cdc := tApp.AppCodec() tApp.InitializeFromGenesisStates( NewPricefeedGenStateMulti(cdc), @@ -41,9 +40,9 @@ func (suite *InterestTestSuite) SetupTest() { func (suite *InterestTestSuite) TestCalculateInterestFactor() { type args struct { - perSecondInterestRate sdk.Dec + perSecondInterestRate sdkmath.LegacyDec timeElapsed sdkmath.Int - expectedValue sdk.Dec + expectedValue sdkmath.LegacyDec } type test struct { @@ -57,73 +56,73 @@ func (suite *InterestTestSuite) TestCalculateInterestFactor() { { "1 year", args{ - perSecondInterestRate: sdk.MustNewDecFromStr("1.000000005555"), + perSecondInterestRate: sdkmath.LegacyMustNewDecFromStr("1.000000005555"), timeElapsed: sdkmath.NewInt(oneYearInSeconds), - expectedValue: sdk.MustNewDecFromStr("1.191463614477847370"), + expectedValue: sdkmath.LegacyMustNewDecFromStr("1.191463614477847370"), }, }, { "10 year", args{ - perSecondInterestRate: sdk.MustNewDecFromStr("1.000000005555"), + perSecondInterestRate: sdkmath.LegacyMustNewDecFromStr("1.000000005555"), timeElapsed: sdkmath.NewInt(oneYearInSeconds * 10), - expectedValue: sdk.MustNewDecFromStr("5.765113233897391189"), + expectedValue: sdkmath.LegacyMustNewDecFromStr("5.765113233897391189"), }, }, { "1 month", args{ - perSecondInterestRate: sdk.MustNewDecFromStr("1.000000005555"), + perSecondInterestRate: sdkmath.LegacyMustNewDecFromStr("1.000000005555"), timeElapsed: sdkmath.NewInt(oneYearInSeconds / 12), - expectedValue: sdk.MustNewDecFromStr("1.014705619075717373"), + expectedValue: sdkmath.LegacyMustNewDecFromStr("1.014705619075717373"), }, }, { "1 day", args{ - perSecondInterestRate: sdk.MustNewDecFromStr("1.000000005555"), + perSecondInterestRate: sdkmath.LegacyMustNewDecFromStr("1.000000005555"), timeElapsed: sdkmath.NewInt(oneYearInSeconds / 365), - expectedValue: sdk.MustNewDecFromStr("1.000480067194057924"), + expectedValue: sdkmath.LegacyMustNewDecFromStr("1.000480067194057924"), }, }, { "1 year: low interest rate", args{ - perSecondInterestRate: sdk.MustNewDecFromStr("1.000000000555"), + perSecondInterestRate: sdkmath.LegacyMustNewDecFromStr("1.000000000555"), timeElapsed: sdkmath.NewInt(oneYearInSeconds), - expectedValue: sdk.MustNewDecFromStr("1.017656545925063632"), + expectedValue: sdkmath.LegacyMustNewDecFromStr("1.017656545925063632"), }, }, { "1 year, lower interest rate", args{ - perSecondInterestRate: sdk.MustNewDecFromStr("1.000000000055"), + perSecondInterestRate: sdkmath.LegacyMustNewDecFromStr("1.000000000055"), timeElapsed: sdkmath.NewInt(oneYearInSeconds), - expectedValue: sdk.MustNewDecFromStr("1.001735985079841390"), + expectedValue: sdkmath.LegacyMustNewDecFromStr("1.001735985079841390"), }, }, { "1 year, lowest interest rate", args{ - perSecondInterestRate: sdk.MustNewDecFromStr("1.000000000005"), + perSecondInterestRate: sdkmath.LegacyMustNewDecFromStr("1.000000000005"), timeElapsed: sdkmath.NewInt(oneYearInSeconds), - expectedValue: sdk.MustNewDecFromStr("1.000157692432076670"), + expectedValue: sdkmath.LegacyMustNewDecFromStr("1.000157692432076670"), }, }, { "1 year: high interest rate", args{ - perSecondInterestRate: sdk.MustNewDecFromStr("1.000000055555"), + perSecondInterestRate: sdkmath.LegacyMustNewDecFromStr("1.000000055555"), timeElapsed: sdkmath.NewInt(oneYearInSeconds), - expectedValue: sdk.MustNewDecFromStr("5.766022095987868825"), + expectedValue: sdkmath.LegacyMustNewDecFromStr("5.766022095987868825"), }, }, { "1 year: higher interest rate", args{ - perSecondInterestRate: sdk.MustNewDecFromStr("1.000000555555"), + perSecondInterestRate: sdkmath.LegacyMustNewDecFromStr("1.000000555555"), timeElapsed: sdkmath.NewInt(oneYearInSeconds), - expectedValue: sdk.MustNewDecFromStr("40628388.864535408465693310"), + expectedValue: sdkmath.LegacyMustNewDecFromStr("40628388.864535408465693310"), }, }, // If we raise the per second interest rate too much we'll cause an integer overflow. @@ -131,9 +130,9 @@ func (suite *InterestTestSuite) TestCalculateInterestFactor() { { "1 year: highest interest rate", args{ - perSecondInterestRate: sdk.MustNewDecFromStr("1.000001555555"), + perSecondInterestRate: sdkmath.LegacyMustNewDecFromStr("1.000001555555"), timeElapsed: sdkmath.NewInt(oneYearInSeconds), - expectedValue: sdk.MustNewDecFromStr("2017093013158200407564.613502861572552603"), + expectedValue: sdkmath.LegacyMustNewDecFromStr("2017093013158200407564.613502861572552603"), }, }, } @@ -179,9 +178,9 @@ func (suite *InterestTestSuite) TestAccumulateInterest() { args{ ctype: "bnb-a", initialTime: time.Date(2020, 12, 15, 14, 0, 0, 0, time.UTC), - totalPrincipal: sdk.ZeroInt(), + totalPrincipal: sdkmath.ZeroInt(), timeElapsed: oneYearInSeconds, - expectedTotalPrincipal: sdk.ZeroInt(), + expectedTotalPrincipal: sdkmath.ZeroInt(), expectedLastAccrualTime: time.Date(2020, 12, 15, 14, 0, 0, 0, time.UTC).Add(time.Duration(int(time.Second) * oneYearInSeconds)), }, }, @@ -246,7 +245,7 @@ func (suite *InterestTestSuite) TestAccumulateInterest() { suite.ctx = suite.ctx.WithBlockTime(tc.args.initialTime) suite.keeper.SetTotalPrincipal(suite.ctx, tc.args.ctype, types.DefaultStableDenom, tc.args.totalPrincipal) suite.keeper.SetPreviousAccrualTime(suite.ctx, tc.args.ctype, suite.ctx.BlockTime()) - suite.keeper.SetInterestFactor(suite.ctx, tc.args.ctype, sdk.OneDec()) + suite.keeper.SetInterestFactor(suite.ctx, tc.args.ctype, sdkmath.LegacyOneDec()) updatedBlockTime := suite.ctx.BlockTime().Add(time.Duration(int(time.Second) * tc.args.timeElapsed)) suite.ctx = suite.ctx.WithBlockTime(updatedBlockTime) @@ -369,7 +368,7 @@ func (suite *InterestTestSuite) TestSynchronizeInterest() { // setup cdp state suite.keeper.SetPreviousAccrualTime(suite.ctx, tc.args.ctype, suite.ctx.BlockTime()) - suite.keeper.SetInterestFactor(suite.ctx, tc.args.ctype, sdk.OneDec()) + suite.keeper.SetInterestFactor(suite.ctx, tc.args.ctype, sdkmath.LegacyOneDec()) err = suite.keeper.AddCdp(suite.ctx, addrs[0], tc.args.initialCollateral, tc.args.initialPrincipal, tc.args.ctype) suite.Require().NoError(err) @@ -483,7 +482,7 @@ func (suite *InterestTestSuite) TestMultipleCDPInterest() { // setup cdp state suite.keeper.SetPreviousAccrualTime(suite.ctx, tc.args.ctype, suite.ctx.BlockTime()) - suite.keeper.SetInterestFactor(suite.ctx, tc.args.ctype, sdk.OneDec()) + suite.keeper.SetInterestFactor(suite.ctx, tc.args.ctype, sdkmath.LegacyOneDec()) // setup account state _, addrs := app.GeneratePrivKeyAddressPairs(tc.args.numberOfCdps) @@ -518,7 +517,7 @@ func (suite *InterestTestSuite) TestMultipleCDPInterest() { suite.Require().Equal(tc.args.expectedStableBalance, usdxSupply.Amount) suite.Require().Equal(tc.args.expectedTotalPrincipal, totalPrincipal) - sumOfCDPPrincipal := sdk.ZeroInt() + sumOfCDPPrincipal := sdkmath.ZeroInt() for j := 0; j < tc.args.numberOfCdps; j++ { cdp, found := suite.keeper.GetCDP(suite.ctx, tc.args.ctype, uint64(j+1)) @@ -623,7 +622,7 @@ func (suite *InterestTestSuite) TestCalculateCDPInterest() { // setup cdp state suite.keeper.SetPreviousAccrualTime(suite.ctx, tc.args.ctype, suite.ctx.BlockTime()) - suite.keeper.SetInterestFactor(suite.ctx, tc.args.ctype, sdk.OneDec()) + suite.keeper.SetInterestFactor(suite.ctx, tc.args.ctype, sdkmath.LegacyOneDec()) err = suite.keeper.AddCdp(suite.ctx, addrs[0], tc.args.initialCollateral, tc.args.initialPrincipal, tc.args.ctype) suite.Require().NoError(err) @@ -701,7 +700,7 @@ func (suite *InterestTestSuite) TestSyncInterestForRiskyCDPs() { // setup cdp state suite.keeper.SetPreviousAccrualTime(suite.ctx, tc.args.ctype, suite.ctx.BlockTime()) - suite.keeper.SetInterestFactor(suite.ctx, tc.args.ctype, sdk.OneDec()) + suite.keeper.SetInterestFactor(suite.ctx, tc.args.ctype, sdkmath.LegacyOneDec()) for j, addr := range addrs { initialPrincipal := tc.args.minPrincipal.Add(c("usdx", int64(j)*tc.args.principalIncrement.Amount.Int64())) err := suite.keeper.AddCdp(suite.ctx, addr, tc.args.initialCollateral, initialPrincipal, tc.args.ctype) @@ -720,12 +719,12 @@ func (suite *InterestTestSuite) TestSyncInterestForRiskyCDPs() { if cp.Type == tc.args.ctype { ctype = cp - cp.CheckCollateralizationIndexCount = sdk.NewInt(int64(tc.args.slice)) + cp.CheckCollateralizationIndexCount = sdkmath.NewInt(int64(tc.args.slice)) break } } - err = suite.keeper.SynchronizeInterestForRiskyCDPs(suite.ctx, sdk.MaxSortableDec, ctype) + err = suite.keeper.SynchronizeInterestForRiskyCDPs(suite.ctx, sdkmath.LegacyMaxSortableDec, ctype) suite.Require().NoError(err) cdpsUpdatedCount := 0 diff --git a/x/cdp/keeper/keeper.go b/x/cdp/keeper/keeper.go index 2ab77c3c9e..d9b5dc4cae 100644 --- a/x/cdp/keeper/keeper.go +++ b/x/cdp/keeper/keeper.go @@ -1,13 +1,14 @@ package keeper import ( + "context" "fmt" "time" sdkmath "cosmossdk.io/math" + "cosmossdk.io/store/prefix" + storetypes "cosmossdk.io/store/types" "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/store/prefix" - storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" @@ -58,22 +59,25 @@ func (k *Keeper) SetHooks(hooks types.CDPHooks) *Keeper { } // CdpDenomIndexIterator returns an sdk.Iterator for all cdps with matching collateral denom -func (k Keeper) CdpDenomIndexIterator(ctx sdk.Context, collateralType string) sdk.Iterator { - store := prefix.NewStore(ctx.KVStore(k.key), types.CdpKeyPrefix) - return sdk.KVStorePrefixIterator(store, types.DenomIterKey(collateralType)) +func (k Keeper) CdpDenomIndexIterator(ctx context.Context, collateralType string) storetypes.Iterator { + sdkCtx := sdk.UnwrapSDKContext(ctx) + store := prefix.NewStore(sdkCtx.KVStore(k.key), types.CdpKeyPrefix) + return storetypes.KVStorePrefixIterator(store, types.DenomIterKey(collateralType)) } // CdpCollateralRatioIndexIterator returns an sdk.Iterator for all cdps that have collateral denom // matching denom and collateral:debt ratio LESS THAN targetRatio -func (k Keeper) CdpCollateralRatioIndexIterator(ctx sdk.Context, collateralType string, targetRatio sdk.Dec) sdk.Iterator { - store := prefix.NewStore(ctx.KVStore(k.key), types.CollateralRatioIndexPrefix) - return store.Iterator(types.CollateralRatioIterKey(collateralType, sdk.ZeroDec()), types.CollateralRatioIterKey(collateralType, targetRatio)) +func (k Keeper) CdpCollateralRatioIndexIterator(ctx context.Context, collateralType string, targetRatio sdkmath.LegacyDec) storetypes.Iterator { + sdkCtx := sdk.UnwrapSDKContext(ctx) + store := prefix.NewStore(sdkCtx.KVStore(k.key), types.CollateralRatioIndexPrefix) + return store.Iterator(types.CollateralRatioIterKey(collateralType, sdkmath.LegacyZeroDec()), types.CollateralRatioIterKey(collateralType, targetRatio)) } // IterateAllCdps iterates over all cdps and performs a callback function -func (k Keeper) IterateAllCdps(ctx sdk.Context, cb func(cdp types.CDP) (stop bool)) { - store := prefix.NewStore(ctx.KVStore(k.key), types.CdpKeyPrefix) - iterator := sdk.KVStorePrefixIterator(store, []byte{}) +func (k Keeper) IterateAllCdps(ctx context.Context, cb func(cdp types.CDP) (stop bool)) { + sdkCtx := sdk.UnwrapSDKContext(ctx) + store := prefix.NewStore(sdkCtx.KVStore(k.key), types.CdpKeyPrefix) + iterator := storetypes.KVStorePrefixIterator(store, []byte{}) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { var cdp types.CDP @@ -86,7 +90,7 @@ func (k Keeper) IterateAllCdps(ctx sdk.Context, cb func(cdp types.CDP) (stop boo } // IterateCdpsByCollateralType iterates over cdps with matching denom and performs a callback function -func (k Keeper) IterateCdpsByCollateralType(ctx sdk.Context, collateralType string, cb func(cdp types.CDP) (stop bool)) { +func (k Keeper) IterateCdpsByCollateralType(ctx context.Context, collateralType string, cb func(cdp types.CDP) (stop bool)) { iterator := k.CdpDenomIndexIterator(ctx, collateralType) defer iterator.Close() @@ -101,7 +105,7 @@ func (k Keeper) IterateCdpsByCollateralType(ctx sdk.Context, collateralType stri // IterateCdpsByCollateralRatio iterate over cdps with collateral denom equal to denom and // collateral:debt ratio LESS THAN targetRatio and performs a callback function. -func (k Keeper) IterateCdpsByCollateralRatio(ctx sdk.Context, collateralType string, targetRatio sdk.Dec, cb func(cdp types.CDP) (stop bool)) { +func (k Keeper) IterateCdpsByCollateralRatio(ctx context.Context, collateralType string, targetRatio sdkmath.LegacyDec, cb func(cdp types.CDP) (stop bool)) { iterator := k.CdpCollateralRatioIndexIterator(ctx, collateralType, targetRatio) defer iterator.Close() @@ -120,19 +124,20 @@ func (k Keeper) IterateCdpsByCollateralRatio(ctx sdk.Context, collateralType str // GetSliceOfCDPsByRatioAndType returns a slice of cdps of size equal to the input cutoffCount // sorted by target ratio in ascending order (ie, the lowest collateral:debt ratio cdps are returned first) -func (k Keeper) GetSliceOfCDPsByRatioAndType(ctx sdk.Context, cutoffCount sdkmath.Int, targetRatio sdk.Dec, collateralType string) (cdps types.CDPs) { - count := sdk.ZeroInt() +func (k Keeper) GetSliceOfCDPsByRatioAndType(ctx context.Context, cutoffCount sdkmath.Int, targetRatio sdkmath.LegacyDec, collateralType string) (cdps types.CDPs) { + count := sdkmath.ZeroInt() k.IterateCdpsByCollateralRatio(ctx, collateralType, targetRatio, func(cdp types.CDP) bool { cdps = append(cdps, cdp) - count = count.Add(sdk.OneInt()) + count = count.Add(sdkmath.OneInt()) return count.GTE(cutoffCount) }) return cdps } // GetPreviousAccrualTime returns the last time an individual market accrued interest -func (k Keeper) GetPreviousAccrualTime(ctx sdk.Context, ctype string) (time.Time, bool) { - store := prefix.NewStore(ctx.KVStore(k.key), types.PreviousAccrualTimePrefix) +func (k Keeper) GetPreviousAccrualTime(ctx context.Context, ctype string) (time.Time, bool) { + sdkCtx := sdk.UnwrapSDKContext(ctx) + store := prefix.NewStore(sdkCtx.KVStore(k.key), types.PreviousAccrualTimePrefix) bz := store.Get([]byte(ctype)) if bz == nil { return time.Time{}, false @@ -145,8 +150,9 @@ func (k Keeper) GetPreviousAccrualTime(ctx sdk.Context, ctype string) (time.Time } // SetPreviousAccrualTime sets the most recent accrual time for a particular market -func (k Keeper) SetPreviousAccrualTime(ctx sdk.Context, ctype string, previousAccrualTime time.Time) { - store := prefix.NewStore(ctx.KVStore(k.key), types.PreviousAccrualTimePrefix) +func (k Keeper) SetPreviousAccrualTime(ctx context.Context, ctype string, previousAccrualTime time.Time) { + sdkCtx := sdk.UnwrapSDKContext(ctx) + store := prefix.NewStore(sdkCtx.KVStore(k.key), types.PreviousAccrualTimePrefix) bz, err := previousAccrualTime.MarshalBinary() if err != nil { panic(err) @@ -155,13 +161,14 @@ func (k Keeper) SetPreviousAccrualTime(ctx sdk.Context, ctype string, previousAc } // GetInterestFactor returns the current interest factor for an individual collateral type -func (k Keeper) GetInterestFactor(ctx sdk.Context, ctype string) (sdk.Dec, bool) { - store := prefix.NewStore(ctx.KVStore(k.key), types.InterestFactorPrefix) +func (k Keeper) GetInterestFactor(ctx context.Context, ctype string) (sdkmath.LegacyDec, bool) { + sdkCtx := sdk.UnwrapSDKContext(ctx) + store := prefix.NewStore(sdkCtx.KVStore(k.key), types.InterestFactorPrefix) bz := store.Get([]byte(ctype)) if bz == nil { - return sdk.ZeroDec(), false + return sdkmath.LegacyZeroDec(), false } - var interestFactor sdk.Dec + var interestFactor sdkmath.LegacyDec if err := interestFactor.Unmarshal(bz); err != nil { panic(err) } @@ -169,8 +176,9 @@ func (k Keeper) GetInterestFactor(ctx sdk.Context, ctype string) (sdk.Dec, bool) } // SetInterestFactor sets the current interest factor for an individual collateral type -func (k Keeper) SetInterestFactor(ctx sdk.Context, ctype string, interestFactor sdk.Dec) { - store := prefix.NewStore(ctx.KVStore(k.key), types.InterestFactorPrefix) +func (k Keeper) SetInterestFactor(ctx context.Context, ctype string, interestFactor sdkmath.LegacyDec) { + sdkCtx := sdk.UnwrapSDKContext(ctx) + store := prefix.NewStore(sdkCtx.KVStore(k.key), types.InterestFactorPrefix) bz, err := interestFactor.Marshal() if err != nil { panic(err) @@ -179,28 +187,29 @@ func (k Keeper) SetInterestFactor(ctx sdk.Context, ctype string, interestFactor } // IncrementTotalPrincipal increments the total amount of debt that has been drawn with that collateral type -func (k Keeper) IncrementTotalPrincipal(ctx sdk.Context, collateralType string, principal sdk.Coin) { +func (k Keeper) IncrementTotalPrincipal(ctx context.Context, collateralType string, principal sdk.Coin) { total := k.GetTotalPrincipal(ctx, collateralType, principal.Denom) total = total.Add(principal.Amount) k.SetTotalPrincipal(ctx, collateralType, principal.Denom, total) } // DecrementTotalPrincipal decrements the total amount of debt that has been drawn for a particular collateral type -func (k Keeper) DecrementTotalPrincipal(ctx sdk.Context, collateralType string, principal sdk.Coin) { +func (k Keeper) DecrementTotalPrincipal(ctx context.Context, collateralType string, principal sdk.Coin) { total := k.GetTotalPrincipal(ctx, collateralType, principal.Denom) // NOTE: negative total principal can happen in tests due to rounding errors // in fee calculation - total = sdk.MaxInt(total.Sub(principal.Amount), sdk.ZeroInt()) + total = sdkmath.MaxInt(total.Sub(principal.Amount), sdkmath.ZeroInt()) k.SetTotalPrincipal(ctx, collateralType, principal.Denom, total) } // GetTotalPrincipal returns the total amount of principal that has been drawn for a particular collateral -func (k Keeper) GetTotalPrincipal(ctx sdk.Context, collateralType, principalDenom string) (total sdkmath.Int) { - store := prefix.NewStore(ctx.KVStore(k.key), types.PrincipalKeyPrefix) +func (k Keeper) GetTotalPrincipal(ctx context.Context, collateralType, principalDenom string) (total sdkmath.Int) { + sdkCtx := sdk.UnwrapSDKContext(ctx) + store := prefix.NewStore(sdkCtx.KVStore(k.key), types.PrincipalKeyPrefix) bz := store.Get([]byte(collateralType + principalDenom)) if bz == nil { - k.SetTotalPrincipal(ctx, collateralType, principalDenom, sdk.ZeroInt()) - return sdk.ZeroInt() + k.SetTotalPrincipal(ctx, collateralType, principalDenom, sdkmath.ZeroInt()) + return sdkmath.ZeroInt() } if err := total.Unmarshal(bz); err != nil { panic(err) @@ -209,8 +218,9 @@ func (k Keeper) GetTotalPrincipal(ctx sdk.Context, collateralType, principalDeno } // SetTotalPrincipal sets the total amount of principal that has been drawn for the input collateral -func (k Keeper) SetTotalPrincipal(ctx sdk.Context, collateralType, principalDenom string, total sdkmath.Int) { - store := prefix.NewStore(ctx.KVStore(k.key), types.PrincipalKeyPrefix) +func (k Keeper) SetTotalPrincipal(ctx context.Context, collateralType, principalDenom string, total sdkmath.Int) { + sdkCtx := sdk.UnwrapSDKContext(ctx) + store := prefix.NewStore(sdkCtx.KVStore(k.key), types.PrincipalKeyPrefix) _, found := k.GetCollateral(ctx, collateralType) if !found { panic(fmt.Sprintf("collateral not found: %s", collateralType)) diff --git a/x/cdp/keeper/keeper_bench_test.go b/x/cdp/keeper/keeper_bench_test.go index 974451fd8d..7a0a7dae41 100644 --- a/x/cdp/keeper/keeper_bench_test.go +++ b/x/cdp/keeper/keeper_bench_test.go @@ -4,11 +4,9 @@ import ( "testing" sdkmath "cosmossdk.io/math" - sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - - tmproto "github.com/cometbft/cometbft/proto/tendermint/types" + _ "github.com/cometbft/cometbft/proto/tendermint/types" tmtime "github.com/cometbft/cometbft/types/time" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/kava-labs/kava/app" "github.com/kava-labs/kava/x/cdp/keeper" @@ -44,7 +42,7 @@ func BenchmarkAccountIteration(b *testing.B) { for _, bm := range benchmarks { b.Run(bm.name, func(b *testing.B) { tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) ak := tApp.GetAccountKeeper() bk := tApp.GetBankKeeper() @@ -64,7 +62,7 @@ func BenchmarkAccountIteration(b *testing.B) { b.ResetTimer() for i := 0; i < b.N; i++ { ak.IterateAccounts(ctx, - func(acc authtypes.AccountI) (stop bool) { + func(acc sdk.AccountI) (stop bool) { coins := bk.GetAllBalances(ctx, acc.GetAddress()) coinsResult = coins return false @@ -76,7 +74,7 @@ func BenchmarkAccountIteration(b *testing.B) { func createCdps(n int) (app.TestApp, sdk.Context, keeper.Keeper) { tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) cdc := tApp.AppCodec() _, addrs := app.GeneratePrivKeyAddressPairs(n) @@ -124,7 +122,7 @@ var errResult error func BenchmarkCdpCreation(b *testing.B) { tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) cdc := tApp.AppCodec() _, addrs := app.GeneratePrivKeyAddressPairs(b.N) diff --git a/x/cdp/keeper/keeper_test.go b/x/cdp/keeper/keeper_test.go index dff4095d72..a1d0f6511d 100644 --- a/x/cdp/keeper/keeper_test.go +++ b/x/cdp/keeper/keeper_test.go @@ -1,7 +1,7 @@ package keeper_test import ( - tmproto "github.com/cometbft/cometbft/proto/tendermint/types" + _ "github.com/cometbft/cometbft/proto/tendermint/types" tmtime "github.com/cometbft/cometbft/types/time" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/suite" @@ -24,7 +24,7 @@ func (suite *KeeperTestSuite) SetupTest() { func (suite *KeeperTestSuite) ResetChain() { tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) keeper := tApp.GetCDPKeeper() suite.app = tApp diff --git a/x/cdp/keeper/params.go b/x/cdp/keeper/params.go index 62b3a4a6a9..978fc89d0d 100644 --- a/x/cdp/keeper/params.go +++ b/x/cdp/keeper/params.go @@ -1,29 +1,34 @@ package keeper import ( - "fmt" - + "context" sdkmath "cosmossdk.io/math" + "fmt" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/kava-labs/kava/x/cdp/types" ) // GetParams returns the params from the store -func (k Keeper) GetParams(ctx sdk.Context) types.Params { +func (k Keeper) GetParams(ctx context.Context) types.Params { var p types.Params - k.paramSubspace.GetParamSetIfExists(ctx, &p) + sdkCtx := sdk.UnwrapSDKContext(ctx) + k.paramSubspace.GetParamSetIfExists(sdkCtx, &p) return p } // SetParams sets params on the store -func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { - k.paramSubspace.SetParamSet(ctx, ¶ms) +func (k Keeper) SetParams(ctx context.Context, params types.Params) { + sdkCtx := sdk.UnwrapSDKContext(ctx) + k.paramSubspace.SetParamSet(sdkCtx, ¶ms) } // GetCollateral returns the collateral param with corresponding denom -func (k Keeper) GetCollateral(ctx sdk.Context, collateralType string) (types.CollateralParam, bool) { +func (k Keeper) GetCollateral(ctx context.Context, collateralType string) (types.CollateralParam, bool) { + // print stack from what function it was called from + //fmt.Println("stack", string(debug.Stack())) params := k.GetParams(ctx) + //fmt.Println("params.CollateralParams", params.CollateralParams) for _, cp := range params.CollateralParams { if cp.Type == collateralType { return cp, true @@ -33,7 +38,7 @@ func (k Keeper) GetCollateral(ctx sdk.Context, collateralType string) (types.Col } // GetCollateralTypes returns an array of collateral types -func (k Keeper) GetCollateralTypes(ctx sdk.Context) []string { +func (k Keeper) GetCollateralTypes(ctx context.Context) []string { params := k.GetParams(ctx) var denoms []string for _, cp := range params.CollateralParams { @@ -43,7 +48,7 @@ func (k Keeper) GetCollateralTypes(ctx sdk.Context) []string { } // GetDebtParam returns the debt param with matching denom -func (k Keeper) GetDebtParam(ctx sdk.Context, denom string) (types.DebtParam, bool) { +func (k Keeper) GetDebtParam(ctx context.Context, denom string) (types.DebtParam, bool) { dp := k.GetParams(ctx).DebtParam if dp.Denom == denom { return dp, true @@ -51,7 +56,7 @@ func (k Keeper) GetDebtParam(ctx sdk.Context, denom string) (types.DebtParam, bo return types.DebtParam{}, false } -func (k Keeper) getSpotMarketID(ctx sdk.Context, collateralType string) string { +func (k Keeper) getSpotMarketID(ctx context.Context, collateralType string) string { cp, found := k.GetCollateral(ctx, collateralType) if !found { panic(fmt.Sprintf("collateral not found: %s", collateralType)) @@ -59,7 +64,7 @@ func (k Keeper) getSpotMarketID(ctx sdk.Context, collateralType string) string { return cp.SpotMarketID } -func (k Keeper) getliquidationMarketID(ctx sdk.Context, collateralType string) string { +func (k Keeper) getliquidationMarketID(ctx context.Context, collateralType string) string { cp, found := k.GetCollateral(ctx, collateralType) if !found { panic(fmt.Sprintf("collateral not found: %s", collateralType)) @@ -67,7 +72,7 @@ func (k Keeper) getliquidationMarketID(ctx sdk.Context, collateralType string) s return cp.LiquidationMarketID } -func (k Keeper) getLiquidationRatio(ctx sdk.Context, collateralType string) sdk.Dec { +func (k Keeper) getLiquidationRatio(ctx context.Context, collateralType string) sdkmath.LegacyDec { cp, found := k.GetCollateral(ctx, collateralType) if !found { panic(fmt.Sprintf("collateral not found: %s", collateralType)) @@ -75,7 +80,7 @@ func (k Keeper) getLiquidationRatio(ctx sdk.Context, collateralType string) sdk. return cp.LiquidationRatio } -func (k Keeper) getLiquidationPenalty(ctx sdk.Context, collateralType string) sdk.Dec { +func (k Keeper) getLiquidationPenalty(ctx context.Context, collateralType string) sdkmath.LegacyDec { cp, found := k.GetCollateral(ctx, collateralType) if !found { panic(fmt.Sprintf("collateral not found: %s", collateralType)) @@ -83,7 +88,7 @@ func (k Keeper) getLiquidationPenalty(ctx sdk.Context, collateralType string) sd return cp.LiquidationPenalty } -func (k Keeper) getAuctionSize(ctx sdk.Context, collateralType string) sdkmath.Int { +func (k Keeper) getAuctionSize(ctx context.Context, collateralType string) sdkmath.Int { cp, found := k.GetCollateral(ctx, collateralType) if !found { panic(fmt.Sprintf("collateral not found: %s", collateralType)) @@ -92,7 +97,7 @@ func (k Keeper) getAuctionSize(ctx sdk.Context, collateralType string) sdkmath.I } // GetFeeRate returns the per second fee rate for the input denom -func (k Keeper) getFeeRate(ctx sdk.Context, collateralType string) (fee sdk.Dec) { +func (k Keeper) getFeeRate(ctx context.Context, collateralType string) (fee sdkmath.LegacyDec) { collalateralParam, found := k.GetCollateral(ctx, collateralType) if !found { panic(fmt.Sprintf("could not get fee rate for %s, collateral not found", collateralType)) diff --git a/x/cdp/keeper/querier.go b/x/cdp/keeper/querier.go index 143dbff0ea..c443e91252 100644 --- a/x/cdp/keeper/querier.go +++ b/x/cdp/keeper/querier.go @@ -1,6 +1,7 @@ package keeper import ( + sdkmath "cosmossdk.io/math" "fmt" "github.com/cosmos/cosmos-sdk/client" @@ -54,7 +55,7 @@ func FilterCDPs(ctx sdk.Context, k Keeper, params types.QueryCdpsParams) (types. } // match cdp ratio (if supplied) - if !params.Ratio.IsNil() && params.Ratio.GT(sdk.ZeroDec()) { + if !params.Ratio.IsNil() && params.Ratio.GT(sdkmath.LegacyZeroDec()) { denoms := k.GetCollateralTypes(ctx) for _, denom := range denoms { ratio, err := k.CalculateCollateralizationRatioFromAbsoluteRatio(ctx, denom, params.Ratio, "liquidation") @@ -68,7 +69,7 @@ func FilterCDPs(ctx sdk.Context, k Keeper, params types.QueryCdpsParams) (types. var commonCDPs types.CDPs // If no params specified, fetch all CDPs - if params.CollateralType == "" && len(params.Owner) == 0 && params.ID == 0 && params.Ratio.Equal(sdk.ZeroDec()) { + if params.CollateralType == "" && len(params.Owner) == 0 && params.ID == 0 && params.Ratio.Equal(sdkmath.LegacyZeroDec()) { commonCDPs = k.GetAllCdps(ctx) } @@ -105,7 +106,7 @@ func FilterCDPs(ctx sdk.Context, k Keeper, params types.QueryCdpsParams) (types. } } - if !params.Ratio.IsNil() && params.Ratio.GT(sdk.ZeroDec()) { + if !params.Ratio.IsNil() && params.Ratio.GT(sdkmath.LegacyZeroDec()) { if len(matchRatio) == 0 { return nil, nil } diff --git a/x/cdp/keeper/seize.go b/x/cdp/keeper/seize.go index 77529a600b..8259ad956f 100644 --- a/x/cdp/keeper/seize.go +++ b/x/cdp/keeper/seize.go @@ -47,7 +47,7 @@ func (k Keeper) SeizeCollateral(ctx sdk.Context, cdp types.CDP) error { deposits := k.GetDeposits(ctx, cdp.ID) debt := cdp.GetTotalPrincipal().Amount modAccountDebt := k.getModAccountDebt(ctx, types.ModuleName) - debt = sdk.MinInt(debt, modAccountDebt) + debt = sdkmath.MinInt(debt, modAccountDebt) debtCoin := sdk.NewCoin(k.GetDebtDenom(ctx), debt) err := k.bankKeeper.SendCoinsFromModuleToModule(ctx, types.ModuleName, types.LiquidatorMacc, sdk.NewCoins(debtCoin)) if err != nil { @@ -88,19 +88,19 @@ func (k Keeper) SeizeCollateral(ctx sdk.Context, cdp types.CDP) error { } // LiquidateCdps seizes collateral from all CDPs below the input liquidation ratio -func (k Keeper) LiquidateCdps(ctx sdk.Context, marketID string, collateralType string, liquidationRatio sdk.Dec, count sdkmath.Int) error { +func (k Keeper) LiquidateCdps(ctx sdk.Context, marketID string, collateralType string, liquidationRatio sdkmath.LegacyDec, count sdkmath.Int) error { price, err := k.pricefeedKeeper.GetCurrentPrice(ctx, marketID) if err != nil { return err } priceDivLiqRatio := price.Price.Quo(liquidationRatio) if priceDivLiqRatio.IsZero() { - priceDivLiqRatio = sdk.SmallestDec() + priceDivLiqRatio = sdkmath.LegacySmallestDec() } // price = $0.5 // liquidation ratio = 1.5 // normalizedRatio = (1/(0.5/1.5)) = 3 - normalizedRatio := sdk.OneDec().Quo(priceDivLiqRatio) + normalizedRatio := sdkmath.LegacyOneDec().Quo(priceDivLiqRatio) cdpsToLiquidate := k.GetSliceOfCDPsByRatioAndType(ctx, count, normalizedRatio, collateralType) for _, c := range cdpsToLiquidate { k.hooks.BeforeCDPModified(ctx, c) @@ -115,7 +115,7 @@ func (k Keeper) LiquidateCdps(ctx sdk.Context, marketID string, collateralType s // ApplyLiquidationPenalty multiplies the input debt amount by the liquidation penalty func (k Keeper) ApplyLiquidationPenalty(ctx sdk.Context, collateralType string, debt sdkmath.Int) sdkmath.Int { penalty := k.getLiquidationPenalty(ctx, collateralType) - return sdk.NewDecFromInt(debt).Mul(penalty).RoundInt() + return sdkmath.LegacyNewDecFromInt(debt).Mul(penalty).RoundInt() } // ValidateLiquidation validate that adding the input principal puts the cdp below the liquidation ratio @@ -141,7 +141,7 @@ func (k Keeper) payoutKeeperLiquidationReward(ctx sdk.Context, keeper sdk.AccAdd if !found { return types.CDP{}, errorsmod.Wrapf(types.ErrInvalidCollateral, "%s", cdp.Type) } - reward := sdk.NewDecFromInt(cdp.Collateral.Amount).Mul(collateralParam.KeeperRewardPercentage).RoundInt() + reward := sdkmath.LegacyNewDecFromInt(cdp.Collateral.Amount).Mul(collateralParam.KeeperRewardPercentage).RoundInt() rewardCoin := sdk.NewCoin(cdp.Collateral.Denom, reward) paidReward := false deposits := k.GetDeposits(ctx, cdp.ID) diff --git a/x/cdp/keeper/seize_test.go b/x/cdp/keeper/seize_test.go index 37c8428a56..e3531492d3 100644 --- a/x/cdp/keeper/seize_test.go +++ b/x/cdp/keeper/seize_test.go @@ -11,11 +11,10 @@ import ( "github.com/stretchr/testify/suite" sdkmath "cosmossdk.io/math" + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/simulation" - abci "github.com/cometbft/cometbft/abci/types" - tmproto "github.com/cometbft/cometbft/proto/tendermint/types" tmtime "github.com/cometbft/cometbft/types/time" "github.com/kava-labs/kava/app" @@ -42,18 +41,24 @@ type liquidationTracker struct { } func (suite *SeizeTestSuite) SetupTest() { + fmt.Println("SetupTest()") tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now(), ChainID: app.TestChainId}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now(), ChainID: app.TestChainId}) tracker := liquidationTracker{} coins := cs(c("btc", 100000000), c("xrp", 10000000000)) + + fmt.Println("Generating addresses") + _, addrs := app.GeneratePrivKeyAddressPairs(100) authGS := app.NewFundedGenStateWithSameCoins(tApp.AppCodec(), coins, addrs) + fmt.Println("Initializing app") tApp.InitializeFromGenesisStates( authGS, NewPricefeedGenStateMulti(tApp.AppCodec()), NewCDPGenStateMulti(tApp.AppCodec()), ) + fmt.Println("App initialized") suite.ctx = ctx suite.app = tApp suite.keeper = tApp.GetCDPKeeper() @@ -64,7 +69,8 @@ func (suite *SeizeTestSuite) SetupTest() { func (suite *SeizeTestSuite) createCdps() { tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + fmt.Println("creating new context") + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) cdps := make(types.CDPs, 100) _, addrs := app.GeneratePrivKeyAddressPairs(100) tracker := liquidationTracker{} @@ -77,6 +83,7 @@ func (suite *SeizeTestSuite) createCdps() { NewCDPGenStateMulti(tApp.AppCodec()), ) + fmt.Println("initialized app from genesis state") suite.ctx = ctx suite.app = tApp suite.keeper = tApp.GetCDPKeeper() @@ -99,6 +106,7 @@ func (suite *SeizeTestSuite) createCdps() { tracker.debt += int64(debt) } } + fmt.Println("creating collateral", collateral) err := suite.keeper.AddCdp(suite.ctx, addrs[j], c(collateral, int64(amount)), c("usdx", int64(debt)), collateral+"-a") suite.NoError(err) c, f := suite.keeper.GetCDP(suite.ctx, collateral+"-a", uint64(j+1)) @@ -111,7 +119,7 @@ func (suite *SeizeTestSuite) createCdps() { suite.liquidations = tracker } -func (suite *SeizeTestSuite) setPrice(price sdk.Dec, market string) { +func (suite *SeizeTestSuite) setPrice(price sdkmath.LegacyDec, market string) { pfKeeper := suite.app.GetPriceFeedKeeper() _, err := pfKeeper.SetPrice(suite.ctx, sdk.AccAddress{}, market, price, suite.ctx.BlockTime().Add(time.Hour*3)) @@ -225,9 +233,9 @@ func (suite *SeizeTestSuite) TestKeeperLiquidation() { type args struct { ctype string blockTime time.Time - initialPrice sdk.Dec - finalPrice sdk.Dec - finalTwapPrice sdk.Dec + initialPrice sdkmath.LegacyDec + finalPrice sdkmath.LegacyDec + finalTwapPrice sdkmath.LegacyDec collateral sdk.Coin principal sdk.Coin expectedKeeperCoins sdk.Coins // additional coins (if any) the borrower address should have after successfully liquidating position @@ -388,7 +396,9 @@ func (suite *SeizeTestSuite) TestKeeperLiquidation() { for _, tc := range testCases { suite.Run(tc.name, func() { + fmt.Println("settings up test") suite.SetupTest() + fmt.Println("test setup complete") spotMarket := fmt.Sprintf("%s:usd", tc.args.collateral.Denom) liquidationMarket := fmt.Sprintf("%s:30", spotMarket) @@ -402,7 +412,7 @@ func (suite *SeizeTestSuite) TestKeeperLiquidation() { // setup cdp state suite.keeper.SetPreviousAccrualTime(suite.ctx, tc.args.ctype, suite.ctx.BlockTime()) - suite.keeper.SetInterestFactor(suite.ctx, tc.args.ctype, sdk.OneDec()) + suite.keeper.SetInterestFactor(suite.ctx, tc.args.ctype, sdkmath.LegacyOneDec()) err = suite.keeper.AddCdp(suite.ctx, suite.addrs[0], tc.args.collateral, tc.args.principal, tc.args.ctype) suite.Require().NoError(err) @@ -450,8 +460,8 @@ func (suite *SeizeTestSuite) TestBeginBlockerLiquidation() { type args struct { ctype string blockTime time.Time - initialPrice sdk.Dec - finalPrice sdk.Dec + initialPrice sdkmath.LegacyDec + finalPrice sdkmath.LegacyDec collaterals sdk.Coins principals sdk.Coins expectedAuctions []auctiontypes.Auction // the auctions we should expect to find have been started @@ -537,7 +547,7 @@ func (suite *SeizeTestSuite) TestBeginBlockerLiquidation() { // setup cdp state suite.keeper.SetPreviousAccrualTime(suite.ctx, tc.args.ctype, suite.ctx.BlockTime()) - suite.keeper.SetInterestFactor(suite.ctx, tc.args.ctype, sdk.OneDec()) + suite.keeper.SetInterestFactor(suite.ctx, tc.args.ctype, sdkmath.LegacyOneDec()) for idx, col := range tc.args.collaterals { err := suite.keeper.AddCdp(suite.ctx, suite.addrs[idx], col, tc.args.principals[idx], tc.args.ctype) @@ -550,7 +560,8 @@ func (suite *SeizeTestSuite) TestBeginBlockerLiquidation() { err = pk.SetCurrentPrices(suite.ctx, "btc:usd") suite.Require().NoError(err) - _ = suite.app.BeginBlocker(suite.ctx, abci.RequestBeginBlock{Header: suite.ctx.BlockHeader()}) + _, err = suite.app.BeginBlocker(suite.ctx) + suite.Require().NoError(err) ak := suite.app.GetAuctionKeeper() auctions := ak.GetAllAuctions(suite.ctx) if tc.errArgs.expectLiquidate { diff --git a/x/cdp/module.go b/x/cdp/module.go index 32d07d1c56..f759cae163 100644 --- a/x/cdp/module.go +++ b/x/cdp/module.go @@ -2,6 +2,7 @@ package cdp import ( "context" + "cosmossdk.io/core/appmodule" "encoding/json" "fmt" @@ -22,6 +23,7 @@ import ( ) var ( + _ appmodule.AppModule = AppModule{} _ module.AppModule = AppModule{} _ module.AppModuleBasic = AppModuleBasic{} ) @@ -145,11 +147,17 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw } // BeginBlock module begin-block -func (am AppModule) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock) { - BeginBlocker(ctx, req, am.keeper) +func (am AppModule) BeginBlock(ctx sdk.Context) error { + BeginBlocker(ctx, am.keeper) + + return nil } // EndBlock module end-block -func (am AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { - return []abci.ValidatorUpdate{} +func (am AppModule) EndBlock(_ sdk.Context) ([]abci.ValidatorUpdate, error) { + return []abci.ValidatorUpdate{}, nil } + +func (AppModule) IsOnePerModuleType() {} + +func (AppModule) IsAppModule() {} diff --git a/x/cdp/spec/02_state.md b/x/cdp/spec/02_state.md index bdf3674426..550daf31db 100644 --- a/x/cdp/spec/02_state.md +++ b/x/cdp/spec/02_state.md @@ -31,7 +31,7 @@ type CDP struct { Principal sdk.Coin AccumulatedFees sdk.Coin FeesUpdated time.Time - InterestFactor sdk.Dec + InterestFactor sdkmath.LegacyDec } ``` diff --git a/x/cdp/types/cdp.go b/x/cdp/types/cdp.go index df38a9b344..dce065d7f3 100644 --- a/x/cdp/types/cdp.go +++ b/x/cdp/types/cdp.go @@ -1,6 +1,7 @@ package types import ( + sdkmath "cosmossdk.io/math" "errors" "fmt" "strings" @@ -12,8 +13,8 @@ import ( ) // NewCDP creates a new CDP object -func NewCDP(id uint64, owner sdk.AccAddress, collateral sdk.Coin, collateralType string, principal sdk.Coin, time time.Time, interestFactor sdk.Dec) CDP { - fees := sdk.NewCoin(principal.Denom, sdk.ZeroInt()) +func NewCDP(id uint64, owner sdk.AccAddress, collateral sdk.Coin, collateralType string, principal sdk.Coin, time time.Time, interestFactor sdkmath.LegacyDec) CDP { + fees := sdk.NewCoin(principal.Denom, sdkmath.ZeroInt()) return CDP{ ID: id, Owner: owner, @@ -27,7 +28,7 @@ func NewCDP(id uint64, owner sdk.AccAddress, collateral sdk.Coin, collateralType } // NewCDPWithFees creates a new CDP object, for use during migration -func NewCDPWithFees(id uint64, owner sdk.AccAddress, collateral sdk.Coin, collateralType string, principal, fees sdk.Coin, time time.Time, interestFactor sdk.Dec) CDP { +func NewCDPWithFees(id uint64, owner sdk.AccAddress, collateral sdk.Coin, collateralType string, principal, fees sdk.Coin, time time.Time, interestFactor sdkmath.LegacyDec) CDP { return CDP{ ID: id, Owner: owner, @@ -77,12 +78,12 @@ func (cdp CDP) GetTotalPrincipal() sdk.Coin { // The normalized principal is effectively how big the principal would have been if it had been borrowed at time 0 and not touched since. // // An error is returned if the cdp interest factor is in an invalid state. -func (cdp CDP) GetNormalizedPrincipal() (sdk.Dec, error) { +func (cdp CDP) GetNormalizedPrincipal() (sdkmath.LegacyDec, error) { unsyncedDebt := cdp.GetTotalPrincipal().Amount - if cdp.InterestFactor.LT(sdk.OneDec()) { - return sdk.Dec{}, fmt.Errorf("interest factor '%s' must be ≥ 1", cdp.InterestFactor) + if cdp.InterestFactor.LT(sdkmath.LegacyOneDec()) { + return sdkmath.LegacyDec{}, fmt.Errorf("interest factor '%s' must be ≥ 1", cdp.InterestFactor) } - return sdk.NewDecFromInt(unsyncedDebt).Quo(cdp.InterestFactor), nil + return sdkmath.LegacyNewDecFromInt(unsyncedDebt).Quo(cdp.InterestFactor), nil } // CDPs a collection of CDP objects @@ -102,12 +103,12 @@ func (cdps CDPs) Validate() error { // This is only used for the legacy querier and legacy rest endpoints. type AugmentedCDP struct { CDP `json:"cdp" yaml:"cdp"` - CollateralValue sdk.Coin `json:"collateral_value" yaml:"collateral_value"` // collateral's market value in debt coin - CollateralizationRatio sdk.Dec `json:"collateralization_ratio" yaml:"collateralization_ratio"` // current collateralization ratio + CollateralValue sdk.Coin `json:"collateral_value" yaml:"collateral_value"` // collateral's market value in debt coin + CollateralizationRatio sdkmath.LegacyDec `json:"collateralization_ratio" yaml:"collateralization_ratio"` // current collateralization ratio } // NewAugmentedCDP creates a new AugmentedCDP object -func NewAugmentedCDP(cdp CDP, collateralValue sdk.Coin, collateralizationRatio sdk.Dec) AugmentedCDP { +func NewAugmentedCDP(cdp CDP, collateralValue sdk.Coin, collateralizationRatio sdkmath.LegacyDec) AugmentedCDP { augmentedCDP := AugmentedCDP{ CDP: CDP{ ID: cdp.ID, @@ -164,7 +165,7 @@ func (augcdps AugmentedCDPs) String() string { } // NewCDPResponse creates a new CDPResponse object -func NewCDPResponse(cdp CDP, collateralValue sdk.Coin, collateralizationRatio sdk.Dec) CDPResponse { +func NewCDPResponse(cdp CDP, collateralValue sdk.Coin, collateralizationRatio sdkmath.LegacyDec) CDPResponse { return CDPResponse{ ID: cdp.ID, Owner: cdp.Owner.String(), diff --git a/x/cdp/types/cdp.pb.go b/x/cdp/types/cdp.pb.go index a59e9caf92..2994788dd8 100644 --- a/x/cdp/types/cdp.pb.go +++ b/x/cdp/types/cdp.pb.go @@ -4,6 +4,7 @@ package types import ( + cosmossdk_io_math "cosmossdk.io/math" fmt "fmt" _ "github.com/cosmos/cosmos-proto" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" @@ -39,7 +40,7 @@ type CDP struct { Principal types.Coin `protobuf:"bytes,5,opt,name=principal,proto3" json:"principal"` AccumulatedFees types.Coin `protobuf:"bytes,6,opt,name=accumulated_fees,json=accumulatedFees,proto3" json:"accumulated_fees"` FeesUpdated time.Time `protobuf:"bytes,7,opt,name=fees_updated,json=feesUpdated,proto3,stdtime" json:"fees_updated"` - InterestFactor github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,8,opt,name=interest_factor,json=interestFactor,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"interest_factor"` + InterestFactor cosmossdk_io_math.LegacyDec `protobuf:"bytes,8,opt,name=interest_factor,json=interestFactor,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"interest_factor"` } func (m *CDP) Reset() { *m = CDP{} } @@ -242,46 +243,47 @@ func init() { func init() { proto.RegisterFile("kava/cdp/v1beta1/cdp.proto", fileDescriptor_68a9ab097fb7be40) } var fileDescriptor_68a9ab097fb7be40 = []byte{ - // 613 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x54, 0xcf, 0x6e, 0xd3, 0x30, - 0x1c, 0xae, 0xbb, 0x36, 0x5b, 0xbd, 0xb1, 0x4e, 0x06, 0xa1, 0xac, 0x87, 0xa4, 0x1a, 0x02, 0x7a, - 0x69, 0xa2, 0x01, 0x12, 0x17, 0x10, 0x5a, 0x1a, 0x0d, 0xca, 0x85, 0x29, 0x1a, 0x17, 0x0e, 0x54, - 0xae, 0xed, 0x96, 0x68, 0x69, 0x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x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x95, 0xe3, 0x65, - 0xc4, 0xeb, 0x04, 0x00, 0x00, + // 627 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x54, 0x4d, 0x6f, 0xd3, 0x30, + 0x18, 0xae, 0xbb, 0x36, 0x5b, 0xbd, 0xb1, 0x4e, 0x06, 0xa1, 0xac, 0x48, 0x49, 0x35, 0x84, 0xe8, + 0xa5, 0x89, 0x06, 0x48, 0x9c, 0x10, 0x5a, 0x1a, 0x0d, 0x8a, 0x90, 0x98, 0xa2, 0x71, 0xd9, 0x81, + 0xca, 0xb5, 0xdd, 0x2e, 0x5a, 0x12, 0x47, 0xb1, 0x3b, 0xb6, 0x2b, 0xbf, 0x60, 0x3f, 0x66, 0x3f, + 0x62, 0x07, 0x0e, 0xd3, 0x4e, 0x88, 0x43, 0x81, 0xec, 0x5f, 0x70, 0x42, 0x76, 0xd2, 0x65, 0xc7, + 0x21, 0xc1, 0xa9, 0xef, 0x87, 0x9f, 0xe7, 0x7d, 0xf5, 0x3e, 0x4f, 0x03, 0x3b, 0x47, 0xf8, 0x18, + 0xbb, 0x84, 0xa6, 0xee, 0xf1, 0xf6, 0x98, 0x49, 0xbc, 0xad, 0x62, 0x27, 0xcd, 0xb8, 0xe4, 0x68, + 0x43, 0xf5, 0x1c, 0x95, 0x97, 0xbd, 0x8e, 0x45, 0xb8, 0x88, 0xb9, 0x70, 0xc7, 0x58, 0xb0, 0x0a, + 0xc0, 0xc3, 0xa4, 0x40, 0x74, 0x36, 0x8b, 0xfe, 0x48, 0x67, 0x6e, 0x91, 0x94, 0xad, 0x07, 0x53, + 0x3e, 0xe5, 0x45, 0x5d, 0x45, 0x65, 0xd5, 0x9e, 0x72, 0x3e, 0x8d, 0x98, 0xab, 0xb3, 0xf1, 0x6c, + 0xe2, 0xca, 0x30, 0x66, 0x42, 0xe2, 0xb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a, 0x02, 0xde, 0xfb, 0xa0, 0xfe, 0x45, 0x03, 0x7f, 0x6f, 0x98, 0x50, 0x76, 0x82, 0x1e, + 0xc3, 0xe5, 0x42, 0x3c, 0x61, 0x82, 0xee, 0x52, 0xaf, 0xe1, 0xc1, 0x7c, 0x6e, 0x1b, 0x5a, 0x3d, + 0x11, 0x18, 0x5a, 0x3e, 0xe1, 0x0d, 0x2e, 0x7e, 0x59, 0xb5, 0x8b, 0xdc, 0x02, 0x97, 0xb9, 0x05, + 0x7e, 0xe6, 0x16, 0x38, 0xbb, 0xb6, 0x6a, 0x97, 0xd7, 0x56, 0xed, 0xdb, 0xb5, 0x55, 0x3b, 0x78, + 0x72, 0x4b, 0x46, 0xf5, 0x7d, 0xea, 0x47, 0x78, 0x2c, 0x74, 0xe4, 0x9e, 0xe8, 0xef, 0x98, 0x56, + 0x72, 0x6c, 0x68, 0xe7, 0x3e, 0xff, 0x13, 0x00, 0x00, 0xff, 0xff, 0x30, 0xcc, 0xbf, 0x01, 0xe0, + 0x04, 0x00, 0x00, } func (m *CDP) Marshal() (dAtA []byte, err error) { diff --git a/x/cdp/types/cdp_test.go b/x/cdp/types/cdp_test.go index 424899b6f7..9bcfde0720 100644 --- a/x/cdp/types/cdp_test.go +++ b/x/cdp/types/cdp_test.go @@ -42,7 +42,7 @@ func (suite *CdpValidationSuite) TestCdpValidation() { }{ { name: "valid cdp", - cdp: types.NewCDP(1, suite.addrs[0], sdk.NewInt64Coin("bnb", 100000), "bnb-a", sdk.NewInt64Coin("usdx", 100000), tmtime.Now(), sdk.OneDec()), + cdp: types.NewCDP(1, suite.addrs[0], sdk.NewInt64Coin("bnb", 100000), "bnb-a", sdk.NewInt64Coin("usdx", 100000), tmtime.Now(), sdkmath.LegacyOneDec()), errArgs: errArgs{ expectPass: true, msg: "", @@ -50,7 +50,7 @@ func (suite *CdpValidationSuite) TestCdpValidation() { }, { name: "invalid cdp id", - cdp: types.NewCDP(0, suite.addrs[0], sdk.NewInt64Coin("bnb", 100000), "bnb-a", sdk.NewInt64Coin("usdx", 100000), tmtime.Now(), sdk.OneDec()), + cdp: types.NewCDP(0, suite.addrs[0], sdk.NewInt64Coin("bnb", 100000), "bnb-a", sdk.NewInt64Coin("usdx", 100000), tmtime.Now(), sdkmath.LegacyOneDec()), errArgs: errArgs{ expectPass: false, msg: "cdp id cannot be 0", @@ -58,7 +58,7 @@ func (suite *CdpValidationSuite) TestCdpValidation() { }, { name: "invalid collateral", - cdp: types.CDP{1, suite.addrs[0], "bnb-a", sdk.Coin{"", sdkmath.NewInt(100)}, sdk.Coin{"usdx", sdkmath.NewInt(100)}, sdk.Coin{"usdx", sdkmath.NewInt(0)}, tmtime.Now(), sdk.OneDec()}, + cdp: types.CDP{1, suite.addrs[0], "bnb-a", sdk.Coin{"", sdkmath.NewInt(100)}, sdk.Coin{"usdx", sdkmath.NewInt(100)}, sdk.Coin{"usdx", sdkmath.NewInt(0)}, tmtime.Now(), sdkmath.LegacyOneDec()}, errArgs: errArgs{ expectPass: false, msg: "collateral 100: invalid coins", @@ -66,7 +66,7 @@ func (suite *CdpValidationSuite) TestCdpValidation() { }, { name: "invalid principal", - cdp: types.CDP{1, suite.addrs[0], "xrp-a", sdk.Coin{"xrp", sdkmath.NewInt(100)}, sdk.Coin{"", sdkmath.NewInt(100)}, sdk.Coin{"usdx", sdkmath.NewInt(0)}, tmtime.Now(), sdk.OneDec()}, + cdp: types.CDP{1, suite.addrs[0], "xrp-a", sdk.Coin{"xrp", sdkmath.NewInt(100)}, sdk.Coin{"", sdkmath.NewInt(100)}, sdk.Coin{"usdx", sdkmath.NewInt(0)}, tmtime.Now(), sdkmath.LegacyOneDec()}, errArgs: errArgs{ expectPass: false, msg: "principal 100: invalid coins", @@ -74,7 +74,7 @@ func (suite *CdpValidationSuite) TestCdpValidation() { }, { name: "invalid fees", - cdp: types.CDP{1, suite.addrs[0], "xrp-a", sdk.Coin{"xrp", sdkmath.NewInt(100)}, sdk.Coin{"usdx", sdkmath.NewInt(100)}, sdk.Coin{"", sdkmath.NewInt(0)}, tmtime.Now(), sdk.OneDec()}, + cdp: types.CDP{1, suite.addrs[0], "xrp-a", sdk.Coin{"xrp", sdkmath.NewInt(100)}, sdk.Coin{"usdx", sdkmath.NewInt(100)}, sdk.Coin{"", sdkmath.NewInt(0)}, tmtime.Now(), sdkmath.LegacyOneDec()}, errArgs: errArgs{ expectPass: false, msg: "accumulated fees 0: invalid coins", @@ -82,7 +82,7 @@ func (suite *CdpValidationSuite) TestCdpValidation() { }, { name: "invalid fees updated", - cdp: types.CDP{1, suite.addrs[0], "xrp-a", sdk.Coin{"xrp", sdkmath.NewInt(100)}, sdk.Coin{"usdx", sdkmath.NewInt(100)}, sdk.Coin{"usdx", sdkmath.NewInt(0)}, time.Time{}, sdk.OneDec()}, + cdp: types.CDP{1, suite.addrs[0], "xrp-a", sdk.Coin{"xrp", sdkmath.NewInt(100)}, sdk.Coin{"usdx", sdkmath.NewInt(100)}, sdk.Coin{"usdx", sdkmath.NewInt(0)}, time.Time{}, sdkmath.LegacyOneDec()}, errArgs: errArgs{ expectPass: false, msg: "cdp updated fee time cannot be zero", @@ -90,7 +90,7 @@ func (suite *CdpValidationSuite) TestCdpValidation() { }, { name: "invalid type", - cdp: types.CDP{1, suite.addrs[0], "", sdk.Coin{"xrp", sdkmath.NewInt(100)}, sdk.Coin{"usdx", sdkmath.NewInt(100)}, sdk.Coin{"usdx", sdkmath.NewInt(0)}, tmtime.Now(), sdk.OneDec()}, + cdp: types.CDP{1, suite.addrs[0], "", sdk.Coin{"xrp", sdkmath.NewInt(100)}, sdk.Coin{"usdx", sdkmath.NewInt(100)}, sdk.Coin{"usdx", sdkmath.NewInt(0)}, tmtime.Now(), sdkmath.LegacyOneDec()}, errArgs: errArgs{ expectPass: false, msg: "cdp type cannot be empty", @@ -184,7 +184,7 @@ func (suite *CdpValidationSuite) TestCDPGetNormalizedPrincipal() { testCases := []struct { name string cdp types.CDP - expected sdk.Dec + expected sdkmath.LegacyDec expectedErr expectedErr }{ { @@ -192,9 +192,9 @@ func (suite *CdpValidationSuite) TestCDPGetNormalizedPrincipal() { cdp: types.CDP{ Principal: sdk.NewInt64Coin("usdx", 1e9), AccumulatedFees: sdk.NewInt64Coin("usdx", 1e6), - InterestFactor: sdk.MustNewDecFromStr("2"), + InterestFactor: sdkmath.LegacyMustNewDecFromStr("2"), }, - expected: sdk.MustNewDecFromStr("500500000"), + expected: sdkmath.LegacyMustNewDecFromStr("500500000"), expectedErr: expectedErr{ expectPass: true, }, @@ -204,7 +204,7 @@ func (suite *CdpValidationSuite) TestCDPGetNormalizedPrincipal() { cdp: types.CDP{ Principal: sdk.NewInt64Coin("usdx", 1e9), AccumulatedFees: sdk.NewInt64Coin("usdx", 1e6), - InterestFactor: sdk.MustNewDecFromStr("0.999999999999999999"), + InterestFactor: sdkmath.LegacyMustNewDecFromStr("0.999999999999999999"), }, expectedErr: expectedErr{ contains: "must be ≥ 1", @@ -215,7 +215,7 @@ func (suite *CdpValidationSuite) TestCDPGetNormalizedPrincipal() { cdp: types.CDP{ Principal: sdk.NewInt64Coin("usdx", 1e9), AccumulatedFees: sdk.NewInt64Coin("usdx", 1e6), - InterestFactor: sdk.MustNewDecFromStr("0"), + InterestFactor: sdkmath.LegacyMustNewDecFromStr("0"), }, expectedErr: expectedErr{ contains: "must be ≥ 1", diff --git a/x/cdp/types/codec.go b/x/cdp/types/codec.go index 08066e6393..37c1c6a319 100644 --- a/x/cdp/types/codec.go +++ b/x/cdp/types/codec.go @@ -6,7 +6,6 @@ import ( cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/msgservice" - authzcodec "github.com/cosmos/cosmos-sdk/x/authz/codec" ) // RegisterLegacyAminoCodec registers all the necessary types and interfaces for the @@ -44,5 +43,5 @@ func init() { // Register all Amino interfaces and concrete types on the authz Amino codec so that this can later be // used to properly serialize MsgGrant and MsgExec instances - RegisterLegacyAminoCodec(authzcodec.Amino) + RegisterLegacyAminoCodec(codec.NewLegacyAmino()) } diff --git a/x/cdp/types/deposit.go b/x/cdp/types/deposit.go index 5104ffcc89..12bb6dcdc7 100644 --- a/x/cdp/types/deposit.go +++ b/x/cdp/types/deposit.go @@ -53,7 +53,7 @@ func (d Deposit) Empty() bool { // SumCollateral returns the total amount of collateral in the input deposits func (ds Deposits) SumCollateral() (sum sdkmath.Int) { - sum = sdk.ZeroInt() + sum = sdkmath.ZeroInt() for _, d := range ds { if !d.Amount.IsZero() { sum = sum.Add(d.Amount.Amount) diff --git a/x/cdp/types/expected_keepers.go b/x/cdp/types/expected_keepers.go index d956ee3e04..24688c3095 100644 --- a/x/cdp/types/expected_keepers.go +++ b/x/cdp/types/expected_keepers.go @@ -1,28 +1,27 @@ package types import ( + "context" "time" sdkmath "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" pftypes "github.com/kava-labs/kava/x/pricefeed/types" ) // BankKeeper defines the expected bank keeper for module accounts type BankKeeper interface { - SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error - SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error - SendCoinsFromModuleToModule(ctx sdk.Context, senderModule, recipientModule string, amt sdk.Coins) error - MintCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error - BurnCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error - - GetSupply(ctx sdk.Context, denom string) sdk.Coin - GetBalance(ctx sdk.Context, addr sdk.AccAddress, denom string) sdk.Coin - GetAllBalances(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins - SpendableCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins + SendCoinsFromModuleToAccount(ctx context.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error + SendCoinsFromAccountToModule(ctx context.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error + SendCoinsFromModuleToModule(ctx context.Context, senderModule, recipientModule string, amt sdk.Coins) error + MintCoins(ctx context.Context, moduleName string, amt sdk.Coins) error + BurnCoins(ctx context.Context, moduleName string, amt sdk.Coins) error + + GetSupply(ctx context.Context, denom string) sdk.Coin + GetBalance(ctx context.Context, addr sdk.AccAddress, denom string) sdk.Coin + GetAllBalances(ctx context.Context, addr sdk.AccAddress) sdk.Coins + SpendableCoins(ctx context.Context, addr sdk.AccAddress) sdk.Coins } var _ BankKeeper = (bankkeeper.Keeper)(nil) @@ -33,7 +32,7 @@ type PricefeedKeeper interface { GetParams(sdk.Context) pftypes.Params // These are used for testing TODO replace mockApp with keeper in tests to remove these SetParams(sdk.Context, pftypes.Params) - SetPrice(sdk.Context, sdk.AccAddress, string, sdk.Dec, time.Time) (pftypes.PostedPrice, error) + SetPrice(sdk.Context, sdk.AccAddress, string, sdkmath.LegacyDec, time.Time) (pftypes.PostedPrice, error) SetCurrentPrices(sdk.Context, string) error } @@ -47,12 +46,12 @@ type AuctionKeeper interface { // AccountKeeper expected interface for the account keeper type AccountKeeper interface { GetModuleAddress(name string) sdk.AccAddress - GetModuleAccount(ctx sdk.Context, name string) authtypes.ModuleAccountI + GetModuleAccount(ctx context.Context, name string) sdk.ModuleAccountI // TODO remove with genesis 2-phases refactor https://github.com/cosmos/cosmos-sdk/issues/2862 - SetModuleAccount(sdk.Context, authtypes.ModuleAccountI) + SetModuleAccount(context.Context, sdk.ModuleAccountI) - IterateAccounts(ctx sdk.Context, cb func(account authtypes.AccountI) (stop bool)) - GetAccount(ctx sdk.Context, addr sdk.AccAddress) authtypes.AccountI + IterateAccounts(ctx context.Context, cb func(account sdk.AccountI) (stop bool)) + GetAccount(ctx context.Context, addr sdk.AccAddress) sdk.AccountI } // CDPHooks event hooks for other keepers to run code in response to CDP modifications diff --git a/x/cdp/types/genesis.go b/x/cdp/types/genesis.go index cf51b7a2ef..7cd614cf0e 100644 --- a/x/cdp/types/genesis.go +++ b/x/cdp/types/genesis.go @@ -108,7 +108,7 @@ func (gtps GenesisTotalPrincipals) Validate() error { } // NewGenesisAccumulationTime returns a new GenesisAccumulationTime -func NewGenesisAccumulationTime(ctype string, prevTime time.Time, factor sdk.Dec) GenesisAccumulationTime { +func NewGenesisAccumulationTime(ctype string, prevTime time.Time, factor sdkmath.LegacyDec) GenesisAccumulationTime { return GenesisAccumulationTime{ CollateralType: ctype, PreviousAccumulationTime: prevTime, @@ -118,7 +118,7 @@ func NewGenesisAccumulationTime(ctype string, prevTime time.Time, factor sdk.Dec // Validate performs validation of GenesisAccumulationTime func (gat GenesisAccumulationTime) Validate() error { - if gat.InterestFactor.LT(sdk.OneDec()) { + if gat.InterestFactor.LT(sdkmath.LegacyOneDec()) { return fmt.Errorf("interest factor should be ≥ 1.0, is %s for %s", gat.InterestFactor, gat.CollateralType) } return nil diff --git a/x/cdp/types/genesis.pb.go b/x/cdp/types/genesis.pb.go index 49ba9a756b..e7f775ef40 100644 --- a/x/cdp/types/genesis.pb.go +++ b/x/cdp/types/genesis.pb.go @@ -4,9 +4,9 @@ package types import ( + cosmossdk_io_math "cosmossdk.io/math" fmt "fmt" _ "github.com/cosmos/cosmos-proto" - github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" @@ -134,15 +134,15 @@ func (m *GenesisState) GetTotalPrincipals() GenesisTotalPrincipals { // Params defines the parameters for the cdp module. type Params struct { - CollateralParams CollateralParams `protobuf:"bytes,1,rep,name=collateral_params,json=collateralParams,proto3,castrepeated=CollateralParams" json:"collateral_params"` - DebtParam DebtParam `protobuf:"bytes,2,opt,name=debt_param,json=debtParam,proto3" json:"debt_param"` - GlobalDebtLimit types.Coin `protobuf:"bytes,3,opt,name=global_debt_limit,json=globalDebtLimit,proto3" json:"global_debt_limit"` - SurplusAuctionThreshold github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,4,opt,name=surplus_auction_threshold,json=surplusAuctionThreshold,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"surplus_auction_threshold"` - SurplusAuctionLot github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,5,opt,name=surplus_auction_lot,json=surplusAuctionLot,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"surplus_auction_lot"` - DebtAuctionThreshold github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,6,opt,name=debt_auction_threshold,json=debtAuctionThreshold,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"debt_auction_threshold"` - DebtAuctionLot github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,7,opt,name=debt_auction_lot,json=debtAuctionLot,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"debt_auction_lot"` - CircuitBreaker bool `protobuf:"varint,8,opt,name=circuit_breaker,json=circuitBreaker,proto3" json:"circuit_breaker,omitempty"` - LiquidationBlockInterval int64 `protobuf:"varint,9,opt,name=liquidation_block_interval,json=liquidationBlockInterval,proto3" json:"liquidation_block_interval,omitempty"` + CollateralParams CollateralParams `protobuf:"bytes,1,rep,name=collateral_params,json=collateralParams,proto3,castrepeated=CollateralParams" json:"collateral_params"` + DebtParam DebtParam `protobuf:"bytes,2,opt,name=debt_param,json=debtParam,proto3" json:"debt_param"` + GlobalDebtLimit types.Coin `protobuf:"bytes,3,opt,name=global_debt_limit,json=globalDebtLimit,proto3" json:"global_debt_limit"` + SurplusAuctionThreshold cosmossdk_io_math.Int `protobuf:"bytes,4,opt,name=surplus_auction_threshold,json=surplusAuctionThreshold,proto3,customtype=cosmossdk.io/math.Int" json:"surplus_auction_threshold"` + SurplusAuctionLot cosmossdk_io_math.Int `protobuf:"bytes,5,opt,name=surplus_auction_lot,json=surplusAuctionLot,proto3,customtype=cosmossdk.io/math.Int" json:"surplus_auction_lot"` + DebtAuctionThreshold cosmossdk_io_math.Int `protobuf:"bytes,6,opt,name=debt_auction_threshold,json=debtAuctionThreshold,proto3,customtype=cosmossdk.io/math.Int" json:"debt_auction_threshold"` + DebtAuctionLot cosmossdk_io_math.Int `protobuf:"bytes,7,opt,name=debt_auction_lot,json=debtAuctionLot,proto3,customtype=cosmossdk.io/math.Int" json:"debt_auction_lot"` + CircuitBreaker bool `protobuf:"varint,8,opt,name=circuit_breaker,json=circuitBreaker,proto3" json:"circuit_breaker,omitempty"` + LiquidationBlockInterval int64 `protobuf:"varint,9,opt,name=liquidation_block_interval,json=liquidationBlockInterval,proto3" json:"liquidation_block_interval,omitempty"` } func (m *Params) Reset() { *m = Params{} } @@ -215,10 +215,10 @@ func (m *Params) GetLiquidationBlockInterval() int64 { // DebtParam defines governance params for debt assets type DebtParam struct { - Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` - ReferenceAsset string `protobuf:"bytes,2,opt,name=reference_asset,json=referenceAsset,proto3" json:"reference_asset,omitempty"` - ConversionFactor github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,3,opt,name=conversion_factor,json=conversionFactor,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"conversion_factor"` - DebtFloor github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,4,opt,name=debt_floor,json=debtFloor,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"debt_floor"` + Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` + ReferenceAsset string `protobuf:"bytes,2,opt,name=reference_asset,json=referenceAsset,proto3" json:"reference_asset,omitempty"` + ConversionFactor cosmossdk_io_math.Int `protobuf:"bytes,3,opt,name=conversion_factor,json=conversionFactor,proto3,customtype=cosmossdk.io/math.Int" json:"conversion_factor"` + DebtFloor cosmossdk_io_math.Int `protobuf:"bytes,4,opt,name=debt_floor,json=debtFloor,proto3,customtype=cosmossdk.io/math.Int" json:"debt_floor"` } func (m *DebtParam) Reset() { *m = DebtParam{} } @@ -270,18 +270,18 @@ func (m *DebtParam) GetReferenceAsset() string { // CollateralParam defines governance parameters for each collateral type within the cdp module type CollateralParam struct { - Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` - Type string `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"` - LiquidationRatio github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=liquidation_ratio,json=liquidationRatio,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"liquidation_ratio"` - DebtLimit types.Coin `protobuf:"bytes,4,opt,name=debt_limit,json=debtLimit,proto3" json:"debt_limit"` - StabilityFee github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,5,opt,name=stability_fee,json=stabilityFee,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"stability_fee"` - AuctionSize github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,6,opt,name=auction_size,json=auctionSize,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"auction_size"` - LiquidationPenalty github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,7,opt,name=liquidation_penalty,json=liquidationPenalty,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"liquidation_penalty"` - SpotMarketID string `protobuf:"bytes,8,opt,name=spot_market_id,json=spotMarketId,proto3" json:"spot_market_id,omitempty"` - LiquidationMarketID string `protobuf:"bytes,9,opt,name=liquidation_market_id,json=liquidationMarketId,proto3" json:"liquidation_market_id,omitempty"` - KeeperRewardPercentage github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,10,opt,name=keeper_reward_percentage,json=keeperRewardPercentage,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"keeper_reward_percentage"` - CheckCollateralizationIndexCount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,11,opt,name=check_collateralization_index_count,json=checkCollateralizationIndexCount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"check_collateralization_index_count"` - ConversionFactor github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,12,opt,name=conversion_factor,json=conversionFactor,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"conversion_factor"` + Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` + Type string `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"` + LiquidationRatio cosmossdk_io_math.LegacyDec `protobuf:"bytes,3,opt,name=liquidation_ratio,json=liquidationRatio,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"liquidation_ratio"` + DebtLimit types.Coin `protobuf:"bytes,4,opt,name=debt_limit,json=debtLimit,proto3" json:"debt_limit"` + StabilityFee cosmossdk_io_math.LegacyDec `protobuf:"bytes,5,opt,name=stability_fee,json=stabilityFee,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"stability_fee"` + AuctionSize cosmossdk_io_math.Int `protobuf:"bytes,6,opt,name=auction_size,json=auctionSize,proto3,customtype=cosmossdk.io/math.Int" json:"auction_size"` + LiquidationPenalty cosmossdk_io_math.LegacyDec `protobuf:"bytes,7,opt,name=liquidation_penalty,json=liquidationPenalty,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"liquidation_penalty"` + SpotMarketID string `protobuf:"bytes,8,opt,name=spot_market_id,json=spotMarketId,proto3" json:"spot_market_id,omitempty"` + LiquidationMarketID string `protobuf:"bytes,9,opt,name=liquidation_market_id,json=liquidationMarketId,proto3" json:"liquidation_market_id,omitempty"` + KeeperRewardPercentage cosmossdk_io_math.LegacyDec `protobuf:"bytes,10,opt,name=keeper_reward_percentage,json=keeperRewardPercentage,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"keeper_reward_percentage"` + CheckCollateralizationIndexCount cosmossdk_io_math.Int `protobuf:"bytes,11,opt,name=check_collateralization_index_count,json=checkCollateralizationIndexCount,proto3,customtype=cosmossdk.io/math.Int" json:"check_collateralization_index_count"` + ConversionFactor cosmossdk_io_math.Int `protobuf:"bytes,12,opt,name=conversion_factor,json=conversionFactor,proto3,customtype=cosmossdk.io/math.Int" json:"conversion_factor"` } func (m *CollateralParam) Reset() { *m = CollateralParam{} } @@ -354,9 +354,9 @@ func (m *CollateralParam) GetLiquidationMarketID() string { // GenesisAccumulationTime defines the previous distribution time and its corresponding denom type GenesisAccumulationTime struct { - CollateralType string `protobuf:"bytes,1,opt,name=collateral_type,json=collateralType,proto3" json:"collateral_type,omitempty"` - PreviousAccumulationTime time.Time `protobuf:"bytes,2,opt,name=previous_accumulation_time,json=previousAccumulationTime,proto3,stdtime" json:"previous_accumulation_time"` - InterestFactor github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=interest_factor,json=interestFactor,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"interest_factor"` + CollateralType string `protobuf:"bytes,1,opt,name=collateral_type,json=collateralType,proto3" json:"collateral_type,omitempty"` + PreviousAccumulationTime time.Time `protobuf:"bytes,2,opt,name=previous_accumulation_time,json=previousAccumulationTime,proto3,stdtime" json:"previous_accumulation_time"` + InterestFactor cosmossdk_io_math.LegacyDec `protobuf:"bytes,3,opt,name=interest_factor,json=interestFactor,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"interest_factor"` } func (m *GenesisAccumulationTime) Reset() { *m = GenesisAccumulationTime{} } @@ -408,8 +408,8 @@ func (m *GenesisAccumulationTime) GetPreviousAccumulationTime() time.Time { // GenesisTotalPrincipal defines the total principal and its corresponding collateral type type GenesisTotalPrincipal struct { - CollateralType string `protobuf:"bytes,1,opt,name=collateral_type,json=collateralType,proto3" json:"collateral_type,omitempty"` - TotalPrincipal github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,2,opt,name=total_principal,json=totalPrincipal,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"total_principal"` + CollateralType string `protobuf:"bytes,1,opt,name=collateral_type,json=collateralType,proto3" json:"collateral_type,omitempty"` + TotalPrincipal cosmossdk_io_math.Int `protobuf:"bytes,2,opt,name=total_principal,json=totalPrincipal,proto3,customtype=cosmossdk.io/math.Int" json:"total_principal"` } func (m *GenesisTotalPrincipal) Reset() { *m = GenesisTotalPrincipal{} } @@ -464,83 +464,84 @@ func init() { func init() { proto.RegisterFile("kava/cdp/v1beta1/genesis.proto", fileDescriptor_e4494a90aaab0034) } var fileDescriptor_e4494a90aaab0034 = []byte{ - // 1208 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x57, 0xdd, 0x6e, 0x1a, 0xc7, - 0x17, 0xf7, 0xda, 0xc4, 0x81, 0xb1, 0x63, 0xf0, 0xc4, 0x49, 0xd6, 0x8e, 0xfe, 0xc0, 0xdf, 0x55, - 0x1b, 0x7a, 0x11, 0x50, 0x52, 0x29, 0x52, 0xa5, 0xa8, 0x69, 0xd6, 0x28, 0x11, 0x4a, 0x2a, 0xa1, - 0xb5, 0xaf, 0xda, 0x8b, 0xd5, 0xec, 0xec, 0x80, 0x47, 0x2c, 0x3b, 0xdb, 0x99, 0x81, 0x26, 0x79, - 0x85, 0xaa, 0x6a, 0xd4, 0x97, 0xa8, 0x14, 0xf5, 0xb2, 0x0f, 0x91, 0xde, 0x45, 0xbd, 0xaa, 0x7a, - 0x41, 0x2a, 0xf2, 0x22, 0xd5, 0x7c, 0x00, 0x6b, 0x30, 0x52, 0x64, 0xd3, 0x1b, 0x76, 0xe7, 0x7c, - 0xfc, 0xce, 0xc7, 0x9c, 0x73, 0xf6, 0x00, 0xca, 0x3d, 0x34, 0x44, 0x0d, 0x1c, 0xa5, 0x8d, 0xe1, - 0xbd, 0x90, 0x48, 0x74, 0xaf, 0xd1, 0x25, 0x09, 0x11, 0x54, 0xd4, 0x53, 0xce, 0x24, 0x83, 0x25, - 0xc5, 0xaf, 0xe3, 0x28, 0xad, 0x5b, 0xfe, 0x41, 0x19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f0, 0xa7, 0x75, 0x70, 0x6b, 0xc9, - 0x06, 0xa4, 0x27, 0xf5, 0x6c, 0xcd, 0xd0, 0xe3, 0xc0, 0xcc, 0x88, 0x9d, 0x19, 0xf9, 0x44, 0x0d, - 0x86, 0x10, 0x1c, 0x2c, 0xdf, 0xcd, 0xec, 0xd6, 0x70, 0x50, 0x37, 0x8b, 0x74, 0x7d, 0xb2, 0x48, - 0xd7, 0x4f, 0x26, 0x8b, 0xb4, 0x97, 0x57, 0x41, 0xbd, 0x7e, 0x5f, 0x71, 0x7c, 0x77, 0xd9, 0xce, - 0x05, 0x09, 0x28, 0xea, 0xd9, 0x4f, 0x84, 0xbc, 0xf8, 0x00, 0x5e, 0x2c, 0x88, 0x9d, 0x09, 0xa8, - 0xcd, 0xc7, 0xaf, 0x0e, 0xb8, 0x71, 0xee, 0x46, 0xf6, 0xf1, 0xd9, 0x20, 0xa0, 0x38, 0xb7, 0x1c, - 0x9a, 0x29, 0x7a, 0xd9, 0xef, 0xe8, 0xd9, 0x85, 0xd0, 0x7b, 0xf4, 0x76, 0x5c, 0x76, 0xde, 0x8d, - 0xcb, 0xce, 0x3f, 0xe3, 0xb2, 0xf3, 0xfa, 0x43, 0x79, 0xed, 0xdd, 0x87, 0xf2, 0xda, 0x5f, 0x1f, - 0xca, 0x6b, 0xdf, 0x7e, 0x9a, 0xc1, 0x57, 0xab, 0xda, 0xdd, 0x18, 0x85, 0x42, 0xbf, 0x35, 0x5e, - 0xe8, 0x3f, 0x2a, 0xda, 0x44, 0xb8, 0xa9, 0x6f, 0xe2, 0x8b, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, - 0x5c, 0xdf, 0x27, 0x18, 0x65, 0x0d, 0x00, 0x00, + // 1221 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0xcf, 0x6f, 0x1b, 0xc5, + 0x17, 0xcf, 0x36, 0x6e, 0x6a, 0x4f, 0xd2, 0xd8, 0x99, 0x26, 0xed, 0x26, 0xd1, 0xd7, 0xf6, 0x37, + 0x08, 0x35, 0x08, 0x75, 0xad, 0x16, 0xa9, 0x12, 0x12, 0xa2, 0x74, 0x63, 0xb5, 0x0a, 0x0d, 0x28, + 0xda, 0x04, 0x84, 0x8a, 0xc4, 0x6a, 0x76, 0x76, 0xb2, 0x19, 0x79, 0xbd, 0xb3, 0xcc, 0x8c, 0x4d, + 0x93, 0x23, 0x57, 0x2e, 0x3d, 0xf1, 0x47, 0xf4, 0xc2, 0x85, 0x3f, 0xa2, 0xdc, 0x2a, 0x4e, 0x88, + 0x43, 0x8a, 0x9c, 0x0b, 0x47, 0xfe, 0x04, 0x34, 0x3f, 0x6c, 0x6f, 0xec, 0x44, 0x6a, 0x22, 0x2e, + 0xf6, 0xce, 0xfb, 0xf1, 0x79, 0x9f, 0x37, 0xf3, 0xde, 0xcc, 0x03, 0xf5, 0x0e, 0xea, 0xa3, 0x16, + 0x8e, 0xf3, 0x56, 0xff, 0x7e, 0x44, 0x24, 0xba, 0xdf, 0x4a, 0x48, 0x46, 0x04, 0x15, 0x5e, 0xce, + 0x99, 0x64, 0xb0, 0xa6, 0xf4, 0x1e, 0x8e, 0x73, 0xcf, 0xea, 0xd7, 0xea, 0x98, 0x89, 0x2e, 0x13, + 0xad, 0x08, 0x09, 0x32, 0x72, 0xc2, 0x8c, 0x66, 0xc6, 0x63, 0x6d, 0xd5, 0xe8, 0x43, 0xbd, 0x6a, + 0x99, 0x85, 0x55, 0x2d, 0x27, 0x2c, 0x61, 0x46, 0xae, 0xbe, 0xac, 0xb4, 0x91, 0x30, 0x96, 0xa4, + 0xa4, 0xa5, 0x57, 0x51, 0xef, 0xa0, 0x25, 0x69, 0x97, 0x08, 0x89, 0xba, 0xb9, 0x35, 0x58, 0x9b, + 0xe2, 0xa8, 0xf8, 0x68, 0xdd, 0xc6, 0x6f, 0x25, 0xb0, 0xf0, 0xd4, 0x30, 0xde,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22, 0x49, 0x59, 0x16, 0xea, 0xf3, 0x70, 0x6f, 0xe8, 0x9c, 0x3e, 0x98, + 0xce, 0xc9, 0x6e, 0xff, 0xe3, 0x82, 0xcb, 0x3e, 0xed, 0x12, 0xbf, 0x69, 0x73, 0x74, 0x2f, 0x30, + 0x10, 0xc1, 0xea, 0x30, 0xde, 0x94, 0x0a, 0x72, 0x50, 0x93, 0x4c, 0xa2, 0x34, 0xcc, 0x39, 0xcd, + 0x30, 0xcd, 0x51, 0x2a, 0xdc, 0xb2, 0x66, 0x70, 0xf7, 0x42, 0x06, 0xfb, 0xca, 0x61, 0x77, 0x68, + 0xef, 0xd7, 0x6d, 0xfc, 0xdb, 0xe7, 0xaa, 0x45, 0x50, 0x95, 0x67, 0x05, 0x1b, 0x7f, 0x5f, 0x07, + 0x73, 0xa6, 0x36, 0xe0, 0x21, 0x58, 0xc2, 0x2c, 0x4d, 0x91, 0x24, 0x5c, 0x71, 0x18, 0x16, 0x94, + 0x8a, 0xff, 0xff, 0x73, 0x4a, 0x63, 0x64, 0xaa, 0xdd, 0x7d, 0xd7, 0x46, 0xae, 0x4d, 0x28, 0x44, + 0x50, 0xc3, 0x13, 0x12, 0xf8, 0x99, 0x3d, 0x32, 0x1d, 0xc3, 0xbd, 0xa6, 0x6b, 0x76, 0xfd, 0xbc, + 0xc2, 0x89, 0xa4, 0x01, 0x37, 0x65, 0xab, 0x4f, 0x55, 0x0b, 0xe0, 0x33, 0xb0, 0x94, 0xa4, 0x2c, + 0x42, 0x69, 0xa8, 0x81, 0x52, 0xda, 0xa5, 0xd2, 0x9d, 0xd5, 0x40, 0xab, 0x9e, 0xed, 0x3f, 0xd5, + 0xac, 0x05, 0xba, 0x34, 0xb3, 0x30, 0x55, 0xe3, 0xa9, 0xd0, 0x77, 0x94, 0x1f, 0x4c, 0xc0, 0xaa, + 0xe8, 0xf1, 0x3c, 0x55, 0x35, 0xd0, 0xc3, 0xe6, 0xf8, 0x0f, 0x39, 0x11, 0x87, 0x2c, 0x35, 0x65, + 0x58, 0xf1, 0x3f, 0x54, 0x9e, 0x7f, 0x9e, 0x34, 0x56, 0x0c, 0xb6, 0x88, 0x3b, 0x1e, 0x65, 0xad, + 0x2e, 0x92, 0x87, 0xde, 0x76, 0x26, 0x7f, 0xff, 0xf5, 0x1e, 0xb0, 0x41, 0xb7, 0x33, 0x19, 0xdc, + 0xb1, 0x68, 0x8f, 0x0d, 0xd8, 0xfe, 0x10, 0x0b, 0x7e, 0x0b, 0x6e, 0x4d, 0x06, 0x4a, 0x99, 0x34, + 0x35, 0x7b, 0xb9, 0x10, 0x4b, 0x67, 0x43, 0xec, 0x30, 0x09, 0x11, 0xb8, 0xad, 0xf7, 0x62, 0x3a, + 0x85, 0xb9, 0xcb, 0xe3, 0x2f, 0x2b, 0xa8, 0x29, 0xfe, 0x5f, 0x81, 0xda, 0x99, 0x10, 0x8a, 0xfc, + 0x8d, 0xcb, 0x83, 0x2f, 0x16, 0xc0, 0x15, 0xf3, 0xbb, 0xa0, 0x8a, 0x29, 0xc7, 0x3d, 0x2a, 0xc3, + 0x88, 0x13, 0xd4, 0x21, 0xdc, 0x2d, 0x37, 0x9d, 0xcd, 0x72, 0xb0, 0x68, 0xc5, 0xbe, 0x91, 0xc2, + 0x4f, 0xc0, 0x5a, 0x4a, 0xbf, 0xef, 0xd1, 0xd8, 0xf4, 0x68, 0x94, 0x32, 0xdc, 0x09, 0x69, 0x26, + 0x09, 0xef, 0xa3, 0xd4, 0xad, 0x34, 0x9d, 0xcd, 0xd9, 0xc0, 0x2d, 0x58, 0xf8, 0xca, 0x60, 0xdb, + 0xea, 0x37, 0xfe, 0x71, 0x40, 0x65, 0x54, 0x52, 0x70, 0x19, 0x5c, 0x37, 0x77, 0x82, 0xa3, 0xef, + 0x04, 0xb3, 0x50, 0x54, 0x38, 0x39, 0x20, 0x9c, 0x64, 0x98, 0x84, 0x48, 0x08, 0x22, 0x75, 0x79, + 0x56, 0x82, 0xc5, 0x91, 0xf8, 0xb1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0x70, 0xc4, 0x8b, 0x43, 0x24, 0xbb, 0x09, 0x3f, 0x3b, 0x60, 0xe5, 0xdc, 0x01, 0xe6, 0xdd, + 0xb7, 0x60, 0x1f, 0x54, 0x27, 0x66, 0x29, 0x73, 0xb5, 0x5d, 0xf2, 0xa5, 0x3a, 0x3b, 0x2e, 0xf9, + 0x8f, 0x5e, 0x0f, 0xea, 0xce, 0x9b, 0x41, 0xdd, 0xf9, 0x6b, 0x50, 0x77, 0x5e, 0x9e, 0xd6, 0x67, + 0xde, 0x9c, 0xd6, 0x67, 0xfe, 0x38, 0xad, 0xcf, 0x3c, 0x7f, 0x3f, 0xa1, 0xf2, 0xb0, 0x17, 0x79, + 0x98, 0x75, 0x5b, 0x6a, 0x90, 0xb9, 0x97, 0xa2, 0x48, 0xe8, 0xaf, 0xd6, 0x0b, 0x3d, 0xc6, 0x2b, + 0xae, 0x22, 0x9a, 0xd3, 0xbb, 0xfd, 0xd1, 0xbf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x06, 0x5a, 0xbc, + 0x22, 0x83, 0x0c, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { diff --git a/x/cdp/types/keys.go b/x/cdp/types/keys.go index 67921b6afa..93d517d94a 100644 --- a/x/cdp/types/keys.go +++ b/x/cdp/types/keys.go @@ -2,6 +2,7 @@ package types import ( "bytes" + sdkmath "cosmossdk.io/math" "encoding/binary" sdk "github.com/cosmos/cosmos-sdk/types" @@ -115,17 +116,17 @@ func SplitDepositIterKey(key []byte) (cdpID uint64) { } // CollateralRatioBytes returns the liquidation ratio as sortable bytes -func CollateralRatioBytes(ratio sdk.Dec) []byte { +func CollateralRatioBytes(ratio sdkmath.LegacyDec) []byte { ok := ValidSortableDec(ratio) if !ok { // set to max sortable if input is too large. - ratio = sdk.OneDec().Quo(sdk.SmallestDec()) + ratio = sdkmath.LegacyOneDec().Quo(sdkmath.LegacySmallestDec()) } return SortableDecBytes(ratio) } // CollateralRatioKey returns the key for querying a cdp by its liquidation ratio -func CollateralRatioKey(collateralType string, cdpID uint64, ratio sdk.Dec) []byte { +func CollateralRatioKey(collateralType string, cdpID uint64, ratio sdkmath.LegacyDec) []byte { ratioBytes := CollateralRatioBytes(ratio) idBytes := GetCdpIDBytes(cdpID) @@ -133,7 +134,7 @@ func CollateralRatioKey(collateralType string, cdpID uint64, ratio sdk.Dec) []by } // SplitCollateralRatioKey split the collateral ratio key and return the denom, cdp id, and collateral:debt ratio -func SplitCollateralRatioKey(key []byte) (string, uint64, sdk.Dec) { +func SplitCollateralRatioKey(key []byte) (string, uint64, sdkmath.LegacyDec) { cdpID := GetCdpIDFromBytes(key[len(key)-8:]) split := bytes.Split(key[:len(key)-8], sep) collateralType := string(split[0]) @@ -146,13 +147,13 @@ func SplitCollateralRatioKey(key []byte) (string, uint64, sdk.Dec) { } // CollateralRatioIterKey returns the key for iterating over cdps by denom and liquidation ratio -func CollateralRatioIterKey(collateralType string, ratio sdk.Dec) []byte { +func CollateralRatioIterKey(collateralType string, ratio sdkmath.LegacyDec) []byte { ratioBytes := CollateralRatioBytes(ratio) return createKey([]byte(collateralType), sep, ratioBytes) } // SplitCollateralRatioIterKey split the collateral ratio key and return the denom, cdp id, and collateral:debt ratio -func SplitCollateralRatioIterKey(key []byte) (string, sdk.Dec) { +func SplitCollateralRatioIterKey(key []byte) (string, sdkmath.LegacyDec) { split := bytes.Split(key, sep) collateralType := string(split[0]) diff --git a/x/cdp/types/keys_test.go b/x/cdp/types/keys_test.go index adb3b8397b..b0a7a83952 100644 --- a/x/cdp/types/keys_test.go +++ b/x/cdp/types/keys_test.go @@ -43,15 +43,15 @@ func TestDepositIterKey_Invalid(t *testing.T) { } func TestCollateralRatioKey(t *testing.T) { - collateralKey := CollateralRatioKey("kava-a", 2, sdk.MustNewDecFromStr("1.50")) + collateralKey := CollateralRatioKey("kava-a", 2, sdkmath.LegacyMustNewDecFromStr("1.50")) collateralType, id, ratio := SplitCollateralRatioKey(collateralKey) require.Equal(t, "kava-a", collateralType) require.Equal(t, 2, int(id)) - require.Equal(t, ratio, sdk.MustNewDecFromStr("1.50")) + require.Equal(t, ratio, sdkmath.LegacyMustNewDecFromStr("1.50")) } func TestCollateralRatioKey_BigRatio(t *testing.T) { - bigRatio := sdk.OneDec().Quo(sdk.SmallestDec()).Mul(sdk.OneDec().Add(sdk.OneDec())) + bigRatio := sdkmath.LegacyOneDec().Quo(sdkmath.LegacySmallestDec()).Mul(sdkmath.LegacyOneDec().Add(sdkmath.LegacyOneDec())) collateralKey := CollateralRatioKey("kava-a", 2, bigRatio) collateralType, id, ratio := SplitCollateralRatioKey(collateralKey) require.Equal(t, "kava-a", collateralType) @@ -64,10 +64,10 @@ func TestCollateralRatioKey_Invalid(t *testing.T) { } func TestCollateralRatioIterKey(t *testing.T) { - collateralIterKey := CollateralRatioIterKey("kava-a", sdk.MustNewDecFromStr("1.50")) + collateralIterKey := CollateralRatioIterKey("kava-a", sdkmath.LegacyMustNewDecFromStr("1.50")) collateralType, ratio := SplitCollateralRatioIterKey(collateralIterKey) require.Equal(t, "kava-a", collateralType) - require.Equal(t, ratio, sdk.MustNewDecFromStr("1.50")) + require.Equal(t, ratio, sdkmath.LegacyMustNewDecFromStr("1.50")) } func TestCollateralRatioIterKey_Invalid(t *testing.T) { diff --git a/x/cdp/types/msg_test.go b/x/cdp/types/msg_test.go index 41ec147ae4..4ee70408a7 100644 --- a/x/cdp/types/msg_test.go +++ b/x/cdp/types/msg_test.go @@ -10,7 +10,7 @@ import ( var ( coinsSingle = sdk.NewInt64Coin(sdk.DefaultBondDenom, 1000) - coinsZero = sdk.NewCoin(sdk.DefaultBondDenom, sdk.ZeroInt()) + coinsZero = sdk.NewCoin(sdk.DefaultBondDenom, sdkmath.ZeroInt()) addrs = []sdk.AccAddress{ sdk.AccAddress("test1"), sdk.AccAddress("test2"), diff --git a/x/cdp/types/params.go b/x/cdp/types/params.go index ca3356fb57..0d5b855c6b 100644 --- a/x/cdp/types/params.go +++ b/x/cdp/types/params.go @@ -22,7 +22,7 @@ var ( KeySurplusThreshold = []byte("SurplusThreshold") KeySurplusLot = []byte("SurplusLot") KeyBeginBlockerExecutionBlockInterval = []byte("BeginBlockerExecutionBlockInterval") - DefaultGlobalDebt = sdk.NewCoin(DefaultStableDenom, sdk.ZeroInt()) + DefaultGlobalDebt = sdk.NewCoin(DefaultStableDenom, sdkmath.ZeroInt()) DefaultCircuitBreaker = false DefaultCollateralParams = CollateralParams{} DefaultDebtParam = DebtParam{ @@ -39,7 +39,7 @@ var ( DefaultDebtThreshold = sdkmath.NewInt(100000000000) DefaultSurplusLot = sdkmath.NewInt(10000000000) DefaultDebtLot = sdkmath.NewInt(10000000000) - stabilityFeeMax = sdk.MustNewDecFromStr("1.000000051034942716") // 500% APR + stabilityFeeMax = sdkmath.LegacyMustNewDecFromStr("1.000000051034942716") // 500% APR // Run every block DefaultBeginBlockerExecutionBlockInterval = int64(1) ) @@ -73,8 +73,8 @@ func DefaultParams() Params { // NewCollateralParam returns a new CollateralParam func NewCollateralParam( - denom, ctype string, liqRatio sdk.Dec, debtLimit sdk.Coin, stabilityFee sdk.Dec, auctionSize sdkmath.Int, - liqPenalty sdk.Dec, spotMarketID, liquidationMarketID string, keeperReward sdk.Dec, checkIndexCount sdkmath.Int, conversionFactor sdkmath.Int, + denom, ctype string, liqRatio sdkmath.LegacyDec, debtLimit sdk.Coin, stabilityFee sdkmath.LegacyDec, auctionSize sdkmath.Int, + liqPenalty sdkmath.LegacyDec, spotMarketID, liquidationMarketID string, keeperReward sdkmath.LegacyDec, checkIndexCount sdkmath.Int, conversionFactor sdkmath.Int, ) CollateralParam { return CollateralParam{ Denom: denom, @@ -181,7 +181,7 @@ func (p Params) Validate() error { // validate collateral params collateralTypeDupMap := make(map[string]bool) - collateralParamsDebtLimit := sdk.ZeroInt() + collateralParamsDebtLimit := sdkmath.ZeroInt() for _, cp := range p.CollateralParams { // Collateral type eg busd-a should be unique, but denom can be same eg busd @@ -263,16 +263,16 @@ func validateCollateralParams(i interface{}) error { return fmt.Errorf("liquidation ratio must be > 0") } - if cp.LiquidationPenalty.LT(sdk.ZeroDec()) || cp.LiquidationPenalty.GT(sdk.OneDec()) { + if cp.LiquidationPenalty.LT(sdkmath.LegacyZeroDec()) || cp.LiquidationPenalty.GT(sdkmath.LegacyOneDec()) { return fmt.Errorf("liquidation penalty should be between 0 and 1, is %s for %s", cp.LiquidationPenalty, cp.Denom) } if !cp.AuctionSize.IsPositive() { return fmt.Errorf("auction size should be positive, is %s for %s", cp.AuctionSize, cp.Denom) } - if cp.StabilityFee.LT(sdk.OneDec()) || cp.StabilityFee.GT(stabilityFeeMax) { + if cp.StabilityFee.LT(sdkmath.LegacyOneDec()) || cp.StabilityFee.GT(stabilityFeeMax) { return fmt.Errorf("stability fee must be ≥ 1.0, ≤ %s, is %s for %s", stabilityFeeMax, cp.StabilityFee, cp.Denom) } - if cp.KeeperRewardPercentage.IsNegative() || cp.KeeperRewardPercentage.GT(sdk.OneDec()) { + if cp.KeeperRewardPercentage.IsNegative() || cp.KeeperRewardPercentage.GT(sdkmath.LegacyOneDec()) { return fmt.Errorf("keeper reward percentage should be between 0 and 1, is %s for %s", cp.KeeperRewardPercentage, cp.Denom) } if cp.CheckCollateralizationIndexCount.IsNegative() { diff --git a/x/cdp/types/params_test.go b/x/cdp/types/params_test.go index 0dd727673f..fe1b199371 100644 --- a/x/cdp/types/params_test.go +++ b/x/cdp/types/params_test.go @@ -66,14 +66,14 @@ func (suite *ParamsTestSuite) TestParamValidation() { { Denom: "bnb", Type: "bnb-a", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), + LiquidationRatio: sdkmath.LegacyMustNewDecFromStr("1.5"), DebtLimit: sdk.NewInt64Coin("usdx", 2000000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), - LiquidationPenalty: sdk.MustNewDecFromStr("0.05"), + StabilityFee: sdkmath.LegacyMustNewDecFromStr("1.000000001547125958"), + LiquidationPenalty: sdkmath.LegacyMustNewDecFromStr("0.05"), AuctionSize: sdkmath.NewInt(50000000000), SpotMarketID: "bnb:usd", LiquidationMarketID: "bnb:usd", - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.01"), + KeeperRewardPercentage: sdkmath.LegacyMustNewDecFromStr("0.01"), ConversionFactor: sdkmath.NewInt(8), CheckCollateralizationIndexCount: sdkmath.NewInt(10), }, @@ -104,14 +104,14 @@ func (suite *ParamsTestSuite) TestParamValidation() { { Denom: "bnb", Type: "bnb-a", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), + LiquidationRatio: sdkmath.LegacyMustNewDecFromStr("1.5"), DebtLimit: sdk.NewInt64Coin("usdx", 2000000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), - LiquidationPenalty: sdk.MustNewDecFromStr("0.05"), + StabilityFee: sdkmath.LegacyMustNewDecFromStr("1.000000001547125958"), + LiquidationPenalty: sdkmath.LegacyMustNewDecFromStr("0.05"), AuctionSize: sdkmath.NewInt(50000000000), SpotMarketID: "bnb:usd", LiquidationMarketID: "bnb:usd", - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.01"), + KeeperRewardPercentage: sdkmath.LegacyMustNewDecFromStr("0.01"), ConversionFactor: sdkmath.NewInt(8), CheckCollateralizationIndexCount: sdkmath.NewInt(10), }, @@ -142,14 +142,14 @@ func (suite *ParamsTestSuite) TestParamValidation() { { Denom: "bnb", Type: "bnb-a", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), + LiquidationRatio: sdkmath.LegacyMustNewDecFromStr("1.5"), DebtLimit: sdk.NewInt64Coin("usdx", 2000000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), - LiquidationPenalty: sdk.MustNewDecFromStr("0.05"), + StabilityFee: sdkmath.LegacyMustNewDecFromStr("1.000000001547125958"), + LiquidationPenalty: sdkmath.LegacyMustNewDecFromStr("0.05"), AuctionSize: sdkmath.NewInt(50000000000), SpotMarketID: "bnb:usd", LiquidationMarketID: "bnb:usd", - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.01"), + KeeperRewardPercentage: sdkmath.LegacyMustNewDecFromStr("0.01"), ConversionFactor: sdkmath.NewInt(8), CheckCollateralizationIndexCount: sdkmath.NewInt(10), }, @@ -180,28 +180,28 @@ func (suite *ParamsTestSuite) TestParamValidation() { { Denom: "bnb", Type: "bnb-a", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), + LiquidationRatio: sdkmath.LegacyMustNewDecFromStr("1.5"), DebtLimit: sdk.NewInt64Coin("usdx", 2000000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), - LiquidationPenalty: sdk.MustNewDecFromStr("0.05"), + StabilityFee: sdkmath.LegacyMustNewDecFromStr("1.000000001547125958"), + LiquidationPenalty: sdkmath.LegacyMustNewDecFromStr("0.05"), AuctionSize: sdkmath.NewInt(50000000000), SpotMarketID: "bnb:usd", LiquidationMarketID: "bnb:usd", - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.01"), + KeeperRewardPercentage: sdkmath.LegacyMustNewDecFromStr("0.01"), ConversionFactor: sdkmath.NewInt(8), CheckCollateralizationIndexCount: sdkmath.NewInt(10), }, { Denom: "xrp", Type: "xrp-a", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), + LiquidationRatio: sdkmath.LegacyMustNewDecFromStr("1.5"), DebtLimit: sdk.NewInt64Coin("usdx", 2000000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), - LiquidationPenalty: sdk.MustNewDecFromStr("0.05"), + StabilityFee: sdkmath.LegacyMustNewDecFromStr("1.000000001547125958"), + LiquidationPenalty: sdkmath.LegacyMustNewDecFromStr("0.05"), AuctionSize: sdkmath.NewInt(50000000000), SpotMarketID: "xrp:usd", LiquidationMarketID: "xrp:usd", - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.01"), + KeeperRewardPercentage: sdkmath.LegacyMustNewDecFromStr("0.01"), ConversionFactor: sdkmath.NewInt(6), CheckCollateralizationIndexCount: sdkmath.NewInt(10), }, @@ -232,28 +232,28 @@ func (suite *ParamsTestSuite) TestParamValidation() { { Denom: "bnb", Type: "bnb-a", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), + LiquidationRatio: sdkmath.LegacyMustNewDecFromStr("1.5"), DebtLimit: sdk.NewInt64Coin("usdx", 2000000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), - LiquidationPenalty: sdk.MustNewDecFromStr("0.05"), + StabilityFee: sdkmath.LegacyMustNewDecFromStr("1.000000001547125958"), + LiquidationPenalty: sdkmath.LegacyMustNewDecFromStr("0.05"), AuctionSize: sdkmath.NewInt(50000000000), SpotMarketID: "bnb:usd", LiquidationMarketID: "bnb:usd", - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.01"), + KeeperRewardPercentage: sdkmath.LegacyMustNewDecFromStr("0.01"), ConversionFactor: sdkmath.NewInt(8), CheckCollateralizationIndexCount: sdkmath.NewInt(10), }, { Denom: "xrp", Type: "xrp-a", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), + LiquidationRatio: sdkmath.LegacyMustNewDecFromStr("1.5"), DebtLimit: sdk.NewInt64Coin("usdx", 2000000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), - LiquidationPenalty: sdk.MustNewDecFromStr("0.05"), + StabilityFee: sdkmath.LegacyMustNewDecFromStr("1.000000001547125958"), + LiquidationPenalty: sdkmath.LegacyMustNewDecFromStr("0.05"), AuctionSize: sdkmath.NewInt(50000000000), SpotMarketID: "xrp:usd", LiquidationMarketID: "xrp:usd", - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.01"), + KeeperRewardPercentage: sdkmath.LegacyMustNewDecFromStr("0.01"), ConversionFactor: sdkmath.NewInt(6), CheckCollateralizationIndexCount: sdkmath.NewInt(10), }, @@ -284,28 +284,28 @@ func (suite *ParamsTestSuite) TestParamValidation() { { Denom: "bnb", Type: "bnb-a", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), + LiquidationRatio: sdkmath.LegacyMustNewDecFromStr("1.5"), DebtLimit: sdk.NewInt64Coin("usdx", 2000000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), - LiquidationPenalty: sdk.MustNewDecFromStr("0.05"), + StabilityFee: sdkmath.LegacyMustNewDecFromStr("1.000000001547125958"), + LiquidationPenalty: sdkmath.LegacyMustNewDecFromStr("0.05"), AuctionSize: sdkmath.NewInt(50000000000), SpotMarketID: "bnb:usd", LiquidationMarketID: "bnb:usd", - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.01"), + KeeperRewardPercentage: sdkmath.LegacyMustNewDecFromStr("0.01"), ConversionFactor: sdkmath.NewInt(8), CheckCollateralizationIndexCount: sdkmath.NewInt(10), }, { Denom: "xrp", Type: "xrp-a", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), + LiquidationRatio: sdkmath.LegacyMustNewDecFromStr("1.5"), DebtLimit: sdk.NewInt64Coin("susd", 2000000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), - LiquidationPenalty: sdk.MustNewDecFromStr("0.05"), + StabilityFee: sdkmath.LegacyMustNewDecFromStr("1.000000001547125958"), + LiquidationPenalty: sdkmath.LegacyMustNewDecFromStr("0.05"), AuctionSize: sdkmath.NewInt(50000000000), SpotMarketID: "xrp:usd", LiquidationMarketID: "xrp:usd", - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.01"), + KeeperRewardPercentage: sdkmath.LegacyMustNewDecFromStr("0.01"), ConversionFactor: sdkmath.NewInt(6), CheckCollateralizationIndexCount: sdkmath.NewInt(10), }, @@ -335,14 +335,14 @@ func (suite *ParamsTestSuite) TestParamValidation() { collateralParams: types.CollateralParams{ { Denom: "", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), + LiquidationRatio: sdkmath.LegacyMustNewDecFromStr("1.5"), DebtLimit: sdk.NewInt64Coin("usdx", 2000000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), - LiquidationPenalty: sdk.MustNewDecFromStr("0.05"), + StabilityFee: sdkmath.LegacyMustNewDecFromStr("1.000000001547125958"), + LiquidationPenalty: sdkmath.LegacyMustNewDecFromStr("0.05"), AuctionSize: sdkmath.NewInt(50000000000), SpotMarketID: "bnb:usd", LiquidationMarketID: "bnb:usd", - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.01"), + KeeperRewardPercentage: sdkmath.LegacyMustNewDecFromStr("0.01"), ConversionFactor: sdkmath.NewInt(8), CheckCollateralizationIndexCount: sdkmath.NewInt(10), }, @@ -373,14 +373,14 @@ func (suite *ParamsTestSuite) TestParamValidation() { { Denom: "bnb", Type: "bnb-a", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), + LiquidationRatio: sdkmath.LegacyMustNewDecFromStr("1.5"), DebtLimit: sdk.NewInt64Coin("usdx", 2000000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), - LiquidationPenalty: sdk.MustNewDecFromStr("0.05"), + StabilityFee: sdkmath.LegacyMustNewDecFromStr("1.000000001547125958"), + LiquidationPenalty: sdkmath.LegacyMustNewDecFromStr("0.05"), AuctionSize: sdkmath.NewInt(50000000000), SpotMarketID: "", LiquidationMarketID: "", - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.01"), + KeeperRewardPercentage: sdkmath.LegacyMustNewDecFromStr("0.01"), ConversionFactor: sdkmath.NewInt(8), CheckCollateralizationIndexCount: sdkmath.NewInt(10), }, @@ -411,28 +411,28 @@ func (suite *ParamsTestSuite) TestParamValidation() { { Denom: "bnb", Type: "bnb-a", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), + LiquidationRatio: sdkmath.LegacyMustNewDecFromStr("1.5"), DebtLimit: sdk.NewInt64Coin("usdx", 1000000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), - LiquidationPenalty: sdk.MustNewDecFromStr("0.05"), + StabilityFee: sdkmath.LegacyMustNewDecFromStr("1.000000001547125958"), + LiquidationPenalty: sdkmath.LegacyMustNewDecFromStr("0.05"), AuctionSize: sdkmath.NewInt(50000000000), SpotMarketID: "bnb:usd", LiquidationMarketID: "bnb:usd", - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.01"), + KeeperRewardPercentage: sdkmath.LegacyMustNewDecFromStr("0.01"), ConversionFactor: sdkmath.NewInt(8), CheckCollateralizationIndexCount: sdkmath.NewInt(10), }, { Denom: "bnb", Type: "bnb-a", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), + LiquidationRatio: sdkmath.LegacyMustNewDecFromStr("1.5"), DebtLimit: sdk.NewInt64Coin("usdx", 1000000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), - LiquidationPenalty: sdk.MustNewDecFromStr("0.05"), + StabilityFee: sdkmath.LegacyMustNewDecFromStr("1.000000001547125958"), + LiquidationPenalty: sdkmath.LegacyMustNewDecFromStr("0.05"), AuctionSize: sdkmath.NewInt(50000000000), SpotMarketID: "bnb:usd", LiquidationMarketID: "bnb:usd", - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.01"), + KeeperRewardPercentage: sdkmath.LegacyMustNewDecFromStr("0.01"), ConversionFactor: sdkmath.NewInt(8), CheckCollateralizationIndexCount: sdkmath.NewInt(10), }, @@ -463,28 +463,28 @@ func (suite *ParamsTestSuite) TestParamValidation() { { Denom: "bnb", Type: "bnb-a", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), + LiquidationRatio: sdkmath.LegacyMustNewDecFromStr("1.5"), DebtLimit: sdk.NewInt64Coin("usdx", 1000000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), - LiquidationPenalty: sdk.MustNewDecFromStr("0.05"), + StabilityFee: sdkmath.LegacyMustNewDecFromStr("1.000000001547125958"), + LiquidationPenalty: sdkmath.LegacyMustNewDecFromStr("0.05"), AuctionSize: sdkmath.NewInt(50000000000), SpotMarketID: "bnb:usd", LiquidationMarketID: "bnb:usd", - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.01"), + KeeperRewardPercentage: sdkmath.LegacyMustNewDecFromStr("0.01"), ConversionFactor: sdkmath.NewInt(8), CheckCollateralizationIndexCount: sdkmath.NewInt(10), }, { Denom: "bnb", Type: "bnb-b", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), + LiquidationRatio: sdkmath.LegacyMustNewDecFromStr("1.5"), DebtLimit: sdk.NewInt64Coin("usdx", 1000000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), - LiquidationPenalty: sdk.MustNewDecFromStr("0.05"), + StabilityFee: sdkmath.LegacyMustNewDecFromStr("1.000000001547125958"), + LiquidationPenalty: sdkmath.LegacyMustNewDecFromStr("0.05"), AuctionSize: sdkmath.NewInt(50000000000), SpotMarketID: "bnb:usd", LiquidationMarketID: "bnb:usd", - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.01"), + KeeperRewardPercentage: sdkmath.LegacyMustNewDecFromStr("0.01"), ConversionFactor: sdkmath.NewInt(8), CheckCollateralizationIndexCount: sdkmath.NewInt(10), }, @@ -515,14 +515,14 @@ func (suite *ParamsTestSuite) TestParamValidation() { { Denom: "bnb", Type: "bnb-a", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), + LiquidationRatio: sdkmath.LegacyMustNewDecFromStr("1.5"), DebtLimit: sdk.Coin{}, - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), - LiquidationPenalty: sdk.MustNewDecFromStr("0.05"), + StabilityFee: sdkmath.LegacyMustNewDecFromStr("1.000000001547125958"), + LiquidationPenalty: sdkmath.LegacyMustNewDecFromStr("0.05"), AuctionSize: sdkmath.NewInt(50000000000), SpotMarketID: "bnb:usd", LiquidationMarketID: "bnb:usd", - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.01"), + KeeperRewardPercentage: sdkmath.LegacyMustNewDecFromStr("0.01"), ConversionFactor: sdkmath.NewInt(8), CheckCollateralizationIndexCount: sdkmath.NewInt(10), }, @@ -553,14 +553,14 @@ func (suite *ParamsTestSuite) TestParamValidation() { { Denom: "bnb", Type: "bnb-a", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), + LiquidationRatio: sdkmath.LegacyMustNewDecFromStr("1.5"), DebtLimit: sdk.NewInt64Coin("usdx", 1000000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), - LiquidationPenalty: sdk.MustNewDecFromStr("1.05"), + StabilityFee: sdkmath.LegacyMustNewDecFromStr("1.000000001547125958"), + LiquidationPenalty: sdkmath.LegacyMustNewDecFromStr("1.05"), AuctionSize: sdkmath.NewInt(50000000000), SpotMarketID: "bnb:usd", LiquidationMarketID: "bnb:usd", - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.01"), + KeeperRewardPercentage: sdkmath.LegacyMustNewDecFromStr("0.01"), ConversionFactor: sdkmath.NewInt(8), CheckCollateralizationIndexCount: sdkmath.NewInt(10), }, @@ -591,14 +591,14 @@ func (suite *ParamsTestSuite) TestParamValidation() { { Denom: "bnb", Type: "bnb-a", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), + LiquidationRatio: sdkmath.LegacyMustNewDecFromStr("1.5"), DebtLimit: sdk.NewInt64Coin("usdx", 1000000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), - LiquidationPenalty: sdk.MustNewDecFromStr("0.05"), - AuctionSize: sdk.ZeroInt(), + StabilityFee: sdkmath.LegacyMustNewDecFromStr("1.000000001547125958"), + LiquidationPenalty: sdkmath.LegacyMustNewDecFromStr("0.05"), + AuctionSize: sdkmath.ZeroInt(), SpotMarketID: "bnb:usd", LiquidationMarketID: "bnb:usd", - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.01"), + KeeperRewardPercentage: sdkmath.LegacyMustNewDecFromStr("0.01"), ConversionFactor: sdkmath.NewInt(8), CheckCollateralizationIndexCount: sdkmath.NewInt(10), }, @@ -629,14 +629,14 @@ func (suite *ParamsTestSuite) TestParamValidation() { { Denom: "bnb", Type: "bnb-a", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), + LiquidationRatio: sdkmath.LegacyMustNewDecFromStr("1.5"), DebtLimit: sdk.NewInt64Coin("usdx", 1000000000000), - StabilityFee: sdk.MustNewDecFromStr("1.1"), - LiquidationPenalty: sdk.MustNewDecFromStr("0.05"), + StabilityFee: sdkmath.LegacyMustNewDecFromStr("1.1"), + LiquidationPenalty: sdkmath.LegacyMustNewDecFromStr("0.05"), AuctionSize: sdkmath.NewInt(50000000000), SpotMarketID: "bnb:usd", LiquidationMarketID: "bnb:usd", - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.01"), + KeeperRewardPercentage: sdkmath.LegacyMustNewDecFromStr("0.01"), ConversionFactor: sdkmath.NewInt(8), CheckCollateralizationIndexCount: sdkmath.NewInt(10), }, @@ -667,14 +667,14 @@ func (suite *ParamsTestSuite) TestParamValidation() { { Denom: "bnb", Type: "bnb-a", - LiquidationRatio: sdk.MustNewDecFromStr("0.0"), + LiquidationRatio: sdkmath.LegacyMustNewDecFromStr("0.0"), DebtLimit: sdk.NewInt64Coin("usdx", 1_000_000_000_000), - StabilityFee: sdk.MustNewDecFromStr("1.1"), - LiquidationPenalty: sdk.MustNewDecFromStr("0.05"), + StabilityFee: sdkmath.LegacyMustNewDecFromStr("1.1"), + LiquidationPenalty: sdkmath.LegacyMustNewDecFromStr("0.05"), AuctionSize: sdkmath.NewInt(50_000_000_000), SpotMarketID: "bnb:usd", LiquidationMarketID: "bnb:usd", - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.01"), + KeeperRewardPercentage: sdkmath.LegacyMustNewDecFromStr("0.01"), ConversionFactor: sdkmath.NewInt(8), CheckCollateralizationIndexCount: sdkmath.NewInt(10), }, @@ -700,14 +700,14 @@ func (suite *ParamsTestSuite) TestParamValidation() { { Denom: "bnb", Type: "bnb-a", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), + LiquidationRatio: sdkmath.LegacyMustNewDecFromStr("1.5"), DebtLimit: sdk.NewInt64Coin("usdx", 2000000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), - LiquidationPenalty: sdk.MustNewDecFromStr("0.05"), + StabilityFee: sdkmath.LegacyMustNewDecFromStr("1.000000001547125958"), + LiquidationPenalty: sdkmath.LegacyMustNewDecFromStr("0.05"), AuctionSize: sdkmath.NewInt(50000000000), SpotMarketID: "bnb:usd", LiquidationMarketID: "bnb:usd", - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.01"), + KeeperRewardPercentage: sdkmath.LegacyMustNewDecFromStr("0.01"), ConversionFactor: sdkmath.NewInt(8), CheckCollateralizationIndexCount: sdkmath.NewInt(10), }, @@ -754,7 +754,7 @@ func (suite *ParamsTestSuite) TestParamValidation() { globalDebtLimit: types.DefaultGlobalDebt, collateralParams: types.DefaultCollateralParams, debtParam: types.DefaultDebtParam, - surplusThreshold: sdk.ZeroInt(), + surplusThreshold: sdkmath.ZeroInt(), surplusLot: types.DefaultSurplusLot, debtThreshold: types.DefaultDebtThreshold, debtLot: types.DefaultDebtLot, @@ -774,7 +774,7 @@ func (suite *ParamsTestSuite) TestParamValidation() { debtParam: types.DefaultDebtParam, surplusThreshold: types.DefaultSurplusThreshold, surplusLot: types.DefaultSurplusLot, - debtThreshold: sdk.ZeroInt(), + debtThreshold: sdkmath.ZeroInt(), debtLot: types.DefaultDebtLot, breaker: types.DefaultCircuitBreaker, beginBlockerExecutionBlockInterval: types.DefaultBeginBlockerExecutionBlockInterval, @@ -791,7 +791,7 @@ func (suite *ParamsTestSuite) TestParamValidation() { collateralParams: types.DefaultCollateralParams, debtParam: types.DefaultDebtParam, surplusThreshold: types.DefaultSurplusThreshold, - surplusLot: sdk.ZeroInt(), + surplusLot: sdkmath.ZeroInt(), debtThreshold: types.DefaultDebtThreshold, debtLot: types.DefaultDebtLot, breaker: types.DefaultCircuitBreaker, @@ -811,7 +811,7 @@ func (suite *ParamsTestSuite) TestParamValidation() { surplusThreshold: types.DefaultSurplusThreshold, surplusLot: types.DefaultSurplusLot, debtThreshold: types.DefaultDebtThreshold, - debtLot: sdk.ZeroInt(), + debtLot: sdkmath.ZeroInt(), breaker: types.DefaultCircuitBreaker, beginBlockerExecutionBlockInterval: types.DefaultBeginBlockerExecutionBlockInterval, }, diff --git a/x/cdp/types/querier.go b/x/cdp/types/querier.go index f3e6a69b9d..0288a1c4d4 100644 --- a/x/cdp/types/querier.go +++ b/x/cdp/types/querier.go @@ -1,21 +1,22 @@ package types import ( + sdkmath "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" ) // QueryCdpsParams is the params for a filtered CDP query type QueryCdpsParams struct { - Page int `json:"page" yaml:"page"` - Limit int `json:"limit" yaml:"limit"` - CollateralType string `json:"collateral_type" yaml:"collateral_type"` - Owner sdk.AccAddress `json:"owner" yaml:"owner"` - ID uint64 `json:"id" yaml:"id"` - Ratio sdk.Dec `json:"ratio" yaml:"ratio"` + Page int `json:"page" yaml:"page"` + Limit int `json:"limit" yaml:"limit"` + CollateralType string `json:"collateral_type" yaml:"collateral_type"` + Owner sdk.AccAddress `json:"owner" yaml:"owner"` + ID uint64 `json:"id" yaml:"id"` + Ratio sdkmath.LegacyDec `json:"ratio" yaml:"ratio"` } // NewQueryCdpsParams creates a new QueryCdpsParams -func NewQueryCdpsParams(page, limit int, collateralType string, owner sdk.AccAddress, id uint64, ratio sdk.Dec) QueryCdpsParams { +func NewQueryCdpsParams(page, limit int, collateralType string, owner sdk.AccAddress, id uint64, ratio sdkmath.LegacyDec) QueryCdpsParams { return QueryCdpsParams{ Page: page, Limit: limit, diff --git a/x/cdp/types/query.pb.go b/x/cdp/types/query.pb.go index ca16689f90..1bd105f16d 100644 --- a/x/cdp/types/query.pb.go +++ b/x/cdp/types/query.pb.go @@ -297,7 +297,7 @@ type QueryCdpsRequest struct { CollateralType string `protobuf:"bytes,1,opt,name=collateral_type,json=collateralType,proto3" json:"collateral_type,omitempty"` Owner string `protobuf:"bytes,2,opt,name=owner,proto3" json:"owner,omitempty"` ID uint64 `protobuf:"varint,3,opt,name=id,proto3" json:"id,omitempty"` - // sdk.Dec as a string + // sdkmath.LegacyDec as a string Ratio string `protobuf:"bytes,4,opt,name=ratio,proto3" json:"ratio,omitempty"` Pagination *query.PageRequest `protobuf:"bytes,5,opt,name=pagination,proto3" json:"pagination,omitempty"` } @@ -1187,6 +1187,7 @@ func _Query_Deposits_Handler(srv interface{}, ctx context.Context, dec func(inte return interceptor(ctx, in, info, handler) } +var Query_serviceDesc = _Query_serviceDesc var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "kava.cdp.v1beta1.Query", HandlerType: (*QueryServer)(nil), diff --git a/x/cdp/types/tx.pb.go b/x/cdp/types/tx.pb.go index f21bd475c3..3aae65f830 100644 --- a/x/cdp/types/tx.pb.go +++ b/x/cdp/types/tx.pb.go @@ -953,6 +953,7 @@ func _Msg_Liquidate_Handler(srv interface{}, ctx context.Context, dec func(inter return interceptor(ctx, in, info, handler) } +var Msg_serviceDesc = _Msg_serviceDesc var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "kava.cdp.v1beta1.Msg", HandlerType: (*MsgServer)(nil), diff --git a/x/cdp/types/utils.go b/x/cdp/types/utils.go index 518fc0fde0..14803ad5a5 100644 --- a/x/cdp/types/utils.go +++ b/x/cdp/types/utils.go @@ -6,21 +6,20 @@ import ( "strings" sdkmath "cosmossdk.io/math" - sdk "github.com/cosmos/cosmos-sdk/types" ) -// MaxSortableDec largest sortable sdk.Dec -var MaxSortableDec = sdk.OneDec().Quo(sdk.SmallestDec()) +// MaxSortableDec largest sortable sdkmath.LegacyDec +var MaxSortableDec = sdkmath.LegacyOneDec().Quo(sdkmath.LegacySmallestDec()) -// ValidSortableDec sdk.Dec can't have precision of less than 10^-18 -func ValidSortableDec(dec sdk.Dec) bool { +// ValidSortableDec sdkmath.LegacyDec can't have precision of less than 10^-18 +func ValidSortableDec(dec sdkmath.LegacyDec) bool { return dec.Abs().LTE(MaxSortableDec) } // SortableDecBytes returns a byte slice representation of a Dec that can be sorted. // Left and right pads with 0s so there are 18 digits to left and right of the decimal point. // For this reason, there is a maximum and minimum value for this, enforced by ValidSortableDec. -func SortableDecBytes(dec sdk.Dec) []byte { +func SortableDecBytes(dec sdkmath.LegacyDec) []byte { if !ValidSortableDec(dec) { panic("dec must be within bounds") } @@ -35,13 +34,13 @@ func SortableDecBytes(dec sdk.Dec) []byte { } // We move the negative sign to the front of all the left padded 0s, to make negative numbers come before positive numbers if dec.IsNegative() { - return append([]byte("-"), []byte(fmt.Sprintf(fmt.Sprintf("%%0%ds", sdk.Precision*2+1), dec.Abs().String()))...) + return append([]byte("-"), []byte(fmt.Sprintf(fmt.Sprintf("%%0%ds", sdkmath.LegacyPrecision*2+1), dec.Abs().String()))...) } - return []byte(fmt.Sprintf(fmt.Sprintf("%%0%ds", sdk.Precision*2+1), dec.String())) + return []byte(fmt.Sprintf(fmt.Sprintf("%%0%ds", sdkmath.LegacyPrecision*2+1), dec.String())) } -// ParseDecBytes parses a []byte encoded using SortableDecBytes back to sdk.Dec -func ParseDecBytes(db []byte) (sdk.Dec, error) { +// ParseDecBytes parses a []byte encoded using SortableDecBytes back to sdkmath.LegacyDec +func ParseDecBytes(db []byte) (sdkmath.LegacyDec, error) { strFromDecBytes := strings.Trim(string(db[:]), "0") if string(strFromDecBytes[0]) == "." { strFromDecBytes = "0" + strFromDecBytes @@ -55,9 +54,9 @@ func ParseDecBytes(db []byte) (sdk.Dec, error) { if bytes.Equal(db, []byte("--")) { return MaxSortableDec.Neg(), nil } - dec, err := sdk.NewDecFromStr(strFromDecBytes) + dec, err := sdkmath.LegacyNewDecFromStr(strFromDecBytes) if err != nil { - return sdk.Dec{}, err + return sdkmath.LegacyDec{}, err } return dec, nil } @@ -71,25 +70,25 @@ func RelativePow(x sdkmath.Int, n sdkmath.Int, b sdkmath.Int) (z sdkmath.Int) { z = b // 0^0 = 1 return } - z = sdk.ZeroInt() // otherwise 0^a = 0 + z = sdkmath.ZeroInt() // otherwise 0^a = 0 return } z = x - if n.Mod(sdkmath.NewInt(2)).Equal(sdk.ZeroInt()) { + if n.Mod(sdkmath.NewInt(2)).Equal(sdkmath.ZeroInt()) { z = b } halfOfB := b.Quo(sdkmath.NewInt(2)) n = n.Quo(sdkmath.NewInt(2)) - for n.GT(sdk.ZeroInt()) { + for n.GT(sdkmath.ZeroInt()) { xSquared := x.Mul(x) xSquaredRounded := xSquared.Add(halfOfB) x = xSquaredRounded.Quo(b) - if n.Mod(sdkmath.NewInt(2)).Equal(sdk.OneInt()) { + if n.Mod(sdkmath.NewInt(2)).Equal(sdkmath.OneInt()) { zx := z.Mul(x) zxRounded := zx.Add(halfOfB) z = zxRounded.Quo(b) diff --git a/x/cdp/types/utils_test.go b/x/cdp/types/utils_test.go index 88856df160..bfee62b07a 100644 --- a/x/cdp/types/utils_test.go +++ b/x/cdp/types/utils_test.go @@ -12,49 +12,49 @@ import ( func TestSortableDecBytes(t *testing.T) { tests := []struct { - d sdk.Dec + d sdkmath.LegacyDec want []byte }{ - {sdk.NewDec(0), []byte("000000000000000000.000000000000000000")}, - {sdk.NewDec(1), []byte("000000000000000001.000000000000000000")}, - {sdk.MustNewDecFromStr("2.0"), []byte("000000000000000002.000000000000000000")}, - {sdk.MustNewDecFromStr("-2.0"), []byte("-000000000000000002.000000000000000000")}, - {sdk.NewDec(10), []byte("000000000000000010.000000000000000000")}, - {sdk.NewDec(12340), []byte("000000000000012340.000000000000000000")}, + {sdkmath.LegacyNewDec(0), []byte("000000000000000000.000000000000000000")}, + {sdkmath.LegacyNewDec(1), []byte("000000000000000001.000000000000000000")}, + {sdkmath.LegacyMustNewDecFromStr("2.0"), []byte("000000000000000002.000000000000000000")}, + {sdkmath.LegacyMustNewDecFromStr("-2.0"), []byte("-000000000000000002.000000000000000000")}, + {sdkmath.LegacyNewDec(10), []byte("000000000000000010.000000000000000000")}, + {sdkmath.LegacyNewDec(12340), []byte("000000000000012340.000000000000000000")}, {sdk.NewDecWithPrec(12340, 4), []byte("000000000000000001.234000000000000000")}, {sdk.NewDecWithPrec(12340, 5), []byte("000000000000000000.123400000000000000")}, {sdk.NewDecWithPrec(12340, 8), []byte("000000000000000000.000123400000000000")}, {sdk.NewDecWithPrec(1009009009009009009, 17), []byte("000000000000000010.090090090090090090")}, {sdk.NewDecWithPrec(-1009009009009009009, 17), []byte("-000000000000000010.090090090090090090")}, - {sdk.NewDec(1000000000000000000), []byte("max")}, - {sdk.NewDec(-1000000000000000000), []byte("--")}, + {sdkmath.LegacyNewDec(1000000000000000000), []byte("max")}, + {sdkmath.LegacyNewDec(-1000000000000000000), []byte("--")}, } for tcIndex, tc := range tests { assert.Equal(t, tc.want, SortableDecBytes(tc.d), "bad String(), index: %v", tcIndex) } - assert.Panics(t, func() { SortableDecBytes(sdk.NewDec(1000000000000000001)) }) - assert.Panics(t, func() { SortableDecBytes(sdk.NewDec(-1000000000000000001)) }) + assert.Panics(t, func() { SortableDecBytes(sdkmath.LegacyNewDec(1000000000000000001)) }) + assert.Panics(t, func() { SortableDecBytes(sdkmath.LegacyNewDec(-1000000000000000001)) }) } func TestParseSortableDecBytes(t *testing.T) { tests := []struct { - d sdk.Dec + d sdkmath.LegacyDec want []byte }{ - {sdk.NewDec(0), []byte("000000000000000000.000000000000000000")}, - {sdk.NewDec(1), []byte("000000000000000001.000000000000000000")}, - {sdk.MustNewDecFromStr("2.0"), []byte("000000000000000002.000000000000000000")}, - {sdk.MustNewDecFromStr("-2.0"), []byte("-000000000000000002.000000000000000000")}, - {sdk.NewDec(10), []byte("000000000000000010.000000000000000000")}, - {sdk.NewDec(12340), []byte("000000000000012340.000000000000000000")}, + {sdkmath.LegacyNewDec(0), []byte("000000000000000000.000000000000000000")}, + {sdkmath.LegacyNewDec(1), []byte("000000000000000001.000000000000000000")}, + {sdkmath.LegacyMustNewDecFromStr("2.0"), []byte("000000000000000002.000000000000000000")}, + {sdkmath.LegacyMustNewDecFromStr("-2.0"), []byte("-000000000000000002.000000000000000000")}, + {sdkmath.LegacyNewDec(10), []byte("000000000000000010.000000000000000000")}, + {sdkmath.LegacyNewDec(12340), []byte("000000000000012340.000000000000000000")}, {sdk.NewDecWithPrec(12340, 4), []byte("000000000000000001.234000000000000000")}, {sdk.NewDecWithPrec(12340, 5), []byte("000000000000000000.123400000000000000")}, {sdk.NewDecWithPrec(12340, 8), []byte("000000000000000000.000123400000000000")}, {sdk.NewDecWithPrec(1009009009009009009, 17), []byte("000000000000000010.090090090090090090")}, {sdk.NewDecWithPrec(-1009009009009009009, 17), []byte("-000000000000000010.090090090090090090")}, - {sdk.NewDec(1000000000000000000), []byte("max")}, - {sdk.NewDec(-1000000000000000000), []byte("--")}, + {sdkmath.LegacyNewDec(1000000000000000000), []byte("max")}, + {sdkmath.LegacyNewDec(-1000000000000000000), []byte("--")}, } for tcIndex, tc := range tests { b := SortableDecBytes(tc.d) @@ -69,10 +69,10 @@ func TestRelativePow(t *testing.T) { args []sdkmath.Int want sdkmath.Int }{ - {[]sdkmath.Int{sdk.ZeroInt(), sdk.ZeroInt(), sdk.OneInt()}, sdk.OneInt()}, - {[]sdkmath.Int{sdk.ZeroInt(), sdk.ZeroInt(), sdkmath.NewInt(10)}, sdkmath.NewInt(10)}, - {[]sdkmath.Int{sdk.ZeroInt(), sdk.OneInt(), sdkmath.NewInt(10)}, sdk.ZeroInt()}, - {[]sdkmath.Int{sdkmath.NewInt(10), sdkmath.NewInt(2), sdk.OneInt()}, sdkmath.NewInt(100)}, + {[]sdkmath.Int{sdkmath.ZeroInt(), sdkmath.ZeroInt(), sdkmath.OneInt()}, sdkmath.OneInt()}, + {[]sdkmath.Int{sdkmath.ZeroInt(), sdkmath.ZeroInt(), sdkmath.NewInt(10)}, sdkmath.NewInt(10)}, + {[]sdkmath.Int{sdkmath.ZeroInt(), sdkmath.OneInt(), sdkmath.NewInt(10)}, sdkmath.ZeroInt()}, + {[]sdkmath.Int{sdkmath.NewInt(10), sdkmath.NewInt(2), sdkmath.OneInt()}, sdkmath.NewInt(100)}, {[]sdkmath.Int{sdkmath.NewInt(210), sdkmath.NewInt(2), sdkmath.NewInt(100)}, sdkmath.NewInt(441)}, {[]sdkmath.Int{sdkmath.NewInt(2100), sdkmath.NewInt(2), sdkmath.NewInt(1000)}, sdkmath.NewInt(4410)}, {[]sdkmath.Int{sdkmath.NewInt(1000000001547125958), sdkmath.NewInt(600), sdkmath.NewInt(1000000000000000000)}, sdkmath.NewInt(1000000928276004850)}, diff --git a/x/committee/abci.go b/x/committee/abci.go index 107c228986..79bdb6ae76 100644 --- a/x/committee/abci.go +++ b/x/committee/abci.go @@ -6,14 +6,12 @@ import ( "github.com/cosmos/cosmos-sdk/telemetry" sdk "github.com/cosmos/cosmos-sdk/types" - abci "github.com/cometbft/cometbft/abci/types" - "github.com/kava-labs/kava/x/committee/keeper" "github.com/kava-labs/kava/x/committee/types" ) // BeginBlocker runs at the start of every block. -func BeginBlocker(ctx sdk.Context, _ abci.RequestBeginBlock, k keeper.Keeper) { +func BeginBlocker(ctx sdk.Context, k keeper.Keeper) { defer telemetry.ModuleMeasureSince(types.ModuleName, time.Now(), telemetry.MetricKeyBeginBlocker) k.ProcessProposals(ctx) diff --git a/x/committee/abci_test.go b/x/committee/abci_test.go index 80bba98980..0b1d6ae289 100644 --- a/x/committee/abci_test.go +++ b/x/committee/abci_test.go @@ -33,7 +33,7 @@ type ModuleTestSuite struct { func (suite *ModuleTestSuite) SetupTest() { suite.app = app.NewTestApp() suite.keeper = suite.app.GetCommitteeKeeper() - suite.ctx = suite.app.NewContext(true, tmproto.Header{}) + suite.ctx = suite.App.NewContextLegacy(true, tmproto.Header{}) _, suite.addresses = app.GeneratePrivKeyAddressPairs(5) } diff --git a/x/committee/client/cli/tx.go b/x/committee/client/cli/tx.go index 8aaaa882c4..628058d842 100644 --- a/x/committee/client/cli/tx.go +++ b/x/committee/client/cli/tx.go @@ -2,6 +2,7 @@ package cli import ( "bytes" + sdkmath "cosmossdk.io/math" "encoding/json" "fmt" "io/ioutil" @@ -12,12 +13,14 @@ import ( "github.com/cometbft/cometbft/crypto" "github.com/spf13/cobra" + "cosmossdk.io/errors" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/client/tx" "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/version" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" paramsproposal "github.com/cosmos/cosmos-sdk/x/params/types/proposal" @@ -244,8 +247,15 @@ and to delete a committee: if err != nil { return err } - err = msg.ValidateBasic() - if err != nil { + + contentProposal := msg.GetContent() + if contentProposal == nil { + return errors.Wrap(govtypes.ErrInvalidProposalContent, "missing content") + } + if !govv1beta1.IsValidProposalType(contentProposal.ProposalType()) { + return errors.Wrap(govtypes.ErrInvalidProposalType, contentProposal.ProposalType()) + } + if err := contentProposal.ValidateBasic(); err != nil { return err } @@ -268,7 +278,7 @@ func MustGetExampleCommitteeChangeProposal(cdc codec.Codec) string { []types.Permission{ &types.GodPermission{}, }, - sdk.MustNewDecFromStr("0.8"), + sdkmath.LegacyMustNewDecFromStr("0.8"), time.Hour*24*7, types.TALLY_OPTION_FIRST_PAST_THE_POST, ), diff --git a/x/committee/client/common/query.go b/x/committee/client/common/query.go index 5efe31dad4..9236a74007 100644 --- a/x/committee/client/common/query.go +++ b/x/committee/client/common/query.go @@ -2,6 +2,7 @@ package common import ( "fmt" + "strings" "github.com/cosmos/cosmos-sdk/client" sdk "github.com/cosmos/cosmos-sdk/types" @@ -38,10 +39,12 @@ func QueryProposer(cliCtx client.Context, proposalID uint64) (Proposer, error) { fmt.Sprintf("%s.%s='%s'", sdk.EventTypeMessage, sdk.AttributeKeyAction, types.TypeMsgSubmitProposal), fmt.Sprintf("%s.%s='%s'", types.EventTypeProposalSubmit, types.AttributeKeyProposalID, []byte(fmt.Sprintf("%d", proposalID))), } + // removed internal join of events and requires the AND operator here + query := strings.Join(events, " AND ") // NOTE: SearchTxs is used to facilitate the txs query which does not currently // support configurable pagination. - searchResult, err := authtx.QueryTxsByEvents(cliCtx, events, defaultPage, defaultLimit, "") + searchResult, err := authtx.QueryTxsByEvents(cliCtx, defaultPage, defaultLimit, query, "") if err != nil { return Proposer{}, err } diff --git a/x/committee/genesis_test.go b/x/committee/genesis_test.go index 64f321f0ef..4cb23070ca 100644 --- a/x/committee/genesis_test.go +++ b/x/committee/genesis_test.go @@ -28,7 +28,7 @@ type GenesisTestSuite struct { func (suite *GenesisTestSuite) SetupTest() { suite.app = app.NewTestApp() suite.keeper = suite.app.GetCommitteeKeeper() - suite.ctx = suite.app.NewContext(true, tmproto.Header{}) + suite.ctx = suite.App.NewContextLegacy(true, tmproto.Header{}) _, suite.addresses = app.GeneratePrivKeyAddressPairs(10) } @@ -133,7 +133,7 @@ func (suite *GenesisTestSuite) TestInitGenesis() { // Setup (note: suite.SetupTest is not run before every suite.Run) suite.app = app.NewTestApp() suite.keeper = suite.app.GetCommitteeKeeper() - suite.ctx = suite.app.NewContext(true, tmproto.Header{}) + suite.ctx = suite.App.NewContextLegacy(true, tmproto.Header{}) // Run var exportedGenState *types.GenesisState diff --git a/x/committee/keeper/_param_permission_test.go b/x/committee/keeper/_param_permission_test.go index 8ebe9c26f5..9553ec1dd5 100644 --- a/x/committee/keeper/_param_permission_test.go +++ b/x/committee/keeper/_param_permission_test.go @@ -89,13 +89,13 @@ func (suite *PermissionTestSuite) TestSubParamChangePermission_Allows() { SupplyLimit: bep3types.SupplyLimit{ Limit: sdkmath.NewInt(350000000000000), TimeLimited: false, - TimeBasedLimit: sdk.ZeroInt(), + TimeBasedLimit: sdkmath.ZeroInt(), TimePeriod: time.Hour, }, Active: true, DeputyAddress: testDeputy, FixedFee: sdkmath.NewInt(1000), - MinSwapAmount: sdk.OneInt(), + MinSwapAmount: sdkmath.OneInt(), MaxSwapAmount: sdkmath.NewInt(1000000000000), MinBlockLock: bep3types.DefaultMinBlockLock, MaxBlockLock: bep3types.DefaultMaxBlockLock, @@ -112,7 +112,7 @@ func (suite *PermissionTestSuite) TestSubParamChangePermission_Allows() { Active: false, DeputyAddress: testDeputy, FixedFee: sdkmath.NewInt(1000), - MinSwapAmount: sdk.OneInt(), + MinSwapAmount: sdkmath.OneInt(), MaxSwapAmount: sdkmath.NewInt(1000000000000), MinBlockLock: bep3types.DefaultMinBlockLock, MaxBlockLock: bep3types.DefaultMaxBlockLock, @@ -157,7 +157,7 @@ func (suite *PermissionTestSuite) TestSubParamChangePermission_Allows() { { name: "normal", genState: []app.GenesisState{ - newPricefeedGenState([]string{"bnb", "btc"}, []sdk.Dec{d("15.01"), d("9500")}), + newPricefeedGenState([]string{"bnb", "btc"}, []sdkmath.LegacyDec{d("15.01"), d("9500")}), newCDPGenesisState(testCDPParams), newBep3GenesisState(testBep3Params), }, @@ -252,7 +252,7 @@ func (suite *PermissionTestSuite) TestSubParamChangePermission_Allows() { for _, tc := range testcases { suite.Run(tc.name, func() { tApp := app.NewTestApp() - ctx := tApp.NewContext(true, abci.Header{}) + ctx := tApp.NewContextLegacy(true, abci.Header{}) tApp.InitializeFromGenesisStates(tc.genState...) suite.Equal( diff --git a/x/committee/keeper/committee_test.go b/x/committee/keeper/committee_test.go index dca7454c79..47e0434211 100644 --- a/x/committee/keeper/committee_test.go +++ b/x/committee/keeper/committee_test.go @@ -165,7 +165,7 @@ package keeper_test // for _, tc := range testcases { // suite.Run(tc.name, func() { // tApp := app.NewTestApp() -// ctx := tApp.NewContext(true, abci.Header{}) +// ctx := tApp.NewContextLegacy(true, abci.Header{}) // tApp.InitializeFromGenesisStates() // com := types.NewMemberCommittee( // 12, diff --git a/x/committee/keeper/grpc_query.go b/x/committee/keeper/grpc_query.go index 0ef0bb4547..2715cc3c3a 100644 --- a/x/committee/keeper/grpc_query.go +++ b/x/committee/keeper/grpc_query.go @@ -6,7 +6,7 @@ import ( "google.golang.org/grpc/codes" "google.golang.org/grpc/status" - "github.com/cosmos/cosmos-sdk/store/prefix" + "cosmossdk.io/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/query" diff --git a/x/committee/keeper/integration_test.go b/x/committee/keeper/integration_test.go index 75c04a0cb7..a59a1427fe 100644 --- a/x/committee/keeper/integration_test.go +++ b/x/committee/keeper/integration_test.go @@ -5,7 +5,6 @@ import ( "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" "github.com/kava-labs/kava/app" @@ -25,7 +24,7 @@ func getProposalVoteMap(k keeper.Keeper, ctx sdk.Context) map[uint64]([]types.Vo return proposalVoteMap } -func (suite *keeperTestSuite) getAccount(addr sdk.AccAddress) authtypes.AccountI { +func (suite *keeperTestSuite) getAccount(addr sdk.AccAddress) sdk.AccountI { ak := suite.App.GetAccountKeeper() return ak.GetAccount(suite.Ctx, addr) } diff --git a/x/committee/keeper/keeper.go b/x/committee/keeper/keeper.go index 703a90bea3..b3eb68b4cd 100644 --- a/x/committee/keeper/keeper.go +++ b/x/committee/keeper/keeper.go @@ -4,9 +4,9 @@ import ( "time" errorsmod "cosmossdk.io/errors" + "cosmossdk.io/store/prefix" + storetypes "cosmossdk.io/store/types" "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/store/prefix" - storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" @@ -80,7 +80,7 @@ func (k Keeper) DeleteCommittee(ctx sdk.Context, committeeID uint64) { // IterateCommittees provides an iterator over all stored committees. // For each committee, cb will be called. If cb returns true, the iterator will close and stop. func (k Keeper) IterateCommittees(ctx sdk.Context, cb func(committee types.Committee) (stop bool)) { - iterator := sdk.KVStorePrefixIterator(ctx.KVStore(k.storeKey), types.CommitteeKeyPrefix) + iterator := storetypes.KVStorePrefixIterator(ctx.KVStore(k.storeKey), types.CommitteeKeyPrefix) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { @@ -187,7 +187,7 @@ func (k Keeper) DeleteProposal(ctx sdk.Context, proposalID uint64) { // IterateProposals provides an iterator over all stored proposals. // For each proposal, cb will be called. If cb returns true, the iterator will close and stop. func (k Keeper) IterateProposals(ctx sdk.Context, cb func(proposal types.Proposal) (stop bool)) { - iterator := sdk.KVStorePrefixIterator(ctx.KVStore(k.storeKey), types.ProposalKeyPrefix) + iterator := storetypes.KVStorePrefixIterator(ctx.KVStore(k.storeKey), types.ProposalKeyPrefix) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { @@ -262,7 +262,7 @@ func (k Keeper) DeleteVote(ctx sdk.Context, proposalID uint64, voter sdk.AccAddr // IterateVotes provides an iterator over all stored votes. // For each vote, cb will be called. If cb returns true, the iterator will close and stop. func (k Keeper) IterateVotes(ctx sdk.Context, cb func(vote types.Vote) (stop bool)) { - iterator := sdk.KVStorePrefixIterator(ctx.KVStore(k.storeKey), types.VoteKeyPrefix) + iterator := storetypes.KVStorePrefixIterator(ctx.KVStore(k.storeKey), types.VoteKeyPrefix) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { @@ -288,7 +288,7 @@ func (k Keeper) GetVotes(ctx sdk.Context) []types.Vote { // GetVotesByProposal returns all votes for one proposal. func (k Keeper) GetVotesByProposal(ctx sdk.Context, proposalID uint64) []types.Vote { results := []types.Vote{} - iterator := sdk.KVStorePrefixIterator(ctx.KVStore(k.storeKey), append(types.VoteKeyPrefix, types.GetKeyFromID(proposalID)...)) + iterator := storetypes.KVStorePrefixIterator(ctx.KVStore(k.storeKey), append(types.VoteKeyPrefix, types.GetKeyFromID(proposalID)...)) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { diff --git a/x/committee/keeper/msg_server_test.go b/x/committee/keeper/msg_server_test.go index f0141ca604..884f1a0f5e 100644 --- a/x/committee/keeper/msg_server_test.go +++ b/x/committee/keeper/msg_server_test.go @@ -7,10 +7,10 @@ import ( "github.com/stretchr/testify/suite" sdkmath "cosmossdk.io/math" + upgradetypes "cosmossdk.io/x/upgrade/types" tmproto "github.com/cometbft/cometbft/proto/tendermint/types" sdk "github.com/cosmos/cosmos-sdk/types" proposal "github.com/cosmos/cosmos-sdk/x/params/types/proposal" - upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" "github.com/kava-labs/kava/app" "github.com/kava-labs/kava/x/committee/keeper" @@ -50,7 +50,7 @@ func (suite *MsgServerTestSuite) SetupTest() { "This committee is for testing.", suite.addresses[:3], []types.Permission{&types.GodPermission{}}, - sdk.MustNewDecFromStr("0.5"), + sdkmath.LegacyMustNewDecFromStr("0.5"), time.Hour*24*7, types.TALLY_OPTION_FIRST_PAST_THE_POST, ) @@ -69,7 +69,7 @@ func (suite *MsgServerTestSuite) SetupTest() { // TODO: not used? // NewDistributionGenesisWithPool(suite.communityPoolAmt), ) - suite.ctx = suite.app.NewContext(true, tmproto.Header{Height: 1, Time: firstBlockTime}) + suite.ctx = suite.App.NewContextLegacy(true, tmproto.Header{Height: 1, Time: firstBlockTime}) } func (suite *MsgServerTestSuite) TestSubmitProposalMsg_Valid() { diff --git a/x/committee/keeper/proposal.go b/x/committee/keeper/proposal.go index f9b62e22fb..21d5493b76 100644 --- a/x/committee/keeper/proposal.go +++ b/x/committee/keeper/proposal.go @@ -1,6 +1,7 @@ package keeper import ( + sdkmath "cosmossdk.io/math" "fmt" errorsmod "cosmossdk.io/errors" @@ -163,14 +164,14 @@ func (k Keeper) GetProposalResult(ctx sdk.Context, proposalID uint64, committee // GetMemberCommitteeProposalResult gets the result of a member committee proposal func (k Keeper) GetMemberCommitteeProposalResult(ctx sdk.Context, proposalID uint64, committee types.Committee) bool { currVotes := k.TallyMemberCommitteeVotes(ctx, proposalID) - possibleVotes := sdk.NewDec(int64(len(committee.GetMembers()))) + possibleVotes := sdkmath.LegacyNewDec(int64(len(committee.GetMembers()))) return currVotes.GTE(committee.GetVoteThreshold().Mul(possibleVotes)) // vote threshold requirements } // TallyMemberCommitteeVotes returns the polling status of a member committee vote -func (k Keeper) TallyMemberCommitteeVotes(ctx sdk.Context, proposalID uint64) (totalVotes sdk.Dec) { +func (k Keeper) TallyMemberCommitteeVotes(ctx sdk.Context, proposalID uint64) (totalVotes sdkmath.LegacyDec) { votes := k.GetVotesByProposal(ctx, proposalID) - return sdk.NewDec(int64(len(votes))) + return sdkmath.LegacyNewDec(int64(len(votes))) } // GetTokenCommitteeProposalResult gets the result of a token committee proposal @@ -190,28 +191,28 @@ func (k Keeper) GetTokenCommitteeProposalResult(ctx sdk.Context, proposalID uint // required for proposal to pass), and quorum (votes tallied at this percentage). func (k Keeper) TallyTokenCommitteeVotes(ctx sdk.Context, proposalID uint64, tallyDenom string, -) (yesVotes, noVotes, totalVotes, possibleVotes sdk.Dec) { +) (yesVotes, noVotes, totalVotes, possibleVotes sdkmath.LegacyDec) { votes := k.GetVotesByProposal(ctx, proposalID) - yesVotes = sdk.ZeroDec() - noVotes = sdk.ZeroDec() - totalVotes = sdk.ZeroDec() + yesVotes = sdkmath.LegacyZeroDec() + noVotes = sdkmath.LegacyZeroDec() + totalVotes = sdkmath.LegacyZeroDec() for _, vote := range votes { // 1 token = 1 vote acc := k.accountKeeper.GetAccount(ctx, vote.Voter) accNumCoins := k.bankKeeper.GetBalance(ctx, acc.GetAddress(), tallyDenom).Amount // Add votes to counters - totalVotes = totalVotes.Add(sdk.NewDecFromInt(accNumCoins)) + totalVotes = totalVotes.Add(sdkmath.LegacyNewDecFromInt(accNumCoins)) if vote.VoteType == types.VOTE_TYPE_YES { - yesVotes = yesVotes.Add(sdk.NewDecFromInt(accNumCoins)) + yesVotes = yesVotes.Add(sdkmath.LegacyNewDecFromInt(accNumCoins)) } else if vote.VoteType == types.VOTE_TYPE_NO { - noVotes = noVotes.Add(sdk.NewDecFromInt(accNumCoins)) + noVotes = noVotes.Add(sdkmath.LegacyNewDecFromInt(accNumCoins)) } } possibleVotesInt := k.bankKeeper.GetSupply(ctx, tallyDenom).Amount - return yesVotes, noVotes, totalVotes, sdk.NewDecFromInt(possibleVotesInt) + return yesVotes, noVotes, totalVotes, sdkmath.LegacyNewDecFromInt(possibleVotesInt) } func (k Keeper) attemptEnactProposal(ctx sdk.Context, proposal types.Proposal) types.ProposalOutcome { @@ -261,15 +262,15 @@ func (k Keeper) GetProposalTallyResponse(ctx sdk.Context, proposalID uint64) (*t switch com := committee.(type) { case *types.MemberCommittee: currVotes := k.TallyMemberCommitteeVotes(ctx, proposal.ID) - possibleVotes := sdk.NewDec(int64(len(com.Members))) + possibleVotes := sdkmath.LegacyNewDec(int64(len(com.Members))) proposalTally = types.QueryTallyResponse{ ProposalID: proposal.ID, YesVotes: currVotes, - NoVotes: sdk.ZeroDec(), + NoVotes: sdkmath.LegacyZeroDec(), CurrentVotes: currVotes, PossibleVotes: possibleVotes, VoteThreshold: com.VoteThreshold, - Quorum: sdk.ZeroDec(), + Quorum: sdkmath.LegacyZeroDec(), } case *types.TokenCommittee: yesVotes, noVotes, currVotes, possibleVotes := k.TallyTokenCommitteeVotes(ctx, proposal.ID, com.TallyDenom) diff --git a/x/committee/keeper/proposal_test.go b/x/committee/keeper/proposal_test.go index 7fa10db5aa..80da69a3cb 100644 --- a/x/committee/keeper/proposal_test.go +++ b/x/committee/keeper/proposal_test.go @@ -31,7 +31,7 @@ import ( // return app.GenesisState{bep3types.ModuleName: bep3types.ModuleCdc.MustMarshalJSON(genesis)} // } -// func newPricefeedGenState(assets []string, prices []sdk.Dec) app.GenesisState { +// func newPricefeedGenState(assets []string, prices []sdkmath.LegacyDec) app.GenesisState { // if len(assets) != len(prices) { // panic("assets and prices must be the same length") // } @@ -226,9 +226,9 @@ import ( // // Create local testApp because suite doesn't run the SetupTest function for subtests // tApp := app.NewTestApp() // keeper := tApp.GetCommitteeKeeper() -// ctx := tApp.NewContext(true, tmproto.Header{}) +// ctx := tApp.NewContextLegacy(true, tmproto.Header{}) // tApp.InitializeFromGenesisStates( -// newPricefeedGenState([]string{"bnb"}, []sdk.Dec{testutil.D("15.01")}), +// newPricefeedGenState([]string{"bnb"}, []sdkmath.LegacyDec{testutil.D("15.01")}), // newCDPGenesisState(testCDPParams), // ) // // Cast BaseCommittee to MemberCommittee (if required) to meet Committee interface requirement @@ -269,7 +269,7 @@ func (suite *keeperTestSuite) TestAddVote() { testutil.D("0.4"), time.Hour*24*7, types.TALLY_OPTION_FIRST_PAST_THE_POST, - sdk.Dec{}, + sdkmath.LegacyDec{}, "hard", ) nonMemberAddr := suite.Addresses[4] @@ -340,7 +340,7 @@ func (suite *keeperTestSuite) TestAddVote() { // Create local testApp because suite doesn't run the SetupTest function for subtests tApp := app.NewTestApp() keeper := tApp.GetCommitteeKeeper() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: firstBlockTime}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: firstBlockTime}) tApp.InitializeFromGenesisStates() // setup the committee and proposal @@ -378,7 +378,7 @@ func (suite *keeperTestSuite) TestTallyMemberCommitteeVotes() { testcases := []struct { name string votes []types.Vote - expectedVoteCount sdk.Dec + expectedVoteCount sdkmath.LegacyDec }{ { name: "has 0 votes", @@ -408,7 +408,7 @@ func (suite *keeperTestSuite) TestTallyMemberCommitteeVotes() { // Set up test app tApp := app.NewTestApp() keeper := tApp.GetCommitteeKeeper() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: firstBlockTime}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: firstBlockTime}) // Initialize test app with genesis state tApp.InitializeFromGenesisStates( @@ -452,9 +452,9 @@ func (suite *keeperTestSuite) TestTallyTokenCommitteeVotes() { testcases := []struct { name string votes []types.Vote - expectedYesVoteCount sdk.Dec - expectedNoVoteCount sdk.Dec - expectedTotalVoteCount sdk.Dec + expectedYesVoteCount sdkmath.LegacyDec + expectedNoVoteCount sdkmath.LegacyDec + expectedTotalVoteCount sdkmath.LegacyDec }{ { name: "has 0 votes", @@ -468,9 +468,9 @@ func (suite *keeperTestSuite) TestTallyTokenCommitteeVotes() { votes: []types.Vote{ {ProposalID: defaultProposalID, Voter: genAddrs[4], VoteType: types.VOTE_TYPE_YES}, // Token holder }, - expectedYesVoteCount: sdk.NewDec(genCoinCounts[4]), + expectedYesVoteCount: sdkmath.LegacyNewDec(genCoinCounts[4]), expectedNoVoteCount: testutil.D("0"), - expectedTotalVoteCount: sdk.NewDec(genCoinCounts[4]), + expectedTotalVoteCount: sdkmath.LegacyNewDec(genCoinCounts[4]), }, { name: "does not count non-token holder 'Yes' votes", @@ -478,9 +478,9 @@ func (suite *keeperTestSuite) TestTallyTokenCommitteeVotes() { {ProposalID: defaultProposalID, Voter: genAddrs[4], VoteType: types.VOTE_TYPE_YES}, // Token holder {ProposalID: defaultProposalID, Voter: genAddrs[0], VoteType: types.VOTE_TYPE_YES}, // Non-token holder }, - expectedYesVoteCount: sdk.NewDec(genCoinCounts[4]), + expectedYesVoteCount: sdkmath.LegacyNewDec(genCoinCounts[4]), expectedNoVoteCount: testutil.D("0"), - expectedTotalVoteCount: sdk.NewDec(genCoinCounts[4]), + expectedTotalVoteCount: sdkmath.LegacyNewDec(genCoinCounts[4]), }, { name: "counts multiple 'Yes' votes from token holders", @@ -489,9 +489,9 @@ func (suite *keeperTestSuite) TestTallyTokenCommitteeVotes() { {ProposalID: defaultProposalID, Voter: genAddrs[5], VoteType: types.VOTE_TYPE_YES}, // Token holder {ProposalID: defaultProposalID, Voter: genAddrs[6], VoteType: types.VOTE_TYPE_YES}, // Token holder }, - expectedYesVoteCount: sdk.NewDec(genCoinCounts[4] + genCoinCounts[5] + genCoinCounts[6]), + expectedYesVoteCount: sdkmath.LegacyNewDec(genCoinCounts[4] + genCoinCounts[5] + genCoinCounts[6]), expectedNoVoteCount: testutil.D("0"), - expectedTotalVoteCount: sdk.NewDec(genCoinCounts[4] + genCoinCounts[5] + genCoinCounts[6]), + expectedTotalVoteCount: sdkmath.LegacyNewDec(genCoinCounts[4] + genCoinCounts[5] + genCoinCounts[6]), }, { name: "counts token holder 'No' votes", @@ -499,8 +499,8 @@ func (suite *keeperTestSuite) TestTallyTokenCommitteeVotes() { {ProposalID: defaultProposalID, Voter: genAddrs[4], VoteType: types.VOTE_TYPE_NO}, // Token holder }, expectedYesVoteCount: testutil.D("0"), - expectedNoVoteCount: sdk.NewDec(genCoinCounts[4]), - expectedTotalVoteCount: sdk.NewDec(genCoinCounts[4]), + expectedNoVoteCount: sdkmath.LegacyNewDec(genCoinCounts[4]), + expectedTotalVoteCount: sdkmath.LegacyNewDec(genCoinCounts[4]), }, { name: "does not count non-token holder 'No' votes", @@ -509,8 +509,8 @@ func (suite *keeperTestSuite) TestTallyTokenCommitteeVotes() { {ProposalID: defaultProposalID, Voter: genAddrs[0], VoteType: types.VOTE_TYPE_NO}, // Non-token holder }, expectedYesVoteCount: testutil.D("0"), - expectedNoVoteCount: sdk.NewDec(genCoinCounts[4]), - expectedTotalVoteCount: sdk.NewDec(genCoinCounts[4]), + expectedNoVoteCount: sdkmath.LegacyNewDec(genCoinCounts[4]), + expectedTotalVoteCount: sdkmath.LegacyNewDec(genCoinCounts[4]), }, { name: "counts multiple 'No' votes from token holders", @@ -520,8 +520,8 @@ func (suite *keeperTestSuite) TestTallyTokenCommitteeVotes() { {ProposalID: defaultProposalID, Voter: genAddrs[6], VoteType: types.VOTE_TYPE_NO}, // Token holder }, expectedYesVoteCount: testutil.D("0"), - expectedNoVoteCount: sdk.NewDec(genCoinCounts[4] + genCoinCounts[5] + genCoinCounts[6]), - expectedTotalVoteCount: sdk.NewDec(genCoinCounts[4] + genCoinCounts[5] + genCoinCounts[6]), + expectedNoVoteCount: sdkmath.LegacyNewDec(genCoinCounts[4] + genCoinCounts[5] + genCoinCounts[6]), + expectedTotalVoteCount: sdkmath.LegacyNewDec(genCoinCounts[4] + genCoinCounts[5] + genCoinCounts[6]), }, { name: "includes token holder 'Abstain' votes in total vote count", @@ -530,7 +530,7 @@ func (suite *keeperTestSuite) TestTallyTokenCommitteeVotes() { }, expectedYesVoteCount: testutil.D("0"), expectedNoVoteCount: testutil.D("0"), - expectedTotalVoteCount: sdk.NewDec(genCoinCounts[4]), + expectedTotalVoteCount: sdkmath.LegacyNewDec(genCoinCounts[4]), }, } @@ -547,7 +547,7 @@ func (suite *keeperTestSuite) TestTallyTokenCommitteeVotes() { // Set up test app tApp := app.NewTestApp() keeper := tApp.GetCommitteeKeeper() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: firstBlockTime}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: firstBlockTime}) // Initialize test app with genesis state tApp.InitializeFromGenesisStates( @@ -574,7 +574,7 @@ func (suite *keeperTestSuite) TestTallyTokenCommitteeVotes() { // Check that all non-Yes votes are counted according to their weight suite.Equal(tc.expectedTotalVoteCount, currVotes) // Check that possible votes equals the number of members on the committee - suite.Equal(sdk.NewDecFromInt(totalSupply.AmountOf(tokenCom.GetTallyDenom())), possibleVotes) + suite.Equal(sdkmath.LegacyNewDecFromInt(totalSupply.AmountOf(tokenCom.GetTallyDenom())), possibleVotes) } } @@ -624,7 +624,7 @@ func (suite *keeperTestSuite) TestGetMemberCommitteeProposalResult() { // Create local testApp because suite doesn't run the SetupTest function for subtests tApp := app.NewTestApp() keeper := tApp.GetCommitteeKeeper() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: firstBlockTime}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: firstBlockTime}) tApp.InitializeFromGenesisStates( committeeGenState( @@ -751,7 +751,7 @@ func (suite *keeperTestSuite) TestGetTokenCommitteeProposalResult() { // Create local testApp because suite doesn't run the SetupTest function for subtests tApp := app.NewTestApp() keeper := tApp.GetCommitteeKeeper() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: firstBlockTime}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: firstBlockTime}) tApp.InitializeFromGenesisStates( committeeGenState( @@ -790,7 +790,7 @@ func (suite *keeperTestSuite) TestCloseProposal() { tApp := app.NewTestApp() keeper := tApp.GetCommitteeKeeper() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: firstBlockTime}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: firstBlockTime}) tApp.InitializeFromGenesisStates( committeeGenState( @@ -1171,7 +1171,7 @@ var _ types.PubProposal = &UnregisteredPubProposal{} // // Create local testApp because suite doesn't run the SetupTest function for subtests // tApp := app.NewTestApp() // keeper := tApp.GetCommitteeKeeper() -// ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: firstBlockTime}) +// ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: firstBlockTime}) // // Initialize all committees, proposals, and votes via Genesis // tApp.InitializeFromGenesisStates( diff --git a/x/committee/module.go b/x/committee/module.go index f444e18469..4541ec5a23 100644 --- a/x/committee/module.go +++ b/x/committee/module.go @@ -135,12 +135,18 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw func (AppModule) ConsensusVersion() uint64 { return ConsensusVersion } // BeginBlock executes all ABCI BeginBlock logic respective to committee module. -func (am AppModule) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock) { - BeginBlocker(ctx, req, am.keeper) +func (am AppModule) BeginBlock(ctx sdk.Context) error { + BeginBlocker(ctx, am.keeper) + + return nil } // EndBlock executes all ABCI EndBlock logic respective to committee module. It // returns no validator updates. -func (am AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { - return []abci.ValidatorUpdate{} +func (am AppModule) EndBlock(_ sdk.Context) ([]abci.ValidatorUpdate, error) { + return []abci.ValidatorUpdate{}, nil } + +func (AppModule) IsOnePerModuleType() {} + +func (AppModule) IsAppModule() {} diff --git a/x/committee/proposal_handler_test.go b/x/committee/proposal_handler_test.go index 117554c8e7..3920154f74 100644 --- a/x/committee/proposal_handler_test.go +++ b/x/committee/proposal_handler_test.go @@ -146,7 +146,7 @@ func (suite *ProposalHandlerTestSuite) TestProposalHandler_ChangeCommittee() { suite.app = suite.app.InitializeFromGenesisStates( NewCommitteeGenState(suite.app.AppCodec(), suite.testGenesis), ) - suite.ctx = suite.app.NewContext(true, tmproto.Header{Height: 1, Time: testTime}) + suite.ctx = suite.App.NewContextLegacy(true, tmproto.Header{Height: 1, Time: testTime}) handler := committee.NewProposalHandler(suite.keeper) oldProposals := suite.keeper.GetProposalsByCommittee(suite.ctx, tc.proposal.GetNewCommittee().GetID()) @@ -208,7 +208,7 @@ func (suite *ProposalHandlerTestSuite) TestProposalHandler_DeleteCommittee() { suite.app = suite.app.InitializeFromGenesisStates( NewCommitteeGenState(suite.app.AppCodec(), suite.testGenesis), ) - suite.ctx = suite.app.NewContext(true, tmproto.Header{Height: 1, Time: testTime}) + suite.ctx = suite.App.NewContextLegacy(true, tmproto.Header{Height: 1, Time: testTime}) handler := committee.NewProposalHandler(suite.keeper) oldProposals := suite.keeper.GetProposalsByCommittee(suite.ctx, tc.proposal.CommitteeID) diff --git a/x/committee/spec/02_state.md b/x/committee/spec/02_state.md index e21ce5ac77..7edd77bc89 100644 --- a/x/committee/spec/02_state.md +++ b/x/committee/spec/02_state.md @@ -40,8 +40,8 @@ type Committee interface { GetProposalDuration() time.Duration SetProposalDuration(time.Duration) BaseCommittee - GetVoteThreshold() sdk.Dec - SetVoteThreshold(sdk.Dec) BaseCommittee + GetVoteThreshold() sdkmath.LegacyDec + SetVoteThreshold(sdkmath.LegacyDec) BaseCommittee GetTallyOption() TallyOption Validate() error @@ -53,7 +53,7 @@ type BaseCommittee struct { Description string `json:"description" yaml:"description"` Members []sdk.AccAddress `json:"members" yaml:"members"` Permissions []Permission `json:"permissions" yaml:"permissions"` - VoteThreshold sdk.Dec `json:"vote_threshold" yaml:"vote_threshold"` // Smallest percentage that must vote for a proposal to pass + VoteThreshold sdkmath.LegacyDec `json:"vote_threshold" yaml:"vote_threshold"` // Smallest percentage that must vote for a proposal to pass ProposalDuration time.Duration `json:"proposal_duration" yaml:"proposal_duration"` // The length of time a proposal remains active for. Proposals will close earlier if they get enough votes. TallyOption TallyOption `json:"tally_option" yaml:"tally_option"` } @@ -66,7 +66,7 @@ type MemberCommittee struct { // TokenCommittee supports voting on proposals by token holders type TokenCommittee struct { BaseCommittee `json:"base_committee" yaml:"base_committee"` - Quorum sdk.Dec `json:"quorum" yaml:"quorum"` + Quorum sdkmath.LegacyDec `json:"quorum" yaml:"quorum"` TallyDenom string `json:"tally_denom" yaml:"tally_denom"` } ``` diff --git a/x/committee/testutil/suite.go b/x/committee/testutil/suite.go index abc3144164..ed2037559f 100644 --- a/x/committee/testutil/suite.go +++ b/x/committee/testutil/suite.go @@ -1,7 +1,6 @@ package testutil import ( - tmproto "github.com/cometbft/cometbft/proto/tendermint/types" sdk "github.com/cosmos/cosmos-sdk/types" bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" "github.com/stretchr/testify/suite" @@ -30,7 +29,7 @@ func (suite *Suite) SetupTest() { suite.App = app.NewTestApp() suite.Keeper = suite.App.GetCommitteeKeeper() suite.BankKeeper = suite.App.GetBankKeeper() - suite.Ctx = suite.App.NewContext(true, tmproto.Header{}) + suite.Ctx = suite.App.NewContextLegacy(true) _, accAddresses := app.GeneratePrivKeyAddressPairs(10) suite.Addresses = accAddresses diff --git a/x/committee/testutil/types.go b/x/committee/testutil/types.go index ec5c409c5b..af0c066d2b 100644 --- a/x/committee/testutil/types.go +++ b/x/committee/testutil/types.go @@ -12,7 +12,7 @@ import ( // Avoid cluttering test cases with long function names func I(in int64) sdkmath.Int { return sdkmath.NewInt(in) } -func D(str string) sdk.Dec { return sdk.MustNewDecFromStr(str) } +func D(str string) sdkmath.LegacyDec { return sdkmath.LegacyMustNewDecFromStr(str) } func C(denom string, amount int64) sdk.Coin { return sdk.NewInt64Coin(denom, amount) } func Cs(coins ...sdk.Coin) sdk.Coins { return sdk.NewCoins(coins...) } diff --git a/x/committee/types/codec.go b/x/committee/types/codec.go index 753bd01111..f0088fdda0 100644 --- a/x/committee/types/codec.go +++ b/x/committee/types/codec.go @@ -1,18 +1,16 @@ package types import ( + upgradetypes "cosmossdk.io/x/upgrade/types" "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/codec/legacy" "github.com/cosmos/cosmos-sdk/codec/types" cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/msgservice" - authzcodec "github.com/cosmos/cosmos-sdk/x/authz/codec" distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" - govcodec "github.com/cosmos/cosmos-sdk/x/gov/codec" govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" proposaltypes "github.com/cosmos/cosmos-sdk/x/params/types/proposal" - upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" communitytypes "github.com/kava-labs/kava/x/community/types" kavadisttypes "github.com/kava-labs/kava/x/kavadist/types" ) @@ -36,18 +34,26 @@ func init() { // Register all Amino interfaces and concrete types on the authz Amino codec so that this can later be // used to properly serialize MsgGrant and MsgExec instances - RegisterLegacyAminoCodec(authzcodec.Amino) + RegisterLegacyAminoCodec(codec.NewLegacyAmino()) // CommitteeChange/Delete proposals along with Permission types are // registered on gov's ModuleCdc - RegisterLegacyAminoCodec(govcodec.Amino) + // TODO(boodyvo): find a current usage pattern + RegisterLegacyAminoCodec(codec.NewLegacyAmino()) // Register external module pubproposal types. Ideally these would be registered within the modules' types pkg init function. // However registration happens here as a work-around. + + // Deprecated: Do not use. As of the Cosmos SDK release v0.47.x, there is no + // longer a need for an explicit CommunityPoolSpendProposal. To spend community + // pool funds, a simple MsgCommunityPoolSpend can be invoked from the x/gov + // module via a v1 governance proposal RegisterProposalTypeCodec(distrtypes.CommunityPoolSpendProposal{}, "cosmos-sdk/CommunityPoolSpendProposal") RegisterProposalTypeCodec(proposaltypes.ParameterChangeProposal{}, "cosmos-sdk/ParameterChangeProposal") RegisterProposalTypeCodec(govv1beta1.TextProposal{}, "cosmos-sdk/TextProposal") + // Deprecated: This legacy proposal is deprecated in favor of Msg-based gov proposals, see MsgSoftwareUpgrade. RegisterProposalTypeCodec(upgradetypes.SoftwareUpgradeProposal{}, "cosmos-sdk/SoftwareUpgradeProposal") + // Deprecated: This legacy proposal is deprecated in favor of Msg-based gov proposals, see MsgCancelUpgrade. RegisterProposalTypeCodec(upgradetypes.CancelSoftwareUpgradeProposal{}, "cosmos-sdk/CancelSoftwareUpgradeProposal") RegisterProposalTypeCodec(communitytypes.CommunityCDPRepayDebtProposal{}, "kava/CommunityCDPRepayDebtProposal") RegisterProposalTypeCodec(communitytypes.CommunityCDPWithdrawCollateralProposal{}, "kava/CommunityCDPWithdrawCollateralProposal") diff --git a/x/committee/types/committee.go b/x/committee/types/committee.go index 358b6b0ac9..7cc5cb08f4 100644 --- a/x/committee/types/committee.go +++ b/x/committee/types/committee.go @@ -1,6 +1,7 @@ package types import ( + sdkmath "cosmossdk.io/math" fmt "fmt" "time" @@ -52,8 +53,8 @@ type Committee interface { GetProposalDuration() time.Duration SetProposalDuration(time.Duration) - GetVoteThreshold() sdk.Dec - SetVoteThreshold(sdk.Dec) + GetVoteThreshold() sdkmath.LegacyDec + SetVoteThreshold(sdkmath.LegacyDec) GetTallyOption() TallyOption Validate() error @@ -151,10 +152,10 @@ func (c BaseCommittee) String() string { } // GetVoteThreshold is a getter for committee VoteThreshold -func (c BaseCommittee) GetVoteThreshold() sdk.Dec { return c.VoteThreshold } +func (c BaseCommittee) GetVoteThreshold() sdkmath.LegacyDec { return c.VoteThreshold } // SetVoteThreshold is a setter for committee VoteThreshold -func (c *BaseCommittee) SetVoteThreshold(voteThreshold sdk.Dec) { +func (c *BaseCommittee) SetVoteThreshold(voteThreshold sdkmath.LegacyDec) { c.VoteThreshold = voteThreshold } @@ -220,7 +221,7 @@ func (c BaseCommittee) Validate() error { } // threshold must be in the range [0, 1] - if c.VoteThreshold.IsNil() || c.VoteThreshold.LTE(sdk.ZeroDec()) || c.VoteThreshold.GT(sdk.NewDec(1)) { + if c.VoteThreshold.IsNil() || c.VoteThreshold.LTE(sdkmath.LegacyZeroDec()) || c.VoteThreshold.GT(sdkmath.LegacyNewDec(1)) { return fmt.Errorf("invalid threshold: %s", c.VoteThreshold) } @@ -233,7 +234,7 @@ func (c BaseCommittee) Validate() error { // NewMemberCommittee instantiates a new instance of MemberCommittee func NewMemberCommittee(id uint64, description string, members []sdk.AccAddress, permissions []Permission, - threshold sdk.Dec, duration time.Duration, tallyOption TallyOption, + threshold sdkmath.LegacyDec, duration time.Duration, tallyOption TallyOption, ) (*MemberCommittee, error) { permissionsAny, err := PackPermissions(permissions) if err != nil { @@ -254,7 +255,7 @@ func NewMemberCommittee(id uint64, description string, members []sdk.AccAddress, // MustNewMemberCommittee instantiates a new instance of MemberCommittee and panics on error func MustNewMemberCommittee(id uint64, description string, members []sdk.AccAddress, permissions []Permission, - threshold sdk.Dec, duration time.Duration, tallyOption TallyOption, + threshold sdkmath.LegacyDec, duration time.Duration, tallyOption TallyOption, ) *MemberCommittee { committee, err := NewMemberCommittee(id, description, members, permissions, threshold, duration, tallyOption) if err != nil { @@ -268,7 +269,7 @@ func (c MemberCommittee) GetType() string { return MemberCommitteeType } // NewTokenCommittee instantiates a new instance of TokenCommittee func NewTokenCommittee(id uint64, description string, members []sdk.AccAddress, permissions []Permission, - threshold sdk.Dec, duration time.Duration, tallyOption TallyOption, quorum sdk.Dec, tallyDenom string, + threshold sdkmath.LegacyDec, duration time.Duration, tallyOption TallyOption, quorum sdkmath.LegacyDec, tallyDenom string, ) (*TokenCommittee, error) { permissionsAny, err := PackPermissions(permissions) if err != nil { @@ -291,7 +292,7 @@ func NewTokenCommittee(id uint64, description string, members []sdk.AccAddress, // MustNewTokenCommittee instantiates a new instance of TokenCommittee and panics on error func MustNewTokenCommittee(id uint64, description string, members []sdk.AccAddress, permissions []Permission, - threshold sdk.Dec, duration time.Duration, tallyOption TallyOption, quorum sdk.Dec, tallyDenom string, + threshold sdkmath.LegacyDec, duration time.Duration, tallyOption TallyOption, quorum sdkmath.LegacyDec, tallyDenom string, ) *TokenCommittee { committee, err := NewTokenCommittee(id, description, members, permissions, threshold, duration, tallyOption, quorum, tallyDenom) if err != nil { @@ -304,7 +305,7 @@ func MustNewTokenCommittee(id uint64, description string, members []sdk.AccAddre func (c TokenCommittee) GetType() string { return TokenCommitteeType } // GetQuorum returns the quorum of the committee -func (c TokenCommittee) GetQuorum() sdk.Dec { return c.Quorum } +func (c TokenCommittee) GetQuorum() sdkmath.LegacyDec { return c.Quorum } // GetTallyDenom returns the tally denom of the committee func (c TokenCommittee) GetTallyDenom() string { return c.TallyDenom } @@ -320,7 +321,7 @@ func (c TokenCommittee) Validate() error { return err } - if c.Quorum.IsNil() || c.Quorum.IsNegative() || c.Quorum.GT(sdk.NewDec(1)) { + if c.Quorum.IsNil() || c.Quorum.IsNegative() || c.Quorum.GT(sdkmath.LegacyNewDec(1)) { return fmt.Errorf("invalid quorum: %s", c.Quorum) } diff --git a/x/committee/types/committee.pb.go b/x/committee/types/committee.pb.go index 12e025362f..00a8ffb549 100644 --- a/x/committee/types/committee.pb.go +++ b/x/committee/types/committee.pb.go @@ -4,6 +4,7 @@ package types import ( + cosmossdk_io_math "cosmossdk.io/math" fmt "fmt" _ "github.com/cosmos/cosmos-proto" types "github.com/cosmos/cosmos-sdk/codec/types" @@ -69,7 +70,7 @@ type BaseCommittee struct { Members []github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,3,rep,name=members,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"members,omitempty"` Permissions []*types.Any `protobuf:"bytes,4,rep,name=permissions,proto3" json:"permissions,omitempty"` // Smallest percentage that must vote for a proposal to pass - VoteThreshold github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,5,opt,name=vote_threshold,json=voteThreshold,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"vote_threshold"` + VoteThreshold cosmossdk_io_math.LegacyDec `protobuf:"bytes,5,opt,name=vote_threshold,json=voteThreshold,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"vote_threshold"` // The length of time a proposal remains active for. Proposals will close earlier if they get enough votes. ProposalDuration time.Duration `protobuf:"bytes,6,opt,name=proposal_duration,json=proposalDuration,proto3,stdduration" json:"proposal_duration"` TallyOption TallyOption `protobuf:"varint,7,opt,name=tally_option,json=tallyOption,proto3,enum=kava.committee.v1beta1.TallyOption" json:"tally_option,omitempty"` @@ -147,8 +148,8 @@ var xxx_messageInfo_MemberCommittee proto.InternalMessageInfo // TokenCommittee supports voting on proposals by token holders type TokenCommittee struct { *BaseCommittee `protobuf:"bytes,1,opt,name=base_committee,json=baseCommittee,proto3,embedded=base_committee" json:"base_committee,omitempty"` - Quorum github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=quorum,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"quorum"` - TallyDenom string `protobuf:"bytes,3,opt,name=tally_denom,json=tallyDenom,proto3" json:"tally_denom,omitempty"` + Quorum cosmossdk_io_math.LegacyDec `protobuf:"bytes,2,opt,name=quorum,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"quorum"` + TallyDenom string `protobuf:"bytes,3,opt,name=tally_denom,json=tallyDenom,proto3" json:"tally_denom,omitempty"` } func (m *TokenCommittee) Reset() { *m = TokenCommittee{} } @@ -195,48 +196,49 @@ func init() { } var fileDescriptor_a2549fd9d70ca349 = []byte{ - // 649 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x54, 0xcd, 0x6e, 0xd3, 0x40, - 0x10, 0xb6, 0x93, 0x90, 0xd2, 0x75, 0x1b, 0xd2, 0xa5, 0x54, 0x4e, 0x85, 0x6c, 0xab, 0x40, 0x15, - 0x81, 0x62, 0xab, 0xe1, 0xc6, 0x2d, 0xae, 0x13, 0xd5,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x9b, 0xc0, 0x9c, - 0xcd, 0x04, 0xf6, 0x62, 0x26, 0xb0, 0x97, 0x33, 0x81, 0x7d, 0x7f, 0x25, 0x30, 0x17, 0x57, 0x02, - 0xf3, 0xf9, 0x4a, 0x60, 0x5e, 0x3f, 0xcb, 0xa8, 0x0e, 0x67, 0x5a, 0x1b, 0xd8, 0x0e, 0x89, 0x4e, - 0xca, 0x71, 0xe6, 0x6f, 0x15, 0xc9, 0x77, 0x8a, 0x91, 0x4b, 0x9f, 0xff, 0x0c, 0x00, 0x00, 0xff, - 0xff, 0x0d, 0x0b, 0x28, 0x7d, 0xcc, 0x04, 0x00, 0x00, + // 667 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x54, 0xcd, 0x6e, 0xd3, 0x4c, + 0x14, 0xb5, 0x93, 0x7c, 0xe9, 0xd7, 0x71, 0x1b, 0x52, 0x53, 0x2a, 0xa7, 0x20, 0xdb, 0x6a, 0x01, + 0x45, 0xa0, 0xd8, 0x6a, 0xd8, 0xc1, 0x2a, 0xae, 0x13, 0xd5, 0x28, 0x34, 0x91, 0x63, 0x16, 0xb0, + 0xb1, 0xfc, 0x33, 0x24, 0x56, 0xe2, 0x4c, 0xf0, 0x4c, 0xaa, 0xe6, 0x0d, 0x58, 0xb2, 0xec, 0x12, + 0x89, 0x57, 0xe8, 0x43, 0x54, 0x5d, 0x55, 0x48, 0x48, 0x88, 0x45, 0x80, 0x74, 0xcf, 0x03, 0xb0, + 0x42, 0xfe, 0x6b, 0x52, 0x08, 0x12, 0x1b, 0x56, 0x9e, 0x39, 0xf7, 0x9c, 0xb9, 0x73, 0xee, 0xbd, + 0x63, 0x70, 0xbf, 0x6f, 0x1d, 0x59, 0xb2, 0x83, 0x7c, 0xdf, 0x23, 0x04, 0x42, 0xf9, 0x68, 0xcf, + 0x86, 0xc4, 0xda, 0x9b, 0x23, 0xd2, 0x28, 0x40, 0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m *BaseCommittee) Marshal() (dAtA []byte, err error) { diff --git a/x/committee/types/committee_test.go b/x/committee/types/committee_test.go index f467cac5e1..42b2a3d61d 100644 --- a/x/committee/types/committee_test.go +++ b/x/committee/types/committee_test.go @@ -132,7 +132,7 @@ func TestBaseCommittee(t *testing.T) { "This base committee is for testing.", addresses[:3], []types.Permission{&types.GodPermission{}}, - sdk.Dec{}, + sdkmath.LegacyDec{}, time.Hour*24*7, types.TALLY_OPTION_FIRST_PAST_THE_POST, ) @@ -289,7 +289,7 @@ func TestTokenCommittee(t *testing.T) { testutil.D("0.667"), time.Hour*24*7, types.TALLY_OPTION_FIRST_PAST_THE_POST, - sdk.Dec{}, + sdkmath.LegacyDec{}, "hard", ) }, diff --git a/x/committee/types/expected_keepers.go b/x/committee/types/expected_keepers.go index d4352e6a0f..34d6d8793b 100644 --- a/x/committee/types/expected_keepers.go +++ b/x/committee/types/expected_keepers.go @@ -1,8 +1,8 @@ package types import ( + "context" sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" ) @@ -12,11 +12,11 @@ type ParamKeeper interface { // AccountKeeper defines the expected account keeper type AccountKeeper interface { - GetAccount(sdk.Context, sdk.AccAddress) authtypes.AccountI + GetAccount(context.Context, sdk.AccAddress) sdk.AccountI } // BankKeeper defines the expected bank keeper interface type BankKeeper interface { - GetSupply(ctx sdk.Context, denom string) sdk.Coin - GetBalance(ctx sdk.Context, addr sdk.AccAddress, denom string) sdk.Coin + GetSupply(ctx context.Context, denom string) sdk.Coin + GetBalance(ctx context.Context, addr sdk.AccAddress, denom string) sdk.Coin } diff --git a/x/committee/types/genesis_test.go b/x/committee/types/genesis_test.go index 98f6e8e511..78ebbed925 100644 --- a/x/committee/types/genesis_test.go +++ b/x/committee/types/genesis_test.go @@ -53,7 +53,7 @@ func TestGenesisState_Validate(t *testing.T) { testutil.D("0.8"), time.Hour*24*21, types.TALLY_OPTION_DEADLINE, - sdk.MustNewDecFromStr("0.4"), + sdkmath.LegacyMustNewDecFromStr("0.4"), "hard", ), }, diff --git a/x/committee/types/param_permissions_test.go b/x/committee/types/param_permissions_test.go index d425171474..a9343872e1 100644 --- a/x/committee/types/param_permissions_test.go +++ b/x/committee/types/param_permissions_test.go @@ -31,7 +31,7 @@ type ParamsChangeTestSuite struct { func (suite *ParamsChangeTestSuite) SetupTest() { tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) suite.ctx = ctx suite.pk = tApp.GetParamsKeeper() @@ -47,10 +47,10 @@ func (suite *ParamsChangeTestSuite) SetupTest() { { Denom: "bnb", Type: "bnb-a", - LiquidationRatio: sdk.MustNewDecFromStr("2.0"), + LiquidationRatio: sdkmath.LegacyMustNewDecFromStr("2.0"), DebtLimit: sdk.NewCoin("usdx", sdkmath.NewInt(100)), - StabilityFee: sdk.MustNewDecFromStr("1.02"), - LiquidationPenalty: sdk.MustNewDecFromStr("0.05"), + StabilityFee: sdkmath.LegacyMustNewDecFromStr("1.02"), + LiquidationPenalty: sdkmath.LegacyMustNewDecFromStr("0.05"), AuctionSize: sdkmath.NewInt(100), ConversionFactor: sdkmath.NewInt(6), SpotMarketID: "bnb:usd", @@ -60,16 +60,16 @@ func (suite *ParamsChangeTestSuite) SetupTest() { { Denom: "btc", Type: "btc-a", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), + LiquidationRatio: sdkmath.LegacyMustNewDecFromStr("1.5"), DebtLimit: sdk.NewCoin("usdx", sdkmath.NewInt(100)), - StabilityFee: sdk.MustNewDecFromStr("1.01"), - LiquidationPenalty: sdk.MustNewDecFromStr("0.10"), + StabilityFee: sdkmath.LegacyMustNewDecFromStr("1.01"), + LiquidationPenalty: sdkmath.LegacyMustNewDecFromStr("0.10"), AuctionSize: sdkmath.NewInt(1000), ConversionFactor: sdkmath.NewInt(8), SpotMarketID: "btc:usd", LiquidationMarketID: "btc:usd", CheckCollateralizationIndexCount: sdkmath.NewInt(1), - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.12"), + KeeperRewardPercentage: sdkmath.LegacyMustNewDecFromStr("0.12"), }, } suite.cdpCollateralRequirements = []types.SubparamRequirement{ diff --git a/x/committee/types/permissions.go b/x/committee/types/permissions.go index 3e4d6e772d..b71ce617c6 100644 --- a/x/committee/types/permissions.go +++ b/x/committee/types/permissions.go @@ -6,11 +6,11 @@ import ( "reflect" "strings" + upgradetypes "cosmossdk.io/x/upgrade/types" "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" paramsproposal "github.com/cosmos/cosmos-sdk/x/params/types/proposal" - upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" proto "github.com/cosmos/gogoproto/proto" communitytypes "github.com/kava-labs/kava/x/community/types" ) diff --git a/x/committee/types/permissions_test.go b/x/committee/types/permissions_test.go index 2fe4c8a88f..eb71aa3d27 100644 --- a/x/committee/types/permissions_test.go +++ b/x/committee/types/permissions_test.go @@ -91,7 +91,7 @@ func TestCommunityPoolLendWithdrawPermission_Allows(t *testing.T) { proposal: communitytypes.NewCommunityPoolLendWithdrawProposal( "withdraw lend position", "this fake proposal withdraws a lend position for the community pool", - sdk.NewCoins(sdk.NewCoin("ukava", sdk.NewInt(1e10))), + sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(1e10))), ), allowed: true, }, diff --git a/x/committee/types/query.pb.go b/x/committee/types/query.pb.go index 335f8d8fa7..de257088ae 100644 --- a/x/committee/types/query.pb.go +++ b/x/committee/types/query.pb.go @@ -5,10 +5,10 @@ package types import ( context "context" + cosmossdk_io_math "cosmossdk.io/math" fmt "fmt" _ "github.com/cosmos/cosmos-proto" types "github.com/cosmos/cosmos-sdk/codec/types" - github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" query "github.com/cosmos/cosmos-sdk/types/query" _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" @@ -617,13 +617,13 @@ var xxx_messageInfo_QueryTallyRequest proto.InternalMessageInfo // QueryTallyResponse defines the response type for querying x/committee tally. type QueryTallyResponse struct { - ProposalID uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"` - YesVotes github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=yes_votes,json=yesVotes,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"yes_votes"` - NoVotes github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=no_votes,json=noVotes,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"no_votes"` - CurrentVotes github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,4,opt,name=current_votes,json=currentVotes,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"current_votes"` - PossibleVotes github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,5,opt,name=possible_votes,json=possibleVotes,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"possible_votes"` - VoteThreshold github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,6,opt,name=vote_threshold,json=voteThreshold,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"vote_threshold"` - Quorum github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,7,opt,name=quorum,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"quorum"` + ProposalID uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"` + YesVotes cosmossdk_io_math.LegacyDec `protobuf:"bytes,2,opt,name=yes_votes,json=yesVotes,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"yes_votes"` + NoVotes cosmossdk_io_math.LegacyDec `protobuf:"bytes,3,opt,name=no_votes,json=noVotes,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"no_votes"` + CurrentVotes cosmossdk_io_math.LegacyDec `protobuf:"bytes,4,opt,name=current_votes,json=currentVotes,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"current_votes"` + PossibleVotes cosmossdk_io_math.LegacyDec `protobuf:"bytes,5,opt,name=possible_votes,json=possibleVotes,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"possible_votes"` + VoteThreshold cosmossdk_io_math.LegacyDec `protobuf:"bytes,6,opt,name=vote_threshold,json=voteThreshold,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"vote_threshold"` + Quorum cosmossdk_io_math.LegacyDec `protobuf:"bytes,7,opt,name=quorum,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"quorum"` } func (m *QueryTallyResponse) Reset() { *m = QueryTallyResponse{} } @@ -763,82 +763,82 @@ func init() { var fileDescriptor_b81d271efeb6eee5 = []byte{ // 1211 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x96, 0xc1, 0x6f, 0xe3, 0xc4, - 0x17, 0xc7, 0xeb, 0x34, 0xed, 0x26, 0x2f, 0xdb, 0xfe, 0xfa, 0x1b, 0x95, 0x92, 0x86, 0x55, 0xd2, - 0x35, 0xab, 0xa5, 0x5b, 0x88, 0x4d, 0x53, 0x50, 0x05, 0xa2, 0x82, 0x4d, 0xdb, 0x45, 0x11, 0x12, - 0xea, 0x9a, 0xc2, 0x81, 0x95, 0x88, 0x26, 0xf5, 0x6c, 0x6a, 0x35, 0xb1, 0x5d, 0x8f, 0xd3, 0x36, - 0x2a, 0xbd, 0x70, 0x47, 0x5a, 0x09, 0x81, 0xb4, 0x07, 0x24, 0x84, 0x40, 0x42, 0xe2, 0x86, 0xf6, - 0x8f, 0xa8, 0xf6, 0xb4, 0x12, 0x17, 0xc4, 0x21, 0x40, 0x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 0x61, 0x7c, - 0x31, 0x53, 0x9a, 0xd5, 0x38, 0x90, 0x16, 0x02, 0x69, 0xf7, 0xed, 0x76, 0x79, 0xea, 0xf9, 0xb3, - 0x62, 0x5a, 0x2a, 0x18, 0x11, 0x37, 0xf5, 0x5d, 0x78, 0xe9, 0xbc, 0xbe, 0x58, 0x18, 0xdd, 0x86, - 0x9b, 0xd2, 0xac, 0x6a, 0x99, 0x59, 0x65, 0x41, 0x59, 0x4c, 0x1a, 0x19, 0xf9, 0xae, 0x62, 0xaa, - 0x8f, 0xfa, 0xa9, 0x25, 0xda, 0x7d, 0x48, 0x4b, 0x43, 0xe6, 0x19, 0x93, 0xac, 0xe7, 0x25, 0xc1, - 0xb6, 0x3c, 0xc7, 0x75, 0x28, 0x6e, 0xd0, 0x6b, 0x80, 0xed, 0x09, 0xb0, 0x88, 0xaf, 0x00, 0x7b, - 0x08, 0x69, 0x37, 0x7c, 0x29, 0x42, 0x56, 0xd4, 0x2e, 0xce, 0x38, 0xed, 0x9c, 0x44, 0xa8, 0x50, - 0x4e, 0x9e, 0x76, 0x0a, 0x63, 0x46, 0x4f, 0x45, 0x5d, 0x85, 0xd9, 0x3e, 0x4b, 0xce, 0x59, 0x80, - 0x4c, 0x68, 0xd4, 0xc3, 0x84, 0xf0, 0x55, 0xc5, 0x54, 0xbf, 0x4e, 0xf4, 0x6d, 0x51, 0x52, 0x3e, - 0x86, 0x9b, 0x6e, 0xab, 0x56, 0x0d, 0x6d, 0xaf, 0x8c, 0x60, 0xb1, 0xdb, 0x29, 0x64, 0xb6, 0x5a, - 0xb5, 0x50, 0xe4, 0xf9, 0xb3, 0x62, 0x4e, 0x64, 0x7c, 0xdd, 0x39, 0x90, 0x9b, 0x59, 0x77, 0x6c, - 0x9f, 0xd8, 0xbe, 0x91, 0x71, 0x7b, 0xa6, 0x68, 0x0e, 0x12, 0x96, 0x99, 0x4d, 0x04, 0x64, 0xe5, - 0xc9, 0x6e, 0xa7, 0x90, 0xa8, 0x6c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6b, - 0x94, 0xab, 0x1e, 0x45, 0x74, 0x59, 0x1f, 0xaa, 0x4d, 0xb2, 0x59, 0x7c, 0xe5, 0xbf, 0x00, 0x00, - 0x00, 0xff, 0xff, 0xb4, 0xd1, 0x58, 0x0c, 0x8a, 0x0f, 0x00, 0x00, + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x96, 0xcf, 0x6f, 0xe3, 0x44, + 0x14, 0xc7, 0xeb, 0xf4, 0x57, 0x32, 0x69, 0x4b, 0x19, 0x95, 0x92, 0x66, 0x57, 0x49, 0xd7, 0xbb, + 0x82, 0x6e, 0x21, 0x36, 0x4d, 0x41, 0x15, 0x3f, 0x0a, 0xbb, 0x69, 0x0b, 0x04, 0x21, 0xd4, 0xb5, + 0x2a, 0x0e, 0xac, 0x44, 0x34, 0x89, 0x67, 0x53, 0xab, 0x89, 0xc7, 0xf5, 0x38, 0x6d, 0xa3, 0xd2, + 0x0b, 0x77, 0xa4, 0x95, 0x10, 0x48, 0x7b, 0x40, 0x42, 0x08, 0x4e, 0xdc, 0xd0, 0xfe, 0x11, 0xd5, + 0x9e, 0x56, 0xe2, 0x82, 0x38, 0x04, 0x48, 0x11, 0x7f, 0x07, 0xf2, 0xcc, 0x78, 0xe2, 0x26, 0x6d, + 0xed, 0xf4, 0xe6, 0x1f, 0xef, 0x7d, 0xe7, 0x33, 0xef, 0xcd, 0xbc, 0xf7, 0x80, 0xba, 0x87, 0x0e, + 0x90, 0x5e, 0x23, 0xcd, 0xa6, 0xe5, 0x79, 0x18, 0xeb, 0x07, 0x2b, 0x55, 0xec, 0xa1, 0x15, 0x7d, + 0xbf, 0x85, 0xdd, 0xb6, 0xe6, 0xb8, 0xc4, 0x23, 0x70, 0xde, 0xb7, 0xd1, 0xa4, 0x8d, 0x26, 0x6c, + 0xb2, 0xcb, 0x35, 0x42, 0x9b, 0x84, 0xea, 0x55, 0x44, 0x31, 0x77, 0x90, 0xee, 0x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, 0x01, 0x63, + 0xbe, 0x20, 0x5c, 0x8a, 0xd1, 0xe2, 0x39, 0x5d, 0xfc, 0x61, 0x40, 0xdd, 0x62, 0x70, 0x1f, 0xc0, + 0xf5, 0x6b, 0xc1, 0xe9, 0xc7, 0xac, 0xa9, 0x9e, 0xb0, 0x20, 0xb2, 0xde, 0x16, 0x11, 0xc4, 0x70, + 0xdb, 0x8c, 0x08, 0xe2, 0xb9, 0x56, 0x79, 0xfd, 0x20, 0x7a, 0x8c, 0xea, 0x7b, 0x05, 0xa4, 0x64, + 0x31, 0x8d, 0xb8, 0xcd, 0xfd, 0xb5, 0x3b, 0xe2, 0x36, 0x0f, 0xd4, 0xe8, 0xe8, 0x72, 0xe8, 0xa2, + 0xc3, 0x82, 0xc3, 0x7c, 0x4a, 0xe5, 0xd3, 0x7f, 0x72, 0x23, 0xa7, 0xdd, 0x9c, 0xf2, 0xbc, 0x9b, + 0x53, 0xfe, 0xee, 0xe6, 0x94, 0xc7, 0x67, 0xb9, 0x91, 0xe7, 0x67, 0xb9, 0x91, 0x3f, 0xce, 0x72, + 0x23, 0x5f, 0xbc, 0x56, 0xb7, 0xbc, 0xdd, 0x56, 0xd5, 0x5f, 0x9a, 0x69, 0x15, 0x1a, 0xa8, 0x4a, + 0xb9, 0xea, 0x51, 0x48, 0xd7, 0x9f, 0x65, 0x68, 0x75, 0x82, 0x4d, 0xd2, 0xab, 0xff, 0x07, 0x00, + 0x00, 0xff, 0xff, 0x66, 0x8f, 0x73, 0x60, 0x48, 0x0f, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1182,6 +1182,7 @@ func _Query_RawParams_Handler(srv interface{}, ctx context.Context, dec func(int return interceptor(ctx, in, info, handler) } +var Query_serviceDesc = _Query_serviceDesc var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "kava.committee.v1beta1.Query", HandlerType: (*QueryServer)(nil), diff --git a/x/committee/types/tx.pb.go b/x/committee/types/tx.pb.go index 7a3570e39d..800fb79886 100644 --- a/x/committee/types/tx.pb.go +++ b/x/committee/types/tx.pb.go @@ -330,6 +330,7 @@ func _Msg_Vote_Handler(srv interface{}, ctx context.Context, dec func(interface{ return interceptor(ctx, in, info, handler) } +var Msg_serviceDesc = _Msg_serviceDesc var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "kava.committee.v1beta1.Msg", HandlerType: (*MsgServer)(nil), diff --git a/x/community/abci_test.go b/x/community/abci_test.go index c74938bdf7..1e009fd4d6 100644 --- a/x/community/abci_test.go +++ b/x/community/abci_test.go @@ -25,7 +25,7 @@ func TestABCIStakingRewardsArePaidOutOnDisableInflationBlock(t *testing.T) { // a block that runs after addition of the disable inflation code on chain // but before the disable inflation time initialBlockTime := time.Now() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: initialBlockTime}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: initialBlockTime}) poolAcc := accountKeeper.GetModuleAccount(ctx, types.ModuleName) feeCollectorAcc := accountKeeper.GetModuleAccount(ctx, authtypes.FeeCollectorName) @@ -57,7 +57,7 @@ func TestABCIStakingRewardsArePaidOutOnDisableInflationBlock(t *testing.T) { // new block when disable inflation runs, 10 seconds from initial block for easy math blockTime := disableTime.Add(1 * time.Second) - ctx = tApp.NewContext(true, tmproto.Header{Height: ctx.BlockHeight() + 1, Time: blockTime}) + ctx = tApp.NewContextLegacy(true, tmproto.Header{Height: ctx.BlockHeight() + 1, Time: blockTime}) // run the next block community.BeginBlocker(ctx, keeper) diff --git a/x/community/client/cli/tx.go b/x/community/client/cli/tx.go index a140c12c79..159bba7b57 100644 --- a/x/community/client/cli/tx.go +++ b/x/community/client/cli/tx.go @@ -2,10 +2,12 @@ package cli import ( "fmt" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" "strings" "github.com/spf13/cobra" + "cosmossdk.io/errors" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/client/tx" @@ -120,7 +122,14 @@ Where proposal.json contains: if err != nil { return err } - if err := msg.ValidateBasic(); err != nil { + contentProposal := msg.GetContent() + if contentProposal == nil { + return errors.Wrap(govtypes.ErrInvalidProposalContent, "missing content") + } + if !govv1beta1.IsValidProposalType(contentProposal.ProposalType()) { + return errors.Wrap(govtypes.ErrInvalidProposalType, contentProposal.ProposalType()) + } + if err := contentProposal.ValidateBasic(); err != nil { return err } @@ -180,7 +189,15 @@ Where proposal.json contains: if err != nil { return err } - if err := msg.ValidateBasic(); err != nil { + + contentProposal := msg.GetContent() + if contentProposal == nil { + return errors.Wrap(govtypes.ErrInvalidProposalContent, "missing content") + } + if !govv1beta1.IsValidProposalType(contentProposal.ProposalType()) { + return errors.Wrap(govtypes.ErrInvalidProposalType, contentProposal.ProposalType()) + } + if err := contentProposal.ValidateBasic(); err != nil { return err } diff --git a/x/community/genesis_test.go b/x/community/genesis_test.go index 1a8a258969..90482e7103 100644 --- a/x/community/genesis_test.go +++ b/x/community/genesis_test.go @@ -7,8 +7,6 @@ import ( "github.com/stretchr/testify/suite" sdkmath "cosmossdk.io/math" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - "github.com/kava-labs/kava/x/community" "github.com/kava-labs/kava/x/community/testutil" "github.com/kava-labs/kava/x/community/types" @@ -49,7 +47,7 @@ func (suite *genesisTestSuite) TestInitGenesis() { // check for module account this way b/c GetModuleAccount creates if not existing. acc := accountKeeper.GetAccount(suite.Ctx, suite.MaccAddress) suite.NotNil(acc) - _, ok := acc.(authtypes.ModuleAccountI) + _, ok := acc.(sdk.ModuleAccountI) suite.True(ok) keeper := suite.App.GetCommunityKeeper() diff --git a/x/community/keeper/disable_inflation.go b/x/community/keeper/disable_inflation.go index 5ecbe8629b..c522b6e994 100644 --- a/x/community/keeper/disable_inflation.go +++ b/x/community/keeper/disable_inflation.go @@ -1,6 +1,7 @@ package keeper import ( + sdkmath "cosmossdk.io/math" "time" sdk "github.com/cosmos/cosmos-sdk/types" @@ -56,8 +57,8 @@ func (k Keeper) disableInflation(ctx sdk.Context) { // set x/min inflation to 0 mintParams := k.mintKeeper.GetParams(ctx) - mintParams.InflationMin = sdk.ZeroDec() - mintParams.InflationMax = sdk.ZeroDec() + mintParams.InflationMin = sdkmath.LegacyZeroDec() + mintParams.InflationMax = sdkmath.LegacyZeroDec() if err := k.mintKeeper.SetParams(ctx, mintParams); err != nil { panic(err) } @@ -75,7 +76,7 @@ func (k Keeper) disableCommunityTax(ctx sdk.Context) { logger := k.Logger(ctx) distrParams := k.distrKeeper.GetParams(ctx) - distrParams.CommunityTax = sdk.ZeroDec() + distrParams.CommunityTax = sdkmath.LegacyZeroDec() if err := k.distrKeeper.SetParams(ctx, distrParams); err != nil { panic(err) } diff --git a/x/community/keeper/grpc_query.go b/x/community/keeper/grpc_query.go index 44d58e6c6c..f701efde78 100644 --- a/x/community/keeper/grpc_query.go +++ b/x/community/keeper/grpc_query.go @@ -76,14 +76,26 @@ func (s queryServer) AnnualizedRewards( // this method adds both sources together so it is accurate in both cases. params := s.keeper.mustGetParams(ctx) - bondDenom := s.keeper.stakingKeeper.BondDenom(ctx) + bondDenom, err := s.keeper.stakingKeeper.BondDenom(ctx) + if err != nil { + return nil, err + } totalSupply := s.keeper.bankKeeper.GetSupply(ctx, bondDenom).Amount - totalBonded := s.keeper.stakingKeeper.TotalBondedTokens(ctx) + totalBonded, err := s.keeper.stakingKeeper.TotalBondedTokens(ctx) + if err != nil { + return nil, err + } + rewardsPerSecond := params.StakingRewardsPerSecond - // need to convert these from sdk.Dec to sdkmath.LegacyDec + // need to convert these from sdkmath.LegacyDec to sdkmath.LegacyDec inflationRate := convertDecToLegacyDec(s.keeper.mintKeeper.GetMinter(ctx).Inflation) - communityTax := convertDecToLegacyDec(s.keeper.distrKeeper.GetCommunityTax(ctx)) + tax, err := s.keeper.distrKeeper.GetCommunityTax(ctx) + if err != nil { + return nil, err + } + + communityTax := convertDecToLegacyDec(tax) return &types.QueryAnnualizedRewardsResponse{ StakingRewards: CalculateStakingAnnualPercentage(totalSupply, totalBonded, inflationRate, communityTax, rewardsPerSecond), @@ -91,9 +103,9 @@ func (s queryServer) AnnualizedRewards( } // convertDecToLegacyDec is a helper method for converting between new and old Dec types -// current version of cosmos-sdk in this repo uses sdk.Dec +// current version of cosmos-sdk in this repo uses sdkmath.LegacyDec // this module uses sdkmath.LegacyDec in its parameters // TODO: remove me after upgrade to cosmos-sdk v50 (LegacyDec is everywhere) -func convertDecToLegacyDec(in sdk.Dec) sdkmath.LegacyDec { - return sdkmath.LegacyNewDecFromBigIntWithPrec(in.BigInt(), sdk.Precision) +func convertDecToLegacyDec(in sdkmath.LegacyDec) sdkmath.LegacyDec { + return sdkmath.LegacyNewDecFromBigIntWithPrec(in.BigInt(), sdkmath.LegacyPrecision) } diff --git a/x/community/keeper/grpc_query_test.go b/x/community/keeper/grpc_query_test.go index 123e01a720..4a4a5c9e28 100644 --- a/x/community/keeper/grpc_query_test.go +++ b/x/community/keeper/grpc_query_test.go @@ -172,55 +172,55 @@ func (suite *grpcQueryTestSuite) TestGrpcQueryAnnualizedRewards() { bondedTokens := sdkmath.NewInt(1e6) testCases := []struct { name string - bondedRatio sdk.Dec - inflation sdk.Dec + bondedRatio sdkmath.LegacyDec + inflation sdkmath.LegacyDec rewardsPerSec sdkmath.LegacyDec - communityTax sdk.Dec + communityTax sdkmath.LegacyDec expectedRate sdkmath.LegacyDec }{ { name: "sanity check: no inflation, no rewards => 0%", - bondedRatio: sdk.MustNewDecFromStr("0.3456"), - inflation: sdk.ZeroDec(), + bondedRatio: sdkmath.LegacyMustNewDecFromStr("0.3456"), + inflation: sdkmath.LegacyZeroDec(), rewardsPerSec: sdkmath.LegacyZeroDec(), expectedRate: sdkmath.LegacyZeroDec(), }, { name: "inflation sanity check: 100% inflation, 100% bonded => 100%", - bondedRatio: sdk.OneDec(), - inflation: sdk.OneDec(), + bondedRatio: sdkmath.LegacyOneDec(), + inflation: sdkmath.LegacyOneDec(), rewardsPerSec: sdkmath.LegacyZeroDec(), expectedRate: sdkmath.LegacyOneDec(), }, { name: "inflation sanity check: 100% community tax => 0%", - bondedRatio: sdk.OneDec(), - inflation: sdk.OneDec(), - communityTax: sdk.OneDec(), + bondedRatio: sdkmath.LegacyOneDec(), + inflation: sdkmath.LegacyOneDec(), + communityTax: sdkmath.LegacyOneDec(), rewardsPerSec: sdkmath.LegacyZeroDec(), expectedRate: sdkmath.LegacyZeroDec(), }, { name: "rewards per second sanity check: (totalBonded/SecondsPerYear) rps => 100%", - bondedRatio: sdk.OneDec(), // bonded tokens are constant in this test. ratio has no affect. - inflation: sdk.ZeroDec(), + bondedRatio: sdkmath.LegacyOneDec(), // bonded tokens are constant in this test. ratio has no affect. + inflation: sdkmath.LegacyZeroDec(), rewardsPerSec: sdkmath.LegacyNewDecFromInt(bondedTokens).QuoInt(sdkmath.NewInt(keeper.SecondsPerYear)), // expect ~100% expectedRate: sdkmath.LegacyMustNewDecFromStr("0.999999999999999984"), }, { name: "inflation enabled: realistic example", - bondedRatio: sdk.MustNewDecFromStr("0.148"), - inflation: sdk.MustNewDecFromStr("0.595"), - communityTax: sdk.MustNewDecFromStr("0.9495"), + bondedRatio: sdkmath.LegacyMustNewDecFromStr("0.148"), + inflation: sdkmath.LegacyMustNewDecFromStr("0.595"), + communityTax: sdkmath.LegacyMustNewDecFromStr("0.9495"), rewardsPerSec: sdkmath.LegacyZeroDec(), // expect ~20.23% expectedRate: sdkmath.LegacyMustNewDecFromStr("0.203023625910000000"), }, { name: "inflation disabled: simple example", - bondedRatio: sdk.OneDec(), // bonded tokens are constant in this test. ratio has no affect. - inflation: sdk.ZeroDec(), + bondedRatio: sdkmath.LegacyOneDec(), // bonded tokens are constant in this test. ratio has no affect. + inflation: sdkmath.LegacyZeroDec(), rewardsPerSec: sdkmath.LegacyMustNewDecFromStr("0.01"), // 1e6 bonded tokens => seconds per year / bonded tokens = 31.536 // expect 31.536% @@ -239,7 +239,7 @@ func (suite *grpcQueryTestSuite) TestGrpcQueryAnnualizedRewards() { mk.SetMinter(suite.Ctx, minter) // set community tax - communityTax := sdk.ZeroDec() + communityTax := sdkmath.LegacyZeroDec() if !tc.communityTax.IsNil() { communityTax = tc.communityTax } @@ -270,7 +270,7 @@ func (suite *grpcQueryTestSuite) TestGrpcQueryAnnualizedRewards() { // it leverages the fact that there is a constant number of bonded tokens // and adjusts the total supply to make change the bonded ratio. // returns the new total supply of the bond denom -func (suite *grpcQueryTestSuite) adjustBondedRatio(desiredRatio sdk.Dec) sdkmath.Int { +func (suite *grpcQueryTestSuite) adjustBondedRatio(desiredRatio sdkmath.LegacyDec) sdkmath.Int { // from the InitGenesis validator bondedTokens := sdkmath.NewInt(1e6) bondDenom := suite.App.GetStakingKeeper().BondDenom(suite.Ctx) @@ -278,12 +278,12 @@ func (suite *grpcQueryTestSuite) adjustBondedRatio(desiredRatio sdk.Dec) sdkmath // first, burn all non-delegated coins (bonded ratio = 100%) suite.App.DeleteGenesisValidatorCoins(suite.T(), suite.Ctx) - if desiredRatio.Equal(sdk.OneDec()) { + if desiredRatio.Equal(sdkmath.LegacyOneDec()) { return bondedTokens } // mint new tokens to adjust the bond ratio - newTotalSupply := sdk.NewDecFromInt(bondedTokens).Quo(desiredRatio).TruncateInt() + newTotalSupply := sdkmath.LegacyNewDecFromInt(bondedTokens).Quo(desiredRatio).TruncateInt() coinsToMint := newTotalSupply.Sub(bondedTokens) err := suite.App.FundAccount(suite.Ctx, app.RandomAddress(), sdk.NewCoins(sdk.NewCoin(bondDenom, coinsToMint))) suite.Require().NoError(err) diff --git a/x/community/keeper/keeper.go b/x/community/keeper/keeper.go index 585afaca9f..ae1b00a70c 100644 --- a/x/community/keeper/keeper.go +++ b/x/community/keeper/keeper.go @@ -3,9 +3,9 @@ package keeper import ( "fmt" - "github.com/cometbft/cometbft/libs/log" + "cosmossdk.io/log" "github.com/cosmos/cosmos-sdk/codec" - storetypes "github.com/cosmos/cosmos-sdk/store/types" + storetypes "cosmossdk.io/store/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/kava-labs/kava/x/community/types" diff --git a/x/community/keeper/params_test.go b/x/community/keeper/params_test.go index 7dff215e2b..2a08525c0a 100644 --- a/x/community/keeper/params_test.go +++ b/x/community/keeper/params_test.go @@ -28,7 +28,7 @@ type StoreTestSuite struct { func (suite *StoreTestSuite) SetupTest() { app.SetSDKConfig() suite.App = app.NewTestApp() - suite.Ctx = suite.App.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + suite.Ctx = suite.App.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) suite.Keeper = suite.App.GetCommunityKeeper() } diff --git a/x/community/keeper/proposal_handler_test.go b/x/community/keeper/proposal_handler_test.go index 7f6a6f540a..d8cadffe86 100644 --- a/x/community/keeper/proposal_handler_test.go +++ b/x/community/keeper/proposal_handler_test.go @@ -59,12 +59,12 @@ func (suite *proposalTestSuite) SetupTest() { genTime := tmtime.Now() hardGS, pricefeedGS := testutil.NewLendGenesisBuilder(). - WithMarket("ukava", "kava:usd", sdk.OneDec()). - WithMarket("usdx", "usdx:usd", sdk.OneDec()). + WithMarket("ukava", "kava:usd", sdkmath.LegacyOneDec()). + WithMarket("usdx", "usdx:usd", sdkmath.LegacyOneDec()). Build() tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmproto.Header{ + ctx := tApp.NewContextLegacy(true, tmproto.Header{ Height: 1, Time: genTime, ChainID: chainID, @@ -83,7 +83,7 @@ func (suite *proposalTestSuite) SetupTest() { app.GenesisState{hardtypes.ModuleName: tApp.AppCodec().MustMarshalJSON(&hardGS)}, app.GenesisState{pricefeedtypes.ModuleName: tApp.AppCodec().MustMarshalJSON(&pricefeedGS)}, app.GenesisState{types.ModuleName: tApp.AppCodec().MustMarshalJSON(&communityGs)}, - testutil.NewCDPGenState(tApp.AppCodec(), "ukava", "kava", sdk.NewDec(2)), + testutil.NewCDPGenState(tApp.AppCodec(), "ukava", "kava", sdkmath.LegacyNewDec(2)), ) suite.App = tApp @@ -313,7 +313,7 @@ func (suite *proposalTestSuite) TestCommunityLendWithdrawProposal() { // during the test - this is because staking denom is "ukava" and no // longer "stake" which has an initial and changing balance instead // of just 0 - suite.App.SetInflation(suite.Ctx, sdk.ZeroDec()) + suite.App.SetInflation(suite.Ctx, sdkmath.LegacyZeroDec()) // setup initial deposit if !tc.initialDeposit.IsZero() { diff --git a/x/community/keeper/rewards_test.go b/x/community/keeper/rewards_test.go index 8aed1f76a1..75974de468 100644 --- a/x/community/keeper/rewards_test.go +++ b/x/community/keeper/rewards_test.go @@ -7,8 +7,6 @@ import ( sdkmath "cosmossdk.io/math" "github.com/stretchr/testify/require" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/kava-labs/kava/x/community/keeper" ) @@ -41,7 +39,7 @@ func TestStakingRewardsCalculator(t *testing.T) { // { name: "inflation only: no bonded tokens -> 0%", - totalSupply: sdk.NewInt(42), + totalSupply: sdkmath.NewInt(42), totalBonded: sdkmath.ZeroInt(), inflation: sdkmath.LegacyOneDec(), communityTax: sdkmath.LegacyZeroDec(), @@ -50,7 +48,7 @@ func TestStakingRewardsCalculator(t *testing.T) { }, { name: "inflation only: 0% inflation -> 0%", - totalSupply: sdk.NewInt(123), + totalSupply: sdkmath.NewInt(123), totalBonded: sdkmath.NewInt(45), inflation: sdkmath.LegacyZeroDec(), communityTax: sdkmath.LegacyZeroDec(), @@ -59,8 +57,8 @@ func TestStakingRewardsCalculator(t *testing.T) { }, { name: "inflation only: 100% bonded w/ 100% inflation -> 100%", - totalSupply: sdk.NewInt(42), - totalBonded: sdk.NewInt(42), + totalSupply: sdkmath.NewInt(42), + totalBonded: sdkmath.NewInt(42), inflation: sdkmath.LegacyOneDec(), communityTax: sdkmath.LegacyZeroDec(), perSecReward: sdkmath.LegacyZeroDec(), @@ -68,7 +66,7 @@ func TestStakingRewardsCalculator(t *testing.T) { }, { name: "inflation only: 100% community tax -> 0%", - totalSupply: sdk.NewInt(123), + totalSupply: sdkmath.NewInt(123), totalBonded: sdkmath.NewInt(45), inflation: sdkmath.LegacyMustNewDecFromStr("0.853"), communityTax: sdkmath.LegacyOneDec(), @@ -77,8 +75,8 @@ func TestStakingRewardsCalculator(t *testing.T) { }, { name: "inflation only: Oct 2023 case", - totalSupply: sdk.NewInt(857570000e6), - totalBonded: sdk.NewInt(127680000e6), + totalSupply: sdkmath.NewInt(857570000e6), + totalBonded: sdkmath.NewInt(127680000e6), inflation: sdkmath.LegacyMustNewDecFromStr("0.595"), communityTax: sdkmath.LegacyMustNewDecFromStr("0.9495"), perSecReward: sdkmath.LegacyZeroDec(), @@ -87,8 +85,8 @@ func TestStakingRewardsCalculator(t *testing.T) { }, { name: "inflation only: low inflation", - totalSupply: sdk.NewInt(857570000e6), - totalBonded: sdk.NewInt(127680000e6), + totalSupply: sdkmath.NewInt(857570000e6), + totalBonded: sdkmath.NewInt(127680000e6), inflation: sdkmath.LegacyMustNewDecFromStr("0.0000000001"), communityTax: sdkmath.LegacyMustNewDecFromStr("0.9495"), perSecReward: sdkmath.LegacyZeroDec(), @@ -96,8 +94,8 @@ func TestStakingRewardsCalculator(t *testing.T) { }, { name: "inflation only: absurdly high inflation", - totalSupply: sdk.NewInt(857570000e6), - totalBonded: sdk.NewInt(127680000e6), + totalSupply: sdkmath.NewInt(857570000e6), + totalBonded: sdkmath.NewInt(127680000e6), inflation: sdkmath.LegacyNewDecFromBigInt(hugeInflation), // 2^205. a higher exponent than this overflows. communityTax: sdkmath.LegacyMustNewDecFromStr("0.9495"), perSecReward: sdkmath.LegacyZeroDec(), @@ -111,7 +109,7 @@ func TestStakingRewardsCalculator(t *testing.T) { // { name: "rps only: no bonded tokens -> 0%", - totalSupply: sdk.NewInt(42), + totalSupply: sdkmath.NewInt(42), totalBonded: sdkmath.ZeroInt(), inflation: sdkmath.LegacyZeroDec(), communityTax: sdkmath.LegacyZeroDec(), @@ -120,7 +118,7 @@ func TestStakingRewardsCalculator(t *testing.T) { }, { name: "rps only: rps = total bonded / seconds in year -> basically 100%", - totalSupply: sdk.NewInt(12345), + totalSupply: sdkmath.NewInt(12345), totalBonded: sdkmath.NewInt(1234), inflation: sdkmath.LegacyZeroDec(), communityTax: sdkmath.LegacyZeroDec(), @@ -129,7 +127,7 @@ func TestStakingRewardsCalculator(t *testing.T) { }, { name: "rps only: 10M kava / year rewards", - totalSupply: sdk.NewInt(870950000e6), + totalSupply: sdkmath.NewInt(870950000e6), totalBonded: sdkmath.NewInt(130380000e6), inflation: sdkmath.LegacyZeroDec(), communityTax: sdkmath.LegacyZeroDec(), @@ -138,7 +136,7 @@ func TestStakingRewardsCalculator(t *testing.T) { }, { name: "rps only: 25M kava / year rewards", - totalSupply: sdk.NewInt(870950000e6), + totalSupply: sdkmath.NewInt(870950000e6), totalBonded: sdkmath.NewInt(130380000e6), inflation: sdkmath.LegacyZeroDec(), communityTax: sdkmath.LegacyZeroDec(), @@ -147,7 +145,7 @@ func TestStakingRewardsCalculator(t *testing.T) { }, { name: "rps only: too much kava / year rewards", - totalSupply: sdk.NewInt(870950000e6), + totalSupply: sdkmath.NewInt(870950000e6), totalBonded: sdkmath.NewInt(130380000e6), inflation: sdkmath.LegacyZeroDec(), communityTax: sdkmath.LegacyZeroDec(), @@ -157,7 +155,7 @@ func TestStakingRewardsCalculator(t *testing.T) { }, { name: "rps only: low kava / year rewards", - totalSupply: sdk.NewInt(870950000e6), + totalSupply: sdkmath.NewInt(870950000e6), totalBonded: sdkmath.NewInt(130380000e6), inflation: sdkmath.LegacyZeroDec(), communityTax: sdkmath.LegacyZeroDec(), @@ -166,7 +164,7 @@ func TestStakingRewardsCalculator(t *testing.T) { }, { name: "rps only: 1 ukava / year rewards", - totalSupply: sdk.NewInt(870950000e6), + totalSupply: sdkmath.NewInt(870950000e6), totalBonded: sdkmath.NewInt(130380000e6), inflation: sdkmath.LegacyZeroDec(), communityTax: sdkmath.LegacyZeroDec(), diff --git a/x/community/keeper/staking.go b/x/community/keeper/staking.go index 52101a1148..58b7561bd5 100644 --- a/x/community/keeper/staking.go +++ b/x/community/keeper/staking.go @@ -28,7 +28,11 @@ func (k Keeper) PayoutAccumulatedStakingRewards(ctx sdk.Context) { } // get the denom for staking - stakingRewardDenom := k.stakingKeeper.BondDenom(ctx) + stakingRewardDenom, err := k.stakingKeeper.BondDenom(ctx) + if err != nil { + // TODO(boodyvo): handle error + panic(err) + } // we fetch the community pool balance to ensure only accumulate rewards up to the current balance communityPoolBalance := sdkmath.LegacyNewDecFromInt(k.bankKeeper.GetBalance(ctx, k.moduleAddress, stakingRewardDenom).Amount) diff --git a/x/community/migrations/v2/store.go b/x/community/migrations/v2/store.go index 34907dfd07..8a45a493c7 100644 --- a/x/community/migrations/v2/store.go +++ b/x/community/migrations/v2/store.go @@ -3,7 +3,7 @@ package v2 import ( "time" - storetypes "github.com/cosmos/cosmos-sdk/store/types" + storetypes "cosmossdk.io/store/types" sdkmath "cosmossdk.io/math" "github.com/cosmos/cosmos-sdk/codec" diff --git a/x/community/module.go b/x/community/module.go index 83eaef6e39..0e75284a07 100644 --- a/x/community/module.go +++ b/x/community/module.go @@ -138,11 +138,17 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw } // BeginBlock module begin-block -func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) { +func (am AppModule) BeginBlock(ctx sdk.Context) error { BeginBlocker(ctx, am.keeper) + + return nil } // EndBlock module end-block -func (am AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { - return []abci.ValidatorUpdate{} +func (am AppModule) EndBlock(_ sdk.Context) ([]abci.ValidatorUpdate, error) { + return []abci.ValidatorUpdate{}, nil } + +func (AppModule) IsOnePerModuleType() {} + +func (AppModule) IsAppModule() {} diff --git a/x/community/module_test.go b/x/community/module_test.go index 4e74874a46..74898ee570 100644 --- a/x/community/module_test.go +++ b/x/community/module_test.go @@ -13,7 +13,7 @@ import ( func TestItCreatesModuleAccountOnInitBlock(t *testing.T) { tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1}) tApp.InitializeFromGenesisStates() accKeeper := tApp.GetAccountKeeper() diff --git a/x/community/testutil/cdp_genesis.go b/x/community/testutil/cdp_genesis.go index 3b4ef80dcf..2b9dac97af 100644 --- a/x/community/testutil/cdp_genesis.go +++ b/x/community/testutil/cdp_genesis.go @@ -10,7 +10,7 @@ import ( cdptypes "github.com/kava-labs/kava/x/cdp/types" ) -func NewCDPGenState(cdc codec.JSONCodec, denom, asset string, liquidationRatio sdk.Dec) app.GenesisState { +func NewCDPGenState(cdc codec.JSONCodec, denom, asset string, liquidationRatio sdkmath.LegacyDec) app.GenesisState { cdpGenesis := cdptypes.GenesisState{ Params: cdptypes.Params{ GlobalDebtLimit: sdk.NewInt64Coin("usdx", 1000000000000), @@ -25,21 +25,21 @@ func NewCDPGenState(cdc codec.JSONCodec, denom, asset string, liquidationRatio s Type: asset + "-a", LiquidationRatio: liquidationRatio, DebtLimit: sdk.NewInt64Coin("usdx", 1000000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), // %5 apr - LiquidationPenalty: sdk.MustNewDecFromStr("0.05"), - AuctionSize: sdk.NewInt(100), + StabilityFee: sdkmath.LegacyMustNewDecFromStr("1.000000001547125958"), // %5 apr + LiquidationPenalty: sdkmath.LegacyMustNewDecFromStr("0.05"), + AuctionSize: sdkmath.NewInt(100), SpotMarketID: asset + ":usd", LiquidationMarketID: asset + ":usd", - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.01"), - CheckCollateralizationIndexCount: sdk.NewInt(10), - ConversionFactor: sdk.NewInt(6), + KeeperRewardPercentage: sdkmath.LegacyMustNewDecFromStr("0.01"), + CheckCollateralizationIndexCount: sdkmath.NewInt(10), + ConversionFactor: sdkmath.NewInt(6), }, }, DebtParam: cdptypes.DebtParam{ Denom: "usdx", ReferenceAsset: "usd", - ConversionFactor: sdk.NewInt(6), - DebtFloor: sdk.NewInt(10000000), + ConversionFactor: sdkmath.NewInt(6), + DebtFloor: sdkmath.NewInt(10000000), }, }, StartingCdpID: cdptypes.DefaultCdpStartingID, @@ -47,10 +47,10 @@ func NewCDPGenState(cdc codec.JSONCodec, denom, asset string, liquidationRatio s GovDenom: cdptypes.DefaultGovDenom, CDPs: cdptypes.CDPs{}, PreviousAccumulationTimes: cdptypes.GenesisAccumulationTimes{ - cdptypes.NewGenesisAccumulationTime(asset+"-a", time.Time{}, sdk.OneDec()), + cdptypes.NewGenesisAccumulationTime(asset+"-a", time.Time{}, sdkmath.LegacyOneDec()), }, TotalPrincipals: cdptypes.GenesisTotalPrincipals{ - cdptypes.NewGenesisTotalPrincipal(asset+"-a", sdk.ZeroInt()), + cdptypes.NewGenesisTotalPrincipal(asset+"-a", sdkmath.ZeroInt()), }, } return app.GenesisState{cdptypes.ModuleName: cdc.MustMarshalJSON(&cdpGenesis)} diff --git a/x/community/testutil/disable_inflation.go b/x/community/testutil/disable_inflation.go index 4d37cc7359..ed32776b4e 100644 --- a/x/community/testutil/disable_inflation.go +++ b/x/community/testutil/disable_inflation.go @@ -46,7 +46,7 @@ func (suite *disableInflationTestSuite) SetupTest() { app.SetSDKConfig() tApp := app.NewTestApp() suite.App = tApp - suite.Ctx = suite.App.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + suite.Ctx = suite.App.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) suite.Keeper = suite.App.GetCommunityKeeper() // Set up x/mint and x/kavadist gen state @@ -60,7 +60,7 @@ func (suite *disableInflationTestSuite) SetupTest() { suite.genesisKavadistState = kavadistGen distrGen := distrtypes.DefaultGenesisState() - distrGen.Params.CommunityTax = sdk.MustNewDecFromStr("0.949500000000000000") + distrGen.Params.CommunityTax = sdkmath.LegacyMustNewDecFromStr("0.949500000000000000") suite.genesisDistrState = distrGen appCodec := tApp.AppCodec() @@ -97,12 +97,12 @@ func (suite *disableInflationTestSuite) TestDisableInflation() { disableTimeMsg = "expected inflation disable time to be reset" expectedStakingRewards = setStakingRewards - expectedMintState.Params.InflationMin = sdk.ZeroDec() - expectedMintState.Params.InflationMax = sdk.ZeroDec() + expectedMintState.Params.InflationMin = sdkmath.LegacyZeroDec() + expectedMintState.Params.InflationMax = sdkmath.LegacyZeroDec() expectedKavadistState.Params.Active = false - expectedDistrState.Params.CommunityTax = sdk.ZeroDec() + expectedDistrState.Params.CommunityTax = sdkmath.LegacyZeroDec() msgSuffix = "after upgrade" diff --git a/x/community/testutil/main.go b/x/community/testutil/main.go index 1016b68e8e..2c0b142d61 100644 --- a/x/community/testutil/main.go +++ b/x/community/testutil/main.go @@ -26,7 +26,7 @@ type Suite struct { func (suite *Suite) SetupTest() { app.SetSDKConfig() tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) suite.App = tApp.InitializeFromGenesisStates() diff --git a/x/community/testutil/pricefeed_genesis_builder.go b/x/community/testutil/pricefeed_genesis_builder.go index e0a2e37c6f..bb23ad9666 100644 --- a/x/community/testutil/pricefeed_genesis_builder.go +++ b/x/community/testutil/pricefeed_genesis_builder.go @@ -30,17 +30,17 @@ func (b lendGenesisBuilder) Build() (hardtypes.GenesisState, pricefeedtypes.Gene return hardGS, pricefeedGS } -func (b lendGenesisBuilder) WithMarket(denom, spotMarketId string, price sdk.Dec) lendGenesisBuilder { +func (b lendGenesisBuilder) WithMarket(denom, spotMarketId string, price sdkmath.LegacyDec) lendGenesisBuilder { // add hard money market b.hardMarkets = append(b.hardMarkets, hardtypes.NewMoneyMarket( denom, - hardtypes.NewBorrowLimit(false, sdk.NewDec(1e15), sdk.MustNewDecFromStr("0.6")), + hardtypes.NewBorrowLimit(false, sdkmath.LegacyNewDec(1e15), sdkmath.LegacyMustNewDecFromStr("0.6")), spotMarketId, sdkmath.NewInt(1e6), - hardtypes.NewInterestRateModel(sdk.MustNewDecFromStr("0.05"), sdk.MustNewDecFromStr("2"), sdk.MustNewDecFromStr("0.8"), sdk.MustNewDecFromStr("10")), - sdk.MustNewDecFromStr("0.05"), - sdk.ZeroDec(), + hardtypes.NewInterestRateModel(sdkmath.LegacyMustNewDecFromStr("0.05"), sdkmath.LegacyMustNewDecFromStr("2"), sdkmath.LegacyMustNewDecFromStr("0.8"), sdkmath.LegacyMustNewDecFromStr("10")), + sdkmath.LegacyMustNewDecFromStr("0.05"), + sdkmath.LegacyZeroDec(), ), ) diff --git a/x/community/testutil/staking_rewards.go b/x/community/testutil/staking_rewards.go index dbecab2c48..4e4e6c25d3 100644 --- a/x/community/testutil/staking_rewards.go +++ b/x/community/testutil/staking_rewards.go @@ -239,7 +239,7 @@ func (suite *stakingRewardsTestSuite) TestStakingRewards() { // initial context at height 1 height := int64(1) blockTime := tc.periodStart - ctx := suite.App.NewContext(true, tmproto.Header{Height: height, Time: blockTime}) + ctx := suite.App.NewContextLegacy(true, tmproto.Header{Height: height, Time: blockTime}) // ensure community pool balance matches the test expectations poolAcc := accountKeeper.GetModuleAccount(ctx, types.ModuleName) @@ -283,7 +283,7 @@ func (suite *stakingRewardsTestSuite) TestStakingRewards() { if blockTime.After(tc.periodEnd) { blockTime = tc.periodEnd } - ctx = suite.App.NewContext(true, tmproto.Header{Height: height, Time: blockTime}) + ctx = suite.App.NewContextLegacy(true, tmproto.Header{Height: height, Time: blockTime}) } endingFeeCollectorBalance := bankKeeper.GetBalance(ctx, feeCollectorAcc.GetAddress(), "ukava").Amount @@ -323,7 +323,7 @@ func (suite *stakingRewardsTestSuite) TestStakingRewardsDoNotAccumulateWhenPoolI // first block blockTime := time.Now() - ctx := app.NewContext(true, tmproto.Header{Height: 1, Time: blockTime}) + ctx := app.NewContextLegacy(true, tmproto.Header{Height: 1, Time: blockTime}) poolAcc := accountKeeper.GetModuleAccount(ctx, types.ModuleName) feeCollectorAcc := accountKeeper.GetModuleAccount(ctx, authtypes.FeeCollectorName) @@ -345,17 +345,17 @@ func (suite *stakingRewardsTestSuite) TestStakingRewardsDoNotAccumulateWhenPoolI // run second block 10 seconds in future and spend all community pool rewards blockTime = blockTime.Add(10 * time.Second) - ctx = app.NewContext(true, tmproto.Header{Height: 2, Time: blockTime}) + ctx = app.NewContextLegacy(true, tmproto.Header{Height: 2, Time: blockTime}) community.BeginBlocker(ctx, keeper) // run third block 10 seconds in future which no rewards will be paid blockTime = blockTime.Add(10 * time.Second) - ctx = app.NewContext(true, tmproto.Header{Height: 3, Time: blockTime}) + ctx = app.NewContextLegacy(true, tmproto.Header{Height: 3, Time: blockTime}) community.BeginBlocker(ctx, keeper) // run fourth block 10 seconds in future which no rewards will be paid blockTime = blockTime.Add(10 * time.Second) - ctx = app.NewContext(true, tmproto.Header{Height: 4, Time: blockTime}) + ctx = app.NewContextLegacy(true, tmproto.Header{Height: 4, Time: blockTime}) community.BeginBlocker(ctx, keeper) // refund the community pool with 100 KAVA -- plenty of funds @@ -363,7 +363,7 @@ func (suite *stakingRewardsTestSuite) TestStakingRewardsDoNotAccumulateWhenPoolI // run fifth block 10 seconds in future which no rewards will be paid blockTime = blockTime.Add(10 * time.Second) - ctx = app.NewContext(true, tmproto.Header{Height: 5, Time: blockTime}) + ctx = app.NewContextLegacy(true, tmproto.Header{Height: 5, Time: blockTime}) community.BeginBlocker(ctx, keeper) // assert that only 20 total KAVA has been distributed in rewards @@ -375,7 +375,7 @@ func (suite *stakingRewardsTestSuite) TestStakingRewardsDoNotAccumulateWhenPoolI func (suite *stakingRewardsTestSuite) TestPanicsOnMissingParameters() { suite.SetupTest() - ctx := suite.App.NewContext(true, tmproto.Header{Height: 1, Time: time.Now()}) + ctx := suite.App.NewContextLegacy(true, tmproto.Header{Height: 1, Time: time.Now()}) store := ctx.KVStore(suite.App.GetKVStoreKey(types.StoreKey)) store.Delete(types.ParamsKey) diff --git a/x/community/types/codec.go b/x/community/types/codec.go index 9c20c18fa1..e1cd9a9277 100644 --- a/x/community/types/codec.go +++ b/x/community/types/codec.go @@ -7,7 +7,6 @@ import ( cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/msgservice" - authzcodec "github.com/cosmos/cosmos-sdk/x/authz/codec" govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" ) @@ -50,5 +49,6 @@ func init() { // Register all Amino interfaces and concrete types on the authz Amino codec so that this can later be // used to properly serialize MsgGrant and MsgExec instances - RegisterLegacyAminoCodec(authzcodec.Amino) + // TODO(boodyvo): identify how to get authz Amino codec + RegisterLegacyAminoCodec(codec.NewLegacyAmino()) } diff --git a/x/community/types/expected_keepers.go b/x/community/types/expected_keepers.go index 468b4efc0d..b253fa7f49 100644 --- a/x/community/types/expected_keepers.go +++ b/x/community/types/expected_keepers.go @@ -1,9 +1,9 @@ package types import ( + "context" sdkmath "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" kavadisttypes "github.com/kava-labs/kava/x/kavadist/types" @@ -11,26 +11,26 @@ import ( // AccountKeeper defines the contract required for account APIs. type AccountKeeper interface { - GetModuleAccount(ctx sdk.Context, moduleName string) authtypes.ModuleAccountI + GetModuleAccount(ctx context.Context, moduleName string) sdk.ModuleAccountI GetModuleAddress(name string) sdk.AccAddress } // BankKeeper defines the contract needed to be fulfilled for banking dependencies. type BankKeeper interface { - GetBalance(ctx sdk.Context, addr sdk.AccAddress, denom string) sdk.Coin - GetAllBalances(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins + GetBalance(ctx context.Context, addr sdk.AccAddress, denom string) sdk.Coin + GetAllBalances(ctx context.Context, addr sdk.AccAddress) sdk.Coins - SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error - SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error - SendCoinsFromModuleToModule(ctx sdk.Context, senderModule, recipientModule string, amt sdk.Coins) error + SendCoinsFromAccountToModule(ctx context.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error + SendCoinsFromModuleToAccount(ctx context.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error + SendCoinsFromModuleToModule(ctx context.Context, senderModule, recipientModule string, amt sdk.Coins) error - GetSupply(ctx sdk.Context, denom string) sdk.Coin + GetSupply(ctx context.Context, denom string) sdk.Coin } // CdpKeeper defines the contract needed to be fulfilled for cdp dependencies. type CdpKeeper interface { - RepayPrincipal(ctx sdk.Context, owner sdk.AccAddress, collateralType string, payment sdk.Coin) error - WithdrawCollateral(ctx sdk.Context, owner, depositor sdk.AccAddress, collateral sdk.Coin, collateralType string) error + RepayPrincipal(ctx context.Context, owner sdk.AccAddress, collateralType string, payment sdk.Coin) error + WithdrawCollateral(ctx context.Context, owner, depositor sdk.AccAddress, collateral sdk.Coin, collateralType string) error } // HardKeeper defines the contract needed to be fulfilled for Kava Lend dependencies. @@ -41,20 +41,23 @@ type HardKeeper interface { // DistributionKeeper defines the contract needed to be fulfilled for distribution dependencies. type DistributionKeeper interface { - DistributeFromFeePool(ctx sdk.Context, amount sdk.Coins, receiveAddr sdk.AccAddress) error - FundCommunityPool(ctx sdk.Context, amount sdk.Coins, sender sdk.AccAddress) error - GetFeePoolCommunityCoins(ctx sdk.Context) sdk.DecCoins - GetFeePool(ctx sdk.Context) distrtypes.FeePool - SetFeePool(ctx sdk.Context, feePool distrtypes.FeePool) - GetParams(ctx sdk.Context) distrtypes.Params - SetParams(ctx sdk.Context, params distrtypes.Params) error - GetCommunityTax(ctx sdk.Context) sdk.Dec + DistributeFromFeePool(ctx context.Context, amount sdk.Coins, receiveAddr sdk.AccAddress) error + FundCommunityPool(ctx context.Context, amount sdk.Coins, sender sdk.AccAddress) error + GetFeePoolCommunityCoins(ctx context.Context) sdk.DecCoins + GetFeePool(ctx context.Context) distrtypes.FeePool + SetFeePool(ctx context.Context, feePool distrtypes.FeePool) + GetParams(ctx context.Context) distrtypes.Params + SetParams(ctx context.Context, params distrtypes.Params) error + GetCommunityTax(ctx context.Context) (sdkmath.LegacyDec, error) } +// need the method: GetParams(ctx context.Context) distrtypes.Params +// have the method: GetParams(clientCtx sdk.Context) (params types.Params) + type MintKeeper interface { - GetParams(ctx sdk.Context) (params minttypes.Params) - SetParams(ctx sdk.Context, params minttypes.Params) error - GetMinter(ctx sdk.Context) (minter minttypes.Minter) + GetParams(ctx context.Context) (params minttypes.Params) + SetParams(ctx context.Context, params minttypes.Params) error + GetMinter(ctx context.Context) (minter minttypes.Minter) } type KavadistKeeper interface { @@ -64,6 +67,6 @@ type KavadistKeeper interface { // StakingKeeper expected interface for the staking keeper type StakingKeeper interface { - BondDenom(ctx sdk.Context) string - TotalBondedTokens(ctx sdk.Context) sdkmath.Int + BondDenom(ctx context.Context) (string, error) + TotalBondedTokens(ctx context.Context) (sdkmath.Int, error) } diff --git a/x/community/types/msg_test.go b/x/community/types/msg_test.go index 5629e40fe3..3e4f25ba85 100644 --- a/x/community/types/msg_test.go +++ b/x/community/types/msg_test.go @@ -57,7 +57,7 @@ func TestFundCommunityPool_ValidateBasic(t *testing.T) { message: types.MsgFundCommunityPool{ Depositor: app.RandomAddress().String(), Amount: sdk.NewCoins( - sdk.NewCoin("ukava", sdk.ZeroInt()), + sdk.NewCoin("ukava", sdkmath.ZeroInt()), ), }, }, diff --git a/x/community/types/proposal.go b/x/community/types/proposal.go index ba8471da16..3cdf9d3c61 100644 --- a/x/community/types/proposal.go +++ b/x/community/types/proposal.go @@ -8,7 +8,6 @@ import ( errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - govcodec "github.com/cosmos/cosmos-sdk/x/gov/codec" govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" ) @@ -32,14 +31,15 @@ var ( ) func init() { + // TODO(boodyvo): the moduleCdc was removed, looks like need an updated (depinjection ?) govv1beta1.RegisterProposalType(ProposalTypeCommunityPoolLendDeposit) - govcodec.ModuleCdc.Amino.RegisterConcrete(&CommunityPoolLendDepositProposal{}, "kava/CommunityPoolLendDepositProposal", nil) + //govcodec.ModuleCdc.Amino.RegisterConcrete(&CommunityPoolLendDepositProposal{}, "kava/CommunityPoolLendDepositProposal", nil) govv1beta1.RegisterProposalType(ProposalTypeCommunityPoolLendWithdraw) - govcodec.ModuleCdc.Amino.RegisterConcrete(&CommunityPoolLendWithdrawProposal{}, "kava/CommunityPoolLendWithdrawProposal", nil) + //govcodec.ModuleCdc.Amino.RegisterConcrete(&CommunityPoolLendWithdrawProposal{}, "kava/CommunityPoolLendWithdrawProposal", nil) govv1beta1.RegisterProposalType(ProposalTypeCommunityCDPRepayDebt) - govcodec.ModuleCdc.Amino.RegisterConcrete(&CommunityCDPRepayDebtProposal{}, "kava/CommunityCDPRepayDebtProposal", nil) + //govcodec.ModuleCdc.Amino.RegisterConcrete(&CommunityCDPRepayDebtProposal{}, "kava/CommunityCDPRepayDebtProposal", nil) govv1beta1.RegisterProposalType(ProposalTypeCommunityCDPWithdrawCollateral) - govcodec.ModuleCdc.Amino.RegisterConcrete(&CommunityCDPWithdrawCollateralProposal{}, "kava/CommunityCDPWithdrawCollateralProposal", nil) + //govcodec.ModuleCdc.Amino.RegisterConcrete(&CommunityCDPWithdrawCollateralProposal{}, "kava/CommunityCDPWithdrawCollateralProposal", nil) } ////////////////// diff --git a/x/community/types/proposal_test.go b/x/community/types/proposal_test.go index 384fcf5328..b7899943f8 100644 --- a/x/community/types/proposal_test.go +++ b/x/community/types/proposal_test.go @@ -60,7 +60,7 @@ func TestLendProposals_ValidateBasic(t *testing.T) { proposal: proposalData{ Title: "Error profoundly", Description: "My coins are zero", - Amount: sdk.NewCoins(sdk.NewCoin("ukava", sdk.ZeroInt())), + Amount: sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.ZeroInt())), }, expectedErr: "invalid coins", }, diff --git a/x/community/types/query.pb.go b/x/community/types/query.pb.go index c1451fd4e1..24b4cdc27c 100644 --- a/x/community/types/query.pb.go +++ b/x/community/types/query.pb.go @@ -590,6 +590,7 @@ func _Query_AnnualizedRewards_Handler(srv interface{}, ctx context.Context, dec return interceptor(ctx, in, info, handler) } +var Query_serviceDesc = _Query_serviceDesc var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "kava.community.v1beta1.Query", HandlerType: (*QueryServer)(nil), diff --git a/x/community/types/tx.pb.go b/x/community/types/tx.pb.go index 96e553330d..806fba66e4 100644 --- a/x/community/types/tx.pb.go +++ b/x/community/types/tx.pb.go @@ -431,6 +431,7 @@ func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(in return interceptor(ctx, in, info, handler) } +var Msg_serviceDesc = _Msg_serviceDesc var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "kava.community.v1beta1.Msg", HandlerType: (*MsgServer)(nil), diff --git a/x/earn/client/cli/tx.go b/x/earn/client/cli/tx.go index 2ab9e45d12..5a0b0e8c11 100644 --- a/x/earn/client/cli/tx.go +++ b/x/earn/client/cli/tx.go @@ -2,10 +2,12 @@ package cli import ( "fmt" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" "strings" "github.com/spf13/cobra" + "cosmossdk.io/errors" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/client/tx" @@ -159,7 +161,15 @@ Where proposal.json contains: if err != nil { return err } - if err := msg.ValidateBasic(); err != nil { + + contentProposal := msg.GetContent() + if contentProposal == nil { + return errors.Wrap(govtypes.ErrInvalidProposalContent, "missing content") + } + if !govv1beta1.IsValidProposalType(contentProposal.ProposalType()) { + return errors.Wrap(govtypes.ErrInvalidProposalType, contentProposal.ProposalType()) + } + if err := contentProposal.ValidateBasic(); err != nil { return err } @@ -217,7 +227,15 @@ Where proposal.json contains: if err != nil { return err } - if err := msg.ValidateBasic(); err != nil { + + contentProposal := msg.GetContent() + if contentProposal == nil { + return errors.Wrap(govtypes.ErrInvalidProposalContent, "missing content") + } + if !govv1beta1.IsValidProposalType(contentProposal.ProposalType()) { + return errors.Wrap(govtypes.ErrInvalidProposalType, contentProposal.ProposalType()) + } + if err := contentProposal.ValidateBasic(); err != nil { return err } diff --git a/x/earn/genesis_test.go b/x/earn/genesis_test.go index 2d982a6d46..c8a3a10717 100644 --- a/x/earn/genesis_test.go +++ b/x/earn/genesis_test.go @@ -30,7 +30,7 @@ func (suite *genesisTestSuite) Test_InitGenesis_ValidationPanic() { types.VaultRecords{ { TotalShares: types.VaultShare{ - Denom: "", Amount: sdk.NewDec(1), + Denom: "", Amount: sdkmath.LegacyNewDec(1), }, }, }, @@ -68,25 +68,25 @@ func (suite *genesisTestSuite) Test_InitAndExportGenesis() { }, types.VaultRecords{ types.VaultRecord{ - TotalShares: types.NewVaultShare("ukava", sdk.NewDec(3800000)), + TotalShares: types.NewVaultShare("ukava", sdkmath.LegacyNewDec(3800000)), }, types.VaultRecord{ - TotalShares: types.NewVaultShare("usdx", sdk.NewDec(1000000)), + TotalShares: types.NewVaultShare("usdx", sdkmath.LegacyNewDec(1000000)), }, }, types.VaultShareRecords{ types.VaultShareRecord{ Depositor: depositor_1, Shares: types.NewVaultShares( - types.NewVaultShare("usdx", sdk.NewDec(500000)), - types.NewVaultShare("ukava", sdk.NewDec(1900000)), + types.NewVaultShare("usdx", sdkmath.LegacyNewDec(500000)), + types.NewVaultShare("ukava", sdkmath.LegacyNewDec(1900000)), ), }, types.VaultShareRecord{ Depositor: depositor_2, Shares: types.NewVaultShares( - types.NewVaultShare("usdx", sdk.NewDec(500000)), - types.NewVaultShare("ukava", sdk.NewDec(1900000)), + types.NewVaultShare("usdx", sdkmath.LegacyNewDec(500000)), + types.NewVaultShare("ukava", sdkmath.LegacyNewDec(1900000)), ), }, }, @@ -136,25 +136,25 @@ func (suite *genesisTestSuite) Test_Marshall() { }, types.VaultRecords{ types.VaultRecord{ - TotalShares: types.NewVaultShare("ukava", sdk.NewDec(3800000)), + TotalShares: types.NewVaultShare("ukava", sdkmath.LegacyNewDec(3800000)), }, types.VaultRecord{ - TotalShares: types.NewVaultShare("usdx", sdk.NewDec(1000000)), + TotalShares: types.NewVaultShare("usdx", sdkmath.LegacyNewDec(1000000)), }, }, types.VaultShareRecords{ types.VaultShareRecord{ Depositor: depositor_1, Shares: types.NewVaultShares( - types.NewVaultShare("usdx", sdk.NewDec(500000)), - types.NewVaultShare("ukava", sdk.NewDec(1900000)), + types.NewVaultShare("usdx", sdkmath.LegacyNewDec(500000)), + types.NewVaultShare("ukava", sdkmath.LegacyNewDec(1900000)), ), }, types.VaultShareRecord{ Depositor: depositor_2, Shares: types.NewVaultShares( - types.NewVaultShare("usdx", sdk.NewDec(500000)), - types.NewVaultShare("ukava", sdk.NewDec(1900000)), + types.NewVaultShare("usdx", sdkmath.LegacyNewDec(500000)), + types.NewVaultShare("ukava", sdkmath.LegacyNewDec(1900000)), ), }, }, diff --git a/x/earn/keeper/deposit.go b/x/earn/keeper/deposit.go index 5598e5c1fa..cbd777a841 100644 --- a/x/earn/keeper/deposit.go +++ b/x/earn/keeper/deposit.go @@ -1,6 +1,7 @@ package keeper import ( + sdkmath "cosmossdk.io/math" "fmt" sdk "github.com/cosmos/cosmos-sdk/types" @@ -41,7 +42,7 @@ func (k *Keeper) Deposit( vaultRecord, found := k.GetVaultRecord(ctx, amount.Denom) if !found { // Create a new VaultRecord with 0 supply - vaultRecord = types.NewVaultRecord(amount.Denom, sdk.ZeroDec()) + vaultRecord = types.NewVaultRecord(amount.Denom, sdkmath.LegacyZeroDec()) } // Get the strategy for the vault diff --git a/x/earn/keeper/deposit_test.go b/x/earn/keeper/deposit_test.go index 806d1b1773..29babb5488 100644 --- a/x/earn/keeper/deposit_test.go +++ b/x/earn/keeper/deposit_test.go @@ -52,7 +52,7 @@ func (suite *depositTestSuite) TestDeposit_Balances() { suite.VaultTotalValuesEqual(sdk.NewCoins(depositAmount)) suite.VaultTotalSharesEqual(types.NewVaultShares( - types.NewVaultShare(depositAmount.Denom, sdk.NewDecFromInt(depositAmount.Amount)), + types.NewVaultShare(depositAmount.Denom, sdkmath.LegacyNewDecFromInt(depositAmount.Amount)), )) } diff --git a/x/earn/keeper/grpc_query.go b/x/earn/keeper/grpc_query.go index b3175c9be7..df2c04821c 100644 --- a/x/earn/keeper/grpc_query.go +++ b/x/earn/keeper/grpc_query.go @@ -2,6 +2,7 @@ package keeper import ( "context" + sdkmath "cosmossdk.io/math" "fmt" "strings" @@ -122,8 +123,8 @@ func (s queryServer) Vaults( IsPrivateVault: allowedVault.IsPrivateVault, AllowedDepositors: addressSliceToStringSlice(allowedVault.AllowedDepositors), // No shares, no value - TotalShares: sdk.ZeroDec().String(), - TotalValue: sdk.ZeroInt(), + TotalShares: sdkmath.LegacyZeroDec().String(), + TotalValue: sdkmath.ZeroInt(), }) } @@ -164,7 +165,7 @@ func (s queryServer) Vault( vaultRecord, found := s.keeper.GetVaultRecord(sdkCtx, req.Denom) if !found { // No supply yet, no error just set it to zero - vaultRecord.TotalShares = types.NewVaultShare(req.Denom, sdk.ZeroDec()) + vaultRecord.TotalShares = types.NewVaultShare(req.Denom, sdkmath.LegacyZeroDec()) } totalValue, err := s.keeper.GetVaultTotalValue(sdkCtx, req.Denom) @@ -354,8 +355,8 @@ func (s queryServer) getOneAccountOneVaultDeposit( { Depositor: depositor.String(), // Zero shares and zero value for no deposits - Shares: types.NewVaultShares(types.NewVaultShare(req.Denom, sdk.ZeroDec())), - Value: sdk.NewCoins(sdk.NewCoin(req.Denom, sdk.ZeroInt())), + Shares: types.NewVaultShares(types.NewVaultShare(req.Denom, sdkmath.LegacyZeroDec())), + Value: sdk.NewCoins(sdk.NewCoin(req.Denom, sdkmath.ZeroInt())), }, }, Pagination: nil, @@ -420,8 +421,8 @@ func (s queryServer) getOneAccountBkavaVaultDeposit( { Depositor: depositor.String(), // Zero shares and zero value for no deposits - Shares: types.NewVaultShares(types.NewVaultShare(req.Denom, sdk.ZeroDec())), - Value: sdk.NewCoins(sdk.NewCoin(req.Denom, sdk.ZeroInt())), + Shares: types.NewVaultShares(types.NewVaultShare(req.Denom, sdkmath.LegacyZeroDec())), + Value: sdk.NewCoins(sdk.NewCoin(req.Denom, sdkmath.ZeroInt())), }, }, Pagination: nil, diff --git a/x/earn/keeper/grpc_query_test.go b/x/earn/keeper/grpc_query_test.go index 2ba413c360..b1aef5341b 100644 --- a/x/earn/keeper/grpc_query_test.go +++ b/x/earn/keeper/grpc_query_test.go @@ -79,7 +79,7 @@ func (suite *grpcQueryTestSuite) TestVaults_ZeroSupply() { Strategies: []types.StrategyType{types.STRATEGY_TYPE_HARD}, IsPrivateVault: false, AllowedDepositors: nil, - TotalShares: sdk.NewDec(0).String(), + TotalShares: sdkmath.LegacyNewDec(0).String(), TotalValue: sdkmath.NewInt(0), }, res.Vault, @@ -95,16 +95,16 @@ func (suite *grpcQueryTestSuite) TestVaults_ZeroSupply() { Strategies: []types.StrategyType{types.STRATEGY_TYPE_HARD}, IsPrivateVault: false, AllowedDepositors: nil, - TotalShares: sdk.ZeroDec().String(), - TotalValue: sdk.ZeroInt(), + TotalShares: sdkmath.LegacyZeroDec().String(), + TotalValue: sdkmath.ZeroInt(), }, { Denom: "busd", Strategies: []types.StrategyType{types.STRATEGY_TYPE_HARD}, IsPrivateVault: false, AllowedDepositors: nil, - TotalShares: sdk.ZeroDec().String(), - TotalValue: sdk.ZeroInt(), + TotalShares: sdkmath.LegacyZeroDec().String(), + TotalValue: sdkmath.ZeroInt(), }, }, res.Vaults, @@ -143,7 +143,7 @@ func (suite *grpcQueryTestSuite) TestVaults_WithSupply() { Strategies: []types.StrategyType{types.STRATEGY_TYPE_HARD}, IsPrivateVault: false, AllowedDepositors: nil, - TotalShares: sdk.NewDecFromInt(depositAmount.Amount).String(), + TotalShares: sdkmath.LegacyNewDecFromInt(depositAmount.Amount).String(), TotalValue: depositAmount.Amount, }, { @@ -151,7 +151,7 @@ func (suite *grpcQueryTestSuite) TestVaults_WithSupply() { Strategies: []types.StrategyType{types.STRATEGY_TYPE_SAVINGS}, IsPrivateVault: false, AllowedDepositors: nil, - TotalShares: sdk.NewDecFromInt(deposit2Amount.Amount).String(), + TotalShares: sdkmath.LegacyNewDecFromInt(deposit2Amount.Amount).String(), TotalValue: deposit2Amount.Amount, }, }, @@ -189,23 +189,23 @@ func (suite *grpcQueryTestSuite) TestVaults_MixedSupply() { Strategies: []types.StrategyType{types.STRATEGY_TYPE_HARD}, IsPrivateVault: false, AllowedDepositors: nil, - TotalShares: sdk.ZeroDec().String(), - TotalValue: sdk.ZeroInt(), + TotalShares: sdkmath.LegacyZeroDec().String(), + TotalValue: sdkmath.ZeroInt(), }, { Denom: vault2Denom, Strategies: []types.StrategyType{types.STRATEGY_TYPE_HARD}, IsPrivateVault: false, AllowedDepositors: nil, - TotalShares: sdk.ZeroDec().String(), - TotalValue: sdk.ZeroInt(), + TotalShares: sdkmath.LegacyZeroDec().String(), + TotalValue: sdkmath.ZeroInt(), }, { Denom: vault3Denom, Strategies: []types.StrategyType{types.STRATEGY_TYPE_SAVINGS}, IsPrivateVault: false, AllowedDepositors: nil, - TotalShares: sdk.NewDecFromInt(depositAmount.Amount).String(), + TotalShares: sdkmath.LegacyNewDecFromInt(depositAmount.Amount).String(), TotalValue: depositAmount.Amount, }, }, @@ -301,7 +301,7 @@ func (suite *grpcQueryTestSuite) TestDeposits() { Depositor: acc1.String(), // Only includes specified deposit shares Shares: types.NewVaultShares( - types.NewVaultShare(deposit1Amount.Denom, sdk.NewDecFromInt(deposit1Amount.Amount)), + types.NewVaultShare(deposit1Amount.Denom, sdkmath.LegacyNewDecFromInt(deposit1Amount.Amount)), ), // Only the specified vault denom value Value: sdk.NewCoins(deposit1Amount), @@ -326,7 +326,7 @@ func (suite *grpcQueryTestSuite) TestDeposits() { Depositor: acc2.String(), // Only includes specified deposit shares Shares: types.NewVaultShares( - types.NewVaultShare(deposit3Amount.Denom, sdk.NewDecFromInt(deposit3Amount.Amount)), + types.NewVaultShare(deposit3Amount.Denom, sdkmath.LegacyNewDecFromInt(deposit3Amount.Amount)), ), // Only the specified vault denom value Value: sdk.NewCoins(deposit3Amount), @@ -350,7 +350,7 @@ func (suite *grpcQueryTestSuite) TestDeposits() { Depositor: acc2.String(), // Only includes specified deposit shares Shares: types.NewVaultShares( - types.NewVaultShare(deposit3Amount.Denom, sdk.NewDecFromInt(deposit3Amount.Amount)), + types.NewVaultShare(deposit3Amount.Denom, sdkmath.LegacyNewDecFromInt(deposit3Amount.Amount)), ), // Only the specified vault denom value Value: sdk.NewCoins( @@ -383,8 +383,8 @@ func (suite *grpcQueryTestSuite) TestDeposits() { { Depositor: acc1.String(), Shares: types.NewVaultShares( - types.NewVaultShare(deposit1Amount.Denom, sdk.NewDecFromInt(deposit1Amount.Amount)), - types.NewVaultShare(deposit2Amount.Denom, sdk.NewDecFromInt(deposit2Amount.Amount)), + types.NewVaultShare(deposit1Amount.Denom, sdkmath.LegacyNewDecFromInt(deposit1Amount.Amount)), + types.NewVaultShare(deposit2Amount.Denom, sdkmath.LegacyNewDecFromInt(deposit2Amount.Amount)), ), Value: sdk.NewCoins(deposit1Amount, deposit2Amount), }, @@ -406,8 +406,8 @@ func (suite *grpcQueryTestSuite) TestDeposits() { Depositor: acc2.String(), Shares: types.VaultShares{ // Does not include non-bkava vaults - types.NewVaultShare(deposit4Amount.Denom, sdk.NewDecFromInt(deposit4Amount.Amount)), - types.NewVaultShare(deposit3Amount.Denom, sdk.NewDecFromInt(deposit3Amount.Amount)), + types.NewVaultShare(deposit4Amount.Denom, sdkmath.LegacyNewDecFromInt(deposit4Amount.Amount)), + types.NewVaultShare(deposit3Amount.Denom, sdkmath.LegacyNewDecFromInt(deposit3Amount.Amount)), }, Value: sdk.Coins{ // Does not include non-bkava vaults @@ -420,7 +420,7 @@ func (suite *grpcQueryTestSuite) TestDeposits() { for i := range res.Deposits[0].Shares { suite.Equal( res.Deposits[0].Shares[i].Amount, - sdk.NewDecFromInt(res.Deposits[0].Value[i].Amount), + sdkmath.LegacyNewDecFromInt(res.Deposits[0].Value[i].Amount), "order of deposit value should match shares", ) } @@ -523,7 +523,7 @@ func (suite *grpcQueryTestSuite) TestDeposits_bKava() { // Slash the last validator to reduce the value of it's derivatives to test bkava to underlying token conversion. // First call end block to bond validator to enable slashing. staking.EndBlocker(suite.Ctx, suite.App.GetStakingKeeper()) - err = suite.slashValidator(sdk.ValAddress(address2), sdk.MustNewDecFromStr("0.5")) + err = suite.slashValidator(sdk.ValAddress(address2), sdkmath.LegacyMustNewDecFromStr("0.5")) suite.Require().NoError(err) suite.Run("no deposits", func() { @@ -573,6 +573,8 @@ func (suite *grpcQueryTestSuite) TestDeposits_bKava() { // last validator slashed 50% so derivatives are worth half // Excludes non-bkava deposits expectedValue := derivatives1.Amount.Add(derivatives2.Amount.QuoRaw(2)) + bondDemon, err := suite.bondDenom() + suite.Require().NoError(err) suite.Require().ElementsMatchf( []types.DepositResponse{ { @@ -581,7 +583,7 @@ func (suite *grpcQueryTestSuite) TestDeposits_bKava() { Shares: nil, // Value returned in units of staked token Value: sdk.NewCoins( - sdk.NewCoin(suite.bondDenom(), expectedValue), + sdk.NewCoin(bondDemon, expectedValue), ), }, }, @@ -644,7 +646,7 @@ func (suite *grpcQueryTestSuite) TestVault_bKava_Aggregate() { // Slash the last validator to reduce the value of it's derivatives to test bkava to underlying token conversion. // First call end block to bond validator to enable slashing. staking.EndBlocker(suite.Ctx, suite.App.GetStakingKeeper()) - err := suite.slashValidator(sdk.ValAddress(address3), sdk.MustNewDecFromStr("0.5")) + err := suite.slashValidator(sdk.ValAddress(address3), sdkmath.LegacyMustNewDecFromStr("0.5")) suite.Require().NoError(err) // vault denom is only "bkava" which has it's own special handler @@ -797,7 +799,7 @@ func (suite *grpcQueryTestSuite) TestTotalSupply() { // bond validators staking.EndBlocker(suite.Ctx, suite.App.GetStakingKeeper()) // slash val2 - its shares are now 80% as valuable! - err := suite.slashValidator(sdk.ValAddress(address2), sdk.MustNewDecFromStr("0.2")) + err := suite.slashValidator(sdk.ValAddress(address2), sdkmath.LegacyMustNewDecFromStr("0.2")) suite.Require().NoError(err) // create "bkava" vault. it holds all bkava denoms @@ -837,7 +839,7 @@ func (suite *grpcQueryTestSuite) createUnbondedValidator(address sdk.ValAddress, ed25519.GenPrivKey().PubKey(), selfDelegation, stakingtypes.Description{}, - stakingtypes.NewCommissionRates(sdk.ZeroDec(), sdk.ZeroDec(), sdk.ZeroDec()), + stakingtypes.NewCommissionRates(sdkmath.LegacyZeroDec(), sdkmath.LegacyZeroDec(), sdkmath.LegacyZeroDec()), minSelfDelegation, ) if err != nil { @@ -857,8 +859,10 @@ func (suite *grpcQueryTestSuite) createAccountWithDerivatives(denom string, amou address := sdk.AccAddress(valAddress) remainingSelfDelegation := sdkmath.NewInt(1e6) + bondDenom, err := suite.bondDenom() + suite.Require().NoError(err) selfDelegation := sdk.NewCoin( - suite.bondDenom(), + bondDenom, amount.Add(remainingSelfDelegation), ) @@ -867,7 +871,9 @@ func (suite *grpcQueryTestSuite) createAccountWithDerivatives(denom string, amou err = suite.createUnbondedValidator(valAddress, selfDelegation, remainingSelfDelegation) suite.Require().NoError(err) - toConvert := sdk.NewCoin(suite.bondDenom(), amount) + bondDenom, err = suite.bondDenom() + suite.Require().NoError(err) + toConvert := sdk.NewCoin(bondDenom, amount) derivatives, err := suite.App.GetLiquidKeeper().MintDerivative(suite.Ctx, address, valAddress, @@ -881,11 +887,11 @@ func (suite *grpcQueryTestSuite) createAccountWithDerivatives(denom string, amou } // slashValidator slashes the validator with the given address by the given percentage. -func (suite *grpcQueryTestSuite) slashValidator(address sdk.ValAddress, slashFraction sdk.Dec) error { +func (suite *grpcQueryTestSuite) slashValidator(address sdk.ValAddress, slashFraction sdkmath.LegacyDec) error { stakingKeeper := suite.App.GetStakingKeeper() - validator, found := stakingKeeper.GetValidator(suite.Ctx, address) - suite.Require().True(found) + validator, err := stakingKeeper.GetValidator(suite.Ctx, address) + suite.Require().NoError(err) consAddr, err := validator.GetConsAddr() suite.Require().NoError(err) @@ -900,6 +906,6 @@ func (suite *grpcQueryTestSuite) slashValidator(address sdk.ValAddress, slashFra } // bondDenom fetches the staking denom from the staking module. -func (suite *grpcQueryTestSuite) bondDenom() string { +func (suite *grpcQueryTestSuite) bondDenom() (string, error) { return suite.App.GetStakingKeeper().BondDenom(suite.Ctx) } diff --git a/x/earn/keeper/hooks.go b/x/earn/keeper/hooks.go index 36a33ce310..15e31077a0 100644 --- a/x/earn/keeper/hooks.go +++ b/x/earn/keeper/hooks.go @@ -1,6 +1,8 @@ package keeper import ( + "context" + sdkmath "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/kava-labs/kava/x/earn/types" @@ -11,10 +13,10 @@ var _ types.EarnHooks = Keeper{} // AfterVaultDepositCreated - call hook if registered func (k Keeper) AfterVaultDepositCreated( - ctx sdk.Context, + ctx context.Context, vaultDenom string, depositor sdk.AccAddress, - sharesOwned sdk.Dec, + sharesOwned sdkmath.LegacyDec, ) { if k.hooks != nil { k.hooks.AfterVaultDepositCreated(ctx, vaultDenom, depositor, sharesOwned) @@ -23,10 +25,10 @@ func (k Keeper) AfterVaultDepositCreated( // BeforeVaultDepositModified - call hook if registered func (k Keeper) BeforeVaultDepositModified( - ctx sdk.Context, + ctx context.Context, vaultDenom string, depositor sdk.AccAddress, - sharesOwned sdk.Dec, + sharesOwned sdkmath.LegacyDec, ) { if k.hooks != nil { k.hooks.BeforeVaultDepositModified(ctx, vaultDenom, depositor, sharesOwned) diff --git a/x/earn/keeper/hooks_test.go b/x/earn/keeper/hooks_test.go index 55d8b67361..d6cff5b7cb 100644 --- a/x/earn/keeper/hooks_test.go +++ b/x/earn/keeper/hooks_test.go @@ -58,7 +58,7 @@ func (suite *hookTestSuite) TestHooks_DepositAndWithdraw() { suite.Ctx, acc1deposit1Amount.Denom, acc.GetAddress(), - sdk.NewDecFromInt(acc1deposit1Amount.Amount), + sdkmath.LegacyNewDecFromInt(acc1deposit1Amount.Amount), ).Once() err := suite.Keeper.Deposit( suite.Ctx, @@ -75,7 +75,7 @@ func (suite *hookTestSuite) TestHooks_DepositAndWithdraw() { suite.Ctx, acc1deposit1Amount.Denom, acc.GetAddress(), - sdk.NewDecFromInt(acc1deposit1Amount.Amount), + sdkmath.LegacyNewDecFromInt(acc1deposit1Amount.Amount), ).Once() err = suite.Keeper.Deposit( suite.Ctx, @@ -115,7 +115,7 @@ func (suite *hookTestSuite) TestHooks_DepositAndWithdraw() { suite.Ctx, acc1deposit2Amount.Denom, acc.GetAddress(), - sdk.NewDecFromInt(acc1deposit2Amount.Amount), + sdkmath.LegacyNewDecFromInt(acc1deposit2Amount.Amount), ).Once() err = suite.Keeper.Deposit( suite.Ctx, @@ -131,7 +131,7 @@ func (suite *hookTestSuite) TestHooks_DepositAndWithdraw() { suite.Ctx, acc1deposit2Amount.Denom, acc.GetAddress(), - sdk.NewDecFromInt(acc1deposit2Amount.Amount), + sdkmath.LegacyNewDecFromInt(acc1deposit2Amount.Amount), ).Once() err = suite.Keeper.Deposit( suite.Ctx, @@ -174,7 +174,7 @@ func (suite *hookTestSuite) TestHooks_DepositAndWithdraw() { suite.Ctx, acc2deposit1Amount.Denom, acc2.GetAddress(), - sdk.NewDecFromInt(acc2deposit1Amount.Amount), + sdkmath.LegacyNewDecFromInt(acc2deposit1Amount.Amount), ).Once() err = suite.Keeper.Deposit( suite.Ctx, @@ -192,7 +192,7 @@ func (suite *hookTestSuite) TestHooks_DepositAndWithdraw() { suite.Ctx, acc2deposit1Amount.Denom, acc2.GetAddress(), - sdk.NewDecFromInt(acc2deposit1Amount.Amount), + sdkmath.LegacyNewDecFromInt(acc2deposit1Amount.Amount), ).Once() err = suite.Keeper.Deposit( suite.Ctx, @@ -232,7 +232,7 @@ func (suite *hookTestSuite) TestHooks_DepositAndWithdraw() { suite.Ctx, acc2deposit2Amount.Denom, acc2.GetAddress(), - sdk.NewDecFromInt(acc2deposit2Amount.Amount), + sdkmath.LegacyNewDecFromInt(acc2deposit2Amount.Amount), ).Once() err = suite.Keeper.Deposit( suite.Ctx, @@ -248,7 +248,7 @@ func (suite *hookTestSuite) TestHooks_DepositAndWithdraw() { suite.Ctx, acc2deposit2Amount.Denom, acc2.GetAddress(), - sdk.NewDecFromInt(acc2deposit2Amount.Amount), + sdkmath.LegacyNewDecFromInt(acc2deposit2Amount.Amount), ).Once() err = suite.Keeper.Deposit( suite.Ctx, @@ -508,20 +508,20 @@ func (suite *hookTestSuite) TestHooks_HookOrdering() { acc := suite.CreateAccount(sdk.NewCoins(startBalance), 0) - earnHooks.On("AfterVaultDepositCreated", suite.Ctx, depositAmount.Denom, acc.GetAddress(), sdk.NewDecFromInt(depositAmount.Amount)). + earnHooks.On("AfterVaultDepositCreated", suite.Ctx, depositAmount.Denom, acc.GetAddress(), sdkmath.LegacyNewDecFromInt(depositAmount.Amount)). Run(func(args mock.Arguments) { shares, found := suite.Keeper.GetVaultAccountShares(suite.Ctx, acc.GetAddress()) suite.Require().True(found, "expected after hook to be called after shares are updated") - suite.Require().Equal(sdk.NewDecFromInt(depositAmount.Amount), shares.AmountOf(depositAmount.Denom)) + suite.Require().Equal(sdkmath.LegacyNewDecFromInt(depositAmount.Amount), shares.AmountOf(depositAmount.Denom)) }) err := suite.Keeper.Deposit(suite.Ctx, acc.GetAddress(), depositAmount, types.STRATEGY_TYPE_HARD) suite.Require().NoError(err) - earnHooks.On("BeforeVaultDepositModified", suite.Ctx, depositAmount.Denom, acc.GetAddress(), sdk.NewDecFromInt(depositAmount.Amount)). + earnHooks.On("BeforeVaultDepositModified", suite.Ctx, depositAmount.Denom, acc.GetAddress(), sdkmath.LegacyNewDecFromInt(depositAmount.Amount)). Run(func(args mock.Arguments) { shares, found := suite.Keeper.GetVaultAccountShares(suite.Ctx, acc.GetAddress()) suite.Require().True(found, "expected after hook to be called after shares are updated") - suite.Require().Equal(sdk.NewDecFromInt(depositAmount.Amount), shares.AmountOf(depositAmount.Denom)) + suite.Require().Equal(sdkmath.LegacyNewDecFromInt(depositAmount.Amount), shares.AmountOf(depositAmount.Denom)) }) err = suite.Keeper.Deposit(suite.Ctx, acc.GetAddress(), depositAmount, types.STRATEGY_TYPE_HARD) suite.Require().NoError(err) @@ -532,7 +532,7 @@ func (suite *hookTestSuite) TestHooks_HookOrdering() { Run(func(args mock.Arguments) { shares, found := suite.Keeper.GetVaultAccountShares(suite.Ctx, acc.GetAddress()) suite.Require().True(found, "expected after hook to be called after shares are updated") - suite.Require().Equal(sdk.NewDecFromInt(depositAmount.Amount.MulRaw(2)), shares.AmountOf(depositAmount.Denom)) + suite.Require().Equal(sdkmath.LegacyNewDecFromInt(depositAmount.Amount.MulRaw(2)), shares.AmountOf(depositAmount.Denom)) }) _, err = suite.Keeper.Withdraw(suite.Ctx, acc.GetAddress(), depositAmount, types.STRATEGY_TYPE_HARD) suite.Require().NoError(err) diff --git a/x/earn/keeper/invariants.go b/x/earn/keeper/invariants.go index 880921e8c0..ee8953718d 100644 --- a/x/earn/keeper/invariants.go +++ b/x/earn/keeper/invariants.go @@ -1,6 +1,7 @@ package keeper import ( + sdkmath "cosmossdk.io/math" "github.com/kava-labs/kava/x/earn/types" sdk "github.com/cosmos/cosmos-sdk/types" @@ -81,7 +82,7 @@ func VaultSharesInvariant(k Keeper) sdk.Invariant { k.IterateVaultRecords(ctx, func(record types.VaultRecord) bool { totalShares[record.TotalShares.Denom] = vaultShares{ totalShares: record.TotalShares, - totalSharesOwned: types.NewVaultShare(record.TotalShares.Denom, sdk.ZeroDec()), + totalSharesOwned: types.NewVaultShare(record.TotalShares.Denom, sdkmath.LegacyZeroDec()), } return false @@ -94,7 +95,7 @@ func VaultSharesInvariant(k Keeper) sdk.Invariant { totalShares[share.Denom] = shares } else { totalShares[share.Denom] = vaultShares{ - totalShares: types.NewVaultShare(share.Denom, sdk.ZeroDec()), + totalShares: types.NewVaultShare(share.Denom, sdkmath.LegacyZeroDec()), totalSharesOwned: share, } } diff --git a/x/earn/keeper/invariants_test.go b/x/earn/keeper/invariants_test.go index cd0ebd4a95..18cb9e6d2f 100644 --- a/x/earn/keeper/invariants_test.go +++ b/x/earn/keeper/invariants_test.go @@ -35,25 +35,25 @@ func (suite *invariantTestSuite) SetupTest() { func (suite *invariantTestSuite) SetupValidState() { suite.Keeper.SetVaultRecord(suite.Ctx, types.NewVaultRecord( "usdx", - sdk.MustNewDecFromStr("100"), + sdkmath.LegacyMustNewDecFromStr("100"), )) suite.Keeper.SetVaultRecord(suite.Ctx, types.NewVaultRecord( "ukava", - sdk.MustNewDecFromStr("250.123456"), + sdkmath.LegacyMustNewDecFromStr("250.123456"), )) vaultShare1 := types.NewVaultShareRecord( suite.addrs[0], types.NewVaultShares( - types.NewVaultShare("usdx", sdk.MustNewDecFromStr("50")), - types.NewVaultShare("ukava", sdk.MustNewDecFromStr("105.123")), + types.NewVaultShare("usdx", sdkmath.LegacyMustNewDecFromStr("50")), + types.NewVaultShare("ukava", sdkmath.LegacyMustNewDecFromStr("105.123")), ), ) vaultShare2 := types.NewVaultShareRecord( suite.addrs[1], types.NewVaultShares( - types.NewVaultShare("usdx", sdk.MustNewDecFromStr("50")), - types.NewVaultShare("ukava", sdk.MustNewDecFromStr("145.000456")), + types.NewVaultShare("usdx", sdkmath.LegacyMustNewDecFromStr("50")), + types.NewVaultShare("ukava", sdkmath.LegacyMustNewDecFromStr("145.000456")), ), ) @@ -114,7 +114,7 @@ func (suite *invariantTestSuite) TestVaultRecordsInvariant() { suite.Keeper.SetVaultRecord(suite.Ctx, types.VaultRecord{ TotalShares: types.VaultShare{ Denom: "invalid denom", - Amount: sdk.MustNewDecFromStr("101"), + Amount: sdkmath.LegacyMustNewDecFromStr("101"), }, }) message, broken = suite.runInvariant("vault-records", keeper.VaultRecordsInvariant) @@ -137,8 +137,8 @@ func (suite *invariantTestSuite) TestShareRecordsInvariant() { suite.addrs[0], // Directly create vaultshares instead of NewVaultShares() to avoid sanitization types.VaultShares{ - types.NewVaultShare("ukava", sdk.MustNewDecFromStr("50")), - types.NewVaultShare("ukava", sdk.MustNewDecFromStr("105.123")), + types.NewVaultShare("ukava", sdkmath.LegacyMustNewDecFromStr("50")), + types.NewVaultShare("ukava", sdkmath.LegacyMustNewDecFromStr("105.123")), }, )) message, broken = suite.runInvariant("share-records", keeper.ShareRecordsInvariant) @@ -159,7 +159,7 @@ func (suite *invariantTestSuite) TestVaultSharesInvariant() { // broken when total shares are greater than depositor shares suite.Keeper.SetVaultRecord(suite.Ctx, types.NewVaultRecord( "usdx", - sdk.MustNewDecFromStr("101"), + sdkmath.LegacyMustNewDecFromStr("101"), )) message, broken = suite.runInvariant("vault-shares", keeper.VaultSharesInvariant) suite.Equal("earn: vault shares broken invariant\nvault shares do not match depositor shares\n", message) @@ -168,7 +168,7 @@ func (suite *invariantTestSuite) TestVaultSharesInvariant() { // broken when total shares are less than the depositor shares suite.Keeper.SetVaultRecord(suite.Ctx, types.NewVaultRecord( "usdx", - sdk.MustNewDecFromStr("99.999"), + sdkmath.LegacyMustNewDecFromStr("99.999"), )) message, broken = suite.runInvariant("vault-shares", keeper.VaultSharesInvariant) suite.Equal("earn: vault shares broken invariant\nvault shares do not match depositor shares\n", message) diff --git a/x/earn/keeper/keeper.go b/x/earn/keeper/keeper.go index c7a691d794..c3a4fc6164 100644 --- a/x/earn/keeper/keeper.go +++ b/x/earn/keeper/keeper.go @@ -1,8 +1,8 @@ package keeper import ( + storetypes "cosmossdk.io/store/types" "github.com/cosmos/cosmos-sdk/codec" - storetypes "github.com/cosmos/cosmos-sdk/store/types" "github.com/kava-labs/kava/x/earn/types" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" diff --git a/x/earn/keeper/msg_server_test.go b/x/earn/keeper/msg_server_test.go index 04efa27dac..ddd824183b 100644 --- a/x/earn/keeper/msg_server_test.go +++ b/x/earn/keeper/msg_server_test.go @@ -69,7 +69,7 @@ func (suite *msgServerTestSuite) TestDeposit() { sdk.NewAttribute(types.AttributeKeyVaultDenom, depositAmount.Denom), sdk.NewAttribute(types.AttributeKeyDepositor, acc.GetAddress().String()), // Shares 1:1 to amount - sdk.NewAttribute(types.AttributeKeyShares, sdk.NewDecFromInt(depositAmount.Amount).String()), + sdk.NewAttribute(types.AttributeKeyShares, sdkmath.LegacyNewDecFromInt(depositAmount.Amount).String()), sdk.NewAttribute(sdk.AttributeKeyAmount, depositAmount.Amount.String()), ), ) @@ -122,7 +122,7 @@ func (suite *msgServerTestSuite) TestWithdraw() { types.EventTypeVaultWithdraw, sdk.NewAttribute(types.AttributeKeyVaultDenom, depositAmount.Denom), sdk.NewAttribute(types.AttributeKeyOwner, acc.GetAddress().String()), - sdk.NewAttribute(types.AttributeKeyShares, sdk.NewDecFromInt(depositAmount.Amount).String()), + sdk.NewAttribute(types.AttributeKeyShares, sdkmath.LegacyNewDecFromInt(depositAmount.Amount).String()), sdk.NewAttribute(sdk.AttributeKeyAmount, depositAmount.Amount.String()), ), ) diff --git a/x/earn/keeper/strategy_hard.go b/x/earn/keeper/strategy_hard.go index b703435e70..26c33b0a2d 100644 --- a/x/earn/keeper/strategy_hard.go +++ b/x/earn/keeper/strategy_hard.go @@ -1,6 +1,7 @@ package keeper import ( + sdkmath "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/kava-labs/kava/x/earn/types" ) @@ -22,7 +23,7 @@ func (s *HardStrategy) GetEstimatedTotalAssets(ctx sdk.Context, denom string) (s deposit, found := s.hardKeeper.GetSyncedDeposit(ctx, macc.GetAddress()) if !found { // Return 0 if no deposit exists for module account - return sdk.NewCoin(denom, sdk.ZeroInt()), nil + return sdk.NewCoin(denom, sdkmath.ZeroInt()), nil } // Only return the deposit for the vault denom. @@ -33,7 +34,7 @@ func (s *HardStrategy) GetEstimatedTotalAssets(ctx sdk.Context, denom string) (s } // Return 0 if no deposit exists for the vault denom - return sdk.NewCoin(denom, sdk.ZeroInt()), nil + return sdk.NewCoin(denom, sdkmath.ZeroInt()), nil } // Deposit deposits the specified amount of coins into hard. diff --git a/x/earn/keeper/strategy_hard_test.go b/x/earn/keeper/strategy_hard_test.go index a283763e41..d1f7438f15 100644 --- a/x/earn/keeper/strategy_hard_test.go +++ b/x/earn/keeper/strategy_hard_test.go @@ -47,7 +47,7 @@ func (suite *strategyHardTestSuite) TestDeposit_SingleAcc() { suite.HardDepositAmountEqual(sdk.NewCoins(depositAmount)) suite.VaultTotalValuesEqual(sdk.NewCoins(depositAmount)) suite.VaultTotalSharesEqual(types.NewVaultShares( - types.NewVaultShare(depositAmount.Denom, sdk.NewDecFromInt(depositAmount.Amount)), + types.NewVaultShare(depositAmount.Denom, sdkmath.LegacyNewDecFromInt(depositAmount.Amount)), )) // Query vault total @@ -77,7 +77,7 @@ func (suite *strategyHardTestSuite) TestDeposit_SingleAcc_MultipleDeposits() { suite.HardDepositAmountEqual(sdk.NewCoins(expectedVaultBalance)) suite.VaultTotalValuesEqual(sdk.NewCoins(expectedVaultBalance)) suite.VaultTotalSharesEqual(types.NewVaultShares( - types.NewVaultShare(expectedVaultBalance.Denom, sdk.NewDecFromInt(expectedVaultBalance.Amount)), + types.NewVaultShare(expectedVaultBalance.Denom, sdkmath.LegacyNewDecFromInt(expectedVaultBalance.Amount)), )) // Query vault total @@ -113,7 +113,7 @@ func (suite *strategyHardTestSuite) TestDeposit_MultipleAcc_MultipleDeposits() { suite.HardDepositAmountEqual(sdk.NewCoins(expectedTotalValue)) suite.VaultTotalValuesEqual(sdk.NewCoins(expectedTotalValue)) suite.VaultTotalSharesEqual(types.NewVaultShares( - types.NewVaultShare(expectedTotalValue.Denom, sdk.NewDecFromInt(expectedTotalValue.Amount)), + types.NewVaultShare(expectedTotalValue.Denom, sdkmath.LegacyNewDecFromInt(expectedTotalValue.Amount)), )) // Query vault total @@ -132,7 +132,7 @@ func (suite *strategyHardTestSuite) TestGetVaultTotalValue_Empty() { totalValue, err := suite.Keeper.GetVaultTotalValue(suite.Ctx, vaultDenom) suite.Require().NoError(err) - suite.Equal(sdk.NewCoin(vaultDenom, sdk.ZeroInt()), totalValue) + suite.Equal(sdk.NewCoin(vaultDenom, sdkmath.ZeroInt()), totalValue) } func (suite *strategyHardTestSuite) TestGetVaultTotalValue_NoDenomDeposit() { @@ -160,7 +160,7 @@ func (suite *strategyHardTestSuite) TestGetVaultTotalValue_NoDenomDeposit() { totalValueBusd, err := suite.Keeper.GetVaultTotalValue(suite.Ctx, vaultDenomBusd) suite.Require().NoError(err) - suite.Equal(sdk.NewCoin(vaultDenomBusd, sdk.ZeroInt()), totalValueBusd) + suite.Equal(sdk.NewCoin(vaultDenomBusd, sdkmath.ZeroInt()), totalValueBusd) } // ---------------------------------------------------------------------------- @@ -312,7 +312,7 @@ func (suite *strategyHardTestSuite) TestAccountShares() { acc1Shares, found := suite.Keeper.GetVaultAccountShares(suite.Ctx, acc1) suite.Require().True(found) - suite.Equal(sdk.NewDec(100), acc1Shares.AmountOf(vaultDenom), "initial deposit 1:1 shares") + suite.Equal(sdkmath.LegacyNewDec(100), acc1Shares.AmountOf(vaultDenom), "initial deposit 1:1 shares") // 2. Direct hard deposit from module account to increase vault value // Total value: 100 -> 110 @@ -340,12 +340,12 @@ func (suite *strategyHardTestSuite) TestAccountShares() { suite.Require().True(found) // 100 * 100 / 110 = 190.909090909090909091 // QuoInt64() truncates - expectedAcc2Shares := sdk.NewDec(100).MulInt64(100).QuoInt64(110) + expectedAcc2Shares := sdkmath.LegacyNewDec(100).MulInt64(100).QuoInt64(110) suite.Equal(expectedAcc2Shares, acc2Shares.AmountOf(vaultDenom)) vaultTotalShares, found := suite.Keeper.GetVaultTotalShares(suite.Ctx, vaultDenom) suite.Require().True(found) - suite.Equal(sdk.NewDec(100).Add(expectedAcc2Shares), vaultTotalShares.Amount) + suite.Equal(sdkmath.LegacyNewDec(100).Add(expectedAcc2Shares), vaultTotalShares.Amount) // Hard deposit again from module account to triple original value // 210 -> 300 @@ -364,7 +364,7 @@ func (suite *strategyHardTestSuite) TestAccountShares() { // sharedIssued = 100 * 190 / 300 = 63.3 = 63 // total shares = 100 + 63 = 163 suite.Equal( - sdk.NewDec(100).Add(sdk.NewDec(100).Mul(vaultTotalShares.Amount).Quo(sdk.NewDec(300))), + sdkmath.LegacyNewDec(100).Add(sdkmath.LegacyNewDec(100).Mul(vaultTotalShares.Amount).Quo(sdkmath.LegacyNewDec(300))), acc1Shares.AmountOf(vaultDenom), "shares should consist of 100 of 1x share price and 63 of 3x share price", ) @@ -393,7 +393,7 @@ func (suite *strategyHardTestSuite) TestWithdraw_AccumulatedAmount() { acc1Shares, found := suite.Keeper.GetVaultAccountShares(suite.Ctx, acc1) suite.Require().True(found) - suite.Equal(sdk.NewDec(100), acc1Shares.AmountOf(vaultDenom), "initial deposit 1:1 shares") + suite.Equal(sdkmath.LegacyNewDec(100), acc1Shares.AmountOf(vaultDenom), "initial deposit 1:1 shares") // 2. Direct hard deposit from module account to increase vault value // Total value: 200 -> 220, 110 each account @@ -432,7 +432,7 @@ func (suite *strategyHardTestSuite) TestWithdraw_AccumulatedTruncated() { acc1Shares, found := suite.Keeper.GetVaultAccountShares(suite.Ctx, acc1) suite.Require().True(found) - suite.Equal(sdk.NewDec(100), acc1Shares.AmountOf(vaultDenom), "initial deposit 1:1 shares") + suite.Equal(sdkmath.LegacyNewDec(100), acc1Shares.AmountOf(vaultDenom), "initial deposit 1:1 shares") // 2. Direct hard deposit from module account to increase vault value // Total value: 200 -> 211, 105.5 each account @@ -473,7 +473,7 @@ func (suite *strategyHardTestSuite) TestWithdraw_ExpensiveShares() { acc1Shares, found := suite.Keeper.GetVaultAccountShares(suite.Ctx, acc1) suite.Require().True(found) - suite.Equal(sdk.NewDec(100), acc1Shares.AmountOf(vaultDenom), "initial deposit 1:1 shares") + suite.Equal(sdkmath.LegacyNewDec(100), acc1Shares.AmountOf(vaultDenom), "initial deposit 1:1 shares") // 2. Direct hard deposit from module account to increase vault value // Total value: 100 -> 2000, shares now 10usdx each diff --git a/x/earn/keeper/strategy_savings.go b/x/earn/keeper/strategy_savings.go index c5955e674c..dcf6985c09 100644 --- a/x/earn/keeper/strategy_savings.go +++ b/x/earn/keeper/strategy_savings.go @@ -1,6 +1,7 @@ package keeper import ( + sdkmath "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/kava-labs/kava/x/earn/types" ) @@ -22,7 +23,7 @@ func (s *SavingsStrategy) GetEstimatedTotalAssets(ctx sdk.Context, denom string) deposit, found := s.savingsKeeper.GetDeposit(ctx, macc.GetAddress()) if !found { // Return 0 if no deposit exists for module account - return sdk.NewCoin(denom, sdk.ZeroInt()), nil + return sdk.NewCoin(denom, sdkmath.ZeroInt()), nil } // Only return the deposit for the vault denom. @@ -33,7 +34,7 @@ func (s *SavingsStrategy) GetEstimatedTotalAssets(ctx sdk.Context, denom string) } // Return 0 if no deposit exists for the vault denom - return sdk.NewCoin(denom, sdk.ZeroInt()), nil + return sdk.NewCoin(denom, sdkmath.ZeroInt()), nil } // Deposit deposits the specified amount of coins into savings. diff --git a/x/earn/keeper/strategy_savings_test.go b/x/earn/keeper/strategy_savings_test.go index 72ad8d243d..5cfaf8cef5 100644 --- a/x/earn/keeper/strategy_savings_test.go +++ b/x/earn/keeper/strategy_savings_test.go @@ -48,7 +48,7 @@ func (suite *strategySavingsTestSuite) TestDeposit_SingleAcc() { suite.SavingsDepositAmountEqual(sdk.NewCoins(depositAmount)) suite.VaultTotalValuesEqual(sdk.NewCoins(depositAmount)) suite.VaultTotalSharesEqual(types.NewVaultShares( - types.NewVaultShare(depositAmount.Denom, sdk.NewDecFromInt(depositAmount.Amount)), + types.NewVaultShare(depositAmount.Denom, sdkmath.LegacyNewDecFromInt(depositAmount.Amount)), )) // Query vault total @@ -77,7 +77,7 @@ func (suite *strategySavingsTestSuite) TestDeposit_SingleAcc_MultipleDeposits() suite.SavingsDepositAmountEqual(sdk.NewCoins(expectedVaultBalance)) suite.VaultTotalValuesEqual(sdk.NewCoins(expectedVaultBalance)) suite.VaultTotalSharesEqual(types.NewVaultShares( - types.NewVaultShare(expectedVaultBalance.Denom, sdk.NewDecFromInt(expectedVaultBalance.Amount)), + types.NewVaultShare(expectedVaultBalance.Denom, sdkmath.LegacyNewDecFromInt(expectedVaultBalance.Amount)), )) // Query vault total @@ -112,7 +112,7 @@ func (suite *strategySavingsTestSuite) TestDeposit_MultipleAcc_MultipleDeposits( suite.SavingsDepositAmountEqual(sdk.NewCoins(expectedTotalValue)) suite.VaultTotalValuesEqual(sdk.NewCoins(expectedTotalValue)) suite.VaultTotalSharesEqual(types.NewVaultShares( - types.NewVaultShare(expectedTotalValue.Denom, sdk.NewDecFromInt(expectedTotalValue.Amount)), + types.NewVaultShare(expectedTotalValue.Denom, sdkmath.LegacyNewDecFromInt(expectedTotalValue.Amount)), )) // Query vault total @@ -129,7 +129,7 @@ func (suite *strategySavingsTestSuite) TestGetVaultTotalValue_Empty() { totalValue, err := suite.Keeper.GetVaultTotalValue(suite.Ctx, savingsVaultDenom) suite.Require().NoError(err) - suite.Equal(sdk.NewCoin(savingsVaultDenom, sdk.ZeroInt()), totalValue) + suite.Equal(sdk.NewCoin(savingsVaultDenom, sdkmath.ZeroInt()), totalValue) } func (suite *strategySavingsTestSuite) TestGetVaultTotalValue_NoDenomDeposit() { @@ -157,7 +157,7 @@ func (suite *strategySavingsTestSuite) TestGetVaultTotalValue_NoDenomDeposit() { totalValueBusd, err := suite.Keeper.GetVaultTotalValue(suite.Ctx, vaultDenomBusd) suite.Require().NoError(err) - suite.Equal(sdk.NewCoin(vaultDenomBusd, sdk.ZeroInt()), totalValueBusd) + suite.Equal(sdk.NewCoin(vaultDenomBusd, sdkmath.ZeroInt()), totalValueBusd) } // ---------------------------------------------------------------------------- @@ -305,7 +305,7 @@ func (suite *strategySavingsTestSuite) TestAccountShares() { acc1Shares, found := suite.Keeper.GetVaultAccountShares(suite.Ctx, acc1) suite.Require().True(found) - suite.Equal(sdk.NewDec(100), acc1Shares.AmountOf(savingsVaultDenom), "initial deposit 1:1 shares") + suite.Equal(sdkmath.LegacyNewDec(100), acc1Shares.AmountOf(savingsVaultDenom), "initial deposit 1:1 shares") // 2. Direct savings deposit from module account to increase vault value // Total value: 100 -> 110 @@ -333,12 +333,12 @@ func (suite *strategySavingsTestSuite) TestAccountShares() { suite.Require().True(found) // 100 * 100 / 110 = 90.909090909090909091 // QuoInt64() truncates - expectedAcc2Shares := sdk.NewDec(100).MulInt64(100).QuoInt64(110) + expectedAcc2Shares := sdkmath.LegacyNewDec(100).MulInt64(100).QuoInt64(110) suite.Equal(expectedAcc2Shares, acc2Shares.AmountOf(savingsVaultDenom)) vaultTotalShares, found := suite.Keeper.GetVaultTotalShares(suite.Ctx, savingsVaultDenom) suite.Require().True(found) - suite.Equal(sdk.NewDec(100).Add(expectedAcc2Shares), vaultTotalShares.Amount) + suite.Equal(sdkmath.LegacyNewDec(100).Add(expectedAcc2Shares), vaultTotalShares.Amount) // Savings deposit again from module account to triple original value // 210 -> 300 @@ -357,7 +357,7 @@ func (suite *strategySavingsTestSuite) TestAccountShares() { // sharedIssued = 100 * 190 / 300 = 63.3 = 63 // total shares = 100 + 63 = 163 suite.Equal( - sdk.NewDec(100).Add(sdk.NewDec(100).Mul(vaultTotalShares.Amount).Quo(sdk.NewDec(300))), + sdkmath.LegacyNewDec(100).Add(sdkmath.LegacyNewDec(100).Mul(vaultTotalShares.Amount).Quo(sdkmath.LegacyNewDec(300))), acc1Shares.AmountOf(savingsVaultDenom), "shares should consist of 100 of 1x share price and 63 of 3x share price", ) @@ -385,7 +385,7 @@ func (suite *strategySavingsTestSuite) TestWithdraw_AccumulatedAmount() { acc1Shares, found := suite.Keeper.GetVaultAccountShares(suite.Ctx, acc1) suite.Require().True(found) - suite.Equal(sdk.NewDec(100), acc1Shares.AmountOf(savingsVaultDenom), "initial deposit 1:1 shares") + suite.Equal(sdkmath.LegacyNewDec(100), acc1Shares.AmountOf(savingsVaultDenom), "initial deposit 1:1 shares") // 2. Direct savings deposit from module account to increase vault value // Total value: 200 -> 220, 110 each account @@ -423,7 +423,7 @@ func (suite *strategySavingsTestSuite) TestWithdraw_AccumulatedTruncated() { acc1Shares, found := suite.Keeper.GetVaultAccountShares(suite.Ctx, acc1) suite.Require().True(found) - suite.Equal(sdk.NewDec(100), acc1Shares.AmountOf(savingsVaultDenom), "initial deposit 1:1 shares") + suite.Equal(sdkmath.LegacyNewDec(100), acc1Shares.AmountOf(savingsVaultDenom), "initial deposit 1:1 shares") // 2. Direct savings deposit from module account to increase vault value // Total value: 200 -> 211, 105.5 each account @@ -463,7 +463,7 @@ func (suite *strategySavingsTestSuite) TestWithdraw_ExpensiveShares() { acc1Shares, found := suite.Keeper.GetVaultAccountShares(suite.Ctx, acc1) suite.Require().True(found) - suite.Equal(sdk.NewDec(100), acc1Shares.AmountOf(savingsVaultDenom), "initial deposit 1:1 shares") + suite.Equal(sdkmath.LegacyNewDec(100), acc1Shares.AmountOf(savingsVaultDenom), "initial deposit 1:1 shares") // 2. Direct savings deposit from module account to increase vault value // Total value: 100 -> 2000, shares now 10usdx each diff --git a/x/earn/keeper/vault_record.go b/x/earn/keeper/vault_record.go index 9a7eb29db7..1a0e4b4273 100644 --- a/x/earn/keeper/vault_record.go +++ b/x/earn/keeper/vault_record.go @@ -1,7 +1,8 @@ package keeper import ( - "github.com/cosmos/cosmos-sdk/store/prefix" + "cosmossdk.io/store/prefix" + storetypes "cosmossdk.io/store/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/kava-labs/kava/x/earn/types" ) @@ -60,7 +61,7 @@ func (k Keeper) IterateVaultRecords( cb func(record types.VaultRecord) (stop bool), ) { store := prefix.NewStore(ctx.KVStore(k.key), types.VaultRecordKeyPrefix) - iterator := sdk.KVStorePrefixIterator(store, []byte{}) + iterator := storetypes.KVStorePrefixIterator(store, []byte{}) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { diff --git a/x/earn/keeper/vault_share.go b/x/earn/keeper/vault_share.go index 36f3c608b0..2721136487 100644 --- a/x/earn/keeper/vault_share.go +++ b/x/earn/keeper/vault_share.go @@ -1,6 +1,7 @@ package keeper import ( + sdkmath "cosmossdk.io/math" "fmt" sdk "github.com/cosmos/cosmos-sdk/types" @@ -12,7 +13,7 @@ func (k *Keeper) ConvertToShares(ctx sdk.Context, assets sdk.Coin) (types.VaultS totalShares, found := k.GetVaultTotalShares(ctx, assets.Denom) if !found { // No shares issued yet, so shares are issued 1:1 - return types.NewVaultShare(assets.Denom, sdk.NewDecFromInt(assets.Amount)), nil + return types.NewVaultShare(assets.Denom, sdkmath.LegacyNewDecFromInt(assets.Amount)), nil } totalValue, err := k.GetVaultTotalValue(ctx, assets.Denom) @@ -40,7 +41,7 @@ func (k *Keeper) ConvertToShares(ctx sdk.Context, assets sdk.Coin) (types.VaultS // 100 * 100 / 105 == 10000 / 105 == 95.238095238095238095 // 100 * (100 / 105) == 100 * 0.952380952380952380 == 95.238095238095238000 // rounded down and truncated ^ loss of precision ^ - issuedShares := sdk.NewDecFromInt(assets.Amount).Mul(totalShares.Amount).QuoTruncate(sdk.NewDecFromInt(totalValue.Amount)) + issuedShares := sdkmath.LegacyNewDecFromInt(assets.Amount).Mul(totalShares.Amount).QuoTruncate(sdkmath.LegacyNewDecFromInt(totalValue.Amount)) if issuedShares.IsZero() { return types.VaultShare{}, fmt.Errorf("share count is zero") @@ -65,7 +66,7 @@ func (k *Keeper) ConvertToAssets(ctx sdk.Context, share types.VaultShare) (sdk.C // accValue := totalValue * percentOwnership // accValue := totalValue * accShares / totalVaultShares // Division must be last to avoid rounding errors and properly truncate. - value := sdk.NewDecFromInt(totalValue.Amount).Mul(share.Amount).QuoTruncate(totalVaultShares.Amount) + value := sdkmath.LegacyNewDecFromInt(totalValue.Amount).Mul(share.Amount).QuoTruncate(totalVaultShares.Amount) return sdk.NewCoin(share.Denom, value.TruncateInt()), nil } diff --git a/x/earn/keeper/vault_share_record.go b/x/earn/keeper/vault_share_record.go index 0358539718..91f76b6461 100644 --- a/x/earn/keeper/vault_share_record.go +++ b/x/earn/keeper/vault_share_record.go @@ -1,7 +1,8 @@ package keeper import ( - "github.com/cosmos/cosmos-sdk/store/prefix" + "cosmossdk.io/store/prefix" + storetypes "cosmossdk.io/store/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/kava-labs/kava/x/earn/types" ) @@ -68,7 +69,7 @@ func (k Keeper) IterateVaultShareRecords( cb func(record types.VaultShareRecord) (stop bool), ) { store := prefix.NewStore(ctx.KVStore(k.key), types.VaultShareRecordKeyPrefix) - iterator := sdk.KVStorePrefixIterator(store, []byte{}) + iterator := storetypes.KVStorePrefixIterator(store, []byte{}) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { diff --git a/x/earn/keeper/vault_share_record_test.go b/x/earn/keeper/vault_share_record_test.go index 89eb480632..b3ba08c5a0 100644 --- a/x/earn/keeper/vault_share_record_test.go +++ b/x/earn/keeper/vault_share_record_test.go @@ -9,7 +9,7 @@ import ( // State methods func (suite *vaultTestSuite) TestGetVaultRecord() { - record := types.NewVaultRecord("usdx", sdk.ZeroDec()) + record := types.NewVaultRecord("usdx", sdkmath.LegacyZeroDec()) _, found := suite.Keeper.GetVaultRecord(suite.Ctx, record.TotalShares.Denom) suite.Require().False(found) @@ -22,9 +22,9 @@ func (suite *vaultTestSuite) TestGetVaultRecord() { } func (suite *vaultTestSuite) TestUpdateVaultRecord() { - record := types.NewVaultRecord("usdx", sdk.ZeroDec()) + record := types.NewVaultRecord("usdx", sdkmath.LegacyZeroDec()) - record.TotalShares = types.NewVaultShare("usdx", sdk.NewDec(100)) + record.TotalShares = types.NewVaultShare("usdx", sdkmath.LegacyNewDec(100)) // Update vault suite.Keeper.UpdateVaultRecord(suite.Ctx, record) @@ -34,7 +34,7 @@ func (suite *vaultTestSuite) TestUpdateVaultRecord() { suite.Require().Equal(record, stateRecord) // Remove supply - record.TotalShares = types.NewVaultShare("usdx", sdk.NewDec(0)) + record.TotalShares = types.NewVaultShare("usdx", sdkmath.LegacyNewDec(0)) suite.Keeper.UpdateVaultRecord(suite.Ctx, record) _, found = suite.Keeper.GetVaultRecord(suite.Ctx, record.TotalShares.Denom) @@ -55,7 +55,7 @@ func (suite *vaultTestSuite) TestGetVaultShareRecord() { // Update share record record.Shares = types.NewVaultShares( - types.NewVaultShare(vaultDenom, sdk.NewDec(100)), + types.NewVaultShare(vaultDenom, sdkmath.LegacyNewDec(100)), ) suite.Keeper.SetVaultShareRecord(suite.Ctx, record) @@ -71,7 +71,7 @@ func (suite *vaultTestSuite) TestUpdateVaultShareRecord() { acc := suite.CreateAccount(sdk.NewCoins(startBalance), 0) record := types.NewVaultShareRecord(acc.GetAddress(), types.NewVaultShares( - types.NewVaultShare(vaultDenom, sdk.NewDec(100)), + types.NewVaultShare(vaultDenom, sdkmath.LegacyNewDec(100)), )) // Update vault diff --git a/x/earn/keeper/vault_share_test.go b/x/earn/keeper/vault_share_test.go index 8cefd82a7f..bf2d6a89f8 100644 --- a/x/earn/keeper/vault_share_test.go +++ b/x/earn/keeper/vault_share_test.go @@ -38,7 +38,7 @@ func (suite *vaultShareTestSuite) TestConvertToShares() { name: "initial 1:1", beforeConvert: func() {}, giveAmount: sdk.NewCoin(vaultDenom, sdkmath.NewInt(100)), - wantShares: types.NewVaultShare(vaultDenom, sdk.NewDec(100)), + wantShares: types.NewVaultShare(vaultDenom, sdkmath.LegacyNewDec(100)), }, { name: "value doubled", @@ -47,20 +47,20 @@ func (suite *vaultShareTestSuite) TestConvertToShares() { // set total shares set total value for hard // value is double than shares // shares is 2x price now - suite.addTotalShareAndValue(vaultDenom, sdk.NewDec(100), sdkmath.NewInt(200)) + suite.addTotalShareAndValue(vaultDenom, sdkmath.LegacyNewDec(100), sdkmath.NewInt(200)) }, giveAmount: sdk.NewCoin(vaultDenom, sdkmath.NewInt(100)), - wantShares: types.NewVaultShare(vaultDenom, sdk.NewDec(50)), + wantShares: types.NewVaultShare(vaultDenom, sdkmath.LegacyNewDec(50)), }, { name: "truncate", beforeConvert: func() { - suite.addTotalShareAndValue(vaultDenom, sdk.NewDec(1000), sdkmath.NewInt(1001)) + suite.addTotalShareAndValue(vaultDenom, sdkmath.LegacyNewDec(1000), sdkmath.NewInt(1001)) }, giveAmount: sdk.NewCoin(vaultDenom, sdkmath.NewInt(100)), // 100 * 100 / 101 = 99.0099something - wantShares: types.NewVaultShare(vaultDenom, sdk.NewDec(100).MulInt64(1000).QuoInt64(1001)), + wantShares: types.NewVaultShare(vaultDenom, sdkmath.LegacyNewDec(100).MulInt64(1000).QuoInt64(1001)), }, } @@ -89,14 +89,14 @@ func (suite *vaultShareTestSuite) TestConvertToShares() { func (suite *vaultShareTestSuite) addTotalShareAndValue( vaultDenom string, - vaultShares sdk.Dec, + vaultShares sdkmath.LegacyDec, hardDeposit sdkmath.Int, ) { macc := suite.AccountKeeper.GetModuleAccount(suite.Ctx, types.ModuleName) vaultRecord, found := suite.Keeper.GetVaultRecord(suite.Ctx, vaultDenom) if !found { - vaultRecord = types.NewVaultRecord(vaultDenom, sdk.ZeroDec()) + vaultRecord = types.NewVaultRecord(vaultDenom, sdkmath.LegacyZeroDec()) } // Add to vault record @@ -117,17 +117,17 @@ func (suite *vaultShareTestSuite) addTotalShareAndValue( } func TestPrecisionMulQuoOrder(t *testing.T) { - assetAmount := sdk.NewDec(100) - totalShares := sdk.NewDec(100) - totalValue := sdk.NewDec(105) + assetAmount := sdkmath.LegacyNewDec(100) + totalShares := sdkmath.LegacyNewDec(100) + totalValue := sdkmath.LegacyNewDec(105) // issuedShares = assetAmount * (totalValue / totalShares) // = (assetAmount * totalShares) / totalValue mulFirst := assetAmount.Mul(totalShares).QuoTruncate(totalValue) quoFirst := assetAmount.Mul(totalShares.QuoTruncate(totalValue)) - assert.Equal(t, sdk.MustNewDecFromStr("95.238095238095238095"), mulFirst) - assert.Equal(t, sdk.MustNewDecFromStr("95.238095238095238000"), quoFirst) + assert.Equal(t, sdkmath.LegacyMustNewDecFromStr("95.238095238095238095"), mulFirst) + assert.Equal(t, sdkmath.LegacyMustNewDecFromStr("95.238095238095238000"), quoFirst) assert.NotEqual(t, mulFirst, quoFirst) } diff --git a/x/earn/keeper/vault_test.go b/x/earn/keeper/vault_test.go index d15688805d..c17b9e2c85 100644 --- a/x/earn/keeper/vault_test.go +++ b/x/earn/keeper/vault_test.go @@ -39,7 +39,7 @@ func (suite *vaultTestSuite) TestGetVaultTotalShares() { vaultTotalShares, found := suite.Keeper.GetVaultTotalShares(suite.Ctx, vaultDenom) suite.Require().True(found) - suite.Equal(sdk.NewDecFromInt(depositAmount.Amount), vaultTotalShares.Amount) + suite.Equal(sdkmath.LegacyNewDecFromInt(depositAmount.Amount), vaultTotalShares.Amount) } func (suite *vaultTestSuite) TestGetVaultTotalShares_NotFound() { @@ -110,8 +110,8 @@ func (suite *vaultTestSuite) TestGetVaultAccountSupplied() { suite.Require().True(found) // Account supply only includes the deposit from respective accounts - suite.Equal(sdk.NewDecFromInt(deposit1Amount.Amount), vaultAcc1Supplied.Shares.AmountOf(vaultDenom)) - suite.Equal(sdk.NewDecFromInt(deposit1Amount.Amount), vaultAcc2Supplied.Shares.AmountOf(vaultDenom)) + suite.Equal(sdkmath.LegacyNewDecFromInt(deposit1Amount.Amount), vaultAcc1Supplied.Shares.AmountOf(vaultDenom)) + suite.Equal(sdkmath.LegacyNewDecFromInt(deposit1Amount.Amount), vaultAcc2Supplied.Shares.AmountOf(vaultDenom)) } func (suite *vaultTestSuite) TestGetVaultAccountValue() { diff --git a/x/earn/keeper/withdraw_test.go b/x/earn/keeper/withdraw_test.go index 4b8d0b4d1b..d7844ed190 100644 --- a/x/earn/keeper/withdraw_test.go +++ b/x/earn/keeper/withdraw_test.go @@ -78,7 +78,7 @@ func (suite *withdrawTestSuite) TestWithdraw_NoVaultShareRecord() { suite.VaultTotalValuesEqual(sdk.NewCoins(acc1DepositAmount)) suite.VaultTotalSharesEqual(types.NewVaultShares( - types.NewVaultShare(acc1DepositAmount.Denom, sdk.NewDecFromInt(acc1DepositAmount.Amount)), + types.NewVaultShare(acc1DepositAmount.Denom, sdkmath.LegacyNewDecFromInt(acc1DepositAmount.Amount)), )) } @@ -107,7 +107,7 @@ func (suite *withdrawTestSuite) TestWithdraw_ExceedBalance() { suite.VaultTotalValuesEqual(sdk.NewCoins(depositAmount)) suite.VaultTotalSharesEqual(types.NewVaultShares( - types.NewVaultShare(depositAmount.Denom, sdk.NewDecFromInt(depositAmount.Amount)), + types.NewVaultShare(depositAmount.Denom, sdkmath.LegacyNewDecFromInt(depositAmount.Amount)), )) } diff --git a/x/earn/module.go b/x/earn/module.go index 0337436411..2a1250e4fb 100644 --- a/x/earn/module.go +++ b/x/earn/module.go @@ -137,10 +137,15 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw } // BeginBlock module begin-block -func (am AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) { +func (am AppModule) BeginBlock(ctx sdk.Context) error { + return nil } // EndBlock module end-block -func (am AppModule) EndBlock(ctx sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { - return []abci.ValidatorUpdate{} +func (am AppModule) EndBlock(_ sdk.Context) ([]abci.ValidatorUpdate, error) { + return []abci.ValidatorUpdate{}, nil } + +func (AppModule) IsOnePerModuleType() {} + +func (AppModule) IsAppModule() {} diff --git a/x/earn/testutil/suite.go b/x/earn/testutil/suite.go index 063dca4177..aec4feae61 100644 --- a/x/earn/testutil/suite.go +++ b/x/earn/testutil/suite.go @@ -23,7 +23,6 @@ import ( tmtime "github.com/cometbft/cometbft/types/time" sdk "github.com/cosmos/cosmos-sdk/types" authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" banktestutil "github.com/cosmos/cosmos-sdk/x/bank/testutil" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" @@ -67,19 +66,19 @@ func (suite *Suite) SetupTest() { { MarketID: "usdx:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("1.00"), + Price: sdkmath.LegacyMustNewDecFromStr("1.00"), Expiry: time.Now().Add(100 * time.Hour), }, { MarketID: "kava:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("2.00"), + Price: sdkmath.LegacyMustNewDecFromStr("2.00"), Expiry: time.Now().Add(100 * time.Hour), }, { MarketID: "bnb:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("10.00"), + Price: sdkmath.LegacyMustNewDecFromStr("10.00"), Expiry: time.Now().Add(100 * time.Hour), }, }, @@ -91,58 +90,58 @@ func (suite *Suite) SetupTest() { "usdx", hardtypes.NewBorrowLimit( true, - sdk.MustNewDecFromStr("20000000"), - sdk.MustNewDecFromStr("1"), + sdkmath.LegacyMustNewDecFromStr("20000000"), + sdkmath.LegacyMustNewDecFromStr("1"), ), "usdx:usd", sdkmath.NewInt(1000000), hardtypes.NewInterestRateModel( - sdk.MustNewDecFromStr("0.05"), - sdk.MustNewDecFromStr("2"), - sdk.MustNewDecFromStr("0.8"), - sdk.MustNewDecFromStr("10"), + sdkmath.LegacyMustNewDecFromStr("0.05"), + sdkmath.LegacyMustNewDecFromStr("2"), + sdkmath.LegacyMustNewDecFromStr("0.8"), + sdkmath.LegacyMustNewDecFromStr("10"), ), - sdk.MustNewDecFromStr("0.05"), - sdk.ZeroDec(), + sdkmath.LegacyMustNewDecFromStr("0.05"), + sdkmath.LegacyZeroDec(), ), hardtypes.NewMoneyMarket( "busd", hardtypes.NewBorrowLimit( true, - sdk.MustNewDecFromStr("20000000"), - sdk.MustNewDecFromStr("1"), + sdkmath.LegacyMustNewDecFromStr("20000000"), + sdkmath.LegacyMustNewDecFromStr("1"), ), "busd:usd", sdkmath.NewInt(1000000), hardtypes.NewInterestRateModel( - sdk.MustNewDecFromStr("0.05"), - sdk.MustNewDecFromStr("2"), - sdk.MustNewDecFromStr("0.8"), - sdk.MustNewDecFromStr("10"), + sdkmath.LegacyMustNewDecFromStr("0.05"), + sdkmath.LegacyMustNewDecFromStr("2"), + sdkmath.LegacyMustNewDecFromStr("0.8"), + sdkmath.LegacyMustNewDecFromStr("10"), ), - sdk.MustNewDecFromStr("0.05"), - sdk.ZeroDec(), + sdkmath.LegacyMustNewDecFromStr("0.05"), + sdkmath.LegacyZeroDec(), ), hardtypes.NewMoneyMarket( "kava", hardtypes.NewBorrowLimit( true, - sdk.MustNewDecFromStr("20000000"), - sdk.MustNewDecFromStr("1"), + sdkmath.LegacyMustNewDecFromStr("20000000"), + sdkmath.LegacyMustNewDecFromStr("1"), ), "kava:usd", sdkmath.NewInt(1000000), hardtypes.NewInterestRateModel( - sdk.MustNewDecFromStr("0.05"), - sdk.MustNewDecFromStr("2"), - sdk.MustNewDecFromStr("0.8"), - sdk.MustNewDecFromStr("10"), + sdkmath.LegacyMustNewDecFromStr("0.05"), + sdkmath.LegacyMustNewDecFromStr("2"), + sdkmath.LegacyMustNewDecFromStr("0.8"), + sdkmath.LegacyMustNewDecFromStr("10"), ), - sdk.MustNewDecFromStr("0.05"), - sdk.ZeroDec(), + sdkmath.LegacyMustNewDecFromStr("0.05"), + sdkmath.LegacyZeroDec(), ), }, - sdk.NewDec(10), + sdkmath.LegacyNewDec(10), ), hardtypes.DefaultAccumulationTimes, hardtypes.DefaultDeposits, @@ -184,7 +183,7 @@ func (suite *Suite) SetupTest() { }, ) - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) suite.Ctx = ctx suite.App = tApp @@ -221,7 +220,7 @@ func (suite *Suite) RemoveCoinsFromModule(amount sdk.Coins) { // CreateAccount creates a new account from the provided balance, using index // to create different new addresses. -func (suite *Suite) CreateAccount(initialBalance sdk.Coins, index int) authtypes.AccountI { +func (suite *Suite) CreateAccount(initialBalance sdk.Coins, index int) sdk.AccountI { _, addrs := app.GeneratePrivKeyAddressPairs(index + 1) ak := suite.App.GetAccountKeeper() @@ -235,7 +234,7 @@ func (suite *Suite) CreateAccount(initialBalance sdk.Coins, index int) authtypes } // NewAccountFromAddr creates a new account from the provided address with the provided balance -func (suite *Suite) NewAccountFromAddr(addr sdk.AccAddress, balance sdk.Coins) authtypes.AccountI { +func (suite *Suite) NewAccountFromAddr(addr sdk.AccAddress, balance sdk.Coins) sdk.AccountI { ak := suite.App.GetAccountKeeper() acc := ak.NewAccountWithAddress(suite.Ctx, addr) @@ -395,7 +394,7 @@ func (suite *Suite) NewBondCoin(amount sdkmath.Int) sdk.Coin { } // CreateDelegation delegates tokens to a validator. -func (suite *Suite) CreateDelegation(valAddr sdk.ValAddress, delegator sdk.AccAddress, amount sdkmath.Int) sdk.Dec { +func (suite *Suite) CreateDelegation(valAddr sdk.ValAddress, delegator sdk.AccAddress, amount sdkmath.Int) sdkmath.LegacyDec { sk := suite.App.GetStakingKeeper() stakingDenom := sk.BondDenom(suite.Ctx) @@ -420,7 +419,7 @@ func (suite *Suite) deliverMsgCreateValidator(ctx sdk.Context, address sdk.ValAd ed25519.GenPrivKey().PubKey(), selfDelegation, stakingtypes.Description{}, - stakingtypes.NewCommissionRates(sdk.ZeroDec(), sdk.ZeroDec(), sdk.ZeroDec()), + stakingtypes.NewCommissionRates(sdkmath.LegacyZeroDec(), sdkmath.LegacyZeroDec(), sdkmath.LegacyZeroDec()), sdkmath.NewInt(1e6), ) if err != nil { diff --git a/x/earn/types/codec.go b/x/earn/types/codec.go index 8b773ff8f9..6a80adfd52 100644 --- a/x/earn/types/codec.go +++ b/x/earn/types/codec.go @@ -6,7 +6,6 @@ import ( cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/msgservice" - authzcodec "github.com/cosmos/cosmos-sdk/x/authz/codec" govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" ) @@ -46,5 +45,5 @@ func init() { // Register all Amino interfaces and concrete types on the authz Amino codec so that this can later be // used to properly serialize MsgGrant and MsgExec instances - RegisterLegacyAminoCodec(authzcodec.Amino) + RegisterLegacyAminoCodec(codec.NewLegacyAmino()) } diff --git a/x/earn/types/expected_keepers.go b/x/earn/types/expected_keepers.go index e2533c884b..29ba5d277d 100644 --- a/x/earn/types/expected_keepers.go +++ b/x/earn/types/expected_keepers.go @@ -1,8 +1,9 @@ package types import ( + "context" + sdkmath "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/auth/types" disttypes "github.com/cosmos/cosmos-sdk/x/distribution/types" hardtypes "github.com/kava-labs/kava/x/hard/types" @@ -11,27 +12,27 @@ import ( // AccountKeeper defines the expected account keeper type AccountKeeper interface { - GetAccount(ctx sdk.Context, addr sdk.AccAddress) types.AccountI - SetModuleAccount(sdk.Context, types.ModuleAccountI) + GetAccount(ctx context.Context, addr sdk.AccAddress) sdk.AccountI + SetModuleAccount(context.Context, sdk.ModuleAccountI) GetModuleAddress(name string) sdk.AccAddress - GetModuleAccount(ctx sdk.Context, name string) types.ModuleAccountI + GetModuleAccount(ctx context.Context, name string) sdk.ModuleAccountI } // BankKeeper defines the expected interface needed to retrieve account balances. type BankKeeper interface { - GetAllBalances(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins + GetAllBalances(ctx context.Context, addr sdk.AccAddress) sdk.Coins - SendCoinsFromModuleToModule(ctx sdk.Context, senderModule, recipientModule string, amt sdk.Coins) error - SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error - SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error + SendCoinsFromModuleToModule(ctx context.Context, senderModule, recipientModule string, amt sdk.Coins) error + SendCoinsFromModuleToAccount(ctx context.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error + SendCoinsFromAccountToModule(ctx context.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error } // DistributionKeeper defines the expected interface needed for community-pool deposits to earn vaults type DistributionKeeper interface { - GetFeePool(ctx sdk.Context) (feePool disttypes.FeePool) - SetFeePool(ctx sdk.Context, feePool disttypes.FeePool) - GetDistributionAccount(ctx sdk.Context) types.ModuleAccountI - DistributeFromFeePool(ctx sdk.Context, amount sdk.Coins, receiveAddr sdk.AccAddress) error + GetFeePool(ctx context.Context) (feePool disttypes.FeePool) + SetFeePool(ctx context.Context, feePool disttypes.FeePool) + GetDistributionAccount(ctx context.Context) sdk.ModuleAccountI + DistributeFromFeePool(ctx context.Context, amount sdk.Coins, receiveAddr sdk.AccAddress) error } // LiquidKeeper defines the expected interface needed for derivative to staked token conversions. @@ -58,6 +59,6 @@ type SavingsKeeper interface { // EarnHooks are event hooks called when a user's deposit to a earn vault changes. type EarnHooks interface { - AfterVaultDepositCreated(ctx sdk.Context, vaultDenom string, depositor sdk.AccAddress, sharesOwned sdk.Dec) - BeforeVaultDepositModified(ctx sdk.Context, vaultDenom string, depositor sdk.AccAddress, sharesOwned sdk.Dec) + AfterVaultDepositCreated(ctx context.Context, vaultDenom string, depositor sdk.AccAddress, sharesOwned sdkmath.LegacyDec) + BeforeVaultDepositModified(ctx context.Context, vaultDenom string, depositor sdk.AccAddress, sharesOwned sdkmath.LegacyDec) } diff --git a/x/earn/types/proposal.go b/x/earn/types/proposal.go index ee4433b8fb..887d585c40 100644 --- a/x/earn/types/proposal.go +++ b/x/earn/types/proposal.go @@ -5,7 +5,6 @@ import ( "strings" sdk "github.com/cosmos/cosmos-sdk/types" - govcodec "github.com/cosmos/cosmos-sdk/x/gov/codec" govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" ) @@ -24,9 +23,10 @@ var ( func init() { govv1beta1.RegisterProposalType(ProposalTypeCommunityPoolDeposit) - govcodec.ModuleCdc.Amino.RegisterConcrete(&CommunityPoolDepositProposal{}, "kava/CommunityPoolDepositProposal", nil) + //TODO(boodyvo): identify how to do this now + //govcodec.ModuleCdc.Amino.RegisterConcrete(&CommunityPoolDepositProposal{}, "kava/CommunityPoolDepositProposal", nil) govv1beta1.RegisterProposalType(ProposalTypeCommunityPoolWithdraw) - govcodec.ModuleCdc.Amino.RegisterConcrete(&CommunityPoolWithdrawProposal{}, "kava/CommunityPoolWithdrawProposal", nil) + //govcodec.ModuleCdc.Amino.RegisterConcrete(&CommunityPoolWithdrawProposal{}, "kava/CommunityPoolWithdrawProposal", nil) } // NewCommunityPoolDepositProposal creates a new community pool deposit proposal. diff --git a/x/earn/types/query.pb.go b/x/earn/types/query.pb.go index a470d300d4..2e012dc5bc 100644 --- a/x/earn/types/query.pb.go +++ b/x/earn/types/query.pb.go @@ -5,6 +5,7 @@ package types import ( context "context" + cosmossdk_io_math "cosmossdk.io/math" fmt "fmt" _ "github.com/cosmos/cosmos-proto" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" @@ -281,7 +282,7 @@ type VaultResponse struct { TotalShares string `protobuf:"bytes,5,opt,name=total_shares,json=totalShares,proto3" json:"total_shares,omitempty"` // TotalValue is the total value of denom coins supplied to the vault if the // vault were to be liquidated. - TotalValue github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,6,opt,name=total_value,json=totalValue,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"total_value"` + TotalValue cosmossdk_io_math.Int `protobuf:"bytes,6,opt,name=total_value,json=totalValue,proto3,customtype=cosmossdk.io/math.Int" json:"total_value"` } func (m *VaultResponse) Reset() { *m = VaultResponse{} } @@ -544,68 +545,69 @@ func init() { func init() { proto.RegisterFile("kava/earn/v1beta1/query.proto", fileDescriptor_63f8dee2f3192a6b) } var fileDescriptor_63f8dee2f3192a6b = []byte{ - // 971 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x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eb, 0xaf, 0x13, 0xdb, 0xfa, 0xe9, 0xd4, 0xce, 0x3c, - 0x39, 0xb5, 0x33, 0x7f, 0x9c, 0xda, 0x99, 0xaf, 0x46, 0x57, 0x87, 0x02, 0xda, 0xe8, 0xd2, 0xb6, - 0x30, 0x90, 0xdf, 0x1a, 0x50, 0xdd, 0xf1, 0xed, 0x82, 0xfe, 0xa9, 0x73, 0xfb, 0xbf, 0x00, 0x00, - 0x00, 0xff, 0xff, 0xb7, 0x20, 0xeb, 0xea, 0x1a, 0x0a, 0x00, 0x00, + // 977 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0x4f, 0x6f, 0x1b, 0x45, + 0x14, 0xf7, 0xda, 0xb1, 0x95, 0x3c, 0xd3, 0x42, 0x26, 0x6e, 0xb1, 0x5d, 0xb2, 0x76, 0x96, 0x36, + 0x31, 0x29, 0xd9, 0xa5, 0xa9, 0x04, 0x17, 0x40, 0xc2, 0x44, 0x54, 0x41, 0x08, 0x95, 0x4d, 0xe8, + 0x81, 0x8b, 0x35, 0x8e, 0x47, 0xeb, 0x95, 0xed, 0x9d, 0xed, 0xce, 0xd8, 0x10, 0x10, 0x97, 0x7e, + 0x01, 0x90, 0x38, 0x70, 0xe0, 0xce, 0xa1, 0xe7, 0x7e, 0x88, 0x1c, 0xab, 0x72, 0x41, 0x48, 0xb4, + 0x34, 0xe1, 0x43, 0x70, 0x44, 0xf3, 0x67, 0xed, 0x75, 0xbc, 0x8e, 0x23, 0xc4, 0x29, 0xd9, 0x79, + 0xef, 0xf7, 0xe7, 0xcd, 0xbc, 0x79, 0x63, 0x58, 0xef, 0xe1, 0x11, 0x76, 0x08, 0x8e, 0x02, 0x67, + 0x74, 0xa7, 0x4d, 0x38, 0xbe, 0xe3, 0x3c, 0x1c, 0x92, 0xe8, 0xd8, 0x0e, 0x23, 0xca, 0x29, 0x5a, + 0x15, 0x61, 0x5b, 0x84, 0x6d, 0x1d, 0xae, 0x6e, 0x1f, 0x51, 0x36, 0xa0, 0xcc, 0x69, 0x63, 0x46, + 0x54, 0xee, 0x18, 0x19, 0x62, 0xcf, 0x0f, 0x30, 0xf7, 0x69, 0xa0, 0xe0, 0x55, 0x33, 0x99, 0x1b, + 0x67, 0x1d, 0x51, 0x3f, 0x8e, 0x57, 0x54, 0xbc, 0x25, 0xbf, 0x1c, 0xf5, 0xa1, 0x43, 0x25, 0x8f, + 0x7a, 0x54, 0xad, 0x8b, 0xff, 0xf4, 0xea, 0x1b, 0x1e, 0xa5, 0x5e, 0x9f, 0x38, 0x38, 0xf4, 0x1d, + 0x1c, 0x04, 0x94, 0x4b, 0xb5, 0x18, 0x63, 0xce, 0x16, 0x13, 0xe2, 0x08, 0x0f, 0xe2, 0x78, 0x7d, + 0x36, 0xce, 0x78, 0x84, 0x39, 0xf1, 0x74, 0xbd, 0xd5, 0x94, 0xed, 0x18, 0xe1, 0x61, 0x9f, 0xab, + 0xb0, 0x55, 0x02, 0xf4, 0x85, 0xa8, 0xf8, 0xbe, 0x64, 0x75, 0xc9, 0xc3, 0x21, 0x61, 0xdc, 0xfa, + 0x1c, 0xd6, 0xa6, 0x56, 0x59, 0x48, 0x03, 0x46, 0xd0, 0x7b, 0x50, 0x50, 0xea, 0x65, 0xa3, 0x6e, + 0x34, 0x8a, 0xbb, 0x15, 0x7b, 0x66, 0x33, 0x6d, 0x05, 0x69, 0x2e, 0x9d, 0x3c, 0xaf, 0x65, 0x5c, + 0x9d, 0x3e, 0x56, 0x79, 0x20, 0x94, 0xc7, 0x2a, 0x5f, 0x6a, 0x95, 0x78, 0x55, 0xab, 0x7c, 0x08, + 0x05, 0xe9, 0x50, 0xa8, 0xe4, 0x1a, 0xc5, 0xdd, 0x7a, 0x8a, 0x8a, 0x84, 0xc4, 0x88, 0x58, 0x4c, + 0xa1, 0xac, 0xb7, 0x60, 0x75, 0x42, 0xab, 0xb5, 0x50, 0x09, 0xf2,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b, 0x61, 0x62, 0x39, 0xbe, 0xda, 0x68, 0x6b, 0x9e, + 0xc2, 0xb9, 0x01, 0x57, 0x6d, 0x2c, 0x4e, 0xd4, 0x6e, 0xde, 0x94, 0x6e, 0xd6, 0xd1, 0x8d, 0x14, + 0x37, 0xe3, 0x21, 0xf0, 0x83, 0x01, 0xc5, 0x44, 0x83, 0xa2, 0xed, 0x79, 0xf4, 0xb3, 0x1d, 0x5e, + 0xbd, 0x7d, 0xa9, 0x5c, 0xed, 0x66, 0x4b, 0xba, 0xd9, 0x40, 0xb5, 0x14, 0x37, 0xfa, 0xed, 0x90, + 0x80, 0xe6, 0xde, 0xc9, 0x4b, 0x33, 0x73, 0x72, 0x6a, 0x1a, 0x4f, 0x4f, 0x4d, 0xe3, 0xaf, 0x53, + 0xd3, 0xf8, 0xf1, 0xcc, 0xcc, 0x3c, 0x3d, 0x33, 0x33, 0xbf, 0x9f, 0x99, 0x99, 0xaf, 0x36, 0x13, + 0xdd, 0x2e, 0x88, 0x76, 0xfa, 0xb8, 0xcd, 0x14, 0xe5, 0x37, 0x8a, 0x54, 0x76, 0x7c, 0xbb, 0x20, + 0x7f, 0xd9, 0xdc, 0xfd, 0x37, 0x00, 0x00, 0xff, 0xff, 0x46, 0x7b, 0x31, 0x2c, 0x09, 0x0a, 0x00, + 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -813,6 +815,7 @@ func _Query_TotalSupply_Handler(srv interface{}, ctx context.Context, dec func(i return interceptor(ctx, in, info, handler) } +var Query_serviceDesc = _Query_serviceDesc var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "kava.earn.v1beta1.Query", HandlerType: (*QueryServer)(nil), diff --git a/x/earn/types/share.go b/x/earn/types/share.go index 1e6d15311b..fc7dc2de08 100644 --- a/x/earn/types/share.go +++ b/x/earn/types/share.go @@ -1,6 +1,7 @@ package types import ( + sdkmath "cosmossdk.io/math" fmt "fmt" "sort" "strings" @@ -10,7 +11,7 @@ import ( ) // NewVaultShare returns a new VaultShare -func NewVaultShare(denom string, amount sdk.Dec) VaultShare { +func NewVaultShare(denom string, amount sdkmath.LegacyDec) VaultShare { share := VaultShare{ Denom: denom, Amount: amount, @@ -284,14 +285,14 @@ func (shares VaultShares) negative() VaultShares { } // AmountOf returns the amount of shares of the given denom. -func (shares VaultShares) AmountOf(denom string) sdk.Dec { +func (shares VaultShares) AmountOf(denom string) sdkmath.LegacyDec { for _, s := range shares { if s.Denom == denom { return s.Amount } } - return sdk.ZeroDec() + return sdkmath.LegacyZeroDec() } // GetShare the single share of the given denom. @@ -302,7 +303,7 @@ func (shares VaultShares) GetShare(denom string) VaultShare { } } - return NewVaultShare(denom, sdk.ZeroDec()) + return NewVaultShare(denom, sdkmath.LegacyZeroDec()) } // IsZero returns true if the VaultShares is empty. diff --git a/x/earn/types/share_test.go b/x/earn/types/share_test.go index 083417367c..a8b9cf0e0b 100644 --- a/x/earn/types/share_test.go +++ b/x/earn/types/share_test.go @@ -15,8 +15,8 @@ var ( testDenom2 = "usdx" ) -func d(i int64) sdk.Dec { - return sdk.NewDec(i) +func d(i int64) sdkmath.LegacyDec { + return sdkmath.LegacyNewDec(i) } type vaultShareTestSuite struct { @@ -29,16 +29,16 @@ func TestVaultShareTestSuite(t *testing.T) { func (s *vaultShareTestSuite) TestNewVaultShareFromDec() { s.Require().NotPanics(func() { - types.NewVaultShare(testDenom1, sdk.NewDec(5)) + types.NewVaultShare(testDenom1, sdkmath.LegacyNewDec(5)) }) s.Require().NotPanics(func() { - types.NewVaultShare(testDenom1, sdk.ZeroDec()) + types.NewVaultShare(testDenom1, sdkmath.LegacyZeroDec()) }) s.Require().NotPanics(func() { - types.NewVaultShare(strings.ToUpper(testDenom1), sdk.NewDec(5)) + types.NewVaultShare(strings.ToUpper(testDenom1), sdkmath.LegacyNewDec(5)) }) s.Require().Panics(func() { - types.NewVaultShare(testDenom1, sdk.NewDec(-5)) + types.NewVaultShare(testDenom1, sdkmath.LegacyNewDec(-5)) }) } @@ -58,9 +58,9 @@ func (s *vaultShareTestSuite) TestAddVaultShare() { } func (s *vaultShareTestSuite) TestAddVaultShares() { - one := sdk.NewDec(1) - zero := sdk.NewDec(0) - two := sdk.NewDec(2) + one := sdkmath.LegacyNewDec(1) + zero := sdkmath.LegacyNewDec(0) + two := sdkmath.LegacyNewDec(2) cases := []struct { inputOne types.VaultShares @@ -123,11 +123,11 @@ func (s *vaultShareTestSuite) TestFilteredZeroVaultShares() { { name: "all greater than zero", input: types.VaultShares{ - {"testa", sdk.NewDec(1)}, - {"testb", sdk.NewDec(2)}, - {"testc", sdk.NewDec(3)}, - {"testd", sdk.NewDec(4)}, - {"teste", sdk.NewDec(5)}, + {"testa", sdkmath.LegacyNewDec(1)}, + {"testb", sdkmath.LegacyNewDec(2)}, + {"testc", sdkmath.LegacyNewDec(3)}, + {"testd", sdkmath.LegacyNewDec(4)}, + {"teste", sdkmath.LegacyNewDec(5)}, }, original: "1.000000000000000000testa,2.000000000000000000testb,3.000000000000000000testc,4.000000000000000000testd,5.000000000000000000teste", expected: "1.000000000000000000testa,2.000000000000000000testb,3.000000000000000000testc,4.000000000000000000testd,5.000000000000000000teste", @@ -135,11 +135,11 @@ func (s *vaultShareTestSuite) TestFilteredZeroVaultShares() { { name: "zero share in middle", input: types.VaultShares{ - {"testa", sdk.NewDec(1)}, - {"testb", sdk.NewDec(2)}, - {"testc", sdk.NewDec(0)}, - {"testd", sdk.NewDec(4)}, - {"teste", sdk.NewDec(5)}, + {"testa", sdkmath.LegacyNewDec(1)}, + {"testb", sdkmath.LegacyNewDec(2)}, + {"testc", sdkmath.LegacyNewDec(0)}, + {"testd", sdkmath.LegacyNewDec(4)}, + {"teste", sdkmath.LegacyNewDec(5)}, }, original: "1.000000000000000000testa,2.000000000000000000testb,0.000000000000000000testc,4.000000000000000000testd,5.000000000000000000teste", expected: "1.000000000000000000testa,2.000000000000000000testb,4.000000000000000000testd,5.000000000000000000teste", @@ -147,11 +147,11 @@ func (s *vaultShareTestSuite) TestFilteredZeroVaultShares() { { name: "zero share end (unordered)", input: types.VaultShares{ - {"teste", sdk.NewDec(5)}, - {"testc", sdk.NewDec(3)}, - {"testa", sdk.NewDec(1)}, - {"testd", sdk.NewDec(4)}, - {"testb", sdk.NewDec(0)}, + {"teste", sdkmath.LegacyNewDec(5)}, + {"testc", sdkmath.LegacyNewDec(3)}, + {"testa", sdkmath.LegacyNewDec(1)}, + {"testd", sdkmath.LegacyNewDec(4)}, + {"testb", sdkmath.LegacyNewDec(0)}, }, original: "5.000000000000000000teste,3.000000000000000000testc,1.000000000000000000testa,4.000000000000000000testd,0.000000000000000000testb", expected: "1.000000000000000000testa,3.000000000000000000testc,4.000000000000000000testd,5.000000000000000000teste", @@ -172,22 +172,22 @@ func (s *vaultShareTestSuite) TestIsValid() { msg string }{ { - types.NewVaultShare("mytoken", sdk.NewDec(10)), + types.NewVaultShare("mytoken", sdkmath.LegacyNewDec(10)), true, "valid shares should have passed", }, { - types.VaultShare{Denom: "BTC", Amount: sdk.NewDec(10)}, + types.VaultShare{Denom: "BTC", Amount: sdkmath.LegacyNewDec(10)}, true, "valid uppercase denom", }, { - types.VaultShare{Denom: "Bitshare", Amount: sdk.NewDec(10)}, + types.VaultShare{Denom: "Bitshare", Amount: sdkmath.LegacyNewDec(10)}, true, "valid mixed case denom", }, { - types.VaultShare{Denom: "btc", Amount: sdk.NewDec(-10)}, + types.VaultShare{Denom: "btc", Amount: sdkmath.LegacyNewDec(-10)}, false, "negative amount", }, @@ -210,23 +210,23 @@ func (s *vaultShareTestSuite) TestSubVaultShare() { msg string }{ { - types.NewVaultShare("mytoken", sdk.NewDec(20)), + types.NewVaultShare("mytoken", sdkmath.LegacyNewDec(20)), true, "valid shares should have passed", }, { - types.NewVaultShare("othertoken", sdk.NewDec(20)), + types.NewVaultShare("othertoken", sdkmath.LegacyNewDec(20)), false, "denom mismatch", }, { - types.NewVaultShare("mytoken", sdk.NewDec(9)), + types.NewVaultShare("mytoken", sdkmath.LegacyNewDec(9)), false, "negative amount", }, } - vaultShare := types.NewVaultShare("mytoken", sdk.NewDec(10)) + vaultShare := types.NewVaultShare("mytoken", sdkmath.LegacyNewDec(10)) for _, tc := range tests { tc := tc @@ -256,7 +256,7 @@ func (s *vaultShareTestSuite) TestSubVaultShares() { "unorted shares should panic", }, { - types.VaultShares{types.VaultShare{Denom: "BTC", Amount: sdk.NewDec(10)}, types.NewVaultShare("eth", d(15)), types.NewVaultShare("mytoken", d(5))}, + types.VaultShares{types.VaultShare{Denom: "BTC", Amount: sdkmath.LegacyNewDec(10)}, types.NewVaultShare("eth", d(15)), types.NewVaultShare("mytoken", d(5))}, false, "invalid denoms", }, @@ -330,16 +330,16 @@ func (s *vaultShareTestSuite) TestVaultSharesValidate() { expectedPass bool }{ {types.VaultShares{}, true}, - {types.VaultShares{types.VaultShare{testDenom1, sdk.NewDec(5)}}, true}, - {types.VaultShares{types.VaultShare{testDenom1, sdk.NewDec(5)}, types.VaultShare{testDenom2, sdk.NewDec(100000)}}, true}, - {types.VaultShares{types.VaultShare{testDenom1, sdk.NewDec(-5)}}, false}, - {types.VaultShares{types.VaultShare{"BTC", sdk.NewDec(5)}}, true}, - {types.VaultShares{types.VaultShare{"0BTC", sdk.NewDec(5)}}, false}, - {types.VaultShares{types.VaultShare{testDenom1, sdk.NewDec(5)}, types.VaultShare{"B", sdk.NewDec(100000)}}, false}, - {types.VaultShares{types.VaultShare{testDenom1, sdk.NewDec(5)}, types.VaultShare{testDenom2, sdk.NewDec(-100000)}}, false}, - {types.VaultShares{types.VaultShare{testDenom1, sdk.NewDec(-5)}, types.VaultShare{testDenom2, sdk.NewDec(100000)}}, false}, - {types.VaultShares{types.VaultShare{"BTC", sdk.NewDec(5)}, types.VaultShare{testDenom2, sdk.NewDec(100000)}}, true}, - {types.VaultShares{types.VaultShare{"0BTC", sdk.NewDec(5)}, types.VaultShare{testDenom2, sdk.NewDec(100000)}}, false}, + {types.VaultShares{types.VaultShare{testDenom1, sdkmath.LegacyNewDec(5)}}, true}, + {types.VaultShares{types.VaultShare{testDenom1, sdkmath.LegacyNewDec(5)}, types.VaultShare{testDenom2, sdkmath.LegacyNewDec(100000)}}, true}, + {types.VaultShares{types.VaultShare{testDenom1, sdkmath.LegacyNewDec(-5)}}, false}, + {types.VaultShares{types.VaultShare{"BTC", sdkmath.LegacyNewDec(5)}}, true}, + {types.VaultShares{types.VaultShare{"0BTC", sdkmath.LegacyNewDec(5)}}, false}, + {types.VaultShares{types.VaultShare{testDenom1, sdkmath.LegacyNewDec(5)}, types.VaultShare{"B", sdkmath.LegacyNewDec(100000)}}, false}, + {types.VaultShares{types.VaultShare{testDenom1, sdkmath.LegacyNewDec(5)}, types.VaultShare{testDenom2, sdkmath.LegacyNewDec(-100000)}}, false}, + {types.VaultShares{types.VaultShare{testDenom1, sdkmath.LegacyNewDec(-5)}, types.VaultShare{testDenom2, sdkmath.LegacyNewDec(100000)}}, false}, + {types.VaultShares{types.VaultShare{"BTC", sdkmath.LegacyNewDec(5)}, types.VaultShare{testDenom2, sdkmath.LegacyNewDec(100000)}}, true}, + {types.VaultShares{types.VaultShare{"0BTC", sdkmath.LegacyNewDec(5)}, types.VaultShare{testDenom2, sdkmath.LegacyNewDec(100000)}}, false}, } for i, tc := range testCases { @@ -374,8 +374,8 @@ func (s *vaultShareTestSuite) TestVaultSharesString() { } func (s *vaultShareTestSuite) TestNewVaultSharesWithIsValid() { - fake1 := append(types.NewVaultShares(types.NewVaultShare("mytoken", d(10))), types.VaultShare{Denom: "10BTC", Amount: sdk.NewDec(10)}) - fake2 := append(types.NewVaultShares(types.NewVaultShare("mytoken", d(10))), types.VaultShare{Denom: "BTC", Amount: sdk.NewDec(-10)}) + fake1 := append(types.NewVaultShares(types.NewVaultShare("mytoken", d(10))), types.VaultShare{Denom: "10BTC", Amount: sdkmath.LegacyNewDec(10)}) + fake2 := append(types.NewVaultShares(types.NewVaultShare("mytoken", d(10))), types.VaultShare{Denom: "BTC", Amount: sdkmath.LegacyNewDec(-10)}) tests := []struct { share types.VaultShares @@ -410,7 +410,7 @@ func (s *vaultShareTestSuite) TestNewVaultSharesWithIsValid() { } func (s *vaultShareTestSuite) TestVaultShares_AddVaultShareWithIsValid() { - lengthTestVaultShares := types.NewVaultShares().Add(types.NewVaultShare("mytoken", d(10))).Add(types.VaultShare{Denom: "BTC", Amount: sdk.NewDec(10)}) + lengthTestVaultShares := types.NewVaultShares().Add(types.NewVaultShare("mytoken", d(10))).Add(types.VaultShare{Denom: "BTC", Amount: sdkmath.LegacyNewDec(10)}) s.Require().Equal(2, len(lengthTestVaultShares), "should be 2") tests := []struct { @@ -424,12 +424,12 @@ func (s *vaultShareTestSuite) TestVaultShares_AddVaultShareWithIsValid() { "valid shares should have passed", }, { - types.NewVaultShares().Add(types.NewVaultShare("mytoken", d(10))).Add(types.VaultShare{Denom: "0BTC", Amount: sdk.NewDec(10)}), + types.NewVaultShares().Add(types.NewVaultShare("mytoken", d(10))).Add(types.VaultShare{Denom: "0BTC", Amount: sdkmath.LegacyNewDec(10)}), false, "invalid denoms", }, { - types.NewVaultShares().Add(types.NewVaultShare("mytoken", d(10))).Add(types.VaultShare{Denom: "BTC", Amount: sdk.NewDec(-10)}), + types.NewVaultShares().Add(types.NewVaultShare("mytoken", d(10))).Add(types.VaultShare{Denom: "BTC", Amount: sdkmath.LegacyNewDec(-10)}), false, "negative amount", }, diff --git a/x/earn/types/tx.pb.go b/x/earn/types/tx.pb.go index 44555c8d42..a26b27b59a 100644 --- a/x/earn/types/tx.pb.go +++ b/x/earn/types/tx.pb.go @@ -352,6 +352,7 @@ func _Msg_Withdraw_Handler(srv interface{}, ctx context.Context, dec func(interf return interceptor(ctx, in, info, handler) } +var Msg_serviceDesc = _Msg_serviceDesc var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "kava.earn.v1beta1.Msg", HandlerType: (*MsgServer)(nil), diff --git a/x/earn/types/vault.go b/x/earn/types/vault.go index 907c25e1e5..9230172e23 100644 --- a/x/earn/types/vault.go +++ b/x/earn/types/vault.go @@ -1,6 +1,7 @@ package types import ( + sdkmath "cosmossdk.io/math" "fmt" errorsmod "cosmossdk.io/errors" @@ -8,7 +9,7 @@ import ( ) // NewVaultRecord returns a new VaultRecord with 0 supply. -func NewVaultRecord(vaultDenom string, amount sdk.Dec) VaultRecord { +func NewVaultRecord(vaultDenom string, amount sdkmath.LegacyDec) VaultRecord { return VaultRecord{ TotalShares: NewVaultShare(vaultDenom, amount), } diff --git a/x/earn/types/vault.pb.go b/x/earn/types/vault.pb.go index 55b37c2e78..e672d7d028 100644 --- a/x/earn/types/vault.pb.go +++ b/x/earn/types/vault.pb.go @@ -4,6 +4,7 @@ package types import ( + cosmossdk_io_math "cosmossdk.io/math" fmt "fmt" _ "github.com/cosmos/cosmos-proto" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" @@ -206,8 +207,8 @@ func (m *VaultShareRecord) GetShares() VaultShares { // VaultShare defines shares of a vault owned by a depositor. type VaultShare struct { - Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` - Amount github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=amount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"amount"` + Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` + Amount cosmossdk_io_math.LegacyDec `protobuf:"bytes,2,opt,name=amount,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"amount"` } func (m *VaultShare) Reset() { *m = VaultShare{} } @@ -259,38 +260,39 @@ func init() { func init() { proto.RegisterFile("kava/earn/v1beta1/vault.proto", fileDescriptor_884eb89509fbdc04) } var fileDescriptor_884eb89509fbdc04 = []byte{ - // 487 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x53, 0x3f, 0x6f, 0xd3, 0x40, - 0x14, 0xb7, 0x93, 0x10, 0xd1, 0x4b, 0xa8, 0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, 0xe0, 0x3f, 0x7c, 0x3a, 0x27, 0xa8, 0x49, 0xc6, 0x6c, 0x36, 0xe1, 0x76, - 0x4d, 0xc0, 0xf1, 0x53, 0x41, 0xf8, 0x7d, 0xe1, 0x3e, 0xfa, 0x87, 0x60, 0x7d, 0x9a, 0xdc, 0x5c, - 0x06, 0x48, 0x27, 0xea, 0xd3, 0x04, 0x6b, 0xae, 0x27, 0x8d, 0x4f, 0x5f, 0x5c, 0x23, 0x7e, 0x76, - 0xb5, 0x74, 0xcc, 0xeb, 0xa5, 0x63, 0xfe, 0x58, 0x3a, 0xe6, 0xc7, 0x95, 0x63, 0x5c, 0xaf, 0x1c, - 0xe3, 0xdb, 0xca, 0x31, 0xde, 0xae, 0xb3, 0x8b, 0x7c, 0x41, 0x4e, 0x86, 0x20, 0x4f, 0xd1, 0x7b, - 0xf5, 0x20, 0xa4, 0xc2, 0xb0, 0x29, 0x9f, 0xc1, 0xe3, 0x5f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xa0, - 0xa9, 0xba, 0x64, 0x8d, 0x03, 0x00, 0x00, + // 500 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x53, 0xbf, 0x6f, 0xd3, 0x40, + 0x14, 0x8e, 0x93, 0x10, 0xd1, 0x4b, 0xa8, 0x1a, 0xb7, 0x83, 0x29, 0xaa, 0x6d, 0x65, 0x40, 0x5e, + 0x6c, 0x2b, 0x65, 0x63, 0x22, 0x56, 0x84, 0x00, 0x31, 0xa0, 0x2b, 0x30, 0xb0, 0x44, 0x17, 0xfb, + 0x70, 0xac, 0xd8, 0xb9, 0xc8, 0xef, 0x92, 0x92, 0xff, 0x82, 0x11, 0x89, 0x85, 0xb9, 0x73, 0xff, + 0x06, 0xd4, 0xb1, 0xea, 0x84, 0x18, 0x52, 0x94, 0xfc, 0x17, 0x4c, 0xe8, 0x7e, 0xa8, 0x89, 0x54, + 0x10, 0x4b, 0xa7, 0xdc, 0x7d, 0xef, 0xbd, 0xef, 0x7d, 0xdf, 0x97, 0x33, 0x3a, 0x1a, 0x93, 0x39, + 0x09, 0x29, 0x29, 0x27, 0xe1, 0xbc, 0x3b, 0xa4, 0x9c, 0x74, 0xc3, 0x39, 0x99, 0xe5, 0x3c, 0x98, + 0x96, 0x8c, 0x33, 0xb3, 0x2d, 0xca, 0x81, 0x28, 0x07, 0xba, 0x7c, 0xf8, 0x30, 0x66, 0x50, 0x30, + 0x18, 0xc8, 0x86, 0x50, 0x5d, 0x54, 0xf7, 0xe1, 0x41, 0xca, 0x52, 0xa6, 0x70, 0x71, 0xd2, 0xa8, + 0x7b, 0x7b, 0x05, 0xf0, 0x92, 0x70, 0x9a, 0x2e, 0x54, 0x47, 0xe7, 0x6b, 0x15, 0xb5, 0x7a, 0x79, + 0xce, 0x4e, 0x69, 0xf2, 0x5e, 0x2c, 0x37, 0x0f, 0xd0, 0xbd, 0x84, 0x4e, 0x58, 0x61, 0x19, 0xae, + 0xe1, 0xed, 0x60, 0x75, 0x31, 0x31, 0x42, 0x7a, 0x30, 0xa3, 0x60, 0x55, 0xdd, 0x9a, 0xb7, 0x7b, + 0xec, 0x04, 0xb7, 0x14, 0x06, 0x27, 0x9a, 0xfd, 0xed, 0x62, 0x4a, 0xa3, 0xf6, 0xd9, 0xb5, 0xf3, + 0x60, 0x1b, 0x01, 0xbc, 0xc5, 0x62, 0x7a, 0x68, 0x2f, 0x13, 0x5e, 0xb2, 0x39, 0xe1, 0x74, 0x20, + 0xad, 0x5b, 0x35, 0xd7, 0xf0, 0xee, 0xe3, 0xdd, 0x0c, 0xde, 0x28, 0x58, 0x69, 0x3a, 0x45, 0x26, + 0x51, 0x1a, 0x07, 0x09, 0x9d, 0x32, 0xc8, 0x38, 0x2b, 0xc1, 0xaa, 0xbb, 0x35, 0xaf, 0x15, 0xbd, + 0xf8, 0xbd, 0x74, 0xfc, 0x34, 0xe3, 0xa3, 0xd9, 0x30,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, + 0xb6, 0xf1, 0x6b, 0x65, 0x1b, 0x9f, 0xd7, 0x76, 0xe5, 0x72, 0x6d, 0x57, 0x7e, 0xac, 0xed, 0xca, + 0x87, 0xc7, 0x5b, 0x59, 0x09, 0x53, 0x7e, 0x4e, 0x86, 0x20, 0x4f, 0xe1, 0x27, 0xf5, 0x15, 0xc8, + 0xbc, 0x86, 0x0d, 0xf9, 0xf6, 0x9f, 0xfc, 0x09, 0x00, 0x00, 0xff, 0xff, 0x2e, 0xec, 0xc7, 0xdc, + 0x82, 0x03, 0x00, 0x00, } func (m *AllowedVault) Marshal() (dAtA []byte, err error) { diff --git a/x/earn/types/vault_test.go b/x/earn/types/vault_test.go index f56b78d984..50321288b7 100644 --- a/x/earn/types/vault_test.go +++ b/x/earn/types/vault_test.go @@ -26,10 +26,10 @@ func TestVaultRecordValidate(t *testing.T) { name: "valid vault records", vaultRecords: types.VaultRecords{ { - TotalShares: types.NewVaultShare("usdx", sdk.NewDec(0)), + TotalShares: types.NewVaultShare("usdx", sdkmath.LegacyNewDec(0)), }, { - TotalShares: types.NewVaultShare("ukava", sdk.NewDec(5)), + TotalShares: types.NewVaultShare("ukava", sdkmath.LegacyNewDec(5)), }, }, errArgs: errArgs{ @@ -40,10 +40,10 @@ func TestVaultRecordValidate(t *testing.T) { name: "invalid - duplicate denom", vaultRecords: types.VaultRecords{ { - TotalShares: types.NewVaultShare("usdx", sdk.NewDec(0)), + TotalShares: types.NewVaultShare("usdx", sdkmath.LegacyNewDec(0)), }, { - TotalShares: types.NewVaultShare("usdx", sdk.NewDec(5)), + TotalShares: types.NewVaultShare("usdx", sdkmath.LegacyNewDec(5)), }, }, errArgs: errArgs{ @@ -55,7 +55,7 @@ func TestVaultRecordValidate(t *testing.T) { name: "invalid - invalid denom", vaultRecords: types.VaultRecords{ { - TotalShares: types.VaultShare{Denom: "", Amount: sdk.NewDec(0)}, + TotalShares: types.VaultShare{Denom: "", Amount: sdkmath.LegacyNewDec(0)}, }, }, errArgs: errArgs{ @@ -67,7 +67,7 @@ func TestVaultRecordValidate(t *testing.T) { name: "invalid - negative", vaultRecords: types.VaultRecords{ { - TotalShares: types.VaultShare{"usdx", sdk.NewDec(-5)}, + TotalShares: types.VaultShare{"usdx", sdkmath.LegacyNewDec(-5)}, }, }, errArgs: errArgs{ @@ -110,14 +110,14 @@ func TestVaultShareRecordsValidate(t *testing.T) { { Depositor: addrs[0], Shares: types.NewVaultShares( - types.NewVaultShare("usdx", sdk.NewDec(0)), + types.NewVaultShare("usdx", sdkmath.LegacyNewDec(0)), ), }, { Depositor: addrs[1], Shares: types.NewVaultShares( - types.NewVaultShare("usdx", sdk.NewDec(0)), - types.NewVaultShare("ukava", sdk.NewDec(5)), + types.NewVaultShare("usdx", sdkmath.LegacyNewDec(0)), + types.NewVaultShare("ukava", sdkmath.LegacyNewDec(5)), ), }, }, @@ -131,14 +131,14 @@ func TestVaultShareRecordsValidate(t *testing.T) { { Depositor: addrs[0], Shares: types.NewVaultShares( - types.NewVaultShare("usdx", sdk.NewDec(0)), + types.NewVaultShare("usdx", sdkmath.LegacyNewDec(0)), ), }, { Depositor: addrs[0], Shares: types.NewVaultShares( - types.NewVaultShare("usdx", sdk.NewDec(0)), - types.NewVaultShare("ukava", sdk.NewDec(5)), + types.NewVaultShare("usdx", sdkmath.LegacyNewDec(0)), + types.NewVaultShare("ukava", sdkmath.LegacyNewDec(5)), ), }, }, @@ -153,7 +153,7 @@ func TestVaultShareRecordsValidate(t *testing.T) { { Depositor: sdk.AccAddress{}, Shares: types.NewVaultShares( - types.NewVaultShare("usdx", sdk.NewDec(0)), + types.NewVaultShare("usdx", sdkmath.LegacyNewDec(0)), ), }, }, @@ -169,7 +169,7 @@ func TestVaultShareRecordsValidate(t *testing.T) { Depositor: addrs[0], // Direct slice, not NewVaultShares() which panics Shares: types.VaultShares{ - types.VaultShare{"usdx", sdk.NewDec(-5)}, + types.VaultShare{"usdx", sdkmath.LegacyNewDec(-5)}, }, }, }, @@ -376,8 +376,8 @@ func TestNewVaultShareRecord(t *testing.T) { _, addrs := app.GeneratePrivKeyAddressPairs(1) shares := types.NewVaultShares( - types.NewVaultShare("usdx", sdk.NewDec(0)), - types.NewVaultShare("ukava", sdk.NewDec(5)), + types.NewVaultShare("usdx", sdkmath.LegacyNewDec(0)), + types.NewVaultShare("ukava", sdkmath.LegacyNewDec(5)), ) shareRecord := types.NewVaultShareRecord(addrs[0], shares) diff --git a/x/evmutil/genesis_test.go b/x/evmutil/genesis_test.go index 0c71f9ffa8..89b2f9b771 100644 --- a/x/evmutil/genesis_test.go +++ b/x/evmutil/genesis_test.go @@ -1,12 +1,12 @@ package evmutil_test import ( + sdk "github.com/cosmos/cosmos-sdk/types" "testing" "github.com/stretchr/testify/suite" sdkmath "cosmossdk.io/math" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "github.com/kava-labs/kava/x/evmutil" "github.com/kava-labs/kava/x/evmutil/testutil" "github.com/kava-labs/kava/x/evmutil/types" @@ -77,7 +77,7 @@ func (s *genesisTestSuite) TestInitGenesis_ModuleAccount() { // check for module account this way b/c GetModuleAccount creates if not existing. acc := s.AccountKeeper.GetAccount(s.Ctx, s.AccountKeeper.GetModuleAddress(types.ModuleName)) s.Require().NotNil(acc) - _, ok := acc.(authtypes.ModuleAccountI) + _, ok := acc.(sdk.ModuleAccountI) s.Require().True(ok) } diff --git a/x/evmutil/keeper/conversion_evm_native_bep3_test.go b/x/evmutil/keeper/conversion_evm_native_bep3_test.go index c2d0612898..40e178ac89 100644 --- a/x/evmutil/keeper/conversion_evm_native_bep3_test.go +++ b/x/evmutil/keeper/conversion_evm_native_bep3_test.go @@ -376,7 +376,7 @@ func (suite *Bep3ConversionTestSuite) testConvertBep3ERC20ToCoin(denom string) { } // create user account, otherwise `CallEVMWithData` will fail due to failing to get user account when finding its sequence. - err = suite.App.FundAccount(suite.Ctx, invokerCosmosAddr, sdk.NewCoins(sdk.NewCoin(conversionDenom, sdk.ZeroInt()))) + err = suite.App.FundAccount(suite.Ctx, invokerCosmosAddr, sdk.NewCoins(sdk.NewCoin(conversionDenom, sdkmath.ZeroInt()))) suite.Require().NoError(err) // execute bep3 conversion diff --git a/x/evmutil/keeper/conversion_evm_native_test.go b/x/evmutil/keeper/conversion_evm_native_test.go index 3cd9d1c72a..f0d01bc509 100644 --- a/x/evmutil/keeper/conversion_evm_native_test.go +++ b/x/evmutil/keeper/conversion_evm_native_test.go @@ -72,7 +72,7 @@ func (suite *ConversionTestSuite) TestBurn() { suite.Require().NoError(err) bal = suite.App.GetBankKeeper().GetBalance(suite.Ctx, recipient, pair.Denom) - suite.Require().Equal(sdk.ZeroInt(), bal.Amount, "balance should be zero after burn") + suite.Require().Equal(sdkmath.ZeroInt(), bal.Amount, "balance should be zero after burn") } func (suite *ConversionTestSuite) TestUnlockERC20Tokens() { @@ -179,7 +179,7 @@ func (suite *ConversionTestSuite) TestConvertCoinToERC20() { // Source should decrease bal := suite.App.GetBankKeeper().GetBalance(suite.Ctx, originAcc, pair.Denom) - suite.Require().Equal(sdk.ZeroInt(), bal.Amount, "conversion should decrease source balance") + suite.Require().Equal(sdkmath.ZeroInt(), bal.Amount, "conversion should decrease source balance") // Module bal should also decrease moduleBal := suite.GetERC20BalanceOf( @@ -349,5 +349,5 @@ func (suite *ConversionTestSuite) TestConvertERC20ToCoin_EmptyContract() { // bank balance should not change bal := suite.App.GetBankKeeper().GetBalance(suite.Ctx, userAddr, pair.Denom) - suite.Require().Equal(sdk.ZeroInt(), bal.Amount) + suite.Require().Equal(sdkmath.ZeroInt(), bal.Amount) } diff --git a/x/evmutil/keeper/evm.go b/x/evmutil/keeper/evm.go index 43829dd427..76d85ed8fa 100644 --- a/x/evmutil/keeper/evm.go +++ b/x/evmutil/keeper/evm.go @@ -15,6 +15,7 @@ package keeper import ( + storetypes "cosmossdk.io/store/types" "encoding/json" "math/big" @@ -89,7 +90,7 @@ func (k Keeper) CallEVMWithData( return nil, err } - ethGasContext := ctx.WithGasMeter(sdk.NewInfiniteGasMeter()) + ethGasContext := ctx.WithGasMeter(storetypes.NewInfiniteGasMeter()) // EstimateGas applies the transaction against current block state to get // optimal gas value. Since this is done right before the ApplyMessage diff --git a/x/evmutil/keeper/grpc_query.go b/x/evmutil/keeper/grpc_query.go index 0ff2d0e9d6..d3a12cf068 100644 --- a/x/evmutil/keeper/grpc_query.go +++ b/x/evmutil/keeper/grpc_query.go @@ -6,7 +6,7 @@ import ( "google.golang.org/grpc/codes" "google.golang.org/grpc/status" - "github.com/cosmos/cosmos-sdk/store/prefix" + "cosmossdk.io/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/query" diff --git a/x/evmutil/keeper/grpc_query_test.go b/x/evmutil/keeper/grpc_query_test.go index 4f6c6c057c..aab1110aa3 100644 --- a/x/evmutil/keeper/grpc_query_test.go +++ b/x/evmutil/keeper/grpc_query_test.go @@ -31,7 +31,7 @@ func (suite *grpcQueryTestSuite) SetupTest() { suite.App.InitializeFromGenesisStates() suite.Keeper = suite.App.GetEvmutilKeeper() - suite.Ctx = suite.App.NewContext(true, tmproto.Header{Height: 1}) + suite.Ctx = suite.App.NewContextLegacy(true, tmproto.Header{Height: 1}) queryHelper := baseapp.NewQueryServerTestHelper(suite.Ctx, suite.App.InterfaceRegistry()) types.RegisterQueryServer(queryHelper, keeper.NewQueryServerImpl(suite.App.GetEvmutilKeeper())) diff --git a/x/evmutil/keeper/keeper.go b/x/evmutil/keeper/keeper.go index 02098c8d3b..a56eea5878 100644 --- a/x/evmutil/keeper/keeper.go +++ b/x/evmutil/keeper/keeper.go @@ -5,8 +5,8 @@ import ( errorsmod "cosmossdk.io/errors" sdkmath "cosmossdk.io/math" + storetypes "cosmossdk.io/store/types" "github.com/cosmos/cosmos-sdk/codec" - storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" @@ -63,7 +63,7 @@ func (k Keeper) GetAllAccounts(ctx sdk.Context) (accounts []types.Account) { // callback, iteration is halted. func (k Keeper) IterateAllAccounts(ctx sdk.Context, cb func(types.Account) bool) { store := ctx.KVStore(k.storeKey) - iterator := sdk.KVStorePrefixIterator(store, types.AccountStoreKeyPrefix) + iterator := storetypes.KVStorePrefixIterator(store, types.AccountStoreKeyPrefix) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { @@ -119,7 +119,7 @@ func (k Keeper) SetAccount(ctx sdk.Context, account types.Account) error { func (k Keeper) GetBalance(ctx sdk.Context, addr sdk.AccAddress) sdkmath.Int { account := k.GetAccount(ctx, addr) if account == nil { - return sdk.ZeroInt() + return sdkmath.ZeroInt() } return account.Balance } @@ -217,7 +217,7 @@ func (k *Keeper) GetDeployedCosmosCoinContract(ctx sdk.Context, cosmosDenom stri // cosmos-sdk coins. If true is returned from the callback, iteration is halted. func (k Keeper) IterateAllDeployedCosmosCoinContracts(ctx sdk.Context, cb func(types.DeployedCosmosCoinContract) bool) { store := ctx.KVStore(k.storeKey) - iterator := sdk.KVStorePrefixIterator(store, types.DeployedCosmosCoinContractKeyPrefix) + iterator := storetypes.KVStorePrefixIterator(store, types.DeployedCosmosCoinContractKeyPrefix) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { diff --git a/x/evmutil/keeper/keeper_test.go b/x/evmutil/keeper/keeper_test.go index a5ea5c6ebd..2848fbb89d 100644 --- a/x/evmutil/keeper/keeper_test.go +++ b/x/evmutil/keeper/keeper_test.go @@ -64,11 +64,11 @@ func (suite *keeperTestSuite) TestSetAccount_ZeroBalance() { suite.Require().NoError(err) err = suite.Keeper.SetAccount(suite.Ctx, types.Account{ Address: suite.Addrs[0], - Balance: sdk.ZeroInt(), + Balance: sdkmath.ZeroInt(), }) suite.Require().NoError(err) bal := suite.Keeper.GetBalance(suite.Ctx, suite.Addrs[0]) - suite.Require().Equal(sdk.ZeroInt(), bal) + suite.Require().Equal(sdkmath.ZeroInt(), bal) expAcct := suite.Keeper.GetAccount(suite.Ctx, suite.Addrs[0]) suite.Require().Nil(expAcct) } @@ -142,13 +142,13 @@ func (suite *keeperTestSuite) TestSendBalance() { { "fails when sending negative amount", sdkmath.NewInt(-5), - sdk.ZeroInt(), - sdk.ZeroInt(), + sdkmath.ZeroInt(), + sdkmath.ZeroInt(), false, }, { "send zero amount", - sdk.ZeroInt(), + sdkmath.ZeroInt(), startingSenderBal, startingRecipientBal, true, @@ -156,8 +156,8 @@ func (suite *keeperTestSuite) TestSendBalance() { { "fails when sender does not have enough balance", sdkmath.NewInt(101), - sdk.ZeroInt(), - sdk.ZeroInt(), + sdkmath.ZeroInt(), + sdkmath.ZeroInt(), false, }, { @@ -228,7 +228,7 @@ func (suite *keeperTestSuite) TestSetBalance() { { "zero balance", suite.Addrs[0], - sdk.ZeroInt(), + sdkmath.ZeroInt(), true, }, } @@ -272,25 +272,25 @@ func (suite *keeperTestSuite) TestRemoveBalance() { { "fails if amount is negative", sdkmath.NewInt(-10), - sdk.ZeroInt(), + sdkmath.ZeroInt(), false, }, { "remove zero amount", - sdk.ZeroInt(), + sdkmath.ZeroInt(), existingAccount.Balance, true, }, { "not enough balance", sdkmath.NewInt(101), - sdk.ZeroInt(), + sdkmath.ZeroInt(), false, }, { "remove full balance", sdkmath.NewInt(100), - sdk.ZeroInt(), + sdkmath.ZeroInt(), true, }, { @@ -334,7 +334,7 @@ func (suite *keeperTestSuite) TestGetBalance() { { "returns 0 balance if account does not exist", suite.Addrs[1], - sdk.ZeroInt(), + sdkmath.ZeroInt(), }, { "returns account balance", diff --git a/x/evmutil/keeper/msg_server_bep3_test.go b/x/evmutil/keeper/msg_server_bep3_test.go index d36c68fd6e..11a2992158 100644 --- a/x/evmutil/keeper/msg_server_bep3_test.go +++ b/x/evmutil/keeper/msg_server_bep3_test.go @@ -266,7 +266,7 @@ func (suite *MsgServerSuite) TestConvertERC20ToCoin_Bep3() { } // create user account, otherwise `CallEVMWithData` will fail due to failing to get user account when finding its sequence. - err = suite.App.FundAccount(suite.Ctx, invokerCosmosAddr, sdk.NewCoins(sdk.NewCoin(conversionDenom, sdk.ZeroInt()))) + err = suite.App.FundAccount(suite.Ctx, invokerCosmosAddr, sdk.NewCoins(sdk.NewCoin(conversionDenom, sdkmath.ZeroInt()))) suite.Require().NoError(err) _, err := suite.msgServer.ConvertERC20ToCoin(sdk.WrapSDKContext(suite.Ctx), &tc.msg) diff --git a/x/evmutil/keeper/msg_server_test.go b/x/evmutil/keeper/msg_server_test.go index 89c7c04a0a..3bf152a01f 100644 --- a/x/evmutil/keeper/msg_server_test.go +++ b/x/evmutil/keeper/msg_server_test.go @@ -155,7 +155,7 @@ func (suite *MsgServerSuite) TestConvertERC20ToCoin() { suite.Require().NoError(err) // create user account, otherwise `CallEVMWithData` will fail due to failing to get user account when finding its sequence. - err = suite.App.FundAccount(suite.Ctx, invokerCosmosAddr, sdk.NewCoins(sdk.NewCoin(pair.Denom, sdk.ZeroInt()))) + err = suite.App.FundAccount(suite.Ctx, invokerCosmosAddr, sdk.NewCoins(sdk.NewCoin(pair.Denom, sdkmath.ZeroInt()))) suite.Require().NoError(err) type errArgs struct { @@ -202,7 +202,7 @@ func (suite *MsgServerSuite) TestConvertERC20ToCoin() { invoker, invokerCosmosAddr, contractAddr, - sdkmath.NewIntFromBigInt(pairStartingBal).Add(sdk.OneInt()), + sdkmath.NewIntFromBigInt(pairStartingBal).Add(sdkmath.OneInt()), ), math.MaxBig256, errArgs{ diff --git a/x/evmutil/module.go b/x/evmutil/module.go index 09ed8b11dd..3cfb184d25 100644 --- a/x/evmutil/module.go +++ b/x/evmutil/module.go @@ -151,10 +151,16 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw func (AppModule) ConsensusVersion() uint64 { return ConsensusVersion } // BeginBlock executes all ABCI BeginBlock logic respective to evmutil module. -func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) {} +func (am AppModule) BeginBlock(ctx sdk.Context) error { + return nil +} // EndBlock executes all ABCI EndBlock logic respective to evmutil module. It // returns no validator updates. -func (am AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { - return []abci.ValidatorUpdate{} +func (am AppModule) EndBlock(_ sdk.Context) ([]abci.ValidatorUpdate, error) { + return []abci.ValidatorUpdate{}, nil } + +func (AppModule) IsOnePerModuleType() {} + +func (AppModule) IsAppModule() {} diff --git a/x/evmutil/testutil/suite.go b/x/evmutil/testutil/suite.go index f9e24f731c..4b9f8bcf87 100644 --- a/x/evmutil/testutil/suite.go +++ b/x/evmutil/testutil/suite.go @@ -62,7 +62,7 @@ type Suite struct { func (suite *Suite) SetupTest() { tApp := app.NewTestApp() - suite.Ctx = tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + suite.Ctx = tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) suite.App = tApp suite.BankKeeper = tApp.GetBankKeeper() suite.AccountKeeper = tApp.GetAccountKeeper() @@ -104,7 +104,7 @@ func (suite *Suite) SetupTest() { consAddress := sdk.ConsAddress(consPriv.PubKey().Address()) // InitializeFromGenesisStates commits first block so we start at 2 here - suite.Ctx = suite.App.NewContext(false, tmproto.Header{ + suite.Ctx = suite.App.NewContextLegacy(false, tmproto.Header{ Height: suite.App.LastBlockHeight() + 1, ChainID: app.TestChainId, Time: time.Now().UTC(), @@ -137,7 +137,7 @@ func (suite *Suite) SetupTest() { } suite.AccountKeeper.SetAccount(suite.Ctx, acc) valAddr := sdk.ValAddress(suite.Address.Bytes()) - validator, err := stakingtypes.NewValidator(valAddr, consPriv.PubKey(), stakingtypes.Description{}) + validator, err := stakingtypes.NewValidator(valAddr.String(), consPriv.PubKey(), stakingtypes.Description{}) suite.Require().NoError(err) err = suite.App.GetStakingKeeper().SetValidatorByConsAddr(suite.Ctx, validator) suite.Require().NoError(err) @@ -167,18 +167,20 @@ func (suite *Suite) SetupTest() { } func (suite *Suite) Commit() { - _ = suite.App.Commit() + _, err := suite.App.Commit() + suite.Require().NoError(err) header := suite.Ctx.BlockHeader() header.Height += 1 - suite.App.BeginBlock(abci.RequestBeginBlock{ - Header: header, - }) + suite.App.FinalizeBlock(&abci.RequestFinalizeBlock{Height: header.Height}) + //suite.App.BeginBlock(abci.RequestBeginBlock{ + // Header: header, + //}) // update ctx - suite.Ctx = suite.App.NewContext(false, header) + suite.Ctx = suite.App.NewContextLegacy(false, header) } -func (suite *Suite) ModuleBalance(denom string) sdk.Int { +func (suite *Suite) ModuleBalance(denom string) sdkmath.Int { return suite.App.GetModuleAccountBalance(suite.Ctx, types.ModuleName, denom) } diff --git a/x/evmutil/types/codec.go b/x/evmutil/types/codec.go index fa9c5fe60e..079409d8d3 100644 --- a/x/evmutil/types/codec.go +++ b/x/evmutil/types/codec.go @@ -7,7 +7,6 @@ import ( cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/msgservice" - authzcodec "github.com/cosmos/cosmos-sdk/x/authz/codec" ) // RegisterLegacyAminoCodec registers the necessary evmutil interfaces and concrete types @@ -42,5 +41,5 @@ func init() { // Register all Amino interfaces and concrete types on the authz Amino codec so that this can later be // used to properly serialize MsgGrant and MsgExec instances - RegisterLegacyAminoCodec(authzcodec.Amino) + RegisterLegacyAminoCodec(codec.NewLegacyAmino()) } diff --git a/x/evmutil/types/expected_keepers.go b/x/evmutil/types/expected_keepers.go index 1992f5d61e..850ec1b4a9 100644 --- a/x/evmutil/types/expected_keepers.go +++ b/x/evmutil/types/expected_keepers.go @@ -4,7 +4,6 @@ import ( "context" sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "github.com/ethereum/go-ethereum/core" "github.com/ethereum/go-ethereum/core/vm" evmtypes "github.com/evmos/ethermint/x/evm/types" @@ -12,22 +11,22 @@ import ( // AccountKeeper defines the expected account keeper interface type AccountKeeper interface { - GetModuleAccount(ctx sdk.Context, moduleName string) authtypes.ModuleAccountI + GetModuleAccount(context context.Context, moduleName string) sdk.ModuleAccountI GetModuleAddress(moduleName string) sdk.AccAddress - GetSequence(sdk.Context, sdk.AccAddress) (uint64, error) + GetSequence(context.Context, sdk.AccAddress) (uint64, error) } // BankKeeper defines the expected bank keeper interface type BankKeeper interface { - GetBalance(ctx sdk.Context, addr sdk.AccAddress, denom string) sdk.Coin - SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error - SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error - MintCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error - BurnCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error + GetBalance(ctx context.Context, addr sdk.AccAddress, denom string) sdk.Coin + SendCoinsFromAccountToModule(ctx context.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error + SendCoinsFromModuleToAccount(ctx context.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error + MintCoins(ctx context.Context, moduleName string, amt sdk.Coins) error + BurnCoins(ctx context.Context, moduleName string, amt sdk.Coins) error - GetSupply(ctx sdk.Context, denom string) sdk.Coin - SpendableCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins - SendCoins(ctx sdk.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Coins) error + GetSupply(ctx context.Context, denom string) sdk.Coin + SpendableCoins(ctx context.Context, addr sdk.AccAddress) sdk.Coins + SendCoins(ctx context.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Coins) error } // EvmKeeper defines the expected interface needed to make EVM transactions. diff --git a/x/evmutil/types/genesis.pb.go b/x/evmutil/types/genesis.pb.go index 93aa0b9759..fb35d2bcb7 100644 --- a/x/evmutil/types/genesis.pb.go +++ b/x/evmutil/types/genesis.pb.go @@ -5,6 +5,7 @@ package types import ( bytes "bytes" + cosmossdk_io_math "cosmossdk.io/math" fmt "fmt" _ "github.com/cosmos/cosmos-proto" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" @@ -70,7 +71,7 @@ var xxx_messageInfo_GenesisState proto.InternalMessageInfo type Account struct { Address github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,1,opt,name=address,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"address,omitempty"` // balance indicates the amount of akava owned by the address. - Balance github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,2,opt,name=balance,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"balance"` + Balance cosmossdk_io_math.Int `protobuf:"bytes,2,opt,name=balance,proto3,customtype=cosmossdk.io/math.Int" json:"balance"` } func (m *Account) Reset() { *m = Account{} } @@ -174,38 +175,38 @@ func init() { } var fileDescriptor_d916ab97b8e628c2 = []byte{ - // 489 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x52, 0x41, 0x6b, 0x13, 0x41, - 0x14, 0xde, 0xa9, 0x21, 0xd1, 0x69, 0x41, 0xd8, 0x56, 0x8d, 0xa5, 0xce, 0x96, 0x50, 0x24, 0x0a, - 0xbb, 0x6b, 0xe2, 0xad, 0x08, 0xd2, 0x8d, 0xa2, 0xc5, 0x4b, 0x59, 0xc5, 0x83, 0x97, 0xf0, 0x76, - 0x77, 0x88, 0x4b, 0x76, 0x67, 0xc2, 0xce, 0x24, 0xb5, 0xff, 0x40, 0xf0, 0xa0, 0xfe, 0x03, 0x8f, - 0xe2, 0xb9, 0x3f, 0xa2, 0xe0, 0xa5, 0xf4, 0x24, 0x1e, 0x62, 0x4d, 0xfe, 0x85, 0x27, 0xd9, 0x99, - 0x49, 0xa8, 0x21, 0x8a, 0xa7, 0x9d, 0x7d, 0xf3, 0x7d, 0xef, 0xfb, 0xe6, 0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 0x42, 0xf0, 0xa5, 0x33, 0x37, 0x83, 0x48, 0xa8, 0x93, - 0xff, 0x66, 0xbe, 0xd8, 0x2a, 0xff, 0xa8, 0xaa, 0xf6, 0xf8, 0xfe, 0xef, 0x00, 0x00, 0x00, 0xff, - 0xff, 0xa1, 0xec, 0x74, 0x78, 0x60, 0x03, 0x00, 0x00, + // 495 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x92, 0x31, 0x6f, 0xd3, 0x40, + 0x14, 0xc7, 0x7d, 0x25, 0x4a, 0xe0, 0x5a, 0x09, 0xc9, 0x6d, 0x21, 0x54, 0xc5, 0xae, 0xa2, 0x0e, + 0x01, 0x64, 0x9b, 0x84, 0xad, 0x0b, 0xaa, 0x43, 0x05, 0x15, 0x4b, 0x65, 0x98, 0x58, 0xa2, 0x67, + 0xfb, 0x94, 0x9e, 0x62, 0xdf, 0x45, 0xbe, 0x4b, 0x4a, 0xbf, 0x01, 0x12, 0x03, 0xf0, 0x0d, 0x18, + 0x11, 0x73, 0x27, 0x3e, 0x41, 0xc7, 0xaa, 0x13, 0x62, 0x08, 0x25, 0xf9, 0x16, 0x4c, 0xc8, 0x77, + 0x97, 0xa8, 0x44, 0x81, 0xc9, 0xe7, 0xe7, 0xff, 0xff, 0xdd, 0xcf, 0xff, 0xf7, 0x70, 0xa3, 0x0f, + 0x23, 0x08, 0xc8, 0x28, 0x1f, 0x4a, 0x9a, 0x05, 0xa3, 0x56, 0x4c, 0x24, 0xb4, 0x82, 0x1e, 0x61, + 0x44, 0x50, 0xe1, 0x0f, 0x0a, 0x2e, 0xb9, 0xbd, 0x51, 0x6a, 0x7c, 0xa3, 0xf1, 0x8d, 0x66, 0xeb, + 0x5e, 0xc2, 0x45, 0xce, 0x45, 0x57, 0x69, 0x02, 0xfd, 0xa2, 0x0d, 0x5b, 0x1b, 0x3d, 0xde, 0xe3, + 0xba, 0x5e, 0x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32, 0x9a, 0x79, 0x0d, 0xfc, 0x87, 0x15, 0x5c, + 0xd5, 0xff, 0x66, 0x9f, 0xe0, 0x3a, 0x61, 0x10, 0x67, 0x24, 0xed, 0x2e, 0x84, 0x2f, 0xea, 0x15, + 0x15, 0xed, 0xee, 0xf2, 0x6c, 0x3a, 0x73, 0xf5, 0x11, 0xd0, 0x22, 0xbc, 0x5b, 0xe2, 0x7c, 0xfd, + 0xe9, 0xde, 0xfe, 0xbb, 0x2e, 0xa2, 0x3b, 0xa6, 0xfd, 0x42, 0xdd, 0x7e, 0x8f, 0xf0, 0x26, 0x64, + 0x19, 0x3f, 0x51, 0x37, 0xab, 0xe5, 0x49, 0x09, 0xe3, 0xf9, 0x6c, 0xa2, 0xad, 0x7f, 0x4c, 0x54, + 0x5b, 0x3a, 0xca, 0xd1, 0xe1, 0x94, 0x1d, 0x44, 0x9d, 0xf6, 0xe3, 0xd7, 0xbc, 0x4f, 0x58, 0xb8, + 0x6b, 0x18, 0xb6, 0xff, 0x23, 0x12, 0xd1, 0x3a, 0x5c, 0xff, 0xfa, 0x4c, 0xdd, 0x19, 0xbe, 0xbc, + 0xfa, 0xe5, 0xa0, 0x2f, 0x13, 0x07, 0x9d, 0x4f, 0x1c, 0x74, 0x31, 0x71, 0xd0, 0xd5, 0xc4, 0x41, + 0x1f, 0xa7, 0x8e, 0x75, 0x31, 0x75, 0xac, 0xef, 0x53, 0xc7, 0x7a, 0xf3, 0xe0, 0xda, 0x3c, 0x4b, + 0x32, 0x2f, 0x83, 0x58, 0xa8, 0x53, 0xf0, 0x76, 0xbe, 0xc7, 0x6a, 0xac, 0x71, 0x55, 0xad, 0xed, + 0x93, 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x60, 0xf3, 0x3b, 0x54, 0x4f, 0x03, 0x00, 0x00, } func (this *GenesisState) VerboseEqual(that interface{}) error { diff --git a/x/evmutil/types/msg.go b/x/evmutil/types/msg.go index 093f96a3aa..90e5f891b7 100644 --- a/x/evmutil/types/msg.go +++ b/x/evmutil/types/msg.go @@ -11,7 +11,8 @@ import ( // ensure Msg interface compliance at compile time var ( - _ sdk.Msg = &MsgConvertCoinToERC20{} + _ sdk.Msg = &MsgConvertCoinToERC20{} + // TODO(boodyvo): do we want to switch to Msg? _ legacytx.LegacyMsg = &MsgConvertCoinToERC20{} _ sdk.Msg = &MsgConvertERC20ToCoin{} _ legacytx.LegacyMsg = &MsgConvertERC20ToCoin{} @@ -137,7 +138,7 @@ func (msg MsgConvertERC20ToCoin) ValidateBasic() error { return errorsmod.Wrap(sdkerrors.ErrInvalidAddress, "receiver is not a valid bech32 address") } - if msg.Amount.IsNil() || msg.Amount.LTE(sdk.ZeroInt()) { + if msg.Amount.IsNil() || msg.Amount.LTE(sdkmath.ZeroInt()) { return errorsmod.Wrapf(sdkerrors.ErrInvalidRequest, "amount cannot be zero or less") } diff --git a/x/evmutil/types/query.pb.go b/x/evmutil/types/query.pb.go index 9336d95d8c..3af62afd2d 100644 --- a/x/evmutil/types/query.pb.go +++ b/x/evmutil/types/query.pb.go @@ -411,6 +411,7 @@ func _Query_DeployedCosmosCoinContracts_Handler(srv interface{}, ctx context.Con return interceptor(ctx, in, info, handler) } +var Query_serviceDesc = _Query_serviceDesc var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "kava.evmutil.v1beta1.Query", HandlerType: (*QueryServer)(nil), diff --git a/x/evmutil/types/tx.pb.go b/x/evmutil/types/tx.pb.go index d4aa63b403..549d4e81c2 100644 --- a/x/evmutil/types/tx.pb.go +++ b/x/evmutil/types/tx.pb.go @@ -5,9 +5,9 @@ package types import ( context "context" + cosmossdk_io_math "cosmossdk.io/math" fmt "fmt" _ "github.com/cosmos/cosmos-proto" - github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" @@ -141,7 +141,7 @@ type MsgConvertERC20ToCoin struct { // EVM 0x hex address of the ERC20 contract. KavaERC20Address string `protobuf:"bytes,3,opt,name=kava_erc20_address,json=kavaErc20Address,proto3" json:"kava_erc20_address,omitempty"` // ERC20 token amount to convert. - Amount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,4,opt,name=amount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"amount"` + Amount cosmossdk_io_math.Int `protobuf:"bytes,4,opt,name=amount,proto3,customtype=cosmossdk.io/math.Int" json:"amount"` } func (m *MsgConvertERC20ToCoin) Reset() { *m = MsgConvertERC20ToCoin{} } @@ -452,42 +452,42 @@ func init() { func init() { proto.RegisterFile("kava/evmutil/v1beta1/tx.proto", fileDescriptor_6e82783c6c58f89c) } var fileDescriptor_6e82783c6c58f89c = []byte{ - // 559 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x55, 0x41, 0x6b, 0xd4, 0x4c, - 0x18, 0xde, 0x69, 0x4b, 0xf9, 0x76, 0xbe, 0x4b, 0x19, 0x56, 0x48, 0xa3, 0xcd, 0x96, 0x95, 0x6a, - 0x45, 0x36, 0xe9, 0xee, 0x8a, 0x20, 0x7a, 0x71, 0x97, 0x0a, 0xa5, 0xf4, 0x12, 0xf7, 0xe4, 0x65, - 0x99, 0x64, 0x87, 0x18, 0xda, 0x64, 0x96, 0xcc, 0x6c, 0xa8, 0x3f, 0x40, 0x10, 0x11, 0xd1, 0x3f, - 0xe0, 0xd9, 0x1f, 0xd0, 0x1f, 0xd1, 0x63, 0xe9, 0x49, 0x3c, 0x2c, 0x35, 0xfb, 0x47, 0x64, 0x92, - 0x49, 0x3a, 0xd6, 0x98, 0xb5, 0x22, 0x78, 0xda, 0xcc, 0xbc, 0xcf, 0xf3, 0xbe, 0xcf, 0xf3, 0xbe, - 0x33, 0xb3, 0x70, 0xe3, 0x10, 0xc7, 0xd8, 0x22, 0x71, 0x30, 0xe5, 0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 0x94, 0x42, 0xca, 0x7b, 0x00, 0xf5, 0x8a, 0x73, - 0xd3, 0xfb, 0xfd, 0xcc, 0x05, 0x49, 0x7f, 0xfc, 0x07, 0xa4, 0x5c, 0x50, 0x7f, 0xff, 0xe2, 0x9b, - 0x01, 0x3e, 0x27, 0x06, 0x38, 0x4d, 0x0c, 0x70, 0x96, 0x18, 0xe0, 0x22, 0x31, 0xc0, 0x87, 0xb9, - 0x51, 0x3b, 0x9b, 0x1b, 0xb5, 0x2f, 0x73, 0xa3, 0xf6, 0xe2, 0x9e, 0xf2, 0x00, 0x88, 0x42, 0xed, - 0x23, 0xec, 0xb0, 0xf4, 0xcb, 0x3a, 0x2e, 0xfe, 0x29, 0xd2, 0x77, 0xc0, 0x59, 0x4d, 0x9f, 0xef, - 0xde, 0xf7, 0x00, 0x00, 0x00, 0xff, 0xff, 0xa2, 0x5a, 0x1f, 0x90, 0x46, 0x06, 0x00, 0x00, + // 553 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x55, 0xdd, 0x6a, 0x13, 0x41, + 0x14, 0xce, 0xd8, 0x52, 0xcc, 0x78, 0x53, 0x86, 0x14, 0xb6, 0xab, 0xdd, 0x94, 0x48, 0xb1, 0x52, + 0x32, 0xdb, 0x24, 0x22, 0x88, 0x57, 0x26, 0x54, 0x28, 0xa5, 0x37, 0x6b, 0xaf, 0xbc, 0x09, 0xb3, + 0x9b, 0x61, 0x3b, 0xb4, 0xbb, 0x13, 0x76, 0x26, 0x4b, 0x7d, 0x03, 0x11, 0x11, 0x7d, 0x01, 0xaf, + 0x7d, 0x80, 0x3e, 0x44, 0x2f, 0x4b, 0xaf, 0xc4, 0x8b, 0x50, 0x37, 0xaf, 0xe0, 0x03, 0xc8, 0xec, + 0x5f, 0xb7, 0x75, 0xdd, 0x58, 0x11, 0xbc, 0xdb, 0x99, 0xf3, 0x7d, 0xe7, 0x7c, 0x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d1, 0x9f, 0xdd, 0x9a, 0x92, 0x4b, 0xf9, 0x00, + 0xa0, 0x5e, 0xb1, 0x37, 0xbd, 0x3f, 0xcf, 0x9c, 0x93, 0xf4, 0xe7, 0x7f, 0x41, 0xca, 0x04, 0xf5, + 0xf7, 0x2e, 0xbf, 0x1b, 0xe0, 0x4b, 0x64, 0x80, 0xb3, 0xc8, 0x00, 0xe7, 0x91, 0x01, 0x2e, 0x23, + 0x03, 0x7c, 0x9c, 0x19, 0xb5, 0xf3, 0x99, 0x51, 0xfb, 0x3a, 0x33, 0x6a, 0xaf, 0x1f, 0xbb, 0x4c, + 0x1e, 0x4e, 0x6c, 0xec, 0x70, 0xcf, 0x54, 0x85, 0xda, 0xc7, 0xc4, 0x16, 0xf1, 0x97, 0x79, 0x92, + 0xff, 0x31, 0xc8, 0x37, 0x63, 0x2a, 0xec, 0xa5, 0xf8, 0xd7, 0xba, 0xf7, 0x33, 0x00, 0x00, 0xff, + 0xff, 0xcd, 0x21, 0x15, 0x75, 0x35, 0x06, 0x00, 0x00, } func (this *MsgConvertCoinToERC20) VerboseEqual(that interface{}) error { @@ -1124,6 +1124,7 @@ func _Msg_ConvertCosmosCoinFromERC20_Handler(srv interface{}, ctx context.Contex return interceptor(ctx, in, info, handler) } +var Msg_serviceDesc = _Msg_serviceDesc var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "kava.evmutil.v1beta1.Msg", HandlerType: (*MsgServer)(nil), diff --git a/x/hard/genesis.go b/x/hard/genesis.go index b19749d3b3..91079f5951 100644 --- a/x/hard/genesis.go +++ b/x/hard/genesis.go @@ -1,6 +1,7 @@ package hard import ( + sdkmath "cosmossdk.io/math" "fmt" sdk "github.com/cosmos/cosmos-sdk/types" @@ -90,11 +91,11 @@ func ExportGenesis(ctx sdk.Context, k keeper.Keeper) types.GenesisState { for _, mm := range params.MoneyMarkets { supplyFactor, f := k.GetSupplyInterestFactor(ctx, mm.Denom) if !f { - supplyFactor = sdk.OneDec() + supplyFactor = sdkmath.LegacyOneDec() } borrowFactor, f := k.GetBorrowInterestFactor(ctx, mm.Denom) if !f { - borrowFactor = sdk.OneDec() + borrowFactor = sdkmath.LegacyOneDec() } previousAccrualTime, f := k.GetPreviousAccrualTime(ctx, mm.Denom) if !f { diff --git a/x/hard/genesis_test.go b/x/hard/genesis_test.go index 8d8b923acc..298dbd230c 100644 --- a/x/hard/genesis_test.go +++ b/x/hard/genesis_test.go @@ -31,7 +31,7 @@ type GenesisTestSuite struct { func (suite *GenesisTestSuite) SetupTest() { tApp := app.NewTestApp() suite.genTime = tmtime.Canonical(time.Date(2021, 1, 1, 1, 1, 1, 1, time.UTC)) - suite.ctx = tApp.NewContext(true, tmproto.Header{Height: 1, Time: suite.genTime}) + suite.ctx = tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: suite.genTime}) suite.keeper = tApp.GetHardKeeper() suite.app = tApp @@ -40,29 +40,29 @@ func (suite *GenesisTestSuite) SetupTest() { } func (suite *GenesisTestSuite) Test_InitExportGenesis() { - loanToValue, _ := sdk.NewDecFromStr("0.6") + loanToValue, _ := sdkmath.LegacyNewDecFromStr("0.6") params := types.NewParams( types.MoneyMarkets{ types.NewMoneyMarket( "ukava", types.NewBorrowLimit( false, - sdk.NewDec(1e15), + sdkmath.LegacyNewDec(1e15), loanToValue, ), "kava:usd", sdkmath.NewInt(1e6), types.NewInterestRateModel( - sdk.MustNewDecFromStr("0.05"), - sdk.MustNewDecFromStr("2"), - sdk.MustNewDecFromStr("0.8"), - sdk.MustNewDecFromStr("10"), + sdkmath.LegacyMustNewDecFromStr("0.05"), + sdkmath.LegacyMustNewDecFromStr("2"), + sdkmath.LegacyMustNewDecFromStr("0.8"), + sdkmath.LegacyMustNewDecFromStr("10"), ), - sdk.MustNewDecFromStr("0.05"), - sdk.ZeroDec(), + sdkmath.LegacyMustNewDecFromStr("0.05"), + sdkmath.LegacyZeroDec(), ), }, - sdk.NewDec(10), + sdkmath.LegacyNewDec(10), ) deposits := types.Deposits{ @@ -72,7 +72,7 @@ func (suite *GenesisTestSuite) Test_InitExportGenesis() { types.SupplyInterestFactors{ { Denom: "ukava", - Value: sdk.NewDec(1), + Value: sdkmath.LegacyNewDec(1), }, }, ), @@ -90,7 +90,7 @@ func (suite *GenesisTestSuite) Test_InitExportGenesis() { types.BorrowInterestFactors{ { Denom: "ukava", - Value: sdk.NewDec(1), + Value: sdkmath.LegacyNewDec(1), }, }, ), @@ -101,8 +101,8 @@ func (suite *GenesisTestSuite) Test_InitExportGenesis() { totalBorrowed = totalBorrowed.Add(borrow.Amount...) } - supplyInterestFactor := sdk.MustNewDecFromStr("1.0001") - borrowInterestFactor := sdk.MustNewDecFromStr("1.1234") + supplyInterestFactor := sdkmath.LegacyMustNewDecFromStr("1.0001") + borrowInterestFactor := sdkmath.LegacyMustNewDecFromStr("1.1234") accuralTimes := types.GenesisAccumulationTimes{ types.NewGenesisAccumulationTime("ukava", suite.genTime, supplyInterestFactor, borrowInterestFactor), } diff --git a/x/hard/keeper/borrow.go b/x/hard/keeper/borrow.go index df65fc14ef..cd06cc61ab 100644 --- a/x/hard/keeper/borrow.go +++ b/x/hard/keeper/borrow.go @@ -18,7 +18,7 @@ func (k Keeper) Borrow(ctx sdk.Context, borrower sdk.AccAddress, coins sdk.Coins if !foundInterestFactor { _, foundMm := k.GetMoneyMarket(ctx, coin.Denom) if foundMm { - k.SetBorrowInterestFactor(ctx, coin.Denom, sdk.OneDec()) + k.SetBorrowInterestFactor(ctx, coin.Denom, sdkmath.LegacyOneDec()) } } } @@ -135,7 +135,7 @@ func (k Keeper) ValidateBorrow(ctx sdk.Context, borrower sdk.AccAddress, amount } // Get the proposed borrow USD value - proprosedBorrowUSDValue := sdk.ZeroDec() + proprosedBorrowUSDValue := sdkmath.LegacyZeroDec() for _, coin := range amount { moneyMarket, found := k.GetMoneyMarket(ctx, coin.Denom) if !found { @@ -147,18 +147,18 @@ func (k Keeper) ValidateBorrow(ctx sdk.Context, borrower sdk.AccAddress, amount if err != nil { return errorsmod.Wrapf(types.ErrPriceNotFound, "no price found for market %s", moneyMarket.SpotMarketID) } - coinUSDValue := sdk.NewDecFromInt(coin.Amount).Quo(sdk.NewDecFromInt(moneyMarket.ConversionFactor)).Mul(assetPriceInfo.Price) + coinUSDValue := sdkmath.LegacyNewDecFromInt(coin.Amount).Quo(sdkmath.LegacyNewDecFromInt(moneyMarket.ConversionFactor)).Mul(assetPriceInfo.Price) // Validate the requested borrow value for the asset against the money market's global borrow limit if moneyMarket.BorrowLimit.HasMaxLimit { var assetTotalBorrowedAmount sdkmath.Int totalBorrowedCoins, found := k.GetBorrowedCoins(ctx) if !found { - assetTotalBorrowedAmount = sdk.ZeroInt() + assetTotalBorrowedAmount = sdkmath.ZeroInt() } else { assetTotalBorrowedAmount = totalBorrowedCoins.AmountOf(coin.Denom) } - newProposedAssetTotalBorrowedAmount := sdk.NewDecFromInt(assetTotalBorrowedAmount.Add(coin.Amount)) + newProposedAssetTotalBorrowedAmount := sdkmath.LegacyNewDecFromInt(assetTotalBorrowedAmount.Add(coin.Amount)) if newProposedAssetTotalBorrowedAmount.GT(moneyMarket.BorrowLimit.MaximumLimit) { return errorsmod.Wrapf(types.ErrGreaterThanAssetBorrowLimit, "proposed borrow would result in %s borrowed, but the maximum global asset borrow limit is %s", @@ -173,7 +173,7 @@ func (k Keeper) ValidateBorrow(ctx sdk.Context, borrower sdk.AccAddress, amount if !found { return errorsmod.Wrapf(types.ErrDepositsNotFound, "no deposits found for %s", borrower) } - totalBorrowableAmount := sdk.ZeroDec() + totalBorrowableAmount := sdkmath.LegacyZeroDec() for _, coin := range deposit.Amount { moneyMarket, found := k.GetMoneyMarket(ctx, coin.Denom) if !found { @@ -185,13 +185,13 @@ func (k Keeper) ValidateBorrow(ctx sdk.Context, borrower sdk.AccAddress, amount if err != nil { return errorsmod.Wrapf(types.ErrPriceNotFound, "no price found for market %s", moneyMarket.SpotMarketID) } - depositUSDValue := sdk.NewDecFromInt(coin.Amount).Quo(sdk.NewDecFromInt(moneyMarket.ConversionFactor)).Mul(assetPriceInfo.Price) + depositUSDValue := sdkmath.LegacyNewDecFromInt(coin.Amount).Quo(sdkmath.LegacyNewDecFromInt(moneyMarket.ConversionFactor)).Mul(assetPriceInfo.Price) borrowableAmountForDeposit := depositUSDValue.Mul(moneyMarket.BorrowLimit.LoanToValue) totalBorrowableAmount = totalBorrowableAmount.Add(borrowableAmountForDeposit) } // Get the total USD value of user's existing borrows - existingBorrowUSDValue := sdk.ZeroDec() + existingBorrowUSDValue := sdkmath.LegacyZeroDec() existingBorrow, found := k.GetBorrow(ctx, borrower) if found { for _, coin := range existingBorrow.Amount { @@ -205,7 +205,7 @@ func (k Keeper) ValidateBorrow(ctx sdk.Context, borrower sdk.AccAddress, amount if err != nil { return errorsmod.Wrapf(types.ErrPriceNotFound, "no price found for market %s", moneyMarket.SpotMarketID) } - coinUSDValue := sdk.NewDecFromInt(coin.Amount).Quo(sdk.NewDecFromInt(moneyMarket.ConversionFactor)).Mul(assetPriceInfo.Price) + coinUSDValue := sdkmath.LegacyNewDecFromInt(coin.Amount).Quo(sdkmath.LegacyNewDecFromInt(moneyMarket.ConversionFactor)).Mul(assetPriceInfo.Price) existingBorrowUSDValue = existingBorrowUSDValue.Add(coinUSDValue) } } @@ -278,7 +278,7 @@ func (k Keeper) DecrementBorrowedCoins(ctx sdk.Context, coins sdk.Coins) error { coinsToSubtract := sdk.NewCoins() for _, coin := range coins { if borrowedCoins.AmountOf(coin.Denom).LT(coin.Amount) { - if borrowedCoins.AmountOf(coin.Denom).GT(sdk.ZeroInt()) { + if borrowedCoins.AmountOf(coin.Denom).GT(sdkmath.ZeroInt()) { coinsToSubtract = coinsToSubtract.Add(sdk.NewCoin(coin.Denom, borrowedCoins.AmountOf(coin.Denom))) } } else { @@ -320,7 +320,7 @@ func (k Keeper) loadSyncedBorrow(ctx sdk.Context, borrow types.Borrow) types.Bor // Calculate interest owed by user for this asset if foundAtIndex != -1 { - storedAmount := sdk.NewDecFromInt(borrow.Amount.AmountOf(coin.Denom)) + storedAmount := sdkmath.LegacyNewDecFromInt(borrow.Amount.AmountOf(coin.Denom)) userLastInterestFactor := borrow.Index[foundAtIndex].Value coinInterest := (storedAmount.Quo(userLastInterestFactor).Mul(interestFactorValue)).Sub(storedAmount) totalNewInterest = totalNewInterest.Add(sdk.NewCoin(coin.Denom, coinInterest.TruncateInt())) diff --git a/x/hard/keeper/borrow_test.go b/x/hard/keeper/borrow_test.go index 9f9c8f5d7a..45e3a6695b 100644 --- a/x/hard/keeper/borrow_test.go +++ b/x/hard/keeper/borrow_test.go @@ -26,13 +26,13 @@ const ( func (suite *KeeperTestSuite) TestBorrow() { type setupArgs struct { - usdxBorrowLimit sdk.Dec - priceKAVA sdk.Dec - loanToValueKAVA sdk.Dec - priceBTCB sdk.Dec - loanToValueBTCB sdk.Dec - priceBNB sdk.Dec - loanToValueBNB sdk.Dec + usdxBorrowLimit sdkmath.LegacyDec + priceKAVA sdkmath.LegacyDec + loanToValueKAVA sdkmath.LegacyDec + priceBTCB sdkmath.LegacyDec + loanToValueBTCB sdkmath.LegacyDec + priceBNB sdkmath.LegacyDec + loanToValueBNB sdkmath.LegacyDec borrower sdk.AccAddress depositCoins []sdk.Coin initialBorrowCoins sdk.Coins @@ -61,13 +61,13 @@ func (suite *KeeperTestSuite) TestBorrow() { { name: "valid", setup: setupArgs{ - usdxBorrowLimit: sdk.MustNewDecFromStr("100000000000"), - priceKAVA: sdk.MustNewDecFromStr("5.00"), - loanToValueKAVA: sdk.MustNewDecFromStr("0.6"), - priceBTCB: sdk.MustNewDecFromStr("0.00"), - loanToValueBTCB: sdk.MustNewDecFromStr("0.01"), - priceBNB: sdk.MustNewDecFromStr("0.00"), - loanToValueBNB: sdk.MustNewDecFromStr("0.01"), + usdxBorrowLimit: sdkmath.LegacyMustNewDecFromStr("100000000000"), + priceKAVA: sdkmath.LegacyMustNewDecFromStr("5.00"), + loanToValueKAVA: sdkmath.LegacyMustNewDecFromStr("0.6"), + priceBTCB: sdkmath.LegacyMustNewDecFromStr("0.00"), + loanToValueBTCB: sdkmath.LegacyMustNewDecFromStr("0.01"), + priceBNB: sdkmath.LegacyMustNewDecFromStr("0.00"), + loanToValueBNB: sdkmath.LegacyMustNewDecFromStr("0.01"), borrower: sdk.AccAddress(crypto.AddressHash([]byte("test"))), depositCoins: []sdk.Coin{sdk.NewCoin("ukava", sdkmath.NewInt(100*KAVA_CF))}, initialBorrowCoins: sdk.NewCoins(), @@ -90,13 +90,13 @@ func (suite *KeeperTestSuite) TestBorrow() { { name: "invalid: loan-to-value limited", setup: setupArgs{ - usdxBorrowLimit: sdk.MustNewDecFromStr("100000000000"), - priceKAVA: sdk.MustNewDecFromStr("5.00"), - loanToValueKAVA: sdk.MustNewDecFromStr("0.6"), - priceBTCB: sdk.MustNewDecFromStr("0.00"), - loanToValueBTCB: sdk.MustNewDecFromStr("0.01"), - priceBNB: sdk.MustNewDecFromStr("0.00"), - loanToValueBNB: sdk.MustNewDecFromStr("0.01"), + usdxBorrowLimit: sdkmath.LegacyMustNewDecFromStr("100000000000"), + priceKAVA: sdkmath.LegacyMustNewDecFromStr("5.00"), + loanToValueKAVA: sdkmath.LegacyMustNewDecFromStr("0.6"), + priceBTCB: sdkmath.LegacyMustNewDecFromStr("0.00"), + loanToValueBTCB: sdkmath.LegacyMustNewDecFromStr("0.01"), + priceBNB: sdkmath.LegacyMustNewDecFromStr("0.00"), + loanToValueBNB: sdkmath.LegacyMustNewDecFromStr("0.01"), borrower: sdk.AccAddress(crypto.AddressHash([]byte("test"))), depositCoins: []sdk.Coin{sdk.NewCoin("ukava", sdkmath.NewInt(20*KAVA_CF))}, // 20 KAVA x $5.00 price = $100 initialBorrowCoins: sdk.NewCoins(), @@ -120,13 +120,13 @@ func (suite *KeeperTestSuite) TestBorrow() { { name: "valid: multiple deposits", setup: setupArgs{ - usdxBorrowLimit: sdk.MustNewDecFromStr("100000000000"), - priceKAVA: sdk.MustNewDecFromStr("2.00"), - loanToValueKAVA: sdk.MustNewDecFromStr("0.80"), - priceBTCB: sdk.MustNewDecFromStr("10000.00"), - loanToValueBTCB: sdk.MustNewDecFromStr("0.10"), - priceBNB: sdk.MustNewDecFromStr("0.00"), - loanToValueBNB: sdk.MustNewDecFromStr("0.01"), + usdxBorrowLimit: sdkmath.LegacyMustNewDecFromStr("100000000000"), + priceKAVA: sdkmath.LegacyMustNewDecFromStr("2.00"), + loanToValueKAVA: sdkmath.LegacyMustNewDecFromStr("0.80"), + priceBTCB: sdkmath.LegacyMustNewDecFromStr("10000.00"), + loanToValueBTCB: sdkmath.LegacyMustNewDecFromStr("0.10"), + priceBNB: sdkmath.LegacyMustNewDecFromStr("0.00"), + loanToValueBNB: sdkmath.LegacyMustNewDecFromStr("0.01"), borrower: sdk.AccAddress(crypto.AddressHash([]byte("test"))), depositCoins: sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(50*KAVA_CF)), sdk.NewCoin("btcb", sdkmath.NewInt(0.1*BTCB_CF))), initialBorrowCoins: sdk.NewCoins(), @@ -151,13 +151,13 @@ func (suite *KeeperTestSuite) TestBorrow() { { name: "invalid: multiple deposits", setup: setupArgs{ - usdxBorrowLimit: sdk.MustNewDecFromStr("100000000000"), - priceKAVA: sdk.MustNewDecFromStr("2.00"), - loanToValueKAVA: sdk.MustNewDecFromStr("0.80"), - priceBTCB: sdk.MustNewDecFromStr("10000.00"), - loanToValueBTCB: sdk.MustNewDecFromStr("0.10"), - priceBNB: sdk.MustNewDecFromStr("0.00"), - loanToValueBNB: sdk.MustNewDecFromStr("0.01"), + usdxBorrowLimit: sdkmath.LegacyMustNewDecFromStr("100000000000"), + priceKAVA: sdkmath.LegacyMustNewDecFromStr("2.00"), + loanToValueKAVA: sdkmath.LegacyMustNewDecFromStr("0.80"), + priceBTCB: sdkmath.LegacyMustNewDecFromStr("10000.00"), + loanToValueBTCB: sdkmath.LegacyMustNewDecFromStr("0.10"), + priceBNB: sdkmath.LegacyMustNewDecFromStr("0.00"), + loanToValueBNB: sdkmath.LegacyMustNewDecFromStr("0.01"), borrower: sdk.AccAddress(crypto.AddressHash([]byte("test"))), depositCoins: sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(50*KAVA_CF)), sdk.NewCoin("btcb", sdkmath.NewInt(0.1*BTCB_CF))), initialBorrowCoins: sdk.NewCoins(), @@ -181,13 +181,13 @@ func (suite *KeeperTestSuite) TestBorrow() { { name: "valid: multiple previous borrows", setup: setupArgs{ - usdxBorrowLimit: sdk.MustNewDecFromStr("100000000000"), - priceKAVA: sdk.MustNewDecFromStr("2.00"), - loanToValueKAVA: sdk.MustNewDecFromStr("0.8"), - priceBTCB: sdk.MustNewDecFromStr("0.00"), - loanToValueBTCB: sdk.MustNewDecFromStr("0.01"), - priceBNB: sdk.MustNewDecFromStr("5.00"), - loanToValueBNB: sdk.MustNewDecFromStr("0.8"), + usdxBorrowLimit: sdkmath.LegacyMustNewDecFromStr("100000000000"), + priceKAVA: sdkmath.LegacyMustNewDecFromStr("2.00"), + loanToValueKAVA: sdkmath.LegacyMustNewDecFromStr("0.8"), + priceBTCB: sdkmath.LegacyMustNewDecFromStr("0.00"), + loanToValueBTCB: sdkmath.LegacyMustNewDecFromStr("0.01"), + priceBNB: sdkmath.LegacyMustNewDecFromStr("5.00"), + loanToValueBNB: sdkmath.LegacyMustNewDecFromStr("0.8"), borrower: sdk.AccAddress(crypto.AddressHash([]byte("test"))), depositCoins: sdk.NewCoins(sdk.NewCoin("bnb", sdkmath.NewInt(30*BNB_CF)), sdk.NewCoin("ukava", sdkmath.NewInt(50*KAVA_CF))), // (50 KAVA x $2.00 price = $100) + (30 BNB x $5.00 price = $150) = $250 initialBorrowCoins: sdk.NewCoins(sdk.NewCoin("usdx", sdkmath.NewInt(99*USDX_CF)), sdk.NewCoin("busd", sdkmath.NewInt(100*BUSD_CF))), @@ -210,13 +210,13 @@ func (suite *KeeperTestSuite) TestBorrow() { { name: "invalid: over loan-to-value with multiple previous borrows", setup: setupArgs{ - usdxBorrowLimit: sdk.MustNewDecFromStr("100000000000"), - priceKAVA: sdk.MustNewDecFromStr("2.00"), - loanToValueKAVA: sdk.MustNewDecFromStr("0.8"), - priceBTCB: sdk.MustNewDecFromStr("0.00"), - loanToValueBTCB: sdk.MustNewDecFromStr("0.01"), - priceBNB: sdk.MustNewDecFromStr("5.00"), - loanToValueBNB: sdk.MustNewDecFromStr("0.8"), + usdxBorrowLimit: sdkmath.LegacyMustNewDecFromStr("100000000000"), + priceKAVA: sdkmath.LegacyMustNewDecFromStr("2.00"), + loanToValueKAVA: sdkmath.LegacyMustNewDecFromStr("0.8"), + priceBTCB: sdkmath.LegacyMustNewDecFromStr("0.00"), + loanToValueBTCB: sdkmath.LegacyMustNewDecFromStr("0.01"), + priceBNB: sdkmath.LegacyMustNewDecFromStr("5.00"), + loanToValueBNB: sdkmath.LegacyMustNewDecFromStr("0.8"), borrower: sdk.AccAddress(crypto.AddressHash([]byte("test"))), depositCoins: sdk.NewCoins(sdk.NewCoin("bnb", sdkmath.NewInt(30*BNB_CF)), sdk.NewCoin("ukava", sdkmath.NewInt(50*KAVA_CF))), // (50 KAVA x $2.00 price = $100) + (30 BNB x $5.00 price = $150) = $250 initialBorrowCoins: sdk.NewCoins(sdk.NewCoin("usdx", sdkmath.NewInt(100*USDX_CF)), sdk.NewCoin("busd", sdkmath.NewInt(100*BUSD_CF))), @@ -239,13 +239,13 @@ func (suite *KeeperTestSuite) TestBorrow() { { name: "invalid: no price for asset", setup: setupArgs{ - usdxBorrowLimit: sdk.MustNewDecFromStr("100000000000"), - priceKAVA: sdk.MustNewDecFromStr("5.00"), - loanToValueKAVA: sdk.MustNewDecFromStr("0.6"), - priceBTCB: sdk.MustNewDecFromStr("0.00"), - loanToValueBTCB: sdk.MustNewDecFromStr("0.01"), - priceBNB: sdk.MustNewDecFromStr("0.00"), - loanToValueBNB: sdk.MustNewDecFromStr("0.01"), + usdxBorrowLimit: sdkmath.LegacyMustNewDecFromStr("100000000000"), + priceKAVA: sdkmath.LegacyMustNewDecFromStr("5.00"), + loanToValueKAVA: sdkmath.LegacyMustNewDecFromStr("0.6"), + priceBTCB: sdkmath.LegacyMustNewDecFromStr("0.00"), + loanToValueBTCB: sdkmath.LegacyMustNewDecFromStr("0.01"), + priceBNB: sdkmath.LegacyMustNewDecFromStr("0.00"), + loanToValueBNB: sdkmath.LegacyMustNewDecFromStr("0.01"), borrower: sdk.AccAddress(crypto.AddressHash([]byte("test"))), depositCoins: sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(100*KAVA_CF))), initialBorrowCoins: sdk.NewCoins(), @@ -269,13 +269,13 @@ func (suite *KeeperTestSuite) TestBorrow() { { name: "invalid: borrow exceed module account balance", setup: setupArgs{ - usdxBorrowLimit: sdk.MustNewDecFromStr("100000000000"), - priceKAVA: sdk.MustNewDecFromStr("2.00"), - loanToValueKAVA: sdk.MustNewDecFromStr("0.8"), - priceBTCB: sdk.MustNewDecFromStr("0.00"), - loanToValueBTCB: sdk.MustNewDecFromStr("0.01"), - priceBNB: sdk.MustNewDecFromStr("0.00"), - loanToValueBNB: sdk.MustNewDecFromStr("0.01"), + usdxBorrowLimit: sdkmath.LegacyMustNewDecFromStr("100000000000"), + priceKAVA: sdkmath.LegacyMustNewDecFromStr("2.00"), + loanToValueKAVA: sdkmath.LegacyMustNewDecFromStr("0.8"), + priceBTCB: sdkmath.LegacyMustNewDecFromStr("0.00"), + loanToValueBTCB: sdkmath.LegacyMustNewDecFromStr("0.01"), + priceBNB: sdkmath.LegacyMustNewDecFromStr("0.00"), + loanToValueBNB: sdkmath.LegacyMustNewDecFromStr("0.01"), borrower: sdk.AccAddress(crypto.AddressHash([]byte("test"))), depositCoins: sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(100*KAVA_CF))), initialBorrowCoins: sdk.NewCoins(), @@ -298,13 +298,13 @@ func (suite *KeeperTestSuite) TestBorrow() { { name: "invalid: over global asset borrow limit", setup: setupArgs{ - usdxBorrowLimit: sdk.MustNewDecFromStr("20000000"), - priceKAVA: sdk.MustNewDecFromStr("2.00"), - loanToValueKAVA: sdk.MustNewDecFromStr("0.8"), - priceBTCB: sdk.MustNewDecFromStr("0.00"), - loanToValueBTCB: sdk.MustNewDecFromStr("0.01"), - priceBNB: sdk.MustNewDecFromStr("0.00"), - loanToValueBNB: sdk.MustNewDecFromStr("0.01"), + usdxBorrowLimit: sdkmath.LegacyMustNewDecFromStr("20000000"), + priceKAVA: sdkmath.LegacyMustNewDecFromStr("2.00"), + loanToValueKAVA: sdkmath.LegacyMustNewDecFromStr("0.8"), + priceBTCB: sdkmath.LegacyMustNewDecFromStr("0.00"), + loanToValueBTCB: sdkmath.LegacyMustNewDecFromStr("0.01"), + priceBNB: sdkmath.LegacyMustNewDecFromStr("0.00"), + loanToValueBNB: sdkmath.LegacyMustNewDecFromStr("0.01"), borrower: sdk.AccAddress(crypto.AddressHash([]byte("test"))), depositCoins: sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(50*KAVA_CF))), initialBorrowCoins: sdk.NewCoins(), @@ -327,13 +327,13 @@ func (suite *KeeperTestSuite) TestBorrow() { { name: "invalid: borrowing an individual coin type results in a borrow that's under the minimum USD borrow limit", setup: setupArgs{ - usdxBorrowLimit: sdk.MustNewDecFromStr("20000000"), - priceKAVA: sdk.MustNewDecFromStr("2.00"), - loanToValueKAVA: sdk.MustNewDecFromStr("0.8"), - priceBTCB: sdk.MustNewDecFromStr("0.00"), - loanToValueBTCB: sdk.MustNewDecFromStr("0.01"), - priceBNB: sdk.MustNewDecFromStr("0.00"), - loanToValueBNB: sdk.MustNewDecFromStr("0.01"), + usdxBorrowLimit: sdkmath.LegacyMustNewDecFromStr("20000000"), + priceKAVA: sdkmath.LegacyMustNewDecFromStr("2.00"), + loanToValueKAVA: sdkmath.LegacyMustNewDecFromStr("0.8"), + priceBTCB: sdkmath.LegacyMustNewDecFromStr("0.00"), + loanToValueBTCB: sdkmath.LegacyMustNewDecFromStr("0.01"), + priceBNB: sdkmath.LegacyMustNewDecFromStr("0.00"), + loanToValueBNB: sdkmath.LegacyMustNewDecFromStr("0.01"), borrower: sdk.AccAddress(crypto.AddressHash([]byte("test"))), depositCoins: sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(50*KAVA_CF))), initialBorrowCoins: sdk.NewCoins(), @@ -356,13 +356,13 @@ func (suite *KeeperTestSuite) TestBorrow() { { name: "invalid: borrowing multiple coins results in a borrow that's under the minimum USD borrow limit", setup: setupArgs{ - usdxBorrowLimit: sdk.MustNewDecFromStr("20000000"), - priceKAVA: sdk.MustNewDecFromStr("2.00"), - loanToValueKAVA: sdk.MustNewDecFromStr("0.8"), - priceBTCB: sdk.MustNewDecFromStr("0.00"), - loanToValueBTCB: sdk.MustNewDecFromStr("0.01"), - priceBNB: sdk.MustNewDecFromStr("0.00"), - loanToValueBNB: sdk.MustNewDecFromStr("0.01"), + usdxBorrowLimit: sdkmath.LegacyMustNewDecFromStr("20000000"), + priceKAVA: sdkmath.LegacyMustNewDecFromStr("2.00"), + loanToValueKAVA: sdkmath.LegacyMustNewDecFromStr("0.8"), + priceBTCB: sdkmath.LegacyMustNewDecFromStr("0.00"), + loanToValueBTCB: sdkmath.LegacyMustNewDecFromStr("0.01"), + priceBNB: sdkmath.LegacyMustNewDecFromStr("0.00"), + loanToValueBNB: sdkmath.LegacyMustNewDecFromStr("0.01"), borrower: sdk.AccAddress(crypto.AddressHash([]byte("test"))), depositCoins: sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(50*KAVA_CF))), initialBorrowCoins: sdk.NewCoins(), @@ -385,13 +385,13 @@ func (suite *KeeperTestSuite) TestBorrow() { { name: "valid borrow multiple blocks", setup: setupArgs{ - usdxBorrowLimit: sdk.MustNewDecFromStr("100000000000"), - priceKAVA: sdk.MustNewDecFromStr("5.00"), - loanToValueKAVA: sdk.MustNewDecFromStr("0.6"), - priceBTCB: sdk.MustNewDecFromStr("0.00"), - loanToValueBTCB: sdk.MustNewDecFromStr("0.01"), - priceBNB: sdk.MustNewDecFromStr("0.00"), - loanToValueBNB: sdk.MustNewDecFromStr("0.01"), + usdxBorrowLimit: sdkmath.LegacyMustNewDecFromStr("100000000000"), + priceKAVA: sdkmath.LegacyMustNewDecFromStr("5.00"), + loanToValueKAVA: sdkmath.LegacyMustNewDecFromStr("0.6"), + priceBTCB: sdkmath.LegacyMustNewDecFromStr("0.00"), + loanToValueBTCB: sdkmath.LegacyMustNewDecFromStr("0.01"), + priceBNB: sdkmath.LegacyMustNewDecFromStr("0.00"), + loanToValueBNB: sdkmath.LegacyMustNewDecFromStr("0.01"), borrower: sdk.AccAddress(crypto.AddressHash([]byte("test"))), depositCoins: []sdk.Coin{sdk.NewCoin("ukava", sdkmath.NewInt(100*KAVA_CF))}, initialBorrowCoins: sdk.NewCoins(), @@ -423,13 +423,13 @@ func (suite *KeeperTestSuite) TestBorrow() { { name: "valid borrow followed by protocol reserves exceed available cash for busd when borrowing from ukava", setup: setupArgs{ - usdxBorrowLimit: sdk.MustNewDecFromStr("100000000000"), - priceKAVA: sdk.MustNewDecFromStr("5.00"), - loanToValueKAVA: sdk.MustNewDecFromStr("0.8"), - priceBTCB: sdk.MustNewDecFromStr("0.00"), - loanToValueBTCB: sdk.MustNewDecFromStr("0.01"), - priceBNB: sdk.MustNewDecFromStr("5.00"), - loanToValueBNB: sdk.MustNewDecFromStr("0.8"), + usdxBorrowLimit: sdkmath.LegacyMustNewDecFromStr("100000000000"), + priceKAVA: sdkmath.LegacyMustNewDecFromStr("5.00"), + loanToValueKAVA: sdkmath.LegacyMustNewDecFromStr("0.8"), + priceBTCB: sdkmath.LegacyMustNewDecFromStr("0.00"), + loanToValueBTCB: sdkmath.LegacyMustNewDecFromStr("0.01"), + priceBNB: sdkmath.LegacyMustNewDecFromStr("5.00"), + loanToValueBNB: sdkmath.LegacyMustNewDecFromStr("0.8"), borrower: sdk.AccAddress(crypto.AddressHash([]byte("test"))), depositCoins: sdk.NewCoins(sdk.NewCoin("bnb", sdkmath.NewInt(30*BNB_CF)), sdk.NewCoin("ukava", sdkmath.NewInt(50*KAVA_CF))), initialBorrowCoins: sdk.NewCoins(sdk.NewCoin("usdx", sdkmath.NewInt(99*USDX_CF)), sdk.NewCoin("busd", sdkmath.NewInt(100*BUSD_CF))), @@ -472,13 +472,13 @@ func (suite *KeeperTestSuite) TestBorrow() { { name: "valid borrow followed by protocol reserves exceed available cash for busd when borrowing from busd", setup: setupArgs{ - usdxBorrowLimit: sdk.MustNewDecFromStr("100000000000"), - priceKAVA: sdk.MustNewDecFromStr("2.00"), - loanToValueKAVA: sdk.MustNewDecFromStr("0.8"), - priceBTCB: sdk.MustNewDecFromStr("0.00"), - loanToValueBTCB: sdk.MustNewDecFromStr("0.01"), - priceBNB: sdk.MustNewDecFromStr("5.00"), - loanToValueBNB: sdk.MustNewDecFromStr("0.8"), + usdxBorrowLimit: sdkmath.LegacyMustNewDecFromStr("100000000000"), + priceKAVA: sdkmath.LegacyMustNewDecFromStr("2.00"), + loanToValueKAVA: sdkmath.LegacyMustNewDecFromStr("0.8"), + priceBTCB: sdkmath.LegacyMustNewDecFromStr("0.00"), + loanToValueBTCB: sdkmath.LegacyMustNewDecFromStr("0.01"), + priceBNB: sdkmath.LegacyMustNewDecFromStr("5.00"), + loanToValueBNB: sdkmath.LegacyMustNewDecFromStr("0.8"), borrower: sdk.AccAddress(crypto.AddressHash([]byte("test"))), depositCoins: sdk.NewCoins(sdk.NewCoin("bnb", sdkmath.NewInt(30*BNB_CF)), sdk.NewCoin("ukava", sdkmath.NewInt(50*KAVA_CF))), initialBorrowCoins: sdk.NewCoins(sdk.NewCoin("usdx", sdkmath.NewInt(99*USDX_CF)), sdk.NewCoin("busd", sdkmath.NewInt(100*BUSD_CF))), @@ -513,7 +513,7 @@ func (suite *KeeperTestSuite) TestBorrow() { suite.Run(tc.name, func() { // Initialize test app and set context tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) // Auth module genesis state authGS := app.NewFundedGenStateWithCoins( @@ -532,14 +532,14 @@ func (suite *KeeperTestSuite) TestBorrow() { // hard module genesis state hardGS := types.NewGenesisState(types.NewParams( types.MoneyMarkets{ - types.NewMoneyMarket("usdx", types.NewBorrowLimit(true, tc.setup.usdxBorrowLimit, sdk.MustNewDecFromStr("1")), "usdx:usd", sdkmath.NewInt(USDX_CF), types.NewInterestRateModel(sdk.MustNewDecFromStr("0.05"), sdk.MustNewDecFromStr("2"), sdk.MustNewDecFromStr("0.8"), sdk.MustNewDecFromStr("10")), sdk.MustNewDecFromStr("0.05"), sdk.ZeroDec()), - types.NewMoneyMarket("busd", types.NewBorrowLimit(false, sdk.NewDec(100000000*BUSD_CF), sdk.MustNewDecFromStr("1")), "busd:usd", sdkmath.NewInt(BUSD_CF), types.NewInterestRateModel(sdk.MustNewDecFromStr("0.05"), sdk.MustNewDecFromStr("2"), sdk.MustNewDecFromStr("0.8"), sdk.MustNewDecFromStr("10")), sdk.MustNewDecFromStr("0.05"), sdk.ZeroDec()), - types.NewMoneyMarket("ukava", types.NewBorrowLimit(false, sdk.NewDec(100000000*KAVA_CF), tc.setup.loanToValueKAVA), "kava:usd", sdkmath.NewInt(KAVA_CF), types.NewInterestRateModel(sdk.MustNewDecFromStr("0.05"), sdk.MustNewDecFromStr("2"), sdk.MustNewDecFromStr("0.8"), sdk.MustNewDecFromStr("10")), sdk.MustNewDecFromStr("0.99"), sdk.ZeroDec()), - types.NewMoneyMarket("btcb", types.NewBorrowLimit(false, sdk.NewDec(100000000*BTCB_CF), tc.setup.loanToValueBTCB), "btcb:usd", sdkmath.NewInt(BTCB_CF), types.NewInterestRateModel(sdk.MustNewDecFromStr("0.05"), sdk.MustNewDecFromStr("2"), sdk.MustNewDecFromStr("0.8"), sdk.MustNewDecFromStr("10")), sdk.MustNewDecFromStr("0.05"), sdk.ZeroDec()), - types.NewMoneyMarket("bnb", types.NewBorrowLimit(false, sdk.NewDec(100000000*BNB_CF), tc.setup.loanToValueBNB), "bnb:usd", sdkmath.NewInt(BNB_CF), types.NewInterestRateModel(sdk.MustNewDecFromStr("0.05"), sdk.MustNewDecFromStr("2"), sdk.MustNewDecFromStr("0.8"), sdk.MustNewDecFromStr("10")), sdk.MustNewDecFromStr("0.05"), sdk.ZeroDec()), - types.NewMoneyMarket("xyz", types.NewBorrowLimit(false, sdk.NewDec(1), tc.setup.loanToValueBNB), "xyz:usd", sdkmath.NewInt(1), types.NewInterestRateModel(sdk.MustNewDecFromStr("0.05"), sdk.MustNewDecFromStr("2"), sdk.MustNewDecFromStr("0.8"), sdk.MustNewDecFromStr("10")), sdk.MustNewDecFromStr("0.05"), sdk.ZeroDec()), - }, - sdk.NewDec(10), + types.NewMoneyMarket("usdx", types.NewBorrowLimit(true, tc.setup.usdxBorrowLimit, sdkmath.LegacyMustNewDecFromStr("1")), "usdx:usd", sdkmath.NewInt(USDX_CF), types.NewInterestRateModel(sdkmath.LegacyMustNewDecFromStr("0.05"), sdkmath.LegacyMustNewDecFromStr("2"), sdkmath.LegacyMustNewDecFromStr("0.8"), sdkmath.LegacyMustNewDecFromStr("10")), sdkmath.LegacyMustNewDecFromStr("0.05"), sdkmath.LegacyZeroDec()), + types.NewMoneyMarket("busd", types.NewBorrowLimit(false, sdkmath.LegacyNewDec(100000000*BUSD_CF), sdkmath.LegacyMustNewDecFromStr("1")), "busd:usd", sdkmath.NewInt(BUSD_CF), types.NewInterestRateModel(sdkmath.LegacyMustNewDecFromStr("0.05"), sdkmath.LegacyMustNewDecFromStr("2"), sdkmath.LegacyMustNewDecFromStr("0.8"), sdkmath.LegacyMustNewDecFromStr("10")), sdkmath.LegacyMustNewDecFromStr("0.05"), sdkmath.LegacyZeroDec()), + types.NewMoneyMarket("ukava", types.NewBorrowLimit(false, sdkmath.LegacyNewDec(100000000*KAVA_CF), tc.setup.loanToValueKAVA), "kava:usd", sdkmath.NewInt(KAVA_CF), types.NewInterestRateModel(sdkmath.LegacyMustNewDecFromStr("0.05"), sdkmath.LegacyMustNewDecFromStr("2"), sdkmath.LegacyMustNewDecFromStr("0.8"), sdkmath.LegacyMustNewDecFromStr("10")), sdkmath.LegacyMustNewDecFromStr("0.99"), sdkmath.LegacyZeroDec()), + types.NewMoneyMarket("btcb", types.NewBorrowLimit(false, sdkmath.LegacyNewDec(100000000*BTCB_CF), tc.setup.loanToValueBTCB), "btcb:usd", sdkmath.NewInt(BTCB_CF), types.NewInterestRateModel(sdkmath.LegacyMustNewDecFromStr("0.05"), sdkmath.LegacyMustNewDecFromStr("2"), sdkmath.LegacyMustNewDecFromStr("0.8"), sdkmath.LegacyMustNewDecFromStr("10")), sdkmath.LegacyMustNewDecFromStr("0.05"), sdkmath.LegacyZeroDec()), + types.NewMoneyMarket("bnb", types.NewBorrowLimit(false, sdkmath.LegacyNewDec(100000000*BNB_CF), tc.setup.loanToValueBNB), "bnb:usd", sdkmath.NewInt(BNB_CF), types.NewInterestRateModel(sdkmath.LegacyMustNewDecFromStr("0.05"), sdkmath.LegacyMustNewDecFromStr("2"), sdkmath.LegacyMustNewDecFromStr("0.8"), sdkmath.LegacyMustNewDecFromStr("10")), sdkmath.LegacyMustNewDecFromStr("0.05"), sdkmath.LegacyZeroDec()), + types.NewMoneyMarket("xyz", types.NewBorrowLimit(false, sdkmath.LegacyNewDec(1), tc.setup.loanToValueBNB), "xyz:usd", sdkmath.NewInt(1), types.NewInterestRateModel(sdkmath.LegacyMustNewDecFromStr("0.05"), sdkmath.LegacyMustNewDecFromStr("2"), sdkmath.LegacyMustNewDecFromStr("0.8"), sdkmath.LegacyMustNewDecFromStr("10")), sdkmath.LegacyMustNewDecFromStr("0.05"), sdkmath.LegacyZeroDec()), + }, + sdkmath.LegacyNewDec(10), ), types.DefaultAccumulationTimes, types.DefaultDeposits, types.DefaultBorrows, types.DefaultTotalSupplied, types.DefaultTotalBorrowed, types.DefaultTotalReserves, ) @@ -560,13 +560,13 @@ func (suite *KeeperTestSuite) TestBorrow() { { MarketID: "usdx:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("1.00"), + Price: sdkmath.LegacyMustNewDecFromStr("1.00"), Expiry: time.Now().Add(1 * time.Hour), }, { MarketID: "busd:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("1.00"), + Price: sdkmath.LegacyMustNewDecFromStr("1.00"), Expiry: time.Now().Add(1 * time.Hour), }, { @@ -660,11 +660,11 @@ func (suite *KeeperTestSuite) TestValidateBorrow() { sdk.NewCoin("usdx", sdkmath.NewInt(1000*KAVA_CF)), ) - model := types.NewInterestRateModel(sdk.MustNewDecFromStr("1.0"), sdk.MustNewDecFromStr("2"), sdk.MustNewDecFromStr("0.8"), sdk.MustNewDecFromStr("10")) + model := types.NewInterestRateModel(sdkmath.LegacyMustNewDecFromStr("1.0"), sdkmath.LegacyMustNewDecFromStr("2"), sdkmath.LegacyMustNewDecFromStr("0.8"), sdkmath.LegacyMustNewDecFromStr("10")) // Initialize test app and set context tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) // Auth module genesis state authGS := app.NewFundedGenStateWithSameCoins( @@ -678,21 +678,21 @@ func (suite *KeeperTestSuite) TestValidateBorrow() { types.NewParams( types.MoneyMarkets{ types.NewMoneyMarket("usdx", - types.NewBorrowLimit(false, sdk.NewDec(100000000*USDX_CF), sdk.MustNewDecFromStr("1")), // Borrow Limit - "usdx:usd", // Market ID - sdkmath.NewInt(USDX_CF), // Conversion Factor - model, // Interest Rate Model - sdk.MustNewDecFromStr("1.0"), // Reserve Factor (high) - sdk.MustNewDecFromStr("0.05")), // Keeper Reward Percent + types.NewBorrowLimit(false, sdkmath.LegacyNewDec(100000000*USDX_CF), sdkmath.LegacyMustNewDecFromStr("1")), // Borrow Limit + "usdx:usd", // Market ID + sdkmath.NewInt(USDX_CF), // Conversion Factor + model, // Interest Rate Model + sdkmath.LegacyMustNewDecFromStr("1.0"), // Reserve Factor (high) + sdkmath.LegacyMustNewDecFromStr("0.05")), // Keeper Reward Percent types.NewMoneyMarket("ukava", - types.NewBorrowLimit(false, sdk.NewDec(100000000*KAVA_CF), sdk.MustNewDecFromStr("0.8")), // Borrow Limit - "kava:usd", // Market ID - sdkmath.NewInt(KAVA_CF), // Conversion Factor - model, // Interest Rate Model - sdk.MustNewDecFromStr("1.0"), // Reserve Factor (high) - sdk.MustNewDecFromStr("0.05")), // Keeper Reward Percent - }, - sdk.NewDec(10), + types.NewBorrowLimit(false, sdkmath.LegacyNewDec(100000000*KAVA_CF), sdkmath.LegacyMustNewDecFromStr("0.8")), // Borrow Limit + "kava:usd", // Market ID + sdkmath.NewInt(KAVA_CF), // Conversion Factor + model, // Interest Rate Model + sdkmath.LegacyMustNewDecFromStr("1.0"), // Reserve Factor (high) + sdkmath.LegacyMustNewDecFromStr("0.05")), // Keeper Reward Percent + }, + sdkmath.LegacyNewDec(10), ), types.DefaultAccumulationTimes, types.DefaultDeposits, @@ -714,13 +714,13 @@ func (suite *KeeperTestSuite) TestValidateBorrow() { { MarketID: "usdx:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("1.00"), + Price: sdkmath.LegacyMustNewDecFromStr("1.00"), Expiry: time.Now().Add(1 * time.Hour), }, { MarketID: "kava:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("2.00"), + Price: sdkmath.LegacyMustNewDecFromStr("2.00"), Expiry: time.Now().Add(1 * time.Hour), }, }, @@ -773,7 +773,7 @@ func (suite *KeeperTestSuite) TestValidateBorrow() { err = suite.keeper.Borrow( suite.ctx, borrower, - sdk.NewCoins(sdk.NewCoin("ukava", availableToBorrow.AmountOf("ukava").Add(sdk.OneInt()))), + sdk.NewCoins(sdk.NewCoin("ukava", availableToBorrow.AmountOf("ukava").Add(sdkmath.OneInt()))), ) suite.Require().Error(err) diff --git a/x/hard/keeper/deposit.go b/x/hard/keeper/deposit.go index e4cd5315f9..63efdd1721 100644 --- a/x/hard/keeper/deposit.go +++ b/x/hard/keeper/deposit.go @@ -19,7 +19,7 @@ func (k Keeper) Deposit(ctx sdk.Context, depositor sdk.AccAddress, coins sdk.Coi if !foundInterestFactor { _, foundMm := k.GetMoneyMarket(ctx, coin.Denom) if foundMm { - k.SetSupplyInterestFactor(ctx, coin.Denom, sdk.OneDec()) + k.SetSupplyInterestFactor(ctx, coin.Denom, sdkmath.LegacyOneDec()) } } } @@ -146,7 +146,7 @@ func (k Keeper) DecrementSuppliedCoins(ctx sdk.Context, coins sdk.Coins) error { coinsToSubtract := sdk.NewCoins() for _, coin := range coins { if suppliedCoins.AmountOf(coin.Denom).LT(coin.Amount) { - if suppliedCoins.AmountOf(coin.Denom).GT(sdk.ZeroInt()) { + if suppliedCoins.AmountOf(coin.Denom).GT(sdkmath.ZeroInt()) { coinsToSubtract = coinsToSubtract.Add(sdk.NewCoin(coin.Denom, suppliedCoins.AmountOf(coin.Denom))) } } else { @@ -188,7 +188,7 @@ func (k Keeper) loadSyncedDeposit(ctx sdk.Context, deposit types.Deposit) types. // Calculate interest that will be paid to user for this asset if foundAtIndex != -1 { - storedAmount := sdk.NewDecFromInt(deposit.Amount.AmountOf(coin.Denom)) + storedAmount := sdkmath.LegacyNewDecFromInt(deposit.Amount.AmountOf(coin.Denom)) userLastInterestFactor := deposit.Index[foundAtIndex].Value coinInterest := (storedAmount.Quo(userLastInterestFactor).Mul(interestFactorValue)).Sub(storedAmount) totalNewInterest = totalNewInterest.Add(sdk.NewCoin(coin.Denom, coinInterest.TruncateInt())) diff --git a/x/hard/keeper/deposit_test.go b/x/hard/keeper/deposit_test.go index 8eb7cdf1e7..f6f5f98713 100644 --- a/x/hard/keeper/deposit_test.go +++ b/x/hard/keeper/deposit_test.go @@ -102,7 +102,7 @@ func (suite *KeeperTestSuite) TestDeposit() { // Initialize test app and set context tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) authGS := app.NewFundedGenStateWithCoins( tApp.AppCodec(), []sdk.Coins{ @@ -113,15 +113,15 @@ func (suite *KeeperTestSuite) TestDeposit() { }, []sdk.AccAddress{tc.args.depositor}, ) - loanToValue, _ := sdk.NewDecFromStr("0.6") + loanToValue, _ := sdkmath.LegacyNewDecFromStr("0.6") hardGS := types.NewGenesisState(types.NewParams( types.MoneyMarkets{ - types.NewMoneyMarket("usdx", types.NewBorrowLimit(false, sdk.NewDec(1000000000000000), loanToValue), "usdx:usd", sdkmath.NewInt(1000000), types.NewInterestRateModel(sdk.MustNewDecFromStr("0.05"), sdk.MustNewDecFromStr("2"), sdk.MustNewDecFromStr("0.8"), sdk.MustNewDecFromStr("10")), sdk.MustNewDecFromStr("0.05"), sdk.ZeroDec()), - types.NewMoneyMarket("ukava", types.NewBorrowLimit(false, sdk.NewDec(1000000000000000), loanToValue), "kava:usd", sdkmath.NewInt(1000000), types.NewInterestRateModel(sdk.MustNewDecFromStr("0.05"), sdk.MustNewDecFromStr("2"), sdk.MustNewDecFromStr("0.8"), sdk.MustNewDecFromStr("10")), sdk.MustNewDecFromStr("0.05"), sdk.ZeroDec()), - types.NewMoneyMarket("bnb", types.NewBorrowLimit(false, sdk.NewDec(1000000000000000), loanToValue), "bnb:usd", sdkmath.NewInt(1000000), types.NewInterestRateModel(sdk.MustNewDecFromStr("0.05"), sdk.MustNewDecFromStr("2"), sdk.MustNewDecFromStr("0.8"), sdk.MustNewDecFromStr("10")), sdk.MustNewDecFromStr("0.05"), sdk.ZeroDec()), - types.NewMoneyMarket("btcb", types.NewBorrowLimit(false, sdk.NewDec(1000000000000000), loanToValue), "btcb:usd", sdkmath.NewInt(1000000), types.NewInterestRateModel(sdk.MustNewDecFromStr("0.05"), sdk.MustNewDecFromStr("2"), sdk.MustNewDecFromStr("0.8"), sdk.MustNewDecFromStr("10")), sdk.MustNewDecFromStr("0.05"), sdk.ZeroDec()), + types.NewMoneyMarket("usdx", types.NewBorrowLimit(false, sdkmath.LegacyNewDec(1000000000000000), loanToValue), "usdx:usd", sdkmath.NewInt(1000000), types.NewInterestRateModel(sdkmath.LegacyMustNewDecFromStr("0.05"), sdkmath.LegacyMustNewDecFromStr("2"), sdkmath.LegacyMustNewDecFromStr("0.8"), sdkmath.LegacyMustNewDecFromStr("10")), sdkmath.LegacyMustNewDecFromStr("0.05"), sdkmath.LegacyZeroDec()), + types.NewMoneyMarket("ukava", types.NewBorrowLimit(false, sdkmath.LegacyNewDec(1000000000000000), loanToValue), "kava:usd", sdkmath.NewInt(1000000), types.NewInterestRateModel(sdkmath.LegacyMustNewDecFromStr("0.05"), sdkmath.LegacyMustNewDecFromStr("2"), sdkmath.LegacyMustNewDecFromStr("0.8"), sdkmath.LegacyMustNewDecFromStr("10")), sdkmath.LegacyMustNewDecFromStr("0.05"), sdkmath.LegacyZeroDec()), + types.NewMoneyMarket("bnb", types.NewBorrowLimit(false, sdkmath.LegacyNewDec(1000000000000000), loanToValue), "bnb:usd", sdkmath.NewInt(1000000), types.NewInterestRateModel(sdkmath.LegacyMustNewDecFromStr("0.05"), sdkmath.LegacyMustNewDecFromStr("2"), sdkmath.LegacyMustNewDecFromStr("0.8"), sdkmath.LegacyMustNewDecFromStr("10")), sdkmath.LegacyMustNewDecFromStr("0.05"), sdkmath.LegacyZeroDec()), + types.NewMoneyMarket("btcb", types.NewBorrowLimit(false, sdkmath.LegacyNewDec(1000000000000000), loanToValue), "btcb:usd", sdkmath.NewInt(1000000), types.NewInterestRateModel(sdkmath.LegacyMustNewDecFromStr("0.05"), sdkmath.LegacyMustNewDecFromStr("2"), sdkmath.LegacyMustNewDecFromStr("0.8"), sdkmath.LegacyMustNewDecFromStr("10")), sdkmath.LegacyMustNewDecFromStr("0.05"), sdkmath.LegacyZeroDec()), }, - sdk.NewDec(10), + sdkmath.LegacyNewDec(10), ), types.DefaultAccumulationTimes, types.DefaultDeposits, types.DefaultBorrows, types.DefaultTotalSupplied, types.DefaultTotalBorrowed, types.DefaultTotalReserves, ) @@ -140,25 +140,25 @@ func (suite *KeeperTestSuite) TestDeposit() { { MarketID: "usdx:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("1.00"), + Price: sdkmath.LegacyMustNewDecFromStr("1.00"), Expiry: time.Now().Add(1 * time.Hour), }, { MarketID: "kava:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("2.00"), + Price: sdkmath.LegacyMustNewDecFromStr("2.00"), Expiry: time.Now().Add(1 * time.Hour), }, { MarketID: "btcb:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("100.00"), + Price: sdkmath.LegacyMustNewDecFromStr("100.00"), Expiry: time.Now().Add(1 * time.Hour), }, { MarketID: "bnb:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("10.00"), + Price: sdkmath.LegacyMustNewDecFromStr("10.00"), Expiry: time.Now().Add(1 * time.Hour), }, }, @@ -269,8 +269,8 @@ func (suite *KeeperTestSuite) TestDecrementSuppliedCoins() { suite.Run(tc.name, func() { // Initialize test app and set context tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) - loanToValue, _ := sdk.NewDecFromStr("0.6") + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + loanToValue, _ := sdkmath.LegacyNewDecFromStr("0.6") depositor := sdk.AccAddress(crypto.AddressHash([]byte("test"))) authGS := app.NewFundedGenStateWithCoins( tApp.AppCodec(), @@ -279,11 +279,11 @@ func (suite *KeeperTestSuite) TestDecrementSuppliedCoins() { ) hardGS := types.NewGenesisState(types.NewParams( types.MoneyMarkets{ - types.NewMoneyMarket("bnb", types.NewBorrowLimit(false, sdk.NewDec(1000000000000000), loanToValue), "bnb:usd", sdkmath.NewInt(100000000), types.NewInterestRateModel(sdk.MustNewDecFromStr("0.05"), sdk.MustNewDecFromStr("2"), sdk.MustNewDecFromStr("0.8"), sdk.MustNewDecFromStr("10")), sdk.MustNewDecFromStr("0.05"), sdk.ZeroDec()), - types.NewMoneyMarket("busd", types.NewBorrowLimit(false, sdk.NewDec(1000000000000000), loanToValue), "busd:usd", sdkmath.NewInt(100000000), types.NewInterestRateModel(sdk.MustNewDecFromStr("0.05"), sdk.MustNewDecFromStr("2"), sdk.MustNewDecFromStr("0.8"), sdk.MustNewDecFromStr("10")), sdk.MustNewDecFromStr("0.05"), sdk.ZeroDec()), - types.NewMoneyMarket("xrpb", types.NewBorrowLimit(false, sdk.NewDec(1000000000000000), loanToValue), "xrpb:usd", sdkmath.NewInt(100000000), types.NewInterestRateModel(sdk.MustNewDecFromStr("0.05"), sdk.MustNewDecFromStr("2"), sdk.MustNewDecFromStr("0.8"), sdk.MustNewDecFromStr("10")), sdk.MustNewDecFromStr("0.05"), sdk.ZeroDec()), + types.NewMoneyMarket("bnb", types.NewBorrowLimit(false, sdkmath.LegacyNewDec(1000000000000000), loanToValue), "bnb:usd", sdkmath.NewInt(100000000), types.NewInterestRateModel(sdkmath.LegacyMustNewDecFromStr("0.05"), sdkmath.LegacyMustNewDecFromStr("2"), sdkmath.LegacyMustNewDecFromStr("0.8"), sdkmath.LegacyMustNewDecFromStr("10")), sdkmath.LegacyMustNewDecFromStr("0.05"), sdkmath.LegacyZeroDec()), + types.NewMoneyMarket("busd", types.NewBorrowLimit(false, sdkmath.LegacyNewDec(1000000000000000), loanToValue), "busd:usd", sdkmath.NewInt(100000000), types.NewInterestRateModel(sdkmath.LegacyMustNewDecFromStr("0.05"), sdkmath.LegacyMustNewDecFromStr("2"), sdkmath.LegacyMustNewDecFromStr("0.8"), sdkmath.LegacyMustNewDecFromStr("10")), sdkmath.LegacyMustNewDecFromStr("0.05"), sdkmath.LegacyZeroDec()), + types.NewMoneyMarket("xrpb", types.NewBorrowLimit(false, sdkmath.LegacyNewDec(1000000000000000), loanToValue), "xrpb:usd", sdkmath.NewInt(100000000), types.NewInterestRateModel(sdkmath.LegacyMustNewDecFromStr("0.05"), sdkmath.LegacyMustNewDecFromStr("2"), sdkmath.LegacyMustNewDecFromStr("0.8"), sdkmath.LegacyMustNewDecFromStr("10")), sdkmath.LegacyMustNewDecFromStr("0.05"), sdkmath.LegacyZeroDec()), }, - sdk.MustNewDecFromStr("10"), + sdkmath.LegacyMustNewDecFromStr("10"), ), types.DefaultAccumulationTimes, types.DefaultDeposits, types.DefaultBorrows, types.DefaultTotalSupplied, types.DefaultTotalBorrowed, types.DefaultTotalReserves, ) @@ -300,19 +300,19 @@ func (suite *KeeperTestSuite) TestDecrementSuppliedCoins() { { MarketID: "busd:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("1.00"), + Price: sdkmath.LegacyMustNewDecFromStr("1.00"), Expiry: time.Now().Add(1 * time.Hour), }, { MarketID: "xrpb:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("2.00"), + Price: sdkmath.LegacyMustNewDecFromStr("2.00"), Expiry: time.Now().Add(1 * time.Hour), }, { MarketID: "bnb:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("200.00"), + Price: sdkmath.LegacyMustNewDecFromStr("200.00"), Expiry: time.Now().Add(1 * time.Hour), }, }, diff --git a/x/hard/keeper/grpc_query.go b/x/hard/keeper/grpc_query.go index 85b6b6d07f..33964a8398 100644 --- a/x/hard/keeper/grpc_query.go +++ b/x/hard/keeper/grpc_query.go @@ -2,6 +2,7 @@ package keeper import ( "context" + sdkmath "cosmossdk.io/math" errorsmod "cosmossdk.io/errors" "github.com/cosmos/cosmos-sdk/client" @@ -436,7 +437,7 @@ func (s queryServer) InterestRate(ctx context.Context, req *types.QueryInterestR macc := s.accountKeeper.GetModuleAccount(sdkCtx, types.ModuleName) cash := s.bankKeeper.GetBalance(sdkCtx, macc.GetAddress(), denom).Amount - borrowed := sdk.NewCoin(denom, sdk.ZeroInt()) + borrowed := sdk.NewCoin(denom, sdkmath.ZeroInt()) borrowedCoins, foundBorrowedCoins := s.keeper.GetBorrowedCoins(sdkCtx) if foundBorrowedCoins { borrowed = sdk.NewCoin(denom, borrowedCoins.AmountOf(denom)) @@ -448,14 +449,14 @@ func (s queryServer) InterestRate(ctx context.Context, req *types.QueryInterestR } // CalculateBorrowRate calculates the current interest rate based on utilization (the fraction of supply that has ien borrowed) - borrowAPY, err := CalculateBorrowRate(moneyMarket.InterestRateModel, sdk.NewDecFromInt(cash), sdk.NewDecFromInt(borrowed.Amount), sdk.NewDecFromInt(reserves.AmountOf(denom))) + borrowAPY, err := CalculateBorrowRate(moneyMarket.InterestRateModel, sdkmath.LegacyNewDecFromInt(cash), sdkmath.LegacyNewDecFromInt(borrowed.Amount), sdkmath.LegacyNewDecFromInt(reserves.AmountOf(denom))) if err != nil { return nil, err } - utilRatio := CalculateUtilizationRatio(sdk.NewDecFromInt(cash), sdk.NewDecFromInt(borrowed.Amount), sdk.NewDecFromInt(reserves.AmountOf(denom))) + utilRatio := CalculateUtilizationRatio(sdkmath.LegacyNewDecFromInt(cash), sdkmath.LegacyNewDecFromInt(borrowed.Amount), sdkmath.LegacyNewDecFromInt(reserves.AmountOf(denom))) fullSupplyAPY := borrowAPY.Mul(utilRatio) - realSupplyAPY := fullSupplyAPY.Mul(sdk.OneDec().Sub(moneyMarket.ReserveFactor)) + realSupplyAPY := fullSupplyAPY.Mul(sdkmath.LegacyOneDec().Sub(moneyMarket.ReserveFactor)) moneyMarketInterestRate := types.MoneyMarketInterestRate{ Denom: denom, @@ -517,13 +518,13 @@ func (s queryServer) InterestFactors(ctx context.Context, req *types.QueryIntere } else { interestFactorMap := make(map[string]types.InterestFactor) // Populate mapping with supply interest factors - s.keeper.IterateSupplyInterestFactors(sdkCtx, func(denom string, factor sdk.Dec) (stop bool) { + s.keeper.IterateSupplyInterestFactors(sdkCtx, func(denom string, factor sdkmath.LegacyDec) (stop bool) { interestFactor := types.InterestFactor{Denom: denom, SupplyInterestFactor: factor.String()} interestFactorMap[denom] = interestFactor return false }) // Populate mapping with borrow interest factors - s.keeper.IterateBorrowInterestFactors(sdkCtx, func(denom string, factor sdk.Dec) (stop bool) { + s.keeper.IterateBorrowInterestFactors(sdkCtx, func(denom string, factor sdkmath.LegacyDec) (stop bool) { interestFactor, ok := interestFactorMap[denom] if !ok { newInterestFactor := types.InterestFactor{Denom: denom, BorrowInterestFactor: factor.String()} diff --git a/x/hard/keeper/grpc_query_test.go b/x/hard/keeper/grpc_query_test.go index 0f3e48ba23..ff90fffaf6 100644 --- a/x/hard/keeper/grpc_query_test.go +++ b/x/hard/keeper/grpc_query_test.go @@ -4,7 +4,6 @@ import ( "testing" "time" - tmprototypes "github.com/cometbft/cometbft/proto/tendermint/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/kava-labs/kava/app" "github.com/kava-labs/kava/x/hard/keeper" @@ -28,7 +27,7 @@ func (suite *grpcQueryTestSuite) SetupTest() { suite.addrs = addrs - suite.ctx = suite.tApp.NewContext(true, tmprototypes.Header{}). + suite.ctx = suite.tApp.NewContextLegacy(true). WithBlockTime(time.Now().UTC()) suite.keeper = suite.tApp.GetHardKeeper() suite.queryServer = keeper.NewQueryServerImpl(suite.keeper, suite.tApp.GetAccountKeeper(), suite.tApp.GetBankKeeper()) diff --git a/x/hard/keeper/integration_test.go b/x/hard/keeper/integration_test.go index b4fcaef8f5..f4dfc8af1c 100644 --- a/x/hard/keeper/integration_test.go +++ b/x/hard/keeper/integration_test.go @@ -20,65 +20,65 @@ func NewHARDGenState(cdc codec.JSONCodec) app.GenesisState { Denom: "usdx", BorrowLimit: types.BorrowLimit{ HasMaxLimit: true, - MaximumLimit: sdk.MustNewDecFromStr("100000000000"), - LoanToValue: sdk.MustNewDecFromStr("1"), + MaximumLimit: sdkmath.LegacyMustNewDecFromStr("100000000000"), + LoanToValue: sdkmath.LegacyMustNewDecFromStr("1"), }, SpotMarketID: "usdx:usd", ConversionFactor: sdkmath.NewInt(USDX_CF), InterestRateModel: types.InterestRateModel{ - BaseRateAPY: sdk.MustNewDecFromStr("0.05"), - BaseMultiplier: sdk.MustNewDecFromStr("2"), - Kink: sdk.MustNewDecFromStr("0.8"), - JumpMultiplier: sdk.MustNewDecFromStr("10"), + BaseRateAPY: sdkmath.LegacyMustNewDecFromStr("0.05"), + BaseMultiplier: sdkmath.LegacyMustNewDecFromStr("2"), + Kink: sdkmath.LegacyMustNewDecFromStr("0.8"), + JumpMultiplier: sdkmath.LegacyMustNewDecFromStr("10"), }, - ReserveFactor: sdk.MustNewDecFromStr("0.05"), - KeeperRewardPercentage: sdk.ZeroDec(), + ReserveFactor: sdkmath.LegacyMustNewDecFromStr("0.05"), + KeeperRewardPercentage: sdkmath.LegacyZeroDec(), }, types.MoneyMarket{ Denom: "bnb", BorrowLimit: types.BorrowLimit{ HasMaxLimit: true, - MaximumLimit: sdk.MustNewDecFromStr("3000000000000"), - LoanToValue: sdk.MustNewDecFromStr("0.5"), + MaximumLimit: sdkmath.LegacyMustNewDecFromStr("3000000000000"), + LoanToValue: sdkmath.LegacyMustNewDecFromStr("0.5"), }, SpotMarketID: "bnb:usd", ConversionFactor: sdkmath.NewInt(USDX_CF), InterestRateModel: types.InterestRateModel{ - BaseRateAPY: sdk.MustNewDecFromStr("0"), - BaseMultiplier: sdk.MustNewDecFromStr("0.05"), - Kink: sdk.MustNewDecFromStr("0.8"), - JumpMultiplier: sdk.MustNewDecFromStr("5.0"), + BaseRateAPY: sdkmath.LegacyMustNewDecFromStr("0"), + BaseMultiplier: sdkmath.LegacyMustNewDecFromStr("0.05"), + Kink: sdkmath.LegacyMustNewDecFromStr("0.8"), + JumpMultiplier: sdkmath.LegacyMustNewDecFromStr("5.0"), }, - ReserveFactor: sdk.MustNewDecFromStr("0.025"), - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.02"), + ReserveFactor: sdkmath.LegacyMustNewDecFromStr("0.025"), + KeeperRewardPercentage: sdkmath.LegacyMustNewDecFromStr("0.02"), }, types.MoneyMarket{ Denom: "busd", BorrowLimit: types.BorrowLimit{ HasMaxLimit: true, - MaximumLimit: sdk.MustNewDecFromStr("1000000000000000"), - LoanToValue: sdk.MustNewDecFromStr("0.5"), + MaximumLimit: sdkmath.LegacyMustNewDecFromStr("1000000000000000"), + LoanToValue: sdkmath.LegacyMustNewDecFromStr("0.5"), }, SpotMarketID: "busd:usd", ConversionFactor: sdkmath.NewInt(100000000), InterestRateModel: types.InterestRateModel{ - BaseRateAPY: sdk.MustNewDecFromStr("0"), - BaseMultiplier: sdk.MustNewDecFromStr("0.5"), - Kink: sdk.MustNewDecFromStr("0.8"), - JumpMultiplier: sdk.MustNewDecFromStr("5"), + BaseRateAPY: sdkmath.LegacyMustNewDecFromStr("0"), + BaseMultiplier: sdkmath.LegacyMustNewDecFromStr("0.5"), + Kink: sdkmath.LegacyMustNewDecFromStr("0.8"), + JumpMultiplier: sdkmath.LegacyMustNewDecFromStr("5"), }, - ReserveFactor: sdk.MustNewDecFromStr("0.025"), - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.02"), + ReserveFactor: sdkmath.LegacyMustNewDecFromStr("0.025"), + KeeperRewardPercentage: sdkmath.LegacyMustNewDecFromStr("0.02"), }, }, - sdk.MustNewDecFromStr("10"), + sdkmath.LegacyMustNewDecFromStr("10"), ), PreviousAccumulationTimes: types.GenesisAccumulationTimes{ types.NewGenesisAccumulationTime( "usdx", time.Date(2020, 12, 15, 14, 0, 0, 0, time.UTC), - sdk.OneDec(), - sdk.OneDec(), + sdkmath.LegacyOneDec(), + sdkmath.LegacyOneDec(), ), }, Deposits: types.DefaultDeposits, @@ -104,19 +104,19 @@ func NewPricefeedGenStateMulti(cdc codec.JSONCodec) app.GenesisState { { MarketID: "usdx:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.OneDec(), + Price: sdkmath.LegacyOneDec(), Expiry: time.Now().Add(1 * time.Hour), }, { MarketID: "bnb:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("618.13"), + Price: sdkmath.LegacyMustNewDecFromStr("618.13"), Expiry: time.Now().Add(1 * time.Hour), }, { MarketID: "busd:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.OneDec(), + Price: sdkmath.LegacyOneDec(), Expiry: time.Now().Add(1 * time.Hour), }, }, diff --git a/x/hard/keeper/interest.go b/x/hard/keeper/interest.go index e07d2862c9..df4c809b5e 100644 --- a/x/hard/keeper/interest.go +++ b/x/hard/keeper/interest.go @@ -78,7 +78,7 @@ func (k Keeper) AccrueInterest(ctx sdk.Context, denom string) error { macc := k.accountKeeper.GetModuleAccount(ctx, types.ModuleName) cashPrior := k.bankKeeper.GetBalance(ctx, macc.GetAddress(), denom).Amount - borrowedPrior := sdk.NewCoin(denom, sdk.ZeroInt()) + borrowedPrior := sdk.NewCoin(denom, sdkmath.ZeroInt()) borrowedCoinsPrior, foundBorrowedCoinsPrior := k.GetBorrowedCoins(ctx) if foundBorrowedCoinsPrior { borrowedPrior = sdk.NewCoin(denom, borrowedCoinsPrior.AmountOf(denom)) @@ -97,14 +97,14 @@ func (k Keeper) AccrueInterest(ctx sdk.Context, denom string) error { borrowInterestFactorPrior, foundBorrowInterestFactorPrior := k.GetBorrowInterestFactor(ctx, denom) if !foundBorrowInterestFactorPrior { - newBorrowInterestFactorPrior := sdk.MustNewDecFromStr("1.0") + newBorrowInterestFactorPrior := sdkmath.LegacyMustNewDecFromStr("1.0") k.SetBorrowInterestFactor(ctx, denom, newBorrowInterestFactorPrior) borrowInterestFactorPrior = newBorrowInterestFactorPrior } supplyInterestFactorPrior, foundSupplyInterestFactorPrior := k.GetSupplyInterestFactor(ctx, denom) if !foundSupplyInterestFactorPrior { - newSupplyInterestFactorPrior := sdk.MustNewDecFromStr("1.0") + newSupplyInterestFactorPrior := sdkmath.LegacyMustNewDecFromStr("1.0") k.SetSupplyInterestFactor(ctx, denom, newSupplyInterestFactorPrior) supplyInterestFactorPrior = newSupplyInterestFactorPrior } @@ -116,20 +116,20 @@ func (k Keeper) AccrueInterest(ctx sdk.Context, denom string) error { } // GetBorrowRate calculates the current interest rate based on utilization (the fraction of supply that has been borrowed) - borrowRateApy, err := CalculateBorrowRate(mm.InterestRateModel, sdk.NewDecFromInt(cashPrior), sdk.NewDecFromInt(borrowedPrior.Amount), sdk.NewDecFromInt(reservesPrior.AmountOf(denom))) + borrowRateApy, err := CalculateBorrowRate(mm.InterestRateModel, sdkmath.LegacyNewDecFromInt(cashPrior), sdkmath.LegacyNewDecFromInt(borrowedPrior.Amount), sdkmath.LegacyNewDecFromInt(reservesPrior.AmountOf(denom))) if err != nil { return err } // Convert from APY to SPY, expressed as (1 + borrow rate) - borrowRateSpy, err := APYToSPY(sdk.OneDec().Add(borrowRateApy)) + borrowRateSpy, err := APYToSPY(sdkmath.LegacyOneDec().Add(borrowRateApy)) if err != nil { return err } // Calculate borrow interest factor and update borrowInterestFactor := CalculateBorrowInterestFactor(borrowRateSpy, sdkmath.NewInt(timeElapsed)) - interestBorrowAccumulated := (borrowInterestFactor.Mul(sdk.NewDecFromInt(borrowedPrior.Amount)).TruncateInt()).Sub(borrowedPrior.Amount) + interestBorrowAccumulated := (borrowInterestFactor.Mul(sdkmath.LegacyNewDecFromInt(borrowedPrior.Amount)).TruncateInt()).Sub(borrowedPrior.Amount) if interestBorrowAccumulated.IsZero() && borrowRateApy.IsPositive() { // don't accumulate if borrow interest is rounding to zero @@ -137,13 +137,13 @@ func (k Keeper) AccrueInterest(ctx sdk.Context, denom string) error { } totalBorrowInterestAccumulated := sdk.NewCoins(sdk.NewCoin(denom, interestBorrowAccumulated)) - reservesNew := sdk.NewDecFromInt(interestBorrowAccumulated).Mul(mm.ReserveFactor).TruncateInt() + reservesNew := sdkmath.LegacyNewDecFromInt(interestBorrowAccumulated).Mul(mm.ReserveFactor).TruncateInt() borrowInterestFactorNew := borrowInterestFactorPrior.Mul(borrowInterestFactor) k.SetBorrowInterestFactor(ctx, denom, borrowInterestFactorNew) // Calculate supply interest factor and update supplyInterestNew := interestBorrowAccumulated.Sub(reservesNew) - supplyInterestFactor := CalculateSupplyInterestFactor(sdk.NewDecFromInt(supplyInterestNew), sdk.NewDecFromInt(cashPrior), sdk.NewDecFromInt(borrowedPrior.Amount), sdk.NewDecFromInt(reservesPrior.AmountOf(denom))) + supplyInterestFactor := CalculateSupplyInterestFactor(sdkmath.LegacyNewDecFromInt(supplyInterestNew), sdkmath.LegacyNewDecFromInt(cashPrior), sdkmath.LegacyNewDecFromInt(borrowedPrior.Amount), sdkmath.LegacyNewDecFromInt(reservesPrior.AmountOf(denom))) supplyInterestFactorNew := supplyInterestFactorPrior.Mul(supplyInterestFactor) k.SetSupplyInterestFactor(ctx, denom, supplyInterestFactorNew) @@ -158,7 +158,7 @@ func (k Keeper) AccrueInterest(ctx sdk.Context, denom string) error { // CalculateBorrowRate calculates the borrow rate, which is the current APY expressed as a decimal // based on the current utilization. -func CalculateBorrowRate(model types.InterestRateModel, cash, borrows, reserves sdk.Dec) (sdk.Dec, error) { +func CalculateBorrowRate(model types.InterestRateModel, cash, borrows, reserves sdkmath.LegacyDec) (sdkmath.LegacyDec, error) { utilRatio := CalculateUtilizationRatio(cash, borrows, reserves) // Calculate normal borrow rate (under kink) @@ -173,25 +173,25 @@ func CalculateBorrowRate(model types.InterestRateModel, cash, borrows, reserves } // CalculateUtilizationRatio calculates an asset's current utilization rate -func CalculateUtilizationRatio(cash, borrows, reserves sdk.Dec) sdk.Dec { +func CalculateUtilizationRatio(cash, borrows, reserves sdkmath.LegacyDec) sdkmath.LegacyDec { // Utilization rate is 0 when there are no borrows - if borrows.Equal(sdk.ZeroDec()) { - return sdk.ZeroDec() + if borrows.Equal(sdkmath.LegacyZeroDec()) { + return sdkmath.LegacyZeroDec() } totalSupply := cash.Add(borrows).Sub(reserves) if totalSupply.IsNegative() { - return sdk.OneDec() + return sdkmath.LegacyOneDec() } - return sdk.MinDec(sdk.OneDec(), borrows.Quo(totalSupply)) + return sdkmath.LegacyMinDec(sdkmath.LegacyOneDec(), borrows.Quo(totalSupply)) } // CalculateBorrowInterestFactor calculates the simple interest scaling factor, // which is equal to: (per-second interest rate * number of seconds elapsed) // Will return 1.000x, multiply by principal to get new principal with added interest -func CalculateBorrowInterestFactor(perSecondInterestRate sdk.Dec, secondsElapsed sdkmath.Int) sdk.Dec { - scalingFactorUint := sdk.NewUint(uint64(scalingFactor)) +func CalculateBorrowInterestFactor(perSecondInterestRate sdkmath.LegacyDec, secondsElapsed sdkmath.Int) sdkmath.LegacyDec { + scalingFactorUint := sdkmath.NewUint(uint64(scalingFactor)) scalingFactorInt := sdkmath.NewInt(int64(scalingFactor)) // Convert per-second interest rate to a uint scaled by 1e18 @@ -201,19 +201,19 @@ func CalculateBorrowInterestFactor(perSecondInterestRate sdk.Dec, secondsElapsed // Calculate the interest factor as a uint scaled by 1e18 interestFactorMantissa := sdkmath.RelativePow(interestMantissa, secondsElapsedUint, scalingFactorUint) - // Convert interest factor to an unscaled sdk.Dec - return sdk.NewDecFromBigInt(interestFactorMantissa.BigInt()).QuoInt(scalingFactorInt) + // Convert interest factor to an unscaled sdkmath.LegacyDec + return sdkmath.LegacyNewDecFromBigInt(interestFactorMantissa.BigInt()).QuoInt(scalingFactorInt) } // CalculateSupplyInterestFactor calculates the supply interest factor, which is the percentage of borrow interest // that flows to each unit of supply, i.e. at 50% utilization and 0% reserve factor, a 5% borrow interest will // correspond to a 2.5% supply interest. -func CalculateSupplyInterestFactor(newInterest, cash, borrows, reserves sdk.Dec) sdk.Dec { +func CalculateSupplyInterestFactor(newInterest, cash, borrows, reserves sdkmath.LegacyDec) sdkmath.LegacyDec { totalSupply := cash.Add(borrows).Sub(reserves) if totalSupply.IsZero() { - return sdk.OneDec() + return sdkmath.LegacyOneDec() } - return (newInterest.Quo(totalSupply)).Add(sdk.OneDec()) + return (newInterest.Quo(totalSupply)).Add(sdkmath.LegacyOneDec()) } // SyncBorrowInterest updates the user's owed interest on newly borrowed coins to the latest global state @@ -241,7 +241,7 @@ func (k Keeper) SyncBorrowInterest(ctx sdk.Context, addr sdk.AccAddress) { borrow.Index = append(borrow.Index, types.NewBorrowInterestFactor(coin.Denom, interestFactorValue)) } else { // User has an existing borrow index for this denom // Calculate interest owed by user since asset's last borrow index update - storedAmount := sdk.NewDecFromInt(borrow.Amount.AmountOf(coin.Denom)) + storedAmount := sdkmath.LegacyNewDecFromInt(borrow.Amount.AmountOf(coin.Denom)) userLastInterestFactor := borrow.Index[foundAtIndex].Value interest := (storedAmount.Quo(userLastInterestFactor).Mul(interestFactorValue)).Sub(storedAmount) totalNewInterest = totalNewInterest.Add(sdk.NewCoin(coin.Denom, interest.TruncateInt())) @@ -282,10 +282,10 @@ func (k Keeper) SyncSupplyInterest(ctx sdk.Context, addr sdk.AccAddress) { deposit.Index = append(deposit.Index, types.NewSupplyInterestFactor(coin.Denom, interestFactorValue)) } else { // User has an existing supply index for this denom // Calculate interest earned by user since asset's last deposit index update - storedAmount := sdk.NewDecFromInt(deposit.Amount.AmountOf(coin.Denom)) + storedAmount := sdkmath.LegacyNewDecFromInt(deposit.Amount.AmountOf(coin.Denom)) userLastInterestFactor := deposit.Index[foundAtIndex].Value interest := (storedAmount.Mul(interestFactorValue).Quo(userLastInterestFactor)).Sub(storedAmount) - if interest.TruncateInt().GT(sdk.ZeroInt()) { + if interest.TruncateInt().GT(sdkmath.ZeroInt()) { totalNewInterest = totalNewInterest.Add(sdk.NewCoin(coin.Denom, interest.TruncateInt())) } // We're synced up, so update user's deposit index value to match the current global deposit index value @@ -301,17 +301,17 @@ func (k Keeper) SyncSupplyInterest(ctx sdk.Context, addr sdk.AccAddress) { // APYToSPY converts the input annual interest rate. For example, 10% apy would be passed as 1.10. // SPY = Per second compounded interest rate is how cosmos mathematically represents APY. -func APYToSPY(apy sdk.Dec) (sdk.Dec, error) { +func APYToSPY(apy sdkmath.LegacyDec) (sdkmath.LegacyDec, error) { // Note: any APY 179 or greater will cause an out-of-bounds error root, err := apy.ApproxRoot(uint64(secondsPerYear)) if err != nil { - return sdk.ZeroDec(), err + return sdkmath.LegacyZeroDec(), err } return root, nil } // SPYToEstimatedAPY converts the internal per second compounded interest rate into an estimated annual // interest rate. The returned value is an estimate and should not be used for financial calculations. -func SPYToEstimatedAPY(apy sdk.Dec) sdk.Dec { +func SPYToEstimatedAPY(apy sdkmath.LegacyDec) sdkmath.LegacyDec { return apy.Power(uint64(secondsPerYear)) } diff --git a/x/hard/keeper/interest_test.go b/x/hard/keeper/interest_test.go index 753e75dbb1..38e529dd34 100644 --- a/x/hard/keeper/interest_test.go +++ b/x/hard/keeper/interest_test.go @@ -25,10 +25,10 @@ type InterestTestSuite struct { func (suite *InterestTestSuite) TestCalculateUtilizationRatio() { type args struct { - cash sdk.Dec - borrows sdk.Dec - reserves sdk.Dec - expectedValue sdk.Dec + cash sdkmath.LegacyDec + borrows sdkmath.LegacyDec + reserves sdkmath.LegacyDec + expectedValue sdkmath.LegacyDec } type test struct { @@ -40,46 +40,46 @@ func (suite *InterestTestSuite) TestCalculateUtilizationRatio() { { "normal", args{ - cash: sdk.MustNewDecFromStr("1000"), - borrows: sdk.MustNewDecFromStr("5000"), - reserves: sdk.MustNewDecFromStr("100"), - expectedValue: sdk.MustNewDecFromStr("0.847457627118644068"), + cash: sdkmath.LegacyMustNewDecFromStr("1000"), + borrows: sdkmath.LegacyMustNewDecFromStr("5000"), + reserves: sdkmath.LegacyMustNewDecFromStr("100"), + expectedValue: sdkmath.LegacyMustNewDecFromStr("0.847457627118644068"), }, }, { "high util ratio", args{ - cash: sdk.MustNewDecFromStr("1000"), - borrows: sdk.MustNewDecFromStr("250000"), - reserves: sdk.MustNewDecFromStr("100"), - expectedValue: sdk.MustNewDecFromStr("0.996412913511359107"), + cash: sdkmath.LegacyMustNewDecFromStr("1000"), + borrows: sdkmath.LegacyMustNewDecFromStr("250000"), + reserves: sdkmath.LegacyMustNewDecFromStr("100"), + expectedValue: sdkmath.LegacyMustNewDecFromStr("0.996412913511359107"), }, }, { "very high util ratio", args{ - cash: sdk.MustNewDecFromStr("1000"), - borrows: sdk.MustNewDecFromStr("250000000000"), - reserves: sdk.MustNewDecFromStr("100"), - expectedValue: sdk.MustNewDecFromStr("0.999999996400000013"), + cash: sdkmath.LegacyMustNewDecFromStr("1000"), + borrows: sdkmath.LegacyMustNewDecFromStr("250000000000"), + reserves: sdkmath.LegacyMustNewDecFromStr("100"), + expectedValue: sdkmath.LegacyMustNewDecFromStr("0.999999996400000013"), }, }, { "low util ratio", args{ - cash: sdk.MustNewDecFromStr("1000"), - borrows: sdk.MustNewDecFromStr("50"), - reserves: sdk.MustNewDecFromStr("100"), - expectedValue: sdk.MustNewDecFromStr("0.052631578947368421"), + cash: sdkmath.LegacyMustNewDecFromStr("1000"), + borrows: sdkmath.LegacyMustNewDecFromStr("50"), + reserves: sdkmath.LegacyMustNewDecFromStr("100"), + expectedValue: sdkmath.LegacyMustNewDecFromStr("0.052631578947368421"), }, }, { "very low util ratio", args{ - cash: sdk.MustNewDecFromStr("10000000"), - borrows: sdk.MustNewDecFromStr("50"), - reserves: sdk.MustNewDecFromStr("100"), - expectedValue: sdk.MustNewDecFromStr("0.000005000025000125"), + cash: sdkmath.LegacyMustNewDecFromStr("10000000"), + borrows: sdkmath.LegacyMustNewDecFromStr("50"), + reserves: sdkmath.LegacyMustNewDecFromStr("100"), + expectedValue: sdkmath.LegacyMustNewDecFromStr("0.000005000025000125"), }, }, } @@ -94,11 +94,11 @@ func (suite *InterestTestSuite) TestCalculateUtilizationRatio() { func (suite *InterestTestSuite) TestCalculateBorrowRate() { type args struct { - cash sdk.Dec - borrows sdk.Dec - reserves sdk.Dec + cash sdkmath.LegacyDec + borrows sdkmath.LegacyDec + reserves sdkmath.LegacyDec model types.InterestRateModel - expectedValue sdk.Dec + expectedValue sdkmath.LegacyDec } type test struct { @@ -111,102 +111,102 @@ func (suite *InterestTestSuite) TestCalculateBorrowRate() { // - BaseMultiplier: 0.1 // - Kink: 0.8 // - JumpMultiplier: 0.5 - normalModel := types.NewInterestRateModel(sdk.MustNewDecFromStr("0"), sdk.MustNewDecFromStr("0.1"), sdk.MustNewDecFromStr("0.8"), sdk.MustNewDecFromStr("0.5")) + normalModel := types.NewInterestRateModel(sdkmath.LegacyMustNewDecFromStr("0"), sdkmath.LegacyMustNewDecFromStr("0.1"), sdkmath.LegacyMustNewDecFromStr("0.8"), sdkmath.LegacyMustNewDecFromStr("0.5")) testCases := []test{ { "normal no jump", args{ - cash: sdk.MustNewDecFromStr("5000"), - borrows: sdk.MustNewDecFromStr("1000"), - reserves: sdk.MustNewDecFromStr("1000"), + cash: sdkmath.LegacyMustNewDecFromStr("5000"), + borrows: sdkmath.LegacyMustNewDecFromStr("1000"), + reserves: sdkmath.LegacyMustNewDecFromStr("1000"), model: normalModel, - expectedValue: sdk.MustNewDecFromStr("0.020000000000000000"), + expectedValue: sdkmath.LegacyMustNewDecFromStr("0.020000000000000000"), }, }, { "normal with jump", args{ - cash: sdk.MustNewDecFromStr("1000"), - borrows: sdk.MustNewDecFromStr("5000"), - reserves: sdk.MustNewDecFromStr("100"), + cash: sdkmath.LegacyMustNewDecFromStr("1000"), + borrows: sdkmath.LegacyMustNewDecFromStr("5000"), + reserves: sdkmath.LegacyMustNewDecFromStr("100"), model: normalModel, - expectedValue: sdk.MustNewDecFromStr("0.103728813559322034"), + expectedValue: sdkmath.LegacyMustNewDecFromStr("0.103728813559322034"), }, }, { "high cash", args{ - cash: sdk.MustNewDecFromStr("10000000"), - borrows: sdk.MustNewDecFromStr("5000"), - reserves: sdk.MustNewDecFromStr("100"), + cash: sdkmath.LegacyMustNewDecFromStr("10000000"), + borrows: sdkmath.LegacyMustNewDecFromStr("5000"), + reserves: sdkmath.LegacyMustNewDecFromStr("100"), model: normalModel, - expectedValue: sdk.MustNewDecFromStr("0.000049975511999120"), + expectedValue: sdkmath.LegacyMustNewDecFromStr("0.000049975511999120"), }, }, { "high borrows", args{ - cash: sdk.MustNewDecFromStr("1000"), - borrows: sdk.MustNewDecFromStr("5000000000000"), - reserves: sdk.MustNewDecFromStr("100"), + cash: sdkmath.LegacyMustNewDecFromStr("1000"), + borrows: sdkmath.LegacyMustNewDecFromStr("5000000000000"), + reserves: sdkmath.LegacyMustNewDecFromStr("100"), model: normalModel, - expectedValue: sdk.MustNewDecFromStr("0.179999999910000000"), + expectedValue: sdkmath.LegacyMustNewDecFromStr("0.179999999910000000"), }, }, { "high reserves", args{ - cash: sdk.MustNewDecFromStr("1000"), - borrows: sdk.MustNewDecFromStr("5000"), - reserves: sdk.MustNewDecFromStr("1000000000000"), + cash: sdkmath.LegacyMustNewDecFromStr("1000"), + borrows: sdkmath.LegacyMustNewDecFromStr("5000"), + reserves: sdkmath.LegacyMustNewDecFromStr("1000000000000"), model: normalModel, - expectedValue: sdk.MustNewDecFromStr("0.180000000000000000"), + expectedValue: sdkmath.LegacyMustNewDecFromStr("0.180000000000000000"), }, }, { "random numbers", args{ - cash: sdk.MustNewDecFromStr("125"), - borrows: sdk.MustNewDecFromStr("11"), - reserves: sdk.MustNewDecFromStr("82"), + cash: sdkmath.LegacyMustNewDecFromStr("125"), + borrows: sdkmath.LegacyMustNewDecFromStr("11"), + reserves: sdkmath.LegacyMustNewDecFromStr("82"), model: normalModel, - expectedValue: sdk.MustNewDecFromStr("0.020370370370370370"), + expectedValue: sdkmath.LegacyMustNewDecFromStr("0.020370370370370370"), }, }, { "increased base multiplier", args{ - cash: sdk.MustNewDecFromStr("1000"), - borrows: sdk.MustNewDecFromStr("5000"), - reserves: sdk.MustNewDecFromStr("100"), - model: types.NewInterestRateModel(sdk.MustNewDecFromStr("0"), sdk.MustNewDecFromStr("0.5"), sdk.MustNewDecFromStr("0.8"), sdk.MustNewDecFromStr("1.0")), - expectedValue: sdk.MustNewDecFromStr("0.447457627118644068"), + cash: sdkmath.LegacyMustNewDecFromStr("1000"), + borrows: sdkmath.LegacyMustNewDecFromStr("5000"), + reserves: sdkmath.LegacyMustNewDecFromStr("100"), + model: types.NewInterestRateModel(sdkmath.LegacyMustNewDecFromStr("0"), sdkmath.LegacyMustNewDecFromStr("0.5"), sdkmath.LegacyMustNewDecFromStr("0.8"), sdkmath.LegacyMustNewDecFromStr("1.0")), + expectedValue: sdkmath.LegacyMustNewDecFromStr("0.447457627118644068"), }, }, { "decreased kink", args{ - cash: sdk.MustNewDecFromStr("1000"), - borrows: sdk.MustNewDecFromStr("5000"), - reserves: sdk.MustNewDecFromStr("100"), - model: types.NewInterestRateModel(sdk.MustNewDecFromStr("0"), sdk.MustNewDecFromStr("0.5"), sdk.MustNewDecFromStr("0.1"), sdk.MustNewDecFromStr("1.0")), - expectedValue: sdk.MustNewDecFromStr("0.797457627118644068"), + cash: sdkmath.LegacyMustNewDecFromStr("1000"), + borrows: sdkmath.LegacyMustNewDecFromStr("5000"), + reserves: sdkmath.LegacyMustNewDecFromStr("100"), + model: types.NewInterestRateModel(sdkmath.LegacyMustNewDecFromStr("0"), sdkmath.LegacyMustNewDecFromStr("0.5"), sdkmath.LegacyMustNewDecFromStr("0.1"), sdkmath.LegacyMustNewDecFromStr("1.0")), + expectedValue: sdkmath.LegacyMustNewDecFromStr("0.797457627118644068"), }, }, { "zero model returns zero", args{ - cash: sdk.MustNewDecFromStr("1000"), - borrows: sdk.MustNewDecFromStr("5000"), - reserves: sdk.MustNewDecFromStr("100"), + cash: sdkmath.LegacyMustNewDecFromStr("1000"), + borrows: sdkmath.LegacyMustNewDecFromStr("5000"), + reserves: sdkmath.LegacyMustNewDecFromStr("100"), model: types.NewInterestRateModel( - sdk.MustNewDecFromStr("0.0"), - sdk.MustNewDecFromStr("0.0"), - sdk.MustNewDecFromStr("0.8"), - sdk.MustNewDecFromStr("0.0"), + sdkmath.LegacyMustNewDecFromStr("0.0"), + sdkmath.LegacyMustNewDecFromStr("0.0"), + sdkmath.LegacyMustNewDecFromStr("0.8"), + sdkmath.LegacyMustNewDecFromStr("0.0"), ), - expectedValue: sdk.MustNewDecFromStr("0.0"), + expectedValue: sdkmath.LegacyMustNewDecFromStr("0.0"), }, }, } @@ -222,9 +222,9 @@ func (suite *InterestTestSuite) TestCalculateBorrowRate() { func (suite *InterestTestSuite) TestCalculateBorrowInterestFactor() { type args struct { - perSecondInterestRate sdk.Dec + perSecondInterestRate sdkmath.LegacyDec timeElapsed sdkmath.Int - expectedValue sdk.Dec + expectedValue sdkmath.LegacyDec } type test struct { @@ -238,105 +238,105 @@ func (suite *InterestTestSuite) TestCalculateBorrowInterestFactor() { { "1 year", args{ - perSecondInterestRate: sdk.MustNewDecFromStr("1.000000005555"), + perSecondInterestRate: sdkmath.LegacyMustNewDecFromStr("1.000000005555"), timeElapsed: sdkmath.NewInt(oneYearInSeconds), - expectedValue: sdk.MustNewDecFromStr("1.191463614477847370"), + expectedValue: sdkmath.LegacyMustNewDecFromStr("1.191463614477847370"), }, }, { "10 year", args{ - perSecondInterestRate: sdk.MustNewDecFromStr("1.000000005555"), + perSecondInterestRate: sdkmath.LegacyMustNewDecFromStr("1.000000005555"), timeElapsed: sdkmath.NewInt(oneYearInSeconds * 10), - expectedValue: sdk.MustNewDecFromStr("5.765113233897391189"), + expectedValue: sdkmath.LegacyMustNewDecFromStr("5.765113233897391189"), }, }, { "1 month", args{ - perSecondInterestRate: sdk.MustNewDecFromStr("1.000000005555"), + perSecondInterestRate: sdkmath.LegacyMustNewDecFromStr("1.000000005555"), timeElapsed: sdkmath.NewInt(oneYearInSeconds / 12), - expectedValue: sdk.MustNewDecFromStr("1.014705619075717373"), + expectedValue: sdkmath.LegacyMustNewDecFromStr("1.014705619075717373"), }, }, { "1 day", args{ - perSecondInterestRate: sdk.MustNewDecFromStr("1.000000005555"), + perSecondInterestRate: sdkmath.LegacyMustNewDecFromStr("1.000000005555"), timeElapsed: sdkmath.NewInt(oneYearInSeconds / 365), - expectedValue: sdk.MustNewDecFromStr("1.000480067194057924"), + expectedValue: sdkmath.LegacyMustNewDecFromStr("1.000480067194057924"), }, }, { "1 year: low interest rate", args{ - perSecondInterestRate: sdk.MustNewDecFromStr("1.000000000555"), + perSecondInterestRate: sdkmath.LegacyMustNewDecFromStr("1.000000000555"), timeElapsed: sdkmath.NewInt(oneYearInSeconds), - expectedValue: sdk.MustNewDecFromStr("1.017656545925063632"), + expectedValue: sdkmath.LegacyMustNewDecFromStr("1.017656545925063632"), }, }, { "1 year, lower interest rate", args{ - perSecondInterestRate: sdk.MustNewDecFromStr("1.000000000055"), + perSecondInterestRate: sdkmath.LegacyMustNewDecFromStr("1.000000000055"), timeElapsed: sdkmath.NewInt(oneYearInSeconds), - expectedValue: sdk.MustNewDecFromStr("1.001735985079841390"), + expectedValue: sdkmath.LegacyMustNewDecFromStr("1.001735985079841390"), }, }, { "1 year, lowest interest rate", args{ - perSecondInterestRate: sdk.MustNewDecFromStr("1.000000000005"), + perSecondInterestRate: sdkmath.LegacyMustNewDecFromStr("1.000000000005"), timeElapsed: sdkmath.NewInt(oneYearInSeconds), - expectedValue: sdk.MustNewDecFromStr("1.000157692432076670"), + expectedValue: sdkmath.LegacyMustNewDecFromStr("1.000157692432076670"), }, }, { "1 year: high interest rate", args{ - perSecondInterestRate: sdk.MustNewDecFromStr("1.000000055555"), + perSecondInterestRate: sdkmath.LegacyMustNewDecFromStr("1.000000055555"), timeElapsed: sdkmath.NewInt(oneYearInSeconds), - expectedValue: sdk.MustNewDecFromStr("5.766022095987868825"), + expectedValue: sdkmath.LegacyMustNewDecFromStr("5.766022095987868825"), }, }, { "1 year: higher interest rate", args{ - perSecondInterestRate: sdk.MustNewDecFromStr("1.000000555555"), + perSecondInterestRate: sdkmath.LegacyMustNewDecFromStr("1.000000555555"), timeElapsed: sdkmath.NewInt(oneYearInSeconds), - expectedValue: sdk.MustNewDecFromStr("40628388.864535408465693310"), + expectedValue: sdkmath.LegacyMustNewDecFromStr("40628388.864535408465693310"), }, }, { "1 year: highest interest rate", args{ - perSecondInterestRate: sdk.MustNewDecFromStr("1.000001555555"), + perSecondInterestRate: sdkmath.LegacyMustNewDecFromStr("1.000001555555"), timeElapsed: sdkmath.NewInt(oneYearInSeconds), - expectedValue: sdk.MustNewDecFromStr("2017093013158200407564.613502861572552603"), + expectedValue: sdkmath.LegacyMustNewDecFromStr("2017093013158200407564.613502861572552603"), }, }, { "largest per second interest rate with practical elapsed time", args{ - perSecondInterestRate: sdk.MustNewDecFromStr("18.445"), // Begins to panic at ~18.45 (1845%/second interest rate) - timeElapsed: sdkmath.NewInt(30), // Assume a 30 second period, longer than any expected individual block - expectedValue: sdk.MustNewDecFromStr("94702138679846565921082258202543002089.215969366091911769"), + perSecondInterestRate: sdkmath.LegacyMustNewDecFromStr("18.445"), // Begins to panic at ~18.45 (1845%/second interest rate) + timeElapsed: sdkmath.NewInt(30), // Assume a 30 second period, longer than any expected individual block + expectedValue: sdkmath.LegacyMustNewDecFromStr("94702138679846565921082258202543002089.215969366091911769"), }, }, { "supports calculated values greater than 1.84x10^19", args{ - perSecondInterestRate: sdk.MustNewDecFromStr("18.5"), // Old uint64 conversion would panic at ~18.45 (1845%/second interest rate) - timeElapsed: sdkmath.NewInt(30), // Assume a 30 second period, longer than any expected individual block - expectedValue: sdk.MustNewDecFromStr("103550416986452240450480615551792302106.072205164469778538"), + perSecondInterestRate: sdkmath.LegacyMustNewDecFromStr("18.5"), // Old uint64 conversion would panic at ~18.45 (1845%/second interest rate) + timeElapsed: sdkmath.NewInt(30), // Assume a 30 second period, longer than any expected individual block + expectedValue: sdkmath.LegacyMustNewDecFromStr("103550416986452240450480615551792302106.072205164469778538"), }, }, { "largest per second interest rate before sdk.Uint overflows 256 bytes", args{ - perSecondInterestRate: sdk.MustNewDecFromStr("23.3"), // 23.4 overflows bit length 256 by 1 byte - timeElapsed: sdkmath.NewInt(30), // Assume a 30 second period, longer than any expected individual block - expectedValue: sdk.MustNewDecFromStr("104876366068119517411103023062013348034546.437155815200037999"), + perSecondInterestRate: sdkmath.LegacyMustNewDecFromStr("23.3"), // 23.4 overflows bit length 256 by 1 byte + timeElapsed: sdkmath.NewInt(30), // Assume a 30 second period, longer than any expected individual block + expectedValue: sdkmath.LegacyMustNewDecFromStr("104876366068119517411103023062013348034546.437155815200037999"), }, }, } @@ -351,12 +351,12 @@ func (suite *InterestTestSuite) TestCalculateBorrowInterestFactor() { func (suite *InterestTestSuite) TestCalculateSupplyInterestFactor() { type args struct { - newInterest sdk.Dec - cash sdk.Dec - borrows sdk.Dec - reserves sdk.Dec - reserveFactor sdk.Dec - expectedValue sdk.Dec + newInterest sdkmath.LegacyDec + cash sdkmath.LegacyDec + borrows sdkmath.LegacyDec + reserves sdkmath.LegacyDec + reserveFactor sdkmath.LegacyDec + expectedValue sdkmath.LegacyDec } type test struct { @@ -368,34 +368,34 @@ func (suite *InterestTestSuite) TestCalculateSupplyInterestFactor() { { "low new interest", args{ - newInterest: sdk.MustNewDecFromStr("1"), - cash: sdk.MustNewDecFromStr("100.0"), - borrows: sdk.MustNewDecFromStr("1000.0"), - reserves: sdk.MustNewDecFromStr("10.0"), - reserveFactor: sdk.MustNewDecFromStr("0.05"), - expectedValue: sdk.MustNewDecFromStr("1.000917431192660550"), + newInterest: sdkmath.LegacyMustNewDecFromStr("1"), + cash: sdkmath.LegacyMustNewDecFromStr("100.0"), + borrows: sdkmath.LegacyMustNewDecFromStr("1000.0"), + reserves: sdkmath.LegacyMustNewDecFromStr("10.0"), + reserveFactor: sdkmath.LegacyMustNewDecFromStr("0.05"), + expectedValue: sdkmath.LegacyMustNewDecFromStr("1.000917431192660550"), }, }, { "medium new interest", args{ - newInterest: sdk.MustNewDecFromStr("5"), - cash: sdk.MustNewDecFromStr("100.0"), - borrows: sdk.MustNewDecFromStr("1000.0"), - reserves: sdk.MustNewDecFromStr("10.0"), - reserveFactor: sdk.MustNewDecFromStr("0.05"), - expectedValue: sdk.MustNewDecFromStr("1.004587155963302752"), + newInterest: sdkmath.LegacyMustNewDecFromStr("5"), + cash: sdkmath.LegacyMustNewDecFromStr("100.0"), + borrows: sdkmath.LegacyMustNewDecFromStr("1000.0"), + reserves: sdkmath.LegacyMustNewDecFromStr("10.0"), + reserveFactor: sdkmath.LegacyMustNewDecFromStr("0.05"), + expectedValue: sdkmath.LegacyMustNewDecFromStr("1.004587155963302752"), }, }, { "high new interest", args{ - newInterest: sdk.MustNewDecFromStr("10"), - cash: sdk.MustNewDecFromStr("100.0"), - borrows: sdk.MustNewDecFromStr("1000.0"), - reserves: sdk.MustNewDecFromStr("10.0"), - reserveFactor: sdk.MustNewDecFromStr("0.05"), - expectedValue: sdk.MustNewDecFromStr("1.009174311926605505"), + newInterest: sdkmath.LegacyMustNewDecFromStr("10"), + cash: sdkmath.LegacyMustNewDecFromStr("100.0"), + borrows: sdkmath.LegacyMustNewDecFromStr("1000.0"), + reserves: sdkmath.LegacyMustNewDecFromStr("10.0"), + reserveFactor: sdkmath.LegacyMustNewDecFromStr("0.05"), + expectedValue: sdkmath.LegacyMustNewDecFromStr("1.009174311926605505"), }, }, } @@ -411,8 +411,8 @@ func (suite *InterestTestSuite) TestCalculateSupplyInterestFactor() { func (suite *InterestTestSuite) TestAPYToSPY() { type args struct { - apy sdk.Dec - expectedValue sdk.Dec + apy sdkmath.LegacyDec + expectedValue sdkmath.LegacyDec } type test struct { @@ -425,72 +425,72 @@ func (suite *InterestTestSuite) TestAPYToSPY() { { "lowest apy", args{ - apy: sdk.MustNewDecFromStr("0.005"), - expectedValue: sdk.MustNewDecFromStr("0.999999831991472557"), + apy: sdkmath.LegacyMustNewDecFromStr("0.005"), + expectedValue: sdkmath.LegacyMustNewDecFromStr("0.999999831991472557"), }, false, }, { "lower apy", args{ - apy: sdk.MustNewDecFromStr("0.05"), - expectedValue: sdk.MustNewDecFromStr("0.999999905005957279"), + apy: sdkmath.LegacyMustNewDecFromStr("0.05"), + expectedValue: sdkmath.LegacyMustNewDecFromStr("0.999999905005957279"), }, false, }, { "medium-low apy", args{ - apy: sdk.MustNewDecFromStr("0.5"), - expectedValue: sdk.MustNewDecFromStr("0.999999978020447332"), + apy: sdkmath.LegacyMustNewDecFromStr("0.5"), + expectedValue: sdkmath.LegacyMustNewDecFromStr("0.999999978020447332"), }, false, }, { "5% apy", args{ - apy: sdk.MustNewDecFromStr("1.05"), - expectedValue: sdk.MustNewDecFromStr("1.000000001547125958"), + apy: sdkmath.LegacyMustNewDecFromStr("1.05"), + expectedValue: sdkmath.LegacyMustNewDecFromStr("1.000000001547125958"), }, false, }, { "25% apy", args{ - apy: sdk.MustNewDecFromStr("1.25"), - expectedValue: sdk.MustNewDecFromStr("1.000000007075835620"), + apy: sdkmath.LegacyMustNewDecFromStr("1.25"), + expectedValue: sdkmath.LegacyMustNewDecFromStr("1.000000007075835620"), }, false, }, { "medium-high apy", args{ - apy: sdk.MustNewDecFromStr("5"), - expectedValue: sdk.MustNewDecFromStr("1.000000051034942717"), + apy: sdkmath.LegacyMustNewDecFromStr("5"), + expectedValue: sdkmath.LegacyMustNewDecFromStr("1.000000051034942717"), }, false, }, { "high apy", args{ - apy: sdk.MustNewDecFromStr("50"), - expectedValue: sdk.MustNewDecFromStr("1.000000124049443433"), + apy: sdkmath.LegacyMustNewDecFromStr("50"), + expectedValue: sdkmath.LegacyMustNewDecFromStr("1.000000124049443433"), }, false, }, { "highest apy", args{ - apy: sdk.MustNewDecFromStr("177"), - expectedValue: sdk.MustNewDecFromStr("1.000000164134644767"), + apy: sdkmath.LegacyMustNewDecFromStr("177"), + expectedValue: sdkmath.LegacyMustNewDecFromStr("1.000000164134644767"), }, false, }, { "out of bounds error after 178", args{ - apy: sdk.MustNewDecFromStr("179"), - expectedValue: sdk.ZeroDec(), + apy: sdkmath.LegacyMustNewDecFromStr("179"), + expectedValue: sdkmath.LegacyZeroDec(), }, true, }, @@ -510,7 +510,7 @@ func (suite *InterestTestSuite) TestAPYToSPY() { func (suite *InterestTestSuite) TestSPYToEstimatedAPY() { type args struct { - spy sdk.Dec + spy sdkmath.LegacyDec expectedAPY float64 acceptableRange float64 } @@ -524,7 +524,7 @@ func (suite *InterestTestSuite) TestSPYToEstimatedAPY() { { "lowest apy", args{ - spy: sdk.MustNewDecFromStr("0.999999831991472557"), + spy: sdkmath.LegacyMustNewDecFromStr("0.999999831991472557"), expectedAPY: 0.005, // Returned value: 0.004999999888241291 acceptableRange: 0.00001, // +/- 1/10000th of a precent }, @@ -532,7 +532,7 @@ func (suite *InterestTestSuite) TestSPYToEstimatedAPY() { { "lower apy", args{ - spy: sdk.MustNewDecFromStr("0.999999905005957279"), + spy: sdkmath.LegacyMustNewDecFromStr("0.999999905005957279"), expectedAPY: 0.05, // Returned value: 0.05000000074505806 acceptableRange: 0.00001, // +/- 1/10000th of a precent }, @@ -540,7 +540,7 @@ func (suite *InterestTestSuite) TestSPYToEstimatedAPY() { { "medium-low apy", args{ - spy: sdk.MustNewDecFromStr("0.999999978020447332"), + spy: sdkmath.LegacyMustNewDecFromStr("0.999999978020447332"), expectedAPY: 0.5, // Returned value: 0.5 acceptableRange: 0.00001, // +/- 1/10000th of a precent }, @@ -548,7 +548,7 @@ func (suite *InterestTestSuite) TestSPYToEstimatedAPY() { { "medium-high apy", args{ - spy: sdk.MustNewDecFromStr("1.000000051034942717"), + spy: sdkmath.LegacyMustNewDecFromStr("1.000000051034942717"), expectedAPY: 5, // Returned value: 5 acceptableRange: 0.00001, // +/- 1/10000th of a precent }, @@ -556,7 +556,7 @@ func (suite *InterestTestSuite) TestSPYToEstimatedAPY() { { "high apy", args{ - spy: sdk.MustNewDecFromStr("1.000000124049443433"), + spy: sdkmath.LegacyMustNewDecFromStr("1.000000124049443433"), expectedAPY: 50, // Returned value: 50 acceptableRange: 0.00001, // +/- 1/10000th of a precent }, @@ -564,7 +564,7 @@ func (suite *InterestTestSuite) TestSPYToEstimatedAPY() { { "highest apy", args{ - spy: sdk.MustNewDecFromStr("1.000000146028999310"), + spy: sdkmath.LegacyMustNewDecFromStr("1.000000146028999310"), expectedAPY: 100, // 100 acceptableRange: 0.00001, // +/- 1/10000th of a precent }, @@ -572,7 +572,7 @@ func (suite *InterestTestSuite) TestSPYToEstimatedAPY() { } for _, tc := range testCases { suite.Run(tc.name, func() { - // From SPY calculate APY and parse result from sdk.Dec to float64 + // From SPY calculate APY and parse result from sdkmath.LegacyDec to float64 calculatedAPY := keeper.SPYToEstimatedAPY(tc.args.spy) calculatedAPYFloat, err := strconv.ParseFloat(calculatedAPY.String(), 32) suite.Require().NoError(err) @@ -597,7 +597,7 @@ func (suite *KeeperTestSuite) TestBorrowInterest() { borrowCoinDenom string borrowCoins sdk.Coins interestRateModel types.InterestRateModel - reserveFactor sdk.Dec + reserveFactor sdkmath.LegacyDec expectedInterestSnaphots []ExpectedBorrowInterest } @@ -612,7 +612,7 @@ func (suite *KeeperTestSuite) TestBorrowInterest() { errArgs errArgs } - normalModel := types.NewInterestRateModel(sdk.MustNewDecFromStr("0"), sdk.MustNewDecFromStr("0.1"), sdk.MustNewDecFromStr("0.8"), sdk.MustNewDecFromStr("0.5")) + normalModel := types.NewInterestRateModel(sdkmath.LegacyMustNewDecFromStr("0"), sdkmath.LegacyMustNewDecFromStr("0.1"), sdkmath.LegacyMustNewDecFromStr("0.8"), sdkmath.LegacyMustNewDecFromStr("0.5")) oneDayInSeconds := int64(86400) oneWeekInSeconds := int64(604800) @@ -629,7 +629,7 @@ func (suite *KeeperTestSuite) TestBorrowInterest() { borrowCoinDenom: "ukava", borrowCoins: sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(20*KAVA_CF))), interestRateModel: normalModel, - reserveFactor: sdk.MustNewDecFromStr("0.05"), + reserveFactor: sdkmath.LegacyMustNewDecFromStr("0.05"), expectedInterestSnaphots: []ExpectedBorrowInterest{ { elapsedTime: oneDayInSeconds, @@ -652,7 +652,7 @@ func (suite *KeeperTestSuite) TestBorrowInterest() { borrowCoinDenom: "ukava", borrowCoins: sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(20*KAVA_CF))), interestRateModel: normalModel, - reserveFactor: sdk.MustNewDecFromStr("0.05"), + reserveFactor: sdkmath.LegacyMustNewDecFromStr("0.05"), expectedInterestSnaphots: []ExpectedBorrowInterest{ { elapsedTime: oneWeekInSeconds, @@ -675,7 +675,7 @@ func (suite *KeeperTestSuite) TestBorrowInterest() { borrowCoinDenom: "ukava", borrowCoins: sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(20*KAVA_CF))), interestRateModel: normalModel, - reserveFactor: sdk.MustNewDecFromStr("0.05"), + reserveFactor: sdkmath.LegacyMustNewDecFromStr("0.05"), expectedInterestSnaphots: []ExpectedBorrowInterest{ { elapsedTime: oneMonthInSeconds, @@ -698,7 +698,7 @@ func (suite *KeeperTestSuite) TestBorrowInterest() { borrowCoinDenom: "ukava", borrowCoins: sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(20*KAVA_CF))), interestRateModel: normalModel, - reserveFactor: sdk.MustNewDecFromStr("0.05"), + reserveFactor: sdkmath.LegacyMustNewDecFromStr("0.05"), expectedInterestSnaphots: []ExpectedBorrowInterest{ { elapsedTime: oneYearInSeconds, @@ -721,7 +721,7 @@ func (suite *KeeperTestSuite) TestBorrowInterest() { borrowCoinDenom: "ukava", borrowCoins: sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(20*KAVA_CF))), interestRateModel: normalModel, - reserveFactor: sdk.MustNewDecFromStr("0"), + reserveFactor: sdkmath.LegacyMustNewDecFromStr("0"), expectedInterestSnaphots: []ExpectedBorrowInterest{ { elapsedTime: oneYearInSeconds, @@ -744,7 +744,7 @@ func (suite *KeeperTestSuite) TestBorrowInterest() { borrowCoinDenom: "ukava", borrowCoins: sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(20*KAVA_CF))), interestRateModel: normalModel, - reserveFactor: sdk.MustNewDecFromStr("0.05"), + reserveFactor: sdkmath.LegacyMustNewDecFromStr("0.05"), expectedInterestSnaphots: []ExpectedBorrowInterest{ { elapsedTime: oneYearInSeconds, @@ -767,7 +767,7 @@ func (suite *KeeperTestSuite) TestBorrowInterest() { borrowCoinDenom: "ukava", borrowCoins: sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(20*KAVA_CF))), interestRateModel: normalModel, - reserveFactor: sdk.MustNewDecFromStr("0.05"), + reserveFactor: sdkmath.LegacyMustNewDecFromStr("0.05"), expectedInterestSnaphots: []ExpectedBorrowInterest{ { elapsedTime: oneMonthInSeconds, @@ -795,7 +795,7 @@ func (suite *KeeperTestSuite) TestBorrowInterest() { borrowCoinDenom: "ukava", borrowCoins: sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(20*KAVA_CF))), interestRateModel: normalModel, - reserveFactor: sdk.MustNewDecFromStr("0.05"), + reserveFactor: sdkmath.LegacyMustNewDecFromStr("0.05"), expectedInterestSnaphots: []ExpectedBorrowInterest{ { elapsedTime: oneDayInSeconds, @@ -830,7 +830,7 @@ func (suite *KeeperTestSuite) TestBorrowInterest() { suite.Run(tc.name, func() { // Initialize test app and set context tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) // Auth module genesis state authGS := app.NewFundedGenStateWithCoins( @@ -843,14 +843,14 @@ func (suite *KeeperTestSuite) TestBorrowInterest() { hardGS := types.NewGenesisState(types.NewParams( types.MoneyMarkets{ types.NewMoneyMarket("ukava", - types.NewBorrowLimit(false, sdk.NewDec(100000000*KAVA_CF), sdk.MustNewDecFromStr("0.8")), // Borrow Limit + types.NewBorrowLimit(false, sdkmath.LegacyNewDec(100000000*KAVA_CF), sdkmath.LegacyMustNewDecFromStr("0.8")), // Borrow Limit "kava:usd", // Market ID sdkmath.NewInt(KAVA_CF), // Conversion Factor tc.args.interestRateModel, // Interest Rate Model tc.args.reserveFactor, // Reserve Factor - sdk.ZeroDec()), // Keeper Reward Percentage + sdkmath.LegacyZeroDec()), // Keeper Reward Percentage }, - sdk.NewDec(10), + sdkmath.LegacyNewDec(10), ), types.DefaultAccumulationTimes, types.DefaultDeposits, types.DefaultBorrows, types.DefaultTotalSupplied, types.DefaultTotalBorrowed, types.DefaultTotalReserves, ) @@ -866,7 +866,7 @@ func (suite *KeeperTestSuite) TestBorrowInterest() { { MarketID: "kava:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("2.00"), + Price: sdkmath.LegacyMustNewDecFromStr("2.00"), Expiry: time.Now().Add(100 * time.Hour), }, }, @@ -918,23 +918,23 @@ func (suite *KeeperTestSuite) TestBorrowInterest() { reservesPrior, foundReservesPrior := suite.keeper.GetTotalReserves(prevCtx) if !foundReservesPrior { - reservesPrior = sdk.NewCoins(sdk.NewCoin(tc.args.borrowCoinDenom, sdk.ZeroInt())) + reservesPrior = sdk.NewCoins(sdk.NewCoin(tc.args.borrowCoinDenom, sdkmath.ZeroInt())) } interestFactorPrior, foundInterestFactorPrior := suite.keeper.GetBorrowInterestFactor(prevCtx, tc.args.borrowCoinDenom) suite.Require().True(foundInterestFactorPrior) // 2. Calculate expected interest owed - borrowRateApy, err := keeper.CalculateBorrowRate(tc.args.interestRateModel, sdk.NewDecFromInt(cashPrior), sdk.NewDecFromInt(borrowCoinPriorAmount), sdk.NewDecFromInt(reservesPrior.AmountOf(tc.args.borrowCoinDenom))) + borrowRateApy, err := keeper.CalculateBorrowRate(tc.args.interestRateModel, sdkmath.LegacyNewDecFromInt(cashPrior), sdkmath.LegacyNewDecFromInt(borrowCoinPriorAmount), sdkmath.LegacyNewDecFromInt(reservesPrior.AmountOf(tc.args.borrowCoinDenom))) suite.Require().NoError(err) // Convert from APY to SPY, expressed as (1 + borrow rate) - borrowRateSpy, err := keeper.APYToSPY(sdk.OneDec().Add(borrowRateApy)) + borrowRateSpy, err := keeper.APYToSPY(sdkmath.LegacyOneDec().Add(borrowRateApy)) suite.Require().NoError(err) interestFactor := keeper.CalculateBorrowInterestFactor(borrowRateSpy, sdkmath.NewInt(snapshot.elapsedTime)) - expectedInterest := (interestFactor.Mul(sdk.NewDecFromInt(borrowCoinPriorAmount)).TruncateInt()).Sub(borrowCoinPriorAmount) - expectedReserves := reservesPrior.Add(sdk.NewCoin(tc.args.borrowCoinDenom, sdk.NewDecFromInt(expectedInterest).Mul(tc.args.reserveFactor).TruncateInt())) + expectedInterest := (interestFactor.Mul(sdkmath.LegacyNewDecFromInt(borrowCoinPriorAmount)).TruncateInt()).Sub(borrowCoinPriorAmount) + expectedReserves := reservesPrior.Add(sdk.NewCoin(tc.args.borrowCoinDenom, sdkmath.LegacyNewDecFromInt(expectedInterest).Mul(tc.args.reserveFactor).TruncateInt())) expectedInterestFactor := interestFactorPrior.Mul(interestFactor) // ------------------------------------------------------------------------------------- @@ -990,7 +990,7 @@ func (suite *KeeperTestSuite) TestSupplyInterest() { coinDenoms []string borrowCoins sdk.Coins interestRateModel types.InterestRateModel - reserveFactor sdk.Dec + reserveFactor sdkmath.LegacyDec expectedInterestSnaphots []ExpectedSupplyInterest } @@ -1005,7 +1005,7 @@ func (suite *KeeperTestSuite) TestSupplyInterest() { errArgs errArgs } - normalModel := types.NewInterestRateModel(sdk.MustNewDecFromStr("0"), sdk.MustNewDecFromStr("0.1"), sdk.MustNewDecFromStr("0.8"), sdk.MustNewDecFromStr("0.5")) + normalModel := types.NewInterestRateModel(sdkmath.LegacyMustNewDecFromStr("0"), sdkmath.LegacyMustNewDecFromStr("0.1"), sdkmath.LegacyMustNewDecFromStr("0.8"), sdkmath.LegacyMustNewDecFromStr("0.5")) oneDayInSeconds := int64(86400) oneWeekInSeconds := int64(604800) @@ -1023,7 +1023,7 @@ func (suite *KeeperTestSuite) TestSupplyInterest() { coinDenoms: []string{"ukava"}, borrowCoins: sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(20*KAVA_CF))), interestRateModel: normalModel, - reserveFactor: sdk.MustNewDecFromStr("0.05"), + reserveFactor: sdkmath.LegacyMustNewDecFromStr("0.05"), expectedInterestSnaphots: []ExpectedSupplyInterest{ { elapsedTime: oneDayInSeconds, @@ -1047,7 +1047,7 @@ func (suite *KeeperTestSuite) TestSupplyInterest() { coinDenoms: []string{"ukava"}, borrowCoins: sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(20*KAVA_CF))), interestRateModel: normalModel, - reserveFactor: sdk.MustNewDecFromStr("0.05"), + reserveFactor: sdkmath.LegacyMustNewDecFromStr("0.05"), expectedInterestSnaphots: []ExpectedSupplyInterest{ { elapsedTime: oneWeekInSeconds, @@ -1071,7 +1071,7 @@ func (suite *KeeperTestSuite) TestSupplyInterest() { coinDenoms: []string{"ukava"}, borrowCoins: sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(20*KAVA_CF))), interestRateModel: normalModel, - reserveFactor: sdk.MustNewDecFromStr("0.05"), + reserveFactor: sdkmath.LegacyMustNewDecFromStr("0.05"), expectedInterestSnaphots: []ExpectedSupplyInterest{ { elapsedTime: oneMonthInSeconds, @@ -1095,7 +1095,7 @@ func (suite *KeeperTestSuite) TestSupplyInterest() { coinDenoms: []string{"ukava"}, borrowCoins: sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(20*KAVA_CF))), interestRateModel: normalModel, - reserveFactor: sdk.MustNewDecFromStr("0.05"), + reserveFactor: sdkmath.LegacyMustNewDecFromStr("0.05"), expectedInterestSnaphots: []ExpectedSupplyInterest{ { elapsedTime: oneYearInSeconds, @@ -1119,7 +1119,7 @@ func (suite *KeeperTestSuite) TestSupplyInterest() { coinDenoms: []string{"ukava"}, borrowCoins: sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(20*KAVA_CF)), sdk.NewCoin("bnb", sdkmath.NewInt(20*BNB_CF))), interestRateModel: normalModel, - reserveFactor: sdk.MustNewDecFromStr("0.05"), + reserveFactor: sdkmath.LegacyMustNewDecFromStr("0.05"), expectedInterestSnaphots: []ExpectedSupplyInterest{ { elapsedTime: oneMonthInSeconds, @@ -1143,7 +1143,7 @@ func (suite *KeeperTestSuite) TestSupplyInterest() { coinDenoms: []string{"ukava"}, borrowCoins: sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(20*KAVA_CF))), interestRateModel: normalModel, - reserveFactor: sdk.MustNewDecFromStr("0.05"), + reserveFactor: sdkmath.LegacyMustNewDecFromStr("0.05"), expectedInterestSnaphots: []ExpectedSupplyInterest{ { elapsedTime: oneMonthInSeconds, @@ -1167,7 +1167,7 @@ func (suite *KeeperTestSuite) TestSupplyInterest() { coinDenoms: []string{"ukava"}, borrowCoins: sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(80*KAVA_CF))), interestRateModel: normalModel, - reserveFactor: sdk.MustNewDecFromStr("0.05"), + reserveFactor: sdkmath.LegacyMustNewDecFromStr("0.05"), expectedInterestSnaphots: []ExpectedSupplyInterest{ { elapsedTime: oneMonthInSeconds, @@ -1201,7 +1201,7 @@ func (suite *KeeperTestSuite) TestSupplyInterest() { coinDenoms: []string{"ukava"}, borrowCoins: sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(50*KAVA_CF))), interestRateModel: normalModel, - reserveFactor: sdk.MustNewDecFromStr("0.05"), + reserveFactor: sdkmath.LegacyMustNewDecFromStr("0.05"), expectedInterestSnaphots: []ExpectedSupplyInterest{ { elapsedTime: oneMonthInSeconds, @@ -1235,7 +1235,7 @@ func (suite *KeeperTestSuite) TestSupplyInterest() { suite.Run(tc.name, func() { // Initialize test app and set context tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) // Auth module genesis state authGS := app.NewFundedGenStateWithCoins( @@ -1248,21 +1248,21 @@ func (suite *KeeperTestSuite) TestSupplyInterest() { hardGS := types.NewGenesisState(types.NewParams( types.MoneyMarkets{ types.NewMoneyMarket("ukava", - types.NewBorrowLimit(false, sdk.NewDec(100000000*KAVA_CF), sdk.MustNewDecFromStr("0.8")), // Borrow Limit + types.NewBorrowLimit(false, sdkmath.LegacyNewDec(100000000*KAVA_CF), sdkmath.LegacyMustNewDecFromStr("0.8")), // Borrow Limit "kava:usd", // Market ID sdkmath.NewInt(KAVA_CF), // Conversion Factor tc.args.interestRateModel, // Interest Rate Model tc.args.reserveFactor, // Reserve Factor - sdk.ZeroDec()), // Keeper Reward Percentage + sdkmath.LegacyZeroDec()), // Keeper Reward Percentage types.NewMoneyMarket("bnb", - types.NewBorrowLimit(false, sdk.NewDec(100000000*BNB_CF), sdk.MustNewDecFromStr("0.8")), // Borrow Limit + types.NewBorrowLimit(false, sdkmath.LegacyNewDec(100000000*BNB_CF), sdkmath.LegacyMustNewDecFromStr("0.8")), // Borrow Limit "bnb:usd", // Market ID sdkmath.NewInt(BNB_CF), // Conversion Factor tc.args.interestRateModel, // Interest Rate Model tc.args.reserveFactor, // Reserve Factor - sdk.ZeroDec()), // Keeper Reward Percentage + sdkmath.LegacyZeroDec()), // Keeper Reward Percentage }, - sdk.NewDec(10), + sdkmath.LegacyNewDec(10), ), types.DefaultAccumulationTimes, types.DefaultDeposits, types.DefaultBorrows, types.DefaultTotalSupplied, types.DefaultTotalBorrowed, types.DefaultTotalReserves, ) @@ -1279,13 +1279,13 @@ func (suite *KeeperTestSuite) TestSupplyInterest() { { MarketID: "kava:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("2.00"), + Price: sdkmath.LegacyMustNewDecFromStr("2.00"), Expiry: time.Now().Add(100 * time.Hour), }, { MarketID: "bnb:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("20.00"), + Price: sdkmath.LegacyMustNewDecFromStr("20.00"), Expiry: time.Now().Add(100 * time.Hour), }, }, @@ -1337,7 +1337,7 @@ func (suite *KeeperTestSuite) TestSupplyInterest() { reservesPrior, foundReservesPrior := suite.keeper.GetTotalReserves(prevCtx) if !foundReservesPrior { - reservesPrior = sdk.NewCoins(sdk.NewCoin(coinDenom, sdk.ZeroInt())) + reservesPrior = sdk.NewCoins(sdk.NewCoin(coinDenom, sdkmath.ZeroInt())) } borrowInterestFactorPrior, foundBorrowInterestFactorPrior := suite.keeper.GetBorrowInterestFactor(prevCtx, coinDenom) @@ -1347,22 +1347,22 @@ func (suite *KeeperTestSuite) TestSupplyInterest() { suite.Require().True(foundSupplyInterestFactorPrior) // 2. Calculate expected borrow interest owed - borrowRateApy, err := keeper.CalculateBorrowRate(tc.args.interestRateModel, sdk.NewDecFromInt(cashPrior), sdk.NewDecFromInt(borrowCoinPriorAmount), sdk.NewDecFromInt(reservesPrior.AmountOf(coinDenom))) + borrowRateApy, err := keeper.CalculateBorrowRate(tc.args.interestRateModel, sdkmath.LegacyNewDecFromInt(cashPrior), sdkmath.LegacyNewDecFromInt(borrowCoinPriorAmount), sdkmath.LegacyNewDecFromInt(reservesPrior.AmountOf(coinDenom))) suite.Require().NoError(err) // Convert from APY to SPY, expressed as (1 + borrow rate) - borrowRateSpy, err := keeper.APYToSPY(sdk.OneDec().Add(borrowRateApy)) + borrowRateSpy, err := keeper.APYToSPY(sdkmath.LegacyOneDec().Add(borrowRateApy)) suite.Require().NoError(err) newBorrowInterestFactor := keeper.CalculateBorrowInterestFactor(borrowRateSpy, sdkmath.NewInt(snapshot.elapsedTime)) - expectedBorrowInterest := (newBorrowInterestFactor.Mul(sdk.NewDecFromInt(borrowCoinPriorAmount)).TruncateInt()).Sub(borrowCoinPriorAmount) - expectedReserves := reservesPrior.Add(sdk.NewCoin(coinDenom, sdk.NewDecFromInt(expectedBorrowInterest).Mul(tc.args.reserveFactor).TruncateInt())).Sub(reservesPrior...) + expectedBorrowInterest := (newBorrowInterestFactor.Mul(sdkmath.LegacyNewDecFromInt(borrowCoinPriorAmount)).TruncateInt()).Sub(borrowCoinPriorAmount) + expectedReserves := reservesPrior.Add(sdk.NewCoin(coinDenom, sdkmath.LegacyNewDecFromInt(expectedBorrowInterest).Mul(tc.args.reserveFactor).TruncateInt())).Sub(reservesPrior...) expectedTotalReserves := expectedReserves.Add(reservesPrior...) expectedBorrowInterestFactor := borrowInterestFactorPrior.Mul(newBorrowInterestFactor) expectedSupplyInterest := expectedBorrowInterest.Sub(expectedReserves.AmountOf(coinDenom)) - newSupplyInterestFactor := keeper.CalculateSupplyInterestFactor(sdk.NewDecFromInt(expectedSupplyInterest), sdk.NewDecFromInt(cashPrior), sdk.NewDecFromInt(borrowCoinPriorAmount), sdk.NewDecFromInt(reservesPrior.AmountOf(coinDenom))) + newSupplyInterestFactor := keeper.CalculateSupplyInterestFactor(sdkmath.LegacyNewDecFromInt(expectedSupplyInterest), sdkmath.LegacyNewDecFromInt(cashPrior), sdkmath.LegacyNewDecFromInt(borrowCoinPriorAmount), sdkmath.LegacyNewDecFromInt(reservesPrior.AmountOf(coinDenom))) expectedSupplyInterestFactor := supplyInterestFactorPrior.Mul(newSupplyInterestFactor) // ------------------------------------------------------------------------------------- @@ -1405,7 +1405,7 @@ func (suite *KeeperTestSuite) TestSupplyInterest() { // Calculate percentage of supply interest profits owed to user userSupplyBefore, _ := suite.keeper.GetDeposit(snapshotCtx, tc.args.user) userSupplyCoinAmount := userSupplyBefore.Amount.AmountOf(coinDenom) - userPercentOfTotalSupplied := sdk.NewDecFromInt(userSupplyCoinAmount).Quo(sdk.NewDecFromInt(supplyCoinPriorAmount)) + userPercentOfTotalSupplied := sdkmath.LegacyNewDecFromInt(userSupplyCoinAmount).Quo(sdkmath.LegacyNewDecFromInt(supplyCoinPriorAmount)) userExpectedSupplyInterestCoin := sdk.NewCoin(coinDenom, userPercentOfTotalSupplied.MulInt(expectedSupplyInterest).TruncateInt()) // Supplying syncs user's owed supply and borrow interest @@ -1416,7 +1416,7 @@ func (suite *KeeperTestSuite) TestSupplyInterest() { userSupplyAfter, _ := suite.keeper.GetDeposit(snapshotCtx, tc.args.user) // Confirm that user's supply index for the denom has increased as expected - var userSupplyAfterIndexFactor sdk.Dec + var userSupplyAfterIndexFactor sdkmath.LegacyDec for _, indexFactor := range userSupplyAfter.Index { if indexFactor.Denom == coinDenom { userSupplyAfterIndexFactor = indexFactor.Value diff --git a/x/hard/keeper/keeper.go b/x/hard/keeper/keeper.go index 5d4fc3e2fd..c862c77b14 100644 --- a/x/hard/keeper/keeper.go +++ b/x/hard/keeper/keeper.go @@ -1,11 +1,12 @@ package keeper import ( + sdkmath "cosmossdk.io/math" "time" + "cosmossdk.io/store/prefix" + storetypes "cosmossdk.io/store/types" "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/store/prefix" - storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" @@ -82,7 +83,7 @@ func (k Keeper) DeleteDeposit(ctx sdk.Context, deposit types.Deposit) { // IterateDeposits iterates over all deposit objects in the store and performs a callback function func (k Keeper) IterateDeposits(ctx sdk.Context, cb func(deposit types.Deposit) (stop bool)) { store := prefix.NewStore(ctx.KVStore(k.key), types.DepositsKeyPrefix) - iterator := sdk.KVStorePrefixIterator(store, []byte{}) + iterator := storetypes.KVStorePrefixIterator(store, []byte{}) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { var deposit types.Deposit @@ -133,7 +134,7 @@ func (k Keeper) DeleteBorrow(ctx sdk.Context, borrow types.Borrow) { // IterateBorrows iterates over all borrow objects in the store and performs a callback function func (k Keeper) IterateBorrows(ctx sdk.Context, cb func(borrow types.Borrow) (stop bool)) { store := prefix.NewStore(ctx.KVStore(k.key), types.BorrowsKeyPrefix) - iterator := sdk.KVStorePrefixIterator(store, []byte{}) + iterator := storetypes.KVStorePrefixIterator(store, []byte{}) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { var borrow types.Borrow @@ -224,7 +225,7 @@ func (k Keeper) DeleteMoneyMarket(ctx sdk.Context, denom string) { // that returns both the money market and the key (denom) it's stored under func (k Keeper) IterateMoneyMarkets(ctx sdk.Context, cb func(denom string, moneyMarket types.MoneyMarket) (stop bool)) { store := prefix.NewStore(ctx.KVStore(k.key), types.MoneyMarketsPrefix) - iterator := sdk.KVStorePrefixIterator(store, []byte{}) + iterator := storetypes.KVStorePrefixIterator(store, []byte{}) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { var moneyMarket types.MoneyMarket @@ -297,11 +298,11 @@ func (k Keeper) GetTotalReserves(ctx sdk.Context) (sdk.Coins, bool) { } // GetBorrowInterestFactor returns the current borrow interest factor for an individual market -func (k Keeper) GetBorrowInterestFactor(ctx sdk.Context, denom string) (sdk.Dec, bool) { +func (k Keeper) GetBorrowInterestFactor(ctx sdk.Context, denom string) (sdkmath.LegacyDec, bool) { store := prefix.NewStore(ctx.KVStore(k.key), types.BorrowInterestFactorPrefix) bz := store.Get([]byte(denom)) if len(bz) == 0 { - return sdk.ZeroDec(), false + return sdkmath.LegacyZeroDec(), false } var borrowInterestFactor sdk.DecProto k.cdc.MustUnmarshal(bz, &borrowInterestFactor) @@ -309,7 +310,7 @@ func (k Keeper) GetBorrowInterestFactor(ctx sdk.Context, denom string) (sdk.Dec, } // SetBorrowInterestFactor sets the current borrow interest factor for an individual market -func (k Keeper) SetBorrowInterestFactor(ctx sdk.Context, denom string, borrowInterestFactor sdk.Dec) { +func (k Keeper) SetBorrowInterestFactor(ctx sdk.Context, denom string, borrowInterestFactor sdkmath.LegacyDec) { store := prefix.NewStore(ctx.KVStore(k.key), types.BorrowInterestFactorPrefix) bz := k.cdc.MustMarshal(&sdk.DecProto{Dec: borrowInterestFactor}) store.Set([]byte(denom), bz) @@ -317,9 +318,9 @@ func (k Keeper) SetBorrowInterestFactor(ctx sdk.Context, denom string, borrowInt // IterateBorrowInterestFactors iterates over all borrow interest factors in the store and returns // both the borrow interest factor and the key (denom) it's stored under -func (k Keeper) IterateBorrowInterestFactors(ctx sdk.Context, cb func(denom string, factor sdk.Dec) (stop bool)) { +func (k Keeper) IterateBorrowInterestFactors(ctx sdk.Context, cb func(denom string, factor sdkmath.LegacyDec) (stop bool)) { store := prefix.NewStore(ctx.KVStore(k.key), types.BorrowInterestFactorPrefix) - iterator := sdk.KVStorePrefixIterator(store, []byte{}) + iterator := storetypes.KVStorePrefixIterator(store, []byte{}) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { var factor sdk.DecProto @@ -331,11 +332,11 @@ func (k Keeper) IterateBorrowInterestFactors(ctx sdk.Context, cb func(denom stri } // GetSupplyInterestFactor returns the current supply interest factor for an individual market -func (k Keeper) GetSupplyInterestFactor(ctx sdk.Context, denom string) (sdk.Dec, bool) { +func (k Keeper) GetSupplyInterestFactor(ctx sdk.Context, denom string) (sdkmath.LegacyDec, bool) { store := prefix.NewStore(ctx.KVStore(k.key), types.SupplyInterestFactorPrefix) bz := store.Get([]byte(denom)) if len(bz) == 0 { - return sdk.ZeroDec(), false + return sdkmath.LegacyZeroDec(), false } var supplyInterestFactor sdk.DecProto k.cdc.MustUnmarshal(bz, &supplyInterestFactor) @@ -343,7 +344,7 @@ func (k Keeper) GetSupplyInterestFactor(ctx sdk.Context, denom string) (sdk.Dec, } // SetSupplyInterestFactor sets the current supply interest factor for an individual market -func (k Keeper) SetSupplyInterestFactor(ctx sdk.Context, denom string, supplyInterestFactor sdk.Dec) { +func (k Keeper) SetSupplyInterestFactor(ctx sdk.Context, denom string, supplyInterestFactor sdkmath.LegacyDec) { store := prefix.NewStore(ctx.KVStore(k.key), types.SupplyInterestFactorPrefix) bz := k.cdc.MustMarshal(&sdk.DecProto{Dec: supplyInterestFactor}) store.Set([]byte(denom), bz) @@ -351,9 +352,9 @@ func (k Keeper) SetSupplyInterestFactor(ctx sdk.Context, denom string, supplyInt // IterateSupplyInterestFactors iterates over all supply interest factors in the store and returns // both the supply interest factor and the key (denom) it's stored under -func (k Keeper) IterateSupplyInterestFactors(ctx sdk.Context, cb func(denom string, factor sdk.Dec) (stop bool)) { +func (k Keeper) IterateSupplyInterestFactors(ctx sdk.Context, cb func(denom string, factor sdkmath.LegacyDec) (stop bool)) { store := prefix.NewStore(ctx.KVStore(k.key), types.SupplyInterestFactorPrefix) - iterator := sdk.KVStorePrefixIterator(store, []byte{}) + iterator := storetypes.KVStorePrefixIterator(store, []byte{}) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { var factor sdk.DecProto diff --git a/x/hard/keeper/keeper_test.go b/x/hard/keeper/keeper_test.go index 8d2054befc..195ab0fb5d 100644 --- a/x/hard/keeper/keeper_test.go +++ b/x/hard/keeper/keeper_test.go @@ -8,11 +8,9 @@ import ( sdkmath "cosmossdk.io/math" "github.com/stretchr/testify/suite" - sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - tmproto "github.com/cometbft/cometbft/proto/tendermint/types" tmtime "github.com/cometbft/cometbft/types/time" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/kava-labs/kava/app" auctionkeeper "github.com/kava-labs/kava/x/auction/keeper" @@ -36,7 +34,7 @@ func (suite *KeeperTestSuite) SetupTest() { app.SetBech32AddressPrefixes(config) tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) tApp.InitializeFromGenesisStates() _, addrs := app.GeneratePrivKeyAddressPairs(1) keeper := tApp.GetHardKeeper() @@ -51,7 +49,7 @@ func (suite *KeeperTestSuite) TestGetSetDeleteDeposit() { dep := types.NewDeposit( addr, sdk.NewCoins(sdk.NewCoin("bnb", sdkmath.NewInt(100))), - types.SupplyInterestFactors{types.NewSupplyInterestFactor("bnb", sdk.MustNewDecFromStr("1.12"))}, + types.SupplyInterestFactors{types.NewSupplyInterestFactor("bnb", sdkmath.LegacyMustNewDecFromStr("1.12"))}, ) _, f := suite.keeper.GetDeposit(suite.ctx, addr) @@ -75,7 +73,7 @@ func (suite *KeeperTestSuite) TestIterateDeposits() { dep := types.NewDeposit( sdk.AccAddress("test"+fmt.Sprint(i)), sdk.NewCoins(sdk.NewCoin("bnb", sdkmath.NewInt(100))), - types.SupplyInterestFactors{types.NewSupplyInterestFactor("bnb", sdk.MustNewDecFromStr("1.12"))}, + types.SupplyInterestFactors{types.NewSupplyInterestFactor("bnb", sdkmath.LegacyMustNewDecFromStr("1.12"))}, ) deposits = append(deposits, dep) suite.keeper.SetDeposit(suite.ctx, dep) @@ -94,7 +92,7 @@ func (suite *KeeperTestSuite) TestGetSetDeleteBorrow() { borrow := types.NewBorrow( addr, sdk.NewCoins(sdk.NewInt64Coin("bnb", 1e9)), - types.BorrowInterestFactors{types.NewBorrowInterestFactor("bnb", sdk.MustNewDecFromStr("1.12"))}, + types.BorrowInterestFactors{types.NewBorrowInterestFactor("bnb", sdkmath.LegacyMustNewDecFromStr("1.12"))}, ) _, f := suite.keeper.GetBorrow(suite.ctx, addr) @@ -118,7 +116,7 @@ func (suite *KeeperTestSuite) TestIterateBorrows() { borrow := types.NewBorrow( sdk.AccAddress("test"+fmt.Sprint(i)), sdk.NewCoins(sdk.NewInt64Coin("bnb", 1e9)), - types.BorrowInterestFactors{types.NewBorrowInterestFactor("bnb", sdk.MustNewDecFromStr("1.12"))}, + types.BorrowInterestFactors{types.NewBorrowInterestFactor("bnb", sdkmath.LegacyMustNewDecFromStr("1.12"))}, ) borrows = append(borrows, borrow) suite.keeper.SetBorrow(suite.ctx, borrow) @@ -133,9 +131,9 @@ func (suite *KeeperTestSuite) TestIterateBorrows() { func (suite *KeeperTestSuite) TestGetSetDeleteInterestRateModel() { denom := "test" - model := types.NewInterestRateModel(sdk.MustNewDecFromStr("0.05"), sdk.MustNewDecFromStr("2"), sdk.MustNewDecFromStr("0.8"), sdk.MustNewDecFromStr("10")) - borrowLimit := types.NewBorrowLimit(false, sdk.MustNewDecFromStr("0.2"), sdk.MustNewDecFromStr("0.5")) - moneyMarket := types.NewMoneyMarket(denom, borrowLimit, denom+":usd", sdkmath.NewInt(1000000), model, sdk.MustNewDecFromStr("0.05"), sdk.ZeroDec()) + model := types.NewInterestRateModel(sdkmath.LegacyMustNewDecFromStr("0.05"), sdkmath.LegacyMustNewDecFromStr("2"), sdkmath.LegacyMustNewDecFromStr("0.8"), sdkmath.LegacyMustNewDecFromStr("10")) + borrowLimit := types.NewBorrowLimit(false, sdkmath.LegacyMustNewDecFromStr("0.2"), sdkmath.LegacyMustNewDecFromStr("0.5")) + moneyMarket := types.NewMoneyMarket(denom, borrowLimit, denom+":usd", sdkmath.NewInt(1000000), model, sdkmath.LegacyMustNewDecFromStr("0.05"), sdkmath.LegacyZeroDec()) _, f := suite.keeper.GetMoneyMarket(suite.ctx, denom) suite.Require().False(f) @@ -159,9 +157,9 @@ func (suite *KeeperTestSuite) TestIterateInterestRateModels() { for i := 0; i < 5; i++ { // Initialize a new money market denom := testDenom + strconv.Itoa(i) - model := types.NewInterestRateModel(sdk.MustNewDecFromStr("0.05"), sdk.MustNewDecFromStr("2"), sdk.MustNewDecFromStr("0.8"), sdk.MustNewDecFromStr("10")) - borrowLimit := types.NewBorrowLimit(false, sdk.MustNewDecFromStr("0.2"), sdk.MustNewDecFromStr("0.5")) - moneyMarket := types.NewMoneyMarket(denom, borrowLimit, denom+":usd", sdkmath.NewInt(1000000), model, sdk.MustNewDecFromStr("0.05"), sdk.ZeroDec()) + model := types.NewInterestRateModel(sdkmath.LegacyMustNewDecFromStr("0.05"), sdkmath.LegacyMustNewDecFromStr("2"), sdkmath.LegacyMustNewDecFromStr("0.8"), sdkmath.LegacyMustNewDecFromStr("10")) + borrowLimit := types.NewBorrowLimit(false, sdkmath.LegacyMustNewDecFromStr("0.2"), sdkmath.LegacyMustNewDecFromStr("0.5")) + moneyMarket := types.NewMoneyMarket(denom, borrowLimit, denom+":usd", sdkmath.NewInt(1000000), model, sdkmath.LegacyMustNewDecFromStr("0.05"), sdkmath.LegacyZeroDec()) // Store money market in the module's store suite.Require().NotPanics(func() { suite.keeper.SetMoneyMarket(suite.ctx, denom, moneyMarket) }) @@ -205,27 +203,27 @@ func (suite *KeeperTestSuite) TestGetSetBorrowedCoins_Empty() { suite.Require().Empty(coins) } -func (suite *KeeperTestSuite) getAccountCoins(acc authtypes.AccountI) sdk.Coins { +func (suite *KeeperTestSuite) getAccountCoins(acc sdk.AccountI) sdk.Coins { bk := suite.app.GetBankKeeper() return bk.GetAllBalances(suite.ctx, acc.GetAddress()) } -func (suite *KeeperTestSuite) getAccount(addr sdk.AccAddress) authtypes.AccountI { +func (suite *KeeperTestSuite) getAccount(addr sdk.AccAddress) sdk.AccountI { ak := suite.app.GetAccountKeeper() return ak.GetAccount(suite.ctx, addr) } -func (suite *KeeperTestSuite) getAccountAtCtx(addr sdk.AccAddress, ctx sdk.Context) authtypes.AccountI { +func (suite *KeeperTestSuite) getAccountAtCtx(addr sdk.AccAddress, ctx sdk.Context) sdk.AccountI { ak := suite.app.GetAccountKeeper() return ak.GetAccount(ctx, addr) } -func (suite *KeeperTestSuite) getModuleAccount(name string) authtypes.ModuleAccountI { +func (suite *KeeperTestSuite) getModuleAccount(name string) sdk.ModuleAccountI { ak := suite.app.GetAccountKeeper() return ak.GetModuleAccount(suite.ctx, name) } -func (suite *KeeperTestSuite) getModuleAccountAtCtx(name string, ctx sdk.Context) authtypes.ModuleAccountI { +func (suite *KeeperTestSuite) getModuleAccountAtCtx(name string, ctx sdk.Context) sdk.ModuleAccountI { ak := suite.app.GetAccountKeeper() return ak.GetModuleAccount(ctx, name) } diff --git a/x/hard/keeper/liquidation.go b/x/hard/keeper/liquidation.go index 94fce1a8b0..9159392412 100644 --- a/x/hard/keeper/liquidation.go +++ b/x/hard/keeper/liquidation.go @@ -12,8 +12,8 @@ import ( // LiqData holds liquidation-related data type LiqData struct { - price sdk.Dec - ltv sdk.Dec + price sdkmath.LegacyDec + ltv sdkmath.LegacyDec conversionFactor sdkmath.Int } @@ -86,7 +86,7 @@ func (k Keeper) SeizeDeposits(ctx sdk.Context, keeper sdk.AccAddress, deposit ty for _, depCoin := range deposit.Amount { mm, _ := k.GetMoneyMarket(ctx, depCoin.Denom) keeperReward := mm.KeeperRewardPercentage.MulInt(depCoin.Amount).TruncateInt() - if keeperReward.GT(sdk.ZeroInt()) { + if keeperReward.GT(sdkmath.ZeroInt()) { // Send keeper their reward keeperCoin := sdk.NewCoin(depCoin.Denom, keeperReward) keeperRewardCoins = append(keeperRewardCoins, keeperCoin) @@ -108,7 +108,7 @@ func (k Keeper) SeizeDeposits(ctx sdk.Context, keeper sdk.AccAddress, deposit ty depositCoinValues := types.NewValuationMap() for _, deposit := range aucDeposits { dData := liqMap[deposit.Denom] - dCoinUsdValue := sdk.NewDecFromInt(deposit.Amount).Quo(sdk.NewDecFromInt(dData.conversionFactor)).Mul(dData.price) + dCoinUsdValue := sdkmath.LegacyNewDecFromInt(deposit.Amount).Quo(sdkmath.LegacyNewDecFromInt(dData.conversionFactor)).Mul(dData.price) depositCoinValues.Increment(deposit.Denom, dCoinUsdValue) } @@ -116,7 +116,7 @@ func (k Keeper) SeizeDeposits(ctx sdk.Context, keeper sdk.AccAddress, deposit ty borrowCoinValues := types.NewValuationMap() for _, bCoin := range borrow.Amount { bData := liqMap[bCoin.Denom] - bCoinUsdValue := sdk.NewDecFromInt(bCoin.Amount).Quo(sdk.NewDecFromInt(bData.conversionFactor)).Mul(bData.price) + bCoinUsdValue := sdkmath.LegacyNewDecFromInt(bCoin.Amount).Quo(sdkmath.LegacyNewDecFromInt(bData.conversionFactor)).Mul(bData.price) borrowCoinValues.Increment(bCoin.Denom, bCoinUsdValue) } @@ -148,7 +148,7 @@ func (k Keeper) SeizeDeposits(ctx sdk.Context, keeper sdk.AccAddress, deposit ty // StartAuctions attempts to start auctions for seized assets func (k Keeper) StartAuctions(ctx sdk.Context, borrower sdk.AccAddress, borrows, deposits sdk.Coins, - depositCoinValues, borrowCoinValues types.ValuationMap, ltv sdk.Dec, liqMap map[string]LiqData, + depositCoinValues, borrowCoinValues types.ValuationMap, ltv sdkmath.LegacyDec, liqMap map[string]LiqData, ) (sdk.Coins, error) { // Sort keys to ensure deterministic behavior bKeys := borrowCoinValues.GetSortedKeys() @@ -157,7 +157,7 @@ func (k Keeper) StartAuctions(ctx sdk.Context, borrower sdk.AccAddress, borrows, // Set up auction constants returnAddrs := []sdk.AccAddress{borrower} weights := []sdkmath.Int{sdkmath.NewInt(100)} - debt := sdk.NewCoin("debt", sdk.ZeroInt()) + debt := sdk.NewCoin("debt", sdkmath.ZeroInt()) macc := k.accountKeeper.GetModuleAccount(ctx, types.ModuleAccountName) maccCoins := k.bankKeeper.SpendableCoins(ctx, macc.GetAddress()) @@ -169,7 +169,7 @@ func (k Keeper) StartAuctions(ctx sdk.Context, borrower sdk.AccAddress, borrows, for _, dKey := range dKeys { dValue := depositCoinValues.Get(dKey) - if maxLotSize.Equal(sdk.ZeroDec()) { + if maxLotSize.Equal(sdkmath.LegacyZeroDec()) { break // exit out of the loop if we have cleared the full amount } @@ -177,7 +177,7 @@ func (k Keeper) StartAuctions(ctx sdk.Context, borrower sdk.AccAddress, borrows, bid := sdk.NewCoin(bKey, borrows.AmountOf(bKey)) lotSize := maxLotSize.MulInt(liqMap[dKey].conversionFactor).Quo(liqMap[dKey].price) - if lotSize.TruncateInt().Equal(sdk.ZeroInt()) { + if lotSize.TruncateInt().Equal(sdkmath.ZeroInt()) { continue } lot := sdk.NewCoin(dKey, lotSize.TruncateInt()) @@ -222,14 +222,14 @@ func (k Keeper) StartAuctions(ctx sdk.Context, borrower sdk.AccAddress, borrows, deposits = deposits.Sub(lot) } // Update max lot size - maxLotSize = sdk.ZeroDec() + maxLotSize = sdkmath.LegacyZeroDec() } else { // We can only start an auction for the partial borrow amount maxBid := dValue.Mul(ltv) bidSize := maxBid.MulInt(liqMap[bKey].conversionFactor).Quo(liqMap[bKey].price) bid := sdk.NewCoin(bKey, bidSize.TruncateInt()) lot := sdk.NewCoin(dKey, deposits.AmountOf(dKey)) - if bid.Amount.Equal(sdk.ZeroInt()) || lot.Amount.Equal(sdk.ZeroInt()) { + if bid.Amount.Equal(sdkmath.ZeroInt()) || lot.Amount.Equal(sdkmath.ZeroInt()) { continue } @@ -282,7 +282,7 @@ func (k Keeper) StartAuctions(ctx sdk.Context, borrower sdk.AccAddress, borrows, // Send any remaining deposit back to the original borrower for _, dKey := range dKeys { remaining := deposits.AmountOf(dKey) - if remaining.GT(sdk.ZeroInt()) { + if remaining.GT(sdkmath.ZeroInt()) { returnCoin := sdk.NewCoins(sdk.NewCoin(dKey, remaining)) err := k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleAccountName, borrower, returnCoin) if err != nil { @@ -301,18 +301,18 @@ func (k Keeper) IsWithinValidLtvRange(ctx sdk.Context, deposit types.Deposit, bo return false, err } - totalBorrowableUSDAmount := sdk.ZeroDec() + totalBorrowableUSDAmount := sdkmath.LegacyZeroDec() for _, depCoin := range deposit.Amount { lData := liqMap[depCoin.Denom] - usdValue := sdk.NewDecFromInt(depCoin.Amount).Quo(sdk.NewDecFromInt(lData.conversionFactor)).Mul(lData.price) + usdValue := sdkmath.LegacyNewDecFromInt(depCoin.Amount).Quo(sdkmath.LegacyNewDecFromInt(lData.conversionFactor)).Mul(lData.price) borrowableUSDAmountForDeposit := usdValue.Mul(lData.ltv) totalBorrowableUSDAmount = totalBorrowableUSDAmount.Add(borrowableUSDAmountForDeposit) } - totalBorrowedUSDAmount := sdk.ZeroDec() + totalBorrowedUSDAmount := sdkmath.LegacyZeroDec() for _, coin := range borrow.Amount { lData := liqMap[coin.Denom] - usdValue := sdk.NewDecFromInt(coin.Amount).Quo(sdk.NewDecFromInt(lData.conversionFactor)).Mul(lData.price) + usdValue := sdkmath.LegacyNewDecFromInt(coin.Amount).Quo(sdkmath.LegacyNewDecFromInt(lData.conversionFactor)).Mul(lData.price) totalBorrowedUSDAmount = totalBorrowedUSDAmount.Add(usdValue) } @@ -326,17 +326,17 @@ func (k Keeper) IsWithinValidLtvRange(ctx sdk.Context, deposit types.Deposit, bo // GetStoreLTV calculates the user's current LTV based on their deposits/borrows in the store // and does not include any outsanding interest. -func (k Keeper) GetStoreLTV(ctx sdk.Context, addr sdk.AccAddress) (sdk.Dec, error) { +func (k Keeper) GetStoreLTV(ctx sdk.Context, addr sdk.AccAddress) (sdkmath.LegacyDec, error) { // Fetch deposits and parse coin denoms deposit, found := k.GetDeposit(ctx, addr) if !found { - return sdk.ZeroDec(), nil + return sdkmath.LegacyZeroDec(), nil } // Fetch borrow balances and parse coin denoms borrow, found := k.GetBorrow(ctx, addr) if !found { - return sdk.ZeroDec(), nil + return sdkmath.LegacyZeroDec(), nil } return k.CalculateLtv(ctx, deposit, borrow) @@ -344,18 +344,18 @@ func (k Keeper) GetStoreLTV(ctx sdk.Context, addr sdk.AccAddress) (sdk.Dec, erro // CalculateLtv calculates the potential LTV given a user's deposits and borrows. // The boolean returned indicates if the LTV should be added to the store's LTV index. -func (k Keeper) CalculateLtv(ctx sdk.Context, deposit types.Deposit, borrow types.Borrow) (sdk.Dec, error) { +func (k Keeper) CalculateLtv(ctx sdk.Context, deposit types.Deposit, borrow types.Borrow) (sdkmath.LegacyDec, error) { // Load required liquidation data for every deposit/borrow denom liqMap, err := k.LoadLiquidationData(ctx, deposit, borrow) if err != nil { - return sdk.ZeroDec(), nil + return sdkmath.LegacyZeroDec(), nil } // Build valuation map to hold deposit coin USD valuations depositCoinValues := types.NewValuationMap() for _, depCoin := range deposit.Amount { dData := liqMap[depCoin.Denom] - dCoinUsdValue := sdk.NewDecFromInt(depCoin.Amount).Quo(sdk.NewDecFromInt(dData.conversionFactor)).Mul(dData.price) + dCoinUsdValue := sdkmath.LegacyNewDecFromInt(depCoin.Amount).Quo(sdkmath.LegacyNewDecFromInt(dData.conversionFactor)).Mul(dData.price) depositCoinValues.Increment(depCoin.Denom, dCoinUsdValue) } @@ -363,14 +363,14 @@ func (k Keeper) CalculateLtv(ctx sdk.Context, deposit types.Deposit, borrow type borrowCoinValues := types.NewValuationMap() for _, bCoin := range borrow.Amount { bData := liqMap[bCoin.Denom] - bCoinUsdValue := sdk.NewDecFromInt(bCoin.Amount).Quo(sdk.NewDecFromInt(bData.conversionFactor)).Mul(bData.price) + bCoinUsdValue := sdkmath.LegacyNewDecFromInt(bCoin.Amount).Quo(sdkmath.LegacyNewDecFromInt(bData.conversionFactor)).Mul(bData.price) borrowCoinValues.Increment(bCoin.Denom, bCoinUsdValue) } // User doesn't have any deposits, catch divide by 0 error sumDeposits := depositCoinValues.Sum() - if sumDeposits.Equal(sdk.ZeroDec()) { - return sdk.ZeroDec(), nil + if sumDeposits.Equal(sdkmath.LegacyZeroDec()) { + return sdkmath.LegacyZeroDec(), nil } // Loan-to-Value ratio diff --git a/x/hard/keeper/liquidation_test.go b/x/hard/keeper/liquidation_test.go index d9c3fe33da..08bbb5d4bf 100644 --- a/x/hard/keeper/liquidation_test.go +++ b/x/hard/keeper/liquidation_test.go @@ -20,7 +20,7 @@ func (suite *KeeperTestSuite) TestKeeperLiquidation() { type args struct { borrower sdk.AccAddress keeper sdk.AccAddress - keeperRewardPercent sdk.Dec + keeperRewardPercent sdkmath.LegacyDec initialModuleCoins sdk.Coins initialBorrowerCoins sdk.Coins initialKeeperCoins sdk.Coins @@ -46,8 +46,8 @@ func (suite *KeeperTestSuite) TestKeeperLiquidation() { } // Set up test constants - model := types.NewInterestRateModel(sdk.MustNewDecFromStr("0"), sdk.MustNewDecFromStr("0.1"), sdk.MustNewDecFromStr("0.8"), sdk.MustNewDecFromStr("0.5")) - reserveFactor := sdk.MustNewDecFromStr("0.05") + model := types.NewInterestRateModel(sdkmath.LegacyMustNewDecFromStr("0"), sdkmath.LegacyMustNewDecFromStr("0.1"), sdkmath.LegacyMustNewDecFromStr("0.8"), sdkmath.LegacyMustNewDecFromStr("0.5")) + reserveFactor := sdkmath.LegacyMustNewDecFromStr("0.05") oneMonthDur := time.Second * 30 * 24 * 3600 borrower := sdk.AccAddress(crypto.AddressHash([]byte("testborrower"))) keeper := sdk.AccAddress(crypto.AddressHash([]byte("testkeeper"))) @@ -65,7 +65,7 @@ func (suite *KeeperTestSuite) TestKeeperLiquidation() { args{ borrower: borrower, keeper: keeper, - keeperRewardPercent: sdk.MustNewDecFromStr("0.05"), + keeperRewardPercent: sdkmath.LegacyMustNewDecFromStr("0.05"), initialModuleCoins: sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(100*KAVA_CF))), initialBorrowerCoins: sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(100*KAVA_CF))), initialKeeperCoins: sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(100*KAVA_CF))), @@ -104,7 +104,7 @@ func (suite *KeeperTestSuite) TestKeeperLiquidation() { args{ borrower: borrower, keeper: keeper, - keeperRewardPercent: sdk.MustNewDecFromStr("0.0"), + keeperRewardPercent: sdkmath.LegacyMustNewDecFromStr("0.0"), initialModuleCoins: sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(100*KAVA_CF))), initialBorrowerCoins: sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(100*KAVA_CF))), initialKeeperCoins: sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(100*KAVA_CF))), @@ -143,7 +143,7 @@ func (suite *KeeperTestSuite) TestKeeperLiquidation() { args{ borrower: borrower, keeper: keeper, - keeperRewardPercent: sdk.MustNewDecFromStr("1.0"), + keeperRewardPercent: sdkmath.LegacyMustNewDecFromStr("1.0"), initialModuleCoins: sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(100*KAVA_CF))), initialBorrowerCoins: sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(100*KAVA_CF))), initialKeeperCoins: sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(100*KAVA_CF))), @@ -166,7 +166,7 @@ func (suite *KeeperTestSuite) TestKeeperLiquidation() { args{ borrower: borrower, keeper: keeper, - keeperRewardPercent: sdk.MustNewDecFromStr("0.05"), + keeperRewardPercent: sdkmath.LegacyMustNewDecFromStr("0.05"), initialModuleCoins: sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(1000*KAVA_CF)), sdk.NewCoin("usdc", sdkmath.NewInt(1000*KAVA_CF)), sdk.NewCoin("bnb", sdkmath.NewInt(1000*BNB_CF)), sdk.NewCoin("btc", sdkmath.NewInt(1000*BTCB_CF))), initialBorrowerCoins: sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(100*KAVA_CF))), initialKeeperCoins: sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(100*KAVA_CF))), @@ -255,7 +255,7 @@ func (suite *KeeperTestSuite) TestKeeperLiquidation() { args{ borrower: borrower, keeper: keeper, - keeperRewardPercent: sdk.MustNewDecFromStr("0.05"), + keeperRewardPercent: sdkmath.LegacyMustNewDecFromStr("0.05"), initialModuleCoins: sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(1000*KAVA_CF))), initialBorrowerCoins: sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(100*KAVA_CF)), sdk.NewCoin("bnb", sdkmath.NewInt(100*BNB_CF)), sdk.NewCoin("btc", sdkmath.NewInt(100*BTCB_CF))), initialKeeperCoins: sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(100*KAVA_CF))), @@ -327,7 +327,7 @@ func (suite *KeeperTestSuite) TestKeeperLiquidation() { args{ borrower: borrower, keeper: keeper, - keeperRewardPercent: sdk.MustNewDecFromStr("0.05"), + keeperRewardPercent: sdkmath.LegacyMustNewDecFromStr("0.05"), initialModuleCoins: sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(1000*KAVA_CF)), sdk.NewCoin("bnb", sdkmath.NewInt(1000*BNB_CF)), sdk.NewCoin("btc", sdkmath.NewInt(1000*BTCB_CF))), initialBorrowerCoins: sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(100*KAVA_CF)), sdk.NewCoin("usdc", sdkmath.NewInt(100*KAVA_CF)), sdk.NewCoin("usdt", sdkmath.NewInt(100*KAVA_CF)), sdk.NewCoin("usdx", sdkmath.NewInt(100*KAVA_CF))), initialKeeperCoins: sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(100*KAVA_CF))), @@ -431,7 +431,7 @@ func (suite *KeeperTestSuite) TestKeeperLiquidation() { args{ borrower: borrower, keeper: keeper, - keeperRewardPercent: sdk.MustNewDecFromStr("0.05"), + keeperRewardPercent: sdkmath.LegacyMustNewDecFromStr("0.05"), initialModuleCoins: sdk.NewCoins(sdk.NewCoin("usdx", sdkmath.NewInt(1000*KAVA_CF)), sdk.NewCoin("usdt", sdkmath.NewInt(1000*KAVA_CF)), sdk.NewCoin("dai", sdkmath.NewInt(1000*KAVA_CF)), sdk.NewCoin("usdc", sdkmath.NewInt(1000*KAVA_CF))), initialBorrowerCoins: sdk.NewCoins(sdk.NewCoin("usdx", sdkmath.NewInt(1000*KAVA_CF)), sdk.NewCoin("usdt", sdkmath.NewInt(1000*KAVA_CF)), sdk.NewCoin("dai", sdkmath.NewInt(1000*KAVA_CF)), sdk.NewCoin("usdc", sdkmath.NewInt(1000*KAVA_CF))), initialKeeperCoins: sdk.NewCoins(sdk.NewCoin("usdx", sdkmath.NewInt(1000*KAVA_CF)), sdk.NewCoin("usdt", sdkmath.NewInt(1000*KAVA_CF)), sdk.NewCoin("dai", sdkmath.NewInt(1000*KAVA_CF)), sdk.NewCoin("usdc", sdkmath.NewInt(1000*KAVA_CF))), @@ -505,7 +505,7 @@ func (suite *KeeperTestSuite) TestKeeperLiquidation() { args{ borrower: borrower, keeper: keeper, - keeperRewardPercent: sdk.MustNewDecFromStr("0.05"), + keeperRewardPercent: sdkmath.LegacyMustNewDecFromStr("0.05"), initialModuleCoins: sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(100*KAVA_CF))), initialBorrowerCoins: sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(100*KAVA_CF))), initialKeeperCoins: sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(100*KAVA_CF))), @@ -529,7 +529,7 @@ func (suite *KeeperTestSuite) TestKeeperLiquidation() { suite.Run(tc.name, func() { // Initialize test app and set context tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: time.Date(1998, 1, 1, 0, 0, 0, 0, time.UTC)}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: time.Date(1998, 1, 1, 0, 0, 0, 0, time.UTC)}) // account which will deposit "initial module account coins" depositor := sdk.AccAddress(crypto.AddressHash([]byte("testdepositor"))) @@ -553,56 +553,56 @@ func (suite *KeeperTestSuite) TestKeeperLiquidation() { hardGS := types.NewGenesisState(types.NewParams( types.MoneyMarkets{ types.NewMoneyMarket("usdx", - types.NewBorrowLimit(false, sdk.NewDec(100000000*KAVA_CF), sdk.MustNewDecFromStr("0.9")), // Borrow Limit + types.NewBorrowLimit(false, sdkmath.LegacyNewDec(100000000*KAVA_CF), sdkmath.LegacyMustNewDecFromStr("0.9")), // Borrow Limit "usdx:usd", // Market ID sdkmath.NewInt(KAVA_CF), // Conversion Factor model, // Interest Rate Model reserveFactor, // Reserve Factor tc.args.keeperRewardPercent), // Keeper Reward Percent types.NewMoneyMarket("usdt", - types.NewBorrowLimit(false, sdk.NewDec(100000000*KAVA_CF), sdk.MustNewDecFromStr("0.9")), // Borrow Limit + types.NewBorrowLimit(false, sdkmath.LegacyNewDec(100000000*KAVA_CF), sdkmath.LegacyMustNewDecFromStr("0.9")), // Borrow Limit "usdt:usd", // Market ID sdkmath.NewInt(KAVA_CF), // Conversion Factor model, // Interest Rate Model reserveFactor, // Reserve Factor tc.args.keeperRewardPercent), // Keeper Reward Percent types.NewMoneyMarket("usdc", - types.NewBorrowLimit(false, sdk.NewDec(100000000*KAVA_CF), sdk.MustNewDecFromStr("0.9")), // Borrow Limit + types.NewBorrowLimit(false, sdkmath.LegacyNewDec(100000000*KAVA_CF), sdkmath.LegacyMustNewDecFromStr("0.9")), // Borrow Limit "usdc:usd", // Market ID sdkmath.NewInt(KAVA_CF), // Conversion Factor model, // Interest Rate Model reserveFactor, // Reserve Factor tc.args.keeperRewardPercent), // Keeper Reward Percent types.NewMoneyMarket("dai", - types.NewBorrowLimit(false, sdk.NewDec(100000000*KAVA_CF), sdk.MustNewDecFromStr("0.9")), // Borrow Limit + types.NewBorrowLimit(false, sdkmath.LegacyNewDec(100000000*KAVA_CF), sdkmath.LegacyMustNewDecFromStr("0.9")), // Borrow Limit "dai:usd", // Market ID sdkmath.NewInt(KAVA_CF), // Conversion Factor model, // Interest Rate Model reserveFactor, // Reserve Factor tc.args.keeperRewardPercent), // Keeper Reward Percent types.NewMoneyMarket("ukava", - types.NewBorrowLimit(false, sdk.NewDec(100000000*KAVA_CF), sdk.MustNewDecFromStr("0.8")), // Borrow Limit + types.NewBorrowLimit(false, sdkmath.LegacyNewDec(100000000*KAVA_CF), sdkmath.LegacyMustNewDecFromStr("0.8")), // Borrow Limit "kava:usd", // Market ID sdkmath.NewInt(KAVA_CF), // Conversion Factor model, // Interest Rate Model reserveFactor, // Reserve Factor tc.args.keeperRewardPercent), // Keeper Reward Percent types.NewMoneyMarket("bnb", - types.NewBorrowLimit(false, sdk.NewDec(100000000*BNB_CF), sdk.MustNewDecFromStr("0.8")), // Borrow Limit + types.NewBorrowLimit(false, sdkmath.LegacyNewDec(100000000*BNB_CF), sdkmath.LegacyMustNewDecFromStr("0.8")), // Borrow Limit "bnb:usd", // Market ID sdkmath.NewInt(BNB_CF), // Conversion Factor model, // Interest Rate Model reserveFactor, // Reserve Factor tc.args.keeperRewardPercent), // Keeper Reward Percent types.NewMoneyMarket("btc", - types.NewBorrowLimit(false, sdk.NewDec(100000000*BTCB_CF), sdk.MustNewDecFromStr("0.8")), // Borrow Limit + types.NewBorrowLimit(false, sdkmath.LegacyNewDec(100000000*BTCB_CF), sdkmath.LegacyMustNewDecFromStr("0.8")), // Borrow Limit "btc:usd", // Market ID sdkmath.NewInt(BTCB_CF), // Conversion Factor model, // Interest Rate Model reserveFactor, // Reserve Factor tc.args.keeperRewardPercent), // Keeper Reward Percent }, - sdk.NewDec(10), + sdkmath.LegacyNewDec(10), ), types.DefaultAccumulationTimes, types.DefaultDeposits, types.DefaultBorrows, types.DefaultTotalSupplied, types.DefaultTotalBorrowed, types.DefaultTotalReserves, ) @@ -624,43 +624,43 @@ func (suite *KeeperTestSuite) TestKeeperLiquidation() { { MarketID: "usdx:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("1.00"), + Price: sdkmath.LegacyMustNewDecFromStr("1.00"), Expiry: time.Now().Add(100 * time.Hour), }, { MarketID: "usdt:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("1.00"), + Price: sdkmath.LegacyMustNewDecFromStr("1.00"), Expiry: time.Now().Add(100 * time.Hour), }, { MarketID: "usdc:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("1.00"), + Price: sdkmath.LegacyMustNewDecFromStr("1.00"), Expiry: time.Now().Add(100 * time.Hour), }, { MarketID: "dai:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("1.00"), + Price: sdkmath.LegacyMustNewDecFromStr("1.00"), Expiry: time.Now().Add(100 * time.Hour), }, { MarketID: "kava:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("2.00"), + Price: sdkmath.LegacyMustNewDecFromStr("2.00"), Expiry: time.Now().Add(100 * time.Hour), }, { MarketID: "bnb:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("10.00"), + Price: sdkmath.LegacyMustNewDecFromStr("10.00"), Expiry: time.Now().Add(100 * time.Hour), }, { MarketID: "btc:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("100.00"), + Price: sdkmath.LegacyMustNewDecFromStr("100.00"), Expiry: time.Now().Add(100 * time.Hour), }, }, diff --git a/x/hard/keeper/params.go b/x/hard/keeper/params.go index 8bcd339cd6..6225402c50 100644 --- a/x/hard/keeper/params.go +++ b/x/hard/keeper/params.go @@ -1,6 +1,7 @@ package keeper import ( + sdkmath "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/kava-labs/kava/x/hard/types" @@ -19,7 +20,7 @@ func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { } // GetMinimumBorrowUSDValue returns the minimum borrow USD value -func (k Keeper) GetMinimumBorrowUSDValue(ctx sdk.Context) sdk.Dec { +func (k Keeper) GetMinimumBorrowUSDValue(ctx sdk.Context) sdkmath.LegacyDec { params := k.GetParams(ctx) return params.MinimumBorrowUSDValue } diff --git a/x/hard/keeper/repay.go b/x/hard/keeper/repay.go index 454812fd5e..d1fcc851c1 100644 --- a/x/hard/keeper/repay.go +++ b/x/hard/keeper/repay.go @@ -2,6 +2,7 @@ package keeper import ( errorsmod "cosmossdk.io/errors" + sdkmath "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/kava-labs/kava/x/hard/types" @@ -83,10 +84,10 @@ func (k Keeper) Repay(ctx sdk.Context, sender, owner sdk.AccAddress, coins sdk.C // ValidateRepay validates a requested loan repay func (k Keeper) ValidateRepay(ctx sdk.Context, sender, owner sdk.AccAddress, coins sdk.Coins) error { - assetPriceCache := map[string]sdk.Dec{} + assetPriceCache := map[string]sdkmath.LegacyDec{} // Get the total USD value of user's existing borrows - existingBorrowUSDValue := sdk.ZeroDec() + existingBorrowUSDValue := sdkmath.LegacyZeroDec() existingBorrow, found := k.GetBorrow(ctx, owner) if found { for _, coin := range existingBorrow.Amount { @@ -106,13 +107,13 @@ func (k Keeper) ValidateRepay(ctx sdk.Context, sender, owner sdk.AccAddress, coi } // Calculate this borrow coin's USD value and add it to the total previous borrowed USD value - coinUSDValue := sdk.NewDecFromInt(coin.Amount).Quo(sdk.NewDecFromInt(moneyMarket.ConversionFactor)).Mul(assetPrice) + coinUSDValue := sdkmath.LegacyNewDecFromInt(coin.Amount).Quo(sdkmath.LegacyNewDecFromInt(moneyMarket.ConversionFactor)).Mul(assetPrice) existingBorrowUSDValue = existingBorrowUSDValue.Add(coinUSDValue) } } senderCoins := k.bankKeeper.SpendableCoins(ctx, sender) - repayTotalUSDValue := sdk.ZeroDec() + repayTotalUSDValue := sdkmath.LegacyZeroDec() for _, repayCoin := range coins { // Check that sender holds enough tokens to make the proposed payment if senderCoins.AmountOf(repayCoin.Denom).LT(repayCoin.Amount) { @@ -134,16 +135,16 @@ func (k Keeper) ValidateRepay(ctx sdk.Context, sender, owner sdk.AccAddress, coi assetPriceCache[repayCoin.Denom] = assetPriceInfo.Price assetPrice = assetPriceInfo.Price } - coinUSDValue := sdk.NewDecFromInt(repayCoin.Amount).Quo(sdk.NewDecFromInt(moneyMarket.ConversionFactor)).Mul(assetPrice) + coinUSDValue := sdkmath.LegacyNewDecFromInt(repayCoin.Amount).Quo(sdkmath.LegacyNewDecFromInt(moneyMarket.ConversionFactor)).Mul(assetPrice) repayTotalUSDValue = repayTotalUSDValue.Add(coinUSDValue) } - // If the proposed repayment would results in a borrowed USD value below the minimum borrow USD value, reject it. + // If the proposed repayment would result in a borrowed USD value below the minimum borrow USD value, reject it. // User can overpay their loan to close it out, but underpaying by such a margin that the USD value is in an // invalid range is not allowed // Unless the user is fully repaying their loan proposedBorrowNewUSDValue := existingBorrowUSDValue.Sub(repayTotalUSDValue) - isFullRepayment := coins.IsEqual(existingBorrow.Amount) + isFullRepayment := coins.Equal(existingBorrow.Amount) if proposedBorrowNewUSDValue.LT(k.GetMinimumBorrowUSDValue(ctx)) && !isFullRepayment { return errorsmod.Wrapf(types.ErrBelowMinimumBorrowValue, "the proposed borrow's USD value $%s is below the minimum borrow limit $%s", proposedBorrowNewUSDValue, k.GetMinimumBorrowUSDValue(ctx)) } diff --git a/x/hard/keeper/repay_test.go b/x/hard/keeper/repay_test.go index 9d9e9e39f8..f5c2273e1c 100644 --- a/x/hard/keeper/repay_test.go +++ b/x/hard/keeper/repay_test.go @@ -39,7 +39,7 @@ func (suite *KeeperTestSuite) TestRepay() { errArgs errArgs } - model := types.NewInterestRateModel(sdk.MustNewDecFromStr("0.05"), sdk.MustNewDecFromStr("2"), sdk.MustNewDecFromStr("0.8"), sdk.MustNewDecFromStr("10")) + model := types.NewInterestRateModel(sdkmath.LegacyMustNewDecFromStr("0.05"), sdkmath.LegacyMustNewDecFromStr("2"), sdkmath.LegacyMustNewDecFromStr("0.8"), sdkmath.LegacyMustNewDecFromStr("10")) testCases := []borrowTest{ { @@ -210,7 +210,7 @@ func (suite *KeeperTestSuite) TestRepay() { suite.Run(tc.name, func() { // Initialize test app and set context tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) // Auth module genesis state addrs, coinses := uniqueAddressCoins( @@ -227,21 +227,21 @@ func (suite *KeeperTestSuite) TestRepay() { hardGS := types.NewGenesisState(types.NewParams( types.MoneyMarkets{ types.NewMoneyMarket("usdx", - types.NewBorrowLimit(false, sdk.NewDec(100000000*USDX_CF), sdk.MustNewDecFromStr("1")), // Borrow Limit - "usdx:usd", // Market ID - sdkmath.NewInt(USDX_CF), // Conversion Factor - model, // Interest Rate Model - sdk.MustNewDecFromStr("0.05"), // Reserve Factor - sdk.MustNewDecFromStr("0.05")), // Keeper Reward Percent + types.NewBorrowLimit(false, sdkmath.LegacyNewDec(100000000*USDX_CF), sdkmath.LegacyMustNewDecFromStr("1")), // Borrow Limit + "usdx:usd", // Market ID + sdkmath.NewInt(USDX_CF), // Conversion Factor + model, // Interest Rate Model + sdkmath.LegacyMustNewDecFromStr("0.05"), // Reserve Factor + sdkmath.LegacyMustNewDecFromStr("0.05")), // Keeper Reward Percent types.NewMoneyMarket("ukava", - types.NewBorrowLimit(false, sdk.NewDec(100000000*KAVA_CF), sdk.MustNewDecFromStr("0.8")), // Borrow Limit - "kava:usd", // Market ID - sdkmath.NewInt(KAVA_CF), // Conversion Factor - model, // Interest Rate Model - sdk.MustNewDecFromStr("0.05"), // Reserve Factor - sdk.MustNewDecFromStr("0.05")), // Keeper Reward Percent + types.NewBorrowLimit(false, sdkmath.LegacyNewDec(100000000*KAVA_CF), sdkmath.LegacyMustNewDecFromStr("0.8")), // Borrow Limit + "kava:usd", // Market ID + sdkmath.NewInt(KAVA_CF), // Conversion Factor + model, // Interest Rate Model + sdkmath.LegacyMustNewDecFromStr("0.05"), // Reserve Factor + sdkmath.LegacyMustNewDecFromStr("0.05")), // Keeper Reward Percent }, - sdk.NewDec(10), + sdkmath.LegacyNewDec(10), ), types.DefaultAccumulationTimes, types.DefaultDeposits, types.DefaultBorrows, types.DefaultTotalSupplied, types.DefaultTotalBorrowed, types.DefaultTotalReserves, ) @@ -258,13 +258,13 @@ func (suite *KeeperTestSuite) TestRepay() { { MarketID: "usdx:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("1.00"), + Price: sdkmath.LegacyMustNewDecFromStr("1.00"), Expiry: time.Now().Add(1 * time.Hour), }, { MarketID: "kava:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("2.00"), + Price: sdkmath.LegacyMustNewDecFromStr("2.00"), Expiry: time.Now().Add(1 * time.Hour), }, }, diff --git a/x/hard/keeper/withdraw_test.go b/x/hard/keeper/withdraw_test.go index 0268283151..a98cb50733 100644 --- a/x/hard/keeper/withdraw_test.go +++ b/x/hard/keeper/withdraw_test.go @@ -117,7 +117,7 @@ func (suite *KeeperTestSuite) TestWithdraw() { // Initialize test app and set context tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) authGS := app.NewFundedGenStateWithCoins( tApp.AppCodec(), []sdk.Coins{sdk.NewCoins( @@ -127,14 +127,14 @@ func (suite *KeeperTestSuite) TestWithdraw() { []sdk.AccAddress{tc.args.depositor}, ) - loanToValue := sdk.MustNewDecFromStr("0.6") + loanToValue := sdkmath.LegacyMustNewDecFromStr("0.6") hardGS := types.NewGenesisState(types.NewParams( types.MoneyMarkets{ - types.NewMoneyMarket("usdx", types.NewBorrowLimit(false, sdk.NewDec(1000000000000000), loanToValue), "usdx:usd", sdkmath.NewInt(1000000), types.NewInterestRateModel(sdk.MustNewDecFromStr("0.05"), sdk.MustNewDecFromStr("2"), sdk.MustNewDecFromStr("0.8"), sdk.MustNewDecFromStr("10")), sdk.MustNewDecFromStr("0.05"), sdk.ZeroDec()), - types.NewMoneyMarket("ukava", types.NewBorrowLimit(false, sdk.NewDec(1000000000000000), loanToValue), "kava:usd", sdkmath.NewInt(1000000), types.NewInterestRateModel(sdk.MustNewDecFromStr("0.05"), sdk.MustNewDecFromStr("2"), sdk.MustNewDecFromStr("0.8"), sdk.MustNewDecFromStr("10")), sdk.MustNewDecFromStr("0.05"), sdk.ZeroDec()), - types.NewMoneyMarket("bnb", types.NewBorrowLimit(false, sdk.NewDec(1000000000000000), loanToValue), "bnb:usd", sdkmath.NewInt(100000000), types.NewInterestRateModel(sdk.MustNewDecFromStr("0.05"), sdk.MustNewDecFromStr("2"), sdk.MustNewDecFromStr("0.8"), sdk.MustNewDecFromStr("10")), sdk.MustNewDecFromStr("0.05"), sdk.ZeroDec()), + types.NewMoneyMarket("usdx", types.NewBorrowLimit(false, sdkmath.LegacyNewDec(1000000000000000), loanToValue), "usdx:usd", sdkmath.NewInt(1000000), types.NewInterestRateModel(sdkmath.LegacyMustNewDecFromStr("0.05"), sdkmath.LegacyMustNewDecFromStr("2"), sdkmath.LegacyMustNewDecFromStr("0.8"), sdkmath.LegacyMustNewDecFromStr("10")), sdkmath.LegacyMustNewDecFromStr("0.05"), sdkmath.LegacyZeroDec()), + types.NewMoneyMarket("ukava", types.NewBorrowLimit(false, sdkmath.LegacyNewDec(1000000000000000), loanToValue), "kava:usd", sdkmath.NewInt(1000000), types.NewInterestRateModel(sdkmath.LegacyMustNewDecFromStr("0.05"), sdkmath.LegacyMustNewDecFromStr("2"), sdkmath.LegacyMustNewDecFromStr("0.8"), sdkmath.LegacyMustNewDecFromStr("10")), sdkmath.LegacyMustNewDecFromStr("0.05"), sdkmath.LegacyZeroDec()), + types.NewMoneyMarket("bnb", types.NewBorrowLimit(false, sdkmath.LegacyNewDec(1000000000000000), loanToValue), "bnb:usd", sdkmath.NewInt(100000000), types.NewInterestRateModel(sdkmath.LegacyMustNewDecFromStr("0.05"), sdkmath.LegacyMustNewDecFromStr("2"), sdkmath.LegacyMustNewDecFromStr("0.8"), sdkmath.LegacyMustNewDecFromStr("10")), sdkmath.LegacyMustNewDecFromStr("0.05"), sdkmath.LegacyZeroDec()), }, - sdk.NewDec(10), + sdkmath.LegacyNewDec(10), ), types.DefaultAccumulationTimes, types.DefaultDeposits, types.DefaultBorrows, types.DefaultTotalSupplied, types.DefaultTotalBorrowed, types.DefaultTotalReserves, ) @@ -152,19 +152,19 @@ func (suite *KeeperTestSuite) TestWithdraw() { { MarketID: "usdx:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("1.00"), + Price: sdkmath.LegacyMustNewDecFromStr("1.00"), Expiry: time.Now().Add(100 * time.Hour), }, { MarketID: "kava:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("2.00"), + Price: sdkmath.LegacyMustNewDecFromStr("2.00"), Expiry: time.Now().Add(100 * time.Hour), }, { MarketID: "bnb:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("10.00"), + Price: sdkmath.LegacyMustNewDecFromStr("10.00"), Expiry: time.Now().Add(100 * time.Hour), }, }, @@ -234,8 +234,8 @@ func (suite *KeeperTestSuite) TestLtvWithdraw() { } // Set up test constants - model := types.NewInterestRateModel(sdk.MustNewDecFromStr("0"), sdk.MustNewDecFromStr("0.1"), sdk.MustNewDecFromStr("0.8"), sdk.MustNewDecFromStr("0.5")) - reserveFactor := sdk.MustNewDecFromStr("0.05") + model := types.NewInterestRateModel(sdkmath.LegacyMustNewDecFromStr("0"), sdkmath.LegacyMustNewDecFromStr("0.1"), sdkmath.LegacyMustNewDecFromStr("0.8"), sdkmath.LegacyMustNewDecFromStr("0.5")) + reserveFactor := sdkmath.LegacyMustNewDecFromStr("0.05") oneMonthInSeconds := int64(2592000) borrower := sdk.AccAddress(crypto.AddressHash([]byte("testborrower"))) @@ -262,7 +262,7 @@ func (suite *KeeperTestSuite) TestLtvWithdraw() { suite.Run(tc.name, func() { // Initialize test app and set context tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) // Auth module genesis state authGS := app.NewFundedGenStateWithCoins( @@ -275,21 +275,21 @@ func (suite *KeeperTestSuite) TestLtvWithdraw() { harvestGS := types.NewGenesisState(types.NewParams( types.MoneyMarkets{ types.NewMoneyMarket("ukava", - types.NewBorrowLimit(false, sdk.NewDec(100000000*KAVA_CF), sdk.MustNewDecFromStr("0.8")), // Borrow Limit - "kava:usd", // Market ID - sdkmath.NewInt(KAVA_CF), // Conversion Factor - model, // Interest Rate Model - reserveFactor, // Reserve Factor - sdk.MustNewDecFromStr("0.05")), // Keeper Reward Percent + types.NewBorrowLimit(false, sdkmath.LegacyNewDec(100000000*KAVA_CF), sdkmath.LegacyMustNewDecFromStr("0.8")), // Borrow Limit + "kava:usd", // Market ID + sdkmath.NewInt(KAVA_CF), // Conversion Factor + model, // Interest Rate Model + reserveFactor, // Reserve Factor + sdkmath.LegacyMustNewDecFromStr("0.05")), // Keeper Reward Percent types.NewMoneyMarket("usdx", - types.NewBorrowLimit(false, sdk.NewDec(100000000*KAVA_CF), sdk.MustNewDecFromStr("0.8")), // Borrow Limit - "usdx:usd", // Market ID - sdkmath.NewInt(KAVA_CF), // Conversion Factor - model, // Interest Rate Model - reserveFactor, // Reserve Factor - sdk.MustNewDecFromStr("0.05")), // Keeper Reward Percent + types.NewBorrowLimit(false, sdkmath.LegacyNewDec(100000000*KAVA_CF), sdkmath.LegacyMustNewDecFromStr("0.8")), // Borrow Limit + "usdx:usd", // Market ID + sdkmath.NewInt(KAVA_CF), // Conversion Factor + model, // Interest Rate Model + reserveFactor, // Reserve Factor + sdkmath.LegacyMustNewDecFromStr("0.05")), // Keeper Reward Percent }, - sdk.NewDec(10), + sdkmath.LegacyNewDec(10), ), types.DefaultAccumulationTimes, types.DefaultDeposits, types.DefaultBorrows, types.DefaultTotalSupplied, types.DefaultTotalBorrowed, types.DefaultTotalReserves, ) @@ -306,13 +306,13 @@ func (suite *KeeperTestSuite) TestLtvWithdraw() { { MarketID: "usdx:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("1.00"), + Price: sdkmath.LegacyMustNewDecFromStr("1.00"), Expiry: time.Now().Add(100 * time.Hour), }, { MarketID: "kava:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("2.00"), + Price: sdkmath.LegacyMustNewDecFromStr("2.00"), Expiry: time.Now().Add(100 * time.Hour), }, }, @@ -348,7 +348,7 @@ func (suite *KeeperTestSuite) TestLtvWithdraw() { suite.Require().NoError(err) // Attempting to withdraw fails - err = suite.keeper.Withdraw(suite.ctx, tc.args.borrower, sdk.NewCoins(sdk.NewCoin("ukava", sdk.OneInt()))) + err = suite.keeper.Withdraw(suite.ctx, tc.args.borrower, sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.OneInt()))) suite.Require().Error(err) suite.Require().True(strings.Contains(err.Error(), tc.errArgs.contains)) @@ -358,7 +358,7 @@ func (suite *KeeperTestSuite) TestLtvWithdraw() { hard.BeginBlocker(liqCtx, suite.keeper) // Attempted withdraw of 1 coin still fails - err = suite.keeper.Withdraw(suite.ctx, tc.args.borrower, sdk.NewCoins(sdk.NewCoin("ukava", sdk.OneInt()))) + err = suite.keeper.Withdraw(suite.ctx, tc.args.borrower, sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.OneInt()))) suite.Require().Error(err) suite.Require().True(strings.Contains(err.Error(), tc.errArgs.contains)) diff --git a/x/hard/legacy/v0_15/types.go b/x/hard/legacy/v0_15/types.go index bfdfd85db8..9505c64d94 100644 --- a/x/hard/legacy/v0_15/types.go +++ b/x/hard/legacy/v0_15/types.go @@ -25,8 +25,8 @@ type GenesisState struct { // Params governance parameters for hard module type Params struct { - MoneyMarkets MoneyMarkets `json:"money_markets" yaml:"money_markets"` - MinimumBorrowUSDValue sdk.Dec `json:"minimum_borrow_usd_value" yaml:"minimum_borrow_usd_value"` + MoneyMarkets MoneyMarkets `json:"money_markets" yaml:"money_markets"` + MinimumBorrowUSDValue sdkmath.LegacyDec `json:"minimum_borrow_usd_value" yaml:"minimum_borrow_usd_value"` } // MoneyMarkets slice of MoneyMarket @@ -39,23 +39,23 @@ type MoneyMarket struct { SpotMarketID string `json:"spot_market_id" yaml:"spot_market_id"` ConversionFactor sdkmath.Int `json:"conversion_factor" yaml:"conversion_factor"` InterestRateModel InterestRateModel `json:"interest_rate_model" yaml:"interest_rate_model"` - ReserveFactor sdk.Dec `json:"reserve_factor" yaml:"reserve_factor"` - KeeperRewardPercentage sdk.Dec `json:"keeper_reward_percentage" yaml:"keeper_reward_percentages"` + ReserveFactor sdkmath.LegacyDec `json:"reserve_factor" yaml:"reserve_factor"` + KeeperRewardPercentage sdkmath.LegacyDec `json:"keeper_reward_percentage" yaml:"keeper_reward_percentages"` } // BorrowLimit enforces restrictions on a money market type BorrowLimit struct { - HasMaxLimit bool `json:"has_max_limit" yaml:"has_max_limit"` - MaximumLimit sdk.Dec `json:"maximum_limit" yaml:"maximum_limit"` - LoanToValue sdk.Dec `json:"loan_to_value" yaml:"loan_to_value"` + HasMaxLimit bool `json:"has_max_limit" yaml:"has_max_limit"` + MaximumLimit sdkmath.LegacyDec `json:"maximum_limit" yaml:"maximum_limit"` + LoanToValue sdkmath.LegacyDec `json:"loan_to_value" yaml:"loan_to_value"` } // InterestRateModel contains information about an asset's interest rate type InterestRateModel struct { - BaseRateAPY sdk.Dec `json:"base_rate_apy" yaml:"base_rate_apy"` - BaseMultiplier sdk.Dec `json:"base_multiplier" yaml:"base_multiplier"` - Kink sdk.Dec `json:"kink" yaml:"kink"` - JumpMultiplier sdk.Dec `json:"jump_multiplier" yaml:"jump_multiplier"` + BaseRateAPY sdkmath.LegacyDec `json:"base_rate_apy" yaml:"base_rate_apy"` + BaseMultiplier sdkmath.LegacyDec `json:"base_multiplier" yaml:"base_multiplier"` + Kink sdkmath.LegacyDec `json:"kink" yaml:"kink"` + JumpMultiplier sdkmath.LegacyDec `json:"jump_multiplier" yaml:"jump_multiplier"` } // GenesisAccumulationTimes slice of GenesisAccumulationTime @@ -63,10 +63,10 @@ type GenesisAccumulationTimes []GenesisAccumulationTime // GenesisAccumulationTime stores the previous distribution time and its corresponding denom type GenesisAccumulationTime struct { - CollateralType string `json:"collateral_type" yaml:"collateral_type"` - PreviousAccumulationTime time.Time `json:"previous_accumulation_time" yaml:"previous_accumulation_time"` - SupplyInterestFactor sdk.Dec `json:"supply_interest_factor" yaml:"supply_interest_factor"` - BorrowInterestFactor sdk.Dec `json:"borrow_interest_factor" yaml:"borrow_interest_factor"` + CollateralType string `json:"collateral_type" yaml:"collateral_type"` + PreviousAccumulationTime time.Time `json:"previous_accumulation_time" yaml:"previous_accumulation_time"` + SupplyInterestFactor sdkmath.LegacyDec `json:"supply_interest_factor" yaml:"supply_interest_factor"` + BorrowInterestFactor sdkmath.LegacyDec `json:"borrow_interest_factor" yaml:"borrow_interest_factor"` } // Deposits is a slice of Deposit @@ -84,8 +84,8 @@ type SupplyInterestFactors []SupplyInterestFactor // SupplyInterestFactor defines an individual borrow interest factor type SupplyInterestFactor struct { - Denom string `json:"denom" yaml:"denom"` - Value sdk.Dec `json:"value" yaml:"value"` + Denom string `json:"denom" yaml:"denom"` + Value sdkmath.LegacyDec `json:"value" yaml:"value"` } // Borrows is a slice of Borrow @@ -103,6 +103,6 @@ type BorrowInterestFactors []BorrowInterestFactor // BorrowInterestFactor defines an individual borrow interest factor type BorrowInterestFactor struct { - Denom string `json:"denom" yaml:"denom"` - Value sdk.Dec `json:"value" yaml:"value"` + Denom string `json:"denom" yaml:"denom"` + Value sdkmath.LegacyDec `json:"value" yaml:"value"` } diff --git a/x/hard/legacy/v0_16/migrate.go b/x/hard/legacy/v0_16/migrate.go index cc4fbdd7d5..3b1351e0e1 100644 --- a/x/hard/legacy/v0_16/migrate.go +++ b/x/hard/legacy/v0_16/migrate.go @@ -2,8 +2,6 @@ package v0_16 import ( sdkmath "cosmossdk.io/math" - sdk "github.com/cosmos/cosmos-sdk/types" - v015hard "github.com/kava-labs/kava/x/hard/legacy/v0_15" v016hard "github.com/kava-labs/kava/x/hard/types" ) @@ -39,19 +37,19 @@ func migrateParams(params v015hard.Params) v016hard.Params { Denom: UATOM_IBC_DENOM, BorrowLimit: v016hard.BorrowLimit{ HasMaxLimit: true, - MaximumLimit: sdk.NewDec(25000000000), - LoanToValue: sdk.MustNewDecFromStr("0.5"), + MaximumLimit: sdkmath.LegacyNewDec(25000000000), + LoanToValue: sdkmath.LegacyMustNewDecFromStr("0.5"), }, SpotMarketID: "atom:usd:30", ConversionFactor: sdkmath.NewInt(1000000), InterestRateModel: v016hard.InterestRateModel{ - BaseRateAPY: sdk.ZeroDec(), - BaseMultiplier: sdk.MustNewDecFromStr("0.05"), - Kink: sdk.MustNewDecFromStr("0.8"), - JumpMultiplier: sdk.NewDec(5), + BaseRateAPY: sdkmath.LegacyZeroDec(), + BaseMultiplier: sdkmath.LegacyMustNewDecFromStr("0.05"), + Kink: sdkmath.LegacyMustNewDecFromStr("0.8"), + JumpMultiplier: sdkmath.LegacyNewDec(5), }, - ReserveFactor: sdk.MustNewDecFromStr("0.025"), - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.02"), + ReserveFactor: sdkmath.LegacyMustNewDecFromStr("0.025"), + KeeperRewardPercentage: sdkmath.LegacyMustNewDecFromStr("0.02"), } moneyMarkets = append(moneyMarkets, atomMoneyMarket) diff --git a/x/hard/legacy/v0_16/migrate_test.go b/x/hard/legacy/v0_16/migrate_test.go index b15c1b6ef1..fa23918d3f 100644 --- a/x/hard/legacy/v0_16/migrate_test.go +++ b/x/hard/legacy/v0_16/migrate_test.go @@ -60,19 +60,19 @@ func (s *migrateTestSuite) TestMigrate_GenState() { Denom: "kava", BorrowLimit: v015hard.BorrowLimit{ HasMaxLimit: true, - MaximumLimit: sdk.MustNewDecFromStr("0.1"), - LoanToValue: sdk.MustNewDecFromStr("0.2"), + MaximumLimit: sdkmath.LegacyMustNewDecFromStr("0.1"), + LoanToValue: sdkmath.LegacyMustNewDecFromStr("0.2"), }, SpotMarketID: "spot-market-id", ConversionFactor: sdkmath.NewInt(110), InterestRateModel: v015hard.InterestRateModel{ - BaseRateAPY: sdk.MustNewDecFromStr("0.1"), - BaseMultiplier: sdk.MustNewDecFromStr("0.2"), - Kink: sdk.MustNewDecFromStr("0.3"), - JumpMultiplier: sdk.MustNewDecFromStr("0.4"), + BaseRateAPY: sdkmath.LegacyMustNewDecFromStr("0.1"), + BaseMultiplier: sdkmath.LegacyMustNewDecFromStr("0.2"), + Kink: sdkmath.LegacyMustNewDecFromStr("0.3"), + JumpMultiplier: sdkmath.LegacyMustNewDecFromStr("0.4"), }, - ReserveFactor: sdk.MustNewDecFromStr("0.5"), - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.6"), + ReserveFactor: sdkmath.LegacyMustNewDecFromStr("0.5"), + KeeperRewardPercentage: sdkmath.LegacyMustNewDecFromStr("0.6"), }, }, }, @@ -80,8 +80,8 @@ func (s *migrateTestSuite) TestMigrate_GenState() { { CollateralType: "kava", PreviousAccumulationTime: time.Date(1998, time.January, 1, 12, 0, 0, 1, time.UTC), - SupplyInterestFactor: sdk.MustNewDecFromStr("0.1"), - BorrowInterestFactor: sdk.MustNewDecFromStr("0.2"), + SupplyInterestFactor: sdkmath.LegacyMustNewDecFromStr("0.1"), + BorrowInterestFactor: sdkmath.LegacyMustNewDecFromStr("0.2"), }, }, Deposits: v015hard.Deposits{ @@ -91,7 +91,7 @@ func (s *migrateTestSuite) TestMigrate_GenState() { Index: v015hard.SupplyInterestFactors{ { Denom: "kava", - Value: sdk.MustNewDecFromStr("1.12"), + Value: sdkmath.LegacyMustNewDecFromStr("1.12"), }, }, }, @@ -103,7 +103,7 @@ func (s *migrateTestSuite) TestMigrate_GenState() { Index: v015hard.BorrowInterestFactors{ { Denom: "kava", - Value: sdk.MustNewDecFromStr("1.12"), + Value: sdkmath.LegacyMustNewDecFromStr("1.12"), }, }, }, @@ -119,37 +119,37 @@ func (s *migrateTestSuite) TestMigrate_GenState() { Denom: "kava", BorrowLimit: v016hard.BorrowLimit{ HasMaxLimit: true, - MaximumLimit: sdk.MustNewDecFromStr("0.1"), - LoanToValue: sdk.MustNewDecFromStr("0.2"), + MaximumLimit: sdkmath.LegacyMustNewDecFromStr("0.1"), + LoanToValue: sdkmath.LegacyMustNewDecFromStr("0.2"), }, SpotMarketID: "spot-market-id", ConversionFactor: sdkmath.NewInt(110), InterestRateModel: v016hard.InterestRateModel{ - BaseRateAPY: sdk.MustNewDecFromStr("0.1"), - BaseMultiplier: sdk.MustNewDecFromStr("0.2"), - Kink: sdk.MustNewDecFromStr("0.3"), - JumpMultiplier: sdk.MustNewDecFromStr("0.4"), + BaseRateAPY: sdkmath.LegacyMustNewDecFromStr("0.1"), + BaseMultiplier: sdkmath.LegacyMustNewDecFromStr("0.2"), + Kink: sdkmath.LegacyMustNewDecFromStr("0.3"), + JumpMultiplier: sdkmath.LegacyMustNewDecFromStr("0.4"), }, - ReserveFactor: sdk.MustNewDecFromStr("0.5"), - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.6"), + ReserveFactor: sdkmath.LegacyMustNewDecFromStr("0.5"), + KeeperRewardPercentage: sdkmath.LegacyMustNewDecFromStr("0.6"), }, { Denom: UATOM_IBC_DENOM, BorrowLimit: v016hard.BorrowLimit{ HasMaxLimit: true, - MaximumLimit: sdk.NewDec(25000000000), - LoanToValue: sdk.MustNewDecFromStr("0.5"), + MaximumLimit: sdkmath.LegacyNewDec(25000000000), + LoanToValue: sdkmath.LegacyMustNewDecFromStr("0.5"), }, SpotMarketID: "atom:usd:30", ConversionFactor: sdkmath.NewInt(1000000), InterestRateModel: v016hard.InterestRateModel{ - BaseRateAPY: sdk.ZeroDec(), - BaseMultiplier: sdk.MustNewDecFromStr("0.05"), - Kink: sdk.MustNewDecFromStr("0.8"), - JumpMultiplier: sdk.NewDec(5), + BaseRateAPY: sdkmath.LegacyZeroDec(), + BaseMultiplier: sdkmath.LegacyMustNewDecFromStr("0.05"), + Kink: sdkmath.LegacyMustNewDecFromStr("0.8"), + JumpMultiplier: sdkmath.LegacyNewDec(5), }, - ReserveFactor: sdk.MustNewDecFromStr("0.025"), - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.02"), + ReserveFactor: sdkmath.LegacyMustNewDecFromStr("0.025"), + KeeperRewardPercentage: sdkmath.LegacyMustNewDecFromStr("0.02"), }, }, }, @@ -157,8 +157,8 @@ func (s *migrateTestSuite) TestMigrate_GenState() { { CollateralType: "kava", PreviousAccumulationTime: time.Date(1998, time.January, 1, 12, 0, 0, 1, time.UTC), - SupplyInterestFactor: sdk.MustNewDecFromStr("0.1"), - BorrowInterestFactor: sdk.MustNewDecFromStr("0.2"), + SupplyInterestFactor: sdkmath.LegacyMustNewDecFromStr("0.1"), + BorrowInterestFactor: sdkmath.LegacyMustNewDecFromStr("0.2"), }, }, Deposits: v016hard.Deposits{ @@ -168,7 +168,7 @@ func (s *migrateTestSuite) TestMigrate_GenState() { Index: v016hard.SupplyInterestFactors{ { Denom: "kava", - Value: sdk.MustNewDecFromStr("1.12"), + Value: sdkmath.LegacyMustNewDecFromStr("1.12"), }, }, }, @@ -180,7 +180,7 @@ func (s *migrateTestSuite) TestMigrate_GenState() { Index: v016hard.BorrowInterestFactors{ { Denom: "kava", - Value: sdk.MustNewDecFromStr("1.12"), + Value: sdkmath.LegacyMustNewDecFromStr("1.12"), }, }, }, diff --git a/x/hard/module.go b/x/hard/module.go index 952ff860a9..09bea02a28 100644 --- a/x/hard/module.go +++ b/x/hard/module.go @@ -138,11 +138,17 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw } // BeginBlock module begin-block -func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) { +func (am AppModule) BeginBlock(ctx sdk.Context) error { BeginBlocker(ctx, am.keeper) + + return nil } // EndBlock module end-block -func (am AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { - return []abci.ValidatorUpdate{} +func (am AppModule) EndBlock(_ sdk.Context) ([]abci.ValidatorUpdate, error) { + return []abci.ValidatorUpdate{}, nil } + +func (AppModule) IsOnePerModuleType() {} + +func (AppModule) IsAppModule() {} diff --git a/x/hard/spec/02_state.md b/x/hard/spec/02_state.md index 0bc73e70ff..01083e38e9 100644 --- a/x/hard/spec/02_state.md +++ b/x/hard/spec/02_state.md @@ -18,7 +18,7 @@ Without financial incentives, borrowers and suppliers will withdraw their funds // Params governance parameters for hard module type Params struct { MoneyMarkets MoneyMarkets `json:"money_markets" yaml:"money_markets"` - MinimumBorrowUSDValue sdk.Dec `json:"minimum_borrow_usd_value" yaml:"minimum_borrow_usd_value"` + MinimumBorrowUSDValue sdkmath.LegacyDec `json:"minimum_borrow_usd_value" yaml:"minimum_borrow_usd_value"` } // MoneyMarket is a money market for an individual asset @@ -28,8 +28,8 @@ type MoneyMarket struct { SpotMarketID string `json:"spot_market_id" yaml:"spot_market_id"` // the pricefeed market where price data is fetched ConversionFactor sdkmath.Int `json:"conversion_factor" yaml:"conversion_factor"` //the internal conversion factor for going from the smallest unit of a token to a whole unit (ie. 8 for BTC, 6 for KAVA, 18 for ETH) InterestRateModel InterestRateModel `json:"interest_rate_model" yaml:"interest_rate_model"` // the model that determines the prevailing interest rate at each block - ReserveFactor sdk.Dec `json:"reserve_factor" yaml:"reserve_factor"` // the percentage of interest that is accumulated by the protocol as reserves - KeeperRewardPercentage sdk.Dec `json:"keeper_reward_percentage" yaml:"keeper_reward_percentages"` // the percentage of a liquidation that is given to the keeper that liquidated the position + ReserveFactor sdkmath.LegacyDec `json:"reserve_factor" yaml:"reserve_factor"` // the percentage of interest that is accumulated by the protocol as reserves + KeeperRewardPercentage sdkmath.LegacyDec `json:"keeper_reward_percentage" yaml:"keeper_reward_percentages"` // the percentage of a liquidation that is given to the keeper that liquidated the position } // MoneyMarkets slice of MoneyMarket @@ -37,17 +37,17 @@ type MoneyMarkets []MoneyMarket // InterestRateModel contains information about an asset's interest rate type InterestRateModel struct { - BaseRateAPY sdk.Dec `json:"base_rate_apy" yaml:"base_rate_apy"` // the base rate of APY when borrows are zero. Ex. A value of "0.02" would signify an interest rate of 2% APY as the Y-intercept of the interest rate model for the money market. Note that internally, interest rates are stored as per-second interest. - BaseMultiplier sdk.Dec `json:"base_multiplier" yaml:"base_multiplier"` // the percentage rate at which the interest rate APY increases for each percentage increase in borrow utilization. Ex. A value of "0.01" signifies that the APY interest rate increases by 1% for each additional percentage increase in borrow utilization. - Kink sdk.Dec `json:"kink" yaml:"kink"` // the inflection point at which the BaseMultiplier no longer applies and the JumpMultiplier does apply. For example, a value of "0.8" signifies that at 80% utilization, the JumpMultiplier applies - JumpMultiplier sdk.Dec `json:"jump_multiplier" yaml:"jump_multiplier"` // same as BaseMultiplier, but only applied when utilization is above the Kink + BaseRateAPY sdkmath.LegacyDec `json:"base_rate_apy" yaml:"base_rate_apy"` // the base rate of APY when borrows are zero. Ex. A value of "0.02" would signify an interest rate of 2% APY as the Y-intercept of the interest rate model for the money market. Note that internally, interest rates are stored as per-second interest. + BaseMultiplier sdkmath.LegacyDec `json:"base_multiplier" yaml:"base_multiplier"` // the percentage rate at which the interest rate APY increases for each percentage increase in borrow utilization. Ex. A value of "0.01" signifies that the APY interest rate increases by 1% for each additional percentage increase in borrow utilization. + Kink sdkmath.LegacyDec `json:"kink" yaml:"kink"` // the inflection point at which the BaseMultiplier no longer applies and the JumpMultiplier does apply. For example, a value of "0.8" signifies that at 80% utilization, the JumpMultiplier applies + JumpMultiplier sdkmath.LegacyDec `json:"jump_multiplier" yaml:"jump_multiplier"` // same as BaseMultiplier, but only applied when utilization is above the Kink } // BorrowLimit enforces restrictions on a money market type BorrowLimit struct { HasMaxLimit bool `json:"has_max_limit" yaml:"has_max_limit"` // boolean for if the money market has a max amount that can be borrowed, irrespective of utilization. - MaximumLimit sdk.Dec `json:"maximum_limit" yaml:"maximum_limit"` // the maximum amount that can be borrowed for this money market, irrespective of utilization. Ignored if HasMaxLimit is false - LoanToValue sdk.Dec `json:"loan_to_value" yaml:"loan_to_value"` // the percentage amount of borrow power each unit of deposit accounts for. Ex. A value of "0.5" signifies that for $1 of supply of a particular asset, borrow limits will be increased by $0.5 + MaximumLimit sdkmath.LegacyDec `json:"maximum_limit" yaml:"maximum_limit"` // the maximum amount that can be borrowed for this money market, irrespective of utilization. Ignored if HasMaxLimit is false + LoanToValue sdkmath.LegacyDec `json:"loan_to_value" yaml:"loan_to_value"` // the percentage amount of borrow power each unit of deposit accounts for. Ex. A value of "0.5" signifies that for $1 of supply of a particular asset, borrow limits will be increased by $0.5 } ``` diff --git a/x/hard/spec/05_params.md b/x/hard/spec/05_params.md index 6f4ad2c520..ff5843593e 100644 --- a/x/hard/spec/05_params.md +++ b/x/hard/spec/05_params.md @@ -9,7 +9,7 @@ Example parameters for the Hard module: | Key | Type | Example | Description | | --------------------- | ------------------- | ------------- | -------------------------------------------- | | MoneyMarkets | array (MoneyMarket) | [{see below}] | Array of params for each supported market | -| MinimumBorrowUSDValue | sdk.Dec | 10.0 | Minimum amount an individual user can borrow | +| MinimumBorrowUSDValue | sdkmath.LegacyDec | 10.0 | Minimum amount an individual user can borrow | Example parameters for `MoneyMarket`: diff --git a/x/hard/types/borrow.go b/x/hard/types/borrow.go index 5c395610ea..0efa80910a 100644 --- a/x/hard/types/borrow.go +++ b/x/hard/types/borrow.go @@ -1,6 +1,7 @@ package types import ( + sdkmath "cosmossdk.io/math" "fmt" "strings" @@ -31,14 +32,14 @@ func (b Borrow) NormalizedBorrow() (sdk.DecCoins, error) { if !found { return nil, fmt.Errorf("borrowed amount '%s' missing interest factor", coin.Denom) } - if factor.LT(sdk.OneDec()) { + if factor.LT(sdkmath.LegacyOneDec()) { return nil, fmt.Errorf("interest factor '%s' < 1", coin.Denom) } normalized = normalized.Add( sdk.NewDecCoinFromDec( coin.Denom, - sdk.NewDecFromInt(coin.Amount).Quo(factor), + sdkmath.LegacyNewDecFromInt(coin.Amount).Quo(factor), ), ) } @@ -108,7 +109,7 @@ func NewBorrowResponse(borrower sdk.AccAddress, amount sdk.Coins, index BorrowIn type BorrowResponses []BorrowResponse // NewBorrowInterestFactor returns a new BorrowInterestFactor instance -func NewBorrowInterestFactor(denom string, value sdk.Dec) BorrowInterestFactor { +func NewBorrowInterestFactor(denom string, value sdkmath.LegacyDec) BorrowInterestFactor { return BorrowInterestFactor{ Denom: denom, Value: value, @@ -132,7 +133,7 @@ func (bif BorrowInterestFactor) ToResponse() BorrowInterestFactorResponse { } // NewBorrowInterestFactorResponse returns a new BorrowInterestFactorResponse instance -func NewBorrowInterestFactorResponse(denom string, value sdk.Dec) BorrowInterestFactorResponse { +func NewBorrowInterestFactorResponse(denom string, value sdkmath.LegacyDec) BorrowInterestFactorResponse { return BorrowInterestFactorResponse{ Denom: denom, Value: value.String(), @@ -143,17 +144,17 @@ func NewBorrowInterestFactorResponse(denom string, value sdk.Dec) BorrowInterest type BorrowInterestFactors []BorrowInterestFactor // GetInterestFactor returns a denom's interest factor value -func (bifs BorrowInterestFactors) GetInterestFactor(denom string) (sdk.Dec, bool) { +func (bifs BorrowInterestFactors) GetInterestFactor(denom string) (sdkmath.LegacyDec, bool) { for _, bif := range bifs { if bif.Denom == denom { return bif.Value, true } } - return sdk.ZeroDec(), false + return sdkmath.LegacyZeroDec(), false } // SetInterestFactor sets a denom's interest factor value -func (bifs BorrowInterestFactors) SetInterestFactor(denom string, factor sdk.Dec) BorrowInterestFactors { +func (bifs BorrowInterestFactors) SetInterestFactor(denom string, factor sdkmath.LegacyDec) BorrowInterestFactors { for i, bif := range bifs { if bif.Denom == denom { bif.Value = factor diff --git a/x/hard/types/borrow_test.go b/x/hard/types/borrow_test.go index 107bf1f2cf..0f96074a14 100644 --- a/x/hard/types/borrow_test.go +++ b/x/hard/types/borrow_test.go @@ -26,11 +26,11 @@ func TestBorrow_NormalizedBorrow(t *testing.T) { Index: types.BorrowInterestFactors{ { Denom: "xrpb", - Value: sdk.MustNewDecFromStr("1.25"), + Value: sdkmath.LegacyMustNewDecFromStr("1.25"), }, { Denom: "bnb", - Value: sdk.MustNewDecFromStr("2.0"), + Value: sdkmath.LegacyMustNewDecFromStr("2.0"), }, }, }, @@ -64,7 +64,7 @@ func TestBorrow_NormalizedBorrow(t *testing.T) { Index: types.BorrowInterestFactors{ { Denom: "xrpb", - Value: sdk.MustNewDecFromStr("1.25"), + Value: sdkmath.LegacyMustNewDecFromStr("1.25"), }, }, }, @@ -79,7 +79,7 @@ func TestBorrow_NormalizedBorrow(t *testing.T) { Index: types.BorrowInterestFactors{ { Denom: "bnb", - Value: sdk.MustNewDecFromStr("0.999999999999999999"), + Value: sdkmath.LegacyMustNewDecFromStr("0.999999999999999999"), }, }, }, @@ -94,7 +94,7 @@ func TestBorrow_NormalizedBorrow(t *testing.T) { Index: types.BorrowInterestFactors{ { Denom: "bnb", - Value: sdk.MustNewDecFromStr("0"), + Value: sdkmath.LegacyMustNewDecFromStr("0"), }, }, }, diff --git a/x/hard/types/codec.go b/x/hard/types/codec.go index 44c19da443..8566989685 100644 --- a/x/hard/types/codec.go +++ b/x/hard/types/codec.go @@ -6,7 +6,6 @@ import ( cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/msgservice" - authzcodec "github.com/cosmos/cosmos-sdk/x/authz/codec" ) func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { @@ -40,5 +39,5 @@ func init() { // Register all Amino interfaces and concrete types on the authz Amino codec so that this can later be // used to properly serialize MsgGrant and MsgExec instances - RegisterLegacyAminoCodec(authzcodec.Amino) + RegisterLegacyAminoCodec(codec.NewLegacyAmino()) } diff --git a/x/hard/types/deposit.go b/x/hard/types/deposit.go index f73c4dd57d..cafc589992 100644 --- a/x/hard/types/deposit.go +++ b/x/hard/types/deposit.go @@ -1,6 +1,7 @@ package types import ( + sdkmath "cosmossdk.io/math" "fmt" "strings" @@ -31,14 +32,14 @@ func (b Deposit) NormalizedDeposit() (sdk.DecCoins, error) { if !found { return nil, fmt.Errorf("deposited amount '%s' missing interest factor", coin.Denom) } - if factor.LT(sdk.OneDec()) { + if factor.LT(sdkmath.LegacyOneDec()) { return nil, fmt.Errorf("interest factor '%s' < 1", coin.Denom) } normalized = normalized.Add( sdk.NewDecCoinFromDec( coin.Denom, - sdk.NewDecFromInt(coin.Amount).Quo(factor), + sdkmath.LegacyNewDecFromInt(coin.Amount).Quo(factor), ), ) } @@ -108,7 +109,7 @@ func NewDepositResponse(depositor sdk.AccAddress, amount sdk.Coins, indexes Supp type DepositResponses []DepositResponse // NewSupplyInterestFactor returns a new SupplyInterestFactor instance -func NewSupplyInterestFactor(denom string, value sdk.Dec) SupplyInterestFactor { +func NewSupplyInterestFactor(denom string, value sdkmath.LegacyDec) SupplyInterestFactor { return SupplyInterestFactor{ Denom: denom, Value: value, @@ -132,7 +133,7 @@ func (sif SupplyInterestFactor) ToResponse() SupplyInterestFactorResponse { } // NewSupplyInterestFactorResponse returns a new SupplyInterestFactorResponse instance -func NewSupplyInterestFactorResponse(denom string, value sdk.Dec) SupplyInterestFactorResponse { +func NewSupplyInterestFactorResponse(denom string, value sdkmath.LegacyDec) SupplyInterestFactorResponse { return SupplyInterestFactorResponse{ Denom: denom, Value: value.String(), @@ -143,17 +144,17 @@ func NewSupplyInterestFactorResponse(denom string, value sdk.Dec) SupplyInterest type SupplyInterestFactors []SupplyInterestFactor // GetInterestFactor returns a denom's interest factor value -func (sifs SupplyInterestFactors) GetInterestFactor(denom string) (sdk.Dec, bool) { +func (sifs SupplyInterestFactors) GetInterestFactor(denom string) (sdkmath.LegacyDec, bool) { for _, sif := range sifs { if sif.Denom == denom { return sif.Value, true } } - return sdk.ZeroDec(), false + return sdkmath.LegacyZeroDec(), false } // SetInterestFactor sets a denom's interest factor value -func (sifs SupplyInterestFactors) SetInterestFactor(denom string, factor sdk.Dec) SupplyInterestFactors { +func (sifs SupplyInterestFactors) SetInterestFactor(denom string, factor sdkmath.LegacyDec) SupplyInterestFactors { for i, sif := range sifs { if sif.Denom == denom { sif.Value = factor diff --git a/x/hard/types/deposit_test.go b/x/hard/types/deposit_test.go index 7776fb4076..856bb3d30e 100644 --- a/x/hard/types/deposit_test.go +++ b/x/hard/types/deposit_test.go @@ -26,11 +26,11 @@ func TestDeposit_NormalizedDeposit(t *testing.T) { Index: types.SupplyInterestFactors{ { Denom: "xrpb", - Value: sdk.MustNewDecFromStr("1.25"), + Value: sdkmath.LegacyMustNewDecFromStr("1.25"), }, { Denom: "bnb", - Value: sdk.MustNewDecFromStr("2.0"), + Value: sdkmath.LegacyMustNewDecFromStr("2.0"), }, }, }, @@ -64,7 +64,7 @@ func TestDeposit_NormalizedDeposit(t *testing.T) { Index: types.SupplyInterestFactors{ { Denom: "xrpb", - Value: sdk.MustNewDecFromStr("1.25"), + Value: sdkmath.LegacyMustNewDecFromStr("1.25"), }, }, }, @@ -79,7 +79,7 @@ func TestDeposit_NormalizedDeposit(t *testing.T) { Index: types.SupplyInterestFactors{ { Denom: "bnb", - Value: sdk.MustNewDecFromStr("0.999999999999999999"), + Value: sdkmath.LegacyMustNewDecFromStr("0.999999999999999999"), }, }, }, @@ -94,7 +94,7 @@ func TestDeposit_NormalizedDeposit(t *testing.T) { Index: types.SupplyInterestFactors{ { Denom: "bnb", - Value: sdk.MustNewDecFromStr("0"), + Value: sdkmath.LegacyMustNewDecFromStr("0"), }, }, }, diff --git a/x/hard/types/expected_keepers.go b/x/hard/types/expected_keepers.go index 61d7740cdc..da66ef06d4 100644 --- a/x/hard/types/expected_keepers.go +++ b/x/hard/types/expected_keepers.go @@ -1,9 +1,9 @@ package types // noalias import ( + "context" sdkmath "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" pftypes "github.com/kava-labs/kava/x/pricefeed/types" @@ -11,32 +11,32 @@ import ( // BankKeeper defines the expected bank keeper type BankKeeper interface { - SendCoinsFromModuleToModule(ctx sdk.Context, senderModule, recipientModule string, amt sdk.Coins) error - SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error - SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error - - GetSupply(ctx sdk.Context, denom string) sdk.Coin - GetBalance(ctx sdk.Context, addr sdk.AccAddress, denom string) sdk.Coin - GetAllBalances(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins - SpendableCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins + SendCoinsFromModuleToModule(ctx context.Context, senderModule, recipientModule string, amt sdk.Coins) error + SendCoinsFromAccountToModule(ctx context.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error + SendCoinsFromModuleToAccount(ctx context.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error + + GetSupply(ctx context.Context, denom string) sdk.Coin + GetBalance(ctx context.Context, addr sdk.AccAddress, denom string) sdk.Coin + GetAllBalances(ctx context.Context, addr sdk.AccAddress) sdk.Coins + SpendableCoins(ctx context.Context, addr sdk.AccAddress) sdk.Coins } // AccountKeeper defines the expected keeper interface for interacting with account type AccountKeeper interface { - GetAccount(ctx sdk.Context, addr sdk.AccAddress) authtypes.AccountI - SetAccount(ctx sdk.Context, acc authtypes.AccountI) + GetAccount(ctx context.Context, addr sdk.AccAddress) sdk.AccountI + SetAccount(ctx context.Context, acc sdk.AccountI) GetModuleAddress(name string) sdk.AccAddress - GetModuleAccount(ctx sdk.Context, name string) authtypes.ModuleAccountI + GetModuleAccount(ctx context.Context, name string) sdk.ModuleAccountI } // StakingKeeper defines the expected keeper interface for the staking keeper type StakingKeeper interface { - IterateLastValidators(ctx sdk.Context, fn func(index int64, validator stakingtypes.ValidatorI) (stop bool)) - IterateValidators(sdk.Context, func(index int64, validator stakingtypes.ValidatorI) (stop bool)) - IterateAllDelegations(ctx sdk.Context, cb func(delegation stakingtypes.Delegation) (stop bool)) - GetBondedPool(ctx sdk.Context) (bondedPool authtypes.ModuleAccountI) - BondDenom(ctx sdk.Context) (res string) + IterateLastValidators(ctx context.Context, fn func(index int64, validator stakingtypes.ValidatorI) (stop bool)) + IterateValidators(context.Context, func(index int64, validator stakingtypes.ValidatorI) (stop bool)) + IterateAllDelegations(ctx context.Context, cb func(delegation stakingtypes.Delegation) (stop bool)) + GetBondedPool(ctx context.Context) (bondedPool sdk.ModuleAccountI) + BondDenom(ctx context.Context) (res string, err error) } // PricefeedKeeper defines the expected interface for the pricefeed diff --git a/x/hard/types/genesis.go b/x/hard/types/genesis.go index e138b16acc..7a24edba85 100644 --- a/x/hard/types/genesis.go +++ b/x/hard/types/genesis.go @@ -1,6 +1,7 @@ package types import ( + sdkmath "cosmossdk.io/math" "fmt" "time" @@ -65,7 +66,7 @@ func (gs GenesisState) Validate() error { } // NewGenesisAccumulationTime returns a new GenesisAccumulationTime -func NewGenesisAccumulationTime(ctype string, prevTime time.Time, supplyFactor, borrowFactor sdk.Dec) GenesisAccumulationTime { +func NewGenesisAccumulationTime(ctype string, prevTime time.Time, supplyFactor, borrowFactor sdkmath.LegacyDec) GenesisAccumulationTime { return GenesisAccumulationTime{ CollateralType: ctype, PreviousAccumulationTime: prevTime, @@ -89,10 +90,10 @@ func (gats GenesisAccumulationTimes) Validate() error { // Validate performs validation of GenesisAccumulationTime func (gat GenesisAccumulationTime) Validate() error { - if gat.SupplyInterestFactor.LT(sdk.OneDec()) { + if gat.SupplyInterestFactor.LT(sdkmath.LegacyOneDec()) { return fmt.Errorf("supply interest factor should be ≥ 1.0, is %s for %s", gat.SupplyInterestFactor, gat.CollateralType) } - if gat.BorrowInterestFactor.LT(sdk.OneDec()) { + if gat.BorrowInterestFactor.LT(sdkmath.LegacyOneDec()) { return fmt.Errorf("borrow interest factor should be ≥ 1.0, is %s for %s", gat.BorrowInterestFactor, gat.CollateralType) } return nil diff --git a/x/hard/types/genesis.pb.go b/x/hard/types/genesis.pb.go index 45dcb84db0..f92bd1fde6 100644 --- a/x/hard/types/genesis.pb.go +++ b/x/hard/types/genesis.pb.go @@ -4,6 +4,7 @@ package types import ( + cosmossdk_io_math "cosmossdk.io/math" fmt "fmt" _ "github.com/cosmos/cosmos-proto" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" @@ -125,10 +126,10 @@ func (m *GenesisState) GetTotalReserves() github_com_cosmos_cosmos_sdk_types.Coi // GenesisAccumulationTime stores the previous distribution time and its corresponding denom. type GenesisAccumulationTime struct { - CollateralType string `protobuf:"bytes,1,opt,name=collateral_type,json=collateralType,proto3" json:"collateral_type,omitempty"` - PreviousAccumulationTime time.Time `protobuf:"bytes,2,opt,name=previous_accumulation_time,json=previousAccumulationTime,proto3,stdtime" json:"previous_accumulation_time"` - SupplyInterestFactor github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=supply_interest_factor,json=supplyInterestFactor,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"supply_interest_factor"` - BorrowInterestFactor github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,4,opt,name=borrow_interest_factor,json=borrowInterestFactor,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"borrow_interest_factor"` + CollateralType string `protobuf:"bytes,1,opt,name=collateral_type,json=collateralType,proto3" json:"collateral_type,omitempty"` + PreviousAccumulationTime time.Time `protobuf:"bytes,2,opt,name=previous_accumulation_time,json=previousAccumulationTime,proto3,stdtime" json:"previous_accumulation_time"` + SupplyInterestFactor cosmossdk_io_math.LegacyDec `protobuf:"bytes,3,opt,name=supply_interest_factor,json=supplyInterestFactor,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"supply_interest_factor"` + BorrowInterestFactor cosmossdk_io_math.LegacyDec `protobuf:"bytes,4,opt,name=borrow_interest_factor,json=borrowInterestFactor,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"borrow_interest_factor"` } func (m *GenesisAccumulationTime) Reset() { *m = GenesisAccumulationTime{} } @@ -186,44 +187,45 @@ func init() { func init() { proto.RegisterFile("kava/hard/v1beta1/genesis.proto", fileDescriptor_20a1f6c2cf728e74) } var fileDescriptor_20a1f6c2cf728e74 = []byte{ - // 590 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x94, 0xcd, 0x6e, 0xd3, 0x40, - 0x10, 0xc7, 0xe3, 0xa6, 0x6d, 0xc2, 0x16, 0x5a, 0xb0, 0x2a, 0x70, 0x02, 0xb2, 0xa3, 0x1e, 0x20, - 0x42, 0x8a, 0x4d, 0xcb, 0x81, 0x0b, 0x07, 0x30, 0x11, 0x1f, 0x37, 0xe4, 0xe6, 0xc4, 0xc5, 0x5a, - 0x3b, 0x5b, 0xd7, 0xaa, 0x9d, 0xb5, 0x76, 0xd6, 0x81, 0xbc, 0x03, 0x42, 0x7d, 0x0e, 0xce, 0x3c, - 0x01, 0xa7, 0x1e, 0x2b, 0x4e, 0x88, 0x43, 0x8b, 0x92, 0x17, 0x41, 0xfb, 0x91, 0xa4, 0x28, 0x89, - 0xc4, 0x81, 0x9e, 0xe2, 0xdd, 0xfd, 0xcf, 0xff, 0x37, 0x3b, 0x3b, 0x13, 0xe4, 0x9c, 0xe0, 0x21, - 0xf6, 0x8e, 0x31, 0xeb, 0x7b, 0xc3, 0xfd, 0x88, 0x70, 0xbc, 0xef, 0x25, 0x64, 0x40, 0x20, 0x05, - 0xb7, 0x60, 0x94, 0x53, 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8c, - 0x00, 0x0f, 0x8f, 0x70, 0xcc, 0x29, 0xb3, 0xaa, 0x22, 0x27, 0xff, 0xb9, 0xf0, 0xf8, 0x75, 0xe1, - 0x3c, 0xfc, 0x87, 0x4a, 0x74, 0x49, 0xfc, 0xe3, 0x5b, 0x07, 0xe9, 0xaa, 0x76, 0x49, 0x1c, 0xec, - 0x2a, 0xef, 0x77, 0xda, 0xfa, 0xb5, 0x74, 0x16, 0x4c, 0xf5, 0xfc, 0x0b, 0xcc, 0xf5, 0xff, 0xc1, - 0x54, 0xde, 0x7f, 0x33, 0xfd, 0x17, 0x67, 0x63, 0xdb, 0x38, 0x1f, 0xdb, 0xc6, 0xef, 0xb1, 0x6d, - 0x9c, 0x4e, 0xec, 0xca, 0xf9, 0xc4, 0xae, 0xfc, 0x9c, 0xd8, 0x95, 0x0f, 0x57, 0x29, 0x62, 0x8a, - 0x3a, 0x19, 0x8e, 0x40, 0x7e, 0x79, 0x9f, 0xd4, 0x9f, 0x94, 0x24, 0x45, 0x9b, 0xb2, 0xc2, 0x4f, - 0xff, 0x04, 0x00, 0x00, 0xff, 0xff, 0x16, 0xde, 0x3f, 0x0d, 0x64, 0x05, 0x00, 0x00, + // 605 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x94, 0x4f, 0x6f, 0xd3, 0x30, + 0x18, 0xc6, 0x9b, 0xb6, 0x6b, 0x8b, 0x07, 0x1b, 0x44, 0x13, 0xa4, 0x1d, 0x4a, 0xaa, 0x1d, 0xa0, + 0x42, 0x6a, 0x42, 0xc7, 0x81, 0x2b, 0x84, 0x8a, 0x3f, 0x12, 0x07, 0x94, 0xf5, 0xc4, 0x25, 0x72, + 0x12, 0x2f, 0xb5, 0x9a, 0xd4, 0x91, 0xed, 0x14, 0xfa, 0x1d, 0x38, 0xec, 0x73, 0x70, 0xe6, 0x13, + 0x70, 0xda, 0x71, 0xe2, 0x84, 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 0x0f, 0xa6, 0x19, 0xd2, 0x03, 0xd0, 0xda, 0xde, 0xbe, 0x46, 0x59, 0x0c, 0x43, + 0xcb, 0x96, 0xd3, 0x66, 0x2f, 0xa6, 0xcd, 0x1e, 0x2c, 0xa6, 0xcd, 0x6d, 0x14, 0xb7, 0x38, 0xbb, + 0xb2, 0x34, 0xcf, 0xd8, 0xd6, 0x95, 0x7a, 0x0c, 0xee, 0x8b, 0xf2, 0x4f, 0x7d, 0x3c, 0xe6, 0x88, + 0x22, 0xc6, 0xfd, 0x53, 0x18, 0x72, 0x42, 0x8d, 0x4a, 0x91, 0x93, 0xdb, 0x2b, 0x3c, 0x7e, 0x5d, + 0x5a, 0x87, 0xf2, 0xde, 0x2c, 0x1a, 0xd9, 0x98, 0x38, 0x29, 0xe4, 0x43, 0xfb, 0x3d, 0x8a, 0x61, + 0x38, 0xed, 0xa3, 0xf0, 0xc7, 0xb7, 0x2e, 0x50, 0x4f, 0xd9, 0x47, 0xa1, 0x77, 0x20, 0x0d, 0xdf, + 0x29, 0xbf, 0xd7, 0xc2, 0xae, 0x00, 0xc9, 0x9a, 0xaf, 0x81, 0xaa, 0xff, 0x0d, 0x92, 0x86, 0xff, + 0x82, 0xdc, 0x17, 0xe7, 0x33, 0x53, 0xbb, 0x98, 0x99, 0xda, 0xef, 0x99, 0xa9, 0x9d, 0xcd, 0xcd, + 0xd2, 0xc5, 0xdc, 0x2c, 0xfd, 0x9c, 0x9b, 0xa5, 0x8f, 0x8f, 0xae, 0x55, 0xb3, 0x98, 0x97, 0x6e, + 0x02, 0x03, 0x26, 0xbe, 0x9c, 0xcf, 0xf2, 0xef, 0x48, 0x54, 0x34, 0xa8, 0x89, 0xb7, 0x7c, 0xf6, + 0x37, 0x00, 0x00, 0xff, 0xff, 0x13, 0x02, 0x0a, 0x3a, 0x4e, 0x05, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { diff --git a/x/hard/types/genesis_test.go b/x/hard/types/genesis_test.go index 2769040cb0..fc14fd264e 100644 --- a/x/hard/types/genesis_test.go +++ b/x/hard/types/genesis_test.go @@ -60,12 +60,12 @@ func (suite *GenesisTestSuite) TestGenesisValidation() { args: args{ params: types.NewParams( types.MoneyMarkets{ - types.NewMoneyMarket("usdx", types.NewBorrowLimit(true, sdk.MustNewDecFromStr("100000000000"), sdk.MustNewDecFromStr("1")), "usdx:usd", sdkmath.NewInt(USDX_CF), types.NewInterestRateModel(sdk.MustNewDecFromStr("0.05"), sdk.MustNewDecFromStr("2"), sdk.MustNewDecFromStr("0.8"), sdk.MustNewDecFromStr("10")), sdk.MustNewDecFromStr("0.05"), sdk.ZeroDec()), + types.NewMoneyMarket("usdx", types.NewBorrowLimit(true, sdkmath.LegacyMustNewDecFromStr("100000000000"), sdkmath.LegacyMustNewDecFromStr("1")), "usdx:usd", sdkmath.NewInt(USDX_CF), types.NewInterestRateModel(sdkmath.LegacyMustNewDecFromStr("0.05"), sdkmath.LegacyMustNewDecFromStr("2"), sdkmath.LegacyMustNewDecFromStr("0.8"), sdkmath.LegacyMustNewDecFromStr("10")), sdkmath.LegacyMustNewDecFromStr("0.05"), sdkmath.LegacyZeroDec()), }, - sdk.MustNewDecFromStr("10"), + sdkmath.LegacyMustNewDecFromStr("10"), ), gats: types.GenesisAccumulationTimes{ - types.NewGenesisAccumulationTime("usdx", time.Date(2020, 12, 15, 14, 0, 0, 0, time.UTC), sdk.OneDec(), sdk.OneDec()), + types.NewGenesisAccumulationTime("usdx", time.Date(2020, 12, 15, 14, 0, 0, 0, time.UTC), sdkmath.LegacyOneDec(), sdkmath.LegacyOneDec()), }, deps: types.DefaultDeposits, brws: types.DefaultBorrows, diff --git a/x/hard/types/hard.pb.go b/x/hard/types/hard.pb.go index e7de080bdc..39a21a6f85 100644 --- a/x/hard/types/hard.pb.go +++ b/x/hard/types/hard.pb.go @@ -4,6 +4,7 @@ package types import ( + cosmossdk_io_math "cosmossdk.io/math" fmt "fmt" _ "github.com/cosmos/cosmos-proto" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" @@ -28,8 +29,8 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // Params defines the parameters for the hard module. type Params struct { - MoneyMarkets MoneyMarkets `protobuf:"bytes,1,rep,name=money_markets,json=moneyMarkets,proto3,castrepeated=MoneyMarkets" json:"money_markets"` - MinimumBorrowUSDValue github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=minimum_borrow_usd_value,json=minimumBorrowUsdValue,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"minimum_borrow_usd_value"` + MoneyMarkets MoneyMarkets `protobuf:"bytes,1,rep,name=money_markets,json=moneyMarkets,proto3,castrepeated=MoneyMarkets" json:"money_markets"` + MinimumBorrowUSDValue cosmossdk_io_math.LegacyDec `protobuf:"bytes,2,opt,name=minimum_borrow_usd_value,json=minimumBorrowUsdValue,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"minimum_borrow_usd_value"` } func (m *Params) Reset() { *m = Params{} } @@ -67,13 +68,13 @@ var xxx_messageInfo_Params proto.InternalMessageInfo // MoneyMarket is a money market for an individual asset. type MoneyMarket struct { - Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` - BorrowLimit BorrowLimit `protobuf:"bytes,2,opt,name=borrow_limit,json=borrowLimit,proto3" json:"borrow_limit"` - SpotMarketID string `protobuf:"bytes,3,opt,name=spot_market_id,json=spotMarketId,proto3" json:"spot_market_id,omitempty"` - ConversionFactor github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,4,opt,name=conversion_factor,json=conversionFactor,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"conversion_factor"` - InterestRateModel InterestRateModel `protobuf:"bytes,5,opt,name=interest_rate_model,json=interestRateModel,proto3" json:"interest_rate_model"` - ReserveFactor github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,6,opt,name=reserve_factor,json=reserveFactor,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"reserve_factor"` - KeeperRewardPercentage github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,7,opt,name=keeper_reward_percentage,json=keeperRewardPercentage,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"keeper_reward_percentage"` + Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` + BorrowLimit BorrowLimit `protobuf:"bytes,2,opt,name=borrow_limit,json=borrowLimit,proto3" json:"borrow_limit"` + SpotMarketID string `protobuf:"bytes,3,opt,name=spot_market_id,json=spotMarketId,proto3" json:"spot_market_id,omitempty"` + ConversionFactor cosmossdk_io_math.Int `protobuf:"bytes,4,opt,name=conversion_factor,json=conversionFactor,proto3,customtype=cosmossdk.io/math.Int" json:"conversion_factor"` + InterestRateModel InterestRateModel `protobuf:"bytes,5,opt,name=interest_rate_model,json=interestRateModel,proto3" json:"interest_rate_model"` + ReserveFactor cosmossdk_io_math.LegacyDec `protobuf:"bytes,6,opt,name=reserve_factor,json=reserveFactor,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"reserve_factor"` + KeeperRewardPercentage cosmossdk_io_math.LegacyDec `protobuf:"bytes,7,opt,name=keeper_reward_percentage,json=keeperRewardPercentage,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"keeper_reward_percentage"` } func (m *MoneyMarket) Reset() { *m = MoneyMarket{} } @@ -111,9 +112,9 @@ var xxx_messageInfo_MoneyMarket proto.InternalMessageInfo // BorrowLimit enforces restrictions on a money market. type BorrowLimit struct { - HasMaxLimit bool `protobuf:"varint,1,opt,name=has_max_limit,json=hasMaxLimit,proto3" json:"has_max_limit"` - MaximumLimit github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=maximum_limit,json=maximumLimit,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"maximum_limit"` - LoanToValue github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=loan_to_value,json=loanToValue,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"loan_to_value"` + HasMaxLimit bool `protobuf:"varint,1,opt,name=has_max_limit,json=hasMaxLimit,proto3" json:"has_max_limit"` + MaximumLimit cosmossdk_io_math.LegacyDec `protobuf:"bytes,2,opt,name=maximum_limit,json=maximumLimit,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"maximum_limit"` + LoanToValue cosmossdk_io_math.LegacyDec `protobuf:"bytes,3,opt,name=loan_to_value,json=loanToValue,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"loan_to_value"` } func (m *BorrowLimit) Reset() { *m = BorrowLimit{} } @@ -151,10 +152,10 @@ var xxx_messageInfo_BorrowLimit proto.InternalMessageInfo // InterestRateModel contains information about an asset's interest rate. type InterestRateModel struct { - BaseRateAPY github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,1,opt,name=base_rate_apy,json=baseRateApy,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"base_rate_apy"` - BaseMultiplier github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=base_multiplier,json=baseMultiplier,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"base_multiplier"` - Kink github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=kink,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"kink"` - JumpMultiplier github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,4,opt,name=jump_multiplier,json=jumpMultiplier,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"jump_multiplier"` + BaseRateAPY cosmossdk_io_math.LegacyDec `protobuf:"bytes,1,opt,name=base_rate_apy,json=baseRateApy,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"base_rate_apy"` + BaseMultiplier cosmossdk_io_math.LegacyDec `protobuf:"bytes,2,opt,name=base_multiplier,json=baseMultiplier,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"base_multiplier"` + Kink cosmossdk_io_math.LegacyDec `protobuf:"bytes,3,opt,name=kink,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"kink"` + JumpMultiplier cosmossdk_io_math.LegacyDec `protobuf:"bytes,4,opt,name=jump_multiplier,json=jumpMultiplier,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"jump_multiplier"` } func (m *InterestRateModel) Reset() { *m = InterestRateModel{} } @@ -272,8 +273,8 @@ var xxx_messageInfo_Borrow proto.InternalMessageInfo // SupplyInterestFactor defines an individual borrow interest factor. type SupplyInterestFactor struct { - Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` - Value github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=value,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"value"` + Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` + Value cosmossdk_io_math.LegacyDec `protobuf:"bytes,2,opt,name=value,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"value"` } func (m *SupplyInterestFactor) Reset() { *m = SupplyInterestFactor{} } @@ -311,8 +312,8 @@ var xxx_messageInfo_SupplyInterestFactor proto.InternalMessageInfo // BorrowInterestFactor defines an individual borrow interest factor. type BorrowInterestFactor struct { - Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` - Value github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=value,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"value"` + Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` + Value cosmossdk_io_math.LegacyDec `protobuf:"bytes,2,opt,name=value,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"value"` } func (m *BorrowInterestFactor) Reset() { *m = BorrowInterestFactor{} } @@ -401,64 +402,65 @@ func init() { func init() { proto.RegisterFile("kava/hard/v1beta1/hard.proto", fileDescriptor_23a5de800263a2ff) } var fileDescriptor_23a5de800263a2ff = []byte{ - // 911 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x56, 0xbd, 0x8f, 0x1b, 0x45, - 0x14, 0xf7, 0x9e, 0x3f, 0x92, 0x8c, 0xed, 0x23, 0xde, 0xdc, 0xa1, 0x4d, 0x04, 0xeb, 0xc8, 0x42, - 0x70, 0x8d, 0x6d, 0x02, 0x82, 0x8a, 0xe6, 0x16, 0x0b, 0x38, 0x81, 0x25, 0x6b, 0x8f, 0x20, 0x25, - 0x42, 0x5a, 0xc6, 0xbb, 0x2f, 0x77, 0x83, 0x3d, 0x3b, 0xab, 0x99, 0xb1, 0x63, 0x77, 0xb4, 0x34, - 0x88, 0x3f, 0x82, 0x8a, 0x0e, 0xe9, 0xfe, 0x88, 0x2b, 0xa3, 0x54, 0x88, 0xc2, 0x80, 0xaf, 0xa3, - 0xa6, 0xa2, 0x42, 0xf3, 0xe1, 0x8f, 0x5c, 0x1c, 0x29, 0xa7, 0x58, 0x88, 0x6a, 0x77, 0xe6, 0xbd, - 0xf9, 0xbd, 0xdf, 0xfb, 0xcd, 0x9b, 0x99, 0x87, 0xde, 0x18, 0xe0, 0x31, 0x6e, 0x9f, 0x62, 0x9e, - 0xb4, 0xc7, 0xf7, 0xfa, 0x20, 0xf1, 0x3d, 0x3d, 0x68, 0x65, 0x9c, 0x49, 0xe6, 0xd6, 0x94, 0xb5, - 0xa5, 0x27, 0xac, 0xf5, 0x8e, 0x1f, 0x33, 0x41, 0x99, 0x68, 0xf7, 0xb1, 0x80, 0xe5, 0x92, 0x98, - 0x91, 0xd4, 0x2c, 0xb9, 0x73, 0xdb, 0xd8, 0x23, 0x3d, 0x6a, 0x9b, 0x81, 0x35, 0xed, 0x9d, 0xb0, - 0x13, 0x66, 0xe6, 0xd5, 0x9f, 0x99, 0x6d, 0xfc, 0xed, 0xa0, 0x52, 0x0f, 0x73, 0x4c, 0x85, 0xfb, - 0x00, 0x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a7, 0x0a, 0x00, 0x00, + // 927 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x56, 0x4f, 0x6f, 0x1b, 0x45, + 0x14, 0xb7, 0x13, 0xdb, 0x6d, 0xc7, 0x76, 0xa8, 0xa7, 0x09, 0xda, 0x16, 0x58, 0x57, 0x16, 0x82, + 0x48, 0xc8, 0x6b, 0x02, 0x82, 0x33, 0x59, 0xcc, 0x9f, 0xa0, 0x5a, 0x8a, 0x36, 0xb4, 0x6a, 0x23, + 0xa4, 0xd5, 0x78, 0x77, 0x6a, 0x0f, 0xf6, 0xec, 0xac, 0x66, 0x66, 0x5d, 0xfb, 0xcc, 0x17, 0xe0, + 0x2b, 0x70, 0xe5, 0x86, 0x94, 0x0f, 0x91, 0x63, 0xd5, 0x13, 0xe2, 0x60, 0xc0, 0x39, 0xc1, 0x95, + 0x0b, 0xe2, 0x84, 0xe6, 0x4f, 0x6c, 0x37, 0x71, 0xa5, 0xc8, 0x0a, 0x12, 0x27, 0xef, 0xcc, 0x7b, + 0xef, 0xf7, 0x7e, 0xf3, 0x9b, 0xf7, 0x9e, 0x07, 0xbc, 0x39, 0x40, 0x23, 0xd4, 0xea, 0x23, 0x1e, + 0xb7, 0x46, 0x7b, 0x5d, 0x2c, 0xd1, 0x9e, 0x5e, 0x78, 0x29, 0x67, 0x92, 0xc1, 0x9a, 0xb2, 0x7a, + 0x7a, 0xc3, 0x5a, 0xef, 0xb9, 0x11, 0x13, 0x94, 0x89, 0x56, 0x17, 0x09, 0x3c, 0x0f, 0x89, 0x18, + 0x49, 0x4c, 0xc8, 0xbd, 0xbb, 0xc6, 0x1e, 0xea, 0x55, 0xcb, 0x2c, 0xac, 0x69, 0xbb, 0xc7, 0x7a, + 0xcc, 0xec, 0xab, 0x2f, 0xb3, 0xdb, 0xf8, 0x23, 0x0f, 0x4a, 0x87, 0x88, 0x23, 0x2a, 0xe0, 0x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x36, 0x2f, 0x40, 0x0d, 0xd9, 0x2d, 0xe9, 0x77, 0xd9, + 0x87, 0xff, 0x06, 0x00, 0x00, 0xff, 0xff, 0x35, 0x81, 0x07, 0xeb, 0x1b, 0x0a, 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { diff --git a/x/hard/types/keys.go b/x/hard/types/keys.go index cc42bec0c7..67e3d0fd2b 100644 --- a/x/hard/types/keys.go +++ b/x/hard/types/keys.go @@ -25,9 +25,9 @@ var ( MoneyMarketsPrefix = []byte{0x05} PreviousAccrualTimePrefix = []byte{0x06} // denom -> time TotalReservesPrefix = []byte{0x07} // denom -> sdk.Coin - BorrowInterestFactorPrefix = []byte{0x08} // denom -> sdk.Dec - SupplyInterestFactorPrefix = []byte{0x09} // denom -> sdk.Dec - DelegatorInterestFactorPrefix = []byte{0x10} // denom -> sdk.Dec + BorrowInterestFactorPrefix = []byte{0x08} // denom -> sdkmath.LegacyDec + SupplyInterestFactorPrefix = []byte{0x09} // denom -> sdkmath.LegacyDec + DelegatorInterestFactorPrefix = []byte{0x10} // denom -> sdkmath.LegacyDec ) // DepositTypeIteratorKey returns an interator prefix for interating over deposits by deposit denom diff --git a/x/hard/types/liquidation.go b/x/hard/types/liquidation.go index 81398eb9df..1c132b3abf 100644 --- a/x/hard/types/liquidation.go +++ b/x/hard/types/liquidation.go @@ -1,35 +1,34 @@ package types import ( + sdkmath "cosmossdk.io/math" "sort" - - sdk "github.com/cosmos/cosmos-sdk/types" ) // ValuationMap holds the USD value of various coin types type ValuationMap struct { - Usd map[string]sdk.Dec + Usd map[string]sdkmath.LegacyDec } // NewValuationMap returns a new instance of ValuationMap func NewValuationMap() ValuationMap { return ValuationMap{ - Usd: make(map[string]sdk.Dec), + Usd: make(map[string]sdkmath.LegacyDec), } } // Get returns the USD value for a specific denom -func (m ValuationMap) Get(denom string) sdk.Dec { +func (m ValuationMap) Get(denom string) sdkmath.LegacyDec { return m.Usd[denom] } // SetZero sets the USD value for a specific denom to 0 func (m ValuationMap) SetZero(denom string) { - m.Usd[denom] = sdk.ZeroDec() + m.Usd[denom] = sdkmath.LegacyZeroDec() } // Increment increments the USD value of a denom -func (m ValuationMap) Increment(denom string, amount sdk.Dec) { +func (m ValuationMap) Increment(denom string, amount sdkmath.LegacyDec) { _, ok := m.Usd[denom] if !ok { m.Usd[denom] = amount @@ -39,7 +38,7 @@ func (m ValuationMap) Increment(denom string, amount sdk.Dec) { } // Decrement decrements the USD value of a denom -func (m ValuationMap) Decrement(denom string, amount sdk.Dec) { +func (m ValuationMap) Decrement(denom string, amount sdkmath.LegacyDec) { _, ok := m.Usd[denom] if !ok { m.Usd[denom] = amount @@ -49,8 +48,8 @@ func (m ValuationMap) Decrement(denom string, amount sdk.Dec) { } // Sum returns the total USD value of all coins in the map -func (m ValuationMap) Sum() sdk.Dec { - sum := sdk.ZeroDec() +func (m ValuationMap) Sum() sdkmath.LegacyDec { + sum := sdkmath.LegacyZeroDec() for _, v := range m.Usd { sum = sum.Add(v) } diff --git a/x/hard/types/params.go b/x/hard/types/params.go index f3422a8e6b..ffdefe7e43 100644 --- a/x/hard/types/params.go +++ b/x/hard/types/params.go @@ -14,7 +14,7 @@ var ( KeyMoneyMarkets = []byte("MoneyMarkets") KeyMinimumBorrowUSDValue = []byte("MinimumBorrowUSDValue") DefaultMoneyMarkets = MoneyMarkets{} - DefaultMinimumBorrowUSDValue = sdk.NewDec(10) // $10 USD minimum borrow value + DefaultMinimumBorrowUSDValue = sdkmath.LegacyNewDec(10) // $10 USD minimum borrow value DefaultAccumulationTimes = GenesisAccumulationTimes{} DefaultTotalSupplied = sdk.Coins{} DefaultTotalBorrowed = sdk.Coins{} @@ -24,7 +24,7 @@ var ( ) // NewBorrowLimit returns a new BorrowLimit -func NewBorrowLimit(hasMaxLimit bool, maximumLimit, loanToValue sdk.Dec) BorrowLimit { +func NewBorrowLimit(hasMaxLimit bool, maximumLimit, loanToValue sdkmath.LegacyDec) BorrowLimit { return BorrowLimit{ HasMaxLimit: hasMaxLimit, MaximumLimit: maximumLimit, @@ -40,7 +40,7 @@ func (bl BorrowLimit) Validate() error { if bl.LoanToValue.IsNegative() { return fmt.Errorf("loan-to-value must be a non-negative decimal: %s", bl.LoanToValue) } - if bl.LoanToValue.GT(sdk.OneDec()) { + if bl.LoanToValue.GT(sdkmath.LegacyOneDec()) { return fmt.Errorf("loan-to-value cannot be greater than 1.0: %s", bl.LoanToValue) } return nil @@ -62,7 +62,7 @@ func (bl BorrowLimit) Equal(blCompareTo BorrowLimit) bool { // NewMoneyMarket returns a new MoneyMarket func NewMoneyMarket(denom string, borrowLimit BorrowLimit, spotMarketID string, conversionFactor sdkmath.Int, - interestRateModel InterestRateModel, reserveFactor, keeperRewardPercentage sdk.Dec, + interestRateModel InterestRateModel, reserveFactor, keeperRewardPercentage sdkmath.LegacyDec, ) MoneyMarket { return MoneyMarket{ Denom: denom, @@ -85,7 +85,7 @@ func (mm MoneyMarket) Validate() error { return err } - if mm.ConversionFactor.IsNil() || mm.ConversionFactor.LT(sdk.OneInt()) { + if mm.ConversionFactor.IsNil() || mm.ConversionFactor.LT(sdkmath.OneInt()) { return fmt.Errorf("conversion '%s' factor must be ≥ one", mm.ConversionFactor) } @@ -93,11 +93,11 @@ func (mm MoneyMarket) Validate() error { return err } - if mm.ReserveFactor.IsNegative() || mm.ReserveFactor.GT(sdk.OneDec()) { + if mm.ReserveFactor.IsNegative() || mm.ReserveFactor.GT(sdkmath.LegacyOneDec()) { return fmt.Errorf("reserve factor must be between 0.0-1.0") } - if mm.KeeperRewardPercentage.IsNegative() || mm.KeeperRewardPercentage.GT(sdk.OneDec()) { + if mm.KeeperRewardPercentage.IsNegative() || mm.KeeperRewardPercentage.GT(sdkmath.LegacyOneDec()) { return fmt.Errorf("keeper reward percentage must be between 0.0-1.0") } @@ -144,7 +144,7 @@ func (mms MoneyMarkets) Validate() error { } // NewInterestRateModel returns a new InterestRateModel -func NewInterestRateModel(baseRateAPY, baseMultiplier, kink, jumpMultiplier sdk.Dec) InterestRateModel { +func NewInterestRateModel(baseRateAPY, baseMultiplier, kink, jumpMultiplier sdkmath.LegacyDec) InterestRateModel { return InterestRateModel{ BaseRateAPY: baseRateAPY, BaseMultiplier: baseMultiplier, @@ -155,7 +155,7 @@ func NewInterestRateModel(baseRateAPY, baseMultiplier, kink, jumpMultiplier sdk. // Validate InterestRateModel param func (irm InterestRateModel) Validate() error { - if irm.BaseRateAPY.IsNegative() || irm.BaseRateAPY.GT(sdk.OneDec()) { + if irm.BaseRateAPY.IsNegative() || irm.BaseRateAPY.GT(sdkmath.LegacyOneDec()) { return fmt.Errorf("base rate APY must be in the inclusive range 0.0-1.0") } @@ -163,7 +163,7 @@ func (irm InterestRateModel) Validate() error { return fmt.Errorf("base multiplier must not be negative") } - if irm.Kink.IsNegative() || irm.Kink.GT(sdk.OneDec()) { + if irm.Kink.IsNegative() || irm.Kink.GT(sdkmath.LegacyOneDec()) { return fmt.Errorf("kink must be in the inclusive range 0.0-1.0") } @@ -195,7 +195,7 @@ func (irm InterestRateModel) Equal(irmCompareTo InterestRateModel) bool { type InterestRateModels []InterestRateModel // NewParams returns a new params object -func NewParams(moneyMarkets MoneyMarkets, minimumBorrowUSDValue sdk.Dec) Params { +func NewParams(moneyMarkets MoneyMarkets, minimumBorrowUSDValue sdkmath.LegacyDec) Params { return Params{ MoneyMarkets: moneyMarkets, MinimumBorrowUSDValue: minimumBorrowUSDValue, @@ -230,7 +230,7 @@ func (p Params) Validate() error { } func validateMinimumBorrowUSDValue(i interface{}) error { - minBorrowVal, ok := i.(sdk.Dec) + minBorrowVal, ok := i.(sdkmath.LegacyDec) if !ok { return fmt.Errorf("invalid parameter type: %T", i) } diff --git a/x/hard/types/params_test.go b/x/hard/types/params_test.go index 7134e4e4ff..e8fb56c3f8 100644 --- a/x/hard/types/params_test.go +++ b/x/hard/types/params_test.go @@ -4,7 +4,6 @@ import ( "testing" sdkmath "cosmossdk.io/math" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/suite" "github.com/kava-labs/kava/x/hard/types" @@ -16,7 +15,7 @@ type ParamTestSuite struct { func (suite *ParamTestSuite) TestParamValidation() { type args struct { - minBorrowVal sdk.Dec + minBorrowVal sdkmath.LegacyDec mms types.MoneyMarkets } testCases := []struct { @@ -43,14 +42,14 @@ func (suite *ParamTestSuite) TestParamValidation() { Denom: "btcb", BorrowLimit: types.NewBorrowLimit( false, - sdk.MustNewDecFromStr("100000000000"), - sdk.MustNewDecFromStr("0.5"), + sdkmath.LegacyMustNewDecFromStr("100000000000"), + sdkmath.LegacyMustNewDecFromStr("0.5"), ), SpotMarketID: "btc:usd", ConversionFactor: sdkmath.NewInt(0), InterestRateModel: types.InterestRateModel{}, - ReserveFactor: sdk.MustNewDecFromStr("0.05"), - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.05"), + ReserveFactor: sdkmath.LegacyMustNewDecFromStr("0.05"), + KeeperRewardPercentage: sdkmath.LegacyMustNewDecFromStr("0.05"), }, }, }, diff --git a/x/hard/types/query.pb.go b/x/hard/types/query.pb.go index 35d2b87700..0021b52674 100644 --- a/x/hard/types/query.pb.go +++ b/x/hard/types/query.pb.go @@ -1168,7 +1168,7 @@ func (m *DepositResponse) GetIndex() SupplyInterestFactorResponses { // SupplyInterestFactorResponse defines an individual borrow interest factor. type SupplyInterestFactorResponse struct { Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` - // sdk.Dec as string + // sdkmath.LegacyDec as string Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` } @@ -1283,7 +1283,7 @@ func (m *BorrowResponse) GetIndex() BorrowInterestFactorResponses { // BorrowInterestFactorResponse defines an individual borrow interest factor. type BorrowInterestFactorResponse struct { Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` - // sdk.Dec as string + // sdkmath.LegacyDec as string Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` } @@ -1337,9 +1337,9 @@ func (m *BorrowInterestFactorResponse) GetValue() string { // MoneyMarketInterestRate is a unique type returned by interest rate queries type MoneyMarketInterestRate struct { Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` - // sdk.Dec as String + // sdkmath.LegacyDec as String SupplyInterestRate string `protobuf:"bytes,2,opt,name=supply_interest_rate,json=supplyInterestRate,proto3" json:"supply_interest_rate,omitempty"` - // sdk.Dec as String + // sdkmath.LegacyDec as String BorrowInterestRate string `protobuf:"bytes,3,opt,name=borrow_interest_rate,json=borrowInterestRate,proto3" json:"borrow_interest_rate,omitempty"` } @@ -1400,9 +1400,9 @@ func (m *MoneyMarketInterestRate) GetBorrowInterestRate() string { // InterestFactor is a unique type returned by interest factor queries type InterestFactor struct { Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` - // sdk.Dec as String + // sdkmath.LegacyDec as String BorrowInterestFactor string `protobuf:"bytes,2,opt,name=borrow_interest_factor,json=borrowInterestFactor,proto3" json:"borrow_interest_factor,omitempty"` - // sdk.Dec as String + // sdkmath.LegacyDec as String SupplyInterestFactor string `protobuf:"bytes,3,opt,name=supply_interest_factor,json=supplyInterestFactor,proto3" json:"supply_interest_factor,omitempty"` } @@ -1989,6 +1989,7 @@ func _Query_InterestFactors_Handler(srv interface{}, ctx context.Context, dec fu return interceptor(ctx, in, info, handler) } +var Query_serviceDesc = _Query_serviceDesc var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "kava.hard.v1beta1.Query", HandlerType: (*QueryServer)(nil), diff --git a/x/hard/types/tx.pb.go b/x/hard/types/tx.pb.go index e14cb5d5c6..4a70a19114 100644 --- a/x/hard/types/tx.pb.go +++ b/x/hard/types/tx.pb.go @@ -747,6 +747,7 @@ func _Msg_Liquidate_Handler(srv interface{}, ctx context.Context, dec func(inter return interceptor(ctx, in, info, handler) } +var Msg_serviceDesc = _Msg_serviceDesc var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "kava.hard.v1beta1.Msg", HandlerType: (*MsgServer)(nil), diff --git a/x/incentive/genesis.go b/x/incentive/genesis.go index 246ffa67f2..e9cc7ab8e7 100644 --- a/x/incentive/genesis.go +++ b/x/incentive/genesis.go @@ -1,6 +1,7 @@ package incentive import ( + sdkmath "cosmossdk.io/math" "fmt" "time" @@ -176,7 +177,7 @@ func getUSDXMintingGenesisRewardState(ctx sdk.Context, keeper keeper.Keeper) typ }) var mris types.MultiRewardIndexes - keeper.IterateUSDXMintingRewardFactors(ctx, func(ctype string, factor sdk.Dec) bool { + keeper.IterateUSDXMintingRewardFactors(ctx, func(ctype string, factor sdkmath.LegacyDec) bool { mris = append( mris, types.NewMultiRewardIndex( diff --git a/x/incentive/genesis_test.go b/x/incentive/genesis_test.go index 78b75cc79d..b7345e0a41 100644 --- a/x/incentive/genesis_test.go +++ b/x/incentive/genesis_test.go @@ -46,15 +46,15 @@ func (suite *GenesisTestSuite) SetupTest() { WithSimpleAccount(addrs[0], cs(c("bnb", 1e10), c("ukava", 1e10))). WithSimpleModuleAccount(kavadisttypes.KavaDistMacc, cs(c("hard", 1e15), c("ukava", 1e15))) - loanToValue, _ := sdk.NewDecFromStr("0.6") - borrowLimit := sdk.NewDec(1000000000000000) + loanToValue, _ := sdkmath.LegacyNewDecFromStr("0.6") + borrowLimit := sdkmath.LegacyNewDec(1000000000000000) hardGS := hardtypes.NewGenesisState( hardtypes.NewParams( hardtypes.MoneyMarkets{ - hardtypes.NewMoneyMarket("ukava", hardtypes.NewBorrowLimit(false, borrowLimit, loanToValue), "kava:usd", sdkmath.NewInt(1000000), hardtypes.NewInterestRateModel(sdk.MustNewDecFromStr("0.05"), sdk.MustNewDecFromStr("2"), sdk.MustNewDecFromStr("0.8"), sdk.MustNewDecFromStr("10")), sdk.MustNewDecFromStr("0.05"), sdk.ZeroDec()), - hardtypes.NewMoneyMarket("bnb", hardtypes.NewBorrowLimit(false, borrowLimit, loanToValue), "bnb:usd", sdkmath.NewInt(1000000), hardtypes.NewInterestRateModel(sdk.MustNewDecFromStr("0.05"), sdk.MustNewDecFromStr("2"), sdk.MustNewDecFromStr("0.8"), sdk.MustNewDecFromStr("10")), sdk.MustNewDecFromStr("0.05"), sdk.ZeroDec()), + hardtypes.NewMoneyMarket("ukava", hardtypes.NewBorrowLimit(false, borrowLimit, loanToValue), "kava:usd", sdkmath.NewInt(1000000), hardtypes.NewInterestRateModel(sdkmath.LegacyMustNewDecFromStr("0.05"), sdkmath.LegacyMustNewDecFromStr("2"), sdkmath.LegacyMustNewDecFromStr("0.8"), sdkmath.LegacyMustNewDecFromStr("10")), sdkmath.LegacyMustNewDecFromStr("0.05"), sdkmath.LegacyZeroDec()), + hardtypes.NewMoneyMarket("bnb", hardtypes.NewBorrowLimit(false, borrowLimit, loanToValue), "bnb:usd", sdkmath.NewInt(1000000), hardtypes.NewInterestRateModel(sdkmath.LegacyMustNewDecFromStr("0.05"), sdkmath.LegacyMustNewDecFromStr("2"), sdkmath.LegacyMustNewDecFromStr("0.8"), sdkmath.LegacyMustNewDecFromStr("10")), sdkmath.LegacyMustNewDecFromStr("0.05"), sdkmath.LegacyZeroDec()), }, - sdk.NewDec(10), + sdkmath.LegacyNewDec(10), ), hardtypes.DefaultAccumulationTimes, hardtypes.DefaultDeposits, @@ -122,7 +122,7 @@ func (suite *GenesisTestSuite) SetupTest() { NewPricefeedGenStateMultiFromTime(cdc, suite.genesisTime), ) - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: suite.genesisTime}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: suite.genesisTime}) suite.addrs = addrs suite.keeper = keeper @@ -277,7 +277,7 @@ func (suite *GenesisTestSuite) TestExportedGenesisMatchesImported() { ) tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmproto.Header{Height: 0, Time: genesisTime}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 0, Time: genesisTime}) // Incentive init genesis reads from the cdp keeper to check params are ok. So it needs to be initialized first. // Then the cdp keeper reads from pricefeed keeper to check its params are ok. So it also need initialization. @@ -363,7 +363,7 @@ func (suite *GenesisTestSuite) TestInitGenesisPanicsWhenAccumulationTimesTooLong for _, tc := range testCases { tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmproto.Header{Height: 0, Time: genesisTime}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 0, Time: genesisTime}) // Incentive init genesis reads from the cdp keeper to check params are ok. So it needs to be initialized first. // Then the cdp keeper reads from pricefeed keeper to check its params are ok. So it also need initialization. diff --git a/x/incentive/integration_test.go b/x/incentive/integration_test.go index f1d5039dc4..c9c5fed4fd 100644 --- a/x/incentive/integration_test.go +++ b/x/incentive/integration_test.go @@ -16,7 +16,7 @@ import ( // Avoid cluttering test cases with long function names func i(in int64) sdkmath.Int { return sdkmath.NewInt(in) } -func d(str string) sdk.Dec { return sdk.MustNewDecFromStr(str) } +func d(str string) sdkmath.LegacyDec { return sdkmath.LegacyMustNewDecFromStr(str) } func cs(coins ...sdk.Coin) sdk.Coins { return sdk.NewCoins(coins...) } func c(denom string, amount int64) sdk.Coin { return sdk.NewInt64Coin(denom, amount) } @@ -33,9 +33,9 @@ func NewCDPGenStateMulti(cdc codec.JSONCodec) app.GenesisState { { Denom: "xrp", Type: "xrp-a", - LiquidationRatio: sdk.MustNewDecFromStr("2.0"), + LiquidationRatio: sdkmath.LegacyMustNewDecFromStr("2.0"), DebtLimit: sdk.NewInt64Coin("usdx", 500000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), // %5 apr + StabilityFee: sdkmath.LegacyMustNewDecFromStr("1.000000001547125958"), // %5 apr LiquidationPenalty: d("0.05"), AuctionSize: i(7000000000), SpotMarketID: "xrp:usd", @@ -45,9 +45,9 @@ func NewCDPGenStateMulti(cdc codec.JSONCodec) app.GenesisState { { Denom: "btc", Type: "btc-a", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), + LiquidationRatio: sdkmath.LegacyMustNewDecFromStr("1.5"), DebtLimit: sdk.NewInt64Coin("usdx", 500000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000000782997609"), // %2.5 apr + StabilityFee: sdkmath.LegacyMustNewDecFromStr("1.000000000782997609"), // %2.5 apr LiquidationPenalty: d("0.025"), AuctionSize: i(10000000), SpotMarketID: "btc:usd", @@ -57,9 +57,9 @@ func NewCDPGenStateMulti(cdc codec.JSONCodec) app.GenesisState { { Denom: "bnb", Type: "bnb-a", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), + LiquidationRatio: sdkmath.LegacyMustNewDecFromStr("1.5"), DebtLimit: sdk.NewInt64Coin("usdx", 500000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), // %5 apr + StabilityFee: sdkmath.LegacyMustNewDecFromStr("1.000000001547125958"), // %5 apr LiquidationPenalty: d("0.05"), AuctionSize: i(50000000000), SpotMarketID: "bnb:usd", @@ -71,7 +71,7 @@ func NewCDPGenStateMulti(cdc codec.JSONCodec) app.GenesisState { Type: "busd-a", LiquidationRatio: d("1.01"), DebtLimit: sdk.NewInt64Coin("usdx", 500000000000), - StabilityFee: sdk.OneDec(), // %0 apr + StabilityFee: sdkmath.LegacyOneDec(), // %0 apr LiquidationPenalty: d("0.05"), AuctionSize: i(10000000000), SpotMarketID: "busd:usd", @@ -91,16 +91,16 @@ func NewCDPGenStateMulti(cdc codec.JSONCodec) app.GenesisState { GovDenom: cdptypes.DefaultGovDenom, CDPs: cdptypes.CDPs{}, PreviousAccumulationTimes: cdptypes.GenesisAccumulationTimes{ - cdptypes.NewGenesisAccumulationTime("btc-a", time.Time{}, sdk.OneDec()), - cdptypes.NewGenesisAccumulationTime("xrp-a", time.Time{}, sdk.OneDec()), - cdptypes.NewGenesisAccumulationTime("busd-a", time.Time{}, sdk.OneDec()), - cdptypes.NewGenesisAccumulationTime("bnb-a", time.Time{}, sdk.OneDec()), + cdptypes.NewGenesisAccumulationTime("btc-a", time.Time{}, sdkmath.LegacyOneDec()), + cdptypes.NewGenesisAccumulationTime("xrp-a", time.Time{}, sdkmath.LegacyOneDec()), + cdptypes.NewGenesisAccumulationTime("busd-a", time.Time{}, sdkmath.LegacyOneDec()), + cdptypes.NewGenesisAccumulationTime("bnb-a", time.Time{}, sdkmath.LegacyOneDec()), }, TotalPrincipals: cdptypes.GenesisTotalPrincipals{ - cdptypes.NewGenesisTotalPrincipal("btc-a", sdk.ZeroInt()), - cdptypes.NewGenesisTotalPrincipal("xrp-a", sdk.ZeroInt()), - cdptypes.NewGenesisTotalPrincipal("busd-a", sdk.ZeroInt()), - cdptypes.NewGenesisTotalPrincipal("bnb-a", sdk.ZeroInt()), + cdptypes.NewGenesisTotalPrincipal("btc-a", sdkmath.ZeroInt()), + cdptypes.NewGenesisTotalPrincipal("xrp-a", sdkmath.ZeroInt()), + cdptypes.NewGenesisTotalPrincipal("busd-a", sdkmath.ZeroInt()), + cdptypes.NewGenesisTotalPrincipal("bnb-a", sdkmath.ZeroInt()), }, } return app.GenesisState{cdptypes.ModuleName: cdc.MustMarshalJSON(&cdpGenesis)} @@ -122,37 +122,37 @@ func NewPricefeedGenStateMultiFromTime(cdc codec.JSONCodec, t time.Time) app.Gen { MarketID: "kava:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("2.00"), + Price: sdkmath.LegacyMustNewDecFromStr("2.00"), Expiry: t.Add(1 * time.Hour), }, { MarketID: "btc:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("8000.00"), + Price: sdkmath.LegacyMustNewDecFromStr("8000.00"), Expiry: t.Add(1 * time.Hour), }, { MarketID: "xrp:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("0.25"), + Price: sdkmath.LegacyMustNewDecFromStr("0.25"), Expiry: t.Add(1 * time.Hour), }, { MarketID: "bnb:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("17.25"), + Price: sdkmath.LegacyMustNewDecFromStr("17.25"), Expiry: t.Add(1 * time.Hour), }, { MarketID: "busd:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.OneDec(), + Price: sdkmath.LegacyOneDec(), Expiry: t.Add(1 * time.Hour), }, { MarketID: "zzz:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("2.00"), + Price: sdkmath.LegacyMustNewDecFromStr("2.00"), Expiry: t.Add(1 * time.Hour), }, }, diff --git a/x/incentive/keeper/claim.go b/x/incentive/keeper/claim.go index c58ae6e870..525bdb2921 100644 --- a/x/incentive/keeper/claim.go +++ b/x/incentive/keeper/claim.go @@ -2,6 +2,7 @@ package keeper import ( errorsmod "cosmossdk.io/errors" + sdkmath "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/kava-labs/kava/x/incentive/types" @@ -31,7 +32,7 @@ func (k Keeper) ClaimUSDXMintingReward(ctx sdk.Context, owner, receiver sdk.AccA return err } - rewardAmount := sdk.NewDecFromInt(claim.Reward.Amount).Mul(multiplier.Factor).RoundInt() + rewardAmount := sdkmath.LegacyNewDecFromInt(claim.Reward.Amount).Mul(multiplier.Factor).RoundInt() if rewardAmount.IsZero() { return types.ErrZeroClaim } @@ -80,7 +81,7 @@ func (k Keeper) ClaimHardReward(ctx sdk.Context, owner, receiver sdk.AccAddress, amt := syncedClaim.Reward.AmountOf(denom) claimingCoins := sdk.NewCoins(sdk.NewCoin(denom, amt)) - rewardCoins := sdk.NewCoins(sdk.NewCoin(denom, sdk.NewDecFromInt(amt).Mul(multiplier.Factor).RoundInt())) + rewardCoins := sdk.NewCoins(sdk.NewCoin(denom, sdkmath.LegacyNewDecFromInt(amt).Mul(multiplier.Factor).RoundInt())) if rewardCoins.IsZero() { return types.ErrZeroClaim } @@ -133,7 +134,7 @@ func (k Keeper) ClaimDelegatorReward(ctx sdk.Context, owner, receiver sdk.AccAdd amt := syncedClaim.Reward.AmountOf(denom) claimingCoins := sdk.NewCoins(sdk.NewCoin(denom, amt)) - rewardCoins := sdk.NewCoins(sdk.NewCoin(denom, sdk.NewDecFromInt(amt).Mul(multiplier.Factor).RoundInt())) + rewardCoins := sdk.NewCoins(sdk.NewCoin(denom, sdkmath.LegacyNewDecFromInt(amt).Mul(multiplier.Factor).RoundInt())) if rewardCoins.IsZero() { return types.ErrZeroClaim } @@ -182,7 +183,7 @@ func (k Keeper) ClaimSwapReward(ctx sdk.Context, owner, receiver sdk.AccAddress, amt := syncedClaim.Reward.AmountOf(denom) claimingCoins := sdk.NewCoins(sdk.NewCoin(denom, amt)) - rewardCoins := sdk.NewCoins(sdk.NewCoin(denom, sdk.NewDecFromInt(amt).Mul(multiplier.Factor).RoundInt())) + rewardCoins := sdk.NewCoins(sdk.NewCoin(denom, sdkmath.LegacyNewDecFromInt(amt).Mul(multiplier.Factor).RoundInt())) if rewardCoins.IsZero() { return types.ErrZeroClaim } @@ -231,7 +232,7 @@ func (k Keeper) ClaimSavingsReward(ctx sdk.Context, owner, receiver sdk.AccAddre amt := syncedClaim.Reward.AmountOf(denom) claimingCoins := sdk.NewCoins(sdk.NewCoin(denom, amt)) - rewardCoins := sdk.NewCoins(sdk.NewCoin(denom, sdk.NewDecFromInt(amt).Mul(multiplier.Factor).RoundInt())) + rewardCoins := sdk.NewCoins(sdk.NewCoin(denom, sdkmath.LegacyNewDecFromInt(amt).Mul(multiplier.Factor).RoundInt())) if rewardCoins.IsZero() { return types.ErrZeroClaim } @@ -279,7 +280,7 @@ func (k Keeper) ClaimEarnReward(ctx sdk.Context, owner, receiver sdk.AccAddress, amt := syncedClaim.Reward.AmountOf(denom) claimingCoins := sdk.NewCoins(sdk.NewCoin(denom, amt)) - rewardCoins := sdk.NewCoins(sdk.NewCoin(denom, sdk.NewDecFromInt(amt).Mul(multiplier.Factor).RoundInt())) + rewardCoins := sdk.NewCoins(sdk.NewCoin(denom, sdkmath.LegacyNewDecFromInt(amt).Mul(multiplier.Factor).RoundInt())) if rewardCoins.IsZero() { return types.ErrZeroClaim } diff --git a/x/incentive/keeper/grpc_query.go b/x/incentive/keeper/grpc_query.go index 956eaa4054..a6dd193e2f 100644 --- a/x/incentive/keeper/grpc_query.go +++ b/x/incentive/keeper/grpc_query.go @@ -2,6 +2,7 @@ package keeper import ( "context" + sdkmath "cosmossdk.io/math" "strings" sdk "github.com/cosmos/cosmos-sdk/types" @@ -97,7 +98,7 @@ func (s queryServer) RewardFactors( sdkCtx := sdk.UnwrapSDKContext(ctx) var usdxFactors types.RewardIndexes - s.keeper.IterateUSDXMintingRewardFactors(sdkCtx, func(collateralType string, factor sdk.Dec) (stop bool) { + s.keeper.IterateUSDXMintingRewardFactors(sdkCtx, func(collateralType string, factor sdkmath.LegacyDec) (stop bool) { usdxFactors = usdxFactors.With(collateralType, factor) return false }) diff --git a/x/incentive/keeper/grpc_query_test.go b/x/incentive/keeper/grpc_query_test.go index a4ac6c5bae..5ffccedb2f 100644 --- a/x/incentive/keeper/grpc_query_test.go +++ b/x/incentive/keeper/grpc_query_test.go @@ -5,7 +5,6 @@ import ( "time" sdkmath "cosmossdk.io/math" - tmprototypes "github.com/cometbft/cometbft/proto/tendermint/types" "github.com/cosmos/cosmos-sdk/baseapp" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/kava-labs/kava/app" @@ -41,7 +40,7 @@ func (suite *grpcQueryTestSuite) SetupTest() { suite.addrs = addrs - suite.ctx = suite.tApp.NewContext(true, tmprototypes.Header{}). + suite.ctx = suite.tApp.NewContextLegacy(true). WithBlockTime(time.Now().UTC()) suite.keeper = suite.tApp.GetIncentiveKeeper() @@ -50,15 +49,15 @@ func (suite *grpcQueryTestSuite) SetupTest() { suite.queryClient = types.NewQueryClient(queryHelper) - loanToValue, _ := sdk.NewDecFromStr("0.6") - borrowLimit := sdk.NewDec(1000000000000000) + loanToValue, _ := sdkmath.LegacyNewDecFromStr("0.6") + borrowLimit := sdkmath.LegacyNewDec(1000000000000000) hardGS := hardtypes.NewGenesisState( hardtypes.NewParams( hardtypes.MoneyMarkets{ - hardtypes.NewMoneyMarket("ukava", hardtypes.NewBorrowLimit(false, borrowLimit, loanToValue), "kava:usd", sdkmath.NewInt(1000000), hardtypes.NewInterestRateModel(sdk.MustNewDecFromStr("0.05"), sdk.MustNewDecFromStr("2"), sdk.MustNewDecFromStr("0.8"), sdk.MustNewDecFromStr("10")), sdk.MustNewDecFromStr("0.05"), sdk.ZeroDec()), - hardtypes.NewMoneyMarket("bnb", hardtypes.NewBorrowLimit(false, borrowLimit, loanToValue), "bnb:usd", sdkmath.NewInt(1000000), hardtypes.NewInterestRateModel(sdk.MustNewDecFromStr("0.05"), sdk.MustNewDecFromStr("2"), sdk.MustNewDecFromStr("0.8"), sdk.MustNewDecFromStr("10")), sdk.MustNewDecFromStr("0.05"), sdk.ZeroDec()), + hardtypes.NewMoneyMarket("ukava", hardtypes.NewBorrowLimit(false, borrowLimit, loanToValue), "kava:usd", sdkmath.NewInt(1000000), hardtypes.NewInterestRateModel(sdkmath.LegacyMustNewDecFromStr("0.05"), sdkmath.LegacyMustNewDecFromStr("2"), sdkmath.LegacyMustNewDecFromStr("0.8"), sdkmath.LegacyMustNewDecFromStr("10")), sdkmath.LegacyMustNewDecFromStr("0.05"), sdkmath.LegacyZeroDec()), + hardtypes.NewMoneyMarket("bnb", hardtypes.NewBorrowLimit(false, borrowLimit, loanToValue), "bnb:usd", sdkmath.NewInt(1000000), hardtypes.NewInterestRateModel(sdkmath.LegacyMustNewDecFromStr("0.05"), sdkmath.LegacyMustNewDecFromStr("2"), sdkmath.LegacyMustNewDecFromStr("0.8"), sdkmath.LegacyMustNewDecFromStr("10")), sdkmath.LegacyMustNewDecFromStr("0.05"), sdkmath.LegacyZeroDec()), }, - sdk.NewDec(10), + sdkmath.LegacyNewDec(10), ), hardtypes.DefaultAccumulationTimes, hardtypes.DefaultDeposits, diff --git a/x/incentive/keeper/hooks.go b/x/incentive/keeper/hooks.go index 2fa7e6dcc7..84a46c9a18 100644 --- a/x/incentive/keeper/hooks.go +++ b/x/incentive/keeper/hooks.go @@ -1,6 +1,7 @@ package keeper import ( + "context" sdkmath "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" @@ -33,14 +34,16 @@ func (k Keeper) Hooks() Hooks { return Hooks{k} } // AfterCDPCreated function that runs after a cdp is created func (h Hooks) AfterCDPCreated(ctx sdk.Context, cdp cdptypes.CDP) { - h.k.InitializeUSDXMintingClaim(ctx, cdp) + sdkCtx := sdk.UnwrapSDKContext(ctx) + h.k.InitializeUSDXMintingClaim(sdkCtx, cdp) } // BeforeCDPModified function that runs before a cdp is modified // note that this is called immediately after interest is synchronized, and so could potentially // be called AfterCDPInterestUpdated or something like that, if we we're to expand the scope of cdp hooks func (h Hooks) BeforeCDPModified(ctx sdk.Context, cdp cdptypes.CDP) { - h.k.SynchronizeUSDXMintingReward(ctx, cdp) + sdkCtx := sdk.UnwrapSDKContext(ctx) + h.k.SynchronizeUSDXMintingReward(sdkCtx, cdp) } // ------------------- Hard Module Hooks ------------------- @@ -96,28 +99,36 @@ When delegated tokens (to bonded validators) are changed: */ // BeforeDelegationCreated runs before a delegation is created -func (h Hooks) BeforeDelegationCreated(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error { +func (h Hooks) BeforeDelegationCreated(ctx context.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error { + sdkCtx := sdk.UnwrapSDKContext(ctx) // Add a claim if one doesn't exist, otherwise sync the existing. - h.k.InitializeDelegatorReward(ctx, delAddr) + h.k.InitializeDelegatorReward(sdkCtx, delAddr) return nil } // BeforeDelegationSharesModified runs before an existing delegation is modified -func (h Hooks) BeforeDelegationSharesModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error { +func (h Hooks) BeforeDelegationSharesModified(ctx context.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error { + sdkCtx := sdk.UnwrapSDKContext(ctx) // Sync rewards based on total delegated to bonded validators. - h.k.SynchronizeDelegatorRewards(ctx, delAddr, nil, false) + h.k.SynchronizeDelegatorRewards(sdkCtx, delAddr, nil, false) return nil } // BeforeValidatorSlashed is called before a validator is slashed // Validator status is not updated when Slash or Jail is called -func (h Hooks) BeforeValidatorSlashed(ctx sdk.Context, valAddr sdk.ValAddress, fraction sdk.Dec) error { +func (h Hooks) BeforeValidatorSlashed(ctx context.Context, valAddr sdk.ValAddress, fraction sdkmath.LegacyDec) error { // Sync all claims for users delegated to this validator. // For each claim, sync based on the total delegated to bonded validators. - for _, delegation := range h.k.stakingKeeper.GetValidatorDelegations(ctx, valAddr) { - h.k.SynchronizeDelegatorRewards(ctx, delegation.GetDelegatorAddr(), nil, false) + delegations, err := h.k.stakingKeeper.GetValidatorDelegations(ctx, valAddr) + if err != nil { + return err + } + sdkCtx := sdk.UnwrapSDKContext(ctx) + + for _, delegation := range delegations { + h.k.SynchronizeDelegatorRewards(sdkCtx, []byte(delegation.GetDelegatorAddr()), nil, false) } return nil @@ -125,12 +136,17 @@ func (h Hooks) BeforeValidatorSlashed(ctx sdk.Context, valAddr sdk.ValAddress, f // AfterValidatorBeginUnbonding is called after a validator begins unbonding // Validator status is set to Unbonding prior to hook running -func (h Hooks) AfterValidatorBeginUnbonding(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) error { +func (h Hooks) AfterValidatorBeginUnbonding(ctx context.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) error { + delegations, err := h.k.stakingKeeper.GetValidatorDelegations(ctx, valAddr) + if err != nil { + return err + } + sdkCtx := sdk.UnwrapSDKContext(ctx) // Sync all claims for users delegated to this validator. // For each claim, sync based on the total delegated to bonded validators, and also delegations to valAddr. // valAddr's status has just been set to Unbonding, but we want to include delegations to it in the sync. - for _, delegation := range h.k.stakingKeeper.GetValidatorDelegations(ctx, valAddr) { - h.k.SynchronizeDelegatorRewards(ctx, delegation.GetDelegatorAddr(), valAddr, true) + for _, delegation := range delegations { + h.k.SynchronizeDelegatorRewards(sdkCtx, []byte(delegation.GetDelegatorAddr()), valAddr, true) } return nil @@ -138,12 +154,17 @@ func (h Hooks) AfterValidatorBeginUnbonding(ctx sdk.Context, consAddr sdk.ConsAd // AfterValidatorBonded is called after a validator is bonded // Validator status is set to Bonded prior to hook running -func (h Hooks) AfterValidatorBonded(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) error { +func (h Hooks) AfterValidatorBonded(ctx context.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) error { + delegations, err := h.k.stakingKeeper.GetValidatorDelegations(ctx, valAddr) + if err != nil { + return err + } + sdkCtx := sdk.UnwrapSDKContext(ctx) // Sync all claims for users delegated to this validator. // For each claim, sync based on the total delegated to bonded validators, except for delegations to valAddr. // valAddr's status has just been set to Bonded, but we don't want to include delegations to it in the sync - for _, delegation := range h.k.stakingKeeper.GetValidatorDelegations(ctx, valAddr) { - h.k.SynchronizeDelegatorRewards(ctx, delegation.GetDelegatorAddr(), valAddr, false) + for _, delegation := range delegations { + h.k.SynchronizeDelegatorRewards(sdkCtx, []byte(delegation.GetDelegatorAddr()), valAddr, false) } return nil @@ -152,55 +173,57 @@ func (h Hooks) AfterValidatorBonded(ctx sdk.Context, consAddr sdk.ConsAddress, v // NOTE: following hooks are just implemented to ensure StakingHooks interface compliance // AfterDelegationModified runs after a delegation is modified -func (h Hooks) AfterDelegationModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error { +func (h Hooks) AfterDelegationModified(ctx context.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error { return nil } // BeforeDelegationRemoved runs directly before a delegation is deleted. BeforeDelegationSharesModified is run prior to this. -func (h Hooks) BeforeDelegationRemoved(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error { +func (h Hooks) BeforeDelegationRemoved(ctx context.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error { return nil } // AfterValidatorCreated runs after a validator is created -func (h Hooks) AfterValidatorCreated(ctx sdk.Context, valAddr sdk.ValAddress) error { +func (h Hooks) AfterValidatorCreated(ctx context.Context, valAddr sdk.ValAddress) error { return nil } // BeforeValidatorModified runs before a validator is modified -func (h Hooks) BeforeValidatorModified(ctx sdk.Context, valAddr sdk.ValAddress) error { +func (h Hooks) BeforeValidatorModified(ctx context.Context, valAddr sdk.ValAddress) error { return nil } // AfterValidatorRemoved runs after a validator is removed -func (h Hooks) AfterValidatorRemoved(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) error { +func (h Hooks) AfterValidatorRemoved(ctx context.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) error { return nil } // AfterUnbondingInitiated is called when an unbonding operation // (validator unbonding, unbonding delegation, redelegation) was initiated -func (h Hooks) AfterUnbondingInitiated(_ sdk.Context, _ uint64) error { +func (h Hooks) AfterUnbondingInitiated(_ context.Context, _ uint64) error { return nil } // ------------------- Swap Module Hooks ------------------- -func (h Hooks) AfterPoolDepositCreated(ctx sdk.Context, poolID string, depositor sdk.AccAddress, _ sdkmath.Int) { - h.k.InitializeSwapReward(ctx, poolID, depositor) +func (h Hooks) AfterPoolDepositCreated(ctx context.Context, poolID string, depositor sdk.AccAddress, _ sdkmath.Int) { + sdkCtx := sdk.UnwrapSDKContext(ctx) + h.k.InitializeSwapReward(sdkCtx, poolID, depositor) } -func (h Hooks) BeforePoolDepositModified(ctx sdk.Context, poolID string, depositor sdk.AccAddress, sharesOwned sdkmath.Int) { - h.k.SynchronizeSwapReward(ctx, poolID, depositor, sharesOwned) +func (h Hooks) BeforePoolDepositModified(ctx context.Context, poolID string, depositor sdk.AccAddress, sharesOwned sdkmath.Int) { + sdkCtx := sdk.UnwrapSDKContext(ctx) + h.k.SynchronizeSwapReward(sdkCtx, poolID, depositor, sharesOwned) } // ------------------- Savings Module Hooks ------------------- // AfterSavingsDepositCreated function that runs after a deposit is created -func (h Hooks) AfterSavingsDepositCreated(ctx sdk.Context, deposit savingstypes.Deposit) { +func (h Hooks) AfterSavingsDepositCreated(ctx context.Context, deposit savingstypes.Deposit) { // h.k.InitializeSavingsReward(ctx, deposit) } // BeforeSavingsDepositModified function that runs before a deposit is modified -func (h Hooks) BeforeSavingsDepositModified(ctx sdk.Context, deposit savingstypes.Deposit, incomingDenoms []string) { +func (h Hooks) BeforeSavingsDepositModified(ctx context.Context, deposit savingstypes.Deposit, incomingDenoms []string) { // h.k.SynchronizeSavingsReward(ctx, deposit, incomingDenoms) } @@ -208,20 +231,22 @@ func (h Hooks) BeforeSavingsDepositModified(ctx sdk.Context, deposit savingstype // AfterVaultDepositCreated function that runs after a vault deposit is created func (h Hooks) AfterVaultDepositCreated( - ctx sdk.Context, + ctx context.Context, vaultDenom string, depositor sdk.AccAddress, - _ sdk.Dec, + _ sdkmath.LegacyDec, ) { - h.k.InitializeEarnReward(ctx, vaultDenom, depositor) + sdkCtx := sdk.UnwrapSDKContext(ctx) + h.k.InitializeEarnReward(sdkCtx, vaultDenom, depositor) } // BeforeVaultDepositModified function that runs before a vault deposit is modified func (h Hooks) BeforeVaultDepositModified( - ctx sdk.Context, + ctx context.Context, vaultDenom string, depositor sdk.AccAddress, - sharesOwned sdk.Dec, + sharesOwned sdkmath.LegacyDec, ) { - h.k.SynchronizeEarnReward(ctx, vaultDenom, depositor, sharesOwned) + sdkCtx := sdk.UnwrapSDKContext(ctx) + h.k.SynchronizeEarnReward(sdkCtx, vaultDenom, depositor, sharesOwned) } diff --git a/x/incentive/keeper/integration_test.go b/x/incentive/keeper/integration_test.go index efc3716913..35c197229b 100644 --- a/x/incentive/keeper/integration_test.go +++ b/x/incentive/keeper/integration_test.go @@ -17,14 +17,14 @@ import ( // Avoid cluttering test cases with long function names func i(in int64) sdkmath.Int { return sdkmath.NewInt(in) } -func d(str string) sdk.Dec { return sdk.MustNewDecFromStr(str) } +func d(str string) sdkmath.LegacyDec { return sdkmath.LegacyMustNewDecFromStr(str) } func c(denom string, amount int64) sdk.Coin { return sdk.NewInt64Coin(denom, amount) } -func dc(denom string, amount string) sdk.DecCoin { - return sdk.NewDecCoinFromDec(denom, sdk.MustNewDecFromStr(amount)) +func dc(denom string, amount string) sdkmath.LegacyDecCoin { + return sdk.NewDecCoinFromDec(denom, sdkmath.LegacyMustNewDecFromStr(amount)) } -func cs(coins ...sdk.Coin) sdk.Coins { return sdk.NewCoins(coins...) } -func toDcs(coins ...sdk.Coin) sdk.DecCoins { return sdk.NewDecCoinsFromCoins(coins...) } -func dcs(coins ...sdk.DecCoin) sdk.DecCoins { return sdk.NewDecCoins(coins...) } +func cs(coins ...sdk.Coin) sdk.Coins { return sdk.NewCoins(coins...) } +func toDcs(coins ...sdk.Coin) sdk.DecCoins { return sdk.NewDecCoinsFromCoins(coins...) } +func dcs(coins ...sdkmath.LegacyDecCoin) sdk.DecCoins { return sdk.NewDecCoins(coins...) } func NewCDPGenStateMulti(cdc codec.JSONCodec) app.GenesisState { cdpGenesis := cdptypes.GenesisState{ @@ -39,9 +39,9 @@ func NewCDPGenStateMulti(cdc codec.JSONCodec) app.GenesisState { { Denom: "xrp", Type: "xrp-a", - LiquidationRatio: sdk.MustNewDecFromStr("2.0"), + LiquidationRatio: sdkmath.LegacyMustNewDecFromStr("2.0"), DebtLimit: sdk.NewInt64Coin("usdx", 500000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), // %5 apr + StabilityFee: sdkmath.LegacyMustNewDecFromStr("1.000000001547125958"), // %5 apr LiquidationPenalty: d("0.05"), AuctionSize: i(7000000000), SpotMarketID: "xrp:usd", @@ -51,9 +51,9 @@ func NewCDPGenStateMulti(cdc codec.JSONCodec) app.GenesisState { { Denom: "btc", Type: "btc-a", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), + LiquidationRatio: sdkmath.LegacyMustNewDecFromStr("1.5"), DebtLimit: sdk.NewInt64Coin("usdx", 500000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000000782997609"), // %2.5 apr + StabilityFee: sdkmath.LegacyMustNewDecFromStr("1.000000000782997609"), // %2.5 apr LiquidationPenalty: d("0.025"), AuctionSize: i(10000000), SpotMarketID: "btc:usd", @@ -63,9 +63,9 @@ func NewCDPGenStateMulti(cdc codec.JSONCodec) app.GenesisState { { Denom: "bnb", Type: "bnb-a", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), + LiquidationRatio: sdkmath.LegacyMustNewDecFromStr("1.5"), DebtLimit: sdk.NewInt64Coin("usdx", 500000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), // %5 apr + StabilityFee: sdkmath.LegacyMustNewDecFromStr("1.000000001547125958"), // %5 apr LiquidationPenalty: d("0.05"), AuctionSize: i(50000000000), SpotMarketID: "bnb:usd", @@ -77,7 +77,7 @@ func NewCDPGenStateMulti(cdc codec.JSONCodec) app.GenesisState { Type: "busd-a", LiquidationRatio: d("1.01"), DebtLimit: sdk.NewInt64Coin("usdx", 500000000000), - StabilityFee: sdk.OneDec(), // %0 apr + StabilityFee: sdkmath.LegacyOneDec(), // %0 apr LiquidationPenalty: d("0.05"), AuctionSize: i(10000000000), SpotMarketID: "busd:usd", @@ -97,16 +97,16 @@ func NewCDPGenStateMulti(cdc codec.JSONCodec) app.GenesisState { GovDenom: cdptypes.DefaultGovDenom, CDPs: cdptypes.CDPs{}, PreviousAccumulationTimes: cdptypes.GenesisAccumulationTimes{ - cdptypes.NewGenesisAccumulationTime("btc-a", time.Time{}, sdk.OneDec()), - cdptypes.NewGenesisAccumulationTime("xrp-a", time.Time{}, sdk.OneDec()), - cdptypes.NewGenesisAccumulationTime("busd-a", time.Time{}, sdk.OneDec()), - cdptypes.NewGenesisAccumulationTime("bnb-a", time.Time{}, sdk.OneDec()), + cdptypes.NewGenesisAccumulationTime("btc-a", time.Time{}, sdkmath.LegacyOneDec()), + cdptypes.NewGenesisAccumulationTime("xrp-a", time.Time{}, sdkmath.LegacyOneDec()), + cdptypes.NewGenesisAccumulationTime("busd-a", time.Time{}, sdkmath.LegacyOneDec()), + cdptypes.NewGenesisAccumulationTime("bnb-a", time.Time{}, sdkmath.LegacyOneDec()), }, TotalPrincipals: cdptypes.GenesisTotalPrincipals{ - cdptypes.NewGenesisTotalPrincipal("btc-a", sdk.ZeroInt()), - cdptypes.NewGenesisTotalPrincipal("xrp-a", sdk.ZeroInt()), - cdptypes.NewGenesisTotalPrincipal("busd-a", sdk.ZeroInt()), - cdptypes.NewGenesisTotalPrincipal("bnb-a", sdk.ZeroInt()), + cdptypes.NewGenesisTotalPrincipal("btc-a", sdkmath.ZeroInt()), + cdptypes.NewGenesisTotalPrincipal("xrp-a", sdkmath.ZeroInt()), + cdptypes.NewGenesisTotalPrincipal("busd-a", sdkmath.ZeroInt()), + cdptypes.NewGenesisTotalPrincipal("bnb-a", sdkmath.ZeroInt()), }, } return app.GenesisState{cdptypes.ModuleName: cdc.MustMarshalJSON(&cdpGenesis)} @@ -130,37 +130,37 @@ func NewPricefeedGenStateMultiFromTime(cdc codec.JSONCodec, t time.Time) app.Gen { MarketID: "kava:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("2.00"), + Price: sdkmath.LegacyMustNewDecFromStr("2.00"), Expiry: t.Add(expiry), }, { MarketID: "btc:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("8000.00"), + Price: sdkmath.LegacyMustNewDecFromStr("8000.00"), Expiry: t.Add(expiry), }, { MarketID: "xrp:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("0.25"), + Price: sdkmath.LegacyMustNewDecFromStr("0.25"), Expiry: t.Add(expiry), }, { MarketID: "bnb:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("17.25"), + Price: sdkmath.LegacyMustNewDecFromStr("17.25"), Expiry: t.Add(expiry), }, { MarketID: "busd:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.OneDec(), + Price: sdkmath.LegacyOneDec(), Expiry: t.Add(expiry), }, { MarketID: "zzz:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("2.00"), + Price: sdkmath.LegacyMustNewDecFromStr("2.00"), Expiry: t.Add(expiry), }, }, @@ -200,7 +200,7 @@ func NewCommitteeGenesisState(cdc codec.Codec, committeeID uint64, members ...sd "This committee is for testing.", members, []committeetypes.Permission{&committeetypes.GodPermission{}}, - sdk.MustNewDecFromStr("0.666666667"), + sdkmath.LegacyMustNewDecFromStr("0.666666667"), time.Hour*24*7, committeetypes.TALLY_OPTION_FIRST_PAST_THE_POST, ) diff --git a/x/incentive/keeper/keeper.go b/x/incentive/keeper/keeper.go index 7158c50de7..38c3ec5100 100644 --- a/x/incentive/keeper/keeper.go +++ b/x/incentive/keeper/keeper.go @@ -1,11 +1,12 @@ package keeper import ( + sdkmath "cosmossdk.io/math" "time" + "cosmossdk.io/store/prefix" + storetypes "cosmossdk.io/store/types" "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/store/prefix" - storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/kava-labs/kava/x/incentive/types" @@ -91,7 +92,7 @@ func (k Keeper) DeleteUSDXMintingClaim(ctx sdk.Context, owner sdk.AccAddress) { // IterateUSDXMintingClaims iterates over all claim objects in the store and preforms a callback function func (k Keeper) IterateUSDXMintingClaims(ctx sdk.Context, cb func(c types.USDXMintingClaim) (stop bool)) { store := prefix.NewStore(ctx.KVStore(k.key), types.USDXMintingClaimKeyPrefix) - iterator := sdk.KVStorePrefixIterator(store, []byte{}) + iterator := storetypes.KVStorePrefixIterator(store, []byte{}) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { var c types.USDXMintingClaim @@ -138,7 +139,7 @@ func (k Keeper) SetPreviousUSDXMintingAccrualTime(ctx sdk.Context, ctype string, // IterateUSDXMintingAccrualTimes iterates over all previous USDX minting accrual times and preforms a callback function func (k Keeper) IterateUSDXMintingAccrualTimes(ctx sdk.Context, cb func(string, time.Time) (stop bool)) { store := prefix.NewStore(ctx.KVStore(k.key), types.PreviousUSDXMintingRewardAccrualTimeKeyPrefix) - iterator := sdk.KVStorePrefixIterator(store, []byte{}) + iterator := storetypes.KVStorePrefixIterator(store, []byte{}) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { var accrualTime time.Time @@ -153,11 +154,11 @@ func (k Keeper) IterateUSDXMintingAccrualTimes(ctx sdk.Context, cb func(string, } // GetUSDXMintingRewardFactor returns the current reward factor for an individual collateral type -func (k Keeper) GetUSDXMintingRewardFactor(ctx sdk.Context, ctype string) (factor sdk.Dec, found bool) { +func (k Keeper) GetUSDXMintingRewardFactor(ctx sdk.Context, ctype string) (factor sdkmath.LegacyDec, found bool) { store := prefix.NewStore(ctx.KVStore(k.key), types.USDXMintingRewardFactorKeyPrefix) bz := store.Get([]byte(ctype)) if bz == nil { - return sdk.ZeroDec(), false + return sdkmath.LegacyZeroDec(), false } if err := factor.Unmarshal(bz); err != nil { panic(err) @@ -166,7 +167,7 @@ func (k Keeper) GetUSDXMintingRewardFactor(ctx sdk.Context, ctype string) (facto } // SetUSDXMintingRewardFactor sets the current reward factor for an individual collateral type -func (k Keeper) SetUSDXMintingRewardFactor(ctx sdk.Context, ctype string, factor sdk.Dec) { +func (k Keeper) SetUSDXMintingRewardFactor(ctx sdk.Context, ctype string, factor sdkmath.LegacyDec) { store := prefix.NewStore(ctx.KVStore(k.key), types.USDXMintingRewardFactorKeyPrefix) bz, err := factor.Marshal() if err != nil { @@ -176,12 +177,12 @@ func (k Keeper) SetUSDXMintingRewardFactor(ctx sdk.Context, ctype string, factor } // IterateUSDXMintingRewardFactors iterates over all USDX Minting reward factor objects in the store and preforms a callback function -func (k Keeper) IterateUSDXMintingRewardFactors(ctx sdk.Context, cb func(denom string, factor sdk.Dec) (stop bool)) { +func (k Keeper) IterateUSDXMintingRewardFactors(ctx sdk.Context, cb func(denom string, factor sdkmath.LegacyDec) (stop bool)) { store := prefix.NewStore(ctx.KVStore(k.key), types.USDXMintingRewardFactorKeyPrefix) - iterator := sdk.KVStorePrefixIterator(store, []byte{}) + iterator := storetypes.KVStorePrefixIterator(store, []byte{}) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { - var factor sdk.Dec + var factor sdkmath.LegacyDec if err := factor.Unmarshal(iterator.Value()); err != nil { panic(err) } @@ -219,7 +220,7 @@ func (k Keeper) DeleteHardLiquidityProviderClaim(ctx sdk.Context, owner sdk.AccA // IterateHardLiquidityProviderClaims iterates over all claim objects in the store and preforms a callback function func (k Keeper) IterateHardLiquidityProviderClaims(ctx sdk.Context, cb func(c types.HardLiquidityProviderClaim) (stop bool)) { store := prefix.NewStore(ctx.KVStore(k.key), types.HardLiquidityClaimKeyPrefix) - iterator := sdk.KVStorePrefixIterator(store, []byte{}) + iterator := storetypes.KVStorePrefixIterator(store, []byte{}) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { var c types.HardLiquidityProviderClaim @@ -268,7 +269,7 @@ func (k Keeper) DeleteDelegatorClaim(ctx sdk.Context, owner sdk.AccAddress) { // IterateDelegatorClaims iterates over all claim objects in the store and preforms a callback function func (k Keeper) IterateDelegatorClaims(ctx sdk.Context, cb func(c types.DelegatorClaim) (stop bool)) { store := prefix.NewStore(ctx.KVStore(k.key), types.DelegatorClaimKeyPrefix) - iterator := sdk.KVStorePrefixIterator(store, []byte{}) + iterator := storetypes.KVStorePrefixIterator(store, []byte{}) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { var c types.DelegatorClaim @@ -317,7 +318,7 @@ func (k Keeper) DeleteSwapClaim(ctx sdk.Context, owner sdk.AccAddress) { // IterateSwapClaims iterates over all claim objects in the store and preforms a callback function func (k Keeper) IterateSwapClaims(ctx sdk.Context, cb func(c types.SwapClaim) (stop bool)) { store := prefix.NewStore(ctx.KVStore(k.key), types.SwapClaimKeyPrefix) - iterator := sdk.KVStorePrefixIterator(store, []byte{}) + iterator := storetypes.KVStorePrefixIterator(store, []byte{}) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { var c types.SwapClaim @@ -366,7 +367,7 @@ func (k Keeper) DeleteSavingsClaim(ctx sdk.Context, owner sdk.AccAddress) { // IterateSavingsClaims iterates over all savings claim objects in the store and preforms a callback function func (k Keeper) IterateSavingsClaims(ctx sdk.Context, cb func(c types.SavingsClaim) (stop bool)) { store := prefix.NewStore(ctx.KVStore(k.key), types.SavingsClaimKeyPrefix) - iterator := sdk.KVStorePrefixIterator(store, []byte{}) + iterator := storetypes.KVStorePrefixIterator(store, []byte{}) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { var c types.SavingsClaim @@ -415,7 +416,7 @@ func (k Keeper) DeleteEarnClaim(ctx sdk.Context, owner sdk.AccAddress) { // IterateEarnClaims iterates over all claim objects in the store and preforms a callback function func (k Keeper) IterateEarnClaims(ctx sdk.Context, cb func(c types.EarnClaim) (stop bool)) { store := prefix.NewStore(ctx.KVStore(k.key), types.EarnClaimKeyPrefix) - iterator := sdk.KVStorePrefixIterator(store, []byte{}) + iterator := storetypes.KVStorePrefixIterator(store, []byte{}) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { var c types.EarnClaim @@ -461,7 +462,7 @@ func (k Keeper) GetHardSupplyRewardIndexes(ctx sdk.Context, denom string) (types // IterateHardSupplyRewardIndexes iterates over all Hard supply reward index objects in the store and preforms a callback function func (k Keeper) IterateHardSupplyRewardIndexes(ctx sdk.Context, cb func(denom string, indexes types.RewardIndexes) (stop bool)) { store := prefix.NewStore(ctx.KVStore(k.key), types.HardSupplyRewardIndexesKeyPrefix) - iterator := sdk.KVStorePrefixIterator(store, []byte{}) + iterator := storetypes.KVStorePrefixIterator(store, []byte{}) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { var proto types.RewardIndexesProto @@ -474,7 +475,7 @@ func (k Keeper) IterateHardSupplyRewardIndexes(ctx sdk.Context, cb func(denom st func (k Keeper) IterateHardSupplyRewardAccrualTimes(ctx sdk.Context, cb func(string, time.Time) (stop bool)) { store := prefix.NewStore(ctx.KVStore(k.key), types.PreviousHardSupplyRewardAccrualTimeKeyPrefix) - iterator := sdk.KVStorePrefixIterator(store, []byte{}) + iterator := storetypes.KVStorePrefixIterator(store, []byte{}) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { var accrualTime time.Time @@ -513,7 +514,7 @@ func (k Keeper) GetHardBorrowRewardIndexes(ctx sdk.Context, denom string) (types // IterateHardBorrowRewardIndexes iterates over all Hard borrow reward index objects in the store and preforms a callback function func (k Keeper) IterateHardBorrowRewardIndexes(ctx sdk.Context, cb func(denom string, indexes types.RewardIndexes) (stop bool)) { store := prefix.NewStore(ctx.KVStore(k.key), types.HardBorrowRewardIndexesKeyPrefix) - iterator := sdk.KVStorePrefixIterator(store, []byte{}) + iterator := storetypes.KVStorePrefixIterator(store, []byte{}) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { var proto types.RewardIndexesProto @@ -526,7 +527,7 @@ func (k Keeper) IterateHardBorrowRewardIndexes(ctx sdk.Context, cb func(denom st func (k Keeper) IterateHardBorrowRewardAccrualTimes(ctx sdk.Context, cb func(string, time.Time) (stop bool)) { store := prefix.NewStore(ctx.KVStore(k.key), types.PreviousHardBorrowRewardAccrualTimeKeyPrefix) - iterator := sdk.KVStorePrefixIterator(store, []byte{}) + iterator := storetypes.KVStorePrefixIterator(store, []byte{}) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { denom := string(iterator.Key()) @@ -565,7 +566,7 @@ func (k Keeper) SetDelegatorRewardIndexes(ctx sdk.Context, denom string, indexes // IterateDelegatorRewardIndexes iterates over all delegator reward index objects in the store and preforms a callback function func (k Keeper) IterateDelegatorRewardIndexes(ctx sdk.Context, cb func(denom string, indexes types.RewardIndexes) (stop bool)) { store := prefix.NewStore(ctx.KVStore(k.key), types.DelegatorRewardIndexesKeyPrefix) - iterator := sdk.KVStorePrefixIterator(store, []byte{}) + iterator := storetypes.KVStorePrefixIterator(store, []byte{}) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { var proto types.RewardIndexesProto @@ -578,7 +579,7 @@ func (k Keeper) IterateDelegatorRewardIndexes(ctx sdk.Context, cb func(denom str func (k Keeper) IterateDelegatorRewardAccrualTimes(ctx sdk.Context, cb func(string, time.Time) (stop bool)) { store := prefix.NewStore(ctx.KVStore(k.key), types.PreviousDelegatorRewardAccrualTimeKeyPrefix) - iterator := sdk.KVStorePrefixIterator(store, []byte{}) + iterator := storetypes.KVStorePrefixIterator(store, []byte{}) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { denom := string(iterator.Key()) @@ -685,7 +686,7 @@ func (k Keeper) GetSwapRewardIndexes(ctx sdk.Context, poolID string) (types.Rewa // IterateSwapRewardIndexes iterates over all swap reward index objects in the store and preforms a callback function func (k Keeper) IterateSwapRewardIndexes(ctx sdk.Context, cb func(poolID string, indexes types.RewardIndexes) (stop bool)) { store := prefix.NewStore(ctx.KVStore(k.key), types.SwapRewardIndexesKeyPrefix) - iterator := sdk.KVStorePrefixIterator(store, []byte{}) + iterator := storetypes.KVStorePrefixIterator(store, []byte{}) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { var proto types.RewardIndexesProto @@ -721,7 +722,7 @@ func (k Keeper) SetSwapRewardAccrualTime(ctx sdk.Context, poolID string, blockTi func (k Keeper) IterateSwapRewardAccrualTimes(ctx sdk.Context, cb func(string, time.Time) (stop bool)) { store := prefix.NewStore(ctx.KVStore(k.key), types.PreviousSwapRewardAccrualTimeKeyPrefix) - iterator := sdk.KVStorePrefixIterator(store, []byte{}) + iterator := storetypes.KVStorePrefixIterator(store, []byte{}) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { poolID := string(iterator.Key()) @@ -759,7 +760,7 @@ func (k Keeper) GetSavingsRewardIndexes(ctx sdk.Context, denom string) (types.Re // IterateSavingsRewardIndexes iterates over all savings reward index objects in the store and preforms a callback function func (k Keeper) IterateSavingsRewardIndexes(ctx sdk.Context, cb func(poolID string, indexes types.RewardIndexes) (stop bool)) { store := prefix.NewStore(ctx.KVStore(k.key), types.SavingsRewardIndexesKeyPrefix) - iterator := sdk.KVStorePrefixIterator(store, []byte{}) + iterator := storetypes.KVStorePrefixIterator(store, []byte{}) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { var proto types.RewardIndexesProto @@ -796,7 +797,7 @@ func (k Keeper) SetSavingsRewardAccrualTime(ctx sdk.Context, poolID string, bloc // IterateSavingsRewardAccrualTimes over all the previous savings reward accrual times in the store func (k Keeper) IterateSavingsRewardAccrualTimes(ctx sdk.Context, cb func(string, time.Time) (stop bool)) { store := prefix.NewStore(ctx.KVStore(k.key), types.PreviousSavingsRewardAccrualTimeKeyPrefix) - iterator := sdk.KVStorePrefixIterator(store, []byte{}) + iterator := storetypes.KVStorePrefixIterator(store, []byte{}) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { poolID := string(iterator.Key()) @@ -834,7 +835,7 @@ func (k Keeper) GetEarnRewardIndexes(ctx sdk.Context, vaultDenom string) (types. // IterateEarnRewardIndexes iterates over all earn reward index objects in the store and preforms a callback function func (k Keeper) IterateEarnRewardIndexes(ctx sdk.Context, cb func(vaultDenom string, indexes types.RewardIndexes) (stop bool)) { store := prefix.NewStore(ctx.KVStore(k.key), types.EarnRewardIndexesKeyPrefix) - iterator := sdk.KVStorePrefixIterator(store, []byte{}) + iterator := storetypes.KVStorePrefixIterator(store, []byte{}) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { var proto types.RewardIndexesProto @@ -870,7 +871,7 @@ func (k Keeper) SetEarnRewardAccrualTime(ctx sdk.Context, vaultDenom string, blo func (k Keeper) IterateEarnRewardAccrualTimes(ctx sdk.Context, cb func(string, time.Time) (stop bool)) { store := prefix.NewStore(ctx.KVStore(k.key), types.PreviousEarnRewardAccrualTimeKeyPrefix) - iterator := sdk.KVStorePrefixIterator(store, []byte{}) + iterator := storetypes.KVStorePrefixIterator(store, []byte{}) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { poolID := string(iterator.Key()) diff --git a/x/incentive/keeper/keeper_test.go b/x/incentive/keeper/keeper_test.go index 3ab619aa54..f18094d274 100644 --- a/x/incentive/keeper/keeper_test.go +++ b/x/incentive/keeper/keeper_test.go @@ -42,12 +42,12 @@ func (suite *KeeperTestSuite) SetupApp() { suite.keeper = suite.app.GetIncentiveKeeper() - suite.ctx = suite.app.NewContext(true, tmprototypes.Header{Time: suite.genesisTime}) + suite.ctx = suite.App.NewContextLegacy(true, tmprototypes.Header{Time: suite.genesisTime}) } func (suite *KeeperTestSuite) TestGetSetDeleteUSDXMintingClaim() { suite.SetupApp() - c := types.NewUSDXMintingClaim(suite.addrs[0], c("ukava", 1000000), types.RewardIndexes{types.NewRewardIndex("bnb-a", sdk.ZeroDec())}) + c := types.NewUSDXMintingClaim(suite.addrs[0], c("ukava", 1000000), types.RewardIndexes{types.NewRewardIndex("bnb-a", sdkmath.LegacyZeroDec())}) _, found := suite.keeper.GetUSDXMintingClaim(suite.ctx, suite.addrs[0]) suite.Require().False(found) suite.Require().NotPanics(func() { @@ -66,7 +66,7 @@ func (suite *KeeperTestSuite) TestGetSetDeleteUSDXMintingClaim() { func (suite *KeeperTestSuite) TestIterateUSDXMintingClaims() { suite.SetupApp() for i := 0; i < len(suite.addrs); i++ { - c := types.NewUSDXMintingClaim(suite.addrs[i], c("ukava", 100000), types.RewardIndexes{types.NewRewardIndex("bnb-a", sdk.ZeroDec())}) + c := types.NewUSDXMintingClaim(suite.addrs[i], c("ukava", 100000), types.RewardIndexes{types.NewRewardIndex("bnb-a", sdkmath.LegacyZeroDec())}) suite.Require().NotPanics(func() { suite.keeper.SetUSDXMintingClaim(suite.ctx, c) }) diff --git a/x/incentive/keeper/msg_server_earn_test.go b/x/incentive/keeper/msg_server_earn_test.go index 98fd3a53cf..d2ff81a763 100644 --- a/x/incentive/keeper/msg_server_earn_test.go +++ b/x/incentive/keeper/msg_server_earn_test.go @@ -205,15 +205,15 @@ func (suite *HandlerTestSuite) TestEarnLiquidClaim() { // User 2 gets 99% of rewards stakingRewards1 := delegationRewards. AmountOf("ukava"). - Quo(sdk.NewDec(100)). + Quo(sdkmath.LegacyNewDec(100)). RoundInt() suite.BalanceEquals(userAddr1, preClaimBal1.Add(sdk.NewCoin("ukava", stakingRewards1))) // Total * 99 / 100 stakingRewards2 := delegationRewards. AmountOf("ukava"). - Mul(sdk.NewDec(99)). - Quo(sdk.NewDec(100)). + Mul(sdkmath.LegacyNewDec(99)). + Quo(sdkmath.LegacyNewDec(100)). RoundInt() suite.BalanceInEpsilon( diff --git a/x/incentive/keeper/msg_server_swap_test.go b/x/incentive/keeper/msg_server_swap_test.go index 366fccb829..c0b73c1464 100644 --- a/x/incentive/keeper/msg_server_swap_test.go +++ b/x/incentive/keeper/msg_server_swap_test.go @@ -42,7 +42,7 @@ func (suite *HandlerTestSuite) SetupTest() { func (suite *HandlerTestSuite) SetupApp() { suite.App = app.NewTestApp() - suite.Ctx = suite.App.NewContext(true, tmproto.Header{Height: 1, Time: suite.genesisTime}) + suite.Ctx = suite.App.NewContextLegacy(true, tmproto.Header{Height: 1, Time: suite.genesisTime}) } func (suite *HandlerTestSuite) SetupWithGenState(builders ...testutil.GenesisBuilder) { diff --git a/x/incentive/keeper/payout.go b/x/incentive/keeper/payout.go index a50ef5a701..c3544e1b03 100644 --- a/x/incentive/keeper/payout.go +++ b/x/incentive/keeper/payout.go @@ -39,7 +39,7 @@ func (k Keeper) SendTimeLockedCoinsToAccount(ctx sdk.Context, senderModule strin } switch acc.(type) { - case *vestingtypes.ContinuousVestingAccount, authtypes.ModuleAccountI: + case *vestingtypes.ContinuousVestingAccount, sdk.ModuleAccountI: return errorsmod.Wrapf(types.ErrInvalidAccountType, "%T", acc) case *vestingtypes.PeriodicVestingAccount: return k.SendTimeLockedCoinsToPeriodicVestingAccount(ctx, senderModule, recipientAddr, amt, length) @@ -71,7 +71,11 @@ func (k Keeper) SendTimeLockedCoinsToBaseAccount(ctx sdk.Context, senderModule s bacc := authtypes.NewBaseAccount(acc.GetAddress(), acc.GetPubKey(), acc.GetAccountNumber(), acc.GetSequence()) newPeriods := vestingtypes.Periods{types.NewPeriod(amt, length)} - bva := vestingtypes.NewBaseVestingAccount(bacc, amt, ctx.BlockTime().Unix()+length) + bva, err := vestingtypes.NewBaseVestingAccount(bacc, amt, ctx.BlockTime().Unix()+length) + if err != nil { + return err + } + pva := vestingtypes.NewPeriodicVestingAccountRaw(bva, ctx.BlockTime().Unix(), newPeriods) k.accountKeeper.SetAccount(ctx, pva) diff --git a/x/incentive/keeper/payout_test.go b/x/incentive/keeper/payout_test.go index 0c20bfce19..d1483f9203 100644 --- a/x/incentive/keeper/payout_test.go +++ b/x/incentive/keeper/payout_test.go @@ -9,7 +9,6 @@ import ( tmprototypes "github.com/cometbft/cometbft/proto/tendermint/types" sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" "github.com/kava-labs/kava/app" @@ -54,7 +53,7 @@ func (suite *PayoutTestSuite) SetupApp() { suite.hardKeeper = suite.app.GetHardKeeper() suite.cdpKeeper = suite.app.GetCDPKeeper() - suite.ctx = suite.app.NewContext(true, tmprototypes.Header{Time: suite.genesisTime}) + suite.ctx = suite.App.NewContextLegacy(true, tmprototypes.Header{Time: suite.genesisTime}) } func (suite *PayoutTestSuite) SetupWithGenState(authBuilder app.AuthBankGenesisBuilder, incentBuilder testutil.IncentiveGenesisBuilder, hardBuilder testutil.HardGenesisBuilder) { @@ -70,12 +69,12 @@ func (suite *PayoutTestSuite) SetupWithGenState(authBuilder app.AuthBankGenesisB ) } -func (suite *PayoutTestSuite) getAccount(addr sdk.AccAddress) authtypes.AccountI { +func (suite *PayoutTestSuite) getAccount(addr sdk.AccAddress) sdk.AccountI { ak := suite.app.GetAccountKeeper() return ak.GetAccount(suite.ctx, addr) } -func (suite *PayoutTestSuite) getModuleAccount(name string) authtypes.ModuleAccountI { +func (suite *PayoutTestSuite) getModuleAccount(name string) sdk.ModuleAccountI { ak := suite.app.GetAccountKeeper() return ak.GetModuleAccount(suite.ctx, name) } diff --git a/x/incentive/keeper/querier.go b/x/incentive/keeper/querier.go index fc5832b33c..62eec59b68 100644 --- a/x/incentive/keeper/querier.go +++ b/x/incentive/keeper/querier.go @@ -16,19 +16,26 @@ const ( ) // GetStakingAPR returns the total APR for staking and incentive rewards -func GetStakingAPR(ctx sdk.Context, k Keeper, params types.Params) (sdk.Dec, error) { +func GetStakingAPR(ctx sdk.Context, k Keeper, params types.Params) (sdkmath.LegacyDec, error) { // Get staking APR + incentive APR inflationRate := k.mintKeeper.GetMinter(ctx).Inflation - communityTax := k.distrKeeper.GetCommunityTax(ctx) + communityTax, err := k.distrKeeper.GetCommunityTax(ctx) + if err != nil { + return sdkmath.LegacyZeroDec(), err + } + + bondedTokens, err := k.stakingKeeper.TotalBondedTokens(ctx) + if err != nil { + return sdkmath.LegacyZeroDec(), err + } - bondedTokens := k.stakingKeeper.TotalBondedTokens(ctx) circulatingSupply := k.bankKeeper.GetSupply(ctx, types.BondDenom) // Staking APR = (Inflation Rate * (1 - Community Tax)) / (Bonded Tokens / Circulating Supply) stakingAPR := inflationRate. - Mul(sdk.OneDec().Sub(communityTax)). - Quo(sdk.NewDecFromInt(bondedTokens). - Quo(sdk.NewDecFromInt(circulatingSupply.Amount))) + Mul(sdkmath.LegacyOneDec().Sub(communityTax)). + Quo(sdkmath.LegacyNewDecFromInt(bondedTokens). + Quo(sdkmath.LegacyNewDecFromInt(circulatingSupply.Amount))) // Get incentive APR bkavaRewardPeriod, found := params.EarnRewardPeriods.GetMultiRewardPeriod(liquidtypes.DefaultDerivativeDenom) @@ -39,7 +46,7 @@ func GetStakingAPR(ctx sdk.Context, k Keeper, params types.Params) (sdk.Dec, err // Total amount of bkava in earn vaults, this may be lower than total bank // supply of bkava as some bkava may not be deposited in earn vaults - totalEarnBkavaDeposited := sdk.ZeroInt() + totalEarnBkavaDeposited := sdkmath.ZeroInt() var iterErr error k.earnKeeper.IterateVaultRecords(ctx, func(record earntypes.VaultRecord) (stop bool) { @@ -59,14 +66,14 @@ func GetStakingAPR(ctx sdk.Context, k Keeper, params types.Params) (sdk.Dec, err }) if iterErr != nil { - return sdk.ZeroDec(), iterErr + return sdkmath.LegacyZeroDec(), iterErr } // Incentive APR = rewards per second * seconds per year / total supplied to earn vaults // Override collateral type to use "kava" instead of "bkava" when fetching incentiveAPY, err := GetAPYFromMultiRewardPeriod(ctx, k, types.BondDenom, bkavaRewardPeriod, totalEarnBkavaDeposited) if err != nil { - return sdk.ZeroDec(), err + return sdkmath.LegacyZeroDec(), err } totalAPY := stakingAPR.Add(incentiveAPY) @@ -80,24 +87,24 @@ func GetAPYFromMultiRewardPeriod( collateralType string, rewardPeriod types.MultiRewardPeriod, totalSupply sdkmath.Int, -) (sdk.Dec, error) { +) (sdkmath.LegacyDec, error) { if totalSupply.IsZero() { - return sdk.ZeroDec(), nil + return sdkmath.LegacyZeroDec(), nil } // Get USD value of collateral type collateralUSDValue, err := k.pricefeedKeeper.GetCurrentPrice(ctx, getMarketID(collateralType)) if err != nil { - return sdk.ZeroDec(), fmt.Errorf( + return sdkmath.LegacyZeroDec(), fmt.Errorf( "failed to get price for incentive collateralType %s with market ID %s: %w", collateralType, getMarketID(collateralType), err, ) } // Total USD value of the collateral type total supply - totalSupplyUSDValue := sdk.NewDecFromInt(totalSupply).Mul(collateralUSDValue.Price) + totalSupplyUSDValue := sdkmath.LegacyNewDecFromInt(totalSupply).Mul(collateralUSDValue.Price) - totalUSDRewardsPerSecond := sdk.ZeroDec() + totalUSDRewardsPerSecond := sdkmath.LegacyZeroDec() // In many cases, RewardsPerSecond are assets that are different from the // CollateralType, so we need to use the USD value of CollateralType and @@ -106,10 +113,10 @@ func GetAPYFromMultiRewardPeriod( // Get USD value of 1 unit of reward asset type, using TWAP rewardDenomUSDValue, err := k.pricefeedKeeper.GetCurrentPrice(ctx, getMarketID(reward.Denom)) if err != nil { - return sdk.ZeroDec(), fmt.Errorf("failed to get price for RewardsPerSecond asset %s: %w", reward.Denom, err) + return sdkmath.LegacyZeroDec(), fmt.Errorf("failed to get price for RewardsPerSecond asset %s: %w", reward.Denom, err) } - rewardPerSecond := sdk.NewDecFromInt(reward.Amount).Mul(rewardDenomUSDValue.Price) + rewardPerSecond := sdkmath.LegacyNewDecFromInt(reward.Amount).Mul(rewardDenomUSDValue.Price) totalUSDRewardsPerSecond = totalUSDRewardsPerSecond.Add(rewardPerSecond) } diff --git a/x/incentive/keeper/querier_test.go b/x/incentive/keeper/querier_test.go index 30bf0cbefb..5ceb21d54a 100644 --- a/x/incentive/keeper/querier_test.go +++ b/x/incentive/keeper/querier_test.go @@ -24,8 +24,8 @@ func TestQuerierTestSuite(t *testing.T) { } func (suite *QuerierTestSuite) TestGetStakingAPR() { - communityTax := sdk.MustNewDecFromStr("0.90") - inflation := sdk.MustNewDecFromStr("0.75") + communityTax := sdkmath.LegacyMustNewDecFromStr("0.90") + inflation := sdkmath.LegacyMustNewDecFromStr("0.75") bondedTokens := int64(120_000_000_000000) liquidStakedTokens := int64(60_000_000_000000) @@ -35,8 +35,8 @@ func (suite *QuerierTestSuite) TestGetStakingAPR() { usdcSupply := int64(2_500_000_000000) earnKeeper := newFakeEarnKeeper(). - addVault("bkava-asdf", earntypes.NewVaultShare("bkava-asdf", sdk.NewDec(liquidStakedTokens))). - addVault(usdcDenom, earntypes.NewVaultShare(usdcDenom, sdk.NewDec(usdcSupply))) + addVault("bkava-asdf", earntypes.NewVaultShare("bkava-asdf", sdkmath.LegacyNewDec(liquidStakedTokens))). + addVault(usdcDenom, earntypes.NewVaultShare(usdcDenom, sdkmath.LegacyNewDec(usdcSupply))) suite.keeper = suite.NewTestKeeper(&fakeParamSubspace{}). WithDistrKeeper( @@ -44,7 +44,7 @@ func (suite *QuerierTestSuite) TestGetStakingAPR() { ). WithMintKeeper( newFakeMintKeeper(). - setMinter(minttypes.NewMinter(inflation, sdk.OneDec())), + setMinter(minttypes.NewMinter(inflation, sdkmath.LegacyOneDec())), ). WithStakingKeeper( newFakeStakingKeeper().addBondedTokens(bondedTokens), @@ -58,15 +58,15 @@ func (suite *QuerierTestSuite) TestGetStakingAPR() { ). WithPricefeedKeeper( newFakePricefeedKeeper(). - setPrice(pricefeedtypes.NewCurrentPrice("kava:usd:30", sdk.MustNewDecFromStr("1.5"))). - setPrice(pricefeedtypes.NewCurrentPrice("usdc:usd:30", sdk.OneDec())), + setPrice(pricefeedtypes.NewCurrentPrice("kava:usd:30", sdkmath.LegacyMustNewDecFromStr("1.5"))). + setPrice(pricefeedtypes.NewCurrentPrice("usdc:usd:30", sdkmath.LegacyOneDec())), ). Build() // ~18% APR expectedStakingAPY := inflation. - Mul(sdk.OneDec().Sub(communityTax)). - Quo(sdk.NewDec(bondedTokens).Quo(sdk.NewDec(totalSupply))) + Mul(sdkmath.LegacyOneDec().Sub(communityTax)). + Quo(sdkmath.LegacyNewDec(bondedTokens).Quo(sdkmath.LegacyNewDec(totalSupply))) // Staking APR = (Inflation Rate * (1 - Community Tax)) / (Bonded Tokens / Circulating Supply) aprWithoutIncentives, err := keeper.GetStakingAPR(suite.ctx, suite.keeper, types.Params{}) @@ -105,7 +105,7 @@ func (suite *QuerierTestSuite) TestGetStakingAPR() { aprWithIncentives, err := keeper.GetStakingAPR(suite.ctx, suite.keeper, params) suite.Require().NoError(err) // Approx 10% increase in APR from incentives - suite.Require().Equal(sdk.MustNewDecFromStr("0.280711113729177500"), aprWithIncentives) + suite.Require().Equal(sdkmath.LegacyMustNewDecFromStr("0.280711113729177500"), aprWithIncentives) suite.Require().Truef( aprWithIncentives.GT(aprWithoutIncentives), @@ -127,7 +127,7 @@ func (suite *QuerierTestSuite) TestGetStakingAPR() { ) suite.Require().NoError(err) suite.Require().Equal( - sdk.MustNewDecFromStr("0.099981734400000000"), + sdkmath.LegacyMustNewDecFromStr("0.099981734400000000"), apy, "usdc apy should be approx 10%", ) diff --git a/x/incentive/keeper/rewards_borrow.go b/x/incentive/keeper/rewards_borrow.go index 44de0fb1ab..fa17733568 100644 --- a/x/incentive/keeper/rewards_borrow.go +++ b/x/incentive/keeper/rewards_borrow.go @@ -46,7 +46,7 @@ func (k Keeper) AccumulateHardBorrowRewards(ctx sdk.Context, rewardPeriod types. // The normalized borrow is also used for each individual borrow's source shares amount. Normalized amounts do not change except through // user input. This is essential as claims must be synced before any change to a source shares amount. The actual borrowed amounts cannot // be used as they increase every block due to interest. -func (k Keeper) getHardBorrowTotalSourceShares(ctx sdk.Context, denom string) sdk.Dec { +func (k Keeper) getHardBorrowTotalSourceShares(ctx sdk.Context, denom string) sdkmath.LegacyDec { totalBorrowedCoins, found := k.hardKeeper.GetBorrowedCoins(ctx) if !found { // assume no coins have been borrowed @@ -57,11 +57,11 @@ func (k Keeper) getHardBorrowTotalSourceShares(ctx sdk.Context, denom string) sd interestFactor, found := k.hardKeeper.GetBorrowInterestFactor(ctx, denom) if !found { // assume nothing has been borrowed so the factor starts at it's default value - interestFactor = sdk.OneDec() + interestFactor = sdkmath.LegacyOneDec() } // return borrowed/factor to get the "pre interest" value of the current total borrowed - return sdk.NewDecFromInt(totalBorrowed).Quo(interestFactor) + return sdkmath.LegacyNewDecFromInt(totalBorrowed).Quo(interestFactor) } // InitializeHardBorrowReward initializes the borrow-side of a hard liquidity provider claim @@ -108,7 +108,7 @@ func (k Keeper) SynchronizeHardBorrowReward(ctx sdk.Context, borrow hardtypes.Bo // synchronizeSingleHardBorrowReward synchronizes a single rewarded borrow denom in a hard claim. // It returns the claim without setting in the store. // The public methods for accessing and modifying claims are preferred over this one. Direct modification of claims is easy to get wrong. -func (k Keeper) synchronizeSingleHardBorrowReward(ctx sdk.Context, claim types.HardLiquidityProviderClaim, denom string, sourceShares sdk.Dec) types.HardLiquidityProviderClaim { +func (k Keeper) synchronizeSingleHardBorrowReward(ctx sdk.Context, claim types.HardLiquidityProviderClaim, denom string, sourceShares sdkmath.LegacyDec) types.HardLiquidityProviderClaim { globalRewardIndexes, found := k.GetHardBorrowRewardIndexes(ctx, denom) if !found { // The global factor is only not found if @@ -182,7 +182,7 @@ func (k Keeper) UpdateHardBorrowIndexDenoms(ctx sdk.Context, borrow hardtypes.Bo // // It returns an error if newIndexes does not contain all CollateralTypes from oldIndexes, or if any value of oldIndex.RewardFactor > newIndex.RewardFactor. // This should never happen, as it would mean that a global reward index has decreased in value, or that a global reward index has been deleted from state. -func (k Keeper) CalculateRewards(oldIndexes, newIndexes types.RewardIndexes, sourceShares sdk.Dec) (sdk.Coins, error) { +func (k Keeper) CalculateRewards(oldIndexes, newIndexes types.RewardIndexes, sourceShares sdkmath.LegacyDec) (sdk.Coins, error) { // check for missing CollateralType's for _, oldIndex := range oldIndexes { if newIndex, found := newIndexes.Get(oldIndex.CollateralType); !found { @@ -193,7 +193,7 @@ func (k Keeper) CalculateRewards(oldIndexes, newIndexes types.RewardIndexes, sou for _, newIndex := range newIndexes { oldFactor, found := oldIndexes.Get(newIndex.CollateralType) if !found { - oldFactor = sdk.ZeroDec() + oldFactor = sdkmath.LegacyZeroDec() } rewardAmount, err := k.CalculateSingleReward(oldFactor, newIndex.RewardFactor, sourceShares) @@ -215,7 +215,7 @@ func (k Keeper) CalculateRewards(oldIndexes, newIndexes types.RewardIndexes, sou // // Returns an error if oldIndex > newIndex. This should never happen, as it would mean that a global reward index has decreased in value, // or that a global reward index has been deleted from state. -func (k Keeper) CalculateSingleReward(oldIndex, newIndex, sourceShares sdk.Dec) (sdkmath.Int, error) { +func (k Keeper) CalculateSingleReward(oldIndex, newIndex, sourceShares sdkmath.LegacyDec) (sdkmath.Int, error) { increase := newIndex.Sub(oldIndex) if increase.IsNegative() { return sdkmath.Int{}, errorsmod.Wrapf(types.ErrDecreasingRewardFactor, "old: %v, new: %v", oldIndex, newIndex) diff --git a/x/incentive/keeper/rewards_borrow_sync_test.go b/x/incentive/keeper/rewards_borrow_sync_test.go index 8f9f9dc314..7bdf007e66 100644 --- a/x/incentive/keeper/rewards_borrow_sync_test.go +++ b/x/incentive/keeper/rewards_borrow_sync_test.go @@ -318,7 +318,7 @@ func (builder BorrowBuilder) Build() hardtypes.Borrow { return builder.Borrow } // WithSourceShares adds a borrow amount and factor such that the source shares for this borrow is equal to specified. // With a factor of 1, the borrow amount is the source shares. This picks an arbitrary factor to ensure factors are accounted for in production code. func (builder BorrowBuilder) WithSourceShares(denom string, shares int64) BorrowBuilder { - if !builder.Amount.AmountOf(denom).Equal(sdk.ZeroInt()) { + if !builder.Amount.AmountOf(denom).Equal(sdkmath.ZeroInt()) { panic("adding to amount with existing denom not implemented") } if _, f := builder.Index.GetInterestFactor(denom); f { @@ -326,7 +326,7 @@ func (builder BorrowBuilder) WithSourceShares(denom string, shares int64) Borrow } // pick arbitrary factor - factor := sdk.MustNewDecFromStr("2") + factor := sdkmath.LegacyMustNewDecFromStr("2") // Calculate borrow amount that would equal the requested source shares given the above factor. amt := sdkmath.NewInt(shares).Mul(factor.RoundInt()) @@ -352,7 +352,7 @@ func TestCalculateRewards(t *testing.T) { } type args struct { oldIndexes, newIndexes types.RewardIndexes - sourceAmount sdk.Dec + sourceAmount sdkmath.LegacyDec } testcases := []struct { name string @@ -512,8 +512,8 @@ func TestCalculateSingleReward(t *testing.T) { reward sdkmath.Int } type args struct { - oldIndex, newIndex sdk.Dec - sourceAmount sdk.Dec + oldIndex, newIndex sdkmath.LegacyDec + sourceAmount sdkmath.LegacyDec } testcases := []struct { name string @@ -551,7 +551,7 @@ func TestCalculateSingleReward(t *testing.T) { sourceAmount: d("1000000000"), }, expected: expected{ - reward: sdk.ZeroInt(), + reward: sdkmath.ZeroInt(), }, }, } diff --git a/x/incentive/keeper/rewards_borrow_test.go b/x/incentive/keeper/rewards_borrow_test.go index c76dd2ff68..49d1212e3b 100644 --- a/x/incentive/keeper/rewards_borrow_test.go +++ b/x/incentive/keeper/rewards_borrow_test.go @@ -126,7 +126,7 @@ func (suite *BorrowRewardsTestSuite) SetupApp() { suite.hardKeeper = suite.app.GetHardKeeper() suite.committeeKeeper = suite.app.GetCommitteeKeeper() - suite.ctx = suite.app.NewContext(true, tmproto.Header{Height: 1, Time: suite.genesisTime}) + suite.ctx = suite.App.NewContextLegacy(true, tmproto.Header{Height: 1, Time: suite.genesisTime}) } func (suite *BorrowRewardsTestSuite) SetupWithGenState(authBuilder *app.AuthBankGenesisBuilder, incentBuilder testutil.IncentiveGenesisBuilder, hardBuilder testutil.HardGenesisBuilder) { @@ -585,7 +585,7 @@ func (suite *BorrowRewardsTestSuite) TestSynchronizeHardBorrowReward() { incentBuilder = incentBuilder.WithSimpleBorrowRewardPeriod(tc.args.incentiveBorrowRewardDenom, tc.args.rewardsPerSecond) } // Set the minimum borrow to 0 to allow testing small borrows - hardBuilder := NewHardGenStateMulti(suite.genesisTime).WithMinBorrow(sdk.ZeroDec()) + hardBuilder := NewHardGenStateMulti(suite.genesisTime).WithMinBorrow(sdkmath.LegacyZeroDec()) suite.SetupWithGenState(authBuilder, incentBuilder, hardBuilder) @@ -610,7 +610,7 @@ func (suite *BorrowRewardsTestSuite) TestSynchronizeHardBorrowReward() { for _, expectedRewardIndex := range tc.args.expectedRewardIndexes { currRewardIndex, found := multiRewardIndex.RewardIndexes.GetRewardIndex(expectedRewardIndex.CollateralType) suite.Require().True(found) - suite.Require().Equal(sdk.ZeroDec(), currRewardIndex.RewardFactor) + suite.Require().Equal(sdkmath.LegacyZeroDec(), currRewardIndex.RewardFactor) } // Run accumulator at several intervals @@ -1045,7 +1045,7 @@ func (suite *BorrowRewardsTestSuite) TestSimulateHardBorrowRewardSynchronization for _, expectedRewardIndex := range tc.args.expectedRewardIndexes { currRewardIndex, found := multiRewardIndexPre.RewardIndexes.GetRewardIndex(expectedRewardIndex.CollateralType) suite.Require().True(found) - suite.Require().Equal(sdk.ZeroDec(), currRewardIndex.RewardFactor) + suite.Require().Equal(sdkmath.LegacyZeroDec(), currRewardIndex.RewardFactor) } // Check that the synced claim held in memory has properly simulated syncing diff --git a/x/incentive/keeper/rewards_delegator.go b/x/incentive/keeper/rewards_delegator.go index 77d58a17be..d9c682e0a1 100644 --- a/x/incentive/keeper/rewards_delegator.go +++ b/x/incentive/keeper/rewards_delegator.go @@ -1,8 +1,9 @@ package keeper import ( + "bytes" + sdkmath "cosmossdk.io/math" "fmt" - sdk "github.com/cosmos/cosmos-sdk/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" @@ -37,10 +38,15 @@ func (k Keeper) AccumulateDelegatorRewards(ctx sdk.Context, rewardPeriod types.M // getDelegatorTotalSourceShares fetches the sum of all source shares for a delegator reward. // In the case of delegation, this is the total tokens staked to bonded validators. -func (k Keeper) getDelegatorTotalSourceShares(ctx sdk.Context, denom string) sdk.Dec { - totalBonded := k.stakingKeeper.TotalBondedTokens(ctx) +func (k Keeper) getDelegatorTotalSourceShares(ctx sdk.Context, denom string) sdkmath.LegacyDec { + totalBonded, err := k.stakingKeeper.TotalBondedTokens(ctx) + if err != nil { + // TODO(boodyvo): should we panic here or return zero? + //panic(fmt.Sprintf("could not retrieve total bonded tokens: %v", err)) + return sdkmath.LegacyZeroDec() + } - return sdk.NewDecFromInt(totalBonded) + return sdkmath.LegacyNewDecFromInt(totalBonded) } // InitializeDelegatorReward initializes the reward index of a delegator claim @@ -98,7 +104,7 @@ func (k Keeper) SynchronizeDelegatorRewards(ctx sdk.Context, delegator sdk.AccAd userRewardIndexes, found := claim.RewardIndexes.Get(types.BondDenom) if !found { // Normally the reward indexes should always be found. - // However if there were no delegator rewards (ie no reward period in params) then a reward period is added, existing claims will not have the factor. + // However, if there were no delegator rewards (ie no reward period in params) then a reward period is added, existing claims will not have the factor. // So given the reward period was just added, assume the starting value for any global reward indexes, which is an empty slice. userRewardIndexes = types.RewardIndexes{} } @@ -117,17 +123,24 @@ func (k Keeper) SynchronizeDelegatorRewards(ctx sdk.Context, delegator sdk.AccAd k.SetDelegatorClaim(ctx, claim) } -func (k Keeper) GetTotalDelegated(ctx sdk.Context, delegator sdk.AccAddress, valAddr sdk.ValAddress, shouldIncludeValidator bool) sdk.Dec { - totalDelegated := sdk.ZeroDec() +func (k Keeper) GetTotalDelegated(ctx sdk.Context, delegator sdk.AccAddress, valAddr sdk.ValAddress, shouldIncludeValidator bool) sdkmath.LegacyDec { + totalDelegated := sdkmath.LegacyZeroDec() + + delegations, err := k.stakingKeeper.GetDelegatorDelegations(ctx, delegator, 200) + if err != nil { + // TODO(boodyvo): should we panic here or return zero? + return totalDelegated + } - delegations := k.stakingKeeper.GetDelegatorDelegations(ctx, delegator, 200) for _, delegation := range delegations { - validator, found := k.stakingKeeper.GetValidator(ctx, delegation.GetValidatorAddr()) - if !found { + validator, err := k.stakingKeeper.GetValidator(ctx, []byte(delegation.GetValidatorAddr())) + if err != nil { continue } - if validator.GetOperator().Equals(valAddr) { + //if validator.GetOperator().Equals(valAddr) { + // TODO(boodyvo): was updated. Should be like this? + if bytes.Equal([]byte(validator.GetOperator()), valAddr) { if shouldIncludeValidator { // do nothing, so the validator is included regardless of bonded status } else { @@ -178,7 +191,7 @@ func (k Keeper) SimulateDelegatorSynchronization(ctx sdk.Context, claim types.De for _, globalRewardIndex := range globalRewardIndexes { userRewardIndex, foundUserRewardIndex := userRewardIndexes.RewardIndexes.GetRewardIndex(globalRewardIndex.CollateralType) if !foundUserRewardIndex { - userRewardIndex = types.NewRewardIndex(globalRewardIndex.CollateralType, sdk.ZeroDec()) + userRewardIndex = types.NewRewardIndex(globalRewardIndex.CollateralType, sdkmath.LegacyZeroDec()) userRewardIndexes.RewardIndexes = append(userRewardIndexes.RewardIndexes, userRewardIndex) claim.RewardIndexes[userRewardIndexIndex].RewardIndexes = append(claim.RewardIndexes[userRewardIndexIndex].RewardIndexes, userRewardIndex) } diff --git a/x/incentive/keeper/rewards_delegator_sync_test.go b/x/incentive/keeper/rewards_delegator_sync_test.go index 829aacaee3..03c24b8d3f 100644 --- a/x/incentive/keeper/rewards_delegator_sync_test.go +++ b/x/incentive/keeper/rewards_delegator_sync_test.go @@ -247,7 +247,7 @@ func unslashedBondedValidator(address sdk.ValAddress) stakingtypes.Validator { // Set the tokens and shares equal so then // a _delegator's_ token amount is equal to their shares amount Tokens: i(1e12), - DelegatorShares: sdk.NewDec(1e12), + DelegatorShares: sdkmath.LegacyNewDec(1e12), } } @@ -259,7 +259,7 @@ func unslashedNotBondedValidator(address sdk.ValAddress) stakingtypes.Validator // Set the tokens and shares equal so then // a _delegator's_ token amount is equal to their shares amount Tokens: i(1e12), - DelegatorShares: sdk.NewDec(1e12), + DelegatorShares: sdkmath.LegacyNewDec(1e12), } } diff --git a/x/incentive/keeper/rewards_delegator_test.go b/x/incentive/keeper/rewards_delegator_test.go index 6402e17a66..0b0cfe14cc 100644 --- a/x/incentive/keeper/rewards_delegator_test.go +++ b/x/incentive/keeper/rewards_delegator_test.go @@ -54,7 +54,7 @@ func (suite *DelegatorRewardsTestSuite) SetupApp() { suite.keeper = suite.app.GetIncentiveKeeper() suite.stakingKeeper = suite.app.GetStakingKeeper() - suite.ctx = suite.app.NewContext(true, tmproto.Header{Height: 1, Time: suite.genesisTime, ChainID: app.TestChainId}) + suite.ctx = suite.App.NewContextLegacy(true, tmproto.Header{Height: 1, Time: suite.genesisTime, ChainID: app.TestChainId}) } func (suite *DelegatorRewardsTestSuite) SetupWithGenState(authBuilder *app.AuthBankGenesisBuilder, incentBuilder testutil.IncentiveGenesisBuilder) { @@ -262,7 +262,7 @@ func (suite *DelegatorRewardsTestSuite) TestSynchronizeDelegatorReward() { claim, found := suite.keeper.GetDelegatorClaim(suite.ctx, suite.addrs[0]) suite.Require().True(found) for _, rewardIndex := range claim.RewardIndexes[0].RewardIndexes { - suite.Require().Equal(sdk.ZeroDec(), rewardIndex.RewardFactor) + suite.Require().Equal(sdkmath.LegacyZeroDec(), rewardIndex.RewardFactor) } // Run accumulator at several intervals @@ -380,7 +380,7 @@ func (suite *DelegatorRewardsTestSuite) TestSimulateDelegatorRewardSynchronizati claim, found := suite.keeper.GetDelegatorClaim(suite.ctx, suite.addrs[0]) suite.Require().True(found) for _, rewardIndex := range claim.RewardIndexes[0].RewardIndexes { - suite.Require().Equal(sdk.ZeroDec(), rewardIndex.RewardFactor) + suite.Require().Equal(sdkmath.LegacyZeroDec(), rewardIndex.RewardFactor) } // Run accumulator at several intervals @@ -425,7 +425,7 @@ func (suite *DelegatorRewardsTestSuite) deliverMsgCreateValidator(ctx sdk.Contex ed25519.GenPrivKey().PubKey(), selfDelegation, stakingtypes.Description{}, - stakingtypes.NewCommissionRates(sdk.ZeroDec(), sdk.ZeroDec(), sdk.ZeroDec()), + stakingtypes.NewCommissionRates(sdkmath.LegacyZeroDec(), sdkmath.LegacyZeroDec(), sdkmath.LegacyZeroDec()), sdkmath.NewInt(1_000_000), ) if err != nil { diff --git a/x/incentive/keeper/rewards_earn.go b/x/incentive/keeper/rewards_earn.go index 6d176efd95..a678cb52b5 100644 --- a/x/incentive/keeper/rewards_earn.go +++ b/x/incentive/keeper/rewards_earn.go @@ -51,9 +51,9 @@ func GetProportionalRewardsPerSecond( } for _, rewardCoin := range rewardPeriod.RewardsPerSecond { - scaledAmount := sdk.NewDecFromInt(rewardCoin.Amount). - Mul(sdk.NewDecFromInt(singleBkavaSupply)). - Quo(sdk.NewDecFromInt(totalBkavaSupply)) + scaledAmount := sdkmath.LegacyNewDecFromInt(rewardCoin.Amount). + Mul(sdkmath.LegacyNewDecFromInt(singleBkavaSupply)). + Quo(sdkmath.LegacyNewDecFromInt(totalBkavaSupply)) newRate = newRate.Add(sdk.NewDecCoinFromDec(rewardCoin.Denom, scaledAmount)) } @@ -156,7 +156,7 @@ func (k Keeper) accumulateBkavaEarnRewards( totalSourceShares := k.getEarnTotalSourceShares(ctx, collateralType) var increment types.RewardIndexes - if totalSourceShares.GT(sdk.ZeroDec()) { + if totalSourceShares.GT(sdkmath.LegacyZeroDec()) { // Divide total rewards by total shares to get the reward **per share** // Leave as nil if no source shares increment = types.NewRewardIndexesFromCoins(rewards).Quo(totalSourceShares) @@ -258,10 +258,10 @@ func (k Keeper) accumulateEarnRewards( // getEarnTotalSourceShares fetches the sum of all source shares for a earn reward. // In the case of earn, these are the total (earn module) shares in a particular vault. -func (k Keeper) getEarnTotalSourceShares(ctx sdk.Context, vaultDenom string) sdk.Dec { +func (k Keeper) getEarnTotalSourceShares(ctx sdk.Context, vaultDenom string) sdkmath.LegacyDec { totalShares, found := k.earnKeeper.GetVaultTotalShares(ctx, vaultDenom) if !found { - return sdk.ZeroDec() + return sdkmath.LegacyZeroDec() } return totalShares.Amount } @@ -289,7 +289,7 @@ func (k Keeper) SynchronizeEarnReward( ctx sdk.Context, vaultDenom string, owner sdk.AccAddress, - shares sdk.Dec, + shares sdkmath.LegacyDec, ) { claim, found := k.GetEarnClaim(ctx, owner) if !found { @@ -306,7 +306,7 @@ func (k *Keeper) synchronizeEarnReward( claim types.EarnClaim, vaultDenom string, owner sdk.AccAddress, - shares sdk.Dec, + shares sdkmath.LegacyDec, ) types.EarnClaim { globalRewardIndexes, found := k.GetEarnRewardIndexes(ctx, vaultDenom) if !found { diff --git a/x/incentive/keeper/rewards_earn_accum_integration_test.go b/x/incentive/keeper/rewards_earn_accum_integration_test.go index 892323dbde..8be47700b5 100644 --- a/x/incentive/keeper/rewards_earn_accum_integration_test.go +++ b/x/incentive/keeper/rewards_earn_accum_integration_test.go @@ -65,9 +65,9 @@ func (suite *AccumulateEarnRewardsIntegrationTests) SetupTest() { stakingBuilder := testutil.NewStakingGenesisBuilder() mintBuilder := testutil.NewMintGenesisBuilder(). - WithInflationMax(sdk.OneDec()). - WithInflationMin(sdk.OneDec()). - WithMinter(sdk.OneDec(), sdk.ZeroDec()). + WithInflationMax(sdkmath.LegacyOneDec()). + WithInflationMin(sdkmath.LegacyOneDec()). + WithMinter(sdkmath.LegacyOneDec(), sdkmath.LegacyZeroDec()). WithMintDenom("ukava") suite.StartChainWithBuilders( @@ -168,13 +168,13 @@ func (suite *AccumulateEarnRewardsIntegrationTests) TestStateUpdatedWhenBlockTim suite.StoredEarnTimeEquals(derivative0.Denom, suite.Ctx.BlockTime()) suite.StoredEarnTimeEquals(derivative1.Denom, suite.Ctx.BlockTime()) - stakingRewardIndexes0 := sdk.NewDecFromInt(validatorRewards[suite.valAddrs[0].String()]. + stakingRewardIndexes0 := sdkmath.LegacyNewDecFromInt(validatorRewards[suite.valAddrs[0].String()]. AmountOf("ukava")). - Quo(sdk.NewDecFromInt(derivative0.Amount)) + Quo(sdkmath.LegacyNewDecFromInt(derivative0.Amount)) - stakingRewardIndexes1 := sdk.NewDecFromInt(validatorRewards[suite.valAddrs[1].String()]. + stakingRewardIndexes1 := sdkmath.LegacyNewDecFromInt(validatorRewards[suite.valAddrs[1].String()]. AmountOf("ukava")). - Quo(sdk.NewDecFromInt(derivative1.Amount)) + Quo(sdkmath.LegacyNewDecFromInt(derivative1.Amount)) suite.StoredEarnIndexesEqual(derivative0.Denom, types.RewardIndexes{ { @@ -293,13 +293,13 @@ func (suite *AccumulateEarnRewardsIntegrationTests) TestStateUpdatedWhenBlockTim suite.StoredEarnTimeEquals(derivative1.Denom, suite.Ctx.BlockTime()) // Divided by deposit amounts, not bank supply amounts - stakingRewardIndexes0 := sdk.NewDecFromInt(validatorRewards[suite.valAddrs[0].String()]. + stakingRewardIndexes0 := sdkmath.LegacyNewDecFromInt(validatorRewards[suite.valAddrs[0].String()]. AmountOf("ukava")). - Quo(sdk.NewDecFromInt(depositAmount0.Amount)) + Quo(sdkmath.LegacyNewDecFromInt(depositAmount0.Amount)) - stakingRewardIndexes1 := sdk.NewDecFromInt(validatorRewards[suite.valAddrs[1].String()]. + stakingRewardIndexes1 := sdkmath.LegacyNewDecFromInt(validatorRewards[suite.valAddrs[1].String()]. AmountOf("ukava")). - Quo(sdk.NewDecFromInt(depositAmount1.Amount)) + Quo(sdkmath.LegacyNewDecFromInt(depositAmount1.Amount)) // Slightly increased rewards due to less bkava deposited suite.StoredEarnIndexesEqual(derivative0.Denom, types.RewardIndexes{ @@ -532,13 +532,13 @@ func (suite *AccumulateEarnRewardsIntegrationTests) TestStateAddedWhenStateDoesN validatorRewards0, _ := suite.GetBeginBlockClaimedStakingRewards(resBeginBlock) - firstStakingRewardIndexes0 := sdk.NewDecFromInt(validatorRewards0[suite.valAddrs[0].String()]. + firstStakingRewardIndexes0 := sdkmath.LegacyNewDecFromInt(validatorRewards0[suite.valAddrs[0].String()]. AmountOf("ukava")). - Quo(sdk.NewDecFromInt(derivative0.Amount)) + Quo(sdkmath.LegacyNewDecFromInt(derivative0.Amount)) - firstStakingRewardIndexes1 := sdk.NewDecFromInt(validatorRewards0[suite.valAddrs[1].String()]. + firstStakingRewardIndexes1 := sdkmath.LegacyNewDecFromInt(validatorRewards0[suite.valAddrs[1].String()]. AmountOf("ukava")). - Quo(sdk.NewDecFromInt(derivative1.Amount)) + Quo(sdkmath.LegacyNewDecFromInt(derivative1.Amount)) // After the first accumulation only the current block time should be stored. // The indexes will be empty as no time has passed since the previous block because it didn't exist. @@ -584,13 +584,13 @@ func (suite *AccumulateEarnRewardsIntegrationTests) TestStateAddedWhenStateDoesN validatorRewards1, _ := suite.GetBeginBlockClaimedStakingRewards(resBeginBlock) - secondStakingRewardIndexes0 := sdk.NewDecFromInt(validatorRewards1[suite.valAddrs[0].String()]. + secondStakingRewardIndexes0 := sdkmath.LegacyNewDecFromInt(validatorRewards1[suite.valAddrs[0].String()]. AmountOf("ukava")). - Quo(sdk.NewDecFromInt(derivative0.Amount)) + Quo(sdkmath.LegacyNewDecFromInt(derivative0.Amount)) - secondStakingRewardIndexes1 := sdk.NewDecFromInt(validatorRewards1[suite.valAddrs[1].String()]. + secondStakingRewardIndexes1 := sdkmath.LegacyNewDecFromInt(validatorRewards1[suite.valAddrs[1].String()]. AmountOf("ukava")). - Quo(sdk.NewDecFromInt(derivative1.Amount)) + Quo(sdkmath.LegacyNewDecFromInt(derivative1.Amount)) // Second accumulation has both staking rewards and incentive rewards // ukava incentive rewards: 3600 * 1000 / (2 * 1000000) == 1.8 diff --git a/x/incentive/keeper/rewards_earn_accum_test.go b/x/incentive/keeper/rewards_earn_accum_test.go index c83e47edce..e2f4e1eca2 100644 --- a/x/incentive/keeper/rewards_earn_accum_test.go +++ b/x/incentive/keeper/rewards_earn_accum_test.go @@ -4,7 +4,6 @@ import ( "testing" "time" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/suite" earntypes "github.com/kava-labs/kava/x/earn/types" @@ -261,10 +260,10 @@ func (suite *AccumulateEarnRewardsTests) TestStateUpdatedWhenBlockTimeHasIncreas { CollateralType: "ukava", RewardFactor: d("4.154285714285714286"). // base incentive - Add(sdk.NewDecFromInt(vaultDenom1Supply). // staking rewards - QuoInt64(10). - MulInt64(3600). - Quo(vault1Shares), + Add(sdkmath.LegacyNewDecFromInt(vaultDenom1Supply). // staking rewards + QuoInt64(10). + MulInt64(3600). + Quo(vault1Shares), ), }, }) @@ -292,7 +291,7 @@ func (suite *AccumulateEarnRewardsTests) TestStateUpdatedWhenBlockTimeHasIncreas { CollateralType: "ukava", RewardFactor: d("7.24"). - Add(sdk.NewDecFromInt(vaultDenom2Supply). + Add(sdkmath.LegacyNewDecFromInt(vaultDenom2Supply). QuoInt64(10). MulInt64(3600). Quo(vault2Shares), diff --git a/x/incentive/keeper/rewards_earn_staking_integration_test.go b/x/incentive/keeper/rewards_earn_staking_integration_test.go index 59466c139c..24c9f26bb1 100644 --- a/x/incentive/keeper/rewards_earn_staking_integration_test.go +++ b/x/incentive/keeper/rewards_earn_staking_integration_test.go @@ -64,9 +64,9 @@ func (suite *EarnStakingRewardsIntegrationTestSuite) SetupTest() { stakingBuilder := testutil.NewStakingGenesisBuilder() mintBuilder := testutil.NewMintGenesisBuilder(). - WithInflationMax(sdk.OneDec()). - WithInflationMin(sdk.OneDec()). - WithMinter(sdk.OneDec(), sdk.ZeroDec()). + WithInflationMax(sdkmath.LegacyOneDec()). + WithInflationMin(sdkmath.LegacyOneDec()). + WithMinter(sdkmath.LegacyOneDec(), sdkmath.LegacyZeroDec()). WithMintDenom("ukava") suite.StartChainWithBuilders( @@ -166,13 +166,13 @@ func (suite *EarnStakingRewardsIntegrationTestSuite) TestStakingRewardsDistribut // Total staking rewards / total source shares (**deposited in earn** not total minted) // types.RewardIndexes.Quo() uses Dec.Quo() which uses bankers rounding. // So we need to use Dec.Quo() to also round vs Dec.QuoInt() which truncates - expectedIndexes1 := sdk.NewDecFromInt(validatorRewards[suite.valAddrs[0].String()]. + expectedIndexes1 := sdkmath.LegacyNewDecFromInt(validatorRewards[suite.valAddrs[0].String()]. AmountOf("ukava")). - Quo(sdk.NewDecFromInt(userDepositAmount0)) + Quo(sdkmath.LegacyNewDecFromInt(userDepositAmount0)) - expectedIndexes2 := sdk.NewDecFromInt(validatorRewards[suite.valAddrs[1].String()]. + expectedIndexes2 := sdkmath.LegacyNewDecFromInt(validatorRewards[suite.valAddrs[1].String()]. AmountOf("ukava")). - Quo(sdk.NewDecFromInt(userDepositAmount1)) + Quo(sdkmath.LegacyNewDecFromInt(userDepositAmount1)) // Only contains staking rewards suite.StoredEarnIndexesEqual(vaultDenom1, types.RewardIndexes{ diff --git a/x/incentive/keeper/rewards_earn_staking_test.go b/x/incentive/keeper/rewards_earn_staking_test.go index 5df7ed1775..277d55921d 100644 --- a/x/incentive/keeper/rewards_earn_staking_test.go +++ b/x/incentive/keeper/rewards_earn_staking_test.go @@ -3,7 +3,6 @@ package keeper_test import ( "time" - sdk "github.com/cosmos/cosmos-sdk/types" earntypes "github.com/kava-labs/kava/x/earn/types" "github.com/kava-labs/kava/x/incentive/types" ) @@ -84,7 +83,7 @@ func (suite *AccumulateEarnRewardsTests) TestStakingRewardsDistributed() { { CollateralType: "ukava", RewardFactor: initialVault1RewardFactor. - Add(sdk.NewDecFromInt(vaultDenom1Supply). + Add(sdkmath.LegacyNewDecFromInt(vaultDenom1Supply). QuoInt64(10). MulInt64(3600). Quo(vault1Shares)), @@ -95,7 +94,7 @@ func (suite *AccumulateEarnRewardsTests) TestStakingRewardsDistributed() { { CollateralType: "ukava", RewardFactor: initialVault2RewardFactor. - Add(sdk.NewDecFromInt(vaultDenom2Supply). + Add(sdkmath.LegacyNewDecFromInt(vaultDenom2Supply). QuoInt64(10). MulInt64(3600). Quo(vault2Shares)), diff --git a/x/incentive/keeper/rewards_savings.go b/x/incentive/keeper/rewards_savings.go index 1b843bdfcf..7969499964 100644 --- a/x/incentive/keeper/rewards_savings.go +++ b/x/incentive/keeper/rewards_savings.go @@ -1,6 +1,7 @@ package keeper import ( + sdkmath "cosmossdk.io/math" "fmt" sdk "github.com/cosmos/cosmos-sdk/types" @@ -27,7 +28,7 @@ func (k Keeper) AccumulateSavingsRewards(ctx sdk.Context, rewardPeriod types.Mul maccCoins := k.bankKeeper.GetAllBalances(ctx, savingsMacc.GetAddress()) denomBalance := maccCoins.AmountOf(rewardPeriod.CollateralType) - acc.Accumulate(rewardPeriod, sdk.NewDecFromInt(denomBalance), ctx.BlockTime()) + acc.Accumulate(rewardPeriod, sdkmath.LegacyNewDecFromInt(denomBalance), ctx.BlockTime()) k.SetSavingsRewardAccrualTime(ctx, rewardPeriod.CollateralType, acc.PreviousAccumulationTime) @@ -78,7 +79,7 @@ func (k Keeper) SynchronizeSavingsReward(ctx sdk.Context, deposit savingstypes.D // Existing denoms have their reward indexes + reward amount synced existingDenoms := setDifference(getDenoms(deposit.Amount), incomingDenoms) for _, denom := range existingDenoms { - claim = k.synchronizeSingleSavingsReward(ctx, claim, denom, sdk.NewDecFromInt(deposit.Amount.AmountOf(denom))) + claim = k.synchronizeSingleSavingsReward(ctx, claim, denom, sdkmath.LegacyNewDecFromInt(deposit.Amount.AmountOf(denom))) } k.SetSavingsClaim(ctx, claim) @@ -87,7 +88,7 @@ func (k Keeper) SynchronizeSavingsReward(ctx sdk.Context, deposit savingstypes.D // synchronizeSingleSavingsReward synchronizes a single rewarded savings denom in a savings claim. // It returns the claim without setting in the store. // The public methods for accessing and modifying claims are preferred over this one. Direct modification of claims is easy to get wrong. -func (k Keeper) synchronizeSingleSavingsReward(ctx sdk.Context, claim types.SavingsClaim, denom string, sourceShares sdk.Dec) types.SavingsClaim { +func (k Keeper) synchronizeSingleSavingsReward(ctx sdk.Context, claim types.SavingsClaim, denom string, sourceShares sdkmath.LegacyDec) types.SavingsClaim { globalRewardIndexes, found := k.GetSavingsRewardIndexes(ctx, denom) if !found { // The global factor is only not found if @@ -133,7 +134,7 @@ func (k Keeper) GetSynchronizedSavingsClaim(ctx sdk.Context, owner sdk.AccAddres } for _, coin := range deposit.Amount { - claim = k.synchronizeSingleSavingsReward(ctx, claim, coin.Denom, sdk.NewDecFromInt(coin.Amount)) + claim = k.synchronizeSingleSavingsReward(ctx, claim, coin.Denom, sdkmath.LegacyNewDecFromInt(coin.Amount)) } return claim, true diff --git a/x/incentive/keeper/rewards_savings_accum_test.go b/x/incentive/keeper/rewards_savings_accum_test.go index 2485669a5d..e4f475506b 100644 --- a/x/incentive/keeper/rewards_savings_accum_test.go +++ b/x/incentive/keeper/rewards_savings_accum_test.go @@ -47,7 +47,7 @@ func (suite *SavingsRewardsTestSuite) SetupApp() { suite.keeper = suite.app.GetIncentiveKeeper() suite.savingsKeeper = suite.app.GetSavingsKeeper() - suite.ctx = suite.app.NewContext(true, tmproto.Header{Height: 1, Time: suite.genesisTime}) + suite.ctx = suite.App.NewContextLegacy(true, tmproto.Header{Height: 1, Time: suite.genesisTime}) } func (suite *SavingsRewardsTestSuite) SetupWithGenState(authBuilder *app.AuthBankGenesisBuilder, incentBuilder testutil.IncentiveGenesisBuilder, diff --git a/x/incentive/keeper/rewards_savings_init_test.go b/x/incentive/keeper/rewards_savings_init_test.go index f9b7bac200..3bad5a4086 100644 --- a/x/incentive/keeper/rewards_savings_init_test.go +++ b/x/incentive/keeper/rewards_savings_init_test.go @@ -28,7 +28,7 @@ func (suite *InitializeSavingsRewardTests) TestClaimAddedWhenClaimDoesNotExistAn owner := arbitraryAddress() - amount := sdk.NewCoin("test", sdk.OneInt()) + amount := sdk.NewCoin("test", sdkmath.OneInt()) deposit := savingstypes.NewDeposit(owner, sdk.NewCoins(amount)) suite.keeper.InitializeSavingsReward(suite.ctx, deposit) @@ -49,7 +49,7 @@ func (suite *InitializeSavingsRewardTests) TestClaimAddedWhenClaimDoesNotExistAn // When a claim doesn't exist, and a user deposits to a rewarded pool; // then a claim is added with no rewards and indexes matching the global indexes - amount := sdk.NewCoin("test", sdk.OneInt()) + amount := sdk.NewCoin("test", sdkmath.OneInt()) globalIndexes := types.MultiRewardIndexes{ { @@ -105,7 +105,7 @@ func (suite *InitializeSavingsRewardTests) TestClaimUpdatedWhenClaimExistsAndNoR // no global indexes stored as the new denom is not rewarded newDenom := "test" - deposit := savingstypes.NewDeposit(claim.Owner, sdk.NewCoins(sdk.NewCoin(newDenom, sdk.OneInt()))) + deposit := savingstypes.NewDeposit(claim.Owner, sdk.NewCoins(sdk.NewCoin(newDenom, sdkmath.OneInt()))) suite.keeper.InitializeSavingsReward(suite.ctx, deposit) syncedClaim, found := suite.keeper.GetSavingsClaim(suite.ctx, claim.Owner) @@ -173,7 +173,7 @@ func (suite *InitializeSavingsRewardTests) TestClaimUpdatedWhenClaimExistsAndRew } suite.storeGlobalSavingsIndexes(globalIndexes) - deposit := savingstypes.NewDeposit(claim.Owner, sdk.NewCoins(sdk.NewCoin(newDenom, sdk.OneInt()))) + deposit := savingstypes.NewDeposit(claim.Owner, sdk.NewCoins(sdk.NewCoin(newDenom, sdkmath.OneInt()))) suite.keeper.InitializeSavingsReward(suite.ctx, deposit) syncedClaim, _ := suite.keeper.GetSavingsClaim(suite.ctx, claim.Owner) diff --git a/x/incentive/keeper/rewards_supply.go b/x/incentive/keeper/rewards_supply.go index bc97694b73..cc6af6530d 100644 --- a/x/incentive/keeper/rewards_supply.go +++ b/x/incentive/keeper/rewards_supply.go @@ -1,6 +1,7 @@ package keeper import ( + sdkmath "cosmossdk.io/math" "fmt" sdk "github.com/cosmos/cosmos-sdk/types" @@ -38,7 +39,7 @@ func (k Keeper) AccumulateHardSupplyRewards(ctx sdk.Context, rewardPeriod types. // getHardSupplyTotalSourceShares fetches the sum of all source shares for a supply reward. // In the case of hard supply, this is the total supplied divided by the supply interest factor. // This gives the "pre interest" value of the total supplied. -func (k Keeper) getHardSupplyTotalSourceShares(ctx sdk.Context, denom string) sdk.Dec { +func (k Keeper) getHardSupplyTotalSourceShares(ctx sdk.Context, denom string) sdkmath.LegacyDec { totalSuppliedCoins, found := k.hardKeeper.GetSuppliedCoins(ctx) if !found { // assume no coins have been supplied @@ -49,11 +50,11 @@ func (k Keeper) getHardSupplyTotalSourceShares(ctx sdk.Context, denom string) sd interestFactor, found := k.hardKeeper.GetSupplyInterestFactor(ctx, denom) if !found { // assume nothing has been borrowed so the factor starts at it's default value - interestFactor = sdk.OneDec() + interestFactor = sdkmath.LegacyOneDec() } // return supplied/factor to get the "pre interest" value of the current total supplied - return sdk.NewDecFromInt(totalSupplied).Quo(interestFactor) + return sdkmath.LegacyNewDecFromInt(totalSupplied).Quo(interestFactor) } // InitializeHardSupplyReward initializes the supply-side of a hard liquidity provider claim @@ -100,7 +101,7 @@ func (k Keeper) SynchronizeHardSupplyReward(ctx sdk.Context, deposit hardtypes.D // synchronizeSingleHardSupplyReward synchronizes a single rewarded supply denom in a hard claim. // It returns the claim without setting in the store. // The public methods for accessing and modifying claims are preferred over this one. Direct modification of claims is easy to get wrong. -func (k Keeper) synchronizeSingleHardSupplyReward(ctx sdk.Context, claim types.HardLiquidityProviderClaim, denom string, sourceShares sdk.Dec) types.HardLiquidityProviderClaim { +func (k Keeper) synchronizeSingleHardSupplyReward(ctx sdk.Context, claim types.HardLiquidityProviderClaim, denom string, sourceShares sdkmath.LegacyDec) types.HardLiquidityProviderClaim { globalRewardIndexes, found := k.GetHardSupplyRewardIndexes(ctx, denom) if !found { // The global factor is only not found if @@ -204,7 +205,7 @@ func (k Keeper) SimulateHardSynchronization(ctx sdk.Context, claim types.HardLiq for _, globalRewardIndex := range globalRewardIndexes { userRewardIndex, foundUserRewardIndex := userRewardIndexes.RewardIndexes.GetRewardIndex(globalRewardIndex.CollateralType) if !foundUserRewardIndex { - userRewardIndex = types.NewRewardIndex(globalRewardIndex.CollateralType, sdk.ZeroDec()) + userRewardIndex = types.NewRewardIndex(globalRewardIndex.CollateralType, sdkmath.LegacyZeroDec()) userRewardIndexes.RewardIndexes = append(userRewardIndexes.RewardIndexes, userRewardIndex) claim.SupplyRewardIndexes[userRewardIndexIndex].RewardIndexes = append(claim.SupplyRewardIndexes[userRewardIndexIndex].RewardIndexes, userRewardIndex) } @@ -219,7 +220,7 @@ func (k Keeper) SimulateHardSynchronization(ctx sdk.Context, claim types.HardLiq if !found { continue } - newRewardsAmount := rewardsAccumulatedFactor.Mul(sdk.NewDecFromInt(deposit.Amount.AmountOf(ri.CollateralType))).RoundInt() + newRewardsAmount := rewardsAccumulatedFactor.Mul(sdkmath.LegacyNewDecFromInt(deposit.Amount.AmountOf(ri.CollateralType))).RoundInt() if newRewardsAmount.IsZero() || newRewardsAmount.IsNegative() { continue } @@ -254,7 +255,7 @@ func (k Keeper) SimulateHardSynchronization(ctx sdk.Context, claim types.HardLiq for _, globalRewardIndex := range globalRewardIndexes { userRewardIndex, foundUserRewardIndex := userRewardIndexes.RewardIndexes.GetRewardIndex(globalRewardIndex.CollateralType) if !foundUserRewardIndex { - userRewardIndex = types.NewRewardIndex(globalRewardIndex.CollateralType, sdk.ZeroDec()) + userRewardIndex = types.NewRewardIndex(globalRewardIndex.CollateralType, sdkmath.LegacyZeroDec()) userRewardIndexes.RewardIndexes = append(userRewardIndexes.RewardIndexes, userRewardIndex) claim.BorrowRewardIndexes[userRewardIndexIndex].RewardIndexes = append(claim.BorrowRewardIndexes[userRewardIndexIndex].RewardIndexes, userRewardIndex) } @@ -269,7 +270,7 @@ func (k Keeper) SimulateHardSynchronization(ctx sdk.Context, claim types.HardLiq if !found { continue } - newRewardsAmount := rewardsAccumulatedFactor.Mul(sdk.NewDecFromInt(borrow.Amount.AmountOf(ri.CollateralType))).RoundInt() + newRewardsAmount := rewardsAccumulatedFactor.Mul(sdkmath.LegacyNewDecFromInt(borrow.Amount.AmountOf(ri.CollateralType))).RoundInt() if newRewardsAmount.IsZero() || newRewardsAmount.IsNegative() { continue } diff --git a/x/incentive/keeper/rewards_supply_sync_test.go b/x/incentive/keeper/rewards_supply_sync_test.go index 10c181852e..86b627405d 100644 --- a/x/incentive/keeper/rewards_supply_sync_test.go +++ b/x/incentive/keeper/rewards_supply_sync_test.go @@ -314,7 +314,7 @@ func (builder HardDepositBuilder) Build() hardtypes.Deposit { return builder.Dep // WithSourceShares adds a deposit amount and factor such that the source shares for this deposit is equal to specified. // With a factor of 1, the deposit amount is the source shares. This picks an arbitrary factor to ensure factors are accounted for in production code. func (builder HardDepositBuilder) WithSourceShares(denom string, shares int64) HardDepositBuilder { - if !builder.Amount.AmountOf(denom).Equal(sdk.ZeroInt()) { + if !builder.Amount.AmountOf(denom).Equal(sdkmath.ZeroInt()) { panic("adding to amount with existing denom not implemented") } if _, f := builder.Index.GetInterestFactor(denom); f { @@ -322,7 +322,7 @@ func (builder HardDepositBuilder) WithSourceShares(denom string, shares int64) H } // pick arbitrary factor - factor := sdk.MustNewDecFromStr("2") + factor := sdkmath.LegacyMustNewDecFromStr("2") // Calculate deposit amount that would equal the requested source shares given the above factor. amt := sdkmath.NewInt(shares).Mul(factor.RoundInt()) diff --git a/x/incentive/keeper/rewards_supply_test.go b/x/incentive/keeper/rewards_supply_test.go index 2780a843bf..451f2e8755 100644 --- a/x/incentive/keeper/rewards_supply_test.go +++ b/x/incentive/keeper/rewards_supply_test.go @@ -129,7 +129,7 @@ func (suite *SupplyRewardsTestSuite) SetupApp() { suite.hardKeeper = suite.app.GetHardKeeper() suite.committeeKeeper = suite.app.GetCommitteeKeeper() - suite.ctx = suite.app.NewContext(true, tmproto.Header{Height: 1, Time: suite.genesisTime}) + suite.ctx = suite.App.NewContextLegacy(true, tmproto.Header{Height: 1, Time: suite.genesisTime}) } func (suite *SupplyRewardsTestSuite) SetupWithGenState(authBuilder *app.AuthBankGenesisBuilder, incentBuilder testutil.IncentiveGenesisBuilder, hardBuilder testutil.HardGenesisBuilder) { @@ -604,7 +604,7 @@ func (suite *SupplyRewardsTestSuite) TestSynchronizeHardSupplyReward() { for _, expectedRewardIndex := range tc.args.expectedRewardIndexes { currRewardIndex, found := multiRewardIndex.RewardIndexes.GetRewardIndex(expectedRewardIndex.CollateralType) suite.Require().True(found) - suite.Require().Equal(sdk.ZeroDec(), currRewardIndex.RewardFactor) + suite.Require().Equal(sdkmath.LegacyZeroDec(), currRewardIndex.RewardFactor) } // Run accumulator at several intervals @@ -1002,7 +1002,7 @@ func (suite *SupplyRewardsTestSuite) TestSimulateHardSupplyRewardSynchronization for _, expectedRewardIndex := range tc.args.expectedRewardIndexes { currRewardIndex, found := multiRewardIndexPre.RewardIndexes.GetRewardIndex(expectedRewardIndex.CollateralType) suite.Require().True(found) - suite.Require().Equal(sdk.ZeroDec(), currRewardIndex.RewardFactor) + suite.Require().Equal(sdkmath.LegacyZeroDec(), currRewardIndex.RewardFactor) } // Check that the synced claim held in memory has properly simulated syncing diff --git a/x/incentive/keeper/rewards_swap.go b/x/incentive/keeper/rewards_swap.go index 7f468c9606..ec419bdc73 100644 --- a/x/incentive/keeper/rewards_swap.go +++ b/x/incentive/keeper/rewards_swap.go @@ -37,12 +37,12 @@ func (k Keeper) AccumulateSwapRewards(ctx sdk.Context, rewardPeriod types.MultiR // getSwapTotalSourceShares fetches the sum of all source shares for a swap reward. // In the case of swap, these are the total (swap module) shares in a particular pool. -func (k Keeper) getSwapTotalSourceShares(ctx sdk.Context, poolID string) sdk.Dec { +func (k Keeper) getSwapTotalSourceShares(ctx sdk.Context, poolID string) sdkmath.LegacyDec { totalShares, found := k.swapKeeper.GetPoolShares(ctx, poolID) if !found { - totalShares = sdk.ZeroInt() + totalShares = sdkmath.ZeroInt() } - return sdk.NewDecFromInt(totalShares) + return sdkmath.LegacyNewDecFromInt(totalShares) } // InitializeSwapReward creates a new claim with zero rewards and indexes matching the global indexes. @@ -95,7 +95,7 @@ func (k *Keeper) synchronizeSwapReward(ctx sdk.Context, claim types.SwapClaim, p userRewardIndexes = types.RewardIndexes{} } - newRewards, err := k.CalculateRewards(userRewardIndexes, globalRewardIndexes, sdk.NewDecFromInt(shares)) + newRewards, err := k.CalculateRewards(userRewardIndexes, globalRewardIndexes, sdkmath.LegacyNewDecFromInt(shares)) if err != nil { // Global reward factors should never decrease, as it would lead to a negative update to claim.Rewards. // This panics if a global reward factor decreases or disappears between the old and new indexes. @@ -118,7 +118,7 @@ func (k Keeper) GetSynchronizedSwapClaim(ctx sdk.Context, owner sdk.AccAddress) k.IterateSwapRewardIndexes(ctx, func(poolID string, _ types.RewardIndexes) bool { shares, found := k.swapKeeper.GetDepositorSharesAmount(ctx, owner, poolID) if !found { - shares = sdk.ZeroInt() + shares = sdkmath.ZeroInt() } claim = k.synchronizeSwapReward(ctx, claim, poolID, owner, shares) diff --git a/x/incentive/keeper/rewards_usdx.go b/x/incentive/keeper/rewards_usdx.go index ada2414723..11ec021585 100644 --- a/x/incentive/keeper/rewards_usdx.go +++ b/x/incentive/keeper/rewards_usdx.go @@ -1,6 +1,7 @@ package keeper import ( + sdkmath "cosmossdk.io/math" "fmt" sdk "github.com/cosmos/cosmos-sdk/types" @@ -19,7 +20,7 @@ func (k Keeper) AccumulateUSDXMintingRewards(ctx sdk.Context, rewardPeriod types factor, found := k.GetUSDXMintingRewardFactor(ctx, rewardPeriod.CollateralType) if !found { - factor = sdk.ZeroDec() + factor = sdkmath.LegacyZeroDec() } // wrap in RewardIndexes for compatibility with Accumulator indexes := types.RewardIndexes{}.With(types.USDXMintingRewardDenom, factor) @@ -42,16 +43,16 @@ func (k Keeper) AccumulateUSDXMintingRewards(ctx sdk.Context, rewardPeriod types // getUSDXTotalSourceShares fetches the sum of all source shares for a usdx minting reward. // In the case of usdx minting, this is the total debt from all cdps of a particular type, divided by the cdp interest factor. // This gives the "pre interest" value of the total debt. -func (k Keeper) getUSDXTotalSourceShares(ctx sdk.Context, collateralType string) sdk.Dec { +func (k Keeper) getUSDXTotalSourceShares(ctx sdk.Context, collateralType string) sdkmath.LegacyDec { totalPrincipal := k.cdpKeeper.GetTotalPrincipal(ctx, collateralType, cdptypes.DefaultStableDenom) cdpFactor, found := k.cdpKeeper.GetInterestFactor(ctx, collateralType) if !found { // assume nothing has been borrowed so the factor starts at it's default value - cdpFactor = sdk.OneDec() + cdpFactor = sdkmath.LegacyOneDec() } // return debt/factor to get the "pre interest" value of the current total debt - return sdk.NewDecFromInt(totalPrincipal).Quo(cdpFactor) + return sdkmath.LegacyNewDecFromInt(totalPrincipal).Quo(cdpFactor) } // InitializeUSDXMintingClaim creates or updates a claim such that no new rewards are accrued, but any existing rewards are not lost. @@ -61,12 +62,12 @@ func (k Keeper) getUSDXTotalSourceShares(ctx sdk.Context, collateralType string) func (k Keeper) InitializeUSDXMintingClaim(ctx sdk.Context, cdp cdptypes.CDP) { claim, found := k.GetUSDXMintingClaim(ctx, cdp.Owner) if !found { // this is the owner's first usdx minting reward claim - claim = types.NewUSDXMintingClaim(cdp.Owner, sdk.NewCoin(types.USDXMintingRewardDenom, sdk.ZeroInt()), types.RewardIndexes{}) + claim = types.NewUSDXMintingClaim(cdp.Owner, sdk.NewCoin(types.USDXMintingRewardDenom, sdkmath.ZeroInt()), types.RewardIndexes{}) } globalRewardFactor, found := k.GetUSDXMintingRewardFactor(ctx, cdp.Type) if !found { - globalRewardFactor = sdk.ZeroDec() + globalRewardFactor = sdkmath.LegacyZeroDec() } claim.RewardIndexes = claim.RewardIndexes.With(cdp.Type, globalRewardFactor) @@ -94,7 +95,7 @@ func (k Keeper) SynchronizeUSDXMintingReward(ctx sdk.Context, cdp cdptypes.CDP) // synchronizeSingleUSDXMintingReward synchronizes a single rewarded cdp collateral type in a usdx minting claim. // It returns the claim without setting in the store. // The public methods for accessing and modifying claims are preferred over this one. Direct modification of claims is easy to get wrong. -func (k Keeper) synchronizeSingleUSDXMintingReward(ctx sdk.Context, claim types.USDXMintingClaim, ctype string, sourceShares sdk.Dec) types.USDXMintingClaim { +func (k Keeper) synchronizeSingleUSDXMintingReward(ctx sdk.Context, claim types.USDXMintingClaim, ctype string, sourceShares sdkmath.LegacyDec) types.USDXMintingClaim { globalRewardFactor, found := k.GetUSDXMintingRewardFactor(ctx, ctype) if !found { // The global factor is only not found if @@ -111,7 +112,7 @@ func (k Keeper) synchronizeSingleUSDXMintingReward(ctx sdk.Context, claim types. // Normally the factor should always be found, as it is added when the cdp is created in InitializeUSDXMintingClaim. // However if a cdp type is not rewarded then becomes rewarded (ie a reward period is added to params), existing cdps will not have the factor in their claims. // So assume the factor is the starting value for any global factor: 0. - userRewardFactor = sdk.ZeroDec() + userRewardFactor = sdkmath.LegacyZeroDec() } newRewardsAmount, err := k.CalculateSingleReward(userRewardFactor, globalRewardFactor, sourceShares) @@ -138,7 +139,7 @@ func (k Keeper) SimulateUSDXMintingSynchronization(ctx sdk.Context, claim types. globalRewardFactor, found := k.GetUSDXMintingRewardFactor(ctx, ri.CollateralType) if !found { - globalRewardFactor = sdk.ZeroDec() + globalRewardFactor = sdkmath.LegacyZeroDec() } // the owner has an existing usdx minting reward claim @@ -158,7 +159,7 @@ func (k Keeper) SimulateUSDXMintingSynchronization(ctx sdk.Context, claim types. if !found { continue } - newRewardsAmount := rewardsAccumulatedFactor.Mul(sdk.NewDecFromInt(cdp.GetTotalPrincipal().Amount)).RoundInt() + newRewardsAmount := rewardsAccumulatedFactor.Mul(sdkmath.LegacyNewDecFromInt(cdp.GetTotalPrincipal().Amount)).RoundInt() if newRewardsAmount.IsZero() { continue } @@ -192,7 +193,7 @@ func (k Keeper) synchronizeRewardAndReturnClaim(ctx sdk.Context, cdp cdptypes.CD // ZeroUSDXMintingClaim zeroes out the claim object's rewards and returns the updated claim object func (k Keeper) ZeroUSDXMintingClaim(ctx sdk.Context, claim types.USDXMintingClaim) types.USDXMintingClaim { - claim.Reward = sdk.NewCoin(claim.Reward.Denom, sdk.ZeroInt()) + claim.Reward = sdk.NewCoin(claim.Reward.Denom, sdkmath.ZeroInt()) k.SetUSDXMintingClaim(ctx, claim) return claim } diff --git a/x/incentive/keeper/rewards_usdx_accum_test.go b/x/incentive/keeper/rewards_usdx_accum_test.go index 4b7283a664..a5e11f5a37 100644 --- a/x/incentive/keeper/rewards_usdx_accum_test.go +++ b/x/incentive/keeper/rewards_usdx_accum_test.go @@ -4,7 +4,6 @@ import ( "testing" "time" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/suite" "github.com/kava-labs/kava/x/incentive/types" @@ -20,7 +19,7 @@ func (suite *AccumulateUSDXRewardsTests) storedTimeEquals(cType string, expected suite.Equal(expected, storedTime) } -func (suite *AccumulateUSDXRewardsTests) storedIndexesEqual(cType string, expected sdk.Dec) { +func (suite *AccumulateUSDXRewardsTests) storedIndexesEqual(cType string, expected sdkmath.LegacyDec) { storedIndexes, found := suite.keeper.GetUSDXMintingRewardFactor(suite.ctx, cType) suite.True(found) suite.Equal(expected, storedIndexes) @@ -158,7 +157,7 @@ func (suite *AccumulateUSDXRewardsTests) TestStateAddedWhenStateDoesNotExist() { // After the first accumulation the current block time should be stored and the factor will be zero. suite.storedTimeEquals(cType, firstAccrualTime) - suite.storedIndexesEqual(cType, sdk.ZeroDec()) + suite.storedIndexesEqual(cType, sdkmath.LegacyZeroDec()) secondAccrualTime := firstAccrualTime.Add(10 * time.Second) suite.ctx = suite.ctx.WithBlockTime(secondAccrualTime) diff --git a/x/incentive/keeper/rewards_usdx_test.go b/x/incentive/keeper/rewards_usdx_test.go index eb45570e3b..d5fb59c474 100644 --- a/x/incentive/keeper/rewards_usdx_test.go +++ b/x/incentive/keeper/rewards_usdx_test.go @@ -257,7 +257,7 @@ func (suite *USDXRewardsTestSuite) SetupApp() { suite.keeper = suite.app.GetIncentiveKeeper() suite.cdpKeeper = suite.app.GetCDPKeeper() - suite.ctx = suite.app.NewContext(true, tmproto.Header{Height: 1, Time: suite.genesisTime}) + suite.ctx = suite.App.NewContextLegacy(true, tmproto.Header{Height: 1, Time: suite.genesisTime}) } func (suite *USDXRewardsTestSuite) SetupWithGenState(authBuilder *app.AuthBankGenesisBuilder, incentBuilder testutil.IncentiveGenesisBuilder) { @@ -278,7 +278,7 @@ func (suite *USDXRewardsTestSuite) TestAccumulateUSDXMintingRewards() { rewardsPerSecond sdk.Coin initialTotalPrincipal sdk.Coin timeElapsed int - expectedRewardFactor sdk.Dec + expectedRewardFactor sdkmath.LegacyDec } type test struct { name string @@ -344,7 +344,7 @@ func (suite *USDXRewardsTestSuite) TestSynchronizeUSDXMintingReward() { initialCollateral sdk.Coin initialPrincipal sdk.Coin blockTimes []int - expectedRewardFactor sdk.Dec + expectedRewardFactor sdkmath.LegacyDec expectedRewards sdk.Coin } type test struct { @@ -391,7 +391,7 @@ func (suite *USDXRewardsTestSuite) TestSynchronizeUSDXMintingReward() { claim, found := suite.keeper.GetUSDXMintingClaim(suite.ctx, suite.addrs[0]) suite.Require().True(found) - suite.Require().Equal(sdk.ZeroDec(), claim.RewardIndexes[0].RewardFactor) + suite.Require().Equal(sdkmath.LegacyZeroDec(), claim.RewardIndexes[0].RewardFactor) var timeElapsed int previousBlockTime := suite.ctx.BlockTime() @@ -430,7 +430,7 @@ func (suite *USDXRewardsTestSuite) TestSimulateUSDXMintingRewardSynchronization( initialCollateral sdk.Coin initialPrincipal sdk.Coin blockTimes []int - expectedRewardFactor sdk.Dec + expectedRewardFactor sdkmath.LegacyDec expectedRewards sdk.Coin } type test struct { @@ -477,7 +477,7 @@ func (suite *USDXRewardsTestSuite) TestSimulateUSDXMintingRewardSynchronization( claim, found := suite.keeper.GetUSDXMintingClaim(suite.ctx, suite.addrs[0]) suite.Require().True(found) - suite.Require().Equal(sdk.ZeroDec(), claim.RewardIndexes[0].RewardFactor) + suite.Require().Equal(sdkmath.LegacyZeroDec(), claim.RewardIndexes[0].RewardFactor) var timeElapsed int previousBlockTime := suite.ctx.BlockTime() @@ -495,8 +495,8 @@ func (suite *USDXRewardsTestSuite) TestSimulateUSDXMintingRewardSynchronization( claim, found = suite.keeper.GetUSDXMintingClaim(suite.ctx, suite.addrs[0]) suite.Require().True(found) - suite.Require().Equal(claim.RewardIndexes[0].RewardFactor, sdk.ZeroDec()) - suite.Require().Equal(claim.Reward, sdk.NewCoin("ukava", sdk.ZeroInt())) + suite.Require().Equal(claim.RewardIndexes[0].RewardFactor, sdkmath.LegacyZeroDec()) + suite.Require().Equal(claim.Reward, sdk.NewCoin("ukava", sdkmath.ZeroInt())) updatedClaim := suite.keeper.SimulateUSDXMintingSynchronization(suite.ctx, claim) suite.Require().Equal(tc.args.expectedRewardFactor, updatedClaim.RewardIndexes[0].RewardFactor) diff --git a/x/incentive/keeper/rewards_usdx_unit_test.go b/x/incentive/keeper/rewards_usdx_unit_test.go index 61240e8560..76520453e7 100644 --- a/x/incentive/keeper/rewards_usdx_unit_test.go +++ b/x/incentive/keeper/rewards_usdx_unit_test.go @@ -248,8 +248,8 @@ func NewCDPBuilder(owner sdk.AccAddress, collateralType string) CDPBuilder { // Set them to the default denom, but with 0 amount. Principal: c(cdptypes.DefaultStableDenom, 0), AccumulatedFees: c(cdptypes.DefaultStableDenom, 0), - // zero value of sdk.Dec causes nil pointer panics - InterestFactor: sdk.OneDec(), + // zero value of sdkmath.LegacyDec causes nil pointer panics + InterestFactor: sdkmath.LegacyOneDec(), }, } } @@ -260,10 +260,10 @@ func (builder CDPBuilder) Build() cdptypes.CDP { return builder.CDP } // WithSourceShares adds a principal amount and interest factor such that the source shares for this CDP is equal to specified. // With a factor of 1, the total principal is the source shares. This picks an arbitrary factor to ensure factors are accounted for in production code. func (builder CDPBuilder) WithSourceShares(shares int64) CDPBuilder { - if !builder.GetTotalPrincipal().Amount.Equal(sdk.ZeroInt()) { + if !builder.GetTotalPrincipal().Amount.Equal(sdkmath.ZeroInt()) { panic("setting source shares on cdp with existing principal or fees not implemented") } - if !(builder.InterestFactor.IsNil() || builder.InterestFactor.Equal(sdk.OneDec())) { + if !(builder.InterestFactor.IsNil() || builder.InterestFactor.Equal(sdkmath.LegacyOneDec())) { panic("setting source shares on cdp with existing interest factor not implemented") } // pick arbitrary interest factor @@ -273,7 +273,7 @@ func (builder CDPBuilder) WithSourceShares(shares int64) CDPBuilder { principal := sdkmath.NewInt(shares).Mul(factor) builder.Principal = sdk.NewCoin(cdptypes.DefaultStableDenom, principal) - builder.InterestFactor = sdk.NewDecFromInt(factor) + builder.InterestFactor = sdkmath.LegacyNewDecFromInt(factor) return builder } diff --git a/x/incentive/keeper/unit_test.go b/x/incentive/keeper/unit_test.go index 8e459dd042..6b07b19c05 100644 --- a/x/incentive/keeper/unit_test.go +++ b/x/incentive/keeper/unit_test.go @@ -5,12 +5,12 @@ import ( "strings" "time" + "cosmossdk.io/log" sdkmath "cosmossdk.io/math" + "cosmossdk.io/store" + storetypes "cosmossdk.io/store/types" db "github.com/cometbft/cometbft-db" - "github.com/cometbft/cometbft/libs/log" "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/store" - storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" @@ -302,13 +302,13 @@ type fakeHardKeeper struct { type fakeHardState struct { total sdk.Coins - interestFactors map[string]sdk.Dec + interestFactors map[string]sdkmath.LegacyDec } func newFakeHardState() fakeHardState { return fakeHardState{ total: nil, - interestFactors: map[string]sdk.Dec{}, // initialize map to avoid panics on read + interestFactors: map[string]sdkmath.LegacyDec{}, // initialize map to avoid panics on read } } @@ -321,13 +321,13 @@ func newFakeHardKeeper() *fakeHardKeeper { } } -func (k *fakeHardKeeper) addTotalBorrow(coin sdk.Coin, factor sdk.Dec) *fakeHardKeeper { +func (k *fakeHardKeeper) addTotalBorrow(coin sdk.Coin, factor sdkmath.LegacyDec) *fakeHardKeeper { k.borrows.total = k.borrows.total.Add(coin) k.borrows.interestFactors[coin.Denom] = factor return k } -func (k *fakeHardKeeper) addTotalSupply(coin sdk.Coin, factor sdk.Dec) *fakeHardKeeper { +func (k *fakeHardKeeper) addTotalSupply(coin sdk.Coin, factor sdkmath.LegacyDec) *fakeHardKeeper { k.deposits.total = k.deposits.total.Add(coin) k.deposits.interestFactors[coin.Denom] = factor return k @@ -347,12 +347,12 @@ func (k *fakeHardKeeper) GetSuppliedCoins(_ sdk.Context) (sdk.Coins, bool) { return k.deposits.total, true } -func (k *fakeHardKeeper) GetBorrowInterestFactor(_ sdk.Context, denom string) (sdk.Dec, bool) { +func (k *fakeHardKeeper) GetBorrowInterestFactor(_ sdk.Context, denom string) (sdkmath.LegacyDec, bool) { f, ok := k.borrows.interestFactors[denom] return f, ok } -func (k *fakeHardKeeper) GetSupplyInterestFactor(_ sdk.Context, denom string) (sdk.Dec, bool) { +func (k *fakeHardKeeper) GetSupplyInterestFactor(_ sdk.Context, denom string) (sdkmath.LegacyDec, bool) { f, ok := k.deposits.interestFactors[denom] return f, ok } @@ -389,7 +389,7 @@ func (k *fakeStakingKeeper) addBondedTokens(amount int64) *fakeStakingKeeper { } func (k *fakeStakingKeeper) TotalBondedTokens(_ sdk.Context) sdkmath.Int { - total := sdk.ZeroInt() + total := sdkmath.ZeroInt() for _, val := range k.validators { if val.GetStatus() == stakingtypes.Bonded { total = total.Add(val.GetBondedTokens()) @@ -424,7 +424,7 @@ func (k *fakeStakingKeeper) GetValidatorDelegations(_ sdk.Context, valAddr sdk.V // fakeCDPKeeper is a stub cdp keeper. // It can be used to return values to the incentive keeper without having to initialize a full cdp keeper. type fakeCDPKeeper struct { - interestFactor *sdk.Dec + interestFactor *sdkmath.LegacyDec totalPrincipal sdkmath.Int } @@ -433,11 +433,11 @@ var _ types.CdpKeeper = newFakeCDPKeeper() func newFakeCDPKeeper() *fakeCDPKeeper { return &fakeCDPKeeper{ interestFactor: nil, - totalPrincipal: sdk.ZeroInt(), + totalPrincipal: sdkmath.ZeroInt(), } } -func (k *fakeCDPKeeper) addInterestFactor(f sdk.Dec) *fakeCDPKeeper { +func (k *fakeCDPKeeper) addInterestFactor(f sdkmath.LegacyDec) *fakeCDPKeeper { k.interestFactor = &f return k } @@ -447,11 +447,11 @@ func (k *fakeCDPKeeper) addTotalPrincipal(p sdkmath.Int) *fakeCDPKeeper { return k } -func (k *fakeCDPKeeper) GetInterestFactor(_ sdk.Context, collateralType string) (sdk.Dec, bool) { +func (k *fakeCDPKeeper) GetInterestFactor(_ sdk.Context, collateralType string) (sdkmath.LegacyDec, bool) { if k.interestFactor != nil { return *k.interestFactor, true } - return sdk.Dec{}, false + return sdkmath.LegacyDec{}, false } func (k *fakeCDPKeeper) GetTotalPrincipal(_ sdk.Context, collateralType string, principalDenom string) sdkmath.Int { @@ -511,7 +511,7 @@ func (k *fakeEarnKeeper) GetVaultTotalShares( func (k *fakeEarnKeeper) GetVaultTotalValue(ctx sdk.Context, denom string) (sdk.Coin, error) { vaultShares, found := k.vaultShares[denom] if !found { - return sdk.NewCoin(denom, sdk.ZeroInt()), nil + return sdk.NewCoin(denom, sdkmath.ZeroInt()), nil } return sdk.NewCoin(denom, vaultShares.Amount.RoundInt()), nil @@ -575,7 +575,7 @@ func (k *fakeLiquidKeeper) GetAllDerivativeDenoms(ctx sdk.Context) (denoms []str } func (k *fakeLiquidKeeper) GetTotalDerivativeValue(ctx sdk.Context) (sdk.Coin, error) { - totalSupply := sdk.ZeroInt() + totalSupply := sdkmath.ZeroInt() for _, supply := range k.derivatives { totalSupply = totalSupply.Add(supply) } @@ -586,7 +586,7 @@ func (k *fakeLiquidKeeper) GetTotalDerivativeValue(ctx sdk.Context) (sdk.Coin, e func (k *fakeLiquidKeeper) GetDerivativeValue(ctx sdk.Context, denom string) (sdk.Coin, error) { supply, found := k.derivatives[denom] if !found { - return sdk.NewCoin("ukava", sdk.ZeroInt()), nil + return sdk.NewCoin("ukava", sdkmath.ZeroInt()), nil } return sdk.NewCoin("ukava", supply), nil @@ -609,7 +609,7 @@ func (k *fakeLiquidKeeper) getRewardAmount( amt, found := k.derivatives[derivativeDenom] if !found { // No error - return sdk.ZeroInt() + return sdkmath.ZeroInt() } lastRewardClaim, found := k.lastRewardClaim[derivativeDenom] @@ -619,7 +619,7 @@ func (k *fakeLiquidKeeper) getRewardAmount( duration := int64(ctx.BlockTime().Sub(lastRewardClaim).Seconds()) if duration <= 0 { - return sdk.ZeroInt() + return sdkmath.ZeroInt() } // Reward amount just set to 10% of the derivative supply per second @@ -627,7 +627,7 @@ func (k *fakeLiquidKeeper) getRewardAmount( } type fakeDistrKeeper struct { - communityTax sdk.Dec + communityTax sdkmath.LegacyDec } var _ types.DistrKeeper = newFakeDistrKeeper() @@ -636,12 +636,12 @@ func newFakeDistrKeeper() *fakeDistrKeeper { return &fakeDistrKeeper{} } -func (k *fakeDistrKeeper) setCommunityTax(percent sdk.Dec) *fakeDistrKeeper { +func (k *fakeDistrKeeper) setCommunityTax(percent sdkmath.LegacyDec) *fakeDistrKeeper { k.communityTax = percent return k } -func (k *fakeDistrKeeper) GetCommunityTax(ctx sdk.Context) (percent sdk.Dec) { +func (k *fakeDistrKeeper) GetCommunityTax(ctx sdk.Context) (percent sdkmath.LegacyDec) { return k.communityTax } @@ -726,7 +726,7 @@ func (k *fakeBankKeeper) GetAllBalances(ctx sdk.Context, addr sdk.AccAddress) sd func (k *fakeBankKeeper) GetSupply(ctx sdk.Context, denom string) sdk.Coin { supply, found := k.supply[denom] if !found { - return sdk.NewCoin(denom, sdk.ZeroInt()) + return sdk.NewCoin(denom, sdkmath.ZeroInt()) } return sdk.NewCoin(denom, supply) diff --git a/x/incentive/legacy/v0_15/types.go b/x/incentive/legacy/v0_15/types.go index 58f6f912bf..8f78bcb31d 100644 --- a/x/incentive/legacy/v0_15/types.go +++ b/x/incentive/legacy/v0_15/types.go @@ -79,8 +79,8 @@ type RewardIndexes []RewardIndex // RewardIndex stores reward accumulation information type RewardIndex struct { - CollateralType string `json:"collateral_type" yaml:"collateral_type"` - RewardFactor sdk.Dec `json:"reward_factor" yaml:"reward_factor"` + CollateralType string `json:"collateral_type" yaml:"collateral_type"` + RewardFactor sdkmath.LegacyDec `json:"reward_factor" yaml:"reward_factor"` } // USDXMintingClaims slice of USDXMintingClaim @@ -155,9 +155,9 @@ type Multipliers []Multiplier // Multiplier amount the claim rewards get increased by, along with how long the claim rewards are locked type Multiplier struct { - Name MultiplierName `json:"name" yaml:"name"` - MonthsLockup int64 `json:"months_lockup" yaml:"months_lockup"` - Factor sdk.Dec `json:"factor" yaml:"factor"` + Name MultiplierName `json:"name" yaml:"name"` + MonthsLockup int64 `json:"months_lockup" yaml:"months_lockup"` + Factor sdkmath.LegacyDec `json:"factor" yaml:"factor"` } // MultiplierName is the user facing ID for a multiplier. There is a restricted set of possible values. diff --git a/x/incentive/legacy/v0_16/migrate_test.go b/x/incentive/legacy/v0_16/migrate_test.go index 0cfb101435..9c02713865 100644 --- a/x/incentive/legacy/v0_16/migrate_test.go +++ b/x/incentive/legacy/v0_16/migrate_test.go @@ -108,17 +108,17 @@ func (s *migrateTestSuite) TestMigrate_GenState() { { Name: v015incentive.Small, MonthsLockup: 6, - Factor: sdk.MustNewDecFromStr("0.5"), + Factor: sdkmath.LegacyMustNewDecFromStr("0.5"), }, { Name: v015incentive.Large, MonthsLockup: 12, - Factor: sdk.MustNewDecFromStr("0.8"), + Factor: sdkmath.LegacyMustNewDecFromStr("0.8"), }, { Name: v015incentive.Medium, MonthsLockup: 9, - Factor: sdk.MustNewDecFromStr("0.7"), + Factor: sdkmath.LegacyMustNewDecFromStr("0.7"), }, }, }, @@ -137,7 +137,7 @@ func (s *migrateTestSuite) TestMigrate_GenState() { RewardIndexes: []v015incentive.RewardIndex{ { CollateralType: "bnb", - RewardFactor: sdk.MustNewDecFromStr("0.15"), + RewardFactor: sdkmath.LegacyMustNewDecFromStr("0.15"), }, }, }, @@ -152,7 +152,7 @@ func (s *migrateTestSuite) TestMigrate_GenState() { RewardIndexes: v015incentive.RewardIndexes{ { CollateralType: "kava", - RewardFactor: sdk.MustNewDecFromStr("0.5"), + RewardFactor: sdkmath.LegacyMustNewDecFromStr("0.5"), }, }, }, @@ -170,7 +170,7 @@ func (s *migrateTestSuite) TestMigrate_GenState() { RewardIndexes: []v015incentive.RewardIndex{ { CollateralType: "bnb", - RewardFactor: sdk.MustNewDecFromStr("0.15"), + RewardFactor: sdkmath.LegacyMustNewDecFromStr("0.15"), }, }, }, @@ -189,7 +189,7 @@ func (s *migrateTestSuite) TestMigrate_GenState() { RewardIndexes: []v015incentive.RewardIndex{ { CollateralType: "bnb", - RewardFactor: sdk.MustNewDecFromStr("0.15"), + RewardFactor: sdkmath.LegacyMustNewDecFromStr("0.15"), }, }, }, @@ -208,7 +208,7 @@ func (s *migrateTestSuite) TestMigrate_GenState() { RewardIndexes: []v015incentive.RewardIndex{ { CollateralType: "bnb", - RewardFactor: sdk.MustNewDecFromStr("0.15"), + RewardFactor: sdkmath.LegacyMustNewDecFromStr("0.15"), }, }, }, @@ -227,7 +227,7 @@ func (s *migrateTestSuite) TestMigrate_GenState() { RewardIndexes: []v015incentive.RewardIndex{ { CollateralType: "bnb", - RewardFactor: sdk.MustNewDecFromStr("0.25"), + RewardFactor: sdkmath.LegacyMustNewDecFromStr("0.25"), }, }, }, @@ -245,7 +245,7 @@ func (s *migrateTestSuite) TestMigrate_GenState() { RewardIndexes: []v015incentive.RewardIndex{ { CollateralType: "bnb", - RewardFactor: sdk.MustNewDecFromStr("0.25"), + RewardFactor: sdkmath.LegacyMustNewDecFromStr("0.25"), }, }, }, @@ -256,7 +256,7 @@ func (s *migrateTestSuite) TestMigrate_GenState() { RewardIndexes: []v015incentive.RewardIndex{ { CollateralType: "bnb", - RewardFactor: sdk.MustNewDecFromStr("0.25"), + RewardFactor: sdkmath.LegacyMustNewDecFromStr("0.25"), }, }, }, @@ -275,7 +275,7 @@ func (s *migrateTestSuite) TestMigrate_GenState() { RewardIndexes: []v015incentive.RewardIndex{ { CollateralType: "bnb", - RewardFactor: sdk.MustNewDecFromStr("0.25"), + RewardFactor: sdkmath.LegacyMustNewDecFromStr("0.25"), }, }, }, @@ -294,7 +294,7 @@ func (s *migrateTestSuite) TestMigrate_GenState() { RewardIndexes: []v015incentive.RewardIndex{ { CollateralType: "bnb", - RewardFactor: sdk.MustNewDecFromStr("0.25"), + RewardFactor: sdkmath.LegacyMustNewDecFromStr("0.25"), }, }, }, @@ -316,7 +316,7 @@ func (s *migrateTestSuite) TestMigrate_GenState() { RewardIndexes: []v016incentive.RewardIndex{ { CollateralType: "bnb", - RewardFactor: sdk.MustNewDecFromStr("0.15"), + RewardFactor: sdkmath.LegacyMustNewDecFromStr("0.15"), }, }, }, @@ -376,17 +376,17 @@ func (s *migrateTestSuite) TestMigrate_GenState() { { Name: "small", MonthsLockup: 6, - Factor: sdk.MustNewDecFromStr("0.5"), + Factor: sdkmath.LegacyMustNewDecFromStr("0.5"), }, { Name: "large", MonthsLockup: 12, - Factor: sdk.MustNewDecFromStr("0.8"), + Factor: sdkmath.LegacyMustNewDecFromStr("0.8"), }, { Name: "medium", MonthsLockup: 9, - Factor: sdk.MustNewDecFromStr("0.7"), + Factor: sdkmath.LegacyMustNewDecFromStr("0.7"), }, }, }, @@ -401,7 +401,7 @@ func (s *migrateTestSuite) TestMigrate_GenState() { RewardIndexes: v016incentive.RewardIndexes{ { CollateralType: "kava", - RewardFactor: sdk.MustNewDecFromStr("0.5"), + RewardFactor: sdkmath.LegacyMustNewDecFromStr("0.5"), }, }, }, @@ -419,7 +419,7 @@ func (s *migrateTestSuite) TestMigrate_GenState() { RewardIndexes: []v016incentive.RewardIndex{ { CollateralType: "bnb", - RewardFactor: sdk.MustNewDecFromStr("0.15"), + RewardFactor: sdkmath.LegacyMustNewDecFromStr("0.15"), }, }, }, @@ -438,7 +438,7 @@ func (s *migrateTestSuite) TestMigrate_GenState() { RewardIndexes: []v016incentive.RewardIndex{ { CollateralType: "bnb", - RewardFactor: sdk.MustNewDecFromStr("0.15"), + RewardFactor: sdkmath.LegacyMustNewDecFromStr("0.15"), }, }, }, @@ -457,7 +457,7 @@ func (s *migrateTestSuite) TestMigrate_GenState() { RewardIndexes: []v016incentive.RewardIndex{ { CollateralType: "bnb", - RewardFactor: sdk.MustNewDecFromStr("0.15"), + RewardFactor: sdkmath.LegacyMustNewDecFromStr("0.15"), }, }, }, @@ -476,7 +476,7 @@ func (s *migrateTestSuite) TestMigrate_GenState() { RewardIndexes: []v016incentive.RewardIndex{ { CollateralType: "bnb", - RewardFactor: sdk.MustNewDecFromStr("0.25"), + RewardFactor: sdkmath.LegacyMustNewDecFromStr("0.25"), }, }, }, @@ -494,7 +494,7 @@ func (s *migrateTestSuite) TestMigrate_GenState() { RewardIndexes: []v016incentive.RewardIndex{ { CollateralType: "bnb", - RewardFactor: sdk.MustNewDecFromStr("0.25"), + RewardFactor: sdkmath.LegacyMustNewDecFromStr("0.25"), }, }, }, @@ -505,7 +505,7 @@ func (s *migrateTestSuite) TestMigrate_GenState() { RewardIndexes: []v016incentive.RewardIndex{ { CollateralType: "bnb", - RewardFactor: sdk.MustNewDecFromStr("0.25"), + RewardFactor: sdkmath.LegacyMustNewDecFromStr("0.25"), }, }, }, @@ -524,7 +524,7 @@ func (s *migrateTestSuite) TestMigrate_GenState() { RewardIndexes: []v016incentive.RewardIndex{ { CollateralType: "bnb", - RewardFactor: sdk.MustNewDecFromStr("0.25"), + RewardFactor: sdkmath.LegacyMustNewDecFromStr("0.25"), }, }, }, @@ -543,7 +543,7 @@ func (s *migrateTestSuite) TestMigrate_GenState() { RewardIndexes: []v016incentive.RewardIndex{ { CollateralType: "bnb", - RewardFactor: sdk.MustNewDecFromStr("0.25"), + RewardFactor: sdkmath.LegacyMustNewDecFromStr("0.25"), }, }, }, diff --git a/x/incentive/module.go b/x/incentive/module.go index f3a9dfc6e3..033a6fd336 100644 --- a/x/incentive/module.go +++ b/x/incentive/module.go @@ -133,11 +133,17 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw } // BeginBlock returns the begin blocker for the incentive module. -func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) { +func (am AppModule) BeginBlock(ctx sdk.Context) error { BeginBlocker(ctx, am.keeper) + + return nil } // EndBlock returns the end blocker for the incentive module. It returns no validator updates. -func (am AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { - return []abci.ValidatorUpdate{} +func (am AppModule) EndBlock(_ sdk.Context) ([]abci.ValidatorUpdate, error) { + return []abci.ValidatorUpdate{}, nil } + +func (AppModule) IsOnePerModuleType() {} + +func (AppModule) IsAppModule() {} diff --git a/x/incentive/spec/02_state.md b/x/incentive/spec/02_state.md index d76bfd9d69..7066667d5b 100644 --- a/x/incentive/spec/02_state.md +++ b/x/incentive/spec/02_state.md @@ -105,7 +105,7 @@ type BaseMultiClaim struct { // RewardIndex stores reward accumulation information type RewardIndex struct { CollateralType string `json:"collateral_type" yaml:"collateral_type"` - RewardFactor sdk.Dec `json:"reward_factor" yaml:"reward_factor"` + RewardFactor sdkmath.LegacyDec `json:"reward_factor" yaml:"reward_factor"` } // MultiRewardIndex stores reward accumulation information on multiple reward types diff --git a/x/incentive/spec/06_hooks.md b/x/incentive/spec/06_hooks.md index b532fa3311..42fbc981f2 100644 --- a/x/incentive/spec/06_hooks.md +++ b/x/incentive/spec/06_hooks.md @@ -83,7 +83,7 @@ func (h Hooks) BeforeDelegationSharesModified(ctx sdk.Context, delAddr sdk.AccAd // NOTE: following hooks are just implemented to ensure StakingHooks interface compliance // BeforeValidatorSlashed is called before a validator is slashed -func (h Hooks) BeforeValidatorSlashed(ctx sdk.Context, valAddr sdk.ValAddress, fraction sdk.Dec) {} +func (h Hooks) BeforeValidatorSlashed(ctx sdk.Context, valAddr sdk.ValAddress, fraction sdkmath.LegacyDec) {} // AfterValidatorBeginUnbonding is called after a validator begins unbonding func (h Hooks) AfterValidatorBeginUnbonding(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) { diff --git a/x/incentive/testutil/builder.go b/x/incentive/testutil/builder.go index e6ff578903..480089f0f4 100644 --- a/x/incentive/testutil/builder.go +++ b/x/incentive/testutil/builder.go @@ -211,7 +211,7 @@ func (builder IncentiveGenesisBuilder) simpleRewardPeriod(ctype string, rewardsP func newZeroRewardIndexesFromCoins(coins ...sdk.Coin) types.RewardIndexes { var ri types.RewardIndexes for _, coin := range coins { - ri = ri.With(coin.Denom, sdk.ZeroDec()) + ri = ri.With(coin.Denom, sdkmath.LegacyZeroDec()) } return ri } @@ -252,12 +252,12 @@ func (builder HardGenesisBuilder) WithInitializedMoneyMarket(market hardtypes.Mo builder.PreviousAccumulationTimes = append( builder.PreviousAccumulationTimes, - hardtypes.NewGenesisAccumulationTime(market.Denom, builder.genesisTime, sdk.OneDec(), sdk.OneDec()), + hardtypes.NewGenesisAccumulationTime(market.Denom, builder.genesisTime, sdkmath.LegacyOneDec(), sdkmath.LegacyOneDec()), ) return builder } -func (builder HardGenesisBuilder) WithMinBorrow(minUSDValue sdk.Dec) HardGenesisBuilder { +func (builder HardGenesisBuilder) WithMinBorrow(minUSDValue sdkmath.LegacyDec) HardGenesisBuilder { builder.Params.MinimumBorrowUSDValue = minUSDValue return builder } @@ -267,19 +267,19 @@ func NewStandardMoneyMarket(denom string) hardtypes.MoneyMarket { denom, hardtypes.NewBorrowLimit( false, - sdk.NewDec(1e15), - sdk.MustNewDecFromStr("0.6"), + sdkmath.LegacyNewDec(1e15), + sdkmath.LegacyMustNewDecFromStr("0.6"), ), denom+":usd", sdkmath.NewInt(1e6), hardtypes.NewInterestRateModel( - sdk.MustNewDecFromStr("0.05"), - sdk.MustNewDecFromStr("2"), - sdk.MustNewDecFromStr("0.8"), - sdk.MustNewDecFromStr("10"), + sdkmath.LegacyMustNewDecFromStr("0.05"), + sdkmath.LegacyMustNewDecFromStr("2"), + sdkmath.LegacyMustNewDecFromStr("0.8"), + sdkmath.LegacyMustNewDecFromStr("10"), ), - sdk.MustNewDecFromStr("0.05"), - sdk.ZeroDec(), + sdkmath.LegacyMustNewDecFromStr("0.05"), + sdkmath.LegacyZeroDec(), ) } diff --git a/x/incentive/testutil/integration.go b/x/incentive/testutil/integration.go index 549a210554..338ab574b4 100644 --- a/x/incentive/testutil/integration.go +++ b/x/incentive/testutil/integration.go @@ -7,11 +7,9 @@ import ( sdkmath "cosmossdk.io/math" abcitypes "github.com/cometbft/cometbft/abci/types" - tmproto "github.com/cometbft/cometbft/proto/tendermint/types" "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" distributiontypes "github.com/cosmos/cosmos-sdk/x/distribution/types" proposaltypes "github.com/cosmos/cosmos-sdk/x/params/types/proposal" @@ -82,11 +80,10 @@ func (suite *IntegrationTester) StartChain(genesisStates ...app.GenesisState) { genesisStates..., ) - suite.Ctx = suite.App.NewContext(false, tmproto.Header{ - Height: 1, - Time: suite.GenesisTime, - ChainID: app.TestChainId, - }) + suite.Ctx = suite.App.NewContextLegacy(false) + suite.Ctx.WithBlockTime(suite.GenesisTime) + suite.Ctx.WithChainID(app.TestChainId) + suite.Ctx.WithBlockHeight(1) } func (suite *IntegrationTester) NextBlockAfter(blockDuration time.Duration) { @@ -129,9 +126,11 @@ func (suite *IntegrationTester) NextBlockAtWithRequest( } blockHeight := suite.Ctx.BlockHeight() + 1 - responseEndBlock := suite.App.EndBlocker(suite.Ctx, reqEnd) + responseEndBlock, err := suite.App.EndBlocker(suite.Ctx) + suite.Require().NoError(err) suite.Ctx = suite.Ctx.WithBlockTime(blockTime).WithBlockHeight(blockHeight).WithChainID(app.TestChainId) - responseBeginBlock := suite.App.BeginBlocker(suite.Ctx, reqBegin) // height and time in RequestBeginBlock are ignored by module begin blockers + responseBeginBlock, err := suite.App.BeginBlocker(suite.Ctx) // height and time in RequestBeginBlock are ignored by module begin blockers + suite.Require().NoError(err) return responseEndBlock, responseBeginBlock } @@ -205,7 +204,7 @@ func (suite *IntegrationTester) DeliverMsgCreateValidator(address sdk.ValAddress ed25519.GenPrivKey().PubKey(), selfDelegation, stakingtypes.Description{}, - stakingtypes.NewCommissionRates(sdk.ZeroDec(), sdk.ZeroDec(), sdk.ZeroDec()), + stakingtypes.NewCommissionRates(sdkmath.LegacyZeroDec(), sdkmath.LegacyZeroDec(), sdkmath.LegacyZeroDec()), sdkmath.NewInt(1_000_000), ) if err != nil { @@ -229,7 +228,7 @@ func (suite *IntegrationTester) DeliverMsgDelegate(delegator sdk.AccAddress, val return err } -func (suite *IntegrationTester) DeliverSwapMsgDeposit(depositor sdk.AccAddress, tokenA, tokenB sdk.Coin, slippage sdk.Dec) error { +func (suite *IntegrationTester) DeliverSwapMsgDeposit(depositor sdk.AccAddress, tokenA, tokenB sdk.Coin, slippage sdkmath.LegacyDec) error { msg := swaptypes.NewMsgDeposit( depositor.String(), tokenA, @@ -351,12 +350,12 @@ func (suite *IntegrationTester) ProposeAndVoteOnNewParams(voter sdk.AccAddress, suite.NoError(err) } -func (suite *IntegrationTester) GetAccount(addr sdk.AccAddress) authtypes.AccountI { +func (suite *IntegrationTester) GetAccount(addr sdk.AccAddress) sdk.AccountI { ak := suite.App.GetAccountKeeper() return ak.GetAccount(suite.Ctx, addr) } -func (suite *IntegrationTester) GetModuleAccount(name string) authtypes.ModuleAccountI { +func (suite *IntegrationTester) GetModuleAccount(name string) sdk.ModuleAccountI { ak := suite.App.GetAccountKeeper() return ak.GetModuleAccount(suite.Ctx, name) } diff --git a/x/incentive/testutil/mint_builder.go b/x/incentive/testutil/mint_builder.go index 9c7bde74ad..6885315a39 100644 --- a/x/incentive/testutil/mint_builder.go +++ b/x/incentive/testutil/mint_builder.go @@ -39,22 +39,22 @@ func (builder MintGenesisBuilder) BuildMarshalled(cdc codec.JSONCodec) app.Genes } func (builder MintGenesisBuilder) WithMinter( - inflation sdk.Dec, - annualProvisions sdk.Dec, + inflation sdkmath.LegacyDec, + annualProvisions sdkmath.LegacyDec, ) MintGenesisBuilder { builder.Minter = minttypes.NewMinter(inflation, annualProvisions) return builder } func (builder MintGenesisBuilder) WithInflationMax( - inflationMax sdk.Dec, + inflationMax sdkmath.LegacyDec, ) MintGenesisBuilder { builder.Params.InflationMax = inflationMax return builder } func (builder MintGenesisBuilder) WithInflationMin( - inflationMin sdk.Dec, + inflationMin sdkmath.LegacyDec, ) MintGenesisBuilder { builder.Params.InflationMin = inflationMin return builder diff --git a/x/incentive/types/accumulator.go b/x/incentive/types/accumulator.go index e9937cc8be..7aec182603 100644 --- a/x/incentive/types/accumulator.go +++ b/x/incentive/types/accumulator.go @@ -1,6 +1,7 @@ package types import ( + sdkmath "cosmossdk.io/math" "fmt" "math" "time" @@ -30,7 +31,7 @@ func NewAccumulator(previousAccrual time.Time, indexes RewardIndexes) *Accumulat // If a period ends before currentTime, the PreviousAccrualTime is shortened to the end time. This allows accumulate to be called sequentially on consecutive reward periods. // // totalSourceShares is the sum of all users' source shares. For example:total btcb supplied to hard, total usdx borrowed from all bnb CDPs, or total shares in a swap pool. -func (acc *Accumulator) Accumulate(period MultiRewardPeriod, totalSourceShares sdk.Dec, currentTime time.Time) { +func (acc *Accumulator) Accumulate(period MultiRewardPeriod, totalSourceShares sdkmath.LegacyDec, currentTime time.Time) { acc.AccumulateDecCoins( period.Start, period.End, @@ -45,7 +46,7 @@ func (acc *Accumulator) AccumulateDecCoins( periodStart time.Time, periodEnd time.Time, periodRewardsPerSecond sdk.DecCoins, - totalSourceShares sdk.Dec, + totalSourceShares sdkmath.LegacyDec, currentTime time.Time, ) { accumulationDuration := acc.getTimeElapsedWithinLimits(acc.PreviousAccumulationTime, currentTime, periodStart, periodEnd) @@ -76,8 +77,8 @@ func (*Accumulator) getTimeElapsedWithinLimits(start, end, limitMin, limitMax ti // The total rewards to distribute in this block are given by reward rate * duration. This value divided by the sum of all source shares to give // total rewards per source share, which is what the indexes store. // Note, duration is rounded to the nearest second to keep rewards calculation consistent with kava-7. -func (*Accumulator) calculateNewRewards(rewardsPerSecond sdk.DecCoins, totalSourceShares sdk.Dec, duration time.Duration) RewardIndexes { - if totalSourceShares.LTE(sdk.ZeroDec()) { +func (*Accumulator) calculateNewRewards(rewardsPerSecond sdk.DecCoins, totalSourceShares sdkmath.LegacyDec, duration time.Duration) RewardIndexes { + if totalSourceShares.LTE(sdkmath.LegacyZeroDec()) { // When there is zero source shares, there is no users with deposits/borrows/delegations to pay out the current block's rewards to. // So drop the rewards and pay out nothing. return nil @@ -89,7 +90,7 @@ func (*Accumulator) calculateNewRewards(rewardsPerSecond sdk.DecCoins, totalSour return nil } increment := NewRewardIndexesFromCoins(rewardsPerSecond) - increment = increment.Mul(sdk.NewDec(durationSeconds)).Quo(totalSourceShares) + increment = increment.Mul(sdkmath.LegacyNewDec(durationSeconds)).Quo(totalSourceShares) return increment } @@ -140,5 +141,5 @@ func CalculatePerSecondRewards( return nil, upTo // TODO } - return periodRewardsPerSecond.MulDec(sdk.NewDec(durationSeconds)), upTo + return periodRewardsPerSecond.MulDec(sdkmath.LegacyNewDec(durationSeconds)), upTo } diff --git a/x/incentive/types/accumulator_test.go b/x/incentive/types/accumulator_test.go index f179284791..860ced10b8 100644 --- a/x/incentive/types/accumulator_test.go +++ b/x/incentive/types/accumulator_test.go @@ -104,7 +104,7 @@ func TestAccumulator(t *testing.T) { type args struct { rewardsPerSecond sdk.Coins duration time.Duration - totalSourceShares sdk.Dec + totalSourceShares sdkmath.LegacyDec } testcases := []struct { name string @@ -201,7 +201,7 @@ func TestAccumulator(t *testing.T) { type args struct { accumulator Accumulator period MultiRewardPeriod - totalSourceShares sdk.Dec + totalSourceShares sdkmath.LegacyDec currentTime time.Time } testcases := []struct { diff --git a/x/incentive/types/apy.go b/x/incentive/types/apy.go index d7e54462f1..17504950ca 100644 --- a/x/incentive/types/apy.go +++ b/x/incentive/types/apy.go @@ -1,9 +1,11 @@ package types -import sdk "github.com/cosmos/cosmos-sdk/types" +import ( + sdkmath "cosmossdk.io/math" +) // NewAPY returns a new instance of APY -func NewAPY(collateralType string, apy sdk.Dec) Apy { +func NewAPY(collateralType string, apy sdkmath.LegacyDec) Apy { return Apy{ CollateralType: collateralType, Apy: apy, diff --git a/x/incentive/types/apy.pb.go b/x/incentive/types/apy.pb.go index ecf4ca3b51..3378ec48cf 100644 --- a/x/incentive/types/apy.pb.go +++ b/x/incentive/types/apy.pb.go @@ -4,9 +4,9 @@ package types import ( + cosmossdk_io_math "cosmossdk.io/math" fmt "fmt" _ "github.com/cosmos/cosmos-proto" - github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" io "io" @@ -28,8 +28,8 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // Apy contains the calculated APY for a given collateral type at a specific // instant in time. type Apy struct { - CollateralType string `protobuf:"bytes,1,opt,name=collateral_type,json=collateralType,proto3" json:"collateral_type,omitempty"` - Apy github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=apy,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"apy"` + CollateralType string `protobuf:"bytes,1,opt,name=collateral_type,json=collateralType,proto3" json:"collateral_type,omitempty"` + Apy cosmossdk_io_math.LegacyDec `protobuf:"bytes,2,opt,name=apy,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"apy"` } func (m *Apy) Reset() { *m = Apy{} } @@ -79,23 +79,23 @@ func init() { func init() { proto.RegisterFile("kava/incentive/v1beta1/apy.proto", fileDescriptor_b2c1ad571f25cae9) } var fileDescriptor_b2c1ad571f25cae9 = []byte{ - // 248 bytes of a gzipped FileDescriptorProto + // 255 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0xc8, 0x4e, 0x2c, 0x4b, 0xd4, 0xcf, 0xcc, 0x4b, 0x4e, 0xcd, 0x2b, 0xc9, 0x2c, 0x4b, 0xd5, 0x2f, 0x33, 0x4c, 0x4a, 0x2d, 0x49, 0x34, 0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f0, 0x58, 0x8e, 0xe1, 0xc6, 0x63, 0x39, - 0x86, 0x28, 0x6d, 0x24, 0x43, 0x41, 0xbe, 0xd5, 0xcd, 0x49, 0x4c, 0x2a, 0x06, 0xb3, 0xf4, 0x2b, - 0x90, 0xc2, 0x06, 0x6c, 0x7a, 0x12, 0x1b, 0xd8, 0x37, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, - 0x95, 0x59, 0xa8, 0x77, 0x3a, 0x01, 0x00, 0x00, + 0x83, 0x33, 0x88, 0x0f, 0x21, 0x1c, 0x52, 0x59, 0x90, 0x2a, 0xe4, 0xcc, 0xc5, 0x9c, 0x58, 0x50, + 0x29, 0xc1, 0x04, 0x92, 0x74, 0x32, 0x3c, 0x71, 0x4f, 0x9e, 0xe1, 0xd6, 0x3d, 0x79, 0x69, 0x88, + 0x45, 0xc5, 0x29, 0xd9, 0x7a, 0x99, 0xf9, 0xfa, 0xb9, 0x89, 0x25, 0x19, 0x7a, 0x3e, 0xa9, 0xe9, + 0x89, 0xc9, 0x95, 0x2e, 0xa9, 0xc9, 0x97, 0xb6, 0xe8, 0x72, 0x41, 0xdd, 0xe1, 0x92, 0x9a, 0x1c, + 0x04, 0xd2, 0xed, 0xe4, 0x7a, 0xe2, 0x91, 0x1c, 0xe3, 0x85, 0x47, 0x72, 0x8c, 0x0f, 0x1e, 0xc9, + 0x31, 0x4e, 0x78, 0x2c, 0xc7, 0x70, 0xe1, 0xb1, 0x1c, 0xc3, 0x8d, 0xc7, 0x72, 0x0c, 0x51, 0xda, + 0xe9, 0x99, 0x25, 0x19, 0xa5, 0x49, 0x7a, 0xc9, 0xf9, 0xb9, 0xfa, 0x20, 0x2f, 0xea, 0xe6, 0x24, + 0x26, 0x15, 0x83, 0x59, 0xfa, 0x15, 0x48, 0x01, 0x02, 0x72, 0x60, 0x71, 0x12, 0x1b, 0xd8, 0x0b, + 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0x05, 0x24, 0xc5, 0xf4, 0x2f, 0x01, 0x00, 0x00, } func (m *Apy) Marshal() (dAtA []byte, err error) { diff --git a/x/incentive/types/claims.go b/x/incentive/types/claims.go index ac7bc5f611..4395067009 100644 --- a/x/incentive/types/claims.go +++ b/x/incentive/types/claims.go @@ -1,6 +1,7 @@ package types import ( + sdkmath "cosmossdk.io/math" "errors" "fmt" "strings" @@ -395,7 +396,7 @@ func (cs EarnClaims) Validate() error { // ---------------------- Reward indexes are used internally in the store ---------------------- // NewRewardIndex returns a new RewardIndex -func NewRewardIndex(collateralType string, factor sdk.Dec) RewardIndex { +func NewRewardIndex(collateralType string, factor sdkmath.LegacyDec) RewardIndex { return RewardIndex{ CollateralType: collateralType, RewardFactor: factor, @@ -427,17 +428,17 @@ func (ris RewardIndexes) GetRewardIndex(denom string) (RewardIndex, bool) { } // Get fetches a RewardFactor by it's denom -func (ris RewardIndexes) Get(denom string) (sdk.Dec, bool) { +func (ris RewardIndexes) Get(denom string) (sdkmath.LegacyDec, bool) { for _, ri := range ris { if ri.CollateralType == denom { return ri.RewardFactor, true } } - return sdk.Dec{}, false + return sdkmath.LegacyDec{}, false } // With returns a copy of the indexes with a new reward factor added -func (ris RewardIndexes) With(denom string, factor sdk.Dec) RewardIndexes { +func (ris RewardIndexes) With(denom string, factor sdkmath.LegacyDec) RewardIndexes { newIndexes := ris.copy() for i, ri := range newIndexes { @@ -470,7 +471,7 @@ func (ris RewardIndexes) Validate() error { } // Mul returns a copy of RewardIndexes with all factors multiplied by a single value. -func (ris RewardIndexes) Mul(multiplier sdk.Dec) RewardIndexes { +func (ris RewardIndexes) Mul(multiplier sdkmath.LegacyDec) RewardIndexes { newIndexes := ris.copy() for i := range newIndexes { @@ -480,8 +481,8 @@ func (ris RewardIndexes) Mul(multiplier sdk.Dec) RewardIndexes { } // Quo returns a copy of RewardIndexes with all factors divided by a single value. -// It uses sdk.Dec.Quo for the division. -func (ris RewardIndexes) Quo(divisor sdk.Dec) RewardIndexes { +// It uses sdkmath.LegacyDec.Quo for the division. +func (ris RewardIndexes) Quo(divisor sdkmath.LegacyDec) RewardIndexes { newIndexes := ris.copy() for i := range newIndexes { diff --git a/x/incentive/types/claims.pb.go b/x/incentive/types/claims.pb.go index 8f098c5578..16392ca497 100644 --- a/x/incentive/types/claims.pb.go +++ b/x/incentive/types/claims.pb.go @@ -4,6 +4,7 @@ package types import ( + cosmossdk_io_math "cosmossdk.io/math" fmt "fmt" _ "github.com/cosmos/cosmos-proto" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" @@ -106,8 +107,8 @@ var xxx_messageInfo_BaseMultiClaim proto.InternalMessageInfo // RewardIndex stores reward accumulation information type RewardIndex struct { - CollateralType string `protobuf:"bytes,1,opt,name=collateral_type,json=collateralType,proto3" json:"collateral_type,omitempty"` - RewardFactor github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=reward_factor,json=rewardFactor,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"reward_factor"` + CollateralType string `protobuf:"bytes,1,opt,name=collateral_type,json=collateralType,proto3" json:"collateral_type,omitempty"` + RewardFactor cosmossdk_io_math.LegacyDec `protobuf:"bytes,2,opt,name=reward_factor,json=rewardFactor,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"reward_factor"` } func (m *RewardIndex) Reset() { *m = RewardIndex{} } @@ -513,51 +514,51 @@ func init() { } var fileDescriptor_5f7515029623a895 = []byte{ - // 691 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x56, 0x4f, 0x4f, 0x13, 0x4d, - 0x18, 0xef, 0xc0, 0x0b, 0x79, 0x3b, 0x94, 0xbe, 0x64, 0x81, 0x57, 0xe8, 0x61, 0x8b, 0x25, 0xc1, - 0x26, 0xa6, 0xbb, 0x82, 0x07, 0x13, 0x6f, 0x2c, 0x68, 0xc0, 0x48, 0x24, 0x5b, 0x4d, 0x8c, 0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35, 0xaa, 0x8e, 0x38, 0xed, 0x18, 0x73, 0x57, 0x95, 0x35, 0x6e, - 0xc1, 0x61, 0x86, 0x5b, 0x88, 0x05, 0x53, 0x03, 0x33, 0xa0, 0x38, 0xb2, 0x30, 0x6d, 0xe9, 0x64, - 0xa1, 0xe7, 0x40, 0xa4, 0xb5, 0x44, 0x49, 0xe4, 0xfc, 0xb3, 0xdd, 0xc9, 0xa7, 0x5c, 0x9d, 0x7e, - 0x3b, 0xfd, 0x7e, 0xab, 0x34, 0x24, 0x39, 0x16, 0x76, 0x01, 0xcc, 0x0a, 0xc6, 0x6b, 0x8d, 0x30, - 0x26, 0x7f, 0x87, 0xb6, 0x9f, 0xa0, 0x3d, 0x78, 0x36, 0xed, 0x1b, 0x82, 0xf6, 0xdb, 0xef, 0xf9, - 0xe2, 0x39, 0xf0, 0xc5, 0x02, 0xde, 0x4d, 0xe2, 0x4b, 0x00, 0x47, 0x5c, 0x19, 0x5d, 0x8d, 0x02, - 0xbc, 0x69, 0x5c, 0x83, 0xff, 0xf9, 0x34, 0x0c, 0x51, 0x8c, 0x19, 0x0a, 0x2b, 0x62, 0xb1, 0x54, - 0x9a, 0x76, 0xb3, 0x47, 0xe1, 0x87, 0xed, 0x3a, 0x36, 0xca, 0x70, 0x54, 0x55, 0xab, 0x3c, 0x43, - 0x7e, 0x4c, 0x99, 0xb4, 0x39, 0xe3, 0x58, 0x82, 0xd4, 0xb7, 0x4e, 0x7e, 0xee, 0x1c, 0xa4, 0x96, - 0xb1, 0xef, 0x66, 0x54, 0x91, 0xbb, 0xb2, 0x46, 0xa1, 0x05, 0x8d, 0x04, 0x19, 0xcc, 0xd7, 0x65, - 0x87, 0x22, 0x98, 0xd5, 0x50, 0x44, 0x85, 0xa7, 0x80, 0xf4, 0x66, 0xd6, 0xea, 0xde, 0xba, 0x56, - 0xa2, 0x86, 0x33, 0xa9, 0x5d, 0x1a, 0x3d, 0x56, 0xd8, 0xd5, 0xe4, 0xf5, 0xb0, 0xf0, 0x06, 0xc0, - 0x31, 0xb9, 0xcb, 0x7f, 0xe4, 0xc5, 0x69, 0x82, 0x03, 0xfd, 0x26, 0xf8, 0x1a, 0xc0, 0x2b, 0x27, - 0x09, 0x1e, 0xf8, 0xd3, 0x84, 0x13, 0x35, 0x31, 0x55, 0xe9, 0xea, 0x52, 0xb1, 0x17, 0x89, 0x93, - 0xe5, 0x9c, 0x9c, 0x66, 0x62, 0x9c, 0x06, 0x72, 0x8d, 0xda, 0xa9, 0x58, 0xe1, 0x03, 0x80, 0x63, - 0x8f, 0xca, 0xcb, 0x8f, 0xd7, 0x48, 0x14, 0x93, 0xa8, 0xaa, 0x3e, 0x90, 0x7b, 0x10, 0x8a, 0x56, - 0xad, 0xc8, 0x33, 0x46, 0xfa, 0x35, 0xb2, 0x70, 0xb5, 0x17, 0x85, 0xc3, 0xe3, 0xc0, 0xf9, 0x57, - 0x60, 0xef, 0x74, 0xf2, 0xc0, 0x4d, 0x7b, 0x87, 0x67, 0xc4, 0xc5, 0xfb, 0x9a, 0xfc, 0x14, 0x7e, - 0x0e, 0xc0, 0xdc, 0x0a, 0x62, 0xc1, 0x7d, 0xf2, 0xa2, 0x41, 0x02, 0x12, 0xb7, 0xd7, 0x19, 0x6d, - 0x92, 0x00, 0x33, 0x45, 0xe6, 0x41, 0x17, 0x61, 0x73, 0x67, 0x09, 0x3b, 0x3a, 0x35, 0xba, 0xab, - 0xdb, 0x84, 0x93, 0xbc, 0x51, 0xaf, 0x87, 0xed, 0x4a, 0x57, 0x91, 0xfd, 0xd9, 0xb7, 0x71, 0x05, - 0x71, 0x2c, 0x28, 0x90, 0x3d, 0xca, 0x18, 0x6d, 0x9d, 0x44, 0x1e, 0xec, 0x27, 0xb2, 0x82, 0x70, - 0x7b, 0xd9, 0xfd, 0x15, 0xc0, 0xec, 0x32, 0x0e, 0x71, 0x15, 0xc5, 0xf4, 0xa2, 0x2c, 0xde, 0xe8, - 0xd1, 0x40, 0xfd, 0x51, 0xd8, 0xbb, 0x95, 0x3e, 0x01, 0x98, 0x2e, 0xb7, 0x50, 0xfd, 0x92, 0xc9, - 0xfa, 0x0c, 0x60, 0xa6, 0x8c, 0x9a, 0x24, 0xaa, 0xf2, 0x4b, 0xb8, 0x61, 0x77, 0x10, 0x8b, 0x2e, - 0x97, 0x2c, 0x67, 0x75, 0xfb, 0x87, 0x99, 0xda, 0xde, 0x33, 0xc1, 0xce, 0x9e, 0x09, 0x76, 0xf7, - 0x4c, 0xf0, 0x6a, 0xdf, 0x4c, 0xed, 0xec, 0x9b, 0xa9, 0x2f, 0xfb, 0x66, 0xea, 0xc9, 0xf5, 0xc4, - 0x3f, 0x5a, 0xf0, 0x28, 0x85, 0xc8, 0xe3, 0xf2, 0xcd, 0xde, 0x4c, 0xdc, 0x1a, 0xe5, 0xcf, 0xda, - 0x1b, 0x96, 0x97, 0xb8, 0x9b, 0xbf, 0x03, 0x00, 0x00, 0xff, 0xff, 0x88, 0xd7, 0x8a, 0x4f, 0x54, - 0x0a, 0x00, 0x00, + // 703 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x56, 0x4d, 0x4f, 0x13, 0x4f, + 0x18, 0xef, 0xc0, 0x1f, 0xf2, 0xef, 0x50, 0x2a, 0x59, 0x40, 0xa1, 0x26, 0x5b, 0x2c, 0x89, 0x36, + 0x31, 0xdd, 0x15, 0x3c, 0x98, 0x78, 0x63, 0x41, 0x03, 0x06, 0x22, 0x59, 0x34, 0x31, 0x1e, 0x6c, + 0x66, 0x77, 0xc7, 0x65, 0xd2, 0xed, 0x4e, 0xdd, 0xd9, 0xb6, 0xf4, 0xe6, 0x47, 0xd0, 0x2f, 0xe0, + 0x07, 0xf0, 0xe2, 0x85, 0x0f, 0x41, 0x8c, 0x07, 0x62, 0x4c, 0x7c, 0x39, 0x54, 0x84, 0xab, 0x9f, + 0xc0, 0x93, 0x99, 0x17, 0x60, 0x81, 0x96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, 0x59, 0xd6, 0xca, + 0xce, 0x0f, 0x3d, 0xb5, 0xb3, 0xaf, 0x83, 0xdd, 0x7d, 0x1d, 0xec, 0xed, 0xeb, 0xe0, 0xd5, 0x81, + 0x9e, 0xda, 0x3d, 0xd0, 0x53, 0x5f, 0x0e, 0xf4, 0xd4, 0xd3, 0x9b, 0x89, 0xd7, 0x02, 0xe7, 0x51, + 0x0a, 0x90, 0xc3, 0xc4, 0x97, 0xb9, 0x95, 0x78, 0x2a, 0x8a, 0x67, 0x83, 0x33, 0x2c, 0x5e, 0x6e, + 0xb7, 0x7f, 0x07, 0x00, 0x00, 0xff, 0xff, 0xdf, 0xff, 0x44, 0xe6, 0x49, 0x0a, 0x00, 0x00, } func (m *BaseClaim) Marshal() (dAtA []byte, err error) { diff --git a/x/incentive/types/claims_test.go b/x/incentive/types/claims_test.go index 143b6f9d35..3f92c52411 100644 --- a/x/incentive/types/claims_test.go +++ b/x/incentive/types/claims_test.go @@ -10,8 +10,8 @@ import ( "github.com/stretchr/testify/require" ) -// d is a helper function for creating sdk.Dec values in tests -func d(str string) sdk.Dec { return sdk.MustNewDecFromStr(str) } +// d is a helper function for creating sdkmath.LegacyDec values in tests +func d(str string) sdkmath.LegacyDec { return sdkmath.LegacyMustNewDecFromStr(str) } // c is a helper function for created sdk.Coin types in tests func c(denom string, amount int64) sdk.Coin { return sdk.NewInt64Coin(denom, amount) } @@ -31,7 +31,7 @@ func TestClaims_Validate(t *testing.T) { { "valid", USDXMintingClaims{ - NewUSDXMintingClaim(owner, sdk.NewCoin("bnb", sdk.OneInt()), RewardIndexes{NewRewardIndex("bnb-a", sdk.ZeroDec())}), + NewUSDXMintingClaim(owner, sdk.NewCoin("bnb", sdkmath.OneInt()), RewardIndexes{NewRewardIndex("bnb-a", sdkmath.LegacyZeroDec())}), }, true, }, @@ -52,7 +52,7 @@ func TestClaims_Validate(t *testing.T) { { BaseClaim: BaseClaim{ Owner: owner, - Reward: sdk.Coin{Denom: "", Amount: sdk.ZeroInt()}, + Reward: sdk.Coin{Denom: "", Amount: sdkmath.ZeroInt()}, }, }, }, @@ -64,9 +64,9 @@ func TestClaims_Validate(t *testing.T) { { BaseClaim: BaseClaim{ Owner: owner, - Reward: sdk.NewCoin("bnb", sdk.OneInt()), + Reward: sdk.NewCoin("bnb", sdkmath.OneInt()), }, - RewardIndexes: []RewardIndex{{"", sdk.ZeroDec()}}, + RewardIndexes: []RewardIndex{{"", sdkmath.LegacyZeroDec()}}, }, }, false, @@ -193,11 +193,11 @@ func TestClaims_Validate(t *testing.T) { func TestRewardIndexes(t *testing.T) { t.Run("With", func(t *testing.T) { - arbitraryDec := sdk.MustNewDecFromStr("0.1") + arbitraryDec := sdkmath.LegacyMustNewDecFromStr("0.1") type args struct { denom string - factor sdk.Dec + factor sdkmath.LegacyDec } testcases := []struct { name string @@ -244,10 +244,10 @@ func TestRewardIndexes(t *testing.T) { } }) t.Run("Get", func(t *testing.T) { - arbitraryDec := sdk.MustNewDecFromStr("0.1") + arbitraryDec := sdkmath.LegacyMustNewDecFromStr("0.1") type expected struct { - factor sdk.Dec + factor sdkmath.LegacyDec found bool } testcases := []struct { @@ -292,7 +292,7 @@ func TestRewardIndexes(t *testing.T) { testcases := []struct { name string rewardIndexes RewardIndexes - multiplier sdk.Dec + multiplier sdkmath.LegacyDec expected RewardIndexes }{ { @@ -362,7 +362,7 @@ func TestRewardIndexes(t *testing.T) { testcases := []struct { name string rewardIndexes RewardIndexes - divisor sdk.Dec + divisor sdkmath.LegacyDec expected expected }{ { @@ -550,7 +550,7 @@ func TestMultiRewardIndexes(t *testing.T) { arbitraryRewardIndexes := RewardIndexes{ { CollateralType: "reward", - RewardFactor: sdk.MustNewDecFromStr("0.1"), + RewardFactor: sdkmath.LegacyMustNewDecFromStr("0.1"), }, } @@ -770,12 +770,12 @@ func TestMultiRewardIndexes(t *testing.T) { } var normalRewardIndexes = RewardIndexes{ - NewRewardIndex("hard", sdk.MustNewDecFromStr("0.000001")), - NewRewardIndex("ukava", sdk.MustNewDecFromStr("0.1")), + NewRewardIndex("hard", sdkmath.LegacyMustNewDecFromStr("0.000001")), + NewRewardIndex("ukava", sdkmath.LegacyMustNewDecFromStr("0.1")), } var invalidRewardIndexes = RewardIndexes{ - RewardIndex{"hard", sdk.MustNewDecFromStr("-0.01")}, + RewardIndex{"hard", sdkmath.LegacyMustNewDecFromStr("-0.01")}, } func appendUniqueRewardIndex(indexes RewardIndexes) RewardIndexes { @@ -789,6 +789,6 @@ func appendUniqueRewardIndex(indexes RewardIndexes) RewardIndexes { return append( indexes, - NewRewardIndex(uniqueDenom, sdk.MustNewDecFromStr("0.02")), + NewRewardIndex(uniqueDenom, sdkmath.LegacyMustNewDecFromStr("0.02")), ) } diff --git a/x/incentive/types/codec.go b/x/incentive/types/codec.go index ccf560056d..625d8d99d3 100644 --- a/x/incentive/types/codec.go +++ b/x/incentive/types/codec.go @@ -6,7 +6,6 @@ import ( cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/msgservice" - authzcodec "github.com/cosmos/cosmos-sdk/x/authz/codec" ) // RegisterLegacyAminoCodec registers all the necessary types and interfaces for the @@ -45,5 +44,5 @@ func init() { // Register all Amino interfaces and concrete types on the authz Amino codec so that this can later be // used to properly serialize MsgGrant and MsgExec instances - RegisterLegacyAminoCodec(authzcodec.Amino) + RegisterLegacyAminoCodec(codec.NewLegacyAmino()) } diff --git a/x/incentive/types/expected_keepers.go b/x/incentive/types/expected_keepers.go index caf27faab2..39dc487991 100644 --- a/x/incentive/types/expected_keepers.go +++ b/x/incentive/types/expected_keepers.go @@ -1,9 +1,9 @@ package types import ( + "context" sdkmath "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" @@ -24,25 +24,25 @@ type ParamSubspace interface { // BankKeeper defines the expected interface needed to send coins type BankKeeper interface { - SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error - GetAllBalances(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins - GetSupply(ctx sdk.Context, denom string) sdk.Coin + SendCoinsFromModuleToAccount(ctx context.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error + GetAllBalances(ctx context.Context, addr sdk.AccAddress) sdk.Coins + GetSupply(ctx context.Context, denom string) sdk.Coin } // StakingKeeper defines the expected staking keeper for module accounts type StakingKeeper interface { - GetDelegatorDelegations(ctx sdk.Context, delegator sdk.AccAddress, maxRetrieve uint16) (delegations []stakingtypes.Delegation) - GetValidatorDelegations(ctx sdk.Context, valAddr sdk.ValAddress) (delegations []stakingtypes.Delegation) - GetValidator(ctx sdk.Context, addr sdk.ValAddress) (validator stakingtypes.Validator, found bool) - TotalBondedTokens(ctx sdk.Context) sdkmath.Int + GetDelegatorDelegations(ctx context.Context, delegator sdk.AccAddress, maxRetrieve uint16) (delegations []stakingtypes.Delegation, err error) + GetValidatorDelegations(ctx context.Context, valAddr sdk.ValAddress) (delegations []stakingtypes.Delegation, err error) + GetValidator(ctx context.Context, addr sdk.ValAddress) (validator stakingtypes.Validator, err error) + TotalBondedTokens(ctx context.Context) (sdkmath.Int, error) } // CdpKeeper defines the expected cdp keeper for interacting with cdps type CdpKeeper interface { - GetInterestFactor(ctx sdk.Context, collateralType string) (sdk.Dec, bool) - GetTotalPrincipal(ctx sdk.Context, collateralType string, principalDenom string) (total sdkmath.Int) - GetCdpByOwnerAndCollateralType(ctx sdk.Context, owner sdk.AccAddress, collateralType string) (cdptypes.CDP, bool) - GetCollateral(ctx sdk.Context, collateralType string) (cdptypes.CollateralParam, bool) + GetInterestFactor(ctx context.Context, collateralType string) (sdkmath.LegacyDec, bool) + GetTotalPrincipal(ctx context.Context, collateralType string, principalDenom string) (total sdkmath.Int) + GetCdpByOwnerAndCollateralType(ctx context.Context, owner sdk.AccAddress, collateralType string) (cdptypes.CDP, bool) + GetCollateral(ctx context.Context, collateralType string) (cdptypes.CollateralParam, bool) } // HardKeeper defines the expected hard keeper for interacting with Hard protocol @@ -50,8 +50,8 @@ type HardKeeper interface { GetDeposit(ctx sdk.Context, depositor sdk.AccAddress) (hardtypes.Deposit, bool) GetBorrow(ctx sdk.Context, borrower sdk.AccAddress) (hardtypes.Borrow, bool) - GetSupplyInterestFactor(ctx sdk.Context, denom string) (sdk.Dec, bool) - GetBorrowInterestFactor(ctx sdk.Context, denom string) (sdk.Dec, bool) + GetSupplyInterestFactor(ctx sdk.Context, denom string) (sdkmath.LegacyDec, bool) + GetBorrowInterestFactor(ctx sdk.Context, denom string) (sdkmath.LegacyDec, bool) GetBorrowedCoins(ctx sdk.Context) (coins sdk.Coins, found bool) GetSuppliedCoins(ctx sdk.Context) (coins sdk.Coins, found bool) } @@ -90,19 +90,19 @@ type LiquidKeeper interface { // AccountKeeper expected interface for the account keeper (noalias) type AccountKeeper interface { - GetAccount(ctx sdk.Context, addr sdk.AccAddress) authtypes.AccountI - SetAccount(ctx sdk.Context, acc authtypes.AccountI) - GetModuleAccount(ctx sdk.Context, name string) authtypes.ModuleAccountI + GetAccount(ctx context.Context, addr sdk.AccAddress) sdk.AccountI + SetAccount(ctx context.Context, acc sdk.AccountI) + GetModuleAccount(ctx context.Context, name string) sdk.ModuleAccountI } // MintKeeper defines the required methods needed by this modules keeper type MintKeeper interface { - GetMinter(ctx sdk.Context) (minter minttypes.Minter) + GetMinter(ctx context.Context) (minter minttypes.Minter) } // DistrKeeper defines the required methods needed by this modules keeper type DistrKeeper interface { - GetCommunityTax(ctx sdk.Context) (percent sdk.Dec) + GetCommunityTax(ctx context.Context) (percent sdkmath.LegacyDec, err error) } // PricefeedKeeper defines the required methods needed by this modules keeper diff --git a/x/incentive/types/genesis_test.go b/x/incentive/types/genesis_test.go index 4cf95d2a06..f22e0f9c61 100644 --- a/x/incentive/types/genesis_test.go +++ b/x/incentive/types/genesis_test.go @@ -52,8 +52,8 @@ func TestGenesisState_Validate(t *testing.T) { { Denom: "ukava", Multipliers: Multipliers{ - NewMultiplier("small", 1, sdk.MustNewDecFromStr("0.33")), - NewMultiplier("large", 12, sdk.MustNewDecFromStr("1.00")), + NewMultiplier("small", 1, sdkmath.LegacyMustNewDecFromStr("0.33")), + NewMultiplier("large", 12, sdkmath.LegacyMustNewDecFromStr("1.00")), }, }, }, @@ -78,7 +78,7 @@ func TestGenesisState_Validate(t *testing.T) { RewardIndexes: []RewardIndex{ { CollateralType: "bnb-a", - RewardFactor: sdk.ZeroDec(), + RewardFactor: sdkmath.LegacyZeroDec(), }, }, }, @@ -123,7 +123,7 @@ func TestGenesisState_Validate(t *testing.T) { RewardIndexes: []RewardIndex{ { CollateralType: "bnb-a", - RewardFactor: sdk.ZeroDec(), + RewardFactor: sdkmath.LegacyZeroDec(), }, }, }, diff --git a/x/incentive/types/multipliers.go b/x/incentive/types/multipliers.go index 689bea6460..4f82f5bdfd 100644 --- a/x/incentive/types/multipliers.go +++ b/x/incentive/types/multipliers.go @@ -1,6 +1,7 @@ package types import ( + sdkmath "cosmossdk.io/math" "fmt" "sort" @@ -9,7 +10,7 @@ import ( ) // NewMultiplier returns a new Multiplier -func NewMultiplier(name string, lockup int64, factor sdk.Dec) Multiplier { +func NewMultiplier(name string, lockup int64, factor sdkmath.LegacyDec) Multiplier { return Multiplier{ Name: name, MonthsLockup: lockup, diff --git a/x/incentive/types/params.pb.go b/x/incentive/types/params.pb.go index 9656459b48..68c8366afc 100644 --- a/x/incentive/types/params.pb.go +++ b/x/incentive/types/params.pb.go @@ -4,6 +4,7 @@ package types import ( + cosmossdk_io_math "cosmossdk.io/math" fmt "fmt" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" types "github.com/cosmos/cosmos-sdk/types" @@ -115,9 +116,9 @@ var xxx_messageInfo_MultiRewardPeriod proto.InternalMessageInfo // Multiplier amount the claim rewards get increased by, along with how long the claim rewards are locked type Multiplier struct { - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - MonthsLockup int64 `protobuf:"varint,2,opt,name=months_lockup,json=monthsLockup,proto3" json:"months_lockup,omitempty"` - Factor github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=factor,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"factor"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + MonthsLockup int64 `protobuf:"varint,2,opt,name=months_lockup,json=monthsLockup,proto3" json:"months_lockup,omitempty"` + Factor cosmossdk_io_math.LegacyDec `protobuf:"bytes,3,opt,name=factor,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"factor"` } func (m *Multiplier) Reset() { *m = Multiplier{} } @@ -251,56 +252,57 @@ func init() { } var fileDescriptor_bb8833f5d745eac9 = []byte{ - // 774 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x96, 0xcf, 0x6e, 0xd3, 0x4a, - 0x14, 0xc6, 0xe3, 0xfc, 0xbb, 0xc9, 0xb4, 0xbd, 0xb7, 0x9d, 0x46, 0xb9, 0xbe, 0xb9, 0xc8, 0xa9, - 0x52, 0x04, 0x41, 0x55, 0x6d, 0x0a, 0x12, 0x0b, 0x76, 0x98, 0x82, 0x84, 0x44, 0xa5, 0xca, 0x2d, - 0x12, 0xb0, 0x89, 0x26, 0xf6, 0xd4, 0xb5, 0x6a, 0x7b, 0xac, 0x99, 0x49, 0xda, 0x88, 0x05, 0x12, - 0x0b, 0x76, 0x48, 0x15, 0x0b, 0x1e, 0xa2, 0xaf, 0xc1, 0xa6, 0xcb, 0x8a, 0x15, 0x62, 0xd1, 0x42, - 0xfa, 0x22, 0x68, 0xc6, 0x6e, 0xe3, 0xa4, 0x69, 0xa1, 0x52, 0x36, 0xac, 0x32, 0x3e, 0x73, 0xce, - 0xf9, 0x7d, 0xfe, 0xc6, 0x67, 0x14, 0xb0, 0xb8, 0x83, 0xba, 0xc8, 0xf0, 0x42, 0x1b, 0x87, 0xdc, - 0xeb, 0x62, 0xa3, 0xbb, 0xd2, 0xc6, 0x1c, 0xad, 0x18, 0x11, 0xa2, 0x28, 0x60, 0x7a, 0x44, 0x09, - 0x27, 0xb0, 0x2a, 0x92, 0xf4, 0xf3, 0x24, 0x3d, 0x49, 0xaa, 0x69, 0x36, 0x61, 0x01, 0x61, 0x46, - 0x1b, 0xb1, 0x41, 0xa5, 0x4d, 0xbc, 0x30, 0xae, 0xab, 0x55, 0x5c, 0xe2, 0x12, 0xb9, 0x34, 0xc4, - 0x2a, 0x89, 0xd6, 0x5d, 0x42, 0x5c, 0x1f, 0x1b, 0xf2, 0xa9, 0xdd, 0xd9, 0x32, 0xb8, 0x17, 0x60, - 0xc6, 0x51, 0x10, 0xc5, 0x09, 0x8d, 0x8f, 0x59, 0x30, 0x6d, 0xe1, 0x5d, 0x44, 0x9d, 0x75, 0x4c, - 0x3d, 0xe2, 0xc0, 0x2a, 0x28, 0x22, 0x5b, 0x90, 0x55, 0x65, 0x41, 0x69, 0x96, 0xac, 0xe4, 0x09, - 0xde, 0x06, 0xff, 0xd8, 0xc4, 0xf7, 0x11, 0xc7, 0x14, 0xf9, 0x2d, 0xde, 0x8b, 0xb0, 0x9a, 0x5d, - 0x50, 0x9a, 0x65, 0xeb, 0xef, 0x41, 0x78, 0xb3, 0x17, 0x61, 0xf8, 0x10, 0x14, 0x18, 0x47, 0x94, - 0xab, 0xb9, 0x05, 0xa5, 0x39, 0x75, 0xaf, 0xa6, 0xc7, 0x12, 0xf4, 0x33, 0x09, 0xfa, 0xe6, 0x99, - 0x04, 0xb3, 0x74, 0x78, 0x5c, 0xcf, 0xec, 0x9f, 0xd4, 0x15, 0x2b, 0x2e, 0x81, 0x0f, 0x40, 0x0e,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 0x56, 0x7a, - 0x0c, 0x8a, 0x12, 0xba, 0xf4, 0xeb, 0x31, 0x38, 0x1f, 0x2f, 0xf3, 0x46, 0x82, 0xad, 0x8c, 0xd9, - 0x64, 0xd6, 0xac, 0x64, 0xa4, 0xb6, 0xe0, 0x23, 0x50, 0x8e, 0xb9, 0xe2, 0xbe, 0xfb, 0xeb, 0x1a, - 0xf7, 0x5d, 0x49, 0x96, 0x3d, 0x09, 0x1d, 0xf8, 0x06, 0x54, 0x19, 0xea, 0x7a, 0xa1, 0xcb, 0x46, - 0x4d, 0x2b, 0x4d, 0xd2, 0xb4, 0x4a, 0x02, 0xb9, 0x70, 0x5c, 0x18, 0xd1, 0x70, 0x94, 0x5c, 0x9e, - 0xe8, 0x71, 0x09, 0xc2, 0x50, 0xc8, 0x7c, 0x76, 0xf8, 0x43, 0xcb, 0x1c, 0xf6, 0x35, 0xe5, 0xa8, - 0xaf, 0x29, 0xdf, 0xfb, 0x9a, 0xb2, 0x7f, 0xaa, 0x65, 0x8e, 0x4e, 0xb5, 0xcc, 0xd7, 0x53, 0x2d, - 0xf3, 0x7a, 0x29, 0x75, 0x57, 0x0a, 0x05, 0xcb, 0x3e, 0x6a, 0x33, 0xb9, 0x32, 0xf6, 0x52, 0xff, - 0x48, 0xe4, 0xa5, 0xd9, 0x2e, 0x4a, 0x9b, 0xef, 0xff, 0x0c, 0x00, 0x00, 0xff, 0xff, 0xca, 0x77, - 0xf8, 0x09, 0xb0, 0x08, 0x00, 0x00, + // 787 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x96, 0xcf, 0x4f, 0xdb, 0x48, + 0x14, 0xc7, 0xe3, 0xfc, 0xda, 0x64, 0x80, 0x5d, 0x18, 0xa2, 0xac, 0x37, 0xac, 0x1c, 0x14, 0x56, + 0xda, 0xac, 0x10, 0xf6, 0xb2, 0x2b, 0xed, 0x61, 0x7b, 0xaa, 0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6f, 0x17, 0xa5, 0xcd, 0xff, 0x7e, 0x0b, 0x00, 0x00, 0xff, 0xff, 0xda, 0xa7, 0xad, 0x3b, 0xa5, + 0x08, 0x00, 0x00, } func (m *RewardPeriod) Marshal() (dAtA []byte, err error) { diff --git a/x/incentive/types/params_test.go b/x/incentive/types/params_test.go index 2716d0957e..86a5908f42 100644 --- a/x/incentive/types/params_test.go +++ b/x/incentive/types/params_test.go @@ -24,7 +24,7 @@ var rewardPeriodWithInvalidRewardsPerSecond = types.NewRewardPeriod( "bnb", time.Date(2020, 10, 15, 14, 0, 0, 0, time.UTC), time.Date(2024, 10, 15, 14, 0, 0, 0, time.UTC), - sdk.Coin{Denom: "INVALID!@#😫", Amount: sdk.ZeroInt()}, + sdk.Coin{Denom: "INVALID!@#😫", Amount: sdkmath.ZeroInt()}, ) var rewardPeriodWithZeroRewardsPerSecond = types.NewRewardPeriod( @@ -32,7 +32,7 @@ var rewardPeriodWithZeroRewardsPerSecond = types.NewRewardPeriod( "bnb", time.Date(2020, 10, 15, 14, 0, 0, 0, time.UTC), time.Date(2024, 10, 15, 14, 0, 0, 0, time.UTC), - sdk.Coin{Denom: "ukava", Amount: sdk.ZeroInt()}, + sdk.Coin{Denom: "ukava", Amount: sdkmath.ZeroInt()}, ) var rewardMultiPeriodWithInvalidRewardsPerSecond = types.NewMultiRewardPeriod( @@ -40,7 +40,7 @@ var rewardMultiPeriodWithInvalidRewardsPerSecond = types.NewMultiRewardPeriod( "bnb", time.Date(2020, 10, 15, 14, 0, 0, 0, time.UTC), time.Date(2024, 10, 15, 14, 0, 0, 0, time.UTC), - sdk.Coins{sdk.Coin{Denom: "INVALID!@#😫", Amount: sdk.ZeroInt()}}, + sdk.Coins{sdk.Coin{Denom: "INVALID!@#😫", Amount: sdkmath.ZeroInt()}}, ) var rewardMultiPeriodWithZeroRewardsPerSecond = types.NewMultiRewardPeriod( @@ -48,7 +48,7 @@ var rewardMultiPeriodWithZeroRewardsPerSecond = types.NewMultiRewardPeriod( "bnb", time.Date(2020, 10, 15, 14, 0, 0, 0, time.UTC), time.Date(2024, 10, 15, 14, 0, 0, 0, time.UTC), - sdk.Coins{sdk.Coin{Denom: "zero", Amount: sdk.ZeroInt()}}, + sdk.Coins{sdk.Coin{Denom: "zero", Amount: sdkmath.ZeroInt()}}, ) var validMultiRewardPeriod = types.NewMultiRewardPeriod( @@ -107,15 +107,15 @@ func (suite *ParamTestSuite) TestParamValidation() { { Denom: "hard", Multipliers: types.Multipliers{ - types.NewMultiplier("small", 1, sdk.MustNewDecFromStr("0.25")), - types.NewMultiplier("large", 12, sdk.MustNewDecFromStr("1.0")), + types.NewMultiplier("small", 1, sdkmath.LegacyMustNewDecFromStr("0.25")), + types.NewMultiplier("large", 12, sdkmath.LegacyMustNewDecFromStr("1.0")), }, }, { Denom: "ukava", Multipliers: types.Multipliers{ - types.NewMultiplier("small", 1, sdk.MustNewDecFromStr("0.2")), - types.NewMultiplier("large", 12, sdk.MustNewDecFromStr("1.0")), + types.NewMultiplier("small", 1, sdkmath.LegacyMustNewDecFromStr("0.2")), + types.NewMultiplier("large", 12, sdkmath.LegacyMustNewDecFromStr("1.0")), }, }, }, @@ -223,7 +223,7 @@ func (suite *ParamTestSuite) TestParamValidation() { { Denom: "hard", Multipliers: types.Multipliers{ - types.NewMultiplier("small", -9999, sdk.MustNewDecFromStr("0.25")), + types.NewMultiplier("small", -9999, sdkmath.LegacyMustNewDecFromStr("0.25")), }, }, }, diff --git a/x/incentive/types/query.pb.go b/x/incentive/types/query.pb.go index d639bf6917..2a44a70d6b 100644 --- a/x/incentive/types/query.pb.go +++ b/x/incentive/types/query.pb.go @@ -721,6 +721,7 @@ func _Query_Apy_Handler(srv interface{}, ctx context.Context, dec func(interface return interceptor(ctx, in, info, handler) } +var Query_serviceDesc = _Query_serviceDesc var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "kava.incentive.v1beta1.Query", HandlerType: (*QueryServer)(nil), diff --git a/x/incentive/types/tx.pb.go b/x/incentive/types/tx.pb.go index 30dd8bec29..f7b843a995 100644 --- a/x/incentive/types/tx.pb.go +++ b/x/incentive/types/tx.pb.go @@ -818,6 +818,7 @@ func _Msg_ClaimEarnReward_Handler(srv interface{}, ctx context.Context, dec func return interceptor(ctx, in, info, handler) } +var Msg_serviceDesc = _Msg_serviceDesc var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "kava.incentive.v1beta1.Msg", HandlerType: (*MsgServer)(nil), diff --git a/x/issuance/abci_test.go b/x/issuance/abci_test.go index 9805b9f4b0..f337a1e4e7 100644 --- a/x/issuance/abci_test.go +++ b/x/issuance/abci_test.go @@ -34,7 +34,7 @@ type ABCITestSuite struct { func (suite *ABCITestSuite) SetupTest() { tApp := app.NewTestApp() blockTime := tmtime.Now() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: blockTime}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: blockTime}) tApp.InitializeFromGenesisStates() _, addrs := app.GeneratePrivKeyAddressPairs(5) keeper := tApp.GetIssuanceKeeper() @@ -66,10 +66,10 @@ func (suite *ABCITestSuite) TestRateLimitingTimePassage() { types.NewAsset(suite.addrs[0].String(), "usdtoken", []string{suite.addrs[1].String()}, false, true, types.NewRateLimit(true, sdkmath.NewInt(10000000000), time.Hour*24)), }, supplies: []types.AssetSupply{ - types.NewAssetSupply(sdk.NewCoin("usdtoken", sdk.ZeroInt()), time.Hour), + types.NewAssetSupply(sdk.NewCoin("usdtoken", sdkmath.ZeroInt()), time.Hour), }, blockTimes: []time.Duration{time.Hour}, - expectedSupply: types.NewAssetSupply(sdk.NewCoin("usdtoken", sdk.ZeroInt()), time.Hour*2), + expectedSupply: types.NewAssetSupply(sdk.NewCoin("usdtoken", sdkmath.ZeroInt()), time.Hour*2), }, }, { @@ -79,10 +79,10 @@ func (suite *ABCITestSuite) TestRateLimitingTimePassage() { types.NewAsset(suite.addrs[0].String(), "usdtoken", []string{suite.addrs[1].String()}, false, true, types.NewRateLimit(true, sdkmath.NewInt(10000000000), time.Hour*24)), }, supplies: []types.AssetSupply{ - types.NewAssetSupply(sdk.NewCoin("usdtoken", sdk.ZeroInt()), time.Hour), + types.NewAssetSupply(sdk.NewCoin("usdtoken", sdkmath.ZeroInt()), time.Hour), }, blockTimes: []time.Duration{time.Hour * 12, time.Hour * 12}, - expectedSupply: types.NewAssetSupply(sdk.NewCoin("usdtoken", sdk.ZeroInt()), time.Duration(0)), + expectedSupply: types.NewAssetSupply(sdk.NewCoin("usdtoken", sdkmath.ZeroInt()), time.Duration(0)), }, }, } diff --git a/x/issuance/keeper/issuance.go b/x/issuance/keeper/issuance.go index 92c619fe69..d6d1ed9fd3 100644 --- a/x/issuance/keeper/issuance.go +++ b/x/issuance/keeper/issuance.go @@ -6,7 +6,6 @@ import ( errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "github.com/kava-labs/kava/x/issuance/types" ) @@ -29,7 +28,7 @@ func (k Keeper) IssueTokens(ctx sdk.Context, tokens sdk.Coin, owner, receiver sd } } acc := k.accountKeeper.GetAccount(ctx, receiver) - _, ok := acc.(authtypes.ModuleAccountI) + _, ok := acc.(sdk.ModuleAccountI) if ok { return errorsmod.Wrapf(types.ErrIssueToModuleAccount, "address: %s", receiver) } diff --git a/x/issuance/keeper/issuance_test.go b/x/issuance/keeper/issuance_test.go index 03e9c9e80c..5e7b3064cb 100644 --- a/x/issuance/keeper/issuance_test.go +++ b/x/issuance/keeper/issuance_test.go @@ -8,10 +8,8 @@ import ( "github.com/stretchr/testify/suite" sdkmath "cosmossdk.io/math" - sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - tmprototypes "github.com/cometbft/cometbft/proto/tendermint/types" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cometbft/cometbft/crypto" tmtime "github.com/cometbft/cometbft/types/time" @@ -36,7 +34,7 @@ type KeeperTestSuite struct { func (suite *KeeperTestSuite) SetupTest() { tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmprototypes.Header{Height: 1, Time: tmtime.Now()}) + ctx := tApp.NewContextLegacy(true, tmprototypes.Header{Height: 1, Time: tmtime.Now()}) tApp.InitializeFromGenesisStates() _, addrs := app.GeneratePrivKeyAddressPairs(5) var strAddrs []string @@ -57,7 +55,7 @@ func (suite *KeeperTestSuite) SetupTest() { suite.modAccount = modAccount } -func (suite *KeeperTestSuite) getAccount(addr sdk.AccAddress) authtypes.AccountI { +func (suite *KeeperTestSuite) getAccount(addr sdk.AccAddress) sdk.AccountI { ak := suite.tApp.GetAccountKeeper() return ak.GetAccount(suite.ctx, addr) } @@ -67,7 +65,7 @@ func (suite *KeeperTestSuite) getBalance(addr sdk.AccAddress, denom string) sdk. return bk.GetBalance(suite.ctx, addr, denom) } -func (suite *KeeperTestSuite) getModuleAccount(name string) authtypes.ModuleAccountI { +func (suite *KeeperTestSuite) getModuleAccount(name string) sdk.ModuleAccountI { sk := suite.tApp.GetAccountKeeper() return sk.GetModuleAccount(suite.ctx, name) } @@ -75,7 +73,7 @@ func (suite *KeeperTestSuite) getModuleAccount(name string) authtypes.ModuleAcco func (suite *KeeperTestSuite) TestGetSetParams() { params := suite.keeper.GetParams(suite.ctx) suite.Require().Equal(types.Params{Assets: []types.Asset(nil)}, params) - asset := types.NewAsset(suite.addrs[0], "usdtoken", []string{suite.addrs[1]}, false, true, types.NewRateLimit(false, sdk.ZeroInt(), time.Duration(0))) + asset := types.NewAsset(suite.addrs[0], "usdtoken", []string{suite.addrs[1]}, false, true, types.NewRateLimit(false, sdkmath.ZeroInt(), time.Duration(0))) params = types.NewParams([]types.Asset{asset}) suite.keeper.SetParams(suite.ctx, params) newParams := suite.keeper.GetParams(suite.ctx) @@ -102,7 +100,7 @@ func (suite *KeeperTestSuite) TestIssueTokens() { "valid issuance", args{ assets: []types.Asset{ - types.NewAsset(suite.addrs[0], "usdtoken", []string{suite.addrs[1]}, false, true, types.NewRateLimit(false, sdk.ZeroInt(), time.Duration(0))), + types.NewAsset(suite.addrs[0], "usdtoken", []string{suite.addrs[1]}, false, true, types.NewRateLimit(false, sdkmath.ZeroInt(), time.Duration(0))), }, sender: suite.addrs[0], tokens: sdk.NewCoin("usdtoken", sdkmath.NewInt(100000)), @@ -117,7 +115,7 @@ func (suite *KeeperTestSuite) TestIssueTokens() { "non-owner issuance", args{ assets: []types.Asset{ - types.NewAsset(suite.addrs[0], "usdtoken", []string{suite.addrs[1]}, false, true, types.NewRateLimit(false, sdk.ZeroInt(), time.Duration(0))), + types.NewAsset(suite.addrs[0], "usdtoken", []string{suite.addrs[1]}, false, true, types.NewRateLimit(false, sdkmath.ZeroInt(), time.Duration(0))), }, sender: suite.addrs[2], tokens: sdk.NewCoin("usdtoken", sdkmath.NewInt(100000)), @@ -132,7 +130,7 @@ func (suite *KeeperTestSuite) TestIssueTokens() { "invalid denom", args{ assets: []types.Asset{ - types.NewAsset(suite.addrs[0], "usdtoken", []string{suite.addrs[1]}, false, true, types.NewRateLimit(false, sdk.ZeroInt(), time.Duration(0))), + types.NewAsset(suite.addrs[0], "usdtoken", []string{suite.addrs[1]}, false, true, types.NewRateLimit(false, sdkmath.ZeroInt(), time.Duration(0))), }, sender: suite.addrs[0], tokens: sdk.NewCoin("othertoken", sdkmath.NewInt(100000)), @@ -147,7 +145,7 @@ func (suite *KeeperTestSuite) TestIssueTokens() { "issue to blocked address", args{ assets: []types.Asset{ - types.NewAsset(suite.addrs[0], "usdtoken", []string{suite.addrs[1]}, false, true, types.NewRateLimit(false, sdk.ZeroInt(), time.Duration(0))), + types.NewAsset(suite.addrs[0], "usdtoken", []string{suite.addrs[1]}, false, true, types.NewRateLimit(false, sdkmath.ZeroInt(), time.Duration(0))), }, sender: suite.addrs[0], tokens: sdk.NewCoin("usdtoken", sdkmath.NewInt(100000)), @@ -162,7 +160,7 @@ func (suite *KeeperTestSuite) TestIssueTokens() { "issue to module account", args{ assets: []types.Asset{ - types.NewAsset(suite.addrs[0], "usdtoken", []string{suite.addrs[1]}, false, true, types.NewRateLimit(false, sdk.ZeroInt(), time.Duration(0))), + types.NewAsset(suite.addrs[0], "usdtoken", []string{suite.addrs[1]}, false, true, types.NewRateLimit(false, sdkmath.ZeroInt(), time.Duration(0))), }, sender: suite.addrs[0], tokens: sdk.NewCoin("usdtoken", sdkmath.NewInt(100000)), @@ -177,7 +175,7 @@ func (suite *KeeperTestSuite) TestIssueTokens() { "paused issuance", args{ assets: []types.Asset{ - types.NewAsset(suite.addrs[0], "usdtoken", []string{suite.addrs[1]}, true, true, types.NewRateLimit(false, sdk.ZeroInt(), time.Duration(0))), + types.NewAsset(suite.addrs[0], "usdtoken", []string{suite.addrs[1]}, true, true, types.NewRateLimit(false, sdkmath.ZeroInt(), time.Duration(0))), }, sender: suite.addrs[0], tokens: sdk.NewCoin("usdtoken", sdkmath.NewInt(100000)), @@ -233,7 +231,7 @@ func (suite *KeeperTestSuite) TestIssueTokensRateLimited() { types.NewAsset(suite.addrs[0], "usdtoken", []string{suite.addrs[1]}, false, true, types.NewRateLimit(true, sdkmath.NewInt(10000000000), time.Hour*24)), }, supplies: []types.AssetSupply{ - types.NewAssetSupply(sdk.NewCoin("usdtoken", sdk.ZeroInt()), time.Hour), + types.NewAssetSupply(sdk.NewCoin("usdtoken", sdkmath.ZeroInt()), time.Hour), }, sender: suite.addrs[0], tokens: sdk.NewCoin("usdtoken", sdkmath.NewInt(100000)), @@ -252,7 +250,7 @@ func (suite *KeeperTestSuite) TestIssueTokensRateLimited() { types.NewAsset(suite.addrs[0], "usdtoken", []string{suite.addrs[1]}, false, true, types.NewRateLimit(true, sdkmath.NewInt(10000000000), time.Hour*24)), }, supplies: []types.AssetSupply{ - types.NewAssetSupply(sdk.NewCoin("usdtoken", sdk.ZeroInt()), time.Hour), + types.NewAssetSupply(sdk.NewCoin("usdtoken", sdkmath.ZeroInt()), time.Hour), }, sender: suite.addrs[0], tokens: sdk.NewCoin("usdtoken", sdkmath.NewInt(10000000001)), @@ -308,7 +306,7 @@ func (suite *KeeperTestSuite) TestRedeemTokens() { "valid redemption", args{ assets: []types.Asset{ - types.NewAsset(suite.addrs[0], "usdtoken", []string{suite.addrs[1]}, false, true, types.NewRateLimit(false, sdk.ZeroInt(), time.Duration(0))), + types.NewAsset(suite.addrs[0], "usdtoken", []string{suite.addrs[1]}, false, true, types.NewRateLimit(false, sdkmath.ZeroInt(), time.Duration(0))), }, sender: suite.addrs[0], initialTokens: sdk.NewCoin("usdtoken", sdkmath.NewInt(100000)), @@ -323,7 +321,7 @@ func (suite *KeeperTestSuite) TestRedeemTokens() { "invalid denom redemption", args{ assets: []types.Asset{ - types.NewAsset(suite.addrs[0], "usdtoken", []string{suite.addrs[1]}, false, true, types.NewRateLimit(false, sdk.ZeroInt(), time.Duration(0))), + types.NewAsset(suite.addrs[0], "usdtoken", []string{suite.addrs[1]}, false, true, types.NewRateLimit(false, sdkmath.ZeroInt(), time.Duration(0))), }, sender: suite.addrs[0], initialTokens: sdk.NewCoin("usdtoken", sdkmath.NewInt(100000)), @@ -338,7 +336,7 @@ func (suite *KeeperTestSuite) TestRedeemTokens() { "non-owner redemption", args{ assets: []types.Asset{ - types.NewAsset(suite.addrs[0], "usdtoken", []string{suite.addrs[1]}, false, true, types.NewRateLimit(false, sdk.ZeroInt(), time.Duration(0))), + types.NewAsset(suite.addrs[0], "usdtoken", []string{suite.addrs[1]}, false, true, types.NewRateLimit(false, sdkmath.ZeroInt(), time.Duration(0))), }, sender: suite.addrs[2], initialTokens: sdk.NewCoin("usdtoken", sdkmath.NewInt(100000)), @@ -353,7 +351,7 @@ func (suite *KeeperTestSuite) TestRedeemTokens() { "paused redemption", args{ assets: []types.Asset{ - types.NewAsset(suite.addrs[0], "usdtoken", []string{suite.addrs[1]}, true, true, types.NewRateLimit(false, sdk.ZeroInt(), time.Duration(0))), + types.NewAsset(suite.addrs[0], "usdtoken", []string{suite.addrs[1]}, true, true, types.NewRateLimit(false, sdkmath.ZeroInt(), time.Duration(0))), }, sender: suite.addrs[0], initialTokens: sdk.NewCoin("usdtoken", sdkmath.NewInt(100000)), @@ -368,7 +366,7 @@ func (suite *KeeperTestSuite) TestRedeemTokens() { "redeem amount greater than balance", args{ assets: []types.Asset{ - types.NewAsset(suite.addrs[0], "usdtoken", []string{suite.addrs[1]}, false, true, types.NewRateLimit(false, sdk.ZeroInt(), time.Duration(0))), + types.NewAsset(suite.addrs[0], "usdtoken", []string{suite.addrs[1]}, false, true, types.NewRateLimit(false, sdkmath.ZeroInt(), time.Duration(0))), }, sender: suite.addrs[0], initialTokens: sdk.NewCoin("usdtoken", sdkmath.NewInt(100000)), @@ -427,7 +425,7 @@ func (suite *KeeperTestSuite) TestBlockAddress() { "valid block", args{ assets: []types.Asset{ - types.NewAsset(suite.addrs[0], "usdtoken", []string{}, false, true, types.NewRateLimit(false, sdk.ZeroInt(), time.Duration(0))), + types.NewAsset(suite.addrs[0], "usdtoken", []string{}, false, true, types.NewRateLimit(false, sdkmath.ZeroInt(), time.Duration(0))), }, sender: suite.addrs[0], blockedAddr: suite.addrs[1], @@ -442,7 +440,7 @@ func (suite *KeeperTestSuite) TestBlockAddress() { "unblockable token", args{ assets: []types.Asset{ - types.NewAsset(suite.addrs[0], "usdtoken", []string{}, false, false, types.NewRateLimit(false, sdk.ZeroInt(), time.Duration(0))), + types.NewAsset(suite.addrs[0], "usdtoken", []string{}, false, false, types.NewRateLimit(false, sdkmath.ZeroInt(), time.Duration(0))), }, sender: suite.addrs[0], blockedAddr: suite.addrs[1], @@ -457,7 +455,7 @@ func (suite *KeeperTestSuite) TestBlockAddress() { "non-owner block", args{ assets: []types.Asset{ - types.NewAsset(suite.addrs[0], "usdtoken", []string{}, false, true, types.NewRateLimit(false, sdk.ZeroInt(), time.Duration(0))), + types.NewAsset(suite.addrs[0], "usdtoken", []string{}, false, true, types.NewRateLimit(false, sdkmath.ZeroInt(), time.Duration(0))), }, sender: suite.addrs[2], blockedAddr: suite.addrs[1], @@ -472,7 +470,7 @@ func (suite *KeeperTestSuite) TestBlockAddress() { "invalid denom block", args{ assets: []types.Asset{ - types.NewAsset(suite.addrs[0], "usdtoken", []string{}, false, true, types.NewRateLimit(false, sdk.ZeroInt(), time.Duration(0))), + types.NewAsset(suite.addrs[0], "usdtoken", []string{}, false, true, types.NewRateLimit(false, sdkmath.ZeroInt(), time.Duration(0))), }, sender: suite.addrs[0], blockedAddr: suite.addrs[1], @@ -487,7 +485,7 @@ func (suite *KeeperTestSuite) TestBlockAddress() { "block non-existing account", args{ assets: []types.Asset{ - types.NewAsset(suite.addrs[0], "usdtoken", []string{}, false, true, types.NewRateLimit(false, sdk.ZeroInt(), time.Duration(0))), + types.NewAsset(suite.addrs[0], "usdtoken", []string{}, false, true, types.NewRateLimit(false, sdkmath.ZeroInt(), time.Duration(0))), }, sender: suite.addrs[0], blockedAddr: sdk.AccAddress(crypto.AddressHash([]byte("RandomAddr"))).String(), @@ -546,7 +544,7 @@ func (suite *KeeperTestSuite) TestUnblockAddress() { "valid unblock", args{ assets: []types.Asset{ - types.NewAsset(suite.addrs[0], "usdtoken", []string{suite.addrs[1]}, false, true, types.NewRateLimit(false, sdk.ZeroInt(), time.Duration(0))), + types.NewAsset(suite.addrs[0], "usdtoken", []string{suite.addrs[1]}, false, true, types.NewRateLimit(false, sdkmath.ZeroInt(), time.Duration(0))), }, sender: suite.addrs[0], blockedAddr: suite.addrs[1], @@ -561,7 +559,7 @@ func (suite *KeeperTestSuite) TestUnblockAddress() { "non-owner unblock", args{ assets: []types.Asset{ - types.NewAsset(suite.addrs[0], "usdtoken", []string{suite.addrs[1]}, false, true, types.NewRateLimit(false, sdk.ZeroInt(), time.Duration(0))), + types.NewAsset(suite.addrs[0], "usdtoken", []string{suite.addrs[1]}, false, true, types.NewRateLimit(false, sdkmath.ZeroInt(), time.Duration(0))), }, sender: suite.addrs[2], blockedAddr: suite.addrs[1], @@ -576,7 +574,7 @@ func (suite *KeeperTestSuite) TestUnblockAddress() { "invalid denom block", args{ assets: []types.Asset{ - types.NewAsset(suite.addrs[0], "usdtoken", []string{suite.addrs[1]}, false, true, types.NewRateLimit(false, sdk.ZeroInt(), time.Duration(0))), + types.NewAsset(suite.addrs[0], "usdtoken", []string{suite.addrs[1]}, false, true, types.NewRateLimit(false, sdkmath.ZeroInt(), time.Duration(0))), }, sender: suite.addrs[0], blockedAddr: suite.addrs[1], @@ -636,7 +634,7 @@ func (suite *KeeperTestSuite) TestChangePauseStatus() { "valid pause", args{ assets: []types.Asset{ - types.NewAsset(suite.addrs[0], "usdtoken", []string{}, false, true, types.NewRateLimit(false, sdk.ZeroInt(), time.Duration(0))), + types.NewAsset(suite.addrs[0], "usdtoken", []string{}, false, true, types.NewRateLimit(false, sdkmath.ZeroInt(), time.Duration(0))), }, sender: suite.addrs[0], startStatus: false, @@ -652,7 +650,7 @@ func (suite *KeeperTestSuite) TestChangePauseStatus() { "valid unpause", args{ assets: []types.Asset{ - types.NewAsset(suite.addrs[0], "usdtoken", []string{}, true, true, types.NewRateLimit(false, sdk.ZeroInt(), time.Duration(0))), + types.NewAsset(suite.addrs[0], "usdtoken", []string{}, true, true, types.NewRateLimit(false, sdkmath.ZeroInt(), time.Duration(0))), }, sender: suite.addrs[0], startStatus: true, @@ -668,7 +666,7 @@ func (suite *KeeperTestSuite) TestChangePauseStatus() { "non-owner pause", args{ assets: []types.Asset{ - types.NewAsset(suite.addrs[0], "usdtoken", []string{}, false, true, types.NewRateLimit(false, sdk.ZeroInt(), time.Duration(0))), + types.NewAsset(suite.addrs[0], "usdtoken", []string{}, false, true, types.NewRateLimit(false, sdkmath.ZeroInt(), time.Duration(0))), }, sender: suite.addrs[2], startStatus: false, @@ -684,7 +682,7 @@ func (suite *KeeperTestSuite) TestChangePauseStatus() { "invalid denom pause", args{ assets: []types.Asset{ - types.NewAsset(suite.addrs[0], "usdtoken", []string{}, false, true, types.NewRateLimit(false, sdk.ZeroInt(), time.Duration(0))), + types.NewAsset(suite.addrs[0], "usdtoken", []string{}, false, true, types.NewRateLimit(false, sdkmath.ZeroInt(), time.Duration(0))), }, sender: suite.addrs[0], startStatus: true, @@ -738,7 +736,7 @@ func (suite *KeeperTestSuite) TestSeizeCoinsFromBlockedAddress() { "valid seize", args{ assets: []types.Asset{ - types.NewAsset(suite.addrs[0], "usdtoken", []string{}, false, true, types.NewRateLimit(false, sdk.ZeroInt(), time.Duration(0))), + types.NewAsset(suite.addrs[0], "usdtoken", []string{}, false, true, types.NewRateLimit(false, sdkmath.ZeroInt(), time.Duration(0))), }, initialCoins: sdk.NewCoin("usdtoken", sdkmath.NewInt(100000000)), denom: "usdtoken", @@ -753,7 +751,7 @@ func (suite *KeeperTestSuite) TestSeizeCoinsFromBlockedAddress() { "invalid denom seize", args{ assets: []types.Asset{ - types.NewAsset(suite.addrs[0], "usdtoken", []string{}, false, true, types.NewRateLimit(false, sdk.ZeroInt(), time.Duration(0))), + types.NewAsset(suite.addrs[0], "usdtoken", []string{}, false, true, types.NewRateLimit(false, sdkmath.ZeroInt(), time.Duration(0))), }, initialCoins: sdk.NewCoin("usdtoken", sdkmath.NewInt(100000000)), denom: "othertoken", diff --git a/x/issuance/keeper/keeper.go b/x/issuance/keeper/keeper.go index c4680db91d..203bb29893 100644 --- a/x/issuance/keeper/keeper.go +++ b/x/issuance/keeper/keeper.go @@ -3,9 +3,9 @@ package keeper import ( "time" + "cosmossdk.io/store/prefix" + storetypes "cosmossdk.io/store/types" "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/store/prefix" - storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" @@ -56,7 +56,7 @@ func (k Keeper) SetAssetSupply(ctx sdk.Context, supply types.AssetSupply, denom // IterateAssetSupplies provides an iterator over all stored AssetSupplies. func (k Keeper) IterateAssetSupplies(ctx sdk.Context, cb func(supply types.AssetSupply) (stop bool)) { - iterator := sdk.KVStorePrefixIterator(ctx.KVStore(k.key), types.AssetSupplyPrefix) + iterator := storetypes.KVStorePrefixIterator(ctx.KVStore(k.key), types.AssetSupplyPrefix) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { diff --git a/x/issuance/keeper/supply.go b/x/issuance/keeper/supply.go index 0b62406311..603205e757 100644 --- a/x/issuance/keeper/supply.go +++ b/x/issuance/keeper/supply.go @@ -1,6 +1,7 @@ package keeper import ( + sdkmath "cosmossdk.io/math" "time" errorsmod "cosmossdk.io/errors" @@ -12,7 +13,7 @@ import ( // CreateNewAssetSupply creates a new AssetSupply in the store for the input denom func (k Keeper) CreateNewAssetSupply(ctx sdk.Context, denom string) types.AssetSupply { supply := types.NewAssetSupply( - sdk.NewCoin(denom, sdk.ZeroInt()), time.Duration(0)) + sdk.NewCoin(denom, sdkmath.ZeroInt()), time.Duration(0)) k.SetAssetSupply(ctx, supply, denom) return supply } @@ -58,7 +59,7 @@ func (k Keeper) UpdateTimeBasedSupplyLimits(ctx sdk.Context) { } if !asset.RateLimit.Active { // rate limiting is not active, reset supply - supply.CurrentSupply = sdk.NewCoin(asset.Denom, sdk.ZeroInt()) + supply.CurrentSupply = sdk.NewCoin(asset.Denom, sdkmath.ZeroInt()) supply.TimeElapsed = time.Duration(0) k.SetAssetSupply(ctx, supply, asset.Denom) continue @@ -71,7 +72,7 @@ func (k Keeper) UpdateTimeBasedSupplyLimits(ctx sdk.Context) { } // rate limiting is active, the rate-limiting period has expired, and is now reset supply.TimeElapsed = time.Duration(0) - supply.CurrentSupply = sdk.NewCoin(asset.Denom, sdk.ZeroInt()) + supply.CurrentSupply = sdk.NewCoin(asset.Denom, sdkmath.ZeroInt()) k.SetAssetSupply(ctx, supply, asset.Denom) } k.SetPreviousBlockTime(ctx, ctx.BlockTime()) diff --git a/x/issuance/keeper/supply_test.go b/x/issuance/keeper/supply_test.go index fb7a1e2878..fd0441d45d 100644 --- a/x/issuance/keeper/supply_test.go +++ b/x/issuance/keeper/supply_test.go @@ -32,7 +32,7 @@ func (suite *KeeperTestSuite) TestIncrementCurrentAssetSupply() { types.NewAsset(suite.addrs[0], "usdtoken", []string{suite.addrs[1]}, false, true, types.NewRateLimit(true, sdkmath.NewInt(10000000000), time.Hour*24)), }, supplies: []types.AssetSupply{ - types.NewAssetSupply(sdk.NewCoin("usdtoken", sdk.ZeroInt()), time.Hour), + types.NewAssetSupply(sdk.NewCoin("usdtoken", sdkmath.ZeroInt()), time.Hour), }, coin: sdk.NewCoin("usdtoken", sdkmath.NewInt(100000)), }, @@ -48,7 +48,7 @@ func (suite *KeeperTestSuite) TestIncrementCurrentAssetSupply() { types.NewAsset(suite.addrs[0], "usdtoken", []string{suite.addrs[1]}, false, true, types.NewRateLimit(true, sdkmath.NewInt(10000000000), time.Hour*24)), }, supplies: []types.AssetSupply{ - types.NewAssetSupply(sdk.NewCoin("usdtoken", sdk.ZeroInt()), time.Hour), + types.NewAssetSupply(sdk.NewCoin("usdtoken", sdkmath.ZeroInt()), time.Hour), }, coin: sdk.NewCoin("usdtoken", sdkmath.NewInt(10000000001)), }, diff --git a/x/issuance/module.go b/x/issuance/module.go index a5b5f4ae40..3fa627d4fc 100644 --- a/x/issuance/module.go +++ b/x/issuance/module.go @@ -130,9 +130,15 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw } // BeginBlock module begin-block -func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) {} +func (am AppModule) BeginBlock(ctx sdk.Context) error { + return nil +} // EndBlock module end-block -func (am AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { - return []abci.ValidatorUpdate{} +func (am AppModule) EndBlock(_ sdk.Context) ([]abci.ValidatorUpdate, error) { + return []abci.ValidatorUpdate{}, nil } + +func (AppModule) IsOnePerModuleType() {} + +func (AppModule) IsAppModule() {} diff --git a/x/issuance/types/codec.go b/x/issuance/types/codec.go index e88e97f997..018dd22e85 100644 --- a/x/issuance/types/codec.go +++ b/x/issuance/types/codec.go @@ -6,7 +6,6 @@ import ( cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/msgservice" - authzcodec "github.com/cosmos/cosmos-sdk/x/authz/codec" ) var ( @@ -42,5 +41,5 @@ func init() { // Register all Amino interfaces and concrete types on the authz Amino codec so that this can later be // used to properly serialize MsgGrant and MsgExec instances - RegisterLegacyAminoCodec(authzcodec.Amino) + RegisterLegacyAminoCodec(codec.NewLegacyAmino()) } diff --git a/x/issuance/types/expected_keepers.go b/x/issuance/types/expected_keepers.go index db742385eb..8d8ce5544d 100644 --- a/x/issuance/types/expected_keepers.go +++ b/x/issuance/types/expected_keepers.go @@ -1,21 +1,21 @@ package types import ( + "context" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/auth/types" ) // BankKeeper defines the expected interface needed to send coins type BankKeeper interface { - SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error - SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error - BurnCoins(ctx sdk.Context, name string, amt sdk.Coins) error - MintCoins(ctx sdk.Context, name string, amt sdk.Coins) error - GetAllBalances(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins + SendCoinsFromModuleToAccount(ctx context.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error + SendCoinsFromAccountToModule(ctx context.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error + BurnCoins(ctx context.Context, name string, amt sdk.Coins) error + MintCoins(ctx context.Context, name string, amt sdk.Coins) error + GetAllBalances(ctx context.Context, addr sdk.AccAddress) sdk.Coins } // AccountKeeper expected interface for the account keeper (noalias) type AccountKeeper interface { - GetAccount(ctx sdk.Context, addr sdk.AccAddress) types.AccountI - GetModuleAccount(ctx sdk.Context, name string) types.ModuleAccountI + GetAccount(ctx context.Context, addr sdk.AccAddress) sdk.AccountI + GetModuleAccount(ctx context.Context, name string) sdk.ModuleAccountI } diff --git a/x/issuance/types/genesis.pb.go b/x/issuance/types/genesis.pb.go index 612b89c402..f40f5761fa 100644 --- a/x/issuance/types/genesis.pb.go +++ b/x/issuance/types/genesis.pb.go @@ -4,8 +4,8 @@ package types import ( + cosmossdk_io_math "cosmossdk.io/math" fmt "fmt" - github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" @@ -213,9 +213,9 @@ func (m *Asset) GetRateLimit() RateLimit { // RateLimit parameters for rate-limiting the supply of an issued asset type RateLimit struct { - Active bool `protobuf:"varint,1,opt,name=active,proto3" json:"active,omitempty"` - Limit github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,2,opt,name=limit,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"limit,omitempty"` - TimePeriod time.Duration `protobuf:"bytes,3,opt,name=time_period,json=timePeriod,proto3,stdduration" json:"time_period"` + Active bool `protobuf:"varint,1,opt,name=active,proto3" json:"active,omitempty"` + Limit cosmossdk_io_math.Int `protobuf:"bytes,2,opt,name=limit,proto3,customtype=cosmossdk.io/math.Int" json:"limit,omitempty"` + TimePeriod time.Duration `protobuf:"bytes,3,opt,name=time_period,json=timePeriod,proto3,stdduration" json:"time_period"` } func (m *RateLimit) Reset() { *m = RateLimit{} } @@ -331,44 +331,44 @@ func init() { } var fileDescriptor_e567e34e5c078b96 = []byte{ - // 590 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x53, 0x4f, 0x6f, 0xd3, 0x4e, - 0x10, 0x8d, 0x9b, 0x26, 0x4a, 0x36, 0xfd, 0xfd, 0x80, 0x55, 0x41, 0x6e, 0x55, 0x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x01, 0x00, 0x00, 0xff, 0xff, 0x3f, 0xa6, 0xf1, 0xda, 0x11, 0x04, 0x00, 0x00, + // 586 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x53, 0xcd, 0x6e, 0xd3, 0x4c, + 0x14, 0x8d, 0x9b, 0x26, 0x4a, 0x26, 0xfd, 0x3e, 0x60, 0xd4, 0x22, 0xb7, 0x2a, 0x4e, 0x14, 0x36, + 0x11, 0x3f, 0x63, 0x5a, 0x76, 0x65, 0xd5, 0x90, 0x16, 0x81, 0x58, 0x54, 0xee, 0x8e, 0x4d, 0x34, + 0xb6, 0x2f, 0xee, 0xa8, 0xb6, 0xc7, 0xf2, 0x8c, 0x0b, 0x79, 0x0b, 0xd8, 0x75, 0x89, 0xc4, 0x13, + 0xf0, 0x16, 0x5d, 0x76, 0x89, 0x58, 0x04, 0x94, 0xec, 0x78, 0x0a, 0x34, 0x3f, 0x49, 0x58, 0x50, + 0xc4, 0x6e, 0xee, 0x9d, 0x73, 0xee, 0x9c, 0x73, 0x7d, 0x8c, 0xee, 0x9f, 0xd3, 0x0b, 0xea, 0x33, + 0x21, 0x2a, 0x9a, 0x47, 0xe0, 0x5f, 0xec, 0x85, 0x20, 0xe9, 0x9e, 0x9f, 0x40, 0x0e, 0x82, 0x09, + 0x52, 0x94, 0x5c, 0x72, 0xbc, 0xa5, 0x40, 0x64, 0x01, 0x22, 0x16, 0xb4, 0xe3, 0x45, 0x5c, 0x64, + 0x5c, 0xf8, 0x21, 0x15, 0x2b, 0x66, 0xc4, 0x59, 0x6e, 0x68, 0x3b, 0x9b, 0x09, 0x4f, 0xb8, 0x3e, + 0xfa, 0xea, 0x64, 0xbb, 0x5e, 0xc2, 0x79, 0x92, 0x82, 0xaf, 0xab, 0xb0, 0x7a, 0xeb, 0xc7, 0x55, + 0x49, 0x25, 0xe3, 0x96, 0xd5, 0xff, 0xe8, 0xa0, 0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d5, 0xae, 0xe7, 0x5e, 0xed, 0xeb, 0xdc, 0xab, 0xbd, 0x79, 0x90, + 0x30, 0x79, 0x56, 0x85, 0x24, 0xe2, 0x99, 0xaf, 0x3e, 0xdb, 0xe3, 0x94, 0x86, 0x42, 0x9f, 0xfc, + 0xf7, 0xab, 0x5f, 0x5c, 0x4e, 0x0a, 0x10, 0x61, 0x53, 0xbf, 0xfa, 0xf4, 0x57, 0x00, 0x00, 0x00, + 0xff, 0xff, 0x03, 0xcb, 0xb7, 0xaf, 0x00, 0x04, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { diff --git a/x/issuance/types/genesis_test.go b/x/issuance/types/genesis_test.go index 5c1db54041..301a608ab9 100644 --- a/x/issuance/types/genesis_test.go +++ b/x/issuance/types/genesis_test.go @@ -58,7 +58,7 @@ func (suite *GenesisTestSuite) TestValidate() { "with asset", args{ assets: []types.Asset{ - types.NewAsset(suite.addrs[0], "usdtoken", []string{suite.addrs[1]}, false, true, types.NewRateLimit(false, sdk.ZeroInt(), time.Duration(0))), + types.NewAsset(suite.addrs[0], "usdtoken", []string{suite.addrs[1]}, false, true, types.NewRateLimit(false, sdkmath.ZeroInt(), time.Duration(0))), }, supplies: []types.AssetSupply{types.NewAssetSupply(sdk.NewCoin("usdtoken", sdkmath.NewInt(1000000)), time.Hour)}, }, @@ -84,8 +84,8 @@ func (suite *GenesisTestSuite) TestValidate() { "with multiple assets", args{ assets: []types.Asset{ - types.NewAsset(suite.addrs[0], "usdtoken", []string{suite.addrs[1]}, false, true, types.NewRateLimit(false, sdk.ZeroInt(), time.Duration(0))), - types.NewAsset(suite.addrs[0], "pegtoken", []string{suite.addrs[1]}, false, true, types.NewRateLimit(false, sdk.ZeroInt(), time.Duration(0))), + types.NewAsset(suite.addrs[0], "usdtoken", []string{suite.addrs[1]}, false, true, types.NewRateLimit(false, sdkmath.ZeroInt(), time.Duration(0))), + types.NewAsset(suite.addrs[0], "pegtoken", []string{suite.addrs[1]}, false, true, types.NewRateLimit(false, sdkmath.ZeroInt(), time.Duration(0))), }, supplies: []types.AssetSupply{}, }, @@ -98,7 +98,7 @@ func (suite *GenesisTestSuite) TestValidate() { "blocked owner", args{ assets: []types.Asset{ - types.NewAsset(suite.addrs[0], "usdtoken", []string{suite.addrs[0]}, false, true, types.NewRateLimit(false, sdk.ZeroInt(), time.Duration(0))), + types.NewAsset(suite.addrs[0], "usdtoken", []string{suite.addrs[0]}, false, true, types.NewRateLimit(false, sdkmath.ZeroInt(), time.Duration(0))), }, supplies: []types.AssetSupply{}, }, @@ -111,7 +111,7 @@ func (suite *GenesisTestSuite) TestValidate() { "empty owner", args{ assets: []types.Asset{ - types.NewAsset("", "usdtoken", []string{suite.addrs[0]}, false, true, types.NewRateLimit(false, sdk.ZeroInt(), time.Duration(0))), + types.NewAsset("", "usdtoken", []string{suite.addrs[0]}, false, true, types.NewRateLimit(false, sdkmath.ZeroInt(), time.Duration(0))), }, supplies: []types.AssetSupply{}, }, @@ -124,7 +124,7 @@ func (suite *GenesisTestSuite) TestValidate() { "empty blocked address", args{ assets: []types.Asset{ - types.NewAsset(suite.addrs[0], "usdtoken", []string{""}, false, true, types.NewRateLimit(false, sdk.ZeroInt(), time.Duration(0))), + types.NewAsset(suite.addrs[0], "usdtoken", []string{""}, false, true, types.NewRateLimit(false, sdkmath.ZeroInt(), time.Duration(0))), }, supplies: []types.AssetSupply{}, }, @@ -137,7 +137,7 @@ func (suite *GenesisTestSuite) TestValidate() { "invalid denom", args{ assets: []types.Asset{ - types.NewAsset(suite.addrs[0], "USD2T ", []string{}, false, true, types.NewRateLimit(false, sdk.ZeroInt(), time.Duration(0))), + types.NewAsset(suite.addrs[0], "USD2T ", []string{}, false, true, types.NewRateLimit(false, sdkmath.ZeroInt(), time.Duration(0))), }, supplies: []types.AssetSupply{}, }, @@ -150,8 +150,8 @@ func (suite *GenesisTestSuite) TestValidate() { "duplicate denom", args{ assets: []types.Asset{ - types.NewAsset(suite.addrs[0], "usdtoken", []string{suite.addrs[1]}, false, true, types.NewRateLimit(false, sdk.ZeroInt(), time.Duration(0))), - types.NewAsset(suite.addrs[1], "usdtoken", []string{}, true, true, types.NewRateLimit(false, sdk.ZeroInt(), time.Duration(0))), + types.NewAsset(suite.addrs[0], "usdtoken", []string{suite.addrs[1]}, false, true, types.NewRateLimit(false, sdkmath.ZeroInt(), time.Duration(0))), + types.NewAsset(suite.addrs[1], "usdtoken", []string{}, true, true, types.NewRateLimit(false, sdkmath.ZeroInt(), time.Duration(0))), }, supplies: []types.AssetSupply{}, }, @@ -164,8 +164,8 @@ func (suite *GenesisTestSuite) TestValidate() { "duplicate asset", args{ assets: []types.Asset{ - types.NewAsset(suite.addrs[0], "usdtoken", []string{suite.addrs[1]}, false, true, types.NewRateLimit(false, sdk.ZeroInt(), time.Duration(0))), - types.NewAsset(suite.addrs[0], "usdtoken", []string{suite.addrs[1]}, false, true, types.NewRateLimit(false, sdk.ZeroInt(), time.Duration(0))), + types.NewAsset(suite.addrs[0], "usdtoken", []string{suite.addrs[1]}, false, true, types.NewRateLimit(false, sdkmath.ZeroInt(), time.Duration(0))), + types.NewAsset(suite.addrs[0], "usdtoken", []string{suite.addrs[1]}, false, true, types.NewRateLimit(false, sdkmath.ZeroInt(), time.Duration(0))), }, supplies: []types.AssetSupply{}, }, @@ -178,9 +178,9 @@ func (suite *GenesisTestSuite) TestValidate() { "invalid block list", args{ assets: []types.Asset{ - types.NewAsset(suite.addrs[0], "usdtoken", []string{suite.addrs[1]}, false, false, types.NewRateLimit(false, sdk.ZeroInt(), time.Duration(0))), + types.NewAsset(suite.addrs[0], "usdtoken", []string{suite.addrs[1]}, false, false, types.NewRateLimit(false, sdkmath.ZeroInt(), time.Duration(0))), }, - supplies: []types.AssetSupply{types.NewAssetSupply(sdk.NewCoin("usdtoken", sdk.ZeroInt()), time.Hour)}, + supplies: []types.AssetSupply{types.NewAssetSupply(sdk.NewCoin("usdtoken", sdkmath.ZeroInt()), time.Hour)}, }, errArgs{ expectPass: false, diff --git a/x/issuance/types/query.pb.go b/x/issuance/types/query.pb.go index 3cefbb8b3f..d468ef760f 100644 --- a/x/issuance/types/query.pb.go +++ b/x/issuance/types/query.pb.go @@ -209,6 +209,7 @@ func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interf return interceptor(ctx, in, info, handler) } +var Query_serviceDesc = _Query_serviceDesc var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "kava.issuance.v1beta1.Query", HandlerType: (*QueryServer)(nil), diff --git a/x/issuance/types/tx.pb.go b/x/issuance/types/tx.pb.go index e0416cc9e1..c88079e161 100644 --- a/x/issuance/types/tx.pb.go +++ b/x/issuance/types/tx.pb.go @@ -668,6 +668,7 @@ func _Msg_SetPauseStatus_Handler(srv interface{}, ctx context.Context, dec func( return interceptor(ctx, in, info, handler) } +var Msg_serviceDesc = _Msg_serviceDesc var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "kava.issuance.v1beta1.Msg", HandlerType: (*MsgServer)(nil), diff --git a/x/kavadist/client/cli/tx.go b/x/kavadist/client/cli/tx.go index b226d27f1b..b1e4558e91 100644 --- a/x/kavadist/client/cli/tx.go +++ b/x/kavadist/client/cli/tx.go @@ -2,10 +2,12 @@ package cli import ( "fmt" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" "strings" "github.com/spf13/cobra" + "cosmossdk.io/errors" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/tx" "github.com/cosmos/cosmos-sdk/version" @@ -79,7 +81,14 @@ Where proposal.json contains: if err != nil { return err } - if err := msg.ValidateBasic(); err != nil { + contentProposal := msg.GetContent() + if contentProposal == nil { + return errors.Wrap(govtypes.ErrInvalidProposalContent, "missing content") + } + if !govv1beta1.IsValidProposalType(contentProposal.ProposalType()) { + return errors.Wrap(govtypes.ErrInvalidProposalType, contentProposal.ProposalType()) + } + if err := contentProposal.ValidateBasic(); err != nil { return err } diff --git a/x/kavadist/genesis_test.go b/x/kavadist/genesis_test.go index 171a4feec1..0e35941bee 100644 --- a/x/kavadist/genesis_test.go +++ b/x/kavadist/genesis_test.go @@ -27,7 +27,7 @@ func (suite *genesisTestSuite) TestInitGenesis_ValidationPanic() { { Start: time.Date(2021, 1, 1, 1, 1, 1, 1, time.UTC), End: tmtime.Canonical(time.Unix(1, 0)), - Inflation: sdk.OneDec(), + Inflation: sdkmath.LegacyOneDec(), }, }, }, @@ -47,7 +47,7 @@ func (suite *genesisTestSuite) TestInitAndExportGenesis() { { Start: time.Date(2021, 1, 1, 1, 1, 1, 1, time.UTC), End: time.Date(2021, 2, 1, 1, 1, 1, 1, time.UTC), - Inflation: sdk.OneDec(), + Inflation: sdkmath.LegacyOneDec(), }, }, }, diff --git a/x/kavadist/keeper/infrastructure.go b/x/kavadist/keeper/infrastructure.go index 0445d662cf..f3693e5019 100644 --- a/x/kavadist/keeper/infrastructure.go +++ b/x/kavadist/keeper/infrastructure.go @@ -12,8 +12,8 @@ import ( func (k Keeper) mintInfrastructurePeriods(ctx sdk.Context, periods types.Periods, previousBlockTime time.Time) (sdk.Coin, sdkmath.Int, error) { var err error - coinsMinted := sdk.NewCoin(types.GovDenom, sdk.ZeroInt()) - timeElapsed := sdk.ZeroInt() + coinsMinted := sdk.NewCoin(types.GovDenom, sdkmath.ZeroInt()) + timeElapsed := sdkmath.ZeroInt() for _, period := range periods { switch { // Case 1 - period is fully expired @@ -77,7 +77,7 @@ func (k Keeper) distributeInfrastructureCoins(ctx sdk.Context, partnerRewards ty coinsToDistribute = updatedCoins } for _, cr := range coreRewards { - coinsToSend := sdk.NewCoin(types.GovDenom, sdk.NewDecFromInt(coinsToDistribute.Amount).Mul(cr.Weight).RoundInt()) + coinsToSend := sdk.NewCoin(types.GovDenom, sdkmath.LegacyNewDecFromInt(coinsToDistribute.Amount).Mul(cr.Weight).RoundInt()) // TODO check balance, log if insufficient and return rather than error err := k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, cr.Address, sdk.NewCoins(coinsToSend)) if err != nil { diff --git a/x/kavadist/keeper/keeper.go b/x/kavadist/keeper/keeper.go index cc324c5310..57a283c1c8 100644 --- a/x/kavadist/keeper/keeper.go +++ b/x/kavadist/keeper/keeper.go @@ -4,8 +4,8 @@ import ( "time" "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/store/prefix" - storetypes "github.com/cosmos/cosmos-sdk/store/types" + "cosmossdk.io/store/prefix" + storetypes "cosmossdk.io/store/types" sdk "github.com/cosmos/cosmos-sdk/types" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" diff --git a/x/kavadist/keeper/mint.go b/x/kavadist/keeper/mint.go index e9a20ca534..4e589db419 100644 --- a/x/kavadist/keeper/mint.go +++ b/x/kavadist/keeper/mint.go @@ -81,19 +81,19 @@ func (k Keeper) mintIncentivePeriods(ctx sdk.Context, periods types.Periods, pre return nil } -func (k Keeper) mintInflationaryCoins(ctx sdk.Context, inflationRate sdk.Dec, timePeriods sdkmath.Int, denom string) (sdk.Coin, error) { +func (k Keeper) mintInflationaryCoins(ctx sdk.Context, inflationRate sdkmath.LegacyDec, timePeriods sdkmath.Int, denom string) (sdk.Coin, error) { totalSupply := k.bankKeeper.GetSupply(ctx, denom) // used to scale accumulator calculations by 10^18 scalar := sdkmath.NewInt(1000000000000000000) // convert inflation rate to integer - inflationInt := sdkmath.NewUintFromBigInt(inflationRate.Mul(sdk.NewDecFromInt(scalar)).TruncateInt().BigInt()) + inflationInt := sdkmath.NewUintFromBigInt(inflationRate.Mul(sdkmath.LegacyNewDecFromInt(scalar)).TruncateInt().BigInt()) timePeriodsUint := sdkmath.NewUintFromBigInt(timePeriods.BigInt()) scalarUint := sdkmath.NewUintFromBigInt(scalar.BigInt()) // calculate the multiplier (amount to multiply the total supply by to achieve the desired inflation) // multiply the result by 10^-18 because RelativePow returns the result scaled by 10^18 - accumulator := sdk.NewDecFromBigInt(sdkmath.RelativePow(inflationInt, timePeriodsUint, scalarUint).BigInt()).Mul(sdk.SmallestDec()) + accumulator := sdkmath.LegacyNewDecFromBigInt(sdkmath.RelativePow(inflationInt, timePeriodsUint, scalarUint).BigInt()).Mul(sdkmath.LegacySmallestDec()) // calculate the number of coins to mint - amountToMint := (sdk.NewDecFromInt(totalSupply.Amount).Mul(accumulator)).Sub(sdk.NewDecFromInt(totalSupply.Amount)).TruncateInt() + amountToMint := (sdkmath.LegacyNewDecFromInt(totalSupply.Amount).Mul(accumulator)).Sub(sdkmath.LegacyNewDecFromInt(totalSupply.Amount)).TruncateInt() if amountToMint.IsZero() { return sdk.Coin{}, nil } diff --git a/x/kavadist/keeper/mint_test.go b/x/kavadist/keeper/mint_test.go index c58923d132..602471ced6 100644 --- a/x/kavadist/keeper/mint_test.go +++ b/x/kavadist/keeper/mint_test.go @@ -44,9 +44,9 @@ func (suite *keeperTestSuite) TestMintOngoingPeriod() { mAccSupply := suite.BankKeeper.GetAllBalances(ctx, mAcc.GetAddress()).AmountOf(types.GovDenom) suite.Require().True(mAccSupply.Equal(finalSupply.Amount.Sub(initialSupply.Amount))) // expect that inflation is ~10% - expectedSupply := sdk.NewDecFromInt(initialSupply.Amount).Mul(sdk.MustNewDecFromStr("1.1")) - supplyError := sdk.OneDec().Sub((sdk.NewDecFromInt(finalSupply.Amount).Quo(expectedSupply))).Abs() - suite.Require().True(supplyError.LTE(sdk.MustNewDecFromStr("0.001"))) + expectedSupply := sdkmath.LegacyNewDecFromInt(initialSupply.Amount).Mul(sdkmath.LegacyMustNewDecFromStr("1.1")) + supplyError := sdkmath.LegacyOneDec().Sub((sdkmath.LegacyNewDecFromInt(finalSupply.Amount).Quo(expectedSupply))).Abs() + suite.Require().True(supplyError.LTE(sdkmath.LegacyMustNewDecFromStr("0.001"))) } func (suite *keeperTestSuite) TestMintPeriodTransition() { @@ -57,7 +57,7 @@ func (suite *keeperTestSuite) TestMintPeriodTransition() { { Start: time.Date(2021, time.March, 1, 1, 0, 0, 0, time.UTC), End: time.Date(2022, time.March, 1, 1, 0, 0, 0, time.UTC), - Inflation: sdk.MustNewDecFromStr("1.000000003022265980"), + Inflation: sdkmath.LegacyMustNewDecFromStr("1.000000003022265980"), }, } params.Periods = periods @@ -97,7 +97,7 @@ func (suite *keeperTestSuite) TestInfraMinting() { endTime time.Time infraPeriods types.Periods expectedFinalSupply sdk.Coin - marginOfError sdk.Dec + marginOfError sdkmath.LegacyDec } type errArgs struct { @@ -117,9 +117,9 @@ func (suite *keeperTestSuite) TestInfraMinting() { args{ startTime: time.Date(2022, time.October, 1, 1, 0, 0, 0, time.UTC), endTime: time.Date(2023, time.October, 1, 1, 0, 0, 0, time.UTC), - infraPeriods: types.Periods{types.NewPeriod(time.Date(2022, time.October, 1, 1, 0, 0, 0, time.UTC), time.Date(2023, time.October, 1, 1, 0, 0, 0, time.UTC), sdk.MustNewDecFromStr("1.000000001547125958"))}, + infraPeriods: types.Periods{types.NewPeriod(time.Date(2022, time.October, 1, 1, 0, 0, 0, time.UTC), time.Date(2023, time.October, 1, 1, 0, 0, 0, time.UTC), sdkmath.LegacyMustNewDecFromStr("1.000000001547125958"))}, expectedFinalSupply: sdk.NewCoin(types.GovDenom, sdkmath.NewInt(1050000000000)), - marginOfError: sdk.MustNewDecFromStr("0.0001"), + marginOfError: sdkmath.LegacyMustNewDecFromStr("0.0001"), }, errArgs{ expectPass: true, @@ -131,9 +131,9 @@ func (suite *keeperTestSuite) TestInfraMinting() { args{ startTime: time.Date(2022, time.October, 1, 1, 0, 0, 0, time.UTC), endTime: time.Date(2022, time.October, 1, 1, 0, 10, 0, time.UTC), - infraPeriods: types.Periods{types.NewPeriod(time.Date(2022, time.October, 1, 1, 0, 0, 0, time.UTC), time.Date(2023, time.October, 1, 1, 0, 0, 0, time.UTC), sdk.MustNewDecFromStr("1.000000001547125958"))}, + infraPeriods: types.Periods{types.NewPeriod(time.Date(2022, time.October, 1, 1, 0, 0, 0, time.UTC), time.Date(2023, time.October, 1, 1, 0, 0, 0, time.UTC), sdkmath.LegacyMustNewDecFromStr("1.000000001547125958"))}, expectedFinalSupply: sdk.NewCoin(types.GovDenom, sdkmath.NewInt(1000000015471)), - marginOfError: sdk.MustNewDecFromStr("0.0001"), + marginOfError: sdkmath.LegacyMustNewDecFromStr("0.0001"), }, errArgs{ expectPass: true, @@ -160,16 +160,16 @@ func (suite *keeperTestSuite) TestInfraMinting() { suite.Require().NoError(err) finalSupply := suite.BankKeeper.GetSupply(ctx, types.GovDenom) - marginHigh := sdk.NewDecFromInt(tc.args.expectedFinalSupply.Amount).Mul(sdk.OneDec().Add(tc.args.marginOfError)) - marginLow := sdk.NewDecFromInt(tc.args.expectedFinalSupply.Amount).Mul(sdk.OneDec().Sub(tc.args.marginOfError)) + marginHigh := sdkmath.LegacyNewDecFromInt(tc.args.expectedFinalSupply.Amount).Mul(sdkmath.LegacyOneDec().Add(tc.args.marginOfError)) + marginLow := sdkmath.LegacyNewDecFromInt(tc.args.expectedFinalSupply.Amount).Mul(sdkmath.LegacyOneDec().Sub(tc.args.marginOfError)) suite.Require().Truef( - sdk.NewDecFromInt(finalSupply.Amount).LTE(marginHigh), + sdkmath.LegacyNewDecFromInt(finalSupply.Amount).LTE(marginHigh), "final supply %s is not <= %s high margin", finalSupply.Amount.String(), marginHigh.String(), ) suite.Require().Truef( - sdk.NewDecFromInt(finalSupply.Amount).GTE(marginLow), + sdkmath.LegacyNewDecFromInt(finalSupply.Amount).GTE(marginLow), "final supply %s is not >= %s low margin", finalSupply.Amount.String(), ) @@ -186,7 +186,7 @@ func (suite *keeperTestSuite) TestInfraPayoutCore() { infraPeriods types.Periods expectedFinalSupply sdk.Coin expectedBalanceIncrease sdk.Coin - marginOfError sdk.Dec + marginOfError sdkmath.LegacyDec } type errArgs struct { @@ -206,10 +206,10 @@ func (suite *keeperTestSuite) TestInfraPayoutCore() { args{ startTime: time.Date(2022, time.October, 1, 1, 0, 0, 0, time.UTC), endTime: time.Date(2023, time.October, 1, 1, 0, 0, 0, time.UTC), - infraPeriods: types.Periods{types.NewPeriod(time.Date(2022, time.October, 1, 1, 0, 0, 0, time.UTC), time.Date(2023, time.October, 1, 1, 0, 0, 0, time.UTC), sdk.MustNewDecFromStr("1.000000001547125958"))}, + infraPeriods: types.Periods{types.NewPeriod(time.Date(2022, time.October, 1, 1, 0, 0, 0, time.UTC), time.Date(2023, time.October, 1, 1, 0, 0, 0, time.UTC), sdkmath.LegacyMustNewDecFromStr("1.000000001547125958"))}, expectedFinalSupply: sdk.NewCoin(types.GovDenom, sdkmath.NewInt(1050000000000)), expectedBalanceIncrease: sdk.NewCoin(types.GovDenom, sdkmath.NewInt(50000000000)), - marginOfError: sdk.MustNewDecFromStr("0.0001"), + marginOfError: sdkmath.LegacyMustNewDecFromStr("0.0001"), }, errArgs{ expectPass: true, @@ -220,7 +220,7 @@ func (suite *keeperTestSuite) TestInfraPayoutCore() { for _, tc := range testCases { suite.SetupTest() - coreReward := types.NewCoreReward(suite.Addrs[0], sdk.OneDec()) + coreReward := types.NewCoreReward(suite.Addrs[0], sdkmath.LegacyOneDec()) params := types.NewParams(true, types.DefaultPeriods, types.NewInfraParams(tc.args.infraPeriods, types.DefaultInfraParams.PartnerRewards, types.CoreRewards{coreReward})) ctx := suite.Ctx.WithBlockTime(tc.args.startTime) suite.Keeper.SetParams(ctx, params) @@ -237,10 +237,10 @@ func (suite *keeperTestSuite) TestInfraPayoutCore() { err := suite.Keeper.MintPeriodInflation(ctx) suite.Require().NoError(err) finalSupply := suite.BankKeeper.GetSupply(ctx, types.GovDenom) - marginHigh := sdk.NewDecFromInt(tc.args.expectedFinalSupply.Amount).Mul(sdk.OneDec().Add(tc.args.marginOfError)) - marginLow := sdk.NewDecFromInt(tc.args.expectedFinalSupply.Amount).Mul(sdk.OneDec().Sub(tc.args.marginOfError)) - suite.Require().True(sdk.NewDecFromInt(finalSupply.Amount).LTE(marginHigh)) - suite.Require().True(sdk.NewDecFromInt(finalSupply.Amount).GTE(marginLow)) + marginHigh := sdkmath.LegacyNewDecFromInt(tc.args.expectedFinalSupply.Amount).Mul(sdkmath.LegacyOneDec().Add(tc.args.marginOfError)) + marginLow := sdkmath.LegacyNewDecFromInt(tc.args.expectedFinalSupply.Amount).Mul(sdkmath.LegacyOneDec().Sub(tc.args.marginOfError)) + suite.Require().True(sdkmath.LegacyNewDecFromInt(finalSupply.Amount).LTE(marginHigh)) + suite.Require().True(sdkmath.LegacyNewDecFromInt(finalSupply.Amount).GTE(marginLow)) finalBalance := suite.BankKeeper.GetBalance(ctx, suite.Addrs[0], types.GovDenom) suite.Require().Equal(tc.args.expectedBalanceIncrease, finalBalance.Sub(initialBalance)) @@ -257,7 +257,7 @@ func (suite *keeperTestSuite) TestInfraPayoutPartner() { infraPeriods types.Periods expectedFinalSupply sdk.Coin expectedBalanceIncrease sdk.Coin - marginOfError sdk.Dec + marginOfError sdkmath.LegacyDec } type errArgs struct { @@ -277,10 +277,10 @@ func (suite *keeperTestSuite) TestInfraPayoutPartner() { args{ startTime: time.Date(2022, time.October, 1, 1, 0, 0, 0, time.UTC), endTime: time.Date(2023, time.October, 1, 1, 0, 0, 0, time.UTC), - infraPeriods: types.Periods{types.NewPeriod(time.Date(2022, time.October, 1, 1, 0, 0, 0, time.UTC), time.Date(2023, time.October, 1, 1, 0, 0, 0, time.UTC), sdk.MustNewDecFromStr("1.000000001547125958"))}, + infraPeriods: types.Periods{types.NewPeriod(time.Date(2022, time.October, 1, 1, 0, 0, 0, time.UTC), time.Date(2023, time.October, 1, 1, 0, 0, 0, time.UTC), sdkmath.LegacyMustNewDecFromStr("1.000000001547125958"))}, expectedFinalSupply: sdk.NewCoin(types.GovDenom, sdkmath.NewInt(1050000000000)), expectedBalanceIncrease: sdk.NewCoin(types.GovDenom, sdkmath.NewInt(63072000)), - marginOfError: sdk.MustNewDecFromStr("0.0001"), + marginOfError: sdkmath.LegacyMustNewDecFromStr("0.0001"), }, errArgs{ expectPass: true, @@ -308,10 +308,10 @@ func (suite *keeperTestSuite) TestInfraPayoutPartner() { err := suite.Keeper.MintPeriodInflation(ctx) suite.Require().NoError(err) finalSupply := suite.BankKeeper.GetSupply(ctx, types.GovDenom) - marginHigh := sdk.NewDecFromInt(tc.args.expectedFinalSupply.Amount).Mul(sdk.OneDec().Add(tc.args.marginOfError)) - marginLow := sdk.NewDecFromInt(tc.args.expectedFinalSupply.Amount).Mul(sdk.OneDec().Sub(tc.args.marginOfError)) - suite.Require().True(sdk.NewDecFromInt(finalSupply.Amount).LTE(marginHigh)) - suite.Require().True(sdk.NewDecFromInt(finalSupply.Amount).GTE(marginLow)) + marginHigh := sdkmath.LegacyNewDecFromInt(tc.args.expectedFinalSupply.Amount).Mul(sdkmath.LegacyOneDec().Add(tc.args.marginOfError)) + marginLow := sdkmath.LegacyNewDecFromInt(tc.args.expectedFinalSupply.Amount).Mul(sdkmath.LegacyOneDec().Sub(tc.args.marginOfError)) + suite.Require().True(sdkmath.LegacyNewDecFromInt(finalSupply.Amount).LTE(marginHigh)) + suite.Require().True(sdkmath.LegacyNewDecFromInt(finalSupply.Amount).GTE(marginLow)) finalBalance := suite.BankKeeper.GetBalance(ctx, suite.Addrs[0], types.GovDenom) suite.Require().Equal(tc.args.expectedBalanceIncrease, finalBalance.Sub(initialBalance)) @@ -338,7 +338,7 @@ func (suite *keeperTestSuite) TestInfraPayoutE2E() { partnerRewards types.PartnerRewards expectedFinalSupply sdk.Coin expectedBalances balances - marginOfError sdk.Dec + marginOfError sdkmath.LegacyDec } type errArgs struct { @@ -358,18 +358,18 @@ func (suite *keeperTestSuite) TestInfraPayoutE2E() { { "5% apy one year", args{ - periods: types.Periods{types.NewPeriod(time.Date(2022, time.October, 1, 1, 0, 0, 0, time.UTC), time.Date(2023, time.October, 1, 1, 0, 0, 0, time.UTC), sdk.MustNewDecFromStr("1.000000001547125958"))}, + periods: types.Periods{types.NewPeriod(time.Date(2022, time.October, 1, 1, 0, 0, 0, time.UTC), time.Date(2023, time.October, 1, 1, 0, 0, 0, time.UTC), sdkmath.LegacyMustNewDecFromStr("1.000000001547125958"))}, startTime: time.Date(2022, time.October, 1, 1, 0, 0, 0, time.UTC), endTime: time.Date(2023, time.October, 1, 1, 0, 0, 0, time.UTC), - infraPeriods: types.Periods{types.NewPeriod(time.Date(2022, time.October, 1, 1, 0, 0, 0, time.UTC), time.Date(2023, time.October, 1, 1, 0, 0, 0, time.UTC), sdk.MustNewDecFromStr("1.000000001547125958"))}, - coreRewards: types.CoreRewards{types.NewCoreReward(addrs[1], sdk.OneDec())}, + infraPeriods: types.Periods{types.NewPeriod(time.Date(2022, time.October, 1, 1, 0, 0, 0, time.UTC), time.Date(2023, time.October, 1, 1, 0, 0, 0, time.UTC), sdkmath.LegacyMustNewDecFromStr("1.000000001547125958"))}, + coreRewards: types.CoreRewards{types.NewCoreReward(addrs[1], sdkmath.LegacyOneDec())}, partnerRewards: types.PartnerRewards{types.NewPartnerReward(addrs[2], sdk.NewCoin("ukava", sdkmath.NewInt(2)))}, expectedFinalSupply: sdk.NewCoin(types.GovDenom, sdkmath.NewInt(1102500000000)), expectedBalances: balances{ balance{addrs[1], sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(52436928000)))}, balance{addrs[2], sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(63072000)))}, }, - marginOfError: sdk.MustNewDecFromStr("0.0001"), + marginOfError: sdkmath.LegacyMustNewDecFromStr("0.0001"), }, errArgs{ expectPass: true, @@ -395,10 +395,10 @@ func (suite *keeperTestSuite) TestInfraPayoutE2E() { err := suite.Keeper.MintPeriodInflation(ctx) suite.Require().NoError(err) finalSupply := suite.BankKeeper.GetSupply(ctx, types.GovDenom) - marginHigh := sdk.NewDecFromInt(tc.args.expectedFinalSupply.Amount).Mul(sdk.OneDec().Add(tc.args.marginOfError)) - marginLow := sdk.NewDecFromInt(tc.args.expectedFinalSupply.Amount).Mul(sdk.OneDec().Sub(tc.args.marginOfError)) - suite.Require().True(sdk.NewDecFromInt(finalSupply.Amount).LTE(marginHigh)) - suite.Require().True(sdk.NewDecFromInt(finalSupply.Amount).GTE(marginLow)) + marginHigh := sdkmath.LegacyNewDecFromInt(tc.args.expectedFinalSupply.Amount).Mul(sdkmath.LegacyOneDec().Add(tc.args.marginOfError)) + marginLow := sdkmath.LegacyNewDecFromInt(tc.args.expectedFinalSupply.Amount).Mul(sdkmath.LegacyOneDec().Sub(tc.args.marginOfError)) + suite.Require().True(sdkmath.LegacyNewDecFromInt(finalSupply.Amount).LTE(marginHigh)) + suite.Require().True(sdkmath.LegacyNewDecFromInt(finalSupply.Amount).GTE(marginLow)) for _, bal := range tc.args.expectedBalances { finalBalance := suite.BankKeeper.GetAllBalances(ctx, bal.address) diff --git a/x/kavadist/module.go b/x/kavadist/module.go index 11d01d8bc7..3b67870b74 100644 --- a/x/kavadist/module.go +++ b/x/kavadist/module.go @@ -133,12 +133,19 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw func (AppModule) ConsensusVersion() uint64 { return 1 } // BeginBlock executes all ABCI BeginBlock logic respective to kavadist module. -func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) { +func (am AppModule) BeginBlock(ctx sdk.Context) error { BeginBlocker(ctx, am.keeper) + + // TODO(boodyvo): should read about if we should panic inside or return nil here + return nil } // EndBlock executes all ABCI EndBlock logic respective to kavadist module. It // returns no validator updates. -func (am AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { - return []abci.ValidatorUpdate{} +func (am AppModule) EndBlock(_ sdk.Context) ([]abci.ValidatorUpdate, error) { + return []abci.ValidatorUpdate{}, nil } + +func (AppModule) IsOnePerModuleType() {} + +func (AppModule) IsAppModule() {} diff --git a/x/kavadist/spec/02_state.md b/x/kavadist/spec/02_state.md index abc3a0e656..b4a0b3a2d4 100644 --- a/x/kavadist/spec/02_state.md +++ b/x/kavadist/spec/02_state.md @@ -19,7 +19,7 @@ type Params struct { type Period struct { Start time.Time `json:"start" yaml:"start"` // example "2020-03-01T15:20:00Z" End time.Time `json:"end" yaml:"end"` // example "2020-06-01T15:20:00Z" - Inflation sdk.Dec `json:"inflation" yaml:"inflation"` // example "1.000000003022265980" - 10% inflation + Inflation sdkmath.LegacyDec `json:"inflation" yaml:"inflation"` // example "1.000000003022265980" - 10% inflation } ``` diff --git a/x/kavadist/spec/05_params.md b/x/kavadist/spec/05_params.md index 3860bc9494..4a82f0563b 100644 --- a/x/kavadist/spec/05_params.md +++ b/x/kavadist/spec/05_params.md @@ -26,14 +26,14 @@ Each `Period` has the following parameters | --------- | --------- | ---------------------- | --------------------------------------- | | Start | time.Time | "2020-03-01T15:20:00Z" | the time when the period will start | | End | time.Time | "2020-06-01T15:20:00Z" | the time when the period will end | -| Inflation | sdk.Dec | "1.000000003022265980" | the per-second inflation for the period | +| Inflation | sdkmath.LegacyDec | "1.000000003022265980" | the per-second inflation for the period | Each `CoreReward` has the following properties | Key | Type | Example | Description | | ------- | -------------- | --------------------------------------------- | -------------------------------------------------------- | | Address | sdk.AccAddress | "kava1x07eng0q9027j7wayap8nvqegpf625uu0w90tq" | address of core infrastructure provider | -| Weight | sdk.Dec | "0.912345678907654321" | % of remaining minted rewards allocated to this provider | +| Weight | sdkmath.LegacyDec | "0.912345678907654321" | % of remaining minted rewards allocated to this provider | Each `PartnerReward` has the following properties diff --git a/x/kavadist/testutil/suite.go b/x/kavadist/testutil/suite.go index 58a001da58..7a2c53c2f3 100644 --- a/x/kavadist/testutil/suite.go +++ b/x/kavadist/testutil/suite.go @@ -13,7 +13,6 @@ import ( tmtime "github.com/cometbft/cometbft/types/time" accountkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" "github.com/kava-labs/kava/app" @@ -44,13 +43,13 @@ func (suite *Suite) SetupTest() { coins := sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(1000000000000))) authGS := app.NewFundedGenStateWithSameCoins(tApp.AppCodec(), coins, addrs) - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) testPeriods := []types.Period{ { Start: time.Date(2020, time.March, 1, 1, 0, 0, 0, time.UTC), End: time.Date(2021, time.March, 1, 1, 0, 0, 0, time.UTC), - Inflation: sdk.MustNewDecFromStr("1.000000003022265980"), + Inflation: sdkmath.LegacyMustNewDecFromStr("1.000000003022265980"), }, } params := types.NewParams(true, testPeriods, types.DefaultInfraParams) @@ -71,7 +70,7 @@ func (suite *Suite) SetupTest() { } // CreateAccount creates a new account with the provided balance -func (suite *Suite) CreateAccount(initialBalance sdk.Coins) authtypes.AccountI { +func (suite *Suite) CreateAccount(initialBalance sdk.Coins) sdk.AccountI { _, addrs := app.GeneratePrivKeyAddressPairs(1) fmt.Println(addrs[0].String()) acc := suite.AccountKeeper.NewAccountWithAddress(suite.Ctx, addrs[0]) diff --git a/x/kavadist/types/codec.go b/x/kavadist/types/codec.go index 10685c2471..ecfa22b41e 100644 --- a/x/kavadist/types/codec.go +++ b/x/kavadist/types/codec.go @@ -4,7 +4,6 @@ import ( "github.com/cosmos/cosmos-sdk/codec" cdctypes "github.com/cosmos/cosmos-sdk/codec/types" cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" - authzcodec "github.com/cosmos/cosmos-sdk/x/authz/codec" govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" ) @@ -33,5 +32,5 @@ func init() { // Register all Amino interfaces and concrete types on the authz Amino codec so that this can later be // used to properly serialize MsgGrant and MsgExec instances - RegisterLegacyAminoCodec(authzcodec.Amino) + RegisterLegacyAminoCodec(codec.NewLegacyAmino()) } diff --git a/x/kavadist/types/expected_keepers.go b/x/kavadist/types/expected_keepers.go index e78d3d9fc2..59da8271ae 100644 --- a/x/kavadist/types/expected_keepers.go +++ b/x/kavadist/types/expected_keepers.go @@ -1,26 +1,26 @@ package types import ( + "context" sdk "github.com/cosmos/cosmos-sdk/types" - authTypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) // DistKeeper defines the expected distribution keeper interface type DistKeeper interface { - DistributeFromFeePool(ctx sdk.Context, amount sdk.Coins, receiveAddr sdk.AccAddress) error + DistributeFromFeePool(ctx context.Context, amount sdk.Coins, receiveAddr sdk.AccAddress) error } // AccountKeeper defines the expected account keeper interface type AccountKeeper interface { - GetModuleAccount(ctx sdk.Context, moduleName string) authTypes.ModuleAccountI - SetModuleAccount(ctx sdk.Context, macc authTypes.ModuleAccountI) - NewAccountWithAddress(ctx sdk.Context, addr sdk.AccAddress) authTypes.AccountI + GetModuleAccount(ctx context.Context, moduleName string) sdk.ModuleAccountI + SetModuleAccount(ctx context.Context, macc sdk.ModuleAccountI) + NewAccountWithAddress(ctx context.Context, addr sdk.AccAddress) sdk.AccountI } // BankKeeper defines the expected bank keeper interface type BankKeeper interface { - GetAllBalances(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins - MintCoins(ctx sdk.Context, moduleName string, amounts sdk.Coins) error - GetSupply(ctx sdk.Context, denom string) sdk.Coin - SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error + GetAllBalances(ctx context.Context, addr sdk.AccAddress) sdk.Coins + MintCoins(ctx context.Context, moduleName string, amounts sdk.Coins) error + GetSupply(ctx context.Context, denom string) sdk.Coin + SendCoinsFromModuleToAccount(ctx context.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error } diff --git a/x/kavadist/types/params.go b/x/kavadist/types/params.go index ad8074480d..d2fb071891 100644 --- a/x/kavadist/types/params.go +++ b/x/kavadist/types/params.go @@ -1,6 +1,7 @@ package types import ( + sdkmath "cosmossdk.io/math" "fmt" "time" @@ -87,7 +88,7 @@ func (p Params) Validate() error { } // NewPeriod returns a new instance of Period -func NewPeriod(start time.Time, end time.Time, inflation sdk.Dec) Period { +func NewPeriod(start time.Time, end time.Time, inflation sdkmath.LegacyDec) Period { return Period{ Start: start, End: end, @@ -120,7 +121,7 @@ func NewPartnerReward(addr sdk.AccAddress, rps sdk.Coin) PartnerReward { } } -func NewCoreReward(addr sdk.AccAddress, w sdk.Dec) CoreReward { +func NewCoreReward(addr sdk.AccAddress, w sdkmath.LegacyDec) CoreReward { return CoreReward{ Address: addr, Weight: w, diff --git a/x/kavadist/types/params.pb.go b/x/kavadist/types/params.pb.go index 49eb8475fa..418e190287 100644 --- a/x/kavadist/types/params.pb.go +++ b/x/kavadist/types/params.pb.go @@ -4,6 +4,7 @@ package types import ( + cosmossdk_io_math "cosmossdk.io/math" fmt "fmt" _ "github.com/cosmos/cosmos-proto" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" @@ -112,7 +113,7 @@ var xxx_messageInfo_InfrastructureParams proto.InternalMessageInfo // CoreReward defines the reward weights for core infrastructure providers. type CoreReward struct { Address github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,1,opt,name=address,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"address,omitempty"` - Weight github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=weight,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"weight"` + Weight cosmossdk_io_math.LegacyDec `protobuf:"bytes,2,opt,name=weight,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"weight"` } func (m *CoreReward) Reset() { *m = CoreReward{} } @@ -195,7 +196,7 @@ type Period struct { // example "2020-06-01T15:20:00Z" End time.Time `protobuf:"bytes,2,opt,name=end,proto3,stdtime" json:"end"` // example "1.000000003022265980" - 10% inflation - Inflation github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=inflation,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"inflation"` + Inflation cosmossdk_io_math.LegacyDec `protobuf:"bytes,3,opt,name=inflation,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"inflation"` } func (m *Period) Reset() { *m = Period{} } @@ -243,48 +244,49 @@ func init() { } var fileDescriptor_2c7a7a4b0c884a4e = []byte{ - // 649 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x54, 0x3f, 0x4f, 0x1b, 0x3f, - 0x18, 0x8e, 0x49, 0x7e, 0x01, 0x1c, 0x7e, 0x50, 0x99, 0x3f, 0x0a, 0x48, 0xbd, 0x4b, 0xa3, 0xaa, - 0x8a, 0x5a, 0xe5, 0x4e, 0xa4, 0x52, 0x07, 0xd4, 0x0e, 0x5c, 0x19, 0x5a, 0x89, 0x4a, 0xe8, 0xca, - 0xd2, 0x2e, 0x91, 0xcf, 0xe7, 0x04, 0x0b, 0x72, 0x3e, 0xd9, 0x0e, 0x94, 0x6f, 0xc1, 0xd8, 0x91, - 0xb9, 0x33, 0x5f, 0xa1, 0x6a, 0x86, 0x0e, 0x88, 0x09, 0x75, 0x80, 0x02, 0x4b, 0x3f, 0x43, 0xa7, - 0xea, 0x6c, 0x87, 0x10, 0x04, 0x52, 0xba, 0x74, 0x49, 0xee, 0x7d, 0xfd, 0x3e, 0xcf, 0xfb, 0x3e, - 0xe7, 0xe7, 0x3d, 0x58, 0xdd, 0xc6, 0xbb, 0xd8, 0xcf, 0x7e, 0x62, 0x26, 0x95, 0xbf, 0xbb, 0x1c, - 0x51, 0x85, 0x97, 0xfd, 0x14, 0x0b, 0xdc, 0x91, 0x5e, 0x2a, 0xb8, 0xe2, 0x68, 0x3e, 0x3b, 0xf6, - 0xfa, 0x35, 0x9e, 0xad, 0x59, 0x72, 0x08, 0x97, 0x1d, 0x2e, 0xfd, 0x08, 0x4b, 0x7a, 0x0d, 0x24, - 0x9c, 0x25, 0x06, 0xb6, 0xb4, 0x68, 0xce, 0x9b, 0x3a, 0xf2, 0x4d, 0x60, 0x8f, 0xe6, 0xda, 0xbc, - 0xcd, 0x4d, 0x3e, 0x7b, 0xb2, 0x59, 0xb7, 0xcd, 0x79, 0x7b, 0x87, 0xfa, 0x3a, 0x8a, 0xba, 0x2d, - 0x5f, 0xb1, 0x0e, 0x95, 0x0a, 0x77, 0x52, 0x53, 0x50, 0xfd, 0x06, 0x60, 0x71, 0x43, 0x4f, 0x86, - 0x16, 0x60, 0x11, 0x13, 0xc5, 0x76, 0x69, 0x19, 0x54, 0x40, 0x6d, 0x22, 0xb4, 0x11, 0x7a, 0x05, - 0xc7, 0x53, 0x2a, 0x18, 0x8f, 0x65, 0x39, 0x5f, 0xc9, 0xd7, 0x4a, 0x8d, 0x87, 0xde, 0x9d, 0xd3, - 0x7b, 0x1b, 0xba, 0x2a, 0x28, 0xf4, 0xce, 0xdc, 0x5c, 0xd8, 0xc7, 0xa0, 0x16, 0x9c, 0x67, 0x49, - 0x4b, 0x60, 0xa9, 0x44, 0x97, 0xa8, 0xae, 0xa0, 0x4d, 0xf3, 0x26, 0xca, 0x85, 0x0a, 0xa8, 0x95, - 0x1a, 0xcf, 0xee, 0x21, 0x7b, 0x3b, 0x84, 0x31, 0x23, 0x5a, 0xea, 0x39, 0x76, 0xc7, 0x59, 0xf5, - 0xeb, 0x18, 0x9c, 0xbb, 0x0b, 0x84, 0x28, 0x5c, 0xb8, 0x3d, 0x80, 0x95, 0x03, 0x46, 0x91, 0x33, - 0x93, 0xf5, 0xfc, 0x72, 0xee, 0x8e, 0x9b, 0x58, 0x86, 0xb7, 0xe4, 0xd8, 0x34, 0xfa, 0x00, 0xa7, - 0x08, 0x17, 0xb4, 0x29, 0xe8, 0x1e, 0x16, 0xb1, 0x2c, 0x8f, 0x69, 0xf2, 0x47, 0xf7, 0x90, 0xbf, - 0xe6, 0x82, 0x86, 0xba, 0x32, 0x98, 0xb5, 0x0d, 0x4a, 0x83, 0x9c, 0x0c, 0x4b, 0x64, 0x10, 0x20, - 0x0a, 0x67, 0x52, 0x2c, 0x54, 0x42, 0xc5, 0x35, 0xbb, 0xb9, 0x89, 0xc7, 0xf7, 0x8d, 0x6e, 0xaa, - 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xf7, 0x36, 0xfb, 0x7b, 0x1e, 0x4c, 0x64, 0x9c, 0x07, 0xe7, 0x2e, - 0x08, 0x0d, 0x04, 0xbd, 0x80, 0x79, 0x7a, 0x3d, 0xcc, 0x68, 0xc8, 0x0c, 0x80, 0xd6, 0xe1, 0x24, - 0x4b, 0x5a, 0x3b, 0x58, 0x31, 0x9e, 0x94, 0xf3, 0xfa, 0xcd, 0x79, 0x7f, 0x77, 0x51, 0xe1, 0x80, - 0x60, 0xa5, 0xf0, 0xeb, 0xd0, 0x05, 0xc1, 0x7a, 0xef, 0xc2, 0xc9, 0x9d, 0x5e, 0x38, 0xb9, 0xde, - 0xa5, 0x03, 0x8e, 0x2f, 0x1d, 0xf0, 0xf3, 0xd2, 0x01, 0x07, 0x57, 0x4e, 0xee, 0xf8, 0xca, 0xc9, - 0x9d, 0x5e, 0x39, 0xb9, 0x8f, 0x4f, 0x6f, 0x50, 0x67, 0x3e, 0xaf, 0xef, 0xe0, 0x48, 0xea, 0x27, - 0xff, 0xd3, 0xe0, 0x23, 0xab, 0x5b, 0x44, 0x45, 0x2d, 0xe2, 0xf9, 0x9f, 0x00, 0x00, 0x00, 0xff, - 0xff, 0xca, 0x25, 0xda, 0x69, 0x82, 0x05, 0x00, 0x00, + // 662 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x54, 0x3d, 0x4f, 0x1b, 0x4b, + 0x14, 0xf5, 0x60, 0x3f, 0x03, 0x63, 0x1e, 0x3c, 0x2d, 0x1f, 0x32, 0x3c, 0xbd, 0x5d, 0x3f, 0x27, + 0x85, 0x95, 0xc8, 0xb3, 0xc2, 0x91, 0x52, 0x20, 0xa5, 0x60, 0x43, 0x11, 0x24, 0x22, 0xa1, 0x4d, + 0x9a, 0xa4, 0xb1, 0x66, 0x67, 0xc7, 0xcb, 0x08, 0xbc, 0xb3, 0x9a, 0x19, 0x43, 0xf8, 0x17, 0x94, + 0x29, 0xa9, 0x53, 0xf3, 0x07, 0x52, 0xa0, 0xb8, 0x44, 0x54, 0x28, 0x05, 0x04, 0x68, 0xf2, 0x1b, + 0x52, 0x45, 0x3b, 0x33, 0xc6, 0x18, 0x81, 0x44, 0x95, 0xc6, 0xde, 0x7b, 0xe7, 0x9e, 0x33, 0xe7, + 0xec, 0xbd, 0x77, 0x61, 0x7d, 0x1b, 0xef, 0x62, 0x3f, 0xff, 0x89, 0x99, 0x54, 0xfe, 0xee, 0x72, + 0x44, 0x15, 0x5e, 0xf6, 0x33, 0x2c, 0x70, 0x57, 0xa2, 0x4c, 0x70, 0xc5, 0x9d, 0xf9, 0xfc, 0x18, + 0x0d, 0x6a, 0x90, 0xad, 0x59, 0x72, 0x09, 0x97, 0x5d, 0x2e, 0xfd, 0x08, 0x4b, 0x7a, 0x03, 0x24, + 0x9c, 0xa5, 0x06, 0xb6, 0xb4, 0x68, 0xce, 0xdb, 0x3a, 0xf2, 0x4d, 0x60, 0x8f, 0xe6, 0x12, 0x9e, + 0x70, 0x93, 0xcf, 0x9f, 0x6c, 0xd6, 0x4b, 0x38, 0x4f, 0x76, 0xa8, 0xaf, 0xa3, 0xa8, 0xd7, 0xf1, + 0x15, 0xeb, 0x52, 0xa9, 0x70, 0x37, 0x33, 0x05, 0xf5, 0x6f, 0x00, 0x96, 0x37, 0xb5, 0x32, 0x67, + 0x01, 0x96, 0x31, 0x51, 0x6c, 0x97, 0x56, 0x41, 0x0d, 0x34, 0x26, 0x42, 0x1b, 0x39, 0xaf, 0xe0, + 0x78, 0x46, 0x05, 0xe3, 0xb1, 0xac, 0x16, 0x6b, 0xc5, 0x46, 0xa5, 0xf5, 0x1f, 0xba, 0x57, 0x3d, + 0xda, 0xd4, 0x55, 0x41, 0xa9, 0x7f, 0xee, 0x15, 0xc2, 0x01, 0xc6, 0xe9, 0xc0, 0x79, 0x96, 0x76, + 0x04, 0x96, 0x4a, 0xf4, 0x88, 0xea, 0x09, 0xda, 0x36,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x6b, 0xb7, 0x70, 0x72, 0xed, 0x16, 0xce, 0xae, 0xdd, + 0xc2, 0xc7, 0x67, 0xb7, 0xba, 0x91, 0x4f, 0x74, 0x73, 0x07, 0x47, 0x52, 0x3f, 0xf9, 0x9f, 0x86, + 0x9f, 0x53, 0xdd, 0x95, 0xa8, 0xac, 0x95, 0xbf, 0xf8, 0x1d, 0x00, 0x00, 0xff, 0xff, 0xa3, 0x0b, + 0xaf, 0x4d, 0x6c, 0x05, 0x00, 0x00, } func (this *Period) Equal(that interface{}) bool { diff --git a/x/kavadist/types/params_test.go b/x/kavadist/types/params_test.go index 49b068aa43..a708d3d0c3 100644 --- a/x/kavadist/types/params_test.go +++ b/x/kavadist/types/params_test.go @@ -6,8 +6,6 @@ import ( "github.com/stretchr/testify/suite" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/kava-labs/kava/x/kavadist/types" ) @@ -29,12 +27,12 @@ func (suite *ParamTestSuite) SetupTest() { { Start: time.Date(2020, time.March, 1, 1, 0, 0, 0, time.UTC), End: time.Date(2021, time.March, 1, 1, 0, 0, 0, time.UTC), - Inflation: sdk.MustNewDecFromStr("1.000000003022265980"), + Inflation: sdkmath.LegacyMustNewDecFromStr("1.000000003022265980"), }, { Start: time.Date(2021, time.March, 1, 1, 0, 0, 0, time.UTC), End: time.Date(2022, time.March, 1, 1, 0, 0, 0, time.UTC), - Inflation: sdk.MustNewDecFromStr("1.000000003022265980"), + Inflation: sdkmath.LegacyMustNewDecFromStr("1.000000003022265980"), }, }, } @@ -44,12 +42,12 @@ func (suite *ParamTestSuite) SetupTest() { { Start: time.Date(2022, time.March, 1, 1, 0, 0, 0, time.UTC), End: time.Date(2021, time.March, 1, 1, 0, 0, 0, time.UTC), - Inflation: sdk.MustNewDecFromStr("1.000000003022265980"), + Inflation: sdkmath.LegacyMustNewDecFromStr("1.000000003022265980"), }, { Start: time.Date(2023, time.March, 1, 1, 0, 0, 0, time.UTC), End: time.Date(2024, time.March, 1, 1, 0, 0, 0, time.UTC), - Inflation: sdk.MustNewDecFromStr("1.000000003022265980"), + Inflation: sdkmath.LegacyMustNewDecFromStr("1.000000003022265980"), }, }, } @@ -59,12 +57,12 @@ func (suite *ParamTestSuite) SetupTest() { { Start: time.Date(2020, time.March, 1, 1, 0, 0, 0, time.UTC), End: time.Date(2021, time.March, 1, 1, 0, 0, 0, time.UTC), - Inflation: sdk.MustNewDecFromStr("1.000000003022265980"), + Inflation: sdkmath.LegacyMustNewDecFromStr("1.000000003022265980"), }, { Start: time.Date(2020, time.March, 1, 1, 0, 0, 0, time.UTC), End: time.Date(2022, time.March, 1, 1, 0, 0, 0, time.UTC), - Inflation: sdk.MustNewDecFromStr("1.000000003022265980"), + Inflation: sdkmath.LegacyMustNewDecFromStr("1.000000003022265980"), }, }, } diff --git a/x/kavadist/types/proposal.go b/x/kavadist/types/proposal.go index 3fa8e06f4d..08c9d41d48 100644 --- a/x/kavadist/types/proposal.go +++ b/x/kavadist/types/proposal.go @@ -5,7 +5,6 @@ import ( "strings" sdk "github.com/cosmos/cosmos-sdk/types" - govcodec "github.com/cosmos/cosmos-sdk/x/gov/codec" govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" ) @@ -19,7 +18,8 @@ var _ govv1beta1.Content = CommunityPoolMultiSpendProposal{} func init() { govv1beta1.RegisterProposalType(ProposalTypeCommunityPoolMultiSpend) - govcodec.ModuleCdc.Amino.RegisterConcrete(CommunityPoolMultiSpendProposal{}, "kava/CommunityPoolMultiSpendProposal", nil) + // TODO(boodyvo): check how to change + //govcodec.ModuleCdc.Amino.RegisterConcrete(CommunityPoolMultiSpendProposal{}, "kava/CommunityPoolMultiSpendProposal", nil) } // NewCommunityPoolMultiSpendProposal creates a new community pool multi-spend proposal. diff --git a/x/kavadist/types/query.pb.go b/x/kavadist/types/query.pb.go index 397fc89ff0..5c6e03b2b5 100644 --- a/x/kavadist/types/query.pb.go +++ b/x/kavadist/types/query.pb.go @@ -336,6 +336,7 @@ func _Query_Balance_Handler(srv interface{}, ctx context.Context, dec func(inter return interceptor(ctx, in, info, handler) } +var Query_serviceDesc = _Query_serviceDesc var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "kava.kavadist.v1beta1.Query", HandlerType: (*QueryServer)(nil), diff --git a/x/liquid/keeper/claim.go b/x/liquid/keeper/claim.go index 89b8827e3d..5e5126e109 100644 --- a/x/liquid/keeper/claim.go +++ b/x/liquid/keeper/claim.go @@ -16,7 +16,11 @@ func (k Keeper) CollectStakingRewards( macc := k.accountKeeper.GetModuleAccount(ctx, types.ModuleAccountName) // Ensure withdraw address is as expected - withdrawAddr := k.distributionKeeper.GetDelegatorWithdrawAddr(ctx, macc.GetAddress()) + withdrawAddr, err := k.distributionKeeper.GetDelegatorWithdrawAddr(ctx, macc.GetAddress()) + if err != nil { + return nil, err + } + if !withdrawAddr.Equals(macc.GetAddress()) { panic(fmt.Sprintf( "unexpected withdraw address for liquid staking module account, expected %s, got %s", diff --git a/x/liquid/keeper/derivative.go b/x/liquid/keeper/derivative.go index 1a752e32c1..872464d985 100644 --- a/x/liquid/keeper/derivative.go +++ b/x/liquid/keeper/derivative.go @@ -15,7 +15,11 @@ import ( // The input staking token amount is used to calculate shares in the user's delegation, which are transferred to a delegation owned by the module. // Derivative coins are them minted and transferred to the user. func (k Keeper) MintDerivative(ctx sdk.Context, delegatorAddr sdk.AccAddress, valAddr sdk.ValAddress, amount sdk.Coin) (sdk.Coin, error) { - bondDenom := k.stakingKeeper.BondDenom(ctx) + bondDenom, err := k.stakingKeeper.BondDenom(ctx) + if err != nil { + return sdk.Coin{}, err + } + if amount.Denom != bondDenom { return sdk.Coin{}, errorsmod.Wrapf(types.ErrInvalidDenom, "expected %s", bondDenom) } @@ -53,13 +57,13 @@ func (k Keeper) MintDerivative(ctx sdk.Context, delegatorAddr sdk.AccAddress, va // CalculateDerivativeSharesFromTokens converts a staking token amount into its equivalent delegation shares, and staking derivative amount. // This combines the code for calculating the shares to be transferred, and the derivative coins to be minted. -func (k Keeper) CalculateDerivativeSharesFromTokens(ctx sdk.Context, delegator sdk.AccAddress, validator sdk.ValAddress, tokens sdkmath.Int) (sdkmath.Int, sdk.Dec, error) { +func (k Keeper) CalculateDerivativeSharesFromTokens(ctx sdk.Context, delegator sdk.AccAddress, validator sdk.ValAddress, tokens sdkmath.Int) (sdkmath.Int, sdkmath.LegacyDec, error) { if !tokens.IsPositive() { - return sdkmath.Int{}, sdk.Dec{}, errorsmod.Wrap(types.ErrUntransferableShares, "token amount must be positive") + return sdkmath.Int{}, sdkmath.LegacyDec{}, errorsmod.Wrap(types.ErrUntransferableShares, "token amount must be positive") } shares, err := k.stakingKeeper.ValidateUnbondAmount(ctx, delegator, validator, tokens) if err != nil { - return sdkmath.Int{}, sdk.Dec{}, err + return sdkmath.Int{}, sdkmath.LegacyDec{}, err } return shares.TruncateInt(), shares, nil } @@ -67,21 +71,21 @@ func (k Keeper) CalculateDerivativeSharesFromTokens(ctx sdk.Context, delegator s // BurnDerivative burns an user's staking derivative coins and returns them an equivalent staking delegation. // // The derivative coins are burned, and an equivalent number of shares in the module's staking delegation are transferred back to the user. -func (k Keeper) BurnDerivative(ctx sdk.Context, delegatorAddr sdk.AccAddress, valAddr sdk.ValAddress, amount sdk.Coin) (sdk.Dec, error) { +func (k Keeper) BurnDerivative(ctx sdk.Context, delegatorAddr sdk.AccAddress, valAddr sdk.ValAddress, amount sdk.Coin) (sdkmath.LegacyDec, error) { if amount.Denom != k.GetLiquidStakingTokenDenom(valAddr) { - return sdk.Dec{}, errorsmod.Wrap(types.ErrInvalidDenom, "derivative denom does not match validator") + return sdkmath.LegacyDec{}, errorsmod.Wrap(types.ErrInvalidDenom, "derivative denom does not match validator") } if err := k.burnCoins(ctx, delegatorAddr, sdk.NewCoins(amount)); err != nil { - return sdk.Dec{}, err + return sdkmath.LegacyDec{}, err } modAcc := k.accountKeeper.GetModuleAccount(ctx, types.ModuleAccountName) - shares := sdk.NewDecFromInt(amount.Amount) + shares := sdkmath.LegacyNewDecFromInt(amount.Amount) receivedShares, err := k.TransferDelegation(ctx, valAddr, modAcc.GetAddress(), delegatorAddr, shares) if err != nil { - return sdk.Dec{}, err + return sdkmath.LegacyDec{}, err } ctx.EventManager().EmitEvent( @@ -108,14 +112,19 @@ func (k Keeper) IsDerivativeDenom(ctx sdk.Context, denom string) bool { return false } - _, found := k.stakingKeeper.GetValidator(ctx, valAddr) - return found + _, err = k.stakingKeeper.GetValidator(ctx, valAddr) + if err != nil { + return false + } + + // TODO(boodyvo): should we return error as well? + return true } // GetStakedTokensForDerivatives returns the total value of the provided derivatives // in staked tokens, accounting for the specific share prices. func (k Keeper) GetStakedTokensForDerivatives(ctx sdk.Context, coins sdk.Coins) (sdk.Coin, error) { - total := sdk.ZeroInt() + total := sdkmath.ZeroInt() for _, coin := range coins { valAddr, err := types.ParseLiquidStakingTokenDenom(coin.Denom) @@ -123,17 +132,22 @@ func (k Keeper) GetStakedTokensForDerivatives(ctx sdk.Context, coins sdk.Coins) return sdk.Coin{}, fmt.Errorf("invalid derivative denom: %w", err) } - validator, found := k.stakingKeeper.GetValidator(ctx, valAddr) - if !found { + validator, err := k.stakingKeeper.GetValidator(ctx, valAddr) + if err != nil { return sdk.Coin{}, fmt.Errorf("invalid derivative denom %s: validator not found", coin.Denom) } // bkava is 1:1 to delegation shares - valTokens := validator.TokensFromSharesTruncated(sdk.NewDecFromInt(coin.Amount)) + valTokens := validator.TokensFromSharesTruncated(sdkmath.LegacyNewDecFromInt(coin.Amount)) total = total.Add(valTokens.TruncateInt()) } - totalCoin := sdk.NewCoin(k.stakingKeeper.BondDenom(ctx), total) + bondDenom, err := k.stakingKeeper.BondDenom(ctx) + if err != nil { + return sdk.Coin{}, err + } + + totalCoin := sdk.NewCoin(bondDenom, total) return totalCoin, nil } @@ -181,7 +195,11 @@ func (k Keeper) burnCoins(ctx sdk.Context, sender sdk.AccAddress, amount sdk.Coi // DerivativeFromTokens calculates the approximate amount of derivative coins that would be minted for a given amount of staking tokens. func (k Keeper) DerivativeFromTokens(ctx sdk.Context, valAddr sdk.ValAddress, tokens sdk.Coin) (sdk.Coin, error) { - bondDenom := k.stakingKeeper.BondDenom(ctx) + bondDenom, err := k.stakingKeeper.BondDenom(ctx) + if err != nil { + return sdk.Coin{}, err + } + if tokens.Denom != bondDenom { return sdk.Coin{}, errorsmod.Wrapf(types.ErrInvalidDenom, "'%s' does not match staking denom '%s'", tokens.Denom, bondDenom) } diff --git a/x/liquid/keeper/derivative_test.go b/x/liquid/keeper/derivative_test.go index adaf74dfce..126b5d6bb6 100644 --- a/x/liquid/keeper/derivative_test.go +++ b/x/liquid/keeper/derivative_test.go @@ -96,9 +96,9 @@ func (suite *KeeperTestSuite) TestBurnDerivative() { suite.AccountBalanceEqual(user, sdk.NewCoins(tc.balance.Sub(tc.burnAmount))) suite.AccountBalanceEqual(moduleAccAddress, modBalance) // ensure derivatives are burned, and not in module account - sharesTransferred := sdk.NewDecFromInt(tc.burnAmount.Amount) + sharesTransferred := sdkmath.LegacyNewDecFromInt(tc.burnAmount.Amount) suite.DelegationSharesEqual(valAddr, user, sharesTransferred) - suite.DelegationSharesEqual(valAddr, moduleAccAddress, sdk.NewDecFromInt(tc.moduleDelegation).Sub(sharesTransferred)) + suite.DelegationSharesEqual(valAddr, moduleAccAddress, sdkmath.LegacyNewDecFromInt(tc.moduleDelegation).Sub(sharesTransferred)) suite.EventsContains(suite.Ctx.EventManager().Events(), sdk.NewEvent( types.EventTypeBurnDerivative, @@ -118,17 +118,17 @@ func (suite *KeeperTestSuite) TestCalculateShares() { type returns struct { derivatives sdkmath.Int - shares sdk.Dec + shares sdkmath.LegacyDec err error } type validator struct { tokens sdkmath.Int - delegatorShares sdk.Dec + delegatorShares sdkmath.LegacyDec } testCases := []struct { name string validator *validator - delegation sdk.Dec + delegation sdkmath.LegacyDec transfer sdkmath.Int expected returns }{ @@ -144,7 +144,7 @@ func (suite *KeeperTestSuite) TestCalculateShares() { { name: "error when delegation not found", validator: &validator{i(1e9), d("1000000000")}, - delegation: sdk.Dec{}, + delegation: sdkmath.LegacyDec{}, transfer: i(500e6), expected: returns{ err: stakingtypes.ErrNoDelegation, @@ -251,8 +251,8 @@ func (suite *KeeperTestSuite) TestMintDerivative() { name string amount sdk.Coin expectedDerivatives sdkmath.Int - expectedSharesRemaining sdk.Dec - expectedSharesAdded sdk.Dec + expectedSharesRemaining sdkmath.LegacyDec + expectedSharesAdded sdkmath.LegacyDec expectedErr error }{ { @@ -304,7 +304,7 @@ func (suite *KeeperTestSuite) TestMintDerivative() { suite.DelegationSharesEqual(valAddr, delegator, tc.expectedSharesRemaining) suite.DelegationSharesEqual(valAddr, moduleAccAddress, tc.expectedSharesAdded) - sharesTransferred := sdk.NewDecFromInt(initialBalance).Sub(tc.expectedSharesRemaining) + sharesTransferred := sdkmath.LegacyNewDecFromInt(initialBalance).Sub(tc.expectedSharesRemaining) suite.EventsContains(suite.Ctx.EventManager().Events(), sdk.NewEvent( types.EventTypeMintDerivative, sdk.NewAttribute(types.AttributeKeyDelegator, delegator.String()), diff --git a/x/liquid/keeper/grpc_query.go b/x/liquid/keeper/grpc_query.go index 3be393b41b..ba04cb71ff 100644 --- a/x/liquid/keeper/grpc_query.go +++ b/x/liquid/keeper/grpc_query.go @@ -38,10 +38,14 @@ func (s queryServer) DelegatedBalance( delegated := s.getDelegatedBalance(ctx, delegator) - bondDenom := s.keeper.stakingKeeper.BondDenom(ctx) + bondDenom, err := s.keeper.stakingKeeper.BondDenom(ctx) + if err != nil { + return nil, err + } + vesting := s.getVesting(ctx, delegator).AmountOf(bondDenom) - vestingDelegated := sdk.MinInt(vesting, delegated) + vestingDelegated := sdkmath.MinInt(vesting, delegated) vestedDelegated := delegated.Sub(vestingDelegated) res := types.QueryDelegatedBalanceResponse{ @@ -69,11 +73,11 @@ func (s queryServer) TotalSupply( } func (s queryServer) getDelegatedBalance(ctx sdk.Context, delegator sdk.AccAddress) sdkmath.Int { - balance := sdk.ZeroDec() + balance := sdkmath.LegacyZeroDec() s.keeper.stakingKeeper.IterateDelegatorDelegations(ctx, delegator, func(delegation stakingtypes.Delegation) bool { - validator, found := s.keeper.stakingKeeper.GetValidator(ctx, delegation.GetValidatorAddr()) - if !found { + validator, err := s.keeper.stakingKeeper.GetValidator(ctx, []byte(delegation.GetValidatorAddr())) + if err != nil { panic(fmt.Sprintf("validator %s for delegation not found", delegation.GetValidatorAddr())) } tokens := validator.TokensFromSharesTruncated(delegation.GetShares()) diff --git a/x/liquid/keeper/grpc_query_test.go b/x/liquid/keeper/grpc_query_test.go index 5c0b414235..1584128b9f 100644 --- a/x/liquid/keeper/grpc_query_test.go +++ b/x/liquid/keeper/grpc_query_test.go @@ -36,8 +36,8 @@ func TestGrpcQueryTestSuite(t *testing.T) { func (suite *grpcQueryTestSuite) TestQueryDelegatedBalance() { zeroResponse := &types.QueryDelegatedBalanceResponse{ - Vested: suite.NewBondCoin(sdk.ZeroInt()), - Vesting: suite.NewBondCoin(sdk.ZeroInt()), + Vested: suite.NewBondCoin(sdkmath.ZeroInt()), + Vesting: suite.NewBondCoin(sdkmath.ZeroInt()), } testCases := []struct { @@ -64,7 +64,7 @@ func (suite *grpcQueryTestSuite) TestQueryDelegatedBalance() { return delAddr.String() }, expectedRes: &types.QueryDelegatedBalanceResponse{ - Vested: suite.NewBondCoin(sdk.ZeroInt()), + Vested: suite.NewBondCoin(sdkmath.ZeroInt()), Vesting: suite.NewBondCoin(i(250e6)), }, }, @@ -124,7 +124,7 @@ func (suite *grpcQueryTestSuite) TestQueryDelegatedBalance() { }, expectedRes: &types.QueryDelegatedBalanceResponse{ Vested: suite.NewBondCoin(i(1e9)), - Vesting: suite.NewBondCoin(sdk.ZeroInt()), + Vesting: suite.NewBondCoin(sdkmath.ZeroInt()), }, }, { @@ -144,7 +144,7 @@ func (suite *grpcQueryTestSuite) TestQueryDelegatedBalance() { }, expectedRes: &types.QueryDelegatedBalanceResponse{ Vested: suite.NewBondCoin(i(500e6)), - Vesting: suite.NewBondCoin(sdk.ZeroInt()), + Vesting: suite.NewBondCoin(sdkmath.ZeroInt()), }, }, } @@ -178,7 +178,7 @@ func (suite *grpcQueryTestSuite) TestQueryTotalSupply() { { name: "no liquid kava means no tvl", setup: func() {}, - expectedTotal: sdk.ZeroInt(), + expectedTotal: sdkmath.ZeroInt(), expectedErr: nil, }, { diff --git a/x/liquid/keeper/keeper.go b/x/liquid/keeper/keeper.go index ab16723958..3a35005624 100644 --- a/x/liquid/keeper/keeper.go +++ b/x/liquid/keeper/keeper.go @@ -3,7 +3,7 @@ package keeper import ( "fmt" - "github.com/cometbft/cometbft/libs/log" + "cosmossdk.io/log" "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" diff --git a/x/liquid/keeper/keeper_test.go b/x/liquid/keeper/keeper_test.go index af60bf410d..7fa88c3faa 100644 --- a/x/liquid/keeper/keeper_test.go +++ b/x/liquid/keeper/keeper_test.go @@ -35,7 +35,7 @@ type KeeperTestSuite struct { // The default state used by each test func (suite *KeeperTestSuite) SetupTest() { tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) tApp.InitializeFromGenesisStates() @@ -47,14 +47,14 @@ func (suite *KeeperTestSuite) SetupTest() { } // CreateAccount creates a new account (with a fixed address) from the provided balance. -func (suite *KeeperTestSuite) CreateAccount(initialBalance sdk.Coins, index int) authtypes.AccountI { +func (suite *KeeperTestSuite) CreateAccount(initialBalance sdk.Coins, index int) sdk.AccountI { _, addrs := app.GeneratePrivKeyAddressPairs(index + 1) return suite.CreateAccountWithAddress(addrs[index], initialBalance) } // CreateAccount creates a new account from the provided balance and address -func (suite *KeeperTestSuite) CreateAccountWithAddress(addr sdk.AccAddress, initialBalance sdk.Coins) authtypes.AccountI { +func (suite *KeeperTestSuite) CreateAccountWithAddress(addr sdk.AccAddress, initialBalance sdk.Coins) sdk.AccountI { ak := suite.App.GetAccountKeeper() acc := ak.NewAccountWithAddress(suite.Ctx, addr) @@ -67,7 +67,7 @@ func (suite *KeeperTestSuite) CreateAccountWithAddress(addr sdk.AccAddress, init } // CreateVestingAccount creates a new vesting account. `vestingBalance` should be a fraction of `initialBalance`. -func (suite *KeeperTestSuite) CreateVestingAccountWithAddress(addr sdk.AccAddress, initialBalance sdk.Coins, vestingBalance sdk.Coins) authtypes.AccountI { +func (suite *KeeperTestSuite) CreateVestingAccountWithAddress(addr sdk.AccAddress, initialBalance sdk.Coins, vestingBalance sdk.Coins) sdk.AccountI { if vestingBalance.IsAnyGT(initialBalance) { panic("vesting balance must be less than initial balance") } @@ -103,7 +103,7 @@ func (suite *KeeperTestSuite) deliverMsgCreateValidator(ctx sdk.Context, address ed25519.GenPrivKey().PubKey(), selfDelegation, stakingtypes.Description{}, - stakingtypes.NewCommissionRates(sdk.ZeroDec(), sdk.ZeroDec(), sdk.ZeroDec()), + stakingtypes.NewCommissionRates(sdkmath.LegacyZeroDec(), sdkmath.LegacyZeroDec(), sdkmath.LegacyZeroDec()), sdkmath.NewInt(1e6), ) if err != nil { @@ -141,7 +141,7 @@ func (suite *KeeperTestSuite) CreateNewUnbondedValidator(addr sdk.ValAddress, se } // SlashValidator burns tokens staked in a validator. new_tokens = old_tokens * (1-slashFraction) -func (suite *KeeperTestSuite) SlashValidator(addr sdk.ValAddress, slashFraction sdk.Dec) { +func (suite *KeeperTestSuite) SlashValidator(addr sdk.ValAddress, slashFraction sdkmath.LegacyDec) { validator, found := suite.StakingKeeper.GetValidator(suite.Ctx, addr) suite.Require().True(found) consAddr, err := validator.GetConsAddr() @@ -157,7 +157,7 @@ func (suite *KeeperTestSuite) SlashValidator(addr sdk.ValAddress, slashFraction } // CreateDelegation delegates tokens to a validator. -func (suite *KeeperTestSuite) CreateDelegation(valAddr sdk.ValAddress, delegator sdk.AccAddress, amount sdkmath.Int) sdk.Dec { +func (suite *KeeperTestSuite) CreateDelegation(valAddr sdk.ValAddress, delegator sdk.AccAddress, amount sdkmath.Int) sdkmath.LegacyDec { stakingDenom := suite.StakingKeeper.BondDenom(suite.Ctx) msg := stakingtypes.NewMsgDelegate( delegator, @@ -204,7 +204,7 @@ func (suite *KeeperTestSuite) CreateUnbondingDelegation(delegator sdk.AccAddress // DelegationSharesEqual checks if a delegation has the specified shares. // It expects delegations with zero shares to not be stored in state. -func (suite *KeeperTestSuite) DelegationSharesEqual(valAddr sdk.ValAddress, delegator sdk.AccAddress, shares sdk.Dec) bool { +func (suite *KeeperTestSuite) DelegationSharesEqual(valAddr sdk.ValAddress, delegator sdk.AccAddress, shares sdkmath.LegacyDec) bool { del, found := suite.StakingKeeper.GetDelegation(suite.Ctx, delegator, valAddr) if shares.IsZero() { diff --git a/x/liquid/keeper/staking.go b/x/liquid/keeper/staking.go index bd453a9748..c32d7669dd 100644 --- a/x/liquid/keeper/staking.go +++ b/x/liquid/keeper/staking.go @@ -15,64 +15,75 @@ import ( // The sending delegation must not have any active redelegations. // A validator cannot reduce self delegated shares below its min self delegation. // Attempting to transfer zero shares will error. -func (k Keeper) TransferDelegation(ctx sdk.Context, valAddr sdk.ValAddress, fromDelegator, toDelegator sdk.AccAddress, shares sdk.Dec) (sdk.Dec, error) { +func (k Keeper) TransferDelegation(ctx sdk.Context, valAddr sdk.ValAddress, fromDelegator, toDelegator sdk.AccAddress, shares sdkmath.LegacyDec) (sdkmath.LegacyDec, error) { // Redelegations link a delegation to it's previous validator so slashes are propagated to the new validator. // If the delegation is transferred to a new owner, the redelegation object must be updated. // For expediency all transfers with redelegations are blocked. - if k.stakingKeeper.HasReceivingRedelegation(ctx, fromDelegator, valAddr) { - return sdk.Dec{}, types.ErrRedelegationsNotCompleted + + hasReceivingRedelegation, err := k.stakingKeeper.HasReceivingRedelegation(ctx, fromDelegator, valAddr) + if err != nil { + return sdkmath.LegacyDec{}, err + } + if hasReceivingRedelegation { + return sdkmath.LegacyDec{}, types.ErrRedelegationsNotCompleted } - if shares.IsNil() || shares.LT(sdk.ZeroDec()) { - return sdk.Dec{}, errorsmod.Wrap(types.ErrUntransferableShares, "nil or negative shares") + if shares.IsNil() || shares.LT(sdkmath.LegacyZeroDec()) { + return sdkmath.LegacyDec{}, errorsmod.Wrap(types.ErrUntransferableShares, "nil or negative shares") } - if shares.Equal(sdk.ZeroDec()) { + if shares.Equal(sdkmath.LegacyZeroDec()) { // Block 0 transfers to reduce edge cases. - return sdk.Dec{}, errorsmod.Wrap(types.ErrUntransferableShares, "zero shares") + return sdkmath.LegacyDec{}, errorsmod.Wrap(types.ErrUntransferableShares, "zero shares") } - fromDelegation, found := k.stakingKeeper.GetDelegation(ctx, fromDelegator, valAddr) - if !found { - return sdk.Dec{}, types.ErrNoDelegatorForAddress + fromDelegation, err := k.stakingKeeper.GetDelegation(ctx, fromDelegator, valAddr) + if err != nil { + return sdkmath.LegacyDec{}, types.ErrNoDelegatorForAddress } - validator, found := k.stakingKeeper.GetValidator(ctx, valAddr) - if !found { - return sdk.Dec{}, types.ErrNoValidatorFound + validator, err := k.stakingKeeper.GetValidator(ctx, valAddr) + if err != nil { + return sdkmath.LegacyDec{}, types.ErrNoValidatorFound } // Prevent validators from reducing their self delegation below the min. isValidatorOperator := fromDelegator.Equals(valAddr) if isValidatorOperator { if isBelowMinSelfDelegation(validator, fromDelegation.Shares.Sub(shares)) { - return sdk.Dec{}, types.ErrSelfDelegationBelowMinimum + return sdkmath.LegacyDec{}, types.ErrSelfDelegationBelowMinimum } } returnAmount, err := k.fastUndelegate(ctx, valAddr, fromDelegator, shares) if err != nil { - return sdk.Dec{}, err + return sdkmath.LegacyDec{}, err + } + + bondDenom, err := k.stakingKeeper.BondDenom(ctx) + if err != nil { + return sdkmath.LegacyDec{}, err } - returnCoins := sdk.NewCoins(sdk.NewCoin(k.stakingKeeper.BondDenom(ctx), returnAmount)) + + returnCoins := sdk.NewCoins(sdk.NewCoin(bondDenom, returnAmount)) if err := k.bankKeeper.SendCoins(ctx, fromDelegator, toDelegator, returnCoins); err != nil { - return sdk.Dec{}, err + return sdkmath.LegacyDec{}, err } receivedShares, err := k.delegateFromAccount(ctx, valAddr, toDelegator, returnAmount) if err != nil { - return sdk.Dec{}, err + return sdkmath.LegacyDec{}, err } return receivedShares, nil } // isBelowMinSelfDelegation check if the supplied shares, converted to tokens, are under the validator's min_self_delegation. -func isBelowMinSelfDelegation(validator stakingtypes.ValidatorI, shares sdk.Dec) bool { +func isBelowMinSelfDelegation(validator stakingtypes.ValidatorI, shares sdkmath.LegacyDec) bool { return validator.TokensFromShares(shares).TruncateInt().LT(validator.GetMinSelfDelegation()) } // fastUndelegate undelegates shares from a validator skipping the unbonding period and not creating any unbonding delegations. -func (k Keeper) fastUndelegate(ctx sdk.Context, valAddr sdk.ValAddress, delegator sdk.AccAddress, shares sdk.Dec) (sdkmath.Int, error) { - validator, found := k.stakingKeeper.GetValidator(ctx, valAddr) - if !found { +func (k Keeper) fastUndelegate(ctx sdk.Context, valAddr sdk.ValAddress, delegator sdk.AccAddress, shares sdkmath.LegacyDec) (sdkmath.Int, error) { + validator, err := k.stakingKeeper.GetValidator(ctx, valAddr) + if err != nil { return sdkmath.Int{}, types.ErrNoDelegatorForAddress } @@ -80,7 +91,13 @@ func (k Keeper) fastUndelegate(ctx sdk.Context, valAddr sdk.ValAddress, delegato if err != nil { return sdkmath.Int{}, err } - returnCoins := sdk.NewCoins(sdk.NewCoin(k.stakingKeeper.BondDenom(ctx), returnAmount)) + + bondDenom, err := k.stakingKeeper.BondDenom(ctx) + if err != nil { + return sdkmath.Int{}, err + } + + returnCoins := sdk.NewCoins(sdk.NewCoin(bondDenom, returnAmount)) // transfer the validator tokens to the not bonded pool if validator.IsBonded() { @@ -96,15 +113,15 @@ func (k Keeper) fastUndelegate(ctx sdk.Context, valAddr sdk.ValAddress, delegato } // delegateFromAccount delegates to a validator from an account (vs redelegating from an existing delegation) -func (k Keeper) delegateFromAccount(ctx sdk.Context, valAddr sdk.ValAddress, delegator sdk.AccAddress, amount sdkmath.Int) (sdk.Dec, error) { - validator, found := k.stakingKeeper.GetValidator(ctx, valAddr) - if !found { - return sdk.Dec{}, types.ErrNoValidatorFound +func (k Keeper) delegateFromAccount(ctx sdk.Context, valAddr sdk.ValAddress, delegator sdk.AccAddress, amount sdkmath.Int) (sdkmath.LegacyDec, error) { + validator, err := k.stakingKeeper.GetValidator(ctx, valAddr) + if err != nil { + return sdkmath.LegacyDec{}, types.ErrNoValidatorFound } // source tokens are from an account, so subtractAccount true and tokenSrc unbonded newShares, err := k.stakingKeeper.Delegate(ctx, delegator, amount, stakingtypes.Unbonded, validator, true) if err != nil { - return sdk.Dec{}, err + return sdkmath.LegacyDec{}, err } return newShares, nil } diff --git a/x/liquid/keeper/staking_test.go b/x/liquid/keeper/staking_test.go index 430858ad8d..98742b780b 100644 --- a/x/liquid/keeper/staking_test.go +++ b/x/liquid/keeper/staking_test.go @@ -15,8 +15,8 @@ import ( ) var ( - // d is an alias for sdk.MustNewDecFromStr - d = sdk.MustNewDecFromStr + // d is an alias for sdkmath.LegacyMustNewDecFromStr + d = sdkmath.LegacyMustNewDecFromStr // i is an alias for sdkmath.NewInt i = sdkmath.NewInt // c is an alias for sdk.NewInt64Coin @@ -35,11 +35,11 @@ func (suite *KeeperTestSuite) TestTransferDelegation_ValidatorStates() { testCases := []struct { name string - createValidator func() (delegatorShares sdk.Dec, err error) + createValidator func() (delegatorShares sdkmath.LegacyDec, err error) }{ { name: "bonded validator", - createValidator: func() (sdk.Dec, error) { + createValidator: func() (sdkmath.LegacyDec, error) { suite.CreateNewUnbondedValidator(valAddr, initialBalance) delegatorShares := suite.CreateDelegation(valAddr, fromDelegator, i(1e9)) @@ -51,7 +51,7 @@ func (suite *KeeperTestSuite) TestTransferDelegation_ValidatorStates() { }, { name: "unbonded validator", - createValidator: func() (sdk.Dec, error) { + createValidator: func() (sdkmath.LegacyDec, error) { suite.CreateNewUnbondedValidator(valAddr, initialBalance) delegatorShares := suite.CreateDelegation(valAddr, fromDelegator, i(1e9)) @@ -61,7 +61,7 @@ func (suite *KeeperTestSuite) TestTransferDelegation_ValidatorStates() { }, { name: "ubonding (jailed) validator", - createValidator: func() (sdk.Dec, error) { + createValidator: func() (sdkmath.LegacyDec, error) { val := suite.CreateNewUnbondedValidator(valAddr, initialBalance) delegatorShares := suite.CreateDelegation(valAddr, fromDelegator, i(1e9)) @@ -71,7 +71,7 @@ func (suite *KeeperTestSuite) TestTransferDelegation_ValidatorStates() { // Jail and run end blocker to transition validator to unbonding. consAddr, err := val.GetConsAddr() if err != nil { - return sdk.Dec{}, err + return sdkmath.LegacyDec{}, err } suite.StakingKeeper.Jail(suite.Ctx, consAddr) staking.EndBlocker(suite.Ctx, suite.StakingKeeper) @@ -127,39 +127,39 @@ func (suite *KeeperTestSuite) TestTransferDelegation_Shares() { testCases := []struct { name string - createDelegations func() (fromDelegatorShares, toDelegatorShares sdk.Dec, err error) - shares sdk.Dec - expectReceived sdk.Dec + createDelegations func() (fromDelegatorShares, toDelegatorShares sdkmath.LegacyDec, err error) + shares sdkmath.LegacyDec + expectReceived sdkmath.LegacyDec expectedErr error }{ { name: "negative shares cannot be transferred", - createDelegations: func() (sdk.Dec, sdk.Dec, error) { + createDelegations: func() (sdkmath.LegacyDec, sdkmath.LegacyDec, error) { suite.CreateNewUnbondedValidator(valAddr, i(1e9)) fromDelegationShares := suite.CreateDelegation(valAddr, fromDelegator, i(1e9)) // Run end blocker to update validator state to bonded. staking.EndBlocker(suite.Ctx, suite.StakingKeeper) - return fromDelegationShares, sdk.ZeroDec(), nil + return fromDelegationShares, sdkmath.LegacyZeroDec(), nil }, shares: d("-1.0"), expectedErr: types.ErrUntransferableShares, }, { name: "nil shares cannot be transferred", - createDelegations: func() (sdk.Dec, sdk.Dec, error) { + createDelegations: func() (sdkmath.LegacyDec, sdkmath.LegacyDec, error) { suite.CreateNewUnbondedValidator(valAddr, i(1e9)) fromDelegationShares := suite.CreateDelegation(valAddr, fromDelegator, i(1e9)) staking.EndBlocker(suite.Ctx, suite.StakingKeeper) - return fromDelegationShares, sdk.ZeroDec(), nil + return fromDelegationShares, sdkmath.LegacyZeroDec(), nil }, - shares: sdk.Dec{}, + shares: sdkmath.LegacyDec{}, expectedErr: types.ErrUntransferableShares, }, { name: "0 shares cannot be transferred", - createDelegations: func() (sdk.Dec, sdk.Dec, error) { + createDelegations: func() (sdkmath.LegacyDec, sdkmath.LegacyDec, error) { suite.CreateNewUnbondedValidator(valAddr, i(1e9)) fromDelegationShares := suite.CreateDelegation(valAddr, fromDelegator, i(1e9)) toDelegationShares := suite.CreateDelegation(valAddr, toDelegator, i(2e9)) @@ -167,12 +167,12 @@ func (suite *KeeperTestSuite) TestTransferDelegation_Shares() { return fromDelegationShares, toDelegationShares, nil }, - shares: sdk.ZeroDec(), + shares: sdkmath.LegacyZeroDec(), expectedErr: types.ErrUntransferableShares, }, { name: "all shares can be transferred", - createDelegations: func() (sdk.Dec, sdk.Dec, error) { + createDelegations: func() (sdkmath.LegacyDec, sdkmath.LegacyDec, error) { suite.CreateNewUnbondedValidator(valAddr, i(1e9)) fromDelegationShares := suite.CreateDelegation(valAddr, fromDelegator, i(1e9)) toDelegationShares := suite.CreateDelegation(valAddr, toDelegator, i(2e9)) @@ -185,56 +185,56 @@ func (suite *KeeperTestSuite) TestTransferDelegation_Shares() { }, { name: "excess shares cannot be transferred", - createDelegations: func() (sdk.Dec, sdk.Dec, error) { + createDelegations: func() (sdkmath.LegacyDec, sdkmath.LegacyDec, error) { suite.CreateNewUnbondedValidator(valAddr, i(1e9)) fromDelegationShares := suite.CreateDelegation(valAddr, fromDelegator, i(1e9)) staking.EndBlocker(suite.Ctx, suite.StakingKeeper) - return fromDelegationShares, sdk.ZeroDec(), nil + return fromDelegationShares, sdkmath.LegacyZeroDec(), nil }, shares: d("1000000000.000000000000000001"), expectedErr: stakingtypes.ErrNotEnoughDelegationShares, }, { name: "shares can be transferred to a non existent delegation", - createDelegations: func() (sdk.Dec, sdk.Dec, error) { + createDelegations: func() (sdkmath.LegacyDec, sdkmath.LegacyDec, error) { suite.CreateNewUnbondedValidator(valAddr, i(1e9)) fromDelegationShares := suite.CreateDelegation(valAddr, fromDelegator, i(1e9)) staking.EndBlocker(suite.Ctx, suite.StakingKeeper) - return fromDelegationShares, sdk.ZeroDec(), nil + return fromDelegationShares, sdkmath.LegacyZeroDec(), nil }, shares: d("500000000.0"), expectReceived: d("500000000.0"), }, { name: "shares cannot be transferred from a non existent delegation", - createDelegations: func() (sdk.Dec, sdk.Dec, error) { + createDelegations: func() (sdkmath.LegacyDec, sdkmath.LegacyDec, error) { suite.CreateNewUnbondedValidator(valAddr, i(1e9)) staking.EndBlocker(suite.Ctx, suite.StakingKeeper) - return sdk.ZeroDec(), sdk.ZeroDec(), nil + return sdkmath.LegacyZeroDec(), sdkmath.LegacyZeroDec(), nil }, shares: d("500000000.0"), expectedErr: types.ErrNoDelegatorForAddress, }, { name: "slashed validator shares can be transferred", - createDelegations: func() (sdk.Dec, sdk.Dec, error) { + createDelegations: func() (sdkmath.LegacyDec, sdkmath.LegacyDec, error) { suite.CreateNewUnbondedValidator(valAddr, i(1e9)) fromDelegationShares := suite.CreateDelegation(valAddr, fromDelegator, i(1e9)) staking.EndBlocker(suite.Ctx, suite.StakingKeeper) suite.SlashValidator(valAddr, d("0.05")) - return fromDelegationShares, sdk.ZeroDec(), nil + return fromDelegationShares, sdkmath.LegacyZeroDec(), nil }, shares: d("500000000.0"), expectReceived: d("500000000.0"), }, { name: "zero shares received when transfer < 1 token", - createDelegations: func() (sdk.Dec, sdk.Dec, error) { + createDelegations: func() (sdkmath.LegacyDec, sdkmath.LegacyDec, error) { suite.CreateNewUnbondedValidator(valAddr, i(1e9)) fromDelegationShares := suite.CreateDelegation(valAddr, fromDelegator, i(1e9)) toDelegationShares := suite.CreateDelegation(valAddr, toDelegator, i(1e9)) @@ -310,7 +310,7 @@ func (suite *KeeperTestSuite) TestTransferDelegation_RedelegationsForbidden() { _, err := suite.Keeper.TransferDelegation(suite.Ctx, val2Addr, fromDelegator, toDelegator, fromDelegationShares) suite.ErrorIs(err, types.ErrRedelegationsNotCompleted) suite.DelegationSharesEqual(val2Addr, fromDelegator, fromDelegationShares) - suite.DelegationSharesEqual(val2Addr, toDelegator, sdk.ZeroDec()) + suite.DelegationSharesEqual(val2Addr, toDelegator, sdkmath.LegacyZeroDec()) } func (suite *KeeperTestSuite) TestTransferDelegation_CompliesWithMinSelfDelegation() { @@ -328,7 +328,7 @@ func (suite *KeeperTestSuite) TestTransferDelegation_CompliesWithMinSelfDelegati ed25519.GenPrivKey().PubKey(), delegation, stakingtypes.Description{}, - stakingtypes.NewCommissionRates(sdk.ZeroDec(), sdk.ZeroDec(), sdk.ZeroDec()), + stakingtypes.NewCommissionRates(sdkmath.LegacyZeroDec(), sdkmath.LegacyZeroDec(), sdkmath.LegacyZeroDec()), minSelfDelegation, ) suite.Require().NoError(err) @@ -340,7 +340,7 @@ func (suite *KeeperTestSuite) TestTransferDelegation_CompliesWithMinSelfDelegati _, err = suite.Keeper.TransferDelegation(suite.Ctx, valAddr, valAccAddr, toDelegator, d("0.000000000000000001")) suite.ErrorIs(err, types.ErrSelfDelegationBelowMinimum) - suite.DelegationSharesEqual(valAddr, valAccAddr, sdk.NewDecFromInt(delegation.Amount)) + suite.DelegationSharesEqual(valAddr, valAccAddr, sdkmath.LegacyNewDecFromInt(delegation.Amount)) } func (suite *KeeperTestSuite) TestTransferDelegation_CanTransferVested() { diff --git a/x/liquid/module.go b/x/liquid/module.go index 6363920165..55df1a4e56 100644 --- a/x/liquid/module.go +++ b/x/liquid/module.go @@ -2,6 +2,7 @@ package liquid import ( "context" + "cosmossdk.io/core/appmodule" "encoding/json" "github.com/grpc-ecosystem/grpc-gateway/runtime" @@ -21,8 +22,13 @@ import ( ) var ( - _ module.AppModule = AppModule{} + _ appmodule.AppModule = AppModule{} _ module.AppModuleBasic = AppModuleBasic{} + + _ appmodule.AppModule = (*AppModule)(nil) + _ appmodule.HasBeginBlocker = (*AppModule)(nil) + // TODO(boodyvo): should we put it here? Looks like it is different interface + //_ appmodule.HasEndBlocker = (*AppModule)(nil) ) // AppModuleBasic app module basics object @@ -117,9 +123,15 @@ func (am AppModule) ExportGenesis(_ sdk.Context, cdc codec.JSONCodec) json.RawMe } // BeginBlock module begin-block -func (am AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) {} +func (am AppModule) BeginBlock(ctx context.Context) error { + return nil +} // EndBlock module end-block -func (am AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { - return []abci.ValidatorUpdate{} +func (am AppModule) EndBlock(_ context.Context) ([]abci.ValidatorUpdate, error) { + return []abci.ValidatorUpdate{}, nil } + +func (AppModule) IsOnePerModuleType() {} + +func (AppModule) IsAppModule() {} diff --git a/x/liquid/types/codec.go b/x/liquid/types/codec.go index adaea1921f..b3de9dfb28 100644 --- a/x/liquid/types/codec.go +++ b/x/liquid/types/codec.go @@ -6,7 +6,6 @@ import ( cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/msgservice" - authzcodec "github.com/cosmos/cosmos-sdk/x/authz/codec" ) // RegisterLegacyAminoCodec registers all the necessary types and interfaces for the module. @@ -37,5 +36,5 @@ func init() { // Register all Amino interfaces and concrete types on the authz Amino codec so that this can later be // used to properly serialize MsgGrant and MsgExec instances - RegisterLegacyAminoCodec(authzcodec.Amino) + RegisterLegacyAminoCodec(codec.NewLegacyAmino()) } diff --git a/x/liquid/types/expected_keepers.go b/x/liquid/types/expected_keepers.go index 3c059d59fa..7651dd97e0 100644 --- a/x/liquid/types/expected_keepers.go +++ b/x/liquid/types/expected_keepers.go @@ -1,57 +1,57 @@ package types import ( + "context" sdkmath "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" ) // BankKeeper defines the expected bank keeper type BankKeeper interface { - SendCoinsFromModuleToModule(ctx sdk.Context, senderModule, recipientModule string, amt sdk.Coins) error - SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error - SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error - SendCoins(ctx sdk.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Coins) error + SendCoinsFromModuleToModule(ctx context.Context, senderModule, recipientModule string, amt sdk.Coins) error + SendCoinsFromAccountToModule(ctx context.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error + SendCoinsFromModuleToAccount(ctx context.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error + SendCoins(ctx context.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Coins) error - MintCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error - BurnCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error - UndelegateCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error + MintCoins(ctx context.Context, moduleName string, amt sdk.Coins) error + BurnCoins(ctx context.Context, moduleName string, amt sdk.Coins) error + UndelegateCoinsFromModuleToAccount(ctx context.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error - IterateTotalSupply(ctx sdk.Context, cb func(sdk.Coin) bool) - GetSupply(ctx sdk.Context, denom string) sdk.Coin + IterateTotalSupply(ctx context.Context, cb func(sdk.Coin) bool) + GetSupply(ctx context.Context, denom string) sdk.Coin } // AccountKeeper defines the expected keeper interface for interacting with account type AccountKeeper interface { GetModuleAddress(moduleName string) sdk.AccAddress - GetModuleAccount(ctx sdk.Context, name string) authtypes.ModuleAccountI - GetAccount(ctx sdk.Context, addr sdk.AccAddress) authtypes.AccountI + GetModuleAccount(ctx context.Context, name string) sdk.ModuleAccountI + GetAccount(ctx context.Context, addr sdk.AccAddress) sdk.AccountI } // StakingKeeper defines the expected keeper interface for interacting with staking type StakingKeeper interface { - BondDenom(ctx sdk.Context) (res string) + BondDenom(ctx context.Context) (res string, err error) - GetValidator(ctx sdk.Context, addr sdk.ValAddress) (validator stakingtypes.Validator, found bool) - GetDelegation(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) (delegation stakingtypes.Delegation, found bool) - IterateDelegatorDelegations(ctx sdk.Context, delegator sdk.AccAddress, cb func(delegation stakingtypes.Delegation) (stop bool)) - HasReceivingRedelegation(ctx sdk.Context, delAddr sdk.AccAddress, valDstAddr sdk.ValAddress) bool + GetValidator(ctx context.Context, addr sdk.ValAddress) (validator stakingtypes.Validator, err error) + GetDelegation(ctx context.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) (delegation stakingtypes.Delegation, err error) + IterateDelegatorDelegations(ctx context.Context, delegator sdk.AccAddress, cb func(delegation stakingtypes.Delegation) (stop bool)) error + HasReceivingRedelegation(ctx context.Context, delAddr sdk.AccAddress, valDstAddr sdk.ValAddress) (bool, error) ValidateUnbondAmount( - ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress, amt sdkmath.Int, - ) (shares sdk.Dec, err error) + ctx context.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress, amt sdkmath.Int, + ) (shares sdkmath.LegacyDec, err error) Delegate( - ctx sdk.Context, delAddr sdk.AccAddress, bondAmt sdkmath.Int, tokenSrc stakingtypes.BondStatus, + ctx context.Context, delAddr sdk.AccAddress, bondAmt sdkmath.Int, tokenSrc stakingtypes.BondStatus, validator stakingtypes.Validator, subtractAccount bool, - ) (newShares sdk.Dec, err error) + ) (newShares sdkmath.LegacyDec, err error) Unbond( - ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress, shares sdk.Dec, + ctx context.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress, shares sdkmath.LegacyDec, ) (amount sdkmath.Int, err error) } type DistributionKeeper interface { - GetDelegatorWithdrawAddr(ctx sdk.Context, delAddr sdk.AccAddress) sdk.AccAddress - WithdrawDelegationRewards(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) (sdk.Coins, error) + GetDelegatorWithdrawAddr(ctx context.Context, delAddr sdk.AccAddress) (sdk.AccAddress, error) + WithdrawDelegationRewards(ctx context.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) (sdk.Coins, error) } diff --git a/x/liquid/types/query.pb.go b/x/liquid/types/query.pb.go index f771eb3b97..923313263d 100644 --- a/x/liquid/types/query.pb.go +++ b/x/liquid/types/query.pb.go @@ -340,6 +340,7 @@ func _Query_TotalSupply_Handler(srv interface{}, ctx context.Context, dec func(i return interceptor(ctx, in, info, handler) } +var Query_serviceDesc = _Query_serviceDesc var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "kava.liquid.v1beta1.Query", HandlerType: (*QueryServer)(nil), diff --git a/x/liquid/types/tx.pb.go b/x/liquid/types/tx.pb.go index 1fde9ebaae..559c601272 100644 --- a/x/liquid/types/tx.pb.go +++ b/x/liquid/types/tx.pb.go @@ -5,9 +5,9 @@ package types import ( context "context" + cosmossdk_io_math "cosmossdk.io/math" fmt "fmt" _ "github.com/cosmos/cosmos-proto" - github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" @@ -208,7 +208,7 @@ func (m *MsgBurnDerivative) GetAmount() types.Coin { // MsgBurnDerivativeResponse defines the Msg/BurnDerivative response type. type MsgBurnDerivativeResponse struct { // received is the number of delegation shares sent to the sender - Received github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,1,opt,name=received,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"received"` + Received cosmossdk_io_math.LegacyDec `protobuf:"bytes,1,opt,name=received,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"received"` } func (m *MsgBurnDerivativeResponse) Reset() { *m = MsgBurnDerivativeResponse{} } @@ -254,34 +254,34 @@ func init() { func init() { proto.RegisterFile("kava/liquid/v1beta1/tx.proto", fileDescriptor_738981106e50f269) } var fileDescriptor_738981106e50f269 = []byte{ - // 421 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x53, 0xbd, 0xae, 0xda, 0x30, - 0x14, 0x8e, 0x7b, 0x2b, 0x54, 0x5c, 0xe9, 0x4a, 0x4d, 0xef, 0x10, 0xd0, 0x55, 0x40, 0x0c, 0x88, - 0x25, 0x4e, 0xa1, 0x43, 0x87, 0x76, 0x69, 0xca, 0xca, 0x92, 0x2e, 0xa8, 0x4b, 0xe5, 0x24, 0x56, - 0xb0, 0x00, 0x9b, 0xda, 0x4e, 0x44, 0xdf, 0xa2, 0x0f, 0xd0, 0xc7, 0xe0, 0x21, 0x18, 0x11, 0x53, - 0xdb, 0x01, 0x55, 0xf0, 0x22, 0x55, 0x12, 0x13, 0xca, 0x9f, 0xc4, 0x78, 0x27, 0xdb, 0xe7, 0x3b, - 0xdf, 0xf1, 0xf9, 0xbe, 0x63, 0xc3, 0xc7, 0x31, 0x4e, 0xb1, 0x3b, 0xa1, 0xdf, 0x12, 0x1a, 0xb9, - 0x69, 0x37, 0x20, 0x0a, 0x77, 0x5d, 0x35, 0x47, 0x33, 0xc1, 0x15, 0x37, 0x5f, 0x67, 0x28, 0x2a, - 0x50, 0xa4, 0xd1, 0xba, 0x1d, 0x72, 0x39, 0xe5, 0xd2, 0x0d, 0xb0, 0x24, 0x25, 0x25, 0xe4, 0x94, - 0x15, 0xa4, 0x7a, 0xad, 0xc0, 0xbf, 0xe6, 0x27, 0xb7, 0x38, 0x68, 0xe8, 0x21, 0xe6, 0x31, 0x2f, - 0xe2, 0xd9, 0xae, 0x88, 0xb6, 0x7e, 0x02, 0xf8, 0x6a, 0x20, 0xe3, 0x01, 0x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68, 0xa3, 0x0b, 0xef, 0x11, 0x9d, 0x0d, 0xa7, 0x8e, 0x6e, 0xcb, 0x2b, 0xb5, 0x8c, 0xe0, 0xfd, - 0xc9, 0x0c, 0xae, 0xde, 0x74, 0x9c, 0x77, 0xfd, 0xa6, 0xcb, 0xae, 0x79, 0xde, 0x72, 0x6b, 0x83, - 0xd5, 0xd6, 0x06, 0x7f, 0xb7, 0x36, 0xf8, 0xb1, 0xb3, 0x8d, 0xd5, 0xce, 0x36, 0x7e, 0xed, 0x6c, - 0xe3, 0x4b, 0xe7, 0x3f, 0xd7, 0xb2, 0x9a, 0xce, 0x04, 0x07, 0x32, 0xdf, 0xb9, 0xf3, 0xfd, 0xff, - 0xcc, 0xbd, 0x0b, 0x2a, 0xf9, 0xaf, 0x79, 0xfb, 0x2f, 0x00, 0x00, 0xff, 0xff, 0x40, 0x82, 0xe3, - 0xbf, 0xbb, 0x03, 0x00, 0x00, + // 426 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x53, 0xbd, 0x6e, 0xdb, 0x30, + 0x10, 0x16, 0x9b, 0xc2, 0xa8, 0x59, 0x20, 0x40, 0xd5, 0x0c, 0xb2, 0x1b, 0x28, 0x41, 0x86, 0xc2, + 0x8b, 0xc9, 0x3a, 0x1d, 0x3a, 0x74, 0xaa, 0xea, 0xb1, 0x5a, 0xd4, 0xa5, 0xe8, 0x52, 0x50, 0xd2, + 0x41, 0x62, 0x63, 0x91, 0x2e, 0x49, 0x09, 0xc9, 0x5b, 0xf4, 0x01, 0xfa, 0x18, 0x79, 0x88, 0x8c, + 0x41, 0xa6, 0xb6, 0x83, 0x51, 0xd8, 0x2f, 0x52, 0xe8, 0xc7, 0x32, 0xfc, 0x07, 0x78, 0xcc, 0x46, + 0xde, 0x77, 0xdf, 0x77, 0xf7, 0x1d, 0x79, 0xf8, 0xf4, 0x8a, 0x15, 0x8c, 0x4e, 0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0xa3, 0xf1, 0xef, 0x95, 0xf1, 0xf5, 0xee, 0x5a, 0xe3, 0xfe, 0x86, 0xf1, 0xae, + 0x37, 0x2a, 0xc9, 0x7f, 0x67, 0x67, 0xaf, 0x6a, 0x79, 0x1d, 0x5f, 0x11, 0x2e, 0x69, 0xc6, 0x4c, + 0x4a, 0x3e, 0x41, 0xc2, 0xa2, 0x9b, 0x31, 0x44, 0x0f, 0xb7, 0x43, 0xdc, 0x54, 0x1f, 0x43, 0xb4, + 0x1a, 0xc5, 0xe5, 0x1f, 0x84, 0x8f, 0x7c, 0x9d, 0xd8, 0x29, 0x3e, 0xde, 0xf8, 0x07, 0xaf, 0xc9, + 0x8e, 0x4f, 0x48, 0xb6, 0x5e, 0xa4, 0x4f, 0x0e, 0xcb, 0x6b, 0x0d, 0xa4, 0xf8, 0x78, 0x63, 0xf0, + 0x7b, 0x2b, 0xad, 0xe7, 0xed, 0xaf, 0xb4, 0x7b, 0x54, 0x9e, 0x77, 0x37, 0x77, 0xd1, 0xfd, 0xdc, + 0x45, 0xff, 0xe6, 0x2e, 0xfa, 0xb9, 0x70, 0xad, 0xfb, 0x85, 0x6b, 0xfd, 0x5e, 0xb8, 0xd6, 0xd7, + 0x41, 0xc2, 0x4d, 0x9a, 0x87, 0x24, 0x92, 0x19, 0x2d, 0x35, 0x87, 0x13, 0x16, 0xea, 0xea, 0x44, + 0xaf, 0x97, 0x4b, 0x69, 0x6e, 0xa6, 0xa0, 0xc3, 0x4e, 0xb5, 0x2a, 0x6f, 0xff, 0x07, 0x00, 0x00, + 0xff, 0xff, 0x88, 0xe9, 0x05, 0xc2, 0xb0, 0x03, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -387,6 +387,7 @@ func _Msg_BurnDerivative_Handler(srv interface{}, ctx context.Context, dec func( return interceptor(ctx, in, info, handler) } +var Msg_serviceDesc = _Msg_serviceDesc var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "kava.liquid.v1beta1.Msg", HandlerType: (*MsgServer)(nil), diff --git a/x/metrics/abci_test.go b/x/metrics/abci_test.go index 141d501bee..c8c89d95fa 100644 --- a/x/metrics/abci_test.go +++ b/x/metrics/abci_test.go @@ -25,7 +25,7 @@ func (*MockGauge) Add(_ float64) {} func ctxWithHeight(height int64) sdk.Context { tApp := app.NewTestApp() tApp.InitializeFromGenesisStates() - return tApp.NewContext(false, tmproto.Header{Height: height}) + return tApp.NewContextLegacy(false, tmproto.Header{Height: height}) } func TestBeginBlockEmitsLatestHeight(t *testing.T) { diff --git a/x/metrics/module.go b/x/metrics/module.go index 2ee0d65680..dea9c53414 100644 --- a/x/metrics/module.go +++ b/x/metrics/module.go @@ -101,11 +101,17 @@ func (am AppModule) ExportGenesis(_ sdk.Context, cdc codec.JSONCodec) json.RawMe } // BeginBlock module begin-block -func (am AppModule) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock) { +func (am AppModule) BeginBlock(ctx sdk.Context) error { BeginBlocker(ctx, am.metrics) + + return nil } // EndBlock module end-block -func (am AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { - return []abci.ValidatorUpdate{} +func (am AppModule) EndBlock(_ sdk.Context) ([]abci.ValidatorUpdate, error) { + return []abci.ValidatorUpdate{}, nil } + +func (AppModule) IsOnePerModuleType() {} + +func (AppModule) IsAppModule() {} diff --git a/x/precisebank/keeper/burn.go b/x/precisebank/keeper/burn.go index a190659ccd..e526659213 100644 --- a/x/precisebank/keeper/burn.go +++ b/x/precisebank/keeper/burn.go @@ -1,6 +1,7 @@ package keeper import ( + "context" "fmt" errorsmod "cosmossdk.io/errors" @@ -14,15 +15,17 @@ import ( // BurnCoins burns coins deletes coins from the balance of the module account. // It will panic if the module account does not exist or is unauthorized. -func (k Keeper) BurnCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error { +func (k Keeper) BurnCoins(ctx context.Context, moduleName string, amt sdk.Coins) error { // Custom protection for x/precisebank, no external module should be able to // affect reserves. if moduleName == types.ModuleName { panic(errorsmod.Wrapf(sdkerrors.ErrUnauthorized, "module account %s cannot be burned from", moduleName)) } + sdkCtx := sdk.UnwrapSDKContext(ctx) + // Panic errors are identical to x/bank for consistency. - acc := k.ak.GetModuleAccount(ctx, moduleName) + acc := k.ak.GetModuleAccount(sdkCtx, moduleName) if acc == nil { panic(errorsmod.Wrapf(sdkerrors.ErrUnknownAddress, "module account %s does not exist", moduleName)) } @@ -48,14 +51,14 @@ func (k Keeper) BurnCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) err // Coins unmanaged by x/precisebank are passed through to x/bank if !passthroughCoins.Empty() { - if err := k.bk.BurnCoins(ctx, moduleName, passthroughCoins); err != nil { + if err := k.bk.BurnCoins(sdkCtx, moduleName, passthroughCoins); err != nil { return err } } // Only burn extended coin if the amount is positive if extendedAmount.IsPositive() { - if err := k.burnExtendedCoin(ctx, moduleName, extendedAmount); err != nil { + if err := k.burnExtendedCoin(sdkCtx, moduleName, extendedAmount); err != nil { return err } } @@ -65,7 +68,7 @@ func (k Keeper) BurnCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) err return nil } - ctx.EventManager().EmitEvents(sdk.Events{ + sdkCtx.EventManager().EmitEvents(sdk.Events{ banktypes.NewCoinBurnEvent(acc.GetAddress(), fullEmissionCoins), banktypes.NewCoinSpentEvent(acc.GetAddress(), fullEmissionCoins), }) diff --git a/x/precisebank/keeper/burn_integration_test.go b/x/precisebank/keeper/burn_integration_test.go index 042fdbfae3..b5361844d5 100644 --- a/x/precisebank/keeper/burn_integration_test.go +++ b/x/precisebank/keeper/burn_integration_test.go @@ -8,7 +8,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - ibctransfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" + ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" "github.com/kava-labs/kava/x/precisebank/keeper" "github.com/kava-labs/kava/x/precisebank/testutil" "github.com/kava-labs/kava/x/precisebank/types" diff --git a/x/precisebank/keeper/burn_test.go b/x/precisebank/keeper/burn_test.go index 98cd49bfa9..fa1b52cc40 100644 --- a/x/precisebank/keeper/burn_test.go +++ b/x/precisebank/keeper/burn_test.go @@ -134,7 +134,7 @@ func TestBurnCoins_Errors(t *testing.T) { }, sdk.Coins{sdk.Coin{ Denom: "ukava", - Amount: sdk.NewInt(-1000), + Amount: sdkmath.NewInt(-1000), }}, "-1000ukava: invalid coins", }, diff --git a/x/precisebank/keeper/fractional_balance.go b/x/precisebank/keeper/fractional_balance.go index 7f2c20c811..2fea1efa45 100644 --- a/x/precisebank/keeper/fractional_balance.go +++ b/x/precisebank/keeper/fractional_balance.go @@ -5,7 +5,7 @@ import ( "fmt" sdkmath "cosmossdk.io/math" - "github.com/cosmos/cosmos-sdk/store/prefix" + "cosmossdk.io/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/kava-labs/kava/x/precisebank/types" diff --git a/x/precisebank/keeper/fractional_balance_test.go b/x/precisebank/keeper/fractional_balance_test.go index be733ea4d7..2280f6abb4 100644 --- a/x/precisebank/keeper/fractional_balance_test.go +++ b/x/precisebank/keeper/fractional_balance_test.go @@ -4,7 +4,7 @@ import ( "testing" sdkmath "cosmossdk.io/math" - "github.com/cosmos/cosmos-sdk/store/prefix" + "cosmossdk.io/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" diff --git a/x/precisebank/keeper/invariants_integration_test.go b/x/precisebank/keeper/invariants_integration_test.go index 9974035558..b555ce453d 100644 --- a/x/precisebank/keeper/invariants_integration_test.go +++ b/x/precisebank/keeper/invariants_integration_test.go @@ -48,7 +48,7 @@ func (suite *invariantsIntegrationTestSuite) TestReserveBackingFractionalInvaria k.SetFractionalBalance(ctx, sdk.AccAddress{1}, types.ConversionFactor().QuoRaw(2)) k.SetFractionalBalance(ctx, sdk.AccAddress{2}, types.ConversionFactor().QuoRaw(2)) // 1 integer backs same amount fractional - suite.FundReserve(sdk.NewInt(1)) + suite.FundReserve(sdkmath.NewInt(1)) }, false, "", @@ -59,7 +59,7 @@ func (suite *invariantsIntegrationTestSuite) TestReserveBackingFractionalInvaria k.SetFractionalBalance(ctx, sdk.AccAddress{1}, types.ConversionFactor().QuoRaw(2)) k.SetRemainderAmount(ctx, types.ConversionFactor().QuoRaw(2)) // 1 integer backs same amount fractional including remainder - suite.FundReserve(sdk.NewInt(1)) + suite.FundReserve(sdkmath.NewInt(1)) }, false, "", @@ -84,7 +84,7 @@ func (suite *invariantsIntegrationTestSuite) TestReserveBackingFractionalInvaria k.SetRemainderAmount(ctx, amt) // Needs 2 to back 0.5 x 4 - suite.FundReserve(sdk.NewInt(1)) + suite.FundReserve(sdkmath.NewInt(1)) }, true, "precisebank: module reserve backing total fractional balances invariant\nakava reserve balance 1000000000000 mismatches 2000000000000 (fractional balances 1500000000000 + remainder 500000000000)\n\n", @@ -101,7 +101,7 @@ func (suite *invariantsIntegrationTestSuite) TestReserveBackingFractionalInvaria k.SetRemainderAmount(ctx, amt) // Needs 2 to back 0.5 x 4 - suite.FundReserve(sdk.NewInt(3)) + suite.FundReserve(sdkmath.NewInt(3)) }, true, "precisebank: module reserve backing total fractional balances invariant\nakava reserve balance 3000000000000 mismatches 2000000000000 (fractional balances 1500000000000 + remainder 500000000000)\n\n", diff --git a/x/precisebank/keeper/invariants_test.go b/x/precisebank/keeper/invariants_test.go index 2518c6ef29..76646e5911 100644 --- a/x/precisebank/keeper/invariants_test.go +++ b/x/precisebank/keeper/invariants_test.go @@ -4,8 +4,8 @@ import ( "testing" sdkmath "cosmossdk.io/math" - "github.com/cosmos/cosmos-sdk/store/prefix" - storetypes "github.com/cosmos/cosmos-sdk/store/types" + "cosmossdk.io/store/prefix" + storetypes "cosmossdk.io/store/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/kava-labs/kava/x/precisebank/keeper" @@ -186,7 +186,7 @@ func TestFractionalDenomNotInBankInvariant(t *testing.T) { func(ctx sdk.Context, bk *mocks.MockBankKeeper) { bk.EXPECT(). GetSupply(ctx, types.ExtendedCoinDenom). - Return(sdk.NewCoin(types.ExtendedCoinDenom, sdk.NewInt(1000))). + Return(sdk.NewCoin(types.ExtendedCoinDenom, sdkmath.NewInt(1000))). Once() }, true, diff --git a/x/precisebank/keeper/keeper.go b/x/precisebank/keeper/keeper.go index bb2e6c931a..c8e747bfbc 100644 --- a/x/precisebank/keeper/keeper.go +++ b/x/precisebank/keeper/keeper.go @@ -1,8 +1,8 @@ package keeper import ( + storetypes "cosmossdk.io/store/types" "github.com/cosmos/cosmos-sdk/codec" - storetypes "github.com/cosmos/cosmos-sdk/store/types" evmtypes "github.com/evmos/ethermint/x/evm/types" diff --git a/x/precisebank/keeper/keeper_test.go b/x/precisebank/keeper/keeper_test.go index a39c538997..bdb5379ee5 100644 --- a/x/precisebank/keeper/keeper_test.go +++ b/x/precisebank/keeper/keeper_test.go @@ -4,7 +4,7 @@ import ( "testing" sdkmath "cosmossdk.io/math" - storetypes "github.com/cosmos/cosmos-sdk/store/types" + storetypes "cosmossdk.io/store/types" "github.com/cosmos/cosmos-sdk/testutil" sdk "github.com/cosmos/cosmos-sdk/types" diff --git a/x/precisebank/keeper/mint.go b/x/precisebank/keeper/mint.go index 8d42eaded5..714a598ae8 100644 --- a/x/precisebank/keeper/mint.go +++ b/x/precisebank/keeper/mint.go @@ -1,6 +1,7 @@ package keeper import ( + "context" "fmt" errorsmod "cosmossdk.io/errors" @@ -17,15 +18,17 @@ import ( // If ExtendedCoinDenom is provided, the corresponding fractional amount is // added to the module state. // It will panic if the module account does not exist or is unauthorized. -func (k Keeper) MintCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error { +func (k Keeper) MintCoins(ctx context.Context, moduleName string, amt sdk.Coins) error { // Disallow minting to x/precisebank module if moduleName == types.ModuleName { panic(errorsmod.Wrapf(sdkerrors.ErrUnauthorized, "module account %s cannot be minted to", moduleName)) } + sdkCtx := sdk.UnwrapSDKContext(ctx) + // Note: MintingRestrictionFn is not used in x/precisebank // Panic errors are identical to x/bank for consistency. - acc := k.ak.GetModuleAccount(ctx, moduleName) + acc := k.ak.GetModuleAccount(sdkCtx, moduleName) if acc == nil { panic(errorsmod.Wrapf(sdkerrors.ErrUnknownAddress, "module account %s does not exist", moduleName)) } @@ -51,14 +54,14 @@ func (k Keeper) MintCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) err // Coins unmanaged by x/precisebank are passed through to x/bank if !passthroughCoins.Empty() { - if err := k.bk.MintCoins(ctx, moduleName, passthroughCoins); err != nil { + if err := k.bk.MintCoins(sdkCtx, moduleName, passthroughCoins); err != nil { return err } } // Only mint extended coin if the amount is positive if extendedAmount.IsPositive() { - if err := k.mintExtendedCoin(ctx, moduleName, extendedAmount); err != nil { + if err := k.mintExtendedCoin(sdkCtx, moduleName, extendedAmount); err != nil { return err } } @@ -68,7 +71,7 @@ func (k Keeper) MintCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) err return nil } - ctx.EventManager().EmitEvents(sdk.Events{ + sdkCtx.EventManager().EmitEvents(sdk.Events{ banktypes.NewCoinMintEvent(acc.GetAddress(), fullEmissionCoins), banktypes.NewCoinReceivedEvent(acc.GetAddress(), fullEmissionCoins), }) diff --git a/x/precisebank/keeper/mint_test.go b/x/precisebank/keeper/mint_test.go index a7df18ecee..3749497004 100644 --- a/x/precisebank/keeper/mint_test.go +++ b/x/precisebank/keeper/mint_test.go @@ -134,7 +134,7 @@ func TestMintCoins_Errors(t *testing.T) { }, sdk.Coins{sdk.Coin{ Denom: "ukava", - Amount: sdk.NewInt(-1000), + Amount: sdkmath.NewInt(-1000), }}, "-1000ukava: invalid coins", }, diff --git a/x/precisebank/keeper/send.go b/x/precisebank/keeper/send.go index fd3834196f..d429fcca98 100644 --- a/x/precisebank/keeper/send.go +++ b/x/precisebank/keeper/send.go @@ -1,6 +1,7 @@ package keeper import ( + "context" "errors" "fmt" @@ -18,7 +19,7 @@ import ( // Note: This method is not used directly by x/evm, but is still required as // part of authtypes.BankKeeper. x/evm uses auth methods that require this // interface. -func (k Keeper) IsSendEnabledCoins(ctx sdk.Context, coins ...sdk.Coin) error { +func (k Keeper) IsSendEnabledCoins(ctx context.Context, coins ...sdk.Coin) error { // Simply pass through to x/bank return k.bk.IsSendEnabledCoins(ctx, coins...) } @@ -28,7 +29,7 @@ func (k Keeper) IsSendEnabledCoins(ctx sdk.Context, coins ...sdk.Coin) error { // ExtendedCoinDenom and supports non-ExtendedCoinDenom transfers by passing // through to x/bank. func (k Keeper) SendCoins( - ctx sdk.Context, + ctx context.Context, from, to sdk.AccAddress, amt sdk.Coins, ) error { @@ -55,9 +56,11 @@ func (k Keeper) SendCoins( } } + sdkCtx := sdk.UnwrapSDKContext(ctx) + // Send the extended coin amount through x/precisebank if extendedCoinAmount.IsPositive() { - if err := k.sendExtendedCoins(ctx, from, to, extendedCoinAmount); err != nil { + if err := k.sendExtendedCoins(sdkCtx, from, to, extendedCoinAmount); err != nil { return err } } @@ -74,7 +77,7 @@ func (k Keeper) SendCoins( } // Emit transfer event of extended denom for the FULL equivalent value. - ctx.EventManager().EmitEvents(sdk.Events{ + sdkCtx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( banktypes.EventTypeTransfer, sdk.NewAttribute(banktypes.AttributeKeyRecipient, to.String()), @@ -163,7 +166,7 @@ func (k Keeper) sendExtendedCoins( // Sender borrows by transferring 1 integer amount to reserve to account for // lack of fractional balance. if senderNeedsBorrow && !recipientNeedsCarry { - borrowCoin := sdk.NewCoin(types.IntegerCoinDenom, sdk.NewInt(1)) + borrowCoin := sdk.NewCoin(types.IntegerCoinDenom, sdkmath.NewInt(1)) if err := k.bk.SendCoinsFromAccountToModule( ctx, from, // sender borrowing @@ -186,7 +189,7 @@ func (k Keeper) sendExtendedCoins( // a SendCoins operation. Only SendCoinsFromModuleToAccount should check // blocked addrs which is done by the parent SendCoinsFromModuleToAccount // method. - carryCoin := sdk.NewCoin(types.IntegerCoinDenom, sdk.NewInt(1)) + carryCoin := sdk.NewCoin(types.IntegerCoinDenom, sdkmath.NewInt(1)) if err := k.bk.SendCoins( ctx, reserveAddr, @@ -278,12 +281,13 @@ func addToFractionalBalance( // if the recipient module is the x/precisebank module account or if sending the // tokens fails. func (k Keeper) SendCoinsFromAccountToModule( - ctx sdk.Context, + ctx context.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins, ) error { - recipientAcc := k.ak.GetModuleAccount(ctx, recipientModule) + sdkCtx := sdk.UnwrapSDKContext(ctx) + recipientAcc := k.ak.GetModuleAccount(sdkCtx, recipientModule) if recipientAcc == nil { panic(errorsmod.Wrapf(sdkerrors.ErrUnknownAddress, "module account %s does not exist", recipientModule)) } @@ -300,7 +304,7 @@ func (k Keeper) SendCoinsFromAccountToModule( // the recipient address is blocked, if the sender is the x/precisebank module // account, or if sending the tokens fails. func (k Keeper) SendCoinsFromModuleToAccount( - ctx sdk.Context, + ctx context.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins, diff --git a/x/precisebank/keeper/send_integration_test.go b/x/precisebank/keeper/send_integration_test.go index 08c17421f2..a4e8c61b7e 100644 --- a/x/precisebank/keeper/send_integration_test.go +++ b/x/precisebank/keeper/send_integration_test.go @@ -158,7 +158,7 @@ func (suite *sendIntegrationTestSuite) TestSendCoinsFromModuleToAccount_Matching "invalid coins", senderModuleName, sdk.AccAddress([]byte{2}), - sdk.Coins{sdk.Coin{Denom: "ukava", Amount: sdk.NewInt(-1)}}, + sdk.Coins{sdk.Coin{Denom: "ukava", Amount: sdkmath.NewInt(-1)}}, "-1ukava: invalid coins", "", }, @@ -233,7 +233,7 @@ func (suite *sendIntegrationTestSuite) TestSendCoins_MatchingErrors() { { "invalid coins", cs(), - sdk.Coins{sdk.Coin{Denom: "ukava", Amount: sdk.NewInt(-1)}}, + sdk.Coins{sdk.Coin{Denom: "ukava", Amount: sdkmath.NewInt(-1)}}, "-1ukava: invalid coins", }, { diff --git a/x/precisebank/keeper/view.go b/x/precisebank/keeper/view.go index 3c6b83db13..ba6cb50c12 100644 --- a/x/precisebank/keeper/view.go +++ b/x/precisebank/keeper/view.go @@ -1,6 +1,7 @@ package keeper import ( + "context" sdkmath "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/kava-labs/kava/x/precisebank/types" @@ -10,7 +11,7 @@ import ( // return the extended balance for the ExtendedCoinDenom, and the regular // balance for all other denoms. func (k Keeper) GetBalance( - ctx sdk.Context, + ctx context.Context, addr sdk.AccAddress, denom string, ) sdk.Coin { @@ -22,16 +23,18 @@ func (k Keeper) GetBalance( return sdk.NewCoin(denom, sdkmath.ZeroInt()) } + sdkCtx := sdk.UnwrapSDKContext(ctx) + // Pass through to x/bank for denoms except ExtendedCoinDenom if denom != types.ExtendedCoinDenom { - return k.bk.GetBalance(ctx, addr, denom) + return k.bk.GetBalance(sdkCtx, addr, denom) } // x/bank for integer balance - full balance, including locked - integerCoins := k.bk.GetBalance(ctx, addr, types.IntegerCoinDenom) + integerCoins := k.bk.GetBalance(sdkCtx, addr, types.IntegerCoinDenom) // x/precisebank for fractional balance - fractionalAmount := k.GetFractionalBalance(ctx, addr) + fractionalAmount := k.GetFractionalBalance(sdkCtx, addr) // (Integer * ConversionFactor) + Fractional fullAmount := integerCoins. @@ -46,7 +49,7 @@ func (k Keeper) GetBalance( // by address. If the account has no spendable coins, an empty Coins slice is // returned. func (k Keeper) SpendableCoin( - ctx sdk.Context, + ctx context.Context, addr sdk.AccAddress, denom string, ) sdk.Coin { @@ -63,8 +66,9 @@ func (k Keeper) SpendableCoin( // x/bank for integer balance - excluding locked integerCoin := k.bk.SpendableCoin(ctx, addr, types.IntegerCoinDenom) + sdkCtx := sdk.UnwrapSDKContext(ctx) // x/precisebank for fractional balance - fractionalAmount := k.GetFractionalBalance(ctx, addr) + fractionalAmount := k.GetFractionalBalance(sdkCtx, addr) // Spendable = (Integer * ConversionFactor) + Fractional fullAmount := integerCoin.Amount. diff --git a/x/precisebank/keeper/view_integration_test.go b/x/precisebank/keeper/view_integration_test.go index a2f3889595..23c6713f60 100644 --- a/x/precisebank/keeper/view_integration_test.go +++ b/x/precisebank/keeper/view_integration_test.go @@ -40,9 +40,9 @@ func (suite *viewIntegrationTestSuite) TestKeeper_SpendableCoin() { "extended denom, no fractional - locked coins", types.ExtendedCoinDenom, // queried bank balance in ukava when querying for akava - sdk.NewCoins(sdk.NewCoin(types.IntegerCoinDenom, sdk.NewInt(1000))), + sdk.NewCoins(sdk.NewCoin(types.IntegerCoinDenom, sdkmath.NewInt(1000))), sdkmath.ZeroInt(), - sdk.NewCoins(sdk.NewCoin(types.IntegerCoinDenom, sdk.NewInt(10))), + sdk.NewCoins(sdk.NewCoin(types.IntegerCoinDenom, sdkmath.NewInt(10))), // (integer + fractional) - locked sdk.NewCoin( types.ExtendedCoinDenom, @@ -53,9 +53,9 @@ func (suite *viewIntegrationTestSuite) TestKeeper_SpendableCoin() { "extended denom, with fractional - locked coins", types.ExtendedCoinDenom, // queried bank balance in ukava when querying for akava - sdk.NewCoins(sdk.NewCoin(types.IntegerCoinDenom, sdk.NewInt(1000))), + sdk.NewCoins(sdk.NewCoin(types.IntegerCoinDenom, sdkmath.NewInt(1000))), sdkmath.NewInt(5000), - sdk.NewCoins(sdk.NewCoin(types.IntegerCoinDenom, sdk.NewInt(10))), + sdk.NewCoins(sdk.NewCoin(types.IntegerCoinDenom, sdkmath.NewInt(10))), sdk.NewCoin( types.ExtendedCoinDenom, // (integer - locked) + fractional @@ -65,19 +65,19 @@ func (suite *viewIntegrationTestSuite) TestKeeper_SpendableCoin() { { "non-extended denom - ukava returns ukava", types.IntegerCoinDenom, - sdk.NewCoins(sdk.NewCoin(types.IntegerCoinDenom, sdk.NewInt(1000))), + sdk.NewCoins(sdk.NewCoin(types.IntegerCoinDenom, sdkmath.NewInt(1000))), sdkmath.ZeroInt(), - sdk.NewCoins(sdk.NewCoin(types.IntegerCoinDenom, sdk.NewInt(10))), - sdk.NewCoin(types.IntegerCoinDenom, sdk.NewInt(990)), + sdk.NewCoins(sdk.NewCoin(types.IntegerCoinDenom, sdkmath.NewInt(10))), + sdk.NewCoin(types.IntegerCoinDenom, sdkmath.NewInt(990)), }, { "non-extended denom, with fractional - ukava returns ukava", types.IntegerCoinDenom, - sdk.NewCoins(sdk.NewCoin(types.IntegerCoinDenom, sdk.NewInt(1000))), + sdk.NewCoins(sdk.NewCoin(types.IntegerCoinDenom, sdkmath.NewInt(1000))), // does not affect balance sdkmath.NewInt(100), - sdk.NewCoins(sdk.NewCoin(types.IntegerCoinDenom, sdk.NewInt(10))), - sdk.NewCoin(types.IntegerCoinDenom, sdk.NewInt(990)), + sdk.NewCoins(sdk.NewCoin(types.IntegerCoinDenom, sdkmath.NewInt(10))), + sdk.NewCoin(types.IntegerCoinDenom, sdkmath.NewInt(990)), }, } @@ -141,7 +141,7 @@ func (suite *viewIntegrationTestSuite) TestKeeper_HiddenReserve() { // Mint fractional coins to an account, which should cause a mint of 1 // integer coin to the reserve to back it. extCoin := sdk.NewCoin(types.ExtendedCoinDenom, types.ConversionFactor().AddRaw(1000)) - unrelatedCoin := sdk.NewCoin("unrelated", sdk.NewInt(1000)) + unrelatedCoin := sdk.NewCoin("unrelated", sdkmath.NewInt(1000)) suite.MintToAccount( addr1, sdk.NewCoins( diff --git a/x/precisebank/keeper/view_test.go b/x/precisebank/keeper/view_test.go index 1a4e782049..bd401f9a51 100644 --- a/x/precisebank/keeper/view_test.go +++ b/x/precisebank/keeper/view_test.go @@ -24,18 +24,18 @@ func TestKeeper_GetBalance(t *testing.T) { "extended denom - no fractional balance", types.ExtendedCoinDenom, // queried bank balance in ukava when querying for akava - sdk.NewCoins(sdk.NewCoin(types.IntegerCoinDenom, sdk.NewInt(1000))), + sdk.NewCoins(sdk.NewCoin(types.IntegerCoinDenom, sdkmath.NewInt(1000))), sdkmath.ZeroInt(), // integer + fractional - sdk.NewCoin(types.ExtendedCoinDenom, sdk.NewInt(1000_000_000_000_000)), + sdk.NewCoin(types.ExtendedCoinDenom, sdkmath.NewInt(1000_000_000_000_000)), }, { "extended denom - with fractional balance", types.ExtendedCoinDenom, - sdk.NewCoins(sdk.NewCoin(types.IntegerCoinDenom, sdk.NewInt(1000))), + sdk.NewCoins(sdk.NewCoin(types.IntegerCoinDenom, sdkmath.NewInt(1000))), sdkmath.NewInt(100), // integer + fractional - sdk.NewCoin(types.ExtendedCoinDenom, sdk.NewInt(1000_000_000_000_100)), + sdk.NewCoin(types.ExtendedCoinDenom, sdkmath.NewInt(1000_000_000_000_100)), }, { "extended denom - only fractional balance", @@ -43,43 +43,43 @@ func TestKeeper_GetBalance(t *testing.T) { // no coins in bank, only fractional balance sdk.NewCoins(), sdkmath.NewInt(100), - sdk.NewCoin(types.ExtendedCoinDenom, sdk.NewInt(100)), + sdk.NewCoin(types.ExtendedCoinDenom, sdkmath.NewInt(100)), }, { "extended denom - max fractional balance", types.ExtendedCoinDenom, - sdk.NewCoins(sdk.NewCoin(types.IntegerCoinDenom, sdk.NewInt(1000))), + sdk.NewCoins(sdk.NewCoin(types.IntegerCoinDenom, sdkmath.NewInt(1000))), types.ConversionFactor().SubRaw(1), // integer + fractional - sdk.NewCoin(types.ExtendedCoinDenom, sdk.NewInt(1000_999_999_999_999)), + sdk.NewCoin(types.ExtendedCoinDenom, sdkmath.NewInt(1000_999_999_999_999)), }, { "non-extended denom - ukava returns ukava", types.IntegerCoinDenom, - sdk.NewCoins(sdk.NewCoin(types.IntegerCoinDenom, sdk.NewInt(1000))), - sdk.ZeroInt(), - sdk.NewCoin("ukava", sdk.NewInt(1000)), + sdk.NewCoins(sdk.NewCoin(types.IntegerCoinDenom, sdkmath.NewInt(1000))), + sdkmath.ZeroInt(), + sdk.NewCoin("ukava", sdkmath.NewInt(1000)), }, { "non-extended denom - unaffected by fractional balance", "ukava", - sdk.NewCoins(sdk.NewCoin("ukava", sdk.NewInt(1000))), + sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(1000))), sdkmath.NewInt(100), - sdk.NewCoin("ukava", sdk.NewInt(1000)), + sdk.NewCoin("ukava", sdkmath.NewInt(1000)), }, { "unrelated denom - no fractional", "busd", - sdk.NewCoins(sdk.NewCoin("busd", sdk.NewInt(1000))), - sdk.ZeroInt(), - sdk.NewCoin("busd", sdk.NewInt(1000)), + sdk.NewCoins(sdk.NewCoin("busd", sdkmath.NewInt(1000))), + sdkmath.ZeroInt(), + sdk.NewCoin("busd", sdkmath.NewInt(1000)), }, { "unrelated denom - unaffected by fractional balance", "busd", - sdk.NewCoins(sdk.NewCoin("busd", sdk.NewInt(1000))), + sdk.NewCoins(sdk.NewCoin("busd", sdkmath.NewInt(1000))), sdkmath.NewInt(100), - sdk.NewCoin("busd", sdk.NewInt(1000)), + sdk.NewCoin("busd", sdkmath.NewInt(1000)), }, } @@ -139,18 +139,18 @@ func TestKeeper_SpendableCoin(t *testing.T) { "extended denom - no fractional balance", types.ExtendedCoinDenom, // queried bank balance in ukava when querying for akava - sdk.NewCoins(sdk.NewCoin(types.IntegerCoinDenom, sdk.NewInt(1000))), + sdk.NewCoins(sdk.NewCoin(types.IntegerCoinDenom, sdkmath.NewInt(1000))), sdkmath.ZeroInt(), // integer + fractional - sdk.NewCoin(types.ExtendedCoinDenom, sdk.NewInt(1000_000_000_000_000)), + sdk.NewCoin(types.ExtendedCoinDenom, sdkmath.NewInt(1000_000_000_000_000)), }, { "extended denom - with fractional balance", types.ExtendedCoinDenom, - sdk.NewCoins(sdk.NewCoin(types.IntegerCoinDenom, sdk.NewInt(1000))), + sdk.NewCoins(sdk.NewCoin(types.IntegerCoinDenom, sdkmath.NewInt(1000))), sdkmath.NewInt(100), // integer + fractional - sdk.NewCoin(types.ExtendedCoinDenom, sdk.NewInt(1000_000_000_000_100)), + sdk.NewCoin(types.ExtendedCoinDenom, sdkmath.NewInt(1000_000_000_000_100)), }, { "extended denom - only fractional balance", @@ -158,43 +158,43 @@ func TestKeeper_SpendableCoin(t *testing.T) { // no coins in bank, only fractional balance sdk.NewCoins(), sdkmath.NewInt(100), - sdk.NewCoin(types.ExtendedCoinDenom, sdk.NewInt(100)), + sdk.NewCoin(types.ExtendedCoinDenom, sdkmath.NewInt(100)), }, { "extended denom - max fractional balance", types.ExtendedCoinDenom, - sdk.NewCoins(sdk.NewCoin(types.IntegerCoinDenom, sdk.NewInt(1000))), + sdk.NewCoins(sdk.NewCoin(types.IntegerCoinDenom, sdkmath.NewInt(1000))), types.ConversionFactor().SubRaw(1), // integer + fractional - sdk.NewCoin(types.ExtendedCoinDenom, sdk.NewInt(1000_999_999_999_999)), + sdk.NewCoin(types.ExtendedCoinDenom, sdkmath.NewInt(1000_999_999_999_999)), }, { "non-extended denom - ukava returns ukava", types.IntegerCoinDenom, - sdk.NewCoins(sdk.NewCoin(types.IntegerCoinDenom, sdk.NewInt(1000))), - sdk.ZeroInt(), - sdk.NewCoin("ukava", sdk.NewInt(1000)), + sdk.NewCoins(sdk.NewCoin(types.IntegerCoinDenom, sdkmath.NewInt(1000))), + sdkmath.ZeroInt(), + sdk.NewCoin("ukava", sdkmath.NewInt(1000)), }, { "non-extended denom - unaffected by fractional balance", "ukava", - sdk.NewCoins(sdk.NewCoin("ukava", sdk.NewInt(1000))), + sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(1000))), sdkmath.NewInt(100), - sdk.NewCoin("ukava", sdk.NewInt(1000)), + sdk.NewCoin("ukava", sdkmath.NewInt(1000)), }, { "unrelated denom - no fractional", "busd", - sdk.NewCoins(sdk.NewCoin("busd", sdk.NewInt(1000))), - sdk.ZeroInt(), - sdk.NewCoin("busd", sdk.NewInt(1000)), + sdk.NewCoins(sdk.NewCoin("busd", sdkmath.NewInt(1000))), + sdkmath.ZeroInt(), + sdk.NewCoin("busd", sdkmath.NewInt(1000)), }, { "unrelated denom - unaffected by fractional balance", "busd", - sdk.NewCoins(sdk.NewCoin("busd", sdk.NewInt(1000))), + sdk.NewCoins(sdk.NewCoin("busd", sdkmath.NewInt(1000))), sdkmath.NewInt(100), - sdk.NewCoin("busd", sdk.NewInt(1000)), + sdk.NewCoin("busd", sdkmath.NewInt(1000)), }, } diff --git a/x/precisebank/module.go b/x/precisebank/module.go index 6ad8f73a09..3cf3692878 100644 --- a/x/precisebank/module.go +++ b/x/precisebank/module.go @@ -150,10 +150,16 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw func (AppModule) ConsensusVersion() uint64 { return ConsensusVersion } // BeginBlock executes all ABCI BeginBlock logic respective to precisebank module. -func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) {} +func (am AppModule) BeginBlock(ctx sdk.Context) error { + return nil +} // EndBlock executes all ABCI EndBlock logic respective to precisebank module. It // returns no validator updates. -func (am AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { - return []abci.ValidatorUpdate{} +func (am AppModule) EndBlock(_ sdk.Context) ([]abci.ValidatorUpdate, error) { + return []abci.ValidatorUpdate{}, nil } + +func (AppModule) IsOnePerModuleType() {} + +func (AppModule) IsAppModule() {} diff --git a/x/precisebank/testutil/suite.go b/x/precisebank/testutil/suite.go index 345a64deac..cffaed95d5 100644 --- a/x/precisebank/testutil/suite.go +++ b/x/precisebank/testutil/suite.go @@ -34,7 +34,7 @@ type Suite struct { func (suite *Suite) SetupTest() { tApp := app.NewTestApp() - suite.Ctx = tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + suite.Ctx = tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) suite.App = tApp suite.BankKeeper = tApp.GetBankKeeper() suite.AccountKeeper = tApp.GetAccountKeeper() @@ -53,7 +53,7 @@ func (suite *Suite) SetupTest() { consAddress := sdk.ConsAddress(consPriv.PubKey().Address()) // InitializeFromGenesisStates commits first block so we start at 2 here - suite.Ctx = suite.App.NewContext(false, tmproto.Header{ + suite.Ctx = suite.App.NewContextLegacy(false, tmproto.Header{ Height: suite.App.LastBlockHeight() + 1, ChainID: app.TestChainId, Time: time.Now().UTC(), @@ -87,7 +87,7 @@ func (suite *Suite) Commit() { }) // update ctx - suite.Ctx = suite.App.NewContext(false, header) + suite.Ctx = suite.App.NewContextLegacy(false, header) } // MintToAccount mints coins to an account with the x/precisebank methods. This diff --git a/x/precisebank/types/codec.go b/x/precisebank/types/codec.go index 772fa40e04..52020e3cde 100644 --- a/x/precisebank/types/codec.go +++ b/x/precisebank/types/codec.go @@ -5,7 +5,6 @@ import ( cdctypes "github.com/cosmos/cosmos-sdk/codec/types" cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" sdk "github.com/cosmos/cosmos-sdk/types" - authzcodec "github.com/cosmos/cosmos-sdk/x/authz/codec" ) // RegisterLegacyAminoCodec registers the necessary evmutil interfaces and concrete types @@ -29,5 +28,5 @@ func init() { // Register all Amino interfaces and concrete types on the authz Amino codec so that this can later be // used to properly serialize MsgGrant and MsgExec instances - RegisterLegacyAminoCodec(authzcodec.Amino) + RegisterLegacyAminoCodec(codec.NewLegacyAmino()) } diff --git a/x/precisebank/types/expected_keepers.go b/x/precisebank/types/expected_keepers.go index e80741f130..4e387cd6bb 100644 --- a/x/precisebank/types/expected_keepers.go +++ b/x/precisebank/types/expected_keepers.go @@ -1,31 +1,33 @@ package types import ( + "context" sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) // AccountKeeper defines the expected account keeper interface type AccountKeeper interface { - GetModuleAccount(ctx sdk.Context, moduleName string) authtypes.ModuleAccountI + GetModuleAccount(ctx context.Context, moduleName string) sdk.ModuleAccountI GetModuleAddress(moduleName string) sdk.AccAddress - GetSequence(sdk.Context, sdk.AccAddress) (uint64, error) + GetSequence(context.Context, sdk.AccAddress) (uint64, error) } // BankKeeper defines the expected bank keeper interface type BankKeeper interface { - IsSendEnabledCoins(ctx sdk.Context, coins ...sdk.Coin) error - GetBalance(ctx sdk.Context, addr sdk.AccAddress, denom string) sdk.Coin - GetSupply(ctx sdk.Context, denom string) sdk.Coin - SpendableCoin(ctx sdk.Context, addr sdk.AccAddress, denom string) sdk.Coin + IsSendEnabledCoins(ctx context.Context, coins ...sdk.Coin) error + GetBalance(ctx context.Context, addr sdk.AccAddress, denom string) sdk.Coin + GetSupply(ctx context.Context, denom string) sdk.Coin + SpendableCoin(ctx context.Context, addr sdk.AccAddress, denom string) sdk.Coin BlockedAddr(addr sdk.AccAddress) bool - SendCoins(ctx sdk.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Coins) error - SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error - SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error - SendCoinsFromModuleToModule(ctx sdk.Context, senderModule string, recipientModule string, amt sdk.Coins) error + // need the method: SendCoins(ctx context.Context, from sdk.AccAddress, to sdk.AccAddress, amt sdk.Coins) error + // have the method: SendCoins(ctx sdk.Context, from sdk.AccAddress, to sdk.AccAddress, amt sdk.Coins) error + SendCoins(ctx context.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Coins) error + SendCoinsFromAccountToModule(ctx context.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error + SendCoinsFromModuleToAccount(ctx context.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error + SendCoinsFromModuleToModule(ctx context.Context, senderModule string, recipientModule string, amt sdk.Coins) error - MintCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error - BurnCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error + MintCoins(ctx context.Context, moduleName string, amt sdk.Coins) error + BurnCoins(ctx context.Context, moduleName string, amt sdk.Coins) error } diff --git a/x/precisebank/types/extended_balance_test.go b/x/precisebank/types/extended_balance_test.go index 9ce8ed214c..13ade363be 100644 --- a/x/precisebank/types/extended_balance_test.go +++ b/x/precisebank/types/extended_balance_test.go @@ -17,7 +17,7 @@ func TestSumExtendedCoin(t *testing.T) { { "empty", sdk.NewCoins(), - sdk.NewCoin(types.ExtendedCoinDenom, sdk.ZeroInt()), + sdk.NewCoin(types.ExtendedCoinDenom, sdkmath.ZeroInt()), }, { "only integer", @@ -27,7 +27,7 @@ func TestSumExtendedCoin(t *testing.T) { { "only extended", sdk.NewCoins(sdk.NewInt64Coin(types.ExtendedCoinDenom, 100)), - sdk.NewCoin(types.ExtendedCoinDenom, sdk.NewInt(100)), + sdk.NewCoin(types.ExtendedCoinDenom, sdkmath.NewInt(100)), }, { "integer and extended", diff --git a/x/precisebank/types/mocks/MockAccountKeeper.go b/x/precisebank/types/mocks/MockAccountKeeper.go index 982ba7cd54..45e810bfc2 100644 --- a/x/precisebank/types/mocks/MockAccountKeeper.go +++ b/x/precisebank/types/mocks/MockAccountKeeper.go @@ -23,19 +23,19 @@ func (_m *MockAccountKeeper) EXPECT() *MockAccountKeeper_Expecter { } // GetModuleAccount provides a mock function with given fields: ctx, moduleName -func (_m *MockAccountKeeper) GetModuleAccount(ctx types.Context, moduleName string) authtypes.ModuleAccountI { +func (_m *MockAccountKeeper) GetModuleAccount(ctx types.Context, moduleName string) sdk.ModuleAccountI { ret := _m.Called(ctx, moduleName) if len(ret) == 0 { panic("no return value specified for GetModuleAccount") } - var r0 authtypes.ModuleAccountI - if rf, ok := ret.Get(0).(func(types.Context, string) authtypes.ModuleAccountI); ok { + var r0 sdk.ModuleAccountI + if rf, ok := ret.Get(0).(func(types.Context, string) sdk.ModuleAccountI); ok { r0 = rf(ctx, moduleName) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(authtypes.ModuleAccountI) + r0 = ret.Get(0).(sdk.ModuleAccountI) } } @@ -61,12 +61,12 @@ func (_c *MockAccountKeeper_GetModuleAccount_Call) Run(run func(ctx types.Contex return _c } -func (_c *MockAccountKeeper_GetModuleAccount_Call) Return(_a0 authtypes.ModuleAccountI) *MockAccountKeeper_GetModuleAccount_Call { +func (_c *MockAccountKeeper_GetModuleAccount_Call) Return(_a0 sdk.ModuleAccountI) *MockAccountKeeper_GetModuleAccount_Call { _c.Call.Return(_a0) return _c } -func (_c *MockAccountKeeper_GetModuleAccount_Call) RunAndReturn(run func(types.Context, string) authtypes.ModuleAccountI) *MockAccountKeeper_GetModuleAccount_Call { +func (_c *MockAccountKeeper_GetModuleAccount_Call) RunAndReturn(run func(types.Context, string) sdk.ModuleAccountI) *MockAccountKeeper_GetModuleAccount_Call { _c.Call.Return(run) return _c } diff --git a/x/precisebank/types/query.pb.go b/x/precisebank/types/query.pb.go index b324a2252e..203ecc95a6 100644 --- a/x/precisebank/types/query.pb.go +++ b/x/precisebank/types/query.pb.go @@ -451,6 +451,7 @@ func _Query_FractionalBalance_Handler(srv interface{}, ctx context.Context, dec return interceptor(ctx, in, info, handler) } +var Query_serviceDesc = _Query_serviceDesc var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "kava.precisebank.v1.Query", HandlerType: (*QueryServer)(nil), diff --git a/x/pricefeed/client/cli/tx.go b/x/pricefeed/client/cli/tx.go index 0b41cde0f9..61fdbbcd6f 100644 --- a/x/pricefeed/client/cli/tx.go +++ b/x/pricefeed/client/cli/tx.go @@ -1,6 +1,7 @@ package cli import ( + sdkmath "cosmossdk.io/math" "fmt" "strconv" "time" @@ -10,7 +11,6 @@ import ( "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/client/tx" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/version" tmtime "github.com/cometbft/cometbft/types/time" @@ -55,7 +55,7 @@ func GetCmdPostPrice() *cobra.Command { return err } - price, err := sdk.NewDecFromStr(args[1]) + price, err := sdkmath.LegacyNewDecFromStr(args[1]) if err != nil { return err } diff --git a/x/pricefeed/genesis_test.go b/x/pricefeed/genesis_test.go index b8d0889d0f..0513027de2 100644 --- a/x/pricefeed/genesis_test.go +++ b/x/pricefeed/genesis_test.go @@ -25,7 +25,7 @@ type GenesisTestSuite struct { func (suite *GenesisTestSuite) SetupTest() { suite.tApp = app.NewTestApp() - suite.ctx = suite.tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + suite.ctx = suite.tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) suite.keeper = suite.tApp.GetPriceFeedKeeper() } diff --git a/x/pricefeed/integration_test.go b/x/pricefeed/integration_test.go index b8d230f7e5..bce36e8425 100644 --- a/x/pricefeed/integration_test.go +++ b/x/pricefeed/integration_test.go @@ -21,13 +21,13 @@ func NewPricefeedGen() types.GenesisState { { MarketID: "btc:usd", OracleAddress: sdk.AccAddress("oracle1"), - Price: sdk.MustNewDecFromStr("8000.00"), + Price: sdkmath.LegacyMustNewDecFromStr("8000.00"), Expiry: time.Now().Add(1 * time.Hour), }, { MarketID: "xrp:usd", OracleAddress: sdk.AccAddress("oracle2"), - Price: sdk.MustNewDecFromStr("0.25"), + Price: sdkmath.LegacyMustNewDecFromStr("0.25"), Expiry: time.Now().Add(1 * time.Hour), }, }, @@ -51,13 +51,13 @@ func NewPricefeedGenStateWithOracles(addrs []sdk.AccAddress) app.GenesisState { { MarketID: "btc:usd", OracleAddress: addrs[0], - Price: sdk.MustNewDecFromStr("8000.00"), + Price: sdkmath.LegacyMustNewDecFromStr("8000.00"), Expiry: time.Now().Add(1 * time.Hour), }, { MarketID: "xrp:usd", OracleAddress: addrs[0], - Price: sdk.MustNewDecFromStr("0.25"), + Price: sdkmath.LegacyMustNewDecFromStr("0.25"), Expiry: time.Now().Add(1 * time.Hour), }, }, diff --git a/x/pricefeed/keeper/grpc_query_test.go b/x/pricefeed/keeper/grpc_query_test.go index abe950dc50..57fe52a89d 100644 --- a/x/pricefeed/keeper/grpc_query_test.go +++ b/x/pricefeed/keeper/grpc_query_test.go @@ -4,7 +4,6 @@ import ( "testing" "time" - tmprototypes "github.com/cometbft/cometbft/proto/tendermint/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/kava-labs/kava/app" "github.com/kava-labs/kava/x/pricefeed/keeper" @@ -26,7 +25,7 @@ type grpcQueryTestSuite struct { func (suite *grpcQueryTestSuite) SetupTest() { suite.tApp = app.NewTestApp() - suite.ctx = suite.tApp.NewContext(true, tmprototypes.Header{}). + suite.ctx = suite.tApp.NewContextLegacy(true). WithBlockTime(time.Now().UTC()) suite.keeper = suite.tApp.GetPriceFeedKeeper() suite.queryServer = keeper.NewQueryServerImpl(suite.keeper) @@ -82,7 +81,7 @@ func (suite *grpcQueryTestSuite) TestGrpcPrice() { suite.setTestParams() suite.setTstPrice() - expectedPrice := types.NewCurrentPriceResponse("tstusd", sdk.MustNewDecFromStr("0.34")) + expectedPrice := types.NewCurrentPriceResponse("tstusd", sdkmath.LegacyMustNewDecFromStr("0.34")) res, err := suite.queryServer.Price(sdk.WrapSDKContext(suite.ctx), &types.QueryPriceRequest{MarketId: "tstusd"}) suite.NoError(err) @@ -109,7 +108,7 @@ func (suite *grpcQueryTestSuite) TestGrpcPrices() { suite.setTestParams() suite.setTstPrice() - expectedPrice := types.NewCurrentPriceResponse("tstusd", sdk.MustNewDecFromStr("0.34")) + expectedPrice := types.NewCurrentPriceResponse("tstusd", sdkmath.LegacyMustNewDecFromStr("0.34")) prices, err := suite.queryServer.Prices(sdk.WrapSDKContext(suite.ctx), &types.QueryPricesRequest{}) suite.NoError(err) @@ -126,7 +125,7 @@ func (suite *grpcQueryTestSuite) TestGrpcPrices_NoPriceSet() { _, err := suite.keeper.SetPrice( suite.ctx, suite.addrs[2], "tst:usd", - sdk.MustNewDecFromStr("0.34"), + sdkmath.LegacyMustNewDecFromStr("0.34"), suite.now.Add(time.Hour*1)) suite.NoError(err) @@ -136,7 +135,7 @@ func (suite *grpcQueryTestSuite) TestGrpcPrices_NoPriceSet() { // Set current price of "other:usd" with no individual prices in store _ = suite.keeper.SetCurrentPrices(suite.ctx, "other:usd") - expectedPrice := types.NewCurrentPriceResponse("tst:usd", sdk.MustNewDecFromStr("0.34")) + expectedPrice := types.NewCurrentPriceResponse("tst:usd", sdkmath.LegacyMustNewDecFromStr("0.34")) prices, err := suite.queryServer.Prices(sdk.WrapSDKContext(suite.ctx), &types.QueryPricesRequest{}) suite.NoError(err) @@ -159,19 +158,19 @@ func (suite *grpcQueryTestSuite) TestGrpcRawPrices() { types.NewPostedPriceResponse( "tstusd", suite.addrs[0], - sdk.MustNewDecFromStr("0.33"), + sdkmath.LegacyMustNewDecFromStr("0.33"), suite.now.Add(time.Hour*1), ), types.NewPostedPriceResponse( "tstusd", suite.addrs[1], - sdk.MustNewDecFromStr("0.35"), + sdkmath.LegacyMustNewDecFromStr("0.35"), suite.now.Add(time.Hour*1), ), types.NewPostedPriceResponse( "tstusd", suite.addrs[2], - sdk.MustNewDecFromStr("0.34"), + sdkmath.LegacyMustNewDecFromStr("0.34"), suite.now.Add(time.Hour*1), ), }, @@ -245,19 +244,19 @@ func (suite *grpcQueryTestSuite) TestGrpcMarkets() { func (suite *grpcQueryTestSuite) setTstPrice() { _, err := suite.keeper.SetPrice( suite.ctx, suite.addrs[0], "tstusd", - sdk.MustNewDecFromStr("0.33"), + sdkmath.LegacyMustNewDecFromStr("0.33"), suite.now.Add(time.Hour*1)) suite.NoError(err) _, err = suite.keeper.SetPrice( suite.ctx, suite.addrs[1], "tstusd", - sdk.MustNewDecFromStr("0.35"), + sdkmath.LegacyMustNewDecFromStr("0.35"), suite.now.Add(time.Hour*1)) suite.NoError(err) _, err = suite.keeper.SetPrice( suite.ctx, suite.addrs[2], "tstusd", - sdk.MustNewDecFromStr("0.34"), + sdkmath.LegacyMustNewDecFromStr("0.34"), suite.now.Add(time.Hour*1)) suite.NoError(err) diff --git a/x/pricefeed/keeper/integration_test.go b/x/pricefeed/keeper/integration_test.go index e2c1cff64b..ca2021ad50 100644 --- a/x/pricefeed/keeper/integration_test.go +++ b/x/pricefeed/keeper/integration_test.go @@ -21,13 +21,13 @@ func NewPricefeedGenStateMulti() app.GenesisState { { MarketID: "btc:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("8000.00"), + Price: sdkmath.LegacyMustNewDecFromStr("8000.00"), Expiry: time.Now().Add(1 * time.Hour), }, { MarketID: "xrp:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("0.25"), + Price: sdkmath.LegacyMustNewDecFromStr("0.25"), Expiry: time.Now().Add(1 * time.Hour), }, }, diff --git a/x/pricefeed/keeper/keeper.go b/x/pricefeed/keeper/keeper.go index 95c65f7bb9..7c8767b84f 100644 --- a/x/pricefeed/keeper/keeper.go +++ b/x/pricefeed/keeper/keeper.go @@ -1,15 +1,16 @@ package keeper import ( + sdkmath "cosmossdk.io/math" "fmt" "sort" "time" - "github.com/cometbft/cometbft/libs/log" + "cosmossdk.io/log" errorsmod "cosmossdk.io/errors" + storetypes "cosmossdk.io/store/types" "github.com/cosmos/cosmos-sdk/codec" - storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" @@ -51,7 +52,7 @@ func (k Keeper) SetPrice( ctx sdk.Context, oracle sdk.AccAddress, marketID string, - price sdk.Dec, + price sdkmath.LegacyDec, expiry time.Time, ) (types.PostedPrice, error) { // If the expiry is less than or equal to the current blockheight, we consider the price valid @@ -143,7 +144,7 @@ func (k Keeper) SetCurrentPricesForAllMarkets(ctx sdk.Context) { } } - iterator := sdk.KVStorePrefixIterator(ctx.KVStore(k.key), types.RawPriceFeedPrefix) + iterator := storetypes.KVStorePrefixIterator(ctx.KVStore(k.key), types.RawPriceFeedPrefix) for ; iterator.Valid(); iterator.Next() { var postedPrice types.PostedPrice k.cdc.MustUnmarshal(iterator.Value(), &postedPrice) @@ -205,7 +206,7 @@ func (k Keeper) setCurrentPrice(ctx sdk.Context, marketID string, currentPrice t } // CalculateMedianPrice calculates the median prices for the input prices. -func (k Keeper) CalculateMedianPrice(prices []types.CurrentPrice) sdk.Dec { +func (k Keeper) CalculateMedianPrice(prices []types.CurrentPrice) sdkmath.LegacyDec { l := len(prices) if l == 1 { @@ -225,9 +226,9 @@ func (k Keeper) CalculateMedianPrice(prices []types.CurrentPrice) sdk.Dec { return prices[l/2].Price } -func (k Keeper) calculateMeanPrice(priceA, priceB types.CurrentPrice) sdk.Dec { +func (k Keeper) calculateMeanPrice(priceA, priceB types.CurrentPrice) sdkmath.LegacyDec { sum := priceA.Price.Add(priceB.Price) - mean := sum.Quo(sdk.NewDec(2)) + mean := sum.Quo(sdkmath.LegacyNewDec(2)) return mean } @@ -244,7 +245,7 @@ func (k Keeper) GetCurrentPrice(ctx sdk.Context, marketID string) (types.Current if err != nil { return types.CurrentPrice{}, err } - if price.Price.Equal(sdk.ZeroDec()) { + if price.Price.Equal(sdkmath.LegacyZeroDec()) { return types.CurrentPrice{}, types.ErrNoValidPrice } return price, nil @@ -252,7 +253,7 @@ func (k Keeper) GetCurrentPrice(ctx sdk.Context, marketID string) (types.Current // IterateCurrentPrices iterates over all current price objects in the store and performs a callback function func (k Keeper) IterateCurrentPrices(ctx sdk.Context, cb func(cp types.CurrentPrice) (stop bool)) { - iterator := sdk.KVStorePrefixIterator(ctx.KVStore(k.key), types.CurrentPricePrefix) + iterator := storetypes.KVStorePrefixIterator(ctx.KVStore(k.key), types.CurrentPricePrefix) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { var cp types.CurrentPrice @@ -285,7 +286,7 @@ func (k Keeper) GetRawPrices(ctx sdk.Context, marketId string) types.PostedPrice // IterateRawPrices iterates over all raw prices in the store and performs a callback function func (k Keeper) IterateRawPricesByMarket(ctx sdk.Context, marketId string, cb func(record types.PostedPrice) (stop bool)) { - iterator := sdk.KVStorePrefixIterator(ctx.KVStore(k.key), types.RawPriceIteratorKey((marketId))) + iterator := storetypes.KVStorePrefixIterator(ctx.KVStore(k.key), types.RawPriceIteratorKey((marketId))) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { var record types.PostedPrice diff --git a/x/pricefeed/keeper/keeper_test.go b/x/pricefeed/keeper/keeper_test.go index ec7289a2ac..183d3f2059 100644 --- a/x/pricefeed/keeper/keeper_test.go +++ b/x/pricefeed/keeper/keeper_test.go @@ -9,8 +9,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" - tmprototypes "github.com/cometbft/cometbft/proto/tendermint/types" - "github.com/kava-labs/kava/app" "github.com/kava-labs/kava/x/pricefeed/keeper" "github.com/kava-labs/kava/x/pricefeed/testutil" @@ -20,7 +18,7 @@ import ( // TestKeeper_SetGetMarket tests adding markets to the pricefeed, getting markets from the store func TestKeeper_SetGetMarket(t *testing.T) { tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmprototypes.Header{}) + ctx := tApp.NewContextLegacy(true) keeper := tApp.GetPriceFeedKeeper() mp := types.Params{ @@ -59,7 +57,7 @@ func TestKeeper_SetGetMarket(t *testing.T) { func TestKeeper_GetSetPrice(t *testing.T) { _, addrs := app.GeneratePrivKeyAddressPairs(2) tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmprototypes.Header{}) + ctx := tApp.NewContextLegacy(true) keeper := tApp.GetPriceFeedKeeper() mp := types.Params{ @@ -72,12 +70,12 @@ func TestKeeper_GetSetPrice(t *testing.T) { prices := []struct { oracle sdk.AccAddress marketID string - price sdk.Dec + price sdkmath.LegacyDec total int }{ - {addrs[0], "tstusd", sdk.MustNewDecFromStr("0.33"), 1}, - {addrs[1], "tstusd", sdk.MustNewDecFromStr("0.35"), 2}, - {addrs[0], "tstusd", sdk.MustNewDecFromStr("0.37"), 2}, + {addrs[0], "tstusd", sdkmath.LegacyMustNewDecFromStr("0.33"), 1}, + {addrs[1], "tstusd", sdkmath.LegacyMustNewDecFromStr("0.35"), 2}, + {addrs[0], "tstusd", sdkmath.LegacyMustNewDecFromStr("0.37"), 2}, } for _, p := range prices { @@ -111,7 +109,7 @@ func TestKeeper_GetSetPrice(t *testing.T) { func TestKeeper_GetSetCurrentPrice(t *testing.T) { _, addrs := app.GeneratePrivKeyAddressPairs(5) tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmprototypes.Header{}). + ctx := tApp.NewContextLegacy(true). WithBlockTime(time.Now().UTC()) keeper := tApp.GetPriceFeedKeeper() @@ -124,33 +122,33 @@ func TestKeeper_GetSetCurrentPrice(t *testing.T) { _, err := keeper.SetPrice( ctx, addrs[0], "tstusd", - sdk.MustNewDecFromStr("0.33"), + sdkmath.LegacyMustNewDecFromStr("0.33"), time.Now().Add(time.Hour*1)) require.NoError(t, err) _, err = keeper.SetPrice( ctx, addrs[1], "tstusd", - sdk.MustNewDecFromStr("0.35"), + sdkmath.LegacyMustNewDecFromStr("0.35"), time.Now().Add(time.Hour*1)) require.NoError(t, err) _, err = keeper.SetPrice( ctx, addrs[2], "tstusd", - sdk.MustNewDecFromStr("0.34"), + sdkmath.LegacyMustNewDecFromStr("0.34"), time.Now().Add(time.Hour*1)) require.NoError(t, err) // Add an expired one which should fail _, err = keeper.SetPrice( ctx, addrs[3], "tstusd", - sdk.MustNewDecFromStr("0.9"), + sdkmath.LegacyMustNewDecFromStr("0.9"), ctx.BlockTime().Add(-time.Hour*1)) require.Error(t, err) // Add a non-expired price, but will not be counted when BlockTime is changed _, err = keeper.SetPrice( ctx, addrs[3], "tstusd", - sdk.MustNewDecFromStr("0.9"), + sdkmath.LegacyMustNewDecFromStr("0.9"), time.Now().Add(time.Minute*30)) require.NoError(t, err) @@ -165,7 +163,7 @@ func TestKeeper_GetSetCurrentPrice(t *testing.T) { price, err := keeper.GetCurrentPrice(ctx, "tstusd") require.Nil(t, err) - expCurPrice := sdk.MustNewDecFromStr("0.34") + expCurPrice := sdkmath.LegacyMustNewDecFromStr("0.34") require.Truef( t, price.Price.Equal(expCurPrice), @@ -176,7 +174,7 @@ func TestKeeper_GetSetCurrentPrice(t *testing.T) { // Even number of oracles _, err = keeper.SetPrice( ctx, addrs[4], "tstusd", - sdk.MustNewDecFromStr("0.36"), + sdkmath.LegacyMustNewDecFromStr("0.36"), time.Now().Add(time.Hour*1)) require.NoError(t, err) @@ -186,7 +184,7 @@ func TestKeeper_GetSetCurrentPrice(t *testing.T) { price, err = keeper.GetCurrentPrice(ctx, "tstusd") require.Nil(t, err) - exp := sdk.MustNewDecFromStr("0.345") + exp := sdkmath.LegacyMustNewDecFromStr("0.345") require.Truef(t, price.Price.Equal(exp), "current price %s should be %s", price.Price.String(), @@ -201,7 +199,7 @@ func TestKeeper_GetSetCurrentPrice(t *testing.T) { func TestKeeper_ExpiredSetCurrentPrices(t *testing.T) { _, addrs := app.GeneratePrivKeyAddressPairs(5) tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmprototypes.Header{}). + ctx := tApp.NewContextLegacy(true). WithBlockTime(time.Now().UTC()) keeper := tApp.GetPriceFeedKeeper() @@ -214,19 +212,19 @@ func TestKeeper_ExpiredSetCurrentPrices(t *testing.T) { _, err := keeper.SetPrice( ctx, addrs[0], "tstusd", - sdk.MustNewDecFromStr("0.33"), + sdkmath.LegacyMustNewDecFromStr("0.33"), time.Now().Add(time.Hour*1)) require.NoError(t, err) _, err = keeper.SetPrice( ctx, addrs[1], "tstusd", - sdk.MustNewDecFromStr("0.35"), + sdkmath.LegacyMustNewDecFromStr("0.35"), time.Now().Add(time.Hour*1)) require.NoError(t, err) _, err = keeper.SetPrice( ctx, addrs[2], "tstusd", - sdk.MustNewDecFromStr("0.34"), + sdkmath.LegacyMustNewDecFromStr("0.34"), time.Now().Add(time.Hour*1)) require.NoError(t, err) diff --git a/x/pricefeed/keeper/msg_server_test.go b/x/pricefeed/keeper/msg_server_test.go index 2ffcd8bbfa..adc036df18 100644 --- a/x/pricefeed/keeper/msg_server_test.go +++ b/x/pricefeed/keeper/msg_server_test.go @@ -4,7 +4,6 @@ import ( "testing" "time" - tmprototypes "github.com/cometbft/cometbft/proto/tendermint/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/kava-labs/kava/app" "github.com/kava-labs/kava/x/pricefeed/keeper" @@ -15,7 +14,7 @@ import ( func TestKeeper_PostPrice(t *testing.T) { _, addrs := app.GeneratePrivKeyAddressPairs(4) tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmprototypes.Header{}). + ctx := tApp.NewContextLegacy(true). WithBlockTime(time.Now().UTC()) k := tApp.GetPriceFeedKeeper() msgSrv := keeper.NewMsgServerImpl(k) @@ -49,7 +48,7 @@ func TestKeeper_PostPrice(t *testing.T) { for _, tt := range tests { t.Run(tt.giveMsg, func(t *testing.T) { // Use MsgServer over keeper methods directly to tests against valid oracles - msg := types.NewMsgPostPrice(tt.giveOracle.String(), tt.giveMarketId, sdk.MustNewDecFromStr("0.5"), tt.giveExpiry) + msg := types.NewMsgPostPrice(tt.giveOracle.String(), tt.giveMarketId, sdkmath.LegacyMustNewDecFromStr("0.5"), tt.giveExpiry) _, err := msgSrv.PostPrice(sdk.WrapSDKContext(ctx), msg) if tt.wantAccepted { diff --git a/x/pricefeed/keeper/params_test.go b/x/pricefeed/keeper/params_test.go index ffad3c889d..b233cf910a 100644 --- a/x/pricefeed/keeper/params_test.go +++ b/x/pricefeed/keeper/params_test.go @@ -25,7 +25,7 @@ type KeeperTestSuite struct { func (suite *KeeperTestSuite) SetupTest() { tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmprototypes.Header{Height: 1, Time: tmtime.Now()}) + ctx := tApp.NewContextLegacy(true, tmprototypes.Header{Height: 1, Time: tmtime.Now()}) tApp.InitializeFromGenesisStates( NewPricefeedGenStateMulti(), ) diff --git a/x/pricefeed/legacy/v0_15/types.go b/x/pricefeed/legacy/v0_15/types.go index 0a9b672251..fa44de049f 100644 --- a/x/pricefeed/legacy/v0_15/types.go +++ b/x/pricefeed/legacy/v0_15/types.go @@ -39,8 +39,8 @@ type PostedPrices []PostedPrice // PostedPrice price for market posted by a specific oracle type PostedPrice struct { - MarketID string `json:"market_id" yaml:"market_id"` - OracleAddress sdk.AccAddress `json:"oracle_address" yaml:"oracle_address"` - Price sdk.Dec `json:"price" yaml:"price"` - Expiry time.Time `json:"expiry" yaml:"expiry"` + MarketID string `json:"market_id" yaml:"market_id"` + OracleAddress sdk.AccAddress `json:"oracle_address" yaml:"oracle_address"` + Price sdkmath.LegacyDec `json:"price" yaml:"price"` + Expiry time.Time `json:"expiry" yaml:"expiry"` } diff --git a/x/pricefeed/legacy/v0_16/migrate_test.go b/x/pricefeed/legacy/v0_16/migrate_test.go index 81f2e12039..a2ca881a20 100644 --- a/x/pricefeed/legacy/v0_16/migrate_test.go +++ b/x/pricefeed/legacy/v0_16/migrate_test.go @@ -319,13 +319,13 @@ func (s *migrateTestSuite) TestMigrate_PostedPrices() { { MarketID: "market-1", OracleAddress: s.addresses[0], - Price: sdk.MustNewDecFromStr("1.2"), + Price: sdkmath.LegacyMustNewDecFromStr("1.2"), Expiry: time.Date(2020, time.January, 1, 0, 0, 0, 0, time.UTC), }, { MarketID: "market-2", OracleAddress: s.addresses[1], - Price: sdk.MustNewDecFromStr("1.899"), + Price: sdkmath.LegacyMustNewDecFromStr("1.899"), Expiry: time.Date(2021, time.January, 1, 0, 0, 0, 0, time.UTC), }, } @@ -333,13 +333,13 @@ func (s *migrateTestSuite) TestMigrate_PostedPrices() { { MarketID: "market-1", OracleAddress: s.addresses[0], - Price: sdk.MustNewDecFromStr("1.2"), + Price: sdkmath.LegacyMustNewDecFromStr("1.2"), Expiry: time.Date(2020, time.January, 1, 0, 0, 0, 0, time.UTC), }, { MarketID: "market-2", OracleAddress: s.addresses[1], - Price: sdk.MustNewDecFromStr("1.899"), + Price: sdkmath.LegacyMustNewDecFromStr("1.899"), Expiry: time.Date(2021, time.January, 1, 0, 0, 0, 0, time.UTC), }, } diff --git a/x/pricefeed/module.go b/x/pricefeed/module.go index 11ceb784b4..31230626f5 100644 --- a/x/pricefeed/module.go +++ b/x/pricefeed/module.go @@ -133,12 +133,17 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw } // BeginBlock module begin-block -func (am AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) { +func (am AppModule) BeginBlock(_ sdk.Context) error { + return nil } // EndBlock module end-block -func (am AppModule) EndBlock(ctx sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { +func (am AppModule) EndBlock(ctx sdk.Context) ([]abci.ValidatorUpdate, error) { EndBlocker(ctx, am.keeper) - return []abci.ValidatorUpdate{} + return []abci.ValidatorUpdate{}, nil } + +func (AppModule) IsOnePerModuleType() {} + +func (AppModule) IsAppModule() {} diff --git a/x/pricefeed/spec/02_state.md b/x/pricefeed/spec/02_state.md index 6fd95426f9..1b74c69ac9 100644 --- a/x/pricefeed/spec/02_state.md +++ b/x/pricefeed/spec/02_state.md @@ -39,7 +39,7 @@ type GenesisState struct { type PostedPrice struct { MarketID string `json:"market_id" yaml:"market_id"` OracleAddress sdk.AccAddress `json:"oracle_address" yaml:"oracle_address"` - Price sdk.Dec `json:"price" yaml:"price"` + Price sdkmath.LegacyDec `json:"price" yaml:"price"` Expiry time.Time `json:"expiry" yaml:"expiry"` } diff --git a/x/pricefeed/spec/03_messages.md b/x/pricefeed/spec/03_messages.md index fb26c47eb6..696e200002 100644 --- a/x/pricefeed/spec/03_messages.md +++ b/x/pricefeed/spec/03_messages.md @@ -14,7 +14,7 @@ An authorized oraclef for a particular market can post the current price for tha type MsgPostPrice struct { From sdk.AccAddress `json:"from" yaml:"from"` // client that sent in this address MarketID string `json:"market_id" yaml:"market_id"` // asset code used by exchanges/api - Price sdk.Dec `json:"price" yaml:"price"` // price in decimal (max precision 18) + Price sdkmath.LegacyDec `json:"price" yaml:"price"` // price in decimal (max precision 18) Expiry time.Time `json:"expiry" yaml:"expiry"` // expiry time } ``` diff --git a/x/pricefeed/testutil/helpers.go b/x/pricefeed/testutil/helpers.go index 76db45f16c..1306b7b2e3 100644 --- a/x/pricefeed/testutil/helpers.go +++ b/x/pricefeed/testutil/helpers.go @@ -4,7 +4,6 @@ import ( "testing" "time" - tmprototypes "github.com/cometbft/cometbft/proto/tendermint/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -17,7 +16,7 @@ import ( func SetCurrentPrices_PriceCalculations(t *testing.T, f func(ctx sdk.Context, keeper keeper.Keeper)) { _, addrs := app.GeneratePrivKeyAddressPairs(5) tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmprototypes.Header{}). + ctx := tApp.NewContextLegacy(true). WithBlockTime(time.Now().UTC()) keeper := tApp.GetPriceFeedKeeper() @@ -41,13 +40,13 @@ func SetCurrentPrices_PriceCalculations(t *testing.T, f func(ctx sdk.Context, ke blockTime := time.Now() initialPriceExpiry := blockTime.Add(1 * time.Hour) - _, err := keeper.SetPrice(ctx, addrs[0], "asset1:usd", sdk.MustNewDecFromStr("1"), initialPriceExpiry) + _, err := keeper.SetPrice(ctx, addrs[0], "asset1:usd", sdkmath.LegacyMustNewDecFromStr("1"), initialPriceExpiry) require.NoError(t, err) - _, err = keeper.SetPrice(ctx, addrs[0], "asset2:usd", sdk.MustNewDecFromStr("1"), initialPriceExpiry) + _, err = keeper.SetPrice(ctx, addrs[0], "asset2:usd", sdkmath.LegacyMustNewDecFromStr("1"), initialPriceExpiry) require.NoError(t, err) - _, err = keeper.SetPrice(ctx, addrs[0], "asset4:usd", sdk.MustNewDecFromStr("1"), initialPriceExpiry) + _, err = keeper.SetPrice(ctx, addrs[0], "asset4:usd", sdkmath.LegacyMustNewDecFromStr("1"), initialPriceExpiry) require.NoError(t, err) - _, err = keeper.SetPrice(ctx, addrs[0], "asset5:usd", sdk.MustNewDecFromStr("10"), initialPriceExpiry) + _, err = keeper.SetPrice(ctx, addrs[0], "asset5:usd", sdkmath.LegacyMustNewDecFromStr("10"), initialPriceExpiry) require.NoError(t, err) ctx = ctx.WithBlockTime(blockTime) @@ -56,7 +55,7 @@ func SetCurrentPrices_PriceCalculations(t *testing.T, f func(ctx sdk.Context, ke // price should be set price, err := keeper.GetCurrentPrice(ctx, "asset1:usd") require.NoError(t, err) - require.Equal(t, sdk.OneDec(), price.Price) + require.Equal(t, sdkmath.LegacyOneDec(), price.Price) // not an active market, so price is not set price, err = keeper.GetCurrentPrice(ctx, "asset2:usd") require.Equal(t, types.ErrNoValidPrice, err) @@ -66,16 +65,16 @@ func SetCurrentPrices_PriceCalculations(t *testing.T, f func(ctx sdk.Context, ke // price set initially price, err = keeper.GetCurrentPrice(ctx, "asset4:usd") require.NoError(t, err) - require.Equal(t, sdk.OneDec(), price.Price) + require.Equal(t, sdkmath.LegacyOneDec(), price.Price) price, err = keeper.GetCurrentPrice(ctx, "asset5:usd") require.NoError(t, err) - require.Equal(t, sdk.MustNewDecFromStr("10.0"), price.Price) + require.Equal(t, sdkmath.LegacyMustNewDecFromStr("10.0"), price.Price) - _, err = keeper.SetPrice(ctx, addrs[1], "asset1:usd", sdk.MustNewDecFromStr("2"), initialPriceExpiry.Add(1*time.Hour)) + _, err = keeper.SetPrice(ctx, addrs[1], "asset1:usd", sdkmath.LegacyMustNewDecFromStr("2"), initialPriceExpiry.Add(1*time.Hour)) require.NoError(t, err) - _, err = keeper.SetPrice(ctx, addrs[1], "asset2:usd", sdk.MustNewDecFromStr("2"), initialPriceExpiry.Add(1*time.Hour)) + _, err = keeper.SetPrice(ctx, addrs[1], "asset2:usd", sdkmath.LegacyMustNewDecFromStr("2"), initialPriceExpiry.Add(1*time.Hour)) require.NoError(t, err) - _, err = keeper.SetPrice(ctx, addrs[1], "asset5:usd", sdk.MustNewDecFromStr("20"), initialPriceExpiry.Add(1*time.Hour)) + _, err = keeper.SetPrice(ctx, addrs[1], "asset5:usd", sdkmath.LegacyMustNewDecFromStr("20"), initialPriceExpiry.Add(1*time.Hour)) require.NoError(t, err) blockTime = blockTime.Add(30 * time.Minute) @@ -85,7 +84,7 @@ func SetCurrentPrices_PriceCalculations(t *testing.T, f func(ctx sdk.Context, ke // price should be set price, err = keeper.GetCurrentPrice(ctx, "asset1:usd") require.NoError(t, err) - require.Equal(t, sdk.MustNewDecFromStr("1.5"), price.Price) + require.Equal(t, sdkmath.LegacyMustNewDecFromStr("1.5"), price.Price) // not an active market, so price is not set price, err = keeper.GetCurrentPrice(ctx, "asset2:usd") require.Equal(t, types.ErrNoValidPrice, err) @@ -95,16 +94,16 @@ func SetCurrentPrices_PriceCalculations(t *testing.T, f func(ctx sdk.Context, ke // price set initially price, err = keeper.GetCurrentPrice(ctx, "asset4:usd") require.NoError(t, err) - require.Equal(t, sdk.OneDec(), price.Price) + require.Equal(t, sdkmath.LegacyOneDec(), price.Price) price, err = keeper.GetCurrentPrice(ctx, "asset5:usd") require.NoError(t, err) - require.Equal(t, sdk.MustNewDecFromStr("15.0"), price.Price) + require.Equal(t, sdkmath.LegacyMustNewDecFromStr("15.0"), price.Price) - _, err = keeper.SetPrice(ctx, addrs[2], "asset1:usd", sdk.MustNewDecFromStr("30"), initialPriceExpiry.Add(1*time.Hour)) + _, err = keeper.SetPrice(ctx, addrs[2], "asset1:usd", sdkmath.LegacyMustNewDecFromStr("30"), initialPriceExpiry.Add(1*time.Hour)) require.NoError(t, err) - _, err = keeper.SetPrice(ctx, addrs[2], "asset2:usd", sdk.MustNewDecFromStr("30"), initialPriceExpiry.Add(1*time.Hour)) + _, err = keeper.SetPrice(ctx, addrs[2], "asset2:usd", sdkmath.LegacyMustNewDecFromStr("30"), initialPriceExpiry.Add(1*time.Hour)) require.NoError(t, err) - _, err = keeper.SetPrice(ctx, addrs[2], "asset5:usd", sdk.MustNewDecFromStr("30"), initialPriceExpiry.Add(1*time.Hour)) + _, err = keeper.SetPrice(ctx, addrs[2], "asset5:usd", sdkmath.LegacyMustNewDecFromStr("30"), initialPriceExpiry.Add(1*time.Hour)) require.NoError(t, err) blockTime = blockTime.Add(15 * time.Minute) @@ -114,7 +113,7 @@ func SetCurrentPrices_PriceCalculations(t *testing.T, f func(ctx sdk.Context, ke // price should be set price, err = keeper.GetCurrentPrice(ctx, "asset1:usd") require.NoError(t, err) - require.Equal(t, sdk.MustNewDecFromStr("2.0"), price.Price) + require.Equal(t, sdkmath.LegacyMustNewDecFromStr("2.0"), price.Price) // not an active market, so price is not set price, err = keeper.GetCurrentPrice(ctx, "asset2:usd") require.Equal(t, types.ErrNoValidPrice, err) @@ -124,10 +123,10 @@ func SetCurrentPrices_PriceCalculations(t *testing.T, f func(ctx sdk.Context, ke // price set initially price, err = keeper.GetCurrentPrice(ctx, "asset4:usd") require.NoError(t, err) - require.Equal(t, sdk.OneDec(), price.Price) + require.Equal(t, sdkmath.LegacyOneDec(), price.Price) price, err = keeper.GetCurrentPrice(ctx, "asset5:usd") require.NoError(t, err) - require.Equal(t, sdk.MustNewDecFromStr("20.0"), price.Price) + require.Equal(t, sdkmath.LegacyMustNewDecFromStr("20.0"), price.Price) blockTime = blockTime.Add(15 * time.Minute) ctx = ctx.WithBlockTime(blockTime) @@ -136,7 +135,7 @@ func SetCurrentPrices_PriceCalculations(t *testing.T, f func(ctx sdk.Context, ke // price should be set price, err = keeper.GetCurrentPrice(ctx, "asset1:usd") require.NoError(t, err) - require.Equal(t, sdk.MustNewDecFromStr("16"), price.Price) + require.Equal(t, sdkmath.LegacyMustNewDecFromStr("16"), price.Price) // not an active market, so price is not set price, err = keeper.GetCurrentPrice(ctx, "asset2:usd") require.Equal(t, types.ErrNoValidPrice, err) @@ -148,7 +147,7 @@ func SetCurrentPrices_PriceCalculations(t *testing.T, f func(ctx sdk.Context, ke require.Equal(t, types.ErrNoValidPrice, err) price, err = keeper.GetCurrentPrice(ctx, "asset5:usd") require.NoError(t, err) - require.Equal(t, sdk.MustNewDecFromStr("25.0"), price.Price) + require.Equal(t, sdkmath.LegacyMustNewDecFromStr("25.0"), price.Price) blockTime = blockTime.Add(10 * time.Hour) ctx = ctx.WithBlockTime(blockTime) @@ -170,7 +169,7 @@ func SetCurrentPrices_PriceCalculations(t *testing.T, f func(ctx sdk.Context, ke func SetCurrentPrices_EventEmission(t *testing.T, f func(ctx sdk.Context, keeper keeper.Keeper)) { _, addrs := app.GeneratePrivKeyAddressPairs(5) tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmprototypes.Header{}). + ctx := tApp.NewContextLegacy(true). WithBlockTime(time.Now().UTC()) keeper := tApp.GetPriceFeedKeeper() @@ -185,7 +184,7 @@ func SetCurrentPrices_EventEmission(t *testing.T, f func(ctx sdk.Context, keeper initialPriceExpiry := blockTime.Add(1 * time.Hour) // post a price - _, err := keeper.SetPrice(ctx, addrs[0], "asset1:usd", sdk.MustNewDecFromStr("1"), initialPriceExpiry) + _, err := keeper.SetPrice(ctx, addrs[0], "asset1:usd", sdkmath.LegacyMustNewDecFromStr("1"), initialPriceExpiry) require.NoError(t, err) // reset context with fresh event manager @@ -196,7 +195,7 @@ func SetCurrentPrices_EventEmission(t *testing.T, f func(ctx sdk.Context, keeper require.Equal(t, 0, len(ctx.EventManager().Events())) // post same price from another oracle - _, err = keeper.SetPrice(ctx, addrs[1], "asset1:usd", sdk.MustNewDecFromStr("1"), initialPriceExpiry) + _, err = keeper.SetPrice(ctx, addrs[1], "asset1:usd", sdkmath.LegacyMustNewDecFromStr("1"), initialPriceExpiry) require.NoError(t, err) blockTime = blockTime.Add(10 * time.Second) @@ -207,11 +206,11 @@ func SetCurrentPrices_EventEmission(t *testing.T, f func(ctx sdk.Context, keeper require.Equal(t, 0, len(ctx.EventManager().Events())) // post price changes - _, err = keeper.SetPrice(ctx, addrs[2], "asset1:usd", sdk.MustNewDecFromStr("2"), initialPriceExpiry) + _, err = keeper.SetPrice(ctx, addrs[2], "asset1:usd", sdkmath.LegacyMustNewDecFromStr("2"), initialPriceExpiry) require.NoError(t, err) - _, err = keeper.SetPrice(ctx, addrs[3], "asset1:usd", sdk.MustNewDecFromStr("10"), initialPriceExpiry) + _, err = keeper.SetPrice(ctx, addrs[3], "asset1:usd", sdkmath.LegacyMustNewDecFromStr("10"), initialPriceExpiry) require.NoError(t, err) - _, err = keeper.SetPrice(ctx, addrs[4], "asset1:usd", sdk.MustNewDecFromStr("10"), initialPriceExpiry) + _, err = keeper.SetPrice(ctx, addrs[4], "asset1:usd", sdkmath.LegacyMustNewDecFromStr("10"), initialPriceExpiry) require.NoError(t, err) blockTime = blockTime.Add(10 * time.Second) @@ -232,5 +231,5 @@ func SetCurrentPrices_EventEmission(t *testing.T, f func(ctx sdk.Context, keeper require.True(t, found) // attributes have correct values assert.Equal(t, "asset1:usd", marketID.Value) - assert.Equal(t, sdk.MustNewDecFromStr("2").String(), marketPrice.Value) + assert.Equal(t, sdkmath.LegacyMustNewDecFromStr("2").String(), marketPrice.Value) } diff --git a/x/pricefeed/types/codec.go b/x/pricefeed/types/codec.go index 2ac8f712c0..b03ea1acc6 100644 --- a/x/pricefeed/types/codec.go +++ b/x/pricefeed/types/codec.go @@ -6,7 +6,6 @@ import ( cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/msgservice" - authzcodec "github.com/cosmos/cosmos-sdk/x/authz/codec" ) // RegisterLegacyAminoCodec registers all the necessary types and interfaces for the @@ -34,5 +33,5 @@ func init() { // Register all Amino interfaces and concrete types on the authz Amino codec so that this can later be // used to properly serialize MsgGrant and MsgExec instances - RegisterLegacyAminoCodec(authzcodec.Amino) + RegisterLegacyAminoCodec(codec.NewLegacyAmino()) } diff --git a/x/pricefeed/types/genesis_test.go b/x/pricefeed/types/genesis_test.go index acdc45b3a9..38a5b6a61d 100644 --- a/x/pricefeed/types/genesis_test.go +++ b/x/pricefeed/types/genesis_test.go @@ -34,7 +34,7 @@ func TestGenesisStateValidate(t *testing.T) { NewParams([]Market{ {"market", "xrp", "bnb", []sdk.AccAddress{addr}, true}, }), - []PostedPrice{NewPostedPrice("xrp", addr, sdk.OneDec(), now)}, + []PostedPrice{NewPostedPrice("xrp", addr, sdkmath.LegacyOneDec(), now)}, ), expPass: true, }, @@ -44,7 +44,7 @@ func TestGenesisStateValidate(t *testing.T) { NewParams([]Market{ {"", "xrp", "bnb", []sdk.AccAddress{addr}, true}, }), - []PostedPrice{NewPostedPrice("xrp", addr, sdk.OneDec(), now)}, + []PostedPrice{NewPostedPrice("xrp", addr, sdkmath.LegacyOneDec(), now)}, ), expPass: false, }, @@ -55,7 +55,7 @@ func TestGenesisStateValidate(t *testing.T) { {"market", "xrp", "bnb", []sdk.AccAddress{addr}, true}, {"market", "xrp", "bnb", []sdk.AccAddress{addr}, true}, }), - []PostedPrice{NewPostedPrice("xrp", addr, sdk.OneDec(), now)}, + []PostedPrice{NewPostedPrice("xrp", addr, sdkmath.LegacyOneDec(), now)}, ), expPass: false, }, @@ -63,7 +63,7 @@ func TestGenesisStateValidate(t *testing.T) { msg: "invalid posted price", genesisState: NewGenesisState( NewParams([]Market{}), - []PostedPrice{NewPostedPrice("xrp", nil, sdk.OneDec(), now)}, + []PostedPrice{NewPostedPrice("xrp", nil, sdkmath.LegacyOneDec(), now)}, ), expPass: false, }, @@ -72,8 +72,8 @@ func TestGenesisStateValidate(t *testing.T) { genesisState: NewGenesisState( NewParams([]Market{}), []PostedPrice{ - NewPostedPrice("xrp", addr, sdk.OneDec(), now), - NewPostedPrice("xrp", addr, sdk.OneDec(), now), + NewPostedPrice("xrp", addr, sdkmath.LegacyOneDec(), now), + NewPostedPrice("xrp", addr, sdkmath.LegacyOneDec(), now), }, ), expPass: false, diff --git a/x/pricefeed/types/market.go b/x/pricefeed/types/market.go index 923260fa39..f6f9891d72 100644 --- a/x/pricefeed/types/market.go +++ b/x/pricefeed/types/market.go @@ -1,6 +1,7 @@ package types import ( + sdkmath "cosmossdk.io/math" "errors" "fmt" "strings" @@ -88,7 +89,7 @@ func NewMarketResponse(id, base, quote string, oracles []sdk.AccAddress, active type MarketResponses []MarketResponse // NewCurrentPrice returns an instance of CurrentPrice -func NewCurrentPrice(marketID string, price sdk.Dec) CurrentPrice { +func NewCurrentPrice(marketID string, price sdkmath.LegacyDec) CurrentPrice { return CurrentPrice{MarketID: marketID, Price: price} } @@ -96,7 +97,7 @@ func NewCurrentPrice(marketID string, price sdk.Dec) CurrentPrice { type CurrentPrices []CurrentPrice // NewCurrentPriceResponse returns an instance of CurrentPriceResponse -func NewCurrentPriceResponse(marketID string, price sdk.Dec) CurrentPriceResponse { +func NewCurrentPriceResponse(marketID string, price sdkmath.LegacyDec) CurrentPriceResponse { return CurrentPriceResponse{MarketID: marketID, Price: price} } @@ -104,7 +105,7 @@ func NewCurrentPriceResponse(marketID string, price sdk.Dec) CurrentPriceRespons type CurrentPriceResponses []CurrentPriceResponse // NewPostedPrice returns a new PostedPrice -func NewPostedPrice(marketID string, oracle sdk.AccAddress, price sdk.Dec, expiry time.Time) PostedPrice { +func NewPostedPrice(marketID string, oracle sdk.AccAddress, price sdkmath.LegacyDec, expiry time.Time) PostedPrice { return PostedPrice{ MarketID: marketID, OracleAddress: oracle, @@ -152,7 +153,7 @@ func (pps PostedPrices) Validate() error { } // NewPostedPrice returns a new PostedPrice -func NewPostedPriceResponse(marketID string, oracle sdk.AccAddress, price sdk.Dec, expiry time.Time) PostedPriceResponse { +func NewPostedPriceResponse(marketID string, oracle sdk.AccAddress, price sdkmath.LegacyDec, expiry time.Time) PostedPriceResponse { return PostedPriceResponse{ MarketID: marketID, OracleAddress: oracle.String(), @@ -164,8 +165,8 @@ func NewPostedPriceResponse(marketID string, oracle sdk.AccAddress, price sdk.De // PostedPriceResponses is a slice of PostedPriceResponse type PostedPriceResponses []PostedPriceResponse -// SortDecs provides the interface needed to sort sdk.Dec slices -type SortDecs []sdk.Dec +// SortDecs provides the interface needed to sort sdkmath.LegacyDec slices +type SortDecs []sdkmath.LegacyDec func (a SortDecs) Len() int { return len(a) } func (a SortDecs) Swap(i, j int) { a[i], a[j] = a[j], a[i] } diff --git a/x/pricefeed/types/market_test.go b/x/pricefeed/types/market_test.go index 1dbcae875c..1e94a6be8b 100644 --- a/x/pricefeed/types/market_test.go +++ b/x/pricefeed/types/market_test.go @@ -109,7 +109,7 @@ func TestPostedPriceValidate(t *testing.T) { PostedPrice{ MarketID: "market", OracleAddress: addr, - Price: sdk.OneDec(), + Price: sdkmath.LegacyOneDec(), Expiry: now, }, true, @@ -134,7 +134,7 @@ func TestPostedPriceValidate(t *testing.T) { PostedPrice{ MarketID: "market", OracleAddress: addr, - Price: sdk.NewDec(-1), + Price: sdkmath.LegacyNewDec(-1), }, false, }, @@ -143,7 +143,7 @@ func TestPostedPriceValidate(t *testing.T) { PostedPrice{ MarketID: "market", OracleAddress: addr, - Price: sdk.OneDec(), + Price: sdkmath.LegacyOneDec(), Expiry: time.Time{}, }, false, diff --git a/x/pricefeed/types/msgs.go b/x/pricefeed/types/msgs.go index 57e3e8c3e0..aaf8e23ce3 100644 --- a/x/pricefeed/types/msgs.go +++ b/x/pricefeed/types/msgs.go @@ -1,6 +1,7 @@ package types import ( + sdkmath "cosmossdk.io/math" "errors" "fmt" "strings" @@ -23,7 +24,7 @@ const ( var _ sdk.Msg = &MsgPostPrice{} // NewMsgPostPrice returns a new MsgPostPrice -func NewMsgPostPrice(from string, marketID string, price sdk.Dec, expiry time.Time) *MsgPostPrice { +func NewMsgPostPrice(from string, marketID string, price sdkmath.LegacyDec, expiry time.Time) *MsgPostPrice { return &MsgPostPrice{ From: from, MarketID: marketID, diff --git a/x/pricefeed/types/msgs_test.go b/x/pricefeed/types/msgs_test.go index 9bbb84c76c..31f43cbff0 100644 --- a/x/pricefeed/types/msgs_test.go +++ b/x/pricefeed/types/msgs_test.go @@ -12,9 +12,9 @@ import ( func TestMsgPlaceBid_ValidateBasic(t *testing.T) { addr := sdk.AccAddress([]byte("someName")) - price, _ := sdk.NewDecFromStr("0.3005") + price, _ := sdkmath.LegacyNewDecFromStr("0.3005") expiry := tmtime.Now() - negativePrice, _ := sdk.NewDecFromStr("-3.05") + negativePrice, _ := sdkmath.LegacyNewDecFromStr("-3.05") tests := []struct { name string diff --git a/x/pricefeed/types/query.pb.go b/x/pricefeed/types/query.pb.go index a4111a2d50..50e8af5fde 100644 --- a/x/pricefeed/types/query.pb.go +++ b/x/pricefeed/types/query.pb.go @@ -5,8 +5,8 @@ package types import ( context "context" + cosmossdk_io_math "cosmossdk.io/math" fmt "fmt" - github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" @@ -494,10 +494,10 @@ var xxx_messageInfo_QueryMarketsResponse proto.InternalMessageInfo // PostedPriceResponse defines a price for market posted by a specific oracle. type PostedPriceResponse struct { - MarketID string `protobuf:"bytes,1,opt,name=market_id,json=marketId,proto3" json:"market_id,omitempty"` - OracleAddress string `protobuf:"bytes,2,opt,name=oracle_address,json=oracleAddress,proto3" json:"oracle_address,omitempty"` - Price github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=price,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"price"` - Expiry time.Time `protobuf:"bytes,4,opt,name=expiry,proto3,stdtime" json:"expiry"` + MarketID string `protobuf:"bytes,1,opt,name=market_id,json=marketId,proto3" json:"market_id,omitempty"` + OracleAddress string `protobuf:"bytes,2,opt,name=oracle_address,json=oracleAddress,proto3" json:"oracle_address,omitempty"` + Price cosmossdk_io_math.LegacyDec `protobuf:"bytes,3,opt,name=price,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"price"` + Expiry time.Time `protobuf:"bytes,4,opt,name=expiry,proto3,stdtime" json:"expiry"` } func (m *PostedPriceResponse) Reset() { *m = PostedPriceResponse{} } @@ -557,8 +557,8 @@ func (m *PostedPriceResponse) GetExpiry() time.Time { // CurrentPriceResponse defines a current price for a particular market in the pricefeed // module. type CurrentPriceResponse struct { - MarketID string `protobuf:"bytes,1,opt,name=market_id,json=marketId,proto3" json:"market_id,omitempty"` - Price github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=price,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"price"` + MarketID string `protobuf:"bytes,1,opt,name=market_id,json=marketId,proto3" json:"market_id,omitempty"` + Price cosmossdk_io_math.LegacyDec `protobuf:"bytes,2,opt,name=price,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"price"` } func (m *CurrentPriceResponse) Reset() { *m = CurrentPriceResponse{} } @@ -701,63 +701,63 @@ func init() { } var fileDescriptor_84567be3085e4c6c = []byte{ - // 884 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x95, 0xcf, 0x6f, 0x1b, 0x45, - 0x14, 0xc7, 0x3d, 0xa9, 0x7f, 0x4e, 0xa1, 0x88, 0xa9, 0x13, 0x2c, 0xd3, 0xee, 0x86, 0x95, 0x08, - 0x6d, 0x1c, 0xef, 0xaa, 0xa9, 0xa8, 0x50, 0xc5, 0xa5, 0x26, 0x07, 0x7a, 0xa8, 0x80, 0x15, 0x97, - 0x72, 0xb1, 0xc6, 0xde, 0xa9, 0xbb, 0x4a, 0xec, 0xd9, 0xec, 0x8c, 0xe3, 0x46, 0x08, 0x09, 0x21, - 0x24, 0xca, 0x01, 0x29, 0x82, 0x13, 0x37, 0xb8, 0x21, 0x24, 0xfe, 0x8f, 0x1c, 0x23, 0x71, 0x41, - 0x1c, 0x92, 0xe0, 0x70, 0xe3, 0x9f, 0x40, 0x3b, 0xf3, 0x76, 0xf1, 0x26, 0xde, 0x64, 0x2d, 0x4e, - 0xc9, 0xbe, 0x7d, 0x3f, 0x3e, 0xef, 0xbb, 0x33, 0x5f, 0x63, 0x6b, 0x9b, 0xee, 0x51, 0x27, 0x08, - 0xfd, 0x3e, 0x7b, 0xc6, 0x98, 0xe7, 0xec, 0xdd, 0xeb, 0x31, 0x49, 0xef, 0x39, 0xbb, 0x63, 0x16, - 0xee, 0xdb, 0x41, 0xc8, 0x25, 0x27, 0x2b, 0x51, 0x8e, 0x9d, 0xe4, 0xd8, 0x90, 0xd3, 0xac, 0x0f, - 0xf8, 0x80, 0xab, 0x14,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0xa2, - 0x2c, 0x0a, 0x00, 0x00, + // 883 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x95, 0x4d, 0x8f, 0xdb, 0x44, + 0x18, 0xc7, 0x33, 0xdb, 0xbc, 0x4e, 0xa1, 0x88, 0x69, 0x76, 0x89, 0xd2, 0xd6, 0x5e, 0x8c, 0x28, + 0xed, 0x66, 0x63, 0xab, 0x5b, 0x51, 0x41, 0xc5, 0xa5, 0xa1, 0x07, 0x2a, 0x51, 0x01, 0x16, 0x97, + 0x72, 0x89, 0x26, 0xf6, 0x34, 0x6b, 0xed, 0x26, 0xe3, 0xf5, 0x4c, 0x36, 0x8d, 0x00, 0x09, 0x21, + 0x0e, 0xe5, 0x80, 0x54, 0xc1, 0x89, 0x1b, 0xdc, 0x10, 0x12, 0xdf, 0xa3, 0xc7, 0x4a, 0x5c, 0x10, + 0x87, 0xed, 0x92, 0xe5, 0x83, 0x20, 0xcf, 0x3c, 0x36, 0xf1, 0x36, 0xde, 0x3a, 0xb7, 0xf8, 0x99, + 0xe7, 0xe5, 0x37, 0xff, 0x99, 0xf9, 0x07, 0x5b, 0x7b, 0xf4, 0x90, 0x3a, 0x61, 0x14, 0x78, 0xec, + 0x21, 0x63, 0xbe, 0x73, 0x78, 0x63, 0xc0, 0x24, 0xbd, 0xe1, 0x1c, 0x4c, 0x58, 0x34, 0xb3, 0xc3, + 0x88, 0x4b, 0x4e, 0x36, 0xe2, 0x1c, 0x3b, 0xcd, 0xb1, 0x21, 0xa7, 0xdd, 0x1c, 0xf2, 0x21, 0x57, + 0x29, 0x4e, 0xfc, 0x4b, 0x67, 0xb7, 0x2f, 0x0f, 0x39, 0x1f, 0xee, 0x33, 0x87, 0x86, 0x81, 0x43, + 0xc7, 0x63, 0x2e, 0xa9, 0x0c, 0xf8, 0x58, 0xc0, 0xaa, 0x09, 0xab, 0xea, 0x6b, 0x30, 0x79, 0xe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 0x01, 0x81, 0x34, 0xc0, 0xaf, 0x08, 0x37, 0x52, 0x3f, 0x25, 0xdd, 0x33, 0x47, + 0x9c, 0x36, 0xed, 0xb6, 0x5d, 0x34, 0x1d, 0xa0, 0xde, 0x55, 0x50, 0x0e, 0xe9, 0xe6, 0x41, 0x45, + 0x74, 0xba, 0x44, 0xaf, 0x9f, 0x11, 0xae, 0x81, 0x5f, 0x92, 0xb3, 0x45, 0xc8, 0xfa, 0x71, 0x7b, + 0xbb, 0x58, 0x32, 0xd0, 0xdd, 0x54, 0x74, 0x5d, 0xd2, 0xc9, 0xa3, 0x83, 0x27, 0x90, 0x61, 0xfb, + 0x01, 0xe1, 0x1a, 0x98, 0xef, 0x4b, 0xd8, 0xb2, 0xce, 0xfd, 0x12, 0xb6, 0x53, 0x7e, 0x6e, 0xbd, + 0xa3, 0xd8, 0xde, 0x24, 0x66, 0x1e, 0x1b, 0xb8, 0x73, 0xef, 0xfe, 0xf1, 0x3f, 0x06, 0xfa, 0x6d, + 0x6e, 0xa0, 0xa7, 0x73, 0x03, 0x3d, 0x9b, 0x1b, 0xe8, 0x78, 0x6e, 0xa0, 0x27, 0x27, 0x46, 0xe9, + 0xd9, 0x89, 0x51, 0xfa, 0xeb, 0xc4, 0x28, 0x7d, 0xd1, 0x19, 0x06, 0x72, 0x77, 0x32, 0xb0, 0x3d, + 0x3e, 0x52, 0xcd, 0xba, 0xfb, 0x74, 0x20, 0x74, 0xdb, 0x47, 0x0b, 0x8d, 0xe5, 0x2c, 0x64, 0x62, + 0x50, 0x55, 0x4e, 0x79, 0xf3, 0xbf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x73, 0x9f, 0xa5, 0xc7, 0x15, + 0x0a, 0x00, 0x00, } func (this *QueryParamsRequest) VerboseEqual(that interface{}) error { @@ -1890,6 +1890,7 @@ func _Query_Markets_Handler(srv interface{}, ctx context.Context, dec func(inter return interceptor(ctx, in, info, handler) } +var Query_serviceDesc = _Query_serviceDesc var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "kava.pricefeed.v1beta1.Query", HandlerType: (*QueryServer)(nil), diff --git a/x/pricefeed/types/store.pb.go b/x/pricefeed/types/store.pb.go index 6b8f2ae259..e5abf67fe1 100644 --- a/x/pricefeed/types/store.pb.go +++ b/x/pricefeed/types/store.pb.go @@ -5,6 +5,7 @@ package types import ( bytes "bytes" + cosmossdk_io_math "cosmossdk.io/math" fmt "fmt" _ "github.com/cosmos/cosmos-proto" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" @@ -156,7 +157,7 @@ func (m *Market) GetActive() bool { type PostedPrice struct { MarketID string `protobuf:"bytes,1,opt,name=market_id,json=marketId,proto3" json:"market_id,omitempty"` OracleAddress github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,2,opt,name=oracle_address,json=oracleAddress,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"oracle_address,omitempty"` - Price github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=price,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"price"` + Price cosmossdk_io_math.LegacyDec `protobuf:"bytes,3,opt,name=price,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"price"` Expiry time.Time `protobuf:"bytes,4,opt,name=expiry,proto3,stdtime" json:"expiry"` } @@ -217,8 +218,8 @@ func (m *PostedPrice) GetExpiry() time.Time { // CurrentPrice defines a current price for a particular market in the pricefeed // module. type CurrentPrice struct { - MarketID string `protobuf:"bytes,1,opt,name=market_id,json=marketId,proto3" json:"market_id,omitempty"` - Price github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=price,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"price"` + MarketID string `protobuf:"bytes,1,opt,name=market_id,json=marketId,proto3" json:"market_id,omitempty"` + Price cosmossdk_io_math.LegacyDec `protobuf:"bytes,2,opt,name=price,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"price"` } func (m *CurrentPrice) Reset() { *m = CurrentPrice{} } @@ -273,39 +274,40 @@ func init() { } var fileDescriptor_9df40639f5e16f9a = []byte{ - // 508 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x53, 0x3f, 0x6f, 0xd3, 0x40, - 0x14, 0xcf, 0x25, 0x6d, 0xfe, 0x5c, 0x02, 0x48, 0x06, 0x55, 0x26, 0x12, 0x76, 0x94, 0x01, 0x19, - 0xa1, 0x9c, 0xd5, 0xb2, 0xb2, 0xc4, 0x64, 0x20, 0x43, 0xa5, 0xc8, 0x30, 0xb1, 0x44, 0x67, 0xfb, - 0xd5, 0x58, 0x89, 0x39, 0x73, 0x77, 0x89, 0x9a, 0x89, 0xaf, 0xd0, 0x8f, 0x81, 0x90, 0xd8, 0xf8, - 0x10, 0x1d, 0x2b, 0x26, 0xc4, 0x90, 0x16, 0xe7, 0x03, 0xb0, 0x33, 0x21, 0xdf, 0xd9, 0x55, 0x07, - 0x06, 0x2a, 0x98, 0xee, 0xde, 0xef, 0xfd, 0xde, 0xbf, 0xdf, 0xbd, 0xc3, 0xc3, 0x05, 0x5d, 0x53, - 0x37, 0xe3, 0x49, 0x08, 0x27, 0x00, 0x91, 0xbb, 0x3e, 0x0c, 0x40, 0xd2, 0x43, 0x57, 0x48, 0xc6, - 0x81, 0x64, 0x9c, 0x49, 0x66, 0x1c, 0x14, 0x1c, 0x72, 0xcd, 0x21, 0x25, 0xa7, 0xff, 0x30, 0x64, - 0x22, 0x65, 0x62, 0xae, 0x58, 0xae, 0x36, 0x74, 0x48, 0xff, 0x41, 0xcc, 0x62, 0xa6, 0xf1, 0xe2, - 0x56, 0xa2, 0x76, 0xcc, 0x58, 0xbc, 0x04, 0x57, 0x59, 0xc1, 0xea, 0xc4, 0x95, 0x49, 0x0a, 0x42, - 0xd2, 0x34, 0xd3, 0x84, 0xe1, 0x2b, 0xdc, 0x9c, 0x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, 0xdb, - 0x8c, 0xcd, 0xf0, 0x5d, 0x9d, 0x7d, 0x4e, 0x75, 0x49, 0x35, 0xfa, 0xff, 0xec, 0xfe, 0x8e, 0xce, - 0x5f, 0x62, 0xc6, 0x04, 0xef, 0xab, 0x37, 0xd5, 0x12, 0x7a, 0xa4, 0x78, 0xc6, 0xef, 0x5b, 0xfb, - 0xf1, 0x5f, 0xd4, 0x9a, 0x40, 0xe8, 0xeb, 0x60, 0xe3, 0x39, 0x6e, 0xc2, 0x69, 0x96, 0xf0, 0x8d, - 0xb9, 0x37, 0x40, 0x4e, 0xf7, 0xa8, 0x4f, 0xf4, 0xaa, 0x91, 0x6a, 0xd5, 0xc8, 0xeb, 0x6a, 0xd5, - 0xbc, 0x76, 0x51, 0xe2, 0xec, 0xd2, 0x46, 0x7e, 0x19, 0x33, 0xfc, 0x80, 0x7b, 0x2f, 0x56, 0x9c, - 0xc3, 0x3b, 0x79, 0x6b, 0xbd, 0xae, 0xdb, 0xaf, 0xff, 0x43, 0xfb, 0xde, 0xf1, 0xd5, 0x0f, 0x0b, - 0x7d, 0xcc, 0x2d, 0x74, 0x9e, 0x5b, 0xe8, 0x22, 0xb7, 0xd0, 0x55, 0x6e, 0xa1, 0xb3, 0x9d, 0x55, - 0xbb, 0xd8, 0x59, 0xb5, 0x6f, 0x3b, 0xab, 0xf6, 0xe6, 0xe9, 0x8d, 0x84, 0xc5, 0x47, 0x18, 0x2d, - 0x69, 0x20, 0xd4, 0xcd, 0x3d, 0xbd, 0xf1, 0x7d, 0x55, 0xe6, 0xa0, 0xa9, 0xa6, 0x7e, 0xf6, 0x3b, - 0x00, 0x00, 0xff, 0xff, 0x18, 0xb5, 0x5b, 0xc1, 0xdd, 0x03, 0x00, 0x00, + // 523 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x53, 0xcf, 0x6e, 0xd3, 0x4e, + 0x10, 0xce, 0x26, 0x6d, 0xfe, 0x6c, 0xf2, 0xfb, 0x21, 0x19, 0x54, 0x99, 0x20, 0xec, 0x28, 0x5c, + 0x8c, 0x50, 0xd6, 0x6a, 0x39, 0x21, 0x71, 0x89, 0xe9, 0x81, 0x48, 0x54, 0x8a, 0x0c, 0x27, 0x2e, + 0xd1, 0xda, 0x9e, 0xba, 0x56, 0x62, 0xd6, 0xec, 0x6e, 0xa2, 0xe6, 0x2d, 0xfa, 0x0c, 0x9c, 0x10, + 0x67, 0x1e, 0xa2, 0xc7, 0x8a, 0x13, 0xe2, 0x90, 0x16, 0xe7, 0x01, 0xb8, 0x73, 0x42, 0xde, 0xb5, + 0xab, 0x1e, 0xb8, 0x44, 0xe2, 0xe4, 0x9d, 0x6f, 0xbe, 0x6f, 0x3c, 0xf3, 0xed, 0x2c, 0x1e, 0xce, + 0xe9, 0x8a, 0xba, 0x19, 0x4f, 0x42, 0x38, 0x05, 0x88, 0xdc, 0xd5, 0x61, 0x00, 0x92, 0x1e, 0xba, + 0x42, 0x32, 0x0e, 0x24, 0xe3, 0x4c, 0x32, 0xe3, 0xa0, 0xe0, 0x90, 0x5b, 0x0e, 0x29, 0x39, 0xfd, + 0x87, 0x21, 0x13, 0x29, 0x13, 0x33, 0xc5, 0x72, 0x75, 0xa0, 0x25, 0xfd, 0x07, 0x31, 0x8b, 0x99, + 0xc6, 0x8b, 0x53, 0x89, 0xda, 0x31, 0x63, 0xf1, 0x02, 0x5c, 0x15, 0x05, 0xcb, 0x53, 0x57, 0x26, + 0x29, 0x08, 0x49, 0xd3, 0x4c, 0x13, 0x86, 0x6f, 0x71, 0x73, 0x4a, 0x39, 0x4d, 0x85, 0x31, 0xc1, + 0xad, 0x94, 0xf2, 0x39, 0x48, 0x61, 0xa2, 0x41, 0xc3, 0xe9, 0x1e, 0x59, 0xe4, 0xef, 0x5d, 0x90, + 0x13, 0x45, 0xf3, 0xee, 0x5d, 0x6e, 0xec, 0xda, 0x97, 0x6b, 0xbb, 0xa5, 0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xd8, 0x8f, 0xb4, 0x54, 0x44, 0x73, 0x92, 0x30, 0x37, 0xa5, 0xf2, 0x8c, 0xbc, 0x81, + 0x98, 0x86, 0xeb, 0x63, 0x08, 0x7d, 0xad, 0x30, 0x5e, 0xe2, 0x26, 0x9c, 0x67, 0x09, 0x5f, 0x9b, + 0x7b, 0x03, 0xe4, 0x74, 0x8f, 0xfa, 0x44, 0xef, 0x17, 0xa9, 0xf6, 0x8b, 0xbc, 0xab, 0xf6, 0xcb, + 0x6b, 0x17, 0x75, 0x2f, 0xae, 0x6d, 0xe4, 0x97, 0x9a, 0xa1, 0xc4, 0xbd, 0x57, 0x4b, 0xce, 0xe1, + 0x83, 0xdc, 0xd9, 0xa4, 0xdb, 0x9e, 0xeb, 0xbb, 0xf6, 0xec, 0x9d, 0xdc, 0xfc, 0xb4, 0xd0, 0xe7, + 0xdc, 0x42, 0x97, 0xb9, 0x85, 0xae, 0x72, 0x0b, 0xdd, 0xe4, 0x16, 0xba, 0xd8, 0x5a, 0xb5, 0xab, + 0xad, 0x55, 0xfb, 0xbe, 0xb5, 0x6a, 0xef, 0x9f, 0xdd, 0x71, 0xb9, 0x58, 0xf9, 0xd1, 0x82, 0x06, + 0x42, 0x9d, 0xdc, 0xf3, 0x3b, 0x0f, 0x55, 0xd9, 0x1d, 0x34, 0xd5, 0xa8, 0xcf, 0xff, 0x04, 0x00, + 0x00, 0xff, 0xff, 0x33, 0x64, 0x10, 0x26, 0xc7, 0x03, 0x00, 0x00, } func (this *Params) VerboseEqual(that interface{}) error { diff --git a/x/pricefeed/types/tx.pb.go b/x/pricefeed/types/tx.pb.go index 358f29a7bb..98f989fdff 100644 --- a/x/pricefeed/types/tx.pb.go +++ b/x/pricefeed/types/tx.pb.go @@ -5,8 +5,8 @@ package types import ( context "context" + cosmossdk_io_math "cosmossdk.io/math" fmt "fmt" - github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" @@ -36,10 +36,10 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // MsgPostPrice represents a method for creating a new post price type MsgPostPrice struct { // address of client - From string `protobuf:"bytes,1,opt,name=from,proto3" json:"from,omitempty"` - MarketID string `protobuf:"bytes,2,opt,name=market_id,json=marketId,proto3" json:"market_id,omitempty"` - Price github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=price,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"price"` - Expiry time.Time `protobuf:"bytes,4,opt,name=expiry,proto3,stdtime" json:"expiry"` + From string `protobuf:"bytes,1,opt,name=from,proto3" json:"from,omitempty"` + MarketID string `protobuf:"bytes,2,opt,name=market_id,json=marketId,proto3" json:"market_id,omitempty"` + Price cosmossdk_io_math.LegacyDec `protobuf:"bytes,3,opt,name=price,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"price"` + Expiry time.Time `protobuf:"bytes,4,opt,name=expiry,proto3,stdtime" json:"expiry"` } func (m *MsgPostPrice) Reset() { *m = MsgPostPrice{} } @@ -120,31 +120,31 @@ func init() { func init() { proto.RegisterFile("kava/pricefeed/v1beta1/tx.proto", fileDescriptor_afd93c8e4685da16) } var fileDescriptor_afd93c8e4685da16 = []byte{ - // 370 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0xbd, 0x6e, 0xea, 0x30, - 0x14, 0x80, 0xe3, 0x0b, 0x17, 0x81, 0x2f, 0x53, 0x84, 0x50, 0x94, 0xc1, 0x41, 0xe8, 0xaa, 0xa2, - 0x6a, 0xb1, 0x05, 0xdd, 0xaa, 0x4e, 0x88, 0x85, 0x21, 0x12, 0x8a, 0x3a, 0x75, 0x41, 0xf9, 0x71, - 0xd2, 0x08, 0x52, 0x47, 0xb1, 0x41, 0xf0, 0x06, 0x1d, 0x79, 0x84, 0x8e, 0x7d, 0x14, 0x46, 0xb6, - 0x56, 0x1d, 0x28, 0x0d, 0x2f, 0x52, 0xc5, 0x81, 0x36, 0x43, 0x87, 0x4e, 0x39, 0xf1, 0xf9, 0xce, - 0x39, 0xfe, 0x8e, 0x0c, 0x8d, 0xa9, 0xbd, 0xb0, 0x49, 0x9c, 0x84, 0x2e, 0xf5, 0x29, 0xf5, 0xc8, - 0xa2, 0xe7, 0x50, 0x61, 0xf7, 0x88, 0x58, 0xe2, 0x38, 0x61, 0x82, 0xa9, 0xcd, 0x0c, 0xc0, 0x5f, - 0x00, 0x3e, 0x02, 0x7a, 0x23, 0x60, 0x01, 0x93, 0x08, 0xc9, 0xa2, 0x9c, 0xd6, 0x8d, 0x80, 0xb1, - 0x60, 0x46, 0x89, 0xfc, 0x73, 0xe6, 0x3e, 0x11, 0x61, 0x44, 0xb9, 0xb0, 0xa3, 0x38, 0x07, 0xda, - 0x2f, 0x00, 0xd6, 0x4d, 0x1e, 0x8c, 0x19, 0x17, 0xe3, 0xac, 0xa7, 0xaa, 0xc2, 0xb2, 0x9f, 0xb0, - 0x48, 0x03, 0x2d, 0xd0, 0xa9, 0x59, 0x32, 0x56, 0xcf, 0x61, 0x2d, 0xb2, 0x93, 0x29, 0x15, 0x93, - 0xd0, 0xd3, 0xfe, 0x64, 0x89, 0x41, 0x3d, 0xdd, 0x19, 0x55, 0x53, 0x1e, 0x8e, 0x86, 0x56, 0x35, - 0x4f, 0x8f, 0x3c, 0x75, 0x08, 0xff, 0xca, 0xbb, 0x69, 0x25, 0x89, 0xe1, 0xcd, 0xce, 0x50, 0xde, - 0x76, 0xc6, 0x59, 0x10, 0x8a, 0xfb, 0xb9, 0x83, 0x5d, 0x16, 0x11, 0x97, 0xf1, 0x88, 0xf1, 0xe3, - 0xa7, 0xcb, 0xbd, 0x29, 0x11, 0xab, 0x98, 0x72, 0x3c, 0xa4, 0xae, 0x95, 0x17, 0xab, 0x37, 0xb0, - 0x42, 0x97, 0x71, 0x98, 0xac, 0xb4, 0x72, 0x0b, 0x74, 0xfe, 0xf5, 0x75, 0x9c, 0x7b, 0xe0, 0x93, - 0x07, 0xbe, 0x3d, 0x79, 0x0c, 0xaa, 0xd9, 0x88, 0xf5, 0xbb, 0x01, 0xac, 0x63, 0xcd, 0x75, 0xf9, - 0xf1, 0xc9, 0x50, 0xda, 0x4d, 0xd8, 0x28, 0x8a, 0x59, 0x94, 0xc7, 0xec, 0x81, 0xd3, 0xbe, 0x0f, - 0x4b, 0x26, 0x0f, 0xd4, 0x09, 0xac, 0x7d, 0x4b, 0xff, 0xc7, 0x3f, 0x6f, 0x15, 0x17, 0x3b, 0xe8, - 0x97, 0xbf, 0xa1, 0x4e, 0x73, 0x06, 0xe6, 0xfe, 0x03, 0x81, 0xe7, 0x14, 0x81, 0x4d, 0x8a, 0xc0, - 0x36, 0x45, 0x60, 0x9f, 0x22, 0xb0, 0x3e, 0x20, 0x65, 0x7b, 0x40, 0xca, 0xeb, 0x01, 0x29, 0x77, - 0x17, 0x85, 0xa5, 0x64, 0x9d, 0xbb, 0x33, 0xdb, 0xe1, 0x32, 0x22, 0xcb, 0xc2, 0x13, 0x90, 0xdb, - 0x71, 0x2a, 0x52, 0xfd, 0xea, 0x33, 0x00, 0x00, 0xff, 0xff, 0x6f, 0x4a, 0x12, 0x82, 0x21, 0x02, - 0x00, 0x00, + // 376 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x91, 0xb1, 0x8e, 0xda, 0x30, + 0x1c, 0xc6, 0xe3, 0x42, 0x11, 0xb8, 0x4c, 0x11, 0x42, 0x51, 0x2a, 0x39, 0x88, 0x76, 0xa0, 0x6a, + 0x6b, 0x0b, 0x3a, 0xb5, 0xea, 0x84, 0x58, 0x90, 0x1a, 0x09, 0x45, 0x9d, 0xba, 0x20, 0x27, 0x71, + 0x4c, 0x04, 0xa9, 0xa3, 0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0x61, 0x7e, 0x87, 0x35, 0xb6, 0x4e, 0xe3, + 0x6c, 0x63, 0x55, 0x3b, 0xa0, 0xf7, 0x66, 0x60, 0xe3, 0x32, 0x3c, 0xbe, 0x84, 0xc7, 0x3f, 0x2f, + 0xe1, 0x87, 0xf5, 0xc2, 0x77, 0x7b, 0xe7, 0x00, 0xef, 0xbc, 0xf3, 0xad, 0xfa, 0xe7, 0xaf, 0x63, + 0x74, 0xdb, 0xb0, 0x75, 0xdd, 0xc6, 0x63, 0x32, 0x15, 0xbf, 0x25, 0x1b, 0x44, 0xb0, 0xe2, 0x4a, + 0x6e, 0x4e, 0x61, 0xe3, 0xa9, 0xe9, 0x7b, 0xfc, 0xfc, 0x55, 0xe2, 0x6b, 0x07, 0xfb, 0xd3, 0x4b, + 0xa8, 0xcb, 0x39, 0x43, 0xf7, 0x78, 0x8f, 0xc0, 0xbf, 0x1c, 0x81, 0x5d, 0x8e, 0xc0, 0x3e, 0x47, + 0xe0, 0x98, 0x23, 0xb0, 0x3d, 0x21, 0x63, 0x7f, 0x42, 0xc6, 0xcd, 0x09, 0x19, 0xbf, 0x3e, 0xf2, + 0x58, 0xcd, 0x96, 0x3e, 0x0e, 0x44, 0x42, 0x0a, 0xe7, 0xcf, 0x0b, 0xea, 0x4b, 0xad, 0xc8, 0xfa, + 0xea, 0xdd, 0xd5, 0x26, 0x65, 0xd2, 0xaf, 0xe9, 0xea, 0x5f, 0x1e, 0x02, 0x00, 0x00, 0xff, 0xff, + 0x5c, 0x75, 0x6a, 0xc0, 0x16, 0x02, 0x00, 0x00, } func (this *MsgPostPrice) VerboseEqual(that interface{}) error { @@ -337,6 +337,7 @@ func _Msg_PostPrice_Handler(srv interface{}, ctx context.Context, dec func(inter return interceptor(ctx, in, info, handler) } +var Msg_serviceDesc = _Msg_serviceDesc var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "kava.pricefeed.v1beta1.Msg", HandlerType: (*MsgServer)(nil), diff --git a/x/router/keeper/msg_server.go b/x/router/keeper/msg_server.go index ba18c6d041..71ed5c5a51 100644 --- a/x/router/keeper/msg_server.go +++ b/x/router/keeper/msg_server.go @@ -70,11 +70,15 @@ func (m msgServer) DelegateMintDeposit(goCtx context.Context, msg *types.MsgDele if err != nil { return nil, err } - validator, found := m.keeper.stakingKeeper.GetValidator(ctx, valAddr) - if !found { + validator, err := m.keeper.stakingKeeper.GetValidator(ctx, valAddr) + if err != nil { return nil, stakingtypes.ErrNoValidatorFound } - bondDenom := m.keeper.stakingKeeper.BondDenom(ctx) + bondDenom, err := m.keeper.stakingKeeper.BondDenom(ctx) + if err != nil { + return nil, err + } + if msg.Amount.Denom != bondDenom { return nil, errorsmod.Wrapf( sdkerrors.ErrInvalidRequest, "invalid coin denomination: got %s, expected %s", msg.Amount.Denom, bondDenom, @@ -180,7 +184,8 @@ func (m msgServer) WithdrawBurnUndelegate(goCtx context.Context, msg *types.MsgW return nil, err } - completionTime, err := m.keeper.stakingKeeper.Undelegate(ctx, depositor, val, sharesReturned) + // TODO(boodyvo): should we use extra var + completionTime, _, err := m.keeper.stakingKeeper.Undelegate(ctx, depositor, val, sharesReturned) if err != nil { return nil, err } diff --git a/x/router/keeper/msg_server_test.go b/x/router/keeper/msg_server_test.go index a53b6852c4..2175d5ee99 100644 --- a/x/router/keeper/msg_server_test.go +++ b/x/router/keeper/msg_server_test.go @@ -72,7 +72,7 @@ func (suite *msgServerTestSuite) TestDelegateMintDeposit_Events() { sdk.NewAttribute(sdk.AttributeKeySender, user.String()), ), ) - expectedShares := sdk.NewDecFromInt(msg.Amount.Amount) // no slashes so shares equal staked tokens + expectedShares := sdkmath.LegacyNewDecFromInt(msg.Amount.Amount) // no slashes so shares equal staked tokens suite.EventsContains(suite.Ctx.EventManager().Events(), sdk.NewEvent( stakingtypes.EventTypeDelegate, @@ -155,7 +155,7 @@ func (suite *msgServerTestSuite) TestMintDepositAndWithdrawBurn_TransferEntireBa suite.CreateNewUnbondedValidator(valAddr, sdkmath.NewInt(1e9)) suite.CreateDelegation(valAddr, user, sdkmath.NewInt(1e9)) staking.EndBlocker(suite.Ctx, suite.StakingKeeper) - suite.SlashValidator(valAddr, sdk.MustNewDecFromStr("0.666666666666666667")) + suite.SlashValidator(valAddr, sdkmath.LegacyMustNewDecFromStr("0.666666666666666667")) // Query the full staked balance and convert it all to derivatives // user technically 333_333_333.333333333333333333 staked tokens without rounding @@ -173,7 +173,7 @@ func (suite *msgServerTestSuite) TestMintDepositAndWithdrawBurn_TransferEntireBa // There should be no extractable balance left in delegation suite.DelegationBalanceLessThan(valAddr, user, sdkmath.NewInt(1)) // All derivative coins should be deposited to earn - suite.AccountBalanceOfEqual(user, derivativeDenom, sdk.ZeroInt()) + suite.AccountBalanceOfEqual(user, derivativeDenom, sdkmath.ZeroInt()) // Earn vault has all minted derivatives suite.VaultAccountValueEqual(user, sdk.NewInt64Coin(derivativeDenom, 999_999_998)) // 2 lost in conversion @@ -192,7 +192,7 @@ func (suite *msgServerTestSuite) TestMintDepositAndWithdrawBurn_TransferEntireBa // There should be no earn deposit left (earn removes dust amounts) suite.VaultAccountSharesEqual(user, nil) // All derivative coins should be converted to a delegation - suite.AccountBalanceOfEqual(user, derivativeDenom, sdk.ZeroInt()) + suite.AccountBalanceOfEqual(user, derivativeDenom, sdkmath.ZeroInt()) // The user should get back most of their original deposited balance suite.DelegationBalanceInDeltaBelow(valAddr, user, sdkmath.NewInt(333_333_332), sdkmath.NewInt(2)) } @@ -210,7 +210,7 @@ func (suite *msgServerTestSuite) TestDelegateMintDepositAndWithdrawBurnUndelegat // Create a slashed validator, where a future delegator will own fractional tokens. suite.CreateNewUnbondedValidator(valAddr, valBalance) staking.EndBlocker(suite.Ctx, suite.StakingKeeper) - suite.SlashValidator(valAddr, sdk.MustNewDecFromStr("0.4")) // tokens remaining 600_000_000 + suite.SlashValidator(valAddr, sdkmath.LegacyMustNewDecFromStr("0.4")) // tokens remaining 600_000_000 userBalance := sdkmath.NewInt(100e6) vesting := sdkmath.NewInt(1000) @@ -236,9 +236,9 @@ func (suite *msgServerTestSuite) TestDelegateMintDepositAndWithdrawBurnUndelegat // All spendable balance should be withdrawn suite.AccountSpendableBalanceEqual(user, sdk.NewCoins()) // Since shares are newly created, the exact amount should be converted to derivatives, leaving none behind - suite.DelegationSharesEqual(valAddr, user, sdk.ZeroDec()) + suite.DelegationSharesEqual(valAddr, user, sdkmath.LegacyZeroDec()) // All derivative coins should be deposited to earn - suite.AccountBalanceOfEqual(user, derivativeDenom, sdk.ZeroInt()) + suite.AccountBalanceOfEqual(user, derivativeDenom, sdkmath.ZeroInt()) suite.VaultAccountValueEqual(user, sdk.NewInt64Coin(derivativeDenom, 166_666_666)) @@ -257,9 +257,9 @@ func (suite *msgServerTestSuite) TestDelegateMintDepositAndWithdrawBurnUndelegat // There should be no earn deposit left (earn removes dust amounts) suite.VaultAccountSharesEqual(user, nil) // All derivative coins should be converted to a delegation - suite.AccountBalanceOfEqual(user, derivativeDenom, sdk.ZeroInt()) + suite.AccountBalanceOfEqual(user, derivativeDenom, sdkmath.ZeroInt()) // There should be zero shares left because undelegate removes all created by burn. - suite.AccountBalanceOfEqual(user, derivativeDenom, sdk.ZeroInt()) + suite.AccountBalanceOfEqual(user, derivativeDenom, sdkmath.ZeroInt()) // User should have most of their original balance back in an unbonding delegation suite.UnbondingDelegationInDeltaBelow(valAddr, user, userBalance, sdkmath.NewInt(2)) } diff --git a/x/router/module.go b/x/router/module.go index 41be3f3054..9646dbbe1c 100644 --- a/x/router/module.go +++ b/x/router/module.go @@ -110,9 +110,15 @@ func (am AppModule) ExportGenesis(_ sdk.Context, cdc codec.JSONCodec) json.RawMe } // BeginBlock module begin-block -func (am AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) {} +func (am AppModule) BeginBlock(_ sdk.Context) error { + return nil +} // EndBlock module end-block -func (am AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { - return []abci.ValidatorUpdate{} +func (am AppModule) EndBlock(_ sdk.Context) ([]abci.ValidatorUpdate, error) { + return []abci.ValidatorUpdate{}, nil } + +func (AppModule) IsOnePerModuleType() {} + +func (AppModule) IsAppModule() {} diff --git a/x/router/testutil/suite.go b/x/router/testutil/suite.go index 8bbbfdd102..826fde71cf 100644 --- a/x/router/testutil/suite.go +++ b/x/router/testutil/suite.go @@ -39,7 +39,7 @@ type Suite struct { // The default state used by each test func (suite *Suite) SetupTest() { tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) tApp.InitializeFromGenesisStates() @@ -52,7 +52,7 @@ func (suite *Suite) SetupTest() { } // CreateAccount creates a new account from the provided balance and address -func (suite *Suite) CreateAccountWithAddress(addr sdk.AccAddress, initialBalance sdk.Coins) authtypes.AccountI { +func (suite *Suite) CreateAccountWithAddress(addr sdk.AccAddress, initialBalance sdk.Coins) sdk.AccountI { ak := suite.App.GetAccountKeeper() acc := ak.NewAccountWithAddress(suite.Ctx, addr) @@ -65,7 +65,7 @@ func (suite *Suite) CreateAccountWithAddress(addr sdk.AccAddress, initialBalance } // CreateVestingAccount creates a new vesting account. `vestingBalance` should be a fraction of `initialBalance`. -func (suite *Suite) CreateVestingAccountWithAddress(addr sdk.AccAddress, initialBalance sdk.Coins, vestingBalance sdk.Coins) authtypes.AccountI { +func (suite *Suite) CreateVestingAccountWithAddress(addr sdk.AccAddress, initialBalance sdk.Coins, vestingBalance sdk.Coins) sdk.AccountI { if vestingBalance.IsAnyGT(initialBalance) { panic("vesting balance must be less than initial balance") } @@ -128,7 +128,7 @@ func (suite *Suite) deliverMsgCreateValidator(ctx sdk.Context, address sdk.ValAd ed25519.GenPrivKey().PubKey(), selfDelegation, stakingtypes.Description{}, - stakingtypes.NewCommissionRates(sdk.ZeroDec(), sdk.ZeroDec(), sdk.ZeroDec()), + stakingtypes.NewCommissionRates(sdkmath.LegacyZeroDec(), sdkmath.LegacyZeroDec(), sdkmath.LegacyZeroDec()), sdkmath.NewInt(1e6), ) if err != nil { @@ -166,7 +166,7 @@ func (suite *Suite) CreateNewUnbondedValidator(addr sdk.ValAddress, selfDelegati } // SlashValidator burns tokens staked in a validator. new_tokens = old_tokens * (1-slashFraction) -func (suite *Suite) SlashValidator(addr sdk.ValAddress, slashFraction sdk.Dec) { +func (suite *Suite) SlashValidator(addr sdk.ValAddress, slashFraction sdkmath.LegacyDec) { validator, found := suite.StakingKeeper.GetValidator(suite.Ctx, addr) suite.Require().True(found) consAddr, err := validator.GetConsAddr() @@ -182,7 +182,7 @@ func (suite *Suite) SlashValidator(addr sdk.ValAddress, slashFraction sdk.Dec) { } // CreateDelegation delegates tokens to a validator. -func (suite *Suite) CreateDelegation(valAddr sdk.ValAddress, delegator sdk.AccAddress, amount sdkmath.Int) sdk.Dec { +func (suite *Suite) CreateDelegation(valAddr sdk.ValAddress, delegator sdk.AccAddress, amount sdkmath.Int) sdkmath.LegacyDec { stakingDenom := suite.StakingKeeper.BondDenom(suite.Ctx) msg := stakingtypes.NewMsgDelegate( delegator, @@ -201,7 +201,7 @@ func (suite *Suite) CreateDelegation(valAddr sdk.ValAddress, delegator sdk.AccAd // DelegationSharesEqual checks if a delegation has the specified shares. // It expects delegations with zero shares to not be stored in state. -func (suite *Suite) DelegationSharesEqual(valAddr sdk.ValAddress, delegator sdk.AccAddress, shares sdk.Dec) bool { +func (suite *Suite) DelegationSharesEqual(valAddr sdk.ValAddress, delegator sdk.AccAddress, shares sdkmath.LegacyDec) bool { del, found := suite.StakingKeeper.GetDelegation(suite.Ctx, delegator, valAddr) if shares.IsZero() { @@ -215,7 +215,7 @@ func (suite *Suite) DelegationSharesEqual(valAddr sdk.ValAddress, delegator sdk. // DelegationBalanceLessThan checks if a delegation's staked token balance is less the specified amount. // It treats not found delegations as having zero shares. func (suite *Suite) DelegationBalanceLessThan(valAddr sdk.ValAddress, delegator sdk.AccAddress, max sdkmath.Int) bool { - shares := sdk.ZeroDec() + shares := sdkmath.LegacyZeroDec() del, found := suite.StakingKeeper.GetDelegation(suite.Ctx, delegator, valAddr) if found { shares = del.Shares @@ -232,7 +232,7 @@ func (suite *Suite) DelegationBalanceLessThan(valAddr sdk.ValAddress, delegator // DelegationBalanceInDeltaBelow checks if a delegation's staked token balance is between `expected` and `expected - delta` inclusive. // It treats not found delegations as having zero shares. func (suite *Suite) DelegationBalanceInDeltaBelow(valAddr sdk.ValAddress, delegator sdk.AccAddress, expected, delta sdkmath.Int) bool { - shares := sdk.ZeroDec() + shares := sdkmath.LegacyZeroDec() del, found := suite.StakingKeeper.GetDelegation(suite.Ctx, delegator, valAddr) if found { shares = del.Shares @@ -250,7 +250,7 @@ func (suite *Suite) DelegationBalanceInDeltaBelow(valAddr sdk.ValAddress, delega // UnbondingDelegationInDeltaBelow checks if the total balance in an unbonding delegation is between `expected` and `expected - delta` inclusive. func (suite *Suite) UnbondingDelegationInDeltaBelow(valAddr sdk.ValAddress, delegator sdk.AccAddress, expected, delta sdkmath.Int) bool { - tokens := sdk.ZeroInt() + tokens := sdkmath.ZeroInt() ubd, found := suite.StakingKeeper.GetUnbondingDelegation(suite.Ctx, delegator, valAddr) if found { for _, entry := range ubd.Entries { diff --git a/x/router/types/codec.go b/x/router/types/codec.go index dfd5046c03..2e12b9df6c 100644 --- a/x/router/types/codec.go +++ b/x/router/types/codec.go @@ -6,7 +6,6 @@ import ( cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/msgservice" - authzcodec "github.com/cosmos/cosmos-sdk/x/authz/codec" ) // RegisterLegacyAminoCodec registers all the necessary types and interfaces for the module. @@ -42,5 +41,5 @@ func init() { // Register all Amino interfaces and concrete types on the authz Amino codec so that this can later be // used to properly serialize MsgGrant and MsgExec instances - RegisterLegacyAminoCodec(authzcodec.Amino) + RegisterLegacyAminoCodec(codec.NewLegacyAmino()) } diff --git a/x/router/types/expected_keepers.go b/x/router/types/expected_keepers.go index 927160bb58..de83062f0f 100644 --- a/x/router/types/expected_keepers.go +++ b/x/router/types/expected_keepers.go @@ -1,6 +1,7 @@ package types import ( + "context" "time" sdkmath "cosmossdk.io/math" @@ -11,22 +12,22 @@ import ( ) type StakingKeeper interface { - BondDenom(ctx sdk.Context) (res string) - GetValidator(ctx sdk.Context, addr sdk.ValAddress) (validator stakingtypes.Validator, found bool) + BondDenom(ctx context.Context) (res string, err error) + GetValidator(ctx context.Context, addr sdk.ValAddress) (validator stakingtypes.Validator, err error) Delegate( - ctx sdk.Context, delAddr sdk.AccAddress, bondAmt sdkmath.Int, tokenSrc stakingtypes.BondStatus, + ctx context.Context, delAddr sdk.AccAddress, bondAmt sdkmath.Int, tokenSrc stakingtypes.BondStatus, validator stakingtypes.Validator, subtractAccount bool, - ) (newShares sdk.Dec, err error) + ) (newShares sdkmath.LegacyDec, err error) Undelegate( - ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress, sharesAmount sdk.Dec, - ) (time.Time, error) + ctx context.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress, sharesAmount sdkmath.LegacyDec, + ) (time.Time, sdkmath.Int, error) } type LiquidKeeper interface { DerivativeFromTokens(ctx sdk.Context, valAddr sdk.ValAddress, amount sdk.Coin) (sdk.Coin, error) MintDerivative(ctx sdk.Context, delegatorAddr sdk.AccAddress, valAddr sdk.ValAddress, amount sdk.Coin) (sdk.Coin, error) - BurnDerivative(ctx sdk.Context, delegatorAddr sdk.AccAddress, valAddr sdk.ValAddress, amount sdk.Coin) (sdk.Dec, error) + BurnDerivative(ctx sdk.Context, delegatorAddr sdk.AccAddress, valAddr sdk.ValAddress, amount sdk.Coin) (sdkmath.LegacyDec, error) } type EarnKeeper interface { diff --git a/x/router/types/msg_test.go b/x/router/types/msg_test.go index 2f7b10fdb7..37903502c3 100644 --- a/x/router/types/msg_test.go +++ b/x/router/types/msg_test.go @@ -153,7 +153,7 @@ func TestMsg_Validate(t *testing.T) { msgArgs: msgArgs{ depositor: validAddress, validator: validValidatorAddress, - amount: sdk.NewCoin("ukava", sdk.ZeroInt()), + amount: sdk.NewCoin("ukava", sdkmath.ZeroInt()), }, expectedErr: sdkerrors.ErrInvalidCoins, }, diff --git a/x/router/types/tx.pb.go b/x/router/types/tx.pb.go index 5f0dc21989..5303626699 100644 --- a/x/router/types/tx.pb.go +++ b/x/router/types/tx.pb.go @@ -574,6 +574,7 @@ func _Msg_WithdrawBurnUndelegate_Handler(srv interface{}, ctx context.Context, d return interceptor(ctx, in, info, handler) } +var Msg_serviceDesc = _Msg_serviceDesc var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "kava.router.v1beta1.Msg", HandlerType: (*MsgServer)(nil), diff --git a/x/savings/genesis_test.go b/x/savings/genesis_test.go index d2becb567c..27857647f6 100644 --- a/x/savings/genesis_test.go +++ b/x/savings/genesis_test.go @@ -30,7 +30,7 @@ type GenesisTestSuite struct { func (suite *GenesisTestSuite) SetupTest() { tApp := app.NewTestApp() suite.genTime = tmtime.Canonical(time.Date(2022, 1, 1, 1, 1, 1, 1, time.UTC)) - suite.ctx = tApp.NewContext(true, tmproto.Header{Height: 1, Time: suite.genTime}) + suite.ctx = tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: suite.genTime}) suite.keeper = tApp.GetSavingsKeeper() suite.app = tApp diff --git a/x/savings/keeper/deposit_test.go b/x/savings/keeper/deposit_test.go index c6e4e2cafb..fd3066d45d 100644 --- a/x/savings/keeper/deposit_test.go +++ b/x/savings/keeper/deposit_test.go @@ -155,7 +155,7 @@ func (suite *KeeperTestSuite) TestDeposit() { // Initialize test app and set context tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) authGS := app.NewFundedGenStateWithCoins( tApp.AppCodec(), []sdk.Coins{tc.args.initialDepositorBalance}, diff --git a/x/savings/keeper/grpcquery_test.go b/x/savings/keeper/grpcquery_test.go index 8708130233..50a0c319c3 100644 --- a/x/savings/keeper/grpcquery_test.go +++ b/x/savings/keeper/grpcquery_test.go @@ -7,7 +7,6 @@ import ( "github.com/stretchr/testify/suite" sdkmath "cosmossdk.io/math" - tmprototypes "github.com/cometbft/cometbft/proto/tendermint/types" "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" sdk "github.com/cosmos/cosmos-sdk/types" @@ -43,7 +42,7 @@ func (suite *grpcQueryTestSuite) SetupTest() { suite.addrs = addrs - suite.ctx = suite.tApp.NewContext(true, tmprototypes.Header{}). + suite.ctx = suite.tApp.NewContextLegacy(true). WithBlockTime(time.Now().UTC()) suite.keeper = suite.tApp.GetSavingsKeeper() suite.queryServer = keeper.NewQueryServerImpl(suite.keeper) @@ -239,7 +238,7 @@ func (suite *grpcQueryTestSuite) TestGrpcQueryTotalSupply() { // bond validators staking.EndBlocker(suite.ctx, suite.tApp.GetStakingKeeper()) // slash val2 - its shares are now 80% as valuable! - err := suite.slashValidator(sdk.ValAddress(address2), sdk.MustNewDecFromStr("0.2")) + err := suite.slashValidator(sdk.ValAddress(address2), sdkmath.LegacyMustNewDecFromStr("0.2")) suite.Require().NoError(err) suite.addDeposits( @@ -281,7 +280,7 @@ func (suite *grpcQueryTestSuite) createUnbondedValidator(address sdk.ValAddress, ed25519.GenPrivKey().PubKey(), selfDelegation, stakingtypes.Description{}, - stakingtypes.NewCommissionRates(sdk.ZeroDec(), sdk.ZeroDec(), sdk.ZeroDec()), + stakingtypes.NewCommissionRates(sdkmath.LegacyZeroDec(), sdkmath.LegacyZeroDec(), sdkmath.LegacyZeroDec()), minSelfDelegation, ) if err != nil { @@ -331,7 +330,7 @@ func (suite *grpcQueryTestSuite) createAccountWithDerivatives(denom string, amou } // slashValidator slashes the validator with the given address by the given percentage. -func (suite *grpcQueryTestSuite) slashValidator(address sdk.ValAddress, slashFraction sdk.Dec) error { +func (suite *grpcQueryTestSuite) slashValidator(address sdk.ValAddress, slashFraction sdkmath.LegacyDec) error { stakingKeeper := suite.tApp.GetStakingKeeper() validator, found := stakingKeeper.GetValidator(suite.ctx, address) diff --git a/x/savings/keeper/hooks.go b/x/savings/keeper/hooks.go index 9bc577de96..975beac09f 100644 --- a/x/savings/keeper/hooks.go +++ b/x/savings/keeper/hooks.go @@ -1,8 +1,7 @@ package keeper import ( - sdk "github.com/cosmos/cosmos-sdk/types" - + "context" "github.com/kava-labs/kava/x/savings/types" ) @@ -10,14 +9,14 @@ import ( var _ types.SavingsHooks = Keeper{} // AfterSavingsDepositCreated - call hook if registered -func (k Keeper) AfterSavingsDepositCreated(ctx sdk.Context, deposit types.Deposit) { +func (k Keeper) AfterSavingsDepositCreated(ctx context.Context, deposit types.Deposit) { if k.hooks != nil { k.hooks.AfterSavingsDepositCreated(ctx, deposit) } } // BeforeSavingsDepositModified - call hook if registered -func (k Keeper) BeforeSavingsDepositModified(ctx sdk.Context, deposit types.Deposit, incomingDenoms []string) { +func (k Keeper) BeforeSavingsDepositModified(ctx context.Context, deposit types.Deposit, incomingDenoms []string) { if k.hooks != nil { k.hooks.BeforeSavingsDepositModified(ctx, deposit, incomingDenoms) } diff --git a/x/savings/keeper/invariants.go b/x/savings/keeper/invariants.go index e963b59703..0e0eb75f5c 100644 --- a/x/savings/keeper/invariants.go +++ b/x/savings/keeper/invariants.go @@ -61,7 +61,7 @@ func SolvencyInvariant(k Keeper) sdk.Invariant { return false }) - broken := !deposited.IsEqual(balance) + broken := !deposited.Equal(balance) return message, broken } } diff --git a/x/savings/keeper/invariants_test.go b/x/savings/keeper/invariants_test.go index 866a5aed74..1236a97b67 100644 --- a/x/savings/keeper/invariants_test.go +++ b/x/savings/keeper/invariants_test.go @@ -32,7 +32,7 @@ func (suite *invariantTestSuite) SetupTest() { app.SetBech32AddressPrefixes(config) tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) _, addrs := app.GeneratePrivKeyAddressPairs(1) suite.addrs = addrs diff --git a/x/savings/keeper/keeper.go b/x/savings/keeper/keeper.go index 76ca0caa1a..6ab2a7ac1f 100644 --- a/x/savings/keeper/keeper.go +++ b/x/savings/keeper/keeper.go @@ -3,10 +3,10 @@ package keeper import ( "fmt" - "github.com/cometbft/cometbft/libs/log" + "cosmossdk.io/log" + "cosmossdk.io/store/prefix" + storetypes "cosmossdk.io/store/types" "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/store/prefix" - storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" @@ -87,7 +87,7 @@ func (k Keeper) DeleteDeposit(ctx sdk.Context, deposit types.Deposit) { // IterateDeposits iterates over all deposit objects in the store and performs a callback function func (k Keeper) IterateDeposits(ctx sdk.Context, cb func(deposit types.Deposit) (stop bool)) { store := prefix.NewStore(ctx.KVStore(k.key), types.DepositsKeyPrefix) - iterator := sdk.KVStorePrefixIterator(store, []byte{}) + iterator := storetypes.KVStorePrefixIterator(store, []byte{}) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { var deposit types.Deposit diff --git a/x/savings/keeper/keeper_test.go b/x/savings/keeper/keeper_test.go index 5b862fa545..f54eee6687 100644 --- a/x/savings/keeper/keeper_test.go +++ b/x/savings/keeper/keeper_test.go @@ -36,7 +36,7 @@ func (suite *KeeperTestSuite) SetupTest() { app.SetBech32AddressPrefixes(config) tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) tApp.InitializeFromGenesisStates() _, addrs := app.GeneratePrivKeyAddressPairs(1) keeper := tApp.GetSavingsKeeper() @@ -80,27 +80,27 @@ func (suite *KeeperTestSuite) TestIterateDeposits() { suite.Require().Equal(5, len(deposits)) } -func (suite *KeeperTestSuite) getAccountCoins(acc authtypes.AccountI) sdk.Coins { +func (suite *KeeperTestSuite) getAccountCoins(acc sdk.AccountI) sdk.Coins { bk := suite.app.GetBankKeeper() return bk.GetAllBalances(suite.ctx, acc.GetAddress()) } -func (suite *KeeperTestSuite) getAccount(addr sdk.AccAddress) authtypes.AccountI { +func (suite *KeeperTestSuite) getAccount(addr sdk.AccAddress) sdk.AccountI { ak := suite.app.GetAccountKeeper() return ak.GetAccount(suite.ctx, addr) } -func (suite *KeeperTestSuite) getAccountAtCtx(addr sdk.AccAddress, ctx sdk.Context) authtypes.AccountI { +func (suite *KeeperTestSuite) getAccountAtCtx(addr sdk.AccAddress, ctx sdk.Context) sdk.AccountI { ak := suite.app.GetAccountKeeper() return ak.GetAccount(ctx, addr) } -func (suite *KeeperTestSuite) getModuleAccount(name string) authtypes.ModuleAccountI { +func (suite *KeeperTestSuite) getModuleAccount(name string) sdk.ModuleAccountI { ak := suite.app.GetAccountKeeper() return ak.GetModuleAccount(suite.ctx, name) } -func (suite *KeeperTestSuite) getModuleAccountAtCtx(name string, ctx sdk.Context) authtypes.ModuleAccountI { +func (suite *KeeperTestSuite) getModuleAccountAtCtx(name string, ctx sdk.Context) sdk.ModuleAccountI { ak := suite.app.GetAccountKeeper() return ak.GetModuleAccount(ctx, name) } @@ -110,7 +110,7 @@ func TestKeeperTestSuite(t *testing.T) { } // CreateAccount creates a new account from the provided balance and address -func (suite *KeeperTestSuite) CreateAccountWithAddress(addr sdk.AccAddress, initialBalance sdk.Coins) authtypes.AccountI { +func (suite *KeeperTestSuite) CreateAccountWithAddress(addr sdk.AccAddress, initialBalance sdk.Coins) sdk.AccountI { ak := suite.app.GetAccountKeeper() acc := ak.NewAccountWithAddress(suite.ctx, addr) @@ -123,7 +123,7 @@ func (suite *KeeperTestSuite) CreateAccountWithAddress(addr sdk.AccAddress, init } // CreateVestingAccount creates a new vesting account. `vestingBalance` should be a fraction of `initialBalance`. -func (suite *KeeperTestSuite) CreateVestingAccountWithAddress(addr sdk.AccAddress, initialBalance sdk.Coins, vestingBalance sdk.Coins) authtypes.AccountI { +func (suite *KeeperTestSuite) CreateVestingAccountWithAddress(addr sdk.AccAddress, initialBalance sdk.Coins, vestingBalance sdk.Coins) sdk.AccountI { if vestingBalance.IsAnyGT(initialBalance) { panic("vesting balance must be less than initial balance") } @@ -147,7 +147,7 @@ func (suite *KeeperTestSuite) deliverMsgCreateValidator(ctx sdk.Context, address ed25519.GenPrivKey().PubKey(), selfDelegation, stakingtypes.Description{}, - stakingtypes.NewCommissionRates(sdk.ZeroDec(), sdk.ZeroDec(), sdk.ZeroDec()), + stakingtypes.NewCommissionRates(sdkmath.LegacyZeroDec(), sdkmath.LegacyZeroDec(), sdkmath.LegacyZeroDec()), sdkmath.NewInt(1e6), ) if err != nil { @@ -174,7 +174,7 @@ func (suite *KeeperTestSuite) CreateNewUnbondedValidator(addr sdk.ValAddress, se } // CreateDelegation delegates tokens to a validator. -func (suite *KeeperTestSuite) CreateDelegation(valAddr sdk.ValAddress, delegator sdk.AccAddress, amount sdkmath.Int) sdk.Dec { +func (suite *KeeperTestSuite) CreateDelegation(valAddr sdk.ValAddress, delegator sdk.AccAddress, amount sdkmath.Int) sdkmath.LegacyDec { sk := suite.app.GetStakingKeeper() stakingDenom := sk.BondDenom(suite.ctx) diff --git a/x/savings/keeper/withdraw_test.go b/x/savings/keeper/withdraw_test.go index b4f61f98a6..734fe5847d 100644 --- a/x/savings/keeper/withdraw_test.go +++ b/x/savings/keeper/withdraw_test.go @@ -141,7 +141,7 @@ func (suite *KeeperTestSuite) TestWithdraw() { suite.Run(tc.name, func() { // Initialize test app and set context tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) authGS := app.NewFundedGenStateWithCoins( tApp.AppCodec(), []sdk.Coins{tc.args.initialDepositorBalance}, diff --git a/x/savings/module.go b/x/savings/module.go index f7649ec37a..82d5bcbbd2 100644 --- a/x/savings/module.go +++ b/x/savings/module.go @@ -137,10 +137,15 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw } // BeginBlock module begin-block -func (am AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) { +func (am AppModule) BeginBlock(_ sdk.Context) error { + return nil } // EndBlock module end-block -func (am AppModule) EndBlock(ctx sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { - return []abci.ValidatorUpdate{} +func (am AppModule) EndBlock(ctx sdk.Context) ([]abci.ValidatorUpdate, error) { + return []abci.ValidatorUpdate{}, nil } + +func (AppModule) IsOnePerModuleType() {} + +func (AppModule) IsAppModule() {} diff --git a/x/savings/types/codec.go b/x/savings/types/codec.go index 44048a875e..d6e3d06254 100644 --- a/x/savings/types/codec.go +++ b/x/savings/types/codec.go @@ -6,7 +6,6 @@ import ( cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/msgservice" - authzcodec "github.com/cosmos/cosmos-sdk/x/authz/codec" ) // RegisterLegacyAminoCodec registers all the necessary types and interfaces for the @@ -36,5 +35,5 @@ func init() { // Register all Amino interfaces and concrete types on the authz Amino codec so that this can later be // used to properly serialize MsgGrant and MsgExec instances - RegisterLegacyAminoCodec(authzcodec.Amino) + RegisterLegacyAminoCodec(codec.NewLegacyAmino()) } diff --git a/x/savings/types/expected_keepers.go b/x/savings/types/expected_keepers.go index 7072936c01..06f5018e9e 100644 --- a/x/savings/types/expected_keepers.go +++ b/x/savings/types/expected_keepers.go @@ -1,35 +1,35 @@ package types // noalias import ( + "context" sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) // BankKeeper defines the expected bank keeper type BankKeeper interface { - SendCoinsFromModuleToModule(ctx sdk.Context, senderModule, recipientModule string, amt sdk.Coins) error - SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error - SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error + SendCoinsFromModuleToModule(ctx context.Context, senderModule, recipientModule string, amt sdk.Coins) error + SendCoinsFromAccountToModule(ctx context.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error + SendCoinsFromModuleToAccount(ctx context.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error - GetSupply(ctx sdk.Context, denom string) sdk.Coin - GetBalance(ctx sdk.Context, addr sdk.AccAddress, denom string) sdk.Coin - GetAllBalances(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins - SpendableCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins + GetSupply(ctx context.Context, denom string) sdk.Coin + GetBalance(ctx context.Context, addr sdk.AccAddress, denom string) sdk.Coin + GetAllBalances(ctx context.Context, addr sdk.AccAddress) sdk.Coins + SpendableCoins(ctx context.Context, addr sdk.AccAddress) sdk.Coins } // AccountKeeper defines the expected keeper interface for interacting with account type AccountKeeper interface { - GetAccount(ctx sdk.Context, addr sdk.AccAddress) authtypes.AccountI - SetAccount(ctx sdk.Context, acc authtypes.AccountI) + GetAccount(ctx context.Context, addr sdk.AccAddress) sdk.AccountI + SetAccount(ctx context.Context, acc sdk.AccountI) GetModuleAddress(name string) sdk.AccAddress - GetModuleAccount(ctx sdk.Context, name string) authtypes.ModuleAccountI + GetModuleAccount(ctx context.Context, name string) sdk.ModuleAccountI } // SavingsHooks event hooks for other keepers to run code in response to Savings modifications type SavingsHooks interface { - AfterSavingsDepositCreated(ctx sdk.Context, deposit Deposit) - BeforeSavingsDepositModified(ctx sdk.Context, deposit Deposit, incomingDenoms []string) + AfterSavingsDepositCreated(ctx context.Context, deposit Deposit) + BeforeSavingsDepositModified(ctx context.Context, deposit Deposit, incomingDenoms []string) } type LiquidKeeper interface { diff --git a/x/savings/types/hooks.go b/x/savings/types/hooks.go index b4441b5941..12c93e5a5e 100644 --- a/x/savings/types/hooks.go +++ b/x/savings/types/hooks.go @@ -1,6 +1,8 @@ package types -import sdk "github.com/cosmos/cosmos-sdk/types" +import ( + "context" +) // MultiSavingsHooks combine multiple Savings hooks, all hook functions are run in array sequence type MultiSavingsHooks []SavingsHooks @@ -11,14 +13,14 @@ func NewMultiSavingsHooks(hooks ...SavingsHooks) MultiSavingsHooks { } // AfterSavingsDepositCreated runs after a deposit is created -func (s MultiSavingsHooks) AfterSavingsDepositCreated(ctx sdk.Context, deposit Deposit) { +func (s MultiSavingsHooks) AfterSavingsDepositCreated(ctx context.Context, deposit Deposit) { for i := range s { s[i].AfterSavingsDepositCreated(ctx, deposit) } } // BeforeSavingsDepositModified runs before a deposit is modified -func (s MultiSavingsHooks) BeforeSavingsDepositModified(ctx sdk.Context, deposit Deposit, incomingDenoms []string) { +func (s MultiSavingsHooks) BeforeSavingsDepositModified(ctx context.Context, deposit Deposit, incomingDenoms []string) { for i := range s { s[i].BeforeSavingsDepositModified(ctx, deposit, incomingDenoms) } diff --git a/x/savings/types/query.pb.go b/x/savings/types/query.pb.go index 5e1340de43..37689eeaf3 100644 --- a/x/savings/types/query.pb.go +++ b/x/savings/types/query.pb.go @@ -509,6 +509,7 @@ func _Query_TotalSupply_Handler(srv interface{}, ctx context.Context, dec func(i return interceptor(ctx, in, info, handler) } +var Query_serviceDesc = _Query_serviceDesc var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "kava.savings.v1beta1.Query", HandlerType: (*QueryServer)(nil), diff --git a/x/savings/types/tx.pb.go b/x/savings/types/tx.pb.go index 392172d56d..270d45aac0 100644 --- a/x/savings/types/tx.pb.go +++ b/x/savings/types/tx.pb.go @@ -350,6 +350,7 @@ func _Msg_Withdraw_Handler(srv interface{}, ctx context.Context, dec func(interf return interceptor(ctx, in, info, handler) } +var Msg_serviceDesc = _Msg_serviceDesc var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "kava.savings.v1beta1.Msg", HandlerType: (*MsgServer)(nil), diff --git a/x/swap/client/cli/tx.go b/x/swap/client/cli/tx.go index f6f933656b..4a9f4629ef 100644 --- a/x/swap/client/cli/tx.go +++ b/x/swap/client/cli/tx.go @@ -67,7 +67,7 @@ func getCmdDeposit() *cobra.Command { return err } - slippage, err := sdk.NewDecFromStr(args[2]) + slippage, err := sdkmath.LegacyNewDecFromStr(args[2]) if err != nil { return err } @@ -160,7 +160,7 @@ func getCmdSwapExactForTokens() *cobra.Command { return err } - slippage, err := sdk.NewDecFromStr(args[2]) + slippage, err := sdkmath.LegacyNewDecFromStr(args[2]) if err != nil { return err } @@ -206,7 +206,7 @@ func getCmdSwapForExactTokens() *cobra.Command { return err } - slippage, err := sdk.NewDecFromStr(args[2]) + slippage, err := sdkmath.LegacyNewDecFromStr(args[2]) if err != nil { return err } diff --git a/x/swap/genesis_test.go b/x/swap/genesis_test.go index ea7b72b27c..2e6e8edd76 100644 --- a/x/swap/genesis_test.go +++ b/x/swap/genesis_test.go @@ -20,7 +20,7 @@ type genesisTestSuite struct { func (suite *genesisTestSuite) Test_InitGenesis_ValidationPanic() { invalidState := types.NewGenesisState( types.Params{ - SwapFee: sdk.NewDec(-1), + SwapFee: sdkmath.LegacyNewDec(-1), }, types.PoolRecords{}, types.ShareRecords{}, @@ -41,7 +41,7 @@ func (suite *genesisTestSuite) Test_InitAndExportGenesis() { state := types.NewGenesisState( types.Params{ AllowedPools: types.AllowedPools{types.NewAllowedPool("ukava", "usdx")}, - SwapFee: sdk.MustNewDecFromStr("0.00255"), + SwapFee: sdkmath.LegacyMustNewDecFromStr("0.00255"), }, types.PoolRecords{ types.NewPoolRecord(sdk.NewCoins(sdk.NewCoin("hard", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(2e6))), sdkmath.NewInt(1e6)), @@ -80,7 +80,7 @@ func (suite *genesisTestSuite) Test_Marshall() { state := types.NewGenesisState( types.Params{ AllowedPools: types.AllowedPools{types.NewAllowedPool("ukava", "usdx")}, - SwapFee: sdk.MustNewDecFromStr("0.00255"), + SwapFee: sdkmath.LegacyMustNewDecFromStr("0.00255"), }, types.PoolRecords{ types.NewPoolRecord(sdk.NewCoins(sdk.NewCoin("hard", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(2e6))), sdkmath.NewInt(1e6)), @@ -115,7 +115,7 @@ func (suite *genesisTestSuite) Test_LegacyJSONConversion() { state := types.NewGenesisState( types.Params{ AllowedPools: types.AllowedPools{types.NewAllowedPool("ukava", "usdx")}, - SwapFee: sdk.MustNewDecFromStr("0.00255"), + SwapFee: sdkmath.LegacyMustNewDecFromStr("0.00255"), }, types.PoolRecords{ types.NewPoolRecord(sdk.NewCoins(sdk.NewCoin("hard", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(2e6))), sdkmath.NewInt(1e6)), diff --git a/x/swap/keeper/deposit.go b/x/swap/keeper/deposit.go index f88ba7750f..e1048c720d 100644 --- a/x/swap/keeper/deposit.go +++ b/x/swap/keeper/deposit.go @@ -38,7 +38,7 @@ import ( // // These slippages can be calculated by S_B = ((A/B')/(A/B) - 1) and S_A ((B/A')/(B/A) - 1), simplifying to // S_B = (A/A' - 1), and S_B = (B/B' - 1). An error is returned when max(S_A, S_B) > slippageLimit. -func (k Keeper) Deposit(ctx sdk.Context, depositor sdk.AccAddress, coinA sdk.Coin, coinB sdk.Coin, slippageLimit sdk.Dec) error { +func (k Keeper) Deposit(ctx sdk.Context, depositor sdk.AccAddress, coinA sdk.Coin, coinB sdk.Coin, slippageLimit sdkmath.LegacyDec) error { desiredAmount := sdk.NewCoins(coinA, coinB) poolID := types.PoolIDFromCoins(desiredAmount) @@ -67,11 +67,11 @@ func (k Keeper) Deposit(ctx sdk.Context, depositor sdk.AccAddress, coinA sdk.Coi return errorsmod.Wrap(types.ErrInsufficientLiquidity, "deposit must be increased") } - maxPercentPriceChange := sdk.MaxDec( - sdk.NewDecFromInt(desiredAmount.AmountOf(coinA.Denom)).Quo(sdk.NewDecFromInt(depositAmount.AmountOf(coinA.Denom))), - sdk.NewDecFromInt(desiredAmount.AmountOf(coinB.Denom)).Quo(sdk.NewDecFromInt(depositAmount.AmountOf(coinB.Denom))), + maxPercentPriceChange := sdkmath.LegacyMaxDec( + sdkmath.LegacyNewDecFromInt(desiredAmount.AmountOf(coinA.Denom)).Quo(sdkmath.LegacyNewDecFromInt(depositAmount.AmountOf(coinA.Denom))), + sdkmath.LegacyNewDecFromInt(desiredAmount.AmountOf(coinB.Denom)).Quo(sdkmath.LegacyNewDecFromInt(depositAmount.AmountOf(coinB.Denom))), ) - slippage := maxPercentPriceChange.Sub(sdk.OneDec()) + slippage := maxPercentPriceChange.Sub(sdkmath.LegacyOneDec()) if slippage.GT(slippageLimit) { return errorsmod.Wrapf(types.ErrSlippageExceeded, "slippage %s > limit %s", slippage, slippageLimit) @@ -116,12 +116,12 @@ func (k Keeper) depositAllowed(ctx sdk.Context, poolID string) bool { func (k Keeper) initializePool(ctx sdk.Context, poolID string, depositor sdk.AccAddress, reserves sdk.Coins) (*types.DenominatedPool, sdk.Coins, sdkmath.Int, error) { if allowed := k.depositAllowed(ctx, poolID); !allowed { - return nil, sdk.Coins{}, sdk.ZeroInt(), errorsmod.Wrap(types.ErrNotAllowed, fmt.Sprintf("can not create pool '%s'", poolID)) + return nil, sdk.Coins{}, sdkmath.ZeroInt(), errorsmod.Wrap(types.ErrNotAllowed, fmt.Sprintf("can not create pool '%s'", poolID)) } pool, err := types.NewDenominatedPool(reserves) if err != nil { - return nil, sdk.Coins{}, sdk.ZeroInt(), err + return nil, sdk.Coins{}, sdkmath.ZeroInt(), err } return pool, pool.Reserves(), pool.TotalShares(), nil @@ -130,7 +130,7 @@ func (k Keeper) initializePool(ctx sdk.Context, poolID string, depositor sdk.Acc func (k Keeper) addLiquidityToPool(ctx sdk.Context, record types.PoolRecord, depositor sdk.AccAddress, desiredAmount sdk.Coins) (*types.DenominatedPool, sdk.Coins, sdkmath.Int, error) { pool, err := types.NewDenominatedPoolWithExistingShares(record.Reserves(), record.TotalShares) if err != nil { - return nil, sdk.Coins{}, sdk.ZeroInt(), err + return nil, sdk.Coins{}, sdkmath.ZeroInt(), err } depositAmount, shares := pool.AddLiquidity(desiredAmount) diff --git a/x/swap/keeper/deposit_test.go b/x/swap/keeper/deposit_test.go index f0bf042a19..644daebfd0 100644 --- a/x/swap/keeper/deposit_test.go +++ b/x/swap/keeper/deposit_test.go @@ -18,7 +18,7 @@ func (suite *keeperTestSuite) TestDeposit_CreatePool_PoolNotAllowed() { amountA := sdk.NewCoin("ukava", sdkmath.NewInt(10e6)) amountB := sdk.NewCoin("usdx", sdkmath.NewInt(50e6)) - err := suite.Keeper.Deposit(suite.Ctx, depositor.GetAddress(), amountA, amountB, sdk.MustNewDecFromStr("0.01")) + err := suite.Keeper.Deposit(suite.Ctx, depositor.GetAddress(), amountA, amountB, sdkmath.LegacyMustNewDecFromStr("0.01")) suite.Require().EqualError(err, "can not create pool 'ukava:usdx': not allowed") } @@ -32,8 +32,8 @@ func (suite *keeperTestSuite) TestDeposit_InsufficientFunds() { }{ { name: "no balance", - balanceA: sdk.NewCoin("unuseddenom", sdk.ZeroInt()), - balanceB: sdk.NewCoin("unuseddenom", sdk.ZeroInt()), + balanceA: sdk.NewCoin("unuseddenom", sdkmath.ZeroInt()), + balanceB: sdk.NewCoin("unuseddenom", sdkmath.ZeroInt()), depositA: sdk.NewCoin("ukava", sdkmath.NewInt(100)), depositB: sdk.NewCoin("usdx", sdkmath.NewInt(100)), }, @@ -64,7 +64,7 @@ func (suite *keeperTestSuite) TestDeposit_InsufficientFunds() { balance := sdk.NewCoins(tc.balanceA, tc.balanceB) depositor := suite.CreateAccount(balance) - err := suite.Keeper.Deposit(suite.Ctx, depositor.GetAddress(), tc.depositA, tc.depositB, sdk.MustNewDecFromStr("0")) + err := suite.Keeper.Deposit(suite.Ctx, depositor.GetAddress(), tc.depositA, tc.depositB, sdkmath.LegacyMustNewDecFromStr("0")) // TODO: wrap in module specific error? suite.Require().True(errors.Is(err, sdkerrors.ErrInsufficientFunds), fmt.Sprintf("got err %s", err)) @@ -72,7 +72,7 @@ func (suite *keeperTestSuite) TestDeposit_InsufficientFunds() { // test deposit to existing pool insuffient funds err = suite.CreatePool(sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(10e6)), sdk.NewCoin("usdx", sdkmath.NewInt(50e6)))) suite.Require().NoError(err) - err = suite.Keeper.Deposit(suite.Ctx, depositor.GetAddress(), tc.depositA, tc.depositB, sdk.MustNewDecFromStr("10")) + err = suite.Keeper.Deposit(suite.Ctx, depositor.GetAddress(), tc.depositA, tc.depositB, sdkmath.LegacyMustNewDecFromStr("10")) suite.Require().True(errors.Is(err, sdkerrors.ErrInsufficientFunds)) }) } @@ -90,8 +90,8 @@ func (suite *keeperTestSuite) TestDeposit_InsufficientFunds_Vesting() { }{ { name: "no balance, vesting only", - balanceA: sdk.NewCoin("ukava", sdk.ZeroInt()), - balanceB: sdk.NewCoin("usdx", sdk.ZeroInt()), + balanceA: sdk.NewCoin("ukava", sdkmath.ZeroInt()), + balanceB: sdk.NewCoin("usdx", sdkmath.ZeroInt()), vestingA: sdk.NewCoin("ukava", sdkmath.NewInt(100)), vestingB: sdk.NewCoin("usdx", sdkmath.NewInt(100)), depositA: sdk.NewCoin("ukava", sdkmath.NewInt(100)), @@ -130,7 +130,7 @@ func (suite *keeperTestSuite) TestDeposit_InsufficientFunds_Vesting() { depositor := suite.CreateVestingAccount(balance, vesting) // test create pool insuffient funds - err := suite.Keeper.Deposit(suite.Ctx, depositor.GetAddress(), tc.depositA, tc.depositB, sdk.MustNewDecFromStr("0")) + err := suite.Keeper.Deposit(suite.Ctx, depositor.GetAddress(), tc.depositA, tc.depositB, sdkmath.LegacyMustNewDecFromStr("0")) // TODO: wrap in module specific error? suite.Require().True(errors.Is(err, sdkerrors.ErrInsufficientFunds)) @@ -138,7 +138,7 @@ func (suite *keeperTestSuite) TestDeposit_InsufficientFunds_Vesting() { // test deposit to existing pool insuffient funds err = suite.CreatePool(sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(10e6)), sdk.NewCoin("usdx", sdkmath.NewInt(50e6)))) suite.Require().NoError(err) - err = suite.Keeper.Deposit(suite.Ctx, depositor.GetAddress(), tc.depositA, tc.depositB, sdk.MustNewDecFromStr("4")) + err = suite.Keeper.Deposit(suite.Ctx, depositor.GetAddress(), tc.depositA, tc.depositB, sdkmath.LegacyMustNewDecFromStr("4")) suite.Require().True(errors.Is(err, sdkerrors.ErrInsufficientFunds)) }) } @@ -158,7 +158,7 @@ func (suite *keeperTestSuite) TestDeposit_CreatePool() { depositB := sdk.NewCoin(pool.TokenB, sdkmath.NewInt(50e6)) deposit := sdk.NewCoins(depositA, depositB) - err := suite.Keeper.Deposit(suite.Ctx, depositor.GetAddress(), depositA, depositB, sdk.MustNewDecFromStr("0")) + err := suite.Keeper.Deposit(suite.Ctx, depositor.GetAddress(), depositA, depositB, sdkmath.LegacyMustNewDecFromStr("0")) suite.Require().NoError(err) suite.AccountBalanceEqual(depositor.GetAddress(), sdk.NewCoins(amountA.Sub(depositA), amountB.Sub(depositB))) suite.ModuleAccountBalanceEqual(sdk.NewCoins(depositA, depositB)) @@ -192,9 +192,9 @@ func (suite *keeperTestSuite) TestDeposit_PoolExists() { depositA := sdk.NewCoin("usdx", balance.AmountOf("usdx")) depositB := sdk.NewCoin("ukava", balance.AmountOf("ukava")) - ctx := suite.App.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + ctx := suite.App.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) - err = suite.Keeper.Deposit(ctx, depositor.GetAddress(), depositA, depositB, sdk.MustNewDecFromStr("4")) + err = suite.Keeper.Deposit(ctx, depositor.GetAddress(), depositA, depositB, sdkmath.LegacyMustNewDecFromStr("4")) suite.Require().NoError(err) expectedDeposit := sdk.NewCoins( @@ -237,7 +237,7 @@ func (suite *keeperTestSuite) TestDeposit_MultipleDeposit() { depositA := sdk.NewCoin("usdx", fundsToDeposit.AmountOf("usdx")) depositB := sdk.NewCoin("ukava", fundsToDeposit.AmountOf("ukava")) - err := suite.Keeper.Deposit(suite.Ctx, owner.GetAddress(), depositA, depositB, sdk.MustNewDecFromStr("4")) + err := suite.Keeper.Deposit(suite.Ctx, owner.GetAddress(), depositA, depositB, sdkmath.LegacyMustNewDecFromStr("4")) suite.Require().NoError(err) totalDeposit := reserves.Add(fundsToDeposit...) @@ -266,16 +266,16 @@ func (suite *keeperTestSuite) TestDeposit_Slippage() { testCases := []struct { depositA sdk.Coin depositB sdk.Coin - slippage sdk.Dec + slippage sdkmath.LegacyDec shouldFail bool }{ - {sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.NewCoin("ukava", sdkmath.NewInt(5e6)), sdk.MustNewDecFromStr("0.7"), true}, - {sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.NewCoin("ukava", sdkmath.NewInt(5e6)), sdk.MustNewDecFromStr("0.8"), true}, - {sdk.NewCoin("ukava", sdkmath.NewInt(5e6)), sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.MustNewDecFromStr("3"), true}, - {sdk.NewCoin("ukava", sdkmath.NewInt(5e6)), sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.MustNewDecFromStr("4"), false}, - {sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.MustNewDecFromStr("0"), false}, - {sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(4e6)), sdk.MustNewDecFromStr("0.25"), false}, - {sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(4e6)), sdk.MustNewDecFromStr("0.2"), true}, + {sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.NewCoin("ukava", sdkmath.NewInt(5e6)), sdkmath.LegacyMustNewDecFromStr("0.7"), true}, + {sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.NewCoin("ukava", sdkmath.NewInt(5e6)), sdkmath.LegacyMustNewDecFromStr("0.8"), true}, + {sdk.NewCoin("ukava", sdkmath.NewInt(5e6)), sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdkmath.LegacyMustNewDecFromStr("3"), true}, + {sdk.NewCoin("ukava", sdkmath.NewInt(5e6)), sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdkmath.LegacyMustNewDecFromStr("4"), false}, + {sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdkmath.LegacyMustNewDecFromStr("0"), false}, + {sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(4e6)), sdkmath.LegacyMustNewDecFromStr("0.25"), false}, + {sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(4e6)), sdkmath.LegacyMustNewDecFromStr("0.2"), true}, } for _, tc := range testCases { @@ -291,7 +291,7 @@ func (suite *keeperTestSuite) TestDeposit_Slippage() { ) depositor := suite.CreateAccount(balance) - ctx := suite.App.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + ctx := suite.App.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) err = suite.Keeper.Deposit(ctx, depositor.GetAddress(), tc.depositA, tc.depositB, tc.slippage) if tc.shouldFail { @@ -334,7 +334,7 @@ func (suite *keeperTestSuite) TestDeposit_InsufficientLiquidity() { balance := sdk.NewCoins(tc.depositA, tc.depositB) depositor := suite.CreateAccount(balance) - err := suite.Keeper.Deposit(suite.Ctx, depositor.GetAddress(), tc.depositA, tc.depositB, sdk.MustNewDecFromStr("10")) + err := suite.Keeper.Deposit(suite.Ctx, depositor.GetAddress(), tc.depositA, tc.depositB, sdkmath.LegacyMustNewDecFromStr("10")) suite.EqualError(err, "deposit must be increased: insufficient liquidity") }) } diff --git a/x/swap/keeper/grpc_query.go b/x/swap/keeper/grpc_query.go index ba697c5406..a1baa1dd04 100644 --- a/x/swap/keeper/grpc_query.go +++ b/x/swap/keeper/grpc_query.go @@ -7,7 +7,7 @@ import ( "google.golang.org/grpc/codes" "google.golang.org/grpc/status" - "github.com/cosmos/cosmos-sdk/store/prefix" + "cosmossdk.io/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/query" diff --git a/x/swap/keeper/hooks.go b/x/swap/keeper/hooks.go index 11e0f5107b..1be13b5194 100644 --- a/x/swap/keeper/hooks.go +++ b/x/swap/keeper/hooks.go @@ -1,6 +1,7 @@ package keeper import ( + "context" sdkmath "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" @@ -11,14 +12,14 @@ import ( var _ types.SwapHooks = Keeper{} // AfterPoolDepositCreated - call hook if registered -func (k Keeper) AfterPoolDepositCreated(ctx sdk.Context, poolID string, depositor sdk.AccAddress, sharesOwned sdkmath.Int) { +func (k Keeper) AfterPoolDepositCreated(ctx context.Context, poolID string, depositor sdk.AccAddress, sharesOwned sdkmath.Int) { if k.hooks != nil { k.hooks.AfterPoolDepositCreated(ctx, poolID, depositor, sharesOwned) } } // BeforePoolDepositModified - call hook if registered -func (k Keeper) BeforePoolDepositModified(ctx sdk.Context, poolID string, depositor sdk.AccAddress, sharesOwned sdkmath.Int) { +func (k Keeper) BeforePoolDepositModified(ctx context.Context, poolID string, depositor sdk.AccAddress, sharesOwned sdkmath.Int) { if k.hooks != nil { k.hooks.BeforePoolDepositModified(ctx, poolID, depositor, sharesOwned) } diff --git a/x/swap/keeper/hooks_test.go b/x/swap/keeper/hooks_test.go index 893aa65856..d76c7eca34 100644 --- a/x/swap/keeper/hooks_test.go +++ b/x/swap/keeper/hooks_test.go @@ -33,13 +33,13 @@ func (suite *keeperTestSuite) TestHooks_DepositAndWithdraw() { // first deposit creates pool - calls AfterPoolDepositCreated with initial shares swapHooks.On("AfterPoolDepositCreated", suite.Ctx, types.PoolIDFromCoins(deposit), depositor_1.GetAddress(), expectedShares).Once() - err := suite.Keeper.Deposit(suite.Ctx, depositor_1.GetAddress(), depositA, depositB, sdk.MustNewDecFromStr("0.0015")) + err := suite.Keeper.Deposit(suite.Ctx, depositor_1.GetAddress(), depositA, depositB, sdkmath.LegacyMustNewDecFromStr("0.0015")) suite.Require().NoError(err) // second deposit adds to pool - calls BeforePoolDepositModified // shares given are the initial shares, not the shares added to the pool swapHooks.On("BeforePoolDepositModified", suite.Ctx, types.PoolIDFromCoins(deposit), depositor_1.GetAddress(), expectedShares).Once() - err = suite.Keeper.Deposit(suite.Ctx, depositor_1.GetAddress(), sdk.NewCoin("ukava", sdkmath.NewInt(5e6)), sdk.NewCoin("usdx", sdkmath.NewInt(25e6)), sdk.MustNewDecFromStr("0.0015")) + err = suite.Keeper.Deposit(suite.Ctx, depositor_1.GetAddress(), sdk.NewCoin("ukava", sdkmath.NewInt(5e6)), sdk.NewCoin("usdx", sdkmath.NewInt(25e6)), sdkmath.LegacyMustNewDecFromStr("0.0015")) suite.Require().NoError(err) // get the shares from the store from the last deposit @@ -49,7 +49,7 @@ func (suite *keeperTestSuite) TestHooks_DepositAndWithdraw() { // third deposit adds to pool - calls BeforePoolDepositModified // shares given are the shares added in previous deposit, not the shares added to the pool now swapHooks.On("BeforePoolDepositModified", suite.Ctx, types.PoolIDFromCoins(deposit), depositor_1.GetAddress(), shareRecord.SharesOwned).Once() - err = suite.Keeper.Deposit(suite.Ctx, depositor_1.GetAddress(), sdk.NewCoin("ukava", sdkmath.NewInt(10e6)), sdk.NewCoin("usdx", sdkmath.NewInt(50e6)), sdk.MustNewDecFromStr("0.0015")) + err = suite.Keeper.Deposit(suite.Ctx, depositor_1.GetAddress(), sdk.NewCoin("ukava", sdkmath.NewInt(10e6)), sdk.NewCoin("usdx", sdkmath.NewInt(50e6)), sdkmath.LegacyMustNewDecFromStr("0.0015")) suite.Require().NoError(err) depositor_2 := suite.NewAccountFromAddr( @@ -63,12 +63,12 @@ func (suite *keeperTestSuite) TestHooks_DepositAndWithdraw() { // first deposit deposit into pool creates the deposit and calls AfterPoolDepositCreated expectedShares = sdkmath.NewInt(2236067) swapHooks.On("AfterPoolDepositCreated", suite.Ctx, types.PoolIDFromCoins(deposit), depositor_2.GetAddress(), expectedShares).Once() - err = suite.Keeper.Deposit(suite.Ctx, depositor_2.GetAddress(), sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.MustNewDecFromStr("0.0015")) + err = suite.Keeper.Deposit(suite.Ctx, depositor_2.GetAddress(), sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdkmath.LegacyMustNewDecFromStr("0.0015")) suite.Require().NoError(err) // second deposit into pool calls BeforePoolDepositModified with initial shares given swapHooks.On("BeforePoolDepositModified", suite.Ctx, types.PoolIDFromCoins(deposit), depositor_2.GetAddress(), expectedShares).Once() - err = suite.Keeper.Deposit(suite.Ctx, depositor_2.GetAddress(), sdk.NewCoin("ukava", sdkmath.NewInt(2e6)), sdk.NewCoin("usdx", sdkmath.NewInt(10e6)), sdk.MustNewDecFromStr("0.0015")) + err = suite.Keeper.Deposit(suite.Ctx, depositor_2.GetAddress(), sdk.NewCoin("ukava", sdkmath.NewInt(2e6)), sdk.NewCoin("usdx", sdkmath.NewInt(10e6)), sdkmath.LegacyMustNewDecFromStr("0.0015")) suite.Require().NoError(err) // get the shares from the store from the last deposit @@ -77,7 +77,7 @@ func (suite *keeperTestSuite) TestHooks_DepositAndWithdraw() { // third deposit into pool calls BeforePoolDepositModified with shares from last deposit swapHooks.On("BeforePoolDepositModified", suite.Ctx, types.PoolIDFromCoins(deposit), depositor_2.GetAddress(), shareRecord.SharesOwned).Once() - err = suite.Keeper.Deposit(suite.Ctx, depositor_2.GetAddress(), sdk.NewCoin("ukava", sdkmath.NewInt(3e6)), sdk.NewCoin("usdx", sdkmath.NewInt(15e6)), sdk.MustNewDecFromStr("0.0015")) + err = suite.Keeper.Deposit(suite.Ctx, depositor_2.GetAddress(), sdk.NewCoin("ukava", sdkmath.NewInt(3e6)), sdk.NewCoin("usdx", sdkmath.NewInt(15e6)), sdkmath.LegacyMustNewDecFromStr("0.0015")) suite.Require().NoError(err) // test hooks with a full withdraw of all shares @@ -135,11 +135,11 @@ func (suite *keeperTestSuite) TestHooks_NoPanicsOnNilHooks() { deposit := sdk.NewCoins(depositA, depositB) // deposit create pool should not panic when hooks are not set - err := suite.Keeper.Deposit(suite.Ctx, depositor.GetAddress(), depositA, depositB, sdk.MustNewDecFromStr("0.0015")) + err := suite.Keeper.Deposit(suite.Ctx, depositor.GetAddress(), depositA, depositB, sdkmath.LegacyMustNewDecFromStr("0.0015")) suite.Require().NoError(err) // existing deposit should not panic with hooks are not set - err = suite.Keeper.Deposit(suite.Ctx, depositor.GetAddress(), sdk.NewCoin("ukava", sdkmath.NewInt(5e6)), sdk.NewCoin("usdx", sdkmath.NewInt(25e6)), sdk.MustNewDecFromStr("0.0015")) + err = suite.Keeper.Deposit(suite.Ctx, depositor.GetAddress(), sdk.NewCoin("ukava", sdkmath.NewInt(5e6)), sdk.NewCoin("usdx", sdkmath.NewInt(25e6)), sdkmath.LegacyMustNewDecFromStr("0.0015")) suite.Require().NoError(err) // withdraw of shares should not panic when hooks are not set @@ -175,7 +175,7 @@ func (suite *keeperTestSuite) TestHooks_HookOrdering() { _, found := suite.Keeper.GetDepositorShares(suite.Ctx, depositor.GetAddress(), poolID) suite.Require().True(found, "expected after hook to be called after shares are updated") }) - err := suite.Keeper.Deposit(suite.Ctx, depositor.GetAddress(), depositA, depositB, sdk.MustNewDecFromStr("0.0015")) + err := suite.Keeper.Deposit(suite.Ctx, depositor.GetAddress(), depositA, depositB, sdkmath.LegacyMustNewDecFromStr("0.0015")) suite.Require().NoError(err) swapHooks.On("BeforePoolDepositModified", suite.Ctx, poolID, depositor.GetAddress(), expectedShares).Run(func(args mock.Arguments) { @@ -183,7 +183,7 @@ func (suite *keeperTestSuite) TestHooks_HookOrdering() { suite.Require().True(found, "expected share record to exist") suite.Equal(expectedShares, shareRecord.SharesOwned, "expected hook to be called before shares are updated") }) - err = suite.Keeper.Deposit(suite.Ctx, depositor.GetAddress(), depositA, depositB, sdk.MustNewDecFromStr("0.0015")) + err = suite.Keeper.Deposit(suite.Ctx, depositor.GetAddress(), depositA, depositB, sdkmath.LegacyMustNewDecFromStr("0.0015")) suite.Require().NoError(err) existingShareRecord, found := suite.Keeper.GetDepositorShares(suite.Ctx, depositor.GetAddress(), types.PoolIDFromCoins(deposit)) diff --git a/x/swap/keeper/integration_test.go b/x/swap/keeper/integration_test.go index 9e6f8de6b4..3fa6a1fd84 100644 --- a/x/swap/keeper/integration_test.go +++ b/x/swap/keeper/integration_test.go @@ -25,7 +25,7 @@ func cs(coins ...sdk.Coin) sdk.Coins { return sdk.NewCoins(coins...) } // AllowedPools: types.AllowedPools{ // types.NewAllowedPool("ukava", "usdx"), // }, -// SwapFee: sdk.MustNewDecFromStr("0.03"), +// SwapFee: sdkmath.LegacyMustNewDecFromStr("0.03"), // }, // } diff --git a/x/swap/keeper/invariants.go b/x/swap/keeper/invariants.go index c4bce02bca..e1e33159c8 100644 --- a/x/swap/keeper/invariants.go +++ b/x/swap/keeper/invariants.go @@ -86,7 +86,7 @@ func PoolReservesInvariant(k Keeper) sdk.Invariant { return false }) - broken := !reserves.IsEqual(balance) + broken := !reserves.Equal(balance) return message, broken } } @@ -107,7 +107,7 @@ func PoolSharesInvariant(k Keeper) sdk.Invariant { k.IteratePools(ctx, func(pr types.PoolRecord) bool { totalShares[pr.PoolID] = poolShares{ totalShares: pr.TotalShares, - totalSharesOwned: sdk.ZeroInt(), + totalSharesOwned: sdkmath.ZeroInt(), } return false @@ -119,7 +119,7 @@ func PoolSharesInvariant(k Keeper) sdk.Invariant { totalShares[sr.PoolID] = shares } else { totalShares[sr.PoolID] = poolShares{ - totalShares: sdk.ZeroInt(), + totalShares: sdkmath.ZeroInt(), totalSharesOwned: sr.SharesOwned, } } diff --git a/x/swap/keeper/keeper.go b/x/swap/keeper/keeper.go index 86bb32690f..4cd83ffea3 100644 --- a/x/swap/keeper/keeper.go +++ b/x/swap/keeper/keeper.go @@ -4,11 +4,10 @@ import ( "fmt" sdkmath "cosmossdk.io/math" + "cosmossdk.io/store/prefix" + storetypes "cosmossdk.io/store/types" "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/store/prefix" - storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" "github.com/kava-labs/kava/x/swap/types" @@ -72,12 +71,12 @@ func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { } // GetSwapFee returns the swap fee set in the module parameters -func (k Keeper) GetSwapFee(ctx sdk.Context) sdk.Dec { +func (k Keeper) GetSwapFee(ctx sdk.Context) sdkmath.LegacyDec { return k.GetParams(ctx).SwapFee } // GetSwapModuleAccount returns the swap ModuleAccount -func (k Keeper) GetSwapModuleAccount(ctx sdk.Context) authtypes.ModuleAccountI { +func (k Keeper) GetSwapModuleAccount(ctx sdk.Context) sdk.ModuleAccountI { return k.accountKeeper.GetModuleAccount(ctx, types.ModuleAccountName) } @@ -121,7 +120,7 @@ func (k Keeper) DeletePool(ctx sdk.Context, poolID string) { // IteratePools iterates over all pool objects in the store and performs a callback function func (k Keeper) IteratePools(ctx sdk.Context, cb func(record types.PoolRecord) (stop bool)) { store := prefix.NewStore(ctx.KVStore(k.key), types.PoolKeyPrefix) - iterator := sdk.KVStorePrefixIterator(store, []byte{}) + iterator := storetypes.KVStorePrefixIterator(store, []byte{}) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { var record types.PoolRecord @@ -187,7 +186,7 @@ func (k Keeper) DeleteDepositorShares(ctx sdk.Context, depositor sdk.AccAddress, // IterateDepositorShares iterates over all pool objects in the store and performs a callback function func (k Keeper) IterateDepositorShares(ctx sdk.Context, cb func(record types.ShareRecord) (stop bool)) { store := prefix.NewStore(ctx.KVStore(k.key), types.DepositorPoolSharesPrefix) - iterator := sdk.KVStorePrefixIterator(store, []byte{}) + iterator := storetypes.KVStorePrefixIterator(store, []byte{}) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { var record types.ShareRecord @@ -210,7 +209,7 @@ func (k Keeper) GetAllDepositorShares(ctx sdk.Context) (records types.ShareRecor // IterateDepositorSharesByOwner iterates over share records for a specific address and performs a callback function func (k Keeper) IterateDepositorSharesByOwner(ctx sdk.Context, owner sdk.AccAddress, cb func(record types.ShareRecord) (stop bool)) { store := prefix.NewStore(ctx.KVStore(k.key), types.DepositorPoolSharesPrefix) - iterator := sdk.KVStorePrefixIterator(store, owner.Bytes()) + iterator := storetypes.KVStorePrefixIterator(store, owner.Bytes()) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { var record types.ShareRecord diff --git a/x/swap/keeper/keeper_test.go b/x/swap/keeper/keeper_test.go index 07c0f6ca19..69014423e6 100644 --- a/x/swap/keeper/keeper_test.go +++ b/x/swap/keeper/keeper_test.go @@ -63,7 +63,7 @@ func (suite keeperTestSuite) TestParams_Persistance() { AllowedPools: types.AllowedPools{ types.NewAllowedPool("ukava", "usdx"), }, - SwapFee: sdk.MustNewDecFromStr("0.03"), + SwapFee: sdkmath.LegacyMustNewDecFromStr("0.03"), } keeper.SetParams(suite.Ctx, params) suite.Equal(keeper.GetParams(suite.Ctx), params) @@ -73,7 +73,7 @@ func (suite keeperTestSuite) TestParams_Persistance() { AllowedPools: types.AllowedPools{ types.NewAllowedPool("hard", "ukava"), }, - SwapFee: sdk.MustNewDecFromStr("0.01"), + SwapFee: sdkmath.LegacyMustNewDecFromStr("0.01"), } keeper.SetParams(suite.Ctx, params) suite.NotEqual(keeper.GetParams(suite.Ctx), oldParams) @@ -84,7 +84,7 @@ func (suite keeperTestSuite) TestParams_GetSwapFee() { keeper := suite.Keeper params := types.Params{ - SwapFee: sdk.MustNewDecFromStr("0.00333"), + SwapFee: sdkmath.LegacyMustNewDecFromStr("0.00333"), } keeper.SetParams(suite.Ctx, params) diff --git a/x/swap/keeper/msg_server_test.go b/x/swap/keeper/msg_server_test.go index 483cc656db..635085cab3 100644 --- a/x/swap/keeper/msg_server_test.go +++ b/x/swap/keeper/msg_server_test.go @@ -45,7 +45,7 @@ func (suite *msgServerTestSuite) TestDeposit_CreatePool() { depositor.GetAddress().String(), suite.BankKeeper.GetBalance(suite.Ctx, depositor.GetAddress(), pool.TokenA), suite.BankKeeper.GetBalance(suite.Ctx, depositor.GetAddress(), pool.TokenB), - sdk.MustNewDecFromStr("0.01"), + sdkmath.LegacyMustNewDecFromStr("0.01"), time.Now().Add(10*time.Minute).Unix(), ) @@ -95,7 +95,7 @@ func (suite *msgServerTestSuite) TestDeposit_DeadlineExceeded() { depositor.GetAddress().String(), suite.BankKeeper.GetBalance(suite.Ctx, depositor.GetAddress(), pool.TokenA), suite.BankKeeper.GetBalance(suite.Ctx, depositor.GetAddress(), pool.TokenB), - sdk.MustNewDecFromStr("0.01"), + sdkmath.LegacyMustNewDecFromStr("0.01"), suite.Ctx.BlockTime().Add(-1*time.Second).Unix(), ) @@ -124,7 +124,7 @@ func (suite *msgServerTestSuite) TestDeposit_ExistingPool() { depositor.GetAddress().String(), suite.BankKeeper.GetBalance(suite.Ctx, depositor.GetAddress(), "usdx"), suite.BankKeeper.GetBalance(suite.Ctx, depositor.GetAddress(), "ukava"), - sdk.MustNewDecFromStr("0.01"), + sdkmath.LegacyMustNewDecFromStr("0.01"), time.Now().Add(10*time.Minute).Unix(), ) @@ -188,7 +188,7 @@ func (suite *msgServerTestSuite) TestDeposit_ExistingPool_SlippageFailure() { depositor.GetAddress().String(), suite.BankKeeper.GetBalance(suite.Ctx, depositor.GetAddress(), "usdx"), suite.BankKeeper.GetBalance(suite.Ctx, depositor.GetAddress(), "ukava"), - sdk.MustNewDecFromStr("0.01"), + sdkmath.LegacyMustNewDecFromStr("0.01"), time.Now().Add(10*time.Minute).Unix(), ) @@ -208,7 +208,7 @@ func (suite *msgServerTestSuite) TestWithdraw_AllShares() { suite.Require().NoError(pool.Validate()) suite.Keeper.SetParams(suite.Ctx, types.NewParams(types.AllowedPools{pool}, types.DefaultSwapFee)) - err := suite.Keeper.Deposit(suite.Ctx, depositor.GetAddress(), reserves[0], reserves[1], sdk.MustNewDecFromStr("1")) + err := suite.Keeper.Deposit(suite.Ctx, depositor.GetAddress(), reserves[0], reserves[1], sdkmath.LegacyMustNewDecFromStr("1")) suite.Require().NoError(err) withdraw := types.NewMsgWithdraw( @@ -219,7 +219,7 @@ func (suite *msgServerTestSuite) TestWithdraw_AllShares() { time.Now().Add(10*time.Minute).Unix(), ) - suite.Ctx = suite.App.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + suite.Ctx = suite.App.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) res, err := suite.msgServer.Withdraw(sdk.WrapSDKContext(suite.Ctx), withdraw) suite.Require().Equal(&types.MsgWithdrawResponse{}, res) suite.Require().NoError(err) @@ -261,7 +261,7 @@ func (suite *msgServerTestSuite) TestWithdraw_PartialShares() { suite.Require().NoError(pool.Validate()) suite.Keeper.SetParams(suite.Ctx, types.NewParams(types.AllowedPools{pool}, types.DefaultSwapFee)) - err := suite.Keeper.Deposit(suite.Ctx, depositor.GetAddress(), reserves[0], reserves[1], sdk.MustNewDecFromStr("1")) + err := suite.Keeper.Deposit(suite.Ctx, depositor.GetAddress(), reserves[0], reserves[1], sdkmath.LegacyMustNewDecFromStr("1")) suite.Require().NoError(err) minTokenA := sdk.NewCoin("ukava", sdkmath.NewInt(4999999)) @@ -275,7 +275,7 @@ func (suite *msgServerTestSuite) TestWithdraw_PartialShares() { time.Now().Add(10*time.Minute).Unix(), ) - suite.Ctx = suite.App.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + suite.Ctx = suite.App.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) res, err := suite.msgServer.Withdraw(sdk.WrapSDKContext(suite.Ctx), withdraw) suite.Require().Equal(&types.MsgWithdrawResponse{}, res) suite.Require().NoError(err) @@ -319,7 +319,7 @@ func (suite *msgServerTestSuite) TestWithdraw_SlippageFailure() { suite.Require().NoError(pool.Validate()) suite.Keeper.SetParams(suite.Ctx, types.NewParams(types.AllowedPools{pool}, types.DefaultSwapFee)) - err := suite.Keeper.Deposit(suite.Ctx, depositor.GetAddress(), reserves[0], reserves[1], sdk.MustNewDecFromStr("1")) + err := suite.Keeper.Deposit(suite.Ctx, depositor.GetAddress(), reserves[0], reserves[1], sdkmath.LegacyMustNewDecFromStr("1")) suite.Require().NoError(err) minTokenA := sdk.NewCoin("ukava", sdkmath.NewInt(5e6)) @@ -378,11 +378,11 @@ func (suite *msgServerTestSuite) TestSwapExactForTokens() { requester.GetAddress().String(), swapInput, sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), - sdk.MustNewDecFromStr("0.01"), + sdkmath.LegacyMustNewDecFromStr("0.01"), time.Now().Add(10*time.Minute).Unix(), ) - suite.Ctx = suite.App.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + suite.Ctx = suite.App.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) res, err := suite.msgServer.SwapExactForTokens(sdk.WrapSDKContext(suite.Ctx), swapMsg) suite.Require().Equal(&types.MsgSwapExactForTokensResponse{}, res) suite.Require().NoError(err) @@ -442,11 +442,11 @@ func (suite *msgServerTestSuite) TestSwapExactForTokens_SlippageFailure() { requester.GetAddress().String(), swapInput, sdk.NewCoin("usdx", sdkmath.NewInt(5030338)), - sdk.MustNewDecFromStr("0.01"), + sdkmath.LegacyMustNewDecFromStr("0.01"), time.Now().Add(10*time.Minute).Unix(), ) - suite.Ctx = suite.App.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + suite.Ctx = suite.App.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) res, err := suite.msgServer.SwapExactForTokens(sdk.WrapSDKContext(suite.Ctx), swapMsg) suite.Require().Nil(res) suite.EqualError(err, "slippage 0.010000123252155223 > limit 0.010000000000000000: slippage exceeded") @@ -463,7 +463,7 @@ func (suite *msgServerTestSuite) TestSwapExactForTokens_DeadlineExceeded() { requester.GetAddress().String(), sdk.NewCoin("ukava", sdkmath.NewInt(5e6)), sdk.NewCoin("usdx", sdkmath.NewInt(25e5)), - sdk.MustNewDecFromStr("0.01"), + sdkmath.LegacyMustNewDecFromStr("0.01"), suite.Ctx.BlockTime().Add(-1*time.Second).Unix(), ) @@ -491,11 +491,11 @@ func (suite *msgServerTestSuite) TestSwapForExactTokens() { requester.GetAddress().String(), sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), swapOutput, - sdk.MustNewDecFromStr("0.01"), + sdkmath.LegacyMustNewDecFromStr("0.01"), time.Now().Add(10*time.Minute).Unix(), ) - suite.Ctx = suite.App.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + suite.Ctx = suite.App.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) res, err := suite.msgServer.SwapForExactTokens(sdk.WrapSDKContext(suite.Ctx), swapMsg) suite.Require().Equal(&types.MsgSwapForExactTokensResponse{}, res) suite.Require().NoError(err) @@ -555,11 +555,11 @@ func (suite *msgServerTestSuite) TestSwapForExactTokens_SlippageFailure() { requester.GetAddress().String(), sdk.NewCoin("ukava", sdkmath.NewInt(990991)), swapOutput, - sdk.MustNewDecFromStr("0.01"), + sdkmath.LegacyMustNewDecFromStr("0.01"), time.Now().Add(10*time.Minute).Unix(), ) - suite.Ctx = suite.App.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + suite.Ctx = suite.App.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) res, err := suite.msgServer.SwapForExactTokens(sdk.WrapSDKContext(suite.Ctx), swapMsg) suite.Require().Nil(res) suite.EqualError(err, "slippage 0.010000979019022939 > limit 0.010000000000000000: slippage exceeded") @@ -576,7 +576,7 @@ func (suite *msgServerTestSuite) TestSwapForExactTokens_DeadlineExceeded() { requester.GetAddress().String(), sdk.NewCoin("ukava", sdkmath.NewInt(5e6)), sdk.NewCoin("usdx", sdkmath.NewInt(25e5)), - sdk.MustNewDecFromStr("0.01"), + sdkmath.LegacyMustNewDecFromStr("0.01"), suite.Ctx.BlockTime().Add(-1*time.Second).Unix(), ) diff --git a/x/swap/keeper/swap.go b/x/swap/keeper/swap.go index b77aeee269..15f02df595 100644 --- a/x/swap/keeper/swap.go +++ b/x/swap/keeper/swap.go @@ -1,6 +1,7 @@ package keeper import ( + sdkmath "cosmossdk.io/math" "fmt" "github.com/kava-labs/kava/x/swap/types" @@ -10,7 +11,7 @@ import ( ) // SwapExactForTokens swaps an exact coin a input for a coin b output -func (k *Keeper) SwapExactForTokens(ctx sdk.Context, requester sdk.AccAddress, exactCoinA, coinB sdk.Coin, slippageLimit sdk.Dec) error { +func (k *Keeper) SwapExactForTokens(ctx sdk.Context, requester sdk.AccAddress, exactCoinA, coinB sdk.Coin, slippageLimit sdkmath.LegacyDec) error { poolID, pool, err := k.loadPool(ctx, exactCoinA.Denom, coinB.Denom) if err != nil { return err @@ -21,7 +22,7 @@ func (k *Keeper) SwapExactForTokens(ctx sdk.Context, requester sdk.AccAddress, e return errorsmod.Wrapf(types.ErrInsufficientLiquidity, "swap output rounds to zero, increase input amount") } - priceChange := sdk.NewDecFromInt(swapOutput.Amount).Quo(sdk.NewDecFromInt(coinB.Amount)) + priceChange := sdkmath.LegacyNewDecFromInt(swapOutput.Amount).Quo(sdkmath.LegacyNewDecFromInt(coinB.Amount)) if err := k.assertSlippageWithinLimit(priceChange, slippageLimit); err != nil { return err } @@ -34,7 +35,7 @@ func (k *Keeper) SwapExactForTokens(ctx sdk.Context, requester sdk.AccAddress, e } // SwapForExactTokens swaps a coin a input for an exact coin b output -func (k *Keeper) SwapForExactTokens(ctx sdk.Context, requester sdk.AccAddress, coinA, exactCoinB sdk.Coin, slippageLimit sdk.Dec) error { +func (k *Keeper) SwapForExactTokens(ctx sdk.Context, requester sdk.AccAddress, coinA, exactCoinB sdk.Coin, slippageLimit sdkmath.LegacyDec) error { poolID, pool, err := k.loadPool(ctx, coinA.Denom, exactCoinB.Denom) if err != nil { return err @@ -49,7 +50,7 @@ func (k *Keeper) SwapForExactTokens(ctx sdk.Context, requester sdk.AccAddress, c swapInput, feePaid := pool.SwapWithExactOutput(exactCoinB, k.GetSwapFee(ctx)) - priceChange := sdk.NewDecFromInt(coinA.Amount).Quo(sdk.NewDecFromInt(swapInput.Sub(feePaid).Amount)) + priceChange := sdkmath.LegacyNewDecFromInt(coinA.Amount).Quo(sdkmath.LegacyNewDecFromInt(swapInput.Sub(feePaid).Amount)) if err := k.assertSlippageWithinLimit(priceChange, slippageLimit); err != nil { return err } @@ -77,8 +78,8 @@ func (k Keeper) loadPool(ctx sdk.Context, denomA string, denomB string) (string, return poolID, pool, nil } -func (k Keeper) assertSlippageWithinLimit(priceChange sdk.Dec, slippageLimit sdk.Dec) error { - slippage := sdk.OneDec().Sub(priceChange) +func (k Keeper) assertSlippageWithinLimit(priceChange sdkmath.LegacyDec, slippageLimit sdkmath.LegacyDec) error { + slippage := sdkmath.LegacyOneDec().Sub(priceChange) if slippage.GT(slippageLimit) { return errorsmod.Wrapf(types.ErrSlippageExceeded, "slippage %s > limit %s", slippage, slippageLimit) } diff --git a/x/swap/keeper/swap_test.go b/x/swap/keeper/swap_test.go index 12d13af616..9d2005e454 100644 --- a/x/swap/keeper/swap_test.go +++ b/x/swap/keeper/swap_test.go @@ -14,7 +14,7 @@ import ( func (suite *keeperTestSuite) TestSwapExactForTokens() { suite.Keeper.SetParams(suite.Ctx, types.Params{ - SwapFee: sdk.MustNewDecFromStr("0.0025"), + SwapFee: sdkmath.LegacyMustNewDecFromStr("0.0025"), }) owner := suite.CreateAccount(sdk.Coins{}) reserves := sdk.NewCoins( @@ -31,7 +31,7 @@ func (suite *keeperTestSuite) TestSwapExactForTokens() { coinA := sdk.NewCoin("ukava", sdkmath.NewInt(1e6)) coinB := sdk.NewCoin("usdx", sdkmath.NewInt(5e6)) - err := suite.Keeper.SwapExactForTokens(suite.Ctx, requester.GetAddress(), coinA, coinB, sdk.MustNewDecFromStr("0.01")) + err := suite.Keeper.SwapExactForTokens(suite.Ctx, requester.GetAddress(), coinA, coinB, sdkmath.LegacyMustNewDecFromStr("0.01")) suite.Require().NoError(err) expectedOutput := sdk.NewCoin("usdx", sdkmath.NewInt(4982529)) @@ -67,7 +67,7 @@ func (suite *keeperTestSuite) TestSwapExactForTokens_OutputGreaterThanZero() { coinA := sdk.NewCoin("usdx", sdkmath.NewInt(5)) coinB := sdk.NewCoin("ukava", sdkmath.NewInt(1)) - err := suite.Keeper.SwapExactForTokens(suite.Ctx, requester.GetAddress(), coinA, coinB, sdk.MustNewDecFromStr("1")) + err := suite.Keeper.SwapExactForTokens(suite.Ctx, requester.GetAddress(), coinA, coinB, sdkmath.LegacyMustNewDecFromStr("1")) suite.EqualError(err, "swap output rounds to zero, increase input amount: insufficient liquidity") } @@ -83,48 +83,48 @@ func (suite *keeperTestSuite) TestSwapExactForTokens_Slippage() { testCases := []struct { coinA sdk.Coin coinB sdk.Coin - slippage sdk.Dec - fee sdk.Dec + slippage sdkmath.LegacyDec + fee sdkmath.LegacyDec shouldFail bool }{ // positive slippage OK - {sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(2e6)), sdk.MustNewDecFromStr("0.01"), sdk.MustNewDecFromStr("0.0025"), false}, - {sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(4e6)), sdk.MustNewDecFromStr("0.01"), sdk.MustNewDecFromStr("0.0025"), false}, - {sdk.NewCoin("usdx", sdkmath.NewInt(50e6)), sdk.NewCoin("ukava", sdkmath.NewInt(5e6)), sdk.MustNewDecFromStr("0.01"), sdk.MustNewDecFromStr("0.0025"), false}, - {sdk.NewCoin("usdx", sdkmath.NewInt(50e6)), sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.MustNewDecFromStr("0.01"), sdk.MustNewDecFromStr("0.0025"), false}, + {sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(2e6)), sdkmath.LegacyMustNewDecFromStr("0.01"), sdkmath.LegacyMustNewDecFromStr("0.0025"), false}, + {sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(4e6)), sdkmath.LegacyMustNewDecFromStr("0.01"), sdkmath.LegacyMustNewDecFromStr("0.0025"), false}, + {sdk.NewCoin("usdx", sdkmath.NewInt(50e6)), sdk.NewCoin("ukava", sdkmath.NewInt(5e6)), sdkmath.LegacyMustNewDecFromStr("0.01"), sdkmath.LegacyMustNewDecFromStr("0.0025"), false}, + {sdk.NewCoin("usdx", sdkmath.NewInt(50e6)), sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdkmath.LegacyMustNewDecFromStr("0.01"), sdkmath.LegacyMustNewDecFromStr("0.0025"), false}, // positive slippage with zero slippage OK - {sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(2e6)), sdk.ZeroDec(), sdk.MustNewDecFromStr("0.0025"), false}, - {sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(4e6)), sdk.ZeroDec(), sdk.MustNewDecFromStr("0.0025"), false}, - {sdk.NewCoin("usdx", sdkmath.NewInt(50e6)), sdk.NewCoin("ukava", sdkmath.NewInt(5e6)), sdk.ZeroDec(), sdk.MustNewDecFromStr("0.0025"), false}, - {sdk.NewCoin("usdx", sdkmath.NewInt(50e6)), sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.ZeroDec(), sdk.MustNewDecFromStr("0.0025"), false}, + {sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(2e6)), sdkmath.LegacyZeroDec(), sdkmath.LegacyMustNewDecFromStr("0.0025"), false}, + {sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(4e6)), sdkmath.LegacyZeroDec(), sdkmath.LegacyMustNewDecFromStr("0.0025"), false}, + {sdk.NewCoin("usdx", sdkmath.NewInt(50e6)), sdk.NewCoin("ukava", sdkmath.NewInt(5e6)), sdkmath.LegacyZeroDec(), sdkmath.LegacyMustNewDecFromStr("0.0025"), false}, + {sdk.NewCoin("usdx", sdkmath.NewInt(50e6)), sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdkmath.LegacyZeroDec(), sdkmath.LegacyMustNewDecFromStr("0.0025"), false}, // exact zero slippage OK - {sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(4950495)), sdk.ZeroDec(), sdk.MustNewDecFromStr("0"), false}, - {sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(4935790)), sdk.ZeroDec(), sdk.MustNewDecFromStr("0.003"), false}, - {sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(4705299)), sdk.ZeroDec(), sdk.MustNewDecFromStr("0.05"), false}, - {sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.NewCoin("ukava", sdkmath.NewInt(990099)), sdk.ZeroDec(), sdk.MustNewDecFromStr("0"), false}, - {sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.NewCoin("ukava", sdkmath.NewInt(987158)), sdk.ZeroDec(), sdk.MustNewDecFromStr("0.003"), false}, - {sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.NewCoin("ukava", sdkmath.NewInt(941059)), sdk.ZeroDec(), sdk.MustNewDecFromStr("0.05"), false}, + {sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(4950495)), sdkmath.LegacyZeroDec(), sdkmath.LegacyMustNewDecFromStr("0"), false}, + {sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(4935790)), sdkmath.LegacyZeroDec(), sdkmath.LegacyMustNewDecFromStr("0.003"), false}, + {sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(4705299)), sdkmath.LegacyZeroDec(), sdkmath.LegacyMustNewDecFromStr("0.05"), false}, + {sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.NewCoin("ukava", sdkmath.NewInt(990099)), sdkmath.LegacyZeroDec(), sdkmath.LegacyMustNewDecFromStr("0"), false}, + {sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.NewCoin("ukava", sdkmath.NewInt(987158)), sdkmath.LegacyZeroDec(), sdkmath.LegacyMustNewDecFromStr("0.003"), false}, + {sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.NewCoin("ukava", sdkmath.NewInt(941059)), sdkmath.LegacyZeroDec(), sdkmath.LegacyMustNewDecFromStr("0.05"), false}, // slippage failure, zero slippage tolerance - {sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(4950496)), sdk.ZeroDec(), sdk.MustNewDecFromStr("0"), true}, - {sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(4935793)), sdk.ZeroDec(), sdk.MustNewDecFromStr("0.003"), true}, - {sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(4705300)), sdk.ZeroDec(), sdk.MustNewDecFromStr("0.05"), true}, - {sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.NewCoin("ukava", sdkmath.NewInt(990100)), sdk.ZeroDec(), sdk.MustNewDecFromStr("0"), true}, - {sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.NewCoin("ukava", sdkmath.NewInt(987159)), sdk.ZeroDec(), sdk.MustNewDecFromStr("0.003"), true}, - {sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.NewCoin("ukava", sdkmath.NewInt(941060)), sdk.ZeroDec(), sdk.MustNewDecFromStr("0.05"), true}, + {sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(4950496)), sdkmath.LegacyZeroDec(), sdkmath.LegacyMustNewDecFromStr("0"), true}, + {sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(4935793)), sdkmath.LegacyZeroDec(), sdkmath.LegacyMustNewDecFromStr("0.003"), true}, + {sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(4705300)), sdkmath.LegacyZeroDec(), sdkmath.LegacyMustNewDecFromStr("0.05"), true}, + {sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.NewCoin("ukava", sdkmath.NewInt(990100)), sdkmath.LegacyZeroDec(), sdkmath.LegacyMustNewDecFromStr("0"), true}, + {sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.NewCoin("ukava", sdkmath.NewInt(987159)), sdkmath.LegacyZeroDec(), sdkmath.LegacyMustNewDecFromStr("0.003"), true}, + {sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.NewCoin("ukava", sdkmath.NewInt(941060)), sdkmath.LegacyZeroDec(), sdkmath.LegacyMustNewDecFromStr("0.05"), true}, // slippage failure, 1 percent slippage - {sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(5000501)), sdk.MustNewDecFromStr("0.01"), sdk.MustNewDecFromStr("0"), true}, - {sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(4985647)), sdk.MustNewDecFromStr("0.01"), sdk.MustNewDecFromStr("0.003"), true}, - {sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(4752828)), sdk.MustNewDecFromStr("0.01"), sdk.MustNewDecFromStr("0.05"), true}, - {sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.NewCoin("ukava", sdkmath.NewInt(1000101)), sdk.MustNewDecFromStr("0.01"), sdk.MustNewDecFromStr("0"), true}, - {sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.NewCoin("ukava", sdkmath.NewInt(997130)), sdk.MustNewDecFromStr("0.01"), sdk.MustNewDecFromStr("0.003"), true}, - {sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.NewCoin("ukava", sdkmath.NewInt(950565)), sdk.MustNewDecFromStr("0.01"), sdk.MustNewDecFromStr("0.05"), true}, + {sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(5000501)), sdkmath.LegacyMustNewDecFromStr("0.01"), sdkmath.LegacyMustNewDecFromStr("0"), true}, + {sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(4985647)), sdkmath.LegacyMustNewDecFromStr("0.01"), sdkmath.LegacyMustNewDecFromStr("0.003"), true}, + {sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(4752828)), sdkmath.LegacyMustNewDecFromStr("0.01"), sdkmath.LegacyMustNewDecFromStr("0.05"), true}, + {sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.NewCoin("ukava", sdkmath.NewInt(1000101)), sdkmath.LegacyMustNewDecFromStr("0.01"), sdkmath.LegacyMustNewDecFromStr("0"), true}, + {sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.NewCoin("ukava", sdkmath.NewInt(997130)), sdkmath.LegacyMustNewDecFromStr("0.01"), sdkmath.LegacyMustNewDecFromStr("0.003"), true}, + {sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.NewCoin("ukava", sdkmath.NewInt(950565)), sdkmath.LegacyMustNewDecFromStr("0.01"), sdkmath.LegacyMustNewDecFromStr("0.05"), true}, // slippage OK, 1 percent slippage - {sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(5000500)), sdk.MustNewDecFromStr("0.01"), sdk.MustNewDecFromStr("0"), false}, - {sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(4985646)), sdk.MustNewDecFromStr("0.01"), sdk.MustNewDecFromStr("0.003"), false}, - {sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(4752827)), sdk.MustNewDecFromStr("0.01"), sdk.MustNewDecFromStr("0.05"), false}, - {sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.NewCoin("ukava", sdkmath.NewInt(1000100)), sdk.MustNewDecFromStr("0.01"), sdk.MustNewDecFromStr("0"), false}, - {sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.NewCoin("ukava", sdkmath.NewInt(997129)), sdk.MustNewDecFromStr("0.01"), sdk.MustNewDecFromStr("0.003"), false}, - {sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.NewCoin("ukava", sdkmath.NewInt(950564)), sdk.MustNewDecFromStr("0.01"), sdk.MustNewDecFromStr("0.05"), false}, + {sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(5000500)), sdkmath.LegacyMustNewDecFromStr("0.01"), sdkmath.LegacyMustNewDecFromStr("0"), false}, + {sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(4985646)), sdkmath.LegacyMustNewDecFromStr("0.01"), sdkmath.LegacyMustNewDecFromStr("0.003"), false}, + {sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(4752827)), sdkmath.LegacyMustNewDecFromStr("0.01"), sdkmath.LegacyMustNewDecFromStr("0.05"), false}, + {sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.NewCoin("ukava", sdkmath.NewInt(1000100)), sdkmath.LegacyMustNewDecFromStr("0.01"), sdkmath.LegacyMustNewDecFromStr("0"), false}, + {sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.NewCoin("ukava", sdkmath.NewInt(997129)), sdkmath.LegacyMustNewDecFromStr("0.01"), sdkmath.LegacyMustNewDecFromStr("0.003"), false}, + {sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.NewCoin("ukava", sdkmath.NewInt(950564)), sdkmath.LegacyMustNewDecFromStr("0.01"), sdkmath.LegacyMustNewDecFromStr("0.05"), false}, } for _, tc := range testCases { @@ -146,7 +146,7 @@ func (suite *keeperTestSuite) TestSwapExactForTokens_Slippage() { ) requester := suite.NewAccountFromAddr(sdk.AccAddress("requester-----------"), balance) - ctx := suite.App.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + ctx := suite.App.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) err := suite.Keeper.SwapExactForTokens(ctx, requester.GetAddress(), tc.coinA, tc.coinB, tc.slippage) if tc.shouldFail { @@ -166,8 +166,8 @@ func (suite *keeperTestSuite) TestSwapExactForTokens_InsufficientFunds() { coinA sdk.Coin coinB sdk.Coin }{ - {"no ukava balance", sdk.NewCoin("ukava", sdk.ZeroInt()), sdk.NewCoin("ukava", sdkmath.NewInt(100)), sdk.NewCoin("usdx", sdkmath.NewInt(500))}, - {"no usdx balance", sdk.NewCoin("usdx", sdk.ZeroInt()), sdk.NewCoin("usdx", sdkmath.NewInt(500)), sdk.NewCoin("ukava", sdkmath.NewInt(100))}, + {"no ukava balance", sdk.NewCoin("ukava", sdkmath.ZeroInt()), sdk.NewCoin("ukava", sdkmath.NewInt(100)), sdk.NewCoin("usdx", sdkmath.NewInt(500))}, + {"no usdx balance", sdk.NewCoin("usdx", sdkmath.ZeroInt()), sdk.NewCoin("usdx", sdkmath.NewInt(500)), sdk.NewCoin("ukava", sdkmath.NewInt(100))}, {"low ukava balance", sdk.NewCoin("ukava", sdkmath.NewInt(1000000)), sdk.NewCoin("ukava", sdkmath.NewInt(1000001)), sdk.NewCoin("usdx", sdkmath.NewInt(5000000))}, {"low ukava balance", sdk.NewCoin("usdx", sdkmath.NewInt(5000000)), sdk.NewCoin("usdx", sdkmath.NewInt(5000001)), sdk.NewCoin("ukava", sdkmath.NewInt(1000000))}, {"large ukava balance difference", sdk.NewCoin("ukava", sdkmath.NewInt(100e6)), sdk.NewCoin("ukava", sdkmath.NewInt(1000e6)), sdk.NewCoin("usdx", sdkmath.NewInt(5000e6))}, @@ -187,8 +187,8 @@ func (suite *keeperTestSuite) TestSwapExactForTokens_InsufficientFunds() { balance := sdk.NewCoins(tc.balanceA) requester := suite.NewAccountFromAddr(sdk.AccAddress("requester-----------"), balance) - ctx := suite.App.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) - err := suite.Keeper.SwapExactForTokens(ctx, requester.GetAddress(), tc.coinA, tc.coinB, sdk.MustNewDecFromStr("0.1")) + ctx := suite.App.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + err := suite.Keeper.SwapExactForTokens(ctx, requester.GetAddress(), tc.coinA, tc.coinB, sdkmath.LegacyMustNewDecFromStr("0.1")) suite.Require().True(errors.Is(err, sdkerrors.ErrInsufficientFunds), fmt.Sprintf("got err %s", err)) }) } @@ -202,8 +202,8 @@ func (suite *keeperTestSuite) TestSwapExactForTokens_InsufficientFunds_Vesting() coinA sdk.Coin coinB sdk.Coin }{ - {"no ukava balance, vesting only", sdk.NewCoin("ukava", sdk.ZeroInt()), sdk.NewCoin("ukava", sdkmath.NewInt(100)), sdk.NewCoin("ukava", sdkmath.NewInt(100)), sdk.NewCoin("usdx", sdkmath.NewInt(500))}, - {"no usdx balance, vesting only", sdk.NewCoin("usdx", sdk.ZeroInt()), sdk.NewCoin("usdx", sdkmath.NewInt(500)), sdk.NewCoin("usdx", sdkmath.NewInt(500)), sdk.NewCoin("ukava", sdkmath.NewInt(100))}, + {"no ukava balance, vesting only", sdk.NewCoin("ukava", sdkmath.ZeroInt()), sdk.NewCoin("ukava", sdkmath.NewInt(100)), sdk.NewCoin("ukava", sdkmath.NewInt(100)), sdk.NewCoin("usdx", sdkmath.NewInt(500))}, + {"no usdx balance, vesting only", sdk.NewCoin("usdx", sdkmath.ZeroInt()), sdk.NewCoin("usdx", sdkmath.NewInt(500)), sdk.NewCoin("usdx", sdkmath.NewInt(500)), sdk.NewCoin("ukava", sdkmath.NewInt(100))}, {"low ukava balance, vesting matches exact", sdk.NewCoin("ukava", sdkmath.NewInt(1000000)), sdk.NewCoin("ukava", sdkmath.NewInt(1)), sdk.NewCoin("ukava", sdkmath.NewInt(1000001)), sdk.NewCoin("usdx", sdkmath.NewInt(5000000))}, {"low ukava balance, vesting matches exact", sdk.NewCoin("usdx", sdkmath.NewInt(5000000)), sdk.NewCoin("usdx", sdkmath.NewInt(1)), sdk.NewCoin("usdx", sdkmath.NewInt(5000001)), sdk.NewCoin("ukava", sdkmath.NewInt(1000000))}, {"large ukava balance difference, vesting covers difference", sdk.NewCoin("ukava", sdkmath.NewInt(100e6)), sdk.NewCoin("ukava", sdkmath.NewInt(1000e6)), sdk.NewCoin("ukava", sdkmath.NewInt(1000e6)), sdk.NewCoin("usdx", sdkmath.NewInt(5000e6))}, @@ -224,8 +224,8 @@ func (suite *keeperTestSuite) TestSwapExactForTokens_InsufficientFunds_Vesting() vesting := sdk.NewCoins(tc.vestingA) requester := suite.CreateVestingAccount(balance, vesting) - ctx := suite.App.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) - err := suite.Keeper.SwapExactForTokens(ctx, requester.GetAddress(), tc.coinA, tc.coinB, sdk.MustNewDecFromStr("0.1")) + ctx := suite.App.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + err := suite.Keeper.SwapExactForTokens(ctx, requester.GetAddress(), tc.coinA, tc.coinB, sdkmath.LegacyMustNewDecFromStr("0.1")) suite.Require().True(errors.Is(err, sdkerrors.ErrInsufficientFunds), fmt.Sprintf("got err %s", err)) }) } @@ -249,10 +249,10 @@ func (suite *keeperTestSuite) TestSwapExactForTokens_PoolNotFound() { coinA := sdk.NewCoin("ukava", sdkmath.NewInt(1e6)) coinB := sdk.NewCoin("usdx", sdkmath.NewInt(5e6)) - err := suite.Keeper.SwapExactForTokens(suite.Ctx, requester.GetAddress(), coinA, coinB, sdk.MustNewDecFromStr("0.01")) + err := suite.Keeper.SwapExactForTokens(suite.Ctx, requester.GetAddress(), coinA, coinB, sdkmath.LegacyMustNewDecFromStr("0.01")) suite.EqualError(err, "pool ukava:usdx not found: invalid pool") - err = suite.Keeper.SwapExactForTokens(suite.Ctx, requester.GetAddress(), coinB, coinA, sdk.MustNewDecFromStr("0.01")) + err = suite.Keeper.SwapExactForTokens(suite.Ctx, requester.GetAddress(), coinB, coinA, sdkmath.LegacyMustNewDecFromStr("0.01")) suite.EqualError(err, "pool ukava:usdx not found: invalid pool") } @@ -268,7 +268,7 @@ func (suite *keeperTestSuite) TestSwapExactForTokens_PanicOnInvalidPool() { poolRecord, found := suite.Keeper.GetPool(suite.Ctx, poolID) suite.Require().True(found, "expected pool record to exist") - poolRecord.TotalShares = sdk.ZeroInt() + poolRecord.TotalShares = sdkmath.ZeroInt() suite.Keeper.SetPool_Raw(suite.Ctx, poolRecord) balance := sdk.NewCoins( @@ -280,11 +280,11 @@ func (suite *keeperTestSuite) TestSwapExactForTokens_PanicOnInvalidPool() { coinB := sdk.NewCoin("usdx", sdkmath.NewInt(5e6)) suite.PanicsWithValue("invalid pool ukava:usdx: total shares must be greater than zero: invalid pool", func() { - _ = suite.Keeper.SwapExactForTokens(suite.Ctx, requester.GetAddress(), coinA, coinB, sdk.MustNewDecFromStr("0.01")) + _ = suite.Keeper.SwapExactForTokens(suite.Ctx, requester.GetAddress(), coinA, coinB, sdkmath.LegacyMustNewDecFromStr("0.01")) }, "expected invalid pool record to panic") suite.PanicsWithValue("invalid pool ukava:usdx: total shares must be greater than zero: invalid pool", func() { - _ = suite.Keeper.SwapExactForTokens(suite.Ctx, requester.GetAddress(), coinB, coinA, sdk.MustNewDecFromStr("0.01")) + _ = suite.Keeper.SwapExactForTokens(suite.Ctx, requester.GetAddress(), coinB, coinA, sdkmath.LegacyMustNewDecFromStr("0.01")) }, "expected invalid pool record to panic") } @@ -311,17 +311,17 @@ func (suite *keeperTestSuite) TestSwapExactForTokens_PanicOnInsufficientModuleAc coinB := sdk.NewCoin("usdx", sdkmath.NewInt(5e6)) suite.Panics(func() { - _ = suite.Keeper.SwapExactForTokens(suite.Ctx, requester.GetAddress(), coinA, coinB, sdk.MustNewDecFromStr("0.01")) + _ = suite.Keeper.SwapExactForTokens(suite.Ctx, requester.GetAddress(), coinA, coinB, sdkmath.LegacyMustNewDecFromStr("0.01")) }, "expected panic when module account does not have enough funds") suite.Panics(func() { - _ = suite.Keeper.SwapExactForTokens(suite.Ctx, requester.GetAddress(), coinA, coinB, sdk.MustNewDecFromStr("0.01")) + _ = suite.Keeper.SwapExactForTokens(suite.Ctx, requester.GetAddress(), coinA, coinB, sdkmath.LegacyMustNewDecFromStr("0.01")) }, "expected panic when module account does not have enough funds") } func (suite *keeperTestSuite) TestSwapForExactTokens() { suite.Keeper.SetParams(suite.Ctx, types.Params{ - SwapFee: sdk.MustNewDecFromStr("0.0025"), + SwapFee: sdkmath.LegacyMustNewDecFromStr("0.0025"), }) owner := suite.CreateAccount(sdk.Coins{}) reserves := sdk.NewCoins( @@ -338,7 +338,7 @@ func (suite *keeperTestSuite) TestSwapForExactTokens() { coinA := sdk.NewCoin("ukava", sdkmath.NewInt(1e6)) coinB := sdk.NewCoin("usdx", sdkmath.NewInt(5e6)) - err := suite.Keeper.SwapForExactTokens(suite.Ctx, requester.GetAddress(), coinA, coinB, sdk.MustNewDecFromStr("0.01")) + err := suite.Keeper.SwapForExactTokens(suite.Ctx, requester.GetAddress(), coinA, coinB, sdkmath.LegacyMustNewDecFromStr("0.01")) suite.Require().NoError(err) expectedInput := sdk.NewCoin("ukava", sdkmath.NewInt(1003511)) @@ -373,12 +373,12 @@ func (suite *keeperTestSuite) TestSwapForExactTokens_OutputLessThanPoolReserves( requester := suite.NewAccountFromAddr(sdk.AccAddress("requester-----------"), balance) coinA := sdk.NewCoin("ukava", sdkmath.NewInt(1e6)) - coinB := sdk.NewCoin("usdx", sdkmath.NewInt(500e6).Add(sdk.OneInt())) - err := suite.Keeper.SwapForExactTokens(suite.Ctx, requester.GetAddress(), coinA, coinB, sdk.MustNewDecFromStr("0.01")) + coinB := sdk.NewCoin("usdx", sdkmath.NewInt(500e6).Add(sdkmath.OneInt())) + err := suite.Keeper.SwapForExactTokens(suite.Ctx, requester.GetAddress(), coinA, coinB, sdkmath.LegacyMustNewDecFromStr("0.01")) suite.EqualError(err, "output 500000001 >= pool reserves 500000000: insufficient liquidity") coinB = sdk.NewCoin("usdx", sdkmath.NewInt(500e6)) - err = suite.Keeper.SwapForExactTokens(suite.Ctx, requester.GetAddress(), coinA, coinB, sdk.MustNewDecFromStr("0.01")) + err = suite.Keeper.SwapForExactTokens(suite.Ctx, requester.GetAddress(), coinA, coinB, sdkmath.LegacyMustNewDecFromStr("0.01")) suite.EqualError(err, "output 500000000 >= pool reserves 500000000: insufficient liquidity") } @@ -394,48 +394,48 @@ func (suite *keeperTestSuite) TestSwapForExactTokens_Slippage() { testCases := []struct { coinA sdk.Coin coinB sdk.Coin - slippage sdk.Dec - fee sdk.Dec + slippage sdkmath.LegacyDec + fee sdkmath.LegacyDec shouldFail bool }{ // positive slippage OK - {sdk.NewCoin("ukava", sdkmath.NewInt(5e6)), sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.MustNewDecFromStr("0.01"), sdk.MustNewDecFromStr("0.0025"), false}, - {sdk.NewCoin("ukava", sdkmath.NewInt(5e6)), sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.MustNewDecFromStr("0.01"), sdk.MustNewDecFromStr("0.0025"), false}, - {sdk.NewCoin("usdx", sdkmath.NewInt(100e6)), sdk.NewCoin("ukava", sdkmath.NewInt(10e6)), sdk.MustNewDecFromStr("0.01"), sdk.MustNewDecFromStr("0.0025"), false}, - {sdk.NewCoin("usdx", sdkmath.NewInt(100e6)), sdk.NewCoin("ukava", sdkmath.NewInt(10e6)), sdk.MustNewDecFromStr("0.01"), sdk.MustNewDecFromStr("0.0025"), false}, + {sdk.NewCoin("ukava", sdkmath.NewInt(5e6)), sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdkmath.LegacyMustNewDecFromStr("0.01"), sdkmath.LegacyMustNewDecFromStr("0.0025"), false}, + {sdk.NewCoin("ukava", sdkmath.NewInt(5e6)), sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdkmath.LegacyMustNewDecFromStr("0.01"), sdkmath.LegacyMustNewDecFromStr("0.0025"), false}, + {sdk.NewCoin("usdx", sdkmath.NewInt(100e6)), sdk.NewCoin("ukava", sdkmath.NewInt(10e6)), sdkmath.LegacyMustNewDecFromStr("0.01"), sdkmath.LegacyMustNewDecFromStr("0.0025"), false}, + {sdk.NewCoin("usdx", sdkmath.NewInt(100e6)), sdk.NewCoin("ukava", sdkmath.NewInt(10e6)), sdkmath.LegacyMustNewDecFromStr("0.01"), sdkmath.LegacyMustNewDecFromStr("0.0025"), false}, // positive slippage with zero slippage OK - {sdk.NewCoin("ukava", sdkmath.NewInt(5e6)), sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.ZeroDec(), sdk.MustNewDecFromStr("0.0025"), false}, - {sdk.NewCoin("ukava", sdkmath.NewInt(5e6)), sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.ZeroDec(), sdk.MustNewDecFromStr("0.0025"), false}, - {sdk.NewCoin("usdx", sdkmath.NewInt(100e6)), sdk.NewCoin("ukava", sdkmath.NewInt(10e6)), sdk.ZeroDec(), sdk.MustNewDecFromStr("0.0025"), false}, - {sdk.NewCoin("usdx", sdkmath.NewInt(100e6)), sdk.NewCoin("ukava", sdkmath.NewInt(10e6)), sdk.ZeroDec(), sdk.MustNewDecFromStr("0.0025"), false}, + {sdk.NewCoin("ukava", sdkmath.NewInt(5e6)), sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdkmath.LegacyZeroDec(), sdkmath.LegacyMustNewDecFromStr("0.0025"), false}, + {sdk.NewCoin("ukava", sdkmath.NewInt(5e6)), sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdkmath.LegacyZeroDec(), sdkmath.LegacyMustNewDecFromStr("0.0025"), false}, + {sdk.NewCoin("usdx", sdkmath.NewInt(100e6)), sdk.NewCoin("ukava", sdkmath.NewInt(10e6)), sdkmath.LegacyZeroDec(), sdkmath.LegacyMustNewDecFromStr("0.0025"), false}, + {sdk.NewCoin("usdx", sdkmath.NewInt(100e6)), sdk.NewCoin("ukava", sdkmath.NewInt(10e6)), sdkmath.LegacyZeroDec(), sdkmath.LegacyMustNewDecFromStr("0.0025"), false}, // exact zero slippage OK - {sdk.NewCoin("ukava", sdkmath.NewInt(1010102)), sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.ZeroDec(), sdk.MustNewDecFromStr("0"), false}, - {sdk.NewCoin("ukava", sdkmath.NewInt(1010102)), sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.ZeroDec(), sdk.MustNewDecFromStr("0.003"), false}, - {sdk.NewCoin("ukava", sdkmath.NewInt(1010102)), sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.ZeroDec(), sdk.MustNewDecFromStr("0.05"), false}, - {sdk.NewCoin("usdx", sdkmath.NewInt(5050506)), sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.ZeroDec(), sdk.MustNewDecFromStr("0"), false}, - {sdk.NewCoin("usdx", sdkmath.NewInt(5050506)), sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.ZeroDec(), sdk.MustNewDecFromStr("0.003"), false}, - {sdk.NewCoin("usdx", sdkmath.NewInt(5050506)), sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.ZeroDec(), sdk.MustNewDecFromStr("0.05"), false}, + {sdk.NewCoin("ukava", sdkmath.NewInt(1010102)), sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdkmath.LegacyZeroDec(), sdkmath.LegacyMustNewDecFromStr("0"), false}, + {sdk.NewCoin("ukava", sdkmath.NewInt(1010102)), sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdkmath.LegacyZeroDec(), sdkmath.LegacyMustNewDecFromStr("0.003"), false}, + {sdk.NewCoin("ukava", sdkmath.NewInt(1010102)), sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdkmath.LegacyZeroDec(), sdkmath.LegacyMustNewDecFromStr("0.05"), false}, + {sdk.NewCoin("usdx", sdkmath.NewInt(5050506)), sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdkmath.LegacyZeroDec(), sdkmath.LegacyMustNewDecFromStr("0"), false}, + {sdk.NewCoin("usdx", sdkmath.NewInt(5050506)), sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdkmath.LegacyZeroDec(), sdkmath.LegacyMustNewDecFromStr("0.003"), false}, + {sdk.NewCoin("usdx", sdkmath.NewInt(5050506)), sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdkmath.LegacyZeroDec(), sdkmath.LegacyMustNewDecFromStr("0.05"), false}, // slippage failure, zero slippage tolerance - {sdk.NewCoin("ukava", sdkmath.NewInt(1010101)), sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.ZeroDec(), sdk.MustNewDecFromStr("0"), true}, - {sdk.NewCoin("ukava", sdkmath.NewInt(1010101)), sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.ZeroDec(), sdk.MustNewDecFromStr("0.003"), true}, - {sdk.NewCoin("ukava", sdkmath.NewInt(1010101)), sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.ZeroDec(), sdk.MustNewDecFromStr("0.05"), true}, - {sdk.NewCoin("usdx", sdkmath.NewInt(5050505)), sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.ZeroDec(), sdk.MustNewDecFromStr("0"), true}, - {sdk.NewCoin("usdx", sdkmath.NewInt(5050505)), sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.ZeroDec(), sdk.MustNewDecFromStr("0.003"), true}, - {sdk.NewCoin("usdx", sdkmath.NewInt(5050505)), sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.ZeroDec(), sdk.MustNewDecFromStr("0.05"), true}, + {sdk.NewCoin("ukava", sdkmath.NewInt(1010101)), sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdkmath.LegacyZeroDec(), sdkmath.LegacyMustNewDecFromStr("0"), true}, + {sdk.NewCoin("ukava", sdkmath.NewInt(1010101)), sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdkmath.LegacyZeroDec(), sdkmath.LegacyMustNewDecFromStr("0.003"), true}, + {sdk.NewCoin("ukava", sdkmath.NewInt(1010101)), sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdkmath.LegacyZeroDec(), sdkmath.LegacyMustNewDecFromStr("0.05"), true}, + {sdk.NewCoin("usdx", sdkmath.NewInt(5050505)), sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdkmath.LegacyZeroDec(), sdkmath.LegacyMustNewDecFromStr("0"), true}, + {sdk.NewCoin("usdx", sdkmath.NewInt(5050505)), sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdkmath.LegacyZeroDec(), sdkmath.LegacyMustNewDecFromStr("0.003"), true}, + {sdk.NewCoin("usdx", sdkmath.NewInt(5050505)), sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdkmath.LegacyZeroDec(), sdkmath.LegacyMustNewDecFromStr("0.05"), true}, // slippage failure, 1 percent slippage - {sdk.NewCoin("ukava", sdkmath.NewInt(1000000)), sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.MustNewDecFromStr("0.01"), sdk.MustNewDecFromStr("0"), true}, - {sdk.NewCoin("ukava", sdkmath.NewInt(1000000)), sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.MustNewDecFromStr("0.01"), sdk.MustNewDecFromStr("0.003"), true}, - {sdk.NewCoin("ukava", sdkmath.NewInt(1000000)), sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.MustNewDecFromStr("0.01"), sdk.MustNewDecFromStr("0.05"), true}, - {sdk.NewCoin("usdx", sdkmath.NewInt(5000000)), sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.MustNewDecFromStr("0.01"), sdk.MustNewDecFromStr("0"), true}, - {sdk.NewCoin("usdx", sdkmath.NewInt(5000000)), sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.MustNewDecFromStr("0.01"), sdk.MustNewDecFromStr("0.003"), true}, - {sdk.NewCoin("usdx", sdkmath.NewInt(5000000)), sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.MustNewDecFromStr("0.01"), sdk.MustNewDecFromStr("0.05"), true}, + {sdk.NewCoin("ukava", sdkmath.NewInt(1000000)), sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdkmath.LegacyMustNewDecFromStr("0.01"), sdkmath.LegacyMustNewDecFromStr("0"), true}, + {sdk.NewCoin("ukava", sdkmath.NewInt(1000000)), sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdkmath.LegacyMustNewDecFromStr("0.01"), sdkmath.LegacyMustNewDecFromStr("0.003"), true}, + {sdk.NewCoin("ukava", sdkmath.NewInt(1000000)), sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdkmath.LegacyMustNewDecFromStr("0.01"), sdkmath.LegacyMustNewDecFromStr("0.05"), true}, + {sdk.NewCoin("usdx", sdkmath.NewInt(5000000)), sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdkmath.LegacyMustNewDecFromStr("0.01"), sdkmath.LegacyMustNewDecFromStr("0"), true}, + {sdk.NewCoin("usdx", sdkmath.NewInt(5000000)), sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdkmath.LegacyMustNewDecFromStr("0.01"), sdkmath.LegacyMustNewDecFromStr("0.003"), true}, + {sdk.NewCoin("usdx", sdkmath.NewInt(5000000)), sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdkmath.LegacyMustNewDecFromStr("0.01"), sdkmath.LegacyMustNewDecFromStr("0.05"), true}, // slippage OK, 1 percent slippage - {sdk.NewCoin("ukava", sdkmath.NewInt(1000001)), sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.MustNewDecFromStr("0.01"), sdk.MustNewDecFromStr("0"), false}, - {sdk.NewCoin("ukava", sdkmath.NewInt(1000001)), sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.MustNewDecFromStr("0.01"), sdk.MustNewDecFromStr("0.003"), false}, - {sdk.NewCoin("ukava", sdkmath.NewInt(1000001)), sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.MustNewDecFromStr("0.01"), sdk.MustNewDecFromStr("0.05"), false}, - {sdk.NewCoin("usdx", sdkmath.NewInt(5000001)), sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.MustNewDecFromStr("0.01"), sdk.MustNewDecFromStr("0"), false}, - {sdk.NewCoin("usdx", sdkmath.NewInt(5000001)), sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.MustNewDecFromStr("0.01"), sdk.MustNewDecFromStr("0.003"), false}, - {sdk.NewCoin("usdx", sdkmath.NewInt(5000001)), sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.MustNewDecFromStr("0.01"), sdk.MustNewDecFromStr("0.05"), false}, + {sdk.NewCoin("ukava", sdkmath.NewInt(1000001)), sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdkmath.LegacyMustNewDecFromStr("0.01"), sdkmath.LegacyMustNewDecFromStr("0"), false}, + {sdk.NewCoin("ukava", sdkmath.NewInt(1000001)), sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdkmath.LegacyMustNewDecFromStr("0.01"), sdkmath.LegacyMustNewDecFromStr("0.003"), false}, + {sdk.NewCoin("ukava", sdkmath.NewInt(1000001)), sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdkmath.LegacyMustNewDecFromStr("0.01"), sdkmath.LegacyMustNewDecFromStr("0.05"), false}, + {sdk.NewCoin("usdx", sdkmath.NewInt(5000001)), sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdkmath.LegacyMustNewDecFromStr("0.01"), sdkmath.LegacyMustNewDecFromStr("0"), false}, + {sdk.NewCoin("usdx", sdkmath.NewInt(5000001)), sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdkmath.LegacyMustNewDecFromStr("0.01"), sdkmath.LegacyMustNewDecFromStr("0.003"), false}, + {sdk.NewCoin("usdx", sdkmath.NewInt(5000001)), sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdkmath.LegacyMustNewDecFromStr("0.01"), sdkmath.LegacyMustNewDecFromStr("0.05"), false}, } for _, tc := range testCases { @@ -457,7 +457,7 @@ func (suite *keeperTestSuite) TestSwapForExactTokens_Slippage() { ) requester := suite.NewAccountFromAddr(sdk.AccAddress("requester-----------"), balance) - ctx := suite.App.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + ctx := suite.App.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) err := suite.Keeper.SwapForExactTokens(ctx, requester.GetAddress(), tc.coinA, tc.coinB, tc.slippage) if tc.shouldFail { @@ -477,8 +477,8 @@ func (suite *keeperTestSuite) TestSwapForExactTokens_InsufficientFunds() { coinA sdk.Coin coinB sdk.Coin }{ - {"no ukava balance", sdk.NewCoin("ukava", sdk.ZeroInt()), sdk.NewCoin("ukava", sdkmath.NewInt(100)), sdk.NewCoin("usdx", sdkmath.NewInt(500))}, - {"no usdx balance", sdk.NewCoin("usdx", sdk.ZeroInt()), sdk.NewCoin("usdx", sdkmath.NewInt(500)), sdk.NewCoin("ukava", sdkmath.NewInt(100))}, + {"no ukava balance", sdk.NewCoin("ukava", sdkmath.ZeroInt()), sdk.NewCoin("ukava", sdkmath.NewInt(100)), sdk.NewCoin("usdx", sdkmath.NewInt(500))}, + {"no usdx balance", sdk.NewCoin("usdx", sdkmath.ZeroInt()), sdk.NewCoin("usdx", sdkmath.NewInt(500)), sdk.NewCoin("ukava", sdkmath.NewInt(100))}, {"low ukava balance", sdk.NewCoin("ukava", sdkmath.NewInt(1000000)), sdk.NewCoin("ukava", sdkmath.NewInt(1000000)), sdk.NewCoin("usdx", sdkmath.NewInt(5000000))}, {"low ukava balance", sdk.NewCoin("usdx", sdkmath.NewInt(5000000)), sdk.NewCoin("usdx", sdkmath.NewInt(5000000)), sdk.NewCoin("ukava", sdkmath.NewInt(1000000))}, {"large ukava balance difference", sdk.NewCoin("ukava", sdkmath.NewInt(100e6)), sdk.NewCoin("ukava", sdkmath.NewInt(1000e6)), sdk.NewCoin("usdx", sdkmath.NewInt(5000e6))}, @@ -498,8 +498,8 @@ func (suite *keeperTestSuite) TestSwapForExactTokens_InsufficientFunds() { balance := sdk.NewCoins(tc.balanceA) requester := suite.NewAccountFromAddr(sdk.AccAddress("requester-----------"), balance) - ctx := suite.App.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) - err := suite.Keeper.SwapForExactTokens(ctx, requester.GetAddress(), tc.coinA, tc.coinB, sdk.MustNewDecFromStr("0.1")) + ctx := suite.App.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + err := suite.Keeper.SwapForExactTokens(ctx, requester.GetAddress(), tc.coinA, tc.coinB, sdkmath.LegacyMustNewDecFromStr("0.1")) suite.Require().True(errors.Is(err, sdkerrors.ErrInsufficientFunds), fmt.Sprintf("got err %s", err)) }) } @@ -513,8 +513,8 @@ func (suite *keeperTestSuite) TestSwapForExactTokens_InsufficientFunds_Vesting() coinA sdk.Coin coinB sdk.Coin }{ - {"no ukava balance, vesting only", sdk.NewCoin("ukava", sdk.ZeroInt()), sdk.NewCoin("ukava", sdkmath.NewInt(100)), sdk.NewCoin("ukava", sdkmath.NewInt(1000)), sdk.NewCoin("usdx", sdkmath.NewInt(500))}, - {"no usdx balance, vesting only", sdk.NewCoin("usdx", sdk.ZeroInt()), sdk.NewCoin("usdx", sdkmath.NewInt(500)), sdk.NewCoin("usdx", sdkmath.NewInt(5000)), sdk.NewCoin("ukava", sdkmath.NewInt(100))}, + {"no ukava balance, vesting only", sdk.NewCoin("ukava", sdkmath.ZeroInt()), sdk.NewCoin("ukava", sdkmath.NewInt(100)), sdk.NewCoin("ukava", sdkmath.NewInt(1000)), sdk.NewCoin("usdx", sdkmath.NewInt(500))}, + {"no usdx balance, vesting only", sdk.NewCoin("usdx", sdkmath.ZeroInt()), sdk.NewCoin("usdx", sdkmath.NewInt(500)), sdk.NewCoin("usdx", sdkmath.NewInt(5000)), sdk.NewCoin("ukava", sdkmath.NewInt(100))}, {"low ukava balance, vesting matches exact", sdk.NewCoin("ukava", sdkmath.NewInt(1000000)), sdk.NewCoin("ukava", sdkmath.NewInt(100000)), sdk.NewCoin("ukava", sdkmath.NewInt(1000000)), sdk.NewCoin("usdx", sdkmath.NewInt(5000000))}, {"low ukava balance, vesting matches exact", sdk.NewCoin("usdx", sdkmath.NewInt(5000000)), sdk.NewCoin("usdx", sdkmath.NewInt(500000)), sdk.NewCoin("usdx", sdkmath.NewInt(5000000)), sdk.NewCoin("ukava", sdkmath.NewInt(1000000))}, {"large ukava balance difference, vesting covers difference", sdk.NewCoin("ukava", sdkmath.NewInt(100e6)), sdk.NewCoin("ukava", sdkmath.NewInt(10000e6)), sdk.NewCoin("ukava", sdkmath.NewInt(1000e6)), sdk.NewCoin("usdx", sdkmath.NewInt(5000e6))}, @@ -535,8 +535,8 @@ func (suite *keeperTestSuite) TestSwapForExactTokens_InsufficientFunds_Vesting() vesting := sdk.NewCoins(tc.vestingA) requester := suite.CreateVestingAccount(balance, vesting) - ctx := suite.App.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) - err := suite.Keeper.SwapForExactTokens(ctx, requester.GetAddress(), tc.coinA, tc.coinB, sdk.MustNewDecFromStr("0.1")) + ctx := suite.App.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + err := suite.Keeper.SwapForExactTokens(ctx, requester.GetAddress(), tc.coinA, tc.coinB, sdkmath.LegacyMustNewDecFromStr("0.1")) suite.Require().True(errors.Is(err, sdkerrors.ErrInsufficientFunds), fmt.Sprintf("got err %s", err)) }) } @@ -560,10 +560,10 @@ func (suite *keeperTestSuite) TestSwapForExactTokens_PoolNotFound() { coinA := sdk.NewCoin("ukava", sdkmath.NewInt(1e6)) coinB := sdk.NewCoin("usdx", sdkmath.NewInt(5e6)) - err := suite.Keeper.SwapForExactTokens(suite.Ctx, requester.GetAddress(), coinA, coinB, sdk.MustNewDecFromStr("0.01")) + err := suite.Keeper.SwapForExactTokens(suite.Ctx, requester.GetAddress(), coinA, coinB, sdkmath.LegacyMustNewDecFromStr("0.01")) suite.EqualError(err, "pool ukava:usdx not found: invalid pool") - err = suite.Keeper.SwapForExactTokens(suite.Ctx, requester.GetAddress(), coinB, coinA, sdk.MustNewDecFromStr("0.01")) + err = suite.Keeper.SwapForExactTokens(suite.Ctx, requester.GetAddress(), coinB, coinA, sdkmath.LegacyMustNewDecFromStr("0.01")) suite.EqualError(err, "pool ukava:usdx not found: invalid pool") } @@ -579,7 +579,7 @@ func (suite *keeperTestSuite) TestSwapForExactTokens_PanicOnInvalidPool() { poolRecord, found := suite.Keeper.GetPool(suite.Ctx, poolID) suite.Require().True(found, "expected pool record to exist") - poolRecord.TotalShares = sdk.ZeroInt() + poolRecord.TotalShares = sdkmath.ZeroInt() suite.Keeper.SetPool_Raw(suite.Ctx, poolRecord) balance := sdk.NewCoins( @@ -591,11 +591,11 @@ func (suite *keeperTestSuite) TestSwapForExactTokens_PanicOnInvalidPool() { coinB := sdk.NewCoin("usdx", sdkmath.NewInt(5e6)) suite.PanicsWithValue("invalid pool ukava:usdx: total shares must be greater than zero: invalid pool", func() { - _ = suite.Keeper.SwapForExactTokens(suite.Ctx, requester.GetAddress(), coinA, coinB, sdk.MustNewDecFromStr("0.01")) + _ = suite.Keeper.SwapForExactTokens(suite.Ctx, requester.GetAddress(), coinA, coinB, sdkmath.LegacyMustNewDecFromStr("0.01")) }, "expected invalid pool record to panic") suite.PanicsWithValue("invalid pool ukava:usdx: total shares must be greater than zero: invalid pool", func() { - _ = suite.Keeper.SwapForExactTokens(suite.Ctx, requester.GetAddress(), coinB, coinA, sdk.MustNewDecFromStr("0.01")) + _ = suite.Keeper.SwapForExactTokens(suite.Ctx, requester.GetAddress(), coinB, coinA, sdkmath.LegacyMustNewDecFromStr("0.01")) }, "expected invalid pool record to panic") } @@ -622,10 +622,10 @@ func (suite *keeperTestSuite) TestSwapForExactTokens_PanicOnInsufficientModuleAc coinB := sdk.NewCoin("usdx", sdkmath.NewInt(5e6)) suite.Panics(func() { - _ = suite.Keeper.SwapForExactTokens(suite.Ctx, requester.GetAddress(), coinA, coinB, sdk.MustNewDecFromStr("0.01")) + _ = suite.Keeper.SwapForExactTokens(suite.Ctx, requester.GetAddress(), coinA, coinB, sdkmath.LegacyMustNewDecFromStr("0.01")) }, "expected panic when module account does not have enough funds") suite.Panics(func() { - _ = suite.Keeper.SwapForExactTokens(suite.Ctx, requester.GetAddress(), coinA, coinB, sdk.MustNewDecFromStr("0.01")) + _ = suite.Keeper.SwapForExactTokens(suite.Ctx, requester.GetAddress(), coinA, coinB, sdkmath.LegacyMustNewDecFromStr("0.01")) }, "expected panic when module account does not have enough funds") } diff --git a/x/swap/keeper/withdraw_test.go b/x/swap/keeper/withdraw_test.go index f89e765865..d35ecdf067 100644 --- a/x/swap/keeper/withdraw_test.go +++ b/x/swap/keeper/withdraw_test.go @@ -92,7 +92,7 @@ func (suite *keeperTestSuite) TestWithdraw_GreaterThanSharesOwned() { totalShares := sdkmath.NewInt(30e6) suite.setupPool(reserves, totalShares, owner.GetAddress()) - sharesToWithdraw := totalShares.Add(sdk.OneInt()) + sharesToWithdraw := totalShares.Add(sdkmath.OneInt()) err := suite.Keeper.Withdraw(suite.Ctx, owner.GetAddress(), sharesToWithdraw, reserves[0], reserves[1]) suite.EqualError(err, fmt.Sprintf("withdraw of %s shares greater than %s shares owned: invalid shares", sharesToWithdraw, totalShares)) } @@ -196,7 +196,7 @@ func (suite *keeperTestSuite) TestWithdraw_PanicOnInvalidPool() { poolRecord, found := suite.Keeper.GetPool(suite.Ctx, poolID) suite.Require().True(found, "expected pool record to exist") - poolRecord.TotalShares = sdk.ZeroInt() + poolRecord.TotalShares = sdkmath.ZeroInt() suite.Keeper.SetPool_Raw(suite.Ctx, poolRecord) suite.PanicsWithValue("invalid pool ukava:usdx: total shares must be greater than zero: invalid pool", func() { diff --git a/x/swap/legacy/v0_15/types.go b/x/swap/legacy/v0_15/types.go index 95d4d8e6ec..80661361a3 100644 --- a/x/swap/legacy/v0_15/types.go +++ b/x/swap/legacy/v0_15/types.go @@ -19,8 +19,8 @@ type GenesisState struct { // Params are governance parameters for the swap module type Params struct { - AllowedPools AllowedPools `json:"allowed_pools" yaml:"allowed_pools"` - SwapFee sdk.Dec `json:"swap_fee" yaml:"swap_fee"` + AllowedPools AllowedPools `json:"allowed_pools" yaml:"allowed_pools"` + SwapFee sdkmath.LegacyDec `json:"swap_fee" yaml:"swap_fee"` } // PoolRecords is a slice of PoolRecord diff --git a/x/swap/legacy/v0_16/migrate_test.go b/x/swap/legacy/v0_16/migrate_test.go index 6b757e2671..5bc9ff032d 100644 --- a/x/swap/legacy/v0_16/migrate_test.go +++ b/x/swap/legacy/v0_16/migrate_test.go @@ -62,14 +62,14 @@ func (s *migrateTestSuite) TestMigrate_JSON() { func (s *migrateTestSuite) TestMigrate_Params() { params := v015swap.Params{ - SwapFee: sdk.MustNewDecFromStr("0.33"), + SwapFee: sdkmath.LegacyMustNewDecFromStr("0.33"), AllowedPools: v015swap.AllowedPools{ {TokenA: "A", TokenB: "B"}, {TokenA: "C", TokenB: "D"}, }, } expectedParams := v016swap.Params{ - SwapFee: sdk.MustNewDecFromStr("0.33"), + SwapFee: sdkmath.LegacyMustNewDecFromStr("0.33"), AllowedPools: v016swap.AllowedPools{ {TokenA: "A", TokenB: "B"}, {TokenA: "C", TokenB: "D"}, diff --git a/x/swap/module.go b/x/swap/module.go index 8a9ac1fef3..2a3444a364 100644 --- a/x/swap/module.go +++ b/x/swap/module.go @@ -132,10 +132,15 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw } // BeginBlock module begin-block -func (am AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) { +func (am AppModule) BeginBlock(_ sdk.Context) error { + return nil } // EndBlock module end-block -func (am AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { - return []abci.ValidatorUpdate{} +func (am AppModule) EndBlock(_ sdk.Context) ([]abci.ValidatorUpdate, error) { + return []abci.ValidatorUpdate{}, nil } + +func (AppModule) IsOnePerModuleType() {} + +func (AppModule) IsAppModule() {} diff --git a/x/swap/spec/02_state.md b/x/swap/spec/02_state.md index 15b6816580..6bd0e3f969 100644 --- a/x/swap/spec/02_state.md +++ b/x/swap/spec/02_state.md @@ -12,7 +12,7 @@ order: 2 // Params are governance parameters for the swap module type Params struct { AllowedPools AllowedPools `json:"allowed_pools" yaml:"allowed_pools"` - SwapFee sdk.Dec `json:"swap_fee" yaml:"swap_fee"` + SwapFee sdkmath.LegacyDec `json:"swap_fee" yaml:"swap_fee"` } // AllowedPool defines a tradable pool diff --git a/x/swap/spec/03_messages.md b/x/swap/spec/03_messages.md index 1b331f9527..40d6f3c70c 100644 --- a/x/swap/spec/03_messages.md +++ b/x/swap/spec/03_messages.md @@ -13,7 +13,7 @@ type MsgDeposit struct { Depositor sdk.AccAddress `json:"depositor" yaml:"depositor"` TokenA sdk.Coin `json:"token_a" yaml:"token_a"` TokenB sdk.Coin `json:"token_b" yaml:"token_b"` - Slippage sdk.Dec `json:"slippage" yaml:"slippage"` + Slippage sdkmath.LegacyDec `json:"slippage" yaml:"slippage"` Deadline int64 `json:"deadline" yaml:"deadline"` } ``` @@ -42,7 +42,7 @@ type MsgSwapExactForTokens struct { Requester sdk.AccAddress `json:"requester" yaml:"requester"` ExactTokenA sdk.Coin `json:"exact_token_a" yaml:"exact_token_a"` TokenB sdk.Coin `json:"token_b" yaml:"token_b"` - Slippage sdk.Dec `json:"slippage" yaml:"slippage"` + Slippage sdkmath.LegacyDec `json:"slippage" yaml:"slippage"` Deadline int64 `json:"deadline" yaml:"deadline"` } ``` @@ -57,7 +57,7 @@ type MsgSwapForExactTokens struct { Requester sdk.AccAddress `json:"requester" yaml:"requester"` TokenA sdk.Coin `json:"token_a" yaml:"token_a"` ExactTokenB sdk.Coin `json:"exact_token_b" yaml:"exact_token_b"` - Slippage sdk.Dec `json:"slippage" yaml:"slippage"` + Slippage sdkmath.LegacyDec `json:"slippage" yaml:"slippage"` Deadline int64 `json:"deadline" yaml:"deadline"` } ``` diff --git a/x/swap/spec/05_params.md b/x/swap/spec/05_params.md index 321187da23..7ca915665e 100644 --- a/x/swap/spec/05_params.md +++ b/x/swap/spec/05_params.md @@ -9,7 +9,7 @@ Example parameters for the swap module: | Key | Type | Example | Description | | ------------ | ------------------- | ------------- | --------------------------------------- | | AllowedPools | array (AllowedPool) | [{see below}] | Array of tradable pools supported | -| SwapFee | sdk.Dec | 0.03 | Global trading fee in percentage format | +| SwapFee | sdkmath.LegacyDec | 0.03 | Global trading fee in percentage format | Example parameters for `AllowedPool`: diff --git a/x/swap/testutil/suite.go b/x/swap/testutil/suite.go index 35e5429b01..591a289cbd 100644 --- a/x/swap/testutil/suite.go +++ b/x/swap/testutil/suite.go @@ -11,7 +11,6 @@ import ( sdkmath "cosmossdk.io/math" abci "github.com/cometbft/cometbft/abci/types" - tmproto "github.com/cometbft/cometbft/proto/tendermint/types" tmtime "github.com/cometbft/cometbft/types/time" sdk "github.com/cosmos/cosmos-sdk/types" authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" @@ -22,7 +21,7 @@ import ( "github.com/stretchr/testify/suite" ) -var defaultSwapFee = sdk.MustNewDecFromStr("0.003") +var defaultSwapFee = sdkmath.LegacyMustNewDecFromStr("0.003") // Suite implements a test suite for the swap module integration tests type Suite struct { @@ -37,7 +36,7 @@ type Suite struct { // SetupTest instantiates a new app, keepers, and sets suite state func (suite *Suite) SetupTest() { tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + ctx := tApp.NewContextLegacy(true).WithBlockTime(tmtime.Now()).WithBlockHeight(1) suite.Ctx = ctx suite.App = tApp @@ -68,7 +67,7 @@ func (suite *Suite) RemoveCoinsFromModule(amount sdk.Coins) { } // CreateAccount creates a new account from the provided balance -func (suite *Suite) CreateAccount(initialBalance sdk.Coins) authtypes.AccountI { +func (suite *Suite) CreateAccount(initialBalance sdk.Coins) sdk.AccountI { _, addrs := app.GeneratePrivKeyAddressPairs(1) ak := suite.App.GetAccountKeeper() @@ -82,7 +81,7 @@ func (suite *Suite) CreateAccount(initialBalance sdk.Coins) authtypes.AccountI { } // NewAccountFromAddr creates a new account from the provided address with the provided balance -func (suite *Suite) NewAccountFromAddr(addr sdk.AccAddress, balance sdk.Coins) authtypes.AccountI { +func (suite *Suite) NewAccountFromAddr(addr sdk.AccAddress, balance sdk.Coins) sdk.AccountI { ak := suite.App.GetAccountKeeper() acc := ak.NewAccountWithAddress(suite.Ctx, addr) @@ -95,7 +94,7 @@ func (suite *Suite) NewAccountFromAddr(addr sdk.AccAddress, balance sdk.Coins) a } // CreateVestingAccount creates a new vesting account from the provided balance and vesting balance -func (suite *Suite) CreateVestingAccount(initialBalance sdk.Coins, vestingBalance sdk.Coins) authtypes.AccountI { +func (suite *Suite) CreateVestingAccount(initialBalance sdk.Coins, vestingBalance sdk.Coins) sdk.AccountI { acc := suite.CreateAccount(initialBalance) bacc := acc.(*authtypes.BaseAccount) @@ -105,7 +104,8 @@ func (suite *Suite) CreateVestingAccount(initialBalance sdk.Coins, vestingBalanc Amount: vestingBalance, }, } - vacc := vestingtypes.NewPeriodicVestingAccount(bacc, initialBalance, time.Now().Unix(), periods) // TODO is initialBalance correct for originalVesting? + vacc, err := vestingtypes.NewPeriodicVestingAccount(bacc, initialBalance, time.Now().Unix(), periods) // TODO is initialBalance correct for originalVesting? + suite.Require().NoError(err) return vacc } @@ -117,7 +117,7 @@ func (suite *Suite) CreatePool(reserves sdk.Coins) error { suite.Require().NoError(pool.Validate()) suite.Keeper.SetParams(suite.Ctx, types.NewParams(types.AllowedPools{pool}, defaultSwapFee)) - return suite.Keeper.Deposit(suite.Ctx, depositor.GetAddress(), reserves[0], reserves[1], sdk.MustNewDecFromStr("1")) + return suite.Keeper.Deposit(suite.Ctx, depositor.GetAddress(), reserves[0], reserves[1], sdkmath.LegacyMustNewDecFromStr("1")) } // AccountBalanceEqual asserts that the coins match the account balance @@ -171,7 +171,7 @@ func (suite *Suite) PoolReservesEqual(poolID string, reserves sdk.Coins) { } // PoolShareValueEqual asserts that the depositor shares are in state and the value matches the expected coins -func (suite *Suite) PoolShareValueEqual(depositor authtypes.AccountI, pool types.AllowedPool, coins sdk.Coins) { +func (suite *Suite) PoolShareValueEqual(depositor sdk.AccountI, pool types.AllowedPool, coins sdk.Coins) { poolRecord, ok := suite.Keeper.GetPool(suite.Ctx, pool.Name()) suite.Require().True(ok, fmt.Sprintf("expected pool %s to exist", pool.Name())) shares, ok := suite.Keeper.GetDepositorShares(suite.Ctx, depositor.GetAddress(), poolRecord.PoolID) diff --git a/x/swap/types/base_pool.go b/x/swap/types/base_pool.go index fcc2e6b600..ccae81f26b 100644 --- a/x/swap/types/base_pool.go +++ b/x/swap/types/base_pool.go @@ -6,10 +6,9 @@ import ( errorsmod "cosmossdk.io/errors" sdkmath "cosmossdk.io/math" - sdk "github.com/cosmos/cosmos-sdk/types" ) -var zero = sdk.ZeroInt() +var zero = sdkmath.ZeroInt() // calculateInitialShares calculates initial shares as sqrt(A*B), the geometric mean of A and B func calculateInitialShares(reservesA, reservesB sdkmath.Int) sdkmath.Int { @@ -219,11 +218,11 @@ func (p *BasePool) RemoveLiquidity(shares sdkmath.Int) (sdkmath.Int, sdkmath.Int // SwapExactAForB trades an exact value of a for b. Returns the positive amount b // that is removed from the pool and the portion of a that is used for paying the fee. -func (p *BasePool) SwapExactAForB(a sdkmath.Int, fee sdk.Dec) (sdkmath.Int, sdkmath.Int) { +func (p *BasePool) SwapExactAForB(a sdkmath.Int, fee sdkmath.LegacyDec) (sdkmath.Int, sdkmath.Int) { b, feeValue := p.calculateOutputForExactInput(a, p.reservesA, p.reservesB, fee) p.assertInvariantAndUpdateReserves( - p.reservesA.Add(a), feeValue, p.reservesB.Sub(b), sdk.ZeroInt(), + p.reservesA.Add(a), feeValue, p.reservesB.Sub(b), sdkmath.ZeroInt(), ) return b, feeValue @@ -231,11 +230,11 @@ func (p *BasePool) SwapExactAForB(a sdkmath.Int, fee sdk.Dec) (sdkmath.Int, sdkm // SwapExactBForA trades an exact value of b for a. Returns the positive amount a // that is removed from the pool and the portion of b that is used for paying the fee. -func (p *BasePool) SwapExactBForA(b sdkmath.Int, fee sdk.Dec) (sdkmath.Int, sdkmath.Int) { +func (p *BasePool) SwapExactBForA(b sdkmath.Int, fee sdkmath.LegacyDec) (sdkmath.Int, sdkmath.Int) { a, feeValue := p.calculateOutputForExactInput(b, p.reservesB, p.reservesA, fee) p.assertInvariantAndUpdateReserves( - p.reservesA.Sub(a), sdk.ZeroInt(), p.reservesB.Add(b), feeValue, + p.reservesA.Sub(a), sdkmath.ZeroInt(), p.reservesB.Add(b), feeValue, ) return a, feeValue @@ -248,11 +247,11 @@ func (p *BasePool) SwapExactBForA(b sdkmath.Int, fee sdk.Dec) (sdkmath.Int, sdkm // by splitting a trade into multiple trades. // // The swap output is truncated to ensure the pool invariant is always greater than or equal to the previous invariant. -func (p *BasePool) calculateOutputForExactInput(in, inReserves, outReserves sdkmath.Int, fee sdk.Dec) (sdkmath.Int, sdkmath.Int) { +func (p *BasePool) calculateOutputForExactInput(in, inReserves, outReserves sdkmath.Int, fee sdkmath.LegacyDec) (sdkmath.Int, sdkmath.Int) { p.assertSwapInputIsValid(in) p.assertFeeIsValid(fee) - inAfterFee := sdk.NewDecFromInt(in).Mul(sdk.OneDec().Sub(fee)).TruncateInt() + inAfterFee := sdkmath.LegacyNewDecFromInt(in).Mul(sdkmath.LegacyOneDec().Sub(fee)).TruncateInt() var result big.Int result.Mul(outReserves.BigInt(), inAfterFee.BigInt()) @@ -266,11 +265,11 @@ func (p *BasePool) calculateOutputForExactInput(in, inReserves, outReserves sdkm // SwapAForExactB trades a for an exact b. Returns the positive amount a // that is added to the pool, and the portion of a that is used to pay the fee. -func (p *BasePool) SwapAForExactB(b sdkmath.Int, fee sdk.Dec) (sdkmath.Int, sdkmath.Int) { +func (p *BasePool) SwapAForExactB(b sdkmath.Int, fee sdkmath.LegacyDec) (sdkmath.Int, sdkmath.Int) { a, feeValue := p.calculateInputForExactOutput(b, p.reservesB, p.reservesA, fee) p.assertInvariantAndUpdateReserves( - p.reservesA.Add(a), feeValue, p.reservesB.Sub(b), sdk.ZeroInt(), + p.reservesA.Add(a), feeValue, p.reservesB.Sub(b), sdkmath.ZeroInt(), ) return a, feeValue @@ -278,11 +277,11 @@ func (p *BasePool) SwapAForExactB(b sdkmath.Int, fee sdk.Dec) (sdkmath.Int, sdkm // SwapBForExactA trades b for an exact a. Returns the positive amount b // that is added to the pool, and the portion of b that is used to pay the fee. -func (p *BasePool) SwapBForExactA(a sdkmath.Int, fee sdk.Dec) (sdkmath.Int, sdkmath.Int) { +func (p *BasePool) SwapBForExactA(a sdkmath.Int, fee sdkmath.LegacyDec) (sdkmath.Int, sdkmath.Int) { b, feeValue := p.calculateInputForExactOutput(a, p.reservesA, p.reservesB, fee) p.assertInvariantAndUpdateReserves( - p.reservesA.Sub(a), sdk.ZeroInt(), p.reservesB.Add(b), feeValue, + p.reservesA.Sub(a), sdkmath.ZeroInt(), p.reservesB.Add(b), feeValue, ) return b, feeValue @@ -295,7 +294,7 @@ func (p *BasePool) SwapBForExactA(a sdkmath.Int, fee sdk.Dec) (sdkmath.Int, sdkm // by splitting a trade into multiple trades. // // The swap input is ceiled to ensure the pool invariant is always greater than or equal to the previous invariant. -func (p *BasePool) calculateInputForExactOutput(out, outReserves, inReserves sdkmath.Int, fee sdk.Dec) (sdkmath.Int, sdkmath.Int) { +func (p *BasePool) calculateInputForExactOutput(out, outReserves, inReserves sdkmath.Int, fee sdkmath.LegacyDec) (sdkmath.Int, sdkmath.Int) { p.assertSwapOutputIsValid(out, outReserves) p.assertFeeIsValid(fee) @@ -308,10 +307,10 @@ func (p *BasePool) calculateInputForExactOutput(out, outReserves, inReserves sdk inWithoutFee := sdkmath.NewIntFromBigInt(&result) if remainder.Sign() != 0 { - inWithoutFee = inWithoutFee.Add(sdk.OneInt()) + inWithoutFee = inWithoutFee.Add(sdkmath.OneInt()) } - in := sdk.NewDecFromInt(inWithoutFee).Quo(sdk.OneDec().Sub(fee)).Ceil().TruncateInt() + in := sdkmath.LegacyNewDecFromInt(inWithoutFee).Quo(sdkmath.LegacyOneDec().Sub(fee)).Ceil().TruncateInt() feeValue := in.Sub(inWithoutFee) return in, feeValue @@ -371,8 +370,8 @@ func (p *BasePool) assertSwapOutputIsValid(output sdkmath.Int, reserves sdkmath. } // assertFeeIsValid checks if the provided fee is less -func (p *BasePool) assertFeeIsValid(fee sdk.Dec) { - if fee.IsNegative() || fee.GTE(sdk.OneDec()) { +func (p *BasePool) assertFeeIsValid(fee sdkmath.LegacyDec) { + if fee.IsNegative() || fee.GTE(sdkmath.LegacyOneDec()) { panic("invalid value: fee must be between 0 and 1") } } diff --git a/x/swap/types/base_pool_test.go b/x/swap/types/base_pool_test.go index a6fa2ee2bc..eb2739d4dd 100644 --- a/x/swap/types/base_pool_test.go +++ b/x/swap/types/base_pool_test.go @@ -8,7 +8,6 @@ import ( types "github.com/kava-labs/kava/x/swap/types" sdkmath "cosmossdk.io/math" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -27,9 +26,9 @@ func s(str string) sdkmath.Int { return num } -// d creates a new sdk.Dec from a string -func d(str string) sdk.Dec { - return sdk.MustNewDecFromStr(str) +// d creates a new sdkmath.LegacyDec from a string +func d(str string) sdkmath.LegacyDec { + return sdkmath.LegacyMustNewDecFromStr(str) } // exp takes a sdkmath.Int and computes the power @@ -419,7 +418,7 @@ func TestBasePool_Swap_ExactInput(t *testing.T) { reservesA sdkmath.Int reservesB sdkmath.Int exactInput sdkmath.Int - fee sdk.Dec + fee sdkmath.LegacyDec expectedOutput sdkmath.Int expectedFee sdkmath.Int }{ @@ -477,7 +476,7 @@ func TestBasePool_Swap_ExactOutput(t *testing.T) { reservesA sdkmath.Int reservesB sdkmath.Int exactOutput sdkmath.Int - fee sdk.Dec + fee sdkmath.LegacyDec expectedInput sdkmath.Int expectedFee sdkmath.Int }{ @@ -531,7 +530,7 @@ func TestBasePool_Swap_ExactOutput(t *testing.T) { func TestBasePool_Panics_Swap_ExactInput(t *testing.T) { testCases := []struct { swap sdkmath.Int - fee sdk.Dec + fee sdkmath.LegacyDec }{ {i(0), d("0.003")}, {i(-1), d("0.003")}, @@ -561,7 +560,7 @@ func TestBasePool_Panics_Swap_ExactInput(t *testing.T) { func TestBasePool_Panics_Swap_ExactOutput(t *testing.T) { testCases := []struct { swap sdkmath.Int - fee sdk.Dec + fee sdkmath.LegacyDec }{ {i(0), d("0.003")}, {i(-1), d("0.003")}, diff --git a/x/swap/types/codec.go b/x/swap/types/codec.go index 2d1d5c12a5..6f0ee30026 100644 --- a/x/swap/types/codec.go +++ b/x/swap/types/codec.go @@ -6,7 +6,6 @@ import ( cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/msgservice" - authzcodec "github.com/cosmos/cosmos-sdk/x/authz/codec" ) // RegisterLegacyAminoCodec registers all the necessary types and interfaces for the @@ -43,5 +42,5 @@ func init() { // Register all Amino interfaces and concrete types on the authz Amino codec so that this can later be // used to properly serialize MsgGrant and MsgExec instances - RegisterLegacyAminoCodec(authzcodec.Amino) + RegisterLegacyAminoCodec(codec.NewLegacyAmino()) } diff --git a/x/swap/types/denominated_pool.go b/x/swap/types/denominated_pool.go index c816ce1395..0b3a922251 100644 --- a/x/swap/types/denominated_pool.go +++ b/x/swap/types/denominated_pool.go @@ -105,7 +105,7 @@ func (p *DenominatedPool) ShareValue(shares sdkmath.Int) sdk.Coins { // SwapWithExactInput trades an exact input coin for the other. Returns the positive other coin amount // that is removed from the pool and the portion of the input coin that is used for the fee. // It panics if the input denom does not match the pool reserves. -func (p *DenominatedPool) SwapWithExactInput(swapInput sdk.Coin, fee sdk.Dec) (sdk.Coin, sdk.Coin) { +func (p *DenominatedPool) SwapWithExactInput(swapInput sdk.Coin, fee sdkmath.LegacyDec) (sdk.Coin, sdk.Coin) { var ( swapOutput sdkmath.Int feePaid sdkmath.Int @@ -126,7 +126,7 @@ func (p *DenominatedPool) SwapWithExactInput(swapInput sdk.Coin, fee sdk.Dec) (s // SwapWithExactOutput trades a coin for an exact output coin b. Returns the positive input coin // that is added to the pool, and the portion of that input that is used to pay the fee. // Panics if the output denom does not match the pool reserves. -func (p *DenominatedPool) SwapWithExactOutput(swapOutput sdk.Coin, fee sdk.Dec) (sdk.Coin, sdk.Coin) { +func (p *DenominatedPool) SwapWithExactOutput(swapOutput sdk.Coin, fee sdkmath.LegacyDec) (sdk.Coin, sdk.Coin) { var ( swapInput sdkmath.Int feePaid sdkmath.Int diff --git a/x/swap/types/expected_keepers.go b/x/swap/types/expected_keepers.go index 258b9aea25..5b9271cb0d 100644 --- a/x/swap/types/expected_keepers.go +++ b/x/swap/types/expected_keepers.go @@ -1,32 +1,32 @@ package types import ( + "context" sdkmath "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/auth/types" ) // AccountKeeper defines the expected account keeper (noalias) type AccountKeeper interface { - GetAccount(ctx sdk.Context, addr sdk.AccAddress) types.AccountI - SetModuleAccount(sdk.Context, types.ModuleAccountI) + GetAccount(ctx context.Context, addr sdk.AccAddress) sdk.AccountI + SetModuleAccount(context.Context, sdk.ModuleAccountI) // moved in from supply GetModuleAddress(name string) sdk.AccAddress - GetModuleAccount(ctx sdk.Context, name string) types.ModuleAccountI + GetModuleAccount(ctx context.Context, name string) sdk.ModuleAccountI } // BankKeeper defines the expected interface needed to retrieve account balances. type BankKeeper interface { - GetAllBalances(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins + GetAllBalances(ctx context.Context, addr sdk.AccAddress) sdk.Coins - SendCoinsFromModuleToModule(ctx sdk.Context, senderModule, recipientModule string, amt sdk.Coins) error - SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error - SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error + SendCoinsFromModuleToModule(ctx context.Context, senderModule, recipientModule string, amt sdk.Coins) error + SendCoinsFromModuleToAccount(ctx context.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error + SendCoinsFromAccountToModule(ctx context.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error } // SwapHooks are event hooks called when a user's deposit to a swap pool changes. type SwapHooks interface { - AfterPoolDepositCreated(ctx sdk.Context, poolID string, depositor sdk.AccAddress, sharedOwned sdkmath.Int) - BeforePoolDepositModified(ctx sdk.Context, poolID string, depositor sdk.AccAddress, sharedOwned sdkmath.Int) + AfterPoolDepositCreated(ctx context.Context, poolID string, depositor sdk.AccAddress, sharedOwned sdkmath.Int) + BeforePoolDepositModified(ctx context.Context, poolID string, depositor sdk.AccAddress, sharedOwned sdkmath.Int) } diff --git a/x/swap/types/genesis.go b/x/swap/types/genesis.go index 6738e950e5..cd17be7d3e 100644 --- a/x/swap/types/genesis.go +++ b/x/swap/types/genesis.go @@ -4,7 +4,6 @@ import ( "fmt" sdkmath "cosmossdk.io/math" - sdk "github.com/cosmos/cosmos-sdk/types" ) type poolShares struct { @@ -44,7 +43,7 @@ func (gs GenesisState) Validate() error { for _, pr := range gs.PoolRecords { totalShares[pr.PoolID] = poolShares{ totalShares: pr.TotalShares, - totalSharesOwned: sdk.ZeroInt(), + totalSharesOwned: sdkmath.ZeroInt(), } } for _, sr := range gs.ShareRecords { @@ -53,7 +52,7 @@ func (gs GenesisState) Validate() error { totalShares[sr.PoolID] = shares } else { totalShares[sr.PoolID] = poolShares{ - totalShares: sdk.ZeroInt(), + totalShares: sdkmath.ZeroInt(), totalSharesOwned: sr.SharesOwned, } } diff --git a/x/swap/types/genesis_test.go b/x/swap/types/genesis_test.go index 770d228f1c..3a83d901f3 100644 --- a/x/swap/types/genesis_test.go +++ b/x/swap/types/genesis_test.go @@ -24,24 +24,24 @@ func TestGenesis_Default(t *testing.T) { func TestGenesis_Validate_SwapFee(t *testing.T) { type args struct { name string - swapFee sdk.Dec + swapFee sdkmath.LegacyDec expectErr bool } // More comprehensive swap fee tests are in prams_test.go testCases := []args{ { "normal", - sdk.MustNewDecFromStr("0.25"), + sdkmath.LegacyMustNewDecFromStr("0.25"), false, }, { "negative", - sdk.MustNewDecFromStr("-0.5"), + sdkmath.LegacyMustNewDecFromStr("-0.5"), true, }, { "greater than 1.0", - sdk.MustNewDecFromStr("1.001"), + sdkmath.LegacyMustNewDecFromStr("1.001"), true, }, } @@ -157,7 +157,7 @@ func TestGenesis_JSONEncoding(t *testing.T) { require.NoError(t, err) assert.Equal(t, 2, len(state.Params.AllowedPools)) - assert.Equal(t, sdk.MustNewDecFromStr("0.003"), state.Params.SwapFee) + assert.Equal(t, sdkmath.LegacyMustNewDecFromStr("0.003"), state.Params.SwapFee) assert.Equal(t, 2, len(state.PoolRecords)) assert.Equal(t, 2, len(state.ShareRecords)) } @@ -207,7 +207,7 @@ share_records: types.NewAllowedPool("ukava", "usdx"), types.NewAllowedPool("hard", "busd"), ), - sdk.MustNewDecFromStr("0.003"), + sdkmath.LegacyMustNewDecFromStr("0.003"), ), types.PoolRecords{ types.NewPoolRecord(sdk.NewCoins(ukava(1e6), usdx(5e6)), i(3e6)), diff --git a/x/swap/types/msg.go b/x/swap/types/msg.go index b415a01c66..a07afa0c7c 100644 --- a/x/swap/types/msg.go +++ b/x/swap/types/msg.go @@ -38,7 +38,7 @@ type MsgWithDeadline interface { } // NewMsgDeposit returns a new MsgDeposit -func NewMsgDeposit(depositor string, tokenA sdk.Coin, tokenB sdk.Coin, slippage sdk.Dec, deadline int64) *MsgDeposit { +func NewMsgDeposit(depositor string, tokenA sdk.Coin, tokenB sdk.Coin, slippage sdkmath.LegacyDec, deadline int64) *MsgDeposit { return &MsgDeposit{ Depositor: depositor, TokenA: tokenA, @@ -190,7 +190,7 @@ func (msg MsgWithdraw) DeadlineExceeded(blockTime time.Time) bool { } // NewMsgSwapExactForTokens returns a new MsgSwapExactForTokens -func NewMsgSwapExactForTokens(requester string, exactTokenA sdk.Coin, tokenB sdk.Coin, slippage sdk.Dec, deadline int64) *MsgSwapExactForTokens { +func NewMsgSwapExactForTokens(requester string, exactTokenA sdk.Coin, tokenB sdk.Coin, slippage sdkmath.LegacyDec, deadline int64) *MsgSwapExactForTokens { return &MsgSwapExactForTokens{ Requester: requester, ExactTokenA: exactTokenA, @@ -266,7 +266,7 @@ func (msg MsgSwapExactForTokens) DeadlineExceeded(blockTime time.Time) bool { } // NewMsgSwapForExactTokens returns a new MsgSwapForExactTokens -func NewMsgSwapForExactTokens(requester string, tokenA sdk.Coin, exactTokenB sdk.Coin, slippage sdk.Dec, deadline int64) *MsgSwapForExactTokens { +func NewMsgSwapForExactTokens(requester string, tokenA sdk.Coin, exactTokenB sdk.Coin, slippage sdkmath.LegacyDec, deadline int64) *MsgSwapForExactTokens { return &MsgSwapForExactTokens{ Requester: requester, TokenA: tokenA, diff --git a/x/swap/types/msg_test.go b/x/swap/types/msg_test.go index ca155ee406..53fc26d67d 100644 --- a/x/swap/types/msg_test.go +++ b/x/swap/types/msg_test.go @@ -25,7 +25,7 @@ func TestMsgDeposit_Signing(t *testing.T) { addr, err := sdk.AccAddressFromBech32("kava1gepm4nwzz40gtpur93alv9f9wm5ht4l0hzzw9d") require.NoError(t, err) - msg := types.NewMsgDeposit(addr.String(), sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.MustNewDecFromStr("0.01"), 1623606299) + msg := types.NewMsgDeposit(addr.String(), sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdkmath.LegacyMustNewDecFromStr("0.01"), 1623606299) assert.Equal(t, []sdk.AccAddress{addr}, msg.GetSigners()) assert.Equal(t, signBytes, msg.GetSignBytes()) } @@ -38,7 +38,7 @@ func TestMsgDeposit_Validation(t *testing.T) { addr.String(), sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), - sdk.MustNewDecFromStr("0.01"), + sdkmath.LegacyMustNewDecFromStr("0.01"), 1623606299, ) require.NoError(t, validMsg.ValidateBasic()) @@ -48,7 +48,7 @@ func TestMsgDeposit_Validation(t *testing.T) { depositor string tokenA sdk.Coin tokenB sdk.Coin - slippage sdk.Dec + slippage sdkmath.LegacyDec deadline int64 expectedErr string }{ @@ -138,7 +138,7 @@ func TestMsgDeposit_Validation(t *testing.T) { depositor: validMsg.Depositor, tokenA: validMsg.TokenA, tokenB: validMsg.TokenB, - slippage: sdk.MustNewDecFromStr("-0.01"), + slippage: sdkmath.LegacyMustNewDecFromStr("-0.01"), deadline: validMsg.Deadline, expectedErr: "slippage can not be negative: invalid slippage", }, @@ -147,7 +147,7 @@ func TestMsgDeposit_Validation(t *testing.T) { depositor: validMsg.Depositor, tokenA: validMsg.TokenA, tokenB: validMsg.TokenB, - slippage: sdk.Dec{}, + slippage: sdkmath.LegacyDec{}, deadline: validMsg.Deadline, expectedErr: "slippage must be set: invalid slippage", }, @@ -192,7 +192,7 @@ func TestMsgDeposit_Deadline(t *testing.T) { sdk.AccAddress("test1").String(), sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), - sdk.MustNewDecFromStr("0.01"), + sdkmath.LegacyMustNewDecFromStr("0.01"), tc.deadline, ) require.NoError(t, msg.ValidateBasic()) @@ -301,7 +301,7 @@ func TestMsgWithdraw_Validation(t *testing.T) { { name: "zero shares", from: validMsg.From, - shares: sdk.ZeroInt(), + shares: sdkmath.ZeroInt(), minTokenA: validMsg.MinTokenA, minTokenB: validMsg.MinTokenB, deadline: validMsg.Deadline, @@ -406,7 +406,7 @@ func TestMsgSwapExactForTokens_Signing(t *testing.T) { addr, err := sdk.AccAddressFromBech32("kava1gepm4nwzz40gtpur93alv9f9wm5ht4l0hzzw9d") require.NoError(t, err) - msg := types.NewMsgSwapExactForTokens(addr.String(), sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.MustNewDecFromStr("0.01"), 1623606299) + msg := types.NewMsgSwapExactForTokens(addr.String(), sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdkmath.LegacyMustNewDecFromStr("0.01"), 1623606299) assert.Equal(t, []sdk.AccAddress{addr}, msg.GetSigners()) assert.Equal(t, signBytes, msg.GetSignBytes()) } @@ -416,7 +416,7 @@ func TestMsgSwapExactForTokens_Validation(t *testing.T) { sdk.AccAddress("test1").String(), sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), - sdk.MustNewDecFromStr("0.01"), + sdkmath.LegacyMustNewDecFromStr("0.01"), 1623606299, ) require.NoError(t, validMsg.ValidateBasic()) @@ -426,7 +426,7 @@ func TestMsgSwapExactForTokens_Validation(t *testing.T) { requester string exactTokenA sdk.Coin tokenB sdk.Coin - slippage sdk.Dec + slippage sdkmath.LegacyDec deadline int64 expectedErr string }{ @@ -516,7 +516,7 @@ func TestMsgSwapExactForTokens_Validation(t *testing.T) { requester: validMsg.Requester, exactTokenA: validMsg.ExactTokenA, tokenB: validMsg.TokenB, - slippage: sdk.MustNewDecFromStr("-0.01"), + slippage: sdkmath.LegacyMustNewDecFromStr("-0.01"), deadline: validMsg.Deadline, expectedErr: "slippage can not be negative: invalid slippage", }, @@ -525,7 +525,7 @@ func TestMsgSwapExactForTokens_Validation(t *testing.T) { requester: validMsg.Requester, exactTokenA: validMsg.ExactTokenA, tokenB: validMsg.TokenB, - slippage: sdk.Dec{}, + slippage: sdkmath.LegacyDec{}, deadline: validMsg.Deadline, expectedErr: "slippage must be set: invalid slippage", }, @@ -570,7 +570,7 @@ func TestMsgSwapExactForTokens_Deadline(t *testing.T) { sdk.AccAddress("test1").String(), sdk.NewCoin("ukava", sdkmath.NewInt(1000000)), sdk.NewCoin("usdx", sdkmath.NewInt(2000000)), - sdk.MustNewDecFromStr("0.01"), + sdkmath.LegacyMustNewDecFromStr("0.01"), tc.deadline, ) require.NoError(t, msg.ValidateBasic()) @@ -592,7 +592,7 @@ func TestMsgSwapForExactTokens_Signing(t *testing.T) { addr, err := sdk.AccAddressFromBech32("kava1gepm4nwzz40gtpur93alv9f9wm5ht4l0hzzw9d") require.NoError(t, err) - msg := types.NewMsgSwapForExactTokens(addr.String(), sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.MustNewDecFromStr("0.01"), 1623606299) + msg := types.NewMsgSwapForExactTokens(addr.String(), sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdkmath.LegacyMustNewDecFromStr("0.01"), 1623606299) assert.Equal(t, []sdk.AccAddress{addr}, msg.GetSigners()) assert.Equal(t, signBytes, msg.GetSignBytes()) } @@ -602,7 +602,7 @@ func TestMsgSwapForExactTokens_Validation(t *testing.T) { sdk.AccAddress("test1").String(), sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), - sdk.MustNewDecFromStr("0.01"), + sdkmath.LegacyMustNewDecFromStr("0.01"), 1623606299, ) require.NoError(t, validMsg.ValidateBasic()) @@ -612,7 +612,7 @@ func TestMsgSwapForExactTokens_Validation(t *testing.T) { requester string tokenA sdk.Coin exactTokenB sdk.Coin - slippage sdk.Dec + slippage sdkmath.LegacyDec deadline int64 expectedErr string }{ @@ -702,7 +702,7 @@ func TestMsgSwapForExactTokens_Validation(t *testing.T) { requester: validMsg.Requester, tokenA: validMsg.TokenA, exactTokenB: validMsg.ExactTokenB, - slippage: sdk.MustNewDecFromStr("-0.01"), + slippage: sdkmath.LegacyMustNewDecFromStr("-0.01"), deadline: validMsg.Deadline, expectedErr: "slippage can not be negative: invalid slippage", }, @@ -711,7 +711,7 @@ func TestMsgSwapForExactTokens_Validation(t *testing.T) { requester: validMsg.Requester, tokenA: validMsg.TokenA, exactTokenB: validMsg.ExactTokenB, - slippage: sdk.Dec{}, + slippage: sdkmath.LegacyDec{}, deadline: validMsg.Deadline, expectedErr: "slippage must be set: invalid slippage", }, @@ -756,7 +756,7 @@ func TestMsgSwapForExactTokens_Deadline(t *testing.T) { sdk.AccAddress("test1").String(), sdk.NewCoin("ukava", sdkmath.NewInt(1000000)), sdk.NewCoin("usdx", sdkmath.NewInt(2000000)), - sdk.MustNewDecFromStr("0.01"), + sdkmath.LegacyMustNewDecFromStr("0.01"), tc.deadline, ) require.NoError(t, msg.ValidateBasic()) diff --git a/x/swap/types/params.go b/x/swap/types/params.go index 6cd67964df..30162542c1 100644 --- a/x/swap/types/params.go +++ b/x/swap/types/params.go @@ -1,6 +1,7 @@ package types import ( + sdkmath "cosmossdk.io/math" "fmt" "strings" @@ -13,12 +14,12 @@ var ( KeyAllowedPools = []byte("AllowedPools") KeySwapFee = []byte("SwapFee") DefaultAllowedPools = AllowedPools{} - DefaultSwapFee = sdk.ZeroDec() - MaxSwapFee = sdk.OneDec() + DefaultSwapFee = sdkmath.LegacyZeroDec() + MaxSwapFee = sdkmath.LegacyOneDec() ) // NewParams returns a new params object -func NewParams(pairs AllowedPools, swapFee sdk.Dec) Params { +func NewParams(pairs AllowedPools, swapFee sdkmath.LegacyDec) Params { return Params{ AllowedPools: pairs, SwapFee: swapFee, @@ -73,7 +74,7 @@ func validateAllowedPoolsParams(i interface{}) error { } func validateSwapFee(i interface{}) error { - swapFee, ok := i.(sdk.Dec) + swapFee, ok := i.(sdkmath.LegacyDec) if !ok { return fmt.Errorf("invalid parameter type: %T", i) } diff --git a/x/swap/types/params_test.go b/x/swap/types/params_test.go index 505981666a..81a5c9e287 100644 --- a/x/swap/types/params_test.go +++ b/x/swap/types/params_test.go @@ -10,7 +10,6 @@ import ( "github.com/kava-labs/kava/x/swap/types" - sdk "github.com/cosmos/cosmos-sdk/types" paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -25,7 +24,7 @@ func TestParams_UnmarshalJSON(t *testing.T) { poolData, err := json.Marshal(pools) require.NoError(t, err) - fee, err := sdk.NewDecFromStr("0.5") + fee, err := sdkmath.LegacyNewDecFromStr("0.5") require.NoError(t, err) feeData, err := json.Marshal(fee) require.NoError(t, err) @@ -48,7 +47,7 @@ func TestParams_MarshalYAML(t *testing.T) { types.NewAllowedPool("hard", "ukava"), types.NewAllowedPool("hard", "usdx"), ) - fee, err := sdk.NewDecFromStr("0.5") + fee, err := sdkmath.LegacyNewDecFromStr("0.5") require.NoError(t, err) p := types.Params{ @@ -78,7 +77,7 @@ func TestParams_Default(t *testing.T) { assert.Equal(t, types.DefaultSwapFee, defaultParams.SwapFee) assert.Equal(t, 0, len(defaultParams.AllowedPools)) - assert.Equal(t, sdk.ZeroDec(), defaultParams.SwapFee) + assert.Equal(t, sdkmath.LegacyZeroDec(), defaultParams.SwapFee) } func TestParams_ParamSetPairs_AllowedPools(t *testing.T) { @@ -115,7 +114,7 @@ func TestParams_ParamSetPairs_SwapFee(t *testing.T) { } require.NotNil(t, paramSetPair) - swapFee, ok := paramSetPair.Value.(*sdk.Dec) + swapFee, ok := paramSetPair.Value.(*sdkmath.LegacyDec) require.True(t, ok) assert.Equal(t, swapFee, &defaultParams.SwapFee) @@ -142,7 +141,7 @@ func TestParams_Validation(t *testing.T) { name: "nil swap fee", key: types.KeySwapFee, testFn: func(params *types.Params) { - params.SwapFee = sdk.Dec{} + params.SwapFee = sdkmath.LegacyDec{} }, expectedErr: "invalid swap fee: ", }, @@ -150,7 +149,7 @@ func TestParams_Validation(t *testing.T) { name: "negative swap fee", key: types.KeySwapFee, testFn: func(params *types.Params) { - params.SwapFee = sdk.NewDec(-1) + params.SwapFee = sdkmath.LegacyNewDec(-1) }, expectedErr: "invalid swap fee: -1.000000000000000000", }, @@ -158,7 +157,7 @@ func TestParams_Validation(t *testing.T) { name: "swap fee greater than 1", key: types.KeySwapFee, testFn: func(params *types.Params) { - params.SwapFee = sdk.MustNewDecFromStr("1.000000000000000001") + params.SwapFee = sdkmath.LegacyMustNewDecFromStr("1.000000000000000001") }, expectedErr: "invalid swap fee: 1.000000000000000001", }, @@ -166,7 +165,7 @@ func TestParams_Validation(t *testing.T) { name: "0 swap fee", key: types.KeySwapFee, testFn: func(params *types.Params) { - params.SwapFee = sdk.ZeroDec() + params.SwapFee = sdkmath.LegacyZeroDec() }, expectedErr: "", }, @@ -174,7 +173,7 @@ func TestParams_Validation(t *testing.T) { name: "1 swap fee", key: types.KeySwapFee, testFn: func(params *types.Params) { - params.SwapFee = sdk.OneDec() + params.SwapFee = sdkmath.LegacyOneDec() }, expectedErr: "invalid swap fee: 1.000000000000000000", }, @@ -215,7 +214,7 @@ func TestParams_String(t *testing.T) { types.NewAllowedPool("hard", "ukava"), types.NewAllowedPool("ukava", "usdx"), ), - sdk.MustNewDecFromStr("0.5"), + sdkmath.LegacyMustNewDecFromStr("0.5"), ) require.NoError(t, params.Validate()) diff --git a/x/swap/types/query.pb.go b/x/swap/types/query.pb.go index fc239a0366..b4ac383598 100644 --- a/x/swap/types/query.pb.go +++ b/x/swap/types/query.pb.go @@ -5,6 +5,7 @@ package types import ( context "context" + cosmossdk_io_math "cosmossdk.io/math" fmt "fmt" _ "github.com/cosmos/cosmos-proto" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" @@ -226,7 +227,7 @@ type PoolResponse struct { // coins represents the total reserves of the pool Coins github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,2,rep,name=coins,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"coins"` // total_shares represents the total shares of the pool - TotalShares github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,3,opt,name=total_shares,json=totalShares,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"total_shares"` + TotalShares cosmossdk_io_math.Int `protobuf:"bytes,3,opt,name=total_shares,json=totalShares,proto3,customtype=cosmossdk.io/math.Int" json:"total_shares"` } func (m *PoolResponse) Reset() { *m = PoolResponse{} } @@ -353,7 +354,7 @@ type DepositResponse struct { // pool_id represents the pool the deposit is for PoolId string `protobuf:"bytes,2,opt,name=pool_id,json=poolId,proto3" json:"pool_id,omitempty"` // shares_owned presents the shares owned by the depositor for the pool - SharesOwned github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,3,opt,name=shares_owned,json=sharesOwned,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"shares_owned"` + SharesOwned cosmossdk_io_math.Int `protobuf:"bytes,3,opt,name=shares_owned,json=sharesOwned,proto3,customtype=cosmossdk.io/math.Int" json:"shares_owned"` // shares_value represents the coin value of the shares_owned SharesValue github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,4,rep,name=shares_value,json=sharesValue,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"shares_value"` } @@ -405,54 +406,55 @@ func init() { func init() { proto.RegisterFile("kava/swap/v1beta1/query.proto", fileDescriptor_652c07bb38685396) } var fileDescriptor_652c07bb38685396 = []byte{ - // 747 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0xcf, 0x4f, 0x13, 0x4d, - 0x18, 0xee, 0xf6, 0xd7, 0x07, 0x53, 0x92, 0x2f, 0xcc, 0xc7, 0x17, 0xdb, 0x05, 0xb6, 0x58, 0x05, - 0x1a, 0x93, 0xee, 0x0a, 0x26, 0x9a, 0xa8, 0x07, 0xad, 0x04, 0xc3, 0x49, 0x5d, 0x8c, 0x07, 0x2f, - 0xcd, 0x94, 0x9d, 0x2c, 0x1b, 0xb6, 0x3b, 0xcb, 0xce, 0xb4, 0x88, 0x27, 0xc3, 0xc9, 0xa3, 0x89, - 0x37, 0x4f, 0x9e, 0x8d, 0xde, 0xf8, 0x0f, 0xbc, 0x70, 0x24, 0x78, 0x31, 0x1e, 0xd0, 0x80, 0x47, - 0xff, 0x08, 0x33, 0x3f, 0xb6, 0x94, 0x76, 0xb1, 0x6a, 0x38, 0x75, 0x77, 0xde, 0xf7, 0x7d, 0x9e, - 0xe7, 0x7d, 0xdf, 0x67, 0xa7, 0x60, 0x7a, 0x03, 0x75, 0x90, 0x45, 0xb7, 0x50, 0x68, 0x75, 0x16, - 0x9a, 0x98, 0xa1, 0x05, 0x6b,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76, 0x3b, 0x9c, 0x3f, 0x0b, 0xb5, 0xef, - 0xfb, 0xd5, 0xab, 0xc3, 0x13, 0x95, 0x82, 0x4b, 0x42, 0xc1, 0x34, 0x9c, 0x4c, 0x50, 0x10, 0x7f, - 0x17, 0xf5, 0x3b, 0x7b, 0x47, 0x86, 0xb6, 0x7f, 0x64, 0x68, 0xdf, 0x8e, 0x0c, 0xed, 0xd5, 0xb1, - 0x91, 0xda, 0x3f, 0x36, 0x52, 0x9f, 0x8f, 0x8d, 0xd4, 0xd3, 0x5e, 0x7f, 0x71, 0x80, 0x9a, 0x8f, - 0x9a, 0x54, 0x42, 0x3d, 0x93, 0x60, 0x62, 0xbb, 0xcd, 0xbc, 0xf8, 0x93, 0xbb, 0xf6, 0x33, 0x00, - 0x00, 0xff, 0xff, 0x7b, 0x1b, 0x3a, 0x0f, 0xd1, 0x07, 0x00, 0x00, + // 757 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0x4d, 0x6f, 0xd3, 0x4a, + 0x14, 0x8d, 0xf3, 0xf5, 0xda, 0x49, 0xa5, 0xa7, 0xce, 0x6b, 0xf5, 0x12, 0xb7, 0x75, 0xfa, 0xf2, + 0x68, 0x1b, 0x81, 0x62, 0xd3, 0x22, 0x40, 0x82, 0x0d, 0x84, 0x0a, 0xd4, 0x0d, 0x1f, 0x2e, 0x42, + 0x88, 0x4d, 0x34, 0xa9, 0x47, 0xae, 0x55, 0xc7, 0xe3, 0x7a, 0x26, 0x29, 0x65, 0x85, 0xba, 0x62, + 0x89, 0xc4, 0x8e, 0x15, 0x6b, 0x04, 0x1b, 0xd4, 0x1f, 0xd1, 0x65, 0x55, 0x36, 0x08, 0xa4, 0x82, + 0x5a, 0x7e, 0x08, 0x9a, 0x0f, 0xa7, 0x69, 0xe2, 0x12, 0x09, 0x75, 0x15, 0x7b, 0xee, 0xbd, 0xe7, + 0x9c, 0x7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b, 0xcf, 0x5f, 0x57, 0x1c, 0x78, 0x17, + 0x80, 0x93, 0x01, 0x16, 0xd3, 0x82, 0x70, 0xde, 0x54, 0x43, 0xe1, 0x13, 0x34, 0xe5, 0x66, 0x4e, + 0x88, 0x5d, 0xac, 0x40, 0xed, 0x9e, 0xca, 0xca, 0x5b, 0x2d, 0x6e, 0x54, 0xd2, 0xaa, 0x5e, 0x6e, + 0x82, 0x1c, 0x27, 0xe2, 0xad, 0x64, 0xaa, 0x85, 0xa5, 0x72, 0x52, 0x2b, 0x84, 0xf8, 0x71, 0xbe, + 0x6a, 0x48, 0xd6, 0xc0, 0x7b, 0x09, 0xda, 0x16, 0x86, 0x6a, 0x93, 0x48, 0xa7, 0xc4, 0x7d, 0xd3, + 0xc0, 0x58, 0x2f, 0x0d, 0x84, 0x20, 0x1b, 0xa0, 0x16, 0x56, 0xb3, 0x10, 0xcf, 0x10, 0x81, 0x1c, + 0x37, 0x09, 0x2d, 0xa6, 0x85, 0xd4, 0xd2, 0x29, 0xa2, 0x98, 0xe2, 0x0e, 0xf1, 0x82, 0xfa, 0x65, + 0x2e, 0xf2, 0xfd, 0xf7, 0x72, 0xd5, 0xf5, 0xd8, 0x7a, 0xbb, 0x69, 0xae, 0x91, 0x96, 0xb2, 0x91, + 0xfa, 0xa9, 0x51, 0x67, 0xc3, 0x62, 0xdb, 0x21, 0xa6, 0xa2, 0x80, 0xda, 0x12, 0x19, 0xde, 0x07, + 0x63, 0x8c, 0x30, 0xe4, 0x37, 0xe8, 0x3a, 0x8a, 0x30, 0x2d, 0x66, 0x38, 0x7d, 0xfd, 0x12, 0x87, + 0xfb, 0x7a, 0x58, 0x9e, 0x94, 0xc5, 0xd4, 0xd9, 0x30, 0x3d, 0x62, 0xb5, 0x10, 0x5b, 0x37, 0x57, + 0x02, 0x76, 0xb0, 0x5b, 0x03, 0x4a, 0xc9, 0x4a, 0xc0, 0xec, 0x82, 0x00, 0x58, 0x15, 0xf5, 0x6a, + 0xe1, 0x1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, 0xbc, 0x70, 0x26, 0x66, 0xcf, 0x25, 0xa9, + 0xcf, 0x0d, 0xc9, 0x52, 0xc4, 0xb3, 0x82, 0x58, 0x87, 0xc5, 0x24, 0x62, 0x41, 0xb7, 0xa3, 0x81, + 0x91, 0xd8, 0xdc, 0x70, 0xe1, 0x2c, 0xd4, 0xbe, 0xcf, 0x55, 0xaf, 0x0e, 0x4f, 0x54, 0x0a, 0xfe, + 0x17, 0x0a, 0x66, 0xe0, 0x54, 0x82, 0x82, 0xf8, 0x33, 0xa8, 0xdf, 0xda, 0x3b, 0x32, 0xb4, 0xfd, + 0x23, 0x43, 0xfb, 0x71, 0x64, 0x68, 0xaf, 0x8f, 0x8d, 0xd4, 0xfe, 0xb1, 0x91, 0xfa, 0x72, 0x6c, + 0xa4, 0x9e, 0xcd, 0xf7, 0x6c, 0x96, 0x03, 0xd4, 0x7c, 0xd4, 0xa4, 0x12, 0xea, 0xb9, 0x04, 0x13, + 0xdb, 0x6d, 0xe6, 0xc5, 0x5f, 0xd8, 0x95, 0x5f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xbb, 0x8f, 0x8d, + 0x36, 0xaf, 0x07, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -592,6 +594,7 @@ func _Query_Deposits_Handler(srv interface{}, ctx context.Context, dec func(inte return interceptor(ctx, in, info, handler) } +var Query_serviceDesc = _Query_serviceDesc var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "kava.swap.v1beta1.Query", HandlerType: (*QueryServer)(nil), diff --git a/x/swap/types/state_test.go b/x/swap/types/state_test.go index 9471662af0..fafa6258f5 100644 --- a/x/swap/types/state_test.go +++ b/x/swap/types/state_test.go @@ -209,7 +209,7 @@ func TestState_PoolRecord_Validations(t *testing.T) { { name: "zero reserve a", poolID: "ukava:usdx", - reservesA: sdk.Coin{Denom: "ukava", Amount: sdk.ZeroInt()}, + reservesA: sdk.Coin{Denom: "ukava", Amount: sdkmath.ZeroInt()}, reservesB: validRecord.ReservesB, totalShares: validRecord.TotalShares, expectedErr: "pool 'ukava:usdx' has invalid reserves: 0ukava", @@ -226,7 +226,7 @@ func TestState_PoolRecord_Validations(t *testing.T) { name: "zero reserve b", poolID: "ukava:usdx", reservesA: validRecord.ReservesA, - reservesB: sdk.Coin{Denom: "usdx", Amount: sdk.ZeroInt()}, + reservesB: sdk.Coin{Denom: "usdx", Amount: sdkmath.ZeroInt()}, totalShares: validRecord.TotalShares, expectedErr: "pool 'ukava:usdx' has invalid reserves: 0usdx", }, @@ -243,7 +243,7 @@ func TestState_PoolRecord_Validations(t *testing.T) { poolID: validRecord.PoolID, reservesA: validRecord.ReservesA, reservesB: validRecord.ReservesB, - totalShares: sdk.ZeroInt(), + totalShares: sdkmath.ZeroInt(), expectedErr: "pool 'ukava:usdx' has invalid total shares: 0", }, } @@ -466,7 +466,7 @@ func TestState_ShareRecord_Validations(t *testing.T) { name: "zero total shares", depositor: validRecord.Depositor, poolID: validRecord.PoolID, - sharesOwned: sdk.ZeroInt(), + sharesOwned: sdkmath.ZeroInt(), expectedErr: "depositor 'kava1mq9qxlhze029lm0frzw2xr6hem8c3k9ts54w0w' and pool 'ukava:usdx' has invalid total shares: 0", }, } diff --git a/x/swap/types/swap.pb.go b/x/swap/types/swap.pb.go index e1a71cd7e3..8f62284f6a 100644 --- a/x/swap/types/swap.pb.go +++ b/x/swap/types/swap.pb.go @@ -4,6 +4,7 @@ package types import ( + cosmossdk_io_math "cosmossdk.io/math" fmt "fmt" _ "github.com/cosmos/cosmos-proto" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" @@ -31,7 +32,7 @@ type Params struct { // allowed_pools defines that pools that are allowed to be created AllowedPools AllowedPools `protobuf:"bytes,1,rep,name=allowed_pools,json=allowedPools,proto3,castrepeated=AllowedPools" json:"allowed_pools"` // swap_fee defines the swap fee for all pools - SwapFee github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=swap_fee,json=swapFee,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"swap_fee"` + SwapFee cosmossdk_io_math.LegacyDec `protobuf:"bytes,2,opt,name=swap_fee,json=swapFee,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"swap_fee"` } func (m *Params) Reset() { *m = Params{} } @@ -137,7 +138,7 @@ type PoolRecord struct { // reserves_b is the a token coin reserves ReservesB types.Coin `protobuf:"bytes,3,opt,name=reserves_b,json=reservesB,proto3" json:"reserves_b"` // total_shares is the total distrubuted shares of the pool - TotalShares github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,4,opt,name=total_shares,json=totalShares,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"total_shares"` + TotalShares cosmossdk_io_math.Int `protobuf:"bytes,4,opt,name=total_shares,json=totalShares,proto3,customtype=cosmossdk.io/math.Int" json:"total_shares"` } func (m *PoolRecord) Reset() { *m = PoolRecord{} } @@ -201,7 +202,7 @@ type ShareRecord struct { // pool_id represents the pool the shares belong to PoolID string `protobuf:"bytes,2,opt,name=pool_id,json=poolId,proto3" json:"pool_id,omitempty"` // shares_owned represents the number of shares owned by depsoitor for the pool_id - SharesOwned github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,3,opt,name=shares_owned,json=sharesOwned,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"shares_owned"` + SharesOwned cosmossdk_io_math.Int `protobuf:"bytes,3,opt,name=shares_owned,json=sharesOwned,proto3,customtype=cosmossdk.io/math.Int" json:"shares_owned"` } func (m *ShareRecord) Reset() { *m = ShareRecord{} } @@ -261,40 +262,41 @@ func init() { func init() { proto.RegisterFile("kava/swap/v1beta1/swap.proto", fileDescriptor_9df359be90eb28cb) } var fileDescriptor_9df359be90eb28cb = []byte{ - // 521 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x53, 0x3f, 0x6f, 0xd3, 0x5e, - 0x14,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0xee, 0x38, 0x17, 0x15, - 0x77, 0xc7, 0xb9, 0x08, 0x3b, 0x4a, 0xf1, 0x99, 0x12, 0xec, 0x7f, 0xb7, 0x48, 0x47, 0x85, 0xc6, - 0x95, 0x43, 0xd2, 0x4e, 0xa0, 0x40, 0x9e, 0x0a, 0x2c, 0x95, 0x2f, 0xdd, 0xe0, 0xc9, 0xb7, 0xa5, - 0x3b, 0xf8, 0x8b, 0x4e, 0xc3, 0x38, 0x1e, 0x26, 0x49, 0x09, 0x9c, 0x9f, 0x9f, 0x0c, 0xae, 0x9b, - 0x86, 0xa6, 0x12, 0x1c, 0x0b, 0xe0, 0xe1, 0xa5, 0x74, 0xd5, 0xfd, 0xfa, 0x1f, 0xdd, 0xa7, 0xa4, - 0xab, 0xf7, 0xa6, 0xb8, 0xc8, 0x21, 0x51, 0xfe, 0xfd, 0xf3, 0xf6, 0x5a, 0xf1, 0xa9, 0x14, 0x0c, - 0x1e, 0x9c, 0xae, 0x1c, 0xeb, 0x6c, 0xe5, 0x58, 0x5f, 0x57, 0x8e, 0xf5, 0x66, 0xed, 0xd4, 0xce, - 0xd6, 0x4e, 0xed, 0xd3, 0xda, 0xa9, 0xbd, 0xac, 0x8a, 0xcb, 0x03, 0x19, 0x64, 0x2c, 0xe2, 0x2a, - 0xf2, 0x5f, 0xeb, 0x8b, 0x56, 0x0d, 0xa2, 0xa6, 0xba, 0xb3, 0x3b, 0x3f, 0x02, 0x00, 0x00, 0xff, - 0xff, 0xee, 0x4a, 0x16, 0x69, 0xeb, 0x03, 0x00, 0x00, + // 541 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x53, 0x3d, 0x6f, 0xd3, 0x50, + 0x14, 0x8d, 0xd3, 0x28, 0x21, 0x2f, 0x61, 0xc0, 0x14, 0x91, 0x16, 0x64, 0x57, 0x41, 0x42, 0x95, + 0x50, 0x6c, 0xa5, 0x6c, 0x0c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0x38, 0x22, 0xf5, 0x18, 0xa6, 0xc8, 0x12, 0x8e, 0xb9, 0x8c, 0xa1, 0xe9, 0xbd, 0xfa, + 0xb3, 0xb4, 0x3b, 0xc3, 0x84, 0x8f, 0xde, 0x87, 0x4e, 0x84, 0x13, 0x7d, 0xb5, 0xf4, 0x4f, 0x87, + 0xc5, 0x63, 0x97, 0x2f, 0xa6, 0xc0, 0x9c, 0x5e, 0x14, 0xf5, 0xe2, 0x38, 0x07, 0xc6, 0xce, 0x8e, + 0x3b, 0xb7, 0xf5, 0x40, 0xdd, 0xf1, 0x16, 0x1c, 0x98, 0x7f, 0x21, 0x5d, 0x0c, 0xbb, 0x7c, 0x65, + 0xd8, 0x07, 0xa4, 0xa9, 0x6c, 0x06, 0x38, 0xcf, 0x20, 0x96, 0x71, 0x5d, 0xd7, 0xac, 0x12, 0x78, + 0x2d, 0xf8, 0xde, 0xb3, 0x93, 0x95, 0x65, 0x9c, 0xae, 0x2c, 0xe3, 0xd7, 0xca, 0x32, 0x3e, 0xad, + 0xad, 0xd2, 0xe9, 0xda, 0x2a, 0x7d, 0x5f, 0x5b, 0xa5, 0x77, 0x0f, 0x0b, 0xfe, 0xc4, 0x9d, 0xef, + 0xa4, 0x34, 0x64, 0xf2, 0xe4, 0x7e, 0x50, 0x8f, 0x54, 0x7a, 0x0c, 0xab, 0xf2, 0xe9, 0x3c, 0xfe, + 0x1b, 0x00, 0x00, 0xff, 0xff, 0x2e, 0xef, 0x82, 0x5b, 0xbe, 0x03, 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { diff --git a/x/swap/types/tx.pb.go b/x/swap/types/tx.pb.go index 0eea5aa735..a8ec7dec0d 100644 --- a/x/swap/types/tx.pb.go +++ b/x/swap/types/tx.pb.go @@ -5,9 +5,9 @@ package types import ( context "context" + cosmossdk_io_math "cosmossdk.io/math" fmt "fmt" _ "github.com/cosmos/cosmos-proto" - github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" @@ -40,7 +40,7 @@ type MsgDeposit struct { // token_b represents one token of deposit pair TokenB types.Coin `protobuf:"bytes,3,opt,name=token_b,json=tokenB,proto3" json:"token_b"` // slippage represents the max decimal percentage price change - Slippage github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,4,opt,name=slippage,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"slippage"` + Slippage cosmossdk_io_math.LegacyDec `protobuf:"bytes,4,opt,name=slippage,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"slippage"` // deadline represents the unix timestamp to complete the deposit by Deadline int64 `protobuf:"varint,5,opt,name=deadline,proto3" json:"deadline,omitempty"` } @@ -120,7 +120,7 @@ type MsgWithdraw struct { // from represents the address we are withdrawing for From string `protobuf:"bytes,1,opt,name=from,proto3" json:"from,omitempty"` // shares represents the amount of shares to withdraw - Shares github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,2,opt,name=shares,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"shares"` + Shares cosmossdk_io_math.Int `protobuf:"bytes,2,opt,name=shares,proto3,customtype=cosmossdk.io/math.Int" json:"shares"` // min_token_a represents the minimum a token to withdraw MinTokenA types.Coin `protobuf:"bytes,3,opt,name=min_token_a,json=minTokenA,proto3" json:"min_token_a"` // min_token_a represents the minimum a token to withdraw @@ -208,7 +208,7 @@ type MsgSwapExactForTokens struct { // token_b represents the desired token_b to swap for TokenB types.Coin `protobuf:"bytes,3,opt,name=token_b,json=tokenB,proto3" json:"token_b"` // slippage represents the maximum change in token_b allowed - Slippage github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,4,opt,name=slippage,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"slippage"` + Slippage cosmossdk_io_math.LegacyDec `protobuf:"bytes,4,opt,name=slippage,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"slippage"` // deadline represents the unix timestamp to complete the swap by Deadline int64 `protobuf:"varint,5,opt,name=deadline,proto3" json:"deadline,omitempty"` } @@ -294,7 +294,7 @@ type MsgSwapForExactTokens struct { // exact_token_b represents the exact token b amount to swap for token a ExactTokenB types.Coin `protobuf:"bytes,3,opt,name=exact_token_b,json=exactTokenB,proto3" json:"exact_token_b"` // slippage represents the maximum change in token_a allowed - Slippage github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,4,opt,name=slippage,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"slippage"` + Slippage cosmossdk_io_math.LegacyDec `protobuf:"bytes,4,opt,name=slippage,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"slippage"` // deadline represents the unix timestamp to complete the swap by Deadline int64 `protobuf:"varint,5,opt,name=deadline,proto3" json:"deadline,omitempty"` } @@ -384,46 +384,46 @@ func init() { func init() { proto.RegisterFile("kava/swap/v1beta1/tx.proto", fileDescriptor_5b753029ccc8a1ef) } var fileDescriptor_5b753029ccc8a1ef = []byte{ - // 613 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x55, 0xcd, 0x6a, 0xdb, 0x4c, - 0x14, 0xb5, 0x6c, 0x7f, 0x89, 0x3d, 0xe6, 0x5b, 0x74, 0xea, 0x80, 0x22, 0x88, 0x6c, 0x0c, 0x0d, - 0x5e, 0xd4, 0x52, 0x93, 0x42, 0x29, 0xa5, 0xd0, 0x46, 0x71, 0x0c, 0x5d, 0x98, 0x82, 0x12, 0x68, - 0xe9, 0xc6, 0x8c, 0xa4, 0xa9, 0x2c, 0x6c, 0x6b, 0x54, 0xcd, 0x24, 0x76, 0xdf, 0xa0, 0xab, 0xd2, - 0x47, 0xe8, 0xae, 0x2f, 0xe0, 0x87, 0x08, 0x5d, 0x85, 0xac, 0x4a, 0x17, 0xa1, 0xd8, 0x2f, 0x52, - 0x34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36, 0x6c, 0xcf, 0x12, - 0x67, 0x9d, 0xfd, 0xcb, 0x3d, 0x5a, 0x01, 0x7b, 0xa9, 0x5e, 0xa6, 0xb9, 0xdd, 0x22, 0xfe, 0x49, - 0x72, 0xe1, 0xbb, 0xbb, 0x7d, 0xf7, 0x31, 0xb0, 0x54, 0xa7, 0xb5, 0x8d, 0x9e, 0xab, 0xd3, 0xdf, - 0xe2, 0xf6, 0xa2, 0x97, 0xb1, 0xdb, 0x87, 0x9f, 0x73, 0x20, 0xd7, 0xa6, 0x36, 0x7c, 0x0d, 0xb6, - 0xe3, 0x69, 0xbb, 0xa7, 0xdc, 0x9a, 0xf0, 0xca, 0x6c, 0xac, 0x48, 0x0f, 0x56, 0xc2, 0xb1, 0x30, - 0xd4, 0x41, 0x21, 0x99, 0x38, 0x72, 0x3a, 0x25, 0xc6, 0xa5, 0xfd, 0xd5, 0x78, 0xa2, 0xe9, 0x01, - 0x98, 0xf2, 0x27, 0xac, 0xa7, 0xb3, 0x6f, 0x47, 0x4a, 0x8f, 0xd6, 0x8d, 0x5c, 0xce, 0xb8, 0xd4, - 0x88, 0x2b, 0x32, 0x2e, 0x46, 0xae, 0xca, 0x98, 0x5e, 0x10, 0xed, 0xe5, 0xe5, 0x44, 0x16, 0xae, - 0x26, 0xb2, 0xf0, 0x6b, 0x22, 0x0b, 0x5f, 0xa6, 0x72, 0xe6, 0x6a, 0x2a, 0x67, 0x7e, 0x4c, 0xe5, - 0xcc, 0xbb, 0xf9, 0x6e, 0x09, 0x54, 0x1b, 0x7d, 0x64, 0x50, 0xbe, 0x52, 0x47, 0xe1, 0x5b, 0xcd, - 0x3b, 0xc6, 0xd8, 0xe2, 0x6f, 0xe8, 0xe3, 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, 0xd0, 0xde, 0xef, - 0x15, 0xc5, 0x07, 0x00, 0x00, + // 617 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x95, 0xbf, 0x6f, 0xd3, 0x40, + 0x14, 0xc7, 0xe3, 0x24, 0xb4, 0xcd, 0x45, 0x0c, 0x1c, 0x89, 0xe4, 0x1a, 0xc5, 0x89, 0x22, 0x51, + 0x65, 0x20, 0x36, 0x29, 0x02, 0x21, 0x16, 0xa8, 0x9b, 0x56, 0x42, 0x22, 0x42, 0x72, 0x2b, 0x21, + 0xb1, 0x44, 0x67, 0xfb, 0x70, 0xac, 0xc4, 0x3e, 0xe3, 0xbb, 0x36, 0xe9, 0x7f, 0xc0, 0x84, 0x98, + 0x98, 0x59, 0xd9, 0xbb, 0xb3, 0x76, 0xac, 0x3a, 0x21, 0x86, 0x0a, 0x25, 0xff, 0x08, 0xf2, 0xcf, + 0x34, 0x89, 0x15, 0x92, 0x2e, 0x88, 0xed, 0xce, 0xdf, 0xf7, 0xbe, 0x77, 0xf7, 0xb9, 0xe7, 0x77, + 0x40, 0xe8, 0xa3, 0x53, 0x24, 0xd3, 0x21, 0x72, 0xe5, 0xd3, 0x96, 0x86, 0x19, 0x6a, 0xc9, 0x6c, + 0x24, 0xb9, 0x1e, 0x61, 0x04, 0xde, 0xf3, 0x35, 0xc9, 0xd7, 0xa4, 0x48, 0x13, 0x44, 0x9d, 0x50, + 0x9b, 0x50, 0x59, 0x43, 0x14, 0x27, 0x09, 0x3a, 0xb1, 0x9c, 0x30, 0x45, 0xd8, 0x0e, 0xf5, 0x6e, + 0x30, 0x93, 0xc3, 0x49, 0x24, 0x95, 0x4c, 0x62, 0x92, 0xf0, 0xbb, 0x3f, 0x0a, 0xbf, 0xd6, 0xbf, + 0x67, 0x01, 0xe8, 0x50, 0xb3, 0x8d, 0x5d, 0x42, 0x2d, 0x06, 0x9f, 0x81, 0x82, 0x11, 0x0e, 0x89, + 0xc7, 0x73, 0x35, 0xae, 0x51, 0x50, 0xf8, 0xab, 0xf3, 0x66, 0x29, 0x72, 0xda, 0x33, 0x0c, 0x0f, + 0x53, 0x7a,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, 0xc7, 0x22, 0xf7, 0x7b, + 0x2c, 0x72, 0x5f, 0x26, 0x62, 0xe6, 0x72, 0x22, 0x66, 0x7e, 0x4e, 0xc4, 0xcc, 0xfb, 0x1d, 0xd3, + 0x62, 0xbd, 0x13, 0x4d, 0xd2, 0x89, 0x2d, 0xfb, 0xae, 0xcd, 0x01, 0xd2, 0x68, 0x30, 0x92, 0x47, + 0xe1, 0xcb, 0xcb, 0xce, 0x5c, 0x4c, 0xb5, 0x8d, 0xe0, 0x45, 0x7c, 0xf2, 0x27, 0x00, 0x00, 0xff, + 0xff, 0x6b, 0xfa, 0xf0, 0x95, 0x93, 0x07, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -597,6 +597,7 @@ func _Msg_SwapForExactTokens_Handler(srv interface{}, ctx context.Context, dec f return interceptor(ctx, in, info, handler) } +var Msg_serviceDesc = _Msg_serviceDesc var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "kava.swap.v1beta1.Msg", HandlerType: (*MsgServer)(nil), diff --git a/x/validator-vesting/keeper/grpc_query.go b/x/validator-vesting/keeper/grpc_query.go index c633638f47..38c62e1840 100644 --- a/x/validator-vesting/keeper/grpc_query.go +++ b/x/validator-vesting/keeper/grpc_query.go @@ -37,7 +37,7 @@ func (s queryServer) TotalSupply(c context.Context, req *types.QueryTotalSupplyR ctx := sdk.UnwrapSDKContext(c) totalSupply := s.bk.GetSupply(ctx, "ukava").Amount - supplyInt := sdk.NewDecFromInt(totalSupply).Mul(sdk.MustNewDecFromStr("0.000001")).TruncateInt() + supplyInt := sdkmath.LegacyNewDecFromInt(totalSupply).Mul(sdkmath.LegacyMustNewDecFromStr("0.000001")).TruncateInt() return &types.QueryTotalSupplyResponse{ Amount: supplyInt, }, nil @@ -98,7 +98,7 @@ func (s queryServer) CirculatingSupplyHARD(c context.Context, req *types.QueryCi time.Date(2024, 9, 15, 14, 0, 0, 0, time.UTC), // + 1,666,667 *** Year FOUR *** } - circSupply := sdk.ZeroInt() + circSupply := sdkmath.ZeroInt() blockTime := ctx.BlockTime() switch { case blockTime.Before(supplyIncreaseDates[0]): @@ -213,7 +213,7 @@ func (s queryServer) CirculatingSupplyUSDX(c context.Context, req *types.QueryCi ctx := sdk.UnwrapSDKContext(c) totalSupply := s.bk.GetSupply(ctx, "usdx").Amount - supplyInt := sdk.NewDecFromInt(totalSupply).Mul(sdk.MustNewDecFromStr("0.000001")).TruncateInt() + supplyInt := sdkmath.LegacyNewDecFromInt(totalSupply).Mul(sdkmath.LegacyMustNewDecFromStr("0.000001")).TruncateInt() return &types.QueryCirculatingSupplyUSDXResponse{ Amount: supplyInt, }, nil @@ -289,7 +289,7 @@ func (s queryServer) CirculatingSupplySWP(c context.Context, req *types.QueryCir scheduleAmounts = append(scheduleAmounts, []int64{0, 0, 0, monthlyStakersSwp, monthlyLPIncentivesSwp}) } - circSupply := sdk.ZeroInt() + circSupply := sdkmath.ZeroInt() blockTime := ctx.BlockTime() for i := 0; i < len(scheduleAmounts); i++ { @@ -316,7 +316,7 @@ func (s queryServer) TotalSupplyHARD(c context.Context, req *types.QueryTotalSup ctx := sdk.UnwrapSDKContext(c) totalSupply := s.bk.GetSupply(ctx, "hard").Amount - supplyInt := sdk.NewDecFromInt(totalSupply).Mul(sdk.MustNewDecFromStr("0.000001")).TruncateInt() + supplyInt := sdkmath.LegacyNewDecFromInt(totalSupply).Mul(sdkmath.LegacyMustNewDecFromStr("0.000001")).TruncateInt() return &types.QueryTotalSupplyHARDResponse{ Amount: supplyInt, }, nil @@ -344,15 +344,15 @@ func getCirculatingSupply(blockTime time.Time, totalSupply sdkmath.Int) sdkmath. switch { case blockTime.Before(vestingDates[0]): - return sdk.NewDecFromInt(totalSupply.Sub(sdkmath.NewInt(9937500000000))).Mul(sdk.MustNewDecFromStr("0.000001")).RoundInt() + return sdkmath.LegacyNewDecFromInt(totalSupply.Sub(sdkmath.NewInt(9937500000000))).Mul(sdkmath.LegacyMustNewDecFromStr("0.000001")).RoundInt() case blockTime.After(vestingDates[0]) && blockTime.Before(vestingDates[1]) || blockTime.Equal(vestingDates[0]): - return sdk.NewDecFromInt(totalSupply.Sub(sdkmath.NewInt(7453125000000))).Mul(sdk.MustNewDecFromStr("0.000001")).RoundInt() + return sdkmath.LegacyNewDecFromInt(totalSupply.Sub(sdkmath.NewInt(7453125000000))).Mul(sdkmath.LegacyMustNewDecFromStr("0.000001")).RoundInt() case blockTime.After(vestingDates[1]) && blockTime.Before(vestingDates[2]) || blockTime.Equal(vestingDates[1]): - return sdk.NewDecFromInt(totalSupply.Sub(sdkmath.NewInt(4968750000000))).Mul(sdk.MustNewDecFromStr("0.000001")).RoundInt() + return sdkmath.LegacyNewDecFromInt(totalSupply.Sub(sdkmath.NewInt(4968750000000))).Mul(sdkmath.LegacyMustNewDecFromStr("0.000001")).RoundInt() case blockTime.After(vestingDates[2]) && blockTime.Before(vestingDates[3]) || blockTime.Equal(vestingDates[2]): - return sdk.NewDecFromInt(totalSupply.Sub(sdkmath.NewInt(2484375000000))).Mul(sdk.MustNewDecFromStr("0.000001")).RoundInt() + return sdkmath.LegacyNewDecFromInt(totalSupply.Sub(sdkmath.NewInt(2484375000000))).Mul(sdkmath.LegacyMustNewDecFromStr("0.000001")).RoundInt() default: // align with total supply calculation and truncate int here instead of round - return sdk.NewDecFromInt(totalSupply).Mul(sdk.MustNewDecFromStr("0.000001")).TruncateInt() + return sdkmath.LegacyNewDecFromInt(totalSupply).Mul(sdkmath.LegacyMustNewDecFromStr("0.000001")).TruncateInt() } } diff --git a/x/validator-vesting/keeper/grpc_query_test.go b/x/validator-vesting/keeper/grpc_query_test.go index b6c22c0eeb..b74ce7e6c3 100644 --- a/x/validator-vesting/keeper/grpc_query_test.go +++ b/x/validator-vesting/keeper/grpc_query_test.go @@ -39,7 +39,7 @@ func (m *mockBankKeeper) GetSupply(ctx sdk.Context, denom string) sdk.Coin { func (suite *grpcQueryTestSuite) SetupTest() { testTime := time.Date(2024, 2, 29, 12, 00, 00, 00, time.UTC) tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: testTime}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: testTime}) suite.app = tApp suite.ctx = ctx suite.bk = &mockBankKeeper{} diff --git a/x/validator-vesting/module.go b/x/validator-vesting/module.go index 39fa0c6165..ae3de2a58a 100644 --- a/x/validator-vesting/module.go +++ b/x/validator-vesting/module.go @@ -116,10 +116,16 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw func (AppModule) ConsensusVersion() uint64 { return 1 } // BeginBlock executes all ABCI BeginBlock logic respective to validator-vesting module. -func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) {} +func (am AppModule) BeginBlock(ctx sdk.Context) error { + return nil +} // EndBlock executes all ABCI EndBlock logic respective to validator-vesting module. It // returns no validator updates. -func (am AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { - return []abci.ValidatorUpdate{} +func (am AppModule) EndBlock(_ sdk.Context) ([]abci.ValidatorUpdate, error) { + return []abci.ValidatorUpdate{}, nil } + +func (AppModule) IsOnePerModuleType() {} + +func (AppModule) IsAppModule() {} diff --git a/x/validator-vesting/types/expected_keepers.go b/x/validator-vesting/types/expected_keepers.go index 0157c8739e..dd4fa77b94 100644 --- a/x/validator-vesting/types/expected_keepers.go +++ b/x/validator-vesting/types/expected_keepers.go @@ -1,10 +1,11 @@ package types import ( + "context" sdk "github.com/cosmos/cosmos-sdk/types" ) // BankKeeper defines the expected bank keeper (noalias) type BankKeeper interface { - GetSupply(ctx sdk.Context, denom string) sdk.Coin + GetSupply(ctx context.Context, denom string) sdk.Coin } diff --git a/x/validator-vesting/types/query.pb.go b/x/validator-vesting/types/query.pb.go index b8a8442dcc..5253b5d2a5 100644 --- a/x/validator-vesting/types/query.pb.go +++ b/x/validator-vesting/types/query.pb.go @@ -5,9 +5,9 @@ package types import ( context "context" + cosmossdk_io_math "cosmossdk.io/math" fmt "fmt" _ "github.com/cosmos/cosmos-proto" - github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" @@ -70,7 +70,7 @@ var xxx_messageInfo_QueryCirculatingSupplyRequest proto.InternalMessageInfo // QueryCirculatingSupplyResponse is the response type for the Query/CirculatingSupply RPC method type QueryCirculatingSupplyResponse struct { - Amount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,1,opt,name=amount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"amount"` + Amount cosmossdk_io_math.Int `protobuf:"bytes,1,opt,name=amount,proto3,customtype=cosmossdk.io/math.Int" json:"amount"` } func (m *QueryCirculatingSupplyResponse) Reset() { *m = QueryCirculatingSupplyResponse{} } @@ -145,7 +145,7 @@ var xxx_messageInfo_QueryTotalSupplyRequest proto.InternalMessageInfo // QueryTotalSupplyResponse is the response type for the Query/TotalSupply RPC method type QueryTotalSupplyResponse struct { - Amount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,1,opt,name=amount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"amount"` + Amount cosmossdk_io_math.Int `protobuf:"bytes,1,opt,name=amount,proto3,customtype=cosmossdk.io/math.Int" json:"amount"` } func (m *QueryTotalSupplyResponse) Reset() { *m = QueryTotalSupplyResponse{} } @@ -220,7 +220,7 @@ var xxx_messageInfo_QueryCirculatingSupplyHARDRequest proto.InternalMessageInfo // QueryCirculatingSupplyHARDResponse is the response type for the Query/CirculatingSupplyHARD RPC method type QueryCirculatingSupplyHARDResponse struct { - Amount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,1,opt,name=amount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"amount"` + Amount cosmossdk_io_math.Int `protobuf:"bytes,1,opt,name=amount,proto3,customtype=cosmossdk.io/math.Int" json:"amount"` } func (m *QueryCirculatingSupplyHARDResponse) Reset() { *m = QueryCirculatingSupplyHARDResponse{} } @@ -295,7 +295,7 @@ var xxx_messageInfo_QueryCirculatingSupplyUSDXRequest proto.InternalMessageInfo // QueryCirculatingSupplyUSDXResponse is the response type for the Query/CirculatingSupplyUSDX RPC method type QueryCirculatingSupplyUSDXResponse struct { - Amount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,1,opt,name=amount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"amount"` + Amount cosmossdk_io_math.Int `protobuf:"bytes,1,opt,name=amount,proto3,customtype=cosmossdk.io/math.Int" json:"amount"` } func (m *QueryCirculatingSupplyUSDXResponse) Reset() { *m = QueryCirculatingSupplyUSDXResponse{} } @@ -370,7 +370,7 @@ var xxx_messageInfo_QueryCirculatingSupplySWPRequest proto.InternalMessageInfo // QueryCirculatingSupplySWPResponse is the response type for the Query/CirculatingSupplySWP RPC method type QueryCirculatingSupplySWPResponse struct { - Amount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,1,opt,name=amount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"amount"` + Amount cosmossdk_io_math.Int `protobuf:"bytes,1,opt,name=amount,proto3,customtype=cosmossdk.io/math.Int" json:"amount"` } func (m *QueryCirculatingSupplySWPResponse) Reset() { *m = QueryCirculatingSupplySWPResponse{} } @@ -445,7 +445,7 @@ var xxx_messageInfo_QueryTotalSupplyHARDRequest proto.InternalMessageInfo // QueryTotalSupplyHARDResponse is the response type for the Query/TotalSupplyHARD RPC method type QueryTotalSupplyHARDResponse struct { - Amount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,1,opt,name=amount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"amount"` + Amount cosmossdk_io_math.Int `protobuf:"bytes,1,opt,name=amount,proto3,customtype=cosmossdk.io/math.Int" json:"amount"` } func (m *QueryTotalSupplyHARDResponse) Reset() { *m = QueryTotalSupplyHARDResponse{} } @@ -520,7 +520,7 @@ var xxx_messageInfo_QueryTotalSupplyUSDXRequest proto.InternalMessageInfo // QueryTotalSupplyUSDXResponse is the response type for the Query/TotalSupplyUSDX RPC method type QueryTotalSupplyUSDXResponse struct { - Amount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,1,opt,name=amount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"amount"` + Amount cosmossdk_io_math.Int `protobuf:"bytes,1,opt,name=amount,proto3,customtype=cosmossdk.io/math.Int" json:"amount"` } func (m *QueryTotalSupplyUSDXResponse) Reset() { *m = QueryTotalSupplyUSDXResponse{} } @@ -578,46 +578,46 @@ func init() { } var fileDescriptor_2198ebff70588a65 = []byte{ - // 619 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x96, 0xcb, 0x6e, 0xd3, 0x4c, - 0x14, 0xc7, 0x33, 0x9f, 0xf4, 0x55, 0x62, 0xba, 0x40, 0x8c, 0x8a, 0x68, 0x4d, 0xe3, 0x14, 0x23, - 0x21, 0x90, 0x88, 0xad, 0x34, 0x55, 0x4b, 0x2f, 0xd0, 0x0b, 0x5d, 0xd0, 0x1d, 0x4d, 0x8a, 0x40, - 0x6c, 0xa2, 0x49, 0x62, 0xb9, 0x56, 0x1d, 0x8f, 0xeb, 0x19, 0x9b, 0x86, 0x25, 0x4f, 0x80, 0xc4, - 0xab, 0x74, 0xc3, 0x03, 0x20, 0x65, 0xc1, 0xa2, 0x82, 0x0d, 0x20, 0x51, 0x41, 0xc2, 0x83, 0x20, - 0x8f, 0x27, 0xaa, 0xeb, 0xb8, 0x29, 0x76, 0x14, 0x58, 0x25, 0xb1, 0xcf, 0xe5, 0xf7, 0xf7, 0x39, - 0xf3, 0x77, 0xe0, 0xbd, 0x03, 0xec, 0x63, 0xcd, 0xc7, 0x96, 0xd9, 0xc4, 0x8c, 0xb8, 0xbe, 0x4e, - 0x99, 0x69, 0x1b, 0x9a, 0x5f, 0xaa, 0xeb, 0x0c, 0x97, 0xb4, 0x43, 0x4f, 0x77, 0xdb, 0xaa, 0xe3, - 0x12, 0x46, 0x50, 0x3e, 0x08, 0x55, 0xe3, 0xa1, 0xaa, 0x08, 0x95, 0x66, 0x1a, 0x84, 0xb6, 0x08, - 0xad, 0xf1, 0x60, 0x2d, 0xfc, 0x11, 0x66, 0x4a, 0x53, 0x06, 0x31, 0x48, 0x78, 0x3d, 0xf8, 0x26, - 0xae, 0xce, 0x1a, 0x84, 0x18, 0x96, 0xae, 0x61, 0xc7, 0xd4, 0xb0, 0x6d, 0x13, 0x86, 0x99, 0x49, - 0x6c, 0x91, 0xa3, 0x14, 0x60, 0x7e, 0x37, 0x68, 0xfe, 0xd8, 0x74, 0x1b, 0x9e, 0x85, 0x83, 0x56, - 0x55, 0xcf, 0x71, 0xac, 0x76, 0x45, 0x3f, 0xf4, 0x74, 0xca, 0x14, 0x1f, 0xca, 0x17, 0x05, 0x50, - 0x87, 0xd8, 0x54, 0x47, 0x7b, 0x70, 0x02, 0xb7, 0x88, 0x67, 0xb3, 0x69, 0x30, 0x07, 0xee, 0x5e, - 0xd9, 0x5a, 0xeb, 0x9c, 0x16, 0x72, 0xdf, 0x4e, 0x0b, 0x77, 0x0c, 0x93, 0xed, 0x7b, 0x75, 0xb5, - 0x41, 0x5a, 0x82, 0x53, 0x7c, 0x14, 0x69, 0xf3, 0x40, 0x63, 0x6d, 0x47, 0xa7, 0xea, 0x8e, 0xcd, - 0x3e, 0x1d, 0x17, 0xa1, 0x90, 0xb1, 0x63, 0xb3, 0x8a, 0xa8, 0xa5, 0xcc, 0xc0, 0x1b, 0xbc, 0xef, - 0x1e, 0x61, 0xd8, 0x3a, 0x8f, 0xe4, 0xc0, 0xe9, 0xc1, 0x5b, 0x63, 0x85, 0xb9, 0x0d, 0x6f, 0x25, - 0x3f, 0x84, 0x27, 0x9b, 0x95, 0xed, 0x3e, 0xd6, 0x6b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0xe9, 0xf3, 0x68, - 0xf3, 0x08, 0x7d, 0x05, 0x70, 0x2a, 0xc9, 0xf0, 0xd0, 0x7a, 0x26, 0xb8, 0x33, 0x3b, 0x95, 0x36, - 0xb2, 0x17, 0x10, 0xe2, 0x1e, 0x71, 0x71, 0x0f, 0xd0, 0x62, 0x06, 0x71, 0xf4, 0x95, 0x83, 0x3e, - 0x00, 0x78, 0x35, 0x66, 0x99, 0x68, 0x25, 0xe5, 0xf1, 0x88, 0xee, 0xe3, 0x6a, 0xa6, 0x5c, 0x21, - 0x66, 0x99, 0x8b, 0x29, 0xa3, 0x52, 0x9a, 0xe3, 0x15, 0xee, 0x60, 0x4c, 0x07, 0xdf, 0xbe, 0xb4, - 0x3a, 0xa2, 0x7b, 0xb7, 0x9a, 0x29, 0x77, 0x24, 0x1d, 0xc1, 0xae, 0x6d, 0xed, 0x76, 0x7e, 0xca, - 0xb9, 0x4e, 0x57, 0x06, 0x27, 0x5d, 0x19, 0xfc, 0xe8, 0xca, 0xe0, 0x6d, 0x4f, 0xce, 0x9d, 0xf4, - 0xe4, 0xdc, 0x97, 0x9e, 0x9c, 0x7b, 0x59, 0x8e, 0xbc, 0x17, 0x82, 0xd2, 0x45, 0x0b, 0xd7, 0x69, - 0xd8, 0xe4, 0x28, 0xa1, 0x0d, 0x7f, 0x51, 0xd4, 0x27, 0xf8, 0xdf, 0xc8, 0xf2, 0xef, 0x00, 0x00, - 0x00, 0xff, 0xff, 0xbd, 0x0f, 0x0a, 0x7d, 0xe1, 0x0a, 0x00, 0x00, + // 612 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x96, 0xcf, 0x6e, 0xd3, 0x40, + 0x10, 0xc6, 0xbd, 0x48, 0x54, 0x62, 0x7b, 0x40, 0xac, 0x5a, 0xd1, 0x9a, 0xc6, 0x29, 0xe6, 0x02, + 0x82, 0xd8, 0x4a, 0x53, 0xb5, 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 0xd1, 0xa0, 0xc8, 0x71, 0x42, 0x19, 0xd6, 0x76, 0x74, + 0x5a, 0x9b, 0xe2, 0xdf, 0x73, 0xa5, 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x81, 0x91, 0x3d, 0xae, + 0x6a, 0x0a, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -893,6 +893,7 @@ func _Query_TotalSupplyUSDX_Handler(srv interface{}, ctx context.Context, dec fu return interceptor(ctx, in, info, handler) } +var Query_serviceDesc = _Query_serviceDesc var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "kava.validatorvesting.v1beta1.Query", HandlerType: (*QueryServer)(nil),