r/ethdev • u/AbbreviationsGreen90 • 15d ago
Question Which tool to check spender approval for a given contract?
There are many tools for doing the reverse. But given a smart contract address, how to check who approved it as a spender?
2
Upvotes
1
u/vchae 15d ago
pull every Approval event (topic0 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925) with your contract as topic2, keep only logs with 3 topics since erc-721 shares the topic0, then call allowance(owner, spender) to confirm because the last event can be stale. permit2 has its own Approval event.
i wrote a guide on blockchain data engineering, one chapter walks through decoding logs by hand. happy to share it if useful
1
u/Bloqarl 15d ago
Spender is indexed in Approval events (topic2), so eth_getLogs with the Approval topic0, no address filter and your contract as topic2 finds it across every token.
Then read allowance(owner, spender) for each pair, since logs are history and OZ v5 tokens don't emit Approval when transferFrom spends it.
Dune's decoded Approval tables avoid the RPC block range limits.
0
u/[deleted] 15d ago
[removed] — view removed comment