Fabcoin Core  0.16.2
P2P Digital Currency
fasctransaction.h
Go to the documentation of this file.
1 #ifndef FASCTRANSACTION_H
2 #define FASCTRANSACTION_H
3 
5 
6 struct VersionVM {
7  //this should be portable, see https://stackoverflow.com/questions/31726191/is-there-a-portable-alternative-to-c-bitfields
8 # if __BYTE_ORDER == __LITTLE_ENDIAN
9  uint8_t format : 2;
10  uint8_t rootVM : 6;
11 #elif __BYTE_ORDER == __BIG_ENDIAN
12  uint8_t rootVM : 6;
13  uint8_t format : 2;
14 #endif
15  uint8_t vmVersion;
16  uint16_t flagOptions;
17  // CONSENSUS CRITICAL!
18  // Do not add any other fields to this struct
19 
20  uint32_t toRaw() {
21  return *(uint32_t*)this;
22  }
23  static VersionVM fromRaw(uint32_t val) {
24  VersionVM x = *(VersionVM*)&val;
25  return x;
26  }
27  static VersionVM GetNoExec() {
28  VersionVM x;
29  x.flagOptions=0;
30  x.rootVM=0;
31  x.format=0;
32  x.vmVersion=0;
33  return x;
34  }
36  VersionVM x;
37  x.flagOptions=0;
38  x.rootVM=1;
39  x.format=0;
40  x.vmVersion=0;
41  return x;
42  }
43 } __attribute__((__packed__));
44 
46 
47 public:
48 
49  FascTransaction() : nVout(0) {}
50 
51  FascTransaction(dev::u256 const& _value, dev::u256 const& _gasPrice, dev::u256 const& _gas, dev::bytes const& _data, dev::u256 const& _nonce = dev::Invalid256):
52  dev::eth::Transaction(_value, _gasPrice, _gas, _data, _nonce) {}
53 
54  FascTransaction(dev::u256 const& _value, dev::u256 const& _gasPrice, dev::u256 const& _gas, dev::Address const& _dest, dev::bytes const& _data, dev::u256 const& _nonce = dev::Invalid256):
55  dev::eth::Transaction(_value, _gasPrice, _gas, _dest, _data, _nonce) {}
56 
57  void setHashWith(const dev::h256 hash) {
58  m_hashWith = hash;
59  }
60 
62  return m_hashWith;
63  }
64 
65  void setNVout(uint32_t vout) {
66  nVout = vout;
67  }
68 
69  uint32_t getNVout() const {
70  return nVout;
71  }
72 
74  version=v;
75  }
77  return version;
78  }
79 private:
80 
81  uint32_t nVout;
83 
84 };
85 #endif
Adapted from code found on http://stackoverflow.com/questions/180947/base64-decode-snippet-in-c Origi...
Definition: Arith256.cpp:15
static VersionVM GetNoExec()
uint8_t rootVM
static VersionVM GetEVMDefault()
uint8_t format
FascTransaction(dev::u256 const &_value, dev::u256 const &_gasPrice, dev::u256 const &_gas, dev::Address const &_dest, dev::bytes const &_data, dev::u256 const &_nonce=dev::Invalid256)
FascTransaction(dev::u256 const &_value, dev::u256 const &_gasPrice, dev::u256 const &_gas, dev::bytes const &_data, dev::u256 const &_nonce=dev::Invalid256)
void version()
Definition: main.cpp:53
#define x(i)
uint32_t toRaw()
FascTransaction __attribute__
std::vector< byte > bytes
Definition: Common.h:75
const u256 Invalid256
Definition: Common.cpp:38
Fixed-size raw-byte array container type, with an API optimised for storing hashes.
Definition: FixedHash.h:47
static VersionVM fromRaw(uint32_t val)
boost::multiprecision::number< boost::multiprecision::cpp_int_backend< 256, 256, boost::multiprecision::unsigned_magnitude, boost::multiprecision::unchecked, void >> u256
Definition: Common.h:125
Encodes a transaction, ready to be exported to or freshly imported from RLP.
Definition: Transaction.h:84
void setVersion(VersionVM v)
VersionVM getVersion() const
uint8_t vmVersion
uint16_t flagOptions
void setNVout(uint32_t vout)
dev::h256 getHashWith() const
void setHashWith(const dev::h256 hash)
uint32_t getNVout() const