Skip to content
LogoLogo

FlashLoanModule

Git Source

Inherits: IFlashLoanModule

Constants

EXPECTED_DATA_HASH_SLOT

bytes32 private constant EXPECTED_DATA_HASH_SLOT =
        0x5a3c23131f48fa65e051159c96653778099b9ec7df69c3ed6471d5a36605bd00;

moduleFactory

Address of the MakinaXModule factory.

address public immutable moduleFactory;

morpho

Address of the Morpho contract.

address public immutable morpho;

Functions

constructor

constructor(address _moduleFactory, address _morpho);

Parameters

NameTypeDescription
_moduleFactoryaddress
_morphoaddress

requestFlashLoan

Requests a flash loan.

function requestFlashLoan(FlashLoanRequest calldata request) external override;

Parameters

NameTypeDescription
requestFlashLoanRequestThe request for the flash loan.

onMorphoFlashLoan

function onMorphoFlashLoan(uint256 assets, bytes calldata data) external;

Parameters

NameTypeDescription
assetsuint256
databytes

_dispatchFlashLoanRequest

Dispatches the flash loan request to the appropriate provider.

function _dispatchFlashLoanRequest(FlashLoanRequest calldata request) internal;

Parameters

NameTypeDescription
requestFlashLoanRequest

_requestMorphoFlashLoan

Requests a flash loan from Morpho.

function _requestMorphoFlashLoan(FlashLoanRequest calldata request) internal;

Parameters

NameTypeDescription
requestFlashLoanRequest

_setExpectedDataHash

Sets the expected data hash in transient storage to be used for validation in the flash loan callback.

function _setExpectedDataHash(bytes memory data) internal;

Parameters

NameTypeDescription
databytes

_consumeExpectedDataHash

Checks if the expected data hash matches the hash of the provided data and clears the expected data hash from transient storage.

function _consumeExpectedDataHash(bytes memory data) internal;

Parameters

NameTypeDescription
databytes

_handleFlashLoanCallback

Delegates management of flash-loaned funds to the specified MakinaXModule.

function _handleFlashLoanCallback(
        address makinaXModule,
        IWeirollComponent.Instruction memory instruction,
        address token,
        uint256 amount
    ) internal;

Parameters

NameTypeDescription
makinaXModuleaddress
instructionIWeirollComponent.Instruction
tokenaddress
amountuint256