-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathICrossLedgerLink.sol
178 lines (168 loc) · 5.44 KB
/
ICrossLedgerLink.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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
pragma solidity ^0.5.0;
interface ICrossLedgerLink {
enum CrossLedgerTransferStatus {
NonEstablished,
Ordered,
Accepted,
Revoked,
Acknowledged,
TransferInExecuted,
TransferOutExecuted
}
enum CrossLedgerTransferType {
TransferIn,
TransferOut
}
/**
* @notice Initiates the cross ledger value transfer process.
*
* Amount is held.
*
* @param _operationId The user operation id.
* @param _amount amount that will be transferred from the origin
* account.
* @param _to The address in the destination chain where the same currency
* tokens will be minted.
* @param _currency ISO currency code
* @param _chainId destination chain id
*
* @return messageHash Message hash is unique for each request.
*/
function orderTransfer(
string calldata _operationId,
uint256 _amount,
address _to,
string calldata _currency,
uint256 _chainId
)
external
returns (bytes32 messageHash);
/**
* @notice Returns is a given address has cross ledger operator rights.
*
* @param _operator The address of the operator
*
* @return bool
*/
function isCrossLedgerOperator(address _operator)
external
view
returns (bool);
/**
* @notice Returns if a given chain id of blockchain network is activated and can therefore be used
* in orderTransfer as parameter.
*
* @param _chainId The numeric identifier of the blockchain
*
* @return bool
*/
function isChainActive(uint256 _chainId)
external
view
returns (bool);
/**
* @notice Returns if a given currency is activated for a given blockchain network and can therefore be used
* in orderTransfer as parameter.
*
* @param _currency The 3 character currency code specified in ISO 4217
* @param _chainId The numeric identifier of the blockchain
*
* @return bool
*/
function isCurrencyActiveForChain(string calldata _currency, uint256 _chainId)
external
view
returns (bool);
/**
* @notice Returns all the data of a specific cross ledger value transfer.
*
* @param _operationId The transfer operation id.
*
* @return amount amount that will be transferred
* @return from The address in the origin chain where the same currency
* tokens will be burned.
* @return to The address in the destination chain where the same currency
* tokens will be minted.
* @return currency ISO 4217 currency code
* @return originChainId id of the origin chain
* @return destinationChainId id of the destination chain
* @return hashLock The execution hashLock
* @return status The current status of the transfer
* @return crossLedgerTransferType The type can either be an ingoing or an outgoing transfer
* @return reason The numeric value of the non acceptance reason set when a transfer is revoked, zero otherwise
*/
function getTransferData(string calldata _operationId)
external
view
returns (
uint256 amount,
address from,
address to,
string memory currency,
uint256 originChainId,
uint256 destinationChainId,
bytes32 hashLock,
CrossLedgerTransferStatus status,
CrossLedgerTransferType crossLedgerTransferType,
uint8 reason
);
event CrossLedgerTransferOrdered(
string operationId,
address indexed from,
address indexed to,
uint256 value,
uint256 originChainId,
uint256 destinationChainId,
string currency,
address initiator,
bytes32 indexed messageHash
);
event CrossLedgerTransferAccepted(
string operationId,
address indexed from,
address indexed to,
uint256 value,
uint256 originChainId,
uint256 destinationChainId,
string currency,
address acceptingOperator,
bytes32 parentMessageHash,
bytes32 indexed messageHash
);
event CrossLedgerTransferRevoked(
string operationId,
address revokeOperator,
bytes32 parentMessageHash,
bytes32 indexed messageHash,
uint8 reason
);
event CrossLedgerTransferAcknowledged(
string operationId,
address indexed from,
address indexed to,
uint256 originChainId,
uint256 destinationChainId,
address acknowledgeOperator,
bytes32 parentMessageHash,
bytes32 indexed messageHash,
bytes32 hashLock
);
event CrossLedgerTransferInExecuted(
string operationId,
bytes32 parentMessageHash,
bytes32 indexed messageHash,
address transferInOperator,
bytes32 unlockSecret
);
event CrossLedgerTransferOutExecuted(
string operationId,
bytes32 parentMessageHash,
bytes32 indexed messageHash,
address transferOutOperator,
bytes32 unlockSecret
);
event CrossLedgerChainActivated(uint256 indexed chainId, address indexed account);
event CrossLedgerChainDeactivated(uint256 indexed chainId, address indexed account);
event CrossLedgerCurrencyActivated(string currency, uint256 indexed chainId, address indexed account);
event CrossLedgerCurrencyDeactivated(string currency, uint256 indexed chainId, address indexed account);
}