Skip to content

Commit

Permalink
tests: TODO Asset Matcher
Browse files Browse the repository at this point in the history
  • Loading branch information
capedcrusader21 committed Sep 18, 2023
1 parent 91dd5c0 commit 082508e
Show file tree
Hide file tree
Showing 19 changed files with 2,618 additions and 2,196 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {

const assetMatcher = await deploy('AssetMatcher', {
from: deployer,
contract: `@sandbox-smart-contracts/marketplace/src/exchange/AssetMatcher.sol:AssetMatcher`,
contract:
'@sandbox-smart-contracts/marketplace/src/exchange/AssetMatcher.sol:AssetMatcher',
log: true,
skipIfAlreadyDeployed: true,
});
Expand Down
55 changes: 52 additions & 3 deletions packages/marketplace/hardhat.config.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,57 @@
import {HardhatUserConfig} from 'hardhat/config';
import '@nomiclabs/hardhat-ethers';
import '@nomiclabs/hardhat-etherscan';
import '@nomicfoundation/hardhat-network-helpers';
import '@nomicfoundation/hardhat-chai-matchers';
import 'hardhat-deploy';
import 'hardhat-contract-sizer';
import 'solidity-coverage';
import 'dotenv/config';

import "@nomiclabs/hardhat-truffle5";
/**
* TAGS:
* - mainnet -> production networks (you must pay for gas!!!)
* - L1 -> Layer 1 networks
* - L2 -> Layer 2 networks
*/
const networks = {
hardhat: {
tags: ['L1', 'L2'],
deploy: ['deploy_mocks/', 'deploy/'],
companionNetworks: {
l1: 'hardhat',
l2: 'hardhat',
},
blockGasLimit:
parseInt(process.env.HARDHAT_BLOCK_GAS_LIMIT || '0') || 30000000,
},
goerli: {
tags: ['L1'],
// gasPrice: 600000000000, // Uncomment in case of pending txs, and adjust gas
companionNetworks: {
l2: 'mumbai',
},
},
mainnet: {
tags: ['mainnet', 'L1'],
companionNetworks: {
l2: 'polygon',
},
},
mumbai: {
tags: ['L2'],
companionNetworks: {
l1: 'goerli',
},
},
polygon: {
tags: ['mainnet', 'L2'],
companionNetworks: {
l1: 'mainnet',
},
},
};

const config: HardhatUserConfig = {
const config = {
// solidity compiler version may be updated for new packages as required
// to ensure packages use up-to-date dependencies
solidity: {
Expand Down
42 changes: 35 additions & 7 deletions packages/marketplace/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,46 @@
"version": "1.0.0",
"description": "",
"dependencies": {
"@sandbox-smart-contracts/dependency-metatx": "^0.0.2"
"@sandbox-smart-contracts/dependency-metatx": "^0.0.2",
"web3-core-helpers": "^1.10.0",
"web3-core-promievent": "^1.10.0",
"web3-eth-abi": "^4.1.1"
},
"devDependencies": {
"@daonomic/tests-common": "^0.2.2",
"@nomiclabs/hardhat-truffle5": "^2.0.7",
"@nomiclabs/hardhat-web3": "^2.0.0",
"@openzeppelin/contracts": "4.9.3",
"@openzeppelin/contracts-upgradeable": "4.9.3",
"@ethereumjs/block": "^3.5.1",
"@ethereumjs/common": "^2.5.0",
"@ethereumjs/tx": "^3.3.2",
"@ethersproject/units": "^5.7.0",
"@ethersproject/wallet": "^5.0.5",
"@nomicfoundation/hardhat-chai-matchers": "^1.0.6",
"@nomicfoundation/hardhat-network-helpers": "^1.0.9",
"@nomiclabs/hardhat-ethers": "npm:[email protected]",
"@nomiclabs/hardhat-etherscan": "^3.0.3",
"@openzeppelin/contracts": "^4.9.3",
"@openzeppelin/contracts-upgradeable": "^4.9.3",
"@types/chai": "^4.2.11",
"hardhat": "^2.17.2",
"@types/mocha": "^8.0.2",
"@types/node": "^14.10.2",
"@typescript-eslint/eslint-plugin": "^4.6.0",
"@typescript-eslint/parser": "^4.6.0",
"chai": "^4.2.0",
"cross-env": "^7.0.2",
"dotenv": "^8.2.0",
"dotenv-cli": "^4.0.0",
"eslint": "^7.7.0",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-mocha": "^8.0.0",
"ethereumjs-util": "^7.1.3",
"ethers": "^5.7.2",
"hardhat": "~2.15.0",
"hardhat-contract-sizer": "^2.0.3",
"hardhat-deploy": "^0.10.5",
"hardhat-gas-reporter": "^1.0.4",
"prettier": "2.0.5",
"prettier-plugin-solidity": "1.0.0-beta.11",
"readline": "^1.3.0",
"solhint-plugin-prettier": "^0.0.5",
"solidity-coverage": "0.8.2",
"ts-node": "^10.9.1",
"typescript": "^4.0.5",
"web3": "^1.10.2"
Expand Down
36 changes: 36 additions & 0 deletions packages/marketplace/src/test/FakeProxy.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
//SPDX-License-Identifier: MIT
// solhint-disable-next-line compiler-version
pragma solidity 0.8.19;

import {ERC1967UpgradeUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/ERC1967/ERC1967UpgradeUpgradeable.sol";

/// @dev just for testing don't use this code on production !!!!
contract FakeProxy is ERC1967UpgradeUpgradeable {
constructor(address newImplementation) {
_upgradeTo(newImplementation);
}

function _delegate(address implementation) internal virtual {
// solhint-disable-next-line no-inline-assembly
assembly {
calldatacopy(0, 0, calldatasize())
let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)
returndatacopy(0, 0, returndatasize())
switch result
case 0 {
revert(0, returndatasize())
}
default {
return(0, returndatasize())
}
}
}

fallback() external payable {
_delegate(_getImplementation());
}

receive() external payable {
_delegate(_getImplementation());
}
}
216 changes: 0 additions & 216 deletions packages/marketplace/test/AssetMatcher.test.js

This file was deleted.

Loading

0 comments on commit 082508e

Please sign in to comment.