Hot answers tagged

1

See the example below Warning from Remix: Experimental features are turned on. Do not use experimental features on live deployments. pragma solidity ^0.5.12; // Enable the ABI v2 Coder pragma experimental ABIEncoderV2; contract AbiTwoTest { struct Item { string str; uint num; bool bol; } struct Arg { Item[]...


1

I see you modified the question after several valid/correct answers: Question is: how to invoke GenNextID like a regular function, that is: call to this function mutates internal state it returns result returned from the contract's code YOU DON'T You either mutate the state and get a receipt, or you get a response but you don't mutate the ...


1

Try this: let myContract = await MyContract.new("constructor argument", {from: accounts[9]}); Same thing for calling functions of that contract using various accounts. You can use that object argument in order to specify various transaction details such as from, value, gas and gasPrice. It is optional (i.e., assigned default values if not specified ...


1

If you're using Truffle 4.x, then you can patch their source code as follows: Step 1 - open file: /node_modules/truffle/build/cli.bundled.js Step 2 - search for: dir.files(config.test_directory, callback); Step 3 - replace it with: dir.files(config.test_directory, (x, y) => callback(x, y.filter(f => !f.includes(".#"))));


1

No no no. The accepted answer above is incorrect, and the fact that you've accepted it means that not many users will even read your question (let alone try to answer it). The integer value of 1000000000000000000 is indeed larger than Number.MAX_SAFE_INTEGER, and you should therefore use "1000000000000000000" or "1e18". But that's not what the error ...


1

There is no need to hardcode a private key or import a dependency. The accounts supplied by truffle+ganache are accessible in the web3.eth provider. You can use web3.eth.sign to sign arbitrary data. It will hash the data using keccak256 and sign the hash. It is async so you have to await it, and it returns the 65-byte signature. const sig = await web3.eth....


Only top voted, non community-wiki answers of a minimum length are eligible