Skip to main content

LSP1Utils

Standard Specifications
Solidity implementation

LSP1 Utility library.

LSP1Utils is a library of utility functions that can be used to notify the universalReceiver function of a contract that implements LSP1 and retrieve informations related to LSP1 typeId. Based on LSP1 Universal Receiver standard.

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.

notifyUniversalReceiver​

function notifyUniversalReceiver(
address lsp1Implementation,
bytes32 typeId,
bytes data
) internal nonpayable;

Notify a contract at lsp1Implementation address by calling its universalReceiver function if this contract supports the LSP1 interface.

Parameters​

NameTypeDescription
lsp1ImplementationaddressThe address of the contract to notify.
typeIdbytes32A bytes32 typeId.
databytesAny optional data to send to the universalReceiver function to the lsp1Implementation address.

getLSP1DelegateValue​

function getLSP1DelegateValue(
mapping(bytes32 => bytes) erc725YStorage
) internal view returns (bytes);

Retrieving the value stored under the ERC725Y data key LSP1UniversalReceiverDelegate.

Query internally the ERC725Y storage of a ERC725Y smart contract to retrieve the value set under the LSP1UniversalReceiverDelegate data key.

Parameters​

NameTypeDescription
erc725YStoragemapping(bytes32 => bytes)A reference to the ERC725Y storage mapping of the contract.

Returns​

NameTypeDescription
0bytesThe bytes value stored under the LSP1UniversalReceiverDelegate data key.

getLSP1DelegateValueForTypeId​

function getLSP1DelegateValueForTypeId(
mapping(bytes32 => bytes) erc725YStorage,
bytes32 typeId
) internal view returns (bytes);

Retrieving the value stored under the ERC725Y data key LSP1UniversalReceiverDelegate:<type-id> for a specific typeId.

Query internally the ERC725Y storage of a ERC725Y smart contract to retrieve the value set under the LSP1UniversalReceiverDelegate:<bytes32> data key for a specific LSP1 typeId.

Parameters​

NameTypeDescription
erc725YStoragemapping(bytes32 => bytes)A reference to the ERC725Y storage mapping of the contract.
typeIdbytes32A bytes32 LSP1 typeId;

Returns​

NameTypeDescription
0bytesThe bytes value stored under the LSP1UniversalReceiverDelegate:<bytes32> data key.