Skip to content

Commit

Permalink
chore: remove web3 dependency, fix deployments
Browse files Browse the repository at this point in the history
  • Loading branch information
adjisb committed Sep 22, 2023
1 parent 5423471 commit e66bddc
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 438 deletions.
1 change: 1 addition & 0 deletions packages/deploy/deploy/marketplace/02_deploy_exchange.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const orderValidator = await deployments.get('OrderValidator');
const royaltiesRegistry = await deployments.get('RoyaltiesRegistry');

// TODO: Do we need oll the combinations of flags ? Can we have two deployments scripts with different tags each ?
// TODO: to be fetched from env?
const deployMeta = process.env.DEPLOY_META;
const nativeOrder = process.env.NATIVE_ORDER;
Expand Down
8 changes: 7 additions & 1 deletion packages/deploy/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@ import './tasks/importedPackages';
// Package name : solidity source code path
const importedPackages = {
'@sandbox-smart-contracts/giveaway': 'contracts/SignedMultiGiveaway.sol',
'@sandbox-smart-contracts/marketplace': 'contracts/',
'@sandbox-smart-contracts/marketplace': [
'contracts/royalties-registry/RoyaltiesRegistry.sol',
'contracts/exchange/OrderValidator.sol',
'contracts/exchange/ExchangeMeta.sol',
'contracts/exchange/Exchange.sol',
'contracts/exchange/AssetMatcher.sol',
],
};

const namedAccounts = {
Expand Down
14 changes: 6 additions & 8 deletions packages/marketplace/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,12 @@
]
},
"devDependencies": {
"@ethersproject/abi": "^5.7.0",
"@ethersproject/providers": "^5.7.2",
"@nomicfoundation/hardhat-chai-matchers": "^2.0.1",
"@nomicfoundation/hardhat-ethers": "^3.0.3",
"@nomicfoundation/hardhat-network-helpers": "^1.0.8",
"@nomicfoundation/hardhat-toolbox": "^3.0.0",
"@nomicfoundation/hardhat-verify": "^1.0.0",
"@nomiclabs/hardhat-etherscan": "^3.1.7",
"@openzeppelin/contracts": "^4.9.2",
"@openzeppelin/contracts-upgradeable": "^4.9.2",
"@sandbox-smart-contracts/dependency-metatx": "0.0.3",
"@typechain/ethers-v6": "^0.4.0",
"@typechain/hardhat": "^8.0.0",
"@types/chai": "^4.3.6",
Expand All @@ -36,15 +31,15 @@
"ethers": "^6.6.2",
"hardhat": "^2.14.1",
"hardhat-gas-reporter": "^1.0.9",
"mocha": "^10.2.0",
"prettier": "^2.8.8",
"prettier-plugin-solidity": "^1.1.3",
"solhint": "^3.4.1",
"solhint-plugin-prettier": "^0.0.5",
"solidity-coverage": "^0.8.3",
"ts-node": "^10.9.1",
"typechain": "^8.2.0",
"typescript": "5.0.4",
"web3": "^4.1.2"
"typescript": "5.0.4"
},
"scripts": {
"lint": "eslint --max-warnings 0 \"**/*.{js,ts}\" && solhint --max-warnings 0 \"contracts/**/*.sol\"",
Expand All @@ -59,6 +54,9 @@
"author": "",
"license": "ISC",
"dependencies": {
"@openzeppelin/hardhat-upgrades": "^2.2.1"
"@openzeppelin/contracts": "^4.9.2",
"@openzeppelin/contracts-upgradeable": "^4.9.2",
"@openzeppelin/hardhat-upgrades": "^2.2.1",
"@sandbox-smart-contracts/dependency-metatx": "0.0.3"
}
}
11 changes: 5 additions & 6 deletions packages/marketplace/test/utils/assets.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,25 @@
// TODO: This is the same as the root folder scripts... fix it
import ethUtil from 'ethereumjs-util';
import Web3 from 'web3';
import {ethers} from 'hardhat';
import {AbiCoder} from 'ethers';

export const ETH_ASSET_CLASS = '0xaaaebeba';
export const ERC20_ASSET_CLASS = '0x8ae85d84';
export const ERC721_ASSET_CLASS = '0x73ad2146';

