Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
YottaChain
YTBP
提交
bac989ae
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,发现更多精彩内容 >>
提交
bac989ae
编写于
12月 20, 2019
作者:
W
wangxxzhiyy
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
change minimum settlement unit from second to millisecond
上级
4897f3f9
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
9 addition
and
9 deletion
+9
-9
contracts/hddpool/hddpool.cpp
contracts/hddpool/hddpool.cpp
+9
-9
未找到文件。
contracts/hddpool/hddpool.cpp
浏览文件 @
bac989ae
...
...
@@ -18,12 +18,12 @@
using
namespace
eosio
;
const
uint
32
_t
hours_in_one_day
=
24
;
const
uint
32
_t
minutes_in_one_day
=
hours_in_one_day
*
60
;
const
uint
32_t
seconds_in_one_day
=
minutes_in_one_day
*
6
0
;
const
uint
32_t
seconds_in_one_year
=
seconds_in_one_day
*
365
;
const
uint
64
_t
hours_in_one_day
=
24
;
const
uint
64
_t
minutes_in_one_day
=
hours_in_one_day
*
60
;
const
uint
64_t
milliseconds_in_one_day
=
minutes_in_one_day
*
60
*
100
0
;
const
uint
64_t
milliseconds_in_one_year
=
milli
seconds_in_one_day
*
365
;
const
uint
32_t
fee_cycle
=
seconds_in_one_day
;
//计费周期(秒为单位)
const
uint
64_t
fee_cycle
=
milli
seconds_in_one_day
;
//计费周期(秒为单位)
//const uint32_t data_slice_size = 16 * 1024; // among 4k-32k,set it as 16k
...
...
@@ -128,7 +128,7 @@ void hddpool::chg_owner_space(userhdd_index& userhdd, name minerowner, uint64_t
}
eosio_assert
(
newspace
<=
max_profit_space
,
"execeed max profie space"
);
row
.
hdd_space_profit
=
newspace
;
row
.
hdd_per_cycle_profit
=
(
int64_t
)(((
double
)
newspace
/
(
double
)
one_gb
)
*
((
double
)
fee_cycle
/
(
double
)
seconds_in_one_year
)
*
100000000
);
row
.
hdd_per_cycle_profit
=
(
int64_t
)(((
double
)
newspace
/
(
double
)
one_gb
)
*
((
double
)
fee_cycle
/
(
double
)
milli
seconds_in_one_year
)
*
100000000
);
});
}
...
...
@@ -176,7 +176,7 @@ void hddpool::getbalance(name user, uint8_t acc_type, name caller)
int64_t
hddpool
::
calculate_balance
(
int64_t
oldbalance
,
int64_t
hdd_per_cycle_fee
,
int64_t
hdd_per_cycle_profit
,
uint64_t
last_hdd_time
,
uint64_t
current_time
)
{
uint64_t
slot_t
=
(
current_time
-
last_hdd_time
)
/
1000
000ll
;
//convert to
seconds
uint64_t
slot_t
=
(
current_time
-
last_hdd_time
)
/
1000
ll
;
//convert to milli
seconds
int64_t
new_balance
=
0
;
double
tick
=
(
double
)((
double
)
slot_t
/
fee_cycle
);
...
...
@@ -414,7 +414,7 @@ void hddpool::addmprofit(name owner, uint64_t minerid, uint64_t space, name call
uint64_t
newspace
=
row
.
space
+
space
;
row
.
space
=
newspace
;
//每周期收益 += (生产空间/1GB)*(记账周期/ 1年)
row
.
hdd_per_cycle_profit
=
(
int64_t
)((
double
)(
newspace
/
(
double
)
one_gb
)
*
((
double
)
fee_cycle
/
(
double
)
seconds_in_one_year
)
*
100000000
);
row
.
hdd_per_cycle_profit
=
(
int64_t
)((
double
)(
newspace
/
(
double
)
one_gb
)
*
((
double
)
fee_cycle
/
(
double
)
milli
seconds_in_one_year
)
*
100000000
);
});
userhdd_index
_userhdd
(
_self
,
owner
.
value
);
...
...
@@ -530,7 +530,7 @@ void hddpool::mactive(name owner, uint64_t minerid, name caller)
int64_t
profit
=
0
;
//每周期收益 += (生产空间*数据分片大小/1GB)*(记账周期/ 1年)
profit
=
(
int64_t
)(((
double
)
it
->
space
/
(
double
)
one_gb
)
*
((
double
)
fee_cycle
/
(
double
)
seconds_in_one_year
)
*
100000000
);
profit
=
(
int64_t
)(((
double
)
it
->
space
/
(
double
)
one_gb
)
*
((
double
)
fee_cycle
/
(
double
)
milli
seconds_in_one_year
)
*
100000000
);
uint64_t
tmp_t
=
current_time
();
uint64_t
space
=
it
->
space
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录