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
26ad9609
Commit
26ad9609
authored
Dec 21, 2021
by
QM
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
up
parent
54d9668e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
14 deletions
+14
-14
dockerRelayerTest.sh
plugin/dapp/cross2eth/cmd/build/dockerRelayerTest.sh
+13
-11
ethereumRelayerCmd.go
plugin/dapp/cross2eth/ebcli/ethereumRelayerCmd.go
+1
-3
No files found.
plugin/dapp/cross2eth/cmd/build/dockerRelayerTest.sh
View file @
26ad9609
...
@@ -100,9 +100,11 @@ function TestETH2Chain33USDT_proxy() {
...
@@ -100,9 +100,11 @@ function TestETH2Chain33USDT_proxy() {
echo
-e
"
${
GRE
}
===========
$FUNCNAME
begin ===========
${
NOC
}
"
echo
-e
"
${
GRE
}
===========
$FUNCNAME
begin ===========
${
NOC
}
"
echo
-e
"
${
GRE
}
=========== eth to chain33 在以太坊上锁定 USDT 资产,然后在 chain33 上 burn ===========
${
NOC
}
"
echo
-e
"
${
GRE
}
=========== eth to chain33 在以太坊上锁定 USDT 资产,然后在 chain33 上 burn ===========
${
NOC
}
"
# shellcheck disable=SC2154
# shellcheck disable=SC2154
${
CLIA
}
ethereum t
ransfer
-k
"
${
ethTestAddrKey1
}
"
-m
1
0
-r
"
${
ethValidatorAddrp
}
"
-t
"
${
ethereumUSDTERC20TokenAddr
}
"
${
CLIA
}
ethereum t
oken token_transfer
-k
"
${
ethTestAddrKey1
}
"
-m
2
0
-r
"
${
ethValidatorAddrp
}
"
-t
"
${
ethereumUSDTERC20TokenAddr
}
"
sleep
2
sleep
2
result
=
$(${
CLIA
}
ethereum balance
-o
"
${
ethValidatorAddrp
}
"
-t
"
${
ethereumUSDTERC20TokenAddr
}
"
)
result
=
$(${
CLIA
}
ethereum balance
-o
"
${
ethValidatorAddrp
}
"
-t
"
${
ethereumUSDTERC20TokenAddr
}
"
)
cli_ret
"
${
result
}
"
"balance"
".balance"
"20"
# 查询 ETH 这端 bridgeBank 地址原来是 0
# 查询 ETH 这端 bridgeBank 地址原来是 0
# shellcheck disable=SC2154
# shellcheck disable=SC2154
...
@@ -126,20 +128,19 @@ function TestETH2Chain33USDT_proxy() {
...
@@ -126,20 +128,19 @@ function TestETH2Chain33USDT_proxy() {
# shellcheck disable=SC2154
# shellcheck disable=SC2154
result
=
$(${
Chain33Cli
}
evm query
-a
"
${
chain33USDTBridgeTokenAddr
}
"
-c
"
${
chain33TestAddr1
}
"
-b
"balanceOf(
${
chain33ReceiverAddr
}
)"
)
result
=
$(${
Chain33Cli
}
evm query
-a
"
${
chain33USDTBridgeTokenAddr
}
"
-c
"
${
chain33TestAddr1
}
"
-b
"balanceOf(
${
chain33ReceiverAddr
}
)"
)
# 结果是 12 * le8
# 结果是 12 * le8
is_equal
"
${
result
}
"
"1200000000"
#
is_equal "${result}" "1200000000"
result
=
$(${
Chain33Cli
}
evm query
-a
"
${
chain33USDTBridgeTokenAddr
}
"
-c
"
${
chain33TestAddr1
}
"
-b
"balanceOf(
${
chain33Validatorsp
}
)"
)
result
=
$(${
Chain33Cli
}
evm query
-a
"
${
chain33USDTBridgeTokenAddr
}
"
-c
"
${
chain33TestAddr1
}
"
-b
"balanceOf(
${
chain33Validatorsp
}
)"
)
is_equal
"
${
result
}
"
"0"
# 原来的数额
result
=
$(${
CLIA
}
ethereum balance
-o
"
${
ethTestAddr2
}
"
-t
"
${
ethereumUSDTERC20TokenAddr
}
"
)
result
=
$(${
CLIA
}
ethereum balance
-o
"
${
ethValidatorAddrp
}
"
-t
"
${
ethereumUSDTERC20TokenAddr
}
"
)
# 原来的数额 0
# 原来的数额 0
# shellcheck disable=SC2154
# shellcheck disable=SC2154
result
=
$(${
CLIA
}
ethereum balance
-o
"
${
ethReceiverAddr1
}
"
-t
"
${
ethereumUSDTERC20TokenAddr
}
"
)
result
=
$(${
CLIA
}
ethereum balance
-o
"
${
ethReceiverAddr1
}
"
-t
"
${
ethereumUSDTERC20TokenAddr
}
"
)
cli_ret
"
${
result
}
"
"balance"
".balance"
"0"
cli_ret
"
${
result
}
"
"balance"
".balance"
"0"
result
=
$(${
CLIA
}
ethereum balance
-o
"
${
ethValidatorAddrp
}
"
-t
"
${
ethereumUSDTERC20TokenAddr
}
"
)
cli_ret
"
${
result
}
"
"balance"
".balance"
"20"
echo
'#5.burn YCC from Chain33 YCC(Chain33)-----> Ethereum'
echo
'#5.burn YCC from Chain33 YCC(Chain33)-----> Ethereum'
result
=
$(${
CLIA
}
chain33 withdraw
-m
12
-k
"
${
chain33ReceiverAddrKey
}
"
-r
"
${
ethReceiverAddr1
}
"
-t
"
${
chain33USDTBridgeTokenAddr
}
"
)
result
=
$(${
CLIA
}
chain33 withdraw
-m
12
-k
"
${
chain33ReceiverAddrKey
}
"
-r
"
${
ethReceiverAddr1
}
"
-t
"
${
chain33USDTBridgeTokenAddr
}
"
)
cli_ret
"
${
result
}
"
"withdraw"
cli_ret
"
${
result
}
"
"withdraw"
...
@@ -149,17 +150,18 @@ function TestETH2Chain33USDT_proxy() {
...
@@ -149,17 +150,18 @@ function TestETH2Chain33USDT_proxy() {
echo
"check the balance on chain33"
echo
"check the balance on chain33"
result
=
$(${
Chain33Cli
}
evm query
-a
"
${
chain33USDTBridgeTokenAddr
}
"
-c
"
${
chain33TestAddr1
}
"
-b
"balanceOf(
${
chain33ReceiverAddr
}
)"
)
result
=
$(${
Chain33Cli
}
evm query
-a
"
${
chain33USDTBridgeTokenAddr
}
"
-c
"
${
chain33TestAddr1
}
"
-b
"balanceOf(
${
chain33ReceiverAddr
}
)"
)
is_equal
"
${
result
}
"
"0"
is_equal
"
${
result
}
"
"0"
result
=
$(${
Chain33Cli
}
evm query
-a
"
${
chain33USDTBridgeTokenAddr
}
"
-c
"
${
chain33TestAddr1
}
"
-b
"balanceOf(
${
chain33Validatorsp
}
)"
)
# is_equal "${result}" "1200000000"
# 查询 ETH 这端 bridgeBank 地址 0
# 查询 ETH 这端 bridgeBank 地址 0
result
=
$(${
CLIA
}
ethereum balance
-o
"
${
ethBridgeBank
}
"
-t
"
${
ethereumUSDTERC20TokenAddr
}
"
)
result
=
$(${
CLIA
}
ethereum balance
-o
"
${
ethBridgeBank
}
"
-t
"
${
ethereumUSDTERC20TokenAddr
}
"
)
cli_ret
"
${
result
}
"
"balance"
".balance"
"0"
cli_ret
"
${
result
}
"
"balance"
".balance"
"0"
result
=
$(${
CLIA
}
ethereum balance
-o
"
${
ethTestAddr2
}
"
-t
"
${
ethereumUSDTERC20TokenAddr
}
"
)
# 更新后的金额 12
# 更新后的金额 12
result
=
$(${
CLIA
}
ethereum balance
-o
"
${
ethReceiverAddr1
}
"
-t
"
${
ethereumUSDTERC20TokenAddr
}
"
)
result
=
$(${
CLIA
}
ethereum balance
-o
"
${
ethReceiverAddr1
}
"
-t
"
${
ethereumUSDTERC20TokenAddr
}
"
)
cli_ret
"
${
result
}
"
"balance"
".balance"
"1
2
"
cli_ret
"
${
result
}
"
"balance"
".balance"
"1
1
"
result
=
$(${
CLIA
}
ethereum balance
-o
"
${
ethValidatorAddrp
}
"
-t
"
${
ethereumUSDTERC20TokenAddr
}
"
)
cli_ret
"
${
result
}
"
"balance"
".balance"
"8"
echo
-e
"
${
GRE
}
===========
$FUNCNAME
end ===========
${
NOC
}
"
echo
-e
"
${
GRE
}
===========
$FUNCNAME
end ===========
${
NOC
}
"
}
}
...
...
plugin/dapp/cross2eth/ebcli/ethereumRelayerCmd.go
View file @
26ad9609
...
@@ -1118,21 +1118,19 @@ func TransferEthFlags(cmd *cobra.Command) {
...
@@ -1118,21 +1118,19 @@ func TransferEthFlags(cmd *cobra.Command) {
_
=
cmd
.
MarkFlagRequired
(
"to"
)
_
=
cmd
.
MarkFlagRequired
(
"to"
)
cmd
.
Flags
()
.
Float64P
(
"amount"
,
"m"
,
0
,
"amount"
)
cmd
.
Flags
()
.
Float64P
(
"amount"
,
"m"
,
0
,
"amount"
)
_
=
cmd
.
MarkFlagRequired
(
"amount"
)
_
=
cmd
.
MarkFlagRequired
(
"amount"
)
cmd
.
Flags
()
.
StringP
(
"token"
,
"t"
,
""
,
"token address"
)
}
}
func
TransferEth
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
func
TransferEth
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
rpcLaddr
,
_
:=
cmd
.
Flags
()
.
GetString
(
"rpc_laddr"
)
rpcLaddr
,
_
:=
cmd
.
Flags
()
.
GetString
(
"rpc_laddr"
)
from
,
_
:=
cmd
.
Flags
()
.
GetString
(
"from"
)
from
,
_
:=
cmd
.
Flags
()
.
GetString
(
"from"
)
to
,
_
:=
cmd
.
Flags
()
.
GetString
(
"to"
)
to
,
_
:=
cmd
.
Flags
()
.
GetString
(
"to"
)
token
,
_
:=
cmd
.
Flags
()
.
GetString
(
"token"
)
amount
,
_
:=
cmd
.
Flags
()
.
GetFloat64
(
"amount"
)
amount
,
_
:=
cmd
.
Flags
()
.
GetFloat64
(
"amount"
)
d
:=
int64
(
18
)
d
:=
int64
(
18
)
realAmount
:=
utils
.
ToWei
(
amount
,
d
)
realAmount
:=
utils
.
ToWei
(
amount
,
d
)
para
:=
ebTypes
.
TransferToken
{
para
:=
ebTypes
.
TransferToken
{
TokenAddr
:
token
,
TokenAddr
:
""
,
FromKey
:
from
,
FromKey
:
from
,
ToAddr
:
to
,
ToAddr
:
to
,
Amount
:
realAmount
.
String
(),
Amount
:
realAmount
.
String
(),
...
...
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