I'm using hardhat
and have deployed some contracts. That's created a directory deployments
which containes meta data of the deployed smart contracts. Is it called artifacts
?
Now, via the library ethers.js, I want to instantiate those contracts and interract with them. The contracts are on ronkeby
.
I've able to find small pieces, some in web3.js
and some in ethers.js
and it's been confusing.
How to do it?
Here's a part of those contracts from ./deployments/rinkeby/MyContract123.json
{
"address": "0x<12345>",
"abi": [
{
"inputs": [
{
"internalType": "address",
"name": "_factory",
"type": "address"
},
{
"internalType":
//.............
"transactionHash": "0x<some data....>",
"receipt": {
//.....
},
"args": [
"0x<some data....>",
"0x<some data....>"
],
"solcInputHash": "<some data....>",
"metadata": "....",
"bytecode": "...",
"deployedBytecode": "....",
"devdoc": {
},
"userdoc": {
},
"storageLayout": {
}
}
How can I read the ABI of this contract and instantiate it, to be then able to interract with it?