This programs prints swap events information from the Uniswap USDC/DAI protocol. In case a block reorganization of the last 5 blocks takes place the program stops automatically.
- Creates an
.env
file in the main folder with a valid Infura web sockets endpoint, e.g:
INFURA_WSS_ENDPOINT=wss://mainnet.infura.io/ws/v3/<INFURA_KEY>
- Build the project
cargo build
- Check the unit tests pass:
cargo test
- Run the main program:
cargo run
You will see in the console the current block numbers and hashes, as well as for the current block number - 5. The programs prints swap log events that happened in not reorganized blocks (current block number - 5).