@@ -13,7 +13,10 @@ global FULFILL_ORDER_AUTHWIT_NONCE: Field = 2;
1313
1414#[test]
1515unconstrained fn create_order_happy_path () {
16- let (mut env , orderbook_address , token0_address , token1_address , minter , maker ) = setup (true );
16+ let (mut env , orderbook_address , token0_address , token1_address , minter ) = setup ();
17+
18+ // We create a contract account (as opposed to a light account) for the maker to be able to use authwits.
19+ let maker = env .create_contract_account ();
1720
1821 let token0 = Token ::at (token0_address );
1922 let orderbook = Orderbook ::at (orderbook_address );
@@ -45,14 +48,16 @@ unconstrained fn create_order_happy_path() {
4548
4649#[test]
4750unconstrained fn full_flow () {
48- let (mut env , orderbook_address , token0_address , token1_address , minter , maker ) = setup (true );
51+ let (mut env , orderbook_address , token0_address , token1_address , minter ) = setup ();
52+
53+ // We create a contract account (as opposed to a light account) for the maker and taker to be able to use authwits.
54+ let maker = env .create_contract_account ();
55+ let taker = env .create_contract_account ();
4956
5057 let token0 = Token ::at (token0_address );
5158 let token1 = Token ::at (token1_address );
5259 let orderbook = Orderbook ::at (orderbook_address );
5360
54- let taker = env .create_contract_account ();
55-
5661 // Mint tokens to maker and taker
5762 env .call_private (minter , token0 .mint_to_private (maker , BID_AMOUNT ));
5863 env .call_private (minter , token1 .mint_to_private (taker , ASK_AMOUNT ));
@@ -116,7 +121,10 @@ unconstrained fn full_flow() {
116121
117122#[test(should_fail_with = "ZERO_BID_AMOUNT")]
118123unconstrained fn create_order_zero_bid_amount () {
119- let (mut env , orderbook_address , token0_address , token1_address , _ , maker ) = setup (false );
124+ let (mut env , orderbook_address , token0_address , token1_address , _minter ) = setup ();
125+
126+ // We create a light account for the maker (as opposed to a contract account) since we are not using authwits here.
127+ let maker = env .create_light_account ();
120128
121129 let orderbook = Orderbook ::at (orderbook_address );
122130
@@ -136,7 +144,10 @@ unconstrained fn create_order_zero_bid_amount() {
136144
137145#[test(should_fail_with = "ZERO_ASK_AMOUNT")]
138146unconstrained fn create_order_zero_ask_amount () {
139- let (mut env , orderbook_address , token0_address , token1_address , _ , maker ) = setup (false );
147+ let (mut env , orderbook_address , token0_address , token1_address , _minter ) = setup ();
148+
149+ // We create a light account for the maker (as opposed to a contract account) since we are not using authwits here.
150+ let maker = env .create_light_account ();
140151
141152 let orderbook = Orderbook ::at (orderbook_address );
142153
@@ -156,7 +167,10 @@ unconstrained fn create_order_zero_ask_amount() {
156167
157168#[test(should_fail_with = "BID_TOKEN_IS_INVALID")]
158169unconstrained fn create_order_invalid_bid_token () {
159- let (mut env , orderbook_address , _token0_address , token1_address , _ , maker ) = setup (false );
170+ let (mut env , orderbook_address , _token0_address , token1_address , _minter ) = setup ();
171+
172+ // We create a light account for the maker (as opposed to a contract account) since we are not using authwits here.
173+ let maker = env .create_light_account ();
160174
161175 let orderbook = Orderbook ::at (orderbook_address );
162176
@@ -176,7 +190,10 @@ unconstrained fn create_order_invalid_bid_token() {
176190
177191#[test(should_fail_with = "ASK_TOKEN_IS_INVALID")]
178192unconstrained fn create_order_invalid_ask_token () {
179- let (mut env , orderbook_address , token0_address , _token1_address , _ , maker ) = setup (false );
193+ let (mut env , orderbook_address , token0_address , _token1_address , _minter ) = setup ();
194+
195+ // We create a light account for the maker (as opposed to a contract account) since we are not using authwits here.
196+ let maker = env .create_light_account ();
180197
181198 let orderbook = Orderbook ::at (orderbook_address );
182199
@@ -196,7 +213,10 @@ unconstrained fn create_order_invalid_ask_token() {
196213
197214#[test(should_fail_with = "SAME_TOKEN_TRADE")]
198215unconstrained fn create_order_same_tokens () {
199- let (mut env , orderbook_address , token0_address , _token1_address , _ , maker ) = setup (false );
216+ let (mut env , orderbook_address , token0_address , _token1_address , _minter ) = setup ();
217+
218+ // We create a light account for the maker (as opposed to a contract account) since we are not using authwits here.
219+ let maker = env .create_light_account ();
200220
201221 let orderbook = Orderbook ::at (orderbook_address );
202222
0 commit comments