mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-05 16:57:53 +00:00
clang-format
This commit is contained in:
@@ -771,7 +771,7 @@ trustTransferLockedBalance(
|
||||
S& sleDstAcc,
|
||||
STAmount const& amount, // issuer, currency are in this field
|
||||
int deltaLockCount, // -1 decrement, +1 increment, 0 unchanged
|
||||
Rate const& lXferRate, // locked transfer rate
|
||||
Rate const& lXferRate, // locked transfer rate
|
||||
beast::Journal const& j,
|
||||
R dryRun)
|
||||
{
|
||||
@@ -919,15 +919,15 @@ trustTransferLockedBalance(
|
||||
// dstLow XNOR srcLow tells us if we need to flip the balance amount
|
||||
// on the destination line
|
||||
bool flipDstAmt = !((dstHigh && srcHigh) || (!dstHigh && !srcHigh));
|
||||
|
||||
|
||||
// default to amount
|
||||
auto dstAmt = amount;
|
||||
// if transfer rate
|
||||
if (lXferRate != parityRate)
|
||||
{
|
||||
// compute transfer fee, if any
|
||||
auto const xferFee =
|
||||
amount.value() - divideRound(amount, lXferRate, amount.issue(), true);
|
||||
auto const xferFee = amount.value() -
|
||||
divideRound(amount, lXferRate, amount.issue(), true);
|
||||
// compute balance to transfer
|
||||
dstAmt = amount.value() - xferFee;
|
||||
}
|
||||
|
||||
@@ -203,7 +203,10 @@ struct Escrow_test : public beast::unit_test::suite
|
||||
}
|
||||
|
||||
static Rate
|
||||
escrowRate(jtx::Env const& env, jtx::Account const& account, uint32_t const& seq)
|
||||
escrowRate(
|
||||
jtx::Env const& env,
|
||||
jtx::Account const& account,
|
||||
uint32_t const& seq)
|
||||
{
|
||||
auto const sle = env.le(keylet::escrow(account.id(), seq));
|
||||
if (sle->isFieldPresent(sfTransferRate))
|
||||
@@ -3587,7 +3590,8 @@ struct Escrow_test : public beast::unit_test::suite
|
||||
fee(1500));
|
||||
env.close();
|
||||
auto const transferRate = escrowRate(env, alice, seq1);
|
||||
BEAST_EXPECT(transferRate.value == std::uint32_t(1000000000 * 1.25));
|
||||
BEAST_EXPECT(
|
||||
transferRate.value == std::uint32_t(1000000000 * 1.25));
|
||||
env(finish(bob, alice, seq1),
|
||||
condition(cb1),
|
||||
fulfillment(fb1),
|
||||
@@ -3619,7 +3623,8 @@ struct Escrow_test : public beast::unit_test::suite
|
||||
fee(1500));
|
||||
env.close();
|
||||
auto transferRate = escrowRate(env, alice, seq1);
|
||||
BEAST_EXPECT(transferRate.value == std::uint32_t(1000000000 * 1.25));
|
||||
BEAST_EXPECT(
|
||||
transferRate.value == std::uint32_t(1000000000 * 1.25));
|
||||
env(rate(gw, 1.26));
|
||||
env.close();
|
||||
|
||||
@@ -3654,7 +3659,8 @@ struct Escrow_test : public beast::unit_test::suite
|
||||
fee(1500));
|
||||
env.close();
|
||||
auto transferRate = escrowRate(env, alice, seq1);
|
||||
BEAST_EXPECT(transferRate.value == std::uint32_t(1000000000 * 1.25));
|
||||
BEAST_EXPECT(
|
||||
transferRate.value == std::uint32_t(1000000000 * 1.25));
|
||||
env(rate(gw, 1.00));
|
||||
env.close();
|
||||
env(finish(bob, alice, seq1),
|
||||
|
||||
@@ -4821,7 +4821,8 @@ struct PayChan_test : public beast::unit_test::suite
|
||||
env(create(alice, bob, USD(1000), settleDelay, pk));
|
||||
env.close();
|
||||
auto const transferRate = channelRate(*env.current(), chan);
|
||||
BEAST_EXPECT(transferRate.value == std::uint32_t(1000000000 * 1.25));
|
||||
BEAST_EXPECT(
|
||||
transferRate.value == std::uint32_t(1000000000 * 1.25));
|
||||
auto chanBal = channelBalance(*env.current(), chan);
|
||||
auto chanAmt = channelAmount(*env.current(), chan);
|
||||
auto const delta = USD(125);
|
||||
@@ -4855,7 +4856,8 @@ struct PayChan_test : public beast::unit_test::suite
|
||||
env(create(alice, bob, USD(1000), settleDelay, pk));
|
||||
env.close();
|
||||
auto transferRate = channelRate(*env.current(), chan);
|
||||
BEAST_EXPECT(transferRate.value == std::uint32_t(1000000000 * 1.25));
|
||||
BEAST_EXPECT(
|
||||
transferRate.value == std::uint32_t(1000000000 * 1.25));
|
||||
|
||||
auto const preAlice = env.balance(alice, USD.issue());
|
||||
auto chanBal = channelBalance(*env.current(), chan);
|
||||
@@ -4869,7 +4871,8 @@ struct PayChan_test : public beast::unit_test::suite
|
||||
env(fund(alice, chan, USD(1000)));
|
||||
env.close();
|
||||
transferRate = channelRate(*env.current(), chan);
|
||||
BEAST_EXPECT(transferRate.value == std::uint32_t(1000000000 * 1.25));
|
||||
BEAST_EXPECT(
|
||||
transferRate.value == std::uint32_t(1000000000 * 1.25));
|
||||
|
||||
// issuer changes rate lower
|
||||
env(rate(gw, 1.00));
|
||||
@@ -4879,7 +4882,8 @@ struct PayChan_test : public beast::unit_test::suite
|
||||
env(fund(alice, chan, USD(1000)));
|
||||
env.close();
|
||||
transferRate = channelRate(*env.current(), chan);
|
||||
BEAST_EXPECT(transferRate.value == std::uint32_t(1000000000 * 1.00));
|
||||
BEAST_EXPECT(
|
||||
transferRate.value == std::uint32_t(1000000000 * 1.00));
|
||||
|
||||
// issuer changes rate higher
|
||||
env(rate(gw, 1.01));
|
||||
@@ -4890,7 +4894,8 @@ struct PayChan_test : public beast::unit_test::suite
|
||||
env(fund(alice, chan, USD(1000)), ter(temBAD_TRANSFER_RATE));
|
||||
env.close();
|
||||
transferRate = channelRate(*env.current(), chan);
|
||||
BEAST_EXPECT(transferRate.value == std::uint32_t(1000000000 * 1.00));
|
||||
BEAST_EXPECT(
|
||||
transferRate.value == std::uint32_t(1000000000 * 1.00));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4996,7 +5001,8 @@ struct PayChan_test : public beast::unit_test::suite
|
||||
env.close();
|
||||
|
||||
// bob can claim
|
||||
auto const sig = signClaimICAuth(alice.pk(), alice.sk(), chan, authAmt);
|
||||
auto const sig =
|
||||
signClaimICAuth(alice.pk(), alice.sk(), chan, authAmt);
|
||||
env(claim(bob, chan, reqBal, authAmt, Slice(sig), alice.pk()));
|
||||
env.close();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user