This section provides detailed documentation for the Filfox Contract Verification API. It includes information on how to use the API, the available endpoints, request and response formats, and example code snippets.

Please refer to the documentation for more information on how to verify contracts using the Filfox API.

API Endpoint

# mainnet
Post    <https://filfox.info/api/v1/tools/verifyContract>

# calibration
Post    <https://calibration.filfox.info/api/v1/tools/verifyContract>

Parameters

interface SourceFiles {
    [name: string]: {
        content: string
    }
}

<aside> 💡 Tips: Some of the links below only work properly on Chrome, please use Google Chrome for a better reading experience.

</aside>

| --- | --- | --- | --- | --- | --- | | address | string | No | - | contract address, support 0x , f0 and f4 address | '0xB4C47eD546Fc31E26470a186eC2C5F19eF09BA41' or 'f02804637' or 'f410fwtch5vkg7qy6ezdqugdoylc7dhxqtosbhvnbwmq' | | language | string | Yes | 'Solidity' | only support Solidity for now | - | | compiler | string | Yes | 'latest' | compiler version used | 'v0.7.6+commit.7338295f' | | https://docs.soliditylang.org/en/latest/using-the-compiler.html#:~:text=the optimizations. "-,enabled,-"%3A true | boolean | Yes | false | use false for no optimization, and true if optimization was used | - | | https://docs.soliditylang.org/en/latest/using-the-compiler.html#:~:text=frequency usage. "-,runs,-"%3A 200 | number | Yes | 200 | the no. of runs if optimization was used | - | | https://docs.soliditylang.org/en/latest/using-the-compiler.html#:~:text=be omitted. "-,details,-"%3A { | string | Yes | '' | stringified JSON for switch optimizer components on or off in detail | '{"constantOptimizer":true,"cse":true,"deduplicate":true,"inliner":true,"jumpdestRemover":true,"orderLiterals":true,"peephole":true,"yul":false}' | | sourceFiles | https://filfox.notion.site/Filfox-Contract-Verification-API-Documents-c48d361c949348acb0bf806871ddd2c2 | No | - | - | - | | license | string | Yes | 'No License (None)' | - | 'MIT License (MIT)' | | https://docs.soliditylang.org/en/latest/using-the-compiler.html#:~:text=shanghai (default) "-,evmVersion,-"%3A "shanghai | string | Yes | 'default' | version of the EVM to compile for | 'shanghai' | | https://docs.soliditylang.org/en/latest/using-the-compiler.html#:~:text=by default. "-,viaIR,-"%3A true | boolean | Yes | false | change compilation pipeline to go through the Yul intermediate representation | true | | https://docs.soliditylang.org/en/latest/using-the-compiler.html#library-linking | string | Yes | '' | stringified JSON for library used in contract | '{"file_1.sol":{"library_1_name":"0x123..."}}' | | https://docs.soliditylang.org/en/latest/using-the-compiler.html#:~:text=settings (optional) "-,metadata,-"%3A { | string | Yes | '' | stringified JSON for Metadata settings | '{"bytecodeHash":"none"}' |

Examples

curl --location --request POST '<https://filfox.info/api/v1/tools/verifyContract>' \\
  --header 'Content-Type: application/json' \\
  --data-raw '{
  "address": "f02835916",
  "language": "Solidity",
  "compiler": "v0.8.17+commit.8df45f5f",
  "optimize": true,
  "optimizeRuns": 200,
  "optimizerDetails": "",
  "sourceFiles": {
    "filename1.sol": {
      "content": "contract A { function f() public { } }"
    },
    "filename2.sol": {
      "content": "contract B { function g() public { } }"
    }
  },
  "license": "",
  "evmVersion": "default",
  "viaIR": false,
  "libraries": "",
  "metadata": ""
}'

Return value

{
  "success": true,
  "errorCode": 0,
  "contractName": "xxx",
  "initCode": "xxx",
  "abi": "xxx"
}

# your contract is now verified.
{
  "success": false,
  "errorCode": 1,
}

# no source file was provide.
{
  "success": false,
  "errorCode": 2,
}

# please contact us on [Telegram](<https://t.me/Filfoxofficial>) if you encounter this error.
{
  "success": false,
  "errorCode": 3,
}

# The compiler version string must be in the long format. 
# Thus, if you would like to use version v0.7.6 
# you need to include the commit hash of the release
# like this: v0.7.6+commit.7338295f
# please try again later with correct compiler version string
# if you encounter this error.