Questions tagged [events]

Solidity events and logging problems. Events allow the convenient usage of the EVM logging facilities, which in turn can be used to “call” JavaScript callbacks in the user interface of a dapp, which listen for these events.

Filter by
Sorted by
Tagged with
0
votes
1answer
7 views

Are events only useful for loggin purposes?

After reading a bit of documentation about events and reading some answers here, I don't really get why events are useful in solidity. Emit an "event" means to notify listeners about ...
0
votes
0answers
27 views

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

I have a Smart Contract rps. I want my express app to be able to listen to its events. My express app: require("dotenv").config(); const express = require("express"); const app = ...
1
vote
0answers
12 views

eth_getLogs and some missing logs

I have an indexing software that scans the blockchain for certain events. It works continuosly using eth_getLogs over my nodes. It works perfectly, but I'm seeing that sometimes I'm missing some ...
0
votes
0answers
8 views

getPastEvents OR filter across two parameters

Web3 allows one to filter events by indexed parameters (see here). For example: {filter: {myNumber: [12,13]}} would pull only events where “myNumber” is 12 or 13. Is it possible to filter across two ...
1
vote
1answer
15 views

Dealing with ethereum LOG1-2-3-4 opcodes: How to parse them correctly?

I'm trying to do some analysis of events from the opcodes of transactions, but I'm finding it very hard to understand how can I find the index_topics and the values returned by the event. For instance:...
0
votes
1answer
20 views

Getting specific values from Web3js getPastEvents

I would like to know how to pull the account value from returnValues: Result {} of this web3.eth.Contract This code logs to the console just fine, but I have scoured documentation on objects and on ...
0
votes
3answers
28 views

Best way to automatically update balances displayed in front end

Im trying to figure out the best way to automatically update balances in front end upon receiving and sending tokens. Ive tried creating an instance of a token in my react app, then creating an event ...
1
vote
1answer
252 views

Listen to events in the Polygon network using Web3.py

Just started looking at Web3 and I'm currently trying to listen for an event emitted by a smart contract on the Polygon network by using event_filter = contract.events.<MyEvent>.createFilter(...
1
vote
1answer
75 views

How much gas does it cost to emit an event?

How much gas does it cost to emit an event? Is there a formula for calculating how much gas the emission of an event will cost given that its parameters sum up to n bytes of data? Any info or ...
0
votes
1answer
31 views

Ethers.js transfer event filters

In my dapp I'm building I want to update the contracts' balance of an ERC20 token automatically using the transfer event from the token contract. I have created the contract object using: const ...
0
votes
0answers
44 views

How to get all addresses that have had successful transaction in the last polygon block?

I need to listen for special events on some contract addresses in Polygon/Matic blockchain; However, my provider has limitations on the number of possible subscriptions. So, I have to get all the ...
1
vote
0answers
8 views

Possible Security Issues On Web Layer Payment Request and Confirmation

This is more likely a design consultation rather than an issue. I want to introduce additional standards in ISO20022 to promote crypto payment through common payment interface to eliminate 3rd party ...
0
votes
1answer
76 views

Indexed events not returning values when decoded

