@@ -1023,6 +1023,10 @@ describe("Repayer", function () {
10231023 [ "bytes32" , "uint256" , "uint48" , "tuple(uint256, uint256, bytes)" ] ,
10241024 [ apiTx [ 3 ] , apiTx [ 5 ] , apiTx [ 6 ] , apiTx [ 8 ] ]
10251025 ) ;
1026+ const apiAmountIn = apiTx [ 4 ] ;
1027+ const apiFee = apiTx [ 8 ] [ 0 ] ;
1028+ const apiAmountWithFee = apiAmountIn + apiFee ;
1029+ expect ( apiAmountWithFee ) . to . be . lessThanOrEqual ( amount ) ;
10261030 await repayer . connect ( setTokensUser ) . setInputOutputTokens (
10271031 [ {
10281032 inputToken : weth ,
@@ -1034,7 +1038,7 @@ describe("Repayer", function () {
10341038 ) ;
10351039 const tx = repayer . connect ( repayUser ) . initiateRepay (
10361040 weth ,
1037- amount ,
1041+ apiAmountWithFee ,
10381042 liquidityPool ,
10391043 Domain . ETHEREUM ,
10401044 Provider . EVERCLEAR ,
@@ -1043,13 +1047,13 @@ describe("Repayer", function () {
10431047
10441048 await expect ( tx )
10451049 . to . emit ( repayer , "InitiateRepay" )
1046- . withArgs ( weth . target , amount , liquidityPool . target , Domain . ETHEREUM , Provider . EVERCLEAR ) ;
1050+ . withArgs ( weth . target , apiAmountWithFee , liquidityPool . target , Domain . ETHEREUM , Provider . EVERCLEAR ) ;
10471051 await expect ( tx )
10481052 . to . emit ( weth , "Transfer" )
1049- . withArgs ( repayer . target , everclearFeeAdapter . target , amount ) ;
1053+ . withArgs ( repayer . target , everclearFeeAdapter . target , apiAmountWithFee ) ;
10501054 await expect ( tx )
10511055 . to . emit ( everclearFeeAdapter , "IntentWithFeesAdded" ) ;
1052- expect ( await weth . balanceOf ( repayer ) ) . to . equal ( 6n * ETH ) ;
1056+ expect ( await weth . balanceOf ( repayer ) ) . to . equal ( 10n * ETH - apiAmountWithFee ) ;
10531057 expect ( await getBalance ( repayer ) ) . to . equal ( 0n ) ;
10541058 } ) ;
10551059
0 commit comments