stBTC
This contract implements the ERC-4626 tokenized vault standard. By staking tBTC, users acquire a liquid staking token called stBTC, commonly referred to as "shares". Users have the flexibility to redeem stBTC, enabling them to withdraw their deposited tBTC along with the accrued yield.
ERC-4626 is a standard to optimize and unify the technical parameters of yield-bearing vaults. This contract facilitates the minting and burning of shares (stBTC), which are represented as standard ERC20 tokens, providing a seamless exchange with tBTC tokens.
dispatcher
Dispatcher contract that routes tBTC from stBTC to a given allocation contract and back.
treasury
Address of the treasury wallet, where fees should be transferred to.
minimumDepositAmount
Minimum amount for a single deposit operation. The value should be set low enough so the deposits routed through Bitcoin Depositor contract won't be rejected. It means that minimumDepositAmount should be lower than tBTC protocol's depositDustThreshold reduced by all the minting fees taken before depositing in the Acre contract.
entryFeeBasisPoints
Entry fee basis points applied to entry fee calculation.
exitFeeBasisPoints
Exit fee basis points applied to exit fee calculation.
allowedDebt
Returns the maximum amount of the underlying asset for which the shares can be minted without the coverage in deposited assets.
currentDebt
Returns the current debt of the debtor.
totalDebt
Total amount of debt across all debtors.
This is the total amount of assets for which shares have been minted without the coverage in deposited assets. The value is used to adjust the total assets held by the vault.
TreasuryUpdated
Emitted when the treasury wallet address is updated.
Parameters
MinimumDepositAmountUpdated
Emitted when deposit parameters are updated.
Parameters
DispatcherUpdated
Emitted when the dispatcher contract is updated.
Parameters
EntryFeeBasisPointsUpdated
Emitted when the entry fee basis points are updated.
Parameters
ExitFeeBasisPointsUpdated
Emitted when the exit fee basis points are updated.
Parameters
DebtAllowanceUpdated
Emitted when the maximum debt allowance of the debtor is updated.
Parameters
DebtMinted
Emitted when debt is minted.
Parameters
DebtRepaid
Emitted when debt is repaid.
Parameters
LessThanMinDeposit
Reverts if the amount is less than the minimum deposit amount.
Parameters
DisallowedAddress
Reverts if the address is disallowed.
ExceedsMaxFeeBasisPoints
Reverts if the fee basis points exceed the maximum value.
SameTreasury
Reverts if the treasury address is the same.
SameDispatcher
Reverts if the dispatcher address is the same.
InsufficientDebtAllowance
Emitted when the debt allowance of a debtor is insufficient.
Used in the debt minting function.
Parameters
ExcessiveDebtRepayment
Emitted when the debt of the debtor is insufficient - the debtor tries to repay more than they borrowed.
Used in the debt repayment function.
Parameters
constructor
initialize
updateTreasury
Updates treasury wallet address.
Parameters
updateMinimumDepositAmount
Updates minimum deposit amount.
Parameters
updateDispatcher
Updates the dispatcher contract and gives it an unlimited allowance to transfer deposited tBTC.
Parameters
updateEntryFeeBasisPoints
Update the entry fee basis points.
Parameters
updateExitFeeBasisPoints
Update the exit fee basis points.
Parameters
approveAndCall
Calls receiveApproval
function on spender previously approving the spender to withdraw from the caller multiple times, up to the value
amount. If this function is called again, it overwrites the current allowance with value
. Reverts if the approval reverted or if receiveApproval
call on the spender reverted.
If the value
is set to type(uint256).max
then transferFrom
and burnFrom
will not reduce an allowance.
Parameters
Return Values
disableNonFungibleWithdrawals
Disables non-fungible withdrawals.
updateDebtAllowance
Sets the maximum debt allowance of the debtor.
The current debt value is intentionally not checked to allow the governance reduce the debt allowance in case the depositor becomes risky or malicious.
Parameters
mintDebt
Mints the requested amount of shares and registers a debt in asset corresponding to the minted amount of shares.
The debt is calculated based on the current conversion rate from the shares to assets.
Parameters
Return Values
mintReceipt
This function proxies mintDebt
call and provides compatibility with Mezo IReceiptToken interface.
repayDebt
Repay the asset debt, fully of partially with the provided shares.
The debt to be repaid is calculated based on the current conversion rate from the shares to assets. The debtor has to approve the transfer of the shares. To determine the asset debt that is going to be repaid, the caller can use the previewRepayDebt
function.
Parameters
Return Values
burnReceipt
This function proxies repayDebt
call and provides compatibility with Mezo IReceiptToken interface.
deposit
Mints shares to receiver by depositing exactly amount of tBTC tokens.
Takes into account a deposit parameter, minimum deposit amount, which determines the minimum amount for a single deposit operation. The amount of the assets has to be pre-approved in the tBTC contract.
Parameters
Return Values
mint
Mints shares to receiver by depositing tBTC tokens.
Takes into account a deposit parameter, minimum deposit amount, which determines the minimum amount for a single deposit operation. The amount of the assets has to be pre-approved in the tBTC contract. The msg.sender is required to grant approval for the transfer of a certain amount of tBTC, and in addition, approval for the associated fee. Specifically, the total amount to be approved (amountToApprove) should be equal to the sum of the deposited amount and the fee. To determine the total assets amount necessary for approval corresponding to a given share amount, use the previewMint
function.
Parameters
Return Values
withdraw
Withdraws assets from the vault and transfers them to the receiver.
Withdraw unallocated assets first and and if not enough, then pull the assets from the dispatcher.
Parameters
redeem
Redeems shares for assets and transfers them to the receiver.
Redeem unallocated assets first and and if not enough, then pull the assets from the dispatcher.
Parameters
totalAssets
Returns the total amount of assets held by the vault across all allocations and this contract.
The value contains virtual assets reflecting the debt minted by the debtors. The debt is not backed by the deposited assets, and it is used to adjust the total assets held by the vault, to allow shares and assets conversion calculations.
maxDeposit
Returns the maximum amount of the underlying asset that can be deposited into the Vault for the receiver, through a deposit call. If the Vault is paused, returns 0.
maxMint
Returns the maximum amount of the Vault shares that can be minted for the receiver, through a mint call. If the Vault is paused, returns 0.
maxWithdraw
Returns the maximum amount of the underlying asset that can be withdrawn from the owner balance in the Vault, through a withdraw call. If the Vault is paused, returns 0.
maxRedeem
Returns the maximum amount of Vault shares that can be redeemed from the owner balance in the Vault, through a redeem call. If the Vault is paused, returns 0.
assetsBalanceOf
Returns the number of assets that corresponds to the amount of shares held by the specified account.
This function is used to convert shares to assets position for the given account. It does not take fees into account.
Parameters
Return Values
previewRepayDebt
Previews the amount of assets that will be burned for the given amount of repaid shares.
_entryFeeBasisPoints
Return Values
_exitFeeBasisPoints
Return Values
_feeRecipient
Returns the address of the treasury wallet, where fees should be transferred to.
Last updated