Commit dcdc0324 authored by hezhengjun's avatar hezhengjun

Merge branch 'master' into modify_log_level_for_evm_run

parents 58aa23f0 840ec436
...@@ -141,26 +141,10 @@ jobs: ...@@ -141,26 +141,10 @@ jobs:
make docker-compose dapp=paracross make docker-compose dapp=paracross
make docker-compose-down dapp=paracross make docker-compose-down dapp=paracross
ci_paracross_bls:
name: ci_paracross_bls
runs-on: ubuntu-latest
steps:
- name: Set up Golang
uses: actions/setup-go@v2
with:
go-version: 1.14
id: go
- name: set go env
run: export PATH=${PATH}:`go env GOPATH`/bin
- name: checkout
uses: actions/checkout@v2
- name: deploy
run: |
make docker-compose dapp=paracross extra=1
make docker-compose-down dapp=paracross
ci_x2ethereum:
name: ci_x2ethereum ci_cross2eth:
name: ci_cross2eth
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Set up Golang - name: Set up Golang
...@@ -176,8 +160,8 @@ jobs: ...@@ -176,8 +160,8 @@ jobs:
export PATH=${PATH}:`go env GOPATH`/bin export PATH=${PATH}:`go env GOPATH`/bin
echo $GOPATH echo $GOPATH
make make
make docker-compose dapp=x2ethereum make docker-compose dapp=cross2eth
make docker-compose-down dapp=x2ethereum make docker-compose-down dapp=cross2eth
...@@ -36,7 +36,7 @@ para: ...@@ -36,7 +36,7 @@ para:
@go build -v -o build/$(NAME) -ldflags "-X $(SRC_CLI)/buildflags.ParaName=user.p.$(NAME). -X $(SRC_CLI)/buildflags.RPCAddr=http://localhost:8901" $(SRC_CLI) @go build -v -o build/$(NAME) -ldflags "-X $(SRC_CLI)/buildflags.ParaName=user.p.$(NAME). -X $(SRC_CLI)/buildflags.RPCAddr=http://localhost:8901" $(SRC_CLI)
vet: vet:
@go vet ./... @go vet -copylocks=false ./...
autotest: ## build autotest binary autotest: ## build autotest binary
@cd build/autotest && bash ./run.sh build && cd ../../ @cd build/autotest && bash ./run.sh build && cd ../../
......
...@@ -3,7 +3,7 @@ module github.com/33cn/plugin ...@@ -3,7 +3,7 @@ module github.com/33cn/plugin
go 1.14 go 1.14
require ( require (
github.com/33cn/chain33 v1.65.3-0.20210824024448-c73616b9f5de github.com/33cn/chain33 v1.65.3-0.20210830065901-18ab4c8e07ae
github.com/BurntSushi/toml v0.3.1 github.com/BurntSushi/toml v0.3.1
github.com/NebulousLabs/Sia v1.3.7 github.com/NebulousLabs/Sia v1.3.7
github.com/NebulousLabs/errors v0.0.0-20181203160057-9f787ce8f69e // indirect github.com/NebulousLabs/errors v0.0.0-20181203160057-9f787ce8f69e // indirect
...@@ -42,6 +42,7 @@ require ( ...@@ -42,6 +42,7 @@ require (
golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf
golang.org/x/time v0.0.0-20190921001708-c4c64cad1fd0 // indirect golang.org/x/time v0.0.0-20190921001708-c4c64cad1fd0 // indirect
google.golang.org/grpc v1.33.2 google.golang.org/grpc v1.33.2
google.golang.org/protobuf v1.25.0
gopkg.in/sourcemap.v1 v1.0.5 // indirect gopkg.in/sourcemap.v1 v1.0.5 // indirect
gopkg.in/yaml.v2 v2.3.0 gopkg.in/yaml.v2 v2.3.0
) )
...@@ -26,8 +26,8 @@ dmitri.shuralyov.com/html/belt v0.0.0-20180602232347-f7d459c86be0/go.mod h1:JLBr ...@@ -26,8 +26,8 @@ dmitri.shuralyov.com/html/belt v0.0.0-20180602232347-f7d459c86be0/go.mod h1:JLBr
dmitri.shuralyov.com/service/change v0.0.0-20181023043359-a85b471d5412/go.mod h1:a1inKt/atXimZ4Mv927x+r7UpyzRUf4emIoiiSC2TN4= dmitri.shuralyov.com/service/change v0.0.0-20181023043359-a85b471d5412/go.mod h1:a1inKt/atXimZ4Mv927x+r7UpyzRUf4emIoiiSC2TN4=
dmitri.shuralyov.com/state v0.0.0-20180228185332-28bcc343414c/go.mod h1:0PRwlb0D6DFvNNtx+9ybjezNCa8XF0xaYcETyp6rHWU= dmitri.shuralyov.com/state v0.0.0-20180228185332-28bcc343414c/go.mod h1:0PRwlb0D6DFvNNtx+9ybjezNCa8XF0xaYcETyp6rHWU=
git.apache.org/thrift.git v0.0.0-20180902110319-2566ecd5d999/go.mod h1:fPE2ZNJGynbRyZ4dJvy6G277gSllfV2HJqblrnkyeyg= git.apache.org/thrift.git v0.0.0-20180902110319-2566ecd5d999/go.mod h1:fPE2ZNJGynbRyZ4dJvy6G277gSllfV2HJqblrnkyeyg=
github.com/33cn/chain33 v1.65.3-0.20210824024448-c73616b9f5de h1:woC60/W9oVPPzWO+yRp8C6fkpNEym/M2cojEAnWAsa0= github.com/33cn/chain33 v1.65.3-0.20210830065901-18ab4c8e07ae h1:0QYxSubLp37gtq1F+YS+2bL03ltA+uMetwtUnhdVuBY=
github.com/33cn/chain33 v1.65.3-0.20210824024448-c73616b9f5de/go.mod h1:82/Y5u+8arrXk+o83R9PusqGPNc33PDMwfB/zk77+6E= github.com/33cn/chain33 v1.65.3-0.20210830065901-18ab4c8e07ae/go.mod h1:Dpr4UhVgIzqB/5RBUa7Qoq39JQ5kKRN+PjTEWfucN3o=
github.com/AndreasBriese/bbloom v0.0.0-20180913140656-343706a395b7/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8= github.com/AndreasBriese/bbloom v0.0.0-20180913140656-343706a395b7/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8=
github.com/AndreasBriese/bbloom v0.0.0-20190306092124-e2d15f34fcf9/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8= github.com/AndreasBriese/bbloom v0.0.0-20190306092124-e2d15f34fcf9/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8=
github.com/AndreasBriese/bbloom v0.0.0-20190825152654-46b345b51c96 h1:cTp8I5+VIoKjsnZuH8vjyaysT/ses3EvZeaV/1UkF2M= github.com/AndreasBriese/bbloom v0.0.0-20190825152654-46b345b51c96 h1:cTp8I5+VIoKjsnZuH8vjyaysT/ses3EvZeaV/1UkF2M=
......
...@@ -383,7 +383,7 @@ func testSyncBlocksIfNeed(t *testing.T, para *client, testLoopCount int32) { ...@@ -383,7 +383,7 @@ func testSyncBlocksIfNeed(t *testing.T, para *client, testLoopCount int32) {
if err != nil { if err != nil {
errorCount++ errorCount++
} }
assert.Equal(t, isSynced, i == 3 || i == 6) assert.Equalf(t, isSynced, i == 3 || i == 6, "i=%d", i)
} }
switch testLoopCount { switch testLoopCount {
......
...@@ -459,7 +459,8 @@ func (node *Node) addPeer(pc *peerConn) error { ...@@ -459,7 +459,8 @@ func (node *Node) addPeer(pc *peerConn) error {
} }
qbftlog.Info("Added peer", "peer", pc.ip) qbftlog.Info("Added peer", "peer", pc.ip)
stateMsg := MsgInfo{TypeID: ttypes.NewRoundStepID, Msg: node.state.RoundStateMessage(), PeerID: pc.id, PeerIP: pc.ip.String()} rs := node.state.GetRoundState()
stateMsg := MsgInfo{TypeID: ttypes.NewRoundStepID, Msg: rs.RoundStateMessage(), PeerID: pc.id, PeerIP: pc.ip.String()}
pc.Send(stateMsg) pc.Send(stateMsg)
qbftlog.Info("Send state msg", "msg", stateMsg, "ourIP", node.IP, "ourID", node.ID) qbftlog.Info("Send state msg", "msg", stateMsg, "ourIP", node.IP, "ourID", node.ID)
return nil return nil
......
...@@ -412,6 +412,10 @@ func (pc *peerConn) PickSendVote(votes ttypes.VoteSetReader) bool { ...@@ -412,6 +412,10 @@ func (pc *peerConn) PickSendVote(votes ttypes.VoteSetReader) bool {
} }
} }
if vote, ok := pc.state.PickVoteToSend(votes); ok { if vote, ok := pc.state.PickVoteToSend(votes); ok {
if vote == nil {
qbftlog.Warn("Pick nil vote", "aggVote", votes.GetAggVote(), "vote", votes)
return false
}
msg := MsgInfo{TypeID: ttypes.VoteID, Msg: vote.QbftVote, PeerID: pc.id, PeerIP: pc.ip.String()} msg := MsgInfo{TypeID: ttypes.VoteID, Msg: vote.QbftVote, PeerID: pc.id, PeerIP: pc.ip.String()}
qbftlog.Debug("Sending vote message", "msg", msg) qbftlog.Debug("Sending vote message", "msg", msg)
if pc.Send(msg) { if pc.Send(msg) {
......
...@@ -6,6 +6,8 @@ import ( ...@@ -6,6 +6,8 @@ import (
"testing" "testing"
"time" "time"
"github.com/stretchr/testify/require"
"github.com/33cn/chain33/common" "github.com/33cn/chain33/common"
"github.com/33cn/chain33/common/address" "github.com/33cn/chain33/common/address"
"github.com/33cn/chain33/common/crypto" "github.com/33cn/chain33/common/crypto"
...@@ -42,7 +44,8 @@ func TestQbft(t *testing.T) { ...@@ -42,7 +44,8 @@ func TestQbft(t *testing.T) {
time.Sleep(2 * time.Second) time.Sleep(2 * time.Second)
configTx := configManagerTx() configTx := configManagerTx()
mock33.GetAPI().SendTx(configTx) _, err := mock33.GetAPI().SendTx(configTx)
require.Nil(t, err)
mock33.WaitTx(configTx.Hash()) mock33.WaitTx(configTx.Hash())
addTx := addNodeTx() addTx := addNodeTx()
......
...@@ -3,6 +3,7 @@ syntax = "proto3"; ...@@ -3,6 +3,7 @@ syntax = "proto3";
import "transaction.proto"; import "transaction.proto";
package types; package types;
option go_package = "../types";
message Accountmanager { message Accountmanager {
} }
......
...@@ -11,6 +11,7 @@ import "rule.proto"; ...@@ -11,6 +11,7 @@ import "rule.proto";
import "change.proto"; import "change.proto";
package types; package types;
option go_package = "../types";
// message for execs.Autonomy // message for execs.Autonomy
message AutonomyAction { message AutonomyAction {
......
...@@ -7,6 +7,7 @@ syntax = "proto3"; ...@@ -7,6 +7,7 @@ syntax = "proto3";
import "lcommon.proto"; import "lcommon.proto";
package types; package types;
option go_package = "../types";
message AutonomyProposalBoard { message AutonomyProposalBoard {
ProposalBoard propBoard = 1; ProposalBoard propBoard = 1;
......
...@@ -7,6 +7,7 @@ syntax = "proto3"; ...@@ -7,6 +7,7 @@ syntax = "proto3";
import "lcommon.proto"; import "lcommon.proto";
package types; package types;
option go_package = "../types";
message AutonomyProposalChange { message AutonomyProposalChange {
ProposalChange propChange = 1; ProposalChange propChange = 1;
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
syntax = "proto3"; syntax = "proto3";
package types; package types;
option go_package = "../types";
message VoteResult { message VoteResult {
// 总票数 // 总票数
......
...@@ -7,6 +7,7 @@ syntax = "proto3"; ...@@ -7,6 +7,7 @@ syntax = "proto3";
import "lcommon.proto"; import "lcommon.proto";
package types; package types;
option go_package = "../types";
message AutonomyProposalProject { message AutonomyProposalProject {
ProposalProject propProject = 1; ProposalProject propProject = 1;
......
...@@ -7,6 +7,7 @@ syntax = "proto3"; ...@@ -7,6 +7,7 @@ syntax = "proto3";
import "lcommon.proto"; import "lcommon.proto";
package types; package types;
option go_package = "../types";
message AutonomyProposalRule { message AutonomyProposalRule {
ProposalRule propRule = 1; ProposalRule propRule = 1;
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -3,6 +3,7 @@ syntax = "proto3"; ...@@ -3,6 +3,7 @@ syntax = "proto3";
import "transaction.proto"; import "transaction.proto";
package types; package types;
option go_package = "../types";
message AddressResult { message AddressResult {
string addr = 1; string addr = 1;
......
This source diff could not be displayed because it is too large. You can view the blob instead.
syntax = "proto3"; syntax = "proto3";
package types; package types;
option go_package = "../types";
message Cert { message Cert {
bytes certId = 1; bytes certId = 1;
......
This diff is collapsed.
syntax = "proto3"; syntax = "proto3";
package types; package types;
option go_package = "../types";
import "transaction.proto"; import "transaction.proto";
option go_package = "types";
// message for execs.coinsx // message for execs.coinsx
message CoinsxAction { message CoinsxAction {
oneof value { oneof value {
......
This diff is collapsed.
...@@ -33,15 +33,6 @@ func TestListMethod(t *testing.T) { ...@@ -33,15 +33,6 @@ func TestListMethod(t *testing.T) {
} }
} }
func TestListType(t *testing.T) {
excpect := []string{"Value_Withdraw", "Withdraw", "Value_Transfer", "Value_Genesis", "Value_TransferToExec", "Value_Config"}
cfg := types.NewChain33Config(types.GetDefaultCfgstring())
for _, v := range excpect {
if _, ok := NewType(cfg).GetValueTypeMap()[v]; !ok {
t.Error(v + " is not in list")
}
}
}
func BenchmarkGetActionValue(b *testing.B) { func BenchmarkGetActionValue(b *testing.B) {
action := &CoinsxAction{Value: &CoinsxAction_Transfer{Transfer: &types.AssetsTransfer{}}} action := &CoinsxAction{Value: &CoinsxAction_Transfer{Transfer: &types.AssetsTransfer{}}}
funclist := types.ListMethod(action) funclist := types.ListMethod(action)
......
syntax = "proto3"; syntax = "proto3";
package types; package types;
option go_package = "../types";
// 放贷信息 // 放贷信息
message Collateralize { message Collateralize {
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -2,12 +2,13 @@ package offline ...@@ -2,12 +2,13 @@ package offline
import ( import (
"fmt" "fmt"
"math/big"
"github.com/33cn/plugin/plugin/dapp/cross2eth/contracts/contracts4chain33/generated" "github.com/33cn/plugin/plugin/dapp/cross2eth/contracts/contracts4chain33/generated"
ebTypes "github.com/33cn/plugin/plugin/dapp/cross2eth/ebrelayer/types" ebTypes "github.com/33cn/plugin/plugin/dapp/cross2eth/ebrelayer/types"
utilsRelayer "github.com/33cn/plugin/plugin/dapp/cross2eth/ebrelayer/utils" utilsRelayer "github.com/33cn/plugin/plugin/dapp/cross2eth/ebrelayer/utils"
evmAbi "github.com/33cn/plugin/plugin/dapp/evm/executor/abi" evmAbi "github.com/33cn/plugin/plugin/dapp/evm/executor/abi"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"math/big"
) )
/* /*
......
...@@ -2,6 +2,7 @@ package offline ...@@ -2,6 +2,7 @@ package offline
import ( import (
"fmt" "fmt"
"github.com/33cn/plugin/plugin/dapp/cross2eth/contracts/contracts4chain33/generated" "github.com/33cn/plugin/plugin/dapp/cross2eth/contracts/contracts4chain33/generated"
evmAbi "github.com/33cn/plugin/plugin/dapp/evm/executor/abi" evmAbi "github.com/33cn/plugin/plugin/dapp/evm/executor/abi"
"github.com/spf13/cobra" "github.com/spf13/cobra"
......
...@@ -3,6 +3,7 @@ package offline ...@@ -3,6 +3,7 @@ package offline
import ( import (
"encoding/json" "encoding/json"
"fmt" "fmt"
"github.com/33cn/chain33/common/address" "github.com/33cn/chain33/common/address"
"github.com/33cn/chain33/system/crypto/secp256k1" "github.com/33cn/chain33/system/crypto/secp256k1"
"github.com/33cn/plugin/plugin/dapp/cross2eth/contracts/contracts4chain33/generated" "github.com/33cn/plugin/plugin/dapp/cross2eth/contracts/contracts4chain33/generated"
......
...@@ -2,6 +2,8 @@ package offline ...@@ -2,6 +2,8 @@ package offline
import ( import (
"fmt" "fmt"
"time"
"github.com/33cn/chain33/common/address" "github.com/33cn/chain33/common/address"
"github.com/33cn/chain33/system/crypto/secp256k1" "github.com/33cn/chain33/system/crypto/secp256k1"
"github.com/33cn/plugin/plugin/dapp/cross2eth/contracts/contracts4chain33/generated" "github.com/33cn/plugin/plugin/dapp/cross2eth/contracts/contracts4chain33/generated"
...@@ -10,7 +12,6 @@ import ( ...@@ -10,7 +12,6 @@ import (
"github.com/33cn/plugin/plugin/dapp/evm/executor/vm/common" "github.com/33cn/plugin/plugin/dapp/evm/executor/vm/common"
evmtypes "github.com/33cn/plugin/plugin/dapp/evm/types" evmtypes "github.com/33cn/plugin/plugin/dapp/evm/types"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"time"
) )
/* /*
......
...@@ -2,11 +2,12 @@ package offline ...@@ -2,11 +2,12 @@ package offline
import ( import (
"fmt" "fmt"
"strings"
"github.com/33cn/plugin/plugin/dapp/cross2eth/contracts/contracts4chain33/generated" "github.com/33cn/plugin/plugin/dapp/cross2eth/contracts/contracts4chain33/generated"
ebTypes "github.com/33cn/plugin/plugin/dapp/cross2eth/ebrelayer/types" ebTypes "github.com/33cn/plugin/plugin/dapp/cross2eth/ebrelayer/types"
evmAbi "github.com/33cn/plugin/plugin/dapp/evm/executor/abi" evmAbi "github.com/33cn/plugin/plugin/dapp/evm/executor/abi"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"strings"
) )
/* /*
......
...@@ -3,12 +3,13 @@ package offline ...@@ -3,12 +3,13 @@ package offline
import ( import (
"encoding/json" "encoding/json"
"fmt" "fmt"
"io/ioutil"
"os"
"github.com/33cn/plugin/plugin/dapp/dex/utils" "github.com/33cn/plugin/plugin/dapp/dex/utils"
evmtypes "github.com/33cn/plugin/plugin/dapp/evm/types" evmtypes "github.com/33cn/plugin/plugin/dapp/evm/types"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"io/ioutil"
"os"
) )
var crossXfileName = "deployCrossX2Chain33.txt" var crossXfileName = "deployCrossX2Chain33.txt"
......
...@@ -3,14 +3,15 @@ package ethereum ...@@ -3,14 +3,15 @@ package ethereum
import ( import (
"crypto/ecdsa" "crypto/ecdsa"
"fmt" "fmt"
"math/big"
"os"
"github.com/33cn/plugin/plugin/dapp/cross2eth/boss4x/ethereum/offline" "github.com/33cn/plugin/plugin/dapp/cross2eth/boss4x/ethereum/offline"
"github.com/33cn/plugin/plugin/dapp/cross2eth/ebrelayer/relayer/ethereum/ethtxs" "github.com/33cn/plugin/plugin/dapp/cross2eth/ebrelayer/relayer/ethereum/ethtxs"
tml "github.com/BurntSushi/toml" tml "github.com/BurntSushi/toml"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/crypto"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"math/big"
"os"
) )
type DepolyInfo struct { type DepolyInfo struct {
......
...@@ -3,14 +3,16 @@ package offline ...@@ -3,14 +3,16 @@ package offline
import ( import (
//"context" //"context"
"fmt" "fmt"
"math/big"
"github.com/33cn/plugin/plugin/dapp/cross2eth/contracts/contracts4eth/generated" "github.com/33cn/plugin/plugin/dapp/cross2eth/contracts/contracts4eth/generated"
gnosis "github.com/33cn/plugin/plugin/dapp/cross2eth/contracts/gnosis/generated" gnosis "github.com/33cn/plugin/plugin/dapp/cross2eth/contracts/gnosis/generated"
ebTypes "github.com/33cn/plugin/plugin/dapp/cross2eth/ebrelayer/types" ebTypes "github.com/33cn/plugin/plugin/dapp/cross2eth/ebrelayer/types"
"math/big"
//"github.com/ethereum/go-ethereum" //"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/accounts/abi" "github.com/ethereum/go-ethereum/accounts/abi"
"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"
......
...@@ -2,14 +2,15 @@ package offline ...@@ -2,14 +2,15 @@ package offline
import ( import (
"fmt" "fmt"
"math/big"
"strings"
"github.com/33cn/plugin/plugin/dapp/cross2eth/contracts/contracts4eth/generated" "github.com/33cn/plugin/plugin/dapp/cross2eth/contracts/contracts4eth/generated"
ebTypes "github.com/33cn/plugin/plugin/dapp/cross2eth/ebrelayer/types" ebTypes "github.com/33cn/plugin/plugin/dapp/cross2eth/ebrelayer/types"
"github.com/33cn/plugin/plugin/dapp/cross2eth/ebrelayer/utils" "github.com/33cn/plugin/plugin/dapp/cross2eth/ebrelayer/utils"
"github.com/ethereum/go-ethereum/accounts/abi" "github.com/ethereum/go-ethereum/accounts/abi"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"math/big"
"strings"
) )
/* /*
......
...@@ -4,6 +4,10 @@ import ( ...@@ -4,6 +4,10 @@ import (
"context" "context"
"encoding/json" "encoding/json"
"fmt" "fmt"
"math/big"
"strconv"
"strings"
"github.com/33cn/plugin/plugin/dapp/cross2eth/contracts/contracts4eth/generated" "github.com/33cn/plugin/plugin/dapp/cross2eth/contracts/contracts4eth/generated"
gnosis "github.com/33cn/plugin/plugin/dapp/cross2eth/contracts/gnosis/generated" gnosis "github.com/33cn/plugin/plugin/dapp/cross2eth/contracts/gnosis/generated"
"github.com/ethereum/go-ethereum" "github.com/ethereum/go-ethereum"
...@@ -13,9 +17,6 @@ import ( ...@@ -13,9 +17,6 @@ import (
"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"
"math/big"
"strconv"
"strings"
) )
/* /*
......
...@@ -4,20 +4,23 @@ import ( ...@@ -4,20 +4,23 @@ import (
"context" "context"
"encoding/json" "encoding/json"
"fmt" "fmt"
//"github.com/33cn/plugin/plugin/dapp/cross2eth/contracts/contracts4eth/generated" //"github.com/33cn/plugin/plugin/dapp/cross2eth/contracts/contracts4eth/generated"
//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/cross2eth/ebrelayer/utils" //"github.com/33cn/plugin/plugin/dapp/cross2eth/ebrelayer/utils"
tml "github.com/BurntSushi/toml" tml "github.com/BurntSushi/toml"
"github.com/ethereum/go-ethereum" "github.com/ethereum/go-ethereum"
//"github.com/ethereum/go-ethereum/accounts/abi" //"github.com/ethereum/go-ethereum/accounts/abi"
"io/ioutil"
"math/big"
"os"
"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"
"io/ioutil"
"math/big"
"os"
//"strings" //"strings"
//"time" //"time"
) )
......
...@@ -4,10 +4,11 @@ import ( ...@@ -4,10 +4,11 @@ import (
"context" "context"
"errors" "errors"
"fmt" "fmt"
"github.com/ethereum/go-ethereum"
"math/big" "math/big"
"strings" "strings"
"github.com/ethereum/go-ethereum"
erc20 "github.com/33cn/plugin/plugin/dapp/cross2eth/contracts/erc20/generated" erc20 "github.com/33cn/plugin/plugin/dapp/cross2eth/contracts/erc20/generated"
gnosis "github.com/33cn/plugin/plugin/dapp/cross2eth/contracts/gnosis/generated" gnosis "github.com/33cn/plugin/plugin/dapp/cross2eth/contracts/gnosis/generated"
ebTypes "github.com/33cn/plugin/plugin/dapp/cross2eth/ebrelayer/types" ebTypes "github.com/33cn/plugin/plugin/dapp/cross2eth/ebrelayer/types"
......
...@@ -4,13 +4,14 @@ import ( ...@@ -4,13 +4,14 @@ import (
"context" "context"
"encoding/json" "encoding/json"
"fmt" "fmt"
"os"
"time"
"github.com/ethereum/go-ethereum" "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/ethclient" "github.com/ethereum/go-ethereum/ethclient"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"os"
"time"
) )
func SendTxsCmd() *cobra.Command { func SendTxsCmd() *cobra.Command {
......
...@@ -2,6 +2,7 @@ package offline ...@@ -2,6 +2,7 @@ package offline
import ( import (
"fmt" "fmt"
eoff "github.com/33cn/plugin/plugin/dapp/dex/boss/deploy/ethereum/offline" eoff "github.com/33cn/plugin/plugin/dapp/dex/boss/deploy/ethereum/offline"
"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"
......
...@@ -4,8 +4,6 @@ services: ...@@ -4,8 +4,6 @@ services:
ganachetest: ganachetest:
entrypoint: ["node", "/app/ganache-core.docker.cli.js", "-a", "20", "-b", "2", "--debug", "-m", "coast bar giraffe art venue decide symbol law visual crater vital fold"] entrypoint: ["node", "/app/ganache-core.docker.cli.js", "-a", "20", "-b", "2", "--debug", "-m", "coast bar giraffe art venue decide symbol law visual crater vital fold"]
image: trufflesuite/ganache-cli:latest image: trufflesuite/ganache-cli:latest
ports:
- 8545:8545
ebrelayera: ebrelayera:
build: build:
...@@ -31,9 +29,6 @@ services: ...@@ -31,9 +29,6 @@ services:
entrypoint: /root/entrypoint.sh entrypoint: /root/entrypoint.sh
environment: environment:
PARAFILE: "/root/chain33.para33.toml" PARAFILE: "/root/chain33.para33.toml"
ports:
- 8801:8801
- 8901:8901
expose: expose:
- "8802" - "8802"
......
...@@ -48,19 +48,19 @@ chain33ID=0 ...@@ -48,19 +48,19 @@ chain33ID=0
#ethValidatorAddrKeyA="8656d2bc732a8a816a461ba5e2d8aac7c7f85c26a813df30d5327210465eb230" #ethValidatorAddrKeyA="8656d2bc732a8a816a461ba5e2d8aac7c7f85c26a813df30d5327210465eb230"
# shellcheck disable=SC2034 # shellcheck disable=SC2034
{ {
ethValidatorAddrKeyb="a5f3063552f4483cfc20ac4f40f45b798791379862219de9e915c64722c1d400" ethValidatorAddrKeyb="a5f3063552f4483cfc20ac4f40f45b798791379862219de9e915c64722c1d400"
ethValidatorAddrKeyc="bbf5e65539e9af0eb0cfac30bad475111054b09c11d668fc0731d54ea777471e" ethValidatorAddrKeyc="bbf5e65539e9af0eb0cfac30bad475111054b09c11d668fc0731d54ea777471e"
ethValidatorAddrKeyd="c9fa31d7984edf81b8ef3b40c761f1847f6fcd5711ab2462da97dc458f1f896b" ethValidatorAddrKeyd="c9fa31d7984edf81b8ef3b40c761f1847f6fcd5711ab2462da97dc458f1f896b"
# 新增地址 chain33 需要导入地址 转入 10 bty当收费费 # 新增地址 chain33 需要导入地址 转入 10 bty当收费费
chain33Validatora="1N6HstkyLFS8QCeVfdvYxx1xoryXoJtvvZ" chain33Validatora="1N6HstkyLFS8QCeVfdvYxx1xoryXoJtvvZ"
chain33Validatorb="155ooMPBTF8QQsGAknkK7ei5D78rwDEFe6" chain33Validatorb="155ooMPBTF8QQsGAknkK7ei5D78rwDEFe6"
chain33Validatorc="13zBdQwuyDh7cKN79oT2odkxYuDbgQiXFv" chain33Validatorc="13zBdQwuyDh7cKN79oT2odkxYuDbgQiXFv"
chain33Validatord="113ZzVamKfAtGt9dq45fX1mNsEoDiN95HG" chain33Validatord="113ZzVamKfAtGt9dq45fX1mNsEoDiN95HG"
#chain33ValidatorKeya="0xcc38546e9e659d15e6b4893f0ab32a06d103931a8230b0bde71459d2b27d6944" #chain33ValidatorKeya="0xcc38546e9e659d15e6b4893f0ab32a06d103931a8230b0bde71459d2b27d6944"
chain33ValidatorKeyb="0x9d539bc5fd084eb7fe86ad631dba9aa086dba38418725c38d9751459f567da66" chain33ValidatorKeyb="0x9d539bc5fd084eb7fe86ad631dba9aa086dba38418725c38d9751459f567da66"
chain33ValidatorKeyc="0x0a6671f101e30a2cc2d79d77436b62cdf2664ed33eb631a9c9e3f3dd348a23be" chain33ValidatorKeyc="0x0a6671f101e30a2cc2d79d77436b62cdf2664ed33eb631a9c9e3f3dd348a23be"
chain33ValidatorKeyd="0x3818b257b05ee75b6e43ee0e3cfc2d8502342cf67caed533e3756966690b62a5" chain33ValidatorKeyd="0x3818b257b05ee75b6e43ee0e3cfc2d8502342cf67caed533e3756966690b62a5"
} }
function start_docker_ebrelayerA() { function start_docker_ebrelayerA() {
...@@ -152,7 +152,7 @@ function TestChain33ToEthAssets() { ...@@ -152,7 +152,7 @@ function TestChain33ToEthAssets() {
cli_ret "${result}" "balance" ".balance" "5" cli_ret "${result}" "balance" ".balance" "5"
# eth burn # eth burn
result=$(${CLIA} ethereum burn -m 3 -k "${ethDeployKey}" -r "${chain33ReceiverAddr}" -t "${ethereumBtyTokenAddr}" ) #--node_addr https://ropsten.infura.io/v3/9e83f296716142ffbaeaafc05790f26c) result=$(${CLIA} ethereum burn -m 3 -k "${ethDeployKey}" -r "${chain33ReceiverAddr}" -t "${ethereumBtyTokenAddr}") #--node_addr https://ropsten.infura.io/v3/9e83f296716142ffbaeaafc05790f26c)
cli_ret "${result}" "burn" cli_ret "${result}" "burn"
sleep 4 sleep 4
...@@ -172,7 +172,7 @@ function TestChain33ToEthAssets() { ...@@ -172,7 +172,7 @@ function TestChain33ToEthAssets() {
is_equal "${result}" "2.0000" is_equal "${result}" "2.0000"
# eth burn 2 # eth burn 2
result=$(${CLIA} ethereum burn -m 2 -k "${ethDeployKey}" -r "${chain33ReceiverAddr}" -t "${ethereumBtyTokenAddr}" ) #--node_addr https://ropsten.infura.io/v3/9e83f296716142ffbaeaafc05790f26c) result=$(${CLIA} ethereum burn -m 2 -k "${ethDeployKey}" -r "${chain33ReceiverAddr}" -t "${ethereumBtyTokenAddr}") #--node_addr https://ropsten.infura.io/v3/9e83f296716142ffbaeaafc05790f26c)
cli_ret "${result}" "burn" cli_ret "${result}" "burn"
sleep 4 sleep 4
...@@ -220,7 +220,7 @@ function TestChain33ToEthZBCAssets() { ...@@ -220,7 +220,7 @@ function TestChain33ToEthZBCAssets() {
cli_ret "${result}" "balance" ".balance" "9" cli_ret "${result}" "balance" ".balance" "9"
# eth burn # eth burn
result=$(${CLIA} ethereum burn -m 8 -k "${ethDeployKey}" -r "${chain33ReceiverAddr}" -t "${ethBridgeToeknZBCAddr}" ) #--node_addr https://ropsten.infura.io/v3/9e83f296716142ffbaeaafc05790f26c) result=$(${CLIA} ethereum burn -m 8 -k "${ethDeployKey}" -r "${chain33ReceiverAddr}" -t "${ethBridgeToeknZBCAddr}") #--node_addr https://ropsten.infura.io/v3/9e83f296716142ffbaeaafc05790f26c)
cli_ret "${result}" "burn" cli_ret "${result}" "burn"
sleep 4 sleep 4
...@@ -247,7 +247,7 @@ function TestETH2Chain33Assets() { ...@@ -247,7 +247,7 @@ function TestETH2Chain33Assets() {
echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}" echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}"
echo -e "${GRE}=========== eth to chain33 在以太坊上锁定 ETH 资产,然后在 chain33 上 burn ===========${NOC}" echo -e "${GRE}=========== eth to chain33 在以太坊上锁定 ETH 资产,然后在 chain33 上 burn ===========${NOC}"
# 查询 ETH 这端 bridgeBank 地址原来是 0 # 查询 ETH 这端 bridgeBank 地址原来是 0
result=$(${CLIA} ethereum balance -o "${ethBridgeBank}" ) result=$(${CLIA} ethereum balance -o "${ethBridgeBank}")
cli_ret "${result}" "balance" ".balance" "0" cli_ret "${result}" "balance" ".balance" "0"
# ETH 这端 lock 11个 # ETH 这端 lock 11个
...@@ -258,7 +258,7 @@ function TestETH2Chain33Assets() { ...@@ -258,7 +258,7 @@ function TestETH2Chain33Assets() {
sleep 4 sleep 4
# 查询 ETH 这端 bridgeBank 地址 11 # 查询 ETH 这端 bridgeBank 地址 11
result=$(${CLIA} ethereum balance -o "${ethBridgeBank}" ) result=$(${CLIA} ethereum balance -o "${ethBridgeBank}")
cli_ret "${result}" "balance" ".balance" "11" cli_ret "${result}" "balance" ".balance" "11"
sleep ${maturityDegree} sleep ${maturityDegree}
...@@ -283,7 +283,7 @@ function TestETH2Chain33Assets() { ...@@ -283,7 +283,7 @@ function TestETH2Chain33Assets() {
is_equal "${result}" "600000000" is_equal "${result}" "600000000"
# 查询 ETH 这端 bridgeBank 地址 0 # 查询 ETH 这端 bridgeBank 地址 0
result=$(${CLIA} ethereum balance -o "${ethBridgeBank}" ) result=$(${CLIA} ethereum balance -o "${ethBridgeBank}")
cli_ret "${result}" "balance" ".balance" "6" cli_ret "${result}" "balance" ".balance" "6"
# 比之前多 5 # 比之前多 5
...@@ -301,7 +301,7 @@ function TestETH2Chain33Assets() { ...@@ -301,7 +301,7 @@ function TestETH2Chain33Assets() {
is_equal "${result}" "0" is_equal "${result}" "0"
# 查询 ETH 这端 bridgeBank 地址 0 # 查询 ETH 这端 bridgeBank 地址 0
result=$(${CLIA} ethereum balance -o "${ethBridgeBank}" ) result=$(${CLIA} ethereum balance -o "${ethBridgeBank}")
cli_ret "${result}" "balance" ".balance" "0" cli_ret "${result}" "balance" ".balance" "0"
# 比之前多 5 # 比之前多 5
...@@ -338,7 +338,7 @@ function TestETH2Chain33Ycc() { ...@@ -338,7 +338,7 @@ function TestETH2Chain33Ycc() {
# 原来的数额 0 # 原来的数额 0
result=$(${CLIA} ethereum balance -o "${ethReceiverAddr1}" -t "${ethereumYccTokenAddr}") result=$(${CLIA} ethereum balance -o "${ethReceiverAddr1}" -t "${ethereumYccTokenAddr}")
# cli_ret "${result}" "balance" ".balance" "0" # cli_ret "${result}" "balance" ".balance" "0"
echo '#5.burn YCC from Chain33 YCC(Chain33)-----> Ethereum' echo '#5.burn YCC from Chain33 YCC(Chain33)-----> Ethereum'
${CLIA} chain33 burn -m 5 -k "${chain33ReceiverAddrKey}" -r "${ethReceiverAddr1}" -t "${chain33YccTokenAddr}" ${CLIA} chain33 burn -m 5 -k "${chain33ReceiverAddrKey}" -r "${ethReceiverAddr1}" -t "${chain33YccTokenAddr}"
...@@ -382,7 +382,7 @@ function TestETH2Chain33Ycc() { ...@@ -382,7 +382,7 @@ function TestETH2Chain33Ycc() {
function offline_set_offline_token_Bty() { function offline_set_offline_token_Bty() {
echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}" echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}"
echo -e "${GRE}===== chain33 端 configLockedTokenOfflineSave BTY ======${NOC}" echo -e "${GRE}===== chain33 端 configLockedTokenOfflineSave BTY ======${NOC}"
# echo '2:#配置自动转离线钱包(bty, 100, 50%)' # echo '2:#配置自动转离线钱包(bty, 100, 50%)'
${Boss4xCLI} chain33 offline set_offline_token -c "${chain33BridgeBank}" -s BTY -m 10000000000 -p 50 -k "${chain33DeployKey}" --chainID "${chain33ID}" ${Boss4xCLI} chain33 offline set_offline_token -c "${chain33BridgeBank}" -s BTY -m 10000000000 -p 50 -k "${chain33DeployKey}" --chainID "${chain33ID}"
chain33_offline_send "chain33_set_offline_token.txt" chain33_offline_send "chain33_set_offline_token.txt"
...@@ -443,7 +443,7 @@ function initPara() { ...@@ -443,7 +443,7 @@ function initPara() {
} }
# lock bty 判断是否转入多签地址金额是否正确 # lock bty 判断是否转入多签地址金额是否正确
function lock_bty_multisign_docker () { function lock_bty_multisign_docker() {
local lockAmount=$1 local lockAmount=$1
local lockAmount2="${1}00000000" local lockAmount2="${1}00000000"
hash=$(${Chain33Cli} send evm call -f 1 -a "${lockAmount}" -k "${chain33DeployAddr}" -e "${chain33BridgeBank}" -p "lock(${ethDeployAddr}, ${chain33BtyTokenAddr}, ${lockAmount2})" --chainID "${chain33ID}") hash=$(${Chain33Cli} send evm call -f 1 -a "${lockAmount}" -k "${chain33DeployAddr}" -e "${chain33BridgeBank}" -p "lock(${ethDeployAddr}, ${chain33BtyTokenAddr}, ${lockAmount2})" --chainID "${chain33ID}")
...@@ -463,7 +463,7 @@ function lock_bty_multisign_docker () { ...@@ -463,7 +463,7 @@ function lock_bty_multisign_docker () {
function lockBty() { function lockBty() {
echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}" echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}"
echo -e "${GRE}===== chain33 端 lock BTY ======${NOC}" echo -e "${GRE}===== chain33 端 lock BTY ======${NOC}"
# echo '2:#配置自动转离线钱包(bty, 100, 50%)' # echo '2:#配置自动转离线钱包(bty, 100, 50%)'
offline_set_offline_token_Bty offline_set_offline_token_Bty
lock_bty_multisign_docker 33 "33.0000" "0.0000" lock_bty_multisign_docker 33 "33.0000" "0.0000"
...@@ -478,7 +478,7 @@ function lockBty() { ...@@ -478,7 +478,7 @@ function lockBty() {
function lockChain33Ycc() { function lockChain33Ycc() {
echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}" echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}"
echo -e "${GRE}===== chain33 端 lock ERC20 YCC ======${NOC}" echo -e "${GRE}===== chain33 端 lock ERC20 YCC ======${NOC}"
# echo '2:#配置自动转离线钱包(YCC, 100, 60%)' # echo '2:#配置自动转离线钱包(YCC, 100, 60%)'
offline_set_offline_token_Chain33Ycc offline_set_offline_token_Chain33Ycc
lock_chain33_ycc_multisign 30 30 0 lock_chain33_ycc_multisign 30 30 0
...@@ -597,7 +597,7 @@ function StartDockerRelayerDeploy() { ...@@ -597,7 +597,7 @@ function StartDockerRelayerDeploy() {
updata_toml_start_bcd updata_toml_start_bcd
# 设置 token 地址 # 设置 token 地址
# InitTokenAddr # InitTokenAddr
offline_create_bridge_token_eth_BTY offline_create_bridge_token_eth_BTY
offline_create_bridge_token_chain33_ETH offline_create_bridge_token_chain33_ETH
offline_deploy_erc20_eth_YCC offline_deploy_erc20_eth_YCC
...@@ -674,5 +674,3 @@ function AllRelayerMainTest() { ...@@ -674,5 +674,3 @@ function AllRelayerMainTest() {
echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}" echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}"
} }
...@@ -11,14 +11,12 @@ source "./relayerPublic.sh" ...@@ -11,14 +11,12 @@ source "./relayerPublic.sh"
#ethDeployAddr="0x8afdadfc88a1087c9a1d6c0f5dd04634b87f303a" #ethDeployAddr="0x8afdadfc88a1087c9a1d6c0f5dd04634b87f303a"
ethDeployKey="8656d2bc732a8a816a461ba5e2d8aac7c7f85c26a813df30d5327210465eb230" ethDeployKey="8656d2bc732a8a816a461ba5e2d8aac7c7f85c26a813df30d5327210465eb230"
# chain33 部署合约者的私钥 用于部署合约时签名使用 # chain33 部署合约者的私钥 用于部署合约时签名使用
chain33DeployAddr="1N6HstkyLFS8QCeVfdvYxx1xoryXoJtvvZ" chain33DeployAddr="1N6HstkyLFS8QCeVfdvYxx1xoryXoJtvvZ"
chain33DeployKey="0xcc38546e9e659d15e6b4893f0ab32a06d103931a8230b0bde71459d2b27d6944" chain33DeployKey="0xcc38546e9e659d15e6b4893f0ab32a06d103931a8230b0bde71459d2b27d6944"
ethValidatorAddrKeyA="8656d2bc732a8a816a461ba5e2d8aac7c7f85c26a813df30d5327210465eb230" ethValidatorAddrKeyA="8656d2bc732a8a816a461ba5e2d8aac7c7f85c26a813df30d5327210465eb230"
chain33ReceiverAddr="12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv" chain33ReceiverAddr="12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv"
#chain33ReceiverAddrKey="4257d8692ef7fe13c68b65d6a52f03933db2fa5ce8faf210b5b8b80c721ced01" #chain33ReceiverAddrKey="4257d8692ef7fe13c68b65d6a52f03933db2fa5ce8faf210b5b8b80c721ced01"
...@@ -37,13 +35,13 @@ CLIA="./ebcli_A" ...@@ -37,13 +35,13 @@ CLIA="./ebcli_A"
# shellcheck disable=SC2034 # shellcheck disable=SC2034
{ {
bseMultisignA=0x0f2e821517D4f64a012a04b668a6b1aa3B262e08 bseMultisignA=0x0f2e821517D4f64a012a04b668a6b1aa3B262e08
bseMultisignB=0x21B5f4C2F6Ff418fa0067629D9D76AE03fB4a2d2 bseMultisignB=0x21B5f4C2F6Ff418fa0067629D9D76AE03fB4a2d2
bseMultisignC=0xee760B2E502244016ADeD3491948220B3b1dd789 bseMultisignC=0xee760B2E502244016ADeD3491948220B3b1dd789
bseMultisignKeyA=f934e9171c5cf13b35e6c989e95f5e95fa471515730af147b66d60fbcd664b7c bseMultisignKeyA=f934e9171c5cf13b35e6c989e95f5e95fa471515730af147b66d60fbcd664b7c
bseMultisignKeyB=2bcf3e23a17d3f3b190a26a098239ad2d20267a673440e0f57a23f44f94b77b9 bseMultisignKeyB=2bcf3e23a17d3f3b190a26a098239ad2d20267a673440e0f57a23f44f94b77b9
bseMultisignKeyC=e5f8caae6468061c17543bc2205c8d910b3c71ad4d055105cde94e88ccb4e650 bseMultisignKeyC=e5f8caae6468061c17543bc2205c8d910b3c71ad4d055105cde94e88ccb4e650
TestNodeAddr="https://data-seed-prebsc-1-s1.binance.org:8545/" TestNodeAddr="https://data-seed-prebsc-1-s1.binance.org:8545/"
} }
function deployMultisign() { function deployMultisign() {
...@@ -82,18 +80,18 @@ function deployMultisign() { ...@@ -82,18 +80,18 @@ function deployMultisign() {
hash=$(${Chain33Cli} send evm call -f 1 -k "${chain33DeployAddr}" -e "${chain33BridgeBank}" -p "configOfflineSaveAccount(${multisignChain33Addr})" --chainID "${chain33ID}") hash=$(${Chain33Cli} send evm call -f 1 -k "${chain33DeployAddr}" -e "${chain33BridgeBank}" -p "configOfflineSaveAccount(${multisignChain33Addr})" --chainID "${chain33ID}")
check_tx "${Chain33Cli}" "${hash}" check_tx "${Chain33Cli}" "${hash}"
# echo -e "${GRE}=========== 部署 ETH 离线钱包合约 ===========${NOC}" # echo -e "${GRE}=========== 部署 ETH 离线钱包合约 ===========${NOC}"
# result=$(${CLIA} ethereum multisign deploy) # result=$(${CLIA} ethereum multisign deploy)
# cli_ret "${result}" "ethereum multisign deploy" # cli_ret "${result}" "ethereum multisign deploy"
# multisignEthAddr=$(echo "${result}" | jq -r ".msg") # multisignEthAddr=$(echo "${result}" | jq -r ".msg")
# #
# result=$(${CLIA} ethereum multisign setup -k "${ethDeployKey}" -o "${bseMultisignA},${bseMultisignB},${bseMultisignC}") # result=$(${CLIA} ethereum multisign setup -k "${ethDeployKey}" -o "${bseMultisignA},${bseMultisignB},${bseMultisignC}")
# cli_ret "${result}" "ethereum multisign setup" # cli_ret "${result}" "ethereum multisign setup"
# #
# result=$(${CLIA} ethereum multisign set_offline_addr -s "${multisignEthAddr}") # result=$(${CLIA} ethereum multisign set_offline_addr -s "${multisignEthAddr}")
# cli_ret "${result}" "set_offline_addr" # cli_ret "${result}" "set_offline_addr"
# #
# echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}" # echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}"
} }
function lock_eth_balance() { function lock_eth_balance() {
...@@ -107,38 +105,38 @@ function lock_eth_balance() { ...@@ -107,38 +105,38 @@ function lock_eth_balance() {
# eth 等待 10 个区块 # eth 等待 10 个区块
eth_block_wait 2 eth_block_wait 2
result=$(${CLIA} ethereum balance -o "${ethBridgeBank}" ) result=$(${CLIA} ethereum balance -o "${ethBridgeBank}")
# cli_ret "${result}" "balance" ".balance" "${bridgeBankBalance}" # cli_ret "${result}" "balance" ".balance" "${bridgeBankBalance}"
result=$(${CLIA} ethereum balance -o "${multisignEthAddr}" ) result=$(${CLIA} ethereum balance -o "${multisignEthAddr}")
# cli_ret "${result}" "balance" ".balance" "${multisignBalance}" # cli_ret "${result}" "balance" ".balance" "${multisignBalance}"
} }
function lockEth() { function lockEth() {
echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}" echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}"
# echo '2:#配置自动转离线钱包(BNB, 4, 50%)' # echo '2:#配置自动转离线钱包(BNB, 4, 50%)'
# result=$(${CLIA} ethereum multisign set_offline_token -s ETH -m 4) # result=$(${CLIA} ethereum multisign set_offline_token -s ETH -m 4)
# cli_ret "${result}" "set_offline_token -s ETH -m 4" # cli_ret "${result}" "set_offline_token -s ETH -m 4"
result=$(${CLIA} ethereum balance -o "${ethBridgeBank}" ) result=$(${CLIA} ethereum balance -o "${ethBridgeBank}")
# cli_ret "${result}" "balance" ".balance" "0" # cli_ret "${result}" "balance" ".balance" "0"
result=$(${CLIA} ethereum balance -o "${multisignEthAddr}" ) result=$(${CLIA} ethereum balance -o "${multisignEthAddr}")
# cli_ret "${result}" "balance" ".balance" "0" # cli_ret "${result}" "balance" ".balance" "0"
# lock_eth_balance 4 2 2 # lock_eth_balance 4 2 2
lock_eth_balance 2 4 2 lock_eth_balance 2 4 2
# lock_eth_balance 1 10 10 # lock_eth_balance 1 10 10
# lock_eth_balance 16 13 23 # lock_eth_balance 16 13 23
# transfer # transfer
hash=$(./ebcli_A ethereum multisign transfer -a 1 -r "${ethBridgeBank}" -k "${bseMultisignKeyA},${bseMultisignKeyB},${bseMultisignKeyC}") hash=$(./ebcli_A ethereum multisign transfer -a 1 -r "${ethBridgeBank}" -k "${bseMultisignKeyA},${bseMultisignKeyB},${bseMultisignKeyC}")
result=$(${CLIA} ethereum balance -o "${ethBridgeBank}" ) result=$(${CLIA} ethereum balance -o "${ethBridgeBank}")
result=$(${CLIA} ethereum balance -o "${multisignEthAddr}" ) result=$(${CLIA} ethereum balance -o "${multisignEthAddr}")
result=$(${CLIA} ethereum balance -o "${bseMultisignA}" ) result=$(${CLIA} ethereum balance -o "${bseMultisignA}")
hash=$(./ebcli_A ethereum multisign transfer -a 1 -r "${bseMultisignA}" -k "${bseMultisignKeyA},${bseMultisignKeyB},${bseMultisignKeyC}") hash=$(./ebcli_A ethereum multisign transfer -a 1 -r "${bseMultisignA}" -k "${bseMultisignKeyA},${bseMultisignKeyB},${bseMultisignKeyC}")
result=$(${CLIA} ethereum balance -o "${bseMultisignA}" ) result=$(${CLIA} ethereum balance -o "${bseMultisignA}")
result=$(${CLIA} ethereum balance -o "${multisignEthAddr}" ) result=$(${CLIA} ethereum balance -o "${multisignEthAddr}")
echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}" echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}"
} }
...@@ -186,13 +184,12 @@ function lockEthYcc() { ...@@ -186,13 +184,12 @@ function lockEthYcc() {
function StartRelayerOnBsc() { function StartRelayerOnBsc() {
echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}" echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}"
echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}" echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}"
} }
BridgeRegistryOnEth=0x5331F912027057fBE8139D91B225246e8159232f BridgeRegistryOnEth=0x5331F912027057fBE8139D91B225246e8159232f
ethBridgeBank=0xC65B02a22B714b55D708518E2426a22ffB79113d ethBridgeBank=0xC65B02a22B714b55D708518E2426a22ffB79113d
multisignEthAddr=0xbf271b2B23DA4fA8Dc93Ce86D27dd09796a7Bf54 multisignEthAddr=0xbf271b2B23DA4fA8Dc93Ce86D27dd09796a7Bf54
function mainTest() { function mainTest() {
StartChain33 StartChain33
...@@ -206,19 +203,17 @@ function mainTest() { ...@@ -206,19 +203,17 @@ function mainTest() {
fi fi
# shellcheck disable=SC2155 # shellcheck disable=SC2155
line=$(delete_line_show "./relayer.toml" "EthProviderCli=\"http://127.0.0.1:7545\"") line=$(delete_line_show "./relayer.toml" 'EthProviderCli="http://127.0.0.1:7545"')
if [ "${line}" ]; then if [ "${line}" ]; then
sed -i ''"${line}"' a EthProviderCli="https://data-seed-prebsc-1-s1.binance.org:8545/"' "./relayer.toml" sed -i ''"${line}"' a EthProviderCli="https://data-seed-prebsc-1-s1.binance.org:8545/"' "./relayer.toml"
fi fi
line=$(delete_line_show "./relayer.toml" "EthProvider=\"ws://127.0.0.1:7545/\"") line=$(delete_line_show "./relayer.toml" 'EthProvider="ws://127.0.0.1:7545/"')
if [ "${line}" ]; then if [ "${line}" ]; then
sed -i ''"${line}"' a EthProvider="wss://data-seed-prebsc-1-s1.binance.org:8545/"' "./relayer.toml" sed -i ''"${line}"' a EthProvider="wss://data-seed-prebsc-1-s1.binance.org:8545/"' "./relayer.toml"
fi fi
# StartRelayer_A
# StartRelayer_A
echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}" echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}"
# 修改 relayer.toml 配置文件 pushName 字段 # 修改 relayer.toml 配置文件 pushName 字段
...@@ -228,8 +223,8 @@ function mainTest() { ...@@ -228,8 +223,8 @@ function mainTest() {
start_ebrelayerA start_ebrelayerA
# 导入私钥 部署合约 设置 bridgeRegistry 地址 # 导入私钥 部署合约 设置 bridgeRegistry 地址
# InitAndDeploy # InitAndDeploy
{ {
echo -e "${GRE}=========== InitAndDeploy begin ===========${NOC}" echo -e "${GRE}=========== InitAndDeploy begin ===========${NOC}"
result=$(${CLIA} set_pwd -p 123456hzj) result=$(${CLIA} set_pwd -p 123456hzj)
...@@ -255,14 +250,14 @@ function mainTest() { ...@@ -255,14 +250,14 @@ function mainTest() {
cp Chain33BridgeBank.abi "${chain33BridgeBank}.abi" cp Chain33BridgeBank.abi "${chain33BridgeBank}.abi"
# 在 Eth 上部署合约 # 在 Eth 上部署合约
# result=$(${CLIA} ethereum deploy) # result=$(${CLIA} ethereum deploy)
# cli_ret "${result}" "ethereum deploy" # cli_ret "${result}" "ethereum deploy"
# BridgeRegistryOnEth=$(echo "${result}" | jq -r ".msg") # BridgeRegistryOnEth=$(echo "${result}" | jq -r ".msg")
# 拷贝 BridgeRegistry.abi 和 BridgeBank.abi # 拷贝 BridgeRegistry.abi 和 BridgeBank.abi
# cp BridgeRegistry.abi "${BridgeRegistryOnEth}.abi" # cp BridgeRegistry.abi "${BridgeRegistryOnEth}.abi"
# result=$(${CLIA} ethereum bridgeBankAddr) # result=$(${CLIA} ethereum bridgeBankAddr)
# ethBridgeBank=$(echo "${result}" | jq -r ".addr") # ethBridgeBank=$(echo "${result}" | jq -r ".addr")
cp EthBridgeBank.abi "${ethBridgeBank}.abi" cp EthBridgeBank.abi "${ethBridgeBank}.abi"
# 修改 relayer.toml 字段 # 修改 relayer.toml 字段
...@@ -274,7 +269,7 @@ function mainTest() { ...@@ -274,7 +269,7 @@ function mainTest() {
fi fi
echo -e "${GRE}=========== InitAndDeploy end ===========${NOC}" echo -e "${GRE}=========== InitAndDeploy end ===========${NOC}"
} }
# 重启 # 重启
kill_ebrelayer ebrelayer kill_ebrelayer ebrelayer
...@@ -288,7 +283,7 @@ function mainTest() { ...@@ -288,7 +283,7 @@ function mainTest() {
deployMultisign deployMultisign
lockEth lockEth
# lockEthYcc # lockEthYcc
} }
mainTest mainTest
......
...@@ -11,7 +11,6 @@ source "./relayerPublic.sh" ...@@ -11,7 +11,6 @@ source "./relayerPublic.sh"
#ethDeployAddr="0x8afdadfc88a1087c9a1d6c0f5dd04634b87f303a" #ethDeployAddr="0x8afdadfc88a1087c9a1d6c0f5dd04634b87f303a"
ethDeployKey="8656d2bc732a8a816a461ba5e2d8aac7c7f85c26a813df30d5327210465eb230" ethDeployKey="8656d2bc732a8a816a461ba5e2d8aac7c7f85c26a813df30d5327210465eb230"
# chain33 部署合约者的私钥 用于部署合约时签名使用 # chain33 部署合约者的私钥 用于部署合约时签名使用
chain33DeployAddr="1N6HstkyLFS8QCeVfdvYxx1xoryXoJtvvZ" chain33DeployAddr="1N6HstkyLFS8QCeVfdvYxx1xoryXoJtvvZ"
chain33DeployKey="0xcc38546e9e659d15e6b4893f0ab32a06d103931a8230b0bde71459d2b27d6944" chain33DeployKey="0xcc38546e9e659d15e6b4893f0ab32a06d103931a8230b0bde71459d2b27d6944"
...@@ -37,13 +36,13 @@ chain33ID=0 ...@@ -37,13 +36,13 @@ chain33ID=0
# shellcheck disable=SC2034 # shellcheck disable=SC2034
{ {
bseMultisignA=0x0f2e821517D4f64a012a04b668a6b1aa3B262e08 bseMultisignA=0x0f2e821517D4f64a012a04b668a6b1aa3B262e08
bseMultisignB=0x21B5f4C2F6Ff418fa0067629D9D76AE03fB4a2d2 bseMultisignB=0x21B5f4C2F6Ff418fa0067629D9D76AE03fB4a2d2
bseMultisignC=0xee760B2E502244016ADeD3491948220B3b1dd789 bseMultisignC=0xee760B2E502244016ADeD3491948220B3b1dd789
bseMultisignKeyA=f934e9171c5cf13b35e6c989e95f5e95fa471515730af147b66d60fbcd664b7c bseMultisignKeyA=f934e9171c5cf13b35e6c989e95f5e95fa471515730af147b66d60fbcd664b7c
bseMultisignKeyB=2bcf3e23a17d3f3b190a26a098239ad2d20267a673440e0f57a23f44f94b77b9 bseMultisignKeyB=2bcf3e23a17d3f3b190a26a098239ad2d20267a673440e0f57a23f44f94b77b9
bseMultisignKeyC=e5f8caae6468061c17543bc2205c8d910b3c71ad4d055105cde94e88ccb4e650 bseMultisignKeyC=e5f8caae6468061c17543bc2205c8d910b3c71ad4d055105cde94e88ccb4e650
TestNodeAddr="https://data-seed-prebsc-1-s1.binance.org:8545/" TestNodeAddr="https://data-seed-prebsc-1-s1.binance.org:8545/"
} }
function deployMultisign() { function deployMultisign() {
...@@ -81,18 +80,18 @@ function deployMultisign() { ...@@ -81,18 +80,18 @@ function deployMultisign() {
hash=$(${Chain33Cli} send evm call -f 1 -k "${chain33DeployAddr}" -e "${chain33BridgeBank}" -p "configOfflineSaveAccount(${multisignChain33Addr})" --chainID "${chain33ID}") hash=$(${Chain33Cli} send evm call -f 1 -k "${chain33DeployAddr}" -e "${chain33BridgeBank}" -p "configOfflineSaveAccount(${multisignChain33Addr})" --chainID "${chain33ID}")
check_tx "${Chain33Cli}" "${hash}" check_tx "${Chain33Cli}" "${hash}"
# echo -e "${GRE}=========== 部署 ETH 离线钱包合约 ===========${NOC}" # echo -e "${GRE}=========== 部署 ETH 离线钱包合约 ===========${NOC}"
# result=$(${CLIA} ethereum multisign deploy) # result=$(${CLIA} ethereum multisign deploy)
# cli_ret "${result}" "ethereum multisign deploy" # cli_ret "${result}" "ethereum multisign deploy"
# multisignEthAddr=$(echo "${result}" | jq -r ".msg") # multisignEthAddr=$(echo "${result}" | jq -r ".msg")
# #
# result=$(${CLIA} ethereum multisign setup -k "${ethDeployKey}" -o "${bseMultisignA},${bseMultisignB},${bseMultisignC}") # result=$(${CLIA} ethereum multisign setup -k "${ethDeployKey}" -o "${bseMultisignA},${bseMultisignB},${bseMultisignC}")
# cli_ret "${result}" "ethereum multisign setup" # cli_ret "${result}" "ethereum multisign setup"
# #
# result=$(${CLIA} ethereum multisign set_offline_addr -s "${multisignEthAddr}") # result=$(${CLIA} ethereum multisign set_offline_addr -s "${multisignEthAddr}")
# cli_ret "${result}" "set_offline_addr" # cli_ret "${result}" "set_offline_addr"
# #
# echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}" # echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}"
} }
function lock_eth_balance() { function lock_eth_balance() {
...@@ -106,38 +105,38 @@ function lock_eth_balance() { ...@@ -106,38 +105,38 @@ function lock_eth_balance() {
# eth 等待 10 个区块 # eth 等待 10 个区块
eth_block_wait 2 eth_block_wait 2
result=$(${CLIA} ethereum balance -o "${ethBridgeBank}" ) result=$(${CLIA} ethereum balance -o "${ethBridgeBank}")
# cli_ret "${result}" "balance" ".balance" "${bridgeBankBalance}" # cli_ret "${result}" "balance" ".balance" "${bridgeBankBalance}"
result=$(${CLIA} ethereum balance -o "${multisignEthAddr}" ) result=$(${CLIA} ethereum balance -o "${multisignEthAddr}")
# cli_ret "${result}" "balance" ".balance" "${multisignBalance}" # cli_ret "${result}" "balance" ".balance" "${multisignBalance}"
} }
function lockEth() { function lockEth() {
echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}" echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}"
# echo '2:#配置自动转离线钱包(BNB, 4, 50%)' # echo '2:#配置自动转离线钱包(BNB, 4, 50%)'
# result=$(${CLIA} ethereum multisign set_offline_token -s ETH -m 4) # result=$(${CLIA} ethereum multisign set_offline_token -s ETH -m 4)
# cli_ret "${result}" "set_offline_token -s ETH -m 4" # cli_ret "${result}" "set_offline_token -s ETH -m 4"
result=$(${CLIA} ethereum balance -o "${ethBridgeBank}" ) result=$(${CLIA} ethereum balance -o "${ethBridgeBank}")
# cli_ret "${result}" "balance" ".balance" "0" # cli_ret "${result}" "balance" ".balance" "0"
result=$(${CLIA} ethereum balance -o "${multisignEthAddr}" ) result=$(${CLIA} ethereum balance -o "${multisignEthAddr}")
# cli_ret "${result}" "balance" ".balance" "0" # cli_ret "${result}" "balance" ".balance" "0"
# lock_eth_balance 4 2 2 # lock_eth_balance 4 2 2
lock_eth_balance 2 4 2 lock_eth_balance 2 4 2
# lock_eth_balance 1 10 10 # lock_eth_balance 1 10 10
# lock_eth_balance 16 13 23 # lock_eth_balance 16 13 23
# transfer # transfer
hash=$(./ebcli_A ethereum multisign transfer -a 1 -r "${ethBridgeBank}" -k "${bseMultisignKeyA},${bseMultisignKeyB},${bseMultisignKeyC}") hash=$(./ebcli_A ethereum multisign transfer -a 1 -r "${ethBridgeBank}" -k "${bseMultisignKeyA},${bseMultisignKeyB},${bseMultisignKeyC}")
result=$(${CLIA} ethereum balance -o "${ethBridgeBank}" ) result=$(${CLIA} ethereum balance -o "${ethBridgeBank}")
result=$(${CLIA} ethereum balance -o "${multisignEthAddr}" ) result=$(${CLIA} ethereum balance -o "${multisignEthAddr}")
result=$(${CLIA} ethereum balance -o "${bseMultisignA}" ) result=$(${CLIA} ethereum balance -o "${bseMultisignA}")
hash=$(./ebcli_A ethereum multisign transfer -a 1 -r "${bseMultisignA}" -k "${bseMultisignKeyA},${bseMultisignKeyB},${bseMultisignKeyC}") hash=$(./ebcli_A ethereum multisign transfer -a 1 -r "${bseMultisignA}" -k "${bseMultisignKeyA},${bseMultisignKeyB},${bseMultisignKeyC}")
result=$(${CLIA} ethereum balance -o "${bseMultisignA}" ) result=$(${CLIA} ethereum balance -o "${bseMultisignA}")
result=$(${CLIA} ethereum balance -o "${multisignEthAddr}" ) result=$(${CLIA} ethereum balance -o "${multisignEthAddr}")
echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}" echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}"
} }
...@@ -185,17 +184,16 @@ function lockEthYcc() { ...@@ -185,17 +184,16 @@ function lockEthYcc() {
function StartRelayerOnBsc() { function StartRelayerOnBsc() {
echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}" echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}"
echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}" echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}"
} }
BridgeRegistryOnEth=0x5331F912027057fBE8139D91B225246e8159232f BridgeRegistryOnEth=0x5331F912027057fBE8139D91B225246e8159232f
ethBridgeBank=0xC65B02a22B714b55D708518E2426a22ffB79113d ethBridgeBank=0xC65B02a22B714b55D708518E2426a22ffB79113d
multisignEthAddr=0xbf271b2B23DA4fA8Dc93Ce86D27dd09796a7Bf54 multisignEthAddr=0xbf271b2B23DA4fA8Dc93Ce86D27dd09796a7Bf54
# shellcheck disable=SC2120 # shellcheck disable=SC2120
function mainTest() { function mainTest() {
if [[ $# -ge 1 && "${1}" != "" ]]; then if [[ $# -ge 1 && ${1} != "" ]]; then
chain33ID="${1}" chain33ID="${1}"
fi fi
StartChain33 StartChain33
...@@ -209,19 +207,17 @@ function mainTest() { ...@@ -209,19 +207,17 @@ function mainTest() {
fi fi
# shellcheck disable=SC2155 # shellcheck disable=SC2155
line=$(delete_line_show "./relayer.toml" "EthProviderCli=\"http://127.0.0.1:7545\"") line=$(delete_line_show "./relayer.toml" 'EthProviderCli="http://127.0.0.1:7545"')
if [ "${line}" ]; then if [ "${line}" ]; then
sed -i ''"${line}"' a EthProviderCli="https://data-seed-prebsc-1-s1.binance.org:8545/"' "./relayer.toml" sed -i ''"${line}"' a EthProviderCli="https://data-seed-prebsc-1-s1.binance.org:8545/"' "./relayer.toml"
fi fi
line=$(delete_line_show "./relayer.toml" "EthProvider=\"ws://127.0.0.1:7545/\"") line=$(delete_line_show "./relayer.toml" 'EthProvider="ws://127.0.0.1:7545/"')
if [ "${line}" ]; then if [ "${line}" ]; then
sed -i ''"${line}"' a EthProvider="wss://data-seed-prebsc-1-s1.binance.org:8545/"' "./relayer.toml" sed -i ''"${line}"' a EthProvider="wss://data-seed-prebsc-1-s1.binance.org:8545/"' "./relayer.toml"
fi fi
# StartRelayer_A
# StartRelayer_A
echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}" echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}"
# 修改 relayer.toml 配置文件 pushName 字段 # 修改 relayer.toml 配置文件 pushName 字段
...@@ -231,8 +227,8 @@ function mainTest() { ...@@ -231,8 +227,8 @@ function mainTest() {
start_ebrelayerA start_ebrelayerA
# 导入私钥 部署合约 设置 bridgeRegistry 地址 # 导入私钥 部署合约 设置 bridgeRegistry 地址
# InitAndDeploy # InitAndDeploy
{ {
echo -e "${GRE}=========== InitAndDeploy begin ===========${NOC}" echo -e "${GRE}=========== InitAndDeploy begin ===========${NOC}"
result=$(${CLIA} set_pwd -p 123456hzj) result=$(${CLIA} set_pwd -p 123456hzj)
...@@ -258,14 +254,14 @@ function mainTest() { ...@@ -258,14 +254,14 @@ function mainTest() {
cp Chain33BridgeBank.abi "${chain33BridgeBank}.abi" cp Chain33BridgeBank.abi "${chain33BridgeBank}.abi"
# 在 Eth 上部署合约 # 在 Eth 上部署合约
# result=$(${CLIA} ethereum deploy) # result=$(${CLIA} ethereum deploy)
# cli_ret "${result}" "ethereum deploy" # cli_ret "${result}" "ethereum deploy"
# BridgeRegistryOnEth=$(echo "${result}" | jq -r ".msg") # BridgeRegistryOnEth=$(echo "${result}" | jq -r ".msg")
# 拷贝 BridgeRegistry.abi 和 BridgeBank.abi # 拷贝 BridgeRegistry.abi 和 BridgeBank.abi
# cp BridgeRegistry.abi "${BridgeRegistryOnEth}.abi" # cp BridgeRegistry.abi "${BridgeRegistryOnEth}.abi"
# result=$(${CLIA} ethereum bridgeBankAddr) # result=$(${CLIA} ethereum bridgeBankAddr)
# ethBridgeBank=$(echo "${result}" | jq -r ".addr") # ethBridgeBank=$(echo "${result}" | jq -r ".addr")
cp EthBridgeBank.abi "${ethBridgeBank}.abi" cp EthBridgeBank.abi "${ethBridgeBank}.abi"
# 修改 relayer.toml 字段 # 修改 relayer.toml 字段
...@@ -277,7 +273,7 @@ function mainTest() { ...@@ -277,7 +273,7 @@ function mainTest() {
fi fi
echo -e "${GRE}=========== InitAndDeploy end ===========${NOC}" echo -e "${GRE}=========== InitAndDeploy end ===========${NOC}"
} }
# 重启 # 重启
kill_ebrelayer ebrelayer kill_ebrelayer ebrelayer
...@@ -291,7 +287,7 @@ function mainTest() { ...@@ -291,7 +287,7 @@ function mainTest() {
deployMultisign deployMultisign
lockEth lockEth
# lockEthYcc # lockEthYcc
} }
mainTest "${1}" mainTest "${1}"
......
...@@ -51,7 +51,7 @@ function LockTestChain33ToEthAssets() { ...@@ -51,7 +51,7 @@ function LockTestChain33ToEthAssets() {
function BurnTestChain33ToEthAssets() { function BurnTestChain33ToEthAssets() {
echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}" echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}"
# eth burn # eth burn
result=$(${CLIA} ethereum burn -m 1 -k "${ethSendPrivateKeys}" -r "${chain33DeployAddr}" -t "${ethereumBtyTokenAddr}" ) #--node_addr https://ropsten.infura.io/v3/9e83f296716142ffbaeaafc05790f26c) result=$(${CLIA} ethereum burn -m 1 -k "${ethSendPrivateKeys}" -r "${chain33DeployAddr}" -t "${ethereumBtyTokenAddr}") #--node_addr https://ropsten.infura.io/v3/9e83f296716142ffbaeaafc05790f26c)
cli_ret "${result}" "burn" cli_ret "${result}" "burn"
echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}" echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}"
} }
...@@ -96,14 +96,14 @@ function mainTest() { ...@@ -96,14 +96,14 @@ function mainTest() {
${CLIA} ethereum token token_transfer -k "${ethDeployKey}" -m 10000 -r "${ethSendAddress}" -t "${ethereumYccTokenAddr}" ${CLIA} ethereum token token_transfer -k "${ethDeployKey}" -m 10000 -r "${ethSendAddress}" -t "${ethereumYccTokenAddr}"
for (( i = 0; i < 10; i++ )); do for ((i = 0; i < 10; i++)); do
LockTestChain33ToEthAssets LockTestChain33ToEthAssets
LockTestETH2Chain33Assets LockTestETH2Chain33Assets
LockTestETH2Chain33Ycc LockTestETH2Chain33Ycc
sleep 1 sleep 1
done done
while true ; do while true; do
LockTestChain33ToEthAssets LockTestChain33ToEthAssets
LockTestETH2Chain33Assets LockTestETH2Chain33Assets
LockTestETH2Chain33Ycc LockTestETH2Chain33Ycc
...@@ -119,4 +119,3 @@ function mainTest() { ...@@ -119,4 +119,3 @@ function mainTest() {
} }
mainTest mainTest
...@@ -38,49 +38,49 @@ multisignChain33Addr=1b193HbfvVUunUL2DVXrqt9jnbAWwLjcT ...@@ -38,49 +38,49 @@ multisignChain33Addr=1b193HbfvVUunUL2DVXrqt9jnbAWwLjcT
function lockBty() { function lockBty() {
echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}" echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}"
# echo '2:#配置自动转离线钱包(bty, 100, 50%)' # echo '2:#配置自动转离线钱包(bty, 100, 50%)'
hash=$(${Chain33Cli} send evm call -f 1 -k "${chain33DeployAddr}" -e ${chain33BridgeBank} -p "configLockedTokenOfflineSave(${chain33BtyTokenAddr},BTY,10000000000,50)" --khainID "${chain33ID}") hash=$(${Chain33Cli} send evm call -f 1 -k "${chain33DeployAddr}" -e ${chain33BridgeBank} -p "configLockedTokenOfflineSave(${chain33BtyTokenAddr},BTY,10000000000,50)" --khainID "${chain33ID}")
check_tx "${Chain33Cli}" "${hash}" check_tx "${Chain33Cli}" "${hash}"
result=$(${Chain33Cli} account balance -a "${chain33BridgeBank}" -e evm) result=$(${Chain33Cli} account balance -a "${chain33BridgeBank}" -e evm)
# balance_ret "${result}" "0" # balance_ret "${result}" "0"
result=$(${Chain33Cli} account balance -a "${multisignChain33Addr}" -e evm) result=$(${Chain33Cli} account balance -a "${multisignChain33Addr}" -e evm)
# balance_ret "${result}" "0" # balance_ret "${result}" "0"
for (( i = 0; i < 1000; i++ )); do for ((i = 0; i < 1000; i++)); do
echo "${i}" echo "${i}"
lock_bty_multisign 1 lock_bty_multisign 1
sleep 1 sleep 1
done done
result=$(${Chain33Cli} account balance -a "${chain33BridgeBank}" -e evm) result=$(${Chain33Cli} account balance -a "${chain33BridgeBank}" -e evm)
# balance_ret "${result}" "50" # balance_ret "${result}" "50"
result=$(${Chain33Cli} account balance -a "${multisignChain33Addr}" -e evm) result=$(${Chain33Cli} account balance -a "${multisignChain33Addr}" -e evm)
# balance_ret "${result}" "950" # balance_ret "${result}" "950"
# # transfer test # # transfer test
# hash=$(${CLIA} chain33 multisign transfer -a 100 -r "${chain33BridgeBank}" -k "${chain33MultisignKeyA},${chain33MultisignKeyB},${chain33MultisignKeyC},${chain33MultisignKeyD}" | jq -r ".msg") # hash=$(${CLIA} chain33 multisign transfer -a 100 -r "${chain33BridgeBank}" -k "${chain33MultisignKeyA},${chain33MultisignKeyB},${chain33MultisignKeyC},${chain33MultisignKeyD}" | jq -r ".msg")
# check_tx "${Chain33Cli}" "${hash}" # check_tx "${Chain33Cli}" "${hash}"
# sleep 2 # sleep 2
# result=$(${Chain33Cli} account balance -a "${multisignChain33Addr}" -e evm) # result=$(${Chain33Cli} account balance -a "${multisignChain33Addr}" -e evm)
# balance_ret "${result}" "997.5000" # balance_ret "${result}" "997.5000"
# result=$(${Chain33Cli} account balance -a "${chain33BridgeBank}" -e evm) # result=$(${Chain33Cli} account balance -a "${chain33BridgeBank}" -e evm)
# balance_ret "${result}" "632.5000" # balance_ret "${result}" "632.5000"
# #
# hash=$(${CLIA} chain33 multisign transfer -a 100 -r "${chain33MultisignA}" -k "${chain33MultisignKeyA},${chain33MultisignKeyB},${chain33MultisignKeyC},${chain33MultisignKeyD}" | jq -r ".msg") # hash=$(${CLIA} chain33 multisign transfer -a 100 -r "${chain33MultisignA}" -k "${chain33MultisignKeyA},${chain33MultisignKeyB},${chain33MultisignKeyC},${chain33MultisignKeyD}" | jq -r ".msg")
# check_tx "${Chain33Cli}" "${hash}" # check_tx "${Chain33Cli}" "${hash}"
# sleep 2 # sleep 2
# result=$(${Chain33Cli} account balance -a "${multisignChain33Addr}" -e evm) # result=$(${Chain33Cli} account balance -a "${multisignChain33Addr}" -e evm)
# balance_ret "${result}" "897.5000" # balance_ret "${result}" "897.5000"
# result=$(${Chain33Cli} account balance -a "${chain33MultisignA}" -e evm) # result=$(${Chain33Cli} account balance -a "${chain33MultisignA}" -e evm)
# balance_ret "${result}" "100.0000" # balance_ret "${result}" "100.0000"
echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}" echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}"
} }
function lockChain33Ycc() { function lockChain33Ycc() {
echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}" echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}"
# echo '2:#配置自动转离线钱包(YCC, 100, 60%)' # echo '2:#配置自动转离线钱包(YCC, 100, 60%)'
hash=$(${Chain33Cli} send evm call -f 1 -k "${chain33DeployAddr}" -e ${chain33BridgeBank} -p "configLockedTokenOfflineSave(${chain33YccErc20Addr},YCC,10000000000,60)" --chainID "${chain33ID}") hash=$(${Chain33Cli} send evm call -f 1 -k "${chain33DeployAddr}" -e ${chain33BridgeBank} -p "configLockedTokenOfflineSave(${chain33YccErc20Addr},YCC,10000000000,60)" --chainID "${chain33ID}")
check_tx "${Chain33Cli}" "${hash}" check_tx "${Chain33Cli}" "${hash}"
...@@ -109,7 +109,7 @@ function lockChain33Ycc() { ...@@ -109,7 +109,7 @@ function lockChain33Ycc() {
is_equal "${result}" "30300000000" is_equal "${result}" "30300000000"
# 判断 ETH 这端是否金额一致 # 判断 ETH 这端是否金额一致
result=$(${CLIA} ethereum balance -o "${ethDeployAddr}" -t "${ethBridgeToeknYccAddr}" ) result=$(${CLIA} ethereum balance -o "${ethDeployAddr}" -t "${ethBridgeToeknYccAddr}")
cli_ret "${result}" "balance" ".balance" "370" cli_ret "${result}" "balance" ".balance" "370"
echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}" echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}"
...@@ -121,9 +121,9 @@ function lockEth() { ...@@ -121,9 +121,9 @@ function lockEth() {
result=$(${CLIA} ethereum multisign set_offline_token -s ETH -m 20) result=$(${CLIA} ethereum multisign set_offline_token -s ETH -m 20)
cli_ret "${result}" "set_offline_token -s ETH -m 20" cli_ret "${result}" "set_offline_token -s ETH -m 20"
result=$(${CLIA} ethereum balance -o "${ethBridgeBank}" ) result=$(${CLIA} ethereum balance -o "${ethBridgeBank}")
cli_ret "${result}" "balance" ".balance" "0" cli_ret "${result}" "balance" ".balance" "0"
result=$(${CLIA} ethereum balance -o "${multisignEthAddr}" ) result=$(${CLIA} ethereum balance -o "${multisignEthAddr}")
cli_ret "${result}" "balance" ".balance" "0" cli_ret "${result}" "balance" ".balance" "0"
lock_eth_multisign 19 19 0 lock_eth_multisign 19 19 0
...@@ -190,7 +190,7 @@ function lockEthYcc() { ...@@ -190,7 +190,7 @@ function lockEthYcc() {
# shellcheck disable=SC2120 # shellcheck disable=SC2120
function mainTest() { function mainTest() {
if [[ $# -ge 1 && "${1}" != "" ]]; then if [[ $# -ge 1 && ${1} != "" ]]; then
chain33ID="${1}" chain33ID="${1}"
fi fi
StartChain33 StartChain33
...@@ -200,9 +200,9 @@ function mainTest() { ...@@ -200,9 +200,9 @@ function mainTest() {
deployMultisign deployMultisign
lockBty lockBty
# lockChain33Ycc # lockChain33Ycc
# lockEth # lockEth
# lockEthYcc # lockEthYcc
} }
mainTest "${1}" mainTest "${1}"
......
...@@ -46,7 +46,7 @@ function TestChain33ToEthAssets() { ...@@ -46,7 +46,7 @@ function TestChain33ToEthAssets() {
# 原来的地址金额 # 原来的地址金额
result=$(${Chain33Cli} account balance -a "${chain33DeployAddr}" -e evm) result=$(${Chain33Cli} account balance -a "${chain33DeployAddr}" -e evm)
# balance=$(cli_ret "${result}" "balance" ".balance") # balance=$(cli_ret "${result}" "balance" ".balance")
# chain33 lock bty # chain33 lock bty
hash=$(${Chain33Cli} send evm call -f 1 -a 5 -k "${chain33DeployAddr}" -e "${chain33BridgeBank}" -p "lock(${ethDeployAddr}, ${chain33BtyTokenAddr}, 500000000)" --khainID "${chain33ID}") hash=$(${Chain33Cli} send evm call -f 1 -a 5 -k "${chain33DeployAddr}" -e "${chain33BridgeBank}" -p "lock(${ethDeployAddr}, ${chain33BtyTokenAddr}, 500000000)" --khainID "${chain33ID}")
...@@ -54,7 +54,7 @@ function TestChain33ToEthAssets() { ...@@ -54,7 +54,7 @@ function TestChain33ToEthAssets() {
# 原来的地址金额 减少了 5 # 原来的地址金额 减少了 5
result=$(${Chain33Cli} account balance -a "${chain33DeployAddr}" -e evm) result=$(${Chain33Cli} account balance -a "${chain33DeployAddr}" -e evm)
# cli_ret "${result}" "balance" ".balance" "$(echo "${balance}-5" | bc)" # cli_ret "${result}" "balance" ".balance" "$(echo "${balance}-5" | bc)"
#balance_ret "${result}" "195.0000" #balance_ret "${result}" "195.0000"
# chain33BridgeBank 是否增加了 5 # chain33BridgeBank 是否增加了 5
...@@ -68,7 +68,7 @@ function TestChain33ToEthAssets() { ...@@ -68,7 +68,7 @@ function TestChain33ToEthAssets() {
cli_ret "${result}" "balance" ".balance" "5" cli_ret "${result}" "balance" ".balance" "5"
# eth burn # eth burn
result=$(${CLIA} ethereum burn -m 3 -k "${ethDeployKey}" -r "${chain33ReceiverAddr}" -t "${ethereumBtyTokenAddr}" ) #--node_addr https://ropsten.infura.io/v3/9e83f296716142ffbaeaafc05790f26c) result=$(${CLIA} ethereum burn -m 3 -k "${ethDeployKey}" -r "${chain33ReceiverAddr}" -t "${ethereumBtyTokenAddr}") #--node_addr https://ropsten.infura.io/v3/9e83f296716142ffbaeaafc05790f26c)
cli_ret "${result}" "burn" cli_ret "${result}" "burn"
eth_block_wait 2 eth_block_wait 2
...@@ -94,7 +94,7 @@ function TestChain33ToEthAssets() { ...@@ -94,7 +94,7 @@ function TestChain33ToEthAssets() {
function TestETH2Chain33Assets() { function TestETH2Chain33Assets() {
echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}" echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}"
# 查询 ETH 这端 bridgeBank 地址原来是 0 # 查询 ETH 这端 bridgeBank 地址原来是 0
result=$(${CLIA} ethereum balance -o "${ethBridgeBank}" ) result=$(${CLIA} ethereum balance -o "${ethBridgeBank}")
cli_ret "${result}" "balance" ".balance" "0" cli_ret "${result}" "balance" ".balance" "0"
# ETH 这端 lock 11个 # ETH 这端 lock 11个
...@@ -105,7 +105,7 @@ function TestETH2Chain33Assets() { ...@@ -105,7 +105,7 @@ function TestETH2Chain33Assets() {
eth_block_wait 2 eth_block_wait 2
# 查询 ETH 这端 bridgeBank 地址 11 # 查询 ETH 这端 bridgeBank 地址 11
result=$(${CLIA} ethereum balance -o "${ethBridgeBank}" ) result=$(${CLIA} ethereum balance -o "${ethBridgeBank}")
cli_ret "${result}" "balance" ".balance" "11" cli_ret "${result}" "balance" ".balance" "11"
sleep ${maturityDegree} sleep ${maturityDegree}
...@@ -130,7 +130,7 @@ function TestETH2Chain33Assets() { ...@@ -130,7 +130,7 @@ function TestETH2Chain33Assets() {
is_equal "${result}" "600000000" is_equal "${result}" "600000000"
# 查询 ETH 这端 bridgeBank 地址 0 # 查询 ETH 这端 bridgeBank 地址 0
result=$(${CLIA} ethereum balance -o "${ethBridgeBank}" ) result=$(${CLIA} ethereum balance -o "${ethBridgeBank}")
cli_ret "${result}" "balance" ".balance" "6" cli_ret "${result}" "balance" ".balance" "6"
# 比之前多 5 # 比之前多 5
...@@ -192,7 +192,7 @@ function TestETH2Chain33Ycc() { ...@@ -192,7 +192,7 @@ function TestETH2Chain33Ycc() {
# shellcheck disable=SC2120 # shellcheck disable=SC2120
function mainTest() { function mainTest() {
if [[ $# -ge 1 && "${1}" != "" ]]; then if [[ $# -ge 1 && ${1} != "" ]]; then
chain33ID="${1}" chain33ID="${1}"
fi fi
StartChain33 StartChain33
......
...@@ -66,7 +66,7 @@ function TestChain33ToEthAssetsKill() { ...@@ -66,7 +66,7 @@ function TestChain33ToEthAssetsKill() {
kill_ebrelayerC kill_ebrelayerC
# eth burn # eth burn
result=$(${CLIA} ethereum burn -m 3 -k "${ethDeployKey}" -r "${chain33ReceiverAddr}" -t "${ethereumBtyTokenAddr}" ) #--node_addr https://ropsten.infura.io/v3/9e83f296716142ffbaeaafc05790f26c) result=$(${CLIA} ethereum burn -m 3 -k "${ethDeployKey}" -r "${chain33ReceiverAddr}" -t "${ethereumBtyTokenAddr}") #--node_addr https://ropsten.infura.io/v3/9e83f296716142ffbaeaafc05790f26c)
cli_ret "${result}" "burn" cli_ret "${result}" "burn"
eth_block_wait 2 eth_block_wait 2
...@@ -129,7 +129,7 @@ function TestChain33ToEthZBCAssetsKill() { ...@@ -129,7 +129,7 @@ function TestChain33ToEthZBCAssetsKill() {
kill_ebrelayerC kill_ebrelayerC
# eth burn # eth burn
result=$(${CLIA} ethereum burn -m 8 -k "${ethDeployKey}" -r "${chain33ReceiverAddr}" -t "${ethBridgeToeknZBCAddr}" ) #--node_addr https://ropsten.infura.io/v3/9e83f296716142ffbaeaafc05790f26c) result=$(${CLIA} ethereum burn -m 8 -k "${ethDeployKey}" -r "${chain33ReceiverAddr}" -t "${ethBridgeToeknZBCAddr}") #--node_addr https://ropsten.infura.io/v3/9e83f296716142ffbaeaafc05790f26c)
cli_ret "${result}" "burn" cli_ret "${result}" "burn"
eth_block_wait 2 eth_block_wait 2
...@@ -161,7 +161,7 @@ function TestChain33ToEthZBCAssetsKill() { ...@@ -161,7 +161,7 @@ function TestChain33ToEthZBCAssetsKill() {
function TestETH2Chain33AssetsKill() { function TestETH2Chain33AssetsKill() {
echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}" echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}"
# 查询 ETH 这端 bridgeBank 地址原来是 0 # 查询 ETH 这端 bridgeBank 地址原来是 0
result=$(${CLIA} ethereum balance -o "${ethBridgeBank}" ) result=$(${CLIA} ethereum balance -o "${ethBridgeBank}")
cli_ret "${result}" "balance" ".balance" "0" cli_ret "${result}" "balance" ".balance" "0"
kill_ebrelayerC kill_ebrelayerC
...@@ -175,7 +175,7 @@ function TestETH2Chain33AssetsKill() { ...@@ -175,7 +175,7 @@ function TestETH2Chain33AssetsKill() {
eth_block_wait 2 eth_block_wait 2
# 查询 ETH 这端 bridgeBank 地址 11 # 查询 ETH 这端 bridgeBank 地址 11
result=$(${CLIA} ethereum balance -o "${ethBridgeBank}" ) result=$(${CLIA} ethereum balance -o "${ethBridgeBank}")
cli_ret "${result}" "balance" ".balance" "11" cli_ret "${result}" "balance" ".balance" "11"
sleep ${maturityDegree} sleep ${maturityDegree}
...@@ -220,7 +220,7 @@ function TestETH2Chain33AssetsKill() { ...@@ -220,7 +220,7 @@ function TestETH2Chain33AssetsKill() {
is_equal "${result}" "600000000" is_equal "${result}" "600000000"
# 查询 ETH 这端 bridgeBank 地址 0 # 查询 ETH 这端 bridgeBank 地址 0
result=$(${CLIA} ethereum balance -o "${ethBridgeBank}" ) result=$(${CLIA} ethereum balance -o "${ethBridgeBank}")
cli_ret "${result}" "balance" ".balance" "6" cli_ret "${result}" "balance" ".balance" "6"
echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}" echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}"
...@@ -295,7 +295,7 @@ function TestETH2Chain33YccKill() { ...@@ -295,7 +295,7 @@ function TestETH2Chain33YccKill() {
# shellcheck disable=SC2120 # shellcheck disable=SC2120
function mainTest() { function mainTest() {
if [[ $# -ge 1 && "${1}" != "" ]]; then if [[ $# -ge 1 && ${1} != "" ]]; then
chain33ID="${1}" chain33ID="${1}"
fi fi
StartChain33 StartChain33
......
...@@ -48,7 +48,7 @@ function TestChain33ToEthAssets() { ...@@ -48,7 +48,7 @@ function TestChain33ToEthAssets() {
# 原来的地址金额 # 原来的地址金额
result=$(${Chain33Cli} account balance -a "${chain33DeployAddr}" -e evm) result=$(${Chain33Cli} account balance -a "${chain33DeployAddr}" -e evm)
# balance=$(cli_ret "${result}" "balance" ".balance") # balance=$(cli_ret "${result}" "balance" ".balance")
# chain33 lock bty # chain33 lock bty
hash=$(${Chain33Cli} send evm call -f 1 -a 5 -k "${chain33DeployAddr}" -e "${chain33BridgeBank}" -p "lock(${ethDeployAddr}, ${chain33BtyTokenAddr}, 500000000)" --chainID "${chain33ID}") hash=$(${Chain33Cli} send evm call -f 1 -a 5 -k "${chain33DeployAddr}" -e "${chain33BridgeBank}" -p "lock(${ethDeployAddr}, ${chain33BtyTokenAddr}, 500000000)" --chainID "${chain33ID}")
...@@ -56,7 +56,7 @@ function TestChain33ToEthAssets() { ...@@ -56,7 +56,7 @@ function TestChain33ToEthAssets() {
# 原来的地址金额 减少了 5 # 原来的地址金额 减少了 5
result=$(${Chain33Cli} account balance -a "${chain33DeployAddr}" -e evm) result=$(${Chain33Cli} account balance -a "${chain33DeployAddr}" -e evm)
# cli_ret "${result}" "balance" ".balance" "$(echo "${balance}-5" | bc)" # cli_ret "${result}" "balance" ".balance" "$(echo "${balance}-5" | bc)"
#balance_ret "${result}" "195.0000" #balance_ret "${result}" "195.0000"
# chain33BridgeBank 是否增加了 5 # chain33BridgeBank 是否增加了 5
...@@ -70,7 +70,7 @@ function TestChain33ToEthAssets() { ...@@ -70,7 +70,7 @@ function TestChain33ToEthAssets() {
cli_ret "${result}" "balance" ".balance" "5" cli_ret "${result}" "balance" ".balance" "5"
# eth burn # eth burn
result=$(${CLIA} ethereum burn -m 3 -k "${ethDeployKey}" -r "${chain33ReceiverAddr}" -t "${ethereumBtyTokenAddr}" ) #--node_addr https://ropsten.infura.io/v3/9e83f296716142ffbaeaafc05790f26c) result=$(${CLIA} ethereum burn -m 3 -k "${ethDeployKey}" -r "${chain33ReceiverAddr}" -t "${ethereumBtyTokenAddr}") #--node_addr https://ropsten.infura.io/v3/9e83f296716142ffbaeaafc05790f26c)
cli_ret "${result}" "burn" cli_ret "${result}" "burn"
eth_block_wait 2 eth_block_wait 2
...@@ -118,7 +118,7 @@ function TestChain33ToEthZBCAssets() { ...@@ -118,7 +118,7 @@ function TestChain33ToEthZBCAssets() {
cli_ret "${result}" "balance" ".balance" "9" cli_ret "${result}" "balance" ".balance" "9"
# eth burn # eth burn
result=$(${CLIA} ethereum burn -m 8 -k "${ethDeployKey}" -r "${chain33ReceiverAddr}" -t "${ethBridgeToeknZBCAddr}" ) #--node_addr https://ropsten.infura.io/v3/9e83f296716142ffbaeaafc05790f26c) result=$(${CLIA} ethereum burn -m 8 -k "${ethDeployKey}" -r "${chain33ReceiverAddr}" -t "${ethBridgeToeknZBCAddr}") #--node_addr https://ropsten.infura.io/v3/9e83f296716142ffbaeaafc05790f26c)
cli_ret "${result}" "burn" cli_ret "${result}" "burn"
eth_block_wait 2 eth_block_wait 2
...@@ -145,7 +145,7 @@ function TestETH2Chain33Assets() { ...@@ -145,7 +145,7 @@ function TestETH2Chain33Assets() {
echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}" echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}"
echo -e "${GRE}=========== eth to chain33 在以太坊上锁定 ETH 资产,然后在 chain33 上 burn ===========${NOC}" echo -e "${GRE}=========== eth to chain33 在以太坊上锁定 ETH 资产,然后在 chain33 上 burn ===========${NOC}"
# 查询 ETH 这端 bridgeBank 地址原来是 0 # 查询 ETH 这端 bridgeBank 地址原来是 0
result=$(${CLIA} ethereum balance -o "${ethBridgeBank}" ) result=$(${CLIA} ethereum balance -o "${ethBridgeBank}")
cli_ret "${result}" "balance" ".balance" "0" cli_ret "${result}" "balance" ".balance" "0"
# ETH 这端 lock 11个 # ETH 这端 lock 11个
...@@ -156,7 +156,7 @@ function TestETH2Chain33Assets() { ...@@ -156,7 +156,7 @@ function TestETH2Chain33Assets() {
eth_block_wait 2 eth_block_wait 2
# 查询 ETH 这端 bridgeBank 地址 11 # 查询 ETH 这端 bridgeBank 地址 11
result=$(${CLIA} ethereum balance -o "${ethBridgeBank}" ) result=$(${CLIA} ethereum balance -o "${ethBridgeBank}")
cli_ret "${result}" "balance" ".balance" "11" cli_ret "${result}" "balance" ".balance" "11"
sleep ${maturityDegree} sleep ${maturityDegree}
...@@ -181,7 +181,7 @@ function TestETH2Chain33Assets() { ...@@ -181,7 +181,7 @@ function TestETH2Chain33Assets() {
is_equal "${result}" "600000000" is_equal "${result}" "600000000"
# 查询 ETH 这端 bridgeBank 地址 0 # 查询 ETH 这端 bridgeBank 地址 0
result=$(${CLIA} ethereum balance -o "${ethBridgeBank}" ) result=$(${CLIA} ethereum balance -o "${ethBridgeBank}")
cli_ret "${result}" "balance" ".balance" "6" cli_ret "${result}" "balance" ".balance" "6"
# 比之前多 5 # 比之前多 5
...@@ -243,7 +243,7 @@ function TestETH2Chain33Ycc() { ...@@ -243,7 +243,7 @@ function TestETH2Chain33Ycc() {
# shellcheck disable=SC2120 # shellcheck disable=SC2120
function mainTest() { function mainTest() {
if [[ $# -ge 1 && "${1}" != "" ]]; then if [[ $# -ge 1 && ${1} != "" ]]; then
chain33ID="${1}" chain33ID="${1}"
fi fi
...@@ -258,4 +258,3 @@ function mainTest() { ...@@ -258,4 +258,3 @@ function mainTest() {
} }
mainTest "${1}" mainTest "${1}"
...@@ -42,26 +42,25 @@ ethBridgeToeknYccAddr="" ...@@ -42,26 +42,25 @@ ethBridgeToeknYccAddr=""
#ethValidatorAddrKeyA="8656d2bc732a8a816a461ba5e2d8aac7c7f85c26a813df30d5327210465eb230" #ethValidatorAddrKeyA="8656d2bc732a8a816a461ba5e2d8aac7c7f85c26a813df30d5327210465eb230"
# shellcheck disable=SC2034 # shellcheck disable=SC2034
{ {
ethValidatorAddrKeyb="a5f3063552f4483cfc20ac4f40f45b798791379862219de9e915c64722c1d400" ethValidatorAddrKeyb="a5f3063552f4483cfc20ac4f40f45b798791379862219de9e915c64722c1d400"
ethValidatorAddrKeyc="bbf5e65539e9af0eb0cfac30bad475111054b09c11d668fc0731d54ea777471e" ethValidatorAddrKeyc="bbf5e65539e9af0eb0cfac30bad475111054b09c11d668fc0731d54ea777471e"
ethValidatorAddrKeyd="c9fa31d7984edf81b8ef3b40c761f1847f6fcd5711ab2462da97dc458f1f896b" ethValidatorAddrKeyd="c9fa31d7984edf81b8ef3b40c761f1847f6fcd5711ab2462da97dc458f1f896b"
# 新增地址 chain33 需要导入地址 转入 10 bty当收费费 # 新增地址 chain33 需要导入地址 转入 10 bty当收费费
chain33Validatora="1N6HstkyLFS8QCeVfdvYxx1xoryXoJtvvZ" chain33Validatora="1N6HstkyLFS8QCeVfdvYxx1xoryXoJtvvZ"
chain33Validatorb="155ooMPBTF8QQsGAknkK7ei5D78rwDEFe6" chain33Validatorb="155ooMPBTF8QQsGAknkK7ei5D78rwDEFe6"
chain33Validatorc="13zBdQwuyDh7cKN79oT2odkxYuDbgQiXFv" chain33Validatorc="13zBdQwuyDh7cKN79oT2odkxYuDbgQiXFv"
chain33Validatord="113ZzVamKfAtGt9dq45fX1mNsEoDiN95HG" chain33Validatord="113ZzVamKfAtGt9dq45fX1mNsEoDiN95HG"
#chain33ValidatorKeya="0xcc38546e9e659d15e6b4893f0ab32a06d103931a8230b0bde71459d2b27d6944" #chain33ValidatorKeya="0xcc38546e9e659d15e6b4893f0ab32a06d103931a8230b0bde71459d2b27d6944"
chain33ValidatorKeyb="0x9d539bc5fd084eb7fe86ad631dba9aa086dba38418725c38d9751459f567da66" chain33ValidatorKeyb="0x9d539bc5fd084eb7fe86ad631dba9aa086dba38418725c38d9751459f567da66"
chain33ValidatorKeyc="0x0a6671f101e30a2cc2d79d77436b62cdf2664ed33eb631a9c9e3f3dd348a23be" chain33ValidatorKeyc="0x0a6671f101e30a2cc2d79d77436b62cdf2664ed33eb631a9c9e3f3dd348a23be"
chain33ValidatorKeyd="0x3818b257b05ee75b6e43ee0e3cfc2d8502342cf67caed533e3756966690b62a5" chain33ValidatorKeyd="0x3818b257b05ee75b6e43ee0e3cfc2d8502342cf67caed533e3756966690b62a5"
} }
#CLIA="./ebcli_A" #CLIA="./ebcli_A"
#ethUrl="" #ethUrl=""
function start_docker_ebrelayerA() { function start_docker_ebrelayerA() {
# shellcheck disable=SC2154 # shellcheck disable=SC2154
docker cp "./relayer.toml" "${dockerNamePrefix}_ebrelayera_1":/root/relayer.toml docker cp "./relayer.toml" "${dockerNamePrefix}_ebrelayera_1":/root/relayer.toml
...@@ -121,7 +120,7 @@ function StartDockerRelayerDeploy() { ...@@ -121,7 +120,7 @@ function StartDockerRelayerDeploy() {
# change EthProvider url # change EthProvider url
dockerAddr=$(get_docker_addr "${dockerNamePrefix}_ganachetest_1") dockerAddr=$(get_docker_addr "${dockerNamePrefix}_ganachetest_1")
# ethUrl="http://${dockerAddr}:8545" # ethUrl="http://${dockerAddr}:8545"
# 修改 relayer.toml 配置文件 # 修改 relayer.toml 配置文件
updata_relayer_a_toml "${dockerAddr}" "${dockerNamePrefix}_ebrelayera_1" "./relayer.toml" updata_relayer_a_toml "${dockerAddr}" "${dockerNamePrefix}_ebrelayera_1" "./relayer.toml"
...@@ -141,7 +140,7 @@ function StartDockerRelayerDeploy() { ...@@ -141,7 +140,7 @@ function StartDockerRelayerDeploy() {
# kill ebrelayer A # kill ebrelayer A
kill_docker_ebrelayer "${dockerNamePrefix}_ebrelayera_1" kill_docker_ebrelayer "${dockerNamePrefix}_ebrelayera_1"
sleep 1 sleep 1
# kill_ebrelayer ebrelayer # kill_ebrelayer ebrelayer
start_docker_ebrelayerA start_docker_ebrelayerA
result=$(${CLIA} unlock -p 123456hzj) result=$(${CLIA} unlock -p 123456hzj)
...@@ -167,7 +166,7 @@ function TestChain33ToEthAssets() { ...@@ -167,7 +166,7 @@ function TestChain33ToEthAssets() {
# 原来的地址金额 # 原来的地址金额
result=$(${Chain33Cli} account balance -a "${chain33DeployAddr}" -e evm) result=$(${Chain33Cli} account balance -a "${chain33DeployAddr}" -e evm)
# balance=$(cli_ret "${result}" "balance" ".balance") # balance=$(cli_ret "${result}" "balance" ".balance")
# chain33 lock bty # chain33 lock bty
hash=$(${Chain33Cli} send evm call -f 1 -a 5 -k "${chain33DeployAddr}" -e "${chain33BridgeBank}" -p "lock(${ethDeployAddr}, ${chain33BtyTokenAddr}, 500000000)") hash=$(${Chain33Cli} send evm call -f 1 -a 5 -k "${chain33DeployAddr}" -e "${chain33BridgeBank}" -p "lock(${ethDeployAddr}, ${chain33BtyTokenAddr}, 500000000)")
...@@ -175,7 +174,7 @@ function TestChain33ToEthAssets() { ...@@ -175,7 +174,7 @@ function TestChain33ToEthAssets() {
# 原来的地址金额 减少了 5 # 原来的地址金额 减少了 5
result=$(${Chain33Cli} account balance -a "${chain33DeployAddr}" -e evm) result=$(${Chain33Cli} account balance -a "${chain33DeployAddr}" -e evm)
# cli_ret "${result}" "balance" ".balance" "$(echo "${balance}-5" | bc)" # cli_ret "${result}" "balance" ".balance" "$(echo "${balance}-5" | bc)"
#balance_ret "${result}" "195.0000" #balance_ret "${result}" "195.0000"
# chain33BridgeBank 是否增加了 5 # chain33BridgeBank 是否增加了 5
...@@ -183,18 +182,18 @@ function TestChain33ToEthAssets() { ...@@ -183,18 +182,18 @@ function TestChain33ToEthAssets() {
balance_ret "${result}" "5.0000" balance_ret "${result}" "5.0000"
sleep 2 sleep 2
# eth_block_wait 2 "${ethUrl}" # eth_block_wait 2 "${ethUrl}"
# eth 这端 金额是否增加了 5 # eth 这端 金额是否增加了 5
result=$(${CLIA} ethereum balance -o "${ethDeployAddr}" -t "${ethereumBtyTokenAddr}") result=$(${CLIA} ethereum balance -o "${ethDeployAddr}" -t "${ethereumBtyTokenAddr}")
cli_ret "${result}" "balance" ".balance" "5" cli_ret "${result}" "balance" ".balance" "5"
# eth burn # eth burn
result=$(${CLIA} ethereum burn -m 3 -k "${ethDeployKey}" -r "${chain33ReceiverAddr}" -t "${ethereumBtyTokenAddr}" ) #--node_addr https://ropsten.infura.io/v3/9e83f296716142ffbaeaafc05790f26c) result=$(${CLIA} ethereum burn -m 3 -k "${ethDeployKey}" -r "${chain33ReceiverAddr}" -t "${ethereumBtyTokenAddr}") #--node_addr https://ropsten.infura.io/v3/9e83f296716142ffbaeaafc05790f26c)
cli_ret "${result}" "burn" cli_ret "${result}" "burn"
sleep 2 sleep 2
# eth_block_wait 2 "${ethUrl}" # eth_block_wait 2 "${ethUrl}"
# eth 这端 金额是否减少了 3 # eth 这端 金额是否减少了 3
result=$(${CLIA} ethereum balance -o "${ethDeployAddr}" -t "${ethereumBtyTokenAddr}") result=$(${CLIA} ethereum balance -o "${ethDeployAddr}" -t "${ethereumBtyTokenAddr}")
...@@ -217,7 +216,7 @@ function TestChain33ToEthAssets() { ...@@ -217,7 +216,7 @@ function TestChain33ToEthAssets() {
function TestETH2Chain33Assets() { function TestETH2Chain33Assets() {
echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}" echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}"
# 查询 ETH 这端 bridgeBank 地址原来是 0 # 查询 ETH 这端 bridgeBank 地址原来是 0
result=$(${CLIA} ethereum balance -o "${ethBridgeBank}" ) result=$(${CLIA} ethereum balance -o "${ethBridgeBank}")
cli_ret "${result}" "balance" ".balance" "0" cli_ret "${result}" "balance" ".balance" "0"
# ETH 这端 lock 11个 # ETH 这端 lock 11个
...@@ -226,10 +225,10 @@ function TestETH2Chain33Assets() { ...@@ -226,10 +225,10 @@ function TestETH2Chain33Assets() {
# eth 等待 10 个区块 # eth 等待 10 个区块
sleep 2 sleep 2
# eth_block_wait 2 "${ethUrl}" # eth_block_wait 2 "${ethUrl}"
# 查询 ETH 这端 bridgeBank 地址 11 # 查询 ETH 这端 bridgeBank 地址 11
result=$(${CLIA} ethereum balance -o "${ethBridgeBank}" ) result=$(${CLIA} ethereum balance -o "${ethBridgeBank}")
cli_ret "${result}" "balance" ".balance" "11" cli_ret "${result}" "balance" ".balance" "11"
sleep ${maturityDegree} sleep ${maturityDegree}
...@@ -254,7 +253,7 @@ function TestETH2Chain33Assets() { ...@@ -254,7 +253,7 @@ function TestETH2Chain33Assets() {
is_equal "${result}" "600000000" is_equal "${result}" "600000000"
# 查询 ETH 这端 bridgeBank 地址 0 # 查询 ETH 这端 bridgeBank 地址 0
result=$(${CLIA} ethereum balance -o "${ethBridgeBank}" ) result=$(${CLIA} ethereum balance -o "${ethBridgeBank}")
cli_ret "${result}" "balance" ".balance" "6" cli_ret "${result}" "balance" ".balance" "6"
# 比之前多 5 # 比之前多 5
...@@ -276,7 +275,7 @@ function TestETH2Chain33Ycc() { ...@@ -276,7 +275,7 @@ function TestETH2Chain33Ycc() {
# eth 等待 10 个区块 # eth 等待 10 个区块
sleep 2 sleep 2
# eth_block_wait 2 "${ethUrl}" # eth_block_wait 2 "${ethUrl}"
# 查询 ETH 这端 bridgeBank 地址 7 YCC # 查询 ETH 这端 bridgeBank 地址 7 YCC
result=$(${CLIA} ethereum balance -o "${ethBridgeBank}" -t "${ethereumYccTokenAddr}") result=$(${CLIA} ethereum balance -o "${ethBridgeBank}" -t "${ethereumYccTokenAddr}")
......
...@@ -31,7 +31,7 @@ source "./multisignPublicTest.sh" ...@@ -31,7 +31,7 @@ source "./multisignPublicTest.sh"
chain33ID=0 chain33ID=0
function mainTest() { function mainTest() {
if [[ $# -ge 1 && "${1}" != "" ]]; then if [[ $# -ge 1 && ${1} != "" ]]; then
# shellcheck disable=SC2034 # shellcheck disable=SC2034
chain33ID="${1}" chain33ID="${1}"
fi fi
......
...@@ -75,7 +75,7 @@ function loop_send_lock_bty() { ...@@ -75,7 +75,7 @@ function loop_send_lock_bty() {
hash=$(${Chain33Cli} send evm call -f 1 -a 1 -k "${chain33DeployAddr}" -e "${chain33BridgeBank}" -p "lock(${ethAddress[i]}, ${chain33BtyTokenAddr}, 100000000)" --chainID "${chain33ID}") hash=$(${Chain33Cli} send evm call -f 1 -a 1 -k "${chain33DeployAddr}" -e "${chain33BridgeBank}" -p "lock(${ethAddress[i]}, ${chain33BtyTokenAddr}, 100000000)" --chainID "${chain33ID}")
check_tx "${Chain33Cli}" "${hash}" check_tx "${Chain33Cli}" "${hash}"
i=$((i+1)) i=$((i + 1))
done done
eth_block_wait $((maturityDegree + 2)) eth_block_wait $((maturityDegree + 2))
...@@ -86,7 +86,7 @@ function loop_send_lock_bty() { ...@@ -86,7 +86,7 @@ function loop_send_lock_bty() {
res=$((nowEthBalance - preEthBalance[i])) res=$((nowEthBalance - preEthBalance[i]))
echo ${i} "preBalance" "${preEthBalance[i]}" "nowBalance" "${nowEthBalance}" "diff" ${res} echo ${i} "preBalance" "${preEthBalance[i]}" "nowBalance" "${nowEthBalance}" "diff" ${res}
check_number "${res}" 1 check_number "${res}" 1
i=$((i+1)) i=$((i + 1))
done done
nowChain33Balance=$(${Chain33Cli} account balance -a "${chain33DeployAddr}" -e evm | jq -r ".balance" | sed 's/\"//g') nowChain33Balance=$(${Chain33Cli} account balance -a "${chain33DeployAddr}" -e evm | jq -r ".balance" | sed 's/\"//g')
diff=$(echo "$preChain33Balance - $nowChain33Balance" | bc) diff=$(echo "$preChain33Balance - $nowChain33Balance" | bc)
...@@ -103,9 +103,9 @@ function loop_send_burn_bty() { ...@@ -103,9 +103,9 @@ function loop_send_burn_bty() {
i=0 i=0
while [[ i -lt ${#privateKeys[@]} ]]; do while [[ i -lt ${#privateKeys[@]} ]]; do
preEthBalance[$i]=$(${CLIA} ethereum balance -o "${ethAddress[i]}" -t "${ethereumBtyTokenAddr}" | jq -r ".balance") preEthBalance[$i]=$(${CLIA} ethereum balance -o "${ethAddress[i]}" -t "${ethereumBtyTokenAddr}" | jq -r ".balance")
result=$(${CLIA} ethereum burn -m 1 -k "${privateKeys[i]}" -r "${chain33ReceiverAddr}" -t "${ethereumBtyTokenAddr}" ) result=$(${CLIA} ethereum burn -m 1 -k "${privateKeys[i]}" -r "${chain33ReceiverAddr}" -t "${ethereumBtyTokenAddr}")
cli_ret "${result}" "burn" cli_ret "${result}" "burn"
i=$((i+1)) i=$((i + 1))
done done
eth_block_wait $((maturityDegree + 2)) eth_block_wait $((maturityDegree + 2))
...@@ -116,7 +116,7 @@ function loop_send_burn_bty() { ...@@ -116,7 +116,7 @@ function loop_send_burn_bty() {
res=$((preEthBalance[i] - nowEthBalance)) res=$((preEthBalance[i] - nowEthBalance))
echo ${i} "preBalance" "${preEthBalance[i]}" "nowBalance" "${nowEthBalance}" "diff" ${res} echo ${i} "preBalance" "${preEthBalance[i]}" "nowBalance" "${nowEthBalance}" "diff" ${res}
check_number "${res}" 1 check_number "${res}" 1
i=$((i+1)) i=$((i + 1))
done done
nowChain33Balance=$(${Chain33Cli} account balance -a "${chain33ReceiverAddr}" -e evm | jq -r ".balance" | sed 's/\"//g') nowChain33Balance=$(${Chain33Cli} account balance -a "${chain33ReceiverAddr}" -e evm | jq -r ".balance" | sed 's/\"//g')
diff=$(echo "$nowChain33Balance - $preChain33Balance" | bc) diff=$(echo "$nowChain33Balance - $preChain33Balance" | bc)
...@@ -135,7 +135,7 @@ function loop_send_lock_eth() { ...@@ -135,7 +135,7 @@ function loop_send_lock_eth() {
preEthBalance[$i]=$(${CLIA} ethereum balance -o "${ethAddress[i]}" | jq -r ".balance") preEthBalance[$i]=$(${CLIA} ethereum balance -o "${ethAddress[i]}" | jq -r ".balance")
result=$(${CLIA} ethereum lock -m 1 -k "${privateKeys[i]}" -r "${chain33ReceiverAddr}") result=$(${CLIA} ethereum lock -m 1 -k "${privateKeys[i]}" -r "${chain33ReceiverAddr}")
cli_ret "${result}" "lock" cli_ret "${result}" "lock"
i=$((i+1)) i=$((i + 1))
done done
eth_block_wait $((maturityDegree + 2)) eth_block_wait $((maturityDegree + 2))
...@@ -145,12 +145,12 @@ function loop_send_lock_eth() { ...@@ -145,12 +145,12 @@ function loop_send_lock_eth() {
nowEthBalance=$(${CLIA} ethereum balance -o "${ethAddress[i]}" | jq -r ".balance") nowEthBalance=$(${CLIA} ethereum balance -o "${ethAddress[i]}" | jq -r ".balance")
res=$(echo "${preEthBalance[i]} - $nowEthBalance" | bc) res=$(echo "${preEthBalance[i]} - $nowEthBalance" | bc)
echo ${i} "preBalance" "${preEthBalance[i]}" "nowBalance" "${nowEthBalance}" "diff" "${res}" echo ${i} "preBalance" "${preEthBalance[i]}" "nowBalance" "${nowEthBalance}" "diff" "${res}"
diff=$(echo "$res >= 1"| bc) # 浮点数比较 判断是否大于1 大于返回1 小于返回0 diff=$(echo "$res >= 1" | bc) # 浮点数比较 判断是否大于1 大于返回1 小于返回0
if [ "${diff}" -ne 1 ]; then if [ "${diff}" -ne 1 ]; then
echo -e "${RED}error number, expect greater than 1, get ${res}${NOC}" echo -e "${RED}error number, expect greater than 1, get ${res}${NOC}"
exit 1 exit 1
fi fi
i=$((i+1)) i=$((i + 1))
done done
nowChain33Balance=$(${Chain33Cli} evm query -a "${chain33EthTokenAddr}" -c "${chain33DeployAddr}" -b "balanceOf(${chain33ReceiverAddr})") nowChain33Balance=$(${Chain33Cli} evm query -a "${chain33EthTokenAddr}" -c "${chain33DeployAddr}" -b "balanceOf(${chain33ReceiverAddr})")
diff=$(echo "$nowChain33Balance - $preChain33Balance" | bc) diff=$(echo "$nowChain33Balance - $preChain33Balance" | bc)
...@@ -170,7 +170,7 @@ function loop_send_burn_eth() { ...@@ -170,7 +170,7 @@ function loop_send_burn_eth() {
preEthBalance[$i]=$(${CLIA} ethereum balance -o "${ethAddress[i]}" | jq -r ".balance") preEthBalance[$i]=$(${CLIA} ethereum balance -o "${ethAddress[i]}" | jq -r ".balance")
ethTxHash=$(${CLIA} chain33 burn -m 1 -k "${chain33ReceiverAddrKey}" -r "${ethAddress[i]}" -t "${chain33EthTokenAddr}" | jq -r ".msg") ethTxHash=$(${CLIA} chain33 burn -m 1 -k "${chain33ReceiverAddrKey}" -r "${ethAddress[i]}" -t "${chain33EthTokenAddr}" | jq -r ".msg")
echo ${i} "burn chain33 tx hash:" "${ethTxHash}" echo ${i} "burn chain33 tx hash:" "${ethTxHash}"
i=$((i+1)) i=$((i + 1))
done done
eth_block_wait $((maturityDegree + 2)) eth_block_wait $((maturityDegree + 2))
...@@ -180,12 +180,12 @@ function loop_send_burn_eth() { ...@@ -180,12 +180,12 @@ function loop_send_burn_eth() {
nowEthBalance=$(${CLIA} ethereum balance -o "${ethAddress[i]}" | jq -r ".balance") nowEthBalance=$(${CLIA} ethereum balance -o "${ethAddress[i]}" | jq -r ".balance")
res=$(echo "$nowEthBalance - ${preEthBalance[i]}" | bc) res=$(echo "$nowEthBalance - ${preEthBalance[i]}" | bc)
echo ${i} "preBalance" "${preEthBalance[i]}" "nowBalance" "${nowEthBalance}" "diff" "${res}" echo ${i} "preBalance" "${preEthBalance[i]}" "nowBalance" "${nowEthBalance}" "diff" "${res}"
diff=$(echo "$res >= 1"| bc) # 浮点数比较 判断是否大于1 大于返回1 小于返回0 diff=$(echo "$res >= 1" | bc) # 浮点数比较 判断是否大于1 大于返回1 小于返回0
if [ "${diff}" -ne 1 ]; then if [ "${diff}" -ne 1 ]; then
echo -e "${RED}error number, expect greater than 1, get ${res}${NOC}" echo -e "${RED}error number, expect greater than 1, get ${res}${NOC}"
exit 1 exit 1
fi fi
i=$((i+1)) i=$((i + 1))
done done
nowChain33Balance=$(${Chain33Cli} evm query -a "${chain33EthTokenAddr}" -c "${chain33DeployAddr}" -b "balanceOf(${chain33ReceiverAddr})") nowChain33Balance=$(${Chain33Cli} evm query -a "${chain33EthTokenAddr}" -c "${chain33DeployAddr}" -b "balanceOf(${chain33ReceiverAddr})")
diff=$(echo "$preChain33Balance - $nowChain33Balance" | bc) diff=$(echo "$preChain33Balance - $nowChain33Balance" | bc)
...@@ -205,7 +205,7 @@ function loop_send_lock_ycc() { ...@@ -205,7 +205,7 @@ function loop_send_lock_ycc() {
while [[ i -lt ${#privateKeys[@]} ]]; do while [[ i -lt ${#privateKeys[@]} ]]; do
ethTxHash=$(${CLIA} ethereum transfer -m 10 -k "${ethDeployKey}" -r "${ethAddress[i]}" -t "${ethereumYccTokenAddr}" | jq -r ".msg") ethTxHash=$(${CLIA} ethereum transfer -m 10 -k "${ethDeployKey}" -r "${ethAddress[i]}" -t "${ethereumYccTokenAddr}" | jq -r ".msg")
echo ${i} "burn chain33 tx hash:" "${ethTxHash}" echo ${i} "burn chain33 tx hash:" "${ethTxHash}"
i=$((i+1)) i=$((i + 1))
done done
sleep 2 sleep 2
...@@ -215,7 +215,7 @@ function loop_send_lock_ycc() { ...@@ -215,7 +215,7 @@ function loop_send_lock_ycc() {
preEthBalance[i]=$(${CLIA} ethereum balance -o "${ethAddress[i]}" -t "${ethereumYccTokenAddr}" | jq -r ".balance") preEthBalance[i]=$(${CLIA} ethereum balance -o "${ethAddress[i]}" -t "${ethereumYccTokenAddr}" | jq -r ".balance")
ethTxHash=$(${CLIA} ethereum lock -m 1 -k "${privateKeys[i]}" -r "${chain33ReceiverAddr}" -t "${ethereumYccTokenAddr}" | jq -r ".msg") ethTxHash=$(${CLIA} ethereum lock -m 1 -k "${privateKeys[i]}" -r "${chain33ReceiverAddr}" -t "${ethereumYccTokenAddr}" | jq -r ".msg")
echo ${i} "lock ycc tx hash:" "${ethTxHash}" echo ${i} "lock ycc tx hash:" "${ethTxHash}"
i=$((i+1)) i=$((i + 1))
done done
eth_block_wait $((maturityDegree + 2)) eth_block_wait $((maturityDegree + 2))
...@@ -225,7 +225,7 @@ function loop_send_lock_ycc() { ...@@ -225,7 +225,7 @@ function loop_send_lock_ycc() {
res=$(echo "${preEthBalance[i]} - $nowEthBalance" | bc) res=$(echo "${preEthBalance[i]} - $nowEthBalance" | bc)
echo ${i} "preBalance" "${preEthBalance[i]}" "nowBalance" "${nowEthBalance}" "diff" "${res}" echo ${i} "preBalance" "${preEthBalance[i]}" "nowBalance" "${nowEthBalance}" "diff" "${res}"
check_number "${res}" 1 check_number "${res}" 1
i=$((i+1)) i=$((i + 1))
done done
nowChain33Balance=$(${Chain33Cli} evm query -a "${chain33YccTokenAddr}" -c "${chain33DeployAddr}" -b "balanceOf(${chain33ReceiverAddr})") nowChain33Balance=$(${Chain33Cli} evm query -a "${chain33YccTokenAddr}" -c "${chain33DeployAddr}" -b "balanceOf(${chain33ReceiverAddr})")
...@@ -246,7 +246,7 @@ function loop_send_burn_ycc() { ...@@ -246,7 +246,7 @@ function loop_send_burn_ycc() {
preEthBalance[i]=$(${CLIA} ethereum balance -o "${ethAddress[i]}" -t "${ethereumYccTokenAddr}" | jq -r ".balance") preEthBalance[i]=$(${CLIA} ethereum balance -o "${ethAddress[i]}" -t "${ethereumYccTokenAddr}" | jq -r ".balance")
ethTxHash=$(${CLIA} chain33 burn -m 1 -k "${chain33ReceiverAddrKey}" -r "${ethAddress[i]}" -t "${chain33YccTokenAddr}" | jq -r ".msg") ethTxHash=$(${CLIA} chain33 burn -m 1 -k "${chain33ReceiverAddrKey}" -r "${ethAddress[i]}" -t "${chain33YccTokenAddr}" | jq -r ".msg")
echo ${i} "burn chain33 tx hash:" "${ethTxHash}" echo ${i} "burn chain33 tx hash:" "${ethTxHash}"
i=$((i+1)) i=$((i + 1))
done done
eth_block_wait $((maturityDegree + 2)) eth_block_wait $((maturityDegree + 2))
...@@ -257,7 +257,7 @@ function loop_send_burn_ycc() { ...@@ -257,7 +257,7 @@ function loop_send_burn_ycc() {
res=$((nowEthBalance - preEthBalance[i])) res=$((nowEthBalance - preEthBalance[i]))
echo ${i} "preBalance" "${preEthBalance[i]}" "nowBalance" "${nowEthBalance}" "diff" ${res} echo ${i} "preBalance" "${preEthBalance[i]}" "nowBalance" "${nowEthBalance}" "diff" ${res}
check_number "${res}" 1 check_number "${res}" 1
i=$((i+1)) i=$((i + 1))
done done
nowChain33Balance=$(${Chain33Cli} evm query -a "${chain33YccTokenAddr}" -c "${chain33DeployAddr}" -b "balanceOf(${chain33ReceiverAddr})") nowChain33Balance=$(${Chain33Cli} evm query -a "${chain33YccTokenAddr}" -c "${chain33DeployAddr}" -b "balanceOf(${chain33ReceiverAddr})")
diff=$(echo "$preChain33Balance - $nowChain33Balance" | bc) diff=$(echo "$preChain33Balance - $nowChain33Balance" | bc)
......
...@@ -28,4 +28,3 @@ function mainTest() { ...@@ -28,4 +28,3 @@ function mainTest() {
} }
mainTest "${1}" mainTest "${1}"
...@@ -289,30 +289,29 @@ function query_tx() { ...@@ -289,30 +289,29 @@ function query_tx() {
if [[ ${ty} != 2 ]]; then if [[ ${ty} != 2 ]]; then
echo -e "${RED}check tx error, hash is ${2}${NOC}" echo -e "${RED}check tx error, hash is ${2}${NOC}"
exit 1 exit 1
# exit_cp_file # exit_cp_file
fi fi
# block_wait "${1}" 1 # block_wait "${1}" 1
# #
# local times=200 # local times=200
# while true; do # while true; do
# ret=$(${1} tx query -s "${2}" | jq -r ".tx.hash") # ret=$(${1} tx query -s "${2}" | jq -r ".tx.hash")
# echo "query hash is ${2}, return ${ret} " # echo "query hash is ${2}, return ${ret} "
# if [ "${ret}" != "${2}" ]; then # if [ "${ret}" != "${2}" ]; then
# block_wait "${1}" 1 # block_wait "${1}" 1
# times=$((times - 1)) # times=$((times - 1))
# if [ $times -le 0 ]; then # if [ $times -le 0 ]; then
# echo "query tx=$2 failed" # echo "query tx=$2 failed"
# exit 1 # exit 1
# fi # fi
# else # else
# echo "query tx=$2 success" # echo "query tx=$2 success"
# break # break
# fi # fi
# done # done
} }
function para_cross_transfer_from_parachain() { function para_cross_transfer_from_parachain() {
echo "=========== # para cross transfer from parachain test =============" echo "=========== # para cross transfer from parachain test ============="
...@@ -420,10 +419,10 @@ function para_create_nodegroup() { ...@@ -420,10 +419,10 @@ function para_create_nodegroup() {
id=$txhash id=$txhash
balance=$(${CLI} account balance -a 1KSBd17H7ZK8iT37aJztFB22XGwsPTdwE4 -e paracross | jq -r ".frozen") balance=$(${CLI} account balance -a 1KSBd17H7ZK8iT37aJztFB22XGwsPTdwE4 -e paracross | jq -r ".frozen")
# if [ "$balance" != "30.0000" ]; then # if [ "$balance" != "30.0000" ]; then
# echo "apply coinfrozen error balance=$balance" # echo "apply coinfrozen error balance=$balance"
## exit 1 ## exit 1
# fi # fi
echo "=========== # para chain approve node group =============" echo "=========== # para chain approve node group ============="
##approve ##approve
......
...@@ -32,7 +32,7 @@ chain33ID=0 ...@@ -32,7 +32,7 @@ chain33ID=0
function set_offline_token_Bty() { function set_offline_token_Bty() {
echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}" echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}"
echo -e "${GRE}===== chain33 端 configLockedTokenOfflineSave BTY ======${NOC}" echo -e "${GRE}===== chain33 端 configLockedTokenOfflineSave BTY ======${NOC}"
# echo '2:#配置自动转离线钱包(bty, 1000, 50%)' # echo '2:#配置自动转离线钱包(bty, 1000, 50%)'
hash=$(${Chain33Cli} send evm call -f 1 -k "${chain33DeployAddr}" -e "${chain33BridgeBank}" -p "configLockedTokenOfflineSave(${chain33BtyTokenAddr},BTY,100000000000,50)" --khainID "${chain33ID}") hash=$(${Chain33Cli} send evm call -f 1 -k "${chain33DeployAddr}" -e "${chain33BridgeBank}" -p "configLockedTokenOfflineSave(${chain33BtyTokenAddr},BTY,100000000000,50)" --khainID "${chain33ID}")
check_tx "${Chain33Cli}" "${hash}" check_tx "${Chain33Cli}" "${hash}"
...@@ -86,7 +86,7 @@ function set_offline_token_Chain33Ycc() { ...@@ -86,7 +86,7 @@ function set_offline_token_Chain33Ycc() {
echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}" echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}"
echo -e "${GRE}===== chain33 端 configLockedTokenOfflineSave ERC20 YCC ======${NOC}" echo -e "${GRE}===== chain33 端 configLockedTokenOfflineSave ERC20 YCC ======${NOC}"
# echo '2:#配置自动转离线钱包(YCC, 100, 60%)' # echo '2:#配置自动转离线钱包(YCC, 100, 60%)'
hash=$(${Chain33Cli} send evm call -f 1 -k "${chain33DeployAddr}" -e "${chain33BridgeBank}" -p "configLockedTokenOfflineSave(${chain33YccErc20Addr},YCC,10000000000,60)" --chainID "${chain33ID}") hash=$(${Chain33Cli} send evm call -f 1 -k "${chain33DeployAddr}" -e "${chain33BridgeBank}" -p "configLockedTokenOfflineSave(${chain33YccErc20Addr},YCC,10000000000,60)" --chainID "${chain33ID}")
check_tx "${Chain33Cli}" "${hash}" check_tx "${Chain33Cli}" "${hash}"
...@@ -123,7 +123,7 @@ function transfer_multisign_Chain33Ycc_test() { ...@@ -123,7 +123,7 @@ function transfer_multisign_Chain33Ycc_test() {
is_equal "${result}" "30300000000" is_equal "${result}" "30300000000"
# 判断 ETH 这端是否金额一致 # 判断 ETH 这端是否金额一致
result=$(${CLIA} ethereum balance -o "${ethDeployAddr}" -t "${ethBridgeToeknYccAddr}" ) result=$(${CLIA} ethereum balance -o "${ethDeployAddr}" -t "${ethBridgeToeknYccAddr}")
cli_ret "${result}" "balance" ".balance" "370" cli_ret "${result}" "balance" ".balance" "370"
echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}" echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}"
...@@ -150,9 +150,9 @@ function set_offline_token_Eth() { ...@@ -150,9 +150,9 @@ function set_offline_token_Eth() {
function lock_multisign_Eth_test() { function lock_multisign_Eth_test() {
echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}" echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}"
result=$(${CLIA} ethereum balance -o "${ethBridgeBank}" ) result=$(${CLIA} ethereum balance -o "${ethBridgeBank}")
cli_ret "${result}" "balance" ".balance" "0" cli_ret "${result}" "balance" ".balance" "0"
result=$(${CLIA} ethereum balance -o "${multisignEthAddr}" ) result=$(${CLIA} ethereum balance -o "${multisignEthAddr}")
cli_ret "${result}" "balance" ".balance" "0" cli_ret "${result}" "balance" ".balance" "0"
lock_eth_multisign 19 19 0 lock_eth_multisign 19 19 0
......
...@@ -265,7 +265,7 @@ function offline_transfer_multisign_Eth_test() { ...@@ -265,7 +265,7 @@ function offline_transfer_multisign_Eth_test() {
echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}" echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}"
# transfer # transfer
# shellcheck disable=SC2154 # shellcheck disable=SC2154
# ${CLIA} ethereum multisign transfer -a 3 -r "${ethBridgeBank}" -o "${ethValidatorAddrKeyB}" -k "${ethMultisignKeyA},${ethMultisignKeyB},${ethMultisignKeyC},${ethMultisignKeyD}" # ${CLIA} ethereum multisign transfer -a 3 -r "${ethBridgeBank}" -o "${ethValidatorAddrKeyB}" -k "${ethMultisignKeyA},${ethMultisignKeyB},${ethMultisignKeyC},${ethMultisignKeyD}"
${Boss4xCLI} ethereum offline multisign_transfer_prepare -a 3 -r "${ethBridgeBank}" -c "${multisignEthAddr}" -d "${ethValidatorAddrB}" ${Boss4xCLI} ethereum offline multisign_transfer_prepare -a 3 -r "${ethBridgeBank}" -c "${multisignEthAddr}" -d "${ethValidatorAddrB}"
# shellcheck disable=SC2154 # shellcheck disable=SC2154
${Boss4xCLI} ethereum offline sign_multisign_tx -k "${ethMultisignKeyA},${ethMultisignKeyB},${ethMultisignKeyC},${ethMultisignKeyD}" ${Boss4xCLI} ethereum offline sign_multisign_tx -k "${ethMultisignKeyA},${ethMultisignKeyB},${ethMultisignKeyC},${ethMultisignKeyD}"
...@@ -281,7 +281,7 @@ function offline_transfer_multisign_Eth_test() { ...@@ -281,7 +281,7 @@ function offline_transfer_multisign_Eth_test() {
# transfer # transfer
# shellcheck disable=SC2154 # shellcheck disable=SC2154
# ${CLIA} ethereum multisign transfer -a 5 -r "${ethMultisignA}" -o "${ethValidatorAddrKeyB}" -k "${ethMultisignKeyA},${ethMultisignKeyB},${ethMultisignKeyC},${ethMultisignKeyD}" # ${CLIA} ethereum multisign transfer -a 5 -r "${ethMultisignA}" -o "${ethValidatorAddrKeyB}" -k "${ethMultisignKeyA},${ethMultisignKeyB},${ethMultisignKeyC},${ethMultisignKeyD}"
${Boss4xCLI} ethereum offline multisign_transfer_prepare -a 5 -r "${ethMultisignA}" -c "${multisignEthAddr}" -d "${ethValidatorAddrB}" ${Boss4xCLI} ethereum offline multisign_transfer_prepare -a 5 -r "${ethMultisignA}" -c "${multisignEthAddr}" -d "${ethValidatorAddrB}"
${Boss4xCLI} ethereum offline sign_multisign_tx -k "${ethMultisignKeyA},${ethMultisignKeyB},${ethMultisignKeyC},${ethMultisignKeyD}" ${Boss4xCLI} ethereum offline sign_multisign_tx -k "${ethMultisignKeyA},${ethMultisignKeyB},${ethMultisignKeyC},${ethMultisignKeyD}"
${Boss4xCLI} ethereum offline create_multisign_tx ${Boss4xCLI} ethereum offline create_multisign_tx
...@@ -311,7 +311,7 @@ function offline_transfer_multisign_EthYcc() { ...@@ -311,7 +311,7 @@ function offline_transfer_multisign_EthYcc() {
cli_ret "${result}" "balance" ".balance" "80" cli_ret "${result}" "balance" ".balance" "80"
# transfer # transfer
# ${CLIA} ethereum multisign transfer -a 10 -r "${ethMultisignA}" -o "${ethValidatorAddrKeyB}" -t "${ethereumYccTokenAddr}" -k "${ethMultisignKeyA},${ethMultisignKeyB},${ethMultisignKeyC},${ethMultisignKeyD}" # ${CLIA} ethereum multisign transfer -a 10 -r "${ethMultisignA}" -o "${ethValidatorAddrKeyB}" -t "${ethereumYccTokenAddr}" -k "${ethMultisignKeyA},${ethMultisignKeyB},${ethMultisignKeyC},${ethMultisignKeyD}"
${Boss4xCLI} ethereum offline multisign_transfer_prepare -a 10 -r "${ethMultisignA}" -c "${multisignEthAddr}" -d "${ethValidatorAddrB}" -t "${ethereumYccTokenAddr}" ${Boss4xCLI} ethereum offline multisign_transfer_prepare -a 10 -r "${ethMultisignA}" -c "${multisignEthAddr}" -d "${ethValidatorAddrB}" -t "${ethereumYccTokenAddr}"
${Boss4xCLI} ethereum offline sign_multisign_tx -k "${ethMultisignKeyA},${ethMultisignKeyB},${ethMultisignKeyC},${ethMultisignKeyD}" ${Boss4xCLI} ethereum offline sign_multisign_tx -k "${ethMultisignKeyA},${ethMultisignKeyB},${ethMultisignKeyC},${ethMultisignKeyD}"
${Boss4xCLI} ethereum offline create_multisign_tx ${Boss4xCLI} ethereum offline create_multisign_tx
...@@ -328,7 +328,7 @@ function offline_transfer_multisign_EthYcc() { ...@@ -328,7 +328,7 @@ function offline_transfer_multisign_EthYcc() {
function offline_set_offline_token_Chain33Ycc() { function offline_set_offline_token_Chain33Ycc() {
echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}" echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}"
echo -e "${GRE}===== chain33 端 configLockedTokenOfflineSave ERC20 YCC ======${NOC}" echo -e "${GRE}===== chain33 端 configLockedTokenOfflineSave ERC20 YCC ======${NOC}"
# echo '2:#配置自动转离线钱包(YCC, 100, 60%)' # echo '2:#配置自动转离线钱包(YCC, 100, 60%)'
${Boss4xCLI} chain33 offline set_offline_token -c "${chain33BridgeBank}" -t "${chain33YccErc20Addr}" -s YCC -m 10000000000 -p 60 -k "${chain33DeployKey}" --chainID "${chain33ID}" ${Boss4xCLI} chain33 offline set_offline_token -c "${chain33BridgeBank}" -t "${chain33YccErc20Addr}" -s YCC -m 10000000000 -p 60 -k "${chain33DeployKey}" --chainID "${chain33ID}"
chain33_offline_send "chain33_set_offline_token.txt" chain33_offline_send "chain33_set_offline_token.txt"
...@@ -338,7 +338,7 @@ function offline_set_offline_token_Chain33Ycc() { ...@@ -338,7 +338,7 @@ function offline_set_offline_token_Chain33Ycc() {
function offline_transfer_multisign_Chain33Ycc_test() { function offline_transfer_multisign_Chain33Ycc_test() {
echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}" echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}"
# transfer test # transfer test
# hash=$(${CLIA} chain33 multisign transfer -a 10 -r "${chain33BridgeBank}" -t "${chain33YccErc20Addr}" -k "${chain33MultisignKeyA},${chain33MultisignKeyB},${chain33MultisignKeyC},${chain33MultisignKeyD}" | jq -r ".msg") # hash=$(${CLIA} chain33 multisign transfer -a 10 -r "${chain33BridgeBank}" -t "${chain33YccErc20Addr}" -k "${chain33MultisignKeyA},${chain33MultisignKeyB},${chain33MultisignKeyC},${chain33MultisignKeyD}" | jq -r ".msg")
${Boss4xCLI} chain33 offline create_multisign_transfer -a 10 -r "${chain33BridgeBank}" -m "${multisignChain33Addr}" -t "${chain33YccErc20Addr}" ${Boss4xCLI} chain33 offline create_multisign_transfer -a 10 -r "${chain33BridgeBank}" -m "${multisignChain33Addr}" -t "${chain33YccErc20Addr}"
# shellcheck disable=SC2154 # shellcheck disable=SC2154
${Boss4xCLI} chain33 offline multisign_transfer -k "${chain33DeployKey}" -s "${chain33MultisignKeyA},${chain33MultisignKeyB},${chain33MultisignKeyC},${chain33MultisignKeyD}" --chainID "${chain33ID}" ${Boss4xCLI} chain33 offline multisign_transfer -k "${chain33DeployKey}" -s "${chain33MultisignKeyA},${chain33MultisignKeyB},${chain33MultisignKeyC},${chain33MultisignKeyD}" --chainID "${chain33ID}"
...@@ -349,7 +349,7 @@ function offline_transfer_multisign_Chain33Ycc_test() { ...@@ -349,7 +349,7 @@ function offline_transfer_multisign_Chain33Ycc_test() {
result=$(${Chain33Cli} evm query -a "${chain33YccErc20Addr}" -c "${multisignChain33Addr}" -b "balanceOf(${multisignChain33Addr})") result=$(${Chain33Cli} evm query -a "${chain33YccErc20Addr}" -c "${multisignChain33Addr}" -b "balanceOf(${multisignChain33Addr})")
is_equal "${result}" "30800000000" is_equal "${result}" "30800000000"
# hash=$(${CLIA} chain33 multisign transfer -a 5 -r "${chain33MultisignA}" -t "${chain33YccErc20Addr}" -k "${chain33MultisignKeyA},${chain33MultisignKeyB},${chain33MultisignKeyC},${chain33MultisignKeyD}" | jq -r ".msg") # hash=$(${CLIA} chain33 multisign transfer -a 5 -r "${chain33MultisignA}" -t "${chain33YccErc20Addr}" -k "${chain33MultisignKeyA},${chain33MultisignKeyB},${chain33MultisignKeyC},${chain33MultisignKeyD}" | jq -r ".msg")
${Boss4xCLI} chain33 offline create_multisign_transfer -a 5 -r "${chain33MultisignA}" -m "${multisignChain33Addr}" -t "${chain33YccErc20Addr}" ${Boss4xCLI} chain33 offline create_multisign_transfer -a 5 -r "${chain33MultisignA}" -m "${multisignChain33Addr}" -t "${chain33YccErc20Addr}"
# shellcheck disable=SC2154 # shellcheck disable=SC2154
${Boss4xCLI} chain33 offline multisign_transfer -k "${chain33DeployKey}" -s "${chain33MultisignKeyA},${chain33MultisignKeyB},${chain33MultisignKeyC},${chain33MultisignKeyD}" --chainID "${chain33ID}" ${Boss4xCLI} chain33 offline multisign_transfer -k "${chain33DeployKey}" -s "${chain33MultisignKeyA},${chain33MultisignKeyB},${chain33MultisignKeyC},${chain33MultisignKeyD}" --chainID "${chain33ID}"
...@@ -361,7 +361,7 @@ function offline_transfer_multisign_Chain33Ycc_test() { ...@@ -361,7 +361,7 @@ function offline_transfer_multisign_Chain33Ycc_test() {
is_equal "${result}" "30300000000" is_equal "${result}" "30300000000"
# 判断 ETH 这端是否金额一致 # 判断 ETH 这端是否金额一致
result=$(${CLIA} ethereum balance -o "${ethDeployAddr}" -t "${ethBridgeToeknYccAddr}" ) result=$(${CLIA} ethereum balance -o "${ethDeployAddr}" -t "${ethBridgeToeknYccAddr}")
cli_ret "${result}" "balance" ".balance" "370" cli_ret "${result}" "balance" ".balance" "370"
echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}" echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}"
......
...@@ -570,7 +570,7 @@ function is_equal() { ...@@ -570,7 +570,7 @@ function is_equal() {
exit_cp_file exit_cp_file
fi fi
if [[ "$1" != "$2" ]]; then if [[ $1 != "$2" ]]; then
echo -e "${RED}$1 != ${2}${NOC}" echo -e "${RED}$1 != ${2}${NOC}"
exit_cp_file exit_cp_file
fi fi
......
...@@ -17,7 +17,7 @@ function cross2eth() { ...@@ -17,7 +17,7 @@ function cross2eth() {
set -x set -x
para_create_nodegroup para_create_nodegroup
AllRelayerMainTest 10 AllRelayerMainTest 10
# perf_test_main 1 # perf_test_main 1
echo "========================== cross2eth test end ==========================" echo "========================== cross2eth test end =========================="
fi fi
} }
...@@ -4,11 +4,12 @@ import ( ...@@ -4,11 +4,12 @@ import (
"context" "context"
"errors" "errors"
"fmt" "fmt"
"github.com/33cn/plugin/plugin/dapp/cross2eth/ebrelayer/utils"
"math/big" "math/big"
"testing" "testing"
"time" "time"
"github.com/33cn/plugin/plugin/dapp/cross2eth/ebrelayer/utils"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/33cn/plugin/plugin/dapp/cross2eth/contracts/contracts4eth/generated" "github.com/33cn/plugin/plugin/dapp/cross2eth/contracts/contracts4eth/generated"
......
...@@ -5,8 +5,9 @@ package types ...@@ -5,8 +5,9 @@ package types
import ( import (
fmt "fmt" fmt "fmt"
proto "github.com/golang/protobuf/proto"
math "math" math "math"
proto "github.com/golang/protobuf/proto"
) )
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
......
...@@ -5,8 +5,9 @@ package types ...@@ -5,8 +5,9 @@ package types
import ( import (
fmt "fmt" fmt "fmt"
proto "github.com/golang/protobuf/proto"
math "math" math "math"
proto "github.com/golang/protobuf/proto"
) )
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
......
...@@ -2,6 +2,7 @@ package ethereum ...@@ -2,6 +2,7 @@ package ethereum
import ( import (
"fmt" "fmt"
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )
......
...@@ -4,12 +4,13 @@ import ( ...@@ -4,12 +4,13 @@ import (
"context" "context"
"crypto/ecdsa" "crypto/ecdsa"
"fmt" "fmt"
"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/pancakeRouter"
"math/big" "math/big"
"strings" "strings"
"time" "time"
"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/pancakeRouter"
"github.com/ethereum/go-ethereum" "github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
......
...@@ -4,6 +4,9 @@ import ( ...@@ -4,6 +4,9 @@ import (
"context" "context"
"crypto/ecdsa" "crypto/ecdsa"
"fmt" "fmt"
"math/big"
"strings"
"github.com/33cn/plugin/plugin/dapp/cross2eth/contracts/erc20/generated" "github.com/33cn/plugin/plugin/dapp/cross2eth/contracts/erc20/generated"
"github.com/33cn/plugin/plugin/dapp/cross2eth/ebrelayer/utils" "github.com/33cn/plugin/plugin/dapp/cross2eth/ebrelayer/utils"
"github.com/33cn/plugin/plugin/dapp/dex/boss/deploy/ethereum/offline" "github.com/33cn/plugin/plugin/dapp/dex/boss/deploy/ethereum/offline"
...@@ -13,8 +16,6 @@ import ( ...@@ -13,8 +16,6 @@ import (
"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"
"math/big"
"strings"
) )
func EthCmd() *cobra.Command { func EthCmd() *cobra.Command {
......
...@@ -3,14 +3,15 @@ package ethereum ...@@ -3,14 +3,15 @@ package ethereum
import ( import (
"context" "context"
"fmt" "fmt"
"math/big"
"time"
"github.com/33cn/plugin/plugin/dapp/dex/contracts/pancake-farm/src/cakeToken" "github.com/33cn/plugin/plugin/dapp/dex/contracts/pancake-farm/src/cakeToken"
"github.com/33cn/plugin/plugin/dapp/dex/contracts/pancake-farm/src/masterChef" "github.com/33cn/plugin/plugin/dapp/dex/contracts/pancake-farm/src/masterChef"
"github.com/33cn/plugin/plugin/dapp/dex/contracts/pancake-farm/src/syrupBar" "github.com/33cn/plugin/plugin/dapp/dex/contracts/pancake-farm/src/syrupBar"
"github.com/ethereum/go-ethereum" "github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"math/big"
"time"
) )
func GetCakeBalance(owner string, pid int64) (string, error) { func GetCakeBalance(owner string, pid int64) (string, error) {
......
...@@ -2,14 +2,15 @@ package offline ...@@ -2,14 +2,15 @@ package offline
import ( import (
"crypto/ecdsa" "crypto/ecdsa"
"math/big"
"strings"
"github.com/33cn/plugin/plugin/dapp/dex/contracts/pancake-farm/src/cakeToken" "github.com/33cn/plugin/plugin/dapp/dex/contracts/pancake-farm/src/cakeToken"
"github.com/33cn/plugin/plugin/dapp/dex/contracts/pancake-farm/src/masterChef" "github.com/33cn/plugin/plugin/dapp/dex/contracts/pancake-farm/src/masterChef"
"github.com/33cn/plugin/plugin/dapp/dex/contracts/pancake-farm/src/syrupBar" "github.com/33cn/plugin/plugin/dapp/dex/contracts/pancake-farm/src/syrupBar"
"github.com/ethereum/go-ethereum/accounts/abi" "github.com/ethereum/go-ethereum/accounts/abi"
"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"
"math/big"
"strings"
) )
type SignCakeToken struct { type SignCakeToken struct {
......
syntax = "proto3"; syntax = "proto3";
package types; package types;
option go_package = "../types";
// CandidatorInfo 候选节点信息 // CandidatorInfo 候选节点信息
message CandidatorInfo { message CandidatorInfo {
......
This source diff could not be displayed because it is too large. You can view the blob instead.
syntax = "proto3"; syntax = "proto3";
package echo; package echo;
option go_package = "../types";
// ping操作action // ping操作action
message Ping { message Ping {
......
...@@ -118,11 +118,7 @@ func (ca *ContractAccount) updateStorageHash() { ...@@ -118,11 +118,7 @@ func (ca *ContractAccount) updateStorageHash() {
for k, v := range ca.State.GetStorage() { for k, v := range ca.State.GetStorage() {
state.Storage[k] = v state.Storage[k] = v
} }
ret, err := proto.Marshal(state) ret := types.Encode(state)
if err != nil {
log15.Error("marshal contract state data error", "error", err)
return
}
ca.State.StorageHash = common.ToHash(ret).Bytes() ca.State.StorageHash = common.ToHash(ret).Bytes()
} }
...@@ -242,43 +238,27 @@ func (ca *ContractAccount) GetExecName() string { ...@@ -242,43 +238,27 @@ func (ca *ContractAccount) GetExecName() string {
// GetDataKV 合约固定数据,包含合约代码,以及代码哈希 // GetDataKV 合约固定数据,包含合约代码,以及代码哈希
func (ca *ContractAccount) GetDataKV() (kvSet []*types.KeyValue) { func (ca *ContractAccount) GetDataKV() (kvSet []*types.KeyValue) {
ca.Data.Addr = ca.Addr ca.Data.Addr = ca.Addr
datas, err := proto.Marshal(&ca.Data) datas := types.Encode(&ca.Data)
if err != nil {
log15.Error("marshal contract data error!", "addr", ca.Addr, "error", err)
return
}
kvSet = append(kvSet, &types.KeyValue{Key: ca.GetDataKey(), Value: datas}) kvSet = append(kvSet, &types.KeyValue{Key: ca.GetDataKey(), Value: datas})
return return
} }
// GetStateKV 获取合约状态数据,包含nonce、是否自杀、存储哈希、存储数据 // GetStateKV 获取合约状态数据,包含nonce、是否自杀、存储哈希、存储数据
func (ca *ContractAccount) GetStateKV() (kvSet []*types.KeyValue) { func (ca *ContractAccount) GetStateKV() (kvSet []*types.KeyValue) {
datas, err := proto.Marshal(&ca.State) datas := types.Encode(&ca.State)
if err != nil {
log15.Error("marshal contract state error!", "addr", ca.Addr, "error", err)
return
}
kvSet = append(kvSet, &types.KeyValue{Key: ca.GetStateKey(), Value: datas}) kvSet = append(kvSet, &types.KeyValue{Key: ca.GetStateKey(), Value: datas})
return return
} }
// BuildDataLog 构建变更日志 // BuildDataLog 构建变更日志
func (ca *ContractAccount) BuildDataLog() (log *types.ReceiptLog) { func (ca *ContractAccount) BuildDataLog() (log *types.ReceiptLog) {
datas, err := proto.Marshal(&ca.Data) datas := types.Encode(&ca.Data)
if err != nil {
log15.Error("marshal contract data error!", "addr", ca.Addr, "error", err)
return
}
return &types.ReceiptLog{Ty: evmtypes.TyLogContractData, Log: datas} return &types.ReceiptLog{Ty: evmtypes.TyLogContractData, Log: datas}
} }
// BuildStateLog 构建变更日志 // BuildStateLog 构建变更日志
func (ca *ContractAccount) BuildStateLog() (log *types.ReceiptLog) { func (ca *ContractAccount) BuildStateLog() (log *types.ReceiptLog) {
datas, err := proto.Marshal(&ca.State) datas := types.Encode(&ca.State)
if err != nil {
log15.Error("marshal contract state log error!", "addr", ca.Addr, "error", err)
return
}
return &types.ReceiptLog{Ty: evmtypes.TyLogContractState, Log: datas} return &types.ReceiptLog{Ty: evmtypes.TyLogContractState, Log: datas}
} }
......
syntax = "proto3"; syntax = "proto3";
package types; package types;
option go_package = "../types";
//合约对象信息 //合约对象信息
message EVMContractObject { message EVMContractObject {
......
This source diff could not be displayed because it is too large. You can view the blob instead.
syntax = "proto3"; syntax = "proto3";
package types; package types;
option go_package = "../types";
message Exchange {} message Exchange {}
......
This diff is collapsed.
syntax = "proto3"; syntax = "proto3";
package types; package types;
option go_package = "../types";
message Game { message Game {
//默认是由创建这局游戏的txHash作为gameId //默认是由创建这局游戏的txHash作为gameId
......
This diff is collapsed.
...@@ -3,6 +3,7 @@ syntax = "proto3"; ...@@ -3,6 +3,7 @@ syntax = "proto3";
import "transaction.proto"; import "transaction.proto";
package types; package types;
option go_package = "../types";
// GuessGame 竞猜游戏详情 // GuessGame 竞猜游戏详情
message GuessGame { message GuessGame {
......
This source diff could not be displayed because it is too large. You can view the blob instead.
syntax = "proto3"; syntax = "proto3";
package types; package types;
option go_package = "../types";
message Hashlock { message Hashlock {
bytes hashlockId = 1; bytes hashlockId = 1;
......
This diff is collapsed.
syntax = "proto3"; syntax = "proto3";
package types; package types;
option go_package = "../types";
// 发行信息 // 发行信息
message Issuance { message Issuance {
......
This source diff could not be displayed because it is too large. You can view the blob instead.
syntax = "proto3"; syntax = "proto3";
package jsproto; package jsproto;
option go_package = "../jsproto";
// create action // create action
message Create { message Create {
......
This diff is collapsed.
syntax = "proto3"; syntax = "proto3";
package types; package types;
option go_package = "../types";
message PurchaseRecord { message PurchaseRecord {
int64 amount = 1; int64 amount = 1;
......
This source diff could not be displayed because it is too large. You can view the blob instead.
syntax = "proto3"; syntax = "proto3";
import "account.proto"; import "account.proto";
package types; package types;
option go_package = "../types";
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// message for multisig start///////////////////////////////////////////////////// // message for multisig start/////////////////////////////////////////////////////
......
This source diff could not be displayed because it is too large. You can view the blob instead.
syntax = "proto3"; syntax = "proto3";
package types; package types;
option go_package = "../types";
message Norm { message Norm {
bytes normId = 1; bytes normId = 1;
......
This diff is collapsed.
syntax = "proto3"; syntax = "proto3";
package types; package types;
option go_package = "../types";
//事件 //事件
message OracleStatus { message OracleStatus {
......
This diff is collapsed.
...@@ -5,6 +5,7 @@ import "common.proto"; ...@@ -5,6 +5,7 @@ import "common.proto";
import "blockchain.proto"; import "blockchain.proto";
package types; package types;
option go_package = "../types";
// stateDB // stateDB
message ParacrossStatusDetails { message ParacrossStatusDetails {
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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