Transactions

Transaction

Container for the different transaction types.

Parameters

  • type(str) – The type of the transaction. For example, ‘“type”: “DEPOSIT”’.

Deposit

Parameters

  • position_id(int) – The position ID to deposit to.

  • public_key(int) – The position ID owner’s public key.

  • amount(int) – Amount of collateral asset to be deposited; required to be ≥ 0.

Example

{
    "amount": "2569146471088859254",
    "position_id": "7758176404715800194",
    "public_key": "0x37ebdcde87a1613e443df789558867f5ba91faf7a024204f7c1bd874da5e70a",
    "type": "DEPOSIT"
}

Additional resource

WithdrawalToAddress

Parameters

  • position_id(int) – The position ID to withdraw from.

  • public_key(int) – The position ID owner’s public key.

  • eth_address(str) – The Ethereum address to move the funds into.

  • amount(int) – The amount to withdraw.

  • nonce(int) – Unique nonce issued by the caller.

  • expiration_timestamp(int) – The timestamp after which this request is no longer valid.

  • signature(Signature) – The position owner’s signature.

Example

{
    "amount": "1682637359498011204",
    "eth_address": "0xB6aD5EfBd6aDfa29dEfad5BC0f8cE0ad57d4c5Fb",
    "expiration_timestamp": "2101470722",
    "nonce": "4265854110",
    "position_id": "7758176404715800194",
    "public_key": "0x1b9e4c42a399f6ce069127df5ad618489aad21b1687acf4d4b09e08744084a7",
    "signature": {
        "r": "0x18326a6181a507f701968f45f56799b890374a1e329c6b9a37ec3292d92b1f8",
        "s": "0x66dd6745be06d033149a2bcb686e3ec896fc914ff2cb52dcc1d34bbe220b639"
    },
    "type": "WITHDRAWAL_TO_ADDRESS"
}

Additional resource

ForcedWithdrawal

Parameters

  • position_id(int) – The position ID to withdraw from.

  • public_key(int) – The position ID owner’s public key.

  • amount(int) – The amount to withdraw.

  • is_valid(bool) – A flag that specifies the validity of the forced action.

Example

{
    "amount": "1636255576516455737",
    "is_valid": false,
    "position_id": "365647759669025956",
    "public_key": "0x6ce3282201066868b4d32ed785c52bc495a28db63acb5a5d8faf6779079698f",
    "type": "FORCED_WITHDRAWAL"
}

Additional resources

Trade

Parameters

  • party_a_order(Order) – Represents party a’s order.

  • party_b_order(Order) – Represents party b’s order.

  • actual_collateral(int) – The collateral amount sold in the trade.

  • actual_synthetic(int) – The synthetic amount sold in the trade.

  • actual_a_fee(int) – The amount party a paid for fees out of the maximal amount they were willing to pay.

  • actual_b_fee(int) – The amount party b paid for fees of the maximal amount they were willing to pay.

Example

{
    "actual_a_fee": "8791662011684601223",
    "actual_b_fee": "9309829342914403545",
    "actual_collateral": "7758176404715800194",
    "actual_synthetic": "15308084094301570617",
    "party_a_order": {
        "amount_collateral": "15334874138764573096",
        "amount_fee": "17677494534592486883",
        "amount_synthetic": "15460142528840632302",
        "asset_id_collateral": "0x57d05d11b570fd197b55746070ee051c731ee109b07255eab3c9cf8b6c579d",
        "asset_id_synthetic": "0x2",
        "expiration_timestamp": "3608164305",
        "is_buying_synthetic": true,
        "nonce": "1210484339",
        "order_type": "LIMIT_ORDER_WITH_FEES",
        "position_id": "4805234989534244506",
        "public_key": "0x6b974202431eb8c0692c9c8111528d947bc7e70f7ffefaffbab7455dfa5d4f7",
        "signature": {
            "r": "0x54730fcf60f37072926ba182d17e55e21104fbc22886d876a7e8b191b2d456f",
            "s": "0x1f32f41a809b2f2b888bddc2bdbf5ef709403a00d4e5e23dbaef09e55130464"
        }
    },
    "party_b_order": {
        "amount_collateral": "7800133567066683830",
        "amount_fee": "10547508580746848044",
        "amount_synthetic": "17015053283814123498",
        "asset_id_collateral": "0x57d05d11b570fd197b55746070ee051c731ee109b07255eab3c9cf8b6c579d",
        "asset_id_synthetic": "0x2",
        "expiration_timestamp": "3407305306",
        "is_buying_synthetic": false,
        "nonce": "2046685052",
        "order_type": "LIMIT_ORDER_WITH_FEES",
        "position_id": "5076743434755564658",
        "public_key": "0x7784139b0eee3f6fd937bba714acc2b199af2877565ba7c926d3f10d0bca378",
        "signature": {
            "r": "0x929a5a30bb98b23d0fcfcc75a1ff5f0f5a437edac75002cb6ebca78173ffd3",
            "s": "0x2abbf077eb504ae44b2cf1ca81c1aa73489a38aead87600a7dadf82bd39efcc"
        }
    },
    "type": "TRADE"
}

