Skip to content

Commit

Permalink
Merge pull request #49 from hollow-leaf/feat/opBNBDeploy
Browse files Browse the repository at this point in the history
feat(contract): verify method
  • Loading branch information
crypto0627 authored Feb 17, 2024
2 parents 0313202 + 68804ec commit f77e13c
Show file tree
Hide file tree
Showing 7 changed files with 112 additions and 677 deletions.
1 change: 1 addition & 0 deletions packages/contract/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ PRIVATE_KEY="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"

# Block explorer API keys
ETHERSCAN_API_KEY="zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"
BSCSCAN_API_KEY="zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"

QUORUM_URL=http://localhost:8545
BLOCKSCOUT_URL=http://localhost:26000
Expand Down
4 changes: 4 additions & 0 deletions packages/contract/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
```
pnpm deploy:token --network opbnb-testnet --verify
pnpm deploy:nftFactory --network opbnb-testnet --verify
```
10 changes: 7 additions & 3 deletions packages/contract/contracts/DonateToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";

contract DonateToken is ERC20 {
constructor(uint256 initialSupply) ERC20("DonateToken", "DT") {
import "@openzeppelin/contracts/access/Ownable.sol";
contract DonateToken is ERC20, Ownable {
constructor(uint256 initialSupply) ERC20("PSYToken", "PSY") Ownable(msg.sender) {
_mint(msg.sender, initialSupply);
}

function mint(address to, uint256 amount) public onlyOwner {
_mint(to, amount);
}
}
38 changes: 35 additions & 3 deletions packages/contract/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { HardhatUserConfig } from "hardhat/config"
import { NetworkUserConfig } from "hardhat/types"
// hardhat plugin
import "@nomiclabs/hardhat-ethers"
import "@nomiclabs/hardhat-etherscan"
// import "@nomicfoundation/hardhat-verify"
import "@nomicfoundation/hardhat-toolbox"

import { config as dotenvConfig } from "dotenv"
Expand All @@ -21,6 +21,8 @@ const chainIds = {
hardhat: 31337,
mainnet: 1,
quorum: 570,
opbnb: 204,
"opbnb-testnet": 5611,
}

// Ensure that we have all the environment variables we need.
Expand All @@ -40,6 +42,12 @@ function getChainConfig (chain: keyof typeof chainIds): NetworkUserConfig {
case "quorum":
jsonRpcUrl = process.env.NETWORK_URL || ""
break
case "opbnb":
jsonRpcUrl = "https://opbnb-mainnet-rpc.bnbchain.org"
break
case "opbnb-testnet":
jsonRpcUrl = "https://opbnb-testnet-rpc.bnbchain.org"
break
default:
jsonRpcUrl = `https://${chain}.infura.io/v3/${infuraApiKey}`
}
Expand All @@ -55,7 +63,7 @@ const config: HardhatUserConfig = {
networks: {
hardhat: {
// TODO: SHOULD BE REMOVED!
allowUnlimitedContractSize: true,
allowUnlimitedContractSize: false,
chainId: chainIds.hardhat,
},
local: {
Expand All @@ -65,6 +73,8 @@ const config: HardhatUserConfig = {
sepolia: getChainConfig("sepolia"),
mainnet: getChainConfig("mainnet"),
quorum: getChainConfig("quorum"),
opbnb: getChainConfig("opbnb"),
"opbnb-testnet": getChainConfig("opbnb-testnet"),
},
paths: {
artifacts: "./artifacts",
Expand All @@ -79,6 +89,7 @@ const config: HardhatUserConfig = {
},
],
settings: {
viaIR: true,
metadata: {
// Not including the metadata hash
// https://github.com/paulrberg/hardhat-template/issues/31
Expand All @@ -89,7 +100,11 @@ const config: HardhatUserConfig = {
optimizer: {
enabled: true,
runs: 800,
details: { yul: false }
details: {
yulDetails: {
optimizerSteps: "u",
},
},
},
},
},
Expand All @@ -98,15 +113,32 @@ const config: HardhatUserConfig = {
goerli: process.env.ETHERSCAN_API_KEY || "",
sepolia: process.env.ETHERSCAN_API_KEY || "",
mainnet: process.env.ETHERSCAN_API_KEY || "",
opbnb: process.env.BSCSCAN_API_KEY || "",
"opbnb-testnet": process.env.BSCSCAN_API_KEY || "",
quorum: "NO_API_KEY",
},
// https://docs.bscscan.com/v/opbnb-testnet/
customChains: [{
network: "quorum",
chainId: chainIds.quorum,
urls: {
apiURL: `${process.env.BLOCKSCOUT_URL}/api`,
browserURL: process.env.BLOCKSCOUT_URL as string,
},
},{
network: "opbnb",
chainId: chainIds.opbnb,
urls: {
apiURL: "https://api-opbnb.bscscan.com/api",
browserURL: "https://opbnb.bscscan.com",
},
},{
network: "opbnb-testnet",
chainId: chainIds["opbnb-testnet"],
urls: {
apiURL: "https://api-opbnb-testnet.bscscan.com/api",
browserURL: "https://opbnb-testnet.bscscan.com/",
},
}],
},

Expand Down
3 changes: 2 additions & 1 deletion packages/contract/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@
"license": "MIT",
"devDependencies": {
"@nomicfoundation/hardhat-toolbox": "2.0.2",
"@nomicfoundation/hardhat-verify": "^2.0.4",
"@nomiclabs/hardhat-ethers": "2.2.3",
"@nomiclabs/hardhat-etherscan": "3.1.7",
"@types/node": "^20.11.19",
"dotenv": "16.3.1",
"eslint-config-custom": "workspace:*",
"ethers": "^5.0.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"main":"0x15b9eEB14E166400905c42DFfec63384D5ab8CEE"}
Loading

0 comments on commit f77e13c

Please sign in to comment.