Skip to content

Commit

Permalink
add more checks to withdraw function
Browse files Browse the repository at this point in the history
  • Loading branch information
skosito committed Jul 3, 2024
1 parent 725da8e commit efd62ce
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
9 changes: 7 additions & 2 deletions contracts/prototypes/zevm/GatewayZEVM.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ contract GatewayZEVM is Initializable, OwnableUpgradeable, UUPSUpgradeable {

error WithdrawalFailed();
error InsufficientZRC20Amount();
error ZRC20BurnFailed();
error ZRC20TransferFailed();
error GasFeeTransferFailed();
error CallerIsNotFungibleModule();
error InvalidTarget();
Expand All @@ -39,8 +41,11 @@ contract GatewayZEVM is Initializable, OwnableUpgradeable, UUPSUpgradeable {
revert GasFeeTransferFailed();
}

IZRC20(zrc20).transferFrom(msg.sender, address(this), amount);
IZRC20(zrc20).burn(amount);
if (!IZRC20(zrc20).transferFrom(msg.sender, address(this), amount)) {
revert ZRC20TransferFailed();
}

if (!IZRC20(zrc20).burn(amount)) revert ZRC20BurnFailed();

return gasFee;
}
Expand Down
Loading

0 comments on commit efd62ce

Please sign in to comment.