generated from Mens-Ludos/solidity-template-v2
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: cl keeper registration implementation, link obtain using uni v3
- Loading branch information
1 parent
cd7b643
commit dfbf574
Showing
6 changed files
with
201 additions
and
8 deletions.
There are no files selected for viewing
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
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,29 @@ | ||
// SPDX-License-Identifier: MIT | ||
|
||
pragma solidity ^0.8.0; | ||
|
||
interface IUniswapRouterV3 { | ||
struct ExactInputParams { | ||
bytes path; | ||
address recipient; | ||
uint256 deadline; | ||
uint256 amountIn; | ||
uint256 amountOutMinimum; | ||
} | ||
|
||
struct ExactOutputParams { | ||
bytes path; | ||
address recipient; | ||
uint256 deadline; | ||
uint256 amountOut; | ||
uint256 amountInMaximum; | ||
} | ||
|
||
function exactInput( | ||
ExactInputParams calldata params | ||
) external payable returns (uint256 amountOut); | ||
|
||
function exactOutput( | ||
ExactOutputParams calldata params | ||
) external payable returns (uint256 amountIn); | ||
} |
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,9 @@ | ||
// SPDX-License-Identifier: MIT | ||
|
||
pragma solidity ^0.8.0; | ||
|
||
interface IWETH { | ||
function deposit() external payable; | ||
|
||
function withdraw(uint wad) external; | ||
} |
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,40 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.0; | ||
import "../interfaces/IUniswapRouterV3.sol"; | ||
Check warning on line 3 in contracts/libraries/UniswapV3Actions.sol
|
||
|
||
library UniswapV3Actions { | ||
function swap( | ||
address _router, | ||
bytes memory _path, | ||
address _recipient, | ||
uint256 _amount | ||
) internal returns (uint256 amountOut) { | ||
IUniswapRouterV3.ExactInputParams memory swapParams = IUniswapRouterV3 | ||
.ExactInputParams({ | ||
path: _path, | ||
recipient: _recipient, | ||
deadline: block.timestamp, | ||
amountIn: _amount, | ||
amountOutMinimum: 0 | ||
}); | ||
return IUniswapRouterV3(_router).exactInput(swapParams); | ||
} | ||
|
||
function swapExactOutput( | ||
address _router, | ||
bytes memory _path, | ||
address _recipient, | ||
uint256 _amountOut, | ||
uint256 _amountInMaximum | ||
) internal returns (uint256 amountIn) { | ||
IUniswapRouterV3.ExactOutputParams memory swapParams = IUniswapRouterV3 | ||
.ExactOutputParams({ | ||
path: _path, | ||
recipient: _recipient, | ||
deadline: block.timestamp, | ||
amountOut: _amountOut, | ||
amountInMaximum: _amountInMaximum | ||
}); | ||
return IUniswapRouterV3(_router).exactOutput(swapParams); | ||
} | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.