Skip to content

Conversation

jakovmitrovski
Copy link
Collaborator

@jakovmitrovski jakovmitrovski commented Sep 4, 2025

Bridge Implementation: Mint-Burn and Deposit-Withdraw Patterns

Overview

This PR implements a cross-chain token bridging system with two contracts: mint-burn and deposit-withdraw. The implementation includes complete contracts, interfaces, test suites, and documentation.

Architecture

Abstract Bridge Contract

  • Template Method Pattern: Core functionality implemented in Bridge.sol with abstract methods for concrete implementations
  • Access Control: Admin and pauser roles with proper permission management
  • Token Management: Whitelisting, configuration, and daily limits
  • Migration Support: Contract upgrades with role transfers
  • Request Deduplication: Prevents double-processing of bridging requests

Two Bridge Implementations

1. BridgeMintBurn

  • Token Handling: Burns tokens on deposit, mints on claim
  • Deposit Verification: Uses external precompile for eth_getLogs verification
  • Token Creation: createAndWhitelistMirrorToken for token whitelisting / creation
  • To Be Deployed On: Pod

2. BridgeDepositWithdraw

  • Token Handling: Transfers (and locks) tokens to bridge on deposit, transfers out (unlocks) on claim
  • Deposit Verification: Uses PodRegistry to verify a certified log which attests that an event was emitted on Pod
  • To Be Deployed On: Ethereum

Testing

Added tests that cover the functionality of the bridge

Documentation Improvements

  • Interface Documentation
  • Function Documentation
  • Error Documentation

k4m4 and others added 30 commits July 24, 2025 20:19
- Add functions for activating / deactivating validators
- Add a function for initializing a validator
- Refactor methods to use the functions
- Rename nextValidatorIndex to validatorCount and derive index from it
- Add tests compute weight when subset is larger than 255 and test ban not creating a snapshot when the banned validator is inactive
@jakovmitrovski jakovmitrovski marked this pull request as ready for review September 5, 2025 09:12
@jakovmitrovski jakovmitrovski changed the title POD-156 Feat/bridge POD-156: Feat/bridge Sep 5, 2025

let (request_id, token_address, block_number) =
source_chain_bridge_client.deposit_token(to, amount).await?;

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'd have to wait here for block_number to be finalized... repeatedly query get_block_by_number with finalized parameter and compare block_number to the response.block_number


let (request_id, source_chain_block_number) =
source_chain_bridge_client.deposit_native(to, value).await?;

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here too, wait for block number to be finalized when on sepolia/ethereum

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants