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
c39e8f14
Commit
c39e8f14
authored
Aug 30, 2021
by
hezhengjun
Committed by
vipwzw
Sep 07, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
correct dex deploy tool
parent
9ae38022
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
14 additions
and
9 deletions
+14
-9
.gitignore
.gitignore
+1
-1
deployPancake.go
plugin/dapp/dex/boss/deploy/chain33/deployPancake.go
+4
-2
deploy.md
plugin/dapp/dex/boss/deploy/chain33/offline/doc/deploy.md
+4
-3
farmCmd.go
plugin/dapp/dex/boss/deploy/chain33/offline/farmCmd.go
+1
-1
utils.go
plugin/dapp/dex/utils/utils.go
+4
-2
No files found.
.gitignore
View file @
c39e8f14
...
@@ -47,4 +47,4 @@ build/parawallet/
...
@@ -47,4 +47,4 @@ build/parawallet/
build/sendstock
build/sendstock
build/sendstock.toml
build/sendstock.toml
build/*.csv
build/*.csv
plugin/dapp/dex/boss/build/
plugin/dapp/dex/boss/deploy/chain33/deployPancake.go
View file @
c39e8f14
...
@@ -11,6 +11,7 @@ import (
...
@@ -11,6 +11,7 @@ import (
"github.com/33cn/chain33/common/address"
"github.com/33cn/chain33/common/address"
"github.com/33cn/chain33/rpc/jsonclient"
"github.com/33cn/chain33/rpc/jsonclient"
rpctypes
"github.com/33cn/chain33/rpc/types"
rpctypes
"github.com/33cn/chain33/rpc/types"
chain33Types
"github.com/33cn/chain33/types"
erc20
"github.com/33cn/plugin/plugin/dapp/cross2eth/contracts/erc20/generated"
erc20
"github.com/33cn/plugin/plugin/dapp/cross2eth/contracts/erc20/generated"
"github.com/33cn/plugin/plugin/dapp/dex/contracts/multicall/multicall"
"github.com/33cn/plugin/plugin/dapp/dex/contracts/multicall/multicall"
"github.com/33cn/plugin/plugin/dapp/dex/contracts/pancake-swap-periphery/src/pancakeFactory"
"github.com/33cn/plugin/plugin/dapp/dex/contracts/pancake-swap-periphery/src/pancakeFactory"
...
@@ -45,7 +46,7 @@ func DeployMulticall(cmd *cobra.Command) error {
...
@@ -45,7 +46,7 @@ func DeployMulticall(cmd *cobra.Command) error {
}
else
if
data
!=
"2"
{
}
else
if
data
!=
"2"
{
return
errors
.
New
(
"Deploy Multicall failed due to"
+
", ty = "
+
data
)
return
errors
.
New
(
"Deploy Multicall failed due to"
+
", ty = "
+
data
)
}
}
fmt
.
Println
(
"Succeed to deploy Multicall with address ="
,
getContractAddr
(
caller
,
txMulticall
)
,
"
\\
n"
)
fmt
.
Println
(
"Succeed to deploy Multicall with address ="
,
getContractAddr
(
caller
,
txMulticall
))
return
nil
return
nil
}
}
...
@@ -218,7 +219,8 @@ func deployContract(cmd *cobra.Command, code, abi, parameter, contractName strin
...
@@ -218,7 +219,8 @@ func deployContract(cmd *cobra.Command, code, abi, parameter, contractName strin
if
err
!=
nil
{
if
err
!=
nil
{
return
""
,
errors
.
New
(
contractName
+
" parse evm code error "
+
err
.
Error
())
return
""
,
errors
.
New
(
contractName
+
" parse evm code error "
+
err
.
Error
())
}
}
action
=
evmtypes
.
EVMContractAction
{
Amount
:
0
,
Code
:
bCode
,
GasLimit
:
0
,
GasPrice
:
0
,
Note
:
note
,
Alias
:
"PancakeFactory"
}
exector
:=
chain33Types
.
GetExecName
(
"evm"
,
paraName
)
action
=
evmtypes
.
EVMContractAction
{
Amount
:
0
,
Code
:
bCode
,
GasLimit
:
0
,
GasPrice
:
0
,
Note
:
note
,
ContractAddr
:
address
.
ExecAddress
(
exector
)}
if
parameter
!=
""
{
if
parameter
!=
""
{
constructorPara
:=
"constructor("
+
parameter
+
")"
constructorPara
:=
"constructor("
+
parameter
+
")"
packData
,
err
:=
evmAbi
.
PackContructorPara
(
constructorPara
,
abi
)
packData
,
err
:=
evmAbi
.
PackContructorPara
(
constructorPara
,
abi
)
...
...
plugin/dapp/dex/boss/deploy/chain33/offline/doc/deploy.md
View file @
c39e8f14
...
@@ -25,16 +25,16 @@
...
@@ -25,16 +25,16 @@
交易5: 转移所有权: 将SyrupBar的所有权转移给masterchef
交易5: 转移所有权: 将SyrupBar的所有权转移给masterchef
./boss offline chain33 farm masterChef -f 1 -k 0xcc38546e9e659d15e6b4893f0ab32a06d103931a8230b0bde71459d2b27d6944 -n "deploy farm to chain33" -d 14KEKbYtKKQm4wMthSK9J4La4nAiidGozt -s 10 -m 5000000000000000000 --
chainID 33
./boss offline chain33 farm masterChef -f 1 -k 0xcc38546e9e659d15e6b4893f0ab32a06d103931a8230b0bde71459d2b27d6944 -n "deploy farm to chain33" -d 14KEKbYtKKQm4wMthSK9J4La4nAiidGozt -s 10 -m 5000000000000000000 --
paraName user.p.para.
生成交易文件:farm.txt
生成交易文件:farm.txt
```
```
##步骤三: 离线创建多笔增加lp token的交易
##步骤三: 离线创建多笔增加lp token的交易
```
```
./boss offline chain33 farm addPool -f 1 -k 0xcc38546e9e659d15e6b4893f0ab32a06d103931a8230b0bde71459d2b27d6944 -p 1000 -l 1HEp4BiA54iaKx5LrgN9iihkgmd3YxC2xM -m 13YwvpqTatoFepe31c5TUXvi26SbNpC3Qq --
chainID 33
./boss offline chain33 farm addPool -f 1 -k 0xcc38546e9e659d15e6b4893f0ab32a06d103931a8230b0bde71459d2b27d6944 -p 1000 -l 1HEp4BiA54iaKx5LrgN9iihkgmd3YxC2xM -m 13YwvpqTatoFepe31c5TUXvi26SbNpC3Qq --
paraName user.p.para.
```
```
##步骤四: 串行发送交易文件中的交易
##步骤四: 串行发送交易文件中的交易
```
```
./boss
4x chain33 offline
send -f xxx.txt
./boss
offline chain33
send -f xxx.txt
```
```
\ No newline at end of file
plugin/dapp/dex/boss/deploy/chain33/offline/farmCmd.go
View file @
c39e8f14
...
@@ -125,7 +125,7 @@ func TransferOwnerShip(cmd *cobra.Command, from common.Address, masterChef, cont
...
@@ -125,7 +125,7 @@ func TransferOwnerShip(cmd *cobra.Command, from common.Address, masterChef, cont
return
nil
,
err
return
nil
,
err
}
}
action
:=
&
evmtypes
.
EVMContractAction
{
Amount
:
0
,
GasLimit
:
0
,
GasPrice
:
0
,
Note
:
parameter
,
Para
:
packData
}
action
:=
&
evmtypes
.
EVMContractAction
{
Amount
:
0
,
GasLimit
:
0
,
GasPrice
:
0
,
Note
:
parameter
,
Para
:
packData
,
ContractAddr
:
contractAddr
}
content
,
txHash
,
err
:=
utils
.
CallContractAndSign
(
info
,
action
,
contractAddr
)
content
,
txHash
,
err
:=
utils
.
CallContractAndSign
(
info
,
action
,
contractAddr
)
if
nil
!=
err
{
if
nil
!=
err
{
return
nil
,
err
return
nil
,
err
...
...
plugin/dapp/dex/utils/utils.go
View file @
c39e8f14
...
@@ -43,7 +43,7 @@ func CreateContractAndSign(txCreateInfo *TxCreateInfo, code, abi, parameter, con
...
@@ -43,7 +43,7 @@ func CreateContractAndSign(txCreateInfo *TxCreateInfo, code, abi, parameter, con
var
action
evmtypes
.
EVMContractAction
var
action
evmtypes
.
EVMContractAction
bCode
,
err
:=
common
.
FromHex
(
code
)
bCode
,
err
:=
common
.
FromHex
(
code
)
exector
:=
t
xCreateInfo
.
ParaName
+
"evm"
exector
:=
t
ypes
.
GetExecName
(
"evm"
,
txCreateInfo
.
ParaName
)
to
:=
address
.
ExecAddress
(
exector
)
to
:=
address
.
ExecAddress
(
exector
)
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -58,6 +58,7 @@ func CreateContractAndSign(txCreateInfo *TxCreateInfo, code, abi, parameter, con
...
@@ -58,6 +58,7 @@ func CreateContractAndSign(txCreateInfo *TxCreateInfo, code, abi, parameter, con
}
}
action
.
Code
=
append
(
action
.
Code
,
packData
...
)
action
.
Code
=
append
(
action
.
Code
,
packData
...
)
}
}
data
,
txHash
,
err
:=
CreateAndSignEvmTx
(
txCreateInfo
.
ChainID
,
&
action
,
exector
,
txCreateInfo
.
PrivateKey
,
txCreateInfo
.
Expire
,
txCreateInfo
.
Fee
)
data
,
txHash
,
err
:=
CreateAndSignEvmTx
(
txCreateInfo
.
ChainID
,
&
action
,
exector
,
txCreateInfo
.
PrivateKey
,
txCreateInfo
.
Expire
,
txCreateInfo
.
Fee
)
if
err
!=
nil
{
if
err
!=
nil
{
return
""
,
nil
,
errors
.
New
(
contractName
+
" create contract error:"
+
err
.
Error
())
return
""
,
nil
,
errors
.
New
(
contractName
+
" create contract error:"
+
err
.
Error
())
...
@@ -119,7 +120,8 @@ func WriteContractFile(fileName string, content string) {
...
@@ -119,7 +120,8 @@ func WriteContractFile(fileName string, content string) {
}
}
func
CallContractAndSign
(
txCreateInfo
*
TxCreateInfo
,
action
*
evmtypes
.
EVMContractAction
,
contractAddr
string
)
(
string
,
[]
byte
,
error
)
{
func
CallContractAndSign
(
txCreateInfo
*
TxCreateInfo
,
action
*
evmtypes
.
EVMContractAction
,
contractAddr
string
)
(
string
,
[]
byte
,
error
)
{
data
,
txHash
,
err
:=
CreateAndSignEvmTx
(
txCreateInfo
.
ChainID
,
action
,
txCreateInfo
.
ParaName
+
"evm"
,
txCreateInfo
.
PrivateKey
,
txCreateInfo
.
Expire
,
txCreateInfo
.
Fee
)
exector
:=
types
.
GetExecName
(
"evm"
,
txCreateInfo
.
ParaName
)
data
,
txHash
,
err
:=
CreateAndSignEvmTx
(
txCreateInfo
.
ChainID
,
action
,
exector
,
txCreateInfo
.
PrivateKey
,
txCreateInfo
.
Expire
,
txCreateInfo
.
Fee
)
if
err
!=
nil
{
if
err
!=
nil
{
return
""
,
nil
,
errors
.
New
(
contractAddr
+
" call contract error:"
+
err
.
Error
())
return
""
,
nil
,
errors
.
New
(
contractAddr
+
" call contract error:"
+
err
.
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