Additional resource

ForcedTrade

Parameters

  • public_key_party_a(int) – Party a’s public key.

  • public_key_party_b(int) – Party b’s public key.

  • position_id_party_a(int) – The position ID of party a.

  • position_id_party_b(int) – The position ID of party b.

  • collateral_asset_id(int) – The collateral unique asset ID (as registered on the contract).

  • synthetic_asset_id(int) – The unique asset ID of the synthetic asset that is traded.

  • amount_collateral(int) – The amount of collateral asset traded.

  • amount_synthetic(int) – The amount of synthetic asset traded.

  • is_party_a_buying_synthetic(bool) – Specifies if party A is buying the synthetic asset.

  • nonce(int) – Unique nonce issued by the caller.

  • is_valid(bool) – A flag that specifies the validity of the forced action.

Example

{
    "amount_collateral": "1930730637203817844",
    "amount_synthetic": "1156570977348302595",
    "collateral_asset_id": "0x57d05d11b570fd197b55746070ee051c731ee109b07255eab3c9cf8b6c579d",
    "is_party_a_buying_synthetic": true,
    "is_valid": true,
    "nonce": "799733709760957403711256411869042554186700796820103802346414735555910415686",
    "position_id_party_a": "8412741708181210606",
    "position_id_party_b": "10785927268516314993",
    "public_key_party_a": "0x157f2f5e916c04f8d7f6f79c529f96b9c554b9dee79e96035fcfff8ebb1ac0",
    "public_key_party_b": "0x4ac02bfa6ef7aaead1fbefd5860235931b370bce9a11a7895c398d541745ff0",
    "synthetic_asset_id": "0x0",
    "type": "FORCED_TRADE"
}

Additional resources

Transfer

Parameters

  • amount(int) – The amount to transfer.

  • nonce(int) – Unique nonce issued by the caller.

  • sender_public_key(int) – The sender’s public key.

  • sender_position_id(int) – The position ID to transfer from.

  • receiver_public_key(int) – The receiver’s public key.

  • receiver_position_id(int) – The position ID to transfer to.

  • asset_id(int) – The unique asset ID (as registered on the contract) to transfer. Currently only the collateral asset is supported.

  • expiration_timestamp(int) – The timestamp after which this request is no longer valid.

  • signature(Signature) – The sender’s signature.

Example

{
    "amount": "7758176404715800194",
    "asset_id": "0x57d05d11b570fd197b55746070ee051c731ee109b07255eab3c9cf8b6c579d",
    "expiration_timestamp": "2404381470",
    "nonce": "2195908194",
    "receiver_position_id": "6091063652223914538",
    "receiver_public_key": "0x259f432e6f4590b9a164106cf6a659eb4862b21fb97d43588561712e8e5216b",
    "sender_position_id": "9309829342914403545",
    "sender_public_key": "0x28e4d45cd0538ffa6fdc09e70f0fea4e56c47fda87a2a969c22b4fdfe997f60",
    "signature": {
        "r": "0x70cec5dcb9ef2b23250d9afda0d32e3c94a159ba22b3f6951ea589e61f5c33",
        "s": "0x20284352e92b0807cf2309be23d56d29b51ea5412dd3a7bbe8da4b3354f54c1"
    },
    "type": "TRANSFER"
}

Additional resource

ConditionalTransfer

