{"id":19090191,"url":"https://github.com/jefedcreator/defi-lend-swap","last_synced_at":"2026-06-17T12:32:33.902Z","repository":{"id":118308119,"uuid":"504526256","full_name":"jefedcreator/defi-lend-swap","owner":"jefedcreator","description":null,"archived":false,"fork":false,"pushed_at":"2023-04-30T18:01:47.000Z","size":184,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-11-12T12:31:58.843Z","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/jefedcreator.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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2022-06-17T12:27:44.000Z","updated_at":"2023-04-30T17:56:54.000Z","dependencies_parsed_at":"2023-05-26T23:00:37.895Z","dependency_job_id":null,"html_url":"https://github.com/jefedcreator/defi-lend-swap","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jefedcreator/defi-lend-swap","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jefedcreator%2Fdefi-lend-swap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jefedcreator%2Fdefi-lend-swap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jefedcreator%2Fdefi-lend-swap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jefedcreator%2Fdefi-lend-swap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jefedcreator","download_url":"https://codeload.github.com/jefedcreator/defi-lend-swap/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jefedcreator%2Fdefi-lend-swap/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34449277,"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-06-17T02:00:05.408Z","response_time":127,"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":"2024-11-09T03:03:02.255Z","updated_at":"2026-06-17T12:32:33.897Z","avatar_url":"https://github.com/jefedcreator.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Swapper Smart Contract\n\nThe Swapper smart contract is a decentralized application built on Ethereum that allows users to swap USDC tokens for USDT tokens and lend the swapped tokens on the Compound platform using cUSDT. The smart contract is written in Solidity and utilizes the Uniswap V2 Router for the token swap.\n\n## Table of Contents\n\n- [Features](#features)\n- [Technologies Used](#technologies-used)\n- [Smart Contract Overview](#smart-contract-overview)\n- [Installation](#installation)\n- [Deployment](#deployment)\n- [Usage](#usage)\n\n## Features\n\n- Swap USDC tokens for USDT tokens using Uniswap V2 Router\n- Lend the swapped tokens on the Compound platform using cUSDT\n- Redeem cUSDT tokens\n\n## Technologies Used\n\n- Solidity\n- Ethereum\n- Uniswap V2 Router\n- Compound Finance\n- Hardhat\n- Ethers.js\n\n## Smart Contract Overview\n\nThe Swapper smart contract contains the following functions:\n\n- `swapAndLend`: Swaps USDC tokens for USDT tokens and lends the swapped tokens on the Compound platform using cUSDT.\n\n## Installation\n\n1. Install [Node.js](https://nodejs.org/en/download/) on your machine.\n2. Install Hardhat globally:\n```bash\nnpm install --global hardhat\n```\n3. Clone the repository:\n```bash\ngit clone https://github.com/jefedcreator/defi-lend-swap.git\n```\n4. Navigate to the project folder:\n```bash\ncd swapper-smart-contract\n```\n5. Install dependencies:\n```bash\nnpm install\n```\n\n## Deployment\n\n1. Create a `.env` file in the project root folder with the following content:\n\n```env\nALCHEMY_API_KEY=your_alchemy_api_key\nMNEMONIC=your_metamask_mnemonic_phrase\n```\n\nReplace `your_alchemy_api_key` and `your_metamask_mnemonic_phrase` with your respective values.\n\n2. Deploy the smart contract to the Ethereum network using Hardhat:\n\n```bash\nnpx hardhat run --network mainnet scripts/deploy.js\n```\n\n## Usage\n\nTo interact with the Swapper smart contract, you can use ethers.js in your frontend application. Here's an example of how to call the `swapAndLend` function using ethers.js:\n\n```javascript\nimport { ethers } from \"ethers\";\nimport swapperABI from \"./Swapper.json\";\n\nconst provider = new ethers.providers.JsonRpcProvider(\"https://eth-mainnet.alchemyapi.io/v2/your_alchemy_api_key\");\nconst signer = provider.getSigner();\nconst swapperAddress = \"0xYourDeployedSwapperContractAddress\";\n\nconst swapper = new ethers.Contract(swapperAddress, swapperABI, signer);\n\nconst usdcAddress = \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\";\nconst usdtAddress = \"0xdAC17F958D2ee523a2206206994597C13D831ec7\";\nconst cUSDTAddress = \"0xf650C3d88D12dB855b8bf7D11Be6C55A4e07dCC9\";\n\nconst swapAndLend = async (amount) =\u003e {\n  const weiAmount = ethers.utils.parseUnits(amount, \"mwei\");\n  await swapper.swapAndLend(weiAmount, usdcAddress,usdtAddress, cUSDTAddress);\n};\n\n// Example usage: swap 100 USDC for USDT and lend on Compound\nswapAndLend(\"100\")\n.then(() =\u003e console.log(\"Swapped and lent successfully\"))\n.catch((error) =\u003e console.error(\"Error:\", error));\n```\n\nReplace `your_alchemy_api_key` with your Alchemy API key.\n\nThis example shows how to call the `swapAndLend` function to swap 100 USDC for USDT and lend the swapped tokens on the Compound platform using cUSDT. To use this function in your frontend application, you will need to import the ethers.js library and the Swapper smart contract ABI. You will also need to connect to an Ethereum provider and obtain a signer from a connected wallet (e.g., MetaMask).\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjefedcreator%2Fdefi-lend-swap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjefedcreator%2Fdefi-lend-swap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjefedcreator%2Fdefi-lend-swap/lists"}