|
1 | | -# Eco Facet |
| 1 | +# EcoFacet |
2 | 2 |
|
3 | 3 | ## How it works |
4 | 4 |
|
5 | | -The Eco Facet works by ... |
| 5 | +The EcoFacet enables cross-chain bridging through the Eco protocol. It allows users to bridge tokens across chains with optional destination chain calls, supporting both immediate execution and deferred proving mechanisms. |
6 | 6 |
|
7 | 7 | ```mermaid |
8 | 8 | graph LR; |
9 | 9 | D{LiFiDiamond}-- DELEGATECALL -->EcoFacet; |
10 | | - EcoFacet -- CALL --> C(Eco) |
| 10 | + EcoFacet -- CALL --> C(Eco Portal) |
11 | 11 | ``` |
12 | 12 |
|
13 | 13 | ## Public Methods |
14 | 14 |
|
15 | 15 | - `function startBridgeTokensViaEco(BridgeData calldata _bridgeData, EcoData calldata _ecoData)` |
16 | | - - Simply bridges tokens using eco |
17 | | -- `swapAndStartBridgeTokensViaEco(BridgeData memory _bridgeData, LibSwap.SwapData[] calldata _swapData, ecoData memory _ecoData)` |
18 | | - - Performs swap(s) before bridging tokens using eco |
| 16 | + - Simply bridges tokens using Eco |
| 17 | +- `function swapAndStartBridgeTokensViaEco(BridgeData memory _bridgeData, LibSwap.SwapData[] calldata _swapData, EcoData calldata _ecoData)` |
| 18 | + - Performs swap(s) before bridging tokens using Eco |
19 | 19 |
|
20 | | -## eco Specific Parameters |
| 20 | +## Eco Specific Parameters |
21 | 21 |
|
22 | | -The methods listed above take a variable labeled `_ecoData`. This data is specific to eco and is represented as the following struct type: |
| 22 | +The methods listed above take a variable labeled `_ecoData`. This data is specific to Eco and is represented as the following struct type: |
23 | 23 |
|
24 | 24 | ```solidity |
25 | | -/// @param example Example parameter. |
26 | | -struct ecoData { |
27 | | - string example; |
| 25 | +/// @param portal The address of the portal contract on the source chain |
| 26 | +/// @param destinationPortal The address of the portal contract on the destination chain |
| 27 | +/// @param prover The address authorized to prove the route execution |
| 28 | +/// @param routeDeadline The deadline for route execution (timestamp) |
| 29 | +/// @param rewardDeadline The deadline for claiming rewards (timestamp) |
| 30 | +/// @param salt Unique identifier for the route |
| 31 | +/// @param calls Array of calls to be executed on the destination chain |
| 32 | +/// @param allowPartial Whether partial execution is allowed |
| 33 | +struct EcoData { |
| 34 | + address portal; |
| 35 | + address destinationPortal; |
| 36 | + address prover; |
| 37 | + uint64 routeDeadline; |
| 38 | + uint64 rewardDeadline; |
| 39 | + bytes32 salt; |
| 40 | + IEco.Call[] calls; |
| 41 | + bool allowPartial; |
| 42 | +} |
| 43 | +``` |
| 44 | + |
| 45 | +The `IEco.Call` struct is defined as: |
| 46 | + |
| 47 | +```solidity |
| 48 | +/// @param target The contract address to call on destination chain |
| 49 | +/// @param data The calldata to send to the target contract |
| 50 | +/// @param value The amount of native token to send with the call |
| 51 | +struct Call { |
| 52 | + address target; |
| 53 | + bytes data; |
| 54 | + uint256 value; |
28 | 55 | } |
29 | 56 | ``` |
30 | 57 |
|
|
0 commit comments