LibMagpieAggregator

It defines a storage structure and utility functions for managing various settings and data in the Magpie Aggregator application.

struct CurveSettings {
    address mainRegistry;
    address cryptoRegistry;
    address cryptoFactory;
}
Field
Type
Description

Address of the main registry of the curve protocol.

Address of the crypto registry of the curve protocol

Address of the crypto factory of the crypto factory

struct Amm {
    uint8 protocolId;
    bytes4 selector;
    address addr;
}
Field
Type
Description

The protocol identifier provided by magpie team.

The function selector of the AMM.

The address of the facet of the AMM.

struct WormholeBridgeSettings {
    address bridgeAddress;
}
Field
Type
Description

The wormhole token bridge address

struct StargateSettings {
    address routerAddress;
}
Field
Type
Description

The stargate router address.

struct WormholeSettings {
    address bridgeAddress;
    uint8 consistencyLevel;
}
Field
Type
Description

The wormhole core bridge address.

The level of finality the guardians will reach before signing the message

struct LayerZeroSettings {
    address routerAddress;
}
Field
Type
Description

The router address of layer zero protocol

struct CelerBridgeSettings {
    address messageBusAddress; 
}
Field
Type
Description

The message bus address of celer bridge

struct AppStorage {
    address weth;
    uint16 networkId;
    mapping(uint16 => bytes32) magpieAggregatorAddresses;
    mapping(address => uint256) deposits;
    mapping(address => mapping(address => uint256)) depositsByUser;
    mapping(uint16 => mapping(bytes32 => mapping(uint64 => bool))) usedTransferKeys;
    uint64 swapSequence;
    // Pausable
    bool paused;
    // Reentrancy Guard
    bool guarded;
    // Amm
    mapping(uint16 => Amm) amms;
    // Curve Amm
    CurveSettings curveSettings;
    // Data Transfer
    mapping(uint16 => mapping(uint16 => mapping(bytes32 => mapping(uint64 => bytes)))) payloads;
    // Stargate Bridge
    StargateSettings stargateSettings;
    mapping(uint16 => bytes32) magpieStargateBridgeAddresses;
    // Wormhole Bridge
    WormholeBridgeSettings wormholeBridgeSettings;
    mapping(uint64 => uint64) wormholeTokenSequences;
    // Wormhole Data Transfer
    WormholeSettings wormholeSettings;
    mapping(uint16 => uint16) wormholeNetworkIds;
    mapping(uint64 => uint64) wormholeCoreSequences;
    // LayerZero Data Transfer
    LayerZeroSettings layerZeroSettings;
    mapping(uint16 => uint16) layerZeroChainIds;
    mapping(uint16 => uint16) layerZeroNetworkIds;
    address magpieRouterAddress;
    mapping(uint16 => mapping(bytes32 => mapping(uint64 => mapping(address => uint256)))) stargateDeposits;
    mapping(uint8 => bool) delegatedCalls;
    // Celer Bridge
    CelerBridgeSettings celerBridgeSettings;
    mapping(uint16 => uint64) celerChainIds;
    mapping(uint16 => mapping(bytes32 => mapping(uint64 => mapping(address => uint256)))) celerDeposits;
    mapping(uint16 => mapping(bytes32 => mapping(uint64 => address))) celerRefundAddresses;
    mapping(uint16 => bytes32) magpieCelerBridgeAddresses;
    mapping(uint16 => mapping(uint16 => mapping(bytes32 => mapping(uint64 => bytes32)))) payloadHashes;
    mapping(uint16 => bytes32) magpieStargateBridgeV2Addresses;
}
Field
Type
Description

Address of the Wrapped Ether (WETH) contract.

The network ID associated with the application.

A mapping of network IDs to Magpie aggregator addresses.

Tracks the total deposits made by each user.

Tracks the deposits made by each user for specific token addresses.

Tracks the usage status of transfer keys for specific network IDs, sender addresses, and swap sequences.

A counter used for generating swap sequences.

A flag indicating whether the contract is paused or not.

A flag indicating whether reentrancy guard is enabled or not.

A mapping of network IDs to AMMs.

Contains settings related to Curve AMMs.

A mapping used for storing data transfer payloads.

Contains settings related to the Stargate bridge.

A mapping of network IDs to Magpie Stargate bridge addresses.

Contains settings related to the Wormhole Token bridge.

Tracks the token sequences for the Wormhole bridge.

Contains settings related to Wormhole data transfers.

A mapping of network IDs for the Wormhole bridge.

Tracks the core sequences for the Wormhole bridge.

Contains settings related to LayerZero data transfers.

A mapping of chain IDs for LayerZero data transfers.

A mapping of network IDs for LayerZero data transfers.

Address of the Magpie Router

A mapping to show how much amount has been deposited why which address along with the message passed by the address and the networkId

used to associate a boolean value (bool) with a single byte integer (uint8).

A mapping of chain IDs for celer bridge transfers.

A mapping of network Ids, data, chain Id, and address to the amount being deposited.

A mapping of network Ids, data, and chain id to the refund address.

A mapping of network ID to the magpie celer bridge address in the form of bytes.

A mapping of network ID to the magpie stargate bridge V2 address in the form of bytes.

getStorage():

returns a reference to the AppStorage struct.

Output:

Field
Type
Description

AppStorage struct.

Last updated