BridgeFacet

This is a Solidity contract that implements the IBridge interface. The contract has the following functions:

updateStargateSettings():

updates the settings of the Stargate bridge.

Input

FieldTypeDescription

stargateSettings

StargateSettings

struct StargateSettings {
    address routerAddress;
}

updateWormholeBridgeSettings():

updates the settings of the Wormhole bridge.

Input

FieldTypeDescription

wormholeBridgeSettings

WormholeBridgeSettings

struct WormholeBridgeSettings {
    address bridgeAddress;
}

The updateStargateSettings and updateWormholeBridgeSettings functions enforce that only the contract owner can call them, using the enforceIsContractOwner function from the LibDiamond library.

updateCelerBridgeSettings():

It's a way to update and manage the settings associated with the Celer Bridge, and its execution is permissioned for the contract owner.

Input

FieldTypeDescription

celerBridgeSettings

CelerBridgeSettings

struct CelerBridgeSettings {
    address messageBusAddress;
}

addCelerChainIds():

The function is responsible for updating the contract's settings related to chain IDs. It utilizes a modular approach where logic for handling chain IDs is encapsulated in the LibCeler library. The ownership check at the beginning guarantees that only the contract owner can execute this function.

Input

FieldTypeDescription

networkIds

uint16[]

An array containing identifiers for networks.

chainIds

uint64[]

An array containing chain identifiers corresponding to the networks in networkIds.

addMagpieCelerBridgeAddress():

This function is responsible for adding Magpie Celer bridge addresses to the contract's settings, associating them with specific network IDs.

Input

FieldTypeDescription

networkIds

uint16[]

An array containing identifiers for networks.

magpieCelerBridgeAddresses

bytes32[]

An array of bytes32 values representing Magpie Celer Bridge addresses.

addMagpieStargateBridgeAddresses():

This function is responsible for adding the given bridge addresses to the corresponding network IDs.

Input

FieldTypeDescription

networkIds

uint16[]

An array of identifier defined by the magpie team for each network

magpieStargateBridgeAddresses

bytes32[]

An array of magpieStargateBridge addresses for each network in the form of bytes32

addMagpieStargateBridgeV2Address():

This function is responsible for adding the given bridge addresses to the corresponding network IDs.

Input

FieldTypeDescription

networkIds

uint16[]

An array of identifier defined by the magpie team for each network

magpieStargateBridgeAddresses

bytes32[]

An array of magpieStargateBridge addresses for each network in the form of bytes32

getWormholeTokenSequence():

This function takes a uint64 parameter tokenSequence and returns a uint64. It calls the getTokenSequence function from the LibWormhole library, passing the tokenSequence as an argument. The purpose of this function is to retrieve and return a transformed version of the tokenSequence using the LibWormhole library.

Input:

FieldTypeDescription

tokenSequence

uint64

The token sequence defined by magpie

Output:

FieldTypeDescription

The token sequence receiver from wormhole.

bridgeIn():

This function takes a BridgeInArgs struct as a calldata parameter and does not return a value. It overrides a function declared in an interface or parent contract. It calls the bridgeIn function from the LibBridge library, passing the bridgeInArgs as an argument.

Input:

FieldTypeDescription

bridgeInArgs

BridgeInArgs

struct BridgeInArgs {
    uint16 recipientNetworkId;
    BridgeArgs bridgeArgs;
    uint256 amount;
    address toAssetAddress;
    TransferKey transferKey;
}

bridgeOut():

This function takes a BridgeOutArgs struct as a calldata parameter and returns a uint256 value. It overrides a function declared in an interface or parent contract. It calls the bridgeOut function from the LibBridge library, passing the bridgeOutArgs as an argument.

Input:

FieldTypeDescription

bridgeOutArgs

BridgeOutArgs

struct BridgeOutArgs {
    BridgeArgs bridgeArgs;
    Transaction transaction;
    TransferKey transferKey;
}

Last updated