Magpie Contracts

Contract
Path
Description

IAxelarGasService

The IAxelarGasService interface manages gas payments and refunds for cross-chain communication on the Axelar network. It has one function:

payNativeGasForContractCall: pays for gas using native currency for a contract call on a destination chain.

IAxelarGateway

The IAxelarGateway interface enables cross-chain communication on the Axelar network. It has two functions:

callContract: executes a remote contract call on a destination chain.

validateContractCall: verifies the authenticity of a contract call and returns a boolean result.

IReceiver

The IReceiver interface receives messages on the destination chain and forwards them to the IMessageDestinationHandler. It has one function:

receiveMessage: receives an incoming message, validates the header, and passes the body to the application-specific handler.

ILiquidityBridge

The ILiquidityBridge contract defines an interface for a cross-chain liquidity bridge. It specifies several core functions for sending and relaying assets across different blockchain networks, managing transfer status, and handling withdrawals.

IMessageBus

The IMessageBus interface facilitates cross-chain message passing and token transfers. It defines structures like SwapInfo (swap details) and SwapRequest (swap operation), and enums such as BridgeSendType (bridge operation types) and TransferType (transfer actions). Core functions include sending and executing messages with transfers, handling refunds, and calculating fees. It supports multiple transfer mechanisms and integrates with a liquidity bridge for cross-chain operations.

IOFT

The IOFT interface manages cross-chain token transfers using Omnichain Fungible Tokens (OFT). It defines structures like SendParam for transfer details and MessagingReceipt for transaction receipts. The contract includes functionality for sending tokens across chains, quoting transfer limits and fees, and handling messaging and fee structures. It ensures security through slippage checks and transfer validation.

IStargate

The IStargate interface extends the IOFT contract for cross-chain token transfers. It introduces a StargateType enum to define implementation types and a Ticket struct for bus ride operations. Key functionality includes sending tokens across chains via sendToken, which also returns a ticket if bus ride mode is enabled, and retrieving the Stargate type via stargateType(). The interface builds on OFT operations, adding unique Stargate-related logic.

IBridge

The IBridge interface defines the core functionality for a token bridge that supports swapping assets across chains. It emits events for swap operations (SwapIn, SwapOut) and allows the contract owner to update internal parameters such as whitelisted callers, WETH address, and network/router details. The multicall function enables executing multiple operations in a single transaction, enhancing operational efficiency.

IMagpieCCTPBridge

The IMagpieCCTPBridge interface extends the IBridge contract and adds functionality for cross-chain token and message handling. It allows the owner to update critical addresses such as the CCTP token messenger, Axelar gateway, and gas receiver. Additionally, the interface includes an execute function to handle commands from a source chain, processing them based on the provided command ID, source chain, source address, and encoded payload. This enables seamless communication and execution of cross-chain operations.

IMagpieCelerBridgeV2

The IMagpieCelerBridgeV2 interface extends the IBridge contract, facilitating interactions with the Celer Network. It allows the owner to update the Celer address and includes functions for executing messages with fund transfers and managing refunds. This ensures efficient cross-chain communication and transaction handling.

IMagpieRouterV3

The IMagpieRouterV3 interface provides a framework for managing internal callers and bridges, enabling the owner to update their whitelisted statuses. It includes a multicall function for executing multiple actions in a single transaction, and several token swap methods: swapWithMagpieSignature, swapWithUserSignature, and swapWithoutSignature, each facilitating asset exchanges while returning the amount received. Additionally, it features an estimateSwapGas function to assess gas costs for swaps, enhancing transaction efficiency and cost management.

IMagpieStargateBridgeV3

The IMagpieStargateBridgeV3 interface extends the IBridge contract, enabling management of asset mappings to Stargate pools. It allows the owner to update the asset-to-Stargate and Stargate-to-asset mappings through dedicated functions. Additionally, it includes an updateLzAddress function for modifying the LayerZero address. The interface also features the lzCompose function, enabling Stargate to handle transfers and update deposit amounts, facilitating seamless asset management across the bridge.

