mirror of
https://github.com/Instadapp/dsa-connectors-old.git
synced 2024-07-29 22:47:46 +00:00
Merge pull request #11 from InstaDApp/use-staking-token
uses stakingToken instead of snxToken
This commit is contained in:
commit
8d1b0b9dd4
|
@ -1,8 +1,8 @@
|
||||||
pragma solidity ^0.6.0;
|
pragma solidity ^0.6.0;
|
||||||
pragma experimental ABIEncoderV2;
|
pragma experimental ABIEncoderV2;
|
||||||
|
|
||||||
import { SafeERC20 } from "../../node_modules/@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
|
import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
|
||||||
import { IERC20 } from "../../node_modules/@openzeppelin/contracts/token/ERC20/IERC20.sol";
|
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
|
||||||
|
|
||||||
interface LiqudityInterface {
|
interface LiqudityInterface {
|
||||||
function deposit(address, uint) external payable;
|
function deposit(address, uint) external payable;
|
||||||
|
|
|
@ -30,13 +30,6 @@ contract SynthetixStakingHelper is DSMath, Stores {
|
||||||
return 0x772590F33eD05b0E83553650BF9e75A04b337526; // InstaMapping Address
|
return 0x772590F33eD05b0E83553650BF9e75A04b337526; // InstaMapping Address
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @dev Return Synthetix Token address.
|
|
||||||
*/
|
|
||||||
function getSnxAddr() internal virtual view returns (address) {
|
|
||||||
return 0xC011a73ee8576Fb46F5E1c5751cA3B9Fe0af2a6F;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev Convert String to bytes32.
|
* @dev Convert String to bytes32.
|
||||||
*/
|
*/
|
||||||
|
@ -138,13 +131,11 @@ contract SynthetixStaking is SynthetixStakingHelper {
|
||||||
uint _amt = getUint(getId, amt);
|
uint _amt = getUint(getId, amt);
|
||||||
(IStakingRewards stakingContract, TokenInterface stakingToken, bytes32 stakingType) = getStakingData(stakingPoolName);
|
(IStakingRewards stakingContract, TokenInterface stakingToken, bytes32 stakingType) = getStakingData(stakingPoolName);
|
||||||
|
|
||||||
TokenInterface snxToken = TokenInterface(getSnxAddr());
|
|
||||||
|
|
||||||
_amt = _amt == uint(-1) ? stakingContract.balanceOf(address(this)) : _amt;
|
_amt = _amt == uint(-1) ? stakingContract.balanceOf(address(this)) : _amt;
|
||||||
uint intialBal = snxToken.balanceOf(address(this));
|
uint intialBal = stakingToken.balanceOf(address(this));
|
||||||
stakingContract.withdraw(_amt);
|
stakingContract.withdraw(_amt);
|
||||||
stakingContract.getReward();
|
stakingContract.getReward();
|
||||||
uint finalBal = snxToken.balanceOf(address(this));
|
uint finalBal = stakingToken.balanceOf(address(this));
|
||||||
|
|
||||||
uint rewardAmt = sub(finalBal, intialBal);
|
uint rewardAmt = sub(finalBal, intialBal);
|
||||||
|
|
||||||
|
@ -173,11 +164,9 @@ contract SynthetixStaking is SynthetixStakingHelper {
|
||||||
) external payable {
|
) external payable {
|
||||||
(IStakingRewards stakingContract, TokenInterface stakingToken, bytes32 stakingType) = getStakingData(stakingPoolName);
|
(IStakingRewards stakingContract, TokenInterface stakingToken, bytes32 stakingType) = getStakingData(stakingPoolName);
|
||||||
|
|
||||||
TokenInterface snxToken = TokenInterface(getSnxAddr());
|
uint intialBal = stakingToken.balanceOf(address(this));
|
||||||
|
|
||||||
uint intialBal = snxToken.balanceOf(address(this));
|
|
||||||
stakingContract.getReward();
|
stakingContract.getReward();
|
||||||
uint finalBal = snxToken.balanceOf(address(this));
|
uint finalBal = stakingToken.balanceOf(address(this));
|
||||||
|
|
||||||
uint rewardAmt = sub(finalBal, intialBal);
|
uint rewardAmt = sub(finalBal, intialBal);
|
||||||
|
|
||||||
|
|
|
@ -14,10 +14,6 @@ contract MockSynthetixStaking is ConnectSynthetixStaking{
|
||||||
|
|
||||||
function emitEvent(bytes32 eventCode, bytes memory eventData) override internal {}
|
function emitEvent(bytes32 eventCode, bytes memory eventData) override internal {}
|
||||||
|
|
||||||
function getSnxAddr() override internal view returns (address) {
|
|
||||||
return synthetixStakingAddr;
|
|
||||||
}
|
|
||||||
|
|
||||||
function getMappingAddr() override internal view returns (address) {
|
function getMappingAddr() override internal view returns (address) {
|
||||||
return instaMappingAddr;
|
return instaMappingAddr;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user