 |
Ethereum
PoC-8
The C++ Implementation of Ethereum
|
Go to the documentation of this file.
54 const bytes c_blockhashContractCode(
fromHex(
"0x600073fffffffffffffffffffffffffffffffffffffffe33141561005957600143035b60011561005357600035610100820683015561010081061561004057005b6101008104905061010082019150610022565b506100e0565b4360003512156100d4576000356001814303035b61010081121515610085576000610100830614610088565b60005b156100a75761010083019250610100820491506101008104905061006d565b610100811215156100bd57600060a052602060a0f35b610100820683015460c052602060c0f350506100df565b600060e052602060e0f35b5b50"));
60 auto b =
fromHex(_s.substr(0, 2) ==
"0x" ? _s.substr(2) : _s, WhenError::Throw);
64 catch (BadHexCharacter&) {}
65 BOOST_THROW_EXCEPTION(InvalidAddress());
68 vector<pair<u256, string>>
const&
units()
70 static const vector<pair<u256, string>> s_units =
72 {exp10<54>(),
"Uether"},
73 {exp10<51>(),
"Vether"},
74 {exp10<48>(),
"Dether"},
75 {exp10<45>(),
"Nether"},
76 {exp10<42>(),
"Yether"},
77 {exp10<39>(),
"Zether"},
78 {exp10<36>(),
"Eether"},
79 {exp10<33>(),
"Pether"},
80 {exp10<30>(),
"Tether"},
81 {exp10<27>(),
"Gether"},
82 {exp10<24>(),
"Mether"},
83 {exp10<21>(),
"grand"},
84 {exp10<18>(),
"ether"},
85 {exp10<15>(),
"finney"},
86 {exp10<12>(),
"szabo"},
108 if (b >
units()[0].first * 1000)
110 ret << (b /
units()[0].first) <<
" " <<
units()[0].second;
113 ret << setprecision(5);
114 for (
auto const& i:
units())
115 if (i.first != 1 && b >= i.first)
117 ret << (double(b / (i.first / 1000)) / 1000.0) <<
" " << i.second;
124 static void badBlockInfo(
BlockHeader const& _bi,
string const& _err)
128 string const c_space = c_border + string(76,
' ') + c_border +
EthReset;
130 ss << c_line <<
"\n";
131 ss << c_space <<
"\n";
132 ss << c_border +
" Import Failure " + _err + string(max<int>(0, 53 - _err.size()),
' ') +
" " + c_border <<
"\n";
133 ss << c_space <<
"\n";
135 ss << c_border + (
" Bad Block #" + string(max<int>(0, 8 - bin.size()),
'0') + bin +
"." + _bi.
hash().
abridged() +
" ") + c_border <<
"\n";
136 ss << c_space <<
"\n";
138 cwarn <<
"\n" + ss.str();
145 badBlockInfo(bi, _err);
148 string TransactionSkeleton::userReadable(
bool _toProxy,
function<pair<bool, string>(
TransactionSkeleton const&)>
const& _getNatSpec,
function<
string(
Address const&)>
const& _formatAddress)
const
153 return string(
"ÐApp is attempting to create a contract; ") + (_toProxy ?
"(this transaction is not executed directly, but forwarded to another ÐApp) " :
"") +
"to be endowed with " +
formatBalance(value) +
", with additional network fees of up to " +
formatBalance(gas * gasPrice) +
".\n\nMaximum total cost is " +
formatBalance(value + gas * gasPrice) +
".";
158 tie(isContract, natSpec) = _getNatSpec(*
this);
162 return "ÐApp is attempting to send " +
formatBalance(value) +
" to a recipient " + _formatAddress(to) + (_toProxy ?
" (this transaction is not executed directly, but forwarded to another ÐApp)" :
"") +
", with additional network fees of up to " +
formatBalance(gas * gasPrice) +
".\n\nMaximum total cost is " +
formatBalance(value + gas * gasPrice) +
".";
166 return "ÐApp is attempting to call into an unknown contract at address " +
167 _formatAddress(to) +
".\n\n" +
168 (_toProxy ?
"This transaction is not executed directly, but forwarded to another ÐApp.\n\n" :
"") +
169 "Call involves sending " +
170 formatBalance(value) +
" to the recipient, with additional network fees of up to " +
172 "However, this also does other stuff which we don't understand, and does so in your name.\n\n" +
173 "WARNING: This is probably going to cost you at least " +
175 ", however this doesn't include any side-effects, which could be of far greater importance.\n\n" +
176 "REJECT UNLESS YOU REALLY KNOW WHAT YOU ARE DOING!";
178 return "ÐApp attempting to conduct contract interaction with " +
180 ": <b>" + natSpec +
"</b>.\n\n" +
181 (_toProxy ?
"This transaction is not executed directly, but forwarded to another ÐApp.\n\n" :
"") +
183 "In addition, ÐApp is attempting to send " +
184 formatBalance(value) +
" to said recipient, with additional network fees of up to " +
188 "Additional network fees are at most" +
std::string formatBalance(bigint const &_b)
User-friendly string representation of the amount _b in wei.
const unsigned c_databaseVersion
Current database version.
const unsigned c_protocolVersion
Current protocol version.
const unsigned c_databaseVersionModifier
void badBlock(bytesConstRef _block, string const &_err)
std::string toString(std::chrono::time_point< T > const &_e, std::string const &_format="%F %T")
Address toAddress(std::string const &_s)
Convert the given string into an address.
vector< pair< u256, string > > const & units()
Get information concerning the currency denominations.
std::vector< byte > bytes
std::string abridged() const
const Address c_blockhashContractAddress(0xf0)
Address of the special contract for block hash storage defined in EIP96.
const unsigned c_minorProtocolVersion
Current minor protocol version.
boost::multiprecision::number< boost::multiprecision::cpp_int_backend<> > bigint
boost::multiprecision::number< boost::multiprecision::cpp_int_backend< 256, 256, boost::multiprecision::unsigned_magnitude, boost::multiprecision::unchecked, void > > u256
const unsigned c_databaseBaseVersion
#define DEV_IGNORE_EXCEPTIONS(X)
const bytes c_blockhashContractCode(fromHex("0x600073fffffffffffffffffffffffffffffffffffffffe33141561005957600143035b60011561005357600035610100820683015561010081061561004057005b6101008104905061010082019150610022565b506100e0565b4360003512156100d4576000356001814303035b61010081121515610085576000610100830614610088565b60005b156100a75761010083019250610100820491506101008104905061006d565b610100811215156100bd57600060a052602060a0f35b610100820683015460c052602060c0f350506100df565b600060e052602060e0f35b5b50"))
bytes fromHex(std::string const &_s, WhenError _throw=WhenError::DontThrow)