{"id":26055013,"url":"https://github.com/morpho-org/morpho-optimizers-snippets","last_synced_at":"2026-07-11T01:31:36.402Z","repository":{"id":156436909,"uuid":"617901222","full_name":"morpho-org/morpho-optimizers-snippets","owner":"morpho-org","description":null,"archived":false,"fork":false,"pushed_at":"2023-09-15T13:03:51.000Z","size":321,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-10-31T00:44:33.659Z","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":"agpl-3.0","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":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-03-23T10:54:22.000Z","updated_at":"2023-08-18T16:33:21.000Z","dependencies_parsed_at":"2023-09-16T06:05:53.914Z","dependency_job_id":null,"html_url":"https://github.com/morpho-org/morpho-optimizers-snippets","commit_stats":null,"previous_names":["morpho-org/morpho-optimizers-snippets","morpho-org/morpho-snippets"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/morpho-org/morpho-optimizers-snippets","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morpho-org%2Fmorpho-optimizers-snippets","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morpho-org%2Fmorpho-optimizers-snippets/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morpho-org%2Fmorpho-optimizers-snippets/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morpho-org%2Fmorpho-optimizers-snippets/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/morpho-org","download_url":"https://codeload.github.com/morpho-org/morpho-optimizers-snippets/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morpho-org%2Fmorpho-optimizers-snippets/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35348376,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-10T02:00:06.465Z","response_time":60,"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-03-08T10:00:37.772Z","updated_at":"2026-07-11T01:31:36.374Z","avatar_url":"https://github.com/morpho-org.png","language":"Solidity","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Morpho-snippets\n\n## Typescript \u0026 Solidity based snippets related to Morpho Protocols.\n\n## IMPORTANT\n\nThis repository contains smart contracts that have been developed for educational, experimental, or demonstration purposes only. By using or interacting with these smart contracts, you acknowledge and accept the following:\n\n- The smart contracts in this repository have not been audited and are provided \"as is\" with no guarantees, warranties, or assurances of any kind. The authors and maintainers of this repository are not responsible for any damages, losses, or liabilities that may arise from the use or deployment of these smart contracts.\n\n- The smart contracts in this repository are not intended for use in production environments or for the management of real-world assets, funds, or resources. Any use or deployment of these smart contracts for such purposes is done entirely at your own risk.\n\n- The smart contracts are provided for reference and learning purposes, and you are solely responsible for understanding, modifying, and deploying them as needed.\n\n### Morpho-Aave-V3 related functions, in Typescript.\n\nOne can use one of the following functions to get relevant data:\n\n- getTotalSupply\n- getTotalBorrow\n\n- getTotalMarketSupply\n- getTotalMarketBorrow\n\n- getCurrentSupplyBalanceInOf\n- getCurrentCollateralBalanceInOf\n- getCurrentBorrowBalanceInOf\n\n- getCurrentUserSupplyRatePerYear\n- getCurrentUserBorrowRatePerYear\n\n- getP2PSupplyRate\n- getP2PBorrowRate\n\n- getSupplyRatesPerYear\n- getBorrowRatesPerYear\n\n- getUserHealthFactor\n\n### Morpho-Aave-V3 related functions in Solidity.\n\nOne can use the following snippets to get relevant data:\n\n- totalSupply\n- totalBorrow\n\n- supplyAPR\n- borrowAPR\n- avgBorrowAPR\n\n- healthFactor\n\n- marketSupply\n- marketBorrow\n\n- supplyBalance\n- borrowBalance\n\n- poolAPR\n- assetPrice\n\nThe Utils library gathers some pieces of code used in the snippets. You can also visit the [MorphoGetters.sol](https://github.com/morpho-org/morpho-aave-v3/blob/main/src/MorphoGetters.sol) file to have a look at all the data available from the Morpho Contract.\n\n### Getting Started\n\n- Install [Foundry](https://github.com/foundry-rs/foundry).\n- Install yarn\n- Run foundryup\n- Run forge install\n- Create a `.env` file according to the [`.env.example`](./.env.example) file.\n\n### Testing with [Foundry](https://github.com/foundry-rs/foundry) 🔨\n\nTests are run against a fork of real networks, which allows us to interact directly with liquidity pools of Aave V3. Note that you need to have an RPC provider that have access to Ethereum.\n\nYou can run the test by running the command: `forge test`\n\n### VSCode setup\n\nConfigure your VSCode to automatically format a file on save, using `forge fmt`:\n\n- Install [emeraldwalk.runonsave](https://marketplace.visualstudio.com/items?itemName=emeraldwalk.RunOnSave)\n- Update your `settings.json`:\n\n```json\n{\n  \"[solidity]\": {\n    \"editor.formatOnSave\": false\n  },\n  \"emeraldwalk.runonsave\": {\n    \"commands\": [\n      {\n        \"match\": \".sol\",\n        \"isAsync\": true,\n        \"cmd\": \"forge fmt ${file}\"\n      }\n    ]\n  }\n}\n```\n\n## Questions \u0026 Feedback\n\nFor any question or feedback you can send an email to [merlin@morpho.xyz](mailto:merlin@morpho.xyz).\n\n---\n\n## Licensing\n\nThe code is under the GNU AFFERO GENERAL PUBLIC LICENSE v3.0, see [`LICENSE`](./LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmorpho-org%2Fmorpho-optimizers-snippets","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmorpho-org%2Fmorpho-optimizers-snippets","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmorpho-org%2Fmorpho-optimizers-snippets/lists"}