xrpld
Loading...
Searching...
No Matches
xrpl::test::jtx::oracle::Oracle Class Reference

Oracle class facilitates unit-testing of the Price Oracle feature. More...

#include <Oracle.h>

Collaboration diagram for xrpl::test::jtx::oracle::Oracle:

Public Member Functions

 Oracle (Env &env, CreateArg const &arg, bool submit=true)
void remove (RemoveArg const &arg)
void set (CreateArg const &arg)
void set (UpdateArg const &arg)
std::uint32_t documentID () const
bool exists () const
bool expectPrice (DataSeries const &prices) const
bool expectLastUpdateTime (std::uint32_t lastUpdateTime) const
json::Value ledgerEntry (std::optional< std::string > const &index=std::nullopt) const

Static Public Member Functions

static json::Value aggregatePrice (Env &env, std::optional< AnyValue > const &baseAsset, std::optional< AnyValue > const &quoteAsset, std::optional< OraclesData > const &oracles=std::nullopt, std::optional< AnyValue > const &trim=std::nullopt, std::optional< AnyValue > const &timeThreshold=std::nullopt)
static bool exists (Env &env, AccountID const &account, std::uint32_t documentID)
static json::Value ledgerEntry (Env &env, std::optional< std::variant< AccountID, std::string > > const &account, std::optional< AnyValue > const &documentID, std::optional< std::string > const &index=std::nullopt)
static void setFee (std::uint32_t f)

Private Member Functions

void submit (json::Value const &jv, std::optional< jtx::Msig > const &msig, std::optional< jtx::Seq > const &seq, std::optional< Ter > const &err)

Private Attributes

Envenv_
AccountID owner_
std::uint32_t documentID_ {}

Static Private Attributes

static std::uint32_t fee = 0

Friends

std::ostreamoperator<< (std::ostream &strm, Oracle const &oracle)

Detailed Description

Oracle class facilitates unit-testing of the Price Oracle feature.

It defines functions to create, update, and delete the Oracle object, to query for various states, and to call APIs.

Definition at line 92 of file src/test/jtx/Oracle.h.

Constructor & Destructor Documentation

◆ Oracle()

xrpl::test::jtx::oracle::Oracle::Oracle ( Env & env,
CreateArg const & arg,
bool submit = true )

Definition at line 33 of file Oracle.cpp.

Member Function Documentation

◆ submit()

void xrpl::test::jtx::oracle::Oracle::submit ( json::Value const & jv,
std::optional< jtx::Msig > const & msig,
std::optional< jtx::Seq > const & seq,
std::optional< Ter > const & err )
private

Definition at line 76 of file Oracle.cpp.

◆ remove()

void xrpl::test::jtx::oracle::Oracle::remove ( RemoveArg const & arg)

Definition at line 52 of file Oracle.cpp.

◆ set() [1/2]

void xrpl::test::jtx::oracle::Oracle::set ( CreateArg const & arg)

Definition at line 302 of file Oracle.cpp.

◆ set() [2/2]

void xrpl::test::jtx::oracle::Oracle::set ( UpdateArg const & arg)

Definition at line 212 of file Oracle.cpp.

◆ aggregatePrice()

json::Value xrpl::test::jtx::oracle::Oracle::aggregatePrice ( Env & env,
std::optional< AnyValue > const & baseAsset,
std::optional< AnyValue > const & quoteAsset,
std::optional< OraclesData > const & oracles = std::nullopt,
std::optional< AnyValue > const & trim = std::nullopt,
std::optional< AnyValue > const & timeThreshold = std::nullopt )
static

Definition at line 161 of file Oracle.cpp.

◆ documentID()

std::uint32_t xrpl::test::jtx::oracle::Oracle::documentID ( ) const
nodiscard

Definition at line 130 of file src/test/jtx/Oracle.h.

◆ exists() [1/2]

bool xrpl::test::jtx::oracle::Oracle::exists ( ) const
nodiscard

Definition at line 136 of file src/test/jtx/Oracle.h.

◆ exists() [2/2]

bool xrpl::test::jtx::oracle::Oracle::exists ( Env & env,
AccountID const & account,
std::uint32_t documentID )
staticnodiscard

Definition at line 121 of file Oracle.cpp.

◆ expectPrice()

bool xrpl::test::jtx::oracle::Oracle::expectPrice ( DataSeries const & prices) const
nodiscard

Definition at line 128 of file Oracle.cpp.

◆ expectLastUpdateTime()

bool xrpl::test::jtx::oracle::Oracle::expectLastUpdateTime ( std::uint32_t lastUpdateTime) const
nodiscard

Definition at line 154 of file Oracle.cpp.

◆ ledgerEntry() [1/2]

json::Value xrpl::test::jtx::oracle::Oracle::ledgerEntry ( Env & env,
std::optional< std::variant< AccountID, std::string > > const & account,
std::optional< AnyValue > const & documentID,
std::optional< std::string > const & index = std::nullopt )
static

Definition at line 320 of file Oracle.cpp.

◆ ledgerEntry() [2/2]

json::Value xrpl::test::jtx::oracle::Oracle::ledgerEntry ( std::optional< std::string > const & index = std::nullopt) const
nodiscard

Definition at line 158 of file src/test/jtx/Oracle.h.

◆ setFee()

void xrpl::test::jtx::oracle::Oracle::setFee ( std::uint32_t f)
static

Definition at line 164 of file src/test/jtx/Oracle.h.

◆ operator<<

std::ostream & operator<< ( std::ostream & strm,
Oracle const & oracle )
friend

Definition at line 169 of file src/test/jtx/Oracle.h.

Member Data Documentation

◆ fee

std::uint32_t xrpl::test::jtx::oracle::Oracle::fee = 0
staticprivate

Definition at line 96 of file src/test/jtx/Oracle.h.

◆ env_

Env& xrpl::test::jtx::oracle::Oracle::env_
private

Definition at line 97 of file src/test/jtx/Oracle.h.

◆ owner_

AccountID xrpl::test::jtx::oracle::Oracle::owner_
private

Definition at line 98 of file src/test/jtx/Oracle.h.

◆ documentID_

std::uint32_t xrpl::test::jtx::oracle::Oracle::documentID_ {}
private

Definition at line 99 of file src/test/jtx/Oracle.h.