- Install dependencies:
npm install
- Create an
.env
file:
cp template.env .env
- Add wallet private key to
.env
file (template.env
contains dummy private keys by default).
npm test
Deploy all contracts on networkName
:
npm run deploy:{networkName}:all
Deploy a contractName
on networkName
:
npm run deploy:{networkName}:{contractName}
networkName
is one of:
polygon
mumbai
(Polygon testnet)rinkeby
(Ethereum testnet)
To redeploy a contract that hasn't changed, delete it's deployment file under deployments/{networkName}/
and run npm run deploy:{networkName}:{contractName}
again.
To get a deployed contract's address, ABI, etc, check deployments/{networkName}/{contractName}.json
.
- Sign up for an account at https://etherscan.com and/or https://polygonscan.com
- Go to https://polygonscan.com/myapikey and/or https://polygonscan.com/myapikey to generate your API keys.
- Set
API_KEY_ETHERSCAN
andAPI_KEY_POLYGONSCAN
in the.env
file to the API keys generated in step 2.
This will verify all deployed contracts for the specified network.
You can check which ones have been deployed from the .json
files in the deployments/{networkName}/
folder.
npm run verify:{networkName}
networkName
is one of:
polygon
mumbai
(Polygon testnet)rinkeby
(Ethereum testnet)
- Create a new branch
- Make your changes in the branch (contracts + corresponding tests)
- Open up a pull request and get confirmation that the changes are good to go
- Deploy any contracts (see Deployment) and commit the generated artifacts. Any other services that rely on these contracts should use these artifacts.
- Get PR approved & merged
- Verify contracts (see Verification)
git clone https://github.com/poanetwork/solidity-flattener.git
cd solidity-flattener
npm install
cp -r contracts solidity-flattener/contracts
cp node_modules/@openzeppelin solidity-flattener/contracts/@openzeppelin
cd solidity-flattener
npm start contract/contract.sol
- Open Contract on Polygonscan/rinkeby.etherscan.io , click Contract -> Verify and Publish
- Compiler type: Solidity (single file)
- Compiler version: 0.8.9
- License MIT
- Optimization -> Yes
- Paste flattened solidity code
- Get ABI encoded constructor params
- https://abi.hashex.org/, Put contract ABI there
- Add constructor params (for empty values add some value and remove it so its empty)
- Verify and publish