liquid-funding/contracts/LiquidPledgingMock.sol

50 lines
1.8 KiB
Solidity
Raw Normal View History

2017-06-26 17:54:28 +00:00
pragma solidity ^0.4.11;
2017-10-27 14:38:25 +00:00
/*
Copyright 2017, Jordi Baylina
Contributor: Adrià Massanet <adria@codecontext.io>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
2017-06-26 17:54:28 +00:00
2017-07-13 17:12:45 +00:00
import "./LiquidPledging.sol";
2017-06-26 17:54:28 +00:00
2017-10-27 14:38:25 +00:00
/// @dev `LiquidPledgingMock` allows for mocking up
/// a `LiquidPledging` contract with the added ability
/// to manipulate the block time for testing purposes.
2017-06-26 17:54:28 +00:00
contract LiquidPledgingMock is LiquidPledging {
uint public mock_time;
2017-06-26 17:54:28 +00:00
2017-10-27 14:38:25 +00:00
/// @dev `LiquidPledgingMock` creates a standard `LiquidPledging`
/// instance and sets the mocked time to the current blocktime.
2018-02-12 22:55:11 +00:00
function initialize(address _vault, address _escapeHatchDestination) onlyInit public {
super.initialize(_vault, _escapeHatchDestination);
2017-06-26 17:54:28 +00:00
mock_time = now;
}
2017-10-27 14:38:25 +00:00
/// @dev `getTime` is a basic getter function for
/// the mock_time parameter
2018-02-12 22:55:11 +00:00
function _getTime() internal view returns (uint) {
2017-06-26 17:54:28 +00:00
return mock_time;
}
2017-10-27 14:38:25 +00:00
/// @dev `setMockedTime` is a basic setter function for
/// the mock_time parameter
/// @param _t This is the value to which the mocked time
/// will be set.
function setMockedTime(uint _t) public {
2017-06-26 17:54:28 +00:00
mock_time = _t;
}
}