Magpie Protocol
  • Magpie Protocol
    • What is Magpie solving?
      • What is DeFi?
    • Magpies Key Features
      • Use Cases
    • FLY
      • xFLY & FLY33
  • 📶Supported Networks
  • Guides
    • 📖Glossary of DeFi Terms
    • 👜Connect Wallet
    • 🔄On-Chain Swap
    • 🔀Cross-Chain Swap
    • 🔂Swap configuration
    • 🥚Magpie Boosts
    • 📒Transaction History
    • 💲Portfolio
  • Media Kit
  • 👩‍💻Developers
    • Magpie Contracts
      • MagpieCCTPBridge
      • MagpieCelerBridgeV2
      • MagpieRouterV3
      • MagpieStargateBridgeV3
      • LibAsset
      • LibBridge
      • LibRouter
    • Smart Contracts Audit
    • Deployments
    • API Reference
      • On chain swap
      • Cross chain swap
      • Requesting and Using API Key
Powered by GitBook
On this page
  • getOriginalPayload()
  • dataTransfer()
  • getPayload()
  1. Developers
  2. Deprecated Magpie Contracts
  3. MagpieAggregator Diamond Proxy
  4. Data Transfer

LibDataTransfer

This is a Solidity smart contract library that provides functions related to data transfer between different blockchain networks or layers.

getOriginalPayload()

this function is responsible for extracting the original payload from the extended payload by slicing the extendedPayload from the 42nd byte to the end. It removes the extended part of the payload and returns the original payload.

Input

Field
Type
Description

Payload + extra information like which data transfer type has been used

Output

Field
Type
Description

payload

the original payload

dataTransfer()

this function is responsible for executing data transfer operations based on the specified protocols. It increments the core sequence, creates a transfer key, generates the extended payload, and processes each protocol in dataTransferInArgs.protocols. Depending on the protocol's dataTransferType, either the Wormhole or LayerZero data transfer function is called. If an unrecognised dataTransferType is encountered, the function reverts with an error.

Input

Field
Type
Description

Output

Field
Type
Description

getPayload()

this function is responsible for obtaining the transfer key and payload based on the specified data transfer type. Depending on the dataTransferType in dataTransferOutArgs, either the Wormhole or LayerZero library functions are called to obtain the payload.

Input

Field
Type
Description

Output

Field
Type
Description

The data necessary for swapping.

Last updated 1 year ago

👩‍💻
extendedPayload
bytes
bytes
dataTransferInArgs
DataTransferInArgs
struct DataTransferInArgs {
    DataTransferInProtocol protocol;
    TransferKey transferKey;
    bytes payload;
}
transferKey
TransferKey
struct TransferKey {
    uint16 networkId;
    bytes32 senderAddress;
    uint64 swapSequence;
}
dataTransferOutArgs
DataTransferOutArgs
struct DataTransferOutArgs {
    DataTransferType dataTransferType;
    bytes payload;
}
transferKey
TransferKey
struct TransferKey {
    uint16 networkId;
    bytes32 senderAddress;
    uint64 swapSequence;
}
payload
bytes