-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29 from soramitsu/script/add_contract_deploy_veri…
…fy_script [Script] Add script to request deployment and verify contract
- Loading branch information
Showing
2 changed files
with
76 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { BytesLike } from "ethers"; | ||
import { ethers } from "hardhat"; | ||
import { time } from "@nomicfoundation/hardhat-network-helpers"; | ||
async function main() { | ||
let poolStartTime = 1720229672; | ||
let poolEndTime = poolStartTime + 120; | ||
let unstakeLockUp = poolStartTime + 10; | ||
let claimLockUp = poolStartTime + 10; | ||
|
||
const data = { | ||
stakeToken: "0xAfe9448d1C50F1cb3697b50EbDB956C8C73e0A7a", | ||
rewardToken: "0xA854C1bC1aEcC80094E2ac3C0EE98581460F1caD", | ||
poolStartTime: poolStartTime, | ||
poolEndTime: poolEndTime, | ||
unstakeLockUpTime: unstakeLockUp, | ||
claimLockUpTime: claimLockUp, | ||
rewardPerSecond: 1 | ||
} | ||
let factory = await ethers.getContractAt("ERC20LockUpStakingFactory", "0xa5Ffec47E75a69E5EE8480150372e6D7754b1A9D"/**Contract Address */); | ||
await factory.requestDeployment(ethers.randomBytes(32), data) | ||
} | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { ethers, run, network } from "hardhat"; | ||
import config from "../hardhat.config"; // Your Hardhat config file | ||
|
||
async function main() { | ||
const contractAddress = "0x2CB4a3e461d6cE5f3A80B28Bb8596c734E267c26"; // Replace with your deployed address | ||
const contractName = "ERC20LockUpPool"; | ||
|
||
// Ensure the contract is already deployed on the target network | ||
const deployedCode = await ethers.provider.getCode(contractAddress); | ||
if (deployedCode === "0x") { | ||
throw new Error( | ||
`Contract not deployed at address: ${contractAddress} on network: ${network.name}` | ||
); | ||
} | ||
|
||
const poolStartTime = 1720229672; | ||
const poolEndTime = poolStartTime + 120; | ||
const unstakeLockUp = poolStartTime + 10; | ||
const claimLockUp = poolStartTime + 10; | ||
const rewardPerSecond = 1; | ||
|
||
// Verify on Etherscan | ||
try { | ||
await run("verify:verify", { | ||
address: contractAddress, | ||
constructorArguments: [ | ||
"0xAfe9448d1C50F1cb3697b50EbDB956C8C73e0A7a", // stakeToken | ||
"0xA854C1bC1aEcC80094E2ac3C0EE98581460F1caD", // rewardToken | ||
poolStartTime, | ||
poolEndTime, | ||
unstakeLockUp, | ||
claimLockUp, | ||
rewardPerSecond, | ||
], // Add constructor arguments | ||
contract: `contracts/pools/ERC20LockUpStakingPool.sol:ERC20LockUpPool`, // Path from Hardhat root | ||
}); | ||
|
||
console.log("Contract verified successfully!"); | ||
} catch (error) { | ||
if ((error as Error).message.includes("Contract source code already verified")) { | ||
console.log("Contract already verified"); | ||
} else { | ||
console.error("Error verifying contract:", error); | ||
} | ||
} | ||
} | ||
|
||
main().catch((error) => { | ||
console.error(error); | ||
process.exitCode = 1; | ||
}); |