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
e96b4141
Commit
e96b4141
authored
Dec 03, 2021
by
QM
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add ethereum chainId
parent
9b764957
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
17 deletions
+14
-17
cli.go
plugin/dapp/cross2eth/boss4x/cli.go
+1
-0
Erc20AndBridgeToken.go
.../cross2eth/boss4x/ethereum/offline/Erc20AndBridgeToken.go
+2
-1
deployCrossX2Eth.go
...app/cross2eth/boss4x/ethereum/offline/deployCrossX2Eth.go
+9
-6
offline.go
plugin/dapp/cross2eth/boss4x/ethereum/offline/offline.go
+2
-10
No files found.
plugin/dapp/cross2eth/boss4x/cli.go
View file @
e96b4141
...
@@ -28,6 +28,7 @@ func main() {
...
@@ -28,6 +28,7 @@ func main() {
rootCmd
.
PersistentFlags
()
.
String
(
"paraName"
,
""
,
"para chain name,Eg:user.p.fzm."
)
rootCmd
.
PersistentFlags
()
.
String
(
"paraName"
,
""
,
"para chain name,Eg:user.p.fzm."
)
rootCmd
.
PersistentFlags
()
.
String
(
"expire"
,
"120m"
,
"transaction expire time (optional)"
)
rootCmd
.
PersistentFlags
()
.
String
(
"expire"
,
"120m"
,
"transaction expire time (optional)"
)
rootCmd
.
PersistentFlags
()
.
Int32
(
"chainID"
,
0
,
"chain id, default to 0"
)
rootCmd
.
PersistentFlags
()
.
Int32
(
"chainID"
,
0
,
"chain id, default to 0"
)
rootCmd
.
PersistentFlags
()
.
Int64
(
"chainEthId"
,
256
,
"ethereum chain id, default to 0"
)
if
err
:=
rootCmd
.
Execute
();
err
!=
nil
{
if
err
:=
rootCmd
.
Execute
();
err
!=
nil
{
fmt
.
Println
(
err
)
fmt
.
Println
(
err
)
...
...
plugin/dapp/cross2eth/boss4x/ethereum/offline/Erc20AndBridgeToken.go
View file @
e96b4141
...
@@ -57,6 +57,7 @@ func DeployERC20(cmd *cobra.Command, _ []string) {
...
@@ -57,6 +57,7 @@ func DeployERC20(cmd *cobra.Command, _ []string) {
owner
,
_
:=
cmd
.
Flags
()
.
GetString
(
"owner"
)
owner
,
_
:=
cmd
.
Flags
()
.
GetString
(
"owner"
)
symbol
,
_
:=
cmd
.
Flags
()
.
GetString
(
"symbol"
)
symbol
,
_
:=
cmd
.
Flags
()
.
GetString
(
"symbol"
)
amount
,
_
:=
cmd
.
Flags
()
.
GetString
(
"amount"
)
amount
,
_
:=
cmd
.
Flags
()
.
GetString
(
"amount"
)
chainEthId
,
_
:=
cmd
.
Flags
()
.
GetInt64
(
"chainEthId"
)
bnAmount
:=
big
.
NewInt
(
1
)
bnAmount
:=
big
.
NewInt
(
1
)
bnAmount
,
_
=
bnAmount
.
SetString
(
utils
.
TrimZeroAndDot
(
amount
),
10
)
bnAmount
,
_
=
bnAmount
.
SetString
(
utils
.
TrimZeroAndDot
(
amount
),
10
)
client
,
err
:=
ethclient
.
Dial
(
url
)
client
,
err
:=
ethclient
.
Dial
(
url
)
...
@@ -96,7 +97,7 @@ func DeployERC20(cmd *cobra.Command, _ []string) {
...
@@ -96,7 +97,7 @@ func DeployERC20(cmd *cobra.Command, _ []string) {
}
}
infos
=
append
(
infos
,
&
deployInfo
)
infos
=
append
(
infos
,
&
deployInfo
)
fileName
:=
fmt
.
Sprintf
(
"deployErc20%s.txt"
,
symbol
)
fileName
:=
fmt
.
Sprintf
(
"deployErc20%s.txt"
,
symbol
)
err
=
NewTxWrite
(
infos
,
common
.
HexToAddress
(
deployerAddr
),
url
,
fileName
)
err
=
NewTxWrite
(
infos
,
common
.
HexToAddress
(
deployerAddr
),
url
,
fileName
,
chainEthId
)
if
err
!=
nil
{
if
err
!=
nil
{
fmt
.
Println
(
"NewTxWrite error"
,
err
.
Error
())
fmt
.
Println
(
"NewTxWrite error"
,
err
.
Error
())
return
return
...
...
plugin/dapp/cross2eth/boss4x/ethereum/offline/deployCrossX2Eth.go
View file @
e96b4141
...
@@ -50,6 +50,7 @@ func createTx(cmd *cobra.Command, _ []string) {
...
@@ -50,6 +50,7 @@ func createTx(cmd *cobra.Command, _ []string) {
validatorsAddrs
,
_
:=
cmd
.
Flags
()
.
GetString
(
"validatorsAddrs"
)
validatorsAddrs
,
_
:=
cmd
.
Flags
()
.
GetString
(
"validatorsAddrs"
)
initpowers
,
_
:=
cmd
.
Flags
()
.
GetString
(
"initPowers"
)
initpowers
,
_
:=
cmd
.
Flags
()
.
GetString
(
"initPowers"
)
owner
,
_
:=
cmd
.
Flags
()
.
GetString
(
"owner"
)
owner
,
_
:=
cmd
.
Flags
()
.
GetString
(
"owner"
)
chainEthId
,
_
:=
cmd
.
Flags
()
.
GetInt64
(
"chainEthId"
)
deployerAddr
:=
common
.
HexToAddress
(
owner
)
deployerAddr
:=
common
.
HexToAddress
(
owner
)
validatorsAddrsArray
:=
strings
.
Split
(
validatorsAddrs
,
","
)
validatorsAddrsArray
:=
strings
.
Split
(
validatorsAddrs
,
","
)
initPowersArray
:=
strings
.
Split
(
initpowers
,
","
)
initPowersArray
:=
strings
.
Split
(
initpowers
,
","
)
...
@@ -78,13 +79,13 @@ func createTx(cmd *cobra.Command, _ []string) {
...
@@ -78,13 +79,13 @@ func createTx(cmd *cobra.Command, _ []string) {
initPowers
=
append
(
initPowers
,
big
.
NewInt
(
vint64
))
initPowers
=
append
(
initPowers
,
big
.
NewInt
(
vint64
))
}
}
err
:=
createDeployTxs
(
url
,
deployerAddr
,
validators
,
initPowers
)
err
:=
createDeployTxs
(
url
,
deployerAddr
,
validators
,
initPowers
,
chainEthId
)
if
err
!=
nil
{
if
err
!=
nil
{
panic
(
err
)
panic
(
err
)
}
}
}
}
func
createDeployTxs
(
url
string
,
deployerAddr
common
.
Address
,
validators
[]
common
.
Address
,
initPowers
[]
*
big
.
Int
)
error
{
func
createDeployTxs
(
url
string
,
deployerAddr
common
.
Address
,
validators
[]
common
.
Address
,
initPowers
[]
*
big
.
Int
,
chainEthId
int64
)
error
{
client
,
err
:=
ethclient
.
Dial
(
url
)
client
,
err
:=
ethclient
.
Dial
(
url
)
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
...
@@ -156,10 +157,10 @@ func createDeployTxs(url string, deployerAddr common.Address, validators []commo
...
@@ -156,10 +157,10 @@ func createDeployTxs(url string, deployerAddr common.Address, validators []commo
mulSignAddr
:=
crypto
.
CreateAddress
(
deployerAddr
,
startNonce
+
7
)
mulSignAddr
:=
crypto
.
CreateAddress
(
deployerAddr
,
startNonce
+
7
)
infos
=
append
(
infos
,
&
DeployInfo
{
PackData
:
packData
,
ContractorAddr
:
mulSignAddr
,
Name
:
"mulSignAddr"
,
Nonce
:
startNonce
+
7
,
To
:
nil
})
infos
=
append
(
infos
,
&
DeployInfo
{
PackData
:
packData
,
ContractorAddr
:
mulSignAddr
,
Name
:
"mulSignAddr"
,
Nonce
:
startNonce
+
7
,
To
:
nil
})
return
NewTxWrite
(
infos
,
deployerAddr
,
url
,
"deploytxs.txt"
)
return
NewTxWrite
(
infos
,
deployerAddr
,
url
,
"deploytxs.txt"
,
chainEthId
)
}
}
func
NewTxWrite
(
infos
[]
*
DeployInfo
,
deployerAddr
common
.
Address
,
url
,
fileName
string
)
error
{
func
NewTxWrite
(
infos
[]
*
DeployInfo
,
deployerAddr
common
.
Address
,
url
,
fileName
string
,
chainId
int64
)
error
{
ctx
:=
context
.
Background
()
ctx
:=
context
.
Background
()
client
,
err
:=
ethclient
.
Dial
(
url
)
client
,
err
:=
ethclient
.
Dial
(
url
)
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -184,7 +185,8 @@ func NewTxWrite(infos []*DeployInfo, deployerAddr common.Address, url, fileName
...
@@ -184,7 +185,8 @@ func NewTxWrite(infos []*DeployInfo, deployerAddr common.Address, url, fileName
if
gasLimit
<
100
*
10000
{
if
gasLimit
<
100
*
10000
{
gasLimit
=
100
*
10000
gasLimit
=
100
*
10000
}
}
ntx
:=
types
.
NewTx
(
&
types
.
LegacyTx
{
ntx
:=
types
.
NewTx
(
&
types
.
AccessListTx
{
ChainID
:
big
.
NewInt
(
chainId
),
Nonce
:
info
.
Nonce
,
Nonce
:
info
.
Nonce
,
Gas
:
gasLimit
,
Gas
:
gasLimit
,
GasPrice
:
price
,
GasPrice
:
price
,
...
@@ -327,6 +329,7 @@ func addCreateWithFileFlags(cmd *cobra.Command) {
...
@@ -327,6 +329,7 @@ func addCreateWithFileFlags(cmd *cobra.Command) {
func
createWithFileTx
(
cmd
*
cobra
.
Command
,
_
[]
string
)
{
func
createWithFileTx
(
cmd
*
cobra
.
Command
,
_
[]
string
)
{
url
,
_
:=
cmd
.
Flags
()
.
GetString
(
"rpc_laddr_ethereum"
)
url
,
_
:=
cmd
.
Flags
()
.
GetString
(
"rpc_laddr_ethereum"
)
cfgpath
,
_
:=
cmd
.
Flags
()
.
GetString
(
"conf"
)
cfgpath
,
_
:=
cmd
.
Flags
()
.
GetString
(
"conf"
)
chainEthId
,
_
:=
cmd
.
Flags
()
.
GetInt64
(
"chainEthId"
)
var
deployCfg
DeployConfigInfo
var
deployCfg
DeployConfigInfo
InitCfg
(
cfgpath
,
&
deployCfg
)
InitCfg
(
cfgpath
,
&
deployCfg
)
deployPrivateKey
,
err
:=
crypto
.
ToECDSA
(
common
.
FromHex
(
deployCfg
.
DeployerPrivateKey
))
deployPrivateKey
,
err
:=
crypto
.
ToECDSA
(
common
.
FromHex
(
deployCfg
.
DeployerPrivateKey
))
...
@@ -351,7 +354,7 @@ func createWithFileTx(cmd *cobra.Command, _ []string) {
...
@@ -351,7 +354,7 @@ func createWithFileTx(cmd *cobra.Command, _ []string) {
initPowers
=
append
(
initPowers
,
big
.
NewInt
(
deployCfg
.
InitPowers
[
i
]))
initPowers
=
append
(
initPowers
,
big
.
NewInt
(
deployCfg
.
InitPowers
[
i
]))
}
}
err
=
createDeployTxs
(
url
,
deployerAddr
,
validators
,
initPowers
)
err
=
createDeployTxs
(
url
,
deployerAddr
,
validators
,
initPowers
,
chainEthId
)
if
err
!=
nil
{
if
err
!=
nil
{
fmt
.
Println
(
"createDeployTxs Err:"
,
err
)
fmt
.
Println
(
"createDeployTxs Err:"
,
err
)
return
return
...
...
plugin/dapp/cross2eth/boss4x/ethereum/offline/offline.go
View file @
e96b4141
...
@@ -4,25 +4,17 @@ import (
...
@@ -4,25 +4,17 @@ import (
"context"
"context"
"encoding/json"
"encoding/json"
"fmt"
"fmt"
//"github.com/33cn/plugin/plugin/dapp/cross2eth/contracts/contracts4eth/generated"
//erc20 "github.com/33cn/plugin/plugin/dapp/cross2eth/contracts/erc20/generated"
//"github.com/33cn/plugin/plugin/dapp/cross2eth/ebrelayer/utils"
tml
"github.com/BurntSushi/toml"
"github.com/ethereum/go-ethereum"
//"github.com/ethereum/go-ethereum/accounts/abi"
"io/ioutil"
"io/ioutil"
"math/big"
"math/big"
"os"
"os"
tml
"github.com/BurntSushi/toml"
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/ethclient"
"github.com/ethereum/go-ethereum/ethclient"
"github.com/spf13/cobra"
"github.com/spf13/cobra"
//"strings"
//"time"
)
)
type
DeployContractRet
struct
{
type
DeployContractRet
struct
{
...
...
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