FluidWalletImplementation ​
Inherits:FluidWalletVariables, FluidWalletErrorsAndEvents
State Variables ​
REVERT_REASON_MAX_LENGTH ​
uint256 internal constant REVERT_REASON_MAX_LENGTH = 250;Functions ​
constructor ​
constructor(address vaultFactory_, address fluidWalletFactory_);onERC721Received ​
ERC721 callback used Fluid Vault Factory and executes actions encoded in data_ Caller should be Fluid Wallet Factory.
function onERC721Received(address operator_, address from_, uint256 tokenId_, bytes calldata data_)
external
returns (bytes4);Parameters
| Name | Type | Description |
|---|---|---|
operator_ | address | operator_ caller to transfer the the given token ID |
from_ | address | from_ previous owner of the given token ID |
tokenId_ | uint256 | tokenId_ id of the ERC721 |
data_ | bytes | data bytes containing the abi.encoded() actions that are executed like in Action[] & owner |
cast ​
function cast(Action[] memory actions_) public payable;executeOperation ​
| | FLASHLOAN CALLBACK | |__________________________________
callback used by Instadapp Flashloan Aggregator, executes operations while owning the flashloaned amounts. data_ must contain actions, one of them must pay back flashloan
function executeOperation(
address[] calldata,
uint256[] calldata,
uint256[] calldata,
address initiator_,
bytes calldata data_
) external returns (bool);Parameters
| Name | Type | Description |
|---|---|---|
<none> | address[] | |
<none> | uint256[] | |
<none> | uint256[] | |
initiator_ | address | flashloan initiator -> must be this contract |
data_ | bytes | data bytes containing the abi.encoded() actions that are executed like in CastParams.actions |
_calculateStorageSlotUintMapping ​
| | INTERNAL HELPERS | |__________________________________
Calculating the slot ID for Liquidity contract for single mapping
function _calculateStorageSlotUintMapping(uint256 slot_, uint256 key_) internal pure returns (bytes32);_sweepTokens ​
function _sweepTokens(address owner_, uint256 tokenId_) internal;_getVaultConstants ​
function _getVaultConstants(address vault_) internal view returns (VaultConstants memory constants_);_flushTokens ​
function _flushTokens(address token_, address owner_) internal;_validateOwner ​
validate owner by recomputing fluid address.
function _validateOwner(address owner_) internal view;_executeActions ​
executes actions_ with respective target, calldata, operation etc.
function _executeActions(Action[] memory actions_) internal;_handleActionFailure ​
handles failure of an action execution depending on error cause, decoding and reverting with result_ as reason string.
function _handleActionFailure(uint256 i_, bytes memory result_) internal pure;_getRevertReasonFromReturnedData ​
Get the revert reason from the returnedData (supports Panic, Error & Custom Errors). Based on https://github.com/superfluid-finance/protocol-monorepo/blob/dev/packages/ethereum-contracts/contracts/libs/CallUtils.sol This is needed in order to provide some human-readable revert message from a call.
function _getRevertReasonFromReturnedData(bytes memory returnedData_) internal pure returns (string memory reason_);Parameters
| Name | Type | Description |
|---|---|---|
returnedData_ | bytes | revert data of the call |
Returns
| Name | Type | Description |
|---|---|---|
reason_ | string | revert reason |
_toHexDigit ​
used to convert bytes4 selector to string
function _toHexDigit(uint8 d) internal pure returns (bytes1);Structs ​
VaultConstants ​
struct VaultConstants {
address supplyToken0;
address supplyToken1;
address borrowToken0;
address borrowToken1;
}
