🟢Verifying with Hardhat or Truffle
How to Verify a Proxy Contract on ARC20 Testnet and Mainnet
When deploying proxy contracts on blockchain networks such as Avenium’s ARC20 testnet and mainnet, verifying your contract's source code is essential for transparency and security. This guide will walk you through the process of verifying a proxy contract.
Prerequisites
MetaMask: Ensure you have MetaMask installed and connected to the Avenium network.
Remix or Hardhat/Truffle: Have a development environment set up for deploying contracts.
Avenium Testnet/Mainnet Details:
Testnet RPC URL:
https://connect-testnet.avenium.io
Mainnet RPC URL: Coming Soon
Steps to Deploy and Verify a Proxy Contract
1. Deploy the Implementation Contract
Write your implementation contract. For example, a simple implementation might look like this:
Deploy this contract using Remix or your preferred deployment tool.
2. Deploy the Proxy Contract
A basic proxy contract using OpenZeppelin’s TransparentUpgradeableProxy
can be deployed as follows:
First, ensure you have the following imports:
Then deploy the proxy contract:
Here _logic
is the address of the deployed implementation contract, admin
is the address that can upgrade the proxy, and _data
can be used to initialize the proxy.
3. Verify the Implementation Contract
Go to the Avenium block explorer (testnet: testnet.avescan.net).
Navigate to the implementation contract address.
Click on "Verify & Publish".
Enter the Solidity compiler version and optimization settings used during deployment.
Paste the implementation contract’s source code.
Complete the verification process.
4. Verify the Proxy Contract
Navigate to the proxy contract address on the block explorer.
Click on "Verify & Publish".
Select the appropriate proxy contract type (e.g., TransparentUpgradeableProxy).
Enter the Solidity compiler version and optimization settings used during deployment.
Paste the proxy contract’s source code and constructor arguments (encoded as necessary).
Complete the verification process.
Example: Verifying on the Testnet
Assuming you have the proxy and implementation contracts deployed:
Implementation Contract Verification:
Compiler Version: Ensure it matches the version you used.
Optimization: Should match your compilation settings.
Source Code: Directly paste your implementation contract.
Proxy Contract Verification:
Contract Address: Use the address where the proxy is deployed.
Compiler Version: Ensure it matches the version you used for the proxy deployment.
Optimization: Should match your compilation settings.
Proxy Source Code:
Directly paste your
TransparentUpgradeableProxy
source code.Constructor Arguments: Include the
_logic
(implementation contract address),admin
, and_data
arguments encoded in ABI format if required.
Verifying with Hardhat or Truffle
If you use Hardhat or Truffle, you can also verify your contracts using their respective plugins:
Hardhat
Install the verification plugin:
Configure the plugin in
hardhat.config.js
:Verify the contracts:
Truffle
Install the verification plugin:
Configure the plugin in
truffle-config.js
:Verify the contracts:
By following these steps, you can deploy and verify your proxy contract on the Avenium ARC20 testnet and mainnet, ensuring transparency and trust in your smart contracts. Always double-check your contract addresses and constructor arguments to avoid verification errors.
Last updated