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. |