BitcoinRedeemer
This contract facilitates redemption of stBTC tokens to Bitcoin through tBTC redemption process.
tbtcToken
Interface for tBTC token contract.
stbtc
stBTC token contract.
tbtcVault
Address of the TBTCVault contract.
TbtcVaultUpdated
Emitted when the TBTCVault contract address is updated.
Parameters
oldTbtcVault
address
Address of the old TBTCVault contract.
newTbtcVault
address
Address of the new TBTCVault contract.
RedemptionRequested
Emitted when redemption is requested.
Parameters
owner
address
Owner of stBTC tokens.
shares
uint256
Number of stBTC tokens.
tbtcAmount
uint256
Number of tBTC tokens.
TbtcTokenZeroAddress
Reverts if the tBTC Token address is zero.
StbtcZeroAddress
Reverts if the stBTC address is zero.
TbtcVaultZeroAddress
Reverts if the TBTCVault address is zero.
CallerNotAllowed
Attempted to call receiveApproval by supported token.
EmptyExtraData
Attempted to call receiveApproval with empty data.
UnexpectedTbtcTokenOwner
Attempted to call _redeemSharesAndUnmint with unexpected tBTC token owner.
RedeemerNotOwner
Reverts if the redeemer is not the deposit owner.
ApproveAndCallFailed
Reverts when approveAndCall to tBTC contract fails.
NotTbtcTokenOwner
Reverts if the new TBTCVault contract is not tBTC token owner.
constructor
initialize
Initializes the contract with tBTC token and stBTC token addresses.
Parameters
_tbtcToken
address
The address of the tBTC token contract.
_stbtc
address
The address of the stBTC token contract.
_tbtcVault
address
The address of the TBTCVault contract.
receiveApproval
Redeems shares for tBTC and requests bridging to Bitcoin.
Parameters
from
address
Shares token holder executing redemption.
amount
uint256
Amount of shares to redeem.
address
extraData
bytes
Redemption data in a format expected from redemptionData
parameter of Bridge's receiveBalanceApproval
function.
updateTbtcVault
Updates TBTCVault contract address.
Parameters
newTbtcVault
address
New TBTCVault contract address.
_redeemSharesAndUnmint
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
owner
address
The owner of the stBTC tokens.
shares
uint256
The number of stBTC tokens to redeem.
tbtcRedemptionData
bytes
Additional data required for the tBTC redemption. See redemptionData
parameter description of Bridge.requestRedemption
function.
Last updated