Skip to content

Commit

Permalink
revert
Browse files Browse the repository at this point in the history
  • Loading branch information
fadeev committed Nov 20, 2024
1 parent a6d9809 commit 83ab10b
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions examples/call/contracts/Universal.sol
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@ contract Universal is UniversalContract {
(, uint256 gasFee) = IZRC20(zrc20).withdrawGasFeeWithGasLimit(
callOptions.gasLimit
);
if (!IZRC20(zrc20).transferFrom(msg.sender, address(this), gasFee))
if (!IZRC20(zrc20).transferFrom(msg.sender, address(this), gasFee)) {
revert TransferFailed();
}
IZRC20(zrc20).approve(address(gateway), gasFee);
gateway.call(receiver, zrc20, message, callOptions, revertOptions);
}
Expand All @@ -48,8 +49,9 @@ contract Universal is UniversalContract {
) external {
(address gasZRC20, uint256 gasFee) = IZRC20(zrc20).withdrawGasFee();
uint256 target = zrc20 == gasZRC20 ? amount + gasFee : amount;
if (!IZRC20(zrc20).transferFrom(msg.sender, address(this), target))
if (!IZRC20(zrc20).transferFrom(msg.sender, address(this), target)) {
revert TransferFailed();
}
IZRC20(zrc20).approve(address(gateway), target);
if (zrc20 != gasZRC20) {
if (
Expand All @@ -58,7 +60,9 @@ contract Universal is UniversalContract {
address(this),
gasFee
)
) revert TransferFailed();
) {
revert TransferFailed();
}
IZRC20(gasZRC20).approve(address(gateway), gasFee);
}
gateway.withdraw(receiver, amount, zrc20, revertOptions);
Expand All @@ -85,7 +89,9 @@ contract Universal is UniversalContract {
address(this),
gasFee
)
) revert TransferFailed();
) {
revert TransferFailed();
}
IZRC20(gasZRC20).approve(address(gateway), gasFee);
}
gateway.withdrawAndCall(
Expand Down

0 comments on commit 83ab10b

Please sign in to comment.