Compare commits

...

11 Commits

Author SHA1 Message Date
MoneroOcean 084ea7fd77 Added SAL support 2024-07-20 01:24:23 +03:00
MoneroOcean e7a1430242 Added SAL support 2024-07-19 21:44:05 +03:00
MoneroOcean a138d12221 Added SAL support 2024-07-19 21:06:11 +03:00
MoneroOcean dd63cb209d Added SAL support 2024-07-19 21:01:48 +03:00
MoneroOcean 161ec204e6 Added SAL support 2024-07-19 20:50:23 +03:00
MoneroOcean 2104ac35d5 Added SAL support 2024-07-19 20:40:05 +03:00
MoneroOcean 30a1cf7813 Added SAL support 2024-07-19 20:29:42 +03:00
MoneroOcean 32dfbcf8ea Added SAL support 2024-07-19 19:38:52 +03:00
MoneroOcean b8d2ba017e Added SAL support 2024-07-19 19:31:43 +03:00
MoneroOcean b18445f6e7 Added SAL support 2024-07-19 19:31:10 +03:00
MoneroOcean bea129bb73 Added SAL support 2024-07-19 10:14:23 +03:00
7 changed files with 504 additions and 11 deletions
+1
View File
@@ -7,6 +7,7 @@
"src/cryptonote_core/cryptonote_format_utils.cpp",
"src/offshore/pricing_record.cpp",
"src/zephyr_oracle/pricing_record.cpp",
"src/salvium_oracle/pricing_record.cpp",
"src/crypto/tree-hash.c",
"src/crypto/crypto.cpp",
"src/crypto/crypto-ops.c",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "cryptoforknote-util",
"version": "15.5.0",
"version": "15.5.10",
"author": {
"name": "LucasJones",
"email": "lucasjonesdev@hotmail.co.uk"
+16 -6
View File
@@ -28,6 +28,7 @@
#include "cryptonote_protocol/blobdatatype.h"
#include "offshore/pricing_record.h"
#include "zephyr_oracle/pricing_record.h"
#include "salvium_oracle/pricing_record.h"
namespace cryptonote
@@ -727,15 +728,15 @@ namespace cryptonote
} else if (blob_type == BLOB_TYPE_CRYPTONOTE_SALVIUM) {
VARINT_FIELD(version)
if(version == 0 || CURRENT_TRANSACTION_VERSION < version) return false;
//if(version == 0 || CURRENT_TRANSACTION_VERSION < version) return false;
VARINT_FIELD(unlock_time)
FIELD(vin_salvium)
FIELD(vout_salvium)
FIELD(extra)
VARINT_FIELD(tx_type)
if (type != cryptonote::salvium_transaction_type::PROTOCOL) {
if (tx_type != cryptonote::salvium_transaction_type::PROTOCOL) {
VARINT_FIELD(amount_burnt)
if (type != cryptonote::salvium_transaction_type::MINER) {
if (tx_type != cryptonote::salvium_transaction_type::MINER) {
FIELD(return_address)
FIELD(return_pubkey)
FIELD(source_asset_type)
@@ -836,7 +837,7 @@ namespace cryptonote
else
{
ar.tag("rct_signatures");
if (blob_type == BLOB_TYPE_CRYPTONOTE_ZEPHYR ? !vin_zephyr.empty() : !vin.empty())
if (blob_type == BLOB_TYPE_CRYPTONOTE_SALVIUM ? !vin_salvium.empty() : (blob_type == BLOB_TYPE_CRYPTONOTE_ZEPHYR ? !vin_zephyr.empty() : !vin.empty()))
{
ar.begin_object();
bool r;
@@ -844,6 +845,8 @@ namespace cryptonote
r = rct_signatures.serialize_rctsig_base(ar, vin.size(), vout_xhv.size());
else if (blob_type == BLOB_TYPE_CRYPTONOTE_ZEPHYR)
r = rct_signatures.serialize_rctsig_base(ar, vin_zephyr.size(), vout_zephyr.size());
else if (blob_type == BLOB_TYPE_CRYPTONOTE_SALVIUM)
r = rct_signatures.serialize_rctsig_base(ar, vin_salvium.size(), vout_salvium.size());
else
r = rct_signatures.serialize_rctsig_base(ar, vin.size(), vout.size());
if (!r || !ar.stream().good()) return false;
@@ -855,6 +858,9 @@ namespace cryptonote
if (blob_type == BLOB_TYPE_CRYPTONOTE_ZEPHYR) {
r = rct_signatures.p.serialize_rctsig_prunable(ar, rct_signatures.type, vin_zephyr.size(), vout_zephyr.size(),
vin_zephyr[0].type() == typeid(txin_zephyr_key) ? boost::get<txin_zephyr_key>(vin_zephyr[0]).key_offsets.size() - 1 : 0);
} else if (blob_type == BLOB_TYPE_CRYPTONOTE_SALVIUM) {
r = rct_signatures.p.serialize_rctsig_prunable(ar, rct_signatures.type, vin_salvium.size(), vout_salvium.size(),
vin_salvium[0].type() == typeid(txin_salvium_key) ? boost::get<txin_salvium_key>(vin_salvium[0]).key_offsets.size() - 1 : 0);
} else if (blob_type == BLOB_TYPE_CRYPTONOTE_XHV) {
r = rct_signatures.p.serialize_rctsig_prunable(ar, rct_signatures.type, vin.size(), vout_xhv.size(),
vin.size() > 0 && vin[0].type() == typeid(txin_to_key) ? boost::get<txin_to_key>(vin[0]).key_offsets.size() - 1 :
@@ -1046,6 +1052,7 @@ namespace cryptonote
uint64_t nonce8;
offshore::pricing_record pricing_record;
zephyr_oracle::pricing_record zephyr_pricing_record;
salvium_oracle::pricing_record salvium_pricing_record;
crypto::cycle cycle;
crypto::cycle40 cycle40;
crypto::cycle48 cycle48;
@@ -1070,8 +1077,11 @@ namespace cryptonote
if (blob_type == BLOB_TYPE_CRYPTONOTE_XTNC || blob_type == BLOB_TYPE_CRYPTONOTE_CUCKOO) FIELD(cycle)
if (blob_type == BLOB_TYPE_CRYPTONOTE_TUBE) FIELD(cycle40)
if (blob_type == BLOB_TYPE_CRYPTONOTE_XTA) FIELD(cycle48)
if (blob_type == BLOB_TYPE_CRYPTONOTE_XHV) FIELD(pricing_record)
if (blob_type == BLOB_TYPE_CRYPTONOTE_ZEPHYR) {
if (blob_type == BLOB_TYPE_CRYPTONOTE_XHV) {
FIELD(pricing_record)
} else if (blob_type == BLOB_TYPE_CRYPTONOTE_SALVIUM) {
FIELD(salvium_pricing_record)
} else if (blob_type == BLOB_TYPE_CRYPTONOTE_ZEPHYR) {
if (major_version >= 4)
{
FIELD_N("pricing_record", zephyr_pricing_record)
@@ -220,8 +220,8 @@ namespace cryptonote
{
std::stringstream ss;
binary_archive<true> ba(ss);
const size_t inputs = t.blob_type == BLOB_TYPE_CRYPTONOTE_SALVIUM ? t.vin_salvium.size() : BLOB_TYPE_CRYPTONOTE_ZEPHYR ? t.vin_zephyr.size() : t.vin.size();
const size_t outputs = t.blob_type == BLOB_TYPE_CRYPTONOTE_SALVIUM ? t.vout_salvium.size() : t.blob_type == BLOB_TYPE_CRYPTONOTE_ZEPHYR ? t.vout_zephyr.size() : t.blob_type != BLOB_TYPE_CRYPTONOTE_XHV ? t.vout.size() : t.vout_xhv.size();
const size_t inputs = t.blob_type == BLOB_TYPE_CRYPTONOTE_SALVIUM ? t.vin_salvium.size() : (t.blob_type == BLOB_TYPE_CRYPTONOTE_ZEPHYR ? t.vin_zephyr.size() : t.vin.size());
const size_t outputs = t.blob_type == BLOB_TYPE_CRYPTONOTE_SALVIUM ? t.vout_salvium.size() : (t.blob_type == BLOB_TYPE_CRYPTONOTE_ZEPHYR ? t.vout_zephyr.size() : (t.blob_type != BLOB_TYPE_CRYPTONOTE_XHV ? t.vout.size() : t.vout_xhv.size()));
bool r = tt.rct_signatures.serialize_rctsig_base(ba, inputs, outputs);
CHECK_AND_ASSERT_MES(r, false, "Failed to serialize rct signatures base");
cryptonote::get_blob_hash(ss.str(), hashes[1]);
@@ -236,8 +236,8 @@ namespace cryptonote
{
std::stringstream ss;
binary_archive<true> ba(ss);
const size_t inputs = t.blob_type == BLOB_TYPE_CRYPTONOTE_SALVIUM ? t.vin_salvium.size() : BLOB_TYPE_CRYPTONOTE_ZEPHYR ? t.vin_zephyr.size() : t.vin.size();
const size_t outputs = t.blob_type == BLOB_TYPE_CRYPTONOTE_SALVIUM ? t.vout_salvium.size() : t.blob_type == BLOB_TYPE_CRYPTONOTE_ZEPHYR ? t.vout_zephyr.size() : t.blob_type != BLOB_TYPE_CRYPTONOTE_XHV ? t.vout.size() : t.vout_xhv.size();
const size_t inputs = t.blob_type == BLOB_TYPE_CRYPTONOTE_SALVIUM ? t.vin_salvium.size() : (t.blob_type == BLOB_TYPE_CRYPTONOTE_ZEPHYR ? t.vin_zephyr.size() : t.vin.size());
const size_t outputs = t.blob_type == BLOB_TYPE_CRYPTONOTE_SALVIUM ? t.vout_salvium.size() : (t.blob_type == BLOB_TYPE_CRYPTONOTE_ZEPHYR ? t.vout_zephyr.size() : (t.blob_type != BLOB_TYPE_CRYPTONOTE_XHV ? t.vout.size() : t.vout_xhv.size()));
size_t mixin;
if (t.blob_type == BLOB_TYPE_CRYPTONOTE_SALVIUM) {
mixin = t.vin_salvium.empty() ? 0 : t.vin_salvium[0].type() == typeid(txin_salvium_key) ? boost::get<txin_salvium_key>(t.vin_salvium[0]).key_offsets.size() - 1 : 0;
+77
View File
@@ -0,0 +1,77 @@
// Copyright (c) 2021, Haven Protocol
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are
// permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this list of
// conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
// of conditions and the following disclaimer in the documentation and/or other
// materials provided with the distribution.
//
// 3. Neither the name of the copyright holder nor the names of its contributors may be
// used to endorse or promote products derived from this software without specific
// prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#pragma once
#include <string>
#include <vector>
namespace salvium_oracle {
const std::vector<std::string> ASSET_TYPES = {"SAL", "VSD", "BURN"};
class asset_type_counts
{
public:
// Fields
uint64_t SAL;
uint64_t VSD;
uint64_t BURN;
asset_type_counts() noexcept
: SAL(0)
, VSD(0)
, BURN(0)
{
}
uint64_t operator[](const std::string asset_type) const noexcept
{
if (asset_type == "SAL") {
return SAL;
} else if (asset_type == "VSD") {
return VSD;
} else if (asset_type == "BURN") {
return BURN;
}
return 0;
}
void add(const std::string asset_type, const uint64_t val)
{
if (asset_type == "SAL") {
SAL += val;
} else if (asset_type == "VSD") {
VSD += val;
} else if (asset_type == "BURN") {
BURN += val;
}
}
};
}
+246
View File
@@ -0,0 +1,246 @@
// Copyright (c) 2019, Haven Protocol
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are
// permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this list of
// conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
// of conditions and the following disclaimer in the documentation and/or other
// materials provided with the distribution.
//
// 3. Neither the name of the copyright holder nor the names of its contributors may be
// used to endorse or promote products derived from this software without specific
// prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Portions of this code based upon code Copyright (c) 2019, The Monero Project
#include <boost/multiprecision/cpp_int.hpp>
#include "pricing_record.h"
#include "serialization/keyvalue_serialization.h"
#include "storages/portable_storage.h"
#include "string_tools.h"
namespace salvium_oracle
{
namespace
{
struct asset_data_serialized
{
std::string asset_type;
uint64_t spot_price;
uint64_t ma_price;
BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE(asset_type)
KV_SERIALIZE(spot_price)
KV_SERIALIZE(ma_price)
END_KV_SERIALIZE_MAP()
};
struct supply_data_serialized
{
uint64_t SAL;
uint64_t VSD;
BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE(SAL)
KV_SERIALIZE(VSD)
END_KV_SERIALIZE_MAP()
};
struct pr_serialized
{
uint64_t pr_version;
uint64_t height;
supply_data supply;
std::vector<asset_data> assets;
uint64_t timestamp;
std::string signature;
BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE(pr_version)
KV_SERIALIZE(height)
KV_SERIALIZE(supply)
KV_SERIALIZE(assets)
KV_SERIALIZE(timestamp)
KV_SERIALIZE(signature)
END_KV_SERIALIZE_MAP()
};
}
pricing_record::pricing_record() noexcept
: pr_version(0)
, height(0)
, supply()
, assets()
, timestamp(0)
, signature()
{
}
pricing_record::~pricing_record() noexcept
{
}
bool supply_data::_load(epee::serialization::portable_storage& src, epee::serialization::section* hparent)
{
supply_data_serialized in{};
if (in._load(src, hparent))
{
// Copy everything into the local instance
sal = in.SAL;
vsd = in.VSD;
return true;
}
// Report error here?
return false;
}
bool supply_data::store(epee::serialization::portable_storage& dest, epee::serialization::section* hparent) const
{
const supply_data_serialized out{sal, vsd};
return out.store(dest, hparent);
}
bool asset_data::_load(epee::serialization::portable_storage& src, epee::serialization::section* hparent)
{
asset_data_serialized in{};
if (in._load(src, hparent))
{
// Copy everything into the local instance
asset_type = in.asset_type;
spot_price = in.spot_price;
ma_price = in.ma_price;
return true;
}
// Report error here?
return false;
}
bool asset_data::store(epee::serialization::portable_storage& dest, epee::serialization::section* hparent) const
{
const asset_data_serialized out{asset_type, spot_price, ma_price};
return out.store(dest, hparent);
}
bool pricing_record::_load(epee::serialization::portable_storage& src, epee::serialization::section* hparent)
{
pr_serialized in{};
if (in._load(src, hparent))
{
// Copy everything into the local instance
pr_version = in.pr_version;
height = in.height;
supply = in.supply;
assets = in.assets;
timestamp = in.timestamp;
// Signature arrives in HEX format, but needs to be used in BINARY format - convert it here
signature.resize(0);
assert(in.signature.size()%2 == 0);
signature.reserve(in.signature.size() >> 1);
for (unsigned int i = 0; i < in.signature.size(); i += 2) {
std::string byteString = in.signature.substr(i, 2);
signature.emplace_back((uint8_t)strtol(byteString.c_str(), NULL, 16));
}
return true;
}
// Report error here?
return false;
}
bool pricing_record::store(epee::serialization::portable_storage& dest, epee::serialization::section* hparent) const
{
std::string sig_hex;
for (size_t i=0; i<signature.size(); ++i) {
std::stringstream ss;
ss << std::hex << std::setw(2) << std::setfill('0') << (0xff & signature.at(i));
sig_hex += ss.str();
}
const pr_serialized out{pr_version, height, supply, assets, timestamp, sig_hex};
return out.store(dest, hparent);
}
pricing_record::pricing_record(const pricing_record& orig) noexcept
: pr_version(orig.pr_version)
, height(orig.height)
, supply(orig.supply)
, assets(orig.assets)
, timestamp(orig.timestamp)
, signature(orig.signature)
{
}
pricing_record& pricing_record::operator=(const pricing_record& orig) noexcept
{
pr_version = orig.pr_version;
height = orig.height;
supply = orig.supply;
assets = orig.assets;
timestamp = orig.timestamp;
signature = orig.signature;
return *this;
}
uint64_t pricing_record::operator[](const std::string& asset_type) const
{
for (const auto& asset: assets) {
if (asset.asset_type != asset_type) continue;
return asset.spot_price;
}
return 0;
}
bool pricing_record::equal(const pricing_record& other) const noexcept
{
return ((pr_version == other.pr_version) &&
(height == other.height) &&
(supply == other.supply) &&
(assets == other.assets) &&
(timestamp == other.timestamp) &&
(signature == other.signature));
}
bool pricing_record::empty() const noexcept
{
const pricing_record empty_pr = salvium_oracle::pricing_record();
return (*this).equal(empty_pr);
}
// overload for pr validation for block
bool pricing_record::valid(uint32_t hf_version, uint64_t bl_timestamp, uint64_t last_bl_timestamp) const
{
if (this->empty())
return true;
// validate the timestmap
if (this->timestamp > bl_timestamp + PRICING_RECORD_VALID_TIME_DIFF_FROM_BLOCK) {
LOG_ERROR("Pricing record timestamp is too far in the future.");
return false;
}
if (this->timestamp <= last_bl_timestamp) {
LOG_ERROR("Pricing record timestamp: " << this->timestamp << ", block timestamp: " << bl_timestamp);
LOG_ERROR("Pricing record timestamp is too old.");
return false;
}
return true;
}
}
+159
View File
@@ -0,0 +1,159 @@
// Copyright (c) 2019, Haven Protocol
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are
// permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this list of
// conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
// of conditions and the following disclaimer in the documentation and/or other
// materials provided with the distribution.
//
// 3. Neither the name of the copyright holder nor the names of its contributors may be
// used to endorse or promote products derived from this software without specific
// prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Portions of this code based upon code Copyright (c) 2019, The Monero Project
#pragma once
#include "common/pod-class.h"
#include <openssl/bio.h>
#include <openssl/crypto.h>
#include <openssl/ecdsa.h>
#include <openssl/err.h>
#include <openssl/evp.h>
#include <openssl/pem.h>
#include <openssl/rsa.h>
#include <openssl/ssl.h>
#include <cstdint>
#include <string>
#include <cstring>
#include "serialization/vector.h"
#include "cryptonote_config.h"
#include "crypto/hash.h"
namespace epee
{
namespace serialization
{
class portable_storage;
struct section;
}
}
namespace salvium_oracle
{
#pragma pack(push, 1)
POD_CLASS pricing_record_pre {
uint64_t pr_version;
uint64_t price;
uint64_t timestamp;
};
#pragma pack(pop)
struct supply_data {
uint64_t sal;
uint64_t vsd;
//! Load from epee p2p format
bool _load(epee::serialization::portable_storage& src, epee::serialization::section* hparent);
//! Store in epee p2p format
bool store(epee::serialization::portable_storage& dest, epee::serialization::section* hparent) const;
BEGIN_SERIALIZE_OBJECT()
VARINT_FIELD(sal)
VARINT_FIELD(vsd)
END_SERIALIZE()
};
inline bool operator==(const supply_data& a, const supply_data& b) noexcept
{
return (a.sal == b.sal &&
a.vsd == b.vsd);
}
struct asset_data {
std::string asset_type;
uint64_t spot_price;
uint64_t ma_price;
//! Load from epee p2p format
bool _load(epee::serialization::portable_storage& src, epee::serialization::section* hparent);
//! Store in epee p2p format
bool store(epee::serialization::portable_storage& dest, epee::serialization::section* hparent) const;
BEGIN_SERIALIZE_OBJECT()
FIELD(asset_type)
VARINT_FIELD(spot_price)
VARINT_FIELD(ma_price)
END_SERIALIZE()
};
inline bool operator==(const asset_data& a, const asset_data& b) noexcept
{
return (a.asset_type == b.asset_type &&
a.spot_price == b.spot_price &&
a.ma_price == b.ma_price);
}
struct pricing_record
{
// Fields
uint64_t pr_version;
uint64_t height;
supply_data supply;
std::vector<asset_data> assets;
uint64_t timestamp;
std::vector<uint8_t> signature;
// Default c'tor
pricing_record() noexcept;
//! Load from epee p2p format
bool _load(epee::serialization::portable_storage& src, epee::serialization::section* hparent);
//! Store in epee p2p format
bool store(epee::serialization::portable_storage& dest, epee::serialization::section* hparent) const;
pricing_record(const pricing_record& orig) noexcept;
~pricing_record() noexcept;
bool equal(const pricing_record& other) const noexcept;
bool empty() const noexcept;
bool valid(uint32_t hf_version, uint64_t bl_timestamp, uint64_t last_bl_timestamp) const;
pricing_record& operator=(const pricing_record& orig) noexcept;
uint64_t operator[](const std::string& asset_type) const;
BEGIN_SERIALIZE_OBJECT()
VARINT_FIELD(pr_version)
VARINT_FIELD(height)
FIELD(supply)
FIELD(assets)
VARINT_FIELD(timestamp)
FIELD(signature)
END_SERIALIZE()
};
inline bool operator==(const pricing_record& a, const pricing_record& b) noexcept
{
return a.equal(b);
}
inline bool operator!=(const pricing_record& a, const pricing_record& b) noexcept
{
return !a.equal(b);
}
} // salvium_oracle