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
  1. Developers
  2. Deprecated Magpie Contracts
  3. MagpieAggregator Diamond Proxy
  4. Aggregator

Interface - IAggregator

interface IAggregator {
    event UpdateWeth(address indexed sender, address weth);

    /// @dev Allows the contract owner to update the address of wrapped native token.
    /// @param weth Address of the wrapped native token.
    function updateWeth(address weth) external;

    event UpdateNetworkId(address indexed sender, uint16 networkId);

    /// @dev Allows the contract owner to update the network id in the storage.
    /// @param networkId Magpie network id associated with the chain.
    function updateNetworkId(uint16 networkId) external;

    event AddMagpieAggregatorAddresses(
        address indexed sender,
        uint16[] networkIds,
        bytes32[] magpieAggregatorAddresses
    );

    /// @dev Allows the contract owner to add Magpie Aggregator addresses for multiple network ids.
    /// @param networkIds Magpie network id associated with the chain.
    /// @param magpieAggregatorAddresses The Magpie Aggregator diamond contract addresses for the related network ids.
    function addMagpieAggregatorAddresses(
        uint16[] calldata networkIds,
        bytes32[] calldata magpieAggregatorAddresses
    ) external;

    event SwapIn(
        address indexed fromAddress,
        bytes32 indexed toAddress,
        address fromAssetAddress,
        address toAssetAddress,
        uint256 amountIn,
        uint256 amountOut,
        TransferKey transferKey,
        Transaction transaction
    );

    /// @dev This function allows for swapping assets into the contract using a bridge-in transaction.
    /// @param swapInArgs Arguments that are required for swapOut.
    /// @return amountOut The amount received after swapping.
    function swapIn(SwapInArgs calldata swapInArgs) external payable returns (uint256 amountOut);

    event SwapOut(
        address indexed fromAddress,
        address indexed toAddress,
        address fromAssetAddress,
        address toAssetAddress,
        uint256 amountIn,
        uint256 amountOut,
        TransferKey transferKey,
        Transaction transaction
    );

    /// @dev Withdraws the assets from the specified bridge and swaps them out to the specified address.
    /// @param swapOutArgs Arguments that are required for swapOut.
    /// @return amountOut The amount received after swapping.
    function swapOut(SwapOutArgs calldata swapOutArgs) external returns (uint256 amountOut);

    event Withdraw(address indexed sender, address indexed assetAddress, uint256 amount);

    /// @dev Withdraw assets that were collected to cover crosschain swap cost.
    /// @param assetAddress Address of the asset that will be withdrawn.
    function withdraw(address assetAddress) external;

    /// @dev Retrieve the deposit amount for a specific asset in the aggregator contract.
    /// @param assetAddress Address of the asset that will be deposited.
    function getDeposit(address assetAddress) external view returns (uint256);

    /// @dev Retrieve the deposit amount for a specific asset deposited by a specific user.
    /// @param assetAddress Address of the asset that was deposited
    /// @param senderAddress Address of the user who has deposited the asset
    function getDepositByUser(address assetAddress, address senderAddress) external view returns (uint256);

    /// @dev Check if a specific transfer key has been used for a crosschain swap.
    /// @param networkId Magpie network id associated with the chain.
    /// @param senderAddress The address  of the origin contract.
    /// @param swapSequence The magpie sequence for the current swap. Each swap gets a new a new sequence
    function isTransferKeyUsed(
        uint16 networkId,
        bytes32 senderAddress,
        uint64 swapSequence
    ) external view returns (bool);

    event UpdateMagpieRouterAddress(address indexed sender, address magpieRouterAddress);

    /// @dev Allows the contract owner to update the Magpie Router address.
    /// @param magpieRouterAddress The address of the Magpie Router.
    function updateMagpieRouterAddress(address magpieRouterAddress) external;
}

Last updated 1 year ago

👩‍💻