Basically I need to use DAI stablecoin in my contract. I want to test it out so I have copied the DAI smart contract code and deployed it on my localhost. Everything works fine, but I can't write Hardhat tests to my code, because it doesn't know about the contract deployed on my localhost. How should I write the tests when using another contract in my contract?
address daiContractAddress = 0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0; // HOW TO GET THIS TO HARDHAT TESTS?
function getDaiBalanceForOwner() external view returns(uint){
IERC20 dai = IERC20(address(daiContractAddress ));
return dai.balanceOf(msg.sender); //Error: Transaction reverted: function call to a non-contract account
}
factory.at(addr)
if I remember rightbeforeEach
cyclebeforeEach
and then passing it into the original contract constructor?