GithubHelp home page GithubHelp logo

apiscerena / lsp-smart-contracts Goto Github PK

View Code? Open in Web Editor NEW

This project forked from lukso-network/lsp-smart-contracts

0.0 0.0 0.0 33.23 MB

The reference implementation for universal profiles smart contracts

Home Page: https://www.npmjs.com/package/@lukso/lsp-smart-contracts

License: Apache License 2.0

Shell 0.10% JavaScript 0.11% TypeScript 77.04% Solidity 22.75%

lsp-smart-contracts's Introduction

LSP Smart Contracts · npm version Coverage Status All Contributors

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.

Packages

This repo contains packages for the Solidity implementation of the LSP smart contracts.

Package NPM Description
@lukso/lsp0-contracts npm version LSP0 ERC725Account
@lukso/lsp1-contracts npm version LSP1 Universal Receiver
@lukso/lsp1delegate-contracts npm version LSP1 Universal Receiver Delegate
@lukso/lsp2-contracts npm version LSP2 ERC725Y JSON Schema
@lukso/lsp3-contracts npm version LSP3 Profile Metadata
@lukso/lsp4-contracts npm version LSP4 Digital Asset Metadata
@lukso/lsp5-contracts npm version LSP5 Received Assets
@lukso/lsp6-contracts npm version LSP6 Key Manager
@lukso/lsp7-contracts npm version LSP7 Digital Asset
@lukso/lsp8-contracts npm version LSP8 Identifiable Digital Asset
@lukso/lsp9-contracts npm version LSP9 Vault
@lukso/lsp10-contracts npm version LSP10 Received Vaults
@lukso/lsp12-contracts npm version LSP12 Issued Assets
@lukso/lsp14-contracts npm version LSP14 Ownable 2 Step
@lukso/lsp16-contracts npm version LSP16 Universal Factory
@lukso/lsp17-contracts npm version LSP17 Extensions Package
@lukso/lsp17contractextension-contracts npm version LSP17 Contract Extension Package
@lukso/lsp20-contracts npm version LSP20 Call Verification
@lukso/lsp23-contracts npm version LSP23 Linked Contracts Factory
@lukso/lsp25-contracts npm version LSP25 Execute Relay Call
@lukso/universalprofile-contracts npm version Universal Profile

Installation

npm

LSP smart contracts are available as a npm package.

npm install @lukso/lsp-smart-contracts

cloning the repository

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

Testing

For detailed instructions on how to run tests, please refer to our Testing Guide.

Usage

in Javascript

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
);

in Solidity

import "@lukso/lsp-smart-contracts/contracts/LSP0ERC725Account/LSP0ERC725Account.sol";

contract MyAccount is LSP0ERC725Account {
  constructor(address _newOwner) LSP0ERC725Account(_newOwner) {}
}

Deployment via hardhat

You can find more infos on how to deploy the contracts via hardhat in the DEPLOYMENT page.

Available Constants & Types

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',
},

Note for Hardhat Typescript projects

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.

Typescript types

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";

Audits

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.

Contributors ✨

Thanks goes to these wonderful people (emoji key):

Jean Cvllr
Jean Cvllr

💻
Yamen Merhi
Yamen Merhi

💻
Fabian Vogelsteller
Fabian Vogelsteller

💻
b00ste.lyx
b00ste.lyx

💻
Matthew Stevens
Matthew Stevens

💻
Reto Ryter
Reto Ryter

🔧 🚇
Callum Grindle
Callum Grindle

👀
Skima Harvey
Skima Harvey

💻
Jenea Vranceanu
Jenea Vranceanu

💻
Hugo Masclet
Hugo Masclet

👀 💻
Leondroid
Leondroid

👀
lucasmt
lucasmt

🐛
qian-hu
qian-hu

🛡️ 🐛
Magali Morin
Magali Morin

💻
Hugo Montenegro
Hugo Montenegro

📖
Volodymyr Lykhonis
Volodymyr Lykhonis

💻
Prosperity
Prosperity

📖
Michael Standen
Michael Standen

💻
Add your contributions

This project follows the all-contributors specification. Contributions of any kind welcome!

lsp-smart-contracts's People

Contributors

cj42 avatar yamenmerhi avatar b00ste avatar frozeman avatar skimaharvey avatar mattgstevens avatar rryter avatar callumgrindle avatar richtera avatar jeneavranceanu avatar dzbo avatar hugoo avatar screaminghawk avatar kalote avatar github-actions[bot] avatar fhildeb avatar hugo0 avatar magalimorin18 avatar onahprosperity avatar samuel-videau avatar lykhonis avatar lucasmt avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.