FlashLoanModule
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
| Name | Type | Description |
|---|---|---|
| _moduleFactory | address | |
| _morpho | address |
requestFlashLoan
Requests a flash loan.
function requestFlashLoan(FlashLoanRequest calldata request) external override;Parameters
| Name | Type | Description |
|---|---|---|
| request | FlashLoanRequest | The request for the flash loan. |
onMorphoFlashLoan
function onMorphoFlashLoan(uint256 assets, bytes calldata data) external;Parameters
| Name | Type | Description |
|---|---|---|
| assets | uint256 | |
| data | bytes |
_dispatchFlashLoanRequest
Dispatches the flash loan request to the appropriate provider.
function _dispatchFlashLoanRequest(FlashLoanRequest calldata request) internal;Parameters
| Name | Type | Description |
|---|---|---|
| request | FlashLoanRequest |
_requestMorphoFlashLoan
Requests a flash loan from Morpho.
function _requestMorphoFlashLoan(FlashLoanRequest calldata request) internal;Parameters
| Name | Type | Description |
|---|---|---|
| request | FlashLoanRequest |
_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
| Name | Type | Description |
|---|---|---|
| data | bytes |
_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
| Name | Type | Description |
|---|---|---|
| data | bytes |
_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
| Name | Type | Description |
|---|---|---|
| makinaXModule | address | |
| instruction | IWeirollComponent.Instruction | |
| token | address | |
| amount | uint256 |