Skip to content

Commit

Permalink
add event
Browse files Browse the repository at this point in the history
  • Loading branch information
lumtis committed Feb 2, 2024
1 parent 14acf5d commit 7c2084b
Show file tree
Hide file tree
Showing 4 changed files with 366 additions and 43 deletions.
6 changes: 6 additions & 0 deletions proto/crosschain/events.proto
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,9 @@ message EventOutboundSuccess {
string new_status = 4;
string value_received = 5;
}

message EventCCTXGasPriceIncreased {
string cctx_index = 1;
string gas_price_increase = 2;
string additional_fees = 3;
}
34 changes: 34 additions & 0 deletions typescript/crosschain/events_pb.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -291,3 +291,37 @@ export declare class EventOutboundSuccess extends Message<EventOutboundSuccess>
static equals(a: EventOutboundSuccess | PlainMessage<EventOutboundSuccess> | undefined, b: EventOutboundSuccess | PlainMessage<EventOutboundSuccess> | undefined): boolean;
}

/**
* @generated from message zetachain.zetacore.crosschain.EventCCTXGasPriceIncreased
*/
export declare class EventCCTXGasPriceIncreased extends Message<EventCCTXGasPriceIncreased> {
/**
* @generated from field: string cctx_index = 1;
*/
cctxIndex: string;

/**
* @generated from field: string gas_price_increase = 2;
*/
gasPriceIncrease: string;

/**
* @generated from field: string additional_fees = 3;
*/
additionalFees: string;

constructor(data?: PartialMessage<EventCCTXGasPriceIncreased>);

static readonly runtime: typeof proto3;
static readonly typeName = "zetachain.zetacore.crosschain.EventCCTXGasPriceIncreased";
static readonly fields: FieldList;

static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): EventCCTXGasPriceIncreased;

static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): EventCCTXGasPriceIncreased;

static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): EventCCTXGasPriceIncreased;

static equals(a: EventCCTXGasPriceIncreased | PlainMessage<EventCCTXGasPriceIncreased> | undefined, b: EventCCTXGasPriceIncreased | PlainMessage<EventCCTXGasPriceIncreased> | undefined): boolean;
}

17 changes: 12 additions & 5 deletions x/crosschain/keeper/abci.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,18 @@ IterateChains:
continue IterateChains
}
if !gasPriceIncrease.IsNil() && !gasPriceIncrease.IsZero() {
ctx.Logger().Info("GasStabilityPool: updated gas price for pending cctx",
"cctxIndex", pendingCctx.Index,
"gasPriceIncrease", gasPriceIncrease.String(),
"additionalFees", additionalFees.String(),
)
// Emit typed event for gas price increase
if err := ctx.EventManager().EmitTypedEvent(
&types.EventCCTXGasPriceIncreased{
CctxIndex: pendingCctx.Index,
GasPriceIncrease: gasPriceIncrease.String(),
AdditionalFees: additionalFees.String(),
}); err != nil {
ctx.Logger().Error(
"GasStabilityPool: failed to emit EventCCTXGasPriceIncreased",
"err", err.Error(),
)
}
cctxCount++
}
}
Expand Down
Loading

0 comments on commit 7c2084b

Please sign in to comment.