Skip to content

Commit

Permalink
Merge pull request #925 from lukso-network/create-lsp4utils
Browse files Browse the repository at this point in the history
feat: create `LSP4Utils.sol`
  • Loading branch information
CJ42 authored Mar 25, 2024
2 parents a6b47b1 + c4bd51a commit fbf7b3a
Show file tree
Hide file tree
Showing 11 changed files with 1,354 additions and 38 deletions.
3 changes: 2 additions & 1 deletion foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ libs = ['node_modules','lib']
gas_reports = ["LSP6ExecuteRestrictedController", "LSP6ExecuteUnrestrictedController", "LSP6SetDataRestrictedController", "LSP6SetDataUnrestrictedController"]
cache_path = 'forge-cache'
test = 'tests/foundry'
solc_version = "0.8.17"
solc = "0.8.17"

[fuzz]
runs = 10_000
Expand All @@ -30,3 +30,4 @@ out = 'packages/lsp16-contracts/contracts/foundry_artifacts'
src = 'packages/lsp-smart-contracts/contracts'
test = 'packages/lsp-smart-contracts/tests/foundry'
out = 'packages/lsp-smart-contracts/contracts/foundry_artifacts'
solc = "0.8.24"
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.4;

import "@lukso/lsp2-contracts/contracts/LSP2Constants.sol";
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.24;

import "@lukso/lsp4-contracts/contracts/LSP4Utils.sol";
64 changes: 47 additions & 17 deletions packages/lsp-smart-contracts/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,49 @@ import { dodocConfig } from './dodoc/config';

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

const DEFAULT_COMPILER_SETTINGS = {
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'],
},
},
},
};

const VIA_IR_SETTINGS = {
version: '0.8.24',
settings: {
viaIR: true,
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'],
},
},
},
};

function getTestnetChainConfig(): NetworkUserConfig {
const config: NetworkUserConfig = {
live: true,
Expand Down Expand Up @@ -120,23 +163,10 @@ const config: HardhatUserConfig = {
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'],
},
},
compilers: [DEFAULT_COMPILER_SETTINGS],
overrides: {
'@lukso/lsp4-contracts/contracts/LSP4Utils.sol': VIA_IR_SETTINGS,
'contracts/LSP4DigitalAssetMetadata/LSP4Utils.sol': VIA_IR_SETTINGS,
},
},
mocha: {
Expand Down
7 changes: 7 additions & 0 deletions packages/lsp2-contracts/contracts/LSP2Constants.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.4;

// Data verification methods hashes
bytes4 constant _KECCAK256_UTF8 = 0x6f357c6a;
bytes4 constant _KECCAK256_BYTES = 0x8019f9b1;
bytes4 constant _KECCAK256_ECDSA = 0xac75a10e;
3 changes: 2 additions & 1 deletion packages/lsp4-contracts/.solhint.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"reason-string": ["warn", { "maxLength": 120 }],
"avoid-low-level-calls": "off",
"no-empty-blocks": ["error", { "ignoreConstructors": true }],
"custom-errors": "off"
"custom-errors": "off",
"quotes": "off"
}
}
Loading

0 comments on commit fbf7b3a

Please sign in to comment.