{"id":22873963,"url":"https://github.com/angleprotocol/merkl-dispute","last_synced_at":"2025-05-06T19:11:50.815Z","repository":{"id":200536303,"uuid":"667343447","full_name":"AngleProtocol/merkl-dispute","owner":"AngleProtocol","description":null,"archived":false,"fork":false,"pushed_at":"2024-06-06T09:30:31.000Z","size":1078,"stargazers_count":1,"open_issues_count":1,"forks_count":2,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-06-06T11:03:31.430Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AngleProtocol.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-07-17T09:40:58.000Z","updated_at":"2024-06-06T09:30:35.000Z","dependencies_parsed_at":"2024-02-16T17:48:19.662Z","dependency_job_id":"09fce5db-d001-41ce-8017-be5669c92652","html_url":"https://github.com/AngleProtocol/merkl-dispute","commit_stats":null,"previous_names":["angleprotocol/merkl-dispute"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AngleProtocol%2Fmerkl-dispute","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AngleProtocol%2Fmerkl-dispute/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AngleProtocol%2Fmerkl-dispute/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AngleProtocol%2Fmerkl-dispute/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AngleProtocol","download_url":"https://codeload.github.com/AngleProtocol/merkl-dispute/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":229556399,"owners_count":18091753,"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-12-13T14:32:07.857Z","updated_at":"2024-12-13T14:32:08.560Z","avatar_url":"https://github.com/AngleProtocol.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Merkl Dispute bot\n\n## How does it work?\n\nThe bot runs when a dispute period is ongoing and checks if the merkle root submitted on chain is correct.\nIf the data is incorrect or it is unable to fetch enough data to be able to make the checks, it will send a dispute.\n\n![image](./docs/bot-decision-tree.png)\n\n## What is a dispute ?\n\nA dispute is a halt of the merkl root update on the contract, which allows the DAO to come in and resolve the conflict.\nThis mechanism can prevent a malicious or accidental update of the new reward data which might be invalid.\n\n![image](./docs/dispute-process.png)\n\n## Pre-requisites\n\nYou must provide some necessary environment variables (see [.env.example](./.env.example)):\n\n```env\nPORT= 5002\nENV= 'prod'\n\nCHAINID= 1\nDISPUTE_BOT_PRIVATE_KEY= \"\"\nPROVIDER_137= \"\"\nPROVIDER_10= \"\"\nPROVIDER_1= \"\"\nPROVIDER_42161= \"\"\nPROVIDER_1101= \"\"\n```\n\n## Run the bot\n\nInstall the dependencies and build the bot:\n\n```bash\nyarn install\nyarn build\n```\n\n```bash\nyarn bot diff --chain 1 --from 1695734659 --to 1695821059 --gist\n```\n\n### Every n seconds\n\nRun the bot periodically (recommended interval is 1 hour):\n\n```bash\nyarn bot watch --chain \u003cchainId\u003e --time \u003ctimeIntervalInSeconds\u003e\n```\n\n### As a one-time check\n\nYou can also run the bot once to try to dispute the latest block or check the bot against a previous block:\n\n```bash\nyarn bot run --chain \u003cchainId\u003e\nyarn bot run --chain \u003cchainId\u003e --block \u003cblockNumber\u003e\n```\n\n### Compare two points in time\n\nYou can compare two points in time and generate a diff table, using `--gist` requires `KEEPER_GITHUB_AUTH_TOKEN` env variable.\n\n```bash\nyarn bot diff --chain \u003cchainId\u003e --from \u003ctimestamp1\u003e --to \u003ctimestamp1\u003e\nyarn bot diff --chain \u003cchainId\u003e --from \u003ctimestamp1\u003e --to \u003ctimestamp1\u003e --gist\n```\n\n### As a server\n\nRun the bot as an Express server to call a dispute check from an HTTP request:\n\n```bash\nyarn bot serve\n```\n\n`chain` and `blockNumber` parameters are optional, if not provided, the chain will be set from the environement variable `CHAINID`, the blockNumber as the latest one.\n\n```http\nGET http://localhost:5002/\nGET http://localhost:5002/\u003cchainId\u003e/\nGET http://localhost:5002/\u003cchainId\u003e/\u003cblockNumber\u003e\n```\n\n## Optional logging tools\n\nThe bot supports Discord logging and gist creation for the diff tables, enable those features by providing env variables `DISCORD_TOKEN`, `DISCORD_LOG_CHANNEL`, `DISCORD_ALERT_CHANNEL` and `KEEPER_GITHUB_AUTH_TOKEN` respectively.\n\n![image](./docs/discord-logging.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fangleprotocol%2Fmerkl-dispute","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fangleprotocol%2Fmerkl-dispute","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fangleprotocol%2Fmerkl-dispute/lists"}