commenced removal of pricing_record touchpoints for MVP release

This commit is contained in:
Some Random Crypto Guy
2024-05-07 14:34:19 +01:00
parent 7bafd2866c
commit 34b2f9b315
59 changed files with 400 additions and 443 deletions
+13 -13
View File
@@ -31,7 +31,7 @@
namespace oracle {
const std::vector<std::string> ASSET_TYPES = {"FULM", "FUSD", "BURN"};
const std::vector<std::string> ASSET_TYPES = {"SAL", "VSD", "BURN"};
class asset_type_counts
{
@@ -39,23 +39,23 @@ namespace oracle {
public:
// Fields
uint64_t FULM;
uint64_t FUSD;
uint64_t SAL;
uint64_t VSD;
uint64_t BURN;
asset_type_counts() noexcept
: FULM(0)
, FUSD(0)
: SAL(0)
, VSD(0)
, BURN(0)
{
}
uint64_t operator[](const std::string asset_type) const noexcept
{
if (asset_type == "FULM") {
return FULM;
} else if (asset_type == "FUSD") {
return FUSD;
if (asset_type == "SAL") {
return SAL;
} else if (asset_type == "VSD") {
return VSD;
} else if (asset_type == "BURN") {
return BURN;
}
@@ -65,10 +65,10 @@ namespace oracle {
void add(const std::string asset_type, const uint64_t val)
{
if (asset_type == "FULM") {
FULM += val;
} else if (asset_type == "FUSD") {
FUSD += val;
if (asset_type == "SAL") {
SAL += val;
} else if (asset_type == "VSD") {
VSD += val;
} else if (asset_type == "BURN") {
BURN += val;
}
+8 -8
View File
@@ -54,12 +54,12 @@ namespace oracle
struct supply_data_serialized
{
uint64_t FULM;
uint64_t FUSD;
uint64_t SAL;
uint64_t VSD;
BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE(FULM)
KV_SERIALIZE(FUSD)
KV_SERIALIZE(SAL)
KV_SERIALIZE(VSD)
END_KV_SERIALIZE_MAP()
};
@@ -103,8 +103,8 @@ namespace oracle
if (in._load(src, hparent))
{
// Copy everything into the local instance
fulm = in.FULM;
fusd = in.FUSD;
sal = in.SAL;
vsd = in.VSD;
return true;
}
// Report error here?
@@ -113,7 +113,7 @@ namespace oracle
bool supply_data::store(epee::serialization::portable_storage& dest, epee::serialization::section* hparent) const
{
const supply_data_serialized out{fulm, fusd};
const supply_data_serialized out{sal, vsd};
return out.store(dest, hparent);
}
@@ -241,7 +241,7 @@ namespace oracle
std::ostringstream oss;
oss << "{\"pr_version\":" << pr_version;
oss << ",\"height\":" << height;
oss << ",\"supply\":{\"FULM\":" << supply.fulm <<",\"FUSD\":" << supply.fusd << "}";
oss << ",\"supply\":{\"SAL\":" << supply.sal <<",\"VSD\":" << supply.vsd << "}";
oss << ",\"assets\":[";
bool first = true;
for (const auto& asset: assets) {
+6 -6
View File
@@ -67,8 +67,8 @@ namespace oracle
#pragma pack(pop)
struct supply_data {
uint64_t fulm;
uint64_t fusd;
uint64_t sal;
uint64_t vsd;
//! Load from epee p2p format
bool _load(epee::serialization::portable_storage& src, epee::serialization::section* hparent);
@@ -76,15 +76,15 @@ namespace oracle
bool store(epee::serialization::portable_storage& dest, epee::serialization::section* hparent) const;
BEGIN_SERIALIZE_OBJECT()
VARINT_FIELD(fulm)
VARINT_FIELD(fusd)
VARINT_FIELD(sal)
VARINT_FIELD(vsd)
END_SERIALIZE()
};
inline bool operator==(const supply_data& a, const supply_data& b) noexcept
{
return (a.fulm == b.fulm &&
a.fusd == b.fusd);
return (a.sal == b.sal &&
a.vsd == b.vsd);
}
struct asset_data {