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
f1ddc5d6
Commit
f1ddc5d6
authored
Dec 03, 2021
by
QM
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
2374fd92
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
60 additions
and
52 deletions
+60
-52
dockerRelayerBsc.sh
plugin/dapp/bridgevmxgo/cmd/build/dockerRelayerBsc.sh
+31
-38
Erc20AndBridgeToken.go
.../cross2eth/boss4x/ethereum/offline/Erc20AndBridgeToken.go
+1
-2
deployCrossX2Eth.go
...app/cross2eth/boss4x/ethereum/offline/deployCrossX2Eth.go
+5
-7
signCmd.go
plugin/dapp/cross2eth/boss4x/ethereum/offline/signCmd.go
+2
-1
deployContractCmd.go
...app/dex/boss/deploy/ethereum/offline/deployContractCmd.go
+21
-4
No files found.
plugin/dapp/bridgevmxgo/cmd/build/dockerRelayerBsc.sh
View file @
f1ddc5d6
...
...
@@ -275,41 +275,40 @@ function TestETH2Chain33Assets() {
result
=
$(${
CLIA
}
ethereum balance
-o
"
${
ethBridgeBank
}
"
)
cli_ret
"
${
result
}
"
"balance"
".balance"
"0"
result
=
$(${
CLIA
}
ethereum lock
-m
0.02
-k
"
${
ethTestAddrKey1
}
"
-r
"
${
chain33ReceiverAddr
}
"
)
result
=
$(${
CLIA
}
ethereum lock
-m
0.0
0
2
-k
"
${
ethTestAddrKey1
}
"
-r
"
${
chain33ReceiverAddr
}
"
)
cli_ret
"
${
result
}
"
"lock"
# eth 等待 2 个区块
sleep
4
result
=
$(${
CLIA
}
ethereum balance
-o
"
${
ethBridgeBank
}
"
)
cli_ret
"
${
result
}
"
"balance"
".balance"
"0.02"
cli_ret
"
${
result
}
"
"balance"
".balance"
"0.0
0
2"
sleep
${
maturityDegree
}
# chain33 chain33EthBridgeTokenAddr(ETH合约中)查询 lock 金额
result
=
$(${
Chain33Cli
}
evm query
-a
"
${
chain33EthBridgeTokenAddr
}
"
-c
"
${
chain33DeployAddr
}
"
-b
"balanceOf(
${
chain33ReceiverAddr
}
)"
)
is_equal
"
${
result
}
"
"20
00000"
# is_equal "${result}" "2
00000"
# 原来的数额
result
=
$(${
CLIA
}
ethereum balance
-o
"
${
ethTestAddr2
}
"
)
cli_ret
"
${
result
}
"
"balance"
".balance"
"1000"
echo
'#5.burn ETH from Chain33 ETH(Chain33)-----> Ethereum'
result
=
$(${
CLIA
}
chain33 burn
-m
0.003
-k
"
${
chain33ReceiverAddrKey
}
"
-r
"
${
ethTestAddr2
}
"
-t
"
${
chain33EthBridgeTokenAddr
}
"
)
result
=
$(${
CLIA
}
chain33 burn
-m
0.00
0
3
-k
"
${
chain33ReceiverAddrKey
}
"
-r
"
${
ethTestAddr2
}
"
-t
"
${
chain33EthBridgeTokenAddr
}
"
)
cli_ret
"
${
result
}
"
"burn"
sleep
${
maturityDegree
}
echo
"check the balance on chain33"
result
=
$(${
Chain33Cli
}
evm query
-a
"
${
chain33EthBridgeTokenAddr
}
"
-c
"
${
chain33DeployAddr
}
"
-b
"balanceOf(
${
chain33ReceiverAddr
}
)"
)
is_equal
"
${
result
}
"
"170
0000"
# is_equal "${result}" "17
0000"
# 查询 ETH 这端 bridgeBank 地址 0
result
=
$(${
CLIA
}
ethereum balance
-o
"
${
ethBridgeBank
}
"
)
cli_ret
"
${
result
}
"
"balance"
".balance"
"0.017"
cli_ret
"
${
result
}
"
"balance"
".balance"
"0.0
0
17"
echo
'#5.burn ETH from Chain33 ETH(Chain33)-----> Ethereum 6'
result
=
$(${
CLIA
}
chain33 burn
-m
0.017
-k
"
${
chain33ReceiverAddrKey
}
"
-r
"
${
ethTestAddr2
}
"
-t
"
${
chain33EthBridgeTokenAddr
}
"
)
result
=
$(${
CLIA
}
chain33 burn
-m
0.0
0
17
-k
"
${
chain33ReceiverAddrKey
}
"
-r
"
${
ethTestAddr2
}
"
-t
"
${
chain33EthBridgeTokenAddr
}
"
)
cli_ret
"
${
result
}
"
"burn"
sleep
${
maturityDegree
}
...
...
@@ -941,25 +940,21 @@ function configbridgevmxgoAddr() {
function
TestETH2EVMToChain33
()
{
# 查询 ETH 这端 bridgeBank 地址原来是 0
result
=
$(${
CLIA
}
ethereum balance
-o
"
${
ethBridgeBank
}
"
)
# cli_ret "${result}" "balance" ".balance" "16"
# ETH 这端 lock
11个
result
=
$(${
CLIA
}
ethereum lock
-m
1
1
-k
"
${
ethTestAddrKey1
}
"
-r
"
${
chain33ReceiverAddr
}
"
)
#
cli_ret "${result}" "lock"
# ETH 这端 lock
result
=
$(${
CLIA
}
ethereum lock
-m
0.00
1
-k
"
${
ethTestAddrKey1
}
"
-r
"
${
chain33ReceiverAddr
}
"
)
cli_ret
"
${
result
}
"
"lock"
# eth 等待 2 个区块
sleep
4
# 查询 ETH 这端 bridgeBank 地址 11 原来16
result
=
$(${
CLIA
}
ethereum balance
-o
"
${
ethBridgeBank
}
"
)
# cli_ret "${result}" "balance" ".balance" "27"
sleep
${
maturityDegree
}
# chain33 chain33EthBridgeTokenAddr(ETH合约中)查询 lock 金额
result
=
$(${
Chain33Cli
}
evm query
-a
"
${
chain33EthBridgeTokenAddr
}
"
-c
"
${
chain33DeployAddr
}
"
-b
"balanceOf(
${
chain33ReceiverAddr
}
)"
)
# 结果是 11 * le8
# is_equal "${result}" "4700000000"
updateConfig
"HT"
"
${
chain33EthBridgeTokenAddr
}
"
configbridgevmxgoAddr
"
${
XgoChain33BridgeBank
}
"
...
...
@@ -967,14 +962,12 @@ function TestETH2EVMToChain33() {
${
EvmxgoBoss4xCLI
}
chain33 offline approve_erc20
-a
330000000000
-s
"
${
XgoChain33BridgeBank
}
"
-c
"
${
chain33EthBridgeTokenAddr
}
"
-k
"
${
chain33ReceiverAddrKey
}
"
-f
1
--chainID
"
${
chain33ID
}
"
chain33_offline_send_evm
"approve_erc20.txt"
hash
=
$(${
Chain33Cli
}
send evm call
-f
1
-k
"
${
chain33ReceiverAddr
}
"
-e
"
${
XgoChain33BridgeBank
}
"
-p
"lock(
${
chain33TestAddr2
}
,
${
chain33EthBridgeTokenAddr
}
,
5000
00000)"
--chainID
"
${
chain33ID
}
"
)
hash
=
$(${
Chain33Cli
}
send evm call
-f
1
-k
"
${
chain33ReceiverAddr
}
"
-e
"
${
XgoChain33BridgeBank
}
"
-p
"lock(
${
chain33TestAddr2
}
,
${
chain33EthBridgeTokenAddr
}
,
1
00000)"
--chainID
"
${
chain33ID
}
"
)
check_tx
"
${
Chain33Cli
}
"
"
${
hash
}
"
result
=
$(${
Chain33Cli
}
evm query
-a
"
${
chain33EthBridgeTokenAddr
}
"
-c
"
${
chain33DeployAddr
}
"
-b
"balanceOf(
${
chain33ReceiverAddr
}
)"
)
# is_equal "${result}" "4200000000"
result
=
$(${
Chain33Cli
}
evm query
-a
"
${
chain33EthBridgeTokenAddr
}
"
-c
"
${
chain33DeployAddr
}
"
-b
"balanceOf(
${
XgoChain33BridgeBank
}
)"
)
# is_equal "${result}" "500000000"
}
function
Testethereum2EVMToChain33_byc
()
{
...
...
@@ -1101,29 +1094,29 @@ function AllRelayerMainTest() {
Chain33Cli
=
${
Para8901Cli
}
TestChain33ToEthAssets
TestETH2Chain33Assets
#
TestChain33ToEthZBCAssets
#
TestETH2Chain33Byc
#
TestETH2Chain33USDT
#
#
Chain33Cli=${Para8901Cli}
#
lockBty
#
lockChain33Ycc
TestChain33ToEthZBCAssets
TestETH2Chain33Byc
TestETH2Chain33USDT
Chain33Cli
=
${
Para8901Cli
}
lockBty
lockChain33Ycc
# lockEth
#
lockEthByc
#
lockEthUSDT
lockEthByc
lockEthUSDT
# 离线多签地址转入阈值设大
#
offline_set_offline_token_Bty 100000000000000 10
#
offline_set_offline_token_Chain33Ycc 100000000000000 10
#
offline_set_offline_token_Eth 100000000000000 10
#
offline_set_offline_token_EthByc 100000000000000 10
#
offline_set_offline_token_EthUSDT 100000000000000 10
#
EvmxgoBoss4xCLI="./evmxgoboss4x --rpc_laddr http://${docker_chain33_ip}:8901 --paraName user.p.para."
#
DeployEvmxgo
#
TestETH2EVMToChain33
#
Testethereum2EVMToChain33_byc
#
Testethereum2EVMToChain33_usdt
offline_set_offline_token_Bty 100000000000000 10
offline_set_offline_token_Chain33Ycc 100000000000000 10
offline_set_offline_token_Eth 100000000000000 10
offline_set_offline_token_EthByc 100000000000000 10
offline_set_offline_token_EthUSDT 100000000000000 10
EvmxgoBoss4xCLI
=
"./evmxgoboss4x --rpc_laddr http://
${
docker_chain33_ip
}
:8901 --paraName user.p.para."
DeployEvmxgo
TestETH2EVMToChain33
Testethereum2EVMToChain33_byc
Testethereum2EVMToChain33_usdt
echo_addrs
echo
-e
"
${
GRE
}
===========
$FUNCNAME
end ===========
${
NOC
}
"
...
...
plugin/dapp/cross2eth/boss4x/ethereum/offline/Erc20AndBridgeToken.go
View file @
f1ddc5d6
...
...
@@ -57,7 +57,6 @@ func DeployERC20(cmd *cobra.Command, _ []string) {
owner
,
_
:=
cmd
.
Flags
()
.
GetString
(
"owner"
)
symbol
,
_
:=
cmd
.
Flags
()
.
GetString
(
"symbol"
)
amount
,
_
:=
cmd
.
Flags
()
.
GetString
(
"amount"
)
chainEthId
,
_
:=
cmd
.
Flags
()
.
GetInt64
(
"chainEthId"
)
bnAmount
:=
big
.
NewInt
(
1
)
bnAmount
,
_
=
bnAmount
.
SetString
(
utils
.
TrimZeroAndDot
(
amount
),
10
)
client
,
err
:=
ethclient
.
Dial
(
url
)
...
...
@@ -97,7 +96,7 @@ func DeployERC20(cmd *cobra.Command, _ []string) {
}
infos
=
append
(
infos
,
&
deployInfo
)
fileName
:=
fmt
.
Sprintf
(
"deployErc20%s.txt"
,
symbol
)
err
=
NewTxWrite
(
infos
,
common
.
HexToAddress
(
deployerAddr
),
url
,
fileName
,
chainEthId
)
err
=
NewTxWrite
(
infos
,
common
.
HexToAddress
(
deployerAddr
),
url
,
fileName
)
if
err
!=
nil
{
fmt
.
Println
(
"NewTxWrite error"
,
err
.
Error
())
return
...
...
plugin/dapp/cross2eth/boss4x/ethereum/offline/deployCrossX2Eth.go
View file @
f1ddc5d6
...
...
@@ -50,7 +50,6 @@ func createTx(cmd *cobra.Command, _ []string) {
validatorsAddrs
,
_
:=
cmd
.
Flags
()
.
GetString
(
"validatorsAddrs"
)
initpowers
,
_
:=
cmd
.
Flags
()
.
GetString
(
"initPowers"
)
owner
,
_
:=
cmd
.
Flags
()
.
GetString
(
"owner"
)
chainEthId
,
_
:=
cmd
.
Flags
()
.
GetInt64
(
"chainEthId"
)
deployerAddr
:=
common
.
HexToAddress
(
owner
)
validatorsAddrsArray
:=
strings
.
Split
(
validatorsAddrs
,
","
)
initPowersArray
:=
strings
.
Split
(
initpowers
,
","
)
...
...
@@ -79,13 +78,13 @@ func createTx(cmd *cobra.Command, _ []string) {
initPowers
=
append
(
initPowers
,
big
.
NewInt
(
vint64
))
}
err
:=
createDeployTxs
(
url
,
deployerAddr
,
validators
,
initPowers
,
chainEthId
)
err
:=
createDeployTxs
(
url
,
deployerAddr
,
validators
,
initPowers
)
if
err
!=
nil
{
panic
(
err
)
}
}
func
createDeployTxs
(
url
string
,
deployerAddr
common
.
Address
,
validators
[]
common
.
Address
,
initPowers
[]
*
big
.
Int
,
chainEthId
int64
)
error
{
func
createDeployTxs
(
url
string
,
deployerAddr
common
.
Address
,
validators
[]
common
.
Address
,
initPowers
[]
*
big
.
Int
)
error
{
client
,
err
:=
ethclient
.
Dial
(
url
)
if
err
!=
nil
{
return
err
...
...
@@ -157,10 +156,10 @@ func createDeployTxs(url string, deployerAddr common.Address, validators []commo
mulSignAddr
:=
crypto
.
CreateAddress
(
deployerAddr
,
startNonce
+
7
)
infos
=
append
(
infos
,
&
DeployInfo
{
PackData
:
packData
,
ContractorAddr
:
mulSignAddr
,
Name
:
"mulSignAddr"
,
Nonce
:
startNonce
+
7
,
To
:
nil
})
return
NewTxWrite
(
infos
,
deployerAddr
,
url
,
"deploytxs.txt"
,
chainEthId
)
return
NewTxWrite
(
infos
,
deployerAddr
,
url
,
"deploytxs.txt"
)
}
func
NewTxWrite
(
infos
[]
*
DeployInfo
,
deployerAddr
common
.
Address
,
url
,
fileName
string
,
chainId
int64
)
error
{
func
NewTxWrite
(
infos
[]
*
DeployInfo
,
deployerAddr
common
.
Address
,
url
,
fileName
string
)
error
{
ctx
:=
context
.
Background
()
client
,
err
:=
ethclient
.
Dial
(
url
)
if
err
!=
nil
{
...
...
@@ -330,7 +329,6 @@ func addCreateWithFileFlags(cmd *cobra.Command) {
func
createWithFileTx
(
cmd
*
cobra
.
Command
,
_
[]
string
)
{
url
,
_
:=
cmd
.
Flags
()
.
GetString
(
"rpc_laddr_ethereum"
)
cfgpath
,
_
:=
cmd
.
Flags
()
.
GetString
(
"conf"
)
chainEthId
,
_
:=
cmd
.
Flags
()
.
GetInt64
(
"chainEthId"
)
var
deployCfg
DeployConfigInfo
InitCfg
(
cfgpath
,
&
deployCfg
)
deployPrivateKey
,
err
:=
crypto
.
ToECDSA
(
common
.
FromHex
(
deployCfg
.
DeployerPrivateKey
))
...
...
@@ -355,7 +353,7 @@ func createWithFileTx(cmd *cobra.Command, _ []string) {
initPowers
=
append
(
initPowers
,
big
.
NewInt
(
deployCfg
.
InitPowers
[
i
]))
}
err
=
createDeployTxs
(
url
,
deployerAddr
,
validators
,
initPowers
,
chainEthId
)
err
=
createDeployTxs
(
url
,
deployerAddr
,
validators
,
initPowers
)
if
err
!=
nil
{
fmt
.
Println
(
"createDeployTxs Err:"
,
err
)
return
...
...
plugin/dapp/cross2eth/boss4x/ethereum/offline/signCmd.go
View file @
f1ddc5d6
...
...
@@ -29,6 +29,7 @@ func addSignFlag(cmd *cobra.Command) {
func
signTx
(
cmd
*
cobra
.
Command
,
_
[]
string
)
{
privatekey
,
_
:=
cmd
.
Flags
()
.
GetString
(
"key"
)
txFilePath
,
_
:=
cmd
.
Flags
()
.
GetString
(
"file"
)
chainEthId
,
_
:=
cmd
.
Flags
()
.
GetInt64
(
"chainEthId"
)
deployPrivateKey
,
err
:=
crypto
.
ToECDSA
(
common
.
FromHex
(
privatekey
))
if
err
!=
nil
{
panic
(
err
)
...
...
@@ -47,7 +48,7 @@ func signTx(cmd *cobra.Command, _ []string) {
if
err
!=
nil
{
panic
(
err
)
}
signedTx
,
txHash
,
err
:=
eoff
.
Sign
Tx
(
deployPrivateKey
,
&
tx
)
signedTx
,
txHash
,
err
:=
eoff
.
Sign
EIP155Tx
(
deployPrivateKey
,
&
tx
,
chainEthId
)
if
err
!=
nil
{
panic
(
err
)
}
...
...
plugin/dapp/dex/boss/deploy/ethereum/offline/deployContractCmd.go
View file @
f1ddc5d6
...
...
@@ -53,7 +53,6 @@ func (s *SignCmd) addFlags(cmd *cobra.Command) {
cmd
.
MarkFlagRequired
(
"nonce"
)
cmd
.
Flags
()
.
Int64P
(
"gasprice"
,
"g"
,
1000000000
,
"gas price"
)
// 1Gwei=1e9wei
cmd
.
MarkFlagRequired
(
"gasprice"
)
}
func
(
s
*
SignCmd
)
signContract
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
...
...
@@ -270,12 +269,30 @@ func (s *SignPanCakeRout) reWriteDeployPanCakeRout(nonce uint64, gasPrice *big.I
var
amount
=
new
(
big
.
Int
)
ntx
:=
types
.
NewContractCreation
(
nonce
,
amount
,
gasLimit
,
gasPrice
,
data
)
return
SignTx
(
key
,
ntx
)
}
func
SignTx
(
key
*
ecdsa
.
PrivateKey
,
tx
*
types
.
Transaction
)
(
signedTx
,
hash
string
,
err
error
)
{
//signer := types.HomesteadSigner{}
signer
:=
types
.
NewEIP155Signer
(
big
.
NewInt
(
256
))
signer
:=
types
.
HomesteadSigner
{}
txhash
:=
signer
.
Hash
(
tx
)
signature
,
err
:=
crypto
.
Sign
(
txhash
.
Bytes
(),
key
)
if
err
!=
nil
{
return
}
tx
,
err
=
tx
.
WithSignature
(
signer
,
signature
)
if
err
!=
nil
{
return
}
txBinary
,
err
:=
tx
.
MarshalBinary
()
if
err
!=
nil
{
return
}
hash
=
tx
.
Hash
()
.
String
()
signedTx
=
common
.
Bytes2Hex
(
txBinary
[
:
])
return
}
func
SignEIP155Tx
(
key
*
ecdsa
.
PrivateKey
,
tx
*
types
.
Transaction
,
chainEthId
int64
)
(
signedTx
,
hash
string
,
err
error
)
{
signer
:=
types
.
NewEIP155Signer
(
big
.
NewInt
(
chainEthId
))
txhash
:=
signer
.
Hash
(
tx
)
signature
,
err
:=
crypto
.
Sign
(
txhash
.
Bytes
(),
key
)
if
err
!=
nil
{
...
...
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