Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
YottaChain
YTBP
提交
4897f3f9
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,发现更多精彩内容 >>
提交
4897f3f9
编写于
12月 20, 2019
作者:
W
wangxxzhiyy
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update hddpool contract
上级
93d8decb
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
6 addition
and
5 deletion
+6
-5
contracts/hddpool/hddpool.cpp
contracts/hddpool/hddpool.cpp
+6
-5
未找到文件。
contracts/hddpool/hddpool.cpp
浏览文件 @
4897f3f9
...
...
@@ -34,7 +34,8 @@ const uint64_t max_profit_space = one_gb * 1024 * uint64_t(1024 * 500); //500
const
uint64_t
max_pool_space
=
one_gb
*
1024
*
uint64_t
(
1024
*
500
);
//500P 矿池配额最大上限
const
uint64_t
max_miner_space
=
one_gb
*
uint64_t
(
1024
*
100
);
//100T 单个矿机最大的物理空间
const
uint64_t
min_miner_space
=
100
*
one_gb
;
//100G 单个矿机最小的物理空间
const
int64_t
max_buy_sell_hdd_amount
=
2
*
1024
*
1024
*
100000000ll
;
//2P 单次买卖最大的HDD数量
const
int64_t
max_buy_sell_hdd_amount
=
2
*
1024
*
1024
*
100000000ll
;
//2P 单次买卖最大的HDD数量
const
int64_t
min_buy_hdd_amount
=
2
*
100000000ll
;
//2 单次购买的最小的HDD数量
static
constexpr
eosio
::
name
active_permission
{
N
(
active
)};
static
constexpr
eosio
::
name
token_account
{
N
(
eosio
.
token
)};
...
...
@@ -137,11 +138,11 @@ void hddpool::getbalance(name user, uint8_t acc_type, name caller)
{
eosio_assert
(
is_account
(
user
),
"user not a account."
);
account_name
payer
=
_self
;
//
account_name payer = _self;
if
(
acc_type
==
1
)
{
require_auth
(
user
);
payer
=
user
.
value
;
//
payer = user.value;
}
else
if
(
acc_type
==
2
)
{
eosio_assert
(
is_account
(
caller
),
"caller not a account."
);
...
...
@@ -154,7 +155,7 @@ void hddpool::getbalance(name user, uint8_t acc_type, name caller)
auto
it
=
_userhdd
.
find
(
user
.
value
);
if
(
it
==
_userhdd
.
end
())
{
new_user_hdd
(
_userhdd
,
user
,
0
,
payer
);
//
new_user_hdd(_userhdd, user, 0, payer);
print
(
"{
\"
balance
\"
:"
,
0
,
"}"
);
}
else
...
...
@@ -193,7 +194,7 @@ void hddpool::buyhdd(name from, name receiver, int64_t amount, std::string memo)
eosio_assert
(
is_account
(
from
),
"user not a account"
);
eosio_assert
(
is_account
(
receiver
),
"receiver not a account"
);
eosio_assert
(
is_account
(
hdd_exchg_acc
),
"to not a account"
);
eosio_assert
(
amount
>
0
,
"must buy positive quantity
"
);
eosio_assert
(
amount
>
min_buy_hdd_amount
,
"amount too low
"
);
eosio_assert
(
amount
<=
max_buy_sell_hdd_amount
,
"exceed single purchase volume"
);
eosio_assert
(
is_hdd_amount_within_range
(
amount
),
"magnitude of amount must be less than 2^62"
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录