Skip to main content

LSP7DigitalAsset

Standard Specifications
Solidity implementation

Implementation of a LSP7 Digital Asset, a contract that represents a fungible token.

Minting and transferring are supplied with a uint256 amount. This implementation is agnostic to the way tokens are created. A supply mechanism has to be added in a derived contract using _mint For a generic mechanism, see LSP7Mintable.

Public Methods​

Public methods are accessible externally from users, allowing interaction with this function from dApps or other smart contracts. When marked as 'public', a method can be called both externally and internally, on the other hand, when marked as 'external', a method can only be called externally.

fallback​

References
fallback(bytes calldata callData) external payable returns (bytes memory);

The fallback function was called with the following amount of native tokens: msg.value; and the following calldata: callData.

Achieves the goal of LSP-17-ContractExtension standard by extending the contract to handle calls of functions that do not exist natively, forwarding the function call to the extension address mapped to the function being called. This function is executed when:

  • Sending data of length less than 4 bytes to the contract.

  • The first 4 bytes of the calldata do not match any publicly callable functions from the contract ABI.

  • Receiving native tokens

  1. If the data is equal or longer than 4 bytes, the ERC-725Y storage is queried with the following data key: _LSP17_EXTENSION_PREFIX + bytes4(msg.sig) (Check LSP-2-ERC725YJSONSchema for encoding the data key)
  • If there is no address stored under the following data key, revert with NoExtensionFoundForFunctionSelector(bytes4). The data key relative to bytes4(0) is an exception, where no reverts occurs if there is no extension address stored under. This exception is made to allow users to send random data (graffiti) to the account and to be able to react on it.

  • If there is an address, forward the msg.data to the extension using the CALL opcode, appending 52 bytes (20 bytes of msg.sender and 32 bytes of msg.value). Return what the calls returns, or revert if the call failed.

  1. If the data sent to this function is of length less than 4 bytes (not a function selector), revert.

receive​

References
receive() external payable;

LSP7 contract cannot receive native tokens.

Reverts whenever someone tries to send native tokens to a LSP7 contract.


authorizeOperator​

References
danger

To avoid front-running and Allowance Double-Spend Exploit when increasing or decreasing the authorized amount of an operator, it is advised to use the increaseAllowance and decreaseAllowance functions. For more information, see: https://docs.google.com/document/d/1YLPtQxZu1UAvO9cZ1O2RPXBbT0mooh4DYKjA_jp-RLM/

function authorizeOperator(
address operator,
uint256 amount,
bytes operatorNotificationData
) external nonpayable;

Sets an amount of tokens that an operator has access from the caller's balance (allowance). See authorizedAmountFor. Notify the operator based on the LSP1-UniversalReceiver standard

Parameters​

NameTypeDescription
operatoraddressThe address to authorize as an operator.
amountuint256The allowance amount of tokens operator has access to.
operatorNotificationDatabytesThe data to notify the operator about via LSP1.

authorizedAmountFor​

References
function authorizedAmountFor(
address operator,
address tokenOwner
) external view returns (uint256);

Get the amount of tokens operator address has access to from tokenOwner. Operators can send and burn tokens on behalf of their owners.

Parameters​

NameTypeDescription
operatoraddressThe operator's address to query the authorized amount for.
tokenOwneraddressThe token owner that operator has allowance on.

Returns​

NameTypeDescription
0uint256The amount of tokens the operator's address has access on the tokenOwner's balance.

balanceOf​

References
function balanceOf(address tokenOwner) external view returns (uint256);

Get the number of tokens owned by tokenOwner. If the token is divisible (the decimals function returns 18), the amount returned should be divided by 1e18 to get a better picture of the actual balance of the tokenOwner. Example: balanceOf(someAddress) -> 42_000_000_000_000_000_000 / 1e18 = 42 tokens

Parameters​

NameTypeDescription
tokenOwneraddressThe address of the token holder to query the balance for.

Returns​

NameTypeDescription
0uint256The amount of tokens owned by tokenOwner.

batchCalls​

References
info

It's not possible to send value along the functions call due to the use of delegatecall.

