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

Field
Type
Description

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

Field
Type
Description

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

Field
Type
Description

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

Field
Type
Description

networkIds of the networks we want to add

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

Field
Type
Description

Output

Field
Type
Description

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

Field
Type
Description

Output

Field
Type
Description

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

Field
Type
Description

Address of the token for which you want to query deposit

Output

Field
Type
Description

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

Field
Type
Description

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

Field
Type
Description

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

the address of the user who has deposited the asset

Output

Field
Type
Description

amount

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

Field
Type
Description

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

the address of the user

the sequence stored in our data base

Output

Field
Type
Description

True if the key has been used false if not

Last updated