Closed humanwhoexplores closed 3 years ago
All the accounts we got from Test Script are [ '0x104c8a95A4c65757EB8A1747C1eAC04F041A8332', '0xc8cc6718bF382Ebd23CD48D8550d88894BAeD896', '0xa7fF9DE42711152Bb5dFDFD56242B3059b086Ad4', '0x5A1be85250f9c564129FE117010b306BE13875B8', '0x6f074972242A7714e4412ac1Fd510d2bc17Dc2f0', '0x00c021725Ba17F881172Ee78dc0317B9F4b67655', '0xD2C8B80eE4032643887AA3313dd84E2F42280770', '0xD1c68E1B7cE68864cAaff176BdB757F48a750DF1', '0xd7e66d4E3af1b9262E1b553C649c13Cb142aB64c', '0xAA5DA16327638e9a2b49B32030b695384Ec0C7B7' ]
The code uses accounts[0] , which is "0x104c8a95A4c65757EB8A1747C1eAC04F041A8332"
to deploy the contract
curiosity killed the cat : Can you find the balance in this account :-
Why not. here it is
`beforeEach(async () => { // beforeEach runs before running each test // Get a list of all accounts accounts = await web3.eth.getAccounts();
inbox = await new web3.eth.Contract(JSON.parse(interface))
.deploy({data : bytecode, arguments: ['Inbox contract']})
.send({from: accounts[0], gas: '1000000'})
let balance = await web3.eth.getBalance(accounts[0]);
console.log("The balance is ", balance);
});`
OUTPUT The balance is 99998661280000000000
`beforeEach(async () => { // beforeEach runs before running each test // Get a list of all accounts accounts = await web3.eth.getAccounts();
});`
See this code in the :- Inbox.test.js : Dude the flow is It picks the one of the addresses as provided by 'Test Library' It then uses that address to deploy the contrtact Phew !!