-
Notifications
You must be signed in to change notification settings - Fork 124
Closed
Labels
agglayerPRs or issues related to AggLayer bridging integrationPRs or issues related to AggLayer bridging integrationstandardsRelated to standard note scripts or account componentsRelated to standard note scripts or account components
Description
Bridging summary
The overall flow for bridging out from Miden -> AggLayer
- The user creates a Bridge-to-AggLayer (
B2AGG) note withASSETto be bridged out, and sends it to theAggLayerBridgeOutcontract - The
AggLayerBridgeOutaccount verifies that the faucet for theASSETin the note is in the faucet registry it maintains. It then,- Makes an FPI call to this
AggLayerFungibleFaucetto call itsconvert_assetprocedure and get the Ethereum-native representation of the token's amount + address. - Hashes the information about the asset to be bridged out to obtain a hash value, and appends it to a Local Exit Tree (a Merkle Tree) it maintains - only the frontier branch is needed at any given time, not the full tree.
- Sends a burn note with the original asset to the
AggLayerFungibleFaucet - The faucet will consume the note and burn the contained asset.
- Makes an FPI call to this
B2AGG note interface
(this is pretty simple, the code below might already work)
use.miden::note
use.miden::contracts::agglayer::bridge
const.ERR_B2AGG_WRONG_NUMBER_OF_ASSETS="B2AGG script requires exactly 1 note asset"
#! Inputs: []
#! Outputs: []
#!
#! Note inputs are assumed to be as follows:
#! - destination_network (AggLayer-defined network ID)
#! - DESTINATION_ADDRESS (destination network's target address)
#!
begin
# store the number of note assets to memory starting at address 0
push.0 exec.active_note::get_assets
# => [num_assets, ptr]
# make sure the number of assets is 1
assert.err=ERR_B2AGG_WRONG_NUMBER_OF_ASSETS
# => [ptr]
# load the ASSET
mem_loadw
# => [ASSET, destination_network, DESTINATION_ADDRESS]
call.bridge::bridge_asset_out
# => []
end
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
agglayerPRs or issues related to AggLayer bridging integrationPRs or issues related to AggLayer bridging integrationstandardsRelated to standard note scripts or account componentsRelated to standard note scripts or account components