Create a copy of .env.example
and rename the copy to .env
. If your organization already has keys, ask your admin
where they are.
-
MNEMONIC
: the seed phrase used for deploying the contract and upgrades- Make sure there is sufficient balance in the account for these operations
- If you need a new address, you can run
yarn hardhat generate-address
-
INFURA_API_KEY
: Infura is used as the gateway. -
OPENZEPPELIN_API_KEY
andOPENZEPPELIN_SECRET_KEY
: OpenZeppelin Defender is used for proposing upgrades to the multi-sig. -
ETHERSCAN_API_KEY
: Etherscan -
OPTIMISTIC_ETHERSCAN_API_KEY
: Optimism Explorer
Here's a list of the most frequently needed commands.
Note that the project is configured to use both Hardhat and Foundry. We typically use Foundry for fast compiles and testing. We typically use Hardhat to compile for deployment and to run operational tasks.
Build the contracts:
forge build
Solidity tests are executed using Foundry Run the tests:
forge test
Get a gas report:
forge test --gas-report
forge inspect HypercertMinter storageLayout --pretty
Delete the build artifacts and cache directories:
forge clean
yarn build:hardhat
Deployment of the contract to EVM compatible net is managed by OpenZeppelin, primarily because of proxy management and safety checks.
yarn build:deploy
yarn hardhat deploy --network goerli
To transfer ownership of the proxy contract for upgrades, run the following:
yarn hardhat transfer-owner-minter --network goerli --proxy PROXY_CONTRACT_ADDRESS --owner NEW_OWNER_ADDRESS
This is typically done to transfer control to a multi-sig (i.e. Gnosis Safe).
Validate contract upgradeability against deployment.
For example goerli
deployment:
yarn hardhat validate-upgrade --network goerli --proxy PROXY_CONTRACT_ADDRESS
Propose an upgrade via OpenZeppelin Defender. For more information, see this guide
yarn build:hardhat
yarn hardhat propose-upgrade-minter --network goerli --proxy PROXY_CONTRACT_ADDRESS --multisig OWNER_MULTISIG_ADDRESS
This will output an OpenZeppelin URL that multi-sig members can use to approve/reject the upgrade.
Format the contracts with Prettier:
yarn prettier
Lint the contracts:
yarn lint
This interface is the requirements set for hypercert-compliant tokens. This enables developer to use their own preferred token implementation or standard.
Example implementation for a hypercert token that is an ERC1155 NFT
under the hood with an Allowlist
extension.