AggregatorFacet

The AggregatorFacet contract serves as the implementation of the IAggregator interface. It provides functions for updating settings, performing swaps, managing deposits, retrieving payloads, and checking transfer key usage. The functions enforce necessary checks and interact with the underlying LibAggregator library to execute the operations.

updateWeth()

The purpose of this function is to allow the contract owner to update the address of the WETH token used in the aggregator contract.

Input

FieldTypeDescription

weth

address

Address of wrapped native address (WETH for Ethereum, WMATIC for Polygon etc.)

updateMagpieRouterAddress()

the updateMagpieRouterAddress function is a straightforward administrative function that allows the contract owner to update a critical component of the system, in this case, the address of the Magpie Router.

Input

FieldTypeDescription

magpieRouterAddress

address

This new address is the updated address for the Magpie Router within the contract.

updateNetworkId()

The purpose of this function is to allow the contract owner to update the network ID used in the aggregator contract.

Input

FieldTypeDescription

networkId

uint16

networkId of the current chain in Magpie protocol, it is different from the actual networkId ethereum: 1 polygon: 2 bsc: 3 avalanche: 4 arbitrum: 5 optimism: 6

addMagpieAggregatorAddresses()

The purpose of this function is to allow the contract owner to add Magpie aggregator addresses for multiple network IDs in the aggregator contract.

Input

FieldTypeDescription

networkIds

uint16[]

networkIds of the networks we want to add

magpieAggregatorAddresses

bytes32[]

Address of MagpieAggregator contracts on the specified chains/networks

swapIn()

this function is responsible for executing a swap-in operation. It enforces various checks such as the deadline, pausing status, and custom guards.

Input

FieldTypeDescription

swapInArgs

SwapInArgs

SwapInArgs is a struct, its explained here

Output

FieldTypeDescription

amountOut

uint256

amountOut that you will receive after swapping tokens

swapOut()

this function is responsible for executing a swap-out operation. It enforces various checks such as the deadline, pausing status, and custom guards.

Input

FieldTypeDescription

swapOutArgs

SwapOutArgs

SwapOutArgs is a struct, its explained here

Output

FieldTypeDescription

amountOut

uint256

amountOut that you will receive after swapping tokens

getDeposit()

The purpose of this function is to allow external callers to retrieve the deposit amount for a specific asset in the aggregator contract.

Input

FieldTypeDescription

assetAddress

address

Address of the token for which you want to query deposit

Output

FieldTypeDescription

uint256

It returns the amount of deposited assets

withdraw()

The purpose of this function is to allow external callers to initiate the withdrawal of funds from the aggregator contract for a specific asset.

Input

FieldTypeDescription

assetAddress

address

Address of the token which will be withdrawn

getDepositByUser()

The purpose of this function is to allow external callers to retrieve the deposit amount for a specific asset deposited by a specific user in the aggregator contract.

Input

FieldTypeDescription

assetAddress

address

the address of the asset whose deposited amount needs to be retrieved

senderAddress

address

the address of the user who has deposited the asset

Output

FieldTypeDescription

amount

uint256

the deposited amount

isTransferKeyUsed()

The purpose of this function is to allow external callers to check if a specific transfer key has been used in the aggregator contract.

Input

FieldTypeDescription

networkId

uint16

the source network identifier provided by the magpie team for each bloackchain

senderAddress

bytes32

the address of the user

coreSequence

uint64

the sequence stored in our data base

Output

FieldTypeDescription

bool

True if the key has been used false if not

Last updated