I had asked this question but I omitted some info as I (wrongly) assumed that the omitted info was not part of my problem. When you emit an event like so: event ChildCreated(address indexed creator, ...
0
votes
0answers
30 views

Event not returning indexed parameters when decoded [duplicate]

EDIT: I had omitted some data from my code as I thought it was not the one causing the error turns out I was wrong. Here is the question with the appropriate data and solution. ..... Ignore the text ...
1
vote
1answer
108 views

The current provider doesn't support subscriptions: HDWalletProvider on Polygon (matic) blockchain

I use wss://rpc-mainnet.maticvigil.com/v1/MY-APP-ID as my polygon dApp provider, however I cannot subscribe on newBlockHeaders event with the following error: Error: The current provider doesn't ...
1
vote
0answers
33 views

How to detect mint event with EthersJS?

I'm try to detect when a dummy DAI token is minted to my smart contract on Mumbai. It appears that any Transfer event that comes from the 0x0 address is omitted from the logs? Am I doing something ...
0
votes
0answers
24 views

How to Decode Anonymous MakerDAO LogNote Events using Ethers

I'm trying to decode (anonymous LogNote) transaction logs created by the MakerDAO vat contract (https://etherscan.io/address/0x35D1b3F3D7966A1DFe207aa4514C12a259A0492B#code). // --- Logs --- event ...
0
votes
0answers
10 views

How to subscribe to events in brownie

I am having trouble subscribing to events with brownie. My interface is imported with from brownie import interface From there, I have access to the external methods but not the events. I have found ...
3
votes
3answers
164 views

Why can't smart contracts access events

Looking through posts here most refer to the doc saying that smart contracts can't access event data. The Log and its event data is not accessible from within contracts (not even from the contract ...
0
votes
0answers
44 views

How can I listen emitted events from BSC network

How can I noticed and get the results of events whenever events are emitted on BSC network. I have tried web3.on() method, but the on() method can work with WebSocketProvider and BSC network does not ...
0
votes
0answers
39 views

Detecting `accountsChanged` and `chainChanged` with ethersjs?

I'm not sure if this question makes sense or if I'm looking at things correctly but it's coming from my understanding that ethersjs is an abstraction on top of MetaMask (and other providers)... I've ...
0
votes
0answers
16 views

Truffle contract not receiving events after some time

In my nodejs app I'm using truffle to communicate with a ERC721 contract, mainly to receive events. All I'm doing is listening for when a Transfer event happens. But it only works for the first few ...
0
votes
1answer
30 views

How to get events from a contract deployed on different network? - Web3

I have contract A in Avalanche FUJI C-chain. When I'm on C-chain testnet, I can get events from A using getPastEvents() in web3.js, but when I change the testnet (for example, to Goerli), I receive an ...
2
votes
1answer
539 views

Ethers - get historical block.timestamp in batch mode

I am trying to build a simple database table containing block.number and block.timestamp starting at a given block number. This could be easily done with the following JS code using ethers.js library: ...
0
votes
1answer
15 views

Detect Function call or Transaction when no Event is Emitted

Is it possible to detect a contract function call using a listener, even though it does not explicitly emit an event? I want to think this is possible, because block explorers like Etherscan are able ...
0
votes
0answers
30 views

How to associate Transfer events with a Swap event?

Let's take this Transaction as an example. Here we have events: 287 Transfer 289 Transfer 291 Swap We can associate those two Transfer events with Swap event by looking at the sequence of events and ...
0
votes
0answers
72 views

go-ethereum: watching contract for events

I've been trying to get a go program going that monitors a smart contract for emitted events. I had found the amazingly written https://goethereumbook.org/event-read-erc20/ unfortunately it appears to ...
0
votes
1answer
14 views

Security considerations: using events to trigger offchain actions

I need to trigger a sensitive offchain action based on a users interaction with my smart contract. My current approach is to emit and event (Trigger(msg.sender, 123)) and then use a filterQuery with ...
0
votes
1answer
137 views

Is it possible for web3 to listen to contract function call ? (For example mint() for a NFT)

Hey I have read about listening to events in web3js and it worked. I have my abi set up and looked through all available events in it and mint(), what I use to mint nfts is a function which makes ...
0
votes
0answers
7 views

How to validate transfers?

As far as I understand, events associated with transactions are completely arbitrary pieces of data emitted by a contract, i.e. just because transaction event log says that a Transfer took place, ...
0
votes
1answer
24 views

Does solidity event only gets emitted when transaction successfully mined?

I have a transaction method call which sets a value and at the end I have emitted an event. Somewhere in web3 I am listening an events. What if the transaction took time to mine? Does event get ...
1
vote
1answer
67 views

TheGraph is not connecting to IPFS locally

I have a Graph local node set up using this tutorial. When I am trying to deploy it, its not going through with the following error message: Add file to IPFS build/schema.graphql ⠋ Upload subgraph to ...
0
votes
1answer
76 views

How to listend to ALL NFT smart contract events?

I would like log all NFT transfers happening on the blockchain. I know that there is a standard event in the ERC721 smart contract. I actually can subscribe to that event if I know the address of the ...
1
vote
0answers
63 views

Event name conflicts and data out-of-bounds error in Remix

I have been getting a weird errored: Error: data out-of-bounds (length=0, offset=32, code=BUFFER_OVERRUN, version=abi/5.1.2) error when testing contract functions in Remix, even though it goes through ...
0
votes
0answers
12 views

How to get List of Etherscan Lable for each contract address and identify contract transfer token event

I use Etherscan API to get list of ERC20 tranfer token event of a specified address, but I want to get transactions which are sent FROM Uniswap or contract symbol address like this, but I don't know ...
0
votes
1answer
72 views

Obtain transaction hash from event (ethersjs)

My goal is to detect a contract invocation as fast as humanly possible. To do this I am processing all the pending transactions I have access to (via provider.on("pending", async (tx) => {...
0
votes
0answers
43 views

Best way to replay (and track) blockchain to build own indices. Is it hooking into web3.eth.subscribe('logs',..)?

As a nice project to get my hands dirty with Web3 I want to attempt to build something like poocoin which shows historic OHLCV candles for BEP-20 tokens. To this end I want to replay the entire ...
0
votes
0answers
34 views

Get new data after the events.Swap()

here is the code: await SWAP_CONTRACT.events.Swap({}) .on('data', async function(event){ console.log(event) await changeListenPair(); }) .on('changed', async function(event)...
0
votes
0answers
9 views

How to search for event in when an input should be the 5th topic in event

I want to query an ERC1155 token event where I know the token Id, there only can be 4 topics and tokenId would be the fifth,which means it's not an indexed input and goes to the data part. How can I ...
1
vote
0answers
132 views

How to manually interpret balance change after custom Events using web3.py

Context I am trying to build my own Ethereum explorer. I know this already exists on Etherscan out-of-the-box but the features that I want are either rate-limited or not even provided via its API. To ...
1
vote
1answer
61 views

OpenZeppelin test helper: expectEvent.inTransaction error

I'm trying to use OZ Test helpers to pass a test when a specific event is emitted. Here is the logic: I call function1 with a JS Promise. function1 calls function2 which emits an event. Parts of ...
0
votes
0answers
20 views

GetPastEvents and string topic - Error: invalid argument 0: hex has invalid length 160 after decoding; expected 32 for topic

Being "token" below a contract instance, i do: token.getPastEvents('OperationEvent', {fromBlock:68000000, filter: {productId: '...
2
votes
0answers
11 views

can i use events as persisnt storage? [duplicate]

I'm building an application that is a mix of the blockchain and a centralized app. I need some way for the systems to communicate with each other, for example. Let's say you can buy some digital asset ...
0
votes
0answers
19 views

Multisender.app transactions aren't emitting transfer events for Ampleforth

I am trying to collate the whole of Ampleforth's transaction history. To do this I was grabbing the transfer events every 1000 blocks since Ampleforth's inception. In doing this I noticed that some ...
1
vote
2answers
34 views

Is it possible to subscribe to the same event, but in multiple contracts at the same time?

Let's say we have 1000 contracts with the same type of event 'Event'. I can subscribe to each one of them individually using contract.listen('Event'), but I cannot use this if I want to create a ...
1
vote
0answers
27 views

Web3.py filter.get_new_entries() returns nothing if over 10 events have been emitted?

I'm using the following loop to try and add the metadata for tokens generated in my own smart contract, it all works exactly as intended when I am generating up to 9 "bots" at a time, but as ...
1
vote
1answer
142 views

web3.getPastEvents return events but can't subscribe to an event

I have a contract which has an event. The contract's code is pretty simple: pragma solidity >=0.7.4; import "./Crowdfunding.sol"; contract Factory { address[] public ...
0
votes
0answers
30 views

Send web3js event to webhook when it happens

I have a transfer method that transfers a token using the deployed smart contract in Web3JS. I have to return the values to the customer, so I subscribe to the transfer event and wait for it to ...
0
votes
0answers
25 views

How to get data from earlier blocks in ethereum BC via web3.py?

I am trying to get data from earlier blocks/transactions. I have created events and emitted them. I can see the logs in the Remix IDE. However, I cannot get the logs in web3.py. It only returns empty. ...
1
vote
1answer
61 views

Does a failing `require` condition cause emitted events to be reverted too?

Consider the following contrived contract function: function submitOffer(uint256 foo) public payable { emit MyEvent(foo); // then later... require(foo > 10, "Foo must be greater ...

1
2 3 4 5
13