/
MockExchanger.sol
59 lines (44 loc) · 1.63 KB
/
MockExchanger.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
pragma solidity 0.4.25;
import "../interfaces/ISynthetix.sol";
contract MockExchanger {
uint256 private _mockReclaimAmount;
uint256 private _mockRefundAmount;
uint256 private _mockNumEntries;
uint256 private _mockMaxSecsLeft;
ISynthetix synthetix;
constructor(ISynthetix _synthetix) public {
synthetix = _synthetix;
}
// Mock settle function
function settle(address from, bytes32 currencyKey)
external
returns (uint256 reclaimed, uint256 refunded, uint numEntriesSettled)
{
if (_mockReclaimAmount > 0) {
synthetix.synths(currencyKey).burn(from, _mockReclaimAmount);
}
if (_mockRefundAmount > 0) {
synthetix.synths(currencyKey).issue(from, _mockRefundAmount);
}
_mockMaxSecsLeft = 0;
return (_mockReclaimAmount, _mockRefundAmount, _mockNumEntries);
}
function maxSecsLeftInWaitingPeriod(address account, bytes32 currencyKey) public view returns (uint) {
return _mockMaxSecsLeft;
}
function settlementOwing(address account, bytes32 currencyKey) public view returns (uint, uint, uint) {
return (_mockReclaimAmount, _mockRefundAmount, _mockNumEntries);
}
function setReclaim(uint256 _reclaimAmount) external {
_mockReclaimAmount = _reclaimAmount;
}
function setRefund(uint256 _refundAmount) external {
_mockRefundAmount = _refundAmount;
}
function setNumEntries(uint256 _numEntries) external {
_mockNumEntries = _numEntries;
}
function setMaxSecsLeft(uint _maxSecsLeft) external {
_mockMaxSecsLeft = _maxSecsLeft;
}
}