Parameters

  • amount(int) – The amount to transfer.

  • nonce(int) – Unique nonce issued by the caller.

  • sender_public_key(int) – The sender’s public key.

  • sender_position_id(int) – The position ID to transfer from.

  • receiver_public_key(int) – The receiver’s public key.

  • receiver_position_id(int) – The position ID to transfer to.

  • asset_id(int) – The unique asset ID (as registered on the contract) to transfer. Currently only the collateral asset is supported.

  • expiration_timestamp(int) – The timestamp after which this request is no longer valid.

  • fact_registry_address(str) – The address of the fact registry smart contract. Should be checksummed according to Web3.isChecksumAddress.

  • fact(bytes) – The fact that should appear in the fact registry as a condition to the transfer. A 32 bytes blob.

  • signature(Signature) – The sender’s signature.

Example

{
    "amount": "7758176404715800194",
    "asset_id": "0x57d05d11b570fd197b55746070ee051c731ee109b07255eab3c9cf8b6c579d",
    "expiration_timestamp": "2404381470",
    "fact": "6461646162616461626164616461626164616261646164616261646162616461",
    "fact_registry_address": "0x328e67d288C0efB11E32a4C76F51b743a8Ae717E",
    "nonce": "2195908194",
    "receiver_position_id": "6091063652223914538",
    "receiver_public_key": "0x259f432e6f4590b9a164106cf6a659eb4862b21fb97d43588561712e8e5216b",
    "sender_position_id": "9309829342914403545",
    "sender_public_key": "0x6422cee244591f143858115c7e72bfcd176e01d56ad8ed00a959b86c2facf8e",
    "signature": {
        "r": "0x47b7e2214e163ceae09410777f101124c40c099e19dba4d8bf5429fd1c1dc88",
        "s": "0x5209eb31e9d68f08d681a3dee25704278172658a912ec7f943c31064e9558d"
    },
    "type": "CONDITIONAL_TRANSFER"
}

Additional resource

Liquidate

Parameters

  • liquidator_order(Order) – Represents the liquidator order.

  • liquidated_position_id(int) – The liquidated position ID.

  • actual_collateral(int) – The collateral amount sold in the liquidation.

  • actual_synthetic(int) – The synthetic amount sold in the liquidation.

  • actual_liquidator_fee(int) – The fee the liquidator paid out of the maximal amount they were willing to pay.

Example

{
    "actual_collateral": "7758176404715800194",
    "actual_liquidator_fee": "8791662011684601223",
    "actual_synthetic": "15308084094301570617",
    "liquidated_position_id": "15419682365516802845",
    "liquidator_order": {
        "amount_collateral": "8187132600743567510",
        "amount_fee": "11081939229867047606",
        "amount_synthetic": "16558026091473266411",
        "asset_id_collateral": "0x57d05d11b570fd197b55746070ee051c731ee109b07255eab3c9cf8b6c579d",
        "asset_id_synthetic": "0x2",
        "expiration_timestamp": "1430804514",
        "is_buying_synthetic": false,
        "nonce": "3900315155",
        "order_type": "LIMIT_ORDER_WITH_FEES",
        "position_id": "11534118754833929857",
        "public_key": "0x5db665983e23607de57d6dc068797336bfdcb954238044688bec922ca296d3e",
        "signature": {
            "r": "0x4ac8a77f5863238a8bfb8a2e7f2dcc70cb8cad7b45692497b4b2c3ff06f6c94",
            "s": "0x6fd86c349a6c6266d34c11da0ff8c0cf211cafbadc39ba4a4c38124344f3bb1"
        }
    },
    "type": "LIQUIDATE"
}

Additional resource

Deleverage

Parameters

  • deleveraged_position_id(int) – The ID of the liquidated position, that is, the deleveraged position.

  • deleverager_position_id(int) – The ID of the counter-party position, that is, the party to which the deleveraged position is attached.

  • synthetic_asset_id(int) – The unique ID of the asset being deleveraged, as registered on the contract.

  • amount_synthetic(int) – The amount of the synthetic asset being deleveraged, with the resolution factor applied.

  • amount_collateral(int) – The quantized amount of the deleveraged position’s collateral.

  • deleverager_is_buying_synthetic(bool) – A flag that indicates if the deleverager is buying a synthetic asset.

Example

{
    "amount_collateral": "5721212930748269353",
    "amount_synthetic": "9309829342914403545",
    "deleveraged_position_id": "7758176404715800194",
    "deleverager_is_buying_synthetic": false,
    "deleverager_position_id": "15308084094301570617",
    "synthetic_asset_id": "0x1",
    "type": "DELEVERAGE"
}

