Skip to content

Plasma OTC Contract Executions

Below is a list of the available execute messages that can be called to interact with the Plasma OTC contract.

Kujira Testnet Plasma Contract Address: kujira12xtsmfr8x6uv37dvdlxdkhu0egyudnkwvflkw55qv55jjg0spq0s6qm78t

Kujira Mainnet Plasma Contract Address: kujira1daem6pjw74e8sgcp60cxw2l72q43045ge27t7z5q2q2xqkyge44sxlqnf8

create

Creates various types of escrows that will be defined below.

Depending on the type of escrow being created, there will be a slight variation in required values that are expected by the contract. The various escrow types will be defined below with basic field input values shown for each type. The escrow maker's funds must also be deposited at the same time when executing the create message.

All escrow create messages will require the escrow parameter values to be populated using the structure defined below:

Input parameters
//Below is the complete list of all values that can be used when creating an escrow
pub struct Escrow {
    /// Escrow Type
    pub otc_type: EscrowType,    ///See enum definition below
    /// Taker wallet address needs to be specified when creating a private escrow
    pub taker: Option<Addr>,
    /// Title of the escrow, for example for a bug bounty "Fix issue in contract.rs"
    pub title: Option<String>,
    /// Description of the escrow, a more in depth description of how to meet the escrow condition
    pub description: Option<String>,
    /// When start time (in seconds since epoch 00:00:00 UTC on 1 January 1970) is set and
    /// block time exceeds this value, the escrow is started and can be taken.
    pub start_time: Option<u64>,
    /// When end time (in seconds since epoch 00:00:00 UTC on 1 January 1970) is set and
    /// block time exceeds this value, the escrow is expired.
    /// Once an escrow is expired, it can be returned to the original funder (via "refund").
    pub end_time: Option<u64>,
    /// Asking price
    pub asking_price: Coin,
    /// Vesting Account
    pub vesting_enabled: Option<bool>,
    /// Vesting Account
    pub vesting_account: Option<Addr>,
    /// Vesting End Time
    pub vesting_end_time: Option<u64>,
    /// Vesting Duration
    pub vesting_delayed: Option<bool>,
    /// Partial Fills Allowed
    pub partial_fills_enabled: Option<bool>,
    /// Partial Fill Minimum
    pub partial_fill_minimum: Option<Uint128>,
    /// Partial Fill Maximum
    pub partial_fill_maximum: Option<Uint128>,
    /// Whitelist Enabled
    pub whitelist_enabled: Option<bool>,
}


pub enum EscrowType {
  Standard,
  PartialFill,
  AirDrop,
  Burn,
}

Standard Escrow

A simple deal between two individuals which can be public or private and can use any token approved by Plasma. It cannot be partially filled.

When creating a standard escrow the the following actions are not permitted:

  1. The 3 partial fill fields may not be populated.
  2. Whitelisting wallets is not permitted(via whitelist_enabled being set to true)
Sample message for a Standard Escrow
{
  "create": {
    "otc_type": "Standard",
    "taker": null,                  //Populate with wallet address if a private escrow is being created for a specified recipient
    "asking_price": {
      "amount": "1000000",
      "denom": "factory/kujira1ltvwg69sw3c5z99c6rr08hal7v0kdzfxz07yj5/demo"
    },
    "description": "Description Text",
    "title": "Title Text",
    "start_time": null,             //If null then the escrow is active immediately
    "end_time": null,               //If null then the escrow has no expiry time limit
    "vesting_enabled": false,
    "vesting_account": null,
    "vesting_end_time": null,
    "vesting_delayed": null,
    "partial_fills_enabled": null,
    "partial_fill_minimum": null,
    "partial_fill_maximum": null,
    "whitelist_enabled": false      
  }
}

Partial Fill Escrow

An escrow offered by one maker with multiple takers. It is available as a public deal only. Takers can accept as much or as little of the deal as they desire. Makers may cancel the deal at any time. If it has been partially accepted by takers, makers are returned what remains of their offered tokens if the deal expires or the maker cancels the deal.

When creating a partial fill escrow the following actions are not permitted:

  1. The escrow taker wallet address may not be specified.
  2. The partial fill min and max values may not be specified
  3. Whitelisting wallets is not permitted(via whitelist_enabled being set to true)
