# Token Transfer Process

In the following sequence, Chain A refers to the origin chain, and Chain B refers to the destination chain.

1. **BridgeOut Function:**
   * To initiate a token transfer from Chain A to Chain B, an end user calls the **bridgeOut** function of the **Chain-Agnostic Token (CAT)** contract on Chain A and provides necessary gas to complete the cross-chain transfer on Chain B.
   * This function burns the tokens and forwards the call to the **Message Router** contract on Chain A.
2. **Bridge Protocol Selection:**
   * The **Message Router** contract on Chain A selects a message passing protocol based on a predefined criteria and priority order (such as Wormhole, LayerZero, Axelar, CCIP).
   * The choice is made dynamically, ensuring flexibility and resilience.
3. **Message Construction:**
   * The **Message Router** contract constructs a message containing crucial metadata, including the address of the burned token, the amount, and the user wallet initiating the request.
4. **Message Relay:**
   * The message is auto-relayed to the **Message Router** contract on Chain B.
5. **Message Validation:**
   * Upon arrival on Chain B, the message is decoded, parsed, and rigorously validated.
   * The validation process ensures the tokens were genuinely burned on Chain A and that the message remains untampered with.
6. **Token Minting:**
   * After successfully passing validation, the **Message Router** contract on Chain B forwards the message to **bridgeIn** function on the **Chain-Agnostic Token** contract.
   * The **CAT** contract uses the decoded data to mint an equivalent amount of tokens as those burned on the source chain.
7. **Token Distribution:**
   * The newly minted **Chain-Agnostic Tokens** are sent to the end user's wallet, as specified in the original message, completing the cross-chain token transfer.
