{"id":13566129,"url":"https://github.com/Derricks-DApps/contracts","last_synced_at":"2025-04-03T23:31:17.069Z","repository":{"id":181505036,"uuid":"666777242","full_name":"Derricks-DApps/contracts","owner":"Derricks-DApps","description":"📜 Smart contracts for the OKP4 network built on CosmWasm.","archived":false,"fork":true,"pushed_at":"2023-07-16T14:28:31.000Z","size":5810,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2024-11-04T20:42:15.748Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"axone-protocol/contracts","license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Derricks-DApps.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-07-15T14:42:26.000Z","updated_at":"2024-05-15T14:04:23.000Z","dependencies_parsed_at":"2023-09-24T15:13:35.870Z","dependency_job_id":null,"html_url":"https://github.com/Derricks-DApps/contracts","commit_stats":null,"previous_names":["derrick-dapps/contracts","derricks-dapps/contracts"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Derricks-DApps%2Fcontracts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Derricks-DApps%2Fcontracts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Derricks-DApps%2Fcontracts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Derricks-DApps%2Fcontracts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Derricks-DApps","download_url":"https://codeload.github.com/Derricks-DApps/contracts/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247097729,"owners_count":20883125,"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:02.683Z","updated_at":"2025-04-03T23:31:12.060Z","avatar_url":"https://github.com/Derricks-DApps.png","language":"Rust","funding_links":[],"categories":["Rust"],"sub_categories":[],"readme":"# 📜 OKP4 Smart Contracts\n\n\u003e [CosmWasm](https://cosmwasm.com) contracts for the [OKP4 network](http://okp4.network).\n\n[![release](https://img.shields.io/github/v/release/okp4/contracts?style=for-the-badge\u0026logo=github)](https://github.com/okp4/contracts/releases)\n[![build](https://img.shields.io/github/actions/workflow/status/okp4/contracts/build.yml?label=build\u0026style=for-the-badge\u0026logo=github)](https://github.com/okp4/contracts/actions/workflows/build.yml)\n[![lint](https://img.shields.io/github/actions/workflow/status/okp4/contracts/lint.yml?label=lint\u0026style=for-the-badge\u0026logo=github)](https://github.com/okp4/contracts/actions/workflows/lint.yml)\n[![test](https://img.shields.io/github/actions/workflow/status/okp4/contracts/test.yml?label=test\u0026style=for-the-badge\u0026logo=github)](https://github.com/okp4/contracts/actions/workflows/test.yml)\n[![coverage](https://img.shields.io/codecov/c/github/okp4/contracts?style=for-the-badge)](https://app.codecov.io/gh/okp4/contracts)\n[![conventional commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg?style=for-the-badge\u0026logo=conventionalcommits)](https://conventionalcommits.org)\n[![license](https://img.shields.io/badge/License-BSD_3--Clause-blue.svg?style=for-the-badge)](https://opensource.org/licenses/BSD-3-Clause)\n\n## ✨ Smart Contracts\n\nThis repository hosts Smart Contracts that are deployed on the [OKP4 network](http://okp4.network). But they are compatible with any\n[Cosmos blockchains](https://cosmos.network/) that uses the [CosmWasm](https://cosmwasm.com/) framework.\n\n### 🗄️ Storage oriented Smart Contracts\n\n| contract                                            |                          kind                          |    state    | description                          | status |\n|-----------------------------------------------------|:------------------------------------------------------:|:-----------:|--------------------------------------|:------:|\n| [objectarium](contracts/okp4-objectarium/README.md) | [object](https://en.wikipedia.org/wiki/Object_storage) | `immutable` | Persists unstructured data on-chain. |   ✅    |\n| [cognitarium](contracts/okp4-cognitarium/README.md) | [semantic](https://en.wikipedia.org/wiki/Triplestore)  |  `mutable`  | Persists semantic data on-chain.     |   🚧   |\n\n### ⚖️ Sovereignty oriented Smart Contracts\n\n| contract                                        |    state    | description                                                                                                                                                              | status |\n|-------------------------------------------------|:-----------:|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:------:|\n| [law-stone](contracts/okp4-law-stone/README.md) | `immutable` | Interprets the law (governance) expressed as [Prolog](https://en.wikipedia.org/wiki/Prolog) program and ensures the availability and immutability of the rules on-chain. |   ✅    |\n\n## 🗂 Directory Structure\n\nThe project is structured around a set of Rust workspaces, each defining a smart contract.\n\n```text\n.\n├── contracts\n│   └── \u003ccontract\u003e\n│       ├── Cargo.toml\n│       ├── examples\n│       ├── schema\n│       └── src\n├── packages\n│   └── \u003cpackage\u003e\n│       ├── Cargo.toml\n│       ├── examples\n│       └── src\n└─── Cargo.toml\n```\n\n## 🏗 Build\n\n### Pre-requisites\n\nBe sure you have the following tools installed:\n\n- [Rust](https://www.rust-lang.org/tools/install) v1.63.0 or higher\n- [cargo-make](https://github.com/sagiegurari/cargo-make) v0.36.3 or higher\n- [Docker](https://docs.docker.com/get-docker/)\n- [jq](https://stedolan.github.io/jq/download/) v1.6 or higher\n- [jsonschema2md](https://github.com/adobe/jsonschema2md) v7.1.15 or higher\n\nAnd the following common [GNU Core utilities](https://en.wikipedia.org/wiki/List_of_GNU_Core_Utilities_commands):\n\n- [shasum](https://linuxhint.com/shasum-linux/) v6.02 or higher\n- [sed](https://www.gnu.org/software/sed/) v4.8 or higher\n\n### Compiling Smart Contracts to Wasm\n\nTo compile the Smart Contracts to Wasm, just invoke the `wasm` goal of the makefile:\n\n```sh\ncargo make wasm\n```\n\nThis will install the rust Wasm toolchain, if not already done, and start the process for compiling the Smart Contracts\nto Wasm.\n\n### Test Smart Contracts\n\nThe Smart Contracts are under unit testing. The tests can be launched with the following invocation:\n\n```sh\ncargo make test-coverage\n```\n\n## 🏓 Play with the Smart Contracts\n\nThe project comes with a set of convenient tasks to manage the Smart Contracts and the blockchain.\nTo see the list of available tasks, run the following command:\n\n```sh\ncargo make --list-all-steps | grep chain | sort | sed -r 's/chain(-?[a-zA-Z\\-]*)/- `chain\\1`/'\n```\n\nThe list of available tasks for managing the chain is as follows:\n\n- `chain` - Run the okp4d CLI using the chain's home directory under a Docker container.\n- `chain-add-keys` - Add a set of predefined keys (recovered from the seed phrases) to the chain.\n- `chain-clean` - Clean the chain data (⚠️ definitively)\n- `chain-deploy-contract` - Deploy a specific contract to the chain. The contract must be compiled and the wasm file must be present in the artifacts directory (under target/wasm32-unknown-unknown/...).\n- `chain-deploy-contracts` - Deploy all the available contracts to the chain (under target/wasm32-unknown-unknown/...).\n- `chain-execute-contract` - Execute a command on a specific contract to the chain. The contract must be already deployed and instantiated.\n- `chain-init-folder` - Initialize deploy folder to make sure scripts have the right permission (needed for linux)\n- `chain-initialize` - Initialize the chain with a validator's key and a set of predefined keys. ⚠️ The home directory is cleaned before.\n- `chain-inspect-contract` - Inspect a specific contract deployed to the chain.\n- `chain-instantiate-contract` - Instantiate a specific contract to the chain. The contract must be already deployed.\n- `chain-list-contracts` - List all the contracts deployed to the chain.\n- `chain-logs` - Show the chain's container logs.\n- `chain-query-contract` - Query a specific contract to the chain. The contract must be already deployed and instantiated.\n- `chain-start` - Run the full node okp4d application using the chain's home directory under a Docker container.\n- `chain-stop` - Stop the chain's container.\n\n### Initialize the chain\n\nTo initialize the chain, just run:\n\n```sh\ncargo make chain-initialize\n```\n\nThis will initialize the chain's home directory and create a validator's key and a set of predefined keys\n(recovered from the seed phrases).\n\n### Start the chain\n\nTo start the chain, just run:\n\n```sh\ncargo make chain-start\n```\n\nThis will start the chain's container and run the full node wasmd application.\n\nYou can check the chain's logs with:\n\n```sh\ncargo make chain-logs\n```\n\n### Deploy the Smart Contracts\n\nTo deploy the Smart Contracts, just run:\n\n```sh\ncargo make chain-deploy-contracts\n```\n\nThis will deploy all the available contracts to the chain. For this, the contracts must be compiled and the wasm files\nmust be present in the artifacts directory. See the [Build](#-build) section for more details.\n\nNow, you can interact with the deployed smart contracts and test them out.\n\n### Free execution of the CLI command\n\nYou can freely interact with the local chain by executing the following CLI command. This will execute the `okp4d`\nbinary\ninside a Docker container with the `--home` argument pointing to the chain's home directory and using the same network\nas\nthe chain's container. The arguments passed to the command will be directly passed to the `okp4d` binary.\n\n```sh\ncargo make chain \u003ccommand\u003e\n```\n\nFor example, to check the status of the chain, just run:\n\n```sh\ncargo make chain status\n```\n\n### Stop the chain\n\nTo stop the chain, just run:\n\n```sh\ncargo make chain-stop\n```\n\n### Clean the chain\n\nTo clean the chain, just run:\n\n```sh\ncargo make chain-clean\n```\n\n⚠️ Please be cautious when running this command as it will completely clean the chain's home directory and the action is\nirreversible.\n\n## Documentation\n\nTo generate the documentation follow the steps below.\n\n### Tools installation\n\nBe sure you have the following tools installed:\n\n- [Yarn](https://classic.yarnpkg.com/en/docs/install) v1.22.10 or higher\n\nThen, install the dependencies:\n\n```sh\nyarn global add @adobe/jsonschema2md@7.1.5\n```\n\n### Generate the documentation\n\nTo generate the documentation, just run:\n\n```sh\ncargo make schema\ncargo make generate_docs\n```\n\nYou'll find the generated documentation under the `docs` folder.\n\n### Commit the documentation\n\nWhen developing a new contract, you should commit the generated documentation to the repository. For this, gerenate the\ndocumentation and commit the changes:\n\n```sh\ngit commit -am \"docs: update generated documentation\"\n```\n\n## Resources\n\n- [CosmWasm Docs](https://docs.cosmwasm.com/)\n- [OKP4 Whitepaper](https://docs.okp4.network/whitepaper/abstract)\n- [OKP4 Blockchain](https://githhub.com/okp4/okp4d)\n\n## You want to get involved? 😍\n\nSo you want to contribute? Great! ❤️ We appreciate any help you're willing to give. Don't hesitate to open issues and/or\nsubmit pull requests.\n\nPlease check out OKP4 health files:\n\n- [Contributing](https://github.com/okp4/.github/blob/main/CONTRIBUTING.md)\n- [Code of conduct](https://github.com/okp4/.github/blob/main/CODE_OF_CONDUCT.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FDerricks-DApps%2Fcontracts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FDerricks-DApps%2Fcontracts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FDerricks-DApps%2Fcontracts/lists"}