Skip to main content

ControllerFacet

Asset Tokenization Studio Team

ControllerFacet

Diamond facet exposing ERC-1644 forced-transfer operations and ERC-3643 agent management.

Registers nine selectors: initializeController, isControllable, controllerTransfer, controllerRedeem, finalizeControllable, forcedTransfer, addAgent, removeAgent, and isAgent. Inherits all business logic from the Controller abstract contract.

Methods​

addAgent​

function addAgent(address _agent) external nonpayable

Gives an account the agent role.Granting an agent role allows the account to perform multiple ERC-1400 actions.

Can only be called by the role admin.

Parameters​

NameTypeDescription
_agentaddressAddress to be granted the agent role.

controllerRedeem​

function controllerRedeem(address _tokenHolder, uint256 _value, bytes _data, bytes _operatorData) external nonpayable

This function allows an authorised address to redeem tokens for any token holder.

This function can only be executed by the controller or agent address.

Parameters​

NameTypeDescription
_tokenHolderaddressThe account whose tokens will be redeemed.
_valueuint256uint256 the amount of tokens need to be redeemed.
_databytesdata to validate the transfer
_operatorDatabytesdata attached to the transfer by controller to emit in event

controllerTransfer​

function controllerTransfer(address _from, address _to, uint256 _value, bytes _data, bytes _operatorData) external nonpayable

This function allows an authorised address to transfer tokens between any two token holders.

This function can only be executed by the controller or agent address.

Parameters​

NameTypeDescription
_fromaddressAddress The address which you want to send tokens from
_toaddressAddress The address which you want to transfer to
_valueuint256uint256 the amount of tokens to be transferred
_databytesdata to validate the transfer
_operatorDatabytesdata attached to the transfer by controller to emit in event

finalizeControllable​

function finalizeControllable() external nonpayable

It is used to end the controller feature from the token

Emits {FinalizedControllerFeature}.

forcedTransfer​

function forcedTransfer(address _from, address _to, uint256 _amount) external nonpayable returns (bool)

Performs a forced transfer of _amount tokens from _from to _to.

This function should only be callable by an authorized entity. Returns true if the transfer was successful. Emits a ControllerTransfer event.

Parameters​

NameTypeDescription
_fromaddressAddress the tokens are transferred from.
_toaddressAddress the tokens are transferred to.
_amountuint256Amount of tokens to transfer.

Returns​

NameTypeDescription
_0boolTrue if the transfer was successful.

getStaticFunctionSelectors​

function getStaticFunctionSelectors() external pure returns (bytes4[])

Gets all function selectors of a facet

Returns​

NameTypeDescription
_0bytes4[]Face functions selectors

getStaticInterfaceIds​

function getStaticInterfaceIds() external pure returns (bytes4[])

Gets all interfaces ids of a facet.

Returns​

NameTypeDescription
_0bytes4[]Face interface ids

getStaticResolverKey​

function getStaticResolverKey() external pure returns (bytes32 staticResolverKey_)

Gets the static resolver key

Returns​

NameTypeDescription
staticResolverKey_bytes32Static resolver key

initializeController​

function initializeController(bool _controllable) external nonpayable

One-time initialiser that sets whether the token is controllable.

Initial configuration. Can only be called once.

Parameters​

NameTypeDescription
_controllableboolundefined

isAgent​

function isAgent(address _agent) external view returns (bool)

Checks whether an account holds the agent role.

Checks if an account has the agent role.

Parameters​

NameTypeDescription
_agentaddressAddress to query.

Returns​

NameTypeDescription
_0boolTrue if _agent holds the agent role, false otherwise.

isControllable​

function isControllable() external view returns (bool)

In order to provide transparency over whether controllerTransfer / controllerRedeem are useable or not isControllable function will be used.

Returns​

NameTypeDescription
_0boolbool true when controller address is non-zero otherwise return false.

removeAgent​

function removeAgent(address _agent) external nonpayable

Revokes the agent role from an account.

Can only be called by the role admin.

Parameters​

