IFluidWalletFactory

WALLET_PROXY

function WALLET_PROXY() external view returns (address)

InstaFlashReceiverInterface

executeOperation

function executeOperation(address[] assets, uint256[] amounts, uint256[] premiums, address initiator, bytes _data) external returns (bool)

FluidWalletVariables

VERSION

string VERSION

ETH_ADDRESS

address ETH_ADDRESS

X32

uint256 X32

VAULT_T1_FACTORY

address VAULT_T1_FACTORY

FLUID_WALLET_FACTORY

address FLUID_WALLET_FACTORY

owner

address owner

owner address of this wallet. It is initialized while deploying the wallet for the user.

_transientAllowHash

bytes32 _transientAllowHash

transient allow hash used to signal allowing certain entry into methods such as executeOperation etc.

_resetTransientStorage

function _resetTransientStorage() internal

FluidWalletErrorsAndEvents

FluidWallet__NotAllowed

error FluidWallet__NotAllowed()

FluidWallet__ToHexDigit

error FluidWallet__ToHexDigit()

FluidWallet__Unauthorized

error FluidWallet__Unauthorized()

Executed

event Executed(address owner, uint256 tokenId)

ExecutedCast

event ExecutedCast(address owner)

Action

struct Action {
  address target;
  bytes data;
  uint256 value;
  uint8 operation;
}

FluidWalletImplementation

constructor

constructor(address vaultT1Factory_, address fluidWalletFactory_) public

onERC721Received

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

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

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

function cast(struct FluidWalletErrorsAndEvents.Action[] actions_) public

executeOperation

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

Parameters

NameTypeDescription
address
uint256
uint256
initiator_addressflashloan initiator -> must be this contract
data_bytesdata bytes containing the abi.encoded() actions that are executed like in CastParams.actions

_calculateStorageSlotUintMapping

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

Calculating the slot ID for Liquidity contract for single mapping

_flushTokens

function _flushTokens(address owner_, uint256 tokenId_) internal

_validateOwner

function _validateOwner(address owner_) internal view

validate owner by recomputing fluid address.

_executeActions

function _executeActions(struct FluidWalletErrorsAndEvents.Action[] actions_) internal

_executes actions_ with respective target, calldata, operation etc._

_handleActionFailure

function _handleActionFailure(uint256 i_, bytes result_) internal pure

_handles failure of an action execution depending on error cause, decoding and reverting with result_ as reason string._

REVERT_REASON_MAX_LENGTH

uint256 REVERT_REASON_MAX_LENGTH

_getRevertReasonFromReturnedData

function _getRevertReasonFromReturnedData(bytes returnedData_) internal pure returns (string reason_)

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.

Parameters

NameTypeDescription
returnedData_bytesrevert data of the call

Return Values

NameTypeDescription
reason_stringrevert reason

_toHexDigit

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

used to convert bytes4 selector to string