function batchCalls(bytes[] data) external nonpayable returns (bytes[] results);

Executing the following batch of abi-encoded function calls on the contract: data.

Allows a caller to batch different function calls in one call. Perform a delegatecall on self, to call different functions with preserving the context.

Parameters​

NameTypeDescription
databytes[]An array of ABI encoded function calls to be called on the contract.

Returns​

NameTypeDescription
resultsbytes[]An array of abi-encoded data returned by the functions executed.

decimals​

References
function decimals() external view returns (uint8);

Returns the number of decimals used to get its user representation. If the asset contract has been set to be non-divisible via the isNonDivisible_ parameter in the constructor, the decimals returned wiil be 0. Otherwise 18 is the common value.

Returns​

NameTypeDescription
0uint8the number of decimals. If 0 is returned, the asset is non-divisible.

decreaseAllowance​

References
function decreaseAllowance(
address operator,
address tokenOwner,
uint256 subtractedAmount,
bytes operatorNotificationData
) external nonpayable;

Decrease the allowance of operator by -subtractedAmount

Atomically decreases the allowance granted to operator by the caller. This is an alternative approach to authorizeOperator that can be used as a mitigation for the double spending allowance problem. Notify the operator based on the LSP1-UniversalReceiver standard

Parameters​

NameTypeDescription
operatoraddressThe operator to decrease allowance for msg.sender
tokenOwneraddressThe address of the token owner.
subtractedAmountuint256The amount to decrease by in the operator's allowance.
operatorNotificationDatabytes-

getData​

References
function getData(bytes32 dataKey) external view returns (bytes dataValue);

Reading the ERC725Y storage for data key dataKey returned the following value: dataValue.

Get in the ERC725Y storage the bytes data stored at a specific data key dataKey.

Parameters​

NameTypeDescription
dataKeybytes32The data key for which to retrieve the value.

Returns​

NameTypeDescription
dataValuebytesThe bytes value stored under the specified data key.

getDataBatch​

References
function getDataBatch(
bytes32[] dataKeys
) external view returns (bytes[] dataValues);

Reading the ERC725Y storage for data keys dataKeys returned the following values: dataValues.

Get in the ERC725Y storage the bytes data stored at multiple data keys dataKeys.

Parameters​

NameTypeDescription
dataKeysbytes32[]The array of keys which values to retrieve

Returns​

NameTypeDescription
dataValuesbytes[]The array of data stored at multiple keys

getOperatorsOf​

References
function getOperatorsOf(address tokenOwner) external view returns (address[]);

Returns all operator addresses that are allowed to transfer or burn on behalf of tokenOwner.

Parameters​

NameTypeDescription
tokenOwneraddressThe token owner to get the operators for.

Returns​

NameTypeDescription
0address[]An array of operators allowed to transfer or burn tokens on behalf of tokenOwner.

increaseAllowance​

References
function increaseAllowance(
address operator,
uint256 addedAmount,
bytes operatorNotificationData
) external nonpayable;

Increase the allowance of operator by +addedAmount

Atomically increases the allowance granted to operator by the caller. This is an alternative approach to authorizeOperator that can be used as a mitigation for the double spending allowance problem. Notify the operator based on the LSP1-UniversalReceiver standard

Parameters​

NameTypeDescription
operatoraddressThe operator to increase the allowance for msg.sender
addedAmountuint256The additional amount to add on top of the current operator's allowance
operatorNotificationDatabytes-

owner​

References
function owner() external view returns (address);

Returns the address of the current owner.

Returns​

NameTypeDescription
0address-

renounceOwnership​

References
function renounceOwnership() external nonpayable;

Leaves the contract without owner. It will not be possible to call onlyOwner functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.


revokeOperator​

References
function revokeOperator(
address operator,
address tokenOwner,
bool notify,
bytes operatorNotificationData
) external nonpayable;

Enables tokenOwner to remove operator for its tokens, disallowing it to send any amount of tokens on its behalf. This function also allows the operator to remove itself if it is the caller of this function

Parameters​

