Fabcoin Core  0.16.2
P2P Digital Currency
ChainOperationParams.h
Go to the documentation of this file.
1 /*
2  This file is part of cpp-ethereum.
3 
4  cpp-ethereum is free software: you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation, either version 3 of the License, or
7  (at your option) any later version.
8 
9  cpp-ethereum is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>.
16 */
22 #pragma once
23 
24 #include <libdevcore/Common.h>
25 #include "Common.h"
26 #include <libethcore/Precompiled.h>
27 
28 #include <libevmcore/EVMSchedule.h>
29 
30 namespace dev
31 {
32 namespace eth
33 {
34 
36 {
37 public:
38  PrecompiledContract() = default;
40  std::function<bigint(size_t)> const& _cost,
41  PrecompiledExecutor const& _exec,
42  u256 const& _startingBlock = 0
43  ):
44  m_cost(_cost),
45  m_execute(_exec),
46  m_startingBlock(_startingBlock)
47  {}
49  unsigned _base,
50  unsigned _word,
51  PrecompiledExecutor const& _exec,
52  u256 const& _startingBlock = 0
53  );
54 
55  bigint cost(bytesConstRef _in) const { return m_cost(_in.size()); }
56  std::pair<bool, bytes> execute(bytesConstRef _in) const { return m_execute(_in); }
57 
58  u256 const& startingBlock() const { return m_startingBlock; }
59 
60 private:
61  std::function<bigint(size_t)> m_cost;
64 };
65 
67 {
69 
70  explicit operator bool() const { return accountStartNonce != Invalid256; }
71 
73  std::string sealEngineName = "NoProof";
74 
76  u256 blockReward = 0;
77  u256 maximumExtraDataSize = 1024;
78  u256 accountStartNonce = 0;
79  bool tieBreakingGas = true;
80 
82  std::unordered_map<Address, PrecompiledContract> precompiled;
83 
95  std::unordered_map<std::string, std::string> otherParams;
96 
98  u256 u256Param(std::string const& _name) const;
99 };
100 
101 }
102 }
std::function< bigint(size_t)> m_cost
Adapted from code found on http://stackoverflow.com/questions/180947/base64-decode-snippet-in-c Origi...
Definition: Arith256.cpp:15
#define function(a, b, c, d, k, s)
std::pair< bool, bytes > execute(bytesConstRef _in) const
boost::multiprecision::number< boost::multiprecision::cpp_int_backend<>> bigint
Definition: Common.h:121
std::unordered_map< std::string, std::string > otherParams
Additional parameters.
PrecompiledContract(std::function< bigint(size_t)> const &_cost, PrecompiledExecutor const &_exec, u256 const &_startingBlock=0)
std::function< std::pair< bool, bytes >(bytesConstRef _in)> PrecompiledExecutor
Definition: Precompiled.h:34
std::unordered_map< Address, PrecompiledContract > precompiled
Precompiled contracts as specified in the chain params.
const u256 Invalid256
Definition: Common.cpp:38
boost::multiprecision::number< boost::multiprecision::cpp_int_backend< 256, 256, boost::multiprecision::unsigned_magnitude, boost::multiprecision::unchecked, void >> u256
Definition: Common.h:125
size_t size() const
Definition: vector_ref.h:55
u256 const & startingBlock() const
bigint cost(bytesConstRef _in) const