-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathIBranchRouter.sol
126 lines (109 loc) · 5.05 KB
/
IBranchRouter.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
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {
Deposit,
DepositInput,
DepositMultipleInput,
SettlementParams,
SettlementMultipleParams
} from "./IBranchBridgeAgent.sol";
/**
* @title BaseBranchRouter Contract
* @author MaiaDAO
* @notice Base Branch Contract for interfacing with Branch Bridge Agents.
* This contract for deployment in Branch Chains of the Ulysses Omnichain System,
* additional logic can be implemented to perform actions before sending cross-chain
* requests, as well as in response to requests from the Root Omnichain Environment.
*/
interface IBranchRouter {
/*///////////////////////////////////////////////////////////////
VIEW / STATE
//////////////////////////////////////////////////////////////*/
/// @notice Address for local Branch Bridge Agent who processes requests and ineracts with local port.
function localBridgeAgentAddress() external view returns (address);
/// @notice Local Bridge Agent Executor Address.
function bridgeAgentExecutorAddress() external view returns (address);
/*///////////////////////////////////////////////////////////////
EXTERNAL FUNCTIONS
//////////////////////////////////////////////////////////////*/
/**
* @notice Function to perform a call to the Root Omnichain Router without token deposit.
* @param params RLP enconded parameters to execute on the root chain.
* @param rootExecutionGas gas allocated for remote execution.
* @dev ACTION ID: 1 (Call without deposit)
*
*/
function callOut(bytes calldata params, uint128 rootExecutionGas) external payable;
/**
* @notice Function to perform a call to the Root Omnichain Router while depositing a single asset.
* @param params RLP enconded parameters to execute on the root chain.
* @param dParams additional token deposit parameters.
* @param rootExecutionGas gas allocated for remote execution.
* @dev ACTION ID: 2 (Call with single deposit)
*
*/
function callOutAndBridge(bytes calldata params, DepositInput memory dParams, uint128 rootExecutionGas)
external
payable;
/**
* @notice Function to perform a call to the Root Omnichain Router while depositing two or more assets.
* @param params RLP enconded parameters to execute on the root chain.
* @param dParams additional token deposit parameters.
* @param rootExecutionGas gas allocated for remote execution.
* @dev ACTION ID: 3 (Call with multiple deposit)
*
*/
function callOutAndBridgeMultiple(
bytes calldata params,
DepositMultipleInput memory dParams,
uint128 rootExecutionGas
) external payable;
/**
* @notice External function to retry a failed Settlement entry on the root chain.
* @param _settlementNonce Identifier for user settlement.
* @param _gasToBoostSettlement Additional gas to boost settlement.
*
*/
function retrySettlement(uint32 _settlementNonce, uint128 _gasToBoostSettlement) external payable;
/**
* @notice External function to retry a failed Deposit entry on this branch chain.
* @param _depositNonce Identifier for user deposit.
*
*/
function redeemDeposit(uint32 _depositNonce) external;
/**
* @notice External function that returns a given deposit entry.
* @param _depositNonce Identifier for user deposit.
*
*/
function getDepositEntry(uint32 _depositNonce) external view returns (Deposit memory);
/*///////////////////////////////////////////////////////////////
ANYCALL EXTERNAL FUNCTIONS
//////////////////////////////////////////////////////////////*/
/**
* @notice Function responsible of executing a branch router response.
* @param data data received from messaging layer.
*/
function anyExecuteNoSettlement(bytes calldata data) external returns (bool success, bytes memory result);
/**
* @dev Function responsible of executing a crosschain request without any deposit.
* @param data data received from messaging layer.
* @param sParams SettlementParams struct.
*/
function anyExecuteSettlement(bytes calldata data, SettlementParams memory sParams)
external
returns (bool success, bytes memory result);
/**
* @dev Function responsible of executing a crosschain request which contains cross-chain deposit information attached.
* @param data data received from messaging layer.
* @param sParams SettlementParams struct containing deposit information.
*
*/
function anyExecuteSettlementMultiple(bytes calldata data, SettlementMultipleParams memory sParams)
external
returns (bool success, bytes memory result);
/*///////////////////////////////////////////////////////////////
ERRORS
//////////////////////////////////////////////////////////////*/
error UnrecognizedBridgeAgentExecutor();
}