removed constructor from synthetix connector;

overwriting getSynthetixStakingAddr in mock;
comment out everything in migration;
This commit is contained in:
Lecky Lao 2020-07-12 03:42:59 +10:00
parent 12d06f05f7
commit ce11ae6b87
3 changed files with 17 additions and 26 deletions

View File

@ -13,22 +13,16 @@ interface IStakingRewards {
}
contract SynthetixStakingHelper is DSMath, Stores {
IStakingRewards stakingContract;
constructor(address _synthetixStakingAddr) public {
stakingContract = IStakingRewards(_synthetixStakingAddr);
}
/**
* @dev Return Synthetix staking pool address.
*/
function getSynthetixStakingAddr(address token) virtual internal {
function getSynthetixStakingAddr(address token) virtual internal returns (address) {
if (token == address(0x075b1bb99792c9E1041bA13afEf80C91a1e70fB3)){
// SBTC
stakingContract = IStakingRewards(0x13C1542A468319688B89E323fe9A3Be3A90EBb27);
return 0x13C1542A468319688B89E323fe9A3Be3A90EBb27;
} else if (token == address(0xC25a3A3b969415c80451098fa907EC722572917F)){
// SUSD
stakingContract = IStakingRewards(0xDCB6A51eA3CA5d3Fd898Fd6564757c7aAeC3ca92);
return 0xDCB6A51eA3CA5d3Fd898Fd6564757c7aAeC3ca92;
} else {
revert("token-not-found");
}
@ -44,8 +38,6 @@ contract SynthetixStakingHelper is DSMath, Stores {
contract SynthetixStaking is SynthetixStakingHelper {
constructor(address _synthetixStakingAddr) SynthetixStakingHelper(_synthetixStakingAddr) public {}
// Events
event LogDeposit(
address token,
@ -79,7 +71,7 @@ contract SynthetixStaking is SynthetixStakingHelper {
uint setId
) external payable {
uint _amt = getUint(getId, amt);
getSynthetixStakingAddr(token);
IStakingRewards stakingContract = IStakingRewards(getSynthetixStakingAddr(token));
TokenInterface _stakeToken = TokenInterface(token);
_amt = _amt == uint(-1) ? _stakeToken.balanceOf(address(this)) : _amt;
@ -109,7 +101,7 @@ contract SynthetixStaking is SynthetixStakingHelper {
uint setIdReward
) external payable {
uint _amt = getUint(getId, amt);
getSynthetixStakingAddr(token);
IStakingRewards stakingContract = IStakingRewards(getSynthetixStakingAddr(token));
TokenInterface snxToken = TokenInterface(getSnxAddr());
uint intialBal = snxToken.balanceOf(address(this));
@ -146,7 +138,7 @@ contract SynthetixStaking is SynthetixStakingHelper {
address token,
uint setId
) external payable {
getSynthetixStakingAddr(token);
IStakingRewards stakingContract = IStakingRewards(getSynthetixStakingAddr(token));
TokenInterface snxToken = TokenInterface(getSnxAddr());
uint intialBal = snxToken.balanceOf(address(this));
@ -165,7 +157,4 @@ contract SynthetixStaking is SynthetixStakingHelper {
contract ConnectSynthetixStaking is SynthetixStaking {
string public name = "synthetix-staking-v1";
constructor(address _synthetixStakingAddr) SynthetixStaking(_synthetixStakingAddr) public {}
}

View File

@ -5,11 +5,13 @@ import { ConnectSynthetixStaking } from "../connectors/synthetix.sol";
contract MockSynthetixStaking is ConnectSynthetixStaking{
address public synthetixStakingAddr;
constructor(address _synthetixStakingAddr) ConnectSynthetixStaking(_synthetixStakingAddr) public {
constructor(address _synthetixStakingAddr) public {
synthetixStakingAddr = _synthetixStakingAddr;
}
function getSynthetixStakingAddr(address token) override internal{}
function getSynthetixStakingAddr(address token) override internal returns (address) {
return synthetixStakingAddr;
}
function emitEvent(bytes32 eventCode, bytes memory eventData) override internal {}

View File

@ -1,7 +1,7 @@
// const CurveProtocol = artifacts.require("CurveProtocol");
// const ConnectSBTCCurve = artifacts.require("ConnectSBTCCurve");
const MockContract = artifacts.require("MockContract");
const MockSynthetixStaking = artifacts.require("MockSynthetixStaking");
// const MockContract = artifacts.require("MockContract");
// const MockSynthetixStaking = artifacts.require("MockSynthetixStaking");
// const ConnectSynthetixStaking = artifacts.require("ConnectSynthetixStaking");
// const connectorsABI = require("../test/abi/connectors.json");
@ -11,10 +11,10 @@ const MockSynthetixStaking = artifacts.require("MockSynthetixStaking");
module.exports = async function(deployer) {
// deployer.deploy(CurveProtocol);
// let connectorLength = await connectorInstance.methods.connectorLength().call();
deployer.deploy(MockContract).then(function () {
// return deployer.deploy(MockSynthetixStaking, MockContract.address, 1, +connectorLength + 1);
// return deployer.deploy(ConnectSynthetixStaking, MockContract.address);
return deployer.deploy(MockSynthetixStaking, MockContract.address);
});
// deployer.deploy(MockContract).then(function () {
// // return deployer.deploy(MockSynthetixStaking, MockContract.address, 1, +connectorLength + 1);
// // return deployer.deploy(ConnectSynthetixStaking, MockContract.address);
// return deployer.deploy(MockSynthetixStaking, MockContract.address);
// });
};