From 76926c909497b6dd92012431c838cca65d9b6f3c Mon Sep 17 00:00:00 2001 From: Bot Anik <98603954+bot-anik@users.noreply.github.com> Date: Fri, 24 Mar 2023 17:20:37 +0000 Subject: [PATCH] chore(release): perform release 1.0.0 --- CHANGELOG.md | 120 +++++++++++++++++++++++++++++ contracts/cw-law-stone/Cargo.toml | 2 +- contracts/cw-storage/Cargo.toml | 2 +- docs/schema/cw-law-stone.json | 2 +- docs/schema/cw-storage.json | 2 +- packages/logic-bindings/Cargo.toml | 2 +- 6 files changed, 125 insertions(+), 5 deletions(-) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 00000000..d2a51556 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,120 @@ +# ØKP4 contracts + +## 1.0.0 (2023-03-24) + + +### Features + +* add bucket query ([4d9976d](https://github.com/okp4/contracts/commit/4d9976d316ca0d327dc70947f133accf6800d18d)) +* add cw-template ([72d943e](https://github.com/okp4/contracts/commit/72d943e373e35e6679b94cc547b45c55dfe170e3)) +* **ci:** add update draft doc trigger ([8ee54dd](https://github.com/okp4/contracts/commit/8ee54dd33bae17245d5b254dc6554619c779d769)) +* **cw-storage:** add bucket limits ([604086f](https://github.com/okp4/contracts/commit/604086f56e12f32317d5760c3894ac1d505fcff4)) +* **cw-storage:** add ObjectData query ([a022a00](https://github.com/okp4/contracts/commit/a022a00435bf65d015f4c720453d70b58571cf07)) +* **cw-storage:** specify contract ([2080e5c](https://github.com/okp4/contracts/commit/2080e5c9ba628ba3201a23277db9e0e5ba929393)) +* **docs:** add documentations title on attribute ([48cc0b9](https://github.com/okp4/contracts/commit/48cc0b9b62564a4347628ea976ebbda743af3d01)) +* **docs:** add script to improve docs description ([b26698c](https://github.com/okp4/contracts/commit/b26698cc8df812a9ef88f3311982f418e0bd93ea)) +* **docs:** change struct comment to be displayed on generated docs ([7bdf548](https://github.com/okp4/contracts/commit/7bdf548c175caec05e3294f84dce3189e6badadd)) +* **docs:** check if jsonschema2md is present ([70bc47b](https://github.com/okp4/contracts/commit/70bc47bb4ad1a6ece5d557be8388307684d0d763)) +* **docs:** fail generate docs if jsonschema2md is not installed ([c22e902](https://github.com/okp4/contracts/commit/c22e9020cc66a9d4cbad37a58021a12dd268368d)) +* **docs:** generate documentation ([a88941d](https://github.com/okp4/contracts/commit/a88941d624a3cc20e16668eb9299310dce7107ab)) +* **docs:** generate documentation with jsonschema2md ([5b165e3](https://github.com/okp4/contracts/commit/5b165e3e1a99b17f29f26b9325cccbe1ab439fc1)) +* **docs:** ignore docs folder from markdown linter ([4c7011d](https://github.com/okp4/contracts/commit/4c7011df3e16844674d039383204c43f3dc16a39)) +* **docs:** lint changed docs files ([068a719](https://github.com/okp4/contracts/commit/068a719fe0851bbdd30896730e2b849f00d6a8ca)) +* **docs:** mulitple schema generation ([958093b](https://github.com/okp4/contracts/commit/958093be1f190a30d95d8b85360d1fe74172bfc5)) +* **docs:** only ignore json schema on contract folder ([6a43254](https://github.com/okp4/contracts/commit/6a43254aafb2bc34339466fb2e2087c2d02d90eb)) +* **docs:** publish docs ([63c533b](https://github.com/okp4/contracts/commit/63c533bc5a9e21a0799d29f2f6492b3be7a6420f)) +* **docs:** remove schema folder from git ([8eae25d](https://github.com/okp4/contracts/commit/8eae25dea8dfbaf373313aca3e3e92592c8fd8e8)) +* **docs:** rm docs folder before generation ([65ddb99](https://github.com/okp4/contracts/commit/65ddb993e82ac7861393f5fc566d52822be0fc8d)) +* **docs:** trigger the docs workflow to update documentation ([e50e401](https://github.com/okp4/contracts/commit/e50e401a1c55382858a5182d69633b76d47cbde9)) +* **gov:** add query retrieving program location ([7ab021f](https://github.com/okp4/contracts/commit/7ab021fd9251e515031a2495f036b48cb873db18)) +* **gov:** design contract messages ([bb54756](https://github.com/okp4/contracts/commit/bb54756bb7b22425f605d09c67d6364488744d72)) +* **law:** add break stone exec signature ([263e6db](https://github.com/okp4/contracts/commit/263e6db72df195668497400a77102e51e87cf159)) +* **law:** add broken flag in state ([f82073f](https://github.com/okp4/contracts/commit/f82073fbde72e18cf49349367dc7a6e93f669216)) +* **law:** add Law state + tests ([35e8e91](https://github.com/okp4/contracts/commit/35e8e9199742f27aff5dde678cf19bf67f66bdde)) +* **law:** add uri parser to Object ([3ec96b2](https://github.com/okp4/contracts/commit/3ec96b210ec7b5bfa293b4007024f08871ef5452)) +* **law:** check if law is broken before ask ([0cdf648](https://github.com/okp4/contracts/commit/0cdf64868fc200cb36b445c5be94c497a030ed23)) +* **law:** create temporary context on instantiate ([e9de097](https://github.com/okp4/contracts/commit/e9de097d6f013663404d695594fd9841dff2dc3c)) +* **law:** impl Ask query ([af37eb7](https://github.com/okp4/contracts/commit/af37eb7fd213912cce571bb093a103267ed87371)) +* **law:** impl from on ObjectResponse ([17e31d1](https://github.com/okp4/contracts/commit/17e31d1b7f6620c4846adf5ff6c8ac17519b703c)) +* **law:** impl into StdError on ContractError ([d59b268](https://github.com/okp4/contracts/commit/d59b2685fa029a0088d1252ea666c39bfc0c3306)) +* **law:** implement instantiate ([2adaa5b](https://github.com/okp4/contracts/commit/2adaa5b76009bb036f4cbc8002985a20a8bcd32b)) +* **law:** implement the program query ([fe4b0da](https://github.com/okp4/contracts/commit/fe4b0da6ac5aae0f36cd264279a5e6eba593ba44)) +* **law:** implements break stone exec msg ([c28535f](https://github.com/okp4/contracts/commit/c28535f3ea8fba9222d2fd1cf13df73cd1c58a90)) +* **law:** implements object to uri mapping ([06df729](https://github.com/okp4/contracts/commit/06df729421747dcc81148b620f072287115da362)) +* **law:** implements source_files ask query ([c27c2db](https://github.com/okp4/contracts/commit/c27c2db1d5e2338a34513b1bdde403419e98fe19)) +* **law:** instantiate with sub message store ([8819c38](https://github.com/okp4/contracts/commit/8819c3824d823d120915176e158d9db088cec9ed)) +* **law:** update state with object and dependencies ([314bf4a](https://github.com/okp4/contracts/commit/314bf4aa09003b485ae90a93c8697dd72e52842a)) +* **logic:** add a sample logic query contract ([8a67c8d](https://github.com/okp4/contracts/commit/8a67c8d530d13541ee1fd7e452c630a76825b052)) +* **logic:** introduce logic module bindings ([465a4fe](https://github.com/okp4/contracts/commit/465a4fe30f20f94536e11ec46d446c5fa8fcceb1)) +* remove main.rs ([62090ca](https://github.com/okp4/contracts/commit/62090ca74657f35058c5455ed6c51ea397fd3a98)) +* **schema:** generate schema not at workspace place ([c1b1f28](https://github.com/okp4/contracts/commit/c1b1f28c5babc9fd52bacac2eccc8460d082ef3f)) +* **storage:** add cursor bs58 encoding helpers ([1e7c2bc](https://github.com/okp4/contracts/commit/1e7c2bc07594143bc18e9f970dda704452a14fe4)) +* **storage:** add execute PinObject ([07f5e37](https://github.com/okp4/contracts/commit/07f5e378f070cdef427806edfda78bc2a1444b6b)) +* **storage:** add pagination configuration ([6eeb157](https://github.com/okp4/contracts/commit/6eeb157902ad946f5ec1d411df5e994375d09979)) +* **storage:** add pin count attribute on Object ([04d8bff](https://github.com/okp4/contracts/commit/04d8bfff8cdfb9451a94a802fbcb205c414077e4)) +* **storage:** add queries dummy impl ([23f6de9](https://github.com/okp4/contracts/commit/23f6de9d130bfa56d6a0841b4f4c7857040c5b2d)) +* **storage:** add sha256 hash computation util ([ada8714](https://github.com/okp4/contracts/commit/ada8714eaeb2589c3c3442b03096f2477ac4ccfc)) +* **storage:** add the query to get bucket information ([35b6184](https://github.com/okp4/contracts/commit/35b6184c9478c53b44f08bd645ba319072c73184)) +* **storage:** add total size to bucket state ([ce5d622](https://github.com/okp4/contracts/commit/ce5d62291e2e98666ada3b7344bc3c10c8479034)) +* **storage:** check if bucket name is not empty ([eb193db](https://github.com/okp4/contracts/commit/eb193db394143dfdaa3ebbc2fadc5788e8c9ae03)) +* **storage:** create bucket state ([53e2b8c](https://github.com/okp4/contracts/commit/53e2b8c2ac5bc9c133c3076b04bc913a97b7689c)) +* **storage:** define errors related to bucket limits ([4c6587d](https://github.com/okp4/contracts/commit/4c6587d6c125578002dc29b44cd8cb48be66864d)) +* **storage:** enhance error context ([c7e33d8](https://github.com/okp4/contracts/commit/c7e33d813d162cc50bac941751ee0802efa01e39)) +* **storage:** implement the forget object execute message ([52f1666](https://github.com/okp4/contracts/commit/52f16661c60c70a4f608c1913b48693181cd0cb3)) +* **storage:** implement unpin object ([94613c5](https://github.com/okp4/contracts/commit/94613c5dab60ba8a837aec9ca5985948c1f4b822)) +* **storage:** implements data state structure ([0212af3](https://github.com/okp4/contracts/commit/0212af383e0f80bfe71a60e50283f69f0d6a813f)) +* **storage:** implements object data query ([11267fa](https://github.com/okp4/contracts/commit/11267fa6009b89540705af7aa192eb02699f073e)) +* **storage:** implements object pins query ([af9d04f](https://github.com/okp4/contracts/commit/af9d04ffaebc3f875e59bcf13c076cbf191706ed)) +* **storage:** implements object query ([5bccebd](https://github.com/okp4/contracts/commit/5bccebd744d3bf4aa96f3420f8ee7f8ea9cce47a)) +* **storage:** implements objects query ([4326b4c](https://github.com/okp4/contracts/commit/4326b4c539ec4f3ae275de930438f246b7e7623e)) +* **storage:** implements objects state structure ([cf67f3e](https://github.com/okp4/contracts/commit/cf67f3e6d77ce386d8572249b7605a447ffe4d8a)) +* **storage:** implements pins state structure ([467c2da](https://github.com/okp4/contracts/commit/467c2daf50cf827d67473aee16c1365e092e337f)) +* **storage:** implements store object exec msg ([8a1b618](https://github.com/okp4/contracts/commit/8a1b618598507d98ccf62f7431091613b809d2e4)) +* **storage:** instantiate bucket ([c56df54](https://github.com/okp4/contracts/commit/c56df546f5470dd63c5b60a3774a8e3db419dc31)) +* **storage:** load buckect only if object exist ([57327db](https://github.com/okp4/contracts/commit/57327db4a4f7cc28690680dcfd9b8f227d13bbeb)) +* **storage:** persist bucket owner address ([758ed9a](https://github.com/okp4/contracts/commit/758ed9a7fe1e3f0b8a91f5e54ed6bfc1605ad73c)) +* **storage:** persist object count in bucket state ([e233791](https://github.com/okp4/contracts/commit/e2337916afb482ba1380bcbb8161c332c1fe3a11)) +* **storage:** remove address index on pins state ([05e07ec](https://github.com/okp4/contracts/commit/05e07ec3099881a49fc9b9dce3f19423b7927e25)) +* **storage:** remove unused NotImplemented error ([7cbb7c6](https://github.com/okp4/contracts/commit/7cbb7c6f864aa23199a91358fda4cee8e856ec87)) +* **storage:** remove whitespace from bucket name ([403451b](https://github.com/okp4/contracts/commit/403451b861e40f02832c7c70b93c859d33d9803c)) +* **storage:** return error when storing already stored object ([da89b6f](https://github.com/okp4/contracts/commit/da89b6fd7afd32f4aabf4660a5c6bfd7376d4ba1)) +* **storage:** try to generify pagination logic ([e229988](https://github.com/okp4/contracts/commit/e2299887cc1748a02f4fb3d17628c00f08cbb5f0)) +* **storage:** unpin sender on forget ([9f027ca](https://github.com/okp4/contracts/commit/9f027cac3e7569ab5300c99748bddb6edb494d01)) +* **template:** add task to generate schema ([815c58e](https://github.com/okp4/contracts/commit/815c58e5c1746b994ca522150f8207c4c5f30531)) +* **template:** build asC lib for generate wasm ([9e9f5c9](https://github.com/okp4/contracts/commit/9e9f5c9211fd926d5d9765ec247f30b9a64bd460)) +* **template:** format rust and toml ([e4dadf1](https://github.com/okp4/contracts/commit/e4dadf1d3682dbf8aad968e345a8b56489d68e86)) +* **template:** update template with new from cosmwasm ([9656cca](https://github.com/okp4/contracts/commit/9656cca1e7b58aac9d58c45032b1608abab023f9)) + + +### Bug Fixes + +* **ci:** install jsonschema through yarn global and include in path ([16b88bc](https://github.com/okp4/contracts/commit/16b88bc2400d65205f9d904236b6a80bd03037ef)) +* **ci:** only trigger report wasm size on PR ([deecbd1](https://github.com/okp4/contracts/commit/deecbd12cd3e735013fca73b589c0f06c46c9b57)) +* **ci:** remove check feature on test and lint ([6a431e1](https://github.com/okp4/contracts/commit/6a431e19dbcad1dbb25862ccc00ed8069758b22f)) +* **ci:** tarpaulin cargo crate name ([9d1931c](https://github.com/okp4/contracts/commit/9d1931c9f5ddc4337d4a37f15d15606beebc9ac8)) +* **ci:** trigger the good workflow id ([e611394](https://github.com/okp4/contracts/commit/e6113944332bdfafcf96f647aefe4843fe7e6264)) +* **ci:** use bash shell for check_contract task ([eded5b1](https://github.com/okp4/contracts/commit/eded5b13fdb2840d3da68815d6f809fe4e20b537)) +* **ci:** use new check-contract crates ([58cdf37](https://github.com/okp4/contracts/commit/58cdf376a5cb6d76b1a692925c94d1f6e0d3693f)) +* **ci:** verify docs update ([12eb19e](https://github.com/okp4/contracts/commit/12eb19e4990d4950e7b9f9516e7786e34788a659)) +* **ci:** wrong object input for trigger workflow ([ee5fe8d](https://github.com/okp4/contracts/commit/ee5fe8d6820e68da61ebfb4eadac570be21f4560)) +* **docs:** correctly escaping error message ([c9b61e8](https://github.com/okp4/contracts/commit/c9b61e8e42d62a30c0d1a3868eeacc8fe54e22af)) +* **docs:** disable checking jsonschema2md binary ([dfcf049](https://github.com/okp4/contracts/commit/dfcf049df196356a52877b785b9608347c32249f)) +* **docs:** only find json schema at root folder ([7145f6e](https://github.com/okp4/contracts/commit/7145f6edd61ac709d9c89b920c5f8683052677bc)) +* **docs:** search json file into schema folder for gen doc ([c48bc23](https://github.com/okp4/contracts/commit/c48bc239a71be72d1ca0f8efc66b2d2bbf798a4f)) +* format code ([1fd1571](https://github.com/okp4/contracts/commit/1fd1571b5aa263d3ad92a9650a9f5bb0df3dfbb1)) +* **law:** linter impl From unstead of into ([49bc80c](https://github.com/okp4/contracts/commit/49bc80c1a08edf9ffa664ac446bc5485b275def3)) +* **law:** program conversion base64 to string ([3b11d2d](https://github.com/okp4/contracts/commit/3b11d2dfca1d8ab6981f70791cd57378b1946ae7)) +* **lint:** derive Eq when derive PartialEq ([28df736](https://github.com/okp4/contracts/commit/28df7368832bbeae28ea6012ee44454163cb3fba)) +* **lint:** format all rust code ([b955d74](https://github.com/okp4/contracts/commit/b955d745ab2cbf8c8edf2fe67b15df0a205cca8e)) +* **lint:** simplify assert ([fd08d58](https://github.com/okp4/contracts/commit/fd08d5890e680c3a22eccbf49c9f120ba33cd20d)) +* **lint:** update cw-template readme ([79629bb](https://github.com/okp4/contracts/commit/79629bb43598595073cc5b10aa2679bb0f1eec18)) +* **lint:** update readme by cleaning template stuff ([3137e2a](https://github.com/okp4/contracts/commit/3137e2ac180775ead2ef6bf6b3312b45a740e1bb)) +* make linter happy ([241e6ec](https://github.com/okp4/contracts/commit/241e6ec096a2a30fc36b50fd33df11391824e2d6)) +* **storage:** ensure error querying pins on unexisting object ([7e269ed](https://github.com/okp4/contracts/commit/7e269ed7bd896d5f689f8bbbc346fdf3371f3c4a)) +* **storage:** ensure max objects limit ([0734b58](https://github.com/okp4/contracts/commit/0734b58ca1a6e64e2a6ac40e35b25f9b86985da5)) +* **storage:** indicate max pin count in error ([4bb1af0](https://github.com/okp4/contracts/commit/4bb1af05acb5fe16de250b770666fd8569bb398c)) +* **storage:** lint and format ([2b9cfa2](https://github.com/okp4/contracts/commit/2b9cfa27f58a7b721ea1cdd40511159397592192)) +* **storage:** make PageInfo unidirectionnal ([9245e30](https://github.com/okp4/contracts/commit/9245e300d818af07fb3e43764e6bd7f0e585cdee)) +* **storage:** solve object query is_pinned ([3f26651](https://github.com/okp4/contracts/commit/3f26651895066cd601868348497ef894c22900c3)) +* **storage:** use Uint128 instead of primitive in state ([803e1b3](https://github.com/okp4/contracts/commit/803e1b367ee2185b923b398b96e8eef39ead3e63)) +* **test:** apply linter new rules ([43129c0](https://github.com/okp4/contracts/commit/43129c06bc1c199e9c58bf3413a325859734f744)) diff --git a/contracts/cw-law-stone/Cargo.toml b/contracts/cw-law-stone/Cargo.toml index 64b83cc8..62a79ae4 100644 --- a/contracts/cw-law-stone/Cargo.toml +++ b/contracts/cw-law-stone/Cargo.toml @@ -2,7 +2,7 @@ authors = ["OKP4"] edition = "2021" name = "cw-law-stone" -version = "0.2.0" +version = "1.0.0" exclude = [ # Those files are rust-optimizer artifacts. You might want to commit them for convenience but they should not be part of the source code publication. diff --git a/contracts/cw-storage/Cargo.toml b/contracts/cw-storage/Cargo.toml index c4276f5c..30de421e 100644 --- a/contracts/cw-storage/Cargo.toml +++ b/contracts/cw-storage/Cargo.toml @@ -2,7 +2,7 @@ authors = ["OKP4"] edition = "2021" name = "cw-storage" -version = "0.1.0" +version = "1.0.0" exclude = [ # Those files are rust-optimizer artifacts. You might want to commit them for convenience but they should not be part of the source code publication. diff --git a/docs/schema/cw-law-stone.json b/docs/schema/cw-law-stone.json index 16a5c57d..b7cffb1b 100644 --- a/docs/schema/cw-law-stone.json +++ b/docs/schema/cw-law-stone.json @@ -1 +1 @@ -{"contract_name":"cw-law-stone","contract_version":"0.2.0","idl_version":"1.0.0","instantiate":{"$schema":"http://json-schema.org/draft-07/schema#","title":"InstantiateMsg","description":"Instantiate message","type":"object","required":["program","storage_address"],"properties":{"program":{"description":"The Prolog program carrying law rules and facts.","allOf":[{"$ref":"./cw-law-stone.json/#/definitions/Binary"}]},"storage_address":{"description":"The `cw-storage` contract address on which to store the law program.","type":"string"}},"additionalProperties":false,"definitions":{"Binary":{"description":"Binary is a wrapper around Vec to add base64 de/serialization with serde. It also adds some helper methods to help encode inline.\n\nThis is only needed as serde-json-{core,wasm} has a horrible encoding for Vec. See also .","type":"string"}}},"execute":{"$schema":"http://json-schema.org/draft-07/schema#","title":"ExecuteMsg","description":"Execute messages","oneOf":[{"title":"BreakStone","description":"Break the stone making this contract unusable, by clearing all the related resources: - Unpin all the pinned objects on `cw-storage` contracts, if any. - Forget the main program (i.e. or at least unpin it). Only the contract admin is authorized to break it, if any. If already broken, this is a no-op.","type":"string","enum":["break_stone"]}]},"query":{"$schema":"http://json-schema.org/draft-07/schema#","title":"QueryMsg","description":"Query messages","oneOf":[{"title":"Ask","description":"If not broken, ask the logic module the provided query with the law program loaded.","type":"object","required":["ask"],"properties":{"ask":{"type":"object","required":["query"],"properties":{"query":{"type":"string"}},"additionalProperties":false}},"additionalProperties":false},{"title":"Program","description":"If not broken, returns the law program location information.","type":"string","enum":["program"]}]},"migrate":null,"sudo":null,"responses":{"ask":{"$schema":"http://json-schema.org/draft-07/schema#","title":"AskResponse","type":"object","required":["gas_used","height"],"properties":{"answer":{"anyOf":[{"$ref":"./cw-law-stone.json/#/definitions/Answer"},{"type":"null"}]},"gas_used":{"type":"integer","format":"uint64","minimum":0},"height":{"type":"integer","format":"uint64","minimum":0}},"definitions":{"Answer":{"type":"object","required":["has_more","results","success","variables"],"properties":{"has_more":{"type":"boolean"},"results":{"type":"array","items":{"$ref":"./cw-law-stone.json/#/definitions/Result"}},"success":{"type":"boolean"},"variables":{"type":"array","items":{"type":"string"}}}},"Result":{"type":"object","required":["substitutions"],"properties":{"substitutions":{"type":"array","items":{"$ref":"./cw-law-stone.json/#/definitions/Substitution"}}}},"Substitution":{"type":"object","required":["term","variable"],"properties":{"term":{"$ref":"./cw-law-stone.json/#/definitions/Term"},"variable":{"type":"string"}}},"Term":{"type":"object","required":["arguments","name"],"properties":{"arguments":{"type":"array","items":{"$ref":"./cw-law-stone.json/#/definitions/Term"}},"name":{"type":"string"}}}}},"program":{"$schema":"http://json-schema.org/draft-07/schema#","title":"ProgramResponse","description":"ProgramResponse carry elements to locate the program in a `cw-storage` contract.","type":"object","required":["object_id","storage_address"],"properties":{"object_id":{"description":"The program object id in the `cw-storage` contract.","type":"string"},"storage_address":{"description":"The `cw-storage` contract address on which the law program is stored.","type":"string"}},"additionalProperties":false}},"description":"# CW Law Stone\n\n## Overview\n\nThe `cw-law-stone` smart contract aims to provide GaaS (i.e. Governance as a Service) in any [Cosmos blockchains](https://cosmos.network/) using the [CosmWasm](https://cosmwasm.com/) framework and the [Logic](https://docs.okp4.network/modules/next/logic) OKP4 module.\n\nThis contract is built around a Prolog program describing the law by rules and facts. The law stone is immutable, this means it can only been questioned, there is no update mechanisms.\n\nThe `cw-law-stone` responsibility is to guarantee the availability of its rules in order to question them, but not to ensure the rules application.\n\nTo ensure reliability over time, the associated Prolog program is stored and pinned in a `cw-storage` contract. Moreover, all the eventual loaded files must be stored in a `cw-storage` contract as well, allowing the contract to pin them.\n\nTo be able to free the underlying resources (i.e. objects in `cw-storage`) if not used anymore, the contract admin can break the stone.\n\n➡️ Checkout the [examples](https://github.com/okp4/contracts/tree/main/contracts/cw-law-stone/exemples/) for usage information.","title":"cw-law-stone"} +{"contract_name":"cw-law-stone","contract_version":"1.0.0","idl_version":"1.0.0","instantiate":{"$schema":"http://json-schema.org/draft-07/schema#","title":"InstantiateMsg","description":"Instantiate message","type":"object","required":["program","storage_address"],"properties":{"program":{"description":"The Prolog program carrying law rules and facts.","allOf":[{"$ref":"./cw-law-stone.json/#/definitions/Binary"}]},"storage_address":{"description":"The `cw-storage` contract address on which to store the law program.","type":"string"}},"additionalProperties":false,"definitions":{"Binary":{"description":"Binary is a wrapper around Vec to add base64 de/serialization with serde. It also adds some helper methods to help encode inline.\n\nThis is only needed as serde-json-{core,wasm} has a horrible encoding for Vec. See also .","type":"string"}}},"execute":{"$schema":"http://json-schema.org/draft-07/schema#","title":"ExecuteMsg","description":"Execute messages","oneOf":[{"title":"BreakStone","description":"Break the stone making this contract unusable, by clearing all the related resources: - Unpin all the pinned objects on `cw-storage` contracts, if any. - Forget the main program (i.e. or at least unpin it). Only the contract admin is authorized to break it, if any. If already broken, this is a no-op.","type":"string","enum":["break_stone"]}]},"query":{"$schema":"http://json-schema.org/draft-07/schema#","title":"QueryMsg","description":"Query messages","oneOf":[{"title":"Ask","description":"If not broken, ask the logic module the provided query with the law program loaded.","type":"object","required":["ask"],"properties":{"ask":{"type":"object","required":["query"],"properties":{"query":{"type":"string"}},"additionalProperties":false}},"additionalProperties":false},{"title":"Program","description":"If not broken, returns the law program location information.","type":"string","enum":["program"]}]},"migrate":null,"sudo":null,"responses":{"ask":{"$schema":"http://json-schema.org/draft-07/schema#","title":"AskResponse","type":"object","required":["gas_used","height"],"properties":{"answer":{"anyOf":[{"$ref":"./cw-law-stone.json/#/definitions/Answer"},{"type":"null"}]},"gas_used":{"type":"integer","format":"uint64","minimum":0},"height":{"type":"integer","format":"uint64","minimum":0}},"definitions":{"Answer":{"type":"object","required":["has_more","results","success","variables"],"properties":{"has_more":{"type":"boolean"},"results":{"type":"array","items":{"$ref":"./cw-law-stone.json/#/definitions/Result"}},"success":{"type":"boolean"},"variables":{"type":"array","items":{"type":"string"}}}},"Result":{"type":"object","required":["substitutions"],"properties":{"substitutions":{"type":"array","items":{"$ref":"./cw-law-stone.json/#/definitions/Substitution"}}}},"Substitution":{"type":"object","required":["term","variable"],"properties":{"term":{"$ref":"./cw-law-stone.json/#/definitions/Term"},"variable":{"type":"string"}}},"Term":{"type":"object","required":["arguments","name"],"properties":{"arguments":{"type":"array","items":{"$ref":"./cw-law-stone.json/#/definitions/Term"}},"name":{"type":"string"}}}}},"program":{"$schema":"http://json-schema.org/draft-07/schema#","title":"ProgramResponse","description":"ProgramResponse carry elements to locate the program in a `cw-storage` contract.","type":"object","required":["object_id","storage_address"],"properties":{"object_id":{"description":"The program object id in the `cw-storage` contract.","type":"string"},"storage_address":{"description":"The `cw-storage` contract address on which the law program is stored.","type":"string"}},"additionalProperties":false}},"description":"# CW Law Stone\n\n## Overview\n\nThe `cw-law-stone` smart contract aims to provide GaaS (i.e. Governance as a Service) in any [Cosmos blockchains](https://cosmos.network/) using the [CosmWasm](https://cosmwasm.com/) framework and the [Logic](https://docs.okp4.network/modules/next/logic) OKP4 module.\n\nThis contract is built around a Prolog program describing the law by rules and facts. The law stone is immutable, this means it can only been questioned, there is no update mechanisms.\n\nThe `cw-law-stone` responsibility is to guarantee the availability of its rules in order to question them, but not to ensure the rules application.\n\nTo ensure reliability over time, the associated Prolog program is stored and pinned in a `cw-storage` contract. Moreover, all the eventual loaded files must be stored in a `cw-storage` contract as well, allowing the contract to pin them.\n\nTo be able to free the underlying resources (i.e. objects in `cw-storage`) if not used anymore, the contract admin can break the stone.\n\n➡️ Checkout the [examples](https://github.com/okp4/contracts/tree/main/contracts/cw-law-stone/exemples/) for usage information.","title":"cw-law-stone"} diff --git a/docs/schema/cw-storage.json b/docs/schema/cw-storage.json index c006a006..45df2b44 100644 --- a/docs/schema/cw-storage.json +++ b/docs/schema/cw-storage.json @@ -1 +1 @@ -{"contract_name":"cw-storage","contract_version":"0.1.0","idl_version":"1.0.0","instantiate":{"$schema":"http://json-schema.org/draft-07/schema#","title":"InstantiateMsg","description":"Instantiate messages","type":"object","required":["bucket","limits","pagination"],"properties":{"bucket":{"description":"The name of the bucket. The name could not be empty or contains whitespaces. If name contains whitespace, they will be removed.","type":"string"},"limits":{"description":"The limits of the bucket.","allOf":[{"$ref":"./cw-storage.json/#/definitions/BucketLimits"}]},"pagination":{"description":"The configuration for paginated query.","allOf":[{"$ref":"./cw-storage.json/#/definitions/PaginationConfig"}]}},"additionalProperties":false,"definitions":{"BucketLimits":{"description":"BucketLimits is the type of the limits of a bucket.\n\nThe limits are optional and if not set, there is no limit.","type":"object","properties":{"max_object_pins":{"description":"The maximum number of pins in the bucket for an object.","anyOf":[{"$ref":"./cw-storage.json/#/definitions/Uint128"},{"type":"null"}]},"max_object_size":{"description":"The maximum size of the objects in the bucket.","anyOf":[{"$ref":"./cw-storage.json/#/definitions/Uint128"},{"type":"null"}]},"max_objects":{"description":"The maximum number of objects in the bucket.","anyOf":[{"$ref":"./cw-storage.json/#/definitions/Uint128"},{"type":"null"}]},"max_total_size":{"description":"The maximum total size of the objects in the bucket.","anyOf":[{"$ref":"./cw-storage.json/#/definitions/Uint128"},{"type":"null"}]}},"additionalProperties":false},"PaginationConfig":{"description":"PaginationConfig is the type carrying configuration for paginated queries.\n\nThe fields are optional and if not set, there is a default configuration.","type":"object","properties":{"default_page_size":{"description":"The default number of elements in a page.\n\nShall be less or equal than `max_page_size`. Default to '10' if not set.","type":["integer","null"],"format":"uint32","minimum":0},"max_page_size":{"description":"The maximum elements a page can contains.\n\nShall be less than `u32::MAX - 1`. Default to '30' if not set.","type":["integer","null"],"format":"uint32","minimum":0}},"additionalProperties":false},"Uint128":{"description":"A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```","type":"string"}}},"execute":{"$schema":"http://json-schema.org/draft-07/schema#","title":"ExecuteMsg","description":"Execute messages","oneOf":[{"title":"StoreObject","description":"StoreObject store an object to the bucket and make the sender the owner of the object. The object is referenced by the hash of its content and this value is returned. If the object is already stored, an error is returned. If pin is true, the object is pinned for the sender.","type":"object","required":["store_object"],"properties":{"store_object":{"type":"object","required":["data","pin"],"properties":{"data":{"$ref":"./cw-storage.json/#/definitions/Binary"},"pin":{"type":"boolean"}},"additionalProperties":false}},"additionalProperties":false},{"title":"ForgetObject","description":"ForgetObject first unpin the object from the bucket for the considered sender, then remove it from the storage if it is not pinned anymore. If the object is pinned for other senders, it is not removed from the storage and an error is returned. If the object is not pinned for the sender, this is a no-op.","type":"object","required":["forget_object"],"properties":{"forget_object":{"type":"object","required":["id"],"properties":{"id":{"type":"string"}},"additionalProperties":false}},"additionalProperties":false},{"title":"PinObject","description":"PinObject pins the object in the bucket for the considered sender. If the object is already pinned for the sender, this is a no-op. While an object is pinned, it cannot be removed from the storage.","type":"object","required":["pin_object"],"properties":{"pin_object":{"type":"object","required":["id"],"properties":{"id":{"type":"string"}},"additionalProperties":false}},"additionalProperties":false},{"title":"UnpinObject","description":"UnpinObject unpins the object in the bucket for the considered sender. If the object is not pinned for the sender, this is a no-op. The object can be removed from the storage if it is not pinned anymore.","type":"object","required":["unpin_object"],"properties":{"unpin_object":{"type":"object","required":["id"],"properties":{"id":{"type":"string"}},"additionalProperties":false}},"additionalProperties":false}],"definitions":{"Binary":{"description":"Binary is a wrapper around Vec to add base64 de/serialization with serde. It also adds some helper methods to help encode inline.\n\nThis is only needed as serde-json-{core,wasm} has a horrible encoding for Vec. See also .","type":"string"}}},"query":{"$schema":"http://json-schema.org/draft-07/schema#","title":"QueryMsg","description":"Query messages","oneOf":[{"title":"Bucket","description":"Bucket returns the bucket information.","type":"object","required":["bucket"],"properties":{"bucket":{"type":"object","additionalProperties":false}},"additionalProperties":false},{"title":"Object","description":"Object returns the object information with the given id.","type":"object","required":["object"],"properties":{"object":{"type":"object","required":["id"],"properties":{"id":{"description":"The id of the object to get.","type":"string"}},"additionalProperties":false}},"additionalProperties":false},{"title":"Objects","description":"Objects returns the list of objects in the bucket with support for pagination.","type":"object","required":["objects"],"properties":{"objects":{"type":"object","properties":{"address":{"description":"The owner of the objects to get.","type":["string","null"]},"after":{"description":"The point in the sequence to start returning objects.","type":["string","null"]},"first":{"description":"The number of objects to return.","type":["integer","null"],"format":"uint32","minimum":0}},"additionalProperties":false}},"additionalProperties":false},{"title":"ObjectData","description":"ObjectData returns the content of the object with the given id.","type":"object","required":["object_data"],"properties":{"object_data":{"type":"object","required":["id"],"properties":{"id":{"description":"The id of the object to get.","type":"string"}},"additionalProperties":false}},"additionalProperties":false},{"title":"ObjectPins","description":"ObjectPins returns the list of addresses that pinned the object with the given id with support for pagination.","type":"object","required":["object_pins"],"properties":{"object_pins":{"type":"object","required":["id"],"properties":{"after":{"description":"The point in the sequence to start returning pins.","type":["string","null"]},"first":{"description":"The number of pins to return.","type":["integer","null"],"format":"uint32","minimum":0},"id":{"description":"The id of the object to get the pins for.","type":"string"}},"additionalProperties":false}},"additionalProperties":false}]},"migrate":null,"sudo":null,"responses":{"bucket":{"$schema":"http://json-schema.org/draft-07/schema#","title":"BucketResponse","description":"BucketResponse is the response of the Bucket query.","type":"object","required":["limits","name","pagination"],"properties":{"limits":{"description":"The limits of the bucket.","allOf":[{"$ref":"./cw-storage.json/#/definitions/BucketLimits"}]},"name":{"description":"The name of the bucket.","type":"string"},"pagination":{"description":"The configuration for paginated query.","allOf":[{"$ref":"./cw-storage.json/#/definitions/PaginationConfig"}]}},"additionalProperties":false,"definitions":{"BucketLimits":{"description":"BucketLimits is the type of the limits of a bucket.\n\nThe limits are optional and if not set, there is no limit.","type":"object","properties":{"max_object_pins":{"description":"The maximum number of pins in the bucket for an object.","anyOf":[{"$ref":"./cw-storage.json/#/definitions/Uint128"},{"type":"null"}]},"max_object_size":{"description":"The maximum size of the objects in the bucket.","anyOf":[{"$ref":"./cw-storage.json/#/definitions/Uint128"},{"type":"null"}]},"max_objects":{"description":"The maximum number of objects in the bucket.","anyOf":[{"$ref":"./cw-storage.json/#/definitions/Uint128"},{"type":"null"}]},"max_total_size":{"description":"The maximum total size of the objects in the bucket.","anyOf":[{"$ref":"./cw-storage.json/#/definitions/Uint128"},{"type":"null"}]}},"additionalProperties":false},"PaginationConfig":{"description":"PaginationConfig is the type carrying configuration for paginated queries.\n\nThe fields are optional and if not set, there is a default configuration.","type":"object","properties":{"default_page_size":{"description":"The default number of elements in a page.\n\nShall be less or equal than `max_page_size`. Default to '10' if not set.","type":["integer","null"],"format":"uint32","minimum":0},"max_page_size":{"description":"The maximum elements a page can contains.\n\nShall be less than `u32::MAX - 1`. Default to '30' if not set.","type":["integer","null"],"format":"uint32","minimum":0}},"additionalProperties":false},"Uint128":{"description":"A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```","type":"string"}}},"object":{"$schema":"http://json-schema.org/draft-07/schema#","title":"ObjectResponse","description":"ObjectResponse is the response of the Object query.","type":"object","required":["id","is_pinned","owner","size"],"properties":{"id":{"description":"The id of the object.","type":"string"},"is_pinned":{"description":"Tells if the object is pinned by at least one address.","type":"boolean"},"owner":{"description":"The owner of the object.","type":"string"},"size":{"description":"The size of the object.","allOf":[{"$ref":"./cw-storage.json/#/definitions/Uint128"}]}},"additionalProperties":false,"definitions":{"Uint128":{"description":"A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```","type":"string"}}},"object_data":{"$schema":"http://json-schema.org/draft-07/schema#","title":"Binary","description":"Binary is a wrapper around Vec to add base64 de/serialization with serde. It also adds some helper methods to help encode inline.\n\nThis is only needed as serde-json-{core,wasm} has a horrible encoding for Vec. See also .","type":"string"},"object_pins":{"$schema":"http://json-schema.org/draft-07/schema#","title":"ObjectPinsResponse","description":"ObjectPinsResponse is the response of the GetObjectPins query.","type":"object","required":["data","page_info"],"properties":{"data":{"description":"The list of addresses that pinned the object.","type":"array","items":{"type":"string"}},"page_info":{"description":"The page information.","allOf":[{"$ref":"./cw-storage.json/#/definitions/PageInfo"}]}},"additionalProperties":false,"definitions":{"PageInfo":{"title":"PageInfo","description":"PageInfo is the page information returned for paginated queries.","type":"object","required":["cursor","has_next_page"],"properties":{"cursor":{"description":"The cursor to the next page.","type":"string"},"has_next_page":{"description":"Tells if there is a next page.","type":"boolean"}},"additionalProperties":false}}},"objects":{"$schema":"http://json-schema.org/draft-07/schema#","title":"ObjectsResponse","description":"ObjectsResponse is the response of the Objects query.","type":"object","required":["data","page_info"],"properties":{"data":{"description":"The list of objects in the bucket.","type":"array","items":{"$ref":"./cw-storage.json/#/definitions/ObjectResponse"}},"page_info":{"description":"The page information.","allOf":[{"$ref":"./cw-storage.json/#/definitions/PageInfo"}]}},"additionalProperties":false,"definitions":{"ObjectResponse":{"title":"ObjectResponse","description":"ObjectResponse is the response of the Object query.","type":"object","required":["id","is_pinned","owner","size"],"properties":{"id":{"description":"The id of the object.","type":"string"},"is_pinned":{"description":"Tells if the object is pinned by at least one address.","type":"boolean"},"owner":{"description":"The owner of the object.","type":"string"},"size":{"description":"The size of the object.","allOf":[{"$ref":"./cw-storage.json/#/definitions/Uint128"}]}},"additionalProperties":false},"PageInfo":{"title":"PageInfo","description":"PageInfo is the page information returned for paginated queries.","type":"object","required":["cursor","has_next_page"],"properties":{"cursor":{"description":"The cursor to the next page.","type":"string"},"has_next_page":{"description":"Tells if there is a next page.","type":"boolean"}},"additionalProperties":false},"Uint128":{"description":"A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```","type":"string"}}}},"description":"# CW Storage\n\n## Overview\n\nThe `cw-storage` smart contract enables the storage of arbitrary `objects` in any [Cosmos blockchains](https://cosmos.network/) using the [CosmWasm](https://cosmwasm.com/) framework.\n\nThis contract allows for storing `objects`, pinning and unpinning `objects` for a given sender address, and it also includes the ability to remove (forget) `objects` if they are no longer pinned.\n\n## Usage\n\n### Instantiate\n\nThe `cw-storage` can be instantiated as follows, refer to the schema for more information on limits and pagination configuration:\n\n```bash\nokp4d tx wasm instantiate $CODE_ID \\\n --label \"my-storage\" \\\n --from $ADDR \\\n --admin $ADMIN_ADDR \\\n --gas 1000000 \\\n --broadcast-mode block \\\n '{\"bucket\":\"my-bucket\",\"limits\":{}, \"pagination\": {}}'\n```\n\n### Execute\n\nWe can store an object by providing its data in base64 encoded, we can pin the stored object to prevent it from being removed:\n\n```bash\nokp4d tx wasm execute $CONTRACT_ADDR \\\n --from $ADDR \\\n --gas 1000000 \\\n --broadcast-mode block \\\n \"{\\\"store_object\\\":{\\\"data\\\": \\\"$(cat my-data | base64)\\\",\\\"pin\\\":true}}\"\n```\n\nThe object id is stable as it is a hash, we can't store an object twice.\n\nWith the following commands we can pin and unpin existing objects:\n\n```bash\nokp4d tx wasm execute $CONTRACT_ADDR \\\n --from $ADDR \\\n --gas 1000000 \\\n --broadcast-mode block \\\n \"{\\\"pin_object\\\":{\\\"id\\\": \\\"$OBJECT_ID\\\"}}\"\n\nokp4d tx wasm execute $CONTRACT_ADDR \\\n --from $ADDR \\\n --gas 1000000 \\\n --broadcast-mode block \\\n \"{\\\"unpin_object\\\":{\\\"id\\\": \\\"$OBJECT_ID\\\"}}\"\n```\n\nAnd if an object is not pinned, or pinned by the sender of transaction, we can remove it:\n\n```bash\nokp4d tx wasm execute $CONTRACT_ADDR \\\n --from $ADDR \\\n --gas 1000000 \\\n --broadcast-mode block \\\n \"{\\\"forget_object\\\":{\\\"id\\\": \\\"$OBJECT_ID\\\"}}\"\n```\n\n### Query\n\nQuery an object by its id:\n\n```bash\nokp4d query wasm contract smart $CONTRACT_ADDR \\\n \"{\\\"object\\\": {\\\"id\\\": \\\"$OBJECT_ID\\\"}}\"\n```\n\nOr its data:\n\n```bash\nokp4d query wasm contract smart $CONTRACT_ADDR \\\n \"{\\\"object_data\\\": {\\\"id\\\": \\\"$OBJECT_ID\\\"}}\"\n```\n\nWe can also list the objects, eventually filtering on the object owner:\n\n```bash\nokp4d query wasm contract smart $CONTRACT_ADDR \\\n \"{\\\"objects\\\": {\\\"address\\\": \\\"okp41p8u47en82gmzfm259y6z93r9qe63l25dfwwng6\\\"}}\"\n```\n\nAnd navigate in a cursor based pagination:\n\n```bash\nokp4d query wasm contract smart $CONTRACT_ADDR \\\n \"{\\\"objects\\\": {\\\"first\\\": 5, \\\"after\\\": \\\"23Y5t5DBe7DkPwfJo3Sd26Y8Z9epmtpA1FTpdG7DiG6MD8vPRTzzbQ9TccmyoBcePkPK6atUiqcAzJVo3TfYNBGY\\\"}}\"\n```\n\nWe can also query object pins with the same cursor based pagination:\n\n```bash\nokp4d query wasm contract smart $CONTRACT_ADDR \\\n \"{\\\"object_pins\\\": {\\\"id\\\": \\\"$OBJECT_ID\\\", \\\"first\\\": 5, \\\"after\\\": \\\"23Y5t5DBe7DkPwfJo3Sd26Y8Z9epmtpA1FTpdG7DiG6MD8vPRTzzbQ9TccmyoBcePkPK6atUiqcAzJVo3TfYNBGY\\\"}}\"\n```","title":"cw-storage"} +{"contract_name":"cw-storage","contract_version":"1.0.0","idl_version":"1.0.0","instantiate":{"$schema":"http://json-schema.org/draft-07/schema#","title":"InstantiateMsg","description":"Instantiate messages","type":"object","required":["bucket","limits","pagination"],"properties":{"bucket":{"description":"The name of the bucket. The name could not be empty or contains whitespaces. If name contains whitespace, they will be removed.","type":"string"},"limits":{"description":"The limits of the bucket.","allOf":[{"$ref":"./cw-storage.json/#/definitions/BucketLimits"}]},"pagination":{"description":"The configuration for paginated query.","allOf":[{"$ref":"./cw-storage.json/#/definitions/PaginationConfig"}]}},"additionalProperties":false,"definitions":{"BucketLimits":{"description":"BucketLimits is the type of the limits of a bucket.\n\nThe limits are optional and if not set, there is no limit.","type":"object","properties":{"max_object_pins":{"description":"The maximum number of pins in the bucket for an object.","anyOf":[{"$ref":"./cw-storage.json/#/definitions/Uint128"},{"type":"null"}]},"max_object_size":{"description":"The maximum size of the objects in the bucket.","anyOf":[{"$ref":"./cw-storage.json/#/definitions/Uint128"},{"type":"null"}]},"max_objects":{"description":"The maximum number of objects in the bucket.","anyOf":[{"$ref":"./cw-storage.json/#/definitions/Uint128"},{"type":"null"}]},"max_total_size":{"description":"The maximum total size of the objects in the bucket.","anyOf":[{"$ref":"./cw-storage.json/#/definitions/Uint128"},{"type":"null"}]}},"additionalProperties":false},"PaginationConfig":{"description":"PaginationConfig is the type carrying configuration for paginated queries.\n\nThe fields are optional and if not set, there is a default configuration.","type":"object","properties":{"default_page_size":{"description":"The default number of elements in a page.\n\nShall be less or equal than `max_page_size`. Default to '10' if not set.","type":["integer","null"],"format":"uint32","minimum":0},"max_page_size":{"description":"The maximum elements a page can contains.\n\nShall be less than `u32::MAX - 1`. Default to '30' if not set.","type":["integer","null"],"format":"uint32","minimum":0}},"additionalProperties":false},"Uint128":{"description":"A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```","type":"string"}}},"execute":{"$schema":"http://json-schema.org/draft-07/schema#","title":"ExecuteMsg","description":"Execute messages","oneOf":[{"title":"StoreObject","description":"StoreObject store an object to the bucket and make the sender the owner of the object. The object is referenced by the hash of its content and this value is returned. If the object is already stored, an error is returned. If pin is true, the object is pinned for the sender.","type":"object","required":["store_object"],"properties":{"store_object":{"type":"object","required":["data","pin"],"properties":{"data":{"$ref":"./cw-storage.json/#/definitions/Binary"},"pin":{"type":"boolean"}},"additionalProperties":false}},"additionalProperties":false},{"title":"ForgetObject","description":"ForgetObject first unpin the object from the bucket for the considered sender, then remove it from the storage if it is not pinned anymore. If the object is pinned for other senders, it is not removed from the storage and an error is returned. If the object is not pinned for the sender, this is a no-op.","type":"object","required":["forget_object"],"properties":{"forget_object":{"type":"object","required":["id"],"properties":{"id":{"type":"string"}},"additionalProperties":false}},"additionalProperties":false},{"title":"PinObject","description":"PinObject pins the object in the bucket for the considered sender. If the object is already pinned for the sender, this is a no-op. While an object is pinned, it cannot be removed from the storage.","type":"object","required":["pin_object"],"properties":{"pin_object":{"type":"object","required":["id"],"properties":{"id":{"type":"string"}},"additionalProperties":false}},"additionalProperties":false},{"title":"UnpinObject","description":"UnpinObject unpins the object in the bucket for the considered sender. If the object is not pinned for the sender, this is a no-op. The object can be removed from the storage if it is not pinned anymore.","type":"object","required":["unpin_object"],"properties":{"unpin_object":{"type":"object","required":["id"],"properties":{"id":{"type":"string"}},"additionalProperties":false}},"additionalProperties":false}],"definitions":{"Binary":{"description":"Binary is a wrapper around Vec to add base64 de/serialization with serde. It also adds some helper methods to help encode inline.\n\nThis is only needed as serde-json-{core,wasm} has a horrible encoding for Vec. See also .","type":"string"}}},"query":{"$schema":"http://json-schema.org/draft-07/schema#","title":"QueryMsg","description":"Query messages","oneOf":[{"title":"Bucket","description":"Bucket returns the bucket information.","type":"object","required":["bucket"],"properties":{"bucket":{"type":"object","additionalProperties":false}},"additionalProperties":false},{"title":"Object","description":"Object returns the object information with the given id.","type":"object","required":["object"],"properties":{"object":{"type":"object","required":["id"],"properties":{"id":{"description":"The id of the object to get.","type":"string"}},"additionalProperties":false}},"additionalProperties":false},{"title":"Objects","description":"Objects returns the list of objects in the bucket with support for pagination.","type":"object","required":["objects"],"properties":{"objects":{"type":"object","properties":{"address":{"description":"The owner of the objects to get.","type":["string","null"]},"after":{"description":"The point in the sequence to start returning objects.","type":["string","null"]},"first":{"description":"The number of objects to return.","type":["integer","null"],"format":"uint32","minimum":0}},"additionalProperties":false}},"additionalProperties":false},{"title":"ObjectData","description":"ObjectData returns the content of the object with the given id.","type":"object","required":["object_data"],"properties":{"object_data":{"type":"object","required":["id"],"properties":{"id":{"description":"The id of the object to get.","type":"string"}},"additionalProperties":false}},"additionalProperties":false},{"title":"ObjectPins","description":"ObjectPins returns the list of addresses that pinned the object with the given id with support for pagination.","type":"object","required":["object_pins"],"properties":{"object_pins":{"type":"object","required":["id"],"properties":{"after":{"description":"The point in the sequence to start returning pins.","type":["string","null"]},"first":{"description":"The number of pins to return.","type":["integer","null"],"format":"uint32","minimum":0},"id":{"description":"The id of the object to get the pins for.","type":"string"}},"additionalProperties":false}},"additionalProperties":false}]},"migrate":null,"sudo":null,"responses":{"bucket":{"$schema":"http://json-schema.org/draft-07/schema#","title":"BucketResponse","description":"BucketResponse is the response of the Bucket query.","type":"object","required":["limits","name","pagination"],"properties":{"limits":{"description":"The limits of the bucket.","allOf":[{"$ref":"./cw-storage.json/#/definitions/BucketLimits"}]},"name":{"description":"The name of the bucket.","type":"string"},"pagination":{"description":"The configuration for paginated query.","allOf":[{"$ref":"./cw-storage.json/#/definitions/PaginationConfig"}]}},"additionalProperties":false,"definitions":{"BucketLimits":{"description":"BucketLimits is the type of the limits of a bucket.\n\nThe limits are optional and if not set, there is no limit.","type":"object","properties":{"max_object_pins":{"description":"The maximum number of pins in the bucket for an object.","anyOf":[{"$ref":"./cw-storage.json/#/definitions/Uint128"},{"type":"null"}]},"max_object_size":{"description":"The maximum size of the objects in the bucket.","anyOf":[{"$ref":"./cw-storage.json/#/definitions/Uint128"},{"type":"null"}]},"max_objects":{"description":"The maximum number of objects in the bucket.","anyOf":[{"$ref":"./cw-storage.json/#/definitions/Uint128"},{"type":"null"}]},"max_total_size":{"description":"The maximum total size of the objects in the bucket.","anyOf":[{"$ref":"./cw-storage.json/#/definitions/Uint128"},{"type":"null"}]}},"additionalProperties":false},"PaginationConfig":{"description":"PaginationConfig is the type carrying configuration for paginated queries.\n\nThe fields are optional and if not set, there is a default configuration.","type":"object","properties":{"default_page_size":{"description":"The default number of elements in a page.\n\nShall be less or equal than `max_page_size`. Default to '10' if not set.","type":["integer","null"],"format":"uint32","minimum":0},"max_page_size":{"description":"The maximum elements a page can contains.\n\nShall be less than `u32::MAX - 1`. Default to '30' if not set.","type":["integer","null"],"format":"uint32","minimum":0}},"additionalProperties":false},"Uint128":{"description":"A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```","type":"string"}}},"object":{"$schema":"http://json-schema.org/draft-07/schema#","title":"ObjectResponse","description":"ObjectResponse is the response of the Object query.","type":"object","required":["id","is_pinned","owner","size"],"properties":{"id":{"description":"The id of the object.","type":"string"},"is_pinned":{"description":"Tells if the object is pinned by at least one address.","type":"boolean"},"owner":{"description":"The owner of the object.","type":"string"},"size":{"description":"The size of the object.","allOf":[{"$ref":"./cw-storage.json/#/definitions/Uint128"}]}},"additionalProperties":false,"definitions":{"Uint128":{"description":"A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```","type":"string"}}},"object_data":{"$schema":"http://json-schema.org/draft-07/schema#","title":"Binary","description":"Binary is a wrapper around Vec to add base64 de/serialization with serde. It also adds some helper methods to help encode inline.\n\nThis is only needed as serde-json-{core,wasm} has a horrible encoding for Vec. See also .","type":"string"},"object_pins":{"$schema":"http://json-schema.org/draft-07/schema#","title":"ObjectPinsResponse","description":"ObjectPinsResponse is the response of the GetObjectPins query.","type":"object","required":["data","page_info"],"properties":{"data":{"description":"The list of addresses that pinned the object.","type":"array","items":{"type":"string"}},"page_info":{"description":"The page information.","allOf":[{"$ref":"./cw-storage.json/#/definitions/PageInfo"}]}},"additionalProperties":false,"definitions":{"PageInfo":{"title":"PageInfo","description":"PageInfo is the page information returned for paginated queries.","type":"object","required":["cursor","has_next_page"],"properties":{"cursor":{"description":"The cursor to the next page.","type":"string"},"has_next_page":{"description":"Tells if there is a next page.","type":"boolean"}},"additionalProperties":false}}},"objects":{"$schema":"http://json-schema.org/draft-07/schema#","title":"ObjectsResponse","description":"ObjectsResponse is the response of the Objects query.","type":"object","required":["data","page_info"],"properties":{"data":{"description":"The list of objects in the bucket.","type":"array","items":{"$ref":"./cw-storage.json/#/definitions/ObjectResponse"}},"page_info":{"description":"The page information.","allOf":[{"$ref":"./cw-storage.json/#/definitions/PageInfo"}]}},"additionalProperties":false,"definitions":{"ObjectResponse":{"title":"ObjectResponse","description":"ObjectResponse is the response of the Object query.","type":"object","required":["id","is_pinned","owner","size"],"properties":{"id":{"description":"The id of the object.","type":"string"},"is_pinned":{"description":"Tells if the object is pinned by at least one address.","type":"boolean"},"owner":{"description":"The owner of the object.","type":"string"},"size":{"description":"The size of the object.","allOf":[{"$ref":"./cw-storage.json/#/definitions/Uint128"}]}},"additionalProperties":false},"PageInfo":{"title":"PageInfo","description":"PageInfo is the page information returned for paginated queries.","type":"object","required":["cursor","has_next_page"],"properties":{"cursor":{"description":"The cursor to the next page.","type":"string"},"has_next_page":{"description":"Tells if there is a next page.","type":"boolean"}},"additionalProperties":false},"Uint128":{"description":"A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```","type":"string"}}}},"description":"# CW Storage\n\n## Overview\n\nThe `cw-storage` smart contract enables the storage of arbitrary `objects` in any [Cosmos blockchains](https://cosmos.network/) using the [CosmWasm](https://cosmwasm.com/) framework.\n\nThis contract allows for storing `objects`, pinning and unpinning `objects` for a given sender address, and it also includes the ability to remove (forget) `objects` if they are no longer pinned.\n\n## Usage\n\n### Instantiate\n\nThe `cw-storage` can be instantiated as follows, refer to the schema for more information on limits and pagination configuration:\n\n```bash\nokp4d tx wasm instantiate $CODE_ID \\\n --label \"my-storage\" \\\n --from $ADDR \\\n --admin $ADMIN_ADDR \\\n --gas 1000000 \\\n --broadcast-mode block \\\n '{\"bucket\":\"my-bucket\",\"limits\":{}, \"pagination\": {}}'\n```\n\n### Execute\n\nWe can store an object by providing its data in base64 encoded, we can pin the stored object to prevent it from being removed:\n\n```bash\nokp4d tx wasm execute $CONTRACT_ADDR \\\n --from $ADDR \\\n --gas 1000000 \\\n --broadcast-mode block \\\n \"{\\\"store_object\\\":{\\\"data\\\": \\\"$(cat my-data | base64)\\\",\\\"pin\\\":true}}\"\n```\n\nThe object id is stable as it is a hash, we can't store an object twice.\n\nWith the following commands we can pin and unpin existing objects:\n\n```bash\nokp4d tx wasm execute $CONTRACT_ADDR \\\n --from $ADDR \\\n --gas 1000000 \\\n --broadcast-mode block \\\n \"{\\\"pin_object\\\":{\\\"id\\\": \\\"$OBJECT_ID\\\"}}\"\n\nokp4d tx wasm execute $CONTRACT_ADDR \\\n --from $ADDR \\\n --gas 1000000 \\\n --broadcast-mode block \\\n \"{\\\"unpin_object\\\":{\\\"id\\\": \\\"$OBJECT_ID\\\"}}\"\n```\n\nAnd if an object is not pinned, or pinned by the sender of transaction, we can remove it:\n\n```bash\nokp4d tx wasm execute $CONTRACT_ADDR \\\n --from $ADDR \\\n --gas 1000000 \\\n --broadcast-mode block \\\n \"{\\\"forget_object\\\":{\\\"id\\\": \\\"$OBJECT_ID\\\"}}\"\n```\n\n### Query\n\nQuery an object by its id:\n\n```bash\nokp4d query wasm contract smart $CONTRACT_ADDR \\\n \"{\\\"object\\\": {\\\"id\\\": \\\"$OBJECT_ID\\\"}}\"\n```\n\nOr its data:\n\n```bash\nokp4d query wasm contract smart $CONTRACT_ADDR \\\n \"{\\\"object_data\\\": {\\\"id\\\": \\\"$OBJECT_ID\\\"}}\"\n```\n\nWe can also list the objects, eventually filtering on the object owner:\n\n```bash\nokp4d query wasm contract smart $CONTRACT_ADDR \\\n \"{\\\"objects\\\": {\\\"address\\\": \\\"okp41p8u47en82gmzfm259y6z93r9qe63l25dfwwng6\\\"}}\"\n```\n\nAnd navigate in a cursor based pagination:\n\n```bash\nokp4d query wasm contract smart $CONTRACT_ADDR \\\n \"{\\\"objects\\\": {\\\"first\\\": 5, \\\"after\\\": \\\"23Y5t5DBe7DkPwfJo3Sd26Y8Z9epmtpA1FTpdG7DiG6MD8vPRTzzbQ9TccmyoBcePkPK6atUiqcAzJVo3TfYNBGY\\\"}}\"\n```\n\nWe can also query object pins with the same cursor based pagination:\n\n```bash\nokp4d query wasm contract smart $CONTRACT_ADDR \\\n \"{\\\"object_pins\\\": {\\\"id\\\": \\\"$OBJECT_ID\\\", \\\"first\\\": 5, \\\"after\\\": \\\"23Y5t5DBe7DkPwfJo3Sd26Y8Z9epmtpA1FTpdG7DiG6MD8vPRTzzbQ9TccmyoBcePkPK6atUiqcAzJVo3TfYNBGY\\\"}}\"\n```","title":"cw-storage"} diff --git a/packages/logic-bindings/Cargo.toml b/packages/logic-bindings/Cargo.toml index 1f6ba30d..11a90556 100644 --- a/packages/logic-bindings/Cargo.toml +++ b/packages/logic-bindings/Cargo.toml @@ -2,7 +2,7 @@ authors = ["OKP4"] edition = "2021" name = "logic-bindings" -version = "0.2.0" +version = "1.0.0" [dependencies] cosmwasm-std.workspace = true