git.delta.rocks / unique-network / refs/commits / a90a9da574c3

difftreelog

Add `ecrecovery` and `sr25519` precompiles

Grigoriy Simonov2022-12-05parent: #9a4bd0b.patch.diff
in: master

18 files changed

modifiedCargo.lockdiffbeforeafterboth
2274 "hash256-std-hasher",2274 "hash256-std-hasher",
2275 "rlp",2275 "rlp",
2276 "rlp-derive",2276 "rlp-derive",
2277 "sha3",2277 "sha3 0.10.6",
2278 "triehash",2278 "triehash",
2279]2279]
22802280
2292 "rlp",2292 "rlp",
2293 "scale-info",2293 "scale-info",
2294 "serde",2294 "serde",
2295 "sha3",2295 "sha3 0.10.6",
2296 "triehash",2296 "triehash",
2297]2297]
22982298
2350 "rlp",2350 "rlp",
2351 "scale-info",2351 "scale-info",
2352 "serde",2352 "serde",
2353 "sha3",2353 "sha3 0.10.6",
2354]2354]
23552355
2356[[package]]2356[[package]]
2380 "hex",2380 "hex",
2381 "proc-macro2",2381 "proc-macro2",
2382 "quote",2382 "quote",
2383 "sha3",2383 "sha3 0.10.6",
2384 "syn",2384 "syn",
2385]2385]
23862386
2415 "environmental",2415 "environmental",
2416 "evm-core",2416 "evm-core",
2417 "primitive-types 0.12.1",2417 "primitive-types 0.12.1",
2418 "sha3",2418 "sha3 0.10.6",
2419]2419]
24202420
2421[[package]]2421[[package]]
4958 "digest 0.10.6",4958 "digest 0.10.6",
4959 "multihash-derive",4959 "multihash-derive",
4960 "sha2 0.10.6",4960 "sha2 0.10.6",
4961 "sha3",4961 "sha3 0.10.6",
4962 "unsigned-varint",4962 "unsigned-varint",
4963]4963]
49644964
5280 "cumulus-primitives-utility",5280 "cumulus-primitives-utility",
5281 "derivative",5281 "derivative",
5282 "evm-coder",5282 "evm-coder",
5283 "fp-evm",
5283 "fp-evm-mapping",5284 "fp-evm-mapping",
5284 "fp-rpc",5285 "fp-rpc",
5285 "fp-self-contained",5286 "fp-self-contained",
5294 "impl-trait-for-tuples",5295 "impl-trait-for-tuples",
5295 "log",5296 "log",
5296 "logtest",5297 "logtest",
5298 "num_enum",
5297 "orml-tokens",5299 "orml-tokens",
5298 "orml-traits",5300 "orml-traits",
5299 "orml-vesting",5301 "orml-vesting",
5309 "pallet-evm-coder-substrate",5311 "pallet-evm-coder-substrate",
5310 "pallet-evm-contract-helpers",5312 "pallet-evm-contract-helpers",
5311 "pallet-evm-migration",5313 "pallet-evm-migration",
5314 "pallet-evm-precompile-simple",
5312 "pallet-evm-transaction-payment",5315 "pallet-evm-transaction-payment",
5313 "pallet-foreign-assets",5316 "pallet-foreign-assets",
5314 "pallet-fungible",5317 "pallet-fungible",
5333 "parachain-info",5336 "parachain-info",
5334 "parity-scale-codec 3.2.1",5337 "parity-scale-codec 3.2.1",
5335 "polkadot-parachain",5338 "polkadot-parachain",
5339 "precompile-utils-macro",
5336 "rmrk-rpc",5340 "rmrk-rpc",
5337 "scale-info",5341 "scale-info",
5338 "serde",5342 "serde",
6004 "sp-std",6008 "sp-std",
6005]6009]
6010
6011[[package]]
6012name = "pallet-evm-precompile-simple"
6013version = "2.0.0-dev"
6014source = "git+https://github.com/uniquenetwork/frontier?branch=unique-polkadot-v0.9.33#c37ced433a29baad45899d6ab364fe437f97570e"
6015dependencies = [
6016 "fp-evm",
6017 "ripemd",
6018 "sp-io",
6019]
60066020
6007[[package]]6021[[package]]
6008name = "pallet-evm-transaction-payment"6022name = "pallet-evm-transaction-payment"
8594source = "registry+https://github.com/rust-lang/crates.io-index"8608source = "registry+https://github.com/rust-lang/crates.io-index"
8595checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de"8609checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de"
8610
8611[[package]]
8612name = "precompile-utils-macro"
8613version = "0.1.0"
8614dependencies = [
8615 "num_enum",
8616 "proc-macro2",
8617 "quote",
8618 "sha3 0.8.2",
8619 "syn",
8620]
85968621
8597[[package]]8622[[package]]
8598name = "predicates"8623name = "predicates"
8850 "cumulus-primitives-utility",8875 "cumulus-primitives-utility",
8851 "derivative",8876 "derivative",
8852 "evm-coder",8877 "evm-coder",
8878 "fp-evm",
8853 "fp-evm-mapping",8879 "fp-evm-mapping",
8854 "fp-rpc",8880 "fp-rpc",
8855 "fp-self-contained",8881 "fp-self-contained",
8864 "impl-trait-for-tuples",8890 "impl-trait-for-tuples",
8865 "log",8891 "log",
8866 "logtest",8892 "logtest",
8893 "num_enum",
8867 "orml-tokens",8894 "orml-tokens",
8868 "orml-traits",8895 "orml-traits",
8869 "orml-vesting",8896 "orml-vesting",
8879 "pallet-evm-coder-substrate",8906 "pallet-evm-coder-substrate",
8880 "pallet-evm-contract-helpers",8907 "pallet-evm-contract-helpers",
8881 "pallet-evm-migration",8908 "pallet-evm-migration",
8909 "pallet-evm-precompile-simple",
8882 "pallet-evm-transaction-payment",8910 "pallet-evm-transaction-payment",
8883 "pallet-foreign-assets",8911 "pallet-foreign-assets",
8884 "pallet-fungible",8912 "pallet-fungible",
8901 "parachain-info",8929 "parachain-info",
8902 "parity-scale-codec 3.2.1",8930 "parity-scale-codec 3.2.1",
8903 "polkadot-parachain",8931 "polkadot-parachain",
8932 "precompile-utils-macro",
8904 "rmrk-rpc",8933 "rmrk-rpc",
8905 "scale-info",8934 "scale-info",
8906 "serde",8935 "serde",
9248 "winapi",9277 "winapi",
9249]9278]
9279
9280[[package]]
9281name = "ripemd"
9282version = "0.1.3"
9283source = "registry+https://github.com/rust-lang/crates.io-index"
9284checksum = "bd124222d17ad93a644ed9d011a40f4fb64aa54275c08cc216524a9ea82fb09f"
9285dependencies = [
9286 "digest 0.10.6",
9287]
92509288
9251[[package]]9289[[package]]
9252name = "rlp"9290name = "rlp"
10959 "digest 0.10.6",10997 "digest 0.10.6",
10960]10998]
10999
11000[[package]]
11001name = "sha3"
11002version = "0.8.2"
11003source = "registry+https://github.com/rust-lang/crates.io-index"
11004checksum = "dd26bc0e7a2e3a7c959bc494caf58b72ee0c71d67704e9520f736ca7e4853ecf"
11005dependencies = [
11006 "block-buffer 0.7.3",
11007 "byte-tools",
11008 "digest 0.8.1",
11009 "keccak",
11010 "opaque-debug 0.2.3",
11011]
1096111012
10962[[package]]11013[[package]]
10963name = "sha3"11014name = "sha3"
11396 "byteorder",11447 "byteorder",
11397 "digest 0.10.6",11448 "digest 0.10.6",
11398 "sha2 0.10.6",11449 "sha2 0.10.6",
11399 "sha3",11450 "sha3 0.10.6",
11400 "sp-std",11451 "sp-std",
11401 "twox-hash",11452 "twox-hash",
11402]11453]
13026 "cumulus-primitives-utility",13077 "cumulus-primitives-utility",
13027 "derivative",13078 "derivative",
13028 "evm-coder",13079 "evm-coder",
13080 "fp-evm",
13029 "fp-evm-mapping",13081 "fp-evm-mapping",
13030 "fp-rpc",13082 "fp-rpc",
13031 "fp-self-contained",13083 "fp-self-contained",
13040 "impl-trait-for-tuples",13092 "impl-trait-for-tuples",
13041 "log",13093 "log",
13042 "logtest",13094 "logtest",
13095 "num_enum",
13043 "orml-tokens",13096 "orml-tokens",
13044 "orml-traits",13097 "orml-traits",
13045 "orml-vesting",13098 "orml-vesting",
13055 "pallet-evm-coder-substrate",13108 "pallet-evm-coder-substrate",
13056 "pallet-evm-contract-helpers",13109 "pallet-evm-contract-helpers",
13057 "pallet-evm-migration",13110 "pallet-evm-migration",
13111 "pallet-evm-precompile-simple",
13058 "pallet-evm-transaction-payment",13112 "pallet-evm-transaction-payment",
13059 "pallet-foreign-assets",13113 "pallet-foreign-assets",
13060 "pallet-fungible",13114 "pallet-fungible",
13077 "parachain-info",13131 "parachain-info",
13078 "parity-scale-codec 3.2.1",13132 "parity-scale-codec 3.2.1",
13079 "polkadot-parachain",13133 "polkadot-parachain",
13134 "precompile-utils-macro",
13080 "rmrk-rpc",13135 "rmrk-rpc",
13081 "scale-info",13136 "scale-info",
13082 "serde",13137 "serde",
modifiedpallets/refungible/src/erc_token.rsdiffbeforeafterboth
19//! Provides ERC-20 standart support implementation and EVM API for unique extensions for Refungible Pallet.19//! Provides ERC-20 standart support implementation and EVM API for unique extensions for Refungible Pallet.
20//! Method implementations are mostly doing parameter conversion and calling Nonfungible Pallet methods.20//! Method implementations are mostly doing parameter conversion and calling Nonfungible Pallet methods.
21
22extern crate alloc;
23
24#[cfg(not(feature = "std"))]
25use alloc::format;
2621
27use core::{22use core::{
28 char::{REPLACEMENT_CHARACTER, decode_utf16},23 char::{REPLACEMENT_CHARACTER, decode_utf16},
modifiedruntime/common/config/ethereum.rsdiffbeforeafterboth
7use sp_runtime::{RuntimeAppPublic, Perbill};7use sp_runtime::{RuntimeAppPublic, Perbill};
8use crate::{8use crate::{
9 runtime_common::{9 runtime_common::{
10 config::sponsoring::DefaultSponsoringRateLimit,
11 DealWithFees,
10 dispatch::CollectionDispatchT, ethereum::sponsoring::EvmSponsorshipHandler,12 dispatch::CollectionDispatchT,
11 config::sponsoring::DefaultSponsoringRateLimit, DealWithFees,13 ethereum::{precompiles::UniquePrecompiles, sponsoring::EvmSponsorshipHandler},
12 },14 },
13 Runtime, Aura, Balances, RuntimeEvent, ChainId,15 Runtime, Aura, Balances, RuntimeEvent, ChainId,
14};16};
34const EVM_DISPATCH_RATIO: Perbill = Perbill::from_percent(50);36const EVM_DISPATCH_RATIO: Perbill = Perbill::from_percent(50);
35parameter_types! {37parameter_types! {
36 pub BlockGasLimit: U256 = U256::from((NORMAL_DISPATCH_RATIO * EVM_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT / WeightTimePerGas::get()).ref_time());38 pub BlockGasLimit: U256 = U256::from((NORMAL_DISPATCH_RATIO * EVM_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT / WeightTimePerGas::get()).ref_time());
39 pub PrecompilesValue: UniquePrecompiles<Runtime> = UniquePrecompiles::<_>::new();
37}40}
3841
39pub struct EthereumFindAuthor<F>(core::marker::PhantomData<F>);42pub struct EthereumFindAuthor<F>(core::marker::PhantomData<F>);
62 type CallOrigin = EnsureAddressTruncated<Self>;65 type CallOrigin = EnsureAddressTruncated<Self>;
63 type WithdrawOrigin = EnsureAddressTruncated<Self>;66 type WithdrawOrigin = EnsureAddressTruncated<Self>;
64 type AddressMapping = HashedAddressMapping<Self::Hashing>;67 type AddressMapping = HashedAddressMapping<Self::Hashing>;
65 type PrecompilesType = ();68 type PrecompilesType = UniquePrecompiles<Self>;
66 type PrecompilesValue = ();69 type PrecompilesValue = PrecompilesValue;
67 type Currency = Balances;70 type Currency = Balances;
68 type RuntimeEvent = RuntimeEvent;71 type RuntimeEvent = RuntimeEvent;
69 type OnMethodCall = (72 type OnMethodCall = (
modifiedruntime/common/ethereum/mod.rsdiffbeforeafterboth
14// You should have received a copy of the GNU General Public License14// You should have received a copy of the GNU General Public License
15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
1616
17pub mod precompiles;
17pub mod self_contained_call;18pub mod self_contained_call;
18pub mod sponsoring;19pub mod sponsoring;
19pub mod transaction_converter;20pub mod transaction_converter;
addedruntime/common/ethereum/precompiles/mod.rsdiffbeforeafterboth

no changes

addedruntime/common/ethereum/precompiles/sr25519.rsdiffbeforeafterboth

no changes

addedruntime/common/ethereum/precompiles/utils/data.rsdiffbeforeafterboth

no changes

addedruntime/common/ethereum/precompiles/utils/macro/Cargo.tomldiffbeforeafterboth

no changes

addedruntime/common/ethereum/precompiles/utils/macro/src/lib.rsdiffbeforeafterboth

no changes

addedruntime/common/ethereum/precompiles/utils/mod.rsdiffbeforeafterboth

no changes

modifiedruntime/opal/Cargo.tomldiffbeforeafterboth
471up-rpc = { path = "../../primitives/rpc", default-features = false }471up-rpc = { path = "../../primitives/rpc", default-features = false }
472app-promotion-rpc = { path = "../../primitives/app_promotion_rpc", default-features = false }472app-promotion-rpc = { path = "../../primitives/app_promotion_rpc", default-features = false }
473rmrk-rpc = { path = "../../primitives/rmrk-rpc", default-features = false }473rmrk-rpc = { path = "../../primitives/rmrk-rpc", default-features = false }
474fp-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.33" }
474fp-evm-mapping = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.33" }475fp-evm-mapping = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.33" }
475pallet-inflation = { path = '../../pallets/inflation', default-features = false }476pallet-inflation = { path = '../../pallets/inflation', default-features = false }
476pallet-app-promotion = { path = '../../pallets/app-promotion', default-features = false }477pallet-app-promotion = { path = '../../pallets/app-promotion', default-features = false }
494pallet-base-fee = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.33" }495pallet-base-fee = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.33" }
495fp-rpc = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.33" }496fp-rpc = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.33" }
496fp-self-contained = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.33" }497fp-self-contained = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.33" }
498pallet-evm-precompile-simple = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.33" }
497evm-coder = { default-features = false, path = '../../crates/evm-coder' }499evm-coder = { default-features = false, path = '../../crates/evm-coder' }
498up-sponsorship = { default-features = false, git = "https://github.com/uniquenetwork/pallet-sponsoring", branch = 'polkadot-v0.9.33' }500up-sponsorship = { default-features = false, git = "https://github.com/uniquenetwork/pallet-sponsoring", branch = 'polkadot-v0.9.33' }
499pallet-foreign-assets = { default-features = false, path = "../../pallets/foreign-assets" }501pallet-foreign-assets = { default-features = false, path = "../../pallets/foreign-assets" }
500pallet-maintenance = { default-features = false, path = "../../pallets/maintenance" }502pallet-maintenance = { default-features = false, path = "../../pallets/maintenance" }
503precompile-utils-macro = { path = "../common/ethereum/precompiles/utils/macro" }
504num_enum = { version = "0.5.3", default-features = false }
501505
502################################################################################506################################################################################
503# Test dependencies507# Test dependencies
modifiedruntime/opal/src/lib.rsdiffbeforeafterboth
25#[cfg(feature = "std")]25#[cfg(feature = "std")]
26include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));26include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));
27
28extern crate alloc;
2729
28use frame_support::parameter_types;30use frame_support::parameter_types;
2931
modifiedruntime/quartz/Cargo.tomldiffbeforeafterboth
463pallet-unique = { path = '../../pallets/unique', default-features = false }463pallet-unique = { path = '../../pallets/unique', default-features = false }
464up-rpc = { path = "../../primitives/rpc", default-features = false }464up-rpc = { path = "../../primitives/rpc", default-features = false }
465app-promotion-rpc = { path = "../../primitives/app_promotion_rpc", default-features = false }465app-promotion-rpc = { path = "../../primitives/app_promotion_rpc", default-features = false }
466fp-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.33" }
466fp-evm-mapping = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.33" }467fp-evm-mapping = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.33" }
467pallet-inflation = { path = '../../pallets/inflation', default-features = false }468pallet-inflation = { path = '../../pallets/inflation', default-features = false }
468pallet-app-promotion = { path = '../../pallets/app-promotion', default-features = false }469pallet-app-promotion = { path = '../../pallets/app-promotion', default-features = false }
486pallet-base-fee = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.33" }487pallet-base-fee = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.33" }
487fp-rpc = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.33" }488fp-rpc = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.33" }
488fp-self-contained = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.33" }489fp-self-contained = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.33" }
490pallet-evm-precompile-simple = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.33" }
489evm-coder = { default-features = false, path = '../../crates/evm-coder' }491evm-coder = { default-features = false, path = '../../crates/evm-coder' }
490up-sponsorship = { default-features = false, git = "https://github.com/uniquenetwork/pallet-sponsoring", branch = 'polkadot-v0.9.33' }492up-sponsorship = { default-features = false, git = "https://github.com/uniquenetwork/pallet-sponsoring", branch = 'polkadot-v0.9.33' }
491pallet-foreign-assets = { default-features = false, path = "../../pallets/foreign-assets" }493pallet-foreign-assets = { default-features = false, path = "../../pallets/foreign-assets" }
492pallet-maintenance = { default-features = false, path = "../../pallets/maintenance" }494pallet-maintenance = { default-features = false, path = "../../pallets/maintenance" }
495precompile-utils-macro = { path = "../common/ethereum/precompiles/utils/macro" }
496num_enum = { version = "0.5.3", default-features = false }
493497
494################################################################################498################################################################################
495# Other Dependencies499# Other Dependencies
modifiedruntime/quartz/src/lib.rsdiffbeforeafterboth
25#[cfg(feature = "std")]25#[cfg(feature = "std")]
26include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));26include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));
27
28extern crate alloc;
2729
28use frame_support::parameter_types;30use frame_support::parameter_types;
2931
modifiedruntime/unique/Cargo.tomldiffbeforeafterboth
479pallet-base-fee = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.33" }479pallet-base-fee = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.33" }
480fp-rpc = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.33" }480fp-rpc = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.33" }
481fp-self-contained = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.33" }481fp-self-contained = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.33" }
482fp-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.33" }
482fp-evm-mapping = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.33" }483fp-evm-mapping = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.33" }
484pallet-evm-precompile-simple = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.33" }
483evm-coder = { default-features = false, path = '../../crates/evm-coder' }485evm-coder = { default-features = false, path = '../../crates/evm-coder' }
484up-sponsorship = { default-features = false, git = "https://github.com/uniquenetwork/pallet-sponsoring", branch = 'polkadot-v0.9.33' }486up-sponsorship = { default-features = false, git = "https://github.com/uniquenetwork/pallet-sponsoring", branch = 'polkadot-v0.9.33' }
485pallet-foreign-assets = { default-features = false, path = "../../pallets/foreign-assets" }487pallet-foreign-assets = { default-features = false, path = "../../pallets/foreign-assets" }
486pallet-maintenance = { default-features = false, path = "../../pallets/maintenance" }488pallet-maintenance = { default-features = false, path = "../../pallets/maintenance" }
489precompile-utils-macro = { path = "../common/ethereum/precompiles/utils/macro" }
490num_enum = { version = "0.5.3", default-features = false }
487491
488################################################################################492################################################################################
489# Other Dependencies493# Other Dependencies
modifiedruntime/unique/src/lib.rsdiffbeforeafterboth
25#[cfg(feature = "std")]25#[cfg(feature = "std")]
26include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));26include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));
27
28extern crate alloc;
2729
28use frame_support::parameter_types;30use frame_support::parameter_types;
2931
addedtests/src/eth/precompile.test.tsdiffbeforeafterboth

no changes

modifiedtests/src/eth/util/playgrounds/unique.dev.tsdiffbeforeafterboth
60 }60 }
6161
62 async compile(name: string, src: string, imports?: ContractImports[]): Promise<CompiledContract> {62 async compile(name: string, src: string, imports?: ContractImports[]): Promise<CompiledContract> {
63 const out = JSON.parse(solc.compile(JSON.stringify({63 const compiled = JSON.parse(solc.compile(JSON.stringify({
64 language: 'Solidity',64 language: 'Solidity',
65 sources: {65 sources: {
66 [`${name}.sol`]: {66 [`${name}.sol`]: {
74 },74 },
75 },75 },
76 },76 },
77 }), {import: await this.findImports(imports)})).contracts[`${name}.sol`][name];77 }), {import: await this.findImports(imports)}));
78
79 const hasErrors = compiled['errors']
80 && compiled['errors'].length > 0
81 && compiled.errors.some(function(err: any) {
82 return err.severity == 'error';
83 });
84
85 if (hasErrors) {
86 throw compiled.errors;
87 }
88 const out = compiled.contracts[`${name}.sol`][name];
7889
79 return {90 return {
80 abi: out.abi,91 abi: out.abi,