{"id":13680384,"url":"https://github.com/ora-io/marine","last_synced_at":"2025-05-05T02:44:39.869Z","repository":{"id":199212580,"uuid":"702334853","full_name":"ora-io/Marine","owner":"ora-io","description":"Trustless Liquidation Keeper with zkGraph for Compound Protocol","archived":false,"fork":false,"pushed_at":"2023-11-09T02:26:45.000Z","size":416,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-29T23:34:52.995Z","etag":null,"topics":["compound-protocol","defi","zkgraph","zkoracle"],"latest_commit_sha":null,"homepage":"https://www.hyperoracle.io/","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/ora-io.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,"governance":null,"roadmap":null,"authors":null}},"created_at":"2023-10-09T05:56:12.000Z","updated_at":"2024-01-25T03:55:24.000Z","dependencies_parsed_at":"2023-11-03T09:26:03.877Z","dependency_job_id":"4bdc336d-f223-4d89-a587-b6fd9c3f3ce8","html_url":"https://github.com/ora-io/Marine","commit_stats":null,"previous_names":["liriu/zkcompound","hyperoracle/marine","ora-io/marine"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ora-io%2FMarine","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ora-io%2FMarine/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ora-io%2FMarine/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ora-io%2FMarine/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ora-io","download_url":"https://codeload.github.com/ora-io/Marine/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252429934,"owners_count":21746570,"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":["compound-protocol","defi","zkgraph","zkoracle"],"created_at":"2024-08-02T13:01:16.567Z","updated_at":"2025-05-05T02:44:39.813Z","avatar_url":"https://github.com/ora-io.png","language":"JavaScript","funding_links":[],"categories":["🔮 ZK Oracle Ecosystem"],"sub_categories":["DeFi \u0026 DEX \u0026 MEV"],"readme":"# 🐳 [Marine](https://mirror.xyz/hyperoracleblog.eth/iXLTbbggNTtLWqPB695IvJQo2DtgooEbvYVVuFVY6y8): Compound Protocol Liquidation Keeper\n\nA zkGraph for determining whether any Compound account can be liquidated and then performing liquidation as keeper. \n\nBuilt using [HyperOracle](https://www.hyperoracle.io), a programmable zkOracle protocol.\n\n# Getting Start\n\nTest Marine locally by these steps.\n\n### 1. Set up environment\n\n```sh\nnpm install\nvim config.js # Fill in the private key and endpoint in the configuration file.\n```\n\n### 2. Access the status of monitored Compound account\n\n```sh\nnpm run marine -- 0x77C6d4c010EaeF7C0dC0080F78ded522AB58A926\n```\n\n### 3. Obtain the price of underlying assets\n\n```sh\nnpm run prices\n```\n\n### 4. Compile \u0026\u0026 Run with specified block height\n\n```sh\nnpm run compile-local \u0026\u0026 npm run exec-local -- 18370576\n```\n\nThen zkGraph returns a boolean value right after `0x53ad370d` in the result to indicate whether the user can be liquidated. In production, the return value will be the payload / calldata for triggering liquidation onchain.\n\n# Technical Details\n\n### Project Layout\n\n- src - Core logic of Marine.\n- builds - Compiled WASM Binary file and Compound user state file\n- APIs - Libraries including zkgraph-api and other scripts for obtaining user accounts and underlying status.\n\n### Core logic\n\n1. Fetch events from Compound Protocol. Instantiate the events in receipts into corresponding EventClass.\n2. If there is a Sync event, update the underlying asset prices specified in the configs. If there is `Mint`/`Redeem`/`Borrow`/`RepayBorrow`, update the defined Compound user state. The files for underlying prices and Compound user status are respectively `src/static/price.ts` and `src/static/marine.ts`. The core file that tracks the state, `src/static/tokens`, will reference them.\n3. Calculate the user's `totalCollateralValue` and `totalPrincipalValue` by `assetAggregator`. The computation of `totalCollateralValue` needs to take into account the `cToken.collateralFactor` and its corresponding exchangeRate.\n4. Compare `totalValue` and `totalPrincipal`, if `totalPrincipal` is larger, then the user can be liquidated.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fora-io%2Fmarine","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fora-io%2Fmarine","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fora-io%2Fmarine/lists"}