{"id":50874081,"url":"https://github.com/dijkstra-keystone/keystone","last_synced_at":"2026-06-15T08:01:32.396Z","repository":{"id":334393941,"uuid":"1141192447","full_name":"dijkstra-keystone/keystone","owner":"dijkstra-keystone","description":"Deterministic precision arithmetic for financial computation and verifiable systems","archived":false,"fork":false,"pushed_at":"2026-01-29T21:50:06.000Z","size":220,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-09T18:21:26.647Z","etag":null,"topics":["defi","deterministic","financial-computation","no-std","precision-arithmetic","rust","wasm"],"latest_commit_sha":null,"homepage":"https://crates.io/crates/precision-core","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dijkstra-keystone.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE-APACHE","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":"2026-01-24T12:24:54.000Z","updated_at":"2026-01-29T21:50:09.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/dijkstra-keystone/keystone","commit_stats":null,"previous_names":["dijkstra-keystone/keystone"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/dijkstra-keystone/keystone","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dijkstra-keystone%2Fkeystone","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dijkstra-keystone%2Fkeystone/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dijkstra-keystone%2Fkeystone/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dijkstra-keystone%2Fkeystone/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dijkstra-keystone","download_url":"https://codeload.github.com/dijkstra-keystone/keystone/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dijkstra-keystone%2Fkeystone/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34353193,"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-15T02:00:07.085Z","response_time":63,"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":["defi","deterministic","financial-computation","no-std","precision-arithmetic","rust","wasm"],"created_at":"2026-06-15T08:01:19.299Z","updated_at":"2026-06-15T08:01:32.367Z","avatar_url":"https://github.com/dijkstra-keystone.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Keystone\n\nDeterministic precision arithmetic for financial computation and verifiable systems.\n\n[![CI](https://github.com/dijkstra-keystone/keystone/actions/workflows/ci.yml/badge.svg)](https://github.com/dijkstra-keystone/keystone/actions/workflows/ci.yml)\n[![crates.io](https://img.shields.io/crates/v/precision-core.svg)](https://crates.io/crates/precision-core)\n[![docs.rs](https://docs.rs/precision-core/badge.svg)](https://docs.rs/precision-core)\n[![License](https://img.shields.io/badge/license-MIT%2FApache--2.0-blue.svg)](LICENSE-MIT)\n\n## Why Keystone?\n\nDeFi protocols make critical decisions—liquidations, pricing, risk assessments—based on mathematical calculations. When your laptop, a validator node, and a WASM frontend compute the same formula and get *different* results due to floating-point inconsistencies, bad things happen.\n\nKeystone guarantees **bit-identical results** across x86, ARM, and WASM. No floating-point surprises. No platform-dependent rounding. The same input produces the same output, every time, everywhere.\n\n## Overview\n\nKeystone provides a suite of libraries for financial calculations with guaranteed determinism across platforms. Built for DeFi applications, verifiable computation, and any system requiring bit-exact reproducibility.\n\n## Crates\n\n| Crate | Description |\n|-------|-------------|\n| [precision-core](crates/precision-core) | 128-bit decimal arithmetic with 7 rounding modes |\n| [financial-calc](crates/financial-calc) | Interest, time value, options pricing, percentages |\n| [risk-metrics](crates/risk-metrics) | Health factor, liquidation, and position metrics |\n| [keystone-wasm](crates/wasm-bindings) | WebAssembly bindings for browser usage |\n\n## Stylus Examples\n\nReady-to-deploy examples for Arbitrum Stylus:\n\n| Example | Description |\n|---------|-------------|\n| [stylus-lending](examples/stylus-lending) | Health factor and liquidation calculations |\n| [stylus-amm](examples/stylus-amm) | Constant product AMM math |\n| [stylus-vault](examples/stylus-vault) | ERC4626-style vault calculations |\n\n### Deployed on Arbitrum One\n\n| Contract | Address |\n|----------|---------|\n| stylus-lending | [`0x4dff9348275ac3c24e2d3abf54af61d3ebee1585`](https://arbiscan.io/address/0x4dff9348275ac3c24e2d3abf54af61d3ebee1585) |\n| stylus-amm | [`0x9615cc2f65d8bbe4cdc80343db75a6ec32da93cd`](https://arbiscan.io/address/0x9615cc2f65d8bbe4cdc80343db75a6ec32da93cd) |\n| stylus-vault | [`0xdaf8f1a5f8025210f07665d4ccf2d2c0622a41fa`](https://arbiscan.io/address/0xdaf8f1a5f8025210f07665d4ccf2d2c0622a41fa) |\n\n## Features\n\n- **Deterministic**: Identical results on all platforms (x86, ARM, WASM)\n- **no_std**: Core library works in embedded and WASM environments\n- **Precise**: 128-bit decimals with up to 28 significant digits\n- **Safe**: `#![forbid(unsafe_code)]` throughout\n- **Financial**: Banker's rounding and 6 other rounding modes\n- **Fast**: Nanosecond-level operations (~8ns add, ~36ns divide)\n\n## Quick Start\n\n```rust\nuse precision_core::{Decimal, RoundingMode};\n\n// Create decimals\nlet price = Decimal::new(9999, 2);     // 99.99\nlet quantity = Decimal::from(5i64);\nlet tax_rate = Decimal::new(825, 4);   // 8.25%\n\n// Calculate\nlet subtotal = price.checked_mul(quantity)?;\nlet tax = subtotal.checked_mul(tax_rate)?;\nlet total = subtotal.checked_add(tax)?;\n\n// Round for display\nlet display = total.round(2, RoundingMode::HalfUp);\n```\n\n## WASM Usage\n\n```javascript\nimport * as keystone from '@dijkstra-keystone/wasm';\n\nconst subtotal = keystone.multiply(\"99.99\", \"5\");\nconst tax = keystone.multiply(subtotal, \"0.0825\");\nconst total = keystone.add(subtotal, tax);\nconst display = keystone.round(total, 2, \"half_up\");\n```\n\n## Documentation\n\n- [Online Documentation](https://docs.dijkstrakeystone.com)\n- [API Reference](https://docs.rs/precision-core)\n\n## Building\n\n```bash\n# Run tests\ncargo test --all\n\n# Build WASM\ncd crates/wasm-bindings\nwasm-pack build --target web --release\n\n# Build documentation\ncd docs \u0026\u0026 mdbook build\n```\n\n## Benchmarks\n\n| Operation | Time |\n|-----------|------|\n| Addition | ~8 ns |\n| Multiplication | ~8 ns |\n| Division | ~36 ns |\n| compound_interest | ~850 ns |\n\n```bash\ncargo bench\n```\n\n## License\n\nLicensed under either of:\n\n- Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE))\n- MIT License ([LICENSE-MIT](LICENSE-MIT))\n\nat your option.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdijkstra-keystone%2Fkeystone","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdijkstra-keystone%2Fkeystone","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdijkstra-keystone%2Fkeystone/lists"}