---
# System prepended metadata

title: 'Wasmd deploy, instantiate and query contract'

---

# Wasmd deploy, instantiate and query contract

#### Setup environment
First source the cliffnet network configuration in the shell:
```shell
$ source <(curl -sSL https://raw.githubusercontent.com/CosmWasm/testnets/master/cliffnet-1/defaults.env)
```
Add wallets
```shell
$ wasmd keys add wallet
```

~~~md
name: wallet
  type: local
  address: wasm120zfx98pk3fd469hps4rgf0que4lgraz02035c
  pubkey: '{"@type":"/cosmos.crypto.secp256k1.PubKey","key":"AjfncoFpjzZ4DlXh9NKOpY0Lc4fgdsUlDaAR/5Kf1ey7"}'
  mnemonic: ""
**Important** write this mnemonic phrase in a safe place.
~~~
```shell
$ wasmd keys add wallet2
```

~~~md
name: wallet2
  type: local
  address: wasm1a006uek86c2salfjs2lcl42wnameyppjj4g377
  pubkey: '{"@type":"/cosmos.crypto.secp256k1.PubKey","key":"A1574WKcuRbqNjQBiPJ35pN+J7vsCqWZQC8PD7vtdXpL"}'
  mnemonic: ""
**Important** write this mnemonic phrase in a safe place.
~~~
##### Add amount to wallet from faucet
> If `jq` in not already installed, then run `brew install jq`

```shell
$ JSON=$(jq -n --arg addr $(wasmd keys show -a wallet) '{"denom":"upebble","address":$addr}') && curl -X POST --header "Content-Type: application/json" --data "$JSON" https://faucet.cliffnet.cosmwasm.com/credit
```
~~~md
 ok%
~~~
```shell
$ JSON=$(jq -n --arg addr $(wasmd keys show -a wallet2) '{"denom":"upebble","address":$addr}') && curl -X POST --header "Content-Type: application/json" --data "$JSON" https://faucet.cliffnet.cosmwasm.com/credit
```
~~~md
 ok%
~~~
##### Add env variables
```shell
$ export NODE=(--node $RPC)
$ export TXFLAG=($NODE --chain-id $CHAIN_ID --gas-prices 0.025upebble --gas auto --gas-adjustment 1.3)
```
Check if everything is configured well
```shell
$ wasmd query bank total $NODE
```

#### Compile and optimize contract
```shell
$ cd BL-contracts/
```
Make sure you have already generated optimized compiled contract in `artifacts` folder with 
```shell=
docker run --rm -v "$(pwd)":/code \
  --mount type=volume,source="$(basename "$(pwd)")_cache",target=/code/target \
  --mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \
  cosmwasm/workspace-optimizer:0.12.6
```

#### Upload the smart contract to the testnet
```shell
$ RES=$(wasmd tx wasm store artifacts/bl_market.wasm --from wallet $TXFLAG -y --output json -b block)
```
~~~md
gas estimate: 3433755
~~~

```shell
$ CODE_ID=$(echo $RES | jq -r '.logs[0].events[-1].attributes[0].value')
$ echo $CODE_ID 
```
~~~md
1493
~~~


```shell
$ wasmd query wasm list-contract-by-code $CODE_ID $NODE --output json
```
~~~md
 {"pagination":{}}
~~~

