diff --git a/CHANGELOG.md b/CHANGELOG.md index a49616a0a5..e345f9216d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,11 +1,20 @@ ## Current ### Features +- [#2555](https://github.com/poanetwork/blockscout/pull/2555) - find and show decoding candidates for logs +- [#2596](https://github.com/poanetwork/blockscout/pull/2596) - support AuRa's empty step reward type - [#2561](https://github.com/poanetwork/blockscout/pull/2561) - Add token's type to the response of tokenlist method - [#2499](https://github.com/poanetwork/blockscout/pull/2499) - import emission reward ranges - [#2497](https://github.com/poanetwork/blockscout/pull/2497) - Add generic Ordered Cache behaviour and implementation ### Fixes +- [#2640](https://github.com/poanetwork/blockscout/pull/2640) - SVG network icons +- [#2635](https://github.com/poanetwork/blockscout/pull/2635) - optimize ERC721 inventory query +- [#2626](https://github.com/poanetwork/blockscout/pull/2626) - Fixing 2 Mobile UI Issues +- [#2623](https://github.com/poanetwork/blockscout/pull/2623) - fix a blinking test +- [#2616](https://github.com/poanetwork/blockscout/pull/2616) - deduplicate coin history records by delta +- [#2613](https://github.com/poanetwork/blockscout/pull/2613) - fix getminedblocks rpc endpoint +- [#2592](https://github.com/poanetwork/blockscout/pull/2592) - process new metadata format for whisper - [#2572](https://github.com/poanetwork/blockscout/pull/2572) - Ease non-critical css - [#2570](https://github.com/poanetwork/blockscout/pull/2570) - Network icons preload - [#2569](https://github.com/poanetwork/blockscout/pull/2569) - do not fetch emission rewards for transactions csv exporter @@ -15,7 +24,12 @@ - [#2538](https://github.com/poanetwork/blockscout/pull/2538) - fetch the last not empty coin balance records ### Chore +- [#2634](https://github.com/poanetwork/blockscout/pull/2634) - add Lukso to networks dropdown +- [#2611](https://github.com/poanetwork/blockscout/pull/2611) - fix js dependency vulnerabilities +- [#2617](https://github.com/poanetwork/blockscout/pull/2617) - skip cache update if there are no blocks inserted +- [#2594](https://github.com/poanetwork/blockscout/pull/2594) - do not start genesis data fetching periodically - [#2590](https://github.com/poanetwork/blockscout/pull/2590) - restore backward compatablity with old releases +- [#2577](https://github.com/poanetwork/blockscout/pull/2577) - Need recompile column in the env vars table - [#2574](https://github.com/poanetwork/blockscout/pull/2574) - limit request body in json rpc error - [#2566](https://github.com/poanetwork/blockscout/pull/2566) - upgrade absinthe phoenix diff --git a/apps/block_scout_web/assets/css/_images-preload.scss b/apps/block_scout_web/assets/css/_images-preload.scss index 8356a8f90e..95f4633a56 100644 --- a/apps/block_scout_web/assets/css/_images-preload.scss +++ b/apps/block_scout_web/assets/css/_images-preload.scss @@ -1,15 +1,16 @@ body:after { position:absolute; width:0; height:0; overflow:hidden; z-index:-1; content: - url(/images/network-selector-icons/callisto-mainnet.png) - url(/images/network-selector-icons/ethereum-mainnet.png) - url(/images/network-selector-icons/ethereum-classic.png) - url(/images/network-selector-icons/goerli-testnet.png) - url(/images/network-selector-icons/kovan-testnet.png) - url(/images/network-selector-icons/poa-core.png) - url(/images/network-selector-icons/poa-sokol.png) - url(/images/network-selector-icons/rinkeby-testnet.png) - url(/images/network-selector-icons/rsk-mainnet.png) - url(/images/network-selector-icons/ropsten-testnet.png) - url(/images/network-selector-icons/xdai-chain.png) + url(/images/network-selector-icons/callisto-mainnet.svg) + url(/images/network-selector-icons/ethereum-mainnet.svg) + url(/images/network-selector-icons/ethereum-classic.svg) + url(/images/network-selector-icons/goerli-testnet.svg) + url(/images/network-selector-icons/kovan-testnet.svg) + url(/images/network-selector-icons/poa-core.svg) + url(/images/network-selector-icons/poa-sokol.svg) + url(/images/network-selector-icons/rinkeby-testnet.svg) + url(/images/network-selector-icons/rsk-mainnet.svg) + url(/images/network-selector-icons/ropsten-testnet.svg) + url(/images/network-selector-icons/xdai-chain.svg) + url(/images/network-selector-icons/lukso-l14-testnet.svg) }; \ No newline at end of file diff --git a/apps/block_scout_web/assets/css/components/_network-selector.scss b/apps/block_scout_web/assets/css/components/_network-selector.scss index 7f2a4c020d..9df2d22164 100644 --- a/apps/block_scout_web/assets/css/components/_network-selector.scss +++ b/apps/block_scout_web/assets/css/components/_network-selector.scss @@ -245,37 +245,40 @@ $network-selector-item-icon-dimensions: 30px !default; width: $network-selector-item-icon-dimensions; &-callisto-mainnet { - background-image: url(/images/network-selector-icons/callisto-mainnet.png) + background-image: url(/images/network-selector-icons/callisto-mainnet.svg) } &-ethereum-mainnet { - background-image: url(/images/network-selector-icons/ethereum-mainnet.png) + background-image: url(/images/network-selector-icons/ethereum-mainnet.svg) } &-ethereum-classic { - background-image: url(/images/network-selector-icons/ethereum-classic.png) + background-image: url(/images/network-selector-icons/ethereum-classic.svg) } &-goerli-testnet { - background-image: url(/images/network-selector-icons/goerli-testnet.png) + background-image: url(/images/network-selector-icons/goerli-testnet.svg) } &-kovan-testnet { - background-image: url(/images/network-selector-icons/kovan-testnet.png) + background-image: url(/images/network-selector-icons/kovan-testnet.svg) } &-poa-core { - background-image: url(/images/network-selector-icons/poa-core.png) + background-image: url(/images/network-selector-icons/poa-core.svg) } &-poa-sokol { - background-image: url(/images/network-selector-icons/poa-sokol.png) + background-image: url(/images/network-selector-icons/poa-sokol.svg) } &-rinkeby-testnet { - background-image: url(/images/network-selector-icons/rinkeby-testnet.png) + background-image: url(/images/network-selector-icons/rinkeby-testnet.svg) } &-rsk-mainnet { - background-image: url(/images/network-selector-icons/rsk-mainnet.png) + background-image: url(/images/network-selector-icons/rsk-mainnet.svg) } &-ropsten-testnet { - background-image: url(/images/network-selector-icons/ropsten-testnet.png) + background-image: url(/images/network-selector-icons/ropsten-testnet.svg) } &-xdai-chain { - background-image: url(/images/network-selector-icons/xdai-chain.png) + background-image: url(/images/network-selector-icons/xdai-chain.svg) + } + &-lukso-l14-testnet { + background-image: url(/images/network-selector-icons/lukso-l14-testnet.svg) } } diff --git a/apps/block_scout_web/assets/package-lock.json b/apps/block_scout_web/assets/package-lock.json index a03732e4e0..d00f148391 100644 --- a/apps/block_scout_web/assets/package-lock.json +++ b/apps/block_scout_web/assets/package-lock.json @@ -2678,8 +2678,7 @@ "esprima": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", - "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", - "dev": true + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==" }, "is-svg": { "version": "3.0.0", @@ -2690,16 +2689,6 @@ "html-comment-regex": "^1.1.0" } }, - "js-yaml": { - "version": "3.13.1", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz", - "integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==", - "dev": true, - "requires": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" - } - }, "mdn-data": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-1.1.4.tgz", @@ -3638,8 +3627,7 @@ "esprima": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.0.tgz", - "integrity": "sha512-oftTcaMu/EGrEIu904mWteKIv8vMuOgGYo7EhVJJN00R/EED9DCua/xxHRdYnKtcECzVg7xOWhflvJMnqcFZjw==", - "dev": true + "integrity": "sha512-oftTcaMu/EGrEIu904mWteKIv8vMuOgGYo7EhVJJN00R/EED9DCua/xxHRdYnKtcECzVg7xOWhflvJMnqcFZjw==" }, "globals": { "version": "11.7.0", @@ -3647,16 +3635,6 @@ "integrity": "sha512-K8BNSPySfeShBQXsahYB/AbbWruVOTyVpgoIDnl8odPpeSfP2J5QO2oLFFdl2j7GfDCtZj2bMKar2T49itTPCg==", "dev": true }, - "js-yaml": { - "version": "3.12.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.12.0.tgz", - "integrity": "sha512-PIt2cnwmPfL4hKNwqeiuz4bKfnzHTBv6HyVgjahA6mPLwPDzjDWrplJBMjHUFxku/N3FlmrbyPclad+I+4mJ3A==", - "dev": true, - "requires": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" - } - }, "strip-ansi": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", @@ -3812,12 +3790,6 @@ "acorn-jsx": "^3.0.0" } }, - "esprima": { - "version": "2.7.3", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-2.7.3.tgz", - "integrity": "sha1-luO3DVd59q1JzQMmc9HDEnZ7pYE=", - "dev": true - }, "esquery": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.0.1.tgz", @@ -3980,9 +3952,9 @@ } }, "extend": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.1.tgz", - "integrity": "sha1-p1Xqe8Gt/MWjHOfnYtuq3F5jZEQ=", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", "dev": true }, "extend-shallow": { @@ -4293,6 +4265,16 @@ "readable-stream": "^2.0.0" } }, + "fs-minipass": { + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-1.2.6.tgz", + "integrity": "sha512-crhvyXcMejjv3Z5d2Fa9sf5xLYVCF5O1c71QxbVnbLsmYMBEvDAftewesN/HhY03YRoA7zOMxjNGrF5svGaaeQ==", + "dev": true, + "optional": true, + "requires": { + "minipass": "^2.2.1" + } + }, "fs-write-stream-atomic": { "version": "1.0.10", "resolved": "https://registry.npmjs.org/fs-write-stream-atomic/-/fs-write-stream-atomic-1.0.10.tgz", @@ -4375,9 +4357,7 @@ "chownr": { "version": "1.0.1", "resolved": false, - "integrity": "sha1-4qdQQqlVGQi+vSW4Uj1fl2nXkYE=", - "dev": true, - "optional": true + "integrity": "sha1-4qdQQqlVGQi+vSW4Uj1fl2nXkYE=" }, "code-point-at": { "version": "1.1.0", @@ -4442,8 +4422,6 @@ "version": "1.2.5", "resolved": false, "integrity": "sha512-JhBl0skXjUPCFH7x6x61gQxrKyXsxB5gcgePLZCwfyCGGsTISMoIeObbrvVeP6Xmyaudw4TT43qV2Gz+iyd2oQ==", - "dev": true, - "optional": true, "requires": { "minipass": "^2.2.1" } @@ -4577,8 +4555,6 @@ "version": "2.2.4", "resolved": false, "integrity": "sha512-hzXIWWet/BzWhYs2b+u7dRHlruXhwdgvlTMDKC6Cb1U7ps6Ac6yQlR39xsbjWJE377YTCtKwIXIpJ5oP+j5y8g==", - "dev": true, - "optional": true, "requires": { "safe-buffer": "^5.1.1", "yallist": "^3.0.0" @@ -4588,8 +4564,6 @@ "version": "1.1.0", "resolved": false, "integrity": "sha512-4T6Ur/GctZ27nHfpt9THOdRZNgyJ9FZchYO1ceg5S8Q3DNLCKYy44nCZzgCJgcvx2UM8czmqak5BCxJMrq37lA==", - "dev": true, - "optional": true, "requires": { "minipass": "^2.2.1" } @@ -4798,9 +4772,7 @@ "safe-buffer": { "version": "5.1.1", "resolved": false, - "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==", - "dev": true, - "optional": true + "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==" }, "safer-buffer": { "version": "2.1.2", @@ -4876,22 +4848,6 @@ "dev": true, "optional": true }, - "tar": { - "version": "4.4.1", - "resolved": false, - "integrity": "sha512-O+v1r9yN4tOsvl90p5HAP4AEqbYhx4036AGMm075fH9F8Qwi3oJ+v4u50FkT/KkvywNGtwkk0zRI+8eYm1X/xg==", - "dev": true, - "optional": true, - "requires": { - "chownr": "^1.0.1", - "fs-minipass": "^1.2.5", - "minipass": "^2.2.4", - "minizlib": "^1.1.0", - "mkdirp": "^0.5.0", - "safe-buffer": "^5.1.1", - "yallist": "^3.0.2" - } - }, "util-deprecate": { "version": "1.0.2", "resolved": false, @@ -4919,16 +4875,14 @@ "yallist": { "version": "3.0.2", "resolved": false, - "integrity": "sha1-hFK0u36Dx8GI2AQcGoN8dz1ti7k=", - "dev": true, - "optional": true + "integrity": "sha1-hFK0u36Dx8GI2AQcGoN8dz1ti7k=" } } }, "fstream": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/fstream/-/fstream-1.0.11.tgz", - "integrity": "sha1-XB+x8RdHcRTwYyoOtLcbPLD9MXE=", + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/fstream/-/fstream-1.0.12.tgz", + "integrity": "sha512-WvJ193OHa0GHPEL+AycEJgxvBEwyfRkN1vhjca23OaPVMCaLCXTd5qAu82AjTcgP1UJmytkOKb63Ypde7raDIg==", "dev": true, "requires": { "graceful-fs": "^4.1.2", @@ -5158,15 +5112,23 @@ "dev": true }, "handlebars": { - "version": "4.0.12", - "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.0.12.tgz", - "integrity": "sha512-RhmTekP+FZL+XNhwS1Wf+bTTZpdLougwt5pcgA1tuz6Jcx0fpH/7z0qd71RKnZHBCxIRBHfBOnio4gViPemNzA==", + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.1.2.tgz", + "integrity": "sha512-nvfrjqvt9xQ8Z/w0ijewdD/vvWDTOweBUm96NTr66Wfvo1mJenBLwcYmPs3TIBP5ruzYGD7Hx/DaM9RmhroGPw==", "dev": true, "requires": { - "async": "^2.5.0", + "neo-async": "^2.6.0", "optimist": "^0.6.1", "source-map": "^0.6.1", "uglify-js": "^3.1.4" + }, + "dependencies": { + "neo-async": { + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.1.tgz", + "integrity": "sha512-iyam8fBuCUpWeKPGpaNMetEocMt364qkCsfL9JuhjXX6dRnguRVOfk2GZaDpPjcOKiiXCPINZC1GczQ7iTq3Zw==", + "dev": true + } } }, "har-schema": { @@ -6758,9 +6720,9 @@ } }, "jquery": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.3.1.tgz", - "integrity": "sha512-Ubldcmxp5np52/ENotGxlLe6aGMvmF4R8S6tZjsP6Knsaxd/xp3Zrh50cG93lR6nPXyUFwzN3ZSOQI0wRJNdGg==" + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.4.0.tgz", + "integrity": "sha512-ggRCXln9zEqv6OqAGXFEcshF5dSBvCkzj6Gm2gzuR5fWawaX8t7cxKVkkygKODrDAzKdoYw3l/e3pm3vlT4IbQ==" }, "js-base64": { "version": "2.4.5", @@ -6774,13 +6736,21 @@ "integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=" }, "js-yaml": { - "version": "3.7.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.7.0.tgz", - "integrity": "sha1-XJZ93YN6m/3KXy3oQlOr6KHAO4A=", + "version": "3.13.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz", + "integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==", "dev": true, "requires": { "argparse": "^1.0.7", - "esprima": "^2.6.0" + "esprima": "^4.0.0" + }, + "dependencies": { + "esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "dev": true + } } }, "jsbn": { @@ -6988,9 +6958,9 @@ } }, "lodash": { - "version": "4.17.11", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", - "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==" + "version": "4.17.13", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.13.tgz", + "integrity": "sha512-vm3/XWXfWtRua0FkUyEHBZy8kCPjErNBT9fJx8Zvs+U6zjqPbTUOpkaoum3O5uiA8sm+yNMHXfYkTUHFoMxFNA==" }, "lodash.assign": { "version": "4.2.0", @@ -7017,9 +6987,9 @@ "dev": true }, "lodash.mergewith": { - "version": "4.6.1", - "resolved": "https://registry.npmjs.org/lodash.mergewith/-/lodash.mergewith-4.6.1.tgz", - "integrity": "sha512-eWw5r+PYICtEBgrBE5hhlT6aAa75f411bgDz/ZL2KZqYV03USvucsxcHUIlGTDTECs1eunpI7HOV7U+WLDvNdQ==", + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.mergewith/-/lodash.mergewith-4.6.2.tgz", + "integrity": "sha512-GK3g5RPZWTRSeLSpgP8Xhra+pnjBC56q9FZYe1d5RN3TJ35dbkGy3YqBSMbyCrlbi+CM9Z3Jk5yTL7RCsqboyQ==", "dev": true }, "lodash.sortby": { @@ -7422,6 +7392,36 @@ "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", "dev": true }, + "minipass": { + "version": "2.3.5", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-2.3.5.tgz", + "integrity": "sha512-Gi1W4k059gyRbyVUZQ4mEqLm0YIUiGYfvxhF6SIlk3ui1WVxMTGfGdQ2SInh3PDrRTVvPKgULkpJtT4RH10+VA==", + "dev": true, + "optional": true, + "requires": { + "safe-buffer": "^5.1.2", + "yallist": "^3.0.0" + }, + "dependencies": { + "yallist": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.0.3.tgz", + "integrity": "sha512-S+Zk8DEWE6oKpV+vI3qWkaK+jSbIK86pCwe2IF/xwIpQ8jEuxpw9NyaGjmp9+BoJv5FV2piqCDcoCtStppiq2A==", + "dev": true, + "optional": true + } + } + }, + "minizlib": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-1.2.1.tgz", + "integrity": "sha512-7+4oTUOWKg7AuL3vloEWekXY2/D20cevzsrNT2kGWm+39J9hGTCBv8VI5Pm5lXZ/o3/mdR4f8rflAPhnQb8mPA==", + "dev": true, + "optional": true, + "requires": { + "minipass": "^2.2.1" + } + }, "mississippi": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/mississippi/-/mississippi-2.0.0.tgz", @@ -7608,6 +7608,31 @@ "resolved": "https://registry.npmjs.org/semver/-/semver-5.3.0.tgz", "integrity": "sha1-myzl094C0XxgEq0yaqa00M9U+U8=", "dev": true + }, + "tar": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/tar/-/tar-2.2.2.tgz", + "integrity": "sha512-FCEhQ/4rE1zYv9rYXJw/msRqsnmlje5jHP6huWeBZ704jUTy02c5AZyWujpMR1ax6mVw9NyJMfuK2CMDWVIfgA==", + "dev": true, + "requires": { + "block-stream": "*", + "fstream": "^1.0.12", + "inherits": "2" + }, + "dependencies": { + "fstream": { + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/fstream/-/fstream-1.0.12.tgz", + "integrity": "sha512-WvJ193OHa0GHPEL+AycEJgxvBEwyfRkN1vhjca23OaPVMCaLCXTd5qAu82AjTcgP1UJmytkOKb63Ypde7raDIg==", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "inherits": "~2.0.0", + "mkdirp": ">=0.5 0", + "rimraf": "2" + } + } + } } } }, @@ -8026,18 +8051,7 @@ "esprima": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", - "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", - "dev": true - }, - "js-yaml": { - "version": "3.13.1", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz", - "integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==", - "dev": true, - "requires": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" - } + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==" }, "parse-json": { "version": "4.0.0", @@ -10720,14 +10734,35 @@ "dev": true }, "tar": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/tar/-/tar-2.2.1.tgz", - "integrity": "sha1-jk0qJWwOIYXGsYrWlK7JaLg8sdE=", + "version": "4.4.10", + "resolved": "https://registry.npmjs.org/tar/-/tar-4.4.10.tgz", + "integrity": "sha512-g2SVs5QIxvo6OLp0GudTqEf05maawKUxXru104iaayWA09551tFCTI8f1Asb4lPfkBr91k07iL4c11XO3/b0tA==", "dev": true, + "optional": true, "requires": { - "block-stream": "*", - "fstream": "^1.0.2", - "inherits": "2" + "chownr": "^1.1.1", + "fs-minipass": "^1.2.5", + "minipass": "^2.3.5", + "minizlib": "^1.2.1", + "mkdirp": "^0.5.0", + "safe-buffer": "^5.1.2", + "yallist": "^3.0.3" + }, + "dependencies": { + "chownr": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.2.tgz", + "integrity": "sha512-GkfeAQh+QNy3wquu9oIZr6SS5x7wGdSgNQvD10X3r+AZr1Oys22HW8kAmDMvNg2+Dm0TeGaEuO8gFwdBXxwO8A==", + "dev": true, + "optional": true + }, + "yallist": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.0.3.tgz", + "integrity": "sha512-S+Zk8DEWE6oKpV+vI3qWkaK+jSbIK86pCwe2IF/xwIpQ8jEuxpw9NyaGjmp9+BoJv5FV2piqCDcoCtStppiq2A==", + "dev": true, + "optional": true + } } }, "terser": { diff --git a/apps/block_scout_web/assets/package.json b/apps/block_scout_web/assets/package.json index 5c92b7b1f9..1169e22859 100644 --- a/apps/block_scout_web/assets/package.json +++ b/apps/block_scout_web/assets/package.json @@ -29,8 +29,8 @@ "highlight.js": "^9.13.1", "highlightjs-solidity": "^1.0.6", "humps": "^2.0.1", - "jquery": "^3.3.1", - "lodash": "^4.17.11", + "jquery": "^3.4.0", + "lodash": "^4.17.13", "moment": "^2.22.1", "nanomorph": "^5.1.3", "numeral": "^2.0.6", diff --git a/apps/block_scout_web/assets/static/images/network-selector-icons/aerum-mainnet.png b/apps/block_scout_web/assets/static/images/network-selector-icons/aerum-mainnet.png deleted file mode 100644 index cdef9a2edb..0000000000 Binary files a/apps/block_scout_web/assets/static/images/network-selector-icons/aerum-mainnet.png and /dev/null differ diff --git a/apps/block_scout_web/assets/static/images/network-selector-icons/callisto-mainnet.png b/apps/block_scout_web/assets/static/images/network-selector-icons/callisto-mainnet.png deleted file mode 100644 index 2e9f2b2730..0000000000 Binary files a/apps/block_scout_web/assets/static/images/network-selector-icons/callisto-mainnet.png and /dev/null differ diff --git a/apps/block_scout_web/assets/static/images/network-selector-icons/callisto-mainnet.svg b/apps/block_scout_web/assets/static/images/network-selector-icons/callisto-mainnet.svg new file mode 100644 index 0000000000..6a11260fa9 --- /dev/null +++ b/apps/block_scout_web/assets/static/images/network-selector-icons/callisto-mainnet.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/apps/block_scout_web/assets/static/images/network-selector-icons/callisto.svg b/apps/block_scout_web/assets/static/images/network-selector-icons/callisto.svg deleted file mode 100644 index 7adabb6538..0000000000 --- a/apps/block_scout_web/assets/static/images/network-selector-icons/callisto.svg +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/apps/block_scout_web/assets/static/images/network-selector-icons/core.svg b/apps/block_scout_web/assets/static/images/network-selector-icons/core.svg deleted file mode 100644 index 63c66a6baa..0000000000 --- a/apps/block_scout_web/assets/static/images/network-selector-icons/core.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/apps/block_scout_web/assets/static/images/network-selector-icons/dai.svg b/apps/block_scout_web/assets/static/images/network-selector-icons/dai.svg deleted file mode 100644 index c4f800733e..0000000000 --- a/apps/block_scout_web/assets/static/images/network-selector-icons/dai.svg +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/apps/block_scout_web/assets/static/images/network-selector-icons/ethereum-classic.png b/apps/block_scout_web/assets/static/images/network-selector-icons/ethereum-classic.png deleted file mode 100755 index 5ca5d8fe7b..0000000000 Binary files a/apps/block_scout_web/assets/static/images/network-selector-icons/ethereum-classic.png and /dev/null differ diff --git a/apps/block_scout_web/assets/static/images/network-selector-icons/ethereum-classic.svg b/apps/block_scout_web/assets/static/images/network-selector-icons/ethereum-classic.svg new file mode 100644 index 0000000000..111605081a --- /dev/null +++ b/apps/block_scout_web/assets/static/images/network-selector-icons/ethereum-classic.svg @@ -0,0 +1,4 @@ + + + + diff --git a/apps/block_scout_web/assets/static/images/network-selector-icons/ethereum-mainnet.png b/apps/block_scout_web/assets/static/images/network-selector-icons/ethereum-mainnet.png deleted file mode 100755 index 3752a92544..0000000000 Binary files a/apps/block_scout_web/assets/static/images/network-selector-icons/ethereum-mainnet.png and /dev/null differ diff --git a/apps/block_scout_web/assets/static/images/network-selector-icons/ethereum-mainnet.svg b/apps/block_scout_web/assets/static/images/network-selector-icons/ethereum-mainnet.svg new file mode 100644 index 0000000000..cb0276593b --- /dev/null +++ b/apps/block_scout_web/assets/static/images/network-selector-icons/ethereum-mainnet.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/apps/block_scout_web/assets/static/images/network-selector-icons/goerli-testnet.png b/apps/block_scout_web/assets/static/images/network-selector-icons/goerli-testnet.png deleted file mode 100644 index 7a3ac4ae48..0000000000 Binary files a/apps/block_scout_web/assets/static/images/network-selector-icons/goerli-testnet.png and /dev/null differ diff --git a/apps/block_scout_web/assets/static/images/network-selector-icons/goerli-testnet.svg b/apps/block_scout_web/assets/static/images/network-selector-icons/goerli-testnet.svg new file mode 100644 index 0000000000..01b44f13a8 --- /dev/null +++ b/apps/block_scout_web/assets/static/images/network-selector-icons/goerli-testnet.svg @@ -0,0 +1,4 @@ + + + + diff --git a/apps/block_scout_web/assets/static/images/network-selector-icons/kovan-testnet.png b/apps/block_scout_web/assets/static/images/network-selector-icons/kovan-testnet.png deleted file mode 100755 index 4fabf2fd71..0000000000 Binary files a/apps/block_scout_web/assets/static/images/network-selector-icons/kovan-testnet.png and /dev/null differ diff --git a/apps/block_scout_web/assets/static/images/network-selector-icons/kovan-testnet.svg b/apps/block_scout_web/assets/static/images/network-selector-icons/kovan-testnet.svg new file mode 100644 index 0000000000..d04f204e62 --- /dev/null +++ b/apps/block_scout_web/assets/static/images/network-selector-icons/kovan-testnet.svg @@ -0,0 +1,4 @@ + + + + diff --git a/apps/block_scout_web/assets/static/images/network-selector-icons/lukso-l14-testnet.svg b/apps/block_scout_web/assets/static/images/network-selector-icons/lukso-l14-testnet.svg new file mode 100644 index 0000000000..bc849bbf9d --- /dev/null +++ b/apps/block_scout_web/assets/static/images/network-selector-icons/lukso-l14-testnet.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/apps/block_scout_web/assets/static/images/network-selector-icons/poa-core.png b/apps/block_scout_web/assets/static/images/network-selector-icons/poa-core.png deleted file mode 100644 index 68bb5976f1..0000000000 Binary files a/apps/block_scout_web/assets/static/images/network-selector-icons/poa-core.png and /dev/null differ diff --git a/apps/block_scout_web/assets/static/images/network-selector-icons/poa-core.svg b/apps/block_scout_web/assets/static/images/network-selector-icons/poa-core.svg new file mode 100644 index 0000000000..f62c0ff8f6 --- /dev/null +++ b/apps/block_scout_web/assets/static/images/network-selector-icons/poa-core.svg @@ -0,0 +1,4 @@ + + + + diff --git a/apps/block_scout_web/assets/static/images/network-selector-icons/poa-sokol.png b/apps/block_scout_web/assets/static/images/network-selector-icons/poa-sokol.png deleted file mode 100644 index da38f9834b..0000000000 Binary files a/apps/block_scout_web/assets/static/images/network-selector-icons/poa-sokol.png and /dev/null differ diff --git a/apps/block_scout_web/assets/static/images/network-selector-icons/poa-sokol.svg b/apps/block_scout_web/assets/static/images/network-selector-icons/poa-sokol.svg new file mode 100644 index 0000000000..98a2fd0cfe --- /dev/null +++ b/apps/block_scout_web/assets/static/images/network-selector-icons/poa-sokol.svg @@ -0,0 +1,4 @@ + + + + diff --git a/apps/block_scout_web/assets/static/images/network-selector-icons/rinkeby-testnet.png b/apps/block_scout_web/assets/static/images/network-selector-icons/rinkeby-testnet.png deleted file mode 100644 index 0e3993eb36..0000000000 Binary files a/apps/block_scout_web/assets/static/images/network-selector-icons/rinkeby-testnet.png and /dev/null differ diff --git a/apps/block_scout_web/assets/static/images/network-selector-icons/rinkeby-testnet.svg b/apps/block_scout_web/assets/static/images/network-selector-icons/rinkeby-testnet.svg new file mode 100644 index 0000000000..7a1c7de013 --- /dev/null +++ b/apps/block_scout_web/assets/static/images/network-selector-icons/rinkeby-testnet.svg @@ -0,0 +1,4 @@ + + + + diff --git a/apps/block_scout_web/assets/static/images/network-selector-icons/rinkeby.svg b/apps/block_scout_web/assets/static/images/network-selector-icons/rinkeby.svg deleted file mode 100644 index 1991096926..0000000000 --- a/apps/block_scout_web/assets/static/images/network-selector-icons/rinkeby.svg +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - diff --git a/apps/block_scout_web/assets/static/images/network-selector-icons/ropsten-testnet.png b/apps/block_scout_web/assets/static/images/network-selector-icons/ropsten-testnet.png deleted file mode 100644 index bc5afa1a2e..0000000000 Binary files a/apps/block_scout_web/assets/static/images/network-selector-icons/ropsten-testnet.png and /dev/null differ diff --git a/apps/block_scout_web/assets/static/images/network-selector-icons/ropsten-testnet.svg b/apps/block_scout_web/assets/static/images/network-selector-icons/ropsten-testnet.svg new file mode 100644 index 0000000000..96ccf5f9b4 --- /dev/null +++ b/apps/block_scout_web/assets/static/images/network-selector-icons/ropsten-testnet.svg @@ -0,0 +1,4 @@ + + + + diff --git a/apps/block_scout_web/assets/static/images/network-selector-icons/ropsten.svg b/apps/block_scout_web/assets/static/images/network-selector-icons/ropsten.svg deleted file mode 100644 index 87c98f79d2..0000000000 --- a/apps/block_scout_web/assets/static/images/network-selector-icons/ropsten.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/apps/block_scout_web/assets/static/images/network-selector-icons/rsk-mainnet.png b/apps/block_scout_web/assets/static/images/network-selector-icons/rsk-mainnet.png deleted file mode 100755 index c7c0e067c8..0000000000 Binary files a/apps/block_scout_web/assets/static/images/network-selector-icons/rsk-mainnet.png and /dev/null differ diff --git a/apps/block_scout_web/assets/static/images/network-selector-icons/rsk-mainnet.svg b/apps/block_scout_web/assets/static/images/network-selector-icons/rsk-mainnet.svg new file mode 100644 index 0000000000..61965fb810 --- /dev/null +++ b/apps/block_scout_web/assets/static/images/network-selector-icons/rsk-mainnet.svg @@ -0,0 +1,4 @@ + + + + diff --git a/apps/block_scout_web/assets/static/images/network-selector-icons/sokol.svg b/apps/block_scout_web/assets/static/images/network-selector-icons/sokol.svg deleted file mode 100644 index b2ced66189..0000000000 --- a/apps/block_scout_web/assets/static/images/network-selector-icons/sokol.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/apps/block_scout_web/assets/static/images/network-selector-icons/xdai-chain.png b/apps/block_scout_web/assets/static/images/network-selector-icons/xdai-chain.png deleted file mode 100644 index 5fb54a4175..0000000000 Binary files a/apps/block_scout_web/assets/static/images/network-selector-icons/xdai-chain.png and /dev/null differ diff --git a/apps/block_scout_web/assets/static/images/network-selector-icons/xdai-chain.svg b/apps/block_scout_web/assets/static/images/network-selector-icons/xdai-chain.svg new file mode 100644 index 0000000000..e6f660410a --- /dev/null +++ b/apps/block_scout_web/assets/static/images/network-selector-icons/xdai-chain.svg @@ -0,0 +1,4 @@ + + + + diff --git a/apps/block_scout_web/lib/block_scout_web/etherscan.ex b/apps/block_scout_web/lib/block_scout_web/etherscan.ex index 867b56e746..021a0b3aa1 100644 --- a/apps/block_scout_web/lib/block_scout_web/etherscan.ex +++ b/apps/block_scout_web/lib/block_scout_web/etherscan.ex @@ -713,11 +713,6 @@ defmodule BlockScoutWeb.Etherscan do type: "timestamp", definition: "When the block was collated.", example: ~s("1480072029") - }, - blockReward: %{ - type: "block reward", - definition: "The reward given to the miner of a block.", - example: ~s("5003251945421042780") } } } diff --git a/apps/block_scout_web/lib/block_scout_web/templates/address_contract/index.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/address_contract/index.html.eex index e8d6501e02..73f1bbe591 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/address_contract/index.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/address_contract/index.html.eex @@ -73,7 +73,7 @@

