Skip to content
LogoLogo

SwapModule

Git Source

Inherits: AccessManagedUpgradeable, MakinaContext, ISwapModule

Constants

SwapModuleStorageLocation

bytes32 private constant SwapModuleStorageLocation =
        0x2964c0594a3da0414db90b8d5f6c112accd22109f0399a98ea4b239ff3f7a200;

Functions

_getSwapModuleStorage

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

Returns

NameTypeDescription
$SwapModuleStorage

constructor

constructor(address _registry) MakinaContext(_registry);

Parameters

NameTypeDescription
_registryaddress

initialize

function initialize(address initialAuthority) external initializer;

Parameters

NameTypeDescription
initialAuthorityaddress

getSwapperTargets

Returns approval and execution targets for a given swapper ID.

function getSwapperTargets(uint16 swapperId)
        external
        view
        override
        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.

Returns

NameTypeDescription
<none>uint256

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.
executionTargetaddressThe execution target.

Structs

SwapModuleStorage

Note:

  • storage-location: erc7201:makina.storage.SwapModule
struct SwapModuleStorage {
        mapping(uint16 swapperId => SwapperTargets targets) _swapperTargets;
    }

Properties

NameTypeDescription
_swapperTargetsmapping(uint16 swapperId => SwapperTargets targets)