NameTypeDescription
operatoraddressThe address to revoke as an operator.
tokenOwneraddressThe address of the token owner.
notifyboolBoolean indicating whether to notify the operator or not.
operatorNotificationDatabytesThe data to notify the operator about via LSP1.

setData​

References
Warning

Note for developers: despite the fact that this function is set as payable, if the function is not intended to receive value (= native tokens), an additional check should be implemented to ensure that msg.value sent was equal to 0.

function setData(bytes32 dataKey, bytes dataValue) external payable;

Setting the following data key value pair in the ERC725Y storage. Data key: dataKey, data value: dataValue.

Sets a single bytes value dataValue in the ERC725Y storage for a specific data key dataKey. The function is marked as payable to enable flexibility on child contracts. For instance to implement a fee mechanism for setting specific data.

Requirements:

  • SHOULD only be callable by the owner.

Emitted events:

Parameters​

NameTypeDescription
dataKeybytes32The data key for which to set a new value.
dataValuebytesThe new bytes value to set.

setDataBatch​

References
Warning

Note for developers: despite the fact that this function is set as payable, if the function is not intended to receive value (= native tokens), an additional check should be implemented to ensure that msg.value sent was equal to 0.

function setDataBatch(bytes32[] dataKeys, bytes[] dataValues) external payable;

Setting the following data key value pairs in the ERC725Y storage. Data keys: dataKeys, data values: dataValues.

Batch data setting function that behaves the same as setData but allowing to set multiple data key/value pairs in the ERC725Y storage in the same transaction.

Requirements:

  • SHOULD only be callable by the owner of the contract.

Emitted events:

Parameters​

NameTypeDescription
dataKeysbytes32[]An array of data keys to set bytes values for.
dataValuesbytes[]An array of bytes values to set for each dataKeys.

supportsInterface​

References
function supportsInterface(bytes4 interfaceId) external view returns (bool);

Returns true if this contract implements the interface defined by interfaceId. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] to learn more about how these ids are created. This function call must use less than 30 000 gas.

Parameters​

NameTypeDescription
interfaceIdbytes4-

Returns​

NameTypeDescription
0bool-

totalSupply​

References
function totalSupply() external view returns (uint256);

Returns the number of existing tokens that have been minted in this contract.

Returns​

NameTypeDescription
0uint256The number of existing tokens.

transfer​

References
function transfer(
address from,
address to,
uint256 amount,
bool force,
bytes data
) external nonpayable;

Transfers an amount of tokens from the from address to the to address and notify both sender and recipients via the LSP1 universalReceiver(...) function. If the tokens are transferred by an operator on behalf of a token holder, the allowance for the operator will be decreased by amount once the token transfer has been completed (See authorizedAmountFor).

Parameters​

NameTypeDescription
fromaddressThe sender address.
toaddressThe recipient address.
amountuint256The amount of tokens to transfer.
forceboolWhen set to true, the to address CAN be any address. When set to false, the to address MUST be a contract that supports the LSP1 UniversalReceiver standard.
databytesAny additional data the caller wants included in the emitted event, and sent in the hooks of the from and to addresses.

transferBatch​

References
  • Specification details: LSP-7-DigitalAsset
  • Solidity implementation: LSP7DigitalAsset.sol
  • Function signature: transferBatch(address[],address[],uint256[],bool[],bytes[])
  • Function selector: 0x2d7667c9
function transferBatch(
address[] from,
address[] to,
uint256[] amount,
bool[] force,
bytes[] data
) external nonpayable;

Same as transfer(...) but transfer multiple tokens based on the arrays of from, to, amount.

Parameters​

NameTypeDescription
fromaddress[]An array of sending addresses.
toaddress[]An array of receiving addresses.
amountuint256[]An array of amount of tokens to transfer for each from -> to transfer.
forcebool[]For each transfer, when set to true, the to address CAN be any address. When set to false, the to address MUST be a contract that supports the LSP1 UniversalReceiver standard.
databytes[]An array of additional data the caller wants included in the emitted event, and sent in the hooks to from and to addresses.

transferOwnership​

References
function transferOwnership(address newOwner) external nonpayable;

