Get contract abi hardhat

Last UpdatedMarch 5, 2024

by

Anthony Gallo Image

Ethers. Directly use deployContract function. Sep 19, 2023 · To find the contract address of a contract that has already been deployed, you can use the following steps: Get the ABI of the contract. It also uses our custom Chai matchers and our Hardhat Mar 13, 2018 · In my contact have multiple imports and successfully deployed my contract. By Dibas Dauliya Edited at 13 Feb 2023. ERC20 smart contract is a standard and we will use a file with human-readable ABI instead of the compiled artifacts output in our Hardhat project. I want to fetch smart contract file ABI by compiling it programmatically (without using terminal). abi, factoryArtifact. This behavior can be disabled with the --no-compile flag: npx hardhat export-abi --no-compile. I have tried truffle compile and it works fine and generates ABI. ContractFactory(abi, bytecode, wallet) const contract = await factory. abi: the ABI of the smart contract containing the functions you want to call. What is the best way of doing it? The included Hardhat tasks may be run manually: npx hardhat export-abi. From Ethereum's ABI specification, an Jul 20, 2017 · But I also have another previously deployed contract with address1. Dec 27, 2022 · This May or Maynot work for all Contract. greet ( ) ) . You can learn more about Contract ABIs here. I believe there is no need to provide the ABI if your constructor does not have arguments upon creation of the contract. Once your contract is ready, the next step is to deploy it to a live network and verify its source code. 8. Solidity JSON ABI. This is my contract address 0xc2d4d839001f9d985618a22b89155ea8d6550ae6 How can get the abi May 20, 2022 · We use ethers. The ethers. contract(abiarray). Dec 11, 2023 · Creating Contract. methods. Aug 2, 2022 · Using ethers you can deploy a contract just from its bytecode using sendTransaction: const [wallet] = await ethers. By default, the hardhat compile task is run before exporting ABIs. totalAllocPoint(); you've been missing parenthesis here. While you can get array like: let y = await contract. Writing automated tests when building smart contracts is of crucial importance, as your user's money is what's at stake. Developers can generate a smart contract ABI using the Solidity compiler (solc), Remix,or other development frameworks like Foundry or Hardhat. To test our contract, we are going to use Hardhat Network, a local Ethereum network designed for development. yarn run hardhat clear-abi. address whenever you want to use the address and can submit that as a parameter wherever it is needed. The supports ABI types are: Human-Readable ABI. Contract ABI. Some contracts need to be linked with libraries before they are deployed. Step 4) Create a file name sample-script. Get Solidity stack traces, console. To deploy a contract from an artifact on hardhat (for testing purposes) I can get the contract artifact json file and put it in the repo and then do it like this: XTokenWrapperArtifact. interface The Interface meta-class of the parsed ABI. Follow the steps below to create an app: First, navigate to your Alchemy dashboard and click on the "Apps" tab. # Support for path mappings. Something like: Jul 24, 2022 · Smart Contracts: Smart contracts are programs stored on blockchain networks that execute when predetermined conditions are met. getContractEvents({ abi: erc20Abi, eventName: 'Transfer', }) logs[0 Nov 26, 2021 · 2. prototype. It also adds a mechanism to associate names to addresses, so test and deployment scripts can be reconfigured by simply changing the address a name points to, allowing different configurations per network. Aug 22, 2018 · I cannot find the contract details to get the json interface anymore. See the wagmi TypeScript docs for more information. g web3. . However, I recommend using this web3. After compiling your contracts, the next step is to write some tests to verify that they work as intended. 4) of ethers, connected to a Goerli network provider: const CONTRACT_ABI = [/* */]; const myContract = new ethers. Jun 3, 2024 · First clone the repository, and then prepare for the contract deployment: cd hardhat-boilerplate. You can create a Contract Instance with the getContract function by passing in a ABI, address, and Public and/or Wallet Client. It is easier to read, imports are maintained, licenses are maintained. getCode(contractAddress) to get the Bytecode Apr 6, 2023 · There are several formats available to specify an ABI for a Smart Contract, which specifies to the under-lying library what methods, events and errors exist so that encoding and decoding the data from and to the network can be handled by the library. yarn run hardhat export-abi. js plugin to generate the ABI and the bytecode. You can write scripts that access the Hardhat Runtime Environment 's properties as global variables. This guide also covered how to use the web3 libraryethers. With this key, we can make requests to the Sepolia test network. abi, XTokenWrapperArtifact. It generates typesafe, ready to use ethers. @eth I tried -- the transaction is just the exact same data as the contract. Contract( address , abi , signerOrProvider ). Type ". You can find this in the artifacts folder of your Hardhat project. Please note the Note above from when you verify and publish your contract. js && hh run useContract. As an example, I've done this when working with May 17, 2024 · Once the contract is deployed, we can call our contract methods on greeter and use them to get the state of the contract. contract["foobar(address,uint256)"]). getContractFactory("<contract_name>"), it looks for the abi and bytecode in the artifacts directory. infura. expect ( await greeter . to . Get the smart contract ABI using Remix Apr 18, 2016 · Here is how you get the abi by using your local solc compiler: solc filename. It relies on ethers to connect to Hardhat Network and on Mocha and Chai for the tests. Apr 6, 2022 · 2. Data is encoded according to its type, as described in this specification. We will use Ethers. under the interface section Apr 6, 2023 · A Meta-Class is a Class which has any of its properties determined at run-time. py instance #. May 23, 2024 · Hardhat is a development environment for Ethereum software. I have: var list = await contract. Open another terminal and deploy your contract. viem will not return a value for arguments that do not conform to the ABI, thus, some arguments on args may be undefined. Share. Try two things: Comment out the require statement. We can do that by heading to the code tab on Etherscan, where you'll find the ABI for the contract: Nov 11, 2022 · const factory = new ethers. However, Blockscout ignores those arguments, so you may specify any values that correspond to the ABI. I'm unable to get back the data from the contract, here's the info. Compile Solidity contract into bytecode and an ABI #. You'd reference counter. May 20, 2024 · 5. e. For example, if you have a script that deploys the contract and another that uses the contract, and you do hh run deploy. eth-sdk. Jul 20, 2021 · I'm trying to interact with contracts that are deployed in the local hardhat env through web3. 495 2 5 9. By default, getContractEvents will include logs that do not conform to the indexed & non-indexed arguments on the event . Verifying a contract means making its source code public, along with the compiler settings you used, which allows anyone to compile it and compare the generated bytecode with the one that is deployed on-chain. Solidity Object ABI. Note we shouldn’t use a hard coded private key when deploying in production. js (included in hardhat-ethers) to interact with smart contracts; keep in mind you are able to do the same using other web3 libraries e. When the details is clicked, a pop-up window will appear. The collaboration between the Kyber and Hardhat teams to fix issues and implement new features has been fast and smooth, which helped our internal timelines a lot. Hardhat is the easy and user-friendly tool to code, compile, test, and deploy smart contract. sol Solidity file: Explanation of the code above: Line 1: Specifying SPDX license type, which is an addition after Solidity ^0. The compiled artifacts will be saved in the artifacts/ directory by default, or whatever your configured artifacts path is. abiFromBytecode(bytecode); console. ethers. Here are the benefits of testing smart contracts with Hardhat: Jul 3, 2023 · To begin, run the following commands in order. Compiling Compiled 1 contract successfully. It consists of different components for editing, compiling, debugging and deploying your smart contracts and dApps, all of which work together to create a complete development environment. An ABI outlines which function you would like to use from a smart contract deployed on the Ethereum Virtual Machine. getArtifact function : const {deployments} = require ('hardhat'); const artifact = await deployments. Contract(CONTRACT_ADDRESS, CONTRACT_ABI, provider); // `getEntryFee()` function defined in the ABI JSON as well as in the actual contract. Apr 27, 2017 at 22:59. Jan 8, 2022 · In Hardhat, the --dev flag is used when installing libraries using the npm or yarn package managers to indicate that the library being installed is a development dependency. The bytecode is the compiled code of the contract that gets May 5, 2022 · make sure you have installed the extra packages npm install --save-dev @nomiclabs/hardhat-waffle ethereum-waffle chai @nomiclabs/hardhat-ethers ethers and then use Waffle for that. npx hardhat node. The plugin requires you to include constructor arguments with the verify task and ensures that they correspond to expected ABI signature. npx hardhat clear-abi. Metadata. Hardhat is a development environment for Ethereum applications that offers various tools and libraries to facilitate smart contract testing. # Library linking. bytecode, owner ); const factory May 10, 2023 · Here are the benefits of testing smart contracts with Hardhat: Rapid Testing: Hardhat enables developers to create a local Ethereum blockchain for testing, resulting in quicker tests than on a Dec 11, 2023 · The ABI helps different smart contracts understand each other's messages. If you want to interact with a smart contract, two main pieces are needed: the ABI and the deployed contract's address. dir(abi); // We also have a suite of database loaders for convenience. address should be mynft. Feb 28, 2018 · The ABI must be provided by the contract deployer, and cannot be (effectively) derived from just the address or the code at the address. io --private-key abc123456789 src/MyContract. May 23, 2024 · Verifying your contracts. This hardhat plugin adds a mechanism to deploy contracts to any network, keeping track of them and replicating the same environment for testing. Apr 5, 2022 · To deploy a contract we can use the following command:-. Mar 22, 2022 · hardhatでdeploy済みのcontractにabiを使って接続しインタラクトしたいときのやり方を紹介します。. The Contract Application Binary Interface (ABI) is the standard way to interact with contracts in the Ethereum ecosystem, both from outside the blockchain and for contract-to-contract interaction. Transaction's payload is different from the smart contract bytecode. It generates typing files (*. That usually happens when you use two different instances of the hardhat network. import { getContract } from 'viem'import { wagmiAbi } from '. io for the contract address. Compiling smart contracts produces two important artifacts: - the ABI representing the public interface of the contract - the bytecode representing the program executable that actually lives on the blockchain. OR. sol --abi You also need the bin code to deploy the contract, which you can get as follows: solc filename. May 17, 2024 · Once the contract is deployed, we can call our contract methods on greeter and use them to get the state of the contract. May 12, 2021 · To verify Contracts that accept Constructor arguments, please enter the ABI-encoded Arguments in the last box below. Copy-paste the following code into your HelloWorld. Feb 24, 2022 · Contract Application Binary Interface (ABI) is the standard way to interact with contracts in the Ethereum ecosystem. Development frameworks for Ethereum automatically generate the Application Binary Interface as part of the compilation output often stored in the "artifacts" or "build" directory by default. const abi = whatsabi. This will be something you code into your deployment script. Testing contracts. An Ethereum smart contract is bytecode deployed on the Ethereum blockchain. log and more. You can use it by running npx hardhat console: $ npx hardhat console. 10. wait() Share. sol --bin If you want a solc combined output (e. Once created, you can call contract methods, fetch for events, listen to events, etc. Our contract ABI (Application Binary Interface) is the interface to interact with our smart contract. user2548436. And That Meta data has IPFS Hash and Solc Version in Which the code has been complied. 7 (2016-12-15) Solidity compiler generates an output file called metadata that contains information about the contract and the compilation ( see Solidity docs ). Look at the paths configuration section to learn how to change it. Use the ABI to get the contract factory. In the sample LockModule above, two module parameters are used: unlockTime which will default to the 1st of Jan 2030 and lockedAmount which will default to one Gwei. Open your Visual Studio Code and in the terminal type in ‘npx hardhat init Oct 13, 2020 · The recommended way to verify a smart contract inheriting from OpenZeppelin Contracts is as a "multi-file" contract (corresponding to the Standard-Json-Input compiler type on Etherscan). The ERC20 spec is actually a smart contract on Ethereum, and you can see the entire ABI for it here. Read the documentation on the Hardhat Runtime Environment to learn how to access the HRE in different ways to use ethers. Hardhat typically stores artifacts in the "artifacts" directory within your project: Using Remix to get contract ABI Dec 21, 2021 · In this json file you'll find the abi, the bytecode, the topics (if you have any event in your smart contract), the function definitions etc (you get the point I guess, I encourage you to spend some time understanding that file - just to get a broad understanding). /abi' clear: whether to delete old files in path on compilation: false: flat: whether to flatten output directory (may cause name collisions) false: only: Array of String matchers used to select included contracts, defaults to all contracts if length is 0 [] except: Array of String Jan 21, 2022 · Usually you can use what the contract variable is called to reference the address by writing <variable name>. Step 1: Project Setup. The encoding is not self describing and thus requires a schema in order to Feb 13, 2023 · Connect Hardhat Contract with Ethers in Frontend. The compile task will be called before opening the console prompt, but you can skip this with the --no-compile parameter. ContractFactory is used to create a contract factory object by providing the contract's ABI (abi) and bytecode (bytecode). sol:MyContract --constructor-args "Hello Foundry" "Arg2". js. sol --combined-json abi,bin Usage. for parity), where bin is part of the abi json string, use this: solc filename. , abi and bytecode), then you can set those compiled output files as variables in your test file and pass the abi and bytecode as parameters when setting up the contract object through ethers getContractFactory method. Deploy the contract using the Contract instance to initiate a transaction #. js, each script will create, use and destroy a temporary, in-process hardhat network. Moreover, they are typically written in high-level languages like Solidity. TypeChain generates only TypeScript typings ( d. Now, for our contract, create a new directory contracts and place a new file HelloWorld. Jan 26, 2022 · Not entirely sure this answers your question, but I was looking back a project I had deployed a while back and figuring out the contract address for it. mkdir factory-contractcd factory-contractnpm init -ynpm install --save-dev hardhatnpx hardhat. This guide explains our recommended approach for testing contracts in Hardhat. 例えば、ある特定の人のwallet addressのUSDCの残高を確認したいとします。. Oct 2, 2023 · 4. forge create --rpc-url https://mainnet. And You can use web3. Nov 6, 2022 · To make it work, you need to pass an object in the parameters with these 3 properties: address: the address of the smart contract you want to interact with. utils. js copy and paste the below code. It comes built-in with Hardhat, and it's used as the default network. Create a new project directory: mkdir smart-contract-guide cd smart-contract How to get a smart contract ABI. That’s the quick workaround to interact with or test a pre-deployed contract, using its ABI from source and deployed address. Makes it easier to use viem in a Hardhat project. If you select the compile tab, there you will find a button called details. By defining inline or adding a const assertion to abi , TypeScript will infer the correct types for properties and methods on the contract object. js is the JavaScript library to interact with smart contracts. Often you can find the ABI published by the author by looking at the "code" tab on etherscan. Fill in the details for your new app, this includes specifying a name and description (optional) for it. answered Feb 14, 2022 at 3:24. Nomic Foundation's recommended bundle of Hardhat plugins (viem based) Adds Ethereum-related matchers to Chai. I see only one way to work with the contract1: var abiarray = [ here goes pretty big abi ]; contract1 = web3. log("list ", list ); which gets me. There could be several functions in a contract. const mynft= await ethers. hardhat-deploy gives can access to these artifacts via the deployments. /client'// 1. Welcome to Node. getArtifact(artifactName); With the hardhat-deploy . js wrappers and uses etherscan/sourcify to automatically get ABIs based only on smart contract addresses. asked Apr 27, 2017 at 19:49. Get the contract address from the contract object. 0. But there is no way to get the ABI knowing the smartcontract address. Generally, this should not need Apr 21, 2021 · npx hardhat node. ts) files, if you're looking for "opinionated", "batteries included" solution check out our new project: eth-sdk. erc20のabiはその辺 May 17, 2024 · Using the Hardhat console. loaders. The first function specifed in the ABI will be bound to its name. help" for more information. その際には、下記のようにhardhatで記載してあげたら、確認できます。. In a different terminal in the same directory, run: Jan 30, 2018 · 1. Jun 7, 2023 · Setting up the Environment: First we need to set up the hardhat project to get started working on our smart contract . In that JSON you find the bytecode and abi fields of contract A (all inherited external methods and public properties are included) – tenbits Apr 17, 2023 at 8:53 Jun 3, 2024 · To compile your contracts in your Hardhat project, use the built-in compile task: $ npx hardhat compile. May 20, 2024 · There are two ways of writing a script that accesses the Hardhat Runtime Environment. getList(); console. However, you only need the balanceOf method in this The following example runs through these steps: #. js and npm installed on your machine. getSigners to get the signer addresses and extract the first address [sender] which is the default address used by Hardhat. However, is it possible to have the compiled json file stored in another directory, and specify it to have the getContractsFactory function look for it in that directory? If no network is specified, Hardhat Ignition will run against an in-memory instance of Hardhat Network. >. Recently hardhat team made @nomiclabs/hardhat-ethers itself extensible so my plan is to update hardhat-deploy-ethers to extend it instead of being a fork of it. json file. Since v0. Injects ethers. Apr 11, 2018 · Tour Start here for a quick overview of the site Help Center Detailed answers to any questions you might have Jun 30, 2022 · So I am using hardhat-deploy plugin and I have only 2 contracts to deploy. address); This should work for any ERC20 token as well. js into the Hardhat Runtime Environment. # Running scripts with the Hardhat CLI. js - but I personally prefer the ethers SDK. equal ( "Hello, world!" Here we're using our Contract instance to call a smart contract function in our Solidity code. deployed(); May 11, 2023 · Testing smart contracts is a crucial aspect of the development process to ensure that the contracts function correctly and are error-free. 5. Jan 13, 2022 · We can get contract instance using Ethers. address. 6. For mapping types Aug 18, 2023 · Initiate the Uniswap V2 Factory contract and deploy it using the ABI and bytecode: const Factory = new ContractFactory( factoryArtifact. // Your contract bytecode (hexadecimal) const bytecode = "your byte code here"; // Get an ABI-like list of interfaces. Dec 28, 2021 · I have ERC20 contracts with imports and solc is not able to compile contracts with imports. Typescript allows defining custom path mappings via the paths configuration option: Aug 4, 2023 · ABI (Application Binary Interface) in the context of computer science is an interface between two program modules, often between operating systems and user programs. EVM (Ethereum Virtual Machine) is the core component of the Ethereum network, and smart contract is pieces of code stored on the Ethereum blockchain which are executed on EVM. Hardhat Jan 28, 2023 · The ABI is a JSON representation of the contract's interface, which describes the functions and events that the contract exposes. parseEther is a utility function to convert a value from ETH to WEI which is the value we want to send to the contract when calling the payable method save. list {arguments: Array(0), call: ƒ, send: ƒ, encodeABI: ƒ, estimateGas: ƒ Jun 3, 2024 · Testing contracts. These objects contain the abi and the address of any deployed contract and you can export them to json. sol inside it. js v12. When I deployed it at the time using hardhat, you have to write the abi and contract into a . npx hardhat verify --network <network> DEPLOYED_CONTRACT_ADDRESS "Constructor argument 1". Use the contract factory to get the contract object. Most of the times, these tools will automatically create the ABI when you compile the smart contract. address The address (or ENS name) of the contract. To access overloaded functions, use the full typed signature of the functions (e. js from anywhere the HRE is accessible. We will be creating a folder, moving into the folder, intializing a JavaScript project, installing Hardhat, and creating some boilerplate code. Next, click on the "Create new app" button. 4. Makes it easier to use Hardhat and Foundry in the same project. But The Bytecode of the Smart Contract has Meta data in it. /abi'import { publicClient, walletClient } from '. Here we just install the npm project's dependencies, and by running npx hardhat node we spin up an instance of Hardhat Network that you can connect to using your wallet. const logs = await publicClient. The first thing we need to do is grab the ABI for the smart contract. A development dependency is a package that is only needed during the development or testing phase of a project and is not required for the final production deployment. Another option (which is highly under utilized) is the ABI can be stored in ENS for a Mar 28, 2022 · For the ethers plugin in hardhat, when I use ethers. Compile your contracts and run them on a development network. functionName: the name of the function to call. js to send and receive the data from smart contract that we created using Apr 6, 2021 · Step 3: Grab your contract ABI‌. The tx payload contains: code to deploy the Jan 2, 2024 · Fetching ABI from Hardhat. at(address1); Is there another way to do it without including the whole abi of the Jun 18, 2021 · As the warning says, you are making a eth_call in an account with no code. Apr 27, 2017 · edited Apr 27, 2017 at 20:07. npm install. May 20, 2024 · If you want Hardhat to generate types for your smart contract you should install and use @typechain/hardhat. 01 - token 02 - someActionContract 02 - someActionContract is able to mint tokens, so it requires to know the address of a token to mint. If the contracts in your node_modules already contain compiled outputs (i. Feb 14, 2022 · Then to get the owner account's DAI balance I just called balanceOf() from the DAI contract: const DAI = new ethers. Jan 5, 2022 · You can take a look at the transaction that deployed the contract: this type of reverse engineering will probably allow you to deploy the same bytecode. We can use hardhat-ethers plugin's helper function ethers. Mar 15, 2022 · 3. OpenChainSignatureLookup(); And then run npx hardhat blockNumber to try it. Hardhat comes built-in with an interactive JavaScript console. deploy(); await xTokenWrapperContract. The Hardhat Abigen Plugin generates ABI (Application Binary Interface) files from smart contracts, making it easier to interact with contracts on the Ethereum blockchain. Contract(DAI_ADDRESS, ERC20ABI, provider); DAIBalance = await DAI. Initialize a Contract Web3. waitForDeployment(); Also notice in the console log statement that mynft. The contract is the same as the contract with the address0. In brownie there's a very handy syntax to avoid deploying multiple times the same contract on-chain, while developing and iterating fast: In this way it's easy to check whether there's a version of your contract already deployed, and if there is you just re-use it instead of going through deploying again. This repository contains a plugin for Hardhat, a popular Ethereum development environment. You can find the ABI at. balanceOf(owner. This includes the compiler settings, contract ABI, NatSpec contract documentation, and used source files and their hashes. Mar 2, 2022 · Fetching passed strongly typed logs emitted by the contract; To prepare the development environment: $ npm i 0xweb -g $ 0xweb init --hardhat $ npx hardhat compile --watch # compiles sol contracts and listens for changes to recompile Here is an example of reading/writing to an ERC20 contract: Artifacts in hardhat terminology represent a compiled contract (not yet deployed) with at least its bytecode and abi. eth. deployed() These lines are used to deploy a new smart contract to the Ethereum network. path to ABI export directory (relative to Hardhat root) '. These scripts must be run through Hardhat: npx hardhat run script. Duplicate of Getting a contract by address only (without ABI definition) and How do you get a json file (ABI) from a known contract address? – o0ragman0o. No timeline yet though. It enables you to define smart contract instances you want to deploy, and any operation you want to run on them. sendTransaction({ data: bytecode }) await txReceipt. g. npx Jan 21, 2021 · With npm : npm i -D @nomiclabs/hardhat-ethers@npm:hardhat-deploy-ethers. As an example, we will interact with the WEENUS token contract deployed on the Goerli testnet, but you can use any smart contract to interact with. Automatically verify contracts. deployContract("MyNFT"); await wallet. May 20, 2021 · As stated by the other answers, there are plenty of ways to generate the ABI and the bytecode for a smart contract. You can compile the smart contract and save the ABI and the bytcode. const signatureLookup = new whatsabi. By taking over the deployment and execution, Hardhat Ignition lets you focus on your project instead of getting caught up in the deployment details. getSigners() const txReceipt = await wallet. d. deploy(options) await contract. EVM: EVM is a piece of software responsible for executing smart contracts and computing the state of the Ethereum network. The Contract object uses a Contract's ABI to determine what methods are available, so the following sections describe the generic ways to interact with the properties added at run-time during the Contract constructor. Verify. 3. Oct 26, 2022 · Let's get started! Preparation. ts) based on ABI's, and it requires little to no configuration. Aug 5, 2023 · Basic understanding of Ethereum and smart contracts. " Hardhat is an Ethereum development environment. poolInfo(2); if the array length is more than 3 in this case of course. So if the variable you're using to store the contract info is counter. getContractAt("GLDToken", address) ( docs ) as we do in the above code snippet. This will be possible for contracts that register their metadata in Swarm. Here You can get details of smart contract like abi, bytecode, smart contract, opcode. Jun 3, 2024 · Hardhat Ignition is a declarative system for deploying smart contracts on Ethereum. Node. bytecode, deployer, ); xTokenWrapperContract = await XTokenWrapperFactory. under the metadata section, and there output you will see the ABI (json interface). target. waffle provides a deployMockContract method to create an instance of the contract that can be mocked, and then its functions can be mocked with <mocked-instance Jan 25, 2023 · Here's an example of interacting with the contract with the current version (0. js directly: new ethers. Sourcify takes full advantage of this May 24, 2021 · In short you'll be able to get basic type public member like this: let x = await contract. Feb 10, 2023 · A great package to use is hardhat-deploy, which creates deployment objects for each deployed contract. By this way, we need to get abi from the compile output (in artifacts directory). Hardhat Runner is the main component you interact with when using Hardhat. Data is encoded according to its type. The sample deploy script is already there for you. # or. After running the last command, npx hardhat, you will be Jul 20, 2021 · Conclusion. Interact with the contract functions using the Contract instance. An ABI is necessary so that you can specify which function in the contract to invoke, as well as get a guarantee that the function will return data in the format you are expecting. fb na jl we je tu up ho og jz