Skip to content

Commit

Permalink
Move mockgen, and minor changes from taker fee feature branch (osmosi…
Browse files Browse the repository at this point in the history
  • Loading branch information
czarcas7ic authored Aug 28, 2023
1 parent 89be360 commit 7f4e83e
Show file tree
Hide file tree
Showing 8 changed files with 171 additions and 11 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ LEDGER_ENABLED ?= true
SDK_PACK := $(shell go list -m github.com/cosmos/cosmos-sdk | sed 's/ /\@/g')
BUILDDIR ?= $(CURDIR)/build
DOCKER := $(shell which docker)
E2E_UPGRADE_VERSION := "v18"
E2E_UPGRADE_VERSION := "v19"
#SHELL := /bin/bash

GO_VERSION := $(shell cat go.mod | grep -E 'go [0-9].[0-9]+' | cut -d ' ' -f 2)
Expand Down Expand Up @@ -586,7 +586,7 @@ cl-create-bigbang-config:
###############################################################################

go-mock-update:
mockgen -source=x/poolmanager/types/routes.go -destination=tests/mocks/pool_module.go -package=mocks
mockgen -source=x/poolmanager/types/expected_keepers.go -destination=tests/mocks/pool_module.go -package=mocks
mockgen -source=x/poolmanager/types/pool.go -destination=tests/mocks/pool.go -package=mocks
mockgen -source=x/gamm/types/pool.go -destination=tests/mocks/cfmm_pool.go -package=mocks
mockgen -source=x/concentrated-liquidity/types/cl_pool_extensionI.go -destination=tests/mocks/cl_pool.go -package=mocks
Expand Down
4 changes: 2 additions & 2 deletions app/upgrades/v18/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
)

// OSMO / DAI CL pool ID
const firstCLPoolId = 1066
const FirstCLPoolId = 1066

func CreateUpgradeHandler(
mm *module.Manager,
Expand All @@ -28,7 +28,7 @@ func CreateUpgradeHandler(
return nil, err
}

for id := 1; id < firstCLPoolId; id++ {
for id := 1; id < FirstCLPoolId; id++ {
resetSumtree(keepers, ctx, uint64(id))
}
return migrations, nil
Expand Down
3 changes: 2 additions & 1 deletion app/upgrades/v18/upgrades_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ func (s *UpgradeTestSuite) TestUpgrade() {

// Swap
toSwap := sdk.NewCoin(pool.GetToken0(), sdk.NewInt(100))
s.FundAcc(s.TestAccs[0], sdk.NewCoins(toSwap))
_, err = s.App.ConcentratedLiquidityKeeper.SwapExactAmountIn(s.Ctx, s.TestAccs[0], updatedCLPool, toSwap, pool.GetToken1(), sdk.NewInt(1), sdk.ZeroDec())
s.Require().NoError(err)

Expand Down Expand Up @@ -233,7 +234,7 @@ func (suite *UpgradeTestSuite) ensurePreUpgradeDistributionPanics() {
suite.App.ConcentratedLiquidityKeeper.SetParams(suite.Ctx, clParams)

// prepare CL pool with the same denom as pool 3, which is the pool we are testing with
clPool := suite.PrepareConcentratedPoolWithCoins(v17.OSMO, v17.AKTIBCDenom)
clPool := suite.PrepareConcentratedPoolWithCoins(v17.AKTIBCDenom, v17.OSMO)
balancerToCLPoolLink := []gammmigration.BalancerToConcentratedPoolLink{
{
BalancerPoolId: 3,
Expand Down
78 changes: 78 additions & 0 deletions tests/mocks/cfmm_pool.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 31 additions & 4 deletions tests/mocks/cl_pool.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 26 additions & 0 deletions tests/mocks/pool.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 29 additions & 1 deletion tests/mocks/pool_module.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion x/concentrated-liquidity/model/pool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ func (s *ConcentratedPoolTestSuite) TestString() {
pool, err := model.NewConcentratedLiquidityPool(1, "foo", "bar", DefaultTickSpacing, DefaultSpreadFactor)
s.Require().NoError(err)
poolString := pool.String()
s.Require().Equal(poolString, "{\"address\":\"osmo19e2mf7cywkv7zaug6nk5f87d07fxrdgrladvymh2gwv5crvm3vnsuewhh7\",\"incentives_address\":\"osmo156gncm3w2hdvuxxaejue8nejxgdgsrvdf7jftntuhxnaarhxcuas4ywjxf\",\"spread_rewards_address\":\"osmo10t3u6ze74jn7et6rluuxyf9vr2arykewmhcx67svg6heuu0gte2syfudcv\",\"id\":1,\"current_tick_liquidity\":\"0.000000000000000000\",\"token0\":\"foo\",\"token1\":\"bar\",\"current_sqrt_price\":\"0.000000000000000000000000000000000000\",\"tick_spacing\":1,\"exponent_at_price_one\":-6,\"spread_factor\":\"0.010000000000000000\",\"last_liquidity_update\":\"0001-01-01T00:00:00Z\"}")
s.Require().Equal("{\"address\":\"osmo19e2mf7cywkv7zaug6nk5f87d07fxrdgrladvymh2gwv5crvm3vnsuewhh7\",\"incentives_address\":\"osmo156gncm3w2hdvuxxaejue8nejxgdgsrvdf7jftntuhxnaarhxcuas4ywjxf\",\"spread_rewards_address\":\"osmo10t3u6ze74jn7et6rluuxyf9vr2arykewmhcx67svg6heuu0gte2syfudcv\",\"id\":1,\"current_tick_liquidity\":\"0.000000000000000000\",\"token0\":\"foo\",\"token1\":\"bar\",\"current_sqrt_price\":\"0.000000000000000000000000000000000000\",\"tick_spacing\":1,\"exponent_at_price_one\":-6,\"spread_factor\":\"0.010000000000000000\",\"last_liquidity_update\":\"0001-01-01T00:00:00Z\"}", poolString)
}

// TestSpotPrice tests the SpotPrice method of the ConcentratedPoolTestSuite.
Expand Down

0 comments on commit 7f4e83e

Please sign in to comment.