Skip to main content

BTC -> WBTC Aggregator Implementation

GitHub Repo

The TSAggregatorCornSiloWbtc implementation is available on the following repo.

Overview

  • Inherits: TSAggregator
  • Deposits received WBTC into the CornSilo on the user's behalf with no swap required.
  • No parallel functionality for swapping into the Thorchain network.

State Variables

  • IERC20 public immutable wbtc
  • ICornSilo public immutable cornSilo

Functions

constructor

Initializes the contract by setting up WBTC and CornSilo addresses and linking to the TSAggregator.

constructor(address _ttp, address _wBTC, address _cornSilo) TSAggregator(_ttp);

Parameters

NameTypeDescription
_ttpaddressAddress of the Token Transfer Proxy.
_wBTCaddressAddress of the WBTC token contract.
_cornSiloaddressAddress of the CornSilo contract.

swapOut

Swaps BTC to WBTC and deposits atomically into CornSilo.

function swapOut(address token, address to, uint256 amountOutMin) public nonReentrant;

Parameters

NameTypeDescription
tokenaddressThe token address to swap from (must be WBTC).
toaddressThe recipient address of the WBTC.
amountOutMinuint256The minimum amount of WBTC to swap for.