Skip to content

Commit

Permalink
feat(eibc): add operator address and fee to the eibc authorized event (
Browse files Browse the repository at this point in the history
  • Loading branch information
zale144 authored Nov 27, 2024
1 parent 5c1c120 commit 39f197c
Show file tree
Hide file tree
Showing 4 changed files with 178 additions and 58 deletions.
12 changes: 8 additions & 4 deletions proto/dymensionxyz/dymension/eibc/events.proto
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ message EventDemandOrderFeeUpdated {
message EventDemandOrderFulfilled {
// order_id is the unique identifier of the demand order.
string order_id = 1;
// fulfillment_id is the unique identifier of the fulfillment.
// price is the price of the demand order.
string price = 2;
// fulfillment_amount is the amount of the fulfillment.
// fee is the fee of the demand order.
string fee = 3;
// is_fulfilled is the flag indicating whether the order is fulfilled.
bool is_fulfilled = 4;
Expand All @@ -85,9 +85,9 @@ message EventDemandOrderFulfilled {
message EventDemandOrderFulfilledAuthorized {
// order_id is the unique identifier of the demand order.
string order_id = 1;
// fulfillment_id is the unique identifier of the fulfillment.
// price is the price of the demand order.
string price = 2;
// fulfillment_amount is the amount of the fulfillment.
// fee is the fee of the demand order.
string fee = 3;
// is_fulfilled is the flag indicating whether the order is fulfilled.
bool is_fulfilled = 4;
Expand All @@ -101,4 +101,8 @@ message EventDemandOrderFulfilledAuthorized {
uint64 creation_height = 11;
// lp_address is the address of the LP.
string lp_address = 12;
// operator_address is the address of the operator.
string operator_address = 13;
// operator_fee is the fee of the operator.
string operator_fee = 14;
}
7 changes: 6 additions & 1 deletion x/eibc/keeper/msg_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,12 @@ func (m msgServer) FulfillOrderAuthorized(goCtx context.Context, msg *types.MsgF
return nil, err
}

if err = uevent.EmitTypedEvent(ctx, demandOrder.GetFulfilledAuthorizedEvent(demandOrder.CreationHeight, msg.LpAddress)); err != nil {
if err = uevent.EmitTypedEvent(ctx, demandOrder.GetFulfilledAuthorizedEvent(
demandOrder.CreationHeight,
msg.LpAddress,
operatorAccount.GetAddress().String(),
operatorFee.String(),
)); err != nil {
return nil, fmt.Errorf("emit event: %w", err)
}

Expand Down
25 changes: 15 additions & 10 deletions x/eibc/types/demand_order.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,17 +104,22 @@ func (m *DemandOrder) GetFulfilledEvent() *EventDemandOrderFulfilled {
}
}

func (m *DemandOrder) GetFulfilledAuthorizedEvent(creationHeight uint64, lpAddress string) *EventDemandOrderFulfilledAuthorized {
func (m *DemandOrder) GetFulfilledAuthorizedEvent(
creationHeight uint64,
lpAddress, operatorAddress, operatorFee string,
) *EventDemandOrderFulfilledAuthorized {
return &EventDemandOrderFulfilledAuthorized{
OrderId: m.Id,
Price: m.Price.String(),
Fee: m.Fee.String(),
IsFulfilled: true,
PacketStatus: m.TrackingPacketStatus.String(),
Fulfiller: m.FulfillerAddress,
PacketType: m.Type.String(),
CreationHeight: creationHeight,
LpAddress: lpAddress,
OrderId: m.Id,
Price: m.Price.String(),
Fee: m.Fee.String(),
IsFulfilled: true,
PacketStatus: m.TrackingPacketStatus.String(),
Fulfiller: m.FulfillerAddress,
PacketType: m.Type.String(),
CreationHeight: creationHeight,
LpAddress: lpAddress,
OperatorAddress: operatorAddress,
OperatorFee: operatorFee,
}
}

Expand Down
192 changes: 149 additions & 43 deletions x/eibc/types/events.pb.go

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

0 comments on commit 39f197c

Please sign in to comment.