@@ -254,39 +254,23 @@ describe('contract: ERC20SingleRequestProxy', () => {
254
254
) . to . be . reverted ;
255
255
} ) ;
256
256
257
- // it('should work with USDT-like non-standard ERC20 tokens', async () => {
258
- // const usdtProxy = await new ERC20SingleRequestProxy__factory(deployer).deploy(
259
- // user2Addr,
260
- // usdtFake.address,
261
- // feeRecipientAddr,
262
- // feeAmount,
263
- // paymentReference,
264
- // erc20FeeProxy.address,
265
- // );
266
-
267
- // const paymentAmount = BN.from(100).mul(USDT_DECIMAL);
268
- // const totalAmount = paymentAmount.add(feeAmount);
269
-
270
- // await usdtFake.transfer(usdtProxy.address, totalAmount);
271
-
272
- // const usdtProxyBalanceBefore = await usdtFake.balanceOf(usdtProxy.address);
273
- // expect(usdtProxyBalanceBefore).to.equal(totalAmount);
274
-
275
- // await expect(
276
- // user1.sendTransaction({
277
- // to: usdtProxy.address,
278
- // value: 0,
279
- // }),
280
- // )
281
- // .to.emit(erc20FeeProxy, 'TransferWithReferenceAndFee')
282
- // .withArgs(usdtFake.address, user2Addr, paymentAmount, paymentReference, feeAmount, feeRecipientAddr);
283
-
284
- // const usdtProxyBalanceAfter = await usdtFake.balanceOf(usdtProxy.address);
285
- // const user2BalanceAfter = await usdtFake.balanceOf(user2Addr);
286
- // const feeRecipientBalanceAfter = await usdtFake.balanceOf(feeRecipientAddr);
287
-
288
- // expect(usdtProxyBalanceAfter).to.equal(0);
289
- // expect(user2BalanceAfter).to.equal(paymentAmount);
290
- // expect(feeRecipientBalanceAfter).to.equal(feeAmount);
291
- // });
257
+ it ( 'should rescue ERC20 tokens' , async ( ) => {
258
+ const rescueAmount = BN . from ( 100 ) . mul ( BASE_DECIMAL ) ;
259
+
260
+ // Transfer tokens directly to the contract
261
+ await testToken . transfer ( erc20SingleRequestProxy . address , rescueAmount ) ;
262
+
263
+ const contractBalanceBefore = await testToken . balanceOf ( erc20SingleRequestProxy . address ) ;
264
+ expect ( contractBalanceBefore ) . to . equal ( rescueAmount ) ;
265
+
266
+ const payeeBalanceBefore = await testToken . balanceOf ( user2Addr ) ;
267
+
268
+ await erc20SingleRequestProxy . rescueFunds ( ) ;
269
+
270
+ const contractBalanceAfter = await testToken . balanceOf ( erc20SingleRequestProxy . address ) ;
271
+ expect ( contractBalanceAfter ) . to . equal ( 0 ) ;
272
+
273
+ const payeeBalanceAfter = await testToken . balanceOf ( user2Addr ) ;
274
+ expect ( payeeBalanceAfter . sub ( payeeBalanceBefore ) ) . to . equal ( rescueAmount ) ;
275
+ } ) ;
292
276
} ) ;
0 commit comments