#### Initialize smart contract
##### Set InstantiateMsg parameters
```shell
$ INIT='{"config":{"owner":"wasm120zfx98pk3fd469hps4rgf0que4lgraz02035c","ptoken_code_id":1492,"close_factor":"1.3","protocol_admin": "wasm120zfx98pk3fd469hps4rgf0que4lgraz02035c","protocol_rewards_collector_address": "wasm120zfx98pk3fd469hps4rgf0que4lgraz02035c"}}'
```
##### Send InstantiateMsg to smart contract
```shell
$ wasmd tx wasm instantiate $CODE_ID "$INIT" --from wallet --label "test" --admin "wasm120zfx98pk3fd469hps4rgf0que4lgraz02035c" $TXFLAG -y
```
~~~md
gas estimate: 212261
logs: []
raw_log: '[]'
txhash: F0E3F110AFC3BE95C25F694AB1A029264394B73D2589793C5D0F8F9310DECB75
~~~
##### Query state
```shell
$ wasmd query wasm list-contract-by-code $CODE_ID $NODE --output json
```
~~~md
{"contracts":["wasm1upm6hqmjes8g6632kcem9nxru9wuq050pntctel07cstse94khlqv9p6rd"],"pagination":{}}
~~~
##### Get contract address
```shell
$ CONTRACT=$(wasmd query wasm list-contract-by-code $CODE_ID $NODE --output json | jq -r '.contracts[-1]')
$ echo $CONTRACT
```
~~~md
wasm1upm6hqmjes8g6632kcem9nxru9wuq050pntctel07cstse94khlqv9p6rd
~~~
##### Query using contract address
```shell
$ wasmd query wasm contract $CONTRACT $NODE
```
~~~md
address: wasm108kzuqh29q9gnn9rmcjgyeznhjk9xp6hf6f594tv7cadxm6de2yq8aczj8
contract_info:
  admin: wasm120zfx98pk3fd469hps4rgf0que4lgraz02035c
  code_id: "1487"
  creator: wasm120zfx98pk3fd469hps4rgf0que4lgraz02035c
  label: BL market repay
~~~
```shell
$ wasmd query wasm contract-state all $CONTRACT $NODE
```
~~~md
models:
- key: 636F6E666967
  value: eyJvd25lciI6Indhc20xMjB6Zng5OHBrM2ZkNDY5aHBzNHJnZjBxdWU0bGdyYXowMjAzNWMiLCJjbG9zZV9mYWN0b3IiOiIxLjMiLCJwdG9rZW5fY29kZV9pZCI6MTQ4MSwicHJvdG9jb2xfYWRtaW4iOiJ3YXNtMTIwemZ4OThwazNmZDQ2OWhwczRyZ2YwcXVlNGxncmF6MDIwMzVjIiwicHJvdG9jb2xfcmV3YXJkc19jb2xsZWN0b3JfYWRkcmVzcyI6Indhc20xMjB6Zng5OHBrM2ZkNDY5aHBzNHJnZjBxdWU0bGdyYXowMjAzNWMifQ==
- key: 636F6E74726163745F696E666F
  value: eyJjb250cmFjdCI6ImNyYXRlcy5pbzpibF9tYXJrZXQiLCJ2ZXJzaW9uIjoiMC4xLjAifQ==
- key: 676C6F62616C5F7374617465
  value: eyJtYXJrZXRfY291bnQiOjB9
pagination: {}
~~~
```shell
$ wasmd query wasm contract-state raw $CONTRACT 636F6E74726163745F696E666F $NODE --hex
```
~~~md
data: eyJjb250cmFjdCI6ImNyYXRlcy5pbzpibF9tYXJrZXQiLCJ2ZXJzaW9uIjoiMC4xLjAifQ==
~~~
```shell
$ wasmd query wasm contract-state all $CONTRACT $NODE --output "json" | jq -r '.models[0].value' | base64 -d
```
~~~md
{"owner":"wasm120zfx98pk3fd469hps4rgf0que4lgraz02035c","close_factor":"1.3","ptoken_code_id":1481,"protocol_admin":"wasm120zfx98pk3fd469hps4rgf0que4lgraz02035c","protocol_rewards_collector_address":"wasm120zfx98pk3fd469hps4rgf0que4lgraz02035c"}% 
~~~
#### Send QueryMsg to smart contract
```shell
$ wasmd query wasm contract-state smart $CONTRACT '{"get_config": {}}' $NODE
```
~~~md
data:
  close_factor: "1.3"
  market_count: 0
  owner: wasm120zfx98pk3fd469hps4rgf0que4lgraz02035c
  ptoken_code_id: 1481
