From ebe9737c8db5a769eba73db6ca0fefa904c0b844 Mon Sep 17 00:00:00 2001 From: Dylan Tran Date: Sun, 24 Jan 2021 15:34:52 -0800 Subject: [PATCH] pass block number to get created set token address --- utils/common/protocolUtils.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/utils/common/protocolUtils.ts b/utils/common/protocolUtils.ts index 31bf03e..d942b2e 100644 --- a/utils/common/protocolUtils.ts +++ b/utils/common/protocolUtils.ts @@ -15,7 +15,11 @@ export class ProtocolUtils { this._provider = _provider; } - public async getCreatedSetTokenAddress (txnHash: string | undefined): Promise { + public async getCreatedSetTokenAddress( + txnHash: string | undefined, + fromBlockNumber?: string, + toBlockNumber?: string, + ): Promise { if (!txnHash) { throw new Error("Invalid transaction hash"); } @@ -24,9 +28,10 @@ export class ProtocolUtils { const iface = new ethers.utils.Interface(abi); const topic = ethers.utils.id("SetTokenCreated(address,address,string,string)"); + const logs = await this._provider.getLogs({ - fromBlock: "latest", - toBlock: "latest", + fromBlock: fromBlockNumber || "latest", + toBlock: toBlockNumber || "latest", topics: [topic], });