From 6c6fff18d2b5213f58881000607f233939729517 Mon Sep 17 00:00:00 2001 From: Nisheeth Barthwal Date: Fri, 2 Sep 2022 13:24:23 +0200 Subject: [PATCH 1/7] add fee visualizer script --- package-lock.json | 1237 ++++++++++++++++++++++++++++++++++----------- package.json | 3 +- src/tools/fees.ts | 816 ++++++++++++++++++++++++++++++ 3 files changed, 1767 insertions(+), 289 deletions(-) create mode 100644 src/tools/fees.ts diff --git a/package-lock.json b/package-lock.json index be29186..b5ada98 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,6 +15,7 @@ "@polkadot/util-crypto": "^9.5.1", "chalk": "^4.1.2", "esbuild": "^0.13.8", + "ethers": "^5.7.0", "lodash.isobject": "^3.0.2", "lodash.mergewith": "^4.6.2", "moonbeam-types-bundle": "^2.0.7", @@ -22,7 +23,7 @@ "prettier": "^2.7.1", "rollup-plugin-esbuild": "^4.6.0", "rollup-plugin-preserve-shebangs": "^0.2.0", - "solc": "^0.8.10", + "solc": "^0.8.16", "sqlite": "^4.0.25", "sqlite3": "^5.0.2", "table": "^6.8.0", @@ -582,9 +583,9 @@ } }, "node_modules/@ethersproject/abstract-provider": { - "version": "5.5.1", - "resolved": "https://registry.npmjs.org/@ethersproject/abstract-provider/-/abstract-provider-5.5.1.tgz", - "integrity": "sha512-m+MA/ful6eKbxpr99xUYeRvLkfnlqzrF8SZ46d/xFB1A7ZVknYc/sXJG0RcufF52Qn2jeFj1hhcoQ7IXjNKUqg==", + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/abstract-provider/-/abstract-provider-5.7.0.tgz", + "integrity": "sha512-R41c9UkchKCpAqStMYUpdunjo3pkEvZC3FAwZn5S5MGbXoMQOHIdHItezTETxAO5bevtMApSyEhn9+CHcDsWBw==", "funding": [ { "type": "individual", @@ -596,19 +597,19 @@ } ], "dependencies": { - "@ethersproject/bignumber": "^5.5.0", - "@ethersproject/bytes": "^5.5.0", - "@ethersproject/logger": "^5.5.0", - "@ethersproject/networks": "^5.5.0", - "@ethersproject/properties": "^5.5.0", - "@ethersproject/transactions": "^5.5.0", - "@ethersproject/web": "^5.5.0" + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/networks": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/transactions": "^5.7.0", + "@ethersproject/web": "^5.7.0" } }, "node_modules/@ethersproject/abstract-signer": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/@ethersproject/abstract-signer/-/abstract-signer-5.5.0.tgz", - "integrity": "sha512-lj//7r250MXVLKI7sVarXAbZXbv9P50lgmJQGr2/is82EwEb8r7HrxsmMqAjTsztMYy7ohrIhGMIml+Gx4D3mA==", + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/abstract-signer/-/abstract-signer-5.7.0.tgz", + "integrity": "sha512-a16V8bq1/Cz+TGCkE2OPMTOUDLS3grCpdjoJCYNnVBbdYEMSgKrU0+B90s8b6H+ByYTBZN7a3g76jdIJi7UfKQ==", "funding": [ { "type": "individual", @@ -620,17 +621,17 @@ } ], "dependencies": { - "@ethersproject/abstract-provider": "^5.5.0", - "@ethersproject/bignumber": "^5.5.0", - "@ethersproject/bytes": "^5.5.0", - "@ethersproject/logger": "^5.5.0", - "@ethersproject/properties": "^5.5.0" + "@ethersproject/abstract-provider": "^5.7.0", + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/properties": "^5.7.0" } }, "node_modules/@ethersproject/address": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/@ethersproject/address/-/address-5.5.0.tgz", - "integrity": "sha512-l4Nj0eWlTUh6ro5IbPTgbpT4wRbdH5l8CQf7icF7sb/SI3Nhd9Y9HzhonTSTi6CefI0necIw7LJqQPopPLZyWw==", + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/address/-/address-5.7.0.tgz", + "integrity": "sha512-9wYhYt7aghVGo758POM5nqcOMaE168Q6aRLJZwUmiqSrAungkG74gSSeKEIR7ukixesdRZGPgVqme6vmxs1fkA==", "funding": [ { "type": "individual", @@ -642,17 +643,35 @@ } ], "dependencies": { - "@ethersproject/bignumber": "^5.5.0", - "@ethersproject/bytes": "^5.5.0", - "@ethersproject/keccak256": "^5.5.0", - "@ethersproject/logger": "^5.5.0", - "@ethersproject/rlp": "^5.5.0" + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/keccak256": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/rlp": "^5.7.0" } }, "node_modules/@ethersproject/base64": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/@ethersproject/base64/-/base64-5.5.0.tgz", - "integrity": "sha512-tdayUKhU1ljrlHzEWbStXazDpsx4eg1dBXUSI6+mHlYklOXoXF6lZvw8tnD6oVaWfnMxAgRSKROg3cVKtCcppA==", + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/base64/-/base64-5.7.0.tgz", + "integrity": "sha512-Dr8tcHt2mEbsZr/mwTPIQAf3Ai0Bks/7gTw9dSqk1mQvhW3XvRlmDJr/4n+wg1JmCl16NZue17CDh8xb/vZ0sQ==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/bytes": "^5.7.0" + } + }, + "node_modules/@ethersproject/basex": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/basex/-/basex-5.7.0.tgz", + "integrity": "sha512-ywlh43GwZLv2Voc2gQVTKBoVQ1mti3d8HK5aMxsfu/nRDnMmNqaSJ3r3n85HBByT8OpoY96SXM1FogC533T4zw==", "funding": [ { "type": "individual", @@ -664,13 +683,14 @@ } ], "dependencies": { - "@ethersproject/bytes": "^5.5.0" + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/properties": "^5.7.0" } }, "node_modules/@ethersproject/bignumber": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/@ethersproject/bignumber/-/bignumber-5.5.0.tgz", - "integrity": "sha512-6Xytlwvy6Rn3U3gKEc1vP7nR92frHkv6wtVr95LFR3jREXiCPzdWxKQ1cx4JGQBXxcguAwjA8murlYN2TSiEbg==", + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/bignumber/-/bignumber-5.7.0.tgz", + "integrity": "sha512-n1CAdIHRWjSucQO3MC1zPSVgV/6dy/fjL9pMrPP9peL+QxEg9wOsVqwD4+818B6LUEtaXzVHQiuivzRoxPxUGw==", "funding": [ { "type": "individual", @@ -682,15 +702,20 @@ } ], "dependencies": { - "@ethersproject/bytes": "^5.5.0", - "@ethersproject/logger": "^5.5.0", - "bn.js": "^4.11.9" + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "bn.js": "^5.2.1" } }, + "node_modules/@ethersproject/bignumber/node_modules/bn.js": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz", + "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==" + }, "node_modules/@ethersproject/bytes": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/@ethersproject/bytes/-/bytes-5.5.0.tgz", - "integrity": "sha512-ABvc7BHWhZU9PNM/tANm/Qx4ostPGadAuQzWTr3doklZOhDlmcBqclrQe/ZXUIj3K8wC28oYeuRa+A37tX9kog==", + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/bytes/-/bytes-5.7.0.tgz", + "integrity": "sha512-nsbxwgFXWh9NyYWo+U8atvmMsSdKJprTcICAkvbBffT75qDocbuggBU0SJiVK2MuTrp0q+xvLkTnGMPK1+uA9A==", "funding": [ { "type": "individual", @@ -702,13 +727,13 @@ } ], "dependencies": { - "@ethersproject/logger": "^5.5.0" + "@ethersproject/logger": "^5.7.0" } }, "node_modules/@ethersproject/constants": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/@ethersproject/constants/-/constants-5.5.0.tgz", - "integrity": "sha512-2MsRRVChkvMWR+GyMGY4N1sAX9Mt3J9KykCsgUFd/1mwS0UH1qw+Bv9k1UJb3X3YJYFco9H20pjSlOIfCG5HYQ==", + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/constants/-/constants-5.7.0.tgz", + "integrity": "sha512-DHI+y5dBNvkpYUMiRQyxRBYBefZkJfo70VUkUAsRjcPs47muV9evftfZ0PJVCXYbAiCgght0DtcF9srFQmIgWA==", "funding": [ { "type": "individual", @@ -720,13 +745,92 @@ } ], "dependencies": { - "@ethersproject/bignumber": "^5.5.0" + "@ethersproject/bignumber": "^5.7.0" + } + }, + "node_modules/@ethersproject/contracts": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/contracts/-/contracts-5.7.0.tgz", + "integrity": "sha512-5GJbzEU3X+d33CdfPhcyS+z8MzsTrBGk/sc+G+59+tPa9yFkl6HQ9D6L0QMgNTA9q8dT0XKxxkyp883XsQvbbg==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/abi": "^5.7.0", + "@ethersproject/abstract-provider": "^5.7.0", + "@ethersproject/abstract-signer": "^5.7.0", + "@ethersproject/address": "^5.7.0", + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/constants": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/transactions": "^5.7.0" + } + }, + "node_modules/@ethersproject/contracts/node_modules/@ethersproject/abi": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/abi/-/abi-5.7.0.tgz", + "integrity": "sha512-351ktp42TiRcYB3H1OP8yajPeAQstMW/yCFokj/AthP9bLHzQFPlOrxOcwYEDkUAICmOHljvN4K39OMTMUa9RA==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/address": "^5.7.0", + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/constants": "^5.7.0", + "@ethersproject/hash": "^5.7.0", + "@ethersproject/keccak256": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/strings": "^5.7.0" } }, "node_modules/@ethersproject/hash": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/@ethersproject/hash/-/hash-5.5.0.tgz", - "integrity": "sha512-dnGVpK1WtBjmnp3mUT0PlU2MpapnwWI0PibldQEq1408tQBAbZpPidkWoVVuNMOl/lISO3+4hXZWCL3YV7qzfg==", + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/hash/-/hash-5.7.0.tgz", + "integrity": "sha512-qX5WrQfnah1EFnO5zJv1v46a8HW0+E5xuBBDTwMFZLuVTx0tbU2kkx15NqdjxecrLGatQN9FGQKpb1FKdHCt+g==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/abstract-signer": "^5.7.0", + "@ethersproject/address": "^5.7.0", + "@ethersproject/base64": "^5.7.0", + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/keccak256": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/strings": "^5.7.0" + } + }, + "node_modules/@ethersproject/hdnode": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/hdnode/-/hdnode-5.7.0.tgz", + "integrity": "sha512-OmyYo9EENBPPf4ERhR7oj6uAtUAhYGqOnIS+jE5pTXvdKBS99ikzq1E7Iv0ZQZ5V36Lqx1qZLeak0Ra16qpeOg==", "funding": [ { "type": "individual", @@ -738,20 +842,54 @@ } ], "dependencies": { - "@ethersproject/abstract-signer": "^5.5.0", - "@ethersproject/address": "^5.5.0", - "@ethersproject/bignumber": "^5.5.0", - "@ethersproject/bytes": "^5.5.0", - "@ethersproject/keccak256": "^5.5.0", - "@ethersproject/logger": "^5.5.0", - "@ethersproject/properties": "^5.5.0", - "@ethersproject/strings": "^5.5.0" + "@ethersproject/abstract-signer": "^5.7.0", + "@ethersproject/basex": "^5.7.0", + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/pbkdf2": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/sha2": "^5.7.0", + "@ethersproject/signing-key": "^5.7.0", + "@ethersproject/strings": "^5.7.0", + "@ethersproject/transactions": "^5.7.0", + "@ethersproject/wordlists": "^5.7.0" + } + }, + "node_modules/@ethersproject/json-wallets": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/json-wallets/-/json-wallets-5.7.0.tgz", + "integrity": "sha512-8oee5Xgu6+RKgJTkvEMl2wDgSPSAQ9MB/3JYjFV9jlKvcYHUXZC+cQp0njgmxdHkYWn8s6/IqIZYm0YWCjO/0g==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/abstract-signer": "^5.7.0", + "@ethersproject/address": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/hdnode": "^5.7.0", + "@ethersproject/keccak256": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/pbkdf2": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/random": "^5.7.0", + "@ethersproject/strings": "^5.7.0", + "@ethersproject/transactions": "^5.7.0", + "aes-js": "3.0.0", + "scrypt-js": "3.0.1" } }, "node_modules/@ethersproject/keccak256": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/@ethersproject/keccak256/-/keccak256-5.5.0.tgz", - "integrity": "sha512-5VoFCTjo2rYbBe1l2f4mccaRFN/4VQEYFwwn04aJV2h7qf4ZvI2wFxUE1XOX+snbwCLRzIeikOqtAoPwMza9kg==", + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/keccak256/-/keccak256-5.7.0.tgz", + "integrity": "sha512-2UcPboeL/iW+pSg6vZ6ydF8tCnv3Iu/8tUmLLzWWGzxWKFFqOBQFLo6uLUv6BDrLgCDfN28RJ/wtByx+jZ4KBg==", "funding": [ { "type": "individual", @@ -763,14 +901,14 @@ } ], "dependencies": { - "@ethersproject/bytes": "^5.5.0", + "@ethersproject/bytes": "^5.7.0", "js-sha3": "0.8.0" } }, "node_modules/@ethersproject/logger": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/@ethersproject/logger/-/logger-5.5.0.tgz", - "integrity": "sha512-rIY/6WPm7T8n3qS2vuHTUBPdXHl+rGxWxW5okDfo9J4Z0+gRRZT0msvUdIJkE4/HS29GUMziwGaaKO2bWONBrg==", + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/logger/-/logger-5.7.0.tgz", + "integrity": "sha512-0odtFdXu/XHtjQXJYA3u9G0G8btm0ND5Cu8M7i5vhEcE8/HmF4Lbdqanwyv4uQTr2tx6b7fQRmgLrsnpQlmnig==", "funding": [ { "type": "individual", @@ -783,9 +921,27 @@ ] }, "node_modules/@ethersproject/networks": { - "version": "5.5.1", - "resolved": "https://registry.npmjs.org/@ethersproject/networks/-/networks-5.5.1.tgz", - "integrity": "sha512-tYRDM4zZtSUcKnD4UMuAlj7SeXH/k5WC4SP2u1Pn57++JdXHkRu2zwNkgNogZoxHzhm9Q6qqurDBVptHOsW49Q==", + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/networks/-/networks-5.7.0.tgz", + "integrity": "sha512-MG6oHSQHd4ebvJrleEQQ4HhVu8Ichr0RDYEfHzsVAVjHNM+w36x9wp9r+hf1JstMXtseXDtkiVoARAG6M959AA==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/logger": "^5.7.0" + } + }, + "node_modules/@ethersproject/pbkdf2": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/pbkdf2/-/pbkdf2-5.7.0.tgz", + "integrity": "sha512-oR/dBRZR6GTyaofd86DehG72hY6NpAjhabkhxgr3X2FpJtJuodEl2auADWBZfhDHgVCbu3/H/Ocq2uC6dpNjjw==", "funding": [ { "type": "individual", @@ -797,13 +953,32 @@ } ], "dependencies": { - "@ethersproject/logger": "^5.5.0" + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/sha2": "^5.7.0" } }, "node_modules/@ethersproject/properties": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/@ethersproject/properties/-/properties-5.5.0.tgz", - "integrity": "sha512-l3zRQg3JkD8EL3CPjNK5g7kMx4qSwiR60/uk5IVjd3oq1MZR5qUg40CNOoEJoX5wc3DyY5bt9EbMk86C7x0DNA==", + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/properties/-/properties-5.7.0.tgz", + "integrity": "sha512-J87jy8suntrAkIZtecpxEPxY//szqr1mlBaYlQ0r4RCaiD2hjheqF9s1LVE8vVuJCXisjIP+JgtK/Do54ej4Sw==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/logger": "^5.7.0" + } + }, + "node_modules/@ethersproject/providers": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/providers/-/providers-5.7.0.tgz", + "integrity": "sha512-+TTrrINMzZ0aXtlwO/95uhAggKm4USLm1PbeCBR/3XZ7+Oey+3pMyddzZEyRhizHpy1HXV0FRWRMI1O3EGYibA==", "funding": [ { "type": "individual", @@ -815,13 +990,90 @@ } ], "dependencies": { - "@ethersproject/logger": "^5.5.0" + "@ethersproject/abstract-provider": "^5.7.0", + "@ethersproject/abstract-signer": "^5.7.0", + "@ethersproject/address": "^5.7.0", + "@ethersproject/base64": "^5.7.0", + "@ethersproject/basex": "^5.7.0", + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/constants": "^5.7.0", + "@ethersproject/hash": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/networks": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/random": "^5.7.0", + "@ethersproject/rlp": "^5.7.0", + "@ethersproject/sha2": "^5.7.0", + "@ethersproject/strings": "^5.7.0", + "@ethersproject/transactions": "^5.7.0", + "@ethersproject/web": "^5.7.0", + "bech32": "1.1.4", + "ws": "7.4.6" + } + }, + "node_modules/@ethersproject/providers/node_modules/ws": { + "version": "7.4.6", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.4.6.tgz", + "integrity": "sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A==", + "engines": { + "node": ">=8.3.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": "^5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, + "node_modules/@ethersproject/random": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/random/-/random-5.7.0.tgz", + "integrity": "sha512-19WjScqRA8IIeWclFme75VMXSBvi4e6InrUNuaR4s5pTF2qNhcGdCUwdxUVGtDDqC00sDLCO93jPQoDUH4HVmQ==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/logger": "^5.7.0" } }, "node_modules/@ethersproject/rlp": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/@ethersproject/rlp/-/rlp-5.5.0.tgz", - "integrity": "sha512-hLv8XaQ8PTI9g2RHoQGf/WSxBfTB/NudRacbzdxmst5VHAqd1sMibWG7SENzT5Dj3yZ3kJYx+WiRYEcQTAkcYA==", + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/rlp/-/rlp-5.7.0.tgz", + "integrity": "sha512-rBxzX2vK8mVF7b0Tol44t5Tb8gomOHkj5guL+HhzQ1yBh/ydjGnpw6at+X6Iw0Kp3OzzzkcKp8N9r0W4kYSs9w==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/logger": "^5.7.0" + } + }, + "node_modules/@ethersproject/sha2": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/sha2/-/sha2-5.7.0.tgz", + "integrity": "sha512-gKlH42riwb3KYp0reLsFTokByAKoJdgFCwI+CCiX/k+Jm2mbNs6oOaCjYQSlI1+XBVejwH2KrmCbMAT/GnRDQw==", "funding": [ { "type": "individual", @@ -833,14 +1085,15 @@ } ], "dependencies": { - "@ethersproject/bytes": "^5.5.0", - "@ethersproject/logger": "^5.5.0" + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "hash.js": "1.1.7" } }, "node_modules/@ethersproject/signing-key": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/@ethersproject/signing-key/-/signing-key-5.5.0.tgz", - "integrity": "sha512-5VmseH7qjtNmDdZBswavhotYbWB0bOwKIlOTSlX14rKn5c11QmJwGt4GHeo7NrL/Ycl7uo9AHvEqs5xZgFBTng==", + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/signing-key/-/signing-key-5.7.0.tgz", + "integrity": "sha512-MZdy2nL3wO0u7gkB4nA/pEf8lu1TlFswPNmy8AiYkfKTdO6eXBJyUdmHO/ehm/htHw9K/qF8ujnTyUAD+Ry54Q==", "funding": [ { "type": "individual", @@ -852,18 +1105,46 @@ } ], "dependencies": { - "@ethersproject/bytes": "^5.5.0", - "@ethersproject/logger": "^5.5.0", - "@ethersproject/properties": "^5.5.0", - "bn.js": "^4.11.9", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "bn.js": "^5.2.1", "elliptic": "6.5.4", "hash.js": "1.1.7" } }, + "node_modules/@ethersproject/signing-key/node_modules/bn.js": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz", + "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==" + }, + "node_modules/@ethersproject/solidity": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/solidity/-/solidity-5.7.0.tgz", + "integrity": "sha512-HmabMd2Dt/raavyaGukF4XxizWKhKQ24DoLtdNbBmNKUOPqwjsKQSdV9GQtj9CBEea9DlzETlVER1gYeXXBGaA==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/keccak256": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/sha2": "^5.7.0", + "@ethersproject/strings": "^5.7.0" + } + }, "node_modules/@ethersproject/strings": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/@ethersproject/strings/-/strings-5.5.0.tgz", - "integrity": "sha512-9fy3TtF5LrX/wTrBaT8FGE6TDJyVjOvXynXJz5MT5azq+E6D92zuKNx7i29sWW2FjVOaWjAsiZ1ZWznuduTIIQ==", + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/strings/-/strings-5.7.0.tgz", + "integrity": "sha512-/9nu+lj0YswRNSH0NXYqrh8775XNyEdUQAuf3f+SmOrnVewcJ5SBNAjF7lpgehKi4abvNNXyf+HX86czCdJ8Mg==", "funding": [ { "type": "individual", @@ -875,15 +1156,15 @@ } ], "dependencies": { - "@ethersproject/bytes": "^5.5.0", - "@ethersproject/constants": "^5.5.0", - "@ethersproject/logger": "^5.5.0" + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/constants": "^5.7.0", + "@ethersproject/logger": "^5.7.0" } }, "node_modules/@ethersproject/transactions": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/@ethersproject/transactions/-/transactions-5.5.0.tgz", - "integrity": "sha512-9RZYSKX26KfzEd/1eqvv8pLauCKzDTub0Ko4LfIgaERvRuwyaNV78mJs7cpIgZaDl6RJui4o49lHwwCM0526zA==", + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/transactions/-/transactions-5.7.0.tgz", + "integrity": "sha512-kmcNicCp1lp8qanMTC3RIikGgoJ80ztTyvtsFvCYpSCfkjhD0jZ2LOrnbcuxuToLIUYYf+4XwD1rP+B/erDIhQ==", "funding": [ { "type": "individual", @@ -895,21 +1176,95 @@ } ], "dependencies": { - "@ethersproject/address": "^5.5.0", - "@ethersproject/bignumber": "^5.5.0", - "@ethersproject/bytes": "^5.5.0", - "@ethersproject/constants": "^5.5.0", - "@ethersproject/keccak256": "^5.5.0", - "@ethersproject/logger": "^5.5.0", - "@ethersproject/properties": "^5.5.0", - "@ethersproject/rlp": "^5.5.0", - "@ethersproject/signing-key": "^5.5.0" + "@ethersproject/address": "^5.7.0", + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/constants": "^5.7.0", + "@ethersproject/keccak256": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/rlp": "^5.7.0", + "@ethersproject/signing-key": "^5.7.0" + } + }, + "node_modules/@ethersproject/units": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/units/-/units-5.7.0.tgz", + "integrity": "sha512-pD3xLMy3SJu9kG5xDGI7+xhTEmGXlEqXU4OfNapmfnxLVY4EMSSRp7j1k7eezutBPH7RBN/7QPnwR7hzNlEFeg==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/constants": "^5.7.0", + "@ethersproject/logger": "^5.7.0" + } + }, + "node_modules/@ethersproject/wallet": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/wallet/-/wallet-5.7.0.tgz", + "integrity": "sha512-MhmXlJXEJFBFVKrDLB4ZdDzxcBxQ3rLyCkhNqVu3CDYvR97E+8r01UgrI+TI99Le+aYm/in/0vp86guJuM7FCA==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/abstract-provider": "^5.7.0", + "@ethersproject/abstract-signer": "^5.7.0", + "@ethersproject/address": "^5.7.0", + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/hash": "^5.7.0", + "@ethersproject/hdnode": "^5.7.0", + "@ethersproject/json-wallets": "^5.7.0", + "@ethersproject/keccak256": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/random": "^5.7.0", + "@ethersproject/signing-key": "^5.7.0", + "@ethersproject/transactions": "^5.7.0", + "@ethersproject/wordlists": "^5.7.0" } }, "node_modules/@ethersproject/web": { - "version": "5.5.1", - "resolved": "https://registry.npmjs.org/@ethersproject/web/-/web-5.5.1.tgz", - "integrity": "sha512-olvLvc1CB12sREc1ROPSHTdFCdvMh0J5GSJYiQg2D0hdD4QmJDy8QYDb1CvoqD/bF1c++aeKv2sR5uduuG9dQg==", + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/web/-/web-5.7.0.tgz", + "integrity": "sha512-ApHcbbj+muRASVDSCl/tgxaH2LBkRMEYfLOLVa0COipx0+nlu0QKet7U2lEg0vdkh8XRSLf2nd1f1Uk9SrVSGA==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/base64": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/strings": "^5.7.0" + } + }, + "node_modules/@ethersproject/wordlists": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/wordlists/-/wordlists-5.7.0.tgz", + "integrity": "sha512-S2TFNJNfHWVHNE6cNDjbVlZ6MgE17MIxMbMg2zv3wn+3XSJGosL1m9ZVv3GXCf/2ymSsQ+hRI5IzoMJTG6aoVA==", "funding": [ { "type": "individual", @@ -921,11 +1276,11 @@ } ], "dependencies": { - "@ethersproject/base64": "^5.5.0", - "@ethersproject/bytes": "^5.5.0", - "@ethersproject/logger": "^5.5.0", - "@ethersproject/properties": "^5.5.0", - "@ethersproject/strings": "^5.5.0" + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/hash": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/strings": "^5.7.0" } }, "node_modules/@humanwhocodes/config-array": { @@ -1890,6 +2245,11 @@ "node": ">=0.4.0" } }, + "node_modules/aes-js": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/aes-js/-/aes-js-3.0.0.tgz", + "integrity": "sha512-H7wUZRn8WpTq9jocdxQ2c8x2sKo9ZVmzfRE13GiNJXfp7NcKYEdvl3vspKjXox6RIG2VtaRe4JFvxG4rqp2Zuw==" + }, "node_modules/aggregate-error": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.1.0.tgz", @@ -2122,6 +2482,11 @@ "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=" }, + "node_modules/bech32": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/bech32/-/bech32-1.1.4.tgz", + "integrity": "sha512-s0IrSOzLlbvX7yp4WBfPITzpAU8sqQcpsmwXDiKwrG4r491vwCO/XpejasRNl0piBMe/DvP4Tz0mIS/X1DPJBQ==" + }, "node_modules/bignumber.js": { "version": "9.0.2", "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.0.2.tgz", @@ -3715,6 +4080,79 @@ "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.0.tgz", "integrity": "sha512-D7iWRBvnZE8ecXiLj/9wbxH7Tk79fAh8IHaTNq1RWRixsS02W+5qS+iE9yq6RYl0asXx5tw0bLhmT5pIfbSquw==" }, + "node_modules/ethers": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/ethers/-/ethers-5.7.0.tgz", + "integrity": "sha512-5Xhzp2ZQRi0Em+0OkOcRHxPzCfoBfgtOQA+RUylSkuHbhTEaQklnYi2hsWbRgs3ztJsXVXd9VKBcO1ScWL8YfA==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/abi": "5.7.0", + "@ethersproject/abstract-provider": "5.7.0", + "@ethersproject/abstract-signer": "5.7.0", + "@ethersproject/address": "5.7.0", + "@ethersproject/base64": "5.7.0", + "@ethersproject/basex": "5.7.0", + "@ethersproject/bignumber": "5.7.0", + "@ethersproject/bytes": "5.7.0", + "@ethersproject/constants": "5.7.0", + "@ethersproject/contracts": "5.7.0", + "@ethersproject/hash": "5.7.0", + "@ethersproject/hdnode": "5.7.0", + "@ethersproject/json-wallets": "5.7.0", + "@ethersproject/keccak256": "5.7.0", + "@ethersproject/logger": "5.7.0", + "@ethersproject/networks": "5.7.0", + "@ethersproject/pbkdf2": "5.7.0", + "@ethersproject/properties": "5.7.0", + "@ethersproject/providers": "5.7.0", + "@ethersproject/random": "5.7.0", + "@ethersproject/rlp": "5.7.0", + "@ethersproject/sha2": "5.7.0", + "@ethersproject/signing-key": "5.7.0", + "@ethersproject/solidity": "5.7.0", + "@ethersproject/strings": "5.7.0", + "@ethersproject/transactions": "5.7.0", + "@ethersproject/units": "5.7.0", + "@ethersproject/wallet": "5.7.0", + "@ethersproject/web": "5.7.0", + "@ethersproject/wordlists": "5.7.0" + } + }, + "node_modules/ethers/node_modules/@ethersproject/abi": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/abi/-/abi-5.7.0.tgz", + "integrity": "sha512-351ktp42TiRcYB3H1OP8yajPeAQstMW/yCFokj/AthP9bLHzQFPlOrxOcwYEDkUAICmOHljvN4K39OMTMUa9RA==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/address": "^5.7.0", + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/constants": "^5.7.0", + "@ethersproject/hash": "^5.7.0", + "@ethersproject/keccak256": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/strings": "^5.7.0" + } + }, "node_modules/ethjs-unit": { "version": "0.1.6", "resolved": "https://registry.npmjs.org/ethjs-unit/-/ethjs-unit-0.1.6.tgz", @@ -3961,18 +4399,6 @@ "node": ">= 0.6" } }, - "node_modules/fs-extra": { - "version": "0.30.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-0.30.0.tgz", - "integrity": "sha1-8jP/zAjU2n1DLapEl3aYnbHfk/A=", - "dependencies": { - "graceful-fs": "^4.1.2", - "jsonfile": "^2.1.0", - "klaw": "^1.0.0", - "path-is-absolute": "^1.0.0", - "rimraf": "^2.2.8" - } - }, "node_modules/fs-minipass": { "version": "1.2.7", "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-1.2.7.tgz", @@ -4970,14 +5396,6 @@ "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.0.0.tgz", "integrity": "sha512-fQzRfAbIBnR0IQvftw9FJveWiHp72Fg20giDrHz6TdfB12UH/uue0D3hm57UB5KgAVuniLMCaS8P1IMj9NR7cA==" }, - "node_modules/jsonfile": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-2.4.0.tgz", - "integrity": "sha1-NzaitCi4e72gzIO1P6PWM6NcKug=", - "optionalDependencies": { - "graceful-fs": "^4.1.6" - } - }, "node_modules/jsprim": { "version": "1.4.2", "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.2.tgz", @@ -5014,14 +5432,6 @@ "json-buffer": "3.0.0" } }, - "node_modules/klaw": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/klaw/-/klaw-1.3.1.tgz", - "integrity": "sha1-QIhDO0azsbolnXh4XY6W9zugJDk=", - "optionalDependencies": { - "graceful-fs": "^4.1.9" - } - }, "node_modules/levn": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", @@ -6595,25 +7005,23 @@ } }, "node_modules/solc": { - "version": "0.8.11", - "resolved": "https://registry.npmjs.org/solc/-/solc-0.8.11.tgz", - "integrity": "sha512-CdK4pk6VZowmXv7l4lftbr/QUWsHEr+xcdcGHJVgynD08gRwFT4zAFCb3b/eR0FUVVszcHulpGJwEoKRKKrnKw==", + "version": "0.8.16", + "resolved": "https://registry.npmjs.org/solc/-/solc-0.8.16.tgz", + "integrity": "sha512-6oZg7FAhIouj2zYLvoR3Q4fMP/+BGPR7sY7GcrEXKIp+DRd8RmpDEFO1LUBKpClUiaYguNgmthTFmnPl4MeiMQ==", "dependencies": { "command-exists": "^1.2.8", "commander": "^8.1.0", "follow-redirects": "^1.12.1", - "fs-extra": "^0.30.0", "js-sha3": "0.8.0", "memorystream": "^0.3.1", - "require-from-string": "^2.0.0", "semver": "^5.5.0", "tmp": "0.0.33" }, "bin": { - "solcjs": "solcjs" + "solcjs": "solc.js" }, "engines": { - "node": ">=8.0.0" + "node": ">=10.0.0" } }, "node_modules/source-map": { @@ -8335,180 +8743,398 @@ } }, "@ethersproject/abstract-provider": { - "version": "5.5.1", - "resolved": "https://registry.npmjs.org/@ethersproject/abstract-provider/-/abstract-provider-5.5.1.tgz", - "integrity": "sha512-m+MA/ful6eKbxpr99xUYeRvLkfnlqzrF8SZ46d/xFB1A7ZVknYc/sXJG0RcufF52Qn2jeFj1hhcoQ7IXjNKUqg==", + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/abstract-provider/-/abstract-provider-5.7.0.tgz", + "integrity": "sha512-R41c9UkchKCpAqStMYUpdunjo3pkEvZC3FAwZn5S5MGbXoMQOHIdHItezTETxAO5bevtMApSyEhn9+CHcDsWBw==", "requires": { - "@ethersproject/bignumber": "^5.5.0", - "@ethersproject/bytes": "^5.5.0", - "@ethersproject/logger": "^5.5.0", - "@ethersproject/networks": "^5.5.0", - "@ethersproject/properties": "^5.5.0", - "@ethersproject/transactions": "^5.5.0", - "@ethersproject/web": "^5.5.0" + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/networks": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/transactions": "^5.7.0", + "@ethersproject/web": "^5.7.0" } }, "@ethersproject/abstract-signer": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/@ethersproject/abstract-signer/-/abstract-signer-5.5.0.tgz", - "integrity": "sha512-lj//7r250MXVLKI7sVarXAbZXbv9P50lgmJQGr2/is82EwEb8r7HrxsmMqAjTsztMYy7ohrIhGMIml+Gx4D3mA==", + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/abstract-signer/-/abstract-signer-5.7.0.tgz", + "integrity": "sha512-a16V8bq1/Cz+TGCkE2OPMTOUDLS3grCpdjoJCYNnVBbdYEMSgKrU0+B90s8b6H+ByYTBZN7a3g76jdIJi7UfKQ==", "requires": { - "@ethersproject/abstract-provider": "^5.5.0", - "@ethersproject/bignumber": "^5.5.0", - "@ethersproject/bytes": "^5.5.0", - "@ethersproject/logger": "^5.5.0", - "@ethersproject/properties": "^5.5.0" + "@ethersproject/abstract-provider": "^5.7.0", + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/properties": "^5.7.0" } }, "@ethersproject/address": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/@ethersproject/address/-/address-5.5.0.tgz", - "integrity": "sha512-l4Nj0eWlTUh6ro5IbPTgbpT4wRbdH5l8CQf7icF7sb/SI3Nhd9Y9HzhonTSTi6CefI0necIw7LJqQPopPLZyWw==", + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/address/-/address-5.7.0.tgz", + "integrity": "sha512-9wYhYt7aghVGo758POM5nqcOMaE168Q6aRLJZwUmiqSrAungkG74gSSeKEIR7ukixesdRZGPgVqme6vmxs1fkA==", "requires": { - "@ethersproject/bignumber": "^5.5.0", - "@ethersproject/bytes": "^5.5.0", - "@ethersproject/keccak256": "^5.5.0", - "@ethersproject/logger": "^5.5.0", - "@ethersproject/rlp": "^5.5.0" + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/keccak256": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/rlp": "^5.7.0" } }, "@ethersproject/base64": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/@ethersproject/base64/-/base64-5.5.0.tgz", - "integrity": "sha512-tdayUKhU1ljrlHzEWbStXazDpsx4eg1dBXUSI6+mHlYklOXoXF6lZvw8tnD6oVaWfnMxAgRSKROg3cVKtCcppA==", + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/base64/-/base64-5.7.0.tgz", + "integrity": "sha512-Dr8tcHt2mEbsZr/mwTPIQAf3Ai0Bks/7gTw9dSqk1mQvhW3XvRlmDJr/4n+wg1JmCl16NZue17CDh8xb/vZ0sQ==", + "requires": { + "@ethersproject/bytes": "^5.7.0" + } + }, + "@ethersproject/basex": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/basex/-/basex-5.7.0.tgz", + "integrity": "sha512-ywlh43GwZLv2Voc2gQVTKBoVQ1mti3d8HK5aMxsfu/nRDnMmNqaSJ3r3n85HBByT8OpoY96SXM1FogC533T4zw==", "requires": { - "@ethersproject/bytes": "^5.5.0" + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/properties": "^5.7.0" } }, "@ethersproject/bignumber": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/@ethersproject/bignumber/-/bignumber-5.5.0.tgz", - "integrity": "sha512-6Xytlwvy6Rn3U3gKEc1vP7nR92frHkv6wtVr95LFR3jREXiCPzdWxKQ1cx4JGQBXxcguAwjA8murlYN2TSiEbg==", + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/bignumber/-/bignumber-5.7.0.tgz", + "integrity": "sha512-n1CAdIHRWjSucQO3MC1zPSVgV/6dy/fjL9pMrPP9peL+QxEg9wOsVqwD4+818B6LUEtaXzVHQiuivzRoxPxUGw==", "requires": { - "@ethersproject/bytes": "^5.5.0", - "@ethersproject/logger": "^5.5.0", - "bn.js": "^4.11.9" + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "bn.js": "^5.2.1" + }, + "dependencies": { + "bn.js": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz", + "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==" + } } }, "@ethersproject/bytes": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/@ethersproject/bytes/-/bytes-5.5.0.tgz", - "integrity": "sha512-ABvc7BHWhZU9PNM/tANm/Qx4ostPGadAuQzWTr3doklZOhDlmcBqclrQe/ZXUIj3K8wC28oYeuRa+A37tX9kog==", + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/bytes/-/bytes-5.7.0.tgz", + "integrity": "sha512-nsbxwgFXWh9NyYWo+U8atvmMsSdKJprTcICAkvbBffT75qDocbuggBU0SJiVK2MuTrp0q+xvLkTnGMPK1+uA9A==", "requires": { - "@ethersproject/logger": "^5.5.0" + "@ethersproject/logger": "^5.7.0" } }, "@ethersproject/constants": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/@ethersproject/constants/-/constants-5.5.0.tgz", - "integrity": "sha512-2MsRRVChkvMWR+GyMGY4N1sAX9Mt3J9KykCsgUFd/1mwS0UH1qw+Bv9k1UJb3X3YJYFco9H20pjSlOIfCG5HYQ==", - "requires": { - "@ethersproject/bignumber": "^5.5.0" + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/constants/-/constants-5.7.0.tgz", + "integrity": "sha512-DHI+y5dBNvkpYUMiRQyxRBYBefZkJfo70VUkUAsRjcPs47muV9evftfZ0PJVCXYbAiCgght0DtcF9srFQmIgWA==", + "requires": { + "@ethersproject/bignumber": "^5.7.0" + } + }, + "@ethersproject/contracts": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/contracts/-/contracts-5.7.0.tgz", + "integrity": "sha512-5GJbzEU3X+d33CdfPhcyS+z8MzsTrBGk/sc+G+59+tPa9yFkl6HQ9D6L0QMgNTA9q8dT0XKxxkyp883XsQvbbg==", + "requires": { + "@ethersproject/abi": "^5.7.0", + "@ethersproject/abstract-provider": "^5.7.0", + "@ethersproject/abstract-signer": "^5.7.0", + "@ethersproject/address": "^5.7.0", + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/constants": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/transactions": "^5.7.0" + }, + "dependencies": { + "@ethersproject/abi": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/abi/-/abi-5.7.0.tgz", + "integrity": "sha512-351ktp42TiRcYB3H1OP8yajPeAQstMW/yCFokj/AthP9bLHzQFPlOrxOcwYEDkUAICmOHljvN4K39OMTMUa9RA==", + "requires": { + "@ethersproject/address": "^5.7.0", + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/constants": "^5.7.0", + "@ethersproject/hash": "^5.7.0", + "@ethersproject/keccak256": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/strings": "^5.7.0" + } + } } }, "@ethersproject/hash": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/@ethersproject/hash/-/hash-5.5.0.tgz", - "integrity": "sha512-dnGVpK1WtBjmnp3mUT0PlU2MpapnwWI0PibldQEq1408tQBAbZpPidkWoVVuNMOl/lISO3+4hXZWCL3YV7qzfg==", - "requires": { - "@ethersproject/abstract-signer": "^5.5.0", - "@ethersproject/address": "^5.5.0", - "@ethersproject/bignumber": "^5.5.0", - "@ethersproject/bytes": "^5.5.0", - "@ethersproject/keccak256": "^5.5.0", - "@ethersproject/logger": "^5.5.0", - "@ethersproject/properties": "^5.5.0", - "@ethersproject/strings": "^5.5.0" + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/hash/-/hash-5.7.0.tgz", + "integrity": "sha512-qX5WrQfnah1EFnO5zJv1v46a8HW0+E5xuBBDTwMFZLuVTx0tbU2kkx15NqdjxecrLGatQN9FGQKpb1FKdHCt+g==", + "requires": { + "@ethersproject/abstract-signer": "^5.7.0", + "@ethersproject/address": "^5.7.0", + "@ethersproject/base64": "^5.7.0", + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/keccak256": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/strings": "^5.7.0" + } + }, + "@ethersproject/hdnode": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/hdnode/-/hdnode-5.7.0.tgz", + "integrity": "sha512-OmyYo9EENBPPf4ERhR7oj6uAtUAhYGqOnIS+jE5pTXvdKBS99ikzq1E7Iv0ZQZ5V36Lqx1qZLeak0Ra16qpeOg==", + "requires": { + "@ethersproject/abstract-signer": "^5.7.0", + "@ethersproject/basex": "^5.7.0", + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/pbkdf2": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/sha2": "^5.7.0", + "@ethersproject/signing-key": "^5.7.0", + "@ethersproject/strings": "^5.7.0", + "@ethersproject/transactions": "^5.7.0", + "@ethersproject/wordlists": "^5.7.0" + } + }, + "@ethersproject/json-wallets": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/json-wallets/-/json-wallets-5.7.0.tgz", + "integrity": "sha512-8oee5Xgu6+RKgJTkvEMl2wDgSPSAQ9MB/3JYjFV9jlKvcYHUXZC+cQp0njgmxdHkYWn8s6/IqIZYm0YWCjO/0g==", + "requires": { + "@ethersproject/abstract-signer": "^5.7.0", + "@ethersproject/address": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/hdnode": "^5.7.0", + "@ethersproject/keccak256": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/pbkdf2": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/random": "^5.7.0", + "@ethersproject/strings": "^5.7.0", + "@ethersproject/transactions": "^5.7.0", + "aes-js": "3.0.0", + "scrypt-js": "3.0.1" } }, "@ethersproject/keccak256": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/@ethersproject/keccak256/-/keccak256-5.5.0.tgz", - "integrity": "sha512-5VoFCTjo2rYbBe1l2f4mccaRFN/4VQEYFwwn04aJV2h7qf4ZvI2wFxUE1XOX+snbwCLRzIeikOqtAoPwMza9kg==", + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/keccak256/-/keccak256-5.7.0.tgz", + "integrity": "sha512-2UcPboeL/iW+pSg6vZ6ydF8tCnv3Iu/8tUmLLzWWGzxWKFFqOBQFLo6uLUv6BDrLgCDfN28RJ/wtByx+jZ4KBg==", "requires": { - "@ethersproject/bytes": "^5.5.0", + "@ethersproject/bytes": "^5.7.0", "js-sha3": "0.8.0" } }, "@ethersproject/logger": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/@ethersproject/logger/-/logger-5.5.0.tgz", - "integrity": "sha512-rIY/6WPm7T8n3qS2vuHTUBPdXHl+rGxWxW5okDfo9J4Z0+gRRZT0msvUdIJkE4/HS29GUMziwGaaKO2bWONBrg==" + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/logger/-/logger-5.7.0.tgz", + "integrity": "sha512-0odtFdXu/XHtjQXJYA3u9G0G8btm0ND5Cu8M7i5vhEcE8/HmF4Lbdqanwyv4uQTr2tx6b7fQRmgLrsnpQlmnig==" }, "@ethersproject/networks": { - "version": "5.5.1", - "resolved": "https://registry.npmjs.org/@ethersproject/networks/-/networks-5.5.1.tgz", - "integrity": "sha512-tYRDM4zZtSUcKnD4UMuAlj7SeXH/k5WC4SP2u1Pn57++JdXHkRu2zwNkgNogZoxHzhm9Q6qqurDBVptHOsW49Q==", + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/networks/-/networks-5.7.0.tgz", + "integrity": "sha512-MG6oHSQHd4ebvJrleEQQ4HhVu8Ichr0RDYEfHzsVAVjHNM+w36x9wp9r+hf1JstMXtseXDtkiVoARAG6M959AA==", "requires": { - "@ethersproject/logger": "^5.5.0" + "@ethersproject/logger": "^5.7.0" + } + }, + "@ethersproject/pbkdf2": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/pbkdf2/-/pbkdf2-5.7.0.tgz", + "integrity": "sha512-oR/dBRZR6GTyaofd86DehG72hY6NpAjhabkhxgr3X2FpJtJuodEl2auADWBZfhDHgVCbu3/H/Ocq2uC6dpNjjw==", + "requires": { + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/sha2": "^5.7.0" } }, "@ethersproject/properties": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/@ethersproject/properties/-/properties-5.5.0.tgz", - "integrity": "sha512-l3zRQg3JkD8EL3CPjNK5g7kMx4qSwiR60/uk5IVjd3oq1MZR5qUg40CNOoEJoX5wc3DyY5bt9EbMk86C7x0DNA==", + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/properties/-/properties-5.7.0.tgz", + "integrity": "sha512-J87jy8suntrAkIZtecpxEPxY//szqr1mlBaYlQ0r4RCaiD2hjheqF9s1LVE8vVuJCXisjIP+JgtK/Do54ej4Sw==", + "requires": { + "@ethersproject/logger": "^5.7.0" + } + }, + "@ethersproject/providers": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/providers/-/providers-5.7.0.tgz", + "integrity": "sha512-+TTrrINMzZ0aXtlwO/95uhAggKm4USLm1PbeCBR/3XZ7+Oey+3pMyddzZEyRhizHpy1HXV0FRWRMI1O3EGYibA==", + "requires": { + "@ethersproject/abstract-provider": "^5.7.0", + "@ethersproject/abstract-signer": "^5.7.0", + "@ethersproject/address": "^5.7.0", + "@ethersproject/base64": "^5.7.0", + "@ethersproject/basex": "^5.7.0", + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/constants": "^5.7.0", + "@ethersproject/hash": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/networks": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/random": "^5.7.0", + "@ethersproject/rlp": "^5.7.0", + "@ethersproject/sha2": "^5.7.0", + "@ethersproject/strings": "^5.7.0", + "@ethersproject/transactions": "^5.7.0", + "@ethersproject/web": "^5.7.0", + "bech32": "1.1.4", + "ws": "7.4.6" + }, + "dependencies": { + "ws": { + "version": "7.4.6", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.4.6.tgz", + "integrity": "sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A==", + "requires": {} + } + } + }, + "@ethersproject/random": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/random/-/random-5.7.0.tgz", + "integrity": "sha512-19WjScqRA8IIeWclFme75VMXSBvi4e6InrUNuaR4s5pTF2qNhcGdCUwdxUVGtDDqC00sDLCO93jPQoDUH4HVmQ==", "requires": { - "@ethersproject/logger": "^5.5.0" + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/logger": "^5.7.0" } }, "@ethersproject/rlp": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/@ethersproject/rlp/-/rlp-5.5.0.tgz", - "integrity": "sha512-hLv8XaQ8PTI9g2RHoQGf/WSxBfTB/NudRacbzdxmst5VHAqd1sMibWG7SENzT5Dj3yZ3kJYx+WiRYEcQTAkcYA==", + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/rlp/-/rlp-5.7.0.tgz", + "integrity": "sha512-rBxzX2vK8mVF7b0Tol44t5Tb8gomOHkj5guL+HhzQ1yBh/ydjGnpw6at+X6Iw0Kp3OzzzkcKp8N9r0W4kYSs9w==", "requires": { - "@ethersproject/bytes": "^5.5.0", - "@ethersproject/logger": "^5.5.0" + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/logger": "^5.7.0" + } + }, + "@ethersproject/sha2": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/sha2/-/sha2-5.7.0.tgz", + "integrity": "sha512-gKlH42riwb3KYp0reLsFTokByAKoJdgFCwI+CCiX/k+Jm2mbNs6oOaCjYQSlI1+XBVejwH2KrmCbMAT/GnRDQw==", + "requires": { + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "hash.js": "1.1.7" } }, "@ethersproject/signing-key": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/@ethersproject/signing-key/-/signing-key-5.5.0.tgz", - "integrity": "sha512-5VmseH7qjtNmDdZBswavhotYbWB0bOwKIlOTSlX14rKn5c11QmJwGt4GHeo7NrL/Ycl7uo9AHvEqs5xZgFBTng==", + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/signing-key/-/signing-key-5.7.0.tgz", + "integrity": "sha512-MZdy2nL3wO0u7gkB4nA/pEf8lu1TlFswPNmy8AiYkfKTdO6eXBJyUdmHO/ehm/htHw9K/qF8ujnTyUAD+Ry54Q==", "requires": { - "@ethersproject/bytes": "^5.5.0", - "@ethersproject/logger": "^5.5.0", - "@ethersproject/properties": "^5.5.0", - "bn.js": "^4.11.9", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "bn.js": "^5.2.1", "elliptic": "6.5.4", "hash.js": "1.1.7" + }, + "dependencies": { + "bn.js": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz", + "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==" + } + } + }, + "@ethersproject/solidity": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/solidity/-/solidity-5.7.0.tgz", + "integrity": "sha512-HmabMd2Dt/raavyaGukF4XxizWKhKQ24DoLtdNbBmNKUOPqwjsKQSdV9GQtj9CBEea9DlzETlVER1gYeXXBGaA==", + "requires": { + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/keccak256": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/sha2": "^5.7.0", + "@ethersproject/strings": "^5.7.0" } }, "@ethersproject/strings": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/@ethersproject/strings/-/strings-5.5.0.tgz", - "integrity": "sha512-9fy3TtF5LrX/wTrBaT8FGE6TDJyVjOvXynXJz5MT5azq+E6D92zuKNx7i29sWW2FjVOaWjAsiZ1ZWznuduTIIQ==", + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/strings/-/strings-5.7.0.tgz", + "integrity": "sha512-/9nu+lj0YswRNSH0NXYqrh8775XNyEdUQAuf3f+SmOrnVewcJ5SBNAjF7lpgehKi4abvNNXyf+HX86czCdJ8Mg==", "requires": { - "@ethersproject/bytes": "^5.5.0", - "@ethersproject/constants": "^5.5.0", - "@ethersproject/logger": "^5.5.0" + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/constants": "^5.7.0", + "@ethersproject/logger": "^5.7.0" } }, "@ethersproject/transactions": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/@ethersproject/transactions/-/transactions-5.5.0.tgz", - "integrity": "sha512-9RZYSKX26KfzEd/1eqvv8pLauCKzDTub0Ko4LfIgaERvRuwyaNV78mJs7cpIgZaDl6RJui4o49lHwwCM0526zA==", - "requires": { - "@ethersproject/address": "^5.5.0", - "@ethersproject/bignumber": "^5.5.0", - "@ethersproject/bytes": "^5.5.0", - "@ethersproject/constants": "^5.5.0", - "@ethersproject/keccak256": "^5.5.0", - "@ethersproject/logger": "^5.5.0", - "@ethersproject/properties": "^5.5.0", - "@ethersproject/rlp": "^5.5.0", - "@ethersproject/signing-key": "^5.5.0" + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/transactions/-/transactions-5.7.0.tgz", + "integrity": "sha512-kmcNicCp1lp8qanMTC3RIikGgoJ80ztTyvtsFvCYpSCfkjhD0jZ2LOrnbcuxuToLIUYYf+4XwD1rP+B/erDIhQ==", + "requires": { + "@ethersproject/address": "^5.7.0", + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/constants": "^5.7.0", + "@ethersproject/keccak256": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/rlp": "^5.7.0", + "@ethersproject/signing-key": "^5.7.0" + } + }, + "@ethersproject/units": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/units/-/units-5.7.0.tgz", + "integrity": "sha512-pD3xLMy3SJu9kG5xDGI7+xhTEmGXlEqXU4OfNapmfnxLVY4EMSSRp7j1k7eezutBPH7RBN/7QPnwR7hzNlEFeg==", + "requires": { + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/constants": "^5.7.0", + "@ethersproject/logger": "^5.7.0" + } + }, + "@ethersproject/wallet": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/wallet/-/wallet-5.7.0.tgz", + "integrity": "sha512-MhmXlJXEJFBFVKrDLB4ZdDzxcBxQ3rLyCkhNqVu3CDYvR97E+8r01UgrI+TI99Le+aYm/in/0vp86guJuM7FCA==", + "requires": { + "@ethersproject/abstract-provider": "^5.7.0", + "@ethersproject/abstract-signer": "^5.7.0", + "@ethersproject/address": "^5.7.0", + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/hash": "^5.7.0", + "@ethersproject/hdnode": "^5.7.0", + "@ethersproject/json-wallets": "^5.7.0", + "@ethersproject/keccak256": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/random": "^5.7.0", + "@ethersproject/signing-key": "^5.7.0", + "@ethersproject/transactions": "^5.7.0", + "@ethersproject/wordlists": "^5.7.0" } }, "@ethersproject/web": { - "version": "5.5.1", - "resolved": "https://registry.npmjs.org/@ethersproject/web/-/web-5.5.1.tgz", - "integrity": "sha512-olvLvc1CB12sREc1ROPSHTdFCdvMh0J5GSJYiQg2D0hdD4QmJDy8QYDb1CvoqD/bF1c++aeKv2sR5uduuG9dQg==", + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/web/-/web-5.7.0.tgz", + "integrity": "sha512-ApHcbbj+muRASVDSCl/tgxaH2LBkRMEYfLOLVa0COipx0+nlu0QKet7U2lEg0vdkh8XRSLf2nd1f1Uk9SrVSGA==", + "requires": { + "@ethersproject/base64": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/strings": "^5.7.0" + } + }, + "@ethersproject/wordlists": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/wordlists/-/wordlists-5.7.0.tgz", + "integrity": "sha512-S2TFNJNfHWVHNE6cNDjbVlZ6MgE17MIxMbMg2zv3wn+3XSJGosL1m9ZVv3GXCf/2ymSsQ+hRI5IzoMJTG6aoVA==", "requires": { - "@ethersproject/base64": "^5.5.0", - "@ethersproject/bytes": "^5.5.0", - "@ethersproject/logger": "^5.5.0", - "@ethersproject/properties": "^5.5.0", - "@ethersproject/strings": "^5.5.0" + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/hash": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/strings": "^5.7.0" } }, "@humanwhocodes/config-array": { @@ -9266,6 +9892,11 @@ "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==" }, + "aes-js": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/aes-js/-/aes-js-3.0.0.tgz", + "integrity": "sha512-H7wUZRn8WpTq9jocdxQ2c8x2sKo9ZVmzfRE13GiNJXfp7NcKYEdvl3vspKjXox6RIG2VtaRe4JFvxG4rqp2Zuw==" + }, "aggregate-error": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.1.0.tgz", @@ -9454,6 +10085,11 @@ } } }, + "bech32": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/bech32/-/bech32-1.1.4.tgz", + "integrity": "sha512-s0IrSOzLlbvX7yp4WBfPITzpAU8sqQcpsmwXDiKwrG4r491vwCO/XpejasRNl0piBMe/DvP4Tz0mIS/X1DPJBQ==" + }, "bignumber.js": { "version": "9.0.2", "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.0.2.tgz", @@ -10699,6 +11335,61 @@ } } }, + "ethers": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/ethers/-/ethers-5.7.0.tgz", + "integrity": "sha512-5Xhzp2ZQRi0Em+0OkOcRHxPzCfoBfgtOQA+RUylSkuHbhTEaQklnYi2hsWbRgs3ztJsXVXd9VKBcO1ScWL8YfA==", + "requires": { + "@ethersproject/abi": "5.7.0", + "@ethersproject/abstract-provider": "5.7.0", + "@ethersproject/abstract-signer": "5.7.0", + "@ethersproject/address": "5.7.0", + "@ethersproject/base64": "5.7.0", + "@ethersproject/basex": "5.7.0", + "@ethersproject/bignumber": "5.7.0", + "@ethersproject/bytes": "5.7.0", + "@ethersproject/constants": "5.7.0", + "@ethersproject/contracts": "5.7.0", + "@ethersproject/hash": "5.7.0", + "@ethersproject/hdnode": "5.7.0", + "@ethersproject/json-wallets": "5.7.0", + "@ethersproject/keccak256": "5.7.0", + "@ethersproject/logger": "5.7.0", + "@ethersproject/networks": "5.7.0", + "@ethersproject/pbkdf2": "5.7.0", + "@ethersproject/properties": "5.7.0", + "@ethersproject/providers": "5.7.0", + "@ethersproject/random": "5.7.0", + "@ethersproject/rlp": "5.7.0", + "@ethersproject/sha2": "5.7.0", + "@ethersproject/signing-key": "5.7.0", + "@ethersproject/solidity": "5.7.0", + "@ethersproject/strings": "5.7.0", + "@ethersproject/transactions": "5.7.0", + "@ethersproject/units": "5.7.0", + "@ethersproject/wallet": "5.7.0", + "@ethersproject/web": "5.7.0", + "@ethersproject/wordlists": "5.7.0" + }, + "dependencies": { + "@ethersproject/abi": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/abi/-/abi-5.7.0.tgz", + "integrity": "sha512-351ktp42TiRcYB3H1OP8yajPeAQstMW/yCFokj/AthP9bLHzQFPlOrxOcwYEDkUAICmOHljvN4K39OMTMUa9RA==", + "requires": { + "@ethersproject/address": "^5.7.0", + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/constants": "^5.7.0", + "@ethersproject/hash": "^5.7.0", + "@ethersproject/keccak256": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/strings": "^5.7.0" + } + } + } + }, "ethjs-unit": { "version": "0.1.6", "resolved": "https://registry.npmjs.org/ethjs-unit/-/ethjs-unit-0.1.6.tgz", @@ -10897,18 +11588,6 @@ "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=" }, - "fs-extra": { - "version": "0.30.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-0.30.0.tgz", - "integrity": "sha1-8jP/zAjU2n1DLapEl3aYnbHfk/A=", - "requires": { - "graceful-fs": "^4.1.2", - "jsonfile": "^2.1.0", - "klaw": "^1.0.0", - "path-is-absolute": "^1.0.0", - "rimraf": "^2.2.8" - } - }, "fs-minipass": { "version": "1.2.7", "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-1.2.7.tgz", @@ -11639,14 +12318,6 @@ "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.0.0.tgz", "integrity": "sha512-fQzRfAbIBnR0IQvftw9FJveWiHp72Fg20giDrHz6TdfB12UH/uue0D3hm57UB5KgAVuniLMCaS8P1IMj9NR7cA==" }, - "jsonfile": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-2.4.0.tgz", - "integrity": "sha1-NzaitCi4e72gzIO1P6PWM6NcKug=", - "requires": { - "graceful-fs": "^4.1.6" - } - }, "jsprim": { "version": "1.4.2", "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.2.tgz", @@ -11676,14 +12347,6 @@ "json-buffer": "3.0.0" } }, - "klaw": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/klaw/-/klaw-1.3.1.tgz", - "integrity": "sha1-QIhDO0azsbolnXh4XY6W9zugJDk=", - "requires": { - "graceful-fs": "^4.1.9" - } - }, "levn": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", @@ -12905,17 +13568,15 @@ } }, "solc": { - "version": "0.8.11", - "resolved": "https://registry.npmjs.org/solc/-/solc-0.8.11.tgz", - "integrity": "sha512-CdK4pk6VZowmXv7l4lftbr/QUWsHEr+xcdcGHJVgynD08gRwFT4zAFCb3b/eR0FUVVszcHulpGJwEoKRKKrnKw==", + "version": "0.8.16", + "resolved": "https://registry.npmjs.org/solc/-/solc-0.8.16.tgz", + "integrity": "sha512-6oZg7FAhIouj2zYLvoR3Q4fMP/+BGPR7sY7GcrEXKIp+DRd8RmpDEFO1LUBKpClUiaYguNgmthTFmnPl4MeiMQ==", "requires": { "command-exists": "^1.2.8", "commander": "^8.1.0", "follow-redirects": "^1.12.1", - "fs-extra": "^0.30.0", "js-sha3": "0.8.0", "memorystream": "^0.3.1", - "require-from-string": "^2.0.0", "semver": "^5.5.0", "tmp": "0.0.33" } diff --git a/package.json b/package.json index 49caf87..180c04d 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,7 @@ "@polkadot/util-crypto": "^9.5.1", "chalk": "^4.1.2", "esbuild": "^0.13.8", + "ethers": "^5.7.0", "lodash.isobject": "^3.0.2", "lodash.mergewith": "^4.6.2", "moonbeam-types-bundle": "^2.0.7", @@ -20,7 +21,7 @@ "prettier": "^2.7.1", "rollup-plugin-esbuild": "^4.6.0", "rollup-plugin-preserve-shebangs": "^0.2.0", - "solc": "^0.8.10", + "solc": "^0.8.16", "sqlite": "^4.0.25", "sqlite3": "^5.0.2", "table": "^6.8.0", diff --git a/src/tools/fees.ts b/src/tools/fees.ts new file mode 100644 index 0000000..5dd3625 --- /dev/null +++ b/src/tools/fees.ts @@ -0,0 +1,816 @@ +import assert from "node:assert/strict"; +import { exec as execProcess } from "child_process"; +import util from "node:util"; +import fs from "fs"; +import { setTimeout } from "timers/promises"; + +import { EvmCoreErrorExitReason } from "@polkadot/types/lookup"; +import solc from "solc"; +import "@polkadot/api-augment"; +import "@moonbeam-network/api-augment"; +import { ApiTypes, SubmittableExtrinsic } from "@polkadot/api/types"; +import { SubmittableExtrinsic as SubmittableExtrinsicPromise } from "@polkadot/api/promise/types"; +import { DispatchError, EventRecord } from "@polkadot/types/interfaces"; +import Keyring from "@polkadot/keyring"; +import { ApiPromise, WsProvider } from "@polkadot/api"; +import { u8aToHex, BN, BN_BILLION, BN_MILLION } from "@polkadot/util"; +import { JsonRpcResponse } from "web3-core-helpers"; +import { ethers } from "ethers"; +import { Contract } from "web3-eth-contract"; +import Web3 from "web3"; +import * as RLP from "rlp"; +import yargs from "yargs"; +import { AccessListish } from "ethers/lib/utils"; +import { + ALITH_ADDRESS, + ALITH_PRIVATE_KEY, + BALTATHAR_ADDRESS, + BALTATHAR_PRIVATE_KEY, + CHARLETH_ADDRESS, + CHARLETH_PRIVATE_KEY, +} from "../utils/constants"; + +const httpUrl = "http://127.0.0.1:9933"; +const wssUrl = "ws://127.0.0.1:9944"; + +const exec = util.promisify(execProcess); +const ethersApi = new ethers.providers.JsonRpcProvider(httpUrl); +const keyringEth = new Keyring({ type: "ethereum" }); +export const alith = keyringEth.addFromUri(ALITH_PRIVATE_KEY); +export const baltathar = keyringEth.addFromUri(BALTATHAR_PRIVATE_KEY); +export const charleth = keyringEth.addFromUri(CHARLETH_PRIVATE_KEY); +const web3 = new Web3(wssUrl); +web3.eth.accounts.wallet.add(ALITH_PRIVATE_KEY); + +/** + * This test assumes the following: + * + moonbeam + * - EVM calls are unfiltered. + * NormalFilter - Call::EVM(_) => true + * - EVM origin is allowed for all. + * type CallOrigin = EnsureAddressAlways; + * impl EnsureAddressOrigin for EnsureAddressAlways { + * type Success = (); + * + * fn try_address_origin( + * _address: &H160, + * _origin: OuterOrigin, + * ) -> Result { + * Ok(()) + * } + * + * fn ensure_address_origin( + * _address: &H160, + * _origin: OuterOrigin, + * ) -> Result { + * Ok(()) + * } + * } + * + frontier + * - Baltathar pays no EVM fees and full substrate fees, while Charleth pays the opposite. + * let baltathar_addr = H160::from_str("0x3cd0a705a2dc65e5b1e1205896baa2be8a07c6e0").unwrap(); + * let (validate, payable) = if source == baltathar_addr { + * (false, Pays::Yes) + * } else { + * (true, Pays::No) + * }; + * + * Then start the node with the following command + * ./target/release/moonbeam \ + * --execution=Native \ + * --wasm-execution=interpreted-i-know-what-i-do \ + * --ethapi=txpool \ + * --no-hardware-benchmarks \ + * --no-telemetry \ + * --no-prometheus \ + * --force-authoring \ + * --rpc-cors=all \ + * --alice \ + * --chain=moonbase-dev \ + * --sealing=manual \ + * --in-peers=0 \ + * --out-peers=0 -linfo \ + * --port=5502 \ + * --rpc-port=25502 \ + * --ws-port=45502 \ + * --tmp + */ + +/// === test methods === /// + +const TESTER_CONTRACT = `// SPDX-License-Identifier: GPL-3.0-only + pragma solidity >=0.8.3; + + contract Tester { + + uint256 public count; + + function infinite() public pure { + while (true) {} + } + + function incrementalLoop(uint256 n) public { + uint256 i = 0; + while (i < n) { + count = count + 1; + i += 1; + } + } + + function bigData(bytes memory b) public { + // do nothing + } + }`; +const TESTER_JSON = compileSolidity(TESTER_CONTRACT); +const TESTER_INTERFACE = new ethers.utils.Interface(TESTER_JSON.contract.abi); + +async function runTest(api: ApiPromise, callType: "compute" | "length-small" | "length-big") { + const result = []; + console.log("callType", callType); + let contractAddr = "0xc01Ee7f10EA4aF4673cFff62710E1D7792aBa8f3"; + + // override nextFeeMultiplier if needed, note that its value will change immediately after block creation + const nextFeeMultiplierOverride = null; + if (nextFeeMultiplierOverride) { + await createBlock(api, [ + await api.tx.balances.transfer(contractAddr, 0).signAsync(alith), + await api.tx.sudo + .sudo( + await api.tx.system + .setStorage([ + [ + "0x3f1467a096bcd71a5b6a0c8155e208103f2edf3bdf381debe331ab7446addfdc", + u8aToHex(api.createType("u128", nextFeeMultiplierOverride).toU8a()), + ], + ]) + .signAsync(alith) + ) + .signAsync(alith), + ]); + } else { + const nextFeeMultiplier = await api.query.transactionPayment.nextFeeMultiplier(); + assert.equal( + nextFeeMultiplier.toString(), + "1000000000000000000", + "nextFeeMultiplier is not at its base value" + ); + console.log("nextFeeMul", nextFeeMultiplier.toString()); + } + + // deploy contract + const maxBlockWeight = api.consts.system.blockWeights.maxBlock.toBn(); + const blockNumber = (await api.rpc.chain.getBlock()).block.header.number.toNumber(); + if (blockNumber === 0) { + const { contract, rawTx } = await createContract(TESTER_JSON, { + ...ALITH_TRANSACTION_TEMPLATE, + gas: 900_000, + gasPrice: 1_250_000_000, + }); + assert.equal(await createBlock(api, rawTx), true, "failure during block creation"); + await expectEVMSuccess(api); + console.log("addr", contract.options.address); + contractAddr = contract.options.address; + } + + // use the specified call type + const contractCall = (() => { + switch (callType) { + case "compute": + return TESTER_INTERFACE.encodeFunctionData("incrementalLoop", [1000]); + case "length-small": + return TESTER_INTERFACE.encodeFunctionData("bigData", [new Array(100).fill(0x01)]); + case "length-big": + return TESTER_INTERFACE.encodeFunctionData("bigData", [new Array(50 * 1024).fill(0x01)]); + default: + throw new Error(`invalid callType ${callType}`); + } + })(); + + // start load test + const loadFactors = [...generateLoad(60, 2), ...Array(10).fill(0)]; + const repsPerLoad = 30; + for await (const loadFactor of loadFactors) { + console.log(`load: ${loadFactor} (${repsPerLoad} reps)`); + for await (const rep of new Array(repsPerLoad).keys()) { + const multiplierBefore = await api.query.transactionPayment.nextFeeMultiplier(); + const fees = await txObserveFeeDiff(api, async () => { + const txs = [ + // fill block + await api.tx.sudo + .sudo(await api.tx.system.fillBlock(loadFactor * 10_000_000).signAsync(alith)) + .signAsync(alith), + + // charge substrate fees + await api.tx.evm + .call(baltathar.address, contractAddr, contractCall, 0, 900_000n, 0n, null, null, []) + .signAsync(baltathar), + + // charge EVM fees + await api.tx.evm + .call( + charleth.address, + contractAddr, + contractCall, + 0, + 900_000n, + 2_000_000_000n, + null, + null, + [] + ) + .signAsync(charleth), + ]; + + return txs; + }); + + // compute block weight, from events + const events = await api.query.system.events(); + let totalBlockWeight = new BN(0); + for (const event of events) { + if (api.events.system.ExtrinsicSuccess.is(event.event)) { + totalBlockWeight = totalBlockWeight.add(event.event.data.dispatchInfo.weight.toBn()); + } + } + const multiplierAfter = await api.query.transactionPayment.nextFeeMultiplier(); + + result.push({ + fullPercent: totalBlockWeight.muln(100).div(maxBlockWeight).toNumber(), + ...fees, + multiplier: { + before: multiplierBefore.toString(), + after: multiplierAfter.toString(), + }, + block: (await api.rpc.chain.getBlock()).block.header.number.toNumber(), + }); + } + } + + return result; +} + +function generateLoad(middle: number, inc: number = 1): number[] { + const load = []; + for (let i = 0; i <= middle; i += inc) { + load.push(i); + } + for (let i = middle; i >= 0; i -= inc) { + load.push(i); + } + + return load; +} + +async function txObserveFeeDiff( + api: ApiPromise, + txFunc: () => Promise +) { + const txs = await txFunc(); + const balanceBeforeBaltathar = await api.query.system.account(BALTATHAR_ADDRESS); + const balanceBeforeCharleth = await api.query.system.account(CHARLETH_ADDRESS); + await createBlock(api, txs); + const balanceAfterBaltathar = await api.query.system.account(BALTATHAR_ADDRESS); + const balanceAfterCharleth = await api.query.system.account(CHARLETH_ADDRESS); + + return { + substrate: balanceBeforeBaltathar.data.free.sub(balanceAfterBaltathar.data.free).toString(), + evm: balanceBeforeCharleth.data.free.sub(balanceAfterCharleth.data.free).toString(), + }; +} + +/// === block creation methods === /// + +async function expectEVMSuccess(api: ApiPromise) { + const events = await api.query.system.events(); + const ethereumResult = events.find( + ({ event: { section, method } }) => section == "ethereum" && method == "Executed" + ).event.data[3] as EvmCoreErrorExitReason; + assert.equal(ethereumResult.isSucceed, true, "EVM operation failed"); +} + +function extractError(events: EventRecord[] = []): DispatchError | undefined { + return events + .filter(({ event }) => "system" === event.section && ["ExtrinsicFailed"].includes(event.method)) + .map( + ({ + event: { + data: [dispatchError], + }, + }) => dispatchError as DispatchError + )[0]; +} + +async function customWeb3Request(web3: Web3, method: string, params: any[]) { + return new Promise((resolve, reject) => { + (web3.currentProvider as any).send( + { + jsonrpc: "2.0", + id: 1, + method, + params, + }, + (error: Error | null, result?: JsonRpcResponse) => { + if (error) { + reject( + `Failed to send custom request (${method} (${params + .map((p) => { + const str = p.toString(); + return str.length > 128 ? `${str.slice(0, 96)}...${str.slice(-28)}` : str; + }) + .join(",")})): ${error.message || error.toString()}` + ); + } + resolve(result); + } + ); + }); +} + +interface BlockCreation { + parentHash?: string; + finalize?: boolean; +} +type ExtrinsicCreation = boolean; +async function createBlock< + ApiType extends ApiTypes, + Call extends + | SubmittableExtrinsic + | Promise> + | string + | Promise, + Calls extends Call | Call[] +>(api: ApiPromise, transactions?: Calls, options: BlockCreation = {}) { + const results: ({ type: "eth"; hash: string } | { type: "sub"; hash: string })[] = []; + const txs = + transactions == undefined ? [] : Array.isArray(transactions) ? transactions : [transactions]; + for await (const call of txs) { + if (typeof call == "string") { + // Ethereum + results.push({ + type: "eth", + hash: (await customWeb3Request(web3, "eth_sendRawTransaction", [call])).result, + }); + } else if (call.isSigned) { + results.push({ + type: "sub", + hash: (await call.send()).toString(), + }); + } else { + results.push({ + type: "sub", + hash: (await call.signAndSend(alith)).toString(), + }); + } + } + + const { parentHash, finalize } = options; + const block = parentHash + ? await api.rpc.engine.createBlock(true, finalize, parentHash) + : await api.rpc.engine.createBlock(true, finalize); + const blockHash = block.get("hash").toString(); + + // No need to extract events if no transactions + if (results.length == 0) { + return { + block, + result: null, + }; + } + + // We retrieve the events for that block + const allRecords: EventRecord[] = (await (await api.at(blockHash)).query.system.events()) as any; + // We retrieve the block (including the extrinsics) + const blockData = await api.rpc.chain.getBlock(blockHash); + + const result: ExtrinsicCreation[] = results.map((result) => { + const extrinsicIndex = + result.type == "eth" + ? allRecords + .find( + ({ phase, event: { section, method, data } }) => + phase.isApplyExtrinsic && + section == "ethereum" && + method == "Executed" && + data[2].toString() == result.hash + ) + ?.phase?.asApplyExtrinsic?.toNumber() + : blockData.block.extrinsics.findIndex((ext) => ext.hash.toHex() == result.hash); + // We retrieve the events associated with the extrinsic + const events = allRecords.filter( + ({ phase }) => phase.isApplyExtrinsic && phase.asApplyExtrinsic.toNumber() === extrinsicIndex + ); + const failure = extractError(events); + const successful = extrinsicIndex !== undefined && !failure; + return successful; + }); + + // Adds extra time to avoid empty transaction when querying it + if (results.find((r) => r.type == "eth")) { + await setTimeout(2); + } + + return Array.isArray(transactions) ? result : (result[0] as boolean); +} + +const ALITH_TRANSACTION_TEMPLATE: TransactionOptions = { + from: alith.address, + privateKey: ALITH_PRIVATE_KEY, + nonce: null, + gas: 500_000, + gasPrice: 1_000_000_000, + value: "0x00", +}; +interface TransactionOptions { + from?: string; + to?: string; + privateKey?: string; + nonce?: number; + gas?: string | number; + gasPrice?: string | number; + maxFeePerGas?: string | number; + maxPriorityFeePerGas?: string | number; + value?: string | number; + data?: string; + accessList?: AccessListish; // AccessList | Array<[string, Array]> +} +async function createTransaction( + options: TransactionOptions, + ethTransactionType = "Legacy" +): Promise { + const isLegacy = ethTransactionType === "Legacy"; + const isEip2930 = ethTransactionType === "EIP2930"; + const isEip1559 = ethTransactionType === "EIP1559"; + + const gasPrice = options.gasPrice !== undefined ? options.gasPrice : 1_000_000_000; + const maxPriorityFeePerGas = + options.maxPriorityFeePerGas !== undefined ? options.maxPriorityFeePerGas : 0; + const value = options.value !== undefined ? options.value : "0x00"; + const from = options.from || alith.address; + const privateKey = options.privateKey !== undefined ? options.privateKey : ALITH_PRIVATE_KEY; + + // Instead of hardcoding the gas limit, we estimate the gas + const gas = + options.gas || + (await web3.eth.estimateGas({ + from: from, + to: options.to, + data: options.data, + })); + + const maxFeePerGas = options.maxFeePerGas || 1_000_000_000; + const accessList = options.accessList || []; + const nonce = + options.nonce != null ? options.nonce : await web3.eth.getTransactionCount(from, "pending"); + + let data, rawTransaction; + if (isLegacy) { + data = { + from, + to: options.to, + value: value && value.toString(), + gasPrice, + gas, + nonce: nonce, + data: options.data, + }; + const tx = await web3.eth.accounts.signTransaction(data, privateKey); + rawTransaction = tx.rawTransaction; + } else { + const signer = new ethers.Wallet(privateKey, ethersApi); + const chainId = await web3.eth.getChainId(); + if (isEip2930) { + data = { + from, + to: options.to, + value: value && value.toString(), + gasPrice, + gasLimit: gas, + nonce: nonce, + data: options.data, + accessList, + chainId, + type: 1, + }; + } else if (isEip1559) { + data = { + from, + to: options.to, + value: value && value.toString(), + maxFeePerGas, + maxPriorityFeePerGas, + gasLimit: gas, + nonce: nonce, + data: options.data, + accessList, + chainId, + type: 2, + }; + } + rawTransaction = await signer.signTransaction(data); + } + + return rawTransaction; +} + +async function createContract( + contractCompiled: Compiled, + options: TransactionOptions = ALITH_TRANSACTION_TEMPLATE, + contractArguments: any[] = [] +): Promise<{ rawTx: string; contract: Contract; contractAddress: string }> { + const from = options.from !== undefined ? options.from : alith.address; + const nonce = options.nonce || (await web3.eth.getTransactionCount(from)); + + const contractAddress = + "0x" + + web3.utils + .sha3(RLP.encode([from, nonce]) as any) + .slice(12) + .substring(14); + + const contract = new web3.eth.Contract(contractCompiled.contract.abi, contractAddress); + const data = contract + .deploy({ + data: contractCompiled.byteCode, + arguments: contractArguments, + }) + .encodeABI(); + + const rawTx = await createTransaction({ ...options, from, nonce, data }); + + return { + rawTx, + contract, + contractAddress, + }; +} + +/// === solidity compile methods === /// + +export interface Compiled { + byteCode: string; + contract: any; + sourceCode: string; +} +function compileSolidity(fileContents: string): Compiled { + // const fileContents = fs.readFileSync(filepath).toString(); + const result = JSON.parse( + solc.compile( + JSON.stringify({ + language: "Solidity", + sources: { + "main.sol": { + content: fileContents, + }, + }, + settings: { + outputSelection: { + "*": { + "*": ["*"], + }, + }, + }, + }), + { + import: (_: string) => { + return { error: "imports not supported" }; + }, + } + ) + ); + if (!result.contracts) { + throw result; + } + const allContractNames = Object.keys(result.contracts["main.sol"]); + const reduced = allContractNames.reduce((p, contractName) => { + p[contractName] = { + byteCode: "0x" + result.contracts["main.sol"][contractName].evm.bytecode.object, + contract: result.contracts["main.sol"][contractName], + sourceCode: fileContents, + }; + return p; + }, {}); + return reduced[allContractNames[0]]; +} + +/// === main === /// + +async function view(input: string, output: string, open: boolean) { + const data = JSON.parse(fs.readFileSync(input).toString("utf-8")); + const labels = data.map((x: any, i: number) => i); + const fullPercent = data.map((x: any) => x["fullPercent"]); + const substrateFees = data.map((x: any) => new BN(x["substrate"]).toNumber()); + const evmFees = data.map((x: any) => new BN(x["evm"]).toNumber()); + + // editorconfig-checker-disable + fs.writeFileSync( + output, + ` + + + + + +
+ +
+
+ +
+
+ +
+ + + ` + ); + // editorconfig-checker-enable + + const openCmd = (() => { + switch (process.platform) { + case "darwin": + return "open"; + case "win32": + return "start"; + default: + return "xdg-open"; + } + })(); + + if (open) { + await exec(`${openCmd} ${output}`); + } +} + +const argv = yargs(process.argv.slice(2)) + .usage("Usage: $0") + .version("1.0.0") + .options({ + name: { + type: "string", + description: "The output file name", + demandOption: true, + }, + view: { + type: "boolean", + description: "View existing file", + }, + type: { + type: "string", + description: "View existing file", + choices: ["compute", "length-small", "length-big"], + demandOption: false, + default: "compute", + }, + }).argv; + +async function main() { + const name = `${argv.name}-${argv.type}`; + if (argv.view) { + await view(`${name}.json`, `${name}.html`, true); + return; + } + + const api = await ApiPromise.create({ + initWasm: false, + provider: new WsProvider(wssUrl), + }); + + try { + const results = await runTest(api, argv.type as any); + fs.writeFileSync(`${name}.json`, JSON.stringify(results, null, 2)); + await view(`${name}.json`, `${name}.html`, true); + } finally { + await api.disconnect(); + } +} + +main() + .catch((err) => console.error("ERR!", err)) + .finally(() => process.exit(0)); From 891a1952246dcd4e26792f2c69a63122eab5cdc3 Mon Sep 17 00:00:00 2001 From: Nisheeth Barthwal Date: Fri, 2 Sep 2022 13:25:25 +0200 Subject: [PATCH 2/7] docs --- src/tools/fees.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/tools/fees.ts b/src/tools/fees.ts index 5dd3625..8e78139 100644 --- a/src/tools/fees.ts +++ b/src/tools/fees.ts @@ -22,7 +22,6 @@ import * as RLP from "rlp"; import yargs from "yargs"; import { AccessListish } from "ethers/lib/utils"; import { - ALITH_ADDRESS, ALITH_PRIVATE_KEY, BALTATHAR_ADDRESS, BALTATHAR_PRIVATE_KEY, @@ -94,6 +93,13 @@ web3.eth.accounts.wallet.add(ALITH_PRIVATE_KEY); * --rpc-port=25502 \ * --ws-port=45502 \ * --tmp + * + * Examples: + * ts-node ./src/tools/fees.ts --name fees --type compute + * ts-node ./src/tools/fees.ts --name fees --type length-small + * ts-node ./src/tools/fees.ts --name fees --type length-big + * + * The result will open in the browser once done */ /// === test methods === /// From bd68ce4b0a7c7fc0d69325be43f5ab889ef3b051 Mon Sep 17 00:00:00 2001 From: Nisheeth Barthwal Date: Thu, 20 Oct 2022 17:06:42 +0200 Subject: [PATCH 3/7] override fee multiplier, analyze multiple --- src/tools/fees.ts | 475 +++++++++++++++++++++++++++++++++++++--------- 1 file changed, 388 insertions(+), 87 deletions(-) diff --git a/src/tools/fees.ts b/src/tools/fees.ts index 8e78139..7a31df7 100644 --- a/src/tools/fees.ts +++ b/src/tools/fees.ts @@ -13,7 +13,7 @@ import { SubmittableExtrinsic as SubmittableExtrinsicPromise } from "@polkadot/a import { DispatchError, EventRecord } from "@polkadot/types/interfaces"; import Keyring from "@polkadot/keyring"; import { ApiPromise, WsProvider } from "@polkadot/api"; -import { u8aToHex, BN, BN_BILLION, BN_MILLION } from "@polkadot/util"; +import { u8aToHex, BN } from "@polkadot/util"; import { JsonRpcResponse } from "web3-core-helpers"; import { ethers } from "ethers"; import { Contract } from "web3-eth-contract"; @@ -22,11 +22,13 @@ import * as RLP from "rlp"; import yargs from "yargs"; import { AccessListish } from "ethers/lib/utils"; import { + ALITH_ADDRESS, ALITH_PRIVATE_KEY, BALTATHAR_ADDRESS, BALTATHAR_PRIVATE_KEY, CHARLETH_ADDRESS, CHARLETH_PRIVATE_KEY, + DOROTHY_PRIVATE_KEY, } from "../utils/constants"; const httpUrl = "http://127.0.0.1:9933"; @@ -38,6 +40,7 @@ const keyringEth = new Keyring({ type: "ethereum" }); export const alith = keyringEth.addFromUri(ALITH_PRIVATE_KEY); export const baltathar = keyringEth.addFromUri(BALTATHAR_PRIVATE_KEY); export const charleth = keyringEth.addFromUri(CHARLETH_PRIVATE_KEY); +export const dorothy = keyringEth.addFromUri(DOROTHY_PRIVATE_KEY); const web3 = new Web3(wssUrl); web3.eth.accounts.wallet.add(ALITH_PRIVATE_KEY); @@ -48,6 +51,8 @@ web3.eth.accounts.wallet.add(ALITH_PRIVATE_KEY); * NormalFilter - Call::EVM(_) => true * - EVM origin is allowed for all. * type CallOrigin = EnsureAddressAlways; + * + * pub struct EnsureAddressAlways; * impl EnsureAddressOrigin for EnsureAddressAlways { * type Success = (); * @@ -89,19 +94,25 @@ web3.eth.accounts.wallet.add(ALITH_PRIVATE_KEY); * --sealing=manual \ * --in-peers=0 \ * --out-peers=0 -linfo \ - * --port=5502 \ - * --rpc-port=25502 \ - * --ws-port=45502 \ * --tmp - * + * * Examples: * ts-node ./src/tools/fees.ts --name fees --type compute + * ts-node ./src/tools/fees.ts --name fees --type compute --multiplier 300000000 * ts-node ./src/tools/fees.ts --name fees --type length-small * ts-node ./src/tools/fees.ts --name fees --type length-big - * + * * The result will open in the browser once done */ +/** + * Observations + * - The first EVM call causes the SmartContract storage to be initialized and costs around 20,000 gas (we avoid this by pre-initializing the storage) + * - The fees sometime jump abruptly and stay at that level, this is due to nonce going from 1 byte to 2 bytes and so on + * - The block fill ratio is computed differently by transaction-payment; the multiplier is updated only due to `Normal` weight class (actual / max). + * The actual weight also contains some extra weight that doesn't belong to extrinsics (maybe coming from on_initialize/on_finalize) + */ + /// === test methods === /// const TESTER_CONTRACT = `// SPDX-License-Identifier: GPL-3.0-only @@ -130,74 +141,120 @@ const TESTER_CONTRACT = `// SPDX-License-Identifier: GPL-3.0-only const TESTER_JSON = compileSolidity(TESTER_CONTRACT); const TESTER_INTERFACE = new ethers.utils.Interface(TESTER_JSON.contract.abi); -async function runTest(api: ApiPromise, callType: "compute" | "length-small" | "length-big") { +async function runTest( + api: ApiPromise, + options: { callType: "compute" | "length-small" | "length-big"; multiplier: BN | null } +) { const result = []; - console.log("callType", callType); + console.log(`options: ${JSON.stringify(options)}`); let contractAddr = "0xc01Ee7f10EA4aF4673cFff62710E1D7792aBa8f3"; - // override nextFeeMultiplier if needed, note that its value will change immediately after block creation - const nextFeeMultiplierOverride = null; - if (nextFeeMultiplierOverride) { - await createBlock(api, [ - await api.tx.balances.transfer(contractAddr, 0).signAsync(alith), - await api.tx.sudo - .sudo( - await api.tx.system - .setStorage([ - [ - "0x3f1467a096bcd71a5b6a0c8155e208103f2edf3bdf381debe331ab7446addfdc", - u8aToHex(api.createType("u128", nextFeeMultiplierOverride).toU8a()), - ], - ]) - .signAsync(alith) - ) - .signAsync(alith), - ]); - } else { - const nextFeeMultiplier = await api.query.transactionPayment.nextFeeMultiplier(); - assert.equal( - nextFeeMultiplier.toString(), - "1000000000000000000", - "nextFeeMultiplier is not at its base value" - ); - console.log("nextFeeMul", nextFeeMultiplier.toString()); - } - // deploy contract const maxBlockWeight = api.consts.system.blockWeights.maxBlock.toBn(); const blockNumber = (await api.rpc.chain.getBlock()).block.header.number.toNumber(); + const nextFeeMultiplierOriginal = await api.query.transactionPayment.nextFeeMultiplier(); if (blockNumber === 0) { const { contract, rawTx } = await createContract(TESTER_JSON, { ...ALITH_TRANSACTION_TEMPLATE, gas: 900_000, gasPrice: 1_250_000_000, }); - assert.equal(await createBlock(api, rawTx), true, "failure during block creation"); + + const results = await createBlock(api, rawTx); + assert.equal(results, true, "failure during block creation"); await expectEVMSuccess(api); - console.log("addr", contract.options.address); + console.log(`contractAddress: ${contract.options.address.toString()}`); contractAddr = contract.options.address; } // use the specified call type const contractCall = (() => { - switch (callType) { + switch (options.callType) { case "compute": - return TESTER_INTERFACE.encodeFunctionData("incrementalLoop", [1000]); + return TESTER_INTERFACE.encodeFunctionData("incrementalLoop", [10]); case "length-small": return TESTER_INTERFACE.encodeFunctionData("bigData", [new Array(100).fill(0x01)]); case "length-big": return TESTER_INTERFACE.encodeFunctionData("bigData", [new Array(50 * 1024).fill(0x01)]); default: - throw new Error(`invalid callType ${callType}`); + throw new Error(`invalid options.callType ${options.callType}`); } })(); + // init the smart contract storage, if not done then the first tx has a storage initialization cost of around 20,000 + await createBlock(api, [ + await api.tx.evm + .call( + dorothy.address, + contractAddr, + contractCall, + 0, + 900_000n, + 2_000_000_000n, + null, + null, + [] + ) + .signAsync(dorothy), + ]); + + // override nextFeeMultiplier if needed, note that its value will change immediately after block creation + const nextFeeMultiplierOverride = options.multiplier || nextFeeMultiplierOriginal; + if (nextFeeMultiplierOverride) { + console.log(`overriding nextFeeMultiplier to ${nextFeeMultiplierOverride}`); + await createBlock(api, [ + await api.tx.balances.transfer(contractAddr, 0).signAsync(alith), + await api.tx.sudo + .sudo( + await api.tx.system + .setStorage([ + [ + "0x3f1467a096bcd71a5b6a0c8155e208103f2edf3bdf381debe331ab7446addfdc", + u8aToHex(api.createType("u128", nextFeeMultiplierOverride).toU8a()), + ], + ]) + .signAsync(alith) + ) + .signAsync(alith), + ]); + } + // start load test - const loadFactors = [...generateLoad(60, 2), ...Array(10).fill(0)]; + // const loadFactors = [...generateLoad(60, 1), ...Array(10).fill(0)]; + // const loadFactors = [...Array(183).fill(19)]; + const loadFactors = [...Array(183).fill(55)]; + // const loadFactors = [...Array(1).fill(0)]; const repsPerLoad = 30; - for await (const loadFactor of loadFactors) { - console.log(`load: ${loadFactor} (${repsPerLoad} reps)`); + for await (const [loadFactorIndex, loadFactor] of loadFactors.entries()) { + console.log( + `load: ${loadFactor} (${repsPerLoad} reps) ${loadFactorIndex + 1}/${loadFactors.length}` + ); for await (const rep of new Array(repsPerLoad).keys()) { + // uncomment the following code to reduce feeMultiplier by 10 each 100 blocks + // if (blockN % 100 === 0) { + // console.log(`feeMultiplier ${feeMultiplier.toString()}`); + // await createBlock(api, [ + // await api.tx.sudo + // .sudo( + // await api.tx.system + // .setStorage([ + // [ + // "0x3f1467a096bcd71a5b6a0c8155e208103f2edf3bdf381debe331ab7446addfdc", + // u8aToHex(api.createType("u128", feeMultiplier).toU8a()), + // ], + // ]) + // .signAsync(alith) + // ) + // .signAsync(alith), + // ]); + // if (feeMultiplier.eqn(1)) { + // feeMultiplier = BN_ZERO; + // break; + // } + // feeMultiplier = feeMultiplier.divn(10); + // } + // blockN++; + const multiplierBefore = await api.query.transactionPayment.nextFeeMultiplier(); const fees = await txObserveFeeDiff(api, async () => { const txs = [ @@ -208,8 +265,8 @@ async function runTest(api: ApiPromise, callType: "compute" | "length-small" | " // charge substrate fees await api.tx.evm - .call(baltathar.address, contractAddr, contractCall, 0, 900_000n, 0n, null, null, []) - .signAsync(baltathar), + .call(baltathar.address, contractAddr, contractCall, 0, 11_000_000n, 0n, null, null, []) + .signAsync(baltathar, {tip: 1n * 10n ** 15n}), // charge EVM fees await api.tx.evm @@ -218,41 +275,126 @@ async function runTest(api: ApiPromise, callType: "compute" | "length-small" | " contractAddr, contractCall, 0, - 900_000n, - 2_000_000_000n, + 11_000_000n, + 2_000_000_000_000_000n, null, null, [] ) - .signAsync(charleth), + .signAsync(charleth, {tip: 1n * 10n ** 15n}), ]; + txs.forEach(t => { + console.log(t.hash.toString()); + }); + return txs; }); + + + // get block details + const transactions = { + substrate: null, + evm: null, + }; + const block = await api.rpc.chain.getBlock(); + for (const [i, ext] of block.block.extrinsics.entries()) { + if (ext.signer.eq(BALTATHAR_ADDRESS)) { + transactions.substrate = { + index: i, + extrinsicLength: ext.encodedLength, + extrinsic: ext, + }; + } else if (ext.signer.eq(CHARLETH_ADDRESS)) { + transactions.evm = { + index: i, + extrinsicLength: ext.encodedLength, + extrinsic: ext, + }; + } + } + // compute block weight, from events + const weights = {}; const events = await api.query.system.events(); let totalBlockWeight = new BN(0); - for (const event of events) { - if (api.events.system.ExtrinsicSuccess.is(event.event)) { - totalBlockWeight = totalBlockWeight.add(event.event.data.dispatchInfo.weight.toBn()); + for (const { phase, event } of events) { + if (phase.isApplyExtrinsic) { + if ( + api.events.system.ExtrinsicSuccess.is(event) || + api.events.system.ExtrinsicFailed.is(event) + ) { + weights[phase.asApplyExtrinsic.toNumber()] = event.data.dispatchInfo.weight.toBn(); + } + } + } + if (!transactions.substrate || transactions.evm) { + } + for (const i of Object.keys(weights)) { + const key = parseInt(i); + if (transactions.substrate && transactions.substrate.index === key) { + transactions.substrate.weight = weights[i].toString(); + } else if (transactions.evm && transactions.evm.index === key) { + transactions.evm.weight = weights[i].toString(); + } + switch (parseInt(i)) { + case transactions.substrate.index: + transactions.substrate.weight = weights[i].toString(); + break; + case transactions.evm.index: + transactions.evm.weight = weights[i].toString(); + break; } + totalBlockWeight = totalBlockWeight.add(weights[i]); } + + // get feeDetails + + const feeDetails = ( + await api.rpc.payment.queryFeeDetails(transactions.substrate.extrinsic.toHex()) + ).inclusionFee.unwrap(); + const supplyFactor = 1; // 100 for moonbeam, 1 otherwise + const substrateFeeDetails = { + baseFee: feeDetails.baseFee.toString(), + lengthFee: feeDetails.lenFee.toString(), + adjustedWeightFee: multiplierBefore + .mul(new BN(transactions.substrate.weight).muln(50_000 * supplyFactor)) + .div(new BN("1000000000000000000")) + .toString(), + total: null, + }; + substrateFeeDetails.total = Object.values(substrateFeeDetails) + .reduce((acc, v) => acc.add(new BN(v)), new BN(0)) + .toString(); + const multiplierAfter = await api.query.transactionPayment.nextFeeMultiplier(); - result.push({ + delete transactions.substrate.extrinsic; + delete transactions.evm.extrinsic; + const data = { fullPercent: totalBlockWeight.muln(100).div(maxBlockWeight).toNumber(), ...fees, + transactions, + substrateFeeDetails, multiplier: { before: multiplierBefore.toString(), after: multiplierAfter.toString(), }, block: (await api.rpc.chain.getBlock()).block.header.number.toNumber(), - }); + }; + result.push(data); + if (data.block === 4) { + throw Error("FOUR!"); + } } } - return result; + return { + multiplier: nextFeeMultiplierOverride.toString(), + callType: options.callType, + result, + }; } function generateLoad(middle: number, inc: number = 1): number[] { @@ -260,6 +402,9 @@ function generateLoad(middle: number, inc: number = 1): number[] { for (let i = 0; i <= middle; i += inc) { load.push(i); } + for (let i = 0; i <= 50; i++) { + load.push(middle); + } for (let i = middle; i >= 0; i -= inc) { load.push(i); } @@ -602,10 +747,21 @@ function compileSolidity(fileContents: string): Compiled { async function view(input: string, output: string, open: boolean) { const data = JSON.parse(fs.readFileSync(input).toString("utf-8")); - const labels = data.map((x: any, i: number) => i); - const fullPercent = data.map((x: any) => x["fullPercent"]); - const substrateFees = data.map((x: any) => new BN(x["substrate"]).toNumber()); - const evmFees = data.map((x: any) => new BN(x["evm"]).toNumber()); + const labels = data.result.map((x: any) => x["block"]); + const fullPercent = data.result.map((x: any) => x["fullPercent"]); + const substrateFees = data.result.map((x: any) => new BN(x["substrate"]).toString()); + const evmFees = data.result.map((x: any) => new BN(x["evm"]).toString()); + const multiplier = data.result.map((x: any) => new BN(x["multiplier"]["before"]).toString()); + const diff = data.result.map((x: any) => { + const a = new BN(x["substrate"]); + const b = new BN(x["evm"]); + return a.sub(b).abs().muln(100).div(a.add(b).divn(2)).toString(); + }); + const diffSubstrate = data.result.map((x: any) => { + const a = new BN(x["substrate"]); + const b = new BN(x["evm"]); + return a.sub(b).toString(); + }); // editorconfig-checker-disable fs.writeFileSync( @@ -613,6 +769,8 @@ async function view(input: string, output: string, open: boolean) { ` + + -
- -
-
- -
-
- -
+
+
+ +
+
+ +
+
+ +
+
+ +
+
+ + + + + + + + + +` +); +// editorconfig-checker-enable + +const openCmd = (() => { + switch (process.platform) { + case "darwin": + return "open"; + case "win32": + return "start"; + default: + return "xdg-open"; + } +})(); + +exec(`${openCmd} ${outputFile}`); From e5ecbfdd901a201228ad546de35410b3f95efa31 Mon Sep 17 00:00:00 2001 From: crystalin Date: Thu, 14 Nov 2024 09:21:20 +0100 Subject: [PATCH 6/7] fix fees --- src/tools/fees.ts | 66 +++++++++++++++++++++++------------------------ 1 file changed, 32 insertions(+), 34 deletions(-) diff --git a/src/tools/fees.ts b/src/tools/fees.ts index b884f85..6b9bb2f 100644 --- a/src/tools/fees.ts +++ b/src/tools/fees.ts @@ -1,35 +1,33 @@ -import assert from "node:assert/strict"; import { exec as execProcess } from "child_process"; -import util from "node:util"; import fs from "fs"; +import assert from "node:assert/strict"; +import util from "node:util"; import { setTimeout } from "timers/promises"; -import { EvmCoreErrorExitReason } from "@polkadot/types/lookup"; -import solc from "solc"; -import "@polkadot/api-augment"; import "@moonbeam-network/api-augment"; -import { ApiTypes, SubmittableExtrinsic } from "@polkadot/api/types"; +import { ApiPromise, WsProvider } from "@polkadot/api"; +import "@polkadot/api-augment"; import { SubmittableExtrinsic as SubmittableExtrinsicPromise } from "@polkadot/api/promise/types"; -import { DispatchError, EventRecord } from "@polkadot/types/interfaces"; +import { ApiTypes, SubmittableExtrinsic } from "@polkadot/api/types"; import Keyring from "@polkadot/keyring"; -import { ApiPromise, WsProvider } from "@polkadot/api"; -import { u8aToHex, BN } from "@polkadot/util"; -import { JsonRpcResponse } from "web3-core-helpers"; +import { DispatchError, EventRecord } from "@polkadot/types/interfaces"; +import { EvmCoreErrorExitReason } from "@polkadot/types/lookup"; +import { BN, u8aToHex } from "@polkadot/util"; import { ethers } from "ethers"; -import { Contract } from "web3-eth-contract"; -import Web3 from "web3"; +import { AccessListish } from "ethers/lib/utils.js"; import * as RLP from "rlp"; +import solc from "solc"; +import { JsonRpcResponseWithResult, Web3 } from "web3"; +import { Contract } from "web3-eth-contract"; import yargs from "yargs"; -import { AccessListish } from "ethers/lib/utils"; import { - ALITH_ADDRESS, ALITH_PRIVATE_KEY, BALTATHAR_ADDRESS, BALTATHAR_PRIVATE_KEY, CHARLETH_ADDRESS, CHARLETH_PRIVATE_KEY, DOROTHY_PRIVATE_KEY, -} from "../utils/constants"; +} from "../utils/constants.ts"; const httpUrl = "http://127.0.0.1:9933"; const wssUrl = "ws://127.0.0.1:9944"; @@ -150,7 +148,7 @@ async function runTest( let contractAddr = "0xc01Ee7f10EA4aF4673cFff62710E1D7792aBa8f3"; // deploy contract - const maxBlockWeight = api.consts.system.blockWeights.maxBlock.toBn(); + const maxBlockWeight = api.consts.system.blockWeights.maxBlock.refTime.toBn(); const blockNumber = (await api.rpc.chain.getBlock()).block.header.number.toNumber(); const nextFeeMultiplierOriginal = await api.query.transactionPayment.nextFeeMultiplier(); if (blockNumber === 0) { @@ -323,7 +321,7 @@ async function runTest( api.events.system.ExtrinsicSuccess.is(event) || api.events.system.ExtrinsicFailed.is(event) ) { - weights[phase.asApplyExtrinsic.toNumber()] = event.data.dispatchInfo.weight.toBn(); + weights[phase.asApplyExtrinsic.toNumber()] = event.data.dispatchInfo.weight.refTime.toBn(); } } } @@ -450,7 +448,7 @@ function extractError(events: EventRecord[] = []): DispatchError | undefined { } async function customWeb3Request(web3: Web3, method: string, params: any[]) { - return new Promise((resolve, reject) => { + return new Promise((resolve, reject) => { (web3.currentProvider as any).send( { jsonrpc: "2.0", @@ -458,7 +456,7 @@ async function customWeb3Request(web3: Web3, method: string, params: any[]) { method, params, }, - (error: Error | null, result?: JsonRpcResponse) => { + (error: Error | null, result?: JsonRpcResponseWithResult) => { if (error) { reject( `Failed to send custom request (${method} (${params @@ -483,10 +481,10 @@ type ExtrinsicCreation = boolean; async function createBlock< ApiType extends ApiTypes, Call extends - | SubmittableExtrinsic - | Promise> - | string - | Promise, + | SubmittableExtrinsic + | Promise> + | string + | Promise, Calls extends Call | Call[] >(api: ApiPromise, transactions?: Calls, options: BlockCreation = {}) { const results: ({ type: "eth"; hash: string } | { type: "sub"; hash: string })[] = []; @@ -497,7 +495,7 @@ async function createBlock< // Ethereum results.push({ type: "eth", - hash: (await customWeb3Request(web3, "eth_sendRawTransaction", [call])).result, + hash: (await customWeb3Request(web3, "eth_sendRawTransaction", [call])).result.toString(), }); } else if (call.isSigned) { results.push({ @@ -535,14 +533,14 @@ async function createBlock< const extrinsicIndex = result.type == "eth" ? allRecords - .find( - ({ phase, event: { section, method, data } }) => - phase.isApplyExtrinsic && - section == "ethereum" && - method == "Executed" && - data[2].toString() == result.hash - ) - ?.phase?.asApplyExtrinsic?.toNumber() + .find( + ({ phase, event: { section, method, data } }) => + phase.isApplyExtrinsic && + section == "ethereum" && + method == "Executed" && + data[2].toString() == result.hash + ) + ?.phase?.asApplyExtrinsic?.toNumber() : blockData.block.extrinsics.findIndex((ext) => ext.hash.toHex() == result.hash); // We retrieve the events associated with the extrinsic const events = allRecords.filter( @@ -665,9 +663,9 @@ async function createContract( contractCompiled: Compiled, options: TransactionOptions = ALITH_TRANSACTION_TEMPLATE, contractArguments: any[] = [] -): Promise<{ rawTx: string; contract: Contract; contractAddress: string }> { +): Promise<{ rawTx: string; contract: Contract; contractAddress: string }> { const from = options.from !== undefined ? options.from : alith.address; - const nonce = options.nonce || (await web3.eth.getTransactionCount(from)); + const nonce = options.nonce || Number((await web3.eth.getTransactionCount(from))); const contractAddress = "0x" + From f0c023c271d0d8461d2c18b74ab80f78ebf02af7 Mon Sep 17 00:00:00 2001 From: crystalin Date: Thu, 14 Nov 2024 09:22:50 +0100 Subject: [PATCH 7/7] lint --- src/tools/fees-analyze.ts | 6 ++-- src/tools/fees.ts | 63 ++++++++++++++++++++------------------- 2 files changed, 35 insertions(+), 34 deletions(-) diff --git a/src/tools/fees-analyze.ts b/src/tools/fees-analyze.ts index b010d99..0d0f553 100644 --- a/src/tools/fees-analyze.ts +++ b/src/tools/fees-analyze.ts @@ -25,7 +25,7 @@ const data = [ substrateDetails: { baseFee: BigInt(d["result"][0]["substrateFeeDetails"]["baseFee"]).toLocaleString(), adjustedWeightFee: BigInt( - d["result"][0]["substrateFeeDetails"]["adjustedWeightFee"] + d["result"][0]["substrateFeeDetails"]["adjustedWeightFee"], ).toLocaleString(), }, }, @@ -41,7 +41,7 @@ ${"".padStart(10)} ${d.fees.evm.padStart(25)} | evm ${"".padStart(10)} ${d.fees.diff.toLocaleString().padStart(25)} | diff ${"".padStart(10)} ${d.fees.diffPercent.toLocaleString().concat("%").padStart(25)} | diff% ${"".padStart(10)} ${d.fees.substrateDetails.adjustedWeightFee.padStart( - 25 + 25, )} | substrate-weight-fee-part ${"".padStart(10)} ${d.fees.substrateDetails.baseFee.padStart(25)} | substrate-base-fee-part ${"-".repeat(36)} ${"| "}`); @@ -164,7 +164,7 @@ fs.writeFileSync( } -` +`, ); // editorconfig-checker-enable diff --git a/src/tools/fees.ts b/src/tools/fees.ts index 6b9bb2f..b2daeb6 100644 --- a/src/tools/fees.ts +++ b/src/tools/fees.ts @@ -141,7 +141,7 @@ const TESTER_INTERFACE = new ethers.utils.Interface(TESTER_JSON.contract.abi); async function runTest( api: ApiPromise, - options: { callType: "compute" | "length-small" | "length-big"; multiplier: BN | null } + options: { callType: "compute" | "length-small" | "length-big"; multiplier: BN | null }, ) { const result = []; console.log(`options: ${JSON.stringify(options)}`); @@ -191,7 +191,7 @@ async function runTest( 2_000_000_000n, null, null, - [] + [], ) .signAsync(dorothy), ]); @@ -211,7 +211,7 @@ async function runTest( u8aToHex(api.createType("u128", nextFeeMultiplierOverride).toU8a()), ], ]) - .signAsync(alith) + .signAsync(alith), ) .signAsync(alith), ]); @@ -225,7 +225,7 @@ async function runTest( const repsPerLoad = 30; for await (const [loadFactorIndex, loadFactor] of loadFactors.entries()) { console.log( - `load: ${loadFactor} (${repsPerLoad} reps) ${loadFactorIndex + 1}/${loadFactors.length}` + `load: ${loadFactor} (${repsPerLoad} reps) ${loadFactorIndex + 1}/${loadFactors.length}`, ); for await (const rep of new Array(repsPerLoad).keys()) { // uncomment the following code to reduce feeMultiplier by 10 each 100 blocks @@ -277,7 +277,7 @@ async function runTest( 2_000_000_000_000_000n, null, null, - [] + [], ) .signAsync(charleth, { tip: 1n * 10n ** 15n }), ]; @@ -321,7 +321,8 @@ async function runTest( api.events.system.ExtrinsicSuccess.is(event) || api.events.system.ExtrinsicFailed.is(event) ) { - weights[phase.asApplyExtrinsic.toNumber()] = event.data.dispatchInfo.weight.refTime.toBn(); + weights[phase.asApplyExtrinsic.toNumber()] = + event.data.dispatchInfo.weight.refTime.toBn(); } } } @@ -410,7 +411,7 @@ function generateLoad(middle: number, inc: number = 1): number[] { async function txObserveFeeDiff( api: ApiPromise, - txFunc: () => Promise + txFunc: () => Promise, ) { const txs = await txFunc(); const balanceBeforeBaltathar = await api.query.system.account(BALTATHAR_ADDRESS); @@ -430,7 +431,7 @@ async function txObserveFeeDiff( async function expectEVMSuccess(api: ApiPromise) { const events = await api.query.system.events(); const ethereumResult = events.find( - ({ event: { section, method } }) => section == "ethereum" && method == "Executed" + ({ event: { section, method } }) => section == "ethereum" && method == "Executed", ).event.data[3] as EvmCoreErrorExitReason; assert.equal(ethereumResult.isSucceed, true, "EVM operation failed"); } @@ -443,7 +444,7 @@ function extractError(events: EventRecord[] = []): DispatchError | undefined { event: { data: [dispatchError], }, - }) => dispatchError as DispatchError + }) => dispatchError as DispatchError, )[0]; } @@ -464,11 +465,11 @@ async function customWeb3Request(web3: Web3, method: string, params: any[]) { const str = p.toString(); return str.length > 128 ? `${str.slice(0, 96)}...${str.slice(-28)}` : str; }) - .join(",")})): ${error.message || error.toString()}` + .join(",")})): ${error.message || error.toString()}`, ); } resolve(result); - } + }, ); }); } @@ -481,11 +482,11 @@ type ExtrinsicCreation = boolean; async function createBlock< ApiType extends ApiTypes, Call extends - | SubmittableExtrinsic - | Promise> - | string - | Promise, - Calls extends Call | Call[] + | SubmittableExtrinsic + | Promise> + | string + | Promise, + Calls extends Call | Call[], >(api: ApiPromise, transactions?: Calls, options: BlockCreation = {}) { const results: ({ type: "eth"; hash: string } | { type: "sub"; hash: string })[] = []; const txs = @@ -533,18 +534,18 @@ async function createBlock< const extrinsicIndex = result.type == "eth" ? allRecords - .find( - ({ phase, event: { section, method, data } }) => - phase.isApplyExtrinsic && - section == "ethereum" && - method == "Executed" && - data[2].toString() == result.hash - ) - ?.phase?.asApplyExtrinsic?.toNumber() + .find( + ({ phase, event: { section, method, data } }) => + phase.isApplyExtrinsic && + section == "ethereum" && + method == "Executed" && + data[2].toString() == result.hash, + ) + ?.phase?.asApplyExtrinsic?.toNumber() : blockData.block.extrinsics.findIndex((ext) => ext.hash.toHex() == result.hash); // We retrieve the events associated with the extrinsic const events = allRecords.filter( - ({ phase }) => phase.isApplyExtrinsic && phase.asApplyExtrinsic.toNumber() === extrinsicIndex + ({ phase }) => phase.isApplyExtrinsic && phase.asApplyExtrinsic.toNumber() === extrinsicIndex, ); const failure = extractError(events); const successful = extrinsicIndex !== undefined && !failure; @@ -582,7 +583,7 @@ interface TransactionOptions { } async function createTransaction( options: TransactionOptions, - ethTransactionType = "Legacy" + ethTransactionType = "Legacy", ): Promise { const isLegacy = ethTransactionType === "Legacy"; const isEip2930 = ethTransactionType === "EIP2930"; @@ -662,10 +663,10 @@ async function createTransaction( async function createContract( contractCompiled: Compiled, options: TransactionOptions = ALITH_TRANSACTION_TEMPLATE, - contractArguments: any[] = [] + contractArguments: any[] = [], ): Promise<{ rawTx: string; contract: Contract; contractAddress: string }> { const from = options.from !== undefined ? options.from : alith.address; - const nonce = options.nonce || Number((await web3.eth.getTransactionCount(from))); + const nonce = options.nonce || Number(await web3.eth.getTransactionCount(from)); const contractAddress = "0x" + @@ -721,8 +722,8 @@ function compileSolidity(fileContents: string): Compiled { import: (_: string) => { return { error: "imports not supported" }; }, - } - ) + }, + ), ); if (!result.contracts) { throw result; @@ -1043,7 +1044,7 @@ async function view(input: string, output: string, open: boolean) { } - ` + `, ); // editorconfig-checker-enable