NameTypeDescription
_agentaddressAddress whose agent role is revoked.

Events​

AgentAdded​

event AgentAdded(address indexed agent)

Emitted when an agent is granted transfer-management permissions.

Parameters​

NameTypeDescription
agent indexedaddressAddress of the newly added agent.

AgentRemoved​

event AgentRemoved(address indexed agent)

Emitted when an agent's transfer-management permissions are revoked.

Parameters​

NameTypeDescription
agent indexedaddressAddress of the removed agent.

ComplianceAdded​

event ComplianceAdded(address indexed compliance)

Emitted when the compliance contract address is updated.

Parameters​

NameTypeDescription
compliance indexedaddressAddress of the newly wired compliance contract.

ControllerInitialized​

event ControllerInitialized(bool controllable)

Emitted when the controller feature is initialised for a token.

Fired inside initializeController once the facet is marked ready.

Parameters​

NameTypeDescription
controllableboolWhether the token was configured as controllable.

ControllerRedemption​

event ControllerRedemption(address controller, address indexed tokenHolder, uint256 value, bytes data, bytes operatorData)

Emitted when an authorised controller redeems (burns) tokens on behalf of a holder.

Parameters​

NameTypeDescription
controlleraddressThe address of the controller that initiated the redemption.
tokenHolder indexedaddressThe account whose tokens are redeemed.
valueuint256The amount of tokens redeemed.
databytesOptional data attached to the redemption for validation.
operatorDatabytesOptional data attached by the controller for event attribution.

ControllerTransfer​

event ControllerTransfer(address controller, address indexed from, address indexed to, uint256 value, bytes data, bytes operatorData)

Emitted when an authorised controller transfers tokens between two holders.

Parameters​

NameTypeDescription
controlleraddressThe address of the controller that initiated the transfer.
from indexedaddressThe address tokens are transferred from.
to indexedaddressThe address tokens are transferred to.
valueuint256The amount of tokens transferred.
databytesOptional data attached to the transfer for validation.
operatorDatabytesOptional data attached by the controller for event attribution.

FinalizedControllerFeature​

event FinalizedControllerFeature(address operator)

Emitted when the controller feature is permanently disabled for a token.

Parameters​

NameTypeDescription
operatoraddressAddress of the caller who finalised controllability.

IdentityRegistryAdded​

event IdentityRegistryAdded(address indexed identityRegistry)

Emitted when the identity registry contract address is updated.

Parameters​

NameTypeDescription
identityRegistry indexedaddressAddress of the newly wired identity registry.

RecoverySuccess​

event RecoverySuccess(address lostWallet, address newWallet, address investorOnchainID)

Emitted when a lost wallet is successfully recovered to a new address.

Parameters​

NameTypeDescription
lostWalletaddressAddress of the wallet that was lost.
newWalletaddressAddress of the replacement wallet.
investorOnchainIDaddressOnchainID of the investor performing the recovery.

UpdatedTokenInformation​

event UpdatedTokenInformation(string indexed newName, string indexed newSymbol, uint8 newDecimals, string newVersion, address indexed newOnchainID)

Emitted when core token metadata is updated.

Parameters​

NameTypeDescription
newName indexedstringNew token name.
newSymbol indexedstringNew token symbol.
newDecimalsuint8New decimal precision.
newVersionstringNew token version string.
newOnchainID indexedaddressNew onchainID address associated with the token.

Errors​

AccountAssignedToRole​

error AccountAssignedToRole(bytes32 role, address account)

Thrown when attempting to grant a role to an account that already holds it.

Parameters​

NameTypeDescription
rolebytes32The role the account already holds.
accountaddressThe account already assigned to the role.

AccountHasNoRole​

error AccountHasNoRole(address account, bytes32 role)

Thrown when an account does not hold a required role.

Parameters​

NameTypeDescription
accountaddressThe account that lacks the role.
rolebytes32The role that is not held.

AccountHasNoRoles​

error AccountHasNoRoles(address account, bytes32[] roles)

Thrown when an account does not hold any of the specified roles.

