diff --git a/bridge-token-factory/Cargo.lock b/bridge-token-factory/Cargo.lock index d6e4468a..83fc2c3c 100644 --- a/bridge-token-factory/Cargo.lock +++ b/bridge-token-factory/Cargo.lock @@ -9,16 +9,22 @@ checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3" [[package]] name = "admin-controlled" version = "0.1.0" -source = "git+https://github.com/near/rainbow-bridge.git?rev=ca01d9e39403a08397de63fb5ae544f760ffcedd#ca01d9e39403a08397de63fb5ae544f760ffcedd" +source = "git+https://github.com/near/rainbow-bridge?rev=3a60b7eac2f06d160bd7b20b67a181961c08055d#3a60b7eac2f06d160bd7b20b67a181961c08055d" dependencies = [ - "near-sdk", + "near-sdk 3.0.0-pre.3 (git+https://github.com/near/near-sdk-rs?rev=613adcab6322e4f830efb4d5bde2a810ae642158)", ] +[[package]] +name = "ahash" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "739f4a8db6605981345c5654f3a85b056ce52f37a39d34da03f25bf2151ea16e" + [[package]] name = "aho-corasick" -version = "0.7.13" +version = "0.7.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "043164d8ba5c4c3035fec9bbee8647c0261d788f3474306f93bb65901cae0e86" +checksum = "7404febffaa47dac81aa44dba71523c9d069b1bdc50a77db41195149e17f68e5" dependencies = [ "memchr", ] @@ -40,9 +46,29 @@ checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" [[package]] name = "arrayvec" -version = "0.5.1" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" + +[[package]] +name = "async-mutex" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "479db852db25d9dbf6204e6cb6253698f175c15726470f78af0d918e99d6156e" +dependencies = [ + "event-listener", +] + +[[package]] +name = "async-trait" +version = "0.1.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cff77d8686867eceff3105329d4698d96c2391c176d5d03adc90c7389162b5b8" +checksum = "8d3a45e77e34375a7923b1e8febb049bb011f064714a8e17a1a616fef01da13d" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] [[package]] name = "atty" @@ -57,9 +83,9 @@ dependencies = [ [[package]] name = "autocfg" -version = "1.0.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d" +checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" [[package]] name = "base64" @@ -67,11 +93,17 @@ version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b41b7ea54a0c9d92199de89e20e58d49f02f8e699814ef3fdf266f6f748d15c7" +[[package]] +name = "base64" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" + [[package]] name = "bincode" -version = "1.3.1" +version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f30d3a39baa26f9651f17b375061f3233dde33424a8b72b0dbe93a68a0bc896d" +checksum = "d175dfa69e619905c4c3cdb7c3c203fa3bdd5d51184e3afdb2742c0280493772" dependencies = [ "byteorder", "serde", @@ -79,13 +111,13 @@ dependencies = [ [[package]] name = "bindgen" -version = "0.54.1" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4d49b80beb70d76cdac92f5681e666f9a697c737c4f4117a67229a0386dc736" +checksum = "66c0bb6167449588ff70803f4127f0684f9063097eca5016f37eb52b92c2cf36" dependencies = [ "bitflags", "cexpr", - "cfg-if", + "cfg-if 0.1.10", "clang-sys", "clap", "env_logger", @@ -114,113 +146,91 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "41262f11d771fd4a61aa3ce019fca363b4b6c282fca9da2a31186d3965a47a5c" dependencies = [ "either", - "radium", + "radium 0.3.0", +] + +[[package]] +name = "bitvec" +version = "0.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f682656975d3a682daff957be4ddeb65d6ad656737cd821f2d00685ae466af1" +dependencies = [ + "funty", + "radium 0.6.2", + "tap", + "wyz", ] [[package]] name = "blake2" -version = "0.8.1" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94cb07b0da6a73955f8fb85d24c466778e70cda767a568229b104f0264089330" +checksum = "10a5720225ef5daecf08657f23791354e1685a8c91a4c60c7f3d3b2892f978f4" dependencies = [ - "byte-tools", - "crypto-mac 0.7.0", - "digest 0.8.1", + "crypto-mac", + "digest 0.9.0", "opaque-debug", ] [[package]] name = "blake3" -version = "0.3.6" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce4f9586c9a3151c4b49b19e82ba163dd073614dd057e53c969e1a4db5b52720" +checksum = "e9ff35b701f3914bdb8fad3368d822c766ef2858b2583198e41639b936f09d3f" dependencies = [ "arrayref", "arrayvec", "cc", - "cfg-if", + "cfg-if 0.1.10", "constant_time_eq", - "crypto-mac 0.8.0", + "crypto-mac", "digest 0.9.0", ] [[package]] name = "block-buffer" -version = "0.7.3" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b" +checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" dependencies = [ "block-padding", - "byte-tools", - "byteorder", - "generic-array 0.12.3", + "generic-array 0.14.4", ] [[package]] name = "block-padding" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa79dedbb091f449f1f39e53edf88d5dbe95f895dae6135a8d7b881fb5af73f5" -dependencies = [ - "byte-tools", -] - -[[package]] -name = "borsh" -version = "0.6.2" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7769f8f6fdc6ac7617bbc8bc7ef9dc263cd459d99d21cf2ab4afc3bc8d7d70d" -dependencies = [ - "borsh-derive 0.6.2", -] +checksum = "8d696c370c750c948ada61c69a0ee2cbbb9c50b1019ddb86d9317157a99c2cae" [[package]] name = "borsh" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30f3fd65922359a7c6e791bc9b2bba1b977ea0c0b96a528ac48007f535fb4184" -dependencies = [ - "borsh-derive 0.7.1", -] - -[[package]] -name = "borsh-derive" -version = "0.6.2" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2689a82a5fe57f9e71997b16bea340da338c7fb8db400b8d9d55b59010540d8" +checksum = "09a7111f797cc721407885a323fb071636aee57f750b1a4ddc27397eba168a74" dependencies = [ - "borsh-derive-internal 0.6.2", - "borsh-schema-derive-internal 0.6.2", - "syn", + "borsh-derive", + "hashbrown", ] [[package]] name = "borsh-derive" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2d74755d937d261d5e9bdef87e0addfbc1ace0214f7776f21532d6e97325356" -dependencies = [ - "borsh-derive-internal 0.7.1", - "borsh-schema-derive-internal 0.7.1", - "syn", -] - -[[package]] -name = "borsh-derive-internal" -version = "0.6.2" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39b621f19e9891a34f679034fa2238260e27c0eddfe2804e9fb282061cf9b294" +checksum = "307f3740906bac2c118a8122fe22681232b244f1369273e45f1156b45c43d2dd" dependencies = [ + "borsh-derive-internal", + "borsh-schema-derive-internal", + "proc-macro-crate", "proc-macro2", - "quote", "syn", ] [[package]] name = "borsh-derive-internal" -version = "0.7.1" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c9f966cb7a42c8ed83546ef481bc1d1dec888fe5f84a4737d5c2094a483e41e" +checksum = "d2104c73179359431cc98e016998f2f23bc7a05bc53e79741bcba705f30047bc" dependencies = [ "proc-macro2", "quote", @@ -229,9 +239,9 @@ dependencies = [ [[package]] name = "borsh-schema-derive-internal" -version = "0.6.2" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "befebdb9e223ae4528b3d597dbbfb5c68566822d2a3de3e260f235360773ba29" +checksum = "ae29eb8418fcd46f723f8691a2ac06857d31179d33d2f2d91eb13967de97c728" dependencies = [ "proc-macro2", "quote", @@ -239,14 +249,12 @@ dependencies = [ ] [[package]] -name = "borsh-schema-derive-internal" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5df2543b56ebc2b4493e70d024ebde2cbb48d97bf7b1a16318eff30bd02669b8" +name = "bridge-token" +version = "0.1.0" dependencies = [ - "proc-macro2", - "quote", - "syn", + "admin-controlled", + "near-contract-standards 3.0.0-pre.3 (git+https://github.com/near/near-sdk-rs?rev=613adcab6322e4f830efb4d5bde2a810ae642158)", + "near-sdk 3.0.0-pre.3 (git+https://github.com/near/near-sdk-rs?rev=613adcab6322e4f830efb4d5bde2a810ae642158)", ] [[package]] @@ -254,28 +262,29 @@ name = "bridge-token-factory" version = "0.1.0" dependencies = [ "admin-controlled", - "borsh 0.6.2", + "bridge-token", "eth-types", "ethabi", "hex", "lazy_static", - "near-lib", - "near-sdk", - "near-test", - "rand", - "rlp", + "mock-prover", + "near-contract-standards 3.0.0-pre.3 (git+https://github.com/near/near-sdk-rs?rev=613adcab6322e4f830efb4d5bde2a810ae642158)", + "near-sdk 3.0.0-pre.3 (git+https://github.com/near/near-sdk-rs?rev=613adcab6322e4f830efb4d5bde2a810ae642158)", + "near-sdk-sim", + "rand 0.7.3", + "rlp 0.4.6", "serde", "serde_json", + "test-token", "tiny-keccak 1.5.0", - "uint", - "wee_alloc", + "uint 0.8.5", ] [[package]] name = "bs58" -version = "0.3.1" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "476e9cd489f9e121e02ffa6014a8ef220ecb15c05ed23fc34cca13925dc283fb" +checksum = "771fe0050b883fcc3ea2359b1a96bcfbc090b7116eae7c3c512c7a083fdf23d3" [[package]] name = "byte-slice-cast" @@ -284,10 +293,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b0a5e3906bcbf133e33c1d4d95afc664ad37fbdb9f6568d8043e7ea8c27d93d3" [[package]] -name = "byte-tools" -version = "0.3.1" +name = "byte-slice-cast" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" +checksum = "65c1bf4a04a88c54f589125563643d773f3254b5c38571395e2b591c693bbc81" [[package]] name = "byteorder" @@ -295,31 +304,61 @@ version = "1.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de" +[[package]] +name = "bytes" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b700ce4376041dcd0a327fd0097c41095743c4c8af8887265942faf1100bd040" + [[package]] name = "c2-chacha" -version = "0.2.4" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "217192c943108d8b13bac38a1d51df9ce8a407a3f5a71ab633980665e68fbd9a" +checksum = "fb6b83fa00a7c53f420893670940c8fdfaa89f9dd9adb52062cca39482a31ab6" dependencies = [ - "byteorder", + "cipher", "ppv-lite86", - "stream-cipher", ] [[package]] name = "cached" -version = "0.12.0" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "083dc50149e37dfaab1ffe2c3af03576b79550f1e419a5091b28a7191db1c45b" +checksum = "5e2afe73808fbaac302e39c9754bfc3c4b4d0f99c9c240b9f4e4efc841ad1b74" dependencies = [ + "async-mutex", + "async-trait", + "cached_proc_macro", + "cached_proc_macro_types", + "futures", + "hashbrown", "once_cell", ] +[[package]] +name = "cached_proc_macro" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf857ae42d910aede5c5186e62684b0d7a597ce2fe3bd14448ab8f7ef439848c" +dependencies = [ + "async-mutex", + "cached_proc_macro_types", + "darling", + "quote", + "syn", +] + +[[package]] +name = "cached_proc_macro_types" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a4f925191b4367301851c6d99b09890311d74b0d43f274c0b34c86d308a3663" + [[package]] name = "cc" -version = "1.0.59" +version = "1.0.67" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66120af515773fb005778dc07c261bd201ec8ce50bd6e7144c927753fe013381" +checksum = "e3c69b077ad434294d3ce9f1f6143a2a4b89a8a2d54ef813d85003a4fd1137fd" dependencies = [ "jobserver", ] @@ -339,16 +378,33 @@ version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + [[package]] name = "chrono" -version = "0.4.15" +version = "0.4.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "942f72db697d8767c22d46a598e01f2d3b475501ea43d0db4f16d90259182d0b" +checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73" dependencies = [ + "libc", "num-integer", "num-traits", "serde", "time", + "winapi", +] + +[[package]] +name = "cipher" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12f8e7987cbd042a63249497f41aed09f8e65add917ea6566effbc56578d6801" +dependencies = [ + "generic-array 0.14.4", ] [[package]] @@ -371,21 +427,12 @@ dependencies = [ "ansi_term", "atty", "bitflags", - "strsim", + "strsim 0.8.0", "textwrap", "unicode-width", "vec_map", ] -[[package]] -name = "clear_on_drop" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9cc5db465b294c3fa986d5bbb0f3017cd850bff6dd6c52f9ccff8b4d21b7b08" -dependencies = [ - "cc", -] - [[package]] name = "cloudabi" version = "0.0.3" @@ -395,6 +442,12 @@ dependencies = [ "bitflags", ] +[[package]] +name = "concat-with" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ae45936bbf9bddd6a0268c0ea5d3814a72403f4b69a1c318aae2ce90444ad55" + [[package]] name = "constant_time_eq" version = "0.1.5" @@ -402,20 +455,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" [[package]] -name = "crunchy" -version = "0.2.2" +name = "cpuid-bool" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" +checksum = "8aebca1129a03dc6dc2b127edd729435bbc4a37e1d5f4d7513165089ceb02634" [[package]] -name = "crypto-mac" -version = "0.7.0" +name = "crunchy" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4434400df11d95d556bac068ddfedd482915eb18fe8bea89bc80b6e4b1c179e5" -dependencies = [ - "generic-array 0.12.3", - "subtle 1.0.0", -] +checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" [[package]] name = "crypto-mac" @@ -424,27 +473,62 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b584a330336237c1eecd3e94266efb216c56ed91225d634cb2991c5f3fd1aeab" dependencies = [ "generic-array 0.14.4", - "subtle 2.2.3", + "subtle", ] [[package]] name = "curve25519-dalek" -version = "2.1.0" +version = "3.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d85653f070353a16313d0046f173f70d1aadd5b42600a14de626f0dfb3473a5" +checksum = "f627126b946c25a4638eec0ea634fc52506dea98db118aae985118ce7c3d723f" dependencies = [ "byteorder", - "digest 0.8.1", - "rand_core", - "subtle 2.2.3", + "digest 0.9.0", + "rand_core 0.5.1", + "subtle", "zeroize", ] +[[package]] +name = "darling" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d706e75d87e35569db781a9b5e2416cff1236a47ed380831f959382ccd5f858" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0c960ae2da4de88a91b2d920c2a7233b400bc33cb28453a2987822d8392519b" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim 0.9.3", + "syn", +] + +[[package]] +name = "darling_macro" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9b5a2f4ac4969822c62224815d069952656cadc7084fdca9751e6d959189b72" +dependencies = [ + "darling_core", + "quote", + "syn", +] + [[package]] name = "derive_more" -version = "0.99.9" +version = "0.99.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "298998b1cf6b5b2c8a7b023dfd45821825ce3ba8a8af55c921a0e734e4653f76" +checksum = "41cb0e6161ad61ed084a36ba71fbba9e3ac5aee3606fb607fe08da6acbcf3d8c" dependencies = [ "proc-macro2", "quote", @@ -457,7 +541,7 @@ version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5" dependencies = [ - "generic-array 0.12.3", + "generic-array 0.12.4", ] [[package]] @@ -471,14 +555,14 @@ dependencies = [ [[package]] name = "dynasm" -version = "0.5.2" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42a814e1edeb85dd2a3c6fc0d6bf76d02ca5695d438c70ecee3d90774f3259c5" +checksum = "3d7d1242462849390bb2ad38aeed769499f1afc7383affa2ab0c1baa894c0200" dependencies = [ "bitflags", "byteorder", "lazy_static", - "owning_ref", + "proc-macro-error", "proc-macro2", "quote", "syn", @@ -486,41 +570,53 @@ dependencies = [ [[package]] name = "dynasmrt" -version = "0.5.2" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a393aaeb4441a48bcf47b5b6155971f82cc1eb77e22855403ccc0415ac8328d" +checksum = "c1dd4d1d5ca12258cef339a57a7643e8b233a42dea9bb849630ddd9dd7726aa9" dependencies = [ "byteorder", - "memmap", + "dynasm", + "memmap2", ] [[package]] name = "easy-ext" -version = "0.2.2" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33a8eb435d3eadce855cb8dd4b36b0152c6758a3bda2a6696a9ce50129967ee8" +checksum = "80581ee1c96b68c603eee514af47f075b39829304bde1a04381c826f3e06a9b4" dependencies = [ "quote", "syn", ] +[[package]] +name = "ed25519" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37c66a534cbb46ab4ea03477eae19d5c22c01da8258030280b7bd9d8433fb6ef" +dependencies = [ + "signature", +] + [[package]] name = "ed25519-dalek" -version = "1.0.0-pre.3" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "978710b352437433c97b2bff193f2fb1dfd58a093f863dd95e225a19baa599a2" +checksum = "c762bae6dcaf24c4c84667b8579785430908723d5c889f469d76a41d59cc7a9d" dependencies = [ - "clear_on_drop", "curve25519-dalek", - "rand", + "ed25519", + "rand 0.7.3", + "serde", "sha2", + "zeroize", ] [[package]] name = "either" -version = "1.6.0" +version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd56b59865bce947ac5958779cfa508f6c3b9497cc762b7e24a12d11ccde2c4f" +checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" [[package]] name = "elastic-array" @@ -546,9 +642,9 @@ dependencies = [ [[package]] name = "errno" -version = "0.2.6" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6eab5ee3df98a279d9b316b1af6ac95422127b1290317e6d18c1743c99418b01" +checksum = "fa68f2fb9cae9d37c9b2b3584aba698a2e97f72d7aef7b9f7aa71d8b54ce46fe" dependencies = [ "errno-dragonfly", "libc", @@ -568,13 +664,13 @@ dependencies = [ [[package]] name = "eth-types" version = "0.1.0" -source = "git+https://github.com/near/rainbow-bridge#3c9ed763d5e62b0538c6eaf132562da8a4eb1281" +source = "git+https://github.com/near/rainbow-bridge?rev=3a60b7eac2f06d160bd7b20b67a181961c08055d#3a60b7eac2f06d160bd7b20b67a181961c08055d" dependencies = [ - "borsh 0.6.2", + "borsh", "derive_more", - "ethereum-types", - "near-sdk", - "rlp", + "ethereum-types 0.9.2", + "near-sdk 3.0.0-pre.3 (git+https://github.com/near/near-sdk-rs?rev=613adcab6322e4f830efb4d5bde2a810ae642158)", + "rlp 0.4.6", "rlp-derive", "serde", ] @@ -585,12 +681,12 @@ version = "12.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "052a565e3de82944527d6d10a465697e6bb92476b772ca7141080c901f6a63c6" dependencies = [ - "ethereum-types", + "ethereum-types 0.9.2", "rustc-hex", "serde", "serde_json", "tiny-keccak 1.5.0", - "uint", + "uint 0.8.5", ] [[package]] @@ -600,8 +696,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "71a6567e6fd35589fea0c63b94b4cf2e55573e413901bdbe60ab15cf0e25e5df" dependencies = [ "crunchy", - "fixed-hash", - "impl-rlp", + "fixed-hash 0.6.1", + "impl-rlp 0.2.1", + "impl-serde", + "tiny-keccak 2.0.2", +] + +[[package]] +name = "ethbloom" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "779864b9c7f7ead1f092972c3257496c6a84b46dba2ce131dd8a282cb2cc5972" +dependencies = [ + "crunchy", + "fixed-hash 0.7.0", + "impl-rlp 0.3.0", "impl-serde", "tiny-keccak 2.0.2", ] @@ -612,19 +721,33 @@ version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "473aecff686bd8e7b9db0165cbbb53562376b39bf35b427f0c60446a9e1634b0" dependencies = [ - "ethbloom", - "fixed-hash", - "impl-rlp", + "ethbloom 0.9.2", + "fixed-hash 0.6.1", + "impl-rlp 0.2.1", "impl-serde", - "primitive-types", - "uint", + "primitive-types 0.7.3", + "uint 0.8.5", ] [[package]] -name = "fake-simd" -version = "0.1.2" +name = "ethereum-types" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f64b5df66a228d85e4b17e5d6c6aa43b0310898ffe8a85988c4c032357aaabfd" +dependencies = [ + "ethbloom 0.11.0", + "fixed-hash 0.7.0", + "impl-rlp 0.3.0", + "impl-serde", + "primitive-types 0.9.0", + "uint 0.9.0", +] + +[[package]] +name = "event-listener" +version = "2.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" +checksum = "f7531096570974c3a9dcf9e4b8e1cede1ec26cf5046219fb3b9d897503b9be59" [[package]] name = "fixed-hash" @@ -633,7 +756,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "11498d382790b7a8f2fd211780bec78619bba81cdad3a283997c0c41f836759c" dependencies = [ "byteorder", - "rand", + "rand 0.7.3", + "rustc-hex", + "static_assertions", +] + +[[package]] +name = "fixed-hash" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfcf0ed7fe52a17a03854ec54a9f76d6d84508d1c0e66bc1793301c73fc8493c" +dependencies = [ + "byteorder", + "rand 0.8.3", "rustc-hex", "static_assertions", ] @@ -644,11 +779,119 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" +[[package]] +name = "form_urlencoded" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fc25a87fa4fd2094bffb06925852034d90a17f0d1e05197d4956d3555752191" +dependencies = [ + "matches", + "percent-encoding", +] + [[package]] name = "fs_extra" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2022715d62ab30faffd124d40b76f4134a550a87792276512b18d63272333394" + +[[package]] +name = "funty" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f2a4a2034423744d2cc7ca2068453168dcdb82c438419e639a26bd87839c674" +checksum = "fed34cd105917e91daa4da6b3728c47b068749d6a62c59811f06ed2ac71d9da7" + +[[package]] +name = "futures" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f55667319111d593ba876406af7c409c0ebb44dc4be6132a783ccf163ea14c1" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c2dd2df839b57db9ab69c2c9d8f3e8c81984781937fe2807dc6dcf3b2ad2939" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15496a72fabf0e62bdc3df11a59a3787429221dd0710ba8ef163d6f7a9112c94" + +[[package]] +name = "futures-executor" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "891a4b7b96d84d5940084b2a37632dd65deeae662c114ceaa2c879629c9c0ad1" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-io" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d71c2c65c57704c32f5241c1223167c2c3294fd34ac020c807ddbe6db287ba59" + +[[package]] +name = "futures-macro" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea405816a5139fb39af82c2beb921d52143f556038378d6db21183a5c37fbfb7" +dependencies = [ + "proc-macro-hack", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "futures-sink" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85754d98985841b7d4f5e8e6fbfa4a4ac847916893ec511a2917ccd8525b8bb3" + +[[package]] +name = "futures-task" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa189ef211c15ee602667a6fcfe1c1fd9e07d42250d2156382820fba33c9df80" + +[[package]] +name = "futures-util" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1812c7ab8aedf8d6f2701a43e1243acdbcc2b36ab26e2ad421eb99ac963d96d1" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "pin-utils", + "proc-macro-hack", + "proc-macro-nested", + "slab", +] [[package]] name = "gcc" @@ -658,9 +901,9 @@ checksum = "8f5f3913fa0bfe7ee1fd8248b6b9f42a5af4b9d65ec2dd2c3c26132b950ecfc2" [[package]] name = "generic-array" -version = "0.12.3" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c68f0274ae0e023facc3c97b2e00f076be70e254bc851d972503b328db79b2ec" +checksum = "ffdf9f34f1447443d37393cc6c2b8313aebddcd96906caf34e54c68d8e57d7bd" dependencies = [ "typenum", ] @@ -677,13 +920,24 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.1.14" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" +dependencies = [ + "cfg-if 1.0.0", + "libc", + "wasi 0.9.0+wasi-snapshot-preview1", +] + +[[package]] +name = "getrandom" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7abc8dd8451921606d809ba32e95b6111925cd2906060d2dcc29c070220503eb" +checksum = "c9495705279e7140bf035dde1f6e750c162df8b625267cd52cc44e0b156732c8" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", "libc", - "wasi", + "wasi 0.10.2+wasi-snapshot-preview1", ] [[package]] @@ -692,6 +946,15 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" +[[package]] +name = "hashbrown" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7afe4a420e3fe79967a00898cc1f4db7c8a49a9333a29f8a4bd76a253d5cd04" +dependencies = [ + "ahash", +] + [[package]] name = "heapsize" version = "0.4.2" @@ -703,27 +966,27 @@ dependencies = [ [[package]] name = "heck" -version = "0.3.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205" +checksum = "87cbf45460356b7deeb5e3415b5563308c0a9b057c85e12b06ad551f98d0a6ac" dependencies = [ "unicode-segmentation", ] [[package]] name = "hermit-abi" -version = "0.1.15" +version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3deed196b6e7f9e44a2ae8d94225d80302d81208b1bb673fd21fe634645c85a9" +checksum = "322f4de77956e22ed0e5032c359a0f1273f1f7f0d79bfa3b8ffbc730d7fbcc5c" dependencies = [ "libc", ] [[package]] name = "hex" -version = "0.4.2" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "644f9158b2f133fd50f5fb3242878846d9eb792e445c893805ff0e3824006e35" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" [[package]] name = "humantime" @@ -734,11 +997,17 @@ dependencies = [ "quick-error", ] +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + [[package]] name = "idna" -version = "0.2.0" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02e2673c30ee86b5b96a9cb52ad15718aa1f966f5ab9ad54a8b95d5ca33120a9" +checksum = "89829a5d69c23d348314a7ac337fe39173b61149a9864deabd260983aed48c21" dependencies = [ "matches", "unicode-bidi", @@ -746,18 +1015,21 @@ dependencies = [ ] [[package]] -name = "if_chain" -version = "1.0.0" +name = "impl-codec" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3360c7b59e5ffa2653671fb74b4741a5d343c03f331c0a4aeda42b5c2b0ec7d" +checksum = "1be51a921b067b0eaca2fad532d9400041561aa922221cc65f95a85641c6bf53" +dependencies = [ + "parity-scale-codec 1.3.7", +] [[package]] name = "impl-codec" -version = "0.4.2" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1be51a921b067b0eaca2fad532d9400041561aa922221cc65f95a85641c6bf53" +checksum = "df170efa359aebdd5cb7fe78edcc67107748e4737bdca8a8fb40d15ea7a877ed" dependencies = [ - "parity-scale-codec", + "parity-scale-codec 2.0.1", ] [[package]] @@ -766,7 +1038,16 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f7a72f11830b52333f36e3b09a288333888bf54380fd0ac0790a3c31ab0f3c5" dependencies = [ - "rlp", + "rlp 0.4.6", +] + +[[package]] +name = "impl-rlp" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f28220f89297a075ddc7245cd538076ee98b01f2a9c23a53a4f1105d5a322808" +dependencies = [ + "rlp 0.5.0", ] [[package]] @@ -780,19 +1061,29 @@ dependencies = [ [[package]] name = "indexmap" -version = "1.4.0" +version = "1.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c398b2b113b55809ceb9ee3e753fcbac793f1956663f3c36549c1346015c2afe" +checksum = "824845a0bf897a9042383849b02c1bc219c2383772efcd5c6f9766fa4b81aef3" dependencies = [ "autocfg", + "hashbrown", "serde", ] +[[package]] +name = "instant" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61124eeebbd69b8190558df225adf7e4caafce0d743919e5d6b19652314ec5ec" +dependencies = [ + "cfg-if 1.0.0", +] + [[package]] name = "itoa" -version = "0.4.5" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8b7a7c0c47db5545ed3fef7468ee7bb5b74691498139e4b3f6a20685dc6dd8e" +checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736" [[package]] name = "jemalloc-sys" @@ -830,6 +1121,17 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "67c21572b4949434e4fc1e1978b99c5f77064153c59d998bf13ecd96fb5ecba7" +[[package]] +name = "lazy-static-include" +version = "3.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c942ea960c2d8678d32cb14aa56d5c37f21107b54aa281c944e4d03690c55d1" +dependencies = [ + "lazy_static", + "slash-formatter", + "syn", +] + [[package]] name = "lazy_static" version = "1.4.0" @@ -844,9 +1146,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "libc" -version = "0.2.71" +version = "0.2.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9457b06509d27052635f90d6466700c65095fdf75409b3fbdd903e988b886f49" +checksum = "03b07a082330a35e43f63177cc01689da34fbffa0105e1246cf0311472cac73a" [[package]] name = "libloading" @@ -860,8 +1162,9 @@ dependencies = [ [[package]] name = "librocksdb-sys" -version = "6.10.2" -source = "git+https://github.com/nearprotocol/rust-rocksdb?branch=disable-thread#44592812fd12cc2ea5de55af7c8d9bfdeacac692" +version = "6.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb5b56f651c204634b936be2f92dbb42c36867e00ff7fe2405591f3b9fa66f09" dependencies = [ "bindgen", "cc", @@ -878,13 +1181,22 @@ dependencies = [ "scopeguard", ] +[[package]] +name = "lock_api" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd96ffd135b2fd7b973ac026d28085defbe8983df057ced3eb4f2130b0831312" +dependencies = [ + "scopeguard", +] + [[package]] name = "log" -version = "0.4.11" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fabed175da42fed1fa0746b0ea71f412aa9d35e76e95e59b192c64b9dc2bf8b" +checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", ] [[package]] @@ -895,9 +1207,9 @@ checksum = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" [[package]] name = "memchr" -version = "2.3.3" +version = "2.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3728d817d99e5ac407411fa471ff9800a778d88a24685968b36824eaf4bee400" +checksum = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525" [[package]] name = "memmap" @@ -909,51 +1221,77 @@ dependencies = [ "winapi", ] +[[package]] +name = "memmap2" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04e3e85b970d650e2ae6d70592474087051c11c54da7f7b4949725c5735fbcc6" +dependencies = [ + "libc", +] + [[package]] name = "memory_units" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" +[[package]] +name = "mock-prover" +version = "0.1.0" +dependencies = [ + "near-contract-standards 3.0.0-pre.3 (git+https://github.com/near/near-sdk-rs?rev=af0e826f916f3aa3ea51e8b675ecebdd37176671)", + "near-sdk 3.0.0-pre.3 (git+https://github.com/near/near-sdk-rs?rev=af0e826f916f3aa3ea51e8b675ecebdd37176671)", + "serde", + "serde_json", + "uint 0.8.5", + "wee_alloc", +] + +[[package]] +name = "near-contract-standards" +version = "3.0.0-pre.3" +source = "git+https://github.com/near/near-sdk-rs?rev=613adcab6322e4f830efb4d5bde2a810ae642158#613adcab6322e4f830efb4d5bde2a810ae642158" +dependencies = [ + "near-sdk 3.0.0-pre.3 (git+https://github.com/near/near-sdk-rs?rev=613adcab6322e4f830efb4d5bde2a810ae642158)", +] + +[[package]] +name = "near-contract-standards" +version = "3.0.0-pre.3" +source = "git+https://github.com/near/near-sdk-rs?rev=af0e826f916f3aa3ea51e8b675ecebdd37176671#af0e826f916f3aa3ea51e8b675ecebdd37176671" +dependencies = [ + "near-sdk 3.0.0-pre.3 (git+https://github.com/near/near-sdk-rs?rev=af0e826f916f3aa3ea51e8b675ecebdd37176671)", +] + [[package]] name = "near-crypto" version = "0.1.0" -source = "git+https://github.com/nearprotocol/nearcore.git#1c1c019613e4ccb47ea6dc5a591f913af8022998" +source = "git+https://github.com/near/nearcore.git?rev=1e88c6c699e3a2c49c6cbd09d284f69885982e80#1e88c6c699e3a2c49c6cbd09d284f69885982e80" dependencies = [ "arrayref", "blake2", - "borsh 0.7.1", + "borsh", "bs58", "c2-chacha", "curve25519-dalek", - "digest 0.8.1", + "derive_more", "ed25519-dalek", "lazy_static", "libc", "parity-secp256k1", - "rand", - "rand_core", - "serde", - "serde_json", - "sha2", - "subtle 2.2.3", -] - -[[package]] -name = "near-lib" -version = "0.1.0" -source = "git+https://github.com/ilblackdragon/balancer-near?rev=a386305c9829d2e5302a78fdc475c8a279fcf6ed#a386305c9829d2e5302a78fdc475c8a279fcf6ed" -dependencies = [ - "borsh 0.6.2", - "near-sdk", + "rand 0.7.3", + "rand_core 0.5.1", "serde", "serde_json", + "subtle", + "thiserror", ] [[package]] name = "near-metrics" version = "0.1.0" -source = "git+https://github.com/nearprotocol/nearcore.git#1c1c019613e4ccb47ea6dc5a591f913af8022998" +source = "git+https://github.com/near/nearcore.git?rev=1e88c6c699e3a2c49c6cbd09d284f69885982e80#1e88c6c699e3a2c49c6cbd09d284f69885982e80" dependencies = [ "lazy_static", "log", @@ -963,21 +1301,21 @@ dependencies = [ [[package]] name = "near-pool" version = "0.1.0" -source = "git+https://github.com/nearprotocol/nearcore.git#1c1c019613e4ccb47ea6dc5a591f913af8022998" +source = "git+https://github.com/near/nearcore.git?rev=1e88c6c699e3a2c49c6cbd09d284f69885982e80#1e88c6c699e3a2c49c6cbd09d284f69885982e80" dependencies = [ - "borsh 0.7.1", + "borsh", "near-crypto", "near-primitives", - "rand", + "rand 0.7.3", ] [[package]] name = "near-primitives" version = "0.1.0" -source = "git+https://github.com/nearprotocol/nearcore.git#1c1c019613e4ccb47ea6dc5a591f913af8022998" +source = "git+https://github.com/near/nearcore.git?rev=1e88c6c699e3a2c49c6cbd09d284f69885982e80#1e88c6c699e3a2c49c6cbd09d284f69885982e80" dependencies = [ - "base64", - "borsh 0.7.1", + "base64 0.13.0", + "borsh", "bs58", "byteorder", "chrono", @@ -987,11 +1325,12 @@ dependencies = [ "jemallocator", "lazy_static", "near-crypto", - "near-rpc-error-macro 0.1.0 (git+https://github.com/nearprotocol/nearcore.git)", - "near-vm-errors 2.1.1", + "near-primitives-core 0.1.0 (git+https://github.com/near/nearcore.git?rev=1e88c6c699e3a2c49c6cbd09d284f69885982e80)", + "near-rpc-error-macro 0.1.0 (git+https://github.com/near/nearcore.git?rev=1e88c6c699e3a2c49c6cbd09d284f69885982e80)", + "near-vm-errors 3.0.0 (git+https://github.com/near/nearcore.git?rev=1e88c6c699e3a2c49c6cbd09d284f69885982e80)", "num-rational", - "primitive-types", - "rand", + "primitive-types 0.9.0", + "rand 0.7.3", "reed-solomon-erasure", "regex", "serde", @@ -999,18 +1338,41 @@ dependencies = [ "sha2", "smart-default", "validator", - "validator_derive", ] [[package]] -name = "near-rpc-error-core" +name = "near-primitives-core" version = "0.1.0" -source = "git+https://github.com/nearprotocol/nearcore.git#1c1c019613e4ccb47ea6dc5a591f913af8022998" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92035b79bf9983502fe7b67b5a9fecea7604e979d439727827fd0d8f0d77720e" dependencies = [ - "proc-macro2", - "quote", + "base64 0.11.0", + "borsh", + "bs58", + "derive_more", + "hex", + "lazy_static", + "num-rational", "serde", - "syn", + "serde_json", + "sha2", +] + +[[package]] +name = "near-primitives-core" +version = "0.1.0" +source = "git+https://github.com/near/nearcore.git?rev=1e88c6c699e3a2c49c6cbd09d284f69885982e80#1e88c6c699e3a2c49c6cbd09d284f69885982e80" +dependencies = [ + "base64 0.11.0", + "borsh", + "bs58", + "derive_more", + "hex", + "lazy_static", + "num-rational", + "serde", + "serde_json", + "sha2", ] [[package]] @@ -1027,15 +1389,13 @@ dependencies = [ ] [[package]] -name = "near-rpc-error-macro" +name = "near-rpc-error-core" version = "0.1.0" -source = "git+https://github.com/nearprotocol/nearcore.git#1c1c019613e4ccb47ea6dc5a591f913af8022998" +source = "git+https://github.com/near/nearcore.git?rev=1e88c6c699e3a2c49c6cbd09d284f69885982e80#1e88c6c699e3a2c49c6cbd09d284f69885982e80" dependencies = [ - "near-rpc-error-core 0.1.0 (git+https://github.com/nearprotocol/nearcore.git)", "proc-macro2", "quote", "serde", - "serde_json", "syn", ] @@ -1054,68 +1414,84 @@ dependencies = [ ] [[package]] -name = "near-runtime-configs" +name = "near-rpc-error-macro" version = "0.1.0" -source = "git+https://github.com/nearprotocol/nearcore.git#1c1c019613e4ccb47ea6dc5a591f913af8022998" +source = "git+https://github.com/near/nearcore.git?rev=1e88c6c699e3a2c49c6cbd09d284f69885982e80#1e88c6c699e3a2c49c6cbd09d284f69885982e80" dependencies = [ - "near-primitives", - "near-runtime-fees 2.1.1", - "near-vm-logic 2.1.1", + "near-rpc-error-core 0.1.0 (git+https://github.com/near/nearcore.git?rev=1e88c6c699e3a2c49c6cbd09d284f69885982e80)", + "proc-macro2", + "quote", "serde", + "serde_json", + "syn", ] [[package]] -name = "near-runtime-fees" -version = "0.9.1" +name = "near-runtime-utils" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f4992274c8acb33fa1246715d3aafbce5688ae82243c779b561f8eaff1bb6f1" +checksum = "47f5c1891cec5a03e3dc99f985031408b19516305e2e59d64c4ce52b409e46a0" dependencies = [ - "num-rational", - "serde", + "lazy_static", + "regex", ] [[package]] -name = "near-runtime-fees" -version = "2.1.1" -source = "git+https://github.com/nearprotocol/nearcore.git#1c1c019613e4ccb47ea6dc5a591f913af8022998" +name = "near-runtime-utils" +version = "3.0.0" +source = "git+https://github.com/near/nearcore.git?rev=1e88c6c699e3a2c49c6cbd09d284f69885982e80#1e88c6c699e3a2c49c6cbd09d284f69885982e80" dependencies = [ - "num-rational", - "serde", + "lazy_static", + "regex", ] [[package]] -name = "near-runtime-standalone" -version = "2.1.1" -source = "git+https://github.com/nearprotocol/nearcore.git#1c1c019613e4ccb47ea6dc5a591f913af8022998" +name = "near-sdk" +version = "3.0.0-pre.3" +source = "git+https://github.com/near/near-sdk-rs?rev=613adcab6322e4f830efb4d5bde2a810ae642158#613adcab6322e4f830efb4d5bde2a810ae642158" dependencies = [ - "near-crypto", - "near-pool", - "near-primitives", - "near-runtime-configs", - "near-store", - "node-runtime", + "base64 0.13.0", + "borsh", + "bs58", + "near-primitives-core 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "near-sdk-macros 3.0.0-pre.3 (git+https://github.com/near/near-sdk-rs?rev=613adcab6322e4f830efb4d5bde2a810ae642158)", + "near-vm-logic 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "serde", + "serde_json", + "wee_alloc", ] [[package]] name = "near-sdk" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81319d4d44283f63467e4f02b6209297b10643c7aeb62e2ee41e0c31b43e2375" +version = "3.0.0-pre.3" +source = "git+https://github.com/near/near-sdk-rs?rev=af0e826f916f3aa3ea51e8b675ecebdd37176671#af0e826f916f3aa3ea51e8b675ecebdd37176671" dependencies = [ - "base64", - "borsh 0.6.2", + "base64 0.13.0", + "borsh", "bs58", - "near-runtime-fees 0.9.1", - "near-sdk-macros", - "near-vm-logic 0.9.1", + "near-primitives-core 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "near-sdk-macros 3.0.0-pre.3 (git+https://github.com/near/near-sdk-rs?rev=af0e826f916f3aa3ea51e8b675ecebdd37176671)", + "near-vm-logic 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde", + "serde_json", + "wee_alloc", ] [[package]] name = "near-sdk-core" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f3767fc2a61e6577f1336e06d6962a6c61fc39299573b8a25696fd09ce96ffb" +version = "3.0.0-pre.3" +source = "git+https://github.com/near/near-sdk-rs?rev=613adcab6322e4f830efb4d5bde2a810ae642158#613adcab6322e4f830efb4d5bde2a810ae642158" +dependencies = [ + "Inflector", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "near-sdk-core" +version = "3.0.0-pre.3" +source = "git+https://github.com/near/near-sdk-rs?rev=af0e826f916f3aa3ea51e8b675ecebdd37176671#af0e826f916f3aa3ea51e8b675ecebdd37176671" dependencies = [ "Inflector", "proc-macro2", @@ -1125,22 +1501,48 @@ dependencies = [ [[package]] name = "near-sdk-macros" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27c06b45c56028b0e1241b2196397d449091665f3f08d543415373505df5e05f" +version = "3.0.0-pre.3" +source = "git+https://github.com/near/near-sdk-rs?rev=613adcab6322e4f830efb4d5bde2a810ae642158#613adcab6322e4f830efb4d5bde2a810ae642158" dependencies = [ - "near-sdk-core", + "near-sdk-core 3.0.0-pre.3 (git+https://github.com/near/near-sdk-rs?rev=613adcab6322e4f830efb4d5bde2a810ae642158)", "proc-macro2", "quote", "syn", ] +[[package]] +name = "near-sdk-macros" +version = "3.0.0-pre.3" +source = "git+https://github.com/near/near-sdk-rs?rev=af0e826f916f3aa3ea51e8b675ecebdd37176671#af0e826f916f3aa3ea51e8b675ecebdd37176671" +dependencies = [ + "near-sdk-core 3.0.0-pre.3 (git+https://github.com/near/near-sdk-rs?rev=af0e826f916f3aa3ea51e8b675ecebdd37176671)", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "near-sdk-sim" +version = "3.0.0-pre.3" +source = "git+https://github.com/near/near-sdk-rs?rev=613adcab6322e4f830efb4d5bde2a810ae642158#613adcab6322e4f830efb4d5bde2a810ae642158" +dependencies = [ + "funty", + "lazy-static-include", + "near-crypto", + "near-pool", + "near-primitives", + "near-sdk 3.0.0-pre.3 (git+https://github.com/near/near-sdk-rs?rev=613adcab6322e4f830efb4d5bde2a810ae642158)", + "near-store", + "near-vm-logic 3.0.0 (git+https://github.com/near/nearcore.git?rev=1e88c6c699e3a2c49c6cbd09d284f69885982e80)", + "node-runtime", +] + [[package]] name = "near-store" -version = "0.1.0" -source = "git+https://github.com/nearprotocol/nearcore.git#1c1c019613e4ccb47ea6dc5a591f913af8022998" +version = "2.2.0" +source = "git+https://github.com/near/nearcore.git?rev=1e88c6c699e3a2c49c6cbd09d284f69885982e80#1e88c6c699e3a2c49c6cbd09d284f69885982e80" dependencies = [ - "borsh 0.7.1", + "borsh", "byteorder", "cached", "derive_more", @@ -1149,64 +1551,49 @@ dependencies = [ "near-crypto", "near-primitives", "num_cpus", - "rand", + "rand 0.7.3", "rocksdb", "serde", "serde_json", "strum", - "strum_macros", -] - -[[package]] -name = "near-test" -version = "0.1.0" -source = "git+https://github.com/ilblackdragon/balancer-near?rev=a386305c9829d2e5302a78fdc475c8a279fcf6ed#a386305c9829d2e5302a78fdc475c8a279fcf6ed" -dependencies = [ - "borsh 0.6.2", - "env_logger", - "log", - "near-crypto", - "near-primitives", - "near-runtime-standalone", - "near-sdk", - "quickcheck", - "quickcheck_macros", - "serde", - "serde_json", ] [[package]] name = "near-vm-errors" -version = "0.9.1" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "386c2c07ef37ae52ad43860ef69c6322bbc1e610ae0c08c1d7f5ff56f4c28e6a" +checksum = "53a100dda565c5375ac061126167afc5c33cdba1f2e325cfae3ce08f4a5a432a" dependencies = [ - "borsh 0.6.2", + "borsh", + "hex", "near-rpc-error-macro 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde", ] [[package]] name = "near-vm-errors" -version = "2.1.1" -source = "git+https://github.com/nearprotocol/nearcore.git#1c1c019613e4ccb47ea6dc5a591f913af8022998" +version = "3.0.0" +source = "git+https://github.com/near/nearcore.git?rev=1e88c6c699e3a2c49c6cbd09d284f69885982e80#1e88c6c699e3a2c49c6cbd09d284f69885982e80" dependencies = [ - "borsh 0.7.1", - "near-rpc-error-macro 0.1.0 (git+https://github.com/nearprotocol/nearcore.git)", + "borsh", + "hex", + "near-rpc-error-macro 0.1.0 (git+https://github.com/near/nearcore.git?rev=1e88c6c699e3a2c49c6cbd09d284f69885982e80)", "serde", ] [[package]] name = "near-vm-logic" -version = "0.9.1" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6da6c80d3428f45248577820bfc943b8261a6f11d6721037e5c3f43484047cd" +checksum = "a12201244dd59ae79506767afe7a8f51b5eb7bd0aa237d355dfa635f7b777c4a" dependencies = [ - "base64", + "base64 0.13.0", + "borsh", "bs58", "byteorder", - "near-runtime-fees 0.9.1", - "near-vm-errors 0.9.1", + "near-primitives-core 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "near-runtime-utils 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "near-vm-errors 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde", "sha2", "sha3", @@ -1214,14 +1601,16 @@ dependencies = [ [[package]] name = "near-vm-logic" -version = "2.1.1" -source = "git+https://github.com/nearprotocol/nearcore.git#1c1c019613e4ccb47ea6dc5a591f913af8022998" +version = "3.0.0" +source = "git+https://github.com/near/nearcore.git?rev=1e88c6c699e3a2c49c6cbd09d284f69885982e80#1e88c6c699e3a2c49c6cbd09d284f69885982e80" dependencies = [ - "base64", + "base64 0.13.0", + "borsh", "bs58", "byteorder", - "near-runtime-fees 2.1.1", - "near-vm-errors 2.1.1", + "near-primitives-core 0.1.0 (git+https://github.com/near/nearcore.git?rev=1e88c6c699e3a2c49c6cbd09d284f69885982e80)", + "near-runtime-utils 3.0.0 (git+https://github.com/near/nearcore.git?rev=1e88c6c699e3a2c49c6cbd09d284f69885982e80)", + "near-vm-errors 3.0.0 (git+https://github.com/near/nearcore.git?rev=1e88c6c699e3a2c49c6cbd09d284f69885982e80)", "serde", "sha2", "sha3", @@ -1229,17 +1618,19 @@ dependencies = [ [[package]] name = "near-vm-runner" -version = "2.1.1" -source = "git+https://github.com/nearprotocol/nearcore.git#1c1c019613e4ccb47ea6dc5a591f913af8022998" +version = "3.0.0" +source = "git+https://github.com/near/nearcore.git?rev=1e88c6c699e3a2c49c6cbd09d284f69885982e80#1e88c6c699e3a2c49c6cbd09d284f69885982e80" dependencies = [ + "borsh", "cached", - "near-runtime-fees 2.1.1", - "near-vm-errors 2.1.1", - "near-vm-logic 2.1.1", + "log", + "near-primitives", + "near-vm-errors 3.0.0 (git+https://github.com/near/nearcore.git?rev=1e88c6c699e3a2c49c6cbd09d284f69885982e80)", + "near-vm-logic 3.0.0 (git+https://github.com/near/nearcore.git?rev=1e88c6c699e3a2c49c6cbd09d284f69885982e80)", "parity-wasm", "pwasm-utils", - "wasmer-runtime", - "wasmer-runtime-core", + "wasmer-runtime-core-near", + "wasmer-runtime-near", ] [[package]] @@ -1250,35 +1641,34 @@ checksum = "3b2e0b4f3320ed72aaedb9a5ac838690a8047c7b275da22711fddff4f8a14229" dependencies = [ "bitflags", "cc", - "cfg-if", + "cfg-if 0.1.10", "libc", "void", ] [[package]] name = "node-runtime" -version = "2.1.1" -source = "git+https://github.com/nearprotocol/nearcore.git#1c1c019613e4ccb47ea6dc5a591f913af8022998" +version = "3.0.0" +source = "git+https://github.com/near/nearcore.git?rev=1e88c6c699e3a2c49c6cbd09d284f69885982e80#1e88c6c699e3a2c49c6cbd09d284f69885982e80" dependencies = [ - "borsh 0.7.1", + "borsh", "byteorder", - "cached", + "ethereum-types 0.11.0", + "hex", "lazy_static", "log", "near-crypto", "near-metrics", "near-primitives", - "near-runtime-configs", - "near-runtime-fees 2.1.1", + "near-runtime-utils 3.0.0 (git+https://github.com/near/nearcore.git?rev=1e88c6c699e3a2c49c6cbd09d284f69885982e80)", "near-store", - "near-vm-errors 2.1.1", - "near-vm-logic 2.1.1", + "near-vm-errors 3.0.0 (git+https://github.com/near/nearcore.git?rev=1e88c6c699e3a2c49c6cbd09d284f69885982e80)", + "near-vm-logic 3.0.0 (git+https://github.com/near/nearcore.git?rev=1e88c6c699e3a2c49c6cbd09d284f69885982e80)", "near-vm-runner", "num-bigint", "num-rational", "num-traits", - "rand", - "rocksdb", + "rand 0.7.3", "serde", "serde_json", ] @@ -1295,9 +1685,9 @@ dependencies = [ [[package]] name = "num-bigint" -version = "0.2.6" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "090c7f9998ee0ff65aa5b723e4009f7b217707f1fb5ea551329cc4d6231fb304" +checksum = "7d0a3d5e207573f948a9e5376662aa743a2ea13f7c50a554d7af443a73fbfeba" dependencies = [ "autocfg", "num-integer", @@ -1306,9 +1696,9 @@ dependencies = [ [[package]] name = "num-integer" -version = "0.1.42" +version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f6ea62e9d81a77cd3ee9a2a5b9b609447857f3d358704331e4ef39eb247fcba" +checksum = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db" dependencies = [ "autocfg", "num-traits", @@ -1316,9 +1706,9 @@ dependencies = [ [[package]] name = "num-rational" -version = "0.2.4" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c000134b5dbf44adc5cb772486d335293351644b801551abe8f75c84cfa4aef" +checksum = "12ac428b1cb17fce6f731001d307d351ec70a6d202fc2e60f7d4c5e42d8f4f07" dependencies = [ "autocfg", "num-bigint", @@ -1329,9 +1719,9 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.11" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c62be47e61d1842b9170f0fdeec8eba98e60e90e5446449a0545e5152acd7096" +checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" dependencies = [ "autocfg", ] @@ -1348,24 +1738,15 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.4.1" +version = "1.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "260e51e7efe62b592207e9e13a68e43692a7a279171d6ba57abd208bf23645ad" +checksum = "af8b08b04175473088b46763e51ee54da5f9a164bc162f615b91bc179dbf15a3" [[package]] name = "opaque-debug" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" - -[[package]] -name = "owning_ref" -version = "0.4.1" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ff55baddef9e4ad00f88b6c743a2a8062d4c6ade126c2a528644b8e444d52ce" -dependencies = [ - "stable_deref_trait", -] +checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" [[package]] name = "page_size" @@ -1379,13 +1760,25 @@ dependencies = [ [[package]] name = "parity-scale-codec" -version = "1.3.4" +version = "1.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34d38aeaffc032ec69faa476b3caaca8d4dd7f3f798137ff30359e5c7869ceb6" +checksum = "a4b26b16c7687c3075982af47719e481815df30bc544f7a6690763a25ca16e9d" dependencies = [ "arrayvec", - "bitvec", - "byte-slice-cast", + "bitvec 0.17.4", + "byte-slice-cast 0.3.5", + "serde", +] + +[[package]] +name = "parity-scale-codec" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0cd3dab59b5cf4bc81069ade0fc470341a1ef3ad5fa73e5a8943bed2ec12b2e8" +dependencies = [ + "arrayvec", + "bitvec 0.20.2", + "byte-slice-cast 1.0.0", "serde", ] @@ -1397,8 +1790,8 @@ checksum = "4fca4f82fccae37e8bbdaeb949a4a218a1bbc485d11598f193d2a908042e5fc1" dependencies = [ "arrayvec", "cc", - "cfg-if", - "rand", + "cfg-if 0.1.10", + "rand 0.7.3", ] [[package]] @@ -1413,20 +1806,45 @@ version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3a704eb390aafdc107b0e392f56a82b668e3a71366993b5340f5833fd62505e" dependencies = [ - "lock_api", - "parking_lot_core", + "lock_api 0.3.4", + "parking_lot_core 0.7.2", +] + +[[package]] +name = "parking_lot" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d7744ac029df22dca6284efe4e898991d28e3085c706c972bcd7da4a27a15eb" +dependencies = [ + "instant", + "lock_api 0.4.2", + "parking_lot_core 0.8.3", +] + +[[package]] +name = "parking_lot_core" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d58c7c768d4ba344e3e8d72518ac13e259d7c7ade24167003b8488e10b6740a3" +dependencies = [ + "cfg-if 0.1.10", + "cloudabi", + "libc", + "redox_syscall 0.1.57", + "smallvec", + "winapi", ] [[package]] name = "parking_lot_core" -version = "0.7.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d58c7c768d4ba344e3e8d72518ac13e259d7c7ade24167003b8488e10b6740a3" +checksum = "fa7a782938e745763fe6907fc6ba86946d72f49fe7e21de074e08128a99fb018" dependencies = [ - "cfg-if", - "cloudabi", + "cfg-if 1.0.0", + "instant", "libc", - "redox_syscall", + "redox_syscall 0.2.5", "smallvec", "winapi", ] @@ -1443,53 +1861,124 @@ version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" +[[package]] +name = "pin-project-lite" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc0e1f259c92177c30a4c9d177246edd0a3568b25756a977d0632cf8fa37e905" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + [[package]] name = "ppv-lite86" -version = "0.2.9" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c36fa947111f5c62a733b652544dd0016a43ce89619538a8ef92724a6f501a20" +checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857" [[package]] name = "primitive-types" -version = "0.7.2" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7dd39dcacf71411ba488570da7bbc89b717225e46478b30ba99b92db6b149809" +dependencies = [ + "fixed-hash 0.6.1", + "impl-codec 0.4.2", + "impl-rlp 0.2.1", + "impl-serde", + "uint 0.8.5", +] + +[[package]] +name = "primitive-types" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c55c21c64d0eaa4d7ed885d959ef2d62d9e488c27c0e02d9aa5ce6c877b7d5f8" +checksum = "2415937401cb030a2a0a4d922483f945fa068f52a7dbb22ce0fe5f2b6f6adace" dependencies = [ - "fixed-hash", - "impl-codec", - "impl-rlp", + "fixed-hash 0.7.0", + "impl-codec 0.5.0", + "impl-rlp 0.3.0", "impl-serde", - "uint", + "uint 0.9.0", +] + +[[package]] +name = "proc-macro-crate" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d6ea3c4595b96363c13943497db34af4460fb474a95c43f4446ad341b8c9785" +dependencies = [ + "toml", +] + +[[package]] +name = "proc-macro-error" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" +dependencies = [ + "proc-macro-error-attr", + "proc-macro2", + "quote", + "syn", + "version_check", +] + +[[package]] +name = "proc-macro-error-attr" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" +dependencies = [ + "proc-macro2", + "quote", + "version_check", ] +[[package]] +name = "proc-macro-hack" +version = "0.5.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5" + +[[package]] +name = "proc-macro-nested" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc881b2c22681370c6a780e47af9840ef841837bc98118431d4e1868bd0c1086" + [[package]] name = "proc-macro2" -version = "1.0.18" +version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "beae6331a816b1f65d04c45b078fd8e6c93e8071771f41b8163255bbd8d7c8fa" +checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71" dependencies = [ "unicode-xid", ] [[package]] name = "prometheus" -version = "0.8.0" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0575e258dab62268e7236d7307caa38848acbda7ec7ab87bd9093791e999d20" +checksum = "c8425533e7122f0c3cc7a37e6244b16ad3a2cc32ae7ac6276e2a75da0d9c200d" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", "fnv", "lazy_static", + "parking_lot 0.11.1", "protobuf", - "spin", + "regex", "thiserror", ] [[package]] name = "protobuf" -version = "2.17.0" +version = "2.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb14183cc7f213ee2410067e1ceeadba2a7478a59432ff0747a335202798b1e2" +checksum = "73f72884896d22e0da0e5b266cb9a780b791f6c3b2f5beab6368d6cd4f0dbb86" [[package]] name = "pwasm-utils" @@ -1508,34 +1997,11 @@ version = "1.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" -[[package]] -name = "quickcheck" -version = "0.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a44883e74aa97ad63db83c4bf8ca490f02b2fc02f92575e720c8551e843c945f" -dependencies = [ - "env_logger", - "log", - "rand", - "rand_core", -] - -[[package]] -name = "quickcheck_macros" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "608c156fd8e97febc07dc9c2e2c80bf74cfc6ef26893eae3daf8bc2bc94a4b7f" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "quote" -version = "1.0.6" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54a21852a652ad6f610c9510194f398ff6f8692e334fd1145fed931f7fbe44ea" +checksum = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7" dependencies = [ "proc-macro2", ] @@ -1546,19 +2012,36 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "def50a86306165861203e7f84ecffbbdfdea79f0e51039b33de1e952358c47ac" +[[package]] +name = "radium" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "643f8f41a8ebc4c5dc4515c82bb8abd397b527fc20fd681b7c011c2aee5d44fb" + [[package]] name = "rand" version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" dependencies = [ - "getrandom", + "getrandom 0.1.16", "libc", - "rand_chacha", - "rand_core", + "rand_chacha 0.2.2", + "rand_core 0.5.1", "rand_hc", ] +[[package]] +name = "rand" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ef9e7e66b4468674bfcb0c81af8b7fa0bb154fa9f28eb840da5c447baeb8d7e" +dependencies = [ + "libc", + "rand_chacha 0.3.0", + "rand_core 0.6.2", +] + [[package]] name = "rand_chacha" version = "0.2.2" @@ -1566,7 +2049,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" dependencies = [ "ppv-lite86", - "rand_core", + "rand_core 0.5.1", +] + +[[package]] +name = "rand_chacha" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e12735cf05c9e10bf21534da50a147b924d555dc7a547c42e6bb2d5b6017ae0d" +dependencies = [ + "ppv-lite86", + "rand_core 0.6.2", ] [[package]] @@ -1575,7 +2068,16 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" dependencies = [ - "getrandom", + "getrandom 0.1.16", +] + +[[package]] +name = "rand_core" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34cf66eb183df1c5876e2dcf6b13d57340741e8dc255b48e40a26de954d06ae7" +dependencies = [ + "getrandom 0.2.2", ] [[package]] @@ -1584,7 +2086,7 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" dependencies = [ - "rand_core", + "rand_core 0.5.1", ] [[package]] @@ -1593,6 +2095,15 @@ version = "0.1.57" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" +[[package]] +name = "redox_syscall" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94341e4e44e24f6b591b59e47a8a027df12e008d73fd5672dbea9cc22f4507d9" +dependencies = [ + "bitflags", +] + [[package]] name = "reed-solomon-erasure" version = "4.0.2" @@ -1604,9 +2115,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.3.9" +version = "1.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c3780fcf44b193bc4d09f36d2a3c87b251da4a046c87795a0d35f4f927ad8e6" +checksum = "d9251239e129e16308e70d853559389de218ac275b515068abc96829d05b948a" dependencies = [ "aho-corasick", "memchr", @@ -1616,19 +2127,29 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.6.18" +version = "0.6.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26412eb97c6b088a6997e05f69403a802a92d520de2f8e63c2b65f9e0f47c4e8" +checksum = "b5eb417147ba9860a96cfe72a0b93bf88fee1744b5636ec99ab20c1aa9376581" [[package]] name = "rlp" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a7d3f9bed94764eac15b8f14af59fac420c236adaff743b7bcc88e265cb4345" +checksum = "1190dcc8c3a512f1eef5d09bb8c84c7f39e1054e174d1795482e18f5272f2e73" dependencies = [ "rustc-hex", ] +[[package]] +name = "rlp" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e54369147e3e7796c9b885c7304db87ca3d09a0a98f72843d532868675bbfba8" +dependencies = [ + "bytes", + "rustc-hex", +] + [[package]] name = "rlp-derive" version = "0.1.0" @@ -1642,8 +2163,9 @@ dependencies = [ [[package]] name = "rocksdb" -version = "0.14.0" -source = "git+https://github.com/nearprotocol/rust-rocksdb?branch=disable-thread#44592812fd12cc2ea5de55af7c8d9bfdeacac692" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23d83c02c429044d58474eaf5ae31e062d0de894e21125b47437ec0edc1397e6" dependencies = [ "libc", "librocksdb-sys", @@ -1699,9 +2221,9 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.111" +version = "1.0.118" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9124df5b40cbd380080b2cc6ab894c040a3070d995f5c9dc77e18c34a8ae37d" +checksum = "06c64263859d87aa2eb554587e2d23183398d617427327cf2b3d0ed8c69e4800" dependencies = [ "serde_derive", ] @@ -1727,9 +2249,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.111" +version = "1.0.118" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f2c3ac8e6ca1e9c80b8be1023940162bf81ae3cffbb1809474152f2ce1eb250" +checksum = "c84d3526699cd55261af4b941e4e725444df67aa4f9e6a3564f18030d12672df" dependencies = [ "proc-macro2", "quote", @@ -1738,9 +2260,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.53" +version = "1.0.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "993948e75b189211a9b31a7528f950c6adc21f9720b6438ff80a7fa2f864cea2" +checksum = "799e97dc9fdae36a5c8b8f2cae9ce2ee9fdce2058c57a93e6099d919fd982f79" dependencies = [ "indexmap", "itoa", @@ -1750,25 +2272,25 @@ dependencies = [ [[package]] name = "sha2" -version = "0.8.2" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a256f46ea78a0c0d9ff00077504903ac881a1dafdc20da66545699e7776b3e69" +checksum = "fa827a14b29ab7f44778d14a88d3cb76e949c45083f7dbfa507d0cb699dc12de" dependencies = [ "block-buffer", - "digest 0.8.1", - "fake-simd", + "cfg-if 1.0.0", + "cpuid-bool", + "digest 0.9.0", "opaque-debug", ] [[package]] name = "sha3" -version = "0.8.2" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd26bc0e7a2e3a7c959bc494caf58b72ee0c71d67704e9520f736ca7e4853ecf" +checksum = "f81199417d4e5de3f04b1e871023acea7389672c4135918f05aa9cbf2f2fa809" dependencies = [ "block-buffer", - "byte-tools", - "digest 0.8.1", + "digest 0.9.0", "keccak", "opaque-debug", ] @@ -1779,11 +2301,32 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7fdf1b9db47230893d76faad238fd6097fd6d6a9245cd7a4d90dbd639536bbd2" +[[package]] +name = "signature" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f0242b8e50dd9accdd56170e94ca1ebd223b098eb9c83539a6e367d0f36ae68" + +[[package]] +name = "slab" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8" + +[[package]] +name = "slash-formatter" +version = "3.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55a065b7c425d213cbefcaaa4b62dd936183fa41c806a74767c72dd659ff4ad0" +dependencies = [ + "concat-with", +] + [[package]] name = "smallvec" -version = "1.4.2" +version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbee7696b84bbf3d89a1c2eccff0850e3047ed46bfcd2e92c29a2d074d57e252" +checksum = "fe0f37c9e8f3c5a4a66ad655a93c74daac4ad00c441533bf5c6e7990bb42604e" [[package]] name = "smart-default" @@ -1796,18 +2339,6 @@ dependencies = [ "syn", ] -[[package]] -name = "spin" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" - -[[package]] -name = "stable_deref_trait" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" - [[package]] name = "static_assertions" version = "1.1.0" @@ -1815,31 +2346,31 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" [[package]] -name = "stream-cipher" -version = "0.3.2" +name = "strsim" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8131256a5896cabcf5eb04f4d6dacbe1aefda854b0d9896e09cb58829ec5638c" -dependencies = [ - "generic-array 0.12.3", -] +checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" [[package]] name = "strsim" -version = "0.8.0" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" +checksum = "6446ced80d6c486436db5c078dde11a9f73d42b57fb273121e160b84f63d894c" [[package]] name = "strum" -version = "0.18.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57bd81eb48f4c437cadc685403cad539345bf703d78e63707418431cecd4522b" +checksum = "7318c509b5ba57f18533982607f24070a55d353e90d4cae30c467cdb2ad5ac5c" +dependencies = [ + "strum_macros", +] [[package]] name = "strum_macros" -version = "0.18.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87c85aa3f8ea653bfd3ddf25f7ee357ee4d204731f6aa9ad04002306f6e2774c" +checksum = "ee8bc6b87a5112aeeab1f4a9f7ab634fe6cbefc4850006df31267f4cfb9e3149" dependencies = [ "heck", "proc-macro2", @@ -1849,27 +2380,39 @@ dependencies = [ [[package]] name = "subtle" -version = "1.0.0" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d67a5a62ba6e01cb2192ff309324cb4875d0c451d55fe2319433abe7a05a8ee" +checksum = "1e81da0851ada1f3e9d4312c704aa4f8806f0f9d69faaf8df2f3464b4a9437c2" [[package]] -name = "subtle" -version = "2.2.3" +name = "syn" +version = "1.0.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "502d53007c02d7605a05df1c1a73ee436952781653da5d0bf57ad608f66932c1" +checksum = "4211ce9909eb971f111059df92c45640aad50a619cf55cd76476be803c4c68e6" +dependencies = [ + "proc-macro2", + "quote", + "unicode-xid", +] [[package]] -name = "syn" -version = "1.0.30" +name = "synstructure" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93a56fabc59dce20fe48b6c832cc249c713e7ed88fa28b0ee0a3bfcaae5fe4e2" +checksum = "b834f2d66f734cb897113e34aaff2f1ab4719ca946f9a7358dba8f8064148701" dependencies = [ "proc-macro2", "quote", + "syn", "unicode-xid", ] +[[package]] +name = "tap" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" + [[package]] name = "target-lexicon" version = "0.10.0" @@ -1878,13 +2421,22 @@ checksum = "ab0e7238dcc7b40a7be719a25365910f6807bd864f4cce6b2e6b873658e2b19d" [[package]] name = "termcolor" -version = "1.1.0" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb6bfa289a4d7c5766392812c0a1f4c1ba45afa1ad47803c11e1f407d846d75f" +checksum = "2dfed899f0eb03f32ee8c6a0aabdb8a7949659e3466561fc0adf54e26d88c5f4" dependencies = [ "winapi-util", ] +[[package]] +name = "test-token" +version = "0.1.0" +source = "git+https://github.com/mfornet/contracts?rev=9e115e54bec56842d1380c6ebdd884eab3170583#9e115e54bec56842d1380c6ebdd884eab3170583" +dependencies = [ + "near-contract-standards 3.0.0-pre.3 (git+https://github.com/near/near-sdk-rs?rev=613adcab6322e4f830efb4d5bde2a810ae642158)", + "near-sdk 3.0.0-pre.3 (git+https://github.com/near/near-sdk-rs?rev=613adcab6322e4f830efb4d5bde2a810ae642158)", +] + [[package]] name = "textwrap" version = "0.11.0" @@ -1896,18 +2448,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.20" +version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dfdd070ccd8ccb78f4ad66bf1982dc37f620ef696c6b5028fe2ed83dd3d0d08" +checksum = "e0f4a65597094d4483ddaed134f409b2cb7c1beccf25201a9f73c719254fa98e" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.20" +version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd80fc12f73063ac132ac92aceea36734f04a1d93c1240c6944e23a3b8841793" +checksum = "7765189610d8241a44529806d6fd1f2e0a08734313a35d5b3a556f92b381f3c0" dependencies = [ "proc-macro2", "quote", @@ -1916,11 +2468,11 @@ dependencies = [ [[package]] name = "thread_local" -version = "1.0.1" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d40c6d1b69745a6ec6fb1ca717914848da4b44ae29d9b3080cbee91d72a69b14" +checksum = "8018d24e04c95ac8790716a5987d0fec4f8b27249ffa0f7d33f1369bdfb88cbd" dependencies = [ - "lazy_static", + "once_cell", ] [[package]] @@ -1953,9 +2505,27 @@ dependencies = [ [[package]] name = "tinyvec" -version = "0.3.4" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "317cca572a0e89c3ce0ca1f1bdc9369547fe318a683418e42ac8f59d14701023" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" + +[[package]] +name = "toml" +version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "238ce071d267c5710f9d31451efec16c5ee22de34df17cc05e56cbc92e967117" +checksum = "a31142970826733df8241ef35dc040ef98c679ab14d7c3e54d827099b3acecaa" +dependencies = [ + "serde", +] [[package]] name = "typenum" @@ -1965,9 +2535,9 @@ checksum = "373c8a200f9e67a0c95e62a4f52fbf80c23b4381c05a17845531982fa99e6b33" [[package]] name = "uint" -version = "0.8.3" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "173cd16430c206dc1a430af8a89a0e9c076cf15cb42b4aedb10e8cc8fee73681" +checksum = "9db035e67dfaf7edd9aebfe8676afcd63eed53c8a4044fed514c8cccf1835177" dependencies = [ "byteorder", "crunchy", @@ -1975,6 +2545,18 @@ dependencies = [ "static_assertions", ] +[[package]] +name = "uint" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e11fe9a9348741cf134085ad57c249508345fe16411b3d7fb4ff2da2f1d6382e" +dependencies = [ + "byteorder", + "crunchy", + "hex", + "static_assertions", +] + [[package]] name = "unicode-bidi" version = "0.3.4" @@ -1986,18 +2568,18 @@ dependencies = [ [[package]] name = "unicode-normalization" -version = "0.1.13" +version = "0.1.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fb19cf769fa8c6a80a162df694621ebeb4dafb606470b2b2fce0be40a98a977" +checksum = "07fbfce1c8a97d547e8b5334978438d9d6ec8c20e38f56d4a4374d181493eaef" dependencies = [ "tinyvec", ] [[package]] name = "unicode-segmentation" -version = "1.6.0" +version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e83e153d1053cbb5a118eeff7fd5be06ed99153f00dbcd8ae310c5fb2b22edc0" +checksum = "bb0d2e7be6ae3a5fa87eed5fb451aff96f2573d2694942e40543ae0bbe19c796" [[package]] name = "unicode-width" @@ -2007,16 +2589,17 @@ checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3" [[package]] name = "unicode-xid" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c" +checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" [[package]] name = "url" -version = "2.1.1" +version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "829d4a8476c35c9bf0bbce5a3b23f4106f79728039b726d292bb93bc106787cb" +checksum = "9ccd964113622c8e9322cfac19eb1004a07e636c545f325da085d5cdde6f1f8b" dependencies = [ + "form_urlencoded", "idna", "matches", "percent-encoding", @@ -2024,9 +2607,9 @@ dependencies = [ [[package]] name = "validator" -version = "0.10.1" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e60fadf92c22236de4028ceb0b8af50ed3430d41ad43d7a7d63b6bd1a8f47c38" +checksum = "841d6937c33ec6039d8071bcf72933146b5bbe378d645d8fa59bdadabfc2a249" dependencies = [ "idna", "lazy_static", @@ -2035,22 +2618,14 @@ dependencies = [ "serde_derive", "serde_json", "url", + "validator_types", ] [[package]] -name = "validator_derive" -version = "0.10.1" +name = "validator_types" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d577dfb8ca9440a5c0b053d5a19b68f5c92ef57064bac87c8205c3f6072c20f" -dependencies = [ - "if_chain", - "lazy_static", - "proc-macro2", - "quote", - "regex", - "syn", - "validator", -] +checksum = "ad9680608df133af2c1ddd5eaf1ddce91d60d61b6bc51494ef326458365a470a" [[package]] name = "vec_map" @@ -2077,24 +2652,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" [[package]] -name = "wasmer-runtime" -version = "0.17.1" +name = "wasi" +version = "0.10.2+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c92a9ae96b193c35c47fc829265198322cf980edc353a9de32bc87a1545d44f3" -dependencies = [ - "lazy_static", - "memmap", - "serde", - "serde_derive", - "wasmer-runtime-core", - "wasmer-singlepass-backend", -] +checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" [[package]] -name = "wasmer-runtime-core" +name = "wasmer-runtime-core-near" version = "0.17.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "740161245998752cf1a567e860fd6355df0336fedca6be1940ec7aaa59643220" +checksum = "2390b0b8cf58615c2f8b454d9535e1aed1d14c510cc1ce1af806a1992ad53300" dependencies = [ "bincode", "blake3", @@ -2107,7 +2674,7 @@ dependencies = [ "libc", "nix", "page_size", - "parking_lot", + "parking_lot 0.10.2", "rustc_version", "serde", "serde-bench", @@ -2120,10 +2687,24 @@ dependencies = [ ] [[package]] -name = "wasmer-singlepass-backend" +name = "wasmer-runtime-near" +version = "0.17.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6660e86bc7697fa29bab902214d5b33d394a990826c401b10816bcd285f938f" +dependencies = [ + "lazy_static", + "memmap", + "serde", + "serde_derive", + "wasmer-runtime-core-near", + "wasmer-singlepass-backend-near", +] + +[[package]] +name = "wasmer-singlepass-backend-near" version = "0.17.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41a434ebf512ae1c76de46d41935a9ae10775fd937071334bdf5878cc41d9140" +checksum = "d3f23543ef8f59667be4945c22eb4b1a50a79ff340555f6f23354223d2695541" dependencies = [ "bincode", "byteorder", @@ -2135,7 +2716,7 @@ dependencies = [ "serde", "serde_derive", "smallvec", - "wasmer-runtime-core", + "wasmer-runtime-core-near", ] [[package]] @@ -2150,7 +2731,7 @@ version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e" dependencies = [ - "cfg-if", + "cfg-if 0.1.10", "libc", "memory_units", "winapi", @@ -2167,9 +2748,9 @@ dependencies = [ [[package]] name = "winapi" -version = "0.3.8" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8093091eeb260906a183e6ae1abdba2ef5ef2257a21801128899c3fc699229c6" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" dependencies = [ "winapi-i686-pc-windows-gnu", "winapi-x86_64-pc-windows-gnu", @@ -2196,8 +2777,29 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "wyz" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85e60b0d1b5f99db2556934e21937020776a5d31520bf169e851ac44e6420214" + [[package]] name = "zeroize" -version = "1.1.0" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81a974bcdd357f0dca4d41677db03436324d45a4c9ed2d0b873a5a360ce41c36" +dependencies = [ + "zeroize_derive", +] + +[[package]] +name = "zeroize_derive" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cbac2ed2ba24cc90f5e06485ac8c7c1e5449fe8911aef4d8877218af021a5b8" +checksum = "c3f369ddb18862aba61aa49bf31e74d29f0f162dec753063200e1dc084345d16" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] diff --git a/bridge-token-factory/Cargo.toml b/bridge-token-factory/Cargo.toml index 4154440a..afcfcc82 100644 --- a/bridge-token-factory/Cargo.toml +++ b/bridge-token-factory/Cargo.toml @@ -18,22 +18,22 @@ panic = "abort" overflow-checks = true [dependencies] +near-sdk = { git = "https://github.com/near/near-sdk-rs", rev = "613adcab6322e4f830efb4d5bde2a810ae642158" } +near-contract-standards = { git = "https://github.com/near/near-sdk-rs", rev = "613adcab6322e4f830efb4d5bde2a810ae642158" } +eth-types = { git = "https://github.com/near/rainbow-bridge", rev = "3a60b7eac2f06d160bd7b20b67a181961c08055d" } +admin-controlled = { git = "https://github.com/near/rainbow-bridge", rev = "3a60b7eac2f06d160bd7b20b67a181961c08055d" } +tiny-keccak = "1.4.0" +ethabi = "12.0.0" serde = { version = "*", features = ["derive"] } serde_json = "*" -near-sdk = "0.11.0" -borsh = "0.6.2" -# near-sdk = "1.0.0" uint = { version = "0.8.3", default-features = false } -wee_alloc = { version = "0.4.5", default-features = false, features = [] } -near-lib = { git = "https://github.com/ilblackdragon/balancer-near", rev = "a386305c9829d2e5302a78fdc475c8a279fcf6ed"} -eth-types = { git = "https://github.com/near/rainbow-bridge" } -admin-controlled = { git="https://github.com/near/rainbow-bridge.git", rev="ca01d9e39403a08397de63fb5ae544f760ffcedd"} rlp = "0.4.2" -ethabi = "12.0.0" hex = "0.4.2" -tiny-keccak = "1.4.0" [dev-dependencies] -near-test = { git = "https://github.com/ilblackdragon/balancer-near", rev = "a386305c9829d2e5302a78fdc475c8a279fcf6ed"} +near-sdk-sim = { git = "https://github.com/near/near-sdk-rs", rev = "613adcab6322e4f830efb4d5bde2a810ae642158" } +test-token = { git = "https://github.com/mfornet/contracts", rev = "9e115e54bec56842d1380c6ebdd884eab3170583" } +bridge-token = { path = "../bridge-token" } +mock-prover = { path = "../mock-prover" } lazy_static = "1.4.0" -rand = "0.7.3" \ No newline at end of file +rand = "0.7.3" diff --git a/bridge-token-factory/build.sh b/bridge-token-factory/build.sh index b57da171..b7ce6dfb 100755 --- a/bridge-token-factory/build.sh +++ b/bridge-token-factory/build.sh @@ -11,7 +11,7 @@ docker run \ -w /host/bridge-token-factory \ -e RUSTFLAGS='-C link-arg=-s' \ nearprotocol/contract-builder \ - cargo +stable build --target wasm32-unknown-unknown --release + /bin/bash -c "rustup target add wasm32-unknown-unknown; cargo build --target wasm32-unknown-unknown --release" mkdir -p res cp $DIR/target/wasm32-unknown-unknown/release/bridge_token_factory.wasm $DIR/../res/ diff --git a/bridge-token-factory/rust-toolchain b/bridge-token-factory/rust-toolchain new file mode 100644 index 00000000..ed83872a --- /dev/null +++ b/bridge-token-factory/rust-toolchain @@ -0,0 +1 @@ +stable-2020-10-08 diff --git a/bridge-token-factory/src/lib.rs b/bridge-token-factory/src/lib.rs index ef6fa016..7b050828 100644 --- a/bridge-token-factory/src/lib.rs +++ b/bridge-token-factory/src/lib.rs @@ -1,13 +1,12 @@ -use borsh::{BorshDeserialize, BorshSerialize}; +use admin_controlled::{AdminControlled, Mask}; +use near_sdk::borsh::{self, BorshDeserialize, BorshSerialize}; use near_sdk::collections::UnorderedSet; use near_sdk::json_types::U128; use near_sdk::{ - env, ext_contract, near_bindgen, AccountId, Balance, Gas, Promise, PromiseResult, PublicKey, + env, ext_contract, near_bindgen, AccountId, Balance, Gas, PanicOnDefault, Promise, PublicKey, }; -use admin_controlled::{AdminControlled, Mask}; -use near_lib::token::ext_nep21; - +type EthereumAddress = [u8; 20]; pub use lock_event::EthLockedEvent; use prover::*; pub use prover::{validate_eth_address, Proof}; @@ -17,38 +16,48 @@ mod lock_event; pub mod prover; mod unlock_event; -#[global_allocator] -static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT; +near_sdk::setup_alloc!(); /// Price per 1 byte of storage from mainnet genesis config. -const STORAGE_PRICE_PER_BYTE: Balance = 100_000_000_000_000_000_000; // 1e20yN, 0.0001N +const STORAGE_PRICE_PER_BYTE: Balance = 10_000_000_000_000_000_000; // 1e19yN, 0.00001N const NO_DEPOSIT: Balance = 0; +/// Initial balance for the BridgeToken contract to cover storage and related. +const BRIDGE_TOKEN_INIT_BALANCE: Balance = 3_000_000_000_000_000_000_000_000; // 3e24yN, 3N + /// Gas to initialize BridgeToken contract. const BRIDGE_TOKEN_NEW: Gas = 10_000_000_000_000; -/// Initial balance for the BridgeToken contract to cover storage and related. -const BRIDGE_TOKEN_INIT_BALANCE: Balance = 30_000_000_000_000_000_000_000_000; // 3e25yN, 30N +/// Gas to call mint method on bridge token. +const MINT_GAS: Gas = 50_000_000_000_000; -const TRANSFER_FROM_GAS: Gas = 10_000_000_000_000; +/// Gas to call finish deposit method. +/// This doesn't cover the gas required for calling mint method. +const FINISH_DEPOSIT_GAS: Gas = 50_000_000_000_000; -const TRANSFER_GAS: Gas = 10_000_000_000_000; +/// Gas to call verify_log_entry on prover. +const VERIFY_LOG_ENTRY_GAS: Gas = 50_000_000_000_000; #[derive(Debug, Eq, PartialEq, BorshSerialize, BorshDeserialize)] pub enum ResultType { - Withdraw, - Lock, + Withdraw { + amount: Balance, + token: EthereumAddress, + recipient: EthereumAddress, + }, + Lock { + token: String, + amount: Balance, + recipient: EthereumAddress, + }, } const PAUSE_DEPLOY_TOKEN: Mask = 1 << 0; const PAUSE_DEPOSIT: Mask = 1 << 1; -const PAUSE_WITHDRAW: Mask = 1 << 2; -const PAUSE_LOCK: Mask = 1 << 3; -const PAUSE_UNLOCK: Mask = 1 << 4; #[near_bindgen] -#[derive(BorshDeserialize, BorshSerialize)] +#[derive(BorshDeserialize, BorshSerialize, PanicOnDefault)] pub struct BridgeTokenFactory { /// The account of the prover that we can use to prove pub prover_account: AccountId, @@ -60,16 +69,12 @@ pub struct BridgeTokenFactory { pub used_events: UnorderedSet>, /// Public key of the account deploying the factory. pub owner_pk: PublicKey, + /// Balance required to register a new account in the BridgeToken + pub bridge_token_storage_deposit_required: Balance, /// Mask determining all paused functions paused: Mask, } -impl Default for BridgeTokenFactory { - fn default() -> Self { - panic!("Fun token should be initialized before usage") - } -} - #[ext_contract(ext_self)] pub trait ExtBridgeTokenFactory { #[result_serializer(borsh)] @@ -83,49 +88,22 @@ pub trait ExtBridgeTokenFactory { #[serializer(borsh)] amount: Balance, #[serializer(borsh)] proof: Proof, ) -> Promise; +} - #[result_serializer(borsh)] - fn finish_lock( - &self, - #[serializer(borsh)] amount: Balance, - #[serializer(borsh)] recipient: [u8; 20], - #[serializer(borsh)] token: String, - ) -> (U128, [u8; 20], String); - - #[result_serializer(borsh)] - fn finish_unlock( - &self, - #[callback] - #[serializer(borsh)] - verification_success: bool, - #[serializer(borsh)] token: AccountId, - #[serializer(borsh)] recipient: AccountId, - #[serializer(borsh)] amount: Balance, - #[serializer(borsh)] proof: Proof, - ) -> Promise; +#[ext_contract(ext_fungible_token)] +pub trait FungibleToken { + fn ft_transfer(&mut self, receiver_id: AccountId, amount: U128, memo: Option); } #[ext_contract(ext_bridge_token)] pub trait ExtBridgeToken { - fn mint(&self, account_id: AccountId, amount: U128) -> Promise; + fn mint(&self, account_id: AccountId, amount: U128); } pub fn assert_self() { assert_eq!(env::predecessor_account_id(), env::current_account_id()); } -pub fn is_promise_success() -> bool { - assert_eq!( - env::promise_results_count(), - 1, - "Contract expected a result on the callback" - ); - match env::promise_result(0) { - PromiseResult::Successful(_) => true, - _ => false, - } -} - #[near_bindgen] impl BridgeTokenFactory { /// Initializes the contract. @@ -140,13 +118,16 @@ impl BridgeTokenFactory { tokens: UnorderedSet::new(b"t".to_vec()), used_events: UnorderedSet::new(b"u".to_vec()), owner_pk: env::signer_account_pk(), + bridge_token_storage_deposit_required: + near_contract_standards::fungible_token::FungibleToken::new(b"t".to_vec()) + .account_storage_usage as Balance + * STORAGE_PRICE_PER_BYTE, paused: Mask::default(), } } /// Deposit from Ethereum to NEAR based on the proof of the locked tokens. /// Must attach enough NEAR funds to cover for storage of the proof. - /// Also if this is first time this token is used, need to attach extra to deploy the BridgeToken contract. #[payable] pub fn deposit(&mut self, #[serializer(borsh)] proof: Proof) -> Promise { self.check_not_paused(PAUSE_DEPOSIT); @@ -174,7 +155,7 @@ impl BridgeTokenFactory { false, // Do not skip bridge call. This is only used for development and diagnostics. &self.prover_account, NO_DEPOSIT, - env::prepaid_gas() / 4, + VERIFY_LOG_ENTRY_GAS, ) .then(ext_self::finish_deposit( event.token, @@ -183,7 +164,7 @@ impl BridgeTokenFactory { proof_1, &env::current_account_id(), env::attached_deposit(), - env::prepaid_gas() / 2, + FINISH_DEPOSIT_GAS + MINT_GAS, )) } @@ -199,18 +180,24 @@ impl BridgeTokenFactory { #[serializer(borsh)] new_owner_id: AccountId, #[serializer(borsh)] amount: Balance, #[serializer(borsh)] proof: Proof, - ) -> Promise { + ) { assert_self(); assert!(verification_success, "Failed to verify the proof"); - self.record_proof(&proof); + + let required_deposit = self.record_proof(&proof); + + assert!( + env::attached_deposit() + >= required_deposit + self.bridge_token_storage_deposit_required + ); ext_bridge_token::mint( new_owner_id, amount.into(), &self.get_bridge_token_account_id(token), - NO_DEPOSIT, - env::prepaid_gas() / 2, - ) + env::attached_deposit() - required_deposit, + MINT_GAS, + ); } /// Burn given amount of tokens and unlock it on the Ethereum side for the recipient address. @@ -222,8 +209,7 @@ impl BridgeTokenFactory { &mut self, #[serializer(borsh)] amount: Balance, #[serializer(borsh)] recipient: String, - ) -> (ResultType, u128, [u8; 20], [u8; 20]) { - self.check_not_paused(PAUSE_WITHDRAW); + ) -> ResultType { let token = env::predecessor_account_id(); let parts: Vec<&str> = token.split(".").collect(); assert_eq!( @@ -237,12 +223,11 @@ impl BridgeTokenFactory { ); let token_address = validate_eth_address(parts[0].to_string()); let recipient_address = validate_eth_address(recipient); - ( - ResultType::Withdraw, - amount.into(), - token_address, - recipient_address, - ) + ResultType::Withdraw { + amount: amount.into(), + token: token_address, + recipient: recipient_address, + } } #[payable] @@ -287,104 +272,6 @@ impl BridgeTokenFactory { format!("{}.{}", address, env::current_account_id()) } - /// Locks NEP-21 token on NEAR side to mint on Ethereum it's counterpart. - #[payable] - pub fn lock(&mut self, token: AccountId, amount: U128, recipient: String) -> Promise { - self.check_not_paused(PAUSE_LOCK); - assert!(false, "Native NEP21 on Ethereum is disabled."); - let address = validate_eth_address(recipient); - ext_nep21::transfer_from( - env::predecessor_account_id(), - env::current_account_id(), - amount, - &token, - env::attached_deposit(), - TRANSFER_FROM_GAS, - ) - .then(ext_self::finish_lock( - amount.into(), - address, - token, - &env::current_account_id(), - NO_DEPOSIT, - env::prepaid_gas() / 3, - )) - } - - /// Callback after transfer_from happened. - #[result_serializer(borsh)] - pub fn finish_lock( - &self, - #[serializer(borsh)] amount: Balance, - #[serializer(borsh)] recipient: [u8; 20], - #[serializer(borsh)] token: String, - ) -> (ResultType, String, u128, [u8; 20]) { - assert!(false, "Native NEP21 on Ethereum is disabled."); - assert_self(); - assert!(is_promise_success()); - (ResultType::Lock, token, amount.into(), recipient) - } - - #[payable] - pub fn unlock(&mut self, #[serializer(borsh)] proof: Proof) -> Promise { - self.check_not_paused(PAUSE_UNLOCK); - assert!(false, "Native NEP21 on Ethereum is disabled."); - let event = EthUnlockedEvent::from_log_entry_data(&proof.log_entry_data); - assert_eq!( - event.locker_address, - self.locker_address, - "Event's address {} does not match locker address of this token {}", - hex::encode(&event.locker_address), - hex::encode(&self.locker_address), - ); - let proof_1 = proof.clone(); - ext_prover::verify_log_entry( - proof.log_index, - proof.log_entry_data, - proof.receipt_index, - proof.receipt_data, - proof.header_data, - proof.proof, - false, // Do not skip bridge call. This is only used for development and diagnostics. - &self.prover_account, - NO_DEPOSIT, - env::prepaid_gas() / 4, - ) - .then(ext_self::finish_unlock( - event.token, - event.recipient, - event.amount, - proof_1, - &env::current_account_id(), - env::attached_deposit(), - env::prepaid_gas() / 2, - )) - } - - #[payable] - pub fn finish_unlock( - &mut self, - #[callback] - #[serializer(borsh)] - verification_success: bool, - #[serializer(borsh)] token: AccountId, - #[serializer(borsh)] recipient: AccountId, - #[serializer(borsh)] amount: Balance, - #[serializer(borsh)] proof: Proof, - ) -> Promise { - assert!(false, "Native NEP21 on Ethereum is disabled."); - assert_self(); - assert!(verification_success, "Failed to verify the proof"); - self.record_proof(&proof); - ext_nep21::transfer( - recipient, - amount.into(), - &token, - env::attached_deposit(), - TRANSFER_GAS, - ) - } - /// Record proof to make sure it is not re-used later for anther deposit. fn record_proof(&mut self, proof: &Proof) -> Balance { // TODO: Instead of sending the full proof (clone only relevant parts of the Proof) @@ -401,30 +288,19 @@ impl BridgeTokenFactory { ); self.used_events.insert(&key); let current_storage = env::storage_usage(); - let attached_deposit = env::attached_deposit(); let required_deposit = Balance::from(current_storage - initial_storage) * STORAGE_PRICE_PER_BYTE; - attached_deposit - required_deposit + required_deposit } } -impl AdminControlled for BridgeTokenFactory { - fn get_paused(&self) -> Mask { - self.paused - } - - fn set_paused(&mut self, paused: Mask) { - self.assert_owner(); - self.paused = paused; - } -} +admin_controlled::impl_admin_controlled!(BridgeTokenFactory, paused); #[cfg(not(target_arch = "wasm32"))] #[cfg(test)] mod tests { - use near_sdk::testing_env; - use near_sdk::MockedBlockchain; - use near_test::context::VMContextBuilder; + use near_sdk::test_utils::VMContextBuilder; + use near_sdk::{testing_env, MockedBlockchain}; use super::*; use near_sdk::env::sha256; @@ -434,6 +310,28 @@ mod tests { const UNPAUSE_ALL: Mask = 0; + macro_rules! inner_set_env { + ($builder:ident) => { + $builder + }; + + ($builder:ident, $key:ident:$value:expr $(,$key_tail:ident:$value_tail:expr)*) => { + { + $builder.$key($value.try_into().unwrap()); + inner_set_env!($builder $(,$key_tail:$value_tail)*) + } + }; + } + + macro_rules! set_env { + ($($key:ident:$value:expr),* $(,)?) => { + let mut builder = VMContextBuilder::new(); + let mut builder = &mut builder; + builder = inner_set_env!(builder, $($key: $value),*); + testing_env!(builder.build()); + }; + } + fn alice() -> AccountId { "alice.near".to_string() } @@ -499,42 +397,37 @@ mod tests { #[test] #[should_panic] fn test_fail_deploy_bridge_token() { - testing_env!(VMContextBuilder::new() - .predecessor_account_id(alice()) - .finish()); + set_env!(predecessor_account_id: alice()); let mut contract = BridgeTokenFactory::new(prover(), token_locker()); - testing_env!(VMContextBuilder::new() - .predecessor_account_id(alice()) - .attached_deposit(BRIDGE_TOKEN_INIT_BALANCE) - .finish()); + set_env!( + predecessor_account_id: alice(), + attached_deposit: BRIDGE_TOKEN_INIT_BALANCE, + ); contract.deploy_bridge_token(token_locker()); } #[test] #[should_panic] fn test_fail_deposit_no_token() { - testing_env!(VMContextBuilder::new() - .predecessor_account_id(alice()) - .finish()); + set_env!(predecessor_account_id: alice()); let mut contract = BridgeTokenFactory::new(prover(), token_locker()); - testing_env!(VMContextBuilder::new() - .predecessor_account_id(alice()) - .attached_deposit(STORAGE_PRICE_PER_BYTE * 1000) - .finish()); + set_env!( + predecessor_account_id: alice(), + attached_deposit: STORAGE_PRICE_PER_BYTE * 1000 + ); contract.deposit(sample_proof()); } #[test] fn test_deploy_bridge_token() { - testing_env!(VMContextBuilder::new() - .predecessor_account_id(alice()) - .finish()); + set_env!(predecessor_account_id: alice()); let mut contract = BridgeTokenFactory::new(prover(), token_locker()); - testing_env!(VMContextBuilder::new() - .current_account_id(bridge_token_factory()) - .predecessor_account_id(alice()) - .attached_deposit(BRIDGE_TOKEN_INIT_BALANCE * 2) - .finish()); + set_env!( + current_account_id: bridge_token_factory(), + predecessor_account_id: alice(), + attached_deposit: BRIDGE_TOKEN_INIT_BALANCE * 2, + ); + contract.deploy_bridge_token(token_locker()); assert_eq!( contract.get_bridge_token_account_id(token_locker()), @@ -555,63 +448,66 @@ mod tests { #[test] fn test_finish_withdraw() { - testing_env!(VMContextBuilder::new() - .predecessor_account_id(alice()) - .finish()); + set_env!(predecessor_account_id: alice()); let mut contract = BridgeTokenFactory::new(prover(), token_locker()); - testing_env!(VMContextBuilder::new() - .predecessor_account_id(alice()) - .attached_deposit(BRIDGE_TOKEN_INIT_BALANCE * 2) - .finish()); + + set_env!( + predecessor_account_id: alice(), + attached_deposit: BRIDGE_TOKEN_INIT_BALANCE * 2 + ); contract.deploy_bridge_token(token_locker()); - testing_env!(VMContextBuilder::new() - .current_account_id(bridge_token_factory()) - .predecessor_account_id(format!("{}.{}", token_locker(), bridge_token_factory())) - .finish()); + + set_env!( + current_account_id: bridge_token_factory(), + predecessor_account_id: format!("{}.{}", token_locker(), bridge_token_factory()) + ); + let address = validate_eth_address(token_locker()); assert_eq!( contract.finish_withdraw(1_000, token_locker()), - (ResultType::Withdraw, 1_000, address, address) + ResultType::Withdraw { + amount: 1_000, + token: address, + recipient: address + } ); } #[test] fn deploy_bridge_token_paused() { - testing_env!(VMContextBuilder::new() - .predecessor_account_id(alice()) - .finish()); + set_env!(predecessor_account_id: alice()); // User alice can deploy a new bridge token let mut contract = BridgeTokenFactory::new(prover(), token_locker()); - testing_env!(VMContextBuilder::new() - .current_account_id(bridge_token_factory()) - .predecessor_account_id(alice()) - .attached_deposit(BRIDGE_TOKEN_INIT_BALANCE * 2) - .finish()); + set_env!( + current_account_id: bridge_token_factory(), + predecessor_account_id: alice(), + attached_deposit: BRIDGE_TOKEN_INIT_BALANCE * 2 + ); contract.deploy_bridge_token(ethereum_address_from_id(0)); // Admin pause deployment of new token - testing_env!(VMContextBuilder::new() - .current_account_id(bridge_token_factory()) - .signer_account_id(bridge_token_factory()) - .attached_deposit(BRIDGE_TOKEN_INIT_BALANCE * 2) - .finish()); + set_env!( + current_account_id: bridge_token_factory(), + predecessor_account_id: bridge_token_factory(), + attached_deposit: BRIDGE_TOKEN_INIT_BALANCE * 2 + ); contract.set_paused(PAUSE_DEPLOY_TOKEN); + set_env!( + current_account_id: bridge_token_factory(), + predecessor_account_id: bridge_token_factory(), + attached_deposit: BRIDGE_TOKEN_INIT_BALANCE * 2 + ); // Admin can still deploy new tokens after paused - testing_env!(VMContextBuilder::new() - .current_account_id(bridge_token_factory()) - .signer_account_id(bridge_token_factory()) - .attached_deposit(BRIDGE_TOKEN_INIT_BALANCE * 2) - .finish()); contract.deploy_bridge_token(ethereum_address_from_id(1)); // User alice can't deploy a new bridge token when it is paused - testing_env!(VMContextBuilder::new() - .current_account_id(bridge_token_factory()) - .signer_account_id(alice()) - .attached_deposit(BRIDGE_TOKEN_INIT_BALANCE * 2) - .finish()); + set_env!( + current_account_id: bridge_token_factory(), + predecessor_account_id: alice(), + attached_deposit: BRIDGE_TOKEN_INIT_BALANCE * 2 + ); panic::catch_unwind(move || { contract.deploy_bridge_token(ethereum_address_from_id(2)); }) @@ -620,23 +516,21 @@ mod tests { #[test] fn only_admin_can_pause() { - testing_env!(VMContextBuilder::new() - .predecessor_account_id(alice()) - .finish()); + set_env!(predecessor_account_id: alice()); let mut contract = BridgeTokenFactory::new(prover(), token_locker()); // Admin can pause - testing_env!(VMContextBuilder::new() - .current_account_id(bridge_token_factory()) - .signer_account_id(bridge_token_factory()) - .finish()); + set_env!( + current_account_id: bridge_token_factory(), + predecessor_account_id: bridge_token_factory(), + ); contract.set_paused(0b1111); // Alice can't pause - testing_env!(VMContextBuilder::new() - .current_account_id(bridge_token_factory()) - .signer_account_id(alice()) - .finish()); + set_env!( + current_account_id: bridge_token_factory(), + predecessor_account_id: alice(), + ); panic::catch_unwind(move || { contract.set_paused(0); @@ -646,16 +540,14 @@ mod tests { #[test] fn deposit_paused() { - testing_env!(VMContextBuilder::new() - .predecessor_account_id(alice()) - .finish()); + set_env!(predecessor_account_id: alice()); let mut contract = BridgeTokenFactory::new(prover(), token_locker()); - testing_env!(VMContextBuilder::new() - .current_account_id(bridge_token_factory()) - .signer_account_id(alice()) - .attached_deposit(BRIDGE_TOKEN_INIT_BALANCE * 2) - .finish()); + set_env!( + current_account_id: bridge_token_factory(), + predecessor_account_id: alice(), + attached_deposit: BRIDGE_TOKEN_INIT_BALANCE * 2 + ); let erc20_address = ethereum_address_from_id(0); contract.deploy_bridge_token(erc20_address.clone()); @@ -663,18 +555,18 @@ mod tests { contract.deposit(create_proof(token_locker(), erc20_address.clone())); // Pause deposit - testing_env!(VMContextBuilder::new() - .current_account_id(bridge_token_factory()) - .signer_account_id(bridge_token_factory()) - .attached_deposit(BRIDGE_TOKEN_INIT_BALANCE * 2) - .finish()); + set_env!( + current_account_id: bridge_token_factory(), + predecessor_account_id: bridge_token_factory(), + attached_deposit: BRIDGE_TOKEN_INIT_BALANCE * 2 + ); contract.set_paused(PAUSE_DEPOSIT); - testing_env!(VMContextBuilder::new() - .current_account_id(bridge_token_factory()) - .signer_account_id(alice()) - .attached_deposit(BRIDGE_TOKEN_INIT_BALANCE * 2) - .finish()); + set_env!( + current_account_id: bridge_token_factory(), + predecessor_account_id: alice(), + attached_deposit: BRIDGE_TOKEN_INIT_BALANCE * 2 + ); // Check it is NOT possible to use deposit while the contract is paused panic::catch_unwind(move || { @@ -683,67 +575,17 @@ mod tests { .unwrap_err(); } - #[test] - fn withdraw_paused() { - testing_env!(VMContextBuilder::new() - .predecessor_account_id(alice()) - .finish()); - let mut contract = BridgeTokenFactory::new(prover(), token_locker()); - - testing_env!(VMContextBuilder::new() - .current_account_id(bridge_token_factory()) - .signer_account_id(alice()) - .attached_deposit(BRIDGE_TOKEN_INIT_BALANCE * 2) - .finish()); - - let erc20_address = ethereum_address_from_id(0); - let token_name = format!("{}.{}", erc20_address, bridge_token_factory()); - contract.deploy_bridge_token(erc20_address.clone()); - - testing_env!(VMContextBuilder::new() - .current_account_id(bridge_token_factory()) - .predecessor_account_id(token_name.clone()) - .attached_deposit(BRIDGE_TOKEN_INIT_BALANCE * 2) - .finish()); - - // Check it is possible to use withdraw while the contract is NOT paused - let recipient = ethereum_address_from_id(1); - contract.finish_withdraw(0, recipient.clone()); - - // Pause withdraw - testing_env!(VMContextBuilder::new() - .current_account_id(bridge_token_factory()) - .signer_account_id(bridge_token_factory()) - .attached_deposit(BRIDGE_TOKEN_INIT_BALANCE * 2) - .finish()); - contract.set_paused(PAUSE_WITHDRAW); - - testing_env!(VMContextBuilder::new() - .current_account_id(bridge_token_factory()) - .predecessor_account_id(token_name.clone()) - .attached_deposit(BRIDGE_TOKEN_INIT_BALANCE * 2) - .finish()); - - // Check it is NOT possible to use withdraw while the contract is paused - panic::catch_unwind(move || { - contract.finish_withdraw(0, recipient.clone()); - }) - .unwrap_err(); - } - /// Check after all is paused deposit is not available #[test] fn all_paused() { - testing_env!(VMContextBuilder::new() - .predecessor_account_id(alice()) - .finish()); + set_env!(predecessor_account_id: alice()); let mut contract = BridgeTokenFactory::new(prover(), token_locker()); - testing_env!(VMContextBuilder::new() - .current_account_id(bridge_token_factory()) - .signer_account_id(alice()) - .attached_deposit(BRIDGE_TOKEN_INIT_BALANCE * 2) - .finish()); + set_env!( + current_account_id: bridge_token_factory(), + predecessor_account_id: alice(), + attached_deposit: BRIDGE_TOKEN_INIT_BALANCE * 2 + ); let erc20_address = ethereum_address_from_id(0); contract.deploy_bridge_token(erc20_address.clone()); @@ -751,20 +593,18 @@ mod tests { contract.deposit(create_proof(token_locker(), erc20_address.clone())); // Pause everything - testing_env!(VMContextBuilder::new() - .current_account_id(bridge_token_factory()) - .signer_account_id(bridge_token_factory()) - .attached_deposit(BRIDGE_TOKEN_INIT_BALANCE * 2) - .finish()); - contract.set_paused( - PAUSE_DEPLOY_TOKEN | PAUSE_DEPOSIT | PAUSE_WITHDRAW | PAUSE_LOCK | PAUSE_UNLOCK, + set_env!( + current_account_id: bridge_token_factory(), + predecessor_account_id: bridge_token_factory(), + attached_deposit: BRIDGE_TOKEN_INIT_BALANCE * 2 ); + contract.set_paused(PAUSE_DEPLOY_TOKEN | PAUSE_DEPOSIT); - testing_env!(VMContextBuilder::new() - .current_account_id(bridge_token_factory()) - .signer_account_id(alice()) - .attached_deposit(BRIDGE_TOKEN_INIT_BALANCE * 2) - .finish()); + set_env!( + current_account_id: bridge_token_factory(), + predecessor_account_id: alice(), + attached_deposit: BRIDGE_TOKEN_INIT_BALANCE * 2 + ); // Check it is NOT possible to use deposit while the contract is paused panic::catch_unwind(move || { @@ -776,16 +616,14 @@ mod tests { /// Check after all is paused and unpaused deposit works #[test] fn no_paused() { - testing_env!(VMContextBuilder::new() - .predecessor_account_id(alice()) - .finish()); + set_env!(predecessor_account_id: alice()); let mut contract = BridgeTokenFactory::new(prover(), token_locker()); - testing_env!(VMContextBuilder::new() - .current_account_id(bridge_token_factory()) - .signer_account_id(alice()) - .attached_deposit(BRIDGE_TOKEN_INIT_BALANCE * 2) - .finish()); + set_env!( + current_account_id: bridge_token_factory(), + predecessor_account_id: alice(), + attached_deposit: BRIDGE_TOKEN_INIT_BALANCE * 2 + ); let erc20_address = ethereum_address_from_id(0); contract.deploy_bridge_token(erc20_address.clone()); @@ -793,22 +631,20 @@ mod tests { contract.deposit(create_proof(token_locker(), erc20_address.clone())); // Pause everything - testing_env!(VMContextBuilder::new() - .current_account_id(bridge_token_factory()) - .signer_account_id(bridge_token_factory()) - .attached_deposit(BRIDGE_TOKEN_INIT_BALANCE * 2) - .finish()); - - contract.set_paused( - PAUSE_DEPLOY_TOKEN | PAUSE_DEPOSIT | PAUSE_WITHDRAW | PAUSE_LOCK | PAUSE_UNLOCK, + set_env!( + current_account_id: bridge_token_factory(), + predecessor_account_id: bridge_token_factory(), + attached_deposit: BRIDGE_TOKEN_INIT_BALANCE * 2 ); + + contract.set_paused(PAUSE_DEPLOY_TOKEN | PAUSE_DEPOSIT); contract.set_paused(UNPAUSE_ALL); - testing_env!(VMContextBuilder::new() - .current_account_id(bridge_token_factory()) - .signer_account_id(alice()) - .attached_deposit(BRIDGE_TOKEN_INIT_BALANCE * 2) - .finish()); + set_env!( + current_account_id: bridge_token_factory(), + predecessor_account_id: alice(), + attached_deposit: BRIDGE_TOKEN_INIT_BALANCE * 2 + ); // Check the deposit works after pausing and unpausing everything contract.deposit(create_proof(token_locker(), erc20_address)); diff --git a/bridge-token-factory/src/prover.rs b/bridge-token-factory/src/prover.rs index 47500cf6..d3c920af 100644 --- a/bridge-token-factory/src/prover.rs +++ b/bridge-token-factory/src/prover.rs @@ -1,12 +1,11 @@ use std::convert::From; -use borsh::{BorshDeserialize, BorshSerialize}; use eth_types::*; -use ethabi::param_type::Writer; use ethabi::{Event, EventParam, Hash, Log, ParamType, RawLog, Token}; -//use near_sdk::borsh::{self, BorshDeserialize, BorshSerialize}; +use ethabi::param_type::Writer; +use near_sdk::borsh::{self, BorshDeserialize, BorshSerialize}; use near_sdk::ext_contract; - +use near_sdk::serde::{Serialize, Deserialize}; use tiny_keccak::Keccak; pub type EthAddress = [u8; 20]; @@ -34,7 +33,7 @@ pub trait Prover { ) -> bool; } -#[derive(Default, BorshDeserialize, BorshSerialize, Clone)] +#[derive(Default, BorshDeserialize, BorshSerialize, Clone, Serialize, Deserialize)] pub struct Proof { pub log_index: u64, pub log_entry_data: Vec, diff --git a/bridge-token-factory/tests/token_transfer.rs b/bridge-token-factory/tests/token_transfer.rs index 68a568cf..450737b1 100644 --- a/bridge-token-factory/tests/token_transfer.rs +++ b/bridge-token-factory/tests/token_transfer.rs @@ -1,10 +1,15 @@ -use borsh::BorshSerialize; -use near_sdk::{AccountId, Balance}; -use near_test::test_user::{init_test_runtime, to_yocto, TestRuntime, TxResult}; -use near_test::token::TokenContract; +use near_sdk::borsh::{self, BorshSerialize}; use serde_json::json; -use bridge_token_factory::{validate_eth_address, EthLockedEvent, EthUnlockedEvent, Proof}; +use bridge_token_factory::BridgeTokenFactoryContract; +use bridge_token_factory::{validate_eth_address, EthLockedEvent, Proof}; +use mock_prover::MockProverContract; +use near_sdk::json_types::ValidAccountId; +use near_sdk_sim::runtime::GenesisConfig; +use near_sdk_sim::{ + call, deploy, init_simulator, units::to_yocto, view, ContractAccount, ExecutionResult, + UserAccount, +}; const PROVER: &str = "prover"; const FACTORY: &str = "bridge"; @@ -12,209 +17,155 @@ const LOCKER_ADDRESS: &str = "11111474e89094c44da98b954eedeac495271d0f"; const DAI_ADDRESS: &str = "6b175474e89094c44da98b954eedeac495271d0f"; const SENDER_ADDRESS: &str = "00005474e89094c44da98b954eedeac495271d0f"; const ALICE: &str = "alice"; -const TEST_TOKEN: &str = "test-token"; -lazy_static::lazy_static! { - static ref MOCK_PROVER_WASM_BYTES: &'static [u8] = include_bytes!("../../res/mock_prover.wasm").as_ref(); - static ref FACTORY_WASM_BYTES: &'static [u8] = include_bytes!("../../res/bridge_token_factory.wasm").as_ref(); - static ref TEST_TOKEN_WASM_BYTES: &'static [u8] = include_bytes!("../../res/test_token.wasm").as_ref(); +near_sdk_sim::lazy_static_include::lazy_static_include_bytes! { + TEST_TOKEN_WASM_BYTES => "../res/test_token.wasm", + TOKEN_WASM_BYTES => "../res/bridge_token.wasm", + FACTORY_WASM_BYTES => "../res/bridge_token_factory.wasm", + MOCK_PROVER_WASM_BYTES => "../res/mock_prover.wasm", } -pub struct BridgeToken { - pub contract_id: AccountId, -} - -impl BridgeToken { - pub fn get_balance(&self, runtime: &mut TestRuntime, owner: String) -> String { - TokenContract { - contract_id: self.contract_id.clone(), - } - .get_balance(runtime, owner) - } - - pub fn get_total_supply(&self, runtime: &mut TestRuntime) -> String { - TokenContract { - contract_id: self.contract_id.clone(), - } - .get_total_supply(runtime) - } - - pub fn mint( - &self, - runtime: &mut TestRuntime, - signer_id: AccountId, - account_id: AccountId, - amount: String, - ) -> TxResult { - runtime.call( - signer_id, - self.contract_id.clone(), - "mint", - json!({"amount": amount, "account_id": account_id}), - 0, +fn setup_token_factory() -> (UserAccount, ContractAccount) { + let mut config = GenesisConfig::default(); + config.runtime_config.storage_amount_per_byte = 10u128.pow(19); + let root = init_simulator(Some(config)); + let _prover = deploy!( + contract: MockProverContract, + contract_id: PROVER.to_string(), + bytes: &MOCK_PROVER_WASM_BYTES, + signer_account: root + ); + let factory = deploy!( + contract: BridgeTokenFactoryContract, + contract_id: FACTORY.to_string(), + bytes: &FACTORY_WASM_BYTES, + signer_account: root, + init_method: new( + PROVER.to_string(), LOCKER_ADDRESS.to_string() ) - } + ); - pub fn withdraw( - &self, - runtime: &mut TestRuntime, - signer_id: AccountId, - amount: String, - recipient: String, - ) -> TxResult { - runtime.call( - signer_id, - self.contract_id.clone(), - "withdraw", - json!({"amount": amount, "recipient": recipient}), - 0, - ) - } + (root, factory) } -pub struct BridgeTokenFactory { - contract_id: AccountId, +#[derive(BorshSerialize)] +struct AugmentedProof { + proof: Proof, + skip_call: bool, } -impl BridgeTokenFactory { - pub fn new( - runtime: &mut TestRuntime, - signer_id: &AccountId, - contract_id: AccountId, - prover_account: AccountId, - locker_address: String, - ) -> Self { - let _ = runtime - .deploy( - signer_id.clone(), - contract_id.clone(), - &FACTORY_WASM_BYTES, - json!({"prover_account": prover_account, "locker_address": locker_address}), - ) - .unwrap(); - Self { contract_id } +impl From for AugmentedProof { + fn from(proof: Proof) -> Self { + Self { + proof, + skip_call: false, + } } +} - pub fn deposit( - &self, - runtime: &mut TestRuntime, - signer_id: &AccountId, - proof: Proof, - ) -> TxResult { - runtime.call_args( - signer_id.clone(), - self.contract_id.clone(), - "deposit", - proof.try_to_vec().unwrap(), - to_yocto("1"), +#[macro_export] +macro_rules! call_json { + ($signer:expr, $contract:ident, $method:ident, $arg:tt, $gas:expr, $deposit:expr) => { + $signer.call( + $contract.clone(), + stringify!($method), + json!($arg).to_string().into_bytes().as_ref(), + $gas, + $deposit, ) - } - - pub fn deploy_bridge_token( - &self, - runtime: &mut TestRuntime, - signer_id: &AccountId, - address: String, - deposit: Balance, - ) -> TxResult { - runtime.call( - signer_id.clone(), - self.contract_id.clone(), - "deploy_bridge_token", - json!({ "address": address }), - deposit, + }; + ($signer:expr, $contract:ident.$method:ident($arg:tt), $gas:expr, $deposit:expr) => { + call_json!($signer, $contract, $method, $arg, $gas, $deposit) + }; + ($signer:expr, $contract:ident.$method:ident($arg:tt)) => { + call_json!( + $signer, + $contract, + $method, + $arg, + near_sdk_sim::DEFAULT_GAS, + near_sdk_sim::STORAGE_AMOUNT ) - } - - pub fn get_bridge_token_account_id( - &self, - runtime: &mut TestRuntime, - address: String, - ) -> String { - runtime - .view( - self.contract_id.clone(), - "get_bridge_token_account_id", - json!({ "address": address }), - ) - .as_str() - .unwrap() - .to_string() - } - - pub fn lock( - &self, - runtime: &mut TestRuntime, - signer_id: AccountId, - token: AccountId, - amount: Balance, - recipient: String, - ) -> TxResult { - runtime.call( - signer_id.clone(), - self.contract_id.clone(), - "lock", - json!({"token": token, "amount": amount.to_string(), "recipient": recipient}), - to_yocto("0.005"), + }; + ($signer:expr, $contract:ident.$method:ident($arg:tt), deposit=$deposit:expr) => { + call_json!( + $signer, + $contract, + $method, + $arg, + near_sdk_sim::DEFAULT_GAS, + $deposit ) - } + }; +} - pub fn unlock( - &self, - runtime: &mut TestRuntime, - signer_id: AccountId, - proof: Proof, - ) -> TxResult { - runtime.call_args( - signer_id.clone(), - self.contract_id.clone(), - "unlock", - proof.try_to_vec().unwrap(), - to_yocto("1"), +#[macro_export] +macro_rules! call_borsh { + ($signer:expr, $contract:ident, $method:ident, $arg:expr, $gas:expr, $deposit:expr) => { + $signer.call( + $contract.clone(), + stringify!($method), + &$arg.try_to_vec().unwrap(), + $gas, + $deposit, ) - } + }; + ($signer:expr, $contract:ident.$method:ident($arg:expr), $gas:expr, $deposit:expr) => { + call_borsh!($signer, $contract, $method, $arg, $gas, $deposit) + }; + ($signer:expr, $contract:ident.$method:ident($arg:expr)) => { + call_borsh!( + $signer, + $contract, + $method, + $arg, + near_sdk_sim::DEFAULT_GAS, + near_sdk_sim::STORAGE_AMOUNT + ) + }; + ($signer:expr, $contract:ident.$method:ident($arg:expr), deposit=$deposit:expr) => { + call_borsh!( + $signer, + $contract, + $method, + $arg, + near_sdk_sim::DEFAULT_GAS, + $deposit + ) + }; } -fn setup_token_factory() -> (TestRuntime, BridgeTokenFactory) { - let mut runtime = init_test_runtime(); - let root = "root".to_string(); - let _ = runtime - .deploy( - root.clone(), - PROVER.to_string(), - &MOCK_PROVER_WASM_BYTES, - json!({}), - ) - .unwrap(); - let factory = BridgeTokenFactory::new( - &mut runtime, - &root, - FACTORY.to_string(), - PROVER.to_string(), - LOCKER_ADDRESS.to_string(), - ); - (runtime, factory) +fn err_is(result: &ExecutionResult, expected: &str) { + assert!(!result.is_ok(), "Expected error found {:?}", result); + let status = format!("{:?}", result.outcome().status); + assert!(status.contains(expected), "{}", status); } #[test] fn test_eth_token_transfer() { - let (mut runtime, factory) = setup_token_factory(); - let root = "root".to_string(); - runtime.create_user(root.clone(), ALICE.to_string(), to_yocto("1")); + let (user, factory) = setup_token_factory(); - factory - .deploy_bridge_token(&mut runtime, &root, DAI_ADDRESS.to_string(), to_yocto("35")) - .unwrap(); + let alice = user.create_user(ALICE.to_string(), to_yocto("100")); + let factory_id = FACTORY.to_string(); - let token_account_id = - factory.get_bridge_token_account_id(&mut runtime, DAI_ADDRESS.to_string()); + call!( + user, + factory.deploy_bridge_token(DAI_ADDRESS.to_string()), + deposit = to_yocto("35") + ) + .assert_success(); + + let token_account_id: String = + view!(factory.get_bridge_token_account_id(DAI_ADDRESS.to_string())).unwrap_json(); assert_eq!(token_account_id, format!("{}.{}", DAI_ADDRESS, FACTORY)); - let token = BridgeToken { - contract_id: token_account_id, - }; - assert_eq!(token.get_balance(&mut runtime, ALICE.to_string()), "0"); - assert_eq!(token.get_total_supply(&mut runtime), "0"); + let alice_balance: String = + call_json!(user, token_account_id.ft_balance_of({"account_id": ALICE.to_string()})) + .unwrap_json(); + assert_eq!(alice_balance, "0"); + + let total_supply: String = call_json!(user, token_account_id.ft_total_supply({})).unwrap_json(); + assert_eq!(total_supply, "0"); let mut proof = Proof::default(); proof.log_entry_data = EthLockedEvent { @@ -225,36 +176,47 @@ fn test_eth_token_transfer() { recipient: ALICE.to_string(), } .to_log_entry_data(); - factory.deposit(&mut runtime, &root, proof).unwrap(); - assert_eq!(token.get_balance(&mut runtime, ALICE.to_string()), "1000"); - assert_eq!(token.get_total_supply(&mut runtime), "1000"); + call_borsh!(user, factory_id.deposit(proof)).assert_success(); - token - .withdraw( - &mut runtime, - ALICE.to_string(), - "100".to_string(), - SENDER_ADDRESS.to_string(), - ) - .unwrap(); + let alice_balance: String = + call_json!(user, token_account_id.ft_balance_of({"account_id": ALICE.to_string()})) + .unwrap_json(); + assert_eq!(alice_balance, "1000"); + + let total_supply: String = call_json!(user, token_account_id.ft_total_supply({})).unwrap_json(); + assert_eq!(total_supply, "1000"); + + call_json!(alice, token_account_id.withdraw({ + "amount" : "100", + "recipient" : SENDER_ADDRESS.to_string()}), deposit=1) + .assert_success(); - assert_eq!(token.get_balance(&mut runtime, ALICE.to_string()), "900"); - assert_eq!(token.get_total_supply(&mut runtime), "900"); + let alice_balance: String = + call_json!(user, token_account_id.ft_balance_of({"account_id": ALICE.to_string()})) + .unwrap_json(); + assert_eq!(alice_balance, "900"); + + let total_supply: String = call_json!(user, token_account_id.ft_total_supply({})).unwrap_json(); + assert_eq!(total_supply, "900"); } #[test] fn test_with_invalid_proof() { - let (mut runtime, factory) = setup_token_factory(); - let root = "root".to_string(); - runtime.create_user(root.clone(), ALICE.to_string(), to_yocto("1")); - - factory - .deploy_bridge_token(&mut runtime, &root, DAI_ADDRESS.to_string(), to_yocto("35")) - .unwrap(); - - let token_account_id = - factory.get_bridge_token_account_id(&mut runtime, DAI_ADDRESS.to_string()); + let (user, factory) = setup_token_factory(); + + call!( + user, + factory.deploy_bridge_token(DAI_ADDRESS.to_string()), + deposit = to_yocto("35") + ) + .assert_success(); + + let token_account_id: String = call!( + user, + factory.get_bridge_token_account_id(DAI_ADDRESS.to_string()) + ) + .unwrap_json(); assert_eq!(token_account_id, format!("{}.{}", DAI_ADDRESS, FACTORY)); let mut proof = Proof::default(); @@ -272,141 +234,113 @@ fn test_with_invalid_proof() { // since mock_prover will only accept empty proofs. proof.proof = vec![vec![]]; - factory - .deposit(&mut runtime, &root, proof.clone()) - .unwrap_err(); + let factory_id = FACTORY.to_string(); + err_is( + &call_borsh!(user, factory_id.deposit(proof)), + "Failed to verify the proof", + ); // Convert the proof in a valid proof that is going to be accepted by the mock_prover. proof.proof.clear(); // This deposit event must succeed. Notice that previously a similar deposit // was made, but it failed because it had an invalid proof, so this one should succeed. - factory.deposit(&mut runtime, &root, proof.clone()).unwrap(); + call_borsh!(user, factory_id.deposit(proof)).assert_success(); // This deposit event must fail since same deposit event can't be reused. // Previous call to deposit with the same event was successful. - factory.deposit(&mut runtime, &root, proof).unwrap_err(); + err_is( + &call_borsh!(user, factory_id.deposit(proof)), + "Event cannot be reused for depositing.", + ); } -//TODO: At the moment this panics with the error 'Native NEP21 on Ethereum is disabled.'. -// Uncomment and fix this when the migration to NEP-141 is finished. -//#[test] -//fn test_near_token_transfer() { -// let (mut runtime, factory) = setup_token_factory(); -// let root = "root".to_string(); -// let token = TokenContract::new( -// &mut runtime, -// &root, -// &TEST_TOKEN_WASM_BYTES, -// TEST_TOKEN.to_string(), -// &root, -// "1000", -// ); -// token -// .inc_allowance( -// &mut runtime, -// &root, -// FACTORY.to_string(), -// to_yocto("100").into(), -// ) -// .unwrap(); -// factory -// .lock( -// &mut runtime, -// root.clone(), -// TEST_TOKEN.to_string(), -// to_yocto("100"), -// SENDER_ADDRESS.to_string(), -// ) -// .unwrap(); -// assert_eq!( -// token.get_balance(&mut runtime, root.clone()), -// to_yocto("900").to_string() -// ); -// assert_eq!( -// token.get_total_supply(&mut runtime), -// to_yocto("1000").to_string() -// ); -// -// let mut proof = Proof::default(); -// proof.log_entry_data = EthUnlockedEvent { -// locker_address: validate_eth_address(LOCKER_ADDRESS.to_string()), -// token: TEST_TOKEN.to_string(), -// sender: SENDER_ADDRESS.to_string(), -// amount: 50 * 10u128.pow(24), -// recipient: ALICE.to_string(), -// } -// .to_log_entry_data(); -// factory.unlock(&mut runtime, root.clone(), proof).unwrap(); -// assert_eq!( -// token.get_balance(&mut runtime, ALICE.to_string()), -// to_yocto("50").to_string() -// ); -// assert_eq!( -// token.get_total_supply(&mut runtime), -// to_yocto("1000").to_string() -// ); -//} - #[test] fn test_bridge_token_failures() { - let (mut runtime, factory) = setup_token_factory(); - let root = "root".to_string(); - runtime.create_user(root.clone(), ALICE.to_string(), to_yocto("1")); - factory - .deploy_bridge_token(&mut runtime, &root, DAI_ADDRESS.to_string(), to_yocto("35")) - .unwrap(); - let token = BridgeToken { - contract_id: format!("{}.{}", DAI_ADDRESS, FACTORY), - }; + let (user, factory) = setup_token_factory(); + + call!( + user, + factory.deploy_bridge_token(DAI_ADDRESS.to_string()), + deposit = to_yocto("35") + ) + .assert_success(); + + let token_account_id = format!("{}.{}", DAI_ADDRESS, FACTORY); + + // Fail to withdraw because the account is not registered (and have no coins) + err_is( + &call_json!(user, token_account_id.withdraw({ + "amount" : "100", + "recipient" : SENDER_ADDRESS.to_string()}), deposit=1), + "The account is not registered", + ); - // Fail to withdraw because no coins. - token - .withdraw( - &mut runtime, - root.clone(), - "100".to_string(), - SENDER_ADDRESS.to_string(), - ) - .unwrap_err(); - - // Fail to mint because sender is not controller. - token - .mint( - &mut runtime, - root.clone(), - ALICE.to_string(), - "100".to_string(), - ) - .unwrap_err(); + // Register the account + let account_id: Option = None; + let registration_only: Option = None; + call_json!(user, token_account_id.storage_deposit({ + "account_id": account_id, + "registration_only": registration_only, + })) + .assert_success(); + + // Fail to withdraw because the account has no enough balance + err_is( + &call_json!(user, token_account_id.withdraw({ + "amount" : "100", + "recipient" : SENDER_ADDRESS.to_string()}), deposit=1), + "The account doesn't have enough balance", + ); + + // Fail to mint because the caller is not the controller + let other_user = user.create_user(ALICE.to_string(), to_yocto("1")); + err_is( + &call_json!(other_user, token_account_id.mint({ + "account_id" : ALICE.to_string(), + "amount" : "100"}), deposit=1), + "Only controller can call mint", + ); } -/// TODO: instead of just unwrap_err check the specific errors. #[test] fn test_deploy_failures() { - let (mut runtime, factory) = setup_token_factory(); - let root = "root".to_string(); + let (user, factory) = setup_token_factory(); // Fails with not enough deposit. - factory - .deploy_bridge_token(&mut runtime, &root, DAI_ADDRESS.to_string(), 0) - .unwrap_err(); + err_is( + &call!( + user, + factory.deploy_bridge_token(DAI_ADDRESS.to_string()), + deposit = to_yocto("0") + ), + "Not enough attached deposit to complete bridge token creation", + ); // Fails with address is invalid. - factory - .deploy_bridge_token( - &mut runtime, - &root, - "not_a_hex".to_string(), - to_yocto("100"), - ) - .unwrap_err(); + err_is( + &call!( + user, + factory.deploy_bridge_token("not_a_hex".to_string()), + deposit = to_yocto("0") + ), + "address should be a valid hex string.: OddLength", + ); // Fails second time because already exists. - factory - .deploy_bridge_token(&mut runtime, &root, DAI_ADDRESS.to_string(), to_yocto("35")) - .unwrap(); - factory - .deploy_bridge_token(&mut runtime, &root, DAI_ADDRESS.to_string(), to_yocto("35")) - .unwrap_err(); + call!( + user, + factory.deploy_bridge_token(DAI_ADDRESS.to_string()), + deposit = to_yocto("35") + ) + .assert_success(); + + err_is( + &call!( + user, + factory.deploy_bridge_token(DAI_ADDRESS.to_string()), + deposit = to_yocto("35") + ), + "BridgeToken contract already exists.", + ); } diff --git a/bridge-token/Cargo.lock b/bridge-token/Cargo.lock index 9c05cdb0..611041f0 100644 --- a/bridge-token/Cargo.lock +++ b/bridge-token/Cargo.lock @@ -9,11 +9,26 @@ checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3" [[package]] name = "admin-controlled" version = "0.1.0" -source = "git+https://github.com/near/rainbow-bridge?rev=ac1c1561eaaa435d5b5cb18206ba81af18d6b132#ac1c1561eaaa435d5b5cb18206ba81af18d6b132" +source = "git+https://github.com/near/rainbow-bridge?rev=3a60b7eac2f06d160bd7b20b67a181961c08055d#3a60b7eac2f06d160bd7b20b67a181961c08055d" dependencies = [ "near-sdk", ] +[[package]] +name = "ahash" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "739f4a8db6605981345c5654f3a85b056ce52f37a39d34da03f25bf2151ea16e" + +[[package]] +name = "aho-corasick" +version = "0.7.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7404febffaa47dac81aa44dba71523c9d069b1bdc50a77db41195149e17f68e5" +dependencies = [ + "memchr", +] + [[package]] name = "autocfg" version = "1.0.1" @@ -26,52 +41,56 @@ version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b41b7ea54a0c9d92199de89e20e58d49f02f8e699814ef3fdf266f6f748d15c7" +[[package]] +name = "base64" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" + [[package]] name = "block-buffer" -version = "0.7.3" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b" +checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" dependencies = [ "block-padding", - "byte-tools", - "byteorder", "generic-array", ] [[package]] name = "block-padding" -version = "0.1.5" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa79dedbb091f449f1f39e53edf88d5dbe95f895dae6135a8d7b881fb5af73f5" -dependencies = [ - "byte-tools", -] +checksum = "8d696c370c750c948ada61c69a0ee2cbbb9c50b1019ddb86d9317157a99c2cae" [[package]] name = "borsh" -version = "0.6.2" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7769f8f6fdc6ac7617bbc8bc7ef9dc263cd459d99d21cf2ab4afc3bc8d7d70d" +checksum = "a5a26c53ddf60281f18e7a29b20db7ba3db82a9d81b9650bfaa02d646f50d364" dependencies = [ "borsh-derive", + "hashbrown", ] [[package]] name = "borsh-derive" -version = "0.6.2" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2689a82a5fe57f9e71997b16bea340da338c7fb8db400b8d9d55b59010540d8" +checksum = "b637a47728b78a78cd7f4b85bf06d71ef4221840e059a38f048be2422bf673b2" dependencies = [ "borsh-derive-internal", "borsh-schema-derive-internal", + "proc-macro-crate", + "proc-macro2", "syn", ] [[package]] name = "borsh-derive-internal" -version = "0.6.2" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39b621f19e9891a34f679034fa2238260e27c0eddfe2804e9fb282061cf9b294" +checksum = "d813fa25eb0bed78c36492cff4415f38c760d6de833d255ba9095bd8ebb7d725" dependencies = [ "proc-macro2", "quote", @@ -80,9 +99,9 @@ dependencies = [ [[package]] name = "borsh-schema-derive-internal" -version = "0.6.2" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "befebdb9e223ae4528b3d597dbbfb5c68566822d2a3de3e260f235360773ba29" +checksum = "dcf78ee4a98c8cb9eba1bac3d3e2a1ea3d7673c719ce691e67b5cbafc472d3b7" dependencies = [ "proc-macro2", "quote", @@ -94,32 +113,21 @@ name = "bridge-token" version = "0.1.0" dependencies = [ "admin-controlled", - "borsh", - "near-lib", + "near-contract-standards", "near-sdk", - "serde", - "serde_json", - "uint", - "wee_alloc", ] [[package]] name = "bs58" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "476e9cd489f9e121e02ffa6014a8ef220ecb15c05ed23fc34cca13925dc283fb" - -[[package]] -name = "byte-tools" -version = "0.3.1" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" +checksum = "771fe0050b883fcc3ea2359b1a96bcfbc090b7116eae7c3c512c7a083fdf23d3" [[package]] name = "byteorder" -version = "1.3.4" +version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de" +checksum = "ae44d1a3d5a19df61dd0c8beb138458ac2a53a7ac09eba97d55592540004306b" [[package]] name = "cfg-if" @@ -128,33 +136,45 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" [[package]] -name = "crunchy" -version = "0.2.2" +name = "cfg-if" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] -name = "digest" -version = "0.8.1" +name = "cpuid-bool" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5" +checksum = "8aebca1129a03dc6dc2b127edd729435bbc4a37e1d5f4d7513165089ceb02634" + +[[package]] +name = "derive_more" +version = "0.99.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41cb0e6161ad61ed084a36ba71fbba9e3ac5aee3606fb607fe08da6acbcf3d8c" dependencies = [ - "generic-array", + "proc-macro2", + "quote", + "syn", ] [[package]] -name = "fake-simd" -version = "0.1.2" +name = "digest" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" +checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" +dependencies = [ + "generic-array", +] [[package]] name = "generic-array" -version = "0.12.3" +version = "0.14.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c68f0274ae0e023facc3c97b2e00f076be70e254bc851d972503b328db79b2ec" +checksum = "501466ecc8a30d1d3b7fc9229b122b2ce8ed6e9d9223f1138d4babb253e51817" dependencies = [ "typenum", + "version_check", ] [[package]] @@ -162,12 +182,21 @@ name = "hashbrown" version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d7afe4a420e3fe79967a00898cc1f4db7c8a49a9333a29f8a4bd76a253d5cd04" +dependencies = [ + "ahash", +] + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" [[package]] name = "indexmap" -version = "1.6.0" +version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55e2e4c765aa53a0424761bf9f41aa7a6ac1efa87238f59560640e27fca028f2" +checksum = "4fb1fa934250de4de8aef298d81c729a7d33d8c239daa3a7575e6b92bfc7313b" dependencies = [ "autocfg", "hashbrown", @@ -175,9 +204,9 @@ dependencies = [ [[package]] name = "itoa" -version = "0.4.6" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc6f3ad7b9d11a0c00842ff8de1b60ee58661048eb8049ed33c73594f359d7e6" +checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736" [[package]] name = "keccak" @@ -185,11 +214,23 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "67c21572b4949434e4fc1e1978b99c5f77064153c59d998bf13ecd96fb5ecba7" +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + [[package]] name = "libc" -version = "0.2.80" +version = "0.2.87" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "265d751d31d6780a3f956bb5b8022feba2d94eeee5a84ba64f4212eedca42213" + +[[package]] +name = "memchr" +version = "2.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d58d1b70b004888f764dfbf6a26a3b0342a1632d33968e4a179d8011c760614" +checksum = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525" [[package]] name = "memory_units" @@ -198,14 +239,29 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" [[package]] -name = "near-lib" +name = "near-contract-standards" +version = "3.0.0-pre.3" +source = "git+https://github.com/near/near-sdk-rs?rev=613adcab6322e4f830efb4d5bde2a810ae642158#613adcab6322e4f830efb4d5bde2a810ae642158" +dependencies = [ + "near-sdk", +] + +[[package]] +name = "near-primitives-core" version = "0.1.0" -source = "git+https://github.com/ilblackdragon/balancer-near#a386305c9829d2e5302a78fdc475c8a279fcf6ed" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92035b79bf9983502fe7b67b5a9fecea7604e979d439727827fd0d8f0d77720e" dependencies = [ + "base64 0.11.0", "borsh", - "near-sdk", + "bs58", + "derive_more", + "hex", + "lazy_static", + "num-rational", "serde", "serde_json", + "sha2", ] [[package]] @@ -236,35 +292,35 @@ dependencies = [ ] [[package]] -name = "near-runtime-fees" -version = "0.9.1" +name = "near-runtime-utils" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f4992274c8acb33fa1246715d3aafbce5688ae82243c779b561f8eaff1bb6f1" +checksum = "47f5c1891cec5a03e3dc99f985031408b19516305e2e59d64c4ce52b409e46a0" dependencies = [ - "num-rational", - "serde", + "lazy_static", + "regex", ] [[package]] name = "near-sdk" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81319d4d44283f63467e4f02b6209297b10643c7aeb62e2ee41e0c31b43e2375" +version = "3.0.0-pre.3" +source = "git+https://github.com/near/near-sdk-rs?rev=613adcab6322e4f830efb4d5bde2a810ae642158#613adcab6322e4f830efb4d5bde2a810ae642158" dependencies = [ - "base64", + "base64 0.13.0", "borsh", "bs58", - "near-runtime-fees", + "near-primitives-core", "near-sdk-macros", "near-vm-logic", "serde", + "serde_json", + "wee_alloc", ] [[package]] name = "near-sdk-core" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f3767fc2a61e6577f1336e06d6962a6c61fc39299573b8a25696fd09ce96ffb" +version = "3.0.0-pre.3" +source = "git+https://github.com/near/near-sdk-rs?rev=613adcab6322e4f830efb4d5bde2a810ae642158#613adcab6322e4f830efb4d5bde2a810ae642158" dependencies = [ "Inflector", "proc-macro2", @@ -274,9 +330,8 @@ dependencies = [ [[package]] name = "near-sdk-macros" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27c06b45c56028b0e1241b2196397d449091665f3f08d543415373505df5e05f" +version = "3.0.0-pre.3" +source = "git+https://github.com/near/near-sdk-rs?rev=613adcab6322e4f830efb4d5bde2a810ae642158#613adcab6322e4f830efb4d5bde2a810ae642158" dependencies = [ "near-sdk-core", "proc-macro2", @@ -286,25 +341,28 @@ dependencies = [ [[package]] name = "near-vm-errors" -version = "0.9.1" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "386c2c07ef37ae52ad43860ef69c6322bbc1e610ae0c08c1d7f5ff56f4c28e6a" +checksum = "53a100dda565c5375ac061126167afc5c33cdba1f2e325cfae3ce08f4a5a432a" dependencies = [ "borsh", + "hex", "near-rpc-error-macro", "serde", ] [[package]] name = "near-vm-logic" -version = "0.9.1" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6da6c80d3428f45248577820bfc943b8261a6f11d6721037e5c3f43484047cd" +checksum = "a12201244dd59ae79506767afe7a8f51b5eb7bd0aa237d355dfa635f7b777c4a" dependencies = [ - "base64", + "base64 0.13.0", + "borsh", "bs58", "byteorder", - "near-runtime-fees", + "near-primitives-core", + "near-runtime-utils", "near-vm-errors", "serde", "sha2", @@ -313,9 +371,9 @@ dependencies = [ [[package]] name = "num-bigint" -version = "0.2.6" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "090c7f9998ee0ff65aa5b723e4009f7b217707f1fb5ea551329cc4d6231fb304" +checksum = "5e9a41747ae4633fce5adffb4d2e81ffc5e89593cb19917f8fb2cc5ff76507bf" dependencies = [ "autocfg", "num-integer", @@ -334,9 +392,9 @@ dependencies = [ [[package]] name = "num-rational" -version = "0.2.4" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c000134b5dbf44adc5cb772486d335293351644b801551abe8f75c84cfa4aef" +checksum = "12ac428b1cb17fce6f731001d307d351ec70a6d202fc2e60f7d4c5e42d8f4f07" dependencies = [ "autocfg", "num-bigint", @@ -354,11 +412,26 @@ dependencies = [ "autocfg", ] +[[package]] +name = "once_cell" +version = "1.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af8b08b04175473088b46763e51ee54da5f9a164bc162f615b91bc179dbf15a3" + [[package]] name = "opaque-debug" -version = "0.2.3" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" +checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" + +[[package]] +name = "proc-macro-crate" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d6ea3c4595b96363c13943497db34af4460fb474a95c43f4446ad341b8c9785" +dependencies = [ + "toml", +] [[package]] name = "proc-macro2" @@ -371,18 +444,30 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.7" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37" +checksum = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7" dependencies = [ "proc-macro2", ] [[package]] -name = "rustc-hex" -version = "2.1.0" +name = "regex" +version = "1.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e75f6a532d0fd9f7f13144f392b6ad56a32696bfcd9c78f797f16bbb6f072d6" +checksum = "d9251239e129e16308e70d853559389de218ac275b515068abc96829d05b948a" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", + "thread_local", +] + +[[package]] +name = "regex-syntax" +version = "0.6.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5eb417147ba9860a96cfe72a0b93bf88fee1744b5636ec99ab20c1aa9376581" [[package]] name = "ryu" @@ -392,18 +477,18 @@ checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" [[package]] name = "serde" -version = "1.0.117" +version = "1.0.118" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b88fa983de7720629c9387e9f517353ed404164b1e482c970a90c1a4aaf7dc1a" +checksum = "06c64263859d87aa2eb554587e2d23183398d617427327cf2b3d0ed8c69e4800" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.117" +version = "1.0.118" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cbd1ae72adb44aab48f325a02444a5fc079349a8d804c1fc922aed3f7454c74e" +checksum = "c84d3526699cd55261af4b941e4e725444df67aa4f9e6a3564f18030d12672df" dependencies = [ "proc-macro2", "quote", @@ -412,9 +497,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.59" +version = "1.0.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcac07dbffa1c65e7f816ab9eba78eb142c6d44410f4eeba1e26e4f5dfa56b95" +checksum = "799e97dc9fdae36a5c8b8f2cae9ce2ee9fdce2058c57a93e6099d919fd982f79" dependencies = [ "indexmap", "itoa", @@ -424,40 +509,34 @@ dependencies = [ [[package]] name = "sha2" -version = "0.8.2" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a256f46ea78a0c0d9ff00077504903ac881a1dafdc20da66545699e7776b3e69" +checksum = "fa827a14b29ab7f44778d14a88d3cb76e949c45083f7dbfa507d0cb699dc12de" dependencies = [ "block-buffer", + "cfg-if 1.0.0", + "cpuid-bool", "digest", - "fake-simd", "opaque-debug", ] [[package]] name = "sha3" -version = "0.8.2" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd26bc0e7a2e3a7c959bc494caf58b72ee0c71d67704e9520f736ca7e4853ecf" +checksum = "f81199417d4e5de3f04b1e871023acea7389672c4135918f05aa9cbf2f2fa809" dependencies = [ "block-buffer", - "byte-tools", "digest", "keccak", "opaque-debug", ] -[[package]] -name = "static_assertions" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" - [[package]] name = "syn" -version = "1.0.51" +version = "1.0.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b4f34193997d92804d359ed09953e25d5138df6bcc055a71bf68ee89fdf9223" +checksum = "4211ce9909eb971f111059df92c45640aad50a619cf55cd76476be803c4c68e6" dependencies = [ "proc-macro2", "quote", @@ -465,36 +544,48 @@ dependencies = [ ] [[package]] -name = "typenum" -version = "1.12.0" +name = "thread_local" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "373c8a200f9e67a0c95e62a4f52fbf80c23b4381c05a17845531982fa99e6b33" +checksum = "8018d24e04c95ac8790716a5987d0fec4f8b27249ffa0f7d33f1369bdfb88cbd" +dependencies = [ + "once_cell", +] [[package]] -name = "uint" -version = "0.8.5" +name = "toml" +version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9db035e67dfaf7edd9aebfe8676afcd63eed53c8a4044fed514c8cccf1835177" +checksum = "a31142970826733df8241ef35dc040ef98c679ab14d7c3e54d827099b3acecaa" dependencies = [ - "byteorder", - "crunchy", - "rustc-hex", - "static_assertions", + "serde", ] +[[package]] +name = "typenum" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "373c8a200f9e67a0c95e62a4f52fbf80c23b4381c05a17845531982fa99e6b33" + [[package]] name = "unicode-xid" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" +[[package]] +name = "version_check" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5a972e5669d67ba988ce3dc826706fb0a8b01471c088cb0b6110b805cc36aed" + [[package]] name = "wee_alloc" version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e" dependencies = [ - "cfg-if", + "cfg-if 0.1.10", "libc", "memory_units", "winapi", diff --git a/bridge-token/Cargo.toml b/bridge-token/Cargo.toml index 69d8d42b..1ba065d3 100644 --- a/bridge-token/Cargo.toml +++ b/bridge-token/Cargo.toml @@ -18,11 +18,6 @@ panic = "abort" overflow-checks = true [dependencies] -serde = { version = "*", features = ["derive"] } -serde_json = "*" -near-sdk = "0.11.0" -borsh = "0.6.2" -uint = { version = "0.8.3", default-features = false } -wee_alloc = { version = "0.4.5", default-features = false, features = [] } -near-lib = { git = "https://github.com/ilblackdragon/balancer-near" } -admin-controlled = { git = "https://github.com/near/rainbow-bridge", rev = "ac1c1561eaaa435d5b5cb18206ba81af18d6b132" } \ No newline at end of file +near-sdk = { git = "https://github.com/near/near-sdk-rs", rev = "613adcab6322e4f830efb4d5bde2a810ae642158" } +near-contract-standards = { git = "https://github.com/near/near-sdk-rs", rev = "613adcab6322e4f830efb4d5bde2a810ae642158" } +admin-controlled = { git = "https://github.com/near/rainbow-bridge", rev = "3a60b7eac2f06d160bd7b20b67a181961c08055d" } diff --git a/bridge-token/build.sh b/bridge-token/build.sh index e8dba90a..96bacac7 100755 --- a/bridge-token/build.sh +++ b/bridge-token/build.sh @@ -11,7 +11,7 @@ docker run \ -w /host/bridge-token \ -e RUSTFLAGS='-C link-arg=-s' \ nearprotocol/contract-builder \ - cargo +stable build --target wasm32-unknown-unknown --release + /bin/bash -c "rustup target add wasm32-unknown-unknown; cargo build --target wasm32-unknown-unknown --release" mkdir -p res cp $DIR/target/wasm32-unknown-unknown/release/bridge_token.wasm $DIR/../res/ diff --git a/bridge-token/rust-toolchain b/bridge-token/rust-toolchain new file mode 100644 index 00000000..ed83872a --- /dev/null +++ b/bridge-token/rust-toolchain @@ -0,0 +1 @@ +stable-2020-10-08 diff --git a/bridge-token/src/lib.rs b/bridge-token/src/lib.rs index f1b8c1f4..49c17d18 100644 --- a/bridge-token/src/lib.rs +++ b/bridge-token/src/lib.rs @@ -1,29 +1,36 @@ -use admin_controlled::{AdminControlled, Mask}; -use borsh::{self, BorshDeserialize, BorshSerialize}; -use near_sdk::json_types::U128; -use near_sdk::{env, ext_contract, near_bindgen, AccountId, Balance, Promise}; - -use near_lib::token::{FungibleToken, Token}; - -#[global_allocator] -static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT; +use admin_controlled::Mask; +use near_contract_standards::fungible_token::metadata::{ + FungibleTokenMetadata, FungibleTokenMetadataProvider, FT_METADATA_SPEC, +}; +use near_contract_standards::fungible_token::FungibleToken; +use near_sdk::borsh::{self, BorshDeserialize, BorshSerialize}; +use near_sdk::json_types::{Base64VecU8, ValidAccountId, U128}; +use near_sdk::{ + assert_one_yocto, assert_self, env, ext_contract, near_bindgen, AccountId, Balance, Gas, + PanicOnDefault, Promise, PromiseOrValue, StorageUsage, +}; +use std::convert::TryInto; + +near_sdk::setup_alloc!(); const NO_DEPOSIT: Balance = 0; +/// Gas to call finish withdraw method on factory. +const FINISH_WITHDRAW_GAS: Gas = 50_000_000_000_000; + #[near_bindgen] -#[derive(BorshDeserialize, BorshSerialize)] +#[derive(BorshDeserialize, BorshSerialize, PanicOnDefault)] pub struct BridgeToken { controller: AccountId, - token: Token, + token: FungibleToken, + name: String, + symbol: String, + reference: String, + reference_hash: Base64VecU8, + decimals: u8, paused: Mask, } -impl Default for BridgeToken { - fn default() -> Self { - panic!("Bridge Token should be initialized before usage") - } -} - const PAUSE_WITHDRAW: Mask = 1 << 0; #[ext_contract(ext_bridge_token_factory)] @@ -43,82 +50,87 @@ impl BridgeToken { assert!(!env::state_exists(), "Already initialized"); Self { controller: env::predecessor_account_id(), - token: Token::new(env::predecessor_account_id(), 0u128), + token: FungibleToken::new(b"t".to_vec()), + name: String::default(), + symbol: String::default(), + reference: String::default(), + reference_hash: Base64VecU8(vec![]), + decimals: 0, paused: Mask::default(), } } + pub fn set_metadata( + &mut self, + name: Option, + symbol: Option, + reference: Option, + reference_hash: Option, + decimals: Option, + ) { + // Only owner can change the metadata + assert_self(); + name.map(|name| self.name = name); + symbol.map(|symbol| self.symbol = symbol); + reference.map(|reference| self.reference = reference); + reference_hash.map(|reference_hash| self.reference_hash = reference_hash); + decimals.map(|decimals| self.decimals = decimals); + } + + #[payable] pub fn mint(&mut self, account_id: AccountId, amount: U128) { assert_eq!( env::predecessor_account_id(), self.controller, "Only controller can call mint" ); - self.token.mint(account_id, amount.into()); + + self.storage_deposit(Some(account_id.as_str().try_into().unwrap()), None); + self.token.internal_deposit(&account_id, amount.into()); } #[payable] pub fn withdraw(&mut self, amount: U128, recipient: String) -> Promise { self.check_not_paused(PAUSE_WITHDRAW); - self.token - .burn(env::predecessor_account_id(), amount.into()); - - Promise::new(env::signer_account_id()) - .transfer(env::attached_deposit()) - .then(ext_bridge_token_factory::finish_withdraw( - amount.into(), - recipient, - &self.controller, - NO_DEPOSIT, - env::prepaid_gas() / 2, - )) - } -} - -#[near_bindgen] -impl FungibleToken for BridgeToken { - #[payable] - fn inc_allowance(&mut self, escrow_account_id: String, amount: U128) { - self.token.inc_allowance(escrow_account_id, amount.into()); - } - - #[payable] - fn dec_allowance(&mut self, escrow_account_id: String, amount: U128) { - self.token.dec_allowance(escrow_account_id, amount.into()); - } + assert_one_yocto(); + Promise::new(env::predecessor_account_id()).transfer(1); - #[payable] - fn transfer_from(&mut self, owner_id: String, new_owner_id: String, amount: U128) { self.token - .transfer_from(owner_id, new_owner_id, amount.into()); - } - - #[payable] - fn transfer(&mut self, new_owner_id: String, amount: U128) { - self.token.transfer(new_owner_id, amount.into()); + .internal_withdraw(&env::predecessor_account_id(), amount.into()); + + ext_bridge_token_factory::finish_withdraw( + amount.into(), + recipient, + &self.controller, + NO_DEPOSIT, + FINISH_WITHDRAW_GAS, + ) } - fn get_total_supply(&self) -> U128 { - self.token.get_total_supply().into() - } - - fn get_balance(&self, owner_id: String) -> U128 { - self.token.get_balance(owner_id).into() - } - - fn get_allowance(&self, owner_id: String, escrow_account_id: String) -> U128 { - self.token.get_allowance(owner_id, escrow_account_id).into() + pub fn account_storage_usage(&self) -> StorageUsage { + self.token.account_storage_usage } } -impl AdminControlled for BridgeToken { - fn get_paused(&self) -> u128 { - self.paused - } +near_contract_standards::impl_fungible_token_core!(BridgeToken, token); +near_contract_standards::impl_fungible_token_storage!(BridgeToken, token); - fn set_paused(&mut self, paused: u128) { - self.assert_owner(); - self.paused = paused; +#[near_bindgen] +impl FungibleTokenMetadataProvider for BridgeToken { + fn ft_metadata(&self) -> FungibleTokenMetadata { + FungibleTokenMetadata { + spec: FT_METADATA_SPEC.to_string(), + name: self.name.clone(), + symbol: self.symbol.clone(), + icon: Some( + "https://near.org/wp-content/themes/near-19/assets/img/brand-icon.png".to_string(), + ), + reference: Some(self.reference.clone()), + reference_hash: Some(self.reference_hash.clone()), + decimals: self.decimals, + } } } + +admin_controlled::impl_admin_controlled!(BridgeToken, paused); diff --git a/mock-prover/Cargo.lock b/mock-prover/Cargo.lock index ef5a64e5..936306d1 100644 --- a/mock-prover/Cargo.lock +++ b/mock-prover/Cargo.lock @@ -6,6 +6,21 @@ version = "0.11.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3" +[[package]] +name = "ahash" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "739f4a8db6605981345c5654f3a85b056ce52f37a39d34da03f25bf2151ea16e" + +[[package]] +name = "aho-corasick" +version = "0.7.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7404febffaa47dac81aa44dba71523c9d069b1bdc50a77db41195149e17f68e5" +dependencies = [ + "memchr", +] + [[package]] name = "autocfg" version = "1.0.1" @@ -18,52 +33,56 @@ version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b41b7ea54a0c9d92199de89e20e58d49f02f8e699814ef3fdf266f6f748d15c7" +[[package]] +name = "base64" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" + [[package]] name = "block-buffer" -version = "0.7.3" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b" +checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" dependencies = [ "block-padding", - "byte-tools", - "byteorder", "generic-array", ] [[package]] name = "block-padding" -version = "0.1.5" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa79dedbb091f449f1f39e53edf88d5dbe95f895dae6135a8d7b881fb5af73f5" -dependencies = [ - "byte-tools", -] +checksum = "8d696c370c750c948ada61c69a0ee2cbbb9c50b1019ddb86d9317157a99c2cae" [[package]] name = "borsh" -version = "0.6.2" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7769f8f6fdc6ac7617bbc8bc7ef9dc263cd459d99d21cf2ab4afc3bc8d7d70d" +checksum = "a5a26c53ddf60281f18e7a29b20db7ba3db82a9d81b9650bfaa02d646f50d364" dependencies = [ "borsh-derive", + "hashbrown", ] [[package]] name = "borsh-derive" -version = "0.6.2" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2689a82a5fe57f9e71997b16bea340da338c7fb8db400b8d9d55b59010540d8" +checksum = "b637a47728b78a78cd7f4b85bf06d71ef4221840e059a38f048be2422bf673b2" dependencies = [ "borsh-derive-internal", "borsh-schema-derive-internal", + "proc-macro-crate", + "proc-macro2", "syn", ] [[package]] name = "borsh-derive-internal" -version = "0.6.2" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39b621f19e9891a34f679034fa2238260e27c0eddfe2804e9fb282061cf9b294" +checksum = "d813fa25eb0bed78c36492cff4415f38c760d6de833d255ba9095bd8ebb7d725" dependencies = [ "proc-macro2", "quote", @@ -72,9 +91,9 @@ dependencies = [ [[package]] name = "borsh-schema-derive-internal" -version = "0.6.2" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "befebdb9e223ae4528b3d597dbbfb5c68566822d2a3de3e260f235360773ba29" +checksum = "dcf78ee4a98c8cb9eba1bac3d3e2a1ea3d7673c719ce691e67b5cbafc472d3b7" dependencies = [ "proc-macro2", "quote", @@ -83,21 +102,15 @@ dependencies = [ [[package]] name = "bs58" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "476e9cd489f9e121e02ffa6014a8ef220ecb15c05ed23fc34cca13925dc283fb" - -[[package]] -name = "byte-tools" -version = "0.3.1" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" +checksum = "771fe0050b883fcc3ea2359b1a96bcfbc090b7116eae7c3c512c7a083fdf23d3" [[package]] name = "byteorder" -version = "1.3.4" +version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de" +checksum = "ae44d1a3d5a19df61dd0c8beb138458ac2a53a7ac09eba97d55592540004306b" [[package]] name = "cfg-if" @@ -105,6 +118,18 @@ version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "cpuid-bool" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8aebca1129a03dc6dc2b127edd729435bbc4a37e1d5f4d7513165089ceb02634" + [[package]] name = "crunchy" version = "0.2.2" @@ -112,43 +137,55 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" [[package]] -name = "digest" -version = "0.8.1" +name = "derive_more" +version = "0.99.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5" +checksum = "41cb0e6161ad61ed084a36ba71fbba9e3ac5aee3606fb607fe08da6acbcf3d8c" dependencies = [ - "generic-array", + "proc-macro2", + "quote", + "syn", ] [[package]] -name = "fake-simd" -version = "0.1.2" +name = "digest" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" +checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" +dependencies = [ + "generic-array", +] [[package]] name = "generic-array" -version = "0.12.3" +version = "0.14.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c68f0274ae0e023facc3c97b2e00f076be70e254bc851d972503b328db79b2ec" +checksum = "501466ecc8a30d1d3b7fc9229b122b2ce8ed6e9d9223f1138d4babb253e51817" dependencies = [ "typenum", + "version_check", ] [[package]] name = "hashbrown" -version = "0.8.2" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e91b62f79061a0bc2e046024cb7ba44b08419ed238ecbd9adbd787434b9e8c25" +checksum = "d7afe4a420e3fe79967a00898cc1f4db7c8a49a9333a29f8a4bd76a253d5cd04" dependencies = [ - "autocfg", + "ahash", ] +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + [[package]] name = "indexmap" -version = "1.5.1" +version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86b45e59b16c76b11bf9738fd5d38879d3bd28ad292d7b313608becb17ae2df9" +checksum = "4fb1fa934250de4de8aef298d81c729a7d33d8c239daa3a7575e6b92bfc7313b" dependencies = [ "autocfg", "hashbrown", @@ -156,9 +193,9 @@ dependencies = [ [[package]] name = "itoa" -version = "0.4.6" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc6f3ad7b9d11a0c00842ff8de1b60ee58661048eb8049ed33c73594f359d7e6" +checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736" [[package]] name = "keccak" @@ -166,11 +203,23 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "67c21572b4949434e4fc1e1978b99c5f77064153c59d998bf13ecd96fb5ecba7" +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + [[package]] name = "libc" -version = "0.2.76" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "755456fae044e6fa1ebbbd1b3e902ae19e73097ed4ed87bb79934a867c007bc3" +checksum = "265d751d31d6780a3f956bb5b8022feba2d94eeee5a84ba64f4212eedca42213" + +[[package]] +name = "memchr" +version = "2.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525" [[package]] name = "memory_units" @@ -182,8 +231,7 @@ checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" name = "mock-prover" version = "0.1.0" dependencies = [ - "borsh", - "near-lib", + "near-contract-standards", "near-sdk", "serde", "serde_json", @@ -192,14 +240,29 @@ dependencies = [ ] [[package]] -name = "near-lib" +name = "near-contract-standards" +version = "3.0.0-pre.3" +source = "git+https://github.com/near/near-sdk-rs#0b3419cac5af87fb7e71136af2a40df7cb4a1ad5" +dependencies = [ + "near-sdk", +] + +[[package]] +name = "near-primitives-core" version = "0.1.0" -source = "git+https://github.com/ilblackdragon/balancer-near#ce15ce9b20b5de4e91c1eb46acf89e04ef8ecd77" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92035b79bf9983502fe7b67b5a9fecea7604e979d439727827fd0d8f0d77720e" dependencies = [ + "base64 0.11.0", "borsh", - "near-sdk", + "bs58", + "derive_more", + "hex", + "lazy_static", + "num-rational", "serde", "serde_json", + "sha2", ] [[package]] @@ -230,35 +293,35 @@ dependencies = [ ] [[package]] -name = "near-runtime-fees" -version = "0.9.1" +name = "near-runtime-utils" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f4992274c8acb33fa1246715d3aafbce5688ae82243c779b561f8eaff1bb6f1" +checksum = "47f5c1891cec5a03e3dc99f985031408b19516305e2e59d64c4ce52b409e46a0" dependencies = [ - "num-rational", - "serde", + "lazy_static", + "regex", ] [[package]] name = "near-sdk" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81319d4d44283f63467e4f02b6209297b10643c7aeb62e2ee41e0c31b43e2375" +version = "3.0.0-pre.3" +source = "git+https://github.com/near/near-sdk-rs#0b3419cac5af87fb7e71136af2a40df7cb4a1ad5" dependencies = [ - "base64", + "base64 0.13.0", "borsh", "bs58", - "near-runtime-fees", + "near-primitives-core", "near-sdk-macros", "near-vm-logic", "serde", + "serde_json", + "wee_alloc", ] [[package]] name = "near-sdk-core" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f3767fc2a61e6577f1336e06d6962a6c61fc39299573b8a25696fd09ce96ffb" +version = "3.0.0-pre.3" +source = "git+https://github.com/near/near-sdk-rs#0b3419cac5af87fb7e71136af2a40df7cb4a1ad5" dependencies = [ "Inflector", "proc-macro2", @@ -268,9 +331,8 @@ dependencies = [ [[package]] name = "near-sdk-macros" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27c06b45c56028b0e1241b2196397d449091665f3f08d543415373505df5e05f" +version = "3.0.0-pre.3" +source = "git+https://github.com/near/near-sdk-rs#0b3419cac5af87fb7e71136af2a40df7cb4a1ad5" dependencies = [ "near-sdk-core", "proc-macro2", @@ -280,25 +342,28 @@ dependencies = [ [[package]] name = "near-vm-errors" -version = "0.9.1" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "386c2c07ef37ae52ad43860ef69c6322bbc1e610ae0c08c1d7f5ff56f4c28e6a" +checksum = "53a100dda565c5375ac061126167afc5c33cdba1f2e325cfae3ce08f4a5a432a" dependencies = [ "borsh", + "hex", "near-rpc-error-macro", "serde", ] [[package]] name = "near-vm-logic" -version = "0.9.1" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6da6c80d3428f45248577820bfc943b8261a6f11d6721037e5c3f43484047cd" +checksum = "a12201244dd59ae79506767afe7a8f51b5eb7bd0aa237d355dfa635f7b777c4a" dependencies = [ - "base64", + "base64 0.13.0", + "borsh", "bs58", "byteorder", - "near-runtime-fees", + "near-primitives-core", + "near-runtime-utils", "near-vm-errors", "serde", "sha2", @@ -307,9 +372,9 @@ dependencies = [ [[package]] name = "num-bigint" -version = "0.2.6" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "090c7f9998ee0ff65aa5b723e4009f7b217707f1fb5ea551329cc4d6231fb304" +checksum = "5e9a41747ae4633fce5adffb4d2e81ffc5e89593cb19917f8fb2cc5ff76507bf" dependencies = [ "autocfg", "num-integer", @@ -318,9 +383,9 @@ dependencies = [ [[package]] name = "num-integer" -version = "0.1.43" +version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d59457e662d541ba17869cf51cf177c0b5f0cbf476c66bdc90bf1edac4f875b" +checksum = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db" dependencies = [ "autocfg", "num-traits", @@ -328,9 +393,9 @@ dependencies = [ [[package]] name = "num-rational" -version = "0.2.4" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c000134b5dbf44adc5cb772486d335293351644b801551abe8f75c84cfa4aef" +checksum = "12ac428b1cb17fce6f731001d307d351ec70a6d202fc2e60f7d4c5e42d8f4f07" dependencies = [ "autocfg", "num-bigint", @@ -341,37 +406,70 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.12" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac267bcc07f48ee5f8935ab0d24f316fb722d7a1292e2913f0cc196b29ffd611" +checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" dependencies = [ "autocfg", ] +[[package]] +name = "once_cell" +version = "1.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af8b08b04175473088b46763e51ee54da5f9a164bc162f615b91bc179dbf15a3" + [[package]] name = "opaque-debug" -version = "0.2.3" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" +checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" + +[[package]] +name = "proc-macro-crate" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d6ea3c4595b96363c13943497db34af4460fb474a95c43f4446ad341b8c9785" +dependencies = [ + "toml", +] [[package]] name = "proc-macro2" -version = "1.0.19" +version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04f5f085b5d71e2188cb8271e5da0161ad52c3f227a661a3c135fdf28e258b12" +checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71" dependencies = [ "unicode-xid", ] [[package]] name = "quote" -version = "1.0.7" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37" +checksum = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7" dependencies = [ "proc-macro2", ] +[[package]] +name = "regex" +version = "1.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9251239e129e16308e70d853559389de218ac275b515068abc96829d05b948a" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", + "thread_local", +] + +[[package]] +name = "regex-syntax" +version = "0.6.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5eb417147ba9860a96cfe72a0b93bf88fee1744b5636ec99ab20c1aa9376581" + [[package]] name = "rustc-hex" version = "2.1.0" @@ -386,18 +484,18 @@ checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" [[package]] name = "serde" -version = "1.0.115" +version = "1.0.118" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e54c9a88f2da7238af84b5101443f0c0d0a3bbdc455e34a5c9497b1903ed55d5" +checksum = "06c64263859d87aa2eb554587e2d23183398d617427327cf2b3d0ed8c69e4800" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.115" +version = "1.0.118" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "609feed1d0a73cc36a0182a840a9b37b4a82f0b1150369f0536a9e3f2a31dc48" +checksum = "c84d3526699cd55261af4b941e4e725444df67aa4f9e6a3564f18030d12672df" dependencies = [ "proc-macro2", "quote", @@ -406,9 +504,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.57" +version = "1.0.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "164eacbdb13512ec2745fb09d51fd5b22b0d65ed294a1dcf7285a360c80a675c" +checksum = "799e97dc9fdae36a5c8b8f2cae9ce2ee9fdce2058c57a93e6099d919fd982f79" dependencies = [ "indexmap", "itoa", @@ -418,24 +516,24 @@ dependencies = [ [[package]] name = "sha2" -version = "0.8.2" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a256f46ea78a0c0d9ff00077504903ac881a1dafdc20da66545699e7776b3e69" +checksum = "fa827a14b29ab7f44778d14a88d3cb76e949c45083f7dbfa507d0cb699dc12de" dependencies = [ "block-buffer", + "cfg-if 1.0.0", + "cpuid-bool", "digest", - "fake-simd", "opaque-debug", ] [[package]] name = "sha3" -version = "0.8.2" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd26bc0e7a2e3a7c959bc494caf58b72ee0c71d67704e9520f736ca7e4853ecf" +checksum = "f81199417d4e5de3f04b1e871023acea7389672c4135918f05aa9cbf2f2fa809" dependencies = [ "block-buffer", - "byte-tools", "digest", "keccak", "opaque-debug", @@ -449,15 +547,33 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" [[package]] name = "syn" -version = "1.0.39" +version = "1.0.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "891d8d6567fe7c7f8835a3a98af4208f3846fba258c1bc3c31d6e506239f11f9" +checksum = "4211ce9909eb971f111059df92c45640aad50a619cf55cd76476be803c4c68e6" dependencies = [ "proc-macro2", "quote", "unicode-xid", ] +[[package]] +name = "thread_local" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8018d24e04c95ac8790716a5987d0fec4f8b27249ffa0f7d33f1369bdfb88cbd" +dependencies = [ + "once_cell", +] + +[[package]] +name = "toml" +version = "0.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a31142970826733df8241ef35dc040ef98c679ab14d7c3e54d827099b3acecaa" +dependencies = [ + "serde", +] + [[package]] name = "typenum" version = "1.12.0" @@ -482,13 +598,19 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" +[[package]] +name = "version_check" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5a972e5669d67ba988ce3dc826706fb0a8b01471c088cb0b6110b805cc36aed" + [[package]] name = "wee_alloc" version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e" dependencies = [ - "cfg-if", + "cfg-if 0.1.10", "libc", "memory_units", "winapi", diff --git a/mock-prover/Cargo.toml b/mock-prover/Cargo.toml index 4993b20c..cbc246b4 100644 --- a/mock-prover/Cargo.toml +++ b/mock-prover/Cargo.toml @@ -20,8 +20,7 @@ overflow-checks = true [dependencies] serde = { version = "*", features = ["derive"] } serde_json = "*" -near-sdk = "0.11.0" -borsh = "0.6.2" uint = { version = "0.8.3", default-features = false } wee_alloc = { version = "0.4.5", default-features = false, features = [] } -near-lib = { git = "https://github.com/ilblackdragon/balancer-near" } +near-sdk = { git = "https://github.com/near/near-sdk-rs", rev = "af0e826f916f3aa3ea51e8b675ecebdd37176671" } +near-contract-standards = { git = "https://github.com/near/near-sdk-rs", rev = "af0e826f916f3aa3ea51e8b675ecebdd37176671" } diff --git a/mock-prover/src/lib.rs b/mock-prover/src/lib.rs index 4774994e..fc356d8d 100644 --- a/mock-prover/src/lib.rs +++ b/mock-prover/src/lib.rs @@ -1,4 +1,4 @@ -use borsh::{BorshDeserialize, BorshSerialize}; +use near_sdk::borsh::{self, BorshDeserialize, BorshSerialize}; use near_sdk::near_bindgen; #[near_bindgen] diff --git a/res/bridge_token.wasm b/res/bridge_token.wasm index 0ce40764..3c7e21bf 100755 Binary files a/res/bridge_token.wasm and b/res/bridge_token.wasm differ diff --git a/res/bridge_token_factory.wasm b/res/bridge_token_factory.wasm index d89af44e..d6c673dd 100755 Binary files a/res/bridge_token_factory.wasm and b/res/bridge_token_factory.wasm differ diff --git a/res/test_token.wasm b/res/test_token.wasm index 9d0c6122..1a3f54c9 100755 Binary files a/res/test_token.wasm and b/res/test_token.wasm differ diff --git a/rust-toolchain b/rust-toolchain index 8737a7eb..cc8cb2fe 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1 +1 @@ -nightly-2020-05-15 +nightly-2020-10-08 \ No newline at end of file