mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-19 18:45:52 +00:00
progress
This commit is contained in:
committed by
Bronek Kozicki
parent
6046fa239c
commit
12552162c9
@@ -362,8 +362,27 @@ class Vault_test : public beast::unit_test::suite
|
||||
env.close();
|
||||
}
|
||||
|
||||
}
|
||||
{
|
||||
// Withdraw non-zero assets.
|
||||
auto tx = vault.withdraw(
|
||||
{.depositor = depositor,
|
||||
.id = keylet.key,
|
||||
.amount = asset(100)});
|
||||
env(tx);
|
||||
env.close();
|
||||
}
|
||||
|
||||
{
|
||||
// TODO: get asset of share.
|
||||
// Redeem non-zero shares.
|
||||
auto tx = vault.withdraw(
|
||||
{.depositor = depositor,
|
||||
.id = keylet.key,
|
||||
.amount = asset(1000)});
|
||||
env(tx, ter(tecINSUFFICIENT_FUNDS));
|
||||
env.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
@@ -96,13 +96,12 @@ VaultWithdraw::doApply()
|
||||
// The vault must have enough assets on hand.
|
||||
// The vault may hold assets that it has already pledged.
|
||||
// That is why we look at AssetAvailable instead of the account balance.
|
||||
// TODO: Invariant: vault.AssetAvailable <= vault.Account.balance(vault.Asset)
|
||||
// TODO: Invariant: vault.AssetAvailable <=
|
||||
// vault.Account.balance(vault.Asset)
|
||||
if (*vault->at(sfAssetAvailable) < assets)
|
||||
return tecINSUFFICIENT_FUNDS;
|
||||
|
||||
std::cerr << "total before: " << *vault->at(sfAssetTotal) << std::endl;
|
||||
vault->at(sfAssetTotal) -= assets;
|
||||
std::cerr << "total after: " << *vault->at(sfAssetTotal) << std::endl;
|
||||
vault->at(sfAssetAvailable) -= assets;
|
||||
|
||||
auto const& vaultAccount = vault->at(sfAccount);
|
||||
|
||||
Reference in New Issue
Block a user