Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
YottaChain
YTBP
提交
beb27432
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,发现更多精彩内容 >>
未验证
提交
beb27432
编写于
5月 09, 2018
作者:
D
Daniel Larimer
提交者:
GitHub
5月 09, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #2891 from EOSIO/payment
Producer pay testing - test with 21 producers and a few standbys
上级
a0f0c8ec
f52909bc
变更
4
展开全部
隐藏空白更改
内联
并排
Showing
4 changed file
with
453 addition
and
59 deletion
+453
-59
contracts/eosio.system/eosio.system.abi
contracts/eosio.system/eosio.system.abi
+2
-3
contracts/eosio.system/eosio.system.hpp
contracts/eosio.system/eosio.system.hpp
+3
-3
contracts/eosio.system/producer_pay.cpp
contracts/eosio.system/producer_pay.cpp
+23
-17
unittests/eosio.system_tests.cpp
unittests/eosio.system_tests.cpp
+425
-36
未找到文件。
contracts/eosio.system/eosio.system.abi
浏览文件 @
beb27432
...
...
@@ -116,8 +116,7 @@
"name": "eosio_parameters",
"base": "blockchain_parameters",
"fields": [
{"name":"max_ram_size", "type":"uint64"},
{"name":"percent_of_max_inflation_rate", "type":"uint32"}
{"name":"max_ram_size", "type":"uint64"}
]
},{
"name": "eosio_global_state",
...
...
@@ -127,7 +126,7 @@
{"name":"total_ram_stake", "type":"asset"},
{"name":"last_producer_schedule_update", "type":"time"},
{"name":"last_pervote_bucket_fill", "type":"uint64"},
{"name":"
eos_bucket",
"type":"asset"},
{"name":"
pervote_bucket",
"type":"asset"},
{"name":"savings", "type":"asset"},
{"name":"last_producer_schedule_id", "type":"checksum160"},
{"name":"total_activatied_stake", "type":"int64"}
...
...
contracts/eosio.system/eosio.system.hpp
浏览文件 @
beb27432
...
...
@@ -33,7 +33,7 @@ namespace eosiosystem {
block_timestamp
last_producer_schedule_update
=
0
;
uint64_t
last_pervote_bucket_fill
=
0
;
eosio
::
asset
eos
_bucket
;
eosio
::
asset
pervote
_bucket
;
eosio
::
asset
savings
;
checksum160
last_producer_schedule_id
;
...
...
@@ -43,7 +43,7 @@ namespace eosiosystem {
EOSLIB_SERIALIZE_DERIVED
(
eosio_global_state
,
eosio_parameters
,
(
total_ram_bytes_reserved
)(
total_ram_stake
)
(
last_producer_schedule_update
)
(
last_pervote_bucket_fill
)
(
eos
_bucket
)(
savings
)(
last_producer_schedule_id
)(
total_activated_stake
)
)
(
pervote
_bucket
)(
savings
)(
last_producer_schedule_id
)(
total_activated_stake
)
)
};
struct
producer_info
{
...
...
@@ -191,7 +191,7 @@ namespace eosiosystem {
private:
eosio
::
asset
payment_per_block
(
double
rate
,
const
eosio
::
asset
&
token_supply
,
uint32_t
num_blocks
);
eosio
::
asset
payment_per_vote
(
const
account_name
&
owner
,
double
owners_votes
,
const
eosio
::
asset
&
eos
_bucket
);
eosio
::
asset
payment_per_vote
(
const
account_name
&
owner
,
double
owners_votes
,
const
eosio
::
asset
&
pervote
_bucket
);
eosio
::
asset
supply_growth
(
double
rate
,
const
eosio
::
asset
&
token_supply
,
time
seconds
);
...
...
contracts/eosio.system/producer_pay.cpp
浏览文件 @
beb27432
...
...
@@ -29,11 +29,11 @@ namespace eosiosystem {
using
namespace
eosio
;
/** until activated stake crosses this threshold no new rewards are paid */
if
(
_gstate
.
total_activated_stake
<
150
0000000000
/* 150'000'000'0000 */
)
if
(
_gstate
.
total_activated_stake
<
150
'000'000'0000
)
return
;
if
(
_gstate
.
last_pervote_bucket_fill
==
0
)
/// start the presses
_gstate
.
last_pervote_bucket_fill
=
timestamp
;
_gstate
.
last_pervote_bucket_fill
=
current_time
()
;
auto
prod
=
_producers
.
find
(
producer
);
if
(
prod
!=
_producers
.
end
()
)
{
...
...
@@ -50,9 +50,10 @@ namespace eosiosystem {
}
eosio
::
asset
system_contract
::
payment_per_vote
(
const
account_name
&
owner
,
double
owners_votes
,
const
eosio
::
asset
&
eos
_bucket
)
{
eosio
::
asset
system_contract
::
payment_per_vote
(
const
account_name
&
owner
,
double
owners_votes
,
const
eosio
::
asset
&
pervote
_bucket
)
{
eosio
::
asset
payment
(
0
,
S
(
4
,
EOS
));
if
(
eos_bucket
.
amount
<
min_daily_tokens
)
{
const
int64_t
min_daily_amount
=
100
*
10000
;
if
(
pervote_bucket
.
amount
<
min_daily_tokens
)
{
return
payment
;
}
...
...
@@ -74,8 +75,8 @@ namespace eosiosystem {
}
total_producer_votes
+=
itr
->
total_votes
;
running_payment_amount
=
(
itr
->
total_votes
)
*
double
(
eos
_bucket
.
amount
)
/
total_producer_votes
;
if
(
running_payment_amount
<
min_daily_
tokens
)
{
running_payment_amount
=
(
itr
->
total_votes
)
*
double
(
pervote
_bucket
.
amount
)
/
total_producer_votes
;
if
(
running_payment_amount
<
min_daily_
amount
)
{
if
(
itr
->
owner
==
owner
)
{
to_be_payed
=
false
;
}
...
...
@@ -85,7 +86,7 @@ namespace eosiosystem {
}
if
(
to_be_payed
)
{
payment
.
amount
=
static_cast
<
int64_t
>
(
(
double
(
eos
_bucket
.
amount
)
*
owners_votes
)
/
total_producer_votes
);
payment
.
amount
=
static_cast
<
int64_t
>
(
(
double
(
pervote
_bucket
.
amount
)
*
owners_votes
)
/
total_producer_votes
);
}
return
payment
;
...
...
@@ -102,24 +103,29 @@ namespace eosiosystem {
eosio_assert
(
current_time
()
>=
prod
->
last_claim_time
+
useconds_per_day
,
"already claimed rewards within a day"
);
}
auto
parameters
=
_global
.
get
();
const
asset
token_supply
=
token
(
N
(
eosio
.
token
)).
get_supply
(
symbol_type
(
system_token_symbol
).
name
()
);
const
uint32_t
secs_since_last_fill
=
static_cast
<
uint32_t
>
(
(
current_time
()
-
parameters
.
last_pervote_bucket_fill
)
/
1000000
);
const
uint32_t
secs_since_last_fill
=
static_cast
<
uint32_t
>
(
(
current_time
()
-
_gstate
.
last_pervote_bucket_fill
)
/
1000000
);
const
asset
to_
eos
_bucket
=
supply_growth
(
standby_rate
,
token_supply
,
secs_since_last_fill
);
const
asset
to_
pervote
_bucket
=
supply_growth
(
standby_rate
,
token_supply
,
secs_since_last_fill
);
const
asset
to_savings
=
supply_growth
(
continuous_rate
-
(
perblock_rate
+
standby_rate
),
token_supply
,
secs_since_last_fill
);
const
asset
perblock_pay
=
payment_per_block
(
perblock_rate
,
token_supply
,
prod
->
produced_blocks
);
const
asset
issue_amount
=
to_eos_bucket
+
to_savings
+
perblock_pay
;
const
asset
issue_amount
=
to_pervote_bucket
+
to_savings
+
perblock_pay
;
const
asset
pervote_pay
=
payment_per_vote
(
owner
,
prod
->
total_votes
,
to_pervote_bucket
+
_gstate
.
pervote_bucket
);
if
(
perblock_pay
.
amount
+
pervote_pay
.
amount
==
0
)
{
_producers
.
modify
(
prod
,
0
,
[
&
](
auto
&
p
)
{
p
.
last_claim_time
=
current_time
();
});
return
;
}
INLINE_ACTION_SENDER
(
eosio
::
token
,
issue
)(
N
(
eosio
.
token
),
{{
N
(
eosio
),
N
(
active
)}},
{
N
(
eosio
),
issue_amount
,
std
::
string
(
"issue tokens for producer pay and savings"
)}
);
const
asset
pervote_pay
=
payment_per_vote
(
owner
,
prod
->
total_votes
,
to_eos_bucket
+
parameters
.
eos_bucket
);
parameters
.
eos_bucket
+=
(
to_eos_bucket
-
pervote_pay
);
parameters
.
last_pervote_bucket_fill
=
current_time
();
parameters
.
savings
+=
to_savings
;
_global
.
set
(
parameters
,
_self
);
_gstate
.
pervote_bucket
+=
(
to_pervote_bucket
-
pervote_pay
);
_gstate
.
last_pervote_bucket_fill
=
current_time
();
_gstate
.
savings
+=
to_savings
;
INLINE_ACTION_SENDER
(
eosio
::
token
,
transfer
)(
N
(
eosio
.
token
),
{
N
(
eosio
),
N
(
active
)},
{
N
(
eosio
),
owner
,
perblock_pay
+
pervote_pay
,
std
::
string
(
"producer claiming rewards"
)
}
);
...
...
unittests/eosio.system_tests.cpp
浏览文件 @
beb27432
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录