Skip to content
LogoLogo

ISwapComponent

Git Source

Functions

maxSwapLossBps

Max allowed value loss (in basis points) for token swaps while in FENCED or WALLED mode.

function maxSwapLossBps() external view returns (uint256);

Returns

NameTypeDescription
<none>uint256

swapCooldownDuration

Cooldown duration (in seconds) for token swaps while in FENCED or WALLED mode.

function swapCooldownDuration() external view returns (uint256);

Returns

NameTypeDescription
<none>uint256

swapFeeRate

Swap fee rate, 1e18 = 100%.

function swapFeeRate() external view returns (uint256);

Returns

NameTypeDescription
<none>uint256

getSwapperTargets

Returns approval and execution targets for a given swapper ID.

function getSwapperTargets(uint16 swapperId) external view returns (address approvalTarget, address executionTarget);

Parameters

NameTypeDescription
swapperIduint16The swapper ID.

Returns

NameTypeDescription
approvalTargetaddressThe approval target.
executionTargetaddressThe execution target.

swap

Swaps tokens on behalf of the Safe using a given swapper.

function swap(SwapOrder calldata order) external;

Parameters

NameTypeDescription
orderSwapOrderThe swap params.

setMaxSwapLossBps

Sets the maximum allowed relative value loss for token swaps while in FENCED or WALLED mode.

function setMaxSwapLossBps(uint256 newMaxSwapLossBps) external;

Parameters

NameTypeDescription
newMaxSwapLossBpsuint256The new maximum value loss in basis points.

setSwapCooldownDuration

Sets the cooldown duration for token swaps while in FENCED or WALLED mode.

function setSwapCooldownDuration(uint256 newSwapCooldownDuration) external;

Parameters

NameTypeDescription
newSwapCooldownDurationuint256The new cooldown duration in seconds.

setSwapFeeRate

Sets the swap fee rate.

function setSwapFeeRate(uint256 newSwapFeeRate) external;

Parameters

NameTypeDescription
newSwapFeeRateuint256The new swap fee rate, 1e18 = 100%.

setSwapperTargets

Sets approval and execution targets for a given swapper ID.

function setSwapperTargets(uint16 swapperId, address approvalTarget, address executionTarget) external;

Parameters

NameTypeDescription
swapperIduint16The swapper ID.
approvalTargetaddressThe approval target.
executionTargetaddressThe execution target.

Events

MaxSwapLossBpsChanged

event MaxSwapLossBpsChanged(uint256 oldMaxSwapLossBps, uint256 newMaxSwapLossBps);

Parameters

NameTypeDescription
oldMaxSwapLossBpsuint256
newMaxSwapLossBpsuint256

Swap

event Swap(
        uint16 indexed swapperId,
        address indexed inputToken,
        address indexed outputToken,
        uint256 inputAmount,
        uint256 outputAmount
    );

Parameters

NameTypeDescription
swapperIduint16
inputTokenaddress
outputTokenaddress
inputAmountuint256
outputAmountuint256

SwapCooldownDurationChanged

event SwapCooldownDurationChanged(uint256 oldSwapCooldownDuration, uint256 newSwapCooldownDuration);

Parameters

NameTypeDescription
oldSwapCooldownDurationuint256
newSwapCooldownDurationuint256

SwapFeeRateChanged

event SwapFeeRateChanged(uint256 oldSwapFeeRate, uint256 newSwapFeeRate);

Parameters

NameTypeDescription
oldSwapFeeRateuint256
newSwapFeeRateuint256

SwapperTargetsSet

event SwapperTargetsSet(uint16 indexed swapperId, address approvalTarget, address executionTarget);

Parameters

NameTypeDescription
swapperIduint16
approvalTargetaddress
executionTargetaddress

Structs

SwapperTargets

struct SwapperTargets {
        address approvalTarget;
        address executionTarget;
    }

Properties

NameTypeDescription
approvalTargetaddress
executionTargetaddress

SwapOrder

Generic swap params.

struct SwapOrder {
        uint16 swapperId;
        bytes data;
        address inputToken;
        address outputToken;
        uint256 inputAmount;
        uint256 minOutputAmount;
    }

Properties

NameTypeDescription
swapperIduint16The ID of the external swap protocol.
databytesThe swap calldata to pass to the swapper's execution target.
inputTokenaddressThe input token.
outputTokenaddressThe output token.
inputAmountuint256The input amount.
minOutputAmountuint256The minimum expected output amount.