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;
}
FieldTypeDescription
mainRegistry
address

Address of the main registry of the curve protocol.

cryptoRegistry
address

Address of the crypto registry of the curve protocol

cryptoFactory
address

Address of the crypto factory of the crypto factory

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

The protocol identifier provided by magpie team.

selector
bytes4

The function selector of the AMM.

addr
address

The address of the facet of the AMM.

struct WormholeBridgeSettings {
    address bridgeAddress;
}
Field TypeDescription
bridgeAddress
address

The wormhole token bridge address

struct StargateSettings {
    address routerAddress;
}
FieldTypeDescription
routerAddress
address

The stargate router address.

struct WormholeSettings {
    address bridgeAddress;
    uint8 consistencyLevel;
}
FieldTypeDescription
bridgeAddress
address

The wormhole core bridge address.

consistencyLevel
uint8

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

struct LayerZeroSettings {
    address routerAddress;
}
FieldTypeDescription
routerAddress
address

The router address of layer zero protocol

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;
}
FieldTypeDescription
weth

address

Address of the Wrapped Ether (WETH) contract.

networkId

uint16

The network ID associated with the application.

magpieAggregatorAddresses

 mapping(uint16 => bytes32)

A mapping of network IDs to Magpie aggregator addresses.

deposits

mapping(address => uint256)

Tracks the total deposits made by each user.

depositsByUser

mapping(address => mapping(address => uint256))

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

usedTransferKeys

mapping(uint16 => mapping(bytes32 => mapping(uint64 => bool)))

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

swapSequence

uint64

A counter used for generating swap sequences.

paused

bool

A flag indicating whether the contract is paused or not.

guarded

bool

A flag indicating whether reentrancy guard is enabled or not.

amms

mapping(uint16 => Amm)

A mapping of network IDs to AMMs.

curveSettings

CurveSettings

Contains settings related to Curve AMMs.

payloads

mapping(uint16 => mapping(uint16 => mapping(bytes32 => mapping(uint64 => bytes))))

A mapping used for storing data transfer payloads.

stargateSettings

StargateSettings

Contains settings related to the Stargate bridge.

magpieStargateBridgeAddresses

mapping(uint16 => bytes32)

A mapping of network IDs to Magpie Stargate bridge addresses.

wormholeBridgeSettings

WormholeBridgeSettings

Contains settings related to the Wormhole Token bridge.

wormholeTokenSequences

mapping(uint64 => uint64)

Tracks the token sequences for the Wormhole bridge.

wormholeSettings

WormholeSettings

Contains settings related to Wormhole data transfers.

wormholeNetworkIds

mapping(uint16 => uint16)

A mapping of network IDs for the Wormhole bridge.

wormholeCoreSequences

mapping(uint64 => uint64)

Tracks the core sequences for the Wormhole bridge.

layerZeroSettings

LayerZeroSettings

Contains settings related to LayerZero data transfers.

layerZeroChainIds

mapping(uint16 => uint16)

A mapping of chain IDs for LayerZero data transfers.

layerZeroNetworkIds

 mapping(uint16 => uint16)

A mapping of network IDs for LayerZero data transfers.

getStorage():

returns a reference to the AppStorage struct.

Output:

FieldTypeDescription

s

AppStorage

AppStorage struct.

Last updated