-
Notifications
You must be signed in to change notification settings - Fork 43
/
Copy pathIBridgeValidator.sol
61 lines (53 loc) · 2.56 KB
/
IBridgeValidator.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
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.23;
/// @title Bridge Validator Interface
/// @dev Interface all Bridge Validators must follow
/// @author Zeropoint Labs
interface IBridgeValidator {
//////////////////////////////////////////////////////////////
// STRUCTS //
//////////////////////////////////////////////////////////////
struct ValidateTxDataArgs {
bytes txData;
uint64 srcChainId;
uint64 dstChainId;
uint64 liqDstChainId;
bool deposit;
address superform;
address receiverAddress;
address liqDataToken;
address liqDataInterimToken;
}
//////////////////////////////////////////////////////////////
// EXTERNAL VIEW FUNCTIONS //
//////////////////////////////////////////////////////////////
/// @dev validates the receiver of the liquidity request
/// @param txData_ is the txData of the cross chain deposit
/// @param receiver_ is the address of the receiver to validate
/// @return valid_ if the address is valid
function validateReceiver(bytes calldata txData_, address receiver_) external view returns (bool valid_);
/// @dev validates the txData of a cross chain deposit
/// @param args_ the txData arguments to validate in txData
/// @return hasDstSwap if the txData contains a destination swap
function validateTxData(ValidateTxDataArgs calldata args_) external view returns (bool hasDstSwap);
/// @dev decodes the txData and returns the amount of input token on source
/// @param txData_ is the txData of the cross chain deposit
/// @param genericSwapDisallowed_ true if generic swaps are disallowed
/// @return amount_ the amount expected
function decodeAmountIn(
bytes calldata txData_,
bool genericSwapDisallowed_
)
external
view
returns (uint256 amount_);
/// @dev decodes neccesary information for processing swaps on the destination chain
/// @param txData_ is the txData to be decoded
/// @return token_ is the address of the token
/// @return amount_ the amount expected
function decodeDstSwap(bytes calldata txData_) external pure returns (address token_, uint256 amount_);
/// @dev decodes the final output token address (for only direct chain actions!)
/// @param txData_ is the txData to be decoded
/// @return token_ the address of the token
function decodeSwapOutputToken(bytes calldata txData_) external pure returns (address token_);
}