Skip to content

Commit

Permalink
build!: move LSP9 in its own package
Browse files Browse the repository at this point in the history
  • Loading branch information
b00ste committed Feb 5, 2024
1 parent 7923e63 commit 97fe1a8
Show file tree
Hide file tree
Showing 28 changed files with 354 additions and 16 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/solc_version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ jobs:
lsp4/=packages/LSP4DigitalAssetMetadata/ \
lsp5/=packages/LSP5ReceivedAssets/ \
lsp6/=packages/LSP6KeyManager/ \
lsp9/=packages/LSP9Vault/ \
lsp10/=packages/LSP10ReceivedVaults/ \
lsp14/=packages/LSP14Ownable2Step/ \
lsp17contractextension/=packages/LSP17ContractExtension/ \
Expand All @@ -102,6 +103,7 @@ jobs:
lsp4/=packages/LSP4DigitalAssetMetadata/ \
lsp5/=packages/LSP5ReceivedAssets/ \
lsp6/=packages/LSP6KeyManager/ \
lsp9/=packages/LSP9Vault/ \
lsp10/=packages/LSP10ReceivedVaults/ \
lsp14/=packages/LSP14Ownable2Step/ \
lsp17contractextension/=packages/LSP17ContractExtension/ \
Expand Down
4 changes: 2 additions & 2 deletions .mythx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ analyze:
- contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.sol
- contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.sol
# - Vault & Social Recovery
- contracts/LSP9Vault/LSP9Vault.sol
- lsp9/contracts/LSP9Vault.sol
- contracts/LSP11BasicSocialRecovery/LSP11BasicSocialRecovery.sol

# Proxy version
Expand All @@ -53,7 +53,7 @@ analyze:
- contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupplyInitAbstract.sol
- contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8EnumerableInitAbstract.sol
# - Vault & Social Recovery
- contracts/LSP9Vault/LSP9VaultInit.sol
- lsp9/contracts/LSP9VaultInit.sol
- contracts/LSP11BasicSocialRecovery/LSP11BasicSocialRecoveryInit.sol

# Generic Modules & Factories
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import {
import {
_TYPEID_LSP9_OwnershipTransferred_SenderNotification,
_TYPEID_LSP9_OwnershipTransferred_RecipientNotification
} from "../../LSP9Vault/LSP9Constants.sol";
} from "lsp9/contracts/LSP9Constants.sol";

// errors
import {CannotRegisterEOAsAsAssets} from "../LSP1Errors.sol";
Expand Down
4 changes: 2 additions & 2 deletions contracts/Mocks/ERC165Interfaces.sol
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ import {
ILSP8IdentifiableDigitalAsset as ILSP8
} from "../LSP8IdentifiableDigitalAsset/ILSP8IdentifiableDigitalAsset.sol";

import {ILSP9Vault as ILSP9} from "../LSP9Vault/ILSP9Vault.sol";
import {ILSP9Vault as ILSP9} from "lsp9/contracts/ILSP9Vault.sol";
import {
ILSP11BasicSocialRecovery as ILSP11
} from "../LSP11BasicSocialRecovery/ILSP11BasicSocialRecovery.sol";
Expand All @@ -70,7 +70,7 @@ import {_INTERFACEID_LSP7} from "../LSP7DigitalAsset/LSP7Constants.sol";
import {
_INTERFACEID_LSP8
} from "../LSP8IdentifiableDigitalAsset/LSP8Constants.sol";
import {_INTERFACEID_LSP9} from "../LSP9Vault/LSP9Constants.sol";
import {_INTERFACEID_LSP9} from "lsp9/contracts/LSP9Constants.sol";
import {
_INTERFACEID_LSP11
} from "../LSP11BasicSocialRecovery/LSP11Constants.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/Mocks/LSP1TypeIDsTester.sol
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {
_TYPEID_LSP9_OwnershipTransferStarted,
_TYPEID_LSP9_OwnershipTransferred_SenderNotification,
_TYPEID_LSP9_OwnershipTransferred_RecipientNotification
} from "../LSP9Vault/LSP9Constants.sol";
} from "lsp9/contracts/LSP9Constants.sol";
import {
_TYPEID_LSP14_OwnershipTransferStarted,
_TYPEID_LSP14_OwnershipTransferred_SenderNotification,
Expand Down
2 changes: 1 addition & 1 deletion contracts/Mocks/UPWithInstantAcceptOwnership.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
} from "lsp0/contracts/LSP0Constants.sol";
import {
_TYPEID_LSP9_OwnershipTransferStarted
} from "../LSP9Vault/LSP9Constants.sol";
} from "lsp9/contracts/LSP9Constants.sol";
import {
_TYPEID_LSP14_OwnershipTransferStarted
} from "lsp14/contracts/LSP14Constants.sol";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {_TYPEID_LSP0_VALUE_RECEIVED} from "lsp0/contracts/LSP0Constants.sol";

import {_INTERFACEID_LSP1_DELEGATE} from "lsp1/contracts/LSP1Constants.sol";

import {_TYPEID_LSP9_VALUE_RECEIVED} from "../../LSP9Vault/LSP9Constants.sol";
import {_TYPEID_LSP9_VALUE_RECEIVED} from "lsp9/contracts/LSP9Constants.sol";

