Git Source

Inherits: RulesEngineClient

Author: @mpetersoCode55, @ShaneDuncan602, @TJ-Everett, @VoR0220, @Palmerg4

This contract is intended to be inherited and implemented by ERC1155 token contracts requiring Rules Engine integration.

Abstract contract containing modifiers and functions for integrating ERC1155 token operations with the Rules Engine. This contract provides policy checks for safeMint, transferFrom, and safeTransferFrom operations, both before and after execution.

Functions

checksPoliciesERC1155MintBefore

Modifier for checking policies before executing the safeMint function.

Calls the _checkPoliciesERC1155SafeMint function to evaluate policies.

modifier checksPoliciesERC1155MintBefore(address to, uint256 tokenId, uint256 value, bytes memory data);

Parameters

NameTypeDescription
toaddressThe receiving address.
tokenIduint256The token identifier.
valueuint256The value of tokenId being transfered.
databytesGeneric data to pass along with the transfer.

checksPoliciesERC1155MintAfter

Modifier for checking policies after executing the safeMint function.

Calls the _checkPoliciesERC1155SafeMint function to evaluate policies.

modifier checksPoliciesERC1155MintAfter(address to, uint256 tokenId, uint256 value, bytes memory data);

Parameters

NameTypeDescription
toaddressThe receiving address.
tokenIduint256The token identifier.
valueuint256The value of tokenId being transfered.
databytesGeneric data to pass along with the transfer.

checksPoliciesERC1155BatchMintBefore

Modifier for checking policies before executing the safeMint function.

Calls the _checkPoliciesERC1155SafeMint function to evaluate policies.

modifier checksPoliciesERC1155BatchMintBefore(
    address to,
    uint256[] memory tokenIds,
    uint256[] memory values,
    bytes memory data
);

Parameters

NameTypeDescription
toaddressThe receiving address.
tokenIdsuint256[]The token identifiers.
valuesuint256[]The values of tokenIds being transfered.
databytesGeneric data to pass along with the transfer.

checksPoliciesERC1155BatchMintAfter

Modifier for checking policies after executing the safeMint function.

Calls the _checkPoliciesERC1155SafeMint function to evaluate policies.

modifier checksPoliciesERC1155BatchMintAfter(
    address to,
    uint256[] memory tokenIds,
    uint256[] memory values,
    bytes memory data
);

Parameters

NameTypeDescription
toaddressThe receiving address.
tokenIdsuint256[]The token identifiers.
valuesuint256[]The values of tokenIds being transfered.
databytesGeneric data to pass along with the transfer.

checksPoliciesERC1155SafeTransferFromBefore

Modifier for checking policies before executing the safeTransferFrom function.

Calls the _checkPoliciesERC1155SafeTransferFrom function to evaluate policies.

modifier checksPoliciesERC1155SafeTransferFromBefore(
    address from,
    address to,
    uint256 tokenId,
    uint256 value,
    bytes memory data
);

Parameters

NameTypeDescription
fromaddressThe sending address.
toaddressThe receiving address.
tokenIduint256The token identifier.
valueuint256The value of tokenId being transfered.
databytesGeneric data to pass along with the transfer.

checksPoliciesERC1155SafeTransferFromAfter

Modifier for checking policies after executing the safeTransferFrom function.

Calls the _checkPoliciesERC1155SafeTransferFrom function to evaluate policies.

modifier checksPoliciesERC1155SafeTransferFromAfter(
    address from,
    address to,
    uint256 tokenId,
    uint256 value,
    bytes memory data
);

Parameters

NameTypeDescription
fromaddressThe sending address.
toaddressThe receiving address.
tokenIduint256The token identifier.
valueuint256The value of tokenId being transfered.
databytesGeneric data to pass along with the transfer.

checksPoliciesERC1155SafeBatchTransferFromBefore

Modifier for checking policies before executing the transferFrom function.

