Skip to content

Commit 09edac3

Browse files
committed
chore: update pool event parsing
1 parent 22ab2d9 commit 09edac3

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

src/pool/pool_events.ts

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ export enum PoolEventType {
2929
GulpEmissions = 'gulp_emissions',
3030
Gulp = 'gulp',
3131
DefaultedDebt = 'defaulted_debt',
32+
DeleteAuction = 'delete_auction',
3233
}
3334
export interface BasePoolEvent extends BaseBlendEvent {
3435
contractType: BlendContractType.Pool;
@@ -206,6 +207,12 @@ export interface PoolFillAuctionV2Event extends BasePoolEvent {
206207
filledAuctionData: AuctionData;
207208
}
208209

210+
export interface PoolDeleteAuction extends BasePoolEvent {
211+
eventType: PoolEventType.DeleteAuction;
212+
user: string;
213+
auctionType: number;
214+
}
215+
209216
export type PoolEvent =
210217
| PoolSetAdminEvent
211218
| PoolUpdatePoolEvent
@@ -231,7 +238,8 @@ export type PoolEvent =
231238
| PoolGulpEvent
232239
| PoolGulpEmissionsEvent
233240
| PoolNewAuctionV2Event
234-
| PoolFillAuctionV2Event;
241+
| PoolFillAuctionV2Event
242+
| PoolDeleteAuction;
235243

236244
/**
237245
* Create a PoolEvent from a RawEventResponse.
@@ -661,6 +669,23 @@ export function poolEventFromEventResponse(
661669
newBRate: newBRate,
662670
} as PoolGulpEvent;
663671
}
672+
case PoolEventType.DeleteAuction: {
673+
if (topic_scval.length !== 3) {
674+
return undefined;
675+
}
676+
const auctionType = Number(scValToNative(topic_scval[1]));
677+
const user = Address.fromScVal(topic_scval[2]).toString();
678+
679+
if (isNaN(auctionType)) {
680+
return undefined;
681+
}
682+
return {
683+
...baseEvent,
684+
eventType: PoolEventType.DeleteAuction,
685+
user: user,
686+
auctionType: auctionType,
687+
} as PoolDeleteAuction;
688+
}
664689
default:
665690
return undefined;
666691
}

0 commit comments

Comments
 (0)