New answers tagged

0

The fix is to refactor you code to make it smaller. You could reduce the code size by using Struct and libraries that act as external storage and help reduce the overall size of the contract. You can also encode your data to pass only one argument to the function, This will make your function smaller. In other words, your contract is to big.


0

You have to enable optimisation if you face such error at time of compilation,This will help you hope so! Try to select run as 200 and optimisation enabled


0

web3 is no longer available from MetaMask and you have to use the ethereum object to call personal_sign: const message = "Hello from Ethereum Stack Exchange!"; const accounts = await ethereum.request({ method: 'eth_requestAccounts' }); const account = accounts[0]; const signature = await ethereum.request({ method: 'personal_sign', params: [ message,...


1

1000148245 is a representation in wei. To display amount in UI, you can divide it using 1018. In ethers.js there is a method that helps you do that: import { ethers } from 'ethers'; ethers.utils.formatEther('1000148245'); // gives "0.000000001000148245"


0

that is not neither a view or a pure function, so you probably are looking for something like this (check here for documentation): let tx = await contract.mintToken(to, address).send({from: '0x123123123123'}); let events = tx.receipt.events console.log(events)


0

I found that putting the --save at the end of the command worked for me. having it in the middle did not work. npm install ethereumjs-wallet@0.6.5 --save


0

This issue has been resolved. @ethereumjs/common should be imported as default like below. const Common = require('@ethereumjs/common').default;


0

you can use Infura services. infura provide the web3. first you have to create acc in infura after that you should make project. and at least you can use your own Id in this code : web3 = new Web3(new Web3.providers.HttpProvider("https://ropsten.infura.io/v3/3c68ea1...your ID...f301753")); also you can use main net or ropsten network. please check ...


0

You have to respect the constructor when you are deploying your contract. I recommend you to read this for remix: https://remix-ide.readthedocs.io/en/latest/create_deploy.html Since the deployment is the creation of the instance of your class, all the parameters defined must be presented, in this case you are expecting string memory _titel, string memory ...


0

if someone only send ERC-20 token to the address and no etherum, then how I'll get ethereum to pay as gas fee to transfer the received ERC-20 token to cold wallet You buy ETH and deposit it on the address needing ETH. means if 10000 users do the same thing at the same time, will not it create a problem ? or is there any better solution for this ? Yes. ...


0

Solidity doesn't read external files. if you want to add a list of voters provide them using arrays. For example : function addVotersList(string[] calldata _names,uint[] calldata _ids , address[] calldata _voters)public { for (uint i = 0; i < _names.length; i++) { ...


0

You can't send a file to the function. But if you want to get done all of the process with one click, you can use arrays. function addVotersList(string[] calldata name,uint[] calldata id , address[] calldata voter) external I changed function visibility. Because if you are getting arrays in your paramaters, external very much gas saver. And I added calldata ...


0

BN will not accept decimal point numbers. You can do as follows: var decimals = 12; var value = (0.001*(10**decimals)).toString(); var amount = web3.utils.toBN(value); Hope this helps


Top 50 recent answers are included