diff --git a/eth-bytecode-db/Cargo.lock b/eth-bytecode-db/Cargo.lock index 343083361..991914274 100644 --- a/eth-bytecode-db/Cargo.lock +++ b/eth-bytecode-db/Cargo.lock @@ -7,6 +7,10 @@ name = "Inflector" version = "0.11.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3" +dependencies = [ + "lazy_static", + "regex", +] [[package]] name = "actix-codec" @@ -14,7 +18,7 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57a7559404a7f3573127aab53c08ce37a6c6a315c374a31070f3c91cd1b4a7fe" dependencies = [ - "bitflags", + "bitflags 1.3.2", "bytes", "futures-core", "futures-sink", @@ -37,7 +41,7 @@ dependencies = [ "actix-utils", "ahash 0.8.3", "base64 0.21.0", - "bitflags", + "bitflags 1.3.2", "brotli", "bytes", "bytestring", @@ -61,7 +65,7 @@ dependencies = [ "tokio", "tokio-util", "tracing", - "zstd", + "zstd 0.12.3+zstd.1.5.2", ] [[package]] @@ -94,7 +98,7 @@ name = "actix-prost-build" version = "0.1.0" source = "git+https://github.com/blockscout/actix-prost#a060c2fe886d4551ed7350fa445d3d2bc02758f4" dependencies = [ - "prettyplease", + "prettyplease 0.1.25", "proc-macro2", "prost-build", "quote", @@ -241,12 +245,32 @@ dependencies = [ "prometheus", ] +[[package]] +name = "addr2line" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4fa78e18c64fce05e902adecd7a5eed15a5e0a3439f7b0e169f0252214865e3" +dependencies = [ + "gimli", +] + [[package]] name = "adler" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" +[[package]] +name = "aes" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac1f845298e95f983ff1944b728ae08b8cebab80d684f0a832ed0fc74dfa27e2" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + [[package]] name = "ahash" version = "0.7.6" @@ -272,9 +296,9 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "0.7.20" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac" +checksum = "43f6cb1bf222025340178f382c426f13757b2960e89779dfcb319c32542a5a41" dependencies = [ "memchr", ] @@ -351,9 +375,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.70" +version = "1.0.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7de8ce5e0f9f8d88245311066a578d72b7af3e7088f32783804676302df237e4" +checksum = "3b13c32d80ecc7ab747b80c3784bce54ee8a7a0cc4fbda9bf4cda2cf6fe90854" [[package]] name = "arrayvec" @@ -361,6 +385,15 @@ version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +[[package]] +name = "ascii-canvas" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8824ecca2e851cec16968d54a01dd372ef8f95b244fb84b84e70128be347c3c6" +dependencies = [ + "term", +] + [[package]] name = "async-attributes" version = "1.1.2" @@ -426,7 +459,7 @@ dependencies = [ "log", "parking", "polling", - "rustix", + "rustix 0.37.11", "slab", "socket2", "waker-fn", @@ -487,7 +520,7 @@ checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" dependencies = [ "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.26", ] [[package]] @@ -504,7 +537,18 @@ checksum = "b9ccdd8f2a161be9bd5c023df56f1b2a0bd1d83872ae53b71a84a12c9bf6e842" dependencies = [ "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.26", +] + +[[package]] +name = "async_io_stream" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6d7b9decdf35d8908a7e3ef02f64c5e9b1695e230154c0e8de3969142d9b94c" +dependencies = [ + "futures", + "pharos", + "rustc_version", ] [[package]] @@ -548,7 +592,7 @@ checksum = "3b32c5ea3aabaf4deb5f5ced2d688ec0844c881c9e6c696a8b769a05fc691e62" dependencies = [ "async-trait", "axum-core", - "bitflags", + "bitflags 1.3.2", "bytes", "futures-util", "http", @@ -585,6 +629,21 @@ dependencies = [ "tower-service", ] +[[package]] +name = "backtrace" +version = "0.3.68" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4319208da049c43661739c5fade2ba182f09d1dc2299b32298d3a31692b17e12" +dependencies = [ + "addr2line", + "cc", + "cfg-if", + "libc", + "miniz_oxide 0.7.1", + "object", + "rustc-demangle", +] + [[package]] name = "bae" version = "0.1.7" @@ -622,6 +681,12 @@ version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" +[[package]] +name = "bech32" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dabbe35f96fb9507f7330793dc490461b2962659ac5d427181e451a623751d1" + [[package]] name = "bigdecimal" version = "0.3.0" @@ -633,12 +698,52 @@ dependencies = [ "num-traits", ] +[[package]] +name = "bincode" +version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" +dependencies = [ + "serde", +] + +[[package]] +name = "bit-set" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0700ddab506f33b20a03b13996eccd309a48e5ff77d0d95926aa0210fb4e95f1" +dependencies = [ + "bit-vec", +] + +[[package]] +name = "bit-vec" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" + [[package]] name = "bitflags" version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +[[package]] +name = "bitflags" +version = "2.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "630be753d4e58660abd17930c71b647fe46c27ea6b63cc59e1e3851406972e42" + +[[package]] +name = "bitvec" +version = "0.17.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41262f11d771fd4a61aa3ce019fca363b4b6c282fca9da2a31186d3965a47a5c" +dependencies = [ + "either", + "radium 0.3.0", +] + [[package]] name = "bitvec" version = "1.0.1" @@ -646,11 +751,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c" dependencies = [ "funty", - "radium", + "radium 0.7.0", "tap", "wyz", ] +[[package]] +name = "block-buffer" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" +dependencies = [ + "generic-array", +] + [[package]] name = "block-buffer" version = "0.10.4" @@ -778,6 +892,15 @@ dependencies = [ "alloc-stdlib", ] +[[package]] +name = "bs58" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "771fe0050b883fcc3ea2359b1a96bcfbc090b7116eae7c3c512c7a083fdf23d3" +dependencies = [ + "sha2 0.9.9", +] + [[package]] name = "bumpalo" version = "3.12.0" @@ -836,6 +959,59 @@ dependencies = [ "bytes", ] +[[package]] +name = "bzip2" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bdb116a6ef3f6c3698828873ad02c3014b3c85cadb88496095628e3ef1e347f8" +dependencies = [ + "bzip2-sys", + "libc", +] + +[[package]] +name = "bzip2-sys" +version = "0.1.11+1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "736a955f3fa7875102d57c82b8cac37ec45224a07fd32d58f9f7a186b6cd4cdc" +dependencies = [ + "cc", + "libc", + "pkg-config", +] + +[[package]] +name = "camino" +version = "1.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c59e92b5a388f549b863a7bea62612c09f24c8393560709a54558a9abdfb3b9c" +dependencies = [ + "serde", +] + +[[package]] +name = "cargo-platform" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2cfa25e60aea747ec7e1124f238816749faa93759c6ff5b31f1ccdda137f4479" +dependencies = [ + "serde", +] + +[[package]] +name = "cargo_metadata" +version = "0.15.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eee4243f1f26fc7a42710e7439c149e2b10b05472f88090acce52632f231a73a" +dependencies = [ + "camino", + "cargo-platform", + "semver", + "serde", + "serde_json", + "thiserror", +] + [[package]] name = "cc" version = "1.0.79" @@ -864,16 +1040,26 @@ dependencies = [ "winapi", ] +[[package]] +name = "cipher" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common", + "inout", +] + [[package]] name = "clap" version = "3.2.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "71655c45cb9845d3270c9d6df84ebe72b4dad3c2ba3f7023ad47c144e4e473a5" dependencies = [ - "bitflags", + "bitflags 1.3.2", "clap_derive", "clap_lex", - "indexmap", + "indexmap 1.9.3", "once_cell", "textwrap", ] @@ -910,6 +1096,62 @@ dependencies = [ "unicode-width", ] +[[package]] +name = "coins-bip32" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b30a84aab436fcb256a2ab3c80663d8aec686e6bae12827bb05fef3e1e439c9f" +dependencies = [ + "bincode", + "bs58", + "coins-core", + "digest 0.10.6", + "getrandom", + "hmac", + "k256", + "lazy_static", + "serde", + "sha2 0.10.6", + "thiserror", +] + +[[package]] +name = "coins-bip39" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84f4d04ee18e58356accd644896aeb2094ddeafb6a713e056cef0c0a8e468c15" +dependencies = [ + "bitvec 0.17.4", + "coins-bip32", + "getrandom", + "hmac", + "once_cell", + "pbkdf2 0.12.1", + "rand", + "sha2 0.10.6", + "thiserror", +] + +[[package]] +name = "coins-core" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b949a1c63fb7eb591eb7ba438746326aedf0ae843e51ec92ba6bec5bb382c4f" +dependencies = [ + "base64 0.21.0", + "bech32", + "bs58", + "digest 0.10.6", + "generic-array", + "hex", + "ripemd", + "serde", + "serde_derive", + "sha2 0.10.6", + "sha3", + "thiserror", +] + [[package]] name = "concurrent-queue" version = "2.2.0" @@ -934,7 +1176,7 @@ dependencies = [ "rust-ini", "serde", "serde_json", - "toml", + "toml 0.5.11", "yaml-rust", ] @@ -944,6 +1186,12 @@ version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "520fbf3c07483f94e3e3ca9d0cfd913d7718ef2483d2cfd91c0d9e91474ab913" +[[package]] +name = "constant_time_eq" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" + [[package]] name = "convert_case" version = "0.4.0" @@ -1005,6 +1253,30 @@ dependencies = [ "crossbeam-utils", ] +[[package]] +name = "crossbeam-deque" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce6fd6f855243022dcecf8702fef0c297d4338e226845fe067f6341ad9fa0cef" +dependencies = [ + "cfg-if", + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae211234986c545741a7dc064309f67ee1e5ad243d0e48335adc0484d960bcc7" +dependencies = [ + "autocfg", + "cfg-if", + "crossbeam-utils", + "memoffset", + "scopeguard", +] + [[package]] name = "crossbeam-queue" version = "0.3.8" @@ -1062,6 +1334,15 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "ctr" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0369ee1ad671834580515889b80f2ea915f23b8be8d0daa4bbaf2ac5c7590835" +dependencies = [ + "cipher", +] + [[package]] name = "cxx" version = "1.0.94" @@ -1086,7 +1367,7 @@ dependencies = [ "proc-macro2", "quote", "scratch", - "syn 2.0.15", + "syn 2.0.26", ] [[package]] @@ -1103,7 +1384,7 @@ checksum = "2345488264226bf682893e25de0769f3360aac9957980ec49361b083ddaa5bc5" dependencies = [ "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.26", ] [[package]] @@ -1189,13 +1470,22 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6184e33543162437515c2e2b48714794e37845ec9851711914eec9d308f6ebe8" +[[package]] +name = "digest" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" +dependencies = [ + "generic-array", +] + [[package]] name = "digest" version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8168378f4e5023e7218c89c891c0fd8ecdb5e5e4f18cb78f38cf245dd021e76f" dependencies = [ - "block-buffer", + "block-buffer 0.10.4", "const-oid", "crypto-common", "subtle", @@ -1210,6 +1500,16 @@ dependencies = [ "dirs-sys", ] +[[package]] +name = "dirs-next" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b98cf8ebf19c3d1b223e151f99a4f9f0690dca41414773390fc824184ac833e1" +dependencies = [ + "cfg-if", + "dirs-sys-next", +] + [[package]] name = "dirs-sys" version = "0.3.7" @@ -1221,6 +1521,17 @@ dependencies = [ "winapi", ] +[[package]] +name = "dirs-sys-next" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" +dependencies = [ + "libc", + "redox_users", + "winapi", +] + [[package]] name = "dlv-list" version = "0.3.0" @@ -1239,6 +1550,12 @@ version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1435fa1053d8b2fbbe9be7e97eca7f33d37b28409959813daefc1446a14247f1" +[[package]] +name = "dunce" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56ce8c6da7551ec6c462cbaf3bfbc75131ebbfa1c944aeaa9dab51ca1c5f0c3b" + [[package]] name = "ecdsa" version = "0.16.6" @@ -1246,7 +1563,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a48e5d537b8a30c0b023116d981b16334be1485af7ca68db3a2b7024cbc957fd" dependencies = [ "der", - "digest", + "digest 0.10.6", "elliptic-curve", "rfc6979", "signature", @@ -1266,7 +1583,7 @@ checksum = "75c71eaa367f2e5d556414a8eea812bc62985c879748d6403edabd9cb03f16e7" dependencies = [ "base16ct", "crypto-bigint", - "digest", + "digest 0.10.6", "ff", "generic-array", "group", @@ -1277,6 +1594,15 @@ dependencies = [ "zeroize", ] +[[package]] +name = "ena" +version = "0.14.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c533630cf40e9caa44bd91aadc88a75d75a4c3a12b4cfde353cbed41daa1e1f1" +dependencies = [ + "log", +] + [[package]] name = "encoding_rs" version = "0.8.32" @@ -1286,6 +1612,24 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "enr" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf56acd72bb22d2824e66ae8e9e5ada4d0de17a69c7fd35569dde2ada8ec9116" +dependencies = [ + "base64 0.13.1", + "bytes", + "hex", + "k256", + "log", + "rand", + "rlp", + "serde", + "sha3", + "zeroize", +] + [[package]] name = "entity" version = "0.0.0" @@ -1293,6 +1637,12 @@ dependencies = [ "sea-orm", ] +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + [[package]] name = "errno" version = "0.3.1" @@ -1333,6 +1683,7 @@ dependencies = [ "mockall", "pretty_assertions", "prometheus", + "reqwest", "rstest", "sea-orm", "semver", @@ -1378,6 +1729,7 @@ dependencies = [ "config", "eth-bytecode-db", "eth-bytecode-db-proto", + "ethers", "hex", "migration", "mockall", @@ -1390,12 +1742,35 @@ dependencies = [ "serde_json", "serde_with", "smart-contract-verifier-proto", + "sourcify", "tokio", "tokio-stream", "tonic", "tracing", ] +[[package]] +name = "eth-keystore" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fda3bf123be441da5260717e0661c25a2fd9cb2b2c1d20bf2e05580047158ab" +dependencies = [ + "aes", + "ctr", + "digest 0.10.6", + "hex", + "hmac", + "pbkdf2 0.11.0", + "rand", + "scrypt", + "serde", + "serde_json", + "sha2 0.10.6", + "sha3", + "thiserror", + "uuid 0.8.2", +] + [[package]] name = "ethabi" version = "18.0.0" @@ -1444,40 +1819,271 @@ dependencies = [ "uint", ] +[[package]] +name = "ethers" +version = "2.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d5486fdc149826f38c388f26a7df72534ee3f20d3a3f72539376fa7b3bbc43d" +dependencies = [ + "ethers-addressbook", + "ethers-contract", + "ethers-core", + "ethers-etherscan", + "ethers-middleware", + "ethers-providers", + "ethers-signers", + "ethers-solc", +] + +[[package]] +name = "ethers-addressbook" +version = "2.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edcb6ffefc230d8c42874c51b28dc11dbb8de50b27a8fdf92648439d6baa68dc" +dependencies = [ + "ethers-core", + "once_cell", + "serde", + "serde_json", +] + +[[package]] +name = "ethers-contract" +version = "2.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfa43e2e69632492d7b38e59465d125a0066cf4c477390ece00d3acbd11b338b" +dependencies = [ + "ethers-contract-abigen", + "ethers-contract-derive", + "ethers-core", + "ethers-providers", + "futures-util", + "hex", + "once_cell", + "pin-project", + "serde", + "serde_json", + "thiserror", +] + +[[package]] +name = "ethers-contract-abigen" +version = "2.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "155ea1b84d169d231317ed86e307af6f2bed6b40dd17e5e94bc84da21cadb21c" +dependencies = [ + "Inflector", + "dunce", + "ethers-core", + "ethers-etherscan", + "eyre", + "hex", + "prettyplease 0.2.12", + "proc-macro2", + "quote", + "regex", + "reqwest", + "serde", + "serde_json", + "syn 2.0.26", + "tokio", + "toml 0.7.6", + "url", + "walkdir", +] + +[[package]] +name = "ethers-contract-derive" +version = "2.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8567ff196c4a37c1a8c90ec73bda0ad2062e191e4f0a6dc4d943e2ec4830fc88" +dependencies = [ + "Inflector", + "ethers-contract-abigen", + "ethers-core", + "hex", + "proc-macro2", + "quote", + "serde_json", + "syn 2.0.26", +] + [[package]] name = "ethers-core" -version = "2.0.3" +version = "2.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a5f8f85ba96698eab9a4782ed2215d0979b1981b99f1be0726c200ffdac22f5" +checksum = "60ca2514feb98918a0a31de7e1983c29f2267ebf61b2dc5d4294f91e5b866623" dependencies = [ "arrayvec", "bytes", + "cargo_metadata", "chrono", "elliptic-curve", "ethabi", "generic-array", - "getrandom", "hex", "k256", "num_enum", + "once_cell", "open-fastrlp", "rand", "rlp", "serde", "serde_json", "strum", + "syn 2.0.26", "tempfile", "thiserror", "tiny-keccak", "unicode-xid", ] +[[package]] +name = "ethers-etherscan" +version = "2.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22b3a8269d3df0ed6364bc05b4735b95f4bf830ce3aef87d5e760fb0e93e5b91" +dependencies = [ + "ethers-core", + "ethers-solc", + "reqwest", + "semver", + "serde", + "serde_json", + "thiserror", + "tracing", +] + +[[package]] +name = "ethers-middleware" +version = "2.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75594cc450992fc7de701c9145de612325fd8a18be765b8ae78767ba2b74876f" +dependencies = [ + "async-trait", + "auto_impl", + "ethers-contract", + "ethers-core", + "ethers-etherscan", + "ethers-providers", + "ethers-signers", + "futures-channel", + "futures-locks", + "futures-util", + "instant", + "reqwest", + "serde", + "serde_json", + "thiserror", + "tokio", + "tracing", + "tracing-futures", + "url", +] + +[[package]] +name = "ethers-providers" +version = "2.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1009041f40476b972b5d79346cc512e97c662b1a0a2f78285eabe9a122909783" +dependencies = [ + "async-trait", + "auto_impl", + "base64 0.21.0", + "bytes", + "enr", + "ethers-core", + "futures-core", + "futures-timer", + "futures-util", + "getrandom", + "hashers", + "hex", + "http", + "instant", + "once_cell", + "pin-project", + "reqwest", + "serde", + "serde_json", + "thiserror", + "tokio", + "tokio-tungstenite", + "tracing", + "tracing-futures", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "ws_stream_wasm", +] + +[[package]] +name = "ethers-signers" +version = "2.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4864d387456a9c09a1157fa10e1528b29d90f1d859443acf06a1b23365fb518c" +dependencies = [ + "async-trait", + "coins-bip32", + "coins-bip39", + "elliptic-curve", + "eth-keystore", + "ethers-core", + "hex", + "rand", + "sha2 0.10.6", + "thiserror", + "tracing", +] + +[[package]] +name = "ethers-solc" +version = "2.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a6c2b9625a2c639d46625f88acc2092a3cb35786c37f7c2128b3ca20f639b3c" +dependencies = [ + "cfg-if", + "dunce", + "ethers-core", + "glob", + "hex", + "home", + "md-5", + "num_cpus", + "once_cell", + "path-slash", + "rayon", + "regex", + "semver", + "serde", + "serde_json", + "solang-parser", + "svm-rs", + "thiserror", + "tiny-keccak", + "tokio", + "tracing", + "walkdir", + "yansi", +] + [[package]] name = "event-listener" version = "2.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" +[[package]] +name = "eyre" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c2b6b5a29c02cdc822728b7d7b8ae1bab3e3b05d44522770ddd49722eeac7eb" +dependencies = [ + "indenter", + "once_cell", +] + [[package]] name = "fastrand" version = "1.9.0" @@ -1522,7 +2128,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a8a2db397cb1c8772f31494cb8917e48cd1e64f0fa7efac59fbd741a0a8ce841" dependencies = [ "crc32fast", - "miniz_oxide", + "miniz_oxide 0.6.2", ] [[package]] @@ -1569,9 +2175,9 @@ checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" [[package]] name = "form_urlencoded" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9c384f161156f5260c24a097c56119f9be8c798586aecc13afbcbe7b7e26bf8" +checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652" dependencies = [ "percent-encoding", ] @@ -1582,6 +2188,16 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c2141d6d6c8512188a7891b4b01590a45f6dac67afb4f255c4124dbb86d4eaa" +[[package]] +name = "fs2" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9564fc758e15025b46aa6643b1b77d047d1a56a1aea6e01002ac0c7026876213" +dependencies = [ + "libc", + "winapi", +] + [[package]] name = "funty" version = "2.0.0" @@ -1662,6 +2278,16 @@ dependencies = [ "waker-fn", ] +[[package]] +name = "futures-locks" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45ec6fe3675af967e67c5536c0b9d44e34e6c52f86bedc4ea49c5317b8e94d06" +dependencies = [ + "futures-channel", + "futures-task", +] + [[package]] name = "futures-macro" version = "0.3.28" @@ -1670,7 +2296,7 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" dependencies = [ "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.26", ] [[package]] @@ -1690,6 +2316,10 @@ name = "futures-timer" version = "3.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e64b03909df88034c26dc1547e8970b91f98bdb65165d6a4e9110d94263dbb2c" +dependencies = [ + "gloo-timers", + "send_wrapper 0.4.0", +] [[package]] name = "futures-util" @@ -1709,6 +2339,15 @@ dependencies = [ "slab", ] +[[package]] +name = "fxhash" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" +dependencies = [ + "byteorder", +] + [[package]] name = "generic-array" version = "0.14.7" @@ -1733,6 +2372,18 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "gimli" +version = "0.27.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c80984affa11d98d1b88b66ac8853f143217b399d3c74116778ff8fdb4ed2e" + +[[package]] +name = "glob" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" + [[package]] name = "gloo-timers" version = "0.2.6" @@ -1768,7 +2419,7 @@ dependencies = [ "futures-sink", "futures-util", "http", - "indexmap", + "indexmap 1.9.3", "slab", "tokio", "tokio-util", @@ -1793,6 +2444,21 @@ dependencies = [ "ahash 0.8.3", ] +[[package]] +name = "hashbrown" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a" + +[[package]] +name = "hashers" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2bca93b15ea5a746f220e56587f71e73c6165eab783df9e26590069953e3c30" +dependencies = [ + "fxhash", +] + [[package]] name = "hashlink" version = "0.8.1" @@ -1856,7 +2522,16 @@ version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" dependencies = [ - "digest", + "digest 0.10.6", +] + +[[package]] +name = "home" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5444c27eef6923071f7ebcc33e3444508466a76f7a2b93da00ed6e19f30c1ddb" +dependencies = [ + "windows-sys 0.48.0", ] [[package]] @@ -1917,6 +2592,20 @@ dependencies = [ "want", ] +[[package]] +name = "hyper-rustls" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d78e1e73ec14cf7375674f74d7dde185c8206fd9dea6fb6295e8a98098aaa97" +dependencies = [ + "futures-util", + "http", + "hyper", + "rustls 0.21.6", + "tokio", + "tokio-rustls 0.24.1", +] + [[package]] name = "hyper-timeout" version = "0.4.1" @@ -1974,9 +2663,9 @@ checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" [[package]] name = "idna" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e14ddfc70884202db2244c223200c204c2bda1bc6e0998d11b5e024d657209e6" +checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" dependencies = [ "unicode-bidi", "unicode-normalization", @@ -2020,6 +2709,12 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "indenter" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce23b50ad8242c51a442f3ff322d56b02f08852c77e4c0b4d3fd684abc89c683" + [[package]] name = "indexmap" version = "1.9.3" @@ -2031,6 +2726,25 @@ dependencies = [ "serde", ] +[[package]] +name = "indexmap" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5477fe2230a79769d8dc68e0eabf5437907c0457a5614a9e8dddb67f65eb65d" +dependencies = [ + "equivalent", + "hashbrown 0.14.0", +] + +[[package]] +name = "inout" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0c10553d664a4d0bcff9f4215d0aac67a639cc68ef660840afe309b807bc9f5" +dependencies = [ + "generic-array", +] + [[package]] name = "instant" version = "0.1.12" @@ -2038,6 +2752,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" dependencies = [ "cfg-if", + "js-sys", + "wasm-bindgen", + "web-sys", ] [[package]] @@ -2063,6 +2780,17 @@ version = "2.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "12b6ee2129af8d4fb011108c73d99a1b83a85977f23b82460c0ae2e25bb4b57f" +[[package]] +name = "is-terminal" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" +dependencies = [ + "hermit-abi 0.3.1", + "rustix 0.38.6", + "windows-sys 0.48.0", +] + [[package]] name = "itertools" version = "0.10.5" @@ -2117,7 +2845,8 @@ dependencies = [ "ecdsa", "elliptic-curve", "once_cell", - "sha2", + "sha2 0.10.6", + "signature", ] [[package]] @@ -2138,6 +2867,34 @@ dependencies = [ "log", ] +[[package]] +name = "lalrpop" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da4081d44f4611b66c6dd725e6de3169f9f63905421e8626fcb86b6a898998b8" +dependencies = [ + "ascii-canvas", + "bit-set", + "diff", + "ena", + "is-terminal", + "itertools", + "lalrpop-util", + "petgraph", + "regex", + "regex-syntax 0.7.4", + "string_cache", + "term", + "tiny-keccak", + "unicode-xid", +] + +[[package]] +name = "lalrpop-util" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f35c735096c0293d313e8f2a641627472b83d01b937177fe76e5e2708d31e0d" + [[package]] name = "language-tags" version = "0.3.2" @@ -2152,9 +2909,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.141" +version = "0.2.147" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3304a64d199bb964be99741b7a14d26972741915b3649639149b2479bb46f4b5" +checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" [[package]] name = "libsqlite3-sys" @@ -2188,6 +2945,12 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d59d8c75012853d2e872fb56bc8a2e53718e2cafe1a4c823143141c6d90c322f" +[[package]] +name = "linux-raw-sys" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57bcfdad1b858c2db7c38303a6d2ad4dfaf5eb53dfeb0910128b2c26d6158503" + [[package]] name = "local-channel" version = "0.1.3" @@ -2232,7 +2995,7 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" dependencies = [ - "regex-automata", + "regex-automata 0.1.10", ] [[package]] @@ -2247,7 +3010,7 @@ version = "0.10.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6365506850d44bff6e2fbcb5176cf63650e48bd45ef2fe2665ae1570e0f4b9ca" dependencies = [ - "digest", + "digest 0.10.6", ] [[package]] @@ -2256,6 +3019,15 @@ version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" +[[package]] +name = "memoffset" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c" +dependencies = [ + "autocfg", +] + [[package]] name = "migration" version = "0.0.0" @@ -2270,6 +3042,16 @@ version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" +[[package]] +name = "mime_guess" +version = "2.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4192263c238a5f0d0c6bfd21f336a313a4ce1c450542449ca191bb657b4642ef" +dependencies = [ + "mime", + "unicase", +] + [[package]] name = "minicbor" version = "0.18.0" @@ -2305,6 +3087,15 @@ dependencies = [ "adler", ] +[[package]] +name = "miniz_oxide" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" +dependencies = [ + "adler", +] + [[package]] name = "mio" version = "0.8.6" @@ -2377,6 +3168,12 @@ dependencies = [ "tempfile", ] +[[package]] +name = "new_debug_unreachable" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4a24736216ec316047a1fc4252e27dabb04218aa4a3f37c6e7ddbf1f9782b54" + [[package]] name = "nom" version = "7.1.3" @@ -2461,7 +3258,16 @@ dependencies = [ "proc-macro-crate 1.3.1", "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.26", +] + +[[package]] +name = "object" +version = "0.31.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8bda667d9f2b5051b8833f59f3bf748b28ef54f850f4fcb389a252aa383866d1" +dependencies = [ + "memchr", ] [[package]] @@ -2470,6 +3276,12 @@ version = "1.17.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +[[package]] +name = "opaque-debug" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" + [[package]] name = "open-fastrlp" version = "0.1.4" @@ -2501,7 +3313,7 @@ version = "0.10.50" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7e30d8bc91859781f0a943411186324d580f2bbeb71b452fe91ae344806af3f1" dependencies = [ - "bitflags", + "bitflags 1.3.2", "cfg-if", "foreign-types", "libc", @@ -2518,7 +3330,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.26", ] [[package]] @@ -2584,7 +3396,7 @@ dependencies = [ "fnv", "futures-channel", "futures-util", - "indexmap", + "indexmap 1.9.3", "js-sys", "once_cell", "pin-project-lite", @@ -2683,7 +3495,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "637935964ff85a605d114591d4d2c13c5d1ba2806dae97cea6bf180238a749ac" dependencies = [ "arrayvec", - "bitvec", + "bitvec 1.0.1", "byte-slice-cast", "impl-trait-for-tuples", "parity-scale-codec-derive", @@ -2756,23 +3568,62 @@ dependencies = [ "windows-sys 0.45.0", ] +[[package]] +name = "password-hash" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7676374caaee8a325c9e7a2ae557f216c5563a171d6997b0ef8a65af35147700" +dependencies = [ + "base64ct", + "rand_core", + "subtle", +] + [[package]] name = "paste" version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9f746c4065a8fa3fe23974dd82f15431cc8d40779821001404d10d2e79ca7d79" +[[package]] +name = "path-slash" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e91099d4268b0e11973f036e885d652fb0b21fedcf69738c627f94db6a44f42" + [[package]] name = "pathdiff" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd" +[[package]] +name = "pbkdf2" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83a0692ec44e4cf1ef28ca317f14f8f07da2d95ec3fa01f86e4467b725e60917" +dependencies = [ + "digest 0.10.6", + "hmac", + "password-hash", + "sha2 0.10.6", +] + +[[package]] +name = "pbkdf2" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0ca0b5a68607598bf3bad68f32227a8164f6254833f84eafaac409cd6746c31" +dependencies = [ + "digest 0.10.6", + "hmac", +] + [[package]] name = "percent-encoding" -version = "2.2.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" +checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" [[package]] name = "pest" @@ -2804,7 +3655,7 @@ dependencies = [ "pest_meta", "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.26", ] [[package]] @@ -2815,7 +3666,7 @@ checksum = "6733073c7cff3d8459fda0e42f13a047870242aed8b509fe98000928975f359e" dependencies = [ "once_cell", "pest", - "sha2", + "sha2 0.10.6", ] [[package]] @@ -2825,7 +3676,68 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4dd7d28ee937e54fe3080c91faa1c3a46c06de6252988a7f4592ba2310ef22a4" dependencies = [ "fixedbitset", - "indexmap", + "indexmap 1.9.3", +] + +[[package]] +name = "pharos" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9567389417feee6ce15dd6527a8a1ecac205ef62c2932bcf3d9f6fc5b78b414" +dependencies = [ + "futures", + "rustc_version", +] + +[[package]] +name = "phf" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ade2d8b8f33c7333b51bcf0428d37e217e9f32192ae4772156f65063b8ce03dc" +dependencies = [ + "phf_macros", + "phf_shared 0.11.2", +] + +[[package]] +name = "phf_generator" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48e4cc64c2ad9ebe670cb8fd69dd50ae301650392e81c05f9bfcb2d5bdbc24b0" +dependencies = [ + "phf_shared 0.11.2", + "rand", +] + +[[package]] +name = "phf_macros" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3444646e286606587e49f3bcf1679b8cef1dc2c5ecc29ddacaffc305180d464b" +dependencies = [ + "phf_generator", + "phf_shared 0.11.2", + "proc-macro2", + "quote", + "syn 2.0.26", +] + +[[package]] +name = "phf_shared" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6796ad771acdc0123d2a88dc428b5e38ef24456743ddb1744ed628f9815c096" +dependencies = [ + "siphasher", +] + +[[package]] +name = "phf_shared" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90fcb95eef784c2ac79119d1dd819e162b5da872ce6f3c3abe1e8ca1c082f72b" +dependencies = [ + "siphasher", ] [[package]] @@ -2883,7 +3795,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4be1c66a6add46bff50935c313dae30a5030cf8385c5206e8a95e9e9def974aa" dependencies = [ "autocfg", - "bitflags", + "bitflags 1.3.2", "cfg-if", "concurrent-queue", "libc", @@ -2898,6 +3810,12 @@ version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" +[[package]] +name = "precomputed-hash" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" + [[package]] name = "predicates" version = "2.1.5" @@ -2950,6 +3868,16 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "prettyplease" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c64d9ba0963cdcea2e1b2230fbae2bab30eb25a174be395c41e764bfb65dd62" +dependencies = [ + "proc-macro2", + "syn 2.0.26", +] + [[package]] name = "primitive-types" version = "0.12.1" @@ -2970,7 +3898,7 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d6ea3c4595b96363c13943497db34af4460fb474a95c43f4446ad341b8c9785" dependencies = [ - "toml", + "toml 0.5.11", ] [[package]] @@ -3009,9 +3937,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.56" +version = "1.0.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b63bdb0cd06f1f4dedf69b254734f9b45af66e4a031e42a7480257d9898b435" +checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" dependencies = [ "unicode-ident", ] @@ -3054,7 +3982,7 @@ dependencies = [ "log", "multimap", "petgraph", - "prettyplease", + "prettyplease 0.1.25", "prost", "prost-types", "regex", @@ -3113,13 +4041,19 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.26" +version = "1.0.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +checksum = "5fe8a65d69dd0808184ebb5f836ab526bb259db23c657efa38711b1072ee47f0" dependencies = [ "proc-macro2", ] +[[package]] +name = "radium" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "def50a86306165861203e7f84ecffbbdfdea79f0e51039b33de1e952358c47ac" + [[package]] name = "radium" version = "0.7.0" @@ -3156,13 +4090,35 @@ dependencies = [ "getrandom", ] +[[package]] +name = "rayon" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d2df5196e37bcc87abebc0053e20787d73847bb33134a69841207dd0a47f03b" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b8f95bd6966f5c87776639160a66bd8ab9895d9d4ab01ddba9fc60661aebe8d" +dependencies = [ + "crossbeam-channel", + "crossbeam-deque", + "crossbeam-utils", + "num_cpus", +] + [[package]] name = "redox_syscall" version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" dependencies = [ - "bitflags", + "bitflags 1.3.2", ] [[package]] @@ -3171,7 +4127,7 @@ version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" dependencies = [ - "bitflags", + "bitflags 1.3.2", ] [[package]] @@ -3187,13 +4143,14 @@ dependencies = [ [[package]] name = "regex" -version = "1.7.3" +version = "1.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b1f693b24f6ac912f4893ef08244d70b6067480d2f1a46e950c9691e6749d1d" +checksum = "b2eae68fc220f7cf2532e4494aded17545fce192d59cd996e0fe7887f4ceb575" dependencies = [ "aho-corasick", "memchr", - "regex-syntax", + "regex-automata 0.3.4", + "regex-syntax 0.7.4", ] [[package]] @@ -3202,7 +4159,18 @@ version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" dependencies = [ - "regex-syntax", + "regex-syntax 0.6.29", +] + +[[package]] +name = "regex-automata" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7b6d6190b7594385f61bd3911cd1be99dfddcfc365a4160cc2ab5bff4aed294" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax 0.7.4", ] [[package]] @@ -3211,6 +4179,12 @@ version = "0.6.29" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" +[[package]] +name = "regex-syntax" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5ea92a5b6195c6ef2a0295ea818b312502c6fc94dde986c5553242e18fd4ce2" + [[package]] name = "rend" version = "0.4.0" @@ -3222,9 +4196,9 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.11.16" +version = "0.11.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27b71749df584b7f4cac2c426c127a7c785a5106cc98f7a8feb044115f0fa254" +checksum = "cde824a14b7c14f85caff81225f411faacc04a2013f41670f41443742b1c1c55" dependencies = [ "base64 0.21.0", "bytes", @@ -3235,28 +4209,83 @@ dependencies = [ "http", "http-body", "hyper", + "hyper-rustls", "hyper-tls", "ipnet", "js-sys", "log", "mime", + "mime_guess", "native-tls", "once_cell", "percent-encoding", "pin-project-lite", + "rustls 0.21.6", + "rustls-pemfile", "serde", "serde_json", "serde_urlencoded", "tokio", "tokio-native-tls", + "tokio-rustls 0.24.1", "tower-service", "url", "wasm-bindgen", "wasm-bindgen-futures", "web-sys", + "webpki-roots", "winreg", ] +[[package]] +name = "reqwest-middleware" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4531c89d50effe1fac90d095c8b133c20c5c714204feee0bfc3fd158e784209d" +dependencies = [ + "anyhow", + "async-trait", + "http", + "reqwest", + "serde", + "task-local-extensions", + "thiserror", +] + +[[package]] +name = "reqwest-retry" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48d0fd6ef4c6d23790399fe15efc8d12cd9f3d4133958f9bd7801ee5cbaec6c4" +dependencies = [ + "anyhow", + "async-trait", + "chrono", + "futures", + "getrandom", + "http", + "hyper", + "parking_lot 0.11.2", + "reqwest", + "reqwest-middleware", + "retry-policies", + "task-local-extensions", + "tokio", + "tracing", + "wasm-timer", +] + +[[package]] +name = "retry-policies" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e09bbcb5003282bcb688f0bae741b278e9c7e8f378f561522c9806c58e075d9b" +dependencies = [ + "anyhow", + "chrono", + "rand", +] + [[package]] name = "rfc6979" version = "0.4.0" @@ -3282,6 +4311,15 @@ dependencies = [ "winapi", ] +[[package]] +name = "ripemd" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd124222d17ad93a644ed9d011a40f4fb64aa54275c08cc216524a9ea82fb09f" +dependencies = [ + "digest 0.10.6", +] + [[package]] name = "rkyv" version = "0.7.41" @@ -3336,7 +4374,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "88073939a61e5b7680558e6be56b419e208420c2adb92be54921fa6b72283f1a" dependencies = [ "base64 0.13.1", - "bitflags", + "bitflags 1.3.2", "serde", ] @@ -3394,6 +4432,12 @@ dependencies = [ "serde_json", ] +[[package]] +name = "rustc-demangle" +version = "0.1.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" + [[package]] name = "rustc-hex" version = "2.1.0" @@ -3415,24 +4459,49 @@ version = "0.37.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "85597d61f83914ddeba6a47b3b8ffe7365107221c2e557ed94426489fefb5f77" dependencies = [ - "bitflags", + "bitflags 1.3.2", "errno", "io-lifetimes", "libc", - "linux-raw-sys", + "linux-raw-sys 0.3.1", + "windows-sys 0.48.0", +] + +[[package]] +name = "rustix" +version = "0.38.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ee020b1716f0a80e2ace9b03441a749e402e86712f15f16fe8a8f75afac732f" +dependencies = [ + "bitflags 2.3.3", + "errno", + "libc", + "linux-raw-sys 0.4.5", "windows-sys 0.48.0", ] [[package]] name = "rustls" -version = "0.20.8" +version = "0.20.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fff78fc74d175294f4e83b28343315ffcfb114b156f0185e9741cb5570f50e2f" +dependencies = [ + "log", + "ring", + "sct", + "webpki", +] + +[[package]] +name = "rustls" +version = "0.21.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fff78fc74d175294f4e83b28343315ffcfb114b156f0185e9741cb5570f50e2f" +checksum = "1d1feddffcfcc0b33f5c6ce9a29e341e4cd59c3f78e7ee45f4a40c038b1d6cbb" dependencies = [ "log", "ring", + "rustls-webpki", "sct", - "webpki", ] [[package]] @@ -3456,6 +4525,16 @@ dependencies = [ "base64 0.21.0", ] +[[package]] +name = "rustls-webpki" +version = "0.101.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "513722fd73ad80a71f72b61009ea1b584bcfa1483ca93949c8f290298837fa59" +dependencies = [ + "ring", + "untrusted", +] + [[package]] name = "rustversion" version = "1.0.12" @@ -3468,6 +4547,24 @@ version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041" +[[package]] +name = "salsa20" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97a22f5af31f73a954c10289c93e8a50cc23d971e80ee446f1f6f7137a088213" +dependencies = [ + "cipher", +] + +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + [[package]] name = "scale-info" version = "2.5.0" @@ -3513,6 +4610,18 @@ version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1792db035ce95be60c3f8853017b3999209281c24e2ba5bc8e59bf97a0c590c1" +[[package]] +name = "scrypt" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f9e24d2b632954ded8ab2ef9fea0a0c769ea56ea98bddbafbad22caeeadf45d" +dependencies = [ + "hmac", + "pbkdf2 0.11.0", + "salsa20", + "sha2 0.10.6", +] + [[package]] name = "sct" version = "0.7.0" @@ -3548,7 +4657,7 @@ dependencies = [ "time", "tracing", "url", - "uuid", + "uuid 1.3.1", ] [[package]] @@ -3609,7 +4718,7 @@ dependencies = [ "sea-query-derive", "serde_json", "time", - "uuid", + "uuid 1.3.1", ] [[package]] @@ -3625,7 +4734,7 @@ dependencies = [ "serde_json", "sqlx", "time", - "uuid", + "uuid 1.3.1", ] [[package]] @@ -3712,7 +4821,7 @@ version = "2.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a332be01508d814fed64bf28f798a146d73792121129962fdf335bb3c49a4254" dependencies = [ - "bitflags", + "bitflags 1.3.2", "core-foundation", "core-foundation-sys", "libc", @@ -3734,25 +4843,40 @@ name = "semver" version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bebd363326d05ec3e2f532ab7660680f3b02130d780c299bca73469d521bc0ed" +dependencies = [ + "serde", +] + +[[package]] +name = "send_wrapper" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f638d531eccd6e23b980caf34876660d38e265409d8e99b397ab71eb3612fad0" + +[[package]] +name = "send_wrapper" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd0b0ec5f1c1ca621c432a25813d8d60c88abe6d3e08a3eb9cf37d97a0fe3d73" [[package]] name = "serde" -version = "1.0.160" +version = "1.0.173" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb2f3770c8bce3bcda7e149193a069a0f4365bda1fa5cd88e03bca26afc1216c" +checksum = "e91f70896d6720bc714a4a57d22fc91f1db634680e65c8efe13323f1fa38d53f" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.160" +version = "1.0.173" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "291a097c63d8497e00160b166a967a4a79c64f3facdd01cbd7502231688d77df" +checksum = "a6250dde8342e0232232be9ca3db7aa40aceb5a3e5dd9bddbc00d99a007cde49" dependencies = [ "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.26", ] [[package]] @@ -3766,6 +4890,15 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_spanned" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96426c9936fd7a0124915f9185ea1d20aa9445cc9821142f0a73bc9207a2e186" +dependencies = [ + "serde", +] + [[package]] name = "serde_urlencoded" version = "0.7.1" @@ -3787,7 +4920,7 @@ dependencies = [ "base64 0.13.1", "chrono", "hex", - "indexmap", + "indexmap 1.9.3", "serde", "serde_json", "serde_with_macros", @@ -3812,7 +4945,7 @@ version = "0.9.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9d684e3ec7de3bf5466b32bd75303ac16f0736426e5a4e0d6e489559ce1249c" dependencies = [ - "indexmap", + "indexmap 1.9.3", "itoa", "ryu", "serde", @@ -3827,7 +4960,20 @@ checksum = "f04293dc80c3993519f2d7f6f511707ee7094fe0c6d3406feb330cdb3540eba3" dependencies = [ "cfg-if", "cpufeatures", - "digest", + "digest 0.10.6", +] + +[[package]] +name = "sha2" +version = "0.9.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" +dependencies = [ + "block-buffer 0.9.0", + "cfg-if", + "cpufeatures", + "digest 0.9.0", + "opaque-debug", ] [[package]] @@ -3838,7 +4984,7 @@ checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0" dependencies = [ "cfg-if", "cpufeatures", - "digest", + "digest 0.10.6", ] [[package]] @@ -3847,7 +4993,7 @@ version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "54c2bb1a323307527314a36bfb73f24febb08ce2b8a554bf4ffd6f51ad15198c" dependencies = [ - "digest", + "digest 0.10.6", "keccak", ] @@ -3875,7 +5021,7 @@ version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5e1788eed21689f9cf370582dfc467ef36ed9c707f073528ddafa8d83e3b8500" dependencies = [ - "digest", + "digest 0.10.6", "rand_core", ] @@ -3885,6 +5031,12 @@ version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f27f6278552951f1f2b8cf9da965d10969b2efdea95a6ec47987ab46edfe263a" +[[package]] +name = "siphasher" +version = "0.3.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7bd3e3206899af3f8b12af284fafc038cc1dc2b41d1b89dd17297221c5d225de" + [[package]] name = "slab" version = "0.4.8" @@ -3928,6 +5080,20 @@ dependencies = [ "winapi", ] +[[package]] +name = "solang-parser" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c792fe9fae2a2f716846f214ca10d5a1e21133e0bf36cef34bcc4a852467b21" +dependencies = [ + "itertools", + "lalrpop", + "lalrpop-util", + "phf", + "thiserror", + "unicode-xid", +] + [[package]] name = "solidity-metadata" version = "1.0.0" @@ -3940,6 +5106,24 @@ dependencies = [ "thiserror", ] +[[package]] +name = "sourcify" +version = "0.1.0" +source = "git+https://github.com/blockscout/blockscout-rs?branch=rimrakhimov/libs/sourcify#9abb78b6b373bd08f2a5f4dac1a4d069e60c7dd6" +dependencies = [ + "anyhow", + "blockscout-display-bytes", + "bytes", + "reqwest", + "reqwest-middleware", + "reqwest-retry", + "serde", + "serde_json", + "thiserror", + "tracing", + "url", +] + [[package]] name = "spin" version = "0.5.2" @@ -3996,7 +5180,7 @@ dependencies = [ "atoi", "base64 0.13.1", "bigdecimal", - "bitflags", + "bitflags 1.3.2", "byteorder", "bytes", "chrono", @@ -4015,7 +5199,7 @@ dependencies = [ "hex", "hkdf", "hmac", - "indexmap", + "indexmap 1.9.3", "itoa", "libc", "libsqlite3-sys", @@ -4028,12 +5212,12 @@ dependencies = [ "percent-encoding", "rand", "rust_decimal", - "rustls", + "rustls 0.20.8", "rustls-pemfile", "serde", "serde_json", "sha1", - "sha2", + "sha2 0.10.6", "smallvec", "sqlformat", "sqlx-rt", @@ -4042,7 +5226,7 @@ dependencies = [ "time", "tokio-stream", "url", - "uuid", + "uuid 1.3.1", "webpki-roots", "whoami", ] @@ -4074,7 +5258,7 @@ checksum = "804d3f245f894e61b1e6263c84b23ca675d96753b5abfd5cc8597d86806e8024" dependencies = [ "once_cell", "tokio", - "tokio-rustls", + "tokio-rustls 0.23.4", ] [[package]] @@ -4083,6 +5267,19 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" +[[package]] +name = "string_cache" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f91138e76242f575eb1d3b38b4f1362f10d3a43f47d182a5b359af488a02293b" +dependencies = [ + "new_debug_unreachable", + "once_cell", + "parking_lot 0.12.1", + "phf_shared 0.10.0", + "precomputed-hash", +] + [[package]] name = "stringprep" version = "0.1.2" @@ -4101,24 +5298,24 @@ checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" [[package]] name = "strum" -version = "0.24.1" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "063e6045c0e62079840579a7e47a355ae92f60eb74daaf156fb1e84ba164e63f" +checksum = "290d54ea6f91c969195bdbcd7442c8c2a2ba87da8bf60a7ee86a235d4bc1e125" dependencies = [ "strum_macros", ] [[package]] name = "strum_macros" -version = "0.24.3" +version = "0.25.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e385be0d24f186b4ce2f9982191e7101bb737312ad61c1f2f984f34bcf85d59" +checksum = "6069ca09d878a33f883cc06aaa9718ede171841d3832450354410b718b097232" dependencies = [ "heck 0.4.1", "proc-macro2", "quote", "rustversion", - "syn 1.0.109", + "syn 2.0.26", ] [[package]] @@ -4127,6 +5324,26 @@ version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" +[[package]] +name = "svm-rs" +version = "0.2.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a04fc4f5cd35c700153b233f5575ccb3237e0f941fa5049d9e98254d10bf2fe" +dependencies = [ + "fs2", + "hex", + "home", + "once_cell", + "reqwest", + "semver", + "serde", + "serde_json", + "sha2 0.10.6", + "thiserror", + "url", + "zip", +] + [[package]] name = "syn" version = "1.0.109" @@ -4140,9 +5357,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.15" +version = "2.0.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a34fcf3e8b60f57e6a14301a2e916d323af98b0ea63c599441eec8558660c822" +checksum = "45c3457aacde3c65315de5031ec191ce46604304d2446e803d71ade03308d970" dependencies = [ "proc-macro2", "quote", @@ -4161,6 +5378,15 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" +[[package]] +name = "task-local-extensions" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba323866e5d033818e3240feeb9f7db2c4296674e4d9e16b97b7bf8f490434e8" +dependencies = [ + "pin-utils", +] + [[package]] name = "tempfile" version = "3.5.0" @@ -4170,10 +5396,21 @@ dependencies = [ "cfg-if", "fastrand", "redox_syscall 0.3.5", - "rustix", + "rustix 0.37.11", "windows-sys 0.45.0", ] +[[package]] +name = "term" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c59df8ac95d96ff9bede18eb7300b0fda5e5d8d90960e76f8e14ae765eedbf1f" +dependencies = [ + "dirs-next", + "rustversion", + "winapi", +] + [[package]] name = "termcolor" version = "1.2.0" @@ -4212,7 +5449,7 @@ checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.26", ] [[package]] @@ -4300,11 +5537,12 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.27.0" +version = "1.29.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0de47a4eecbe11f498978a9b29d792f0d2692d1dd003650c24c76510e3bc001" +checksum = "532826ff75199d5833b9d2c5fe410f29235e25704ee5f0ef599fb51c21f4a4da" dependencies = [ "autocfg", + "backtrace", "bytes", "libc", "mio", @@ -4314,7 +5552,7 @@ dependencies = [ "signal-hook-registry", "socket2", "tokio-macros", - "windows-sys 0.45.0", + "windows-sys 0.48.0", ] [[package]] @@ -4329,13 +5567,13 @@ dependencies = [ [[package]] name = "tokio-macros" -version = "2.0.0" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61a573bdc87985e9d6ddeed1b3d864e8a302c847e40d647746df2f1de209d1ce" +checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.26", ] [[package]] @@ -4354,11 +5592,21 @@ version = "0.23.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c43ee83903113e03984cb9e5cebe6c04a5116269e900e3ddba8f068a62adda59" dependencies = [ - "rustls", + "rustls 0.20.8", "tokio", "webpki", ] +[[package]] +name = "tokio-rustls" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" +dependencies = [ + "rustls 0.21.6", + "tokio", +] + [[package]] name = "tokio-stream" version = "0.1.12" @@ -4370,6 +5618,22 @@ dependencies = [ "tokio", ] +[[package]] +name = "tokio-tungstenite" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54319c93411147bced34cb5609a80e0a8e44c5999c93903a81cd866630ec0bfd" +dependencies = [ + "futures-util", + "log", + "rustls 0.20.8", + "tokio", + "tokio-rustls 0.23.4", + "tungstenite", + "webpki", + "webpki-roots", +] + [[package]] name = "tokio-util" version = "0.7.7" @@ -4393,19 +5657,36 @@ dependencies = [ "serde", ] +[[package]] +name = "toml" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c17e963a819c331dcacd7ab957d80bc2b9a9c1e71c804826d2f283dd65306542" +dependencies = [ + "serde", + "serde_spanned", + "toml_datetime", + "toml_edit", +] + [[package]] name = "toml_datetime" -version = "0.6.1" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ab8ed2edee10b50132aed5f331333428b011c99402b5a534154ed15746f9622" +checksum = "7cda73e2f1397b1262d6dfdcef8aafae14d1de7748d66822d3bfeeb6d03e5e4b" +dependencies = [ + "serde", +] [[package]] name = "toml_edit" -version = "0.19.8" +version = "0.19.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "239410c8609e8125456927e6707163a3b1fdb40561e4b803bc041f466ccfdc13" +checksum = "f8123f27e969974a3dfba720fdb560be359f57b44302d280ba72e76a74480e8a" dependencies = [ - "indexmap", + "indexmap 2.0.0", + "serde", + "serde_spanned", "toml_datetime", "winnow", ] @@ -4435,7 +5716,7 @@ dependencies = [ "rustls-native-certs", "rustls-pemfile", "tokio", - "tokio-rustls", + "tokio-rustls 0.23.4", "tokio-stream", "tokio-util", "tower", @@ -4451,7 +5732,7 @@ version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5bf5e9b9c0f7e0a7c027dcfaba7b2c60816c7049171f679d99ee2ff65d0de8c4" dependencies = [ - "prettyplease", + "prettyplease 0.1.25", "proc-macro2", "prost-build", "quote", @@ -4466,7 +5747,7 @@ checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" dependencies = [ "futures-core", "futures-util", - "indexmap", + "indexmap 1.9.3", "pin-project", "pin-project-lite", "rand", @@ -4596,6 +5877,27 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" +[[package]] +name = "tungstenite" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30ee6ab729cd4cf0fd55218530c4522ed30b7b6081752839b68fcec8d0960788" +dependencies = [ + "base64 0.13.1", + "byteorder", + "bytes", + "http", + "httparse", + "log", + "rand", + "rustls 0.20.8", + "sha1", + "thiserror", + "url", + "utf-8", + "webpki", +] + [[package]] name = "typenum" version = "1.16.0" @@ -4620,6 +5922,15 @@ dependencies = [ "static_assertions", ] +[[package]] +name = "unicase" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6" +dependencies = [ + "version_check", +] + [[package]] name = "unicode-bidi" version = "0.3.13" @@ -4679,15 +5990,31 @@ checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" [[package]] name = "url" -version = "2.3.1" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d68c799ae75762b8c3fe375feb6600ef5602c883c5d21eb51c09f22b83c4643" +checksum = "50bff7831e19200a85b17131d085c25d7811bc4e186efdaf54bbd132994a88cb" dependencies = [ "form_urlencoded", "idna", "percent-encoding", ] +[[package]] +name = "utf-8" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" + +[[package]] +name = "uuid" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7" +dependencies = [ + "getrandom", + "serde", +] + [[package]] name = "uuid" version = "1.3.1" @@ -4731,6 +6058,16 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9d5b2c62b4012a3e1eca5a7e077d13b3bf498c4073e33ccd58626607748ceeca" +[[package]] +name = "walkdir" +version = "2.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36df944cda56c7d8d8b7496af378e6b16de9284591917d307c9b4d313c44e698" +dependencies = [ + "same-file", + "winapi-util", +] + [[package]] name = "want" version = "0.3.0" @@ -4813,6 +6150,21 @@ version = "0.2.84" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0046fef7e28c3804e5e38bfa31ea2a0f73905319b677e57ebe37e49358989b5d" +[[package]] +name = "wasm-timer" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be0ecb0db480561e9a7642b5d3e4187c128914e58aa84330b9493e3eb68c5e7f" +dependencies = [ + "futures", + "js-sys", + "parking_lot 0.11.2", + "pin-utils", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + [[package]] name = "web-sys" version = "0.3.61" @@ -5052,9 +6404,9 @@ checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" [[package]] name = "winnow" -version = "0.4.1" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae8970b36c66498d8ff1d66685dc86b91b29db0c7739899012f63a63814b4b28" +checksum = "f46aab759304e4d7b2075a9aecba26228bb073ee8c50db796b2c72c676b5d807" dependencies = [ "memchr", ] @@ -5068,6 +6420,25 @@ dependencies = [ "winapi", ] +[[package]] +name = "ws_stream_wasm" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7999f5f4217fe3818726b66257a4475f71e74ffd190776ad053fa159e50737f5" +dependencies = [ + "async_io_stream", + "futures", + "js-sys", + "log", + "pharos", + "rustc_version", + "send_wrapper 0.6.0", + "thiserror", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + [[package]] name = "wyz" version = "0.5.1" @@ -5098,13 +6469,52 @@ version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2a0956f1ba7c7909bfb66c2e9e4124ab6f6482560f6628b5aaeba39207c9aad9" +[[package]] +name = "zip" +version = "0.6.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "760394e246e4c28189f19d488c058bf16f564016aefac5d32bb1f3b51d5e9261" +dependencies = [ + "aes", + "byteorder", + "bzip2", + "constant_time_eq", + "crc32fast", + "crossbeam-utils", + "flate2", + "hmac", + "pbkdf2 0.11.0", + "sha1", + "time", + "zstd 0.11.2+zstd.1.5.2", +] + +[[package]] +name = "zstd" +version = "0.11.2+zstd.1.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20cc960326ece64f010d2d2107537f26dc589a6573a316bd5b1dba685fa5fde4" +dependencies = [ + "zstd-safe 5.0.2+zstd.1.5.2", +] + [[package]] name = "zstd" version = "0.12.3+zstd.1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "76eea132fb024e0e13fd9c2f5d5d595d8a967aa72382ac2f9d39fcc95afd0806" dependencies = [ - "zstd-safe", + "zstd-safe 6.0.5+zstd.1.5.4", +] + +[[package]] +name = "zstd-safe" +version = "5.0.2+zstd.1.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d2a5585e04f9eea4b2a3d1eca508c4dee9592a89ef6f450c11719da0726f4db" +dependencies = [ + "libc", + "zstd-sys", ] [[package]] diff --git a/eth-bytecode-db/Cargo.toml b/eth-bytecode-db/Cargo.toml index 5223dacac..661247ed1 100644 --- a/eth-bytecode-db/Cargo.toml +++ b/eth-bytecode-db/Cargo.toml @@ -4,5 +4,5 @@ members = [ "eth-bytecode-db/entity", "eth-bytecode-db/migration", "eth-bytecode-db-server", - "eth-bytecode-db-proto" + "eth-bytecode-db-proto", ] diff --git a/eth-bytecode-db/eth-bytecode-db-proto/proto/v2/api_config_http.yaml b/eth-bytecode-db/eth-bytecode-db-proto/proto/v2/api_config_http.yaml index 21c733be7..d0c9fff1f 100644 --- a/eth-bytecode-db/eth-bytecode-db-proto/proto/v2/api_config_http.yaml +++ b/eth-bytecode-db/eth-bytecode-db-proto/proto/v2/api_config_http.yaml @@ -9,6 +9,10 @@ http: post: /api/v2/bytecodes/sources:search body: "*" + - selector: blockscout.ethBytecodeDb.v2.Database.SearchSourcifySources + post: /api/v2/bytecodes/sources:search-sourcify + body: "*" + #################### SolidityVerifier #################### - selector: blockscout.ethBytecodeDb.v2.SolidityVerifier.VerifyMultiPart diff --git a/eth-bytecode-db/eth-bytecode-db-proto/proto/v2/eth-bytecode-db.proto b/eth-bytecode-db/eth-bytecode-db-proto/proto/v2/eth-bytecode-db.proto index 469ec150c..929a62e2a 100644 --- a/eth-bytecode-db/eth-bytecode-db-proto/proto/v2/eth-bytecode-db.proto +++ b/eth-bytecode-db/eth-bytecode-db-proto/proto/v2/eth-bytecode-db.proto @@ -6,6 +6,8 @@ option go_package = "github.com/blockscout/blockscout-rs/eth-bytecode-db"; service Database { rpc SearchSources(SearchSourcesRequest) returns (SearchSourcesResponse) {} + + rpc SearchSourcifySources(SearchSourcifySourcesRequest) returns (SearchSourcesResponse) {} } service SolidityVerifier { @@ -175,6 +177,13 @@ message SearchSourcesRequest { BytecodeType bytecode_type = 2; } +message SearchSourcifySourcesRequest { + /// Id of the chain the contract is verified on + string chain_id = 1; + /// The address of the contract to be verified + string contract_address = 2; +} + message SearchSourcesResponse { repeated Source sources = 1; } diff --git a/eth-bytecode-db/eth-bytecode-db-proto/swagger/v2/eth-bytecode-db.swagger.yaml b/eth-bytecode-db/eth-bytecode-db-proto/swagger/v2/eth-bytecode-db.swagger.yaml index c82105632..fbadb9dca 100644 --- a/eth-bytecode-db/eth-bytecode-db-proto/swagger/v2/eth-bytecode-db.swagger.yaml +++ b/eth-bytecode-db/eth-bytecode-db-proto/swagger/v2/eth-bytecode-db.swagger.yaml @@ -33,6 +33,26 @@ paths: $ref: '#/definitions/v2SearchSourcesRequest' tags: - Database + /api/v2/bytecodes/sources:search-sourcify: + post: + operationId: Database_SearchSourcifySources + responses: + "200": + description: A successful response. + schema: + $ref: '#/definitions/v2SearchSourcesResponse' + default: + description: An unexpected error response. + schema: + $ref: '#/definitions/googlerpcStatus' + parameters: + - name: body + in: body + required: true + schema: + $ref: '#/definitions/v2SearchSourcifySourcesRequest' + tags: + - Database /api/v2/verifier/solidity/sources:verify-multi-part: post: operationId: SolidityVerifier_VerifyMultiPart @@ -263,6 +283,15 @@ definitions: type: array items: $ref: '#/definitions/v2Source' + v2SearchSourcifySourcesRequest: + type: object + properties: + chainId: + type: string + title: / Id of the chain the contract is verified on + contractAddress: + type: string + title: / The address of the contract to be verified v2Source: type: object properties: diff --git a/eth-bytecode-db/eth-bytecode-db-server/Cargo.toml b/eth-bytecode-db/eth-bytecode-db-server/Cargo.toml index 5e06890f9..9062e3101 100644 --- a/eth-bytecode-db/eth-bytecode-db-server/Cargo.toml +++ b/eth-bytecode-db/eth-bytecode-db-server/Cargo.toml @@ -17,11 +17,15 @@ async-trait = "0.1" blockscout-display-bytes = "1.0" blockscout-service-launcher = { version = "0.7.1", features = [ "database-0_11" ] } config = "0.13" +ethers = "2.0.0" sea-orm = "0.11" serde = "1.0" +serde_json = "1.0.96" serde_with = "2.1" +sourcify = { git = "https://github.com/blockscout/blockscout-rs", branch = "rimrakhimov/libs/sourcify" } tokio = { version = "1.23", features = [ "rt-multi-thread", "macros" ] } tonic = "0.8" +tracing = "0.1" [dev-dependencies] smart-contract-verifier-proto = { git = "https://github.com/blockscout/blockscout-rs", rev = "52c41ec" } @@ -33,6 +37,4 @@ reqwest = { version = "0.11", features = ["json"]} rand = "0.8" rstest = "0.16" sea-orm = { version = "*", features = [ "sqlx-sqlite" ]} -serde_json = "1.0.96" -tokio-stream = { version = "0.1", features = ["net"] } -tracing = "0.1" \ No newline at end of file +tokio-stream = { version = "0.1", features = ["net"] } \ No newline at end of file diff --git a/eth-bytecode-db/eth-bytecode-db-server/src/proto.rs b/eth-bytecode-db/eth-bytecode-db-server/src/proto.rs index c2c5f6455..df99b94c7 100644 --- a/eth-bytecode-db/eth-bytecode-db-server/src/proto.rs +++ b/eth-bytecode-db/eth-bytecode-db-server/src/proto.rs @@ -3,8 +3,8 @@ pub use eth_bytecode_db_proto::blockscout::eth_bytecode_db::v2::{ solidity_verifier_actix, solidity_verifier_server, source, sourcify_verifier_actix, sourcify_verifier_server, verify_response, vyper_verifier_actix, vyper_verifier_server, BytecodeType, HealthCheckRequest, HealthCheckResponse, ListCompilerVersionsRequest, - ListCompilerVersionsResponse, SearchSourcesRequest, SearchSourcesResponse, Source, - VerificationMetadata, VerifyResponse, VerifySolidityMultiPartRequest, - VerifySolidityStandardJsonRequest, VerifySourcifyRequest, VerifyVyperMultiPartRequest, - VerifyVyperStandardJsonRequest, + ListCompilerVersionsResponse, SearchSourcesRequest, SearchSourcesResponse, + SearchSourcifySourcesRequest, Source, VerificationMetadata, VerifyResponse, + VerifySolidityMultiPartRequest, VerifySolidityStandardJsonRequest, VerifySourcifyRequest, + VerifyVyperMultiPartRequest, VerifyVyperStandardJsonRequest, }; diff --git a/eth-bytecode-db/eth-bytecode-db-server/src/server.rs b/eth-bytecode-db/eth-bytecode-db-server/src/server.rs index f9bc7d62c..a3475b25a 100644 --- a/eth-bytecode-db/eth-bytecode-db-server/src/server.rs +++ b/eth-bytecode-db/eth-bytecode-db-server/src/server.rs @@ -86,7 +86,19 @@ pub async fn run(settings: Settings) -> Result<(), anyhow::Error> { let db_connection = Arc::new(sea_orm::Database::connect(settings.database.url).await?); let client = Client::new_arc(db_connection.clone(), settings.verifier.uri).await?; - let database = Arc::new(DatabaseService::new_arc(db_connection)); + let sourcify_client = settings + .database + .sourcify + .enabled + .then(|| { + sourcify::ClientBuilder::default() + .base_url(&settings.database.sourcify.base_url) + .total_duration(settings.database.sourcify.total_request_duration) + .build() + }) + .transpose()?; + let database = Arc::new(DatabaseService::new_arc(db_connection, sourcify_client)); + let solidity_verifier = Arc::new(SolidityVerifierService::new(client.clone())); let vyper_verifier = Arc::new(VyperVerifierService::new(client.clone())); let sourcify_verifier = Arc::new(SourcifyVerifierService::new(client.clone())); diff --git a/eth-bytecode-db/eth-bytecode-db-server/src/services/database.rs b/eth-bytecode-db/eth-bytecode-db-server/src/services/database.rs index 77e2541e1..9fa096bec 100644 --- a/eth-bytecode-db/eth-bytecode-db-server/src/services/database.rs +++ b/eth-bytecode-db/eth-bytecode-db-server/src/services/database.rs @@ -1,5 +1,8 @@ use crate::{ - proto::{database_server::Database, SearchSourcesRequest, SearchSourcesResponse}, + proto::{ + database_server::Database, SearchSourcesRequest, SearchSourcesResponse, + SearchSourcifySourcesRequest, + }, types::{BytecodeTypeWrapper, SourceWrapper}, }; use amplify::Wrapper; @@ -11,11 +14,18 @@ use std::{str::FromStr, sync::Arc}; pub struct DatabaseService { pub db_client: Arc, + pub sourcify_client: Option, } impl DatabaseService { - pub fn new_arc(db_client: Arc) -> Self { - Self { db_client } + pub fn new_arc( + db_client: Arc, + sourcify_client: Option, + ) -> Self { + Self { + db_client, + sourcify_client, + } } } @@ -47,4 +57,80 @@ impl Database for DatabaseService { let response = SearchSourcesResponse { sources }; Ok(tonic::Response::new(response)) } + + async fn search_sourcify_sources( + &self, + request: tonic::Request, + ) -> Result, tonic::Status> { + let request = request.into_inner(); + + let chain_id = request.chain_id; + let contract_address = DisplayBytes::from_str(&request.contract_address) + .map_err(|err| { + tonic::Status::invalid_argument(format!("Invalid contract address: {err}")) + })? + .0; + + let sourcify_client = self + .sourcify_client + .as_ref() + .ok_or(tonic::Status::unimplemented( + "sourcify search is not enabled", + ))?; + + let sourcify_result = sourcify_client + .get_source_files_any(&chain_id, contract_address) + .await + .map_err(process_sourcify_error); + + let result = match sourcify_result { + Ok(response) => { + let source = SourceWrapper::try_from(response)?.into_inner(); + SearchSourcesResponse { + sources: vec![source], + } + } + Err(None) => SearchSourcesResponse { sources: vec![] }, + Err(Some(err)) => return Err(err), + }; + + Ok(tonic::Response::new(result)) + } +} + +fn process_sourcify_error(error: sourcify::Error) -> Option { + match error { + sourcify::Error::InvalidArgument { .. } + | sourcify::Error::Reqwest(_) + | sourcify::Error::ReqwestMiddleware(_) => { + tracing::error!(target: "sourcify", "{error}"); + Some(tonic::Status::internal( + "sending request to sourcify failed", + )) + } + sourcify::Error::Sourcify(sourcify::SourcifyError::TooManyRequests(_)) => { + tracing::error!(target: "sourcify", "{error}"); + Some(tonic::Status::resource_exhausted(error.to_string())) + } + sourcify::Error::Sourcify(sourcify::SourcifyError::InternalServerError(_)) => { + tracing::error!(target: "sourcify", "{error}"); + Some(tonic::Status::internal("sourcify responded with error")) + } + sourcify::Error::Sourcify(sourcify::SourcifyError::NotFound(_)) => { + tracing::trace!(target: "sourcify", "{error}"); + None + } + sourcify::Error::Sourcify(sourcify::SourcifyError::ChainNotSupported(_)) => { + tracing::error!(target: "sourcify", "{error}"); + None + } + sourcify::Error::Sourcify(sourcify::SourcifyError::BadRequest(_)) => { + tracing::error!(target: "sourcify", "{error}"); + Some(tonic::Status::internal("sourcify responded with error")) + } + sourcify::Error::Sourcify(sourcify::SourcifyError::UnexpectedStatusCode { .. }) => { + tracing::error!(target: "sourcify", "{error}"); + Some(tonic::Status::internal("sourcify responded with error")) + } + } } diff --git a/eth-bytecode-db/eth-bytecode-db-server/src/settings.rs b/eth-bytecode-db/eth-bytecode-db-server/src/settings.rs index 711b07288..9dab88207 100644 --- a/eth-bytecode-db/eth-bytecode-db-server/src/settings.rs +++ b/eth-bytecode-db/eth-bytecode-db-server/src/settings.rs @@ -4,6 +4,7 @@ use blockscout_service_launcher::{ use config::{Config, File}; use serde::{de, Deserialize}; use serde_with::{serde_as, DisplayFromStr}; +use std::time::Duration; /// Wrapper under [`serde::de::IgnoredAny`] which implements /// [`PartialEq`] and [`Eq`] for fields to be ignored. @@ -47,6 +48,8 @@ pub struct DatabaseSettings { pub url: String, pub create_database: bool, pub run_migrations: bool, + #[serde(default)] + pub sourcify: SourcifySettings, } #[serde_as] @@ -57,6 +60,25 @@ pub struct VerifierSettings { pub uri: tonic::transport::Uri, } +#[derive(Debug, Clone, Deserialize, PartialEq, Eq)] +#[serde(deny_unknown_fields)] +pub struct SourcifySettings { + pub enabled: bool, + pub base_url: String, + /// The maximum duration for which attempts to send a request will be processed. + pub total_request_duration: Duration, +} + +impl Default for SourcifySettings { + fn default() -> Self { + Self { + enabled: false, + base_url: "https://sourcify.dev/server/".to_string(), + total_request_duration: Duration::from_secs(60), + } + } +} + impl Settings { pub fn new() -> anyhow::Result { let config_path = std::env::var("ETH_BYTECODE_DB__CONFIG"); @@ -84,6 +106,7 @@ impl Settings { url: database_url, create_database: false, run_migrations: false, + sourcify: Default::default(), }, verifier: VerifierSettings { uri: verifier_uri }, config_path: Default::default(), diff --git a/eth-bytecode-db/eth-bytecode-db-server/src/types/enums.rs b/eth-bytecode-db/eth-bytecode-db-server/src/types/enums.rs index f8702aae3..ece7be2a0 100644 --- a/eth-bytecode-db/eth-bytecode-db-server/src/types/enums.rs +++ b/eth-bytecode-db/eth-bytecode-db-server/src/types/enums.rs @@ -77,6 +77,17 @@ impl From for MatchTypeWrapper { } } +impl From for MatchTypeWrapper { + fn from(value: sourcify::MatchType) -> Self { + match value { + sourcify::MatchType::Full => MatchTypeWrapper::from(proto::source::MatchType::Full), + sourcify::MatchType::Partial => { + MatchTypeWrapper::from(proto::source::MatchType::Partial) + } + } + } +} + /********** Tests **********/ #[cfg(test)] @@ -163,4 +174,15 @@ mod match_type_tests { let result = MatchTypeWrapper::from(verification_type).into_inner(); assert_eq!(proto_type, result); } + + #[rstest] + #[case(sourcify::MatchType::Partial, proto::source::MatchType::Partial)] + #[case(sourcify::MatchType::Full, proto::source::MatchType::Full)] + fn from_sourcify_to_proto( + #[case] verification_type: sourcify::MatchType, + #[case] proto_type: proto::source::MatchType, + ) { + let result = MatchTypeWrapper::from(verification_type).into_inner(); + assert_eq!(proto_type, result); + } } diff --git a/eth-bytecode-db/eth-bytecode-db-server/src/types/source.rs b/eth-bytecode-db/eth-bytecode-db-server/src/types/source.rs index 984873974..68a99a39e 100644 --- a/eth-bytecode-db/eth-bytecode-db-server/src/types/source.rs +++ b/eth-bytecode-db/eth-bytecode-db-server/src/types/source.rs @@ -3,6 +3,7 @@ use crate::{ types::{MatchTypeWrapper, SourceTypeWrapper}, }; use amplify::{From, Wrapper}; +use blockscout_display_bytes::Bytes as DisplayBytes; use eth_bytecode_db::{search, verification}; #[derive(Wrapper, From, Clone, Debug, PartialEq)] @@ -46,9 +47,77 @@ impl From for SourceWrapper { } } +impl TryFrom for SourceWrapper { + type Error = tonic::Status; + + fn try_from(value: sourcify::GetSourceFilesResponse) -> Result { + let match_type = MatchTypeWrapper::from(value.status).into_inner(); + + let metadata: ethers::solc::artifacts::Metadata = + serde_json::from_value(value.metadata.clone()).map_err(|err| { + tracing::error!(target: "sourcify", "returned metadata cannot be parsed: {err}"); + tonic::Status::internal("error occurred when parsing sourcify response") + })?; + + // Compiler settings inside metadata contains a "compilationTarget" + // which does not exist in compiler input. We should remove the key + // to make the settings which could be used for the compiler input. + let compiler_settings = { + let mut compiler_settings = value + .metadata + .as_object() + .expect("metadata has been parsed successfully and must be an object") + .get("settings") + .expect("metadata has been parsed successfully and must contain 'settings' key") + .as_object() + .expect("metadata has been parsed successfully and 'settings' must be an object") + .clone(); + + compiler_settings.remove("compilationTarget"); + compiler_settings + }; + + let abi = value + .metadata + .as_object() + .expect("metadata has been parsed successfully and must be an object") + .get("output") + .expect("metadata has been parsed successfully and must contain 'output' key") + .as_object() + .expect("metadata has been parsed successfully and 'output' must be an object") + .get("abi") + .expect("metadata has been parsed successfully and must contain 'output.abi' key") + .clone(); + + let (file_name, contract_name) = metadata.settings.compilation_target.into_iter() + .next().ok_or_else(|| { + tracing::error!(target: "sourcify", "returned metadata does not contain any compilation target"); + tonic::Status::internal("error occurred when parsing sourcify response") + })?; + + let constructor_arguments = value + .constructor_arguments + .map(|v| DisplayBytes::from(v).to_string()); + + Ok(proto::Source { + file_name, + contract_name, + compiler_version: metadata.compiler.version, + compiler_settings: serde_json::to_string(&compiler_settings).unwrap(), + source_type: proto::source::SourceType::Solidity.into(), + source_files: value.sources, + abi: Some(serde_json::to_string(&abi).unwrap()), + constructor_arguments, + match_type: match_type.into(), + } + .into()) + } +} + #[cfg(test)] mod tests { use super::*; + use pretty_assertions::assert_eq; use std::collections::BTreeMap; #[test] @@ -130,4 +199,70 @@ mod tests { let result = SourceWrapper::from(search_source).into_inner(); assert_eq!(expected, result); } + + #[test] + fn try_from_sourcify_get_source_files_response_to_proto_source() { + let sourcify_response: sourcify::GetSourceFilesResponse = serde_json::from_value(serde_json::json!({ + "status": "full", + "files": [ + { + "name": "immutable-references.json", + "path": "/home/data/repository/contracts/full_match/5/0xb5fa8e1E33df0742Fa40F7bB5f41e782eb5524c3/immutable-references.json", + "content": "{\"76\":[{\"length\":32,\"start\":242}],\"90\":[{\"length\":32,\"start\":636}],\"92\":[{\"length\":32,\"start\":708}]}" + }, + { + "name": "library-map.json", + "path": "/home/data/repository/contracts/full_match/5/0xb5fa8e1E33df0742Fa40F7bB5f41e782eb5524c3/library-map.json", + "content": "{\"__$b01ade520cf6862e0b214d4ce779d49f2a$__\":\"77479d54e233b4b79b9e3f4cf2bd20575fdeb1bb\",\"__$21bb6923d223bd045c4cab9806bdf3594d$__\":\"4ea76bb37c82f6f453c4cbb4ae726036a7a8b820\"}" + }, + { + "name": "metadata.json", + "path": "/home/data/repository/contracts/full_match/5/0xb5fa8e1E33df0742Fa40F7bB5f41e782eb5524c3/metadata.json", + "content": "{\"compiler\":{\"version\":\"0.8.7+commit.e28d00a7\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_c\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"a\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"arr\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"b\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"c\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"test_array\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/C2.sol\":\"C2\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"contracts/Array.sol\":{\"keccak256\":\"0xa3c043d47c03251f392e0dcdf7c2ad5069436cc72561b2404a195d84a78fb33c\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://9eeae2fe8bb3e5addd48dea0b8c5a81581b4137ad605b103b7edc35ea1ab2997\",\"dweb:/ipfs/QmRaC1FTQxkcWwmyZeZ4twQswdpcTnN5GQJ2Db7RMdf14j\"]},\"contracts/Array2.sol\":{\"keccak256\":\"0x6b5b4acc9b4f10f7df803702516752978c40cb4eadd48a218dcc0503fd7f4f88\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://6f9b39fbd016e6b0c62cb3a7d8abc8981fe383c345381dfd7533a8cb8a1ded69\",\"dweb:/ipfs/QmUznGnpnz1TFuQZzjDX4NzoVFsiwRzaA2T7gZQZUoFDim\"]},\"contracts/C1.sol\":{\"keccak256\":\"0x92ca0ef5999e6bae5556c90314c3b7fe3bf95cabf8423d8415ac3d3955f524df\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://1bb5f1bc39e5507da05e9d7700546f74896b47c4da076fbd744d8b6269c32a09\",\"dweb:/ipfs/QmRoabfGHHmoKTPb8vtdWFuaesoc4mUjzuSgEDE8TpeYwF\"]},\"contracts/C2.sol\":{\"keccak256\":\"0x20dd630583b88340fae8cda0a6008c0db058ee4b35d8a1f5a44bcd66ef892782\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://998e0420f165f61fec241b5fbd71f06bc150098c8981f0aeedbf5a95c240b2a0\",\"dweb:/ipfs/QmSG3mwV4zqk4NacHtf3MWSAbWW96sorEVjNBPJiWXs2LQ\"]}},\"version\":1}" + }, + { + "name": "Array.sol", + "path": "/home/data/repository/contracts/full_match/5/0xb5fa8e1E33df0742Fa40F7bB5f41e782eb5524c3/sources/contracts/Array.sol", + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.7;\n\n// Array function to delete element at index and re-organize the array\n// so that there are no gaps between the elements.\nlibrary Array {\n function remove(uint[] storage arr, uint index) public {\n // Move the last element into the place to delete\n require(arr.length > 0, \"Can't remove from empty array\");\n arr[index] = arr[arr.length - 1];\n arr.pop();\n }\n}\n" + }, + { + "name": "Array2.sol", + "path": "/home/data/repository/contracts/full_match/5/0xb5fa8e1E33df0742Fa40F7bB5f41e782eb5524c3/sources/contracts/Array2.sol", + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.7;\n\n// Array function to delete element at index and re-organize the array\n// so that there are no gaps between the elements.\nlibrary Array2 {\n function remove(uint[] storage arr, uint index) public {\n // Move the last element into the place to delete\n require(arr.length > 0, \"Can't remove from empty array\");\n arr[index] = arr[arr.length - 1];\n arr.pop();\n }\n}\n" + }, + { + "name": "C1.sol", + "path": "/home/data/repository/contracts/full_match/5/0xb5fa8e1E33df0742Fa40F7bB5f41e782eb5524c3/sources/contracts/C1.sol", + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.7;\n\ncontract C1 {\n uint256 immutable public a = 0;\n}\n\n" + }, + { + "name": "C2.sol", + "path": "/home/data/repository/contracts/full_match/5/0xb5fa8e1E33df0742Fa40F7bB5f41e782eb5524c3/sources/contracts/C2.sol", + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.7;\n\nimport \"./C1.sol\";\nimport \"./Array.sol\";\nimport \"./Array2.sol\";\n\ncontract C2 is C1 {\n uint[] public arr;\n\n uint256 immutable public b = 10;\n uint256 immutable public c;\n\n constructor(uint256 _c) {\n c = _c;\n }\n\n function test_array() public {\n for (uint i = 0; i < 3; i++) {\n arr.push(i);\n }\n\n Array.remove(arr, 1);\n Array2.remove(arr, 1);\n\n assert(arr.length == 1);\n assert(arr[0] == 0);\n }\n}\n" + } + ] + })).unwrap(); + + let expected = proto::Source { + file_name: "contracts/C2.sol".to_string(), + contract_name: "C2".to_string(), + compiler_version: "0.8.7+commit.e28d00a7".to_string(), + compiler_settings: "{\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]}".to_string(), + source_type: proto::source::SourceType::Solidity.into(), + source_files: BTreeMap::from([ + ("contracts/Array.sol".into(), "// SPDX-License-Identifier: MIT\npragma solidity 0.8.7;\n\n// Array function to delete element at index and re-organize the array\n// so that there are no gaps between the elements.\nlibrary Array {\n function remove(uint[] storage arr, uint index) public {\n // Move the last element into the place to delete\n require(arr.length > 0, \"Can't remove from empty array\");\n arr[index] = arr[arr.length - 1];\n arr.pop();\n }\n}\n".into()), + ("contracts/Array2.sol".into(), "// SPDX-License-Identifier: MIT\npragma solidity 0.8.7;\n\n// Array function to delete element at index and re-organize the array\n// so that there are no gaps between the elements.\nlibrary Array2 {\n function remove(uint[] storage arr, uint index) public {\n // Move the last element into the place to delete\n require(arr.length > 0, \"Can't remove from empty array\");\n arr[index] = arr[arr.length - 1];\n arr.pop();\n }\n}\n".into()), + ("contracts/C1.sol".into(), "// SPDX-License-Identifier: MIT\npragma solidity 0.8.7;\n\ncontract C1 {\n uint256 immutable public a = 0;\n}\n\n".into()), + ("contracts/C2.sol".into(), "// SPDX-License-Identifier: MIT\npragma solidity 0.8.7;\n\nimport \"./C1.sol\";\nimport \"./Array.sol\";\nimport \"./Array2.sol\";\n\ncontract C2 is C1 {\n uint[] public arr;\n\n uint256 immutable public b = 10;\n uint256 immutable public c;\n\n constructor(uint256 _c) {\n c = _c;\n }\n\n function test_array() public {\n for (uint i = 0; i < 3; i++) {\n arr.push(i);\n }\n\n Array.remove(arr, 1);\n Array2.remove(arr, 1);\n\n assert(arr.length == 1);\n assert(arr[0] == 0);\n }\n}\n".into()), + ]), + abi: Some("[{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_c\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"a\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"arr\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"b\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"c\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"test_array\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]".into()), + constructor_arguments: None, + match_type: proto::source::MatchType::Full.into(), + }; + + let result = SourceWrapper::try_from(sourcify_response) + .expect("converting into SourceWrapper failed") + .into_inner(); + assert_eq!(expected, result); + } } diff --git a/eth-bytecode-db/eth-bytecode-db-server/tests/database_search.rs b/eth-bytecode-db/eth-bytecode-db-server/tests/database_search.rs new file mode 100644 index 000000000..57a3df3d5 --- /dev/null +++ b/eth-bytecode-db/eth-bytecode-db-server/tests/database_search.rs @@ -0,0 +1,102 @@ +mod verification_test_helpers; + +use crate::verification_test_helpers::{ + init_db, init_eth_bytecode_db_server, init_verifier_server, +}; +use async_trait::async_trait; +use eth_bytecode_db::{verification, verification::MatchType}; +use eth_bytecode_db_proto::blockscout::eth_bytecode_db::{ + v2 as eth_bytecode_db_v2, + v2::{SearchSourcesResponse, SearchSourcifySourcesRequest, Source}, +}; +use pretty_assertions::assert_eq; +use rstest::{fixture, rstest}; +use smart_contract_verifier_proto::blockscout::smart_contract_verifier::v2 as smart_contract_verifier_v2; +use std::collections::BTreeMap; +use tonic::Response; +use verification_test_helpers::{ + smart_contract_verifer_mock::{MockSolidityVerifierService, SmartContractVerifierServer}, + test_input_data, VerifierService, +}; + +const TEST_SUITE_NAME: &str = "database_search"; + +#[async_trait] +impl VerifierService for MockSolidityVerifierService { + fn add_into_service(&mut self, response: smart_contract_verifier_v2::VerifyResponse) { + self.expect_verify_multi_part() + .returning(move |_| Ok(Response::new(response.clone()))); + } + + fn build_server(self) -> SmartContractVerifierServer { + SmartContractVerifierServer::new().solidity_service(self) + } +} + +#[fixture] +fn service() -> MockSolidityVerifierService { + MockSolidityVerifierService::new() +} + +#[rstest] +#[tokio::test] +#[timeout(std::time::Duration::from_secs(60))] +#[ignore = "Needs database to run"] +async fn search_sourcify_sources(service: MockSolidityVerifierService) { + const ROUTE: &str = "/api/v2/bytecodes/sources:search-sourcify"; + + let db = init_db(TEST_SUITE_NAME, "test_returns_valid_source").await; + + let test_data = test_input_data::basic(verification::SourceType::Solidity, MatchType::Partial); + + let db_url = db.db_url(); + let verifier_addr = init_verifier_server(service, test_data.verifier_response).await; + + let eth_bytecode_db_base = init_eth_bytecode_db_server(db_url, verifier_addr).await; + + let chain_id = "5".to_string(); + let contract_address = "0x027f1fe8BbC2a7E9fE97868E82c6Ec6939086c52".to_string(); + + let request = SearchSourcifySourcesRequest { + chain_id, + contract_address, + }; + + let response = reqwest::Client::new() + .post(eth_bytecode_db_base.join(ROUTE).unwrap()) + .json(&request) + .send() + .await + .expect("Failed to send request"); + + // Assert that status code is success + if !response.status().is_success() { + let status = response.status(); + let message = response.text().await.expect("Read body as text"); + panic!("Invalid status code (success expected). Status: {status}. Message: {message}") + } + + let verification_response: SearchSourcesResponse = response + .json() + .await + .expect("Response deserialization failed"); + + let expected_sources: Vec = vec![ + Source { + file_name: "contracts/project:/ExternalTestMultiple.sol".to_string(), + contract_name: "ExternalTestMultiple".to_string(), + compiler_version: "0.6.8+commit.0bbfe453".to_string(), + compiler_settings: "{\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":300},\"remappings\":[]}".to_string(), + source_type: eth_bytecode_db_v2::source::SourceType::Solidity.into(), + source_files: BTreeMap::from([("contracts/project_/ExternalTestMultiple.sol".to_string(), "//SPDX-License-Identifier: MIT\r\npragma solidity ^0.6.8;\r\n\r\nlibrary ExternalTestLibraryMultiple {\r\n function pop(address[] storage list) external returns (address out) {\r\n out = list[list.length - 1];\r\n list.pop();\r\n }\r\n}\r\n".to_string())]), + abi: Some("[{\"anonymous\":false,\"inputs\":[],\"name\":\"SourcifySolidity14\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"input\",\"type\":\"address\"}],\"name\":\"identity\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]".to_string()), + constructor_arguments: None, + match_type: eth_bytecode_db_v2::source::MatchType::Full.into(), + } + ]; + + assert_eq!( + expected_sources, verification_response.sources, + "Invalid sources returned" + ); +} diff --git a/eth-bytecode-db/eth-bytecode-db-server/tests/verification_test_helpers/mod.rs b/eth-bytecode-db/eth-bytecode-db-server/tests/verification_test_helpers/mod.rs index 2e374b366..2dda72e1a 100644 --- a/eth-bytecode-db/eth-bytecode-db-server/tests/verification_test_helpers/mod.rs +++ b/eth-bytecode-db/eth-bytecode-db-server/tests/verification_test_helpers/mod.rs @@ -1,9 +1,9 @@ #![allow(unused_imports, dead_code)] mod database_helpers; -mod test_input_data; pub mod smart_contract_verifer_mock; +pub mod test_input_data; use async_trait::async_trait; use database_helpers::TestDbGuard; @@ -59,6 +59,7 @@ pub async fn init_eth_bytecode_db_server(db_url: &str, verifier_addr: SocketAddr settings.metrics.enabled = false; settings.tracing.enabled = false; settings.jaeger.enabled = false; + settings.database.sourcify.enabled = true; settings }; diff --git a/eth-bytecode-db/eth-bytecode-db/Cargo.toml b/eth-bytecode-db/eth-bytecode-db/Cargo.toml index 5ba461b9a..83bbc7445 100644 --- a/eth-bytecode-db/eth-bytecode-db/Cargo.toml +++ b/eth-bytecode-db/eth-bytecode-db/Cargo.toml @@ -24,6 +24,7 @@ sea-orm = { version = "0.11", features = [ futures = "0.3" lazy_static = "1" prometheus = "0.13" +reqwest = "0.11.18" semver = "1.0" serde = "1.0" serde_json = "1.0" @@ -43,7 +44,7 @@ pretty_assertions = "1.3" rstest = "0.16" sea-orm = { version = "*", features = ["mock"] } tokio-stream = { version = "0.1", features = ["net"] } -url = "2.3" +url = "2.4.0" [features] # When activated includes helper methods for tests and benchmarking diff --git a/libs/Cargo.toml b/libs/Cargo.toml index 3ad22e75b..1564d1267 100644 --- a/libs/Cargo.toml +++ b/libs/Cargo.toml @@ -6,4 +6,5 @@ members = [ "display-bytes", "mismatch", "solidity-metadata", + "sourcify", ] diff --git a/libs/sourcify/Cargo.toml b/libs/sourcify/Cargo.toml new file mode 100644 index 000000000..fd2309fbb --- /dev/null +++ b/libs/sourcify/Cargo.toml @@ -0,0 +1,26 @@ +[package] +name = "sourcify" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +anyhow = "1.0.71" +bytes = "1.4.0" +blockscout-display-bytes = "1.0.0" +reqwest = { version = "0.11.18", features = ["json"] } +reqwest-middleware = "0.2.2" +reqwest-retry = "0.2.2" +serde = { version = "1.0.164", features = ["derive"] } +serde_json = "1.0.96" +thiserror = "1.0.40" +tracing = { version = "0.1.37", optional = true } +url = "2.4.0" + +[dev-dependencies] +pretty_assertions = "1.3.0" +tokio = { version = "1.28.2", features = ["macros"] } + +[features] +default = ["tracing"] \ No newline at end of file diff --git a/libs/sourcify/src/client.rs b/libs/sourcify/src/client.rs new file mode 100644 index 000000000..31561530d --- /dev/null +++ b/libs/sourcify/src/client.rs @@ -0,0 +1,227 @@ +use crate::{ + types::{ErrorResponse, GetSourceFilesResponse}, + Error, SourcifyError, +}; +use blockscout_display_bytes::Bytes as DisplayBytes; +use bytes::Bytes; +use reqwest::{Response, StatusCode}; +use reqwest_middleware::ClientWithMiddleware; +use reqwest_retry::{policies::ExponentialBackoff, RetryTransientMiddleware}; +use serde::Deserialize; +use std::{str::FromStr, time::Duration}; +use url::Url; + +#[derive(Clone)] +pub struct ClientBuilder { + base_url: String, + total_duration: Duration, +} + +impl Default for ClientBuilder { + fn default() -> Self { + Self { + base_url: "https://sourcify.dev/server/".to_string(), + total_duration: Duration::from_secs(60), + } + } +} + +impl ClientBuilder { + pub fn base_url(mut self, base_url: &str) -> Self { + self.base_url = base_url.to_string(); + self + } + + pub fn total_duration(mut self, total_duration: Duration) -> Self { + self.total_duration = total_duration; + self + } + + pub fn build(self) -> Result { + let base_url = Url::from_str(&self.base_url).map_err(|err| Error::InvalidArgument { + arg: "base_url".to_string(), + error: err.to_string(), + })?; + + let retry_policy = + ExponentialBackoff::builder().build_with_total_retry_duration(self.total_duration); + let client = reqwest_middleware::ClientBuilder::new(reqwest::Client::new()) + .with(RetryTransientMiddleware::new_with_policy(retry_policy)) + .build(); + + Ok(Client { + base_url, + reqwest_client: client, + }) + } +} + +#[derive(Clone)] +pub struct Client { + base_url: Url, + reqwest_client: ClientWithMiddleware, +} + +impl Default for Client { + /// Initializes [`Client`] with base url set to "https://sourcify.dev/server/", + /// and total duration to 60 seconds. + fn default() -> Self { + ClientBuilder::default().build().unwrap() + } +} + +impl Client { + pub async fn get_source_files_any( + &self, + chain_id: &str, + contract_address: Bytes, + ) -> Result { + let contract_address = DisplayBytes::from(contract_address); + let url = self + .base_url + .join(format!("files/any/{}/{}", chain_id, contract_address).as_str()) + .unwrap(); + + let response = self + .reqwest_client + .get(url) + .send() + .await + .map_err(|error| match error { + reqwest_middleware::Error::Middleware(err) => Error::ReqwestMiddleware(err), + reqwest_middleware::Error::Reqwest(err) => Error::Reqwest(err), + })?; + + Self::process_sourcify_response(response).await + } +} + +impl Client { + async fn process_sourcify_response Deserialize<'de>>( + response: Response, + ) -> Result { + let error_message = |response: Response| async { + response + .json::() + .await + .map(|value| value.error) + }; + + match response.status() { + StatusCode::OK => Ok(response.json::().await?), + StatusCode::NOT_FOUND => Err(Error::Sourcify(SourcifyError::NotFound( + error_message(response).await?, + ))), + StatusCode::BAD_REQUEST => Err(Error::Sourcify(SourcifyError::BadRequest( + error_message(response).await?, + ))), + StatusCode::INTERNAL_SERVER_ERROR => { + let message = error_message(response).await?; + + // For now the only way to recognize that the chain is not supported by Sourcify. + // Message example: "Chain 134135 is not a Sourcify chain!" + if message.contains("is not a Sourcify chain") { + Err(Error::Sourcify(SourcifyError::ChainNotSupported(message))) + } else { + Err(Error::Sourcify(SourcifyError::InternalServerError(message))) + } + } + StatusCode::TOO_MANY_REQUESTS => Err(Error::Sourcify(SourcifyError::TooManyRequests( + error_message(response).await?, + ))), + _ => Err(Error::Sourcify(SourcifyError::UnexpectedStatusCode { + status_code: response.status(), + msg: response.text().await?, + })), + } + } +} + +#[cfg(test)] +mod tests { + use super::*; + use pretty_assertions::assert_eq; + use serde_json::json; + + fn parse_contract_address(contract_address: &str) -> Bytes { + DisplayBytes::from_str(contract_address).unwrap().0 + } + + #[tokio::test] + async fn get_source_files_any_success() { + let expected: GetSourceFilesResponse = serde_json::from_value(json!({ + "status": "full", + "files": [ + { + "name": "library-map.json", + "path": "/home/data/repository/contracts/full_match/5/0x027f1fe8BbC2a7E9fE97868E82c6Ec6939086c52/library-map.json", + "content": "{\"__$54103d3e1543ebb87230c9454f838057a5$__\":\"6b88c55cfbd4eda1320f802b724193cab062ccce\"}" + }, + { + "name": "metadata.json", + "path": "/home/data/repository/contracts/full_match/5/0x027f1fe8BbC2a7E9fE97868E82c6Ec6939086c52/metadata.json", + "content": "{\"compiler\":{\"version\":\"0.6.8+commit.0bbfe453\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[],\"name\":\"SourcifySolidity14\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"input\",\"type\":\"address\"}],\"name\":\"identity\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"methods\":{}},\"userdoc\":{\"methods\":{}}},\"settings\":{\"compilationTarget\":{\"contracts/project:/ExternalTestMultiple.sol\":\"ExternalTestMultiple\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":300},\"remappings\":[]},\"sources\":{\"contracts/project:/ExternalTestMultiple.sol\":{\"keccak256\":\"0xc40380283b7d4a97da5e247fbb7b795f6241cfe3d86e34493d87528dfcb4d56b\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://86ec578963cb912c4b912f066390e564c54ea1bc5fb1a55aa4e4c77bb92b07ba\",\"dweb:/ipfs/QmeqihJa8kUjbNHNCpFRHkq1scCbjjFvaUN2gWEJCNEx1Q\"]},\"contracts/project_/ExternalTestMultiple.sol\":{\"keccak256\":\"0xff9e0ddd21b0579491371fe8d4f7e09254ffc7af9382ba287ef8d2a2fd1ce8e2\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://1f516a34091c829a18a8c5dd13fbd82f44b532e7dea6fed9f60ae731c9042d74\",\"dweb:/ipfs/QmZqm6CLGUKQ3RJCLAZy5CWo2ScLzV2r5JXWNWfBwbGCsK\"]}},\"version\":1}" + }, + { + "name": "ExternalTestMultiple.sol", + "path": "/home/data/repository/contracts/full_match/5/0x027f1fe8BbC2a7E9fE97868E82c6Ec6939086c52/sources/contracts/project_/ExternalTestMultiple.sol", + "content": "//SPDX-License-Identifier: MIT\r\npragma solidity ^0.6.8;\r\n\r\nlibrary ExternalTestLibraryMultiple {\r\n function pop(address[] storage list) external returns (address out) {\r\n out = list[list.length - 1];\r\n list.pop();\r\n }\r\n}\r\n" + } + ] + })).unwrap(); + + let chain_id = "5"; + let contract_address = parse_contract_address("0x027f1fe8BbC2a7E9fE97868E82c6Ec6939086c52"); + + let result = Client::default() + .get_source_files_any(chain_id, contract_address) + .await + .expect("success expected"); + assert_eq!(expected, result); + } + + #[tokio::test] + async fn get_source_files_any_not_found() { + let chain_id = "5"; + let contract_address = parse_contract_address("0x8A81C1619f38a5bb29cfaf20dB24B23F42A42dCb"); + + let result = Client::default() + .get_source_files_any(chain_id, contract_address) + .await + .expect_err("error expected"); + assert!( + matches!(result, Error::Sourcify(SourcifyError::NotFound(_))), + "expected: 'SourcifyError::NotFound', got: {result:?}" + ); + } + + #[tokio::test] + async fn get_source_files_any_invalid_argument() { + let chain_id = "5"; + let contract_address = parse_contract_address("0xcafecafecafecafe"); + + let result = Client::default() + .get_source_files_any(chain_id, contract_address) + .await + .expect_err("error expected"); + assert!( + matches!(result, Error::Sourcify(SourcifyError::BadRequest(_))), + "expected: 'SourcifyError::BadRequest', got: {result:?}" + ); + } + + #[tokio::test] + async fn get_source_files_any_unsupported_chain() { + let chain_id = "12345"; + let contract_address = parse_contract_address("0x027f1fe8BbC2a7E9fE97868E82c6Ec6939086c52"); + + let result = Client::default() + .get_source_files_any(chain_id, contract_address) + .await + .expect_err("error expected"); + assert!( + matches!(result, Error::Sourcify(SourcifyError::ChainNotSupported(_))), + "expected: 'SourcifyError::BadRequest', got: {result:?}" + ); + } +} diff --git a/libs/sourcify/src/lib.rs b/libs/sourcify/src/lib.rs new file mode 100644 index 000000000..44a73d688 --- /dev/null +++ b/libs/sourcify/src/lib.rs @@ -0,0 +1,36 @@ +mod client; +mod types; + +pub use client::{Client, ClientBuilder}; +pub use types::{GetSourceFilesResponse, MatchType}; + +#[derive(Clone, Debug, PartialEq, Eq, thiserror::Error)] +pub enum SourcifyError { + #[error("'Too Many Requests': {0}")] + TooManyRequests(String), + #[error("'Internal Server Error': {0}")] + InternalServerError(String), + #[error("Chain is not supported: {0}")] + ChainNotSupported(String), + #[error("'Not Found': {0}")] + NotFound(String), + #[error("'Bad Request': {0}")] + BadRequest(String), + #[error("unexpected status code: {status_code} - {msg}")] + UnexpectedStatusCode { + status_code: reqwest::StatusCode, + msg: String, + }, +} + +#[derive(Debug, thiserror::Error)] +pub enum Error { + #[error("invalid argument: {arg} - {error}")] + InvalidArgument { arg: String, error: String }, + #[error("error occurred while sending request: {0}")] + Reqwest(#[from] reqwest::Error), + #[error("error with the middleware occurred while sending request: {0:#}")] + ReqwestMiddleware(anyhow::Error), + #[error("error got from the Sourcify: {0}")] + Sourcify(#[from] SourcifyError), +} diff --git a/libs/sourcify/src/types.rs b/libs/sourcify/src/types.rs new file mode 100644 index 000000000..8ea725db2 --- /dev/null +++ b/libs/sourcify/src/types.rs @@ -0,0 +1,429 @@ +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] +#[serde(rename_all = "camelCase")] +pub enum MatchType { + Full, + Partial, +} + +#[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] +pub struct ErrorResponse { + pub error: String, +} + +pub use get_source_files_response::GetSourceFilesResponse; +mod get_source_files_response { + use super::*; + use blockscout_display_bytes::Bytes as DisplayBytes; + use bytes::Bytes; + use serde::{de, Deserializer}; + use std::{collections::BTreeMap, path::PathBuf, str::FromStr}; + + type Files = Vec; + + #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] + struct File { + pub name: String, + pub path: PathBuf, + pub content: String, + } + + #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] + struct GetSourceFilesResponseRaw { + pub status: MatchType, + pub files: Files, + } + + #[derive(Clone, Debug, PartialEq, Eq)] + pub struct GetSourceFilesResponse { + pub status: MatchType, + pub sources: BTreeMap, + pub metadata: serde_json::Value, + /// If empty, no "library-map.json" file has been retrieved. + pub library_map: BTreeMap, + /// Notice that `None` is not the same as an empty byte sequence. + /// `None` means that no constructor arguments have been retrieved by the Sourcify + /// (though they may still exist). Empty byte sequence means that the contract has no + /// constructor arguments at all. + pub constructor_arguments: Option, + pub immutable_references: Option, + + pub raw_json: serde_json::Value, + } + + impl<'de> Deserialize<'de> for GetSourceFilesResponse { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + // Deserialize GetSourceFilesResponseRaw from the deserializer + let raw = GetSourceFilesResponseRaw::deserialize(deserializer)?; + + // Convert GetSourceFilesResponseRaw to GetSourceFilesResponse + GetSourceFilesResponse::try_from(raw).map_err(de::Error::custom) + } + } + + impl TryFrom for GetSourceFilesResponse { + type Error = String; + + fn try_from(value: GetSourceFilesResponseRaw) -> Result { + let raw = + serde_json::to_value(value.clone()).expect("deserialized successfully before"); + + let mut sources = BTreeMap::new(); + let mut metadata = None; + let mut library_map = None; + let mut constructor_arguments = None; + let mut immutable_references = None; + + let status = value.status; + for file in value.files { + // "/home/data/repository/contracts/{full_match/partial_match}/{chain_name}/{contract_address}/{sources?}" + // root ('/') - is a separate segment itself + let mut iterator = file.path.as_path().iter().skip(8); + + match iterator.next() { + Some(segment) if segment == std::ffi::OsStr::new("sources") => { + let source_path = iterator.collect::(); + sources.insert(source_path.to_string_lossy().to_string(), file.content); + } + Some(segment) if segment == std::ffi::OsStr::new("metadata.json") => { + metadata = Some(GetSourceFilesResponse::process_metadata(file)?); + } + Some(segment) if segment == std::ffi::OsStr::new("library-map.json") => { + library_map = Some(GetSourceFilesResponse::process_library_map(file)?); + } + Some(segment) if segment == std::ffi::OsStr::new("constructor-args.txt") => { + constructor_arguments = + Some(GetSourceFilesResponse::process_constructor_arguments(file)?); + } + Some(segment) + if segment == std::ffi::OsStr::new("immutable-references.json") => + { + immutable_references = + Some(GetSourceFilesResponse::process_immutable_references(file)?); + } + #[cfg(feature = "tracing")] + Some(segment) => { + tracing::warn!(target: "sourcify", "unknown next segment name; file: {:?}, segment: {segment:?}", file.path); + } + #[cfg(feature = "tracing")] + None => { + tracing::warn!(target: "sourcify", "no next segment available; file: {:?}", file.path); + } + #[cfg(not(feature = "tracing"))] + _ => {} + } + } + + if metadata.is_none() { + return Err("metadata file is missing".to_string()); + } + + if sources.is_empty() { + return Err("sources are missing".to_string()); + } + + Ok(Self { + status, + sources, + metadata: metadata.unwrap(), + library_map: library_map.unwrap_or_default(), + constructor_arguments, + immutable_references, + raw_json: raw, + }) + } + } + + impl GetSourceFilesResponse { + fn process_metadata(file: File) -> Result { + if file.name != "metadata.json" { + return Err(format!( + "{:?}: invalid name for the metadata file: {}", + file.path, file.name + )); + } + serde_json::Value::from_str(&file.content) + .map_err(|err| format!("metadata file is not a valid json: '{err}'")) + } + + fn process_library_map(file: File) -> Result, String> { + if file.name != "library-map.json" { + return Err(format!( + "{:?}: invalid name for the library map file: {}", + file.path, file.name + )); + } + + let parsed_content = serde_json::Value::from_str(file.content.as_str()) + .map_err(|err| format!("library map is not a valid json: '{err}'"))?; + + let mut library_map = BTreeMap::new(); + for (placeholder, value) in parsed_content + .as_object() + .ok_or_else(|| "library map is not a json object".to_string())? + { + let value = value.as_str().ok_or_else(|| { + format!( + "library map has a placeholder value that is not a string; placeholder: \ + {placeholder}, value: {value}" + ) + })?; + let address = DisplayBytes::from_str(value).map_err(|err| { + format!( + "library map has a placeholder value that is not valid bytes; \ + placeholder: {placeholder}, value: {value}, err: '{err}'" + ) + })?; + library_map.insert(placeholder.clone(), address.0); + } + + Ok(library_map) + } + + fn process_constructor_arguments(file: File) -> Result { + if file.name != "constructor-args.txt" { + return Err(format!( + "{:?}: invalid name for the constructor args file: {}", + file.path, file.name + )); + } + + let display_bytes = DisplayBytes::from_str(file.content.as_str()) + .map_err(|err| format!( + "constructor arguments are not valid bytes; constructor_arguments: {}, err: '{err}'", + file.content + ))?; + Ok(display_bytes.0) + } + + fn process_immutable_references(file: File) -> Result { + if file.name != "immutable-references.json" { + return Err(format!( + "{:?}: invalid name for the immutable references file: {}", + file.path, file.name + )); + } + + serde_json::Value::from_str(&file.content) + .map_err(|err| format!("immutable references file is not a valid json: '{err}'")) + } + } +} + +#[cfg(test)] +mod tests { + use super::{get_source_files_response::*, *}; + use blockscout_display_bytes::Bytes as DisplayBytes; + use bytes::Bytes; + use pretty_assertions::assert_eq; + use serde_json::json; + use std::{collections::BTreeMap, fmt::Debug, str::FromStr}; + + fn check Deserialize<'de>>( + value: serde_json::Value, + expected: T, + msg_prefix: Option<&str>, + ) { + let msg_prefix = msg_prefix.map(|msg| format!("{msg} ")).unwrap_or_default(); + let result: T = serde_json::from_value(value) + .unwrap_or_else(|err| panic!("{msg_prefix}deserialization failed: {err}")); + assert_eq!(expected, result, "{msg_prefix}check failed"); + } + + #[test] + fn parse_error_response() { + let value = json!({ + "error": "Invalid address: 0x027f1fe8BbC2a7E9fE97868E82c6Ec6939086c51", + "message": "Invalid address: 0x027f1fe8BbC2a7E9fE97868E82c6Ec6939086c51" + }); + let expected = ErrorResponse { + error: "Invalid address: 0x027f1fe8BbC2a7E9fE97868E82c6Ec6939086c51".to_string(), + }; + check(value, expected, None); + } + + #[test] + fn parse_get_source_files_response() { + /********** Full match response deserialization **********/ + + let value = json!({ + "status": "full", + "files": [ + { + "name": "library-map.json", + "path": "/home/data/repository/contracts/full_match/5/0x027f1fe8BbC2a7E9fE97868E82c6Ec6939086c52/library-map.json", + "content": "{\"__$54103d3e1543ebb87230c9454f838057a5$__\":\"6b88c55cfbd4eda1320f802b724193cab062ccce\"}" + }, + { + "name": "metadata.json", + "path": "/home/data/repository/contracts/full_match/5/0x027f1fe8BbC2a7E9fE97868E82c6Ec6939086c52/metadata.json", + "content": "{\"compiler\":{\"version\":\"0.6.8+commit.0bbfe453\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[],\"name\":\"SourcifySolidity14\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"input\",\"type\":\"address\"}],\"name\":\"identity\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"methods\":{}},\"userdoc\":{\"methods\":{}}},\"settings\":{\"compilationTarget\":{\"contracts/project:/ExternalTestMultiple.sol\":\"ExternalTestMultiple\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":300},\"remappings\":[]},\"sources\":{\"contracts/project:/ExternalTestMultiple.sol\":{\"keccak256\":\"0xc40380283b7d4a97da5e247fbb7b795f6241cfe3d86e34493d87528dfcb4d56b\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://86ec578963cb912c4b912f066390e564c54ea1bc5fb1a55aa4e4c77bb92b07ba\",\"dweb:/ipfs/QmeqihJa8kUjbNHNCpFRHkq1scCbjjFvaUN2gWEJCNEx1Q\"]},\"contracts/project_/ExternalTestMultiple.sol\":{\"keccak256\":\"0xff9e0ddd21b0579491371fe8d4f7e09254ffc7af9382ba287ef8d2a2fd1ce8e2\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://1f516a34091c829a18a8c5dd13fbd82f44b532e7dea6fed9f60ae731c9042d74\",\"dweb:/ipfs/QmZqm6CLGUKQ3RJCLAZy5CWo2ScLzV2r5JXWNWfBwbGCsK\"]}},\"version\":1}" + }, + { + "name": "ExternalTestMultiple.sol", + "path": "/home/data/repository/contracts/full_match/5/0x027f1fe8BbC2a7E9fE97868E82c6Ec6939086c52/sources/contracts/project_/ExternalTestMultiple.sol", + "content": "//SPDX-License-Identifier: MIT\r\npragma solidity ^0.6.8;\r\n\r\nlibrary ExternalTestLibraryMultiple {\r\n function pop(address[] storage list) external returns (address out) {\r\n out = list[list.length - 1];\r\n list.pop();\r\n }\r\n}\r\n" + } + ] + }); + let expected = GetSourceFilesResponse { + status: MatchType::Full, + sources: BTreeMap::from([ + ("contracts/project_/ExternalTestMultiple.sol".into(), "//SPDX-License-Identifier: MIT\r\npragma solidity ^0.6.8;\r\n\r\nlibrary ExternalTestLibraryMultiple {\r\n function pop(address[] storage list) external returns (address out) {\r\n out = list[list.length - 1];\r\n list.pop();\r\n }\r\n}\r\n".into()) + ]), + metadata: serde_json::Value::from_str("{\"compiler\":{\"version\":\"0.6.8+commit.0bbfe453\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[],\"name\":\"SourcifySolidity14\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"input\",\"type\":\"address\"}],\"name\":\"identity\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"methods\":{}},\"userdoc\":{\"methods\":{}}},\"settings\":{\"compilationTarget\":{\"contracts/project:/ExternalTestMultiple.sol\":\"ExternalTestMultiple\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":300},\"remappings\":[]},\"sources\":{\"contracts/project:/ExternalTestMultiple.sol\":{\"keccak256\":\"0xc40380283b7d4a97da5e247fbb7b795f6241cfe3d86e34493d87528dfcb4d56b\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://86ec578963cb912c4b912f066390e564c54ea1bc5fb1a55aa4e4c77bb92b07ba\",\"dweb:/ipfs/QmeqihJa8kUjbNHNCpFRHkq1scCbjjFvaUN2gWEJCNEx1Q\"]},\"contracts/project_/ExternalTestMultiple.sol\":{\"keccak256\":\"0xff9e0ddd21b0579491371fe8d4f7e09254ffc7af9382ba287ef8d2a2fd1ce8e2\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://1f516a34091c829a18a8c5dd13fbd82f44b532e7dea6fed9f60ae731c9042d74\",\"dweb:/ipfs/QmZqm6CLGUKQ3RJCLAZy5CWo2ScLzV2r5JXWNWfBwbGCsK\"]}},\"version\":1}").unwrap(), + library_map: BTreeMap::from([ + ("__$54103d3e1543ebb87230c9454f838057a5$__".into(), DisplayBytes::from_str("6b88c55cfbd4eda1320f802b724193cab062ccce").unwrap().0) + ]), + constructor_arguments: None, + immutable_references: None, + raw_json: value.clone(), + }; + + check(value, expected, Some("full match")); + + /********** Partial match response deserialization **********/ + + let value = json!({ + "status": "partial", + "files": [ + { + "name": "metadata.json", + "path": "/home/data/repository/contracts/partial_match/420/0x341577fB771EBFB4FaF74fBcF786d4F7Ce02BBaB/metadata.json", + "content": "{\"compiler\":{\"version\":\"0.5.17+commit.d19bba13\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"constant\":true,\"inputs\":[],\"name\":\"a\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"a_plus_one\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[],\"name\":\"dead\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"helloworld\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"methods\":{}},\"userdoc\":{\"methods\":{}}},\"settings\":{\"compilationTarget\":{\"Reinit_Poc.sol\":\"Reinit_Poc\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"Reinit_Poc.sol\":{\"keccak256\":\"0x37b3c1d0756395feecb440eb088e3de92e7300db1770e5e00f29ffc22c83ad28\",\"urls\":[\"bzz-raw://f1877139b66f70c9cebcee66f25879cd611e00b6ec658ea5009463e97768c0d3\",\"dweb:/ipfs/QmcVf6NsWfFGN9UTbmWGkuQJxo7EoGXLq6LxRnu4B78fDj\"]}},\"version\":1}" + }, + { + "name": "Reinit_Poc.sol", + "path": "/home/data/repository/contracts/partial_match/420/0x341577fB771EBFB4FaF74fBcF786d4F7Ce02BBaB/sources/Reinit_Poc.sol", + "content": "contract Reinit_Poc {\r\n uint public constant a = 999;\r\n function a_plus_one() public view returns(uint){\r\n return a+1;\r\n }\r\n function helloworld() public view returns(string memory){\r\n return \"hello world\";\r\n }\r\n function dead() public{\r\n selfdestruct(msg.sender);\r\n }\r\n}" + } + ] + }); + let expected = GetSourceFilesResponse { + status: MatchType::Partial, + sources: BTreeMap::from([ + ("Reinit_Poc.sol".into(), "contract Reinit_Poc {\r\n uint public constant a = 999;\r\n function a_plus_one() public view returns(uint){\r\n return a+1;\r\n }\r\n function helloworld() public view returns(string memory){\r\n return \"hello world\";\r\n }\r\n function dead() public{\r\n selfdestruct(msg.sender);\r\n }\r\n}".into()), + ]), + metadata: serde_json::Value::from_str("{\"compiler\":{\"version\":\"0.5.17+commit.d19bba13\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"constant\":true,\"inputs\":[],\"name\":\"a\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"a_plus_one\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[],\"name\":\"dead\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"helloworld\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"methods\":{}},\"userdoc\":{\"methods\":{}}},\"settings\":{\"compilationTarget\":{\"Reinit_Poc.sol\":\"Reinit_Poc\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"Reinit_Poc.sol\":{\"keccak256\":\"0x37b3c1d0756395feecb440eb088e3de92e7300db1770e5e00f29ffc22c83ad28\",\"urls\":[\"bzz-raw://f1877139b66f70c9cebcee66f25879cd611e00b6ec658ea5009463e97768c0d3\",\"dweb:/ipfs/QmcVf6NsWfFGN9UTbmWGkuQJxo7EoGXLq6LxRnu4B78fDj\"]}},\"version\":1}").unwrap(), + library_map: Default::default(), + constructor_arguments: None, + immutable_references: None, + raw_json: value.clone(), + }; + + check(value, expected, Some("partial match")); + + /********** Response with constructor arguments **********/ + + let value = json!({ + "status": "full", + "files": [ + { + "name": "constructor-args.txt", + "path": "/home/data/repository/contracts/full_match/4/0x705bF4e3CCbF37B0cE5dE86B3F606e640A2a40BD/constructor-args.txt", + "content": "0x" + }, + { + "name": "library-map.json", + "path": "/home/data/repository/contracts/full_match/4/0x705bF4e3CCbF37B0cE5dE86B3F606e640A2a40BD/library-map.json", + "content": "{\n \"__$c486e37aeebf327f7a754ca76e58aaef3b$__\": \"a8602b5e79650417ee75f78aa60836be0f234868\"\n}" + }, + { + "name": "metadata.json", + "path": "/home/data/repository/contracts/full_match/4/0x705bF4e3CCbF37B0cE5dE86B3F606e640A2a40BD/metadata.json", + "content": "{\"compiler\":{\"version\":\"0.8.4+commit.c7e474f2\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"ethAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"tokenAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"DividendClaimed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"isExcluded\",\"type\":\"bool\"}],\"name\":\"ExcludeFromFees\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"accounts\",\"type\":\"address[]\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"isExcluded\",\"type\":\"bool\"}],\"name\":\"ExcludeMultipleAccountsFromFees\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"newValue\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"oldValue\",\"type\":\"uint256\"}],\"name\":\"GasForProcessingUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"iterations\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"claims\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"lastProcessedIndex\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"bool\",\"name\":\"automatic\",\"type\":\"bool\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"gas\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"processor\",\"type\":\"address\"}],\"name\":\"ProcessedDividendTracker\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"SendDividends\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"pair\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"bool\",\"name\":\"value\",\"type\":\"bool\"}],\"name\":\"SetAutomatedMarketMakerPair\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newAddress\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"oldAddress\",\"type\":\"address\"}],\"name\":\"UpdateDividendTracker\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newAddress\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"oldAddress\",\"type\":\"address\"}],\"name\":\"UpdateUniswapV2Router\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"_amnestyBot\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"_blacklistBot\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"aidiBuybackEnabled\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"}],\"name\":\"allowance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"automatedMarketMakerPairs\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"buybackFee\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"claim\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"dailySell\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"deadAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"decimals\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"subtractedValue\",\"type\":\"uint256\"}],\"name\":\"decreaseAllowance\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"devMarketingAndCharityAddress\",\"outputs\":[{\"internalType\":\"address payable\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"devMarketingAndCharityEnabled\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"devMarketingAndCharityFee\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"dividendTokenBalanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"dividendTracker\",\"outputs\":[{\"internalType\":\"contract VerseDividendTracker\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ethRedistributeFee\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ethRedistributionEnabled\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"excluded\",\"type\":\"bool\"}],\"name\":\"excludeFromDailyLimit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"excluded\",\"type\":\"bool\"}],\"name\":\"excludeFromFees\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"accounts\",\"type\":\"address[]\"},{\"internalType\":\"bool\",\"name\":\"excluded\",\"type\":\"bool\"}],\"name\":\"excludeMultipleAccountsFromFees\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"gasForProcessing\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"getAccountDividendsInfo\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"int256\",\"name\":\"\",\"type\":\"int256\"},{\"internalType\":\"int256\",\"name\":\"\",\"type\":\"int256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"getAccountDividendsInfoAtIndex\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"int256\",\"name\":\"\",\"type\":\"int256\"},{\"internalType\":\"int256\",\"name\":\"\",\"type\":\"int256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getClaimWait\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getGasForTransfer\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getLastProcessedAccount\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"int256\",\"name\":\"\",\"type\":\"int256\"},{\"internalType\":\"int256\",\"name\":\"\",\"type\":\"int256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getLastProcessedIndex\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getNumberOfDividendTokenHolders\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getTotalDividendsDistributed\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"addedValue\",\"type\":\"uint256\"}],\"name\":\"increaseAllowance\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"isBot\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"isExcludedFromDailyLimit\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"isExcludedFromFees\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"lastTransfer\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"launchTime\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxDailySellAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxPurchaseEnabled\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"openTrading\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"gas\",\"type\":\"uint256\"}],\"name\":\"processDividendTracker\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address payable\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"reinvestInactive\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bool\",\"name\":\"enabled\",\"type\":\"bool\"}],\"name\":\"setAidiBuybackEnabled\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"pair\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"value\",\"type\":\"bool\"}],\"name\":\"setAutomatedMarketMakerPair\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bool\",\"name\":\"enabled\",\"type\":\"bool\"}],\"name\":\"setDevMarketingAndCharityFeeEnabled\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bool\",\"name\":\"enabled\",\"type\":\"bool\"}],\"name\":\"setETHRedistributionEnabled\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"newAmount\",\"type\":\"uint256\"}],\"name\":\"setMaxDailySellAmount\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"newAmount\",\"type\":\"uint256\"}],\"name\":\"setMaxPurchaseAmount\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bool\",\"name\":\"enabled\",\"type\":\"bool\"}],\"name\":\"setMaxPurchaseEnabled\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"swapTokensAtAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"symbol\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalFee\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"tradingOpen\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transfer\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"uniswapV2Pair\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"uniswapV2Router\",\"outputs\":[{\"internalType\":\"contract IUniswapV2Router02\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"claimWait\",\"type\":\"uint256\"}],\"name\":\"updateClaimWait\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address payable\",\"name\":\"newAddress\",\"type\":\"address\"}],\"name\":\"updateDevMarketingAndCharityAddress\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAddress\",\"type\":\"address\"}],\"name\":\"updateDividendTracker\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"newValue\",\"type\":\"uint256\"}],\"name\":\"updateGasForProcessing\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"gasForTransfer\",\"type\":\"uint256\"}],\"name\":\"updateGasForTransfer\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAddress\",\"type\":\"address\"}],\"name\":\"updateUniswapV2Router\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"withdrawableDividendOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"allowance(address,address)\":{\"details\":\"See {IERC20-allowance}.\"},\"approve(address,uint256)\":{\"details\":\"See {IERC20-approve}. Requirements: - `spender` cannot be the zero address.\"},\"balanceOf(address)\":{\"details\":\"See {IERC20-balanceOf}.\"},\"decimals()\":{\"details\":\"Returns the number of decimals used to get its user representation. For example, if `decimals` equals `2`, a balance of `505` tokens should be displayed to a user as `5,05` (`505 / 10 ** 2`). Tokens usually opt for a value of 18, imitating the relationship between Ether and Wei. This is the value {ERC20} uses, unless this function is overridden; NOTE: This information is only used for _display_ purposes: it in no way affects any of the arithmetic of the contract, including {IERC20-balanceOf} and {IERC20-transfer}.\"},\"decreaseAllowance(address,uint256)\":{\"details\":\"Atomically decreases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address. - `spender` must have allowance for the caller of at least `subtractedValue`.\"},\"increaseAllowance(address,uint256)\":{\"details\":\"Atomically increases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address.\"},\"name()\":{\"details\":\"Returns the name of the token.\"},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"symbol()\":{\"details\":\"Returns the symbol of the token, usually a shorter version of the name.\"},\"totalSupply()\":{\"details\":\"See {IERC20-totalSupply}.\"},\"transfer(address,uint256)\":{\"details\":\"See {IERC20-transfer}. Requirements: - `recipient` cannot be the zero address. - the caller must have a balance of at least `amount`.\"},\"transferFrom(address,address,uint256)\":{\"details\":\"See {IERC20-transferFrom}. Emits an {Approval} event indicating the updated allowance. This is not required by the EIP. See the note at the beginning of {ERC20}. Requirements: - `sender` and `recipient` cannot be the zero address. - `sender` must have a balance of at least `amount`. - the caller must have allowance for ``sender``'s tokens of at least `amount`.\"},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"verse.sol\":\"Verse\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"verse.sol\":{\"keccak256\":\"0xd195f71e6fd62c78589726ae45f2e200aebc8bfe4202056e2395b3bcb2f06d52\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://42c7dacbb5b519bed940b155f8cd712e9b75f6d5ea71f2aea395853a95924b1c\",\"dweb:/ipfs/QmZfDn4NVcMZBV7zGhwxJDCA9T3XDNSzsPYVYxn8egggZr\"]}},\"version\":1}" + }, + { + "name": "verse.sol", + "path": "/home/data/repository/contracts/full_match/4/0x705bF4e3CCbF37B0cE5dE86B3F606e640A2a40BD/sources/verse.sol", + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.4;\n\n/*\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\n return msg.data;\n }\n}\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address recipient, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `sender` to `recipient` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n}\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n\n\n/// @title Dividend-Paying Token Optional Interface\n/// @author Roger Wu (https://github.com/roger-wu)\n/// @dev OPTIONAL functions for a dividend-paying token contract.\ninterface DividendPayingTokenOptionalInterface {\n /// @notice View the amount of dividend in wei that an address can withdraw.\n /// @param _owner The address of a token holder.\n /// @return The amount of dividend in wei that `_owner` can withdraw.\n function withdrawableDividendOf(address _owner) external view returns(uint256);\n\n /// @notice View the amount of dividend in wei that an address has withdrawn.\n /// @param _owner The address of a token holder.\n /// @return The amount of dividend in wei that `_owner` has withdrawn.\n function withdrawnDividendOf(address _owner) external view returns(uint256);\n\n /// @notice View the amount of dividend in wei that an address has earned in total.\n /// @dev accumulativeDividendOf(_owner) = withdrawableDividendOf(_owner) + withdrawnDividendOf(_owner)\n /// @param _owner The address of a token holder.\n /// @return The amount of dividend in wei that `_owner` has earned in total.\n function accumulativeDividendOf(address _owner) external view returns(uint256);\n}\n\n/// @title Dividend-Paying Token Interface\n/// @author Roger Wu (https://github.com/roger-wu)\n/// @dev An interface for a dividend-paying token contract.\ninterface DividendPayingTokenInterface {\n /// @notice View the amount of dividend in wei that an address can withdraw.\n /// @param _owner The address of a token holder.\n /// @return The amount of dividend in wei that `_owner` can withdraw.\n function dividendOf(address _owner) external view returns(uint256);\n\n /// @notice Distributes ether to token holders as dividends.\n /// @dev SHOULD distribute the paid ether to token holders as dividends.\n /// SHOULD NOT directly transfer ether to token holders in this function.\n /// MUST emit a `DividendsDistributed` event when the amount of distributed ether is greater than 0.\n function distributeDividends() external payable;\n\n /// @notice Withdraws the ether distributed to the sender.\n /// @dev SHOULD transfer `dividendOf(msg.sender)` wei to `msg.sender`, and `dividendOf(msg.sender)` SHOULD be 0 after the transfer.\n /// MUST emit a `DividendWithdrawn` event if the amount of ether transferred is greater than 0.\n function withdrawDividend() external;\n\n /// @dev This event MUST emit when ether is distributed to token holders.\n /// @param from The address which sends ether to this contract.\n /// @param weiAmount The amount of distributed ether in wei.\n event DividendsDistributed(\n address indexed from,\n uint256 weiAmount\n );\n\n /// @dev This event MUST emit when an address withdraws their dividend.\n /// @param to The address which withdraws ether from this contract.\n /// @param weiAmount The amount of withdrawn ether in wei.\n event DividendWithdrawn(\n address indexed to,\n uint256 weiAmount\n );\n}\n\nlibrary SafeMath {\n /**\n * @dev Returns the addition of two unsigned integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `+` operator.\n *\n * Requirements:\n *\n * - Addition cannot overflow.\n */\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n require(c >= a, \"SafeMath: addition overflow\");\n\n return c;\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting on\n * overflow (when the result is negative).\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n *\n * - Subtraction cannot overflow.\n */\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return sub(a, b, \"SafeMath: subtraction overflow\");\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting with custom message on\n * overflow (when the result is negative).\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n *\n * - Subtraction cannot overflow.\n */\n function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n require(b <= a, errorMessage);\n uint256 c = a - b;\n\n return c;\n }\n\n /**\n * @dev Returns the multiplication of two unsigned integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `*` operator.\n *\n * Requirements:\n *\n * - Multiplication cannot overflow.\n */\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n // benefit is lost if 'b' is also tested.\n // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n require(c / a == b, \"SafeMath: multiplication overflow\");\n\n return c;\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers. Reverts on\n * division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator. Note: this function uses a\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\n * uses an invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return div(a, b, \"SafeMath: division by zero\");\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers. Reverts with custom message on\n * division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator. Note: this function uses a\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\n * uses an invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n require(b > 0, errorMessage);\n uint256 c = a / b;\n // assert(a == b * c + a % b); // There is no case in which this doesn't hold\n\n return c;\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * Reverts when dividing by zero.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n return mod(a, b, \"SafeMath: modulo by zero\");\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * Reverts with custom message when dividing by zero.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n require(b != 0, errorMessage);\n return a % b;\n }\n}\n\n/*\nMIT License\n\nCopyright (c) 2018 requestnetwork\nCopyright (c) 2018 Fragments, Inc.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n*/\n/**\n * @title SafeMathInt\n * @dev Math operations for int256 with overflow safety checks.\n */\nlibrary SafeMathInt {\n int256 private constant MIN_INT256 = int256(1) << 255;\n int256 private constant MAX_INT256 = ~(int256(1) << 255);\n\n /**\n * @dev Multiplies two int256 variables and fails on overflow.\n */\n function mul(int256 a, int256 b) internal pure returns (int256) {\n int256 c = a * b;\n\n // Detect overflow when multiplying MIN_INT256 with -1\n require(c != MIN_INT256 || (a & MIN_INT256) != (b & MIN_INT256));\n require((b == 0) || (c / b == a));\n return c;\n }\n\n /**\n * @dev Division of two int256 variables and fails on overflow.\n */\n function div(int256 a, int256 b) internal pure returns (int256) {\n // Prevent overflow when dividing MIN_INT256 by -1\n require(b != -1 || a != MIN_INT256);\n\n // Solidity already throws when dividing by 0.\n return a / b;\n }\n\n /**\n * @dev Subtracts two int256 variables and fails on overflow.\n */\n function sub(int256 a, int256 b) internal pure returns (int256) {\n int256 c = a - b;\n require((b >= 0 && c <= a) || (b < 0 && c > a));\n return c;\n }\n\n /**\n * @dev Adds two int256 variables and fails on overflow.\n */\n function add(int256 a, int256 b) internal pure returns (int256) {\n int256 c = a + b;\n require((b >= 0 && c >= a) || (b < 0 && c < a));\n return c;\n }\n\n /**\n * @dev Converts to absolute value, and fails on overflow.\n */\n function abs(int256 a) internal pure returns (int256) {\n require(a != MIN_INT256);\n return a < 0 ? -a : a;\n }\n\n\n function toUint256Safe(int256 a) internal pure returns (uint256) {\n require(a >= 0);\n return uint256(a);\n }\n}\n\n/**\n * @title SafeMathUint\n * @dev Math operations with safety checks that revert on error\n */\nlibrary SafeMathUint {\n function toInt256Safe(uint256 a) internal pure returns (int256) {\n int256 b = int256(a);\n require(b >= 0);\n return b;\n }\n}\n\ncontract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor () {\n address msgSender = _msgSender();\n _owner = msgSender;\n emit OwnershipTransferred(address(0), msgSender);\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n require(_owner == _msgSender(), \"Ownable: caller is not the owner\");\n _;\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n _owner = address(0);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n emit OwnershipTransferred(_owner, newOwner);\n _owner = newOwner;\n }\n}\n\nlibrary IterableMapping {\n // Iterable mapping from address to uint;\n struct Map {\n address[] keys;\n mapping(address => uint) values;\n mapping(address => uint) indexOf;\n mapping(address => bool) inserted;\n }\n\n function get(Map storage map, address key) public view returns (uint) {\n return map.values[key];\n }\n\n function getIndexOfKey(Map storage map, address key) public view returns (int) {\n if(!map.inserted[key]) {\n return -1;\n }\n return int(map.indexOf[key]);\n }\n\n function getKeyAtIndex(Map storage map, uint index) public view returns (address) {\n return map.keys[index];\n }\n\n\n\n function size(Map storage map) public view returns (uint) {\n return map.keys.length;\n }\n\n function set(Map storage map, address key, uint val) public {\n if (map.inserted[key]) {\n map.values[key] = val;\n } else {\n map.inserted[key] = true;\n map.values[key] = val;\n map.indexOf[key] = map.keys.length;\n map.keys.push(key);\n }\n }\n\n function remove(Map storage map, address key) public {\n if (!map.inserted[key]) {\n return;\n }\n\n delete map.inserted[key];\n delete map.values[key];\n\n uint index = map.indexOf[key];\n uint lastIndex = map.keys.length - 1;\n address lastKey = map.keys[lastIndex];\n\n map.indexOf[lastKey] = index;\n delete map.indexOf[key];\n\n map.keys[index] = lastKey;\n map.keys.pop();\n }\n}\n\ninterface IUniswapV2Pair {\n event Approval(address indexed owner, address indexed spender, uint value);\n event Transfer(address indexed from, address indexed to, uint value);\n\n function name() external pure returns (string memory);\n function symbol() external pure returns (string memory);\n function decimals() external pure returns (uint8);\n function totalSupply() external view returns (uint);\n function balanceOf(address owner) external view returns (uint);\n function allowance(address owner, address spender) external view returns (uint);\n\n function approve(address spender, uint value) external returns (bool);\n function transfer(address to, uint value) external returns (bool);\n function transferFrom(address from, address to, uint value) external returns (bool);\n\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n function PERMIT_TYPEHASH() external pure returns (bytes32);\n function nonces(address owner) external view returns (uint);\n\n function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;\n\n event Mint(address indexed sender, uint amount0, uint amount1);\n event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);\n event Swap(\n address indexed sender,\n uint amount0In,\n uint amount1In,\n uint amount0Out,\n uint amount1Out,\n address indexed to\n );\n event Sync(uint112 reserve0, uint112 reserve1);\n\n function MINIMUM_LIQUIDITY() external pure returns (uint);\n function factory() external view returns (address);\n function token0() external view returns (address);\n function token1() external view returns (address);\n function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);\n function price0CumulativeLast() external view returns (uint);\n function price1CumulativeLast() external view returns (uint);\n function kLast() external view returns (uint);\n\n function mint(address to) external returns (uint liquidity);\n function burn(address to) external returns (uint amount0, uint amount1);\n function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;\n function skim(address to) external;\n function sync() external;\n\n function initialize(address, address) external;\n}\n\ninterface IUniswapV2Factory {\n event PairCreated(address indexed token0, address indexed token1, address pair, uint);\n\n function feeTo() external view returns (address);\n function feeToSetter() external view returns (address);\n\n function getPair(address tokenA, address tokenB) external view returns (address pair);\n function allPairs(uint) external view returns (address pair);\n function allPairsLength() external view returns (uint);\n\n function createPair(address tokenA, address tokenB) external returns (address pair);\n\n function setFeeTo(address) external;\n function setFeeToSetter(address) external;\n}\n\ninterface IUniswapV2Router01 {\n function factory() external pure returns (address);\n function WETH() external pure returns (address);\n\n function addLiquidity(\n address tokenA,\n address tokenB,\n uint amountADesired,\n uint amountBDesired,\n uint amountAMin,\n uint amountBMin,\n address to,\n uint deadline\n ) external returns (uint amountA, uint amountB, uint liquidity);\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n ) external payable returns (uint amountToken, uint amountETH, uint liquidity);\n function removeLiquidity(\n address tokenA,\n address tokenB,\n uint liquidity,\n uint amountAMin,\n uint amountBMin,\n address to,\n uint deadline\n ) external returns (uint amountA, uint amountB);\n function removeLiquidityETH(\n address token,\n uint liquidity,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n ) external returns (uint amountToken, uint amountETH);\n function removeLiquidityWithPermit(\n address tokenA,\n address tokenB,\n uint liquidity,\n uint amountAMin,\n uint amountBMin,\n address to,\n uint deadline,\n bool approveMax, uint8 v, bytes32 r, bytes32 s\n ) external returns (uint amountA, uint amountB);\n function removeLiquidityETHWithPermit(\n address token,\n uint liquidity,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline,\n bool approveMax, uint8 v, bytes32 r, bytes32 s\n ) external returns (uint amountToken, uint amountETH);\n function swapExactTokensForTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external returns (uint[] memory amounts);\n function swapTokensForExactTokens(\n uint amountOut,\n uint amountInMax,\n address[] calldata path,\n address to,\n uint deadline\n ) external returns (uint[] memory amounts);\n function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline)\n external\n payable\n returns (uint[] memory amounts);\n function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline)\n external\n returns (uint[] memory amounts);\n function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline)\n external\n returns (uint[] memory amounts);\n function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline)\n external\n payable\n returns (uint[] memory amounts);\n\n function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB);\n function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut);\n function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn);\n function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);\n function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts);\n}\n\n\ninterface IUniswapV2Router02 is IUniswapV2Router01 {\n function removeLiquidityETHSupportingFeeOnTransferTokens(\n address token,\n uint liquidity,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n ) external returns (uint amountETH);\n function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(\n address token,\n uint liquidity,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline,\n bool approveMax, uint8 v, bytes32 r, bytes32 s\n ) external returns (uint amountETH);\n\n function swapExactTokensForTokensSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n function swapExactETHForTokensSupportingFeeOnTransferTokens(\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external payable;\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n}\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * We have followed general OpenZeppelin guidelines: functions revert instead\n * of returning `false` on failure. This behavior is nonetheless conventional\n * and does not conflict with the expectations of ERC20 applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * The default value of {decimals} is 18. To select a different value for\n * {decimals} you should overload it.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5,05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\n * overridden;\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `recipient` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address recipient, uint256 amount) public virtual override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n _approve(_msgSender(), spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * Requirements:\n *\n * - `sender` and `recipient` cannot be the zero address.\n * - `sender` must have a balance of at least `amount`.\n * - the caller must have allowance for ``sender``'s tokens of at least\n * `amount`.\n */\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public virtual override returns (bool) {\n _transfer(sender, recipient, amount);\n _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, \"ERC20: transfer amount exceeds allowance\"));\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, \"ERC20: decreased allowance below zero\"));\n return true;\n }\n\n /**\n * @dev Moves tokens `amount` from `sender` to `recipient`.\n *\n * This is internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `sender` cannot be the zero address.\n * - `recipient` cannot be the zero address.\n * - `sender` must have a balance of at least `amount`.\n */\n function _transfer(\n address sender,\n address recipient,\n uint256 amount\n ) internal virtual {\n require(sender != address(0), \"ERC20: transfer from the zero address\");\n require(recipient != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(sender, recipient, amount);\n\n _balances[sender] = _balances[sender].sub(amount, \"ERC20: transfer amount exceeds balance\");\n _balances[recipient] = _balances[recipient].add(amount);\n emit Transfer(sender, recipient, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply = _totalSupply.add(amount);\n _balances[account] = _balances[account].add(amount);\n emit Transfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n _balances[account] = _balances[account].sub(amount, \"ERC20: burn amount exceeds balance\");\n _totalSupply = _totalSupply.sub(amount);\n emit Transfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be to transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n}\n\n/// @title Dividend-Paying Token\n/// @author Roger Wu (https://github.com/roger-wu)\n/// @dev A mintable ERC20 token that allows anyone to pay and distribute ether\n/// to token holders as dividends and allows token holders to withdraw their dividends.\n/// Reference: the source code of PoWH3D: https://etherscan.io/address/0xB3775fB83F7D12A36E0475aBdD1FCA35c091efBe#code\ncontract DividendPayingToken is ERC20, DividendPayingTokenInterface, DividendPayingTokenOptionalInterface {\n using SafeMath for uint256;\n using SafeMathUint for uint256;\n using SafeMathInt for int256;\n\n // With `magnitude`, we can properly distribute dividends even if the amount of received ether is small.\n // For more discussion about choosing the value of `magnitude`,\n // see https://github.com/ethereum/EIPs/issues/1726#issuecomment-472352728\n uint256 constant internal magnitude = 2**128;\n\n uint256 internal magnifiedDividendPerShare;\n\n // About dividendCorrection:\n // If the token balance of a `_user` is never changed, the dividend of `_user` can be computed with:\n // `dividendOf(_user) = dividendPerShare * balanceOf(_user)`.\n // When `balanceOf(_user)` is changed (via minting/burning/transferring tokens),\n // `dividendOf(_user)` should not be changed,\n // but the computed value of `dividendPerShare * balanceOf(_user)` is changed.\n // To keep the `dividendOf(_user)` unchanged, we add a correction term:\n // `dividendOf(_user) = dividendPerShare * balanceOf(_user) + dividendCorrectionOf(_user)`,\n // where `dividendCorrectionOf(_user)` is updated whenever `balanceOf(_user)` is changed:\n // `dividendCorrectionOf(_user) = dividendPerShare * (old balanceOf(_user)) - (new balanceOf(_user))`.\n // So now `dividendOf(_user)` returns the same value before and after `balanceOf(_user)` is changed.\n mapping(address => int256) internal magnifiedDividendCorrections;\n mapping(address => uint256) internal withdrawnDividends;\n\n // Need to make gas fee customizable to future-proof against Ethereum network upgrades.\n uint256 public gasForTransfer;\n\n uint256 public totalDividendsDistributed;\n\n constructor(string memory _name, string memory _symbol) ERC20(_name, _symbol) {\n gasForTransfer = 3000;\n }\n\n /// @dev Distributes dividends whenever ether is paid to this contract.\n receive() external payable {\n distributeDividends();\n }\n\n /// @notice Distributes ether to token holders as dividends.\n /// @dev It reverts if the total supply of tokens is 0.\n /// It emits the `DividendsDistributed` event if the amount of received ether is greater than 0.\n /// About undistributed ether:\n /// In each distribution, there is a small amount of ether not distributed,\n /// the magnified amount of which is\n /// `(msg.value * magnitude) % totalSupply()`.\n /// With a well-chosen `magnitude`, the amount of undistributed ether\n /// (de-magnified) in a distribution can be less than 1 wei.\n /// We can actually keep track of the undistributed ether in a distribution\n /// and try to distribute it in the next distribution,\n /// but keeping track of such data on-chain costs much more than\n /// the saved ether, so we don't do that.\n function distributeDividends() public override payable {\n require(totalSupply() > 0);\n\n if (msg.value > 0) {\n magnifiedDividendPerShare = magnifiedDividendPerShare.add(\n (msg.value).mul(magnitude) / totalSupply()\n );\n emit DividendsDistributed(msg.sender, msg.value);\n\n totalDividendsDistributed = totalDividendsDistributed.add(msg.value);\n }\n }\n\n /// @notice Withdraws the ether distributed to the sender.\n /// @dev It emits a `DividendWithdrawn` event if the amount of withdrawn ether is greater than 0.\n function withdrawDividend() public virtual override {\n _withdrawDividendOfUser(payable(msg.sender));\n }\n\n /// @notice Withdraws the ether distributed to the sender.\n /// @dev It emits a `DividendWithdrawn` event if the amount of withdrawn ether is greater than 0.\n function _withdrawDividendOfUser(address payable user) internal returns (uint256) {\n uint256 _withdrawableDividend = withdrawableDividendOf(user);\n if (_withdrawableDividend > 0) {\n withdrawnDividends[user] = withdrawnDividends[user].add(_withdrawableDividend);\n emit DividendWithdrawn(user, _withdrawableDividend);\n (bool success,) = user.call{value: _withdrawableDividend, gas: gasForTransfer}(\"\");\n\n if(!success) {\n withdrawnDividends[user] = withdrawnDividends[user].sub(_withdrawableDividend);\n return 0;\n }\n\n return _withdrawableDividend;\n }\n\n return 0;\n }\n\n\n /// @notice View the amount of dividend in wei that an address can withdraw.\n /// @param _owner The address of a token holder.\n /// @return The amount of dividend in wei that `_owner` can withdraw.\n function dividendOf(address _owner) public view override returns(uint256) {\n return withdrawableDividendOf(_owner);\n }\n\n /// @notice View the amount of dividend in wei that an address can withdraw.\n /// @param _owner The address of a token holder.\n /// @return The amount of dividend in wei that `_owner` can withdraw.\n function withdrawableDividendOf(address _owner) public view override returns(uint256) {\n return accumulativeDividendOf(_owner).sub(withdrawnDividends[_owner]);\n }\n\n /// @notice View the amount of dividend in wei that an address has withdrawn.\n /// @param _owner The address of a token holder.\n /// @return The amount of dividend in wei that `_owner` has withdrawn.\n function withdrawnDividendOf(address _owner) public view override returns(uint256) {\n return withdrawnDividends[_owner];\n }\n\n\n /// @notice View the amount of dividend in wei that an address has earned in total.\n /// @dev accumulativeDividendOf(_owner) = withdrawableDividendOf(_owner) + withdrawnDividendOf(_owner)\n /// = (magnifiedDividendPerShare * balanceOf(_owner) + magnifiedDividendCorrections[_owner]) / magnitude\n /// @param _owner The address of a token holder.\n /// @return The amount of dividend in wei that `_owner` has earned in total.\n function accumulativeDividendOf(address _owner) public view override returns(uint256) {\n return magnifiedDividendPerShare.mul(balanceOf(_owner)).toInt256Safe()\n .add(magnifiedDividendCorrections[_owner]).toUint256Safe() / magnitude;\n }\n\n /// @dev Internal function that transfer tokens from one address to another.\n /// Update magnifiedDividendCorrections to keep dividends unchanged.\n /// @param from The address to transfer from.\n /// @param to The address to transfer to.\n /// @param value The amount to be transferred.\n function _transfer(address from, address to, uint256 value) internal virtual override {\n require(false);\n\n int256 _magCorrection = magnifiedDividendPerShare.mul(value).toInt256Safe();\n magnifiedDividendCorrections[from] = magnifiedDividendCorrections[from].add(_magCorrection);\n magnifiedDividendCorrections[to] = magnifiedDividendCorrections[to].sub(_magCorrection);\n }\n\n /// @dev Internal function that mints tokens to an account.\n /// Update magnifiedDividendCorrections to keep dividends unchanged.\n /// @param account The account that will receive the created tokens.\n /// @param value The amount that will be created.\n function _mint(address account, uint256 value) internal override {\n super._mint(account, value);\n\n magnifiedDividendCorrections[account] = magnifiedDividendCorrections[account]\n .sub( (magnifiedDividendPerShare.mul(value)).toInt256Safe() );\n }\n\n /// @dev Internal function that burns an amount of the token of a given account.\n /// Update magnifiedDividendCorrections to keep dividends unchanged.\n /// @param account The account whose tokens will be burnt.\n /// @param value The amount that will be burnt.\n function _burn(address account, uint256 value) internal override {\n super._burn(account, value);\n\n magnifiedDividendCorrections[account] = magnifiedDividendCorrections[account]\n .add( (magnifiedDividendPerShare.mul(value)).toInt256Safe() );\n }\n\n function _setBalance(address account, uint256 newBalance) internal {\n uint256 currentBalance = balanceOf(account);\n\n if(newBalance > currentBalance) {\n uint256 mintAmount = newBalance.sub(currentBalance);\n _mint(account, mintAmount);\n } else if(newBalance < currentBalance) {\n uint256 burnAmount = currentBalance.sub(newBalance);\n _burn(account, burnAmount);\n }\n }\n}\n\ncontract Verse is ERC20, Ownable {\n using SafeMath for uint256;\n\n IUniswapV2Router02 public uniswapV2Router;\n address public uniswapV2Pair;\n\n bool private swapping;\n bool private reinvesting;\n bool public maxPurchaseEnabled = true;\n \n VerseDividendTracker public dividendTracker;\n\n address public immutable deadAddress = 0x000000000000000000000000000000000000dEaD;\n address payable public devMarketingAndCharityAddress = payable(0x4cD913cD83D38F355fB375a2873fDf127E9B77dB);\n\n //maximum purchase amount for initial launch\n uint256 maxPurchaseAmount = 3250 * (10**18);\n uint256 public maxDailySellAmount = 3250 * (10**18);\n uint256 public swapTokensAtAmount = 1000 * (10**18);\n\n mapping(address => bool) private _isBot;\n address[] private _confirmedBots;\n\n bool public aidiBuybackEnabled = true;\n bool public ethRedistributionEnabled = true;\n bool public devMarketingAndCharityEnabled = true;\n\n uint256 public buybackFee = 3;\n uint256 public ethRedistributeFee = 4;\n uint256 public devMarketingAndCharityFee = 3;\n uint256 public totalFee = 10;\n // use by default 150,000 gas to process auto-claiming dividends\n uint256 public gasForProcessing = 150000;\n\n // once set to true can never be set false again\n bool public tradingOpen = false;\n uint256 public launchTime;\n\n uint256 minimumTokenBalanceForDividends = 500 * (10**18);\n\n\n // exlcude from fees and max transaction amount\n mapping (address => bool) private _isExcludedFromFees;\n\n // store addresses that a automatic market maker pairs. Any transfer *to* these addresses\n // could be subject to a maximum transfer amount\n mapping (address => bool) public automatedMarketMakerPairs;\n\n // store the amount sold for each account every day\n // to add extra tax\n mapping (uint256 => mapping(address => uint256)) public dailySell;\n\n // the last time an address transferred\n // used to detect if an account can be reinvest inactive funds to the vault\n mapping (address => uint256) public lastTransfer;\n\n mapping (address => bool) public isExcludedFromDailyLimit;\n\n event UpdateDividendTracker(address indexed newAddress, address indexed oldAddress);\n event UpdateUniswapV2Router(address indexed newAddress, address indexed oldAddress);\n event ExcludeFromFees(address indexed account, bool isExcluded);\n event ExcludeMultipleAccountsFromFees(address[] accounts, bool isExcluded);\n event SetAutomatedMarketMakerPair(address indexed pair, bool indexed value);\n event SendDividends(uint256 amount);\n event DividendClaimed(uint256 ethAmount, uint256 tokenAmount, address account);\n event ProcessedDividendTracker(uint256 iterations, uint256 claims, uint256 lastProcessedIndex, bool indexed automatic, uint256 gas, address indexed processor);\n event GasForProcessingUpdated(uint256 indexed newValue, uint256 indexed oldValue);\n\n constructor() ERC20(\"Verse\", \"VERSE\") {\n\n \tdividendTracker = new VerseDividendTracker();\n\n \tIUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);\n // Create a uniswap pair for this new token\n address _uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())\n .createPair(address(this), _uniswapV2Router.WETH());\n\n uniswapV2Router = _uniswapV2Router;\n uniswapV2Pair = _uniswapV2Pair;\n\n _setAutomatedMarketMakerPair(_uniswapV2Pair, true);\n\n // exclude from receiving dividends\n dividendTracker.excludeFromDividends(address(dividendTracker));\n dividendTracker.excludeFromDividends(address(this));\n dividendTracker.excludeFromDividends(owner());\n dividendTracker.excludeFromDividends(address(_uniswapV2Router));\n dividendTracker.excludeFromDividends(address(0x000000000000000000000000000000000000dEaD));\n\n // exclude from paying fees or having max transaction amount\n excludeFromFees(address(this), true);\n excludeFromFees(owner(), true);\n\n isExcludedFromDailyLimit[address(this)] = true;\n isExcludedFromDailyLimit[owner()] = true;\n\n _mint(owner(), 5000000 * (10**18));\n }\n\n receive() external payable {\n\n \t}\n\n function updateDividendTracker(address newAddress) public onlyOwner {\n require(newAddress != address(dividendTracker), \"Verse: The dividend tracker already has that address\");\n\n VerseDividendTracker newDividendTracker = VerseDividendTracker(payable(newAddress));\n\n require(newDividendTracker.owner() == address(this), \"Verse: The new dividend tracker must be owned by the Verse token contract\");\n\n emit UpdateDividendTracker(newAddress, address(dividendTracker));\n\n dividendTracker = newDividendTracker;\n\n dividendTracker.excludeFromDividends(address(newDividendTracker));\n dividendTracker.excludeFromDividends(address(this));\n dividendTracker.excludeFromDividends(owner());\n dividendTracker.excludeFromDividends(address(uniswapV2Router));\n dividendTracker.excludeFromDividends(address(0x000000000000000000000000000000000000dEaD));\n }\n\n function updateUniswapV2Router(address newAddress) public onlyOwner {\n require(newAddress != address(uniswapV2Router), \"Verse: The router already has that address\");\n emit UpdateUniswapV2Router(newAddress, address(uniswapV2Router));\n uniswapV2Router = IUniswapV2Router02(newAddress);\n dividendTracker.excludeFromDividends(address(uniswapV2Router));\n }\n\n function excludeFromFees(address account, bool excluded) public onlyOwner {\n require(_isExcludedFromFees[account] != excluded, \"Verse: Account is already the value of 'excluded'\");\n _isExcludedFromFees[account] = excluded;\n\n emit ExcludeFromFees(account, excluded);\n }\n\n function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {\n for(uint256 i = 0; i < accounts.length; i++) {\n _isExcludedFromFees[accounts[i]] = excluded;\n }\n\n emit ExcludeMultipleAccountsFromFees(accounts, excluded);\n }\n\n function setAutomatedMarketMakerPair(address pair, bool value) public onlyOwner {\n require(pair != uniswapV2Pair, \"Verse: The UniSwap pair cannot be removed from automatedMarketMakerPairs\");\n\n _setAutomatedMarketMakerPair(pair, value);\n }\n\n function _setAutomatedMarketMakerPair(address pair, bool value) private {\n require(automatedMarketMakerPairs[pair] != value, \"Verse: Automated market maker pair is already set to that value\");\n automatedMarketMakerPairs[pair] = value;\n\n if(value) {\n dividendTracker.excludeFromDividends(pair);\n }\n\n emit SetAutomatedMarketMakerPair(pair, value);\n }\n\n function excludeFromDailyLimit(address account, bool excluded) public onlyOwner {\n require(isExcludedFromDailyLimit[account] != excluded, \"Verse: Daily limit exclusion is already the value of 'excluded'\");\n isExcludedFromDailyLimit[account] = excluded;\n }\n\n function setMaxPurchaseEnabled(bool enabled) public onlyOwner {\n require(maxPurchaseEnabled != enabled, \"Verse: Max purchase enabled is already the value of 'enabled'\");\n maxPurchaseEnabled = enabled;\n }\n\n function setAidiBuybackEnabled(bool enabled) public onlyOwner {\n aidiBuybackEnabled = enabled;\n }\n\n function setETHRedistributionEnabled(bool enabled) public onlyOwner {\n ethRedistributionEnabled = enabled;\n }\n\n function setDevMarketingAndCharityFeeEnabled(bool enabled) public onlyOwner {\n devMarketingAndCharityEnabled = enabled;\n }\n\n function setMaxPurchaseAmount(uint256 newAmount) public onlyOwner {\n maxPurchaseAmount = newAmount;\n }\n\n function setMaxDailySellAmount(uint256 newAmount) public onlyOwner {\n require((newAmount > (3250 * (10**18))), \"Verse: maxDailySellAmount should be greater than 3250\");\n maxDailySellAmount = newAmount;\n }\n\n function updateDevMarketingAndCharityAddress(address payable newAddress) public onlyOwner {\n devMarketingAndCharityAddress = newAddress;\n }\n\n\n function updateGasForTransfer(uint256 gasForTransfer) external onlyOwner {\n dividendTracker.updateGasForTransfer(gasForTransfer);\n }\n\n function updateGasForProcessing(uint256 newValue) public onlyOwner {\n // Need to make gas fee customizable to future-proof against Ethereum network upgrades.\n require(newValue != gasForProcessing, \"Verse: Cannot update gasForProcessing to same value\");\n emit GasForProcessingUpdated(newValue, gasForProcessing);\n gasForProcessing = newValue;\n }\n\n function updateClaimWait(uint256 claimWait) external onlyOwner {\n dividendTracker.updateClaimWait(claimWait);\n }\n\n function getGasForTransfer() external view returns(uint256) {\n return dividendTracker.gasForTransfer();\n }\n\n\n function getClaimWait() external view returns(uint256) {\n return dividendTracker.claimWait();\n }\n\n function getTotalDividendsDistributed() external view returns (uint256) {\n return dividendTracker.totalDividendsDistributed();\n }\n\n function isExcludedFromFees(address account) public view returns(bool) {\n return _isExcludedFromFees[account];\n }\n\n function withdrawableDividendOf(address account) public view returns(uint256) {\n return dividendTracker.withdrawableDividendOf(account);\n }\n\n function dividendTokenBalanceOf(address account) public view returns (uint256) {\n return dividendTracker.balanceOf(account);\n }\n\n function getAccountDividendsInfo(address account)\n external view returns (\n address,\n int256,\n int256,\n uint256,\n uint256,\n uint256,\n uint256,\n uint256) {\n return dividendTracker.getAccount(account);\n }\n\n function getAccountDividendsInfoAtIndex(uint256 index)\n external view returns (\n address,\n int256,\n int256,\n uint256,\n uint256,\n uint256,\n uint256,\n uint256) {\n return dividendTracker.getAccountAtIndex(index);\n }\n\n function processDividendTracker(uint256 gas) external {\n (uint256 iterations, uint256 claims, uint256 lastProcessedIndex) = dividendTracker.process(gas);\n emit ProcessedDividendTracker(iterations, claims, lastProcessedIndex, false, gas, tx.origin);\n }\n\n function claim() external {\n dividendTracker.processAccount(payable(msg.sender), false);\n }\n\n function getLastProcessedIndex() external view returns(uint256) {\n return dividendTracker.getLastProcessedIndex();\n }\n\n function getLastProcessedAccount()\n external view returns (\n address,\n int256,\n int256,\n uint256,\n uint256,\n uint256,\n uint256,\n uint256) {\n return dividendTracker.getLastProcessedAccount();\n }\n\n function getNumberOfDividendTokenHolders() external view returns(uint256) {\n return dividendTracker.getNumberOfTokenHolders();\n }\n\n function reinvestInactive(address payable account) public onlyOwner {\n uint256 tokenBalance = dividendTracker.balanceOf(account);\n require(tokenBalance <= minimumTokenBalanceForDividends, \"Verse: Account balance must be less then minimum token balance for dividends\");\n\n uint256 _lastTransfer = lastTransfer[account];\n require(block.timestamp.sub(_lastTransfer) > 12 weeks, \"Verse: Account must have been inactive for at least 12 weeks\");\n\n dividendTracker.processAccount(account, false);\n uint256 dividends = address(this).balance;\n (bool success,) = address(dividendTracker).call{value: dividends}(\"\");\n\n if(success) {\n \t \t\temit SendDividends(dividends);\n try dividendTracker.setBalance(account, 0) {} catch {}\n }\n }\n\n\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal override {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n require(to != address(0), \"ERC20: transfer to the zero address\");\n require(amount > 0, \"Transfer amount must be greater than zero\");\n \n if(from != owner() && to != owner()) {\n if(maxPurchaseEnabled)\n {\n require(amount <= maxPurchaseAmount, \"Transfer amount exceeds the maxPurchaseAmount.\");\n }\n require(!_isBot[from], 'Bots not allowed here! Play fair.');//antibot\n require(!_isBot[to], 'Bots not allowed here! Play fair.');//antibot\n }\n\n // buy\n if (from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_isExcludedFromFees[to]) {\n require(tradingOpen, 'Trading not yet enabled.');\n\n //antibot\n if (block.timestamp == launchTime) {\n _isBot[to] = true;\n _confirmedBots.push(to);\n }\n }\n\n\t\tuint256 contractTokenBalance = balanceOf(address(this));\n\n bool canSwap = contractTokenBalance >= swapTokensAtAmount;\n\n if (!swapping && !reinvesting && from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFees[to]) { //a buy\n if(aidiBuybackEnabled)\n {\n buybackFee = 3;\n }else{\n buybackFee = 0;\n }\n if(ethRedistributionEnabled)\n {\n ethRedistributeFee = 4;\n }else{\n ethRedistributeFee = 0;\n }\n\n if(devMarketingAndCharityEnabled)\n {\n devMarketingAndCharityFee = 3;\n }else{\n devMarketingAndCharityFee = 0;\n }\n\n totalFee = buybackFee + ethRedistributeFee + devMarketingAndCharityFee;\n }else if (!swapping && !reinvesting && to == uniswapV2Pair && from != address(uniswapV2Router) && !_isExcludedFromFees[to]) { //a sell\n\n if(dailySell[getDay()][from].add(amount) > maxDailySellAmount)\n {\n\n if(aidiBuybackEnabled)\n {\n buybackFee = 6;\n }else{\n buybackFee = 0;\n }\n if(ethRedistributionEnabled)\n {\n ethRedistributeFee = 8;\n }else{\n ethRedistributeFee = 0;\n }\n\n if(devMarketingAndCharityEnabled)\n {\n devMarketingAndCharityFee = 6;\n }else{\n devMarketingAndCharityFee = 0;\n }\n\n totalFee = buybackFee + ethRedistributeFee + devMarketingAndCharityFee;\n }else{\n if(aidiBuybackEnabled)\n {\n buybackFee = 3;\n }else{\n buybackFee = 0;\n }\n if(ethRedistributionEnabled)\n {\n ethRedistributeFee = 4;\n }else{\n ethRedistributeFee = 0;\n }\n if(devMarketingAndCharityEnabled)\n {\n devMarketingAndCharityFee = 3;\n }else{\n devMarketingAndCharityFee = 0;\n }\n\n totalFee = buybackFee + ethRedistributeFee + devMarketingAndCharityFee;\n }\n dailySell[getDay()][from] = dailySell[getDay()][from].add(amount);\n }\n\n\n if( canSwap &&\n !swapping &&\n !reinvesting &&\n !automatedMarketMakerPairs[from] &&\n !_isExcludedFromFees[from] &&\n !_isExcludedFromFees[to] &&\n (totalFee > 0))\n {\n swapping = true;\n swapAndDistribute();\n swapping = false;\n }\n\n\n bool takeFee = !swapping && !reinvesting;\n\n // if any account belongs to _isExcludedFromFee account then remove the fee\n // don't take a fee unless it's a buy / sell\n if((_isExcludedFromFees[from] || _isExcludedFromFees[to]) || (!automatedMarketMakerPairs[from] && !automatedMarketMakerPairs[to])) {\n takeFee = false;\n }\n\n if(takeFee && (totalFee >0)) {\n\n \tuint256 fees = amount.mul(totalFee).div(100);\n \tamount = amount.sub(fees);\n\n super._transfer(from, address(this), fees);\n }\n\n super._transfer(from, to, amount);\n\n try dividendTracker.setBalance(payable(from), balanceOf(from)) {} catch {}\n try dividendTracker.setBalance(payable(to), balanceOf(to)) {} catch {}\n\n\n lastTransfer[from] = block.timestamp;\n lastTransfer[to] = block.timestamp;\n\n if (!swapping && ethRedistributionEnabled) {\n uint256 gas = gasForProcessing;\n\n try dividendTracker.process(gas) returns (uint256 iterations, uint256 claims, uint256 lastProcessedIndex) {\n emit ProcessedDividendTracker(iterations, claims, lastProcessedIndex, true, gas, tx.origin);\n } catch {\n\n }\n }\n }\n\n function swapTokensForEth(uint256 tokenAmount) private {\n // generate the uniswap pair path of token -> weth\n address[] memory path = new address[](2);\n path[0] = address(this);\n path[1] = uniswapV2Router.WETH();\n\n _approve(address(this), address(uniswapV2Router), tokenAmount);\n\n // make the swap\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0, // accept any amount of ETH\n path,\n address(this),\n block.timestamp\n );\n }\n\n function swapEthForTokens(uint256 ethAmount, uint256 minTokens, address account) internal returns(uint256) {\n address[] memory path = new address[](2);\n path[0] = uniswapV2Router.WETH();\n path[1] = address(this);\n\n uint256 balanceBefore = balanceOf(account);\n\n uniswapV2Router.swapExactETHForTokensSupportingFeeOnTransferTokens{value: ethAmount}(\n minTokens,\n path,\n account,\n block.timestamp\n );\n\n uint256 tokenAmount = balanceOf(account).sub(balanceBefore);\n return tokenAmount;\n }\n\n function swapAndDistribute() private {\n uint256 tokenBalance = balanceOf(address(this));\n swapTokensForEth(tokenBalance);\n\n uint256 ethBalance = address(this).balance;\n uint256 devMarketingAndCharityPortion = ethBalance.mul(devMarketingAndCharityFee).div(totalFee);\n uint256 buybackAndBurnPortion = ethBalance.mul(buybackFee).div(totalFee);\n\n if(devMarketingAndCharityEnabled && devMarketingAndCharityPortion > 0)\n {\n devMarketingAndCharityAddress.transfer(devMarketingAndCharityPortion);\n }\n if(aidiBuybackEnabled && buybackAndBurnPortion > 0)\n {\n buybackAndBurnAidiTokens(buybackAndBurnPortion);\n }\n\n uint256 dividends = address(this).balance;\n if(ethRedistributionEnabled && dividends > 0)\n {\n (bool success,) = address(dividendTracker).call{value: dividends}(\"\");\n\n if(success) {\n \t \t\temit SendDividends(dividends);\n }\n }\n }\n\n function buybackAndBurnAidiTokens(uint256 amount) private {\n // generate the uniswap pair path of weth -> token\n address[] memory path = new address[](2);\n path[0] = uniswapV2Router.WETH();\n path[1] = address(0xD07F9F9e70d216B3Fe5f97D121B100a77dd682c1);//todo Aidi address\n\n // make the swap\n uniswapV2Router.swapExactETHForTokensSupportingFeeOnTransferTokens{value: amount}(\n 0, // accept any amount of Tokens\n path,\n deadAddress, // Burn address\n block.timestamp.add(300)\n );\n }\n\n function getDay() internal view returns(uint256){\n return block.timestamp.div(1 days);\n }\n\n function openTrading() external onlyOwner {\n tradingOpen = true;\n launchTime = block.timestamp;\n }\n\n function isBot(address account) public view returns (bool) {\n return _isBot[account];\n }\n //manual antibot, play fair!\n function _blacklistBot(address account) external onlyOwner() {\n require(account != 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D, 'We cannot blacklist Uniswap');\n require(!_isBot[account], \"Account is already blacklisted\");\n _isBot[account] = true;\n _confirmedBots.push(account);\n }\n\n function _amnestyBot(address account) external onlyOwner() {\n require(_isBot[account], \"Account is not blacklisted\");\n for (uint256 i = 0; i < _confirmedBots.length; i++) {\n if (_confirmedBots[i] == account) {\n _confirmedBots[i] = _confirmedBots[_confirmedBots.length - 1];\n _isBot[account] = false;\n _confirmedBots.pop();\n break;\n }\n }\n }\n}\n\ncontract VerseDividendTracker is DividendPayingToken, Ownable {\n using SafeMath for uint256;\n using SafeMathInt for int256;\n using IterableMapping for IterableMapping.Map;\n\n IterableMapping.Map private tokenHoldersMap;\n uint256 public lastProcessedIndex;\n\n mapping (address => bool) public excludedFromDividends;\n\n mapping (address => uint256) public lastClaimTimes;\n\n uint256 public claimWait;\n uint256 public constant MIN_TOKEN_BALANCE_FOR_DIVIDENDS = 500 * (10**18); // Must hold 500+ tokens.\n\n event ExcludedFromDividends(address indexed account);\n event GasForTransferUpdated(uint256 indexed newValue, uint256 indexed oldValue);\n event ClaimWaitUpdated(uint256 indexed newValue, uint256 indexed oldValue);\n\n event Claim(address indexed account, uint256 amount, bool indexed automatic);\n\n constructor() DividendPayingToken(\"Verse_Dividend_Tracker\", \"Verse_Dividend_Tracker\") {\n claimWait = 60; //todo = 3600;\n }\n\n function _transfer(address, address, uint256) internal pure override {\n require(false, \"Verse_Dividend_Tracker: No transfers allowed\");\n }\n\n function withdrawDividend() public pure override {\n require(false, \"Verse_Dividend_Tracker: withdrawDividend disabled. Use the 'claim' function on the main Verse contract.\");\n }\n\n function excludeFromDividends(address account) external onlyOwner {\n require(!excludedFromDividends[account]);\n excludedFromDividends[account] = true;\n\n _setBalance(account, 0);\n tokenHoldersMap.remove(account);\n\n emit ExcludedFromDividends(account);\n }\n\n function updateGasForTransfer(uint256 newGasForTransfer) external onlyOwner {\n require(newGasForTransfer != gasForTransfer, \"Verse_Dividend_Tracker: Cannot update gasForTransfer to same value\");\n emit GasForTransferUpdated(newGasForTransfer, gasForTransfer);\n gasForTransfer = newGasForTransfer;\n }\n\n\n function updateClaimWait(uint256 newClaimWait) external onlyOwner {\n require(newClaimWait >= 3600 && newClaimWait <= 86400, \"Verse_Dividend_Tracker: claimWait must be updated to between 1 and 24 hours\");\n require(newClaimWait != claimWait, \"Verse_Dividend_Tracker: Cannot update claimWait to same value\");\n emit ClaimWaitUpdated(newClaimWait, claimWait);\n claimWait = newClaimWait;\n }\n\n function getLastProcessedIndex() external view returns(uint256) {\n return lastProcessedIndex;\n }\n\n function getNumberOfTokenHolders() external view returns(uint256) {\n return tokenHoldersMap.keys.length;\n }\n\n function getAccount(address _account)\n public view returns (\n address account,\n int256 index,\n int256 iterationsUntilProcessed,\n uint256 withdrawableDividends,\n uint256 totalDividends,\n uint256 lastClaimTime,\n uint256 nextClaimTime,\n uint256 secondsUntilAutoClaimAvailable) {\n account = _account;\n\n index = tokenHoldersMap.getIndexOfKey(account);\n\n iterationsUntilProcessed = -1;\n\n if (index >= 0) {\n if (uint256(index) > lastProcessedIndex) {\n iterationsUntilProcessed = index.sub(int256(lastProcessedIndex));\n } else {\n uint256 processesUntilEndOfArray = tokenHoldersMap.keys.length > lastProcessedIndex ? tokenHoldersMap.keys.length.sub(lastProcessedIndex) : 0;\n iterationsUntilProcessed = index.add(int256(processesUntilEndOfArray));\n }\n }\n\n withdrawableDividends = withdrawableDividendOf(account);\n totalDividends = accumulativeDividendOf(account);\n\n lastClaimTime = lastClaimTimes[account];\n nextClaimTime = lastClaimTime > 0 ? lastClaimTime.add(claimWait) : 0;\n secondsUntilAutoClaimAvailable = nextClaimTime > block.timestamp ? nextClaimTime.sub(block.timestamp) : 0;\n }\n\n function getAccountAtIndex(uint256 index)\n public view returns (\n address,\n int256,\n int256,\n uint256,\n uint256,\n uint256,\n uint256,\n uint256) {\n if (index >= tokenHoldersMap.size()) {\n return (0x0000000000000000000000000000000000000000, -1, -1, 0, 0, 0, 0, 0);\n }\n\n address account = tokenHoldersMap.getKeyAtIndex(index);\n return getAccount(account);\n }\n\n function getLastProcessedAccount()\n public view returns (\n address,\n int256,\n int256,\n uint256,\n uint256,\n uint256,\n uint256,\n uint256) {\n if (lastProcessedIndex >= tokenHoldersMap.size()) {\n return (0x0000000000000000000000000000000000000000, -1, -1, 0, 0, 0, 0, 0);\n }\n\n address account = tokenHoldersMap.getKeyAtIndex(lastProcessedIndex);\n return getAccount(account);\n }\n\n function canAutoClaim(uint256 lastClaimTime) private view returns (bool) {\n if (lastClaimTime > block.timestamp) {\n return false;\n }\n return block.timestamp.sub(lastClaimTime) >= claimWait;\n }\n\n function setBalance(address payable account, uint256 newBalance) external onlyOwner {\n if (excludedFromDividends[account]) {\n return;\n }\n\n if (newBalance >= MIN_TOKEN_BALANCE_FOR_DIVIDENDS) {\n _setBalance(account, newBalance);\n tokenHoldersMap.set(account, newBalance);\n } else {\n _setBalance(account, 0);\n tokenHoldersMap.remove(account);\n }\n\n processAccount(account, true);\n }\n\n function process(uint256 gas) public returns (uint256, uint256, uint256) {\n uint256 numberOfTokenHolders = tokenHoldersMap.keys.length;\n\n if (numberOfTokenHolders == 0) {\n return (0, 0, lastProcessedIndex);\n }\n\n uint256 _lastProcessedIndex = lastProcessedIndex;\n\n uint256 gasUsed = 0;\n uint256 gasLeft = gasleft();\n\n uint256 iterations = 0;\n uint256 claims = 0;\n\n while (gasUsed < gas && iterations < numberOfTokenHolders) {\n _lastProcessedIndex++;\n\n if (_lastProcessedIndex >= tokenHoldersMap.keys.length) {\n _lastProcessedIndex = 0;\n }\n\n address account = tokenHoldersMap.keys[_lastProcessedIndex];\n\n if (canAutoClaim(lastClaimTimes[account])) {\n if (processAccount(payable(account), true)) {\n claims++;\n }\n }\n\n iterations++;\n\n uint256 newGasLeft = gasleft();\n\n if (gasLeft > newGasLeft) {\n gasUsed = gasUsed.add(gasLeft.sub(newGasLeft));\n }\n\n gasLeft = newGasLeft;\n }\n\n lastProcessedIndex = _lastProcessedIndex;\n\n return (iterations, claims, lastProcessedIndex);\n }\n\n function processAccount(address payable account, bool automatic) public onlyOwner returns (bool) {\n uint256 amount = _withdrawDividendOfUser(account);\n\n if (amount > 0) {\n lastClaimTimes[account] = block.timestamp;\n emit Claim(account, amount, automatic);\n return true;\n }\n\n return false;\n }\n}\n" + } + ] + }); + let expected = GetSourceFilesResponse { + status: MatchType::Full, + sources: BTreeMap::from([ + ("verse.sol".into(), "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.4;\n\n/*\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\n return msg.data;\n }\n}\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address recipient, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `sender` to `recipient` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n}\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n\n\n/// @title Dividend-Paying Token Optional Interface\n/// @author Roger Wu (https://github.com/roger-wu)\n/// @dev OPTIONAL functions for a dividend-paying token contract.\ninterface DividendPayingTokenOptionalInterface {\n /// @notice View the amount of dividend in wei that an address can withdraw.\n /// @param _owner The address of a token holder.\n /// @return The amount of dividend in wei that `_owner` can withdraw.\n function withdrawableDividendOf(address _owner) external view returns(uint256);\n\n /// @notice View the amount of dividend in wei that an address has withdrawn.\n /// @param _owner The address of a token holder.\n /// @return The amount of dividend in wei that `_owner` has withdrawn.\n function withdrawnDividendOf(address _owner) external view returns(uint256);\n\n /// @notice View the amount of dividend in wei that an address has earned in total.\n /// @dev accumulativeDividendOf(_owner) = withdrawableDividendOf(_owner) + withdrawnDividendOf(_owner)\n /// @param _owner The address of a token holder.\n /// @return The amount of dividend in wei that `_owner` has earned in total.\n function accumulativeDividendOf(address _owner) external view returns(uint256);\n}\n\n/// @title Dividend-Paying Token Interface\n/// @author Roger Wu (https://github.com/roger-wu)\n/// @dev An interface for a dividend-paying token contract.\ninterface DividendPayingTokenInterface {\n /// @notice View the amount of dividend in wei that an address can withdraw.\n /// @param _owner The address of a token holder.\n /// @return The amount of dividend in wei that `_owner` can withdraw.\n function dividendOf(address _owner) external view returns(uint256);\n\n /// @notice Distributes ether to token holders as dividends.\n /// @dev SHOULD distribute the paid ether to token holders as dividends.\n /// SHOULD NOT directly transfer ether to token holders in this function.\n /// MUST emit a `DividendsDistributed` event when the amount of distributed ether is greater than 0.\n function distributeDividends() external payable;\n\n /// @notice Withdraws the ether distributed to the sender.\n /// @dev SHOULD transfer `dividendOf(msg.sender)` wei to `msg.sender`, and `dividendOf(msg.sender)` SHOULD be 0 after the transfer.\n /// MUST emit a `DividendWithdrawn` event if the amount of ether transferred is greater than 0.\n function withdrawDividend() external;\n\n /// @dev This event MUST emit when ether is distributed to token holders.\n /// @param from The address which sends ether to this contract.\n /// @param weiAmount The amount of distributed ether in wei.\n event DividendsDistributed(\n address indexed from,\n uint256 weiAmount\n );\n\n /// @dev This event MUST emit when an address withdraws their dividend.\n /// @param to The address which withdraws ether from this contract.\n /// @param weiAmount The amount of withdrawn ether in wei.\n event DividendWithdrawn(\n address indexed to,\n uint256 weiAmount\n );\n}\n\nlibrary SafeMath {\n /**\n * @dev Returns the addition of two unsigned integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `+` operator.\n *\n * Requirements:\n *\n * - Addition cannot overflow.\n */\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n require(c >= a, \"SafeMath: addition overflow\");\n\n return c;\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting on\n * overflow (when the result is negative).\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n *\n * - Subtraction cannot overflow.\n */\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return sub(a, b, \"SafeMath: subtraction overflow\");\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting with custom message on\n * overflow (when the result is negative).\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n *\n * - Subtraction cannot overflow.\n */\n function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n require(b <= a, errorMessage);\n uint256 c = a - b;\n\n return c;\n }\n\n /**\n * @dev Returns the multiplication of two unsigned integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `*` operator.\n *\n * Requirements:\n *\n * - Multiplication cannot overflow.\n */\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n // benefit is lost if 'b' is also tested.\n // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n require(c / a == b, \"SafeMath: multiplication overflow\");\n\n return c;\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers. Reverts on\n * division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator. Note: this function uses a\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\n * uses an invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return div(a, b, \"SafeMath: division by zero\");\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers. Reverts with custom message on\n * division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator. Note: this function uses a\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\n * uses an invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n require(b > 0, errorMessage);\n uint256 c = a / b;\n // assert(a == b * c + a % b); // There is no case in which this doesn't hold\n\n return c;\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * Reverts when dividing by zero.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n return mod(a, b, \"SafeMath: modulo by zero\");\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * Reverts with custom message when dividing by zero.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n require(b != 0, errorMessage);\n return a % b;\n }\n}\n\n/*\nMIT License\n\nCopyright (c) 2018 requestnetwork\nCopyright (c) 2018 Fragments, Inc.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n*/\n/**\n * @title SafeMathInt\n * @dev Math operations for int256 with overflow safety checks.\n */\nlibrary SafeMathInt {\n int256 private constant MIN_INT256 = int256(1) << 255;\n int256 private constant MAX_INT256 = ~(int256(1) << 255);\n\n /**\n * @dev Multiplies two int256 variables and fails on overflow.\n */\n function mul(int256 a, int256 b) internal pure returns (int256) {\n int256 c = a * b;\n\n // Detect overflow when multiplying MIN_INT256 with -1\n require(c != MIN_INT256 || (a & MIN_INT256) != (b & MIN_INT256));\n require((b == 0) || (c / b == a));\n return c;\n }\n\n /**\n * @dev Division of two int256 variables and fails on overflow.\n */\n function div(int256 a, int256 b) internal pure returns (int256) {\n // Prevent overflow when dividing MIN_INT256 by -1\n require(b != -1 || a != MIN_INT256);\n\n // Solidity already throws when dividing by 0.\n return a / b;\n }\n\n /**\n * @dev Subtracts two int256 variables and fails on overflow.\n */\n function sub(int256 a, int256 b) internal pure returns (int256) {\n int256 c = a - b;\n require((b >= 0 && c <= a) || (b < 0 && c > a));\n return c;\n }\n\n /**\n * @dev Adds two int256 variables and fails on overflow.\n */\n function add(int256 a, int256 b) internal pure returns (int256) {\n int256 c = a + b;\n require((b >= 0 && c >= a) || (b < 0 && c < a));\n return c;\n }\n\n /**\n * @dev Converts to absolute value, and fails on overflow.\n */\n function abs(int256 a) internal pure returns (int256) {\n require(a != MIN_INT256);\n return a < 0 ? -a : a;\n }\n\n\n function toUint256Safe(int256 a) internal pure returns (uint256) {\n require(a >= 0);\n return uint256(a);\n }\n}\n\n/**\n * @title SafeMathUint\n * @dev Math operations with safety checks that revert on error\n */\nlibrary SafeMathUint {\n function toInt256Safe(uint256 a) internal pure returns (int256) {\n int256 b = int256(a);\n require(b >= 0);\n return b;\n }\n}\n\ncontract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor () {\n address msgSender = _msgSender();\n _owner = msgSender;\n emit OwnershipTransferred(address(0), msgSender);\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n require(_owner == _msgSender(), \"Ownable: caller is not the owner\");\n _;\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n _owner = address(0);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n emit OwnershipTransferred(_owner, newOwner);\n _owner = newOwner;\n }\n}\n\nlibrary IterableMapping {\n // Iterable mapping from address to uint;\n struct Map {\n address[] keys;\n mapping(address => uint) values;\n mapping(address => uint) indexOf;\n mapping(address => bool) inserted;\n }\n\n function get(Map storage map, address key) public view returns (uint) {\n return map.values[key];\n }\n\n function getIndexOfKey(Map storage map, address key) public view returns (int) {\n if(!map.inserted[key]) {\n return -1;\n }\n return int(map.indexOf[key]);\n }\n\n function getKeyAtIndex(Map storage map, uint index) public view returns (address) {\n return map.keys[index];\n }\n\n\n\n function size(Map storage map) public view returns (uint) {\n return map.keys.length;\n }\n\n function set(Map storage map, address key, uint val) public {\n if (map.inserted[key]) {\n map.values[key] = val;\n } else {\n map.inserted[key] = true;\n map.values[key] = val;\n map.indexOf[key] = map.keys.length;\n map.keys.push(key);\n }\n }\n\n function remove(Map storage map, address key) public {\n if (!map.inserted[key]) {\n return;\n }\n\n delete map.inserted[key];\n delete map.values[key];\n\n uint index = map.indexOf[key];\n uint lastIndex = map.keys.length - 1;\n address lastKey = map.keys[lastIndex];\n\n map.indexOf[lastKey] = index;\n delete map.indexOf[key];\n\n map.keys[index] = lastKey;\n map.keys.pop();\n }\n}\n\ninterface IUniswapV2Pair {\n event Approval(address indexed owner, address indexed spender, uint value);\n event Transfer(address indexed from, address indexed to, uint value);\n\n function name() external pure returns (string memory);\n function symbol() external pure returns (string memory);\n function decimals() external pure returns (uint8);\n function totalSupply() external view returns (uint);\n function balanceOf(address owner) external view returns (uint);\n function allowance(address owner, address spender) external view returns (uint);\n\n function approve(address spender, uint value) external returns (bool);\n function transfer(address to, uint value) external returns (bool);\n function transferFrom(address from, address to, uint value) external returns (bool);\n\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n function PERMIT_TYPEHASH() external pure returns (bytes32);\n function nonces(address owner) external view returns (uint);\n\n function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;\n\n event Mint(address indexed sender, uint amount0, uint amount1);\n event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);\n event Swap(\n address indexed sender,\n uint amount0In,\n uint amount1In,\n uint amount0Out,\n uint amount1Out,\n address indexed to\n );\n event Sync(uint112 reserve0, uint112 reserve1);\n\n function MINIMUM_LIQUIDITY() external pure returns (uint);\n function factory() external view returns (address);\n function token0() external view returns (address);\n function token1() external view returns (address);\n function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);\n function price0CumulativeLast() external view returns (uint);\n function price1CumulativeLast() external view returns (uint);\n function kLast() external view returns (uint);\n\n function mint(address to) external returns (uint liquidity);\n function burn(address to) external returns (uint amount0, uint amount1);\n function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;\n function skim(address to) external;\n function sync() external;\n\n function initialize(address, address) external;\n}\n\ninterface IUniswapV2Factory {\n event PairCreated(address indexed token0, address indexed token1, address pair, uint);\n\n function feeTo() external view returns (address);\n function feeToSetter() external view returns (address);\n\n function getPair(address tokenA, address tokenB) external view returns (address pair);\n function allPairs(uint) external view returns (address pair);\n function allPairsLength() external view returns (uint);\n\n function createPair(address tokenA, address tokenB) external returns (address pair);\n\n function setFeeTo(address) external;\n function setFeeToSetter(address) external;\n}\n\ninterface IUniswapV2Router01 {\n function factory() external pure returns (address);\n function WETH() external pure returns (address);\n\n function addLiquidity(\n address tokenA,\n address tokenB,\n uint amountADesired,\n uint amountBDesired,\n uint amountAMin,\n uint amountBMin,\n address to,\n uint deadline\n ) external returns (uint amountA, uint amountB, uint liquidity);\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n ) external payable returns (uint amountToken, uint amountETH, uint liquidity);\n function removeLiquidity(\n address tokenA,\n address tokenB,\n uint liquidity,\n uint amountAMin,\n uint amountBMin,\n address to,\n uint deadline\n ) external returns (uint amountA, uint amountB);\n function removeLiquidityETH(\n address token,\n uint liquidity,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n ) external returns (uint amountToken, uint amountETH);\n function removeLiquidityWithPermit(\n address tokenA,\n address tokenB,\n uint liquidity,\n uint amountAMin,\n uint amountBMin,\n address to,\n uint deadline,\n bool approveMax, uint8 v, bytes32 r, bytes32 s\n ) external returns (uint amountA, uint amountB);\n function removeLiquidityETHWithPermit(\n address token,\n uint liquidity,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline,\n bool approveMax, uint8 v, bytes32 r, bytes32 s\n ) external returns (uint amountToken, uint amountETH);\n function swapExactTokensForTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external returns (uint[] memory amounts);\n function swapTokensForExactTokens(\n uint amountOut,\n uint amountInMax,\n address[] calldata path,\n address to,\n uint deadline\n ) external returns (uint[] memory amounts);\n function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline)\n external\n payable\n returns (uint[] memory amounts);\n function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline)\n external\n returns (uint[] memory amounts);\n function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline)\n external\n returns (uint[] memory amounts);\n function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline)\n external\n payable\n returns (uint[] memory amounts);\n\n function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB);\n function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut);\n function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn);\n function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);\n function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts);\n}\n\n\ninterface IUniswapV2Router02 is IUniswapV2Router01 {\n function removeLiquidityETHSupportingFeeOnTransferTokens(\n address token,\n uint liquidity,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n ) external returns (uint amountETH);\n function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(\n address token,\n uint liquidity,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline,\n bool approveMax, uint8 v, bytes32 r, bytes32 s\n ) external returns (uint amountETH);\n\n function swapExactTokensForTokensSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n function swapExactETHForTokensSupportingFeeOnTransferTokens(\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external payable;\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n}\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * We have followed general OpenZeppelin guidelines: functions revert instead\n * of returning `false` on failure. This behavior is nonetheless conventional\n * and does not conflict with the expectations of ERC20 applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * The default value of {decimals} is 18. To select a different value for\n * {decimals} you should overload it.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5,05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\n * overridden;\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `recipient` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address recipient, uint256 amount) public virtual override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n _approve(_msgSender(), spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * Requirements:\n *\n * - `sender` and `recipient` cannot be the zero address.\n * - `sender` must have a balance of at least `amount`.\n * - the caller must have allowance for ``sender``'s tokens of at least\n * `amount`.\n */\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public virtual override returns (bool) {\n _transfer(sender, recipient, amount);\n _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, \"ERC20: transfer amount exceeds allowance\"));\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, \"ERC20: decreased allowance below zero\"));\n return true;\n }\n\n /**\n * @dev Moves tokens `amount` from `sender` to `recipient`.\n *\n * This is internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `sender` cannot be the zero address.\n * - `recipient` cannot be the zero address.\n * - `sender` must have a balance of at least `amount`.\n */\n function _transfer(\n address sender,\n address recipient,\n uint256 amount\n ) internal virtual {\n require(sender != address(0), \"ERC20: transfer from the zero address\");\n require(recipient != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(sender, recipient, amount);\n\n _balances[sender] = _balances[sender].sub(amount, \"ERC20: transfer amount exceeds balance\");\n _balances[recipient] = _balances[recipient].add(amount);\n emit Transfer(sender, recipient, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply = _totalSupply.add(amount);\n _balances[account] = _balances[account].add(amount);\n emit Transfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n _balances[account] = _balances[account].sub(amount, \"ERC20: burn amount exceeds balance\");\n _totalSupply = _totalSupply.sub(amount);\n emit Transfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be to transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n}\n\n/// @title Dividend-Paying Token\n/// @author Roger Wu (https://github.com/roger-wu)\n/// @dev A mintable ERC20 token that allows anyone to pay and distribute ether\n/// to token holders as dividends and allows token holders to withdraw their dividends.\n/// Reference: the source code of PoWH3D: https://etherscan.io/address/0xB3775fB83F7D12A36E0475aBdD1FCA35c091efBe#code\ncontract DividendPayingToken is ERC20, DividendPayingTokenInterface, DividendPayingTokenOptionalInterface {\n using SafeMath for uint256;\n using SafeMathUint for uint256;\n using SafeMathInt for int256;\n\n // With `magnitude`, we can properly distribute dividends even if the amount of received ether is small.\n // For more discussion about choosing the value of `magnitude`,\n // see https://github.com/ethereum/EIPs/issues/1726#issuecomment-472352728\n uint256 constant internal magnitude = 2**128;\n\n uint256 internal magnifiedDividendPerShare;\n\n // About dividendCorrection:\n // If the token balance of a `_user` is never changed, the dividend of `_user` can be computed with:\n // `dividendOf(_user) = dividendPerShare * balanceOf(_user)`.\n // When `balanceOf(_user)` is changed (via minting/burning/transferring tokens),\n // `dividendOf(_user)` should not be changed,\n // but the computed value of `dividendPerShare * balanceOf(_user)` is changed.\n // To keep the `dividendOf(_user)` unchanged, we add a correction term:\n // `dividendOf(_user) = dividendPerShare * balanceOf(_user) + dividendCorrectionOf(_user)`,\n // where `dividendCorrectionOf(_user)` is updated whenever `balanceOf(_user)` is changed:\n // `dividendCorrectionOf(_user) = dividendPerShare * (old balanceOf(_user)) - (new balanceOf(_user))`.\n // So now `dividendOf(_user)` returns the same value before and after `balanceOf(_user)` is changed.\n mapping(address => int256) internal magnifiedDividendCorrections;\n mapping(address => uint256) internal withdrawnDividends;\n\n // Need to make gas fee customizable to future-proof against Ethereum network upgrades.\n uint256 public gasForTransfer;\n\n uint256 public totalDividendsDistributed;\n\n constructor(string memory _name, string memory _symbol) ERC20(_name, _symbol) {\n gasForTransfer = 3000;\n }\n\n /// @dev Distributes dividends whenever ether is paid to this contract.\n receive() external payable {\n distributeDividends();\n }\n\n /// @notice Distributes ether to token holders as dividends.\n /// @dev It reverts if the total supply of tokens is 0.\n /// It emits the `DividendsDistributed` event if the amount of received ether is greater than 0.\n /// About undistributed ether:\n /// In each distribution, there is a small amount of ether not distributed,\n /// the magnified amount of which is\n /// `(msg.value * magnitude) % totalSupply()`.\n /// With a well-chosen `magnitude`, the amount of undistributed ether\n /// (de-magnified) in a distribution can be less than 1 wei.\n /// We can actually keep track of the undistributed ether in a distribution\n /// and try to distribute it in the next distribution,\n /// but keeping track of such data on-chain costs much more than\n /// the saved ether, so we don't do that.\n function distributeDividends() public override payable {\n require(totalSupply() > 0);\n\n if (msg.value > 0) {\n magnifiedDividendPerShare = magnifiedDividendPerShare.add(\n (msg.value).mul(magnitude) / totalSupply()\n );\n emit DividendsDistributed(msg.sender, msg.value);\n\n totalDividendsDistributed = totalDividendsDistributed.add(msg.value);\n }\n }\n\n /// @notice Withdraws the ether distributed to the sender.\n /// @dev It emits a `DividendWithdrawn` event if the amount of withdrawn ether is greater than 0.\n function withdrawDividend() public virtual override {\n _withdrawDividendOfUser(payable(msg.sender));\n }\n\n /// @notice Withdraws the ether distributed to the sender.\n /// @dev It emits a `DividendWithdrawn` event if the amount of withdrawn ether is greater than 0.\n function _withdrawDividendOfUser(address payable user) internal returns (uint256) {\n uint256 _withdrawableDividend = withdrawableDividendOf(user);\n if (_withdrawableDividend > 0) {\n withdrawnDividends[user] = withdrawnDividends[user].add(_withdrawableDividend);\n emit DividendWithdrawn(user, _withdrawableDividend);\n (bool success,) = user.call{value: _withdrawableDividend, gas: gasForTransfer}(\"\");\n\n if(!success) {\n withdrawnDividends[user] = withdrawnDividends[user].sub(_withdrawableDividend);\n return 0;\n }\n\n return _withdrawableDividend;\n }\n\n return 0;\n }\n\n\n /// @notice View the amount of dividend in wei that an address can withdraw.\n /// @param _owner The address of a token holder.\n /// @return The amount of dividend in wei that `_owner` can withdraw.\n function dividendOf(address _owner) public view override returns(uint256) {\n return withdrawableDividendOf(_owner);\n }\n\n /// @notice View the amount of dividend in wei that an address can withdraw.\n /// @param _owner The address of a token holder.\n /// @return The amount of dividend in wei that `_owner` can withdraw.\n function withdrawableDividendOf(address _owner) public view override returns(uint256) {\n return accumulativeDividendOf(_owner).sub(withdrawnDividends[_owner]);\n }\n\n /// @notice View the amount of dividend in wei that an address has withdrawn.\n /// @param _owner The address of a token holder.\n /// @return The amount of dividend in wei that `_owner` has withdrawn.\n function withdrawnDividendOf(address _owner) public view override returns(uint256) {\n return withdrawnDividends[_owner];\n }\n\n\n /// @notice View the amount of dividend in wei that an address has earned in total.\n /// @dev accumulativeDividendOf(_owner) = withdrawableDividendOf(_owner) + withdrawnDividendOf(_owner)\n /// = (magnifiedDividendPerShare * balanceOf(_owner) + magnifiedDividendCorrections[_owner]) / magnitude\n /// @param _owner The address of a token holder.\n /// @return The amount of dividend in wei that `_owner` has earned in total.\n function accumulativeDividendOf(address _owner) public view override returns(uint256) {\n return magnifiedDividendPerShare.mul(balanceOf(_owner)).toInt256Safe()\n .add(magnifiedDividendCorrections[_owner]).toUint256Safe() / magnitude;\n }\n\n /// @dev Internal function that transfer tokens from one address to another.\n /// Update magnifiedDividendCorrections to keep dividends unchanged.\n /// @param from The address to transfer from.\n /// @param to The address to transfer to.\n /// @param value The amount to be transferred.\n function _transfer(address from, address to, uint256 value) internal virtual override {\n require(false);\n\n int256 _magCorrection = magnifiedDividendPerShare.mul(value).toInt256Safe();\n magnifiedDividendCorrections[from] = magnifiedDividendCorrections[from].add(_magCorrection);\n magnifiedDividendCorrections[to] = magnifiedDividendCorrections[to].sub(_magCorrection);\n }\n\n /// @dev Internal function that mints tokens to an account.\n /// Update magnifiedDividendCorrections to keep dividends unchanged.\n /// @param account The account that will receive the created tokens.\n /// @param value The amount that will be created.\n function _mint(address account, uint256 value) internal override {\n super._mint(account, value);\n\n magnifiedDividendCorrections[account] = magnifiedDividendCorrections[account]\n .sub( (magnifiedDividendPerShare.mul(value)).toInt256Safe() );\n }\n\n /// @dev Internal function that burns an amount of the token of a given account.\n /// Update magnifiedDividendCorrections to keep dividends unchanged.\n /// @param account The account whose tokens will be burnt.\n /// @param value The amount that will be burnt.\n function _burn(address account, uint256 value) internal override {\n super._burn(account, value);\n\n magnifiedDividendCorrections[account] = magnifiedDividendCorrections[account]\n .add( (magnifiedDividendPerShare.mul(value)).toInt256Safe() );\n }\n\n function _setBalance(address account, uint256 newBalance) internal {\n uint256 currentBalance = balanceOf(account);\n\n if(newBalance > currentBalance) {\n uint256 mintAmount = newBalance.sub(currentBalance);\n _mint(account, mintAmount);\n } else if(newBalance < currentBalance) {\n uint256 burnAmount = currentBalance.sub(newBalance);\n _burn(account, burnAmount);\n }\n }\n}\n\ncontract Verse is ERC20, Ownable {\n using SafeMath for uint256;\n\n IUniswapV2Router02 public uniswapV2Router;\n address public uniswapV2Pair;\n\n bool private swapping;\n bool private reinvesting;\n bool public maxPurchaseEnabled = true;\n \n VerseDividendTracker public dividendTracker;\n\n address public immutable deadAddress = 0x000000000000000000000000000000000000dEaD;\n address payable public devMarketingAndCharityAddress = payable(0x4cD913cD83D38F355fB375a2873fDf127E9B77dB);\n\n //maximum purchase amount for initial launch\n uint256 maxPurchaseAmount = 3250 * (10**18);\n uint256 public maxDailySellAmount = 3250 * (10**18);\n uint256 public swapTokensAtAmount = 1000 * (10**18);\n\n mapping(address => bool) private _isBot;\n address[] private _confirmedBots;\n\n bool public aidiBuybackEnabled = true;\n bool public ethRedistributionEnabled = true;\n bool public devMarketingAndCharityEnabled = true;\n\n uint256 public buybackFee = 3;\n uint256 public ethRedistributeFee = 4;\n uint256 public devMarketingAndCharityFee = 3;\n uint256 public totalFee = 10;\n // use by default 150,000 gas to process auto-claiming dividends\n uint256 public gasForProcessing = 150000;\n\n // once set to true can never be set false again\n bool public tradingOpen = false;\n uint256 public launchTime;\n\n uint256 minimumTokenBalanceForDividends = 500 * (10**18);\n\n\n // exlcude from fees and max transaction amount\n mapping (address => bool) private _isExcludedFromFees;\n\n // store addresses that a automatic market maker pairs. Any transfer *to* these addresses\n // could be subject to a maximum transfer amount\n mapping (address => bool) public automatedMarketMakerPairs;\n\n // store the amount sold for each account every day\n // to add extra tax\n mapping (uint256 => mapping(address => uint256)) public dailySell;\n\n // the last time an address transferred\n // used to detect if an account can be reinvest inactive funds to the vault\n mapping (address => uint256) public lastTransfer;\n\n mapping (address => bool) public isExcludedFromDailyLimit;\n\n event UpdateDividendTracker(address indexed newAddress, address indexed oldAddress);\n event UpdateUniswapV2Router(address indexed newAddress, address indexed oldAddress);\n event ExcludeFromFees(address indexed account, bool isExcluded);\n event ExcludeMultipleAccountsFromFees(address[] accounts, bool isExcluded);\n event SetAutomatedMarketMakerPair(address indexed pair, bool indexed value);\n event SendDividends(uint256 amount);\n event DividendClaimed(uint256 ethAmount, uint256 tokenAmount, address account);\n event ProcessedDividendTracker(uint256 iterations, uint256 claims, uint256 lastProcessedIndex, bool indexed automatic, uint256 gas, address indexed processor);\n event GasForProcessingUpdated(uint256 indexed newValue, uint256 indexed oldValue);\n\n constructor() ERC20(\"Verse\", \"VERSE\") {\n\n \tdividendTracker = new VerseDividendTracker();\n\n \tIUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);\n // Create a uniswap pair for this new token\n address _uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())\n .createPair(address(this), _uniswapV2Router.WETH());\n\n uniswapV2Router = _uniswapV2Router;\n uniswapV2Pair = _uniswapV2Pair;\n\n _setAutomatedMarketMakerPair(_uniswapV2Pair, true);\n\n // exclude from receiving dividends\n dividendTracker.excludeFromDividends(address(dividendTracker));\n dividendTracker.excludeFromDividends(address(this));\n dividendTracker.excludeFromDividends(owner());\n dividendTracker.excludeFromDividends(address(_uniswapV2Router));\n dividendTracker.excludeFromDividends(address(0x000000000000000000000000000000000000dEaD));\n\n // exclude from paying fees or having max transaction amount\n excludeFromFees(address(this), true);\n excludeFromFees(owner(), true);\n\n isExcludedFromDailyLimit[address(this)] = true;\n isExcludedFromDailyLimit[owner()] = true;\n\n _mint(owner(), 5000000 * (10**18));\n }\n\n receive() external payable {\n\n \t}\n\n function updateDividendTracker(address newAddress) public onlyOwner {\n require(newAddress != address(dividendTracker), \"Verse: The dividend tracker already has that address\");\n\n VerseDividendTracker newDividendTracker = VerseDividendTracker(payable(newAddress));\n\n require(newDividendTracker.owner() == address(this), \"Verse: The new dividend tracker must be owned by the Verse token contract\");\n\n emit UpdateDividendTracker(newAddress, address(dividendTracker));\n\n dividendTracker = newDividendTracker;\n\n dividendTracker.excludeFromDividends(address(newDividendTracker));\n dividendTracker.excludeFromDividends(address(this));\n dividendTracker.excludeFromDividends(owner());\n dividendTracker.excludeFromDividends(address(uniswapV2Router));\n dividendTracker.excludeFromDividends(address(0x000000000000000000000000000000000000dEaD));\n }\n\n function updateUniswapV2Router(address newAddress) public onlyOwner {\n require(newAddress != address(uniswapV2Router), \"Verse: The router already has that address\");\n emit UpdateUniswapV2Router(newAddress, address(uniswapV2Router));\n uniswapV2Router = IUniswapV2Router02(newAddress);\n dividendTracker.excludeFromDividends(address(uniswapV2Router));\n }\n\n function excludeFromFees(address account, bool excluded) public onlyOwner {\n require(_isExcludedFromFees[account] != excluded, \"Verse: Account is already the value of 'excluded'\");\n _isExcludedFromFees[account] = excluded;\n\n emit ExcludeFromFees(account, excluded);\n }\n\n function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {\n for(uint256 i = 0; i < accounts.length; i++) {\n _isExcludedFromFees[accounts[i]] = excluded;\n }\n\n emit ExcludeMultipleAccountsFromFees(accounts, excluded);\n }\n\n function setAutomatedMarketMakerPair(address pair, bool value) public onlyOwner {\n require(pair != uniswapV2Pair, \"Verse: The UniSwap pair cannot be removed from automatedMarketMakerPairs\");\n\n _setAutomatedMarketMakerPair(pair, value);\n }\n\n function _setAutomatedMarketMakerPair(address pair, bool value) private {\n require(automatedMarketMakerPairs[pair] != value, \"Verse: Automated market maker pair is already set to that value\");\n automatedMarketMakerPairs[pair] = value;\n\n if(value) {\n dividendTracker.excludeFromDividends(pair);\n }\n\n emit SetAutomatedMarketMakerPair(pair, value);\n }\n\n function excludeFromDailyLimit(address account, bool excluded) public onlyOwner {\n require(isExcludedFromDailyLimit[account] != excluded, \"Verse: Daily limit exclusion is already the value of 'excluded'\");\n isExcludedFromDailyLimit[account] = excluded;\n }\n\n function setMaxPurchaseEnabled(bool enabled) public onlyOwner {\n require(maxPurchaseEnabled != enabled, \"Verse: Max purchase enabled is already the value of 'enabled'\");\n maxPurchaseEnabled = enabled;\n }\n\n function setAidiBuybackEnabled(bool enabled) public onlyOwner {\n aidiBuybackEnabled = enabled;\n }\n\n function setETHRedistributionEnabled(bool enabled) public onlyOwner {\n ethRedistributionEnabled = enabled;\n }\n\n function setDevMarketingAndCharityFeeEnabled(bool enabled) public onlyOwner {\n devMarketingAndCharityEnabled = enabled;\n }\n\n function setMaxPurchaseAmount(uint256 newAmount) public onlyOwner {\n maxPurchaseAmount = newAmount;\n }\n\n function setMaxDailySellAmount(uint256 newAmount) public onlyOwner {\n require((newAmount > (3250 * (10**18))), \"Verse: maxDailySellAmount should be greater than 3250\");\n maxDailySellAmount = newAmount;\n }\n\n function updateDevMarketingAndCharityAddress(address payable newAddress) public onlyOwner {\n devMarketingAndCharityAddress = newAddress;\n }\n\n\n function updateGasForTransfer(uint256 gasForTransfer) external onlyOwner {\n dividendTracker.updateGasForTransfer(gasForTransfer);\n }\n\n function updateGasForProcessing(uint256 newValue) public onlyOwner {\n // Need to make gas fee customizable to future-proof against Ethereum network upgrades.\n require(newValue != gasForProcessing, \"Verse: Cannot update gasForProcessing to same value\");\n emit GasForProcessingUpdated(newValue, gasForProcessing);\n gasForProcessing = newValue;\n }\n\n function updateClaimWait(uint256 claimWait) external onlyOwner {\n dividendTracker.updateClaimWait(claimWait);\n }\n\n function getGasForTransfer() external view returns(uint256) {\n return dividendTracker.gasForTransfer();\n }\n\n\n function getClaimWait() external view returns(uint256) {\n return dividendTracker.claimWait();\n }\n\n function getTotalDividendsDistributed() external view returns (uint256) {\n return dividendTracker.totalDividendsDistributed();\n }\n\n function isExcludedFromFees(address account) public view returns(bool) {\n return _isExcludedFromFees[account];\n }\n\n function withdrawableDividendOf(address account) public view returns(uint256) {\n return dividendTracker.withdrawableDividendOf(account);\n }\n\n function dividendTokenBalanceOf(address account) public view returns (uint256) {\n return dividendTracker.balanceOf(account);\n }\n\n function getAccountDividendsInfo(address account)\n external view returns (\n address,\n int256,\n int256,\n uint256,\n uint256,\n uint256,\n uint256,\n uint256) {\n return dividendTracker.getAccount(account);\n }\n\n function getAccountDividendsInfoAtIndex(uint256 index)\n external view returns (\n address,\n int256,\n int256,\n uint256,\n uint256,\n uint256,\n uint256,\n uint256) {\n return dividendTracker.getAccountAtIndex(index);\n }\n\n function processDividendTracker(uint256 gas) external {\n (uint256 iterations, uint256 claims, uint256 lastProcessedIndex) = dividendTracker.process(gas);\n emit ProcessedDividendTracker(iterations, claims, lastProcessedIndex, false, gas, tx.origin);\n }\n\n function claim() external {\n dividendTracker.processAccount(payable(msg.sender), false);\n }\n\n function getLastProcessedIndex() external view returns(uint256) {\n return dividendTracker.getLastProcessedIndex();\n }\n\n function getLastProcessedAccount()\n external view returns (\n address,\n int256,\n int256,\n uint256,\n uint256,\n uint256,\n uint256,\n uint256) {\n return dividendTracker.getLastProcessedAccount();\n }\n\n function getNumberOfDividendTokenHolders() external view returns(uint256) {\n return dividendTracker.getNumberOfTokenHolders();\n }\n\n function reinvestInactive(address payable account) public onlyOwner {\n uint256 tokenBalance = dividendTracker.balanceOf(account);\n require(tokenBalance <= minimumTokenBalanceForDividends, \"Verse: Account balance must be less then minimum token balance for dividends\");\n\n uint256 _lastTransfer = lastTransfer[account];\n require(block.timestamp.sub(_lastTransfer) > 12 weeks, \"Verse: Account must have been inactive for at least 12 weeks\");\n\n dividendTracker.processAccount(account, false);\n uint256 dividends = address(this).balance;\n (bool success,) = address(dividendTracker).call{value: dividends}(\"\");\n\n if(success) {\n \t \t\temit SendDividends(dividends);\n try dividendTracker.setBalance(account, 0) {} catch {}\n }\n }\n\n\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal override {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n require(to != address(0), \"ERC20: transfer to the zero address\");\n require(amount > 0, \"Transfer amount must be greater than zero\");\n \n if(from != owner() && to != owner()) {\n if(maxPurchaseEnabled)\n {\n require(amount <= maxPurchaseAmount, \"Transfer amount exceeds the maxPurchaseAmount.\");\n }\n require(!_isBot[from], 'Bots not allowed here! Play fair.');//antibot\n require(!_isBot[to], 'Bots not allowed here! Play fair.');//antibot\n }\n\n // buy\n if (from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_isExcludedFromFees[to]) {\n require(tradingOpen, 'Trading not yet enabled.');\n\n //antibot\n if (block.timestamp == launchTime) {\n _isBot[to] = true;\n _confirmedBots.push(to);\n }\n }\n\n\t\tuint256 contractTokenBalance = balanceOf(address(this));\n\n bool canSwap = contractTokenBalance >= swapTokensAtAmount;\n\n if (!swapping && !reinvesting && from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFees[to]) { //a buy\n if(aidiBuybackEnabled)\n {\n buybackFee = 3;\n }else{\n buybackFee = 0;\n }\n if(ethRedistributionEnabled)\n {\n ethRedistributeFee = 4;\n }else{\n ethRedistributeFee = 0;\n }\n\n if(devMarketingAndCharityEnabled)\n {\n devMarketingAndCharityFee = 3;\n }else{\n devMarketingAndCharityFee = 0;\n }\n\n totalFee = buybackFee + ethRedistributeFee + devMarketingAndCharityFee;\n }else if (!swapping && !reinvesting && to == uniswapV2Pair && from != address(uniswapV2Router) && !_isExcludedFromFees[to]) { //a sell\n\n if(dailySell[getDay()][from].add(amount) > maxDailySellAmount)\n {\n\n if(aidiBuybackEnabled)\n {\n buybackFee = 6;\n }else{\n buybackFee = 0;\n }\n if(ethRedistributionEnabled)\n {\n ethRedistributeFee = 8;\n }else{\n ethRedistributeFee = 0;\n }\n\n if(devMarketingAndCharityEnabled)\n {\n devMarketingAndCharityFee = 6;\n }else{\n devMarketingAndCharityFee = 0;\n }\n\n totalFee = buybackFee + ethRedistributeFee + devMarketingAndCharityFee;\n }else{\n if(aidiBuybackEnabled)\n {\n buybackFee = 3;\n }else{\n buybackFee = 0;\n }\n if(ethRedistributionEnabled)\n {\n ethRedistributeFee = 4;\n }else{\n ethRedistributeFee = 0;\n }\n if(devMarketingAndCharityEnabled)\n {\n devMarketingAndCharityFee = 3;\n }else{\n devMarketingAndCharityFee = 0;\n }\n\n totalFee = buybackFee + ethRedistributeFee + devMarketingAndCharityFee;\n }\n dailySell[getDay()][from] = dailySell[getDay()][from].add(amount);\n }\n\n\n if( canSwap &&\n !swapping &&\n !reinvesting &&\n !automatedMarketMakerPairs[from] &&\n !_isExcludedFromFees[from] &&\n !_isExcludedFromFees[to] &&\n (totalFee > 0))\n {\n swapping = true;\n swapAndDistribute();\n swapping = false;\n }\n\n\n bool takeFee = !swapping && !reinvesting;\n\n // if any account belongs to _isExcludedFromFee account then remove the fee\n // don't take a fee unless it's a buy / sell\n if((_isExcludedFromFees[from] || _isExcludedFromFees[to]) || (!automatedMarketMakerPairs[from] && !automatedMarketMakerPairs[to])) {\n takeFee = false;\n }\n\n if(takeFee && (totalFee >0)) {\n\n \tuint256 fees = amount.mul(totalFee).div(100);\n \tamount = amount.sub(fees);\n\n super._transfer(from, address(this), fees);\n }\n\n super._transfer(from, to, amount);\n\n try dividendTracker.setBalance(payable(from), balanceOf(from)) {} catch {}\n try dividendTracker.setBalance(payable(to), balanceOf(to)) {} catch {}\n\n\n lastTransfer[from] = block.timestamp;\n lastTransfer[to] = block.timestamp;\n\n if (!swapping && ethRedistributionEnabled) {\n uint256 gas = gasForProcessing;\n\n try dividendTracker.process(gas) returns (uint256 iterations, uint256 claims, uint256 lastProcessedIndex) {\n emit ProcessedDividendTracker(iterations, claims, lastProcessedIndex, true, gas, tx.origin);\n } catch {\n\n }\n }\n }\n\n function swapTokensForEth(uint256 tokenAmount) private {\n // generate the uniswap pair path of token -> weth\n address[] memory path = new address[](2);\n path[0] = address(this);\n path[1] = uniswapV2Router.WETH();\n\n _approve(address(this), address(uniswapV2Router), tokenAmount);\n\n // make the swap\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0, // accept any amount of ETH\n path,\n address(this),\n block.timestamp\n );\n }\n\n function swapEthForTokens(uint256 ethAmount, uint256 minTokens, address account) internal returns(uint256) {\n address[] memory path = new address[](2);\n path[0] = uniswapV2Router.WETH();\n path[1] = address(this);\n\n uint256 balanceBefore = balanceOf(account);\n\n uniswapV2Router.swapExactETHForTokensSupportingFeeOnTransferTokens{value: ethAmount}(\n minTokens,\n path,\n account,\n block.timestamp\n );\n\n uint256 tokenAmount = balanceOf(account).sub(balanceBefore);\n return tokenAmount;\n }\n\n function swapAndDistribute() private {\n uint256 tokenBalance = balanceOf(address(this));\n swapTokensForEth(tokenBalance);\n\n uint256 ethBalance = address(this).balance;\n uint256 devMarketingAndCharityPortion = ethBalance.mul(devMarketingAndCharityFee).div(totalFee);\n uint256 buybackAndBurnPortion = ethBalance.mul(buybackFee).div(totalFee);\n\n if(devMarketingAndCharityEnabled && devMarketingAndCharityPortion > 0)\n {\n devMarketingAndCharityAddress.transfer(devMarketingAndCharityPortion);\n }\n if(aidiBuybackEnabled && buybackAndBurnPortion > 0)\n {\n buybackAndBurnAidiTokens(buybackAndBurnPortion);\n }\n\n uint256 dividends = address(this).balance;\n if(ethRedistributionEnabled && dividends > 0)\n {\n (bool success,) = address(dividendTracker).call{value: dividends}(\"\");\n\n if(success) {\n \t \t\temit SendDividends(dividends);\n }\n }\n }\n\n function buybackAndBurnAidiTokens(uint256 amount) private {\n // generate the uniswap pair path of weth -> token\n address[] memory path = new address[](2);\n path[0] = uniswapV2Router.WETH();\n path[1] = address(0xD07F9F9e70d216B3Fe5f97D121B100a77dd682c1);//todo Aidi address\n\n // make the swap\n uniswapV2Router.swapExactETHForTokensSupportingFeeOnTransferTokens{value: amount}(\n 0, // accept any amount of Tokens\n path,\n deadAddress, // Burn address\n block.timestamp.add(300)\n );\n }\n\n function getDay() internal view returns(uint256){\n return block.timestamp.div(1 days);\n }\n\n function openTrading() external onlyOwner {\n tradingOpen = true;\n launchTime = block.timestamp;\n }\n\n function isBot(address account) public view returns (bool) {\n return _isBot[account];\n }\n //manual antibot, play fair!\n function _blacklistBot(address account) external onlyOwner() {\n require(account != 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D, 'We cannot blacklist Uniswap');\n require(!_isBot[account], \"Account is already blacklisted\");\n _isBot[account] = true;\n _confirmedBots.push(account);\n }\n\n function _amnestyBot(address account) external onlyOwner() {\n require(_isBot[account], \"Account is not blacklisted\");\n for (uint256 i = 0; i < _confirmedBots.length; i++) {\n if (_confirmedBots[i] == account) {\n _confirmedBots[i] = _confirmedBots[_confirmedBots.length - 1];\n _isBot[account] = false;\n _confirmedBots.pop();\n break;\n }\n }\n }\n}\n\ncontract VerseDividendTracker is DividendPayingToken, Ownable {\n using SafeMath for uint256;\n using SafeMathInt for int256;\n using IterableMapping for IterableMapping.Map;\n\n IterableMapping.Map private tokenHoldersMap;\n uint256 public lastProcessedIndex;\n\n mapping (address => bool) public excludedFromDividends;\n\n mapping (address => uint256) public lastClaimTimes;\n\n uint256 public claimWait;\n uint256 public constant MIN_TOKEN_BALANCE_FOR_DIVIDENDS = 500 * (10**18); // Must hold 500+ tokens.\n\n event ExcludedFromDividends(address indexed account);\n event GasForTransferUpdated(uint256 indexed newValue, uint256 indexed oldValue);\n event ClaimWaitUpdated(uint256 indexed newValue, uint256 indexed oldValue);\n\n event Claim(address indexed account, uint256 amount, bool indexed automatic);\n\n constructor() DividendPayingToken(\"Verse_Dividend_Tracker\", \"Verse_Dividend_Tracker\") {\n claimWait = 60; //todo = 3600;\n }\n\n function _transfer(address, address, uint256) internal pure override {\n require(false, \"Verse_Dividend_Tracker: No transfers allowed\");\n }\n\n function withdrawDividend() public pure override {\n require(false, \"Verse_Dividend_Tracker: withdrawDividend disabled. Use the 'claim' function on the main Verse contract.\");\n }\n\n function excludeFromDividends(address account) external onlyOwner {\n require(!excludedFromDividends[account]);\n excludedFromDividends[account] = true;\n\n _setBalance(account, 0);\n tokenHoldersMap.remove(account);\n\n emit ExcludedFromDividends(account);\n }\n\n function updateGasForTransfer(uint256 newGasForTransfer) external onlyOwner {\n require(newGasForTransfer != gasForTransfer, \"Verse_Dividend_Tracker: Cannot update gasForTransfer to same value\");\n emit GasForTransferUpdated(newGasForTransfer, gasForTransfer);\n gasForTransfer = newGasForTransfer;\n }\n\n\n function updateClaimWait(uint256 newClaimWait) external onlyOwner {\n require(newClaimWait >= 3600 && newClaimWait <= 86400, \"Verse_Dividend_Tracker: claimWait must be updated to between 1 and 24 hours\");\n require(newClaimWait != claimWait, \"Verse_Dividend_Tracker: Cannot update claimWait to same value\");\n emit ClaimWaitUpdated(newClaimWait, claimWait);\n claimWait = newClaimWait;\n }\n\n function getLastProcessedIndex() external view returns(uint256) {\n return lastProcessedIndex;\n }\n\n function getNumberOfTokenHolders() external view returns(uint256) {\n return tokenHoldersMap.keys.length;\n }\n\n function getAccount(address _account)\n public view returns (\n address account,\n int256 index,\n int256 iterationsUntilProcessed,\n uint256 withdrawableDividends,\n uint256 totalDividends,\n uint256 lastClaimTime,\n uint256 nextClaimTime,\n uint256 secondsUntilAutoClaimAvailable) {\n account = _account;\n\n index = tokenHoldersMap.getIndexOfKey(account);\n\n iterationsUntilProcessed = -1;\n\n if (index >= 0) {\n if (uint256(index) > lastProcessedIndex) {\n iterationsUntilProcessed = index.sub(int256(lastProcessedIndex));\n } else {\n uint256 processesUntilEndOfArray = tokenHoldersMap.keys.length > lastProcessedIndex ? tokenHoldersMap.keys.length.sub(lastProcessedIndex) : 0;\n iterationsUntilProcessed = index.add(int256(processesUntilEndOfArray));\n }\n }\n\n withdrawableDividends = withdrawableDividendOf(account);\n totalDividends = accumulativeDividendOf(account);\n\n lastClaimTime = lastClaimTimes[account];\n nextClaimTime = lastClaimTime > 0 ? lastClaimTime.add(claimWait) : 0;\n secondsUntilAutoClaimAvailable = nextClaimTime > block.timestamp ? nextClaimTime.sub(block.timestamp) : 0;\n }\n\n function getAccountAtIndex(uint256 index)\n public view returns (\n address,\n int256,\n int256,\n uint256,\n uint256,\n uint256,\n uint256,\n uint256) {\n if (index >= tokenHoldersMap.size()) {\n return (0x0000000000000000000000000000000000000000, -1, -1, 0, 0, 0, 0, 0);\n }\n\n address account = tokenHoldersMap.getKeyAtIndex(index);\n return getAccount(account);\n }\n\n function getLastProcessedAccount()\n public view returns (\n address,\n int256,\n int256,\n uint256,\n uint256,\n uint256,\n uint256,\n uint256) {\n if (lastProcessedIndex >= tokenHoldersMap.size()) {\n return (0x0000000000000000000000000000000000000000, -1, -1, 0, 0, 0, 0, 0);\n }\n\n address account = tokenHoldersMap.getKeyAtIndex(lastProcessedIndex);\n return getAccount(account);\n }\n\n function canAutoClaim(uint256 lastClaimTime) private view returns (bool) {\n if (lastClaimTime > block.timestamp) {\n return false;\n }\n return block.timestamp.sub(lastClaimTime) >= claimWait;\n }\n\n function setBalance(address payable account, uint256 newBalance) external onlyOwner {\n if (excludedFromDividends[account]) {\n return;\n }\n\n if (newBalance >= MIN_TOKEN_BALANCE_FOR_DIVIDENDS) {\n _setBalance(account, newBalance);\n tokenHoldersMap.set(account, newBalance);\n } else {\n _setBalance(account, 0);\n tokenHoldersMap.remove(account);\n }\n\n processAccount(account, true);\n }\n\n function process(uint256 gas) public returns (uint256, uint256, uint256) {\n uint256 numberOfTokenHolders = tokenHoldersMap.keys.length;\n\n if (numberOfTokenHolders == 0) {\n return (0, 0, lastProcessedIndex);\n }\n\n uint256 _lastProcessedIndex = lastProcessedIndex;\n\n uint256 gasUsed = 0;\n uint256 gasLeft = gasleft();\n\n uint256 iterations = 0;\n uint256 claims = 0;\n\n while (gasUsed < gas && iterations < numberOfTokenHolders) {\n _lastProcessedIndex++;\n\n if (_lastProcessedIndex >= tokenHoldersMap.keys.length) {\n _lastProcessedIndex = 0;\n }\n\n address account = tokenHoldersMap.keys[_lastProcessedIndex];\n\n if (canAutoClaim(lastClaimTimes[account])) {\n if (processAccount(payable(account), true)) {\n claims++;\n }\n }\n\n iterations++;\n\n uint256 newGasLeft = gasleft();\n\n if (gasLeft > newGasLeft) {\n gasUsed = gasUsed.add(gasLeft.sub(newGasLeft));\n }\n\n gasLeft = newGasLeft;\n }\n\n lastProcessedIndex = _lastProcessedIndex;\n\n return (iterations, claims, lastProcessedIndex);\n }\n\n function processAccount(address payable account, bool automatic) public onlyOwner returns (bool) {\n uint256 amount = _withdrawDividendOfUser(account);\n\n if (amount > 0) {\n lastClaimTimes[account] = block.timestamp;\n emit Claim(account, amount, automatic);\n return true;\n }\n\n return false;\n }\n}\n".into()), + ]), + metadata: serde_json::Value::from_str("{\"compiler\":{\"version\":\"0.8.4+commit.c7e474f2\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"ethAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"tokenAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"DividendClaimed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"isExcluded\",\"type\":\"bool\"}],\"name\":\"ExcludeFromFees\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"accounts\",\"type\":\"address[]\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"isExcluded\",\"type\":\"bool\"}],\"name\":\"ExcludeMultipleAccountsFromFees\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"newValue\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"oldValue\",\"type\":\"uint256\"}],\"name\":\"GasForProcessingUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"iterations\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"claims\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"lastProcessedIndex\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"bool\",\"name\":\"automatic\",\"type\":\"bool\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"gas\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"processor\",\"type\":\"address\"}],\"name\":\"ProcessedDividendTracker\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"SendDividends\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"pair\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"bool\",\"name\":\"value\",\"type\":\"bool\"}],\"name\":\"SetAutomatedMarketMakerPair\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newAddress\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"oldAddress\",\"type\":\"address\"}],\"name\":\"UpdateDividendTracker\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newAddress\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"oldAddress\",\"type\":\"address\"}],\"name\":\"UpdateUniswapV2Router\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"_amnestyBot\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"_blacklistBot\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"aidiBuybackEnabled\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"}],\"name\":\"allowance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"automatedMarketMakerPairs\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"buybackFee\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"claim\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"dailySell\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"deadAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"decimals\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"subtractedValue\",\"type\":\"uint256\"}],\"name\":\"decreaseAllowance\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"devMarketingAndCharityAddress\",\"outputs\":[{\"internalType\":\"address payable\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"devMarketingAndCharityEnabled\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"devMarketingAndCharityFee\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"dividendTokenBalanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"dividendTracker\",\"outputs\":[{\"internalType\":\"contract VerseDividendTracker\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ethRedistributeFee\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ethRedistributionEnabled\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"excluded\",\"type\":\"bool\"}],\"name\":\"excludeFromDailyLimit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"excluded\",\"type\":\"bool\"}],\"name\":\"excludeFromFees\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"accounts\",\"type\":\"address[]\"},{\"internalType\":\"bool\",\"name\":\"excluded\",\"type\":\"bool\"}],\"name\":\"excludeMultipleAccountsFromFees\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"gasForProcessing\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"getAccountDividendsInfo\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"int256\",\"name\":\"\",\"type\":\"int256\"},{\"internalType\":\"int256\",\"name\":\"\",\"type\":\"int256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"getAccountDividendsInfoAtIndex\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"int256\",\"name\":\"\",\"type\":\"int256\"},{\"internalType\":\"int256\",\"name\":\"\",\"type\":\"int256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getClaimWait\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getGasForTransfer\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getLastProcessedAccount\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"int256\",\"name\":\"\",\"type\":\"int256\"},{\"internalType\":\"int256\",\"name\":\"\",\"type\":\"int256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getLastProcessedIndex\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getNumberOfDividendTokenHolders\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getTotalDividendsDistributed\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"addedValue\",\"type\":\"uint256\"}],\"name\":\"increaseAllowance\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"isBot\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"isExcludedFromDailyLimit\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"isExcludedFromFees\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"lastTransfer\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"launchTime\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxDailySellAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxPurchaseEnabled\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"openTrading\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"gas\",\"type\":\"uint256\"}],\"name\":\"processDividendTracker\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address payable\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"reinvestInactive\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bool\",\"name\":\"enabled\",\"type\":\"bool\"}],\"name\":\"setAidiBuybackEnabled\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"pair\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"value\",\"type\":\"bool\"}],\"name\":\"setAutomatedMarketMakerPair\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bool\",\"name\":\"enabled\",\"type\":\"bool\"}],\"name\":\"setDevMarketingAndCharityFeeEnabled\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bool\",\"name\":\"enabled\",\"type\":\"bool\"}],\"name\":\"setETHRedistributionEnabled\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"newAmount\",\"type\":\"uint256\"}],\"name\":\"setMaxDailySellAmount\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"newAmount\",\"type\":\"uint256\"}],\"name\":\"setMaxPurchaseAmount\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bool\",\"name\":\"enabled\",\"type\":\"bool\"}],\"name\":\"setMaxPurchaseEnabled\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"swapTokensAtAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"symbol\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalFee\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"tradingOpen\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transfer\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"uniswapV2Pair\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"uniswapV2Router\",\"outputs\":[{\"internalType\":\"contract IUniswapV2Router02\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"claimWait\",\"type\":\"uint256\"}],\"name\":\"updateClaimWait\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address payable\",\"name\":\"newAddress\",\"type\":\"address\"}],\"name\":\"updateDevMarketingAndCharityAddress\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAddress\",\"type\":\"address\"}],\"name\":\"updateDividendTracker\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"newValue\",\"type\":\"uint256\"}],\"name\":\"updateGasForProcessing\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"gasForTransfer\",\"type\":\"uint256\"}],\"name\":\"updateGasForTransfer\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAddress\",\"type\":\"address\"}],\"name\":\"updateUniswapV2Router\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"withdrawableDividendOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"allowance(address,address)\":{\"details\":\"See {IERC20-allowance}.\"},\"approve(address,uint256)\":{\"details\":\"See {IERC20-approve}. Requirements: - `spender` cannot be the zero address.\"},\"balanceOf(address)\":{\"details\":\"See {IERC20-balanceOf}.\"},\"decimals()\":{\"details\":\"Returns the number of decimals used to get its user representation. For example, if `decimals` equals `2`, a balance of `505` tokens should be displayed to a user as `5,05` (`505 / 10 ** 2`). Tokens usually opt for a value of 18, imitating the relationship between Ether and Wei. This is the value {ERC20} uses, unless this function is overridden; NOTE: This information is only used for _display_ purposes: it in no way affects any of the arithmetic of the contract, including {IERC20-balanceOf} and {IERC20-transfer}.\"},\"decreaseAllowance(address,uint256)\":{\"details\":\"Atomically decreases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address. - `spender` must have allowance for the caller of at least `subtractedValue`.\"},\"increaseAllowance(address,uint256)\":{\"details\":\"Atomically increases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address.\"},\"name()\":{\"details\":\"Returns the name of the token.\"},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"symbol()\":{\"details\":\"Returns the symbol of the token, usually a shorter version of the name.\"},\"totalSupply()\":{\"details\":\"See {IERC20-totalSupply}.\"},\"transfer(address,uint256)\":{\"details\":\"See {IERC20-transfer}. Requirements: - `recipient` cannot be the zero address. - the caller must have a balance of at least `amount`.\"},\"transferFrom(address,address,uint256)\":{\"details\":\"See {IERC20-transferFrom}. Emits an {Approval} event indicating the updated allowance. This is not required by the EIP. See the note at the beginning of {ERC20}. Requirements: - `sender` and `recipient` cannot be the zero address. - `sender` must have a balance of at least `amount`. - the caller must have allowance for ``sender``'s tokens of at least `amount`.\"},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"verse.sol\":\"Verse\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"verse.sol\":{\"keccak256\":\"0xd195f71e6fd62c78589726ae45f2e200aebc8bfe4202056e2395b3bcb2f06d52\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://42c7dacbb5b519bed940b155f8cd712e9b75f6d5ea71f2aea395853a95924b1c\",\"dweb:/ipfs/QmZfDn4NVcMZBV7zGhwxJDCA9T3XDNSzsPYVYxn8egggZr\"]}},\"version\":1}").unwrap(), + library_map: BTreeMap::from([ + ("__$c486e37aeebf327f7a754ca76e58aaef3b$__".to_string(), DisplayBytes::from_str("a8602b5e79650417ee75f78aa60836be0f234868").unwrap().0), + ]), + constructor_arguments: Some(Bytes::new()), + immutable_references: None, + raw_json: value.clone(), + }; + + check(value, expected, Some("contract with constructor-arguments")); + + /********** Response with library map, immutable details and several sources **********/ + + let value = json!({ + "status": "full", + "files": [ + { + "name": "immutable-references.json", + "path": "/home/data/repository/contracts/full_match/5/0xb5fa8e1E33df0742Fa40F7bB5f41e782eb5524c3/immutable-references.json", + "content": "{\"76\":[{\"length\":32,\"start\":242}],\"90\":[{\"length\":32,\"start\":636}],\"92\":[{\"length\":32,\"start\":708}]}" + }, + { + "name": "library-map.json", + "path": "/home/data/repository/contracts/full_match/5/0xb5fa8e1E33df0742Fa40F7bB5f41e782eb5524c3/library-map.json", + "content": "{\"__$b01ade520cf6862e0b214d4ce779d49f2a$__\":\"77479d54e233b4b79b9e3f4cf2bd20575fdeb1bb\",\"__$21bb6923d223bd045c4cab9806bdf3594d$__\":\"4ea76bb37c82f6f453c4cbb4ae726036a7a8b820\"}" + }, + { + "name": "metadata.json", + "path": "/home/data/repository/contracts/full_match/5/0xb5fa8e1E33df0742Fa40F7bB5f41e782eb5524c3/metadata.json", + "content": "{\"compiler\":{\"version\":\"0.8.7+commit.e28d00a7\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_c\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"a\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"arr\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"b\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"c\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"test_array\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/C2.sol\":\"C2\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"contracts/Array.sol\":{\"keccak256\":\"0xa3c043d47c03251f392e0dcdf7c2ad5069436cc72561b2404a195d84a78fb33c\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://9eeae2fe8bb3e5addd48dea0b8c5a81581b4137ad605b103b7edc35ea1ab2997\",\"dweb:/ipfs/QmRaC1FTQxkcWwmyZeZ4twQswdpcTnN5GQJ2Db7RMdf14j\"]},\"contracts/Array2.sol\":{\"keccak256\":\"0x6b5b4acc9b4f10f7df803702516752978c40cb4eadd48a218dcc0503fd7f4f88\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://6f9b39fbd016e6b0c62cb3a7d8abc8981fe383c345381dfd7533a8cb8a1ded69\",\"dweb:/ipfs/QmUznGnpnz1TFuQZzjDX4NzoVFsiwRzaA2T7gZQZUoFDim\"]},\"contracts/C1.sol\":{\"keccak256\":\"0x92ca0ef5999e6bae5556c90314c3b7fe3bf95cabf8423d8415ac3d3955f524df\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://1bb5f1bc39e5507da05e9d7700546f74896b47c4da076fbd744d8b6269c32a09\",\"dweb:/ipfs/QmRoabfGHHmoKTPb8vtdWFuaesoc4mUjzuSgEDE8TpeYwF\"]},\"contracts/C2.sol\":{\"keccak256\":\"0x20dd630583b88340fae8cda0a6008c0db058ee4b35d8a1f5a44bcd66ef892782\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://998e0420f165f61fec241b5fbd71f06bc150098c8981f0aeedbf5a95c240b2a0\",\"dweb:/ipfs/QmSG3mwV4zqk4NacHtf3MWSAbWW96sorEVjNBPJiWXs2LQ\"]}},\"version\":1}" + }, + { + "name": "Array.sol", + "path": "/home/data/repository/contracts/full_match/5/0xb5fa8e1E33df0742Fa40F7bB5f41e782eb5524c3/sources/contracts/Array.sol", + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.7;\n\n// Array function to delete element at index and re-organize the array\n// so that there are no gaps between the elements.\nlibrary Array {\n function remove(uint[] storage arr, uint index) public {\n // Move the last element into the place to delete\n require(arr.length > 0, \"Can't remove from empty array\");\n arr[index] = arr[arr.length - 1];\n arr.pop();\n }\n}\n" + }, + { + "name": "Array2.sol", + "path": "/home/data/repository/contracts/full_match/5/0xb5fa8e1E33df0742Fa40F7bB5f41e782eb5524c3/sources/contracts/Array2.sol", + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.7;\n\n// Array function to delete element at index and re-organize the array\n// so that there are no gaps between the elements.\nlibrary Array2 {\n function remove(uint[] storage arr, uint index) public {\n // Move the last element into the place to delete\n require(arr.length > 0, \"Can't remove from empty array\");\n arr[index] = arr[arr.length - 1];\n arr.pop();\n }\n}\n" + }, + { + "name": "C1.sol", + "path": "/home/data/repository/contracts/full_match/5/0xb5fa8e1E33df0742Fa40F7bB5f41e782eb5524c3/sources/contracts/C1.sol", + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.7;\n\ncontract C1 {\n uint256 immutable public a = 0;\n}\n\n" + }, + { + "name": "C2.sol", + "path": "/home/data/repository/contracts/full_match/5/0xb5fa8e1E33df0742Fa40F7bB5f41e782eb5524c3/sources/contracts/C2.sol", + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.7;\n\nimport \"./C1.sol\";\nimport \"./Array.sol\";\nimport \"./Array2.sol\";\n\ncontract C2 is C1 {\n uint[] public arr;\n\n uint256 immutable public b = 10;\n uint256 immutable public c;\n\n constructor(uint256 _c) {\n c = _c;\n }\n\n function test_array() public {\n for (uint i = 0; i < 3; i++) {\n arr.push(i);\n }\n\n Array.remove(arr, 1);\n Array2.remove(arr, 1);\n\n assert(arr.length == 1);\n assert(arr[0] == 0);\n }\n}\n" + } + ] + }); + let expected = GetSourceFilesResponse { + status: MatchType::Full, + sources: BTreeMap::from([ + ("contracts/Array.sol".into(), "// SPDX-License-Identifier: MIT\npragma solidity 0.8.7;\n\n// Array function to delete element at index and re-organize the array\n// so that there are no gaps between the elements.\nlibrary Array {\n function remove(uint[] storage arr, uint index) public {\n // Move the last element into the place to delete\n require(arr.length > 0, \"Can't remove from empty array\");\n arr[index] = arr[arr.length - 1];\n arr.pop();\n }\n}\n".into()), + ("contracts/Array2.sol".into(), "// SPDX-License-Identifier: MIT\npragma solidity 0.8.7;\n\n// Array function to delete element at index and re-organize the array\n// so that there are no gaps between the elements.\nlibrary Array2 {\n function remove(uint[] storage arr, uint index) public {\n // Move the last element into the place to delete\n require(arr.length > 0, \"Can't remove from empty array\");\n arr[index] = arr[arr.length - 1];\n arr.pop();\n }\n}\n".into()), + ("contracts/C1.sol".into(), "// SPDX-License-Identifier: MIT\npragma solidity 0.8.7;\n\ncontract C1 {\n uint256 immutable public a = 0;\n}\n\n".into()), + ("contracts/C2.sol".into(), "// SPDX-License-Identifier: MIT\npragma solidity 0.8.7;\n\nimport \"./C1.sol\";\nimport \"./Array.sol\";\nimport \"./Array2.sol\";\n\ncontract C2 is C1 {\n uint[] public arr;\n\n uint256 immutable public b = 10;\n uint256 immutable public c;\n\n constructor(uint256 _c) {\n c = _c;\n }\n\n function test_array() public {\n for (uint i = 0; i < 3; i++) {\n arr.push(i);\n }\n\n Array.remove(arr, 1);\n Array2.remove(arr, 1);\n\n assert(arr.length == 1);\n assert(arr[0] == 0);\n }\n}\n".into()), + ]), + metadata: serde_json::Value::from_str("{\"compiler\":{\"version\":\"0.8.7+commit.e28d00a7\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_c\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"a\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"arr\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"b\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"c\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"test_array\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/C2.sol\":\"C2\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"contracts/Array.sol\":{\"keccak256\":\"0xa3c043d47c03251f392e0dcdf7c2ad5069436cc72561b2404a195d84a78fb33c\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://9eeae2fe8bb3e5addd48dea0b8c5a81581b4137ad605b103b7edc35ea1ab2997\",\"dweb:/ipfs/QmRaC1FTQxkcWwmyZeZ4twQswdpcTnN5GQJ2Db7RMdf14j\"]},\"contracts/Array2.sol\":{\"keccak256\":\"0x6b5b4acc9b4f10f7df803702516752978c40cb4eadd48a218dcc0503fd7f4f88\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://6f9b39fbd016e6b0c62cb3a7d8abc8981fe383c345381dfd7533a8cb8a1ded69\",\"dweb:/ipfs/QmUznGnpnz1TFuQZzjDX4NzoVFsiwRzaA2T7gZQZUoFDim\"]},\"contracts/C1.sol\":{\"keccak256\":\"0x92ca0ef5999e6bae5556c90314c3b7fe3bf95cabf8423d8415ac3d3955f524df\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://1bb5f1bc39e5507da05e9d7700546f74896b47c4da076fbd744d8b6269c32a09\",\"dweb:/ipfs/QmRoabfGHHmoKTPb8vtdWFuaesoc4mUjzuSgEDE8TpeYwF\"]},\"contracts/C2.sol\":{\"keccak256\":\"0x20dd630583b88340fae8cda0a6008c0db058ee4b35d8a1f5a44bcd66ef892782\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://998e0420f165f61fec241b5fbd71f06bc150098c8981f0aeedbf5a95c240b2a0\",\"dweb:/ipfs/QmSG3mwV4zqk4NacHtf3MWSAbWW96sorEVjNBPJiWXs2LQ\"]}},\"version\":1}").unwrap(), + library_map: BTreeMap::from([ + ("__$b01ade520cf6862e0b214d4ce779d49f2a$__".to_string(), DisplayBytes::from_str("77479d54e233b4b79b9e3f4cf2bd20575fdeb1bb").unwrap().0), + ("__$21bb6923d223bd045c4cab9806bdf3594d$__".to_string(), DisplayBytes::from_str("4ea76bb37c82f6f453c4cbb4ae726036a7a8b820").unwrap().0), + ]), + constructor_arguments: None, + immutable_references: Some(serde_json::Value::from_str("{\"76\":[{\"length\":32,\"start\":242}],\"90\":[{\"length\":32,\"start\":636}],\"92\":[{\"length\":32,\"start\":708}]}").unwrap()), + raw_json: value.clone(), + }; + + check( + value, + expected, + Some("contract with library-map, immutable-details, several sources"), + ) + } +}