This project is based on Foundry(Ethereum) + Hardhat(Zksync). Foundry is used mostly for unit testing while hardhat is used for testing, scripting and deployments. We use the hardhat-foundry plugin to support both frameworks.
/contracts: Contains solidity smart contracts./deploy: Scripts for contract deployment and interaction./test: Test files. Files tested using foundry are undertest/foundryhardhat.config.ts: Configuration settings.
curl -L https://foundry.paradigm.xyz | bashandfoundryupto install foundrynpm install -g surya: Install Consensys Surya for static analysis of code like drawing inheritance graph. (Optional)- Install Era Test Node. To test your installation, run
era_test_node run.
era_test_node run: Run zkSync Era In-memory node locally (an alternative is to runyarn hardhat node-zksync).yarn compile: Compiles contracts.yarn deploy:upgradable: DeploysGRVTExchange.solusing the transparent proxy pattern.yarn test: Tests the contracts using both forge and harhat.
To keep private keys safe, this project pulls in environment variables from .env files. Primarily, it fetches the wallet's private key.
Rename .env.example to .env and fill in your private key:
WALLET_PRIVATE_KEY=your_private_key_here...
Modify networks in hardhat.config.ts using the networks section. Set a default with defaultNetwork or use --network, e.g., hardhat test --network dockerizedNode.
To deploy the smart contract, run yarn deploy:upgradable --network <networkName> with networkName defined in hardhat.config.ts
This project was scaffolded with zksync-cli.
The current version of era_test_node supports a maximum contract size of 28kb. However, our contracts can be as large as 40kb. To test contracts of this size, you need to run tests against a specific version of era_test_node temporarily that supports Validiums.
You can use this branch until we create a separate flag for validium mode.
To utilize this branch:
-
Build the
era_test_nodewith:cargo build --release -
Run it as an executable:
./target/release/era_test_node run
