Skip to content

Commit

Permalink
Merge branch 'main' into dan/2024/02/bump-comiler-version
Browse files Browse the repository at this point in the history
  • Loading branch information
d1ll0n authored Feb 16, 2024
2 parents 0b37c49 + 30e4229 commit 3f553e9
Show file tree
Hide file tree
Showing 10 changed files with 6,700 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
.env

node_modules

#foundry test compilation files
cache
out
Expand All @@ -24,6 +26,9 @@ reference-out
optimized-out
reference-working
offerers-out
reference-cache
optimized-cache
test-cache

Seaport.yul

Expand Down
15 changes: 15 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
node_modules
artifacts
cache
coverage*
gasReporterOutput.json

typechain-types/

lib/ds-test
lib/forge-std
lib/murky
lib/openzeppelin-contracts
lib/solmate

docs/OrderValidator.md
13 changes: 13 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module.exports = {
overrides: [
{
files: "*.sol",
options: {
tabWidth: 4,
printWidth: 80,
bracketSpacing: true,
compiler: "0.8.17",
},
},
],
};
64 changes: 64 additions & 0 deletions config/.solcover-reference.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
module.exports = {
skipFiles: [
"conduit/Conduit.sol",
"conduit/ConduitController.sol",
"conduit/lib/ConduitEnums.sol",
"conduit/lib/ConduitStructs.sol",
"Consideration.sol",
"helpers/PointerLibraries.sol",
"interfaces/AbridgedProxyInterfaces.sol",
"interfaces/AbridgedTokenInterfaces.sol",
"interfaces/ConduitControllerInterface.sol",
"interfaces/ConduitInterface.sol",
"interfaces/ConsiderationEventsAndErrors.sol",
"interfaces/ConsiderationInterface.sol",
"interfaces/ContractOffererInterface.sol",
"interfaces/EIP1271Interface.sol",
"interfaces/ERC165.sol",
"interfaces/SeaportInterface.sol",
"interfaces/ZoneInterface.sol",
"lib/ConsiderationBase.sol",
"lib/ConsiderationConstants.sol",
"lib/ConsiderationEnums.sol",
"lib/ConsiderationInternal.sol",
"lib/ConsiderationInternalView.sol",
"lib/ConsiderationPure.sol",
"lib/ConsiderationStructs.sol",
"lib/TokenTransferrer.sol",
"test/EIP1271Wallet.sol",
"test/ExcessReturnDataRecipient.sol",
"test/ERC1155BatchRecipient.sol",
"test/InvalidEthRecipient.sol",
"test/Reenterer.sol",
"test/TestERC1155.sol",
"test/TestERC1155Revert.sol",
"test/TestERC20.sol",
"test/TestERC20NotOk.sol",
"test/TestERC721.sol",
"test/TestERC721Revert.sol",
"test/TestContractOfferer.sol",
"test/TestContractOffererNativeToken.sol",
"test/TestInvalidContractOfferer.sol",
"test/TestInvalidContractOffererRatifyOrder.sol",
"test/TestBadContractOfferer.sol",
"test/TestPostExecution.sol",
"test/TestZone.sol",
"test/TestERC20Panic.sol",
"test/TestERC20Revert.sol",
"test/InvalidERC721Recipient.sol",
"test/ERC721ReceiverMock.sol",
"test/ConduitControllerMock.sol",
"test/ConduitMock.sol",
"test/ConduitMockErrors.sol",
"test/ConduitMockInvalidMagic.sol",
"test/ConduitMockRevertBytes.sol",
"test/ConduitMockRevertNoReason.sol",
"test/TestTransferValidationZoneOfferer.sol",
"zones/PausableZone.sol",
"zones/PausableZoneController.sol",
"zones/interfaces/PausableZoneControllerInterface.sol",
"zones/interfaces/PausableZoneEventsAndErrors.sol",
"zones/interfaces/PausableZoneInterface.sol",
"../reference/shim/Shim.sol",
],
};
62 changes: 62 additions & 0 deletions config/.solcover.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
module.exports = {
skipFiles: [
"conduit/lib/ConduitEnums.sol",
"conduit/lib/ConduitStructs.sol",
"helpers/PointerLibraries.sol",
"interfaces/AbridgedProxyInterfaces.sol",
"interfaces/AbridgedTokenInterfaces.sol",
"interfaces/ConduitControllerInterface.sol",
"interfaces/ConduitInterface.sol",
"interfaces/ConsiderationEventsAndErrors.sol",
"interfaces/ConsiderationInterface.sol",
"interfaces/ContractOffererInterface.sol",
"interfaces/EIP1271Interface.sol",
"interfaces/ERC165.sol",
"interfaces/SeaportInterface.sol",
"interfaces/ZoneInterface.sol",
"lib/ConsiderationConstants.sol",
"lib/ConsiderationEnums.sol",
"lib/ConsiderationStructs.sol",
"test/EIP1271Wallet.sol",
"test/ExcessReturnDataRecipient.sol",
"test/ERC1155BatchRecipient.sol",
"test/InvalidEthRecipient.sol",
"test/Reenterer.sol",
"test/TestERC1155.sol",
"test/TestERC1155Revert.sol",
"test/TestERC20.sol",
"test/TestERC20NotOk.sol",
"test/TestERC721.sol",
"test/TestERC721Revert.sol",
"test/TestContractOfferer.sol",
"test/TestContractOffererNativeToken.sol",
"test/TestInvalidContractOfferer.sol",
"test/TestInvalidContractOffererRatifyOrder.sol",
"test/TestBadContractOfferer.sol",
"test/TestPostExecution.sol",
"test/TestZone.sol",
"test/TestERC20Panic.sol",
"test/TestERC20Revert.sol",
"test/InvalidERC721Recipient.sol",
"test/ERC721ReceiverMock.sol",
"test/ConduitControllerMock.sol",
"test/ConduitMock.sol",
"test/ConduitMockErrors.sol",
"test/ConduitMockInvalidMagic.sol",
"test/ConduitMockRevertBytes.sol",
"test/ConduitMockRevertNoReason.sol",
"test/TestTransferValidationZoneOfferer.sol",
"zones/PausableZone.sol",
"zones/PausableZoneController.sol",
"zones/interfaces/PausableZoneControllerInterface.sol",
"zones/interfaces/PausableZoneEventsAndErrors.sol",
"zones/interfaces/PausableZoneInterface.sol",
],
configureYulOptimizer: true,
solcOptimizerDetails: {
yul: true,
yulDetails: {
stackAllocation: true,
},
},
};
16 changes: 16 additions & 0 deletions config/.solhint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"extends": "solhint:all",
"rules": {
"compiler-version": ["error", ">=0.8.7"],
"func-visibility": ["warn", { "ignoreConstructors": true }],
"no-empty-blocks": "off",
"no-inline-assembly": "off",
"avoid-low-level-calls": "off",
"not-rely-on-time": "off",
"var-name-mixedcase": "off",
"func-name-mixedcase": "off",
"max-line-length": ["warn", 80],
"function-max-lines": "off",
"code-complexity": ["warn", 15]
}
}
6 changes: 6 additions & 0 deletions config/.solhintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
node_modules/

