Minor changes

This commit is contained in:
Thrilok Kumar 2020-07-10 16:30:14 +05:30
parent ea52262f2f
commit 0f33852c24

View File

@ -10,6 +10,7 @@ interface IStakingRewards {
function exit() external; function exit() external;
function withdraw(uint256 amount) external; function withdraw(uint256 amount) external;
function getReward() external; function getReward() external;
function balanceOf(address) external returns (uint256);
} }
contract SynthetixStakingHelper is DSMath, Stores { contract SynthetixStakingHelper is DSMath, Stores {
@ -103,14 +104,11 @@ contract SynthetixStaking is SynthetixStakingHelper {
uint _amt = getUint(getId, amt); uint _amt = getUint(getId, amt);
IStakingRewards stakingContract = IStakingRewards(getSynthetixStakingAddr(token)); IStakingRewards stakingContract = IStakingRewards(getSynthetixStakingAddr(token));
TokenInterface snxToken = TokenInterface(getSnxAddr()); TokenInterface snxToken = TokenInterface(getSnxAddr());
_amt = _amt == uint(-1) ? stakingContract.balanceOf(address(this)) : _amt;
uint intialBal = snxToken.balanceOf(address(this)); uint intialBal = snxToken.balanceOf(address(this));
if (_amt == uint(-1)) {
stakingContract.exit();
} else{
stakingContract.withdraw(_amt); stakingContract.withdraw(_amt);
stakingContract.getReward(); stakingContract.getReward();
}
uint finalBal = snxToken.balanceOf(address(this)); uint finalBal = snxToken.balanceOf(address(this));
uint rewardAmt = sub(finalBal, intialBal); uint rewardAmt = sub(finalBal, intialBal);