Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Zied Guesmi <[email protected]>
  • Loading branch information
gfournieriExec and zguesmi authored Jun 10, 2024
1 parent 0fddf5d commit b3f5ac5
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions contracts/beacon/Voucher.sol
Original file line number Diff line number Diff line change
Expand Up @@ -436,16 +436,16 @@ 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,
address(this),
dealPrice - sponsoredAmount
)
) {
// SRLC
revert("Voucher: Transfer of non-sponsored amount failed");
}
//slither-disable-end arbitrary-send-erc20
Expand Down
1 change: 1 addition & 0 deletions test/VoucherHub.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
1 change: 1 addition & 0 deletions test/beacon/Voucher.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit b3f5ac5

Please sign in to comment.