Add DepositPreauth ledger type and transaction (RIPD-1624):

The lsfDepositAuth flag limits the AccountIDs that can deposit into
the account that has the flag set.  The original design only
allowed deposits to complete if the account with the flag set also
signed the transaction that caused the deposit.

The DepositPreauth ledger type allows an account with the
lsfDepositAuth flag set to preauthorize additional accounts.
This preauthorization allows them to sign deposits as well.  An
account can add DepositPreauth objects to the ledger (and remove
them as well) using the DepositPreauth transaction.
This commit is contained in:
Scott Schurr
2018-04-20 13:16:17 -07:00
committed by seelabs
parent b444196bf9
commit 008ff67ac2
56 changed files with 1589 additions and 177 deletions

48
src/test/jtx/deposit.h Normal file
View File

@@ -0,0 +1,48 @@
//------------------------------------------------------------------------------
/*
This file is part of rippled: https://github.com/ripple/rippled
Copyright (c) 2018 Ripple Labs Inc.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
//==============================================================================
#ifndef RIPPLE_TEST_JTX_DEPOSIT_H_INCLUDED
#define RIPPLE_TEST_JTX_DEPOSIT_H_INCLUDED
#include <test/jtx/Env.h>
#include <test/jtx/Account.h>
namespace ripple {
namespace test {
namespace jtx {
/** Deposit preauthorize operations */
namespace deposit {
/** Preauthorize for deposit. Invoke as deposit::auth. */
Json::Value
auth (Account const& account, Account const& auth);
/** Remove preauthorization for deposit. Invoke as deposit::unauth. */
Json::Value
unauth (Account const& account, Account const& unauth);
} // deposit
} // jtx
} // test
} // ripple
#endif

View File

@@ -0,0 +1,55 @@
//------------------------------------------------------------------------------
/*
This file is part of rippled: https://github.com/ripple/rippled
Copyright (c) 2018 Ripple Labs Inc.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
//==============================================================================
#include <test/jtx/deposit.h>
#include <ripple/protocol/JsonFields.h>
namespace ripple {
namespace test {
namespace jtx {
namespace deposit {
// Add DepositPreauth.
Json::Value
auth (jtx::Account const& account, jtx::Account const& auth)
{
Json::Value jv;
jv[sfAccount.jsonName] = account.human();
jv[sfAuthorize.jsonName] = auth.human();
jv[sfTransactionType.jsonName] = "DepositPreauth";
return jv;
}
// Remove DepositPreauth.
Json::Value
unauth (jtx::Account const& account, jtx::Account const& unauth)
{
Json::Value jv;
jv[sfAccount.jsonName] = account.human();
jv[sfUnauthorize.jsonName] = unauth.human();
jv[sfTransactionType.jsonName] = "DepositPreauth";
return jv;
}
} // deposit
} // jtx
} // test
} // ripple