2022 Developer Survey is open! Take survey.

New answers tagged

0 votes

Event listener firing multiple times

At first remove all listeners during unmount, contract.on('FallbackHit', (whoSent, amount) => { const text = `The fallback function was sent ${ethers.utils.formatUnits(amount, 18)} by ${...
user avatar
  • 21
0 votes

How to get the returned values in Solidity functions?

Your function is neither pure nor view so it returns transaction receipt instead of the return value. This function would return result: function addition(uint256 a, uint256 b) public ...
user avatar
  • 112
1 vote

How to get the returned values in Solidity functions?

I believe the problem you're describing is because you are trying to get a return variable from a function which is marked as non-static (not pure/view). Unfortunately, as far as I can tell, it's not ...
user avatar
  • 864
0 votes

How do I listen to Contract Events in my Express App?

I do not see you contract initialization, but take into account you need to use a web socket URL (wss://xxx) as Web3 provider. const web3 = new Web3(WSS_ENDPOINT); const contract = new web3.eth....
user avatar
  • 584
1 vote

How to decode event log info from contract?

For those who want to do it in a hard way, here is an example of Uniswap v2 PairCreated event: def decode_pair_created(log: LogResult) -> dict: """Process a pair created event. ...
user avatar
0 votes
Accepted

Use cases of anonymous events

At the low level all events are quite similar: an optional topics array with a maximum of 4 entries and a data array of arbitrary length. Topics are 32 bytes in length and they are indexed in the ...
user avatar
  • 29.3k
0 votes

What characters are allowed in event names?

ya, but u need to write unicode before string. e.g. // SPDX-License-Identifier: MIT pragma solidity ^0.8.4; contract aakash4dev{ string a=unicode"Hello 😃 sɪˈrɪlɪk"; function get() ...
user avatar
1 vote

What characters are allowed in event names?

An identifier in solidity has to start with a letter, a dollar-sign or an underscore and may additionally contain numbers after the first symbol. from https://docs.soliditylang.org/en/latest/grammar....
user avatar
0 votes
Accepted

Etherscan API get transaction status from getLogs api call

Reverted transactions don't have logs, so any transaction that has logs, must be a transaction that got mined and didn't revert. So status must be true for any transaction you receive from getLogs. ...
user avatar
  • 1,261
0 votes

How can I decode the event log I receive in my txn where there more than 1 smart contract involved and the emitted event cannot be found in ABI

You get empty array because in your abi missing the events abi. Try this: const abi = [ { "anonymous": false, "inputs": [ { "...
user avatar
1 vote

How can I decode the event log I receive in my txn where there more than 1 smart contract involved and the emitted event cannot be found in ABI

The ABI posted to Mumbai implementation contract is probably lacking. Take transaction 0x32e3230a7478315092a04ef57fc2426947ec5031c6977c7b184e7bcd02be9216 for instance, if you look at Mumbai Explorer ...
user avatar
  • 1,261
0 votes
Accepted

events can cause state change?

This answer might clarify it alongside this one. In essence, transactions receipts (containing the logs) are used to form the Transaction Receipt Trie, which will update the Transaction Receipts Root ...
user avatar
  • 4,949
0 votes

Reading Contract Events

You should read the documentation about (indexed) events. You can add the attribute indexed to up to three parameters which adds them to a special data structure known as “topics” instead of the data ...
user avatar
  • 4,949
0 votes

Best way to get notified when fallback arrived

You can create a custom event for the randomNumberConsumer contract that you can listen for in a client (such as a frontend or javascript client).
user avatar
  • 516

Top 50 recent answers are included