I recently started learning to use hardhat to interact with and deploy smart contracts and I noticed that while brownie can accept a from
address field for chain transactions, hardhat doesn't.
- Does hardhat automatically supply this based on the address that deployed the transaction?
- How do I call a transaction with a different address using hardhat?
E.g, Barebone code to deploy a Box
contract and call a function store
which accepts an integer:
Brownie
to deploy
box = Box.deploy({"from": account})
to create a tx
box_tx = box.store(42, {"from": account})
from account here*
hardhat
- to deploy
const box = await deploy("Box", {
from: account,
args: [],
});
- to create a tx
const boxTx = await box.store(42)
No from account here*, how do we add an account?