About AUC Bridge

Introduction

The 'AUC Bridge' is a cross-chain solution designed to expand the Ethereum-based AUC governance token to other chains. The bridge utilizes LayerZero technology to enable seamless transfers between AUC, AUCB (Base chain), and AUCA (Avalanche chain) tokens.

AUC Bridge Website
AUC Bridge Processing Page

How It Works:

  1. Access the website.

  2. Connect AUC Holding Wallet.

  3. Select the desired origin and destination chain.

  4. Enter the amount of tokens you want to transfer(bridge).

  5. Click the 'Approve Tokens' button

  6. Click the 'Bridge' button to start the transfer.

Caution: 0.5% of tokens are burned for each transaction.

Explorer

In the Explorer section, you can view the on-chain results of bridge transactions and the history of token burns.

AUC Bridge Explorer Page

Key Features:

  • View details of each transaction

  • See the amount of 0.5% tokens burned

  • Track cross-chain transaction status

Transaction

In the Transaction section, you can see the history of bridge transactions for each user.

AUC Bridge Transaction Page

Information Provided:

  • Transaction dates

  • Originating and destination chains

  • Transfer amount

  • Burned amount

  • Transaction status

AUC Token Bridging Process

The process of bridging AUC tokens using LayerZero involves a few key steps. When transferring ERC-20-based AUC tokens to the Avalanche network, 0.5% of the original tokens on the Ethereum network are first burned. LayerZero then generates a message that is sent to the Avalanche network, where 99.5% of the original amount of AUC tokens are minted to AUCa. The minted tokens holds the same value of the original token ensuring that users retain the same value in the new network.

This process is fully bidirectional. If a user wishes to transfer AUCa tokens from Avalanche to the Base network, for instance, the AUCa tokens will be bridged and minted to Base, and 0.5% of AUCa will be burned and 99.5% of AUCb tokens will be minted on Base. This seamless transfer capability is one of the core benefits of LayerZero technology.

AUC Token Bridging Process

Technical Details

The AUC Bridge is written in Solidity version 0.8.23, and its key components are as follows:

Ethereum Bridge Contract

This contract is deployed on the main chain (Ethereum) to manage token bridging operations.

Key Functions:

  • xChainTransfer: Initiates cross-chain token transfer.

  • lzReceive: Receives and processes messages from LayerZero.

Key State Variables:

  • AUC_TOKEN: Address of the token being bridged.

  • LZ_CHAIN_ID: LayerZero chain ID of the current chain.

  • endpoint: Address of the LayerZero endpoint.

  • trustedRemote: Mapping of trusted remote addresses.

  • transferFeePercent: Percentage for transfer fees (default: 0.5%).

Key Events:

  • BridgingInitiated: Triggered when a bridging operation starts.

  • BridgingCompleted: Triggered when a bridging operation is completed.

Code Explanation

function xChainTransfer(address _receiver, uint256 _amount, uint16 _dstChainId, bytes memory _adapterParams)
    external
    payable
{
    // Validation
    require(trustedRemote[_dstChainId].length > 0, "bridge/invalid-dst-chain-id");
    require(AUC_TOKEN.balanceOf(msg.sender) >= _amount, "bridge/insufficient-balance");
    require(AUC_TOKEN.allowance(msg.sender, address(this)) >= _amount, "bridge/insufficient-allowance");

    // token transfer
    uint256 balanceBefore = AUC_TOKEN.balanceOf(address(this));
    AUC_TOKEN.transferFrom(msg.sender, address(this), _amount);
    uint256 balanceAfter = AUC_TOKEN.balanceOf(address(this));

    require(balanceAfter - balanceBefore == _amount, "bridge/transfer-from-failed");

    // Calculating fees and burning
    uint256 fees = (_amount * transferFeePercent) / 10000;
    uint256 finalAmount = _amount - fees;

    if (fees > 0) {
        AUC_TOKEN.transfer(0x000000000000000000000000000000000000dEaD, fees);
    }

    // Sending messages through LayerZero
    ++txCounter;
    endpoint.send{value: msg.value}(
        _dstChainId,
        trustedRemote[_dstChainId],
        abi.encode(_receiver, finalAmount, txCounter),
        payable(msg.sender),
        address(0),
        _adapterParams
    );
    emit BridgingInitiated(LZ_CHAIN_ID, _dstChainId, txCounter, _receiver, finalAmount, fees);

This function initiates a cross-chain transfer. The main steps are as follows:

  1. Validation

  2. Token transfer

  3. Fee calculation and burning

  4. Sending messages via LayerZero

Cautions

  • Always use the bridge through the official website.

  • When transferring large amounts of tokens, test with small amounts before proceeding.

  • Bridge transactions are irreversible, so proceed with caution.

Last updated