The CW20 Exchange ADO is used to sell CW20 tokens for other assets. The token to be sold is specified at instantiation, and then sales can be started on the token by the contract owner by sending them to this ADO. Each sale has an "asset" to purchase the tokens with. This asset can be:
CW20
Native
Users can then purchase the CW20 token being sold by sending the required asset to the contract.
Multiple sales can take place at the same time but no two sales can have the same purchasing asset.
ado_type: cw20-exchange
Version: 2.0.1-beta.1
Name | Type | Description |
---|---|---|
Receives CW20 tokens sent from the token_address
contract by performing a Send. These tokens can be set for sale or used to purchase other CW20 tokens. This depends on the attached hook message.
The msg
in the Cw20ReceiveMsg
should be a base64 encoded Cw20HookMsg
.
The CW20 tokens sent with StartSale should come from the contract address specified at instantiation.
The CW20 tokens sent with Purchase should be the same as the defined Asset from StartSale message.
Only available to the contract owner.
The asset to be traded cannot be the same as the asset being bought specified at instantiation.
Starts a sale on the CW20 tokens sent. This is attached as a msg
when sending the CW20 tokens to the Exchange ADO.
Native SDK coins: To create an asset info instance of this type, provide the denomination
CW20 tokens: To create an asset info instance of this type, provide the contract address
Purchase tokens using the CW20 tokens sent. This is attached as a msg
when sending the CW20 tokens to the Exchange ADO.
You need to send an amount wich will get you a whole number in exchange. For example if the exchange rate is 5, then you need to send a multiple of 5 and nothing in between.
Only available for the contract owner.
Cancels an ongoing sale.
Purchase tokens with native funds.
Dont be confused by the previous Purchase message. Although they share the same name, the first message is attached to a CW20 Send and is used to buy using CW20 tokens while this message is called directly on the CW20 Exchange ADO and is used to buy using native funds.
You need to attach the native funds to the message when calling this Purchase.
The rest of the execute messages can be found in the ADO Base section.
Queries the sale info for the specified asset.
Queries the contract address of the token being purchased.
The address of the token being sold.
Queries the different assets of the sale.
A vec of string containing each of the assets.
The rest of the query messages can be found in the ADO Base section.
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
token_address
Address of the CW20 token to be sold.
kernel_address
String
Contract address of the kernel contract to be used for AMP messaging. Kernel contract address can be found in our deployed contracts.
owner
Option<String>
Optional address to specify as the owner of the ADO being created. Defaults to the sender if not specified.
asset
The asset that may be used to purchase the token.
exchange_rate
Uint128
The amount of the above asset
required to purchase a single token.
recipient
Option<String>
The recipient of the sale proceeds. Defaults to the sender if not specified.
start_time
Optional start time in milliseconds since epoch. If not specified, then the sale will start immediately.
duration
Optional duration for the sale in milliseconds from the start_time
. If not specified then the sale never expires.
recipient
Option<String>
Optional recipient of the purchased CW20 tokens. If not set, defaults to the sender.
asset
The purchasing asset of the sale to cancel.
recipient
Option<String>
Optional recipient to receive the purchased tokens. Defaults to the sender if not specified.
asset
The asset of the sale to get info for.
sale
Option<Sale>
The sale data if it exists.
exchange_rate
Uint128
The amount of exchange asset needed to purchase one token.
amount
Uint128
The amount of tokens for sale at the specified exchange_rate.
recipient
String
The recipient of the sale proceeds.
start_time
The time when the sale starts.
end_time
The time when the sale ends.
start_amount
Uint128
The amount of CW20 tokens for sale at the given rate at the start of the sale
start_after
Option<String>
An optional address for which to start after, used for pagination.
limit
Option<u32>
Optional limit to the number of assets that are returned. Default limit is 50 and the max limit is 100.