This repository contains the most recent addresses of all Zup deployed smart contracts.
-
Foundry
- To check if Foundry is installed, run
forge --version. You should see a response likeforge x.x.x. - If Foundry is not installed, follow the Foundry Installation guide.
- To check if Foundry is installed, run
-
GNU Make
- To check if Make is installed, run
make --version. You should see a response likeGNU Make x.xx. - If Make is not installed, visit the GNU Make website for installation instructions.
- To check if Make is installed, run
Deploying a smart contract is straightforward. Open your terminal in the repository directory and run:
make deploy -- {CONTRACT_NAME} {NETWORK_NAME}Example:
make deploy -- ZupRouter sepoliathe make deploy script should automatically verify the contract in the appropriate block explorer. But sometimes the API can return an error and you will need to verify it manually with foundry by running forge verify-contract
Warnings:
- The
NETWORK_NAMEparameter should match the one set in the[rpc_endpoints]and[etherscan]sections of the foundry.toml file. - The
make deploycommand uses the--trezorflag by default to deploy with a Trezor hardware wallet. If you don't want to use a hardware wallet, you can remove the flag and add the necessary parameters for a non-hardware wallet deployment.
If you want to deploy a contract that has already been deployed on the same network, you just need to set up the block explorer API key in the .env file and run the deploy command.
- Create a
.envfile in the root of the repository. - Set the
BLOCK_EXPLORER_API_KEYvariable according to the network you are deploying to. For example:- For Polygon Mainnet, use the Polygonscan API key.
- For Polygon Mumbai Testnet, use the Polygonscan API key.
- For Ethereum Mainnet, use the Etherscan API key.
To deploy to a new network, follow these steps before running the deploy command:
- Add the required parameters in the helper files.
- Add the network to the foundry.toml file.
- Add the block explorer API key to the
.envfile.
There are two possible files where you might need to add new parameters:
- NetworkHelper.sol: For external parameters (e.g., WETH address).
- ZupAddresses.sol: For internal Zup-specific parameters (e.g., Admin address).
To figure out which file to modify, check the relevant deployment script in the script folder for the contract you want to deploy.
Adding the Network to foundry.toml
In the foundry.toml file, you need to add the network configuration, including the RPC endpoint and block explorer API URL. Add the network to both the [rpc_endpoints] and [etherscan] sections, ensuring the network names match. The environment variable for the API key should always be BLOCK_EXPLORER_API_KEY.
Example:
[etherscan]
newchain = { key = "${BLOCK_EXPLORER_API_KEY}", url = "https://newchain.api.endpoint" }
[rpc_endpoints]
newchain = "https://newchain-rpc.com"This step is simple: add a key named BLOCK_EXPLORER_API_KEY to your .env file and assign the appropriate block explorer API key based on the network. For example, use a Polygonscan API key for Polygon Mainnet or Polygon Mumbai.
- All deployment scripts should be placed in the script folder.
- New deployment scripts should follow the naming convention
{CONTRACT_NAME}Deployto work with themake deploycommand. For example:NewContractDeploy.
All the most recent deployed smart contracts can be found in the deployments folder. They are organized by chain ID