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
- yarn
- pnpm
npm install @lukso/lsp-smart-contracts
yarn add @lukso/lsp-smart-contracts
pnpm add @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
- yarn
- pnpm
npm install @lukso/lsp7-contracts
yarn add @lukso/lsp7-contracts
pnpm add @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:
- install the smart contract package with your preferred package manager as shown above (npm, yarn or pnpm).
npm i @lukso/lsp7-contracts
- add the following in your
remappings.txt
orfoundry.toml
.
@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β
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.