@@ -148,7 +148,7 @@ contract OrderContractTest is Test {
148148 // Arrange
149149 uint64 offerId = 1 ;
150150 uint256 priceForOffer = 5 ether ;
151- uint256 expectedAmountPaid = priceForOffer + orderContract. getAgentFee (); // AGENT_FEE i 1 ether
151+ uint256 expectedAmountPaid = priceForOffer;
152152 uint256 expectedTimeStamp = block .timestamp ;
153153 // Act
154154 vm.startPrank (USER);
@@ -165,7 +165,7 @@ contract OrderContractTest is Test {
165165 // Arrange
166166 uint64 offerId = 1 ;
167167 uint256 priceForOffer = 5 ether ;
168- uint256 expectedAmountPaid = priceForOffer + orderContract. getAgentFee (); // AGENT_FEE is 1 ether
168+ uint256 expectedAmountPaid = priceForOffer;
169169
170170
171171 // Act
@@ -188,6 +188,22 @@ contract OrderContractTest is Test {
188188 orderContract.confirmOrder (offerId);
189189 }
190190
191+ function testConfirmOrderBurnsA3ATokens () public proposeOrderForUser orderProposedAnsweredByAgent {
192+ // Arrange
193+ uint64 offerId = 1 ;
194+ uint256 priceForOffer = 5 ether ;
195+ uint256 userA3ABalanceBefore = a3aToken.balanceOf (USER);
196+ uint256 expectedA3ABurned = 100 ether ;
197+ // Act
198+ vm.startPrank (USER);
199+ ERC20Mock (pyUSD).approve (address (orderContract), priceForOffer);
200+ orderContract.confirmOrder (offerId);
201+ vm.stopPrank ();
202+ uint256 userA3ABalanceAfter = a3aToken.balanceOf (USER);
203+ // Assert
204+ assertEq (userA3ABalanceBefore - userA3ABalanceAfter, expectedA3ABurned);
205+ }
206+
191207
192208 /*//////////////////////////////////////////////////////////////
193209 PROPOSE ORDER ANSWER TESTS
@@ -271,7 +287,7 @@ contract OrderContractTest is Test {
271287 // Arrange
272288 uint64 offerId = 1 ;
273289 uint256 sellerBalanceBefore = ERC20Mock (pyUSD).balanceOf (SELLER);
274- uint256 expectedAmountPaid = 5 ether + orderContract. getAgentFee () ;
290+ uint256 expectedAmountPaid = 5 ether ;
275291 // Act
276292 vm.prank (addressController);
277293 orderContract.finalizeOrder (offerId);
@@ -334,35 +350,6 @@ contract OrderContractTest is Test {
334350 assertEq (uint8 (offer.status), uint8 (OrderContract.OrderStatus.Proposed));
335351 }
336352
337-
338- /*//////////////////////////////////////////////////////////////
339- WITHDRAW PYUSD TESTS
340- //////////////////////////////////////////////////////////////*/
341- function testOnlyOwnerCanWithdrawFunds () public orderConfirmed {
342- // Arrange
343- uint64 offerId = 1 ;
344- // Act / Assert
345- vm.prank (address (0x123 ));
346- vm.expectRevert (OrderContract.OrderContract__onlyOwnerCanWithdrawFunds.selector );
347- orderContract.withdrawPyUSD (offerId);
348- }
349-
350- function testWithdrawFunds () public orderConfirmed {
351- // Arrange
352-
353-
354- uint256 contractBalanceBefore = ERC20Mock (pyUSD).balanceOf (address (orderContract));
355- uint256 ownerBalanceBefore = ERC20Mock (pyUSD).balanceOf (owner);
356- uint256 amountToWithdraw = 0.5e6 ;
357- // Act
358- vm.prank (owner);
359- orderContract.withdrawPyUSD (amountToWithdraw);
360- uint256 contractBalanceAfter = ERC20Mock (pyUSD).balanceOf (address (orderContract));
361- uint256 ownerBalanceAfter = ERC20Mock (pyUSD).balanceOf (owner);
362- // Assert
363- assertEq (contractBalanceBefore - contractBalanceAfter, amountToWithdraw);
364- assertEq (ownerBalanceAfter - ownerBalanceBefore, amountToWithdraw);
365- }
366353 /*//////////////////////////////////////////////////////////////
367354 USER ORDER MAPPINGS TESTS
368355 //////////////////////////////////////////////////////////////*/
0 commit comments