Skip to content

Commit

Permalink
Merge branch 'main' into nk/xrp-fees
Browse files Browse the repository at this point in the history
  • Loading branch information
sappenin authored Jun 10, 2024
2 parents a8ce66c + 2a68c4a commit c123274
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 18 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ current [BOM](https://howtodoinjava.com/maven/maven-bom-bill-of-materials-depend
<dependency>
<groupId>org.xrpl</groupId>
<artifactId>xrpl4j-bom</artifactId>
<version>3.2.1</version>
<version>3.3.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand Down
2 changes: 1 addition & 1 deletion xrpl4j-bom/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ POM file. For example:
<dependency>
<groupId>org.xrpl.xrpl4j</groupId>
<artifactId>xrpl4j-bom</artifactId>
<version>3.2.1</version>
<version>3.3.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,8 @@ void depositAndVoteOnTradingFee() throws JsonRpcClientErrorException, JsonProces
TradingFee expectedTradingFee = TradingFee.ofPercent(
issuerLpTokenBalance.multiply(amm.amm().tradingFee().bigDecimalValue()).add(
traderLpTokenBalance.multiply(newTradingFee.bigDecimalValue())
).divide(issuerLpTokenBalance.add(traderLpTokenBalance), RoundingMode.FLOOR)
.setScale(3, RoundingMode.FLOOR)
).divide(issuerLpTokenBalance.add(traderLpTokenBalance), RoundingMode.HALF_UP)
.setScale(3, RoundingMode.HALF_UP)
);

AmmInfoResult ammAfterVote = getAmmInfo(issuerKeyPair);
Expand Down Expand Up @@ -255,7 +255,7 @@ void depositAndWithdraw() throws JsonRpcClientErrorException, JsonProcessingExce
.build()
)
.asset(Issue.XRP)
.amount(XrpCurrencyAmount.ofXrp(BigDecimal.valueOf(90)))
.amount(XrpCurrencyAmount.ofXrp(BigDecimal.valueOf(9)))
.flags(AmmWithdrawFlags.SINGLE_ASSET)
.build();

Expand Down Expand Up @@ -296,7 +296,7 @@ private AccountInfoResult depositXrp(
SignatureService<PrivateKey> signatureService,
FeeResult feeResult
) throws JsonRpcClientErrorException, JsonProcessingException {
XrpCurrencyAmount depositAmount = XrpCurrencyAmount.ofXrp(BigDecimal.valueOf(100));
XrpCurrencyAmount depositAmount = XrpCurrencyAmount.ofXrp(BigDecimal.valueOf(10));
AmmDeposit deposit = AmmDeposit.builder()
.account(traderAccount.accountData().account())
.asset2(
Expand Down Expand Up @@ -373,10 +373,10 @@ private AmmInfoResult createAmm(
IssuedCurrencyAmount.builder()
.issuer(issuerKeyPair.publicKey().deriveAddress())
.currency(xrpl4jCoin)
.value("25")
.value("2.5")
.build()
)
.amount2(XrpCurrencyAmount.ofXrp(BigDecimal.valueOf(100)))
.amount2(XrpCurrencyAmount.ofXrp(BigDecimal.valueOf(10)))
.tradingFee(TradingFee.ofPercent(BigDecimal.ONE))
.lastLedgerSequence(issuerAccount.ledgerIndexSafe().plus(UnsignedInteger.valueOf(4)).unsignedIntegerValue())
.signingPublicKey(issuerKeyPair.publicKey())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,15 @@ public class RippledContainer {
LOGGER.warn("Ledger accept failed", e);
}
};
private final GenericContainer rippledContainer;
private final GenericContainer<?> rippledContainer;
private final ScheduledExecutorService ledgerAcceptor;
private boolean started;

/**
* No-args constructor.
*/
public RippledContainer() {
rippledContainer = new GenericContainer("rippleci/rippled:2.0.0-b4")
rippledContainer = new GenericContainer<>("rippleci/rippled:2.2.0-rc3")
.withCreateContainerCmdModifier((Consumer<CreateContainerCmd>) (cmd) ->
cmd.withEntrypoint("/opt/ripple/bin/rippled"))
.withCommand("-a --start --conf /config/rippled.cfg")
Expand All @@ -92,8 +92,6 @@ public static KeyPair getMasterKeyPair() {

/**
* Starts container with default interval (1s) for closing ledgers.
*
* @return
*/
public RippledContainer start() {
return this.start(1000);
Expand All @@ -102,9 +100,9 @@ public RippledContainer start() {
/**
* Start contain with given interval for closing ledgers.
*
* @param acceptIntervalMillis
* @param acceptIntervalMillis The number of milliseconds before each accept call to close the ledger.
*
* @return
* @return A {@link RippledContainer}.
*/
public RippledContainer start(int acceptIntervalMillis) {
if (started) {
Expand Down Expand Up @@ -166,7 +164,7 @@ private void assertContainerStarted() {
/**
* Provides an instance of an {@link XrplAdminClient} that will connect to the rippled container.
*
* @return
* @return A {@link XrplAdminClient}.
*/
public XrplAdminClient getXrplAdminClient() {
return new XrplAdminClient(this.getBaseUri());
Expand All @@ -175,13 +173,13 @@ public XrplAdminClient getXrplAdminClient() {
/**
* Provides an instance of an {@link XrplClient} that will connect to the rippled container.
*
* @return
* @return A {@link XrplAdminClient}.
*/
public XrplClient getXrplClient() {
return new XrplClient(this.getBaseUri());
}

private static HttpUrl getBaseUri(GenericContainer rippledContainer) {
private static HttpUrl getBaseUri(GenericContainer<?> rippledContainer) {
return HttpUrl.parse("http://" + rippledContainer.getHost() + ":" + rippledContainer.getMappedPort(5005) + "/");
}

Expand Down
15 changes: 14 additions & 1 deletion xrpl4j-integration-tests/src/test/resources/rippled/rippled.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -203,4 +203,17 @@ fixReducedOffersV1
fixNFTokenRemint
# 2.0.0 Amendments
XChainBridge
DID
DID
fixFillOrKill
fixDisallowIncomingV1
# 2.1.0 Amendments
fixNFTokenReserve
fixInnerObjTemplate
# 2.1.1 Amendments
fixAMMOverflowOffer
# TBD Version
fixPreviousTxnID
fixAMMv1_1
fixEmptyDID
fixXChainRewardRounding
PriceOracle

0 comments on commit c123274

Please sign in to comment.