Skip to main content

ISwapManager.sol

Read code on GitHub

Methods

swap

Solidity
function swap(ISwapManager.SwapParams params) external payable

Parameters

NameTypeDescription
paramsISwapManager.SwapParamsundefined

swapCallback

Triggered when swapping tokens in an Engine

Solidity
function swapCallback(uint256 delRisky, uint256 delStable, bytes data) external nonpayable

Parameters

NameTypeDescription
delRiskyuint256Amount of risky tokens required to pay the swap with
delStableuint256Amount of stable tokens required to pay the swap with
databytesCalldata passed on swap function call

Events

Swap

Emitted when a swap occurs

Solidity
event Swap(address indexed payer, address recipient, address indexed engine, bytes32 indexed poolId, bool riskyForStable, uint256 deltaIn, uint256 deltaOut, bool fromMargin, bool toMargin)

Parameters

NameTypeDescription
payer indexedaddressAddress of the payer
recipientaddressAddress of the recipient
engine indexedaddressAddress of the engine
poolId indexedbytes32Id of the pool
riskyForStableboolTrue if swapping risky for stable
deltaInuint256Sent amount
deltaOutuint256Received amount
fromMarginboolTrue if the sent amount is taken from the margin
toMarginboolTrue if the received amount is sent to the margin

Errors

DeadlineReachedError

Thrown when the deadline is reached

Solidity
error DeadlineReachedError()