{"id":28264518,"url":"https://github.com/morpho-org/morpho-ethers-contract","last_synced_at":"2025-08-30T07:15:39.784Z","repository":{"id":58409092,"uuid":"531674695","full_name":"morpho-org/morpho-ethers-contract","owner":"morpho-org","description":":zap: :rocket: Use Morpho contracts with ethers js ","archived":false,"fork":false,"pushed_at":"2023-07-25T13:53:10.000Z","size":472,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-23T15:16:57.096Z","etag":null,"topics":["ethereum","typescript"],"latest_commit_sha":null,"homepage":"","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}},"created_at":"2022-09-01T20:23:20.000Z","updated_at":"2025-05-22T17:49:45.000Z","dependencies_parsed_at":"2024-06-19T19:28:12.068Z","dependency_job_id":"953c00a2-bebd-4233-ac48-bac800324e61","html_url":"https://github.com/morpho-org/morpho-ethers-contract","commit_stats":{"total_commits":53,"total_committers":5,"mean_commits":10.6,"dds":"0.41509433962264153","last_synced_commit":"779854648bcb44874e72e3449f8f0c6c53aec587"},"previous_names":["morpho-org/morpho-ethers-contract","morpho-labs/morpho-ethers-contract"],"tags_count":38,"template":false,"template_full_name":null,"purl":"pkg:github/morpho-org/morpho-ethers-contract","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morpho-org%2Fmorpho-ethers-contract","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morpho-org%2Fmorpho-ethers-contract/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morpho-org%2Fmorpho-ethers-contract/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morpho-org%2Fmorpho-ethers-contract/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/morpho-org","download_url":"https://codeload.github.com/morpho-org/morpho-ethers-contract/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morpho-org%2Fmorpho-ethers-contract/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272817705,"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":["ethereum","typescript"],"created_at":"2025-05-20T09:10:48.713Z","updated_at":"2025-08-30T07:15:39.770Z","avatar_url":"https://github.com/morpho-org.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Morpho Ethers Contract\n\n[![npm package][npm-img]][npm-url]\n[![Build Status][build-img]][build-url]\n[![Downloads][downloads-img]][downloads-url]\n[![Issues][issues-img]][issues-url]\n[![Commitizen Friendly][commitizen-img]][commitizen-url]\n[![Semantic Release][semantic-release-img]][semantic-release-url]\n\nThis package aims to facilitate the integration around morpho with ethers-v5. Instead of importing ABIs,\nfinding implementations, and guessing which functions to call, this package gives you typed classes by using\n[typechain](https://github.com/dethcrypto/TypeChain), and mainnet addresses of deployed contracts.\n\nThe package contains all contracts to interract with Morpho and withe the Compound and Aave pools.\n\n\nNB: for security reasons, we invite you to always check the addresses of the contracts used, and check whether they are indeed those of Morpho.\n\nYou will find more information on the integration of Morpho in the [developer documentation](https://developers.morpho.xyz/get-started).\n\n## Install\n\n```bash\nnpm install @morpho-labs/morpho-ethers-contract\n```\n\n```bash\nyarn add @morpho-labs/morpho-ethers-contract\n```\n\n## Usage\n\n```typescript\nimport { providers, Wallet } from \"ethers\";\nimport { formatUnits, parseUnits } from \"ethers/lib/utils\";\n\nimport addresses from \"@morpho-labs/morpho-ethers-contract/addresses\"\nimport {\n  MorphoAaveV2Lens__factory,\n  MorphoAaveV2__factory,\n  ERC20__factory,\n} from \"@morpho-labs/morpho-ethers-contract\";\n\n(async () =\u003e {\n  const provider = new providers.StaticJsonRpcProvider(process.env.RPC, \"mainnet\");\n\n  const morphoAaveLens = MorphoAaveV2Lens__factory.connect(addresses.morphoAave.lens, provider);\n\n  // now you have autocompletion for morpho contract\n  const morphoAaveMarkets = await morphoAaveLens.getAllMarkets();\n\n  // For example, you can easily supply on Morpho\n\n  const signer = new Wallet(process.env.PRIVATE_KEY!, provider);\n\n  const morphoAaveV2 = MorphoAaveV2__factory.connect(addresses.morphoAave.morpho, provider);\n\n  const toSupply = parseUnits(\"10\"); // 10 DAI\n  const daiAddress = \"0x6b175474e89094c44da98b954eedeac495271d0f\";\n  const aDaiAddress = \"0x028171bCA77440897B824Ca71D1c56caC55b68A3\";\n  // We first need to approve the amount to supply through the ERC20 token\n  const DAI = ERC20__factory.connect(daiAddress, signer);\n  const approvalTransaction = await DAI.approve(morphoAaveV2.address, toSupply);\n\n  console.log(`Approval transaction: https://etherscan.io/tx/${approvalTransaction.hash}`);\n\n  await approvalTransaction.wait(); // wait until transaction was mined\n\n  console.log(`${formatUnits(toSupply)} DAI approved`);\n\n  const supplyTransaction = await morphoAaveV2[\"supply(address,address,uint256)\"](\n    aDaiAddress, // poolToken aka aToken for aave\n    signer.address, // onBehalf of the signer\n    toSupply // amount to supply in WEI units\n  );\n\n  console.log(\n    `Supply on Morpho-AaveV2 transaction: https://etherscan.io/tx/${supplyTransaction.hash}`\n  );\n\n  const receipt = await supplyTransaction.wait();\n\n  console.log(\n    `You have successfully supplied ${formatUnits(\n      toSupply\n    )} DAI on Morpho Aave, with a gas consuption of ${formatUnits(receipt.gasUsed, \"gwei\")} gWei`\n  );\n})();\n```\n\n[build-img]: https://github.com/morpho-labs/morpho-ethers-contract/actions/workflows/release.yml/badge.svg\n[build-url]: https://github.com/morpho-labs/morpho-ethers-contract/actions/workflows/release.yml\n[downloads-img]: https://img.shields.io/npm/dt/@morpho-labs/morpho-ethers-contract\n[downloads-url]: https://www.npmtrends.com/@morpho-labs/morpho-ethers-contract\n[npm-img]: https://img.shields.io/npm/v/@morpho-labs/morpho-ethers-contract\n[npm-url]: https://www.npmjs.com/package/@morpho-labs/morpho-ethers-contract\n[issues-img]: https://img.shields.io/github/issues/morpho-labs/morpho-ethers-contract\n[issues-url]: https://github.com/morpho-labs/morpho-ethers-contract/issues\n[codecov-img]: https://codecov.io/gh/morpho-labs/morpho-ethers-contract/branch/main/graph/badge.svg\n[codecov-url]: https://codecov.io/gh/morpho-labs/morpho-ethers-contract\n[semantic-release-img]: https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg\n[semantic-release-url]: https://github.com/semantic-release/semantic-release\n[commitizen-img]: https://img.shields.io/badge/commitizen-friendly-brightgreen.svg\n[commitizen-url]: http://commitizen.github.io/cz-cli/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmorpho-org%2Fmorpho-ethers-contract","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmorpho-org%2Fmorpho-ethers-contract","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmorpho-org%2Fmorpho-ethers-contract/lists"}