Skip to content

Commit

Permalink
Merge branch 'main' into stack/join-gov-prop
Browse files Browse the repository at this point in the history
  • Loading branch information
stackman27 authored Jul 26, 2023
2 parents d783275 + d804015 commit 9e63479
Show file tree
Hide file tree
Showing 24 changed files with 773 additions and 508 deletions.
51 changes: 0 additions & 51 deletions .github/workflows/test-e2e-makefile.yml

This file was deleted.

24 changes: 24 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,22 +45,46 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### State Breaking

* [#5532](https://github.com/osmosis-labs/osmosis/pull/5532) fix: Fix x/tokenfactory genesis import denoms reset x/bank existing denom metadata
* [#5874](https://github.com/osmosis-labs/osmosis/pull/5874) Remove Partial Migration from superfluid migration to CL

### BugFix

* [#5831](https://github.com/osmosis-labs/osmosis/pull/5831) Fix superfluid_delegations query
* [#5835](https://github.com/osmosis-labs/osmosis/pull/5835) Fix println's for "amountZeroInRemainingBigDec before fee" making it into production
* [#5841] (https://github.com/osmosis-labs/osmosis/pull/5841) Fix protorev's out of gas erroring of the user's transcation.

### Misc Improvements

* [#5534](https://github.com/osmosis-labs/osmosis/pull/5534) fix: fix the account number of x/tokenfactory module account
* [#5750](https://github.com/osmosis-labs/osmosis/pull/5750) feat: add cli commmand for converting proto structs to proto marshalled bytes
* [#5890](https://github.com/osmosis-labs/osmosis/pull/5890) feat: CreateCLPool & LinkCFMMtoCL pool into one gov-prop
* [#5893] (https://github.com/osmosis-labs/osmosis/pull/5893) Export createPosition method in CL so other modules can use it in testing

### Minor improvements & Bug Fixes

* [#5806](https://github.com/osmosis-labs/osmosis/issues/5806) ci: automatically close issues generated by the Broken Links Check action when a new run occurs.

## v16.1.1

### Security

* [#5824](https://github.com/osmosis-labs/osmosis/pull/5824) chore: cosmovisor hashes and v16.1.0 tag updates

### Features

* [#5796](https://github.com/osmosis-labs/osmosis/pull/5796) chore: add missing cli queries CL

### Misc Improvements & Bug Fixes

* [#5831](https://github.com/osmosis-labs/osmosis/pull/5831) Fix the superfluid query
* [#5784](https://github.com/osmosis-labs/osmosis/pull/5784) Chore: Add amino name for tx msgs

## v16.1.0

### Security

* [#5822](https://github.com/osmosis-labs/osmosis/pull/5822) Revert "feat: lock existing position and sfs"

## v16.0.0
Osmosis Labs is excited to announce the release of v16.0.0, a major upgrade that includes a number of new features and improvements like introduction of new modules, updates existing APIs, and dependency updates. This upgrade aims to enhance capital efficiency by introducing SuperCharged Liquidity, introduce custom liquidity pools backed by CosmWasm smart contracts, and improve overall functionality.

Expand Down
16 changes: 16 additions & 0 deletions proto/osmosis/gamm/v1beta1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import "cosmos/base/query/v1beta1/pagination.proto";
import "google/api/annotations.proto";
import "google/protobuf/any.proto";
import "cosmos_proto/cosmos.proto";
import "osmosis/gamm/v1beta1/shared.proto";

option go_package = "github.com/osmosis-labs/osmosis/v16/x/gamm/types";

Expand Down Expand Up @@ -115,6 +116,14 @@ service Query {
"/osmosis/gamm/v1beta1/concentrated_pool_id_link_from_cfmm/"
"{cfmm_pool_id}";
}

// CFMMConcentratedPoolLinks returns migration links between CFMM and
// Concentrated pools.
rpc CFMMConcentratedPoolLinks(QueryCFMMConcentratedPoolLinksRequest)
returns (QueryCFMMConcentratedPoolLinksResponse) {
option (google.api.http).get =
"/osmosis/gamm/v1beta1/cfmm_concentrated_pool_links";
}
}

//=============================== Pool
Expand Down Expand Up @@ -342,3 +351,10 @@ message QueryConcentratedPoolIdLinkFromCFMMRequest {
message QueryConcentratedPoolIdLinkFromCFMMResponse {
uint64 concentrated_pool_id = 1;
}

//=============================== QueryCFMMConcentratedPoolLinks
message QueryCFMMConcentratedPoolLinksRequest {}

message QueryCFMMConcentratedPoolLinksResponse {
MigrationRecords migration_records = 1;
}
53 changes: 27 additions & 26 deletions tests/e2e/configurer/chain/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -414,32 +414,33 @@ func (n *NodeConfig) VoteNoProposal(from string, proposalNumber int) {
n.LogActionF("successfully voted no on proposal: %d", proposalNumber)
}

func (n *NodeConfig) LockTokens(tokens string, duration string, from string) {
func (n *NodeConfig) LockTokens(tokens string, duration string, from string) int {
n.LogActionF("locking %s for %s", tokens, duration)
cmd := []string{"osmosisd", "tx", "lockup", "lock-tokens", tokens, fmt.Sprintf("--duration=%s", duration), fmt.Sprintf("--from=%s", from)}
_, _, err := n.containerManager.ExecTxCmd(n.t, n.chainId, n.Name, cmd)

resp, _, err := n.containerManager.ExecTxCmd(n.t, n.chainId, n.Name, cmd)
require.NoError(n.t, err)

// Extract the lock ID from the response
startIndex := strings.Index(resp.String(), `[{"key":"period_lock_id","value":"`) + len(`[{"key":"period_lock_id","value":"`)
endIndex := strings.Index(resp.String()[startIndex:], `"`)

// Extract the lock ID substring
lockIDStr := resp.String()[startIndex : startIndex+endIndex]

// Convert the lock ID from string to int
lockID, err := strconv.Atoi(lockIDStr)
require.NoError(n.t, err)

n.LogActionF("successfully created lock")

return lockID
}

func (n *NodeConfig) AddToExistingLock(tokens sdk.Int, denom, duration, from string) {
n.LogActionF("retrieving existing lock ID")
durationPath := fmt.Sprintf("/osmosis/lockup/v1beta1/account_locked_longer_duration/%s?duration=%s", from, duration)
bz, err := n.QueryGRPCGateway(durationPath)
require.NoError(n.t, err)
var accountLockedDurationResp lockuptypes.AccountLockedDurationResponse
err = util.Cdc.UnmarshalJSON(bz, &accountLockedDurationResp)
require.NoError(n.t, err)
var lockID string
for _, periodLock := range accountLockedDurationResp.Locks {
if periodLock.Coins.AmountOf(denom).GT(sdk.ZeroInt()) {
lockID = fmt.Sprintf("%v", periodLock.ID)
break
}
}
func (n *NodeConfig) AddToExistingLock(tokens sdk.Int, denom, duration, from string, lockID int) {
n.LogActionF("noting previous lockup amount")
path := fmt.Sprintf("/osmosis/lockup/v1beta1/locked_by_id/%s", lockID)
bz, err = n.QueryGRPCGateway(path)
path := fmt.Sprintf("/osmosis/lockup/v1beta1/locked_by_id/%d", lockID)
bz, err := n.QueryGRPCGateway(path)
require.NoError(n.t, err)
var lockedResp lockuptypes.LockedResponse
err = util.Cdc.UnmarshalJSON(bz, &lockedResp)
Expand Down Expand Up @@ -708,19 +709,19 @@ func (n *NodeConfig) EnableSuperfluidAsset(srcChain *Config, denom string) {

func (n *NodeConfig) LockAndAddToExistingLock(srcChain *Config, amount sdk.Int, denom, lockupWalletAddr, lockupWalletSuperfluidAddr string) {
// lock tokens
n.LockTokens(fmt.Sprintf("%v%s", amount, denom), "240s", lockupWalletAddr)
lockID := n.LockTokens(fmt.Sprintf("%v%s", amount, denom), "240s", lockupWalletAddr)
srcChain.LatestLockNumber += 1
fmt.Println("lock number: ", srcChain.LatestLockNumber)
fmt.Println("lock number: ", lockID)
// add to existing lock
n.AddToExistingLock(amount, denom, "240s", lockupWalletAddr)
n.AddToExistingLock(amount, denom, "240s", lockupWalletAddr, lockID)

// superfluid lock tokens
n.LockTokens(fmt.Sprintf("%v%s", amount, denom), "240s", lockupWalletSuperfluidAddr)
lockID = n.LockTokens(fmt.Sprintf("%v%s", amount, denom), "240s", lockupWalletSuperfluidAddr)
srcChain.LatestLockNumber += 1
fmt.Println("lock number: ", srcChain.LatestLockNumber)
n.SuperfluidDelegate(srcChain.LatestLockNumber, srcChain.NodeConfigs[1].OperatorAddress, lockupWalletSuperfluidAddr)
fmt.Println("lock number: ", lockID)
n.SuperfluidDelegate(lockID, srcChain.NodeConfigs[1].OperatorAddress, lockupWalletSuperfluidAddr)
// add to existing lock
n.AddToExistingLock(amount, denom, "240s", lockupWalletSuperfluidAddr)
n.AddToExistingLock(amount, denom, "240s", lockupWalletSuperfluidAddr, lockID)
}

// TODO remove chain from this as input
Expand Down
9 changes: 4 additions & 5 deletions tests/e2e/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -954,10 +954,9 @@ func (s *IntegrationTestSuite) SuperfluidVoting() {
// setup wallets and send gamm tokens to these wallets (both chains)
superfluidVotingWallet := chainANode.CreateWallet("TestSuperfluidVoting")
chainANode.BankSend(fmt.Sprintf("10000000000000000000gamm/pool/%d", poolId), chainA.NodeConfigs[2].PublicAddress, superfluidVotingWallet)
chainANode.LockTokens(fmt.Sprintf("%v%s", sdk.NewInt(1000000000000000000), fmt.Sprintf("gamm/pool/%d", poolId)), "240s", superfluidVotingWallet)
lockId := chainANode.LockTokens(fmt.Sprintf("%v%s", sdk.NewInt(1000000000000000000), fmt.Sprintf("gamm/pool/%d", poolId)), "240s", superfluidVotingWallet)
chainA.LatestLockNumber += 1
lastLockNumber := chainA.LatestLockNumber
chainANode.SuperfluidDelegate(lastLockNumber, chainA.NodeConfigs[2].OperatorAddress, superfluidVotingWallet)
chainANode.SuperfluidDelegate(lockId, chainA.NodeConfigs[2].OperatorAddress, superfluidVotingWallet)

// create a text prop, deposit and vote yes
chainANode.SubmitTextProposal("superfluid vote overwrite test", sdk.NewCoin(appparams.BaseCoinUnit, sdk.NewInt(config.InitialMinDeposit)), false)
Expand Down Expand Up @@ -1319,8 +1318,8 @@ func (s *IntegrationTestSuite) AddToExistingLockPostUpgrade() {
preUpgradePoolShareDenom := fmt.Sprintf("gamm/pool/%d", config.PreUpgradePoolId)

lockupWalletAddr, lockupWalletSuperfluidAddr := chainANode.GetWallet("lockup-wallet"), chainANode.GetWallet("lockup-wallet-superfluid")
chainANode.AddToExistingLock(sdk.NewInt(1000000000000000000), preUpgradePoolShareDenom, "240s", lockupWalletAddr)
chainANode.AddToExistingLock(sdk.NewInt(1000000000000000000), preUpgradePoolShareDenom, "240s", lockupWalletSuperfluidAddr)
chainANode.AddToExistingLock(sdk.NewInt(1000000000000000000), preUpgradePoolShareDenom, "240s", lockupWalletAddr, 1)
chainANode.AddToExistingLock(sdk.NewInt(1000000000000000000), preUpgradePoolShareDenom, "240s", lockupWalletSuperfluidAddr, 2)
}

// TestAddToExistingLock tests lockups to both regular and superfluid locks.
Expand Down
4 changes: 0 additions & 4 deletions x/concentrated-liquidity/export_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,10 +207,6 @@ func UpdatePositionToInitValuePlusGrowthOutside(accumulator *accum.AccumulatorOb
return updatePositionToInitValuePlusGrowthOutside(accumulator, positionKey, growthOutside)
}

func (k Keeper) CreatePosition(ctx sdk.Context, poolId uint64, owner sdk.AccAddress, tokensProvided sdk.Coins, amount0Min, amount1Min sdk.Int, lowerTick, upperTick int64) (positionId uint64, actualAmount0 sdk.Int, actualAmount1 sdk.Int, liquidityDelta sdk.Dec, lowerTickResult int64, upperTickResult int64, err error) {
return k.createPosition(ctx, poolId, owner, tokensProvided, amount0Min, amount1Min, lowerTick, upperTick)
}

func (k Keeper) AddToPosition(ctx sdk.Context, owner sdk.AccAddress, positionId uint64, amount0Added, amount1Added, amount0Min, amount1Min sdk.Int) (uint64, sdk.Int, sdk.Int, error) {
return k.addToPosition(ctx, owner, positionId, amount0Added, amount1Added, amount0Min, amount1Min)
}
Expand Down
4 changes: 2 additions & 2 deletions x/concentrated-liquidity/lp.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const noUnderlyingLockId = uint64(0)
// - the liquidity delta is zero
// - the amount0 or amount1 returned from the position update is less than the given minimums
// - the pool or user does not have enough tokens to satisfy the requested amount
func (k Keeper) createPosition(ctx sdk.Context, poolId uint64, owner sdk.AccAddress, tokensProvided sdk.Coins, amount0Min, amount1Min sdk.Int, lowerTick, upperTick int64) (positionId uint64, actualAmount0 sdk.Int, actualAmount1 sdk.Int, liquidityDelta sdk.Dec, lowerTickResult int64, upperTickResult int64, err error) {
func (k Keeper) CreatePosition(ctx sdk.Context, poolId uint64, owner sdk.AccAddress, tokensProvided sdk.Coins, amount0Min, amount1Min sdk.Int, lowerTick, upperTick int64) (positionId uint64, actualAmount0 sdk.Int, actualAmount1 sdk.Int, liquidityDelta sdk.Dec, lowerTickResult int64, upperTickResult int64, err error) {
// Use the current blockTime as the position's join time.
joinTime := ctx.BlockTime()

Expand Down Expand Up @@ -367,7 +367,7 @@ func (k Keeper) addToPosition(ctx sdk.Context, owner sdk.AccAddress, positionId
if !amount1MinGiven.IsZero() {
minimumAmount1 = amount1Withdrawn.Add(amount1MinGiven)
}
newPositionId, actualAmount0, actualAmount1, _, _, _, err := k.createPosition(ctx, position.PoolId, owner, tokensProvided, minimumAmount0, minimumAmount1, position.LowerTick, position.UpperTick)
newPositionId, actualAmount0, actualAmount1, _, _, _, err := k.CreatePosition(ctx, position.PoolId, owner, tokensProvided, minimumAmount0, minimumAmount1, position.LowerTick, position.UpperTick)
if err != nil {
return 0, sdk.Int{}, sdk.Int{}, err
}
Expand Down
2 changes: 1 addition & 1 deletion x/concentrated-liquidity/msg_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func (server msgServer) CreatePosition(goCtx context.Context, msg *types.MsgCrea
return nil, err
}

positionId, actualAmount0, actualAmount1, liquidityCreated, lowerTick, upperTick, err := server.keeper.createPosition(ctx, msg.PoolId, sender, msg.TokensProvided, msg.TokenMinAmount0, msg.TokenMinAmount1, msg.LowerTick, msg.UpperTick)
positionId, actualAmount0, actualAmount1, liquidityCreated, lowerTick, upperTick, err := server.keeper.CreatePosition(ctx, msg.PoolId, sender, msg.TokensProvided, msg.TokenMinAmount0, msg.TokenMinAmount1, msg.LowerTick, msg.UpperTick)
if err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion x/concentrated-liquidity/position.go
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ func (k Keeper) CreateFullRangePosition(ctx sdk.Context, poolId uint64, owner sd
}

// Create a full range (min to max tick) concentrated liquidity position.
positionId, amount0, amount1, liquidity, _, _, err = k.createPosition(ctx, concentratedPool.GetId(), owner, coins, sdk.ZeroInt(), sdk.ZeroInt(), types.MinInitializedTick, types.MaxTick)
positionId, amount0, amount1, liquidity, _, _, err = k.CreatePosition(ctx, concentratedPool.GetId(), owner, coins, sdk.ZeroInt(), sdk.ZeroInt(), types.MinInitializedTick, types.MaxTick)
if err != nil {
return 0, sdk.Int{}, sdk.Int{}, sdk.Dec{}, err
}
Expand Down
11 changes: 11 additions & 0 deletions x/gamm/client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ func GetQueryCmd() *cobra.Command {
osmocli.AddQueryCmd(cmd, types.NewQueryClient, GetCmdEstimateSwapExactAmountIn)
osmocli.AddQueryCmd(cmd, types.NewQueryClient, GetCmdEstimateSwapExactAmountOut)
osmocli.AddQueryCmd(cmd, types.NewQueryClient, GetConcentratedPoolIdLinkFromCFMMRequest)
osmocli.AddQueryCmd(cmd, types.NewQueryClient, GetCFMMConcentratedPoolLinksRequest)
cmd.AddCommand(
GetCmdNumPools(),
GetCmdPoolParams(),
Expand Down Expand Up @@ -350,3 +351,13 @@ Example:
types.ModuleName, types.NewQueryClient,
)
}

// GetConcentratedPoolIdLinkFromCFMMRequest returns all concentrated pool id to cfmm pool id links.
func GetCFMMConcentratedPoolLinksRequest() (*osmocli.QueryDescriptor, *types.QueryCFMMConcentratedPoolLinksRequest) {
return &osmocli.QueryDescriptor{
Use: "cfmm-cl-pool-links",
Short: "Query all concentrated pool and cfmm pool id links",
Long: `{{.Short}}{{.ExampleHeader}}
{{.CommandPrefix}} cfmm-cl-pool-links`,
}, &types.QueryCFMMConcentratedPoolLinksRequest{}
}
15 changes: 15 additions & 0 deletions x/gamm/keeper/grpc_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -503,3 +503,18 @@ func (q Querier) ConcentratedPoolIdLinkFromCFMM(ctx context.Context, req *types.
ConcentratedPoolId: poolIdEntering,
}, nil
}

func (q Querier) CFMMConcentratedPoolLinks(ctx context.Context, req *types.QueryCFMMConcentratedPoolLinksRequest) (*types.QueryCFMMConcentratedPoolLinksResponse, error) {
if req == nil {
return nil, status.Error(codes.InvalidArgument, "empty request")
}

poolLinks, err := q.Keeper.GetAllMigrationInfo(sdk.UnwrapSDKContext(ctx))
if err != nil {
return nil, err
}

return &types.QueryCFMMConcentratedPoolLinksResponse{
MigrationRecords: &poolLinks,
}, nil
}
Loading

0 comments on commit 9e63479

Please sign in to comment.