Transfers ownership of the contract to a new account (newOwner). Can only be called by the current owner.

Parameters​

NameTypeDescription
newOwneraddress-

Internal Methods​

Any method labeled as internal serves as utility function within the contract. They can be used when writing solidity contracts that inherit from this contract. These methods can be extended or modified by overriding their internal behavior to suit specific needs.

Internal functions cannot be called externally, whether from other smart contracts, dApp interfaces, or backend services. Their restricted accessibility ensures that they remain exclusively available within the context of the current contract, promoting controlled and encapsulated usage of these internal utilities.

_checkOwner​

function _checkOwner() internal view;

Throws if the sender is not the owner.


_setOwner​

function _setOwner(address newOwner) internal nonpayable;

Changes the owner if newOwner and oldOwner are different This pattern is useful in inheritance.


_getData​

function _getData(bytes32 dataKey) internal view returns (bytes dataValue);

Read the value stored under a specific dataKey inside the underlying ERC725Y storage, represented as a mapping of bytes32 data keys mapped to their bytes data values.

mapping(bytes32 => bytes) _store

Parameters​

NameTypeDescription
dataKeybytes32A bytes32 data key to read the associated bytes value from the store.

Returns​

NameTypeDescription
dataValuebytesThe bytes value associated with the given dataKey in the ERC725Y storage.

_setData​

function _setData(bytes32 dataKey, bytes dataValue) internal nonpayable;

The ERC725Y data keys LSP4TokenName and LSP4TokenSymbol cannot be changed via this function once the digital asset contract has been deployed.


_updateOperator​

function _updateOperator(
address tokenOwner,
address operator,
uint256 allowance,
bool notified,
bytes operatorNotificationData
) internal nonpayable;

Changes token amount the operator has access to from tokenOwner tokens. If the amount is zero the operator is removed from the list of operators, otherwise he is added to the list of operators. If the amount is zero then the operator is being revoked, otherwise the operator amount is being modified.

Parameters​

NameTypeDescription
tokenOwneraddressThe address that will give operator an allowance for on its balance.
operatoraddress@param operatorNotificationData The data to send to the universalReceiver function of the operator in case of notifying
allowanceuint256The maximum amount of token that operator can spend from the tokenOwner's balance.
notifiedboolBoolean indicating whether the operator has been notified about the change of allowance
operatorNotificationDatabytesThe data to send to the universalReceiver function of the operator in case of notifying

_mint​

info

Any logic in the:

function _mint(
address to,
uint256 amount,
bool force,
bytes data
) internal nonpayable;

Mints amount of tokens and transfers it to to.

Emitted events:

  • Transfer event with address(0) as from.

Parameters​

NameTypeDescription
toaddressThe address to mint tokens for.
amountuint256The amount of tokens to mint.
forceboolA boolean that describe if transfer to a to address that does not support LSP1 is allowed or not.
databytesAdditional data the caller wants included in the emitted Transfer event, and sent in the LSP1 hook to the to address.

_burn​

info

Any logic in the:

Hint

In dApps, you can know which address is burning tokens by listening for the Transfer event and filter with the zero address as to.

function _burn(address from, uint256 amount, bytes data) internal nonpayable;

Burns (= destroys) amount of tokens, decrease the from balance. This is done by sending them to the zero address. Both the sender and recipient will be notified of the token transfer through the LSP1 universalReceiver function, if they are contracts that support the LSP1 interface. Their universalReceiver function will receive all the parameters in the calldata packed encoded.

Emitted events:

  • Transfer event with address(0) as the to address

Parameters​

NameTypeDescription
fromaddressThe address to burn tokens from its balance.
amountuint256The amount of tokens to burn.
databytesAdditional data the caller wants included in the emitted event, and sent in the LSP1 hook to the from and to address.

_spendAllowance​

function _spendAllowance(
address operator,
address tokenOwner,
uint256 amountToSpend
) internal nonpayable;

Spend amountToSpend from the operator's authorized on behalf of the tokenOwner.

Parameters​

