BTC->ETH->WBTC Aggregator Implementation
GitHub Repo
The TSAggregatorCornSiloEth implementation is available on the following repo.
Overview
- Inherits:
TSAggregator
- Swaps received ETH for WBTC and deposits into CornSilo on the user's behalf, using the UniswapV3 router.
- No parallel functionality for swapping into the Thorchain network.
State Variables
address public immutable weth
address public immutable wbtc
ISwapRouter public immutable swapRouter
ICornSilo public immutable cornSilo
uint24 public constant feeTier = 3000
Functions
constructor
Initializes the contract with required addresses.
constructor(address _ttp, address _weth, address _wbtc, address _swapRouter, address _cornSilo) TSAggregator(_ttp);
Parameters
Name | Type | Description |
---|---|---|
_ttp | address | Address of the Token Transfer Proxy. |
_weth | address | Address of the Wrapped Ethereum token. |
_wbtc | address | Address of the Wrapped Bitcoin token. |
_swapRouter | address | Address of the Uniswap V3 Swap Router. |
_cornSilo | address | Address of the CornSilo contract. |
swapOut
Swaps received ETH for WBTC and deposits it into CornSilo.
function swapOut(address token, address to, uint256 amountOutMin) public payable nonReentrant;
Parameters
Name | Type | Description |
---|---|---|
token | address | The token address to swap from (must be WBTC). |
to | address | The recipient address of the swap (via Thorchain MEMO). |
amountOutMin | uint256 | The minimum amount of WBTC to receive. |