<%= gettext "Contract ABI" %>

-
@@ -89,7 +89,7 @@ <% {:selfdestructed, transaction_init} -> %>

<%= gettext "Contract Creation Code" %>

-
diff --git a/apps/block_scout_web/lib/block_scout_web/templates/address_logs/_logs.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/address_logs/_logs.html.eex index e49adf8801..92a8ebc6cc 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/address_logs/_logs.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/address_logs/_logs.html.eex @@ -1,4 +1,19 @@
"> + <% decoded_result = decode(@log, @log.transaction) %> + <%= case decoded_result do %> + <%= {:error, :contract_not_verified, _cadidates} -> %> +
+ <%= gettext "To see accurate decoded input data, the contract must be verified." %> + <%= case @log.transaction do %> + <% %{to_address: %{hash: hash}} -> %> + <%= gettext "Verify the contract " %><%= gettext "here" %> + <% _ -> %> + <%= nil %> + <% end %> +
+ <% _ -> %> + <%= nil %> + <% end %>
<%= gettext "Transaction" %>
@@ -11,19 +26,7 @@ ) %>
- <%= case decode(@log, @log.transaction) do %> - <% {:error, :contract_not_verified} -> %> -
<%= gettext "Decoded" %>
-
-
- <%= gettext "To see decoded input data, the contract must be verified." %> - <%= case @log.transaction do %> - <% %{to_address: %{hash: hash}} -> %> - <%= gettext "Verify the contract " %><%= gettext "here" %> - <% _ -> %> - <%= nil %> - <% end %> -
+ <%= case decoded_result do %> <% {:error, :could_not_decode} -> %>
<%= gettext "Decoded" %>
@@ -81,7 +84,61 @@ <% end %> -
+ + <% {:error, :contract_not_verified, results} -> %> + <%= for {:ok, method_id, text, mapping} <- results do %> +
<%= gettext "Decoded" %>
+
+ + + + + + + + + +
Method Id0x<%= method_id %>
Call<%= text %>
+
+ " class="table thead-light table-bordered"> + + + + + + + + <%= for {name, type, indexed?, value} <- mapping do %> + + + + + + + + <% end %> +
<%= gettext "Name" %><%= gettext "Type" %><%= gettext "Indexed?" %><%= gettext "Data" %>
+ <%= case BlockScoutWeb.ABIEncodedValueView.copy_text(type, value) do %> + <% :error -> %> + <%= nil %> + <% copy_text -> %> + + + + + + <% end %> + <%= name %><%= type %><%= indexed? %> +
<%= BlockScoutWeb.ABIEncodedValueView.value_html(type, value) %>
+
+
+ <% end %> <% _ -> %> <%= nil %> <% end %> diff --git a/apps/block_scout_web/lib/block_scout_web/templates/block/overview.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/block/overview.html.eex index 53a63ee9af..26fa5ba725 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/block/overview.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/block/overview.html.eex @@ -10,7 +10,7 @@ -

