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
2553 "pallet-balances",2553 "pallet-balances",
2554 "pallet-contracts",2554 "pallet-contracts",
2555 "pallet-contracts-primitives",2555 "pallet-contracts-primitives",
2556 "pallet-contracts-rpc-runtime-api",
2556 "pallet-grandpa",2557 "pallet-grandpa",
2557 "pallet-nft",2558 "pallet-nft",
2558 "pallet-randomness-collective-flip",2559 "pallet-randomness-collective-flip",
modifiednode/src/chain_spec.rsdiffbeforeafterboth
122 key: root_key,122 key: root_key,
123 }),123 }),
124 contracts: Some(ContractsConfig {124 contracts: Some(ContractsConfig {
125 gas_price: 1_000_000_000,125 gas_price: 1_000,
126 current_schedule: ContractsSchedule {126 current_schedule: ContractsSchedule {
127 // enable_println,127 // enable_println,
128 ..Default::default()128 ..Default::default()
modifiedruntime/Cargo.tomldiffbeforeafterboth
24package = 'pallet-contracts-primitives'24package = 'pallet-contracts-primitives'
25version = '2.0.0-alpha.6'25version = '2.0.0-alpha.6'
26
27[dependencies.contracts-rpc-runtime-api]
28default-features = false
29package = 'pallet-contracts-rpc-runtime-api'
30version = '0.8.0-alpha.6'
2631
27[dependencies.frame-executive]32[dependencies.frame-executive]
28default-features = false33default-features = false
143 'aura/std',148 'aura/std',
144 'balances/std',149 'balances/std',
145 'codec/std',150 'codec/std',
146 'contracts/std',151 "contracts/std",
147 'contracts-primitives/std',152 "contracts-primitives/std",
153 "contracts-rpc-runtime-api/std",
148 'frame-executive/std',154 'frame-executive/std',
149 'frame-support/std',155 'frame-support/std',
150 'grandpa/std',156 '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