Skip to main content

Smart Contracts

Welcome to the LUKSO Smart Contracts documentation!

You will find on this page all the documentation and resources related to theΒ @lukso/lsp-smart-contracts, the reference implementation in Solidity of the LSPs (LUKSO Standard Proposals).

Each LSP standard and features are implemented in separate contracts under their own package. This allows developers toΒ "pick and choose"Β the contracts for the requirements and behaviours they need for their protocols and applications. The @lukso/lsp-smart-contracts package also contains all the LSPs implementations listed below.

This modular design also helps in making the codebase easier to navigate and understand for developers using it.

Installation​

with npm, yarn or pnpm​

To get all the LSP smart contracts, install the @lukso/lsp-smart-contracts.

npm install @lukso/lsp-smart-contracts

You can also install individual package based on the LSP that you need (see table above). For instance, if you only need the LSP7 Digital Asset contract implementation for your project, simply install the @lukso/lsp7-contracts package.

npm install @lukso/lsp7-contracts

with Foundry​

Currently, the monorepo structure of the LSP Smart Contracts create issues when installing via Foundry and forge. As a workaround, it is recommend to use the following method:

  1. install the smart contract package with your preferred package manager as shown above (npm, yarn or pnpm).
npm i @lukso/lsp7-contracts
  1. add the following in your remappings.txt or foundry.toml.
remappings.txt
@lukso/=node_modules/@lukso/

This will install the LUKSO LSP Solidity contracts in your node_modules/ folder and forge will remap your import @lukso/... statements in your .sol files by locating the LSP contracts in the node_modules/ folder.

Overview​

Overall the contracts can be divided by their usage.

Ownership & Access Control

πŸ” LSP6 Key Manager

Allows multi-control over the account using different permissions.

🌱 LSP11 Basic Social Recovery

Recover access to your Blockchain based account if you are locked using a social recovery mechanism.

2️⃣ LSP14 Ownable 2 Steps

A module to allow secure owner management of a smart contract using a 2-steps process for transferring and renouncing ownership.

Digital Assets

πŸ” LSP4 Digital Asset Metadata

Enables to add metadata to any digital asset contract (token or NFT).

πŸͺ™ LSP7 Digital Asset

Creates your own fungible token with the possibility to make it divisible or not.

🎨 LSP8 Identifiable Digital Asset

Creates a non-fungible token where each NFT can be represented differently (numbers, serial numbers, an ERC725Y contract per NFT...).

Accounts & Interactions

πŸ‘€ LSP0 ERC725 Account

A smart contract based account that can be used to represent an identity on-chain.

πŸ“’ LSP1 Universal Receiver

Allows to react on transfers and informations received (token transfers, notifications, etc...)

🏦 LSP9 Vault

A digital vault that can hold and transfer any assets, for storing funds separate from your main account.

🧩 LSP17 Contract Extension

Uses this to add more functionality to your contract, so that it can be flexible and extended overtime.

πŸ”„ LSP20 Call Verification

Module to make interacting with a smart contract easier, without having to resolve through its owner first.

β›½ LSP25 Execute Relay Call

Add Meta Transactions on your contract to enable gas-less transactions and more easily onboard new users.

Types of contracts​

info

If you are using base contracts and are deploying proxies for your application, it is recommended to use a factory pattern to deploy and initialize the proxies to avoid potential front-running issues.

The LSP16 Universal Factory or LSP23 Linked Contract Deployment can help you achieve this.

The @lukso/lsp-smart-contracts repository contains two types of contracts:

TypeDescriptionExample
Standard contractsOne contract deployed per user. Deployed and initialized via a constructor.LSP0ERC725Account.sol
Base contractsDeploy one contract for all users. To be used as base contract behind proxies. Initialized via a initalize(...) function.LSP0ERC725AccountInit.sol

LSP Recipes​

Some of the LSP standards do not have a contract implementation as they represent Metadata-Standards to be used in the implementation contracts.

Each contracts are not just related to one specific section. They could be used in different fashion and combination, with the Universal Profile, Digital Asset, and NFT 2.0 contracts.

For instance, the Universal Profile Browser extension comprises a set of contracts allow a better representation of the identity on the blockchain and better control over it.

Further Information​