frozeman / lsp-smart-contracts

The reference implementation for universal profiles smart contracts

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

LSP Smart Contracts · npm version Coverage Status

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.

Overview

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

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 this.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) {
    
  }
}

Testing

Chai contract tests are defined under the tests directory. To run all the tests, run:

$ npm test

Deployment via hardhat

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

Available Constants

You can access interface IDs and other constants, using the constants.js file file from the lsp-smart-contracts package.

const {
    INTERFACE_IDS,
    ERC1271,
    OPERATIONS,
    SupportedStandards,
    ERC725YKeys,
    BasicUPSetup_Schema,
    PERMISSIONS,
    ALL_PERMISSIONS,
    Errors,
    EventSignatures,
} = require("@lukso/lsp-smart-contracts/constants.js");

It also includes constant values Array data keys to retrieve both the array length and for index access.

'LSP5ReceivedAssets[]': {
    length: '0x6460ee3c0aac563ccbf76d6e1d07bada78e3a9514e6382b736ed3f478ab7b90b',
    index: '0x6460ee3c0aac563ccbf76d6e1d07bada',
},

About

The reference implementation for universal profiles smart contracts

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

License:Apache License 2.0


Languages

Language:TypeScript 75.2%Language:Solidity 23.0%Language:JavaScript 1.6%Language:Shell 0.2%