Skip to content

Commit

Permalink
Use decimal string to represent the ERC721 PropertyID and ERC721 Toke…
Browse files Browse the repository at this point in the history
…nID in remain function
  • Loading branch information
ludete committed Nov 15, 2018
1 parent 0edb894 commit a738a6e
Showing 1 changed file with 15 additions and 20 deletions.
35 changes: 15 additions & 20 deletions src/omnicore/rpcpayload.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ UniValue whc_createpayload_issueERC721property(const Config &config,const JSONRP
UniValue whc_createpayload_issueERC721token(const Config &config,const JSONRPCRequest &request){
if (request.fHelp || request.params.size() > 4 || request.params.size() < 3)
throw runtime_error(
"whc_createpayload_issueERC721token \"0x01\" \"0x02\" \"0x03\" \"url\" \n"
"whc_createpayload_issueERC721token \"1\" \"2\" \"0x03\" \"url\" \n"
"\nCreates the payload to issue ERC721 property\n"
"Argument:\n"
"1. propertyID (string, required) The ID of the special property that will be issued token \n"
Expand All @@ -444,16 +444,15 @@ UniValue whc_createpayload_issueERC721token(const Config &config,const JSONRPCRe
"\"payload\" (string) the hex-encoded payload\n"

"\nExamples:\n"
+ HelpExampleCli("whc_createpayload_issueERC721token", "\"0x01\" \"0x02\" \"0x03\" \"url\" ")
+ HelpExampleRpc("whc_createpayload_issueERC721token", "\"0x01\" \"0x02\" \"0x03\" \"url\" ")
+ HelpExampleCli("whc_createpayload_issueERC721token", "\"1\" \"2\" \"0x03\" \"url\" ")
+ HelpExampleRpc("whc_createpayload_issueERC721token", "\"1\" \"2\" \"0x03\" \"url\" ")
);

int i = 0;
uint256 propertyid = uint256S(request.params[i++].get_str());
uint256 propertyid = uint256S(convertDecToHex(request.params[i++].get_str()));
uint256 tokenid;
if(request.params.size() == 4){
RequireHexNumber(request.params[i].get_str());
tokenid = uint256S(request.params[i++].get_str());
tokenid = uint256S(convertDecToHex(request.params[i++].get_str()));
}
RequireHexNumber(request.params[i].get_str());
uint256 tokenAttributes = uint256S(request.params[i++].get_str());
Expand All @@ -467,23 +466,21 @@ UniValue whc_createpayload_issueERC721token(const Config &config,const JSONRPCRe
UniValue whc_createpayload_transferERC721token(const Config &config,const JSONRPCRequest &request){
if (request.fHelp || request.params.size() != 2)
throw runtime_error(
"whc_createpayload_transferERC721token \"0x01\" \"0x02\" \n"
"whc_createpayload_transferERC721token \"1\" \"2\" \n"
"\nburn BCH to get WHC"
"\nArguments:\n"
"1. propertyID (string, required) The propertyid within the token that will be transfer \n"
"2. tokenID (string, optional) The tokenid that will be transfer\n"
"\nResult:\n"
"\"hash\" (string) the hex-encoded transaction hash\n"
"\nExamples:\n"
+ HelpExampleCli("whc_createpayload_transferERC721token", " \"0x01\" \"0x02\" ")
+ HelpExampleRpc("whc_createpayload_transferERC721token", " \"0x01\" \"0x02\" ")
+ HelpExampleCli("whc_createpayload_transferERC721token", " \"1\" \"2\" ")
+ HelpExampleRpc("whc_createpayload_transferERC721token", " \"1\" \"2\" ")
);

int i = 0;
RequireHexNumber(request.params[i].get_str());
uint256 propertyid = uint256S(request.params[i++].get_str());
RequireHexNumber(request.params[i].get_str());
uint256 tokenid = uint256S(request.params[i++].get_str());
uint256 propertyid = uint256S(convertDecToHex(request.params[i++].get_str()));
uint256 tokenid = uint256S(convertDecToHex(request.params[i++].get_str()));

std::vector<unsigned char> payload = CreatePayload_TransferERC721Token(propertyid, tokenid);

Expand All @@ -493,23 +490,21 @@ UniValue whc_createpayload_transferERC721token(const Config &config,const JSONRP
UniValue whc_createpayload_destroyERC721token(const Config &config,const JSONRPCRequest &request){
if (request.fHelp || request.params.size() != 2)
throw runtime_error(
"whc_createpayload_destroyERC721token \"0x01\" \"0x02\" \n"
"whc_createpayload_destroyERC721token \"1\" \"2\" \n"
"\nburn BCH to get WHC"
"\nArguments:\n"
"1. propertyID (string, required) The token within the property that will be destroy \n"
"2. tokenID (string, optional) The tokenid that will be destroy\n"
"\nResult:\n"
"\"hash\" (string) the hex-encoded transaction hash\n"
"\nExamples:\n"
+ HelpExampleCli("whc_createpayload_destroyERC721token", " \"0x01\" \"0x02\" ")
+ HelpExampleRpc("whc_createpayload_destroyERC721token", " \"0x01\" \"0x02\" ")
+ HelpExampleCli("whc_createpayload_destroyERC721token", " \"1\" \"2\" ")
+ HelpExampleRpc("whc_createpayload_destroyERC721token", " \"1\" \"2\" ")
);

int i = 0;
RequireHexNumber(request.params[i].get_str());
uint256 propertyid = uint256S(request.params[i++].get_str());
RequireHexNumber(request.params[i].get_str());
uint256 tokenid = uint256S(request.params[i++].get_str());
uint256 propertyid = uint256S(convertDecToHex(request.params[i++].get_str()));
uint256 tokenid = uint256S(convertDecToHex(request.params[i++].get_str()));

std::vector<unsigned char> payload = CreatePayload_DestroyERC721Token(propertyid, tokenid);

Expand Down

0 comments on commit a738a6e

Please sign in to comment.