Skip to content

Commit

Permalink
change Id to ID
Browse files Browse the repository at this point in the history
  • Loading branch information
hallazzang committed Jun 8, 2021
1 parent 89fe130 commit 76d6891
Show file tree
Hide file tree
Showing 8 changed files with 55 additions and 55 deletions.
16 changes: 8 additions & 8 deletions x/liquidity/handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func TestMsgServerCreatePool(t *testing.T) {
simapp.LiquidityKeeper.SetParams(ctx, types.DefaultParams())
params := simapp.LiquidityKeeper.GetParams(ctx)

poolTypeId := types.DefaultPoolTypeID
poolTypeID := types.DefaultPoolTypeID
addrs := app.AddTestAddrs(simapp, ctx, 3, params.PoolCreationFee)

denomA := "uETH"
Expand All @@ -45,7 +45,7 @@ func TestMsgServerCreatePool(t *testing.T) {

require.Equal(t, deposit, depositBalance)

msg := types.NewMsgCreatePool(addrs[0], poolTypeId, depositBalance)
msg := types.NewMsgCreatePool(addrs[0], poolTypeID, depositBalance)

handler := liquidity.NewHandler(simapp.LiquidityKeeper)
_, err := handler(ctx, msg)
Expand All @@ -71,7 +71,7 @@ func TestMsgServerDepositLiquidityPool(t *testing.T) {
simapp.LiquidityKeeper.SetParams(ctx, types.DefaultParams())
params := simapp.LiquidityKeeper.GetParams(ctx)

poolTypeId := types.DefaultPoolTypeID
poolTypeID := types.DefaultPoolTypeID
addrs := app.AddTestAddrs(simapp, ctx, 4, params.PoolCreationFee)

denomA := "uETH"
Expand All @@ -94,7 +94,7 @@ func TestMsgServerDepositLiquidityPool(t *testing.T) {

require.Equal(t, deposit, depositBalance)

createMsg := types.NewMsgCreatePool(addrs[0], poolTypeId, depositBalance)
createMsg := types.NewMsgCreatePool(addrs[0], poolTypeID, depositBalance)

_, err := simapp.LiquidityKeeper.CreatePool(ctx, createMsg)
require.NoError(t, err)
Expand Down Expand Up @@ -128,7 +128,7 @@ func TestMsgServerWithdrawLiquidityPool(t *testing.T) {
simapp.LiquidityKeeper.SetParams(ctx, types.DefaultParams())
params := simapp.LiquidityKeeper.GetParams(ctx)

poolTypeId := types.DefaultPoolTypeID
poolTypeID := types.DefaultPoolTypeID
addrs := app.AddTestAddrs(simapp, ctx, 3, params.PoolCreationFee)

denomA := "uETH"
Expand All @@ -144,7 +144,7 @@ func TestMsgServerWithdrawLiquidityPool(t *testing.T) {

require.Equal(t, deposit, depositBalance)

createMsg := types.NewMsgCreatePool(addrs[0], poolTypeId, depositBalance)
createMsg := types.NewMsgCreatePool(addrs[0], poolTypeID, depositBalance)

_, err := simapp.LiquidityKeeper.CreatePool(ctx, createMsg)
require.NoError(t, err)
Expand Down Expand Up @@ -187,7 +187,7 @@ func TestMsgServerGetLiquidityPoolMetadata(t *testing.T) {
simapp.LiquidityKeeper.SetParams(ctx, types.DefaultParams())
params := simapp.LiquidityKeeper.GetParams(ctx)

poolTypeId := types.DefaultPoolTypeID
poolTypeID := types.DefaultPoolTypeID
addrs := app.AddTestAddrs(simapp, ctx, 3, params.PoolCreationFee)

denomA := "uETH"
Expand All @@ -203,7 +203,7 @@ func TestMsgServerGetLiquidityPoolMetadata(t *testing.T) {

require.Equal(t, deposit, depositBalance)

msg := types.NewMsgCreatePool(addrs[0], poolTypeId, depositBalance)
msg := types.NewMsgCreatePool(addrs[0], poolTypeID, depositBalance)

handler := liquidity.NewHandler(simapp.LiquidityKeeper)
_, err := handler(ctx, msg)
Expand Down
12 changes: 6 additions & 6 deletions x/liquidity/keeper/batch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,8 @@ func TestCreateDepositWithdrawLiquidityPoolToBatch(t *testing.T) {
feePoolBalance := simapp.BankKeeper.GetAllBalances(ctx, feePoolAcc)

// Success case, create Liquidity pool
poolTypeId := types.DefaultPoolTypeID
msg := types.NewMsgCreatePool(addrs[0], poolTypeId, depositBalance)
poolTypeID := types.DefaultPoolTypeID
msg := types.NewMsgCreatePool(addrs[0], poolTypeID, depositBalance)
_, err := simapp.LiquidityKeeper.CreatePool(ctx, msg)
require.NoError(t, err)

Expand All @@ -215,13 +215,13 @@ func TestCreateDepositWithdrawLiquidityPoolToBatch(t *testing.T) {

// reset deposit balance without PoolCreationFee of pool creator
// Fail case, insufficient balances for pool creation fee case
msgAB := types.NewMsgCreatePool(addrs[0], poolTypeId, depositBalanceAB)
msgAB := types.NewMsgCreatePool(addrs[0], poolTypeID, depositBalanceAB)
app.SaveAccount(simapp, ctx, addrs[0], depositAB)
_, err = simapp.LiquidityKeeper.CreatePool(ctx, msgAB)
require.ErrorIs(t, types.ErrInsufficientPoolCreationFee, err)

// Success case, create another pool
msgAB = types.NewMsgCreatePool(addrs[0], poolTypeId, depositBalanceAB)
msgAB = types.NewMsgCreatePool(addrs[0], poolTypeID, depositBalanceAB)
app.SaveAccount(simapp, ctx, addrs[0], depositAB.Add(params.PoolCreationFee...))
_, err = simapp.LiquidityKeeper.CreatePool(ctx, msgAB)
require.NoError(t, err)
Expand Down Expand Up @@ -401,8 +401,8 @@ func TestCreateDepositWithdrawLiquidityPoolToBatch2(t *testing.T) {
require.Equal(t, deposit, depositBalance)

// create Liquidity pool
poolTypeId := types.DefaultPoolTypeID
msg := types.NewMsgCreatePool(addrs[0], poolTypeId, depositBalance)
poolTypeID := types.DefaultPoolTypeID
msg := types.NewMsgCreatePool(addrs[0], poolTypeID, depositBalance)
_, err := simapp.LiquidityKeeper.CreatePool(ctx, msg)
require.NoError(t, err)

Expand Down
42 changes: 21 additions & 21 deletions x/liquidity/keeper/liquidity_pool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func TestCreatePool(t *testing.T) {
simapp.LiquidityKeeper.SetParams(ctx, types.DefaultParams())
params := simapp.LiquidityKeeper.GetParams(ctx)

poolTypeId := types.DefaultPoolTypeID
poolTypeID := types.DefaultPoolTypeID
addrs := app.AddTestAddrs(simapp, ctx, 3, params.PoolCreationFee)

denomA := "uETH"
Expand All @@ -51,7 +51,7 @@ func TestCreatePool(t *testing.T) {

require.Equal(t, deposit, depositBalance)

msg := types.NewMsgCreatePool(addrs[0], poolTypeId, depositBalance)
msg := types.NewMsgCreatePool(addrs[0], poolTypeID, depositBalance)
_, err := simapp.LiquidityKeeper.CreatePool(ctx, msg)
require.NoError(t, err)

Expand Down Expand Up @@ -79,7 +79,7 @@ func TestPoolCreationFee(t *testing.T) {
simapp.LiquidityKeeper.SetParams(ctx, types.DefaultParams())
params := simapp.LiquidityKeeper.GetParams(ctx)

poolTypeId := types.DefaultPoolTypeID
poolTypeID := types.DefaultPoolTypeID
addrs := app.AddTestAddrs(simapp, ctx, 3, params.PoolCreationFee)

denomA := "uETH"
Expand All @@ -99,7 +99,7 @@ func TestPoolCreationFee(t *testing.T) {
params.PoolCreationFee = depositBalance
simapp.LiquidityKeeper.SetParams(ctx, params)

msg := types.NewMsgCreatePool(addrs[0], poolTypeId, depositBalance)
msg := types.NewMsgCreatePool(addrs[0], poolTypeID, depositBalance)
_, err := simapp.LiquidityKeeper.CreatePool(ctx, msg)
require.ErrorIs(t, types.ErrInsufficientPoolCreationFee, err)

Expand All @@ -108,7 +108,7 @@ func TestPoolCreationFee(t *testing.T) {
simapp.LiquidityKeeper.SetParams(ctx, params)
feePoolAcc := simapp.AccountKeeper.GetModuleAddress(distrtypes.ModuleName)
feePoolBalance := simapp.BankKeeper.GetAllBalances(ctx, feePoolAcc)
msg = types.NewMsgCreatePool(addrs[0], poolTypeId, depositBalance)
msg = types.NewMsgCreatePool(addrs[0], poolTypeID, depositBalance)
_, err = simapp.LiquidityKeeper.CreatePool(ctx, msg)
require.NoError(t, err)

Expand All @@ -123,7 +123,7 @@ func TestDepositLiquidityPool(t *testing.T) {
simapp.LiquidityKeeper.SetParams(ctx, types.DefaultParams())
params := simapp.LiquidityKeeper.GetParams(ctx)

poolTypeId := types.DefaultPoolTypeID
poolTypeID := types.DefaultPoolTypeID
addrs := app.AddTestAddrs(simapp, ctx, 4, params.PoolCreationFee)

denomA := "uETH"
Expand All @@ -146,7 +146,7 @@ func TestDepositLiquidityPool(t *testing.T) {

require.Equal(t, deposit, depositBalance)

createMsg := types.NewMsgCreatePool(addrs[0], poolTypeId, depositBalance)
createMsg := types.NewMsgCreatePool(addrs[0], poolTypeID, depositBalance)

_, err := simapp.LiquidityKeeper.CreatePool(ctx, createMsg)
require.NoError(t, err)
Expand Down Expand Up @@ -179,7 +179,7 @@ func TestReserveCoinLimit(t *testing.T) {
params.MaxReserveCoinAmount = sdk.NewInt(1000000000000)
simapp.LiquidityKeeper.SetParams(ctx, params)

poolTypeId := types.DefaultPoolTypeID
poolTypeID := types.DefaultPoolTypeID
addrs := app.AddTestAddrs(simapp, ctx, 3, params.PoolCreationFee)

denomA := "uETH"
Expand All @@ -193,7 +193,7 @@ func TestReserveCoinLimit(t *testing.T) {
depositBalance := sdk.NewCoins(depositA, depositB)
require.Equal(t, deposit, depositBalance)

msg := types.NewMsgCreatePool(addrs[0], poolTypeId, depositBalance)
msg := types.NewMsgCreatePool(addrs[0], poolTypeID, depositBalance)
_, err := simapp.LiquidityKeeper.CreatePool(ctx, msg)
require.Equal(t, types.ErrExceededReserveCoinLimit, err)

Expand Down Expand Up @@ -253,7 +253,7 @@ func TestWithdrawLiquidityPool(t *testing.T) {
simapp.LiquidityKeeper.SetParams(ctx, types.DefaultParams())
params := simapp.LiquidityKeeper.GetParams(ctx)

poolTypeId := types.DefaultPoolTypeID
poolTypeID := types.DefaultPoolTypeID
addrs := app.AddTestAddrs(simapp, ctx, 3, params.PoolCreationFee)

denomA := "uETH"
Expand All @@ -269,7 +269,7 @@ func TestWithdrawLiquidityPool(t *testing.T) {

require.Equal(t, deposit, depositBalance)

createMsg := types.NewMsgCreatePool(addrs[0], poolTypeId, depositBalance)
createMsg := types.NewMsgCreatePool(addrs[0], poolTypeID, depositBalance)

_, err := simapp.LiquidityKeeper.CreatePool(ctx, createMsg)
require.NoError(t, err)
Expand Down Expand Up @@ -341,7 +341,7 @@ func TestReinitializePool(t *testing.T) {
params.WithdrawFeeRate = sdk.ZeroDec()
simapp.LiquidityKeeper.SetParams(ctx, params)

poolTypeId := types.DefaultPoolTypeID
poolTypeID := types.DefaultPoolTypeID
addrs := app.AddTestAddrs(simapp, ctx, 3, params.PoolCreationFee)

denomA := "uETH"
Expand All @@ -357,7 +357,7 @@ func TestReinitializePool(t *testing.T) {

require.Equal(t, deposit, depositBalance)

createMsg := types.NewMsgCreatePool(addrs[0], poolTypeId, depositBalance)
createMsg := types.NewMsgCreatePool(addrs[0], poolTypeID, depositBalance)

_, err := simapp.LiquidityKeeper.CreatePool(ctx, createMsg)
require.NoError(t, err)
Expand Down Expand Up @@ -426,7 +426,7 @@ func TestReserveAccManipulation(t *testing.T) {
simapp.LiquidityKeeper.SetParams(ctx, types.DefaultParams())
params := simapp.LiquidityKeeper.GetParams(ctx)

poolTypeId := types.DefaultPoolTypeID
poolTypeID := types.DefaultPoolTypeID
addrs := app.AddTestAddrs(simapp, ctx, 3, params.PoolCreationFee)

denomA := "uETH"
Expand All @@ -452,7 +452,7 @@ func TestReserveAccManipulation(t *testing.T) {
// manipulated reserve coinA
addedDepositA := depositA.Add(manipulationReserveA1).Add(manipulationReserveA2)

createMsg := types.NewMsgCreatePool(addrs[0], poolTypeId, depositBalance)
createMsg := types.NewMsgCreatePool(addrs[0], poolTypeID, depositBalance)

_, err := simapp.LiquidityKeeper.CreatePool(ctx, createMsg)
pools := simapp.LiquidityKeeper.GetAllPools(ctx)
Expand Down Expand Up @@ -511,7 +511,7 @@ func TestGetLiquidityPoolMetadata(t *testing.T) {
simapp.LiquidityKeeper.SetParams(ctx, types.DefaultParams())
params := simapp.LiquidityKeeper.GetParams(ctx)

poolTypeId := types.DefaultPoolTypeID
poolTypeID := types.DefaultPoolTypeID
addrs := app.AddTestAddrs(simapp, ctx, 3, params.PoolCreationFee)

denomA := "uETH"
Expand All @@ -527,7 +527,7 @@ func TestGetLiquidityPoolMetadata(t *testing.T) {

require.Equal(t, deposit, depositBalance)

msg := types.NewMsgCreatePool(addrs[0], poolTypeId, depositBalance)
msg := types.NewMsgCreatePool(addrs[0], poolTypeID, depositBalance)

_, err := simapp.LiquidityKeeper.CreatePool(ctx, msg)
require.NoError(t, err)
Expand Down Expand Up @@ -563,7 +563,7 @@ func TestIsPoolCoinDenom(t *testing.T) {
simapp.LiquidityKeeper.SetParams(ctx, types.DefaultParams())
params := simapp.LiquidityKeeper.GetParams(ctx)

poolTypeId := types.DefaultPoolTypeID
poolTypeID := types.DefaultPoolTypeID
addrs := app.AddTestAddrs(simapp, ctx, 3, params.PoolCreationFee)

denomA := "denomA"
Expand All @@ -577,7 +577,7 @@ func TestIsPoolCoinDenom(t *testing.T) {
depositB := simapp.BankKeeper.GetBalance(ctx, addrs[0], denomB)
depositBalance := sdk.NewCoins(depositA, depositB)

msg := types.NewMsgCreatePool(addrs[0], poolTypeId, depositBalance)
msg := types.NewMsgCreatePool(addrs[0], poolTypeID, depositBalance)

pool, err := simapp.LiquidityKeeper.CreatePool(ctx, msg)
require.NoError(t, err)
Expand All @@ -597,7 +597,7 @@ func TestGetPoolByReserveAccIndex(t *testing.T) {
simapp.LiquidityKeeper.SetParams(ctx, types.DefaultParams())
params := simapp.LiquidityKeeper.GetParams(ctx)

poolTypeId := types.DefaultPoolTypeID
poolTypeID := types.DefaultPoolTypeID
addrs := app.AddTestAddrs(simapp, ctx, 3, params.PoolCreationFee)

denomA := "uETH"
Expand All @@ -613,7 +613,7 @@ func TestGetPoolByReserveAccIndex(t *testing.T) {

require.Equal(t, deposit, depositBalance)

msg := types.NewMsgCreatePool(addrs[0], poolTypeId, depositBalance)
msg := types.NewMsgCreatePool(addrs[0], poolTypeID, depositBalance)
pool, err := simapp.LiquidityKeeper.CreatePool(ctx, msg)
require.NoError(t, err)

Expand Down
16 changes: 8 additions & 8 deletions x/liquidity/keeper/msg_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func TestMsgCreatePool(t *testing.T) {
simapp.LiquidityKeeper.SetParams(ctx, types.DefaultParams())
params := simapp.LiquidityKeeper.GetParams(ctx)

poolTypeId := types.DefaultPoolTypeID
poolTypeID := types.DefaultPoolTypeID
addrs := app.AddTestAddrs(simapp, ctx, 3, params.PoolCreationFee)

denomA := "uETH"
Expand All @@ -35,7 +35,7 @@ func TestMsgCreatePool(t *testing.T) {

require.Equal(t, deposit, depositBalance)

msg := types.NewMsgCreatePool(addrs[0], poolTypeId, depositBalance)
msg := types.NewMsgCreatePool(addrs[0], poolTypeID, depositBalance)

_, err := simapp.LiquidityKeeper.CreatePool(ctx, msg)
require.NoError(t, err)
Expand All @@ -60,7 +60,7 @@ func TestMsgDepositLiquidityPool(t *testing.T) {
simapp.LiquidityKeeper.SetParams(ctx, types.DefaultParams())
params := simapp.LiquidityKeeper.GetParams(ctx)

poolTypeId := types.DefaultPoolTypeID
poolTypeID := types.DefaultPoolTypeID
addrs := app.AddTestAddrs(simapp, ctx, 4, params.PoolCreationFee)

denomA := "uETH"
Expand All @@ -83,7 +83,7 @@ func TestMsgDepositLiquidityPool(t *testing.T) {

require.Equal(t, deposit, depositBalance)

createMsg := types.NewMsgCreatePool(addrs[0], poolTypeId, depositBalance)
createMsg := types.NewMsgCreatePool(addrs[0], poolTypeID, depositBalance)

_, err := simapp.LiquidityKeeper.CreatePool(ctx, createMsg)
require.NoError(t, err)
Expand Down Expand Up @@ -115,7 +115,7 @@ func TestMsgWithdrawLiquidityPool(t *testing.T) {
simapp.LiquidityKeeper.SetParams(ctx, types.DefaultParams())
params := simapp.LiquidityKeeper.GetParams(ctx)

poolTypeId := types.DefaultPoolTypeID
poolTypeID := types.DefaultPoolTypeID
addrs := app.AddTestAddrs(simapp, ctx, 3, params.PoolCreationFee)

denomA := "uETH"
Expand All @@ -131,7 +131,7 @@ func TestMsgWithdrawLiquidityPool(t *testing.T) {

require.Equal(t, deposit, depositBalance)

createMsg := types.NewMsgCreatePool(addrs[0], poolTypeId, depositBalance)
createMsg := types.NewMsgCreatePool(addrs[0], poolTypeID, depositBalance)

_, err := simapp.LiquidityKeeper.CreatePool(ctx, createMsg)
require.NoError(t, err)
Expand Down Expand Up @@ -173,7 +173,7 @@ func TestMsgGetLiquidityPoolMetadata(t *testing.T) {
simapp.LiquidityKeeper.SetParams(ctx, types.DefaultParams())
params := simapp.LiquidityKeeper.GetParams(ctx)

poolTypeId := types.DefaultPoolTypeID
poolTypeID := types.DefaultPoolTypeID
addrs := app.AddTestAddrs(simapp, ctx, 3, params.PoolCreationFee)

denomA := "uETH"
Expand All @@ -189,7 +189,7 @@ func TestMsgGetLiquidityPoolMetadata(t *testing.T) {

require.Equal(t, deposit, depositBalance)

msg := types.NewMsgCreatePool(addrs[0], poolTypeId, depositBalance)
msg := types.NewMsgCreatePool(addrs[0], poolTypeID, depositBalance)

_, err := simapp.LiquidityKeeper.CreatePool(ctx, msg)
require.NoError(t, err)
Expand Down
2 changes: 1 addition & 1 deletion x/liquidity/keeper/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func (k Keeper) GetNextPoolID(ctx sdk.Context) uint64 {

bz := store.Get(types.GlobalLiquidityPoolIDKey)
if bz == nil {
// initialize the LiquidityPoolId
// initialize the LiquidityPoolID
poolID = 1
} else {
val := gogotypes.UInt64Value{}
Expand Down
4 changes: 2 additions & 2 deletions x/liquidity/keeper/store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ func TestGetAllLiquidityPoolBatchSwapMsgs(t *testing.T) {
require.Equal(t, deposit, depositBalance)

// create Liquidity pool
poolTypeId := types.DefaultPoolTypeID
msg := types.NewMsgCreatePool(addrs[0], poolTypeId, depositBalance)
poolTypeID := types.DefaultPoolTypeID
msg := types.NewMsgCreatePool(addrs[0], poolTypeID, depositBalance)
_, err := simapp.LiquidityKeeper.CreatePool(ctx, msg)
require.NoError(t, err)

Expand Down
Loading

0 comments on commit 76d6891

Please sign in to comment.