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
64ff5766
Commit
64ff5766
authored
Dec 13, 2021
by
hezhengjun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add deploy for tether usdt
parent
e659dd7a
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
77 additions
and
0 deletions
+77
-0
Erc20AndBridgeToken.go
.../cross2eth/boss4x/ethereum/offline/Erc20AndBridgeToken.go
+71
-0
offline.go
plugin/dapp/cross2eth/boss4x/ethereum/offline/offline.go
+1
-0
Makefile
plugin/dapp/cross2eth/contracts/Makefile
+5
-0
USDT.sol
plugin/dapp/cross2eth/contracts/usdt/USDT.sol
+0
-0
usdt.go
plugin/dapp/cross2eth/contracts/usdt/generated/usdt.go
+0
-0
No files found.
plugin/dapp/cross2eth/boss4x/ethereum/offline/Erc20AndBridgeToken.go
View file @
64ff5766
...
...
@@ -8,6 +8,7 @@ import (
"github.com/33cn/plugin/plugin/dapp/cross2eth/contracts/contracts4eth/generated"
erc20
"github.com/33cn/plugin/plugin/dapp/cross2eth/contracts/erc20/generated"
tetherUSDT
"github.com/33cn/plugin/plugin/dapp/cross2eth/contracts/usdt/generated"
"github.com/33cn/plugin/plugin/dapp/cross2eth/ebrelayer/utils"
"github.com/ethereum/go-ethereum/accounts/abi"
"github.com/ethereum/go-ethereum/common"
...
...
@@ -103,6 +104,76 @@ func DeployERC20(cmd *cobra.Command, _ []string) {
}
}
func
DeployTetherUSDTCmd
()
*
cobra
.
Command
{
cmd
:=
&
cobra
.
Command
{
Use
:
"create_tether_usdt"
,
Short
:
"create tether usdt contracts"
,
Run
:
DeployTetherUSDT
,
}
DeployTetherUSDTFlags
(
cmd
)
return
cmd
}
func
DeployTetherUSDTFlags
(
cmd
*
cobra
.
Command
)
{
cmd
.
Flags
()
.
StringP
(
"deployAddr"
,
"d"
,
""
,
"deploy contract addr"
)
_
=
cmd
.
MarkFlagRequired
(
"deployAddr"
)
cmd
.
Flags
()
.
StringP
(
"symbol"
,
"s"
,
""
,
"erc20 symbol"
)
_
=
cmd
.
MarkFlagRequired
(
"symbol"
)
cmd
.
Flags
()
.
StringP
(
"amount"
,
"m"
,
"0"
,
"amount"
)
_
=
cmd
.
MarkFlagRequired
(
"amount"
)
}
func
DeployTetherUSDT
(
cmd
*
cobra
.
Command
,
_
[]
string
)
{
url
,
_
:=
cmd
.
Flags
()
.
GetString
(
"rpc_laddr_ethereum"
)
deployerAddr
,
_
:=
cmd
.
Flags
()
.
GetString
(
"deployAddr"
)
symbol
,
_
:=
cmd
.
Flags
()
.
GetString
(
"symbol"
)
amount
,
_
:=
cmd
.
Flags
()
.
GetString
(
"amount"
)
bnAmount
:=
big
.
NewInt
(
1e6
*
1e6
)
bnAmount
,
_
=
bnAmount
.
SetString
(
utils
.
TrimZeroAndDot
(
amount
),
10
)
client
,
err
:=
ethclient
.
Dial
(
url
)
if
err
!=
nil
{
fmt
.
Println
(
"ethclient Dial error"
,
err
.
Error
())
return
}
ctx
:=
context
.
Background
()
startNonce
,
err
:=
client
.
PendingNonceAt
(
ctx
,
common
.
HexToAddress
(
deployerAddr
))
if
nil
!=
err
{
fmt
.
Println
(
"PendingNonceAt error"
,
err
.
Error
())
return
}
var
infos
[]
*
DeployInfo
parsed
,
err
:=
abi
.
JSON
(
strings
.
NewReader
(
tetherUSDT
.
TetherTokenABI
))
if
err
!=
nil
{
fmt
.
Println
(
"abi.JSON(strings.NewReader(tetherUSDT.TetherTokenABI)) error"
,
err
.
Error
())
return
}
bin
:=
common
.
FromHex
(
tetherUSDT
.
TetherTokenBin
)
//function TetherToken(uint _initialSupply, string _name, string _symbol, uint _decimals)
packdata
,
err
:=
parsed
.
Pack
(
""
,
bnAmount
,
symbol
,
symbol
,
big
.
NewInt
(
6
))
if
err
!=
nil
{
fmt
.
Println
(
"Pack error"
,
err
.
Error
())
return
}
Erc20Addr
:=
crypto
.
CreateAddress
(
common
.
HexToAddress
(
deployerAddr
),
startNonce
)
deployInfo
:=
DeployInfo
{
PackData
:
append
(
bin
,
packdata
...
),
ContractorAddr
:
Erc20Addr
,
Name
:
"Erc20: "
+
symbol
,
Nonce
:
startNonce
,
To
:
nil
,
}
infos
=
append
(
infos
,
&
deployInfo
)
fileName
:=
"deployTetherUSDT.txt"
err
=
NewTxWrite
(
infos
,
common
.
HexToAddress
(
deployerAddr
),
url
,
fileName
)
if
err
!=
nil
{
fmt
.
Println
(
"NewTxWrite error"
,
err
.
Error
())
return
}
}
func
CreateAddToken2LockListTxCmd
()
*
cobra
.
Command
{
cmd
:=
&
cobra
.
Command
{
Use
:
"create_add_lock_list"
,
...
...
plugin/dapp/cross2eth/boss4x/ethereum/offline/offline.go
View file @
64ff5766
...
...
@@ -34,6 +34,7 @@ func DeployOfflineContractsCmd() *cobra.Command {
CreateCmd
(),
//构造交易
CreateWithFileCmd
(),
DeployERC20Cmd
(),
DeployTetherUSDTCmd
(),
CreateCfgAccountTxCmd
(),
// set_offline_addr 设置离线多签地址
SetupCmd
(),
ConfigLockedTokenOfflineSaveCmd
(),
...
...
plugin/dapp/cross2eth/contracts/Makefile
View file @
64ff5766
...
...
@@ -3,6 +3,7 @@
SRC_BEP
:=
bep20
SRC_ERC20
:=
erc20
SRC_USDT
:=
usdt
SRC_CONTRACT0
:=
contracts4chain33
SRC_CONTRACT1
:=
contracts4eth
SRC_MULTISIGN
:=
gnosis/safe-contracts/contracts
...
...
@@ -12,6 +13,7 @@ GO_OUT1 := ${SRC_CONTRACT1}/generated
GO_OUT_MULTISIGN
:=
gnosis/generated
GO_OUT_BEP20
:=
bep20/generated
GO_OUT_ERC20
:=
erc20/generated
GO_OUT_USDT
:=
usdt/generated
PACKAGE
:=
generated
proj
:=
"build"
...
...
@@ -35,6 +37,9 @@ bep20Bin:
erc20Bin
:
@
abigen
--sol
$(SRC_ERC20)
/ERC20.sol
--pkg
$(PACKAGE)
--out
$(GO_OUT_ERC20)
/erc20.go
usdtBin
:
@
abigen
--alias
_totalSupply
=
_totalSupply4usdt
--sol
$(SRC_USDT)
/USDT.sol
--pkg
$(PACKAGE)
--out
$(GO_OUT_USDT)
/usdt.go
clean
:
@
rm
-fr
$(GO_OUT)
/
*
...
...
plugin/dapp/cross2eth/contracts/usdt/USDT.sol
0 → 100644
View file @
64ff5766
This diff is collapsed.
Click to expand it.
plugin/dapp/cross2eth/contracts/usdt/generated/usdt.go
0 → 100644
View file @
64ff5766
This source diff could not be displayed because it is too large. You can
view the blob
instead.
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