{"id":23952253,"url":"https://github.com/alhonaut/quant-assigment","last_synced_at":"2026-05-16T15:03:34.485Z","repository":{"id":270493667,"uuid":"910541505","full_name":"alhonaut/quant-assigment","owner":"alhonaut","description":"Code for quant analyz Morpho Markets and simulation reallocation process in MetaMorpho","archived":false,"fork":false,"pushed_at":"2025-01-01T21:21:38.000Z","size":4581,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-24T09:43:03.523Z","etag":null,"topics":["analysis","data","defi","quantitative-finance"],"latest_commit_sha":null,"homepage":"","language":"Solidity","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/alhonaut.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":"2024-12-31T15:18:30.000Z","updated_at":"2025-01-09T14:48:33.000Z","dependencies_parsed_at":"2025-02-24T09:51:27.932Z","dependency_job_id":null,"html_url":"https://github.com/alhonaut/quant-assigment","commit_stats":null,"previous_names":["alhonaut/quant-assigment"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/alhonaut/quant-assigment","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alhonaut%2Fquant-assigment","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alhonaut%2Fquant-assigment/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alhonaut%2Fquant-assigment/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alhonaut%2Fquant-assigment/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alhonaut","download_url":"https://codeload.github.com/alhonaut/quant-assigment/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alhonaut%2Fquant-assigment/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33107564,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-16T04:41:52.686Z","status":"ssl_error","status_checked_at":"2026-05-16T04:41:52.009Z","response_time":115,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5: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":["analysis","data","defi","quantitative-finance"],"created_at":"2025-01-06T13:50:48.119Z","updated_at":"2026-05-16T15:03:34.467Z","avatar_url":"https://github.com/alhonaut.png","language":"Solidity","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Quant Assignment: Optimized Fund Allocation and MetaMorpho Interaction\n\n## Overview\n\nThis repository contains an optimized workflow for data retrieval, fund allocation, and interaction with the MetaMorpho Protocol. It comprises Python scripts and Solidity files to fetch on-chain data, simulate vault allocations, deploy smart contracts on a mainnet fork, and securely interact with the blockchain.\n\n---\n\n## Components\n\n### 1. **Data Pipeline and Allocation Optimization**\n**File**: `main.py`\n\nThis script:\n- Fetches data from the Morpho API.\n- Stores data in a local SQL server.\n- Simulates fund allocation (starting with 1 million USD).\n- Uses linear programming to optimize fund distribution across vaults.\n- Integrates risk management strategies to avoid high-risk allocations.\n\n**Setup and Execution**:\n1. Create a Python virtual environment:\n   ```bash\n   python -m venv myenv\n   ```\n2. Activate the environment:\n   ```bash\n   source myenv/bin/activate\n   ```\n3. Install required dependencies:\n   ```bash\n   pip install -r requirements.txt\n   ```\n4. Run the script:\n   ```bash\n   python script/main.py\n   ```\n\n---\n\n### 2. **Deploying MetaMorpho Smart Contract**\n**File**: `DeployMetaMorpho.s.sol`\n\nThis script uses Foundry to:\n- Call a contract Factory on a forked mainnet.\n- Interact with the deployed MetaMorpho USDC Vault.\n- Display transaction logs and details.\n\n**Setup and Execution**:\n1. Fork the mainnet using your RPC URL:\n   ```bash\n   anvil --fork-url https://mainnet.infura.io/v3/$INFURA_KEY\n   ```\n2. Deploy the script:\n   ```bash\n   forge script script/DeployMetaMorpho.s.sol:DeployMetaMorpho \n      --fork-url https://mainnet.infura.io/v3/$INFURA_KEY        \n      --broadcast\n   ```\n\n---\n\n### 3. **Web3 Interaction with Deployed Contract**\n**File**: `Scripter.py`\n\nThis script connects to the forked chain via Web3.py to:\n1. Ensure the chain is ready for transactions.\n2. Simulate a transaction to verify functionality.\n3. Send a signed transaction to the forked mainnet.\n\n**Setup and Execution**:\n1. Complete the deployment step above.\n2. Run the script:\n   ```bash\n   python script/Scripter.py\n   ```\n\n---\n\n## Security Enhancements\n- **Echidna Fuzz Testing**:\n  - `EchidnaMorphoTest.sol` ensures the `reallocate` function in MetaMorpho.sol is secure.\n- **Static Analysis**:\n  - Security report generated using Cyfrin Aderyn static analyzer to validate contract security (see `report.md`).\n\n---\n\n## Structure of the Repository\n- `script/main.py`: Python-based data pipeline and fund allocation.\n- `script/DeployMetaMorpho.s.sol`: Solidity script for mainnet fork deployment.\n- `script/Scripter.py`: Python script for Web3 interaction.\n- `script/EchidnaMorphoTest.sol`: Echidna test file for contract security.\n- `report.md`: Security analysis report.\n- `requirements.txt`: Python dependencies.\n\n---\n\n## Requirements and Dependencies\n- Python 3.x\n- Foundry (for mainnet fork and deployment)\n- Morpho API\n- Web3.py\n- PuLP (for linear programming)\n\nInstall dependencies using:\n```bash\npip install -r requirements.txt\n```\n\n---\n\n## Running Tests and Simulation\n1. Setup the local environment or fork the mainnet as described above.\n2. Run the Python scripts and Foundry commands to simulate transactions.\n3. Review logs and transaction outputs to verify success.\n\n---\n\n## Notes\n- Make sure to replace `$INFURA_KEY` with your actual Infura API key.\n- The project has been tested with dummy data for demonstration purposes.\n- Refer to the security report for detailed contract analysis.\n\n---\n\n## Optional Enhancements\n- Advanced reallocation strategies.\n- Frontend for visualization.\n- Additional Foundry unit tests with coverage reports.\n\n\n```shell\n$ forge --help\n$ anvil --help\n$ cast --help\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falhonaut%2Fquant-assigment","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falhonaut%2Fquant-assigment","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falhonaut%2Fquant-assigment/lists"}