-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
90 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,4 @@ coverage.json | |
cache | ||
artifacts | ||
|
||
typechain-types |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { ethers } from "hardhat"; | ||
|
||
async function main() { | ||
const gammaRatiosCalculator = await ethers.deployContract( | ||
"GammaRatiosCalculator", | ||
[] | ||
); | ||
|
||
await gammaRatiosCalculator.waitForDeployment(); | ||
console.log( | ||
`GammaRatiosCalculator deployed to ${gammaRatiosCalculator.target}` | ||
); | ||
} | ||
|
||
main().catch((error) => { | ||
console.error(error); | ||
process.exitCode = 1; | ||
}); |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import { ethers, run } from "hardhat"; | ||
|
||
async function main() { | ||
// Fetch current gas price from the network using JSON-RPC | ||
const currentGasPriceHex = await ethers.provider.send("eth_gasPrice", []); | ||
// Convert the hexadecimal string to a BigInt | ||
const currentGasPrice = BigInt(currentGasPriceHex); | ||
// Add 1 Gwei (which is 1e9 Wei) to the current gas price | ||
const adjustedGasPrice = currentGasPrice + BigInt(1e9); | ||
|
||
const router = await ethers.deployContract("Router", [], { | ||
gasPrice: adjustedGasPrice.toString(), | ||
}); | ||
await router.waitForDeployment(); | ||
console.log(`Router deployed to ${router.target}`); | ||
|
||
const routerSimulator = await ethers.deployContract("RouterSimulator", [], { | ||
gasPrice: adjustedGasPrice.toString(), | ||
}); | ||
await routerSimulator.waitForDeployment(); | ||
console.log(`RouterSimulator deployed to ${routerSimulator.target}`); | ||
|
||
console.log(`Waiting to verify...`); | ||
await setTimeout(() => {}, 15000); | ||
|
||
const verifyContract = async ({ | ||
address, | ||
constructorArguments, | ||
}: { | ||
address: any; | ||
constructorArguments: any; | ||
}) => { | ||
let verificationSuccess = false; | ||
while (!verificationSuccess) { | ||
try { | ||
await run("verify:verify", { | ||
address, | ||
constructorArguments, | ||
}); | ||
verificationSuccess = true; // Breaks the loop if verification succeeds | ||
console.log(`Successfully verified contract at ${address}`); | ||
} catch (e) { | ||
console.error( | ||
`Verification failed for ${address}. Retrying in 5 seconds.` | ||
); | ||
await new Promise((resolve) => setTimeout(resolve, 5000)); // Waits for 5 seconds before retrying | ||
} | ||
} | ||
}; | ||
|
||
await verifyContract({ | ||
address: router.target, | ||
constructorArguments: [], | ||
}); | ||
|
||
await verifyContract({ | ||
address: routerSimulator.target, | ||
constructorArguments: [], | ||
}); | ||
|
||
console.log(`Successfully verified contracts`); | ||
} | ||
|
||
main().catch((error) => { | ||
console.error(error); | ||
process.exitCode = 1; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters