Add test for destroying and redeploying contract to same address

This commit is contained in:
nabarun 2022-03-17 17:31:01 +05:30 committed by prathamesh0
parent 56c85709c1
commit 849b17f4bd
8 changed files with 177 additions and 92 deletions

View File

@ -56,6 +56,8 @@ services:
ETH_FORWARD_ETH_CALLS: $ETH_FORWARD_ETH_CALLS
ETH_PROXY_ON_ERROR: $ETH_PROXY_ON_ERROR
ETH_HTTP_PATH: $ETH_HTTP_PATH
WATCHED_ADDRESS_GAP_FILLER_ENABLED: $WATCHED_ADDRESS_GAP_FILLER_ENABLED
WATCHED_ADDRESS_GAP_FILLER_INTERVAL: $WATCHED_ADDRESS_GAP_FILLER_INTERVAL
volumes:
- type: bind
source: ./chain.json

0
scripts/run_integration_test_forward_eth_calls.sh Normal file → Executable file
View File

View File

View File

@ -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": {
@ -9217,7 +9182,7 @@
"license": "MIT"
},
"node_modules/ganache-core/node_modules/node-fetch": {
"version": "2.6.7",
"version": "2.1.2",
"dev": true,
"license": "MIT",
"engines": {
@ -14740,6 +14705,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 +16032,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 +16048,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 +16062,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 +16074,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 +16086,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 +16094,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 +16103,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 +16113,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 +16121,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 +16129,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 +16146,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 +16161,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 +16180,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 +16200,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 +16208,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 +16229,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 +16238,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 +16246,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 +16272,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 +16280,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 +16289,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 +16298,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 +16308,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 +16319,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 +16331,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 +16343,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 +16353,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 +16369,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 +16379,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 +16401,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 +16413,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 +16814,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 +17001,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 +17748,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 +19750,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 +21561,7 @@
"version": "4.1.0",
"dev": true,
"requires": {
"node-fetch": "^2.6.7"
"node-fetch": "~1.7.1"
},
"dependencies": {
"is-stream": {
@ -21629,7 +21569,7 @@
"dev": true
},
"node-fetch": {
"version": "2.6.7",
"version": "1.7.3",
"dev": true,
"requires": {
"encoding": "^0.1.11",
@ -22827,7 +22767,7 @@
"dev": true
},
"node-fetch": {
"version": "2.6.7",
"version": "2.1.2",
"dev": true
},
"node-gyp-build": {
@ -26969,6 +26909,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",

View File

@ -15,7 +15,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",

View File

@ -1,7 +1,14 @@
const fastify = require('fastify')({ logger: true });
const hre = require("hardhat");
const { getStorageSlotKey } = require('./utils');
const {
deployContract,
isDeployed
} = require("solidity-create2-deployer");
const { getStorageSlotKey, deployCreate2Factory } = require('./utils');
const CREATE2_FACTORY_ADDRESS = '0x4a27c059FD7E383854Ea7DE6Be9c390a795f6eE3'
// readiness check
fastify.get('/v1/healthz', async (req, reply) => {
@ -130,6 +137,43 @@ fastify.get('/v1/getStorageKey', async (req, reply) => {
}
});
fastify.get('/v1/create2Contract', async (req, reply) => {
const contract = req.query.contract;
const salt = req.query.salt;
const provider = hre.ethers.provider;
const signer = await hre.ethers.getSigner();
const isFactoryDeployed = await isDeployed(CREATE2_FACTORY_ADDRESS, provider);
if (!isFactoryDeployed) {
await deployCreate2Factory(provider, signer)
}
const contractFactory = await hre.ethers.getContractFactory(contract);
const bytecode = contractFactory.bytecode;
const constructorTypes = [];
const constructorArgs = [];
const { txHash, address, receipt } = await deployContract({
salt,
contractBytecode: bytecode,
constructorTypes: constructorTypes,
constructorArgs: constructorArgs,
signer
});
const success = await isDeployed(address, provider);
if (success) {
return {
address,
txHash,
blockNumber: receipt.blockNumber,
blockHash: receipt.blockHash,
}
}
});
async function main() {
try {
await fastify.listen(3000, '0.0.0.0');
@ -139,4 +183,4 @@ async function main() {
}
}
main();
main();

View File

@ -1,6 +1,8 @@
const { artifacts } = require("hardhat")
const { utils, BigNumber } = require("ethers")
const { deployFactory } = require("solidity-create2-deployer");
const CREATE2_FACTORY_ACCOUNT = '0x2287Fa6efdEc6d8c3E0f4612ce551dEcf89A357A';
async function getStorageLayout(contractName) {
const artifact = await artifacts.readArtifact(contractName);
@ -35,4 +37,18 @@ async function getStorageSlotKey(contractName, variableName) {
return key
};
module.exports = { getStorageSlotKey }
async function deployCreate2Factory(provider, signer) {
// Send eth to account as required to deploy create2 factory contract.
let tx = {
to: CREATE2_FACTORY_ACCOUNT,
value: utils.parseEther('0.01')
}
const txResponse = await signer.sendTransaction(tx);
await txResponse.wait()
// Deploy create2 factory contract.
await deployFactory(provider)
}
module.exports = { getStorageSlotKey, deployCreate2Factory }

View File

@ -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))
})
It("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))
})
})