A simple sample for retrieving the contractABI using Web3.js and Jquery to interact with a contract.
var Web3 =require('web3');var web3 =newWeb3(newWeb3.providers.HttpProvider());var version =web3.version.api;$.getJSON('https://api-cardona-zkevm.polygonscan.com/api?module=contract&action=getabi&address=0x0000000000000000000000000000000000001004&apikey=YourApiKeyToken', function (data) {
var contractABI =""; contractABI =JSON.parse(data.result);if (contractABI !='') {var MyContract =web3.eth.contract(contractABI);var myContractInstance =MyContract.at("0x0000000000000000000000000000000000001004");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.
📩Tip : You can also download a CSV list of Verified Contract Addresses of which the code publishers have provided a corresponding Open Source license for redistribution.
Current daily limit of 100 submissions per day per user (subject to change)
Only supports HTTP post
Upon successful submission you will receive a GUID (50 characters) as a receipt
You may use this GUID to track the status of your submission
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 parametercurl -d "address=0xcbdcd3815b5f975e1a2c944a9b2cd1c985a1cb7f" "https://api-cardona-zkevm.polygonscan.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-cardona-zkevm.polygonscan.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
// 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."}