{"id":13728604,"url":"https://github.com/mars-protocol/v1-core","last_synced_at":"2026-03-10T12:34:35.940Z","repository":{"id":39646575,"uuid":"356711226","full_name":"mars-protocol/v1-core","owner":"mars-protocol","description":null,"archived":false,"fork":false,"pushed_at":"2022-12-02T08:54:56.000Z","size":762,"stargazers_count":43,"open_issues_count":2,"forks_count":19,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-02-16T08:48:52.029Z","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":"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":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-04-10T22:32:08.000Z","updated_at":"2024-12-08T02:10:05.000Z","dependencies_parsed_at":"2023-01-23T17:46:12.586Z","dependency_job_id":null,"html_url":"https://github.com/mars-protocol/v1-core","commit_stats":null,"previous_names":["mars-protocol/mars-core"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/mars-protocol/v1-core","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mars-protocol%2Fv1-core","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mars-protocol%2Fv1-core/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mars-protocol%2Fv1-core/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mars-protocol%2Fv1-core/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mars-protocol","download_url":"https://codeload.github.com/mars-protocol/v1-core/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mars-protocol%2Fv1-core/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30333557,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-10T05:25:20.737Z","status":"ssl_error","status_checked_at":"2026-03-10T05:25:17.430Z","response_time":106,"last_error":"SSL_read: 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":[],"created_at":"2024-08-03T02:00:45.757Z","updated_at":"2026-03-10T12:34:35.891Z","avatar_url":"https://github.com/mars-protocol.png","language":"Rust","funding_links":[],"categories":["External Projects"],"sub_categories":["Other Contracts"],"readme":"# Mars Protocol\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 [Terra](https://www.terra.money/) blockchain.\n\n## Bug bounty\nA bug bounty is currently open for these contracts. See details at: https://immunefi.com/bounty/marsprotocol/\n\n## Verify contracts\n\nFollow these instructions to verify that the smart contracts that exist on chain correspond to a particular version of the contract's source code:\n\n1. Find the code ID of the contract you wish to verify.\n\n    This can be found on the smart contract's page on [Terra Finder](https://finder.terra.money/).\n    \n2. Get the SHA256 checksum of the code ID's wasm binary:\n    - One way to do this is to get the checksum directly from the blockchain:\n\n    ```\n    curl \"https://fcd.terra.dev/terra/wasm/v1beta1/codes/${CODE_ID}\" \\\n      | jq \".code_info.code_hash\" \\\n      | tr -d \\\" \\\n      | base64 -d \\\n      | hexdump -v -e '/1 \"%02x\"'\n    ```\n\n    - Alternatively, download the wasm byte code relating to the code ID from the blockchain and calculate its SHA256 checksum:\n\n    ```\n    curl \"https://fcd.terra.dev/terra/wasm/v1beta1/codes/${CODE_ID}/byte_code\" \\\n      | jq \".byte_code\" \\\n      | tr -d \\\" \\\n      | base64 -d \\\n      | shasum -a 256\n    ```\n\n3. Get the SHA256 checksum of a smart contract's wasm binary built from source code. To do this, first clone this repo, checkout a particular release, compile the smart contracts using the same version of [rust-optimizer](https://github.com/CosmWasm/rust-optimizer) listed in the [releases](https://github.com/mars-protocol/mars-core/releases), and verify the checksum written to `artifacts/checksums.txt`.\n4. Finally, verify that the two checksums are identical.\n\n## Building\n\n### Smart contracts\n```\n./scripts/build_artifacts.sh\n```\n\nCompiles 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](https://github.com/CosmWasm/rust-optimizer)).\n\n### Schemas\n```\n./scripts/build_schema.sh\n```\n\nIs equivalent of running `cargo schema` in each of the smart contracts in `/contracts` directory, which creates JSON schema files for relevant contract calls, quieries and query responses (See: [cosmwams-schema](https://github.com/CosmWasm/cosmwasm/tree/main/packages/schema).\n\n## Linting\n`rustfmt` is used to format any Rust source code:\n\n```\ncargo fmt\n```\n\n`clippy` is used as a linting tool:\n\n```\ncargo +nightly clippy --tests --all-features -- -D warnings\n```\n\n## Setup for Node.js scripts\n\nNode.js scripts are used for deploying and integration testing. These scripts must be run from the `scripts` directory.\n\nSetup:\n\n```\ncd scripts\nnpm install\n```\n\nTypeScript scripts must be executed with `ts-node` using:\n\n```\nnode --loader ts-node/esm \u003cscript\u003e.ts\n```\n\n\n## Deploying\n```\n# build the smart contracts\n./scripts/build_artifacts.sh\n\ncd scripts\nnpm install\n\n# set the deploying wallet\necho \"TEST_MAIN=\u003cMNEMONIC_OF_YOUR_DEPLOYING_WALLET\u003e\" \u003e\u003e .env\n\n# set the network, defaults to LocalTerra if unset\necho \"NETWORK=testnet\" \u003e\u003e .env\n\n# ensure the deploy_config.ts has a cw20_code_id specified for above network\n\nnode --loader ts-node/esm deploy.ts\n```\n\n## Testing\n### Unit tests\n\n```\n# inside a package to run specific package tests\ncargo unit-test\n\n# in the root directory to run all tests\ncargo test\n```\n\n### Integration tests\n\n#### Local Terra\nIntegration tests require LocalTerra to be running:\n\n```\ngit clone https://github.com/terra-money/LocalTerra.git\ncd LocalTerra\ndocker compose up\n```\n\nAdjust the `timeout_*` config items in `LocalTerra/config/config.toml` to `250ms` to make the test run faster:\n\n```\nsed -E -I .bak '/timeout_(propose|prevote|precommit|commit)/s/[0-9]+m?s/250ms/' config/config.toml\n```\n\n#### Environment variables\nRequired environment variables (can be set in `scripts/.env`):\n\n```sh\nCW_PLUS_ARTIFACTS_PATH # path to cw-plus artifacts (example cw20-base.wasm)\nASTROPORT_ARTIFACTS_PATH # path to astroport artifacts\nMARS_MOCKS_ARTIFACTS_PATH # path to mars-mocks artifacts\n```\n\n#### Running a single integration test\n```\ncd scripts\nnode --loader ts-node/esm tests/\u003ctest\u003e.ts\n```\n\n#### Running the main integration test suite\n\n1. Get LocalTerra repo and set `LOCAL_TERRA_REPO_PATH` env variable to its path.\n2. Run `run_tests.sh` from the scripts directory:\n```\ncd scripts\n./run_tests.sh\n```\n\n## Generating a whitelist.json\n\n1. Create a .env file in the top level of the scripts directory if doesn't already exist\n2. Add the env variable NETWORK=[network_to_generate_from_e.g._NETWORK=testnet]\n3. Add the env variable REDBANK_ADDRESS=[your_deployed_red_bank_contract_address]\n4. Run `node --loader ts-node/esm whitelist.ts`\n5. Check the whitelists folder for [NETWORK].json output\n\n## License\n\nContents of this repository are open source under [GNU General Public License v3](https://www.gnu.org/licenses/gpl-3.0.en.html) or later.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmars-protocol%2Fv1-core","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmars-protocol%2Fv1-core","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmars-protocol%2Fv1-core/lists"}