NameTypeDescription
operatoraddressThe address of the operator to decrease the allowance of.
tokenOwneraddressThe address that granted an allowance on its balance to operator.
amountToSpenduint256The amount of tokens to substract in allowance of operator.

_transfer​

info

Any logic in the:

function _transfer(
address from,
address to,
uint256 amount,
bool force,
bytes data
) internal nonpayable;

Transfer tokens from from to to by decreasing the balance of from by -amount and increasing the balance of to by +amount. Both the sender and recipient will be notified of the token transfer through the LSP1 universalReceiver function, if they are contracts that support the LSP1 interface. Their universalReceiver function will receive all the parameters in the calldata packed encoded.

Emitted events:

Parameters​

NameTypeDescription
fromaddressThe address to decrease the balance.
toaddressThe address to increase the balance.
amountuint256The amount of tokens to transfer from from to to.
forceboolA boolean that describe if transfer to a to address that does not support LSP1 is allowed or not.
databytesAdditional data the caller wants included in the emitted event, and sent in the LSP1 hook to the from and to address.

_beforeTokenTransfer​

function _beforeTokenTransfer(
address from,
address to,
uint256 amount,
bytes data
) internal nonpayable;

Hook that is called before any token transfer, including minting and burning. Allows to run custom logic before updating balances and notifiying sender/recipient by overriding this function.

Parameters​

NameTypeDescription
fromaddressThe sender address
toaddressThe recipient address
amountuint256The amount of token to transfer
databytesThe data sent alongside the transfer

_afterTokenTransfer​

function _afterTokenTransfer(
address from,
address to,
uint256 amount,
bytes data
) internal nonpayable;

Hook that is called after any token transfer, including minting and burning. Allows to run custom logic after updating balances, but before notifiying sender/recipient by overriding this function.

Parameters​

NameTypeDescription
fromaddressThe sender address
toaddressThe recipient address
amountuint256The amount of token to transfer
databytesThe data sent alongside the transfer

_notifyTokenOperator​

function _notifyTokenOperator(
address operator,
bytes lsp1Data
) internal nonpayable;

Attempt to notify the operator operator about the amount tokens being authorized with. This is done by calling its universalReceiver function with the _TYPEID_LSP7_TOKENOPERATOR as typeId, if operator is a contract that supports the LSP1 interface. If operator is an EOA or a contract that does not support the LSP1 interface, nothing will happen and no notification will be sent.

Parameters​

NameTypeDescription
operatoraddressThe address to call the universalReceiver function on.
lsp1Databytesthe data to be sent to the operator address in the universalReceiver call.

_notifyTokenSender​

function _notifyTokenSender(address from, bytes lsp1Data) internal nonpayable;

Attempt to notify the token sender from about the amount of tokens being transferred. This is done by calling its universalReceiver function with the _TYPEID_LSP7_TOKENSSENDER as typeId, if from is a contract that supports the LSP1 interface. If from is an EOA or a contract that does not support the LSP1 interface, nothing will happen and no notification will be sent.

Parameters​

NameTypeDescription
fromaddressThe address to call the universalReceiver function on.
lsp1Databytesthe data to be sent to the from address in the universalReceiver call.

_notifyTokenReceiver​

function _notifyTokenReceiver(
address to,
bool force,
bytes lsp1Data
) internal nonpayable;