contract UniversalReceiverDelegateDataLYX is
ERC165Storage,
Expand Down
2 changes: 1 addition & 1 deletion dodoc/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export const dodocConfig = {
'contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateUP/LSP1UniversalReceiverDelegateUP.sol',
'contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateVault/LSP1UniversalReceiverDelegateVault.sol',
'lsp6/contracts/LSP6KeyManager.sol',
'contracts/LSP9Vault/LSP9Vault.sol',
'lsp9/contracts/LSP9Vault.sol',
'contracts/LSP11BasicSocialRecovery/LSP11BasicSocialRecovery.sol',
'lsp14/contracts/LSP14Ownable2Step.sol',
'contracts/LSP16UniversalFactory/LSP16UniversalFactory.sol',
Expand Down
56 changes: 56 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@
"lsp4": "*",
"lsp5": "*",
"lsp6": "*",
"lsp9": "*",
"lsp10": "*",
"lsp14": "*",
"lsp17contractextension": "*",
Expand Down
4 changes: 4 additions & 0 deletions packages/LSP9Vault/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
root: true,
extends: ['custom'],
};
25 changes: 25 additions & 0 deletions packages/LSP9Vault/.solhint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"extends": "solhint:recommended",
"rules": {
"avoid-sha3": "error",
"avoid-suicide": "error",
"avoid-throw": "error",
"avoid-tx-origin": "error",
"check-send-result": "error",
"compiler-version": ["error", "^0.8.0"],
"func-visibility": ["error", { "ignoreConstructors": true }],
"not-rely-on-block-hash": "error",
"not-rely-on-time": "error",
"reentrancy": "error",
"constructor-syntax": "error",
"private-vars-leading-underscore": ["error", { "strict": false }],
"imports-on-top": "error",
"visibility-modifier-order": "error",
"no-unused-import": "error",
"no-global-import": "error",
"reason-string": ["warn", { "maxLength": 120 }],
"avoid-low-level-calls": "off",
"no-empty-blocks": ["error", { "ignoreConstructors": true }],
"custom-errors": "off"
}
}
51 changes: 51 additions & 0 deletions packages/LSP9Vault/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# LSP Package Template

This project can be used as a skeleton to build a package for a LSP implementation in Solidity (LUKSO Standard Proposal)

It is based on Hardhat.

## How to setup a LSP as a package?

1. Copy the `template/` folder and paste it under the `packages/` folder. Then rename this `template/` folder that you copied with the LSP name.

You can do so either:

- manually, by copying the folder and pasting it inside `packages` and then renaming it.
or
- by running the following command from the root of the repository.

```bash
cp -r template packages/lsp-name
```

2. Update the `"name"` and `"description"` field inside the `package.json` for this LSP package you just created.

3. Setup the dependencies

If this LSP uses external dependencies like `@openzeppelin/contracts`, put them under `dependencies` with the version number.

```json
"@openzeppelin/contracts": "^4.9.3"
```

If this LSP uses other LSP as dependencies, put each LSP dependency as shown below. This will use the current code in the package:

```json
"@lsp2": "*"
```

4. Setup the npm commands for linting, building, testing, etc... under the `"scripts"` in the `package.json`

5. Test that all commands you setup run successfully

By running the commands below, your LSP package should come up in the list of packages that Turbo is running this command for.

```bash
turbo build
turbo lint
turbo lint:solidity
turbo test
turbo test:foundry
```

6. Finally update the relevant information in the `README.md` file in the folder of the newly created package, such as the title at the top, some description, etc...
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ pragma solidity ^0.8.4;
import {
OwnableUnset
} from "@erc725/smart-contracts/contracts/custom/OwnableUnset.sol";
import {Version} from "../Version.sol";
import {Version} from "./Version.sol";
import {LSP9VaultCore} from "./LSP9VaultCore.sol";

// libraries
Expand All @@ -17,7 +17,7 @@ import {
_LSP9_SUPPORTED_STANDARDS_VALUE,
_TYPEID_LSP9_VALUE_RECEIVED,
_TYPEID_LSP9_OwnershipTransferred_RecipientNotification
} from "../LSP9Vault/LSP9Constants.sol";
} from "./LSP9Constants.sol";

/**
* @title Implementation of LSP9Vault built on top of [ERC725], [LSP-1-UniversalReceiver]
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
pragma solidity ^0.8.4;

// modules
import {Version} from "../Version.sol";
import {Version} from "./Version.sol";
import {LSP9VaultInitAbstract} from "./LSP9VaultInitAbstract.sol";

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
_LSP9_SUPPORTED_STANDARDS_VALUE,
_TYPEID_LSP9_VALUE_RECEIVED,
_TYPEID_LSP9_OwnershipTransferred_RecipientNotification
} from "../LSP9Vault/LSP9Constants.sol";
} from "./LSP9Constants.sol";

/**
* @title Inheritable Proxy Implementation of LSP9Vault built on top of ERC725, LSP1UniversalReceiver
Expand Down
17 changes: 17 additions & 0 deletions packages/LSP9Vault/contracts/Version.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.4;

abstract contract Version {
/**
* @dev Get the version of the contract.
* @notice Contract version.
*
* @return The version of the the contract.
*/
// DO NOT CHANGE
// Comments block below is used by release-please to automatically update the version in this file.
// x-release-please-start-version
string public constant VERSION = "0.12.1";

// x-release-please-end
}
Loading

0 comments on commit 97fe1a8

Please sign in to comment.