From 358331498ac4748eaeabff7387e5fcd256fab7ce Mon Sep 17 00:00:00 2001 From: Hiroyuki Kumazawa <142436034+hiroyukikumazawa@users.noreply.github.com> Date: Wed, 31 Jan 2024 11:03:23 +0900 Subject: [PATCH] Update README for Enhanced Clarity and Developer Guidance Enhanced the README documentation to include a more detailed introduction, prerequisites, and step-by-step instructions for building, testing, and querying contracts with the sei-cosmwasm package. Added sections for additional resources, changelog, and contributing guidelines to support community engagement and provide clear guidance on how to get involved. These updates aim to make the package more accessible to developers new to sei-chain or smart contract development, while providing comprehensive resources for experienced users. --- README.md | 57 ++++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 42 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 7cb69de..801f4d7 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,23 @@ # Sei-Cosmwasm Package -This repository contains the sei-cosmwasm package to support smart contract querying and messages to the modules in sei-chain. It also includes an example contract that can be used to test package behavior locally and can be used as a reference for implementation details to include sei-chain integration in your smart contracts. +## Introduction + +The sei-cosmwasm package is a comprehensive toolkit designed for developers looking to integrate sei-chain functionalities into their Cosmos smart contracts. Leveraging the power of CosmWasm, this package simplifies the process of querying blockchain state and sending messages to sei-chain modules directly from your smart contracts. Whether you're building complex DeFi platforms or simple token contracts, sei-cosmwasm offers the building blocks necessary for seamless integration. + +## Prerequisites + +Before you begin, ensure you have the following installed and configured: + +- Docker: For building and deploying contracts. +- Rust: Latest stable version. +- Sei-chain CLI (seid): For interacting with the sei-chain network. + +A basic understanding of smart contract development and the Cosmos SDK will also be beneficial. ## Build Sei Tester Contract +To build the sei tester contract, run the following command: + ```shell docker run --rm -v "$(pwd)":/code \ --mount type=volume,source="$(basename "$(pwd)")_cache",target=/code/target \ @@ -11,40 +25,53 @@ docker run --rm -v "$(pwd)":/code \ cosmwasm/rust-optimizer:0.14.0 ``` +This command uses the `cosmwasm/rust-optimizer:0.14.0` Docker image to compile your smart contracts, ensuring a consistent and optimized build environment. + ## Testing with LocalSei ### Store Contract Code +Store your wasm contract on the blockchain: + ```shell seid tx wasm store artifacts/sei_tester.wasm -y --from --chain-id -b block --gas=3000000 --fees=1000sei ``` -Make sure to note the code ID for the contract from the tx response. You can also find it in the list of uploaded code with this query: +- ``: Your sei-chain account name. +- ``: The chain ID of your local sei-chain instance. -```shell -seid q wasm list-code -``` +After storing, note the code ID from the transaction response. ### Instantiate Contract +Deploy your contract with: + ```shell seid tx wasm instantiate '{}' -y --no-admin --from --chain-id --gas=1500000 --fees=1000sei -b block --label sei-tester ``` -Make sure to note the contract address for the contract from the tx response. You can also find it with this query: - -```shell -seid q wasm list-contract-by-code -``` +Replace `` with the ID obtained in the previous step. ### Query Smart Contract +Interact with your contract: + ```shell -seid q wasm contract-state smart +seid q wasm contract-state smart '{"exchange_rates": {}}' ``` -The json literal may look something like this: +- ``: The address of your instantiated contract. -```json -'{"exchange_rates": {}}' -``` +This query fetches exchange rates, as an example. Adjust the JSON query literal based on the data you wish to query. + +## Additional Resources + +For more detailed technical documentation, visit our [Developer Guides](https://docs.sei.io/develop/get-started). Join our community on [Discord](https://discord.gg/sei) for support and discussions. + +## Changelog + +For a detailed list of changes and updates, refer to our [CHANGELOG.md](#). + +## Contributing + +We welcome contributions from the community! If you're interested in improving the sei-cosmwasm package, please review our [contribution guidelines](#) for information on submitting pull requests and reporting bugs.