mirror of
https://github.com/Xahau/xahaud.git
synced 2025-11-04 18:55:49 +00:00
Compare commits
6 Commits
ce7b1c4f1d
...
cadastre
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
45411750cf | ||
|
|
b42be37d78 | ||
|
|
9215b87511 | ||
|
|
2817f848e8 | ||
|
|
557ad3d18e | ||
|
|
e05d7e783c |
@@ -461,6 +461,7 @@ target_sources (rippled PRIVATE
|
||||
src/ripple/app/tx/impl/Taker.cpp
|
||||
src/ripple/app/tx/impl/Transactor.cpp
|
||||
src/ripple/app/tx/impl/URIToken.cpp
|
||||
src/ripple/app/tx/impl/Cadastre.cpp
|
||||
src/ripple/app/tx/impl/apply.cpp
|
||||
src/ripple/app/tx/impl/applySteps.cpp
|
||||
src/ripple/app/hook/impl/applyHook.cpp
|
||||
|
||||
@@ -891,13 +891,19 @@ hook::removeHookNamespaceEntry(ripple::SLE& sleAccount, ripple::uint256 ns)
|
||||
bool
|
||||
hook::canHook(ripple::TxType txType, ripple::uint256 hookOn)
|
||||
{
|
||||
|
||||
uint16_t tt = safe_cast<uint16_t>(txType);
|
||||
|
||||
// only the low order byte is used to determine HookOn
|
||||
tt &= 0xFFU;
|
||||
|
||||
// invert ttHOOK_SET bit
|
||||
hookOn ^= UINT256_BIT[ttHOOK_SET];
|
||||
|
||||
// invert entire field
|
||||
hookOn = ~hookOn;
|
||||
|
||||
return (hookOn & UINT256_BIT[txType]) != beast::zero;
|
||||
return (hookOn & UINT256_BIT[tt]) != beast::zero;
|
||||
}
|
||||
|
||||
// Update HookState ledger objects for the hook... only called after accept()
|
||||
|
||||
207
src/ripple/app/tx/impl/Cadastre.cpp
Normal file
207
src/ripple/app/tx/impl/Cadastre.cpp
Normal file
@@ -0,0 +1,207 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
This file is part of rippled: https://github.com/ripple/rippled
|
||||
Copyright (c) 2012, 2013 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 <ripple/app/tx/impl/Cadastre.h>
|
||||
#include <ripple/basics/Log.h>
|
||||
#include <ripple/ledger/View.h>
|
||||
#include <ripple/protocol/Feature.h>
|
||||
#include <ripple/protocol/Indexes.h>
|
||||
#include <ripple/app/tx/impl/URIToken.h>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
TxConsequences
|
||||
Cadastre::makeTxConsequences(PreflightContext const& ctx)
|
||||
{
|
||||
return TxConsequences{ctx.tx, TxConsequences::normal};
|
||||
}
|
||||
|
||||
/*
|
||||
add(jss::Cadastre,
|
||||
ltCADASTRE,
|
||||
{
|
||||
{sfOwner, soeREQUIRED},
|
||||
{sfOwnerNode, soeREQUIRED},
|
||||
{sfAssociation, soeOPTIONAL},
|
||||
{sfAssociationNode, soeOPTIONAL},
|
||||
{sfLocationX, soeREQUIRED},
|
||||
{sfLocationY, soeREQUIRED},
|
||||
{sfUniverse, soeREQUIRED},
|
||||
{sfDisplayURI, soeOPTIONAL},
|
||||
{sfBroadcastURI, soeOPTIONAL},
|
||||
{sfCadastreCount, soeOPTIONAL}, // for 0x8000,0x8000 tile only
|
||||
},
|
||||
commonFields);
|
||||
|
||||
ttCADASTRE_MINT = 0x005D, // HookOn = 93
|
||||
ttCADASTRE_BURN = 0x015D,
|
||||
ttCADASTRE_CREATE_SELL_OFFER = 0x025D,
|
||||
ttCADASTRE_CANCEL_SELL_OFFER = 0x035D,
|
||||
ttCADASTRE_BUY = 0x045D,
|
||||
ttCADASTRE_SET = 0x055D,
|
||||
*/
|
||||
|
||||
NotTEC
|
||||
Cadastre::preflight(PreflightContext const& ctx)
|
||||
{
|
||||
if (auto const ret = preflight1(ctx); !isTesSuccess(ret))
|
||||
return ret;
|
||||
|
||||
auto& tx = ctx.tx;
|
||||
|
||||
// the validation for amount is the same regardless of which txn is appears
|
||||
// on
|
||||
if (ctx.tx.isFieldPresent(sfAmount))
|
||||
{
|
||||
auto amt = ctx.tx.getFieldAmount(sfAmount);
|
||||
|
||||
if (!isLegalNet(amt) || amt.signum() < 0)
|
||||
{
|
||||
JLOG(ctx.j.warn()) << "Malformed transaction. Negative or "
|
||||
"invalid amount/currency specified.";
|
||||
return temBAD_AMOUNT;
|
||||
}
|
||||
|
||||
if (isBadCurrency(amt.getCurrency()))
|
||||
{
|
||||
JLOG(ctx.j.warn()) << "Malformed transaction. Bad currency.";
|
||||
return temBAD_CURRENCY;
|
||||
}
|
||||
|
||||
if (amt == beast::zero && !ctx.tx.isFieldPresent(sfDestination))
|
||||
{
|
||||
if (tt == ttCADASTRE_BUY)
|
||||
{
|
||||
// buy operation does not specify a destination, and can have a
|
||||
// zero amount pass
|
||||
}
|
||||
else
|
||||
{
|
||||
JLOG(ctx.j.warn()) << "Malformed transaction. "
|
||||
<< "If no sell-to destination is specified "
|
||||
"then a non-zero price must be set.";
|
||||
return temMALFORMED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ctx.tx.isFieldPresent(sfDestination) &&
|
||||
!ctx.tx.isFieldPresent(sfAmount))
|
||||
return temMALFORMED;
|
||||
|
||||
|
||||
auto checkURI = [&ctx](SField const& f) -> TER
|
||||
{
|
||||
if (ctx.tx.isFieldPresent(f))
|
||||
{
|
||||
auto const& vl = ctx.tx.getFieldVL(f);
|
||||
if (vl.size() < 1 || vl.size() > 256)
|
||||
{
|
||||
JLOG(ctx.j.warn())
|
||||
<< "Cadastre: Malformed transaction, "
|
||||
<< f.getName()
|
||||
<< " was invalid size (too big/small)";
|
||||
return temMALFORMED;
|
||||
}
|
||||
|
||||
if (!URIToken::validateUTF8(ctx.tx.getFieldVL(sfDisplayURI)))
|
||||
{
|
||||
JLOG(ctx.j.warn())
|
||||
<< "Cadastre: Malformed transaction, "
|
||||
<< f.getName()
|
||||
<< " was not valid utf-8";
|
||||
return temMALFORMED;
|
||||
}
|
||||
}
|
||||
return tesSUCCESS;
|
||||
};
|
||||
|
||||
checkURI(sfDisplayURI);
|
||||
checkURI(sfBroadcastURI);
|
||||
|
||||
return preflight2(ctx);
|
||||
}
|
||||
|
||||
TER
|
||||
Cadastre::preclaim(PreclaimContext const& ctx)
|
||||
{
|
||||
if (!ctx.view.rules().enabled(featureHooks))
|
||||
return temDISABLED;
|
||||
|
||||
auto const id = ctx.tx[sfAccount];
|
||||
|
||||
auto const sle = ctx.view.read(keylet::account(id));
|
||||
if (!sle)
|
||||
return terNO_ACCOUNT;
|
||||
|
||||
if (ctx.tx.isFieldPresent(sfDestination))
|
||||
{
|
||||
if (!ctx.view.exists(keylet::account(ctx.tx[sfDestination])))
|
||||
return tecNO_TARGET;
|
||||
}
|
||||
|
||||
auto const tt = tx.getTxnType();
|
||||
|
||||
switch(tt)
|
||||
{
|
||||
case ttCADASTRE_MINT:
|
||||
case ttCADASTRE_SET:
|
||||
{
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
case ttCADASTRE_BURN:
|
||||
{
|
||||
break;
|
||||
}
|
||||
case ttCADASTRE_CREATE_SELL_OFFER:
|
||||
{
|
||||
break;
|
||||
}
|
||||
case ttCADASTRE_CANCEL_SELL_OFFER:
|
||||
{
|
||||
break;
|
||||
}
|
||||
case ttCADASTRE_BUY:
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return tesSUCCESS;
|
||||
}
|
||||
|
||||
TER
|
||||
Cadastre::doApply()
|
||||
{
|
||||
// everything happens in the hooks!
|
||||
return tesSUCCESS;
|
||||
}
|
||||
|
||||
XRPAmount
|
||||
Cadastre::calculateBaseFee(ReadView const& view, STTx const& tx)
|
||||
{
|
||||
XRPAmount extraFee{0};
|
||||
|
||||
return Transactor::calculateBaseFee(view, tx) + extraFee;
|
||||
}
|
||||
|
||||
} // namespace ripple
|
||||
57
src/ripple/app/tx/impl/Cadastre.h
Normal file
57
src/ripple/app/tx/impl/Cadastre.h
Normal file
@@ -0,0 +1,57 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
This file is part of rippled: https://github.com/ripple/rippled
|
||||
Copyright (c) 2014 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_TX_CADASTRE_H_INCLUDED
|
||||
#define RIPPLE_TX_CADASTRE_H_INCLUDED
|
||||
|
||||
#include <ripple/app/ledger/Ledger.h>
|
||||
#include <ripple/app/tx/impl/Transactor.h>
|
||||
#include <ripple/basics/Log.h>
|
||||
#include <ripple/protocol/Indexes.h>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
class Cadastre : public Transactor
|
||||
{
|
||||
public:
|
||||
static constexpr ConsequencesFactoryType ConsequencesFactory{Normal};
|
||||
|
||||
explicit Cadastre(ApplyContext& ctx) : Transactor(ctx)
|
||||
{
|
||||
}
|
||||
|
||||
static XRPAmount
|
||||
calculateBaseFee(ReadView const& view, STTx const& tx);
|
||||
|
||||
static TxConsequences
|
||||
makeTxConsequences(PreflightContext const& ctx);
|
||||
|
||||
static NotTEC
|
||||
preflight(PreflightContext const& ctx);
|
||||
|
||||
static TER
|
||||
preclaim(PreclaimContext const& ctx);
|
||||
|
||||
TER
|
||||
doApply() override;
|
||||
};
|
||||
|
||||
} // namespace ripple
|
||||
|
||||
#endif
|
||||
@@ -492,6 +492,7 @@ LedgerEntryTypesMatch::visitEntry(
|
||||
case ltURI_TOKEN:
|
||||
case ltIMPORT_VLSEQ:
|
||||
case ltUNL_REPORT:
|
||||
case ltCADASTRE:
|
||||
break;
|
||||
default:
|
||||
invalidTypeAdded_ = true;
|
||||
|
||||
@@ -103,57 +103,7 @@ URIToken::preflight(PreflightContext const& ctx)
|
||||
return temMALFORMED;
|
||||
}
|
||||
|
||||
if (!([](std::vector<uint8_t> const& u) -> bool {
|
||||
// this code is from
|
||||
// https://www.cl.cam.ac.uk/~mgk25/ucs/utf8_check.c
|
||||
uint8_t const* s = (uint8_t const*)u.data();
|
||||
uint8_t const* end = s + u.size();
|
||||
while (s < end)
|
||||
{
|
||||
if (*s < 0x80)
|
||||
/* 0xxxxxxx */
|
||||
s++;
|
||||
else if ((s[0] & 0xe0) == 0xc0)
|
||||
{
|
||||
/* 110XXXXx 10xxxxxx */
|
||||
if ((s[1] & 0xc0) != 0x80 ||
|
||||
(s[0] & 0xfe) == 0xc0) /* overlong? */
|
||||
return false;
|
||||
else
|
||||
s += 2;
|
||||
}
|
||||
else if ((s[0] & 0xf0) == 0xe0)
|
||||
{
|
||||
/* 1110XXXX 10Xxxxxx 10xxxxxx */
|
||||
if ((s[1] & 0xc0) != 0x80 || (s[2] & 0xc0) != 0x80 ||
|
||||
(s[0] == 0xe0 &&
|
||||
(s[1] & 0xe0) == 0x80) || /* overlong? */
|
||||
(s[0] == 0xed &&
|
||||
(s[1] & 0xe0) == 0xa0) || /* surrogate? */
|
||||
(s[0] == 0xef && s[1] == 0xbf &&
|
||||
(s[2] & 0xfe) == 0xbe)) /* U+FFFE or U+FFFF? */
|
||||
return false;
|
||||
else
|
||||
s += 3;
|
||||
}
|
||||
else if ((s[0] & 0xf8) == 0xf0)
|
||||
{
|
||||
/* 11110XXX 10XXxxxx 10xxxxxx 10xxxxxx */
|
||||
if ((s[1] & 0xc0) != 0x80 || (s[2] & 0xc0) != 0x80 ||
|
||||
(s[3] & 0xc0) != 0x80 ||
|
||||
(s[0] == 0xf0 &&
|
||||
(s[1] & 0xf0) == 0x80) || /* overlong? */
|
||||
(s[0] == 0xf4 && s[1] > 0x8f) ||
|
||||
s[0] > 0xf4) /* > U+10FFFF? */
|
||||
return false;
|
||||
else
|
||||
s += 4;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
})(uri))
|
||||
if (!validateUTF8(uri))
|
||||
{
|
||||
JLOG(ctx.j.warn()) << "Malformed transaction. URI must be a "
|
||||
"valid utf-8 string.";
|
||||
|
||||
@@ -30,6 +30,56 @@ namespace ripple {
|
||||
class URIToken : public Transactor
|
||||
{
|
||||
public:
|
||||
bool inline static validateUTF8(std::vector<uint8_t> const& u)
|
||||
{
|
||||
// this code is from
|
||||
// https://www.cl.cam.ac.uk/~mgk25/ucs/utf8_check.c
|
||||
uint8_t const* s = (uint8_t const*)u.data();
|
||||
uint8_t const* end = s + u.size();
|
||||
while (s < end)
|
||||
{
|
||||
if (*s < 0x80)
|
||||
/* 0xxxxxxx */
|
||||
s++;
|
||||
else if ((s[0] & 0xe0) == 0xc0)
|
||||
{
|
||||
/* 110XXXXx 10xxxxxx */
|
||||
if ((s[1] & 0xc0) != 0x80 ||
|
||||
(s[0] & 0xfe) == 0xc0) /* overlong? */
|
||||
return false;
|
||||
else
|
||||
s += 2;
|
||||
}
|
||||
else if ((s[0] & 0xf0) == 0xe0)
|
||||
{
|
||||
/* 1110XXXX 10Xxxxxx 10xxxxxx */
|
||||
if ((s[1] & 0xc0) != 0x80 || (s[2] & 0xc0) != 0x80 ||
|
||||
(s[0] == 0xe0 && (s[1] & 0xe0) == 0x80) || /* overlong? */
|
||||
(s[0] == 0xed && (s[1] & 0xe0) == 0xa0) || /* surrogate? */
|
||||
(s[0] == 0xef && s[1] == 0xbf &&
|
||||
(s[2] & 0xfe) == 0xbe)) /* U+FFFE or U+FFFF? */
|
||||
return false;
|
||||
else
|
||||
s += 3;
|
||||
}
|
||||
else if ((s[0] & 0xf8) == 0xf0)
|
||||
{
|
||||
/* 11110XXX 10XXxxxx 10xxxxxx 10xxxxxx */
|
||||
if ((s[1] & 0xc0) != 0x80 || (s[2] & 0xc0) != 0x80 ||
|
||||
(s[3] & 0xc0) != 0x80 ||
|
||||
(s[0] == 0xf0 && (s[1] & 0xf0) == 0x80) || /* overlong? */
|
||||
(s[0] == 0xf4 && s[1] > 0x8f) ||
|
||||
s[0] > 0xf4) /* > U+10FFFF? */
|
||||
return false;
|
||||
else
|
||||
s += 4;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static constexpr ConsequencesFactoryType ConsequencesFactory{Normal};
|
||||
|
||||
explicit URIToken(ApplyContext& ctx) : Transactor(ctx)
|
||||
|
||||
@@ -45,6 +45,7 @@
|
||||
#include <ripple/app/tx/impl/SetSignerList.h>
|
||||
#include <ripple/app/tx/impl/SetTrust.h>
|
||||
#include <ripple/app/tx/impl/URIToken.h>
|
||||
#include <ripple/app/tx/impl/Cadastre.h>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
@@ -170,6 +171,13 @@ invoke_preflight(PreflightContext const& ctx)
|
||||
case ttURITOKEN_CREATE_SELL_OFFER:
|
||||
case ttURITOKEN_CANCEL_SELL_OFFER:
|
||||
return invoke_preflight_helper<URIToken>(ctx);
|
||||
case ttCADASTRE_MINT:
|
||||
case ttCADASTRE_BURN:
|
||||
case ttCADASTRE_CREATE_SELL_OFFER:
|
||||
case ttCADASTRE_CANCEL_SELL_OFFER:
|
||||
case ttCADASTRE_BUY:
|
||||
case ttCADASTRE_SET:
|
||||
return invoke_preflight_helper<Cadastre>(ctx);
|
||||
default:
|
||||
assert(false);
|
||||
return {temUNKNOWN, TxConsequences{temUNKNOWN}};
|
||||
@@ -289,6 +297,13 @@ invoke_preclaim(PreclaimContext const& ctx)
|
||||
case ttURITOKEN_CREATE_SELL_OFFER:
|
||||
case ttURITOKEN_CANCEL_SELL_OFFER:
|
||||
return invoke_preclaim<URIToken>(ctx);
|
||||
case ttCADASTRE_MINT:
|
||||
case ttCADASTRE_BURN:
|
||||
case ttCADASTRE_CREATE_SELL_OFFER:
|
||||
case ttCADASTRE_CANCEL_SELL_OFFER:
|
||||
case ttCADASTRE_BUY:
|
||||
case ttCADASTRE_SET:
|
||||
return invoke_preclaim<Cadastre>(ctx);
|
||||
default:
|
||||
assert(false);
|
||||
return temUNKNOWN;
|
||||
@@ -370,6 +385,13 @@ invoke_calculateBaseFee(ReadView const& view, STTx const& tx)
|
||||
case ttURITOKEN_CREATE_SELL_OFFER:
|
||||
case ttURITOKEN_CANCEL_SELL_OFFER:
|
||||
return URIToken::calculateBaseFee(view, tx);
|
||||
case ttCADASTRE_MINT:
|
||||
case ttCADASTRE_BURN:
|
||||
case ttCADASTRE_CREATE_SELL_OFFER:
|
||||
case ttCADASTRE_CANCEL_SELL_OFFER:
|
||||
case ttCADASTRE_BUY:
|
||||
case ttCADASTRE_SET:
|
||||
return Cadastre::calculateBaseFee(view, tx);
|
||||
default:
|
||||
assert(false);
|
||||
return XRPAmount{0};
|
||||
@@ -552,6 +574,15 @@ invoke_apply(ApplyContext& ctx)
|
||||
URIToken p(ctx);
|
||||
return p();
|
||||
}
|
||||
case ttCADASTRE_MINT:
|
||||
case ttCADASTRE_BURN:
|
||||
case ttCADASTRE_CREATE_SELL_OFFER:
|
||||
case ttCADASTRE_CANCEL_SELL_OFFER:
|
||||
case ttCADASTRE_BUY:
|
||||
case ttCADASTRE_SET: {
|
||||
Cadastre p(ctx);
|
||||
return p();
|
||||
}
|
||||
default:
|
||||
assert(false);
|
||||
return {temUNKNOWN, false};
|
||||
|
||||
@@ -297,6 +297,10 @@ import_vlseq(PublicKey const& key) noexcept;
|
||||
Keylet
|
||||
uritoken(AccountID const& issuer, Blob const& uri);
|
||||
|
||||
Keylet
|
||||
cadastre(uint256 const& universe, uint16_t locx, uint16_t locy);
|
||||
|
||||
|
||||
} // namespace keylet
|
||||
|
||||
// Everything below is deprecated and should be removed in favor of keylets:
|
||||
|
||||
@@ -179,6 +179,15 @@ enum LedgerEntryType : std::uint16_t
|
||||
*/
|
||||
ltUNL_REPORT = 0x0052,
|
||||
|
||||
/** A ledger object that contains cadastral information about a unit of virtual land
|
||||
* in a given universe. The block at 0x8000, 0x8000 is the center of the universe
|
||||
* and has special rights and privileges, namely it is the god block whose hooks are
|
||||
* strongly executed whenever dealings with land in that universe occur.
|
||||
*
|
||||
* \sa keylet::cadastre
|
||||
*/
|
||||
ltCADASTRE = 0x004B,
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
/** A special type, matching any ledger entry type.
|
||||
|
||||
|
||||
@@ -354,6 +354,8 @@ extern SF_UINT16 const sfHookStateChangeCount;
|
||||
extern SF_UINT16 const sfHookEmitCount;
|
||||
extern SF_UINT16 const sfHookExecutionIndex;
|
||||
extern SF_UINT16 const sfHookApiVersion;
|
||||
extern SF_UINT16 const sfLocationX;
|
||||
extern SF_UINT16 const sfLocationY;
|
||||
|
||||
// 32-bit integers (common)
|
||||
extern SF_UINT32 const sfNetworkID;
|
||||
@@ -433,6 +435,8 @@ extern SF_UINT64 const sfReferenceCount;
|
||||
extern SF_UINT64 const sfRewardAccumulator;
|
||||
extern SF_UINT64 const sfAccountCount;
|
||||
extern SF_UINT64 const sfAccountIndex;
|
||||
extern SF_UINT64 const sfAssociationNode;
|
||||
extern SF_UINT64 const sfCadastreCount;
|
||||
|
||||
// 128-bit
|
||||
extern SF_UINT128 const sfEmailHash;
|
||||
@@ -483,6 +487,7 @@ extern SF_UINT256 const sfURITokenID;
|
||||
extern SF_UINT256 const sfGovernanceFlags;
|
||||
extern SF_UINT256 const sfGovernanceMarks;
|
||||
extern SF_UINT256 const sfEmittedTxnID;
|
||||
extern SF_UINT256 const sfUniverse;
|
||||
|
||||
// currency amount (common)
|
||||
extern SF_AMOUNT const sfAmount;
|
||||
@@ -537,6 +542,8 @@ extern SF_VL const sfHookReturnString;
|
||||
extern SF_VL const sfHookParameterName;
|
||||
extern SF_VL const sfHookParameterValue;
|
||||
extern SF_VL const sfBlob;
|
||||
extern SF_VL const sfBroadcastURI;
|
||||
extern SF_VL const sfDisplayURI;
|
||||
|
||||
// account
|
||||
extern SF_ACCOUNT const sfAccount;
|
||||
@@ -552,6 +559,7 @@ extern SF_ACCOUNT const sfEmitCallback;
|
||||
// account (uncommon)
|
||||
extern SF_ACCOUNT const sfHookAccount;
|
||||
extern SF_ACCOUNT const sfNFTokenMinter;
|
||||
extern SF_ACCOUNT const sfAssociation;
|
||||
|
||||
// path set
|
||||
extern SField const sfPaths;
|
||||
|
||||
@@ -146,6 +146,15 @@ enum TxType : std::uint16_t
|
||||
ttURITOKEN_CREATE_SELL_OFFER = 48,
|
||||
ttURITOKEN_CANCEL_SELL_OFFER = 49,
|
||||
|
||||
/* This transaction mints, burns or updates cadastral tiles. */
|
||||
ttCADASTRE_MINT = 0x005D, // HookOn = 93
|
||||
ttCADASTRE_BURN = 0x015D,
|
||||
ttCADASTRE_CREATE_SELL_OFFER = 0x025D,
|
||||
ttCADASTRE_CANCEL_SELL_OFFER = 0x035D,
|
||||
ttCADASTRE_BUY = 0x045D,
|
||||
ttCADASTRE_SET = 0x055D,
|
||||
|
||||
|
||||
/** This transaction can only be used by the genesis account, which is controlled exclusively by
|
||||
* rewards/governance hooks, to print new XRP to be delivered directly to an array of destinations,
|
||||
* according to reward schedule */
|
||||
|
||||
@@ -72,6 +72,7 @@ enum class LedgerNameSpace : std::uint16_t {
|
||||
URI_TOKEN = 'U',
|
||||
IMPORT_VLSEQ = 'I',
|
||||
UNL_REPORT = 'R',
|
||||
CADASTRE = 'K',
|
||||
|
||||
// No longer used or supported. Left here to reserve the space
|
||||
// to avoid accidental reuse.
|
||||
@@ -443,6 +444,15 @@ uritoken(AccountID const& issuer, Blob const& uri)
|
||||
LedgerNameSpace::URI_TOKEN, issuer, Slice{uri.data(), uri.size()})};
|
||||
}
|
||||
|
||||
Keylet
|
||||
cadastre(uint256 const& universe, uint16_t locx, uint16_t locy)
|
||||
{
|
||||
return {
|
||||
ltCADASTRE,
|
||||
indexHash(
|
||||
LedgerNameSpace::CADASTRE, universe, locx, locy)};
|
||||
}
|
||||
|
||||
} // namespace keylet
|
||||
|
||||
} // namespace ripple
|
||||
|
||||
@@ -363,6 +363,22 @@ LedgerFormats::LedgerFormats()
|
||||
},
|
||||
commonFields);
|
||||
|
||||
add(jss::Cadastre,
|
||||
ltCADASTRE,
|
||||
{
|
||||
{sfOwner, soeREQUIRED},
|
||||
{sfOwnerNode, soeREQUIRED},
|
||||
{sfAssociation, soeOPTIONAL},
|
||||
{sfAssociationNode, soeOPTIONAL},
|
||||
{sfLocationX, soeREQUIRED},
|
||||
{sfLocationY, soeREQUIRED},
|
||||
{sfUniverse, soeREQUIRED},
|
||||
{sfDisplayURI, soeOPTIONAL},
|
||||
{sfBroadcastURI, soeOPTIONAL},
|
||||
{sfCadastreCount, soeOPTIONAL}, // for 0x8000,0x8000 tile only
|
||||
},
|
||||
commonFields);
|
||||
|
||||
// clang-format on
|
||||
}
|
||||
|
||||
|
||||
@@ -102,6 +102,8 @@ CONSTRUCT_TYPED_SFIELD(sfHookStateChangeCount, "HookStateChangeCount", UINT16,
|
||||
CONSTRUCT_TYPED_SFIELD(sfHookEmitCount, "HookEmitCount", UINT16, 18);
|
||||
CONSTRUCT_TYPED_SFIELD(sfHookExecutionIndex, "HookExecutionIndex", UINT16, 19);
|
||||
CONSTRUCT_TYPED_SFIELD(sfHookApiVersion, "HookApiVersion", UINT16, 20);
|
||||
CONSTRUCT_TYPED_SFIELD(sfLocationX, "LocationX", UINT16, 99);
|
||||
CONSTRUCT_TYPED_SFIELD(sfLocationY, "LocationY", UINT16, 98);
|
||||
|
||||
// 32-bit integers (common)
|
||||
CONSTRUCT_TYPED_SFIELD(sfNetworkID, "NetworkID", UINT32, 1);
|
||||
@@ -183,6 +185,8 @@ CONSTRUCT_TYPED_SFIELD(sfEmitBurden, "EmitBurden", UINT64,
|
||||
CONSTRUCT_TYPED_SFIELD(sfHookInstructionCount, "HookInstructionCount", UINT64, 17);
|
||||
CONSTRUCT_TYPED_SFIELD(sfHookReturnCode, "HookReturnCode", UINT64, 18);
|
||||
CONSTRUCT_TYPED_SFIELD(sfReferenceCount, "ReferenceCount", UINT64, 19);
|
||||
CONSTRUCT_TYPED_SFIELD(sfCadastreCount, "CadastreCount", UINT64, 96);
|
||||
CONSTRUCT_TYPED_SFIELD(sfAssociationNode, "AssociationNode", UINT64, 97);
|
||||
CONSTRUCT_TYPED_SFIELD(sfAccountIndex, "AccountIndex", UINT64, 98);
|
||||
CONSTRUCT_TYPED_SFIELD(sfAccountCount, "AccountCount", UINT64, 99);
|
||||
CONSTRUCT_TYPED_SFIELD(sfRewardAccumulator, "RewardAccumulator", UINT64, 100);
|
||||
@@ -236,6 +240,7 @@ CONSTRUCT_TYPED_SFIELD(sfURITokenID, "URITokenID", UINT256,
|
||||
CONSTRUCT_TYPED_SFIELD(sfGovernanceFlags, "GovernanceFlags", UINT256, 99);
|
||||
CONSTRUCT_TYPED_SFIELD(sfGovernanceMarks, "GovernanceMarks", UINT256, 98);
|
||||
CONSTRUCT_TYPED_SFIELD(sfEmittedTxnID, "EmittedTxnID", UINT256, 97);
|
||||
CONSTRUCT_TYPED_SFIELD(sfUniverse, "Universe", UINT256, 96);
|
||||
|
||||
// currency amount (common)
|
||||
CONSTRUCT_TYPED_SFIELD(sfAmount, "Amount", AMOUNT, 1);
|
||||
@@ -290,6 +295,8 @@ CONSTRUCT_TYPED_SFIELD(sfHookReturnString, "HookReturnString", VL,
|
||||
CONSTRUCT_TYPED_SFIELD(sfHookParameterName, "HookParameterName", VL, 24);
|
||||
CONSTRUCT_TYPED_SFIELD(sfHookParameterValue, "HookParameterValue", VL, 25);
|
||||
CONSTRUCT_TYPED_SFIELD(sfBlob, "Blob", VL, 26);
|
||||
CONSTRUCT_TYPED_SFIELD(sfBroadcastURI, "BroadcastURI", VL, 99);
|
||||
CONSTRUCT_TYPED_SFIELD(sfDisplayURI, "DisplayURI", VL, 98);
|
||||
|
||||
// account
|
||||
CONSTRUCT_TYPED_SFIELD(sfAccount, "Account", ACCOUNT, 1);
|
||||
@@ -305,6 +312,7 @@ CONSTRUCT_TYPED_SFIELD(sfEmitCallback, "EmitCallback", ACCOUNT,
|
||||
|
||||
// account (uncommon)
|
||||
CONSTRUCT_TYPED_SFIELD(sfHookAccount, "HookAccount", ACCOUNT, 16);
|
||||
CONSTRUCT_TYPED_SFIELD(sfAssociation, "Association", ACCOUNT, 99);
|
||||
|
||||
// vector of 256-bit
|
||||
CONSTRUCT_TYPED_SFIELD(sfIndexes, "Indexes", VECTOR256, 1, SField::sMD_Never);
|
||||
|
||||
@@ -441,6 +441,71 @@ TxFormats::TxFormats()
|
||||
{sfTicketSequence, soeOPTIONAL},
|
||||
},
|
||||
commonFields);
|
||||
|
||||
add(jss::CadastreMint,
|
||||
ttCADASTRE_MINT,
|
||||
{
|
||||
{sfDestination, soeOPTIONAL},
|
||||
{sfAmount, soeOPTIONAL},
|
||||
{sfAssociation, soeOPTIONAL},
|
||||
{sfBroadcastURI, soeOPTIONAL},
|
||||
{sfDisplayURI, soeOPTIONAL},
|
||||
{sfLocationX, soeREQUIRED},
|
||||
{sfLocationY, soeREQUIRED},
|
||||
{sfUniverse, soeREQUIRED},
|
||||
},
|
||||
commonFields);
|
||||
|
||||
add(jss::CadastreBurn,
|
||||
ttCADASTRE_BURN,
|
||||
{
|
||||
{sfLocationX, soeREQUIRED},
|
||||
{sfLocationY, soeREQUIRED},
|
||||
{sfUniverse, soeREQUIRED},
|
||||
},
|
||||
commonFields);
|
||||
|
||||
add(jss::CadastreCreateSellOffer,
|
||||
ttCADASTRE_CREATE_SELL_OFFER,
|
||||
{
|
||||
{sfDestination, soeOPTIONAL},
|
||||
{sfAmount, soeREQUIRED},
|
||||
{sfLocationX, soeREQUIRED},
|
||||
{sfLocationY, soeREQUIRED},
|
||||
{sfUniverse, soeREQUIRED},
|
||||
},
|
||||
commonFields);
|
||||
|
||||
add(jss::CadastreCancelSellOffer,
|
||||
ttCADASTRE_CANCEL_SELL_OFFER,
|
||||
{
|
||||
{sfLocationX, soeREQUIRED},
|
||||
{sfLocationY, soeREQUIRED},
|
||||
{sfUniverse, soeREQUIRED},
|
||||
},
|
||||
commonFields);
|
||||
|
||||
add(jss::CadastreBuy,
|
||||
ttCADASTRE_BUY,
|
||||
{
|
||||
{sfAmount, soeREQUIRED},
|
||||
{sfLocationX, soeREQUIRED},
|
||||
{sfLocationY, soeREQUIRED},
|
||||
{sfUniverse, soeREQUIRED},
|
||||
},
|
||||
commonFields);
|
||||
|
||||
add(jss::CadastreSet,
|
||||
ttCADASTRE_SET,
|
||||
{
|
||||
{sfAssociation, soeOPTIONAL},
|
||||
{sfBroadcastURI, soeOPTIONAL},
|
||||
{sfDisplayURI, soeOPTIONAL},
|
||||
{sfLocationX, soeREQUIRED},
|
||||
{sfLocationY, soeREQUIRED},
|
||||
{sfUniverse, soeREQUIRED},
|
||||
},
|
||||
commonFields);
|
||||
}
|
||||
|
||||
TxFormats const&
|
||||
|
||||
@@ -51,6 +51,13 @@ JSS(Amendments); // ledger type.
|
||||
JSS(Amount); // in: TransactionSign; field.
|
||||
JSS(Authorize); // field
|
||||
JSS(Blob);
|
||||
JSS(Cadastre); // ledger type
|
||||
JSS(CadastreMint); // txn type
|
||||
JSS(CadastreBurn); // txn type
|
||||
JSS(CadastreCreateSellOffer); // txn type
|
||||
JSS(CadastreCancelSellOffer); // txn type
|
||||
JSS(CadastreBuy); // txn type
|
||||
JSS(CadastreSet); // txn type
|
||||
JSS(Check); // ledger type.
|
||||
JSS(CheckCancel); // transaction type.
|
||||
JSS(CheckCash); // transaction type.
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
//==============================================================================
|
||||
|
||||
#include <test/jtx/Env.h>
|
||||
#include <ripple/protocol/jss.h>
|
||||
#include <test/jtx/acctdelete.h>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
Reference in New Issue
Block a user