MagpieCelerBridge

MagpieCelerBridge, which serves as an intermediary to handle deposits, withdrawals, and refunds of assets between Magpie Aggregator and Celer Network.

It has two modifiers:

onlyMagpieAggregator:

Restricts functions to only be called by the Magpie Aggregator.

onlyCeler:

Restricts functions to only be called by the Celer Network.

It contains the following functions:

updateSettings():

Allows the owner to update the contract settings.

Input

Field
Type
Description

_settings

Settings

struct Settings {
        address aggregatorAddress;
        address messageBusAddress;
    }

deposit():

Handles the deposit process by receiving funds, approving tokens, sending them to the liquidity bridge, and notifying the message bus.

Input

depositArgs

DepositArgs

struct DepositArgs {
        uint32 slippage;
        uint64 chainId;
        uint256 amount;
        address sender;
        address receiver;
        address assetAddress;
        TransferKey transferKey;
    }

withdraw():

Handles withdrawal requests from deposited amounts.

Input

Field
Type
Description

withdrawArgs

WithdrawArgs

struct WithdrawArgs {
        address assetAddress;
        TransferKey transferKey;
    }

Output

Field
Type
Description

amount

uint256

The withdrawal amount

executeMessageWithTransfer():

Receives transfers and updates the deposited amounts accordingly.

Input

Field
Type
Description

address

assetAddress

address

amount

uint256

uint64

payload

bytes

address

Output

Field
Type
Description

IMessageBus.TxStatus

enum TxStatus {
        Null,
        Success,
        Fail,
        Fallback,
        Pending 
    }

executeMessageWithTransferRefund():

Manages refunds to the designated recipient.

Input

Field
Type
Description

assetAddress

address

amount

uint256

payload

bytes

address

Output

Field
Type
Description

IMessageBus.TxStatus

enum TxStatus {
        Null,
        Success,
        Fail,
        Fallback,
        Pending 
    }

Last updated