From 14c0b78c5065d53170ae985fe599952e0fa72fb7 Mon Sep 17 00:00:00 2001 From: Andres Aiello Date: Wed, 21 Aug 2024 16:03:38 -0300 Subject: [PATCH] custom amount to withdraw --- .../contracts/instant-rewards/InstantRewards.sol | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/zevm-app-contracts/contracts/instant-rewards/InstantRewards.sol b/packages/zevm-app-contracts/contracts/instant-rewards/InstantRewards.sol index 8bc5e81..6aed3c5 100644 --- a/packages/zevm-app-contracts/contracts/instant-rewards/InstantRewards.sol +++ b/packages/zevm-app-contracts/contracts/instant-rewards/InstantRewards.sol @@ -79,9 +79,10 @@ contract InstantRewards is Ownable, Pausable, ReentrancyGuard { signerAddress = signerAddress_; } - function withdraw(address wallet) external onlyOwner { + function withdraw(address wallet, uint256 amount) external onlyOwner { if (wallet == address(0)) revert InvalidAddress(); - payable(wallet).transfer(address(this).balance); + if (amount > address(this).balance) revert TransferFailed(); + payable(wallet).transfer(amount); } receive() external payable {}