From 97c4241e53973eb154d2543229dda45a39cccd62 Mon Sep 17 00:00:00 2001 From: Roman Date: Wed, 17 May 2023 12:43:56 -0400 Subject: [PATCH 1/3] bug: add split route to message server in pool manager --- proto/osmosis/poolmanager/v1beta1/tx.proto | 4 + x/poolmanager/msg_server.go | 50 ++++++ x/poolmanager/router.go | 18 +++ x/poolmanager/types/events.go | 9 +- x/poolmanager/types/tx.pb.go | 167 +++++++++++++++------ 5 files changed, 199 insertions(+), 49 deletions(-) diff --git a/proto/osmosis/poolmanager/v1beta1/tx.proto b/proto/osmosis/poolmanager/v1beta1/tx.proto index fdabd88f563..4e6d6dcdc4f 100644 --- a/proto/osmosis/poolmanager/v1beta1/tx.proto +++ b/proto/osmosis/poolmanager/v1beta1/tx.proto @@ -12,6 +12,10 @@ service Msg { returns (MsgSwapExactAmountInResponse); rpc SwapExactAmountOut(MsgSwapExactAmountOut) returns (MsgSwapExactAmountOutResponse); + rpc SplitRouteSwapExactAmountIn(MsgSplitRouteSwapExactAmountIn) + returns (MsgSplitRouteSwapExactAmountInResponse); + rpc SplitRouteSwapExactAmountOut(MsgSplitRouteSwapExactAmountOut) + returns (MsgSplitRouteSwapExactAmountOutResponse); } // ===================== MsgSwapExactAmountIn diff --git a/x/poolmanager/msg_server.go b/x/poolmanager/msg_server.go index 970a114b14a..c4d730f063d 100644 --- a/x/poolmanager/msg_server.go +++ b/x/poolmanager/msg_server.go @@ -69,3 +69,53 @@ func (server msgServer) SwapExactAmountOut(goCtx context.Context, msg *types.Msg return &types.MsgSwapExactAmountOutResponse{TokenInAmount: tokenInAmount}, nil } + +func (server msgServer) SplitRouteSwapExactAmountIn(goCtx context.Context, msg *types.MsgSplitRouteSwapExactAmountIn) (*types.MsgSplitRouteSwapExactAmountInResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + sender, err := sdk.AccAddressFromBech32(msg.Sender) + if err != nil { + return nil, err + } + + tokenOutAmount, err := server.keeper.SplitRouteExactAmountIn(ctx, sender, msg.Routes, msg.TokenInDenom, msg.TokenOutMinAmount) + if err != nil { + return nil, err + } + + // Swap event is handled elsewhere + ctx.EventManager().EmitEvents(sdk.Events{ + sdk.NewEvent( + sdk.EventTypeMessage, + sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), + sdk.NewAttribute(sdk.AttributeKeySender, msg.Sender), + ), + }) + + return &types.MsgSplitRouteSwapExactAmountInResponse{TokenOutAmount: tokenOutAmount}, nil +} + +func (server msgServer) SplitRouteSwapExactAmountOut(goCtx context.Context, msg *types.MsgSplitRouteSwapExactAmountOut) (*types.MsgSplitRouteSwapExactAmountOutResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + sender, err := sdk.AccAddressFromBech32(msg.Sender) + if err != nil { + return nil, err + } + + tokenInAmount, err := server.keeper.SplitRouteExactAmountOut(ctx, sender, msg.Routes, msg.TokenOutDenom, msg.TokenInMaxAmount) + if err != nil { + return nil, err + } + + // Swap event is handled elsewhere + ctx.EventManager().EmitEvents(sdk.Events{ + sdk.NewEvent( + sdk.EventTypeMessage, + sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), + sdk.NewAttribute(sdk.AttributeKeySender, msg.Sender), + ), + }) + + return &types.MsgSplitRouteSwapExactAmountOutResponse{TokenInAmount: tokenInAmount}, nil +} diff --git a/x/poolmanager/router.go b/x/poolmanager/router.go index 50f285ab8b2..c4987e4856f 100644 --- a/x/poolmanager/router.go +++ b/x/poolmanager/router.go @@ -159,6 +159,15 @@ func (k Keeper) SplitRouteExactAmountIn( return sdk.Int{}, types.PriceImpactProtectionExactInError{Actual: totalOutAmount, MinAmount: tokenOutMinAmount} } + ctx.EventManager().EmitEvents(sdk.Events{ + sdk.NewEvent( + types.TypeMsgSplitRouteSwapExactAmountIn, + sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), + sdk.NewAttribute(sdk.AttributeKeySender, sender.String()), + sdk.NewAttribute(types.AttributeKeyTokensOut, totalOutAmount.String()), + ), + }) + return totalOutAmount, nil } @@ -436,6 +445,15 @@ func (k Keeper) SplitRouteExactAmountOut( return sdk.Int{}, types.PriceImpactProtectionExactOutError{Actual: totalInAmount, MaxAmount: tokenInMaxAmount} } + ctx.EventManager().EmitEvents(sdk.Events{ + sdk.NewEvent( + types.TypeMsgSplitRouteSwapExactAmountOut, + sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), + sdk.NewAttribute(sdk.AttributeKeySender, sender.String()), + sdk.NewAttribute(types.AttributeKeyTokensOut, totalInAmount.String()), + ), + }) + return totalInAmount, nil } diff --git a/x/poolmanager/types/events.go b/x/poolmanager/types/events.go index 9d75c81d253..a080865806b 100644 --- a/x/poolmanager/types/events.go +++ b/x/poolmanager/types/events.go @@ -1,7 +1,10 @@ package types const ( - AttributeValueCategory = ModuleName - TypeEvtPoolCreated = "pool_created" - AttributeKeyPoolId = "pool_id" + AttributeValueCategory = ModuleName + TypeEvtPoolCreated = "pool_created" + TypeEvtSplitRouteSwapExactIn = "split_route_swap_exact_in" + AttributeKeyTokensIn = "tokens_in" + AttributeKeyTokensOut = "tokens_out" + AttributeKeyPoolId = "pool_id" ) diff --git a/x/poolmanager/types/tx.pb.go b/x/poolmanager/types/tx.pb.go index 97d7f8c8942..3912be8dcc4 100644 --- a/x/poolmanager/types/tx.pb.go +++ b/x/poolmanager/types/tx.pb.go @@ -446,52 +446,55 @@ func init() { } var fileDescriptor_acd130b4825d67dc = []byte{ - // 712 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x56, 0xdd, 0x4e, 0xd3, 0x50, - 0x1c, 0x5f, 0x07, 0x41, 0x38, 0xc8, 0x57, 0x05, 0x19, 0x43, 0x5b, 0xd2, 0x18, 0xc4, 0x44, 0xda, - 0x6c, 0x68, 0x8c, 0xdc, 0x18, 0xa7, 0x26, 0x2e, 0xa1, 0x99, 0xd4, 0x3b, 0x6f, 0x96, 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ac, 0xeb, 0x29, 0xac, 0xf4, 0x68, 0x29, 0xb1, 0x8a, 0x15, 0xb5, 0x55, - 0x46, 0x8f, 0x42, 0x35, 0x67, 0xf1, 0x19, 0xb2, 0x09, 0xc6, 0x09, 0xda, 0x75, 0x60, 0xdd, 0x85, - 0x85, 0x91, 0x15, 0x69, 0x6d, 0xb2, 0xbc, 0xa4, 0x33, 0xca, 0x7a, 0x44, 0x39, 0x9e, 0xf3, 0x02, - 0xb9, 0xb0, 0xb2, 0x18, 0xb5, 0xf6, 0x42, 0x75, 0x86, 0x21, 0x13, 0x8d, 0x9a, 0x75, 0x83, 0x5e, - 0x56, 0xa1, 0xfc, 0x11, 0xcc, 0xb3, 0xa7, 0x28, 0x20, 0x75, 0xcf, 0x85, 0x75, 0x9b, 0xae, 0x5d, - 0x18, 0xa5, 0xac, 0xcc, 0xa8, 0xff, 0x67, 0xa8, 0xae, 0xb6, 0x5c, 0xf2, 0x3e, 0x68, 0xe8, 0x4d, - 0xe4, 0x19, 0x5c, 0x5f, 0xf6, 0xb3, 0x8e, 0x77, 0x76, 0x0d, 0x72, 0xe0, 0x3b, 0x58, 0xaf, 0x42, - 0xd2, 0x0b, 0xd5, 0xe5, 0xfe, 0x95, 0x06, 0x67, 0x6a, 0xd6, 0x1c, 0x7d, 0x5c, 0x0b, 0x88, 0xe9, - 0x42, 0xc6, 0x51, 0xfb, 0x2a, 0x81, 0x3b, 0xc3, 0x04, 0xb6, 0x1c, 0xec, 0x23, 0x88, 0x1d, 0x19, - 0x83, 0xd9, 0xf3, 0x61, 0x1c, 0x1c, 0x93, 0xbc, 0x9a, 0x19, 0xdc, 0x62, 0x12, 0x9c, 0x00, 0x36, - 0x2d, 0x80, 0x71, 0x54, 0xbf, 0xf2, 0x40, 0x89, 0x50, 0xf9, 0x6d, 0x97, 0x50, 0x13, 0xfe, 0x29, - 0x00, 0xdb, 0x89, 0x00, 0x6c, 0x5c, 0x39, 0x00, 0xe7, 0x00, 0x12, 0x29, 0x78,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0x9b, 0x04, 0xee, 0xff, 0x45, 0xe3, 0xeb, 0x4b, 0x40, 0xf9, 0x30, 0x0f, 0x46, - 0x4c, 0xdc, 0x92, 0x3f, 0x49, 0x60, 0xee, 0xe2, 0xa9, 0x5f, 0x4a, 0x35, 0x70, 0xd8, 0x1f, 0x59, - 0xf1, 0x69, 0xe6, 0x96, 0x98, 0xfd, 0x67, 0x09, 0xc8, 0x43, 0x02, 0x58, 0xce, 0x38, 0xb1, 0x16, - 0x90, 0xe2, 0x66, 0xf6, 0x1e, 0x01, 0xa3, 0xb2, 0x7d, 0x74, 0xaa, 0x48, 0xc7, 0xa7, 0x8a, 0x74, - 0x72, 0xaa, 0x48, 0x87, 0x67, 0x4a, 0xee, 0xf8, 0x4c, 0xc9, 0xfd, 0x38, 0x53, 0x72, 0xef, 0x9e, - 0xf4, 0xa9, 0xcf, 0xe7, 0xaf, 0xb7, 0xed, 0x06, 0x16, 0x37, 0xc6, 0x5e, 0xe9, 0xb1, 0xd1, 0x1d, - 0xf8, 0xd4, 0xa2, 0x96, 0x34, 0xc6, 0xe8, 0xe7, 0xd5, 0xc6, 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, - 0xfd, 0xb2, 0x75, 0xe9, 0x07, 0x0a, 0x00, 0x00, + // 753 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x56, 0xdf, 0x4e, 0xd3, 0x50, + 0x1c, 0xde, 0x19, 0x0b, 0xc2, 0x41, 0xfe, 0x55, 0x90, 0x51, 0xb0, 0x25, 0x8d, 0x41, 0x4c, 0xa4, + 0xcd, 0x86, 0xc6, 0x88, 0x26, 0xc6, 0x81, 0x89, 0x4b, 0x68, 0x26, 0xf5, 0xce, 0x9b, 0xa5, 0x1b, + 0xcd, 0x6c, 0x58, 0xcf, 0x69, 0x76, 0x4e, 0x61, 0xc4, 0xc4, 0xc4, 0xc4, 0x07, 0xd0, 0x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xfc, 0x91, 0x83, 0x03, 0x2a, 0x69, 0x70, 0xef, 0x01, 0x9c, 0x3c, 0x7d, 0xea, 0x17, + 0x12, 0x05, 0xec, 0xf7, 0x21, 0xe3, 0x1f, 0xa5, 0x4e, 0x89, 0xa6, 0xff, 0x00, 0x20, 0xd7, 0xc7, + 0x80, 0xc5, 0x94, 0x15, 0x2b, 0x0e, 0xe5, 0x57, 0xd3, 0xe7, 0x44, 0x30, 0xbe, 0x01, 0x38, 0x97, + 0xf4, 0x29, 0x7c, 0x7c, 0x6e, 0xed, 0xb3, 0x93, 0xf9, 0xb5, 0x4b, 0x24, 0x47, 0x08, 0xbf, 0x03, + 0x38, 0x9f, 0xb8, 0x67, 0x9f, 0xfc, 0x73, 0x17, 0x8f, 0xbc, 0xf5, 0xcb, 0x64, 0x87, 0x20, 0x4b, + 0x9b, 0xfb, 0x47, 0x02, 0x38, 0x38, 0x12, 0xc0, 0xe1, 0x91, 0x00, 0x3e, 0x1e, 0x0b, 0x99, 0x83, + 0x63, 0x21, 0xf3, 0xf3, 0x58, 0xc8, 0xbc, 0x7e, 0xd8, 0x65, 0x62, 0xd6, 0x69, 0xb9, 0xa9, 0xd7, + 0x48, 0xf8, 0xa0, 0xec, 0x14, 0x1e, 0x28, 0xed, 0x9e, 0x3f, 0x56, 0xdf, 0xd9, 0xb5, 0x41, 0xff, + 0x2f, 0x75, 0xe5, 0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x0d, 0xfe, 0x3b, 0x1f, 0x4e, 0x0b, 0x00, + 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -508,6 +511,8 @@ const _ = grpc.SupportPackageIsVersion4 type MsgClient interface { SwapExactAmountIn(ctx context.Context, in *MsgSwapExactAmountIn, opts ...grpc.CallOption) (*MsgSwapExactAmountInResponse, error) SwapExactAmountOut(ctx context.Context, in *MsgSwapExactAmountOut, opts ...grpc.CallOption) (*MsgSwapExactAmountOutResponse, error) + SplitRouteSwapExactAmountIn(ctx context.Context, in *MsgSplitRouteSwapExactAmountIn, opts ...grpc.CallOption) (*MsgSplitRouteSwapExactAmountInResponse, error) + SplitRouteSwapExactAmountOut(ctx context.Context, in *MsgSplitRouteSwapExactAmountOut, opts ...grpc.CallOption) (*MsgSplitRouteSwapExactAmountOutResponse, error) } type msgClient struct { @@ -536,10 +541,30 @@ func (c *msgClient) SwapExactAmountOut(ctx context.Context, in *MsgSwapExactAmou return out, nil } +func (c *msgClient) SplitRouteSwapExactAmountIn(ctx context.Context, in *MsgSplitRouteSwapExactAmountIn, opts ...grpc.CallOption) (*MsgSplitRouteSwapExactAmountInResponse, error) { + out := new(MsgSplitRouteSwapExactAmountInResponse) + err := c.cc.Invoke(ctx, "/osmosis.poolmanager.v1beta1.Msg/SplitRouteSwapExactAmountIn", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) SplitRouteSwapExactAmountOut(ctx context.Context, in *MsgSplitRouteSwapExactAmountOut, opts ...grpc.CallOption) (*MsgSplitRouteSwapExactAmountOutResponse, error) { + out := new(MsgSplitRouteSwapExactAmountOutResponse) + err := c.cc.Invoke(ctx, "/osmosis.poolmanager.v1beta1.Msg/SplitRouteSwapExactAmountOut", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. type MsgServer interface { SwapExactAmountIn(context.Context, *MsgSwapExactAmountIn) (*MsgSwapExactAmountInResponse, error) SwapExactAmountOut(context.Context, *MsgSwapExactAmountOut) (*MsgSwapExactAmountOutResponse, error) + SplitRouteSwapExactAmountIn(context.Context, *MsgSplitRouteSwapExactAmountIn) (*MsgSplitRouteSwapExactAmountInResponse, error) + SplitRouteSwapExactAmountOut(context.Context, *MsgSplitRouteSwapExactAmountOut) (*MsgSplitRouteSwapExactAmountOutResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -552,6 +577,12 @@ func (*UnimplementedMsgServer) SwapExactAmountIn(ctx context.Context, req *MsgSw func (*UnimplementedMsgServer) SwapExactAmountOut(ctx context.Context, req *MsgSwapExactAmountOut) (*MsgSwapExactAmountOutResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method SwapExactAmountOut not implemented") } +func (*UnimplementedMsgServer) SplitRouteSwapExactAmountIn(ctx context.Context, req *MsgSplitRouteSwapExactAmountIn) (*MsgSplitRouteSwapExactAmountInResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SplitRouteSwapExactAmountIn not implemented") +} +func (*UnimplementedMsgServer) SplitRouteSwapExactAmountOut(ctx context.Context, req *MsgSplitRouteSwapExactAmountOut) (*MsgSplitRouteSwapExactAmountOutResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SplitRouteSwapExactAmountOut not implemented") +} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) @@ -593,6 +624,42 @@ func _Msg_SwapExactAmountOut_Handler(srv interface{}, ctx context.Context, dec f return interceptor(ctx, in, info, handler) } +func _Msg_SplitRouteSwapExactAmountIn_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgSplitRouteSwapExactAmountIn) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).SplitRouteSwapExactAmountIn(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/osmosis.poolmanager.v1beta1.Msg/SplitRouteSwapExactAmountIn", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).SplitRouteSwapExactAmountIn(ctx, req.(*MsgSplitRouteSwapExactAmountIn)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_SplitRouteSwapExactAmountOut_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgSplitRouteSwapExactAmountOut) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).SplitRouteSwapExactAmountOut(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/osmosis.poolmanager.v1beta1.Msg/SplitRouteSwapExactAmountOut", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).SplitRouteSwapExactAmountOut(ctx, req.(*MsgSplitRouteSwapExactAmountOut)) + } + return interceptor(ctx, in, info, handler) +} + var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "osmosis.poolmanager.v1beta1.Msg", HandlerType: (*MsgServer)(nil), @@ -605,6 +672,14 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "SwapExactAmountOut", Handler: _Msg_SwapExactAmountOut_Handler, }, + { + MethodName: "SplitRouteSwapExactAmountIn", + Handler: _Msg_SplitRouteSwapExactAmountIn_Handler, + }, + { + MethodName: "SplitRouteSwapExactAmountOut", + Handler: _Msg_SplitRouteSwapExactAmountOut_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "osmosis/poolmanager/v1beta1/tx.proto", From 1b2c321d05f60f23474fad7d669526a63332e836 Mon Sep 17 00:00:00 2001 From: Roman Date: Thu, 18 May 2023 14:38:05 -0400 Subject: [PATCH 2/3] Update x/poolmanager/msg_server.go Co-authored-by: Matt, Park <45252226+mattverse@users.noreply.github.com> --- x/poolmanager/msg_server.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/poolmanager/msg_server.go b/x/poolmanager/msg_server.go index c4d730f063d..6ed2f7a7b81 100644 --- a/x/poolmanager/msg_server.go +++ b/x/poolmanager/msg_server.go @@ -83,7 +83,7 @@ func (server msgServer) SplitRouteSwapExactAmountIn(goCtx context.Context, msg * return nil, err } - // Swap event is handled elsewhere + // Swap event is handled in each pool module's SwapExactAmountIn ctx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( sdk.EventTypeMessage, From 13e1dcc3ca6a939c1faacbb86c6caf0449ead61c Mon Sep 17 00:00:00 2001 From: Roman Date: Thu, 18 May 2023 14:38:11 -0400 Subject: [PATCH 3/3] Update x/poolmanager/msg_server.go Co-authored-by: Matt, Park <45252226+mattverse@users.noreply.github.com> --- x/poolmanager/msg_server.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/poolmanager/msg_server.go b/x/poolmanager/msg_server.go index 6ed2f7a7b81..493be2facd6 100644 --- a/x/poolmanager/msg_server.go +++ b/x/poolmanager/msg_server.go @@ -108,7 +108,7 @@ func (server msgServer) SplitRouteSwapExactAmountOut(goCtx context.Context, msg return nil, err } - // Swap event is handled elsewhere + // Swap event is handled in each pool module's SwapExactAmountOut ctx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( sdk.EventTypeMessage,