diff --git a/ponder.schema.ts b/ponder.schema.ts index 8e82f46..db3fbbe 100644 --- a/ponder.schema.ts +++ b/ponder.schema.ts @@ -3,7 +3,7 @@ import { createSchema } from "@ponder/core"; export default createSchema((p) => ({ Acknowledgement: p.createTable({ id: p.string(), - dispatcherAddress: p.string(), + dispatcherAddress: p.hex(), dispatcherType: p.string(), sourcePortAddress: p.string(), sourceChannelId: p.string(), @@ -15,10 +15,11 @@ export default createSchema((p) => ({ gas: p.bigint(), maxFeePerGas: p.bigint().optional(), maxPriorityFeePerGas: p.bigint().optional(), + from: p.string(), }), CloseIbcChannel: p.createTable({ id: p.string(), - dispatcherAddress: p.string(), + dispatcherAddress: p.hex(), dispatcherType: p.string(), portAddress: p.string(), channelId: p.string(), @@ -29,10 +30,11 @@ export default createSchema((p) => ({ gas: p.bigint(), maxFeePerGas: p.bigint().optional(), maxPriorityFeePerGas: p.bigint().optional(), + from: p.string(), }), ConnectIbcChannel: p.createTable({ id: p.string(), - dispatcherAddress: p.string(), + dispatcherAddress: p.hex(), dispatcherType: p.string(), portAddress: p.string(), channelId: p.string(), @@ -43,10 +45,11 @@ export default createSchema((p) => ({ gas: p.bigint(), maxFeePerGas: p.bigint().optional(), maxPriorityFeePerGas: p.bigint().optional(), + from: p.string(), }), OpenIbcChannel: p.createTable({ id: p.string(), - dispatcherAddress: p.string(), + dispatcherAddress: p.hex(), dispatcherType: p.string(), portAddress: p.string(), version: p.string(), @@ -62,10 +65,11 @@ export default createSchema((p) => ({ gas: p.bigint(), maxFeePerGas: p.bigint().optional(), maxPriorityFeePerGas: p.bigint().optional(), + from: p.string(), }), OwnershipTransferred: p.createTable({ id: p.string(), - dispatcherAddress: p.string(), + dispatcherAddress: p.hex(), dispatcherType: p.string(), previousOwner: p.string(), newOwner: p.string(), @@ -76,10 +80,11 @@ export default createSchema((p) => ({ gas: p.bigint(), maxFeePerGas: p.bigint().optional(), maxPriorityFeePerGas: p.bigint().optional(), + from: p.string(), }), RecvPacket: p.createTable({ id: p.string(), - dispatcherAddress: p.string(), + dispatcherAddress: p.hex(), dispatcherType: p.string(), destPortAddress: p.string(), destChannelId: p.string(), @@ -91,10 +96,11 @@ export default createSchema((p) => ({ gas: p.bigint(), maxFeePerGas: p.bigint().optional(), maxPriorityFeePerGas: p.bigint().optional(), + from: p.string(), }), SendPacket: p.createTable({ id: p.string(), - dispatcherAddress: p.string(), + dispatcherAddress: p.hex(), dispatcherType: p.string(), sourcePortAddress: p.string(), sourceChannelId: p.string(), @@ -108,10 +114,11 @@ export default createSchema((p) => ({ gas: p.bigint(), maxFeePerGas: p.bigint().optional(), maxPriorityFeePerGas: p.bigint().optional(), + from: p.string(), }), Timeout: p.createTable({ id: p.string(), - dispatcherAddress: p.string(), + dispatcherAddress: p.hex(), dispatcherType: p.string(), sourcePortAddress: p.string(), sourceChannelId: p.string(), @@ -123,10 +130,11 @@ export default createSchema((p) => ({ gas: p.bigint(), maxFeePerGas: p.bigint().optional(), maxPriorityFeePerGas: p.bigint().optional(), + from: p.string(), }), WriteAckPacket: p.createTable({ id: p.string(), - dispatcherAddress: p.string(), + dispatcherAddress: p.hex(), dispatcherType: p.string(), writerPortAddress: p.string(), writerChannelId: p.string(), @@ -140,10 +148,11 @@ export default createSchema((p) => ({ gas: p.bigint(), maxFeePerGas: p.bigint().optional(), maxPriorityFeePerGas: p.bigint().optional(), + from: p.string(), }), WriteTimeoutPacket: p.createTable({ id: p.string(), - dispatcherAddress: p.string(), + dispatcherAddress: p.hex(), dispatcherType: p.string(), writerPortAddress: p.string(), writerChannelId: p.string(), @@ -158,5 +167,6 @@ export default createSchema((p) => ({ gas: p.bigint(), maxFeePerGas: p.bigint().optional(), maxPriorityFeePerGas: p.bigint().optional(), + from: p.string(), }), })); \ No newline at end of file diff --git a/src/index.ts b/src/index.ts index 3a88507..3064bba 100644 --- a/src/index.ts +++ b/src/index.ts @@ -7,7 +7,7 @@ ponder.on("DispatcherSim:Acknowledgement", async ({event, context}) => { await context.db.Acknowledgement.create({ id: event.log.id, data: { - dispatcherAddress: address || "", + dispatcherAddress: address || "0x", dispatcherType: "sim", sourcePortAddress: event.args.sourcePortAddress, sourceChannelId: ethers.decodeBytes32String(event.args.sourceChannelId), @@ -19,6 +19,7 @@ ponder.on("DispatcherSim:Acknowledgement", async ({event, context}) => { gas: event.transaction.gas, maxFeePerGas: event.transaction.maxFeePerGas, maxPriorityFeePerGas: event.transaction.maxPriorityFeePerGas, + from: event.transaction.from.toString(), }, }); }); @@ -29,7 +30,7 @@ ponder.on("DispatcherSim:CloseIbcChannel", async ({event, context}) => { await context.db.CloseIbcChannel.create({ id: event.log.id, data: { - dispatcherAddress: address || "", + dispatcherAddress: address || "0x", dispatcherType: "sim", portAddress: event.args.portAddress, channelId: ethers.decodeBytes32String(event.args.channelId), @@ -40,6 +41,7 @@ ponder.on("DispatcherSim:CloseIbcChannel", async ({event, context}) => { gas: event.transaction.gas, maxFeePerGas: event.transaction.maxFeePerGas, maxPriorityFeePerGas: event.transaction.maxPriorityFeePerGas, + from: event.transaction.from.toString(), }, }); }); @@ -50,7 +52,7 @@ ponder.on("DispatcherSim:ConnectIbcChannel", async ({event, context}) => { await context.db.ConnectIbcChannel.create({ id: event.log.id, data: { - dispatcherAddress: address || "", + dispatcherAddress: address || "0x", dispatcherType: "sim", portAddress: event.args.portAddress, channelId: ethers.decodeBytes32String(event.args.channelId), @@ -61,6 +63,7 @@ ponder.on("DispatcherSim:ConnectIbcChannel", async ({event, context}) => { gas: event.transaction.gas, maxFeePerGas: event.transaction.maxFeePerGas, maxPriorityFeePerGas: event.transaction.maxPriorityFeePerGas, + from: event.transaction.from.toString(), }, }); }); @@ -71,7 +74,7 @@ ponder.on("DispatcherSim:OpenIbcChannel", async ({event, context}) => { await context.db.OpenIbcChannel.create({ id: event.log.id, data: { - dispatcherAddress: address || "", + dispatcherAddress: address || "0x", dispatcherType: "sim", portAddress: event.args.portAddress, version: event.args.version, @@ -88,6 +91,7 @@ ponder.on("DispatcherSim:OpenIbcChannel", async ({event, context}) => { gas: event.transaction.gas, maxFeePerGas: event.transaction.maxFeePerGas, maxPriorityFeePerGas: event.transaction.maxPriorityFeePerGas, + from: event.transaction.from.toString(), }, }); }); @@ -98,7 +102,7 @@ ponder.on("DispatcherSim:OwnershipTransferred", async ({event, context}) => { await context.db.OwnershipTransferred.create({ id: event.log.id, data: { - dispatcherAddress: address || "", + dispatcherAddress: address || "0x", dispatcherType: "sim", previousOwner: event.args.previousOwner, newOwner: event.args.newOwner, @@ -109,6 +113,7 @@ ponder.on("DispatcherSim:OwnershipTransferred", async ({event, context}) => { gas: event.transaction.gas, maxFeePerGas: event.transaction.maxFeePerGas, maxPriorityFeePerGas: event.transaction.maxPriorityFeePerGas, + from: event.transaction.from.toString(), }, }); }); @@ -119,7 +124,7 @@ ponder.on("DispatcherSim:RecvPacket", async ({event, context}) => { await context.db.RecvPacket.create({ id: event.log.id, data: { - dispatcherAddress: address || "", + dispatcherAddress: address || "0x", dispatcherType: "sim", destPortAddress: event.args.destPortAddress, destChannelId: ethers.decodeBytes32String(event.args.destChannelId), @@ -131,6 +136,7 @@ ponder.on("DispatcherSim:RecvPacket", async ({event, context}) => { gas: event.transaction.gas, maxFeePerGas: event.transaction.maxFeePerGas, maxPriorityFeePerGas: event.transaction.maxPriorityFeePerGas, + from: event.transaction.from.toString(), }, }); }); @@ -141,7 +147,7 @@ ponder.on("DispatcherSim:SendPacket", async ({event, context}) => { await context.db.SendPacket.create({ id: event.log.id, data: { - dispatcherAddress: address || "", + dispatcherAddress: address || "0x", dispatcherType: "sim", sourcePortAddress: event.args.sourcePortAddress, sourceChannelId: ethers.decodeBytes32String(event.args.sourceChannelId), @@ -155,6 +161,7 @@ ponder.on("DispatcherSim:SendPacket", async ({event, context}) => { gas: event.transaction.gas, maxFeePerGas: event.transaction.maxFeePerGas, maxPriorityFeePerGas: event.transaction.maxPriorityFeePerGas, + from: event.transaction.from.toString(), }, }); }); @@ -165,7 +172,7 @@ ponder.on("DispatcherSim:Timeout", async ({event, context}) => { await context.db.Timeout.create({ id: event.log.id, data: { - dispatcherAddress: address || "", + dispatcherAddress: address || "0x", dispatcherType: "sim", sourcePortAddress: event.args.sourcePortAddress, sourceChannelId: ethers.decodeBytes32String(event.args.sourceChannelId), @@ -177,6 +184,7 @@ ponder.on("DispatcherSim:Timeout", async ({event, context}) => { gas: event.transaction.gas, maxFeePerGas: event.transaction.maxFeePerGas, maxPriorityFeePerGas: event.transaction.maxPriorityFeePerGas, + from: event.transaction.from.toString(), }, }); }); @@ -187,7 +195,7 @@ ponder.on("DispatcherSim:WriteAckPacket", async ({event, context}) => { await context.db.WriteAckPacket.create({ id: event.log.id, data: { - dispatcherAddress: address || "", + dispatcherAddress: address || "0x", dispatcherType: "sim", writerPortAddress: event.args.writerPortAddress, writerChannelId: ethers.decodeBytes32String(event.args.writerChannelId), @@ -201,6 +209,7 @@ ponder.on("DispatcherSim:WriteAckPacket", async ({event, context}) => { gas: event.transaction.gas, maxFeePerGas: event.transaction.maxFeePerGas, maxPriorityFeePerGas: event.transaction.maxPriorityFeePerGas, + from: event.transaction.from.toString(), }, }); }); @@ -211,7 +220,7 @@ ponder.on("DispatcherSim:WriteTimeoutPacket", async ({event, context}) => { await context.db.WriteTimeoutPacket.create({ id: event.log.id, data: { - dispatcherAddress: address || "", + dispatcherAddress: address || "0x", dispatcherType: "sim", writerPortAddress: event.args.writerPortAddress, writerChannelId: ethers.decodeBytes32String(event.args.writerChannelId), @@ -226,6 +235,7 @@ ponder.on("DispatcherSim:WriteTimeoutPacket", async ({event, context}) => { gas: event.transaction.gas, maxFeePerGas: event.transaction.maxFeePerGas, maxPriorityFeePerGas: event.transaction.maxPriorityFeePerGas, + from: event.transaction.from.toString(), }, }); }); @@ -236,7 +246,7 @@ ponder.on("DispatcherProof:Acknowledgement", async ({event, context}) => { await context.db.Acknowledgement.create({ id: event.log.id, data: { - dispatcherAddress: address || "", + dispatcherAddress: address || "0x", dispatcherType: "proof", sourcePortAddress: event.args.sourcePortAddress, sourceChannelId: ethers.decodeBytes32String(event.args.sourceChannelId), @@ -248,6 +258,7 @@ ponder.on("DispatcherProof:Acknowledgement", async ({event, context}) => { gas: event.transaction.gas, maxFeePerGas: event.transaction.maxFeePerGas, maxPriorityFeePerGas: event.transaction.maxPriorityFeePerGas, + from: event.transaction.from.toString(), }, }); }); @@ -258,7 +269,7 @@ ponder.on("DispatcherProof:CloseIbcChannel", async ({event, context}) => { await context.db.CloseIbcChannel.create({ id: event.log.id, data: { - dispatcherAddress: address || "", + dispatcherAddress: address || "0x", dispatcherType: "proof", portAddress: event.args.portAddress, channelId: ethers.decodeBytes32String(event.args.channelId), @@ -269,6 +280,7 @@ ponder.on("DispatcherProof:CloseIbcChannel", async ({event, context}) => { gas: event.transaction.gas, maxFeePerGas: event.transaction.maxFeePerGas, maxPriorityFeePerGas: event.transaction.maxPriorityFeePerGas, + from: event.transaction.from.toString(), }, }); }); @@ -279,7 +291,7 @@ ponder.on("DispatcherProof:ConnectIbcChannel", async ({event, context}) => { await context.db.ConnectIbcChannel.create({ id: event.log.id, data: { - dispatcherAddress: address || "", + dispatcherAddress: address || "0x", dispatcherType: "proof", portAddress: event.args.portAddress, channelId: ethers.decodeBytes32String(event.args.channelId), @@ -290,33 +302,7 @@ ponder.on("DispatcherProof:ConnectIbcChannel", async ({event, context}) => { gas: event.transaction.gas, maxFeePerGas: event.transaction.maxFeePerGas, maxPriorityFeePerGas: event.transaction.maxPriorityFeePerGas, - }, - }); -}); - -ponder.on("DispatcherProof:OpenIbcChannel", async ({event, context}) => { - const {address} = context.contracts.DispatcherProof; - const chainId = context.network.chainId; - await context.db.OpenIbcChannel.create({ - id: event.log.id, - data: { - dispatcherAddress: address || "", - dispatcherType: "proof", - portAddress: event.args.portAddress, - version: event.args.version, - ordering: event.args.ordering, - feeEnabled: event.args.feeEnabled, - // @ts-ignore - connectionHops: event.args.connectionHops, - counterpartyPortId: event.args.counterpartyPortId, - counterpartyChannelId: ethers.decodeBytes32String(event.args.counterpartyChannelId), - blockNumber: event.block.number, - blockTimestamp: event.block.timestamp, - transactionHash: event.transaction.hash, - chainId: chainId, - gas: event.transaction.gas, - maxFeePerGas: event.transaction.maxFeePerGas, - maxPriorityFeePerGas: event.transaction.maxPriorityFeePerGas, + from: event.transaction.from.toString(), }, }); }); @@ -327,7 +313,7 @@ ponder.on("DispatcherProof:OwnershipTransferred", async ({event, context}) => { await context.db.OwnershipTransferred.create({ id: event.log.id, data: { - dispatcherAddress: address || "", + dispatcherAddress: address || "0x", dispatcherType: "proof", previousOwner: event.args.previousOwner, newOwner: event.args.newOwner, @@ -338,6 +324,7 @@ ponder.on("DispatcherProof:OwnershipTransferred", async ({event, context}) => { gas: event.transaction.gas, maxFeePerGas: event.transaction.maxFeePerGas, maxPriorityFeePerGas: event.transaction.maxPriorityFeePerGas, + from: event.transaction.from.toString(), }, }); }); @@ -348,7 +335,7 @@ ponder.on("DispatcherProof:RecvPacket", async ({event, context}) => { await context.db.RecvPacket.create({ id: event.log.id, data: { - dispatcherAddress: address || "", + dispatcherAddress: address || "0x", dispatcherType: "proof", destPortAddress: event.args.destPortAddress, destChannelId: ethers.decodeBytes32String(event.args.destChannelId), @@ -360,6 +347,7 @@ ponder.on("DispatcherProof:RecvPacket", async ({event, context}) => { gas: event.transaction.gas, maxFeePerGas: event.transaction.maxFeePerGas, maxPriorityFeePerGas: event.transaction.maxPriorityFeePerGas, + from: event.transaction.from.toString(), }, }); }); @@ -370,7 +358,7 @@ ponder.on("DispatcherProof:SendPacket", async ({event, context}) => { await context.db.SendPacket.create({ id: event.log.id, data: { - dispatcherAddress: address || "", + dispatcherAddress: address || "0x", dispatcherType: "proof", sourcePortAddress: event.args.sourcePortAddress, sourceChannelId: ethers.decodeBytes32String(event.args.sourceChannelId), @@ -384,6 +372,7 @@ ponder.on("DispatcherProof:SendPacket", async ({event, context}) => { gas: event.transaction.gas, maxFeePerGas: event.transaction.maxFeePerGas, maxPriorityFeePerGas: event.transaction.maxPriorityFeePerGas, + from: event.transaction.from.toString(), }, }); }); @@ -394,7 +383,7 @@ ponder.on("DispatcherProof:Timeout", async ({event, context}) => { await context.db.Timeout.create({ id: event.log.id, data: { - dispatcherAddress: address || "", + dispatcherAddress: address || "0x", dispatcherType: "proof", sourcePortAddress: event.args.sourcePortAddress, sourceChannelId: ethers.decodeBytes32String(event.args.sourceChannelId), @@ -406,6 +395,7 @@ ponder.on("DispatcherProof:Timeout", async ({event, context}) => { gas: event.transaction.gas, maxFeePerGas: event.transaction.maxFeePerGas, maxPriorityFeePerGas: event.transaction.maxPriorityFeePerGas, + from: event.transaction.from.toString(), }, }); }); @@ -417,7 +407,7 @@ ponder.on("DispatcherProof:WriteTimeoutPacket", async ({event, context}) => { id: event.log.id, data: { chainId: chainId, - dispatcherAddress: address || "", + dispatcherAddress: address || "0x", dispatcherType: "proof", writerPortAddress: event.args.writerPortAddress, writerChannelId: ethers.decodeBytes32String(event.args.writerChannelId), @@ -431,6 +421,7 @@ ponder.on("DispatcherProof:WriteTimeoutPacket", async ({event, context}) => { gas: event.transaction.gas, maxFeePerGas: event.transaction.maxFeePerGas, maxPriorityFeePerGas: event.transaction.maxPriorityFeePerGas, + from: event.transaction.from.toString(), }, }); }); \ No newline at end of file