From eda2a67cd6ebb307db048ac5171d1b506edb184f Mon Sep 17 00:00:00 2001 From: Vishnu Kumavat Date: Sat, 25 Feb 2023 02:25:49 +0530 Subject: [PATCH 01/14] mint/burn mechanism added for farm coins --- .../comdex/liquidity/v1beta1/liquidity.proto | 8 +- x/liquidity/keeper/pool.go | 28 +- x/liquidity/keeper/pool_test.go | 32 ++ x/liquidity/keeper/rewards.go | 23 + x/liquidity/keeper/rewards_test.go | 35 +- x/liquidity/types/events.go | 1 + x/liquidity/types/liquidity.pb.go | 536 +++++++++++++----- x/liquidity/types/pool.go | 47 +- x/liquidity/types/request_test.go | 3 +- 9 files changed, 557 insertions(+), 156 deletions(-) diff --git a/proto/comdex/liquidity/v1beta1/liquidity.proto b/proto/comdex/liquidity/v1beta1/liquidity.proto index 633d93bb2..7b2117340 100644 --- a/proto/comdex/liquidity/v1beta1/liquidity.proto +++ b/proto/comdex/liquidity/v1beta1/liquidity.proto @@ -29,6 +29,12 @@ message Pair { uint64 app_id = 9; } +// Farm Coin defines the basic implementation and meta data for the farm token. +message FarmCoin { + string denom = 1; + uint64 decimals = 2; +} + // Pool defines a basic liquidity pool with no min-price and max-price. message Pool { uint64 id = 1; @@ -55,7 +61,7 @@ message Pool { string max_price = 12 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec"]; - + FarmCoin farm_coin = 13; } diff --git a/x/liquidity/keeper/pool.go b/x/liquidity/keeper/pool.go index 06b2431ce..06d82dbf0 100644 --- a/x/liquidity/keeper/pool.go +++ b/x/liquidity/keeper/pool.go @@ -81,6 +81,14 @@ func (k Keeper) ValidateMsgCreatePool(ctx sdk.Context, msg *types.MsgCreatePool) return sdkerrors.Wrapf(sdkerrors.ErrNotFound, "pair %d not found", msg.PairId) } + if !k.assetKeeper.HasAssetForDenom(ctx, pair.BaseCoinDenom) { + return sdkerrors.Wrapf(types.ErrAssetNotWhiteListed, "asset with denom %s is not white listed - expired pair", pair.BaseCoinDenom) + } + + if !k.assetKeeper.HasAssetForDenom(ctx, pair.QuoteCoinDenom) { + return sdkerrors.Wrapf(types.ErrAssetNotWhiteListed, "asset with denom %s is not white listed - expired pair", pair.QuoteCoinDenom) + } + params, err := k.GetGenericParams(ctx, msg.AppId) if err != nil { return sdkerrors.Wrap(err, "params retreval failed") @@ -138,9 +146,13 @@ func (k Keeper) CreatePool(ctx sdk.Context, msg *types.MsgCreatePool) (types.Poo return types.Pool{}, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, err.Error()) } + // asset existence validation in already done at this stage + baseAsset, _ := k.assetKeeper.GetAssetForDenom(ctx, pair.BaseCoinDenom) + quoteAsset, _ := k.assetKeeper.GetAssetForDenom(ctx, pair.QuoteCoinDenom) + // Create and save the new pool object. poolID := k.getNextPoolIDWithUpdate(ctx, msg.AppId) - pool := types.NewBasicPool(msg.AppId, poolID, pair.Id, msg.GetCreator()) + pool := types.NewBasicPool(msg.AppId, poolID, pair.Id, msg.GetCreator(), baseAsset, quoteAsset) k.SetPool(ctx, pool) k.SetPoolByReserveIndex(ctx, pool) k.SetPoolsByPairIndex(ctx, pool) @@ -244,6 +256,14 @@ func (k Keeper) ValidateMsgCreateRangedPool(ctx sdk.Context, msg *types.MsgCreat return sdkerrors.Wrapf(sdkerrors.ErrNotFound, "pair %d not found", msg.PairId) } + if !k.assetKeeper.HasAssetForDenom(ctx, pair.BaseCoinDenom) { + return sdkerrors.Wrapf(types.ErrAssetNotWhiteListed, "asset with denom %s is not white listed - expired pair", pair.BaseCoinDenom) + } + + if !k.assetKeeper.HasAssetForDenom(ctx, pair.QuoteCoinDenom) { + return sdkerrors.Wrapf(types.ErrAssetNotWhiteListed, "asset with denom %s is not white listed - expired pair", pair.QuoteCoinDenom) + } + for _, coin := range msg.DepositCoins { if coin.Denom != pair.BaseCoinDenom && coin.Denom != pair.QuoteCoinDenom { return sdkerrors.Wrapf(types.ErrInvalidCoinDenom, "coin denom %s is not in the pair", coin.Denom) @@ -289,9 +309,13 @@ func (k Keeper) CreateRangedPool(ctx sdk.Context, msg *types.MsgCreateRangedPool return types.Pool{}, types.ErrInsufficientDepositAmount } + // asset existence validation in already done at this stage + baseAsset, _ := k.assetKeeper.GetAssetForDenom(ctx, pair.BaseCoinDenom) + quoteAsset, _ := k.assetKeeper.GetAssetForDenom(ctx, pair.QuoteCoinDenom) + // Create and save the new pool object. poolId := k.getNextPoolIDWithUpdate(ctx, msg.AppId) - pool := types.NewRangedPool(msg.AppId, poolId, pair.Id, msg.GetCreator(), msg.MinPrice, msg.MaxPrice) + pool := types.NewRangedPool(msg.AppId, poolId, pair.Id, msg.GetCreator(), msg.MinPrice, msg.MaxPrice, baseAsset, quoteAsset) k.SetPool(ctx, pool) k.SetPoolByReserveIndex(ctx, pool) k.SetPoolsByPairIndex(ctx, pool) diff --git a/x/liquidity/keeper/pool_test.go b/x/liquidity/keeper/pool_test.go index 95b29ef1f..f32a4d43b 100644 --- a/x/liquidity/keeper/pool_test.go +++ b/x/liquidity/keeper/pool_test.go @@ -158,6 +158,10 @@ func (s *KeeperTestSuite) TestCreatePool() { AppId: 1, Type: types.PoolTypeBasic, Creator: addr1.String(), + FarmCoin: &types.FarmCoin{ + Denom: "farm1-3", + Decimals: uint64(1000000000000), + }, }, QueryResponseIndex: 2, // poolID 1 & 2 are taken by above two cases, since the test environment is non atomic. QueryResponse: &types.Pool{ @@ -171,6 +175,10 @@ func (s *KeeperTestSuite) TestCreatePool() { AppId: 1, Type: types.PoolTypeBasic, Creator: addr1.String(), + FarmCoin: &types.FarmCoin{ + Denom: "farm1-3", + Decimals: uint64(1000000000000), + }, }, AvailableBalance: sdk.NewCoins(sdk.NewCoin("pool1-3", amm.InitialPoolCoinSupply(sdk.NewInt(1000000000000), sdk.NewInt(1000000000000)))), }, @@ -202,6 +210,10 @@ func (s *KeeperTestSuite) TestCreatePool() { AppId: 2, Type: types.PoolTypeBasic, Creator: addr1.String(), + FarmCoin: &types.FarmCoin{ + Denom: "farm2-1", + Decimals: uint64(1000000000000), + }, }, QueryResponseIndex: 0, QueryResponse: &types.Pool{ @@ -215,6 +227,10 @@ func (s *KeeperTestSuite) TestCreatePool() { AppId: 2, Type: types.PoolTypeBasic, Creator: addr1.String(), + FarmCoin: &types.FarmCoin{ + Denom: "farm2-1", + Decimals: uint64(1000000000000), + }, }, AvailableBalance: sdk.NewCoins(sdk.NewCoin("pool1-3", amm.InitialPoolCoinSupply(sdk.NewInt(1000000000000), sdk.NewInt(1000000000000))), sdk.NewCoin("pool2-1", amm.InitialPoolCoinSupply(sdk.NewInt(1000000000000), sdk.NewInt(1000000000000)))), }, @@ -1093,6 +1109,10 @@ func (s *KeeperTestSuite) TestCreateRangedPool() { AppId: 1, Type: types.PoolTypeRanged, Creator: addr1.String(), + FarmCoin: &types.FarmCoin{ + Denom: "farm1-3", + Decimals: uint64(1000000000000), + }, }, QueryResponseIndex: 2, // poolID 1 & 2 are taken by above two cases, since the test environment is non atomic. QueryResponse: &types.Pool{ @@ -1106,6 +1126,10 @@ func (s *KeeperTestSuite) TestCreateRangedPool() { AppId: 1, Type: types.PoolTypeBasic, Creator: addr1.String(), + FarmCoin: &types.FarmCoin{ + Denom: "farm1-3", + Decimals: uint64(1000000000000), + }, }, AvailableBalance: sdk.NewCoins( sdk.NewCoin("pool1-3", amm.InitialPoolCoinSupply(sdk.NewInt(1000000000000), sdk.NewInt(1000000000000))), @@ -1131,6 +1155,10 @@ func (s *KeeperTestSuite) TestCreateRangedPool() { AppId: 2, Type: types.PoolTypeRanged, Creator: addr1.String(), + FarmCoin: &types.FarmCoin{ + Denom: "farm2-1", + Decimals: uint64(1000000000000), + }, }, QueryResponseIndex: 0, QueryResponse: &types.Pool{ @@ -1144,6 +1172,10 @@ func (s *KeeperTestSuite) TestCreateRangedPool() { AppId: 2, Type: types.PoolTypeRanged, Creator: addr1.String(), + FarmCoin: &types.FarmCoin{ + Denom: "farm2-1", + Decimals: uint64(1000000000000), + }, }, AvailableBalance: sdk.NewCoins( sdk.NewCoin("pool2-1", amm.InitialPoolCoinSupply(sdk.NewInt(1000000000000), sdk.NewInt(1000000000000))), diff --git a/x/liquidity/keeper/rewards.go b/x/liquidity/keeper/rewards.go index 1d7f7756b..5c9fa77eb 100644 --- a/x/liquidity/keeper/rewards.go +++ b/x/liquidity/keeper/rewards.go @@ -313,6 +313,16 @@ func (k Keeper) Farm(ctx sdk.Context, msg *types.MsgFarm) error { return err } + // mint farm coin for 1:1 representation of pool coin and send it to the farmer. + pool, _ := k.GetPool(ctx, msg.AppId, msg.PoolId) + farmCoin := sdk.NewCoin(pool.FarmCoin.Denom, msg.FarmingPoolCoin.Amount) + if err := k.bankKeeper.MintCoins(ctx, types.ModuleName, sdk.NewCoins(farmCoin)); err != nil { + return err + } + if err := k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, farmer, sdk.NewCoins(farmCoin)); err != nil { + return err + } + queuedFarmer, found := k.GetQueuedFarmer(ctx, msg.AppId, msg.PoolId, farmer) if !found { @@ -338,6 +348,7 @@ func (k Keeper) Farm(ctx sdk.Context, msg *types.MsgFarm) error { sdk.NewAttribute(types.AttributeKeyPoolID, strconv.FormatUint(msg.PoolId, 10)), sdk.NewAttribute(types.AttributeKeyPoolCoin, msg.FarmingPoolCoin.String()), sdk.NewAttribute(types.AttributeKeyTimeStamp, ctx.BlockTime().String()), + sdk.NewAttribute(types.AttributeKeyFarmCoin, farmCoin.String()), ), }) @@ -430,6 +441,17 @@ func (k Keeper) Unfarm(ctx sdk.Context, msg *types.MsgUnfarm) error { activeFarmer.FarmedPoolCoin.Amount = activeFarmer.FarmedPoolCoin.Amount.Sub(msg.UnfarmingPoolCoin.Amount) } + // take back farm coin from the farmer which was minted for 1:1 representation of pool coin and burn it. + pool, _ := k.GetPool(ctx, msg.AppId, msg.PoolId) + farmCoin := sdk.NewCoin(pool.FarmCoin.Denom, unFarmingCoin.Amount) + err = k.bankKeeper.SendCoinsFromAccountToModule(ctx, farmer, types.ModuleName, sdk.NewCoins(farmCoin)) + if err != nil { + return err + } + if err := k.bankKeeper.BurnCoins(ctx, types.ModuleName, sdk.NewCoins(farmCoin)); err != nil { + return err + } + err = k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, farmer, sdk.NewCoins(unFarmingCoin)) if err != nil { return err @@ -454,6 +476,7 @@ func (k Keeper) Unfarm(ctx sdk.Context, msg *types.MsgUnfarm) error { sdk.NewAttribute(types.AttributeKeyPoolID, strconv.FormatUint(msg.PoolId, 10)), sdk.NewAttribute(types.AttributeKeyPoolCoin, msg.UnfarmingPoolCoin.String()), sdk.NewAttribute(types.AttributeKeyTimeStamp, ctx.BlockTime().String()), + sdk.NewAttribute(types.AttributeKeyFarmCoin, farmCoin.String()), ), }) diff --git a/x/liquidity/keeper/rewards_test.go b/x/liquidity/keeper/rewards_test.go index 526a01e3a..04f67bfc8 100644 --- a/x/liquidity/keeper/rewards_test.go +++ b/x/liquidity/keeper/rewards_test.go @@ -84,35 +84,35 @@ func (s *KeeperTestSuite) TestFarm() { Name: "success liquidity provider 1 app1", Msg: *types.NewMsgFarm(appID1, pool.Id, liquidityProvider1, utils.ParseCoin("5252000000pool1-1")), ExpErr: nil, - AvailableBalance: utils.ParseCoins("4748000000pool1-1,10000000000pool2-1"), + AvailableBalance: utils.ParseCoins("4748000000pool1-1,10000000000pool2-1,5252000000farm1-1"), QueueLenght: 1, }, { Name: "success liquidity provider 2 app1", Msg: *types.NewMsgFarm(appID1, pool.Id, liquidityProvider2, utils.ParseCoin("6934000000pool1-1")), ExpErr: nil, - AvailableBalance: utils.ParseCoins("3065999999pool1-1,9999999999pool2-1"), + AvailableBalance: utils.ParseCoins("3065999999pool1-1,9999999999pool2-1,6934000000farm1-1"), QueueLenght: 1, }, { Name: "success liquidity provider 1 app1 re-add", Msg: *types.NewMsgFarm(appID1, pool.Id, liquidityProvider1, utils.ParseCoin("23000000pool1-1")), ExpErr: nil, - AvailableBalance: utils.ParseCoins("4725000000pool1-1,10000000000pool2-1"), + AvailableBalance: utils.ParseCoins("4725000000pool1-1,10000000000pool2-1,5275000000farm1-1"), QueueLenght: 2, }, { Name: "success liquidity provider 1 app2", Msg: *types.NewMsgFarm(appID2, pool2.Id, liquidityProvider1, utils.ParseCoin("123000000pool2-1")), ExpErr: nil, - AvailableBalance: utils.ParseCoins("4725000000pool1-1,9877000000pool2-1"), + AvailableBalance: utils.ParseCoins("4725000000pool1-1,9877000000pool2-1,5275000000farm1-1,123000000farm2-1"), QueueLenght: 1, }, { Name: "success liquidity provider 2 app2", Msg: *types.NewMsgFarm(appID2, pool2.Id, liquidityProvider2, utils.ParseCoin("546000000pool2-1")), ExpErr: nil, - AvailableBalance: utils.ParseCoins("3065999999pool1-1,9453999999pool2-1"), + AvailableBalance: utils.ParseCoins("3065999999pool1-1,9453999999pool2-1,6934000000farm1-1,546000000farm2-1"), QueueLenght: 1, }, } @@ -199,6 +199,7 @@ func (s *KeeperTestSuite) TestUnfarm() { msg := types.NewMsgFarm(appID1, pool.Id, liquidityProvider1, utils.ParseCoin("10000000000pool1-1")) err := s.keeper.Farm(s.ctx, msg) s.Require().NoError(err) + s.Require().True(utils.ParseCoins("10000000000farm1-1").IsEqual(s.getBalances(liquidityProvider1))) queuedFarmers := s.keeper.GetAllQueuedFarmers(s.ctx, appID1, pool.Id) s.Require().Len(queuedFarmers, 1) @@ -243,7 +244,7 @@ func (s *KeeperTestSuite) TestUnfarm() { Name: "success partial unlock", Msg: *types.NewMsgUnfarm(appID1, pool.Id, liquidityProvider1, utils.ParseCoin("5000000000pool1-1")), ExpErr: nil, - AvailableBalance: utils.ParseCoins("5000000000pool1-1"), + AvailableBalance: utils.ParseCoins("5000000000pool1-1,5000000000farm1-1"), }, { Name: "success full unlock", @@ -297,6 +298,7 @@ func (s *KeeperTestSuite) TestUnfarmTwo() { msg := types.NewMsgFarm(appID1, pool.Id, liquidityProvider1, utils.ParseCoin("10000000pool1-1")) err := s.keeper.Farm(s.ctx, msg) s.Require().NoError(err) + s.Require().True(utils.ParseCoins("9990000000pool1-1,10000000farm1-1").IsEqual(s.getBalances(liquidityProvider1))) s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(time.Hour * 1)) // farm 2, queue size 2 @@ -304,6 +306,7 @@ func (s *KeeperTestSuite) TestUnfarmTwo() { msg = types.NewMsgFarm(appID1, pool.Id, liquidityProvider1, utils.ParseCoin("20000000pool1-1")) err = s.keeper.Farm(s.ctx, msg) s.Require().NoError(err) + s.Require().True(utils.ParseCoins("9970000000pool1-1,30000000farm1-1").IsEqual(s.getBalances(liquidityProvider1))) s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(time.Hour * 1)) // farm 3, queue size 3 @@ -311,6 +314,7 @@ func (s *KeeperTestSuite) TestUnfarmTwo() { msg = types.NewMsgFarm(appID1, pool.Id, liquidityProvider1, utils.ParseCoin("30000000pool1-1")) err = s.keeper.Farm(s.ctx, msg) s.Require().NoError(err) + s.Require().True(utils.ParseCoins("9940000000pool1-1,60000000farm1-1").IsEqual(s.getBalances(liquidityProvider1))) s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(time.Hour * 1)) // farm 4, queue size 4 @@ -318,6 +322,7 @@ func (s *KeeperTestSuite) TestUnfarmTwo() { msg = types.NewMsgFarm(appID1, pool.Id, liquidityProvider1, utils.ParseCoin("40000000pool1-1")) err = s.keeper.Farm(s.ctx, msg) s.Require().NoError(err) + s.Require().True(utils.ParseCoins("9900000000pool1-1,100000000farm1-1").IsEqual(s.getBalances(liquidityProvider1))) s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(time.Hour * 1)) // farm 5, queue size 5 @@ -325,6 +330,7 @@ func (s *KeeperTestSuite) TestUnfarmTwo() { msg = types.NewMsgFarm(appID1, pool.Id, liquidityProvider1, utils.ParseCoin("50000000pool1-1")) err = s.keeper.Farm(s.ctx, msg) s.Require().NoError(err) + s.Require().True(utils.ParseCoins("9850000000pool1-1,150000000farm1-1").IsEqual(s.getBalances(liquidityProvider1))) queuedFarmers := s.keeper.GetAllQueuedFarmers(s.ctx, appID1, pool.Id) s.Require().Len(queuedFarmers, 1) @@ -348,6 +354,7 @@ func (s *KeeperTestSuite) TestUnfarmTwo() { s.Require().Len(queuedFarmers[0].QueudCoins, 5) s.Require().Equal(utils.ParseCoin("45000000pool1-1").Denom, queuedFarmers[0].QueudCoins[4].FarmedPoolCoin.Denom) s.Require().Equal(utils.ParseCoin("45000000pool1-1").Amount, queuedFarmers[0].QueudCoins[4].FarmedPoolCoin.Amount) + s.Require().True(utils.ParseCoins("9855000000pool1-1,145000000farm1-1").IsEqual(s.getBalances(liquidityProvider1))) // unfarming small portions, below unlock removes token from most recently added queue // unlock is done from a single latest object in a queue since this object itself can satisfy the unlock requirement, @@ -361,6 +368,7 @@ func (s *KeeperTestSuite) TestUnfarmTwo() { s.Require().Len(queuedFarmers[0].QueudCoins, 5) s.Require().Equal(utils.ParseCoin("34000000pool1-1").Denom, queuedFarmers[0].QueudCoins[4].FarmedPoolCoin.Denom) s.Require().Equal(utils.ParseCoin("34000000pool1-1").Amount, queuedFarmers[0].QueudCoins[4].FarmedPoolCoin.Amount) + s.Require().True(utils.ParseCoins("9866000000pool1-1,134000000farm1-1").IsEqual(s.getBalances(liquidityProvider1))) // below case will delete the most recent object from queue since it satisfies the required unlock condition // here the unlock is being satisfied from the two queue objects, most recent one gets deleted after it fullfills all @@ -375,6 +383,7 @@ func (s *KeeperTestSuite) TestUnfarmTwo() { s.Require().Len(queuedFarmers[0].QueudCoins, 4) s.Require().Equal(utils.ParseCoin("36000000pool1-1").Denom, queuedFarmers[0].QueudCoins[3].FarmedPoolCoin.Denom) s.Require().Equal(utils.ParseCoin("36000000pool1-1").Amount, queuedFarmers[0].QueudCoins[3].FarmedPoolCoin.Amount) + s.Require().True(utils.ParseCoins("9904000000pool1-1,96000000farm1-1").IsEqual(s.getBalances(liquidityProvider1))) // similarly below cases are followed as above // Before - SortedByTimeFarmQueue -> [36000000pool1-1, 30000000pool1-1, 20000000pool1-1, 10000000pool1-1] @@ -387,6 +396,7 @@ func (s *KeeperTestSuite) TestUnfarmTwo() { s.Require().Len(queuedFarmers[0].QueudCoins, 3) s.Require().Equal(utils.ParseCoin("30000000pool1-1").Denom, queuedFarmers[0].QueudCoins[2].FarmedPoolCoin.Denom) s.Require().Equal(utils.ParseCoin("30000000pool1-1").Amount, queuedFarmers[0].QueudCoins[2].FarmedPoolCoin.Amount) + s.Require().True(utils.ParseCoins("9940000000pool1-1,60000000farm1-1").IsEqual(s.getBalances(liquidityProvider1))) // Before - SortedByTimeFarmQueue -> [30000000pool1-1, 20000000pool1-1, 10000000pool1-1] // After - SortedByTimeFarmQueue -> [10000000pool1-1] @@ -398,6 +408,7 @@ func (s *KeeperTestSuite) TestUnfarmTwo() { s.Require().Len(queuedFarmers[0].QueudCoins, 1) s.Require().Equal(utils.ParseCoin("10000000pool1-1").Denom, queuedFarmers[0].QueudCoins[0].FarmedPoolCoin.Denom) s.Require().Equal(utils.ParseCoin("10000000pool1-1").Amount, queuedFarmers[0].QueudCoins[0].FarmedPoolCoin.Amount) + s.Require().True(utils.ParseCoins("9990000000pool1-1,10000000farm1-1").IsEqual(s.getBalances(liquidityProvider1))) // lp1 trying to unfarm more than farmed msgUnlock = types.NewMsgUnfarm(appID1, pool.Id, liquidityProvider1, utils.ParseCoin("11000000pool1-1")) @@ -410,6 +421,7 @@ func (s *KeeperTestSuite) TestUnfarmTwo() { msg = types.NewMsgFarm(appID1, pool.Id, liquidityProvider1, utils.ParseCoin("69000000pool1-1")) err = s.keeper.Farm(s.ctx, msg) s.Require().NoError(err) + s.Require().True(utils.ParseCoins("9921000000pool1-1,79000000farm1-1").IsEqual(s.getBalances(liquidityProvider1))) // marking oldest farmed object as valid and dequing it, assuming queue duration is satisfied s.ctx = s.ctx.WithBlockTime(currentTime.Add(types.DefaultFarmingQueueDuration).Add(time.Second * 10)) @@ -439,6 +451,7 @@ func (s *KeeperTestSuite) TestUnfarmTwo() { s.Require().Len(afs, 1) s.Require().Equal(utils.ParseCoin("9000000pool1-1").Denom, afs[0].FarmedPoolCoin.Denom) s.Require().Equal(utils.ParseCoin("9000000pool1-1").Amount, afs[0].FarmedPoolCoin.Amount) + s.Require().True(utils.ParseCoins("9991000000pool1-1,9000000farm1-1").IsEqual(s.getBalances(liquidityProvider1))) // unlocking all farmed tokens // Before @@ -463,6 +476,7 @@ func (s *KeeperTestSuite) TestUnfarmTwo() { msg = types.NewMsgFarm(appID1, pool.Id, liquidityProvider1, utils.ParseCoin("11000000pool1-1")) err = s.keeper.Farm(s.ctx, msg) s.Require().NoError(err) + s.Require().True(utils.ParseCoins("9989000000pool1-1,11000000farm1-1").IsEqual(s.getBalances(liquidityProvider1))) s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(time.Hour * 1)) // SortedByTimeFarmQueue -> [12000000pool1-1, 11000000pool1-1] @@ -470,6 +484,7 @@ func (s *KeeperTestSuite) TestUnfarmTwo() { msg = types.NewMsgFarm(appID1, pool.Id, liquidityProvider1, utils.ParseCoin("12000000pool1-1")) err = s.keeper.Farm(s.ctx, msg) s.Require().NoError(err) + s.Require().True(utils.ParseCoins("9977000000pool1-1,23000000farm1-1").IsEqual(s.getBalances(liquidityProvider1))) s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(time.Hour * 1)) // SortedByTimeFarmQueue -> [13000000pool1-1, 12000000pool1-1, 11000000pool1-1] @@ -477,6 +492,7 @@ func (s *KeeperTestSuite) TestUnfarmTwo() { msg = types.NewMsgFarm(appID1, pool.Id, liquidityProvider1, utils.ParseCoin("13000000pool1-1")) err = s.keeper.Farm(s.ctx, msg) s.Require().NoError(err) + s.Require().True(utils.ParseCoins("9964000000pool1-1,36000000farm1-1").IsEqual(s.getBalances(liquidityProvider1))) // marking oldest farmed object as valid and dequing it, assuming queue duration is satisfied s.ctx = s.ctx.WithBlockTime(currentTime.Add(types.DefaultFarmingQueueDuration).Add(time.Second * 10)) @@ -506,12 +522,14 @@ func (s *KeeperTestSuite) TestUnfarmTwo() { s.Require().Len(afs, 1) s.Require().Equal(utils.ParseCoin("10000000pool1-1").Denom, afs[0].FarmedPoolCoin.Denom) s.Require().Equal(utils.ParseCoin("10000000pool1-1").Amount, afs[0].FarmedPoolCoin.Amount) + s.Require().True(utils.ParseCoins("9990000000pool1-1,10000000farm1-1").IsEqual(s.getBalances(liquidityProvider1))) // SortedByTimeFarmQueue -> [ (l2) 7000000pool1-1] // ActiveFarmedTokens -> [ (l1) 10000000pool1-1] msg = types.NewMsgFarm(appID1, pool.Id, liquidityProvider2, utils.ParseCoin("7000000pool1-1")) err = s.keeper.Farm(s.ctx, msg) s.Require().NoError(err) + s.Require().True(utils.ParseCoins("9992999999pool1-1,7000000farm1-1").IsEqual(s.getBalances(liquidityProvider2))) qf, found := s.keeper.GetQueuedFarmer(s.ctx, appID1, pool.Id, liquidityProvider2) afs = s.keeper.GetAllActiveFarmers(s.ctx, appID1, pool.Id) @@ -524,6 +542,7 @@ func (s *KeeperTestSuite) TestUnfarmTwo() { msg = types.NewMsgFarm(appID1, pool.Id, liquidityProvider1, utils.ParseCoin("9000000pool1-1")) err = s.keeper.Farm(s.ctx, msg) s.Require().NoError(err) + s.Require().True(utils.ParseCoins("9981000000pool1-1,19000000farm1-1").IsEqual(s.getBalances(liquidityProvider1))) afs = s.keeper.GetAllActiveFarmers(s.ctx, appID1, pool.Id) qfs = s.keeper.GetAllQueuedFarmers(s.ctx, appID1, pool.Id) @@ -539,6 +558,7 @@ func (s *KeeperTestSuite) TestUnfarmTwo() { msgUnlock = types.NewMsgUnfarm(appID1, pool.Id, liquidityProvider1, utils.ParseCoin("3000000pool1-1")) err = s.keeper.Unfarm(s.ctx, msgUnlock) s.Require().NoError(err) + s.Require().True(utils.ParseCoins("9984000000pool1-1,16000000farm1-1").IsEqual(s.getBalances(liquidityProvider1))) afs = s.keeper.GetAllActiveFarmers(s.ctx, appID1, pool.Id) qfs = s.keeper.GetAllQueuedFarmers(s.ctx, appID1, pool.Id) s.Require().Len(qfs, 2) @@ -559,6 +579,7 @@ func (s *KeeperTestSuite) TestUnfarmTwo() { msgUnlock = types.NewMsgUnfarm(appID1, pool.Id, liquidityProvider1, utils.ParseCoin("8000000pool1-1")) err = s.keeper.Unfarm(s.ctx, msgUnlock) s.Require().NoError(err) + s.Require().True(utils.ParseCoins("9992000000pool1-1,8000000farm1-1").IsEqual(s.getBalances(liquidityProvider1))) afs = s.keeper.GetAllActiveFarmers(s.ctx, appID1, pool.Id) qfs = s.keeper.GetAllQueuedFarmers(s.ctx, appID1, pool.Id) s.Require().Len(qfs, 2) @@ -589,11 +610,13 @@ func (s *KeeperTestSuite) TestUnfarmTwo() { msgUnlock = types.NewMsgUnfarm(appID1, pool.Id, liquidityProvider1, utils.ParseCoin("8000000pool1-1")) err = s.keeper.Unfarm(s.ctx, msgUnlock) s.Require().NoError(err) + s.Require().True(utils.ParseCoins("10000000000pool1-1").IsEqual(s.getBalances(liquidityProvider1))) // total unlock - lp2 msgUnlock = types.NewMsgUnfarm(appID1, pool.Id, liquidityProvider2, utils.ParseCoin("7000000pool1-1")) err = s.keeper.Unfarm(s.ctx, msgUnlock) s.Require().NoError(err) + s.Require().True(utils.ParseCoins("9999999999pool1-1").IsEqual(s.getBalances(liquidityProvider2))) // SortedByTimeFarmQueue -> [] // ActiveFarmedTokens -> [ (l1) 0pool1-1, (l2) 0pool1-1] diff --git a/x/liquidity/types/events.go b/x/liquidity/types/events.go index b02180c1b..79ef091f3 100644 --- a/x/liquidity/types/events.go +++ b/x/liquidity/types/events.go @@ -59,4 +59,5 @@ const ( AttributeKeyTimeStamp = "timestamp" AttributeKeyMatchedAmount = "matched_amount" AttributeKeyPaidCoin = "paid_coin" + AttributeKeyFarmCoin = "farm_coin" ) diff --git a/x/liquidity/types/liquidity.pb.go b/x/liquidity/types/liquidity.pb.go index fb267252b..bd6118881 100644 --- a/x/liquidity/types/liquidity.pb.go +++ b/x/liquidity/types/liquidity.pb.go @@ -287,6 +287,45 @@ func (m *Pair) XXX_DiscardUnknown() { var xxx_messageInfo_Pair proto.InternalMessageInfo +// Farm Coin defines the basic implementation and meta data for the farm token. +type FarmCoin struct { + Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` + Decimals uint64 `protobuf:"varint,2,opt,name=decimals,proto3" json:"decimals,omitempty"` +} + +func (m *FarmCoin) Reset() { *m = FarmCoin{} } +func (m *FarmCoin) String() string { return proto.CompactTextString(m) } +func (*FarmCoin) ProtoMessage() {} +func (*FarmCoin) Descriptor() ([]byte, []int) { + return fileDescriptor_579dcc42096fa86d, []int{1} +} +func (m *FarmCoin) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *FarmCoin) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_FarmCoin.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *FarmCoin) XXX_Merge(src proto.Message) { + xxx_messageInfo_FarmCoin.Merge(m, src) +} +func (m *FarmCoin) XXX_Size() int { + return m.Size() +} +func (m *FarmCoin) XXX_DiscardUnknown() { + xxx_messageInfo_FarmCoin.DiscardUnknown(m) +} + +var xxx_messageInfo_FarmCoin proto.InternalMessageInfo + // Pool defines a basic liquidity pool with no min-price and max-price. type Pool struct { Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` @@ -301,13 +340,14 @@ type Pool struct { Creator string `protobuf:"bytes,10,opt,name=creator,proto3" json:"creator,omitempty"` MinPrice *github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,11,opt,name=min_price,json=minPrice,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"min_price,omitempty"` MaxPrice *github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,12,opt,name=max_price,json=maxPrice,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"max_price,omitempty"` + FarmCoin *FarmCoin `protobuf:"bytes,13,opt,name=farm_coin,json=farmCoin,proto3" json:"farm_coin,omitempty"` } func (m *Pool) Reset() { *m = Pool{} } func (m *Pool) String() string { return proto.CompactTextString(m) } func (*Pool) ProtoMessage() {} func (*Pool) Descriptor() ([]byte, []int) { - return fileDescriptor_579dcc42096fa86d, []int{1} + return fileDescriptor_579dcc42096fa86d, []int{2} } func (m *Pool) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -359,7 +399,7 @@ func (m *DepositRequest) Reset() { *m = DepositRequest{} } func (m *DepositRequest) String() string { return proto.CompactTextString(m) } func (*DepositRequest) ProtoMessage() {} func (*DepositRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_579dcc42096fa86d, []int{2} + return fileDescriptor_579dcc42096fa86d, []int{3} } func (m *DepositRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -410,7 +450,7 @@ func (m *WithdrawRequest) Reset() { *m = WithdrawRequest{} } func (m *WithdrawRequest) String() string { return proto.CompactTextString(m) } func (*WithdrawRequest) ProtoMessage() {} func (*WithdrawRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_579dcc42096fa86d, []int{3} + return fileDescriptor_579dcc42096fa86d, []int{4} } func (m *WithdrawRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -473,7 +513,7 @@ func (m *Order) Reset() { *m = Order{} } func (m *Order) String() string { return proto.CompactTextString(m) } func (*Order) ProtoMessage() {} func (*Order) Descriptor() ([]byte, []int) { - return fileDescriptor_579dcc42096fa86d, []int{4} + return fileDescriptor_579dcc42096fa86d, []int{5} } func (m *Order) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -515,7 +555,7 @@ func (m *MMOrderIndex) Reset() { *m = MMOrderIndex{} } func (m *MMOrderIndex) String() string { return proto.CompactTextString(m) } func (*MMOrderIndex) ProtoMessage() {} func (*MMOrderIndex) Descriptor() ([]byte, []int) { - return fileDescriptor_579dcc42096fa86d, []int{5} + return fileDescriptor_579dcc42096fa86d, []int{6} } func (m *MMOrderIndex) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -555,7 +595,7 @@ func (m *ActiveFarmer) Reset() { *m = ActiveFarmer{} } func (m *ActiveFarmer) String() string { return proto.CompactTextString(m) } func (*ActiveFarmer) ProtoMessage() {} func (*ActiveFarmer) Descriptor() ([]byte, []int) { - return fileDescriptor_579dcc42096fa86d, []int{6} + return fileDescriptor_579dcc42096fa86d, []int{7} } func (m *ActiveFarmer) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -593,7 +633,7 @@ func (m *QueuedCoin) Reset() { *m = QueuedCoin{} } func (m *QueuedCoin) String() string { return proto.CompactTextString(m) } func (*QueuedCoin) ProtoMessage() {} func (*QueuedCoin) Descriptor() ([]byte, []int) { - return fileDescriptor_579dcc42096fa86d, []int{7} + return fileDescriptor_579dcc42096fa86d, []int{8} } func (m *QueuedCoin) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -633,7 +673,7 @@ func (m *QueuedFarmer) Reset() { *m = QueuedFarmer{} } func (m *QueuedFarmer) String() string { return proto.CompactTextString(m) } func (*QueuedFarmer) ProtoMessage() {} func (*QueuedFarmer) Descriptor() ([]byte, []int) { - return fileDescriptor_579dcc42096fa86d, []int{8} + return fileDescriptor_579dcc42096fa86d, []int{9} } func (m *QueuedFarmer) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -670,6 +710,7 @@ func init() { proto.RegisterEnum("comdex.liquidity.v1beta1.OrderStatus", OrderStatus_name, OrderStatus_value) proto.RegisterEnum("comdex.liquidity.v1beta1.AddressType", AddressType_name, AddressType_value) proto.RegisterType((*Pair)(nil), "comdex.liquidity.v1beta1.Pair") + proto.RegisterType((*FarmCoin)(nil), "comdex.liquidity.v1beta1.FarmCoin") proto.RegisterType((*Pool)(nil), "comdex.liquidity.v1beta1.Pool") proto.RegisterType((*DepositRequest)(nil), "comdex.liquidity.v1beta1.DepositRequest") proto.RegisterType((*WithdrawRequest)(nil), "comdex.liquidity.v1beta1.WithdrawRequest") @@ -685,123 +726,126 @@ func init() { } var fileDescriptor_579dcc42096fa86d = []byte{ - // 1850 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x58, 0xcd, 0x73, 0x1a, 0xc9, - 0x15, 0xd7, 0x00, 0x42, 0xf0, 0x90, 0x10, 0x6e, 0x4b, 0x36, 0xc2, 0x6b, 0x44, 0x91, 0xac, 0x4d, - 0xb9, 0x6a, 0xc1, 0xc6, 0x49, 0x9c, 0x8f, 0xdd, 0x4d, 0xf1, 0x31, 0xda, 0x9d, 0x0a, 0x08, 0x3c, - 0xa0, 0x8a, 0x9d, 0x0b, 0x35, 0x9a, 0x69, 0xa1, 0xae, 0x05, 0x66, 0x3c, 0xd3, 0xd8, 0xd2, 0x2d, - 0x97, 0x54, 0x52, 0x9c, 0xf6, 0x94, 0x1b, 0x97, 0xe4, 0x96, 0xbf, 0x20, 0xd7, 0xdc, 0x7c, 0xc8, - 0x61, 0x4f, 0xa9, 0x54, 0x2a, 0xa5, 0x4d, 0xec, 0xff, 0x20, 0xc7, 0x54, 0xaa, 0x92, 0xea, 0xee, - 0x99, 0x61, 0x06, 0x4b, 0x91, 0xbc, 0x6b, 0x9f, 0xa4, 0x7e, 0xfd, 0x7e, 0xef, 0xfb, 0xf5, 0x7b, - 0x03, 0x94, 0x74, 0x73, 0x6c, 0xe0, 0x93, 0xca, 0x88, 0x3c, 0x9b, 0x12, 0x83, 0xd0, 0xd3, 0xca, - 0xf3, 0x07, 0x87, 0x98, 0x6a, 0x0f, 0x16, 0x94, 0xb2, 0x65, 0x9b, 0xd4, 0x44, 0x59, 0xc1, 0x59, - 0x5e, 0xd0, 0x5d, 0xce, 0xdc, 0xd6, 0xd0, 0x1c, 0x9a, 0x9c, 0xa9, 0xc2, 0xfe, 0x13, 0xfc, 0xb9, - 0xbc, 0x6e, 0x3a, 0x63, 0xd3, 0xa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0xf2, - 0x8b, 0x87, 0xa1, 0x59, 0xc4, 0x1e, 0xe5, 0x8f, 0xcc, 0xa3, 0x23, 0xa2, 0x13, 0x6d, 0xe4, 0x9e, - 0x2b, 0xc1, 0x5f, 0xd0, 0xf8, 0x70, 0x3a, 0x8c, 0xf3, 0x59, 0xf3, 0xf0, 0x7f, 0x01, 0x00, 0x00, - 0xff, 0xff, 0x8d, 0x52, 0xec, 0x37, 0x62, 0x13, 0x00, 0x00, + // 1899 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x58, 0xcd, 0x6f, 0xdb, 0xc8, + 0x15, 0x37, 0x25, 0x59, 0x96, 0x9e, 0x6c, 0x59, 0x99, 0xd8, 0x89, 0xa2, 0x6c, 0x64, 0x41, 0xed, + 0x26, 0x46, 0x80, 0x95, 0x12, 0xa7, 0x6d, 0xfa, 0x91, 0xdd, 0x85, 0x3e, 0xe8, 0x5d, 0xa2, 0x96, + 0xad, 0x50, 0x32, 0x9a, 0xf4, 0x22, 0xd0, 0xe4, 0x48, 0x1e, 0xac, 0x28, 0x32, 0xe4, 0x28, 0xb1, + 0x6f, 0xbd, 0x14, 0x28, 0x74, 0xda, 0x53, 0x6f, 0xba, 0xb4, 0xb7, 0xfe, 0x05, 0xbd, 0xf6, 0x96, + 0x43, 0x0f, 0x7b, 0x2a, 0x8a, 0xa2, 0xc8, 0xb6, 0xc9, 0x7f, 0xd0, 0x63, 0x51, 0xa0, 0xc5, 0x7c, + 0x90, 0xa2, 0x14, 0x7b, 0xed, 0x6c, 0xb3, 0x27, 0x6b, 0xde, 0xbc, 0xdf, 0xfb, 0x7e, 0xf3, 0x1e, + 0x0d, 0xdb, 0xa6, 0x63, 0x5b, 0xf8, 0xa4, 0x3a, 0x24, 0xcf, 0xc6, 0xc4, 0x22, 0xf4, 0xb4, 0xfa, + 0xfc, 0xfe, 0x11, 0xa6, 0xc6, 0xfd, 0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, 0x3c, 0x44, + 0x9f, 0xab, 0xf2, 0x5f, 0x92, 0xb0, 0xcc, 0xe7, 0xdc, 0xe5, 0x5f, 0xf5, 0x0b, 0xa2, 0x9f, 0x87, + 0x15, 0x3e, 0x4c, 0xc3, 0xd0, 0x07, 0x47, 0xb4, 0x0b, 0x69, 0x8b, 0x78, 0xd8, 0xa4, 0xc4, 0x11, + 0x71, 0xcf, 0xee, 0x6c, 0x9f, 0xef, 0x06, 0xb7, 0xaa, 0x19, 0xf0, 0xeb, 0x33, 0x28, 0xfa, 0x04, + 0xc0, 0xe9, 0xf7, 0xb1, 0x27, 0x12, 0x98, 0xbc, 0x5c, 0x02, 0xd3, 0x1c, 0xc2, 0x33, 0xf8, 0x18, + 0x36, 0x3c, 0x6c, 0x1b, 0x64, 0x44, 0x46, 0x83, 0x5e, 0x44, 0xd2, 0x25, 0x5b, 0x04, 0x85, 0xe0, + 0x83, 0x50, 0x64, 0x13, 0xd6, 0x3c, 0x6c, 0x62, 0xf2, 0x5c, 0x76, 0x39, 0x0f, 0xf2, 0x25, 0x64, + 0xad, 0x06, 0x28, 0x29, 0x65, 0x59, 0x3c, 0xce, 0x69, 0xfe, 0x38, 0x57, 0x18, 0xcb, 0x3b, 0x3c, + 0xd0, 0x02, 0x8c, 0x76, 0x21, 0x69, 0xd8, 0xce, 0x78, 0x44, 0xc5, 0x20, 0x79, 0x27, 0x31, 0xda, + 0x88, 0xea, 0x12, 0x8d, 0x0e, 0x20, 0xe3, 0xb8, 0x78, 0xd4, 0x93, 0xc2, 0x32, 0xdf, 0x4a, 0x18, + 0x30, 0x11, 0x35, 0x21, 0xf0, 0x06, 0xa4, 0xc2, 0xa5, 0x67, 0x95, 0x97, 0xd4, 0xca, 0x91, 0xdc, + 0x76, 0x6a, 0x90, 0xc6, 0x27, 0x2e, 0xf1, 0x70, 0xcf, 0xa0, 0x72, 0xa2, 0x14, 0x2a, 0x62, 0x9b, + 0xac, 0x04, 0xdb, 0x64, 0xa5, 0x1b,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20, 0x49, 0xa7, 0x90, + 0x91, 0xff, 0x62, 0xe0, 0xef, 0xc4, 0x7d, 0xd8, 0xac, 0x35, 0x9b, 0xba, 0xda, 0xe9, 0x88, 0xee, + 0x7c, 0xb0, 0xd3, 0xab, 0x3f, 0xed, 0xaa, 0x9d, 0xdc, 0x92, 0x90, 0x13, 0xe1, 0x7d, 0xb0, 0x53, + 0x3f, 0xa5, 0xd8, 0x7f, 0x0b, 0xb2, 0x73, 0x4f, 0x42, 0x94, 0xb7, 0x20, 0x3b, 0xf7, 0x38, 0x44, + 0xa8, 0xae, 0x3f, 0x7e, 0xf9, 0xcf, 0xe2, 0xd2, 0xcb, 0xd7, 0x45, 0xe5, 0xab, 0xd7, 0x45, 0xe5, + 0x1f, 0xaf, 0x8b, 0xca, 0x97, 0x6f, 0x8a, 0x4b, 0x5f, 0xbd, 0x29, 0x2e, 0xfd, 0xf5, 0x4d, 0x71, + 0xe9, 0x97, 0x0f, 0xe6, 0x66, 0x11, 0x7b, 0x94, 0x3f, 0x72, 0xfa, 0x7d, 0x62, 0x12, 0x63, 0x28, + 0xcf, 0xd5, 0xe8, 0x3f, 0xf0, 0xf8, 0x70, 0x3a, 0x4a, 0xf2, 0x59, 0xf3, 0xe0, 0x7f, 0x01, 0x00, + 0x00, 0xff, 0xff, 0x19, 0x9f, 0x01, 0xff, 0xe1, 0x13, 0x00, 0x00, } func (m *Pair) Marshal() (dAtA []byte, err error) { @@ -887,6 +931,41 @@ func (m *Pair) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *FarmCoin) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *FarmCoin) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *FarmCoin) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Decimals != 0 { + i = encodeVarintLiquidity(dAtA, i, uint64(m.Decimals)) + i-- + dAtA[i] = 0x10 + } + if len(m.Denom) > 0 { + i -= len(m.Denom) + copy(dAtA[i:], m.Denom) + i = encodeVarintLiquidity(dAtA, i, uint64(len(m.Denom))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func (m *Pool) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -907,6 +986,18 @@ func (m *Pool) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.FarmCoin != nil { + { + size, err := m.FarmCoin.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintLiquidity(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x6a + } if m.MaxPrice != nil { { size := m.MaxPrice.Size() @@ -1204,12 +1295,12 @@ func (m *Order) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x70 } - n3, err3 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.ExpireAt, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.ExpireAt):]) - if err3 != nil { - return 0, err3 + n4, err4 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.ExpireAt, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.ExpireAt):]) + if err4 != nil { + return 0, err4 } - i -= n3 - i = encodeVarintLiquidity(dAtA, i, uint64(n3)) + i -= n4 + i = encodeVarintLiquidity(dAtA, i, uint64(n4)) i-- dAtA[i] = 0x6a if m.BatchId != 0 { @@ -1328,20 +1419,20 @@ func (m *MMOrderIndex) MarshalToSizedBuffer(dAtA []byte) (int, error) { var l int _ = l if len(m.OrderIds) > 0 { - dAtA8 := make([]byte, len(m.OrderIds)*10) - var j7 int + dAtA9 := make([]byte, len(m.OrderIds)*10) + var j8 int for _, num := range m.OrderIds { for num >= 1<<7 { - dAtA8[j7] = uint8(uint64(num)&0x7f | 0x80) + dAtA9[j8] = uint8(uint64(num)&0x7f | 0x80) num >>= 7 - j7++ + j8++ } - dAtA8[j7] = uint8(num) - j7++ + dAtA9[j8] = uint8(num) + j8++ } - i -= j7 - copy(dAtA[i:], dAtA8[:j7]) - i = encodeVarintLiquidity(dAtA, i, uint64(j7)) + i -= j8 + copy(dAtA[i:], dAtA9[:j8]) + i = encodeVarintLiquidity(dAtA, i, uint64(j8)) i-- dAtA[i] = 0x22 } @@ -1435,12 +1526,12 @@ func (m *QueuedCoin) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - n10, err10 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.CreatedAt, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.CreatedAt):]) - if err10 != nil { - return 0, err10 + n11, err11 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.CreatedAt, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.CreatedAt):]) + if err11 != nil { + return 0, err11 } - i -= n10 - i = encodeVarintLiquidity(dAtA, i, uint64(n10)) + i -= n11 + i = encodeVarintLiquidity(dAtA, i, uint64(n11)) i-- dAtA[i] = 0x12 { @@ -1562,6 +1653,22 @@ func (m *Pair) Size() (n int) { return n } +func (m *FarmCoin) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Denom) + if l > 0 { + n += 1 + l + sovLiquidity(uint64(l)) + } + if m.Decimals != 0 { + n += 1 + sovLiquidity(uint64(m.Decimals)) + } + return n +} + func (m *Pool) Size() (n int) { if m == nil { return 0 @@ -1609,6 +1716,10 @@ func (m *Pool) Size() (n int) { l = m.MaxPrice.Size() n += 1 + l + sovLiquidity(uint64(l)) } + if m.FarmCoin != nil { + l = m.FarmCoin.Size() + n += 1 + l + sovLiquidity(uint64(l)) + } return n } @@ -2122,6 +2233,107 @@ func (m *Pair) Unmarshal(dAtA []byte) error { } return nil } +func (m *FarmCoin) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: FarmCoin: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: FarmCoin: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Denom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthLiquidity + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthLiquidity + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Denom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Decimals", wireType) + } + m.Decimals = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Decimals |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipLiquidity(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthLiquidity + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *Pool) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2453,6 +2665,42 @@ func (m *Pool) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 13: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FarmCoin", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthLiquidity + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthLiquidity + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.FarmCoin == nil { + m.FarmCoin = &FarmCoin{} + } + if err := m.FarmCoin.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipLiquidity(dAtA[iNdEx:]) diff --git a/x/liquidity/types/pool.go b/x/liquidity/types/pool.go index 5323d147f..64d3ff301 100644 --- a/x/liquidity/types/pool.go +++ b/x/liquidity/types/pool.go @@ -2,6 +2,7 @@ package types import ( "fmt" + math "math" "regexp" "strconv" "strings" @@ -10,6 +11,7 @@ import ( "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" + assettypes "github.com/comdex-official/comdex/x/asset/types" "github.com/comdex-official/comdex/x/liquidity/amm" ) @@ -21,6 +23,7 @@ var ( _ amm.Orderer = (*PoolOrderer)(nil) poolCoinDenomRegexp = regexp.MustCompile(`^pool([1-9]-[1-9]\d*)$`) + farmCoinDenomRegexp = regexp.MustCompile(`^pool([1-9]-[1-9]\d*)$`) ) type PoolTokenDeserializerKit struct { @@ -63,8 +66,40 @@ func ParsePoolCoinDenom(denom string) (appID, poolID uint64, err error) { return appID, poolID, nil } +// FarmCoinDenom returns a unique farm coin denom for a pool. +func FarmCoinDenom(appID, poolID uint64) string { + return fmt.Sprintf("farm%d-%d", appID, poolID) +} + +// ParseFarmCoinDenom parses a farm coin denom and returns the app and pool id. +func ParseFarmCoinDenom(denom string) (appID, poolID uint64, err error) { + chunks := farmCoinDenomRegexp.FindStringSubmatch(denom) + if len(chunks) == 0 { + return 0, 0, fmt.Errorf("%s is not a pool coin denom", denom) + } + appID, err = strconv.ParseUint(strings.Split(chunks[1], "-")[0], 10, 64) + if err != nil { + return 0, 0, fmt.Errorf("parse app id: %w", err) + } + poolID, err = strconv.ParseUint(strings.Split(chunks[1], "-")[1], 10, 64) + if err != nil { + return 0, 0, fmt.Errorf("parse pool id: %w", err) + } + return appID, poolID, nil +} + +// FarmCoinDenom returns a unique farm coin denom for a pool. +func FarmCoinDecimals(baseDecimals, quoteDecimals uint64) uint64 { + baseExponent := math.Log10(float64(baseDecimals)) + quoteExponent := math.Log10(float64(quoteDecimals)) + if baseExponent+quoteExponent >= 18 { + return uint64(math.Pow10(18)) + } + return uint64(math.Pow10(int(baseExponent + quoteExponent))) +} + // NewBasicPool returns a new basic pool object. -func NewBasicPool(appID, id, pairID uint64, creator sdk.AccAddress) Pool { +func NewBasicPool(appID, id, pairID uint64, creator sdk.AccAddress, baseAsset, quoteAsset assettypes.Asset) Pool { return Pool{ Type: PoolTypeBasic, Id: id, @@ -76,11 +111,15 @@ func NewBasicPool(appID, id, pairID uint64, creator sdk.AccAddress) Pool { LastWithdrawRequestId: 0, Disabled: false, AppId: appID, + FarmCoin: &FarmCoin{ + Denom: FarmCoinDenom(appID, id), + Decimals: FarmCoinDecimals(baseAsset.Decimals.Uint64(), quoteAsset.Decimals.Uint64()), + }, } } // NewRangedPool returns a new ranged pool object. -func NewRangedPool(appID, id, pairId uint64, creator sdk.AccAddress, minPrice, maxPrice sdk.Dec) Pool { +func NewRangedPool(appID, id, pairId uint64, creator sdk.AccAddress, minPrice, maxPrice sdk.Dec, baseAsset, quoteAsset assettypes.Asset) Pool { return Pool{ Type: PoolTypeRanged, Id: id, @@ -94,6 +133,10 @@ func NewRangedPool(appID, id, pairId uint64, creator sdk.AccAddress, minPrice, m LastWithdrawRequestId: 0, Disabled: false, AppId: appID, + FarmCoin: &FarmCoin{ + Denom: FarmCoinDenom(appID, id), + Decimals: FarmCoinDecimals(baseAsset.Decimals.Uint64(), quoteAsset.Decimals.Uint64()), + }, } } diff --git a/x/liquidity/types/request_test.go b/x/liquidity/types/request_test.go index 7638d959d..a68395e29 100644 --- a/x/liquidity/types/request_test.go +++ b/x/liquidity/types/request_test.go @@ -9,6 +9,7 @@ import ( "github.com/tendermint/tendermint/crypto" utils "github.com/comdex-official/comdex/types" + assettypes "github.com/comdex-official/comdex/x/asset/types" "github.com/comdex-official/comdex/x/liquidity/types" ) @@ -110,7 +111,7 @@ func TestDepositRequest_Validate(t *testing.T) { }, } { t.Run(tc.name, func(t *testing.T) { - pool := types.NewBasicPool(1, 1, 1, testAddr) + pool := types.NewBasicPool(1, 1, 1, testAddr, assettypes.Asset{Decimals: sdk.NewInt(1000000)}, assettypes.Asset{Decimals: sdk.NewInt(1000000)}) depositor := sdk.AccAddress(crypto.AddressHash([]byte("depositor"))) msg := types.NewMsgDeposit(1, depositor, 1, utils.ParseCoins("1000000denom1,1000000denom2")) req := types.NewDepositRequest(msg, pool, 1, 1) From f842ab547a018948a56f058632f2813d000fb92a Mon Sep 17 00:00:00 2001 From: Vishnu Kumavat Date: Sat, 25 Feb 2023 04:45:58 +0530 Subject: [PATCH 02/14] coin denom change in message unfarm --- x/liquidity/handler_test.go | 2 +- x/liquidity/keeper/rewards.go | 18 +++++----- x/liquidity/keeper/rewards_test.go | 56 +++++++++++++++--------------- 3 files changed, 38 insertions(+), 38 deletions(-) diff --git a/x/liquidity/handler_test.go b/x/liquidity/handler_test.go index 51c1a205c..1eb7983fd 100644 --- a/x/liquidity/handler_test.go +++ b/x/liquidity/handler_test.go @@ -385,7 +385,7 @@ func (s *ModuleTestSuite) TestMsgUnfarm() { s.Require().Equal(queuedFarmer.QueudCoins[0].FarmedPoolCoin.Denom, "pool1-1") s.Require().Equal(queuedFarmer.QueudCoins[0].FarmedPoolCoin.Amount, sdk.NewInt(5000000000)) - msgUnlock := types.NewMsgUnfarm(appID1, pool.Id, liquidityProvider1, utils.ParseCoin("5000000000pool1-1")) + msgUnlock := types.NewMsgUnfarm(appID1, pool.Id, liquidityProvider1, utils.ParseCoin("5000000000farm1-1")) _, err = handler(s.ctx, msgUnlock) s.Require().NoError(err) diff --git a/x/liquidity/keeper/rewards.go b/x/liquidity/keeper/rewards.go index 5c9fa77eb..0862910fc 100644 --- a/x/liquidity/keeper/rewards.go +++ b/x/liquidity/keeper/rewards.go @@ -371,8 +371,8 @@ func (k Keeper) ValidateMsgUnfarm(ctx sdk.Context, msg *types.MsgUnfarm) (sdk.Ac return nil, sdkerrors.Wrapf(types.ErrInvalidPoolID, "no pool exists with id : %d", msg.PoolId) } - if msg.UnfarmingPoolCoin.Denom != pool.PoolCoinDenom { - return nil, sdkerrors.Wrapf(types.ErrWrongPoolCoinDenom, "expected pool coin denom %s, found %s", pool.PoolCoinDenom, msg.UnfarmingPoolCoin.Denom) + if msg.UnfarmingPoolCoin.Denom != pool.FarmCoin.Denom { + return nil, sdkerrors.Wrapf(types.ErrWrongPoolCoinDenom, "expected farm coin denom %s, found %s", pool.FarmCoin.Denom, msg.UnfarmingPoolCoin.Denom) } if !msg.UnfarmingPoolCoin.Amount.IsPositive() { return nil, sdkerrors.Wrapf(types.ErrorNotPositiveAmont, "pool coin amount should be positive") @@ -442,17 +442,17 @@ func (k Keeper) Unfarm(ctx sdk.Context, msg *types.MsgUnfarm) error { } // take back farm coin from the farmer which was minted for 1:1 representation of pool coin and burn it. - pool, _ := k.GetPool(ctx, msg.AppId, msg.PoolId) - farmCoin := sdk.NewCoin(pool.FarmCoin.Denom, unFarmingCoin.Amount) - err = k.bankKeeper.SendCoinsFromAccountToModule(ctx, farmer, types.ModuleName, sdk.NewCoins(farmCoin)) + err = k.bankKeeper.SendCoinsFromAccountToModule(ctx, farmer, types.ModuleName, sdk.NewCoins(unFarmingCoin)) if err != nil { return err } - if err := k.bankKeeper.BurnCoins(ctx, types.ModuleName, sdk.NewCoins(farmCoin)); err != nil { + if err := k.bankKeeper.BurnCoins(ctx, types.ModuleName, sdk.NewCoins(unFarmingCoin)); err != nil { return err } - err = k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, farmer, sdk.NewCoins(unFarmingCoin)) + pool, _ := k.GetPool(ctx, msg.AppId, msg.PoolId) + poolCoin := sdk.NewCoin(pool.PoolCoinDenom, unFarmingCoin.Amount) + err = k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, farmer, sdk.NewCoins(poolCoin)) if err != nil { return err } @@ -474,9 +474,9 @@ func (k Keeper) Unfarm(ctx sdk.Context, msg *types.MsgUnfarm) error { sdk.NewAttribute(types.AttributeKeyFarmer, msg.Farmer), sdk.NewAttribute(types.AttributeKeyAppID, strconv.FormatUint(msg.AppId, 10)), sdk.NewAttribute(types.AttributeKeyPoolID, strconv.FormatUint(msg.PoolId, 10)), - sdk.NewAttribute(types.AttributeKeyPoolCoin, msg.UnfarmingPoolCoin.String()), + sdk.NewAttribute(types.AttributeKeyPoolCoin, poolCoin.String()), sdk.NewAttribute(types.AttributeKeyTimeStamp, ctx.BlockTime().String()), - sdk.NewAttribute(types.AttributeKeyFarmCoin, farmCoin.String()), + sdk.NewAttribute(types.AttributeKeyFarmCoin, unFarmingCoin.String()), ), }) diff --git a/x/liquidity/keeper/rewards_test.go b/x/liquidity/keeper/rewards_test.go index 04f67bfc8..5dc1fc84f 100644 --- a/x/liquidity/keeper/rewards_test.go +++ b/x/liquidity/keeper/rewards_test.go @@ -212,43 +212,43 @@ func (s *KeeperTestSuite) TestUnfarm() { }{ { Name: "error app id invalid", - Msg: *types.NewMsgUnfarm(69, pool.Id, liquidityProvider1, utils.ParseCoin("699000000pool1-1")), + Msg: *types.NewMsgUnfarm(69, pool.Id, liquidityProvider1, utils.ParseCoin("699000000farm1-1")), ExpErr: sdkerrors.Wrapf(types.ErrInvalidAppID, "app id %d not found", 69), AvailableBalance: sdk.Coins{}, }, { Name: "error pool id invalid", - Msg: *types.NewMsgUnfarm(appID1, 69, liquidityProvider1, utils.ParseCoin("699000000pool1-1")), + Msg: *types.NewMsgUnfarm(appID1, 69, liquidityProvider1, utils.ParseCoin("699000000farm1-1")), ExpErr: sdkerrors.Wrapf(types.ErrInvalidPoolID, "no pool exists with id : %d", 69), AvailableBalance: sdk.Coins{}, }, { Name: "error pool denom invalid", Msg: *types.NewMsgUnfarm(appID1, pool.Id, liquidityProvider1, utils.ParseCoin("699000000pool1-2")), - ExpErr: sdkerrors.Wrapf(types.ErrWrongPoolCoinDenom, "expected pool coin denom %s, found pool1-2", pool.PoolCoinDenom), + ExpErr: sdkerrors.Wrapf(types.ErrWrongPoolCoinDenom, "expected farm coin denom %s, found pool1-2", pool.FarmCoin.Denom), AvailableBalance: sdk.Coins{}, }, { Name: "error farm not found", - Msg: *types.NewMsgUnfarm(appID1, pool2.Id, liquidityProvider1, utils.ParseCoin("699000000pool1-2")), + Msg: *types.NewMsgUnfarm(appID1, pool2.Id, liquidityProvider1, utils.ParseCoin("699000000farm1-2")), ExpErr: sdkerrors.Wrapf(types.ErrorFarmerNotFound, "no active farm found for given pool id %d", pool2.Id), AvailableBalance: sdk.Coins{}, }, { Name: "error insufficient farmed amounts", - Msg: *types.NewMsgUnfarm(appID1, pool.Id, liquidityProvider1, utils.ParseCoin("100000000000pool1-1")), - ExpErr: sdkerrors.Wrapf(types.ErrInvalidUnfarmAmount, "farmed pool coin amount 10000000000pool1-1 smaller than requested unfarming pool coin amount 100000000000pool1-1"), + Msg: *types.NewMsgUnfarm(appID1, pool.Id, liquidityProvider1, utils.ParseCoin("100000000000farm1-1")), + ExpErr: sdkerrors.Wrapf(types.ErrInvalidUnfarmAmount, "farmed pool coin amount 10000000000farm1-1 smaller than requested unfarming pool coin amount 100000000000farm1-1"), AvailableBalance: sdk.Coins{}, }, { Name: "success partial unlock", - Msg: *types.NewMsgUnfarm(appID1, pool.Id, liquidityProvider1, utils.ParseCoin("5000000000pool1-1")), + Msg: *types.NewMsgUnfarm(appID1, pool.Id, liquidityProvider1, utils.ParseCoin("5000000000farm1-1")), ExpErr: nil, AvailableBalance: utils.ParseCoins("5000000000pool1-1,5000000000farm1-1"), }, { Name: "success full unlock", - Msg: *types.NewMsgUnfarm(appID1, pool.Id, liquidityProvider1, utils.ParseCoin("5000000000pool1-1")), + Msg: *types.NewMsgUnfarm(appID1, pool.Id, liquidityProvider1, utils.ParseCoin("5000000000farm1-1")), ExpErr: nil, AvailableBalance: utils.ParseCoins("10000000000pool1-1"), }, @@ -337,16 +337,16 @@ func (s *KeeperTestSuite) TestUnfarmTwo() { s.Require().Len(queuedFarmers[0].QueudCoins, 5) // lp1 trying to unfarm more than farmed - msgUnlock := types.NewMsgUnfarm(appID1, pool.Id, liquidityProvider1, utils.ParseCoin("160000000pool1-1")) + msgUnlock := types.NewMsgUnfarm(appID1, pool.Id, liquidityProvider1, utils.ParseCoin("160000000farm1-1")) err = s.keeper.Unfarm(s.ctx, msgUnlock) s.Require().Error(err) - s.Require().EqualError(err, sdkerrors.Wrapf(types.ErrInvalidUnfarmAmount, "farmed pool coin amount 150000000pool1-1 smaller than requested unfarming pool coin amount 160000000pool1-1").Error()) + s.Require().EqualError(err, sdkerrors.Wrapf(types.ErrInvalidUnfarmAmount, "farmed pool coin amount 150000000farm1-1 smaller than requested unfarming pool coin amount 160000000farm1-1").Error()) // unfarming small portions, below unlock removes token from most recently added queue // unlock is done from a single latest object in a queue since this object itself can satisfy the unlock requirement, // Before - SortedByTimeFarmQueue -> [50000000pool1-1, 40000000pool1-1, 30000000pool1-1, 20000000pool1-1, 10000000pool1-1] // After - SortedByTimeFarmQueue -> [45000000pool1-1, 40000000pool1-1, 30000000pool1-1, 20000000pool1-1, 10000000pool1-1] - msgUnlock = types.NewMsgUnfarm(appID1, pool.Id, liquidityProvider1, utils.ParseCoin("5000000pool1-1")) + msgUnlock = types.NewMsgUnfarm(appID1, pool.Id, liquidityProvider1, utils.ParseCoin("5000000farm1-1")) err = s.keeper.Unfarm(s.ctx, msgUnlock) s.Require().NoError(err) queuedFarmers = s.keeper.GetAllQueuedFarmers(s.ctx, appID1, pool.Id) @@ -360,7 +360,7 @@ func (s *KeeperTestSuite) TestUnfarmTwo() { // unlock is done from a single latest object in a queue since this object itself can satisfy the unlock requirement, // Before - SortedByTimeFarmQueue -> [45000000pool1-1, 40000000pool1-1, 30000000pool1-1, 20000000pool1-1, 10000000pool1-1] // After - SortedByTimeFarmQueue -> [34000000pool1-1, 40000000pool1-1, 30000000pool1-1, 20000000pool1-1, 10000000pool1-1] - msgUnlock = types.NewMsgUnfarm(appID1, pool.Id, liquidityProvider1, utils.ParseCoin("11000000pool1-1")) + msgUnlock = types.NewMsgUnfarm(appID1, pool.Id, liquidityProvider1, utils.ParseCoin("11000000farm1-1")) err = s.keeper.Unfarm(s.ctx, msgUnlock) s.Require().NoError(err) queuedFarmers = s.keeper.GetAllQueuedFarmers(s.ctx, appID1, pool.Id) @@ -375,7 +375,7 @@ func (s *KeeperTestSuite) TestUnfarmTwo() { // of its token for unlocking, and the remaining unlock tokens are fullfilled from 2nd most recent queue object // Before - SortedByTimeFarmQueue -> [34000000pool1-1, 40000000pool1-1, 30000000pool1-1, 20000000pool1-1, 10000000pool1-1] // After - SortedByTimeFarmQueue -> [36000000pool1-1, 30000000pool1-1, 20000000pool1-1, 10000000pool1-1] - msgUnlock = types.NewMsgUnfarm(appID1, pool.Id, liquidityProvider1, utils.ParseCoin("38000000pool1-1")) + msgUnlock = types.NewMsgUnfarm(appID1, pool.Id, liquidityProvider1, utils.ParseCoin("38000000farm1-1")) err = s.keeper.Unfarm(s.ctx, msgUnlock) s.Require().NoError(err) queuedFarmers = s.keeper.GetAllQueuedFarmers(s.ctx, appID1, pool.Id) @@ -388,7 +388,7 @@ func (s *KeeperTestSuite) TestUnfarmTwo() { // similarly below cases are followed as above // Before - SortedByTimeFarmQueue -> [36000000pool1-1, 30000000pool1-1, 20000000pool1-1, 10000000pool1-1] // After - SortedByTimeFarmQueue -> [30000000pool1-1, 20000000pool1-1, 10000000pool1-1] - msgUnlock = types.NewMsgUnfarm(appID1, pool.Id, liquidityProvider1, utils.ParseCoin("36000000pool1-1")) + msgUnlock = types.NewMsgUnfarm(appID1, pool.Id, liquidityProvider1, utils.ParseCoin("36000000farm1-1")) err = s.keeper.Unfarm(s.ctx, msgUnlock) s.Require().NoError(err) queuedFarmers = s.keeper.GetAllQueuedFarmers(s.ctx, appID1, pool.Id) @@ -400,7 +400,7 @@ func (s *KeeperTestSuite) TestUnfarmTwo() { // Before - SortedByTimeFarmQueue -> [30000000pool1-1, 20000000pool1-1, 10000000pool1-1] // After - SortedByTimeFarmQueue -> [10000000pool1-1] - msgUnlock = types.NewMsgUnfarm(appID1, pool.Id, liquidityProvider1, utils.ParseCoin("50000000pool1-1")) + msgUnlock = types.NewMsgUnfarm(appID1, pool.Id, liquidityProvider1, utils.ParseCoin("50000000farm1-1")) err = s.keeper.Unfarm(s.ctx, msgUnlock) s.Require().NoError(err) queuedFarmers = s.keeper.GetAllQueuedFarmers(s.ctx, appID1, pool.Id) @@ -411,10 +411,10 @@ func (s *KeeperTestSuite) TestUnfarmTwo() { s.Require().True(utils.ParseCoins("9990000000pool1-1,10000000farm1-1").IsEqual(s.getBalances(liquidityProvider1))) // lp1 trying to unfarm more than farmed - msgUnlock = types.NewMsgUnfarm(appID1, pool.Id, liquidityProvider1, utils.ParseCoin("11000000pool1-1")) + msgUnlock = types.NewMsgUnfarm(appID1, pool.Id, liquidityProvider1, utils.ParseCoin("11000000farm1-1")) err = s.keeper.Unfarm(s.ctx, msgUnlock) s.Require().Error(err) - s.Require().EqualError(err, sdkerrors.Wrapf(types.ErrInvalidUnfarmAmount, "farmed pool coin amount 10000000pool1-1 smaller than requested unfarming pool coin amount 11000000pool1-1").Error()) + s.Require().EqualError(err, sdkerrors.Wrapf(types.ErrInvalidUnfarmAmount, "farmed pool coin amount 10000000farm1-1 smaller than requested unfarming pool coin amount 11000000farm1-1").Error()) s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(time.Hour * 1)) // SortedByTimeFarmQueue -> [69000000pool1-1, 10000000pool1-1] @@ -442,7 +442,7 @@ func (s *KeeperTestSuite) TestUnfarmTwo() { // After // SortedByTimeFarmQueue -> [] // ActiveFarmedTokens -> [9000000pool1-1] - msgUnlock = types.NewMsgUnfarm(appID1, pool.Id, liquidityProvider1, utils.ParseCoin("70000000pool1-1")) + msgUnlock = types.NewMsgUnfarm(appID1, pool.Id, liquidityProvider1, utils.ParseCoin("70000000farm1-1")) err = s.keeper.Unfarm(s.ctx, msgUnlock) s.Require().NoError(err) afs = s.keeper.GetAllActiveFarmers(s.ctx, appID1, pool.Id) @@ -460,7 +460,7 @@ func (s *KeeperTestSuite) TestUnfarmTwo() { // After // SortedByTimeFarmQueue -> [] // ActiveFarmedTokens -> [] - msgUnlock = types.NewMsgUnfarm(appID1, pool.Id, liquidityProvider1, utils.ParseCoin("9000000pool1-1")) + msgUnlock = types.NewMsgUnfarm(appID1, pool.Id, liquidityProvider1, utils.ParseCoin("9000000farm1-1")) err = s.keeper.Unfarm(s.ctx, msgUnlock) s.Require().NoError(err) afs = s.keeper.GetAllActiveFarmers(s.ctx, appID1, pool.Id) @@ -513,7 +513,7 @@ func (s *KeeperTestSuite) TestUnfarmTwo() { // After // SortedByTimeFarmQueue -> [] // ActiveFarmedTokens -> [10000000pool1-1] - msgUnlock = types.NewMsgUnfarm(appID1, pool.Id, liquidityProvider1, utils.ParseCoin("26000000pool1-1")) + msgUnlock = types.NewMsgUnfarm(appID1, pool.Id, liquidityProvider1, utils.ParseCoin("26000000farm1-1")) err = s.keeper.Unfarm(s.ctx, msgUnlock) s.Require().NoError(err) afs = s.keeper.GetAllActiveFarmers(s.ctx, appID1, pool.Id) @@ -555,7 +555,7 @@ func (s *KeeperTestSuite) TestUnfarmTwo() { // After // SortedByTimeFarmQueue -> [(l2) 7000000pool1-1, (l1) 6000000pool1-1] // ActiveFarmedTokens -> [ (l1) 10000000pool1-1] - msgUnlock = types.NewMsgUnfarm(appID1, pool.Id, liquidityProvider1, utils.ParseCoin("3000000pool1-1")) + msgUnlock = types.NewMsgUnfarm(appID1, pool.Id, liquidityProvider1, utils.ParseCoin("3000000farm1-1")) err = s.keeper.Unfarm(s.ctx, msgUnlock) s.Require().NoError(err) s.Require().True(utils.ParseCoins("9984000000pool1-1,16000000farm1-1").IsEqual(s.getBalances(liquidityProvider1))) @@ -576,7 +576,7 @@ func (s *KeeperTestSuite) TestUnfarmTwo() { // After // SortedByTimeFarmQueue -> [(l2) 7000000pool1-1] // ActiveFarmedTokens -> [ (l1) 8000000pool1-1] - msgUnlock = types.NewMsgUnfarm(appID1, pool.Id, liquidityProvider1, utils.ParseCoin("8000000pool1-1")) + msgUnlock = types.NewMsgUnfarm(appID1, pool.Id, liquidityProvider1, utils.ParseCoin("8000000farm1-1")) err = s.keeper.Unfarm(s.ctx, msgUnlock) s.Require().NoError(err) s.Require().True(utils.ParseCoins("9992000000pool1-1,8000000farm1-1").IsEqual(s.getBalances(liquidityProvider1))) @@ -607,13 +607,13 @@ func (s *KeeperTestSuite) TestUnfarmTwo() { s.Require().Equal(utils.ParseCoin("7000000pool1-1").Amount, afs[1].FarmedPoolCoin.Amount) // total unlock - lp1 - msgUnlock = types.NewMsgUnfarm(appID1, pool.Id, liquidityProvider1, utils.ParseCoin("8000000pool1-1")) + msgUnlock = types.NewMsgUnfarm(appID1, pool.Id, liquidityProvider1, utils.ParseCoin("8000000farm1-1")) err = s.keeper.Unfarm(s.ctx, msgUnlock) s.Require().NoError(err) s.Require().True(utils.ParseCoins("10000000000pool1-1").IsEqual(s.getBalances(liquidityProvider1))) // total unlock - lp2 - msgUnlock = types.NewMsgUnfarm(appID1, pool.Id, liquidityProvider2, utils.ParseCoin("7000000pool1-1")) + msgUnlock = types.NewMsgUnfarm(appID1, pool.Id, liquidityProvider2, utils.ParseCoin("7000000farm1-1")) err = s.keeper.Unfarm(s.ctx, msgUnlock) s.Require().NoError(err) s.Require().True(utils.ParseCoins("9999999999pool1-1").IsEqual(s.getBalances(liquidityProvider2))) @@ -1151,16 +1151,16 @@ func (s *KeeperTestSuite) TestGetFarmingRewardsDataZeroLPs() { s.Require().Len(qfs[3].QueudCoins, 0) s.Require().Len(afs, 4) - msgUnlock := types.NewMsgUnfarm(appID1, pool.Id, liquidityProvider1, utils.ParseCoin("10000000000pool1-1")) + msgUnlock := types.NewMsgUnfarm(appID1, pool.Id, liquidityProvider1, utils.ParseCoin("10000000000farm1-1")) err = s.keeper.Unfarm(s.ctx, msgUnlock) s.Require().NoError(err) - msgUnlock = types.NewMsgUnfarm(appID1, pool.Id, liquidityProvider2, utils.ParseCoin("9999999999pool1-1")) + msgUnlock = types.NewMsgUnfarm(appID1, pool.Id, liquidityProvider2, utils.ParseCoin("9999999999farm1-1")) err = s.keeper.Unfarm(s.ctx, msgUnlock) s.Require().NoError(err) - msgUnlock = types.NewMsgUnfarm(appID1, pool.Id, liquidityProvider3, utils.ParseCoin("9999999999pool1-1")) + msgUnlock = types.NewMsgUnfarm(appID1, pool.Id, liquidityProvider3, utils.ParseCoin("9999999999farm1-1")) err = s.keeper.Unfarm(s.ctx, msgUnlock) s.Require().NoError(err) - msgUnlock = types.NewMsgUnfarm(appID1, pool.Id, liquidityProvider4, utils.ParseCoin("9999999999pool1-1")) + msgUnlock = types.NewMsgUnfarm(appID1, pool.Id, liquidityProvider4, utils.ParseCoin("9999999999farm1-1")) err = s.keeper.Unfarm(s.ctx, msgUnlock) s.Require().NoError(err) From 70608c72ffad2e57a9cd07cfb0e29523cffe3c02 Mon Sep 17 00:00:00 2001 From: Vishnu Kumavat Date: Sat, 25 Feb 2023 05:03:39 +0530 Subject: [PATCH 03/14] new test cases added for farm-unfarm --- x/liquidity/keeper/rewards_test.go | 54 ++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/x/liquidity/keeper/rewards_test.go b/x/liquidity/keeper/rewards_test.go index 5dc1fc84f..5147eb662 100644 --- a/x/liquidity/keeper/rewards_test.go +++ b/x/liquidity/keeper/rewards_test.go @@ -636,6 +636,60 @@ func (s *KeeperTestSuite) TestUnfarmTwo() { s.Require().True(utils.ParseCoins("9999999999pool1-1").IsEqual(s.getBalances(liquidityProvider2))) } +func (s *KeeperTestSuite) TestFarmAndUnfarm() { + creator := s.addr(0) + + appID1 := s.CreateNewApp("appone") + + asset1 := s.CreateNewAsset("ASSETONE", "uasset1", 1000000) + asset2 := s.CreateNewAsset("ASSETTWO", "uasset2", 1000000) + + pair := s.CreateNewLiquidityPair(appID1, creator, asset1.Denom, asset2.Denom) + pool := s.CreateNewLiquidityPool(appID1, pair.Id, creator, "1000000000000uasset1,1000000000000uasset2") + + liquidityProvider1 := s.addr(1) + s.Deposit(appID1, pool.Id, liquidityProvider1, "1000000000uasset1,1000000000uasset2") + s.nextBlock() + s.Require().True(utils.ParseCoins("10000000000pool1-1").IsEqual(s.getBalances(liquidityProvider1))) + + currentTime := s.ctx.BlockTime() + s.ctx = s.ctx.WithBlockTime(currentTime) + + msg := types.NewMsgFarm(appID1, pool.Id, liquidityProvider1, utils.ParseCoin("10000000000pool1-1")) + err := s.keeper.Farm(s.ctx, msg) + s.Require().NoError(err) + s.Require().True(utils.ParseCoins("10000000000farm1-1").IsEqual(s.getBalances(liquidityProvider1))) + queuedFarmers := s.keeper.GetAllQueuedFarmers(s.ctx, appID1, pool.Id) + s.Require().Len(queuedFarmers, 1) + + modAddress := s.app.AccountKeeper.GetModuleAddress(types.ModuleName) + s.Require().True(utils.ParseCoins("10000000000pool1-1").IsEqual(s.getBalances(modAddress))) + + // validate supply of farm coin after farming - mint check + s.Require().True(utils.ParseCoin("10000000000farm1-1").IsEqual(s.app.BankKeeper.GetSupply(s.ctx, "farm1-1"))) + + unfarmMsg := types.NewMsgUnfarm(appID1, pool.Id, liquidityProvider1, utils.ParseCoin("11000000farm1-1")) + err = s.keeper.Unfarm(s.ctx, unfarmMsg) + s.Require().NoError(err) + + // validate supply of farm coin after farming - burn check + s.Require().True(utils.ParseCoin("9989000000farm1-1").IsEqual(s.app.BankKeeper.GetSupply(s.ctx, "farm1-1"))) + + s.Require().True(utils.ParseCoins("9989000000farm1-1,11000000pool1-1").IsEqual(s.getBalances(liquidityProvider1))) + s.Require().True(utils.ParseCoins("9989000000pool1-1").IsEqual(s.getBalances(modAddress))) + + unfarmMsg = types.NewMsgUnfarm(appID1, pool.Id, liquidityProvider1, utils.ParseCoin("9989000000farm1-1")) + err = s.keeper.Unfarm(s.ctx, unfarmMsg) + s.Require().NoError(err) + + // check after full cycle - 100% farm and unfarm + s.Require().True(utils.ParseCoin("0farm1-1").IsEqual(s.app.BankKeeper.GetSupply(s.ctx, "farm1-1"))) + + s.Require().True(utils.ParseCoins("10000000000pool1-1").IsEqual(s.getBalances(liquidityProvider1))) + s.Require().True(utils.ParseCoins("").IsEqual(s.getBalances(modAddress))) + +} + // liquidity provided in incrementel order func (s *KeeperTestSuite) TestGetFarmingRewardsDataLinearLPs() { currentTime := s.ctx.BlockTime() From 50a39ffa04a2d0f756383d60e1b6f6a38b27a8b9 Mon Sep 17 00:00:00 2001 From: Vishnu Kumavat Date: Sun, 26 Feb 2023 02:02:57 +0530 Subject: [PATCH 04/14] ownership validator for farm coin added --- x/liquidity/keeper/rewards.go | 30 +++++ x/liquidity/keeper/rewards_test.go | 201 +++++++++++++++++++++++++++++ x/liquidity/types/errors.go | 2 + x/liquidity/types/pool.go | 4 +- 4 files changed, 235 insertions(+), 2 deletions(-) diff --git a/x/liquidity/keeper/rewards.go b/x/liquidity/keeper/rewards.go index 0862910fc..c113160d5 100644 --- a/x/liquidity/keeper/rewards.go +++ b/x/liquidity/keeper/rewards.go @@ -569,3 +569,33 @@ func (k Keeper) GetAmountFarmedForAssetID(ctx sdk.Context, appID, assetID uint64 } return totalAmountFarmed, nil } + +func (k Keeper) ValidateFarmCoinOwnershipByFarmer(ctx sdk.Context, farmCoin sdk.Coin, farmer sdk.AccAddress) error { + appID, poolID, err := types.ParseFarmCoinDenom(farmCoin.Denom) + if err != nil { + return err + } + + if !farmCoin.Amount.IsPositive() { + return sdkerrors.Wrapf(types.ErrInvalidFarmAmount, "amount should be positive") + } + + _, found := k.assetKeeper.GetApp(ctx, appID) + if !found { + return sdkerrors.Wrapf(types.ErrInvalidAppID, "app id %d not found", appID) + } + _, found = k.GetPool(ctx, appID, poolID) + if !found { + return sdkerrors.Wrapf(types.ErrInvalidPoolID, "no pool exists with id : %d", poolID) + } + + activeFarmer, found := k.GetActiveFarmer(ctx, appID, poolID, farmer) + if !found { + return sdkerrors.Wrapf(types.ErrNotActiveFarmer, "farmer is not active for given pool id : %d", poolID) + } + + if farmCoin.Amount.GT(activeFarmer.FarmedPoolCoin.Amount) { + return sdkerrors.Wrapf(types.ErrInvalidFarmAmount, "actual farmed amount %s is smaller than %s", sdk.NewCoin(farmCoin.Denom, activeFarmer.FarmedPoolCoin.Amount), farmCoin.String()) + } + return nil +} diff --git a/x/liquidity/keeper/rewards_test.go b/x/liquidity/keeper/rewards_test.go index 5147eb662..bd0056d83 100644 --- a/x/liquidity/keeper/rewards_test.go +++ b/x/liquidity/keeper/rewards_test.go @@ -1,6 +1,7 @@ package keeper_test import ( + "fmt" "time" utils "github.com/comdex-official/comdex/types" @@ -690,6 +691,206 @@ func (s *KeeperTestSuite) TestFarmAndUnfarm() { } +func (s *KeeperTestSuite) TestFarmAndUnfarmTwo() { + creator := s.addr(0) + + appID1 := s.CreateNewApp("appone") + + asset1 := s.CreateNewAsset("ASSETONE", "uasset1", 1000000) + asset2 := s.CreateNewAsset("ASSETTWO", "uasset2", 1000000) + + pair := s.CreateNewLiquidityPair(appID1, creator, asset1.Denom, asset2.Denom) + pool := s.CreateNewLiquidityPool(appID1, pair.Id, creator, "1000000000000uasset1,1000000000000uasset2") + + liquidityProvider1 := s.addr(1) + s.Deposit(appID1, pool.Id, liquidityProvider1, "1000000000uasset1,1000000000uasset2") + s.nextBlock() + s.Require().True(utils.ParseCoins("10000000000pool1-1").IsEqual(s.getBalances(liquidityProvider1))) + + liquidityProvider2 := s.addr(2) + s.Deposit(appID1, pool.Id, liquidityProvider2, "1000000000uasset1,1000000000uasset2") + s.nextBlock() + s.Require().True(utils.ParseCoins("9999999999pool1-1").IsEqual(s.getBalances(liquidityProvider2))) + + currentTime := s.ctx.BlockTime() + s.ctx = s.ctx.WithBlockTime(currentTime) + + msg := types.NewMsgFarm(appID1, pool.Id, liquidityProvider1, utils.ParseCoin("10000000000pool1-1")) + err := s.keeper.Farm(s.ctx, msg) + s.Require().NoError(err) + s.Require().True(utils.ParseCoins("10000000000farm1-1").IsEqual(s.getBalances(liquidityProvider1))) + queuedFarmers := s.keeper.GetAllQueuedFarmers(s.ctx, appID1, pool.Id) + s.Require().Len(queuedFarmers, 1) + + msg = types.NewMsgFarm(appID1, pool.Id, liquidityProvider2, utils.ParseCoin("9999999999pool1-1")) + err = s.keeper.Farm(s.ctx, msg) + s.Require().NoError(err) + s.Require().True(utils.ParseCoins("9999999999farm1-1").IsEqual(s.getBalances(liquidityProvider2))) + queuedFarmers = s.keeper.GetAllQueuedFarmers(s.ctx, appID1, pool.Id) + + s.Require().Len(queuedFarmers, 2) + + s.sendCoins(liquidityProvider2, liquidityProvider1, utils.ParseCoins("9999999999farm1-1")) + s.Require().True(utils.ParseCoins("19999999999farm1-1").IsEqual(s.getBalances(liquidityProvider1))) + + unfarmMsg := types.NewMsgUnfarm(appID1, pool.Id, liquidityProvider1, utils.ParseCoin("19999999999farm1-1")) + err = s.keeper.Unfarm(s.ctx, unfarmMsg) + s.Require().Error(err) + s.Require().EqualError(err, sdkerrors.Wrapf(types.ErrInvalidUnfarmAmount, "farmed pool coin amount 10000000000farm1-1 smaller than requested unfarming pool coin amount 19999999999farm1-1").Error()) + + unfarmMsg = types.NewMsgUnfarm(appID1, pool.Id, liquidityProvider1, utils.ParseCoin("10000000000farm1-1")) + err = s.keeper.Unfarm(s.ctx, unfarmMsg) + s.Require().NoError(err) + + s.Require().True(utils.ParseCoins("10000000000pool1-1,9999999999farm1-1").IsEqual(s.getBalances(liquidityProvider1))) + + unfarmMsg = types.NewMsgUnfarm(appID1, pool.Id, liquidityProvider1, utils.ParseCoin("9999999999farm1-1")) + err = s.keeper.Unfarm(s.ctx, unfarmMsg) + s.Require().Error(err) + s.Require().EqualError(err, sdkerrors.Wrapf(types.ErrInvalidUnfarmAmount, "farmed pool coin amount 0farm1-1 smaller than requested unfarming pool coin amount 9999999999farm1-1").Error()) + + s.Require().True(utils.ParseCoins("10000000000pool1-1,9999999999farm1-1").IsEqual(s.getBalances(liquidityProvider1))) + + modAddress := s.app.AccountKeeper.GetModuleAddress(types.ModuleName) + s.Require().True(utils.ParseCoins("9999999999pool1-1").IsEqual(s.getBalances(modAddress))) + + s.Require().True(utils.ParseCoin("9999999999farm1-1").IsEqual(s.app.BankKeeper.GetSupply(s.ctx, "farm1-1"))) +} + +func (s *KeeperTestSuite) TestValidateFarmCoinOwnershipByFarmer() { + creator := s.addr(0) + + appID1 := s.CreateNewApp("appone") + + asset1 := s.CreateNewAsset("ASSETONE", "uasset1", 1000000) + asset2 := s.CreateNewAsset("ASSETTWO", "uasset2", 1000000) + + pair := s.CreateNewLiquidityPair(appID1, creator, asset1.Denom, asset2.Denom) + pool := s.CreateNewLiquidityPool(appID1, pair.Id, creator, "1000000000000uasset1,1000000000000uasset2") + + // liquidityProvider1 will act as active farmer + liquidityProvider1 := s.addr(1) + s.Deposit(appID1, pool.Id, liquidityProvider1, "1000000000uasset1,1000000000uasset2") + s.nextBlock() + s.Require().True(utils.ParseCoins("10000000000pool1-1").IsEqual(s.getBalances(liquidityProvider1))) + + currentTime := s.ctx.BlockTime() + s.ctx = s.ctx.WithBlockTime(currentTime) + + msg := types.NewMsgFarm(appID1, pool.Id, liquidityProvider1, utils.ParseCoin("10000000000pool1-1")) + err := s.keeper.Farm(s.ctx, msg) + s.Require().NoError(err) + s.Require().True(utils.ParseCoins("10000000000farm1-1").IsEqual(s.getBalances(liquidityProvider1))) + queuedFarmers := s.keeper.GetAllQueuedFarmers(s.ctx, appID1, pool.Id) + s.Require().Len(queuedFarmers, 1) + s.Require().Len(queuedFarmers[0].QueudCoins, 1) + + // liquidityProvider1 dequed here and marked as active + currentTime = s.ctx.BlockTime().Add(time.Hour * 25) + s.ctx = s.ctx.WithBlockTime(currentTime) + s.nextBlock() + + queuedFarmers = s.keeper.GetAllQueuedFarmers(s.ctx, appID1, pool.Id) + s.Require().Len(queuedFarmers, 1) + s.Require().Len(queuedFarmers[0].QueudCoins, 0) + + activeFarmers := s.keeper.GetAllActiveFarmers(s.ctx, appID1, pool.Id) + s.Require().Len(activeFarmers, 1) + + liquidityProvider2 := s.addr(2) + s.Deposit(appID1, pool.Id, liquidityProvider2, "1000000000uasset1,1000000000uasset2") + s.nextBlock() + s.Require().True(utils.ParseCoins("9999999999pool1-1").IsEqual(s.getBalances(liquidityProvider2))) + + msg = types.NewMsgFarm(appID1, pool.Id, liquidityProvider2, utils.ParseCoin("9999999999pool1-1")) + err = s.keeper.Farm(s.ctx, msg) + s.Require().NoError(err) + s.Require().True(utils.ParseCoins("9999999999farm1-1").IsEqual(s.getBalances(liquidityProvider2))) + queuedFarmers = s.keeper.GetAllQueuedFarmers(s.ctx, appID1, pool.Id) + s.Require().Len(queuedFarmers, 2) + s.Require().Len(queuedFarmers[1].QueudCoins, 1) + + testCases := []struct { + Name string + Farmer sdk.AccAddress + FarmCoin sdk.Coin + ExpErr error + }{ + { + Name: "error invalid farm coin 1", + Farmer: liquidityProvider1, + FarmCoin: utils.ParseCoin("10000000000pool1-1"), + ExpErr: fmt.Errorf("pool1-1 is not a farm coin denom"), + }, + { + Name: "error invalid farm coin 2", + Farmer: liquidityProvider1, + FarmCoin: utils.ParseCoin("10000000000farm10-1"), + ExpErr: fmt.Errorf("farm10-1 is not a farm coin denom"), + }, + { + Name: "error invalid farm coin 3", + Farmer: liquidityProvider1, + FarmCoin: utils.ParseCoin("0farm1-1"), + ExpErr: fmt.Errorf("amount should be positive: invalid farm amount"), + }, + { + Name: "error invalid farm coin 4", + Farmer: liquidityProvider1, + FarmCoin: utils.ParseCoin("10000000stake"), + ExpErr: fmt.Errorf("stake is not a farm coin denom"), + }, + { + Name: "error invalid appID", + Farmer: liquidityProvider1, + FarmCoin: utils.ParseCoin("1000000farm3-1"), + ExpErr: fmt.Errorf("app id 3 not found: app id invalid"), + }, + { + Name: "error invalid poolID", + Farmer: liquidityProvider1, + FarmCoin: utils.ParseCoin("1000000farm1-123"), + ExpErr: fmt.Errorf("no pool exists with id : 123: invalid pool id"), + }, + { + Name: "error farmer not active", + Farmer: liquidityProvider2, + FarmCoin: utils.ParseCoin("1000000farm1-1"), + ExpErr: fmt.Errorf("farmer is not active for given pool id : 1: inactive farmer"), + }, + { + Name: "error farmer amount greater than actual farm", + Farmer: liquidityProvider1, + FarmCoin: utils.ParseCoin("100000000000farm1-1"), + ExpErr: fmt.Errorf("actual farmed amount 10000000000farm1-1 is smaller than 100000000000farm1-1: invalid farm amount"), + }, + { + Name: "success 1 request amount equal actual farm amount", + Farmer: liquidityProvider1, + FarmCoin: utils.ParseCoin("10000000000farm1-1"), + ExpErr: nil, + }, + { + Name: "success 2 request amount less than actual farm amount", + Farmer: liquidityProvider1, + FarmCoin: utils.ParseCoin("1000000farm1-1"), + ExpErr: nil, + }, + } + + for _, tc := range testCases { + s.Run(tc.Name, func() { + err := s.keeper.ValidateFarmCoinOwnershipByFarmer(s.ctx, tc.FarmCoin, tc.Farmer) + if tc.ExpErr != nil { + s.Require().Error(err) + s.Require().EqualError(err, tc.ExpErr.Error()) + } else { + s.Require().NoError(err) + } + }) + } +} + // liquidity provided in incrementel order func (s *KeeperTestSuite) TestGetFarmingRewardsDataLinearLPs() { currentTime := s.ctx.BlockTime() diff --git a/x/liquidity/types/errors.go b/x/liquidity/types/errors.go index 0bac8511d..1aa0c8360 100644 --- a/x/liquidity/types/errors.go +++ b/x/liquidity/types/errors.go @@ -39,4 +39,6 @@ var ( ErrorNotPositiveAmont = sdkerrors.Register(ModuleName, 830, "amount should be positive") ErrTooManyPools = sdkerrors.Register(ModuleName, 831, "too many pools in the pair") ErrPriceNotOnTicks = sdkerrors.Register(ModuleName, 832, "price is not on ticks") + ErrNotActiveFarmer = sdkerrors.Register(ModuleName, 833, "inactive farmer") + ErrInvalidFarmAmount = sdkerrors.Register(ModuleName, 834, "invalid farm amount") ) diff --git a/x/liquidity/types/pool.go b/x/liquidity/types/pool.go index 64d3ff301..ff02f53d5 100644 --- a/x/liquidity/types/pool.go +++ b/x/liquidity/types/pool.go @@ -23,7 +23,7 @@ var ( _ amm.Orderer = (*PoolOrderer)(nil) poolCoinDenomRegexp = regexp.MustCompile(`^pool([1-9]-[1-9]\d*)$`) - farmCoinDenomRegexp = regexp.MustCompile(`^pool([1-9]-[1-9]\d*)$`) + farmCoinDenomRegexp = regexp.MustCompile(`^farm([1-9]-[1-9]\d*)$`) ) type PoolTokenDeserializerKit struct { @@ -75,7 +75,7 @@ func FarmCoinDenom(appID, poolID uint64) string { func ParseFarmCoinDenom(denom string) (appID, poolID uint64, err error) { chunks := farmCoinDenomRegexp.FindStringSubmatch(denom) if len(chunks) == 0 { - return 0, 0, fmt.Errorf("%s is not a pool coin denom", denom) + return 0, 0, fmt.Errorf("%s is not a farm coin denom", denom) } appID, err = strconv.ParseUint(strings.Split(chunks[1], "-")[0], 10, 64) if err != nil { From 72880b7e47aa9019de37c10a19f3ef80f0c0f727 Mon Sep 17 00:00:00 2001 From: Vishnu Kumavat Date: Sun, 26 Feb 2023 18:25:51 +0530 Subject: [PATCH 05/14] ownership transfer handler added --- x/liquidity/keeper/rewards.go | 28 +++++ x/liquidity/keeper/rewards_test.go | 177 +++++++++++++++++++++++++++++ x/liquidity/types/pool.go | 4 + x/liquidity/types/pool_test.go | 77 ++++++++++++- 4 files changed, 285 insertions(+), 1 deletion(-) diff --git a/x/liquidity/keeper/rewards.go b/x/liquidity/keeper/rewards.go index c113160d5..8ba06bf33 100644 --- a/x/liquidity/keeper/rewards.go +++ b/x/liquidity/keeper/rewards.go @@ -599,3 +599,31 @@ func (k Keeper) ValidateFarmCoinOwnershipByFarmer(ctx sdk.Context, farmCoin sdk. } return nil } + +func (k Keeper) TransferFarmCoinOwnership(ctx sdk.Context, from, to sdk.AccAddress, farmCoin sdk.Coin) error { + err := k.ValidateFarmCoinOwnershipByFarmer(ctx, farmCoin, from) + if err != nil { + return err + } + + // basic coin and other validations are already done above. + appID, poolID, _ := types.ParseFarmCoinDenom(farmCoin.Denom) + + activeFarmerFrom, _ := k.GetActiveFarmer(ctx, appID, poolID, from) + activeFarmerFrom.FarmedPoolCoin.Amount = activeFarmerFrom.FarmedPoolCoin.Amount.Sub(farmCoin.Amount) + if activeFarmerFrom.FarmedPoolCoin.IsZero() { + k.DeleteActiveFarmer(ctx, activeFarmerFrom) + } else { + k.SetActiveFarmer(ctx, activeFarmerFrom) + } + + activeFarmerTo, found := k.GetActiveFarmer(ctx, appID, poolID, to) + if !found { + pool, _ := k.GetPool(ctx, appID, poolID) + activeFarmerTo = types.NewActivefarmer(appID, poolID, to, sdk.NewCoin(pool.PoolCoinDenom, sdk.NewInt(0))) + } + activeFarmerTo.FarmedPoolCoin.Amount = activeFarmerTo.FarmedPoolCoin.Amount.Add(farmCoin.Amount) + k.SetActiveFarmer(ctx, activeFarmerTo) + + return nil +} diff --git a/x/liquidity/keeper/rewards_test.go b/x/liquidity/keeper/rewards_test.go index bd0056d83..f6d0e817c 100644 --- a/x/liquidity/keeper/rewards_test.go +++ b/x/liquidity/keeper/rewards_test.go @@ -891,6 +891,183 @@ func (s *KeeperTestSuite) TestValidateFarmCoinOwnershipByFarmer() { } } +func (s *KeeperTestSuite) TestTransferFarmCoinOwnership() { + creator := s.addr(0) + + appID1 := s.CreateNewApp("appone") + + asset1 := s.CreateNewAsset("ASSETONE", "uasset1", 1000000) + asset2 := s.CreateNewAsset("ASSETTWO", "uasset2", 1000000) + + pair := s.CreateNewLiquidityPair(appID1, creator, asset1.Denom, asset2.Denom) + pool := s.CreateNewLiquidityPool(appID1, pair.Id, creator, "1000000000000uasset1,1000000000000uasset2") + + // liquidityProvider1 will act as active farmer + liquidityProvider1 := s.addr(1) + s.Deposit(appID1, pool.Id, liquidityProvider1, "1000000000uasset1,1000000000uasset2") + s.nextBlock() + s.Require().True(utils.ParseCoins("10000000000pool1-1").IsEqual(s.getBalances(liquidityProvider1))) + + currentTime := s.ctx.BlockTime() + s.ctx = s.ctx.WithBlockTime(currentTime) + + msg := types.NewMsgFarm(appID1, pool.Id, liquidityProvider1, utils.ParseCoin("10000000000pool1-1")) + err := s.keeper.Farm(s.ctx, msg) + s.Require().NoError(err) + s.Require().True(utils.ParseCoins("10000000000farm1-1").IsEqual(s.getBalances(liquidityProvider1))) + queuedFarmers := s.keeper.GetAllQueuedFarmers(s.ctx, appID1, pool.Id) + s.Require().Len(queuedFarmers, 1) + s.Require().Len(queuedFarmers[0].QueudCoins, 1) + + // liquidityProvider1 dequed here and marked as active + currentTime = s.ctx.BlockTime().Add(time.Hour * 25) + s.ctx = s.ctx.WithBlockTime(currentTime) + s.nextBlock() + + queuedFarmers = s.keeper.GetAllQueuedFarmers(s.ctx, appID1, pool.Id) + s.Require().Len(queuedFarmers, 1) + s.Require().Len(queuedFarmers[0].QueudCoins, 0) + + activeFarmers := s.keeper.GetAllActiveFarmers(s.ctx, appID1, pool.Id) + s.Require().Len(activeFarmers, 1) + s.Require().Equal(activeFarmers[0].FarmedPoolCoin.Amount, sdk.NewInt(10000000000)) + + farmer1, found := s.keeper.GetActiveFarmer(s.ctx, appID1, pool.Id, liquidityProvider1) + s.Require().True(found) + s.Require().Equal(liquidityProvider1.String(), farmer1.Farmer) + s.Require().Equal(utils.ParseCoin("10000000000pool1-1"), farmer1.FarmedPoolCoin) + + auctionWinner1 := s.addr(2) + auctionWinner2 := s.addr(3) + auctionWinner3 := s.addr(4) + + testCases := []struct { + Name string + Farmer sdk.AccAddress + FarmCoin sdk.Coin + ExpErr error + }{ + { + Name: "error invalid farm coin 1", + Farmer: liquidityProvider1, + FarmCoin: utils.ParseCoin("10000000000pool1-1"), + ExpErr: fmt.Errorf("pool1-1 is not a farm coin denom"), + }, + { + Name: "error invalid farm coin 2", + Farmer: liquidityProvider1, + FarmCoin: utils.ParseCoin("10000000000farm10-1"), + ExpErr: fmt.Errorf("farm10-1 is not a farm coin denom"), + }, + { + Name: "error invalid farm coin 3", + Farmer: liquidityProvider1, + FarmCoin: utils.ParseCoin("0farm1-1"), + ExpErr: fmt.Errorf("amount should be positive: invalid farm amount"), + }, + { + Name: "error invalid farm coin 4", + Farmer: liquidityProvider1, + FarmCoin: utils.ParseCoin("10000000stake"), + ExpErr: fmt.Errorf("stake is not a farm coin denom"), + }, + { + Name: "error invalid appID", + Farmer: liquidityProvider1, + FarmCoin: utils.ParseCoin("1000000farm3-1"), + ExpErr: fmt.Errorf("app id 3 not found: app id invalid"), + }, + { + Name: "error invalid poolID", + Farmer: liquidityProvider1, + FarmCoin: utils.ParseCoin("1000000farm1-123"), + ExpErr: fmt.Errorf("no pool exists with id : 123: invalid pool id"), + }, + { + Name: "error farmer not active", + Farmer: creator, + FarmCoin: utils.ParseCoin("1000000farm1-1"), + ExpErr: fmt.Errorf("farmer is not active for given pool id : 1: inactive farmer"), + }, + { + Name: "error farmer amount greater than actual farm", + Farmer: liquidityProvider1, + FarmCoin: utils.ParseCoin("100000000000farm1-1"), + ExpErr: fmt.Errorf("actual farmed amount 10000000000farm1-1 is smaller than 100000000000farm1-1: invalid farm amount"), + }, + } + + for _, tc := range testCases { + s.Run(tc.Name, func() { + err := s.keeper.TransferFarmCoinOwnership(s.ctx, tc.Farmer, auctionWinner1, tc.FarmCoin) + if tc.ExpErr != nil { + s.Require().Error(err) + s.Require().EqualError(err, tc.ExpErr.Error()) + } else { + s.Require().NoError(err) + } + }) + } + + activeFarmers = s.keeper.GetAllActiveFarmers(s.ctx, appID1, pool.Id) + s.Require().Len(activeFarmers, 1) + + _, found = s.keeper.GetActiveFarmer(s.ctx, appID1, pool.Id, auctionWinner1) + s.Require().False(found) + _, found = s.keeper.GetActiveFarmer(s.ctx, appID1, pool.Id, auctionWinner2) + s.Require().False(found) + _, found = s.keeper.GetActiveFarmer(s.ctx, appID1, pool.Id, auctionWinner3) + s.Require().False(found) + + // transfer ownership to 1st auction winner + err = s.keeper.TransferFarmCoinOwnership(s.ctx, liquidityProvider1, auctionWinner1, utils.ParseCoin("3333333333farm1-1")) + s.Require().NoError(err) + + // validate reduction in the amount of original position + farmer1, found = s.keeper.GetActiveFarmer(s.ctx, appID1, pool.Id, liquidityProvider1) + s.Require().True(found) + s.Require().Equal(liquidityProvider1.String(), farmer1.Farmer) + s.Require().Equal(utils.ParseCoin("6666666667pool1-1"), farmer1.FarmedPoolCoin) + + // validate addition in the amount of auction winner + actionFarmer1, found := s.keeper.GetActiveFarmer(s.ctx, appID1, pool.Id, auctionWinner1) + s.Require().True(found) + s.Require().Equal(auctionWinner1.String(), actionFarmer1.Farmer) + s.Require().Equal(utils.ParseCoin("3333333333pool1-1"), actionFarmer1.FarmedPoolCoin) + + // transfer ownership to 2st auction winner + err = s.keeper.TransferFarmCoinOwnership(s.ctx, liquidityProvider1, auctionWinner2, utils.ParseCoin("1234546farm1-1")) + s.Require().NoError(err) + + // validate reduction in the amount of original position + farmer1, found = s.keeper.GetActiveFarmer(s.ctx, appID1, pool.Id, liquidityProvider1) + s.Require().True(found) + s.Require().Equal(liquidityProvider1.String(), farmer1.Farmer) + s.Require().Equal(utils.ParseCoin("6665432121pool1-1"), farmer1.FarmedPoolCoin) + + // validate addition in the amount of auction winner + actionFarmer2, found := s.keeper.GetActiveFarmer(s.ctx, appID1, pool.Id, auctionWinner2) + s.Require().True(found) + s.Require().Equal(auctionWinner2.String(), actionFarmer2.Farmer) + s.Require().Equal(utils.ParseCoin("1234546pool1-1"), actionFarmer2.FarmedPoolCoin) + + // transfer all remaining ownership to 3st auction winner + err = s.keeper.TransferFarmCoinOwnership(s.ctx, liquidityProvider1, auctionWinner3, utils.ParseCoin("6665432121farm1-1")) + s.Require().NoError(err) + + _, found = s.keeper.GetActiveFarmer(s.ctx, appID1, pool.Id, liquidityProvider1) + s.Require().False(found) + + // validate addition in the amount of auction winner + actionFarmer3, found := s.keeper.GetActiveFarmer(s.ctx, appID1, pool.Id, auctionWinner3) + s.Require().True(found) + s.Require().Equal(auctionWinner3.String(), actionFarmer3.Farmer) + s.Require().Equal(utils.ParseCoin("6665432121pool1-1"), actionFarmer3.FarmedPoolCoin) + + activeFarmers = s.keeper.GetAllActiveFarmers(s.ctx, appID1, pool.Id) + s.Require().Len(activeFarmers, 3) +} + // liquidity provided in incrementel order func (s *KeeperTestSuite) TestGetFarmingRewardsDataLinearLPs() { currentTime := s.ctx.BlockTime() diff --git a/x/liquidity/types/pool.go b/x/liquidity/types/pool.go index ff02f53d5..27af3c038 100644 --- a/x/liquidity/types/pool.go +++ b/x/liquidity/types/pool.go @@ -88,6 +88,10 @@ func ParseFarmCoinDenom(denom string) (appID, poolID uint64, err error) { return appID, poolID, nil } +func IsFarmCoinDenom(denom string) bool { + return len(farmCoinDenomRegexp.FindStringSubmatch(denom)) != 0 +} + // FarmCoinDenom returns a unique farm coin denom for a pool. func FarmCoinDecimals(baseDecimals, quoteDecimals uint64) uint64 { baseExponent := math.Log10(float64(baseDecimals)) diff --git a/x/liquidity/types/pool_test.go b/x/liquidity/types/pool_test.go index 1b1bdcce0..4b773510e 100644 --- a/x/liquidity/types/pool_test.go +++ b/x/liquidity/types/pool_test.go @@ -57,8 +57,9 @@ func TestParsePoolCoinDenomFailure(t *testing.T) { {5, "pool5-01", true}, {6, "pool6--10", true}, {7, "pool7-+10", true}, - {8, "ucre8-1", true}, + {8, "stake8-1", true}, {9, "denom9-1", true}, + {10, "pool10-1", true}, } { t.Run("", func(t *testing.T) { _, poolID, err := types.ParsePoolCoinDenom(tc.denom) @@ -71,3 +72,77 @@ func TestParsePoolCoinDenomFailure(t *testing.T) { }) } } + +func TestFarmCoinDenom(t *testing.T) { + for _, tc := range []struct { + appID uint64 + poolId uint64 + expected string + }{ + {1, 1, "farm1-1"}, + {1, 10, "farm1-10"}, + {2, 1, "farm2-1"}, + {2, 10, "farm2-10"}, + {6, 18446744073709551615, "farm6-18446744073709551615"}, + } { + t.Run("", func(t *testing.T) { + poolCoinDenom := types.FarmCoinDenom(tc.appID, tc.poolId) + require.Equal(t, tc.expected, poolCoinDenom) + }) + } +} + +func TestParseFarmCoinDenomFailure(t *testing.T) { + for _, tc := range []struct { + appID uint64 + denom string + expectsErr bool + }{ + {1, "farm1-1", false}, + {2, "farm2-10", false}, + {3, "farm3-18446744073709551615", false}, + {4, "farm3-18446744073709551616", true}, + {5, "farm5-01", true}, + {6, "farm6--10", true}, + {7, "farm7-+10", true}, + {8, "stake8-1", true}, + {9, "denom9-1", true}, + {10, "farm10-1", true}, + } { + t.Run("", func(t *testing.T) { + _, poolID, err := types.ParseFarmCoinDenom(tc.denom) + if tc.expectsErr { + require.Error(t, err) + } else { + require.NoError(t, err) + require.Equal(t, tc.denom, types.FarmCoinDenom(tc.appID, poolID)) + } + }) + } +} + +func TestIsFarmCoinDenom(t *testing.T) { + for _, tc := range []struct { + denom string + valid bool + }{ + {"farm1-1", true}, + {"farm11-1", false}, + {"farm1-1123456", true}, + {"pool1-1123456", false}, + {"stake", false}, + {"cmdx", false}, + {"pool1-1", false}, + {"farmer1-1", false}, + {"farm1-1-1", false}, + {"1farm1-1", false}, + {"farm1farm1-1", false}, + {"farm9-11234", true}, + {"farm2-10", true}, + } { + t.Run("", func(t *testing.T) { + isvalid := types.IsFarmCoinDenom(tc.denom) + require.Equal(t, tc.valid, isvalid) + }) + } +} From 09546c8d4f77b4ddeb8f293fca7eaaf1700cf913 Mon Sep 17 00:00:00 2001 From: Vishnu Kumavat Date: Sun, 26 Feb 2023 18:37:49 +0530 Subject: [PATCH 06/14] farm coin in poools query --- proto/comdex/liquidity/v1beta1/query.proto | 2 + x/liquidity/keeper/grpc_query_test.go | 4 + x/liquidity/types/query.pb.go | 490 ++++++++++++--------- x/liquidity/types/util.go | 1 + 4 files changed, 284 insertions(+), 213 deletions(-) diff --git a/proto/comdex/liquidity/v1beta1/query.proto b/proto/comdex/liquidity/v1beta1/query.proto index c6e180a1c..571464a8a 100644 --- a/proto/comdex/liquidity/v1beta1/query.proto +++ b/proto/comdex/liquidity/v1beta1/query.proto @@ -224,6 +224,8 @@ message PoolResponse { bool disabled = 15; + FarmCoin farm_coin = 16; + } message PoolBalances { diff --git a/x/liquidity/keeper/grpc_query_test.go b/x/liquidity/keeper/grpc_query_test.go index 31fb916bb..ebc4d38ef 100644 --- a/x/liquidity/keeper/grpc_query_test.go +++ b/x/liquidity/keeper/grpc_query_test.go @@ -97,6 +97,7 @@ func (s *KeeperTestSuite) TestPools() { s.Require().Equal(resp.Pools[0].LastWithdrawRequestId, pool.LastWithdrawRequestId) s.Require().Equal(resp.Pools[0].AppId, pool.AppId) s.Require().Equal(resp.Pools[0].PoolCoinSupply, s.getBalance(addr1, pool.PoolCoinDenom).Amount) + s.Require().Equal(resp.Pools[0].FarmCoin, pool.FarmCoin) } func (s *KeeperTestSuite) TestPool() { @@ -161,6 +162,7 @@ func (s *KeeperTestSuite) TestPool() { s.Require().Equal(resp.Pool.LastWithdrawRequestId, pool.LastWithdrawRequestId) s.Require().Equal(resp.Pool.AppId, pool.AppId) s.Require().Equal(resp.Pool.PoolCoinSupply, s.getBalance(addr1, pool.PoolCoinDenom).Amount) + s.Require().Equal(resp.Pool.FarmCoin, pool.FarmCoin) } }) } @@ -233,6 +235,7 @@ func (s *KeeperTestSuite) TestPoolByReserveAddress() { s.Require().Equal(resp.Pool.LastWithdrawRequestId, pool.LastWithdrawRequestId) s.Require().Equal(resp.Pool.AppId, pool.AppId) s.Require().Equal(resp.Pool.PoolCoinSupply, s.getBalance(addr1, pool.PoolCoinDenom).Amount) + s.Require().Equal(resp.Pool.FarmCoin, pool.FarmCoin) } }) } @@ -305,6 +308,7 @@ func (s *KeeperTestSuite) TestPoolByPoolCoinDenom() { s.Require().Equal(resp.Pool.LastWithdrawRequestId, pool.LastWithdrawRequestId) s.Require().Equal(resp.Pool.AppId, pool.AppId) s.Require().Equal(resp.Pool.PoolCoinSupply, s.getBalance(addr1, pool.PoolCoinDenom).Amount) + s.Require().Equal(resp.Pool.FarmCoin, pool.FarmCoin) } }) } diff --git a/x/liquidity/types/query.pb.go b/x/liquidity/types/query.pb.go index 819f29d5c..2e11a5e57 100644 --- a/x/liquidity/types/query.pb.go +++ b/x/liquidity/types/query.pb.go @@ -1493,6 +1493,7 @@ type PoolResponse struct { MaxPrice *github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,13,opt,name=max_price,json=maxPrice,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"max_price,omitempty"` Price *github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,14,opt,name=price,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"price,omitempty"` Disabled bool `protobuf:"varint,15,opt,name=disabled,proto3" json:"disabled,omitempty"` + FarmCoin *FarmCoin `protobuf:"bytes,16,opt,name=farm_coin,json=farmCoin,proto3" json:"farm_coin,omitempty"` } func (m *PoolResponse) Reset() { *m = PoolResponse{} } @@ -1605,6 +1606,13 @@ func (m *PoolResponse) GetDisabled() bool { return false } +func (m *PoolResponse) GetFarmCoin() *FarmCoin { + if m != nil { + return m.FarmCoin + } + return nil +} + type PoolBalances struct { BaseCoin types.Coin `protobuf:"bytes,1,opt,name=base_coin,json=baseCoin,proto3" json:"base_coin"` QuoteCoin types.Coin `protobuf:"bytes,2,opt,name=quote_coin,json=quoteCoin,proto3" json:"quote_coin"` @@ -2709,179 +2717,181 @@ func init() { } var fileDescriptor_d297ec7fcddea2d4 = []byte{ - // 2752 bytes of a gzipped FileDescriptorProto + // 2771 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x59, 0x4d, 0x6c, 0x1c, 0x49, - 0xf5, 0x4f, 0x8f, 0x67, 0x1c, 0xfb, 0xd9, 0x9e, 0xb1, 0x2b, 0x5f, 0x93, 0x49, 0x32, 0xe3, 0x7f, - 0xff, 0x43, 0x32, 0xe4, 0x63, 0x26, 0x71, 0xbe, 0xbd, 0xbb, 0x51, 0x3c, 0xeb, 0x24, 0xeb, 0x4d, - 0x22, 0x92, 0x4e, 0xa2, 0x5d, 0xa2, 0xc0, 0xd0, 0x33, 0x5d, 0x76, 0x5a, 0xe9, 0xe9, 0x6e, 0x77, - 0xf7, 0xc4, 0xf1, 0x5a, 0xd6, 0x4a, 0x48, 0x5c, 0x10, 0x12, 0x2b, 0x2d, 0x8b, 0x40, 0x88, 0x03, - 0x08, 0x09, 0x01, 0x07, 0x0e, 0xc0, 0x65, 0x2f, 0x48, 0x20, 0xa1, 0x3d, 0xb0, 0xda, 0x5d, 0xe5, - 0x82, 0x38, 0x64, 0x21, 0x81, 0x0b, 0xc7, 0x95, 0xb8, 0x70, 0x42, 0xf5, 0xd1, 0x3d, 0xdd, 0xed, - 0x6e, 0x77, 0x8f, 0x35, 0xe6, 0xe2, 0x71, 0x57, 0xd5, 0x7b, 0xef, 0xf7, 0x3e, 0xea, 0xd5, 0xab, - 0x7a, 0x70, 0xb8, 0x6d, 0x74, 0x14, 0xfc, 0xb4, 0xae, 0xa9, 0xcb, 0x5d, 0x55, 0x51, 0x9d, 0xd5, - 0xfa, 0x93, 0xd3, 0x2d, 0xec, 0xc8, 0xa7, 0xeb, 0xcb, 0x5d, 0x6c, 0xad, 0xd6, 0x4c, 0xcb, 0x70, - 0x0c, 0x54, 0x64, 0xab, 0x6a, 0xde, 0xaa, 0x1a, 0x5f, 0x55, 0xda, 0xbd, 0x64, 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36, 0x43, 0x05, 0x16, + 0xa4, 0xa2, 0x15, 0x58, 0x1f, 0x07, 0xfd, 0x9b, 0x30, 0xe5, 0x93, 0x41, 0xfe, 0xbe, 0x66, 0xa8, + 0xfa, 0x02, 0xd6, 0x8d, 0xb6, 0x2b, 0xe2, 0x30, 0x94, 0xa8, 0x35, 0x48, 0x1a, 0x69, 0x28, 0x64, + 0x86, 0x8b, 0x18, 0x33, 0xfd, 0xcb, 0xe3, 0x24, 0x7c, 0xc7, 0x0b, 0x57, 0x59, 0xb5, 0x3c, 0xdc, + 0x7b, 0x21, 0x4f, 0x59, 0xb1, 0x20, 0x28, 0x48, 0xfc, 0x2b, 0x14, 0x91, 0x99, 0x01, 0x44, 0xe4, + 0x90, 0x1f, 0xcc, 0x8f, 0xbc, 0x88, 0x64, 0x60, 0xb8, 0xaf, 0xe6, 0x20, 0x47, 0x76, 0x8b, 0x1b, + 0x91, 0x93, 0xbd, 0x52, 0x85, 0x6a, 0x79, 0x91, 0x48, 0x48, 0xb6, 0x21, 0x12, 0x65, 0xd5, 0x4a, + 0xdc, 0xd5, 0x31, 0xc6, 0xbe, 0xe9, 0xb3, 0xb5, 0xa7, 0xdd, 0x05, 0xc8, 0x12, 0x2a, 0x1e, 0x89, + 0xe9, 0x94, 0xa3, 0x14, 0xe2, 0xfb, 0x02, 0xec, 0xa7, 0xfc, 0x16, 0xb0, 0x69, 0xd8, 0xaa, 0xc3, + 0x61, 0xd9, 0x5b, 0xdc, 0x28, 0x83, 0xca, 0x37, 0xe2, 0x9f, 0x04, 0x38, 0x10, 0x8d, 0x8b, 0xab, + 0xfc, 0x35, 0x18, 0x57, 0xd8, 0x54, 0xc3, 0xe2, 0x73, 0xdc, 0xb7, 0x33, 0xf1, 0xea, 0x07, 0x99, + 0x71, 0x43, 0x94, 0x94, 0xa0, 0x88, 0xc1, 0xf9, 0xfb, 0x01, 0x3f, 0x2c, 0x82, 0x62, 0x13, 0x4d, + 0x5b, 0x84, 0x8c, 0x67, 0x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, 0xf6, 0x77, 0x28, 0x17, 0x74, 0x0d, 0x0a, 0x6d, 0x55, 0x6f, 0x98, 0x96, 0xda, + 0xc2, 0xe5, 0x51, 0xca, 0xf2, 0x68, 0x4a, 0x76, 0x0b, 0xb8, 0x25, 0x0d, 0xb7, 0x55, 0xfd, 0x16, + 0xa1, 0xa5, 0x8c, 0xe4, 0x27, 0x9c, 0xd1, 0xd8, 0x16, 0x18, 0xc9, 0x4f, 0x18, 0xa3, 0xcb, 0x90, + 0x63, 0x4c, 0x8a, 0x7d, 0x33, 0x61, 0x84, 0x81, 0x0b, 0x61, 0x69, 0x5a, 0x98, 0x19, 0xf6, 0x5d, + 0x08, 0xbf, 0x02, 0x85, 0x25, 0xd9, 0x6a, 0x53, 0x4b, 0x96, 0xc7, 0x69, 0xb4, 0xf5, 0x70, 0xd0, + 0x55, 0xd9, 0x6a, 0x13, 0x63, 0x49, 0xc3, 0x4b, 0xfc, 0x17, 0xc9, 0xe0, 0xa3, 0xfe, 0x20, 0x44, + 0xaf, 0x40, 0x81, 0x6c, 0x47, 0xc6, 0x91, 0x25, 0x8f, 0x7d, 0x81, 0x7d, 0xea, 0x32, 0x23, 0xe4, + 0xdd, 0x90, 0xb5, 0x31, 0xf9, 0x46, 0x97, 0x00, 0x56, 0x3a, 0x86, 0xc3, 0xc9, 0x33, 0xe9, 0xc8, + 0x0b, 0x94, 0x84, 0xc2, 0x79, 0xc0, 0x93, 0x19, 0x41, 0xda, 0xcd, 0x37, 0xd1, 0xb7, 0x77, 0xff, + 0xc9, 0x99, 0x09, 0x9c, 0x9c, 0x7b, 0x21, 0xbf, 0x44, 0x19, 0xf0, 0xad, 0xcc, 0xbf, 0xc4, 0x8f, + 0x04, 0x28, 0xde, 0xee, 0xe0, 0x0e, 0x56, 0xdc, 0x8b, 0x13, 0x5a, 0x86, 0x82, 0x17, 0x8a, 0xc9, + 0xea, 0xd6, 0x08, 0xde, 0x5f, 0x7d, 0x36, 0x75, 0x24, 0x85, 0x07, 0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 0x81, 0xc7, 0x08, 0xc2, + 0xf3, 0x84, 0xb1, 0xb4, 0xa4, 0xb6, 0x54, 0x59, 0x73, 0x65, 0xf8, 0xa5, 0xd0, 0xd7, 0x89, 0x66, + 0x9e, 0x3e, 0xb5, 0x9f, 0xfe, 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x71, 0x5c, 0x90, 0xdc, 0x94, + 0x2e, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -4809,6 +4819,20 @@ func (m *PoolResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.FarmCoin != nil { + { + size, err := m.FarmCoin.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x82 + } if m.Disabled { i-- if m.Disabled { @@ -5032,12 +5056,12 @@ func (m *QueuedPoolCoin) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - n22, err22 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.DequeAt, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.DequeAt):]) - if err22 != nil { - return 0, err22 + n23, err23 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.DequeAt, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.DequeAt):]) + if err23 != nil { + return 0, err23 } - i -= n22 - i = encodeVarintQuery(dAtA, i, uint64(n22)) + i -= n23 + i = encodeVarintQuery(dAtA, i, uint64(n23)) i-- dAtA[i] = 0x12 { @@ -5238,21 +5262,21 @@ func (m *PoolIncentive) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x50 } - n25, err25 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.NextDistribution, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.NextDistribution):]) - if err25 != nil { - return 0, err25 - } - i -= n25 - i = encodeVarintQuery(dAtA, i, uint64(n25)) - i-- - dAtA[i] = 0x4a - n26, err26 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.EpochDuration, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.EpochDuration):]) + n26, err26 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.NextDistribution, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.NextDistribution):]) if err26 != nil { return 0, err26 } i -= n26 i = encodeVarintQuery(dAtA, i, uint64(n26)) i-- + dAtA[i] = 0x4a + n27, err27 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.EpochDuration, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.EpochDuration):]) + if err27 != nil { + return 0, err27 + } + i -= n27 + i = encodeVarintQuery(dAtA, i, uint64(n27)) + i-- dAtA[i] = 0x42 if m.FilledEpochs != 0 { i = encodeVarintQuery(dAtA, i, uint64(m.FilledEpochs)) @@ -5285,20 +5309,20 @@ func (m *PoolIncentive) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x22 if len(m.ChildPoolIds) > 0 { - dAtA30 := make([]byte, len(m.ChildPoolIds)*10) - var j29 int + dAtA31 := make([]byte, len(m.ChildPoolIds)*10) + var j30 int for _, num := range m.ChildPoolIds { for num >= 1<<7 { - dAtA30[j29] = uint8(uint64(num)&0x7f | 0x80) + dAtA31[j30] = uint8(uint64(num)&0x7f | 0x80) num >>= 7 - j29++ + j30++ } - dAtA30[j29] = uint8(num) - j29++ + dAtA31[j30] = uint8(num) + j30++ } - i -= j29 - copy(dAtA[i:], dAtA30[:j29]) - i = encodeVarintQuery(dAtA, i, uint64(j29)) + i -= j30 + copy(dAtA[i:], dAtA31[:j30]) + i = encodeVarintQuery(dAtA, i, uint64(j30)) i-- dAtA[i] = 0x1a } @@ -5449,38 +5473,38 @@ func (m *QueryOrderBooksRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) dAtA[i] = 0x20 } if len(m.PriceUnitPowers) > 0 { - dAtA33 := make([]byte, len(m.PriceUnitPowers)*10) - var j32 int + dAtA34 := make([]byte, len(m.PriceUnitPowers)*10) + var j33 int for _, num := range m.PriceUnitPowers { for num >= 1<<7 { - dAtA33[j32] = uint8(uint64(num)&0x7f | 0x80) + dAtA34[j33] = uint8(uint64(num)&0x7f | 0x80) num >>= 7 - j32++ + j33++ } - dAtA33[j32] = uint8(num) - j32++ + dAtA34[j33] = uint8(num) + j33++ } - i -= j32 - copy(dAtA[i:], dAtA33[:j32]) - i = encodeVarintQuery(dAtA, i, uint64(j32)) + i -= j33 + copy(dAtA[i:], dAtA34[:j33]) + i = encodeVarintQuery(dAtA, i, uint64(j33)) i-- dAtA[i] = 0x1a } if len(m.PairIds) > 0 { - dAtA35 := make([]byte, len(m.PairIds)*10) - var j34 int + dAtA36 := make([]byte, len(m.PairIds)*10) + var j35 int for _, num := range m.PairIds { for num >= 1<<7 { - dAtA35[j34] = uint8(uint64(num)&0x7f | 0x80) + dAtA36[j35] = uint8(uint64(num)&0x7f | 0x80) num >>= 7 - j34++ + j35++ } - dAtA35[j34] = uint8(num) - j34++ + dAtA36[j35] = uint8(num) + j35++ } - i -= j34 - copy(dAtA[i:], dAtA35[:j34]) - i = encodeVarintQuery(dAtA, i, uint64(j34)) + i -= j35 + copy(dAtA[i:], dAtA36[:j35]) + i = encodeVarintQuery(dAtA, i, uint64(j35)) i-- dAtA[i] = 0x12 } @@ -6313,6 +6337,10 @@ func (m *PoolResponse) Size() (n int) { if m.Disabled { n += 2 } + if m.FarmCoin != nil { + l = m.FarmCoin.Size() + n += 2 + l + sovQuery(uint64(l)) + } return n } @@ -9914,6 +9942,42 @@ func (m *PoolResponse) Unmarshal(dAtA []byte) error { } } m.Disabled = bool(v != 0) + case 16: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FarmCoin", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.FarmCoin == nil { + m.FarmCoin = &FarmCoin{} + } + if err := m.FarmCoin.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) diff --git a/x/liquidity/types/util.go b/x/liquidity/types/util.go index bf0a8323c..72200f13d 100644 --- a/x/liquidity/types/util.go +++ b/x/liquidity/types/util.go @@ -94,6 +94,7 @@ func NewPoolResponse(pool Pool, rx, ry sdk.Coin, poolCoinSupply sdk.Int) PoolRes MaxPrice: pool.MaxPrice, Price: price, Disabled: pool.Disabled, + FarmCoin: pool.FarmCoin, } } From 876d8777f1c2aa835362e2bd5649e7185d326ad5 Mon Sep 17 00:00:00 2001 From: Vishnu Kumavat Date: Sun, 26 Feb 2023 18:56:06 +0530 Subject: [PATCH 07/14] farm coin decimal check --- x/liquidity/keeper/pool_test.go | 78 +++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) diff --git a/x/liquidity/keeper/pool_test.go b/x/liquidity/keeper/pool_test.go index f32a4d43b..d63667f98 100644 --- a/x/liquidity/keeper/pool_test.go +++ b/x/liquidity/keeper/pool_test.go @@ -2,6 +2,7 @@ package keeper_test import ( utils "github.com/comdex-official/comdex/types" + assettypes "github.com/comdex-official/comdex/x/asset/types" "github.com/comdex-official/comdex/x/liquidity" "github.com/comdex-official/comdex/x/liquidity/amm" "github.com/comdex-official/comdex/x/liquidity/types" @@ -1664,3 +1665,80 @@ func (s *KeeperTestSuite) TestTransferFundsForSwapFeeDistribution_WithBurnRate() s.Require().True(coinEq(utils.ParseCoin("0ucmdx"), s.getBalance(pair.GetSwapFeeCollectorAddress(), params.SwapFeeDistrDenom))) } + +func (s *KeeperTestSuite) TestCreatePoolWithMaxDecimals() { + addr1 := s.addr(1) + appID1 := s.CreateNewApp("appone") + + err := s.app.AssetKeeper.AddAssetRecords(s.ctx, assettypes.Asset{ + Name: "ASSETONE", + Denom: "assetone", + Decimals: sdk.NewInt(1000000000000000000), + IsOnChain: true, + IsOraclePriceRequired: true, + }) + s.Require().NoError(err) + + err = s.app.AssetKeeper.AddAssetRecords(s.ctx, assettypes.Asset{ + Name: "ASSETTWO", + Denom: "assettwo", + Decimals: sdk.NewInt(1000000000000000000), + IsOnChain: true, + IsOraclePriceRequired: true, + }) + s.Require().NoError(err) + + err = s.app.AssetKeeper.AddAssetRecords(s.ctx, assettypes.Asset{ + Name: "ASSETTHREE", + Denom: "assetthree", + Decimals: sdk.NewInt(1000000), + IsOnChain: true, + IsOraclePriceRequired: true, + }) + s.Require().NoError(err) + + err = s.app.AssetKeeper.AddAssetRecords(s.ctx, assettypes.Asset{ + Name: "ASSETFOUR", + Denom: "assetfour", + Decimals: sdk.NewInt(1000000), + IsOnChain: true, + IsOraclePriceRequired: true, + }) + s.Require().NoError(err) + + pair := s.CreateNewLiquidityPair(appID1, addr1, "assetone", "assettwo") + pool := s.CreateNewLiquidityPool(appID1, pair.Id, addr1, "1000000assetone,1000000assettwo") + pool, found := s.keeper.GetPool(s.ctx, appID1, pool.Id) + s.Require().True(found) + s.Require().Equal(pool.FarmCoin.Decimals, uint64(1000000000000000000)) + + pair = s.CreateNewLiquidityPair(appID1, addr1, "assetthree", "assetfour") + pool = s.CreateNewLiquidityPool(appID1, pair.Id, addr1, "10000000assetthree,1000000000assetfour") + pool, found = s.keeper.GetPool(s.ctx, appID1, pool.Id) + s.Require().True(found) + s.Require().Equal(pool.FarmCoin.Decimals, uint64(1000000000000)) + + pair = s.CreateNewLiquidityPair(appID1, addr1, "assetone", "assetthree") + pool = s.CreateNewLiquidityPool(appID1, pair.Id, addr1, "10000000assetone,1000000000assetthree") + pool, found = s.keeper.GetPool(s.ctx, appID1, pool.Id) + s.Require().True(found) + s.Require().Equal(pool.FarmCoin.Decimals, uint64(1000000000000000000)) + + pair = s.CreateNewLiquidityPair(appID1, addr1, "assetone", "assetfour") + pool = s.CreateNewLiquidityPool(appID1, pair.Id, addr1, "1000000000000assetone,1000123000000assetfour") + pool, found = s.keeper.GetPool(s.ctx, appID1, pool.Id) + s.Require().True(found) + s.Require().Equal(pool.FarmCoin.Decimals, uint64(1000000000000000000)) + + pair = s.CreateNewLiquidityPair(appID1, addr1, "assettwo", "assetthree") + pool = s.CreateNewLiquidityPool(appID1, pair.Id, addr1, "1000000assettwo,1000000000assetthree") + pool, found = s.keeper.GetPool(s.ctx, appID1, pool.Id) + s.Require().True(found) + s.Require().Equal(pool.FarmCoin.Decimals, uint64(1000000000000000000)) + + pair = s.CreateNewLiquidityPair(appID1, addr1, "assettwo", "assetfour") + pool = s.CreateNewLiquidityPool(appID1, pair.Id, addr1, "1000000assettwo,1000123000000assetfour") + pool, found = s.keeper.GetPool(s.ctx, appID1, pool.Id) + s.Require().True(found) + s.Require().Equal(pool.FarmCoin.Decimals, uint64(1000000000000000000)) +} From 28967f946d1cbcb4f688b57823a6f771015c648c Mon Sep 17 00:00:00 2001 From: Vishnu Kumavat Date: Sun, 26 Feb 2023 23:56:53 +0530 Subject: [PATCH 08/14] transfers block - farm coins --- x/liquidity/abci.go | 1 + x/liquidity/expected/keeper.go | 3 +++ x/liquidity/keeper/block_coin_transfers.go | 20 +++++++++++++++++++ .../keeper/block_coin_transfers_test.go | 15 ++++++++++++++ x/liquidity/keeper/pool.go | 13 ++++++++++-- 5 files changed, 50 insertions(+), 2 deletions(-) create mode 100644 x/liquidity/keeper/block_coin_transfers.go create mode 100644 x/liquidity/keeper/block_coin_transfers_test.go diff --git a/x/liquidity/abci.go b/x/liquidity/abci.go index 11c91497f..1dc2f096a 100644 --- a/x/liquidity/abci.go +++ b/x/liquidity/abci.go @@ -42,6 +42,7 @@ func EndBlocker(ctx sdk.Context, k keeper.Keeper, assetKeeper expected.AssetKeep k.ExecuteRequests(ctx, app.Id) k.ProcessQueuedFarmers(ctx, app.Id) } + k.BlockAllFarmCoinTransfers(ctx, app.Id) return nil }) } diff --git a/x/liquidity/expected/keeper.go b/x/liquidity/expected/keeper.go index abb20539a..7a6d84f42 100644 --- a/x/liquidity/expected/keeper.go +++ b/x/liquidity/expected/keeper.go @@ -20,6 +20,9 @@ type AccountKeeper interface { // BankKeeper is the expected bank keeper. type BankKeeper interface { + GetParams(ctx sdk.Context) (params banktypes.Params) + SetParams(ctx sdk.Context, params banktypes.Params) + IsSendEnabledCoin(ctx sdk.Context, coin sdk.Coin) bool GetBalance(ctx sdk.Context, addr sdk.AccAddress, denom string) sdk.Coin GetAllBalances(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins GetSupply(ctx sdk.Context, denom string) sdk.Coin diff --git a/x/liquidity/keeper/block_coin_transfers.go b/x/liquidity/keeper/block_coin_transfers.go new file mode 100644 index 000000000..673fe1ec8 --- /dev/null +++ b/x/liquidity/keeper/block_coin_transfers.go @@ -0,0 +1,20 @@ +package keeper + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" +) + +func (k Keeper) IsCoinTransferBlocked(ctx sdk.Context, coin sdk.Coin) bool { + return !k.bankKeeper.IsSendEnabledCoin(ctx, coin) +} + +func (k Keeper) BlockCoinTransferIfNotAlready(ctx sdk.Context, coin sdk.Coin) { + if !k.IsCoinTransferBlocked(ctx, coin) { + bankParams := k.bankKeeper.GetParams(ctx) + bankParams.SendEnabled = append(bankParams.SendEnabled, + banktypes.NewSendEnabled(coin.Denom, false), + ) + k.bankKeeper.SetParams(ctx, bankParams) + } +} diff --git a/x/liquidity/keeper/block_coin_transfers_test.go b/x/liquidity/keeper/block_coin_transfers_test.go new file mode 100644 index 000000000..5c0c13a45 --- /dev/null +++ b/x/liquidity/keeper/block_coin_transfers_test.go @@ -0,0 +1,15 @@ +package keeper_test + +import ( + utils "github.com/comdex-official/comdex/types" + _ "github.com/stretchr/testify/suite" +) + +func (s *KeeperTestSuite) TestBlockCoinTransferIfNotAlready() { + coin1 := utils.ParseCoin("1000coin1") + isBlocked := s.keeper.IsCoinTransferBlocked(s.ctx, coin1) + s.Require().False(isBlocked) + s.keeper.BlockCoinTransferIfNotAlready(s.ctx, coin1) + isBlocked = s.keeper.IsCoinTransferBlocked(s.ctx, coin1) + s.Require().True(isBlocked) +} diff --git a/x/liquidity/keeper/pool.go b/x/liquidity/keeper/pool.go index 06d82dbf0..8f5e46c7e 100644 --- a/x/liquidity/keeper/pool.go +++ b/x/liquidity/keeper/pool.go @@ -156,6 +156,7 @@ func (k Keeper) CreatePool(ctx sdk.Context, msg *types.MsgCreatePool) (types.Poo k.SetPool(ctx, pool) k.SetPoolByReserveIndex(ctx, pool) k.SetPoolsByPairIndex(ctx, pool) + k.BlockCoinTransferIfNotAlready(ctx, sdk.NewCoin(pool.FarmCoin.Denom, sdk.NewInt(0))) // Send deposit coins to the pool's reserve account. creator := msg.GetCreator() @@ -314,11 +315,12 @@ func (k Keeper) CreateRangedPool(ctx sdk.Context, msg *types.MsgCreateRangedPool quoteAsset, _ := k.assetKeeper.GetAssetForDenom(ctx, pair.QuoteCoinDenom) // Create and save the new pool object. - poolId := k.getNextPoolIDWithUpdate(ctx, msg.AppId) - pool := types.NewRangedPool(msg.AppId, poolId, pair.Id, msg.GetCreator(), msg.MinPrice, msg.MaxPrice, baseAsset, quoteAsset) + poolID := k.getNextPoolIDWithUpdate(ctx, msg.AppId) + pool := types.NewRangedPool(msg.AppId, poolID, pair.Id, msg.GetCreator(), msg.MinPrice, msg.MaxPrice, baseAsset, quoteAsset) k.SetPool(ctx, pool) k.SetPoolByReserveIndex(ctx, pool) k.SetPoolsByPairIndex(ctx, pool) + k.BlockCoinTransferIfNotAlready(ctx, sdk.NewCoin(pool.FarmCoin.Denom, sdk.NewInt(0))) // Send deposit coins to the pool's reserve account. creator := msg.GetCreator() @@ -841,3 +843,10 @@ func (k Keeper) WasmMsgAddEmissionPoolRewards(ctx sdk.Context, appID, cswapAppID return nil } + +func (k Keeper) BlockAllFarmCoinTransfers(ctx sdk.Context, appID uint64) { + pools := k.GetAllPools(ctx, appID) + for _, pool := range pools { + k.BlockCoinTransferIfNotAlready(ctx, sdk.NewCoin(pool.FarmCoin.Denom, sdk.NewInt(0))) + } +} From daf4055ebc72465d34bfcef6cd7508956df38662 Mon Sep 17 00:00:00 2001 From: Vishnu Kumavat Date: Mon, 27 Feb 2023 00:04:51 +0530 Subject: [PATCH 09/14] test token list update --- scripts/comdex_local_setup/constants.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/scripts/comdex_local_setup/constants.py b/scripts/comdex_local_setup/constants.py index 4744a5c82..6c51d51b4 100644 --- a/scripts/comdex_local_setup/constants.py +++ b/scripts/comdex_local_setup/constants.py @@ -7,7 +7,19 @@ NODE_MONIKER = "testdev" CHAIN_ID = "test-1" GENESIS_ACCOUNT_NAME = "cooluser" -GENESIS_TOKENS = "1000000000000000000000stake,1000000000000000000000ucmst,100000000000000000000000000ucmdx,100000000000000000000000uosmo,100000000000000000000000000uatom,10000000000000000000000000000000000000000weth-wei,10000000000000000000000000000ucgold,1000000000000000000000000000usdc" + +GENESIS_MINTING_TEST_TOKENS = [ + "100000000000000000000000000stake", + "100000000000000000000000000ucmdx", + "100000000000000000000000000ucmst", + "100000000000000000000000000ibc/C4CFF46FD6DE35CA4CF4CE031E643C8FDC9BA4B99AE598E9B0ED98FE3A2319F9", # ATOM + "100000000000000000000000000ibc/05AC4BBA78C5951339A47DD1BC1E7FC922A9311DF81C85745B1C162F516FF2F1", # OSMO + "100000000000000000000000000ibc/96CF88731A06654F8510473865C75200005B81A2A9FECB90389034F787015CA3", # AXLUSDC + "100000000000000000000000000ibc/065AD21492A7749E283A37AC469426562F988B7BA59712C0C545F381865A66BA", # AXLWETH + "100000000000000000000000000ibc/50EF138042B553362774A8A9DE967F610E52CAEB3BA864881C9A1436DED98075", # AXLDAI +] + +GENESIS_TOKENS = ",".join(GENESIS_MINTING_TEST_TOKENS) VOTING_PERIOD_IN_SEC = 10 DEPOSIT_PERIOD_IN_SEC = 10 \ No newline at end of file From 74349bb06fb57bdf901df7ccb7e60d3e8135a9cb Mon Sep 17 00:00:00 2001 From: Vishnu Kumavat Date: Wed, 1 Mar 2023 19:30:52 +0530 Subject: [PATCH 10/14] typo fix --- x/liquidity/types/pool.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/liquidity/types/pool.go b/x/liquidity/types/pool.go index 85b7e5f20..f7ad85366 100644 --- a/x/liquidity/types/pool.go +++ b/x/liquidity/types/pool.go @@ -123,7 +123,7 @@ func NewBasicPool(appID, id, pairID uint64, creator sdk.AccAddress, baseAsset, q } // NewRangedPool returns a new ranged pool object. -func NewRangedPool(appID, id, pairId uint64, creator sdk.AccAddress, minPrice, maxPrice sdk.Dec, baseAsset, quoteAsset assettypes.Asset) Pool { +func NewRangedPool(appID, id, pairID uint64, creator sdk.AccAddress, minPrice, maxPrice sdk.Dec, baseAsset, quoteAsset assettypes.Asset) Pool { return Pool{ Type: PoolTypeRanged, Id: id, From fac082393a41d7dda253e108d1404ece8806b4c9 Mon Sep 17 00:00:00 2001 From: Vishnu Kumavat Date: Sat, 4 Mar 2023 02:28:30 +0530 Subject: [PATCH 11/14] liquidity modules's migration --- x/liquidity/keeper/migrations.go | 5 + x/liquidity/legacy/v1/liquidity.pb.go | 2 +- x/liquidity/legacy/v1/params.pb.go | 2 +- x/liquidity/legacy/v2/liquidity.pb.go | 4169 +++++++++++++++++++++++++ x/liquidity/legacy/v3/store.go | 271 ++ x/liquidity/legacy/v3/store_test.go | 1 + x/liquidity/module.go | 6 +- 7 files changed, 4453 insertions(+), 3 deletions(-) create mode 100644 x/liquidity/legacy/v2/liquidity.pb.go create mode 100644 x/liquidity/legacy/v3/store.go create mode 100644 x/liquidity/legacy/v3/store_test.go diff --git a/x/liquidity/keeper/migrations.go b/x/liquidity/keeper/migrations.go index b7a77425d..67be527fb 100644 --- a/x/liquidity/keeper/migrations.go +++ b/x/liquidity/keeper/migrations.go @@ -4,6 +4,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" v2 "github.com/comdex-official/comdex/x/liquidity/legacy/v2" + v3 "github.com/comdex-official/comdex/x/liquidity/legacy/v3" ) type Migrator struct { @@ -17,3 +18,7 @@ func NewMigrator(keeper Keeper) Migrator { func (m Migrator) Migrate1to2(ctx sdk.Context) error { return v2.MigrateStore(ctx, m.keeper.assetKeeper, m.keeper.storeKey, m.keeper.cdc) } + +func (m Migrator) Migrate2to3(ctx sdk.Context) error { + return v3.MigrateStore(ctx, m.keeper.assetKeeper, m.keeper.bankKeeper, m.keeper.storeKey, m.keeper.cdc) +} diff --git a/x/liquidity/legacy/v1/liquidity.pb.go b/x/liquidity/legacy/v1/liquidity.pb.go index 7118b695f..1dc156c19 100644 --- a/x/liquidity/legacy/v1/liquidity.pb.go +++ b/x/liquidity/legacy/v1/liquidity.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. // source: comdex/liquidity/v1beta1/liquidity.proto -package types +package v1 import ( fmt "fmt" diff --git a/x/liquidity/legacy/v1/params.pb.go b/x/liquidity/legacy/v1/params.pb.go index 1d125a7b5..fac8416b6 100644 --- a/x/liquidity/legacy/v1/params.pb.go +++ b/x/liquidity/legacy/v1/params.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. // source: comdex/liquidity/v1beta1/params.proto -package types +package v1 import ( fmt "fmt" diff --git a/x/liquidity/legacy/v2/liquidity.pb.go b/x/liquidity/legacy/v2/liquidity.pb.go new file mode 100644 index 000000000..b0548bff1 --- /dev/null +++ b/x/liquidity/legacy/v2/liquidity.pb.go @@ -0,0 +1,4169 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: comdex/liquidity/v1beta1/liquidity.proto + +package v2 + +import ( + fmt "fmt" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" + _ "github.com/golang/protobuf/ptypes/timestamp" + io "io" + math "math" + math_bits "math/bits" + time "time" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf +var _ = time.Kitchen + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// PoolType enumerates pool types. +type PoolType int32 + +const ( + // POOL_TYPE_UNSPECIFIED specifies unknown pool type + PoolTypeUnspecified PoolType = 0 + // POOL_TYPE_BASIC specifies the basic pool type + PoolTypeBasic PoolType = 1 + // POOL_TYPE_RANGED specifies the ranged pool type + PoolTypeRanged PoolType = 2 +) + +var PoolType_name = map[int32]string{ + 0: "POOL_TYPE_UNSPECIFIED", + 1: "POOL_TYPE_BASIC", + 2: "POOL_TYPE_RANGED", +} + +var PoolType_value = map[string]int32{ + "POOL_TYPE_UNSPECIFIED": 0, + "POOL_TYPE_BASIC": 1, + "POOL_TYPE_RANGED": 2, +} + +func (x PoolType) String() string { + return proto.EnumName(PoolType_name, int32(x)) +} + +func (PoolType) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_579dcc42096fa86d, []int{0} +} + +// OrderType enumerates order types. +type OrderType int32 + +const ( + // ORDER_TYPE_UNSPECIFIED specifies unknown order type. + OrderTypeUnspecified OrderType = 0 + // ORDER_TYPE_LIMIT specifies limit order type. + OrderTypeLimit OrderType = 1 + // ORDER_TYPE_MARKET specifies market order type. + OrderTypeMarket OrderType = 2 + // ORDER_TYPE_MM specifies MM(market making) order type. + OrderTypeMM OrderType = 3 +) + +var OrderType_name = map[int32]string{ + 0: "ORDER_TYPE_UNSPECIFIED", + 1: "ORDER_TYPE_LIMIT", + 2: "ORDER_TYPE_MARKET", + 3: "ORDER_TYPE_MM", +} + +var OrderType_value = map[string]int32{ + "ORDER_TYPE_UNSPECIFIED": 0, + "ORDER_TYPE_LIMIT": 1, + "ORDER_TYPE_MARKET": 2, + "ORDER_TYPE_MM": 3, +} + +func (x OrderType) String() string { + return proto.EnumName(OrderType_name, int32(x)) +} + +func (OrderType) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_579dcc42096fa86d, []int{1} +} + +// OrderDirection enumerates order directions. +type OrderDirection int32 + +const ( + // ORDER_DIRECTION_UNSPECIFIED specifies unknown order direction + OrderDirectionUnspecified OrderDirection = 0 + // ORDER_DIRECTION_BUY specifies buy(swap quote coin to base coin) order direction + OrderDirectionBuy OrderDirection = 1 + // ORDER_DIRECTION_SELL specifies sell(swap base coin to quote coin) order direction + OrderDirectionSell OrderDirection = 2 +) + +var OrderDirection_name = map[int32]string{ + 0: "ORDER_DIRECTION_UNSPECIFIED", + 1: "ORDER_DIRECTION_BUY", + 2: "ORDER_DIRECTION_SELL", +} + +var OrderDirection_value = map[string]int32{ + "ORDER_DIRECTION_UNSPECIFIED": 0, + "ORDER_DIRECTION_BUY": 1, + "ORDER_DIRECTION_SELL": 2, +} + +func (x OrderDirection) String() string { + return proto.EnumName(OrderDirection_name, int32(x)) +} + +func (OrderDirection) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_579dcc42096fa86d, []int{2} +} + +// RequestStatus enumerates request statuses. +type RequestStatus int32 + +const ( + // REQUEST_STATUS_UNSPECIFIED specifies unknown request status + RequestStatusUnspecified RequestStatus = 0 + // REQUEST_STATUS_NOT_EXECUTED indicates the request is not executed yet + RequestStatusNotExecuted RequestStatus = 1 + // REQUEST_STATUS_SUCCEEDED indicates the request has been succeeded + RequestStatusSucceeded RequestStatus = 2 + // REQUEST_STATUS_FAILED indicates the request is failed + RequestStatusFailed RequestStatus = 3 +) + +var RequestStatus_name = map[int32]string{ + 0: "REQUEST_STATUS_UNSPECIFIED", + 1: "REQUEST_STATUS_NOT_EXECUTED", + 2: "REQUEST_STATUS_SUCCEEDED", + 3: "REQUEST_STATUS_FAILED", +} + +var RequestStatus_value = map[string]int32{ + "REQUEST_STATUS_UNSPECIFIED": 0, + "REQUEST_STATUS_NOT_EXECUTED": 1, + "REQUEST_STATUS_SUCCEEDED": 2, + "REQUEST_STATUS_FAILED": 3, +} + +func (x RequestStatus) String() string { + return proto.EnumName(RequestStatus_name, int32(x)) +} + +func (RequestStatus) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_579dcc42096fa86d, []int{3} +} + +// OrderStatus enumerates order statuses. +type OrderStatus int32 + +const ( + // ORDER_STATUS_UNSPECIFIED specifies unknown order status + OrderStatusUnspecified OrderStatus = 0 + // ORDER_STATUS_NOT_EXECUTED indicates the order has not been executed yet + OrderStatusNotExecuted OrderStatus = 1 + // ORDER_STATUS_NOT_MATCHED indicates the order has been executed but has no match + OrderStatusNotMatched OrderStatus = 2 + // ORDER_STATUS_PARTIALLY_MATCHED indicates the order has been partially matched + OrderStatusPartiallyMatched OrderStatus = 3 + // ORDER_STATUS_COMPLETED indicates the order has been fully matched and completed + OrderStatusCompleted OrderStatus = 4 + // ORDER_STATUS_CANCELED indicates the order has been canceled + OrderStatusCanceled OrderStatus = 5 + // ORDER_STATUS_EXPIRED indicates the order has been expired + OrderStatusExpired OrderStatus = 6 +) + +var OrderStatus_name = map[int32]string{ + 0: "ORDER_STATUS_UNSPECIFIED", + 1: "ORDER_STATUS_NOT_EXECUTED", + 2: "ORDER_STATUS_NOT_MATCHED", + 3: "ORDER_STATUS_PARTIALLY_MATCHED", + 4: "ORDER_STATUS_COMPLETED", + 5: "ORDER_STATUS_CANCELED", + 6: "ORDER_STATUS_EXPIRED", +} + +var OrderStatus_value = map[string]int32{ + "ORDER_STATUS_UNSPECIFIED": 0, + "ORDER_STATUS_NOT_EXECUTED": 1, + "ORDER_STATUS_NOT_MATCHED": 2, + "ORDER_STATUS_PARTIALLY_MATCHED": 3, + "ORDER_STATUS_COMPLETED": 4, + "ORDER_STATUS_CANCELED": 5, + "ORDER_STATUS_EXPIRED": 6, +} + +func (x OrderStatus) String() string { + return proto.EnumName(OrderStatus_name, int32(x)) +} + +func (OrderStatus) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_579dcc42096fa86d, []int{4} +} + +// AddressType enumerates the available types of a address. +type AddressType int32 + +const ( + // the 32 bytes length address type of ADR 028. + AddressType32Bytes AddressType = 0 + // the default 20 bytes length address type. + AddressType20Bytes AddressType = 1 +) + +var AddressType_name = map[int32]string{ + 0: "ADDRESS_TYPE_32_BYTES", + 1: "ADDRESS_TYPE_20_BYTES", +} + +var AddressType_value = map[string]int32{ + "ADDRESS_TYPE_32_BYTES": 0, + "ADDRESS_TYPE_20_BYTES": 1, +} + +func (x AddressType) String() string { + return proto.EnumName(AddressType_name, int32(x)) +} + +func (AddressType) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_579dcc42096fa86d, []int{5} +} + +// Pair defines a coin pair. +type Pair struct { + Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + BaseCoinDenom string `protobuf:"bytes,2,opt,name=base_coin_denom,json=baseCoinDenom,proto3" json:"base_coin_denom,omitempty"` + QuoteCoinDenom string `protobuf:"bytes,3,opt,name=quote_coin_denom,json=quoteCoinDenom,proto3" json:"quote_coin_denom,omitempty"` + EscrowAddress string `protobuf:"bytes,4,opt,name=escrow_address,json=escrowAddress,proto3" json:"escrow_address,omitempty"` + LastOrderId uint64 `protobuf:"varint,5,opt,name=last_order_id,json=lastOrderId,proto3" json:"last_order_id,omitempty"` + LastPrice *github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,6,opt,name=last_price,json=lastPrice,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"last_price,omitempty"` + CurrentBatchId uint64 `protobuf:"varint,7,opt,name=current_batch_id,json=currentBatchId,proto3" json:"current_batch_id,omitempty"` + SwapFeeCollectorAddress string `protobuf:"bytes,8,opt,name=swap_fee_collector_address,json=swapFeeCollectorAddress,proto3" json:"swap_fee_collector_address,omitempty"` + AppId uint64 `protobuf:"varint,9,opt,name=app_id,json=appId,proto3" json:"app_id,omitempty"` +} + +func (m *Pair) Reset() { *m = Pair{} } +func (m *Pair) String() string { return proto.CompactTextString(m) } +func (*Pair) ProtoMessage() {} +func (*Pair) Descriptor() ([]byte, []int) { + return fileDescriptor_579dcc42096fa86d, []int{0} +} +func (m *Pair) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Pair) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Pair.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Pair) XXX_Merge(src proto.Message) { + xxx_messageInfo_Pair.Merge(m, src) +} +func (m *Pair) XXX_Size() int { + return m.Size() +} +func (m *Pair) XXX_DiscardUnknown() { + xxx_messageInfo_Pair.DiscardUnknown(m) +} + +var xxx_messageInfo_Pair proto.InternalMessageInfo + +// Pool defines a basic liquidity pool with no min-price and max-price. +type Pool struct { + Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + PairId uint64 `protobuf:"varint,2,opt,name=pair_id,json=pairId,proto3" json:"pair_id,omitempty"` + ReserveAddress string `protobuf:"bytes,3,opt,name=reserve_address,json=reserveAddress,proto3" json:"reserve_address,omitempty"` + PoolCoinDenom string `protobuf:"bytes,4,opt,name=pool_coin_denom,json=poolCoinDenom,proto3" json:"pool_coin_denom,omitempty"` + LastDepositRequestId uint64 `protobuf:"varint,5,opt,name=last_deposit_request_id,json=lastDepositRequestId,proto3" json:"last_deposit_request_id,omitempty"` + LastWithdrawRequestId uint64 `protobuf:"varint,6,opt,name=last_withdraw_request_id,json=lastWithdrawRequestId,proto3" json:"last_withdraw_request_id,omitempty"` + Disabled bool `protobuf:"varint,7,opt,name=disabled,proto3" json:"disabled,omitempty"` + AppId uint64 `protobuf:"varint,8,opt,name=app_id,json=appId,proto3" json:"app_id,omitempty"` + Type PoolType `protobuf:"varint,9,opt,name=type,proto3,enum=comdex.liquidity.v1beta1.PoolType" json:"type,omitempty"` + Creator string `protobuf:"bytes,10,opt,name=creator,proto3" json:"creator,omitempty"` + MinPrice *github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,11,opt,name=min_price,json=minPrice,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"min_price,omitempty"` + MaxPrice *github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,12,opt,name=max_price,json=maxPrice,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"max_price,omitempty"` +} + +func (m *Pool) Reset() { *m = Pool{} } +func (m *Pool) String() string { return proto.CompactTextString(m) } +func (*Pool) ProtoMessage() {} +func (*Pool) Descriptor() ([]byte, []int) { + return fileDescriptor_579dcc42096fa86d, []int{1} +} +func (m *Pool) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Pool) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Pool.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Pool) XXX_Merge(src proto.Message) { + xxx_messageInfo_Pool.Merge(m, src) +} +func (m *Pool) XXX_Size() int { + return m.Size() +} +func (m *Pool) XXX_DiscardUnknown() { + xxx_messageInfo_Pool.DiscardUnknown(m) +} + +var xxx_messageInfo_Pool proto.InternalMessageInfo + +// DepositRequest defines a deposit request. +type DepositRequest struct { + // id specifies the id for the request + Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + // pool_id specifies the pool id + PoolId uint64 `protobuf:"varint,2,opt,name=pool_id,json=poolId,proto3" json:"pool_id,omitempty"` + // msg_height specifies the block height when the request is stored for the batch execution + MsgHeight int64 `protobuf:"varint,3,opt,name=msg_height,json=msgHeight,proto3" json:"msg_height,omitempty"` + // depositor specifies the bech32-encoded address that makes a deposit to the pool + Depositor string `protobuf:"bytes,4,opt,name=depositor,proto3" json:"depositor,omitempty"` + // deposit_coins specifies the amount of coins to deposit. + DepositCoins github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,5,rep,name=deposit_coins,json=depositCoins,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"deposit_coins"` + // accepted_coins specifies the amount of coins that are accepted. + AcceptedCoins github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,6,rep,name=accepted_coins,json=acceptedCoins,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"accepted_coins"` + MintedPoolCoin types.Coin `protobuf:"bytes,7,opt,name=minted_pool_coin,json=mintedPoolCoin,proto3" json:"minted_pool_coin"` + Status RequestStatus `protobuf:"varint,8,opt,name=status,proto3,enum=comdex.liquidity.v1beta1.RequestStatus" json:"status,omitempty"` + AppId uint64 `protobuf:"varint,9,opt,name=app_id,json=appId,proto3" json:"app_id,omitempty"` +} + +func (m *DepositRequest) Reset() { *m = DepositRequest{} } +func (m *DepositRequest) String() string { return proto.CompactTextString(m) } +func (*DepositRequest) ProtoMessage() {} +func (*DepositRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_579dcc42096fa86d, []int{2} +} +func (m *DepositRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DepositRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_DepositRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *DepositRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_DepositRequest.Merge(m, src) +} +func (m *DepositRequest) XXX_Size() int { + return m.Size() +} +func (m *DepositRequest) XXX_DiscardUnknown() { + xxx_messageInfo_DepositRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_DepositRequest proto.InternalMessageInfo + +// WithdrawRequest defines a withdraw request. +type WithdrawRequest struct { + // id specifies the id for the request + Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + // pool_id specifies the pool id + PoolId uint64 `protobuf:"varint,2,opt,name=pool_id,json=poolId,proto3" json:"pool_id,omitempty"` + // msg_height specifies the block height when the request is stored for the batch execution + MsgHeight int64 `protobuf:"varint,3,opt,name=msg_height,json=msgHeight,proto3" json:"msg_height,omitempty"` + // withdrawer specifies the bech32-encoded address that withdraws pool coin from the pool + Withdrawer string `protobuf:"bytes,4,opt,name=withdrawer,proto3" json:"withdrawer,omitempty"` + // pool_coin specifies the pool coin that is a proof of liquidity provider for the pool + PoolCoin types.Coin `protobuf:"bytes,5,opt,name=pool_coin,json=poolCoin,proto3" json:"pool_coin"` + // withdrawn_coins specifies the amount of coins that are withdrawn. + WithdrawnCoins github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,6,rep,name=withdrawn_coins,json=withdrawnCoins,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"withdrawn_coins"` + Status RequestStatus `protobuf:"varint,7,opt,name=status,proto3,enum=comdex.liquidity.v1beta1.RequestStatus" json:"status,omitempty"` + AppId uint64 `protobuf:"varint,8,opt,name=app_id,json=appId,proto3" json:"app_id,omitempty"` +} + +func (m *WithdrawRequest) Reset() { *m = WithdrawRequest{} } +func (m *WithdrawRequest) String() string { return proto.CompactTextString(m) } +func (*WithdrawRequest) ProtoMessage() {} +func (*WithdrawRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_579dcc42096fa86d, []int{3} +} +func (m *WithdrawRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *WithdrawRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_WithdrawRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *WithdrawRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_WithdrawRequest.Merge(m, src) +} +func (m *WithdrawRequest) XXX_Size() int { + return m.Size() +} +func (m *WithdrawRequest) XXX_DiscardUnknown() { + xxx_messageInfo_WithdrawRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_WithdrawRequest proto.InternalMessageInfo + +// Order defines an order. +type Order struct { + // id specifies the id for the request + Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + // pair_id specifies the pair id + PairId uint64 `protobuf:"varint,2,opt,name=pair_id,json=pairId,proto3" json:"pair_id,omitempty"` + // msg_height specifies the block height when the request is stored for the batch execution + MsgHeight int64 `protobuf:"varint,3,opt,name=msg_height,json=msgHeight,proto3" json:"msg_height,omitempty"` + // orderer specifies the bech32-encoded address that makes an order + Orderer string `protobuf:"bytes,4,opt,name=orderer,proto3" json:"orderer,omitempty"` + // direction specifies the order direction; either buy or sell + Direction OrderDirection `protobuf:"varint,5,opt,name=direction,proto3,enum=comdex.liquidity.v1beta1.OrderDirection" json:"direction,omitempty"` + OfferCoin types.Coin `protobuf:"bytes,6,opt,name=offer_coin,json=offerCoin,proto3" json:"offer_coin"` + // remaining_offer_coin specifies the remaining offer coin + RemainingOfferCoin types.Coin `protobuf:"bytes,7,opt,name=remaining_offer_coin,json=remainingOfferCoin,proto3" json:"remaining_offer_coin"` + // received_coin specifies the received coin after the swap + ReceivedCoin types.Coin `protobuf:"bytes,8,opt,name=received_coin,json=receivedCoin,proto3" json:"received_coin"` + // price specifies the price that an orderer is willing to swap + Price github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,9,opt,name=price,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"price"` + Amount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,10,opt,name=amount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"amount"` + OpenAmount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,11,opt,name=open_amount,json=openAmount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"open_amount"` + // batch_id specifies the pair's batch id when the request is stored + BatchId uint64 `protobuf:"varint,12,opt,name=batch_id,json=batchId,proto3" json:"batch_id,omitempty"` + ExpireAt time.Time `protobuf:"bytes,13,opt,name=expire_at,json=expireAt,proto3,stdtime" json:"expire_at"` + Status OrderStatus `protobuf:"varint,14,opt,name=status,proto3,enum=comdex.liquidity.v1beta1.OrderStatus" json:"status,omitempty"` + AppId uint64 `protobuf:"varint,15,opt,name=app_id,json=appId,proto3" json:"app_id,omitempty"` + // type specifies the typo of the order + Type OrderType `protobuf:"varint,16,opt,name=type,proto3,enum=comdex.liquidity.v1beta1.OrderType" json:"type,omitempty"` +} + +func (m *Order) Reset() { *m = Order{} } +func (m *Order) String() string { return proto.CompactTextString(m) } +func (*Order) ProtoMessage() {} +func (*Order) Descriptor() ([]byte, []int) { + return fileDescriptor_579dcc42096fa86d, []int{4} +} +func (m *Order) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Order) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Order.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Order) XXX_Merge(src proto.Message) { + xxx_messageInfo_Order.Merge(m, src) +} +func (m *Order) XXX_Size() int { + return m.Size() +} +func (m *Order) XXX_DiscardUnknown() { + xxx_messageInfo_Order.DiscardUnknown(m) +} + +var xxx_messageInfo_Order proto.InternalMessageInfo + +// MMOrderIndex defines an index type to quickly find market making orders +// from an orderer. +type MMOrderIndex struct { + Orderer string `protobuf:"bytes,1,opt,name=orderer,proto3" json:"orderer,omitempty"` + AppId uint64 `protobuf:"varint,2,opt,name=app_id,json=appId,proto3" json:"app_id,omitempty"` + PairId uint64 `protobuf:"varint,3,opt,name=pair_id,json=pairId,proto3" json:"pair_id,omitempty"` + OrderIds []uint64 `protobuf:"varint,4,rep,packed,name=order_ids,json=orderIds,proto3" json:"order_ids,omitempty"` +} + +func (m *MMOrderIndex) Reset() { *m = MMOrderIndex{} } +func (m *MMOrderIndex) String() string { return proto.CompactTextString(m) } +func (*MMOrderIndex) ProtoMessage() {} +func (*MMOrderIndex) Descriptor() ([]byte, []int) { + return fileDescriptor_579dcc42096fa86d, []int{5} +} +func (m *MMOrderIndex) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MMOrderIndex) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MMOrderIndex.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MMOrderIndex) XXX_Merge(src proto.Message) { + xxx_messageInfo_MMOrderIndex.Merge(m, src) +} +func (m *MMOrderIndex) XXX_Size() int { + return m.Size() +} +func (m *MMOrderIndex) XXX_DiscardUnknown() { + xxx_messageInfo_MMOrderIndex.DiscardUnknown(m) +} + +var xxx_messageInfo_MMOrderIndex proto.InternalMessageInfo + +type ActiveFarmer struct { + AppId uint64 `protobuf:"varint,1,opt,name=app_id,json=appId,proto3" json:"app_id,omitempty"` + PoolId uint64 `protobuf:"varint,2,opt,name=pool_id,json=poolId,proto3" json:"pool_id,omitempty"` + Farmer string `protobuf:"bytes,3,opt,name=farmer,proto3" json:"farmer,omitempty"` + FarmedPoolCoin github_com_cosmos_cosmos_sdk_types.Coin `protobuf:"bytes,4,opt,name=farmed_pool_coin,json=farmedPoolCoin,proto3,casttype=github.com/cosmos/cosmos-sdk/types.Coin" json:"farmed_pool_coin"` +} + +func (m *ActiveFarmer) Reset() { *m = ActiveFarmer{} } +func (m *ActiveFarmer) String() string { return proto.CompactTextString(m) } +func (*ActiveFarmer) ProtoMessage() {} +func (*ActiveFarmer) Descriptor() ([]byte, []int) { + return fileDescriptor_579dcc42096fa86d, []int{6} +} +func (m *ActiveFarmer) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ActiveFarmer) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ActiveFarmer.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ActiveFarmer) XXX_Merge(src proto.Message) { + xxx_messageInfo_ActiveFarmer.Merge(m, src) +} +func (m *ActiveFarmer) XXX_Size() int { + return m.Size() +} +func (m *ActiveFarmer) XXX_DiscardUnknown() { + xxx_messageInfo_ActiveFarmer.DiscardUnknown(m) +} + +var xxx_messageInfo_ActiveFarmer proto.InternalMessageInfo + +type QueuedCoin struct { + FarmedPoolCoin github_com_cosmos_cosmos_sdk_types.Coin `protobuf:"bytes,1,opt,name=farmed_pool_coin,json=farmedPoolCoin,proto3,casttype=github.com/cosmos/cosmos-sdk/types.Coin" json:"farmed_pool_coin"` + CreatedAt time.Time `protobuf:"bytes,2,opt,name=created_at,json=createdAt,proto3,stdtime" json:"created_at" yaml:"created_at"` +} + +func (m *QueuedCoin) Reset() { *m = QueuedCoin{} } +func (m *QueuedCoin) String() string { return proto.CompactTextString(m) } +func (*QueuedCoin) ProtoMessage() {} +func (*QueuedCoin) Descriptor() ([]byte, []int) { + return fileDescriptor_579dcc42096fa86d, []int{7} +} +func (m *QueuedCoin) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueuedCoin) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueuedCoin.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueuedCoin) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueuedCoin.Merge(m, src) +} +func (m *QueuedCoin) XXX_Size() int { + return m.Size() +} +func (m *QueuedCoin) XXX_DiscardUnknown() { + xxx_messageInfo_QueuedCoin.DiscardUnknown(m) +} + +var xxx_messageInfo_QueuedCoin proto.InternalMessageInfo + +type QueuedFarmer struct { + AppId uint64 `protobuf:"varint,1,opt,name=app_id,json=appId,proto3" json:"app_id,omitempty"` + PoolId uint64 `protobuf:"varint,2,opt,name=pool_id,json=poolId,proto3" json:"pool_id,omitempty"` + Farmer string `protobuf:"bytes,3,opt,name=farmer,proto3" json:"farmer,omitempty"` + QueudCoins []*QueuedCoin `protobuf:"bytes,4,rep,name=queud_coins,json=queudCoins,proto3" json:"queud_coins,omitempty"` +} + +func (m *QueuedFarmer) Reset() { *m = QueuedFarmer{} } +func (m *QueuedFarmer) String() string { return proto.CompactTextString(m) } +func (*QueuedFarmer) ProtoMessage() {} +func (*QueuedFarmer) Descriptor() ([]byte, []int) { + return fileDescriptor_579dcc42096fa86d, []int{8} +} +func (m *QueuedFarmer) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueuedFarmer) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueuedFarmer.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueuedFarmer) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueuedFarmer.Merge(m, src) +} +func (m *QueuedFarmer) XXX_Size() int { + return m.Size() +} +func (m *QueuedFarmer) XXX_DiscardUnknown() { + xxx_messageInfo_QueuedFarmer.DiscardUnknown(m) +} + +var xxx_messageInfo_QueuedFarmer proto.InternalMessageInfo + +func init() { + proto.RegisterEnum("comdex.liquidity.v1beta1.PoolType", PoolType_name, PoolType_value) + proto.RegisterEnum("comdex.liquidity.v1beta1.OrderType", OrderType_name, OrderType_value) + proto.RegisterEnum("comdex.liquidity.v1beta1.OrderDirection", OrderDirection_name, OrderDirection_value) + proto.RegisterEnum("comdex.liquidity.v1beta1.RequestStatus", RequestStatus_name, RequestStatus_value) + proto.RegisterEnum("comdex.liquidity.v1beta1.OrderStatus", OrderStatus_name, OrderStatus_value) + proto.RegisterEnum("comdex.liquidity.v1beta1.AddressType", AddressType_name, AddressType_value) + proto.RegisterType((*Pair)(nil), "comdex.liquidity.v1beta1.Pair") + proto.RegisterType((*Pool)(nil), "comdex.liquidity.v1beta1.Pool") + proto.RegisterType((*DepositRequest)(nil), "comdex.liquidity.v1beta1.DepositRequest") + proto.RegisterType((*WithdrawRequest)(nil), "comdex.liquidity.v1beta1.WithdrawRequest") + proto.RegisterType((*Order)(nil), "comdex.liquidity.v1beta1.Order") + proto.RegisterType((*MMOrderIndex)(nil), "comdex.liquidity.v1beta1.MMOrderIndex") + proto.RegisterType((*ActiveFarmer)(nil), "comdex.liquidity.v1beta1.ActiveFarmer") + proto.RegisterType((*QueuedCoin)(nil), "comdex.liquidity.v1beta1.QueuedCoin") + proto.RegisterType((*QueuedFarmer)(nil), "comdex.liquidity.v1beta1.QueuedFarmer") +} + +func init() { + proto.RegisterFile("comdex/liquidity/v1beta1/liquidity.proto", fileDescriptor_579dcc42096fa86d) +} + +var fileDescriptor_579dcc42096fa86d = []byte{ + // 1850 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x58, 0xcd, 0x73, 0x1a, 0xc9, + 0x15, 0xd7, 0x00, 0x42, 0xf0, 0x90, 0x10, 0x6e, 0x4b, 0x36, 0xc2, 0x6b, 0x44, 0x91, 0xac, 0x4d, + 0xb9, 0x6a, 0xc1, 0xc6, 0x49, 0x9c, 0x8f, 0xdd, 0x4d, 0xf1, 0x31, 0xda, 0x9d, 0x0a, 0x08, 0x3c, + 0xa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0x68, 0xf7, 0x27, 0x70, 0x6b, 0x09, 0xbd, 0xdf, 0xe9, 0x0f, 0xe4, 0x27, 0x72, 0xe3, 0xa0, + 0x2f, 0x37, 0x33, 0xd2, 0x39, 0xf0, 0x7d, 0x93, 0xca, 0x27, 0x58, 0x9f, 0x52, 0x6c, 0xa0, 0x1f, + 0x42, 0x76, 0x09, 0xde, 0x3b, 0x68, 0x34, 0x64, 0xb9, 0xc9, 0xab, 0x28, 0x37, 0x9b, 0x17, 0x6e, + 0x84, 0xb0, 0xbd, 0xa9, 0xae, 0x63, 0x6c, 0x60, 0x83, 0xd5, 0xf4, 0x12, 0x72, 0xaf, 0xa6, 0xb4, + 0xe4, 0x66, 0x26, 0x2a, 0x6a, 0x3a, 0x04, 0xdb, 0xd3, 0xc8, 0xc8, 0xaf, 0xc0, 0xdf, 0x45, 0x21, + 0x15, 0x98, 0x23, 0xcc, 0x06, 0x11, 0xca, 0x73, 0xdd, 0xe7, 0x36, 0x04, 0xd8, 0x83, 0xce, 0xff, + 0x08, 0x76, 0x42, 0xc8, 0x25, 0xd7, 0x97, 0xa1, 0x41, 0xc7, 0x1f, 0x2d, 0x29, 0x65, 0xd0, 0x76, + 0xad, 0xdf, 0xf8, 0x9c, 0x3b, 0xbe, 0x33, 0x9b, 0x17, 0xb6, 0xc3, 0xc8, 0x36, 0x9b, 0xb7, 0xd8, + 0x40, 0x0d, 0xc8, 0x87, 0x80, 0xdd, 0x9a, 0xda, 0x57, 0x6a, 0xad, 0xd6, 0x53, 0x1f, 0x1e, 0xcd, + 0xed, 0xce, 0xe6, 0x85, 0x5b, 0x01, 0x78, 0x57, 0xb3, 0x29, 0xd1, 0x46, 0xa3, 0x53, 0x4f, 0x88, + 0xdf, 0x76, 0xae, 0x90, 0x46, 0xa7, 0xdd, 0x6d, 0xc9, 0xcc, 0xea, 0x58, 0xa0, 0xed, 0x04, 0xb8, + 0x61, 0x8e, 0xad, 0x11, 0xa6, 0x22, 0xe4, 0x61, 0x54, 0x6d, 0xbf, 0x21, 0xb3, 0x90, 0xaf, 0x8a, + 0x90, 0x07, 0x41, 0xda, 0x44, 0xc7, 0xec, 0x53, 0xd9, 0xaf, 0x53, 0x17, 0x23, 0x3f, 0xe9, 0x2a, + 0xaa, 0xdc, 0xcc, 0xc4, 0x03, 0x75, 0x2a, 0x20, 0x32, 0x5f, 0x07, 0xbc, 0x24, 0x9d, 0x42, 0xca, + 0xfd, 0x85, 0x80, 0xbf, 0x13, 0x0f, 0x60, 0xbb, 0xd6, 0x6c, 0xaa, 0x72, 0xaf, 0x27, 0xba, 0xf3, + 0x61, 0x75, 0x50, 0x7f, 0xda, 0x97, 0x7b, 0x99, 0x15, 0x21, 0x27, 0xc0, 0xfb, 0xb0, 0x5a, 0x3f, + 0xa5, 0xd8, 0x79, 0x03, 0x52, 0xbd, 0xef, 0x42, 0xa4, 0x37, 0x20, 0xd5, 0xfb, 0x1c, 0x22, 0x54, + 0xd7, 0x1f, 0xbf, 0xfc, 0x67, 0x7e, 0xe5, 0xe5, 0xab, 0xbc, 0xf4, 0xd5, 0xab, 0xbc, 0xf4, 0x8f, + 0x57, 0x79, 0xe9, 0xcb, 0xd7, 0xf9, 0x95, 0xaf, 0x5e, 0xe7, 0x57, 0xfe, 0xfa, 0x3a, 0xbf, 0xf2, + 0x8b, 0x87, 0xa1, 0x59, 0xc4, 0x1e, 0xe5, 0x8f, 0xcc, 0xa3, 0x23, 0xa2, 0x13, 0x6d, 0xe4, 0x9e, + 0x2b, 0xc1, 0x5f, 0xd0, 0xf8, 0x70, 0x3a, 0x8c, 0xf3, 0x59, 0xf3, 0xf0, 0x7f, 0x01, 0x00, 0x00, + 0xff, 0xff, 0x8d, 0x52, 0xec, 0x37, 0x62, 0x13, 0x00, 0x00, +} + +func (m *Pair) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Pair) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Pair) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.AppId != 0 { + i = encodeVarintLiquidity(dAtA, i, uint64(m.AppId)) + i-- + dAtA[i] = 0x48 + } + if len(m.SwapFeeCollectorAddress) > 0 { + i -= len(m.SwapFeeCollectorAddress) + copy(dAtA[i:], m.SwapFeeCollectorAddress) + i = encodeVarintLiquidity(dAtA, i, uint64(len(m.SwapFeeCollectorAddress))) + i-- + dAtA[i] = 0x42 + } + if m.CurrentBatchId != 0 { + i = encodeVarintLiquidity(dAtA, i, uint64(m.CurrentBatchId)) + i-- + dAtA[i] = 0x38 + } + if m.LastPrice != nil { + { + size := m.LastPrice.Size() + i -= size + if _, err := m.LastPrice.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintLiquidity(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + } + if m.LastOrderId != 0 { + i = encodeVarintLiquidity(dAtA, i, uint64(m.LastOrderId)) + i-- + dAtA[i] = 0x28 + } + if len(m.EscrowAddress) > 0 { + i -= len(m.EscrowAddress) + copy(dAtA[i:], m.EscrowAddress) + i = encodeVarintLiquidity(dAtA, i, uint64(len(m.EscrowAddress))) + i-- + dAtA[i] = 0x22 + } + if len(m.QuoteCoinDenom) > 0 { + i -= len(m.QuoteCoinDenom) + copy(dAtA[i:], m.QuoteCoinDenom) + i = encodeVarintLiquidity(dAtA, i, uint64(len(m.QuoteCoinDenom))) + i-- + dAtA[i] = 0x1a + } + if len(m.BaseCoinDenom) > 0 { + i -= len(m.BaseCoinDenom) + copy(dAtA[i:], m.BaseCoinDenom) + i = encodeVarintLiquidity(dAtA, i, uint64(len(m.BaseCoinDenom))) + i-- + dAtA[i] = 0x12 + } + if m.Id != 0 { + i = encodeVarintLiquidity(dAtA, i, uint64(m.Id)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *Pool) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Pool) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Pool) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.MaxPrice != nil { + { + size := m.MaxPrice.Size() + i -= size + if _, err := m.MaxPrice.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintLiquidity(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x62 + } + if m.MinPrice != nil { + { + size := m.MinPrice.Size() + i -= size + if _, err := m.MinPrice.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintLiquidity(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x5a + } + if len(m.Creator) > 0 { + i -= len(m.Creator) + copy(dAtA[i:], m.Creator) + i = encodeVarintLiquidity(dAtA, i, uint64(len(m.Creator))) + i-- + dAtA[i] = 0x52 + } + if m.Type != 0 { + i = encodeVarintLiquidity(dAtA, i, uint64(m.Type)) + i-- + dAtA[i] = 0x48 + } + if m.AppId != 0 { + i = encodeVarintLiquidity(dAtA, i, uint64(m.AppId)) + i-- + dAtA[i] = 0x40 + } + if m.Disabled { + i-- + if m.Disabled { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x38 + } + if m.LastWithdrawRequestId != 0 { + i = encodeVarintLiquidity(dAtA, i, uint64(m.LastWithdrawRequestId)) + i-- + dAtA[i] = 0x30 + } + if m.LastDepositRequestId != 0 { + i = encodeVarintLiquidity(dAtA, i, uint64(m.LastDepositRequestId)) + i-- + dAtA[i] = 0x28 + } + if len(m.PoolCoinDenom) > 0 { + i -= len(m.PoolCoinDenom) + copy(dAtA[i:], m.PoolCoinDenom) + i = encodeVarintLiquidity(dAtA, i, uint64(len(m.PoolCoinDenom))) + i-- + dAtA[i] = 0x22 + } + if len(m.ReserveAddress) > 0 { + i -= len(m.ReserveAddress) + copy(dAtA[i:], m.ReserveAddress) + i = encodeVarintLiquidity(dAtA, i, uint64(len(m.ReserveAddress))) + i-- + dAtA[i] = 0x1a + } + if m.PairId != 0 { + i = encodeVarintLiquidity(dAtA, i, uint64(m.PairId)) + i-- + dAtA[i] = 0x10 + } + if m.Id != 0 { + i = encodeVarintLiquidity(dAtA, i, uint64(m.Id)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *DepositRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *DepositRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DepositRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.AppId != 0 { + i = encodeVarintLiquidity(dAtA, i, uint64(m.AppId)) + i-- + dAtA[i] = 0x48 + } + if m.Status != 0 { + i = encodeVarintLiquidity(dAtA, i, uint64(m.Status)) + i-- + dAtA[i] = 0x40 + } + { + size, err := m.MintedPoolCoin.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintLiquidity(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3a + if len(m.AcceptedCoins) > 0 { + for iNdEx := len(m.AcceptedCoins) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.AcceptedCoins[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintLiquidity(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + } + } + if len(m.DepositCoins) > 0 { + for iNdEx := len(m.DepositCoins) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.DepositCoins[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintLiquidity(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + } + } + if len(m.Depositor) > 0 { + i -= len(m.Depositor) + copy(dAtA[i:], m.Depositor) + i = encodeVarintLiquidity(dAtA, i, uint64(len(m.Depositor))) + i-- + dAtA[i] = 0x22 + } + if m.MsgHeight != 0 { + i = encodeVarintLiquidity(dAtA, i, uint64(m.MsgHeight)) + i-- + dAtA[i] = 0x18 + } + if m.PoolId != 0 { + i = encodeVarintLiquidity(dAtA, i, uint64(m.PoolId)) + i-- + dAtA[i] = 0x10 + } + if m.Id != 0 { + i = encodeVarintLiquidity(dAtA, i, uint64(m.Id)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *WithdrawRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *WithdrawRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *WithdrawRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.AppId != 0 { + i = encodeVarintLiquidity(dAtA, i, uint64(m.AppId)) + i-- + dAtA[i] = 0x40 + } + if m.Status != 0 { + i = encodeVarintLiquidity(dAtA, i, uint64(m.Status)) + i-- + dAtA[i] = 0x38 + } + if len(m.WithdrawnCoins) > 0 { + for iNdEx := len(m.WithdrawnCoins) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.WithdrawnCoins[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintLiquidity(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + } + } + { + size, err := m.PoolCoin.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintLiquidity(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + if len(m.Withdrawer) > 0 { + i -= len(m.Withdrawer) + copy(dAtA[i:], m.Withdrawer) + i = encodeVarintLiquidity(dAtA, i, uint64(len(m.Withdrawer))) + i-- + dAtA[i] = 0x22 + } + if m.MsgHeight != 0 { + i = encodeVarintLiquidity(dAtA, i, uint64(m.MsgHeight)) + i-- + dAtA[i] = 0x18 + } + if m.PoolId != 0 { + i = encodeVarintLiquidity(dAtA, i, uint64(m.PoolId)) + i-- + dAtA[i] = 0x10 + } + if m.Id != 0 { + i = encodeVarintLiquidity(dAtA, i, uint64(m.Id)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *Order) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Order) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Order) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Type != 0 { + i = encodeVarintLiquidity(dAtA, i, uint64(m.Type)) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x80 + } + if m.AppId != 0 { + i = encodeVarintLiquidity(dAtA, i, uint64(m.AppId)) + i-- + dAtA[i] = 0x78 + } + if m.Status != 0 { + i = encodeVarintLiquidity(dAtA, i, uint64(m.Status)) + i-- + dAtA[i] = 0x70 + } + n3, err3 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.ExpireAt, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.ExpireAt):]) + if err3 != nil { + return 0, err3 + } + i -= n3 + i = encodeVarintLiquidity(dAtA, i, uint64(n3)) + i-- + dAtA[i] = 0x6a + if m.BatchId != 0 { + i = encodeVarintLiquidity(dAtA, i, uint64(m.BatchId)) + i-- + dAtA[i] = 0x60 + } + { + size := m.OpenAmount.Size() + i -= size + if _, err := m.OpenAmount.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintLiquidity(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x5a + { + size := m.Amount.Size() + i -= size + if _, err := m.Amount.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintLiquidity(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x52 + { + size := m.Price.Size() + i -= size + if _, err := m.Price.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintLiquidity(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x4a + { + size, err := m.ReceivedCoin.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintLiquidity(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x42 + { + size, err := m.RemainingOfferCoin.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintLiquidity(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3a + { + size, err := m.OfferCoin.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintLiquidity(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + if m.Direction != 0 { + i = encodeVarintLiquidity(dAtA, i, uint64(m.Direction)) + i-- + dAtA[i] = 0x28 + } + if len(m.Orderer) > 0 { + i -= len(m.Orderer) + copy(dAtA[i:], m.Orderer) + i = encodeVarintLiquidity(dAtA, i, uint64(len(m.Orderer))) + i-- + dAtA[i] = 0x22 + } + if m.MsgHeight != 0 { + i = encodeVarintLiquidity(dAtA, i, uint64(m.MsgHeight)) + i-- + dAtA[i] = 0x18 + } + if m.PairId != 0 { + i = encodeVarintLiquidity(dAtA, i, uint64(m.PairId)) + i-- + dAtA[i] = 0x10 + } + if m.Id != 0 { + i = encodeVarintLiquidity(dAtA, i, uint64(m.Id)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *MMOrderIndex) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MMOrderIndex) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MMOrderIndex) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.OrderIds) > 0 { + dAtA8 := make([]byte, len(m.OrderIds)*10) + var j7 int + for _, num := range m.OrderIds { + for num >= 1<<7 { + dAtA8[j7] = uint8(uint64(num)&0x7f | 0x80) + num >>= 7 + j7++ + } + dAtA8[j7] = uint8(num) + j7++ + } + i -= j7 + copy(dAtA[i:], dAtA8[:j7]) + i = encodeVarintLiquidity(dAtA, i, uint64(j7)) + i-- + dAtA[i] = 0x22 + } + if m.PairId != 0 { + i = encodeVarintLiquidity(dAtA, i, uint64(m.PairId)) + i-- + dAtA[i] = 0x18 + } + if m.AppId != 0 { + i = encodeVarintLiquidity(dAtA, i, uint64(m.AppId)) + i-- + dAtA[i] = 0x10 + } + if len(m.Orderer) > 0 { + i -= len(m.Orderer) + copy(dAtA[i:], m.Orderer) + i = encodeVarintLiquidity(dAtA, i, uint64(len(m.Orderer))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *ActiveFarmer) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ActiveFarmer) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ActiveFarmer) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.FarmedPoolCoin.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintLiquidity(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + if len(m.Farmer) > 0 { + i -= len(m.Farmer) + copy(dAtA[i:], m.Farmer) + i = encodeVarintLiquidity(dAtA, i, uint64(len(m.Farmer))) + i-- + dAtA[i] = 0x1a + } + if m.PoolId != 0 { + i = encodeVarintLiquidity(dAtA, i, uint64(m.PoolId)) + i-- + dAtA[i] = 0x10 + } + if m.AppId != 0 { + i = encodeVarintLiquidity(dAtA, i, uint64(m.AppId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueuedCoin) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueuedCoin) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueuedCoin) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + n10, err10 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.CreatedAt, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.CreatedAt):]) + if err10 != nil { + return 0, err10 + } + i -= n10 + i = encodeVarintLiquidity(dAtA, i, uint64(n10)) + i-- + dAtA[i] = 0x12 + { + size, err := m.FarmedPoolCoin.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintLiquidity(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *QueuedFarmer) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueuedFarmer) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueuedFarmer) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.QueudCoins) > 0 { + for iNdEx := len(m.QueudCoins) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.QueudCoins[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintLiquidity(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + } + if len(m.Farmer) > 0 { + i -= len(m.Farmer) + copy(dAtA[i:], m.Farmer) + i = encodeVarintLiquidity(dAtA, i, uint64(len(m.Farmer))) + i-- + dAtA[i] = 0x1a + } + if m.PoolId != 0 { + i = encodeVarintLiquidity(dAtA, i, uint64(m.PoolId)) + i-- + dAtA[i] = 0x10 + } + if m.AppId != 0 { + i = encodeVarintLiquidity(dAtA, i, uint64(m.AppId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarintLiquidity(dAtA []byte, offset int, v uint64) int { + offset -= sovLiquidity(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Pair) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Id != 0 { + n += 1 + sovLiquidity(uint64(m.Id)) + } + l = len(m.BaseCoinDenom) + if l > 0 { + n += 1 + l + sovLiquidity(uint64(l)) + } + l = len(m.QuoteCoinDenom) + if l > 0 { + n += 1 + l + sovLiquidity(uint64(l)) + } + l = len(m.EscrowAddress) + if l > 0 { + n += 1 + l + sovLiquidity(uint64(l)) + } + if m.LastOrderId != 0 { + n += 1 + sovLiquidity(uint64(m.LastOrderId)) + } + if m.LastPrice != nil { + l = m.LastPrice.Size() + n += 1 + l + sovLiquidity(uint64(l)) + } + if m.CurrentBatchId != 0 { + n += 1 + sovLiquidity(uint64(m.CurrentBatchId)) + } + l = len(m.SwapFeeCollectorAddress) + if l > 0 { + n += 1 + l + sovLiquidity(uint64(l)) + } + if m.AppId != 0 { + n += 1 + sovLiquidity(uint64(m.AppId)) + } + return n +} + +func (m *Pool) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Id != 0 { + n += 1 + sovLiquidity(uint64(m.Id)) + } + if m.PairId != 0 { + n += 1 + sovLiquidity(uint64(m.PairId)) + } + l = len(m.ReserveAddress) + if l > 0 { + n += 1 + l + sovLiquidity(uint64(l)) + } + l = len(m.PoolCoinDenom) + if l > 0 { + n += 1 + l + sovLiquidity(uint64(l)) + } + if m.LastDepositRequestId != 0 { + n += 1 + sovLiquidity(uint64(m.LastDepositRequestId)) + } + if m.LastWithdrawRequestId != 0 { + n += 1 + sovLiquidity(uint64(m.LastWithdrawRequestId)) + } + if m.Disabled { + n += 2 + } + if m.AppId != 0 { + n += 1 + sovLiquidity(uint64(m.AppId)) + } + if m.Type != 0 { + n += 1 + sovLiquidity(uint64(m.Type)) + } + l = len(m.Creator) + if l > 0 { + n += 1 + l + sovLiquidity(uint64(l)) + } + if m.MinPrice != nil { + l = m.MinPrice.Size() + n += 1 + l + sovLiquidity(uint64(l)) + } + if m.MaxPrice != nil { + l = m.MaxPrice.Size() + n += 1 + l + sovLiquidity(uint64(l)) + } + return n +} + +func (m *DepositRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Id != 0 { + n += 1 + sovLiquidity(uint64(m.Id)) + } + if m.PoolId != 0 { + n += 1 + sovLiquidity(uint64(m.PoolId)) + } + if m.MsgHeight != 0 { + n += 1 + sovLiquidity(uint64(m.MsgHeight)) + } + l = len(m.Depositor) + if l > 0 { + n += 1 + l + sovLiquidity(uint64(l)) + } + if len(m.DepositCoins) > 0 { + for _, e := range m.DepositCoins { + l = e.Size() + n += 1 + l + sovLiquidity(uint64(l)) + } + } + if len(m.AcceptedCoins) > 0 { + for _, e := range m.AcceptedCoins { + l = e.Size() + n += 1 + l + sovLiquidity(uint64(l)) + } + } + l = m.MintedPoolCoin.Size() + n += 1 + l + sovLiquidity(uint64(l)) + if m.Status != 0 { + n += 1 + sovLiquidity(uint64(m.Status)) + } + if m.AppId != 0 { + n += 1 + sovLiquidity(uint64(m.AppId)) + } + return n +} + +func (m *WithdrawRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Id != 0 { + n += 1 + sovLiquidity(uint64(m.Id)) + } + if m.PoolId != 0 { + n += 1 + sovLiquidity(uint64(m.PoolId)) + } + if m.MsgHeight != 0 { + n += 1 + sovLiquidity(uint64(m.MsgHeight)) + } + l = len(m.Withdrawer) + if l > 0 { + n += 1 + l + sovLiquidity(uint64(l)) + } + l = m.PoolCoin.Size() + n += 1 + l + sovLiquidity(uint64(l)) + if len(m.WithdrawnCoins) > 0 { + for _, e := range m.WithdrawnCoins { + l = e.Size() + n += 1 + l + sovLiquidity(uint64(l)) + } + } + if m.Status != 0 { + n += 1 + sovLiquidity(uint64(m.Status)) + } + if m.AppId != 0 { + n += 1 + sovLiquidity(uint64(m.AppId)) + } + return n +} + +func (m *Order) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Id != 0 { + n += 1 + sovLiquidity(uint64(m.Id)) + } + if m.PairId != 0 { + n += 1 + sovLiquidity(uint64(m.PairId)) + } + if m.MsgHeight != 0 { + n += 1 + sovLiquidity(uint64(m.MsgHeight)) + } + l = len(m.Orderer) + if l > 0 { + n += 1 + l + sovLiquidity(uint64(l)) + } + if m.Direction != 0 { + n += 1 + sovLiquidity(uint64(m.Direction)) + } + l = m.OfferCoin.Size() + n += 1 + l + sovLiquidity(uint64(l)) + l = m.RemainingOfferCoin.Size() + n += 1 + l + sovLiquidity(uint64(l)) + l = m.ReceivedCoin.Size() + n += 1 + l + sovLiquidity(uint64(l)) + l = m.Price.Size() + n += 1 + l + sovLiquidity(uint64(l)) + l = m.Amount.Size() + n += 1 + l + sovLiquidity(uint64(l)) + l = m.OpenAmount.Size() + n += 1 + l + sovLiquidity(uint64(l)) + if m.BatchId != 0 { + n += 1 + sovLiquidity(uint64(m.BatchId)) + } + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.ExpireAt) + n += 1 + l + sovLiquidity(uint64(l)) + if m.Status != 0 { + n += 1 + sovLiquidity(uint64(m.Status)) + } + if m.AppId != 0 { + n += 1 + sovLiquidity(uint64(m.AppId)) + } + if m.Type != 0 { + n += 2 + sovLiquidity(uint64(m.Type)) + } + return n +} + +func (m *MMOrderIndex) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Orderer) + if l > 0 { + n += 1 + l + sovLiquidity(uint64(l)) + } + if m.AppId != 0 { + n += 1 + sovLiquidity(uint64(m.AppId)) + } + if m.PairId != 0 { + n += 1 + sovLiquidity(uint64(m.PairId)) + } + if len(m.OrderIds) > 0 { + l = 0 + for _, e := range m.OrderIds { + l += sovLiquidity(uint64(e)) + } + n += 1 + sovLiquidity(uint64(l)) + l + } + return n +} + +func (m *ActiveFarmer) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.AppId != 0 { + n += 1 + sovLiquidity(uint64(m.AppId)) + } + if m.PoolId != 0 { + n += 1 + sovLiquidity(uint64(m.PoolId)) + } + l = len(m.Farmer) + if l > 0 { + n += 1 + l + sovLiquidity(uint64(l)) + } + l = m.FarmedPoolCoin.Size() + n += 1 + l + sovLiquidity(uint64(l)) + return n +} + +func (m *QueuedCoin) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.FarmedPoolCoin.Size() + n += 1 + l + sovLiquidity(uint64(l)) + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.CreatedAt) + n += 1 + l + sovLiquidity(uint64(l)) + return n +} + +func (m *QueuedFarmer) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.AppId != 0 { + n += 1 + sovLiquidity(uint64(m.AppId)) + } + if m.PoolId != 0 { + n += 1 + sovLiquidity(uint64(m.PoolId)) + } + l = len(m.Farmer) + if l > 0 { + n += 1 + l + sovLiquidity(uint64(l)) + } + if len(m.QueudCoins) > 0 { + for _, e := range m.QueudCoins { + l = e.Size() + n += 1 + l + sovLiquidity(uint64(l)) + } + } + return n +} + +func sovLiquidity(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozLiquidity(x uint64) (n int) { + return sovLiquidity(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Pair) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Pair: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Pair: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) + } + m.Id = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Id |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BaseCoinDenom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthLiquidity + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthLiquidity + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BaseCoinDenom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field QuoteCoinDenom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthLiquidity + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthLiquidity + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.QuoteCoinDenom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field EscrowAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthLiquidity + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthLiquidity + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.EscrowAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field LastOrderId", wireType) + } + m.LastOrderId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.LastOrderId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LastPrice", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthLiquidity + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthLiquidity + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var v github_com_cosmos_cosmos_sdk_types.Dec + m.LastPrice = &v + if err := m.LastPrice.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CurrentBatchId", wireType) + } + m.CurrentBatchId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CurrentBatchId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SwapFeeCollectorAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthLiquidity + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthLiquidity + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SwapFeeCollectorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 9: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AppId", wireType) + } + m.AppId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.AppId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipLiquidity(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthLiquidity + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Pool) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Pool: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Pool: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) + } + m.Id = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Id |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PairId", wireType) + } + m.PairId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.PairId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ReserveAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthLiquidity + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthLiquidity + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ReserveAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PoolCoinDenom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthLiquidity + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthLiquidity + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PoolCoinDenom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field LastDepositRequestId", wireType) + } + m.LastDepositRequestId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.LastDepositRequestId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field LastWithdrawRequestId", wireType) + } + m.LastWithdrawRequestId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.LastWithdrawRequestId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Disabled", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Disabled = bool(v != 0) + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AppId", wireType) + } + m.AppId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.AppId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 9: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) + } + m.Type = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Type |= PoolType(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 10: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthLiquidity + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthLiquidity + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Creator = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 11: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MinPrice", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthLiquidity + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthLiquidity + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var v github_com_cosmos_cosmos_sdk_types.Dec + m.MinPrice = &v + if err := m.MinPrice.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 12: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxPrice", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthLiquidity + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthLiquidity + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var v github_com_cosmos_cosmos_sdk_types.Dec + m.MaxPrice = &v + if err := m.MaxPrice.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipLiquidity(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthLiquidity + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DepositRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DepositRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DepositRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) + } + m.Id = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Id |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PoolId", wireType) + } + m.PoolId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.PoolId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MsgHeight", wireType) + } + m.MsgHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MsgHeight |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Depositor", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthLiquidity + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthLiquidity + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Depositor = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DepositCoins", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthLiquidity + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthLiquidity + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DepositCoins = append(m.DepositCoins, types.Coin{}) + if err := m.DepositCoins[len(m.DepositCoins)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AcceptedCoins", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthLiquidity + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthLiquidity + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AcceptedCoins = append(m.AcceptedCoins, types.Coin{}) + if err := m.AcceptedCoins[len(m.AcceptedCoins)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MintedPoolCoin", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthLiquidity + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthLiquidity + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.MintedPoolCoin.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + m.Status = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Status |= RequestStatus(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 9: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AppId", wireType) + } + m.AppId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.AppId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipLiquidity(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthLiquidity + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *WithdrawRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: WithdrawRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: WithdrawRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) + } + m.Id = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Id |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PoolId", wireType) + } + m.PoolId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.PoolId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MsgHeight", wireType) + } + m.MsgHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MsgHeight |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Withdrawer", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthLiquidity + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthLiquidity + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Withdrawer = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PoolCoin", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthLiquidity + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthLiquidity + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.PoolCoin.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field WithdrawnCoins", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthLiquidity + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthLiquidity + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.WithdrawnCoins = append(m.WithdrawnCoins, types.Coin{}) + if err := m.WithdrawnCoins[len(m.WithdrawnCoins)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + m.Status = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Status |= RequestStatus(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AppId", wireType) + } + m.AppId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.AppId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipLiquidity(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthLiquidity + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Order) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Order: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Order: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) + } + m.Id = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Id |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PairId", wireType) + } + m.PairId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.PairId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MsgHeight", wireType) + } + m.MsgHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MsgHeight |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Orderer", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthLiquidity + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthLiquidity + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Orderer = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Direction", wireType) + } + m.Direction = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Direction |= OrderDirection(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OfferCoin", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthLiquidity + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthLiquidity + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.OfferCoin.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RemainingOfferCoin", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthLiquidity + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthLiquidity + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RemainingOfferCoin.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ReceivedCoin", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthLiquidity + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthLiquidity + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ReceivedCoin.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Price", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthLiquidity + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthLiquidity + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Price.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 10: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthLiquidity + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthLiquidity + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 11: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OpenAmount", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthLiquidity + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthLiquidity + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.OpenAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 12: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BatchId", wireType) + } + m.BatchId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BatchId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 13: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ExpireAt", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthLiquidity + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthLiquidity + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.ExpireAt, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 14: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + m.Status = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Status |= OrderStatus(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 15: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AppId", wireType) + } + m.AppId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.AppId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 16: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) + } + m.Type = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Type |= OrderType(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipLiquidity(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthLiquidity + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MMOrderIndex) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MMOrderIndex: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MMOrderIndex: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Orderer", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthLiquidity + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthLiquidity + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Orderer = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AppId", wireType) + } + m.AppId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.AppId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PairId", wireType) + } + m.PairId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.PairId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType == 0 { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.OrderIds = append(m.OrderIds, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLengthLiquidity + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLengthLiquidity + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.OrderIds) == 0 { + m.OrderIds = make([]uint64, 0, elementCount) + } + for iNdEx < postIndex { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.OrderIds = append(m.OrderIds, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field OrderIds", wireType) + } + default: + iNdEx = preIndex + skippy, err := skipLiquidity(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthLiquidity + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ActiveFarmer) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ActiveFarmer: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ActiveFarmer: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AppId", wireType) + } + m.AppId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.AppId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PoolId", wireType) + } + m.PoolId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.PoolId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Farmer", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthLiquidity + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthLiquidity + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Farmer = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FarmedPoolCoin", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthLiquidity + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthLiquidity + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.FarmedPoolCoin.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipLiquidity(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthLiquidity + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueuedCoin) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueuedCoin: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueuedCoin: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FarmedPoolCoin", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthLiquidity + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthLiquidity + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.FarmedPoolCoin.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CreatedAt", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthLiquidity + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthLiquidity + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.CreatedAt, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipLiquidity(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthLiquidity + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueuedFarmer) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueuedFarmer: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueuedFarmer: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AppId", wireType) + } + m.AppId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.AppId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PoolId", wireType) + } + m.PoolId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.PoolId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Farmer", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthLiquidity + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthLiquidity + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Farmer = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field QueudCoins", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthLiquidity + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthLiquidity + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.QueudCoins = append(m.QueudCoins, &QueuedCoin{}) + if err := m.QueudCoins[len(m.QueudCoins)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipLiquidity(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthLiquidity + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipLiquidity(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowLiquidity + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowLiquidity + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowLiquidity + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthLiquidity + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupLiquidity + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthLiquidity + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthLiquidity = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowLiquidity = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupLiquidity = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/liquidity/legacy/v3/store.go b/x/liquidity/legacy/v3/store.go new file mode 100644 index 000000000..85dff6ac1 --- /dev/null +++ b/x/liquidity/legacy/v3/store.go @@ -0,0 +1,271 @@ +package v3 + +import ( + "fmt" + + "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" + + expected "github.com/comdex-official/comdex/x/liquidity/expected" + v2liquidity "github.com/comdex-official/comdex/x/liquidity/legacy/v2" + "github.com/comdex-official/comdex/x/liquidity/types" +) + +func GetPair( + store sdk.KVStore, + cdc codec.BinaryCodec, + appID, pairID uint64, +) (pair types.Pair, found bool) { + bz := store.Get(types.GetPairKey(appID, pairID)) + if bz == nil { + return + } + pair = types.MustUnmarshalPair(cdc, bz) + return pair, true +} + +func IterateAllPools( + store sdk.KVStore, + cdc codec.BinaryCodec, + appID uint64, cb func(pool types.Pool) (stop bool, err error), +) error { + iter := sdk.KVStorePrefixIterator(store, types.GetAllPoolsKey(appID)) + defer func(iter sdk.Iterator) { + err := iter.Close() + if err != nil { + return + } + }(iter) + for ; iter.Valid(); iter.Next() { + pool := types.MustUnmarshalPool(cdc, iter.Value()) + stop, err := cb(pool) + if err != nil { + return err + } + if stop { + break + } + } + return nil +} + +func GetAllPools( + store sdk.KVStore, + cdc codec.BinaryCodec, + appID uint64, +) (pools []types.Pool) { + pools = []types.Pool{} + _ = IterateAllPools(store, cdc, appID, func(pool types.Pool) (stop bool, err error) { + pools = append(pools, pool) + return false, nil + }) + return +} + +func IterateAllActiveFarmers( + store sdk.KVStore, + cdc codec.BinaryCodec, + appID, poolID uint64, + cb func(activeFarmer types.ActiveFarmer) (stop bool, err error), +) error { + iter := sdk.KVStorePrefixIterator(store, types.GetAllActiveFarmersKey(appID, poolID)) + defer func(iter sdk.Iterator) { + err := iter.Close() + if err != nil { + return + } + }(iter) + for ; iter.Valid(); iter.Next() { + activeFarmer := types.MustUnmarshalActiveFarmer(cdc, iter.Value()) + stop, err := cb(activeFarmer) + if err != nil { + return err + } + if stop { + break + } + } + return nil +} + +func GetAllActiveFarmers( + store sdk.KVStore, + cdc codec.BinaryCodec, + appID, poolID uint64, +) (activeFarmers []types.ActiveFarmer) { + activeFarmers = []types.ActiveFarmer{} + _ = IterateAllActiveFarmers(store, cdc, appID, poolID, func(activeFarmer types.ActiveFarmer) (stop bool, err error) { + activeFarmers = append(activeFarmers, activeFarmer) + return false, nil + }) + return activeFarmers +} + +func IterateAllQueuedFarmers( + store sdk.KVStore, + cdc codec.BinaryCodec, + appID, poolID uint64, + cb func(queuedFarmer types.QueuedFarmer) (stop bool, err error), +) error { + iter := sdk.KVStorePrefixIterator(store, types.GetAllQueuedFarmersKey(appID, poolID)) + defer func(iter sdk.Iterator) { + err := iter.Close() + if err != nil { + return + } + }(iter) + for ; iter.Valid(); iter.Next() { + queuedFarmer := types.MustUnmarshalQueuedFarmer(cdc, iter.Value()) + stop, err := cb(queuedFarmer) + if err != nil { + return err + } + if stop { + break + } + } + return nil +} + +func GetAllQueuedFarmers( + store sdk.KVStore, + cdc codec.BinaryCodec, + appID, poolID uint64, +) (queuedFarmers []types.QueuedFarmer) { + queuedFarmers = []types.QueuedFarmer{} + _ = IterateAllQueuedFarmers(store, cdc, appID, poolID, func(queuedFarmer types.QueuedFarmer) (stop bool, err error) { + queuedFarmers = append(queuedFarmers, queuedFarmer) + return false, nil + }) + return queuedFarmers +} + +func MigratePools( + ctx sdk.Context, + store sdk.KVStore, + cdc codec.BinaryCodec, + assetKeeper expected.AssetKeeper, + appID uint64, +) error { + iter := sdk.KVStorePrefixIterator(store, types.GetAllPoolsKey(appID)) + defer func(iter sdk.Iterator) { + err := iter.Close() + if err != nil { + return + } + }(iter) + for ; iter.Valid(); iter.Next() { + var oldPool v2liquidity.Pool + if err := cdc.Unmarshal(iter.Value(), &oldPool); err != nil { + return err + } + pair, found := GetPair(store, cdc, appID, oldPool.Id) + if !found { + return fmt.Errorf("pair %d not found", oldPool.PairId) + } + + baseAsset, found := assetKeeper.GetAssetForDenom(ctx, pair.BaseCoinDenom) + if !found { + return fmt.Errorf("baseAsset %s not found", pair.BaseCoinDenom) + } + quoteAsset, found := assetKeeper.GetAssetForDenom(ctx, pair.QuoteCoinDenom) + if !found { + return fmt.Errorf("quoteAsset %s not found", pair.QuoteCoinDenom) + } + + newPool := types.Pool{ + Id: oldPool.Id, + PairId: oldPool.PairId, + ReserveAddress: oldPool.ReserveAddress, + PoolCoinDenom: oldPool.PoolCoinDenom, + LastDepositRequestId: oldPool.LastDepositRequestId, + LastWithdrawRequestId: oldPool.LastWithdrawRequestId, + Disabled: oldPool.Disabled, + AppId: oldPool.AppId, + Type: types.PoolTypeBasic, + Creator: oldPool.Creator, + MinPrice: oldPool.MinPrice, + MaxPrice: oldPool.MaxPrice, + FarmCoin: &types.FarmCoin{ + Denom: types.FarmCoinDenom(appID, oldPool.Id), + Decimals: types.FarmCoinDecimals(baseAsset.Decimals.Uint64(), quoteAsset.Decimals.Uint64()), + }, + } + bz, err := cdc.Marshal(&newPool) + if err != nil { + return err + } + store.Set(iter.Key(), bz) + } + return nil +} + +func MintAndSendHelper(ctx sdk.Context, bankKeeper expected.BankKeeper, farmer sdk.AccAddress, farmCoin sdk.Coin) error { + if err := bankKeeper.MintCoins(ctx, types.ModuleName, sdk.NewCoins(farmCoin)); err != nil { + return err + } + if err := bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, farmer, sdk.NewCoins(farmCoin)); err != nil { + return err + } + return nil +} + +func MintFarmTokenAndTransferToAccounts( + ctx sdk.Context, + store sdk.KVStore, + cdc codec.BinaryCodec, + bankKeeper expected.BankKeeper, + appID uint64, +) error { + allPools := GetAllPools(store, cdc, appID) + for _, pool := range allPools { + if !pool.Disabled { + allActiveFarmers := GetAllActiveFarmers(store, cdc, appID, pool.Id) + for _, afarmer := range allActiveFarmers { + farmer := sdk.MustAccAddressFromBech32(afarmer.Farmer) + farmCoin := sdk.NewCoin(pool.FarmCoin.Denom, afarmer.FarmedPoolCoin.Amount) + if err := MintAndSendHelper(ctx, bankKeeper, farmer, farmCoin); err != nil { + return err + } + } + + allQueuedFarmer := GetAllQueuedFarmers(store, cdc, appID, pool.Id) + for _, qfarmer := range allQueuedFarmer { + farmer := sdk.MustAccAddressFromBech32(qfarmer.Farmer) + farmCoin := sdk.NewCoin(pool.FarmCoin.Denom, sdk.ZeroInt()) + for _, qCoin := range qfarmer.QueudCoins { + farmCoin.Amount = farmCoin.Amount.Add(qCoin.FarmedPoolCoin.Amount) + } + if err := MintAndSendHelper(ctx, bankKeeper, farmer, farmCoin); err != nil { + return err + } + } + } + } + + return nil +} + +func MigrateStore( + ctx sdk.Context, + assetKeeper expected.AssetKeeper, + bankKeeper expected.BankKeeper, + storeKey sdk.StoreKey, + cdc codec.BinaryCodec, +) error { + allApps, found := assetKeeper.GetApps(ctx) + cacheCtx, writeCache := ctx.CacheContext() + if found { + for _, app := range allApps { + store := cacheCtx.KVStore(storeKey) + if err := MigratePools(cacheCtx, store, cdc, assetKeeper, app.Id); err != nil { + panic(err) + } + if err := MintFarmTokenAndTransferToAccounts(cacheCtx, store, cdc, bankKeeper, app.Id); err != nil { + panic(err) + } + } + } + writeCache() + return nil +} diff --git a/x/liquidity/legacy/v3/store_test.go b/x/liquidity/legacy/v3/store_test.go new file mode 100644 index 000000000..0640081e3 --- /dev/null +++ b/x/liquidity/legacy/v3/store_test.go @@ -0,0 +1 @@ +package v3_test diff --git a/x/liquidity/module.go b/x/liquidity/module.go index 6262f4f17..96f961edd 100644 --- a/x/liquidity/module.go +++ b/x/liquidity/module.go @@ -145,6 +145,10 @@ func (am AppModule) RegisterServices(cfg module.Configurator) { if err := cfg.RegisterMigration(types.ModuleName, 1, m.Migrate1to2); err != nil { panic(err) } + + if err := cfg.RegisterMigration(types.ModuleName, 2, m.Migrate2to3); err != nil { + panic(err) + } } // RegisterInvariants registers the capability module's invariants. @@ -167,7 +171,7 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw } // ConsensusVersion implements ConsensusVersion. -func (AppModule) ConsensusVersion() uint64 { return 2 } +func (AppModule) ConsensusVersion() uint64 { return 3 } // BeginBlock executes all ABCI BeginBlock logic respective to the capability module. func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) { From 7ea6eee0c425348dd58ede401577b0add3107d7a Mon Sep 17 00:00:00 2001 From: Vishnu Kumavat Date: Sat, 4 Mar 2023 03:34:48 +0530 Subject: [PATCH 12/14] liquidity migration code update --- x/liquidity/legacy/v2/liquidity.pb.go | 22 ---------------------- x/liquidity/legacy/v3/store.go | 4 ++-- 2 files changed, 2 insertions(+), 24 deletions(-) diff --git a/x/liquidity/legacy/v2/liquidity.pb.go b/x/liquidity/legacy/v2/liquidity.pb.go index b0548bff1..abf9be0c5 100644 --- a/x/liquidity/legacy/v2/liquidity.pb.go +++ b/x/liquidity/legacy/v2/liquidity.pb.go @@ -662,28 +662,6 @@ func (m *QueuedFarmer) XXX_DiscardUnknown() { var xxx_messageInfo_QueuedFarmer proto.InternalMessageInfo -func init() { - proto.RegisterEnum("comdex.liquidity.v1beta1.PoolType", PoolType_name, PoolType_value) - proto.RegisterEnum("comdex.liquidity.v1beta1.OrderType", OrderType_name, OrderType_value) - proto.RegisterEnum("comdex.liquidity.v1beta1.OrderDirection", OrderDirection_name, OrderDirection_value) - proto.RegisterEnum("comdex.liquidity.v1beta1.RequestStatus", RequestStatus_name, RequestStatus_value) - proto.RegisterEnum("comdex.liquidity.v1beta1.OrderStatus", OrderStatus_name, OrderStatus_value) - proto.RegisterEnum("comdex.liquidity.v1beta1.AddressType", AddressType_name, AddressType_value) - proto.RegisterType((*Pair)(nil), "comdex.liquidity.v1beta1.Pair") - proto.RegisterType((*Pool)(nil), "comdex.liquidity.v1beta1.Pool") - proto.RegisterType((*DepositRequest)(nil), "comdex.liquidity.v1beta1.DepositRequest") - proto.RegisterType((*WithdrawRequest)(nil), "comdex.liquidity.v1beta1.WithdrawRequest") - proto.RegisterType((*Order)(nil), "comdex.liquidity.v1beta1.Order") - proto.RegisterType((*MMOrderIndex)(nil), "comdex.liquidity.v1beta1.MMOrderIndex") - proto.RegisterType((*ActiveFarmer)(nil), "comdex.liquidity.v1beta1.ActiveFarmer") - proto.RegisterType((*QueuedCoin)(nil), "comdex.liquidity.v1beta1.QueuedCoin") - proto.RegisterType((*QueuedFarmer)(nil), "comdex.liquidity.v1beta1.QueuedFarmer") -} - -func init() { - proto.RegisterFile("comdex/liquidity/v1beta1/liquidity.proto", fileDescriptor_579dcc42096fa86d) -} - var fileDescriptor_579dcc42096fa86d = []byte{ // 1850 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x58, 0xcd, 0x73, 0x1a, 0xc9, diff --git a/x/liquidity/legacy/v3/store.go b/x/liquidity/legacy/v3/store.go index 85dff6ac1..a948f15cb 100644 --- a/x/liquidity/legacy/v3/store.go +++ b/x/liquidity/legacy/v3/store.go @@ -159,9 +159,9 @@ func MigratePools( if err := cdc.Unmarshal(iter.Value(), &oldPool); err != nil { return err } - pair, found := GetPair(store, cdc, appID, oldPool.Id) + pair, found := GetPair(store, cdc, appID, oldPool.PairId) if !found { - return fmt.Errorf("pair %d not found", oldPool.PairId) + return fmt.Errorf("pair %d not found in app %d", oldPool.PairId, appID) } baseAsset, found := assetKeeper.GetAssetForDenom(ctx, pair.BaseCoinDenom) From 84371368b3f79b9209868c643dfd88fa0908c1fc Mon Sep 17 00:00:00 2001 From: Vishnu Kumavat Date: Sat, 4 Mar 2023 03:38:18 +0530 Subject: [PATCH 13/14] amount check before mint in migration --- x/liquidity/legacy/v3/store.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/x/liquidity/legacy/v3/store.go b/x/liquidity/legacy/v3/store.go index a948f15cb..d253613ff 100644 --- a/x/liquidity/legacy/v3/store.go +++ b/x/liquidity/legacy/v3/store.go @@ -224,8 +224,10 @@ func MintFarmTokenAndTransferToAccounts( for _, afarmer := range allActiveFarmers { farmer := sdk.MustAccAddressFromBech32(afarmer.Farmer) farmCoin := sdk.NewCoin(pool.FarmCoin.Denom, afarmer.FarmedPoolCoin.Amount) - if err := MintAndSendHelper(ctx, bankKeeper, farmer, farmCoin); err != nil { - return err + if farmCoin.Amount.IsPositive() { + if err := MintAndSendHelper(ctx, bankKeeper, farmer, farmCoin); err != nil { + return err + } } } @@ -236,8 +238,10 @@ func MintFarmTokenAndTransferToAccounts( for _, qCoin := range qfarmer.QueudCoins { farmCoin.Amount = farmCoin.Amount.Add(qCoin.FarmedPoolCoin.Amount) } - if err := MintAndSendHelper(ctx, bankKeeper, farmer, farmCoin); err != nil { - return err + if farmCoin.Amount.IsPositive() { + if err := MintAndSendHelper(ctx, bankKeeper, farmer, farmCoin); err != nil { + return err + } } } } From 9e6008e414c1b9563d085e86f6c4cc1e3fc66aae Mon Sep 17 00:00:00 2001 From: Vishnu Kumavat Date: Mon, 6 Mar 2023 22:26:00 +0530 Subject: [PATCH 14/14] farm validation and ownership transfer added in vault and auction --- app/app.go | 2 ++ x/auction/expected/keeper.go | 4 ++++ x/auction/keeper/dutch.go | 14 ++++++++++++++ x/auction/keeper/keeper.go | 3 +++ x/auction/keeper/keeper_test.go | 3 ++- x/vault/expected/keeper.go | 4 ++++ x/vault/handler_test.go | 2 +- x/vault/keeper/keeper.go | 15 ++++++++++++++- x/vault/keeper/msg_server.go | 19 +++++++++++++++++++ 9 files changed, 63 insertions(+), 3 deletions(-) diff --git a/app/app.go b/app/app.go index 7b3b02d6b..56a19c0ab 100644 --- a/app/app.go +++ b/app/app.go @@ -599,6 +599,7 @@ func New( &app.EsmKeeper, &app.TokenmintKeeper, &app.Rewardskeeper, + &app.LiquidityKeeper, ) app.TokenmintKeeper = tokenmintkeeper.NewKeeper( @@ -669,6 +670,7 @@ func New( &app.TokenmintKeeper, &app.EsmKeeper, &app.LendKeeper, + &app.LiquidityKeeper, ) app.CollectorKeeper = collectorkeeper.NewKeeper( diff --git a/x/auction/expected/keeper.go b/x/auction/expected/keeper.go index 16f75bad6..94a355d9b 100644 --- a/x/auction/expected/keeper.go +++ b/x/auction/expected/keeper.go @@ -112,3 +112,7 @@ type LendKeeper interface { SetAllReserveStatsByAssetID(ctx sdk.Context, allReserveStats lendtypes.AllReserveStats) GetAllReserveStatsByAssetID(ctx sdk.Context, id uint64) (allReserveStats lendtypes.AllReserveStats, found bool) } + +type LiquidityKeeper interface { + TransferFarmCoinOwnership(ctx sdk.Context, from, to sdk.AccAddress, farmCoin sdk.Coin) error +} diff --git a/x/auction/keeper/dutch.go b/x/auction/keeper/dutch.go index 982a857a8..c8d5b5510 100644 --- a/x/auction/keeper/dutch.go +++ b/x/auction/keeper/dutch.go @@ -6,6 +6,7 @@ import ( "time" liquidationtypes "github.com/comdex-official/comdex/x/liquidation/types" + liquiditytypes "github.com/comdex-official/comdex/x/liquidity/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -264,6 +265,19 @@ func (k Keeper) PlaceDutchAuctionBid(ctx sdk.Context, appID, auctionMappingID, a return err } } + + // if the bid is on farm token, then we have the transfer the ownership of that farm token from vault owner to bidder. + if liquiditytypes.IsFarmCoinDenom(outFlowTokenCoin.Denom) { + vaultOwner, err := sdk.AccAddressFromBech32(lockedVault.Owner) + if err != nil { + return err + } + err = k.liquidity.TransferFarmCoinOwnership(ctx, vaultOwner, bidder, outFlowTokenCoin) + if err != nil { + return err + } + } + if outFlowTokenCoin.Amount.GT(sdk.ZeroInt()) { err = k.bank.SendCoinsFromModuleToAccount(ctx, auctiontypes.ModuleName, bidder, sdk.NewCoins(outFlowTokenCoin)) if err != nil { diff --git a/x/auction/keeper/keeper.go b/x/auction/keeper/keeper.go index f0fbb12df..f0aa54b89 100644 --- a/x/auction/keeper/keeper.go +++ b/x/auction/keeper/keeper.go @@ -29,6 +29,7 @@ type ( tokenMint expected.TokenMintKeeper esm expected.EsmKeeper lend expected.LendKeeper + liquidity expected.LiquidityKeeper } ) @@ -47,6 +48,7 @@ func NewKeeper( tokenMintKeeper expected.TokenMintKeeper, esm expected.EsmKeeper, lend expected.LendKeeper, + liquidity expected.LiquidityKeeper, ) Keeper { // set KeyTable if it has not already been set if !ps.HasKeyTable() { @@ -68,6 +70,7 @@ func NewKeeper( tokenMint: tokenMintKeeper, esm: esm, lend: lend, + liquidity: liquidity, } } diff --git a/x/auction/keeper/keeper_test.go b/x/auction/keeper/keeper_test.go index d0a2457c7..eeb35d7a9 100644 --- a/x/auction/keeper/keeper_test.go +++ b/x/auction/keeper/keeper_test.go @@ -1,10 +1,11 @@ package keeper_test import ( - lendkeeper "github.com/comdex-official/comdex/x/lend/keeper" "testing" "time" + lendkeeper "github.com/comdex-official/comdex/x/lend/keeper" + "github.com/stretchr/testify/suite" sdk "github.com/cosmos/cosmos-sdk/types" diff --git a/x/vault/expected/keeper.go b/x/vault/expected/keeper.go index b0ba1b0d8..4fede39e7 100644 --- a/x/vault/expected/keeper.go +++ b/x/vault/expected/keeper.go @@ -53,3 +53,7 @@ type RewardsKeeper interface { GetExternalRewardStableVaultByApp(ctx sdk.Context, appID uint64) (VaultExternalRewards rewardstypes.StableVaultExternalRewards, found bool) VerifyAppIDInRewards(ctx sdk.Context, appID uint64) bool } + +type LiquidityKeeper interface { + ValidateFarmCoinOwnershipByFarmer(ctx sdk.Context, farmCoin sdk.Coin, farmer sdk.AccAddress) error +} diff --git a/x/vault/handler_test.go b/x/vault/handler_test.go index 708f1d58b..f8b2e5f29 100644 --- a/x/vault/handler_test.go +++ b/x/vault/handler_test.go @@ -22,7 +22,7 @@ func TestInvalidMsg(t *testing.T) { app1.VaultKeeper = keeper.NewKeeper( app1.AppCodec(), app1.GetKey(types.StoreKey), app1.BankKeeper, &app1.AssetKeeper, &app1.MarketKeeper, &app1.CollectorKeeper, &app1.EsmKeeper, - app1.TokenmintKeeper, app1.Rewardskeeper) + app1.TokenmintKeeper, app1.Rewardskeeper, app1.LiquidityKeeper) h := vault.NewHandler(app1.VaultKeeper) res, err := h(sdk.NewContext(nil, tmproto.Header{}, false, nil), testdata.NewTestMsg()) diff --git a/x/vault/keeper/keeper.go b/x/vault/keeper/keeper.go index 356ca329d..486b661a9 100644 --- a/x/vault/keeper/keeper.go +++ b/x/vault/keeper/keeper.go @@ -21,9 +21,21 @@ type Keeper struct { esm expected.EsmKeeper tokenmint expected.TokenMintKeeper rewards expected.RewardsKeeper + liquidity expected.LiquidityKeeper } -func NewKeeper(cdc codec.BinaryCodec, key sdk.StoreKey, bank expected.BankKeeper, asset expected.AssetKeeper, oracle expected.MarketKeeper, collector expected.CollectorKeeper, esm expected.EsmKeeper, tokenmint expected.TokenMintKeeper, rewards expected.RewardsKeeper) Keeper { +func NewKeeper( + cdc codec.BinaryCodec, + key sdk.StoreKey, + bank expected.BankKeeper, + asset expected.AssetKeeper, + oracle expected.MarketKeeper, + collector expected.CollectorKeeper, + esm expected.EsmKeeper, + tokenmint expected.TokenMintKeeper, + rewards expected.RewardsKeeper, + liquidity expected.LiquidityKeeper, +) Keeper { return Keeper{ cdc: cdc, key: key, @@ -34,6 +46,7 @@ func NewKeeper(cdc codec.BinaryCodec, key sdk.StoreKey, bank expected.BankKeeper esm: esm, tokenmint: tokenmint, rewards: rewards, + liquidity: liquidity, } } diff --git a/x/vault/keeper/msg_server.go b/x/vault/keeper/msg_server.go index bdefa6d30..d217ef58d 100644 --- a/x/vault/keeper/msg_server.go +++ b/x/vault/keeper/msg_server.go @@ -8,6 +8,7 @@ import ( collectortypes "github.com/comdex-official/comdex/x/collector/types" esmtypes "github.com/comdex-official/comdex/x/esm/types" + liquiditytypes "github.com/comdex-official/comdex/x/liquidity/types" rewardstypes "github.com/comdex-official/comdex/x/rewards/types" "github.com/comdex-official/comdex/x/vault/types" ) @@ -99,6 +100,15 @@ func (k msgServer) MsgCreate(c context.Context, msg *types.MsgCreateRequest) (*t return nil, types.ErrorAmountOutGreaterThanDebtCeiling } + // if the collateral token in farm token, then validate if the vault creator is the actual owner of that farm token if not return error. + if liquiditytypes.IsFarmCoinDenom(assetInData.Denom) { + farmCoin := sdk.NewCoin(assetInData.Denom, msg.AmountIn) + err := k.liquidity.ValidateFarmCoinOwnershipByFarmer(ctx, farmCoin, depositorAddress) + if err != nil { + return nil, err + } + } + // Calculate CR - make necessary changes to calculate collateralization function if err := k.VerifyCollaterlizationRatio(ctx, extendedPairVault.Id, msg.AmountIn, msg.AmountOut, extendedPairVault.MinCr, status); err != nil { return nil, err @@ -278,6 +288,15 @@ func (k msgServer) MsgDeposit(c context.Context, msg *types.MsgDepositRequest) ( return nil, types.ErrorInvalidExtendedPairMappingData } + // if the collateral token in farm token, then validate if the vault creator is the actual owner of that farm token if not return error. + if liquiditytypes.IsFarmCoinDenom(assetInData.Denom) { + farmCoin := sdk.NewCoin(assetInData.Denom, msg.Amount) + err := k.liquidity.ValidateFarmCoinOwnershipByFarmer(ctx, farmCoin, depositor) + if err != nil { + return nil, err + } + } + totalDebt := userVault.AmountOut.Add(userVault.InterestAccumulated) err1 := k.rewards.CalculateVaultInterest(ctx, appMapping.Id, msg.ExtendedPairVaultId, msg.UserVaultId, totalDebt, userVault.BlockHeight, userVault.BlockTime.Unix()) if err1 != nil {