Skip to main content

ICallback

Git Source

This interface should be implemented by anyone wishing to use callbacks in the swap, borrow, and borrowLiquidity functions in the IAmmalgamPair interface.

Functions

ammalgamSwapCallV1

Handles a swap call in the Ammalgam protocol.

Callback passed as calldata to swap functions in IAmmalgamPair.

function ammalgamSwapCallV1(
address sender,
uint256 amountXAssets,
uint256 amountYAssets,
bytes calldata data
) external;

Parameters

NameTypeDescription
senderaddressThe address of the sender initiating the swap call.
amountXAssetsuint256The amount of token X involved in the swap.
amountYAssetsuint256The amount of token Y involved in the swap.
databytesThe calldata provided to the swap function.

ammalgamBorrowCallV1

function ammalgamBorrowCallV1(
address sender,
uint256 amountXAssets,
uint256 amountYAssets,
uint256 amountXShares,
uint256 amountYShares,
bytes calldata data
) external;

Parameters

NameTypeDescription
senderaddress
amountXAssetsuint256The amount of token X involved in the borrow.
amountYAssetsuint256The amount of token Y involved in the borrow.
amountXSharesuint256The shares of token X involved in the borrow.
amountYSharesuint256The shares of token Y involved in the borrow.
databytesThe calldata provided to the borrow function.

ammalgamBorrowLiquidityCallV1

function ammalgamBorrowLiquidityCallV1(
address sender,
uint256 amountXAssets,
uint256 amountYAssets,
uint256 amountLShares,
bytes calldata data
) external;

Parameters

NameTypeDescription
senderaddress
amountXAssetsuint256The amount of token X involved in the borrow.
amountYAssetsuint256The amount of token Y involved in the borrow.
amountLSharesuint256The shares of liquidity involved in the borrow.
databytesThe calldata provided to the borrow function.

ammalgamLiquidateCallV1

Handles a liquidate call in the Ammalgam protocol. The callback is expected to transfer repayXInXAssets and repayYInYAssets from the liquidator to the pair.

function ammalgamLiquidateCallV1(uint256 repayXInXAssets, uint256 repayYInYAssets) external;

Parameters

NameTypeDescription
repayXInXAssetsuint256The amount of token X the liquidator should transfer to the pair.
repayYInYAssetsuint256The amount of token Y the liquidator should transfer to the pair.