{"id":21429748,"url":"https://github.com/limechain/forta-flashloan-detector","last_synced_at":"2025-07-14T11:30:53.402Z","repository":{"id":57686382,"uuid":"475339666","full_name":"LimeChain/forta-flashloan-detector","owner":"LimeChain","description":"A library for Forta agents that detects if a transaction event contains a flashloan","archived":false,"fork":false,"pushed_at":"2022-03-30T07:21:26.000Z","size":128,"stargazers_count":2,"open_issues_count":0,"forks_count":3,"subscribers_count":6,"default_branch":"main","last_synced_at":"2024-10-31T15:52:52.025Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LimeChain.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-03-29T07:59:42.000Z","updated_at":"2023-11-08T15:00:27.000Z","dependencies_parsed_at":"2022-09-19T08:24:31.324Z","dependency_job_id":null,"html_url":"https://github.com/LimeChain/forta-flashloan-detector","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LimeChain%2Fforta-flashloan-detector","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LimeChain%2Fforta-flashloan-detector/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LimeChain%2Fforta-flashloan-detector/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LimeChain%2Fforta-flashloan-detector/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LimeChain","download_url":"https://codeload.github.com/LimeChain/forta-flashloan-detector/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225971582,"owners_count":17553522,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-22T22:19:03.124Z","updated_at":"2024-11-22T22:19:03.630Z","avatar_url":"https://github.com/LimeChain.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# forta-flashloan-detector\n\nThe forta-flashloan-detector library checks if a transaction contains a flashloan.\nIt currently supports only the Ethereum network and supports these protocols:\n - Aave\n - dYdX\n - Euler\n - Iron Bank\n - MakerDAO\n\n## Dependencies\n\nThis package depends on the `forta-agent` package.\n\n\n## Installation\n\nUse the node package manager npm to add the library to your project:\n\n```\n$ npm install forta-flashloan-detector\n```\n\n## Usage\n\nImport the forta-flashloan-detector library into a JavaScript file like this:\n\n```js\nconst FlashloanDetector = require('forta-flashloan-detector');\n```\n\nSpecify the protocols you want to support (If you don't specify any protocols the detector will support all):\n\n```js\nconst flashloanDetector = new FlashloanDetector(['aave', 'maker']);\n```\n\nCall the `init` function to fetch dynamically markets for some of the protocols (Currently needed for Iron Bank)\n\n```js\nawait flashloanDetector.init();\n```\n\n### Examples\n\n```js\nconst flashloanDetector = new FlashloanDetector(['aave', 'maker']);\n\nconst initialize = async () =\u003e {\n  await flashloanDetector.init();\n};\n\nconst handleTransaction = async (txEvent) =\u003e {\n  const findings = [];\n\n  const flashloanProtocols = flashloanDetector.getFlashloans(txEvent);\n\n  if (flashloanProtocols.length \u003e 0) {\n      findings.push(createAlert(flashloanProtocols));\n  }\n\n  return findings;\n}\n```\n\n### Test Data\n\n - Aave flashloan tx: `0xeda125ef4a0d59be543ecb90b9d66ce606593497d8e8cfc5933822e8b6527c82`\n - dYdX flashloan tx: `0xfcd0564b16592a6168ca0a906f7781182a071aa30f7eb9d67dbce42f6a358db9`\n - Euler flashloan tx: `0x1eddb00425ba62dea460825967583b8dd4ec239d6c68c25c49025304161682b6`\n - Iron Bank flashloan tx: `0x891e70b9e4201c6f481c07054bad88e7c11c946535c20b96e1920e876b1fd0b0`\n - MakerDAO flashloan tx: `0x291fbea2843e188c2997a00e35c9a4340e736215572c2fb57935db3366789106`\n\nYou can use the `npm run tx` command to test the agent:\n\n```js\nnpm run tx 0xeda125ef4a0d59be543ecb90b9d66ce606593497d8e8cfc5933822e8b6527c82,0xfcd0564b16592a6168ca0a906f7781182a071aa30f7eb9d67dbce42f6a358db9,0x1eddb00425ba62dea460825967583b8dd4ec239d6c68c25c49025304161682b6,0x891e70b9e4201c6f481c07054bad88e7c11c946535c20b96e1920e876b1fd0b0,0x291fbea2843e188c2997a00e35c9a4340e736215572c2fb57935db3366789106\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flimechain%2Fforta-flashloan-detector","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flimechain%2Fforta-flashloan-detector","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flimechain%2Fforta-flashloan-detector/lists"}