Fraxscan
Fraxscan
Fraxscan
  • Introduction
  • ✨Getting Started
    • Creating an Account
    • Getting an API key
    • Endpoint URLs
  • 🎯API Endpoints
    • Accounts
    • Contracts
    • Transactions
    • Blocks
    • Logs
    • Geth Proxy
    • Tokens
    • Stats
  • 🤝Support
    • FAQ
    • Rate Limits
    • Common Error Messages
    • Getting Help
  • Visit Fraxscan.com
Powered by GitBook
On this page
  • Get Contract ABI for Verified Contract Source Codes
  • Get Contract Source Code for Verified Contract Source Codes
  • Verify Source Code
  • Source Code Submission Gist
  • Check Source Code Verification Submission Status
  • Verify Proxy Contract
  • Verifying Proxy Contract using cURL
  • Checking Proxy Contract Verification Submission Status using cURL
  1. API Endpoints

Contracts

PreviousAccountsNextTransactions

Last updated 1 year ago

Get Contract ABI for Verified Contract Source Codes

Returns the Contract Application Binary Interface ( ABI ) of a verified smart contract.

Find verified contracts on our page.

https://api.fraxscan.com/api
   ?module=contract
   &action=getabi
   &address=0x8C5e76293DF42f33CCAEe43C8De61A522E118a8d
   &apikey=YourApiKeyToken

Try this endpoint in your

Query Parameters

Parameter
Description

address

the contract address that has a verified source code

Sample Response

{
   "status":"1",
   "message":"OK",
   "result":"[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_factory\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_WETH\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"WETH\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"tokenA\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"tokenB\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amountADesired\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountBDesired\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountAMin\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountBMin\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"}],\"name\":\"addLiquidity\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amountA\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountB\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"liquidity\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amountTokenDesired\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountTokenMin\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountETHMin\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"}],\"name\":\"addLiquidityETH\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amountToken\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountETH\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"liquidity\",\"type\":\"uint256\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"factory\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amountOut\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"reserveIn\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"reserveOut\",\"type\":\"uint256\"}],\"name\":\"getAmountIn\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amountIn\",\"type\":\"uint256\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amountIn\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"reserveIn\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"reserveOut\",\"type\":\"uint256\"}],\"name\":\"getAmountOut\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amountOut\",\"type\":\"uint256\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amountOut\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"path\",\"type\":\"address[]\"}],\"name\":\"getAmountsIn\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amountIn\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"path\",\"type\":\"address[]\"}],\"name\":\"getAmountsOut\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amountA\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"reserveA\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"reserveB\",\"type\":\"uint256\"}],\"name\":\"quote\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amountB\",\"type\":\"uint256\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"tokenA\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"tokenB\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"liquidity\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountAMin\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountBMin\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"}],\"name\":\"removeLiquidity\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amountA\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountB\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"liquidity\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountTokenMin\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountETHMin\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"}],\"name\":\"removeLiquidityETH\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amountToken\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountETH\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"liquidity\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountTokenMin\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountETHMin\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"}],\"name\":\"removeLiquidityETHSupportingFeeOnTransferTokens\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amountETH\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"liquidity\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountTokenMin\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountETHMin\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"approveMax\",\"type\":\"bool\"},{\"internalType\":\"uint8\",\"name\":\"v\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"r\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"s\",\"type\":\"bytes32\"}],\"name\":\"removeLiquidityETHWithPermit\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amountToken\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountETH\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"liquidity\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountTokenMin\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountETHMin\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"approveMax\",\"type\":\"bool\"},{\"internalType\":\"uint8\",\"name\":\"v\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"r\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"s\",\"type\":\"bytes32\"}],\"name\":\"removeLiquidityETHWithPermitSupportingFeeOnTransferTokens\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amountETH\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"tokenA\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"tokenB\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"liquidity\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountAMin\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountBMin\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"approveMax\",\"type\":\"bool\"},{\"internalType\":\"uint8\",\"name\":\"v\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"r\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"s\",\"type\":\"bytes32\"}],\"name\":\"removeLiquidityWithPermit\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amountA\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountB\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amountOut\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"path\",\"type\":\"address[]\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"}],\"name\":\"swapETHForExactTokens\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amountOutMin\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"path\",\"type\":\"address[]\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"}],\"name\":\"swapExactETHForTokens\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amountOutMin\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"path\",\"type\":\"address[]\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"}],\"name\":\"swapExactETHForTokensSupportingFeeOnTransferTokens\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amountIn\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountOutMin\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"path\",\"type\":\"address[]\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"}],\"name\":\"swapExactTokensForETH\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amountIn\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountOutMin\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"path\",\"type\":\"address[]\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"}],\"name\":\"swapExactTokensForETHSupportingFeeOnTransferTokens\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amountIn\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountOutMin\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"path\",\"type\":\"address[]\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"}],\"name\":\"swapExactTokensForTokens\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amountIn\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountOutMin\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"path\",\"type\":\"address[]\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"}],\"name\":\"swapExactTokensForTokensSupportingFeeOnTransferTokens\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amountOut\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountInMax\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"path\",\"type\":\"address[]\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"}],\"name\":\"swapTokensForExactETH\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amountOut\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountInMax\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"path\",\"type\":\"address[]\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"}],\"name\":\"swapTokensForExactTokens\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}]"
}

A simple sample for retrieving the contractABI using Web3.js and Jquery to interact with a contract.

var Web3 = require('web3');
var web3 = new Web3(new Web3.providers.HttpProvider());
var version = web3.version.api;
        
$.getJSON('https://api.fraxscan.com/api?module=contract&action=getabi&address=0xfb6916095ca1df60bb79ce92ce3ea74c37c5d359', function (data) {
    var contractABI = "";
    contractABI = JSON.parse(data.result);
    if (contractABI != ''){
        var MyContract = web3.eth.contract(contractABI);
        var myContractInstance = MyContract.at("0xfb6916095ca1df60bb79ce92ce3ea74c37c5d359");
        var result = myContractInstance.memberId("0xfe8ad7dd2f564a877cc23feea6c0a9cc2e783715");
        console.log("result1 : " + result);            
        var result = myContractInstance.members(1);
        console.log("result2 : " + result);
    } else {
        console.log("Error" );
    }            
});

Get Contract Source Code for Verified Contract Source Codes

Returns the Solidity source code of a verified smart contract.

https://api.fraxscan.com/api
   ?module=contract
   &action=getsourcecode
   &address=0x8ee3bcb68486c2439f01ffba3a8aa0b8cb15a662
   &apikey=YourApiKeyToken 

Query Parameters

Parameter
Description

address

the contract address that has a verified source code

Sample Response

