{"id":13566300,"url":"https://github.com/mars-protocol/contracts","last_synced_at":"2025-12-30T00:04:05.970Z","repository":{"id":65591617,"uuid":"507113143","full_name":"mars-protocol/contracts","owner":"mars-protocol","description":"Smart contracts for Mars Protocol","archived":false,"fork":false,"pushed_at":"2025-04-01T09:14:02.000Z","size":12355,"stargazers_count":49,"open_issues_count":10,"forks_count":22,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-04-01T10:25:30.335Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mars-protocol.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":"audit.txt","citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-06-24T18:48:56.000Z","updated_at":"2025-04-01T09:14:03.000Z","dependencies_parsed_at":"2024-02-26T23:30:07.589Z","dependency_job_id":"ec5ac127-77e3-4dbf-a324-331db71f420e","html_url":"https://github.com/mars-protocol/contracts","commit_stats":{"total_commits":581,"total_committers":24,"mean_commits":"24.208333333333332","dds":0.7211703958691911,"last_synced_commit":"9c861d8ae1704f0f4694b591c7b5352953eaef31"},"previous_names":["mars-protocol/red-bank"],"tags_count":29,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mars-protocol%2Fcontracts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mars-protocol%2Fcontracts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mars-protocol%2Fcontracts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mars-protocol%2Fcontracts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mars-protocol","download_url":"https://codeload.github.com/mars-protocol/contracts/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247103305,"owners_count":20884023,"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":"2024-08-01T13:02:06.568Z","updated_at":"2025-12-30T00:04:05.956Z","avatar_url":"https://github.com/mars-protocol.png","language":"Rust","funding_links":[],"categories":["Rust"],"sub_categories":[],"readme":"# Smart contracts for Mars Outposts\n\nThis repository contains the source code for the core smart contracts of Mars Protocol. Smart contracts are meant to be compiled to `.wasm` files and uploaded to the Cosmos chains.\n\n## Audits\n\nSee reports for red-bank and rover [here][1].\n\n## Bug bounty\n\nA bug bounty is currently open for these contracts. See details [here][2].\n\n## Verify contracts\n\n### For contracts deployed on the Osmosis chain\n\n1. Install [Osmosisd][3]\n\n2. Get the wasm binary executable on your local machine.\n\n   ```bash\n   git clone https://github.com/mars-protocol/contracts.git\n   git checkout \u003ccommit-id\u003e\n   cargo make rust-optimizer\n   ```\n\n   Note: Intel/Amd 64-bit processor is required. While there is experimental ARM support for CosmWasm/rust-optimizer, it's discouraged to use in production and the wasm bytecode will not match up to an Intel compiled wasm file.\n\n3. Download the wasm from the chain.\n\n   ```bash\n   osmosisd query wasm code $CODEID -- $NODE download.wasm\n   ```\n\n4. Verify that the diff is empty between them. If any value is returned, then the wasm files differ.\n\n   ```bash\n   diff artifacts/$CONTRACTNAME.wasm download.wasm\n   ```\n\n5. Alternatively, compare the wasm files' checksums:\n\n   ```bash\n   sha256sum artifacts/$CONTRACTNAME.wasm download.wasm\n   ```\n\n## Environment set up\n\n- Install [cargo-make][4]\n\n  ```bash\n  cargo install --force cargo-make\n  ```\n\n- Install [rust][5]\n\n  ```bash\n  cargo make install-stable\n  ```\n\n- Install [Docker][6]\n\n- Install [Node.js v16][7]\n\n- Install [Yarn][8]\n\n- Create the build folder:\n\n   ```bash\n   cd scripts\n   yarn\n   yarn build\n   ```\n\n- Compile all contracts:\n\n  ```bash\n  cargo make rust-optimizer\n  ```\n\n- Formatting:\n\n   ```bash\n   cd scripts\n   yarn format\n   yarn lint\n   ```\n\nThis compiles and optimizes all contracts, storing them in `/artifacts` directory along with `checksum.txt` which contains sha256 hashes of each of the `.wasm` files (The script just uses CosmWasm's [rust-optimizer][9]).\n\n**Note:** Intel/Amd 64-bit processor is required. While there is experimental ARM support for CosmWasm/rust-optimizer, it's discouraged to use in production.\n\n## Deployment\n\nWhen the deployment scripts run for the first time, it will upload code IDs for each contract, instantiate each contract, initialize assets, and set oracles. If you want to redeploy, you must locally delete the file with `.json` extension (e.g. `devnet-deployer-owner.json`) in the artifacts directory.\n\nEverything related to deployment must be ran from the `scripts` directory.\n\nEach outpost has a config file for its respective deployment and assets.\n\nFor Osmosis:\n\n```bash\ncd scripts\n\n# for devnet deployment with deployerAddr set as owner \u0026 admin:\nyarn deploy:osmosis-devnet\n\n# for mainnet deployment:\nyarn deploy:osmosis-mainnet\n```\n\n## Schemas\n\n```bash\ncargo make --makefile Makefile.toml generate-all-schemas\n```\n\nCreates JSON schema files for relevant contract calls, queries and query responses (See: [cosmwams-schema][10]).\n\n## Linting\n\n`rustfmt` is used to format any Rust source code:\n\n```bash\ncargo make fmt\n```\n\n`clippy` is used as a linting tool:\n\n```bash\ncargo make clippy\n```\n\n## Testing\n\nInstall [Go][38]. It is used by [osmosis-test-tube][39] dependency.\n\nIntegration tests (task `integration-test` or `test`) use `.wasm` files. They have to be generated with `cargo make build`.\n\nRun unit tests:\n\n```bash\ncargo make unit-test\n```\n\nRun integration tests:\n\n```bash\ncargo make integration-test\n```\n\nRun all tests:\n\n```bash\ncargo make test\n```\n\n## Deployments\n\n### osmosis-1\n\n| Contract               | Address                                                                 | Tag\n| ---------------------- | ----------------------------------------------------------------------- | --------------------\n| mars-address-provider  | [`osmo1g677w7mfvn78eeudzwylxzlyz69fsgumqrscj6tekhdvs8fye3asufmvxr`][11] | [`v2.1.0-osmo`][40] |\n| mars-account-nft       | [`osmo1450hrg6dv2l58c0rvdwx8ec2a0r6dd50hn4frk370tpvqjhy8khqw7sw09`][12] | [`v2.1.0-osmo`][40] |\n| mars-credit-manager    | [`osmo1f2m24wktq0sw3c0lexlg7fv4kngwyttvzws3a3r3al9ld2s2pvds87jqvf`][13] | [`v2.1.0-osmo`][40] |\n| mars-health            | [`osmo1pdc49qlyhpkzx4j24uuw97kk6hv7e9xvrdjlww8qj6al53gmu49sge4g79`][14] | [`v2.1.0-osmo`][40] |\n| mars-incentives        | [`osmo1nkahswfr8shg8rlxqwup0vgahp0dk4x8w6tkv3rra8rratnut36sk22vrm`][15] | [`v2.1.0-osmo`][40] |\n| mars-oracle            | [`osmo1mhznfr60vjdp2gejhyv2gax9nvyyzhd3z0qcwseyetkfustjauzqycsy2g`][16] | [`v2.1.0-osmo`][40] |\n| mars-params            | [`osmo1nlmdxt9ctql2jr47qd4fpgzg84cjswxyw6q99u4y4u4q6c2f5ksq7ysent`][17] | [`v2.1.0-osmo`][40] |\n| mars-red-bank          | [`osmo1c3ljch9dfw5kf52nfwpxd2zmj2ese7agnx0p9tenkrryasrle5sqf3ftpg`][18] | [`v2.1.0-osmo`][40] |\n| mars-rewards-collector | [`osmo1urvqe5mw00ws25yqdd4c4hlh8kdyf567mpcml7cdve9w08z0ydcqvsrgdy`][19] | [`v2.1.0-osmo`][40] |\n| mars-swapper           | [`osmo1wee0z8c7tcawyl647eapqs4a88q8jpa7ddy6nn2nrs7t47p2zhxswetwla`][20] | [`v2.1.0-osmo`][40] |\n| mars-zapper            | [`osmo17qwvc70pzc9mudr8t02t3pl74hhqsgwnskl734p4hug3s8mkerdqzduf7c`][21] | [`v2.1.0-osmo`][40] |\n\n### neutron-1\n\nSee repo: [core-contracts][41]\n\n### mars-1\n\n| Module Account  | Address                                             |\n| --------------- | --------------------------------------------------- |\n| `fee_collector` | [`mars17xpfvakm2amg962yls6f84z3kell8c5ldy6e7x`][36] |\n| `safety`        | [`mars1s4hgh56can3e33e0zqpnjxh0t5wdf7u3pze575`][37] |\n\n## License\n\nContents of this repository are open source under [GNU General Public License v3](./LICENSE) or later.\n\n[1]: https://github.com/mars-protocol/mars-audits\n[2]: https://immunefi.com/bounty/mars/\n[3]: https://docs.osmosis.zone/osmosis-core/osmosisd/\n[4]: https://github.com/sagiegurari/cargo-make\n[5]: https://rustup.rs/\n[6]: https://docs.docker.com/get-docker/\n[7]: https://github.com/nvm-sh/nvm\n[8]: https://classic.yarnpkg.com/lang/en/docs/install/#mac-stable\n[9]: https://github.com/CosmWasm/rust-optimizer\n[10]: https://github.com/CosmWasm/cosmwasm/tree/main/packages/schema\n[11]: https://osmosis.celat.one/osmosis-1/contracts/osmo1g677w7mfvn78eeudzwylxzlyz69fsgumqrscj6tekhdvs8fye3asufmvxr\n[12]: https://osmosis.celat.one/osmosis-1/contracts/osmo1450hrg6dv2l58c0rvdwx8ec2a0r6dd50hn4frk370tpvqjhy8khqw7sw09\n[13]: https://osmosis.celat.one/osmosis-1/contracts/osmo1f2m24wktq0sw3c0lexlg7fv4kngwyttvzws3a3r3al9ld2s2pvds87jqvf\n[14]: https://osmosis.celat.one/osmosis-1/contracts/osmo1pdc49qlyhpkzx4j24uuw97kk6hv7e9xvrdjlww8qj6al53gmu49sge4g79\n[15]: https://osmosis.celat.one/osmosis-1/contracts/osmo1nkahswfr8shg8rlxqwup0vgahp0dk4x8w6tkv3rra8rratnut36sk22vrm\n[16]: https://osmosis.celat.one/osmosis-1/contracts/osmo1mhznfr60vjdp2gejhyv2gax9nvyyzhd3z0qcwseyetkfustjauzqycsy2g\n[17]: https://osmosis.celat.one/osmosis-1/contracts/osmo1nlmdxt9ctql2jr47qd4fpgzg84cjswxyw6q99u4y4u4q6c2f5ksq7ysent\n[18]: https://osmosis.celat.one/osmosis-1/contracts/osmo1c3ljch9dfw5kf52nfwpxd2zmj2ese7agnx0p9tenkrryasrle5sqf3ftpg\n[19]: https://osmosis.celat.one/osmosis-1/contracts/osmo1urvqe5mw00ws25yqdd4c4hlh8kdyf567mpcml7cdve9w08z0ydcqvsrgdy\n[20]: https://osmosis.celat.one/osmosis-1/contracts/osmo1wee0z8c7tcawyl647eapqs4a88q8jpa7ddy6nn2nrs7t47p2zhxswetwla\n[21]: https://osmosis.celat.one/osmosis-1/contracts/osmo17qwvc70pzc9mudr8t02t3pl74hhqsgwnskl734p4hug3s8mkerdqzduf7c\n[22]: https://osmosis.celat.one/osmosis-1/contracts/osmo1kqzkuyh23chjwemve7p9t7sl63v0sxtjh84e95w4fdz3htg8gmgspua7q4\n[23]: https://osmosis.celat.one/osmosis-1/contracts/osmo1aye5qcer5n52crrkaf35jprsad2807q6kg3eeeu7k79h4slxfausfqhc9y\n[36]: https://www.mintscan.io/mars-protocol/accounts/mars17xpfvakm2amg962yls6f84z3kell8c5ldy6e7x\n[37]: https://www.mintscan.io/mars-protocol/accounts/mars1s4hgh56can3e33e0zqpnjxh0t5wdf7u3pze575\n[38]: https://go.dev/\n[39]: https://github.com/osmosis-labs/test-tube\n[40]: https://github.com/mars-protocol/contracts/releases/tag/v2.1.0-osmo\n[41]: https://github.com/mars-protocol/core-contracts?tab=readme-ov-file#neutron-1","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmars-protocol%2Fcontracts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmars-protocol%2Fcontracts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmars-protocol%2Fcontracts/lists"}