@@ -108,7 +108,7 @@ Returns:
108108 );
109109 <b >let</b > response = market.get_order_book_mut().<a href =" market_bulk_order.md#0x7_market_bulk_order_place_bulk_order " >place_bulk_order</a >(request);
110110 <b >let</b > (bulk_order, cancelled_bid_prices, cancelled_bid_sizes, cancelled_ask_prices, cancelled_ask_sizes, previous_seq_num_option) = destroy_bulk_order_place_response(response);
111- <b >let</b > (order_id, _, _, order_sequence_number, bid_prices, bid_sizes, ask_prices, ask_sizes, _ ) = bulk_order.destroy_bulk_order(); // We don't need <b >to</b > keep the bulk order <b >struct</b > after placement
111+ <b >let</b > (order_id, _, _, order_sequence_number, _, bid_prices, bid_sizes, ask_prices, ask_sizes, _ ) = bulk_order.destroy_bulk_order(); // We don't need <b >to</b > keep the bulk order <b >struct</b > after placement
112112 <b >assert</b >!(sequence_number == order_sequence_number, <a href =" market_bulk_order.md#0x7_market_bulk_order_E_SEQUENCE_NUMBER_MISMATCH " >E_SEQUENCE_NUMBER_MISMATCH</a >);
113113 // Extract previous_seq_num from <a href =" ../../aptos-framework/../aptos-stdlib/../move-stdlib/doc/option.md#0x1_option " >option</a >, defaulting <b >to</b > 0 <b >if</b > none
114114 <b >let</b > previous_seq_num = previous_seq_num_option.destroy_with_default(0);
@@ -146,10 +146,11 @@ for the specified user account.
146146Parameters:
147147- market: The market instance
148148- user: The signer of the user whose bulk orders should be cancelled
149+ - cancellation_reason: The reason for cancelling the bulk order
149150- callbacks: The market clearinghouse callbacks for cleanup operations
150151
151152
152- <pre ><code ><b >public</b > <b >fun</b > <a href =" market_bulk_order.md#0x7_market_bulk_order_cancel_bulk_order " >cancel_bulk_order</a >< ; M: <b >copy</b >, drop, store, R: <b >copy</b >, drop, store> ; (market: &<b >mut</b > <a href =" market_types.md#0x7_market_types_Market " >market_types::Market</a >< ; M> ; , user: &<a href =" ../../aptos-framework/../aptos-stdlib/../move-stdlib/doc/signer.md#0x1_signer " >signer</a >, callbacks: &<a href =" market_types.md#0x7_market_types_MarketClearinghouseCallbacks " >market_types::MarketClearinghouseCallbacks</a >< ; M, R> ; )
153+ <pre ><code ><b >public</b > <b >fun</b > <a href =" market_bulk_order.md#0x7_market_bulk_order_cancel_bulk_order " >cancel_bulk_order</a >< ; M: <b >copy</b >, drop, store, R: <b >copy</b >, drop, store> ; (market: &<b >mut</b > <a href =" market_types.md#0x7_market_types_Market " >market_types::Market</a >< ; M> ; , user: &<a href =" ../../aptos-framework/../aptos-stdlib/../move-stdlib/doc/signer.md#0x1_signer " >signer</a >, cancellation_reason: < a href = " market_types.md#0x7_market_types_OrderCancellationReason " >market_types::OrderCancellationReason</ a >, callbacks: &<a href =" market_types.md#0x7_market_types_MarketClearinghouseCallbacks " >market_types::MarketClearinghouseCallbacks</a >< ; M, R> ; )
153154</code ></pre >
154155
155156
@@ -161,10 +162,11 @@ Parameters:
161162<pre ><code ><b >public</b > <b >fun</b > <a href =" market_bulk_order.md#0x7_market_bulk_order_cancel_bulk_order " >cancel_bulk_order</a >< ; M: store + <b >copy</b > + drop, R: store + <b >copy</b > + drop> ; (
162163 market: &<b >mut</b > Market< ; M> ; ,
163164 user: &<a href =" ../../aptos-framework/../aptos-stdlib/../move-stdlib/doc/signer.md#0x1_signer " >signer</a >,
165+ cancellation_reason: <a href =" market_types.md#0x7_market_types_OrderCancellationReason " >market_types::OrderCancellationReason</a >,
164166 callbacks: &MarketClearinghouseCallbacks< ; M, R> ;
165167) {
166168 <b >let</b > <a href =" ../../aptos-framework/doc/account.md#0x1_account " >account</a > = <a href =" ../../aptos-framework/../aptos-stdlib/../move-stdlib/doc/signer.md#0x1_signer_address_of " >signer::address_of</a >(user);
167- <a href =" market_bulk_order.md#0x7_market_bulk_order_cancel_bulk_order_internal " >cancel_bulk_order_internal</a >(market, <a href =" ../../aptos-framework/doc/account.md#0x1_account " >account</a >, callbacks);
169+ <a href =" market_bulk_order.md#0x7_market_bulk_order_cancel_bulk_order_internal " >cancel_bulk_order_internal</a >(market, <a href =" ../../aptos-framework/doc/account.md#0x1_account " >account</a >, cancellation_reason, callbacks);
168170}
169171</code ></pre >
170172
@@ -178,7 +180,7 @@ Parameters:
178180
179181
180182
181- <pre ><code ><b >public</b >(<b >friend</b >) <b >fun</b > <a href =" market_bulk_order.md#0x7_market_bulk_order_cancel_bulk_order_internal " >cancel_bulk_order_internal</a >< ; M: <b >copy</b >, drop, store, R: <b >copy</b >, drop, store> ; (market: &<b >mut</b > <a href =" market_types.md#0x7_market_types_Market " >market_types::Market</a >< ; M> ; , user: <b >address</b >, callbacks: &<a href =" market_types.md#0x7_market_types_MarketClearinghouseCallbacks " >market_types::MarketClearinghouseCallbacks</a >< ; M, R> ; )
183+ <pre ><code ><b >public</b >(<b >friend</b >) <b >fun</b > <a href =" market_bulk_order.md#0x7_market_bulk_order_cancel_bulk_order_internal " >cancel_bulk_order_internal</a >< ; M: <b >copy</b >, drop, store, R: <b >copy</b >, drop, store> ; (market: &<b >mut</b > <a href =" market_types.md#0x7_market_types_Market " >market_types::Market</a >< ; M> ; , user: <b >address</b >, cancellation_reason: < a href = " market_types.md#0x7_market_types_OrderCancellationReason " >market_types::OrderCancellationReason</ a >, callbacks: &<a href =" market_types.md#0x7_market_types_MarketClearinghouseCallbacks " >market_types::MarketClearinghouseCallbacks</a >< ; M, R> ; )
182184</code ></pre >
183185
184186
@@ -190,10 +192,11 @@ Parameters:
190192<pre ><code ><b >public</b >(<b >friend</b >) <b >fun</b > <a href =" market_bulk_order.md#0x7_market_bulk_order_cancel_bulk_order_internal " >cancel_bulk_order_internal</a >< ; M: store + <b >copy</b > + drop, R: store + <b >copy</b > + drop> ; (
191193 market: &<b >mut</b > Market< ; M> ; ,
192194 user: <b >address</b >,
195+ cancellation_reason: <a href =" market_types.md#0x7_market_types_OrderCancellationReason " >market_types::OrderCancellationReason</a >,
193196 callbacks: &MarketClearinghouseCallbacks< ; M, R> ;
194197) {
195198 <b >let</b > cancelled_bulk_order = market.get_order_book_mut().<a href =" market_bulk_order.md#0x7_market_bulk_order_cancel_bulk_order " >cancel_bulk_order</a >(user);
196- <b >let</b > (order_id, _, _, sequence_number, bid_prices, bid_sizes, ask_prices, ask_sizes, _ ) = cancelled_bulk_order.destroy_bulk_order();
199+ <b >let</b > (order_id, _, _, sequence_number, _, bid_prices, bid_sizes, ask_prices, ask_sizes, _ ) = cancelled_bulk_order.destroy_bulk_order();
197200 <b >let</b > i = 0;
198201 <b >while</b > (i < ; bid_sizes.length()) {
199202 callbacks.cleanup_bulk_order_at_price(user, order_id, <b >true</b >, bid_prices[i], bid_sizes[i]);
@@ -211,7 +214,8 @@ Parameters:
211214 bid_prices,
212215 bid_sizes,
213216 ask_prices,
214- ask_sizes
217+ ask_sizes,
218+ std::option::some(cancellation_reason)
215219 );
216220}
217221</code ></pre >
0 commit comments