Skip to content

Commit

Permalink
Merge pull request #15 from gnosisguild/feat-verification-debounce
Browse files Browse the repository at this point in the history
feat: add verification debounce
  • Loading branch information
samepant authored Aug 29, 2024
2 parents fb98551 + f043fab commit 437900c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@gnosis-guild/zodiac-core",
"version": "2.0.1",
"version": "2.0.2",
"description": "Zodiac is a composable design philosophy and collection of standards for building DAO ecosystem tooling.",
"author": "Auryn Macmillan <[email protected]>",
"license": "LGPL-3.0+",
Expand Down
16 changes: 15 additions & 1 deletion src/tooling/verifyMastercopy.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,23 @@
import { MastercopyArtifact } from "../types";
import { verifySourceCode } from "../artifact/internal/etherscan";

/**
* Pauses the execution for a specified amount of time.
*
* @param {number} ms - The number of milliseconds to wait.
* @returns {Promise<void>} A promise that resolves after the specified delay.
*/
const sleep = (ms: number): Promise<void> => {
return new Promise((resolve) => setTimeout(resolve, ms));
};

/**
* Verifies a Mastercopy contract on an Etherscan-like block explorer.
*
* This function submits the source code and metadata of a Mastercopy contract to a block explorer
* for verification. It interacts with the explorer's API using the provided API key and endpoint.
* for verification. It interacts with the explorer's API
* using the provided API key and endpoint. A debounced timer of 500 milliseconds
* is added between each verification to prevent rate-limiting issues.
*
* @param {Object} params - The parameters required for verification.
* @param {string} params.apiUrlOrChainId - The base URL of the block explorer's API or the chain ID.
Expand All @@ -30,6 +42,8 @@ export default async function verifyMastercopy({
address: string;
noop: boolean;
}> {
await sleep(500);

const { noop } = await verifySourceCode({
...artifact,
apiUrlOrChainId,
Expand Down

0 comments on commit 437900c

Please sign in to comment.