mirror of
https://github.com/Instadapp/dsa-connectors-old.git
synced 2024-07-29 22:47:46 +00:00
Minor changes
This commit is contained in:
parent
ea52262f2f
commit
0f33852c24
|
@ -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);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user