astroport-native-coin-wrapper

Crates.ioastroport-native-coin-wrapper
lib.rsastroport-native-coin-wrapper
version0.1.0
sourcesrc
created_at2023-07-20 17:21:42.610927
updated_at2023-07-20 17:21:42.610927
descriptionAstroport Native Coin Wrapper wraps native coins to CW20 tokens enabling them to be used as Astroport 3rd party rewards in generator.
homepagehttps://astroport.fi
repositoryhttps://github.com/astroport-fi/astroport
max_upload_size
id921599
size43,464
Timofey (epanchee)

documentation

README

Astroport native coins wrapper contract

This contract allows you to wrap native coins into Cw20 tokens.


InstantiateMsg

Initializes the contract with the token code identifier that will be used to create a Cw20 token for wrapping native coins.

{
  "denom": "denom",
  "token_code_id": 123,
  "token_decimals": 6
}

ExecuteMsg

wrap

Wraps the amount of specified native coin and issues cw20 tokens instead. You should send the amount of the native coin through the funds array.

{
  "wrap": {}
}

receive

CW20 receive msg.

{
  "receive": {
    "sender": "terra...",
    "amount": "123",
    "msg": "<base64_encoded_json_string>"
  }
}

Unwrap

Receives Cw20 wrapped tokens and returns unwrapped native coins.

Execute this message by calling the CW20 native wrapped token contract and use a message like this:

{
  "send": {
    "contract": <NativeWrapperContractAddress>,
    "amount": "999",
    "msg": "base64-encodedStringOfWithdrawMsg"
  }
}

In send.msg, you may encode this JSON string into base64 encoding:

{
  "unwrap": {}
}

QueryMsg

config

Returns the general config of the contract.

{
  "config": {}
}
Commit count: 1186

cargo fmt