Skip to main content

LSP1 - Universal Receiver Delegate


To better understand this standard, it is well-advised first to check the origin standard LSP1-UniversalReceiver.


Once deployed, the code of a smart contract can not be changed. However, builders can decide how their smart contracts implement the universalReceiver(...) function. This standard allows any external smart contract to change relations from the main contract to change function behavior.

Therefore, it is advised not to hardcode how the smart contract should handle and react to specific calls inside the universalReceiver(...) function. Instead, it should delegate this functionality to another external contract. Developers could then customize such contracts to implement a specific logic that is changeable anytime via an upgrade.

What does this standard represent ?​


This standard represents a smart contract delegated to the initial universalReceiver(...) function.

It contains a single function named universalReceiverDelegate(...) that takes the same parameters as the universalReceiver(...) function with two additional params:

  • address caller: the address that initially called the universalReceiver(...) function.

  • uint256 value: the amount of value sent to the universalReceiver(...) function.

How Delegation works​

The address of the UniversalReceiverDelegate contract should be set as a value for the data key LSP1UniversalReceiverDelegate, inside the ERC725Y Data key-value store of the implementation contract (contract implementing the universalReceiver(...) function).

With such an implementation, the universalReceiver(...) function can forward the call to its similar one called universalReceiverDelegate(...).

This external contract will then implement the universalReceiverDelegate(...) function. It is also recommended that this contract registers the LSP1UniversalReceiverDelegate interfaceId using ERC165.



There are several implementations of the standard. The LSP1UniversalReceiverDelegateUP contract is one of them and is used as a delegate to the universalReceiver(...) function of UniversalProfile contract.

At the moment, this contract allows to:

Token transfer scenario​

One of the possible scenarios is a token transfer between Alice and Bob. Alice wants to transfer a token owned by her Universal Profile to the Universal Profile of her friend Bob.

1. It calls the transfer(...) function on the token contract through the KeyManager.

executing transfer function

2. The transfer(...) function on the token contract will directly trigger a hook that will call the universalReceiver(...) function on both sender and recipient Universal Profiles.

token contract hooks calling universalReceiver function

3. 3. If the UniversalReceiverDelegate contract is set, it will be called by the universalReceiver(...) function and will execute its custom logic.

universalReceiver function calling UniversalReceiverDelegate contract

4. The UniversalReceiverDelegate of Universal Profile allows the transfer and set LSP5-ReceivedAssets data keys on both Profiles through the KeyManager.

UniversalReceiverDelegate setting data keys on profile