Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
YottaChain
YTBP
提交
41e30d17
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,发现更多精彩内容 >>
提交
41e30d17
编写于
11月 26, 2019
作者:
W
Wang Zhi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update contracts
上级
8d145e93
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
90 addition
and
30 deletion
+90
-30
contracts/eosio.system/eosio.system.abi
contracts/eosio.system/eosio.system.abi
+23
-2
contracts/eosio.system/eosio.system.cpp
contracts/eosio.system/eosio.system.cpp
+1
-1
contracts/eosio.system/eosio.system.hpp
contracts/eosio.system/eosio.system.hpp
+11
-3
contracts/eosio.system/voting.cpp
contracts/eosio.system/voting.cpp
+30
-7
contracts/eosio.token/eosio.token.cpp
contracts/eosio.token/eosio.token.cpp
+1
-1
contracts/hdddeposit/hdddeposit.cpp
contracts/hdddeposit/hdddeposit.cpp
+1
-2
contracts/hddlock/hddlock.cpp
contracts/hddlock/hddlock.cpp
+17
-8
contracts/hddlock/hddlock.hpp
contracts/hddlock/hddlock.hpp
+1
-1
contracts/hddpool/hddpool.cpp
contracts/hddpool/hddpool.cpp
+5
-5
未找到文件。
contracts/eosio.system/eosio.system.abi
浏览文件 @
41e30d17
...
...
@@ -281,6 +281,13 @@
{"name":"last_claim_time", "type":"uint64"}
]
},{
"name": "eosio_global_state3",
"base": "",
"fields": [
{"name":"is_schedule", "type":"bool"}
]
},
{
"name": "eosio_global_count",
"base": "",
"fields": [
...
...
@@ -306,8 +313,6 @@
{"name":"owner", "type":"account_name"},
{"name":"seq_num", "type":"uint16"},
{"name":"level", "type":"uint8"},
{"name":"out_votes", "type":"int64"},
{"name":"deposit_votes", "type":"int64"},
{"name":"unpaid_base_cnt", "type":"uint32"},
{"name":"unpaid_amount", "type":"int64"},
{"name":"shadow", "type":"account_name"}
...
...
@@ -378,6 +383,12 @@
"fields": [
{"name":"voter_name", "type":"account_name"}
]
},{
"name": "setautosche",
"base": "",
"fields": [
{"name":"auto_sche", "type":"bool"}
]
},{
"name": "voter_info",
"base": "",
...
...
@@ -583,6 +594,10 @@
"name": "changevotes",
"type": "changevotes",
"ricardian_contract": ""
},{
"name": "setautosche",
"type": "setautosche",
"ricardian_contract": ""
},{
"name": "claimrewards",
"type": "claimrewards",
...
...
@@ -654,6 +669,12 @@
"index_type": "i64",
"key_names" : [],
"key_types" : []
},{
"name": "globalext2",
"type": "eosio_global_state3",
"index_type": "i64",
"key_names" : [],
"key_types" : []
},{
"name": "gcount",
"type": "eosio_global_count",
...
...
contracts/eosio.system/eosio.system.cpp
浏览文件 @
41e30d17
...
...
@@ -209,7 +209,7 @@ EOSIO_ABI( eosiosystem::system_contract,
// delegate_bandwidth.cpp
(
buyrambytes
)(
buyram
)(
sellram
)(
delegatebw
)(
undelegatebw
)(
refund
)
// voting.cpp
(
regproducer
)(
unregprod
)(
voteproducer
)(
changevotes
)(
regproxy
)(
clsprods2
)(
seqproducer
)(
reprodlevel
)
(
regproducer
)(
unregprod
)(
voteproducer
)(
changevotes
)(
regproxy
)(
clsprods2
)(
seqproducer
)(
reprodlevel
)
(
setautosche
)
// producer_pay.cpp
(
onblock
)(
claimrewards
)(
rewardprods
)(
startreward
)
)
contracts/eosio.system/eosio.system.hpp
浏览文件 @
41e30d17
...
...
@@ -75,6 +75,13 @@ namespace eosiosystem {
EOSLIB_SERIALIZE
(
eosio_global_count
,
(
total_accounts
)
)
};
struct
eosio_global_state3
{
bool
is_schedule
=
true
;
EOSLIB_SERIALIZE
(
eosio_global_state3
,
(
is_schedule
)
)
};
//##YTA-Change end:
struct
producer_info
{
...
...
@@ -102,14 +109,12 @@ namespace eosiosystem {
account_name
owner
;
uint16_t
seq_num
=
1
;
// from 1 to 21
uint8_t
level
=
3
;
int64_t
out_votes
=
0
;
int64_t
deposit_votes
=
0
;
uint32_t
unpaid_base_cnt
=
0
;
int64_t
unpaid_amount
=
0
;
account_name
shadow
=
0
;
uint64_t
primary_key
()
const
{
return
owner
;
}
EOSLIB_SERIALIZE
(
producer_info_ext
,
(
owner
)(
seq_num
)(
level
)(
out_votes
)(
deposit_votes
)(
unpaid_base_cnt
)(
unpaid_amount
)(
shadow
))
EOSLIB_SERIALIZE
(
producer_info_ext
,
(
owner
)(
seq_num
)(
level
)(
unpaid_base_cnt
)(
unpaid_amount
)(
shadow
))
};
//##YTA-Change end:
...
...
@@ -184,6 +189,7 @@ namespace eosiosystem {
//##YTA-Change start:
typedef
eosio
::
singleton
<
N
(
globalext
),
eosio_global_state2
>
global_state2_singleton
;
typedef
eosio
::
singleton
<
N
(
globalext2
),
eosio_global_state3
>
global_state3_singleton
;
typedef
eosio
::
singleton
<
N
(
gcount
),
eosio_global_count
>
global_count_singleton
;
//##YTA-Change end:
...
...
@@ -278,6 +284,8 @@ namespace eosiosystem {
void
reprodlevel
();
void
changevotes
(
const
account_name
voter_name
);
void
setautosche
(
bool
auto_sche
);
//##YTA-Change end:
void
setram
(
uint64_t
max_ram_size
);
...
...
contracts/eosio.system/voting.cpp
浏览文件 @
41e30d17
...
...
@@ -90,13 +90,6 @@ namespace eosiosystem {
require_auth
(
N
(
ytaadminuser
));
while
(
_producersext
.
begin
()
!=
_producersext
.
end
())
{
auto
it
=
_producersext
.
begin
();
//it->out_votes
const
auto
&
prod
=
_producers
.
get
(
it
->
owner
,
"producer not found"
);
_producers
.
modify
(
prod
,
0
,
[
&
](
producer_info
&
info
){
info
.
total_votes
-=
it
->
out_votes
;
});
_gstate
.
total_producer_vote_weight
-=
it
->
out_votes
;
_producersext
.
erase
(
_producersext
.
begin
());
}
...
...
@@ -418,8 +411,38 @@ namespace eosiosystem {
}
void
system_contract
::
setautosche
(
bool
auto_sche
)
{
require_auth
(
N
(
ytaadminuser
));
global_state3_singleton
_globalext2
(
_self
,
_self
);
eosio_global_state3
_global_state3
;
if
(
_globalext2
.
exists
())
{
_global_state3
=
_globalext2
.
get
();
}
else
{
_global_state3
=
eosio_global_state3
{};
}
_global_state3
.
is_schedule
=
auto_sche
;
_globalext2
.
set
(
_global_state3
,
_self
);
}
void
system_contract
::
update_elected_producers_yta
(
block_timestamp
block_time
)
{
global_state3_singleton
_globalext2
(
_self
,
_self
);
eosio_global_state3
_global_state3
;
bool
isSchedule
=
true
;
if
(
_globalext2
.
exists
())
{
_global_state3
=
_globalext2
.
get
();
isSchedule
=
_global_state3
.
is_schedule
;
}
if
(
!
isSchedule
)
return
;
all_prods_singleton
_all_prods
(
_self
,
_self
);
all_prods_level
_all_prods_state
;
...
...
contracts/eosio.token/eosio.token.cpp
浏览文件 @
41e30d17
...
...
@@ -122,7 +122,7 @@ void token::sub_balance_yta( account_name owner, asset value , account_name to)
bool
is_frozen
=
hddlock
(
hdd_lock_account
).
is_frozen
(
owner
);
//todo : need consider lock_token situation
if
(
to
==
hdd_deposit_account
)
{
//缴纳罚金,锁仓币也可以缴纳罚金
if
(
to
==
N
(
yottaforfeit
)
)
{
//缴纳罚金,锁仓币也可以缴纳罚金
eosio_assert
(
from
.
balance
.
amount
>=
value
.
amount
,
"overdrawn balance"
);
}
else
if
(
to
==
N
(
eosio
.
stake
)
)
{
//用来抵押带宽和CPU
eosio_assert
(
!
is_frozen
,
"user is frozen"
);
...
...
contracts/hdddeposit/hdddeposit.cpp
浏览文件 @
41e30d17
...
...
@@ -15,7 +15,6 @@ using namespace eosio;
static
constexpr
eosio
::
name
active_permission
{
N
(
active
)};
static
constexpr
eosio
::
name
token_account
{
N
(
eosio
.
token
)};
static
constexpr
eosio
::
name
system_account
{
N
(
eosio
)};
static
constexpr
eosio
::
name
hdd_deposit_account
{
N
(
hdddeposit12
)};
static
constexpr
eosio
::
name
hdd_lock_account
{
N
(
hddlock12345
)};
...
...
@@ -196,7 +195,7 @@ void hdddeposit::payforfeit(name user, uint64_t minerid, asset quant, uint8_t ac
action
(
permission_level
{
user
,
active_permission
},
token_account
,
N
(
transfer
),
std
::
make_tuple
(
user
,
hdd_deposit_account
,
quant
,
std
::
string
(
"draw forfeit"
)))
std
::
make_tuple
(
user
,
N
(
yottaforfeit
)
,
quant
,
std
::
string
(
"draw forfeit"
)))
.
send
();
if
(
eosiosystem
::
isActiveVoter
(
user
)
)
{
...
...
contracts/hddlock/hddlock.cpp
浏览文件 @
41e30d17
...
...
@@ -96,14 +96,23 @@ void hddlock::locktransfer(uint64_t lockruleid, account_name from, account_name
}
acclock_table
_acclock
(
_self
,
to
);
_acclock
.
emplace
(
_self
,
[
&
](
auto
&
row
)
{
row
.
quantity
=
quantity
;
row
.
lockruleid
=
lockruleid
;
row
.
user
=
to
;
row
.
from
=
from
;
row
.
memo
=
memo
;
row
.
time
=
current_time
();
});
auto
itlc
=
_acclock
.
find
(
lockruleid
);
if
(
itlc
!=
_acclock
.
end
())
{
_acclock
.
modify
(
itlc
,
_self
,
[
&
](
auto
&
row
)
{
row
.
time
=
current_time
();
row
.
quantity
+=
quantity
;
});
}
else
{
_acclock
.
emplace
(
_self
,
[
&
](
auto
&
row
)
{
row
.
quantity
=
quantity
;
row
.
lockruleid
=
lockruleid
;
row
.
user
=
to
;
row
.
from
=
from
;
row
.
memo
=
memo
;
row
.
time
=
current_time
();
});
}
}
void
hddlock
::
frozenuser
(
account_name
user
,
uint64_t
time
)
{
...
...
contracts/hddlock/hddlock.hpp
浏览文件 @
41e30d17
...
...
@@ -47,7 +47,7 @@ class hddlock : public eosio::contract {
account_name
from
;
std
::
string
memo
;
uint64_t
time
;
uint64_t
primary_key
()
const
{
return
time
;
}
uint64_t
primary_key
()
const
{
return
lockruleid
;
}
};
typedef
multi_index
<
N
(
acclock
),
acclock
>
acclock_table
;
...
...
contracts/hddpool/hddpool.cpp
浏览文件 @
41e30d17
...
...
@@ -36,7 +36,7 @@ const uint64_t max_minerspace = 64 * 1024 * uint64_t(1024 * 100); //100T 单个
static
constexpr
eosio
::
name
active_permission
{
N
(
active
)};
static
constexpr
eosio
::
name
token_account
{
N
(
eosio
.
token
)};
static
constexpr
eosio
::
name
hdd_
account
{
N
(
hddpool12345
)};
static
constexpr
eosio
::
name
hdd_
exchg_acc
{
N
(
hddpoolexchg
)};
static
constexpr
eosio
::
name
hdd_deposit
{
N
(
hdddeposit12
)};
static
constexpr
int64_t
max_hdd_amount
=
(
1LL
<<
62
)
-
1
;
...
...
@@ -229,7 +229,7 @@ void hddpool::buyhdd(name from, name receiver, asset quant)
eosio_assert
(
is_account
(
from
),
"user not a account"
);
eosio_assert
(
is_account
(
receiver
),
"receiver not a account"
);
eosio_assert
(
is_account
(
hdd_
account
),
"to not a account"
);
eosio_assert
(
is_account
(
hdd_
exchg_acc
),
"to not a account"
);
eosio_assert
(
quant
.
is_valid
(),
"asset is invalid"
);
eosio_assert
(
quant
.
symbol
==
CORE_SYMBOL
,
"must use core asset to buy HDD"
);
eosio_assert
(
quant
.
amount
>
0
,
"must transfer positive quantity"
);
...
...
@@ -238,7 +238,7 @@ void hddpool::buyhdd(name from, name receiver, asset quant)
action
(
permission_level
{
from
,
active_permission
},
token_account
,
N
(
transfer
),
std
::
make_tuple
(
from
,
hdd_
account
,
quant
,
std
::
string
(
"buy hdd"
)))
std
::
make_tuple
(
from
,
hdd_
exchg_acc
,
quant
,
std
::
string
(
"buy hdd"
)))
.
send
();
int64_t
_hdd_amount
=
0
;
...
...
@@ -300,9 +300,9 @@ void hddpool::sellhdd(name user, int64_t amount)
asset
quant
{
_yta_amount
,
CORE_SYMBOL
};
action
(
permission_level
{
hdd_
account
,
active_permission
},
permission_level
{
hdd_
exchg_acc
,
active_permission
},
token_account
,
N
(
transfer
),
std
::
make_tuple
(
hdd_
account
,
user
,
quant
,
std
::
string
(
"sell hdd"
)))
std
::
make_tuple
(
hdd_
exchg_acc
,
user
,
quant
,
std
::
string
(
"sell hdd"
)))
.
send
();
update_total_hdd_balance
(
-
amount
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录