49 const std::string& contract_name,
50 const std::string& contract_path,
51 const std::vector<std::string>& init_params) {
52 auto contract = client->
DeployContract(caller_address, contract_name,
53 contract_path, init_params);
55 printf(
"deploy contract fail\n");
58 LOG(ERROR) <<
"deploy contract:\n" << contract->DebugString();
62 const std::string& contract_address,
63 const std::string& func_name,
64 const std::vector<std::string>& params) {
68 printf(
"execute contract fail\n");
71 LOG(ERROR) <<
"execute result:\n" << *output;
74int main(
int argc,
char** argv) {
76 printf(
"<cmd> -c [config]\n");
80 std::string cmd = argv[1];
81 std::string caller_address, contract_name, contract_path, params,
82 contract_address, func_name;
84 std::string client_config_file;
85 while ((c = getopt(argc, argv,
"m:c:a:n:p:h:f:s:")) != -1) {
88 caller_address = optarg;
91 client_config_file = optarg;
94 contract_name = optarg;
100 contract_path = optarg;
106 contract_address = optarg;
114 printf(
"cmd = %s config path = %s\n", cmd.c_str(),
115 client_config_file.c_str());
116 ResDBConfig config = GenerateResDBConfig(client_config_file);
121 if (cmd ==
"create") {
123 }
else if (cmd ==
"deploy") {
124 std::vector<std::string> init_params;
125 boost::split(init_params, params, boost::is_any_of(
","));
127 DeployContract(&client, caller_address, contract_name, contract_path,
129 }
else if (cmd ==
"execute") {
131 "execute\n caller address:%s\n contract address: %s\n func: %s\n "
133 caller_address.c_str(), contract_address.c_str(), func_name.c_str(),
135 std::vector<std::string> func_params;
136 boost::split(func_params, params, boost::is_any_of(
","));
std::unique_ptr< ResDBConfig > GenerateResDBConfig(const std::string &config_file, const std::string &private_key_file, const std::string &cert_file, std::optional< ReplicaInfo > self_info, std::optional< ConfigGenFunc > gen_func)