git.delta.rocks / unique-network / refs/commits / 6ec64feddc4d

difftreelog

Contracts rpc runtime added

str-mv2020-07-10parent: #dc1cc2f.patch.diff
in: master

4 files changed

modifiedCargo.lockdiffbeforeafterboth
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -2553,6 +2553,7 @@
  "pallet-balances",
  "pallet-contracts",
  "pallet-contracts-primitives",
+ "pallet-contracts-rpc-runtime-api",
  "pallet-grandpa",
  "pallet-nft",
  "pallet-randomness-collective-flip",
modifiednode/src/chain_spec.rsdiffbeforeafterboth
--- a/node/src/chain_spec.rs
+++ b/node/src/chain_spec.rs
@@ -122,7 +122,7 @@
 			key: root_key,
 		}),
 		contracts: Some(ContractsConfig {
-			gas_price: 1_000_000_000,
+			gas_price: 1_000,
             current_schedule: ContractsSchedule {
                  //   enable_println,
                     ..Default::default()
modifiedruntime/Cargo.tomldiffbeforeafterboth
--- a/runtime/Cargo.toml
+++ b/runtime/Cargo.toml
@@ -24,6 +24,11 @@
 package = 'pallet-contracts-primitives'
 version = '2.0.0-alpha.6'
 
+[dependencies.contracts-rpc-runtime-api]
+default-features = false
+package = 'pallet-contracts-rpc-runtime-api'
+version = '0.8.0-alpha.6'
+
 [dependencies.frame-executive]
 default-features = false
 version = '2.0.0-alpha.6'
@@ -143,8 +148,9 @@
     'aura/std',
     'balances/std',
     'codec/std',
-    'contracts/std',
-    'contracts-primitives/std',
+	"contracts/std",
+	"contracts-primitives/std",
+	"contracts-rpc-runtime-api/std",
     'frame-executive/std',
     'frame-support/std',
     'grandpa/std',
modifiedruntime/src/lib.rsdiffbeforeafterboth
36pub use sp_runtime::{Perbill, Permill};36pub use sp_runtime::{Perbill, Permill};
37pub use timestamp::Call as TimestampCall;37pub use timestamp::Call as TimestampCall;
38pub use contracts::Schedule as ContractsSchedule;38pub use contracts::Schedule as ContractsSchedule;
39pub use contracts_rpc_runtime_api::{
40 self as runtime_api, ContractExecResult
41};
3942
40/// Importing a template pallet43/// Importing a template pallet
41pub use nft;44pub use nft;
404 }407 }
405 }408 }
409
410 impl contracts_rpc_runtime_api::ContractsApi<Block, AccountId, Balance, BlockNumber>
411 for Runtime
412 {
413 fn call(
414 origin: AccountId,
415 dest: AccountId,
416 value: Balance,
417 gas_limit: u64,
418 input_data: Vec<u8>,
419 ) -> ContractExecResult {
420 let exec_result =
421 Contracts::bare_call(origin, dest.into(), value, gas_limit, input_data);
422 match exec_result {
423 Ok(v) => ContractExecResult::Success {
424 status: v.status,
425 data: v.data,
426 },
427 Err(_) => ContractExecResult::Error,
428 }
429 }
430
431 fn get_storage(
432 address: AccountId,
433 key: [u8; 32],
434 ) -> contracts_primitives::GetStorageResult {
435 Contracts::get_storage(address, key)
436 }
437
438 fn rent_projection(
439 address: AccountId,
440 ) -> contracts_primitives::RentProjectionResult<BlockNumber> {
441 Contracts::rent_projection(address)
442 }
443 }
406}444}
407445