From b3f5ac5bbd4d067e6384e0dac95f02646c5e2985 Mon Sep 17 00:00:00 2001 From: gfournieriExec <100280020+gfournieriExec@users.noreply.github.com> Date: Mon, 10 Jun 2024 18:40:31 +0200 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Zied Guesmi <26070035+zguesmi@users.noreply.github.com> --- contracts/beacon/Voucher.sol | 4 ++-- test/VoucherHub.test.ts | 1 + test/beacon/Voucher.test.ts | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/contracts/beacon/Voucher.sol b/contracts/beacon/Voucher.sol index 4a8b5d0..70b4a7a 100644 --- a/contracts/beacon/Voucher.sol +++ b/contracts/beacon/Voucher.sol @@ -436,8 +436,9 @@ contract Voucher is Initializable, IVoucher { // Transfer non-sponsored amount from the iExec account of the // requester to the iExec account of the voucher //slither-disable-start arbitrary-send-erc20 - // Note: We can disable this check since request order is signed by requester so he agrees to pay for it + // Note: We can disable this check since the requester signed the request order and agreed to pay for the deal. // & caller is only authorized. + // SRLC if ( !IERC20(iexecPoco).transferFrom( requestOrder.requester, @@ -445,7 +446,6 @@ contract Voucher is Initializable, IVoucher { dealPrice - sponsoredAmount ) ) { - // SRLC revert("Voucher: Transfer of non-sponsored amount failed"); } //slither-disable-end arbitrary-send-erc20 diff --git a/test/VoucherHub.test.ts b/test/VoucherHub.test.ts index 1ddf9d1..564289e 100644 --- a/test/VoucherHub.test.ts +++ b/test/VoucherHub.test.ts @@ -668,6 +668,7 @@ describe('VoucherHub', function () { ), ).to.be.revertedWith('VoucherHub: type index out of bounds'); }); + it('Should not create voucher when SLRC transfer fails', async function () { const { voucherOwner1 } = await loadFixture(deployFixture); await voucherHubWithAssetEligibilityManagerSigner.createVoucherType( diff --git a/test/beacon/Voucher.test.ts b/test/beacon/Voucher.test.ts index df9bf02..d1fa600 100644 --- a/test/beacon/Voucher.test.ts +++ b/test/beacon/Voucher.test.ts @@ -1071,6 +1071,7 @@ describe('Voucher', function () { ); }); }); + describe('Should not claim task when SLRC transfer fails', async () => { it('Classic', async () => await runTest(voucherMatchOrders, claim)); it('Boost', async () => await runTest(voucherMatchOrdersBoost, claimBoost));