Skip to main content

LSP1UniversalReceiverDelegateVault

Standard Specifications

Implementation of a UniversalReceiverDelegate for the [LSP9Vault]

The LSP1UniversalReceiverDelegateVault follows the LSP-1-UniversalReceiver standard and is designed for [LSP9Vault] contracts. The LSP1UniversalReceiverDelegateVault is a contract called by the universalReceiver(...) function of the [LSP-9-Vault] contract that:

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.

VERSION​

References
function VERSION() external view returns (string);

Contract version.

Returns​

NameTypeDescription
0string-

supportsInterface​

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

See IERC165-supportsInterface.

Parameters​

NameTypeDescription
interfaceIdbytes4-

Returns​

NameTypeDescription
0bool-

universalReceiverDelegate​

References
info
  • If some issues occured with generating the dataKeys or dataValues the returnedMessage will be an error message, otherwise it will be empty.
  • If an error occured when trying to use setDataBatch(dataKeys,dataValues), it will return the raw error data back to the caller.
function universalReceiverDelegate(
address notifier,
uint256,
bytes32 typeId,
bytes
) external nonpayable returns (bytes);

Reacted on received notification with typeId.

Handles two cases: Writes the received LSP-7-DigitalAsset or LSP-8-IdentifiableDigitalAsset assets into the vault storage according to the LSP-5-ReceivedAssets standard.

Requirements:

  • Cannot accept native tokens.

Parameters​

NameTypeDescription
notifieraddress-
_1uint256-
typeIdbytes32Unique identifier for a specific notification.
_3bytes-

Returns​

NameTypeDescription
0bytesThe result of the reaction for typeId.

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.

_tokenSender​

function _tokenSender(address notifier) internal nonpayable returns (bytes);

Handler for LSP7 and LSP8 token sender type id.

Parameters​

NameTypeDescription
notifieraddressThe LSP7 or LSP8 token address.

_tokenRecipient​

function _tokenRecipient(
address notifier,
bytes4 interfaceId
) internal nonpayable returns (bytes);

Handler for LSP7 and LSP8 token recipient type id.

Parameters​

NameTypeDescription
notifieraddressThe LSP7 or LSP8 token address.
interfaceIdbytes4The LSP7 or LSP8 interface id.

_setDataBatchWithoutReverting​

info

If an the low-level transaction revert, the returned data will be forwarded. Th contract that uses this function can use the Address library to revert with the revert reason.

function _setDataBatchWithoutReverting(
bytes32[] dataKeys,
bytes[] dataValues
) internal nonpayable returns (bytes);

Calls bytes4(keccak256(setDataBatch(bytes32[],bytes[]))) without checking for bool succes, but it returns all the data back.

Parameters​

NameTypeDescription
dataKeysbytes32[]Data Keys to be set.
dataValuesbytes[]Data Values to be set.

Errors​

CannotRegisterEOAsAsAssets​

References
error CannotRegisterEOAsAsAssets(address caller);

EOA: caller cannot be registered as an asset.

Reverts when EOA calls the universalReceiver(..) function with an asset/vault typeId.

Parameters​

NameTypeDescription
calleraddressThe address of the EOA