Deploy allows you to deploy and upgrade smart contracts across chains securely. You can prove that the code running on-chain matches the audited implementation and minimize crucial mistakes that can lead to losses or issues.
Configure production and test environments with granularity over deployer addresses.
Pay gas for deployments automatically.
Ensure all smart contract deployments are verified on block explorers.
Manage deployments to multiple chains from a single place.
Automate multisig approval process for upgrades.
Fully compatible with CI/CD for automated releases.
Track the details and history for every deployment or upgrade.
Deploy is divided into production and test environments, with mainnet networks for the former and testnet networks for the latter. Each environment is associated with one or more networks according to its type of environment, which allows to separate test contracts from production safely. To facilitate the onboarding process, the setup for each environment is configured through a wizard, which swiftly walks you through the following steps.
In the first step, you select the networks to use. Deploy supports multi-chain deployments, allowing users to deploy contracts to the same addresses across multiple networks. You can add or remove networks at any time through the environment page.
|To maintain the best security practices, the wizard will only show networks according to the type of environment chosen to prevent mixing networks.|
The second step is optional but recommended so that Defender 2.0 can automatically verify the contracts. To do so, you must provide an API key of a block explorer supported for each network selected previously.
In this step, users choose the default relayer for each network. This relayer is the one that will be used to pay and execute the deployment transactions; however, you can choose a different relayer for each deployment by specifying it in the Hardhat script. If you don’t have a relayer for a network, the wizard will create one. You can learn more about relayers here.
|We are automatically funding testnet relayers created in this step as long as funds are available! Enjoy.|
This last step is optional but recommended if you plan to deploy upgradeable contracts. Here you choose the approval process for upgrades for each network. You can find a list of supported processes here.
Once inside an environment, you can see the configuration and activity of deployments within it.
You can edit the configuration of any network within the environment. To do so, click the edit button to reach the configuration page, where you can add or remove a network and change the default relayers or approval processes.
The history table shows the activity within the environment, allowing you to check the status of deployments or upgrades. There are three possible statuses:
COMPLETE: The deployment has been successfully executed in the network.
PENDING: The upgrade is waiting for approval.
FAILED: The deployment has failed. Make sure the relayer has enough funds and that the smart contract is valid.
After an environment is configured, you can use it for deployments and upgrades. To do so, we provide an API and a Hardhat plugin. The Deploy API is recommended for non-Hardhat projects. On the other hand, the Hardhat plugin is extremely easy to use in Hardhat projects, as it only requires a few lines of code to implement.
Both the API and the Hardhat plugin allow using different relayers for each contract deployment. However, if none is specified, Defender 2.0 will identify the target network and use the associated default relayer. If the environment is configured with the block explorer API key, Defender 2.0 will also automatically verify the contracts.
|We provide a quickstart tutorial to deploy and upgrade a smart contract using Defender 2.0. Check it out here!|