Contract Verification

Verifying your contracts
For contracts that have been verified, the simulated transactions can be debugged using the Debug Transaction feature of Phalcon Explorer.
Verifying a contract means making its source code available in that Fork, along with the compiler settings you used.
If you want to delete the source code, delete the associated Fork.
Contract verification is supported for Hardhat and Foundry .

Get Acess Key and Fork RPC ID

The first step is getting the API access key (Fork_API_ACCESSS_KEY) and the Fork RPC ID (FORK_RPC_ID). Please refer to this link.

Hardhat

Verify a contract in Fork is similar to the verification on Etherscan. Read this manual on Hardhat on contract verification on Etherscan.
You need to change the configuration to verify a contract on Phalcon Fork.
module.exports = {
networks: {
phalcon: {
//The Fork RPC URL
url: "https://rpc.phalcon.xyz/FORK_RPC_ID"
accounts: ['private_key']
}
},
etherscan: {
apiKey: {
phalcon: "Fork_API_ACCESSS_KEY"
},
customChains: [
{
network: "phalcon",
chainId: 1,
urls: {
apiURL: "https://api.phalcon.xyz/api/FORK_RPC_ID",
browserURL: "https://etherscan.io/"
}
}
]
},
solidity: "0.8.17",
};
```
Then using the following command to verify the deployed contract.
npx hardhat verify --network phalcon <deployed contract address> <constructor parameters>
If you have not deployed your contract, using the following command to deploy your contract first.
npx hardhat run scripts/deploy.ts --network phalcon

Foundry

In Foundry, you can use the verify-contract for verification. Please refer the document on Foundry.
forge verify-contract \
--chain-id 1 \
--num-of-optimizations 200 \
--watch \
--verifier-url 'https://api.phalcon.xyz/api/FORK_RPC_ID'\
<the_contract_address> \
<the_contract_code_path> \
--etherscan-api-key Fork_API_ACCESSS_KEY
  • the_contract_address: The contract address
  • the_contract_code_path: The path of the local contract code, e.g., src/MyToken.sol:MyToken.
The verification process is showing in the terminal.
forge verify-contract --chain-id 1 --num-of-optimizations 200 --watch --verifier-url 'https://api.phalcon.xyz/api/FORK_RPC_ID' 0x3bd7eFCdd52Fe1E4329CA5D2a86F4c9224Fb27DD 'src/Contract.sol:Contract' --etherscan-api-key Fork_API_ACCESSS_KEY
Start verifying contract `0x3bd7efcdd52fe1e4329ca5d2a86f4c9224fb27dd` deployed on mainnet
Submitting verification for [src/Contract.sol:Contract] "0x3bd7eFCdd52Fe1E4329CA5D2a86F4c9224Fb27DD".
Submitted contract for verification:
Response: `OK`
GUID: `ciox2qu87u53h0mdz0vhfcztximzhitkmxkk7gyx8zq1r97lkm`
URL:
https://etherscan.io/address/0x3bd7efcdd52fe1e4329ca5d2a86f4c9224fb27dd
Contract verification status:
Response: `OK`
Details: `Pass - Verified`
Contract successfully verified

Verified Contracts

The detailed information of the verified contracts is shown in the Contracts of the Phalcon Fork Panel.
Click on the contract address to see detailed information on the contract.