Skip to content

Commit

Permalink
build!: move LSP25 in its own package (#851)
Browse files Browse the repository at this point in the history
  • Loading branch information
CJ42 authored Jan 25, 2024
1 parent 607145a commit 6a51249
Show file tree
Hide file tree
Showing 26 changed files with 370 additions and 39 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/solc_version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,11 @@ jobs:
--allow-paths $(pwd)/node_modules/,$(pwd)/packages/ \
@=node_modules/@ \
solidity-bytes-utils/=node_modules/solidity-bytes-utils/ \
../=$(pwd)/contracts/
../=$(pwd)/contracts/ \
lsp25/=packages/LSP25ExecuteRelayCall/
else
solc contracts/**/*.sol \
@=node_modules/@ \
solidity-bytes-utils/=node_modules/solidity-bytes-utils/
solidity-bytes-utils/=node_modules/solidity-bytes-utils/ \
lsp25/=packages/LSP25ExecuteRelayCall/
fi;
6 changes: 3 additions & 3 deletions contracts/LSP6KeyManager/LSP6KeyManagerCore.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
} from "../LSP20CallVerification/ILSP20CallVerifier.sol";
import {
ILSP25ExecuteRelayCall as ILSP25
} from "../LSP25ExecuteRelayCall/ILSP25ExecuteRelayCall.sol";
} from "lsp25/contracts/ILSP25ExecuteRelayCall.sol";

// modules
import {ILSP14Ownable2Step} from "../LSP14Ownable2Step/ILSP14Ownable2Step.sol";
Expand All @@ -29,7 +29,7 @@ import {
import {LSP6OwnershipModule} from "./LSP6Modules/LSP6OwnershipModule.sol";
import {
LSP25MultiChannelNonce
} from "../LSP25ExecuteRelayCall/LSP25MultiChannelNonce.sol";
} from "lsp25/contracts/LSP25MultiChannelNonce.sol";

// libraries
import {BytesLib} from "solidity-bytes-utils/contracts/BytesLib.sol";
Expand Down Expand Up @@ -69,7 +69,7 @@ import {
_LSP20_VERIFY_CALL_SUCCESS_VALUE_WITH_POST_VERIFICATION,
_LSP20_VERIFY_CALL_RESULT_SUCCESS_VALUE
} from "../LSP20CallVerification/LSP20Constants.sol";
import {_INTERFACEID_LSP25} from "../LSP25ExecuteRelayCall/LSP25Constants.sol";
import {_INTERFACEID_LSP25} from "lsp25/contracts/LSP25Constants.sol";

