This repository has been archived by the owner on Jul 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 198
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #121 from 1inch/aggregation-protocol-V6-routers
[SC-779] Update docs for routers in AggregationRouterV6
- Loading branch information
Showing
14 changed files
with
1,883 additions
and
441 deletions.
There are no files selected for viewing
108 changes: 0 additions & 108 deletions
108
docs/aggregation-protocol/smart-contract/AggregationRouterV5.md
This file was deleted.
Oops, something went wrong.
84 changes: 84 additions & 0 deletions
84
docs/aggregation-protocol/smart-contract/AggregationRouterV6.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
# AggregationRouterV6 | ||
|
||
|
||
|
||
|
||
|
||
|
||
## Derives | ||
- [GenericRouter](GenericRouter.md) | ||
- [ClipperRouter](ClipperRouter.md) | ||
- [UnoswapRouter](UnoswapRouter.md) | ||
- [LimitOrderProtocol](LimitOrderProtocol.md) | ||
- [IUniswapV3SwapCallback](interfaces/IUniswapV3SwapCallback.md) | ||
- [EIP712](https://docs.openzeppelin.com/contracts/3.x/api/drafts#EIP712) | ||
- [EthReceiver](helpers/EthReceiver.md) | ||
- [Ownable](https://docs.openzeppelin.com/contracts/3.x/api/access#Ownable) | ||
- [OnlyWethReceiver](helpers/OnlyWethReceiver.md) | ||
- [PredicateHelper](helpers/PredicateHelper.md) | ||
- [SeriesEpochManager](helpers/SeriesEpochManager.md) | ||
|
||
## Functions | ||
### constructor | ||
```solidity | ||
function constructor( | ||
contract IWETH weth | ||
) | ||
``` | ||
|
||
|
||
#### Parameters: | ||
| Name | Type | Description | | ||
| :--- | :--- | :------------------------------------------------------------------- | | ||
|`weth` | contract IWETH | | ||
|
||
|
||
### rescueFunds | ||
```solidity | ||
function rescueFunds( | ||
contract IERC20 token, | ||
uint256 amount | ||
) external | ||
``` | ||
Retrieves funds accidently sent directly to the contract address. | ||
|
||
|
||
#### Parameters: | ||
| Name | Type | Description | | ||
| :--- | :--- | :------------------------------------------------------------------- | | ||
|`token` | contract IERC20 | ERC20 token to retrieve | ||
|`amount` | uint256 | amount to retrieve | ||
|
||
|
||
### destroy | ||
```solidity | ||
function destroy( | ||
) external | ||
``` | ||
Destroys the contract and sends eth to sender. Use with caution. The only case when the use of the method is justified is if there is an exploit found. And the damage from the exploit is greater than from just an urgent contract change. | ||
|
||
|
||
|
||
## Events | ||
### Swapped | ||
```solidity | ||
event Swapped( | ||
address sender, | ||
contract IERC20 srcToken, | ||
contract IERC20 dstToken, | ||
address dstReceiver, | ||
uint256 spentAmount, | ||
uint256 returnAmount | ||
) | ||
``` | ||
|
||
|
||
#### Parameters: | ||
| Name | Type | Description | | ||
| :--- | :--- | :------------------------------------------------------------------- | | ||
|`sender` | address | | ||
|`srcToken` | contract IERC20 | | ||
|`dstToken` | contract IERC20 | | ||
|`dstReceiver` | address | | ||
|`spentAmount` | uint256 | | ||
|`returnAmount` | uint256 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# GenericRouter | ||
|
||
|
||
Router that allows to use `IAggregationExecutor` for swaps | ||
|
||
|
||
|
||
## Derives | ||
- [EthReceiver](helpers/EthReceiver.md) | ||
|
||
## Functions | ||
### swap | ||
```solidity | ||
function swap( | ||
contract IAggregationExecutor executor, | ||
contract SwapDescription calldata desc, | ||
bytes calldata permit, | ||
bytes calldata data | ||
) external payable returns (uint256 returnAmount, uint256 spentAmount) | ||
``` | ||
Performs a swap, delegating all calls encoded in `data` to `executor`. See tests for usage examples | ||
|
||
|
||
#### Parameters: | ||
| Name | Type | Description | | ||
| :--- | :--- | :------------------------------------------------------------------- | | ||
|`executor` | contract IAggregationExecutore | Aggregation executor that executes calls described in `data` | ||
|`desc` | contract SwapDescription | Swap description | ||
|`permit` | bytes | Should contain valid permit that can be used in `IERC20Permit.permit` calls | ||
|`data` | bytes | Encoded calls that `caller` should execute in between of swaps | ||
|
||
|
||
#### Return values | ||
| Name | Type | Description | | ||
| :--- | :--- | :------------------------------------------------------------------- | | ||
|`returnAmount` | uint256 | Resulting token amount | ||
|`spentAmount` | uint256 | Source token amount |
Oops, something went wrong.