{"id":13711808,"url":"https://github.com/primitivefinance/rmm-examples","last_synced_at":"2025-07-10T13:32:54.562Z","repository":{"id":40315903,"uuid":"432270235","full_name":"primitivefinance/rmm-examples","owner":"primitivefinance","description":null,"archived":false,"fork":false,"pushed_at":"2022-06-17T14:30:21.000Z","size":284,"stargazers_count":10,"open_issues_count":4,"forks_count":0,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-04-05T14:01:37.064Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Solidity","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/primitivefinance.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-11-26T18:33:06.000Z","updated_at":"2024-02-06T18:16:16.000Z","dependencies_parsed_at":"2022-07-22T08:52:25.884Z","dependency_job_id":null,"html_url":"https://github.com/primitivefinance/rmm-examples","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/primitivefinance/rmm-examples","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/primitivefinance%2Frmm-examples","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/primitivefinance%2Frmm-examples/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/primitivefinance%2Frmm-examples/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/primitivefinance%2Frmm-examples/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/primitivefinance","download_url":"https://codeload.github.com/primitivefinance/rmm-examples/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/primitivefinance%2Frmm-examples/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264585371,"owners_count":23632646,"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-08-02T23:01:11.849Z","updated_at":"2025-07-10T13:32:54.022Z","avatar_url":"https://github.com/primitivefinance.png","language":"Solidity","funding_links":[],"categories":["Projects"],"sub_categories":[],"readme":"![](https://pbs.twimg.com/profile_banners/1241234631707381760/1588727988/1500x500)\n\n# 🦣 RMM Examples\n\n[![License](https://img.shields.io/badge/License-GPLv3-green.svg)](https://www.gnu.org/licenses/gpl-3.0)\n\nThis repository contains examples showing how to interact with the RMM protocol.\n\nAlternatively, you can use this repository as a base if you plan on building on top of the RMM protocol, as it contains all the necessary setup to run the whole protocol locally.\n\n\u003e ⚠️ These example contracts are written for educational purposes and were **NOT AUDITED**. Keep this in mind before using them in production.\n\n## 🚀 Usage\n\nClone the repository on your computer:\n\n```bash\ngit clone https://github.com/primitivefinance/rmm-examples.git\n```\n\nThen install the required dependencies:\n\n```bash\n# Using npm\nnpm install\n\n# Using yarn\nyarn\n```\n\nAfter that, you can try the other commands:\n\n```bash\n# Using npm and npx\n\n# Compile the contracts\nnpm run compile\n\n# Run a test\nnpx hardhat test ./path/to/the/test.ts\n\n# Style the contracts using Prettier\nnpm run prettier\n\n\n# Using yarn\n\n# Compile the contracts\nyarn compile\n\n# Run a test\nyarn hardhat test ./path/to/the/test.ts\n\n# Style the contracts using Prettier\nyarn prettier\n```\n\n## 📚 Example Contracts\n\n### 💦 LiquidityManager\n\nThis simple example shows how a contract can manage liquidity pool tokens on the behalf of users, allowing them to allocate or remove into different pools. It's a very basic version of the `PrimitiveManager` contract.\n\nThe features of this example are quite basic:\n- Users can allocate or remove liquidity into a pool of a predefined risky / stable pair\n- Check the liquidity of each user currently managed by the contract\n\nSee the code [here](contracts/liquidityManager/liquidityManager.sol).\n\n### 🎁 LiquidityWrapper\n\nThe PrimitiveManager contract tokenizes liquidity pool tokens using the ERC1155 standard. This allows significant gas optimizations at a contract level, but adds a little bit of friction when it comes to integrating with other protocols, more used to deal with ERC20 tokens. Luckily, a straightforward solution to this problem is to use a \"wrapper\" contract.\n\nThe specifications of the `LiquidityWrapper` contract are extremely simple:\n- A wrapper can only be associated with a unique PrimitiveManager token id (a specific pool)\n- Deposit (wrap) liquidity pool tokens (ERC1155) to receive wrapped tokens (ERC20)\n- Withdraw (unwrap) wrapped liquidity pool tokens (ERC20) to get their unwrapped tokens back (ERC1155)\n\nSee the code [here](contracts/liquidityWrapper/LiquidityWrapper.sol).\n\n### 🧑‍🍳 PrimitiveChef\n\nBased on the [MasterChef](https://github.com/sushiswap/sushiswap/blob/canary/contracts/MasterChef.sol) created by SushiSwap, this contract is a reimplementation of the code with the support of ERC1155 tokens, the token standard used by the PrimitiveManager.\n\nIn a few words, the `PrimitiveChef` goals are to:\n- Create staking pools dedicated to specific ERC1155 tokens\n- Reward users depositing liquidity pool tokens in these staking pools\n\nSee the code [here](contracts/primitiveChef/PrimitiveChef.sol).\n\n## 🏗 Building\n\nAs mentioned above, if you plan on building on top of the RMM protocol, this repository can be used as a base for your work, as it already contains:\n- A local context deploying a complete version of the protocol (PrimitiveFactory, PrimitiveEngine, PrimitiveManager and test ERC20 tokens)\n- Custom Mocha hooks specific to the RMM protocol\n\nFeel free to remove the examples or any files you don't want to keep to make yourself at home!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprimitivefinance%2Frmm-examples","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprimitivefinance%2Frmm-examples","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprimitivefinance%2Frmm-examples/lists"}