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
0728e1aa
Commit
0728e1aa
authored
Dec 24, 2021
by
QM
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix gas
parent
83cf1891
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
30 additions
and
9 deletions
+30
-9
ConfigplatformTokenSymbol.go
...2eth/boss4x/ethereum/offline/ConfigplatformTokenSymbol.go
+2
-1
Erc20AndBridgeToken.go
.../cross2eth/boss4x/ethereum/offline/Erc20AndBridgeToken.go
+4
-2
cfgAccount.go
plugin/dapp/cross2eth/boss4x/ethereum/offline/cfgAccount.go
+4
-2
cfgLockedToken.go
.../dapp/cross2eth/boss4x/ethereum/offline/cfgLockedToken.go
+2
-1
offline.go
plugin/dapp/cross2eth/boss4x/ethereum/offline/offline.go
+16
-2
safeTransferCmd.go
...dapp/cross2eth/boss4x/ethereum/offline/safeTransferCmd.go
+2
-1
No files found.
plugin/dapp/cross2eth/boss4x/ethereum/offline/ConfigplatformTokenSymbol.go
View file @
0728e1aa
...
@@ -34,6 +34,7 @@ func ConfigplatformTokenSymbol(cmd *cobra.Command, _ []string) {
...
@@ -34,6 +34,7 @@ func ConfigplatformTokenSymbol(cmd *cobra.Command, _ []string) {
symbol
,
_
:=
cmd
.
Flags
()
.
GetString
(
"symbol"
)
symbol
,
_
:=
cmd
.
Flags
()
.
GetString
(
"symbol"
)
deployAddr
,
_
:=
cmd
.
Flags
()
.
GetString
(
"deployAddr"
)
deployAddr
,
_
:=
cmd
.
Flags
()
.
GetString
(
"deployAddr"
)
contract
,
_
:=
cmd
.
Flags
()
.
GetString
(
"contract"
)
contract
,
_
:=
cmd
.
Flags
()
.
GetString
(
"contract"
)
chainEthId
,
_
:=
cmd
.
Flags
()
.
GetInt64
(
"chainEthId"
)
bridgeAbi
,
err
:=
abi
.
JSON
(
strings
.
NewReader
(
generated
.
BridgeBankABI
))
bridgeAbi
,
err
:=
abi
.
JSON
(
strings
.
NewReader
(
generated
.
BridgeBankABI
))
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -46,5 +47,5 @@ func ConfigplatformTokenSymbol(cmd *cobra.Command, _ []string) {
...
@@ -46,5 +47,5 @@ func ConfigplatformTokenSymbol(cmd *cobra.Command, _ []string) {
panic
(
err
)
panic
(
err
)
}
}
CreateTxInfoAndWrite
(
abiData
,
deployAddr
,
contract
,
"set_symbol"
,
url
)
CreateTxInfoAndWrite
(
abiData
,
deployAddr
,
contract
,
"set_symbol"
,
url
,
chainEthId
)
}
}
plugin/dapp/cross2eth/boss4x/ethereum/offline/Erc20AndBridgeToken.go
View file @
0728e1aa
...
@@ -201,6 +201,7 @@ func AddToken2LockListTx(cmd *cobra.Command, _ []string) {
...
@@ -201,6 +201,7 @@ func AddToken2LockListTx(cmd *cobra.Command, _ []string) {
deployAddr
,
_
:=
cmd
.
Flags
()
.
GetString
(
"deployAddr"
)
deployAddr
,
_
:=
cmd
.
Flags
()
.
GetString
(
"deployAddr"
)
token
,
_
:=
cmd
.
Flags
()
.
GetString
(
"token"
)
token
,
_
:=
cmd
.
Flags
()
.
GetString
(
"token"
)
contract
,
_
:=
cmd
.
Flags
()
.
GetString
(
"contract"
)
contract
,
_
:=
cmd
.
Flags
()
.
GetString
(
"contract"
)
chainEthId
,
_
:=
cmd
.
Flags
()
.
GetInt64
(
"chainEthId"
)
bridgeAbi
,
err
:=
abi
.
JSON
(
strings
.
NewReader
(
generated
.
BridgeBankABI
))
bridgeAbi
,
err
:=
abi
.
JSON
(
strings
.
NewReader
(
generated
.
BridgeBankABI
))
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -214,7 +215,7 @@ func AddToken2LockListTx(cmd *cobra.Command, _ []string) {
...
@@ -214,7 +215,7 @@ func AddToken2LockListTx(cmd *cobra.Command, _ []string) {
return
return
}
}
CreateTxInfoAndWrite
(
abiData
,
deployAddr
,
contract
,
"create_add_lock_list"
,
url
)
CreateTxInfoAndWrite
(
abiData
,
deployAddr
,
contract
,
"create_add_lock_list"
,
url
,
chainEthId
)
}
}
func
CreateBridgeTokenTxCmd
()
*
cobra
.
Command
{
func
CreateBridgeTokenTxCmd
()
*
cobra
.
Command
{
...
@@ -241,6 +242,7 @@ func CreateBridgeTokenTx(cmd *cobra.Command, _ []string) {
...
@@ -241,6 +242,7 @@ func CreateBridgeTokenTx(cmd *cobra.Command, _ []string) {
symbol
,
_
:=
cmd
.
Flags
()
.
GetString
(
"symbol"
)
symbol
,
_
:=
cmd
.
Flags
()
.
GetString
(
"symbol"
)
deployAddr
,
_
:=
cmd
.
Flags
()
.
GetString
(
"deployAddr"
)
deployAddr
,
_
:=
cmd
.
Flags
()
.
GetString
(
"deployAddr"
)
contract
,
_
:=
cmd
.
Flags
()
.
GetString
(
"contract"
)
contract
,
_
:=
cmd
.
Flags
()
.
GetString
(
"contract"
)
chainEthId
,
_
:=
cmd
.
Flags
()
.
GetInt64
(
"chainEthId"
)
bridgeAbi
,
err
:=
abi
.
JSON
(
strings
.
NewReader
(
generated
.
BridgeBankABI
))
bridgeAbi
,
err
:=
abi
.
JSON
(
strings
.
NewReader
(
generated
.
BridgeBankABI
))
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -253,5 +255,5 @@ func CreateBridgeTokenTx(cmd *cobra.Command, _ []string) {
...
@@ -253,5 +255,5 @@ func CreateBridgeTokenTx(cmd *cobra.Command, _ []string) {
fmt
.
Println
(
"bridgeAbi.Pack createNewBridgeToken Err:"
,
err
)
fmt
.
Println
(
"bridgeAbi.Pack createNewBridgeToken Err:"
,
err
)
return
return
}
}
CreateTxInfoAndWrite
(
abiData
,
deployAddr
,
contract
,
"create_bridge_token"
,
url
)
CreateTxInfoAndWrite
(
abiData
,
deployAddr
,
contract
,
"create_bridge_token"
,
url
,
chainEthId
)
}
}
plugin/dapp/cross2eth/boss4x/ethereum/offline/cfgAccount.go
View file @
0728e1aa
...
@@ -58,6 +58,7 @@ func cfgAccountTx(cmd *cobra.Command, _ []string) {
...
@@ -58,6 +58,7 @@ func cfgAccountTx(cmd *cobra.Command, _ []string) {
address
,
_
:=
cmd
.
Flags
()
.
GetString
(
"address"
)
address
,
_
:=
cmd
.
Flags
()
.
GetString
(
"address"
)
deployAddr
,
_
:=
cmd
.
Flags
()
.
GetString
(
"deployAddr"
)
deployAddr
,
_
:=
cmd
.
Flags
()
.
GetString
(
"deployAddr"
)
contract
,
_
:=
cmd
.
Flags
()
.
GetString
(
"contract"
)
contract
,
_
:=
cmd
.
Flags
()
.
GetString
(
"contract"
)
chainEthId
,
_
:=
cmd
.
Flags
()
.
GetInt64
(
"chainEthId"
)
bridgeAbi
,
err
:=
abi
.
JSON
(
strings
.
NewReader
(
generated
.
BridgeBankABI
))
bridgeAbi
,
err
:=
abi
.
JSON
(
strings
.
NewReader
(
generated
.
BridgeBankABI
))
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -70,7 +71,7 @@ func cfgAccountTx(cmd *cobra.Command, _ []string) {
...
@@ -70,7 +71,7 @@ func cfgAccountTx(cmd *cobra.Command, _ []string) {
panic
(
err
)
panic
(
err
)
}
}
CreateTxInfoAndWrite
(
abiData
,
deployAddr
,
contract
,
"set_offline_addr"
,
url
)
CreateTxInfoAndWrite
(
abiData
,
deployAddr
,
contract
,
"set_offline_addr"
,
url
,
chainEthId
)
}
}
func
SetupCmd
()
*
cobra
.
Command
{
func
SetupCmd
()
*
cobra
.
Command
{
...
@@ -96,6 +97,7 @@ func SetupOwner(cmd *cobra.Command, _ []string) {
...
@@ -96,6 +97,7 @@ func SetupOwner(cmd *cobra.Command, _ []string) {
url
,
_
:=
cmd
.
Flags
()
.
GetString
(
"rpc_laddr_ethereum"
)
url
,
_
:=
cmd
.
Flags
()
.
GetString
(
"rpc_laddr_ethereum"
)
multisign
,
_
:=
cmd
.
Flags
()
.
GetString
(
"multisign"
)
multisign
,
_
:=
cmd
.
Flags
()
.
GetString
(
"multisign"
)
deployAddr
,
_
:=
cmd
.
Flags
()
.
GetString
(
"deployAddr"
)
deployAddr
,
_
:=
cmd
.
Flags
()
.
GetString
(
"deployAddr"
)
chainEthId
,
_
:=
cmd
.
Flags
()
.
GetInt64
(
"chainEthId"
)
owner
,
_
:=
cmd
.
Flags
()
.
GetString
(
"owner"
)
owner
,
_
:=
cmd
.
Flags
()
.
GetString
(
"owner"
)
owners
:=
strings
.
Split
(
owner
,
","
)
owners
:=
strings
.
Split
(
owner
,
","
)
...
@@ -118,6 +120,6 @@ func SetupOwner(cmd *cobra.Command, _ []string) {
...
@@ -118,6 +120,6 @@ func SetupOwner(cmd *cobra.Command, _ []string) {
return
return
}
}
CreateTxInfoAndWrite
(
abiData
,
deployAddr
,
multisign
,
"multisign_setup"
,
url
)
CreateTxInfoAndWrite
(
abiData
,
deployAddr
,
multisign
,
"multisign_setup"
,
url
,
chainEthId
)
}
}
plugin/dapp/cross2eth/boss4x/ethereum/offline/cfgLockedToken.go
View file @
0728e1aa
...
@@ -53,6 +53,7 @@ func ConfigLockedTokenOfflineSave(cmd *cobra.Command, _ []string) {
...
@@ -53,6 +53,7 @@ func ConfigLockedTokenOfflineSave(cmd *cobra.Command, _ []string) {
percents
,
_
:=
cmd
.
Flags
()
.
GetUint8
(
"percents"
)
percents
,
_
:=
cmd
.
Flags
()
.
GetUint8
(
"percents"
)
deployAddr
,
_
:=
cmd
.
Flags
()
.
GetString
(
"deployAddr"
)
deployAddr
,
_
:=
cmd
.
Flags
()
.
GetString
(
"deployAddr"
)
contract
,
_
:=
cmd
.
Flags
()
.
GetString
(
"contract"
)
contract
,
_
:=
cmd
.
Flags
()
.
GetString
(
"contract"
)
chainEthId
,
_
:=
cmd
.
Flags
()
.
GetInt64
(
"chainEthId"
)
d
,
err
:=
utils
.
GetDecimalsFromNode
(
token
,
url
)
d
,
err
:=
utils
.
GetDecimalsFromNode
(
token
,
url
)
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -86,5 +87,5 @@ func ConfigLockedTokenOfflineSave(cmd *cobra.Command, _ []string) {
...
@@ -86,5 +87,5 @@ func ConfigLockedTokenOfflineSave(cmd *cobra.Command, _ []string) {
panic
(
err
)
panic
(
err
)
}
}
CreateTxInfoAndWrite
(
abiData
,
deployAddr
,
contract
,
"set_offline_token"
,
url
)
CreateTxInfoAndWrite
(
abiData
,
deployAddr
,
contract
,
"set_offline_token"
,
url
,
chainEthId
)
}
}
plugin/dapp/cross2eth/boss4x/ethereum/offline/offline.go
View file @
0728e1aa
...
@@ -71,7 +71,7 @@ type DeployConfigInfo struct {
...
@@ -71,7 +71,7 @@ type DeployConfigInfo struct {
MultisignAddrs
[]
string
`toml:"multisignAddrs"`
MultisignAddrs
[]
string
`toml:"multisignAddrs"`
}
}
func
CreateTxInfoAndWrite
(
abiData
[]
byte
,
deployAddr
,
contract
,
name
,
url
string
)
{
func
CreateTxInfoAndWrite
(
abiData
[]
byte
,
deployAddr
,
contract
,
name
,
url
string
,
chainEthId
int64
)
{
client
,
err
:=
ethclient
.
Dial
(
url
)
client
,
err
:=
ethclient
.
Dial
(
url
)
if
err
!=
nil
{
if
err
!=
nil
{
fmt
.
Println
(
"Dial Err:"
,
err
)
fmt
.
Println
(
"Dial Err:"
,
err
)
...
@@ -96,7 +96,21 @@ func CreateTxInfoAndWrite(abiData []byte, deployAddr, contract, name, url string
...
@@ -96,7 +96,21 @@ func CreateTxInfoAndWrite(abiData []byte, deployAddr, contract, name, url string
msg
.
To
=
&
contracAddr
msg
.
To
=
&
contracAddr
msg
.
Value
=
big
.
NewInt
(
0
)
msg
.
Value
=
big
.
NewInt
(
0
)
//估算gas
//估算gas
gasLimit
:=
uint64
(
500
*
10000
)
var
gasLimit
uint64
// 模拟节点测试
if
chainEthId
==
1337
{
gasLimit
=
uint64
(
500
*
10000
)
}
else
{
gasLimit
,
err
:=
client
.
EstimateGas
(
context
.
Background
(),
msg
)
if
err
!=
nil
{
fmt
.
Println
(
"EstimateGas Err:"
,
err
)
return
}
gasLimit
=
uint64
(
1.2
*
float64
(
gasLimit
))
if
gasLimit
<
100
*
10000
{
gasLimit
=
100
*
10000
}
}
ntx
:=
types
.
NewTx
(
&
types
.
LegacyTx
{
ntx
:=
types
.
NewTx
(
&
types
.
LegacyTx
{
Nonce
:
nonce
,
Nonce
:
nonce
,
...
...
plugin/dapp/cross2eth/boss4x/ethereum/offline/safeTransferCmd.go
View file @
0728e1aa
...
@@ -246,6 +246,7 @@ func addCreateMultisignTransferTxFlags(cmd *cobra.Command) {
...
@@ -246,6 +246,7 @@ func addCreateMultisignTransferTxFlags(cmd *cobra.Command) {
func
CreateMultisignTransferTx
(
cmd
*
cobra
.
Command
,
_
[]
string
)
{
func
CreateMultisignTransferTx
(
cmd
*
cobra
.
Command
,
_
[]
string
)
{
url
,
_
:=
cmd
.
Flags
()
.
GetString
(
"rpc_laddr_ethereum"
)
url
,
_
:=
cmd
.
Flags
()
.
GetString
(
"rpc_laddr_ethereum"
)
chainEthId
,
_
:=
cmd
.
Flags
()
.
GetInt64
(
"chainEthId"
)
txFilePath
,
_
:=
cmd
.
Flags
()
.
GetString
(
"file"
)
txFilePath
,
_
:=
cmd
.
Flags
()
.
GetString
(
"file"
)
client
,
err
:=
ethclient
.
Dial
(
url
)
client
,
err
:=
ethclient
.
Dial
(
url
)
...
@@ -282,7 +283,7 @@ func CreateMultisignTransferTx(cmd *cobra.Command, _ []string) {
...
@@ -282,7 +283,7 @@ func CreateMultisignTransferTx(cmd *cobra.Command, _ []string) {
return
return
}
}
CreateTxInfoAndWrite
(
gnoData
,
txinfo
.
SendAddr
,
txinfo
.
CrontractAddr
,
"create_multisign_tx"
,
url
)
CreateTxInfoAndWrite
(
gnoData
,
txinfo
.
SendAddr
,
txinfo
.
CrontractAddr
,
"create_multisign_tx"
,
url
,
chainEthId
)
}
}
func
buildSigs
(
data
[]
byte
,
privateKeys
[]
string
)
([]
byte
,
error
)
{
func
buildSigs
(
data
[]
byte
,
privateKeys
[]
string
)
([]
byte
,
error
)
{
...
...
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