Bridge
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.
Deposit Structure
The following is an explanation regarding the DepositParams
structure, which is used to represent deposits made to Citrea from the Bitcoin network using Clementine.
Parameters | Description |
---|---|
| Version field of a transaction |
| Marker + Flag of a segregated witness transaction |
| Transaction inputs |
| Transaction outputs |
| Transaction witness |
| Transaction locktime |
| The proof's intermediate nodes |
| Block Height |
| The leaf's index in the tree (0-indexed) |
To understand more, please check the way deposit params are used along with the BitcoinLightClient
contract from both our documentation and explorer.
State Structure
A flag indicating whether the contract has been initialized.
The fixed amount for deposits and withdrawals, set to 0.01 ether (cBTC).
The address of the privileged operator who can process user deposits.
The number of signatures required in the deposit script for verification.
The expected deposit script for all L1 (Bitcoin) deposits.
The suffix of the deposit script that follows the receiver address.
A mapping to keep track of spent witness transaction IDs to prevent double-spending.
An array to store Bitcoin addresses for withdrawal requests.
Access Control Structure
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).
Functions
Initializes the bridge contract and sets the initial deposit script parameters.
Parameters | Description |
---|---|
| The deposit script expected in the witness field for all L1 deposits |
| The suffix of the deposit script that follows the receiver address |
| The number of signatures contained in the deposit script |
| The address to be set as the owner of the contract |
Updates the expected deposit script parameters.
Parameters | Description |
---|---|
| The new deposit script |
| The part of the deposit script that succeeds the receiver address |
| The number of signatures needed for deposit transaction |
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.
Parameters | Description |
---|---|
| Struct containing deposit transaction details from Bitcoin |
Accepts configured bridge amount of cBTC from the sender and records a withdrawal request to be processed on Bitcoin.
Parameters | Description |
---|---|
| The Bitcoin address of the receiver |
Batch version of withdraw
that can accept multiple withdrawal requests at once.
Parameters | Description |
---|---|
| Array of Bitcoin addresses for the receivers |
Returns the total number of withdrawal requests made so far.
Returns | Description |
---|---|
| The count of withdrawals happened so far |
Sets the operator address that can process user deposits.
Parameters | Description |
---|---|
| Address of the privileged operator |
Extracts the recipient from a given script.
Parameters | Description |
---|---|
| The script to be processed |
Returns | Description |
---|---|
| The recipient |
Events
Emitted when a deposit is successfully processed.
Parameters | Description |
---|---|
| The witness transaction ID of the Bitcoin transaction |
| The Citrea address receiving the deposited cBTC |
| The timestamp of the deposit |
Emitted when a withdrawal request is recorded.
Parameters | Description |
---|---|
| The Bitcoin address for the withdrawal |
| The index of the withdrawal in the |
| The timestamp of the withdrawal request |
Emitted when the deposit script parameters are updated.
Parameters | Description |
---|---|
| The new deposit script |
| The new script suffix |
| The new required signatures count |
Emitted when the operator address is updated.
Parameters | Description |
---|---|
| The previous operator address |
| The new operator address |
Last updated