diff --git a/Cargo.lock b/Cargo.lock index fed7eae..16db243 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -306,13 +306,13 @@ dependencies = [ [[package]] name = "aurora-engine-migration-tool" -version = "0.1.0" -source = "git+https://github.com/aurora-is-near/aurora-engine-migration-tool.git#3c3f7f771ff985d510bb1f051811767fdfbe911b" +version = "0.2.0" +source = "git+https://github.com/aurora-is-near/aurora-engine-migration-tool.git#f59ff3600e8117ea44c5d429866daa146754a270" dependencies = [ "anyhow", - "aurora-engine-types 1.0.0 (git+https://github.com/aurora-is-near/aurora-engine.git?tag=2.9.0)", - "base64 0.13.1", - "clap 4.2.7", + "aurora-engine-types 1.0.0 (git+https://github.com/aurora-is-near/aurora-engine.git?tag=2.9.1)", + "base64 0.20.0", + "clap 4.3.0", "libc", "near-crypto 0.16.1", "near-jsonrpc-client 0.5.1", @@ -338,6 +338,19 @@ dependencies = [ "serde_json", ] +[[package]] +name = "aurora-engine-types" +version = "1.0.0" +source = "git+https://github.com/aurora-is-near/aurora-engine.git?tag=2.9.1#733b1a2562fc4416f7d05d76d939ada144a56456" +dependencies = [ + "borsh 0.10.3", + "borsh 0.9.3", + "hex 0.4.3", + "primitive-types 0.12.1", + "serde", + "serde_json", +] + [[package]] name = "aurora-engine-types" version = "1.0.0" @@ -352,7 +365,7 @@ dependencies = [ [[package]] name = "aurora-eth-connector" -version = "0.5.1" +version = "0.6.0" dependencies = [ "aurora-engine-types 1.0.0 (git+https://github.com/aurora-is-near/aurora-engine.git?tag=2.9.0)", "byte-slice-cast", @@ -368,7 +381,7 @@ dependencies = [ [[package]] name = "aurora-eth-connector-tests" -version = "0.5.1" +version = "0.6.0" dependencies = [ "anyhow", "aurora-engine-migration-tool", @@ -391,7 +404,7 @@ dependencies = [ [[package]] name = "aurora-workspace-eth-connector" version = "0.1.0" -source = "git+https://github.com/aurora-is-near/aurora-workspace.git?tag=0.2.0#18bef2bd5cfbacd2f0ae1030593e6478452d82f3" +source = "git+https://github.com/aurora-is-near/aurora-workspace.git?tag=0.2.1#30fa78cb006f2b97fed88589bc9484fe95b01071" dependencies = [ "anyhow", "aurora-engine-types 1.0.0 (git+https://github.com/aurora-is-near/aurora-engine.git?tag=2.9.0)", @@ -408,7 +421,7 @@ dependencies = [ [[package]] name = "aurora-workspace-types" version = "0.1.0" -source = "git+https://github.com/aurora-is-near/aurora-workspace.git?tag=0.2.0#18bef2bd5cfbacd2f0ae1030593e6478452d82f3" +source = "git+https://github.com/aurora-is-near/aurora-workspace.git?tag=0.2.1#30fa78cb006f2b97fed88589bc9484fe95b01071" dependencies = [ "aurora-engine-types 1.0.0 (git+https://github.com/aurora-is-near/aurora-engine.git?rev=d9763085157188055f62752fd499ac4c7db8331e)", "ethereum-types", @@ -422,7 +435,7 @@ dependencies = [ [[package]] name = "aurora-workspace-utils" version = "0.1.0" -source = "git+https://github.com/aurora-is-near/aurora-workspace.git?tag=0.2.0#18bef2bd5cfbacd2f0ae1030593e6478452d82f3" +source = "git+https://github.com/aurora-is-near/aurora-workspace.git?tag=0.2.1#30fa78cb006f2b97fed88589bc9484fe95b01071" dependencies = [ "anyhow", "aurora-workspace-types", @@ -469,9 +482,15 @@ checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" [[package]] name = "base64" -version = "0.21.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4a4ddaa51a5bc52a6948f74c06d20aaaddb71924eab79b8c97a8c556e942d6a" +checksum = "0ea22880d78093b0cbe17c89f64a7d457941e65759157ec6cb31a31d652b05e5" + +[[package]] +name = "base64" +version = "0.21.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f1e31e207a6b8fb791a38ea3105e6cb541f55e4d029902d3039a4ad07cc4105" [[package]] name = "binary-install" @@ -673,9 +692,9 @@ checksum = "771fe0050b883fcc3ea2359b1a96bcfbc090b7116eae7c3c512c7a083fdf23d3" [[package]] name = "bumpalo" -version = "3.12.2" +version = "3.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c6ed94e98ecff0c12dd1b04c15ec0d7d9458ca8fe806cea6f12954efe74c63b" +checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1" [[package]] name = "byte-slice-cast" @@ -797,23 +816,23 @@ dependencies = [ [[package]] name = "clap" -version = "4.2.7" +version = "4.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34d21f9bf1b425d2968943631ec91202fe5e837264063503708b83013f8fc938" +checksum = "93aae7a4192245f70fe75dd9157fc7b4a5bf53e88d30bd4396f7d8f9284d5acc" dependencies = [ "clap_builder", ] [[package]] name = "clap_builder" -version = "4.2.7" +version = "4.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "914c8c79fb560f238ef6429439a30023c862f7a28e688c58f7203f12b29970bd" +checksum = "4f423e341edefb78c9caba2d9c7f7687d0e72e89df3ce3394554754393ac3990" dependencies = [ "anstream", "anstyle", "bitflags", - "clap_lex 0.4.1", + "clap_lex 0.5.0", "once_cell", "strsim", ] @@ -842,9 +861,9 @@ dependencies = [ [[package]] name = "clap_lex" -version = "0.4.1" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a2dd5a6fe8c6e3502f568a6353e5273bbb15193ad9a89e457b9970798efbea1" +checksum = "2da6da31387c7e4ef160ffab6d5e7f00c42626fe39aea70a7b0f1773f7dd6c1b" [[package]] name = "colorchoice" @@ -969,9 +988,9 @@ dependencies = [ [[package]] name = "curl-sys" -version = "0.4.61+curl-8.0.1" +version = "0.4.62+curl-8.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14d05c10f541ae6f3bc5b3d923c20001f47db7d5f0b2bc6ad16490133842db79" +checksum = "274ef7ef7c1113c7611af49ce248a700afa1171045a1aaa40137030773f993b8" dependencies = [ "cc", "libc", @@ -1030,9 +1049,9 @@ dependencies = [ [[package]] name = "digest" -version = "0.10.6" +version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8168378f4e5023e7218c89c891c0fd8ecdb5e5e4f18cb78f38cf245dd021e76f" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer 0.10.4", "crypto-common", @@ -1868,9 +1887,9 @@ dependencies = [ [[package]] name = "linux-raw-sys" -version = "0.3.7" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ece97ea872ece730aed82664c424eb4c8291e1ff2480247ccf7409044bc6479f" +checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" [[package]] name = "lock_api" @@ -3073,9 +3092,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.57" +version = "1.0.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4ec6d5fe0b140acb27c9a0444118cf55bfbb4e0b259739429abb4521dd67c16" +checksum = "fa1fb82fc0c281dd9671101b66b771ebbe1eaf967b96ac8740dcba4b70005ca8" dependencies = [ "unicode-ident", ] @@ -3303,13 +3322,13 @@ dependencies = [ [[package]] name = "regex" -version = "1.8.1" +version = "1.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af83e617f331cc6ae2da5443c602dfa5af81e517212d9d611a5b3ba1777b5370" +checksum = "d1a59b5d8e97dee33696bf13c5ba8ab85341c002922fba050069326b9c498974" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.7.1", + "regex-syntax 0.7.2", ] [[package]] @@ -3329,9 +3348,9 @@ checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" [[package]] name = "regex-syntax" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5996294f19bd3aae0453a862ad728f60e6600695733dd5df01da90c54363a3c" +checksum = "436b050e76ed2903236f032a59761c1eb99e1b0aead2c257922771dab1fc8c78" [[package]] name = "reqwest" @@ -3339,7 +3358,7 @@ version = "0.11.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cde824a14b7c14f85caff81225f411faacc04a2013f41670f41443742b1c1c55" dependencies = [ - "base64 0.21.0", + "base64 0.21.1", "bytes", "encoding_rs", "futures-core", @@ -3376,7 +3395,7 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bd124222d17ad93a644ed9d011a40f4fb64aa54275c08cc216524a9ea82fb09f" dependencies = [ - "digest 0.10.6", + "digest 0.10.7", ] [[package]] @@ -3508,9 +3527,9 @@ dependencies = [ [[package]] name = "security-framework" -version = "2.9.0" +version = "2.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca2855b3715770894e67cbfa3df957790aa0c9edc3bf06efa1a84d77fa0839d1" +checksum = "1fc758eb7bffce5b308734e9b0c1468893cae9ff70ebf13e7090be8dcbcc83a8" dependencies = [ "bitflags", "core-foundation", @@ -3634,7 +3653,7 @@ checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0" dependencies = [ "cfg-if 1.0.0", "cpufeatures", - "digest 0.10.6", + "digest 0.10.7", ] [[package]] @@ -3643,7 +3662,7 @@ version = "0.10.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60" dependencies = [ - "digest 0.10.6", + "digest 0.10.7", "keccak", ] @@ -4052,15 +4071,15 @@ dependencies = [ [[package]] name = "toml_datetime" -version = "0.6.1" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ab8ed2edee10b50132aed5f331333428b011c99402b5a534154ed15746f9622" +checksum = "5a76a9312f5ba4c2dec6b9161fdf25d87ad8a09256ccea5a556fef03c706a10f" [[package]] name = "toml_edit" -version = "0.19.8" +version = "0.19.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "239410c8609e8125456927e6707163a3b1fdb40561e4b803bc041f466ccfdc13" +checksum = "2380d56e8670370eee6566b0bfd4265f65b3f432e8c6d85623f728d4fa31f739" dependencies = [ "indexmap", "toml_datetime", diff --git a/contract_state.borsh b/contract_state.borsh index bff8b3e..e1322fb 100644 Binary files a/contract_state.borsh and b/contract_state.borsh differ diff --git a/eth-connector-tests/Cargo.toml b/eth-connector-tests/Cargo.toml index 44ad08c..430ce73 100644 --- a/eth-connector-tests/Cargo.toml +++ b/eth-connector-tests/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "aurora-eth-connector-tests" -version = "0.5.1" +version = "0.6.0" authors = ["Aurora Labs ", "Evgeny Ukhanov "] edition = "2021" description = "" @@ -27,8 +27,8 @@ hex = "0.4.3" ethabi = "18.0" rlp = { version = "0.5.0", default-features = false } aurora-engine-migration-tool = { git = "https://github.com/aurora-is-near/aurora-engine-migration-tool.git" } -aurora-workspace-eth-connector = { git = "https://github.com/aurora-is-near/aurora-workspace.git", tag = "0.2.0" } -aurora-workspace-utils = { git = "https://github.com/aurora-is-near/aurora-workspace.git", tag = "0.2.0" } +aurora-workspace-eth-connector = { git = "https://github.com/aurora-is-near/aurora-workspace.git", tag = "0.2.1" } +aurora-workspace-utils = { git = "https://github.com/aurora-is-near/aurora-workspace.git", tag = "0.2.1" } [features] migration-tests = [] diff --git a/eth-connector-tests/src/connector.rs b/eth-connector-tests/src/connector.rs index 17b0481..72cdab4 100644 --- a/eth-connector-tests/src/connector.rs +++ b/eth-connector-tests/src/connector.rs @@ -932,77 +932,6 @@ async fn test_withdraw_from_near_pausability() { assert_eq!(data.eth_custodian_address, custodian_addr); } -#[tokio::test] -async fn test_get_accounts_counter() { - let contract = TestContract::new().await.unwrap(); - contract.call_deposit_eth_to_near().await.unwrap(); - - let res = contract - .contract - .get_accounts_counter() - .await - .transact() - .await - .unwrap() - .result; - assert_eq!(res.0, 2); -} - -#[tokio::test] -async fn test_get_accounts_counter_and_transfer() { - let contract = TestContract::new().await.unwrap(); - contract.call_deposit_eth_to_near().await.unwrap(); - contract.call_deposit_contract().await.unwrap(); - - let res = contract - .contract - .get_accounts_counter() - .await - .transact() - .await - .unwrap() - .result; - assert_eq!(res.0, 2); - - let transfer_amount: U128 = 70.into(); - let receiver_id: AccountId = DEPOSITED_RECIPIENT.parse().unwrap(); - let memo = Some("transfer memo".to_string()); - let res = contract - .contract - .ft_transfer(receiver_id.clone(), transfer_amount, memo) - .max_gas() - .deposit(ONE_YOCTO) - .transact() - .await - .unwrap(); - assert!(res.is_success()); - - let balance = contract - .get_eth_on_near_balance(&receiver_id) - .await - .unwrap(); - assert_eq!(balance.0, DEPOSITED_AMOUNT + transfer_amount.0); - - let balance = contract - .get_eth_on_near_balance(contract.contract.id()) - .await - .unwrap(); - assert_eq!(balance.0, DEPOSITED_CONTRACT - transfer_amount.0); - assert_eq!( - contract.total_supply().await.unwrap().0, - DEPOSITED_AMOUNT + DEPOSITED_CONTRACT - ); - let res = contract - .contract - .get_accounts_counter() - .await - .transact() - .await - .unwrap() - .result; - assert_eq!(res.0, 2); -} - #[tokio::test] async fn test_deposit_to_near_with_zero_fee() { let proof_str = r#"{"log_index":0,"log_entry_data":[248,251,148,9,109,233,194,184,165,184,194,44,238,50,137,177,1,246,150,13,104,229,30,248,66,160,209,66,67,156,39,142,37,218,217,165,7,102,241,83,208,227,210,215,191,43,209,111,194,120,28,75,212,148,178,177,90,157,160,0,0,0,0,0,0,0,0,0,0,0,0,121,24,63,219,216,14,45,138,234,26,202,162,246,123,251,138,54,212,10,141,184,160,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,96,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,11,184,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,18,101,116,104,95,114,101,99,105,112,105,101,110,116,46,114,111,111,116,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"receipt_index":0,"receipt_data":[249,2,6,1,130,106,249,185,1,0,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,0,0,0,0,0,0,0,0,0,0,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,248,253,248,251,148,9,109,233,194,184,165,184,194,44,238,50,137,177,1,246,150,13,104,229,30,248,66,160,209,66,67,156,39,142,37,218,217,165,7,102,241,83,208,227,210,215,191,43,209,111,194,120,28,75,212,148,178,177,90,157,160,0,0,0,0,0,0,0,0,0,0,0,0,121,24,63,219,216,14,45,138,234,26,202,162,246,123,251,138,54,212,10,141,184,160,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,96,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,11,184,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,18,101,116,104,95,114,101,99,105,112,105,101,110,116,46,114,111,111,116,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"header_data":[249,2,23,160,7,139,123,21,146,99,81,234,117,153,151,30,67,221,231,90,105,219,121,127,196,224,201,83,178,31,173,155,190,123,227,174,160,29,204,77,232,222,199,93,122,171,133,181,103,182,204,212,26,211,18,69,27,148,138,116,19,240,161,66,253,64,212,147,71,148,109,150,79,199,61,172,73,162,195,49,105,169,235,252,47,207,92,249,136,136,160,227,202,170,144,85,104,169,90,220,93,227,155,76,252,229,223,163,146,127,223,157,121,27,238,116,64,112,216,124,129,107,9,160,158,128,122,7,117,120,186,231,92,224,181,67,43,66,153,79,155,38,238,166,68,1,151,100,134,126,214,86,59,66,174,201,160,235,177,124,164,253,179,174,206,160,196,186,61,51,64,217,35,121,86,229,24,251,162,51,82,72,31,218,240,150,32,157,48,185,1,0,0,0,8,0,0,32,0,0,0,0,0,0,128,0,0,0,2,0,128,0,64,32,0,0,0,0,0,0,64,0,0,10,0,0,0,0,0,0,3,0,0,0,0,64,128,0,0,64,0,0,0,0,0,16,0,0,130,0,1,16,0,32,4,0,0,0,0,0,2,1,0,0,0,0,0,8,0,8,0,0,32,0,4,128,2,0,128,0,0,0,0,0,0,0,0,0,4,32,0,8,2,0,0,0,128,65,0,136,0,0,40,0,0,0,8,0,0,128,0,34,0,4,0,185,2,0,0,4,32,128,0,2,0,0,0,128,0,0,10,0,1,0,1,0,0,0,0,32,1,8,128,0,0,4,0,0,0,128,128,0,70,0,0,0,0,0,0,16,64,0,64,0,34,64,0,0,0,4,0,0,0,0,1,128,0,9,0,0,0,0,0,16,0,0,64,2,0,0,0,132,0,64,32,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,4,0,0,0,32,8,0,16,0,8,0,16,68,0,0,0,16,0,0,0,128,0,64,0,0,128,0,0,0,0,0,0,0,16,0,1,0,16,132,49,181,116,68,131,157,92,101,131,122,18,0,131,101,155,9,132,96,174,110,74,153,216,131,1,10,1,132,103,101,116,104,134,103,111,49,46,49,54,135,119,105,110,100,111,119,115,160,228,82,26,232,236,82,141,6,111,169,92,14,115,254,59,131,192,3,202,209,126,79,140,182,163,12,185,45,210,17,60,38,136,84,114,37,115,236,183,145,213],"proof":[[248,145,160,187,129,186,104,13,250,13,252,114,170,223,247,137,53,113,225,188,217,54,244,108,193,247,236,197,29,0,161,119,76,227,184,160,66,209,234,66,254,223,80,22,246,80,204,38,2,90,115,201,183,79,207,47,192,234,143,221,89,78,36,199,127,9,55,190,160,91,160,251,58,165,255,90,2,105,47,46,220,67,3,52,105,42,182,130,224,19,162,115,159,136,158,218,93,187,148,188,9,128,128,128,128,128,160,181,223,248,223,173,187,103,169,52,204,62,13,90,70,147,236,199,27,201,112,157,4,139,63,188,12,98,117,10,82,85,125,128,128,128,128,128,128,128,128],[249,2,13,48,185,2,9,249,2,6,1,130,106,249,185,1,0,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,0,0,0,0,0,0,0,0,0,0,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,248,253,248,251,148,9,109,233,194,184,165,184,194,44,238,50,137,177,1,246,150,13,104,229,30,248,66,160,209,66,67,156,39,142,37,218,217,165,7,102,241,83,208,227,210,215,191,43,209,111,194,120,28,75,212,148,178,177,90,157,160,0,0,0,0,0,0,0,0,0,0,0,0,121,24,63,219,216,14,45,138,234,26,202,162,246,123,251,138,54,212,10,141,184,160,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,96,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,11,184,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,18,101,116,104,95,114,101,99,105,112,105,101,110,116,46,114,111,111,116,0,0,0,0,0,0,0,0,0,0,0,0,0,0]]}"#; diff --git a/eth-connector-tests/src/migration.rs b/eth-connector-tests/src/migration.rs index 8b6d35c..1bd7492 100644 --- a/eth-connector-tests/src/migration.rs +++ b/eth-connector-tests/src/migration.rs @@ -1,6 +1,5 @@ use crate::utils::TestContract; -use aurora_engine_migration_tool::{BorshDeserialize, StateData}; -use aurora_engine_types::types::NEP141Wei; +use aurora_engine_migration_tool::{BorshDeserialize, NEP141Wei, StateData}; use aurora_workspace_eth_connector::types::{MigrationCheckResult, MigrationInputData}; use near_sdk::{AccountId, Balance}; use std::collections::HashMap; @@ -130,7 +129,6 @@ async fn test_migration_state() { let args = MigrationInputData { total_supply: Some(state.contract_data.total_eth_supply_on_near.as_u128()), account_storage_usage: Some(state.contract_data.account_storage_usage), - statistics_aurora_accounts_counter: Some(state.accounts_counter), ..Default::default() }; let res = contract @@ -164,7 +162,6 @@ async fn test_migration_state() { let args = MigrationInputData { total_supply: Some(state.contract_data.total_eth_supply_on_near.as_u128()), account_storage_usage: Some(state.contract_data.account_storage_usage), - statistics_aurora_accounts_counter: Some(state.accounts_counter), ..Default::default() }; let res = contract diff --git a/eth-connector/Cargo.toml b/eth-connector/Cargo.toml index f2d559e..95a5ea4 100644 --- a/eth-connector/Cargo.toml +++ b/eth-connector/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "aurora-eth-connector" -version = "0.5.1" +version = "0.6.0" authors = ["Aurora Labs ", "Evgeny Ukhanov "] edition = "2021" description = "Aurora Eth Connector NEAR contract" diff --git a/eth-connector/src/connector.rs b/eth-connector/src/connector.rs index 0f607e6..b2db616 100644 --- a/eth-connector/src/connector.rs +++ b/eth-connector/src/connector.rs @@ -1,7 +1,6 @@ use crate::{connector_impl::FinishDepositCallArgs, Proof, VerifyProofArgs, WithdrawResult}; use aurora_engine_types::types::Address; use near_contract_standards::storage_management::StorageBalance; -use near_sdk::json_types::U64; use near_sdk::{ borsh, ext_contract, json_types::U128, AccountId, Balance, Promise, PromiseOrValue, }; @@ -38,11 +37,6 @@ pub trait ProofVerifier { fn verify_log_entry(&self, #[serializer(borsh)] args: VerifyProofArgs) -> bool; } -#[ext_contract(ext_ft_statistic)] -pub trait FungibleTokenStatistic { - fn get_accounts_counter(&self) -> U64; -} - /// Withdraw method for legacy implementation in Engine #[ext_contract(ext_engine_withdraw)] pub trait EngineConnectorWithdraw { diff --git a/eth-connector/src/lib.rs b/eth-connector/src/lib.rs index f37cedd..da27a65 100644 --- a/eth-connector/src/lib.rs +++ b/eth-connector/src/lib.rs @@ -3,7 +3,7 @@ use crate::admin_controlled::{AdminControlled, PausedMask, PAUSE_WITHDRAW, UNPAUSE_ALL}; use crate::connector::{ Deposit, EngineConnectorWithdraw, EngineFungibleToken, EngineStorageManagement, FundsFinish, - FungibleTokenStatistic, KnownEngineAccountsManagement, Withdraw, + KnownEngineAccountsManagement, Withdraw, }; use crate::connector_impl::{ EthConnector, FinishDepositCallArgs, TransferCallCallArgs, WithdrawResult, @@ -19,7 +19,6 @@ use near_contract_standards::fungible_token::metadata::{ use near_contract_standards::fungible_token::receiver::ext_ft_receiver; use near_contract_standards::fungible_token::resolver::{ext_ft_resolver, FungibleTokenResolver}; use near_contract_standards::fungible_token::FungibleToken; -use near_sdk::json_types::U64; use near_sdk::{ assert_one_yocto, borsh::{self, BorshDeserialize, BorshSerialize}, @@ -55,7 +54,6 @@ pub struct EthConnectorContract { ft: FungibleToken, metadata: LazyOption, used_proofs: LookupSet, - accounts_counter: u64, known_engine_accounts: LookupSet, } @@ -94,7 +92,6 @@ impl EthConnectorContract { // Register user and calculate counter fn register_if_not_exists(&mut self, account: &AccountId) { if !self.ft.accounts.contains_key(account) { - self.accounts_counter += 1; self.ft.internal_register_account(account); } } @@ -190,7 +187,6 @@ impl EthConnectorContract { connector: connector_data, metadata: LazyOption::new(StorageKey::Metadata, Some(metadata)), used_proofs: LookupSet::new(StorageKey::Proof), - accounts_counter: 0, known_engine_accounts: LookupSet::new(StorageKey::EngineAccounts), }; this.register_if_not_exists(&env::current_account_id()); @@ -457,14 +453,6 @@ impl FungibleTokenMetadataProvider for EthConnectorContract { } } -#[near_bindgen] -impl FungibleTokenStatistic for EthConnectorContract { - #[result_serializer(borsh)] - fn get_accounts_counter(&self) -> U64 { - self.accounts_counter.into() - } -} - #[near_bindgen] impl AdminControlled for EthConnectorContract { #[result_serializer(borsh)] @@ -629,15 +617,6 @@ impl Migration for EthConnectorContract { ); } - // Insert statistics_aurora_accounts_counter - if let Some(statistics_aurora_accounts_counter) = data.statistics_aurora_accounts_counter { - self.accounts_counter = statistics_aurora_accounts_counter; - log!( - "Inserted statistics_aurora_accounts_counter: {:?}", - statistics_aurora_accounts_counter - ); - } - // Insert Proof for proof_key in &data.used_proofs { self.used_proofs.insert(proof_key); @@ -691,12 +670,6 @@ impl Migration for EthConnectorContract { return CheckResult::TotalSupply(self.ft.total_supply); } } - - if let Some(statistics_aurora_accounts_counter) = data.statistics_aurora_accounts_counter { - if self.accounts_counter != statistics_aurora_accounts_counter { - return CheckResult::StatisticsCounter(self.accounts_counter); - } - } CheckResult::Success } } diff --git a/eth-connector/src/migration.rs b/eth-connector/src/migration.rs index 124b57f..68c4f84 100644 --- a/eth-connector/src/migration.rs +++ b/eth-connector/src/migration.rs @@ -7,7 +7,6 @@ pub struct InputData { pub accounts: HashMap, pub total_supply: Option, pub account_storage_usage: Option, - pub statistics_aurora_accounts_counter: Option, pub used_proofs: Vec, }