Skip to content

Commit

Permalink
build!: move LSP4 in its own package
Browse files Browse the repository at this point in the history
  • Loading branch information
b00ste committed Jan 26, 2024
1 parent 6a51249 commit 494d192
Show file tree
Hide file tree
Showing 25 changed files with 316 additions and 14 deletions.
4 changes: 2 additions & 2 deletions .mythx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ analyze:
- contracts/LSP0ERC725Account/LSP0ERC725Account.sol
- contracts/LSP6KeyManager/LSP6KeyManager.sol
# - Tokens & NFTs
- contracts/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadata.sol
- lsp4/contracts/LSP4DigitalAssetMetadata.sol
- contracts/LSP7DigitalAsset/LSP7DigitalAsset.sol
- contracts/LSP7DigitalAsset/presets/LSP7Mintable.sol
- contracts/LSP7DigitalAsset/extensions/LSP7Burnable.sol
Expand All @@ -43,7 +43,7 @@ analyze:
# ------------------
- contracts/UniversalProfileInit.sol
- contracts/LSP0ERC725Account/LSP0ERC725AccountInit.sol
- contracts/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadataInitAbstract.sol
- lsp4/contracts/LSP4DigitalAssetMetadataInitAbstract.sol
- contracts/LSP6KeyManager/LSP6KeyManagerInit.sol
# - Tokens & NFTs
- contracts/LSP7DigitalAsset/LSP7DigitalAssetInitAbstract.sol
Expand Down
2 changes: 1 addition & 1 deletion contracts/LSP7DigitalAsset/LSP7DigitalAsset.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
import {ERC725YCore} from "@erc725/smart-contracts/contracts/ERC725YCore.sol";
import {
LSP4DigitalAssetMetadata
} from "../LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadata.sol";
} from "lsp4/contracts/LSP4DigitalAssetMetadata.sol";
import {LSP7DigitalAssetCore} from "./LSP7DigitalAssetCore.sol";
import {LSP17Extendable} from "../LSP17ContractExtension/LSP17Extendable.sol";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
import {ERC725YCore} from "@erc725/smart-contracts/contracts/ERC725YCore.sol";
import {
LSP4DigitalAssetMetadataInitAbstract
} from "../LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadataInitAbstract.sol";
} from "lsp4/contracts/LSP4DigitalAssetMetadataInitAbstract.sol";
import {LSP7DigitalAssetCore} from "./LSP7DigitalAssetCore.sol";

import {LSP17Extendable} from "../LSP17ContractExtension/LSP17Extendable.sol";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ import {
} from "./LSP8IdentifiableDigitalAssetCore.sol";
import {
LSP4DigitalAssetMetadata
} from "../LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadata.sol";
} from "lsp4/contracts/LSP4DigitalAssetMetadata.sol";

import {
LSP4DigitalAssetMetadataCore
} from "../LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadataCore.sol";
} from "lsp4/contracts/LSP4DigitalAssetMetadataCore.sol";

import {LSP17Extendable} from "../LSP17ContractExtension/LSP17Extendable.sol";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {

import {
LSP4DigitalAssetMetadataCore
} from "../LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadataCore.sol";
} from "lsp4/contracts/LSP4DigitalAssetMetadataCore.sol";

// libraries
import {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ import {
} from "./LSP8IdentifiableDigitalAssetCore.sol";
import {
LSP4DigitalAssetMetadataInitAbstract
} from "../LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadataInitAbstract.sol";
} from "lsp4/contracts/LSP4DigitalAssetMetadataInitAbstract.sol";

import {
LSP4DigitalAssetMetadataCore
} from "../LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadataCore.sol";
} from "lsp4/contracts/LSP4DigitalAssetMetadataCore.sol";

import {LSP17Extendable} from "../LSP17ContractExtension/LSP17Extendable.sol";

Expand Down
4 changes: 1 addition & 3 deletions dodoc/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const dodocConfig = {
'lsp25/contracts/LSP25MultiChannelNonce.sol',

// tokens
'contracts/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadata.sol',
'lsp4/contracts/LSP4DigitalAssetMetadata.sol',
'contracts/LSP7DigitalAsset/LSP7DigitalAsset.sol',
'contracts/LSP7DigitalAsset/extensions/LSP7Burnable.sol',
'contracts/LSP7DigitalAsset/extensions/LSP7CappedSupply.sol',
Expand All @@ -48,8 +48,6 @@ 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
72 changes: 72 additions & 0 deletions package-lock.json

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

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@
"@openzeppelin/contracts": "^4.9.2",
"@openzeppelin/contracts-upgradeable": "^4.9.2",
"solidity-bytes-utils": "0.8.0",
"lsp2": "*",
"lsp4": "*",
"lsp25": "*"
},
"devDependencies": {
Expand Down
4 changes: 4 additions & 0 deletions packages/LSP4DigitalAssetMetadata/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
root: true,
extends: ['custom'],
};
3 changes: 3 additions & 0 deletions packages/LSP4DigitalAssetMetadata/.gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "lib/forge-std"]
path = ../../lib/forge-std
url = https://github.com/foundry-rs/forge-std.git
25 changes: 25 additions & 0 deletions packages/LSP4DigitalAssetMetadata/.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/LSP4DigitalAssetMetadata/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# LSP4 Digital Asset Metadata