Calls the _checkPoliciesERC1155TransferFrom function to evaluate policies.

modifier checksPoliciesERC1155SafeBatchTransferFromBefore(
    address from,
    address to,
    uint256[] memory tokenIds,
    uint256[] memory values,
    bytes memory data
);

Parameters

NameTypeDescription
fromaddressThe sending address.
toaddressThe receiving address.
tokenIdsuint256[]The token identifiers.
valuesuint256[]The values of tokenIds being transfered.
databytes

checksPoliciesERC1155SafeBatchTransferFromAfter

Modifier for checking policies before executing the transferFrom function.

Calls the _checkPoliciesERC1155TransferFrom function to evaluate policies.

modifier checksPoliciesERC1155SafeBatchTransferFromAfter(
    address from,
    address to,
    uint256[] memory tokenIds,
    uint256[] memory values,
    bytes memory data
);

Parameters

NameTypeDescription
fromaddressThe sending address.
toaddressThe receiving address.
tokenIdsuint256[]The token identifiers.
valuesuint256[]The values of tokenIds being transfered.
databytes

_checkPoliciesERC1155Mint

Calls the Rules Engine to evaluate policies for an ERC1155 Mint operation.

Encodes the parameters and invokes the _invokeRulesEngine function.

function _checkPoliciesERC1155Mint(address _to, uint256 _tokenId, uint256 _value, bytes memory _data) internal;

Parameters

NameTypeDescription
_toaddressThe receiving address.
_tokenIduint256The token identifier.
_valueuint256The value of tokenId being transfered.
_databytesGeneric data to pass along with the transfer.

_checkPoliciesERC1155MintBatch

Calls the Rules Engine to evaluate policies for an ERC1155 MintBatch operation.

Encodes the parameters and invokes the _invokeRulesEngine function.

function _checkPoliciesERC1155MintBatch(
    address _to,
    uint256[] memory _tokenIds,
    uint256[] memory _values,
    bytes memory _data
) internal;

Parameters

NameTypeDescription
_toaddressThe receiving address.
_tokenIdsuint256[]The token identifiers.
_valuesuint256[]The values of tokenIds being transfered.
_databytesGeneric data to pass along with the transfer.

_checkPoliciesERC1155SafeTransferFrom

Calls the Rules Engine to evaluate policies for an ERC1155 safeTransferFrom operation.

Encodes the parameters and invokes the _invokeRulesEngine function.

function _checkPoliciesERC1155SafeTransferFrom(
    address _from,
    address _to,
    uint256 _tokenId,
    uint256 _value,
    bytes memory _data
) internal;

Parameters

NameTypeDescription
_fromaddressThe sending address.
_toaddressThe receiving address.
_tokenIduint256The token identifier.
_valueuint256The value of tokenId being transfered.
_databytesGeneric data to pass along with the transfer.

_checkPoliciesERC1155SafeBatchTransferFrom

Calls the Rules Engine to evaluate policies for an ERC1155 safeTransferFrom operation.

Encodes the parameters and invokes the _invokeRulesEngine function.

function _checkPoliciesERC1155SafeBatchTransferFrom(
    address _from,
    address _to,
    uint256[] memory _tokenIds,
    uint256[] memory _values,
    bytes memory _data
) internal;

Parameters

NameTypeDescription
_fromaddressThe sending address.
_toaddressThe receiving address.
_tokenIdsuint256[]The token identifiers.
_valuesuint256[]The values of tokenIds being transfered.
_databytesGeneric data to pass along with the transfer.

_checkPoliciesERC1155TransferFrom

Calls the Rules Engine to evaluate policies for an ERC1155 transferFrom operation.

Encodes the parameters and invokes the _invokeRulesEngine function.

function _checkPoliciesERC1155TransferFrom(address _from, address _to, uint256 _tokenId) internal;

Parameters

NameTypeDescription
_fromaddressThe sending address.
_toaddressThe receiving address.
_tokenIduint256The token identifier.