Skip to content

Commit

Permalink
Disable Stableswap (#1523)
Browse files Browse the repository at this point in the history
Closes: #1503 

## What is the purpose of the change

The upcoming V9 upgrade should be including the gamm generalization, but not stable swap implementations. 
This PR removes(comments out) stable swap inplementation and existing stableswap calls, which was to my surprise only present in `msg_sever.go` and `module.go`. 




## Brief Changelog
  - Remove stableswap implementation from gamm module
## Testing and Verifying

This change is a trivial rework / code cleanup without any test coverage.


## Documentation and Release Note

  - Does this pull request introduce a new feature or user-facing behavior changes? no
  - Is a relevant changelog entry added to the `Unreleased` section in `CHANGELOG.md`? no
  - How is the feature or change documented? (not applicable   /   specification (`x/<module>/spec/`)  /  [Osmosis docs repo](https://github.com/osmosis-labs/docs)   /   not documented)
  • Loading branch information
mattverse committed May 17, 2022
1 parent ffc1d46 commit d3af599
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 20 deletions.
31 changes: 15 additions & 16 deletions x/gamm/keeper/msg_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"

"github.com/osmosis-labs/osmosis/v7/x/gamm/pool-models/balancer"
"github.com/osmosis-labs/osmosis/v7/x/gamm/pool-models/stableswap"
"github.com/osmosis-labs/osmosis/v7/x/gamm/types"
)

Expand All @@ -27,30 +26,30 @@ func NewBalancerMsgServerImpl(keeper *Keeper) balancer.MsgServer {
}
}

func NewStableswapMsgServerImpl(keeper *Keeper) stableswap.MsgServer {
return &msgServer{
keeper: keeper,
}
}
// func NewStableswapMsgServerImpl(keeper *Keeper) stableswap.MsgServer {
// return &msgServer{
// keeper: keeper,
// }
// }

var (
_ types.MsgServer = msgServer{}
_ balancer.MsgServer = msgServer{}
_ stableswap.MsgServer = msgServer{}
_ types.MsgServer = msgServer{}
_ balancer.MsgServer = msgServer{}
// _ stableswap.MsgServer = msgServer{}
)

func (server msgServer) CreateBalancerPool(goCtx context.Context, msg *balancer.MsgCreateBalancerPool) (*balancer.MsgCreateBalancerPoolResponse, error) {
poolId, err := server.CreatePool(goCtx, msg)
return &balancer.MsgCreateBalancerPoolResponse{PoolID: poolId}, err
}

func (server msgServer) CreateStableswapPool(goCtx context.Context, msg *stableswap.MsgCreateStableswapPool) (*stableswap.MsgCreateStableswapPoolResponse, error) {
poolId, err := server.CreatePool(goCtx, msg)
if err != nil {
return nil, err
}
return &stableswap.MsgCreateStableswapPoolResponse{PoolID: poolId}, nil
}
// func (server msgServer) CreateStableswapPool(goCtx context.Context, msg *stableswap.MsgCreateStableswapPool) (*stableswap.MsgCreateStableswapPoolResponse, error) {
// poolId, err := server.CreatePool(goCtx, msg)
// if err != nil {
// return nil, err
// }
// return &stableswap.MsgCreateStableswapPoolResponse{PoolID: poolId}, nil
// }

func (server msgServer) CreatePool(goCtx context.Context, msg types.CreatePoolMsg) (poolId uint64, err error) {
ctx := sdk.UnwrapSDKContext(goCtx)
Expand Down
7 changes: 3 additions & 4 deletions x/gamm/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import (
"github.com/osmosis-labs/osmosis/v7/x/gamm/client/cli"
"github.com/osmosis-labs/osmosis/v7/x/gamm/keeper"
"github.com/osmosis-labs/osmosis/v7/x/gamm/pool-models/balancer"
"github.com/osmosis-labs/osmosis/v7/x/gamm/pool-models/stableswap"
"github.com/osmosis-labs/osmosis/v7/x/gamm/simulation"
"github.com/osmosis-labs/osmosis/v7/x/gamm/types"
)
Expand All @@ -44,7 +43,7 @@ func (AppModuleBasic) Name() string { return types.ModuleName }
func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {
types.RegisterLegacyAminoCodec(cdc)
balancer.RegisterLegacyAminoCodec(cdc)
stableswap.RegisterLegacyAminoCodec(cdc)
// stableswap.RegisterLegacyAminoCodec(cdc)
}

// DefaultGenesis returns default genesis state as raw bytes for the gamm
Expand Down Expand Up @@ -83,7 +82,7 @@ func (b AppModuleBasic) GetQueryCmd() *cobra.Command {
func (AppModuleBasic) RegisterInterfaces(registry codectypes.InterfaceRegistry) {
types.RegisterInterfaces(registry)
balancer.RegisterInterfaces(registry)
stableswap.RegisterInterfaces(registry)
// stableswap.RegisterInterfaces(registry)
}

type AppModule struct {
Expand All @@ -100,7 +99,7 @@ type AppModule struct {
func (am AppModule) RegisterServices(cfg module.Configurator) {
types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(&am.keeper))
balancer.RegisterMsgServer(cfg.MsgServer(), keeper.NewBalancerMsgServerImpl(&am.keeper))
stableswap.RegisterMsgServer(cfg.MsgServer(), keeper.NewStableswapMsgServerImpl(&am.keeper))
// stableswap.RegisterMsgServer(cfg.MsgServer(), keeper.NewStableswapMsgServerImpl(&am.keeper))
types.RegisterQueryServer(cfg.QueryServer(), keeper.NewQuerier(am.keeper))
}

Expand Down

0 comments on commit d3af599

Please sign in to comment.