Skip to content

Commit

Permalink
update mock
Browse files Browse the repository at this point in the history
  • Loading branch information
gfournieriExec committed Jun 10, 2024
1 parent e8214eb commit f605ed1
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions contracts/mocks/IexecPocoMock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ contract IexecPocoMock is ERC20 {
bool public shouldRevertOnSponsorMatchOrdersBoost = false;
bool public shouldRevertOnClaim = false;
bool public shouldReturnTaskWithFailedStatus = false;
bool public shouldRevertOnTransfer = false;
bool public shouldRevertOnTransferFrom = false;
bool public shouldFailOnTransfer = false;
bool public shouldFailOnTransferFrom = false;

bytes32 public mockDealId = keccak256("deal");
uint256 public mockTaskIndex = 0;
Expand Down Expand Up @@ -95,11 +95,11 @@ contract IexecPocoMock is ERC20 {
}

function willRevertOnTransfer() external {
shouldRevertOnTransfer = true;
shouldFailOnTransfer = true;
}

function willRevertOnTransferFrom() external {
shouldRevertOnTransferFrom = true;
shouldFailOnTransferFrom = true;
}

/**
Expand Down Expand Up @@ -171,7 +171,7 @@ contract IexecPocoMock is ERC20 {
*/
function transfer(address recipient, uint256 amount) public override returns (bool) {
if (shouldFailOnTransfer) {
return !shouldRevertOnTransfer;
return false;
}
return super.transfer(recipient, amount);
}
Expand All @@ -181,8 +181,8 @@ contract IexecPocoMock is ERC20 {
address recipient,
uint256 amount
) public override returns (bool) {
if (shouldRevertOnTransferFrom) {
return !shouldRevertOnTransferFrom;
if (shouldFailOnTransferFrom) {
return false;
}
return super.transferFrom(sender, recipient, amount);
}
Expand Down

0 comments on commit f605ed1

Please sign in to comment.