{"id":24054633,"url":"https://github.com/cardinal-cryptography/common-amm","last_synced_at":"2025-10-06T00:08:49.729Z","repository":{"id":217700876,"uuid":"636320055","full_name":"Cardinal-Cryptography/common-amm","owner":"Cardinal-Cryptography","description":null,"archived":false,"fork":false,"pushed_at":"2024-11-20T10:53:46.000Z","size":1849,"stargazers_count":12,"open_issues_count":0,"forks_count":9,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-03-29T18:41:36.721Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/Cardinal-Cryptography.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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-05-04T15:22:09.000Z","updated_at":"2025-03-06T13:50:08.000Z","dependencies_parsed_at":"2024-04-14T15:58:39.107Z","dependency_job_id":"d73be557-7fb3-4cd6-bbed-4ba3edc7b7e7","html_url":"https://github.com/Cardinal-Cryptography/common-amm","commit_stats":null,"previous_names":["cardinal-cryptography/common-amm"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cardinal-Cryptography%2Fcommon-amm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cardinal-Cryptography%2Fcommon-amm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cardinal-Cryptography%2Fcommon-amm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cardinal-Cryptography%2Fcommon-amm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Cardinal-Cryptography","download_url":"https://codeload.github.com/Cardinal-Cryptography/common-amm/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250322044,"owners_count":21411694,"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":[],"created_at":"2025-01-09T03:49:06.836Z","updated_at":"2025-10-06T00:08:44.698Z","avatar_url":"https://github.com/Cardinal-Cryptography.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ![Common logo](common_logo.svg \"Common logo\")\n\n\nThis repository contains implementations of AMM DEXes written for Common product.\n\nThere will be multiple AMM models implemented, each being the most suitable model for a certain token pair (stablecoin pairs being created in a CFM based on Curve StableSwap, PSP22 token pair on UniswapV2, etc.)\n\n## Purpose\n\nThis is an unaudited full dex implementation ready to be used.\n\n## Versions\n\n[ink! 4.3.0](https://github.com/paritytech/ink/tree/v4.3.0)\n`cargo-contract` in version `3.2.0`\n\n## License\n\nApache 2.0\n\n### 🏗️ How to use - Contracts\n\n##### 💫 Build\n\nUse these [instructions](https://use.ink/getting-started/setup) to set up your ink!/Rust environment.\nTo build all contracts, run this command from the project root directory:\n\n```sh\nmake build-all\n```\n\n##### 💫 Build verifiably\n\nGiven a deployed set of contracts with some code hashes, it's possible to check that the contract has been produced from a certain version of the source code in this repo (say a given commit). To do so:\n\n1. `git checkout $COMMIT`\n2. `make build-dockerized`.\n\nYou can also run `make build-dockerized` and ensure that the generated code hashes are the same as the ones found on chian.\n\nThe contracts will be deployed using the same docker image as the one used for this procedure, which smooths out indeterminism in ink! contract compilation.\n\nThe reason to build contracts with this command is to allow for _reproducible builds_ (ink! contracts' builds are not deterministic).\n\n##### How to verify\n\nCheck out the repository at commit `TODO` (after deployment) and in the root of the project run the command above. This will output contracts' builds to `/target/ink` directory. \n\nFor every contract there's a separate folder in which you will find `\u003ccontract\u003e.json` containing contract's metadata. One of the keys is `source.hash`. Compare that to the code hash of the on-chain contract.\n\n##### 💫 Wrap\n\nUse these [instructions](https://github.com/Cardinal-Cryptography/ink-wrapper#installation) to set up your `ink-wrapper` environment.\nOnce you have built your contracts, you can wrap them by running this command from the project root directory:\n\n```sh\nmake wrap-all\n```\n\nYou can also build and wrap the contracts in one step using:\n\n```sh\nmake build-and-wrap-all\n```\n\n##### 💫 Run checks\n\nRust code checks and unit tests can be run from the root directory of the project:\n\n```sh\nmake check-all\n```\n\n##### 💫 Run unit test\n\nTo manually run unit tests, use:\n\n```sh\ncargo test\n```\n\n##### 💫 Run E2E tests\n\nTo run the E2E test suite, execute the following command from the root directory of the project.\n\n```sh\nmake e2e-tests-with-setup-and-teardown\n```\n\nThis will:\n\n- Build and wrap your contracts.\n- Run a single node.\n- Sequentially run all the E2E test cases with setup.\n- Stop the node.\n\n##### 💫 Run drink!-based integration tests\n\nTo run drink!-based integration test suite, currently implemented only for `Farm` contract, go to `./farm` directory and run `make all-drink` - this will set up the tests and run them.\n\nFor more information about the framework see [here](./farm/tests/README.md).\n\n##### 💫 Deploy\n\nFirst start your local node. You can do that by running `make start-node` in the root directory of the project.\n\nTo deploy contracts, execute `npm run deploy-local` in the root directory.\n\nTo create sample tokens, execute `npm run create-tokens-local`.\nTo register them as pairs in the DEX, run `npm run add-liquidity-local`.\n\nNote that this requires rebuilding TypeScript wrappers first: `npm run compile`.\n\n##### 💫 Help\n\nYou can see a list of available `make` recipes by running:\n\n```sh\nmake help\n```\n\n## Acknowledgement\n\nThe contracts here implement a constant-product AMM based on the classical Uniswap V2 model. The initial version of the code has been developed by @HyunggyuJang, @PierreOssun and @shunsukew from Astar and was based on the Solidity implementation of UniswapV2. Since then, a multitude of fixes, enhancements, and alterations have been implemented to refine its functionality and address evolving needs. Through collaborative efforts and continuous improvement, the repository has undergone significant changes, paving the way for a more robust and efficient system that aligns with our current objectives.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcardinal-cryptography%2Fcommon-amm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcardinal-cryptography%2Fcommon-amm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcardinal-cryptography%2Fcommon-amm/lists"}