@verax-attestation-registry/verax-contracts
v10.0.0
Published
Verax Attestation Registry core smart contracts
Downloads
49
Readme
Verax Attestation Registry - Contracts
Verax is mainly composed of a set of smart contracts that allows anyone to read and write Attestations.
Pre-requisites
Development commands
Build contracts
forge buildTest contracts
forge testGenerate a coverage report
forge coverageDeployment of a new Verax instance
1. Environment setup
- Copy an
.env.NETWORKfile from theenvfolder to a.envfile:cp env/.env.linea .env - Fill it with your Infura key, your private key and your chain explorer API key
- Update the
hardhat.config.tsfile with:- A new entry to the
networksobject - A new entry to the
etherscan.apiKeyobject - A new entry to the
etherscan.customChainsarray
- A new entry to the
- Add a new entry to the
script/utils.tsfile to define:- If the network is a testnet or a mainnet (cf.
isTestnet) - The network's dedicated chain prefix (cf.
chainPrefix)
- If the network is a testnet or a mainnet (cf.
2. Registries deployments
- Run the
pnpm run deploy NETWORK_NAMEcommand (replacingNETWORK_NAMEwith the name of the targeted network) - Note down the summarized addresses (proxies), and the total logs can be of interest too
- Add the addresses of the Verax registries to the
.env.NETWORKand your.envfiles
3. EAS compatibility
If the targeted network benefits from an EAS instance, you can deploy the contract enabling the EAS-Verax compatibility.
- Add the address of the EAS registry to the
EAS_REGISTRY_ADDRESSvalue in your.envfile - Run the
pnpm run deploy:eas NETWORK_NAMEcommand (replacingNETWORK_NAMEwith the name of the targeted network) - Note down the Attestation Reader contract address
- Add the Attestation Reader contract address to the
.env.NETWORKand your.envfiles
4. Platform bootstrapping
4.1. On a mainnet instance
- Gather the first list of Issuer addresses
- Set the issuers via the PortalRegistry’s
setIssuersmethod
4.2. On all instances
- Deploy an instance of DefaultPortal via the PortalRegistry’s
deployDefaultPortalmethod and note down its address - Verify this contract via
npx hardhat verify --network NETWORK_NAME ADDRESS(replacingNETWORK_NAMEwith the name of the targeted network andADDRESSwith the address of the freshly deployedDefaultPortal)
Verax contracts upgrade
1. Check all registry implementations follow the upgradeability rules
Run pnpm run check:implementations to check if the local versions of the registries follow the upgradeability rules.
:warning: Note: this is a static check, not run against the already deployed contracts.
2. Check all registry implementations are upgradeable
Run pnpm run check:upgradeability NETWORK_NAME (replacing NETWORK_NAME with the name of the targeted network) to
check if the already deployed registries are upgradable to the new local versions.
:warning: Note: this is a dynamic check, run against the already deployed contracts.
3. Do upgrade
- Check your
.envfile contains the address of all the proxies for the targeted network - Upgrade only the implementations that have changed since the last upgrade via the
pnpm run upgrade NETWORK_NAMEcommand - Optional: Upgrade all the implementations by forcing their re-deployment via the
pnpm run upgrade:force NETWORK_NAMEcommand
:warning: Note: Forcing the redeployment of all the implementations is more expensive!
4. Update the network files
:warning: Note: this script must only be run on a branch/commit corresponding to the version of the contracts deployed on the targeted network!.
Run pnpm run reimport NETWORK_NAME (replacing NETWORK_NAME with the name of the targeted network) to re-generate the
network files describing the deployed contracts.
:warning: Note: This step is mandatory to avoid being desynchronized.
5. Deploy the contract library
The core contracts are available on npm as a library. To deploy the library, follow the steps below:
- Upgrade the package version in package.json
- Test the deployment on npm
pnpm run publish:dry-run - Deploy on npm
pnpm run publish:public
Utils
Verify with arguments
Change the arguments you want to use for the verify action in contracts/script/arguments.ts, then run:
npx hardhat verify --network NETWORK_NAME CONTRACT_ADDRESS --constructor-args contracts/script/arguments.tsImportant Notes
Removal of Issuers and Schemas ownership
Issuers may have Schemas associated with them. When removing issuers, you will need to reassign schema ownership by calling the following methods :
- updateSchemaIssuer
- bulkUpdateSchemasIssuers
