xrpld
Toggle main menu visibility
Loading...
Searching...
No Matches
test
jtx
vault.h
1
#pragma once
2
3
#include <test/jtx/Account.h>
4
5
#include <xrpl/basics/base_uint.h>
6
#include <xrpl/basics/chrono.h>
7
#include <xrpl/json/json_value.h>
8
#include <xrpl/protocol/Asset.h>
9
#include <xrpl/protocol/Keylet.h>
10
#include <xrpl/protocol/Protocol.h>
11
12
#include <
chrono
>
13
#include <
cstdint
>
14
#include <
optional
>
15
#include <
tuple
>
16
17
namespace
xrpl::test::jtx
{
18
19
class
Env
;
20
21
struct
Vault
22
{
23
Env
&
env
;
24
25
struct
CreateArgs
26
{
27
Account
owner
;
28
Asset
asset
;
29
std::optional<std::uint32_t>
flags
=
30
std::nullopt;
// NOLINT(readability-redundant-member-init)
31
std::optional<std::uint8_t>
vaultKind
=
32
std::nullopt;
// NOLINT(readability-redundant-member-init)
33
std::optional<std::uint32_t>
subscriptionDate
=
34
std::nullopt;
// NOLINT(readability-redundant-member-init)
35
std::optional<std::uint32_t>
redemptionDate
=
36
std::nullopt;
// NOLINT(readability-redundant-member-init)
37
std::optional<VaultVersion>
leVersion
=
38
std::nullopt;
// NOLINT(readability-redundant-member-init)
39
};
40
44
[[nodiscard]]
std::tuple<json::Value, Keylet>
45
create
(
CreateArgs
const
& args)
const
;
46
47
struct
CreateClosedEndedArgs
48
{
49
Account
owner
;
50
Asset
asset
;
51
std::optional<std::uint32_t>
flags
=
52
std::nullopt;
// NOLINT(readability-redundant-member-init)
53
NetClock::duration
subscriptionOffset
=
std::chrono::seconds
{10};
54
NetClock::duration
investmentWindow
=
std::chrono::seconds
{1'000'000};
55
};
56
68
[[nodiscard]]
std::tuple<json::Value, Keylet, NetClock::time_point>
69
createClosedEnded
(CreateClosedEndedArgs
const
& args)
const
;
70
76
void
77
closePastSubscription
(
NetClock::time_point
subscriptionDate)
const
;
78
79
struct
SetArgs
80
{
81
Account
owner
;
82
UInt256
id
;
83
};
84
85
static
json::Value
86
set
(
SetArgs
const
& args);
87
88
struct
DeleteArgs
89
{
90
Account
owner
;
91
UInt256
id
;
92
};
93
94
static
json::Value
95
del
(
DeleteArgs
const
& args);
96
97
struct
DepositArgs
98
{
99
Account
depositor
;
100
UInt256
id
;
101
STAmount
amount
;
102
};
103
104
static
json::Value
105
deposit
(
DepositArgs
const
& args);
106
107
struct
WithdrawArgs
108
{
109
Account
depositor
;
110
UInt256
id
;
111
STAmount
amount
;
112
};
113
114
static
json::Value
115
withdraw
(
WithdrawArgs
const
& args);
116
117
struct
ClawbackArgs
118
{
119
Account
issuer
;
120
UInt256
id
;
121
Account
holder
;
122
std::optional<STAmount>
amount
= std::nullopt;
// NOLINT(readability-redundant-member-init)
123
};
124
125
static
json::Value
126
clawback
(
ClawbackArgs
const
& args);
127
};
128
129
}
// namespace xrpl::test::jtx
chrono
json::Value
Represents a JSON value.
Definition
json_value.h:117
xrpl::Asset
Definition
Asset.h:52
xrpl::NetClock::time_point
std::chrono::time_point< NetClock > time_point
Definition
chrono.h:48
xrpl::NetClock::duration
std::chrono::duration< rep, period > duration
Definition
chrono.h:47
xrpl::STAmount
Definition
STAmount.h:46
xrpl::test::jtx::Account
Immutable cryptographic account descriptor.
Definition
jtx/Account.h:21
xrpl::test::jtx::Env
A transaction testing environment.
Definition
Env.h:161
cstdint
std::chrono::seconds
xrpl::test::jtx
Definition
Oracle_test.cpp:34
xrpl::UInt256
BaseUInt< 256 > UInt256
Definition
base_uint.h:580
optional
xrpl::test::jtx::Vault::ClawbackArgs
Definition
vault.h:118
xrpl::test::jtx::Vault::ClawbackArgs::holder
Account holder
Definition
vault.h:121
xrpl::test::jtx::Vault::ClawbackArgs::issuer
Account issuer
Definition
vault.h:119
xrpl::test::jtx::Vault::ClawbackArgs::amount
std::optional< STAmount > amount
Definition
vault.h:122
xrpl::test::jtx::Vault::ClawbackArgs::id
UInt256 id
Definition
vault.h:120
xrpl::test::jtx::Vault::CreateArgs
Definition
vault.h:26
xrpl::test::jtx::Vault::CreateArgs::owner
Account owner
Definition
vault.h:27
xrpl::test::jtx::Vault::CreateArgs::asset
Asset asset
Definition
vault.h:28
xrpl::test::jtx::Vault::CreateArgs::vaultKind
std::optional< std::uint8_t > vaultKind
Definition
vault.h:31
xrpl::test::jtx::Vault::CreateArgs::subscriptionDate
std::optional< std::uint32_t > subscriptionDate
Definition
vault.h:33
xrpl::test::jtx::Vault::CreateArgs::redemptionDate
std::optional< std::uint32_t > redemptionDate
Definition
vault.h:35
xrpl::test::jtx::Vault::CreateArgs::leVersion
std::optional< VaultVersion > leVersion
Definition
vault.h:37
xrpl::test::jtx::Vault::CreateArgs::flags
std::optional< std::uint32_t > flags
Definition
vault.h:29
xrpl::test::jtx::Vault::CreateClosedEndedArgs
Definition
vault.h:48
xrpl::test::jtx::Vault::CreateClosedEndedArgs::investmentWindow
NetClock::duration investmentWindow
Definition
vault.h:54
xrpl::test::jtx::Vault::CreateClosedEndedArgs::subscriptionOffset
NetClock::duration subscriptionOffset
Definition
vault.h:53
xrpl::test::jtx::Vault::CreateClosedEndedArgs::flags
std::optional< std::uint32_t > flags
Definition
vault.h:51
xrpl::test::jtx::Vault::CreateClosedEndedArgs::asset
Asset asset
Definition
vault.h:50
xrpl::test::jtx::Vault::CreateClosedEndedArgs::owner
Account owner
Definition
vault.h:49
xrpl::test::jtx::Vault::DeleteArgs
Definition
vault.h:89
xrpl::test::jtx::Vault::DeleteArgs::id
UInt256 id
Definition
vault.h:91
xrpl::test::jtx::Vault::DeleteArgs::owner
Account owner
Definition
vault.h:90
xrpl::test::jtx::Vault::DepositArgs
Definition
vault.h:98
xrpl::test::jtx::Vault::DepositArgs::id
UInt256 id
Definition
vault.h:100
xrpl::test::jtx::Vault::DepositArgs::depositor
Account depositor
Definition
vault.h:99
xrpl::test::jtx::Vault::DepositArgs::amount
STAmount amount
Definition
vault.h:101
xrpl::test::jtx::Vault::SetArgs
Definition
vault.h:80
xrpl::test::jtx::Vault::SetArgs::id
UInt256 id
Definition
vault.h:82
xrpl::test::jtx::Vault::SetArgs::owner
Account owner
Definition
vault.h:81
xrpl::test::jtx::Vault::WithdrawArgs
Definition
vault.h:108
xrpl::test::jtx::Vault::WithdrawArgs::id
UInt256 id
Definition
vault.h:110
xrpl::test::jtx::Vault::WithdrawArgs::depositor
Account depositor
Definition
vault.h:109
xrpl::test::jtx::Vault::WithdrawArgs::amount
STAmount amount
Definition
vault.h:111
xrpl::test::jtx::Vault
Definition
vault.h:22
xrpl::test::jtx::Vault::create
std::tuple< json::Value, Keylet > create(CreateArgs const &args) const
Return a VaultCreate transaction and the Vault's expected keylet.
Definition
vault.cpp:26
xrpl::test::jtx::Vault::withdraw
static json::Value withdraw(WithdrawArgs const &args)
Definition
vault.cpp:100
xrpl::test::jtx::Vault::del
static json::Value del(DeleteArgs const &args)
Definition
vault.cpp:79
xrpl::test::jtx::Vault::clawback
static json::Value clawback(ClawbackArgs const &args)
Definition
vault.cpp:111
xrpl::test::jtx::Vault::set
static json::Value set(SetArgs const &args)
Definition
vault.cpp:69
xrpl::test::jtx::Vault::env
Env & env
Definition
vault.h:23
xrpl::test::jtx::Vault::createClosedEnded
std::tuple< json::Value, Keylet, NetClock::time_point > createClosedEnded(CreateClosedEndedArgs const &args) const
Return a VaultCreate transaction for a closed-ended vault, its expected keylet, and the vault's Subsc...
Definition
vault.cpp:48
xrpl::test::jtx::Vault::closePastSubscription
void closePastSubscription(NetClock::time_point subscriptionDate) const
Advance env's clock to just past subscriptionDate, moving a closed-ended vault from the Subscription ...
Definition
vault.cpp:63
xrpl::test::jtx::Vault::deposit
static json::Value deposit(DepositArgs const &args)
Definition
vault.cpp:89
tuple
Generated by
1.17.0