Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
YottaChain
YTBP
提交
93291c8a
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,发现更多精彩内容 >>
未验证
提交
93291c8a
编写于
3月 19, 2019
作者:
L
luchiagogogo
提交者:
GitHub
3月 19, 2019
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #2 from big4david/feature/ytaseo
Feature/ytaseo
上级
c1584115
c5983cd6
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
49 addition
and
20 deletion
+49
-20
CMakeLists.txt
CMakeLists.txt
+1
-1
contracts/eosio.system/producer_pay.cpp
contracts/eosio.system/producer_pay.cpp
+39
-12
libraries/chain/genesis_state.cpp
libraries/chain/genesis_state.cpp
+1
-1
scripts/eosio_build_centos.sh
scripts/eosio_build_centos.sh
+4
-2
tutorials/bios-boot-tutorial/bios-boot-tutorial.py
tutorials/bios-boot-tutorial/bios-boot-tutorial.py
+3
-3
tutorials/bios-boot-tutorial/genesis.json
tutorials/bios-boot-tutorial/genesis.json
+1
-1
未找到文件。
CMakeLists.txt
浏览文件 @
93291c8a
...
@@ -209,7 +209,7 @@ include(utils)
...
@@ -209,7 +209,7 @@ include(utils)
add_subdirectory
(
externals
)
add_subdirectory
(
externals
)
if
(
"
${
CORE_SYMBOL_NAME
}
"
STREQUAL
""
)
if
(
"
${
CORE_SYMBOL_NAME
}
"
STREQUAL
""
)
set
(
CORE_SYMBOL_NAME
"
SYS
"
)
set
(
CORE_SYMBOL_NAME
"
YTA
"
)
endif
()
endif
()
string
(
TOUPPER
${
CORE_SYMBOL_NAME
}
CORE_SYMBOL_NAME
)
string
(
TOUPPER
${
CORE_SYMBOL_NAME
}
CORE_SYMBOL_NAME
)
...
...
contracts/eosio.system/producer_pay.cpp
浏览文件 @
93291c8a
#include "eosio.system.hpp"
#include "eosio.system.hpp"
#include <eosiolib/print.hpp>
#include <eosio.token/eosio.token.hpp>
#include <eosio.token/eosio.token.hpp>
namespace
eosiosystem
{
namespace
eosiosystem
{
const
int64_t
min_pervote_daily_pay
=
100'0000
;
const
int64_t
min_pervote_daily_pay
=
100'0000
;
const
int64_t
min_activated_stake
=
150'000'000'0000
;
const
int64_t
min_activated_stake
=
150'000'000'0000
;
const
double
continuous_rate
=
0.04879
;
// 5% annual rate
const
double
perblock_rate
=
0.0025
;
// 0.25%
const
double
standby_rate
=
0.0075
;
// 0.75%
const
uint32_t
blocks_per_year
=
52
*
7
*
24
*
2
*
3600
;
// half seconds per year
const
uint32_t
blocks_per_year
=
52
*
7
*
24
*
2
*
3600
;
// half seconds per year
const
uint32_t
seconds_per_year
=
52
*
7
*
24
*
3600
;
const
uint32_t
seconds_per_year
=
52
*
7
*
24
*
3600
;
const
uint32_t
blocks_per_day
=
2
*
24
*
3600
;
const
uint32_t
blocks_per_day
=
2
*
24
*
3600
;
...
@@ -16,6 +13,27 @@ namespace eosiosystem {
...
@@ -16,6 +13,27 @@ namespace eosiosystem {
const
uint64_t
useconds_per_day
=
24
*
3600
*
uint64_t
(
1000000
);
const
uint64_t
useconds_per_day
=
24
*
3600
*
uint64_t
(
1000000
);
const
uint64_t
useconds_per_year
=
seconds_per_year
*
1000000ll
;
const
uint64_t
useconds_per_year
=
seconds_per_year
*
1000000ll
;
const
int64_t
block_initial_timestamp
=
1551369600ll
;
// epoch year 2019.03.01 unix timestamp 1551369600s
//yta seo total= yta_seo_year[i] * YTA_SEO_BASE
const
uint32_t
YTA_SEO_BASE
=
10'0000
;
const
double
YTA_PRECISION
=
10000.0000
;
const
uint32_t
yta_seo_year
[
62
]
=
{
1000
,
900
,
800
,
700
,
600
,
600
,
500
,
500
,
400
,
400
,
300
,
300
,
200
,
200
,
200
,
100
,
100
,
100
,
90
,
90
,
90
,
80
,
80
,
80
,
70
,
70
,
70
,
70
,
60
,
60
,
60
,
60
,
50
,
50
,
50
,
50
,
50
,
40
,
40
,
40
,
40
,
40
,
30
,
30
,
30
,
30
,
30
,
20
,
20
,
20
,
20
,
20
,
10
,
10
,
10
,
10
,
10
,
9
,
9
,
9
,
9
,
9
};
void
system_contract
::
onblock
(
block_timestamp
timestamp
,
account_name
producer
)
{
void
system_contract
::
onblock
(
block_timestamp
timestamp
,
account_name
producer
)
{
using
namespace
eosio
;
using
namespace
eosio
;
...
@@ -73,27 +91,36 @@ namespace eosiosystem {
...
@@ -73,27 +91,36 @@ namespace eosiosystem {
eosio_assert
(
_gstate
.
total_activated_stake
>=
min_activated_stake
,
eosio_assert
(
_gstate
.
total_activated_stake
>=
min_activated_stake
,
"cannot claim rewards until the chain is activated (at least 15% of all tokens participate in voting)"
);
"cannot claim rewards until the chain is activated (at least 15% of all tokens participate in voting)"
);
auto
ct
=
current_time
();
auto
ct
=
current_time
();
eosio_assert
(
ct
-
prod
.
last_claim_time
>
useconds_per_day
,
"already claimed rewards within past day"
);
//
eosio_assert( ct - prod.last_claim_time > useconds_per_day, "already claimed rewards within past day" );
const
asset
token_supply
=
token
(
N
(
eosio
.
token
)).
get_supply
(
symbol_type
(
system_token_symbol
).
name
()
);
const
asset
token_supply
=
token
(
N
(
eosio
.
token
)).
get_supply
(
symbol_type
(
system_token_symbol
).
name
()
);
const
auto
usecs_since_last_fill
=
ct
-
_gstate
.
last_pervote_bucket_fill
;
const
auto
usecs_since_last_fill
=
ct
-
_gstate
.
last_pervote_bucket_fill
;
print
(
"usecs_since_last_fill: "
,
usecs_since_last_fill
,
"
\n
"
);
print
(
"_gstate.last_pervote_bucket_fill: "
,
_gstate
.
last_pervote_bucket_fill
,
"
\n
"
);
print
(
"now(): "
,
now
(),
"
\n
"
);
int
idx_year
=
(
int
)((
now
()
-
block_initial_timestamp
)
/
seconds_per_year
);
auto
seo_token
=
yta_seo_year
[
idx_year
]
*
YTA_SEO_BASE
;
print
(
"idx_year: "
,
idx_year
,
"
\n
"
);
print
(
"yta_seo_year[idx_year]: "
,
yta_seo_year
[
idx_year
],
"
\n
"
);
print
(
"token_supply: "
,
token_supply
,
"
\n
"
);
print
(
"seo_token: "
,
seo_token
,
"
\n
"
);
if
(
usecs_since_last_fill
>
0
&&
_gstate
.
last_pervote_bucket_fill
>
0
)
{
if
(
usecs_since_last_fill
>
0
&&
_gstate
.
last_pervote_bucket_fill
>
0
)
{
auto
new_tokens
=
static_cast
<
int64_t
>
(
(
continuous_rate
*
double
(
token_supply
.
amount
)
*
double
(
usecs_since_last_fill
))
/
double
(
useconds_per_year
)
);
auto
new_tokens
=
static_cast
<
int64_t
>
(
seo_token
*
YTA_PRECISION
*
double
(
usecs_since_last_fill
)
/
double
(
useconds_per_year
));
print
(
"new_token: "
,
new_tokens
,
"
\n
"
);
auto
to_producers
=
new_tokens
/
5
;
auto
to_producers
=
new_tokens
;
auto
to_savings
=
new_tokens
-
to_producers
;
auto
to_per_block_pay
=
to_producers
/
4
;
auto
to_per_block_pay
=
to_producers
/
4
;
auto
to_per_vote_pay
=
to_producers
-
to_per_block_pay
;
auto
to_per_vote_pay
=
to_producers
-
to_per_block_pay
;
INLINE_ACTION_SENDER
(
eosio
::
token
,
issue
)(
N
(
eosio
.
token
),
{{
N
(
eosio
),
N
(
active
)}},
INLINE_ACTION_SENDER
(
eosio
::
token
,
issue
)(
N
(
eosio
.
token
),
{{
N
(
eosio
),
N
(
active
)}},
{
N
(
eosio
),
asset
(
new_tokens
),
std
::
string
(
"issue tokens for producer pay and savings"
)}
);
{
N
(
eosio
),
asset
(
new_tokens
),
std
::
string
(
"issue tokens for producer pay and savings"
)}
);
INLINE_ACTION_SENDER
(
eosio
::
token
,
transfer
)(
N
(
eosio
.
token
),
{
N
(
eosio
),
N
(
active
)},
{
N
(
eosio
),
N
(
eosio
.
saving
),
asset
(
to_savings
),
"unallocated inflation"
}
);
INLINE_ACTION_SENDER
(
eosio
::
token
,
transfer
)(
N
(
eosio
.
token
),
{
N
(
eosio
),
N
(
active
)},
INLINE_ACTION_SENDER
(
eosio
::
token
,
transfer
)(
N
(
eosio
.
token
),
{
N
(
eosio
),
N
(
active
)},
{
N
(
eosio
),
N
(
eosio
.
bpay
),
asset
(
to_per_block_pay
),
"fund per-block bucket"
}
);
{
N
(
eosio
),
N
(
eosio
.
bpay
),
asset
(
to_per_block_pay
),
"fund per-block bucket"
}
);
...
...
libraries/chain/genesis_state.cpp
浏览文件 @
93291c8a
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
namespace
eosio
{
namespace
chain
{
namespace
eosio
{
namespace
chain
{
genesis_state
::
genesis_state
()
{
genesis_state
::
genesis_state
()
{
initial_timestamp
=
fc
::
time_point
::
from_iso_string
(
"201
8-06
-01T12:00:00"
);
initial_timestamp
=
fc
::
time_point
::
from_iso_string
(
"201
9-03
-01T12:00:00"
);
initial_key
=
fc
::
variant
(
eosio_root_key
).
as
<
public_key_type
>
();
initial_key
=
fc
::
variant
(
eosio_root_key
).
as
<
public_key_type
>
();
}
}
...
...
scripts/eosio_build_centos.sh
浏览文件 @
93291c8a
...
@@ -52,7 +52,8 @@
...
@@ -52,7 +52,8 @@
printf
"
\\
t- Yum installation found at %s.
\\
n"
"
${
YUM
}
"
printf
"
\\
t- Yum installation found at %s.
\\
n"
"
${
YUM
}
"
printf
"
\\
tUpdating YUM repository...
\\
n"
printf
"
\\
tUpdating YUM repository...
\\
n"
if
!
sudo
"
${
YUM
}
"
-y
update
>
/dev/null 2>&1
;
then
#if ! sudo "${YUM}" -y update > /dev/null 2>&1; then
if
!
true
;
then
printf
"
\\
t!! YUM update failed !!
\\
n"
printf
"
\\
t!! YUM update failed !!
\\
n"
printf
"
\\
tExiting now.
\\
n"
printf
"
\\
tExiting now.
\\
n"
exit
1
;
exit
1
;
...
@@ -178,7 +179,8 @@
...
@@ -178,7 +179,8 @@
case
$yn
in
case
$yn
in
[
Yy]
*
)
[
Yy]
*
)
printf
"
\\
tInstalling dependencies
\\
n
\\
n"
printf
"
\\
tInstalling dependencies
\\
n
\\
n"
if
!
sudo
"
${
YUM
}
"
-y
install
${
DEP
}
;
then
#if ! sudo "${YUM}" -y install ${DEP}; then
if
!
true
;
then
printf
"
\\
t!! YUM dependency installation failed !!
\\
n"
printf
"
\\
t!! YUM dependency installation failed !!
\\
n"
printf
"
\\
tExiting now.
\\
n"
printf
"
\\
tExiting now.
\\
n"
exit
1
;
exit
1
;
...
...
tutorials/bios-boot-tutorial/bios-boot-tutorial.py
浏览文件 @
93291c8a
...
@@ -296,7 +296,7 @@ def stepSetSystemContract():
...
@@ -296,7 +296,7 @@ def stepSetSystemContract():
sleep
(
1
)
sleep
(
1
)
run
(
args
.
cleos
+
'push action eosio setpriv'
+
jsonArg
([
'eosio.msig'
,
1
])
+
'-p eosio@active'
)
run
(
args
.
cleos
+
'push action eosio setpriv'
+
jsonArg
([
'eosio.msig'
,
1
])
+
'-p eosio@active'
)
def
stepInitSystemContract
():
def
stepInitSystemContract
():
run
(
args
.
cleos
+
'push action eosio init'
+
jsonArg
([
'0'
,
'4,
SYS
'
])
+
'-p eosio@active'
)
run
(
args
.
cleos
+
'push action eosio init'
+
jsonArg
([
'0'
,
'4,
YTA
'
])
+
'-p eosio@active'
)
sleep
(
1
)
sleep
(
1
)
def
stepCreateStakedAccounts
():
def
stepCreateStakedAccounts
():
createStakedAccounts
(
0
,
len
(
accounts
))
createStakedAccounts
(
0
,
len
(
accounts
))
...
@@ -336,7 +336,7 @@ commands = [
...
@@ -336,7 +336,7 @@ commands = [
(
'c'
,
'contracts'
,
stepInstallSystemContracts
,
True
,
"Install system contracts (token, msig)"
),
(
'c'
,
'contracts'
,
stepInstallSystemContracts
,
True
,
"Install system contracts (token, msig)"
),
(
't'
,
'tokens'
,
stepCreateTokens
,
True
,
"Create tokens"
),
(
't'
,
'tokens'
,
stepCreateTokens
,
True
,
"Create tokens"
),
(
'S'
,
'sys-contract'
,
stepSetSystemContract
,
True
,
"Set system contract"
),
(
'S'
,
'sys-contract'
,
stepSetSystemContract
,
True
,
"Set system contract"
),
(
'I'
,
'init-sys-contract'
,
stepInitSystemContract
,
True
,
"Initialiaze system contract"
),
#
('I', 'init-sys-contract', stepInitSystemContract, True, "Initialiaze system contract"),
(
'T'
,
'stake'
,
stepCreateStakedAccounts
,
True
,
"Create staked accounts"
),
(
'T'
,
'stake'
,
stepCreateStakedAccounts
,
True
,
"Create staked accounts"
),
(
'p'
,
'reg-prod'
,
stepRegProducers
,
True
,
"Register producers"
),
(
'p'
,
'reg-prod'
,
stepRegProducers
,
True
,
"Register producers"
),
(
'P'
,
'start-prod'
,
stepStartProducers
,
True
,
"Start producers"
),
(
'P'
,
'start-prod'
,
stepStartProducers
,
True
,
"Start producers"
),
...
@@ -359,7 +359,7 @@ parser.add_argument('--nodes-dir', metavar='', help="Path to nodes directory", d
...
@@ -359,7 +359,7 @@ parser.add_argument('--nodes-dir', metavar='', help="Path to nodes directory", d
parser
.
add_argument
(
'--genesis'
,
metavar
=
''
,
help
=
"Path to genesis.json"
,
default
=
"./genesis.json"
)
parser
.
add_argument
(
'--genesis'
,
metavar
=
''
,
help
=
"Path to genesis.json"
,
default
=
"./genesis.json"
)
parser
.
add_argument
(
'--wallet-dir'
,
metavar
=
''
,
help
=
"Path to wallet directory"
,
default
=
'./wallet/'
)
parser
.
add_argument
(
'--wallet-dir'
,
metavar
=
''
,
help
=
"Path to wallet directory"
,
default
=
'./wallet/'
)
parser
.
add_argument
(
'--log-path'
,
metavar
=
''
,
help
=
"Path to log file"
,
default
=
'./output.log'
)
parser
.
add_argument
(
'--log-path'
,
metavar
=
''
,
help
=
"Path to log file"
,
default
=
'./output.log'
)
parser
.
add_argument
(
'--symbol'
,
metavar
=
''
,
help
=
"The eosio.system symbol"
,
default
=
'
SYS
'
)
parser
.
add_argument
(
'--symbol'
,
metavar
=
''
,
help
=
"The eosio.system symbol"
,
default
=
'
YTA
'
)
parser
.
add_argument
(
'--user-limit'
,
metavar
=
''
,
help
=
"Max number of users. (0 = no limit)"
,
type
=
int
,
default
=
3000
)
parser
.
add_argument
(
'--user-limit'
,
metavar
=
''
,
help
=
"Max number of users. (0 = no limit)"
,
type
=
int
,
default
=
3000
)
parser
.
add_argument
(
'--max-user-keys'
,
metavar
=
''
,
help
=
"Maximum user keys to import into wallet"
,
type
=
int
,
default
=
10
)
parser
.
add_argument
(
'--max-user-keys'
,
metavar
=
''
,
help
=
"Maximum user keys to import into wallet"
,
type
=
int
,
default
=
10
)
parser
.
add_argument
(
'--ram-funds'
,
metavar
=
''
,
help
=
"How much funds for each user to spend on ram"
,
type
=
float
,
default
=
0.1
)
parser
.
add_argument
(
'--ram-funds'
,
metavar
=
''
,
help
=
"How much funds for each user to spend on ram"
,
type
=
float
,
default
=
0.1
)
...
...
tutorials/bios-boot-tutorial/genesis.json
浏览文件 @
93291c8a
{
{
"initial_timestamp"
:
"201
8-03-02
T12:00:00.000"
,
"initial_timestamp"
:
"201
9-03-01
T12:00:00.000"
,
"initial_key"
:
"EOS8Znrtgwt8TfpmbVpTKvA2oB8Nqey625CLN8bCN3TEbgx86Dsvr"
,
"initial_key"
:
"EOS8Znrtgwt8TfpmbVpTKvA2oB8Nqey625CLN8bCN3TEbgx86Dsvr"
,
"initial_configuration"
:
{
"initial_configuration"
:
{
"max_block_net_usage"
:
1048576
,
"max_block_net_usage"
:
1048576
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录