Skip to content

Commit

Permalink
chore: base EboActor implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
0xyaco committed Jul 31, 2024
1 parent e97d367 commit d0171b2
Show file tree
Hide file tree
Showing 7 changed files with 95 additions and 2 deletions.
3 changes: 2 additions & 1 deletion packages/automated-dispute/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"author": "",
"license": "ISC",
"dependencies": {
"viem": "2.17.11"
"viem": "2.17.11",
"@ebo-agent/blocknumber": "workspace:*"
}
}
66 changes: 66 additions & 0 deletions packages/automated-dispute/src/eboActor.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import { BlockNumberService } from "@ebo-agent/blocknumber";

import { ProtocolProvider } from "./protocolProvider.js";
import {
DisputeStatusChanged,
RequestCreated,
RequestFinalizable,
ResponseDisputed,
} from "./types/events.js";
import { Dispute, Response } from "./types/prophet.js";

export class EboActor {
private requestActivity: unknown[];

constructor(
private readonly protocolProvider: ProtocolProvider,
private readonly blockNumberService: BlockNumberService,
private readonly requestId: string,
) {
this.requestActivity = [];
}

public async onRequestCreated(_event: RequestCreated): Promise<void> {
// TODO: implement
return;
}

public async onResponseProposed(_event: ResponseDisputed): Promise<void> {
// TODO: implement
return;
}

public async onResponseDisputed(_event: ResponseDisputed): Promise<void> {
// TODO: implement
return;
}

private async proposeResponse(_response: Response): Promise<void> {
// TODO: implement
return;
}

private async disputeProposal(_dispute: Dispute): Promise<void> {
// TODO: implement
return;
}

private async isValidDispute(_dispute: Dispute): Promise<boolean> {
// TODO: implement
return true;
}

public async onFinalizeRequest(_event: RequestFinalizable): Promise<void> {
// TODO: implement
return;
}

public async onDisputeStatusChanged(_event: DisputeStatusChanged): Promise<void> {
// TODO: implement
return;
}

public async onDisputeEscalated(_event: Dispute): Promise<void> {
return;
}
}
12 changes: 12 additions & 0 deletions packages/automated-dispute/src/types/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,18 @@ export type DisputeStatusChanged = BaseEvent & {
metadata: { disputeId: string; status: string; blockNumber: bigint };
};

export type DisputeEscalated = BaseEvent & {
metadata: { caller: string; disputeId: string; blockNumber: bigint };
};

export type RequestFinalizable = BaseEvent & {
metadata: { requestId: string };
};

export type RequestFinalized = BaseEvent & {
metadata: { requestId: string; responseId: string; caller: string; blockNumber: bigint };
};

export type EboEvent =
| NewEpoch
| RequestCreated
Expand Down
10 changes: 10 additions & 0 deletions packages/automated-dispute/tests/eboActor.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { describe } from "vitest";

describe("EboActor", () => {
describe.skip("onRequestCreated");
describe.skip("onResponseProposed");
describe.skip("onResponseDisputed");
describe.skip("onFinalizeRequest");
describe.skip("onDisputeStatusChanged");
describe.skip("onDisputeEscalated");
});
2 changes: 1 addition & 1 deletion packages/blocknumber/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@ebo-agent/blocknumber",
"version": "1.0.0",
"description": "",
"main": "index.ts",
"main": "./dist/index.js",
"type": "module",
"scripts": {
"build": "tsc -p tsconfig.build.json",
Expand Down
1 change: 1 addition & 0 deletions packages/blocknumber/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./services/index.js";
3 changes: 3 additions & 0 deletions pnpm-lock.yaml

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

0 comments on commit d0171b2

Please sign in to comment.