]> Git Repo - VerusCoin.git/blob - src/cc/CCcustom.cpp
19772a8f7e247bcb6bfb1f7f629a871da2923b25
[VerusCoin.git] / src / cc / CCcustom.cpp
1 /******************************************************************************
2  * Copyright © 2014-2018 The SuperNET Developers.                             *
3  *                                                                            *
4  * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at                  *
5  * the top-level directory of this distribution for the individual copyright  *
6  * holder information and the developer policies on copyright and licensing.  *
7  *                                                                            *
8  * Unless otherwise agreed in a custom licensing agreement, no part of the    *
9  * SuperNET software, including this file may be copied, modified, propagated *
10  * or distributed except according to the terms contained in the LICENSE file *
11  *                                                                            *
12  * Removal or modification of this copyright notice is prohibited.            *
13  *                                                                            *
14  ******************************************************************************/
15
16 #include "key_io.h"
17 #include "CCinclude.h"
18 #include "CCassets.h"
19 #include "CCfaucet.h"
20 #include "CCrewards.h"
21 #include "CCdice.h"
22 #include "CCauction.h"
23 #include "CClotto.h"
24 #include "CCfsm.h"
25 #include "CCMofN.h"
26 #include "CCchannels.h"
27 #include "CCOracles.h"
28 #include "CCPrices.h"
29 #include "CCPegs.h"
30 #include "CCTriggers.h"
31 #include "CCPayments.h"
32 #include "CCGateways.h"
33 #include "StakeGuard.h"
34 #include "pbaas/crosschainrpc.h"
35 #include "pbaas/pbaas.h"
36 #include "pbaas/notarization.h"
37
38 /*
39  CCcustom has most of the functions that need to be extended to create a new CC contract.
40  
41  A CC scriptPubKey can only be spent if it is properly signed and validated. By constraining the vins and vouts, it is possible to implement a variety of functionality. CC vouts have an otherwise non-standard form, but it is properly supported by the enhanced bitcoin protocol code as a "cryptoconditions" output and the same pubkey will create a different address.
42  
43  This allows creation of a special address(es) for each contract type, which has the privkey public. That allows anybody to properly sign and spend it, but with the constraints on what is allowed in the validation code, the contract functionality can be implemented.
44  
45  what needs to be done to add a new contract:
46  1. add EVAL_CODE to eval.h
47  2. initialize the variables in the CCinit function below
48  3. write a Validate function to reject any unsanctioned usage of vin/vout
49  4. make helper functions to create rawtx for RPC functions
50  5. add rpc calls to rpcserver.cpp and rpcserver.h and in one of the rpc.cpp files
51  6. add the new .cpp files to src/Makefile.am
52  
53  IMPORTANT: make sure that all CC inputs and CC outputs are properly accounted for and reconcile to the satoshi. The built in utxo management will enforce overall vin/vout constraints but it wont know anything about the CC constraints. That is what your Validate function needs to do.
54  
55  Generally speaking, there will be normal coins that change into CC outputs, CC outputs that go back to being normal coins, CC outputs that are spent to new CC outputs.
56  
57  Make sure both the CC coins and normal coins are preserved and follow the rules that make sense. It is a good idea to define specific roles for specific vins and vouts to reduce the complexity of validation.
58  */
59
60 // to create a new CCaddr, add to rpcwallet the CCaddress and start with -pubkey= with the pubkey of the new address, with its wif already imported. set normaladdr and CChexstr. run CCaddress and it will print the privkey along with autocorrect the CCaddress. which should then update the CCaddr here
61
62 // StakeGuard - nothing at stake
63 std::string StakeGuardAddr = "RCG8KwJNDVwpUBcdoa6AoHqHVJsA1uMYMR";
64 std::string StakeGuardPubKey = "03166b7813a4855a88e9ef7340a692ef3c2decedfdc2c7563ec79537e89667d935";
65 std::string StakeGuardWIF = "Uw7vRYHGKjyi1FaJ8Lv1USSuj7ntUti8fAhSDiCdbzuV6yDagaTn";
66
67 // defines the currency characteristics of a PBaaS currency that will be the native coins of a PBaaS chain
68 std::string PBaaSDefinitionAddr = "RP7id3CzCnwvzNUZesYJM6ekvsxpEzMqB1";
69 std::string PBaaSDefinitionPubKey = "02a0de91740d3d5a3a4a7990ae22315133d02f33716b339ebce88662d012224ef5";
70 std::string PBaaSDefinitionWIF = "UwhNWARAQTUvYUEqxGbRjM2BFUneGnFzmaMMiSqJQZFQZTku6xTW";
71
72 // StakeGuard - nothing at stake
73 std::string EarnedNotarizationAddr = "RMYbaxFsCT1xfMmwLCCYAVf2DsxcDTtBmx";
74 std::string EarnedNotarizationPubKey = "03fb008879b37d644bef929576dda7f5ee31b352c76fc112b4a89838d5b61f52e2";
75 std::string EarnedNotarizationWIF = "UtzhFWXw24xS2Tf3gCDm9p2Ex7TUnCNt4DFA7r2f5cCKPhPknEqD";
76
77 // StakeGuard - nothing at stake
78 std::string AcceptedNotarizationAddr = "RDTq9qn1Lthv7fvsdbWz36mGp8HK9XaruZ";
79 std::string AcceptedNotarizationPubKey = "02d85f078815b7a52faa92639c3691d2a640e26c4e06de54dd1490f0e93bcc11c3";
80 std::string AcceptedNotarizationWIF = "UtgbVEYs2PShTMffbkYh8bgo9DYsXr8JuqWVjAYHRt2ebGPeP5Mf";
81
82 // StakeGuard - nothing at stake
83 std::string FinalizeNotarizationAddr = "RRbKYitLH9EhQCvCo4bPZqJx3TWxASadxE";
84 std::string FinalizeNotarizationPubKey = "02e3154f8122ff442fbca3ff8ff4d4fb2d9285fd9f4d841d58fb8d6b7acefed60f";
85 std::string FinalizeNotarizationWIF = "UrN1b1hCQc6cUpcUdQD7DFTn2PJneDpKv5pmURPQzJ2zVp9UVM6E";
86
87 // StakeGuard - nothing at stake
88 std::string ServiceRewardAddr = "RQWMeecjGFF3ZAVeSimRbyG9iMDUHPY5Ny";
89 std::string ServiceRewardPubKey = "03e1894e9d487125be5a8c6657a8ce01bc81ba7816d698dbfcfb0483754eb5a2d9";
90 std::string ServiceRewardWIF = "Uw5dNvvgz7eyUJGtfi696hYbF9YPXHPHasgZFeQeDu8j4SapPBzd";
91
92 // StakeGuard - nothing at stake
93 std::string ReserveOutputAddr = "RMXeZGxxRuABFkT4uLSCeuJHLegBNGZq8D";
94 std::string ReserveOutputPubKey = "02d3e0f4c308c6e9786a5280ec96ea6d0e07505bae88d28b4b3156c309e2ae5515";
95 std::string ReserveOutputWIF = "UrCfRxuFKPg3b3HtPFhvL9X8iePfETRZpgymrxzdDZ3vpjSwHrxH";
96
97 // StakeGuard - nothing at stake
98 std::string ReserveExportAddr = "RTqQe58LSj2yr5CrwYFwcsAQ1edQwmrkUU";
99 std::string ReserveExportPubKey = "0367add5577ca8f5f680ee0adf4cf802584c56ed14956efedd3e18656874614548";
100 std::string ReserveExportWIF = "UtbtjjXtNtYroASwDrW63pEK7Fv3ehBRGDc2GRkPPr292DkRTmtB";
101
102 // StakeGuard - nothing at stake
103 std::string ReserveImportAddr = "";
104 std::string ReserveImportPubKey = "";
105 std::string ReserveImportWIF = "";
106
107 // Assets, aka Tokens
108 #define FUNCNAME IsAssetsInput
109 #define EVALCODE EVAL_ASSETS
110 const char *AssetsCCaddr = "RGKRjeTBw4LYFotSDLT6RWzMHbhXri6BG6";
111 const char *AssetsNormaladdr = "RFYE2yL3KknWdHK6uNhvWacYsCUtwzjY3u";
112 char AssetsCChexstr[67] = { "02adf84e0e075cf90868bd4e3d34a03420e034719649c41f371fc70d8e33aa2702" };
113 uint8_t AssetsCCpriv[32] = { 0x9b, 0x17, 0x66, 0xe5, 0x82, 0x66, 0xac, 0xb6, 0xba, 0x43, 0x83, 0x74, 0xf7, 0x63, 0x11, 0x3b, 0xf0, 0xf3, 0x50, 0x6f, 0xd9, 0x6b, 0x67, 0x85, 0xf9, 0x7a, 0xf0, 0x54, 0x4d, 0xb1, 0x30, 0x77 };
114
115 #include "CCcustom.inc"
116 #undef FUNCNAME
117 #undef EVALCODE
118
119 // Faucet
120 #define FUNCNAME IsFaucetInput
121 #define EVALCODE EVAL_FAUCET
122 const char *FaucetCCaddr = "R9zHrofhRbub7ER77B7NrVch3A63R39GuC";
123 const char *FaucetNormaladdr = "RKQV4oYs4rvxAWx1J43VnT73rSTVtUeckk";
124 char FaucetCChexstr[67] = { "03682b255c40d0cde8faee381a1a50bbb89980ff24539cb8518e294d3a63cefe12" };
125 uint8_t FaucetCCpriv[32] = { 0xd4, 0x4f, 0xf2, 0x31, 0x71, 0x7d, 0x28, 0x02, 0x4b, 0xc7, 0xdd, 0x71, 0xa0, 0x39, 0xc4, 0xbe, 0x1a, 0xfe, 0xeb, 0xc2, 0x46, 0xda, 0x76, 0xf8, 0x07, 0x53, 0x3d, 0x96, 0xb4, 0xca, 0xa0, 0xe9 };
126
127 #include "CCcustom.inc"
128 #undef FUNCNAME
129 #undef EVALCODE
130
131 // Rewards
132 #define FUNCNAME IsRewardsInput
133 #define EVALCODE EVAL_REWARDS
134 const char *RewardsCCaddr = "RTsRBYL1HSvMoE3qtBJkyiswdVaWkm8YTK";
135 const char *RewardsNormaladdr = "RMgye9jeczNjQx9Uzq8no8pTLiCSwuHwkz";
136 char RewardsCChexstr[67] = { "03da60379d924c2c30ac290d2a86c2ead128cb7bd571f69211cb95356e2dcc5eb9" };
137 uint8_t RewardsCCpriv[32] = { 0x82, 0xf5, 0xd2, 0xe7, 0xd6, 0x99, 0x33, 0x77, 0xfb, 0x80, 0x00, 0x97, 0x23, 0x3d, 0x1e, 0x6f, 0x61, 0xa9, 0xb5, 0x2e, 0x5e, 0xb4, 0x96, 0x6f, 0xbc, 0xed, 0x6b, 0xe2, 0xbb, 0x7b, 0x4b, 0xb3 };
138 #include "CCcustom.inc"
139 #undef FUNCNAME
140 #undef EVALCODE
141
142 // Dice
143 #define FUNCNAME IsDiceInput
144 #define EVALCODE EVAL_DICE
145 const char *DiceCCaddr = "REabWB7KjFN5C3LFMZ5odExHPenYzHLtVw";
146 const char *DiceNormaladdr = "RLEe8f7Eg3TDuXii9BmNiiiaVGraHUt25c";
147 char DiceCChexstr[67] = { "039d966927cfdadab3ee6c56da63c21f17ea753dde4b3dfd41487103e24b27e94e" };
148 uint8_t DiceCCpriv[32] = { 0x0e, 0xe8, 0xf5, 0xb4, 0x3d, 0x25, 0xcc, 0x35, 0xd1, 0xf1, 0x2f, 0x04, 0x5f, 0x01, 0x26, 0xb8, 0xd1, 0xac, 0x3a, 0x5a, 0xea, 0xe0, 0x25, 0xa2, 0x8f, 0x2a, 0x8e, 0x0e, 0xf9, 0x34, 0xfa, 0x77 };
149 #include "CCcustom.inc"
150 #undef FUNCNAME
151 #undef EVALCODE
152
153 // Lotto
154 #define FUNCNAME IsLottoInput
155 #define EVALCODE EVAL_LOTTO
156 const char *LottoCCaddr = "RNXZxgyWSAE6XS3qGnTaf5dVNCxnYzhPrg";
157 const char *LottoNormaladdr = "RLW6hhRqBZZMBndnyPv29Yg3krh6iBYCyg";
158 char LottoCChexstr[67] = { "03f72d2c4db440df1e706502b09ca5fec73ffe954ea1883e4049e98da68690d98f" };
159 uint8_t LottoCCpriv[32] = { 0xb4, 0xac, 0xc2, 0xd9, 0x67, 0x34, 0xd7, 0x58, 0x80, 0x4e, 0x25, 0x55, 0xc0, 0x50, 0x66, 0x84, 0xbb, 0xa2, 0xe7, 0xc0, 0x39, 0x17, 0xb4, 0xc5, 0x07, 0xb7, 0x3f, 0xca, 0x07, 0xb0, 0x9a, 0xeb };
160 #include "CCcustom.inc"
161 #undef FUNCNAME
162 #undef EVALCODE
163
164 // Finite State Machine
165 #define FUNCNAME IsFSMInput
166 #define EVALCODE EVAL_FSM
167 const char *FSMCCaddr = "RUKTbLBeKgHkm3Ss4hKZP3ikuLW1xx7B2x";
168 const char *FSMNormaladdr = "RWSHRbxnJYLvDjpcQ2i8MekgP6h2ctTKaj";
169 char FSMCChexstr[67] = { "039b52d294b413b07f3643c1a28c5467901a76562d8b39a785910ae0a0f3043810" };
170 uint8_t FSMCCpriv[32] = { 0x11, 0xe1, 0xea, 0x3e, 0xdb, 0x36, 0xf0, 0xa8, 0xc6, 0x34, 0xe1, 0x21, 0xb8, 0x02, 0xb9, 0x4b, 0x12, 0x37, 0x8f, 0xa0, 0x86, 0x23, 0x50, 0xb2, 0x5f, 0xe4, 0xe7, 0x36, 0x0f, 0xda, 0xae, 0xfc };
171 #include "CCcustom.inc"
172 #undef FUNCNAME
173 #undef EVALCODE
174
175 // Auction
176 #define FUNCNAME IsAuctionInput
177 #define EVALCODE EVAL_AUCTION
178 const char *AuctionCCaddr = "RL4YPX7JYG3FnvoPqWF2pn3nQknH5NWEwx";
179 const char *AuctionNormaladdr = "RFtVDNmdTZBTNZdmFRbfBgJ6LitgTghikL";
180 char AuctionCChexstr[67] = { "037eefe050c14cb60ae65d5b2f69eaa1c9006826d729bc0957bdc3024e3ca1dbe6" };
181 uint8_t AuctionCCpriv[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 };
182 #include "CCcustom.inc"
183 #undef FUNCNAME
184 #undef EVALCODE
185
186 // MofN
187 #define FUNCNAME IsMofNInput
188 #define EVALCODE EVAL_MOFN
189 const char *MofNCCaddr = "RDVHcSekmXgeYBqRupNTmqo3Rn8QRXNduy";
190 const char *MofNNormaladdr = "RTPwUjKYECcGn6Y4KYChLhgaht1RSU4jwf";
191 char MofNCChexstr[67] = { "03c91bef3d7cc59c3a89286833a3446b29e52a5e773f738a1ad2b09785e5f4179e" };
192 uint8_t MofNCCpriv[32] = { 0x9d, 0xa1, 0xf8, 0xf7, 0xba, 0x0a, 0x91, 0x36, 0x89, 0x9a, 0x86, 0x30, 0x63, 0x20, 0xd7, 0xdf, 0xaa, 0x35, 0xe3, 0x99, 0x32, 0x2b, 0x63, 0xc0, 0x66, 0x9c, 0x93, 0xc4, 0x5e, 0x9d, 0xb9, 0xce };
193 #include "CCcustom.inc"
194 #undef FUNCNAME
195 #undef EVALCODE
196
197 // Channels
198 #define FUNCNAME IsChannelsInput
199 #define EVALCODE EVAL_CHANNELS
200 const char *ChannelsCCaddr = "RQy3rwX8sP9oDm3c39vGKA6H315cgtPLfr";
201 const char *ChannelsNormaladdr = "RQUuT8zmkvDfXqECH4m3VD3SsHZAfnoh1v";
202 char ChannelsCChexstr[67] = { "035debdb19b1c98c615259339500511d6216a3ffbeb28ff5655a7ef5790a12ab0b" };
203 uint8_t ChannelsCCpriv[32] = { 0xec, 0x91, 0x36, 0x15, 0x2d, 0xd4, 0x48, 0x73, 0x22, 0x36, 0x4f, 0x6a, 0x34, 0x5c, 0x61, 0x0f, 0x01, 0xb4, 0x79, 0xe8, 0x1c, 0x2f, 0xa1, 0x1d, 0x4a, 0x0a, 0x21, 0x16, 0xea, 0x82, 0x84, 0x60 };
204 #include "CCcustom.inc"
205 #undef FUNCNAME
206 #undef EVALCODE
207
208 // Oracles
209 #define FUNCNAME IsOraclesInput
210 #define EVALCODE EVAL_ORACLES
211 const char *OraclesCCaddr = "REt2C4ZMnX8YYX1DRpffNA4hECZTFm39e3";
212 const char *OraclesNormaladdr = "RHkFKzn1csxA3fWzAsxsLWohoCgBbirXb5";
213 char OraclesCChexstr[67] = { "038c1d42db6a45a57eccb8981b078fb7857b9b496293fe299d2b8d120ac5b5691a" };
214 uint8_t OraclesCCpriv[32] = { 0xf7, 0x4b, 0x5b, 0xa2, 0x7a, 0x5e, 0x9c, 0xda, 0x89, 0xb1, 0xcb, 0xb9, 0xe6, 0x9c, 0x2c, 0x70, 0x85, 0x37, 0xdd, 0x00, 0x7a, 0x67, 0xff, 0x7c, 0x62, 0x1b, 0xe2, 0xfb, 0x04, 0x8f, 0x85, 0xbf };
215 #include "CCcustom.inc"
216 #undef FUNCNAME
217 #undef EVALCODE
218
219 // Prices
220 #define FUNCNAME IsPricesInput
221 #define EVALCODE EVAL_PRICES
222 const char *PricesCCaddr = "RAL5Vh8NXmFqEKJRKrk1KjKaUckK7mM1iS";
223 const char *PricesNormaladdr = "RBunXCsMHk5NPd6q8SQfmpgre3x133rSwZ";
224 char PricesCChexstr[67] = { "039894cb054c0032e99e65e715b03799607aa91212a16648d391b6fa2cc52ed0cf" };
225 uint8_t PricesCCpriv[32] = { 0x0a, 0x3b, 0xe7, 0x5d, 0xce, 0x06, 0xed, 0xb7, 0xc0, 0xb1, 0xbe, 0xe8, 0x7b, 0x5a, 0xd4, 0x99, 0xb8, 0x8d, 0xde, 0xac, 0xb2, 0x7e, 0x7a, 0x52, 0x96, 0x15, 0xd2, 0xa0, 0xc6, 0xb9, 0x89, 0x61 };
226 #include "CCcustom.inc"
227 #undef FUNCNAME
228 #undef EVALCODE
229
230 // Pegs
231 #define FUNCNAME IsPegsInput
232 #define EVALCODE EVAL_PEGS
233 const char *PegsCCaddr = "RHnkVb7vHuHnjEjhkCF1bS6xxLLNZPv5fd";
234 const char *PegsNormaladdr = "RMcCZtX6dHf1fz3gpLQhUEMQ8cVZ6Rzaro";
235 char PegsCChexstr[67] = { "03c75c1de29a35e41606363b430c08be1c2dd93cf7a468229a082cc79c7b77eece" };
236 uint8_t PegsCCpriv[32] = { 0x52, 0x56, 0x4c, 0x78, 0x87, 0xf7, 0xa2, 0x39, 0xb0, 0x90, 0xb7, 0xb8, 0x62, 0x80, 0x0f, 0x83, 0x18, 0x9d, 0xf4, 0xf4, 0xbd, 0x28, 0x09, 0xa9, 0x9b, 0x85, 0x54, 0x16, 0x0f, 0x3f, 0xfb, 0x65 };
237 #include "CCcustom.inc"
238 #undef FUNCNAME
239 #undef EVALCODE
240
241 // Triggers
242 #define FUNCNAME IsTriggersInput
243 #define EVALCODE EVAL_TRIGGERS
244 const char *TriggersCCaddr = "RGLSRDnUqTB43bYtRtNVgmwSSd1sun2te8";
245 const char *TriggersNormaladdr = "RMN25Tn8NNzcyQDiQNuMp8UmwLMFd9thYc";
246 char TriggersCChexstr[67] = { "03afc5be570d0ff419425cfcc580cc762ab82baad88c148f5b028d7db7bfeee61d" };
247 uint8_t TriggersCCpriv[32] = { 0x7c, 0x0b, 0x54, 0x9b, 0x65, 0xd4, 0x89, 0x57, 0xdf, 0x05, 0xfe, 0xa2, 0x62, 0x41, 0xa9, 0x09, 0x0f, 0x2a, 0x6b, 0x11, 0x2c, 0xbe, 0xbd, 0x06, 0x31, 0x8d, 0xc0, 0xb9, 0x96, 0x76, 0x3f, 0x24 };
248 #include "CCcustom.inc"
249 #undef FUNCNAME
250 #undef EVALCODE
251
252 // Payments
253 #define FUNCNAME IsPaymentsInput
254 #define EVALCODE EVAL_PAYMENTS
255 const char *PaymentsCCaddr = "REpyKi7avsVduqZ3eimncK4uKqSArLTGGK";
256 const char *PaymentsNormaladdr = "RHRX8RTMAh2STWe9DHqsvJbzS7ty6aZy3d";
257 char PaymentsCChexstr[67] = { "0358f1764f82c63abc7c7455555fd1d3184905e30e819e97667e247e5792b46856" };
258 uint8_t PaymentsCCpriv[32] = { 0x03, 0xc9, 0x73, 0xc2, 0xb8, 0x30, 0x3d, 0xbd, 0xc8, 0xd9, 0xbf, 0x02, 0x49, 0xd9, 0x65, 0x61, 0x45, 0xed, 0x9e, 0x93, 0x51, 0xab, 0x8b, 0x2e, 0xe7, 0xc7, 0x40, 0xf1, 0xc4, 0xd2, 0xc0, 0x5b };
259 #include "CCcustom.inc"
260 #undef FUNCNAME
261 #undef EVALCODE
262
263 // Gateways
264 #define FUNCNAME IsGatewaysInput
265 #define EVALCODE EVAL_GATEWAYS
266 const char *GatewaysCCaddr = "RKWpoK6vTRtq5b9qrRBodLkCzeURHeEk33";
267 const char *GatewaysNormaladdr = "RGJKV97ZN1wBfunuMt1tebiiHENNEq73Yh";
268 char GatewaysCChexstr[67] = { "03ea9c062b9652d8eff34879b504eda0717895d27597aaeb60347d65eed96ccb40" };
269 uint8_t GatewaysCCpriv[32] = { 0xf7, 0x4b, 0x5b, 0xa2, 0x7a, 0x5e, 0x9c, 0xda, 0x89, 0xb1, 0xcb, 0xb9, 0xe6, 0x9c, 0x2c, 0x70, 0x85, 0x37, 0xdd, 0x00, 0x7a, 0x67, 0xff, 0x7c, 0x62, 0x1b, 0xe2, 0xfb, 0x04, 0x8f, 0x85, 0xbf };
270 #include "CCcustom.inc"
271 #undef FUNCNAME
272 #undef EVALCODE
273
274 struct CCcontract_info *CCinit(struct CCcontract_info *cp, uint8_t evalcode)
275 {
276     cp->evalcode = evalcode;
277     switch ( evalcode )
278     {
279         case EVAL_STAKEGUARD:
280             strcpy(cp->unspendableCCaddr,StakeGuardAddr.c_str());
281             strcpy(cp->normaladdr,StakeGuardAddr.c_str());
282             strcpy(cp->CChexstr,StakeGuardPubKey.c_str());
283             memcpy(cp->CCpriv,DecodeSecret(StakeGuardWIF).begin(),32);
284             cp->validate = StakeGuardValidate;
285             cp->ismyvin = IsStakeGuardInput;  // TODO: these input functions are not correct and should be as above with FUNCNAME/EVALCODE
286             break;
287
288         case EVAL_PBAASDEFINITION:
289             strcpy(cp->unspendableCCaddr,PBaaSDefinitionAddr.c_str());
290             strcpy(cp->normaladdr,PBaaSDefinitionAddr.c_str());
291             strcpy(cp->CChexstr,PBaaSDefinitionPubKey.c_str());
292             memcpy(cp->CCpriv,DecodeSecret(PBaaSDefinitionWIF).begin(),32);
293             cp->validate = ValidateChainDefinition;
294             cp->ismyvin = IsChainDefinitionInput;
295             break;
296
297         case EVAL_EARNEDNOTARIZATION:
298             strcpy(cp->unspendableCCaddr,EarnedNotarizationAddr.c_str());
299             strcpy(cp->normaladdr,EarnedNotarizationAddr.c_str());
300             strcpy(cp->CChexstr,EarnedNotarizationPubKey.c_str());
301             memcpy(cp->CCpriv,DecodeSecret(EarnedNotarizationWIF).begin(),32);
302             cp->validate = ValidateEarnedNotarization;
303             cp->ismyvin = IsEarnedNotarizationInput;
304             break;
305
306         case EVAL_ACCEPTEDNOTARIZATION:
307             strcpy(cp->unspendableCCaddr,AcceptedNotarizationAddr.c_str());
308             strcpy(cp->normaladdr,AcceptedNotarizationAddr.c_str());
309             strcpy(cp->CChexstr,AcceptedNotarizationPubKey.c_str());
310             memcpy(cp->CCpriv,DecodeSecret(AcceptedNotarizationWIF).begin(),32);
311             cp->validate = ValidateAcceptedNotarization;
312             cp->ismyvin = IsAcceptedNotarizationInput;
313             break;
314
315         case EVAL_FINALIZENOTARIZATION:
316             strcpy(cp->unspendableCCaddr,FinalizeNotarizationAddr.c_str());
317             strcpy(cp->normaladdr,FinalizeNotarizationAddr.c_str());
318             strcpy(cp->CChexstr,FinalizeNotarizationPubKey.c_str());
319             memcpy(cp->CCpriv,DecodeSecret(FinalizeNotarizationWIF).begin(),32);
320             cp->validate = ValidateFinalizeNotarization;
321             cp->ismyvin = IsFinalizeNotarizationInput;
322             break;
323
324         case EVAL_SERVICEREWARD:
325             strcpy(cp->unspendableCCaddr,ServiceRewardAddr.c_str());
326             strcpy(cp->normaladdr,ServiceRewardAddr.c_str());
327             strcpy(cp->CChexstr,ServiceRewardPubKey.c_str());
328             memcpy(cp->CCpriv,DecodeSecret(ServiceRewardWIF).begin(),32);
329             cp->validate = ValidateServiceReward;
330             cp->ismyvin = IsServiceRewardInput;
331             break;
332
333         case EVAL_RESERVEIMPORT:
334         case EVAL_RESERVEEXPORT:
335         case EVAL_RESERVEOUTPUT:
336             assert(false);
337             break;
338
339         case EVAL_ASSETS:
340             strcpy(cp->unspendableCCaddr,AssetsCCaddr);
341             strcpy(cp->normaladdr,AssetsNormaladdr);
342             strcpy(cp->CChexstr,AssetsCChexstr);
343             memcpy(cp->CCpriv,AssetsCCpriv,32);
344             cp->validate = AssetsValidate;
345             cp->ismyvin = IsAssetsInput;
346             break;
347         case EVAL_FAUCET:
348             strcpy(cp->unspendableCCaddr,FaucetCCaddr);
349             strcpy(cp->normaladdr,FaucetNormaladdr);
350             strcpy(cp->CChexstr,FaucetCChexstr);
351             memcpy(cp->CCpriv,FaucetCCpriv,32);
352             cp->validate = FaucetValidate;
353             cp->ismyvin = IsFaucetInput;
354             break;
355         case EVAL_REWARDS:
356             strcpy(cp->unspendableCCaddr,RewardsCCaddr);
357             strcpy(cp->normaladdr,RewardsNormaladdr);
358             strcpy(cp->CChexstr,RewardsCChexstr);
359             memcpy(cp->CCpriv,RewardsCCpriv,32);
360             cp->validate = RewardsValidate;
361             cp->ismyvin = IsRewardsInput;
362             break;
363         case EVAL_DICE:
364             strcpy(cp->unspendableCCaddr,DiceCCaddr);
365             strcpy(cp->normaladdr,DiceNormaladdr);
366             strcpy(cp->CChexstr,DiceCChexstr);
367             memcpy(cp->CCpriv,DiceCCpriv,32);
368             cp->validate = DiceValidate;
369             cp->ismyvin = IsDiceInput;
370             break;
371         case EVAL_LOTTO:
372             strcpy(cp->unspendableCCaddr,LottoCCaddr);
373             strcpy(cp->normaladdr,LottoNormaladdr);
374             strcpy(cp->CChexstr,LottoCChexstr);
375             memcpy(cp->CCpriv,LottoCCpriv,32);
376             cp->validate = LottoValidate;
377             cp->ismyvin = IsLottoInput;
378             break;
379         case EVAL_FSM:
380             strcpy(cp->unspendableCCaddr,FSMCCaddr);
381             strcpy(cp->normaladdr,FSMNormaladdr);
382             strcpy(cp->CChexstr,FSMCChexstr);
383             memcpy(cp->CCpriv,FSMCCpriv,32);
384             cp->validate = FSMValidate;
385             cp->ismyvin = IsFSMInput;
386             break;
387         case EVAL_AUCTION:
388             strcpy(cp->unspendableCCaddr,AuctionCCaddr);
389             strcpy(cp->normaladdr,AuctionNormaladdr);
390             strcpy(cp->CChexstr,AuctionCChexstr);
391             memcpy(cp->CCpriv,AuctionCCpriv,32);
392             cp->validate = AuctionValidate;
393             cp->ismyvin = IsAuctionInput;
394             break;
395         case EVAL_MOFN:
396             strcpy(cp->unspendableCCaddr,MofNCCaddr);
397             strcpy(cp->normaladdr,MofNNormaladdr);
398             strcpy(cp->CChexstr,MofNCChexstr);
399             memcpy(cp->CCpriv,MofNCCpriv,32);
400             cp->validate = MofNValidate;
401             cp->ismyvin = IsMofNInput;
402             break;
403         case EVAL_CHANNELS:
404             strcpy(cp->unspendableCCaddr,ChannelsCCaddr);
405             strcpy(cp->normaladdr,ChannelsNormaladdr);
406             strcpy(cp->CChexstr,ChannelsCChexstr);
407             memcpy(cp->CCpriv,ChannelsCCpriv,32);
408             cp->validate = ChannelsValidate;
409             cp->ismyvin = IsChannelsInput;
410             break;
411         case EVAL_ORACLES:
412             strcpy(cp->unspendableCCaddr,OraclesCCaddr);
413             strcpy(cp->normaladdr,OraclesNormaladdr);
414             strcpy(cp->CChexstr,OraclesCChexstr);
415             memcpy(cp->CCpriv,OraclesCCpriv,32);
416             cp->validate = OraclesValidate;
417             cp->ismyvin = IsOraclesInput;
418             break;
419         case EVAL_PRICES:
420             strcpy(cp->unspendableCCaddr,PricesCCaddr);
421             strcpy(cp->normaladdr,PricesNormaladdr);
422             strcpy(cp->CChexstr,PricesCChexstr);
423             memcpy(cp->CCpriv,PricesCCpriv,32);
424             cp->validate = PricesValidate;
425             cp->ismyvin = IsPricesInput;
426             break;
427         case EVAL_PEGS:
428             strcpy(cp->unspendableCCaddr,PegsCCaddr);
429             strcpy(cp->normaladdr,PegsNormaladdr);
430             strcpy(cp->CChexstr,PegsCChexstr);
431             memcpy(cp->CCpriv,PegsCCpriv,32);
432             cp->validate = PegsValidate;
433             cp->ismyvin = IsPegsInput;
434             break;
435         case EVAL_TRIGGERS:
436             strcpy(cp->unspendableCCaddr,TriggersCCaddr);
437             strcpy(cp->normaladdr,TriggersNormaladdr);
438             strcpy(cp->CChexstr,TriggersCChexstr);
439             memcpy(cp->CCpriv,TriggersCCpriv,32);
440             cp->validate = TriggersValidate;
441             cp->ismyvin = IsTriggersInput;
442             break;
443         case EVAL_PAYMENTS:
444             strcpy(cp->unspendableCCaddr,PaymentsCCaddr);
445             strcpy(cp->normaladdr,PaymentsNormaladdr);
446             strcpy(cp->CChexstr,PaymentsCChexstr);
447             memcpy(cp->CCpriv,PaymentsCCpriv,32);
448             cp->validate = PaymentsValidate;
449             cp->ismyvin = IsPaymentsInput;
450             break;
451         case EVAL_GATEWAYS:
452             strcpy(cp->unspendableCCaddr,GatewaysCCaddr);
453             strcpy(cp->normaladdr,GatewaysNormaladdr);
454             strcpy(cp->CChexstr,GatewaysCChexstr);
455             memcpy(cp->CCpriv,GatewaysCCpriv,32);
456             cp->validate = GatewaysValidate;
457             cp->ismyvin = IsGatewaysInput;
458             break;
459
460     }
461     return(cp);
462 }
This page took 0.066575 seconds and 2 git commands to generate.