MCPcopy Create free account
hub / github.com/WaykiChain/WaykiChain / submitdexoperatorregtx

Function submitdexoperatorregtx

src/rpc/rpcdex.cpp:954–1008  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

952}
953
954Value submitdexoperatorregtx(const Array& params, bool fHelp){
955
956 if (fHelp || params.size() < 9 || params.size() > 11){
957 throw runtime_error(
958 "submitdexoperatorregtx \"sender\" \"owner_uid\" \"fee_receiver_uid\" \"dex_name\" \"portal_url\" "
959 "\"open_mode\" maker_fee_ratio taker_fee_ratio [\"fees\"] [\"memo\"]\n"
960 "\nregister a dex operator\n"
961 "\nArguments:\n"
962 "1.\"sender\": (string required) the tx sender's address\n"
963 "2.\"owner_uid\": (string, required) the dexoperator 's owner account \n"
964 "3.\"fee_receiver_uid\":(string, required) the dexoperator 's fee receiver account \n"
965 "4.\"dex_name\": (string, required) dex operator's name \n"
966 "5.\"portal_url\": (string, required) the dex operator's website url \n"
967 "6.\"open_mode\": (string, required) indicate the order is PUBLIC or PRIVATE\n"
968 "7.\"maker_fee_ratio\": (number, required) range is 0 ~ 50000000, 50000000 stand for 50% \n"
969 "8.\"taker_fee_ratio\": (number, required) range is 0 ~ 50000000, 50000000 stand for 50% \n"
970 "9.\"order_open_dexop_list\": (array of number, required) order open dexop list, max size is 500\n"
971 "10.\"fee\": (symbol:fee:unit, optional) tx fee,default is the min fee for the tx type \n"
972 "11 \"memo\": (string, optional) dex memo \n"
973 "\nResult:\n"
974 "\"txHash\" (string) The transaction id.\n"
975
976 "\nExamples:\n"
977 + HelpExampleCli("submitdexoperatorregtx", "\"0-1\" \"0-1\" \"0-2\" \"wayki-dex\" \"http://www.wayki-dex.com\" \"PRIVATE\" 2000000 2000000 '[0,1]'")
978 + "\nAs json rpc call\n"
979 + HelpExampleRpc("submitdexoperatorregtx", "\"0-1\", \"0-1\", \"0-2\", \"wayki-dex\", "
980 "\"http://www.wayki-dex.com\", \"PRIVATE\", 2000000, 2000000, [0, 1]")
981
982 );
983 }
984
985 EnsureWalletIsUnlocked();
986 const CUserID &userId = RPC_PARAM::GetUserId(params[0].get_str(),true);
987 CDEXOperatorRegisterTx::Data data;
988 data.owner_uid = RPC_PARAM::GetUserId(params[1].get_str());
989 data.fee_receiver_uid = RPC_PARAM::GetUserId(params[2].get_str());
990 CheckAccountRegId(data.owner_uid, "owner_uid");
991 CheckAccountRegId(data.fee_receiver_uid, "fee_receiver_uid");
992 data.name = params[3].get_str();
993 data.portal_url = params[4].get_str();
994 data.order_open_mode = RPC_PARAM::GetOrderOpenMode(params[5]);
995 data.maker_fee_ratio = AmountToRawValue(params[6]);
996 data.taker_fee_ratio = AmountToRawValue(params[7]);
997 data.order_open_dexop_list = RPC_PARAM::GetOrderOpenDexopList(params[8]);
998 ComboMoney fee = RPC_PARAM::GetFee(params, 9, DEX_OPERATOR_REGISTER_TX);
999 data.memo = RPC_PARAM::GetMemo(params, 10);
1000
1001 // Get account for checking balance
1002 CAccount account = RPC_PARAM::GetUserAccount(*pCdMan->pAccountCache, userId);
1003 RPC_PARAM::CheckAccountBalance(account, fee.symbol, SUB_FREE, fee.GetAmountInSawi());
1004 int32_t validHeight = chainActive.Height();
1005
1006 CDEXOperatorRegisterTx tx(userId, validHeight, fee.symbol, fee.GetAmountInSawi(), data);
1007 return SubmitTx(account.keyid, tx);
1008}
1009
1010Value submitdexopupdatetx(const Array& params, bool fHelp){
1011

Callers

nothing calls this directly

Calls 12

HelpExampleCliFunction · 0.85
HelpExampleRpcFunction · 0.85
EnsureWalletIsUnlockedFunction · 0.85
CheckAccountRegIdFunction · 0.85
GetOrderOpenModeFunction · 0.85
AmountToRawValueFunction · 0.85
GetOrderOpenDexopListFunction · 0.85
GetMemoFunction · 0.85
SubmitTxFunction · 0.85
GetAmountInSawiMethod · 0.80
HeightMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected