mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
clang-format
This commit is contained in:
@@ -771,7 +771,7 @@ trustTransferLockedBalance(
|
|||||||
S& sleDstAcc,
|
S& sleDstAcc,
|
||||||
STAmount const& amount, // issuer, currency are in this field
|
STAmount const& amount, // issuer, currency are in this field
|
||||||
int deltaLockCount, // -1 decrement, +1 increment, 0 unchanged
|
int deltaLockCount, // -1 decrement, +1 increment, 0 unchanged
|
||||||
Rate const& lXferRate, // locked transfer rate
|
Rate const& lXferRate, // locked transfer rate
|
||||||
beast::Journal const& j,
|
beast::Journal const& j,
|
||||||
R dryRun)
|
R dryRun)
|
||||||
{
|
{
|
||||||
@@ -926,8 +926,8 @@ trustTransferLockedBalance(
|
|||||||
if (lXferRate != parityRate)
|
if (lXferRate != parityRate)
|
||||||
{
|
{
|
||||||
// compute transfer fee, if any
|
// compute transfer fee, if any
|
||||||
auto const xferFee =
|
auto const xferFee = amount.value() -
|
||||||
amount.value() - divideRound(amount, lXferRate, amount.issue(), true);
|
divideRound(amount, lXferRate, amount.issue(), true);
|
||||||
// compute balance to transfer
|
// compute balance to transfer
|
||||||
dstAmt = amount.value() - xferFee;
|
dstAmt = amount.value() - xferFee;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -203,7 +203,10 @@ struct Escrow_test : public beast::unit_test::suite
|
|||||||
}
|
}
|
||||||
|
|
||||||
static Rate
|
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));
|
auto const sle = env.le(keylet::escrow(account.id(), seq));
|
||||||
if (sle->isFieldPresent(sfTransferRate))
|
if (sle->isFieldPresent(sfTransferRate))
|
||||||
@@ -3587,7 +3590,8 @@ struct Escrow_test : public beast::unit_test::suite
|
|||||||
fee(1500));
|
fee(1500));
|
||||||
env.close();
|
env.close();
|
||||||
auto const transferRate = escrowRate(env, alice, seq1);
|
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),
|
env(finish(bob, alice, seq1),
|
||||||
condition(cb1),
|
condition(cb1),
|
||||||
fulfillment(fb1),
|
fulfillment(fb1),
|
||||||
@@ -3619,7 +3623,8 @@ struct Escrow_test : public beast::unit_test::suite
|
|||||||
fee(1500));
|
fee(1500));
|
||||||
env.close();
|
env.close();
|
||||||
auto transferRate = escrowRate(env, alice, seq1);
|
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(rate(gw, 1.26));
|
||||||
env.close();
|
env.close();
|
||||||
|
|
||||||
@@ -3654,7 +3659,8 @@ struct Escrow_test : public beast::unit_test::suite
|
|||||||
fee(1500));
|
fee(1500));
|
||||||
env.close();
|
env.close();
|
||||||
auto transferRate = escrowRate(env, alice, seq1);
|
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(rate(gw, 1.00));
|
||||||
env.close();
|
env.close();
|
||||||
env(finish(bob, alice, seq1),
|
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(create(alice, bob, USD(1000), settleDelay, pk));
|
||||||
env.close();
|
env.close();
|
||||||
auto const transferRate = channelRate(*env.current(), chan);
|
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 chanBal = channelBalance(*env.current(), chan);
|
||||||
auto chanAmt = channelAmount(*env.current(), chan);
|
auto chanAmt = channelAmount(*env.current(), chan);
|
||||||
auto const delta = USD(125);
|
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(create(alice, bob, USD(1000), settleDelay, pk));
|
||||||
env.close();
|
env.close();
|
||||||
auto transferRate = channelRate(*env.current(), chan);
|
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 const preAlice = env.balance(alice, USD.issue());
|
||||||
auto chanBal = channelBalance(*env.current(), chan);
|
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(fund(alice, chan, USD(1000)));
|
||||||
env.close();
|
env.close();
|
||||||
transferRate = channelRate(*env.current(), chan);
|
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
|
// issuer changes rate lower
|
||||||
env(rate(gw, 1.00));
|
env(rate(gw, 1.00));
|
||||||
@@ -4879,7 +4882,8 @@ struct PayChan_test : public beast::unit_test::suite
|
|||||||
env(fund(alice, chan, USD(1000)));
|
env(fund(alice, chan, USD(1000)));
|
||||||
env.close();
|
env.close();
|
||||||
transferRate = channelRate(*env.current(), chan);
|
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
|
// issuer changes rate higher
|
||||||
env(rate(gw, 1.01));
|
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(fund(alice, chan, USD(1000)), ter(temBAD_TRANSFER_RATE));
|
||||||
env.close();
|
env.close();
|
||||||
transferRate = channelRate(*env.current(), chan);
|
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();
|
env.close();
|
||||||
|
|
||||||
// bob can claim
|
// 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(claim(bob, chan, reqBal, authAmt, Slice(sig), alice.pk()));
|
||||||
env.close();
|
env.close();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user