Flow

Git Source

Inherits: ICloneableV2, IFlowV4, FlowCommon

Functions

constructor

Forwards to FlowCommon constructor.

constructor(DeployerDiscoverableMetaV2ConstructionConfig memory config) FlowCommon(CALLER_META_HASH, config);

initialize

Overloaded typed initialize function MUST revert with this error. As per ICloneableV2 interface.

function initialize(EvaluableConfigV2[] memory) external pure;

initialize

function initialize(bytes calldata data) external initializer returns (bytes32);

stackToFlow

Given a stack of values, convert it to a flow transfer. MUST NOT modify state but MAY revert if the stack is malformed. The intended workflow is that the interpreter contract is called to produce a stack then the stack is converted to a flow transfer struct, to allow the caller to preview a flow before actually executing it. By accepting a stack as input, the caller can preview any possible flow, not just ones that have been registered with the flow contract, and can preview flows that may not even be possible to execute due to the state of the tokens, or access gating that would exclude the caller, etc.

function stackToFlow(uint256[] memory stack) external pure virtual override returns (FlowTransferV1 memory);

Parameters

NameTypeDescription
stackuint256[]The stack of values to convert to a flow transfer.

Returns

NameTypeDescription
<none>FlowTransferV1flowTransfer The resulting flow transfer.

flow

Given an evaluable, caller context, and signed contexts, evaluate the evaluable and return the resulting flow transfer. MUST process the flow transfer atomically, either all of it succeeds or none of it succeeds. MUST revert if the evaluable is not registered with the flow contract. MUST revert if the evaluable reverts. MUST revert if the evaluable returns a stack that is malformed. MUST revert if the evaluable returns a stack that contains a token transfer that is not allowed by the flow contract (e.g. if a token is being moved from an address that is not the caller or the flow contract).

function flow(Evaluable memory evaluable, uint256[] memory callerContext, SignedContextV1[] memory signedContexts)
    external
    virtual
    nonReentrant
    returns (FlowTransferV1 memory);

Parameters

NameTypeDescription
evaluableEvaluableThe evaluable to evaluate.
callerContextuint256[]The caller context to pass to the evaluable.
signedContextsSignedContextV1[]The signed contexts to pass to the evaluable.

Returns

NameTypeDescription
<none>FlowTransferV1flowTransfer The resulting flow transfer.