how can I interact with interfaces through hardhat.
For example in brownie you can just call function from an interface like this:
def main():
weth = interface.IWeth("weth_address")
tx = weth.deposit({"from": account, "value": "value"})
and that's it.
Is there a way to do the same in hardhat? I've been siting on this problem for couple of hours and for the life of me I can't figure out how to do this.
If it's not possible how do I get weth through solidity.
In hardhat, you can achieve it using the attachment.
npx hardhat console
factory = await ethers.getContractFactory('YourContractName')
weth = await factory.attach('weth_address')
signer = await ethers.getSigner();
await signer.sendTransaction({ to: tokenAddress, value: ethers.utils.parseEther("5.0") });