EnviDa Protocol
  • 🌍About Envida Blockchain
    • Introduction
    • Overview
    • Why EnviDa?
    • How it works?
    • Understanding the EnviDa Blockchain
    • DeFi Essentials
    • The Joint Potential of Blockchain, IOT and AI
  • πŸš™What is DriveMiner?
    • Environmental Tracking Devices
    • The Cost of Mining
    • The Solution of Mining
    • POW Consensus
    • Technical Specs
    • Device Sales and ROI
  • πŸ’°$EDAT Tokenomics
    • Detailed EDAT Tokenomics
    • ICO and Token Listings
    • Token Unlock and Allocation
    • Game Theory
  • πŸ“ˆStaking and Rewards
    • Reward Distribution
    • DriveMining Rewards
    • Validator Rewards
      • Unstaking Penalty
    • Staking Pool Rewards
      • Discounts
    • Data Collection Rewards
      • Stream Payment - Sensors
        • Competition and Arrival
      • Stream Payment - Lidiar
        • Teamwork
      • Pool Bonus
      • Formulas
  • ROI
  • πŸ¦Έβ€β™‚οΈFor Users
    • EnviDa Wallet
    • Driver Experience
    • Data Marketplace
    • DeFi Essentials
    • External Wallets
  • ⛓️Blockchain Architecture
    • Trustless EVM
    • Bridges
    • Runtime Development
    • Cross-Chain Compatibility
    • EnviDa Dex Engine
    • Technical Architecture
    • Scalability
    • Indexer & Explorer
    • Application Security
    • Storage
    • IPLD
    • Governance
    • Liquidity
    • Concensus
    • Runtime Environment
  • πŸ“”API Recipes
    • Account
    • Asset
    • Bag
    • Bundle
    • Market
  • 🌐EnviDa Network Infrastructure
  • ☸️Nodes and Validators
  • 🧠AI & Simulations
  • 🀝Network Referral System
  • πŸ›£οΈRoadmap
  • πŸ“šResources
    • Website
    • Business Whitepaper
    • Github
    • Technical Whitepaper
Powered by GitBook
On this page
  • Create
  • Create Market Rate
  • Deposit Assets
  • Exchange Assets
  1. API Recipes

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:

{
    "market_id": 1,
    "who": "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY"
}
  • 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:

{
    "seed": "//Alice",
    "market_id": 1,
    "market_rate_id": 1,
    "rates": {
        "rates": [
            {
                "class_id": 2000,
                "asset_id": 1,
                "action": {
                    "Transfer": 1
                },
                "from": "Market",
                "to": "Buyer"
            },
            {
                "class_id": 2000,
                "asset_id": 2,
                "action": {
                    "Mint": 1
                },
                "from": "Market",
                "to": "Buyer"
            },
            {
                "class_id": 3000,
                "asset_id": 1,
                "action": {
                    "Has": [
                        "GreaterEqualThan",
                        5000
                    ]
                },
                "from": "Buyer",
                "to": "Market"
            },
            {
                "class_id": 3000,
                "asset_id": 2,
                "action": {
                    "Transfer": 5
                },
                "from": "Buyer",
                "to": "Market"
            },
            {
                "class_id": 3000,
                "asset_id": 3,
                "action": {
                    "Burn": 50
                },
                "from": "Buyer",
                "to": "Market"
            },
            {
                "class_id": 4000,
                "asset_id": 1,
                "action": {
                    "Transfer": 2
                },
                "from": "Market",
                "to": {
                    "Account": "//Alice"
                }
            },
            {
                "class_id": 4000,
                "asset_id": 2,
                "action": {
                    "Transfer": 1
                },
                "from": "Buyer",
                "to": {
                    "Account": "//Alice"
                }
            }
        ],
        "metadata": []
    }
}

Expected Output:

{
    "market_id": 1,
    "market_rate_id": 1,
    "who": "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY"
}
  • 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:

{
    "seed": "//Alice",
    "market_id": 1,
    "market_rate_id": 1,
    "amount": 1000
}

Expected Output:

{
    "who": "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY",
    "market_id": 1,
    "market_rate_id": 1,
    "amount": 1000,
    "balances": [],
    "success": true
}
  • 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:

{
    "seed": "//Bob",
    "market_id": 1,
    "market_rate_id": 1,
    "amount": 1000
}

Expected Output:

{
    "buyer": "5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty",
    "market_id": 1,
    "market_rate_id": 1,
    "amount": 1000,
    "balances": [
        {
            "rate": {
                "class_id": 1,
                "asset_id": 1,
                "action": "Mint",
                "amount": 1000,
                "from": "Market",
                "to": "Buyer"
            },
            "balance": 1000000
        }
    ],
    "success": true
}
  • 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

PreviousBundleNextEnviDa Network Infrastructure

Last updated 2 years ago

πŸ“”
Create a market
Create a market
Create a market rate
Create a market
Create a market rate
Deposit assets