New answers tagged

0

In order to display accounts with Metamask first you have to prompt the user to allow the application to have access to the accounts. Check https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1102.md Look for window.ethereum and if it's presented call window.ethereum.enable() and after that is resolved, you will be able to access the accounts.


0

Yes, i’m pretty sure it comes from the fact that my Crowdsale contract have no supply has you said. I was expecting to do the transfer from the Token.sol Smartcontract, but in fact, i need to do it in the Test script ? So i can’t make it an automatism ? I will need to transfer manually the supply from the token to the crowdsale after their deployments ? ...


0

Yes as mentioned by @Masoud answer. You can however avoid it by either manually passing for each transaction the option { gasPrice: 0 }. Or you can set the defaults for a contract to use a gas price of 0: MyContract.defaults({ gasPrice: 0, }) Then your tests consume in fact no gas.


0

It depends on your test. if your test contains transaction ( which is used by using .send() ), Yes you are using gas and ether from your local client. and in order to test and see the Ether inside the account you can do this : let balance = await web3.eth.getBalance(accounts[0]); console.log(balance); Make sure you have extracted your account before, with ...


0

Your crowdsale contract has no tokens to transfer to the buyer. You transfer ownership of the Token Contract in your test file, but the total supply is still in control of the Token Contract deployer address . From the looks of it should be your account[0]. After both your contract have been instantiated, you will need to do something like: await this....


1

Thanks, @Ismael I got the solution. I changed my constructor as this: constructor(address payable _acc1,address payable _acc2) public { addBank("Bank A", _acc1); addBank("Bank B", _acc2); } and in migrations/2_deploy_contracts.js as this: var kyc = artifacts.require("./kyc.sol"); var accounts=web3.eth.getAccounts(); module.exports = ...


0

The address is actually unlocked but doesn't have enough ETH. So I need to send a tx to fund the address. I think -e 1000000 will also fund the unlock address but actually it will not and that' my mistake.


Top 50 recent answers are included