Sample message for a PartialFill Escrow
{
  "create": {
    "otc_type": "PartialFill",
    "taker": null,                  
    "asking_price": {
      "amount": "1000000",
      "denom": "factory/kujira1ltvwg69sw3c5z99c6rr08hal7v0kdzfxz07yj5/demo"
    },
    "description": "Test Partial Deal",
    "title": "Partial",
    "start_time": null,             //If null then the escrow is active immediately
    "end_time": null,               //If null then the escrow has no expiry time limit
    "vesting_enabled": false,
    "vesting_account": null,
    "vesting_end_time": null,
    "vesting_delayed": null,
    "partial_fills_enabled": true,
    "partial_fill_minimum": null,
    "partial_fill_maximum": null,
    "whitelist_enabled": false      
  }
}

Airdrop Escrow

The maker creates a deal, provides the quantity of tokens to be distributed, the maximum amount per claim, and an expiration date (if one is required).

A whitelist is required to prevent takers from claiming multiple times using different addresses. The deal is complete when all tokens have been claimed. Successful takers will see their deal results under the Inbox tab. When whitelisting addresses, it is possible to set individual claim limits per wallet address, which will override the value set in partial_fill_maximum. This allows for different claim values per wallet address if the airdrop creator desires.

Any unclaimed tokens are returned to the maker once the deal expires or is cancelled.

When creating an airdrop escrow the following actions are not permitted:

  1. The escrow taker wallet address may not be specified.
Sample message for an Airdrop Escrow
{
  "create": {
    "otc_type": "AirDrop",
    "taker": null,
    "asking_price": {
      "amount": "0",
      "denom": "factory/kujira1ltvwg69sw3c5z99c6rr08hal7v0kdzfxz07yj5/demo"
    },
    "description": "Test Airdrop Deal",
    "title": "Airdrop",
    "start_time": 1690365432,
    "end_time": null,
    "vesting_enabled": false,
    "vesting_account": null,
    "vesting_end_time": null,
    "vesting_delayed": null,
    "partial_fills_enabled": true,
    "partial_fill_minimum": "0",
    "partial_fill_maximum": "0",
    "whitelist_enabled": true           //Must be set to true
  }
}

set_taker

Sets the Taker address of an Escrow. This is only required to be executed in the case of a public escrow where there is no taker specified.

taker_deposit

Executes a deposit from the taker of the escrow.

In the case of a standard escrow, the taker deposit needs to be for the full value of the deal. For partial escrows the taker can deposit any amount in the required denom. When executing taker_deposit on a standard escrow, the escrow will be marked as completed. When executing taker_deposit on a partial escrow, the escrow will remain active until the full asking value has been fulfilled or the end date/time of the escrow is reached.

It is possible to have the taker's tokens vest out. This will require populating the vesting_account value with a brand new unused wallet address as this is required by the standard Cosmos vesting functionality.

Input parameters
//The escrow takers funds must also be deposited at the same time when executing the taker_deposit message.

id: u64,                           //Id of the escrow to execute against
vesting_account: Option<String>,   //Standard Cosmos vesting requires this account to be unused(brand new)
Sample message for taker_deposit
{
  "taker_deposit": {
    "id": 1265,
    "vesting_account": null
   }
}

refund

Executes a refund to the escrow maker.

Refunds can be executed against any escrow that has not been fulfilled and the escrow will go into completed status In the case of a standard escrow the total funds that were deposited by the maker will be returned. For partial escrows the remaining balance of the makers deposit will be returned when executed.

Input parameters
id: u64,    //Id of the escrow to execute against
Sample message for refund
{
  "refund": {
    "id": 1283
  }
}

whitelist_action

Executes a change to the whilist on an Airdrop escrow.

Input parameters
id: u64,                    //Id of the escrow to execute against
whitelist: Vec<Whitelist>,  //Array of addresses and airdrop values for the execute message to action. Definition below
remove: Option<bool>,

pub struct Whitelist {
    pub address: String,
    pub minimum_amount: Option<Uint128>,
    pub maximum_amount: Option<Uint128>,
}
Sample message for whitelist_action
{
  "whitelist_action": {
    "id": 1323,
    "whitelist": [
      {
        "address": "kujira1xxxxxxxxxxmq14",
        "minimum_amount": "0",
        "maximum_amount": "100000"
      },
      {
        "address": "kujira1xxxxxxxxxxt73t",
        "minimum_amount": "0",
        "maximum_amount": "200000"
      }
    ],
    "remove": false
  }
}