mirror of
https://github.com/Xahau/xahaud.git
synced 2025-11-19 10:05:48 +00:00
Compare commits
3 Commits
clawback
...
sublimator
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8b0be2d2f5 | ||
|
|
60dec74baf | ||
|
|
9abea13649 |
@@ -4147,7 +4147,8 @@ struct Escrow_test : public beast::unit_test::suite
|
||||
env(trust(gw, USD(10'000), bob, tfSetFreeze | tfSetDeepFreeze));
|
||||
env.close();
|
||||
|
||||
// bob cancel escrow fails because of deep frozen assets
|
||||
// bob cancel escrow succeeds despite deep frozen assets (unlocking
|
||||
// return is allowed)
|
||||
env(escrow::cancel(bob, alice, seq1),
|
||||
fee(baseFee),
|
||||
ter(tesSUCCESS));
|
||||
@@ -4657,4 +4658,4 @@ public:
|
||||
BEAST_DEFINE_TESTSUITE(Escrow, app, ripple);
|
||||
|
||||
} // namespace test
|
||||
} // namespace ripple
|
||||
} // namespace ripple
|
||||
|
||||
@@ -1932,31 +1932,135 @@ struct URIToken_test : public beast::unit_test::suite
|
||||
env(pay(gw, bob, USD(1000)));
|
||||
env.close();
|
||||
|
||||
// set freeze on alice trustline
|
||||
env(trust(gw, USD(10000), bob, tfSetFreeze));
|
||||
{
|
||||
// IOU bob(frozen) -> alice
|
||||
|
||||
// set freeze on bob trustline
|
||||
env(trust(gw, USD(10000), bob, tfSetFreeze));
|
||||
env.close();
|
||||
|
||||
// setup mint
|
||||
std::string const uri(maxTokenURILength, '?');
|
||||
auto const tid = uritoken::tokenid(alice, uri);
|
||||
std::string const hexid{strHex(tid)};
|
||||
env(uritoken::mint(alice, uri));
|
||||
env(uritoken::sell(alice, hexid), uritoken::amt(USD(10)));
|
||||
env.close();
|
||||
|
||||
// buy uritoken fails - frozen trustline
|
||||
env(uritoken::buy(bob, hexid),
|
||||
uritoken::amt(USD(10)),
|
||||
ter(tecINSUFFICIENT_FUNDS));
|
||||
env.close();
|
||||
|
||||
// clear freeze on bob trustline
|
||||
env(trust(gw, USD(10000), bob, tfClearFreeze));
|
||||
env.close();
|
||||
|
||||
// buy uri success
|
||||
env(uritoken::buy(bob, hexid), uritoken::amt(USD(10)));
|
||||
env.close();
|
||||
}
|
||||
{
|
||||
// IOU alice -> bob(frozen)
|
||||
|
||||
// set freeze on bob trustline
|
||||
env(trust(gw, USD(10000), bob, tfSetFreeze));
|
||||
env.close();
|
||||
|
||||
// setup mint
|
||||
std::string const uri(maxTokenURILength, '?');
|
||||
auto const tid = uritoken::tokenid(bob, uri);
|
||||
std::string const hexid{strHex(tid)};
|
||||
env(uritoken::mint(bob, uri));
|
||||
env(uritoken::sell(bob, hexid), uritoken::amt(USD(10)));
|
||||
env.close();
|
||||
|
||||
// buy uritoken fails - frozen trustline
|
||||
env(uritoken::buy(alice, hexid),
|
||||
uritoken::amt(USD(10)),
|
||||
ter(tecFROZEN));
|
||||
env.close();
|
||||
|
||||
// clear freeze on bob trustline
|
||||
env(trust(gw, USD(10000), bob, tfClearFreeze));
|
||||
env.close();
|
||||
|
||||
// buy uri success
|
||||
env(uritoken::buy(alice, hexid), uritoken::amt(USD(10)));
|
||||
env.close();
|
||||
}
|
||||
}
|
||||
// test DeepFreeze
|
||||
{
|
||||
// Env Setup
|
||||
Env env{*this, features};
|
||||
env.fund(XRP(1000), alice, bob, gw);
|
||||
env.close();
|
||||
env.trust(USD(100000), alice, bob);
|
||||
env.close();
|
||||
env(pay(gw, alice, USD(1000)));
|
||||
env(pay(gw, bob, USD(1000)));
|
||||
env.close();
|
||||
|
||||
// setup mint
|
||||
std::string const uri(maxTokenURILength, '?');
|
||||
auto const tid = uritoken::tokenid(alice, uri);
|
||||
std::string const hexid{strHex(tid)};
|
||||
env(uritoken::mint(alice, uri));
|
||||
env(uritoken::sell(alice, hexid), uritoken::amt(USD(10)));
|
||||
env.close();
|
||||
{
|
||||
// set freeze on bob trustline
|
||||
env(trust(gw, USD(10000), bob, tfSetFreeze | tfSetDeepFreeze));
|
||||
env.close();
|
||||
|
||||
// buy uritoken fails - frozen trustline
|
||||
env(uritoken::buy(bob, hexid),
|
||||
uritoken::amt(USD(10)),
|
||||
ter(tecINSUFFICIENT_FUNDS));
|
||||
env.close();
|
||||
// IOU bob(frozen) -> alice
|
||||
// setup mint
|
||||
std::string const uri(maxTokenURILength, '?');
|
||||
auto const tid = uritoken::tokenid(alice, uri);
|
||||
std::string const hexid{strHex(tid)};
|
||||
env(uritoken::mint(alice, uri));
|
||||
env(uritoken::sell(alice, hexid), uritoken::amt(USD(10)));
|
||||
env.close();
|
||||
|
||||
// clear freeze on alice trustline
|
||||
env(trust(gw, USD(10000), bob, tfClearFreeze));
|
||||
env.close();
|
||||
// buy uritoken fails - frozen trustline
|
||||
env(uritoken::buy(bob, hexid),
|
||||
uritoken::amt(USD(10)),
|
||||
ter(tecINSUFFICIENT_FUNDS));
|
||||
env.close();
|
||||
|
||||
// buy uri success
|
||||
env(uritoken::buy(bob, hexid), uritoken::amt(USD(10)));
|
||||
env.close();
|
||||
// clear freeze on bob trustline
|
||||
env(trust(
|
||||
gw, USD(10000), bob, tfClearFreeze | tfClearDeepFreeze));
|
||||
env.close();
|
||||
|
||||
// buy uri success
|
||||
env(uritoken::buy(bob, hexid), uritoken::amt(USD(10)));
|
||||
env.close();
|
||||
}
|
||||
{
|
||||
// set freeze on bob trustline
|
||||
env(trust(gw, USD(10000), bob, tfSetFreeze | tfSetDeepFreeze));
|
||||
env.close();
|
||||
|
||||
// IOU alice -> bob(frozen)
|
||||
// setup mint
|
||||
std::string const uri(maxTokenURILength, '?');
|
||||
auto const tid = uritoken::tokenid(bob, uri);
|
||||
std::string const hexid{strHex(tid)};
|
||||
env(uritoken::mint(bob, uri));
|
||||
env(uritoken::sell(bob, hexid), uritoken::amt(USD(10)));
|
||||
env.close();
|
||||
|
||||
// buy uritoken fails - frozen trustline
|
||||
env(uritoken::buy(alice, hexid),
|
||||
uritoken::amt(USD(10)),
|
||||
ter(tecFROZEN));
|
||||
env.close();
|
||||
|
||||
// clear freeze on bob trustline
|
||||
env(trust(
|
||||
gw, USD(10000), bob, tfClearFreeze | tfClearDeepFreeze));
|
||||
env.close();
|
||||
|
||||
// buy uri success
|
||||
env(uritoken::buy(alice, hexid), uritoken::amt(USD(10)));
|
||||
env.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user