diff --git a/docker-compose.test.yml b/docker-compose.test.yml new file mode 100644 index 00000000..afbe30f0 --- /dev/null +++ b/docker-compose.test.yml @@ -0,0 +1,14 @@ +version: '3.2' + +services: + contract: + depends_on: + - dapptools + build: + context: ./test/contract + args: + ETH_ADDR: "http://192.168.192.4:8545" + environment: + ETH_ADDR: "http://192.168.192.4:8545" + ports: + - "127.0.0.1:3000:3000" diff --git a/test/README.md b/test/README.md new file mode 100644 index 00000000..95e3b5f8 --- /dev/null +++ b/test/README.md @@ -0,0 +1,6 @@ + +Spin up services: +``` +docker-compose -f docker-compose.test.yml -f ../docker-compose.yml up contract + +``` \ No newline at end of file diff --git a/test/contract/.dockerignore b/test/contract/.dockerignore new file mode 100644 index 00000000..e4036624 --- /dev/null +++ b/test/contract/.dockerignore @@ -0,0 +1,3 @@ +node_modules +artifacts +cache \ No newline at end of file diff --git a/test/contract/Dockerfile b/test/contract/Dockerfile new file mode 100644 index 00000000..a56d3be0 --- /dev/null +++ b/test/contract/Dockerfile @@ -0,0 +1,14 @@ +FROM node:14 + +ARG ETH_ADDR +ENV ETH_ADDR $ETH_ADDR + +WORKDIR /usr/src/app +COPY package*.json ./ +RUN npm ci +COPY . . +RUN npm run compile && ls -lah + +EXPOSE 3000 + +ENTRYPOINT ["npm", "start"] \ No newline at end of file diff --git a/test/contract/contracts/GLDToken.sol b/test/contract/contracts/GLDToken.sol new file mode 100644 index 00000000..4cd3205f --- /dev/null +++ b/test/contract/contracts/GLDToken.sol @@ -0,0 +1,7 @@ +pragma solidity ^0.8.0; +import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; +contract GLDToken is ERC20 { + constructor() ERC20("Gold", "GLD") { + _mint(msg.sender, 1000000000000000000000); + } +} diff --git a/test/contract/contracts/Greeter.sol b/test/contract/contracts/Greeter.sol deleted file mode 100644 index 9440bbbb..00000000 --- a/test/contract/contracts/Greeter.sol +++ /dev/null @@ -1,21 +0,0 @@ -//SPDX-License-Identifier: Unlicense -pragma solidity ^0.7.0; - -contract Greeter { - string greeting; - - event Greet(string value); - - constructor(string memory _greeting) { - greeting = _greeting; - } - - function greet() public view returns (string memory) { - return greeting; - } - - function setGreeting(string memory _greeting) public { - greeting = _greeting; - emit Greet(greeting); - } -} diff --git a/test/contract/hardhat.config.js b/test/contract/hardhat.config.js index fb1a3a3e..b474482c 100644 --- a/test/contract/hardhat.config.js +++ b/test/contract/hardhat.config.js @@ -17,11 +17,15 @@ task("accounts", "Prints the list of accounts", async () => { * @type import('hardhat/config').HardhatUserConfig */ module.exports = { - solidity: "0.7.3", + solidity: "0.8.0", networks: { local: { url: 'http://127.0.0.1:8545', chainId: 4 + }, + docker: { + url: process.env.ETH_ADDR, + chainId: 4 } } }; diff --git a/test/contract/package-lock.json b/test/contract/package-lock.json index d6bbb65d..82ad9e42 100644 --- a/test/contract/package-lock.json +++ b/test/contract/package-lock.json @@ -8,6 +8,8 @@ "version": "1.0.0", "license": "ISC", "dependencies": { + "@openzeppelin/contracts": "^4.0.0", + "fastify": "^3.14.2", "hardhat": "^2.2.0" }, "devDependencies": { @@ -1196,6 +1198,23 @@ "@ethersproject/strings": "^5.1.0" } }, + "node_modules/@fastify/forwarded": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@fastify/forwarded/-/forwarded-1.0.0.tgz", + "integrity": "sha512-VoO+6WD0aRz8bwgJZ8pkkxjq7o/782cQ1j945HWg0obZMgIadYW3Pew0+an+k1QL7IPZHM3db5WF6OP6x4ymMA==", + "engines": { + "node": ">= 10" + } + }, + "node_modules/@fastify/proxy-addr": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@fastify/proxy-addr/-/proxy-addr-3.0.0.tgz", + "integrity": "sha512-ty7wnUd/GeSqKTC2Jozsl5xGbnxUnEFC0On2/zPv/8ixywipQmVZwuWvNGnBoitJ2wixwVqofwXNua8j6Y62lQ==", + "dependencies": { + "@fastify/forwarded": "^1.0.0", + "ipaddr.js": "^2.0.0" + } + }, "node_modules/@nomiclabs/hardhat-ethers": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/@nomiclabs/hardhat-ethers/-/hardhat-ethers-2.0.2.tgz", @@ -1222,6 +1241,11 @@ "hardhat": "^2.0.0" } }, + "node_modules/@openzeppelin/contracts": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@openzeppelin/contracts/-/contracts-4.0.0.tgz", + "integrity": "sha512-UcIJl/vUVjTr3H1yYXZi7Sr2PlXzBEHVUJKOUlVyzyy0FI8oQCCy0Wx+BuK/fojdnmLeMvUk4KUvhKUybP+C7Q==" + }, "node_modules/@resolver-engine/core": { "version": "0.3.3", "resolved": "https://registry.npmjs.org/@resolver-engine/core/-/core-0.3.3.tgz", @@ -1589,6 +1613,11 @@ "node": ">=6" } }, + "node_modules/abstract-logging": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/abstract-logging/-/abstract-logging-2.0.1.tgz", + "integrity": "sha512-2BjRTZxTPvheOvGbBslFSYOUkr+SjPtOnrLP33f+VIWLzezQpZcqVg7ja3L4dBXmzzgwT+a029jRx5PCi3JuiA==" + }, "node_modules/adm-zip": { "version": "0.4.16", "resolved": "https://registry.npmjs.org/adm-zip/-/adm-zip-0.4.16.tgz", @@ -1618,7 +1647,6 @@ "version": "6.12.6", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", - "dev": true, "dependencies": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", @@ -1683,6 +1711,11 @@ "node": ">= 8" } }, + "node_modules/archy": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/archy/-/archy-1.0.0.tgz", + "integrity": "sha1-+cjBN1fMHde8N5rHeyxipcKGjEA=" + }, "node_modules/argparse": { "version": "1.0.10", "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", @@ -1752,6 +1785,25 @@ "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", "dev": true }, + "node_modules/atomic-sleep": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/atomic-sleep/-/atomic-sleep-1.0.0.tgz", + "integrity": "sha512-kNOjDqAh7px0XWNI+4QbzoiR/nTkHAWNud2uvnJquD1/x5a7EQZMJT0AczqK0Qn67oY/TTQ1LbUKajZpp3I9tQ==", + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/avvio": { + "version": "7.2.1", + "resolved": "https://registry.npmjs.org/avvio/-/avvio-7.2.1.tgz", + "integrity": "sha512-b+gox68dqD6c3S3t+bZBKN6rYbVWdwpN12sHQLFTiacDT2rcq7fm07Ww+IKt/AvAkyCIe1f5ArP1bC/vAlx97A==", + "dependencies": { + "archy": "^1.0.0", + "debug": "^4.0.0", + "fastq": "^1.6.1", + "queue-microtask": "^1.1.2" + } + }, "node_modules/aws-sign2": { "version": "0.7.0", "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", @@ -2322,6 +2374,14 @@ "node": ">=0.12" } }, + "node_modules/deepmerge": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.2.2.tgz", + "integrity": "sha512-FJ3UgI4gIl+PHZm53knsuSFpE+nESMr7M4v9QcgB7S63Kj/6WqMiFQJpBBYz1Pt+66bZpP3Q7Lye0Oo9MPKEdg==", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/deferred-leveldown": { "version": "5.3.0", "resolved": "https://registry.npmjs.org/deferred-leveldown/-/deferred-leveldown-5.3.0.tgz", @@ -2830,17 +2890,121 @@ "node >=0.6.0" ] }, + "node_modules/fast-decode-uri-component": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/fast-decode-uri-component/-/fast-decode-uri-component-1.0.1.tgz", + "integrity": "sha512-WKgKWg5eUxvRZGwW8FvfbaH7AXSh2cL+3j5fMGzUMCxWBJ3dV3a7Wz8y2f/uQ0e3B6WmodD3oS54jTQ9HVTIIg==" + }, "node_modules/fast-deep-equal": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", - "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", - "dev": true + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" }, "node_modules/fast-json-stable-stringify": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", - "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", - "dev": true + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==" + }, + "node_modules/fast-json-stringify": { + "version": "2.5.4", + "resolved": "https://registry.npmjs.org/fast-json-stringify/-/fast-json-stringify-2.5.4.tgz", + "integrity": "sha512-fu74X0fRzQqADX6LFJ+5lSal1+j/QmX4oWrDnrfVAXV4qT6PwyymZmhGa/1SWgouOmf0tBJzZrHZPLymO00Lxg==", + "dependencies": { + "ajv": "^6.11.0", + "deepmerge": "^4.2.2", + "rfdc": "^1.2.0", + "string-similarity": "^4.0.1" + }, + "engines": { + "node": ">= 10.0.0" + } + }, + "node_modules/fast-redact": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/fast-redact/-/fast-redact-3.0.0.tgz", + "integrity": "sha512-a/S/Hp6aoIjx7EmugtzLqXmcNsyFszqbt6qQ99BdG61QjBZF6shNis0BYR6TsZOQ1twYc0FN2Xdhwwbv6+KD0w==", + "engines": { + "node": ">=6" + } + }, + "node_modules/fast-safe-stringify": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/fast-safe-stringify/-/fast-safe-stringify-2.0.7.tgz", + "integrity": "sha512-Utm6CdzT+6xsDk2m8S6uL8VHxNwI6Jub+e9NYTcAms28T84pTa25GJQV9j0CY0N1rM8hK4x6grpF2BQf+2qwVA==" + }, + "node_modules/fastify": { + "version": "3.14.2", + "resolved": "https://registry.npmjs.org/fastify/-/fastify-3.14.2.tgz", + "integrity": "sha512-/PY//7gJnGxLQORaRHCEW148vpFKFpBIQNz1Yo/DxbHuk5EQqK2comzyE2ug8FSEldDX8nleapTshl0m78Px2w==", + "dependencies": { + "@fastify/proxy-addr": "^3.0.0", + "abstract-logging": "^2.0.0", + "ajv": "^6.12.2", + "avvio": "^7.1.2", + "fast-json-stringify": "^2.5.2", + "fastify-error": "^0.3.0", + "fastify-warning": "^0.2.0", + "find-my-way": "^4.0.0", + "flatstr": "^1.0.12", + "light-my-request": "^4.2.0", + "pino": "^6.2.1", + "readable-stream": "^3.4.0", + "rfdc": "^1.1.4", + "secure-json-parse": "^2.0.0", + "semver": "^7.3.2", + "tiny-lru": "^7.0.0" + }, + "engines": { + "node": ">=10.16.0" + } + }, + "node_modules/fastify-error": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/fastify-error/-/fastify-error-0.3.0.tgz", + "integrity": "sha512-Jm2LMTB5rsJqlS1+cmgqqM9tTs0UrlgYR7TvDT3ZgXsUI5ib1NjQlqZHf+tDK5tVPdFGwyq02wAoJtyYIRSiFA==" + }, + "node_modules/fastify-warning": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/fastify-warning/-/fastify-warning-0.2.0.tgz", + "integrity": "sha512-s1EQguBw/9qtc1p/WTY4eq9WMRIACkj+HTcOIK1in4MV5aFaQC9ZCIt0dJ7pr5bIf4lPpHvAtP2ywpTNgs7hqw==" + }, + "node_modules/fastify/node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/fastify/node_modules/semver": { + "version": "7.3.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", + "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/fastify/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" + }, + "node_modules/fastq": { + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.11.0.tgz", + "integrity": "sha512-7Eczs8gIPDrVzT+EksYBcupqMyxSHXXrHOLRRxU2/DicV8789MRBRR8+Hc2uWzUupOs4YS4JzBmBxjjCVBxD/g==", + "dependencies": { + "reusify": "^1.0.4" + } }, "node_modules/fill-range": { "version": "7.0.1", @@ -2853,6 +3017,20 @@ "node": ">=8" } }, + "node_modules/find-my-way": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-my-way/-/find-my-way-4.1.0.tgz", + "integrity": "sha512-UBD94MdO6cBi6E97XA0fBA9nwqw+xG5x1TYIPHats33gEi/kNqy7BWHAWx8QHCQQRSU5Txc0JiD8nzba39gvMQ==", + "dependencies": { + "fast-decode-uri-component": "^1.0.1", + "fast-deep-equal": "^3.1.3", + "safe-regex2": "^2.0.0", + "semver-store": "^0.3.0" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/find-replace": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/find-replace/-/find-replace-1.0.3.tgz", @@ -2909,6 +3087,11 @@ "flat": "cli.js" } }, + "node_modules/flatstr": { + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/flatstr/-/flatstr-1.0.12.tgz", + "integrity": "sha512-4zPxDyhCyiN2wIAtSLI6gc82/EjqZc1onI4Mz/l0pWrAlsSfYH/2ZIcU+e3oA2wDwbzIWNKwa23F8rh6+DRWkw==" + }, "node_modules/follow-redirects": { "version": "1.13.3", "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.13.3.tgz", @@ -12566,6 +12749,14 @@ "fp-ts": "^1.0.0" } }, + "node_modules/ipaddr.js": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-2.0.0.tgz", + "integrity": "sha512-S54H9mIj0rbxRIyrDMEuuER86LdlgUg9FSeZ8duQb6CUG2iRrA36MYVQBSprTF/ZeAwvyQ5mDGuNvIPM0BIl3w==", + "engines": { + "node": ">= 10" + } + }, "node_modules/is-arrayish": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", @@ -12861,8 +13052,7 @@ "node_modules/json-schema-traverse": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", - "dev": true + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==" }, "node_modules/json-stringify-safe": { "version": "5.0.1", @@ -13041,6 +13231,18 @@ "node": ">=6" } }, + "node_modules/light-my-request": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/light-my-request/-/light-my-request-4.4.1.tgz", + "integrity": "sha512-FDNRF2mYjthIRWE7O8d/X7AzDx4otQHl4/QXbu3Q/FRwBFcgb+ZoDaUd5HwN53uQXLAiw76osN+Va0NEaOW6rQ==", + "dependencies": { + "ajv": "^6.12.2", + "cookie": "^0.4.0", + "fastify-warning": "^0.2.0", + "readable-stream": "^3.6.0", + "set-cookie-parser": "^2.4.1" + } + }, "node_modules/load-json-file": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", @@ -13922,6 +14124,27 @@ "node": ">=0.10.0" } }, + "node_modules/pino": { + "version": "6.11.3", + "resolved": "https://registry.npmjs.org/pino/-/pino-6.11.3.tgz", + "integrity": "sha512-drPtqkkSf0ufx2gaea3TryFiBHdNIdXKf5LN0hTM82SXI4xVIve2wLwNg92e1MT6m3jASLu6VO7eGY6+mmGeyw==", + "dependencies": { + "fast-redact": "^3.0.0", + "fast-safe-stringify": "^2.0.7", + "flatstr": "^1.0.12", + "pino-std-serializers": "^3.1.0", + "quick-format-unescaped": "^4.0.3", + "sonic-boom": "^1.0.2" + }, + "bin": { + "pino": "bin.js" + } + }, + "node_modules/pino-std-serializers": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/pino-std-serializers/-/pino-std-serializers-3.2.0.tgz", + "integrity": "sha512-EqX4pwDPrt3MuOAAUBMU0Tk5kR/YcCM5fNPEzgCO2zJ5HfX0vbiH9HbJglnyeQsN96Kznae6MWD47pZB5avTrg==" + }, "node_modules/postinstall-postinstall": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/postinstall-postinstall/-/postinstall-postinstall-2.1.0.tgz", @@ -13976,7 +14199,6 @@ "version": "2.1.0", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.0.tgz", "integrity": "sha1-X4Y+3Im5bbCQdLrXlHvwkFbKTn0=", - "dev": true, "engines": { "node": ">=6" } @@ -14018,6 +14240,30 @@ "node": ">=0.4.x" } }, + "node_modules/queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/quick-format-unescaped": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/quick-format-unescaped/-/quick-format-unescaped-4.0.3.tgz", + "integrity": "sha512-MaL/oqh02mhEo5m5J2rwsVL23Iw2PEaGVHgT2vFt8AAsr0lfvQA5dpXo9TPu0rz7tSBdUPgkbam0j/fj5ZM8yg==" + }, "node_modules/randombytes": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", @@ -14203,6 +14449,28 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/ret": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/ret/-/ret-0.2.2.tgz", + "integrity": "sha512-M0b3YWQs7R3Z917WRQy1HHA7Ba7D8hvZg6UE5mLykJxQVE2ju0IXbGlaHPPlkY+WN7wFP+wUMXmBFA0aV6vYGQ==", + "engines": { + "node": ">=4" + } + }, + "node_modules/reusify": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", + "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", + "engines": { + "iojs": ">=1.0.0", + "node": ">=0.10.0" + } + }, + "node_modules/rfdc": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/rfdc/-/rfdc-1.3.0.tgz", + "integrity": "sha512-V2hovdzFbOi77/WajaSMXk2OLm+xNIeQdMMuB7icj7bk6zi2F8GGAxigcnDFpJHbNyNcgyJDiP+8nOrY5cZGrA==" + }, "node_modules/rimraf": { "version": "2.7.1", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", @@ -14258,6 +14526,14 @@ } ] }, + "node_modules/safe-regex2": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/safe-regex2/-/safe-regex2-2.0.0.tgz", + "integrity": "sha512-PaUSFsUaNNuKwkBijoAPHAK6/eM6VirvyPWlZ7BAQy4D+hCvh4B6lIG+nPdhbFfIbP+gTGBcrdsOaUs0F+ZBOQ==", + "dependencies": { + "ret": "~0.2.0" + } + }, "node_modules/safer-buffer": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", @@ -14282,6 +14558,11 @@ "node": ">=10.0.0" } }, + "node_modules/secure-json-parse": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/secure-json-parse/-/secure-json-parse-2.4.0.tgz", + "integrity": "sha512-Q5Z/97nbON5t/L/sH6mY2EacfjVGwrCcSi5D3btRO2GZ8pf1K1UN7Z9H5J57hjVU2Qzxr1xO+FmBhOvEkzCMmg==" + }, "node_modules/semaphore-async-await": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/semaphore-async-await/-/semaphore-async-await-1.5.1.tgz", @@ -14298,11 +14579,21 @@ "semver": "bin/semver.js" } }, + "node_modules/semver-store": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/semver-store/-/semver-store-0.3.0.tgz", + "integrity": "sha512-TcZvGMMy9vodEFSse30lWinkj+JgOBvPn8wRItpQRSayhc+4ssDs335uklkfvQQJgL/WvmHLVj4Ycv2s7QCQMg==" + }, "node_modules/set-blocking": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=" }, + "node_modules/set-cookie-parser": { + "version": "2.4.8", + "resolved": "https://registry.npmjs.org/set-cookie-parser/-/set-cookie-parser-2.4.8.tgz", + "integrity": "sha512-edRH8mBKEWNVIVMKejNnuJxleqYE/ZSdcT8/Nem9/mmosx12pctd80s2Oy00KNZzrogMZS5mauK2/ymL1bvlvg==" + }, "node_modules/setimmediate": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz", @@ -14448,6 +14739,15 @@ "semver": "bin/semver" } }, + "node_modules/sonic-boom": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/sonic-boom/-/sonic-boom-1.4.1.tgz", + "integrity": "sha512-LRHh/A8tpW7ru89lrlkU4AszXt1dbwSjVWguGrmlxE7tawVmDBlI1PILMkXAxJTwqhgsEeTHzj36D5CmHgQmNg==", + "dependencies": { + "atomic-sleep": "^1.0.0", + "flatstr": "^1.0.12" + } + }, "node_modules/source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", @@ -14577,6 +14877,11 @@ "safe-buffer": "~5.2.0" } }, + "node_modules/string-similarity": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/string-similarity/-/string-similarity-4.0.4.tgz", + "integrity": "sha512-/q/8Q4Bl4ZKAPjj8WerIBJWALKkaPRfrvhfF8k/B23i4nzrlRj2/go1m90In7nG/3XDSbOo0+pu6RvCTM9RGMQ==" + }, "node_modules/string-width": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", @@ -14708,6 +15013,14 @@ "node": ">=0.10.0" } }, + "node_modules/tiny-lru": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/tiny-lru/-/tiny-lru-7.0.6.tgz", + "integrity": "sha512-zNYO0Kvgn5rXzWpL0y3RS09sMK67eGaQj9805jlK9G6pSadfriTczzLHFXa/xcW4mIRfmlB9HyQ/+SgL0V1uow==", + "engines": { + "node": ">=6" + } + }, "node_modules/tmp": { "version": "0.0.33", "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", @@ -14930,7 +15243,6 @@ "version": "4.4.1", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", - "dev": true, "dependencies": { "punycode": "^2.1.0" } @@ -16165,6 +16477,20 @@ "@ethersproject/strings": "^5.1.0" } }, + "@fastify/forwarded": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@fastify/forwarded/-/forwarded-1.0.0.tgz", + "integrity": "sha512-VoO+6WD0aRz8bwgJZ8pkkxjq7o/782cQ1j945HWg0obZMgIadYW3Pew0+an+k1QL7IPZHM3db5WF6OP6x4ymMA==" + }, + "@fastify/proxy-addr": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@fastify/proxy-addr/-/proxy-addr-3.0.0.tgz", + "integrity": "sha512-ty7wnUd/GeSqKTC2Jozsl5xGbnxUnEFC0On2/zPv/8ixywipQmVZwuWvNGnBoitJ2wixwVqofwXNua8j6Y62lQ==", + "requires": { + "@fastify/forwarded": "^1.0.0", + "ipaddr.js": "^2.0.0" + } + }, "@nomiclabs/hardhat-ethers": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/@nomiclabs/hardhat-ethers/-/hardhat-ethers-2.0.2.tgz", @@ -16182,6 +16508,11 @@ "@types/web3": "1.0.19" } }, + "@openzeppelin/contracts": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@openzeppelin/contracts/-/contracts-4.0.0.tgz", + "integrity": "sha512-UcIJl/vUVjTr3H1yYXZi7Sr2PlXzBEHVUJKOUlVyzyy0FI8oQCCy0Wx+BuK/fojdnmLeMvUk4KUvhKUybP+C7Q==" + }, "@resolver-engine/core": { "version": "0.3.3", "resolved": "https://registry.npmjs.org/@resolver-engine/core/-/core-0.3.3.tgz", @@ -16524,6 +16855,11 @@ "xtend": "~4.0.0" } }, + "abstract-logging": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/abstract-logging/-/abstract-logging-2.0.1.tgz", + "integrity": "sha512-2BjRTZxTPvheOvGbBslFSYOUkr+SjPtOnrLP33f+VIWLzezQpZcqVg7ja3L4dBXmzzgwT+a029jRx5PCi3JuiA==" + }, "adm-zip": { "version": "0.4.16", "resolved": "https://registry.npmjs.org/adm-zip/-/adm-zip-0.4.16.tgz", @@ -16547,7 +16883,6 @@ "version": "6.12.6", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", - "dev": true, "requires": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", @@ -16590,6 +16925,11 @@ "picomatch": "^2.0.4" } }, + "archy": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/archy/-/archy-1.0.0.tgz", + "integrity": "sha1-+cjBN1fMHde8N5rHeyxipcKGjEA=" + }, "argparse": { "version": "1.0.10", "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", @@ -16650,6 +16990,22 @@ "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", "dev": true }, + "atomic-sleep": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/atomic-sleep/-/atomic-sleep-1.0.0.tgz", + "integrity": "sha512-kNOjDqAh7px0XWNI+4QbzoiR/nTkHAWNud2uvnJquD1/x5a7EQZMJT0AczqK0Qn67oY/TTQ1LbUKajZpp3I9tQ==" + }, + "avvio": { + "version": "7.2.1", + "resolved": "https://registry.npmjs.org/avvio/-/avvio-7.2.1.tgz", + "integrity": "sha512-b+gox68dqD6c3S3t+bZBKN6rYbVWdwpN12sHQLFTiacDT2rcq7fm07Ww+IKt/AvAkyCIe1f5ArP1bC/vAlx97A==", + "requires": { + "archy": "^1.0.0", + "debug": "^4.0.0", + "fastq": "^1.6.1", + "queue-microtask": "^1.1.2" + } + }, "aws-sign2": { "version": "0.7.0", "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", @@ -17107,6 +17463,11 @@ "type-detect": "^4.0.0" } }, + "deepmerge": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.2.2.tgz", + "integrity": "sha512-FJ3UgI4gIl+PHZm53knsuSFpE+nESMr7M4v9QcgB7S63Kj/6WqMiFQJpBBYz1Pt+66bZpP3Q7Lye0Oo9MPKEdg==" + }, "deferred-leveldown": { "version": "5.3.0", "resolved": "https://registry.npmjs.org/deferred-leveldown/-/deferred-leveldown-5.3.0.tgz", @@ -17535,17 +17896,105 @@ "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=", "dev": true }, + "fast-decode-uri-component": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/fast-decode-uri-component/-/fast-decode-uri-component-1.0.1.tgz", + "integrity": "sha512-WKgKWg5eUxvRZGwW8FvfbaH7AXSh2cL+3j5fMGzUMCxWBJ3dV3a7Wz8y2f/uQ0e3B6WmodD3oS54jTQ9HVTIIg==" + }, "fast-deep-equal": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", - "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", - "dev": true + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" }, "fast-json-stable-stringify": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", - "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", - "dev": true + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==" + }, + "fast-json-stringify": { + "version": "2.5.4", + "resolved": "https://registry.npmjs.org/fast-json-stringify/-/fast-json-stringify-2.5.4.tgz", + "integrity": "sha512-fu74X0fRzQqADX6LFJ+5lSal1+j/QmX4oWrDnrfVAXV4qT6PwyymZmhGa/1SWgouOmf0tBJzZrHZPLymO00Lxg==", + "requires": { + "ajv": "^6.11.0", + "deepmerge": "^4.2.2", + "rfdc": "^1.2.0", + "string-similarity": "^4.0.1" + } + }, + "fast-redact": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/fast-redact/-/fast-redact-3.0.0.tgz", + "integrity": "sha512-a/S/Hp6aoIjx7EmugtzLqXmcNsyFszqbt6qQ99BdG61QjBZF6shNis0BYR6TsZOQ1twYc0FN2Xdhwwbv6+KD0w==" + }, + "fast-safe-stringify": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/fast-safe-stringify/-/fast-safe-stringify-2.0.7.tgz", + "integrity": "sha512-Utm6CdzT+6xsDk2m8S6uL8VHxNwI6Jub+e9NYTcAms28T84pTa25GJQV9j0CY0N1rM8hK4x6grpF2BQf+2qwVA==" + }, + "fastify": { + "version": "3.14.2", + "resolved": "https://registry.npmjs.org/fastify/-/fastify-3.14.2.tgz", + "integrity": "sha512-/PY//7gJnGxLQORaRHCEW148vpFKFpBIQNz1Yo/DxbHuk5EQqK2comzyE2ug8FSEldDX8nleapTshl0m78Px2w==", + "requires": { + "@fastify/proxy-addr": "^3.0.0", + "abstract-logging": "^2.0.0", + "ajv": "^6.12.2", + "avvio": "^7.1.2", + "fast-json-stringify": "^2.5.2", + "fastify-error": "^0.3.0", + "fastify-warning": "^0.2.0", + "find-my-way": "^4.0.0", + "flatstr": "^1.0.12", + "light-my-request": "^4.2.0", + "pino": "^6.2.1", + "readable-stream": "^3.4.0", + "rfdc": "^1.1.4", + "secure-json-parse": "^2.0.0", + "semver": "^7.3.2", + "tiny-lru": "^7.0.0" + }, + "dependencies": { + "lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "requires": { + "yallist": "^4.0.0" + } + }, + "semver": { + "version": "7.3.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", + "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", + "requires": { + "lru-cache": "^6.0.0" + } + }, + "yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" + } + } + }, + "fastify-error": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/fastify-error/-/fastify-error-0.3.0.tgz", + "integrity": "sha512-Jm2LMTB5rsJqlS1+cmgqqM9tTs0UrlgYR7TvDT3ZgXsUI5ib1NjQlqZHf+tDK5tVPdFGwyq02wAoJtyYIRSiFA==" + }, + "fastify-warning": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/fastify-warning/-/fastify-warning-0.2.0.tgz", + "integrity": "sha512-s1EQguBw/9qtc1p/WTY4eq9WMRIACkj+HTcOIK1in4MV5aFaQC9ZCIt0dJ7pr5bIf4lPpHvAtP2ywpTNgs7hqw==" + }, + "fastq": { + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.11.0.tgz", + "integrity": "sha512-7Eczs8gIPDrVzT+EksYBcupqMyxSHXXrHOLRRxU2/DicV8789MRBRR8+Hc2uWzUupOs4YS4JzBmBxjjCVBxD/g==", + "requires": { + "reusify": "^1.0.4" + } }, "fill-range": { "version": "7.0.1", @@ -17555,6 +18004,17 @@ "to-regex-range": "^5.0.1" } }, + "find-my-way": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-my-way/-/find-my-way-4.1.0.tgz", + "integrity": "sha512-UBD94MdO6cBi6E97XA0fBA9nwqw+xG5x1TYIPHats33gEi/kNqy7BWHAWx8QHCQQRSU5Txc0JiD8nzba39gvMQ==", + "requires": { + "fast-decode-uri-component": "^1.0.1", + "fast-deep-equal": "^3.1.3", + "safe-regex2": "^2.0.0", + "semver-store": "^0.3.0" + } + }, "find-replace": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/find-replace/-/find-replace-1.0.3.tgz", @@ -17601,6 +18061,11 @@ "is-buffer": "~2.0.3" } }, + "flatstr": { + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/flatstr/-/flatstr-1.0.12.tgz", + "integrity": "sha512-4zPxDyhCyiN2wIAtSLI6gc82/EjqZc1onI4Mz/l0pWrAlsSfYH/2ZIcU+e3oA2wDwbzIWNKwa23F8rh6+DRWkw==" + }, "follow-redirects": { "version": "1.13.3", "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.13.3.tgz", @@ -25012,6 +25477,11 @@ "fp-ts": "^1.0.0" } }, + "ipaddr.js": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-2.0.0.tgz", + "integrity": "sha512-S54H9mIj0rbxRIyrDMEuuER86LdlgUg9FSeZ8duQb6CUG2iRrA36MYVQBSprTF/ZeAwvyQ5mDGuNvIPM0BIl3w==" + }, "is-arrayish": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", @@ -25202,8 +25672,7 @@ "json-schema-traverse": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", - "dev": true + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==" }, "json-stringify-safe": { "version": "5.0.1", @@ -25345,6 +25814,18 @@ "xtend": "~4.0.0" } }, + "light-my-request": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/light-my-request/-/light-my-request-4.4.1.tgz", + "integrity": "sha512-FDNRF2mYjthIRWE7O8d/X7AzDx4otQHl4/QXbu3Q/FRwBFcgb+ZoDaUd5HwN53uQXLAiw76osN+Va0NEaOW6rQ==", + "requires": { + "ajv": "^6.12.2", + "cookie": "^0.4.0", + "fastify-warning": "^0.2.0", + "readable-stream": "^3.6.0", + "set-cookie-parser": "^2.4.1" + } + }, "load-json-file": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", @@ -26027,6 +26508,24 @@ "pinkie": "^2.0.0" } }, + "pino": { + "version": "6.11.3", + "resolved": "https://registry.npmjs.org/pino/-/pino-6.11.3.tgz", + "integrity": "sha512-drPtqkkSf0ufx2gaea3TryFiBHdNIdXKf5LN0hTM82SXI4xVIve2wLwNg92e1MT6m3jASLu6VO7eGY6+mmGeyw==", + "requires": { + "fast-redact": "^3.0.0", + "fast-safe-stringify": "^2.0.7", + "flatstr": "^1.0.12", + "pino-std-serializers": "^3.1.0", + "quick-format-unescaped": "^4.0.3", + "sonic-boom": "^1.0.2" + } + }, + "pino-std-serializers": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/pino-std-serializers/-/pino-std-serializers-3.2.0.tgz", + "integrity": "sha512-EqX4pwDPrt3MuOAAUBMU0Tk5kR/YcCM5fNPEzgCO2zJ5HfX0vbiH9HbJglnyeQsN96Kznae6MWD47pZB5avTrg==" + }, "postinstall-postinstall": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/postinstall-postinstall/-/postinstall-postinstall-2.1.0.tgz", @@ -26064,8 +26563,7 @@ "punycode": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.0.tgz", - "integrity": "sha1-X4Y+3Im5bbCQdLrXlHvwkFbKTn0=", - "dev": true + "integrity": "sha1-X4Y+3Im5bbCQdLrXlHvwkFbKTn0=" }, "qs": { "version": "6.10.1", @@ -26092,6 +26590,16 @@ "integrity": "sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA=", "dev": true }, + "queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==" + }, + "quick-format-unescaped": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/quick-format-unescaped/-/quick-format-unescaped-4.0.3.tgz", + "integrity": "sha512-MaL/oqh02mhEo5m5J2rwsVL23Iw2PEaGVHgT2vFt8AAsr0lfvQA5dpXo9TPu0rz7tSBdUPgkbam0j/fj5ZM8yg==" + }, "randombytes": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", @@ -26241,6 +26749,21 @@ "path-parse": "^1.0.6" } }, + "ret": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/ret/-/ret-0.2.2.tgz", + "integrity": "sha512-M0b3YWQs7R3Z917WRQy1HHA7Ba7D8hvZg6UE5mLykJxQVE2ju0IXbGlaHPPlkY+WN7wFP+wUMXmBFA0aV6vYGQ==" + }, + "reusify": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", + "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==" + }, + "rfdc": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/rfdc/-/rfdc-1.3.0.tgz", + "integrity": "sha512-V2hovdzFbOi77/WajaSMXk2OLm+xNIeQdMMuB7icj7bk6zi2F8GGAxigcnDFpJHbNyNcgyJDiP+8nOrY5cZGrA==" + }, "rimraf": { "version": "2.7.1", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", @@ -26276,6 +26799,14 @@ "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==" }, + "safe-regex2": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/safe-regex2/-/safe-regex2-2.0.0.tgz", + "integrity": "sha512-PaUSFsUaNNuKwkBijoAPHAK6/eM6VirvyPWlZ7BAQy4D+hCvh4B6lIG+nPdhbFfIbP+gTGBcrdsOaUs0F+ZBOQ==", + "requires": { + "ret": "~0.2.0" + } + }, "safer-buffer": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", @@ -26296,6 +26827,11 @@ "node-gyp-build": "^4.2.0" } }, + "secure-json-parse": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/secure-json-parse/-/secure-json-parse-2.4.0.tgz", + "integrity": "sha512-Q5Z/97nbON5t/L/sH6mY2EacfjVGwrCcSi5D3btRO2GZ8pf1K1UN7Z9H5J57hjVU2Qzxr1xO+FmBhOvEkzCMmg==" + }, "semaphore-async-await": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/semaphore-async-await/-/semaphore-async-await-1.5.1.tgz", @@ -26306,11 +26842,21 @@ "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==" }, + "semver-store": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/semver-store/-/semver-store-0.3.0.tgz", + "integrity": "sha512-TcZvGMMy9vodEFSse30lWinkj+JgOBvPn8wRItpQRSayhc+4ssDs335uklkfvQQJgL/WvmHLVj4Ycv2s7QCQMg==" + }, "set-blocking": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=" }, + "set-cookie-parser": { + "version": "2.4.8", + "resolved": "https://registry.npmjs.org/set-cookie-parser/-/set-cookie-parser-2.4.8.tgz", + "integrity": "sha512-edRH8mBKEWNVIVMKejNnuJxleqYE/ZSdcT8/Nem9/mmosx12pctd80s2Oy00KNZzrogMZS5mauK2/ymL1bvlvg==" + }, "setimmediate": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz", @@ -26420,6 +26966,15 @@ } } }, + "sonic-boom": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/sonic-boom/-/sonic-boom-1.4.1.tgz", + "integrity": "sha512-LRHh/A8tpW7ru89lrlkU4AszXt1dbwSjVWguGrmlxE7tawVmDBlI1PILMkXAxJTwqhgsEeTHzj36D5CmHgQmNg==", + "requires": { + "atomic-sleep": "^1.0.0", + "flatstr": "^1.0.12" + } + }, "source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", @@ -26530,6 +27085,11 @@ "safe-buffer": "~5.2.0" } }, + "string-similarity": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/string-similarity/-/string-similarity-4.0.4.tgz", + "integrity": "sha512-/q/8Q4Bl4ZKAPjj8WerIBJWALKkaPRfrvhfF8k/B23i4nzrlRj2/go1m90In7nG/3XDSbOo0+pu6RvCTM9RGMQ==" + }, "string-width": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", @@ -26628,6 +27188,11 @@ "integrity": "sha1-8y6srFoXW+ol1/q1Zas+2HQe9W8=", "dev": true }, + "tiny-lru": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/tiny-lru/-/tiny-lru-7.0.6.tgz", + "integrity": "sha512-zNYO0Kvgn5rXzWpL0y3RS09sMK67eGaQj9805jlK9G6pSadfriTczzLHFXa/xcW4mIRfmlB9HyQ/+SgL0V1uow==" + }, "tmp": { "version": "0.0.33", "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", @@ -26803,7 +27368,6 @@ "version": "4.4.1", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", - "dev": true, "requires": { "punycode": "^2.1.0" } diff --git a/test/contract/package.json b/test/contract/package.json index 28f1d8fe..f2c759a8 100644 --- a/test/contract/package.json +++ b/test/contract/package.json @@ -3,6 +3,8 @@ "version": "1.0.0", "main": "index.js", "scripts": { + "compile": "npx hardhat compile", + "start": "HARDHAT_NETWORK=docker node src/index.js", "test": "echo \"Error: no test specified\" && exit 1" }, "keywords": [], @@ -10,6 +12,8 @@ "license": "ISC", "description": "", "dependencies": { + "@openzeppelin/contracts": "^4.0.0", + "fastify": "^3.14.2", "hardhat": "^2.2.0" }, "devDependencies": { diff --git a/test/contract/scripts/deploy.js b/test/contract/scripts/deploy.js new file mode 100644 index 00000000..b83c0103 --- /dev/null +++ b/test/contract/scripts/deploy.js @@ -0,0 +1,18 @@ +const hre = require("hardhat"); + +async function main() { + // await hre.run('compile'); + // We get the contract to deploy + const GLDToken = await hre.ethers.getContractFactory("GLDToken"); + const token = await GLDToken.deploy(); + await token.deployed(); + console.log("GLDToken deployed to:", token.address, token.deployTransaction.hash); +} +// We recommend this pattern to be able to use async/await everywhere +// and properly handle errors. +main() + .then(() => process.exit(0)) + .catch(error => { + console.error(error); + process.exit(1); + }); \ No newline at end of file diff --git a/test/contract/scripts/sample-script.js b/test/contract/scripts/sample-script.js index 127c73a6..5c3fbf0e 100644 --- a/test/contract/scripts/sample-script.js +++ b/test/contract/scripts/sample-script.js @@ -20,6 +20,10 @@ async function main() { await greeter.deployed(); console.log("Greeter deployed to:", greeter.address, "; tx hash: ", greeter.deployTransaction.hash); + + const result = await greeter.setGreeting("Hello 123!"); + + console.log("Greeter updated", "; tx hash: ", result.hash, "; block hash: ", result.blockHash); } // We recommend this pattern to be able to use async/await everywhere diff --git a/test/contract/src/index.js b/test/contract/src/index.js new file mode 100644 index 00000000..9fede5c4 --- /dev/null +++ b/test/contract/src/index.js @@ -0,0 +1,47 @@ +const fastify = require('fastify')({ logger: true }); +const hre = require("hardhat"); + +// readiness check +fastify.get('/v1/healthz', async (req, reply) => { + reply + .code(200) + .header('Content-Type', 'application/json; charset=utf-8') + .send({ success: true }) +}); + +fastify.get('/v1/deployContract', async (req, reply) => { + const GLDToken = await hre.ethers.getContractFactory("GLDToken"); + const token = await GLDToken.deploy(); + await token.deployed(); + + return { + address: token.address, + txHash: token.deployTransaction.hash, + blockNumber: token.deployTransaction.blockNumber, + blockHash: token.deployTransaction.blockHash, + } +}); + +// fastify.get('/v1/deployContract', async (req, reply) => { +// const GLDToken = await hre.ethers.getContractFactory("GLDToken"); +// const token = await GLDToken.deploy(); +// await token.deployed(); +// console.log("GLDToken deployed to:", token.address, token.deployTransaction); +// +// return { +// address: token.address, +// txHash: token.deployTransaction.hash, +// blockNumber: token.deployTransaction.blockNumber, +// } +// }); + +async function main() { + try { + await fastify.listen(3000, '0.0.0.0'); + } catch (err) { + fastify.log.error(err); + process.exit(1); + } +} + +main(); \ No newline at end of file diff --git a/test/helper.go b/test/helper.go new file mode 100644 index 00000000..ab72b1bf --- /dev/null +++ b/test/helper.go @@ -0,0 +1,31 @@ +package integration + +import ( + "encoding/json" + "net/http" +) + +type ContractDeployed struct { + Address string + TransactionHash string + BlockNumber int + BlockHash string +} + +func DeployContract() (*ContractDeployed, error) { + res, err := http.Get("http://localhost:3000/v1/deployContract") + if err != nil { + return nil, err + } + defer res.Body.Close() + + var contract ContractDeployed + + decoder := json.NewDecoder(res.Body) + err = decoder.Decode(&contract) + if err != nil { + return nil, err + } + + return &contract, nil +} diff --git a/test/integration_test.go b/test/integration_test.go index 445fa367..a319ed0c 100644 --- a/test/integration_test.go +++ b/test/integration_test.go @@ -2,10 +2,15 @@ package integration_test import ( "context" - "math/big" - + "fmt" + "github.com/ethereum/go-ethereum" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/rlp" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" + integration "github.com/vulcanize/ipld-eth-server/test" + "math/big" "github.com/ethereum/go-ethereum/ethclient" ) @@ -19,47 +24,146 @@ var _ = Describe("Integration test", func() { ipldClient, err := ethclient.Dial(ipldEthHttpPath) Expect(err).ToNot(HaveOccurred()) + ctx := context.Background() + + var contract *integration.ContractDeployed + var contractErr error + Describe("get Block", func() { - ctx := context.Background() + contract, contractErr = integration.DeployContract() - gethBlock, err := gethClient.BlockByNumber(ctx, big.NewInt(1)) - Expect(err).ToNot(HaveOccurred()) - Expect(gethBlock).ToNot(BeEmpty()) + It("get block by number", func() { + Expect(contractErr).ToNot(HaveOccurred()) - ipldBlock, err := ipldClient.BlockByNumber(ctx, big.NewInt(1)) - Expect(err).ToNot(HaveOccurred()) - Expect(ipldBlock).ToNot(BeEmpty()) + blockNum := contract.BlockNumber + + gethBlock, err := gethClient.BlockByNumber(ctx, big.NewInt(int64(blockNum))) + Expect(err).ToNot(HaveOccurred()) + + ipldBlock, err := ipldClient.BlockByNumber(ctx, big.NewInt(int64(blockNum))) + Expect(err).ToNot(HaveOccurred()) + + // check headers are equals + Expect(gethBlock.Header()).To(Equal(ipldBlock.Header())) + + gethTxs := gethBlock.Transactions() + ipldTxs := ipldBlock.Transactions() + + Expect(gethTxs.Len()).To(Equal(ipldTxs.Len())) + Expect(types.TxDifference(gethTxs, ipldTxs).Len()).To(Equal(0)) + }) + + It("get block by hash", func() { + + gethBlock, err := gethClient.BlockByHash(ctx, common.HexToHash(contract.BlockHash)) + fmt.Printf("contract info: %+v", contract) + Expect(err).ToNot(HaveOccurred()) + + ipldBlock, err := ipldClient.BlockByHash(ctx, common.HexToHash(contract.BlockHash)) + Expect(err).ToNot(HaveOccurred()) + + // check headers are equals + Expect(gethBlock).To(Equal(ipldBlock)) + Expect(gethBlock.Header()).To(Equal(ipldBlock.Header())) + + gethTxs := gethBlock.Transactions() + ipldTxs := ipldBlock.Transactions() + + Expect(gethTxs.Len()).To(Equal(ipldTxs.Len())) + Expect(types.TxDifference(gethTxs, ipldTxs).Len()).To(Equal(0)) + }) + }) + + Describe("Transaction", func() { + txHash := "0xdb3d5ef2d4e3260e1b8c1bcbb09b2d8fe7a6423196a20b8a3fa6c09dd9d79073" + blockHash := "0xb821ca79bd37174368073e469db92ead75148a95f7c24c49f2435fb7c7797588" + + It("Get tx by hash", func() { + gethTx, _, err := gethClient.TransactionByHash(ctx, common.HexToHash(txHash)) + Expect(err).ToNot(HaveOccurred()) + + ipldTx, _, err := ipldClient.TransactionByHash(ctx, common.HexToHash(txHash)) + Expect(err).ToNot(HaveOccurred()) + + Expect(gethTx).To(Equal(ipldTx)) + + Expect(gethTx.Hash()).To(Equal(ipldTx.Hash())) + }) + + It("Get tx by block hash and index", func() { + gethTx, err := gethClient.TransactionInBlock(ctx, common.HexToHash(blockHash), 0) + Expect(err).ToNot(HaveOccurred()) + + ipldTx, err := ipldClient.TransactionInBlock(ctx, common.HexToHash(blockHash), 0) + Expect(err).ToNot(HaveOccurred()) + + Expect(gethTx).To(Equal(ipldTx)) + + Expect(gethTx.Hash()).To(Equal(ipldTx.Hash())) + }) }) -}) + Describe("Receipt", func() { + txHash := "0xdb3d5ef2d4e3260e1b8c1bcbb09b2d8fe7a6423196a20b8a3fa6c09dd9d79073" -//func Test1(t *testing.T) { -// gethHttpPath := "http://127.0.0.1:8545" -// gethClient, err := ethclient.Dial(gethHttpPath) -// if err != nil { -// t.Fatal(err) -// } -// -// ipldEthHttpPath := "http://127.0.0.1:8081" -// ipldClient, err := ethclient.Dial(ipldEthHttpPath) -// if err != nil { -// t.Fatal(err) -// } -// -// ctx := context.Background() -// -// gethBlock, err := gethClient.BlockByNumber(ctx, big.NewInt(1)) -// if err != nil { -// t.Fatal(err) -// } -// ipldBlock, err := ipldClient.BlockByNumber(ctx, big.NewInt(1)) -// if err != nil { -// t.Fatal(err) -// } -// -// t.Logf("Geth Block header: %+v", gethBlock.Header()) -// t.Logf("IPLD Block header: %+v", ipldBlock.Header()) -// -// t.Log("asdasd") -//} + It("Get tx receipt", func() { + gethReceipt, err := gethClient.TransactionReceipt(ctx, common.HexToHash(txHash)) + Expect(err).ToNot(HaveOccurred()) + + ipldReceipt, err := ipldClient.TransactionReceipt(ctx, common.HexToHash(txHash)) + Expect(err).ToNot(HaveOccurred()) + + Expect(gethReceipt).To(Equal(ipldReceipt)) + + rlpGeth, err := rlp.EncodeToBytes(gethReceipt) + Expect(err).ToNot(HaveOccurred()) + + rlpIpld, err := rlp.EncodeToBytes(ipldReceipt) + Expect(err).ToNot(HaveOccurred()) + + Expect(rlpGeth).To(Equal(rlpIpld)) + }) + }) + + Describe("FilterLogs", func() { + //txHash := "0xdb3d5ef2d4e3260e1b8c1bcbb09b2d8fe7a6423196a20b8a3fa6c09dd9d79073" + //blockHash := "0xb821ca79bd37174368073e469db92ead75148a95f7c24c49f2435fb7c7797588" + blockHash := common.HexToHash( + "0xb821ca79bd37174368073e469db92ead75148a95f7c24c49f2435fb7c7797588", + ) + + It("with blockhash", func() { + filterQuery := ethereum.FilterQuery{ + //Addresses: addresses, + BlockHash: &blockHash, + Topics: [][]common.Hash{}, + } + + gethLogs, err := gethClient.FilterLogs(ctx, filterQuery) + Expect(err).ToNot(HaveOccurred()) + + ipldLogs, err := ipldClient.FilterLogs(ctx, filterQuery) + Expect(err).ToNot(HaveOccurred()) + + // not empty list + Expect(gethLogs).ToNot(BeEmpty()) + + Expect(len(gethLogs)).To(Equal(len(ipldLogs))) + Expect(gethLogs).To(Equal(ipldLogs)) + }) + }) + + Describe("CodeAt", func() { + contractAddress := "0xdEE08501Ef5b68339ca920227d6520A10B72b65b" + It("Get code of deployed contract without block number", func() { + gethCode, err := gethClient.CodeAt(ctx, common.HexToAddress(contractAddress), nil) + Expect(err).ToNot(HaveOccurred()) + + ipldCode, err := ipldClient.CodeAt(ctx, common.HexToAddress(contractAddress), nil) + Expect(err).ToNot(HaveOccurred()) + + Expect(gethCode).To(Equal(ipldCode)) + }) + }) +})