MethodWhitelist

Managing and retrieving whitelisted method selectors

SENTINEL_SELECTOR

bytes4 SENTINEL_SELECTOR

Special selector value threated as sentinel

_restrictedMethods

mapping(bytes4 => bool) _restrictedMethods

This is applied to all tokens in collection

Method selector to boolean if method whitelisting is restricted

_whitelistedMethods

mapping(uint256 => struct IMethodWhitelist.Whitelisted[]) _whitelistedMethods

This is applied per token

Token ID to array of whitelisted method selectors

_selectorToIndex

mapping(uint256 => mapping(bytes4 => uint256)) _selectorToIndex

If index is bigger then sentinel index is threated as invalid value

setRestrictedMethods

function setRestrictedMethods(bytes4[] restricted) public virtual

Sets methods as restricted for whitelisting

Parameters

Name
Type
Description

restricted

bytes4[]

Array of selectors

setWhitelistedMethods

function setWhitelistedMethods(uint256 tokenId, struct WhitelistedParams[] whitelistParams) public virtual

Sets whitelisted methods for given token

Parameters

Name
Type
Description

tokenId

uint256

Token identifier

whitelistParams

struct WhitelistedParams[]

getMethodRestricted

function getMethodRestricted(bytes4 selector) external view returns (bool)

Returns if selector is restricted for whitelisting

Parameters

Name
Type
Description

selector

bytes4

Method selector

Return Values

Name
Type
Description

[0]

bool

Flag if method is restricted

getMethodWhitelisted

function getMethodWhitelisted(uint256 tokenId, bytes4 selector) public view returns (bool whitelisted)

Returns if method is whitelisted

Parameters

Name
Type
Description

tokenId

uint256

Token identifier

selector

bytes4

Method selector

Return Values

Name
Type
Description

whitelisted

bool

Flag if method is whitelisted

getWhitelistedMethods

function getWhitelistedMethods(uint256 tokenId) external view returns (struct IMethodWhitelist.Whitelisted[] whitelist)

Returns all whitelisted methods as array of Whitelisted structs

Parameters

Name
Type
Description

tokenId

uint256

Token identifier

Return Values

Name
Type
Description

whitelist

struct IMethodWhitelist.Whitelisted[]

Array of Whitelisted methods

getSentinelIndex

function getSentinelIndex(uint256 tokenId) public view returns (uint256)

Returns sentinel index for given tokenId

Parameters

Name
Type
Description

tokenId

uint256

Token identifier

Return Values

Name
Type
Description

[0]

uint256

Sentinel index

_incWhitelistedCallCount

function _incWhitelistedCallCount(uint256 tokenId, bytes4 selector) internal

Incements call count for given selector and token

Parameters

Name
Type
Description

tokenId

uint256

Token identifier

selector

bytes4

Method selector

_resetWhitelistedCallCount

function _resetWhitelistedCallCount(uint256 tokenId) internal

Resets call count for given token

Parameters

Name
Type
Description

tokenId

uint256

Token identifier

__gap

uint256[47] __gap

Last updated