Skip to content

Comments

Trap 2 for DoraHacks AVS Hackathon submission#10

Open
surbhit14 wants to merge 5 commits intodrosera-network:mainfrom
surbhit14:compund-uni-trap
Open

Trap 2 for DoraHacks AVS Hackathon submission#10
surbhit14 wants to merge 5 commits intodrosera-network:mainfrom
surbhit14:compund-uni-trap

Conversation

@surbhit14
Copy link

Compound Uni Trap

This is a trap for the Compund Uni exploit
This contract leverages price feeds from various sources to identify discrepancies that could indicate manipulation attempts

Running the Examples

forge test

Results

Ran 1 test for test/CompoundUniTrapTest.t.sol:CompoundUniTrapTest
[PASS] testContinuousMonitoring() (gas: 154422)
Logs:
  Setting for block number:  19290918
  Setting for block number:  19290919
  Setting for block number:  19290920
  Setting for block number:  19290921
  Setting for block number:  19290922
  Setting for block number:  19290923
  Setting for block number:  19290924
  Setting for block number:  19290925
  Setting for block number:  19290926
  Setting for block number:  19290927
  Block Number: 19290918
  Price from chainlink:  9474361440000000000
  Price from uniswap:  8340000000000000000
  Difference is:  1134361440000000000
  Deviation is:  11
  Block Number: 19290919
  Price from chainlink:  9713000000000000000
  Price from uniswap:  8340000000000000000
  Difference is:  1373000000000000000
  Deviation is:  14
  Block Number: 19290920
  Price from chainlink:  9713000000000000000
  Price from uniswap:  8340000000000000000
  Difference is:  1373000000000000000
  Deviation is:  14
  Block Number: 19290921
  Price from chainlink:  10158692020000000000
  Price from uniswap:  8340000000000000000
  Difference is:  1818692020000000000
  Deviation is:  17
  Price deviation detected at block:  19290921
Suite result: ok. 1 passed; 0 failed; 0 skipped; finished in 11.70s (15.68ms CPU time)

How the Trap Works

  1. Data Collection:

    • The trap contract fetches the price of UNI tokens from various reliable sources, such as Chainlink, to get accurate price feeds.
  2. Validation:

    • The fetched price data is compared to detect any significant discrepancies. If a substantial difference is identified, it suggests potential price manipulation.
  3. Response:

    • Upon detecting a price discrepancy, the trap contract triggers measures to halt or mitigate the exploit, protecting the protocol from further damage.

Defi Lab Source

Summary

The Compound UNI Exploit Trap provides a robust mechanism to detect and mitigate exploits targeting the Compound protocol. By monitoring price feeds from multiple sources and comparing them, the trap contract can identify potential manipulation attempts and take immediate action to protect the protocol.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant