Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
YottaChain
YTBP
提交
04d4b400
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,发现更多精彩内容 >>
未验证
提交
04d4b400
编写于
3月 19, 2019
作者:
L
luchiagogogo
提交者:
GitHub
3月 19, 2019
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #4 from big4david/feature/ytaseo
Feature/ytaseo
上级
63ffb524
0e4d4825
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
25 addition
and
25 deletion
+25
-25
testnet.template
testnet.template
+6
-6
tests/Node.py
tests/Node.py
+5
-5
tests/get_table_tests.cpp
tests/get_table_tests.cpp
+14
-14
未找到文件。
testnet.template
浏览文件 @
04d4b400
...
...
@@ -19,7 +19,7 @@ wdurl=http://$wdaddr
# bioshost=$BIOS_HOSTNAME
# biosport=$BIOS_HTTP_PORT
# cnt_dir=$CONTRACT_DIR
#
sys
=$SYS_CONTRACT
#
YTA
=$SYS_CONTRACT
# where $BIOS_HOSTNAME is replaced by the hostname portion of the http-server-address configured
# for the nodeos instance running to bios producer
# ------ DO NOT ALTER THE NEXT LINE -------
...
...
@@ -56,7 +56,7 @@ wcmd () {
}
cacmd
()
{
programs/cleos/cleos
--wallet-url
$wdurl
--url
http://
$bioshost
:
$biosport
system newaccount
--transfer
--stake-net
"10000000.0000
SYS"
--stake-cpu
"10000000.0000 SYS"
--buy-ram
"10000000.0000 SYS
"
eosio
$*
>>
$logfile
2>&1
programs/cleos/cleos
--wallet-url
$wdurl
--url
http://
$bioshost
:
$biosport
system newaccount
--transfer
--stake-net
"10000000.0000
YTA"
--stake-cpu
"10000000.0000 YTA"
--buy-ram
"10000000.0000 YTA
"
eosio
$*
>>
$logfile
2>&1
ecmd system regproducer
$1
$2
ecmd system voteproducer prods
$1
$1
}
...
...
@@ -99,11 +99,11 @@ ecmd set contract eosio.msig contracts/eosio.msig eosio.msig.wasm eosio.msig.abi
ecmd
set
contract eosio.sudo contracts/eosio.sudo eosio.sudo.wasm eosio.sudo.abi
echo
=====
Start:
$step
============
>>
$logfile
echo
executing: cleos
--wallet-url
$wdurl
--url
http://
$bioshost
:
$biosport
push action eosio.token create
'[ "eosio", "10000000000.0000
SYS
" ]'
-p
eosio.token |
tee
-a
$logfile
echo
executing: cleos
--wallet-url
$wdurl
--url
http://
$bioshost
:
$biosport
push action eosio.token issue
'[ "eosio", "1000000000.0000
SYS
", "memo" ]'
-p
eosio |
tee
-a
$logfile
echo
executing: cleos
--wallet-url
$wdurl
--url
http://
$bioshost
:
$biosport
push action eosio.token create
'[ "eosio", "10000000000.0000
YTA
" ]'
-p
eosio.token |
tee
-a
$logfile
echo
executing: cleos
--wallet-url
$wdurl
--url
http://
$bioshost
:
$biosport
push action eosio.token issue
'[ "eosio", "1000000000.0000
YTA
", "memo" ]'
-p
eosio |
tee
-a
$logfile
echo
-----------------------
>>
$logfile
programs/cleos/cleos
--wallet-url
$wdurl
--url
http://
$bioshost
:
$biosport
push action eosio.token create
'[ "eosio", "10000000000.0000
SYS
" ]'
-p
eosio.token
>>
$logfile
2>&1
programs/cleos/cleos
--wallet-url
$wdurl
--url
http://
$bioshost
:
$biosport
push action eosio.token issue
'[ "eosio", "1000000000.0000
SYS
", "memo" ]'
-p
eosio
>>
$logfile
2>&1
programs/cleos/cleos
--wallet-url
$wdurl
--url
http://
$bioshost
:
$biosport
push action eosio.token create
'[ "eosio", "10000000000.0000
YTA
" ]'
-p
eosio.token
>>
$logfile
2>&1
programs/cleos/cleos
--wallet-url
$wdurl
--url
http://
$bioshost
:
$biosport
push action eosio.token issue
'[ "eosio", "1000000000.0000
YTA
", "memo" ]'
-p
eosio
>>
$logfile
2>&1
echo
====
End:
$step
==============
>>
$logfile
step
=
$((
$step
+
1
))
...
...
tests/Node.py
浏览文件 @
04d4b400
...
...
@@ -720,7 +720,7 @@ class Node(object):
@
staticmethod
def
currencyStrToInt
(
balanceStr
):
"""Converts currency string of form "12.3456
SYS
" to int 123456"""
"""Converts currency string of form "12.3456
YTA
" to int 123456"""
assert
(
isinstance
(
balanceStr
,
str
))
balanceStr
=
balanceStr
.
split
()[
0
]
#balance=int(decimal.Decimal(balanceStr[1:])*10000)
...
...
@@ -730,7 +730,7 @@ class Node(object):
@
staticmethod
def
currencyIntToStr
(
balance
,
symbol
):
"""Converts currency int of form 123456 to string "12.3456
SYS" where SYS
is symbol string"""
"""Converts currency int of form 123456 to string "12.3456
YTA" where YTA
is symbol string"""
assert
(
isinstance
(
balance
,
int
))
assert
(
isinstance
(
symbol
,
str
))
balanceStr
=
"%.04f %s"
%
(
balance
/
10000.0
,
symbol
)
...
...
@@ -738,7 +738,7 @@ class Node(object):
return
balanceStr
def
validateFunds
(
self
,
initialBalances
,
transferAmount
,
source
,
accounts
):
"""Validate each account has the expected
SYS
balance. Validate cumulative balance matches expectedTotal."""
"""Validate each account has the expected
YTA
balance. Validate cumulative balance matches expectedTotal."""
assert
(
source
)
assert
(
isinstance
(
source
,
Account
))
assert
(
accounts
)
...
...
@@ -849,7 +849,7 @@ class Node(object):
return
servants
def
getAccountEosBalanceStr
(
self
,
scope
):
"""Returns
SYS currency0000 account balance from cleos get table command. Returned balance is string following syntax "98.0311 SYS
". """
"""Returns
YTA currency0000 account balance from cleos get table command. Returned balance is string following syntax "98.0311 YTA
". """
assert
isinstance
(
scope
,
str
)
amount
=
self
.
getTableAccountBalance
(
"eosio.token"
,
scope
)
if
Utils
.
Debug
:
Utils
.
Print
(
"getNodeAccountEosBalance %s %s"
%
(
scope
,
amount
))
...
...
@@ -857,7 +857,7 @@ class Node(object):
return
amount
def
getAccountEosBalance
(
self
,
scope
):
"""Returns
SYS
currency0000 account balance from cleos get table command. Returned balance is an integer e.g. 980311. """
"""Returns
YTA
currency0000 account balance from cleos get table command. Returned balance is an integer e.g. 980311. """
balanceStr
=
self
.
getAccountEosBalanceStr
(
scope
)
balance
=
Node
.
currencyStrToInt
(
balanceStr
)
return
balance
...
...
tests/get_table_tests.cpp
浏览文件 @
04d4b400
...
...
@@ -58,14 +58,14 @@ BOOST_FIXTURE_TEST_CASE( get_scope_test, TESTER ) try {
// create currency
auto
act
=
mutable_variant_object
()
(
"issuer"
,
"eosio"
)
(
"maximum_supply"
,
eosio
::
chain
::
asset
::
from_string
(
"1000000000.0000
SYS
"
));
(
"maximum_supply"
,
eosio
::
chain
::
asset
::
from_string
(
"1000000000.0000
YTA
"
));
push_action
(
N
(
eosio
.
token
),
N
(
create
),
N
(
eosio
.
token
),
act
);
// issue
for
(
account_name
a
:
accs
)
{
push_action
(
N
(
eosio
.
token
),
N
(
issue
),
"eosio"
,
mutable_variant_object
()
(
"to"
,
name
(
a
)
)
(
"quantity"
,
eosio
::
chain
::
asset
::
from_string
(
"999.0000
SYS
"
)
)
(
"quantity"
,
eosio
::
chain
::
asset
::
from_string
(
"999.0000
YTA
"
)
)
(
"memo"
,
""
)
);
}
...
...
@@ -134,14 +134,14 @@ BOOST_FIXTURE_TEST_CASE( get_table_test, TESTER ) try {
// create currency
auto
act
=
mutable_variant_object
()
(
"issuer"
,
"eosio"
)
(
"maximum_supply"
,
eosio
::
chain
::
asset
::
from_string
(
"1000000000.0000
SYS
"
));
(
"maximum_supply"
,
eosio
::
chain
::
asset
::
from_string
(
"1000000000.0000
YTA
"
));
push_action
(
N
(
eosio
.
token
),
N
(
create
),
N
(
eosio
.
token
),
act
);
// issue
for
(
account_name
a
:
accs
)
{
push_action
(
N
(
eosio
.
token
),
N
(
issue
),
"eosio"
,
mutable_variant_object
()
(
"to"
,
name
(
a
)
)
(
"quantity"
,
eosio
::
chain
::
asset
::
from_string
(
"10000.0000
SYS
"
)
)
(
"quantity"
,
eosio
::
chain
::
asset
::
from_string
(
"10000.0000
YTA
"
)
)
(
"memo"
,
""
)
);
}
...
...
@@ -207,7 +207,7 @@ BOOST_FIXTURE_TEST_CASE( get_table_test, TESTER ) try {
BOOST_REQUIRE_EQUAL
(
"9999.0000 AAA"
,
result
.
rows
[
0
][
"balance"
].
as_string
());
BOOST_REQUIRE_EQUAL
(
"8888.0000 BBB"
,
result
.
rows
[
1
][
"balance"
].
as_string
());
BOOST_REQUIRE_EQUAL
(
"7777.0000 CCC"
,
result
.
rows
[
2
][
"balance"
].
as_string
());
BOOST_REQUIRE_EQUAL
(
"10000.0000
SYS
"
,
result
.
rows
[
3
][
"balance"
].
as_string
());
BOOST_REQUIRE_EQUAL
(
"10000.0000
YTA
"
,
result
.
rows
[
3
][
"balance"
].
as_string
());
}
// get table: reverse ordered
...
...
@@ -219,7 +219,7 @@ BOOST_FIXTURE_TEST_CASE( get_table_test, TESTER ) try {
BOOST_REQUIRE_EQUAL
(
"9999.0000 AAA"
,
result
.
rows
[
3
][
"balance"
].
as_string
());
BOOST_REQUIRE_EQUAL
(
"8888.0000 BBB"
,
result
.
rows
[
2
][
"balance"
].
as_string
());
BOOST_REQUIRE_EQUAL
(
"7777.0000 CCC"
,
result
.
rows
[
1
][
"balance"
].
as_string
());
BOOST_REQUIRE_EQUAL
(
"10000.0000
SYS
"
,
result
.
rows
[
0
][
"balance"
].
as_string
());
BOOST_REQUIRE_EQUAL
(
"10000.0000
YTA
"
,
result
.
rows
[
0
][
"balance"
].
as_string
());
}
// get table: reverse ordered, with ram payer
...
...
@@ -232,7 +232,7 @@ BOOST_FIXTURE_TEST_CASE( get_table_test, TESTER ) try {
BOOST_REQUIRE_EQUAL
(
"9999.0000 AAA"
,
result
.
rows
[
3
][
"data"
][
"balance"
].
as_string
());
BOOST_REQUIRE_EQUAL
(
"8888.0000 BBB"
,
result
.
rows
[
2
][
"data"
][
"balance"
].
as_string
());
BOOST_REQUIRE_EQUAL
(
"7777.0000 CCC"
,
result
.
rows
[
1
][
"data"
][
"balance"
].
as_string
());
BOOST_REQUIRE_EQUAL
(
"10000.0000
SYS
"
,
result
.
rows
[
0
][
"data"
][
"balance"
].
as_string
());
BOOST_REQUIRE_EQUAL
(
"10000.0000
YTA
"
,
result
.
rows
[
0
][
"data"
][
"balance"
].
as_string
());
BOOST_REQUIRE_EQUAL
(
"eosio"
,
result
.
rows
[
0
][
"payer"
].
as_string
());
BOOST_REQUIRE_EQUAL
(
"eosio"
,
result
.
rows
[
1
][
"payer"
].
as_string
());
BOOST_REQUIRE_EQUAL
(
"eosio"
,
result
.
rows
[
2
][
"payer"
].
as_string
());
...
...
@@ -283,7 +283,7 @@ BOOST_FIXTURE_TEST_CASE( get_table_test, TESTER ) try {
BOOST_REQUIRE_EQUAL
(
1
,
result
.
rows
.
size
());
BOOST_REQUIRE_EQUAL
(
true
,
result
.
more
);
if
(
result
.
rows
.
size
()
>=
1
)
{
BOOST_REQUIRE_EQUAL
(
"10000.0000
SYS
"
,
result
.
rows
[
0
][
"balance"
].
as_string
());
BOOST_REQUIRE_EQUAL
(
"10000.0000
YTA
"
,
result
.
rows
[
0
][
"balance"
].
as_string
());
}
// get table: normal case, with bound & limit
...
...
@@ -329,14 +329,14 @@ BOOST_FIXTURE_TEST_CASE( get_table_by_seckey_test, TESTER ) try {
// create currency
auto
act
=
mutable_variant_object
()
(
"issuer"
,
"eosio"
)
(
"maximum_supply"
,
eosio
::
chain
::
asset
::
from_string
(
"1000000000.0000
SYS
"
));
(
"maximum_supply"
,
eosio
::
chain
::
asset
::
from_string
(
"1000000000.0000
YTA
"
));
push_action
(
N
(
eosio
.
token
),
N
(
create
),
N
(
eosio
.
token
),
act
);
// issue
for
(
account_name
a
:
accs
)
{
push_action
(
N
(
eosio
.
token
),
N
(
issue
),
"eosio"
,
mutable_variant_object
()
(
"to"
,
name
(
a
)
)
(
"quantity"
,
eosio
::
chain
::
asset
::
from_string
(
"10000.0000
SYS
"
)
)
(
"quantity"
,
eosio
::
chain
::
asset
::
from_string
(
"10000.0000
YTA
"
)
)
(
"memo"
,
""
)
);
}
...
...
@@ -354,10 +354,10 @@ BOOST_FIXTURE_TEST_CASE( get_table_by_seckey_test, TESTER ) try {
);
};
bidname
(
N
(
inita
),
N
(
com
),
eosio
::
chain
::
asset
::
from_string
(
"10.0000
SYS
"
));
bidname
(
N
(
initb
),
N
(
org
),
eosio
::
chain
::
asset
::
from_string
(
"11.0000
SYS
"
));
bidname
(
N
(
initc
),
N
(
io
),
eosio
::
chain
::
asset
::
from_string
(
"12.0000
SYS
"
));
bidname
(
N
(
initd
),
N
(
html
),
eosio
::
chain
::
asset
::
from_string
(
"14.0000
SYS
"
));
bidname
(
N
(
inita
),
N
(
com
),
eosio
::
chain
::
asset
::
from_string
(
"10.0000
YTA
"
));
bidname
(
N
(
initb
),
N
(
org
),
eosio
::
chain
::
asset
::
from_string
(
"11.0000
YTA
"
));
bidname
(
N
(
initc
),
N
(
io
),
eosio
::
chain
::
asset
::
from_string
(
"12.0000
YTA
"
));
bidname
(
N
(
initd
),
N
(
html
),
eosio
::
chain
::
asset
::
from_string
(
"14.0000
YTA
"
));
produce_blocks
(
1
);
// get table: normal case
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录