{
   "status":"1",
   "message":"OK",
   "result":[
      {
         "SourceCode":"// SPDX-License-Identifier: LGPL-3.0-or-later\r\npragma abicoder v2;\r\npragma solidity ^0.8.9;\r\n\r\ncontract BulkFactory {\r\n  struct Pool {\r\n    address pool_address;\r\n    uint112 reserve0;\r\n    uint112 reserve1;\r\n  }\r\n  \r\n  struct Token01 {\r\n    address pool_address;\r\n    address token0;\r\n    address token1;\r\n  }\r\n  \r\n  function pairLength(address factory) external view returns (uint) {\r\n    return IPancakeFactory(factory).allPairsLength();\r\n  }\r\n\r\n  function getPairs(address factory, uint start, uint end) public view returns (address[] memory pairs) {\r\n    pairs = new address[](end - start + 1);\r\n    for(uint i = start; i <= end; i++) {\r\n      try IPancakeFactory(factory).allPairs(i) returns (address pair) {\r\n          pairs[i - start] = pair;\r\n      } catch {\r\n          pairs[i - start] = address(0);\r\n      }\r\n    }\r\n  }\r\n\r\n  function getPairsToken01(address factory, uint start, uint end) external view returns (Token01[] memory tokens) {\r\n    address[] memory pairs = getPairs(factory, start, end);\r\n\r\n    tokens = new Token01[](pairs.length);\r\n    \r\n    for(uint i = 0; i < pairs.length; i++) {\r\n      if(isAContract(pairs[i])) { \r\n        address _token0 = getToken0(pairs[i]); \r\n        address _token1 = getToken1(pairs[i]);\r\n        tokens[i] = Token01(pairs[i], _token0, _token1); \r\n      } else {\r\n        tokens[i] = Token01(pairs[i], address(0), address(0));   \r\n      }\r\n    }\r\n  }\r\n\r\n  function getPairsReserve(address factory, uint start, uint end) external view returns (Pool[] memory reserves) {\r\n    address[] memory pairs = getPairs(factory, start, end);\r\n\r\n    reserves = new Pool[](pairs.length);\r\n    \r\n    for(uint i = 0; i < pairs.length; i++) {\r\n      if(isAContract(pairs[i])) { \r\n        (uint112 _reserve0, uint112 _reserve1,) = getReserves(pairs[i]); \r\n        reserves[i] = Pool(pairs[i], _reserve0, _reserve1); \r\n      } else {\r\n        reserves[i] = Pool(pairs[i], 0, 0);   \r\n      }\r\n    }\r\n    return reserves;\r\n  }\r\n\r\n  function getReservesBulk(address[] calldata pools) external view returns (Pool[] memory reserves) {\r\n    reserves = new Pool[](pools.length);\r\n    \r\n    for(uint i = 0; i < pools.length; i++) {\r\n      if(isAContract(pools[i])) { \r\n        (uint112 _reserve0, uint112 _reserve1,) = getReserves(pools[i]); \r\n        reserves[i] = Pool(pools[i], _reserve0, _reserve1); \r\n      } else {\r\n        reserves[i] = Pool(pools[i], 0, 0);   \r\n      }\r\n    }\r\n    return reserves;\r\n  }\r\n\r\n  function getToken01Bulk(address[] calldata pools) external view returns (Token01[] memory tokens) {\r\n    tokens = new Token01[](pools.length);\r\n    \r\n    for(uint i = 0; i < pools.length; i++) {\r\n      if(isAContract(pools[i])) { \r\n        address _token0 = getToken0(pools[i]); \r\n        address _token1 = getToken1(pools[i]);\r\n        tokens[i] = Token01(pools[i], _token0, _token1); \r\n      } else {\r\n        tokens[i] = Token01(pools[i], address(0), address(0));   \r\n      }\r\n    }\r\n    return tokens;\r\n  }\r\n\r\n  function getReserves(address pair) internal view returns (uint112, uint112, uint32) {\r\n    try IPancakePair(pair).getReserves() returns (uint112 _reserve0, uint112 _reserve1, uint32 blockTimestampLast) {\r\n        return (_reserve0, _reserve1, blockTimestampLast);\r\n    } catch Error(string memory /*reason*/) {\r\n        return (0, 0, 0);\r\n    } catch (bytes memory /*lowLevelData*/) {\r\n        return (0, 0, 0);\r\n    }\r\n  }\r\n    \r\n  function getToken0(address pair) internal view returns (address) {\r\n    try IPancakePair(pair).token0() returns (address token) {\r\n        return (token);\r\n    } catch Error(string memory /*reason*/) {\r\n        return (address(0));\r\n    } catch (bytes memory /*lowLevelData*/) {\r\n        return (address(0));\r\n    }\r\n  }\r\n\r\n  function getToken1(address pair) internal view returns (address) {\r\n    try IPancakePair(pair).token1() returns (address token) {\r\n        return (token);\r\n    } catch Error(string memory /*reason*/) {\r\n        return (address(0));\r\n    } catch (bytes memory /*lowLevelData*/) {\r\n        return (address(0));\r\n    }\r\n  }\r\n\r\n  // check if contract (token, exchange) is actually a smart contract and not a 'regular' address\r\n  function isAContract(address contractAddr) internal view returns (bool) {\r\n    uint256 codeSize;\r\n    assembly { codeSize := extcodesize(contractAddr) } // contract code size\r\n    return codeSize > 0; \r\n    // Might not be 100% foolproof, but reliable enough for an early return in 'view' functions \r\n  }\r\n}\r\n\r\ninterface IPancakePair {\r\n  function token0() external view returns (address);\r\n  function token1() external view returns (address);\r\n  function getReserves() external view returns (uint112, uint112, uint32);\r\n}\r\n\r\ninterface IPancakeFactory {\r\n  function allPairsLength() external view returns (uint);\r\n  function allPairs(uint index) external view returns (address);\r\n}",
         "ABI":"[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"factory\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"start\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"end\",\"type\":\"uint256\"}],\"name\":\"getPairs\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"pairs\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"factory\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"start\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"end\",\"type\":\"uint256\"}],\"name\":\"getPairsReserve\",\"outputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"pool_address\",\"type\":\"address\"},{\"internalType\":\"uint112\",\"name\":\"reserve0\",\"type\":\"uint112\"},{\"internalType\":\"uint112\",\"name\":\"reserve1\",\"type\":\"uint112\"}],\"internalType\":\"struct BulkFactory.Pool[]\",\"name\":\"reserves\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"factory\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"start\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"end\",\"type\":\"uint256\"}],\"name\":\"getPairsToken01\",\"outputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"pool_address\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"token0\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"token1\",\"type\":\"address\"}],\"internalType\":\"struct BulkFactory.Token01[]\",\"name\":\"tokens\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"pools\",\"type\":\"address[]\"}],\"name\":\"getReservesBulk\",\"outputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"pool_address\",\"type\":\"address\"},{\"internalType\":\"uint112\",\"name\":\"reserve0\",\"type\":\"uint112\"},{\"internalType\":\"uint112\",\"name\":\"reserve1\",\"type\":\"uint112\"}],\"internalType\":\"struct BulkFactory.Pool[]\",\"name\":\"reserves\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"pools\",\"type\":\"address[]\"}],\"name\":\"getToken01Bulk\",\"outputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"pool_address\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"token0\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"token1\",\"type\":\"address\"}],\"internalType\":\"struct BulkFactory.Token01[]\",\"name\":\"tokens\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"factory\",\"type\":\"address\"}],\"name\":\"pairLength\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]",
         "ContractName":"BulkFactory",
         "CompilerVersion":"v0.8.9+commit.e5eed63a",
         "OptimizationUsed":"0",
         "Runs":"200",
         "ConstructorArguments":"",
         "EVMVersion":"Default",
         "Library":"",
         "LicenseType":"None",
         "Proxy":"0",
         "Implementation":"",
         "SwarmSource":"ipfs://95d5fe4631fcc4b4efc07909be73a1f15fe806841ffb112c77b7a7d430edf593"
      }
   ]
}

