func (self *XEth) FromNumber(str string) string { if common.IsHex(str) { str = str[2:] } return common.BigD(common.FromHex(str)).String() }
func (self *XEth) FromAscii(str string) string { if common.IsHex(str) { str = str[2:] } return string(bytes.Trim(common.FromHex(str), "\x00")) }
func (self *Object) StorageString(str string) []byte { if common.IsHex(str) { return self.storage(common.Hex2Bytes(str[2:])) } else { return self.storage(common.RightPadBytes([]byte(str), 32)) } }
func StateObjectFromAccount(db common.Database, addr string, account Account) *state.StateObject { obj := state.NewStateObject(common.HexToAddress(addr), db) obj.SetBalance(common.Big(account.Balance)) if common.IsHex(account.Code) { account.Code = account.Code[2:] } obj.SetCode(common.Hex2Bytes(account.Code)) obj.SetNonce(common.Big(account.Nonce).Uint64()) return obj }