Attempt to notify the token receiver to about the amount tokens being received. This is done by calling its universalReceiver function with the _TYPEID_LSP7_TOKENSRECIPIENT as typeId, if to is a contract that supports the LSP1 interface. If to is is an EOA or a contract that does not support the LSP1 interface, the behaviour will depend on the force boolean flag.

  • if force is set to true, nothing will happen and no notification will be sent.

  • if force is set to `false, the transaction will revert.

Parameters​

NameTypeDescription
toaddressThe address to call the universalReceiver function on.
forceboolA boolean that describe if transfer to a to address that does not support LSP1 is allowed or not.
lsp1DatabytesThe data to be sent to the to address in the universalReceiver(...) call.

_supportsInterfaceInERC165Extension​

function _supportsInterfaceInERC165Extension(
bytes4 interfaceId
) internal view returns (bool);

Returns whether the interfaceId being checked is supported in the extension of the supportsInterface selector. To be used by extendable contracts wishing to extend the ERC165 interfaceIds originally supported by reading whether the interfaceId queried is supported in the supportsInterface extension if the extension is set, if not it returns false.


_getExtensionAndForwardValue​

function _getExtensionAndForwardValue(
bytes4 functionSelector
) internal view returns (address, bool);

Returns the extension address stored under the following data key:

  • _LSP17_EXTENSION_PREFIX + <bytes4> (Check [LSP2-ERC725YJSONSchema] for encoding the data key).

  • If no extension is stored, returns the address(0).

  • we do not check that payable bool as in lsp7 standard we will always forward the value to the extension


_fallbackLSP17Extendable​

info

The LSP7 Token contract should not hold any native tokens. Any native tokens received by the contract will be forwarded to the extension address mapped to the selector from msg.sig.

function _fallbackLSP17Extendable(
bytes callData
) internal nonpayable returns (bytes);

Forwards the call with the received value to an extension mapped to a function selector. Calls _getExtensionAndForwardValue to get the address of the extension mapped to the function selector being called on the account. If there is no extension, the address(0) will be returned. Forwards the value if the extension is payable. Reverts if there is no extension for the function being called. If there is an extension for the function selector being called, it calls the extension with the CALL opcode, passing the msg.data appended with the 20 bytes of the msg.sender and 32 bytes of the msg.value


Events​

DataChanged​

References
  • Specification details: LSP-7-DigitalAsset
  • Solidity implementation: LSP7DigitalAsset.sol
  • Event signature: DataChanged(bytes32,bytes)
  • Event topic hash: 0xece574603820d07bc9b91f2a932baadf4628aabcb8afba49776529c14a6104b2
event DataChanged(bytes32 indexed dataKey, bytes dataValue);

The following data key/value pair has been changed in the ERC725Y storage: Data key: dataKey, data value: dataValue.

Emitted when data at a specific dataKey was changed to a new value dataValue.

Parameters​

NameTypeDescription
dataKey indexedbytes32The data key for which a bytes value is set.
dataValuebytesThe value to set for the given data key.

OperatorAuthorizationChanged​

References
  • Specification details: LSP-7-DigitalAsset
  • Solidity implementation: LSP7DigitalAsset.sol
  • Event signature: OperatorAuthorizationChanged(address,address,uint256,bytes)
  • Event topic hash: 0xf772a43bfdf4729b196e3fb54a818b91a2ca6c49d10b2e16278752f9f515c25d
event OperatorAuthorizationChanged(
address indexed operator,
address indexed tokenOwner,
uint256 indexed amount,
bytes operatorNotificationData
);

Emitted when tokenOwner enables operator for amount tokens.

Parameters​

NameTypeDescription
operator indexedaddressThe address authorized as an operator
tokenOwner indexedaddressThe token owner
amount indexeduint256The amount of tokens operator address has access to from tokenOwner
operatorNotificationDatabytesThe data to notify the operator about via LSP1.

OperatorRevoked​

References
  • Specification details: LSP-7-DigitalAsset
  • Solidity implementation: LSP7DigitalAsset.sol
  • Event signature: OperatorRevoked(address,address,bool,bytes)
  • Event topic hash: 0x0ebf5762d8855cbe012d2ca42fb33a81175e17c8a8751f8859931ba453bd4167
event OperatorRevoked(
address indexed operator,
address indexed tokenOwner,
bool indexed notified,
bytes operatorNotificationData
);

Emitted when tokenOwner disables operator for amount tokens and set its authorizedAmountFor(...) to 0.

Parameters​

NameTypeDescription
operator indexedaddressThe address revoked from operating
tokenOwner indexedaddressThe token owner
notified indexedboolBool indicating whether the operator has been notified or not
operatorNotificationDatabytesThe data to notify the operator about via LSP1.

OwnershipTransferred​

References
  • Specification details: LSP-7-DigitalAsset
  • Solidity implementation: LSP7DigitalAsset.sol
  • Event signature: OwnershipTransferred(address,address)
  • Event topic hash: 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);

Parameters​

NameTypeDescription
previousOwner indexedaddress-
newOwner indexedaddress-

Transfer​

References
  • Specification details: LSP-7-DigitalAsset
  • Solidity implementation: LSP7DigitalAsset.sol
  • Event signature: Transfer(address,address,address,uint256,bool,bytes)
  • Event topic hash: 0x3997e418d2cef0b3b0e907b1e39605c3f7d32dbd061e82ea5b4a770d46a160a6
event Transfer(
address indexed operator,
address indexed from,
address indexed to,
uint256 amount,
bool force,
bytes data
);

Emitted when the from transferred successfully amount of tokens to to.

Parameters​

NameTypeDescription
operator indexedaddressThe address of the operator that executed the transfer.
from indexedaddressThe address which tokens were sent from (balance decreased by -amount).
to indexedaddressThe address that received the tokens (balance increased by +amount).
amountuint256The amount of tokens transferred.
forceboolif the transferred enforced the to recipient address to be a contract that implements the LSP1 standard or not.
databytesAny additional data included by the caller during the transfer, and sent in the LSP1 hooks to the from and to addresses.

Errors​

ERC725Y_DataKeysValuesEmptyArray​

References
error ERC725Y_DataKeysValuesEmptyArray();

Reverts when one of the array parameter provided to setDataBatch function is an empty array.


ERC725Y_DataKeysValuesLengthMismatch​

References
error ERC725Y_DataKeysValuesLengthMismatch();

Reverts when there is not the same number of elements in the datakeys and dataValues array parameters provided when calling the setDataBatch function.


ERC725Y_MsgValueDisallowed​

References
error ERC725Y_MsgValueDisallowed();

Reverts when sending value to the setData or setDataBatch function.


InvalidExtensionAddress​

References
error InvalidExtensionAddress(bytes storedData);

reverts when the bytes retrieved from the LSP17 data key is not a valid address (not 20 bytes)

Parameters​

NameTypeDescription
storedDatabytes-

InvalidFunctionSelector​

References
error InvalidFunctionSelector(bytes data);

reverts when the contract is called with a function selector not valid (less than 4 bytes of data)

Parameters​

NameTypeDescription
databytes-

LSP4TokenNameNotEditable​

References
error LSP4TokenNameNotEditable();

Reverts when trying to edit the data key LSP4TokenName after the digital asset contract has been deployed / initialized. The LSP4TokenName data key is located inside the ERC725Y data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed / initialized.


LSP4TokenSymbolNotEditable​

References
error LSP4TokenSymbolNotEditable();

Reverts when trying to edit the data key LSP4TokenSymbol after the digital asset contract has been deployed / initialized. The LSP4TokenSymbol data key is located inside the ERC725Y data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed / initialized.


LSP4TokenTypeNotEditable​

References
error LSP4TokenTypeNotEditable();

Reverts when trying to edit the data key LSP4TokenType after the digital asset contract has been deployed / initialized. The LSP4TokenType data key is located inside the ERC725Y data key-value store of the digital asset contract. It can be set only once inside the constructor / initializer when the digital asset contract is being deployed / initialized.


LSP7AmountExceedsAuthorizedAmount​

References
  • Specification details: LSP-7-DigitalAsset
  • Solidity implementation: LSP7DigitalAsset.sol
  • Error signature: LSP7AmountExceedsAuthorizedAmount(address,uint256,address,uint256)
  • Error hash: 0xf3a6b691
error LSP7AmountExceedsAuthorizedAmount(
address tokenOwner,
uint256 authorizedAmount,
address operator,
uint256 amount
);

reverts when operator of tokenOwner send an amount of tokens larger than the authorizedAmount.

Parameters​

NameTypeDescription
tokenOwneraddress-
authorizedAmountuint256-
operatoraddress-
amountuint256-

LSP7AmountExceedsBalance​

References
error LSP7AmountExceedsBalance(
uint256 balance,
address tokenOwner,
uint256 amount
);

reverts when sending an amount of tokens larger than the current balance of the tokenOwner.

Parameters​

NameTypeDescription
balanceuint256-
tokenOwneraddress-
amountuint256-

LSP7BatchCallFailed​

References
error LSP7BatchCallFailed(uint256 callIndex);

Batch call failed.

Reverts when a batch call failed.

Parameters​

NameTypeDescription
callIndexuint256-

LSP7CannotSendWithAddressZero​

References
error LSP7CannotSendWithAddressZero();

reverts when trying to:

  • mint tokens to the zero address.

  • burn tokens from the zero address.

  • transfer tokens from or to the zero address.


LSP7CannotUseAddressZeroAsOperator​

References
error LSP7CannotUseAddressZeroAsOperator();

reverts when trying to set the zero address as an operator.


LSP7DecreaseAllowanceNotAuthorized​

References
error LSP7DecreaseAllowanceNotAuthorized(
address caller,
address tokenOwner,
address operator
);

Reverts when the call to decrease allowance is not authorized.

Parameters​

NameTypeDescription
calleraddress-
tokenOwneraddress-
operatoraddress-

LSP7DecreasedAllowanceBelowZero​

References
error LSP7DecreasedAllowanceBelowZero();

Reverts when trying to decrease an operator's allowance to more than its current allowance.


LSP7InvalidTransferBatch​

References
error LSP7InvalidTransferBatch();

reverts when the array parameters used in transferBatch have different lengths.


LSP7NotifyTokenReceiverContractMissingLSP1Interface​

References
  • Specification details: LSP-7-DigitalAsset
  • Solidity implementation: LSP7DigitalAsset.sol
  • Error signature: LSP7NotifyTokenReceiverContractMissingLSP1Interface(address)
  • Error hash: 0xa608fbb6
error LSP7NotifyTokenReceiverContractMissingLSP1Interface(
address tokenReceiver
);

reverts if the tokenReceiver does not implement LSP1 when minting or transferring tokens with bool force set as false.

Parameters​

NameTypeDescription
tokenReceiveraddress-

LSP7NotifyTokenReceiverIsEOA​

References
error LSP7NotifyTokenReceiverIsEOA(address tokenReceiver);

reverts if the tokenReceiver is an EOA when minting or transferring tokens with bool force set as false.

Parameters​

NameTypeDescription
tokenReceiveraddress-

LSP7RevokeOperatorNotAuthorized​

References
error LSP7RevokeOperatorNotAuthorized(
address caller,
address tokenOwner,
address operator
);

Reverts when the call to revoke operator is not authorized.

Parameters​

NameTypeDescription
calleraddress-
tokenOwneraddress-
operatoraddress-

LSP7TokenContractCannotHoldValue​

References
error LSP7TokenContractCannotHoldValue();

LSP7 contract cannot receive native tokens.

Error occurs when sending native tokens to the LSP7 contract without sending any data. E.g. Sending value without passing a bytes4 function selector to call a LSP17 Extension.


LSP7TokenOwnerCannotBeOperator​

References
error LSP7TokenOwnerCannotBeOperator();

reverts when trying to authorize or revoke the token's owner as an operator.


NoExtensionFoundForFunctionSelector​

References
error NoExtensionFoundForFunctionSelector(bytes4 functionSelector);

reverts when there is no extension for the function selector being called with

Parameters​

NameTypeDescription
functionSelectorbytes4-

OperatorAllowanceCannotBeIncreasedFromZero​

References
error OperatorAllowanceCannotBeIncreasedFromZero(address operator);

Reverts when token owner call increaseAllowance for an operator that does not have any allowance

Parameters​

NameTypeDescription
operatoraddress-

OwnableCallerNotTheOwner​

References
error OwnableCallerNotTheOwner(address callerAddress);

Reverts when only the owner is allowed to call the function.

Parameters​

NameTypeDescription
callerAddressaddressThe address that tried to make the call.

OwnableCannotSetZeroAddressAsOwner​

References
error OwnableCannotSetZeroAddressAsOwner();

Reverts when trying to set address(0) as the contract owner when deploying the contract, initializing it or transferring ownership of the contract.