created Mocks and MockSynthetix;

adding constructor for MockSynthetix and passing mock for synthetix address;
This commit is contained in:
Lecky Lao 2020-07-10 01:08:08 +10:00
parent d1fc7fd324
commit cdb8bf01eb
5 changed files with 35 additions and 8 deletions

View File

@ -12,11 +12,11 @@ interface IStakingRewards {
function getReward() external;
}
contract SynthetixStakingHelper is DSMath, Stores {
contract SynthetixStakingHelper is DSMath, Stores {
/**
* @dev Return Synthetix staking pool address.
*/
function getSynthetixStakingAddr(address token) internal pure returns (address){
function getSynthetixStakingAddr(address token) virtual internal view returns (address){
if (token == address(0x075b1bb99792c9E1041bA13afEf80C91a1e70fB3)){
// SBTC
return 0x13C1542A468319688B89E323fe9A3Be3A90EBb27;
@ -117,7 +117,7 @@ contract SynthetixStaking is SynthetixStakingHelper {
setUint(setIdAmount, _amt);
setUint(setIdReward, rewardAmt);
emit LogWithdraw(token, _amt, getId, setIdAmount);
bytes32 _eventCodeWithdraw = keccak256("LogWithdraw(address,uint256,uint256,uint256)");
bytes memory _eventParamWithdraw = abi.encode(token, _amt, getId, setIdAmount);

View File

@ -0,0 +1,19 @@
pragma solidity ^0.6.0;
import { ConnectSynthetixStaking } from "../connectors/synthetix.sol";
contract MockSynthetixStaking is ConnectSynthetixStaking{
// uint public _model;
// uint public _id;
address public synthetixStakingAddr;
constructor(address _synthetixStakingAddr) public {
// _model = model;
// _id = id;
synthetixStakingAddr = _synthetixStakingAddr;
}
function getSynthetixStakingAddr(address token) override internal view returns (address){
return synthetixStakingAddr;
}
}

View File

@ -1,10 +1,18 @@
// const CurveProtocol = artifacts.require("CurveProtocol");
// const ConnectSBTCCurve = artifacts.require("ConnectSBTCCurve");
const MockContract = artifacts.require("MockContract");
const MockSynthetixStaking = artifacts.require("MockSynthetixStaking");
// const connectorsABI = require("../test/abi/connectors.json");
// let connectorsAddr = "0xD6A602C01a023B98Ecfb29Df02FBA380d3B21E0c";
// let connectorInstance = new web3.eth.Contract(connectorsABI, connectorsAddr);
module.exports = async function(deployer) {
// deployer.deploy(CurveProtocol);
deployer.deploy(MockContract);
// let connectorLength = await connectorInstance.methods.connectorLength().call();
// deployer.deploy(ConnectSBTCCurve, 1, +connectorLength + 1);
deployer.deploy(MockContract).then(function () {
// return deployer.deploy(MockSynthetixStaking, MockContract.address, 1, +connectorLength + 1);
return deployer.deploy(MockSynthetixStaking, MockContract.address);
});
};

View File

@ -7,13 +7,13 @@ const {
} = require('@openzeppelin/test-helpers');
const MockContract = artifacts.require("MockContract");
const ConnectSynthetixStaking = artifacts.require('ConnectSynthetixStaking');
const MockSynthetixStaking = artifacts.require('MockSynthetixStaking');
const erc20ABI = require("./abi/erc20.js");
contract('ConnectSynthetixStaking', async accounts => {
const [sender, receiver] = accounts;
const mock = await MockContract.new();
const mock = await MockContract.deployed();
const mockSynthetixStaking = await MockSynthetixStaking.deployed();
const crvRenWSBTCContract = new web3.eth.Contract(erc20ABI, mock.address);
before(async function () {