Skip to content

Commit

Permalink
Index signature pub (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
jiguantong authored Apr 3, 2024
1 parent 3004a30 commit 8b23469
Show file tree
Hide file tree
Showing 6 changed files with 80 additions and 1 deletion.
File renamed without changes.
File renamed without changes.
46 changes: 46 additions & 0 deletions abis/v2/SignaturePubAbi.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
export const SignaturePubAbi = [
{
name: "SignatureSubmittion",
type: "event",
inputs: [
{
name: "chainId",
type: "uint256",
indexed: true,
internalType: "uint256",
},
{
name: "msgIndex",
type: "uint256",
indexed: true,
internalType: "uint256",
},
{
name: "signer",
type: "address",
indexed: true,
internalType: "address",
},
{
name: "signature",
type: "bytes",
indexed: false,
internalType: "bytes",
},
{ name: "data", type: "bytes", indexed: false, internalType: "bytes" },
],
anonymous: false,
},
{
name: "submit",
type: "function",
inputs: [
{ name: "chainId", type: "uint256", internalType: "uint256" },
{ name: "msgIndex", type: "uint256", internalType: "uint256" },
{ name: "signature", type: "bytes", internalType: "bytes" },
{ name: "data", type: "bytes", internalType: "bytes" },
],
outputs: [],
stateMutability: "nonpayable",
},
] as const;
12 changes: 11 additions & 1 deletion ponder.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { ORMPAbi as ORMPAbiV2 } from "./abis/v2/ORMPAbi";
import { ORMPAbi as ORMPAbiV1 } from "./abis/v1/ORMPAbi";
import { ORMPOracleAbi as ORMPOracleAbiV1 } from "./abis/v1/ORMPOracleAbi";
import { ORMPRelayerAbi as ORMPRelayerAbiV1 } from "./abis/v1/ORMPRelayerAbi";
import { SignaturePubAbi } from "./abis/v2/SignaturePubAbi";

// const INFURA_API_KEY = process.env.INFURA_API_KEY;
const INFURA_API_KEY = null;
Expand Down Expand Up @@ -133,7 +134,7 @@ export default createConfig({
network: {
// testnets
sepolia: {
startBlock: 5579141
startBlock: 5579141,
},
arbitrum_sepolia: {
startBlock: 27875636
Expand All @@ -148,6 +149,15 @@ export default createConfig({
event: ["MessageAccepted", "MessageDispatched", "MessageAssigned"],
},
},
SignaturePub: {
abi: SignaturePubAbi,
address: "0x57dd62e0986a61a269c769b107a5a7952d73b7ed",
network: {
darwinia: {
startBlock: 2394555,
}
}
},

// === V1
ORMPV1: {
Expand Down
8 changes: 8 additions & 0 deletions ponder.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@ export default createSchema((p) => ({
oracleFee: p.bigint(),
relayerFee: p.bigint(),
}),
SignatureSubmittion: p.createTable({
id: p.string(),
chainId: p.bigint(),
msgIndex: p.bigint(),
signer: p.string(),
signature: p.string(),
data: p.string(),
}),
// === V1
MessageAcceptedV1: p.createTable({
id: p.string(),
Expand Down
15 changes: 15 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,21 @@ ponder.on("ORMPV2:MessageAssigned", async ({ event, context }) => {
});
});

ponder.on("SignaturePub:SignatureSubmittion", async ({ event, context }) => {
const { SignatureSubmittion } = context.db;
await SignatureSubmittion.create({
id: event.log.id,
data: {
chainId: event.args.chainId,
msgIndex: event.args.msgIndex,
signer: event.args.signer,
signature: event.args.signature,
data: event.args.data,
},
});
});

// V1
ponder.on("ORMPV1:MessageAccepted", async ({ event, context }) => {
const { MessageAcceptedV1 } = context.db;
const message = event.args.message;
Expand Down

0 comments on commit 8b23469

Please sign in to comment.