Parameters​

NameTypeDescription
accountaddressThe account that lacks the roles.
rolesbytes32[]The roles that are not held.

AccountNotAssignedToRole​

error AccountNotAssignedToRole(bytes32 role, address account)

Thrown when attempting to revoke or renounce a role from an account that does not hold it.

Parameters​

NameTypeDescription
rolebytes32The role the account does not hold.
accountaddressThe account not assigned to the role.

AddressNotVerified​

error AddressNotVerified()

Thrown when a transfer target address has not passed identity verification.

AssetNotOperational​

error AssetNotOperational(bytes32 configId, uint256 versionId)

Raised by InitializerStorageWrapper.checkOperational (and the related isConfigVersionOperational helper) when an operation is attempted on a configuration version that has not yet been marked operational.

Parameters​

NameTypeDescription
configIdbytes32Resolver-proxy configuration whose operational status was checked.
versionIduint256Configuration version whose operational status was checked.

CannotRecoverWallet​

error CannotRecoverWallet()

Thrown when wallet recovery preconditions are not met (e.g. identity mismatch).

CannotRenounceSoleAdmin​

error CannotRenounceSoleAdmin()

Thrown when the sole holder of DEFAULT_ADMIN_ROLE attempts to renounce it, which would permanently lock all admin-gated functions.

ComplianceCallFailed​

error ComplianceCallFailed()

Thrown when an external call to the compliance contract reverts or returns false.

ComplianceNotAllowed​

error ComplianceNotAllowed()

Thrown when a transfer is blocked by the compliance module.

Deactivated​

error Deactivated()

Thrown when an operation guarded by onlyActivated is attempted on a token whose deactivation flag has already been set.

FacetAlreadyRegistered​

error FacetAlreadyRegistered(bytes32 facetId, uint256 lastVersion)

Raised when an initialiser tries to register a facet that already has a non-zero last registered version (i.e. the facet is being re-initialised on a fresh install).

Parameters​

NameTypeDescription
facetIdbytes32Identifier of the offending facet.
lastVersionuint256Last version recorded for that facet at the time of the check.

IdentityRegistryCallFailed​

error IdentityRegistryCallFailed()

Thrown when an external call to the identity registry reverts or returns false.

InputAmountsArrayLengthMismatch​

error InputAmountsArrayLengthMismatch()

Thrown when the lengths of two input amount arrays do not match.

InputBoolArrayLengthMismatch​

error InputBoolArrayLengthMismatch()

Thrown when the lengths of two input boolean arrays do not match.

InsufficientFrozenBalance​

error InsufficientFrozenBalance(address user, uint256 requestedUnfreeze, uint256 availableFrozen, bytes32 partition)

Thrown when an unfreeze request exceeds the address's available frozen balance.

Parameters​

NameTypeDescription
useraddressAddress whose frozen balance was checked.
requestedUnfreezeuint256Amount the caller attempted to unfreeze.
availableFrozenuint256Actual frozen balance available for unfreezing.
partitionbytes32Partition on which the frozen balance was checked.

IsPaused​

error IsPaused()

Thrown when an operation that requires the token to be unpaused is attempted while the token is paused (own flag or any external pause contract).

NotAllowedInMultiPartitionMode​

error NotAllowedInMultiPartitionMode()

Thrown when a single-partition operation is attempted on a multi-partition token.

TokenIsNotControllable​

error TokenIsNotControllable()

Thrown when an operation requires the token to be controllable but it is not.

UnrecognizedResolverProxyVersion​

error UnrecognizedResolverProxyVersion(bytes8 _resolverProxyVersion)

Thrown when the provided proxy version does not match any BLR compatible standard.

Parameters​

NameTypeDescription
_resolverProxyVersionbytes8proxy version that is not compatible with the BLR.

WalletRecovered​

error WalletRecovered()

Thrown when attempting to recover a wallet that has already been recovered.

ZeroValue​

error ZeroValue()

Thrown when a zero token amount is supplied to an operation that requires a positive value.