Additional resource

FundingTick

Parameters

  • global_funding_indices(FundingIndicesState) – A definition of one or more global funding indices. Every asset type in the system should have a corresponding global funding index.

Example

{
    "global_funding_indices": {
        "indices": {
            "0x0": "-431710025170174585",
            "0x1": "6084712057446794809"
        },
        "timestamp": "3900315155"
    },
    "type": "FUNDING_TICK"
}

Additional resource

OraclePricesTick

Parameters

  • oracle_prices(Mapping[int,AssetOraclePrice]) – Map between the asset ID to its median price and a collection of signed prices that generate this median.

  • timestamp(int) – Transaction generation timestamp.

Example

{
    "oracle_prices": {
        "0x0": {
            "price": "4345629098988793194",
            "signed_prices": {
                "0x2ae10445c08f66270cd8d3a71cdac5630a541b1f7d13e47ec1d0373ce3e8fd3": {
                    "external_asset_id": "0x425443555344000000000000000000004d616b6572",
                    "price": "10117956201985462554675959028152",
                    "timestamped_signature": {
                        "signature": {
                            "r": "0x50eaea29fe0f217708744beb6a13e88c8c0674499184f9b8d0899d4c9a57bb4",
                            "s": "0x33fc4bb5f59a8e647c31db11e9ae9e6991347313cc9ce731edc5bb7878f6d0d"
                        },
                        "timestamp": "3618339112"
                    }
                }
            }
        },
        "0x1": {
            "price": "14829673561266596382",
            "signed_prices": {
                "0x35007be34c2c3d47d2216cb3e13f61d65f4c3c76bb4c57bf1afbe7388bc3238": {
                    "external_asset_id": "0x455448555344000000000000000000004d616b6572",
                    "price": "216314955048675504460053108771",
                    "timestamped_signature": {
                        "signature": {
                            "r": "0x104d9d6d2770e4d9b83e4d06f38e73afb1d9432e0ad3ce12da530c360fa9f2f",
                            "s": "0x6eac2c15b04e683df692089f1a3caf4f60da12526349c664695427f2b3f3f1b"
                        },
                        "timestamp": "4265854110"
                    }
                },
                "0x4722c15415ba4ab0a1b3a516be64b94846e9257d25e619c6014f8af08acf90c": {
                    "external_asset_id": "0x455448555344000000000000000000004d616b6572",
                    "price": "345280244044647467828513979784",
                    "timestamped_signature": {
                        "signature": {
                            "r": "0x52d6857e3ba659d1b1a2e68bfa00a6ba4c2332ca0702124bf072a349e4a40e2",
                            "s": "0x1052cf56df2da70cb9249e0a132ea7c1cff17d3f2ba9e9fab34d72c850076b4"
                        },
                        "timestamp": "2685496293"
                    }
                }
            }
        }
    },
    "timestamp": "3485918757",
    "type": "ORACLE_PRICES_TICK"
}

Additional resource

MultiTransaction

Parameters

Example

{
    "txs": [
        {
            "amount": "2569146471088859254",
            "position_id": "7758176404715800194",
            "public_key": "0x37ebdcde87a1613e443df789558867f5ba91faf7a024204f7c1bd874da5e70a",
            "type": "DEPOSIT"
        },
        {
            "amount": "13942126818862981423",
            "asset_id": "0x57d05d11b570fd197b55746070ee051c731ee109b07255eab3c9cf8b6c579d",
            "expiration_timestamp": "2628077981",
            "nonce": "3874773259",
            "receiver_position_id": "11534118754833929857",
            "receiver_public_key": "0x66194cbd71037d1b83e90ec17e0aa3c03983ca8ea7e9d498c778ea6eb2083e7",
            "sender_position_id": "10326739782786242647",
            "sender_public_key": "0x36c85e2cb4dad66da13e89fd0a931a181750a5129ec8efb3fba66645949da73",
            "signature": {
                "r": "0x4a39324d103510b13cffb6ccef598a0071ba56281e2de942ceb08efc1487641",
                "s": "0x3fe9caf6f1becda00ce1083f6758fc6140f20552ea07388a85a608ecfcc6c0e"
            },
            "type": "TRANSFER"
        }
    ],
    "type": "MULTI_TRANSACTION"
}

Additional resource

log_additional_data

Logs additional data that isn’t present in the repr or str functions.