ERC1400
ERC1400Upgradeable
Inherits: IERC20, IERC1400, ERC1400Storage, OwnableUpgradeable, ERC1820Client, ERC1820Implementer, MinterRoleUpgradeable, DomainAwareUpgradeable
ERC1400 logic
State Variables
ERC1400_INTERFACE_NAME
ERC20_INTERFACE_NAME
ERC1400_TOKENS_CHECKER
ERC1400_TOKENS_VALIDATOR
ERC1400_TOKENS_SENDER
ERC1400_TOKENS_RECIPIENT
Functions
__ERC1400_init
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
isIssuableToken
Modifiers *******************************************
Modifier to verify if token is issuable.
isNotMigratedToken
Modifier to make a function callable only when the contract is not migrated.
onlyMinter
Modifier to verifiy if sender is a minter.
totalSupply
Get the total number of issued tokens.
Returns
<none>
uint256
Total supply of tokens currently in circulation.
balanceOf
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
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.
allowance
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
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.
transferFrom
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.
getDocument
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
setDocument
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].
removeDocument
getAllDocuments
balanceOfByPartition
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.
partitionsOf
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'.
transferWithData
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.
transferFromWithData
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').
transferByPartition
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.
operatorTransferByPartition
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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'.
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.
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.
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.
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".
Returns
<none>
string
Name of the token.
symbol
Get the symbol of the token, e.g., "MYT".
Returns
<none>
string
Symbol of the token.
decimals
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.
granularity
Get the smallest part of the token that’s not divisible.
Returns
<none>
uint256
The smallest non-divisible part of the token.
totalPartitions
Get list of existing partitions.
Returns
<none>
bytes32[]
Array of all exisiting partitions.
totalSupplyByPartition
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.
renounceControl
Definitely renounce the possibility to control tokens on behalf of tokenHolders. Once set to false, '_isControllable' can never be set to 'true' again.
renounceIssuance
Definitely renounce the possibility to issue new tokens. Once set to false, '_isIssuable' can never be set to 'true' again.
controllers
Get the list of controllers as defined by the token contract.
Returns
<none>
address[]
List of addresses of all the controllers.
controllersByPartition
Get controllers for a given partition.
Parameters
partition
bytes32
Name of the partition.
Returns
<none>
address[]
Array of controllers for partition.
setControllers
Set list of token controllers.
Parameters
operators
address[]
Controller addresses.
setPartitionControllers
Set list of token partition controllers.
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").
Returns
<none>
bytes32[]
Array of default partitions.
setDefaultPartitions
Set default partitions to transfer from. Function used for ERC20 retrocompatibility.
Parameters
partitions
bytes32[]
partitions to use by default when not specified.
allowanceByPartition
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.
approveByPartition
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.
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.
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*
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.
Parameters
from
address
Token holder.
to
address
Token recipient.
value
uint256
Number of tokens to transfer.
_transferByPartition
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.
_transferByDefaultPartitions
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].
_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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
Parameters
operators
address[]
Controller addresses.
_setPartitionControllers
Set list of token partition controllers.
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.
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*
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
domainVersion
Events
ApprovalByPartition
Last updated