mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 19:11:02 +00:00
More work on Ext & calls.
This commit is contained in:
@@ -18,7 +18,7 @@
|
||||
|
||||
use rstd::prelude::*;
|
||||
use rstd::cell::RefCell;
|
||||
use rstd::hash_map::{HashMap, Entry};
|
||||
use rstd::collections::hash_map::{HashMap, Entry};
|
||||
use runtime_io::{print, blake2_256};
|
||||
use codec::KeyedVec;
|
||||
use runtime_support::{storage, StorageVec};
|
||||
@@ -220,6 +220,7 @@ pub mod public {
|
||||
let local: RefCell<State> = RefCell::new(HashMap::new());
|
||||
|
||||
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.
|
||||
let ext = Ext {
|
||||
do_get_account_storage: |account: &AccountId, location: &[u8]|
|
||||
@@ -237,7 +238,6 @@ pub mod public {
|
||||
.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) {
|
||||
let mut local = local.borrow_mut();
|
||||
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!();
|
||||
let mut create = |code: &[u8], value: Balance| unimplemented!(); // TODO: use `create` and place in `local`
|
||||
let mut set_storage = |code: &[u8], value: Balance| unimplemented!(); // TODO: use `local`
|
||||
|
||||
storage::put(CALL_DEPTH, &(call_depth + 1));
|
||||
|
||||
|
||||
@@ -25,4 +25,6 @@ pub use std::ptr;
|
||||
pub use std::rc;
|
||||
pub use std::slice;
|
||||
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::rc;
|
||||
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::cmp;
|
||||
pub use core::intrinsics;
|
||||
|
||||
Reference in New Issue
Block a user