Skip to main content

LSP10Utils

Standard Specifications
Solidity implementation

LSP10 Utility library.

LSP5Utils is a library of functions that can be used to register and manage vaults received by an ERC725Y smart contract. Based on the LSP10 Received Vaults 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.

generateReceivedVaultKeys​

Warning

This function returns empty arrays when encountering errors. Otherwise the arrays will contain 3 data keys and 3 data values.

function generateReceivedVaultKeys(
address receiver,
address vaultAddress
) internal view returns (bytes32[] lsp10DataKeys, bytes[] lsp10DataValues);

Generate an array of data keys/values pairs to be set on the receiver address after receiving vaults.

Parameters​

NameTypeDescription
receiveraddressThe address receiving the vault and where the LSP10 data keys should be added.
vaultAddressaddressThe address of the vault being received.

Returns​

NameTypeDescription
lsp10DataKeysbytes32[]An array data keys used to update the [LSP-10-ReceivedAssets] data.
lsp10DataValuesbytes[]An array data values used to update the [LSP-10-ReceivedAssets] data.

generateSentVaultKeys​

Warning

Returns empty arrays when encountering errors. Otherwise the arrays must have at least 3 data keys and 3 data values.

function generateSentVaultKeys(
address sender,
address vaultAddress
) internal view returns (bytes32[] lsp10DataKeys, bytes[] lsp10DataValues);

Generate an array of data key/value pairs to be set on the sender address after sending vaults.

Parameters​

NameTypeDescription
senderaddressThe address sending the vault and where the LSP10 data keys should be updated.
vaultAddressaddressThe address of the vault that is being sent.

Returns​

NameTypeDescription
lsp10DataKeysbytes32[]An array data keys used to update the [LSP-10-ReceivedAssets] data.
lsp10DataValuesbytes[]An array data values used to update the [LSP-10-ReceivedAssets] data.

getLSP10ArrayLengthBytes​

function getLSP10ArrayLengthBytes(contract IERC725Y erc725YContract) internal view returns (bytes);

Get the raw bytes value stored under the _LSP10_VAULTS_ARRAY_KEY.

Parameters​

NameTypeDescription
erc725YContractcontract IERC725YThe contract to query the ERC725Y storage from.

Returns​

NameTypeDescription
0bytesThe raw bytes value stored under this data key.