+

<%= if block_type(@block) == "Block" do %> diff --git a/apps/block_scout_web/lib/block_scout_web/templates/layout/_topnav.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/layout/_topnav.html.eex index 970206636c..9d640e55e5 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/layout/_topnav.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/layout/_topnav.html.eex @@ -99,7 +99,7 @@ <% end %> -

- <%= case decode(@log, @transaction) do %> - <% {:error, :contract_not_verified} -> %> -
<%= gettext "Decoded" %>
-
-
- <%= gettext "To see decoded input data, the contract must be verified." %> - <%= case @transaction do %> - <% %{to_address: %{hash: hash}} -> %> - <%= gettext "Verify the contract " %><%= gettext "here" %> - <% _ -> %> - <%= nil %> - <% end %> -
+ <%= case decoded_result do %> <% {:error, :could_not_decode} -> %>
<%= gettext "Decoded" %>
@@ -83,7 +87,61 @@ <% end %> - + + <% {:error, :contract_not_verified, results} -> %> + <%= for {:ok, method_id, text, mapping} <- results do %> +
<%= gettext "Decoded" %>
+
+ + + + + + + + + +
Method Id0x<%= method_id %>
Call<%= text %>
+
+ " class="table thead-light table-bordered"> + + + + + + + + <%= for {name, type, indexed?, value} <- mapping do %> + + + + + + + + <% end %> +
<%= gettext "Name" %><%= gettext "Type" %><%= gettext "Indexed?" %><%= gettext "Data" %>
+ <%= case BlockScoutWeb.ABIEncodedValueView.copy_text(type, value) do %> + <% :error -> %> + <%= nil %> + <% copy_text -> %> + + + + + + <% end %> + <%= name %><%= type %><%= indexed? %> +
<%= BlockScoutWeb.ABIEncodedValueView.value_html(type, value) %>
+
+
+ <% end %> <% _ -> %> <%= nil %> <% end %> diff --git a/apps/block_scout_web/lib/block_scout_web/views/api/rpc/address_view.ex b/apps/block_scout_web/lib/block_scout_web/views/api/rpc/address_view.ex index 2ec350da71..8063b1db40 100644 --- a/apps/block_scout_web/lib/block_scout_web/views/api/rpc/address_view.ex +++ b/apps/block_scout_web/lib/block_scout_web/views/api/rpc/address_view.ex @@ -157,8 +157,7 @@ defmodule BlockScoutWeb.API.RPC.AddressView do defp prepare_block(block) do %{ "blockNumber" => to_string(block.number), - "timeStamp" => to_string(block.timestamp), - "blockReward" => to_string(block.reward.value) + "timeStamp" => to_string(block.timestamp) } end diff --git a/apps/block_scout_web/mix.exs b/apps/block_scout_web/mix.exs index e54907177f..de55cb0eb7 100644 --- a/apps/block_scout_web/mix.exs +++ b/apps/block_scout_web/mix.exs @@ -99,7 +99,7 @@ defmodule BlockScoutWeb.Mixfile do {:logger_file_backend, "~> 0.0.10"}, {:math, "~> 0.3.0"}, {:mock, "~> 0.3.0", only: [:test], runtime: false}, - {:phoenix, "~> 1.4"}, + {:phoenix, "== 1.4.0"}, {:phoenix_ecto, "~> 4.0"}, {:phoenix_html, "~> 2.10"}, {:phoenix_live_reload, "~> 1.2", only: [:dev]}, diff --git a/apps/block_scout_web/priv/gettext/default.pot b/apps/block_scout_web/priv/gettext/default.pot index 7db99a5e1d..c2c324f51e 100644 --- a/apps/block_scout_web/priv/gettext/default.pot +++ b/apps/block_scout_web/priv/gettext/default.pot @@ -98,7 +98,7 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/address/_validator_metadata_modal.html.eex:16 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:3 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:19 #: lib/block_scout_web/views/address_view.ex:99 msgid "Address" msgstr "" @@ -213,8 +213,8 @@ msgstr "" #: lib/block_scout_web/templates/address/_validator_metadata_modal.html.eex:37 #: lib/block_scout_web/templates/address/overview.html.eex:145 #: lib/block_scout_web/templates/address/overview.html.eex:153 -#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:94 -#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:102 +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:106 +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:114 msgid "Close" msgstr "" @@ -558,11 +558,13 @@ msgid "Must be set to:" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/address_logs/_logs.html.eex:50 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:53 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:106 #: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:52 #: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:59 #: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:19 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:52 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:56 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:109 msgid "Name" msgstr "" @@ -637,7 +639,7 @@ msgstr "" #: lib/block_scout_web/templates/address/overview.html.eex:33 #: lib/block_scout_web/templates/address/overview.html.eex:144 #: lib/block_scout_web/templates/tokens/overview/_details.html.eex:36 -#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:93 +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:105 msgid "QR Code" msgstr "" @@ -846,7 +848,7 @@ msgid "Total transactions" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/address_logs/_logs.html.eex:3 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:18 #: lib/block_scout_web/views/transaction_view.ex:262 msgid "Transaction" msgstr "" @@ -1123,12 +1125,12 @@ msgid "Static Call" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/address_logs/_logs.html.eex:16 -#: lib/block_scout_web/templates/address_logs/_logs.html.eex:28 -#: lib/block_scout_web/templates/address_logs/_logs.html.eex:34 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:16 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:28 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:36 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:31 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:37 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:90 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:32 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:40 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:93 msgid "Decoded" msgstr "" @@ -1137,12 +1139,6 @@ msgstr "" msgid "Method Id" msgstr "" -#, elixir-format -#: lib/block_scout_web/templates/address_logs/_logs.html.eex:19 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:19 -msgid "To see decoded input data, the contract must be verified." -msgstr "" - #, elixir-format #: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:2 #: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:16 @@ -1150,16 +1146,16 @@ msgid "Transaction Inputs" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/address_logs/_logs.html.eex:22 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:9 #: lib/block_scout_web/templates/transaction/_decoded_input.html.eex:11 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:22 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:9 msgid "Verify the contract " msgstr "" #, elixir-format -#: lib/block_scout_web/templates/address_logs/_logs.html.eex:22 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:9 #: lib/block_scout_web/templates/transaction/_decoded_input.html.eex:11 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:22 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:9 msgid "here" msgstr "" @@ -1313,7 +1309,9 @@ msgid "To have guaranteed accuracy, use the link above to verify the contract's msgstr "" #, elixir-format +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:6 #: lib/block_scout_web/templates/transaction/_decoded_input.html.eex:8 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:6 msgid "To see accurate decoded input data, the contract must be verified." msgstr "" @@ -1772,9 +1770,11 @@ msgid "Constructor Arguments" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/address_logs/_logs.html.eex:63 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:66 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:119 #: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:31 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:65 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:69 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:122 msgid "Copy Value" msgstr "" @@ -1784,29 +1784,35 @@ msgid "Create2" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/address_logs/_logs.html.eex:53 -#: lib/block_scout_web/templates/address_logs/_logs.html.eex:118 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:56 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:109 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:175 #: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:21 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:55 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:121 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:59 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:112 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:179 msgid "Data" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/address_logs/_logs.html.eex:31 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:31 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:34 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:35 msgid "Failed to decode log data." msgstr "" #, elixir-format -#: lib/block_scout_web/templates/address_logs/_logs.html.eex:52 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:54 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:55 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:108 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:58 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:111 msgid "Indexed?" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/address_logs/_logs.html.eex:47 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:49 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:50 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:103 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:53 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:106 msgid "Log Data" msgstr "" @@ -1818,14 +1824,21 @@ msgid "Reward" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/address_logs/_logs.html.eex:88 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:91 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:145 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:149 msgid "Topics" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/address_logs/_logs.html.eex:51 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:54 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:107 #: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:20 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:53 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:57 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:110 msgid "Type" msgstr "" + +#, elixir-format +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:75 +msgid "Total Supply" +msgstr "" diff --git a/apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po b/apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po index 08d1c01e20..dd60e9394d 100644 --- a/apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po +++ b/apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po @@ -98,7 +98,7 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/address/_validator_metadata_modal.html.eex:16 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:3 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:19 #: lib/block_scout_web/views/address_view.ex:99 msgid "Address" msgstr "" @@ -213,8 +213,8 @@ msgstr "" #: lib/block_scout_web/templates/address/_validator_metadata_modal.html.eex:37 #: lib/block_scout_web/templates/address/overview.html.eex:145 #: lib/block_scout_web/templates/address/overview.html.eex:153 -#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:94 -#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:102 +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:106 +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:114 msgid "Close" msgstr "" @@ -558,11 +558,13 @@ msgid "Must be set to:" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/address_logs/_logs.html.eex:50 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:53 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:106 #: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:52 #: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:59 #: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:19 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:52 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:56 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:109 msgid "Name" msgstr "" @@ -637,7 +639,7 @@ msgstr "" #: lib/block_scout_web/templates/address/overview.html.eex:33 #: lib/block_scout_web/templates/address/overview.html.eex:144 #: lib/block_scout_web/templates/tokens/overview/_details.html.eex:36 -#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:93 +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:105 msgid "QR Code" msgstr "" @@ -846,7 +848,7 @@ msgid "Total transactions" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/address_logs/_logs.html.eex:3 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:18 #: lib/block_scout_web/views/transaction_view.ex:262 msgid "Transaction" msgstr "" @@ -1123,12 +1125,12 @@ msgid "Static Call" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/address_logs/_logs.html.eex:16 -#: lib/block_scout_web/templates/address_logs/_logs.html.eex:28 -#: lib/block_scout_web/templates/address_logs/_logs.html.eex:34 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:16 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:28 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:36 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:31 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:37 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:90 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:32 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:40 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:93 msgid "Decoded" msgstr "" @@ -1137,12 +1139,6 @@ msgstr "" msgid "Method Id" msgstr "" -#, elixir-format -#: lib/block_scout_web/templates/address_logs/_logs.html.eex:19 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:19 -msgid "To see decoded input data, the contract must be verified." -msgstr "" - #, elixir-format #: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:2 #: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:16 @@ -1150,16 +1146,16 @@ msgid "Transaction Inputs" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/address_logs/_logs.html.eex:22 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:9 #: lib/block_scout_web/templates/transaction/_decoded_input.html.eex:11 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:22 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:9 msgid "Verify the contract " msgstr "" #, elixir-format -#: lib/block_scout_web/templates/address_logs/_logs.html.eex:22 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:9 #: lib/block_scout_web/templates/transaction/_decoded_input.html.eex:11 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:22 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:9 msgid "here" msgstr "" @@ -1314,7 +1310,9 @@ msgid "To have guaranteed accuracy, use the link above to verify the contract's msgstr "" #, elixir-format +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:6 #: lib/block_scout_web/templates/transaction/_decoded_input.html.eex:8 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:6 msgid "To see accurate decoded input data, the contract must be verified." msgstr "" @@ -1773,9 +1771,11 @@ msgid "Constructor Arguments" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/address_logs/_logs.html.eex:63 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:66 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:119 #: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:31 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:65 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:69 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:122 msgid "Copy Value" msgstr "" @@ -1785,29 +1785,35 @@ msgid "Create2" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/address_logs/_logs.html.eex:53 -#: lib/block_scout_web/templates/address_logs/_logs.html.eex:118 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:56 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:109 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:175 #: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:21 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:55 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:121 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:59 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:112 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:179 msgid "Data" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/address_logs/_logs.html.eex:31 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:31 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:34 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:35 msgid "Failed to decode log data." msgstr "" #, elixir-format -#: lib/block_scout_web/templates/address_logs/_logs.html.eex:52 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:54 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:55 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:108 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:58 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:111 msgid "Indexed?" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/address_logs/_logs.html.eex:47 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:49 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:50 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:103 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:53 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:106 msgid "Log Data" msgstr "" @@ -1819,14 +1825,21 @@ msgid "Reward" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/address_logs/_logs.html.eex:88 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:91 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:145 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:149 msgid "Topics" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/address_logs/_logs.html.eex:51 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:54 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:107 #: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:20 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:53 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:57 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:110 msgid "Type" msgstr "" + +#, elixir-format +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:75 +msgid "Total Supply" +msgstr "" diff --git a/apps/block_scout_web/test/block_scout_web/controllers/api/rpc/address_controller_test.exs b/apps/block_scout_web/test/block_scout_web/controllers/api/rpc/address_controller_test.exs index 7e88d4717f..96716f0935 100644 --- a/apps/block_scout_web/test/block_scout_web/controllers/api/rpc/address_controller_test.exs +++ b/apps/block_scout_web/test/block_scout_web/controllers/api/rpc/address_controller_test.exs @@ -2266,7 +2266,7 @@ defmodule BlockScoutWeb.API.RPC.AddressControllerTest do end test "returns all the required fields", %{conn: conn} do - %{block_range: range} = emission_reward = insert(:emission_reward) + %{block_range: range} = insert(:emission_reward) block = insert(:block, number: Enum.random(Range.new(range.from, range.to))) @@ -2274,17 +2274,10 @@ defmodule BlockScoutWeb.API.RPC.AddressControllerTest do |> insert(gas_price: 1) |> with_block(block, gas_used: 1) - expected_reward = - emission_reward.reward - |> Wei.to(:wei) - |> Decimal.add(Decimal.new(1)) - |> Wei.from(:wei) - expected_result = [ %{ "blockNumber" => to_string(block.number), - "timeStamp" => to_string(block.timestamp), - "blockReward" => to_string(expected_reward.value) + "timeStamp" => to_string(block.timestamp) } ] @@ -2306,7 +2299,7 @@ defmodule BlockScoutWeb.API.RPC.AddressControllerTest do end test "with a block with one transaction", %{conn: conn} do - %{block_range: range} = emission_reward = insert(:emission_reward) + %{block_range: range} = insert(:emission_reward) block = insert(:block, number: Enum.random(Range.new(range.from, range.to))) @@ -2314,12 +2307,6 @@ defmodule BlockScoutWeb.API.RPC.AddressControllerTest do |> insert(gas_price: 1) |> with_block(block, gas_used: 1) - expected_reward = - emission_reward.reward - |> Wei.to(:wei) - |> Decimal.add(Decimal.new(1)) - |> Wei.from(:wei) - params = %{ "module" => "account", "action" => "getminedblocks", @@ -2329,8 +2316,7 @@ defmodule BlockScoutWeb.API.RPC.AddressControllerTest do expected_result = [ %{ "blockNumber" => to_string(block.number), - "timeStamp" => to_string(block.timestamp), - "blockReward" => to_string(expected_reward.value) + "timeStamp" => to_string(block.timestamp) } ] @@ -2346,7 +2332,7 @@ defmodule BlockScoutWeb.API.RPC.AddressControllerTest do end test "with pagination options", %{conn: conn} do - %{block_range: range} = emission_reward = insert(:emission_reward) + %{block_range: range} = insert(:emission_reward) block_numbers = Range.new(range.from, range.to) @@ -2361,12 +2347,6 @@ defmodule BlockScoutWeb.API.RPC.AddressControllerTest do |> insert(gas_price: 2) |> with_block(block2, gas_used: 2) - expected_reward = - emission_reward.reward - |> Wei.to(:wei) - |> Decimal.add(Decimal.new(4)) - |> Wei.from(:wei) - params = %{ "module" => "account", "action" => "getminedblocks", @@ -2380,8 +2360,7 @@ defmodule BlockScoutWeb.API.RPC.AddressControllerTest do expected_result = [ %{ "blockNumber" => to_string(block2.number), - "timeStamp" => to_string(block2.timestamp), - "blockReward" => to_string(expected_reward.value) + "timeStamp" => to_string(block2.timestamp) } ] @@ -2683,7 +2662,7 @@ defmodule BlockScoutWeb.API.RPC.AddressControllerTest do }) end - defp resolve_schema(result \\ %{}) do + defp resolve_schema(result) do %{ "type" => "object", "properties" => %{ diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/parity/fetched_beneficiaries.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/parity/fetched_beneficiaries.ex index fea1a4c8aa..b2a90d53bc 100644 --- a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/parity/fetched_beneficiaries.ex +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/parity/fetched_beneficiaries.ex @@ -182,4 +182,5 @@ defmodule EthereumJSONRPC.Parity.FetchedBeneficiaries do defp get_address_type(reward_type, index) when reward_type == "external" and index == 10, do: :validator defp get_address_type(reward_type, _index) when reward_type == "block", do: :validator defp get_address_type(reward_type, _index) when reward_type == "uncle", do: :uncle + defp get_address_type(reward_type, _index) when reward_type == "emptyStep", do: :validator end diff --git a/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/rolling_window_test.exs b/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/rolling_window_test.exs index 43f400434a..5f8db2a821 100644 --- a/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/rolling_window_test.exs +++ b/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/rolling_window_test.exs @@ -1,27 +1,8 @@ defmodule EthereumJSONRPC.RollingWindowTest do - use ExUnit.Case, - # The same named process is used for all tests and they use the same key in the table, so they would interfere - async: false + use ExUnit.Case, async: true alias EthereumJSONRPC.RollingWindow - @table :table - - setup do - # We set `window_length` to a large time frame so that we can sweep manually to simulate - # time passing - {:ok, pid} = - RollingWindow.start_link([table: @table, duration: :timer.minutes(120), window_count: 3], name: RollingWindow) - - on_exit(fn -> Process.exit(pid, :normal) end) - - :ok - end - - defp sweep do - GenServer.call(RollingWindow, :sweep) - end - test "start_link/2" do assert {:ok, _} = RollingWindow.start_link(table: :test_table, duration: 5, window_count: 1) end @@ -29,7 +10,7 @@ defmodule EthereumJSONRPC.RollingWindowTest do describe "init/1" do test "raises when duration isn't evenly divisble by window_count" do assert_raise ArgumentError, ~r"evenly divisible", fn -> - RollingWindow.init(table: @table, duration: :timer.seconds(2), window_count: 3) + RollingWindow.init(table: :init_test_table, duration: :timer.seconds(2), window_count: 3) end end @@ -40,61 +21,85 @@ defmodule EthereumJSONRPC.RollingWindowTest do end test "when no increments have happened, inspect returns an empty list" do - assert RollingWindow.inspect(@table, :foobar) == [] + table = :no_increments_have_happened + start_rolling_window(table) + + assert RollingWindow.inspect(table, :foobar) == [] end test "when no increments have happened, count returns 0" do - assert RollingWindow.count(@table, :foobar) == 0 + table = :no_increments_have_happened_empty_list + start_rolling_window(table) + + assert RollingWindow.count(table, :foobar) == 0 end test "when an increment has happened, inspect returns the count for that window" do - RollingWindow.inc(@table, :foobar) + table = :no_increments_have_happened_count + start_rolling_window(table) - assert RollingWindow.inspect(@table, :foobar) == [1] + RollingWindow.inc(table, :foobar) + + assert RollingWindow.inspect(table, :foobar) == [1] end test "when an increment has happened, count returns the count for that window" do - RollingWindow.inc(@table, :foobar) + table = :no_increments_have_happened_count1 + start_rolling_window(table) + + RollingWindow.inc(table, :foobar) - assert RollingWindow.count(@table, :foobar) == 1 + assert RollingWindow.count(table, :foobar) == 1 end test "when an increment has happened in multiple windows, inspect returns the count for both windows" do - RollingWindow.inc(@table, :foobar) - sweep() - RollingWindow.inc(@table, :foobar) + table = :no_increments_have_happened_multiple_windows + start_rolling_window(table) - assert RollingWindow.inspect(@table, :foobar) == [1, 1] + RollingWindow.inc(table, :foobar) + sweep(table) + RollingWindow.inc(table, :foobar) + + assert RollingWindow.inspect(table, :foobar) == [1, 1] end test "when an increment has happened in multiple windows, count returns the sum of both windows" do - RollingWindow.inc(@table, :foobar) - sweep() - RollingWindow.inc(@table, :foobar) + table = :no_increments_have_happened_multiple_windows1 + start_rolling_window(table) + + RollingWindow.inc(table, :foobar) + sweep(table) + RollingWindow.inc(table, :foobar) - assert RollingWindow.count(@table, :foobar) == 2 + assert RollingWindow.count(table, :foobar) == 2 end test "when an increment has happened, but has been swept times, it no longer appears in inspect" do - RollingWindow.inc(@table, :foobar) - sweep() - sweep() - RollingWindow.inc(@table, :foobar) - sweep() - RollingWindow.inc(@table, :foobar) - - assert RollingWindow.inspect(@table, :foobar) == [1, 1, 0] + table = :no_increments_have_happened_multiple_windows3 + start_rolling_window(table) + + RollingWindow.inc(table, :foobar) + sweep(table) + sweep(table) + RollingWindow.inc(table, :foobar) + sweep(table) + RollingWindow.inc(table, :foobar) + + assert RollingWindow.inspect(table, :foobar) == [1, 1, 0] end test "when an increment has happened, but has been swept times, it no longer is included in count" do - RollingWindow.inc(@table, :foobar) - sweep() - sweep() - RollingWindow.inc(@table, :foobar) - sweep() - RollingWindow.inc(@table, :foobar) - - assert RollingWindow.count(@table, :foobar) == 2 + table = :no_increments_have_happened_multiple_windows4 + start_rolling_window(table) + + RollingWindow.inc(table, :foobar) + sweep(table) + sweep(table) + RollingWindow.inc(table, :foobar) + sweep(table) + RollingWindow.inc(table, :foobar) + + assert RollingWindow.count(table, :foobar) == 2 end test "sweeping schedules another sweep" do @@ -102,4 +107,13 @@ defmodule EthereumJSONRPC.RollingWindowTest do RollingWindow.handle_info(:sweep, state) assert_receive(:sweep) end + + defp start_rolling_window(table_name) do + {:ok, _pid} = + RollingWindow.start_link([table: table_name, duration: :timer.minutes(120), window_count: 3], name: table_name) + end + + defp sweep(name) do + GenServer.call(name, :sweep) + end end diff --git a/apps/explorer/config/config.exs b/apps/explorer/config/config.exs index 95c80ba445..93298073e0 100644 --- a/apps/explorer/config/config.exs +++ b/apps/explorer/config/config.exs @@ -27,7 +27,7 @@ config :explorer, Explorer.Counters.AverageBlockTime, enabled: true, period: average_block_period -config :explorer, Explorer.ChainSpec.GenesisData, enabled: true, chain_spec_path: System.get_env("CHAIN_SPEC_PATH") +config :explorer, Explorer.ChainSpec.GenesisData, enabled: false, chain_spec_path: System.get_env("CHAIN_SPEC_PATH") config :explorer, Explorer.Chain.Cache.BlockNumber, enabled: true diff --git a/apps/explorer/lib/explorer/chain.ex b/apps/explorer/lib/explorer/chain.ex index 58253c0f27..b2c18e8a50 100644 --- a/apps/explorer/lib/explorer/chain.ex +++ b/apps/explorer/lib/explorer/chain.ex @@ -2967,6 +2967,13 @@ defmodule Explorer.Chain do |> CoinBalance.fetch_coin_balances(paging_options) |> page_coin_balances(paging_options) |> Repo.all() + |> Enum.dedup_by(fn record -> + if record.delta == Decimal.new(0) do + :dup + else + System.unique_integer() + end + end) end def get_coin_balance(address_hash, block_number) do diff --git a/apps/explorer/lib/explorer/chain/log.ex b/apps/explorer/lib/explorer/chain/log.ex index b6c5c00a2d..7916b56fb3 100644 --- a/apps/explorer/lib/explorer/chain/log.ex +++ b/apps/explorer/lib/explorer/chain/log.ex @@ -6,7 +6,8 @@ defmodule Explorer.Chain.Log do require Logger alias ABI.{Event, FunctionSelector} - alias Explorer.Chain.{Address, Data, Hash, Transaction} + alias Explorer.Chain.{Address, ContractMethod, Data, Hash, Transaction} + alias Explorer.Repo @required_attrs ~w(address_hash data index transaction_hash)a @optional_attrs ~w(first_topic second_topic third_topic fourth_topic type)a @@ -114,7 +115,50 @@ defmodule Explorer.Chain.Log do do: {:ok, identifier, text, mapping} end - def decode(_log, _transaction), do: {:error, :contract_not_verified} + def decode(log, transaction) do + case log.first_topic do + "0x" <> hex_part -> + case Integer.parse(hex_part, 16) do + {number, ""} -> + <> = :binary.encode_unsigned(number) + find_candidates(method_id, log, transaction) + + _ -> + {:error, :could_not_decode} + end + + _ -> + {:error, :could_not_decode} + end + end + + defp find_candidates(method_id, log, transaction) do + candidates_query = + from( + contract_method in ContractMethod, + where: contract_method.identifier == ^method_id, + limit: 3 + ) + + candidates = + candidates_query + |> Repo.all() + |> Enum.flat_map(fn contract_method -> + case find_and_decode([contract_method.abi], log, transaction) do + {:ok, selector, mapping} -> + identifier = Base.encode16(selector.method_id, case: :lower) + text = function_call(selector.function, mapping) + + [{:ok, identifier, text, mapping}] + + _ -> + [] + end + end) + |> Enum.take(1) + + {:error, :contract_not_verified, candidates} + end defp find_and_decode(abi, log, transaction) do with {%FunctionSelector{} = selector, mapping} <- diff --git a/apps/explorer/lib/explorer/chain/token_transfer.ex b/apps/explorer/lib/explorer/chain/token_transfer.ex index 2aa291cb6f..619de87db2 100644 --- a/apps/explorer/lib/explorer/chain/token_transfer.ex +++ b/apps/explorer/lib/explorer/chain/token_transfer.ex @@ -27,7 +27,7 @@ defmodule Explorer.Chain.TokenTransfer do import Ecto.Changeset import Ecto.Query, only: [from: 2, limit: 2, where: 3] - alias Explorer.Chain.{Address, Hash, Token, TokenTransfer, Transaction} + alias Explorer.Chain.{Address, Hash, TokenTransfer, Transaction} alias Explorer.{PagingOptions, Repo} @default_paging_options %PagingOptions{page_size: 50} @@ -238,12 +238,8 @@ defmodule Explorer.Chain.TokenTransfer do def address_to_unique_tokens(contract_address_hash) do from( tt in TokenTransfer, - join: t in Token, - on: tt.token_contract_address_hash == t.contract_address_hash, - join: ts in Transaction, - on: tt.transaction_hash == ts.hash, - where: t.contract_address_hash == ^contract_address_hash and t.type == "ERC-721", - order_by: [desc: ts.block_number], + where: tt.token_contract_address_hash == ^contract_address_hash, + order_by: [desc: tt.block_number], distinct: tt.token_id, preload: [:to_address], select: tt diff --git a/apps/explorer/lib/explorer/chain_spec/genesis_data.ex b/apps/explorer/lib/explorer/chain_spec/genesis_data.ex index a156aae6d7..690be2eb19 100644 --- a/apps/explorer/lib/explorer/chain_spec/genesis_data.ex +++ b/apps/explorer/lib/explorer/chain_spec/genesis_data.ex @@ -18,7 +18,6 @@ defmodule Explorer.ChainSpec.GenesisData do @impl GenServer def init(_) do - :timer.send_interval(@interval, :import) Process.send_after(self(), :import, @interval) {:ok, %{}} diff --git a/apps/explorer/lib/explorer/etherscan.ex b/apps/explorer/lib/explorer/etherscan.ex index ca31cc5c3c..848f5ae620 100644 --- a/apps/explorer/lib/explorer/etherscan.ex +++ b/apps/explorer/lib/explorer/etherscan.ex @@ -8,8 +8,7 @@ defmodule Explorer.Etherscan do alias Explorer.Etherscan.Logs alias Explorer.{Chain, Repo} alias Explorer.Chain.Address.TokenBalance - alias Explorer.Chain.{Block, Hash, InternalTransaction, Transaction, Wei} - alias Explorer.Chain.Block.EmissionReward + alias Explorer.Chain.{Block, Hash, InternalTransaction, Transaction} @default_options %{ order_by_direction: :asc, @@ -187,22 +186,15 @@ defmodule Explorer.Etherscan do query = from( b in Block, - left_join: t in assoc(b, :transactions), - inner_join: r in EmissionReward, - on: fragment("? <@ ?", b.number, r.block_range), where: b.miner_hash == ^address_hash, order_by: [desc: b.number], group_by: b.number, group_by: b.timestamp, - group_by: r.reward, limit: ^merged_options.page_size, offset: ^offset(merged_options), select: %{ number: b.number, - timestamp: b.timestamp, - reward: %Wei{ - value: fragment("coalesce(sum(? * ?), 0) + ?", t.gas_used, t.gas_price, r.reward) - } + timestamp: b.timestamp } ) diff --git a/apps/explorer/lib/explorer/smart_contract/verifier.ex b/apps/explorer/lib/explorer/smart_contract/verifier.ex index 7aa9957bab..4c2daa680c 100644 --- a/apps/explorer/lib/explorer/smart_contract/verifier.ex +++ b/apps/explorer/lib/explorer/smart_contract/verifier.ex @@ -115,6 +115,14 @@ defmodule Explorer.SmartContract.Verifier do |> Enum.reverse() |> :binary.list_to_bin() + # Solidity >= 0.5.11 https://github.com/ethereum/solidity/blob/develop/Changelog.md#0511-2019-08-12 + # Metadata: Update the swarm hash to the current specification, changes bzzr0 to bzzr1 and urls to use bzz-raw:// + "a265627a7a72315820" <> + <<_::binary-size(64)>> <> "64736f6c6343" <> <<_::binary-size(6)>> <> "0032" <> _constructor_arguments -> + extracted + |> Enum.reverse() + |> :binary.list_to_bin() + <> <> rest -> do_extract_bytecode([next | extracted], rest) end diff --git a/apps/explorer/lib/explorer/smart_contract/verifier/constructor_arguments.ex b/apps/explorer/lib/explorer/smart_contract/verifier/constructor_arguments.ex index 61167a4559..6e25b3cc52 100644 --- a/apps/explorer/lib/explorer/smart_contract/verifier/constructor_arguments.ex +++ b/apps/explorer/lib/explorer/smart_contract/verifier/constructor_arguments.ex @@ -48,6 +48,16 @@ defmodule Explorer.SmartContract.Verifier.ConstructorArguments do extract_constructor_arguments(constructor_arguments, passed_constructor_arguments) end + # Solidity >= 0.5.11 https://github.com/ethereum/solidity/blob/develop/Changelog.md#0511-2019-08-12 + # Metadata: Update the swarm hash to the current specification, changes bzzr0 to bzzr1 and urls to use bzz-raw:// + "a265627a7a72315820" <> + <<_::binary-size(64)>> <> "64736f6c6343" <> <<_::binary-size(6)>> <> "0032" <> constructor_arguments -> + if passed_constructor_arguments == constructor_arguments do + true + else + extract_constructor_arguments(constructor_arguments, passed_constructor_arguments) + end + <<>> -> passed_constructor_arguments == "" diff --git a/apps/explorer/priv/repo/migrations/20190827120224_add_index_on_token_transfer_token_id.exs b/apps/explorer/priv/repo/migrations/20190827120224_add_index_on_token_transfer_token_id.exs new file mode 100644 index 0000000000..b92f216fd4 --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20190827120224_add_index_on_token_transfer_token_id.exs @@ -0,0 +1,7 @@ +defmodule Explorer.Repo.Migrations.AddIndexOnTokenTransferTokenId do + use Ecto.Migration + + def change do + create_if_not_exists(index(:token_transfers, [:token_id])) + end +end diff --git a/apps/explorer/test/explorer/chain/log_test.exs b/apps/explorer/test/explorer/chain/log_test.exs index 28be44a1af..e4ce0695bc 100644 --- a/apps/explorer/test/explorer/chain/log_test.exs +++ b/apps/explorer/test/explorer/chain/log_test.exs @@ -2,7 +2,8 @@ defmodule Explorer.Chain.LogTest do use Explorer.DataCase alias Ecto.Changeset - alias Explorer.Chain.Log + alias Explorer.Chain.{Log, SmartContract} + alias Explorer.Repo doctest Log @@ -47,7 +48,7 @@ defmodule Explorer.Chain.LogTest do log = insert(:log, transaction: transaction) - assert Log.decode(log, transaction) == {:error, :contract_not_verified} + assert Log.decode(log, transaction) == {:error, :could_not_decode} end test "that a contract call transaction that has a verified contract returns the decoded input data" do @@ -100,5 +101,59 @@ defmodule Explorer.Chain.LogTest do {"_belly", "bool", true, true} ]} end + + test "finds decoding candidates" do + params = + params_for(:smart_contract, %{ + abi: [ + %{ + "anonymous" => false, + "inputs" => [ + %{"indexed" => true, "name" => "_from_human", "type" => "string"}, + %{"indexed" => false, "name" => "_number", "type" => "uint256"}, + %{"indexed" => true, "name" => "_belly", "type" => "bool"} + ], + "name" => "WantsPets", + "type" => "event" + } + ] + }) + + # changeset has a callback to insert contract methods + %SmartContract{} + |> SmartContract.changeset(params) + |> Repo.insert!() + + topic1 = "0x" <> Base.encode16(:keccakf1600.hash(:sha3_256, "WantsPets(string,uint256,bool)"), case: :lower) + topic2 = "0x" <> Base.encode16(:keccakf1600.hash(:sha3_256, "bob"), case: :lower) + topic3 = "0x0000000000000000000000000000000000000000000000000000000000000001" + data = "0x0000000000000000000000000000000000000000000000000000000000000000" + + transaction = insert(:transaction) + + log = + insert(:log, + transaction: transaction, + first_topic: topic1, + second_topic: topic2, + third_topic: topic3, + fourth_topic: nil, + data: data + ) + + assert Log.decode(log, transaction) == + {:error, :contract_not_verified, + [ + {:ok, "eb9b3c4c", "WantsPets(string indexed _from_human, uint256 _number, bool indexed _belly)", + [ + {"_from_human", "string", true, + {:dynamic, + <<56, 228, 122, 123, 113, 157, 206, 99, 102, 42, 234, 244, 52, 64, 50, 111, 85, 27, 138, 126, + 225, 152, 206, 227, 92, 181, 213, 23, 242, 210, 150, 162>>}}, + {"_number", "uint256", false, 0}, + {"_belly", "bool", true, true} + ]} + ]} + end end end diff --git a/apps/explorer/test/explorer/chain/token_transfer_test.exs b/apps/explorer/test/explorer/chain/token_transfer_test.exs index 5d9608e66b..b388fafcbe 100644 --- a/apps/explorer/test/explorer/chain/token_transfer_test.exs +++ b/apps/explorer/test/explorer/chain/token_transfer_test.exs @@ -188,31 +188,6 @@ defmodule Explorer.Chain.TokenTransferTest do assert Enum.map(results, & &1.token_id) == [last_owner.token_id] assert Enum.map(results, & &1.to_address_hash) == [last_owner.to_address_hash] end - - test "won't return tokens that aren't uniques" do - token_contract_address = insert(:contract_address) - token = insert(:token, contract_address: token_contract_address, type: "ERC-20") - - transaction = - :transaction - |> insert() - |> with_block(insert(:block, number: 1)) - - insert( - :token_transfer, - to_address: build(:address), - transaction: transaction, - token_contract_address: token_contract_address, - token: token - ) - - results = - token_contract_address.hash - |> TokenTransfer.address_to_unique_tokens() - |> Repo.all() - - assert results == [] - end end describe "where_any_address_fields_match/3" do diff --git a/apps/explorer/test/explorer/chain_test.exs b/apps/explorer/test/explorer/chain_test.exs index f49be6da4e..10788b60ba 100644 --- a/apps/explorer/test/explorer/chain_test.exs +++ b/apps/explorer/test/explorer/chain_test.exs @@ -4159,4 +4159,30 @@ defmodule Explorer.ChainTest do assert Chain.staking_pools_count(:inactive) == 1 end end + + describe "address_to_coin_balances/2" do + test "deduplicates records by zero delta" do + address = insert(:address) + + 1..5 + |> Enum.each(fn block_number -> + insert(:block, number: block_number) + insert(:fetched_balance, value: 1, block_number: block_number, address_hash: address.hash) + end) + + insert(:block, number: 6) + insert(:fetched_balance, value: 2, block_number: 6, address_hash: address.hash) + + assert [first, second, third] = Chain.address_to_coin_balances(address.hash, []) + + assert first.block_number == 6 + assert first.delta == Decimal.new(1) + + assert second.block_number == 5 + assert second.delta == Decimal.new(0) + + assert third.block_number == 1 + assert third.delta == Decimal.new(1) + end + end end diff --git a/apps/explorer/test/explorer/etherscan_test.exs b/apps/explorer/test/explorer/etherscan_test.exs index 420dd3e7d2..ded7f2cc30 100644 --- a/apps/explorer/test/explorer/etherscan_test.exs +++ b/apps/explorer/test/explorer/etherscan_test.exs @@ -4,7 +4,7 @@ defmodule Explorer.EtherscanTest do import Explorer.Factory alias Explorer.{Etherscan, Chain} - alias Explorer.Chain.{Transaction, Wei} + alias Explorer.Chain.Transaction describe "list_transactions/2" do test "with empty db" do @@ -1170,7 +1170,7 @@ defmodule Explorer.EtherscanTest do describe "list_blocks/1" do test "it returns all required fields" do - %{block_range: range} = emission_reward = insert(:emission_reward) + %{block_range: range} = insert(:emission_reward) block = insert(:block, number: Enum.random(Range.new(range.from, range.to))) @@ -1181,17 +1181,10 @@ defmodule Explorer.EtherscanTest do |> insert(gas_price: 1) |> with_block(block, gas_used: 1) - expected_reward = - emission_reward.reward - |> Wei.to(:wei) - |> Decimal.add(Decimal.new(1)) - |> Wei.from(:wei) - expected = [ %{ number: block.number, - timestamp: block.timestamp, - reward: expected_reward + timestamp: block.timestamp } ] @@ -1199,32 +1192,14 @@ defmodule Explorer.EtherscanTest do end test "with block containing multiple transactions" do - %{block_range: range} = emission_reward = insert(:emission_reward) + %{block_range: range} = insert(:emission_reward) block = insert(:block, number: Enum.random(Range.new(range.from, range.to))) - # irrelevant transaction - insert(:transaction) - - :transaction - |> insert(gas_price: 1) - |> with_block(block, gas_used: 1) - - :transaction - |> insert(gas_price: 1) - |> with_block(block, gas_used: 2) - - expected_reward = - emission_reward.reward - |> Wei.to(:wei) - |> Decimal.add(Decimal.new(3)) - |> Wei.from(:wei) - expected = [ %{ number: block.number, - timestamp: block.timestamp, - reward: expected_reward + timestamp: block.timestamp } ] @@ -1232,7 +1207,7 @@ defmodule Explorer.EtherscanTest do end test "with block without transactions" do - %{block_range: range} = emission_reward = insert(:emission_reward) + %{block_range: range} = insert(:emission_reward) block = insert(:block, number: Enum.random(Range.new(range.from, range.to))) @@ -1242,8 +1217,7 @@ defmodule Explorer.EtherscanTest do expected = [ %{ number: block.number, - timestamp: block.timestamp, - reward: emission_reward.reward + timestamp: block.timestamp } ] @@ -1251,7 +1225,7 @@ defmodule Explorer.EtherscanTest do end test "with multiple blocks" do - %{block_range: range} = emission_reward = insert(:emission_reward) + %{block_range: range} = insert(:emission_reward) block_numbers = Range.new(range.from, range.to) @@ -1262,47 +1236,14 @@ defmodule Explorer.EtherscanTest do block1 = insert(:block, number: block_number1, miner: address) block2 = insert(:block, number: block_number2, miner: address) - # irrelevant transaction - insert(:transaction) - - :transaction - |> insert(gas_price: 2) - |> with_block(block1, gas_used: 2) - - :transaction - |> insert(gas_price: 2) - |> with_block(block1, gas_used: 2) - - :transaction - |> insert(gas_price: 3) - |> with_block(block2, gas_used: 3) - - :transaction - |> insert(gas_price: 3) - |> with_block(block2, gas_used: 3) - - expected_reward_block1 = - emission_reward.reward - |> Wei.to(:wei) - |> Decimal.add(Decimal.new(8)) - |> Wei.from(:wei) - - expected_reward_block2 = - emission_reward.reward - |> Wei.to(:wei) - |> Decimal.add(Decimal.new(18)) - |> Wei.from(:wei) - expected = [ %{ number: block2.number, - timestamp: block2.timestamp, - reward: expected_reward_block2 + timestamp: block2.timestamp }, %{ number: block1.number, - timestamp: block1.timestamp, - reward: expected_reward_block1 + timestamp: block1.timestamp } ] @@ -1310,7 +1251,7 @@ defmodule Explorer.EtherscanTest do end test "with pagination options" do - %{block_range: range} = emission_reward = insert(:emission_reward) + %{block_range: range} = insert(:emission_reward) block_numbers = Range.new(range.from, range.to) @@ -1321,29 +1262,17 @@ defmodule Explorer.EtherscanTest do block1 = insert(:block, number: block_number1, miner: address) block2 = insert(:block, number: block_number2, miner: address) - :transaction - |> insert(gas_price: 2) - |> with_block(block1, gas_used: 2) - - expected_reward = - emission_reward.reward - |> Wei.to(:wei) - |> Decimal.add(Decimal.new(4)) - |> Wei.from(:wei) - expected1 = [ %{ number: block2.number, - timestamp: block2.timestamp, - reward: emission_reward.reward + timestamp: block2.timestamp } ] expected2 = [ %{ number: block1.number, - timestamp: block1.timestamp, - reward: expected_reward + timestamp: block1.timestamp } ] diff --git a/apps/explorer/test/explorer/smart_contract/verifier_test.exs b/apps/explorer/test/explorer/smart_contract/verifier_test.exs index 9633804c60..fba0622964 100644 --- a/apps/explorer/test/explorer/smart_contract/verifier_test.exs +++ b/apps/explorer/test/explorer/smart_contract/verifier_test.exs @@ -56,6 +56,33 @@ defmodule Explorer.SmartContract.VerifierTest do assert abi != nil end + test "verifies smart contract with new `whisper` metadata (bzz0 => bzz1) in solidity 0.5.11" do + contract_data = + "#{File.cwd!()}/test/support/fixture/smart_contract/solidity_5.11_new_whisper_metadata.json" + |> File.read!() + |> Jason.decode!() + + compiler_version = contract_data["compiler_version"] + name = contract_data["name"] + optimize = false + contract = contract_data["contract"] + expected_bytecode = contract_data["bytecode"] + evm_version = contract_data["evm_version"] + + contract_address = insert(:contract_address, contract_code: "0x" <> expected_bytecode) + + params = %{ + "contract_source_code" => contract, + "compiler_version" => compiler_version, + "evm_version" => evm_version, + "name" => name, + "optimization" => optimize + } + + assert {:ok, %{abi: abi}} = Verifier.evaluate_authenticity(contract_address.hash, params) + assert abi != nil + end + test "verifies smart contract with constructor arguments", %{ contract_code_info: contract_code_info } do diff --git a/apps/explorer/test/support/fixture/smart_contract/solidity_5.11_new_whisper_metadata.json b/apps/explorer/test/support/fixture/smart_contract/solidity_5.11_new_whisper_metadata.json new file mode 100644 index 0000000000..bd0301ef78 --- /dev/null +++ b/apps/explorer/test/support/fixture/smart_contract/solidity_5.11_new_whisper_metadata.json @@ -0,0 +1,7 @@ +{ + "bytecode": "608060405260043610610105576000357c0100000000000000000000000000000000000000000000000000000000900480638da5cb5b116100a7578063d4ee1d9011610076578063d4ee1d90146105dc578063dc39d06d14610633578063dd62ed3e146106a6578063f2fde38b1461072b57610105565b80638da5cb5b1461037857806395d89b41146103cf578063a9059cbb1461045f578063cae9ca51146104d257610105565b806323b872dd116100e357806323b872dd14610238578063313ce567146102cb57806370a08231146102fc57806379ba50971461036157610105565b806306fdde031461010a578063095ea7b31461019a57806318160ddd1461020d575b600080fd5b34801561011657600080fd5b5061011f61077c565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561015f578082015181840152602081019050610144565b50505050905090810190601f16801561018c5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101a657600080fd5b506101f3600480360360408110156101bd57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061081a565b604051808215151515815260200191505060405180910390f35b34801561021957600080fd5b5061022261090c565b6040518082815260200191505060405180910390f35b34801561024457600080fd5b506102b16004803603606081101561025b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610967565b604051808215151515815260200191505060405180910390f35b3480156102d757600080fd5b506102e0610c12565b604051808260ff1660ff16815260200191505060405180910390f35b34801561030857600080fd5b5061034b6004803603602081101561031f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610c25565b6040518082815260200191505060405180910390f35b34801561036d57600080fd5b50610376610c6e565b005b34801561038457600080fd5b5061038d610e0b565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156103db57600080fd5b506103e4610e30565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610424578082015181840152602081019050610409565b50505050905090810190601f1680156104515780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561046b57600080fd5b506104b86004803603604081101561048257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610ece565b604051808215151515815260200191505060405180910390f35b3480156104de57600080fd5b506105c2600480360360608110156104f557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291908035906020019064010000000081111561053c57600080fd5b82018360208201111561054e57600080fd5b8035906020019184600183028401116401000000008311171561057057600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290505050611069565b604051808215151515815260200191505060405180910390f35b3480156105e857600080fd5b506105f16112b8565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561063f57600080fd5b5061068c6004803603604081101561065657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506112de565b604051808215151515815260200191505060405180910390f35b3480156106b257600080fd5b50610715600480360360408110156106c957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611440565b6040518082815260200191505060405180910390f35b34801561073757600080fd5b5061077a6004803603602081101561074e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506114c7565b005b60038054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108125780601f106107e757610100808354040283529160200191610812565b820191906000526020600020905b8154815290600101906020018083116107f557829003601f168201915b505050505081565b600081600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000610962600660008073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205460055461156490919063ffffffff16565b905090565b60006109bb82600660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461156490919063ffffffff16565b600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610a8d82600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461156490919063ffffffff16565b600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610b5f82600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461157e90919063ffffffff16565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600460009054906101000a900460ff1681565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610cc857600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60028054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610ec65780601f10610e9b57610100808354040283529160200191610ec6565b820191906000526020600020905b815481529060010190602001808311610ea957829003601f168201915b505050505081565b6000610f2282600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461156490919063ffffffff16565b600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610fb782600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461157e90919063ffffffff16565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600082600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925856040518082815260200191505060405180910390a38373ffffffffffffffffffffffffffffffffffffffff16638f4ffcb1338530866040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200180602001828103825283818151815260200191508051906020019080838360005b8381101561124657808201518184015260208101905061122b565b50505050905090810190601f1680156112735780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b15801561129557600080fd5b505af11580156112a9573d6000803e3d6000fd5b50505050600190509392505050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461133957600080fd5b8273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156113fd57600080fd5b505af1158015611411573d6000803e3d6000fd5b505050506040513d602081101561142757600080fd5b8101908080519060200190929190505050905092915050565b6000600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461152057600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008282111561157357600080fd5b818303905092915050565b600081830190508281101561159257600080fd5b9291505056fea265627a7a7231582073fbadbc806cc1f3349b3f98d58b62f7fa417e82d98f41bafd3dd9f9be4e4fa764736f6c634300050b0032", + "compiler_version": "v0.5.11+commit.c082d0b4", + "contract": "/**\r\n *Submitted for verification at Etherscan.io on 2019-08-16\r\n*/\r\n\r\npragma solidity ^0.5.0;\r\n\r\n\r\n// ----------------------------------------------------------------------------\r\n\r\n// 'FIXED' 'Example Fixed Supply Token' token contract\r\n\r\n//\r\n\r\n// Symbol : FIXED\r\n\r\n// Name : Example Fixed Supply Token\r\n\r\n// Total supply: 1,000,000.000000000000000000\r\n\r\n// Decimals : 18\r\n\r\n//\r\n\r\n// Enjoy.\r\n\r\n//\r\n\r\n// (c) BokkyPooBah / Bok Consulting Pty Ltd 2018. The MIT Licence.\r\n\r\n// ----------------------------------------------------------------------------\r\n\r\n\r\n\r\n// ----------------------------------------------------------------------------\r\n\r\n// Safe maths\r\n\r\n// ----------------------------------------------------------------------------\r\n\r\nlibrary SafeMath {\r\n\r\n function add(uint a, uint b) internal pure returns (uint c) {\r\n\r\n c = a + b;\r\n\r\n require(c >= a);\r\n\r\n }\r\n\r\n function sub(uint a, uint b) internal pure returns (uint c) {\r\n\r\n require(b <= a);\r\n\r\n c = a - b;\r\n\r\n }\r\n\r\n function mul(uint a, uint b) internal pure returns (uint c) {\r\n\r\n c = a * b;\r\n\r\n require(a == 0 || c / a == b);\r\n\r\n }\r\n\r\n function div(uint a, uint b) internal pure returns (uint c) {\r\n\r\n require(b > 0);\r\n\r\n c = a / b;\r\n\r\n }\r\n\r\n}\r\n\r\n\r\n\r\n// ----------------------------------------------------------------------------\r\n\r\n// ERC Token Standard #20 Interface\r\n\r\n// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md\r\n\r\n// ----------------------------------------------------------------------------\r\n\r\ncontract ERC20Interface {\r\n\r\n function totalSupply() public view returns (uint);\r\n\r\n function balanceOf(address tokenOwner) public view returns (uint balance);\r\n\r\n function allowance(address tokenOwner, address spender) public view returns (uint remaining);\r\n\r\n function transfer(address to, uint tokens) public returns (bool success);\r\n\r\n function approve(address spender, uint tokens) public returns (bool success);\r\n\r\n function transferFrom(address from, address to, uint tokens) public returns (bool success);\r\n\r\n\r\n event Transfer(address indexed from, address indexed to, uint tokens);\r\n\r\n event Approval(address indexed tokenOwner, address indexed spender, uint tokens);\r\n\r\n}\r\n\r\n\r\n\r\n// ----------------------------------------------------------------------------\r\n\r\n// Contract function to receive approval and execute function in one call\r\n\r\n//\r\n\r\n// Borrowed from MiniMeToken\r\n\r\n// ----------------------------------------------------------------------------\r\n\r\ncontract ApproveAndCallFallBack {\r\n\r\n function receiveApproval(address from, uint256 tokens, address token, bytes memory data) public;\r\n\r\n}\r\n\r\n\r\n\r\n// ----------------------------------------------------------------------------\r\n\r\n// Owned contract\r\n\r\n// ----------------------------------------------------------------------------\r\n\r\ncontract Owned {\r\n\r\n address public owner;\r\n\r\n address public newOwner;\r\n\r\n\r\n event OwnershipTransferred(address indexed _from, address indexed _to);\r\n\r\n\r\n constructor() public {\r\n\r\n owner = msg.sender;\r\n\r\n }\r\n\r\n\r\n modifier onlyOwner {\r\n\r\n require(msg.sender == owner);\r\n\r\n _;\r\n\r\n }\r\n\r\n\r\n function transferOwnership(address _newOwner) public onlyOwner {\r\n\r\n newOwner = _newOwner;\r\n\r\n }\r\n\r\n function acceptOwnership() public {\r\n\r\n require(msg.sender == newOwner);\r\n\r\n emit OwnershipTransferred(owner, newOwner);\r\n\r\n owner = newOwner;\r\n\r\n newOwner = address(0);\r\n\r\n }\r\n\r\n}\r\n\r\n\r\n\r\n// ----------------------------------------------------------------------------\r\n\r\n// ERC20 Token, with the addition of symbol, name and decimals and a\r\n\r\n// fixed supply\r\n\r\n// ----------------------------------------------------------------------------\r\n\r\ncontract FixedSupplyToken is ERC20Interface, Owned {\r\n\r\n using SafeMath for uint;\r\n\r\n\r\n string public symbol;\r\n\r\n string public name;\r\n\r\n uint8 public decimals;\r\n\r\n uint _totalSupply;\r\n\r\n\r\n mapping(address => uint) balances;\r\n\r\n mapping(address => mapping(address => uint)) allowed;\r\n\r\n\r\n\r\n // ------------------------------------------------------------------------\r\n\r\n // Constructor\r\n\r\n // ------------------------------------------------------------------------\r\n\r\n constructor() public {\r\n\r\n symbol = \"TEST\";\r\n\r\n name = \"Test Token\";\r\n\r\n decimals = 18;\r\n\r\n _totalSupply = 1000000 * 10**uint(decimals);\r\n\r\n balances[owner] = _totalSupply;\r\n\r\n emit Transfer(address(0), owner, _totalSupply);\r\n\r\n }\r\n\r\n\r\n\r\n // ------------------------------------------------------------------------\r\n\r\n // Total supply\r\n\r\n // ------------------------------------------------------------------------\r\n\r\n function totalSupply() public view returns (uint) {\r\n\r\n return _totalSupply.sub(balances[address(0)]);\r\n\r\n }\r\n\r\n\r\n\r\n // ------------------------------------------------------------------------\r\n\r\n // Get the token balance for account `tokenOwner`\r\n\r\n // ------------------------------------------------------------------------\r\n\r\n function balanceOf(address tokenOwner) public view returns (uint balance) {\r\n\r\n return balances[tokenOwner];\r\n\r\n }\r\n\r\n\r\n\r\n // ------------------------------------------------------------------------\r\n\r\n // Transfer the balance from token owner's account to `to` account\r\n\r\n // - Owner's account must have sufficient balance to transfer\r\n\r\n // - 0 value transfers are allowed\r\n\r\n // ------------------------------------------------------------------------\r\n\r\n function transfer(address to, uint tokens) public returns (bool success) {\r\n\r\n balances[msg.sender] = balances[msg.sender].sub(tokens);\r\n\r\n balances[to] = balances[to].add(tokens);\r\n\r\n emit Transfer(msg.sender, to, tokens);\r\n\r\n return true;\r\n\r\n }\r\n\r\n\r\n\r\n // ------------------------------------------------------------------------\r\n\r\n // Token owner can approve for `spender` to transferFrom(...) `tokens`\r\n\r\n // from the token owner's account\r\n\r\n //\r\n\r\n // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md\r\n\r\n // recommends that there are no checks for the approval double-spend attack\r\n\r\n // as this should be implemented in user interfaces\r\n\r\n // ------------------------------------------------------------------------\r\n\r\n function approve(address spender, uint tokens) public returns (bool success) {\r\n\r\n allowed[msg.sender][spender] = tokens;\r\n\r\n emit Approval(msg.sender, spender, tokens);\r\n\r\n return true;\r\n\r\n }\r\n\r\n\r\n\r\n // ------------------------------------------------------------------------\r\n\r\n // Transfer `tokens` from the `from` account to the `to` account\r\n\r\n //\r\n\r\n // The calling account must already have sufficient tokens approve(...)-d\r\n\r\n // for spending from the `from` account and\r\n\r\n // - From account must have sufficient balance to transfer\r\n\r\n // - Spender must have sufficient allowance to transfer\r\n\r\n // - 0 value transfers are allowed\r\n\r\n // ------------------------------------------------------------------------\r\n\r\n function transferFrom(address from, address to, uint tokens) public returns (bool success) {\r\n\r\n balances[from] = balances[from].sub(tokens);\r\n\r\n allowed[from][msg.sender] = allowed[from][msg.sender].sub(tokens);\r\n\r\n balances[to] = balances[to].add(tokens);\r\n\r\n emit Transfer(from, to, tokens);\r\n\r\n return true;\r\n\r\n }\r\n\r\n\r\n\r\n // ------------------------------------------------------------------------\r\n\r\n // Returns the amount of tokens approved by the owner that can be\r\n\r\n // transferred to the spender's account\r\n\r\n // ------------------------------------------------------------------------\r\n\r\n function allowance(address tokenOwner, address spender) public view returns (uint remaining) {\r\n\r\n return allowed[tokenOwner][spender];\r\n\r\n }\r\n\r\n\r\n\r\n // ------------------------------------------------------------------------\r\n\r\n // Token owner can approve for `spender` to transferFrom(...) `tokens`\r\n\r\n // from the token owner's account. The `spender` contract function\r\n\r\n // `receiveApproval(...)` is then executed\r\n\r\n // ------------------------------------------------------------------------\r\n\r\n function approveAndCall(address spender, uint tokens, bytes memory data) public returns (bool success) {\r\n\r\n allowed[msg.sender][spender] = tokens;\r\n\r\n emit Approval(msg.sender, spender, tokens);\r\n\r\n ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, address(this), data);\r\n\r\n return true;\r\n\r\n }\r\n\r\n\r\n\r\n // ------------------------------------------------------------------------\r\n\r\n // Don't accept ETH\r\n\r\n // ------------------------------------------------------------------------\r\n\r\n function () external payable {\r\n\r\n revert();\r\n\r\n }\r\n\r\n\r\n\r\n // ------------------------------------------------------------------------\r\n\r\n // Owner can transfer out any accidentally sent ERC20 tokens\r\n\r\n // ------------------------------------------------------------------------\r\n\r\n function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) {\r\n\r\n return ERC20Interface(tokenAddress).transfer(owner, tokens);\r\n\r\n }\r\n\r\n}", + "name": "FixedSupplyToken", + "evm_version": "byzantium" +} diff --git a/apps/indexer/lib/indexer/block/fetcher.ex b/apps/indexer/lib/indexer/block/fetcher.ex index 6a4eb3661b..a8b28d1391 100644 --- a/apps/indexer/lib/indexer/block/fetcher.ex +++ b/apps/indexer/lib/indexer/block/fetcher.ex @@ -183,7 +183,7 @@ defmodule Indexer.Block.Fetcher do end end - defp update_block_cache(blocks) do + defp update_block_cache(blocks) when is_list(blocks) do max_block = Enum.max_by(blocks, fn block -> block.number end) min_block = Enum.min_by(blocks, fn block -> block.number end) @@ -192,6 +192,8 @@ defmodule Indexer.Block.Fetcher do BlocksCache.update(blocks) end + defp update_block_cache(_), do: :ok + defp update_transactions_cache(transactions) do Transactions.update(transactions) end diff --git a/docs/env-variables.md b/docs/env-variables.md index 60c9eee442..a0fae07bc3 100644 --- a/docs/env-variables.md +++ b/docs/env-variables.md @@ -14,52 +14,54 @@ $ export NETWORK=POA ``` -| Variable | Required | Description | Default | Version | -| --- | --- | --- | ---| --- | -| `NETWORK`| :white_check_mark: | Environment variable for the main EVM network such as Ethereum Network or POA Network | POA Network | all | -| `SUBNETWORK` | :white_check_mark: | Environment variable for the subnetwork such as Core or Sokol Network | Sokol Testnet | all | -| `NETWORK_ICON` | :white_check_mark: | Environment variable for the main network icon or testnet icon. Two options are `_test_network_icon.html` and `_network_icon.html` | `_test_network_icon.html` | all | -| `LOGO` | :white_check_mark: | Environment variable for the logo image location. The logo files names for different chains can be found [here](https://github.com/poanetwork/blockscout/tree/master/apps/block_scout_web/assets/static/images) | /images/blockscout_logo.svg | all | -| `ETHEREUM_JSONRPC_VARIANT` | :white_check_mark: | This environment variable is used to tell the application which RPC Client the node is using (i.e. Geth, Parity, or Ganache) | parity | all | -| `ETHEREUM_JSONRPC_HTTP_URL` | :white_check_mark: | The RPC endpoint used to fetch blocks, transactions, receipts, tokens. | localhost:8545 | all | -| `ETHEREUM_JSONRPC_TRACE_URL` | | The RPC endpoint specifically for the Geth/Parity client used by trace_block and trace_replayTransaction. This can be used to designate a tracing node. | localhost:8545 | all | -| `ETHEREUM_JSONRPC_WS_URL` | :white_check_mark: | The WebSockets RPC endpoint used to subscribe to the `newHeads` subscription alerting the indexer to fetch new blocks. | ws://localhost:8546 | all | -| `NETWORK_PATH` | | Used to set a network path other than what is displayed in the root directory. An example would be to add /eth/mainnet/ to the root directory. | (empty) | all | -| `SECRET_KEY_BASE` | :white_check_mark: | Use mix phx.gen.secret to generate a new Secret Key Base string to protect production assets. | (empty) | all | -| `CHECK_ORIGIN` | | Used to check the origin of requests when the origin header is present. It defaults to false. In case of true, it will check against the host value. | false | all | -| `PORT` | :white_check_mark: | Default port the application runs on is 4000 | 4000 | all | -| `COIN` | :white_check_mark: | The coin here is checked via the Coinmarketcap API to obtain USD prices on graphs and other areas of the UI | POA | all | -| `METADATA_CONTRACT` | | This environment variable is specifically used by POA Network to obtain Validators information to display in the UI. | (empty) | all | -| `VALIDATORS_CONTRACT` | | This environment variable is specifically used by POA Network to obtain the Emission Fund contract. | (empty) | all | -| `SUPPLY_MODULE` | | This environment variable is used by the xDai Chain in order to tell the application how to calculate the total supply of the chain. | false | all | -| `SOURCE_MODULE` | | This environment variable is used to calculate the exchange rate and is specifically used by the xDai Chain. | false | all | -| `DATABASE_URL` | | Production environment variable to define the Database endpoint. | (empty) | all | -| `POOL_SIZE` | | Production environment variable to define the number of database connections allowed. | 20 | all | -| `ECTO_USE_SSL` | | Production environment variable to use SSL on Ecto queries. | true | all | -| `DATADOG_HOST` | | Host configuration setting for [Datadog integration](https://docs.datadoghq.com/integrations/) | (empty) | all | -| `DATADOG_PORT` | | Port configuration setting for [Datadog integration](https://docs.datadoghq.com/integrations/). | (empty} | all | +| Variable | Required | Description | Default | Version | Need recompile | +| --- | --- | --- | ---| --- | --- | +| `NETWORK`| :white_check_mark: | Environment variable for the main EVM network such as Ethereum Network or POA Network | POA Network | all | | +| `SUBNETWORK` | :white_check_mark: | Environment variable for the subnetwork such as Core or Sokol Network | Sokol Testnet | all | | +| `NETWORK_ICON` | :white_check_mark: | Environment variable for the main network icon or testnet icon. Two options are `_test_network_icon.html` and `_network_icon.html` | `_test_network_icon.html` | all | | +| `LOGO` | :white_check_mark: | Environment variable for the logo image location. The logo files names for different chains can be found [here](https://github.com/poanetwork/blockscout/tree/master/apps/block_scout_web/assets/static/images) | /images/blockscout_logo.svg | all | | +| `ETHEREUM_JSONRPC_VARIANT` | :white_check_mark: | This environment variable is used to tell the application which RPC Client the node is using (i.e. Geth, Parity, or Ganache) | parity | all | | +| `ETHEREUM_JSONRPC_HTTP_URL` | :white_check_mark: | The RPC endpoint used to fetch blocks, transactions, receipts, tokens. | localhost:8545 | all | | +| `ETHEREUM_JSONRPC_TRACE_URL` | | The RPC endpoint specifically for the Geth/Parity client used by trace_block and trace_replayTransaction. This can be used to designate a tracing node. | localhost:8545 | all | | +| `ETHEREUM_JSONRPC_WS_URL` | :white_check_mark: | The WebSockets RPC endpoint used to subscribe to the `newHeads` subscription alerting the indexer to fetch new blocks. | ws://localhost:8546 | all | | +| `NETWORK_PATH` | | Used to set a network path other than what is displayed in the root directory. An example would be to add /eth/mainnet/ to the root directory. | (empty) | all | | +| `SECRET_KEY_BASE` | :white_check_mark: | Use mix phx.gen.secret to generate a new Secret Key Base string to protect production assets. | (empty) | all | | +| `CHECK_ORIGIN` | | Used to check the origin of requests when the origin header is present. It defaults to false. In case of true, it will check against the host value. | false | all | | +| `PORT` | :white_check_mark: | Default port the application runs on is 4000 | 4000 | all | | +| `COIN` | :white_check_mark: | The coin here is checked via the Coinmarketcap API to obtain USD prices on graphs and other areas of the UI | POA | all | | +| `METADATA_CONTRACT` | | This environment variable is specifically used by POA Network to obtain Validators information to display in the UI. | (empty) | all | | +| `VALIDATORS_CONTRACT` | | This environment variable is specifically used by POA Network to obtain the Emission Fund contract. | (empty) | all | | +| `SUPPLY_MODULE` | | This environment variable is used by the xDai Chain in order to tell the application how to calculate the total supply of the chain. | false | all | | +| `SOURCE_MODULE` | | This environment variable is used to calculate the exchange rate and is specifically used by the xDai Chain. | false | all | | +| `DATABASE_URL` | | Production environment variable to define the Database endpoint. | (empty) | all | | +| `POOL_SIZE` | | Production environment variable to define the number of database connections allowed. | 20 | all | | +| `ECTO_USE_SSL` | | Production environment variable to use SSL on Ecto queries. | true | all | | +| `DATADOG_HOST` | | Host configuration setting for [Datadog integration](https://docs.datadoghq.com/integrations/) | (empty) | all | | +| `DATADOG_PORT` | | Port configuration setting for [Datadog integration](https://docs.datadoghq.com/integrations/). | (empty} | all | | | `SPANDEX_BATCH_SIZE` | | [Spandex](https://github.com/spandex-project/spandex) and Datadog configuration setting. | (empty) | all | -| `SPANDEX_SYNC_THRESHOLD` | | [Spandex](https://github.com/spandex-project/spandex) and Datadog configuration setting. | (empty) | all | -| `HEART_BEAT_TIMEOUT` | | Production environment variable to restart the application in the event of a crash. | 30 | all | -| `HEART_COMMAND` | | Production environment variable to restart the application in the event of a crash. | systemctl restart explorer.service | all | -| `BLOCKSCOUT_VERSION` | | Added to the footer to signify the current BlockScout version. | (empty) | v1.3.4+ | -| `RELEASE_LINK` | | The link to Blockscout release notes in the footer. | https: //github.com/poanetwork/
blockscout/releases/
tag/${BLOCKSCOUT_VERSION} | v1.3.5+ | -| `ELIXIR_VERSION` | | Elixir version to install on the node before Blockscout deploy. | (empty) | all | -| `BLOCK_TRANSFORMER` | | Transformer for blocks: base or clique. | base | v1.3.4+ | -| `GRAPHIQL _TRANSACTION` | | Default transaction in query to GraphiQL. | (empty) | v1.3.4+ | -| `FIRST_BLOCK` | | The block number, where indexing begins from. | 0 | v1.3.8+ | -| `LAST_BLOCK` | | The block number, where indexing stops. | (empty) | v2.0.3+ | -| `TXS_COUNT_CACHE_PERIOD` | | Interval in seconds to restart the task, which calculates the total txs count. | 60 * 60 * 2 | v1.3.9+ | -| `ADDRESS_WITH_BALANCES`
`_UPDATE_INTERVAL`| | Interval in seconds to restart the task, which calculates addresses with balances. | 30 * 60 | v1.3.9+ | -| `LINK_TO_OTHER_EXPLORERS` | | true/false. If true, links to other explorers are added in the footer | (empty) | v1.3.0+ | -| `COINMARKETCAP_PAGES` | | the number of pages on coinmarketcap to list in order to find token's price | 10 | v1.3.10+ | -| `CHAIN_SPEC_PATH` | | Chain specification path (absolute file system path or url) to import block emission reward ranges and genesis account balances from | (empty) | master | -| `SUPPORTED_CHAINS` | | Array of supported chains that displays in the footer and in the chains dropdown. This var was introduced in this PR [#1900](https://github.com/poanetwork/blockscout/pull/1900) and looks like an array of JSON objects. | (empty) | v2.0.0+ | -| `BLOCK_COUNT_CACHE_PERIOD ` | | time to live of cache in seconds. This var was introduced in [#1876](https://github.com/poanetwork/blockscout/pull/1876) | 600 | v2.0.0+ | -| `ALLOWED_EVM_VERSIONS ` | | the comma-separated list of allowed EVM versions for contracts verification. This var was introduced in [#1964](https://github.com/poanetwork/blockscout/pull/1964) | "homestead, tangerineWhistle, spuriousDragon, byzantium, constantinople, petersburg" | v2.0.0+ | -| `DISABLE_WEBAPP` | | If `true`, endpoints to webapp are hidden (compile-time) | `false` | v2.0.3+ | -| `DISABLE_READ_API` | | If `true`, read-only endpoints to API are hidden (compile-time) | `false` | v2.0.3+ | -| `DISABLE_WRITE_API` | | If `true`, write endpoints to API are hidden (compile-time) | `false` | v2.0.3+ | -| `DISABLE_INDEXER` | | If `true`, indexer application doesn't run | `false` | v2.0.3+ | -| `WEBAPP_URL` | | Link to web application instance, e.g. `http://host/path` | (empty) | v2.0.3+ | -| `API_URL` | | Link to API instance, e.g. `http://host/path` | (empty) | v2.0.3+ | +| `SPANDEX_SYNC_THRESHOLD` | | [Spandex](https://github.com/spandex-project/spandex) and Datadog configuration setting. | (empty) | all | | +| `HEART_BEAT_TIMEOUT` | | Production environment variable to restart the application in the event of a crash. | 30 | all | | +| `HEART_COMMAND` | | Production environment variable to restart the application in the event of a crash. | systemctl restart explorer.service | all | | +| `BLOCKSCOUT_VERSION` | | Added to the footer to signify the current BlockScout version. | (empty) | v1.3.4+ | | +| `RELEASE_LINK` | | The link to Blockscout release notes in the footer. | https: //github.com/poanetwork/
blockscout/releases/
tag/${BLOCKSCOUT_VERSION} | v1.3.5+ | | +| `ELIXIR_VERSION` | | Elixir version to install on the node before Blockscout deploy. | (empty) | all | | +| `BLOCK_TRANSFORMER` | | Transformer for blocks: base or clique. | base | v1.3.4+ | | +| `GRAPHIQL_TRANSACTION` | | Default transaction in query to GraphiQL. | (empty) | v1.2.0+ | :white_check_mark: | +| `FIRST_BLOCK` | | The block number, where indexing begins from. | 0 | v1.3.8+ | | +| `LAST_BLOCK` | | The block number, where indexing stops. | (empty) | v2.0.3+ | | +| `TXS_COUNT_CACHE_PERIOD` | | Interval in seconds to restart the task, which calculates the total txs count. | 60 * 60 * 2 | v1.3.9+ | | +| `ADDRESS_WITH_BALANCES`
`_UPDATE_INTERVAL`| | Interval in seconds to restart the task, which calculates addresses with balances. | 30 * 60 | v1.3.9+ | | +| `LINK_TO_OTHER_EXPLORERS` | | true/false. If true, links to other explorers are added in the footer | (empty) | v1.3.0+ | | +| `COINMARKETCAP_PAGES` | | the number of pages on coinmarketcap to list in order to find token's price | 10 | v1.3.10+ | | +| `SUPPORTED_CHAINS` | | Array of supported chains that displays in the footer and in the chains dropdown. This var was introduced in this PR [#1900](https://github.com/poanetwork/blockscout/pull/1900) and looks like an array of JSON objects. | (empty) | v2.0.0+ | | +| `BLOCK_COUNT_CACHE_PERIOD ` | | time to live of cache in seconds. This var was introduced in [#1876](https://github.com/poanetwork/blockscout/pull/1876) | 600 | v2.0.0+ | | +| `ALLOWED_EVM_VERSIONS ` | | the comma-separated list of allowed EVM versions for contracts verification. This var was introduced in [#1964](https://github.com/poanetwork/blockscout/pull/1964) | "homestead, tangerineWhistle, spuriousDragon, byzantium, constantinople, petersburg" | v2.0.0+ | | +| `AVERAGE_BLOCK_CACHE_PERIOD` | | Update of average block cache, in seconds | 30 minutes | v2.0.2+ | +| `MARKET_HISTORY_CACHE_PERIOD` | | Update of market history cache, in seconds | 6 hours | v2.0.2+ | +| `DISABLE_WEBAPP` | | If `true`, endpoints to webapp are hidden (compile-time) | `false` | v2.0.3+ | :white_check_mark: | +| `DISABLE_READ_API` | | If `true`, read-only endpoints to API are hidden (compile-time) | `false` | v2.0.3+ | :white_check_mark: | +| `DISABLE_WRITE_API` | | If `true`, write endpoints to API are hidden (compile-time) | `false` | v2.0.3+ | :white_check_mark: | +| `DISABLE_INDEXER` | | If `true`, indexer application doesn't run | `false` | v2.0.3+ | :white_check_mark: | +| `WEBAPP_URL` | | Link to web application instance, e.g. `http://host/path` | (empty) | v2.0.3+ | | +| `API_URL` | | Link to API instance, e.g. `http://host/path` | (empty) | v2.0.3+ | | +| `CHAIN_SPEC_PATH` | | Chain specification path (absolute file system path or url) to import block emission reward ranges and genesis account balances from | (empty) | master | | diff --git a/mix.lock b/mix.lock index d589137148..e0d75af01a 100644 --- a/mix.lock +++ b/mix.lock @@ -81,7 +81,7 @@ "optimal": {:hex, :optimal, "0.3.6", "46bbf52fbbbd238cda81e02560caa84f93a53c75620f1fe19e81e4ae7b07d1dd", [:mix], [], "hexpm"}, "parallel_stream": {:hex, :parallel_stream, "1.0.6", "b967be2b23f0f6787fab7ed681b4c45a215a81481fb62b01a5b750fa8f30f76c", [:mix], [], "hexpm"}, "parse_trans": {:hex, :parse_trans, "3.2.0", "2adfa4daf80c14dc36f522cf190eb5c4ee3e28008fc6394397c16f62a26258c2", [:rebar3], [], "hexpm"}, - "phoenix": {:hex, :phoenix, "1.4.9", "746d098e10741c334d88143d3c94cab1756435f94387a63441792e66ec0ee974", [:mix], [{:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:phoenix_pubsub, "~> 1.1", [hex: :phoenix_pubsub, repo: "hexpm", optional: false]}, {:plug, "~> 1.8.1 or ~> 1.9", [hex: :plug, repo: "hexpm", optional: false]}, {:plug_cowboy, "~> 1.0 or ~> 2.0", [hex: :plug_cowboy, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm"}, + "phoenix": {:hex, :phoenix, "1.4.0", "56fe9a809e0e735f3e3b9b31c1b749d4b436e466d8da627b8d82f90eaae714d2", [:mix], [{:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:phoenix_pubsub, "~> 1.1", [hex: :phoenix_pubsub, repo: "hexpm", optional: false]}, {:plug, "~> 1.7", [hex: :plug, repo: "hexpm", optional: false]}, {:plug_cowboy, "~> 1.0 or ~> 2.0", [hex: :plug_cowboy, repo: "hexpm", optional: true]}], "hexpm"}, "phoenix_ecto": {:hex, :phoenix_ecto, "4.0.0", "c43117a136e7399ea04ecaac73f8f23ee0ffe3e07acfcb8062fe5f4c9f0f6531", [:mix], [{:ecto, "~> 3.0", [hex: :ecto, repo: "hexpm", optional: false]}, {:phoenix_html, "~> 2.9", [hex: :phoenix_html, repo: "hexpm", optional: true]}, {:plug, "~> 1.0", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm"}, "phoenix_form_awesomplete": {:hex, :phoenix_form_awesomplete, "0.1.5", "d09aade160b584e3428e1e095645482396f17bddda4f566f1118f12d2598d11c", [:mix], [{:phoenix_html, "~> 2.10", [hex: :phoenix_html, repo: "hexpm", optional: false]}], "hexpm"}, "phoenix_html": {:hex, :phoenix_html, "2.13.3", "850e292ff6e204257f5f9c4c54a8cb1f6fbc16ed53d360c2b780a3d0ba333867", [:mix], [{:plug, "~> 1.5", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm"},