Skip to main content

IComplianceFacet

Asset Tokenization Studio Team

IComplianceFacet

Interface for the Compliance facet that wires an external compliance contract, provides transfer eligibility checks, and exposes the compliance contract address.

Methods​

canTransfer​

function canTransfer(address _to, uint256 _value, bytes _data) external view returns (bool, bytes1, bytes32)

Checks if a transfer can be executed

Parameters​

NameTypeDescription
_toaddressThe recipient address
_valueuint256The amount of tokens to transfer
_databytesAdditional data for the transfer check

Returns​

NameTypeDescription
_0boolbool True if the transfer can be executed
_1bytes1bytes1 EIP1066 status code indicating the result
_2bytes32bytes32 Additional reason data for the result

canTransferFrom​

function canTransferFrom(address _from, address _to, uint256 _value, bytes _data) external view returns (bool, bytes1, bytes32)

Checks if a transferFrom can be executed

Parameters​

NameTypeDescription
_fromaddressThe sender address
_toaddressThe recipient address
_valueuint256The amount of tokens to transfer
_databytesAdditional data for the transfer check

Returns​

NameTypeDescription
_0boolbool True if the transfer can be executed
_1bytes1bytes1 EIP1066 status code indicating the result
_2bytes32bytes32 Additional reason data for the result

compliance​

function compliance() external view returns (contract ICompliance)

Returns the address of the compliance contract

Returns​

NameTypeDescription
_0contract IComplianceICompliance The compliance contract

initializeCompliance​

function initializeCompliance(address _compliance) external nonpayable

Initialises the compliance capability on the token and wires the compliance contract.

Callable once; subsequent calls revert with FacetAlreadyRegistered. Requires DEFAULT_ADMIN_ROLE. Called by the factory during deployment.

Parameters​

NameTypeDescription
_complianceaddressAddress of the compliance contract that authorises transfers.

setCompliance​

function setCompliance(address _compliance) external nonpayable

Sets the compliance contract address

Parameters​

NameTypeDescription
_complianceaddressThe address of the new compliance contract

Events​

ComplianceInitialized​

event ComplianceInitialized(address compliance)

Emitted once when the compliance capability is initialised on a token.

Fires exclusively from initializeCompliance.

Parameters​

NameTypeDescription
complianceaddressThe compliance contract address wired at initialisation.