{"id":25244701,"url":"https://github.com/strader07/minimalist-dex","last_synced_at":"2026-02-07T22:35:31.718Z","repository":{"id":276323479,"uuid":"928359930","full_name":"strader07/minimalist-dex","owner":"strader07","description":"POC of Minimalist DEX","archived":false,"fork":false,"pushed_at":"2025-02-07T18:25:04.000Z","size":333,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-04T13:52:34.988Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"HTML","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/strader07.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-06T14:06:25.000Z","updated_at":"2025-02-07T23:48:01.000Z","dependencies_parsed_at":"2025-02-07T15:23:44.079Z","dependency_job_id":"70a802b8-49d9-4d03-977e-d60a5caeaf0f","html_url":"https://github.com/strader07/minimalist-dex","commit_stats":null,"previous_names":["strader07/minimalist-dex"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/strader07/minimalist-dex","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/strader07%2Fminimalist-dex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/strader07%2Fminimalist-dex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/strader07%2Fminimalist-dex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/strader07%2Fminimalist-dex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/strader07","download_url":"https://codeload.github.com/strader07/minimalist-dex/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/strader07%2Fminimalist-dex/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29211127,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-07T22:22:11.602Z","status":"ssl_error","status_checked_at":"2026-02-07T22:22:10.684Z","response_time":63,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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-02-12T01:34:53.648Z","updated_at":"2026-02-07T22:35:31.671Z","avatar_url":"https://github.com/strader07.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Minimalist DEX - Proof of Concept\n\n## Project Description\n\nThis project is a **minimalist Decentralized Exchange (DEX) proof of concept** that allows users to:\n\n- **Add Liquidity**: Users can provide liquidity to token pairs and receive LP tokens.\n- **Swap Tokens**: Users can swap tokens based on their USD price.\n- **Remove Liquidity**: Users can remove liquidity based on percentage ownership of the pool.\n- **Price Oracle Integration**: Prices are fetched from a USD-referenced **Price Oracle**.\n\nThe project is implemented in **Solidity** using **Foundry** for testing and **Sepolia Testnet** for deployment.\n\n---\n\n## Architecture ([View Diagram](./contract-architecture.png))\n\n### Smart Contracts:\n\n1. **MinimalistDEX.sol**\n   - Core DEX contract.\n   - Handles liquidity management, swaps, and LP token tracking.\n2. **PriceOracle.sol**\n   - Stores USD-referenced token prices.\n   - Enables fair token swaps using real-time pricing.\n3. **MockToken.sol**\n   - A mock ERC20 token for testing.\n   - Configurable token name, symbol, decimals, and supply.\n4. **MLP.sol** (Minimalist Liquidity Pool Token)\n   - ERC20-based LP token contract.\n   - Tracks liquidity contributions of users.\n\n---\n\n### Assumptions and Scope Limitations\n\n- The token pricing for swaps purely relies on the external price oracle.\n- The token price has been assumed to be always valid, there is no explicit validation check.\n- Slippage protection for swaps has been scoped out.\n- No rewards logic was implemented for LP contributors.\n- LP token allocation has been simplified without implying any business logic.\n\n---\n\n## Deployed Addresses\n\n| Contract          | Address (Sepolia)                                                                                                                   |\n| ----------------- | ----------------------------------------------------------------------------------------------------------------------------------- |\n| **MinimalistDEX** | [`0x62eA3e856A006e09DfF6DD70850f9c73f74Dec79`](https://sepolia.arbiscan.io/address/0x62eA3e856A006e09DfF6DD70850f9c73f74Dec79#code) |\n| **PriceOracle**   | [`0xd32b0ccAD5deCfC9C7fAFbA89D918153202dbF4a`](https://sepolia.arbiscan.io/address/0xd32b0ccad5decfc9c7fafba89d918153202dbf4a#code) |\n| **MockToken A**   | [`0x612de751150638dB0E8CC8eF53CD94005742faC2`](https://sepolia.arbiscan.io/address/0x612de751150638dB0E8CC8eF53CD94005742faC2#code) |\n| **MockToken B**   | [`0x31b9DbB5A4d34c9e730d676Bf254f0e1b5eb03FA`](https://sepolia.arbiscan.io/address/0x31b9DbB5A4d34c9e730d676Bf254f0e1b5eb03FA#code) |\n| **StableCoin A**  | [`0x8e0d3Ded296c324050EeF42662c6a778a96DFe73`](https://sepolia.arbiscan.io/address/0x8e0d3Ded296c324050EeF42662c6a778a96DFe73#code) |\n| **StableCoin B**  | [`0xE7A42EF87A5B717B46940120A0E84e2399acff90`](https://sepolia.arbiscan.io/address/0xE7A42EF87A5B717B46940120A0E84e2399acff90#code) |\n\n## Example transaction of [token swap](https://sepolia.arbiscan.io//tx/0x9324860b2630a6c006eb1de6451d6fc4ba785f7db292e899f1d2fd858ee7e1d5)\n\n## Running Locally \u0026 Testing\n\n### **Prerequisites**\n\n1. Install Foundry:\n\n   ```sh\n   curl -L https://foundry.paradigm.xyz | bash\n   foundryup\n   ```\n\n2. Clone the repository:\n\n   ```sh\n   git clone https://github.com/your-repo/minimalist-dex.git\n   cd minimalist-dex\n   ```\n\n3. Install dependencies:\n\n   ```sh\n   forge install\n   ```\n\n4. Build the contracts:\n   ```sh\n   forge build\n   ```\n\n### **Run Tests**\n\n```sh\nforge test -vv\n```\n\n#### **Run Specific Test File**\n\n```sh\nforge test ./test/MinimalistDEX.t.sol -vvvv\n```\n\n#### **Run Specific Tests**\n\n```sh\nforge test --match-test testSwapSamePriceDifferentDecimals\n```\n\n#### **Check Test Coverage**\n\n```sh\nforge coverage\n```\n\n#### **Test Results** (📊 Code Coverage)\n\n| File                    | % Lines             | % Statements        | % Branches          | % Functions         |\n| ----------------------- | ------------------- | ------------------- | ------------------- | ------------------- |\n| `src/MinimalistDEX.sol` | 100.00% (59/59)     | 100.00% (62/62)     | 100.00% (19/19)     | 100.00% (8/8)       |\n| `src/MockToken.sol`     | 100.00% (5/5)       | 100.00% (3/3)       | 100.00% (0/0)       | 100.00% (2/2)       |\n| `src/PriceOracle.sol`   | 100.00% (6/6)       | 100.00% (4/4)       | 100.00% (2/2)       | 100.00% (2/2)       |\n| **Total**               | **100.00% (70/70)** | **100.00% (69/69)** | **100.00% (21/21)** | **100.00% (12/12)** |\n\nView the detailed coverage report [here](./coverage_report/index.html).\n\n---\n\n## Deployment \u0026 Verification\n\n### **Deploy Contracts to Sepolia**\n\n1. Create an `.env` file with your private key and RPC URL:\n\n   ```sh\n   SEPOLIA_RPC_URL=\u003cyour-rpc-url\u003e\n   ARB_SEPOLIA_RPC_URL=\u003cyour-rpc-url-in-arbitrum\u003e\n   ETHERSCAN_API_KEY=\u003cyour-etherscan-api-key\u003e\n   ARBISCAN_API_KEY=\u003cyour-arbiscan-api-key\u003e\n   PRIVATE_KEY=\u003cyour-private-key\u003e\n   ```\n\n2. Deploy and verify with Foundry:\n\n   ```sh\n   souece .env\n\n   forge script --chain arbitrum-sepolia script/DeployDex.s.sol:DeployDEX --rpc-url $ARB_SEPOLIA_RPC_URL --private-key $PRIVATE_KEY --broadcast --verify --etherscan-api-key $ARBISCAN_API_KEY\n   ```\n\n3. Verify individual contracts:\n\n   ```sh\n   souece .env\n\n   forge verify-contract \\\n     --chain arbitrum-sepolia \\\n     --num-of-optimizations 200 \\\n     --watch \\\n     --etherscan-api-key $ARBISCAN_API_KEY \\\n     --constructor-args $(cast abi-encode \"constructor(string,string,uint8,uint256)\" \"arg1\" \"arg2\" arg3 arg4) \\\n     [ADDRESS] \\\n     [CONTRACT]\n   ```\n\n---\n\n## Future Enhancements\n\n- **Slippage Protection**: Prevent swaps from executing beyond a threshold price.\n- **Real Oracle Integration**: Use Chainlink for real-time USD-based prices.\n- **Liquidity Mining**: Introduce rewards for liquidity providers.\n- **Market Making**: Improve asset pricing incorporating both of oracle and internal pool.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstrader07%2Fminimalist-dex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstrader07%2Fminimalist-dex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstrader07%2Fminimalist-dex/lists"}