The smart contracts reference implementation of the LUKSO Standard Proposals (LSPs).
For more information see Documentation on docs.lukso.tech.
This package is currently in early stages of development, use for testing or experimentation purposes only. |
---|
This repo contains packages for the Solidity implementation of the LSP smart contracts.
Package | NPM | Description |
---|---|---|
@lukso/lsp0-contracts |
LSP0 ERC725Account | |
@lukso/lsp1-contracts |
LSP1 Universal Receiver | |
@lukso/lsp1delegate-contracts |
LSP1 Universal Receiver Delegate | |
@lukso/lsp2-contracts |
LSP2 ERC725Y JSON Schema | |
@lukso/lsp3-contracts |
LSP3 Profile Metadata | |
@lukso/lsp4-contracts |
LSP4 Digital Asset Metadata | |
@lukso/lsp5-contracts |
LSP5 Received Assets | |
@lukso/lsp6-contracts |
LSP6 Key Manager | |
@lukso/lsp7-contracts |
LSP7 Digital Asset | |
@lukso/lsp8-contracts |
LSP8 Identifiable Digital Asset | |
@lukso/lsp9-contracts |
LSP9 Vault | |
@lukso/lsp10-contracts |
LSP10 Received Vaults | |
@lukso/lsp12-contracts |
LSP12 Issued Assets | |
@lukso/lsp14-contracts |
LSP14 Ownable 2 Step | |
@lukso/lsp16-contracts |
LSP16 Universal Factory | |
@lukso/lsp17-contracts |
LSP17 Extensions Package | |
@lukso/lsp17contractextension-contracts |
LSP17 Contract Extension Package | |
@lukso/lsp20-contracts |
LSP20 Call Verification | |
@lukso/lsp23-contracts |
LSP23 Linked Contracts Factory | |
@lukso/lsp25-contracts |
LSP25 Execute Relay Call | |
@lukso/universalprofile-contracts |
Universal Profile |
LSP smart contracts are available as a npm package.
npm install @lukso/lsp-smart-contracts
Alternatively you can also clone the repository and install its dependencies to start using the smart contracts.
$ git clone https://github.com/lukso-network/lsp-smart-contracts.git
$ cd ./lsp-smart-contracts
$ npm install
For detailed instructions on how to run tests, please refer to our Testing Guide.
You can use the contracts JSON ABI by importing them as follow:
import LSP0ERC725Account from "@lukso/lsp-smart-contracts/artifacts/LSP0ERC725Account.json";
const myContract = new web3.eth.Contract(
LSP0ERC725Account.abi,
"",
defaultOptions
);
import "@lukso/lsp-smart-contracts/contracts/LSP0ERC725Account/LSP0ERC725Account.sol";
contract MyAccount is LSP0ERC725Account {
constructor(address _newOwner) LSP0ERC725Account(_newOwner) {}
}
You can find more infos on how to deploy the contracts via hardhat in the DEPLOYMENT page.
The @lukso/lsp-smart-contracts
npm package contains useful constants such as Interface IDs or ERC725Y Data Keys related to the LSP Standards. You can import and access them as follow:
import {
INTERFACE_IDS,
ERC1271,
OPERATIONS,
SupportedStandards,
ERC725YDataKeys,
PERMISSIONS,
ALL_PERMISSIONS,
LSP8_TOKEN_ID_SCHEMA,
LSP25_VERSION,
ErrorSelectors,
EventSigHashes,
FunctionSelectors,
ContractsDocs,
StateVariables,
} from "@lukso/lsp-smart-contracts";
Note: we also export it as
@lukso/lsp-smart-contracts/constants
or@lukso/lsp-smart-contracts/constants.js
to keep it backward compatible.
It also includes constant values Array data keys to retrieve both the array length and for index access.
'LSP5ReceivedAssets[]': {
length: '0x6460ee3c0aac563ccbf76d6e1d07bada78e3a9514e6382b736ed3f478ab7b90b',
index: '0x6460ee3c0aac563ccbf76d6e1d07bada',
},
If you are trying to import the constants in a Hardhat project that uses Typescript, you will need to import the constants from the dist
folder directly, as shown in the code snippet:
import { INTERFACE_IDS } from "@lukso/lsp-smart-contracts/dist/constants.cjs.js";
// This will raise an error if you have ES Lint enabled,
// but will allow you to import the constants in a Hardhat + Typescript based project.
const LSP0InterfaceId = INTERFACE_IDS.LSP0ERC725Account;
See the issue related to Hardhat Typescript + ES Modules in the Hardhat docs for more infos.
The following additional typescript types are also available, including types for the JSON format of the LSP3 Profile and LSP4 Digital Asset metadata.
import {
LSP2ArrayKey,
LSPSupportedStandard,
LSP6PermissionName,
LSP3ProfileMetadataJSON,
LSP3ProfileMetadata,
LSP4DigitalAssetMetadataJSON,
LSP4DigitalAssetMetadata,
ImageMetadata,
LinkMetadata,
AssetMetadata,
} from "@lukso/lsp-smart-contracts";
NB: dates of the audit reports use the american date format YYYY-MM-DD.
The following audits and formal verification were conducted. All high-level issues were addressed, or were not deemed as critical.
- Chainsulting Audit, 2022-07-06, Final Result: Chainsulting_audit_06_07_2022.pdf
- Quantstamp Audit, 2022-09-07, Final Result: Quantstamp_audit_07_09_2022.pdf
- Watchpug Audit, 2022-10-20, Final Result: Watchpug_audit_20_10_2022.pdf
- Watchpug Audit, 2022-12-15, Final Result: Watchpug_audit_15_12_2022.pdf
- Runtime Verification - Formal Verification, 2023-02-20, Final Result: RuntimeVerification_formalVerification_2023_02_20.pdf
- Trust Audit, 2023-04-13, Final Result: Trust_audit_2023_04_13.pdf
- Watchpug Audit, 2023-04-21, Final Result: Watchpug_audit_2023_04_21.pdf
- Code4Rena Audit Contest, 2023-06-30 to 2023-07-14, Final Result: See Code4Rena audit report on Code4rena.com website
- MiloTruck, 2023-11-31, Final Result: MiloTruck_audit_2023_11_31.pdf
- MiloTruck, 2024-01-24, Final Result: MiloTruck_audit_2024_01_24.pdf
The implementation contracts of the LSPs exist thanks to their contributors. There are many ways you can participate and help build high quality software. Check out the contribution guidelines!
Thanks goes to these wonderful people (emoji key):
This project follows the all-contributors specification. Contributions of any kind welcome!