Skip to content

Commit 48b43f1

Browse files
committed
add trading framework package for types
1 parent 49e73b0 commit 48b43f1

File tree

68 files changed

+11941
-3057
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+11941
-3057
lines changed

aptos-move/aptos-e2e-comparison-testing/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,13 @@ use move_package::{
4242
};
4343
pub use online_execution::*;
4444

45-
const APTOS_PACKAGES_DIR_NAMES: [&str; 6] = [
45+
const APTOS_PACKAGES_DIR_NAMES: [&str; 7] = [
4646
"aptos-framework",
4747
"move-stdlib",
4848
"aptos-stdlib",
4949
"aptos-token",
5050
"aptos-token-objects",
51+
"aptos-trading",
5152
"aptos-experimental",
5253
];
5354

aptos-move/aptos-release-builder/src/components/framework.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ pub fn generate_upgrade_proposals(
4141
("0x1", "aptos-move/framework/aptos-framework"),
4242
("0x3", "aptos-move/framework/aptos-token"),
4343
("0x4", "aptos-move/framework/aptos-token-objects"),
44+
("0x5", "aptos-move/framework/aptos-trading"),
4445
];
4546

4647
let mut result: Vec<(String, String)> = vec![];

aptos-move/framework/aptos-experimental/Move.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ aptos_experimental = "0x7"
77

88
[dependencies]
99
AptosFramework = { local = "../aptos-framework" }
10+
AptosTrading = { local = "../aptos-trading" }

aptos-move/framework/aptos-experimental/doc/active_order_book.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ This is internal module, which cannot be used directly, use OrderBook instead.
6666

6767
</dd>
6868
<dt>
69-
<code>tie_breaker: <a href="order_book_types.md#0x7_order_book_types_UniqueIdxType">order_book_types::UniqueIdxType</a></code>
69+
<code>tie_breaker: <a href="order_book_types.md#0x7_order_book_types_UniqueIdxType">order_book_types::IncreasingIdxType</a></code>
7070
</dt>
7171
<dd>
7272

@@ -455,7 +455,7 @@ aborts if there are no sells
455455

456456

457457

458-
<pre><code><b>fun</b> <a href="active_order_book.md#0x7_active_order_book_get_tie_breaker">get_tie_breaker</a>(unique_priority_idx: <a href="order_book_types.md#0x7_order_book_types_UniqueIdxType">order_book_types::UniqueIdxType</a>, is_bid: bool): <a href="order_book_types.md#0x7_order_book_types_UniqueIdxType">order_book_types::UniqueIdxType</a>
458+
<pre><code><b>fun</b> <a href="active_order_book.md#0x7_active_order_book_get_tie_breaker">get_tie_breaker</a>(unique_priority_idx: <a href="order_book_types.md#0x7_order_book_types_UniqueIdxType">order_book_types::IncreasingIdxType</a>, is_bid: bool): <a href="order_book_types.md#0x7_order_book_types_UniqueIdxType">order_book_types::IncreasingIdxType</a>
459459
</code></pre>
460460

461461

@@ -465,8 +465,8 @@ aborts if there are no sells
465465

466466

467467
<pre><code>inline <b>fun</b> <a href="active_order_book.md#0x7_active_order_book_get_tie_breaker">get_tie_breaker</a>(
468-
unique_priority_idx: UniqueIdxType, is_bid: bool
469-
): UniqueIdxType {
468+
unique_priority_idx: IncreasingIdxType, is_bid: bool
469+
): IncreasingIdxType {
470470
<b>if</b> (is_bid) {
471471
unique_priority_idx
472472
} <b>else</b> {
@@ -485,7 +485,7 @@ aborts if there are no sells
485485

486486

487487

488-
<pre><code><b>public</b>(<b>friend</b>) <b>fun</b> <a href="active_order_book.md#0x7_active_order_book_cancel_active_order">cancel_active_order</a>(self: &<b>mut</b> <a href="active_order_book.md#0x7_active_order_book_ActiveOrderBook">active_order_book::ActiveOrderBook</a>, price: u64, unique_priority_idx: <a href="order_book_types.md#0x7_order_book_types_UniqueIdxType">order_book_types::UniqueIdxType</a>, is_bid: bool): u64
488+
<pre><code><b>public</b>(<b>friend</b>) <b>fun</b> <a href="active_order_book.md#0x7_active_order_book_cancel_active_order">cancel_active_order</a>(self: &<b>mut</b> <a href="active_order_book.md#0x7_active_order_book_ActiveOrderBook">active_order_book::ActiveOrderBook</a>, price: u64, unique_priority_idx: <a href="order_book_types.md#0x7_order_book_types_UniqueIdxType">order_book_types::IncreasingIdxType</a>, is_bid: bool): u64
489489
</code></pre>
490490

491491

@@ -497,7 +497,7 @@ aborts if there are no sells
497497
<pre><code><b>public</b>(<b>friend</b>) <b>fun</b> <a href="active_order_book.md#0x7_active_order_book_cancel_active_order">cancel_active_order</a>(
498498
self: &<b>mut</b> <a href="active_order_book.md#0x7_active_order_book_ActiveOrderBook">ActiveOrderBook</a>,
499499
price: u64,
500-
unique_priority_idx: UniqueIdxType,
500+
unique_priority_idx: IncreasingIdxType,
501501
is_bid: bool
502502
): u64 {
503503
<b>let</b> tie_breaker = <a href="active_order_book.md#0x7_active_order_book_get_tie_breaker">get_tie_breaker</a>(unique_priority_idx, is_bid);
@@ -522,7 +522,7 @@ aborts if there are no sells
522522

523523

524524

525-
<pre><code><b>public</b>(<b>friend</b>) <b>fun</b> <a href="active_order_book.md#0x7_active_order_book_cancel_if_active_order">cancel_if_active_order</a>(self: &<b>mut</b> <a href="active_order_book.md#0x7_active_order_book_ActiveOrderBook">active_order_book::ActiveOrderBook</a>, price: u64, unique_priority_idx: <a href="order_book_types.md#0x7_order_book_types_UniqueIdxType">order_book_types::UniqueIdxType</a>, is_bid: bool)
525+
<pre><code><b>public</b>(<b>friend</b>) <b>fun</b> <a href="active_order_book.md#0x7_active_order_book_cancel_if_active_order">cancel_if_active_order</a>(self: &<b>mut</b> <a href="active_order_book.md#0x7_active_order_book_ActiveOrderBook">active_order_book::ActiveOrderBook</a>, price: u64, unique_priority_idx: <a href="order_book_types.md#0x7_order_book_types_UniqueIdxType">order_book_types::IncreasingIdxType</a>, is_bid: bool)
526526
</code></pre>
527527

528528

@@ -534,7 +534,7 @@ aborts if there are no sells
534534
<pre><code><b>public</b>(<b>friend</b>) <b>fun</b> <a href="active_order_book.md#0x7_active_order_book_cancel_if_active_order">cancel_if_active_order</a>(
535535
self: &<b>mut</b> <a href="active_order_book.md#0x7_active_order_book_ActiveOrderBook">ActiveOrderBook</a>,
536536
price: u64,
537-
unique_priority_idx: UniqueIdxType,
537+
unique_priority_idx: IncreasingIdxType,
538538
is_bid: bool
539539
){
540540
<b>let</b> tie_breaker = <a href="active_order_book.md#0x7_active_order_book_get_tie_breaker">get_tie_breaker</a>(unique_priority_idx, is_bid);
@@ -561,7 +561,7 @@ aborts if there are no sells
561561

562562

563563

564-
<pre><code><b>public</b>(<b>friend</b>) <b>fun</b> <a href="active_order_book.md#0x7_active_order_book_is_active_order">is_active_order</a>(self: &<a href="active_order_book.md#0x7_active_order_book_ActiveOrderBook">active_order_book::ActiveOrderBook</a>, price: u64, unique_priority_idx: <a href="order_book_types.md#0x7_order_book_types_UniqueIdxType">order_book_types::UniqueIdxType</a>, is_bid: bool): bool
564+
<pre><code><b>public</b>(<b>friend</b>) <b>fun</b> <a href="active_order_book.md#0x7_active_order_book_is_active_order">is_active_order</a>(self: &<a href="active_order_book.md#0x7_active_order_book_ActiveOrderBook">active_order_book::ActiveOrderBook</a>, price: u64, unique_priority_idx: <a href="order_book_types.md#0x7_order_book_types_UniqueIdxType">order_book_types::IncreasingIdxType</a>, is_bid: bool): bool
565565
</code></pre>
566566

567567

@@ -573,7 +573,7 @@ aborts if there are no sells
573573
<pre><code><b>public</b>(<b>friend</b>) <b>fun</b> <a href="active_order_book.md#0x7_active_order_book_is_active_order">is_active_order</a>(
574574
self: &<a href="active_order_book.md#0x7_active_order_book_ActiveOrderBook">ActiveOrderBook</a>,
575575
price: u64,
576-
unique_priority_idx: UniqueIdxType,
576+
unique_priority_idx: IncreasingIdxType,
577577
is_bid: bool
578578
): bool {
579579
<b>let</b> tie_breaker = <a href="active_order_book.md#0x7_active_order_book_get_tie_breaker">get_tie_breaker</a>(unique_priority_idx, is_bid);
@@ -780,7 +780,7 @@ Check if the order is a taker order - i.e. if it can be immediately matched with
780780
Increase the size of the order in the orderbook without altering its position in the price-time priority.
781781

782782

783-
<pre><code><b>public</b>(<b>friend</b>) <b>fun</b> <a href="active_order_book.md#0x7_active_order_book_increase_order_size">increase_order_size</a>(self: &<b>mut</b> <a href="active_order_book.md#0x7_active_order_book_ActiveOrderBook">active_order_book::ActiveOrderBook</a>, price: u64, unique_priority_idx: <a href="order_book_types.md#0x7_order_book_types_UniqueIdxType">order_book_types::UniqueIdxType</a>, size_delta: u64, is_bid: bool)
783+
<pre><code><b>public</b>(<b>friend</b>) <b>fun</b> <a href="active_order_book.md#0x7_active_order_book_increase_order_size">increase_order_size</a>(self: &<b>mut</b> <a href="active_order_book.md#0x7_active_order_book_ActiveOrderBook">active_order_book::ActiveOrderBook</a>, price: u64, unique_priority_idx: <a href="order_book_types.md#0x7_order_book_types_UniqueIdxType">order_book_types::IncreasingIdxType</a>, size_delta: u64, is_bid: bool)
784784
</code></pre>
785785

786786

@@ -792,7 +792,7 @@ Increase the size of the order in the orderbook without altering its position in
792792
<pre><code><b>public</b>(<b>friend</b>) <b>fun</b> <a href="active_order_book.md#0x7_active_order_book_increase_order_size">increase_order_size</a>(
793793
self: &<b>mut</b> <a href="active_order_book.md#0x7_active_order_book_ActiveOrderBook">ActiveOrderBook</a>,
794794
price: u64,
795-
unique_priority_idx: UniqueIdxType,
795+
unique_priority_idx: IncreasingIdxType,
796796
size_delta: u64,
797797
is_bid: bool
798798
) {
@@ -817,7 +817,7 @@ Increase the size of the order in the orderbook without altering its position in
817817
Decrease the size of the order in the order book without altering its position in the price-time priority.
818818

819819

820-
<pre><code><b>public</b>(<b>friend</b>) <b>fun</b> <a href="active_order_book.md#0x7_active_order_book_decrease_order_size">decrease_order_size</a>(self: &<b>mut</b> <a href="active_order_book.md#0x7_active_order_book_ActiveOrderBook">active_order_book::ActiveOrderBook</a>, price: u64, unique_priority_idx: <a href="order_book_types.md#0x7_order_book_types_UniqueIdxType">order_book_types::UniqueIdxType</a>, size_delta: u64, is_bid: bool)
820+
<pre><code><b>public</b>(<b>friend</b>) <b>fun</b> <a href="active_order_book.md#0x7_active_order_book_decrease_order_size">decrease_order_size</a>(self: &<b>mut</b> <a href="active_order_book.md#0x7_active_order_book_ActiveOrderBook">active_order_book::ActiveOrderBook</a>, price: u64, unique_priority_idx: <a href="order_book_types.md#0x7_order_book_types_UniqueIdxType">order_book_types::IncreasingIdxType</a>, size_delta: u64, is_bid: bool)
821821
</code></pre>
822822

823823

@@ -829,7 +829,7 @@ Decrease the size of the order in the order book without altering its position i
829829
<pre><code><b>public</b>(<b>friend</b>) <b>fun</b> <a href="active_order_book.md#0x7_active_order_book_decrease_order_size">decrease_order_size</a>(
830830
self: &<b>mut</b> <a href="active_order_book.md#0x7_active_order_book_ActiveOrderBook">ActiveOrderBook</a>,
831831
price: u64,
832-
unique_priority_idx: UniqueIdxType,
832+
unique_priority_idx: IncreasingIdxType,
833833
size_delta: u64,
834834
is_bid: bool
835835
) {
@@ -853,7 +853,7 @@ Decrease the size of the order in the order book without altering its position i
853853

854854

855855

856-
<pre><code><b>public</b>(<b>friend</b>) <b>fun</b> <a href="active_order_book.md#0x7_active_order_book_place_maker_order">place_maker_order</a>(self: &<b>mut</b> <a href="active_order_book.md#0x7_active_order_book_ActiveOrderBook">active_order_book::ActiveOrderBook</a>, order_id: <a href="order_book_types.md#0x7_order_book_types_OrderIdType">order_book_types::OrderIdType</a>, price: u64, unique_priority_idx: <a href="order_book_types.md#0x7_order_book_types_UniqueIdxType">order_book_types::UniqueIdxType</a>, size: u64, is_bid: bool)
856+
<pre><code><b>public</b>(<b>friend</b>) <b>fun</b> <a href="active_order_book.md#0x7_active_order_book_place_maker_order">place_maker_order</a>(self: &<b>mut</b> <a href="active_order_book.md#0x7_active_order_book_ActiveOrderBook">active_order_book::ActiveOrderBook</a>, order_id: <a href="order_book_types.md#0x7_order_book_types_OrderIdType">order_book_types::OrderIdType</a>, price: u64, unique_priority_idx: <a href="order_book_types.md#0x7_order_book_types_UniqueIdxType">order_book_types::IncreasingIdxType</a>, size: u64, is_bid: bool)
857857
</code></pre>
858858

859859

@@ -866,7 +866,7 @@ Decrease the size of the order in the order book without altering its position i
866866
self: &<b>mut</b> <a href="active_order_book.md#0x7_active_order_book_ActiveOrderBook">ActiveOrderBook</a>,
867867
order_id: OrderIdType,
868868
price: u64,
869-
unique_priority_idx: UniqueIdxType,
869+
unique_priority_idx: IncreasingIdxType,
870870
size: u64,
871871
is_bid: bool
872872
) {

0 commit comments

Comments
 (0)