ERC1400
Last updated
Last updated
Inherits: IERC20, IERC1400, ERC1400Storage, OwnableUpgradeable, ERC1820Client, ERC1820Implementer, MinterRoleUpgradeable, DomainAwareUpgradeable
ERC1400 logic
Initialize ERC1400 + register the contract implementation in ERC1820Registry.
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
Modifiers *******************************************
Modifier to verify if token is issuable.
Modifier to make a function callable only when the contract is not migrated.
Modifier to verifiy if sender is a minter.
Get the total number of issued tokens.
Returns
<none>
uint256
Total supply of tokens currently in circulation.
Get the balance of the account with address 'tokenHolder'.
Parameters
tokenHolder
address
Address for which the balance is returned.
Returns
<none>
uint256
Amount of token held by 'tokenHolder' in the token contract.
Transfer token for a specified address.
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.
Check the value of tokens that an owner allowed to a spender.
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 the passed address to spend the specified amount of tokens on behalf of 'msg.sender'.
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.
Transfer tokens from one address to another.
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.
Access a document associated with the token.
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
Associate a document with the token.
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].
Get balance of a tokenholder for a specific partition.
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.
Get partitions index of a tokenholder.
Parameters
tokenHolder
address
Address for which the partitions index are returned.
Returns
<none>
bytes32[]
Array of partitions index of 'tokenHolder'.
Transfer the amount of tokens from the address 'msg.sender' to the address 'to'.
Parameters
to
address
Token recipient.
value
uint256
Number of tokens to transfer.
data
bytes
Information attached to the transfer, by the token holder.
Transfer the amount of tokens on behalf of the address 'from' to the address 'to'.
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').
Transfer tokens from a specific partition.
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.
Transfer tokens from a specific partition through an operator.
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.
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.
Returns
<none>
bool
bool 'true' if the token can still be controlled by operators, 'false' if it can't anymore.
Set a third party operator address as an operator of 'msg.sender' to transfer and redeem tokens on its behalf.
Parameters
operator
address
Address to set as an operator for 'msg.sender'.
Remove the right of the operator address to be an operator for 'msg.sender' and to transfer and redeem tokens on its behalf.
Parameters
operator
address
Address to rescind as an operator for 'msg.sender'.
Set 'operator' as an operator for 'msg.sender' for a given partition.
Parameters
partition
bytes32
Name of the partition.
operator
address
Address to set as an operator for 'msg.sender'.
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.
Parameters
partition
bytes32
Name of the partition.
operator
address
Address to rescind as an operator on given partition for 'msg.sender'.
Indicate whether the operator address is an operator of the tokenHolder address.
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.
Indicate whether the operator address is an operator of the tokenHolder address for the given partition.
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.
Know if new tokens can be issued in the future.
Returns
<none>
bool
bool 'true' if tokens can still be issued by the issuer, 'false' if they can't anymore.
Issue tokens from default partition.
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.
Issue tokens from a specific partition.
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 the amount of tokens from the address 'msg.sender'.
Parameters
value
uint256
Number of tokens to redeem.
data
bytes
Information attached to the redemption, by the token holder.
Redeem the amount of tokens on behalf of the address from.
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.
Redeem tokens of a specific partition.
Parameters
partition
bytes32
Name of the partition.
value
uint256
Number of tokens redeemed.
data
bytes
Information attached to the redemption, by the redeemer.
Redeem tokens of a specific partition.
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.
Get the name of the token, e.g., "MyToken".
Returns
<none>
string
Name of the token.
Get the symbol of the token, e.g., "MYT".
Returns
<none>
string
Symbol of the token.
Get the number of decimals of the token.
Returns
<none>
uint8
The number of decimals of the token. For retrocompatibility, decimals are forced to 18 in ERC1400.
Get the smallest part of the token that’s not divisible.
Returns
<none>
uint256
The smallest non-divisible part of the token.
Get list of existing partitions.
Returns
<none>
bytes32[]
Array of all exisiting partitions.
Get the total number of issued tokens for a given partition.
Parameters
partition
bytes32
Name of the partition.
Returns
<none>
uint256
Total supply of tokens currently in circulation, for a given partition.
Definitely renounce the possibility to control tokens on behalf of tokenHolders. Once set to false, '_isControllable' can never be set to 'true' again.
Definitely renounce the possibility to issue new tokens. Once set to false, '_isIssuable' can never be set to 'true' again.
Get the list of controllers as defined by the token contract.
Returns
<none>
address[]
List of addresses of all the controllers.
Get controllers for a given partition.
Parameters
partition
bytes32
Name of the partition.
Returns
<none>
address[]
Array of controllers for partition.
Set list of token controllers.
Parameters
operators
address[]
Controller addresses.
Set list of token partition controllers.
Parameters
partition
bytes32
Name of the partition.
operators
address[]
Controller addresses.
Get default partitions to transfer from. Function used for ERC20 retrocompatibility. For example, a security token may return the bytes32("unrestricted").
Returns
<none>
bytes32[]
Array of default partitions.
Set default partitions to transfer from. Function used for ERC20 retrocompatibility.
Parameters
partitions
bytes32[]
partitions to use by default when not specified.
Check the value of tokens that an owner allowed to a spender.
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.
Approve the passed address to spend the specified amount of tokens on behalf of 'msg.sender'.
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.
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.
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 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*
Parameters
newContractAddress
address
Address of the new version of the smart contract.
definitive
bool
If set to 'true' the contract is turned off definitely.
Perform the transfer of tokens.
Parameters
from
address
Token holder.
to
address
Token recipient.
value
uint256
Number of tokens to transfer.
Transfer tokens from a specific partition.
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.
Transfer tokens from default partitions. Function used for ERC20 retrocompatibility.
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].
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.
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.
Remove a token from a specific partition.
Parameters
from
address
Token holder.
partition
bytes32
Name of the partition.
value
uint256
Number of tokens to transfer.
Add a token to a specific partition.
Parameters
to
address
Token recipient.
partition
bytes32
Name of the partition.
value
uint256
Number of tokens to transfer.
Check if 'value' is multiple of the granularity.
Parameters
value
uint256
The quantity that want's to be checked.
Returns
<none>
bool
'true' if 'value' is a multiple of the granularity.
Check for 'ERC1400TokensSender' user extension in ERC1820 registry and call it.
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).
Check for 'ERC1400TokensValidator' token extension in ERC1820 registry and call it.
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).
Check for 'ERC1400TokensRecipient' user extension in ERC1820 registry and call it.
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).
Indicate whether the operator address is an operator of the tokenHolder address.
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.
Indicate whether the operator address is an operator of the tokenHolder address for the given partition.
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.
Perform the issuance of tokens.
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).
Issue tokens from a specific partition.
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.
Perform the token redemption.
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.
Redeem tokens of a specific partition.
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).
Redeem tokens from a default partitions.
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.
Know the reason on success or failure based on the EIP-1066 application-specific status codes.
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.
Set list of token controllers.
Parameters
operators
address[]
Controller addresses.
Set list of token partition controllers.
Parameters
partition
bytes32
Name of the partition.
operators
address[]
Controller addresses.
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.
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 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*
Parameters
newContractAddress
address
Address of the new version of the smart contract.
definitive
bool
If set to 'true' the contract is turned off definitely.