~~~
#### Execute Update Config 
##### Set ExecuteMsg parameters
```shell
$ UPDATE_CONFIG='{"update_config":{"config":{"owner":"wasm120zfx98pk3fd469hps4rgf0que4lgraz02035c","cw20_code_id":1293,"close_factor":"1.2"}}}'
```
##### Send ExecuteMsg to smart contract
```shell
$ wasmd tx wasm execute $CONTRACT "$UPDATE_CONFIG" --from wallet $TXFLAG -y
```
~~~md
gas estimate: 149730
logs: []
raw_log: '[]'
txhash: 9B55D4B7655CF76BCC7DAC7D53994841DE9553BDDC87D485122C2994D2606E3D
~~~
##### Query for the update
```shell
$ wasmd query wasm contract-state smart $CONTRACT '{"get_config": {}}' $NODE
```
~~~md
 data:
  close_factor: "1.3"
  market_count: 0
  owner: wasm120zfx98pk3fd469hps4rgf0que4lgraz02035c
  ptoken_code_id: 1347
~~~
#### Execute Init Asset
```shell
$ INIT_ASSET='{"init_asset":{"asset":{"native":{"denom":"upebble"}},"asset_params":{"initial_borrow_rate":"0.01","reserve_factor":"0.01","max_loan_to_value":"0.4","liquidation_threshold":"0.5","liquidation_bonus":"0.15","interest_rate_model_params":{"linear":{"base":"0.02","optimal_utilization_rate":"0.8","slope_1":"0.07","slope_2":"3.0"}},"active":true,"deposit_enabled":true,"borrow_enabled":true},"asset_symbol":"UPB"}}'
$ wasmd tx wasm execute $CONTRACT "$INIT_ASSET" --from wallet $TXFLAG -y
```
~~~md
gas estimate: 484823
logs: []
raw_log: '[]'
txhash: BC64E2B6279DFEDBA032D7053D926093A0DCF8502374FA100AB53EB0EE3D1CE0
~~~
##### Check contract state
```shell
$ wasmd query wasm contract-state all $CONTRACT $NODE --output "json" | jq -r '.models[0].value' | base64 -d
```
~~~md
{"index":0,"ptoken_address":"wasm1f8wwvs7sl3zemdw50m2g3hncvdj6tcn6army4unqc5x8ujyfktfqud5u5t","asset_type":"native","max_loan_to_value":"0.4","liquidation_threshold":"0.5","liquidation_bonus":"0.15","reserve_factor":"0.01","interest_rate_model":{"linear":{"params":{"optimal_utilization_rate":"0.8","base":"0.02","slope_1":"0.07","slope_2":"3"}}},"borrow_index":"1","liquidity_index":"1","borrow_rate":"0.01","liquidity_rate":"0","indexes_last_updated":1655820422,"debt_total_scaled":"0","active":true,"deposit_enabled":true,"borrow_enabled":true}% 
~~~
##### QueryMsg for market state
```shell
$ QUERY_MARKET='{"get_market":{"asset":{"native":{"denom":"upebble"}}}}'
$ wasmd query wasm contract-state smart $CONTRACT "$QUERY_MARKET" $NODE
```
~~~md
data:
  active: true
  asset_type: native
  borrow_enabled: true
  borrow_index: "1"
  borrow_rate: "0.01"
  debt_total_scaled: "0"
  deposit_enabled: true
  index: 0
  indexes_last_updated: 1.655820422e+09
  interest_rate_model:
    linear:
      params:
        base: "0.02"
        optimal_utilization_rate: "0.8"
        slope_1: "0.07"
        slope_2: "3"
  liquidation_bonus: "0.15"
  liquidation_threshold: "0.5"
  liquidity_index: "1"
  liquidity_rate: "0"
  max_loan_to_value: "0.4"
  ptoken_address: wasm1f8wwvs7sl3zemdw50m2g3hncvdj6tcn6army4unqc5x8ujyfktfqud5u5t
  reserve_factor: "0.01"