Verify Source Code

Submits a contract source code to Fraxscan for verification.

  1. Only supports HTTP POST due to max transfer size limitations for HTTP GET

  2. Supports up to 10 different library pairs

  3. Contracts that use "imports" will need to have the code concatenated into one file as we do not support "imports" in separate files.

  4. Upon successful submission you will receive a GUID (50 characters) as a receipt

  5. You may use this GUID to track the status of your submission

Source Code Submission Gist

//Submit Source Code for Verification
$.ajax({
    type: "POST", //Only POST supported  
    url: "//api.fraxscan.com/api", //Set to the  correct API url for Other Networks
    data: {
        apikey: $('#apikey').val(),                     //A valid API-Key is required        
        module: 'contract',                             //Do not change
        action: 'verifysourcecode',                     //Do not change
        contractaddress: $('#contractaddress').val(),   //Contract Address starts with 0x...     
        sourceCode: $('#sourceCode').val(),             //Contract Source Code (Flattened if necessary)
        codeformat: $('#codeformat').val(),             //solidity-single-file (default) or solidity-standard-json-input (for std-input-json-format support
        contractname: $('#contractname').val(),         //ContractName (if codeformat=solidity-standard-json-input, then enter contractname as ex: erc20.sol:erc20)
        compilerversion: $('#compilerversion').val(),   // see https://fraxscan.com/solcversions for list of support versions
        optimizationUsed: $('#optimizationUsed').val(), //0 = No Optimization, 1 = Optimization used (applicable when codeformat=solidity-single-file)
        runs: 200,                                      //set to 200 as default unless otherwise  (applicable when codeformat=solidity-single-file)        
        constructorArguements: $('#constructorArguements').val(),   //if applicable
        evmversion: $('#evmVersion').val(),             //leave blank for compiler default, homestead, tangerineWhistle, spuriousDragon, byzantium, constantinople, petersburg, istanbul (applicable when codeformat=solidity-single-file)
        licenseType: $('#licenseType').val(),           //Valid codes 1-14 where 1=No License .. 14=Business Source License 1.1, see https://fraxscan.com/contract-license-types
        libraryname1: $('#libraryname1').val(),         //if applicable, a matching pair with libraryaddress1 required
        libraryaddress1: $('#libraryaddress1').val(),   //if applicable, a matching pair with libraryname1 required
        libraryname2: $('#libraryname2').val(),         //if applicable, matching pair required
        libraryaddress2: $('#libraryaddress2').val(),   //if applicable, matching pair required
        libraryname3: $('#libraryname3').val(),         //if applicable, matching pair required
        libraryaddress3: $('#libraryaddress3').val(),   //if applicable, matching pair required
        libraryname4: $('#libraryname4').val(),         //if applicable, matching pair required
        libraryaddress4: $('#libraryaddress4').val(),   //if applicable, matching pair required
        libraryname5: $('#libraryname5').val(),         //if applicable, matching pair required
        libraryaddress5: $('#libraryaddress5').val(),   //if applicable, matching pair required
        libraryname6: $('#libraryname6').val(),         //if applicable, matching pair required
        libraryaddress6: $('#libraryaddress6').val(),   //if applicable, matching pair required
        libraryname7: $('#libraryname7').val(),         //if applicable, matching pair required
        libraryaddress7: $('#libraryaddress7').val(),   //if applicable, matching pair required
        libraryname8: $('#libraryname8').val(),         //if applicable, matching pair required
        libraryaddress8: $('#libraryaddress8').val(),   //if applicable, matching pair required
        libraryname9: $('#libraryname9').val(),         //if applicable, matching pair required
        libraryaddress9: $('#libraryaddress9').val(),   //if applicable, matching pair required
        libraryname10: $('#libraryname10').val(),       //if applicable, matching pair required
        libraryaddress10: $('#libraryaddress10').val()  //if applicable, matching pair required
    },
    success: function (result) {
        console.log(result);
        if (result.status == "1") {
            //1 = submission success, use the guid returned (result.result) to check the status of your submission.
            // Average time of processing is 30-60 seconds
            document.getElementById("postresult").innerHTML = result.status + ";" + result.message + ";" + result.result;
            // result.result is the GUID receipt for the submission, you can use this guid for checking the verification status
        } else {
            //0 = error
            document.getElementById("postresult").innerHTML = result.status + ";" + result.message + ";" + result.result;
        }
        console.log("status : " + result.status);
        console.log("result : " + result.result);
    },
    error: function (result) {
        console.log("error!");
        document.getElementById("postresult").innerHTML = "Unexpected Error"
    }
});

