updated setUint

This commit is contained in:
pradyuman-verma 2021-12-27 21:11:55 +05:30
parent e56ca991e7
commit 60169ee5ee
No known key found for this signature in database
GPG Key ID: E36FD6BC8923221F
4 changed files with 10 additions and 2 deletions

View File

@ -1,3 +1,4 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
contract Events {

View File

@ -1,5 +1,4 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
pragma experimental ABIEncoderV2;
@ -100,4 +99,8 @@ contract Helpers is DSMath, Basic {
address(this)
);
}
function _balance(address token1, address token2) internal view returns (uint balance) {
balance = IERC20(token1).balanceOf(address(this)) + IERC20(token2).balanceOf(address(this));
}
}

View File

@ -1,3 +1,4 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
pragma experimental ABIEncoderV2;

View File

@ -1,3 +1,4 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
pragma experimental ABIEncoderV2;
@ -198,10 +199,12 @@ abstract contract SushipswapIncentiveResolver is Helpers, Events {
if (data.poolId == uint256(-1) || data.version == 0) {
data = _getPoolId(token1, token2);
}
setUint(setId, data.poolId);
uint256 currentBal = _balance(token1, token2);
require(data.poolId != uint256(-1), "pool-does-not-exist");
(uint256 lpAmount, uint256 rewardsAmount) = _getUserInfo(data);
_emergencyWithdraw(data);
uint256 finalBal = _balance(token1, token2);
setUint(setId, uint256(currentBal - finalBal));
_eventName = "LogEmergencyWithdraw(address,address,uint256,uint256,uint256,uint256)";
_eventParam = abi.encode(
token1,