Hello.
Please provide me with correct code for EthersJs library.
Am I right with this example:
await Moralis.start({moralisSecret});
const ethers = Moralis.web3Library;
const daiAddress = "dai.tokens.ethers.eth";
const daiAbi = [
"function name() view returns (string)",
"function symbol() view returns (string)",
"function balanceOf(address) view returns (uint)",
"function transfer(address to, uint amount)",
"event Transfer(address indexed from, address indexed to, uint amount)",
];
const daiContract = new ethers.Contract(daiAddress, daiAbi);
or I need use:
const daiContract = new ethers.Contract(daiAddress, daiAbi, provider);
What is provider in this case?
Or provider in this case (not common):
const provider = await Moralis.enableWeb3();
and correct code is:
await Moralis.start({moralisSecret});
const provider = await Moralis.enableWeb3();
const ethers = Moralis.web3Library;
const daiAddress = "dai.tokens.ethers.eth";
const daiAbi = [
"function name() view returns (string)",
"function symbol() view returns (string)",
"function balanceOf(address) view returns (uint)",
"function transfer(address to, uint amount)",
"event Transfer(address indexed from, address indexed to, uint amount)",
];
const daiContract = new ethers.Contract(daiAddress, daiAbi, provider);
Thanks.