From c93e196c8e67e098467357631adc2895ef8a115c Mon Sep 17 00:00:00 2001 From: arigatodl <99845398+dulguun-staderlabs@users.noreply.github.com> Date: Fri, 5 Jan 2024 16:48:51 +0800 Subject: [PATCH] Fix weth issue --- contracts/OperatorRewardsCollector.sol | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/contracts/OperatorRewardsCollector.sol b/contracts/OperatorRewardsCollector.sol index 9ea7a453..6ac5fa97 100644 --- a/contracts/OperatorRewardsCollector.sol +++ b/contracts/OperatorRewardsCollector.sol @@ -100,7 +100,7 @@ contract OperatorRewardsCollector is IOperatorRewardsCollector, AccessControlUpg if (balances[operator] < operatorLiquidation.totalAmountInEth) revert InsufficientBalance(); // Transfer WETH to liquidator and ETH to treasury - weth.deposit{value: operatorLiquidation.totalAmountInEth}(); + weth.deposit{value: operatorLiquidation.totalAmountInEth - operatorLiquidation.totalFeeInEth}(); if ( weth.transferFrom( address(this), @@ -132,7 +132,14 @@ contract OperatorRewardsCollector is IOperatorRewardsCollector, AccessControlUpg // If there's an amount to send, transfer it to the operator's rewards address if (amount > 0) { address rewardsAddress = UtilLib.getOperatorRewardAddress(operator, staderConfig); - UtilLib.sendValue(rewardsAddress, amount); + weth.deposit{value: amount}(); + if ( + weth.transferFrom( + address(this), + rewardsAddress, + amount + ) == false + ) revert WethTransferFailed(); emit Claimed(rewardsAddress, amount); } }