mirror of
https://github.com/Instadapp/dsa-connectors-old.git
synced 2024-07-29 22:47:46 +00:00
created Mocks and MockSynthetix;
adding constructor for MockSynthetix and passing mock for synthetix address;
This commit is contained in:
parent
d1fc7fd324
commit
cdb8bf01eb
|
@ -12,11 +12,11 @@ interface IStakingRewards {
|
||||||
function getReward() external;
|
function getReward() external;
|
||||||
}
|
}
|
||||||
|
|
||||||
contract SynthetixStakingHelper is DSMath, Stores {
|
contract SynthetixStakingHelper is DSMath, Stores {
|
||||||
/**
|
/**
|
||||||
* @dev Return Synthetix staking pool address.
|
* @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)){
|
if (token == address(0x075b1bb99792c9E1041bA13afEf80C91a1e70fB3)){
|
||||||
// SBTC
|
// SBTC
|
||||||
return 0x13C1542A468319688B89E323fe9A3Be3A90EBb27;
|
return 0x13C1542A468319688B89E323fe9A3Be3A90EBb27;
|
||||||
|
@ -117,7 +117,7 @@ contract SynthetixStaking is SynthetixStakingHelper {
|
||||||
|
|
||||||
setUint(setIdAmount, _amt);
|
setUint(setIdAmount, _amt);
|
||||||
setUint(setIdReward, rewardAmt);
|
setUint(setIdReward, rewardAmt);
|
||||||
|
|
||||||
emit LogWithdraw(token, _amt, getId, setIdAmount);
|
emit LogWithdraw(token, _amt, getId, setIdAmount);
|
||||||
bytes32 _eventCodeWithdraw = keccak256("LogWithdraw(address,uint256,uint256,uint256)");
|
bytes32 _eventCodeWithdraw = keccak256("LogWithdraw(address,uint256,uint256,uint256)");
|
||||||
bytes memory _eventParamWithdraw = abi.encode(token, _amt, getId, setIdAmount);
|
bytes memory _eventParamWithdraw = abi.encode(token, _amt, getId, setIdAmount);
|
||||||
|
|
19
contracts/tests/MockSynthetix.sol
Normal file
19
contracts/tests/MockSynthetix.sol
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,10 +1,18 @@
|
||||||
// const CurveProtocol = artifacts.require("CurveProtocol");
|
// const CurveProtocol = artifacts.require("CurveProtocol");
|
||||||
// const ConnectSBTCCurve = artifacts.require("ConnectSBTCCurve");
|
// const ConnectSBTCCurve = artifacts.require("ConnectSBTCCurve");
|
||||||
const MockContract = artifacts.require("MockContract");
|
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) {
|
module.exports = async function(deployer) {
|
||||||
// deployer.deploy(CurveProtocol);
|
// deployer.deploy(CurveProtocol);
|
||||||
deployer.deploy(MockContract);
|
|
||||||
// let connectorLength = await connectorInstance.methods.connectorLength().call();
|
// 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);
|
||||||
|
});
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -7,13 +7,13 @@ const {
|
||||||
} = require('@openzeppelin/test-helpers');
|
} = require('@openzeppelin/test-helpers');
|
||||||
|
|
||||||
const MockContract = artifacts.require("MockContract");
|
const MockContract = artifacts.require("MockContract");
|
||||||
|
const MockSynthetixStaking = artifacts.require('MockSynthetixStaking');
|
||||||
const ConnectSynthetixStaking = artifacts.require('ConnectSynthetixStaking');
|
|
||||||
const erc20ABI = require("./abi/erc20.js");
|
const erc20ABI = require("./abi/erc20.js");
|
||||||
|
|
||||||
contract('ConnectSynthetixStaking', async accounts => {
|
contract('ConnectSynthetixStaking', async accounts => {
|
||||||
const [sender, receiver] = 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);
|
const crvRenWSBTCContract = new web3.eth.Contract(erc20ABI, mock.address);
|
||||||
|
|
||||||
before(async function () {
|
before(async function () {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user