Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
plugin
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
link33
plugin
Commits
07736434
Commit
07736434
authored
May 08, 2020
by
hezhengjun
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'x2eth_200507' of github.com:zhengjunhe/plugin into x2eth_200507
parents
c0c58ef3
69e84426
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
141 additions
and
87 deletions
+141
-87
allRelayerTest.sh
plugin/dapp/x2Ethereum/cmd/build/allRelayerTest.sh
+79
-28
commands.go
plugin/dapp/x2Ethereum/commands/commands.go
+20
-20
relayToChain33.go
plugin/dapp/x2Ethereum/ebrelayer/ethtxs/relayToChain33.go
+18
-18
claim.go
plugin/dapp/x2Ethereum/executor/ethbridge/claim.go
+9
-9
exec.go
plugin/dapp/x2Ethereum/executor/exec.go
+1
-0
exec_test.go
plugin/dapp/x2Ethereum/executor/exec_test.go
+10
-10
oracle.pb.go
plugin/dapp/x2Ethereum/types/oracle.pb.go
+2
-1
x2ethereum.pb.go
plugin/dapp/x2Ethereum/types/x2ethereum.pb.go
+2
-1
No files found.
plugin/dapp/x2Ethereum/cmd/build/allRelayerTest.sh
View file @
07736434
...
@@ -42,6 +42,22 @@ ethReceiverAddr2="0x0c05ba5c230fdaa503b53702af1962e08d0c60bf"
...
@@ -42,6 +42,22 @@ ethReceiverAddr2="0x0c05ba5c230fdaa503b53702af1962e08d0c60bf"
ethReceiverAddrKey2
=
"9dc6df3a8ab139a54d8a984f54958ae0661f880229bf3bdbb886b87d58b56a08"
ethReceiverAddrKey2
=
"9dc6df3a8ab139a54d8a984f54958ae0661f880229bf3bdbb886b87d58b56a08"
maturityDegree
=
10
maturityDegree
=
10
function
kill_ebrelayerC
()
{
kill_ebrelayer
"./C/ebrelayer"
}
function
kill_ebrelayerD
()
{
kill_ebrelayer
"./D/ebrelayer"
}
function
start_ebrelayerC
()
{
start_ebrelayer
"./C/ebrelayer"
"./C/ebrelayer.log"
${
CLIC
}
relayer unlock
-p
123456hzj
sleep
60
}
function
start_ebrelayerD
()
{
start_ebrelayer
"./D/ebrelayer"
"./D/ebrelayer.log"
${
CLID
}
relayer unlock
-p
123456hzj
sleep
60
}
function
InitAndDeploy
()
{
function
InitAndDeploy
()
{
echo
-e
"
${
GRE
}
===========
$FUNCNAME
begin ===========
${
NOC
}
"
echo
-e
"
${
GRE
}
===========
$FUNCNAME
begin ===========
${
NOC
}
"
...
@@ -60,15 +76,13 @@ function InitAndDeploy() {
...
@@ -60,15 +76,13 @@ function InitAndDeploy() {
function
EthImportKey
()
{
function
EthImportKey
()
{
echo
-e
"
${
GRE
}
===========
$FUNCNAME
begin ===========
${
NOC
}
"
echo
-e
"
${
GRE
}
===========
$FUNCNAME
begin ===========
${
NOC
}
"
# 重启 ebrelayer 并解锁
# 重启 ebrelayer 并解锁
for
name
in
A B C D
for
name
in
A B C D
;
do
do
start_ebrelayer
"./"
$name
"/ebrelayer"
"./"
$name
"/ebrelayer.log"
start_ebrelayer
"./"
$name
"/ebrelayer"
"./"
$name
"/ebrelayer.log"
# 导入测试地址私钥
# 导入测试地址私钥
CLI
=
"./ebcli_
$name
"
CLI
=
"./ebcli_
$name
"
result
=
$(${
CLI
}
relayer set_pwd
-n
123456hzj
-o
kk
)
result
=
$(${
CLI
}
relayer set_pwd
-n
123456hzj
-o
kk
)
#cli_ret "${result}" "set_pwd"
result
=
$(${
CLI
}
relayer unlock
-p
123456hzj
)
result
=
$(${
CLI
}
relayer unlock
-p
123456hzj
)
cli_ret
"
${
result
}
"
"unlock"
cli_ret
"
${
result
}
"
"unlock"
...
@@ -107,8 +121,7 @@ function EthImportKey() {
...
@@ -107,8 +121,7 @@ function EthImportKey() {
function
StartRelayerAndDeploy
()
{
function
StartRelayerAndDeploy
()
{
echo
-e
"
${
GRE
}
===========
$FUNCNAME
begin ===========
${
NOC
}
"
echo
-e
"
${
GRE
}
===========
$FUNCNAME
begin ===========
${
NOC
}
"
for
name
in
A B C D
for
name
in
A B C D
;
do
do
local
ebrelayer
=
"./
$name
/ebrelayer"
local
ebrelayer
=
"./
$name
/ebrelayer"
kill_ebrelayer
"
${
ebrelayer
}
"
kill_ebrelayer
"
${
ebrelayer
}
"
done
done
...
@@ -128,7 +141,6 @@ function StartRelayerAndDeploy() {
...
@@ -128,7 +141,6 @@ function StartRelayerAndDeploy() {
# 获取 BridgeRegistry 地址
# 获取 BridgeRegistry 地址
result
=
$(${
CLIA
}
relayer ethereum bridgeRegistry
)
result
=
$(${
CLIA
}
relayer ethereum bridgeRegistry
)
BridgeRegistry
=
$(
cli_ret
"
${
result
}
"
"bridgeRegistry"
".addr"
)
BridgeRegistry
=
$(
cli_ret
"
${
result
}
"
"bridgeRegistry"
".addr"
)
# BridgeRegistry="0x5331F912027057fBE8139D91B225246e8159232f"
kill_ebrelayer
"./A/ebrelayer"
kill_ebrelayer
"./A/ebrelayer"
# 修改 relayer.toml 配置文件
# 修改 relayer.toml 配置文件
...
@@ -171,7 +183,7 @@ function InitChain33Vilators() {
...
@@ -171,7 +183,7 @@ function InitChain33Vilators() {
# cions 转帐到 x2ethereum 合约地址
# cions 转帐到 x2ethereum 合约地址
hash
=
$(${
Chain33Cli
}
send coins send_exec
-e
x2ethereum
-a
200
-k
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
)
hash
=
$(${
Chain33Cli
}
send coins send_exec
-e
x2ethereum
-a
200
-k
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
)
check_tx
"
${
Chain33Cli
}
"
"
${
hash
}
"
check_tx
"
${
Chain33Cli
}
"
"
${
hash
}
"
result
=
$(${
Chain33Cli
}
account balance
-a
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
-e
x2ethereum
)
result
=
$(${
Chain33Cli
}
account balance
-a
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
-e
x2ethereum
)
balance_ret
"
${
result
}
"
"200.0000"
balance_ret
"
${
result
}
"
"200.0000"
...
@@ -209,15 +221,23 @@ function TestChain33ToEthAssets() {
...
@@ -209,15 +221,23 @@ function TestChain33ToEthAssets() {
result
=
$(${
CLIA
}
relayer ethereum balance
-o
"
${
ethReceiverAddr1
}
"
-t
"
${
tokenAddr
}
"
)
result
=
$(${
CLIA
}
relayer ethereum balance
-o
"
${
ethReceiverAddr1
}
"
-t
"
${
tokenAddr
}
"
)
cli_ret
"
${
result
}
"
"balance"
".balance"
"0"
cli_ret
"
${
result
}
"
"balance"
".balance"
"0"
kill_ebrelayerC
kill_ebrelayerD
# chain33 lock bty
# chain33 lock bty
hash
=
$(${
Chain33Cli
}
send x2ethereum lock
-a
5
-t
bty
-r
${
ethReceiverAddr1
}
-q
${
tokenAddr
}
-k
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
)
hash
=
$(${
Chain33Cli
}
send x2ethereum lock
-a
5
-t
bty
-r
${
ethReceiverAddr1
}
-q
${
tokenAddr
}
-k
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
)
block_wait
"
${
Chain33Cli
}
"
$((
${
maturityDegree
}
+
2
))
block_wait
"
${
Chain33Cli
}
"
$((
maturityDegree
+
2
))
check_tx
"
${
Chain33Cli
}
"
"
${
hash
}
"
check_tx
"
${
Chain33Cli
}
"
"
${
hash
}
"
result
=
$(${
Chain33Cli
}
account balance
-a
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
-e
x2ethereum
)
result
=
$(${
Chain33Cli
}
account balance
-a
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
-e
x2ethereum
)
balance_ret
"
${
result
}
"
"195.0000"
balance_ret
"
${
result
}
"
"195.0000"
eth_block_wait
$((${
maturityDegree
}
+
2
))
eth_block_wait
$((
maturityDegree
+
2
))
result
=
$(${
CLIA
}
relayer ethereum balance
-o
"
${
ethReceiverAddr1
}
"
-t
"
${
tokenAddr
}
"
)
cli_ret
"
${
result
}
"
"balance"
".balance"
"0"
start_ebrelayerC
result
=
$(${
CLIA
}
relayer ethereum balance
-o
"
${
ethReceiverAddr1
}
"
-t
"
${
tokenAddr
}
"
)
result
=
$(${
CLIA
}
relayer ethereum balance
-o
"
${
ethReceiverAddr1
}
"
-t
"
${
tokenAddr
}
"
)
cli_ret
"
${
result
}
"
"balance"
".balance"
"5"
cli_ret
"
${
result
}
"
"balance"
".balance"
"5"
...
@@ -230,10 +250,15 @@ function TestChain33ToEthAssets() {
...
@@ -230,10 +250,15 @@ function TestChain33ToEthAssets() {
cli_ret
"
${
result
}
"
"balance"
".balance"
"0"
cli_ret
"
${
result
}
"
"balance"
".balance"
"0"
# eth 等待 10 个区块
# eth 等待 10 个区块
eth_block_wait
$((
${
maturityDegree
}
+
2
))
eth_block_wait
$((
maturityDegree
+
2
))
result
=
$(${
Chain33Cli
}
account balance
-a
"
${
chain33SenderAddr
}
"
-e
x2ethereum
)
result
=
$(${
Chain33Cli
}
account balance
-a
"
${
chain33SenderAddr
}
"
-e
x2ethereum
)
balance_ret
"
${
result
}
"
"5.0000"
balance_ret
"
${
result
}
"
"0"
start_ebrelayerD
result
=
$(${
Chain33Cli
}
account balance
-a
"
${
chain33SenderAddr
}
"
-e
x2ethereum
)
balance_ret
"
${
result
}
"
"5"
echo
-e
"
${
GRE
}
===========
$FUNCNAME
end ===========
${
NOC
}
"
echo
-e
"
${
GRE
}
===========
$FUNCNAME
end ===========
${
NOC
}
"
}
}
...
@@ -250,24 +275,36 @@ function TestETH2Chain33Assets() {
...
@@ -250,24 +275,36 @@ function TestETH2Chain33Assets() {
result
=
$(${
CLIA
}
relayer ethereum balance
-o
"
${
bridgeBankAddr
}
"
)
result
=
$(${
CLIA
}
relayer ethereum balance
-o
"
${
bridgeBankAddr
}
"
)
cli_ret
"
${
result
}
"
"balance"
".balance"
"0"
cli_ret
"
${
result
}
"
"balance"
".balance"
"0"
# eth lock 10
kill_ebrelayerC
result
=
$(${
CLIA
}
relayer ethereum lock
-m
10
-k
"
${
ethReceiverAddrKey1
}
"
-r
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
)
kill_ebrelayerD
# eth lock 0.1
result
=
$(${
CLIA
}
relayer ethereum lock
-m
0.1
-k
"
${
ethReceiverAddrKey1
}
"
-r
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
)
cli_ret
"
${
result
}
"
"lock"
cli_ret
"
${
result
}
"
"lock"
result
=
$(${
CLIA
}
relayer ethereum balance
-o
"
${
bridgeBankAddr
}
"
)
result
=
$(${
CLIA
}
relayer ethereum balance
-o
"
${
bridgeBankAddr
}
"
)
cli_ret
"
${
result
}
"
"balance"
".balance"
"
10
"
cli_ret
"
${
result
}
"
"balance"
".balance"
"
0.1
"
# eth 等待 10 个区块
# eth 等待 10 个区块
eth_block_wait
$((
${
maturityDegree
}
+
2
))
eth_block_wait
$((
maturityDegree
+
2
))
result
=
$(${
Chain33Cli
}
x2ethereum balance
-s
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
-t
eth | jq
".res"
| jq
".[]"
)
result
=
$(${
Chain33Cli
}
x2ethereum balance
-s
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
-t
eth | jq
".res"
| jq
".[]"
)
balance_ret
"
${
result
}
"
"10"
balance_ret
"
${
result
}
"
"0"
start_ebrelayerC
start_ebrelayerD
result
=
$(${
Chain33Cli
}
x2ethereum balance
-s
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
-t
eth | jq
".res"
| jq
".[]"
)
balance_ret
"
${
result
}
"
"0.1"
result
=
$(${
CLIA
}
relayer ethereum balance
-o
"
${
ethReceiverAddr2
}
"
)
result
=
$(${
CLIA
}
relayer ethereum balance
-o
"
${
ethReceiverAddr2
}
"
)
balance
=
$(
cli_ret
"
${
result
}
"
"balance"
".balance"
)
balance
=
$(
cli_ret
"
${
result
}
"
"balance"
".balance"
)
hash
=
$(${
Chain33Cli
}
send x2ethereum burn
-a
10
-t
eth
-r
${
ethReceiverAddr2
}
-k
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
)
kill_ebrelayerC
block_wait
"
${
Chain33Cli
}
"
$((${
maturityDegree
}
+
2
))
kill_ebrelayerD
hash
=
$(${
Chain33Cli
}
send x2ethereum burn
-a
0.1
-t
eth
-r
${
ethReceiverAddr2
}
-k
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
)
block_wait
"
${
Chain33Cli
}
"
$((
maturityDegree
+
2
))
check_tx
"
${
Chain33Cli
}
"
"
${
hash
}
"
check_tx
"
${
Chain33Cli
}
"
"
${
hash
}
"
result
=
$(${
Chain33Cli
}
x2ethereum balance
-s
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
-t
eth | jq
".res"
| jq
".[]"
)
result
=
$(${
Chain33Cli
}
x2ethereum balance
-s
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
-t
eth | jq
".res"
| jq
".[]"
)
...
@@ -276,10 +313,13 @@ function TestETH2Chain33Assets() {
...
@@ -276,10 +313,13 @@ function TestETH2Chain33Assets() {
eth_block_wait 2
eth_block_wait 2
result
=
$(${
CLIA
}
relayer ethereum balance
-o
"
${
bridgeBankAddr
}
"
)
result
=
$(${
CLIA
}
relayer ethereum balance
-o
"
${
bridgeBankAddr
}
"
)
cli_ret
"
${
result
}
"
"balance"
".balance"
"0"
cli_ret
"
${
result
}
"
"balance"
".balance"
"0.1"
start_ebrelayerC
start_ebrelayerD
result
=
$(${
CLIA
}
relayer ethereum balance
-o
"
${
ethReceiverAddr2
}
"
)
result
=
$(${
CLIA
}
relayer ethereum balance
-o
"
${
ethReceiverAddr2
}
"
)
cli_ret
"
${
result
}
"
"balance"
".balance"
$(
echo
"
${
balance
}
+
10"
|
bc
)
cli_ret
"
${
result
}
"
"balance"
".balance"
$(
echo
"
${
balance
}
+
0.1"
|
bc
)
echo
-e
"
${
GRE
}
===========
$FUNCNAME
end ===========
${
NOC
}
"
echo
-e
"
${
GRE
}
===========
$FUNCNAME
end ===========
${
NOC
}
"
}
}
...
@@ -306,6 +346,9 @@ function TestETH2Chain33Erc20() {
...
@@ -306,6 +346,9 @@ function TestETH2Chain33Erc20() {
result
=
$(${
CLIA
}
relayer ethereum balance
-o
"
${
bridgeBankAddr
}
"
-t
"
${
tokenAddr
}
"
)
result
=
$(${
CLIA
}
relayer ethereum balance
-o
"
${
bridgeBankAddr
}
"
-t
"
${
tokenAddr
}
"
)
cli_ret
"
${
result
}
"
"balance"
".balance"
"0"
cli_ret
"
${
result
}
"
"balance"
".balance"
"0"
kill_ebrelayerC
kill_ebrelayerD
# lock 100
# lock 100
result
=
$(${
CLIA
}
relayer ethereum lock
-m
100
-k
"
${
ethReceiverAddrKey1
}
"
-r
"
${
chain33Validator1
}
"
-t
"
${
tokenAddr
}
"
)
result
=
$(${
CLIA
}
relayer ethereum lock
-m
100
-k
"
${
ethReceiverAddrKey1
}
"
-r
"
${
chain33Validator1
}
"
-t
"
${
tokenAddr
}
"
)
cli_ret
"
${
result
}
"
"lock"
cli_ret
"
${
result
}
"
"lock"
...
@@ -317,14 +360,23 @@ function TestETH2Chain33Erc20() {
...
@@ -317,14 +360,23 @@ function TestETH2Chain33Erc20() {
cli_ret
"
${
result
}
"
"balance"
".balance"
"100"
cli_ret
"
${
result
}
"
"balance"
".balance"
"100"
# eth 等待 10 个区块
# eth 等待 10 个区块
eth_block_wait
$((${
maturityDegree
}
+
2
))
eth_block_wait
$((
maturityDegree
+
2
))
result
=
$(${
Chain33Cli
}
x2ethereum balance
-s
"
${
chain33Validator1
}
"
-t
"
${
tokenSymbol
}
"
-a
"
${
tokenAddr
}
"
| jq
".res"
| jq
".[]"
)
balance_ret
"
${
result
}
"
"0"
start_ebrelayerC
start_ebrelayerD
result
=
$(${
Chain33Cli
}
x2ethereum balance
-s
"
${
chain33Validator1
}
"
-t
"
${
tokenSymbol
}
"
-a
"
${
tokenAddr
}
"
| jq
".res"
| jq
".[]"
)
result
=
$(${
Chain33Cli
}
x2ethereum balance
-s
"
${
chain33Validator1
}
"
-t
"
${
tokenSymbol
}
"
-a
"
${
tokenAddr
}
"
| jq
".res"
| jq
".[]"
)
balance_ret
"
${
result
}
"
"100"
balance_ret
"
${
result
}
"
"100"
kill_ebrelayerC
kill_ebrelayerD
# chain33 burn 100
# chain33 burn 100
hash
=
$(${
Chain33Cli
}
send x2ethereum burn
-a
100
-t
"
${
tokenSymbol
}
"
-r
${
ethReceiverAddr2
}
-q
${
tokenAddr
}
-k
"
${
chain33Validator1
}
"
)
hash
=
$(${
Chain33Cli
}
send x2ethereum burn
-a
100
-t
"
${
tokenSymbol
}
"
-r
${
ethReceiverAddr2
}
-q
${
tokenAddr
}
-k
"
${
chain33Validator1
}
"
)
block_wait
"
${
Chain33Cli
}
"
$((
${
maturityDegree
}
+
2
))
block_wait
"
${
Chain33Cli
}
"
$((
maturityDegree
+
2
))
check_tx
"
${
Chain33Cli
}
"
"
${
hash
}
"
check_tx
"
${
Chain33Cli
}
"
"
${
hash
}
"
result
=
$(${
Chain33Cli
}
x2ethereum balance
-s
"
${
chain33Validator1
}
"
-t
"
${
tokenSymbol
}
"
-a
"
${
tokenAddr
}
"
| jq
".res"
| jq
".[]"
)
result
=
$(${
Chain33Cli
}
x2ethereum balance
-s
"
${
chain33Validator1
}
"
-t
"
${
tokenSymbol
}
"
-a
"
${
tokenAddr
}
"
| jq
".res"
| jq
".[]"
)
...
@@ -332,6 +384,8 @@ function TestETH2Chain33Erc20() {
...
@@ -332,6 +384,8 @@ function TestETH2Chain33Erc20() {
eth_block_wait 2
eth_block_wait 2
start_ebrelayerC
result
=
$(${
CLIA
}
relayer ethereum balance
-o
"
${
ethReceiverAddr2
}
"
-t
"
${
tokenAddr
}
"
)
result
=
$(${
CLIA
}
relayer ethereum balance
-o
"
${
ethReceiverAddr2
}
"
-t
"
${
tokenAddr
}
"
)
cli_ret
"
${
result
}
"
"balance"
".balance"
"100"
cli_ret
"
${
result
}
"
"balance"
".balance"
"100"
...
@@ -348,7 +402,7 @@ function MainTest() {
...
@@ -348,7 +402,7 @@ function MainTest() {
echo
-e
"
${
GRE
}
===========allTest
$FUNCNAME
begin ===========
${
NOC
}
"
echo
-e
"
${
GRE
}
===========allTest
$FUNCNAME
begin ===========
${
NOC
}
"
if
[[
"
${
1
}
"
!=
""
]]
;
then
if
[[
${
1
}
!=
""
]]
;
then
maturityDegree
=
${
1
}
maturityDegree
=
${
1
}
echo
-e
"
${
GRE
}
maturityDegree is
${
maturityDegree
}
${
NOC
}
"
echo
-e
"
${
GRE
}
maturityDegree is
${
maturityDegree
}
${
NOC
}
"
fi
fi
...
@@ -362,5 +416,3 @@ function MainTest() {
...
@@ -362,5 +416,3 @@ function MainTest() {
TestETH2Chain33Erc20
TestETH2Chain33Erc20
echo
-e
"
${
GRE
}
===========allTest
$FUNCNAME
end ===========
${
NOC
}
"
echo
-e
"
${
GRE
}
===========allTest
$FUNCNAME
end ===========
${
NOC
}
"
}
}
#MainTest "${1}"
\ No newline at end of file
plugin/dapp/x2Ethereum/commands/commands.go
View file @
07736434
...
@@ -116,16 +116,16 @@ func Eth2Chain33(cmd *cobra.Command, args []string) {
...
@@ -116,16 +116,16 @@ func Eth2Chain33(cmd *cobra.Command, args []string) {
params
:=
&
types3
.
Eth2Chain33
{
params
:=
&
types3
.
Eth2Chain33
{
EthereumChainID
:
ethid
,
EthereumChainID
:
ethid
,
BridgeContractAddress
:
bcontract
,
BridgeContractAddress
:
bcontract
,
Nonce
:
nonce
,
Nonce
:
nonce
,
LocalCoinSymbol
:
csymbol
,
LocalCoinSymbol
:
csymbol
,
LocalCoinExec
:
cexec
,
LocalCoinExec
:
cexec
,
TokenContractAddress
:
tcontract
,
TokenContractAddress
:
tcontract
,
EthereumSender
:
sender
,
EthereumSender
:
sender
,
Chain33Receiver
:
receiver
,
Chain33Receiver
:
receiver
,
ValidatorAddress
:
validator
,
ValidatorAddress
:
validator
,
Amount
:
strconv
.
FormatFloat
(
types3
.
MultiplySpecifyTimes
(
amount
,
decimal
),
'f'
,
4
,
64
),
Amount
:
strconv
.
FormatFloat
(
types3
.
MultiplySpecifyTimes
(
amount
,
decimal
),
'f'
,
4
,
64
),
ClaimType
:
claimtype
,
ClaimType
:
claimtype
,
Decimals
:
decimal
,
Decimals
:
decimal
,
}
}
payLoad
:=
types
.
MustPBToJSON
(
params
)
payLoad
:=
types
.
MustPBToJSON
(
params
)
...
@@ -162,16 +162,16 @@ func WithdrawEth(cmd *cobra.Command, args []string) {
...
@@ -162,16 +162,16 @@ func WithdrawEth(cmd *cobra.Command, args []string) {
params
:=
&
types3
.
Eth2Chain33
{
params
:=
&
types3
.
Eth2Chain33
{
EthereumChainID
:
ethid
,
EthereumChainID
:
ethid
,
BridgeContractAddress
:
bcontract
,
BridgeContractAddress
:
bcontract
,
Nonce
:
nonce
,
Nonce
:
nonce
,
LocalCoinSymbol
:
csymbol
,
LocalCoinSymbol
:
csymbol
,
LocalCoinExec
:
cexec
,
LocalCoinExec
:
cexec
,
TokenContractAddress
:
tcontract
,
TokenContractAddress
:
tcontract
,
EthereumSender
:
sender
,
EthereumSender
:
sender
,
Chain33Receiver
:
receiver
,
Chain33Receiver
:
receiver
,
ValidatorAddress
:
validator
,
ValidatorAddress
:
validator
,
Amount
:
strconv
.
FormatFloat
(
amount
*
1e8
,
'f'
,
4
,
64
),
Amount
:
strconv
.
FormatFloat
(
amount
*
1e8
,
'f'
,
4
,
64
),
ClaimType
:
claimtype
,
ClaimType
:
claimtype
,
Decimals
:
decimal
,
Decimals
:
decimal
,
}
}
payLoad
:=
types
.
MustPBToJSON
(
params
)
payLoad
:=
types
.
MustPBToJSON
(
params
)
...
...
plugin/dapp/x2Ethereum/ebrelayer/ethtxs/relayToChain33.go
View file @
07736434
...
@@ -26,15 +26,15 @@ func RelayLockToChain33(privateKey chain33Crypto.PrivKey, claim *ebrelayerTypes.
...
@@ -26,15 +26,15 @@ func RelayLockToChain33(privateKey chain33Crypto.PrivKey, claim *ebrelayerTypes.
params
:=
&
types
.
Eth2Chain33
{
params
:=
&
types
.
Eth2Chain33
{
EthereumChainID
:
claim
.
EthereumChainID
,
EthereumChainID
:
claim
.
EthereumChainID
,
BridgeContractAddress
:
claim
.
BridgeBrankAddr
,
BridgeContractAddress
:
claim
.
BridgeBrankAddr
,
Nonce
:
claim
.
Nonce
,
Nonce
:
claim
.
Nonce
,
LocalCoinSymbol
:
claim
.
Symbol
,
LocalCoinSymbol
:
claim
.
Symbol
,
LocalCoinExec
:
X2Eth
,
LocalCoinExec
:
X2Eth
,
TokenContractAddress
:
claim
.
TokenAddr
,
TokenContractAddress
:
claim
.
TokenAddr
,
EthereumSender
:
claim
.
EthereumSender
,
EthereumSender
:
claim
.
EthereumSender
,
Chain33Receiver
:
claim
.
Chain33Receiver
,
Chain33Receiver
:
claim
.
Chain33Receiver
,
Amount
:
claim
.
Amount
,
Amount
:
claim
.
Amount
,
ClaimType
:
int64
(
claim
.
ClaimType
),
ClaimType
:
int64
(
claim
.
ClaimType
),
Decimals
:
claim
.
Decimal
,
Decimals
:
claim
.
Decimal
,
}
}
pm
:=
rpctypes
.
CreateTxIn
{
pm
:=
rpctypes
.
CreateTxIn
{
...
@@ -83,15 +83,15 @@ func RelayBurnToChain33(privateKey chain33Crypto.PrivKey, claim *ebrelayerTypes.
...
@@ -83,15 +83,15 @@ func RelayBurnToChain33(privateKey chain33Crypto.PrivKey, claim *ebrelayerTypes.
params
:=
&
types
.
Eth2Chain33
{
params
:=
&
types
.
Eth2Chain33
{
EthereumChainID
:
claim
.
EthereumChainID
,
EthereumChainID
:
claim
.
EthereumChainID
,
BridgeContractAddress
:
claim
.
BridgeBrankAddr
,
BridgeContractAddress
:
claim
.
BridgeBrankAddr
,
Nonce
:
claim
.
Nonce
,
Nonce
:
claim
.
Nonce
,
LocalCoinSymbol
:
claim
.
Symbol
,
LocalCoinSymbol
:
claim
.
Symbol
,
LocalCoinExec
:
X2Eth
,
LocalCoinExec
:
X2Eth
,
TokenContractAddress
:
claim
.
TokenAddr
,
TokenContractAddress
:
claim
.
TokenAddr
,
EthereumSender
:
claim
.
EthereumSender
,
EthereumSender
:
claim
.
EthereumSender
,
Chain33Receiver
:
claim
.
Chain33Receiver
,
Chain33Receiver
:
claim
.
Chain33Receiver
,
Amount
:
claim
.
Amount
,
Amount
:
claim
.
Amount
,
ClaimType
:
int64
(
claim
.
ClaimType
),
ClaimType
:
int64
(
claim
.
ClaimType
),
Decimals
:
claim
.
Decimal
,
Decimals
:
claim
.
Decimal
,
}
}
pm
:=
rpctypes
.
CreateTxIn
{
pm
:=
rpctypes
.
CreateTxIn
{
...
...
plugin/dapp/x2Ethereum/executor/ethbridge/claim.go
View file @
07736434
...
@@ -19,15 +19,15 @@ func NewEthBridgeClaim(ethereumChainID int64, bridgeContract string, nonce int64
...
@@ -19,15 +19,15 @@ func NewEthBridgeClaim(ethereumChainID int64, bridgeContract string, nonce int64
return
types
.
Eth2Chain33
{
return
types
.
Eth2Chain33
{
EthereumChainID
:
ethereumChainID
,
EthereumChainID
:
ethereumChainID
,
BridgeContractAddress
:
bridgeContract
,
BridgeContractAddress
:
bridgeContract
,
Nonce
:
nonce
,
Nonce
:
nonce
,
TokenContractAddress
:
tokenContact
,
TokenContractAddress
:
tokenContact
,
EthereumSender
:
ethereumSender
,
EthereumSender
:
ethereumSender
,
Chain33Receiver
:
chain33Receiver
,
Chain33Receiver
:
chain33Receiver
,
ValidatorAddress
:
validator
,
ValidatorAddress
:
validator
,
Amount
:
amount
,
Amount
:
amount
,
ClaimType
:
claimType
,
ClaimType
:
claimType
,
LocalCoinSymbol
:
localCoinSymbol
,
LocalCoinSymbol
:
localCoinSymbol
,
LocalCoinExec
:
localCoinExec
,
LocalCoinExec
:
localCoinExec
,
}
}
}
}
...
...
plugin/dapp/x2Ethereum/executor/exec.go
View file @
07736434
...
@@ -2,6 +2,7 @@ package executor
...
@@ -2,6 +2,7 @@ package executor
import
(
import
(
"errors"
"errors"
"github.com/33cn/chain33/common/address"
"github.com/33cn/chain33/common/address"
"github.com/33cn/chain33/types"
"github.com/33cn/chain33/types"
x2ethereumtypes
"github.com/33cn/plugin/plugin/dapp/x2Ethereum/types"
x2ethereumtypes
"github.com/33cn/plugin/plugin/dapp/x2Ethereum/types"
...
...
plugin/dapp/x2Ethereum/executor/exec_test.go
View file @
07736434
...
@@ -171,16 +171,16 @@ func (x *suiteX2Ethereum) Test_4_Eth2Chain33() {
...
@@ -171,16 +171,16 @@ func (x *suiteX2Ethereum) Test_4_Eth2Chain33() {
payload
:=
&
types2
.
Eth2Chain33
{
payload
:=
&
types2
.
Eth2Chain33
{
EthereumChainID
:
0
,
EthereumChainID
:
0
,
BridgeContractAddress
:
bridgeContractAddress
,
BridgeContractAddress
:
bridgeContractAddress
,
Nonce
:
0
,
Nonce
:
0
,
LocalCoinSymbol
:
symbol
,
LocalCoinSymbol
:
symbol
,
LocalCoinExec
:
coinExec
,
LocalCoinExec
:
coinExec
,
TokenContractAddress
:
tokenContractAddress
,
TokenContractAddress
:
tokenContractAddress
,
EthereumSender
:
ethereumAddr
,
EthereumSender
:
ethereumAddr
,
Chain33Receiver
:
chain33Receiver
,
Chain33Receiver
:
chain33Receiver
,
ValidatorAddress
:
addValidator1
,
ValidatorAddress
:
addValidator1
,
Amount
:
10
,
Amount
:
10
,
ClaimType
:
common2
.
LockText
,
ClaimType
:
common2
.
LockText
,
EthSymbol
:
symbol
,
EthSymbol
:
symbol
,
}
}
receipt
,
err
:=
x
.
action
.
procMsgEth2Chain33
(
payload
)
receipt
,
err
:=
x
.
action
.
procMsgEth2Chain33
(
payload
)
...
...
plugin/dapp/x2Ethereum/types/oracle.pb.go
View file @
07736434
...
@@ -5,8 +5,9 @@ package types
...
@@ -5,8 +5,9 @@ package types
import
(
import
(
fmt
"fmt"
fmt
"fmt"
proto
"github.com/golang/protobuf/proto"
math
"math"
math
"math"
proto
"github.com/golang/protobuf/proto"
)
)
// Reference imports to suppress errors if they are not otherwise used.
// Reference imports to suppress errors if they are not otherwise used.
...
...
plugin/dapp/x2Ethereum/types/x2ethereum.pb.go
View file @
07736434
...
@@ -6,10 +6,11 @@ package types
...
@@ -6,10 +6,11 @@ package types
import
(
import
(
context
"context"
context
"context"
fmt
"fmt"
fmt
"fmt"
math
"math"
types
"github.com/33cn/chain33/types"
types
"github.com/33cn/chain33/types"
proto
"github.com/golang/protobuf/proto"
proto
"github.com/golang/protobuf/proto"
grpc
"google.golang.org/grpc"
grpc
"google.golang.org/grpc"
math
"math"
)
)
// Reference imports to suppress errors if they are not otherwise used.
// Reference imports to suppress errors if they are not otherwise used.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment