def __init__(self, root=BLANK_ROOT, env=Env(), qkc_config=None, executing_on_head=False, db=None, **kwargs): if db is None: db = env.db self.env = env self.__db = db self.trie = SecureTrie(Trie(self.db, root)) for k, v in STATE_DEFAULTS.items(): setattr(self, k, kwargs.get(k, copy.copy(v))) self.journal = [] self.cache = {} self.log_listeners = [] self.deletes = [] self.changed = {} self.executing_on_head = executing_on_head self.qkc_config = qkc_config self.sender_disallow_map = dict() # type: Dict[bytes, int] self.shard_config = ShardConfig(ChainConfig())
def __init__(self, nonce, balance, storage, code_hash, full_shard_id, env, address, db=None): self.db = env.db if db is None else db assert isinstance(db, Db) self.env = env self.address = address acc = _Account(nonce, balance, storage, code_hash, full_shard_id) self.nonce = acc.nonce self.balance = acc.balance self.storage = acc.storage self.code_hash = acc.code_hash self.full_shard_id = acc.full_shard_id self.multibalance = dict() token1 = Token('token1', 0) token2 = Token('token2', 1) token3 = Token('token3', 2) self.multibalance[token1.token_id] = 10000000000000000000000 self.multibalance[token2.token_id] = 10000000000000000000000 self.multibalance[token3.token_id] = 10000000000000000000000 self.storage_cache = {} self.storage_trie = SecureTrie(Trie(self.db)) self.storage_trie.root_hash = self.storage self.touched = False self.existent_at_start = True self._mutable = True self.deleted = False