IMagpieSymbiosisBridge

The IMagpieSymbiosisBridge interface extends the IBridge contract, providing functionalities to manage critical addresses for the Portal, Axelar gateway, and gas receiver, allowing the owner to update these addresses as needed. Additionally, it features an execute function that facilitates the execution of Axelar commands from a source chain, using parameters like command ID, source chain name, source address, and payload. This ensures effective cross-chain communication and command execution.

IWETH

The IWETH interface defines essential functions for interacting with Wrapped Ether (WETH). It includes a deposit function to convert Ether to WETH, a transfer function for transferring WETH to a specified address, and a withdraw function for converting WETH back to Ether. This interface facilitates seamless handling of WETH within smart contracts.

MagpieCCTPBridge

The MagpieCCTPBridge contract facilitates cross-chain asset swaps and deposits through Circle CCTP bridge. It includes functions for updating router addresses, processing inbound and outbound swaps, and managing deposits. The contract verifies signatures for secure transactions and emits events for asset bridging and deposits.

MagpieCelerBridgeV2

The MagpieCelerBridgeV2 contract enables cross-chain asset swaps and deposits, incorporating security measures like ownership control and pausable functions. It verifies swap signatures, manages deposit data, and facilitates asset bridging through the Celer Network, ensuring efficient transaction handling and refund management.

MagpieRouterV3

The contract is designed to facilitate token swaps. It includes a range of functions for executing commands, handling swaps, and managing gas usage. The contract uses a combination of libraries and interfaces to provide its functionality, including the IOFT interface, LibAsset, LibRouter, and Ownable2Step and Pausable from OpenZeppelin.

MagpieStargateBridgeV3

The MagpieStargateBridgeV3 contract facilitates cross-chain asset swaps and deposits, ensuring security through ownership control and pausable functions. It verifies swap signatures, manages deposit data, and handles asset bridging via the Stargate network. Key functionalities include updating internal callers, executing swaps, and processing deposits while preventing reentrancy and validating addresses.

MagpieSymbiosisBridge

The IMagpieSymbiosisBridge interface extends the IBridge contract and introduces functionalities for cross-chain asset transfers and swaps. It enables the owner to update key addresses, including the WETH token, portal, Axelar gateway, and gas receiver, ensuring flexible asset management. The interface features several swap functions, allowing for inbound and outbound asset operations, supported by rigorous signature verification to enhance security. Furthermore, the execute function processes incoming commands from a source chain, validating them through the Axelar gateway before executing the associated payload. This design facilitates efficient cross-chain communication and execution of transactions.

LibAsset

The LibAsset library offers utility functions for handling asset transfers, approvals, and balance checks within Ethereum smart contracts. It identifies native assets (Ether) and provides functions to wrap and unwrap assets securely. The library facilitates balance retrieval for both the contract and specific addresses. Additionally, it ensures safe transfer and approval operations for ERC20 tokens using low-level calls with detailed error handling. Key functions include wrap, unwrap, transfer, approve, and permit, enhancing asset management capabilities in cross-chain contexts.

LibBridge

The LibBridge library provides essential functions for managing cross-chain swap operations within smart contracts. It computes bridge fees based on the asset type, ensuring accurate financial handling during swaps. The library enables the encoding and decoding of deposit data hashes, facilitating secure data management across different networks. It also incorporates robust error handling for invalid swap conditions and provides methods for both inbound and outbound swap operations. Key functionalities include fee calculation, deposit data encoding, and executing swaps with native and ERC20 assets, optimizing cross-chain transaction processes.

LibRouter

The LibRouter library provides functionalities for handling swap operations in smart contracts. It processes incoming data to create a structured SwapData object while validating transaction deadlines. The library facilitates fee transfers, including gas fees and affiliate fees, while managing permissions through an approval mechanism. It verifies signatures to ensure transaction authenticity, utilizing EIP-712 standards for structured data hashing. Key features include getData, transferFees, permit, and verifySignature, enabling robust and secure cross-chain swap functionality.

Last updated