Base.t.sol
1 pragma solidity >=0.6.0; 2 3 import "truffle/Assert.sol"; 4 //import "truffle/DeployedAddresses.sol"; 5 import "../../../contracts/feeds/ChainlinkFeed.sol"; 6 import "../../common/mock/AggregatorV3Mock.t.sol"; 7 import "../../common/mock/ERC20Mock.t.sol"; 8 import "../../common/mock/EthFeedMock.t.sol"; 9 import "../../common/mock/TimeProviderMock.t.sol"; 10 import "../../common/mock/UniswapV2RouterMock.t.sol"; 11 12 abstract contract Base { 13 14 ChainlinkFeed feed; 15 TimeProviderMock time; 16 17 uint[] roundIds; 18 int[] answers; 19 int[] prices; 20 uint[] updatedAts; 21 22 int price; 23 bool cached; 24 25 //function beforeEachDeploy() public { 26 function setUp() public { 27 28 time = new TimeProviderMock(); 29 30 roundIds = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; 31 answers = [20e8, 25e8, 28e8, 18e8, 19e8, 12e8, 12e8, 13e8, 18e8, 20e8]; 32 prices = [20e18, 25e18, 28e18, 18e18, 19e18, 12e18, 12e18, 13e18, 18e18, 20e18]; 33 updatedAts = 34 [1 days, 2 days, 3 days, 4 days, 5 days, 6 days, 7 days, 8 days, 9 days, 10 days]; 35 36 AggregatorV3Mock mock = new AggregatorV3Mock(roundIds, answers, updatedAts); 37 38 feed = new ChainlinkFeed( 39 "ETH/USD", 40 address(0), 41 address(0), 42 address(mock), 43 address(time), 44 0, 45 new uint[](0), 46 new int[](0) 47 ); 48 49 time.setFixedTime(10 days); 50 } 51 }