BitcoinRedeemer

This contract facilitates redemption of stBTC tokens to Bitcoin through tBTC redemption process.

tbtcToken

contract ITBTCToken tbtcToken

Interface for tBTC token contract.

stbtc

contract stBTC stbtc

stBTC token contract.

tbtcVault

address tbtcVault

Address of the TBTCVault contract.

TbtcVaultUpdated

event TbtcVaultUpdated(address oldTbtcVault, address newTbtcVault)

Emitted when the TBTCVault contract address is updated.

Parameters

RedemptionRequested

event RedemptionRequested(address owner, uint256 shares, uint256 tbtcAmount)

Emitted when redemption is requested.

Parameters

TbtcTokenZeroAddress

error TbtcTokenZeroAddress()

Reverts if the tBTC Token address is zero.

StbtcZeroAddress

error StbtcZeroAddress()

Reverts if the stBTC address is zero.

TbtcVaultZeroAddress

error TbtcVaultZeroAddress()

Reverts if the TBTCVault address is zero.

CallerNotAllowed

error CallerNotAllowed(address caller)

Attempted to call receiveApproval by supported token.

EmptyExtraData

error EmptyExtraData()

Attempted to call receiveApproval with empty data.

UnexpectedTbtcTokenOwner

error UnexpectedTbtcTokenOwner()

Attempted to call _redeemSharesAndUnmint with unexpected tBTC token owner.

RedeemerNotOwner

error RedeemerNotOwner(address redeemer, address owner)

Reverts if the redeemer is not the deposit owner.

ApproveAndCallFailed

error ApproveAndCallFailed()

Reverts when approveAndCall to tBTC contract fails.

NotTbtcTokenOwner

error NotTbtcTokenOwner()

Reverts if the new TBTCVault contract is not tBTC token owner.

constructor

constructor() public

initialize

function initialize(address _tbtcToken, address _stbtc, address _tbtcVault) public

Initializes the contract with tBTC token and stBTC token addresses.

Parameters

receiveApproval

function receiveApproval(address from, uint256 amount, address, bytes extraData) external

Redeems shares for tBTC and requests bridging to Bitcoin.

Parameters

updateTbtcVault

function updateTbtcVault(address newTbtcVault) external

Updates TBTCVault contract address.

Parameters

_redeemSharesAndUnmint

function _redeemSharesAndUnmint(address owner, uint256 shares, bytes tbtcRedemptionData) internal

Initiates the redemption process by exchanging stBTC tokens for tBTC tokens and requesting bridging to Bitcoin.

Redeems stBTC shares to receive tBTC and requests redemption of tBTC to Bitcoin via tBTC Bridge. Redemption data in a format expected from redemptionData parameter of Bridge's receiveBalanceApproval. It uses tBTC token owner which is the TBTCVault contract as spender of tBTC requested for redemption. tBTC Bridge redemption process has a path where request can timeout. It is a scenario that is unlikely to happen with the current Bridge setup. This contract remains upgradable to have flexibility to handle adjustments to tBTC Bridge changes. Redemption data should include a redeemer address matching the address of the deposit owner who is redeeming the shares. In case anything goes wrong during the tBTC unminting process, the redeemer will be able to claim the tBTC tokens back from the tBTC Bank contract.

Parameters

Last updated