~~~
##### QueryMsg for pToken state
```shell
$ PTOKEN_CONTRACT="wasm1f8wwvs7sl3zemdw50m2g3hncvdj6tcn6army4unqc5x8ujyfktfqud5u5t"
$ wasmd query wasm contract-state all $PTOKEN_CONTRACT $NODE --output "json" | jq -r '.models[3].value' | base64 -d
```
~~~md
{"name":"BL UPB Liquidity Token","symbol":"pUPB","decimals":6,"total_supply":"0","mint":{"minter":"wasm108kzuqh29q9gnn9rmcjgyeznhjk9xp6hf6f594tv7cadxm6de2yq8aczj8","cap":null}}%
~~~
#### Execute deposit native asset
```shell
$ DEPOSIT_NATIVE='{"deposit_native":{"denom":"upebble","on_behalf_of":null}}'
$ wasmd tx wasm execute $CONTRACT "$DEPOSIT_NATIVE" --from wallet $TXFLAG -y --amount 1000upebble
```
~~~md
gas estimate: 308106
logs: []
raw_log: '[]'
txhash: A04E9CC7A28E02CF31F673B5B969ECEC707581E51377B3526174FE4E56798BCA
~~~ 

##### QueryMsg for user state
```shell
$ QUERY_USER='{"get_user_collateral":{"user_address":"wasm120zfx98pk3fd469hps4rgf0que4lgraz02035c"}}'
$ wasmd query wasm contract-state smart $CONTRACT "$QUERY_USER" $NODE
```
~~~md
data:
  collateral:
  - asset_label: upebble
    asset_reference:
    - 117
    - 112
    - 101
    - 98
    - 98
    - 108
    - 101
    asset_type: native
    denom: upebble
    enabled: true
~~~ 
##### Check balance
```shell
$ WALLET=$( wasmd keys show -a wallet | tee /dev/tty | tail -1 | tr -d '\r' )
```
~~~md
wasm120zfx98pk3fd469hps4rgf0que4lgraz02035c
~~~
```shell
$ BALANCE_OF_WALLET=$( jq -n --arg address $WALLET '{ "balance": { "address": $address } }' | tee /dev/tty )
```
~~~md
{
  "balance": {
    "address": "wasm120zfx98pk3fd469hps4rgf0que4lgraz02035c"
  }
}
~~~
```shell
$ wasmd query wasm contract-state smart $PTOKEN_CONTRACT "$BALANCE_OF_WALLET" $NODE
```
~~~md
data:
  balance: "1000000000"
~~~
#### Execute withdraw native asset
```shell
$ WITHDRAW_PARAMS='{"withdraw":{"asset":{"native":{"denom":"upebble"}},"amount":"100","recipient":null}}'
$ wasmd tx wasm execute $CONTRACT "$WITHDRAW_PARAMS" --from wallet $TXFLAG -y
```
~~~md
gas estimate: 387045
logs: []
raw_log: '[]'
txhash: 624D498EDF0CF318CBDEE81746757EE62DF5FB7B54271AC7221F3F3B9B64CBB0
~~~
##### Check balance again
```shell
$ wasmd query wasm contract-state smart $PTOKEN_CONTRACT "$BALANCE_OF_WALLET" $NODE
```
~~~md
data:
  balance: "900000000"
