Bridge
Last updated
Last updated
Serves as a facilitator of deposits and withdrawals between Bitcoin and Citrea. It verifies Bitcoin transactions for deposits and manages withdrawal requests to be processed on the Bitcoin network.
You can find the contract in the address 0x31000...0002
, here.
The following is an explanation regarding the TransactionParams
structure, which is used to represent deposits made to Citrea from the Bitcoin network using Clementine.
Parameters | Description |
---|---|
To understand more, please check the way deposit params are used along with the BitcoinLightClient
contract from both our documentation and explorer.
A flag indicating whether the contract has been initialized.
The address of the privileged operator who can process user deposits.
A list of values indicating if a operator is marked as malicious.
The fixed amount for deposits and withdrawals, set to 10 ether (cBTC) for Citrea Testnet.
Index of the latest processed deposit.
The prefix part of deposit script for all L1 (Bitcoin) deposits.
The suffix part of the deposit script that follows the receiver address.
Script that is used for "slash or take" transactions on Bitcoin. These transactions are sent after an operator proves that they covered a withdrawal through declareWithdrawFiller
and it is used as a part of the process that enables the operator to get back the amount they covered from N-of-N multisig on Bitcoin.
An array to store ANYONE_CAN_PAY
UTXOs on Bitcoin that are utilized as withdraw intents that are covered by operators later on. This stored UTXO information is used to prove that an operator covered a certain withdrawal through declareWithdrawFiller
.
A mapping that maps the transaction IDs of deposit transactions on Bitcoin to their deposit IDs on Citrea side.
A mapping that maps the withdraw ID to operator ID that covered the withdrawal with that withdraw ID.
Ensures that only the system caller (0xdeaDDeADDEaDdeaDdEAddEADDEAdDeadDEADDEaD
) can call the function.
Ensures that only the designated operator can call the function.
Ensures that only the contract owner can call the function (inherited from Ownable).
Initializes the bridge contract and sets the initial deposit script parameters.
Updates the expected deposit script parameters.
Updates the expected slash or take script. See slashOrTakeScript
in State Structure
for detailed information.
Processes a deposit from Bitcoin to Citrea by verifying the Bitcoin transaction and sending configured bridge amount of cBTC to the recipient. Can only be called by the designated operator.
Accepts configured bridge amount of cBTC from the sender and records a withdrawal request to be processed on Bitcoin. This recording is done by storing a UTXO consisting of a txId
and an outputId
which is the input for the ANYONE_CAN_PAY
withdraw transaction on Bitcoin.
Batch version of withdraw
that can accept multiple withdrawal requests at once.
Returns the total number of withdrawal requests made so far.
Sets the operator address that can process user deposits.
Stores which operator filled a certain withdraw request. Operators should make sure this function is called before sending a "slash or take" transaction on Bitcoin to avoid being marked as malicious.
Marks an operator as malicious if they sent a "slash or take" transaction on Bitcoin without first proving that they covered a withdrawal through declareWithdrawFiller
. This information is later on used as evidence in the process of BitVM challenges on the Bitcoin side to prevent the operator stealing user funds from N-of-N multisig, as not being able to successfully call declareWithdrawFiller
indicates that the operator is trying to claim funds from multisig even though they didn't cover a withdrawal request.
Reverts if the provided transaction is not properly structured or not an actual Bitcoin transaction that happened according to BitcoinLightClient
.
Extracts the recipient from a given script.
Emitted when a deposit is successfully processed.
Emitted when a withdrawal request is recorded.
Emitted when the deposit script parameters are updated.
Emitted when the operator address is updated.
Emitted when the operator filled a withdrawal request is declared.
Emitted when an operator is marked as malicious.
Emitted when slash or take script is updated.
Parameters | Description |
---|---|
Parameters | Description |
---|---|
Parameters | Description |
---|---|
Parameters | Description |
---|---|
Parameters | Description |
---|---|
Parameters | Description |
---|---|
Returns | Description |
---|---|
Parameters | Description |
---|---|
Parameters | Description |
---|---|
Parameters | Description |
---|---|
Parameters | Description |
---|---|
Returns | Description |
---|---|
Parameters | Description |
---|---|
Returns | Description |
---|---|
Parameters | Description |
---|---|
Parameters | Description |
---|---|
Parameters | Description |
---|---|
Parameters | Description |
---|---|
Parameters | Description |
---|---|
Parameters | Description |
---|---|
Parameters | Description |
---|---|