I need to create contracts from various accounts in a Truffle JS Test. To do so, I set:
let accounts = await web3.eth.getAccounts();
MyContract.web3.from = accounts[9];
Before creating my contract instance via:
let myContract = await MyContract.new("constructor argument");
However, the contract is still deployed by account 0 (accounts[0]
).
How can I specify that that instance of MyContract
shall be created using account 9?
I'm also interested in then calling functions of that contract using various accounts, so it's not just about deploying a contract using a specific account.