From d3c4de0cecfc85e9447583ff57aff97c201936b7 Mon Sep 17 00:00:00 2001 From: nabarun Date: Fri, 11 Mar 2022 14:50:23 +0530 Subject: [PATCH] Add integration test case for storage value after redeploying to same address --- test/contract/package-lock.json | 136 +++++++++++--------------------- test/integration_test.go | 74 +++++++++++++++++ 2 files changed, 122 insertions(+), 88 deletions(-) diff --git a/test/contract/package-lock.json b/test/contract/package-lock.json index 87061f13..a3d7634c 100644 --- a/test/contract/package-lock.json +++ b/test/contract/package-lock.json @@ -11,7 +11,8 @@ "dependencies": { "@openzeppelin/contracts": "^4.0.0", "fastify": "^3.14.2", - "hardhat": "^2.2.0" + "hardhat": "^2.2.0", + "solidity-create2-deployer": "^0.4.0" }, "devDependencies": { "@nomiclabs/hardhat-ethers": "^2.0.2", @@ -469,7 +470,6 @@ "version": "5.1.0", "resolved": "https://registry.npmjs.org/@ethersproject/abi/-/abi-5.1.0.tgz", "integrity": "sha512-N/W9Sbn1/C6Kh2kuHRjf/hX6euMK4+9zdJRBB8sDWmihVntjUAfxbusGZKzDQD8i3szAHhTz8K7XADV5iFNfJw==", - "dev": true, "funding": [ { "type": "individual", @@ -496,7 +496,6 @@ "version": "5.1.0", "resolved": "https://registry.npmjs.org/@ethersproject/abstract-provider/-/abstract-provider-5.1.0.tgz", "integrity": "sha512-8dJUnT8VNvPwWhYIau4dwp7qe1g+KgdRm4XTWvjkI9gAT2zZa90WF5ApdZ3vl1r6NDmnn6vUVvyphClRZRteTQ==", - "dev": true, "funding": [ { "type": "individual", @@ -521,7 +520,6 @@ "version": "5.1.0", "resolved": "https://registry.npmjs.org/@ethersproject/abstract-signer/-/abstract-signer-5.1.0.tgz", "integrity": "sha512-qQDMkjGZSSJSKl6AnfTgmz9FSnzq3iEoEbHTYwjDlEAv+LNP7zd4ixCcVWlWyk+2siud856M5CRhAmPdupeN9w==", - "dev": true, "funding": [ { "type": "individual", @@ -544,7 +542,6 @@ "version": "5.1.0", "resolved": "https://registry.npmjs.org/@ethersproject/address/-/address-5.1.0.tgz", "integrity": "sha512-rfWQR12eHn2cpstCFS4RF7oGjfbkZb0oqep+BfrT+gWEGWG2IowJvIsacPOvzyS1jhNF4MQ4BS59B04Mbovteg==", - "dev": true, "funding": [ { "type": "individual", @@ -567,7 +564,6 @@ "version": "5.1.0", "resolved": "https://registry.npmjs.org/@ethersproject/base64/-/base64-5.1.0.tgz", "integrity": "sha512-npD1bLvK4Bcxz+m4EMkx+F8Rd7CnqS9DYnhNu0/GlQBXhWjvfoAZzk5HJ0f1qeyp8d+A86PTuzLOGOXf4/CN8g==", - "dev": true, "funding": [ { "type": "individual", @@ -586,7 +582,6 @@ "version": "5.1.0", "resolved": "https://registry.npmjs.org/@ethersproject/basex/-/basex-5.1.0.tgz", "integrity": "sha512-vBKr39bum7DDbOvkr1Sj19bRMEPA4FnST6Utt6xhDzI7o7L6QNkDn2yrCfP+hnvJGhZFKtLygWwqlTBZoBXYLg==", - "dev": true, "funding": [ { "type": "individual", @@ -606,7 +601,6 @@ "version": "5.1.0", "resolved": "https://registry.npmjs.org/@ethersproject/bignumber/-/bignumber-5.1.0.tgz", "integrity": "sha512-wUvQlhTjPjFXIdLPOuTrFeQmSa6Wvls1bGXQNQWvB/SEn1NsTCE8PmumIEZxmOPjSHl1eV2uyHP5jBm5Cgj92Q==", - "dev": true, "funding": [ { "type": "individual", @@ -627,7 +621,6 @@ "version": "5.1.0", "resolved": "https://registry.npmjs.org/@ethersproject/bytes/-/bytes-5.1.0.tgz", "integrity": "sha512-sGTxb+LVjFxJcJeUswAIK6ncgOrh3D8c192iEJd7mLr95V6du119rRfYT/b87WPkZ5I3gRBUYIYXtdgCWACe8g==", - "dev": true, "funding": [ { "type": "individual", @@ -646,7 +639,6 @@ "version": "5.1.0", "resolved": "https://registry.npmjs.org/@ethersproject/constants/-/constants-5.1.0.tgz", "integrity": "sha512-0/SuHrxc8R8k+JiLmJymxHJbojUDWBQqO+b+XFdwaP0jGzqC09YDy/CAlSZB6qHsBifY8X3I89HcK/oMqxRdBw==", - "dev": true, "funding": [ { "type": "individual", @@ -665,7 +657,6 @@ "version": "5.1.0", "resolved": "https://registry.npmjs.org/@ethersproject/contracts/-/contracts-5.1.0.tgz", "integrity": "sha512-dvTMs/4XGSc57cYOW0KjgX1NdTujUu7mNb6PQdJWg08m9ULzPyGZuBkFJnijBcp6vTOCQ59RwjboWgNWw393og==", - "dev": true, "funding": [ { "type": "individual", @@ -693,7 +684,6 @@ "version": "5.1.0", "resolved": "https://registry.npmjs.org/@ethersproject/hash/-/hash-5.1.0.tgz", "integrity": "sha512-fNwry20yLLPpnRRwm3fBL+2ksgO+KMadxM44WJmRIoTKzy4269+rbq9KFoe2LTqq2CXJM2CE70beGaNrpuqflQ==", - "dev": true, "funding": [ { "type": "individual", @@ -719,7 +709,6 @@ "version": "5.1.0", "resolved": "https://registry.npmjs.org/@ethersproject/hdnode/-/hdnode-5.1.0.tgz", "integrity": "sha512-obIWdlujloExPHWJGmhJO/sETOOo7SEb6qemV4f8kyFoXg+cJK+Ta9SvBrj7hsUK85n3LZeZJZRjjM7oez3Clg==", - "dev": true, "funding": [ { "type": "individual", @@ -749,7 +738,6 @@ "version": "5.1.0", "resolved": "https://registry.npmjs.org/@ethersproject/json-wallets/-/json-wallets-5.1.0.tgz", "integrity": "sha512-00n2iBy27w8zrGZSiU762UOVuzCQZxUZxopsZC47++js6xUFuI74DHcJ5K/2pddlF1YBskvmMuboEu1geK8mnA==", - "dev": true, "funding": [ { "type": "individual", @@ -780,7 +768,6 @@ "version": "5.1.0", "resolved": "https://registry.npmjs.org/@ethersproject/keccak256/-/keccak256-5.1.0.tgz", "integrity": "sha512-vrTB1W6AEYoadww5c9UyVJ2YcSiyIUTNDRccZIgwTmFFoSHwBtcvG1hqy9RzJ1T0bMdATbM9Hfx2mJ6H0i7Hig==", - "dev": true, "funding": [ { "type": "individual", @@ -799,14 +786,12 @@ "node_modules/@ethersproject/keccak256/node_modules/js-sha3": { "version": "0.5.7", "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.5.7.tgz", - "integrity": "sha1-DU/9gALVMzqrr0oj7tL2N0yfKOc=", - "dev": true + "integrity": "sha1-DU/9gALVMzqrr0oj7tL2N0yfKOc=" }, "node_modules/@ethersproject/logger": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/@ethersproject/logger/-/logger-5.1.0.tgz", "integrity": "sha512-wtUaD1lBX10HBXjjKV9VHCBnTdUaKQnQ2XSET1ezglqLdPdllNOIlLfhyCRqXm5xwcjExVI5ETokOYfjPtaAlw==", - "dev": true, "funding": [ { "type": "individual", @@ -822,7 +807,6 @@ "version": "5.1.0", "resolved": "https://registry.npmjs.org/@ethersproject/networks/-/networks-5.1.0.tgz", "integrity": "sha512-A/NIrIED/G/IgU1XUukOA3WcFRxn2I4O5GxsYGA5nFlIi+UZWdGojs85I1VXkR1gX9eFnDXzjE6OtbgZHjFhIA==", - "dev": true, "funding": [ { "type": "individual", @@ -841,7 +825,6 @@ "version": "5.1.0", "resolved": "https://registry.npmjs.org/@ethersproject/pbkdf2/-/pbkdf2-5.1.0.tgz", "integrity": "sha512-B8cUbHHTgs8OtgJIafrRcz/YPDobVd5Ru8gTnShOiM9EBuFpYHQpq3+8iQJ6pyczDu6HP/oc/njAsIBhwFZYew==", - "dev": true, "funding": [ { "type": "individual", @@ -861,7 +844,6 @@ "version": "5.1.0", "resolved": "https://registry.npmjs.org/@ethersproject/properties/-/properties-5.1.0.tgz", "integrity": "sha512-519KKTwgmH42AQL3+GFV3SX6khYEfHsvI6v8HYejlkigSDuqttdgVygFTDsGlofNFchhDwuclrxQnD5B0YLNMg==", - "dev": true, "funding": [ { "type": "individual", @@ -880,7 +862,6 @@ "version": "5.1.0", "resolved": "https://registry.npmjs.org/@ethersproject/providers/-/providers-5.1.0.tgz", "integrity": "sha512-FjpZL2lSXrYpQDg2fMjugZ0HjQD9a+2fOOoRhhihh+Z+qi/xZ8vIlPoumrEP1DzIG4DBV6liUqLNqnX2C6FIAA==", - "dev": true, "funding": [ { "type": "individual", @@ -917,7 +898,6 @@ "version": "7.2.3", "resolved": "https://registry.npmjs.org/ws/-/ws-7.2.3.tgz", "integrity": "sha512-HTDl9G9hbkNDk98naoR/cHDws7+EyYMOdL1BmjsZXRUjf7d+MficC4B7HLUPlSiho0vg+CWKrGIt/VJBd1xunQ==", - "dev": true, "engines": { "node": ">=8.3.0" }, @@ -938,7 +918,6 @@ "version": "5.1.0", "resolved": "https://registry.npmjs.org/@ethersproject/random/-/random-5.1.0.tgz", "integrity": "sha512-+uuczLQZ4+no9cP6TCoCktXx0u2YbNaRT7lRkSt12d8263e702f0u+4JnnRO8Qmv5nylWJebnqCHzyxP+6mLqw==", - "dev": true, "funding": [ { "type": "individual", @@ -958,7 +937,6 @@ "version": "5.1.0", "resolved": "https://registry.npmjs.org/@ethersproject/rlp/-/rlp-5.1.0.tgz", "integrity": "sha512-vDTyHIwNPrecy55gKGZ47eJZhBm8LLBxihzi5ou+zrSvYTpkSTWRcKUlXFDFQVwfWB+P5PGyERAdiDEI76clxw==", - "dev": true, "funding": [ { "type": "individual", @@ -978,7 +956,6 @@ "version": "5.1.0", "resolved": "https://registry.npmjs.org/@ethersproject/sha2/-/sha2-5.1.0.tgz", "integrity": "sha512-+fNSeZRstOpdRJpdGUkRONFCaiAqWkc91zXgg76Nlp5ndBQE25Kk5yK8gCPG1aGnCrbariiPr5j9DmrYH78JCA==", - "dev": true, "funding": [ { "type": "individual", @@ -999,7 +976,6 @@ "version": "1.1.3", "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.3.tgz", "integrity": "sha512-/UETyP0W22QILqS+6HowevwhEFJ3MBJnwTf75Qob9Wz9t0DPuisL8kW8YZMK62dHAKE1c1p+gY1TtOLY+USEHA==", - "dev": true, "dependencies": { "inherits": "^2.0.3", "minimalistic-assert": "^1.0.0" @@ -1009,7 +985,6 @@ "version": "5.1.0", "resolved": "https://registry.npmjs.org/@ethersproject/signing-key/-/signing-key-5.1.0.tgz", "integrity": "sha512-tE5LFlbmdObG8bY04NpuwPWSRPgEswfxweAI1sH7TbP0ml1elNfqcq7ii/3AvIN05i5U0Pkm3Tf8bramt8MmLw==", - "dev": true, "funding": [ { "type": "individual", @@ -1032,7 +1007,6 @@ "version": "5.1.0", "resolved": "https://registry.npmjs.org/@ethersproject/solidity/-/solidity-5.1.0.tgz", "integrity": "sha512-kPodsGyo9zg1g9XSXp1lGhFaezBAUUsAUB1Vf6OkppE5Wksg4Et+x3kG4m7J/uShDMP2upkJtHNsIBK2XkVpKQ==", - "dev": true, "funding": [ { "type": "individual", @@ -1055,7 +1029,6 @@ "version": "5.1.0", "resolved": "https://registry.npmjs.org/@ethersproject/strings/-/strings-5.1.0.tgz", "integrity": "sha512-perBZy0RrmmL0ejiFGUOlBVjMsUceqLut3OBP3zP96LhiJWWbS8u1NqQVgN4/Gyrbziuda66DxiQocXhsvx+Sw==", - "dev": true, "funding": [ { "type": "individual", @@ -1076,7 +1049,6 @@ "version": "5.1.0", "resolved": "https://registry.npmjs.org/@ethersproject/transactions/-/transactions-5.1.0.tgz", "integrity": "sha512-s10crRLZEA0Bgv6FGEl/AKkTw9f+RVUrlWDX1rHnD4ZncPFeiV2AJr4nT7QSUhxJdFPvjyKRDb3nEH27dIqcPQ==", - "dev": true, "funding": [ { "type": "individual", @@ -1103,7 +1075,6 @@ "version": "5.1.0", "resolved": "https://registry.npmjs.org/@ethersproject/units/-/units-5.1.0.tgz", "integrity": "sha512-isvJrx6qG0nKWfxsGORNjmOq/nh175fStfvRTA2xEKrGqx8JNJY83fswu4GkILowfriEM/eYpretfJnfzi7YhA==", - "dev": true, "funding": [ { "type": "individual", @@ -1124,7 +1095,6 @@ "version": "5.1.0", "resolved": "https://registry.npmjs.org/@ethersproject/wallet/-/wallet-5.1.0.tgz", "integrity": "sha512-ULmUtiYQLTUS+y3DgkLzRhFEK10zMwmjOthnjiZxee3Q/MVwr3rnmuAnXIUZrPjna6hvUPnyRIdW5XuF0Ld0YQ==", - "dev": true, "funding": [ { "type": "individual", @@ -1157,7 +1127,6 @@ "version": "5.1.0", "resolved": "https://registry.npmjs.org/@ethersproject/web/-/web-5.1.0.tgz", "integrity": "sha512-LTeluWgTq04+RNqAkVhpydPcRZK/kKxD2Vy7PYGrAD27ABO9kTqTBKwiOuzTyAHKUQHfnvZbXmxBXJAGViSDcA==", - "dev": true, "funding": [ { "type": "individual", @@ -1180,7 +1149,6 @@ "version": "5.1.0", "resolved": "https://registry.npmjs.org/@ethersproject/wordlists/-/wordlists-5.1.0.tgz", "integrity": "sha512-NsUCi/TpBb+oTFvMSccUkJGtp5o/84eOyqp5q5aBeiNBSLkYyw21znRn9mAmxZgySpxgruVgKbaapnYPgvctPQ==", - "dev": true, "funding": [ { "type": "individual", @@ -1630,8 +1598,7 @@ "node_modules/aes-js": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/aes-js/-/aes-js-3.0.0.tgz", - "integrity": "sha1-4h3xCtbCBTKVvLuNq0Cwnb6ofk0=", - "dev": true + "integrity": "sha1-4h3xCtbCBTKVvLuNq0Cwnb6ofk0=" }, "node_modules/agent-base": { "version": "6.0.2", @@ -1870,8 +1837,7 @@ "node_modules/bech32": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/bech32/-/bech32-1.1.4.tgz", - "integrity": "sha512-s0IrSOzLlbvX7yp4WBfPITzpAU8sqQcpsmwXDiKwrG4r491vwCO/XpejasRNl0piBMe/DvP4Tz0mIS/X1DPJBQ==", - "dev": true + "integrity": "sha512-s0IrSOzLlbvX7yp4WBfPITzpAU8sqQcpsmwXDiKwrG4r491vwCO/XpejasRNl0piBMe/DvP4Tz0mIS/X1DPJBQ==" }, "node_modules/binary-extensions": { "version": "2.2.0", @@ -2774,7 +2740,6 @@ "version": "5.1.0", "resolved": "https://registry.npmjs.org/ethers/-/ethers-5.1.0.tgz", "integrity": "sha512-2L6Ge6wMBw02FlRoCLg4E0Elt3khMNlW6ULawa10mMeeZToYJ5+uCfiuTuB+XZ6om1Y7wuO9ZzezP8FsU2M/+g==", - "dev": true, "funding": [ { "type": "individual", @@ -5427,7 +5392,7 @@ "dev": true, "license": "MIT", "dependencies": { - "node-fetch": "^2.6.7", + "node-fetch": "2.1.2", "whatwg-fetch": "2.0.4" } }, @@ -7533,7 +7498,7 @@ "dev": true, "license": "MIT", "dependencies": { - "node-fetch": "^2.6.7" + "node-fetch": "~1.7.1" } }, "node_modules/ganache-core/node_modules/fetch-ponyfill/node_modules/is-stream": { @@ -7545,7 +7510,7 @@ } }, "node_modules/ganache-core/node_modules/fetch-ponyfill/node_modules/node-fetch": { - "version": "2.6.7", + "version": "1.7.3", "dev": true, "license": "MIT", "dependencies": { @@ -8639,6 +8604,8 @@ }, "node_modules/ganache-core/node_modules/keccak": { "version": "3.0.1", + "resolved": "https://registry.npmjs.org/keccak/-/keccak-3.0.1.tgz", + "integrity": "sha512-epq90L9jlFWCW7+pQa6JOnKn2Xgl2mtI664seYR6MHskvI9agt7AnDqmAlp9TqU4/caMYbA08Hi5DMZAl5zdkA==", "dev": true, "hasInstallScript": true, "inBundle": true, @@ -9212,12 +9179,14 @@ }, "node_modules/ganache-core/node_modules/node-addon-api": { "version": "2.0.2", + "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-2.0.2.tgz", + "integrity": "sha512-Ntyt4AIXyaLIuMHF6IOoTakB3K+RWxwtsHNRxllEoA6vPwP9o4866g6YWDLUdnucilZhmkxiHwHr11gAENw+QA==", "dev": true, "inBundle": true, "license": "MIT" }, "node_modules/ganache-core/node_modules/node-fetch": { - "version": "2.6.7", + "version": "2.1.2", "dev": true, "license": "MIT", "engines": { @@ -9226,6 +9195,8 @@ }, "node_modules/ganache-core/node_modules/node-gyp-build": { "version": "4.2.3", + "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.2.3.tgz", + "integrity": "sha512-MN6ZpzmfNCRM+3t57PTJHgHyw/h4OWnZ6mR8P5j/uZtqQr46RRuDE/P+g3n0YR/AiYXeWixZZzaip77gdICfRg==", "dev": true, "inBundle": true, "license": "MIT", @@ -14740,6 +14711,17 @@ "semver": "bin/semver" } }, + "node_modules/solidity-create2-deployer": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/solidity-create2-deployer/-/solidity-create2-deployer-0.4.0.tgz", + "integrity": "sha512-bB5d8fPt4dWsOoRodrsyfWKcjiv77IFl84+e6EckMMGYlfL2ZFqUoMz6tnqqiUFrM9abF1p6dWFOgJ/3zVc8yQ==", + "dependencies": { + "ethers": "^5.0.14" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/sonic-boom": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/sonic-boom/-/sonic-boom-1.4.1.tgz", @@ -16056,7 +16038,6 @@ "version": "5.1.0", "resolved": "https://registry.npmjs.org/@ethersproject/abi/-/abi-5.1.0.tgz", "integrity": "sha512-N/W9Sbn1/C6Kh2kuHRjf/hX6euMK4+9zdJRBB8sDWmihVntjUAfxbusGZKzDQD8i3szAHhTz8K7XADV5iFNfJw==", - "dev": true, "requires": { "@ethersproject/address": "^5.1.0", "@ethersproject/bignumber": "^5.1.0", @@ -16073,7 +16054,6 @@ "version": "5.1.0", "resolved": "https://registry.npmjs.org/@ethersproject/abstract-provider/-/abstract-provider-5.1.0.tgz", "integrity": "sha512-8dJUnT8VNvPwWhYIau4dwp7qe1g+KgdRm4XTWvjkI9gAT2zZa90WF5ApdZ3vl1r6NDmnn6vUVvyphClRZRteTQ==", - "dev": true, "requires": { "@ethersproject/bignumber": "^5.1.0", "@ethersproject/bytes": "^5.1.0", @@ -16088,7 +16068,6 @@ "version": "5.1.0", "resolved": "https://registry.npmjs.org/@ethersproject/abstract-signer/-/abstract-signer-5.1.0.tgz", "integrity": "sha512-qQDMkjGZSSJSKl6AnfTgmz9FSnzq3iEoEbHTYwjDlEAv+LNP7zd4ixCcVWlWyk+2siud856M5CRhAmPdupeN9w==", - "dev": true, "requires": { "@ethersproject/abstract-provider": "^5.1.0", "@ethersproject/bignumber": "^5.1.0", @@ -16101,7 +16080,6 @@ "version": "5.1.0", "resolved": "https://registry.npmjs.org/@ethersproject/address/-/address-5.1.0.tgz", "integrity": "sha512-rfWQR12eHn2cpstCFS4RF7oGjfbkZb0oqep+BfrT+gWEGWG2IowJvIsacPOvzyS1jhNF4MQ4BS59B04Mbovteg==", - "dev": true, "requires": { "@ethersproject/bignumber": "^5.1.0", "@ethersproject/bytes": "^5.1.0", @@ -16114,7 +16092,6 @@ "version": "5.1.0", "resolved": "https://registry.npmjs.org/@ethersproject/base64/-/base64-5.1.0.tgz", "integrity": "sha512-npD1bLvK4Bcxz+m4EMkx+F8Rd7CnqS9DYnhNu0/GlQBXhWjvfoAZzk5HJ0f1qeyp8d+A86PTuzLOGOXf4/CN8g==", - "dev": true, "requires": { "@ethersproject/bytes": "^5.1.0" } @@ -16123,7 +16100,6 @@ "version": "5.1.0", "resolved": "https://registry.npmjs.org/@ethersproject/basex/-/basex-5.1.0.tgz", "integrity": "sha512-vBKr39bum7DDbOvkr1Sj19bRMEPA4FnST6Utt6xhDzI7o7L6QNkDn2yrCfP+hnvJGhZFKtLygWwqlTBZoBXYLg==", - "dev": true, "requires": { "@ethersproject/bytes": "^5.1.0", "@ethersproject/properties": "^5.1.0" @@ -16133,7 +16109,6 @@ "version": "5.1.0", "resolved": "https://registry.npmjs.org/@ethersproject/bignumber/-/bignumber-5.1.0.tgz", "integrity": "sha512-wUvQlhTjPjFXIdLPOuTrFeQmSa6Wvls1bGXQNQWvB/SEn1NsTCE8PmumIEZxmOPjSHl1eV2uyHP5jBm5Cgj92Q==", - "dev": true, "requires": { "@ethersproject/bytes": "^5.1.0", "@ethersproject/logger": "^5.1.0", @@ -16144,7 +16119,6 @@ "version": "5.1.0", "resolved": "https://registry.npmjs.org/@ethersproject/bytes/-/bytes-5.1.0.tgz", "integrity": "sha512-sGTxb+LVjFxJcJeUswAIK6ncgOrh3D8c192iEJd7mLr95V6du119rRfYT/b87WPkZ5I3gRBUYIYXtdgCWACe8g==", - "dev": true, "requires": { "@ethersproject/logger": "^5.1.0" } @@ -16153,7 +16127,6 @@ "version": "5.1.0", "resolved": "https://registry.npmjs.org/@ethersproject/constants/-/constants-5.1.0.tgz", "integrity": "sha512-0/SuHrxc8R8k+JiLmJymxHJbojUDWBQqO+b+XFdwaP0jGzqC09YDy/CAlSZB6qHsBifY8X3I89HcK/oMqxRdBw==", - "dev": true, "requires": { "@ethersproject/bignumber": "^5.1.0" } @@ -16162,7 +16135,6 @@ "version": "5.1.0", "resolved": "https://registry.npmjs.org/@ethersproject/contracts/-/contracts-5.1.0.tgz", "integrity": "sha512-dvTMs/4XGSc57cYOW0KjgX1NdTujUu7mNb6PQdJWg08m9ULzPyGZuBkFJnijBcp6vTOCQ59RwjboWgNWw393og==", - "dev": true, "requires": { "@ethersproject/abi": "^5.1.0", "@ethersproject/abstract-provider": "^5.1.0", @@ -16180,7 +16152,6 @@ "version": "5.1.0", "resolved": "https://registry.npmjs.org/@ethersproject/hash/-/hash-5.1.0.tgz", "integrity": "sha512-fNwry20yLLPpnRRwm3fBL+2ksgO+KMadxM44WJmRIoTKzy4269+rbq9KFoe2LTqq2CXJM2CE70beGaNrpuqflQ==", - "dev": true, "requires": { "@ethersproject/abstract-signer": "^5.1.0", "@ethersproject/address": "^5.1.0", @@ -16196,7 +16167,6 @@ "version": "5.1.0", "resolved": "https://registry.npmjs.org/@ethersproject/hdnode/-/hdnode-5.1.0.tgz", "integrity": "sha512-obIWdlujloExPHWJGmhJO/sETOOo7SEb6qemV4f8kyFoXg+cJK+Ta9SvBrj7hsUK85n3LZeZJZRjjM7oez3Clg==", - "dev": true, "requires": { "@ethersproject/abstract-signer": "^5.1.0", "@ethersproject/basex": "^5.1.0", @@ -16216,7 +16186,6 @@ "version": "5.1.0", "resolved": "https://registry.npmjs.org/@ethersproject/json-wallets/-/json-wallets-5.1.0.tgz", "integrity": "sha512-00n2iBy27w8zrGZSiU762UOVuzCQZxUZxopsZC47++js6xUFuI74DHcJ5K/2pddlF1YBskvmMuboEu1geK8mnA==", - "dev": true, "requires": { "@ethersproject/abstract-signer": "^5.1.0", "@ethersproject/address": "^5.1.0", @@ -16237,7 +16206,6 @@ "version": "5.1.0", "resolved": "https://registry.npmjs.org/@ethersproject/keccak256/-/keccak256-5.1.0.tgz", "integrity": "sha512-vrTB1W6AEYoadww5c9UyVJ2YcSiyIUTNDRccZIgwTmFFoSHwBtcvG1hqy9RzJ1T0bMdATbM9Hfx2mJ6H0i7Hig==", - "dev": true, "requires": { "@ethersproject/bytes": "^5.1.0", "js-sha3": "0.5.7" @@ -16246,22 +16214,19 @@ "js-sha3": { "version": "0.5.7", "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.5.7.tgz", - "integrity": "sha1-DU/9gALVMzqrr0oj7tL2N0yfKOc=", - "dev": true + "integrity": "sha1-DU/9gALVMzqrr0oj7tL2N0yfKOc=" } } }, "@ethersproject/logger": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/@ethersproject/logger/-/logger-5.1.0.tgz", - "integrity": "sha512-wtUaD1lBX10HBXjjKV9VHCBnTdUaKQnQ2XSET1ezglqLdPdllNOIlLfhyCRqXm5xwcjExVI5ETokOYfjPtaAlw==", - "dev": true + "integrity": "sha512-wtUaD1lBX10HBXjjKV9VHCBnTdUaKQnQ2XSET1ezglqLdPdllNOIlLfhyCRqXm5xwcjExVI5ETokOYfjPtaAlw==" }, "@ethersproject/networks": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/@ethersproject/networks/-/networks-5.1.0.tgz", "integrity": "sha512-A/NIrIED/G/IgU1XUukOA3WcFRxn2I4O5GxsYGA5nFlIi+UZWdGojs85I1VXkR1gX9eFnDXzjE6OtbgZHjFhIA==", - "dev": true, "requires": { "@ethersproject/logger": "^5.1.0" } @@ -16270,7 +16235,6 @@ "version": "5.1.0", "resolved": "https://registry.npmjs.org/@ethersproject/pbkdf2/-/pbkdf2-5.1.0.tgz", "integrity": "sha512-B8cUbHHTgs8OtgJIafrRcz/YPDobVd5Ru8gTnShOiM9EBuFpYHQpq3+8iQJ6pyczDu6HP/oc/njAsIBhwFZYew==", - "dev": true, "requires": { "@ethersproject/bytes": "^5.1.0", "@ethersproject/sha2": "^5.1.0" @@ -16280,7 +16244,6 @@ "version": "5.1.0", "resolved": "https://registry.npmjs.org/@ethersproject/properties/-/properties-5.1.0.tgz", "integrity": "sha512-519KKTwgmH42AQL3+GFV3SX6khYEfHsvI6v8HYejlkigSDuqttdgVygFTDsGlofNFchhDwuclrxQnD5B0YLNMg==", - "dev": true, "requires": { "@ethersproject/logger": "^5.1.0" } @@ -16289,7 +16252,6 @@ "version": "5.1.0", "resolved": "https://registry.npmjs.org/@ethersproject/providers/-/providers-5.1.0.tgz", "integrity": "sha512-FjpZL2lSXrYpQDg2fMjugZ0HjQD9a+2fOOoRhhihh+Z+qi/xZ8vIlPoumrEP1DzIG4DBV6liUqLNqnX2C6FIAA==", - "dev": true, "requires": { "@ethersproject/abstract-provider": "^5.1.0", "@ethersproject/abstract-signer": "^5.1.0", @@ -16316,7 +16278,6 @@ "version": "7.2.3", "resolved": "https://registry.npmjs.org/ws/-/ws-7.2.3.tgz", "integrity": "sha512-HTDl9G9hbkNDk98naoR/cHDws7+EyYMOdL1BmjsZXRUjf7d+MficC4B7HLUPlSiho0vg+CWKrGIt/VJBd1xunQ==", - "dev": true, "requires": {} } } @@ -16325,7 +16286,6 @@ "version": "5.1.0", "resolved": "https://registry.npmjs.org/@ethersproject/random/-/random-5.1.0.tgz", "integrity": "sha512-+uuczLQZ4+no9cP6TCoCktXx0u2YbNaRT7lRkSt12d8263e702f0u+4JnnRO8Qmv5nylWJebnqCHzyxP+6mLqw==", - "dev": true, "requires": { "@ethersproject/bytes": "^5.1.0", "@ethersproject/logger": "^5.1.0" @@ -16335,7 +16295,6 @@ "version": "5.1.0", "resolved": "https://registry.npmjs.org/@ethersproject/rlp/-/rlp-5.1.0.tgz", "integrity": "sha512-vDTyHIwNPrecy55gKGZ47eJZhBm8LLBxihzi5ou+zrSvYTpkSTWRcKUlXFDFQVwfWB+P5PGyERAdiDEI76clxw==", - "dev": true, "requires": { "@ethersproject/bytes": "^5.1.0", "@ethersproject/logger": "^5.1.0" @@ -16345,7 +16304,6 @@ "version": "5.1.0", "resolved": "https://registry.npmjs.org/@ethersproject/sha2/-/sha2-5.1.0.tgz", "integrity": "sha512-+fNSeZRstOpdRJpdGUkRONFCaiAqWkc91zXgg76Nlp5ndBQE25Kk5yK8gCPG1aGnCrbariiPr5j9DmrYH78JCA==", - "dev": true, "requires": { "@ethersproject/bytes": "^5.1.0", "@ethersproject/logger": "^5.1.0", @@ -16356,7 +16314,6 @@ "version": "1.1.3", "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.3.tgz", "integrity": "sha512-/UETyP0W22QILqS+6HowevwhEFJ3MBJnwTf75Qob9Wz9t0DPuisL8kW8YZMK62dHAKE1c1p+gY1TtOLY+USEHA==", - "dev": true, "requires": { "inherits": "^2.0.3", "minimalistic-assert": "^1.0.0" @@ -16368,7 +16325,6 @@ "version": "5.1.0", "resolved": "https://registry.npmjs.org/@ethersproject/signing-key/-/signing-key-5.1.0.tgz", "integrity": "sha512-tE5LFlbmdObG8bY04NpuwPWSRPgEswfxweAI1sH7TbP0ml1elNfqcq7ii/3AvIN05i5U0Pkm3Tf8bramt8MmLw==", - "dev": true, "requires": { "@ethersproject/bytes": "^5.1.0", "@ethersproject/logger": "^5.1.0", @@ -16381,7 +16337,6 @@ "version": "5.1.0", "resolved": "https://registry.npmjs.org/@ethersproject/solidity/-/solidity-5.1.0.tgz", "integrity": "sha512-kPodsGyo9zg1g9XSXp1lGhFaezBAUUsAUB1Vf6OkppE5Wksg4Et+x3kG4m7J/uShDMP2upkJtHNsIBK2XkVpKQ==", - "dev": true, "requires": { "@ethersproject/bignumber": "^5.1.0", "@ethersproject/bytes": "^5.1.0", @@ -16394,7 +16349,6 @@ "version": "5.1.0", "resolved": "https://registry.npmjs.org/@ethersproject/strings/-/strings-5.1.0.tgz", "integrity": "sha512-perBZy0RrmmL0ejiFGUOlBVjMsUceqLut3OBP3zP96LhiJWWbS8u1NqQVgN4/Gyrbziuda66DxiQocXhsvx+Sw==", - "dev": true, "requires": { "@ethersproject/bytes": "^5.1.0", "@ethersproject/constants": "^5.1.0", @@ -16405,7 +16359,6 @@ "version": "5.1.0", "resolved": "https://registry.npmjs.org/@ethersproject/transactions/-/transactions-5.1.0.tgz", "integrity": "sha512-s10crRLZEA0Bgv6FGEl/AKkTw9f+RVUrlWDX1rHnD4ZncPFeiV2AJr4nT7QSUhxJdFPvjyKRDb3nEH27dIqcPQ==", - "dev": true, "requires": { "@ethersproject/address": "^5.1.0", "@ethersproject/bignumber": "^5.1.0", @@ -16422,7 +16375,6 @@ "version": "5.1.0", "resolved": "https://registry.npmjs.org/@ethersproject/units/-/units-5.1.0.tgz", "integrity": "sha512-isvJrx6qG0nKWfxsGORNjmOq/nh175fStfvRTA2xEKrGqx8JNJY83fswu4GkILowfriEM/eYpretfJnfzi7YhA==", - "dev": true, "requires": { "@ethersproject/bignumber": "^5.1.0", "@ethersproject/constants": "^5.1.0", @@ -16433,7 +16385,6 @@ "version": "5.1.0", "resolved": "https://registry.npmjs.org/@ethersproject/wallet/-/wallet-5.1.0.tgz", "integrity": "sha512-ULmUtiYQLTUS+y3DgkLzRhFEK10zMwmjOthnjiZxee3Q/MVwr3rnmuAnXIUZrPjna6hvUPnyRIdW5XuF0Ld0YQ==", - "dev": true, "requires": { "@ethersproject/abstract-provider": "^5.1.0", "@ethersproject/abstract-signer": "^5.1.0", @@ -16456,7 +16407,6 @@ "version": "5.1.0", "resolved": "https://registry.npmjs.org/@ethersproject/web/-/web-5.1.0.tgz", "integrity": "sha512-LTeluWgTq04+RNqAkVhpydPcRZK/kKxD2Vy7PYGrAD27ABO9kTqTBKwiOuzTyAHKUQHfnvZbXmxBXJAGViSDcA==", - "dev": true, "requires": { "@ethersproject/base64": "^5.1.0", "@ethersproject/bytes": "^5.1.0", @@ -16469,7 +16419,6 @@ "version": "5.1.0", "resolved": "https://registry.npmjs.org/@ethersproject/wordlists/-/wordlists-5.1.0.tgz", "integrity": "sha512-NsUCi/TpBb+oTFvMSccUkJGtp5o/84eOyqp5q5aBeiNBSLkYyw21znRn9mAmxZgySpxgruVgKbaapnYPgvctPQ==", - "dev": true, "requires": { "@ethersproject/bytes": "^5.1.0", "@ethersproject/hash": "^5.1.0", @@ -16871,8 +16820,7 @@ "aes-js": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/aes-js/-/aes-js-3.0.0.tgz", - "integrity": "sha1-4h3xCtbCBTKVvLuNq0Cwnb6ofk0=", - "dev": true + "integrity": "sha1-4h3xCtbCBTKVvLuNq0Cwnb6ofk0=" }, "agent-base": { "version": "6.0.2", @@ -17059,8 +17007,7 @@ "bech32": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/bech32/-/bech32-1.1.4.tgz", - "integrity": "sha512-s0IrSOzLlbvX7yp4WBfPITzpAU8sqQcpsmwXDiKwrG4r491vwCO/XpejasRNl0piBMe/DvP4Tz0mIS/X1DPJBQ==", - "dev": true + "integrity": "sha512-s0IrSOzLlbvX7yp4WBfPITzpAU8sqQcpsmwXDiKwrG4r491vwCO/XpejasRNl0piBMe/DvP4Tz0mIS/X1DPJBQ==" }, "binary-extensions": { "version": "2.2.0", @@ -17807,7 +17754,6 @@ "version": "5.1.0", "resolved": "https://registry.npmjs.org/ethers/-/ethers-5.1.0.tgz", "integrity": "sha512-2L6Ge6wMBw02FlRoCLg4E0Elt3khMNlW6ULawa10mMeeZToYJ5+uCfiuTuB+XZ6om1Y7wuO9ZzezP8FsU2M/+g==", - "dev": true, "requires": { "@ethersproject/abi": "5.1.0", "@ethersproject/abstract-provider": "5.1.0", @@ -19810,7 +19756,7 @@ "version": "2.2.3", "dev": true, "requires": { - "node-fetch": "^2.6.7", + "node-fetch": "2.1.2", "whatwg-fetch": "2.0.4" } }, @@ -21621,7 +21567,7 @@ "version": "4.1.0", "dev": true, "requires": { - "node-fetch": "^2.6.7" + "node-fetch": "~1.7.1" }, "dependencies": { "is-stream": { @@ -21629,7 +21575,7 @@ "dev": true }, "node-fetch": { - "version": "2.6.7", + "version": "1.7.3", "dev": true, "requires": { "encoding": "^0.1.11", @@ -22392,6 +22338,8 @@ }, "keccak": { "version": "3.0.1", + "resolved": "https://registry.npmjs.org/keccak/-/keccak-3.0.1.tgz", + "integrity": "sha512-epq90L9jlFWCW7+pQa6JOnKn2Xgl2mtI664seYR6MHskvI9agt7AnDqmAlp9TqU4/caMYbA08Hi5DMZAl5zdkA==", "bundled": true, "dev": true, "requires": { @@ -22823,15 +22771,19 @@ }, "node-addon-api": { "version": "2.0.2", + "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-2.0.2.tgz", + "integrity": "sha512-Ntyt4AIXyaLIuMHF6IOoTakB3K+RWxwtsHNRxllEoA6vPwP9o4866g6YWDLUdnucilZhmkxiHwHr11gAENw+QA==", "bundled": true, "dev": true }, "node-fetch": { - "version": "2.6.7", + "version": "2.1.2", "dev": true }, "node-gyp-build": { "version": "4.2.3", + "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.2.3.tgz", + "integrity": "sha512-MN6ZpzmfNCRM+3t57PTJHgHyw/h4OWnZ6mR8P5j/uZtqQr46RRuDE/P+g3n0YR/AiYXeWixZZzaip77gdICfRg==", "bundled": true, "dev": true }, @@ -26969,6 +26921,14 @@ } } }, + "solidity-create2-deployer": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/solidity-create2-deployer/-/solidity-create2-deployer-0.4.0.tgz", + "integrity": "sha512-bB5d8fPt4dWsOoRodrsyfWKcjiv77IFl84+e6EckMMGYlfL2ZFqUoMz6tnqqiUFrM9abF1p6dWFOgJ/3zVc8yQ==", + "requires": { + "ethers": "^5.0.14" + } + }, "sonic-boom": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/sonic-boom/-/sonic-boom-1.4.1.tgz", diff --git a/test/integration_test.go b/test/integration_test.go index d38474ac..228dcec9 100644 --- a/test/integration_test.go +++ b/test/integration_test.go @@ -325,6 +325,11 @@ var _ = Describe("Integration test", func() { }) Describe("Get Storage", func() { + var slvContract *integration.ContractDeployed + var slvCountA *big.Int + + contractSalt := "SLVContractSalt" + BeforeEach(func() { contract, contractErr = integration.DeployContract() erc20TotalSupply, bigIntResult = new(big.Int).SetString("1000000000000000000000", 10) @@ -405,12 +410,48 @@ var _ = Describe("Integration test", func() { Expect(gethStorage).To(Equal(ipldStorage)) }) + It("get storage for SLV countA", func() { + slvContract, contractErr = integration.Create2Contract("SLVToken", contractSalt) + Expect(contractErr).ToNot(HaveOccurred()) + countAIndex := "0x5" + + time.Sleep(sleepInterval) + + gethStorage, err := gethClient.StorageAt(ctx, common.HexToAddress(slvContract.Address), common.HexToHash(countAIndex), nil) + Expect(err).ToNot(HaveOccurred()) + + gethCountA := new(big.Int).SetBytes(gethStorage) + slvCountA = gethCountA + + ipldStorage, err := ipldClient.StorageAt(ctx, common.HexToAddress(slvContract.Address), common.HexToHash(countAIndex), nil) + Expect(err).ToNot(HaveOccurred()) + + ipldCountA := new(big.Int).SetBytes(ipldStorage) + Expect(ipldCountA.String()).To(Equal(slvCountA.String())) + + _, txErr = integration.IncrementCount(slvContract.Address, "A") + Expect(txErr).ToNot(HaveOccurred()) + slvCountA.Add(slvCountA, big.NewInt(1)) + + time.Sleep(sleepInterval) + + ipldStorage, err = ipldClient.StorageAt(ctx, common.HexToAddress(slvContract.Address), common.HexToHash(countAIndex), nil) + Expect(err).ToNot(HaveOccurred()) + + ipldCountA = new(big.Int).SetBytes(ipldStorage) + Expect(ipldCountA.String()).To(Equal(slvCountA.String())) + }) + It("get storage after self destruct", func() { totalSupplyIndex := "0x2" + countAIndex := "0x5" tx, err := integration.DestroyContract(contract.Address) Expect(err).ToNot(HaveOccurred()) + slvTx, err := integration.DestroyContract(slvContract.Address) + Expect(err).ToNot(HaveOccurred()) + time.Sleep(sleepInterval) gethStorage1, err := gethClient.StorageAt(ctx, common.HexToAddress(contract.Address), common.HexToHash(totalSupplyIndex), big.NewInt(tx.BlockNumber-1)) @@ -434,6 +475,39 @@ var _ = Describe("Integration test", func() { Expect(err).ToNot(HaveOccurred()) Expect(ipldStorage2).To(Equal(ipldStorage3)) + + // Check for SLV contract + gethStorage, err := gethClient.StorageAt(ctx, common.HexToAddress(slvContract.Address), common.HexToHash(countAIndex), big.NewInt(slvTx.BlockNumber)) + Expect(err).ToNot(HaveOccurred()) + Expect(gethStorage).To(Equal(eth.EmptyNodeValue)) + + ipldStorage, err := ipldClient.StorageAt(ctx, common.HexToAddress(slvContract.Address), common.HexToHash(countAIndex), big.NewInt(slvTx.BlockNumber)) + Expect(err).ToNot(HaveOccurred()) + Expect(ipldStorage).To(Equal(gethStorage)) + + slvCountA.Set(big.NewInt(0)) + }) + + XIt("get storage after redeploying", func() { + slvContract, contractErr = integration.Create2Contract("SLVToken", contractSalt) + Expect(contractErr).ToNot(HaveOccurred()) + time.Sleep(sleepInterval) + + countAIndex := "0x5" + + gethStorage, err := gethClient.StorageAt(ctx, common.HexToAddress(slvContract.Address), common.HexToHash(countAIndex), nil) + Expect(err).ToNot(HaveOccurred()) + + gethCountA := new(big.Int).SetBytes(gethStorage) + Expect(gethCountA.String()).To(Equal(slvCountA.String())) + + ipldStorage, err := ipldClient.StorageAt(ctx, common.HexToAddress(slvContract.Address), common.HexToHash(countAIndex), nil) + Expect(err).ToNot(HaveOccurred()) + + ipldCountA := new(big.Int).SetBytes(ipldStorage) + Expect(ipldCountA.String()).To(Equal(slvCountA.String())) + + Expect(gethStorage).To(Equal(ipldStorage)) }) })