Commit c39e8f14 authored by hezhengjun's avatar hezhengjun Committed by vipwzw

correct dex deploy tool

parent 9ae38022
......@@ -47,4 +47,4 @@ build/parawallet/
build/sendstock
build/sendstock.toml
build/*.csv
plugin/dapp/dex/boss/build/
......@@ -11,6 +11,7 @@ import (
"github.com/33cn/chain33/common/address"
"github.com/33cn/chain33/rpc/jsonclient"
rpctypes "github.com/33cn/chain33/rpc/types"
chain33Types "github.com/33cn/chain33/types"
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/pancake-swap-periphery/src/pancakeFactory"
......@@ -45,7 +46,7 @@ func DeployMulticall(cmd *cobra.Command) error {
} else if data != "2" {
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
}
......@@ -218,7 +219,8 @@ func deployContract(cmd *cobra.Command, code, abi, parameter, contractName strin
if err != nil {
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 != "" {
constructorPara := "constructor(" + parameter + ")"
packData, err := evmAbi.PackContructorPara(constructorPara, abi)
......
......@@ -25,16 +25,16 @@
交易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
```
##步骤三: 离线创建多笔增加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.
```
##步骤四: 串行发送交易文件中的交易
```
./boss4x chain33 offline send -f xxx.txt
./boss offline chain33 send -f xxx.txt
```
\ No newline at end of file
......@@ -125,7 +125,7 @@ func TransferOwnerShip(cmd *cobra.Command, from common.Address, masterChef, cont
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)
if nil != err {
return nil, err
......
......@@ -43,7 +43,7 @@ func CreateContractAndSign(txCreateInfo *TxCreateInfo, code, abi, parameter, con
var action evmtypes.EVMContractAction
bCode, err := common.FromHex(code)
exector := txCreateInfo.ParaName + "evm"
exector := types.GetExecName("evm", txCreateInfo.ParaName)
to := address.ExecAddress(exector)
if err != nil {
......@@ -58,6 +58,7 @@ func CreateContractAndSign(txCreateInfo *TxCreateInfo, code, abi, parameter, con
}
action.Code = append(action.Code, packData...)
}
data, txHash, err := CreateAndSignEvmTx(txCreateInfo.ChainID, &action, exector, txCreateInfo.PrivateKey, txCreateInfo.Expire, txCreateInfo.Fee)
if err != nil {
return "", nil, errors.New(contractName + " create contract error:" + err.Error())
......@@ -119,7 +120,8 @@ func WriteContractFile(fileName string, content string) {
}
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 {
return "", nil, errors.New(contractAddr + " call contract error:" + err.Error())
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment