Smart Contracts
The smart contracts are public and open source on GitHub.
They are available as a npm package
@lukso/lsp-smart-contracts
.
Welcome to the LUKSO Smart Contracts documentation!
In this section, you will find all the documentation and resources related to the @lukso/lsp-smart-contracts
, the reference contract implementations in Solidity of the LUKSO Standard Proposals.
The @lukso/lsp-smart-contracts
codebase is modular, with each LSP standard and features implemented in separate contracts. This allows smart contract developers to "pick and choose" the contracts for the requirements and behaviors they need for their protocols and applications.
This modular design also helps in making the codebase easier to navigate and understand for developers using it.
Installation
- npm
- yarn
- pnpm
npm install @lukso/lsp-smart-contracts
yarn add @lukso/lsp-smart-contracts
pnpm add @lukso/lsp-smart-contracts
To set up your developer environment, you can check the 👉 getting started section for Smart Contract developers.
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...)
🌐 LSP3 Profile Metadata
Add information to an account or a vault, such as a profile/cover image, external links, attributes, 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
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:
Type | Description | Example |
---|---|---|
Standard contracts | One contract deployed per user. Deployed and initialized via a constructor . | LSP0ERC725Account.sol |
Base contracts | Deploy 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.