Smart Contracts

Introduction

The Multi-Ledger Rollup can receive deposits via smart contracts. The addresses of which are below:

Smart ContractBlockchainAddressDescription
Deposit ContractEthereum Sepolia testnet0xaee1299034f8d04ba414e8ca3ef6a67203844313The main entry point for depositing tokens from the Sepolia testnet.
Deposit ContractPolygon Amoy testnet0xaf0f944d79d93635d79c66a1f51bff187bac0087The main entry point for depositing tokens from the Amoy testnet.
Deposit ContractQuant Besu Private Network0x7ecd170e2f858cec9436af9f0a91f4838d565475The main entry point for depositing tokens from Quant's Besu private testnet

The Multi-Ledger Rollup can also receive cross chain messages, which can be used for cross chain smart contract calls. The addresses of which are below:

Smart ContractBlockchainAddressDescription
Message ContractEthereum Sepolia testnet0x456c3f92432fd89f008b5cd0b2d799d931a98d42The main entry point for cross chain messages from the Sepolia testnet.
Message ContractPolygon Amoy testnet0x5056e5c6da3f2c48b744a199b72c6f1953491469The main entry point for cross chain messages from the Amoy testnet.
Message ContractQuant Besu Private Network0x456c3f92432fd89f008b5cd0b2d799d931a98d42The main entry point for cross chain messages from Quant's Besu private testnet

How do deposits work?

The deposit process in the Multi-Ledger Rollup follows a secure cross-chain mechanism that enables users to transfer tokens from any connected L1 blockchain to the shared Multi-Ledger Rollup.

Here's more details on how the deposit process works:

Prerequisites for Deposits

Note: The following prerequisites are completed for each whitelisted token by Quant. This ensures that only authorized administrators can configure which chains and tokens are allowed to participate in the Multi-Ledger Rollup system.

To be able to deposit from a blockchain to the Rollup, the following whitelisting requirements must be met:

  1. Rollup Whitelisted on Blockchain: The multi-ledger rollup must be whitelisted on the token whitelist contract located on each connected blockchain
  2. Local Token Configuration: The token we want to deposit from a blockchain to the Rollup must be set as a local token on that blockchain's token whitelist contract
  3. Rollup Token Whitelisted: The anchored token on the Rollup must be added as a whitelisted token on the Rollup's token whitelist contract

1. ERC20 Deposits

Important Note: If QNT is the ERC20 token being deposited, then the user will receive the native coin on the Rollup, not an ERC20 token. The native coin is required for transaction fees.

When a user wants to deposit tokens from a blockchain to the Multi-Ledger Rollup:

  1. Token Approval: For ERC-20 tokens, the user must first approve the deposit contract to spend their tokens

  2. Deposit Transaction: The user can call either of the following functions on the deposit contract:

    Option A: depositERC20() - Deposits to the sender's address on the Rollup:

    • _l1Token: Address of the blockchain token being deposited
    • _l2Token: Address of the anchored token on the Rollup
    • _amount: Amount of the token to deposit
    • _minGasLimit: Minimum gas limit for the deposit message on the Rollup
    • _extraData: Optional data to forward to the Rollup
    • _destinationChainId: Rollup chain Id

    Option B: depositERC20To() - Deposits to a specific address on the Rollup:

    • _l1Token: Address of the blockchain token being deposited
    • _l2Token: Address of the corresponding token on the Rollup
    • _to: Address of the recipient on the Rollup
    • _amount: Amount of the token to deposit
    • _minGasLimit: Minimum gas limit for the deposit message on the Rollup
    • _extraData: Optional data to forward to the Rollup
    • _destinationChainId: Rollup chain Id

2. Deposit Processing

The deposit contract on the original blockchain does the following:

  1. Validates the deposit: Checks if the token is whitelisted and the user has sufficient balance
  2. Locks the tokens: Transfers the tokens from user to the deposit contract
  3. Creates cross-chain message: so that the token is transferred to the rollup

3. Rollup Processing

The Multi-Chain Rollup now processes the deposit:

  1. Event Detection: The Rollup sequencer detects the TransactionDeposited event from the source blockchain
  2. Transaction Creation: A deposit transaction is created on Rollup with the user's address and token amount
  3. State Update: The Rollup updates its state to reflect the incoming deposit
  4. Token Minting: The system creates a corresponding Rollup anchored token and sends it the the address requested by the user on the deposit step