From 8a09b7ff3d86dc9f8a5766a75ae8ab39eb317794 Mon Sep 17 00:00:00 2001 From: Michael Tsitrin Date: Sun, 13 Oct 2024 12:55:54 +0300 Subject: [PATCH 1/5] added IRO creation event. updated settle event. fixed trade events --- proto/dymensionxyz/dymension/iro/events.proto | 6 +- x/iro/keeper/create_plan.go | 10 + x/iro/keeper/settle.go | 20 +- x/iro/keeper/trade.go | 2 + x/iro/types/events.pb.go | 188 ++++++++++++------ 5 files changed, 151 insertions(+), 75 deletions(-) diff --git a/proto/dymensionxyz/dymension/iro/events.proto b/proto/dymensionxyz/dymension/iro/events.proto index 4095e40e2..0041db24d 100644 --- a/proto/dymensionxyz/dymension/iro/events.proto +++ b/proto/dymensionxyz/dymension/iro/events.proto @@ -18,7 +18,7 @@ message EventUpdateParams { message EventNewIROPlan { string creator = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; string plan_id = 2; - Plan plan = 3; + string rollapp_id = 3; } @@ -40,7 +40,6 @@ message EventSell { string seller = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; string plan_id = 2; string rollapp_id = 3; - string amount = 4[ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false @@ -67,5 +66,6 @@ message EventClaim { message EventSettle { string plan_id = 1; string rollapp_id = 2; - //FIXME: Add more fields, probably liquidity related + uint64 pool_id = 3; + uint64 gauge_id = 4; } \ No newline at end of file diff --git a/x/iro/keeper/create_plan.go b/x/iro/keeper/create_plan.go index 4ae5a6c16..7b5bd8ee8 100644 --- a/x/iro/keeper/create_plan.go +++ b/x/iro/keeper/create_plan.go @@ -132,6 +132,16 @@ func (k Keeper) CreatePlan(ctx sdk.Context, allocatedAmount math.Int, start, pre // Set the plan in the store k.SetPlan(ctx, plan) + // Emit event + err = ctx.EventManager().EmitTypedEvent(&types.EventNewIROPlan{ + Creator: rollapp.Owner, + PlanId: fmt.Sprintf("%d", plan.Id), + RollappId: rollapp.RollappId, + }) + if err != nil { + return "", err + } + return fmt.Sprintf("%d", plan.Id), nil } diff --git a/x/iro/keeper/settle.go b/x/iro/keeper/settle.go index 18ff5a608..176a64698 100644 --- a/x/iro/keeper/settle.go +++ b/x/iro/keeper/settle.go @@ -58,15 +58,17 @@ func (k Keeper) Settle(ctx sdk.Context, rollappId, rollappIBCDenom string) error k.SetPlan(ctx, plan) // uses the raised DYM and unsold tokens to bootstrap the rollapp's liquidity pool - err = k.bootstrapLiquidityPool(ctx, plan) + poolID, gaugeID, err := k.bootstrapLiquidityPool(ctx, plan) if err != nil { return errors.Join(types.ErrFailedBootstrapLiquidityPool, err) } // Emit event err = ctx.EventManager().EmitTypedEvent(&types.EventSettle{ - RollappId: rollappId, PlanId: fmt.Sprintf("%d", plan.Id), + RollappId: rollappId, + PoolId: poolID, + GaugeId: gaugeID, }) if err != nil { return err @@ -82,14 +84,14 @@ func (k Keeper) Settle(ctx sdk.Context, rollappId, rollappIBCDenom string) error // - Determines the required pool liquidity amounts to fulfill the last price. // - Creates a balancer pool with the determined tokens and DYM. // - Uses leftover tokens as incentives to the pool LP token holders. -func (k Keeper) bootstrapLiquidityPool(ctx sdk.Context, plan types.Plan) error { +func (k Keeper) bootstrapLiquidityPool(ctx sdk.Context, plan types.Plan) (poolID, gaugeID uint64, err error) { unallocatedTokens := plan.TotalAllocation.Amount.Sub(plan.SoldAmt) // assumed > 0, as we enforce it in the Buy function raisedDYM := k.BK.GetBalance(ctx, plan.GetAddress(), appparams.BaseDenom) // assumed > 0, as we enforce it by IRO creation fee // send the raised DYM to the iro module as it will be used as the pool creator - err := k.BK.SendCoinsFromAccountToModule(ctx, plan.GetAddress(), types.ModuleName, sdk.NewCoins(raisedDYM)) + err = k.BK.SendCoinsFromAccountToModule(ctx, plan.GetAddress(), types.ModuleName, sdk.NewCoins(raisedDYM)) if err != nil { - return err + return 0, 0, err } // find the tokens needed to bootstrap the pool, to fulfill last price @@ -114,7 +116,7 @@ func (k Keeper) bootstrapLiquidityPool(ctx sdk.Context, plan types.Plan) error { // we call the pool manager directly, instead of the gamm keeper, to avoid the pool creation fee poolId, err := k.pm.CreatePool(ctx, balancerPool) if err != nil { - return err + return 0, 0, err } // Add incentives @@ -128,12 +130,12 @@ func (k Keeper) bootstrapLiquidityPool(ctx sdk.Context, plan types.Plan) error { Denom: poolDenom, Duration: k.ik.GetLockableDurations(ctx)[0], } - _, err = k.ik.CreateGauge(ctx, false, k.AK.GetModuleAddress(types.ModuleName), incentives, distrTo, ctx.BlockTime().Add(plan.IncentivePlanParams.StartTimeAfterSettlement), plan.IncentivePlanParams.NumEpochsPaidOver) + gaugeID, err = k.ik.CreateGauge(ctx, false, k.AK.GetModuleAddress(types.ModuleName), incentives, distrTo, ctx.BlockTime().Add(plan.IncentivePlanParams.StartTimeAfterSettlement), plan.IncentivePlanParams.NumEpochsPaidOver) if err != nil { - return err + return 0, 0, err } - return nil + return poolID, gaugeID, nil } // calcLiquidityPoolTokens determines the tokens and DYM to be used for bootstrapping the liquidity pool. diff --git a/x/iro/keeper/trade.go b/x/iro/keeper/trade.go index 4c0363cf7..90cda6578 100644 --- a/x/iro/keeper/trade.go +++ b/x/iro/keeper/trade.go @@ -99,6 +99,7 @@ func (k Keeper) Buy(ctx sdk.Context, planId string, buyer sdk.AccAddress, amount PlanId: planId, RollappId: plan.RollappId, Amount: amountTokensToBuy, + Cost: costPlusTakerFee.Amount, }) if err != nil { return err @@ -154,6 +155,7 @@ func (k Keeper) Sell(ctx sdk.Context, planId string, seller sdk.AccAddress, amou PlanId: planId, RollappId: plan.RollappId, Amount: amountTokensToSell, + Revenue: costMinusTakerFee.Amount, }) if err != nil { return err diff --git a/x/iro/types/events.pb.go b/x/iro/types/events.pb.go index e8c5c4ed1..b96f57234 100644 --- a/x/iro/types/events.pb.go +++ b/x/iro/types/events.pb.go @@ -87,9 +87,9 @@ func (m *EventUpdateParams) GetOldParams() Params { } type EventNewIROPlan struct { - Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` - PlanId string `protobuf:"bytes,2,opt,name=plan_id,json=planId,proto3" json:"plan_id,omitempty"` - Plan *Plan `protobuf:"bytes,3,opt,name=plan,proto3" json:"plan,omitempty"` + Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` + PlanId string `protobuf:"bytes,2,opt,name=plan_id,json=planId,proto3" json:"plan_id,omitempty"` + RollappId string `protobuf:"bytes,3,opt,name=rollapp_id,json=rollappId,proto3" json:"rollapp_id,omitempty"` } func (m *EventNewIROPlan) Reset() { *m = EventNewIROPlan{} } @@ -139,11 +139,11 @@ func (m *EventNewIROPlan) GetPlanId() string { return "" } -func (m *EventNewIROPlan) GetPlan() *Plan { +func (m *EventNewIROPlan) GetRollappId() string { if m != nil { - return m.Plan + return m.RollappId } - return nil + return "" } type EventBuy struct { @@ -334,6 +334,8 @@ func (m *EventClaim) GetRollappId() string { type EventSettle struct { PlanId string `protobuf:"bytes,1,opt,name=plan_id,json=planId,proto3" json:"plan_id,omitempty"` RollappId string `protobuf:"bytes,2,opt,name=rollapp_id,json=rollappId,proto3" json:"rollapp_id,omitempty"` + PoolId uint64 `protobuf:"varint,3,opt,name=pool_id,json=poolId,proto3" json:"pool_id,omitempty"` + GaugeId uint64 `protobuf:"varint,4,opt,name=gauge_id,json=gaugeId,proto3" json:"gauge_id,omitempty"` } func (m *EventSettle) Reset() { *m = EventSettle{} } @@ -383,6 +385,20 @@ func (m *EventSettle) GetRollappId() string { return "" } +func (m *EventSettle) GetPoolId() uint64 { + if m != nil { + return m.PoolId + } + return 0 +} + +func (m *EventSettle) GetGaugeId() uint64 { + if m != nil { + return m.GaugeId + } + return 0 +} + func init() { proto.RegisterType((*EventUpdateParams)(nil), "dymensionxyz.dymension.iro.EventUpdateParams") proto.RegisterType((*EventNewIROPlan)(nil), "dymensionxyz.dymension.iro.EventNewIROPlan") @@ -397,41 +413,42 @@ func init() { } var fileDescriptor_9d7833031285167c = []byte{ - // 537 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x94, 0x41, 0x6f, 0xd3, 0x30, - 0x14, 0xc7, 0xeb, 0xad, 0x6b, 0xc9, 0xdb, 0x01, 0x11, 0x4d, 0xa2, 0x54, 0x22, 0xad, 0x22, 0x04, - 0xbb, 0x2c, 0x99, 0x36, 0xc4, 0x9d, 0xa2, 0x31, 0xca, 0x01, 0xa6, 0x4c, 0x5c, 0xb8, 0x54, 0x6e, - 0x63, 0x32, 0x0b, 0xc7, 0x8e, 0x6c, 0x67, 0x5d, 0xf8, 0x02, 0x5c, 0x39, 0xf0, 0x51, 0xf8, 0x00, - 0x1c, 0x77, 0x9c, 0x38, 0x21, 0x24, 0x26, 0xd4, 0x7e, 0x0f, 0x84, 0xe2, 0xb8, 0xa3, 0x42, 0x6a, - 0x37, 0x76, 0xd9, 0xa9, 0x7e, 0x7e, 0xff, 0xf7, 0xfc, 0x7b, 0xff, 0x3a, 0x86, 0x47, 0x71, 0x91, - 0x12, 0xae, 0xa8, 0xe0, 0x27, 0xc5, 0x87, 0xf0, 0x22, 0x08, 0xa9, 0x14, 0x21, 0x39, 0x26, 0x5c, - 0xab, 0x20, 0x93, 0x42, 0x0b, 0xb7, 0x3d, 0x2f, 0x0c, 0x2e, 0x82, 0x80, 0x4a, 0xd1, 0xde, 0x48, - 0x44, 0x22, 0x8c, 0x2c, 0x2c, 0x57, 0x55, 0x45, 0xfb, 0xde, 0x48, 0xa8, 0x54, 0xa8, 0x41, 0x95, - 0xa8, 0x02, 0x9b, 0xea, 0x24, 0x42, 0x24, 0x8c, 0x84, 0x26, 0x1a, 0xe6, 0xef, 0x42, 0x4d, 0x53, - 0xa2, 0x34, 0x4e, 0x33, 0x2b, 0x78, 0xb0, 0x04, 0x8b, 0x4a, 0x7b, 0x82, 0xff, 0x13, 0xc1, 0x9d, - 0xbd, 0x12, 0xf2, 0x4d, 0x16, 0x63, 0x4d, 0x0e, 0xb0, 0xc4, 0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, 0x34, 0xeb, 0xc7, 0x79, 0xe7, 0x61, 0x42, 0xf5, 0x51, 0x3e, 0x0c, 0x46, 0x22, 0xb5, 0x77, - 0xcc, 0xfe, 0x6c, 0xa9, 0xf8, 0x7d, 0xa8, 0x8b, 0x8c, 0xa8, 0xa0, 0xcf, 0x75, 0x64, 0xab, 0xdd, - 0x1e, 0xd4, 0x47, 0x42, 0xe9, 0xd6, 0xda, 0xb5, 0xba, 0x98, 0x5a, 0xff, 0xe3, 0x0a, 0x38, 0xc6, - 0x80, 0x43, 0xc2, 0x98, 0xbb, 0x0d, 0x0d, 0x45, 0x18, 0xbb, 0x82, 0x05, 0x56, 0x77, 0xe3, 0x1e, - 0xbc, 0x80, 0xa6, 0x2c, 0x3f, 0xee, 0x9c, 0x5c, 0xd3, 0x86, 0x59, 0xb9, 0xff, 0x15, 0x01, 0x18, - 0x27, 0x9e, 0x31, 0x4c, 0x53, 0x73, 0x39, 0xcb, 0x05, 0xb9, 0xca, 0xe5, 0xac, 0x84, 0x37, 0x6d, - 0x86, 0xbf, 0x07, 0xeb, 0xf6, 0xbf, 0xd4, 0x9a, 0x91, 0x79, 0x1c, 0xb4, 0x04, 0x67, 0xe5, 0x1f, - 0x9c, 0xde, 0xcb, 0xd3, 0x89, 0x87, 0xce, 0x26, 0x1e, 0xfa, 0x35, 0xf1, 0xd0, 0xa7, 0xa9, 0x57, - 0x3b, 0x9b, 0x7a, 0xb5, 0xef, 0x53, 0xaf, 0xf6, 0x76, 0x7b, 0x0e, 0x68, 0xc1, 0xb3, 0x76, 0xbc, - 0x1b, 0x9e, 0x98, 0xb7, 0xcd, 0xe0, 0x0d, 0x1b, 0xe6, 0x79, 0xdb, 0xfd, 0x13, 0x00, 0x00, 0xff, - 0xff, 0x56, 0x7e, 0xfa, 0xf0, 0x9d, 0x05, 0x00, 0x00, + // 548 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x54, 0x4d, 0x6f, 0xd3, 0x40, + 0x10, 0x8d, 0xdb, 0x34, 0xa9, 0xa7, 0x07, 0x84, 0x55, 0x89, 0x34, 0x12, 0x4e, 0x65, 0x21, 0xe8, + 0xa5, 0x76, 0xd5, 0x4a, 0xdc, 0x09, 0x82, 0x62, 0x0e, 0x50, 0xb9, 0xe2, 0xc2, 0x25, 0xda, 0x64, + 0x17, 0xd7, 0x62, 0xed, 0xb1, 0x76, 0xd7, 0x4d, 0x8d, 0xc4, 0x99, 0x2b, 0x3f, 0x86, 0x1f, 0xc0, + 0xb1, 0xc7, 0x8a, 0x13, 0x42, 0xa2, 0x42, 0xc9, 0xff, 0x40, 0xc8, 0xeb, 0x4d, 0x89, 0x90, 0xfa, + 0x41, 0x2e, 0x3d, 0x65, 0xdf, 0xce, 0x9b, 0x99, 0x37, 0x2f, 0xeb, 0x81, 0x47, 0xb4, 0x4c, 0x59, + 0x26, 0x13, 0xcc, 0x4e, 0xca, 0x0f, 0xc1, 0x05, 0x08, 0x12, 0x81, 0x01, 0x3b, 0x66, 0x99, 0x92, + 0x7e, 0x2e, 0x50, 0xa1, 0xd3, 0x9d, 0x27, 0xfa, 0x17, 0xc0, 0x4f, 0x04, 0x76, 0xd7, 0x63, 0x8c, + 0x51, 0xd3, 0x82, 0xea, 0x54, 0x67, 0x74, 0x37, 0x46, 0x28, 0x53, 0x94, 0x83, 0x3a, 0x50, 0x03, + 0x13, 0xea, 0xc5, 0x88, 0x31, 0x67, 0x81, 0x46, 0xc3, 0xe2, 0x5d, 0xa0, 0x92, 0x94, 0x49, 0x45, + 0xd2, 0xdc, 0x10, 0x1e, 0x5c, 0x21, 0x2b, 0x11, 0xa6, 0x83, 0xf7, 0xd3, 0x82, 0xbb, 0xcf, 0x2a, + 0x91, 0x6f, 0x72, 0x4a, 0x14, 0x3b, 0x20, 0x82, 0xa4, 0xd2, 0x79, 0x0c, 0x36, 0x29, 0xd4, 0x11, + 0x8a, 0x44, 0x95, 0x1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x65, 0xce, 0xa4, 0x1f, 0x66, 0x2a, 0x32, 0xd9, + 0x4e, 0x1f, 0x9a, 0x23, 0x94, 0xaa, 0xb3, 0xb2, 0x50, 0x15, 0x9d, 0xeb, 0x7d, 0x5a, 0x02, 0x5b, + 0x1b, 0x70, 0xc8, 0x38, 0x77, 0x76, 0xa0, 0x25, 0x19, 0xe7, 0x37, 0xb0, 0xc0, 0xf0, 0x6e, 0xdd, + 0x83, 0x17, 0xd0, 0x16, 0xd5, 0x47, 0x5c, 0xb0, 0x05, 0x6d, 0x98, 0xa5, 0x7b, 0x5f, 0x2d, 0x00, + 0xed, 0xc4, 0x53, 0x4e, 0x92, 0x54, 0xbf, 0xc2, 0xea, 0xc0, 0x6e, 0xf2, 0x0a, 0x6b, 0xe2, 0x6d, + 0x9b, 0xe1, 0x95, 0xb0, 0x66, 0xfe, 0x4b, 0xa5, 0x38, 0x9b, 0x97, 0x63, 0x5d, 0x21, 0x67, 0xe9, + 0x5f, 0x39, 0x55, 0x1e, 0x22, 0x9f, 0x49, 0x6d, 0x46, 0xad, 0x0a, 0x86, 0xd4, 0xd9, 0x80, 0xd5, + 0x98, 0x14, 0x31, 0xab, 0x22, 0x4d, 0x1d, 0x69, 0x6b, 0x1c, 0xd2, 0xfe, 0xcb, 0xd3, 0x89, 0x6b, + 0x9d, 0x4d, 0x5c, 0xeb, 0xd7, 0xc4, 0xb5, 0x3e, 0x4f, 0xdd, 0xc6, 0xd9, 0xd4, 0x6d, 0x7c, 0x9f, + 0xba, 0x8d, 0xb7, 0x3b, 0x73, 0x43, 0x5c, 0xb2, 0xf2, 0x8e, 0xf7, 0x82, 0x13, 0xbd, 0xf7, 0xf4, + 0x48, 0xc3, 0x96, 0x5e, 0x7d, 0x7b, 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, 0xcb, 0xb3, 0x59, 0xda, + 0xb9, 0x05, 0x00, 0x00, } func (m *EventUpdateParams) Marshal() (dAtA []byte, err error) { @@ -504,15 +521,10 @@ func (m *EventNewIROPlan) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.Plan != nil { - { - size, err := m.Plan.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintEvents(dAtA, i, uint64(size)) - } + if len(m.RollappId) > 0 { + i -= len(m.RollappId) + copy(dAtA[i:], m.RollappId) + i = encodeVarintEvents(dAtA, i, uint64(len(m.RollappId))) i-- dAtA[i] = 0x1a } @@ -735,6 +747,16 @@ func (m *EventSettle) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.GaugeId != 0 { + i = encodeVarintEvents(dAtA, i, uint64(m.GaugeId)) + i-- + dAtA[i] = 0x20 + } + if m.PoolId != 0 { + i = encodeVarintEvents(dAtA, i, uint64(m.PoolId)) + i-- + dAtA[i] = 0x18 + } if len(m.RollappId) > 0 { i -= len(m.RollappId) copy(dAtA[i:], m.RollappId) @@ -794,8 +816,8 @@ func (m *EventNewIROPlan) Size() (n int) { if l > 0 { n += 1 + l + sovEvents(uint64(l)) } - if m.Plan != nil { - l = m.Plan.Size() + l = len(m.RollappId) + if l > 0 { n += 1 + l + sovEvents(uint64(l)) } return n @@ -888,6 +910,12 @@ func (m *EventSettle) Size() (n int) { if l > 0 { n += 1 + l + sovEvents(uint64(l)) } + if m.PoolId != 0 { + n += 1 + sovEvents(uint64(m.PoolId)) + } + if m.GaugeId != 0 { + n += 1 + sovEvents(uint64(m.GaugeId)) + } return n } @@ -1140,9 +1168,9 @@ func (m *EventNewIROPlan) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Plan", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field RollappId", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowEvents @@ -1152,27 +1180,23 @@ func (m *EventNewIROPlan) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthEvents } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthEvents } if postIndex > l { return io.ErrUnexpectedEOF } - if m.Plan == nil { - m.Plan = &Plan{} - } - if err := m.Plan.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.RollappId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -1896,6 +1920,44 @@ func (m *EventSettle) Unmarshal(dAtA []byte) error { } m.RollappId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 3: + 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 ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.PoolId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field GaugeId", wireType) + } + m.GaugeId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.GaugeId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipEvents(dAtA[iNdEx:]) From 91b3030ca333be376fa089f59a7d5d207d06b7cd Mon Sep 17 00:00:00 2001 From: Michael Tsitrin Date: Sun, 13 Oct 2024 14:13:18 +0300 Subject: [PATCH 2/5] added taker fee to trade events --- proto/dymensionxyz/dymension/iro/events.proto | 9 + x/iro/keeper/trade.go | 6 +- x/iro/types/events.pb.go | 167 ++++++++++++++---- 3 files changed, 144 insertions(+), 38 deletions(-) diff --git a/proto/dymensionxyz/dymension/iro/events.proto b/proto/dymensionxyz/dymension/iro/events.proto index 0041db24d..e7491342b 100644 --- a/proto/dymensionxyz/dymension/iro/events.proto +++ b/proto/dymensionxyz/dymension/iro/events.proto @@ -34,6 +34,10 @@ message EventBuy { (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false ]; + string taker_fee = 6[ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; } message EventSell { @@ -49,6 +53,11 @@ message EventSell { (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false ]; + + string taker_fee = 6[ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; } message EventClaim { diff --git a/x/iro/keeper/trade.go b/x/iro/keeper/trade.go index 90cda6578..7b414359d 100644 --- a/x/iro/keeper/trade.go +++ b/x/iro/keeper/trade.go @@ -99,7 +99,8 @@ func (k Keeper) Buy(ctx sdk.Context, planId string, buyer sdk.AccAddress, amount PlanId: planId, RollappId: plan.RollappId, Amount: amountTokensToBuy, - Cost: costPlusTakerFee.Amount, + Cost: cost.Amount, + TakerFee: takerFee.Amount, }) if err != nil { return err @@ -155,7 +156,8 @@ func (k Keeper) Sell(ctx sdk.Context, planId string, seller sdk.AccAddress, amou PlanId: planId, RollappId: plan.RollappId, Amount: amountTokensToSell, - Revenue: costMinusTakerFee.Amount, + Revenue: cost.Amount, + TakerFee: takerFee.Amount, }) if err != nil { return err diff --git a/x/iro/types/events.pb.go b/x/iro/types/events.pb.go index b96f57234..10b0f6ae2 100644 --- a/x/iro/types/events.pb.go +++ b/x/iro/types/events.pb.go @@ -152,6 +152,7 @@ type EventBuy struct { RollappId string `protobuf:"bytes,3,opt,name=rollapp_id,json=rollappId,proto3" json:"rollapp_id,omitempty"` Amount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,4,opt,name=amount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"amount"` Cost github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,5,opt,name=cost,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"cost"` + TakerFee github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,6,opt,name=taker_fee,json=takerFee,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"taker_fee"` } func (m *EventBuy) Reset() { *m = EventBuy{} } @@ -214,6 +215,7 @@ type EventSell struct { RollappId string `protobuf:"bytes,3,opt,name=rollapp_id,json=rollappId,proto3" json:"rollapp_id,omitempty"` Amount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,4,opt,name=amount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"amount"` Revenue github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,5,opt,name=revenue,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"revenue"` + TakerFee github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,6,opt,name=taker_fee,json=takerFee,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"taker_fee"` } func (m *EventSell) Reset() { *m = EventSell{} } @@ -413,42 +415,43 @@ func init() { } var fileDescriptor_9d7833031285167c = []byte{ - // 548 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x54, 0x4d, 0x6f, 0xd3, 0x40, - 0x10, 0x8d, 0xdb, 0x34, 0xa9, 0xa7, 0x07, 0x84, 0x55, 0x89, 0x34, 0x12, 0x4e, 0x65, 0x21, 0xe8, - 0xa5, 0x76, 0xd5, 0x4a, 0xdc, 0x09, 0x82, 0x62, 0x0e, 0x50, 0xb9, 0xe2, 0xc2, 0x25, 0xda, 0x64, - 0x17, 0xd7, 0x62, 0xed, 0xb1, 0x76, 0xd7, 0x4d, 0x8d, 0xc4, 0x99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, 0x05, 0x6d, 0x98, 0xa5, 0x7b, 0x5f, 0x2d, 0x00, - 0xed, 0xc4, 0x53, 0x4e, 0x92, 0x54, 0xbf, 0xc2, 0xea, 0xc0, 0x6e, 0xf2, 0x0a, 0x6b, 0xe2, 0x6d, - 0x9b, 0xe1, 0x95, 0xb0, 0x66, 0xfe, 0x4b, 0xa5, 0x38, 0x9b, 0x97, 0x63, 0x5d, 0x21, 0x67, 0xe9, - 0x5f, 0x39, 0x55, 0x1e, 0x22, 0x9f, 0x49, 0x6d, 0x46, 0xad, 0x0a, 0x86, 0xd4, 0xd9, 0x80, 0xd5, - 0x98, 0x14, 0x31, 0xab, 0x22, 0x4d, 0x1d, 0x69, 0x6b, 0x1c, 0xd2, 0xfe, 0xcb, 0xd3, 0x89, 0x6b, - 0x9d, 0x4d, 0x5c, 0xeb, 0xd7, 0xc4, 0xb5, 0x3e, 0x4f, 0xdd, 0xc6, 0xd9, 0xd4, 0x6d, 0x7c, 0x9f, - 0xba, 0x8d, 0xb7, 0x3b, 0x73, 0x43, 0x5c, 0xb2, 0xf2, 0x8e, 0xf7, 0x82, 0x13, 0xbd, 0xf7, 0xf4, - 0x48, 0xc3, 0x96, 0x5e, 0x7d, 0x7b, 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, 0xcb, 0xb3, 0x59, 0xda, - 0xb9, 0x05, 0x00, 0x00, + // 571 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x54, 0xdf, 0x6a, 0xd4, 0x4e, + 0x14, 0xde, 0x6c, 0xb7, 0xbb, 0xcd, 0xe9, 0xc5, 0x8f, 0xdf, 0x50, 0x30, 0x2d, 0x98, 0x96, 0x20, + 0xda, 0x9b, 0x26, 0xa5, 0x05, 0xef, 0x5d, 0xb1, 0x35, 0x0a, 0x5a, 0x52, 0xbc, 0xf1, 0x66, 0x99, + 0xdd, 0x39, 0x4d, 0x43, 0x27,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+ 0xf4, 0xbe, 0xb6, 0xc1, 0x36, 0x6e, 0xee, 0x22, 0xe7, 0x64, 0x1d, 0xba, 0x0a, 0x39, 0xbf, 0x85, + 0x9f, 0x0d, 0xef, 0xce, 0x0d, 0x7d, 0x0e, 0x3d, 0x59, 0x6d, 0x84, 0x02, 0xa7, 0xf4, 0x74, 0x9c, + 0xfe, 0x6f, 0x6d, 0xfd, 0x64, 0x01, 0x18, 0x5b, 0x9f, 0x72, 0x9a, 0xa4, 0xe6, 0x7d, 0x54, 0x3f, + 0x78, 0x9b, 0xf7, 0x51, 0x13, 0xef, 0xda, 0x59, 0xaf, 0x84, 0xf9, 0xe6, 0x62, 0x68, 0xcd, 0x71, + 0x52, 0x8e, 0x75, 0x8d, 0x9c, 0xf6, 0x9f, 0x72, 0xaa, 0x3c, 0x21, 0xf8, 0x58, 0x6a, 0x27, 0xea, + 0x56, 0x30, 0x64, 0x64, 0x11, 0xe6, 0x62, 0x5a, 0xc4, 0x58, 0x45, 0x3a, 0x26, 0xd2, 0x33, 0x38, + 0x64, 0xfd, 0x17, 0x27, 0xe7, 0xae, 0x75, 0x7a, 0xee, 0x5a, 0x3f, 0xcf, 0x5d, 0xeb, 0xc3, 0x85, + 0xdb, 0x3a, 0xbd, 0x70, 0x5b, 0xdf, 0x2e, 0xdc, 0xd6, 0xdb, 0xf5, 0x89, 0x21, 0xae, 0x58, 0xc6, + 0x87, 0x9b, 0xc1, 0xb1, 0xd9, 0xc8, 0x66, 0xa4, 0x61, 0xd7, 0x2c, 0xe5, 0xcd, 0x5f, 0x01, 0x00, + 0x00, 0xff, 0xff, 0xe7, 0xd0, 0xb5, 0xf4, 0x53, 0x06, 0x00, 0x00, } func (m *EventUpdateParams) Marshal() (dAtA []byte, err error) { @@ -565,6 +568,16 @@ func (m *EventBuy) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + { + size := m.TakerFee.Size() + i -= size + if _, err := m.TakerFee.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintEvents(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 { size := m.Cost.Size() i -= size @@ -629,6 +642,16 @@ func (m *EventSell) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + { + size := m.TakerFee.Size() + i -= size + if _, err := m.TakerFee.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintEvents(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 { size := m.Revenue.Size() i -= size @@ -845,6 +868,8 @@ func (m *EventBuy) Size() (n int) { n += 1 + l + sovEvents(uint64(l)) l = m.Cost.Size() n += 1 + l + sovEvents(uint64(l)) + l = m.TakerFee.Size() + n += 1 + l + sovEvents(uint64(l)) return n } @@ -870,6 +895,8 @@ func (m *EventSell) Size() (n int) { n += 1 + l + sovEvents(uint64(l)) l = m.Revenue.Size() n += 1 + l + sovEvents(uint64(l)) + l = m.TakerFee.Size() + n += 1 + l + sovEvents(uint64(l)) return n } @@ -1412,6 +1439,40 @@ func (m *EventBuy) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TakerFee", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + 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 ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.TakerFee.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipEvents(dAtA[iNdEx:]) @@ -1626,6 +1687,40 @@ func (m *EventSell) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TakerFee", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + 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 ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.TakerFee.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipEvents(dAtA[iNdEx:]) From 55592601c0b7cc2a13f649f556641adab63a8bdb Mon Sep 17 00:00:00 2001 From: Michael Tsitrin Date: Sun, 13 Oct 2024 14:15:04 +0300 Subject: [PATCH 3/5] added ibc denom to settle event --- proto/dymensionxyz/dymension/iro/events.proto | 5 +- x/iro/keeper/settle.go | 1 + x/iro/types/events.pb.go | 137 ++++++++++++------ 3 files changed, 99 insertions(+), 44 deletions(-) diff --git a/proto/dymensionxyz/dymension/iro/events.proto b/proto/dymensionxyz/dymension/iro/events.proto index e7491342b..4eea0a80a 100644 --- a/proto/dymensionxyz/dymension/iro/events.proto +++ b/proto/dymensionxyz/dymension/iro/events.proto @@ -75,6 +75,7 @@ message EventClaim { message EventSettle { string plan_id = 1; string rollapp_id = 2; - uint64 pool_id = 3; - uint64 gauge_id = 4; + string IBC_denom = 3; + uint64 pool_id = 4; + uint64 gauge_id = 5; } \ No newline at end of file diff --git a/x/iro/keeper/settle.go b/x/iro/keeper/settle.go index 176a64698..7cb46e873 100644 --- a/x/iro/keeper/settle.go +++ b/x/iro/keeper/settle.go @@ -67,6 +67,7 @@ func (k Keeper) Settle(ctx sdk.Context, rollappId, rollappIBCDenom string) error err = ctx.EventManager().EmitTypedEvent(&types.EventSettle{ PlanId: fmt.Sprintf("%d", plan.Id), RollappId: rollappId, + IBCDenom: rollappIBCDenom, PoolId: poolID, GaugeId: gaugeID, }) diff --git a/x/iro/types/events.pb.go b/x/iro/types/events.pb.go index 10b0f6ae2..dda3deeb3 100644 --- a/x/iro/types/events.pb.go +++ b/x/iro/types/events.pb.go @@ -336,8 +336,9 @@ func (m *EventClaim) GetRollappId() string { type EventSettle struct { PlanId string `protobuf:"bytes,1,opt,name=plan_id,json=planId,proto3" json:"plan_id,omitempty"` RollappId string `protobuf:"bytes,2,opt,name=rollapp_id,json=rollappId,proto3" json:"rollapp_id,omitempty"` - PoolId uint64 `protobuf:"varint,3,opt,name=pool_id,json=poolId,proto3" json:"pool_id,omitempty"` - GaugeId uint64 `protobuf:"varint,4,opt,name=gauge_id,json=gaugeId,proto3" json:"gauge_id,omitempty"` + IBCDenom string `protobuf:"bytes,3,opt,name=IBC_denom,json=IBCDenom,proto3" json:"IBC_denom,omitempty"` + PoolId uint64 `protobuf:"varint,4,opt,name=pool_id,json=poolId,proto3" json:"pool_id,omitempty"` + GaugeId uint64 `protobuf:"varint,5,opt,name=gauge_id,json=gaugeId,proto3" json:"gauge_id,omitempty"` } func (m *EventSettle) Reset() { *m = EventSettle{} } @@ -387,6 +388,13 @@ func (m *EventSettle) GetRollappId() string { return "" } +func (m *EventSettle) GetIBCDenom() string { + if m != nil { + return m.IBCDenom + } + return "" +} + func (m *EventSettle) GetPoolId() uint64 { if m != nil { return m.PoolId @@ -415,43 +423,45 @@ func init() { } var fileDescriptor_9d7833031285167c = []byte{ - // 571 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x54, 0xdf, 0x6a, 0xd4, 0x4e, - 0x14, 0xde, 0x6c, 0xb7, 0xbb, 0xcd, 0xe9, 0xc5, 0x8f, 0xdf, 0x50, 0x30, 0x2d, 0x98, 0x96, 0x20, - 0xda,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x8a, 0xc9, 0x25, 0x2f, - 0xc1, 0xd6, 0xf4, 0x00, 0xe5, 0x60, 0x0f, 0xd1, 0xe9, 0x4e, 0x55, 0x68, 0xce, 0x14, 0xd8, 0x42, - 0xf4, 0xbe, 0xb6, 0xc1, 0x36, 0x6e, 0xee, 0x22, 0xe7, 0x64, 0x1d, 0xba, 0x0a, 0x39, 0xbf, 0x85, - 0x9f, 0x0d, 0xef, 0xce, 0x0d, 0x7d, 0x0e, 0x3d, 0x59, 0x6d, 0x84, 0x02, 0xa7, 0xf4, 0x74, 0x9c, - 0xfe, 0x6f, 0x6d, 0xfd, 0x64, 0x01, 0x18, 0x5b, 0x9f, 0x72, 0x9a, 0xa4, 0xe6, 0x7d, 0x54, 0x3f, - 0x78, 0x9b, 0xf7, 0x51, 0x13, 0xef, 0xda, 0x59, 0xaf, 0x84, 0xf9, 0xe6, 0x62, 0x68, 0xcd, 0x71, - 0x52, 0x8e, 0x75, 0x8d, 0x9c, 0xf6, 0x9f, 0x72, 0xaa, 0x3c, 0x21, 0xf8, 0x58, 0x6a, 0x27, 0xea, - 0x56, 0x30, 0x64, 0x64, 0x11, 0xe6, 0x62, 0x5a, 0xc4, 0x58, 0x45, 0x3a, 0x26, 0xd2, 0x33, 0x38, - 0x64, 0xfd, 0x17, 0x27, 0xe7, 0xae, 0x75, 0x7a, 0xee, 0x5a, 0x3f, 0xcf, 0x5d, 0xeb, 0xc3, 0x85, - 0xdb, 0x3a, 0xbd, 0x70, 0x5b, 0xdf, 0x2e, 0xdc, 0xd6, 0xdb, 0xf5, 0x89, 0x21, 0xae, 0x58, 0xc6, - 0x87, 0x9b, 0xc1, 0xb1, 0xd9, 0xc8, 0x66, 0xa4, 0x61, 0xd7, 0x2c, 0xe5, 0xcd, 0x5f, 0x01, 0x00, - 0x00, 0xff, 0xff, 0xe7, 0xd0, 0xb5, 0xf4, 0x53, 0x06, 0x00, 0x00, + // 593 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0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0xd6, 0xad, 0x1d, 0x9f, 0x75, 0x6b, 0xdf, 0xce, 0xba, 0xb5, 0x37, + 0x2b, 0x63, 0x23, 0x5e, 0xb2, 0xaa, 0xf7, 0xd7, 0x82, 0x43, 0xb3, 0xaf, 0xcd, 0xc0, 0xc3, 0xa6, + 0x59, 0xd9, 0x6b, 0xbf, 0x02, 0x00, 0x00, 0xff, 0xff, 0x18, 0xc4, 0x05, 0x9b, 0x71, 0x06, 0x00, + 0x00, } func (m *EventUpdateParams) Marshal() (dAtA []byte, err error) { @@ -773,12 +783,19 @@ func (m *EventSettle) MarshalToSizedBuffer(dAtA []byte) (int, error) { if m.GaugeId != 0 { i = encodeVarintEvents(dAtA, i, uint64(m.GaugeId)) i-- - dAtA[i] = 0x20 + dAtA[i] = 0x28 } if m.PoolId != 0 { i = encodeVarintEvents(dAtA, i, uint64(m.PoolId)) i-- - dAtA[i] = 0x18 + dAtA[i] = 0x20 + } + if len(m.IBCDenom) > 0 { + i -= len(m.IBCDenom) + copy(dAtA[i:], m.IBCDenom) + i = encodeVarintEvents(dAtA, i, uint64(len(m.IBCDenom))) + i-- + dAtA[i] = 0x1a } if len(m.RollappId) > 0 { i -= len(m.RollappId) @@ -937,6 +954,10 @@ func (m *EventSettle) Size() (n int) { if l > 0 { n += 1 + l + sovEvents(uint64(l)) } + l = len(m.IBCDenom) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } if m.PoolId != 0 { n += 1 + sovEvents(uint64(m.PoolId)) } @@ -2016,6 +2037,38 @@ func (m *EventSettle) Unmarshal(dAtA []byte) error { m.RollappId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field IBCDenom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + 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 ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.IBCDenom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field PoolId", wireType) } @@ -2034,7 +2087,7 @@ func (m *EventSettle) Unmarshal(dAtA []byte) error { break } } - case 4: + case 5: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field GaugeId", wireType) } From a2c3bf09e19db80c7f07ac0a72979190bd1f4b9f Mon Sep 17 00:00:00 2001 From: Michael Tsitrin Date: Sun, 13 Oct 2024 14:15:27 +0300 Subject: [PATCH 4/5] proto format --- proto/dymensionxyz/dymension/iro/events.proto | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/proto/dymensionxyz/dymension/iro/events.proto b/proto/dymensionxyz/dymension/iro/events.proto index 4eea0a80a..b57f09b27 100644 --- a/proto/dymensionxyz/dymension/iro/events.proto +++ b/proto/dymensionxyz/dymension/iro/events.proto @@ -14,27 +14,25 @@ message EventUpdateParams { Params old_params = 3 [ (gogoproto.nullable) = false ]; } - message EventNewIROPlan { string creator = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; string plan_id = 2; string rollapp_id = 3; } - message EventBuy { string buyer = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; string plan_id = 2; string rollapp_id = 3; - string amount = 4[ + string amount = 4 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false ]; - string cost = 5[ + string cost = 5 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false ]; - string taker_fee = 6[ + string taker_fee = 6 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false ]; @@ -44,17 +42,17 @@ message EventSell { string seller = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; string plan_id = 2; string rollapp_id = 3; - string amount = 4[ + string amount = 4 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false ]; - string revenue = 5[ + string revenue = 5 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false ]; - string taker_fee = 6[ + string taker_fee = 6 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false ]; @@ -64,14 +62,12 @@ message EventClaim { string claimer = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; string plan_id = 2; string rollapp_id = 3; - string amount = 4[ + string amount = 4 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false ]; } - - message EventSettle { string plan_id = 1; string rollapp_id = 2; From 49cb07a9d587d39292e07c4bc0cca8cb98f908b4 Mon Sep 17 00:00:00 2001 From: Michael Tsitrin Date: Sun, 13 Oct 2024 14:28:36 +0300 Subject: [PATCH 5/5] updated ethermint to include VFC client queries --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 289adccd6..dc3adf36b 100644 --- a/go.mod +++ b/go.mod @@ -238,7 +238,7 @@ replace ( // for collections cosmossdk.io/api => cosmossdk.io/api v0.3.1 // use dymension forks - github.com/evmos/ethermint => github.com/dymensionxyz/ethermint v0.22.0-dymension-v0.4.1.0.20240625101522-b1506ae83050 + github.com/evmos/ethermint => github.com/dymensionxyz/ethermint v0.22.0-dymension-v0.4.1.0.20241013112411-5ef491708a2d github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 github.com/osmosis-labs/osmosis/osmomath => github.com/dymensionxyz/osmosis/osmomath v0.0.6-dymension-v0.1.0.20240820121212-c0e21fa21e43 github.com/osmosis-labs/osmosis/v15 => github.com/dymensionxyz/osmosis/v15 v15.2.1-0.20240820121212-c0e21fa21e43 diff --git a/go.sum b/go.sum index 2a19763e3..a67018703 100644 --- a/go.sum +++ b/go.sum @@ -500,8 +500,8 @@ github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkp github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= github.com/dvsekhvalnov/jose2go v1.6.0 h1:Y9gnSnP4qEI0+/uQkHvFXeD2PLPJeXEL+ySMEA2EjTY= github.com/dvsekhvalnov/jose2go v1.6.0/go.mod h1:QsHjhyTlD/lAVqn/NSbVZmSCGeDehTB/mPZadG+mhXU= -github.com/dymensionxyz/ethermint v0.22.0-dymension-v0.4.1.0.20240625101522-b1506ae83050 h1:1mtlo6bDOdBihHWbDpOaai0NMC/4xHCkCHGCqdLT8WM= -github.com/dymensionxyz/ethermint v0.22.0-dymension-v0.4.1.0.20240625101522-b1506ae83050/go.mod h1:aokD0im7cUMMtR/khzNsmcGtINtxCpBfcgRvJdmLymA= +github.com/dymensionxyz/ethermint v0.22.0-dymension-v0.4.1.0.20241013112411-5ef491708a2d h1:UiPbek/78Cr0hUKJmCCtVt0VkfGop5zV39tnF08I6Qk= +github.com/dymensionxyz/ethermint v0.22.0-dymension-v0.4.1.0.20241013112411-5ef491708a2d/go.mod h1:aokD0im7cUMMtR/khzNsmcGtINtxCpBfcgRvJdmLymA= github.com/dymensionxyz/gerr-cosmos v1.1.0 h1:IW/P7HCB/iP9kgk3VXaWUoMoyx3vD76YO6p1fnubHVc= github.com/dymensionxyz/gerr-cosmos v1.1.0/go.mod h1:n+0olxPogzWqFKba45mCpvrHLGmeS8W9UZjggHnWk6c= github.com/dymensionxyz/osmosis/osmomath v0.0.6-dymension-v0.1.0.20240820121212-c0e21fa21e43 h1:EskhZ6ILN3vwJ6l8gPWPZ49RFSB52WghT5v+pmzrNCI=