Repository navigation
Changes to single asset vault #832
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 3 commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
a1dd179
Upcoming changes to Single Asset Vault (DGE-7974)
cybele-ripple d44e8f9
Address review of Single Asset Vault changes (DGE-7974)
cybele-ripple 0504c81
Add missing @Override annotation to tfInnerBatchTxn() in Vault flags …
cybele-ripple 53d66bd
Address PR review feedback for Vault flags (DGE-7974)
cybele-ripple 5f48277
Add VaultKind, SubscriptionDate, RedemptionDate to support closed-end…
cybele-ripple fe777cf
Enable LendingProtocolV1_1 amendment for local rippled test container…
cybele-ripple 96be695
Merge remote-tracking branch 'origin/main' into single-asset-vault
cybele-ripple 09691be
Add remaining LendingProtocolV1_1 protocol surface
cybele-ripple e37030e
Attribute the vault deposit-block and donate flags to LendingProtocol…
cybele-ripple 61b6380
Merge remote-tracking branch 'origin/main' into single-asset-vault
cybele-ripple aae84d3
Fix LendingProtocolIT tecNO_PERMISSION failures on LoanSet/LoanBrokerSet
cybele-ripple 2336840
Widen LendingProtocolIT's Vault SubscriptionDate buffer for real netw…
cybele-ripple e1e1285
Fix scanForResult timeout mismatch after widening SubscriptionDate bu…
cybele-ripple e933650
Widen awaitLoanPaymentLate's timeout for real-network ledger close pa…
cybele-ripple 73b0bf3
Omit VaultKind.OPEN_ENDED from serialized Vault JSON
cybele-ripple 96efb58
Address remaining PR 832 review feedback: hashCode, unread locals
cybele-ripple cff3ebd
Merge remote-tracking branch 'origin/main' into single-asset-vault
cybele-ripple efd6fdb
Merge remote-tracking branch 'origin/main' into single-asset-vault
cybele-ripple 41c8cb4
Remove LendingProtocolV1_2-gated Vault flags from this LP1.1 branch
cybele-ripple 3b4caf3
Restore VaultFlagsTest.java instead of deleting it
cybele-ripple 2cfdbd0
Address PR review feedback for single-asset-vault
cybele-ripple 994e7ff
Add IT coverage for VaultWithdraw CredentialIDs and VaultDelete MemoData
cybele-ripple aabded6
fix: remove unread local variable in LendingProtocolIT
cybele-ripple e4fb977
Merge remote-tracking branch 'origin/main' into single-asset-vault
cybele-ripple 1b0fd62
fix: enforce investment-period bounds in VaultCreate.check()
cybele-ripple 16c1398
Merge remote-tracking branch 'origin/main' into single-asset-vault
cybele-ripple File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
143 changes: 143 additions & 0 deletions
143
xrpl4j-core/src/main/java/org/xrpl/xrpl4j/model/flags/VaultDepositFlags.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,143 @@ | ||
| package org.xrpl.xrpl4j.model.flags; | ||
|
|
||
| import com.google.common.annotations.Beta; | ||
| import org.xrpl.xrpl4j.model.transactions.VaultDeposit; | ||
|
|
||
| /** | ||
| * A set of static {@link TransactionFlags} which can be set on {@link VaultDeposit} transactions. | ||
| * | ||
| * <p>This class will be marked {@link Beta} until the SingleAssetVault amendment is enabled on mainnet. Its API is | ||
| * subject to change.</p> | ||
| * | ||
| * @see "https://github.com/XRPLF/XRPL-Standards/pull/469" | ||
| */ | ||
| @Beta | ||
| public class VaultDepositFlags extends TransactionFlags { | ||
|
|
||
| /** | ||
| * Constant {@link VaultDepositFlags} for the {@code tfVaultDonate} flag. | ||
| */ | ||
| public static final VaultDepositFlags VAULT_DONATE = new VaultDepositFlags(0x00010000L); | ||
|
|
||
| /** | ||
| * Constant {@link VaultDepositFlags} for the {@code tfInnerBatchTxn} flag. | ||
| * | ||
| * @see "https://github.com/XRPLF/XRPL-Standards/tree/master/XLS-0056-batch" | ||
| */ | ||
| public static final VaultDepositFlags INNER_BATCH_TXN = | ||
| new VaultDepositFlags(TransactionFlags.INNER_BATCH_TXN.getValue()); | ||
|
|
||
| private VaultDepositFlags(long value) { | ||
| super(value); | ||
| } | ||
|
|
||
| private VaultDepositFlags() { | ||
| } | ||
|
|
||
| /** | ||
| * Create a new {@link Builder}. | ||
| * | ||
| * @return A new {@link Builder}. | ||
| */ | ||
| public static Builder builder() { | ||
| return new Builder(); | ||
| } | ||
|
|
||
| /** | ||
| * Construct {@link VaultDepositFlags} with a given value. | ||
| * | ||
| * @param value The long-number encoded flags value of this {@link VaultDepositFlags}. | ||
| * | ||
| * @return New {@link VaultDepositFlags}. | ||
| */ | ||
| public static VaultDepositFlags of(long value) { | ||
| return new VaultDepositFlags(value); | ||
| } | ||
|
|
||
| private static VaultDepositFlags of( | ||
| boolean tfFullyCanonicalSig, | ||
| boolean tfVaultDonate, | ||
| boolean tfInnerBatchTxn | ||
| ) { | ||
| long value = Flags.of( | ||
| tfFullyCanonicalSig ? TransactionFlags.FULLY_CANONICAL_SIG : UNSET, | ||
| tfVaultDonate ? VAULT_DONATE : UNSET, | ||
| tfInnerBatchTxn ? TransactionFlags.INNER_BATCH_TXN : UNSET | ||
| ).getValue(); | ||
| return new VaultDepositFlags(value); | ||
| } | ||
|
|
||
| /** | ||
| * Construct an empty instance of {@link VaultDepositFlags}. Transactions with empty flags will not be serialized | ||
| * with a {@code Flags} field. | ||
| * | ||
| * @return An empty {@link VaultDepositFlags}. | ||
| */ | ||
| public static VaultDepositFlags empty() { | ||
| return new VaultDepositFlags(); | ||
| } | ||
|
|
||
| /** | ||
| * If enabled, the deposited assets are donated to the vault, meaning the depositor receives no shares in return. | ||
| * | ||
| * <p>This flag requires the {@code LendingProtocolV1_1} amendment. Only the vault owner may donate, and the vault | ||
| * must already have outstanding shares.</p> | ||
| * | ||
| * @return {@code true} if {@code tfVaultDonate} is set, otherwise {@code false}. | ||
| */ | ||
| public boolean tfVaultDonate() { | ||
| return this.isSet(VaultDepositFlags.VAULT_DONATE); | ||
| } | ||
|
|
||
| /** | ||
| * Whether the {@code tfInnerBatchTxn} flag is set. | ||
| * | ||
| * @return {@code true} if {@code tfInnerBatchTxn} is set, otherwise {@code false}. | ||
| */ | ||
| @Override | ||
| public boolean tfInnerBatchTxn() { | ||
|
github-code-quality[bot] marked this conversation as resolved.
Fixed
|
||
| return this.isSet(VaultDepositFlags.INNER_BATCH_TXN); | ||
| } | ||
|
|
||
| /** | ||
| * A builder class for {@link VaultDepositFlags} flags. | ||
| */ | ||
| public static class Builder { | ||
|
|
||
| private boolean tfVaultDonate = false; | ||
| private boolean tfInnerBatchTxn = false; | ||
|
|
||
| /** | ||
| * Set {@code tfVaultDonate} to the given value. | ||
| * | ||
| * @param tfVaultDonate A boolean value. | ||
| * | ||
| * @return The same {@link Builder}. | ||
| */ | ||
| public Builder tfVaultDonate(boolean tfVaultDonate) { | ||
| this.tfVaultDonate = tfVaultDonate; | ||
| return this; | ||
| } | ||
|
|
||
| /** | ||
| * Set {@code tfInnerBatchTxn} to the given value. | ||
| * | ||
| * @param tfInnerBatchTxn A boolean value. | ||
| * | ||
| * @return The same {@link Builder}. | ||
| */ | ||
| public Builder tfInnerBatchTxn(boolean tfInnerBatchTxn) { | ||
| this.tfInnerBatchTxn = tfInnerBatchTxn; | ||
| return this; | ||
| } | ||
|
|
||
| /** | ||
| * Build a new {@link VaultDepositFlags} from the current boolean values. | ||
| * | ||
| * @return A new {@link VaultDepositFlags}. | ||
| */ | ||
| public VaultDepositFlags build() { | ||
| return VaultDepositFlags.of(true, tfVaultDonate, tfInnerBatchTxn); | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.