Create a Bitshares MPA

MPA is a price stable asset in Bitshares, for more information you could refer to the official document MPA

Well the instruction of creating/using the MPA is scattered around the documentations, so I rearranged here to demonstrate a complete example.

Create the asset

The whole command line:

create_asset nathan CNY 5 { "max_supply": "1000000000000000", "market_fee_percent": 0, "max_market_fee": "1000000000000000", "issuer_permissions": 80, "flags": 0, "core_exchange_rate": { "base": { "amount": 10000, "asset_id": "1.3.0" }, "quote": { "amount": 80000, "asset_id": "1.3.1" } }, "whitelist_authorities": [], "blacklist_authorities": [], "whitelist_markets": [], "blacklist_markets": [], "description": "", "extensions": [] } { "feed_lifetime_sec": 86400, "minimum_feeds": 1, "force_settlement_delay_sec": 86400, "force_settlement_offset_percent": 0, "maximum_force_settlement_volume": 2000, "short_backing_asset": "1.3.0", "extensions": [] } true

The two options in the command line are:

{
  "max_supply": "1000000000000000",
  "market_fee_percent": 0,
  "max_market_fee": "1000000000000000",
  "issuer_permissions": 80,
  "flags": 0,
  "core_exchange_rate": {
    "base": {
      "amount": 10000,
      "asset_id": "1.3.0"
    },
    "quote": {
      "amount": 80000,
      "asset_id": "1.3.4"
    }
  },
  "whitelist_authorities": [],
  "blacklist_authorities": [],
  "whitelist_markets": [],
  "blacklist_markets": [],
  "description": "",
  "extensions": []
}
{
  "feed_lifetime_sec": 86400,
  "minimum_feeds": 1,
  "force_settlement_delay_sec": 86400,
  "force_settlement_offset_percent": 0,
  "maximum_force_settlement_volume": 2000,
  "short_backing_asset": "1.3.0",
  "extensions": []
}

Update feed producer

update_asset_feed_producers CNY [nathan] true

Put producer account in the bracket.

Publish Feed

publish_asset_feed nathan CNY { "settlement_price": { "base": { "amount": 10, "asset_id": "1.3.5" }, "quote": { "amount": 10, "asset_id": "1.3.0" } }, "maintenance_collateral_ratio": 1750, "maximum_short_squeeze_ratio": 1200, "core_exchange_rate": { "base": { "amount": 10, "asset_id": "1.3.5" }, "quote": { "amount": 10, "asset_id": "1.3.0" } } } true

The feed option is

  "settlement_price": {
    "base": {
      "amount": 10,
      "asset_id": "1.3.5"
    },
    "quote": {
      "amount": 10,
      "asset_id": "1.3.0"
    }
  },
  "maintenance_collateral_ratio": 1750,
  "maximum_short_squeeze_ratio": 1200,
  "core_exchange_rate": {
    "base": {
      "amount": 10,
      "asset_id": "1.3.5"
    },
    "quote": {
      "amount": 10,
      "asset_id": "1.3.0"
    }
  }
}

Make sure the asset_id equals to the one you created.

Borrow the asset

Now, you can borrow the MPA.

unlocked >>> list_account_balances nathan
list_account_balances nathan
9999468458 BTS

unlocked >>> borrow_asset nathan 10 CNY 20 true

unlocked >>> list_account_balances nathan
list_account_balances nathan
9999468418 BTS
10 CNY

Sounds we use 40 BTS for 10 CNY. A little expensive.

Return the asset

Then you can return the asset, but not sure whether we need to pay some fee?

unlocked >>> settle_asset nathan 10 CNY true

unlocked >>> list_account_balances nathan    
list_account_balances nathan
9999468218 BTS
0 CNY

你可能感兴趣的:(Create a Bitshares MPA)