FlowERC721

Git Source

Inherits: ICloneableV2, IFlowERC721V4, FlowCommon, ERC721

State Variables

sEvalHandleTransfer

True if we need to eval handleTransfer on every transfer. For many tokens this will be false, so we don't want to invoke the external interpreter call just to cause a noop.

bool private sEvalHandleTransfer;

sEvalTokenURI

True if we need to eval tokenURI to build the token URI. For many tokens this will be false, so we don't want to invoke the external interpreter call just to cause a noop.

bool private sEvalTokenURI;

sEvaluable

The evaluable that contains the entrypoints for handleTransfer and tokenURI. This is only set if sEvalHandleTransfer or sEvalTokenURI is true.

Evaluable internal sEvaluable;

sBaseURI

The base URI for all token URIs. This is set during initialization and cannot be changed. The token URI evaluable can be used for dynamic token URIs from the base URI.

string private sBaseURI;

Functions

constructor

Forwards the FlowCommon constructor arguments to the FlowCommon.

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

supportsInterface

Needed here to fix Open Zeppelin implementing supportsInterface on multiple base contracts.

function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721, ERC1155Receiver) returns (bool);

initialize

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

function initialize(FlowERC721ConfigV2 memory) external pure;

initialize

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

_baseURI

Overrides the Open Zeppelin _baseURI hook to return the base URI set during initialization.

function _baseURI() internal view virtual override returns (string memory);

tokenURI

Overrides the Open Zeppelin tokenURI function to return the token URI calculated by the token URI evaluable. Currently the token URI evaluable can only return a single token ID value, and the token URI is built from that according to default Open Zeppelin logic. If the token URI evaluable is not set, then the default Open Zeppelin logic is used with the token ID passed in.

function tokenURI(uint256 tokenId) public view virtual override returns (string memory);

stackToFlow

As per IFlowV4 but returns a FlowERC721IOV1 instead of a FlowTransferV1.

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

flow

As per IFlowV4 but returns a FlowERC721IOV1 instead of a FlowTransferV1 and mints/burns itself as an ERC721 accordingly.

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

Parameters

NameTypeDescription
evaluableEvaluableThe Evaluable to use to evaluate the flow.
callerContextuint256[]The caller context to use to evaluate the flow.
signedContextsSignedContextV1[]The signed contexts to use to evaluate the flow.

Returns

NameTypeDescription
<none>FlowERC721IOV1flowERC721IO The FlowERC721IOV1 representing all token mint/burns and transfers that occurred during the flow.

_afterTokenTransfer

Exposes the Open Zeppelin _afterTokenTransfer hook as an evaluable entrypoint so that the deployer of the token can use it to implement custom transfer logic. The stack is ignored, so if the expression author wants to prevent some kind of transfer, they can just revert within the expression evaluation.

function _afterTokenTransfer(address from, address to, uint256 tokenId, uint256 batchSize) internal virtual override;

_stackToFlow

Wraps the standard LibFlow.stackToFlow with the additional logic to convert the stack to a FlowERC721IOV1 struct. This involves consuming the mints and burns from the stack as additional sentinel separated tuples. The mints are consumed first, then the burns, then the remaining stack is converted to a flow as normal.

function _stackToFlow(Pointer stackBottom, Pointer stackTop) internal pure returns (FlowERC721IOV1 memory);

Parameters

NameTypeDescription
stackBottomPointerThe bottom of the stack.
stackTopPointerThe top of the stack.

Returns

NameTypeDescription
<none>FlowERC721IOV1flowERC721IO The FlowERC721IOV1 representation of the stack.

_flow

Wraps the standard LibFlow.flow with the additional logic to handle self minting and burning. This involves consuming the mints and burns from the stack as additional sentinel separated tuples. The mints are consumed first, then the burns, then the remaining stack is converted to a flow as normal.

function _flow(Evaluable memory evaluable, uint256[] memory callerContext, SignedContextV1[] memory signedContexts)
    internal
    virtual
    nonReentrant
    returns (FlowERC721IOV1 memory);