Browse Source

MofN address

pull/4/head
jl777 6 years ago
parent
commit
da629dfe5a
  1. 19
      src/cc/CCcustom.cpp
  2. 2
      src/cc/CCutils.cpp
  3. 10
      src/cc/eval.h
  4. 3
      src/rpcserver.cpp
  5. 1
      src/rpcserver.h
  6. 13
      src/wallet/rpcwallet.cpp

19
src/cc/CCcustom.cpp

@ -128,6 +128,17 @@ uint8_t AuctionCCpriv[32] = { 0x8c, 0x1b, 0xb7, 0x8c, 0x02, 0xa3, 0x9d, 0x21, 0x
#undef FUNCNAME
#undef EVALCODE
// MofN
#define FUNCNAME IsMofNInput
#define EVALCODE EVAL_MOFN
const char *MofNCCaddr = "RL4YPX7JYG3FnvoPqWF2pn3nQknH5NWEwx";
const char *MofNNormaladdr = "RTPwUjKYECcGn6Y4KYChLhgaht1RSU4jwf";
char MofNCChexstr[67] = { "03c91bef3d7cc59c3a89286833a3446b29e52a5e773f738a1ad2b09785e5f4179e" };
uint8_t MofNCCpriv[32] = { 0x8c, 0x1b, 0xb7, 0x8c, 0x02, 0xa3, 0x9d, 0x21, 0x28, 0x59, 0xf5, 0xea, 0xda, 0xec, 0x0d, 0x11, 0xcd, 0x38, 0x47, 0xac, 0x0b, 0x6f, 0x19, 0xc0, 0x24, 0x36, 0xbf, 0x1c, 0x0a, 0x06, 0x31, 0xfb };
#include "CCcustom.inc"
#undef FUNCNAME
#undef EVALCODE
struct CCcontract_info *CCinit(struct CCcontract_info *cp,uint8_t evalcode)
{
cp->evalcode = evalcode;
@ -189,6 +200,14 @@ struct CCcontract_info *CCinit(struct CCcontract_info *cp,uint8_t evalcode)
cp->validate = AuctionValidate;
cp->ismyvin = IsAuctionInput;
break;
case EVAL_MofN:
strcpy(cp->unspendableCCaddr,MofNCCaddr);
strcpy(cp->normaladdr,MofNNormaladdr);
strcpy(cp->CChexstr,MofNCChexstr);
memcpy(cp->CCpriv,MofNCCpriv,32);
cp->validate = MofNValidate;
cp->ismyvin = IsMofNInput;
break;
}
return(cp);
}

2
src/cc/CCutils.cpp

@ -231,7 +231,7 @@ bool Myprivkey(uint8_t myprivkey[])
if ( pwalletMain->GetKey(keyID,vchSecret) != 0 )
{
memcpy(myprivkey,vchSecret.begin(),32);
if ( 0 )
if ( 1 )
{
for (i=0; i<32; i++)
fprintf(stderr,"0x%02x, ",myprivkey[i]);

10
src/cc/eval.h

@ -46,7 +46,15 @@
EVAL(EVAL_DICE, 0xe6) \
EVAL(EVAL_FSM, 0xe7) \
EVAL(EVAL_AUCTION, 0xe8) \
EVAL(EVAL_LOTTO, 0xe9)
EVAL(EVAL_LOTTO, 0xe9) \
EVAL(EVAL_MOFN, 0xea) \
EVAL(EVAL_CHANNELS, 0xeb) \
EVAL(EVAL_ORACLES, 0xec) \
EVAL(EVAL_PRICES, 0xed) \
EVAL(EVAL_PEGS, 0xee) \
EVAL(EVAL_TRIGGERS, 0xef) \
EVAL(EVAL_PAYMENTS, 0xf0) \
EVAL(EVAL_GATEWAYS, 0xf1)
typedef uint8_t EvalCode;

3
src/rpcserver.cpp

@ -371,6 +371,9 @@ static const CRPCCommand vRPCCommands[] =
{ "faucet", "faucetget", &faucetget, true },
{ "faucet", "faucetaddress", &faucetaddress, true },
/* MofN */
{ "MofN", "mofnaddress", &mofnaddress, true },
/* dice */
{ "dice", "dicelist", &dicelist, true },
{ "dice", "diceinfo", &diceinfo, true },

1
src/rpcserver.h

@ -221,6 +221,7 @@ extern UniValue tokenfillbid(const UniValue& params, bool fHelp);
extern UniValue tokenask(const UniValue& params, bool fHelp);
extern UniValue tokencancelask(const UniValue& params, bool fHelp);
extern UniValue tokenfillask(const UniValue& params, bool fHelp);
extern UniValue mofnaddress(const UniValue& params, bool fHelp);
//extern UniValue tokenswapask(const UniValue& params, bool fHelp);
//extern UniValue tokenfillswap(const UniValue& params, bool fHelp);
extern UniValue faucetfund(const UniValue& params, bool fHelp);

13
src/wallet/rpcwallet.cpp

@ -4873,6 +4873,19 @@ UniValue CCaddress(struct CCcontract_info *cp,char *name,std::vector<unsigned ch
return(result);
}
UniValue mofnaddress(const UniValue& params, bool fHelp)
{
struct CCcontract_info *cp,C; std::vector<unsigned char> pubkey;
cp = CCinit(&C,EVAL_MOFN);
if ( fHelp || params.size() > 1 )
throw runtime_error("mofnaddress [pubkey]\n");
if ( ensure_CCrequirements() < 0 )
throw runtime_error("to use CC contracts, you need to launch daemon with valid -pubkey= for an address in your wallet\n");
if ( params.size() == 1 )
pubkey = ParseHex(params[0].get_str().c_str());
return(CCaddress(cp,(char *)"Lotto",pubkey));
}
UniValue lottoaddress(const UniValue& params, bool fHelp)
{
struct CCcontract_info *cp,C; std::vector<unsigned char> pubkey;

Loading…
Cancel
Save