difftreelog
Merge pull request #961 from UniqueNetwork/test/send_value_to_contract_with_evm_call
in: master
Send value to contract with evm call
3 files changed
Cargo.lockdiffbeforeafterboth--- a/Cargo.lock
+++ b/Cargo.lock
@@ -2777,7 +2777,7 @@
[[package]]
name = "fc-consensus"
version = "2.0.0-dev"
-source = "git+https://github.com/uniquenetwork/unique-frontier?branch=unique-polkadot-v0.9.42#4f7a610defd7623aa147d83c83cbc42f907ce8bb"
+source = "git+https://github.com/uniquenetwork/unique-frontier?branch=unique-polkadot-v0.9.42-1#cf3f4f309c7b053c29a619b78fd27b744cbe020a"
dependencies = [
"async-trait",
"fc-db",
@@ -2794,7 +2794,7 @@
[[package]]
name = "fc-db"
version = "2.0.0-dev"
-source = "git+https://github.com/uniquenetwork/unique-frontier?branch=unique-polkadot-v0.9.42#4f7a610defd7623aa147d83c83cbc42f907ce8bb"
+source = "git+https://github.com/uniquenetwork/unique-frontier?branch=unique-polkadot-v0.9.42-1#cf3f4f309c7b053c29a619b78fd27b744cbe020a"
dependencies = [
"fp-storage",
"kvdb-rocksdb",
@@ -2813,7 +2813,7 @@
[[package]]
name = "fc-mapping-sync"
version = "2.0.0-dev"
-source = "git+https://github.com/uniquenetwork/unique-frontier?branch=unique-polkadot-v0.9.42#4f7a610defd7623aa147d83c83cbc42f907ce8bb"
+source = "git+https://github.com/uniquenetwork/unique-frontier?branch=unique-polkadot-v0.9.42-1#cf3f4f309c7b053c29a619b78fd27b744cbe020a"
dependencies = [
"fc-db",
"fc-storage",
@@ -2834,7 +2834,7 @@
[[package]]
name = "fc-rpc"
version = "2.0.0-dev"
-source = "git+https://github.com/uniquenetwork/unique-frontier?branch=unique-polkadot-v0.9.42#4f7a610defd7623aa147d83c83cbc42f907ce8bb"
+source = "git+https://github.com/uniquenetwork/unique-frontier?branch=unique-polkadot-v0.9.42-1#cf3f4f309c7b053c29a619b78fd27b744cbe020a"
dependencies = [
"ethereum",
"ethereum-types",
@@ -2883,7 +2883,7 @@
[[package]]
name = "fc-rpc-core"
version = "1.1.0-dev"
-source = "git+https://github.com/uniquenetwork/unique-frontier?branch=unique-polkadot-v0.9.42#4f7a610defd7623aa147d83c83cbc42f907ce8bb"
+source = "git+https://github.com/uniquenetwork/unique-frontier?branch=unique-polkadot-v0.9.42-1#cf3f4f309c7b053c29a619b78fd27b744cbe020a"
dependencies = [
"ethereum",
"ethereum-types",
@@ -2896,7 +2896,7 @@
[[package]]
name = "fc-storage"
version = "1.0.0-dev"
-source = "git+https://github.com/uniquenetwork/unique-frontier?branch=unique-polkadot-v0.9.42#4f7a610defd7623aa147d83c83cbc42f907ce8bb"
+source = "git+https://github.com/uniquenetwork/unique-frontier?branch=unique-polkadot-v0.9.42-1#cf3f4f309c7b053c29a619b78fd27b744cbe020a"
dependencies = [
"ethereum",
"ethereum-types",
@@ -3048,7 +3048,7 @@
[[package]]
name = "fp-account"
version = "1.0.0-dev"
-source = "git+https://github.com/uniquenetwork/unique-frontier?branch=unique-polkadot-v0.9.42#4f7a610defd7623aa147d83c83cbc42f907ce8bb"
+source = "git+https://github.com/uniquenetwork/unique-frontier?branch=unique-polkadot-v0.9.42-1#cf3f4f309c7b053c29a619b78fd27b744cbe020a"
dependencies = [
"hex",
"impl-serde",
@@ -3066,7 +3066,7 @@
[[package]]
name = "fp-consensus"
version = "2.0.0-dev"
-source = "git+https://github.com/uniquenetwork/unique-frontier?branch=unique-polkadot-v0.9.42#4f7a610defd7623aa147d83c83cbc42f907ce8bb"
+source = "git+https://github.com/uniquenetwork/unique-frontier?branch=unique-polkadot-v0.9.42-1#cf3f4f309c7b053c29a619b78fd27b744cbe020a"
dependencies = [
"ethereum",
"parity-scale-codec",
@@ -3078,7 +3078,7 @@
[[package]]
name = "fp-ethereum"
version = "1.0.0-dev"
-source = "git+https://github.com/uniquenetwork/unique-frontier?branch=unique-polkadot-v0.9.42#4f7a610defd7623aa147d83c83cbc42f907ce8bb"
+source = "git+https://github.com/uniquenetwork/unique-frontier?branch=unique-polkadot-v0.9.42-1#cf3f4f309c7b053c29a619b78fd27b744cbe020a"
dependencies = [
"ethereum",
"ethereum-types",
@@ -3092,7 +3092,7 @@
[[package]]
name = "fp-evm"
version = "3.0.0-dev"
-source = "git+https://github.com/uniquenetwork/unique-frontier?branch=unique-polkadot-v0.9.42#4f7a610defd7623aa147d83c83cbc42f907ce8bb"
+source = "git+https://github.com/uniquenetwork/unique-frontier?branch=unique-polkadot-v0.9.42-1#cf3f4f309c7b053c29a619b78fd27b744cbe020a"
dependencies = [
"evm",
"frame-support",
@@ -3108,7 +3108,7 @@
[[package]]
name = "fp-rpc"
version = "3.0.0-dev"
-source = "git+https://github.com/uniquenetwork/unique-frontier?branch=unique-polkadot-v0.9.42#4f7a610defd7623aa147d83c83cbc42f907ce8bb"
+source = "git+https://github.com/uniquenetwork/unique-frontier?branch=unique-polkadot-v0.9.42-1#cf3f4f309c7b053c29a619b78fd27b744cbe020a"
dependencies = [
"ethereum",
"ethereum-types",
@@ -3125,7 +3125,7 @@
[[package]]
name = "fp-self-contained"
version = "1.0.0-dev"
-source = "git+https://github.com/uniquenetwork/unique-frontier?branch=unique-polkadot-v0.9.42#4f7a610defd7623aa147d83c83cbc42f907ce8bb"
+source = "git+https://github.com/uniquenetwork/unique-frontier?branch=unique-polkadot-v0.9.42-1#cf3f4f309c7b053c29a619b78fd27b744cbe020a"
dependencies = [
"frame-support",
"parity-scale-codec",
@@ -3137,7 +3137,7 @@
[[package]]
name = "fp-storage"
version = "2.0.0"
-source = "git+https://github.com/uniquenetwork/unique-frontier?branch=unique-polkadot-v0.9.42#4f7a610defd7623aa147d83c83cbc42f907ce8bb"
+source = "git+https://github.com/uniquenetwork/unique-frontier?branch=unique-polkadot-v0.9.42-1#cf3f4f309c7b053c29a619b78fd27b744cbe020a"
dependencies = [
"parity-scale-codec",
"serde",
@@ -6278,7 +6278,7 @@
[[package]]
name = "pallet-base-fee"
version = "1.0.0"
-source = "git+https://github.com/uniquenetwork/unique-frontier?branch=unique-polkadot-v0.9.42#4f7a610defd7623aa147d83c83cbc42f907ce8bb"
+source = "git+https://github.com/uniquenetwork/unique-frontier?branch=unique-polkadot-v0.9.42-1#cf3f4f309c7b053c29a619b78fd27b744cbe020a"
dependencies = [
"fp-evm",
"frame-support",
@@ -6542,7 +6542,7 @@
[[package]]
name = "pallet-ethereum"
version = "4.0.0-dev"
-source = "git+https://github.com/uniquenetwork/unique-frontier?branch=unique-polkadot-v0.9.42#4f7a610defd7623aa147d83c83cbc42f907ce8bb"
+source = "git+https://github.com/uniquenetwork/unique-frontier?branch=unique-polkadot-v0.9.42-1#cf3f4f309c7b053c29a619b78fd27b744cbe020a"
dependencies = [
"ethereum",
"ethereum-types",
@@ -6565,7 +6565,7 @@
[[package]]
name = "pallet-evm"
version = "6.0.0-dev"
-source = "git+https://github.com/uniquenetwork/unique-frontier?branch=unique-polkadot-v0.9.42#4f7a610defd7623aa147d83c83cbc42f907ce8bb"
+source = "git+https://github.com/uniquenetwork/unique-frontier?branch=unique-polkadot-v0.9.42-1#cf3f4f309c7b053c29a619b78fd27b744cbe020a"
dependencies = [
"environmental",
"evm",
@@ -6644,7 +6644,7 @@
[[package]]
name = "pallet-evm-precompile-simple"
version = "2.0.0-dev"
-source = "git+https://github.com/uniquenetwork/unique-frontier?branch=unique-polkadot-v0.9.42#4f7a610defd7623aa147d83c83cbc42f907ce8bb"
+source = "git+https://github.com/uniquenetwork/unique-frontier?branch=unique-polkadot-v0.9.42-1#cf3f4f309c7b053c29a619b78fd27b744cbe020a"
dependencies = [
"fp-evm",
"ripemd",
Cargo.tomldiffbeforeafterboth--- a/Cargo.toml
+++ b/Cargo.toml
@@ -65,19 +65,19 @@
unique-runtime = { path = "runtime/unique" }
# Frontier (Unique patches over the Parity version)
-fc-consensus = { git = "https://github.com/uniquenetwork/unique-frontier", branch = "unique-polkadot-v0.9.42" }
-fc-db = { default-features = false, git = "https://github.com/uniquenetwork/unique-frontier", branch = "unique-polkadot-v0.9.42" }
-fc-mapping-sync = { git = "https://github.com/uniquenetwork/unique-frontier", branch = "unique-polkadot-v0.9.42" }
-fc-rpc = { default-features = false, git = "https://github.com/uniquenetwork/unique-frontier", branch = "unique-polkadot-v0.9.42" }
-fc-rpc-core = { default-features = false, git = "https://github.com/uniquenetwork/unique-frontier", branch = "unique-polkadot-v0.9.42" }
-fp-evm = { default-features = false, git = "https://github.com/uniquenetwork/unique-frontier", branch = "unique-polkadot-v0.9.42" }
-fp-rpc = { default-features = false, git = "https://github.com/uniquenetwork/unique-frontier", branch = "unique-polkadot-v0.9.42" }
-fp-self-contained = { default-features = false, git = "https://github.com/uniquenetwork/unique-frontier", branch = "unique-polkadot-v0.9.42" }
-fp-storage = { default-features = false, git = "https://github.com/uniquenetwork/unique-frontier", branch = "unique-polkadot-v0.9.42" }
-pallet-base-fee = { default-features = false, git = "https://github.com/uniquenetwork/unique-frontier", branch = "unique-polkadot-v0.9.42" }
-pallet-ethereum = { default-features = false, git = "https://github.com/uniquenetwork/unique-frontier", branch = "unique-polkadot-v0.9.42" }
-pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/unique-frontier", branch = "unique-polkadot-v0.9.42" }
-pallet-evm-precompile-simple = { default-features = false, git = "https://github.com/uniquenetwork/unique-frontier", branch = "unique-polkadot-v0.9.42" }
+fc-consensus = { git = "https://github.com/uniquenetwork/unique-frontier", branch = "unique-polkadot-v0.9.42-1" }
+fc-db = { default-features = false, git = "https://github.com/uniquenetwork/unique-frontier", branch = "unique-polkadot-v0.9.42-1" }
+fc-mapping-sync = { git = "https://github.com/uniquenetwork/unique-frontier", branch = "unique-polkadot-v0.9.42-1" }
+fc-rpc = { default-features = false, git = "https://github.com/uniquenetwork/unique-frontier", branch = "unique-polkadot-v0.9.42-1" }
+fc-rpc-core = { default-features = false, git = "https://github.com/uniquenetwork/unique-frontier", branch = "unique-polkadot-v0.9.42-1" }
+fp-evm = { default-features = false, git = "https://github.com/uniquenetwork/unique-frontier", branch = "unique-polkadot-v0.9.42-1" }
+fp-rpc = { default-features = false, git = "https://github.com/uniquenetwork/unique-frontier", branch = "unique-polkadot-v0.9.42-1" }
+fp-self-contained = { default-features = false, git = "https://github.com/uniquenetwork/unique-frontier", branch = "unique-polkadot-v0.9.42-1" }
+fp-storage = { default-features = false, git = "https://github.com/uniquenetwork/unique-frontier", branch = "unique-polkadot-v0.9.42-1" }
+pallet-base-fee = { default-features = false, git = "https://github.com/uniquenetwork/unique-frontier", branch = "unique-polkadot-v0.9.42-1" }
+pallet-ethereum = { default-features = false, git = "https://github.com/uniquenetwork/unique-frontier", branch = "unique-polkadot-v0.9.42-1" }
+pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/unique-frontier", branch = "unique-polkadot-v0.9.42-1" }
+pallet-evm-precompile-simple = { default-features = false, git = "https://github.com/uniquenetwork/unique-frontier", branch = "unique-polkadot-v0.9.42-1" }
# Parity
codec = { default-features = false, features = ['derive'], package = 'parity-scale-codec', version = "3.2.2" }
tests/src/eth/transferValue.test.tsdiffbeforeafterboth1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617import {IKeyringPair} from '@polkadot/types/types';18import {itEth, usingEthPlaygrounds} from './util';19import {expect} from 'chai';2021describe('Send value to contract', () => {22 let donor: IKeyringPair;2324 before(async () => {25 await usingEthPlaygrounds(async (_helper, privateKey) => {26 donor = await privateKey({url: import.meta.url});27 });28 });2930 itEth('Send to and from contract', async ({helper}) => {31 const contractOwner = await helper.eth.createAccountWithBalance(donor, 600n);32 const [buyer, receiver] = await helper.arrange.createAccounts([600n, 600n], donor);33 const receiverMirror = helper.address.substrateToEth(receiver.address);34 const contract = await helper.ethContract.deployByCode(35 contractOwner,36 'Test',37 `38 // SPDX-License-Identifier: UNLICENSED39 pragma solidity 0.8.17;40 41 contract Test {42 function send() public payable {43 if (msg.value < 1000000000000000000)44 revert("Not enough gold");45 }46 47 function withdraw(address to) public {48 payable(to).transfer(1000000000000000000);49 }50 }51 `,52 );5354 const balanceBefore = await helper.balance.getSubstrate(buyer.address);55 await helper.eth.sendEVM(buyer, contract.options.address, contract.methods.send().encodeABI(), '2000000000000000000');56 const balanceAfter = await helper.balance.getSubstrate(buyer.address);57 expect(balanceBefore - balanceAfter > 2000000000000000000n).to.be.true;58 expect(await helper.balance.getEthereum(contract.options.address)).to.be.equal(2000000000000000000n);5960 await helper.eth.sendEVM(buyer, contract.options.address, contract.methods.withdraw(receiverMirror).encodeABI(), '0');61 expect(await helper.balance.getEthereum(receiverMirror)).to.be.equal(1000000000000000000n);62 expect(await helper.balance.getEthereum(contract.options.address)).to.be.equal(1000000000000000000n);63 });64});