contracts/test/

test/
lib/
4 changes: 4 additions & 0 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ out = 'reference-out'
script = 'reference'
# specify something so it doesn't try to compile the files in test/foundry
test = 'test/foundry'
cache_path='reference-cache'

[profile.optimized]
src = 'src'
Expand All @@ -57,9 +58,12 @@ bytecode_hash = 'none'
# no need to compile tests with via-ir since they load optimized bytecode directly by default
test ='src/main'
evm_version = "shanghai"
cache_path='optimized-cache'
extra_output_files=['irOptimized']

[profile.test]
src = 'test/foundry'
cache_path='test-cache'

[profile.test.fuzz]
runs = 1_000
Expand Down
122 changes: 122 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
{
"name": "seaport",
"version": "1.6.0",
"description": "Seaport is a marketplace protocol for safely and efficiently buying and selling NFTs. Each listing contains an arbitrary number of items that the offerer is willing to give (the \"offer\") along with an arbitrary number of items that must be received along with their respective receivers (the \"consideration\").",
"main": "contracts/Seaport.sol",
"author": "0age",
"license": "MIT",
"private": false,
"engines": {
"node": ">=16.15.1"
},
"dependencies": {
"@nomicfoundation/hardhat-network-helpers": "^1.0.7",
"@openzeppelin/contracts": "^4.9.3",
"ethers": "^5.5.3",
"ethers-eip712": "^0.2.0",
"hardhat": "^2.12.1-ir.0",
"merkletreejs": "^0.3.9",
"seaport-core": "^1.5.0",
"seaport-sol": "^1.5.0",
"seaport-types": "^0.0.1",
"solady": "^0.0.84"
},
"devDependencies": {
"@nomicfoundation/hardhat-chai-matchers": "^1.0.5",
"@nomiclabs/hardhat-ethers": "^2.0.6",
"@nomiclabs/hardhat-etherscan": "^3.1.0",
"@rari-capital/solmate": "^6.2.0",
"@typechain/ethers-v5": "^10.0.0",
"@typechain/hardhat": "^6.0.0",
"@types/chai": "^4.3.0",
"@types/mocha": "^10.0.1",
"@types/node": "^18.11.11",
"@typescript-eslint/eslint-plugin": "^5.9.1",
"@typescript-eslint/parser": "^5.9.1",
"chai": "^4.3.4",
"cli-barchart": "^0.2.3",
"dotenv": "^16.0.0",
"eslint": "^8.6.0",
"eslint-config-prettier": "^8.3.0",
"eslint-config-standard": "^17.0.0",
"eslint-plugin-import": "^2.25.4",
"eslint-plugin-n": "^15.2.0",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-promise": "^6.0.0",
"hardhat-gas-reporter": "^1.0.7",
"husky": ">=6",
"lint-staged": ">=10",
"prettier": "^2.5.1",
"prettier-plugin-solidity": "^1.1.0",
"scuffed-abi": "^1.0.4",
"solhint": "^3.3.6",
"solidity-coverage": "^0.8.2",
"ts-node": "^10.4.0",
"typechain": "^8.0.0",
"typescript": "^4.5.4"
},
"resolutions": {
"async": ">=2.6.4",
"cross-fetch": ">=3.1.5",
"got": ">=11.8.5",
"lodash": ">=4.17.21",
"node-fetch": ">=2.6.7",
"underscore": ">=1.12.1",
"undici": ">=5.8.2",
"yargs-parser": ">=5.0.1",
"minimist": ">=1.2.6",
"json-schema": ">=0.4.0",
"simple-get": ">=2.8.2",
"tar": ">=4.4.18",
"normalize-url": ">=4.5.1",
"ws": ">=5.2.3",
"path-parse": ">=1.0.7",
"elliptic": ">=6.5.4",
"minimatch": ">=3.0.5",
"flat": ">=5.0.1",
"json5": ">=1.0.2",
"cookiejar": ">=2.1.4"
},
"scripts": {
"build": "yarn clean; hardhat compile --config ./hardhat.config.ts; yarn show:headroom;",
"build:quick": "hardhat compile --config ./hardhat.config.ts; yarn show:headroom;",
"build:ref": "hardhat compile --config ./hardhat-reference.config.ts",
"build:opt": "FOUNDRY_PROFILE=optimized forge build",
"build:nospec": "yarn clean; NO_SPECIALIZER=true hardhat compile --config ./hardhat.config.ts; yarn show:headroom;",
"clean": "hardhat clean; hardhat clean --config ./hardhat-reference.config.ts; forge clean; rm -rf coverage coverage.json hh-cache hh-cache-ref",
"test": "yarn clean; hardhat test --config ./hardhat.config.ts",
"test:quick": "hardhat test --config ./hardhat.config.ts",
"test:nospec": "NO_SPECIALIZER=true hardhat test --config ./hardhat.config.ts",
"test:ref": "REFERENCE=true hardhat test --config ./hardhat-reference.config.ts",
"profile": "yarn clean; REPORT_GAS=true hardhat test --config ./hardhat.config.ts; hardhat compare-reports",
"profile:show": "hardhat compare-reports",
"profile:nospec": "yarn clean; NO_SPECIALIZER=true REPORT_GAS=true hardhat test --config ./hardhat.config.ts",
"coverage": "yarn clean; hardhat coverage --config ./hardhat-coverage.config.ts --solcoverjs ./config/.solcover.js",
"coverage:ref": "REFERENCE=true hardhat coverage --config ./hardhat-reference-coverage.config.ts --solcoverjs ./config/.solcover-reference.js",
"coverage:forge": "SEAPORT_COVERAGE=true forge coverage --report summary",
"coverage:fuzz": "SEAPORT_COVERAGE=true forge coverage --match-path test/foundry/new/FuzzCoverage.t.sol --report summary --report lcov && lcov -o lcov.info --remove lcov.info --rc lcov_branch_coverage=1 --rc lcov_function_coverage=1 'test/*' 'script/*' 'contracts/helpers/*' 'contracts/test/*' 'contracts/zones/*' 'reference/*' && genhtml lcov.info -o html --branch",
"generate:optimized-yul": "yarn build; jq -r '.output.contracts.\"contracts/Seaport.sol\".Seaport.irOptimized' artifacts/build-info/\"$(jq -r '.buildInfo[17:]' artifacts/contracts/Seaport.sol/Seaport.dbg.json)\" | cat > Seaport.yul",
"lint:check": "yarn lint:check:format && yarn lint:check:solhint && yarn lint:check:eslint",
"lint:check:format": "prettier --check **.{sol,js,ts}",
"lint:check:solhint": "yarn build && solhint --config ./config/.solhint.json --ignore-path ./config/.solhintignore contracts/**/*.sol",
"lint:check:eslint": "eslint . --ext js,ts",
"lint:fix": "yarn lint:fix:format && yarn lint:fix:eslint",
"lint:fix:format": "prettier --write **.{sol,js,ts}",
"lint:fix:eslint": "eslint --fix . --ext js,ts",
"show:headroom": "jq -r '.deployedBytecode' artifacts/contracts/Seaport.sol/Seaport.json | tr -d '\n' | wc -m | awk '{print 24577 - ($1 - 2)/2}'",
"test:forge": "FOUNDRY_PROFILE=reference forge build; FOUNDRY_PROFILE=optimized forge build; FOUNDRY_PROFILE=test forge test -vvv",
"test:forge:lite": "FOUNDRY_PROFILE=reference forge build; FOUNDRY_PROFILE=lite forge test -vvv",
"build:validator": "hardhat compile --config ./hardhat-validator.config.ts",
"test:validator": "hardhat test --config ./hardhat-validator.config.ts",
"test:fuzz": "FOUNDRY_PROFILE=optimized forge build; FOUNDRY_PROFILE=test forge test --mp test/foundry/new/FuzzMain.t.sol",
"test:fuzz:concrete": "forge test --mt test_concrete",
"test:fuzz:metrics": "yarn ts-node scripts/plot_metrics.ts",
"test:opt": "FOUNDRY_PROFILE=optimized forge build; FOUNDRY_PROFILE=test forge test -vvv",
"prepare": "husky install"
},
"lint-staged": {
"*.sol": "prettier --write",
"*.js": "prettier --write",
"*.ts": "prettier --write"
}
}
Loading

0 comments on commit 3f553e9

Please sign in to comment.