Skip to main content

SwapModule

Git Source

Inherits: AccessManagedUpgradeable, MakinaContext, ISwapModule

State Variables

SwapModuleStorageLocation

bytes32 private constant SwapModuleStorageLocation = 0x2964c0594a3da0414db90b8d5f6c112accd22109f0399a98ea4b239ff3f7a200;

Functions

_getSwapModuleStorage

function _getSwapModuleStorage() private pure returns (SwapModuleStorage storage $);

constructor

constructor(address _registry) MakinaContext(_registry);

initialize

function initialize(address _initialAuthority) external initializer;

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 using a given swapper.

function swap(SwapOrder calldata order) external override returns (uint256);

Parameters

NameTypeDescription
orderSwapOrderThe swap order object.

setSwapperTargets

Sets approval and execution targets for a given swapper ID.

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

Parameters

NameTypeDescription
swapperIduint16The swapper ID.
approvalTargetaddressThe approval target.
executionTargetaddress

Structs

SwapModuleStorage

Note: storage-location: erc7201:makina.storage.SwapModule

struct SwapModuleStorage {
mapping(uint16 swapperId => SwapperTargets targets) _swapperTargets;
}