Skip to content

Commit

Permalink
Disable NFT RPCs until activation
Browse files Browse the repository at this point in the history
  • Loading branch information
dexX7 committed Oct 4, 2022
1 parent 7862b52 commit b5ac2ab
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/omnicore/rpc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,10 @@ UniValue omni_getnonfungibletokens(const JSONRPCRequest& request)
}
}.Check(request);

if (!IsFeatureActivated(FEATURE_NFTS, GetHeight())) {
throw JSONRPCError(RPC_INTERNAL_ERROR, "NFTs not activated");
}

std::string address = ParseAddress(request.params[0]);
uint32_t propertyId{0};
if (!request.params[1].isNull()) {
Expand Down Expand Up @@ -264,6 +268,10 @@ UniValue omni_getnonfungibletokendata(const JSONRPCRequest& request)
}
}.Check(request);

if (!IsFeatureActivated(FEATURE_NFTS, GetHeight())) {
throw JSONRPCError(RPC_INTERNAL_ERROR, "NFTs not activated");
}

uint32_t propertyId = ParsePropertyId(request.params[0]);

RequireExistingProperty(propertyId);
Expand Down Expand Up @@ -352,6 +360,10 @@ UniValue omni_getnonfungibletokenranges(const JSONRPCRequest& request)
}
}.Check(request);

if (!IsFeatureActivated(FEATURE_NFTS, GetHeight())) {
throw JSONRPCError(RPC_INTERNAL_ERROR, "NFTs not activated");
}

uint32_t propertyId = ParsePropertyId(request.params[0]);

RequireExistingProperty(propertyId);
Expand Down
12 changes: 12 additions & 0 deletions src/omnicore/rpctx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,10 @@ static UniValue omni_sendnonfungible(const JSONRPCRequest& request)
}
}.Check(request);

if (!IsFeatureActivated(FEATURE_NFTS, GetHeight())) {
throw JSONRPCError(RPC_INTERNAL_ERROR, "NFTs not activated");
}

std::string fromAddress = ParseAddress(request.params[0]);
std::string toAddress = ParseAddress(request.params[1]);
uint32_t propertyId = ParsePropertyId(request.params[2]);
Expand Down Expand Up @@ -375,6 +379,10 @@ static UniValue omni_setnonfungibledata(const JSONRPCRequest& request)
}
}.Check(request);

if (!IsFeatureActivated(FEATURE_NFTS, GetHeight())) {
throw JSONRPCError(RPC_INTERNAL_ERROR, "NFTs not activated");
}

uint32_t propertyId = ParsePropertyId(request.params[0]);
uint64_t tokenStart = request.params[1].get_int64();
int64_t tokenEnd = request.params[2].get_int64();
Expand Down Expand Up @@ -1149,6 +1157,10 @@ static UniValue omni_sendissuancemanaged(const JSONRPCRequest& request)
std::string url = ParseText(request.params[7]);
std::string data = ParseText(request.params[8]);

if (type == 5 && !IsFeatureActivated(FEATURE_NFTS, GetHeight())) {
throw JSONRPCError(RPC_INTERNAL_ERROR, "NFTs not activated");
}

// perform checks
RequirePropertyName(name);

Expand Down

0 comments on commit b5ac2ab

Please sign in to comment.