/**
* @title Core implementation of the LSP6 Key Manager standard.
Expand Down
4 changes: 2 additions & 2 deletions contracts/Mocks/ERC165Interfaces.sol
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ import {
} from "../LSP20CallVerification/ILSP20CallVerifier.sol";
import {
ILSP25ExecuteRelayCall as ILSP25
} from "../LSP25ExecuteRelayCall/ILSP25ExecuteRelayCall.sol";
} from "lsp25/contracts/ILSP25ExecuteRelayCall.sol";

// constants
import {_INTERFACEID_LSP0} from "../LSP0ERC725Account/LSP0Constants.sol";
Expand All @@ -83,7 +83,7 @@ import {
_INTERFACEID_LSP20_CALL_VERIFICATION,
_INTERFACEID_LSP20_CALL_VERIFIER
} from "../LSP20CallVerification/LSP20Constants.sol";
import {_INTERFACEID_LSP25} from "../LSP25ExecuteRelayCall/LSP25Constants.sol";
import {_INTERFACEID_LSP25} from "lsp25/contracts/LSP25Constants.sol";

// libraries
import {
Expand Down
2 changes: 1 addition & 1 deletion contracts/Mocks/Reentrancy/BatchReentrancyRelayer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pragma solidity ^0.8.4;
// interfaces
import {
ILSP25ExecuteRelayCall
} from "../../LSP25ExecuteRelayCall/ILSP25ExecuteRelayCall.sol";
} from "lsp25/contracts/ILSP25ExecuteRelayCall.sol";

contract BatchReentrancyRelayer {
bytes[] private _signatures;
Expand Down
2 changes: 1 addition & 1 deletion contracts/Mocks/Reentrancy/SingleReentrancyRelayer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pragma solidity ^0.8.4;
// interfaces
import {
ILSP25ExecuteRelayCall
} from "../../LSP25ExecuteRelayCall/ILSP25ExecuteRelayCall.sol";
} from "lsp25/contracts/ILSP25ExecuteRelayCall.sol";

contract SingleReentrancyRelayer {
bytes private _signature;
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@

:::info Standard Specifications

[`LSP-25-ExecuteRelayCall`](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-25-ExecuteRelayCall.md)
[`LSP-25-MultiChannelNonce.sol`](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-25-MultiChannelNonce.sol.md)

:::
:::info Solidity implementation

[`LSP25MultiChannelNonce.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP25ExecuteRelayCall/LSP25MultiChannelNonce.sol)
[`LSP25MultiChannelNonce.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/lsp25/contracts/LSP25MultiChannelNonce.sol)

:::

Expand Down
15 changes: 9 additions & 6 deletions dodoc/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const dodocConfig = {
'contracts/LSP20CallVerification/LSP20CallVerification.sol',
'contracts/LSP23LinkedContractsFactory/LSP23LinkedContractsFactory.sol',
'contracts/LSP23LinkedContractsFactory/IPostDeploymentModule.sol',
'contracts/LSP25ExecuteRelayCall/LSP25MultiChannelNonce.sol',
'lsp25/contracts/LSP25MultiChannelNonce.sol',

// tokens
'contracts/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadata.sol',
Expand Down Expand Up @@ -48,6 +48,8 @@ export const dodocConfig = {

// external --------------------
'@erc725/smart-contracts/contracts/ERC725.sol',
// 'solidity-bytes-utils/contracts/BytesLib.sol',
'@openzeppelin/contracts/token/ERC20/ERC20.sol',
],
libraries: [
'contracts/LSP1UniversalReceiver/LSP1Utils.sol',
Expand Down Expand Up @@ -335,13 +337,14 @@ const generateContractSpecsDetails = (contractName: string) => {
if (value.endsWith(`${contractName}.sol`)) return value;
})[0];

const specs = contractPath.split('/')[1];
const specsIndex = contractPath.startsWith('lsp') ? 2 : 1;
const specs = contractPath.split('/')[specsIndex];

const specsName = `LSP-${specs.match(/\d+/)[0]}-${specs.split(/LSP\d+/)[1]}`;
const lspNumber = specs.match(/\d+/)[0];
const lspName = specs.split(/LSP\d+/)[1];

const specsLink = `${linkBase}lips/tree/main/LSPs/LSP-${specs.match(/\d+/)[0]}-${
specs.split(/LSP\d+/)[1]
}.md`;
const specsName = `LSP-${lspNumber}-${lspName}`;
const specsLink = `${linkBase}lips/tree/main/LSPs/LSP-${lspNumber}-${lspName}.md`;

return { specsName, specsLink };
};
Expand Down
114 changes: 107 additions & 7 deletions package-lock.json

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

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,11 @@
"@erc725/smart-contracts": "^7.0.0",
"@openzeppelin/contracts": "^4.9.2",
"@openzeppelin/contracts-upgradeable": "^4.9.2",
"solidity-bytes-utils": "0.8.0"
"solidity-bytes-utils": "0.8.0",
"lsp25": "*"
},
"devDependencies": {
"@b00ste/hardhat-dodoc": "^0.3.15",
"@b00ste/hardhat-dodoc": "^0.3.16",
"@defi-wonderland/smock": "^2.3.4",
"@erc725/erc725.js": "0.17.2",
"@lukso/eip191-signer.js": "^0.2.2",
Expand Down
4 changes: 4 additions & 0 deletions packages/LSP25ExecuteRelayCall/.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/LSP25ExecuteRelayCall/.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"
}
}
3 changes: 3 additions & 0 deletions packages/LSP25ExecuteRelayCall/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# LSP25 Execute Relay Call

Package for the LSP25 Execute Relay Call standard.
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.4;

import {
LSP25MultiChannelNonce
} from "../LSP25ExecuteRelayCall/LSP25MultiChannelNonce.sol";
import {LSP25MultiChannelNonce} from "../LSP25MultiChannelNonce.sol";

/**
* @dev This contract is used only for testing the internal functions.
Expand Down
Loading

0 comments on commit 6a51249

Please sign in to comment.