code.vegaprotocol.io/vega@v0.79.0/protos/sources/vega/commands/v1/commands.proto (about) 1 syntax = "proto3"; 2 3 package vega.commands.v1; 4 5 import "vega/commands/v1/validator_commands.proto"; 6 import "vega/governance.proto"; 7 import "vega/vega.proto"; 8 9 option go_package = "code.vegaprotocol.io/vega/protos/vega/commands/v1"; 10 11 // A command that allows the submission of a batch market instruction which wraps up multiple market instructions into a single transaction. 12 // These instructions are then processed sequentially in the following order: 13 // - OrderCancellation 14 // - OrderAmendment 15 // - OrderSubmission 16 // - StopOrderSubmission 17 // where the maximum allow of instructions in a batch is controlled by the network parameter "spam.protection.max.batchSize". 18 message BatchMarketInstructions { 19 // List of order cancellations to be processed sequentially. 20 repeated OrderCancellation cancellations = 1; 21 // List of order amendments to be processed sequentially. 22 repeated OrderAmendment amendments = 2; 23 // List of order submissions to be processed sequentially. 24 repeated OrderSubmission submissions = 3; 25 // List of stop order cancellations to be processed sequentially. 26 repeated StopOrdersCancellation stop_orders_cancellation = 4; 27 // List of stop order submissions to be processed sequentially. 28 repeated StopOrdersSubmission stop_orders_submission = 5; 29 // Update margin mode instruction 30 repeated UpdateMarginMode update_margin_mode = 6; 31 } 32 33 // A command that allows a party to submit a stop order for a given market. 34 // A stop order is a normal order that remains off the order book and is only submitted if a given trigger is breached from a particular direction. 35 // If both rises-above and falls-below are configured, then if one is triggered the other will be cancelled (OCO). 36 message StopOrdersSubmission { 37 // Stop order that will be triggered if the price rises above a given trigger price. 38 optional StopOrderSetup rises_above = 1; 39 // Stop order that will be triggered if the price falls below a given trigger price. 40 optional StopOrderSetup falls_below = 2; 41 } 42 43 // Price and expiry configuration for a stop order. 44 message StopOrderSetup { 45 // Order to be submitted once the trigger is breached. 46 OrderSubmission order_submission = 1; 47 // Timestamp, in Unix nanoseconds, for when the stop order should expire. If not set the stop order will not expire. 48 optional int64 expires_at = 2; 49 // Strategy to adopt if the expiry time is reached. 50 optional vega.StopOrder.ExpiryStrategy expiry_strategy = 3; 51 // Indicates if this order is linked to an order or position to derive the order size 52 optional vega.StopOrder.SizeOverrideSetting size_override_setting = 4; 53 // If this order is linked to a position, provide an optional scaling factor 54 optional vega.StopOrder.SizeOverrideValue size_override_value = 5; 55 56 // Trigger that will need to be breached for the order to be submitted to the book. 57 oneof trigger { 58 // Order will be submitted if the last traded price on the market breaches the given price. 59 string price = 100; 60 // Order will be submitted if the last traded price has moved the given percent from the highest/lowest mark price since the stop order was submitted. 61 string trailing_percent_offset = 101; 62 } 63 } 64 65 // A command that instructs the network to cancel untriggered stop orders that were submitted by the sender of this transaction. 66 // If any cancelled stop order is part of an OCO, both stop orders will be cancelled. 67 // It is not possible to cancel another party's stop orders with this command. 68 message StopOrdersCancellation { 69 // Restrict cancellations to those submitted to the given market. If not set, all stop orders across all markets will be cancelled. 70 optional string market_id = 1; 71 // Restrict cancellations to a stop order with the given ID. If set, then a market ID must also be provided. 72 optional string stop_order_id = 2; 73 } 74 75 // A command that submits an order to the Vega network for a given market. 76 message OrderSubmission { 77 // Market ID to submit the order to. 78 string market_id = 1; 79 // Price for the order, the price is an integer, for example `123456` is a correctly 80 // formatted price of `1.23456` assuming market configured to 5 decimal places, 81 // required field for limit orders, however it is not required for market orders. 82 // This field is an unsigned integer scaled to the market's decimal places. 83 string price = 2; 84 // Size for the order, for example, in a futures market the size equals the number of units. 85 uint64 size = 3; 86 // Which side of the order book the order is for, e.g. buy or sell. 87 vega.Side side = 4; 88 // Time in force indicates how long an order will remain active before it is executed or expires.. 89 vega.Order.TimeInForce time_in_force = 5; 90 // Timestamp, in Unix nanoseconds, for when the order will expire. Can only be set when the order's time-in-force is GTT. 91 int64 expires_at = 6; 92 // Type of the order. 93 vega.Order.Type type = 7; 94 // Arbitrary optional reference for the order, to be used as a human-readable non-unique identifier for the order. 95 string reference = 8; 96 // Pegged order details. If set, the order's price will be offset from a particular reference price of the order book at all times. 97 vega.PeggedOrder pegged_order = 9; 98 // If set, the order will only be executed if it would not trade on entry to the order book. Only valid for limit orders. 99 bool post_only = 10; 100 // If set, the order will only be executed if the outcome of the trade moves the trader's position closer to 0. 101 // Only valid for non-persistent orders. 102 bool reduce_only = 11; 103 // Iceberg order details. If set, the order will exist on the order book in chunks. 104 optional IcebergOpts iceberg_opts = 12; 105 } 106 107 // Iceberg order options 108 message IcebergOpts { 109 // Size of the order that is made visible and can be traded with during the execution of a single order. 110 uint64 peak_size = 1; 111 // Minimum allowed remaining size of the order before it is replenished back to its peak size. 112 uint64 minimum_visible_size = 2; 113 } 114 115 message UpdateMarginMode { 116 enum Mode { 117 // Never valid. 118 MODE_UNSPECIFIED = 0; 119 // Cross margin mode - margin is dynamically acquired and released as a position is marked to market 120 MODE_CROSS_MARGIN = 1; 121 // Isolated margin mode - margin for any newly opened position volume is transferred to the margin account when the trade is executed 122 MODE_ISOLATED_MARGIN = 2; 123 } 124 // Market to change margin mode for. 125 string market_id = 1; 126 // Margin mode to use. 127 Mode mode = 2; 128 // Margin factor to use for margin in isolated mode. It is a multiplier that defines how much margin needs to be set aside 129 optional string margin_factor = 3; 130 } 131 132 // A command that instructs the network to cancel orders, active or partially filled, that were previously submitted by the sender of this transaction. 133 // It is not possible to cancel another party's order with this command. 134 message OrderCancellation { 135 // Restrict cancellations to an order with the given ID. If set, then a market ID must also be provided. 136 string order_id = 1; 137 // Restrict cancellations to those submitted to the given market. If not set, all stop orders across all markets will be cancelled. 138 string market_id = 2; 139 } 140 141 // A command that allows a party to update the details of an existing order. 142 // Any field that is left unset or as a default value indicates that this field on the original order will be left unchanged. 143 // It is not possible to change an order's type through this command. 144 message OrderAmendment { 145 // ID of the order to amend. 146 string order_id = 1; 147 // Market ID that the order was originally submitted to. 148 string market_id = 2; 149 // New price for the order. This field is an unsigned integer scaled to the market's decimal places. 150 optional string price = 3; 151 // Amend the size for the order by the delta specified: 152 // - To reduce the size from the current value set a negative integer value 153 // - To increase the size from the current value, set a positive integer value 154 // - To leave the size unchanged set a value of zero 155 // This field needs to be scaled using the market's position decimal places. 156 // If specified, size must not be set. 157 int64 size_delta = 4; 158 // Timestamp, in Unix nanoseconds, for the new expiry time for the order. 159 optional int64 expires_at = 5; 160 // New time in force for the order. 161 vega.Order.TimeInForce time_in_force = 6; 162 // New pegged offset for the order. 163 // This field is an unsigned integer scaled to the market's decimal places. 164 string pegged_offset = 7; 165 // New pegged reference for the order. 166 vega.PeggedReference pegged_reference = 8; 167 // New size for the order. 168 // Amending the size causes the size and remaining part of the order to be changed by the difference between the original and amended size. 169 // - Specifying a size smaller than the current size leaves the order at its current order book position. 170 // - Specifying a size larger than the current size removes and reinserts the order at the back of the price level. 171 // - Specifying a size that results in the remaining part of the order being reduced to zero cancels the order. 172 // This field is an unsigned integer scaled to the market's decimal places. 173 // If specified, size_delta must be set to 0. 174 optional uint64 size = 9; 175 } 176 177 // A command that indicates to the network the party's intention to supply liquidity to the given market and become a liquidity provider. 178 // An active liquidity provider for a market will earn fees based on the trades that occur in the market. 179 message LiquidityProvisionSubmission { 180 reserved 4, 5; 181 // Market that the submitter wishes to provide liquidity for. 182 string market_id = 1; 183 // Amount that the submitter will commit as liquidity to the market, specified as a unitless number in the settlement asset of the market. 184 // This field is an unsigned integer scaled using the asset's decimal places. 185 string commitment_amount = 2; 186 // Nominated liquidity fee factor, which is an input to the calculation of taker fees on the market, as per setting fees and rewarding liquidity providers. 187 string fee = 3; 188 // Arbitrary reference to be added to every order created out of this liquidity provision submission. 189 string reference = 6; 190 } 191 192 // Command that allows a liquidity provider to inform the network that they will stop providing liquidity for a market. 193 message LiquidityProvisionCancellation { 194 // Market that the submitter will stop providing liquidity for. 195 string market_id = 1; 196 } 197 198 // Command that allows a liquidity provider to update the details of their existing liquidity commitment. 199 // Any field that is left unset or as a default value indicates that this field on the original submission will be left unchanged. 200 message LiquidityProvisionAmendment { 201 reserved 4, 5; 202 // Market that the submitter wants to amend the liquidity commitment for. 203 string market_id = 1; 204 // New commitment amount. 205 string commitment_amount = 2; 206 // New nominated liquidity fee factor. 207 string fee = 3; 208 // New arbitrary reference to be added to every order created out of this liquidity provision submission. 209 string reference = 6; 210 } 211 212 // Command to instruct the network to process an asset withdrawal from the Vega network. 213 // The process is specific to the destination foreign chain, for example, a withdrawal to Ethereum will generate signatures 214 // that allow funds to be taken across the bridge. 215 message WithdrawSubmission { 216 // Amount to be withdrawn, as an unsigned integer scaled to the asset's decimal places. 217 string amount = 1; 218 // Asset to be withdrawn. 219 string asset = 2; 220 // Details specific to the foreign chain, such as the receiver address. 221 vega.WithdrawExt ext = 3; 222 } 223 224 // Command that allows a token holder to submit a governance proposal that can be voted on by any other token holders, and eventually enacted on the Vega network. 225 // For example this command can be used to propose a new market. 226 message ProposalSubmission { 227 // Arbitrary human-readable reference identifying the proposal. 228 string reference = 1; 229 // Proposal terms containing the type and details of the proposal, as well as time spans for voting and enactment. 230 vega.ProposalTerms terms = 2; 231 // Rationale behind a proposal. 232 vega.ProposalRationale rationale = 3; 233 } 234 235 // Terms for a batch governance proposal submission 236 message BatchProposalSubmissionTerms { 237 // Closing timestamp in Unix time; adheres to `minClose` and `maxClose` limits. 238 int64 closing_timestamp = 1; 239 // List of individual changes included in the batch proposal. 240 repeated vega.BatchProposalTermsChange changes = 2; 241 } 242 243 // Command that allows a token holder to submit a batch governance proposal that can be voted on by any other token holders, and eventually enacted on the Vega network. 244 // For example this command can be used to propose a new market and a network parameter change with it. 245 message BatchProposalSubmission { 246 // Arbitrary human-readable reference identifying the proposal. 247 string reference = 1; 248 // Proposal terms containing the type and details of the proposal, as well as time spans for voting and enactment. 249 BatchProposalSubmissionTerms terms = 2; 250 // Rationale behind a proposal. 251 vega.ProposalRationale rationale = 3; 252 } 253 254 // Command that allows a token holder to vote for or against an active governance proposal. 255 message VoteSubmission { 256 // Submit vote for the specified proposal ID. 257 string proposal_id = 1; 258 // Actual value of the vote. 259 vega.Vote.Value value = 2; 260 } 261 262 // Command to allow a token holder to delegate their tokens to a validator to help secure the network. 263 // A token holder delegating to a validator will earn rewards based on the amount they have delegated, and the performance of the chosen validator. 264 message DelegateSubmission { 265 // Node ID to delegate stake to. 266 string node_id = 1; 267 // Amount of stake to delegate, as an unsigned integer scaled to the governance asset's decimal places. 268 string amount = 2; 269 } 270 271 // Command to allow a token holder to instruct the network to remove their delegated stake from a given validator node. 272 message UndelegateSubmission { 273 enum Method { 274 reserved 3; 275 276 METHOD_UNSPECIFIED = 0; 277 // Undelegate straight away, losing all rewards for the current epoch. 278 METHOD_NOW = 1; 279 // Undelegate at the end of an epoch, retaining all rewards for the current epoch. 280 METHOD_AT_END_OF_EPOCH = 2; 281 } 282 // Node ID to undelegate stake from. 283 string node_id = 1; 284 // Amount to undelegate, as an unsigned integer scaled to the governance asset's decimal places. 285 // If not set, then all delegations to the given validator node will be removed. 286 string amount = 2; 287 // Method of delegation. 288 Method method = 3; 289 } 290 291 // Command that allows a party to move assets from one account to another. 292 // A transfer can be set up as a single one-off transfer, or a recurring transfer that occurs once at the start of each epoch. 293 // Each transfer incurs a fee as specified by the network parameter `transfer.fee.factor` 294 message Transfer { 295 // Account type from which the funds of the party should be taken. 296 vega.AccountType from_account_type = 1; 297 // Public key of the destination account. 298 string to = 2; 299 // Type of the destination account. 300 vega.AccountType to_account_type = 3; 301 // Asset ID of the asset to be transferred. 302 string asset = 4; 303 // Amount to be taken from the source account, as an unsigned integer scaled to the asset's decimal places. 304 string amount = 5; 305 // Reference to be attached to the transfer. 306 string reference = 6; 307 // AMM key from which assets are to be transferred, if applicable. 308 // The submitter of the transaction must be the owner of this AMM key. 309 // If provided, the 'from_account_type' must be REWARDS_VESTED, and the asset in this account 310 // must match the asset specified in the transfer. 311 optional string from = 7; 312 313 // Specific details of the transfer. 314 oneof kind { 315 // Details of a one-off transfer that is executed once at a specified time. 316 OneOffTransfer one_off = 101; 317 // Details of a transfer that is executed once every epoch until stopped. 318 RecurringTransfer recurring = 102; 319 } 320 } 321 322 // Details for a one-off transfer. 323 message OneOffTransfer { 324 // Timestamp, in Unix nanoseconds, for when the transfer should be executed, i.e., assets transferred into the receiver's account. 325 int64 deliver_on = 1; 326 } 327 328 // Details for a recurring transfer 329 message RecurringTransfer { 330 // First epoch from which this transfer shall be executed. 331 uint64 start_epoch = 1; 332 // Last epoch at which this transfer shall be executed. 333 optional uint64 end_epoch = 2; 334 // Factor that the initial transfer amount is multiplied by for each epoch that it is executed. 335 // For example if the initial transfer amount is 1000 and the factor is 0.5, then the amounts transferred per epoch will be 1000, 500, 250, 125, etc. 336 string factor = 3; 337 // Optional parameter defining how a transfer is dispatched. 338 vega.DispatchStrategy dispatch_strategy = 4; 339 } 340 341 // Command that can be used by the party that initiated a transfer to instruct the network to stop an active recurring transaction. 342 message CancelTransfer { 343 // Transfer ID of the transfer to cancel. 344 string transfer_id = 1; 345 } 346 347 // Command that can be used by a validator to instruct the network to generate signatures to add or remove validators from the multisig-control contract. 348 // Signatures can only be generated for validator nodes that have been promoted or demoted from the consensus validator set, and any attempt to generate signatures for another node will be rejected. 349 // The generated signatures can only be submitted to the contract by the Ethereum addresses included in the command. 350 message IssueSignatures { 351 // Ethereum address which will submit the signatures to the smart contract. 352 string submitter = 1; 353 // What kind of signatures to generate, namely for whether a signer is being added or removed. 354 NodeSignatureKind kind = 2; 355 // Node ID of the validator node that will be signed in or out of the smart contract. 356 string validator_node_id = 3; 357 // Chain ID of the bridge to generate signatures for. 358 string chain_id = 4; 359 } 360 361 // Command that a party can use to instruct the network to create a new referral set on the network. 362 // The submitter of this command will become the referrer of the new set and cannot be the referrer or a referee of another set. 363 // A referrer can use the referral set ID as a referral code to attract others to the Vega network and have fees reduced for the referral set. 364 message CreateReferralSet { 365 // Whether or not the referral set should be considered a team that can participate in team games on the network. 366 bool is_team = 1; 367 // Team details, if the referral set is to be considered a team. 368 optional Team team = 2; 369 // Should a referral set be created as well or only a team. 370 // the default is false so the existing behaviour is kept if older versions of the protobufs are used. 371 bool do_not_create_referral_set = 3; 372 373 message Team { 374 // Name of the team. 375 string name = 10; 376 // External link to the team's homepage. 377 optional string team_url = 11; 378 // External link to an avatar for the team. 379 optional string avatar_url = 12; 380 // Whether or not the team is closed to new party members. 381 bool closed = 13; 382 // List of public keys that are allowed to join the team. 383 // Only applicable to closed teams. Removing a party from the allow list does not remove 384 // the party from the team. 385 repeated string allow_list = 14; 386 } 387 } 388 389 // A command that allows the referrer of a referral set to update team details for a referral set. 390 // Any field that is left unset or has a default value indicates that this field on the original referral set will be left unchanged. 391 message UpdateReferralSet { 392 // ID of the referral set to update. 393 string id = 1; 394 // Whether or not the referral set should be considered a team that can participate in team games on the network. 395 bool is_team = 2; 396 // Team details, if the referral set is to be considered a team. 397 optional Team team = 3; 398 399 message Team { 400 // New name of the team. 401 optional string name = 10; 402 // New link to the team's homepage. 403 optional string team_url = 11; 404 // New link to an avatar for the team. 405 optional string avatar_url = 12; 406 // Whether or not the team is closed to new party members. When closed, only parties specified in the allow list can 407 // join the team. 408 optional bool closed = 13; 409 // List of public keys that are allowed to join the team. 410 // Only applicable to closed teams. Removing a party from the allow list does not remove 411 // the party from the team. 412 repeated string allow_list = 14; 413 } 414 } 415 416 // Command that allows the submitter to join a referral set and earn a collective reduction in fees based on the activity of all members of that set. 417 // A party that joins a referral set is called a referee. A referee can only be a member of one referral set and cannot themselves be or become a referrer. 418 // To switch to another referral set, a subsequent command can be sent and the switch will take effect at the end of the epoch. 419 message ApplyReferralCode { 420 // Referral code, normally the referral set ID, for the party to join. 421 string id = 1; 422 // Should the key applying the referral code also join the team. 423 // the default is false so the existing behaviour is kept if older versions of the protobufs are used. 424 bool do_not_join_team = 2; 425 } 426 427 // Command that allows the submitter to join a team or change teams if they are already a member of a team. 428 message JoinTeam { 429 // ID of the team to join, this is the same as the referral code used to generate the team. 430 string id = 1; 431 } 432 433 // Command to associate metadata to a public key, known as a party ID. 434 // Partial update is not supported, meaning previous values must be included in 435 // the update, otherwise they are removed. 436 message UpdatePartyProfile { 437 // Alias given to the party. It must be unique network-wide. 438 string alias = 1; 439 // Freeform data to associate to the party. 440 // Support a maximum of 10 entries. 441 repeated vega.Metadata metadata = 2; 442 } 443 444 // Command to create an automated market maker for a given market. 445 message SubmitAMM { 446 // Market ID for which to create an AMM. 447 string market_id = 1; 448 // Amount to be committed to the AMM. 449 string commitment_amount = 2; 450 // Slippage tolerance used for rebasing the AMM if its base price crosses with existing order 451 string slippage_tolerance = 3; 452 // Concentrated liquidity parameters defining the shape of the AMM's volume curves. 453 ConcentratedLiquidityParameters concentrated_liquidity_parameters = 4; 454 // Nominated liquidity fee factor, which is an input to the calculation of taker fees on the market. 455 string proposed_fee = 5; 456 // Liquidity parameters that define the size and range of the AMM's tradeable volume. 457 message ConcentratedLiquidityParameters { 458 // Price at which the AMM will stop quoting sell volume. If not supplied the AMM will never hold a short position. 459 optional string upper_bound = 1; 460 // Price at which the AMM will stop quoting buy volume. If not supplied the AMM will never hold a long position. 461 optional string lower_bound = 2; 462 // Price that the AMM will quote as its "fair price" when its position is zero. 463 string base = 3; 464 // Leverage at upper bound. If not set the markets risk-factors will be used to calculate leverage. 465 optional string leverage_at_upper_bound = 4; 466 // Leverage at lower bound. If not set the markets risk-factors will be used to calculate leverage. 467 optional string leverage_at_lower_bound = 5; 468 // ID of a data source already used by the market which will be used as the base price for the AMM. 469 optional string data_source_id = 6; 470 } 471 // An AMM with an oracle driven base price will only be updated if abs(new-base-price / old-base-price - 1) >= minimum_price_change_trigger. 472 optional string minimum_price_change_trigger = 7; 473 } 474 475 // Command to amend an existing automated market maker on a market. 476 message AmendAMM { 477 // Market ID for the AMM to be amended. 478 string market_id = 1; 479 // Amount to be committed to the AMM. If not supplied the commitment will remain unchanged. 480 optional string commitment_amount = 2; 481 // Slippage tolerance for rebasing position when updating the AMM. 482 string slippage_tolerance = 3; 483 // Concentrated liquidity parameters defining the shape of the AMM's volume curves. If not supplied the parameters will remain unchanged. 484 optional ConcentratedLiquidityParameters concentrated_liquidity_parameters = 4; 485 // Nominated liquidity fee factor, which is an input to the calculation of taker fees on the market. If not supplied the proposed fee will remain unchanged. 486 optional string proposed_fee = 5; 487 // Liquidity parameters that define the size and range of the AMM's tradeable volume. 488 message ConcentratedLiquidityParameters { 489 // Price at which the AMM will stop quoting sell volume. If not supplied the AMM will never hold a short position. 490 optional string upper_bound = 1; 491 // Price at which the AMM will stop quoting buy volume. If not supplied the AMM will never hold a long position. 492 optional string lower_bound = 2; 493 // Price that the AMM will quote as its "fair price" when its position is zero. 494 string base = 3; 495 // Leverage at upper bound. If not set the markets risk-factors will be used to calculate leverage. 496 optional string leverage_at_upper_bound = 4; 497 // Leverage at lower bound. If not set the markets risk-factors will be used to calculate leverage. 498 optional string leverage_at_lower_bound = 5; 499 // ID of a data source already used by the market which will be used as the base price for the AMM. 500 optional string data_source_id = 6; 501 } 502 // An AMM with an oracle driven base price will only be updated if abs(new-base-price / old-base-price - 1) >= minimum_price_change_trigger. 503 optional string minimum_price_change_trigger = 7; 504 } 505 506 // Command to cancel an automated market maker for a given market. 507 message CancelAMM { 508 enum Method { 509 METHOD_UNSPECIFIED = 0; 510 // Cancellation will be immediate and any open positions will be transferred to the network for liquidation. 511 METHOD_IMMEDIATE = 1; 512 // AMM will only trade to reduce its position, and will be cancelled once its position reaches zero. 513 METHOD_REDUCE_ONLY = 2; 514 } 515 // Market ID to cancel an AMM for. 516 string market_id = 1; 517 // Method to use to cancel the AMM. 518 Method method = 2; 519 } 520 521 // Internal transactions used to convey delayed transactions to be included in the next block. 522 message DelayedTransactionsWrapper { 523 repeated bytes transactions = 1; 524 uint64 height = 2; 525 }