# FBTC Minter

The `FBTCMinter` contract is a critical component in the FBTC protocol that manages the confirmation of minting, burning, and cross-chain requests. It operates under a role-based access control system to ensure secure and efficient processing of these operations.

## Key Features

### **Role-Based Access Control**

Utilizes specific roles for minting, burning, and cross-chain operations to ensure only authorized entities can perform these actions.

* `MINT_ROLE`: Responsible for confirming minting requests.
* `BURN_ROLE`: Responsible for confirming burning requests.
* `CROSSCHAIN_ROLE`: Responsible for confirming cross-chain requests.

### **Bridge Integration**

The `FBTCMinter` interacts with the `FireBridge` contract to execute its functions, ensuring seamless integration within the FBTC ecosystem.

## High-level Workflow

The `FBTCMinter` contract works closely with the `FireBridge` contract to ensure secure and efficient confirmation of minting, burning, and cross-chain requests. Below is a detailed workflow for each operation:

### Minting Workflow

1. **Minting Request Initiation**:
   * A merchant initiates a minting request via the `FireBridge` contract.
   * The `FireBridge` contract validates the request and records it.
2. **Confirmation by FBTCMinter**:
   * An entity with the `MINT_ROLE` calls the `confirmMintRequest` function on the `FBTCMinter` contract.
   * `FBTCMinter` forwards the confirmation to the `FireBridge` contract by calling its `confirmMintRequest` function.
   * The `FireBridge` contract processes the request and mints the appropriate amount of FBTC tokens.

### Burning Workflow

1. **Burning Request Initiation**:
   * A merchant initiates a burning request via the `FireBridge` contract.
   * The `FireBridge` contract validates the request and records it.
2. **Confirmation by FBTCMinter**:
   * An entity with the `BURN_ROLE` calls the `confirmBurnRequest` function on the `FBTCMinter` contract, providing the request hash, withdrawal transaction ID, and output index.
   * `FBTCMinter` forwards the confirmation to the `FireBridge` contract by calling its `confirmBurnRequest` function.
   * The `FireBridge` contract processes the request and burns the appropriate amount of FBTC tokens.

### Cross-Chain Workflow

1. **Cross-Chain Request Initiation**:
   * A merchant initiates a cross-chain request via the `FireBridge` contract.
   * The `FireBridge` contract validates the request and records it.
2. **Confirmation by FBTCMinter**:
   * An entity with the `CROSSCHAIN_ROLE` calls the `confirmCrosschainRequest` function on the `FBTCMinter` contract, providing the request details.
   * `FBTCMinter` forwards the confirmation to the `FireBridge` contract by calling its `confirmCrosschainRequest` function.
   * The `FireBridge` contract processes the request and initiates the cross-chain transfer.

### Batch Confirmation Workflow

1. **Batch Cross-Chain Request Initiation**:
   * Multiple cross-chain requests are initiated and recorded by the `FireBridge` contract.
2. **Batch Confirmation by FBTCMinter**:
   * An entity with the `CROSSCHAIN_ROLE` calls the `batchConfirmCrosschainRequest` function on the `FBTCMinter` contract, providing an array of requests.
   * `FBTCMinter` iterates through the array and forwards each request confirmation to the `FireBridge` contract.
   * The `FireBridge` contract processes each request and initiates the respective cross-chain transfers.