Check Source Code Verification Submission Status

//Check Source Code Verification Status
$.ajax({
    type: "GET",
    url: "//api.fraxscan.com/api",
    data: {
        apikey: $('#apikey').val(), 
        guid: 'ezq878u486pzijkvvmerl6a9mzwhv6sefgvqi5tkwceejc7tvn', //Replace with your Source Code GUID receipt above
        module: "contract",
        action: "checkverifystatus"
    },
    success: function (result) {
        console.log("status : " + result.status);   //0=Error, 1=Pass 
        console.log("message : " + result.message); //OK, NOTOK
        console.log("result : " + result.result);   //result explanation
        $('#guidstatus').html(">> " + result.result);
    },
    error: function (result) {
        alert('error');
    }
});

Verify Proxy Contract

Submits a proxy contract source code to Fraxscan for verification.

  1. Requires a valid Fraxscan API key, it will be rejected otherwise

  2. Current daily limit of 100 submissions per day per user (subject to change)

  3. Only supports HTTP post

  4. Upon successful submission you will receive a GUID (50 characters) as a receipt

  5. You may use this GUID to track the status of your submission

  6. Verified proxy contracts will display the "Read/Write as Proxy" of the implementation contract under the contract address's contract tab

Verifying Proxy Contract using cURL

// example with only the mandatory contract address parameter
curl -d "address=0xcbdcd3815b5f975e1a2c944a9b2cd1c985a1cb7f" "https://api.fraxscan.com/api?module=contract&action=verifyproxycontract&apikey=YourApiKeyToken"

// example using the expectedimplementation optional parameter
// the expectedimplementation enforces a check to ensure the returned implementation contract address == address picked up by the verifier
curl -d "address=0xbc46363a7669f6e12353fa95bb067aead3675c29&expectedimplementation=0xe45a5176bc0f2c1198e2451c4e4501d4ed9b65a6" "https://api.fraxscan.com/api?module=contract&action=verifyproxycontract&apikey=YourApiKeyToken"
// OK
{"status":"1","message":"OK","result":"gwgrrnfy56zf6vc1fljuejwg6pelnc5yns6fg6y2i6zfpgzquz"}

// NOTOK
{"status":"0","message":"NOTOK","result":"Invalid API Key"}

Checking Proxy Contract Verification Submission Status using cURL

curl "https://api.fraxscan.com/api?module=contract&action=checkproxyverification&guid=gwgrrnfy56zf6vc1fljuejwg6pelnc5yns6fg6y2i6zfpgzquz&apikey=YourApiKeyToken"
// OK
{"status":"1","message":"OK","result":"The proxy's (0xbc46363a7669f6e12353fa95bb067aead3675c29) implementation contract is found at 0xe45a5176bc0f2c1198e2451c4e4501d4ed9b65a6 and is successfully updated."}
                                    
// NOTOK
{"status":"0","message":"NOTOK","result":"A corresponding implementation contract was unfortunately not detected for the proxy address."}

Tip : You can also download a of which the code publishers have provided a corresponding Open Source license for redistribution.

Try this endpoint in your

Requires a valid , it will be rejected otherwise

List of , only solc version v0.4.11 and above is supported e.g. v0.4.25+commit.59dbf8f1

Verified Source Codes will be displayed at the page.

Note: Upon successful submission, a GUID is returned, which can be used to check for submission status.

🎯
👇
✅
🔗
Verified Contracts Source Code
browser
📩
CSV list of verified contracts addresses
🔗
browser
Fraxscan API key
supported solc versions
Verified Contracts