{"id":21221809,"url":"https://github.com/primitivefinance/proto-sim-portfolio","last_synced_at":"2025-06-19T11:35:05.257Z","repository":{"id":183312284,"uuid":"669186039","full_name":"primitivefinance/proto-sim-portfolio","owner":"primitivefinance","description":"Prototype risk modeling simulation for Portfolio using Arbiter.","archived":false,"fork":false,"pushed_at":"2023-08-04T07:14:27.000Z","size":292,"stargazers_count":20,"open_issues_count":0,"forks_count":1,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-04-05T14:02:42.086Z","etag":null,"topics":["amm","arbiter","evm","portfolio","risk-modeling","rust","security","solidity"],"latest_commit_sha":null,"homepage":"https://www.primitive.xyz/security","language":"Rust","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/primitivefinance.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":"2023-07-21T14:53:16.000Z","updated_at":"2024-08-25T12:01:29.000Z","dependencies_parsed_at":"2024-11-20T22:46:20.396Z","dependency_job_id":"04aa9c9f-7687-415c-b581-c0f6c85e0e98","html_url":"https://github.com/primitivefinance/proto-sim-portfolio","commit_stats":null,"previous_names":["primitivefinance/proto-sim-portfolio"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/primitivefinance/proto-sim-portfolio","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/primitivefinance%2Fproto-sim-portfolio","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/primitivefinance%2Fproto-sim-portfolio/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/primitivefinance%2Fproto-sim-portfolio/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/primitivefinance%2Fproto-sim-portfolio/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/primitivefinance","download_url":"https://codeload.github.com/primitivefinance/proto-sim-portfolio/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/primitivefinance%2Fproto-sim-portfolio/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260742685,"owners_count":23055823,"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","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":["amm","arbiter","evm","portfolio","risk-modeling","rust","security","solidity"],"created_at":"2024-11-20T22:33:55.277Z","updated_at":"2025-06-19T11:35:00.244Z","avatar_url":"https://github.com/primitivefinance.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# proto-sim\n\nPrototype simulation using Arbiter as the simulation \u0026 agent engine.\n\n## Build \u0026 Run\n```bash\nbuild.sh\n\ncargo run\n```\n\n## Arbiter config\n\nThe `arbiter.toml` config defines the initial parameterization of the underlying price process and pool parameters.\n\n\n## Project Structure\n- analysis - Contains analysis scripts for the simulation results.\n    - trading_function - Contains scripts for analyzing the trading function.\n- bisection - Implements the bisection algorithm in rust.\n- calls - Agent wrapper abstraction for gracefully handling EVM transactions and calls.\n- cli - Handles the cli parser and matching commands.\n- common - Static variables used across the sim as default values.\n- config - Loads the arbiter.toml config into a deserialized struct type.\n- log - Fetches EVM state and loads it into a DataFrame type that can be written to a csv.\n- main - Main entry point for the cli.\n- math - Implements the Portfolio Strategy math in rust.\n- plots - Implements utility functions for plotting simulation csv or other data.\n- raw_data - Handles the storage of the raw EVM state that is processed by log.\n- setup - Handles the simulation environment setup, including contract and agents deployment.\n- sim - Implements the simulation loop and agent interaction.\n- spreadsheetorizer - Converts the DataFrame raw data type to a csv which can be written to a file.\n- step - Handles a \"simulation step\" in the simulation loop in sim.rs.\n- task - Handles a specific agent task in the simulation loop in sim.rs.\n\n\n\n### Basic Sim Example\n\n```rust\nuse arbiter::prelude::*;\nuse bindings::weth;\n\n#[tokio::main]\nasync fn main() -\u003e Result\u003c(), Box\u003cdyn std::error::Error\u003e\u003e {\n    // Simulation manager is the controller of the arbiter simulation environment.\n    let mut manager = SimulationManager::new();\n\n    // Get a deployer account from the manager.\n    let admin = manager.agents.get(\"admin\").unwrap();\n\n    // Deploy a contract to the EVM.\n    let contract = SimulationContract::new(weth::WETH_ABI.clone(), weth::WETH_BYTECODE.clone());\n    let (weth, tx_deploy) = admin.deploy(weth, vec![])?;\n\n    // Add it to the manager's deployed contracts list.\n    manager.deployed_contracts.insert(\"weth\".to_string(), weth);\n\n    // Execute EVM transactions, log the data, and repeat.\n    admin.call(weth, \"deposit\", vec![1000]).await?;\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprimitivefinance%2Fproto-sim-portfolio","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprimitivefinance%2Fproto-sim-portfolio","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprimitivefinance%2Fproto-sim-portfolio/lists"}