export async function id(str: string) {
return `0x${ethUtil
return `0x${ethers
.keccak256(Buffer.from(str))
.toString('hex')
.substring(0, 8)}`;
}

export async function enc(token: string, tokenId: number) {
const web3 = new Web3('http://localhost:8545'); // Mock Provider URL to eliminate warnings
if (tokenId) {
return web3.eth.abi.encodeParameters(
return AbiCoder.defaultAbiCoder().encode(
['address', 'uint256'],
[token, tokenId]
);
} else {
return web3.eth.abi.encodeParameter('address', token);
return AbiCoder.defaultAbiCoder().encode(['address'], [token]);
}
}
Loading

1 comment on commit e66bddc

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage for this commit

7.39%

Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
packages/marketplace/contracts/exchange
   AssetMatcher.sol56.16%46.67%100%58.97%49–50, 50, 50–51, 53, 55–56, 56, 56–57, 59, 61–62, 62, 62–63, 65, 67–68, 68, 68–69, 71, 73–74, 74, 74–75, 77, 80–81
   Exchange.sol83.33%83.33%75%87.50%33, 56
   ExchangeCore.sol13.73%11.63%22.73%13.60%129–132, 144, 146, 159, 159, 159, 161, 173, 184–186, 192, 194, 206, 218–219, 234–235, 249–251, 251, 251–252, 252, 252, 252, 252, 254, 254, 254–255, 255, 255, 255, 255, 263, 265, 271, 294–295, 297, 297, 297, 297, 297–298, 298, 298–299, 299, 299, 301, 301, 301–302, 302, 302–303, 303, 303–304, 304, 304–305, 307, 307–308, 308, 308–309, 309, 309–310, 332–333, 335–336, 336, 336–337, 339, 339, 339–340, 343–344, 346, 372–373, 396, 396, 396, 402, 405–407, 407, 407–409, 409, 409–410, 410–412, 412, 412, 414, 416, 416, 416, 418, 429, 432–433, 437–438, 441, 458–460, 469, 469, 469, 471, 471, 471–472, 472, 472–473, 475, 479, 479, 479–480, 480, 480–481, 483, 487, 489, 496, 496, 496–497, 499, 511–512, 512, 512–514, 514, 514, 523–524, 530–531, 531, 531–532, 534–535, 537, 544, 544, 544–545, 547, 547, 547–548, 550, 73, 73–75, 77
   ExchangeMeta.sol0%0%0%0%33, 33–36, 42, 52, 56, 61, 61–62, 62, 62, 64
   OrderValidator.sol5.71%2.94%14.29%6.90%108, 108, 108–109, 114, 114, 114–116, 116, 116, 116–117, 119, 37, 44, 44–45, 45, 45–46, 46, 46–47, 49, 55, 63–64, 66, 74, 74, 74–76, 79, 79, 79–80, 80, 80–81, 81, 81, 84, 84, 84–85, 87, 87, 87–88, 88, 88, 95, 95, 95–96, 98, 98, 98
   WhiteList.sol21.43%6.25%12.50%38.89%100, 100–101, 106, 106–107, 50, 65, 65–69, 71, 76, 76–77, 82, 82–83, 88, 88–89, 94, 94–95
packages/marketplace/contracts/exchange/libraries
   LibDirectTransfer.sol100%100%100%100%
   LibFill.sol0%0%0%0%37, 42, 48, 48, 48–49, 51, 60–61, 61, 61–62, 71–72, 72, 72–73
   LibOrderDataGeneric.sol0%0%0%0%18, 18, 18–24, 24–28, 30, 30–31, 33, 33, 33–34, 39–42, 46, 48, 48, 48–49, 51–52, 55, 55, 55–56, 58, 61, 61, 61–62, 64, 67, 71, 73, 73, 73–75, 78, 87, 87, 87–89
packages/marketplace/contracts/exchange/mocks
   ERC1155LazyMintTest.sol100%100%100%100%
   ERC721LazyMintTest.sol100%100%100%100%
   ExchangeSimple.sol0%0%0%0%15, 15–17, 27, 31
   ExchangeSimple1.sol0%100%0%0%9
   ExchangeTestImports.sol100%100%100%100%
   LibFillTest.sol0%100%0%0%17
   LibOrderTest.sol0%100%0%0%13, 17, 21, 25, 35, 47
   MockTrustedForwarder.sol0%0%0%0%14, 17–18, 18, 18–19
   OrderValidatorTest.sol0%0%0%0%13, 8, 8–9
   RaribleTestHelper.sol0%100%0%0%11, 15, 19, 23, 33
   SimpleTransferManager.sol0%100%0%0%13–16
   TestAssetMatcher.sol0%0%0%0%12, 12, 12–15, 15, 15–16, 19
   TestERC1155WithRoyaltyV2981.sol100%100%100%100%
   TestERC1271.sol0%0%0%0%24, 28, 28,

Please sign in to comment.