-
Notifications
You must be signed in to change notification settings - Fork 66
#576: Add support for AMMClawback #601
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 28 commits
Commits
Show all changes
41 commits
Select commit
Hold shift + click to select a range
8c0896e
generate definitions.json from xrpl.js script
f7ede3e
add amm clawback transaction and transaction flags
6208633
add ammclawback to signature utils
ad2caee
set up tests, almost full flow working
ccee59b
cleanup test
e526d46
remove extra print lines
c8aab1f
make enable rippling private again
b1f8c42
enable AMMClawback amendment, create two integration tests
3149b86
add one more integration test
ee8054c
add comment for unset flag
21b1e9d
add some comments to AmmClawback class
fcd0407
merge main into this branch
10b2b50
fix build by addressing TransactionFlags reference
850fa74
add Address import to AmmClawback class
b030ff5
fix all checkstyle issues, successful build
16dc361
address issues in unit test
ec0c5d2
address changes for currencies used
60396cd
add new empty method and add tests for AmmClawbackFlags
1c92ba8
change default for AmmClawbackFlags to empty instead of Unset
0513be4
add multi signature transaction helper test for signature utils
7d8f95d
update rippled version and fix checkstyle issues
6f41e95
fix amm clawback test class failing test
d699102
remove failing data driven test types
f06efc0
go back to version 2.3.0 rippled container
8984374
remove extra address import
3c03a3a
apply formatting for files changes
aaeba34
fix indenting and build
f67ba31
fix more formatting
e3a4fec
merge main into this branch
af2e5b2
undo formatting in SignatureUtils.java
0f5ec91
fix formatting in signature utils.java
81f1b9b
fix other small issues with SignatureUtils.java
59d2099
put back 2 other comments
81f1962
remove @beta from amm clawback
609855b
add javadoc to amm clawback transaction type
83afd49
fix formatting issues in rippledcontainer.java
ff76e41
apply formatting to signature utils test java
257c468
apply formatting to amm clawback test java
c92872c
put back stuff i changed in ripple d container java
9e4aeaa
fix formatting in AMM It Java
5dd9b0e
Update xrpl4j-core/src/main/java/org/xrpl/xrpl4j/model/transactions/T…
sappenin 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
389 changes: 196 additions & 193 deletions
389
xrpl4j-core/src/main/java/org/xrpl/xrpl4j/crypto/signing/SignatureUtils.java
Large diffs are not rendered by default.
Oops, something went wrong.
64 changes: 64 additions & 0 deletions
64
xrpl4j-core/src/main/java/org/xrpl/xrpl4j/model/flags/AmmClawbackFlags.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,64 @@ | ||
| package org.xrpl.xrpl4j.model.flags; | ||
|
|
||
| /*- | ||
| * ========================LICENSE_START================================= | ||
| * xrpl4j :: core | ||
| * %% | ||
| * Copyright (C) 2020 - 2023 XRPL Foundation and its contributors | ||
| * %% | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| * =========================LICENSE_END================================== | ||
| */ | ||
|
|
||
| import org.xrpl.xrpl4j.model.transactions.AmmClawback; | ||
|
|
||
| /** | ||
| * {@link TransactionFlags} for {@link AmmClawback} transactions. | ||
| */ | ||
| public class AmmClawbackFlags extends TransactionFlags { | ||
| /** | ||
| * Constant {@link AmmDepositFlags} for the {@code tfClawTwoAssets} flag. | ||
| */ | ||
| public static final AmmClawbackFlags CLAW_TWO_ASSETS = new AmmClawbackFlags(0x00000001); | ||
|
|
||
| /** | ||
| * Constant {@link AmmDepositFlags} for an unset value for "flags". | ||
| */ | ||
| public static final AmmClawbackFlags UNSET = new AmmClawbackFlags(0L); | ||
|
|
||
| private AmmClawbackFlags(long value) { | ||
| super(value); | ||
| } | ||
|
|
||
| private AmmClawbackFlags() { | ||
| } | ||
|
|
||
| /** | ||
| * Construct an empty instance of {@link AmmClawbackFlags}. Transactions with empty flags will | ||
| * not be serialized with a {@code Flags} field. | ||
| * | ||
| * @return An empty {@link AmmClawbackFlags}. | ||
| */ | ||
| public static AmmClawbackFlags empty() { | ||
| return new AmmClawbackFlags(); | ||
| } | ||
|
|
||
| /** | ||
| * Whether the {@code tfClawTwoAssets} flag is set. | ||
| * | ||
| * @return {@code true} if {@code tfLPToken} is set, otherwise {@code false}. | ||
| */ | ||
| public boolean tfClawTwoAssets() { | ||
| return this.isSet(CLAW_TWO_ASSETS); | ||
| } | ||
nkramer44 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
73 changes: 73 additions & 0 deletions
73
xrpl4j-core/src/main/java/org/xrpl/xrpl4j/model/transactions/AmmClawback.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,73 @@ | ||
| package org.xrpl.xrpl4j.model.transactions; | ||
|
|
||
| import com.fasterxml.jackson.annotation.JsonProperty; | ||
| import com.fasterxml.jackson.databind.annotation.JsonDeserialize; | ||
| import com.fasterxml.jackson.databind.annotation.JsonSerialize; | ||
| import com.google.common.annotations.Beta; | ||
| import org.immutables.value.Value; | ||
| import org.xrpl.xrpl4j.model.flags.AmmClawbackFlags; | ||
| import org.xrpl.xrpl4j.model.ledger.Issue; | ||
|
|
||
sappenin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| import java.util.Optional; | ||
|
|
||
| /** | ||
| * An {@link AmmClawback} transaction claws back tokens from a holder that has funds in an AMM pool. | ||
| */ | ||
| @Value.Immutable | ||
| @JsonSerialize(as = ImmutableAmmClawback.class) | ||
| @JsonDeserialize(as = ImmutableAmmClawback.class) | ||
| @Beta | ||
sappenin marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| public interface AmmClawback extends Transaction { | ||
|
|
||
| /** | ||
| * Construct a builder for this class. | ||
| * | ||
| * @return An {@link ImmutableAmmClawback.Builder}. | ||
| */ | ||
| static ImmutableAmmClawback.Builder builder() { | ||
| return ImmutableAmmClawback.builder(); | ||
| } | ||
|
|
||
| /** | ||
| * The address of the holder that has funds deposited in the AMM pool. | ||
| * | ||
| * @return An {@link Address}. | ||
| */ | ||
| @JsonProperty("Holder") | ||
| Address holder(); | ||
|
|
||
| /** | ||
| * The asset in the AMM pool that the issuer is looking to claw back. | ||
| * | ||
| * @return An {@link Issue}. | ||
| */ | ||
| @JsonProperty("Asset") | ||
| Issue asset(); | ||
|
|
||
| /** | ||
| * Other asset in the AMM pool that the issuer is looking to claw back. | ||
| * | ||
| * @return An {@link Issue}. | ||
| */ | ||
| @JsonProperty("Asset2") | ||
| Issue asset2(); | ||
|
|
||
| /** | ||
| * Optional field that specifies the maximum amount to clawback from the AMM pool. | ||
| * | ||
| * @return An {@link CurrencyAmount}. | ||
| */ | ||
| @JsonProperty("Amount") | ||
| Optional<CurrencyAmount> amount(); | ||
|
|
||
| /** | ||
| * Transaction Flags for {@link AmmClawback}, with the only option being tfClawTwoAssets. | ||
| * | ||
| * @return {@link AmmClawbackFlags#UNSET} if field was not set, otherwise returns with the set flag. | ||
| */ | ||
| @JsonProperty("Flags") | ||
| @Value.Default | ||
| default AmmClawbackFlags flags() { | ||
| return AmmClawbackFlags.empty(); | ||
| } | ||
| } | ||
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
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.