Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Missing Data Types in Install Command #129

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions docs/1-quickstart-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,14 @@ For greater detail into the creation and mechanics of the Casper fungible token

Before using this guide, ensure you meet the following requirements:

- Set up your machine as per the [prerequisites](https://docs.casper.network/developers/prerequisites/)
- Use the [Casper command-line client]
- Get a valid [`node-address`](https://cspr.live/tools/peers)
- Know how to deploy a [smart contract](https://docs.casper.network/developers/dapps/sending-deploys/) to a Casper network
- Hold enough CSPR tokens to pay for transactions
- Set up the [development prerequisites](https://docs.casper.network/developers/prerequisites/), including the [Casper client](https://docs.casper.network/developers/prerequisites/#install-casper-client)
- Get a valid [node address](https://docs.casper.network/developers/prerequisites/#acquire-node-address-from-network-peers)
- Know how to install a [smart contract](https://docs.casper.network/developers/cli/sending-deploys/) on a Casper network
- Hold enough CSPR tokens to pay for transactions

# Setup

Clone the [fungible token (CEP-18) contract repository](https://github.com/casper-ecosystem/cep18) and run the `make build-contract` command. This will create the `cep18.wasm` and the `cep18_test_contract.wasm`. The token Wasm is the main contract. We will use the `cep18_test_contract` Wasm to query the balances and allowances of the fungible token balances throughout this workflow.
Clone the [fungible token (CEP-18) contract repository](https://github.com/casper-ecosystem/cep18) and run the `make test` command. This will create the `cep18.wasm` and the `cep18_test_contract.wasm`. The token Wasm is the main contract. We will use the `cep18_test_contract` Wasm to query token balances and allowances throughout this workflow.

## Install the Main Fungible Token Contract

Expand Down
41 changes: 21 additions & 20 deletions docs/full-tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ This section briefly explains the contract methods used in the Casper Fungible T

To see the full implementation of the below contract methods, refer to the [contract file](https://github.com/casper-ecosystem/cep18/blob/master/cep18/src/main.rs) in Github. If you have any questions, review the [casper_erc20](https://docs.rs/casper-erc20-crate/latest/casper_erc20_crate/) library and the [EIP-20](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md#) standard.

Also, for further unresolved issues please contact the Casper support team via the [Discord channel](https://discord.com/invite/Q38s3Vh).
Also, for further unresolved issues please contact the Casper support team via the [Discord channel](https://discord.com/invite/casperblockchain).

Contract methods are:

Expand All @@ -153,7 +153,7 @@ Contract methods are:

# Installing the Contract

After customizing your instance of the CEP-18 token contract, it's time to install it in global state. Installing the Fungible Token contract is similar to installing other smart contracts, while only the Wasm files and parameters will differ. Refer to the [Sending Deploys to a Casper network using the Rust Client](https://docs.casper.network/developers/dapps/sending-deploys/) section to learn more about install contracts.
After customizing your instance of the CEP-18 token contract, it's time to install it in global state. Installing the Fungible Token contract is similar to installing other smart contracts, while only the Wasm files and parameters will differ. Refer to the [Sending Deploys to a Casper network using the Rust Client](https://docs.casper.network/developers/cli/sending-deploys/) section to learn more about install contracts.

## Deploy Prerequisites {#deploy-prerequisites}

Expand Down Expand Up @@ -225,7 +225,7 @@ casper-client get-state-root-hash --node-address http://<HOST:PORT>
Run the following command and supply the path to your public key in hexadecimal format to get the account hash.

```bash
casper-client account-address --public-key "[PATH_TO_YOUR_KEY]/public_key_hex"
casper-client account-address --public-key "[PATH_TO_PUBLIC_KEY_HEX]"
```

**Querying global state**
Expand All @@ -243,7 +243,7 @@ casper-client query-global-state \

Now you can install the contract to the network and check how it behaves.

If you are sending the deploy on Mainnet, try several put deploys on the Testnet to understand the exact gas amount required for that deploy. Refer to the [note about gas price](https://docs.casper.network/developers/dapps/sending-deploys/#a-note-about-gas-price) to understand more about payment amounts and gas price adjustments.
If you are sending the deploy on Mainnet, try several put deploys on the Testnet to understand the exact gas amount required for that deploy. Refer to the [note about gas price](https://docs.casper.network/developers/cli/sending-deploys/#a-note-about-gas-price) to understand more about payment amounts and gas price adjustments.

**The Casper platform currently does not refund any tokens as part of sending a deploy.** For example, if you spend 10 CSPR for the deployment and it only costs 1 CSPR, you will not receive the remaining 9 CSPR. Refer to the [Gas and the Casper Blockchain](https://docs.casper.network/concepts/economics/gas-concepts/) documentation for further details.

Expand All @@ -252,27 +252,28 @@ Use the following command template to deploy the contract:
```bash
casper-client put-deploy \
--node-address http://<HOST:PORT> \
--chain-name [NETWORK_NAME]] \
--secret-key [PATH_TO_YOUR_KEY]/secret_key.pem \
--chain-name [NETWORK_NAME] \
--secret-key [PATH_TO_SECRET_KEY] \
--payment-amount [AMOUNT] \
--session-path [WASM_FILE_PATH]/[File_Name].wasm
--session-arg <"NAME:TYPE='VALUE'" OR "NAME:TYPE=null">
--session-path [WASM_FILE_PATH] \
--session-arg <"NAME:TYPE='VALUE'">
```

- `NETWORK_NAME`: Use the relevant network name. Here we use '_casper-test_'
- `PATH_TO_YOUR_KEY`: Replace this with the actual path of your secret key
- `PAYMENT_AMOUNT`: Gas amount in tokens needed for contract execution. If there are no adequate tokens, the deploy will not execute and will return an error
- `WASM FILE PATH`: The session-path argument should point to the location of your compiled Fungible Token Wasm file
- `NETWORK_NAME`: The relevant network name
- `PATH_TO_SECRET_KEY`: The path to your secret key
- `AMOUNT`: Gas amount in motes needed for deploy execution
- `WASM_FILE_PATH`: The location of your compiled fungible token Wasm file
- `NAME:TYPE='VALUE'`: The required and optional arguments for installing the contract

Here is a sample _put-deploy_ command:

```bash
casper-client put-deploy \
--node-address http://95.216.24.237:7777 \
--node-address https://rpc.testnet.casperlabs.io/ \
--chain-name casper-test \
--secret-key "/home/ubuntu/secret_key.pem" \
--payment-amount 1000000 \
--session-path "<machine-path>/cep18/target/wasm32-unknown-unknown/release/cep18.wasm"
--session-path "target/wasm32-unknown-unknown/release/cep18.wasm" \
--session-arg "name='Token test', symbol='TEST', decimals:u8=10, total_supply:u256=1000"
```

Expand Down Expand Up @@ -323,7 +324,7 @@ Here is the command to query the state of the network:

```bash
casper-client query-global-state \
--key account-hash-<account-address> \
--key account-hash-<HASH> \
--node-address http://<HOST:PORT> \
--state-root-hash E5B679BD1562fE6257257F5f969A79482E8DCEBBD501501BfA6d5844b61cBE3f
```
Expand All @@ -344,18 +345,18 @@ This result contains the network state before the deploy. You can see the `named
"merkle_proof": "[25564 hex chars]",
"stored_value": {
"Account": {
"account_hash": "account-hash-<account-address> ",
"account_hash": "account-hash-<HASH> ",
"action_thresholds": {
"deployment": 1,
"key_management": 1
},
"associated_keys": [
{
"account_hash": "account-hash-<account-address> ",
"account_hash": "account-hash-<HASH> ",
"weight": 1
}
],
"main_purse": "uref-<hash>",
"main_purse": "uref-<HASH>",
"named_keys": []
}
}
Expand All @@ -372,11 +373,11 @@ Send the Deploy containing your contract with this command:

```bash
casper-client put-deploy \
--node-address http://<HOST:PORT> \
--node-address https://rpc.testnet.casperlabs.io/ \
--chain-name casper-test \
--secret-key "/home/ubuntu/secret_key.pem" \
--payment-amount 1000000 \
--session-path "<machine-path>/cep18/target/wasm32-unknown-unknown/release/cep18.wasm"
--session-path "target/wasm32-unknown-unknown/release/cep18.wasm" \
--session-arg "name='Token test', symbol='TEST', decimals:u8=10, total_supply:u256=1000"
```

Expand Down
Loading