I'm trying to detect the creation of new ERC20 tokens. My current idea is to scan all transactions in a block, and look for transactions where the "to" address is null. This is normally contract creation transactions.
The problem that I'm having currently is how to get the newly created contract address from the contract creation transaction details? If I can get the newly created contract address, I can then check if the contract adheres to ERC20 standard and then parse it as ERC20 contract.
I normally get transaction details using the following code:
let tx = await web3.eth.getTransaction('0x46af5890c8ab51af8eeba255ad920f74e258218bdfd28951b6795fb0afa61ee6');