# Interface - IAggregator

```solidity
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;
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.fly.trade/flycn/developers/deprecated-magpie-contracts/magpieaggregator-diamond-proxy/aggregator/interface-iaggregator.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
