-
Notifications
You must be signed in to change notification settings - Fork 604
/
Copy pathIRewardEscrowV2.sol
140 lines (99 loc) · 4.63 KB
/
IRewardEscrowV2.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
pragma solidity >=0.4.24;
pragma experimental ABIEncoderV2;
import "../RewardEscrowV2Frozen/IRewardEscrowV2Frozen.sol";
interface IRewardEscrowV2Storage {
/// Views
function numVestingEntries(address account) external view returns (uint);
function totalEscrowedAccountBalance(address account) external view returns (uint);
function totalVestedAccountBalance(address account) external view returns (uint);
function totalEscrowedBalance() external view returns (uint);
function nextEntryId() external view returns (uint);
function vestingSchedules(address account, uint256 entryId) external view returns (VestingEntries.VestingEntry memory);
function accountVestingEntryIDs(address account, uint256 index) external view returns (uint);
/// Mutative
function setZeroAmount(address account, uint entryId) external;
function setZeroAmountUntilTarget(
address account,
uint startIndex,
uint targetAmount
)
external
returns (
uint total,
uint endIndex,
uint lastEntryTime
);
function updateEscrowAccountBalance(address account, int delta) external;
function updateVestedAccountBalance(address account, int delta) external;
function updateTotalEscrowedBalance(int delta) external;
function addVestingEntry(address account, VestingEntries.VestingEntry calldata entry) external returns (uint);
// setFallbackRewardEscrow is used for configuration but not used by contracts
}
/// this should remain backwards compatible to IRewardEscrowV2Frozen
/// ideally this would be done by inheriting from that interface
/// but solidity v0.5 doesn't support interface inheritance
interface IRewardEscrowV2 {
// Views
function balanceOf(address account) external view returns (uint);
function numVestingEntries(address account) external view returns (uint);
function totalEscrowedBalance() external view returns (uint);
function totalEscrowedAccountBalance(address account) external view returns (uint);
function totalVestedAccountBalance(address account) external view returns (uint);
function getVestingQuantity(address account, uint256[] calldata entryIDs) external view returns (uint);
function getVestingSchedules(
address account,
uint256 index,
uint256 pageSize
) external view returns (VestingEntries.VestingEntryWithID[] memory);
function getAccountVestingEntryIDs(
address account,
uint256 index,
uint256 pageSize
) external view returns (uint256[] memory);
function getVestingEntryClaimable(address account, uint256 entryID) external view returns (uint);
function getVestingEntry(address account, uint256 entryID) external view returns (uint64, uint256);
// Mutative functions
function vest(uint256[] calldata entryIDs) external;
function createEscrowEntry(
address beneficiary,
uint256 deposit,
uint256 duration
) external;
function appendVestingEntry(
address account,
uint256 quantity,
uint256 duration
) external;
function migrateVestingSchedule(address _addressToMigrate) external;
function migrateAccountEscrowBalances(
address[] calldata accounts,
uint256[] calldata escrowBalances,
uint256[] calldata vestedBalances
) external;
// Account Merging
function startMergingWindow() external;
function mergeAccount(address accountToMerge, uint256[] calldata entryIDs) external;
function nominateAccountToMerge(address account) external;
function accountMergingIsOpen() external view returns (bool);
// L2 Migration
function importVestingEntries(
address account,
uint256 escrowedAmount,
VestingEntries.VestingEntry[] calldata vestingEntries
) external;
// Return amount of SNX transfered to SynthetixBridgeToOptimism deposit contract
function burnForMigration(address account, uint256[] calldata entryIDs)
external
returns (uint256 escrowedAccountBalance, VestingEntries.VestingEntry[] memory vestingEntries);
function nextEntryId() external view returns (uint);
function vestingSchedules(address account, uint256 entryId) external view returns (VestingEntries.VestingEntry memory);
function accountVestingEntryIDs(address account, uint256 index) external view returns (uint);
/// below are methods not available in IRewardEscrowV2Frozen
// revoke entries for liquidations (access controlled to Synthetix)
function revokeFrom(
address account,
address recipient,
uint targetAmount,
uint startIndex
) external;
}