For unit testing purposes, I want to impersonate the DAI contract to transfer some DAI to a local wallet address in my local blockchain environment. I have followed the instructions on Hardhat's mainnet forking guide, but I'm not really sure what the following does:
const signer = await ethers.provider.getSigner("0x364d6D0333432C3Ac016Ca832fb8594A8cE43Ca6")
signer.sendTransaction(...) // what does this do?
What are the parameters within signer.sendTransaction()
, and is it only for sending Ether from one contract to another address? Can I make the impersonated DAI contract approve and transfer ETH from the DAI contract to a local wallet?
The purpose of this is for a local signer to be able to spend DAI to buy a special token minted by a ERC1155 contract I'm deploying. The only currency is DAI, and it is essential to increase the signer's balance for DAI to purchase that token.