diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..77cc3a7 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "rust-analyzer.linkedProjects": ["./Cargo.toml", "./Cargo.toml"] +} diff --git a/Cargo.lock b/Cargo.lock index fdb78f6..41d06d9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -14,9 +14,9 @@ dependencies = [ [[package]] name = "RustQuant" -version = "0.0.35" +version = "0.0.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f49b833c14d1191d4d68563308c300aa9d071b34165cfa94330c6505019fcf8a" +checksum = "4a2929c11b9817836feee2a412e1f77c8ff10d9134e2b241b3fe93cccd6be358" dependencies = [ "nalgebra 0.32.3", "ndarray", @@ -60,6 +60,17 @@ dependencies = [ "cpufeatures", ] +[[package]] +name = "ahash" +version = "0.7.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a824f2aa7e75a0c98c5a504fceb80649e9c35265d44525b5f94de4771a395cd" +dependencies = [ + "getrandom", + "once_cell", + "version_check", +] + [[package]] name = "ahash" version = "0.8.6" @@ -143,6 +154,54 @@ dependencies = [ "libc", ] +[[package]] +name = "anstream" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ab91ebe16eb252986481c5b62f6098f3b698a45e34b5b98200cf20dd2484a44" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7079075b41f533b8c61d2a4d073c4676e1f8b249ff94a393b0595db304e0dd87" + +[[package]] +name = "anstyle-parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "317b9a89c1868f5ea6ff1d9539a69f45dffc21ce321ac1fd1160dfa48c8e2140" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b" +dependencies = [ + "windows-sys", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0699d10d2f4d628a98ee7b57b289abbc98ff3bad977cb3152709d4bf2330628" +dependencies = [ + "anstyle", + "windows-sys", +] + [[package]] name = "anyhow" version = "1.0.75" @@ -160,9 +219,9 @@ dependencies = [ [[package]] name = "arbiter-core" -version = "0.6.3" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25d40e109d3172460d0cb5ca64c588e8797ffb8d692d25d76020947caa975d17" +checksum = "ea6954f9669da3e9ecd38c2e7c6cd4f270f82b2973b27f720dff62620f848a2e" dependencies = [ "RustQuant", "async-trait", @@ -191,6 +250,9 @@ version = "0.1.0" dependencies = [ "anyhow", "arbiter-core", + "async-trait", + "clap", + "config", "ethers", "serde", "serde_json", @@ -566,6 +628,46 @@ dependencies = [ "libloading 0.7.4", ] +[[package]] +name = "clap" +version = "4.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac495e00dcec98c83465d5ad66c5c4fabd652fd6686e7c6269b117e729a6f17b" +dependencies = [ + "clap_builder", + "clap_derive", +] + +[[package]] +name = "clap_builder" +version = "4.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c77ed9a32a62e6ca27175d00d29d05ca32e396ea1eb5fb01d8256b669cec7663" +dependencies = [ + "anstream", + "anstyle", + "clap_lex", + "strsim", +] + +[[package]] +name = "clap_derive" +version = "4.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf9804afaaf59a91e75b022a30fb7229a7901f60c755489cc61c9b423b836442" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn 2.0.38", +] + +[[package]] +name = "clap_lex" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1" + [[package]] name = "cmake" version = "0.1.50" @@ -633,6 +735,31 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b" +[[package]] +name = "colorchoice" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" + +[[package]] +name = "config" +version = "0.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d379af7f68bfc21714c6c7dea883544201741d2ce8274bb12fa54f89507f52a7" +dependencies = [ + "async-trait", + "json5", + "lazy_static", + "nom", + "pathdiff", + "ron", + "rust-ini", + "serde", + "serde_json", + "toml 0.5.11", + "yaml-rust", +] + [[package]] name = "const-cstr" version = "0.3.0" @@ -641,13 +768,14 @@ checksum = "ed3d0b5ff30645a68f35ece8cea4556ca14ef8a1651455f789a099a0513532a6" [[package]] name = "const-hex" -version = "1.9.1" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c37be52ef5e3b394db27a2341010685ad5103c72ac15ce2e9420a7e8f93f342c" +checksum = "a5104de16b218eddf8e34ffe2f86f74bfa4e61e95a1b89732fccf6325efd0557" dependencies = [ "cfg-if", "cpufeatures", "hex", + "proptest", "serde", ] @@ -723,9 +851,9 @@ dependencies = [ [[package]] name = "cpufeatures" -version = "0.2.10" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fbc60abd742b35f2492f808e1abbb83d45f72db402e14c55057edc9c7b1e9e4" +checksum = "ce420fe07aecd3e67c5f910618fe65e94158f6dcc0adf44e00d69ce2bdfe0fd0" dependencies = [ "libc", ] @@ -926,6 +1054,12 @@ dependencies = [ "libloading 0.8.1", ] +[[package]] +name = "dlv-list" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0688c2a7f92e427f44895cd63841bff7b29f8d7a1648b9e7e07a4a365b2e1257" + [[package]] name = "dunce" version = "1.0.4" @@ -1183,7 +1317,7 @@ dependencies = [ "serde", "serde_json", "syn 2.0.38", - "toml", + "toml 0.7.8", "walkdir", ] @@ -1381,9 +1515,9 @@ checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" [[package]] name = "fdeflate" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d329bdeac514ee06249dabc27877490f17f5d371ec693360768b838e19f3ae10" +checksum = "64d6dafc854908ff5da46ff3f8f473c6984119a2876a383a860246dd7841a868" dependencies = [ "simd-adler32", ] @@ -1526,9 +1660,9 @@ checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" [[package]] name = "futures" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23342abe12aba583913b2e62f22225ff9c950774065e4bfb61a19cd9770fec40" +checksum = "da0290714b38af9b4a7b094b8a37086d1b4e61f2df9122c3cad2577669145335" dependencies = [ "futures-channel", "futures-core", @@ -1541,9 +1675,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2" +checksum = "ff4dd66668b557604244583e3e1e1eada8c5c2e96a6d0d6653ede395b78bbacb" dependencies = [ "futures-core", "futures-sink", @@ -1551,15 +1685,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c" +checksum = "eb1d22c66e66d9d72e1758f0bd7d4fd0bee04cad842ee34587d68c07e45d088c" [[package]] name = "futures-executor" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccecee823288125bd88b4d7f565c9e58e41858e47ab72e8ea2d64e93624386e0" +checksum = "0f4fb8693db0cf099eadcca0efe2a5a22e4550f98ed16aba6c48700da29597bc" dependencies = [ "futures-core", "futures-task", @@ -1568,9 +1702,9 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964" +checksum = "8bf34a163b5c4c52d0478a4d757da8fb65cabef42ba90515efee0f6f9fa45aaa" [[package]] name = "futures-locks" @@ -1585,9 +1719,9 @@ dependencies = [ [[package]] name = "futures-macro" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" +checksum = "53b153fd91e4b0147f4aced87be237c98248656bb01050b96bf3ee89220a8ddb" dependencies = [ "proc-macro2", "quote", @@ -1596,15 +1730,15 @@ dependencies = [ [[package]] name = "futures-sink" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f43be4fe21a13b9781a69afa4985b0f6ee0e1afab2c6f454a8cf30e2b2237b6e" +checksum = "e36d3378ee38c2a36ad710c5d30c2911d752cb941c00c72dbabfb786a7970817" [[package]] name = "futures-task" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65" +checksum = "efd193069b0ddadc69c46389b740bbccdd97203899b48d09c5f7969591d6bae2" [[package]] name = "futures-timer" @@ -1618,9 +1752,9 @@ dependencies = [ [[package]] name = "futures-util" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533" +checksum = "a19526d624e703a3179b3d322efec918b6246ea0fa51d41124525f00f1cc8104" dependencies = [ "futures-channel", "futures-core", @@ -1734,6 +1868,9 @@ name = "hashbrown" version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" +dependencies = [ + "ahash 0.7.7", +] [[package]] name = "hashbrown" @@ -1741,7 +1878,7 @@ version = "0.14.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f93e7192158dbcda357bdec5fb5788eebf8bbac027f3f33e719d29135ae84156" dependencies = [ - "ahash", + "ahash 0.8.6", "allocator-api2", "serde", ] @@ -1860,9 +1997,9 @@ dependencies = [ [[package]] name = "hyper-rustls" -version = "0.24.1" +version = "0.24.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d78e1e73ec14cf7375674f74d7dde185c8206fd9dea6fb6295e8a98098aaa97" +checksum = "ec3efd23720e2049821a693cbc7e65ea87c72f1c58ff2f9522ff332b1491e590" dependencies = [ "futures-util", "http", @@ -1976,9 +2113,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.0.2" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8adf3ddd720272c6ea8bf59463c04e0f93d0bbf7c5439b691bca2987e0270897" +checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f" dependencies = [ "equivalent", "hashbrown 0.14.2", @@ -2060,13 +2197,24 @@ checksum = "bc0000e42512c92e31c2252315bda326620a4e034105e900c98ec492fa077b3e" [[package]] name = "js-sys" -version = "0.3.64" +version = "0.3.65" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a" +checksum = "54c0c35952f67de54bb584e9fd912b3023117cbafc0a77d8f3dee1fb5f572fe8" dependencies = [ "wasm-bindgen", ] +[[package]] +name = "json5" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96b0db21af676c1ce64250b5f40f3ce2cf27e4e47cb91ed91eb6fe9350b430c1" +dependencies = [ + "pest", + "pest_derive", + "serde", +] + [[package]] name = "jsonwebtoken" version = "8.3.0" @@ -2179,6 +2327,12 @@ version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" +[[package]] +name = "linked-hash-map" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" + [[package]] name = "linux-raw-sys" version = "0.4.10" @@ -2443,20 +2597,20 @@ dependencies = [ [[package]] name = "num_enum" -version = "0.7.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70bf6736f74634d299d00086f02986875b3c2d924781a6a2cb6c201e73da0ceb" +checksum = "683751d591e6d81200c39fb0d1032608b77724f34114db54f571ff1317b337c0" dependencies = [ "num_enum_derive", ] [[package]] name = "num_enum_derive" -version = "0.7.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56ea360eafe1022f7cc56cd7b869ed57330fb2453d0c7831d99b74c65d2f5597" +checksum = "6c11e44798ad209ccdd91fc192f0526a369a01234f7373e1b141c96d7cee4f0e" dependencies = [ - "proc-macro-crate", + "proc-macro-crate 2.0.0", "proc-macro2", "quote", "syn 2.0.38", @@ -2508,6 +2662,16 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" +[[package]] +name = "ordered-multimap" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccd746e37177e1711c20dd619a1620f34f5c8b569c53590a72dedd5344d8924a" +dependencies = [ + "dlv-list", + "hashbrown 0.12.3", +] + [[package]] name = "parity-scale-codec" version = "3.6.5" @@ -2528,7 +2692,7 @@ version = "3.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "312270ee71e1cd70289dacf597cab7b207aa107d2f28191c2ae45b2ece18a260" dependencies = [ - "proc-macro-crate", + "proc-macro-crate 1.3.1", "proc-macro2", "quote", "syn 1.0.109", @@ -2580,6 +2744,12 @@ 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 = "pathfinder_geometry" version = "0.5.1" @@ -2642,6 +2812,51 @@ version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" +[[package]] +name = "pest" +version = "2.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae9cee2a55a544be8b89dc6848072af97a20f2422603c10865be2a42b580fff5" +dependencies = [ + "memchr", + "thiserror", + "ucd-trie", +] + +[[package]] +name = "pest_derive" +version = "2.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81d78524685f5ef2a3b3bd1cafbc9fcabb036253d9b1463e726a91cd16e2dfc2" +dependencies = [ + "pest", + "pest_generator", +] + +[[package]] +name = "pest_generator" +version = "2.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68bd1206e71118b5356dae5ddc61c8b11e28b09ef6a31acbd15ea48a28e0c227" +dependencies = [ + "pest", + "pest_meta", + "proc-macro2", + "quote", + "syn 2.0.38", +] + +[[package]] +name = "pest_meta" +version = "2.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c747191d4ad9e4a4ab9c8798f1e82a39affe7ef9648390b7e5548d18e099de6" +dependencies = [ + "once_cell", + "pest", + "sha2", +] + [[package]] name = "petgraph" version = "0.6.4" @@ -2649,7 +2864,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e1d3afd2628e69da2be385eb6f2fd57c8ac7977ceeff6dc166ff1657b0e386a9" dependencies = [ "fixedbitset", - "indexmap 2.0.2", + "indexmap 2.1.0", ] [[package]] @@ -2869,7 +3084,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919" dependencies = [ "once_cell", - "toml_edit", + "toml_edit 0.19.15", +] + +[[package]] +name = "proc-macro-crate" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e8366a6159044a37876a2b9817124296703c586a5c92e2c53751fa06d8d43e8" +dependencies = [ + "toml_edit 0.20.7", ] [[package]] @@ -2912,10 +3136,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7c003ac8c77cb07bb74f5f198bce836a689bcd5a42574612bf14d17bfd08c20e" dependencies = [ "bitflags 2.4.1", + "lazy_static", "num-traits", "rand", "rand_chacha", "rand_xorshift", + "regex-syntax 0.7.5", "unarray", ] @@ -3018,15 +3244,6 @@ dependencies = [ "bitflags 1.3.2", ] -[[package]] -name = "redox_syscall" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" -dependencies = [ - "bitflags 1.3.2", -] - [[package]] name = "redox_syscall" version = "0.4.1" @@ -3251,11 +3468,22 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "ron" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88073939a61e5b7680558e6be56b419e208420c2adb92be54921fa6b72283f1a" +dependencies = [ + "base64 0.13.1", + "bitflags 1.3.2", + "serde", +] + [[package]] name = "ruint" -version = "1.10.1" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95294d6e3a6192f3aabf91c38f56505a625aa495533442744185a36d75a790c4" +checksum = "724fd11728a3804e9944b14cab63825024c40bf42f8af87c8b5d97c4bbacf426" dependencies = [ "alloy-rlp", "proptest", @@ -3272,6 +3500,16 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e666a5496a0b2186dbcd0ff6106e29e093c15591bde62c20d3842007c6978a09" +[[package]] +name = "rust-ini" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6d5f2436026b4f6e79dc829837d467cc7e9a55ee40e750d716713540715a2df" +dependencies = [ + "cfg-if", + "ordered-multimap", +] + [[package]] name = "rustc-demangle" version = "0.1.23" @@ -3301,9 +3539,9 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.20" +version = "0.38.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67ce50cb2e16c2903e30d1cbccfd8387a74b9d4c938b6a4c5ec6cc7556f7a8a0" +checksum = "2b426b0506e5d50a7d8dafcf2e81471400deb602392c7dd110815afb4eaf02a3" dependencies = [ "bitflags 2.4.1", "errno", @@ -3400,7 +3638,7 @@ version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "abf2c68b89cafb3b8d918dd07b42be0da66ff202cf1155c5739a4e0c1ea0dc19" dependencies = [ - "proc-macro-crate", + "proc-macro-crate 1.3.1", "proc-macro2", "quote", "syn 1.0.109", @@ -3489,18 +3727,18 @@ checksum = "cd0b0ec5f1c1ca621c432a25813d8d60c88abe6d3e08a3eb9cf37d97a0fe3d73" [[package]] name = "serde" -version = "1.0.189" +version = "1.0.190" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e422a44e74ad4001bdc8eede9a4570ab52f71190e9c076d14369f38b9200537" +checksum = "91d3c334ca1ee894a2c6f6ad698fe8c435b76d504b13d436f0685d648d6d96f7" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.189" +version = "1.0.190" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e48d1f918009ce3145511378cf68d613e3b3d9137d67272562080d68a2b32d5" +checksum = "67c5609f394e5c2bd7fc51efda478004ea80ef42fee983d5c67a65e34f32c0e3" dependencies = [ "proc-macro2", "quote", @@ -3513,7 +3751,7 @@ version = "1.0.107" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6b420ce6e3d8bd882e9b243c6eed35dbc9a6110c9769e74b584e0d68d1f20c65" dependencies = [ - "indexmap 2.0.2", + "indexmap 2.1.0", "itoa", "ryu", "serde", @@ -3759,6 +3997,12 @@ dependencies = [ "precomputed-hash", ] +[[package]] +name = "strsim" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" + [[package]] name = "strum" version = "0.25.0" @@ -3802,9 +4046,9 @@ checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" [[package]] name = "svm-rs" -version = "0.3.0" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "597e3a746727984cb7ea2487b6a40726cad0dbe86628e7d429aa6b8c4c153db4" +checksum = "d0cc95be7cc2c384a2f57cac56548d2178650905ebe5725bc8970ccc25529060" dependencies = [ "dirs", "fs2", @@ -3871,13 +4115,13 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] name = "tempfile" -version = "3.8.0" +version = "3.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb94d2f3cc536af71caac6b6fcebf65860b347e7ce0cc9ebe8f70d3e521054ef" +checksum = "7ef1adac450ad7f4b3c28589471ade84f25f731a7a0fe30d71dfa9f60fd808e5" dependencies = [ "cfg-if", "fastrand", - "redox_syscall 0.3.5", + "redox_syscall 0.4.1", "rustix", "windows-sys", ] @@ -4044,6 +4288,15 @@ dependencies = [ "tracing", ] +[[package]] +name = "toml" +version = "0.5.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" +dependencies = [ + "serde", +] + [[package]] name = "toml" version = "0.7.8" @@ -4053,7 +4306,7 @@ dependencies = [ "serde", "serde_spanned", "toml_datetime", - "toml_edit", + "toml_edit 0.19.15", ] [[package]] @@ -4071,13 +4324,24 @@ version = "0.19.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" dependencies = [ - "indexmap 2.0.2", + "indexmap 2.1.0", "serde", "serde_spanned", "toml_datetime", "winnow", ] +[[package]] +name = "toml_edit" +version = "0.20.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70f427fce4d84c72b5b732388bf4a9f4531b53f74e2887e3ecb2481f68f66d81" +dependencies = [ + "indexmap 2.1.0", + "toml_datetime", + "winnow", +] + [[package]] name = "tower-service" version = "0.3.2" @@ -4163,6 +4427,12 @@ version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" +[[package]] +name = "ucd-trie" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed646292ffc8188ef8ea4d1e0e0150fb15a5c2e12ad9b8fc191ae7a8a7f3c4b9" + [[package]] name = "uint" version = "0.9.5" @@ -4237,6 +4507,12 @@ version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" +[[package]] +name = "utf8parse" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" + [[package]] name = "uuid" version = "0.8.2" @@ -4286,9 +4562,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.87" +version = "0.2.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342" +checksum = "7daec296f25a1bae309c0cd5c29c4b260e510e6d813c286b19eaadf409d40fce" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -4296,9 +4572,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.87" +version = "0.2.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd" +checksum = "e397f4664c0e4e428e8313a469aaa58310d302159845980fd23b0f22a847f217" dependencies = [ "bumpalo", "log", @@ -4311,9 +4587,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.37" +version = "0.4.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c02dbc21516f9f1f04f187958890d7e6026df8d16540b7ad9492bc34a67cea03" +checksum = "9afec9963e3d0994cac82455b2b3502b81a7f40f9a0d32181f7528d9f4b43e02" dependencies = [ "cfg-if", "js-sys", @@ -4323,9 +4599,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.87" +version = "0.2.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d" +checksum = "5961017b3b08ad5f3fe39f1e79877f8ee7c23c5e5fd5eb80de95abc41f1f16b2" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -4333,9 +4609,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.87" +version = "0.2.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" +checksum = "c5353b8dab669f5e10f5bd76df26a9360c748f054f862ff5f3f8aae0c7fb3907" dependencies = [ "proc-macro2", "quote", @@ -4346,15 +4622,15 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.87" +version = "0.2.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" +checksum = "0d046c5d029ba91a1ed14da14dca44b68bf2f124cfbaf741c54151fdb3e0750b" [[package]] name = "web-sys" -version = "0.3.64" +version = "0.3.65" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b" +checksum = "5db499c5f66323272151db0e666cd34f78617522fb0c1604d31a27c50c206a85" dependencies = [ "js-sys", "wasm-bindgen", @@ -4502,9 +4778,9 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "winnow" -version = "0.5.17" +version = "0.5.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3b801d0e0a6726477cc207f60162da452f3a95adb368399bef20a946e06f65c" +checksum = "176b6138793677221d420fd2f0aeeced263f197688b36484660da767bca2fa32" dependencies = [ "memchr", ] @@ -4556,6 +4832,15 @@ dependencies = [ "tap", ] +[[package]] +name = "yaml-rust" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85" +dependencies = [ + "linked-hash-map", +] + [[package]] name = "yansi" version = "0.5.1" @@ -4576,18 +4861,18 @@ dependencies = [ [[package]] name = "zerocopy" -version = "0.7.15" +version = "0.7.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81ba595b9f2772fbee2312de30eeb80ec773b4cb2f1e8098db024afadda6c06f" +checksum = "686b7e407015242119c33dab17b8f61ba6843534de936d94368856528eae4dcc" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.7.15" +version = "0.7.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "772666c41fb6dceaf520b564b962d738a8e1a83b41bd48945f50837aed78bb1d" +checksum = "020f3dfe25dfc38dfea49ce62d5d45ecdd7f0d8a724fa63eb36b6eba4ec76806" dependencies = [ "proc-macro2", "quote", diff --git a/Cargo.toml b/Cargo.toml index 8afe08f..0eb04ce 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,9 +4,13 @@ version = "0.1.0" edition = "2021" [dependencies] -arbiter-core = { version = "0.6.3", features = ["contracts"] } +arbiter-core = { version = "0.7.0", features = ["contracts"] } tokio = { version = "1.33.0", features = ["full"] } ethers = { version = "2.0.10" } serde_json = { version = "1.0.107" } serde = { version = "1.0.189", features = ["derive"] } anyhow = { version = "1.0.75" } +async-trait = "0.1.74" +config = "0.13.3" +clap = { version = "4.4.6", features = ["derive"] } + diff --git a/contracts/Counter.sol b/contracts/Counter.sol index aded799..f18f8af 100644 --- a/contracts/Counter.sol +++ b/contracts/Counter.sol @@ -4,11 +4,14 @@ pragma solidity ^0.8.13; contract Counter { uint256 public number; + event Incremented(uint256 number); + function setNumber(uint256 newNumber) public { number = newNumber; } function increment() public { number++; + emit Incremented(number); } } diff --git a/fork_example/WETH.json b/fork_example/WETH.json deleted file mode 100644 index 6051219..0000000 --- a/fork_example/WETH.json +++ /dev/null @@ -1,1901 +0,0 @@ -{ - "abi": [ - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "Deposit", - "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": "amount", - "type": "uint256" - } - ], - "name": "Transfer", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "Withdrawal", - "type": "event" - }, - { - "inputs": [], - "name": "DOMAIN_SEPARATOR", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "address", - "name": "", - "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": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "decimals", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "deposit", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [], - "name": "name", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "nonces", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - }, - { - "internalType": "uint8", - "name": "v", - "type": "uint8" - }, - { - "internalType": "bytes32", - "name": "r", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "s", - "type": "bytes32" - } - ], - "name": "permit", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "symbol", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "transfer", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "transferFrom", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "withdraw", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "stateMutability": "payable", - "type": "receive" - } - ], - "bytecode": { - "object": "0x60e06040523480156200001157600080fd5b506040518060400160405280600d81526020016c2bb930b83832b21022ba3432b960991b815250604051806040016040528060048152602001630ae8aa8960e31b81525060128260009081620000689190620001db565b506001620000778382620001db565b5060ff81166080524660a0526200008d6200009a565b60c0525062000325915050565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6000604051620000ce9190620002a7565b6040805191829003822060208301939093528101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a082015260c00160405160208183030381529060405280519060200120905090565b634e487b7160e01b600052604160045260246000fd5b600181811c908216806200016157607f821691505b6020821081036200018257634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115620001d657600081815260208120601f850160051c81016020861015620001b15750805b601f850160051c820191505b81811015620001d257828155600101620001bd565b5050505b505050565b81516001600160401b03811115620001f757620001f762000136565b6200020f816200020884546200014c565b8462000188565b602080601f8311600181146200024757600084156200022e5750858301515b600019600386901b1c1916600185901b178555620001d2565b600085815260208120601f198616915b82811015620002785788860151825594840194600190910190840162000257565b5085821015620002975787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6000808354620002b7816200014c565b60018281168015620002d25760018114620002e85762000319565b60ff198416875282151583028701945062000319565b8760005260208060002060005b85811015620003105781548a820152908401908201620002f5565b50505082870194505b50929695505050505050565b60805160a05160c051610d4562000355600039600061059f0152600061056a015260006101c60152610d456000f3fe6080604052600436106100e15760003560e01c806370a082311161007f578063a9059cbb11610059578063a9059cbb1461027e578063d0e30db01461029e578063d505accf146102a6578063dd62ed3e146102c657600080fd5b806370a082311461020f5780637ecebe001461023c57806395d89b411461026957600080fd5b806323b872dd116100bb57806323b872dd146101745780632e1a7d4d14610194578063313ce567146101b45780633644e515146101fa57600080fd5b806306fdde03146100f5578063095ea7b31461012057806318160ddd1461015057600080fd5b366100f0576100ee6102fe565b005b600080fd5b34801561010157600080fd5b5061010a61033f565b6040516101179190610a29565b60405180910390f35b34801561012c57600080fd5b5061014061013b366004610a93565b6103cd565b6040519015158152602001610117565b34801561015c57600080fd5b5061016660025481565b604051908152602001610117565b34801561018057600080fd5b5061014061018f366004610abd565b61043a565b3480156101a057600080fd5b506100ee6101af366004610af9565b61051a565b3480156101c057600080fd5b506101e87f000000000000000000000000000000000000000000000000000000000000000081565b60405160ff9091168152602001610117565b34801561020657600080fd5b50610166610566565b34801561021b57600080fd5b5061016661022a366004610b12565b60036020526000908152604090205481565b34801561024857600080fd5b50610166610257366004610b12565b60056020526000908152604090205481565b34801561027557600080fd5b5061010a6105c1565b34801561028a57600080fd5b50610140610299366004610a93565b6105ce565b6100ee6102fe565b3480156102b257600080fd5b506100ee6102c1366004610b34565b610634565b3480156102d257600080fd5b506101666102e1366004610ba7565b600460209081526000928352604080842090915290825290205481565b610308333461087d565b60405134815233907fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c9060200160405180910390a2565b6000805461034c90610bda565b80601f016020809104026020016040519081016040528092919081815260200182805461037890610bda565b80156103c55780601f1061039a576101008083540402835291602001916103c5565b820191906000526020600020905b8154815290600101906020018083116103a857829003601f168201915b505050505081565b3360008181526004602090815260408083206001600160a01b038716808552925280832085905551919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906104289086815260200190565b60405180910390a35060015b92915050565b6001600160a01b03831660009081526004602090815260408083203384529091528120546000198114610496576104718382610c2a565b6001600160a01b03861660009081526004602090815260408083203384529091529020555b6001600160a01b038516600090815260036020526040812080548592906104be908490610c2a565b90915550506001600160a01b0380851660008181526003602052604090819020805487019055519091871690600080516020610cf0833981519152906105079087815260200190565b60405180910390a3506001949350505050565b61052433826108d7565b60405181815233907f7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b659060200160405180910390a26105633382610939565b50565b60007f0000000000000000000000000000000000000000000000000000000000000000461461059c5761059761098f565b905090565b507f000000000000000000000000000000000000000000000000000000000000000090565b6001805461034c90610bda565b336000908152600360205260408120805483919083906105ef908490610c2a565b90915550506001600160a01b03831660008181526003602052604090819020805485019055513390600080516020610cf0833981519152906104289086815260200190565b428410156106895760405162461bcd60e51b815260206004820152601760248201527f5045524d49545f444541444c494e455f4558504952454400000000000000000060448201526064015b60405180910390fd5b60006001610695610566565b6001600160a01b038a811660008181526005602090815260409182902080546001810190915582517f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98184015280840194909452938d166060840152608083018c905260a083019390935260c08083018b90528151808403909101815260e08301909152805192019190912061190160f01b6101008301526101028201929092526101228101919091526101420160408051601f198184030181528282528051602091820120600084529083018083525260ff871690820152606081018590526080810184905260a0016020604051602081039080840390855afa1580156107a1573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116158015906107d75750876001600160a01b0316816001600160a01b0316145b6108145760405162461bcd60e51b815260206004820152600e60248201526d24a72b20a624a22fa9a4a3a722a960911b6044820152606401610680565b6001600160a01b0390811660009081526004602090815260408083208a8516808552908352928190208990555188815291928a16917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a350505050505050565b806002600082825461088f9190610c3d565b90915550506001600160a01b038216600081815260036020908152604080832080548601905551848152600080516020610cf083398151915291015b60405180910390a35050565b6001600160a01b038216600090815260036020526040812080548392906108ff908490610c2a565b90915550506002805482900390556040518181526000906001600160a01b03841690600080516020610cf0833981519152906020016108cb565b600080600080600085875af190508061098a5760405162461bcd60e51b815260206004820152601360248201527211551217d514905394d1915497d19052531151606a1b6044820152606401610680565b505050565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60006040516109c19190610c50565b6040805191829003822060208301939093528101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a082015260c00160405160208183030381529060405280519060200120905090565b600060208083528351808285015260005b81811015610a5657858101830151858201604001528201610a3a565b506000604082860101526040601f19601f8301168501019250505092915050565b80356001600160a01b0381168114610a8e57600080fd5b919050565b60008060408385031215610aa657600080fd5b610aaf83610a77565b946020939093013593505050565b600080600060608486031215610ad257600080fd5b610adb84610a77565b9250610ae960208501610a77565b9150604084013590509250925092565b600060208284031215610b0b57600080fd5b5035919050565b600060208284031215610b2457600080fd5b610b2d82610a77565b9392505050565b600080600080600080600060e0888a031215610b4f57600080fd5b610b5888610a77565b9650610b6660208901610a77565b95506040880135945060608801359350608088013560ff81168114610b8a57600080fd5b9699959850939692959460a0840135945060c09093013592915050565b60008060408385031215610bba57600080fd5b610bc383610a77565b9150610bd160208401610a77565b90509250929050565b600181811c90821680610bee57607f821691505b602082108103610c0e57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b8181038181111561043457610434610c14565b8082018082111561043457610434610c14565b600080835481600182811c915080831680610c6c57607f831692505b60208084108203610c8b57634e487b7160e01b86526022600452602486fd5b818015610c9f5760018114610cb457610ce1565b60ff1986168952841515850289019650610ce1565b60008a81526020902060005b86811015610cd95781548b820152908501908301610cc0565b505084890196505b50949897505050505050505056feddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa26469706673582212205c31d86073784b1e39f51e9dce54214cc16270f1d510098b81351fb2f55bab8864736f6c63430008130033", - "sourceMap": "406:605:4:-:0;;;;;;;;;;;;;1968:292:2;;;;;;;;;;;;;-1:-1:-1;;;1968:292:2;;;;;;;;;;;;;;;;-1:-1:-1;;;1968:292:2;;;454:2:4;2088:5:2;2081:4;:12;;;;;;:::i;:::-;-1:-1:-1;2103:6:2;:16;2112:7;2103:6;:16;:::i;:::-;-1:-1:-1;2129:20:2;;;;;2179:13;2160:32;;2229:24;:22;:24::i;:::-;2202:51;;-1:-1:-1;406:605:4;;-1:-1:-1;;406:605:4;5497:446:2;5562:7;5659:95;5792:4;5776:22;;;;;;:::i;:::-;;;;;;;;;;5627:295;;;3843:25:6;;;;3884:18;;3877:34;;;;5820:14:2;3927:18:6;;;3920:34;5856:13:2;3970:18:6;;;3963:34;5899:4:2;4013:19:6;;;4006:61;3815:19;;5627:295:2;;;;;;;;;;;;5600:336;;;;;;5581:355;;5497:446;:::o;14:127:6:-;75:10;70:3;66:20;63:1;56:31;106:4;103:1;96:15;130:4;127:1;120:15;146:380;225:1;221:12;;;;268;;;289:61;;343:4;335:6;331:17;321:27;;289:61;396:2;388:6;385:14;365:18;362:38;359:161;;442:10;437:3;433:20;430:1;423:31;477:4;474:1;467:15;505:4;502:1;495:15;359:161;;146:380;;;:::o;657:545::-;759:2;754:3;751:11;748:448;;;795:1;820:5;816:2;809:17;865:4;861:2;851:19;935:2;923:10;919:19;916:1;912:27;906:4;902:38;971:4;959:10;956:20;953:47;;;-1:-1:-1;994:4:6;953:47;1049:2;1044:3;1040:12;1037:1;1033:20;1027:4;1023:31;1013:41;;1104:82;1122:2;1115:5;1112:13;1104:82;;;1167:17;;;1148:1;1137:13;1104:82;;;1108:3;;;748:448;657:545;;;:::o;1378:1352::-;1498:10;;-1:-1:-1;;;;;1520:30:6;;1517:56;;;1553:18;;:::i;:::-;1582:97;1672:6;1632:38;1664:4;1658:11;1632:38;:::i;:::-;1626:4;1582:97;:::i;:::-;1734:4;;1798:2;1787:14;;1815:1;1810:663;;;;2517:1;2534:6;2531:89;;;-1:-1:-1;2586:19:6;;;2580:26;2531:89;-1:-1:-1;;1335:1:6;1331:11;;;1327:24;1323:29;1313:40;1359:1;1355:11;;;1310:57;2633:81;;1780:944;;1810:663;604:1;597:14;;;641:4;628:18;;-1:-1:-1;;1846:20:6;;;1964:236;1978:7;1975:1;1972:14;1964:236;;;2067:19;;;2061:26;2046:42;;2159:27;;;;2127:1;2115:14;;;;1994:19;;1964:236;;;1968:3;2228:6;2219:7;2216:19;2213:201;;;2289:19;;;2283:26;-1:-1:-1;;2372:1:6;2368:14;;;2384:3;2364:24;2360:37;2356:42;2341:58;2326:74;;2213:201;-1:-1:-1;;;;;2460:1:6;2444:14;;;2440:22;2427:36;;-1:-1:-1;1378:1352:6:o;2735:844::-;2865:3;2894:1;2927:6;2921:13;2957:36;2983:9;2957:36;:::i;:::-;3012:1;3029:18;;;3056:133;;;;3203:1;3198:356;;;;3022:532;;3056:133;-1:-1:-1;;3089:24:6;;3077:37;;3162:14;;3155:22;3143:35;;3134:45;;;-1:-1:-1;3056:133:6;;3198:356;3229:6;3226:1;3219:17;3259:4;3304:2;3301:1;3291:16;3329:1;3343:165;3357:6;3354:1;3351:13;3343:165;;;3435:14;;3422:11;;;3415:35;3478:16;;;;3372:10;;3343:165;;;3347:3;;;3537:6;3532:3;3528:16;3521:23;;3022:532;-1:-1:-1;3570:3:6;;2735:844;-1:-1:-1;;;;;;2735:844:6:o;3584:489::-;406:605:4;;;;;;;;;;;;;;;;;;;;;;;;", - "linkReferences": {} - }, - "deployedBytecode": { - "object": "0x6080604052600436106100e15760003560e01c806370a082311161007f578063a9059cbb11610059578063a9059cbb1461027e578063d0e30db01461029e578063d505accf146102a6578063dd62ed3e146102c657600080fd5b806370a082311461020f5780637ecebe001461023c57806395d89b411461026957600080fd5b806323b872dd116100bb57806323b872dd146101745780632e1a7d4d14610194578063313ce567146101b45780633644e515146101fa57600080fd5b806306fdde03146100f5578063095ea7b31461012057806318160ddd1461015057600080fd5b366100f0576100ee6102fe565b005b600080fd5b34801561010157600080fd5b5061010a61033f565b6040516101179190610a29565b60405180910390f35b34801561012c57600080fd5b5061014061013b366004610a93565b6103cd565b6040519015158152602001610117565b34801561015c57600080fd5b5061016660025481565b604051908152602001610117565b34801561018057600080fd5b5061014061018f366004610abd565b61043a565b3480156101a057600080fd5b506100ee6101af366004610af9565b61051a565b3480156101c057600080fd5b506101e87f000000000000000000000000000000000000000000000000000000000000000081565b60405160ff9091168152602001610117565b34801561020657600080fd5b50610166610566565b34801561021b57600080fd5b5061016661022a366004610b12565b60036020526000908152604090205481565b34801561024857600080fd5b50610166610257366004610b12565b60056020526000908152604090205481565b34801561027557600080fd5b5061010a6105c1565b34801561028a57600080fd5b50610140610299366004610a93565b6105ce565b6100ee6102fe565b3480156102b257600080fd5b506100ee6102c1366004610b34565b610634565b3480156102d257600080fd5b506101666102e1366004610ba7565b600460209081526000928352604080842090915290825290205481565b610308333461087d565b60405134815233907fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c9060200160405180910390a2565b6000805461034c90610bda565b80601f016020809104026020016040519081016040528092919081815260200182805461037890610bda565b80156103c55780601f1061039a576101008083540402835291602001916103c5565b820191906000526020600020905b8154815290600101906020018083116103a857829003601f168201915b505050505081565b3360008181526004602090815260408083206001600160a01b038716808552925280832085905551919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906104289086815260200190565b60405180910390a35060015b92915050565b6001600160a01b03831660009081526004602090815260408083203384529091528120546000198114610496576104718382610c2a565b6001600160a01b03861660009081526004602090815260408083203384529091529020555b6001600160a01b038516600090815260036020526040812080548592906104be908490610c2a565b90915550506001600160a01b0380851660008181526003602052604090819020805487019055519091871690600080516020610cf0833981519152906105079087815260200190565b60405180910390a3506001949350505050565b61052433826108d7565b60405181815233907f7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b659060200160405180910390a26105633382610939565b50565b60007f0000000000000000000000000000000000000000000000000000000000000000461461059c5761059761098f565b905090565b507f000000000000000000000000000000000000000000000000000000000000000090565b6001805461034c90610bda565b336000908152600360205260408120805483919083906105ef908490610c2a565b90915550506001600160a01b03831660008181526003602052604090819020805485019055513390600080516020610cf0833981519152906104289086815260200190565b428410156106895760405162461bcd60e51b815260206004820152601760248201527f5045524d49545f444541444c494e455f4558504952454400000000000000000060448201526064015b60405180910390fd5b60006001610695610566565b6001600160a01b038a811660008181526005602090815260409182902080546001810190915582517f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98184015280840194909452938d166060840152608083018c905260a083019390935260c08083018b90528151808403909101815260e08301909152805192019190912061190160f01b6101008301526101028201929092526101228101919091526101420160408051601f198184030181528282528051602091820120600084529083018083525260ff871690820152606081018590526080810184905260a0016020604051602081039080840390855afa1580156107a1573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116158015906107d75750876001600160a01b0316816001600160a01b0316145b6108145760405162461bcd60e51b815260206004820152600e60248201526d24a72b20a624a22fa9a4a3a722a960911b6044820152606401610680565b6001600160a01b0390811660009081526004602090815260408083208a8516808552908352928190208990555188815291928a16917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a350505050505050565b806002600082825461088f9190610c3d565b90915550506001600160a01b038216600081815260036020908152604080832080548601905551848152600080516020610cf083398151915291015b60405180910390a35050565b6001600160a01b038216600090815260036020526040812080548392906108ff908490610c2a565b90915550506002805482900390556040518181526000906001600160a01b03841690600080516020610cf0833981519152906020016108cb565b600080600080600085875af190508061098a5760405162461bcd60e51b815260206004820152601360248201527211551217d514905394d1915497d19052531151606a1b6044820152606401610680565b505050565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60006040516109c19190610c50565b6040805191829003822060208301939093528101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a082015260c00160405160208183030381529060405280519060200120905090565b600060208083528351808285015260005b81811015610a5657858101830151858201604001528201610a3a565b506000604082860101526040601f19601f8301168501019250505092915050565b80356001600160a01b0381168114610a8e57600080fd5b919050565b60008060408385031215610aa657600080fd5b610aaf83610a77565b946020939093013593505050565b600080600060608486031215610ad257600080fd5b610adb84610a77565b9250610ae960208501610a77565b9150604084013590509250925092565b600060208284031215610b0b57600080fd5b5035919050565b600060208284031215610b2457600080fd5b610b2d82610a77565b9392505050565b600080600080600080600060e0888a031215610b4f57600080fd5b610b5888610a77565b9650610b6660208901610a77565b95506040880135945060608801359350608088013560ff81168114610b8a57600080fd5b9699959850939692959460a0840135945060c09093013592915050565b60008060408385031215610bba57600080fd5b610bc383610a77565b9150610bd160208401610a77565b90509250929050565b600181811c90821680610bee57607f821691505b602082108103610c0e57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b8181038181111561043457610434610c14565b8082018082111561043457610434610c14565b600080835481600182811c915080831680610c6c57607f831692505b60208084108203610c8b57634e487b7160e01b86526022600452602486fd5b818015610c9f5760018114610cb457610ce1565b60ff1986168952841515850289019650610ce1565b60008a81526020902060005b86811015610cd95781548b820152908501908301610cc0565b505084890196505b50949897505050505050505056feddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa26469706673582212205c31d86073784b1e39f51e9dce54214cc16270f1d510098b81351fb2f55bab8864736f6c63430008130033", - "sourceMap": "406:605:4:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;993:9;:7;:9::i;:::-;406:605;;;;;1018:18:2;;;;;;;;;;;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;2448:211;;;;;;;;;;-1:-1:-1;2448:211:2;;;;;:::i;:::-;;:::i;:::-;;;1169:14:6;;1162:22;1144:41;;1132:2;1117:18;2448:211:2;1004:187:6;1291:26:2;;;;;;;;;;;;;;;;;;;1342:25:6;;;1330:2;1315:18;1291:26:2;1196:177:6;3044:592:2;;;;;;;;;;-1:-1:-1;3044:592:2;;;;;:::i;:::-;;:::i;760:182:4:-;;;;;;;;;;-1:-1:-1;760:182:4;;;;;:::i;:::-;;:::i;1070:31:2:-;;;;;;;;;;;;;;;;;;2068:4:6;2056:17;;;2038:36;;2026:2;2011:18;1070:31:2;1896:184:6;5314:177:2;;;;;;;;;;;;;:::i;1324:44::-;;;;;;;;;;-1:-1:-1;1324:44:2;;;;;:::i;:::-;;;;;;;;;;;;;;1738:41;;;;;;;;;;-1:-1:-1;1738:41:2;;;;;:::i;:::-;;;;;;;;;;;;;;1043:20;;;;;;;;;;;;;:::i;2665:373::-;;;;;;;;;;-1:-1:-1;2665:373:2;;;;;:::i;:::-;;:::i;621:133:4:-;;;:::i;3825:1483:2:-;;;;;;;;;;-1:-1:-1;3825:1483:2;;;;;:::i;:::-;;:::i;1375:64::-;;;;;;;;;;-1:-1:-1;1375:64:2;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;621:133:4;673:28;679:10;691:9;673:5;:28::i;:::-;717:30;;737:9;1342:25:6;;725:10:4;;717:30;;1330:2:6;1315:18;717:30:4;;;;;;;621:133::o;1018:18:2:-;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;2448:211::-;2548:10;2522:4;2538:21;;;:9;:21;;;;;;;;-1:-1:-1;;;;;2538:30:2;;;;;;;;;;:39;;;2593:37;2522:4;;2538:30;;2593:37;;;;2571:6;1342:25:6;;1330:2;1315:18;;1196:177;2593:37:2;;;;;;;;-1:-1:-1;2648:4:2;2448:211;;;;;:::o;3044:592::-;-1:-1:-1;;;;;3196:15:2;;3162:4;3196:15;;;:9;:15;;;;;;;;3212:10;3196:27;;;;;;;;-1:-1:-1;;3274:28:2;;3270:80;;3334:16;3344:6;3334:7;:16;:::i;:::-;-1:-1:-1;;;;;3304:15:2;;;;;;:9;:15;;;;;;;;3320:10;3304:27;;;;;;;:46;3270:80;-1:-1:-1;;;;;3361:15:2;;;;;;:9;:15;;;;;:25;;3380:6;;3361:15;:25;;3380:6;;3361:25;:::i;:::-;;;;-1:-1:-1;;;;;;;3532:13:2;;;;;;;:9;:13;;;;;;;:23;;;;;;3581:26;3532:13;;3581:26;;;-1:-1:-1;;;;;;;;;;;3581:26:2;;;3549:6;1342:25:6;;1330:2;1315:18;;1196:177;3581:26:2;;;;;;;;-1:-1:-1;3625:4:2;;3044:592;-1:-1:-1;;;;3044:592:2:o;760:182:4:-;819:25;825:10;837:6;819:5;:25::i;:::-;860:30;;1342:25:6;;;871:10:4;;860:30;;1330:2:6;1315:18;860:30:4;;;;;;;901:34;:10;928:6;901:26;:34::i;:::-;760:182;:::o;5314:177:2:-;5371:7;5414:16;5397:13;:33;:87;;5460:24;:22;:24::i;:::-;5390:94;;5314:177;:::o;5397:87::-;-1:-1:-1;5433:24:2;;5314:177::o;1043:20::-;;;;;;;:::i;2665:373::-;2761:10;2735:4;2751:21;;;:9;:21;;;;;:31;;2776:6;;2751:21;2735:4;;2751:31;;2776:6;;2751:31;:::i;:::-;;;;-1:-1:-1;;;;;;;2928:13:2;;;;;;:9;:13;;;;;;;:23;;;;;;2977:32;2986:10;;-1:-1:-1;;;;;;;;;;;2977:32:2;;;2945:6;1342:25:6;;1330:2;1315:18;;1196:177;3825:1483:2;4044:15;4032:8;:27;;4024:63;;;;-1:-1:-1;;;4024:63:2;;4273:2:6;4024:63:2;;;4255:21:6;4312:2;4292:18;;;4285:30;4351:25;4331:18;;;4324:53;4394:18;;4024:63:2;;;;;;;;;4252:24;4279:805;4415:18;:16;:18::i;:::-;-1:-1:-1;;;;;4860:13:2;;;;;;;:6;:13;;;;;;;;;:15;;;;;;;;4498:449;;4542:165;4498:449;;;4710:25:6;4789:18;;;4782:43;;;;4861:15;;;4841:18;;;4834:43;4893:18;;;4886:34;;;4936:19;;;4929:35;;;;4980:19;;;;4973:35;;;4498:449:2;;;;;;;;;;4682:19:6;;;4498:449:2;;;4459:514;;;;;;;;-1:-1:-1;;;4337:658:2;;;5277:27:6;5320:11;;;5313:27;;;;5356:12;;;5349:28;;;;5393:12;;4337:658:2;;;-1:-1:-1;;4337:658:2;;;;;;;;;4306:707;;4337:658;4306:707;;;;4279:805;;;;;;;;;5643:25:6;5716:4;5704:17;;5684:18;;;5677:45;5738:18;;;5731:34;;;5781:18;;;5774:34;;;5615:19;;4279:805:2;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;4279:805:2;;-1:-1:-1;;4279:805:2;;;-1:-1:-1;;;;;;;5107:30:2;;;;;;:59;;;5161:5;-1:-1:-1;;;;;5141:25:2;:16;-1:-1:-1;;;;;5141:25:2;;5107:59;5099:86;;;;-1:-1:-1;;;5099:86:2;;6021:2:6;5099:86:2;;;6003:21:6;6060:2;6040:18;;;6033:30;-1:-1:-1;;;6079:18:6;;;6072:44;6133:18;;5099:86:2;5819:338:6;5099:86:2;-1:-1:-1;;;;;5200:27:2;;;;;;;:9;:27;;;;;;;;:36;;;;;;;;;;;;;:44;;;5270:31;1342:25:6;;;5200:36:2;;5270:31;;;;;1315:18:6;5270:31:2;;;;;;;3825:1483;;;;;;;:::o;6137:325::-;6222:6;6207:11;;:21;;;;;;;:::i;:::-;;;;-1:-1:-1;;;;;;;6374:13:2;;;;;;:9;:13;;;;;;;;:23;;;;;;6423:32;1342:25:6;;;-1:-1:-1;;;;;;;;;;;6423:32:2;1315:18:6;6423:32:2;;;;;;;;6137:325;;:::o;6468:328::-;-1:-1:-1;;;;;6540:15:2;;;;;;:9;:15;;;;;:25;;6559:6;;6540:15;:25;;6559:6;;6540:25;:::i;:::-;;;;-1:-1:-1;;6708:11:2;:21;;;;;;;6755:34;;1342:25:6;;;-1:-1:-1;;;;;;;6755:34:2;;;-1:-1:-1;;;;;;;;;;;6755:34:2;1330:2:6;1315:18;6755:34:2;1196:177:6;621:296:5;693:12;849:1;846;843;840;832:6;828:2;821:5;816:35;805:46;;879:7;871:39;;;;-1:-1:-1;;;871:39:5;;6494:2:6;871:39:5;;;6476:21:6;6533:2;6513:18;;;6506:30;-1:-1:-1;;;6552:18:6;;;6545:49;6611:18;;871:39:5;6292:343:6;871:39:5;683:234;621:296;;:::o;5497:446:2:-;5562:7;5659:95;5792:4;5776:22;;;;;;:::i;:::-;;;;;;;;;;5627:295;;;8166:25:6;;;;8207:18;;8200:34;;;;5820:14:2;8250:18:6;;;8243:34;5856:13:2;8293:18:6;;;8286:34;5899:4:2;8336:19:6;;;8329:61;8138:19;;5627:295:2;;;;;;;;;;;;5600:336;;;;;;5581:355;;5497:446;:::o;14:548:6:-;126:4;155:2;184;173:9;166:21;216:6;210:13;259:6;254:2;243:9;239:18;232:34;284:1;294:140;308:6;305:1;302:13;294:140;;;403:14;;;399:23;;393:30;369:17;;;388:2;365:26;358:66;323:10;;294:140;;;298:3;483:1;478:2;469:6;458:9;454:22;450:31;443:42;553:2;546;542:7;537:2;529:6;525:15;521:29;510:9;506:45;502:54;494:62;;;;14:548;;;;:::o;567:173::-;635:20;;-1:-1:-1;;;;;684:31:6;;674:42;;664:70;;730:1;727;720:12;664:70;567:173;;;:::o;745:254::-;813:6;821;874:2;862:9;853:7;849:23;845:32;842:52;;;890:1;887;880:12;842:52;913:29;932:9;913:29;:::i;:::-;903:39;989:2;974:18;;;;961:32;;-1:-1:-1;;;745:254:6:o;1378:328::-;1455:6;1463;1471;1524:2;1512:9;1503:7;1499:23;1495:32;1492:52;;;1540:1;1537;1530:12;1492:52;1563:29;1582:9;1563:29;:::i;:::-;1553:39;;1611:38;1645:2;1634:9;1630:18;1611:38;:::i;:::-;1601:48;;1696:2;1685:9;1681:18;1668:32;1658:42;;1378:328;;;;;:::o;1711:180::-;1770:6;1823:2;1811:9;1802:7;1798:23;1794:32;1791:52;;;1839:1;1836;1829:12;1791:52;-1:-1:-1;1862:23:6;;1711:180;-1:-1:-1;1711:180:6:o;2267:186::-;2326:6;2379:2;2367:9;2358:7;2354:23;2350:32;2347:52;;;2395:1;2392;2385:12;2347:52;2418:29;2437:9;2418:29;:::i;:::-;2408:39;2267:186;-1:-1:-1;;;2267:186:6:o;2458:693::-;2569:6;2577;2585;2593;2601;2609;2617;2670:3;2658:9;2649:7;2645:23;2641:33;2638:53;;;2687:1;2684;2677:12;2638:53;2710:29;2729:9;2710:29;:::i;:::-;2700:39;;2758:38;2792:2;2781:9;2777:18;2758:38;:::i;:::-;2748:48;;2843:2;2832:9;2828:18;2815:32;2805:42;;2894:2;2883:9;2879:18;2866:32;2856:42;;2948:3;2937:9;2933:19;2920:33;2993:4;2986:5;2982:16;2975:5;2972:27;2962:55;;3013:1;3010;3003:12;2962:55;2458:693;;;;-1:-1:-1;2458:693:6;;;;3036:5;3088:3;3073:19;;3060:33;;-1:-1:-1;3140:3:6;3125:19;;;3112:33;;2458:693;-1:-1:-1;;2458:693:6:o;3156:260::-;3224:6;3232;3285:2;3273:9;3264:7;3260:23;3256:32;3253:52;;;3301:1;3298;3291:12;3253:52;3324:29;3343:9;3324:29;:::i;:::-;3314:39;;3372:38;3406:2;3395:9;3391:18;3372:38;:::i;:::-;3362:48;;3156:260;;;;;:::o;3421:380::-;3500:1;3496:12;;;;3543;;;3564:61;;3618:4;3610:6;3606:17;3596:27;;3564:61;3671:2;3663:6;3660:14;3640:18;3637:38;3634:161;;3717:10;3712:3;3708:20;3705:1;3698:31;3752:4;3749:1;3742:15;3780:4;3777:1;3770:15;3634:161;;3421:380;;;:::o;3806:127::-;3867:10;3862:3;3858:20;3855:1;3848:31;3898:4;3895:1;3888:15;3922:4;3919:1;3912:15;3938:128;4005:9;;;4026:11;;;4023:37;;;4040:18;;:::i;6162:125::-;6227:9;;;6248:10;;;6245:36;;;6261:18;;:::i;6769:1133::-;6899:3;6928:1;6961:6;6955:13;6991:3;7013:1;7041:9;7037:2;7033:18;7023:28;;7101:2;7090:9;7086:18;7123;7113:61;;7167:4;7159:6;7155:17;7145:27;;7113:61;7193:2;7241;7233:6;7230:14;7210:18;7207:38;7204:165;;-1:-1:-1;;;7268:33:6;;7324:4;7321:1;7314:15;7354:4;7275:3;7342:17;7204:165;7385:18;7412:133;;;;7559:1;7554:323;;;;7378:499;;7412:133;-1:-1:-1;;7445:24:6;;7433:37;;7518:14;;7511:22;7499:35;;7490:45;;;-1:-1:-1;7412:133:6;;7554:323;6716:1;6709:14;;;6753:4;6740:18;;7652:1;7666:165;7680:6;7677:1;7674:13;7666:165;;;7758:14;;7745:11;;;7738:35;7801:16;;;;7695:10;;7666:165;;;7670:3;;7860:6;7855:3;7851:16;7844:23;;7378:499;-1:-1:-1;7893:3:6;;6769:1133;-1:-1:-1;;;;;;;;6769:1133:6:o", - "linkReferences": {}, - "immutableReferences": { - "1459": [ - { - "start": 454, - "length": 32 - } - ], - "1473": [ - { - "start": 1386, - "length": 32 - } - ], - "1475": [ - { - "start": 1439, - "length": 32 - } - ] - } - }, - "methodIdentifiers": { - "DOMAIN_SEPARATOR()": "3644e515", - "allowance(address,address)": "dd62ed3e", - "approve(address,uint256)": "095ea7b3", - "balanceOf(address)": "70a08231", - "decimals()": "313ce567", - "deposit()": "d0e30db0", - "name()": "06fdde03", - "nonces(address)": "7ecebe00", - "permit(address,address,uint256,uint256,uint8,bytes32,bytes32)": "d505accf", - "symbol()": "95d89b41", - "totalSupply()": "18160ddd", - "transfer(address,uint256)": "a9059cbb", - "transferFrom(address,address,uint256)": "23b872dd", - "withdraw(uint256)": "2e1a7d4d" - }, - "rawMetadata": "{\"compiler\":{\"version\":\"0.8.19+commit.7dd6d404\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Deposit\",\"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\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Withdrawal\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"DOMAIN_SEPARATOR\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"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\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"decimals\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"deposit\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"nonces\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"uint8\",\"name\":\"v\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"r\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"s\",\"type\":\"bytes32\"}],\"name\":\"permit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"symbol\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transfer\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"withdraw\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"author\":\"Solmate (https://github.com/Rari-Capital/solmate/blob/main/src/tokens/WETH.sol)Inspired by WETH9 (https://github.com/dapphub/ds-weth/blob/master/src/weth9.sol)\",\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"notice\":\"Minimalist and modern Wrapped Ether implementation.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"lib/solmate/src/tokens/WETH.sol\":\"WETH\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[\":ds-test/=lib/forge-std/lib/ds-test/src/\",\":erc4626-tests/=lib/portfolio/lib/openzeppelin-contracts/lib/erc4626-tests/\",\":forge-std/=lib/forge-std/src/\",\":nugu/=lib/portfolio/lib/nugu/\",\":openzeppelin-contracts/=lib/portfolio/lib/openzeppelin-contracts/\",\":openzeppelin/=lib/portfolio/lib/openzeppelin-contracts/contracts/\",\":portfolio/=lib/portfolio/contracts/\",\":solmate/=lib/solmate/src/\",\":solstat/=lib/portfolio/lib/solstat/src/\"]},\"sources\":{\"lib/solmate/src/tokens/ERC20.sol\":{\"keccak256\":\"0x43aa1509bb753f053143530705d9c4eee415691d26a4779769bf028a74e6ac69\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://fb440672ebad7d487c1600e406e140fd1ffc4bd7520c86b5709183ca2602da58\",\"dweb:/ipfs/QmNgZaBoAZwnwm4mTL1cUZnMtvt1iZnruMnfpJnDu6upuc\"]},\"lib/solmate/src/tokens/WETH.sol\":{\"keccak256\":\"0x9b7c1a6a154f8298c26ca09a868d5352de6006c07091dd9a90e5d4069a3a57b0\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://3c2507104931e101e5fa0f8e80b352e04f1ad7a90eb1dbfbce59f956bfae7272\",\"dweb:/ipfs/Qma89Py3L5UmsqtkjXQf99PnddFkYAqnQUd9siQNRdDeMH\"]},\"lib/solmate/src/utils/SafeTransferLib.sol\":{\"keccak256\":\"0x5f2e1158c68c1f3d15b80e8a7dd92b6849f873066969562ad33c0abb80e536ff\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://8c829a9d77ae852541d7ed1492cad93c371907f45b8f85134683b76ec62d4969\",\"dweb:/ipfs/QmX5dry5ofeGfGaC8GpDyCx3RHYf3CFpVftc517PVkuRSL\"]}},\"version\":1}", - "metadata": { - "compiler": { - "version": "0.8.19+commit.7dd6d404" - }, - "language": "Solidity", - "output": { - "abi": [ - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address", - "indexed": true - }, - { - "internalType": "address", - "name": "spender", - "type": "address", - "indexed": true - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256", - "indexed": false - } - ], - "type": "event", - "name": "Approval", - "anonymous": false - }, - { - "inputs": [ - { - "internalType": "address", - "name": "from", - "type": "address", - "indexed": true - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256", - "indexed": false - } - ], - "type": "event", - "name": "Deposit", - "anonymous": false - }, - { - "inputs": [ - { - "internalType": "address", - "name": "from", - "type": "address", - "indexed": true - }, - { - "internalType": "address", - "name": "to", - "type": "address", - "indexed": true - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256", - "indexed": false - } - ], - "type": "event", - "name": "Transfer", - "anonymous": false - }, - { - "inputs": [ - { - "internalType": "address", - "name": "to", - "type": "address", - "indexed": true - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256", - "indexed": false - } - ], - "type": "event", - "name": "Withdrawal", - "anonymous": false - }, - { - "inputs": [], - "stateMutability": "view", - "type": "function", - "name": "DOMAIN_SEPARATOR", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ] - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function", - "name": "allowance", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ] - }, - { - "inputs": [ - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function", - "name": "approve", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ] - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function", - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ] - }, - { - "inputs": [], - "stateMutability": "view", - "type": "function", - "name": "decimals", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ] - }, - { - "inputs": [], - "stateMutability": "payable", - "type": "function", - "name": "deposit" - }, - { - "inputs": [], - "stateMutability": "view", - "type": "function", - "name": "name", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ] - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function", - "name": "nonces", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ] - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - }, - { - "internalType": "uint8", - "name": "v", - "type": "uint8" - }, - { - "internalType": "bytes32", - "name": "r", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "s", - "type": "bytes32" - } - ], - "stateMutability": "nonpayable", - "type": "function", - "name": "permit" - }, - { - "inputs": [], - "stateMutability": "view", - "type": "function", - "name": "symbol", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ] - }, - { - "inputs": [], - "stateMutability": "view", - "type": "function", - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ] - }, - { - "inputs": [ - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function", - "name": "transfer", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ] - }, - { - "inputs": [ - { - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function", - "name": "transferFrom", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ] - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function", - "name": "withdraw" - }, - { - "inputs": [], - "stateMutability": "payable", - "type": "receive" - } - ], - "devdoc": { - "kind": "dev", - "methods": {}, - "version": 1 - }, - "userdoc": { - "kind": "user", - "methods": {}, - "version": 1 - } - }, - "settings": { - "remappings": [ - "ds-test/=lib/forge-std/lib/ds-test/src/", - "erc4626-tests/=lib/portfolio/lib/openzeppelin-contracts/lib/erc4626-tests/", - "forge-std/=lib/forge-std/src/", - "nugu/=lib/portfolio/lib/nugu/", - "openzeppelin-contracts/=lib/portfolio/lib/openzeppelin-contracts/", - "openzeppelin/=lib/portfolio/lib/openzeppelin-contracts/contracts/", - "portfolio/=lib/portfolio/contracts/", - "solmate/=lib/solmate/src/", - "solstat/=lib/portfolio/lib/solstat/src/" - ], - "optimizer": { - "enabled": true, - "runs": 200 - }, - "metadata": { - "bytecodeHash": "ipfs" - }, - "compilationTarget": { - "lib/solmate/src/tokens/WETH.sol": "WETH" - }, - "libraries": {} - }, - "sources": { - "lib/solmate/src/tokens/ERC20.sol": { - "keccak256": "0x43aa1509bb753f053143530705d9c4eee415691d26a4779769bf028a74e6ac69", - "urls": [ - "bzz-raw://fb440672ebad7d487c1600e406e140fd1ffc4bd7520c86b5709183ca2602da58", - "dweb:/ipfs/QmNgZaBoAZwnwm4mTL1cUZnMtvt1iZnruMnfpJnDu6upuc" - ], - "license": "MIT" - }, - "lib/solmate/src/tokens/WETH.sol": { - "keccak256": "0x9b7c1a6a154f8298c26ca09a868d5352de6006c07091dd9a90e5d4069a3a57b0", - "urls": [ - "bzz-raw://3c2507104931e101e5fa0f8e80b352e04f1ad7a90eb1dbfbce59f956bfae7272", - "dweb:/ipfs/Qma89Py3L5UmsqtkjXQf99PnddFkYAqnQUd9siQNRdDeMH" - ], - "license": "MIT" - }, - "lib/solmate/src/utils/SafeTransferLib.sol": { - "keccak256": "0x5f2e1158c68c1f3d15b80e8a7dd92b6849f873066969562ad33c0abb80e536ff", - "urls": [ - "bzz-raw://8c829a9d77ae852541d7ed1492cad93c371907f45b8f85134683b76ec62d4969", - "dweb:/ipfs/QmX5dry5ofeGfGaC8GpDyCx3RHYf3CFpVftc517PVkuRSL" - ], - "license": "MIT" - } - }, - "version": 1 - }, - "storageLayout": { - "storage": [ - { - "astId": 1455, - "contract": "lib/solmate/src/tokens/WETH.sol:WETH", - "label": "name", - "offset": 0, - "slot": "0", - "type": "t_string_storage" - }, - { - "astId": 1457, - "contract": "lib/solmate/src/tokens/WETH.sol:WETH", - "label": "symbol", - "offset": 0, - "slot": "1", - "type": "t_string_storage" - }, - { - "astId": 1461, - "contract": "lib/solmate/src/tokens/WETH.sol:WETH", - "label": "totalSupply", - "offset": 0, - "slot": "2", - "type": "t_uint256" - }, - { - "astId": 1465, - "contract": "lib/solmate/src/tokens/WETH.sol:WETH", - "label": "balanceOf", - "offset": 0, - "slot": "3", - "type": "t_mapping(t_address,t_uint256)" - }, - { - "astId": 1471, - "contract": "lib/solmate/src/tokens/WETH.sol:WETH", - "label": "allowance", - "offset": 0, - "slot": "4", - "type": "t_mapping(t_address,t_mapping(t_address,t_uint256))" - }, - { - "astId": 1479, - "contract": "lib/solmate/src/tokens/WETH.sol:WETH", - "label": "nonces", - "offset": 0, - "slot": "5", - "type": "t_mapping(t_address,t_uint256)" - } - ], - "types": { - "t_address": { - "encoding": "inplace", - "label": "address", - "numberOfBytes": "20" - }, - "t_mapping(t_address,t_mapping(t_address,t_uint256))": { - "encoding": "mapping", - "key": "t_address", - "label": "mapping(address => mapping(address => uint256))", - "numberOfBytes": "32", - "value": "t_mapping(t_address,t_uint256)" - }, - "t_mapping(t_address,t_uint256)": { - "encoding": "mapping", - "key": "t_address", - "label": "mapping(address => uint256)", - "numberOfBytes": "32", - "value": "t_uint256" - }, - "t_string_storage": { - "encoding": "bytes", - "label": "string", - "numberOfBytes": "32" - }, - "t_uint256": { - "encoding": "inplace", - "label": "uint256", - "numberOfBytes": "32" - } - } - }, - "ast": { - "absolutePath": "lib/solmate/src/tokens/WETH.sol", - "id": 2466, - "exportedSymbols": { - "ERC20": [ - 1822 - ], - "SafeTransferLib": [ - 2550 - ], - "WETH": [ - 2465 - ] - }, - "nodeType": "SourceUnit", - "src": "32:980:4", - "nodes": [ - { - "id": 2388, - "nodeType": "PragmaDirective", - "src": "32:24:4", - "nodes": [], - "literals": [ - "solidity", - ">=", - "0.8", - ".0" - ] - }, - { - "id": 2390, - "nodeType": "ImportDirective", - "src": "58:34:4", - "nodes": [], - "absolutePath": "lib/solmate/src/tokens/ERC20.sol", - "file": "./ERC20.sol", - "nameLocation": "-1:-1:-1", - "scope": 2466, - "sourceUnit": 1823, - "symbolAliases": [ - { - "foreign": { - "id": 2389, - "name": "ERC20", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 1822, - "src": "66:5:4", - "typeDescriptions": {} - }, - "nameLocation": "-1:-1:-1" - } - ], - "unitAlias": "" - }, - { - "id": 2392, - "nodeType": "ImportDirective", - "src": "94:61:4", - "nodes": [], - "absolutePath": "lib/solmate/src/utils/SafeTransferLib.sol", - "file": "../utils/SafeTransferLib.sol", - "nameLocation": "-1:-1:-1", - "scope": 2466, - "sourceUnit": 2551, - "symbolAliases": [ - { - "foreign": { - "id": 2391, - "name": "SafeTransferLib", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2550, - "src": "102:15:4", - "typeDescriptions": {} - }, - "nameLocation": "-1:-1:-1" - } - ], - "unitAlias": "" - }, - { - "id": 2465, - "nodeType": "ContractDefinition", - "src": "406:605:4", - "nodes": [ - { - "id": 2401, - "nodeType": "UsingForDirective", - "src": "464:34:4", - "nodes": [], - "global": false, - "libraryName": { - "id": 2399, - "name": "SafeTransferLib", - "nameLocations": [ - "470:15:4" - ], - "nodeType": "IdentifierPath", - "referencedDeclaration": 2550, - "src": "470:15:4" - }, - "typeName": { - "id": 2400, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "490:7:4", - "stateMutability": "nonpayable", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - } - }, - { - "id": 2407, - "nodeType": "EventDefinition", - "src": "504:52:4", - "nodes": [], - "anonymous": false, - "eventSelector": "e1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c", - "name": "Deposit", - "nameLocation": "510:7:4", - "parameters": { - "id": 2406, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 2403, - "indexed": true, - "mutability": "mutable", - "name": "from", - "nameLocation": "534:4:4", - "nodeType": "VariableDeclaration", - "scope": 2407, - "src": "518:20:4", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - }, - "typeName": { - "id": 2402, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "518:7:4", - "stateMutability": "nonpayable", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "visibility": "internal" - }, - { - "constant": false, - "id": 2405, - "indexed": false, - "mutability": "mutable", - "name": "amount", - "nameLocation": "548:6:4", - "nodeType": "VariableDeclaration", - "scope": 2407, - "src": "540:14:4", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 2404, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "540:7:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "visibility": "internal" - } - ], - "src": "517:38:4" - } - }, - { - "id": 2413, - "nodeType": "EventDefinition", - "src": "562:53:4", - "nodes": [], - "anonymous": false, - "eventSelector": "7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65", - "name": "Withdrawal", - "nameLocation": "568:10:4", - "parameters": { - "id": 2412, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 2409, - "indexed": true, - "mutability": "mutable", - "name": "to", - "nameLocation": "595:2:4", - "nodeType": "VariableDeclaration", - "scope": 2413, - "src": "579:18:4", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - }, - "typeName": { - "id": 2408, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "579:7:4", - "stateMutability": "nonpayable", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "visibility": "internal" - }, - { - "constant": false, - "id": 2411, - "indexed": false, - "mutability": "mutable", - "name": "amount", - "nameLocation": "607:6:4", - "nodeType": "VariableDeclaration", - "scope": 2413, - "src": "599:14:4", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 2410, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "599:7:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "visibility": "internal" - } - ], - "src": "578:36:4" - } - }, - { - "id": 2431, - "nodeType": "FunctionDefinition", - "src": "621:133:4", - "nodes": [], - "body": { - "id": 2430, - "nodeType": "Block", - "src": "663:91:4", - "nodes": [], - "statements": [ - { - "expression": { - "arguments": [ - { - "expression": { - "id": 2417, - "name": "msg", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": -15, - "src": "679:3:4", - "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 2418, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberLocation": "683:6:4", - "memberName": "sender", - "nodeType": "MemberAccess", - "src": "679:10:4", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - { - "expression": { - "id": 2419, - "name": "msg", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": -15, - "src": "691:3:4", - "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 2420, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberLocation": "695:5:4", - "memberName": "value", - "nodeType": "MemberAccess", - "src": "691:9:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_address", - "typeString": "address" - }, - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - ], - "id": 2416, - "name": "_mint", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 1793, - "src": "673:5:4", - "typeDescriptions": { - "typeIdentifier": "t_function_internal_nonpayable$_t_address_$_t_uint256_$returns$__$", - "typeString": "function (address,uint256)" - } - }, - "id": 2421, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "nameLocations": [], - "names": [], - "nodeType": "FunctionCall", - "src": "673:28:4", - "tryCall": false, - "typeDescriptions": { - "typeIdentifier": "t_tuple$__$", - "typeString": "tuple()" - } - }, - "id": 2422, - "nodeType": "ExpressionStatement", - "src": "673:28:4" - }, - { - "eventCall": { - "arguments": [ - { - "expression": { - "id": 2424, - "name": "msg", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": -15, - "src": "725:3:4", - "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 2425, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberLocation": "729:6:4", - "memberName": "sender", - "nodeType": "MemberAccess", - "src": "725:10:4", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - { - "expression": { - "id": 2426, - "name": "msg", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": -15, - "src": "737:3:4", - "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 2427, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberLocation": "741:5:4", - "memberName": "value", - "nodeType": "MemberAccess", - "src": "737:9:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_address", - "typeString": "address" - }, - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - ], - "id": 2423, - "name": "Deposit", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2407, - "src": "717:7:4", - "typeDescriptions": { - "typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_uint256_$returns$__$", - "typeString": "function (address,uint256)" - } - }, - "id": 2428, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "nameLocations": [], - "names": [], - "nodeType": "FunctionCall", - "src": "717:30:4", - "tryCall": false, - "typeDescriptions": { - "typeIdentifier": "t_tuple$__$", - "typeString": "tuple()" - } - }, - "id": 2429, - "nodeType": "EmitStatement", - "src": "712:35:4" - } - ] - }, - "functionSelector": "d0e30db0", - "implemented": true, - "kind": "function", - "modifiers": [], - "name": "deposit", - "nameLocation": "630:7:4", - "parameters": { - "id": 2414, - "nodeType": "ParameterList", - "parameters": [], - "src": "637:2:4" - }, - "returnParameters": { - "id": 2415, - "nodeType": "ParameterList", - "parameters": [], - "src": "663:0:4" - }, - "scope": 2465, - "stateMutability": "payable", - "virtual": true, - "visibility": "public" - }, - { - "id": 2457, - "nodeType": "FunctionDefinition", - "src": "760:182:4", - "nodes": [], - "body": { - "id": 2456, - "nodeType": "Block", - "src": "809:133:4", - "nodes": [], - "statements": [ - { - "expression": { - "arguments": [ - { - "expression": { - "id": 2437, - "name": "msg", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": -15, - "src": "825:3:4", - "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 2438, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberLocation": "829:6:4", - "memberName": "sender", - "nodeType": "MemberAccess", - "src": "825:10:4", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - { - "id": 2439, - "name": "amount", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2433, - "src": "837:6:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_address", - "typeString": "address" - }, - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - ], - "id": 2436, - "name": "_burn", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 1821, - "src": "819:5:4", - "typeDescriptions": { - "typeIdentifier": "t_function_internal_nonpayable$_t_address_$_t_uint256_$returns$__$", - "typeString": "function (address,uint256)" - } - }, - "id": 2440, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "nameLocations": [], - "names": [], - "nodeType": "FunctionCall", - "src": "819:25:4", - "tryCall": false, - "typeDescriptions": { - "typeIdentifier": "t_tuple$__$", - "typeString": "tuple()" - } - }, - "id": 2441, - "nodeType": "ExpressionStatement", - "src": "819:25:4" - }, - { - "eventCall": { - "arguments": [ - { - "expression": { - "id": 2443, - "name": "msg", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": -15, - "src": "871:3:4", - "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 2444, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberLocation": "875:6:4", - "memberName": "sender", - "nodeType": "MemberAccess", - "src": "871:10:4", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - { - "id": 2445, - "name": "amount", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2433, - "src": "883:6:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_address", - "typeString": "address" - }, - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - ], - "id": 2442, - "name": "Withdrawal", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2413, - "src": "860:10:4", - "typeDescriptions": { - "typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_uint256_$returns$__$", - "typeString": "function (address,uint256)" - } - }, - "id": 2446, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "nameLocations": [], - "names": [], - "nodeType": "FunctionCall", - "src": "860:30:4", - "tryCall": false, - "typeDescriptions": { - "typeIdentifier": "t_tuple$__$", - "typeString": "tuple()" - } - }, - "id": 2447, - "nodeType": "EmitStatement", - "src": "855:35:4" - }, - { - "expression": { - "arguments": [ - { - "id": 2453, - "name": "amount", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2433, - "src": "928:6:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - ], - "expression": { - "expression": { - "id": 2448, - "name": "msg", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": -15, - "src": "901:3:4", - "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 2451, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberLocation": "905:6:4", - "memberName": "sender", - "nodeType": "MemberAccess", - "src": "901:10:4", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "id": 2452, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberLocation": "912:15:4", - "memberName": "safeTransferETH", - "nodeType": "MemberAccess", - "referencedDeclaration": 2487, - "src": "901:26:4", - "typeDescriptions": { - "typeIdentifier": "t_function_internal_nonpayable$_t_address_$_t_uint256_$returns$__$attached_to$_t_address_$", - "typeString": "function (address,uint256)" - } - }, - "id": 2454, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "nameLocations": [], - "names": [], - "nodeType": "FunctionCall", - "src": "901:34:4", - "tryCall": false, - "typeDescriptions": { - "typeIdentifier": "t_tuple$__$", - "typeString": "tuple()" - } - }, - "id": 2455, - "nodeType": "ExpressionStatement", - "src": "901:34:4" - } - ] - }, - "functionSelector": "2e1a7d4d", - "implemented": true, - "kind": "function", - "modifiers": [], - "name": "withdraw", - "nameLocation": "769:8:4", - "parameters": { - "id": 2434, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 2433, - "mutability": "mutable", - "name": "amount", - "nameLocation": "786:6:4", - "nodeType": "VariableDeclaration", - "scope": 2457, - "src": "778:14:4", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 2432, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "778:7:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "visibility": "internal" - } - ], - "src": "777:16:4" - }, - "returnParameters": { - "id": 2435, - "nodeType": "ParameterList", - "parameters": [], - "src": "809:0:4" - }, - "scope": 2465, - "stateMutability": "nonpayable", - "virtual": true, - "visibility": "public" - }, - { - "id": 2464, - "nodeType": "FunctionDefinition", - "src": "948:61:4", - "nodes": [], - "body": { - "id": 2463, - "nodeType": "Block", - "src": "983:26:4", - "nodes": [], - "statements": [ - { - "expression": { - "arguments": [], - "expression": { - "argumentTypes": [], - "id": 2460, - "name": "deposit", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2431, - "src": "993:7:4", - "typeDescriptions": { - "typeIdentifier": "t_function_internal_nonpayable$__$returns$__$", - "typeString": "function ()" - } - }, - "id": 2461, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "nameLocations": [], - "names": [], - "nodeType": "FunctionCall", - "src": "993:9:4", - "tryCall": false, - "typeDescriptions": { - "typeIdentifier": "t_tuple$__$", - "typeString": "tuple()" - } - }, - "id": 2462, - "nodeType": "ExpressionStatement", - "src": "993:9:4" - } - ] - }, - "implemented": true, - "kind": "receive", - "modifiers": [], - "name": "", - "nameLocation": "-1:-1:-1", - "parameters": { - "id": 2458, - "nodeType": "ParameterList", - "parameters": [], - "src": "955:2:4" - }, - "returnParameters": { - "id": 2459, - "nodeType": "ParameterList", - "parameters": [], - "src": "983:0:4" - }, - "scope": 2465, - "stateMutability": "payable", - "virtual": true, - "visibility": "external" - } - ], - "abstract": false, - "baseContracts": [ - { - "arguments": [ - { - "hexValue": "57726170706564204574686572", - "id": 2395, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "string", - "lValueRequested": false, - "nodeType": "Literal", - "src": "429:15:4", - "typeDescriptions": { - "typeIdentifier": "t_stringliteral_00cd3d46df44f2cbb950cf84eb2e92aa2ddd23195b1a009173ea59a063357ed3", - "typeString": "literal_string \"Wrapped Ether\"" - }, - "value": "Wrapped Ether" - }, - { - "hexValue": "57455448", - "id": 2396, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "string", - "lValueRequested": false, - "nodeType": "Literal", - "src": "446:6:4", - "typeDescriptions": { - "typeIdentifier": "t_stringliteral_0f8a193ff464434486c0daf7db2a895884365d2bc84ba47a68fcf89c1b14b5b8", - "typeString": "literal_string \"WETH\"" - }, - "value": "WETH" - }, - { - "hexValue": "3138", - "id": 2397, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "454:2:4", - "typeDescriptions": { - "typeIdentifier": "t_rational_18_by_1", - "typeString": "int_const 18" - }, - "value": "18" - } - ], - "baseName": { - "id": 2394, - "name": "ERC20", - "nameLocations": [ - "423:5:4" - ], - "nodeType": "IdentifierPath", - "referencedDeclaration": 1822, - "src": "423:5:4" - }, - "id": 2398, - "nodeType": "InheritanceSpecifier", - "src": "423:34:4" - } - ], - "canonicalName": "WETH", - "contractDependencies": [], - "contractKind": "contract", - "documentation": { - "id": 2393, - "nodeType": "StructuredDocumentation", - "src": "157:249:4", - "text": "@notice Minimalist and modern Wrapped Ether implementation.\n @author Solmate (https://github.com/Rari-Capital/solmate/blob/main/src/tokens/WETH.sol)\n @author Inspired by WETH9 (https://github.com/dapphub/ds-weth/blob/master/src/weth9.sol)" - }, - "fullyImplemented": true, - "linearizedBaseContracts": [ - 2465, - 1822 - ], - "name": "WETH", - "nameLocation": "415:4:4", - "scope": 2466, - "usedErrors": [] - } - ], - "license": "MIT" - }, - "id": 4 - } \ No newline at end of file diff --git a/fork_example/test.json b/fork_example/test.json deleted file mode 100644 index d9660e1..0000000 --- a/fork_example/test.json +++ /dev/null @@ -1 +0,0 @@ -{"meta":{"weth":{"address":"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2","artifacts_path":"fork_example/WETH.json","mappings":{"balanceOf":["0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"]}}},"raw":{"0xd8da6bf26964af9d7eed9e03e53415d37aa96045":[{"balance":"0x32a256c95f0e218155","nonce":1130,"code_hash":"0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470","code":{"bytecode":"0x","state":"Raw"}},{}],"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2":[{"balance":"0x295f9676bf9b23ace3959","nonce":1,"code_hash":"0xd0a06b12ac47863b5c7be4185c2deaad1c61557033f56c7d4ea74429cbb25e23","code":{"bytecode":"0x6060604052600436106100af576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100b9578063095ea7b31461014757806318160ddd146101a157806323b872dd146101ca5780632e1a7d4d14610243578063313ce5671461026657806370a082311461029557806395d89b41146102e2578063a9059cbb14610370578063d0e30db0146103ca578063dd62ed3e146103d4575b6100b7610440565b005b34156100c457600080fd5b6100cc6104dd565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561010c5780820151818401526020810190506100f1565b50505050905090810190601f1680156101395780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561015257600080fd5b610187600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061057b565b604051808215151515815260200191505060405180910390f35b34156101ac57600080fd5b6101b461066d565b6040518082815260200191505060405180910390f35b34156101d557600080fd5b610229600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061068c565b604051808215151515815260200191505060405180910390f35b341561024e57600080fd5b61026460048080359060200190919050506109d9565b005b341561027157600080fd5b610279610b05565b604051808260ff1660ff16815260200191505060405180910390f35b34156102a057600080fd5b6102cc600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610b18565b6040518082815260200191505060405180910390f35b34156102ed57600080fd5b6102f5610b30565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561033557808201518184015260208101905061031a565b50505050905090810190601f1680156103625780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561037b57600080fd5b6103b0600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610bce565b604051808215151515815260200191505060405180910390f35b6103d2610440565b005b34156103df57600080fd5b61042a600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610be3565b6040518082815260200191505060405180910390f35b34600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055503373ffffffffffffffffffffffffffffffffffffffff167fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c346040518082815260200191505060405180910390a2565b60008054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156105735780601f1061054857610100808354040283529160200191610573565b820191906000526020600020905b81548152906001019060200180831161055657829003601f168201915b505050505081565b600081600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60003073ffffffffffffffffffffffffffffffffffffffff1631905090565b600081600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101515156106dc57600080fd5b3373ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16141580156107b457507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414155b156108cf5781600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015151561084457600080fd5b81600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055505b81600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b80600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410151515610a2757600080fd5b80600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055503373ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501515610ab457600080fd5b3373ffffffffffffffffffffffffffffffffffffffff167f7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65826040518082815260200191505060405180910390a250565b600260009054906101000a900460ff1681565b60036020528060005260406000206000915090505481565b60018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610bc65780601f10610b9b57610100808354040283529160200191610bc6565b820191906000526020600020905b815481529060010190602001808311610ba957829003601f168201915b505050505081565b6000610bdb33848461068c565b905092915050565b60046020528160005260406000206020528060005260406000206000915091505054815600a165627a7a72305820deb4c2ccab3c2fdca32ab3f46728389c2fe2c165d5fafa07661e4e004f6c344a0029","state":"Raw"}},{"3":"0","4":"0","5":"0","2":"18","26503682303622372439135079884578270057785794679663935708947492083441471802570":"34890707020710109111","0":"39553310892875263560936207548857176834471854732421237974622739861269930573850","1":"39473711962023174749424659199615060097653232135126263878786656434573155500040"}]},"externally_owned_accounts":{"vitalik":"0xd8da6bf26964af9d7eed9e03e53415d37aa96045"}} \ No newline at end of file diff --git a/fork_example/weth_fork_config.toml b/fork_example/weth_fork_config.toml deleted file mode 100644 index 7326055..0000000 --- a/fork_example/weth_fork_config.toml +++ /dev/null @@ -1,20 +0,0 @@ -# Basic configuration -output_directory = "fork_example/" -output_filename = "test.json" -provider = "https://eth.llamarpc.com" -block_number = 18228556 - -# EOAs -[externally_owned_accounts] -vitalik = "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" # vitalik.eth as of 10/2/2023 - -# Contracts stored in a mapping -# Try this out with the weth contract -[contracts.weth] -address = "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2" -artifacts_path = "fork_example/WETH.json" - -[contracts.weth.mappings] -balanceOf = [ - "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045", # vitalik.eth as of 10/2/2023 -] \ No newline at end of file diff --git a/script/Counter.s.sol b/script/Counter.s.sol deleted file mode 100644 index 0e546ab..0000000 --- a/script/Counter.s.sol +++ /dev/null @@ -1,12 +0,0 @@ -// SPDX-License-Identifier: UNLICENSED -pragma solidity ^0.8.13; - -import "forge-std/Script.sol"; - -contract CounterScript is Script { - function setUp() public {} - - function run() public { - vm.broadcast(); - } -} diff --git a/src/agents/block_admin.rs b/src/agents/block_admin.rs new file mode 100644 index 0000000..29d0c43 --- /dev/null +++ b/src/agents/block_admin.rs @@ -0,0 +1,53 @@ +use std::sync::Arc; + +use arbiter_core::environment::Environment; +use arbiter_core::middleware::RevmMiddleware; +use ethers::providers::Middleware; +use settings::SimulationConfig; + +use super::*; + +#[derive(Clone)] +pub struct BlockAdmin { + pub client: Arc, + pub timestep_size: u64, + pub block_timestamp: u64, + pub block_number: u64, +} + +impl BlockAdmin { + pub async fn new(environment: &Environment, config: &SimulationConfig) -> Result { + let client = RevmMiddleware::new(environment, "block_admin".into())?; + let timestep_size = config.block.timestep_size; + let block_number = client.get_block_number().await?.as_u64(); + let block_timestamp = client.get_block_timestamp().await?.as_u64(); + + Ok(Self { + client, + timestep_size, + block_timestamp, + block_number, + }) + } + + pub fn update_block(&mut self) -> Result<()> { + self.block_number += 1; + self.block_timestamp = self.block_number * self.timestep_size; + self.client + .update_block(self.block_number, self.block_timestamp)?; + Ok(()) + } +} + +#[async_trait::async_trait] +impl Agent for BlockAdmin { + async fn step(&mut self) -> Result<()> { + self.update_block()?; + Ok(()) + } + + async fn startup(&mut self) -> Result<()> { + self.update_block()?; + Ok(()) + } +} diff --git a/src/agents/counter_agent.rs b/src/agents/counter_agent.rs new file mode 100644 index 0000000..0da035c --- /dev/null +++ b/src/agents/counter_agent.rs @@ -0,0 +1,35 @@ +use std::sync::Arc; + +use arbiter_core::{middleware::RevmMiddleware, environment::Environment, bindings::arbiter_token::ArbiterToken}; +use ethers::types::{Address, U256}; +use bindings::counter::Counter; + +use super::*; + +#[derive(Clone)] +pub struct CounterAgent { + pub client: Arc, + pub counter: Counter, +} + +impl CounterAgent { + pub async fn new(environment: &Environment) -> Result { + let client = RevmMiddleware::new(environment, "counter_agent".into())?; + let counter = Counter::deploy(client.clone(), ())?.send().await?; + + Ok(Self { client, counter}) + } + + pub async fn increment (&self) -> Result<()> { + self.counter.increment().send().await?.await?; + Ok(()) + } +} + +#[async_trait::async_trait] +impl Agent for CounterAgent { + async fn step(&mut self) -> Result<()> { + self.increment().await?; + Ok(()) + } +} diff --git a/src/agents/mod.rs b/src/agents/mod.rs new file mode 100644 index 0000000..4d3b7ae --- /dev/null +++ b/src/agents/mod.rs @@ -0,0 +1,62 @@ +use super::*; + +pub mod block_admin; +pub mod counter_agent; +pub mod price_changer; +pub mod token_admin; + +use std::marker::{Send, Sync}; + +use crate::settings::parameters::Fixed; + +/// Universal agent methods for interacting with the simulation environment or +/// loop. +#[async_trait::async_trait] +pub trait Agent: Sync + Send { + /// Executed outside the main simulation loop. + async fn startup(&mut self) -> Result<()> { + Ok(()) + } + + /// Executed by each agent inside the main simulation loop. + /// Ordering is determined by placement in the simulation loop. + async fn step(&mut self) -> Result<()> { + Ok(()) + } + + /// Executed by each agent in a separate loop before the main loop. + async fn priority_step(&mut self) -> Result<()> { + Ok(()) + } +} + +pub struct Agents(pub Vec>); + +impl Agents { + pub fn iter_mut(&mut self) -> impl Iterator> { + self.0.iter_mut() + } +} + +impl Agents { + #[allow(clippy::new_without_default)] + pub fn new() -> Self { + Self(vec![]) + } + + pub fn add(mut self, agent: impl Agent + 'static) -> Self { + self.0.push(Box::new(agent)); + self + } +} + +#[async_trait::async_trait] +impl Agent for Agents { + async fn step(&mut self) -> Result<()> { + Ok(()) + } + + async fn priority_step(&mut self) -> Result<()> { + Ok(()) + } +} diff --git a/src/agents/price_changer.rs b/src/agents/price_changer.rs new file mode 100644 index 0000000..02ac7fd --- /dev/null +++ b/src/agents/price_changer.rs @@ -0,0 +1,99 @@ +use arbiter_core::math::{float_to_wad, Trajectories, GeometricBrownianMotion, StochasticProcess}; +use arbiter_core::bindings::liquid_exchange::LiquidExchange; +use arbiter_core::environment::Environment; +use arbiter_core::middleware::RevmMiddleware; +use ethers::utils::parse_ether; +use crate::settings::{SimulationConfig, parameters::GBMParameters}; +use crate::agents::*; + +/// The `PriceChanger` holds the data and has methods that allow it to update +/// the price of the `LiquidExchange`. +pub struct PriceChanger { + /// The path the price process takes. + pub trajectory: Trajectories, + + /// The `LiquidExchange` contract with the admin `Client`. + pub liquid_exchange: LiquidExchange, + + /// The index of the current price in the trajectory. + pub index: usize, +} + +impl PriceChanger { + /// Create a new `PriceChanger` with the given `LiquidExchange` contract + /// bound to the admin `Client`. The `PriceChanger` will use the + /// `OrnsteinUhlenbeck` process to generate a price trajectory with the + /// constants defined in `config.rs`. + /// Ornstein-Uhlenbeck processes are useful for modeling the price of stable + /// tokens. + pub async fn new( + environment: &Environment, + token_admin: &token_admin::TokenAdmin, + config: &SimulationConfig, + ) -> Result { + let client = RevmMiddleware::new(environment, "price_changer".into())?; + let liquid_exchange = LiquidExchange::deploy( + client, + ( + token_admin.arbx.address(), + token_admin.arby.address(), + float_to_wad(config.trajectory.initial_price.0), + ), + )? + .send() + .await?; + + token_admin + .mint( + liquid_exchange.address(), + parse_ether(100_000_000_000_u64).unwrap(), + parse_ether(100_000_000_000_u64).unwrap(), + ) + .await?; + + let trajectory_params = &config.trajectory; + let trajectory = match trajectory_params.process.as_str() { + "gbm" => { + let GBMParameters { drift, volatility } = config.gbm.unwrap(); + GeometricBrownianMotion::new(drift.0, volatility.0).seedable_euler_maruyama( + trajectory_params.initial_price.0, + trajectory_params.t_0.0, + trajectory_params.t_n.0, + trajectory_params.num_steps, + 1, + false, + trajectory_params.seed, + ) + } + _ => panic!("Invalid process type"), + }; + + Ok(Self { + trajectory, + liquid_exchange, + index: 1, /* start after the initial price since it is already set on contract + * deployment */ + }) + } + + /// Update the price of the `LiquidExchange` contract to the next price in + /// the trajectory and increment the index. + pub async fn update_price(&mut self) -> Result<()> { + let price = self.trajectory.paths[0][self.index]; + self.liquid_exchange + .set_price(arbiter_core::math::float_to_wad(price)) + .send() + .await? + .await?; + self.index += 1; + Ok(()) + } +} + +#[async_trait::async_trait] +impl Agent for PriceChanger { + async fn step(&mut self) -> Result<()> { + self.update_price().await?; + Ok(()) + } +} diff --git a/src/agents/token_admin.rs b/src/agents/token_admin.rs new file mode 100644 index 0000000..b35ff34 --- /dev/null +++ b/src/agents/token_admin.rs @@ -0,0 +1,44 @@ +use std::sync::Arc; + +use arbiter_core::{middleware::RevmMiddleware, environment::Environment, bindings::arbiter_token::ArbiterToken}; +use ethers::types::{Address, U256}; + +use super::*; + +#[derive(Clone)] +pub struct TokenAdmin { + pub client: Arc, + pub arbx: ArbiterToken, + pub arby: ArbiterToken, +} + +impl TokenAdmin { + pub async fn new(environment: &Environment) -> Result { + let client = RevmMiddleware::new(environment, "token_admin".into())?; + let decimals = 18_u8; + + let arbx = ArbiterToken::deploy( + client.clone(), + ("Arbiter Token X".to_string(), "arbx".to_string(), decimals), + )? + .send() + .await?; + let arby = ArbiterToken::deploy( + client.clone(), + ("Arbiter Token Y".to_string(), "arby".to_string(), decimals), + )? + .send() + .await?; + + Ok(Self { client, arbx, arby }) + } + + pub async fn mint(&self, to: Address, amount_x: U256, amount_y: U256) -> Result<()> { + self.arbx.mint(to, amount_x).send().await?.await?; + self.arby.mint(to, amount_y).send().await?.await?; + Ok(()) + } +} + +#[async_trait::async_trait] +impl Agent for TokenAdmin {} diff --git a/src/bindings/counter.rs b/src/bindings/counter.rs index 180bd1a..03ccfcb 100644 --- a/src/bindings/counter.rs +++ b/src/bindings/counter.rs @@ -7,7 +7,7 @@ pub use counter::*; clippy::upper_case_acronyms, clippy::type_complexity, dead_code, - non_camel_case_types + non_camel_case_types, )] pub mod counter { #[allow(deprecated)] @@ -17,66 +17,102 @@ pub mod counter { functions: ::core::convert::From::from([ ( ::std::borrow::ToOwned::to_owned("increment"), - ::std::vec![::ethers::core::abi::ethabi::Function { - name: ::std::borrow::ToOwned::to_owned("increment"), - inputs: ::std::vec![], - outputs: ::std::vec![], - constant: ::core::option::Option::None, - state_mutability: ::ethers::core::abi::ethabi::StateMutability::NonPayable, - },], + ::std::vec![ + ::ethers::core::abi::ethabi::Function { + name: ::std::borrow::ToOwned::to_owned("increment"), + inputs: ::std::vec![], + outputs: ::std::vec![], + constant: ::core::option::Option::None, + state_mutability: ::ethers::core::abi::ethabi::StateMutability::NonPayable, + }, + ], ), ( ::std::borrow::ToOwned::to_owned("number"), - ::std::vec![::ethers::core::abi::ethabi::Function { - name: ::std::borrow::ToOwned::to_owned("number"), - inputs: ::std::vec![], - outputs: ::std::vec![::ethers::core::abi::ethabi::Param { - name: ::std::string::String::new(), - kind: ::ethers::core::abi::ethabi::ParamType::Uint(256usize,), - internal_type: ::core::option::Option::Some( - ::std::borrow::ToOwned::to_owned("uint256"), - ), - },], - constant: ::core::option::Option::None, - state_mutability: ::ethers::core::abi::ethabi::StateMutability::View, - },], + ::std::vec![ + ::ethers::core::abi::ethabi::Function { + name: ::std::borrow::ToOwned::to_owned("number"), + inputs: ::std::vec![], + outputs: ::std::vec![ + ::ethers::core::abi::ethabi::Param { + name: ::std::string::String::new(), + kind: ::ethers::core::abi::ethabi::ParamType::Uint( + 256usize, + ), + internal_type: ::core::option::Option::Some( + ::std::borrow::ToOwned::to_owned("uint256"), + ), + }, + ], + constant: ::core::option::Option::None, + state_mutability: ::ethers::core::abi::ethabi::StateMutability::View, + }, + ], ), ( ::std::borrow::ToOwned::to_owned("setNumber"), - ::std::vec![::ethers::core::abi::ethabi::Function { - name: ::std::borrow::ToOwned::to_owned("setNumber"), - inputs: ::std::vec![::ethers::core::abi::ethabi::Param { - name: ::std::borrow::ToOwned::to_owned("newNumber"), - kind: ::ethers::core::abi::ethabi::ParamType::Uint(256usize,), - internal_type: ::core::option::Option::Some( - ::std::borrow::ToOwned::to_owned("uint256"), - ), - },], - outputs: ::std::vec![], - constant: ::core::option::Option::None, - state_mutability: ::ethers::core::abi::ethabi::StateMutability::NonPayable, - },], + ::std::vec![ + ::ethers::core::abi::ethabi::Function { + name: ::std::borrow::ToOwned::to_owned("setNumber"), + inputs: ::std::vec![ + ::ethers::core::abi::ethabi::Param { + name: ::std::borrow::ToOwned::to_owned("newNumber"), + kind: ::ethers::core::abi::ethabi::ParamType::Uint( + 256usize, + ), + internal_type: ::core::option::Option::Some( + ::std::borrow::ToOwned::to_owned("uint256"), + ), + }, + ], + outputs: ::std::vec![], + constant: ::core::option::Option::None, + state_mutability: ::ethers::core::abi::ethabi::StateMutability::NonPayable, + }, + ], + ), + ]), + events: ::core::convert::From::from([ + ( + ::std::borrow::ToOwned::to_owned("Incremented"), + ::std::vec![ + ::ethers::core::abi::ethabi::Event { + name: ::std::borrow::ToOwned::to_owned("Incremented"), + inputs: ::std::vec![ + ::ethers::core::abi::ethabi::EventParam { + name: ::std::borrow::ToOwned::to_owned("number"), + kind: ::ethers::core::abi::ethabi::ParamType::Uint( + 256usize, + ), + indexed: false, + }, + ], + anonymous: false, + }, + ], ), ]), - events: ::std::collections::BTreeMap::new(), errors: ::std::collections::BTreeMap::new(), receive: false, fallback: false, } } ///The parsed JSON ABI of the contract. - pub static COUNTER_ABI: ::ethers::contract::Lazy<::ethers::core::abi::Abi> = - ::ethers::contract::Lazy::new(__abi); + pub static COUNTER_ABI: ::ethers::contract::Lazy<::ethers::core::abi::Abi> = ::ethers::contract::Lazy::new( + __abi, + ); #[rustfmt::skip] - const __BYTECODE: &[u8] = b"`\x80`@R4\x80\x15a\0]W`@QbF\x1B\xCD`\xE5\x1B\x81R` `\x04\x82\x01R`\"`$\x82\x01R\x7FEther sent to non-payable functi`D\x82\x01\x90\x81Ra7\xB7`\xF1\x1B`d\x83\x01R`\x84\x82\xFD[Pa\x01\xFD\x80a\0m`\09`\0\xF3\xFE`\x80`@R4\x80\x15a\0]W`@QbF\x1B\xCD`\xE5\x1B\x81R` `\x04\x82\x01R`\"`$\x82\x01R\x7FEther sent to non-payable functi`D\x82\x01\x90\x81Ra7\xB7`\xF1\x1B`d\x83\x01R`\x84\x82\xFD[P`\x046\x10a\0\x8EW`\x005`\xE0\x1C\x80c?\xB5\xC1\xCB\x14a\0\xF3W\x80c\x83\x81\xF5\x8A\x14a\x01\x08W\x80c\xD0\x9D\xE0\x8A\x14a\x01#W[`@QbF\x1B\xCD`\xE5\x1B\x81R` `\x04\x82\x01R`5`$\x82\x01R\x7FContract does not have fallback `D\x82\x01\x90\x81Rtnor receive functions`X\x1B`d\x83\x01R`\x84\x82\xFD[a\x01\x06a\x01\x016`\x04a\x01(::ethers::contract::Contract); impl ::core::clone::Clone for Counter { fn clone(&self) -> Self { @@ -96,9 +132,7 @@ pub mod counter { } impl ::core::fmt::Debug for Counter { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_tuple(::core::stringify!(Counter)) - .field(&self.address()) - .finish() + f.debug_tuple(::core::stringify!(Counter)).field(&self.address()).finish() } } impl Counter { @@ -108,11 +142,13 @@ pub mod counter { address: T, client: ::std::sync::Arc, ) -> Self { - Self(::ethers::contract::Contract::new( - address.into(), - COUNTER_ABI.clone(), - client, - )) + Self( + ::ethers::contract::Contract::new( + address.into(), + COUNTER_ABI.clone(), + client, + ), + ) } /// Constructs the general purpose `Deployer` instance based on the provided constructor arguments and sends it. /// Returns a new instance of a deployer that returns an instance of this contract after sending the transaction @@ -176,22 +212,61 @@ pub mod counter { .method_hash([63, 181, 193, 203], new_number) .expect("method not found (this should never happen)") } + ///Gets the contract's `Incremented` event + pub fn incremented_filter( + &self, + ) -> ::ethers::contract::builders::Event< + ::std::sync::Arc, + M, + IncrementedFilter, + > { + self.0.event() + } + /// Returns an `Event` builder for all the events of this contract. + pub fn events( + &self, + ) -> ::ethers::contract::builders::Event< + ::std::sync::Arc, + M, + IncrementedFilter, + > { + self.0.event_with_filter(::core::default::Default::default()) + } } - impl From<::ethers::contract::Contract> for Counter { + impl From<::ethers::contract::Contract> + for Counter { fn from(contract: ::ethers::contract::Contract) -> Self { Self::new(contract.address(), contract.client()) } } + #[derive( + Clone, + ::ethers::contract::EthEvent, + ::ethers::contract::EthDisplay, + serde::Serialize, + serde::Deserialize, + Default, + Debug, + PartialEq, + Eq, + Hash + )] + #[ethevent(name = "Incremented", abi = "Incremented(uint256)")] + pub struct IncrementedFilter { + pub number: ::ethers::core::types::U256, + } ///Container type for all input parameters for the `increment` function with signature `increment()` and selector `0xd09de08a` #[derive( Clone, ::ethers::contract::EthCall, ::ethers::contract::EthDisplay, + serde::Serialize, + serde::Deserialize, Default, Debug, PartialEq, Eq, - Hash, + Hash )] #[ethcall(name = "increment", abi = "increment()")] pub struct IncrementCall; @@ -200,11 +275,13 @@ pub mod counter { Clone, ::ethers::contract::EthCall, ::ethers::contract::EthDisplay, + serde::Serialize, + serde::Deserialize, Default, Debug, PartialEq, Eq, - Hash, + Hash )] #[ethcall(name = "number", abi = "number()")] pub struct NumberCall; @@ -213,18 +290,29 @@ pub mod counter { Clone, ::ethers::contract::EthCall, ::ethers::contract::EthDisplay, + serde::Serialize, + serde::Deserialize, Default, Debug, PartialEq, Eq, - Hash, + Hash )] #[ethcall(name = "setNumber", abi = "setNumber(uint256)")] pub struct SetNumberCall { pub new_number: ::ethers::core::types::U256, } ///Container type for all of the contract's call - #[derive(Clone, ::ethers::contract::EthAbiType, Debug, PartialEq, Eq, Hash)] + #[derive( + Clone, + ::ethers::contract::EthAbiType, + serde::Serialize, + serde::Deserialize, + Debug, + PartialEq, + Eq, + Hash + )] pub enum CounterCalls { Increment(IncrementCall), Number(NumberCall), @@ -235,13 +323,19 @@ pub mod counter { data: impl AsRef<[u8]>, ) -> ::core::result::Result { let data = data.as_ref(); - if let Ok(decoded) = ::decode(data) { + if let Ok(decoded) = ::decode( + data, + ) { return Ok(Self::Increment(decoded)); } - if let Ok(decoded) = ::decode(data) { + if let Ok(decoded) = ::decode( + data, + ) { return Ok(Self::Number(decoded)); } - if let Ok(decoded) = ::decode(data) { + if let Ok(decoded) = ::decode( + data, + ) { return Ok(Self::SetNumber(decoded)); } Err(::ethers::core::abi::Error::InvalidData.into()) @@ -250,9 +344,13 @@ pub mod counter { impl ::ethers::core::abi::AbiEncode for CounterCalls { fn encode(self) -> Vec { match self { - Self::Increment(element) => ::ethers::core::abi::AbiEncode::encode(element), + Self::Increment(element) => { + ::ethers::core::abi::AbiEncode::encode(element) + } Self::Number(element) => ::ethers::core::abi::AbiEncode::encode(element), - Self::SetNumber(element) => ::ethers::core::abi::AbiEncode::encode(element), + Self::SetNumber(element) => { + ::ethers::core::abi::AbiEncode::encode(element) + } } } } @@ -285,11 +383,13 @@ pub mod counter { Clone, ::ethers::contract::EthAbiType, ::ethers::contract::EthAbiCodec, + serde::Serialize, + serde::Deserialize, Default, Debug, PartialEq, Eq, - Hash, + Hash )] pub struct NumberReturn(pub ::ethers::core::types::U256); } diff --git a/src/bindings/mod.rs b/src/bindings/mod.rs index 868d7af..be18f2f 100644 --- a/src/bindings/mod.rs +++ b/src/bindings/mod.rs @@ -3,6 +3,4 @@ //! This is autogenerated code. //! Do not manually edit these files. //! These files may be overwritten by the codegen system at any time. -pub mod counter; -pub mod std_invariant; -pub mod std_style; +pub mod counter; \ No newline at end of file diff --git a/src/bindings/std_invariant.rs b/src/bindings/std_invariant.rs deleted file mode 100644 index 96d0601..0000000 --- a/src/bindings/std_invariant.rs +++ /dev/null @@ -1,691 +0,0 @@ -pub use std_invariant::*; -/// This module was auto-generated with ethers-rs Abigen. -/// More information at: -#[allow( - clippy::enum_variant_names, - clippy::too_many_arguments, - clippy::upper_case_acronyms, - clippy::type_complexity, - dead_code, - non_camel_case_types -)] -pub mod std_invariant { - #[allow(deprecated)] - fn __abi() -> ::ethers::core::abi::Abi { - ::ethers::core::abi::ethabi::Contract { - constructor: ::core::option::Option::None, - functions: ::core::convert::From::from([ - ( - ::std::borrow::ToOwned::to_owned("excludeArtifacts"), - ::std::vec![::ethers::core::abi::ethabi::Function { - name: ::std::borrow::ToOwned::to_owned("excludeArtifacts"), - inputs: ::std::vec![], - outputs: ::std::vec![::ethers::core::abi::ethabi::Param { - name: ::std::borrow::ToOwned::to_owned("excludedArtifacts_",), - kind: ::ethers::core::abi::ethabi::ParamType::Array( - ::std::boxed::Box::new( - ::ethers::core::abi::ethabi::ParamType::String, - ), - ), - internal_type: ::core::option::Option::Some( - ::std::borrow::ToOwned::to_owned("string[]"), - ), - },], - constant: ::core::option::Option::None, - state_mutability: ::ethers::core::abi::ethabi::StateMutability::View, - },], - ), - ( - ::std::borrow::ToOwned::to_owned("excludeContracts"), - ::std::vec![::ethers::core::abi::ethabi::Function { - name: ::std::borrow::ToOwned::to_owned("excludeContracts"), - inputs: ::std::vec![], - outputs: ::std::vec![::ethers::core::abi::ethabi::Param { - name: ::std::borrow::ToOwned::to_owned("excludedContracts_",), - kind: ::ethers::core::abi::ethabi::ParamType::Array( - ::std::boxed::Box::new( - ::ethers::core::abi::ethabi::ParamType::Address, - ), - ), - internal_type: ::core::option::Option::Some( - ::std::borrow::ToOwned::to_owned("address[]"), - ), - },], - constant: ::core::option::Option::None, - state_mutability: ::ethers::core::abi::ethabi::StateMutability::View, - },], - ), - ( - ::std::borrow::ToOwned::to_owned("excludeSenders"), - ::std::vec![::ethers::core::abi::ethabi::Function { - name: ::std::borrow::ToOwned::to_owned("excludeSenders"), - inputs: ::std::vec![], - outputs: ::std::vec![::ethers::core::abi::ethabi::Param { - name: ::std::borrow::ToOwned::to_owned("excludedSenders_"), - kind: ::ethers::core::abi::ethabi::ParamType::Array( - ::std::boxed::Box::new( - ::ethers::core::abi::ethabi::ParamType::Address, - ), - ), - internal_type: ::core::option::Option::Some( - ::std::borrow::ToOwned::to_owned("address[]"), - ), - },], - constant: ::core::option::Option::None, - state_mutability: ::ethers::core::abi::ethabi::StateMutability::View, - },], - ), - ( - ::std::borrow::ToOwned::to_owned("targetArtifactSelectors"), - ::std::vec![::ethers::core::abi::ethabi::Function { - name: ::std::borrow::ToOwned::to_owned("targetArtifactSelectors",), - inputs: ::std::vec![], - outputs: ::std::vec![::ethers::core::abi::ethabi::Param { - name: ::std::borrow::ToOwned::to_owned("targetedArtifactSelectors_",), - kind: ::ethers::core::abi::ethabi::ParamType::Array( - ::std::boxed::Box::new( - ::ethers::core::abi::ethabi::ParamType::Tuple(::std::vec![ - ::ethers::core::abi::ethabi::ParamType::Address, - ::ethers::core::abi::ethabi::ParamType::Array( - ::std::boxed::Box::new( - ::ethers::core::abi::ethabi::ParamType::FixedBytes( - 4usize - ), - ), - ), - ],), - ), - ), - internal_type: ::core::option::Option::Some( - ::std::borrow::ToOwned::to_owned( - "struct StdInvariant.FuzzSelector[]", - ), - ), - },], - constant: ::core::option::Option::None, - state_mutability: ::ethers::core::abi::ethabi::StateMutability::View, - },], - ), - ( - ::std::borrow::ToOwned::to_owned("targetArtifacts"), - ::std::vec![::ethers::core::abi::ethabi::Function { - name: ::std::borrow::ToOwned::to_owned("targetArtifacts"), - inputs: ::std::vec![], - outputs: ::std::vec![::ethers::core::abi::ethabi::Param { - name: ::std::borrow::ToOwned::to_owned("targetedArtifacts_",), - kind: ::ethers::core::abi::ethabi::ParamType::Array( - ::std::boxed::Box::new( - ::ethers::core::abi::ethabi::ParamType::String, - ), - ), - internal_type: ::core::option::Option::Some( - ::std::borrow::ToOwned::to_owned("string[]"), - ), - },], - constant: ::core::option::Option::None, - state_mutability: ::ethers::core::abi::ethabi::StateMutability::View, - },], - ), - ( - ::std::borrow::ToOwned::to_owned("targetContracts"), - ::std::vec![::ethers::core::abi::ethabi::Function { - name: ::std::borrow::ToOwned::to_owned("targetContracts"), - inputs: ::std::vec![], - outputs: ::std::vec![::ethers::core::abi::ethabi::Param { - name: ::std::borrow::ToOwned::to_owned("targetedContracts_",), - kind: ::ethers::core::abi::ethabi::ParamType::Array( - ::std::boxed::Box::new( - ::ethers::core::abi::ethabi::ParamType::Address, - ), - ), - internal_type: ::core::option::Option::Some( - ::std::borrow::ToOwned::to_owned("address[]"), - ), - },], - constant: ::core::option::Option::None, - state_mutability: ::ethers::core::abi::ethabi::StateMutability::View, - },], - ), - ( - ::std::borrow::ToOwned::to_owned("targetSelectors"), - ::std::vec![::ethers::core::abi::ethabi::Function { - name: ::std::borrow::ToOwned::to_owned("targetSelectors"), - inputs: ::std::vec![], - outputs: ::std::vec![::ethers::core::abi::ethabi::Param { - name: ::std::borrow::ToOwned::to_owned("targetedSelectors_",), - kind: ::ethers::core::abi::ethabi::ParamType::Array( - ::std::boxed::Box::new( - ::ethers::core::abi::ethabi::ParamType::Tuple(::std::vec![ - ::ethers::core::abi::ethabi::ParamType::Address, - ::ethers::core::abi::ethabi::ParamType::Array( - ::std::boxed::Box::new( - ::ethers::core::abi::ethabi::ParamType::FixedBytes( - 4usize - ), - ), - ), - ],), - ), - ), - internal_type: ::core::option::Option::Some( - ::std::borrow::ToOwned::to_owned( - "struct StdInvariant.FuzzSelector[]", - ), - ), - },], - constant: ::core::option::Option::None, - state_mutability: ::ethers::core::abi::ethabi::StateMutability::View, - },], - ), - ( - ::std::borrow::ToOwned::to_owned("targetSenders"), - ::std::vec![::ethers::core::abi::ethabi::Function { - name: ::std::borrow::ToOwned::to_owned("targetSenders"), - inputs: ::std::vec![], - outputs: ::std::vec![::ethers::core::abi::ethabi::Param { - name: ::std::borrow::ToOwned::to_owned("targetedSenders_"), - kind: ::ethers::core::abi::ethabi::ParamType::Array( - ::std::boxed::Box::new( - ::ethers::core::abi::ethabi::ParamType::Address, - ), - ), - internal_type: ::core::option::Option::Some( - ::std::borrow::ToOwned::to_owned("address[]"), - ), - },], - constant: ::core::option::Option::None, - state_mutability: ::ethers::core::abi::ethabi::StateMutability::View, - },], - ), - ]), - events: ::std::collections::BTreeMap::new(), - errors: ::std::collections::BTreeMap::new(), - receive: false, - fallback: false, - } - } - ///The parsed JSON ABI of the contract. - pub static STDINVARIANT_ABI: ::ethers::contract::Lazy<::ethers::core::abi::Abi> = - ::ethers::contract::Lazy::new(__abi); - pub struct StdInvariant(::ethers::contract::Contract); - impl ::core::clone::Clone for StdInvariant { - fn clone(&self) -> Self { - Self(::core::clone::Clone::clone(&self.0)) - } - } - impl ::core::ops::Deref for StdInvariant { - type Target = ::ethers::contract::Contract; - fn deref(&self) -> &Self::Target { - &self.0 - } - } - impl ::core::ops::DerefMut for StdInvariant { - fn deref_mut(&mut self) -> &mut Self::Target { - &mut self.0 - } - } - impl ::core::fmt::Debug for StdInvariant { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_tuple(::core::stringify!(StdInvariant)) - .field(&self.address()) - .finish() - } - } - impl StdInvariant { - /// Creates a new contract instance with the specified `ethers` client at - /// `address`. The contract derefs to a `ethers::Contract` object. - pub fn new>( - address: T, - client: ::std::sync::Arc, - ) -> Self { - Self(::ethers::contract::Contract::new( - address.into(), - STDINVARIANT_ABI.clone(), - client, - )) - } - ///Calls the contract's `excludeArtifacts` (0xb5508aa9) function - pub fn exclude_artifacts( - &self, - ) -> ::ethers::contract::builders::ContractCall> - { - self.0 - .method_hash([181, 80, 138, 169], ()) - .expect("method not found (this should never happen)") - } - ///Calls the contract's `excludeContracts` (0xe20c9f71) function - pub fn exclude_contracts( - &self, - ) -> ::ethers::contract::builders::ContractCall< - M, - ::std::vec::Vec<::ethers::core::types::Address>, - > { - self.0 - .method_hash([226, 12, 159, 113], ()) - .expect("method not found (this should never happen)") - } - ///Calls the contract's `excludeSenders` (0x1ed7831c) function - pub fn exclude_senders( - &self, - ) -> ::ethers::contract::builders::ContractCall< - M, - ::std::vec::Vec<::ethers::core::types::Address>, - > { - self.0 - .method_hash([30, 215, 131, 28], ()) - .expect("method not found (this should never happen)") - } - ///Calls the contract's `targetArtifactSelectors` (0x66d9a9a0) function - pub fn target_artifact_selectors( - &self, - ) -> ::ethers::contract::builders::ContractCall> { - self.0 - .method_hash([102, 217, 169, 160], ()) - .expect("method not found (this should never happen)") - } - ///Calls the contract's `targetArtifacts` (0x85226c81) function - pub fn target_artifacts( - &self, - ) -> ::ethers::contract::builders::ContractCall> - { - self.0 - .method_hash([133, 34, 108, 129], ()) - .expect("method not found (this should never happen)") - } - ///Calls the contract's `targetContracts` (0x3f7286f4) function - pub fn target_contracts( - &self, - ) -> ::ethers::contract::builders::ContractCall< - M, - ::std::vec::Vec<::ethers::core::types::Address>, - > { - self.0 - .method_hash([63, 114, 134, 244], ()) - .expect("method not found (this should never happen)") - } - ///Calls the contract's `targetSelectors` (0x916a17c6) function - pub fn target_selectors( - &self, - ) -> ::ethers::contract::builders::ContractCall> { - self.0 - .method_hash([145, 106, 23, 198], ()) - .expect("method not found (this should never happen)") - } - ///Calls the contract's `targetSenders` (0x3e5e3c23) function - pub fn target_senders( - &self, - ) -> ::ethers::contract::builders::ContractCall< - M, - ::std::vec::Vec<::ethers::core::types::Address>, - > { - self.0 - .method_hash([62, 94, 60, 35], ()) - .expect("method not found (this should never happen)") - } - } - impl From<::ethers::contract::Contract> for StdInvariant { - fn from(contract: ::ethers::contract::Contract) -> Self { - Self::new(contract.address(), contract.client()) - } - } - ///Container type for all input parameters for the `excludeArtifacts` function with signature `excludeArtifacts()` and selector `0xb5508aa9` - #[derive( - Clone, - ::ethers::contract::EthCall, - ::ethers::contract::EthDisplay, - Default, - Debug, - PartialEq, - Eq, - Hash, - )] - #[ethcall(name = "excludeArtifacts", abi = "excludeArtifacts()")] - pub struct ExcludeArtifactsCall; - ///Container type for all input parameters for the `excludeContracts` function with signature `excludeContracts()` and selector `0xe20c9f71` - #[derive( - Clone, - ::ethers::contract::EthCall, - ::ethers::contract::EthDisplay, - Default, - Debug, - PartialEq, - Eq, - Hash, - )] - #[ethcall(name = "excludeContracts", abi = "excludeContracts()")] - pub struct ExcludeContractsCall; - ///Container type for all input parameters for the `excludeSenders` function with signature `excludeSenders()` and selector `0x1ed7831c` - #[derive( - Clone, - ::ethers::contract::EthCall, - ::ethers::contract::EthDisplay, - Default, - Debug, - PartialEq, - Eq, - Hash, - )] - #[ethcall(name = "excludeSenders", abi = "excludeSenders()")] - pub struct ExcludeSendersCall; - ///Container type for all input parameters for the `targetArtifactSelectors` function with signature `targetArtifactSelectors()` and selector `0x66d9a9a0` - #[derive( - Clone, - ::ethers::contract::EthCall, - ::ethers::contract::EthDisplay, - Default, - Debug, - PartialEq, - Eq, - Hash, - )] - #[ethcall(name = "targetArtifactSelectors", abi = "targetArtifactSelectors()")] - pub struct TargetArtifactSelectorsCall; - ///Container type for all input parameters for the `targetArtifacts` function with signature `targetArtifacts()` and selector `0x85226c81` - #[derive( - Clone, - ::ethers::contract::EthCall, - ::ethers::contract::EthDisplay, - Default, - Debug, - PartialEq, - Eq, - Hash, - )] - #[ethcall(name = "targetArtifacts", abi = "targetArtifacts()")] - pub struct TargetArtifactsCall; - ///Container type for all input parameters for the `targetContracts` function with signature `targetContracts()` and selector `0x3f7286f4` - #[derive( - Clone, - ::ethers::contract::EthCall, - ::ethers::contract::EthDisplay, - Default, - Debug, - PartialEq, - Eq, - Hash, - )] - #[ethcall(name = "targetContracts", abi = "targetContracts()")] - pub struct TargetContractsCall; - ///Container type for all input parameters for the `targetSelectors` function with signature `targetSelectors()` and selector `0x916a17c6` - #[derive( - Clone, - ::ethers::contract::EthCall, - ::ethers::contract::EthDisplay, - Default, - Debug, - PartialEq, - Eq, - Hash, - )] - #[ethcall(name = "targetSelectors", abi = "targetSelectors()")] - pub struct TargetSelectorsCall; - ///Container type for all input parameters for the `targetSenders` function with signature `targetSenders()` and selector `0x3e5e3c23` - #[derive( - Clone, - ::ethers::contract::EthCall, - ::ethers::contract::EthDisplay, - Default, - Debug, - PartialEq, - Eq, - Hash, - )] - #[ethcall(name = "targetSenders", abi = "targetSenders()")] - pub struct TargetSendersCall; - ///Container type for all of the contract's call - #[derive(Clone, ::ethers::contract::EthAbiType, Debug, PartialEq, Eq, Hash)] - pub enum StdInvariantCalls { - ExcludeArtifacts(ExcludeArtifactsCall), - ExcludeContracts(ExcludeContractsCall), - ExcludeSenders(ExcludeSendersCall), - TargetArtifactSelectors(TargetArtifactSelectorsCall), - TargetArtifacts(TargetArtifactsCall), - TargetContracts(TargetContractsCall), - TargetSelectors(TargetSelectorsCall), - TargetSenders(TargetSendersCall), - } - impl ::ethers::core::abi::AbiDecode for StdInvariantCalls { - fn decode( - data: impl AsRef<[u8]>, - ) -> ::core::result::Result { - let data = data.as_ref(); - if let Ok(decoded) = - ::decode(data) - { - return Ok(Self::ExcludeArtifacts(decoded)); - } - if let Ok(decoded) = - ::decode(data) - { - return Ok(Self::ExcludeContracts(decoded)); - } - if let Ok(decoded) = - ::decode(data) - { - return Ok(Self::ExcludeSenders(decoded)); - } - if let Ok(decoded) = - ::decode(data) - { - return Ok(Self::TargetArtifactSelectors(decoded)); - } - if let Ok(decoded) = - ::decode(data) - { - return Ok(Self::TargetArtifacts(decoded)); - } - if let Ok(decoded) = - ::decode(data) - { - return Ok(Self::TargetContracts(decoded)); - } - if let Ok(decoded) = - ::decode(data) - { - return Ok(Self::TargetSelectors(decoded)); - } - if let Ok(decoded) = ::decode(data) - { - return Ok(Self::TargetSenders(decoded)); - } - Err(::ethers::core::abi::Error::InvalidData.into()) - } - } - impl ::ethers::core::abi::AbiEncode for StdInvariantCalls { - fn encode(self) -> Vec { - match self { - Self::ExcludeArtifacts(element) => ::ethers::core::abi::AbiEncode::encode(element), - Self::ExcludeContracts(element) => ::ethers::core::abi::AbiEncode::encode(element), - Self::ExcludeSenders(element) => ::ethers::core::abi::AbiEncode::encode(element), - Self::TargetArtifactSelectors(element) => { - ::ethers::core::abi::AbiEncode::encode(element) - } - Self::TargetArtifacts(element) => ::ethers::core::abi::AbiEncode::encode(element), - Self::TargetContracts(element) => ::ethers::core::abi::AbiEncode::encode(element), - Self::TargetSelectors(element) => ::ethers::core::abi::AbiEncode::encode(element), - Self::TargetSenders(element) => ::ethers::core::abi::AbiEncode::encode(element), - } - } - } - impl ::core::fmt::Display for StdInvariantCalls { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - match self { - Self::ExcludeArtifacts(element) => ::core::fmt::Display::fmt(element, f), - Self::ExcludeContracts(element) => ::core::fmt::Display::fmt(element, f), - Self::ExcludeSenders(element) => ::core::fmt::Display::fmt(element, f), - Self::TargetArtifactSelectors(element) => ::core::fmt::Display::fmt(element, f), - Self::TargetArtifacts(element) => ::core::fmt::Display::fmt(element, f), - Self::TargetContracts(element) => ::core::fmt::Display::fmt(element, f), - Self::TargetSelectors(element) => ::core::fmt::Display::fmt(element, f), - Self::TargetSenders(element) => ::core::fmt::Display::fmt(element, f), - } - } - } - impl ::core::convert::From for StdInvariantCalls { - fn from(value: ExcludeArtifactsCall) -> Self { - Self::ExcludeArtifacts(value) - } - } - impl ::core::convert::From for StdInvariantCalls { - fn from(value: ExcludeContractsCall) -> Self { - Self::ExcludeContracts(value) - } - } - impl ::core::convert::From for StdInvariantCalls { - fn from(value: ExcludeSendersCall) -> Self { - Self::ExcludeSenders(value) - } - } - impl ::core::convert::From for StdInvariantCalls { - fn from(value: TargetArtifactSelectorsCall) -> Self { - Self::TargetArtifactSelectors(value) - } - } - impl ::core::convert::From for StdInvariantCalls { - fn from(value: TargetArtifactsCall) -> Self { - Self::TargetArtifacts(value) - } - } - impl ::core::convert::From for StdInvariantCalls { - fn from(value: TargetContractsCall) -> Self { - Self::TargetContracts(value) - } - } - impl ::core::convert::From for StdInvariantCalls { - fn from(value: TargetSelectorsCall) -> Self { - Self::TargetSelectors(value) - } - } - impl ::core::convert::From for StdInvariantCalls { - fn from(value: TargetSendersCall) -> Self { - Self::TargetSenders(value) - } - } - ///Container type for all return fields from the `excludeArtifacts` function with signature `excludeArtifacts()` and selector `0xb5508aa9` - #[derive( - Clone, - ::ethers::contract::EthAbiType, - ::ethers::contract::EthAbiCodec, - Default, - Debug, - PartialEq, - Eq, - Hash, - )] - pub struct ExcludeArtifactsReturn { - pub excluded_artifacts: ::std::vec::Vec<::std::string::String>, - } - ///Container type for all return fields from the `excludeContracts` function with signature `excludeContracts()` and selector `0xe20c9f71` - #[derive( - Clone, - ::ethers::contract::EthAbiType, - ::ethers::contract::EthAbiCodec, - Default, - Debug, - PartialEq, - Eq, - Hash, - )] - pub struct ExcludeContractsReturn { - pub excluded_contracts: ::std::vec::Vec<::ethers::core::types::Address>, - } - ///Container type for all return fields from the `excludeSenders` function with signature `excludeSenders()` and selector `0x1ed7831c` - #[derive( - Clone, - ::ethers::contract::EthAbiType, - ::ethers::contract::EthAbiCodec, - Default, - Debug, - PartialEq, - Eq, - Hash, - )] - pub struct ExcludeSendersReturn { - pub excluded_senders: ::std::vec::Vec<::ethers::core::types::Address>, - } - ///Container type for all return fields from the `targetArtifactSelectors` function with signature `targetArtifactSelectors()` and selector `0x66d9a9a0` - #[derive( - Clone, - ::ethers::contract::EthAbiType, - ::ethers::contract::EthAbiCodec, - Default, - Debug, - PartialEq, - Eq, - Hash, - )] - pub struct TargetArtifactSelectorsReturn { - pub targeted_artifact_selectors: ::std::vec::Vec, - } - ///Container type for all return fields from the `targetArtifacts` function with signature `targetArtifacts()` and selector `0x85226c81` - #[derive( - Clone, - ::ethers::contract::EthAbiType, - ::ethers::contract::EthAbiCodec, - Default, - Debug, - PartialEq, - Eq, - Hash, - )] - pub struct TargetArtifactsReturn { - pub targeted_artifacts: ::std::vec::Vec<::std::string::String>, - } - ///Container type for all return fields from the `targetContracts` function with signature `targetContracts()` and selector `0x3f7286f4` - #[derive( - Clone, - ::ethers::contract::EthAbiType, - ::ethers::contract::EthAbiCodec, - Default, - Debug, - PartialEq, - Eq, - Hash, - )] - pub struct TargetContractsReturn { - pub targeted_contracts: ::std::vec::Vec<::ethers::core::types::Address>, - } - ///Container type for all return fields from the `targetSelectors` function with signature `targetSelectors()` and selector `0x916a17c6` - #[derive( - Clone, - ::ethers::contract::EthAbiType, - ::ethers::contract::EthAbiCodec, - Default, - Debug, - PartialEq, - Eq, - Hash, - )] - pub struct TargetSelectorsReturn { - pub targeted_selectors: ::std::vec::Vec, - } - ///Container type for all return fields from the `targetSenders` function with signature `targetSenders()` and selector `0x3e5e3c23` - #[derive( - Clone, - ::ethers::contract::EthAbiType, - ::ethers::contract::EthAbiCodec, - Default, - Debug, - PartialEq, - Eq, - Hash, - )] - pub struct TargetSendersReturn { - pub targeted_senders: ::std::vec::Vec<::ethers::core::types::Address>, - } - ///`FuzzSelector(address,bytes4[])` - #[derive( - Clone, - ::ethers::contract::EthAbiType, - ::ethers::contract::EthAbiCodec, - Default, - Debug, - PartialEq, - Eq, - Hash, - )] - pub struct FuzzSelector { - pub addr: ::ethers::core::types::Address, - pub selectors: ::std::vec::Vec<[u8; 4]>, - } -} diff --git a/src/bindings/std_style.rs b/src/bindings/std_style.rs deleted file mode 100644 index 44bf790..0000000 --- a/src/bindings/std_style.rs +++ /dev/null @@ -1,119 +0,0 @@ -pub use std_style::*; -/// This module was auto-generated with ethers-rs Abigen. -/// More information at: -#[allow( - clippy::enum_variant_names, - clippy::too_many_arguments, - clippy::upper_case_acronyms, - clippy::type_complexity, - dead_code, - non_camel_case_types -)] -pub mod std_style { - #[allow(deprecated)] - fn __abi() -> ::ethers::core::abi::Abi { - ::ethers::core::abi::ethabi::Contract { - constructor: ::core::option::Option::None, - functions: ::std::collections::BTreeMap::new(), - events: ::std::collections::BTreeMap::new(), - errors: ::std::collections::BTreeMap::new(), - receive: false, - fallback: false, - } - } - ///The parsed JSON ABI of the contract. - pub static STDSTYLE_ABI: ::ethers::contract::Lazy<::ethers::core::abi::Abi> = - ::ethers::contract::Lazy::new(__abi); - #[rustfmt::skip] - const __BYTECODE: &[u8] = b"`\xB2`7`\x0B\x82\x82\x829\x80Q`\0\x1A`s\x14`*WcNH{q`\xE0\x1B`\0R`\0`\x04R`$`\0\xFD[0`\0R`s\x81S\x82\x81\xF3\xFEs\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0`\x80`@\x81\x90RbF\x1B\xCD`\xE5\x1B\x81R` `\x84\x90\x81R`5`\xA4R\x7FContract does not have fallback `\xC4\x90\x81Rtnor receive functions`X\x1B`\xE4R0\x93\x90\x93\x14\x92\x90\x82\xFD\xFE\xA2dipfsX\"\x12 p\x97v3\xCAd\x9F]\xD7\x99o\x12\x1Ccp\xC7]Vc\xB2(\x1C\xB5\x13\r\xCC\x98\xCDn\x8D\xCA\xA7dsolcC\0\x08\x13\x003"; - /// The bytecode of the contract. - pub static STDSTYLE_BYTECODE: ::ethers::core::types::Bytes = - ::ethers::core::types::Bytes::from_static(__BYTECODE); - #[rustfmt::skip] - const __DEPLOYED_BYTECODE: &[u8] = b"s\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0`\x80`@\x81\x90RbF\x1B\xCD`\xE5\x1B\x81R` `\x84\x90\x81R`5`\xA4R\x7FContract does not have fallback `\xC4\x90\x81Rtnor receive functions`X\x1B`\xE4R0\x93\x90\x93\x14\x92\x90\x82\xFD\xFE\xA2dipfsX\"\x12 p\x97v3\xCAd\x9F]\xD7\x99o\x12\x1Ccp\xC7]Vc\xB2(\x1C\xB5\x13\r\xCC\x98\xCDn\x8D\xCA\xA7dsolcC\0\x08\x13\x003"; - /// The deployed bytecode of the contract. - pub static STDSTYLE_DEPLOYED_BYTECODE: ::ethers::core::types::Bytes = - ::ethers::core::types::Bytes::from_static(__DEPLOYED_BYTECODE); - pub struct StdStyle(::ethers::contract::Contract); - impl ::core::clone::Clone for StdStyle { - fn clone(&self) -> Self { - Self(::core::clone::Clone::clone(&self.0)) - } - } - impl ::core::ops::Deref for StdStyle { - type Target = ::ethers::contract::Contract; - fn deref(&self) -> &Self::Target { - &self.0 - } - } - impl ::core::ops::DerefMut for StdStyle { - fn deref_mut(&mut self) -> &mut Self::Target { - &mut self.0 - } - } - impl ::core::fmt::Debug for StdStyle { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_tuple(::core::stringify!(StdStyle)) - .field(&self.address()) - .finish() - } - } - impl StdStyle { - /// Creates a new contract instance with the specified `ethers` client at - /// `address`. The contract derefs to a `ethers::Contract` object. - pub fn new>( - address: T, - client: ::std::sync::Arc, - ) -> Self { - Self(::ethers::contract::Contract::new( - address.into(), - STDSTYLE_ABI.clone(), - client, - )) - } - /// Constructs the general purpose `Deployer` instance based on the provided constructor arguments and sends it. - /// Returns a new instance of a deployer that returns an instance of this contract after sending the transaction - /// - /// Notes: - /// - If there are no constructor arguments, you should pass `()` as the argument. - /// - The default poll duration is 7 seconds. - /// - The default number of confirmations is 1 block. - /// - /// - /// # Example - /// - /// Generate contract bindings with `abigen!` and deploy a new contract instance. - /// - /// *Note*: this requires a `bytecode` and `abi` object in the `greeter.json` artifact. - /// - /// ```ignore - /// # async fn deploy(client: ::std::sync::Arc) { - /// abigen!(Greeter, "../greeter.json"); - /// - /// let greeter_contract = Greeter::deploy(client, "Hello world!".to_string()).unwrap().send().await.unwrap(); - /// let msg = greeter_contract.greet().call().await.unwrap(); - /// # } - /// ``` - pub fn deploy( - client: ::std::sync::Arc, - constructor_args: T, - ) -> ::core::result::Result< - ::ethers::contract::builders::ContractDeployer, - ::ethers::contract::ContractError, - > { - let factory = ::ethers::contract::ContractFactory::new( - STDSTYLE_ABI.clone(), - STDSTYLE_BYTECODE.clone().into(), - client, - ); - let deployer = factory.deploy(constructor_args)?; - let deployer = ::ethers::contract::ContractDeployer::new(deployer); - Ok(deployer) - } - } - impl From<::ethers::contract::Contract> for StdStyle { - fn from(contract: ::ethers::contract::Contract) -> Self { - Self::new(contract.address(), contract.client()) - } - } -} diff --git a/src/config/counter.toml b/src/config/counter.toml new file mode 100644 index 0000000..28b5157 --- /dev/null +++ b/src/config/counter.toml @@ -0,0 +1,38 @@ +simulation = "Counter" +output_directory = "analysis/counter" + +[trajectory] +# The type of price process to use. +process = "gbm" +# The number of steps in the process. +num_steps = 36500 +# Starting seed for the price processes +seed = 10 +# The number of distinct paths to use +num_paths = 10 +# The initial price of the asset. +[trajectory.initial_price] +fixed = 1.0 +# The start time of the process. +[trajectory.t_0] +fixed = 0.0 +# The end time of the process. +[trajectory.t_n] +fixed = 10.0 + +[gbm] +# The drift of the process. +[gbm.drift] +fixed = 0.0 +# start = -1.0 +# end = 1.0 +# steps = 11 +# The volatility of the process. +[gbm.volatility] +# start = 0.1 +# end = 1.0 +# steps = 10 +fixed = 0.5 + +[block] +timestep_size = 15 diff --git a/src/config/gbm.toml b/src/config/gbm.toml new file mode 100644 index 0000000..67d7b7c --- /dev/null +++ b/src/config/gbm.toml @@ -0,0 +1,38 @@ +simulation = "SimulatedPricePath" +output_directory = "analysis/prices" + +[trajectory] +# The type of price process to use. +process = "gbm" +# The number of steps in the process. +num_steps = 36500 +# Starting seed for the price processes +seed = 10 +# The number of distinct paths to use +num_paths = 10 +# The initial price of the asset. +[trajectory.initial_price] +fixed = 1.0 +# The start time of the process. +[trajectory.t_0] +fixed = 0.0 +# The end time of the process. +[trajectory.t_n] +fixed = 10.0 + +[gbm] +# The drift of the process. +[gbm.drift] +fixed = 0.0 +# start = -1.0 +# end = 1.0 +# steps = 11 +# The volatility of the process. +[gbm.volatility] +# start = 0.1 +# end = 1.0 +# steps = 10 +fixed = 0.5 + +[block] +timestep_size = 15 diff --git a/src/main.rs b/src/main.rs index 620ac65..bf6fffc 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,104 +1,52 @@ -use std::str::FromStr; - -use anyhow::{Ok, Result}; -use arbiter_core::{ - bindings::weth, - environment::{builder::EnvironmentBuilder, fork::Fork}, - middleware::RevmMiddleware, -}; -use ethers::{providers::Middleware, types::Address}; - -use crate::bindings::counter::Counter; - -#[allow(unused_imports)] -mod bindings; - -const FORK_PATH: &str = "fork_example/test.json"; - -#[tokio::main] -pub async fn main() -> Result<()> { - // these are examples you can run - counter_example().await?; - // load_eoa_from_disk().await?; - // load_contract_from_fork().await?; - Ok(()) +use std::time::Instant; + +use anyhow::Result; +use clap::{ArgAction, CommandFactory, Parser, Subcommand}; + +pub mod simulations; +pub mod settings; +pub mod agents; +pub mod bindings; + +/// Represents command-line arguments passed to the `Arbiter` tool. +#[derive(Parser)] +#[clap(name = "Excalibur")] +#[clap(version = env!("CARGO_PKG_VERSION"))] +#[clap(about = "Simulation driven development.", long_about = None)] +#[clap(author)] +struct Args { + /// Defines the subcommand to execute. + #[command(subcommand)] + command: Option, + + #[clap(short, long, global = true, required = false, action = ArgAction::Count, value_parser( + clap::value_parser!(u8)))] + verbose: Option, } -// This is an example of deploying a contract and then mutating its state -pub async fn counter_example() -> Result<()> { - let environment = EnvironmentBuilder::new().build(); - - let client_with_signer = RevmMiddleware::new(&environment, None)?; - - println!( - "created client with address {:?}", - client_with_signer.address() - ); - - let counter = Counter::deploy(client_with_signer.clone(), ())? - .send() - .await?; - println!("Counter contract deployed at {:?}", counter.address()); - - for index in 0..10 { - let _ = counter.increment().send().await?.await?; - println!("Counter incremented to {}", index + 1); - } - // post state mutation call to show that the state has changed with send - let count = counter.number().call().await?; - println!("Counter count is {}", count); - Ok(()) +/// Defines available subcommands for the `Arbiter` tool. +#[derive(Subcommand)] +enum Commands { + /// Represents the `Bind` subcommand. + Simulate { + #[clap(index = 1, default_value = "src/config/gbm.toml")] + config_path: String, + }, } -// This is an example of loading an eoa from disk and then using it to deploy a contract -// Note: you need to have forked state written to disk with arbiter fork command -pub async fn load_eoa_from_disk() -> Result<()> { - let fork = Fork::from_disk(FORK_PATH).unwrap(); - - // Get the environment going - let environment = EnvironmentBuilder::new().db(fork.db).build(); - - // grab vitaliks address and create a client with it - let vitalik_address = fork.eoa.get("vitalik").unwrap(); - let vitalik_as_a_client = RevmMiddleware::new_from_forked_eoa(&environment, *vitalik_address)?; - - // test a state mutating call from the forked eoa - let weth = weth::WETH::deploy(vitalik_as_a_client.clone(), ()) - .unwrap() - .send() - .await?; - println!("vitalik deployed the weth contract as {:?}", weth.address()); - - // test a non mutating call from the forked eoa - let eth_balance = vitalik_as_a_client - .get_balance(*vitalik_address, None) - .await - .unwrap(); - println!("vitalik has {} eth", eth_balance); +fn main() -> Result<()> { + let args = Args::parse(); + + match &args.command { + Some(Commands::Simulate { config_path }) => { + println!("Reading from config path: {}", config_path); + let start = Instant::now(); + simulations::batch(config_path)?; + let duration = start.elapsed(); + println!("Total duration of simulations: {:?}", duration); + } + None => Args::command().print_long_help()?, + } Ok(()) } -// This is an example of loading a contract from disk with it's state -// Note: you need to have forked state written to disk with arbiter fork command -pub async fn load_contract_from_fork() -> Result<()> { - // Create fork from - let fork = Fork::from_disk(FORK_PATH)?; - - // Get the environment going - let environment = EnvironmentBuilder::new().db(fork.db).build(); - - // Create a client - let client = RevmMiddleware::new(&environment, Some("name"))?; - - // Deal with the weth contract - let weth_meta = fork.contracts_meta.get("weth").unwrap(); - let weth = weth::WETH::new(weth_meta.address, client.clone()); - - let address_to_check_balance = - Address::from_str(&weth_meta.mappings.get("balanceOf").unwrap()[0])?; - - println!("checking address: {}", address_to_check_balance); - let balance = weth.balance_of(address_to_check_balance).call().await?; - println!("balance is {}", balance); - Ok(()) -} diff --git a/src/settings/mod.rs b/src/settings/mod.rs new file mode 100644 index 0000000..2af4dc3 --- /dev/null +++ b/src/settings/mod.rs @@ -0,0 +1,68 @@ +pub mod parameters; +use std::{env, path::Path}; + +use parameters::*; + +use crate::simulations::SimulationType; +use serde::{Deserialize, Serialize}; +use config::{Config, ConfigError}; + +#[derive(Clone, Debug, Serialize, Deserialize)] +pub struct SimulationConfig> { + pub simulation: SimulationType, + pub max_parallel: Option, + pub output_directory: String, + pub output_file_name: Option, + pub trajectory: TrajectoryParameters

, + pub gbm: Option>, + pub block: BlockParameters, +} + +impl SimulationConfig { + pub fn new(config_path: &str) -> Result { + let s = Config::builder() + .add_source(config::File::with_name(config_path)) + .build()?; + s.try_deserialize() + } +} + +impl Parameterized> for SimulationConfig { + fn generate(&self) -> Vec> { + let mut result = vec![]; + let trajectories = self.trajectory.generate(); + + let gbms = self + .gbm + .as_ref() + .map(|gbm| gbm.generate()) + .unwrap_or_default(); + + if gbms.is_empty() { + panic!("You must supply either a gbm configuration."); + } + + for trajectory in &trajectories { + for gbm in &gbms { + let output_directory = self.output_directory.clone() + + "/gbm_drift=" + + &gbm.drift.0.to_string() + + "_vol=" + + &gbm.volatility.0.to_string(); + let output_file_name = + format!("trajectory={}", trajectory.output_tag.clone().unwrap()); + result.push(SimulationConfig { + simulation: self.simulation, + max_parallel: None, + output_directory, + output_file_name: Some(output_file_name), + trajectory: trajectory.clone(), + gbm: Some(*gbm), + block: self.block, + }); + } + } + + result + } +} \ No newline at end of file diff --git a/src/settings/parameters.rs b/src/settings/parameters.rs new file mode 100644 index 0000000..fcc7725 --- /dev/null +++ b/src/settings/parameters.rs @@ -0,0 +1,159 @@ +use std::{collections::hash_map::DefaultHasher, hash::Hasher}; + +use super::*; +pub trait Parameterized { + fn generate(&self) -> Vec; +} + +#[derive(Copy, Clone, Debug, Serialize, Deserialize, PartialEq)] +pub struct Fixed(pub f64); +impl Parameterized for Fixed { + fn generate(&self) -> Vec { + vec![self.0] + } +} + +#[derive(Copy, Clone, Debug, Serialize, Deserialize)] +pub struct Meta(LinspaceParameters); +impl Parameterized for Meta { + fn generate(&self) -> Vec { + self.0.generate() + } +} + +#[derive(Copy, Clone, Debug, Serialize, Deserialize)] +pub struct LinspaceParameters { + pub start: Option, + pub end: Option, + pub steps: Option, + pub fixed: Option, +} + +impl LinspaceParameters { + fn generate(&self) -> Vec { + // Check if start, end, steps are all Some + match (self.start, self.end, self.steps) { + (Some(start), Some(end), Some(steps)) => { + if self.fixed.is_some() { + panic!("Both linspace and fixed parameters are set"); + } + let step_size = (end - start) / (steps as f64 - 1.0); + (0..steps).map(|i| start + step_size * i as f64).collect() + } + // If only fixed is Some, return a vec with that fixed value + (_, _, _) if self.fixed.is_some() => vec![self.fixed.unwrap()], + // Otherwise, configuration is invalid + _ => panic!("Invalid configuration for LinspaceParameters. Please provide a `start`, `end`, and `steps` or alternatively just provide a `fixed` value."), + } + } +} + +#[derive(Copy, Clone, Debug, Serialize, Deserialize)] +pub struct BlockParameters { + pub timestep_size: u64, +} + +#[derive(Clone, Debug, Serialize, Deserialize)] +pub struct TrajectoryParameters> { + pub process: String, + /// The initial price of the asset. + pub initial_price: P, + /// The start time of the process. + pub t_0: P, + /// The end time of the process. + pub t_n: P, + /// The number of steps in the process. + pub num_steps: usize, + pub num_paths: usize, + pub seed: u64, + pub output_tag: Option, +} + +impl Parameterized> for TrajectoryParameters { + fn generate(&self) -> Vec> { + let initial_price = self.initial_price.generate(); + let t_0 = self.t_0.generate(); + let t_n = self.t_n.generate(); + let mut result = vec![]; + let mut hasher = DefaultHasher::new(); + let mut seed = self.seed; + for p in initial_price { + for t0 in t_0.clone() { + for tn in t_n.clone() { + for index in 0..self.num_paths { + result.push(TrajectoryParameters { + process: self.process.clone(), + initial_price: Fixed(p), + t_0: Fixed(t0), + t_n: Fixed(tn), + num_steps: self.num_steps, + num_paths: 1, + seed, + output_tag: Some(index.to_string()), + }); + hasher.write_u64(seed); + seed = hasher.finish(); + } + } + } + } + result + } +} + +#[derive(Copy, Clone, Debug, Serialize, Deserialize)] +pub struct GBMParameters> { + // The drift of the process. + pub drift: P, + // The volatility of the process. + pub volatility: P, +} + +impl Parameterized> for GBMParameters { + fn generate(&self) -> Vec> { + let drift = self.drift.generate(); + let volatility = self.volatility.generate(); + let mut result = vec![]; + for d in drift { + for v in volatility.clone() { + result.push(GBMParameters { + drift: Fixed(d), + volatility: Fixed(v), + }); + } + } + result + } +} + +#[derive(Copy, Clone, Debug, Serialize, Deserialize)] +pub struct OUParameters> { + /// The mean (price) of the process. + pub mean: P, + /// The standard deviation of the process. + pub std_dev: P, + /// The theta parameter of the process. + /// This describes how strongly the process will revert to the mean. + pub theta: P, +} + +impl Parameterized> for OUParameters { + fn generate(&self) -> Vec> { + let mean = self.mean.generate(); + let std_dev = self.std_dev.generate(); + let theta = self.theta.generate(); + let mut result = vec![]; + for m in mean { + for s in std_dev.clone() { + for t in theta.clone() { + result.push(OUParameters { + mean: Fixed(m), + std_dev: Fixed(s), + theta: Fixed(t), + }); + } + } + } + result + } +} diff --git a/src/simulations/counter.rs b/src/simulations/counter.rs new file mode 100644 index 0000000..1037a2d --- /dev/null +++ b/src/simulations/counter.rs @@ -0,0 +1,34 @@ +use arbiter_core::{data_collection::EventLogger, environment::builder::{BlockSettings, EnvironmentBuilder}}; + +use crate::{ + agents::{ + block_admin::BlockAdmin, + counter_agent::CounterAgent, + Agents, + }, + settings::SimulationConfig, +}; +use super::*; + +pub async fn setup(config: SimulationConfig) -> Result { + let environment = EnvironmentBuilder::new() + .block_settings(BlockSettings::UserControlled) + .build(); + + let block_admin = BlockAdmin::new(&environment, &config).await?; + let counter_agent = CounterAgent::new(&environment).await?; + + EventLogger::builder() + .directory(config.output_directory) + .file_name(config.output_file_name.unwrap()) + .add(counter_agent.counter.events(), "counter") + .run()?; + + Ok(Simulation { + agents: Agents::new() + .add(block_admin) + .add(counter_agent), + steps: config.trajectory.num_steps, + environment, + }) +} diff --git a/src/simulations/mod.rs b/src/simulations/mod.rs new file mode 100644 index 0000000..faab844 --- /dev/null +++ b/src/simulations/mod.rs @@ -0,0 +1,128 @@ +use arbiter_core::environment::Environment; +use std::sync::Arc; +use tokio::sync::Semaphore; +use serde::{Serialize, Deserialize}; + +use super::*; +use crate::{ + agents::{Agent, Agents}, + settings::parameters::Fixed, +}; + +pub mod price_path_simulation; +pub mod counter; + +use settings::parameters::Parameterized; +use tokio::runtime::Builder; +use crate::settings::SimulationConfig; +use anyhow::Result; + +pub struct Simulation { + pub agents: Agents, + pub steps: usize, + environment: Environment, +} + +#[derive(Copy, Clone, Debug, Serialize, Deserialize, PartialEq, Eq)] +pub enum SimulationType { + SimulatedPricePath, + Counter +} + +impl SimulationType { + async fn run(config: SimulationConfig) -> Result<()> { + let simulation = match config.simulation { + SimulationType::SimulatedPricePath => price_path_simulation::setup(config.clone()).await?, + SimulationType::Counter => counter::setup(config.clone()).await?, + }; + match looper(simulation.agents, simulation.steps).await { + Result::Ok(_) => { + simulation.environment.stop()?; + Ok(()) + } + Err(e) => { + let metadata = format!( + "{}_{}", + config.output_directory, + config.output_file_name.unwrap() + ); + let error_string = format!("Error in simulation `{:?}`: {:?}", metadata, e); + simulation.environment.stop()?; + Err(e) + } + } + } +} + + +pub fn batch(config_path: &str) -> Result<()> { + let config = SimulationConfig::new(config_path)?; + + let direct_configs: Vec> = config.generate(); + + // Create a multi-threaded runtime + let rt = Builder::new_multi_thread().build()?; + + // Create a semaphore with a given number of permits + let semaphore = config + .max_parallel + .map(|max_parallel| Arc::new(Semaphore::new(max_parallel))); + + rt.block_on(async { + let mut handles = vec![]; + let errors = Arc::new(tokio::sync::Mutex::new(vec![])); + + for config in direct_configs { + let errors_clone = errors.clone(); + let semaphore_clone = semaphore.clone(); + handles.push(tokio::spawn(async move { + // Acquire a permit inside the spawned task + let permit = if let Some(ref semaphore_clone) = semaphore_clone { + // Acquire a permit outside the spawned task + let permit = semaphore_clone.acquire().await.unwrap(); + Some(permit) + } else { + None + }; + + let result = SimulationType::run(config).await; + match result { + Err(e) => { + let mut errors_clone_lock = errors_clone.lock().await; + errors_clone_lock.push(e); + // Drop the permit when the simulation is done. + drop(permit); + } + Result::Ok(_) => { + drop(permit); + } + } + })); + } + + for handle in handles { + handle.await?; + } + + Ok(()) + }) +} + +pub async fn looper(mut agents: Agents, steps: usize) -> Result<()> { + + for agent in agents.iter_mut() { + agent.startup().await?; + } + + for _ in 0..steps { + for agent in agents.iter_mut() { + agent.priority_step().await?; + } + + for agent in agents.iter_mut() { + agent.step().await?; + } + } + + Ok(()) +} \ No newline at end of file diff --git a/src/simulations/price_path_simulation.rs b/src/simulations/price_path_simulation.rs new file mode 100644 index 0000000..84546e8 --- /dev/null +++ b/src/simulations/price_path_simulation.rs @@ -0,0 +1,35 @@ +use arbiter_core::{data_collection::EventLogger, environment::builder::{BlockSettings, EnvironmentBuilder}}; + +use crate::{ + agents::{ + block_admin::BlockAdmin, + price_changer::PriceChanger, token_admin::TokenAdmin, + Agent, Agents, + }, + settings::SimulationConfig, +}; +use super::*; + +pub async fn setup(config: SimulationConfig) -> Result { + let environment = EnvironmentBuilder::new() + .block_settings(BlockSettings::UserControlled) + .build(); + + let block_admin = BlockAdmin::new(&environment, &config).await?; + let token_admin = TokenAdmin::new(&environment).await?; + let price_changer = PriceChanger::new(&environment, &token_admin, &config).await?; + + EventLogger::builder() + .directory(config.output_directory) + .file_name(config.output_file_name.unwrap()) + .add(price_changer.liquid_exchange.events(), "lex") + .run()?; + + Ok(Simulation { + agents: Agents::new() + .add(price_changer) + .add(block_admin), + steps: config.trajectory.num_steps, + environment, + }) +} diff --git a/test/Counter.t.sol b/test/Counter.t.sol deleted file mode 100644 index 23ec0bd..0000000 --- a/test/Counter.t.sol +++ /dev/null @@ -1,24 +0,0 @@ -// SPDX-License-Identifier: UNLICENSED -pragma solidity ^0.8.13; - -import "forge-std/Test.sol"; -import "../contracts/Counter.sol"; - -contract CounterTest is Test { - Counter public counter; - - function setUp() public { - counter = new Counter(); - counter.setNumber(0); - } - - function testIncrement() public { - counter.increment(); - assertEq(counter.number(), 1); - } - - function testSetNumber(uint256 x) public { - counter.setNumber(x); - assertEq(counter.number(), x); - } -}