mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 20:21:03 +00:00
More work on Ext & calls.
This commit is contained in:
@@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
use rstd::prelude::*;
|
use rstd::prelude::*;
|
||||||
use rstd::cell::RefCell;
|
use rstd::cell::RefCell;
|
||||||
use rstd::hash_map::{HashMap, Entry};
|
use rstd::collections::hash_map::{HashMap, Entry};
|
||||||
use runtime_io::{print, blake2_256};
|
use runtime_io::{print, blake2_256};
|
||||||
use codec::KeyedVec;
|
use codec::KeyedVec;
|
||||||
use runtime_support::{storage, StorageVec};
|
use runtime_support::{storage, StorageVec};
|
||||||
@@ -220,6 +220,7 @@ pub mod public {
|
|||||||
let local: RefCell<State> = RefCell::new(HashMap::new());
|
let local: RefCell<State> = RefCell::new(HashMap::new());
|
||||||
|
|
||||||
let should_commit = {
|
let should_commit = {
|
||||||
|
let mut transfer = |inner_dest: &AccountId, value: Balance| {
|
||||||
// Our local ext: Should be used for any transfers and creates that happen internally.
|
// Our local ext: Should be used for any transfers and creates that happen internally.
|
||||||
let ext = Ext {
|
let ext = Ext {
|
||||||
do_get_account_storage: |account: &AccountId, location: &[u8]|
|
do_get_account_storage: |account: &AccountId, location: &[u8]|
|
||||||
@@ -237,7 +238,6 @@ pub mod public {
|
|||||||
.unwrap_or_else(|| ext.get_account_balance(account)),
|
.unwrap_or_else(|| ext.get_account_balance(account)),
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut transfer = |inner_dest: &AccountId, value: Balance| {
|
|
||||||
if let Some(commit_state) = effect_transfer(dest, inner_dest, value, ext) {
|
if let Some(commit_state) = effect_transfer(dest, inner_dest, value, ext) {
|
||||||
let mut local = local.borrow_mut();
|
let mut local = local.borrow_mut();
|
||||||
for (address, (maybe_balance, maybe_code, storage)) in commit_state.into_iter() {
|
for (address, (maybe_balance, maybe_code, storage)) in commit_state.into_iter() {
|
||||||
@@ -259,8 +259,8 @@ pub mod public {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
let mut create = |code: &[u8], value: Balance| unimplemented!(); // TODO: use `create` and place in `local`
|
||||||
let mut create = |code: &[u8], value: Balance| unimplemented!();
|
let mut set_storage = |code: &[u8], value: Balance| unimplemented!(); // TODO: use `local`
|
||||||
|
|
||||||
storage::put(CALL_DEPTH, &(call_depth + 1));
|
storage::put(CALL_DEPTH, &(call_depth + 1));
|
||||||
|
|
||||||
|
|||||||
@@ -25,4 +25,6 @@ pub use std::ptr;
|
|||||||
pub use std::rc;
|
pub use std::rc;
|
||||||
pub use std::slice;
|
pub use std::slice;
|
||||||
pub use std::vec;
|
pub use std::vec;
|
||||||
pub use std::collections::hash_map;
|
pub mod collections {
|
||||||
|
pub use std::collections::hash_map;
|
||||||
|
}
|
||||||
|
|||||||
@@ -25,7 +25,9 @@ extern crate pwasm_alloc;
|
|||||||
pub use alloc::boxed;
|
pub use alloc::boxed;
|
||||||
pub use alloc::rc;
|
pub use alloc::rc;
|
||||||
pub use alloc::vec;
|
pub use alloc::vec;
|
||||||
pub use alloc::collections::hash_map;
|
pub mod collections {
|
||||||
|
pub use alloc::collections::hash_map;
|
||||||
|
}
|
||||||
pub use core::cell;
|
pub use core::cell;
|
||||||
pub use core::cmp;
|
pub use core::cmp;
|
||||||
pub use core::intrinsics;
|
pub use core::intrinsics;
|
||||||
|
|||||||
Reference in New Issue
Block a user