ApprovalGuardian

Prize winner, Chainlink CRE Hackathon

what it is

Using a DeFi protocol means granting it an ERC-20 approval, which is permission to spend your tokens. Most users approve unlimited amounts and forget about them. When a protocol is exploited, attackers can drain those approved wallets within seconds, faster than a person can react.

ApprovalGuardian automates the response. A user registers a wallet and picks a sensitivity level (conservative, moderate or aggressive) and a scan schedule from a configuration dashboard, anywhere from every minute to once a day.

The system then scans registered wallets across Ethereum, Arbitrum and Base for open approvals to known threat contracts, and watches monitored protocols for Paused and LargeDrain events. When one fires, it scores the threat and sends an alert.

If the threat score crosses the user's threshold, every open approval to the affected contract is revoked on-chain by setting its allowance to zero, with no manual step and no private key held on a server.

how it's made

The project is built on three Chainlink CRE (Chainlink Runtime Environment) workflows and was tested on Tenderly Virtual TestNets.

  • Approval scanner: a cron workflow that scans registered wallets for approvals to known threat contracts
  • Threat monitor: triggered by Paused and LargeDrain event logs. Each node in the oracle network independently fetches TVL data from DefiLlama, calls paused on the contract, decodes the event and computes its own threat score. The scores are combined with median aggregation, so a single compromised node cannot set the outcome. TVL drops of more than 20% and 50% feed the score.
  • Revocation: finds every open approval to the threat contract, builds a report signed by the oracle network, and submits it with writeReport through the CRE Forwarder

The ApprovalGuardian Solidity contract extends CRE's ReceiverTemplate and accepts reports only from the forwarder. On a valid report it calls guardianRevokeApproval to zero the allowance. Supabase is used for storage.