From c97a2e3539563cd28f17cc1f0f061c7d6783f24b Mon Sep 17 00:00:00 2001 From: Margarita Skomorokh Date: Mon, 28 Oct 2024 11:00:32 +0100 Subject: [PATCH 1/8] added chiado instructions to the wasm guide --- .../operate-a-keychain/create-a-keychain.md | 2 +- .../deploy-a-wasm-contract.md | 208 +++++++++++++----- .../deploy-an-evm-contract.md | 4 +- 3 files changed, 160 insertions(+), 54 deletions(-) diff --git a/docs/developer-docs/docs/build-a-keychain/operate-a-keychain/create-a-keychain.md b/docs/developer-docs/docs/build-a-keychain/operate-a-keychain/create-a-keychain.md index 160a6879a..115c78561 100644 --- a/docs/developer-docs/docs/build-a-keychain/operate-a-keychain/create-a-keychain.md +++ b/docs/developer-docs/docs/build-a-keychain/operate-a-keychain/create-a-keychain.md @@ -71,7 +71,7 @@ You can skip this guide and test a preconfigured Keychain. Just run a local node 2. Clone the repository with Warden source code. Then build the binary and initialize the chain home folder: ```bash - git clone --depth 1 --branch v0.4.2 https://github.com/warden-protocol/wardenprotocol + git clone --depth 1 --branch v0.5.2 https://github.com/warden-protocol/wardenprotocol cd wardenprotocol just build just install diff --git a/docs/developer-docs/docs/build-an-app/deploy-smart-contracts-on-warden/deploy-a-wasm-contract.md b/docs/developer-docs/docs/build-an-app/deploy-smart-contracts-on-warden/deploy-a-wasm-contract.md index dab340665..6db0d24b5 100644 --- a/docs/developer-docs/docs/build-an-app/deploy-smart-contracts-on-warden/deploy-a-wasm-contract.md +++ b/docs/developer-docs/docs/build-an-app/deploy-smart-contracts-on-warden/deploy-a-wasm-contract.md @@ -31,26 +31,85 @@ Before you start, complete the following prerequisites: - [wasm-opt](https://docs.rs/wasm-opt/latest/wasm_opt/index.html): A tool for optimizing the compiled WebAssembly (Wasm) code. - To install these tools, run the following commands: - ```bash rustup target add wasm32-unknown-unknown cargo install cargo-generate --features vendored-openssl brew install binaryen ``` -- [Run a local chain](/operate-a-node/run-a-local-chain) and make sure you have `wardend` correctly installed. +## 1. Prepare the chain - The next steps require your local account name, or key name. You can check the list of available keys by executing this command: +### Option 1. Run a local chain - ```bash - wardend keys list - ``` - :::tip - If you used our `just` script to run the node with default settings, the local account name is `shulgin`. - ::: +1. Run a local chain as explained here: [Run a local chain](/operate-a-node/run-a-local-chain). Note that you'll need to [install Go](https://golang.org/doc/install) 1.22.3 or later and [just](https://github.com/casey/just) 1.34.0 or later. + +2. The next steps require your local account name, or key name. You can check the list of available keys by executing this command: + + ```bash + wardend keys list + ``` + :::tip + If you used our `just` script to run the node with default settings, the local account name is `shulgin`. + ::: + +3. Check the local account balance to make sure it has funds: + + + + ```bash + wardend query bank balances shulgin + ``` + + + ```bash + wardend query bank balances my-key-name + ``` + + + +### Option 2. Connect to Chiado + +1. If you haven't yet, [install Go](https://golang.org/doc/install) 1.22.3 or later and [just](https://github.com/casey/just) 1.34.0 or later. + +2. Clone the repository with Warden source code. Then build the binary and initialize the chain home folder: + + ```bash + git clone --depth 1 --branch v0.5.2 https://github.com/warden-protocol/wardenprotocol + cd wardenprotocol + just build + just install + wardend init my-chain-moniker + ``` + +3. Create a new key: + + ``` + wardend keys add my-key-name + ``` + +4. Write down the **mnemonic phrase** and the **address** of the new account. You'll need this information to interact with the chain and restore the account. + + :::warning + The seed phrase is the only way to restore your keys. Losing it can result in the irrecoverable loss of WARD tokens. + ::: -## 1. Create a CosmWasm project + :::tip + You can always check your public address by running this command: + + ``` + wardend keys show my-key-name --address + ``` + ::: + +5. Fund your key using [Chiado faucet](https://faucet.chiado.wardenprotocol.org) and the public address returned in the previous step. + +6. Check your balance. Here and in other commands, you need to add the `--node` flag with an RPC URL for connecting to Chiado. + + ``` + wardend query bank balances my-key-name --node https://rpc.chiado.wardenprotocol.org:443 + ``` + +## 2. Create a CosmWasm project Create a new CosmWasm project template: @@ -59,7 +118,7 @@ cargo generate --git https://github.com/CosmWasm/cw-template.git --name hello-wo cd hello-world ``` -## 2. Modify the contract code +## 3. Modify the contract code Now you need to modify files in the `/src` directory as shown in the steps below. @@ -171,7 +230,7 @@ Now you need to modify files in the `/src` directory as shown in the steps below } ``` -## 3. Compile the contract +## 4. Compile the contract To compile the contract, run the following from the `hellow-world` directory: @@ -181,7 +240,7 @@ cargo wasm The contract should be compiled without any errors. -## 4. Optimize the code +## 5. Optimize the code Now you need to optimize your compiled Wasm code: @@ -190,56 +249,77 @@ wasm-opt -Os -o target/wasm32-unknown-unknown/release/hello_world.wasm \ target/wasm32-unknown-unknown/release/hello_world.wasm ``` -## 5. Run the chain - -If your local chain isn't running, execute this command in a separate terminal window: - -```bash -wardend start -``` - ## 6. Store the contract on-chain -To store your contract on the Warden chain, run the command below. Specify your key name from [Prerequisites](#prerequisites) in the `--from` flag (typically `shulgin`), also set the chain ID. +1. If you're deploying your contract on a local chain, make sure it's running. You can start your chain by executing this command in a separate terminal window: + + ```bash + wardend start + ``` - - -```bash -wardend tx wasm store target/wasm32-unknown-unknown/release/hello_world.wasm \ - --from shulgin \ - --gas auto \ - --gas-adjustment 1.3 \ - --gas-prices 100000000000award \ - -y \ - --chain-id warden_1337-1 -``` - - -```bash -wardend tx wasm store target/wasm32-unknown-unknown/release/hello_world.wasm \ - --from my-key-name \ - --gas auto \ - --gas-adjustment 1.3 \ - --gas-prices 100000000000award \ - -y \ - --chain-id chain_123-1 -``` - - + If you're going to deploy on Chiado, skip this step. -The transaction should be successful without any errors. +2. To store your contract on the Warden chain, run the command below. Specify your key name from [Prerequisites](#prerequisites) in the `--from` flag, also set the chain ID. -:::tip -If you used a `just` script or a devnet snapshot to run your node, you can omit the `--chain-id` flag in this and the following commands. -::: + + + ```bash + wardend tx wasm store target/wasm32-unknown-unknown/release/hello_world.wasm \ + --from shulgin \ + --gas auto \ + --gas-adjustment 1.3 \ + --gas-prices 100000000000award \ + -y \ + --chain-id warden_1337-1 + ``` + + + ```bash + wardend tx wasm store target/wasm32-unknown-unknown/release/hello_world.wasm \ + --from my-key-name \ + --gas auto \ + --gas-adjustment 1.3 \ + --gas-prices 100000000000award \ + -y \ + --chain-id chain_123-1 + ``` + + + ```bash + wardend tx wasm store target/wasm32-unknown-unknown/release/hello_world.wasm \ + --from my-key-name \ + --gas auto \ + --gas-adjustment 1.3 \ + --gas-prices 100000000000award \ + -y \ + --chain-id chain_123-1 \ + --node https://rpc.chiado.wardenprotocol.org:443 + ``` + + + + The transaction should be successful without any errors. + + :::tip + If you used a `just` script or a devnet snapshot to run your node, you can omit the `--chain-id` flag in this and the following commands. + ::: ## 7. Get the code ID Get the code ID that indentifies your Wasm code: + + ```bash wardend query wasm list-code ``` + + +```bash +wardend query wasm list-code --node https://rpc.chiado.wardenprotocol.org:443 +``` + + Note down `code_id` from the output. @@ -277,6 +357,20 @@ wardend tx wasm instantiate 1 '{}' \ --chain-id chain_123-1 ``` + +```bash +wardend tx wasm instantiate 1 '{}' \ + --from my-key-name \ + --label "Hello World" \ + --gas auto \ + --gas-adjustment 1.3 \ + --gas-prices 100000000000award \ + --no-admin \ + -y \ + --chain-id chain_123-1 \ + --node https://rpc.chiado.wardenprotocol.org:443 +``` + @@ -317,6 +411,18 @@ wardend tx wasm execute my-contract-address '{"say_hello":{}}' \ --chain-id chain_123-1 ``` + +```bash +wardend tx wasm execute my-contract-address '{"say_hello":{}}' \ + --from my-key-name \ + --gas auto \ + --gas-adjustment 1.3 \ + --gas-prices 100000000000award \ + -y \ + --chain-id chain_123-1 \ + --node https://rpc.chiado.wardenprotocol.org:443 +``` + diff --git a/docs/developer-docs/docs/build-an-app/deploy-smart-contracts-on-warden/deploy-an-evm-contract.md b/docs/developer-docs/docs/build-an-app/deploy-smart-contracts-on-warden/deploy-an-evm-contract.md index adb628833..369b19e62 100644 --- a/docs/developer-docs/docs/build-an-app/deploy-smart-contracts-on-warden/deploy-an-evm-contract.md +++ b/docs/developer-docs/docs/build-an-app/deploy-smart-contracts-on-warden/deploy-an-evm-contract.md @@ -124,7 +124,7 @@ Make adjustments in the code using your chain settings from [Prerequisites](#pre ```javascript title="/warden-smart-contract/truffle-config.js" const HDWalletProvider = require("@truffle/hdwallet-provider"); -// Your private key (keep this secret and never commit it to version control!) +// Your private key (keep this confidential and never commit it to version control!) const PRIVATE_KEY = "your_private_key"; module.exports = { @@ -160,7 +160,7 @@ In `/migrations`, create a new file `2_deploy_hello_warden.js` with the followin const HelloWarden = artifacts.require("HelloWarden"); module.exports = function(deployer) { -deployer.deploy(HelloWarden); + deployer.deploy(HelloWarden); }; ``` From 71c10003b8ecbc508c9e4110666d82ac98a6e8cf Mon Sep 17 00:00:00 2001 From: Margarita Skomorokh Date: Mon, 28 Oct 2024 12:06:30 +0100 Subject: [PATCH 2/8] added chiado instructions to the evm guide --- .../operate-a-keychain/create-a-keychain.md | 4 +- .../deploy-a-wasm-contract.md | 105 ++++----- .../deploy-an-evm-contract.md | 204 ++++++++++++++---- 3 files changed, 204 insertions(+), 109 deletions(-) diff --git a/docs/developer-docs/docs/build-a-keychain/operate-a-keychain/create-a-keychain.md b/docs/developer-docs/docs/build-a-keychain/operate-a-keychain/create-a-keychain.md index 115c78561..933d37e98 100644 --- a/docs/developer-docs/docs/build-a-keychain/operate-a-keychain/create-a-keychain.md +++ b/docs/developer-docs/docs/build-a-keychain/operate-a-keychain/create-a-keychain.md @@ -73,8 +73,8 @@ You can skip this guide and test a preconfigured Keychain. Just run a local node ```bash git clone --depth 1 --branch v0.5.2 https://github.com/warden-protocol/wardenprotocol cd wardenprotocol - just build - just install + just wardend build + just wardend install wardend init my-chain-moniker ``` diff --git a/docs/developer-docs/docs/build-an-app/deploy-smart-contracts-on-warden/deploy-a-wasm-contract.md b/docs/developer-docs/docs/build-an-app/deploy-smart-contracts-on-warden/deploy-a-wasm-contract.md index 6db0d24b5..9bc90453f 100644 --- a/docs/developer-docs/docs/build-an-app/deploy-smart-contracts-on-warden/deploy-a-wasm-contract.md +++ b/docs/developer-docs/docs/build-an-app/deploy-smart-contracts-on-warden/deploy-a-wasm-contract.md @@ -76,14 +76,14 @@ Before you start, complete the following prerequisites: ```bash git clone --depth 1 --branch v0.5.2 https://github.com/warden-protocol/wardenprotocol cd wardenprotocol - just build - just install + just wardend build + just wardend install wardend init my-chain-moniker ``` 3. Create a new key: - ``` + ```bash wardend keys add my-key-name ``` @@ -96,7 +96,7 @@ Before you start, complete the following prerequisites: :::tip You can always check your public address by running this command: - ``` + ```bash wardend keys show my-key-name --address ``` ::: @@ -105,7 +105,7 @@ Before you start, complete the following prerequisites: 6. Check your balance. Here and in other commands, you need to add the `--node` flag with an RPC URL for connecting to Chiado. - ``` + ```bash wardend query bank balances my-key-name --node https://rpc.chiado.wardenprotocol.org:443 ``` @@ -189,11 +189,6 @@ Now you need to modify files in the `/src` directory as shown in the steps below #[returns(String)] GetGreeting {}, } - - #[cw_serde] - pub struct GetCountResponse { - pub count: i32, - } ``` 2. Open the `helpers.rs` file and replace its contents with this code: @@ -251,58 +246,48 @@ wasm-opt -Os -o target/wasm32-unknown-unknown/release/hello_world.wasm \ ## 6. Store the contract on-chain -1. If you're deploying your contract on a local chain, make sure it's running. You can start your chain by executing this command in a separate terminal window: - - ```bash - wardend start - ``` - - If you're going to deploy on Chiado, skip this step. +If you're deploying on a local chain, make sure it's running. You can start your chain by running `wardend start` in a separate terminal window. -2. To store your contract on the Warden chain, run the command below. Specify your key name from [Prerequisites](#prerequisites) in the `--from` flag, also set the chain ID. +To store your contract on-chain, run the command below. Specify your key name from [Step 1](##1-prepare-the-chain) in the `--from` flag, also set the chain ID. - - - ```bash - wardend tx wasm store target/wasm32-unknown-unknown/release/hello_world.wasm \ - --from shulgin \ - --gas auto \ - --gas-adjustment 1.3 \ - --gas-prices 100000000000award \ - -y \ - --chain-id warden_1337-1 - ``` - - - ```bash - wardend tx wasm store target/wasm32-unknown-unknown/release/hello_world.wasm \ - --from my-key-name \ - --gas auto \ - --gas-adjustment 1.3 \ - --gas-prices 100000000000award \ - -y \ - --chain-id chain_123-1 - ``` - - - ```bash - wardend tx wasm store target/wasm32-unknown-unknown/release/hello_world.wasm \ - --from my-key-name \ - --gas auto \ - --gas-adjustment 1.3 \ - --gas-prices 100000000000award \ - -y \ - --chain-id chain_123-1 \ - --node https://rpc.chiado.wardenprotocol.org:443 - ``` - - - - The transaction should be successful without any errors. - - :::tip - If you used a `just` script or a devnet snapshot to run your node, you can omit the `--chain-id` flag in this and the following commands. - ::: + + +```bash +wardend tx wasm store target/wasm32-unknown-unknown/release/hello_world.wasm \ + --from shulgin \ + --gas auto \ + --gas-adjustment 1.3 \ + --gas-prices 100000000000award \ + -y \ + --chain-id warden_1337-1 +``` + + +```bash +wardend tx wasm store target/wasm32-unknown-unknown/release/hello_world.wasm \ + --from my-key-name \ + --gas auto \ + --gas-adjustment 1.3 \ + --gas-prices 100000000000award \ + -y \ + --chain-id chain_123-1 +``` + + +```bash +wardend tx wasm store target/wasm32-unknown-unknown/release/hello_world.wasm \ + --from my-key-name \ + --gas auto \ + --gas-adjustment 1.3 \ + --gas-prices 100000000000award \ + -y \ + --chain-id chain_123-1 \ + --node https://rpc.chiado.wardenprotocol.org:443 +``` + + + +The transaction should be successful without any errors. ## 7. Get the code ID diff --git a/docs/developer-docs/docs/build-an-app/deploy-smart-contracts-on-warden/deploy-an-evm-contract.md b/docs/developer-docs/docs/build-an-app/deploy-smart-contracts-on-warden/deploy-an-evm-contract.md index 369b19e62..bcad854c5 100644 --- a/docs/developer-docs/docs/build-an-app/deploy-smart-contracts-on-warden/deploy-an-evm-contract.md +++ b/docs/developer-docs/docs/build-an-app/deploy-smart-contracts-on-warden/deploy-an-evm-contract.md @@ -34,44 +34,112 @@ Before you start, complete the following prerequisites: ```bash npm install @truffle/hdwallet-provider ``` -- [Run a local chain](/operate-a-node/run-a-local-chain) and make sure you have `wardend` correctly installed. Get the information required for the next steps: - - Check the list of available keys (local accounts) and note down your key name. +## 1. Prepare the chain - ```bash - wardend keys list - ``` +### Option 1. Run a local chain - :::tip - If you used our `just` script to run the node with default settings, the local account name is `shulgin`. - ::: +1. Run a local chain as explained here: [Run a local chain](/operate-a-node/run-a-local-chain). Note that you'll need to [install Go](https://golang.org/doc/install) 1.22.3 or later and [just](https://github.com/casey/just) 1.34.0 or later. - - Execute a command for getting the private key associated with this key name. You'll need it in [Step 3](#3-configure-truffle). +2. Check the list of available keys (local accounts) and note down your key name. - - - ```bash - wardend keys export shulgin --unarmored-hex --unsafe - ``` - - - ```bash - wardend keys export my-key-name --unarmored-hex --unsafe - ``` - - + ```bash + wardend keys list + ``` + + :::tip + If you used our `just` script to run the node with default settings, the local account name is `shulgin`. + ::: + +3. Check the local account balance to make sure it has funds: + + + + ```bash + wardend query bank balances shulgin + ``` + + + ```bash + wardend query bank balances my-key-name + ``` + + - - You'll also need your chain ID. Run the following and note down the value from the `network` field: +4. The next steps require the private key associated with this account. To get it, run this: + + + + ```bash + wardend keys export shulgin --unarmored-hex --unsafe + ``` + + + ```bash + wardend keys export my-key-name --unarmored-hex --unsafe + ``` + + + +5. You'll also need your chain ID. Run the following and note down the value from the `network` field: + + ```bash + wardend status + ``` - ``` - wardend status - ``` + :::tip + If you used our `just` script to run the node with default settings, the chain ID is `warden_1337-1`. + ::: - :::tip - If you used our `just` script to run the node with default settings, the chain ID is `warden_1337-1`. - ::: +### Option 2. Connect to Chiado -## 1. Create an EVM project +1. If you haven't yet, [install Go](https://golang.org/doc/install) 1.22.3 or later and [just](https://github.com/casey/just) 1.34.0 or later. + +2. Clone the repository with Warden source code. Then build the binary and initialize the chain home folder: + + ```bash + git clone --depth 1 --branch v0.5.2 https://github.com/warden-protocol/wardenprotocol + cd wardenprotocol + just wardend build + just wardend install + wardend init my-chain-moniker + ``` + +3. Create a new key: + + ```bash + wardend keys add my-key-name + ``` + +4. Write down the **mnemonic phrase** and the **address** of the new account. You'll need this information to interact with the chain and restore the account. + + :::warning + The seed phrase is the only way to restore your keys. Losing it can result in the irrecoverable loss of WARD tokens. + ::: + + :::tip + You can always check your public address by running this command: + + ```bash + wardend keys show my-key-name --address + ``` + ::: + +5. Fund your key using [Chiado faucet](https://faucet.chiado.wardenprotocol.org) and the public address returned in the previous step. + +6. Check your balance: + + ```bash + wardend query bank balances my-key-name --node https://rpc.chiado.wardenprotocol.org:443 + ``` + +7. The next steps require the private key associated with this account. To get it, run this: + + ```bash + wardend keys export my-key-name --unarmored-hex --unsafe + ``` + +## 2. Create an EVM project 1. Create a new directory `/warden-smart-contract` for your project and navigate there: @@ -86,7 +154,7 @@ Before you start, complete the following prerequisites: truffle init ``` -## 2. Create a smart contract +## 3. Create a smart contract In the `/contracts` directory, create a new file `HelloWarden.sol` with the following contents: @@ -111,31 +179,35 @@ contract HelloWarden { } ``` -## 3. Configure Truffle +## 4. Configure Truffle In the `/warden-smart-contract` directory, find the `truffle-config.js` file and update it with the code below. -Make adjustments in the code using your chain settings from [Prerequisites](#prerequisites): +Make adjustments in the code using your chain settings from [Step 1](#1-prepare-the-chain): 1. Replace `your_private_key` with your actual private key. -2. In `network_id`, specify the first number from your chain ID. For example, if your chain ID is `warden_1337-1` or `chain_123-1`, specify `1337` or `123` respectively. Alternatively, you can just use `"*"` to match any chain ID. +2. If you're running a local chain on a different machine from where you're deploying the contract, check the chain's host address by executing `wardend status` on the machine hosting the chain. Then adjust the `RPC_URL` value accordingly. +2. In `network_id`, specify the first number from the chain ID. For example, if your local chain ID is `warden_1337-1` or `chain_123-1`, specify `1337` or `123` respectively. The network ID of Chiado is `10010`. Alternatively, you can just use `"*"` to match any chain ID. 3. If needed, adjust the gas limit and price – `gas` and `gasPrice`. + + ```javascript title="/warden-smart-contract/truffle-config.js" const HDWalletProvider = require("@truffle/hdwallet-provider"); -// Your private key (keep this confidential and never commit it to version control!) +// Keep your private key confidential, DO NOT commit to version control! const PRIVATE_KEY = "your_private_key"; +// The standard localhost address and the node's RPC port +const RPC_URL = "127.0.0.1:8545"; + module.exports = { networks: { warden: { provider: function() { - return new HDWalletProvider(PRIVATE_KEY, "http://localhost:8545"); - }, - network_id: 1337, // The first number from your chain ID - host: "127.0.0.1", - port: 8545, + return new HDWalletProvider(PRIVATE_KEY, RPC_URL); + } + network_id: 1337, // The first number from the chain ID gas: 5500000, gasPrice: 20000000000 // award }, @@ -146,13 +218,40 @@ module.exports = { } } }; - ``` +``` + + +```javascript title="/warden-smart-contract/truffle-config.js" +const HDWalletProvider = require("@truffle/hdwallet-provider"); -:::note -The `host` and `port` values are the standard localhost address and the RPC port of the node. `HDWalletProvider` uses the same URL to connect to the node. If you're running your node on the same machine where you're deploying the contract, you don't need to change these settings. Otherwise, run `wardend status` to check the host address and adjust the configuration accordingly. -::: +// Keep your private key confidential, DO NOT commit to version control! +const PRIVATE_KEY = "your_private_key"; + +// Chiado's EVM endpoint +const RPC_URL = "https://evm.chiado.wardenprotocol.org"; + +module.exports = { + networks: { + warden: { + provider: function() { + return new HDWalletProvider(PRIVATE_KEY, RPC_URL); + } + network_id: 10010, // The first number from the chain ID + gas: 5500000, + gasPrice: 20000000000 // award + }, + }, + compilers: { + solc: { + version: "0.8.20", + } + } +}; +``` + + -## 4. Create a migration script +## 5. Create a migration script In `/migrations`, create a new file `2_deploy_hello_warden.js` with the following contents: @@ -164,7 +263,7 @@ module.exports = function(deployer) { }; ``` -## 5. Compile the contract +## 6. Compile the contract To compile your contract, run this command: @@ -183,13 +282,24 @@ Compiling your contracts... - solc: 0.8.20+commit.c7dfd78e.Emscripten.clang ``` -## 6. Deploy the contract +## 7. Deploy the contract +If you're deploying on a local chain, make sure it's running. You can start your chain by running `wardend start` in a separate terminal window. + To deploy the contract, run this: + + ```bash truffle migrate --network warden ``` + + +```bash +truffle migrate --network warden --node https://rpc.chiado.wardenprotocol.org:443 +``` + + You should see the following output, confirming the successful deployment. @@ -237,7 +347,7 @@ Summary Due to Evmos default settings, this log displays prices in ETH and gwei. However, the contract itself uses Warden's currency – WARD, denominated in award. ::: -## 7. Interact with the contract +## 8. Interact with the contract 1. To interact with your contract, open the Truffle console: From a23c4b209a2823f5ef6a20fc2728a0792cc16adc Mon Sep 17 00:00:00 2001 From: Margarita Skomorokh Date: Mon, 28 Oct 2024 12:41:14 +0100 Subject: [PATCH 3/8] more fixes in the evm guide --- .../deploy-an-evm-contract.md | 132 +++++++++--------- 1 file changed, 66 insertions(+), 66 deletions(-) diff --git a/docs/developer-docs/docs/build-an-app/deploy-smart-contracts-on-warden/deploy-an-evm-contract.md b/docs/developer-docs/docs/build-an-app/deploy-smart-contracts-on-warden/deploy-an-evm-contract.md index bcad854c5..44033e1bf 100644 --- a/docs/developer-docs/docs/build-an-app/deploy-smart-contracts-on-warden/deploy-an-evm-contract.md +++ b/docs/developer-docs/docs/build-an-app/deploy-smart-contracts-on-warden/deploy-an-evm-contract.md @@ -181,75 +181,75 @@ contract HelloWarden { ## 4. Configure Truffle -In the `/warden-smart-contract` directory, find the `truffle-config.js` file and update it with the code below. +1. In the `/warden-smart-contract` directory, find the `truffle-config.js` file and update it with this code: -Make adjustments in the code using your chain settings from [Step 1](#1-prepare-the-chain): + + + ```javascript title="/warden-smart-contract/truffle-config.js" + const HDWalletProvider = require("@truffle/hdwallet-provider"); + + // Keep your private key confidential, DO NOT commit to version control! + const PRIVATE_KEY = "your_private_key"; + + // The standard localhost address and the node's RPC port + const RPC_URL = "http://127.0.0.1:8545"; + + module.exports = { + networks: { + warden: { + provider: function() { + return new HDWalletProvider(PRIVATE_KEY, RPC_URL); + }, + network_id: 1337, // The first number from the chain ID + gas: 5500000, + gasPrice: 20000000000 // award + }, + }, + compilers: { + solc: { + version: "0.8.20", + } + } + }; + ``` + + + ```javascript title="/warden-smart-contract/truffle-config.js" + const HDWalletProvider = require("@truffle/hdwallet-provider"); + + // Keep your private key confidential, DO NOT commit to version control! + const PRIVATE_KEY = "your_private_key"; + + // Chiado's EVM endpoint + const RPC_URL = "https://evm.chiado.wardenprotocol.org"; + + module.exports = { + networks: { + warden: { + provider: function() { + return new HDWalletProvider(PRIVATE_KEY, RPC_URL); + }, + network_id: 10010, // The first number from the chain ID + gas: 5500000, + gasPrice: 20000000000 // award + }, + }, + compilers: { + solc: { + version: "0.8.20", + } + } + }; + ``` + + -1. Replace `your_private_key` with your actual private key. -2. If you're running a local chain on a different machine from where you're deploying the contract, check the chain's host address by executing `wardend status` on the machine hosting the chain. Then adjust the `RPC_URL` value accordingly. -2. In `network_id`, specify the first number from the chain ID. For example, if your local chain ID is `warden_1337-1` or `chain_123-1`, specify `1337` or `123` respectively. The network ID of Chiado is `10010`. Alternatively, you can just use `"*"` to match any chain ID. -3. If needed, adjust the gas limit and price – `gas` and `gasPrice`. +2. Adjust the code and make sure all values are correct: - - -```javascript title="/warden-smart-contract/truffle-config.js" -const HDWalletProvider = require("@truffle/hdwallet-provider"); - -// Keep your private key confidential, DO NOT commit to version control! -const PRIVATE_KEY = "your_private_key"; - -// The standard localhost address and the node's RPC port -const RPC_URL = "127.0.0.1:8545"; - -module.exports = { - networks: { - warden: { - provider: function() { - return new HDWalletProvider(PRIVATE_KEY, RPC_URL); - } - network_id: 1337, // The first number from the chain ID - gas: 5500000, - gasPrice: 20000000000 // award - }, - }, - compilers: { - solc: { - version: "0.8.20", - } - } -}; -``` - - -```javascript title="/warden-smart-contract/truffle-config.js" -const HDWalletProvider = require("@truffle/hdwallet-provider"); - -// Keep your private key confidential, DO NOT commit to version control! -const PRIVATE_KEY = "your_private_key"; - -// Chiado's EVM endpoint -const RPC_URL = "https://evm.chiado.wardenprotocol.org"; - -module.exports = { - networks: { - warden: { - provider: function() { - return new HDWalletProvider(PRIVATE_KEY, RPC_URL); - } - network_id: 10010, // The first number from the chain ID - gas: 5500000, - gasPrice: 20000000000 // award - }, - }, - compilers: { - solc: { - version: "0.8.20", - } - } -}; -``` - - + - `your_private_key`: Replace it with your actual private key from [Step 1](#1-prepare-the-chain). + - `RPC_URL`: If you're running a local chain and deploying the contract on the same machine, use the standard localhost address. Otherwise, check the chain's host address by executing `wardend status` on the machine hosting the chain. For Chiado, specify its EVM endpoint: `https://evm.chiado.wardenprotocol.org`. + - `network_id`: Specify the first number from the chain ID. For example, if your local chain ID is `warden_1337-1`, the network ID is `1337`. The correct value for Chiado is `10010`. Alternatively, you can just use `"*"` to match any chain ID. + - If needed, adjust the gas limit and price – `gas` and `gasPrice`. ## 5. Create a migration script From 6f7da8e7cb07474b4ff7e6c535982dc1bfea8802 Mon Sep 17 00:00:00 2001 From: Margarita Skomorokh Date: Mon, 28 Oct 2024 12:59:03 +0100 Subject: [PATCH 4/8] coderabbit + broken anchors --- .../deploy-a-cross-chain-app.md | 6 +++--- .../deploy-a-wasm-contract.md | 6 +++--- .../deploy-an-evm-contract.md | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/developer-docs/docs/build-an-app/deploy-smart-contracts-on-warden/deploy-a-cross-chain-app.md b/docs/developer-docs/docs/build-an-app/deploy-smart-contracts-on-warden/deploy-a-cross-chain-app.md index 112f109f7..aac1529ef 100644 --- a/docs/developer-docs/docs/build-an-app/deploy-smart-contracts-on-warden/deploy-a-cross-chain-app.md +++ b/docs/developer-docs/docs/build-an-app/deploy-smart-contracts-on-warden/deploy-a-cross-chain-app.md @@ -292,7 +292,7 @@ Before you start, do the following: Start by creating a WASM contract that will burn tokens on the EVM contract: -1. Create a CosmWasm project. You can [use a template](deploy-a-wasm-contract#1-create-a-cosmwasm-project). +1. Create a CosmWasm project. You can [use a template](deploy-a-wasm-contract#2-create-a-cosmwasm-project). 2. In the `/src` directory of your project, create a `contract.rs` file with the code below. If you've used a template, update the existing file. @@ -405,7 +405,7 @@ Start by creating a WASM contract that will burn tokens on the EVM contract: ### 2.2. Add supporting code -In the following steps, you'll create files in the `/src` folder to add supporting code for your contract. If you're using a [CosmWasm project template](deploy-a-wasm-contract#1-create-a-cosmwasm-project), just update the existing files. +In the following steps, you'll create files in the `/src` folder to add supporting code for your contract. If you're using a [CosmWasm project template](deploy-a-wasm-contract#2-create-a-cosmwasm-project), just update the existing files. 1. Create a file named `msg.rs` with the following code: @@ -619,7 +619,7 @@ In the following steps, you'll create files in the `/src` folder to add supporti ### 2.3. Compile & optimize -Now you can [compile](deploy-a-wasm-contract#3-compile-the-contract) and [optimize](deploy-a-wasm-contract#4-optimize-the-code) your contract. +Now you can [compile](deploy-a-wasm-contract#4-compile-the-contract) and [optimize](deploy-a-wasm-contract#5-optimize-the-code) your contract. ### 2.4. Create a Warden account diff --git a/docs/developer-docs/docs/build-an-app/deploy-smart-contracts-on-warden/deploy-a-wasm-contract.md b/docs/developer-docs/docs/build-an-app/deploy-smart-contracts-on-warden/deploy-a-wasm-contract.md index 9bc90453f..d31120bf6 100644 --- a/docs/developer-docs/docs/build-an-app/deploy-smart-contracts-on-warden/deploy-a-wasm-contract.md +++ b/docs/developer-docs/docs/build-an-app/deploy-smart-contracts-on-warden/deploy-a-wasm-contract.md @@ -101,7 +101,7 @@ Before you start, complete the following prerequisites: ``` ::: -5. Fund your key using [Chiado faucet](https://faucet.chiado.wardenprotocol.org) and the public address returned in the previous step. +5. Fund your key using [Chiado faucet](https://faucet.chiado.wardenprotocol.org) and the public address obtained in the previous step. 6. Check your balance. Here and in other commands, you need to add the `--node` flag with an RPC URL for connecting to Chiado. @@ -248,7 +248,7 @@ wasm-opt -Os -o target/wasm32-unknown-unknown/release/hello_world.wasm \ If you're deploying on a local chain, make sure it's running. You can start your chain by running `wardend start` in a separate terminal window. -To store your contract on-chain, run the command below. Specify your key name from [Step 1](##1-prepare-the-chain) in the `--from` flag, also set the chain ID. +To store your contract on-chain, run the command below. Specify your key name from [Step 1](#1-prepare-the-chain) in the `--from` flag, also set the chain ID. @@ -291,7 +291,7 @@ The transaction should be successful without any errors. ## 7. Get the code ID -Get the code ID that indentifies your Wasm code: +Get the code ID that identifies your Wasm code: diff --git a/docs/developer-docs/docs/build-an-app/deploy-smart-contracts-on-warden/deploy-an-evm-contract.md b/docs/developer-docs/docs/build-an-app/deploy-smart-contracts-on-warden/deploy-an-evm-contract.md index 44033e1bf..eca8a20c1 100644 --- a/docs/developer-docs/docs/build-an-app/deploy-smart-contracts-on-warden/deploy-an-evm-contract.md +++ b/docs/developer-docs/docs/build-an-app/deploy-smart-contracts-on-warden/deploy-an-evm-contract.md @@ -125,7 +125,7 @@ Before you start, complete the following prerequisites: ``` ::: -5. Fund your key using [Chiado faucet](https://faucet.chiado.wardenprotocol.org) and the public address returned in the previous step. +5. Fund your key using [Chiado faucet](https://faucet.chiado.wardenprotocol.org) and the public address obtained in the previous step. 6. Check your balance: From 3e3fc1d174ca9a1c4e129a2d4411056f6293fc63 Mon Sep 17 00:00:00 2001 From: Margarita Skomorokh Date: Tue, 29 Oct 2024 14:36:40 +0100 Subject: [PATCH 5/8] a minor fix --- .../deploy-an-evm-contract.md | 9 --------- 1 file changed, 9 deletions(-) diff --git a/docs/developer-docs/docs/build-an-app/deploy-smart-contracts-on-warden/deploy-an-evm-contract.md b/docs/developer-docs/docs/build-an-app/deploy-smart-contracts-on-warden/deploy-an-evm-contract.md index eca8a20c1..f8031e648 100644 --- a/docs/developer-docs/docs/build-an-app/deploy-smart-contracts-on-warden/deploy-an-evm-contract.md +++ b/docs/developer-docs/docs/build-an-app/deploy-smart-contracts-on-warden/deploy-an-evm-contract.md @@ -288,18 +288,9 @@ If you're deploying on a local chain, make sure it's running. You can start your To deploy the contract, run this: - - ```bash truffle migrate --network warden ``` - - -```bash -truffle migrate --network warden --node https://rpc.chiado.wardenprotocol.org:443 -``` - - You should see the following output, confirming the successful deployment. From f3e68215ff9865bdc7fa2ba4f32c44433310cc6c Mon Sep 17 00:00:00 2001 From: Margarita Skomorokh Date: Tue, 29 Oct 2024 14:43:04 +0100 Subject: [PATCH 6/8] fixed a typo --- .../deploy-smart-contracts-on-warden/deploy-a-wasm-contract.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/developer-docs/docs/build-an-app/deploy-smart-contracts-on-warden/deploy-a-wasm-contract.md b/docs/developer-docs/docs/build-an-app/deploy-smart-contracts-on-warden/deploy-a-wasm-contract.md index d31120bf6..52f513180 100644 --- a/docs/developer-docs/docs/build-an-app/deploy-smart-contracts-on-warden/deploy-a-wasm-contract.md +++ b/docs/developer-docs/docs/build-an-app/deploy-smart-contracts-on-warden/deploy-a-wasm-contract.md @@ -227,7 +227,7 @@ Now you need to modify files in the `/src` directory as shown in the steps below ## 4. Compile the contract -To compile the contract, run the following from the `hellow-world` directory: +To compile the contract, run the following from the `hello-world` directory: ```bash cargo wasm From bebd9539733361d35cac23f7828a620c9af29ff1 Mon Sep 17 00:00:00 2001 From: Margarita Skomorokh Date: Thu, 31 Oct 2024 12:18:36 +0100 Subject: [PATCH 7/8] added a warning about deploying EVM contracts on Chiado and refactored introductions in contract guides --- .../deploy-a-wasm-contract.md | 9 ++++++--- .../deploy-an-evm-contract.md | 16 ++++++++++++++-- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/docs/developer-docs/docs/build-an-app/deploy-smart-contracts-on-warden/deploy-a-wasm-contract.md b/docs/developer-docs/docs/build-an-app/deploy-smart-contracts-on-warden/deploy-a-wasm-contract.md index 52f513180..860a72d25 100644 --- a/docs/developer-docs/docs/build-an-app/deploy-smart-contracts-on-warden/deploy-a-wasm-contract.md +++ b/docs/developer-docs/docs/build-an-app/deploy-smart-contracts-on-warden/deploy-a-wasm-contract.md @@ -9,10 +9,9 @@ import TabItem from '@theme/TabItem'; ## Overview -The [`x/wasm`](/learn/warden-protocol-modules/external-modules#xwasm) Warden module allows executing WebAssembly smart contracts developed with [CosmWasm](https://cosmwasm.com) and **Rust**. - -This guide explains how to create and deploy a simple "Hello World" WASM contract on the Warden chain. Since it's intended for testing purposes, you'll be running a local chain. +The [`x/wasm`](/learn/warden-protocol-modules/external-modules#xwasm) Warden module allows executing **WebAssembly smart contracts** developed with [CosmWasm](https://cosmwasm.com) and **Rust**. +This guide explains how to create and deploy a simple "Hello World" WASM contract on a Warden local chain or on [Chiado testnet](/operate-a-node/chiado-testnet/chiado-overview). ## Prerequisites Before you start, complete the following prerequisites: @@ -41,6 +40,8 @@ Before you start, complete the following prerequisites: ### Option 1. Run a local chain +To deploy a WASM contract locally, you need to run a local chain and make sure it's configured properly, as shown in the following steps: + 1. Run a local chain as explained here: [Run a local chain](/operate-a-node/run-a-local-chain). Note that you'll need to [install Go](https://golang.org/doc/install) 1.22.3 or later and [just](https://github.com/casey/just) 1.34.0 or later. 2. The next steps require your local account name, or key name. You can check the list of available keys by executing this command: @@ -69,6 +70,8 @@ Before you start, complete the following prerequisites: ### Option 2. Connect to Chiado +To deploy a WASM contract on [Chiado testnet](/operate-a-node/chiado-testnet/chiado-overview), you need to install its binary and fund your key, as shown in the following steps: + 1. If you haven't yet, [install Go](https://golang.org/doc/install) 1.22.3 or later and [just](https://github.com/casey/just) 1.34.0 or later. 2. Clone the repository with Warden source code. Then build the binary and initialize the chain home folder: diff --git a/docs/developer-docs/docs/build-an-app/deploy-smart-contracts-on-warden/deploy-an-evm-contract.md b/docs/developer-docs/docs/build-an-app/deploy-smart-contracts-on-warden/deploy-an-evm-contract.md index f8031e648..f07563e2b 100644 --- a/docs/developer-docs/docs/build-an-app/deploy-smart-contracts-on-warden/deploy-an-evm-contract.md +++ b/docs/developer-docs/docs/build-an-app/deploy-smart-contracts-on-warden/deploy-an-evm-contract.md @@ -9,9 +9,13 @@ import TabItem from '@theme/TabItem'; ## Overview -The [`x/evm`](/learn/warden-protocol-modules/external-modules#xevm) Warden module allows executing Ethereum Virtual Machine (EVM) contracts charged by [Evmos](https://docs.evmos.org/protocol/modules/evm). They are written in **Solidity**. +The [`x/evm`](/learn/warden-protocol-modules/external-modules#xevm) Warden module allows executing **Ethereum Virtual Machine (EVM)** contracts charged by [Evmos](https://docs.evmos.org/protocol/modules/evm) and written in **Solidity**. -This guide explains how to create and deploy a simple "Hello World" Solidity smart contract on the Warden chain. Since it's intended for testing purposes, you'll be running a local chain. +This guide explains how to create and deploy a simple "Hello World" Solidity smart contract on a Warden local chain or on [Chiado testnet](/operate-a-node/chiado-testnet/chiado-overview). + +:::warning +Please note that deployment on Chiado will be available only after the next Chiado upgrade. +::: ## Prerequisites @@ -39,6 +43,8 @@ Before you start, complete the following prerequisites: ### Option 1. Run a local chain +To deploy an EVM contract locally, you need to run a local chain and make sure it's configured properly, as shown in the following steps: + 1. Run a local chain as explained here: [Run a local chain](/operate-a-node/run-a-local-chain). Note that you'll need to [install Go](https://golang.org/doc/install) 1.22.3 or later and [just](https://github.com/casey/just) 1.34.0 or later. 2. Check the list of available keys (local accounts) and note down your key name. @@ -93,6 +99,12 @@ Before you start, complete the following prerequisites: ### Option 2. Connect to Chiado +:::warning +Please note that deployment on Chiado will be available only after the next Chiado upgrade. +::: + +To deploy an EVM contract on [Chiado testnet](/operate-a-node/chiado-testnet/chiado-overview), you need to install its binary and fund your key, as shown in the following steps: + 1. If you haven't yet, [install Go](https://golang.org/doc/install) 1.22.3 or later and [just](https://github.com/casey/just) 1.34.0 or later. 2. Clone the repository with Warden source code. Then build the binary and initialize the chain home folder: From 43af51fe6a92f2ad5d59780fd80b760853402fb9 Mon Sep 17 00:00:00 2001 From: Margarita Skomorokh Date: Fri, 1 Nov 2024 09:56:28 +0100 Subject: [PATCH 8/8] deleted the warning and mentioned the new binary v0.5.3 --- .../deploy-a-wasm-contract.md | 2 +- .../deploy-an-evm-contract.md | 10 +--------- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/docs/developer-docs/docs/build-an-app/deploy-smart-contracts-on-warden/deploy-a-wasm-contract.md b/docs/developer-docs/docs/build-an-app/deploy-smart-contracts-on-warden/deploy-a-wasm-contract.md index 860a72d25..58f27be6f 100644 --- a/docs/developer-docs/docs/build-an-app/deploy-smart-contracts-on-warden/deploy-a-wasm-contract.md +++ b/docs/developer-docs/docs/build-an-app/deploy-smart-contracts-on-warden/deploy-a-wasm-contract.md @@ -77,7 +77,7 @@ To deploy a WASM contract on [Chiado testnet](/operate-a-node/chiado-testnet/chi 2. Clone the repository with Warden source code. Then build the binary and initialize the chain home folder: ```bash - git clone --depth 1 --branch v0.5.2 https://github.com/warden-protocol/wardenprotocol + git clone --depth 1 --branch v0.5.3 https://github.com/warden-protocol/wardenprotocol cd wardenprotocol just wardend build just wardend install diff --git a/docs/developer-docs/docs/build-an-app/deploy-smart-contracts-on-warden/deploy-an-evm-contract.md b/docs/developer-docs/docs/build-an-app/deploy-smart-contracts-on-warden/deploy-an-evm-contract.md index f07563e2b..fe8814869 100644 --- a/docs/developer-docs/docs/build-an-app/deploy-smart-contracts-on-warden/deploy-an-evm-contract.md +++ b/docs/developer-docs/docs/build-an-app/deploy-smart-contracts-on-warden/deploy-an-evm-contract.md @@ -13,10 +13,6 @@ The [`x/evm`](/learn/warden-protocol-modules/external-modules#xevm) Warden modul This guide explains how to create and deploy a simple "Hello World" Solidity smart contract on a Warden local chain or on [Chiado testnet](/operate-a-node/chiado-testnet/chiado-overview). -:::warning -Please note that deployment on Chiado will be available only after the next Chiado upgrade. -::: - ## Prerequisites Before you start, complete the following prerequisites: @@ -99,10 +95,6 @@ To deploy an EVM contract locally, you need to run a local chain and make sure i ### Option 2. Connect to Chiado -:::warning -Please note that deployment on Chiado will be available only after the next Chiado upgrade. -::: - To deploy an EVM contract on [Chiado testnet](/operate-a-node/chiado-testnet/chiado-overview), you need to install its binary and fund your key, as shown in the following steps: 1. If you haven't yet, [install Go](https://golang.org/doc/install) 1.22.3 or later and [just](https://github.com/casey/just) 1.34.0 or later. @@ -110,7 +102,7 @@ To deploy an EVM contract on [Chiado testnet](/operate-a-node/chiado-testnet/chi 2. Clone the repository with Warden source code. Then build the binary and initialize the chain home folder: ```bash - git clone --depth 1 --branch v0.5.2 https://github.com/warden-protocol/wardenprotocol + git clone --depth 1 --branch v0.5.3 https://github.com/warden-protocol/wardenprotocol cd wardenprotocol just wardend build just wardend install