-
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.
Update contract to deploy test net and verify
- Loading branch information
1 parent
cefc789
commit 41c47a4
Showing
7 changed files
with
183 additions
and
16 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,13 @@ | ||
# testnet | ||
PRIVATE_KEY = | ||
|
||
# livenet | ||
# PRIVATE_KEY = | ||
|
||
INFURA = "6e9457c7d3754cc2a205c109a69e516f" | ||
ETHEREUM_API_KEY = "S1VH5HN4RW22314GI9APVKVFIJ36IH5SXV" | ||
SEPOLIA_API_KEY = "U2nZW5r0_xgomMtKnbOAruRlIQv3GhYT" | ||
OPTIMISM_API_KEY = "P5K84TXHSZAXCDHM58VKHAB9HEGK3WZICH" | ||
ARBITRUM_API_KEY = "NN4Z8UJ8UXANGVZV22YX1SWMYZZPY7GKG4" | ||
BSC_API_KEY = "W29G6AQ1BNQFTNS86GFJH5ZN12WA5RTM4T" | ||
FANTOM_API_KEY = "4MR937N251D431QWQE9R55W8YJMXPW17CV" |
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,10 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
pragma solidity ^0.8.20; | ||
|
||
import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; | ||
|
||
contract Token is ERC20 { | ||
constructor(uint256 initialSupply) ERC20("test token", "test") { | ||
_mint(msg.sender, initialSupply * 1e18); | ||
} | ||
} |
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
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
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
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,28 @@ | ||
const fs = require("fs"); | ||
const addresses = require("../build/addresses.json"); | ||
|
||
const getTargetAddress = (contractName, network) => { | ||
return addresses[network][contractName]; | ||
}; | ||
|
||
const setTargetAddress = (contractName, network, address) => { | ||
if (addresses[network] == undefined) { | ||
addresses[network] = {}; | ||
} | ||
addresses[network][contractName] = address; | ||
fs.writeFileSync( | ||
"build/addresses.json", | ||
JSON.stringify(addresses), | ||
function (err) { | ||
if (err) return console.log(err); | ||
} | ||
); | ||
console.log( | ||
`${contractName} | ${network} | ${addresses[network][contractName]}` | ||
); | ||
}; | ||
|
||
module.exports = { | ||
getTargetAddress, | ||
setTargetAddress, | ||
}; |
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,72 @@ | ||
const addresses = require("../build/addresses.json"); | ||
const { getTargetAddress } = require("./helpers"); | ||
|
||
async function main() { | ||
const network = hre.network.name; | ||
getTargetAddress("Token", network); | ||
const Token = getTargetAddress("Token", network); | ||
const NFT1 = getTargetAddress("NFT1", network); | ||
const NFT2 = getTargetAddress("NFT2", network); | ||
const NFT3 = getTargetAddress("NFT3", network); | ||
const Marketplace = getTargetAddress("Marketplace", network); | ||
console.log({ Token }, { NFT1 }, { NFT2 }, { NFT3 }, { Marketplace }); | ||
|
||
try { | ||
await run("verify:verify", { | ||
address: Token, | ||
constructorArguments: [1e9], | ||
}); | ||
console.log("Verified Token"); | ||
} catch (e) { | ||
console.log(e); | ||
} | ||
|
||
try { | ||
await run("verify:verify", { | ||
address: NFT1, | ||
constructorArguments: ["test1 NFT", "t1NFT"], | ||
}); | ||
console.log("Verified NFT1"); | ||
} catch (e) { | ||
console.log(e); | ||
} | ||
|
||
try { | ||
await run("verify:verify", { | ||
address: NFT2, | ||
constructorArguments: ["test2 NFT", "t2NFT"], | ||
}); | ||
console.log("Verified NFT2"); | ||
} catch (e) { | ||
console.log(e); | ||
} | ||
|
||
try { | ||
await run("verify:verify", { | ||
address: NFT3, | ||
constructorArguments: ["test3 NFT", "t3NFT"], | ||
}); | ||
console.log("Verified NFT3"); | ||
} catch (e) { | ||
console.log(e); | ||
} | ||
|
||
try { | ||
await run("verify:verify", { | ||
address: Marketplace, | ||
constructorArguments: [Token], | ||
}); | ||
console.log("Verified Marketplace"); | ||
} catch (e) { | ||
console.log(e); | ||
} | ||
} | ||
|
||
main() | ||
.then(() => { | ||
process.exit(0); | ||
}) | ||
.catch((error) => { | ||
console.error(error); | ||
process.exit(1); | ||
}); |