Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
YottaChain
YTBP
提交
d933f16a
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,发现更多精彩内容 >>
未验证
提交
d933f16a
编写于
5月 04, 2018
作者:
K
Kevin Heifner
提交者:
GitHub
5月 04, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #2757 from EOSIO/gh#2738-buyram-newaccount
Gh#2738 buyram newaccount
上级
e45c8c08
e26458b0
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
51 addition
and
20 deletion
+51
-20
.gitignore
.gitignore
+13
-15
libraries/chain/include/eosio/chain/symbol.hpp
libraries/chain/include/eosio/chain/symbol.hpp
+2
-2
programs/cleos/main.cpp
programs/cleos/main.cpp
+33
-1
tests/testUtils.py
tests/testUtils.py
+1
-1
unittests/currency_tests.cpp
unittests/currency_tests.cpp
+2
-1
未找到文件。
.gitignore
浏览文件 @
d933f16a
...
...
@@ -10,6 +10,7 @@
*.dot
*.abi.hpp
*.cmake
*.ninja
\#*
\.#*
CMakeCache.txt
...
...
@@ -29,6 +30,9 @@ libraries/egenesis/egenesis_full.cpp
libraries/egenesis/embed_genesis
libraries/types/type_generator
libraries/types/types_test
libraries/fc/test/crypto/test_cypher_suites
libraries/testing/chain_tester
libraries/wallet/Doxyfile
libraries/wallet/api_documentation.cpp
...
...
@@ -39,26 +43,24 @@ libraries/wasm-jit/Source/Programs/Disassemble
libraries/wasm-jit/Source/Programs/Test
libraries/wasm-jit/Source/Programs/wavm
programs/cli_wallet/cli_wallet
programs/cleos/cleos
programs/js_operation_serializer/js_operation_serializer
programs/witness_node/witness_node
programs/data-dir
programs/eos-walletd/eos-walletd
programs/eosiod/eosiod
programs/eosioc/eosioc
programs/launcher/launcher
programs/eosio-abigen/eosio-abigen
programs/cleos/config.hpp
programs/eosio-applesedemo/eosio-applesedemo
programs/eosio-launcher/config.hpp
programs/eosio-launcher/eosio-launcher
programs/keosd/keosd
programs/nodeos/config.hpp
programs/nodeos/nodeos
scripts/tn_init.sh
tests/app_test
tests/chain_bench
tests/chain_test
tests/intense_test
tests/performance_test
tests/plugin_test
tests/config.hpp
unittests/config.hpp
unittests/unit_test
doxygen
...
...
@@ -67,10 +69,6 @@ witness_node_data_dir
*.wallet
programs/witness_node/object_database/*
object_database/*
*.pyc
*.pyo
...
...
libraries/chain/include/eosio/chain/symbol.hpp
浏览文件 @
d933f16a
...
...
@@ -63,10 +63,10 @@ namespace eosio {
static
constexpr
uint8_t
max_precision
=
18
;
explicit
symbol
(
uint8_t
p
,
const
char
*
s
)
:
m_value
(
string_to_symbol
(
p
,
s
))
{
FC_ASSERT
(
valid
(),
"invalid symbol"
,
(
"s"
,
s
));
FC_ASSERT
(
valid
(),
"invalid symbol
: ${s}
"
,
(
"s"
,
s
));
}
explicit
symbol
(
uint64_t
v
=
SY
(
4
,
EOS
))
:
m_value
(
v
)
{
FC_ASSERT
(
valid
(),
"invalid symbol"
,
(
"name"
,
name
()));
FC_ASSERT
(
valid
(),
"invalid symbol
: ${name}
"
,
(
"name"
,
name
()));
}
static
symbol
from_string
(
const
string
&
from
)
{
...
...
programs/cleos/main.cpp
浏览文件 @
d933f16a
...
...
@@ -401,6 +401,24 @@ chain::action create_action(const vector<permission_level>& authorization, const
return
chain
::
action
{
authorization
,
code
,
act
,
result
.
get_object
()[
"binargs"
].
as
<
bytes
>
()};
}
chain
::
action
create_buyram
(
const
name
&
creator
,
const
name
&
newaccount
,
const
asset
&
quantity
)
{
fc
::
variant
act_payload
=
fc
::
mutable_variant_object
()
(
"payer"
,
creator
.
to_string
())
(
"receiver"
,
newaccount
.
to_string
())
(
"quant"
,
quantity
.
to_string
());
return
create_action
(
tx_permission
.
empty
()
?
vector
<
chain
::
permission_level
>
{{
creator
,
config
::
active_name
}}
:
get_account_permissions
(
tx_permission
),
config
::
system_account_name
,
N
(
buyram
),
act_payload
);
}
chain
::
action
create_buyrambytes
(
const
name
&
creator
,
const
name
&
newaccount
,
uint32_t
numbytes
)
{
fc
::
variant
act_payload
=
fc
::
mutable_variant_object
()
(
"payer"
,
creator
.
to_string
())
(
"receiver"
,
newaccount
.
to_string
())
(
"bytes"
,
numbytes
);
return
create_action
(
tx_permission
.
empty
()
?
vector
<
chain
::
permission_level
>
{{
creator
,
config
::
active_name
}}
:
get_account_permissions
(
tx_permission
),
config
::
system_account_name
,
N
(
buyrambytes
),
act_payload
);
}
fc
::
variant
regproducer_variant
(
const
account_name
&
producer
,
public_key_type
key
,
string
url
)
{
...
...
@@ -923,12 +941,18 @@ int main( int argc, char** argv ) {
string
account_name
;
string
owner_key_str
;
string
active_key_str
;
uint32_t
buy_ram_bytes_in_kbytes
=
8
;
string
buy_ram_eos
;
auto
createAccount
=
create
->
add_subcommand
(
"account"
,
localized
(
"Create a new account on the blockchain"
),
false
);
createAccount
->
add_option
(
"creator"
,
creator
,
localized
(
"The name of the account creating the new account"
))
->
required
();
createAccount
->
add_option
(
"name"
,
account_name
,
localized
(
"The name of the new account"
))
->
required
();
createAccount
->
add_option
(
"OwnerKey"
,
owner_key_str
,
localized
(
"The owner public key for the new account"
))
->
required
();
createAccount
->
add_option
(
"ActiveKey"
,
active_key_str
,
localized
(
"The active public key for the new account"
))
->
required
();
createAccount
->
add_option
(
"--buy-ram-bytes"
,
buy_ram_bytes_in_kbytes
,
(
localized
(
"The amount of RAM bytes to purchase for the new account in kilobytes KiB, default is 8 KiB"
)));
createAccount
->
add_option
(
"--buy-ram-EOS"
,
buy_ram_eos
,
(
localized
(
"The amount of RAM bytes to purchase for the new account in EOS"
)));
add_standard_transaction_options
(
createAccount
,
"creator@active"
);
createAccount
->
set_callback
([
&
]
{
public_key_type
owner_key
,
active_key
;
...
...
@@ -938,7 +962,15 @@ int main( int argc, char** argv ) {
try
{
active_key
=
public_key_type
(
active_key_str
);
}
EOS_RETHROW_EXCEPTIONS
(
public_key_type_exception
,
"Invalid active public key: ${public_key}"
,
(
"public_key"
,
active_key_str
))
if
(
!
buy_ram_eos
.
empty
()
)
{
action
buyact
=
create_buyram
(
creator
,
account_name
,
asset
::
from_string
(
buy_ram_eos
));
send_actions
({
create_newaccount
(
creator
,
account_name
,
owner_key
,
active_key
),
buyact
});
}
else
if
(
buy_ram_bytes_in_kbytes
>
0
){
action
buyact
=
create_buyrambytes
(
creator
,
account_name
,
buy_ram_bytes_in_kbytes
*
1024
*
1024
);
send_actions
({
create_newaccount
(
creator
,
account_name
,
owner_key
,
active_key
),
buyact
});
}
else
{
send_actions
({
create_newaccount
(
creator
,
account_name
,
owner_key
,
active_key
)});
}
});
// Get subcommand
...
...
tests/testUtils.py
浏览文件 @
d933f16a
...
...
@@ -488,7 +488,7 @@ class Node(object):
# Create account and return creation transactions. Return transaction json object
# waitForTransBlock: wait on creation transaction id to appear in a block
def
createAccount
(
self
,
account
,
creatorAccount
,
stakedDeposit
=
1000
,
waitForTransBlock
=
False
):
cmd
=
"%s %s create account -j %s %s %s %s"
%
(
cmd
=
"%s %s create account -j
--buy-ram-bytes 0
%s %s %s %s"
%
(
Utils
.
EosClientPath
,
self
.
endpointArgs
,
creatorAccount
.
name
,
account
.
name
,
account
.
ownerPublicKey
,
account
.
activePublicKey
)
...
...
unittests/currency_tests.cpp
浏览文件 @
d933f16a
...
...
@@ -43,6 +43,7 @@ class currency_tester : public TESTER {
signed_transaction
trx
;
trx
.
actions
.
emplace_back
(
std
::
move
(
act
));
set_transaction_headers
(
trx
);
trx
.
sign
(
get_private_key
(
signer
,
"active"
),
chain_id_type
());
return
push_transaction
(
trx
);
...
...
@@ -316,7 +317,7 @@ BOOST_FIXTURE_TEST_CASE(test_symbol, TESTER) try {
// invalid - contains lower case characters, no validation
{
BOOST_CHECK_EXCEPTION
(
symbol
malformed
(
SY
(
6
,
EoS
)),
fc
::
assert_exception
,
fc_assert_exception_message_is
(
"invalid symbol"
));
fc
::
assert_exception
,
fc_assert_exception_message_is
(
"invalid symbol
: EoS
"
));
}
// invalid - contains lower case characters, exception thrown
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录