Skip to content

FluidWalletImplementation ​

Git Source

Inherits:FluidWalletVariables, FluidWalletErrorsAndEvents

State Variables ​

REVERT_REASON_MAX_LENGTH ​

solidity
uint256 internal constant REVERT_REASON_MAX_LENGTH = 250;

Functions ​

constructor ​

solidity
constructor(address vaultFactory_, address fluidWalletFactory_);

onERC721Received ​

ERC721 callback used Fluid Vault Factory and executes actions encoded in data_ Caller should be Fluid Wallet Factory.

solidity
function onERC721Received(address operator_, address from_, uint256 tokenId_, bytes calldata data_)
    external
    returns (bytes4);

Parameters

NameTypeDescription
operator_addressoperator_ caller to transfer the the given token ID
from_addressfrom_ previous owner of the given token ID
tokenId_uint256tokenId_ id of the ERC721
data_bytesdata bytes containing the abi.encoded() actions that are executed like in Action[] & owner

cast ​

solidity
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

solidity
function executeOperation(
    address[] calldata,
    uint256[] calldata,
    uint256[] calldata,
    address initiator_,
    bytes calldata data_
) external returns (bool);

Parameters

NameTypeDescription
<none>address[]
<none>uint256[]
<none>uint256[]
initiator_addressflashloan initiator -> must be this contract
data_bytesdata 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

solidity
function _calculateStorageSlotUintMapping(uint256 slot_, uint256 key_) internal pure returns (bytes32);

_sweepTokens ​

solidity
function _sweepTokens(address owner_, uint256 tokenId_) internal;

_getVaultConstants ​

solidity
function _getVaultConstants(address vault_) internal view returns (VaultConstants memory constants_);

_flushTokens ​

solidity
function _flushTokens(address token_, address owner_) internal;

_validateOwner ​

validate owner by recomputing fluid address.

solidity
function _validateOwner(address owner_) internal view;

_executeActions ​

executes actions_ with respective target, calldata, operation etc.

solidity
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.

solidity
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.

solidity
function _getRevertReasonFromReturnedData(bytes memory returnedData_) internal pure returns (string memory reason_);

Parameters

NameTypeDescription
returnedData_bytesrevert data of the call

Returns

NameTypeDescription
reason_stringrevert reason

_toHexDigit ​

used to convert bytes4 selector to string

solidity
function _toHexDigit(uint8 d) internal pure returns (bytes1);

Structs ​

VaultConstants ​

solidity
struct VaultConstants {
    address supplyToken0;
    address supplyToken1;
    address borrowToken0;
    address borrowToken1;
}