Package for the LSP4 Digital Asset Metadata standard.
10 changes: 10 additions & 0 deletions packages/LSP4DigitalAssetMetadata/foundry.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[profile.default]
src = 'contracts'
out = 'out'
libs = ['node_modules','lib']
cache_path = 'forge-cache'
test = 'foundry'
solc_version = "0.8.17"
[fuzz]
runs = 10_000
max_test_rejects = 200_000
128 changes: 128 additions & 0 deletions packages/LSP4DigitalAssetMetadata/hardhat.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
import { HardhatUserConfig } from 'hardhat/config';
import { NetworkUserConfig } from 'hardhat/types';
import { config as dotenvConfig } from 'dotenv';
import { resolve } from 'path';

/**
* this package includes:
* - @nomiclabs/hardhat-ethers
* - @nomicfoundation/hardhat-chai-matchers
* - @nomicfoundation/hardhat-network-helpers
* - @nomiclabs/hardhat-etherscan
* - hardhat-gas-reporter (is this true? Why do we have it as a separate dependency?)
* - @typechain/hardhat
* - solidity-coverage
*/
import '@nomicfoundation/hardhat-toolbox';

// additional hardhat plugins
import 'hardhat-packager';
import 'hardhat-contract-sizer';
import 'hardhat-deploy';

// custom built hardhat plugins and scripts
// can be imported here (e.g: docs generation, gas benchmark, etc...)

dotenvConfig({ path: resolve(__dirname, './.env') });

function getTestnetChainConfig(): NetworkUserConfig {
const config: NetworkUserConfig = {
live: true,
url: 'https://rpc.testnet.lukso.network',
chainId: 4201,
};

if (process.env.CONTRACT_VERIFICATION_TESTNET_PK !== undefined) {
config['accounts'] = [process.env.CONTRACT_VERIFICATION_TESTNET_PK];
}

return config;
}

const config: HardhatUserConfig = {
defaultNetwork: 'hardhat',
networks: {
hardhat: {
live: false,
saveDeployments: false,
allowBlocksWithSameTimestamp: true,
},
luksoTestnet: getTestnetChainConfig(),
},
namedAccounts: {
owner: 0,
},
// uncomment if the contracts from this LSP package must be deployed at deterministic
// // addresses across multiple chains
// deterministicDeployment: {
// luksoTestnet: {
// // Nick Factory. See https://github.com/Arachnid/deterministic-deployment-proxy
// factory: '0x4e59b44847b379578588920ca78fbf26c0b4956c',
// deployer: '0x3fab184622dc19b6109349b94811493bf2a45362',
// funding: '0x0000000000000000000000000000000000000000000000000000000000000000',
// signedTx:
// '0xf8a58085174876e800830186a08080b853604580600e600039806000f350fe7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe03601600081602082378035828234f58015156039578182fd5b8082525050506014600cf31ba02222222222222222222222222222222222222222222222222222222222222222a02222222222222222222222222222222222222222222222222222222222222222',
// },
// },
etherscan: {
apiKey: 'no-api-key-needed',
customChains: [
{
network: 'luksoTestnet',
chainId: 4201,
urls: {
apiURL: 'https://api.explorer.execution.testnet.lukso.network/api',
browserURL: 'https://explorer.execution.testnet.lukso.network/',
},
},
],
},
gasReporter: {
enabled: true,
currency: 'USD',
gasPrice: 21,
excludeContracts: ['Helpers/'],
src: './contracts',
showMethodSig: true,
},
solidity: {
version: '0.8.17',
settings: {
optimizer: {
enabled: true,
/**
* Optimize for how many times you intend to run the code.
* Lower values will optimize more for initial deployment cost, higher
* values will optimize more for high-frequency usage.
* @see https://docs.soliditylang.org/en/v0.8.6/internals/optimizer.html#opcode-based-optimizer-module
*/
runs: 1000,
},
outputSelection: {
'*': {
'*': ['storageLayout'],
},
},
},
},
packager: {
// What contracts to keep the artifacts and the bindings for.
contracts: [],
// Whether to include the TypeChain factories or not.
// If this is enabled, you need to run the TypeChain files through the TypeScript compiler before shipping to the registry.
includeFactories: true,
},
paths: {
artifacts: 'artifacts',
tests: 'tests',
},
typechain: {
outDir: 'types',
target: 'ethers-v5',
},
mocha: {
timeout: 10000000,
},
};

export default config;
Loading

0 comments on commit 494d192

Please sign in to comment.