Manifests

Below are the manifest for the Order Book

You don't need CaviarNine to interact with any smart contract. All you need is the manifest and to submit it the Radix network. An easy way to submit is already supplied by Radix via their dashboard: https://console.radixdlt.com/transaction-manifest

Price Condition Information:

Please note that any price sent to a CaviarNine Order Book can have a maximum of 5 significant figures.

Decimal("{PRICE}") - This must be a number with maximum 5 significant figures

Place a single limit order:

Simple manifest to place a single order

CALL_METHOD
    Address("{ACCOUNT}")
    "withdraw"
    Address("{TOKEN}")
    Decimal("{AMOUNT}")
;
TAKE_ALL_FROM_WORKTOP
    Address("{TOKEN}")
    Bucket("tokens")
;

CALL_METHOD
    Address("{ORDER_BOOK_COMPONENT}")
    "limit_order"
    Bucket("tokens")
    Decimal("{PRICE}")
;

CALL_METHOD
    Address("{ACCOUNT}")
    "deposit_batch"
    Expression("ENTIRE_WORKTOP")
;

Place multiple limit orders:

Condition:

AMOUNT >= AMOUNT_0 + AMOUNT_1 + AMOUNT_2 ...

Manifest example below with 3 limits placed at the same time. The limit of the number of orders you can place at any one time is set by the Radix gas being spent:

CALL_METHOD
    Address("{ACCOUNT}")
    "withdraw"
    Address("{TOKEN}")
    Decimal("{AMOUNT}")
;

TAKE_FROM_WORKTOP
    Address("{TOKEN}")
    Decimal("{AMOUNT_0}")
    Bucket("tokens_0")
;
TAKE_FROM_WORKTOP
    Address("{TOKEN}")
    Decimal("{AMOUNT_1}")
    Bucket("tokens_1")
;
TAKE_FROM_WORKTOP
    Address("{TOKEN}")
    Decimal("{AMOUNT_2}")
    Bucket("tokens_2")
;

CALL_METHOD
    Address("{ORDER_BOOK_COMPONENT}")
    "limit_order_batch"
    Array<Tuple>(
        Tuple(
            Bucket("tokens_0"),
            Decimal("{PRICE_0}")
        ),
        Tuple(
            Bucket("tokens_1"),
            Decimal("{PRICE_1}")
        ),
        Tuple(
            Bucket("tokens_2"),
            Decimal("{PRICE_2}")
        ),
    )
;

CALL_METHOD
    Address("{ACCOUNT}")
    "deposit_batch"
    Expression("ENTIRE_WORKTOP")
;

Claim or Cancel a Single Order:

Cancelling or Claiming is an identical manifest.

  • If your order has been 100% filled you will get back you filled tokens

  • If your order has been partially filled, you will get back the correct amount of both tokens

  • If you order has been traded on, you will get back 100% of the original tokens you put in

To claim/cancel your orders you will need:

ORDER_BOOK_ORDER_RECEIPT - Get this from your wallet
ORDER_ID - Get this from your wallet

Manifest below claiming a single order:

CALL_METHOD
    Address("{ACCOUNT}")
    "withdraw_non_fungibles"
    Address("{ORDER_BOOK_ORDER_RECEIPT}")
    Array<NonFungibleLocalId>(
        NonFungibleLocalId("{ORDER_ID}"),
    )
;
TAKE_NON_FUNGIBLES_FROM_WORKTOP
    Address("{ORDER_BOOK_ORDER_RECEIPT}")
    Array<NonFungibleLocalId>(
        NonFungibleLocalId("{ORDER_ID}"),
    )
    Bucket("order_receipts")
;

CALL_METHOD
    Address("{ORDER_BOOK_COMPONENT}")
    "claim_orders"
    Bucket("order_receipts")
;

CALL_METHOD
    Address("{ACCOUNT}")
    "deposit_batch"
    Expression("ENTIRE_WORKTOP")
;

Claim or Cancel Multiple Orders:

Please read above manifest also.

If you have multiple orders from the same order book component, you can cell them in one manifest:

CALL_METHOD
    Address("{ACCOUNT}")
    "withdraw_non_fungibles"
    Address("{ORDER_BOOK_ORDER_RECEIPT}")
    Array<NonFungibleLocalId>(
        NonFungibleLocalId("{ORDER_ID_01}"),
        NonFungibleLocalId("{ORDER_ID_02}"),
        NonFungibleLocalId("{ORDER_ID_03}"),
    )
;
TAKE_NON_FUNGIBLES_FROM_WORKTOP
    Address("{ORDER_BOOK_ORDER_RECEIPT}")
    Array<NonFungibleLocalId>(
        NonFungibleLocalId("{ORDER_ID_01}"),
        NonFungibleLocalId("{ORDER_ID_02}"),
        NonFungibleLocalId("{ORDER_ID_03}"),
    )
    Bucket("order_receipts")
;

CALL_METHOD
    Address("{ORDER_BOOK_COMPONENT}")
    "claim_orders"
    Bucket("order_receipts")
;

CALL_METHOD
    Address("{ACCOUNT}")
    "deposit_batch"
    Expression("ENTIRE_WORKTOP")
;

Execute a Market Order (trade directly with component)

A simple manifest below. Note that the {STOP_PRICE} is an Enum so Optional

CALL_METHOD
    Address("{ACCOUNT}")
    "withdraw"
    Address("{TOKEN}")
    Decimal("{AMOUNT}")
;
TAKE_ALL_FROM_WORKTOP
    Address("{TOKEN}")
    Bucket("tokens")
;

CALL_METHOD
    Address("{ORDER_BOOK_COMPONENT}")
    "market_order"
    Bucket("tokens")
    Enum<1u8>(
        Decimal("{STOP_PRICE}")
    )
;

CALL_METHOD
    Address("{ACCOUNT}")
    "deposit_batch"
    Expression("ENTIRE_WORKTOP")
;

Last updated