Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
YottaChain
YTBP
提交
102a0990
Y
YTBP
项目概览
YottaChain
/
YTBP
通知
0
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Y
YTBP
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
102a0990
编写于
6月 04, 2018
作者:
K
Kayan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add cleos command for name bidding
上级
00168f0b
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
70 addition
and
0 deletion
+70
-0
contracts/eosio.system/eosio.system.abi
contracts/eosio.system/eosio.system.abi
+15
-0
programs/cleos/main.cpp
programs/cleos/main.cpp
+55
-0
未找到文件。
contracts/eosio.system/eosio.system.abi
浏览文件 @
102a0990
...
...
@@ -398,6 +398,15 @@
{"name":"base", "type":"connector"},
{"name":"quote", "type":"connector"}
]
}, {
"name": "namebid_info",
"base": "",
"fields": [
{"name":"newname", "type":"account_name"},
{"name":"high_bidder", "type":"account_name"},
{"name":"high_bid", "type":"int64"},
{"name":"last_bid_time", "type":"uint64"}
]
}
],
"actions": [{
...
...
@@ -559,6 +568,12 @@
"index_type": "i64",
"key_names" : ["owner"],
"key_types" : ["uint64"]
},{
"name": "namebids",
"type": "namebid_info",
"index_type": "i64",
"key_names" : ["newname"],
"key_types" : ["account_name"]
}
],
"ricardian_clauses": [],
...
...
programs/cleos/main.cpp
浏览文件 @
102a0990
...
...
@@ -1133,6 +1133,59 @@ struct undelegate_bandwidth_subcommand {
}
};
struct
bidname_subcommand
{
string
bidder_str
;
string
newname_str
;
string
bid_amount
;
bidname_subcommand
(
CLI
::
App
*
actionRoot
)
{
auto
bidname
=
actionRoot
->
add_subcommand
(
"bidname"
,
localized
(
"Name bidding"
));
bidname
->
add_option
(
"bidder"
,
bidder_str
,
localized
(
"The bidding account"
))
->
required
();
bidname
->
add_option
(
"newname"
,
newname_str
,
localized
(
"The bidding name"
))
->
required
();
bidname
->
add_option
(
"bid"
,
bid_amount
,
localized
(
"The amount of EOS to bid"
))
->
required
();
add_standard_transaction_options
(
bidname
);
bidname
->
set_callback
([
this
]
{
fc
::
variant
act_payload
=
fc
::
mutable_variant_object
()
(
"bidder"
,
bidder_str
)
(
"newname"
,
newname_str
)
(
"bid"
,
to_asset
(
bid_amount
));
send_actions
({
create_action
({
permission_level
{
bidder_str
,
config
::
active_name
}},
config
::
system_account_name
,
N
(
bidname
),
act_payload
)});
});
}
};
struct
bidname_info_subcommand
{
bool
print_json
=
false
;
string
newname_str
;
bidname_info_subcommand
(
CLI
::
App
*
actionRoot
)
{
auto
list_producers
=
actionRoot
->
add_subcommand
(
"bidnameinfo"
,
localized
(
"Get bidname info"
));
list_producers
->
add_flag
(
"--json,-j"
,
print_json
,
localized
(
"Output in JSON format"
));
list_producers
->
add_option
(
"newname"
,
newname_str
,
localized
(
"The bidding name"
))
->
required
();
list_producers
->
set_callback
([
this
]
{
auto
rawResult
=
call
(
get_table_func
,
fc
::
mutable_variant_object
(
"json"
,
true
)
(
"code"
,
"eosio"
)(
"scope"
,
"eosio"
)(
"table"
,
"namebids"
)
(
"lower_bound"
,
eosio
::
chain
::
string_to_name
(
newname_str
.
c_str
()))(
"limit"
,
1
));
if
(
print_json
)
{
std
::
cout
<<
fc
::
json
::
to_pretty_string
(
rawResult
)
<<
std
::
endl
;
return
;
}
auto
result
=
rawResult
.
as
<
eosio
::
chain_apis
::
read_only
::
get_table_rows_result
>
();
if
(
result
.
rows
.
empty
()
)
{
std
::
cout
<<
"No bidname record found"
<<
std
::
endl
;
return
;
}
for
(
auto
&
row
:
result
.
rows
)
{
fc
::
time_point
time
(
fc
::
microseconds
(
row
[
"last_bid_time"
].
as_uint64
()));
int64_t
bid
=
row
[
"high_bid"
].
as_int64
();
std
::
cout
<<
std
::
left
<<
std
::
setw
(
18
)
<<
"bidname:"
<<
std
::
right
<<
std
::
setw
(
24
)
<<
row
[
"newname"
].
as_string
()
<<
"
\n
"
<<
std
::
left
<<
std
::
setw
(
18
)
<<
"highest bidder:"
<<
std
::
right
<<
std
::
setw
(
24
)
<<
row
[
"high_bidder"
].
as_string
()
<<
"
\n
"
<<
std
::
left
<<
std
::
setw
(
18
)
<<
"highest bid:"
<<
std
::
right
<<
std
::
setw
(
24
)
<<
(
bid
>
0
?
bid
:
-
bid
)
<<
"
\n
"
<<
std
::
left
<<
std
::
setw
(
18
)
<<
"last bid time:"
<<
std
::
right
<<
std
::
setw
(
24
)
<<
((
std
::
string
)
time
).
c_str
()
<<
std
::
endl
;
if
(
bid
<
0
)
std
::
cout
<<
"This auction has already closed"
<<
std
::
endl
;
}
});
}
};
struct
list_bw_subcommand
{
eosio
::
name
account
;
bool
print_json
=
false
;
...
...
@@ -2555,6 +2608,8 @@ int main( int argc, char** argv ) {
auto
delegateBandWidth
=
delegate_bandwidth_subcommand
(
system
);
auto
undelegateBandWidth
=
undelegate_bandwidth_subcommand
(
system
);
auto
listBandWidth
=
list_bw_subcommand
(
system
);
auto
bidname
=
bidname_subcommand
(
system
);
auto
bidnameinfo
=
bidname_info_subcommand
(
system
);
auto
biyram
=
buyram_subcommand
(
system
);
auto
sellram
=
sellram_subcommand
(
system
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录