~~~
#### Execute cw20 Init Asset
```shell
$ INIT_ASSET='{"init_asset":{"asset":{"cw20":{"contract_addr":"wasm17r53vvjedjycurxr3l4qfuchwxgdk0qlz2d0gvzvffj76weejmeqkj38ld"}},"asset_params":{"initial_borrow_rate":"0.01","reserve_factor":"0.01","max_loan_to_value":"0.4","liquidation_threshold":"0.5","liquidation_bonus":"0.15","interest_rate_model_params":{"linear":{"base":"0.02","optimal_utilization_rate":"0.8","slope_1":"0.07","slope_2":"3.0"}},"active":true,"deposit_enabled":true,"borrow_enabled":true},"asset_symbol":"BTOK"}}'
$ wasmd tx wasm execute $CONTRACT "$INIT_ASSET" --from wallet $TXFLAG -y
```
~~~md
gas estimate: 518928
logs: []
raw_log: '[]'
txhash: 182F6B972E8DD0EC72F649F17ED4C9BCAA3631824E883A6FB714EAD5C6E07E9E
~~~
#### Execute deposit cw20 asset
[Base64 encoding](https://www.base64encode.org/) of following need to be sent as `msg`:
~~~md
{
  "deposit_cw20": {
    "on_behalf_of": "wasm1a006uek86c2salfjs2lcl42wnameyppjj4g377"
  }
}
~~~
```shell
$ TRANSFER_TO_CONTRACT=$( jq -n --arg recipient $CONTRACT '{"send":{"contract":$recipient,"amount":"1000","msg":"ewogICJkZXBvc2l0X2N3MjAiOiB7CiAgICAib25fYmVoYWxmX29mIjogIndhc20xYTAwNnVlazg2YzJzYWxmanMybGNsNDJ3bmFtZXlwcGpqNGczNzciCiAgfQp9"}}' | tee /dev/tty )
```
~~~md
{
  "send": {
    "contract": "wasm1upm6hqmjes8g6632kcem9nxru9wuq050pntctel07cstse94khlqv9p6rd",
    "amount": "1000",
    "msg": "ewogICJkZXBvc2l0X2N3MjAiOiB7CiAgICAib25fYmVoYWxmX29mIjogIndhc20xMjB6Zng5OHBrM2ZkNDY5aHBzNHJnZjBxdWU0bGdyYXowMjAzNWMiCiAgfQp9"
  }
}
~~~
##### Execute the transfer from cw20 contract:
```shell
$ wasmd tx wasm execute $CW_CONTRACT "$TRANSFER_TO_CONTRACT" --from wallet2 $TXFLAG
```
~~~md
gas estimate: 483822
{"body":{"messages":[{"@type":"/cosmwasm.wasm.v1.MsgExecuteContract","sender":"wasm1a006uek86c2salfjs2lcl42wnameyppjj4g377","contract":"wasm17r53vvjedjycurxr3l4qfuchwxgdk0qlz2d0gvzvffj76weejmeqkj38ld","msg":{"send":{"contract":"wasm1upm6hqmjes8g6632kcem9nxru9wuq050pntctel07cstse94khlqv9p6rd","amount":"1000","msg":"ewogICJkZXBvc2l0X2N3MjAiOiB7CiAgICAib25fYmVoYWxmX29mIjogIndhc20xYTAwNnVlazg2YzJzYWxmanMybGNsNDJ3bmFtZXlwcGpqNGczNzciCiAgfQp9"}},"funds":[]}],"memo":"","timeout_height":"0","extension_options":[],"non_critical_extension_options":[]},"auth_info":{"signer_infos":[],"fee":{"amount":[{"denom":"upebble","amount":"12096"}],"gas_limit":"483822","payer":"","granter":""}},"signatures":[]}

confirm transaction before signing and broadcasting [y/N]: y
logs: []
raw_log: '[]'
txhash: F7850BA9266E6BD41E876F65E1897D0BB7B2BDF0208BA72CB456CEE2B128726F
~~~
##### Get markets list
```shell
$ QUERY_MARKET_LIST='{"get_markets_list":{}}'
$ wasmd query wasm contract-state smart $CONTRACT "$QUERY_MARKET_LIST" $NODE
```
~~~md
data:
  markets_list:
  - asset_label: upebble
    asset_reference:
    - 117
    - 112
    - 101
    - 98
    - 98
    - 108
    - 101
    asset_type: native
    cw20_token_address: wasm1f8wwvs7sl3zemdw50m2g3hncvdj6tcn6army4unqc5x8ujyfktfqud5u5t
    denom: upebble
  - asset_label: usd
    asset_reference:
    - 117
    - 115
    - 100
    asset_type: native
    cw20_token_address: wasm1mx6pr2e54j9a8d5dx56at395mqn02xhkqgd53tv58fyad33h83kqcgfygx
    denom: usd
  - asset_label: wasm17r53vvjedjycurxr3l4qfuchwxgdk0qlz2d0gvzvffj76weejmeqkj38ld
    asset_reference:
    - 119
    - 97
    - 115
    - 109
    - 49
    - 55
    - 114
    - 53
    - 51
    - 118
    - 118
    - 106
    - 101
    - 100
    - 106
    - 121
    - 99
    - 117
    - 114
    - 120
    - 114
    - 51
    - 108
    - 52
    - 113
    - 102
    - 117
    - 99
    - 104
    - 119
    - 120
    - 103
    - 100
    - 107
    - 48
    - 113
    - 108
    - 122
    - 50
    - 100
    - 48
    - 103
    - 118
    - 122
    - 118
    - 102
    - 102
    - 106
    - 55
    - 54
    - 119
    - 101
    - 101
    - 106
    - 109
    - 101
    - 113
    - 107
    - 106
    - 51
    - 56
    - 108
    - 100
    asset_type: cw20
    cw20_token_address: wasm1zyswl863p7vk0rcqvxpq4e4d8uhpffs00vc32glacjp63frqm68qzm3zya
    denom: BTOK
~~~
```shell
$ QUERY_MARKET='{"get_market":{"asset":{"cw20":{"contract_addr":"wasm17r53vvjedjycurxr3l4qfuchwxgdk0qlz2d0gvzvffj76weejmeqkj38ld"}}}}'
$ wasmd query wasm contract-state smart $CONTRACT "$QUERY_MARKET" $NODE
```
~~~md
data:
  active: true
  asset_type: cw20
  borrow_enabled: true
  borrow_index: "1"
  borrow_rate: "0.01"
  debt_total_scaled: "0"
  deposit_enabled: true
  index: 2
  indexes_last_updated: 1.655823571e+09
  interest_rate_model:
    linear:
      params:
        base: "0.02"
        optimal_utilization_rate: "0.8"
        slope_1: "0.07"
        slope_2: "3"
  liquidation_bonus: "0.15"
  liquidation_threshold: "0.5"
  liquidity_index: "1"
  liquidity_rate: "0"
  max_loan_to_value: "0.4"
  ptoken_address: wasm1zyswl863p7vk0rcqvxpq4e4d8uhpffs00vc32glacjp63frqm68qzm3zya
  reserve_factor: "0.01"
~~~
##### Check balance
```shell
$ WALLET2=$( wasmd keys show -a wallet2 | tee /dev/tty | tail -1 | tr -d '\r' )
$ BALANCE_OF_WALLET2=$( jq -n --arg address $WALLET2 '{ "balance": { "address": $address } }' | tee /dev/tty )
$ PTOKEN_CONTRACT="wasm1zyswl863p7vk0rcqvxpq4e4d8uhpffs00vc32glacjp63frqm68qzm3zya"
$ wasmd query wasm contract-state smart $PTOKEN_CONTRACT "$BALANCE_OF_WALLET2" $NODE
```
~~~md
data:
  balance: "1000000000"
~~~
#### Execute withdraw cw20 asset
```shell
$ WITHDRAW_PARAMS='{"withdraw":{"asset":{"cw20":{"contract_addr":"wasm17r53vvjedjycurxr3l4qfuchwxgdk0qlz2d0gvzvffj76weejmeqkj38ld"}},"amount":"10","recipient":"wasm1a006uek86c2salfjs2lcl42wnameyppjj4g377"}}'
$ wasmd tx wasm execute $CONTRACT "$WITHDRAW_PARAMS" --from wallet2 $TXFLAG -y
```
~~~md
gas estimate: 387045
logs: []
raw_log: '[]'
txhash: 624D498EDF0CF318CBDEE81746757EE62DF5FB7B54271AC7221F3F3B9B64CBB0
~~~
##### Check balance again
```shell
$ wasmd query wasm contract-state smart $PTOKEN_CONTRACT "$BALANCE_OF_WALLET2" $NODE
```
~~~md
data:
  balance: "990000000"
~~~
#### Execute Borrow cw20 asset
```shell
$ BORROW='{"borrow":{"asset":{"cw20":{"contract_addr":"wasm17r53vvjedjycurxr3l4qfuchwxgdk0qlz2d0gvzvffj76weejmeqkj38ld"}},"amount":"10","recipient":"wasm120zfx98pk3fd469hps4rgf0que4lgraz02035c"}}'
$ wasmd tx wasm execute $CONTRACT "$BORROW" --from wallet $TXFLAG -y
```
~~~md
gas estimate: 476793
logs: []
raw_log: '[]'
txhash: 6C6175D9EB54C1AEFA73ADECC4DA9E0C47FD12A92A7A635738EE539553718D8D
~~~
#### Execute Repay cw20 asset
[Base64 encoding](https://www.base64encode.org/) of following need to be sent as `msg`:
~~~md
{
  "repay_cw20": {
    "on_behalf_of": "wasm120zfx98pk3fd469hps4rgf0que4lgraz02035c"
  }
}
~~~
```shell
$ REPAY_TO_CONTRACT=$( jq -n --arg recipient $CONTRACT '{"send":{"contract":$recipient,"amount":"10","msg":"ewogICJyZXBheV9jdzIwIjogewogICAgIm9uX2JlaGFsZl9vZiI6ICJ3YXNtMTIwemZ4OThwazNmZDQ2OWhwczRyZ2YwcXVlNGxncmF6MDIwMzVjIgogIH0KfQ=="}}' | tee /dev/tty )
```
~~~md
{
  "send": {
    "contract": "wasm1upm6hqmjes8g6632kcem9nxru9wuq050pntctel07cstse94khlqv9p6rd",
    "amount": "10",
    "msg": "ewogICJyZXBheV9jdzIwIjogewogICAgIm9uX2JlaGFsZl9vZiI6ICJ3YXNtMTIwemZ4OThwazNmZDQ2OWhwczRyZ2YwcXVlNGxncmF6MDIwMzVjIgogIH0KfQ=="
  }
}
~~~
##### Execute the transfer from cw20 contract:
```shell
$ wasmd tx wasm execute $CW_CONTRACT "$REPAY_TO_CONTRACT" --from wallet $TXFLAG
```
~~~md
gas estimate: 377166
{"body":{"messages":[{"@type":"/cosmwasm.wasm.v1.MsgExecuteContract","sender":"wasm120zfx98pk3fd469hps4rgf0que4lgraz02035c","contract":"wasm17r53vvjedjycurxr3l4qfuchwxgdk0qlz2d0gvzvffj76weejmeqkj38ld","msg":{"send":{"contract":"wasm1upm6hqmjes8g6632kcem9nxru9wuq050pntctel07cstse94khlqv9p6rd","amount":"10","msg":"ewogICJyZXBheV9jdzIwIjogewogICAgIm9uX2JlaGFsZl9vZiI6ICJ3YXNtMTIwemZ4OThwazNmZDQ2OWhwczRyZ2YwcXVlNGxncmF6MDIwMzVjIgogIH0KfQ=="}},"funds":[]}],"memo":"","timeout_height":"0","extension_options":[],"non_critical_extension_options":[]},"auth_info":{"signer_infos":[],"fee":{"amount":[{"denom":"upebble","amount":"9430"}],"gas_limit":"377166","payer":"","granter":""}},"signatures":[]}

confirm transaction before signing and broadcasting [y/N]: y
logs: []
raw_log: '[]'
txhash: 878099627B0F11421986B68190B85AD641E6AE267C822D7AA3092FB3C467A0B2
~~~

