Crestal Omnichain Smart Contracts
Install Foundry.
Update Foundry to latest version:
foundryupAdd
~/.foundry/binto$PATHif command is not found.
Install OpenZeppelin contracts:
forge install foundry-rs/forge-std
forge install OpenZeppelin/openzeppelin-foundry-upgrades
forge install OpenZeppelin/openzeppelin-contracts-upgradeableUpdate dependencies (for an existing project):
forge updateInstall OpenZeppelin Upgrades CLI:
npm install @openzeppelin/upgrades-coreThis only needs to be set up during initialization for each Foundry project. Keeping it as reference.
(Optional) Recommend installing solc-select to manage Solidity compiler versions.
(Optional) Security tools
Install pipx.
pipx install slither-analyzerpipx install mythrilFormat source files:
forge fmtBuild contracts:
forge clean
forge buildTest contracts:
forge testSecurity checks:
make slither
make mythrilGenerate abi (for external access):
make abiStart local node in a separate window:
anvilDeploy (copy private key from anvil output):
PRIVATE_KEY=xxx make deployUpgrade to latest version (copy proxy address from deployed output):
PRIVATE_KEY=xxx PROXY_ADDRESS=xxx make upgradeUpgrade to particular version, one V+ at a time (copy proxy address from deployed output):
PRIVATE_KEY=xxx PROXY_ADDRESS=xxx UPGRADE_TO=Vx make upgradeSanity check:
PROXY_ADDRESS=xxx make checkDeploy:
PRIVATE_KEY=xxx RPC_URL=https://xxx make deployUpgrade (copy proxy address from deployed output):
PRIVATE_KEY=xxx RPC_URL=https://xxx PROXY_ADDRESS=xxx UPGRADE_TO=Vx make upgradeSanity check:
PROXY_ADDRESS=xxx RPC_URL=https://xxx make checkPut all env-related variables in a per chain .env.chain file then use the following:
ENV_FILE=.env.chain make deploy