Market

Create

Description:

This function creates a new market.

Previous Steps:

  1. Create an account

  2. Fund an account

Steps:

  1. Call the market/create_market endpoint with the following request body:

  • seed: the seed of the account that will pay for the transaction.

  • market_id: the market identifier.

Example Input:

{
    "seed": "//Alice",
    "market_id": 1
}

Expected Output:

  • who: the account address associated with the market.

  • market_id: the market identifier.

Create Market Rate

Description:

This function creates a new market rate.

Previous Steps:

  1. Create an account

  2. Fund an account

  3. Create a class

  4. Create an asset

  5. Mint an asset

Steps:

  1. Call the market/create_market_rate endpoint with the following request body:

  • seed: the seed of the account that will pay for the transaction.

  • market_id: the market identifier

  • market_rate_id: the market rate identifier

  • rates:

    • rates: an array of the requirements that the transaction needs to fullfilled.

    • metadata: additional information about the rates.

Example Input:

Expected Output:

  • who: the account address associated with the market.

  • market_id: the market identifier.

  • market_rate_id: the market rate identifier.

Deposit Assets

Description:

This function deposits a given amount of assets in the market.

Previous Steps:

  1. Create an account

  2. Fund an account

  3. Create a class

  4. Create an asset

  5. Mint an asset

Steps:

  1. Call the market/deposit_assets endpoint with the following request body:

  • seed: the seed of the account that will pay for the transaction.

  • market_id: the market identifier

  • market_rate_id: the market rate identifier

  • amount: the specific amount of assets to be deposited.

Example Input:

Expected Output:

  • who: the account address associated with the market.

  • market_id: the market identifier.

  • market_rate_id: the market rate identifier.

  • amount: the specific amount of assets deposited.

  • balances: an array of the results of each operation after the deposit

  • success: an indicator to see if the deposited was successful

Exchange Assets

Description:

This function deposits a given amount of assets in the market.

Previous Steps:

  1. Create an account

  2. Fund an account

  3. Create a class

  4. Create an asset

  5. Mint an asset

Steps:

  1. Call the market/exchange_assets endpoint with the following request body:

  • seed: the seed of the account that will pay for the transaction.

  • market_id: the market identifier

  • market_rate_id: the market rate identifier

  • amount: the specific amount of assets to be deposited.

Example Input:

Expected Output:

  • buyer: the account address associated with the market.

  • market_id: the market identifier.

  • market_rate_id: the market rate identifier.

  • amount: the specific amount of assets deposited.

  • balances: an array of the results of each operation after the deposit

  • success: an indicator to see if the deposited was successful

Last updated