ERC1400
ERC1400Upgradeable
Inherits: IERC20, IERC1400, ERC1400Storage, OwnableUpgradeable, ERC1820Client, ERC1820Implementer, MinterRoleUpgradeable, DomainAwareUpgradeable
ERC1400 logic
State Variables
ERC1400_INTERFACE_NAME
string internal constant ERC1400_INTERFACE_NAME = "ERC1400Token";
ERC20_INTERFACE_NAME
string internal constant ERC20_INTERFACE_NAME = "ERC20Token";
ERC1400_TOKENS_CHECKER
string internal constant ERC1400_TOKENS_CHECKER = "ERC1400TokensChecker";
ERC1400_TOKENS_VALIDATOR
string internal constant ERC1400_TOKENS_VALIDATOR = "ERC1400TokensValidator";
ERC1400_TOKENS_SENDER
string internal constant ERC1400_TOKENS_SENDER = "ERC1400TokensSender";
ERC1400_TOKENS_RECIPIENT
string internal constant ERC1400_TOKENS_RECIPIENT = "ERC1400TokensRecipient";
Functions
__ERC1400_init
Initialize ERC1400 + register the contract implementation in ERC1820Registry.
function __ERC1400_init(
string memory tokenName,
string memory tokenSymbol,
uint256 tokenGranularity,
address[] memory initialControllers,
bytes32[] memory defaultPartitions,
address owner,
address minter
) internal onlyInitializing;
Parameters
tokenName
string
Name of the token.
tokenSymbol
string
Symbol of the token.
tokenGranularity
uint256
Granularity of the token.
initialControllers
address[]
Array of initial controllers.
defaultPartitions
bytes32[]
Partitions chosen by default, when partition is not specified, like the case ERC20 tranfers.
owner
address
minter
address
isIssuableToken
Modifiers *******************************************
Modifier to verify if token is issuable.
modifier isIssuableToken();
isNotMigratedToken
Modifier to make a function callable only when the contract is not migrated.
modifier isNotMigratedToken();
onlyMinter
Modifier to verifiy if sender is a minter.
modifier onlyMinter() override;
totalSupply
Get the total number of issued tokens.
function totalSupply() external view override returns (uint256);
Returns
<none>
uint256
Total supply of tokens currently in circulation.
balanceOf
Get the balance of the account with address 'tokenHolder'.
function balanceOf(address tokenHolder) external view override returns (uint256);
Parameters
tokenHolder
address
Address for which the balance is returned.
Returns
<none>
uint256
Amount of token held by 'tokenHolder' in the token contract.
transfer
Transfer token for a specified address.
function transfer(address to, uint256 value) external override returns (bool);
Parameters
to
address
The address to transfer to.
value
uint256
The value to be transferred.
Returns
<none>
bool
A boolean that indicates if the operation was successful.
allowance
Check the value of tokens that an owner allowed to a spender.
function allowance(address owner, address spender) external view override returns (uint256);
Parameters
owner
address
address The address which owns the funds.
spender
address
address The address which will spend the funds.
Returns
<none>
uint256
A uint256 specifying the value of tokens still available for the spender.
approve
Approve the passed address to spend the specified amount of tokens on behalf of 'msg.sender'.
function approve(address spender, uint256 value) external override returns (bool);
Parameters
spender
address
The address which will spend the funds.
value
uint256
The amount of tokens to be spent.
Returns
<none>
bool
A boolean that indicates if the operation was successful.
transferFrom
Transfer tokens from one address to another.
function transferFrom(address from, address to, uint256 value) external override returns (bool);
Parameters
from
address
The address which you want to transfer tokens from.
to
address
The address which you want to transfer to.
value
uint256
The amount of tokens to be transferred.
Returns
<none>
bool
A boolean that indicates if the operation was successful.
getDocument
Access a document associated with the token.
function getDocument(bytes32 documentName) external view override returns (string memory, bytes32, uint256);
Parameters
documentName
bytes32
Short name (represented as a bytes32) associated to the document.
Returns
<none>
string
Requested document + document hash + document timestamp.
<none>
bytes32
<none>
uint256
setDocument
Associate a document with the token.
function setDocument(bytes32 documentName, string calldata uri, bytes32 documentHash) external override;
Parameters
documentName
bytes32
Short name (represented as a bytes32) associated to the document.
uri
string
Document content.
documentHash
bytes32
Hash of the document [optional parameter].
removeDocument
function removeDocument(bytes32 documentName) external override;
getAllDocuments
function getAllDocuments() external view override returns (bytes32[] memory);
balanceOfByPartition
Get balance of a tokenholder for a specific partition.
function balanceOfByPartition(bytes32 partition, address tokenHolder) external view override returns (uint256);
Parameters
partition
bytes32
Name of the partition.
tokenHolder
address
Address for which the balance is returned.
Returns
<none>
uint256
Amount of token of partition 'partition' held by 'tokenHolder' in the token contract.
partitionsOf
Get partitions index of a tokenholder.
function partitionsOf(address tokenHolder) external view override returns (bytes32[] memory);
Parameters
tokenHolder
address
Address for which the partitions index are returned.
Returns
<none>
bytes32[]
Array of partitions index of 'tokenHolder'.
transferWithData
Transfer the amount of tokens from the address 'msg.sender' to the address 'to'.
function transferWithData(address to, uint256 value, bytes calldata data) external override;
Parameters
to
address
Token recipient.
value
uint256
Number of tokens to transfer.
data
bytes
Information attached to the transfer, by the token holder.
transferFromWithData
Transfer the amount of tokens on behalf of the address 'from' to the address 'to'.
function transferFromWithData(address from, address to, uint256 value, bytes calldata data) external virtual override;
Parameters
from
address
Token holder (or 'address(0)' to set from to 'msg.sender').
to
address
Token recipient.
value
uint256
Number of tokens to transfer.
data
bytes
Information attached to the transfer, and intended for the token holder ('from').
transferByPartition
Transfer tokens from a specific partition.
function transferByPartition(bytes32 partition, address to, uint256 value, bytes calldata data)
external
override
returns (bytes32);
Parameters
partition
bytes32
Name of the partition.
to
address
Token recipient.
value
uint256
Number of tokens to transfer.
data
bytes
Information attached to the transfer, by the token holder.
Returns
<none>
bytes32
Destination partition.
operatorTransferByPartition
Transfer tokens from a specific partition through an operator.
function operatorTransferByPartition(
bytes32 partition,
address from,
address to,
uint256 value,
bytes calldata data,
bytes calldata operatorData
) external override returns (bytes32);
Parameters
partition
bytes32
Name of the partition.
from
address
Token holder.
to
address
Token recipient.
value
uint256
Number of tokens to transfer.
data
bytes
Information attached to the transfer. [CAN CONTAIN THE DESTINATION PARTITION]
operatorData
bytes
Information attached to the transfer, by the operator.
Returns
<none>
bytes32
Destination partition.
isControllable
Know if the token can be controlled by operators. If a token returns 'false' for 'isControllable()'' then it MUST always return 'false' in the future.
function isControllable() external view override returns (bool);
Returns
<none>
bool
bool 'true' if the token can still be controlled by operators, 'false' if it can't anymore.
authorizeOperator
Set a third party operator address as an operator of 'msg.sender' to transfer and redeem tokens on its behalf.
function authorizeOperator(address operator) external override;
Parameters
operator
address
Address to set as an operator for 'msg.sender'.
revokeOperator
Remove the right of the operator address to be an operator for 'msg.sender' and to transfer and redeem tokens on its behalf.
function revokeOperator(address operator) external override;
Parameters
operator
address
Address to rescind as an operator for 'msg.sender'.
authorizeOperatorByPartition
Set 'operator' as an operator for 'msg.sender' for a given partition.
function authorizeOperatorByPartition(bytes32 partition, address operator) external override;
Parameters
partition
bytes32
Name of the partition.
operator
address
Address to set as an operator for 'msg.sender'.
revokeOperatorByPartition
Remove the right of the operator address to be an operator on a given partition for 'msg.sender' and to transfer and redeem tokens on its behalf.
function revokeOperatorByPartition(bytes32 partition, address operator) external override;
Parameters
partition
bytes32
Name of the partition.
operator
address
Address to rescind as an operator on given partition for 'msg.sender'.
isOperator
Indicate whether the operator address is an operator of the tokenHolder address.
function isOperator(address operator, address tokenHolder) external view override returns (bool);
Parameters
operator
address
Address which may be an operator of tokenHolder.
tokenHolder
address
Address of a token holder which may have the operator address as an operator.
Returns
<none>
bool
'true' if operator is an operator of 'tokenHolder' and 'false' otherwise.
isOperatorForPartition
Indicate whether the operator address is an operator of the tokenHolder address for the given partition.
function isOperatorForPartition(bytes32 partition, address operator, address tokenHolder)
external
view
override
returns (bool);
Parameters
partition
bytes32
Name of the partition.
operator
address
Address which may be an operator of tokenHolder for the given partition.
tokenHolder
address
Address of a token holder which may have the operator address as an operator for the given partition.
Returns
<none>
bool
'true' if 'operator' is an operator of 'tokenHolder' for partition 'partition' and 'false' otherwise.
isIssuable
Know if new tokens can be issued in the future.
function isIssuable() external view override returns (bool);
Returns
<none>
bool
bool 'true' if tokens can still be issued by the issuer, 'false' if they can't anymore.
issue
Issue tokens from default partition.
function issue(address tokenHolder, uint256 value, bytes calldata data) external override onlyMinter isIssuableToken;
Parameters
tokenHolder
address
Address for which we want to issue tokens.
value
uint256
Number of tokens issued.
data
bytes
Information attached to the issuance, by the issuer.
issueByPartition
Issue tokens from a specific partition.
function issueByPartition(bytes32 partition, address tokenHolder, uint256 value, bytes calldata data)
external
override
onlyMinter
isIssuableToken;
Parameters
partition
bytes32
Name of the partition.
tokenHolder
address
Address for which we want to issue tokens.
value
uint256
Number of tokens issued.
data
bytes
Information attached to the issuance, by the issuer.
redeem
Redeem the amount of tokens from the address 'msg.sender'.
function redeem(uint256 value, bytes calldata data) external override;
Parameters
value
uint256
Number of tokens to redeem.
data
bytes
Information attached to the redemption, by the token holder.
redeemFrom
Redeem the amount of tokens on behalf of the address from.
function redeemFrom(address from, uint256 value, bytes calldata data) external virtual override;
Parameters
from
address
Token holder whose tokens will be redeemed (or address(0) to set from to msg.sender).
value
uint256
Number of tokens to redeem.
data
bytes
Information attached to the redemption.
redeemByPartition
Redeem tokens of a specific partition.
function redeemByPartition(bytes32 partition, uint256 value, bytes calldata data) external override;
Parameters
partition
bytes32
Name of the partition.
value
uint256
Number of tokens redeemed.
data
bytes
Information attached to the redemption, by the redeemer.
operatorRedeemByPartition
Redeem tokens of a specific partition.
function operatorRedeemByPartition(bytes32 partition, address tokenHolder, uint256 value, bytes calldata operatorData)
external
override;
Parameters
partition
bytes32
Name of the partition.
tokenHolder
address
Address for which we want to redeem tokens.
value
uint256
Number of tokens redeemed
operatorData
bytes
Information attached to the redemption, by the operator.
name
Get the name of the token, e.g., "MyToken".
function name() external view returns (string memory);
Returns
<none>
string
Name of the token.
symbol
Get the symbol of the token, e.g., "MYT".
function symbol() external view returns (string memory);
Returns
<none>
string
Symbol of the token.
decimals
Get the number of decimals of the token.
function decimals() external pure returns (uint8);
Returns
<none>
uint8
The number of decimals of the token. For retrocompatibility, decimals are forced to 18 in ERC1400.
granularity
Get the smallest part of the token that’s not divisible.
function granularity() external view returns (uint256);
Returns
<none>
uint256
The smallest non-divisible part of the token.
totalPartitions
Get list of existing partitions.
function totalPartitions() external view returns (bytes32[] memory);
Returns
<none>
bytes32[]
Array of all exisiting partitions.
totalSupplyByPartition
Get the total number of issued tokens for a given partition.
function totalSupplyByPartition(bytes32 partition) external view returns (uint256);
Parameters
partition
bytes32
Name of the partition.
Returns
<none>
uint256
Total supply of tokens currently in circulation, for a given partition.
renounceControl
Definitely renounce the possibility to control tokens on behalf of tokenHolders. Once set to false, '_isControllable' can never be set to 'true' again.
function renounceControl() external onlyOwner;
renounceIssuance
Definitely renounce the possibility to issue new tokens. Once set to false, '_isIssuable' can never be set to 'true' again.
function renounceIssuance() external onlyOwner;
controllers
Get the list of controllers as defined by the token contract.
function controllers() external view returns (address[] memory);
Returns
<none>
address[]
List of addresses of all the controllers.
controllersByPartition
Get controllers for a given partition.
function controllersByPartition(bytes32 partition) external view returns (address[] memory);
Parameters
partition
bytes32
Name of the partition.
Returns
<none>
address[]
Array of controllers for partition.
setControllers
Set list of token controllers.
function setControllers(address[] calldata operators) external onlyOwner;
Parameters
operators
address[]
Controller addresses.
setPartitionControllers
Set list of token partition controllers.
function setPartitionControllers(bytes32 partition, address[] calldata operators) external onlyOwner;
Parameters
partition
bytes32
Name of the partition.
operators
address[]
Controller addresses.
getDefaultPartitions
Get default partitions to transfer from. Function used for ERC20 retrocompatibility. For example, a security token may return the bytes32("unrestricted").
function getDefaultPartitions() external view returns (bytes32[] memory);
Returns
<none>
bytes32[]
Array of default partitions.
setDefaultPartitions
Set default partitions to transfer from. Function used for ERC20 retrocompatibility.
function setDefaultPartitions(bytes32[] calldata partitions) external onlyOwner;
Parameters
partitions
bytes32[]
partitions to use by default when not specified.
allowanceByPartition
Check the value of tokens that an owner allowed to a spender.
function allowanceByPartition(bytes32 partition, address owner, address spender)
external
view
override
returns (uint256);
Parameters
partition
bytes32
Name of the partition.
owner
address
address The address which owns the funds.
spender
address
address The address which will spend the funds.
Returns
<none>
uint256
A uint256 specifying the value of tokens still available for the spender.
approveByPartition
Approve the passed address to spend the specified amount of tokens on behalf of 'msg.sender'.
function approveByPartition(bytes32 partition, address spender, uint256 value) external returns (bool);
Parameters
partition
bytes32
Name of the partition.
spender
address
The address which will spend the funds.
value
uint256
The amount of tokens to be spent.
Returns
<none>
bool
A boolean that indicates if the operation was successful.
setTokenExtension
Set token extension contract address. The extension contract can for example verify "ERC1400TokensValidator" or "ERC1400TokensChecker" interfaces. If the extension is an "ERC1400TokensValidator", it will be called everytime a transfer is executed.
function setTokenExtension(
address extension,
string calldata interfaceLabel,
bool removeOldExtensionRoles,
bool addMinterRoleForExtension,
bool addControllerRoleForExtension
) external onlyOwner;
Parameters
extension
address
Address of the extension contract.
interfaceLabel
string
Interface label of extension contract.
removeOldExtensionRoles
bool
If set to 'true', the roles of the old extension(minter, controller) will be removed extension.
addMinterRoleForExtension
bool
If set to 'true', the extension contract will be added as minter.
addControllerRoleForExtension
bool
If set to 'true', the extension contract will be added as controller.
migrate
*Migrate contract. ===> CAUTION: DEFINITIVE ACTION This function shall be called once a new version of the smart contract has been created. Once this function is called:
The address of the new smart contract is set in ERC1820 registry
If the choice is definitive, the current smart contract is turned off and can never be used again*
function migrate(address newContractAddress, bool definitive) external onlyOwner;
Parameters
newContractAddress
address
Address of the new version of the smart contract.
definitive
bool
If set to 'true' the contract is turned off definitely.
_transferWithData
Perform the transfer of tokens.
function _transferWithData(address from, address to, uint256 value) internal isNotMigratedToken;
Parameters
from
address
Token holder.
to
address
Token recipient.
value
uint256
Number of tokens to transfer.
_transferByPartition
Transfer tokens from a specific partition.
function _transferByPartition(
bytes32 fromPartition,
address operator,
address from,
address to,
uint256 value,
bytes memory data,
bytes memory operatorData
) internal returns (bytes32);
Parameters
fromPartition
bytes32
Partition of the tokens to transfer.
operator
address
The address performing the transfer.
from
address
Token holder.
to
address
Token recipient.
value
uint256
Number of tokens to transfer.
data
bytes
Information attached to the transfer. [CAN CONTAIN THE DESTINATION PARTITION]
operatorData
bytes
Information attached to the transfer, by the operator (if any).
Returns
<none>
bytes32
Destination partition.
_transferByDefaultPartitions
Transfer tokens from default partitions. Function used for ERC20 retrocompatibility.
function _transferByDefaultPartitions(address operator, address from, address to, uint256 value, bytes memory data)
internal;
Parameters
operator
address
The address performing the transfer.
from
address
Token holder.
to
address
Token recipient.
value
uint256
Number of tokens to transfer.
data
bytes
Information attached to the transfer, and intended for the token holder ('from') [CAN CONTAIN THE DESTINATION PARTITION].
_getDestinationPartition
Retrieve the destination partition from the 'data' field. By convention, a partition change is requested ONLY when 'data' starts with the flag: 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff When the flag is detected, the destination tranche is extracted from the 32 bytes following the flag.
function _getDestinationPartition(bytes32 fromPartition, bytes memory data)
internal
pure
returns (bytes32 toPartition);
Parameters
fromPartition
bytes32
Partition of the tokens to transfer.
data
bytes
Information attached to the transfer. [CAN CONTAIN THE DESTINATION PARTITION]
Returns
toPartition
bytes32
Destination partition.
_removeTokenFromPartition
Remove a token from a specific partition.
function _removeTokenFromPartition(address from, bytes32 partition, uint256 value) internal;
Parameters
from
address
Token holder.
partition
bytes32
Name of the partition.
value
uint256
Number of tokens to transfer.
_addTokenToPartition
Add a token to a specific partition.
function _addTokenToPartition(address to, bytes32 partition, uint256 value) internal;
Parameters
to
address
Token recipient.
partition
bytes32
Name of the partition.
value
uint256
Number of tokens to transfer.
_isMultiple
Check if 'value' is multiple of the granularity.
function _isMultiple(uint256 value) internal view returns (bool);
Parameters
value
uint256
The quantity that want's to be checked.
Returns
<none>
bool
'true' if 'value' is a multiple of the granularity.
_callSenderExtension
Check for 'ERC1400TokensSender' user extension in ERC1820 registry and call it.
function _callSenderExtension(
bytes32 partition,
address operator,
address from,
address to,
uint256 value,
bytes memory data,
bytes memory operatorData
) internal;
Parameters
partition
bytes32
Name of the partition (bytes32 to be left empty for transfers where partition is not specified).
operator
address
Address which triggered the balance decrease (through transfer or redemption).
from
address
Token holder.
to
address
Token recipient for a transfer and 0x for a redemption.
value
uint256
Number of tokens the token holder balance is decreased by.
data
bytes
Extra information.
operatorData
bytes
Extra information, attached by the operator (if any).
_callTokenExtension
Check for 'ERC1400TokensValidator' token extension in ERC1820 registry and call it.
function _callTokenExtension(
bytes32 partition,
address operator,
address from,
address to,
uint256 value,
bytes memory data,
bytes memory operatorData
) internal;
Parameters
partition
bytes32
Name of the partition (bytes32 to be left empty for transfers where partition is not specified).
operator
address
Address which triggered the balance decrease (through transfer or redemption).
from
address
Token holder.
to
address
Token recipient for a transfer and 0x for a redemption.
value
uint256
Number of tokens the token holder balance is decreased by.
data
bytes
Extra information.
operatorData
bytes
Extra information, attached by the operator (if any).
_callRecipientExtension
Check for 'ERC1400TokensRecipient' user extension in ERC1820 registry and call it.
function _callRecipientExtension(
bytes32 partition,
address operator,
address from,
address to,
uint256 value,
bytes memory data,
bytes memory operatorData
) internal virtual;
Parameters
partition
bytes32
Name of the partition (bytes32 to be left empty for transfers where partition is not specified).
operator
address
Address which triggered the balance increase (through transfer or issuance).
from
address
Token holder for a transfer and 0x for an issuance.
to
address
Token recipient.
value
uint256
Number of tokens the recipient balance is increased by.
data
bytes
Extra information, intended for the token holder ('from').
operatorData
bytes
Extra information attached by the operator (if any).
_isOperator
Indicate whether the operator address is an operator of the tokenHolder address.
function _isOperator(address operator, address tokenHolder) internal view returns (bool);
Parameters
operator
address
Address which may be an operator of 'tokenHolder'.
tokenHolder
address
Address of a token holder which may have the 'operator' address as an operator.
Returns
<none>
bool
'true' if 'operator' is an operator of 'tokenHolder' and 'false' otherwise.
_isOperatorForPartition
Indicate whether the operator address is an operator of the tokenHolder address for the given partition.
function _isOperatorForPartition(bytes32 partition, address operator, address tokenHolder)
internal
view
returns (bool);
Parameters
partition
bytes32
Name of the partition.
operator
address
Address which may be an operator of tokenHolder for the given partition.
tokenHolder
address
Address of a token holder which may have the operator address as an operator for the given partition.
Returns
<none>
bool
'true' if 'operator' is an operator of 'tokenHolder' for partition 'partition' and 'false' otherwise.
_issue
Perform the issuance of tokens.
function _issue(address operator, address to, uint256 value, bytes memory data) internal isNotMigratedToken;
Parameters
operator
address
Address which triggered the issuance.
to
address
Token recipient.
value
uint256
Number of tokens issued.
data
bytes
Information attached to the issuance, and intended for the recipient (to).
_issueByPartition
Issue tokens from a specific partition.
function _issueByPartition(bytes32 toPartition, address operator, address to, uint256 value, bytes memory data)
internal;
Parameters
toPartition
bytes32
Name of the partition.
operator
address
The address performing the issuance.
to
address
Token recipient.
value
uint256
Number of tokens to issue.
data
bytes
Information attached to the issuance.
_redeem
Perform the token redemption.
function _redeem(address operator, address from, uint256 value, bytes memory data) internal isNotMigratedToken;
Parameters
operator
address
The address performing the redemption.
from
address
Token holder whose tokens will be redeemed.
value
uint256
Number of tokens to redeem.
data
bytes
Information attached to the redemption.
_redeemByPartition
Redeem tokens of a specific partition.
function _redeemByPartition(
bytes32 fromPartition,
address operator,
address from,
uint256 value,
bytes memory data,
bytes memory operatorData
) internal;
Parameters
fromPartition
bytes32
Name of the partition.
operator
address
The address performing the redemption.
from
address
Token holder whose tokens will be redeemed.
value
uint256
Number of tokens to redeem.
data
bytes
Information attached to the redemption.
operatorData
bytes
Information attached to the redemption, by the operator (if any).
_redeemByDefaultPartitions
Redeem tokens from a default partitions.
function _redeemByDefaultPartitions(address operator, address from, uint256 value, bytes memory data) internal;
Parameters
operator
address
The address performing the redeem.
from
address
Token holder.
value
uint256
Number of tokens to redeem.
data
bytes
Information attached to the redemption.
_canTransfer
Know the reason on success or failure based on the EIP-1066 application-specific status codes.
function _canTransfer(
bytes memory payload,
bytes32 partition,
address operator,
address from,
address to,
uint256 value,
bytes memory data,
bytes memory operatorData
) internal view returns (bytes1, bytes32, bytes32);
Parameters
payload
bytes
Payload of the initial transaction.
partition
bytes32
Name of the partition.
operator
address
The address performing the transfer.
from
address
Token holder.
to
address
Token recipient.
value
uint256
Number of tokens to transfer.
data
bytes
Information attached to the transfer. [CAN CONTAIN THE DESTINATION PARTITION]
operatorData
bytes
Information attached to the transfer, by the operator (if any).
Returns
<none>
bytes1
ESC (Ethereum Status Code) following the EIP-1066 standard.
<none>
bytes32
Additional bytes32 parameter that can be used to define application specific reason codes with additional details (for example the transfer restriction rule responsible for making the transfer operation invalid).
<none>
bytes32
Destination partition.
_setControllers
Set list of token controllers.
function _setControllers(address[] memory operators) internal;
Parameters
operators
address[]
Controller addresses.
_setPartitionControllers
Set list of token partition controllers.
function _setPartitionControllers(bytes32 partition, address[] memory operators) internal;
Parameters
partition
bytes32
Name of the partition.
operators
address[]
Controller addresses.
_setTokenExtension
Set token extension contract address. The extension contract can for example verify "ERC1400TokensValidator" or "ERC1400TokensChecker" interfaces. If the extension is an "ERC1400TokensValidator", it will be called everytime a transfer is executed.
function _setTokenExtension(
address extension,
string memory interfaceLabel,
bool removeOldExtensionRoles,
bool addMinterRoleForExtension,
bool addControllerRoleForExtension
) internal;
Parameters
extension
address
Address of the extension contract.
interfaceLabel
string
Interface label of extension contract.
removeOldExtensionRoles
bool
If set to 'true', the roles of the old extension(minter, controller) will be removed extension.
addMinterRoleForExtension
bool
If set to 'true', the extension contract will be added as minter.
addControllerRoleForExtension
bool
If set to 'true', the extension contract will be added as controller.
_migrate
*Migrate contract. ===> CAUTION: DEFINITIVE ACTION This function shall be called once a new version of the smart contract has been created. Once this function is called:
The address of the new smart contract is set in ERC1820 registry
If the choice is definitive, the current smart contract is turned off and can never be used again*
function _migrate(address newContractAddress, bool definitive) internal;
Parameters
newContractAddress
address
Address of the new version of the smart contract.
definitive
bool
If set to 'true' the contract is turned off definitely.
domainName
function domainName() public view override returns (string memory);
domainVersion
function domainVersion() public pure override returns (string memory);
Events
ApprovalByPartition
event ApprovalByPartition(bytes32 indexed partition, address indexed owner, address indexed spender, uint256 value);
Last updated