# Verify ZkSync Contracts For CCIP

Pre-requisites:
- `pnpm install` at contracts directory
- `pnpm run zksync:compile `>> for compiling the contracts, you can uncomment `contractsToCompile` in [hardhat.ccip.zksync.config.ts](../../hardhat.ccip.zksync.config.ts) to compile only the contracts you need

Now that you have compiled the contracts, you can verify them :

You will need -
`abiFilePath`: Absolute file path to the compiled json file. You can find the compiled json files in the `artifacts-zk` directory under [contracts](../../) folder. Example: <path-to-your-project-root>contracts/artifacts-zk/src/v0.8/ccip/PriceRegistry.sol/PriceRegistry.json
`encodedConstructorArgs`: The encoded constructor arguments for the contract. You can find the encoded constructor arguments in the `Input Data` field of the deployment transaction on etherscan.
If you cannot find the encoded constructor arguments, you can pass the following argument for the script to fetch the encoded constructor arguments:
`deploymentTx` - The transaction hash of the contract deployment transaction. Example: 0x801901aea0714fff8f26997bd148c744b6494865b01e83dfa15f571df7af531c
`rpcURL` - The RPC URL of the network you want to verify the contract on. Example: https://mainnet.infura.io/v3/your-infura-project-id

Once you have the above you can run the following command to generate the constructor arguments for verification script:

```bash
go run scripts/zksyncverify/main.go --abiFilePath=<path-to-abi-file> --deploymentTx=<deployment-tx> --rpcURL=<rpc-url>

Or 

go run scripts/zksyncverify/main.go --abiFilePath=<path-to-abi-file> --encodedConstructorArgs=<encoded-constructor-args>
```

This will generate the constructor arguments which you can use to in [zksync-verify.ts](zksync-verify.ts) script.
Replace the constructor arguments and contract address in the script and run the following command from [contracts](../../) dir to verify the contract:
Please note : the generated constructor arguments may not be in the right order, Cross-check the order of the constructor arguments, structs & its fields against the constructor in the respective solidity file.

```bash
pnpm run zksync:verify

For Testnet:
pnpm run zksync:verify:sepolia
```