diff --git a/contracts/VoucherHub.sol b/contracts/VoucherHub.sol index 92a2d1d..448c726 100644 --- a/contracts/VoucherHub.sol +++ b/contracts/VoucherHub.sol @@ -174,13 +174,10 @@ contract VoucherHub is // The proxy contract does a delegatecall to its implementation. // Re-Entrancy safe because the target contract is controlled. Voucher(voucherAddress).initialize(owner, address(this), expiration, voucherType); - // SRLC - if (!IERC20($._iexecPoco).transfer(voucherAddress, value)) { - revert("VoucherHub: SRLC transfer to voucher failed"); - } _mint(voucherAddress, value); // VCHR $._isVoucher[voucherAddress] = true; emit VoucherCreated(voucherAddress, owner, voucherType, expiration, value); + _transfertFundsToVoucher($._iexecPoco, voucherAddress, value); // SRLC } /** @@ -193,10 +190,7 @@ contract VoucherHub is VoucherHubStorage storage $ = _getVoucherHubStorage(); require($._isVoucher[voucher], "VoucherHub: unknown voucher"); _mint(voucher, value); // VCHR - if (!IERC20($._iexecPoco).transfer(voucher, value)) { - // SRLC - revert("VoucherHub: SRLC transfer to voucher failed"); - } + _transfertFundsToVoucher($._iexecPoco, voucher, value); // SRLC uint256 expiration = block.timestamp + $.voucherTypes[Voucher(voucher).getType()].duration; Voucher(voucher).setExpiration(expiration); emit VoucherToppedUp(voucher, expiration, value);