{"id":30614595,"url":"https://github.com/morpho-org/rewards-hub-lite","last_synced_at":"2025-08-30T07:15:50.319Z","repository":{"id":300137555,"uuid":"927734397","full_name":"morpho-org/rewards-hub-lite","owner":"morpho-org","description":null,"archived":false,"fork":false,"pushed_at":"2025-02-10T15:14:24.000Z","size":2984,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-20T03:46:00.986Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/morpho-org.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,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-02-05T13:07:46.000Z","updated_at":"2025-02-19T08:43:03.000Z","dependencies_parsed_at":"2025-06-20T03:56:24.960Z","dependency_job_id":null,"html_url":"https://github.com/morpho-org/rewards-hub-lite","commit_stats":null,"previous_names":["morpho-org/rewards-hub-lite"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/morpho-org/rewards-hub-lite","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morpho-org%2Frewards-hub-lite","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morpho-org%2Frewards-hub-lite/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morpho-org%2Frewards-hub-lite/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morpho-org%2Frewards-hub-lite/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/morpho-org","download_url":"https://codeload.github.com/morpho-org/rewards-hub-lite/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morpho-org%2Frewards-hub-lite/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272817706,"owners_count":24998038,"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","status":"online","status_checked_at":"2025-08-30T02:00:09.474Z","response_time":77,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":"2025-08-30T07:15:49.274Z","updated_at":"2025-08-30T07:15:50.305Z","avatar_url":"https://github.com/morpho-org.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Rewards hub lite stack\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"./docs/banner.png\" /\u003e\n\u003c/p\u003e\n\nThe Lite Stack is designed to bootstrap the distribution of rewards on Morpho, providing a streamlined framework for managing and distributing incentives efficiently.\n\n## Components\n\n- [Universal Rewards Distributor (URD)](https://github.com/morpho-org/universal-rewards-distributor): A smart contract that facilitates on-chain reward claims securely.\n- `apps/subgraph`: Indexes all relevant data necessary for reward computation.\n- `@morpho-org/blue-rewards-sdk`: The core library responsible for reward calculations and processing.\n- `packages/cli`: A working example demonstrating how to generate Merkle trees for rewards distribution.\n\n## Getting Started\n\n### 1. Deploy the Universal Rewards Distributor\n\nThe Universal Rewards Distributor (URD) is the smart contract responsible for handling on-chain reward claims.\n\nYou can find the contract codebase [here](https://github.com/morpho-org/universal-rewards-distributor).\n\nAs a first step, we strongly encourage you to have the owner of the URD on a SAFE with no updaters.\n\n### 2. Deploy Subgraph\n\nThe subgraph indexes the necessary data to compute rewards and is located in `/apps/subgraph`.\n\nFor detailed instructions on deploying a subgraph, refer to [this alchemy docs](https://docs.alchemy.com/docs/alchemy-subgraphs-overview).\n\n### 3. Setup Programs\n\nReward programs define the distribution logic for rewards. There are three types of programs available:\n\n- **Vault \u0026 Market programs**: Designed to incentivize vault and market through linear reward distribution over a predefined timeline.\n- **Airdrop programs**: Provide a fixed reward amount to a selected group of users.\n\n```typescript\nimport { RewardProgram } from \"@morpho-org/blue-rewards-sdk\";\n\nexport const PROGRAMS: RewardProgram[] = [];\n```\n\nTo set up reward programs using an npm package, you can fork this [repository](https://github.com/morpho-org/morpho-blue-reward-programs).\n\n### 4. Setup config\n\nReward configurations define rules that modify reward computations. These include:\n\n- **Blacklisting**: Excludes specific addresses from reward calculations.\n- **Redirection**: Redirects rewards from one address to another (useful for integrators contracts).\n- **Tree exclusion**: Removes a user from a specific reward tree without altering rewards computation.\n\n```typescript\nimport { RewardsConfig } from \"@morpho-org/blue-rewards-sdk\";\n\nexport const CONFIG: RewardsConfig = {\n  blacklist: [],\n  redirections: [],\n  exclusions: [],\n};\n```\n\n### 5. Compute the trees\n\nA working example of reward tree computation is available in `./packages/cli/src/trees.ts`.\n\nTo generate reward trees, update `trees.ts` with your program and config settings, then execute:\n\n```bash\nyarn cli trees -t 1738886400\n```\n\nExample Output:\n\n```bash\nComputing trees...\n\nTrees generated at 1738886400\n\n- Tree 0xB5b17231E2C89Ca34CE94B8CB895A9B124BB466e\n\n Ipfs: https://ipfs.io/ipfs/QmR1PwNb9eBSWT6QsvMBJ2Wtf91BpbMVXaZVwubsxYnG9U\n Hash: 0x27a452cf8d5a1a4ffa25eaf8a659b233ce3755d102817d30d68ff2b1360687df\n Root: 0x703620cd0ba4bf378979c315f6cf1409cca1278f454d8e31f93c696badb968b3\n\nSources of data:\n- Chain 1: https://subgraph.satsuma-prod.com\n```\n\n### 6. Push the tree onchain\n\nTo update the URD contract with the latest Merkle tree, call the following functions:\n\n- **As the Owner or with an updater if timelock is 0**: setRoot([root, hash])\n- **As an Updater**: submitRoot([root, hash])\n\n### 7. Claim the rewards\n\nUsers can claim their rewards by calling the `claim` function:\n\n```typescript\nclaim([account, reward, claimable, proof]);\n```\n\n**Parameters:**\n\n- **account** (address): The user address claiming the rewards.\n- **reward** (address): The token being claimed.\n- **claimable** (uint256): The total claimable reward amount for the user \u0026 token. It can be found in the Tree at `rewards[account][reward].amount`. (Note: Claimable includes both unclaimed and already claimed rewards.)\n- **proof** (bytes32[]): The Merkle proof verifying the claim. This proof path is located in the Merkle tree at `rewards[account][reward].proof`\n\nSee on this tree example: https://ipfs.io/ipfs/QmR1PwNb9eBSWT6QsvMBJ2Wtf91BpbMVXaZVwubsxYnG9U\n\nNote: To get the IPFS CID from the contract hash, you can use the function `bytes32ToCid` provided by the package `@morpho-org/blue-rewards-sdk`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmorpho-org%2Frewards-hub-lite","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmorpho-org%2Frewards-hub-lite","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmorpho-org%2Frewards-hub-lite/lists"}