Skip to content

Commit

Permalink
Add reset option in scripts (#38)
Browse files Browse the repository at this point in the history
* add wait func

* add reset
  • Loading branch information
julienbrg authored Feb 29, 2024
1 parent f638eae commit dcdbd85
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 68 deletions.
86 changes: 22 additions & 64 deletions deploy/deploy-basic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ const initialMint = ethers.parseEther("10000")
export default async ({ getNamedAccounts, deployments }: any) => {
const { deploy } = deployments

function wait(ms: number): Promise<void> {
return new Promise(resolve => setTimeout(resolve, ms))
}

const { deployer } = await getNamedAccounts()
console.log("deployer:", deployer)

Expand All @@ -18,73 +22,14 @@ export default async ({ getNamedAccounts, deployments }: any) => {
})

switch (hre.network.name) {
case "arthera":
console.log(
"Basic ERC-20 token contract deployed:",
msg(basic.receipt.contractAddress)
)

try {
// Please use `pnpm sourcify:arthera` after the deployment instead.

// console.log("\nEtherscan verification in progress...")
// console.log(
// "\nWaiting for 6 block confirmations (you can skip this part)"
// )
// await basic.deploymentTransaction()?.wait(6)
// await hre.run("verify:verify", {
// network: network.name,
// address: basic.receipt.contractAddress,
// constructorArguments: [initialMint]
// })

console.log(
"Please use `pnpm sourcify:arthera` to verify your contract."
)
} catch (error) {
console.error(error)
}

break
case "arthera-testnet":
console.log(
"Basic ERC-20 token contract deployed:",
msg(basic.receipt.contractAddress)
)

try {
// Please use `pnpm sourcify:arthera` after the deployment instead.

// console.log("\nEtherscan verification in progress...")
// console.log(
// "\nWaiting for 6 block confirmations (you can skip this part)"
// )
// await basic.deploymentTransaction()?.wait(6)
// await hre.run("verify:verify", {
// network: network.name,
// address: basic.receipt.contractAddress,
// constructorArguments: [initialMint]
// })

console.log(
"Please use `pnpm sourcify:arthera-testnet` to verify your contract."
)
} catch (error) {
console.error(error)
}

break
case "sepolia":
try {
console.log(
"Basic ERC-20 token contract deployed:",
msg(basic.receipt.contractAddress)
)
console.log("\nEtherscan verification in progress...")
console.log(
"\nWaiting for 6 block confirmations (you can skip this part)"
)
// await basic.deploymentTransaction()?.wait(6)
await wait(90 * 1000)
await hre.run("verify:verify", {
network: network.name,
address: basic.receipt.contractAddress,
Expand All @@ -103,10 +48,7 @@ export default async ({ getNamedAccounts, deployments }: any) => {
msg(basic.receipt.contractAddress)
)
console.log("\nEtherscan verification in progress...")
console.log(
"\nWaiting for 6 block confirmations (you can skip this part)"
)
// await basic.deploymentTransaction()?.wait(6)
await wait(90 * 1000)
await hre.run("verify:verify", {
network: network.name,
address: basic.receipt.contractAddress,
Expand All @@ -117,6 +59,22 @@ export default async ({ getNamedAccounts, deployments }: any) => {
console.error(error)
}
break

case "arthera":
// the contract will be verified automatically
console.log(
"Basic ERC-20 token contract deployed:",
msg(basic.receipt.contractAddress)
)
break

case "arthera-testnet":
// the contract will be verified automatically
console.log(
"Basic ERC-20 token contract deployed:",
msg(basic.receipt.contractAddress)
)
break
}
}
export const tags = ["Basic"]
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
"scripts": {
"test": "hardhat test",
"compile": "hardhat compile",
"deploy:arthera": "hardhat deploy --network arthera",
"deploy:sepolia": "hardhat deploy --network sepolia",
"deploy:arthera-testnet": "hardhat deploy --network arthera-testnet && hardhat sourcify --network arthera-testnet",
"deploy:op-sepolia": "hardhat deploy --network op-sepolia",
"deploy:arthera": "hardhat deploy --network arthera --reset",
"deploy:sepolia": "hardhat deploy --network sepolia --reset",
"deploy:arthera-testnet": "hardhat deploy --network arthera-testnet && hardhat sourcify --network arthera-testnet --reset",
"deploy:op-sepolia": "hardhat deploy --network op-sepolia --reset",
"sourcify:arthera": "hardhat sourcify --network arthera",
"sourcify:arthera-testnet": "hardhat sourcify --network arthera-testnet",
"mint:arthera": "hardhat mint --network arthera --amount",
Expand Down

0 comments on commit dcdbd85

Please sign in to comment.