New answers tagged

0

You can't compile ABI. The error is because the Solidity compiler is expecting to see Solidity code, but instead it's seeing something else (JSON).


0

You can console log with Solidity in development! Just create an event for your contract that takes a string as an argument. Then fire that event anywhere you want in your contract code. You'll be able to follow the flow of the contract from looking at the events that are recorded along with the transaction. If you need to see a numeric value / address, ...


-1

Change the solidity version your are using. Change the first line of your solidity file to this pragma solidity >0.4.2;


0

Try this mysmartContract.getPastEvents('numberSaved', { fromBlock: 0, toBlock: 'latest' }, function(error, events){ console.log(events); }) .then(function(events){ console.log(events) // same results as the optional callback above }); Actually, I took the example from Web3 docs.


2

The value is actually returned, but we just don't have a way to get it with web3 libraries yet. Think about it: how can your client get the return value if it has no clue when or if the transaction will be included in a block. Luckily for you, there's a solution. It's called "Events", check it out: https://solidity.readthedocs.io/en/v0.5.10/structure-of-a-...


2

Let's suppose you have a raffle and can reserve a number contract Raffle { mapping(uint256 => address) reserved; event Reserved(uint256 value, address owner); function reserve(uint256 value) public { require(reserved[value] == address(0), "Already reserved"); reserved[value] = msg.sender; emit Reserved(value, msg....


2

You can modify the AST and generate new source code from the AST using this tool: https://github.com/chao-peng/SIF


0

Truffle has a debug command that lets you move through your source code. It is not quite easy to use, but still, it is a debug option. See https://www.trufflesuite.com/docs/truffle/getting-started/debugging-your-contracts


0

There you go: const Web3 = require("web3"); const signature = Web3.utils.keccak256("Transfer(address,address,uint256)"); Tested with web3 v1.0.0-beta.34.


1

Calling transferFrom triggers a Transfer event. If you use open zeppelin then it also triggers an Approval event. There is not a tranferFrom event in the ERC20 standard. Hope this helps.


0

As you define the input parameter to be bytes32, the function expects a specific length of bytes to be valid. You would need to pad your input to 32 bytes. E.g. id = '0xabca00000000000000000000000000'; shall be id = '0xabca000000000000000000000000000000000000000000000000000000000000';


0

Commenting out the check is the cause of the failure. activeChild doesn't become a valid instance until later. activeChild = newChild; But this line seems to be trying to deactivate a predecessor. How can that work if there is no predecessor? activeChild.activate(false) On the first run, there will be no previous activeChild, so it is important to ...


Top 50 recent answers are included