From 0f33852c24d838decffb3a4e9640c51dc807167c Mon Sep 17 00:00:00 2001 From: Thrilok Kumar Date: Fri, 10 Jul 2020 16:30:14 +0530 Subject: [PATCH 1/2] Minor changes --- contracts/connectors/synthetix.sol | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/contracts/connectors/synthetix.sol b/contracts/connectors/synthetix.sol index e46c494..460b683 100644 --- a/contracts/connectors/synthetix.sol +++ b/contracts/connectors/synthetix.sol @@ -10,6 +10,7 @@ interface IStakingRewards { function exit() external; function withdraw(uint256 amount) external; function getReward() external; + function balanceOf(address) external returns (uint256); } contract SynthetixStakingHelper is DSMath, Stores { @@ -103,14 +104,11 @@ contract SynthetixStaking is SynthetixStakingHelper { uint _amt = getUint(getId, amt); IStakingRewards stakingContract = IStakingRewards(getSynthetixStakingAddr(token)); TokenInterface snxToken = TokenInterface(getSnxAddr()); + _amt = _amt == uint(-1) ? stakingContract.balanceOf(address(this)) : _amt; uint intialBal = snxToken.balanceOf(address(this)); - if (_amt == uint(-1)) { - stakingContract.exit(); - } else{ - stakingContract.withdraw(_amt); - stakingContract.getReward(); - } + stakingContract.withdraw(_amt); + stakingContract.getReward(); uint finalBal = snxToken.balanceOf(address(this)); uint rewardAmt = sub(finalBal, intialBal); From c8d45fbfe47f5870e143c9c477229f17c1239817 Mon Sep 17 00:00:00 2001 From: Thrilok Kumar Date: Fri, 10 Jul 2020 16:36:29 +0530 Subject: [PATCH 2/2] Fixed minor bug --- contracts/connectors/synthetix.sol | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contracts/connectors/synthetix.sol b/contracts/connectors/synthetix.sol index a19afcb..7464283 100644 --- a/contracts/connectors/synthetix.sol +++ b/contracts/connectors/synthetix.sol @@ -10,14 +10,14 @@ interface IStakingRewards { function exit() external; function withdraw(uint256 amount) external; function getReward() external; - function balanceOf(address) external returns (uint256); + function balanceOf(address) external view returns (uint256); } contract SynthetixStakingHelper is DSMath, Stores { /** * @dev Return Synthetix staking pool address. */ - function getSynthetixStakingAddr(address token) virtual internal view returns (address){ + function getSynthetixStakingAddr(address token) internal pure returns (address){ if (token == address(0x075b1bb99792c9E1041bA13afEf80C91a1e70fB3)){ // SBTC return 0x13C1542A468319688B89E323fe9A3Be3A90EBb27;