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 {
...@@ -41,4 +42,4 @@ message AutonomyAction { ...@@ -41,4 +42,4 @@ message AutonomyAction {
TerminateProposalChange tmintPropChange = 19; TerminateProposalChange tmintPropChange = 19;
} }
int32 ty = 20; int32 ty = 20;
} }
\ No newline at end of file
...@@ -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;
...@@ -79,4 +80,4 @@ message ReqQueryProposalBoard { ...@@ -79,4 +80,4 @@ message ReqQueryProposalBoard {
message ReplyQueryProposalBoard { message ReplyQueryProposalBoard {
repeated AutonomyProposalBoard propBoards = 1; repeated AutonomyProposalBoard propBoards = 1;
} }
\ No newline at end of file
...@@ -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;
...@@ -82,4 +83,4 @@ message ReqQueryProposalChange { ...@@ -82,4 +83,4 @@ message ReqQueryProposalChange {
message ReplyQueryProposalChange { message ReplyQueryProposalChange {
repeated AutonomyProposalChange propChanges = 1; repeated AutonomyProposalChange propChanges = 1;
} }
\ No newline at end of file
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
syntax = "proto3"; syntax = "proto3";
package types; package types;
option go_package = "../types";
message VoteResult { message VoteResult {
// 总票数 // 总票数
...@@ -50,4 +51,4 @@ message ActiveBoard { ...@@ -50,4 +51,4 @@ message ActiveBoard {
repeated string revboards = 2; repeated string revboards = 2;
int64 amount = 3; int64 amount = 3;
int64 startHeight = 4; int64 startHeight = 4;
} }
\ No newline at end of file
...@@ -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;
...@@ -93,4 +94,4 @@ message ReqQueryProposalProject { ...@@ -93,4 +94,4 @@ message ReqQueryProposalProject {
message ReplyQueryProposalProject { message ReplyQueryProposalProject {
repeated AutonomyProposalProject propProjects = 1; repeated AutonomyProposalProject propProjects = 1;
} }
\ No newline at end of file
...@@ -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;
...@@ -113,4 +114,4 @@ message RelationCmt { ...@@ -113,4 +114,4 @@ message RelationCmt {
message ReplyQueryProposalComment { message ReplyQueryProposalComment {
repeated RelationCmt rltCmt = 1; repeated RelationCmt rltCmt = 1;
} }
\ No newline at end of file
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;
...@@ -197,4 +198,4 @@ service blackwhite { ...@@ -197,4 +198,4 @@ service blackwhite {
//交易接口 //交易接口
rpc Play(BlackwhitePlay) returns (UnsignTx) {} rpc Play(BlackwhitePlay) returns (UnsignTx) {}
rpc TimeoutDone(BlackwhiteTimeoutDone) returns (UnsignTx) {} rpc TimeoutDone(BlackwhiteTimeoutDone) returns (UnsignTx) {}
} }
\ No newline at end of file
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;
...@@ -51,4 +52,4 @@ message ReqQueryValidCertSN { ...@@ -51,4 +52,4 @@ message ReqQueryValidCertSN {
message RepQueryValidCertSN { message RepQueryValidCertSN {
bytes sn = 1; bytes sn = 1;
} }
\ No newline at end of file
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 {
...@@ -66,4 +65,4 @@ message CoinsConfig { ...@@ -66,4 +65,4 @@ message CoinsConfig {
TransferFlagConfig transferFlag = 2; TransferFlagConfig transferFlag = 2;
ManagerAccountsConfig managerAccounts = 3; ManagerAccountsConfig managerAccounts = 3;
} }
} }
\ No newline at end of file
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 {
...@@ -219,4 +220,4 @@ message RepCollateralizePrice { ...@@ -219,4 +220,4 @@ message RepCollateralizePrice {
// 返回用户借贷总额 // 返回用户借贷总额
message RepCollateralizeUserBalance { message RepCollateralizeUserBalance {
int64 balance = 1; //返回用户借贷总额 int64 balance = 1; //返回用户借贷总额
} }
\ No newline at end of file
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,18 +247,18 @@ function TestETH2Chain33Assets() { ...@@ -247,18 +247,18 @@ 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个
result=$(${CLIA} ethereum lock -m 11 -k "${ethValidatorAddrKeyA}" -r "${chain33ReceiverAddr}") result=$(${CLIA} ethereum lock -m 11 -k "${ethValidatorAddrKeyA}" -r "${chain33ReceiverAddr}")
cli_ret "${result}" "lock" cli_ret "${result}" "lock"
# eth 等待 2 个区块 # eth 等待 2 个区块
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
...@@ -322,7 +322,7 @@ function TestETH2Chain33Ycc() { ...@@ -322,7 +322,7 @@ function TestETH2Chain33Ycc() {
result=$(${CLIA} ethereum lock -m 7 -k "${ethDeployKey}" -r "${chain33ReceiverAddr}" -t "${ethereumYccTokenAddr}") result=$(${CLIA} ethereum lock -m 7 -k "${ethDeployKey}" -r "${chain33ReceiverAddr}" -t "${ethereumYccTokenAddr}")
cli_ret "${result}" "lock" cli_ret "${result}" "lock"
# eth 等待 2 个区块 # eth 等待 2 个区块
sleep 4 sleep 4
# 查询 ETH 这端 bridgeBank 地址 7 YCC # 查询 ETH 这端 bridgeBank 地址 7 YCC
...@@ -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"
...@@ -418,7 +418,7 @@ function offline_transfer_multisign_Bty_test() { ...@@ -418,7 +418,7 @@ function offline_transfer_multisign_Bty_test() {
function initPara() { function initPara() {
# para add # para add
hash=$(${Para8901Cli} send coins transfer -a 10000 -n test -t "${chain33ReceiverAddr}" -k CC38546E9E659D15E6B4893F0AB32A06D103931A8230B0BDE71459D2B27D6944) hash=$(${Para8901Cli} send coins transfer -a 10000 -n test -t "${chain33ReceiverAddr}" -k CC38546E9E659D15E6B4893F0AB32A06D103931A8230B0BDE71459D2B27D6944)
check_tx "${Para8901Cli}" "${hash}" check_tx "${Para8901Cli}" "${hash}"
Chain33Cli=${Para8901Cli} Chain33Cli=${Para8901Cli}
...@@ -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}"
} }
...@@ -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}"
...@@ -89,7 +89,7 @@ function lockChain33Ycc() { ...@@ -89,7 +89,7 @@ function lockChain33Ycc() {
lock_chain33_ycc_multisign 260 120 240 lock_chain33_ycc_multisign 260 120 240
lock_chain33_ycc_multisign 10 52 318 lock_chain33_ycc_multisign 10 52 318
# transfer test # transfer test
# shellcheck disable=SC2154 # shellcheck disable=SC2154
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")
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
...@@ -170,7 +170,7 @@ function lockEthYcc() { ...@@ -170,7 +170,7 @@ function lockEthYcc() {
# multisignEthAddr 要有手续费 # multisignEthAddr 要有手续费
./ebcli_A ethereum transfer -k "${ethDeployKey}" -m 10 -r "${multisignEthAddr}" ./ebcli_A ethereum transfer -k "${ethDeployKey}" -m 10 -r "${multisignEthAddr}"
# transfer # transfer
${CLIA} ethereum multisign transfer -a 8 -r "${ethBridgeBank}" -t "${ethereumYccTokenAddr}" -k "${ethMultisignKeyA},${ethMultisignKeyB},${ethMultisignKeyC},${ethMultisignKeyD}" ${CLIA} ethereum multisign transfer -a 8 -r "${ethBridgeBank}" -t "${ethereumYccTokenAddr}" -k "${ethMultisignKeyA},${ethMultisignKeyB},${ethMultisignKeyC},${ethMultisignKeyD}"
sleep 2 sleep 2
result=$(${CLIA} ethereum balance -o "${ethBridgeBank}" -t "${ethereumYccTokenAddr}") result=$(${CLIA} ethereum balance -o "${ethBridgeBank}" -t "${ethereumYccTokenAddr}")
...@@ -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
...@@ -79,7 +79,7 @@ function TestChain33ToEthAssets() { ...@@ -79,7 +79,7 @@ function TestChain33ToEthAssets() {
sleep ${maturityDegree} sleep ${maturityDegree}
# 接收的地址金额 变成了 3 # 接收的地址金额 变成了 3
result=$(${Chain33Cli} account balance -a "${chain33ReceiverAddr}" -e evm) result=$(${Chain33Cli} account balance -a "${chain33ReceiverAddr}" -e evm)
balance_ret "${result}" "3.0000" balance_ret "${result}" "3.0000"
...@@ -94,18 +94,18 @@ function TestChain33ToEthAssets() { ...@@ -94,18 +94,18 @@ 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个
result=$(${CLIA} ethereum lock -m 11 -k "${ethValidatorAddrKeyA}" -r "${chain33ReceiverAddr}") result=$(${CLIA} ethereum lock -m 11 -k "${ethValidatorAddrKeyA}" -r "${chain33ReceiverAddr}")
cli_ret "${result}" "lock" cli_ret "${result}" "lock"
# eth 等待 10 个区块 # eth 等待 10 个区块
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
...@@ -151,7 +151,7 @@ function TestETH2Chain33Ycc() { ...@@ -151,7 +151,7 @@ function TestETH2Chain33Ycc() {
result=$(${CLIA} ethereum lock -m 7 -k "${ethDeployKey}" -r "${chain33ReceiverAddr}" -t "${ethereumYccTokenAddr}") result=$(${CLIA} ethereum lock -m 7 -k "${ethDeployKey}" -r "${chain33ReceiverAddr}" -t "${ethereumYccTokenAddr}")
cli_ret "${result}" "lock" cli_ret "${result}" "lock"
# eth 等待 10 个区块 # eth 等待 10 个区块
eth_block_wait 2 eth_block_wait 2
# 查询 ETH 这端 bridgeBank 地址 7 YCC # 查询 ETH 这端 bridgeBank 地址 7 YCC
...@@ -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
...@@ -204,4 +204,4 @@ function mainTest() { ...@@ -204,4 +204,4 @@ function mainTest() {
TestETH2Chain33Ycc TestETH2Chain33Ycc
} }
mainTest "${1}" mainTest "${1}"
\ No newline at end of file
...@@ -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
...@@ -81,7 +81,7 @@ function TestChain33ToEthAssetsKill() { ...@@ -81,7 +81,7 @@ function TestChain33ToEthAssetsKill() {
start_ebrelayerC start_ebrelayerC
start_ebrelayerD start_ebrelayerD
# 接收的地址金额 变成了 3 # 接收的地址金额 变成了 3
result=$(${Chain33Cli} account balance -a "${chain33ReceiverAddr}" -e evm) result=$(${Chain33Cli} account balance -a "${chain33ReceiverAddr}" -e evm)
balance_ret "${result}" "3.0000" balance_ret "${result}" "3.0000"
...@@ -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
...@@ -171,11 +171,11 @@ function TestETH2Chain33AssetsKill() { ...@@ -171,11 +171,11 @@ function TestETH2Chain33AssetsKill() {
result=$(${CLIA} ethereum lock -m 11 -k "${ethValidatorAddrKeyA}" -r "${chain33ReceiverAddr}") result=$(${CLIA} ethereum lock -m 11 -k "${ethValidatorAddrKeyA}" -r "${chain33ReceiverAddr}")
cli_ret "${result}" "lock" cli_ret "${result}" "lock"
# eth 等待 10 个区块 # eth 等待 10 个区块
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}"
...@@ -239,7 +239,7 @@ function TestETH2Chain33YccKill() { ...@@ -239,7 +239,7 @@ function TestETH2Chain33YccKill() {
result=$(${CLIA} ethereum lock -m 7 -k "${ethDeployKey}" -r "${chain33ReceiverAddr}" -t "${ethereumYccTokenAddr}") result=$(${CLIA} ethereum lock -m 7 -k "${ethDeployKey}" -r "${chain33ReceiverAddr}" -t "${ethereumYccTokenAddr}")
cli_ret "${result}" "lock" cli_ret "${result}" "lock"
# eth 等待 10 个区块 # eth 等待 10 个区块
eth_block_wait 2 eth_block_wait 2
sleep ${maturityDegree} sleep ${maturityDegree}
...@@ -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
...@@ -81,7 +81,7 @@ function TestChain33ToEthAssets() { ...@@ -81,7 +81,7 @@ function TestChain33ToEthAssets() {
sleep ${maturityDegree} sleep ${maturityDegree}
# 接收的地址金额 变成了 3 # 接收的地址金额 变成了 3
result=$(${Chain33Cli} account balance -a "${chain33ReceiverAddr}" -e evm) result=$(${Chain33Cli} account balance -a "${chain33ReceiverAddr}" -e evm)
balance_ret "${result}" "3.0000" balance_ret "${result}" "3.0000"
...@@ -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
...@@ -129,8 +129,8 @@ function TestChain33ToEthZBCAssets() { ...@@ -129,8 +129,8 @@ function TestChain33ToEthZBCAssets() {
sleep ${maturityDegree} sleep ${maturityDegree}
# 接收的地址金额 变成了 8 # 接收的地址金额 变成了 8
result=$(${Chain33Cli} evm query -a "${chain33ZBCErc20Addr}" -c "${chain33ReceiverAddr}" -b "balanceOf(${chain33ReceiverAddr})") result=$(${Chain33Cli} evm query -a "${chain33ZBCErc20Addr}" -c "${chain33ReceiverAddr}" -b "balanceOf(${chain33ReceiverAddr})")
is_equal "${result}" "800000000" is_equal "${result}" "800000000"
# chain33BridgeBank 是否减少了 1 # chain33BridgeBank 是否减少了 1
...@@ -145,18 +145,18 @@ function TestETH2Chain33Assets() { ...@@ -145,18 +145,18 @@ 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个
result=$(${CLIA} ethereum lock -m 11 -k "${ethValidatorAddrKeyA}" -r "${chain33ReceiverAddr}") result=$(${CLIA} ethereum lock -m 11 -k "${ethValidatorAddrKeyA}" -r "${chain33ReceiverAddr}")
cli_ret "${result}" "lock" cli_ret "${result}" "lock"
# eth 等待 10 个区块 # eth 等待 10 个区块
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
...@@ -202,7 +202,7 @@ function TestETH2Chain33Ycc() { ...@@ -202,7 +202,7 @@ function TestETH2Chain33Ycc() {
result=$(${CLIA} ethereum lock -m 7 -k "${ethDeployKey}" -r "${chain33ReceiverAddr}" -t "${ethereumYccTokenAddr}") result=$(${CLIA} ethereum lock -m 7 -k "${ethDeployKey}" -r "${chain33ReceiverAddr}" -t "${ethereumYccTokenAddr}")
cli_ret "${result}" "lock" cli_ret "${result}" "lock"
# eth 等待 10 个区块 # eth 等待 10 个区块
eth_block_wait 2 eth_block_wait 2
# 查询 ETH 这端 bridgeBank 地址 7 YCC # 查询 ETH 这端 bridgeBank 地址 7 YCC
...@@ -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}")
...@@ -202,7 +201,7 @@ function TestChain33ToEthAssets() { ...@@ -202,7 +201,7 @@ function TestChain33ToEthAssets() {
sleep ${maturityDegree} sleep ${maturityDegree}
# 接收的地址金额 变成了 3 # 接收的地址金额 变成了 3
result=$(${Chain33Cli} account balance -a "${chain33ReceiverAddr}" -e evm) result=$(${Chain33Cli} account balance -a "${chain33ReceiverAddr}" -e evm)
balance_ret "${result}" "3.0000" balance_ret "${result}" "3.0000"
...@@ -217,19 +216,19 @@ function TestChain33ToEthAssets() { ...@@ -217,19 +216,19 @@ 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个
result=$(${CLIA} ethereum lock -m 11 -k "${ethValidatorAddrKeyA}" -r "${chain33ReceiverAddr}") result=$(${CLIA} ethereum lock -m 11 -k "${ethValidatorAddrKeyA}" -r "${chain33ReceiverAddr}")
cli_ret "${result}" "lock" cli_ret "${result}" "lock"
# 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
...@@ -274,9 +273,9 @@ function TestETH2Chain33Ycc() { ...@@ -274,9 +273,9 @@ function TestETH2Chain33Ycc() {
result=$(${CLIA} ethereum lock -m 7 -k "${ethDeployKey}" -r "${chain33ReceiverAddr}" -t "${ethereumYccTokenAddr}") result=$(${CLIA} ethereum lock -m 7 -k "${ethDeployKey}" -r "${chain33ReceiverAddr}" -t "${ethereumYccTokenAddr}")
cli_ret "${result}" "lock" cli_ret "${result}" "lock"
# 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 ============="
...@@ -414,16 +413,16 @@ function check_cross_transfer_game_balance() { ...@@ -414,16 +413,16 @@ function check_cross_transfer_game_balance() {
function para_create_nodegroup() { function para_create_nodegroup() {
echo "=========== # para chain create node group again =============" echo "=========== # para chain create node group again ============="
##apply ##apply
txhash=$(${PARA_CLI} send para nodegroup apply -a "1KSBd17H7ZK8iT37aJztFB22XGwsPTdwE4,1JRNjdEqp4LJ5fqycUBm9ayCKSeeskgMKR,1NLHPEcbTWWxxU3dGUZBhayjrCHD3psX7k,1MCftFynyvG2F4ED5mdHYgziDxx6vDrScs" -c 6 -k 0xd165c84ed37c2a427fea487470ee671b7a0495d68d82607cafbc6348bf23bec5) txhash=$(${PARA_CLI} send para nodegroup apply -a "1KSBd17H7ZK8iT37aJztFB22XGwsPTdwE4,1JRNjdEqp4LJ5fqycUBm9ayCKSeeskgMKR,1NLHPEcbTWWxxU3dGUZBhayjrCHD3psX7k,1MCftFynyvG2F4ED5mdHYgziDxx6vDrScs" -c 6 -k 0xd165c84ed37c2a427fea487470ee671b7a0495d68d82607cafbc6348bf23bec5)
echo "tx=$txhash" echo "tx=$txhash"
query_tx "${PARA_CLI}" "${txhash}" query_tx "${PARA_CLI}" "${txhash}"
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
...@@ -438,4 +437,4 @@ function para_create_nodegroup() { ...@@ -438,4 +437,4 @@ function para_create_nodegroup() {
fi fi
${PARA_CLI} para nodegroup addrs ${PARA_CLI} para nodegroup addrs
} }
\ No newline at end of file
...@@ -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
...@@ -224,7 +224,7 @@ function transfer_multisign_EthYcc() { ...@@ -224,7 +224,7 @@ function transfer_multisign_EthYcc() {
${CLIA} ethereum transfer -k "${ethDeployKey}" -m 10 -r "${multisignEthAddr}" ${CLIA} ethereum transfer -k "${ethDeployKey}" -m 10 -r "${multisignEthAddr}"
sleep 2 sleep 2
# transfer # transfer
${CLIA} ethereum multisign transfer -a 8 -r "${ethBridgeBank}" -t "${ethereumYccTokenAddr}" -k "${ethMultisignKeyA},${ethMultisignKeyB},${ethMultisignKeyC},${ethMultisignKeyD}" ${CLIA} ethereum multisign transfer -a 8 -r "${ethBridgeBank}" -t "${ethereumYccTokenAddr}" -k "${ethMultisignKeyA},${ethMultisignKeyB},${ethMultisignKeyC},${ethMultisignKeyD}"
sleep 2 sleep 2
result=$(${CLIA} ethereum balance -o "${ethBridgeBank}" -t "${ethereumYccTokenAddr}") result=$(${CLIA} ethereum balance -o "${ethBridgeBank}" -t "${ethereumYccTokenAddr}")
......
...@@ -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}"
......
...@@ -498,7 +498,7 @@ function start_trufflesuite() { ...@@ -498,7 +498,7 @@ function start_trufflesuite() {
fi fi
# 启动 eth # 启动 eth
docker run -d --name ${ganacheName} -p 7545:8545 -l eth_test trufflesuite/ganache-cli:latest -a 20 --debug -b 1 -m "coast bar giraffe art venue decide symbol law visual crater vital fold" -l 0x7a1200 docker run -d --name ${ganacheName} -p 7545:8545 -l eth_test trufflesuite/ganache-cli:latest -a 20 --debug -b 1 -m "coast bar giraffe art venue decide symbol law visual crater vital fold" -l 0x7a1200
sleep 1 sleep 1
} }
...@@ -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 {
...@@ -37,4 +38,4 @@ message Query { ...@@ -37,4 +38,4 @@ message Query {
message QueryResult { message QueryResult {
string msg = 1; string msg = 1;
int32 count = 2; int32 count = 2;
} }
\ No newline at end of file
...@@ -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;
...@@ -50,4 +51,4 @@ message HashlockAction { ...@@ -50,4 +51,4 @@ message HashlockAction {
HashlockUnlock hunlock = 3; HashlockUnlock hunlock = 3;
} }
int32 ty = 4; int32 ty = 4;
} }
\ No newline at end of file
This diff is collapsed.
syntax = "proto3"; syntax = "proto3";
package types; package types;
option go_package = "../types";
// 发行信息 // 发行信息
message Issuance { message Issuance {
...@@ -177,4 +178,4 @@ message RepIssuancePrice { ...@@ -177,4 +178,4 @@ message RepIssuancePrice {
// 返回用户发行总额 // 返回用户发行总额
message RepIssuanceUserBalance { message RepIssuanceUserBalance {
int64 balance = 1; //返回用户发行总额 int64 balance = 1; //返回用户发行总额
} }
\ No newline at end of file
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 {
...@@ -28,4 +29,4 @@ message JsLog { ...@@ -28,4 +29,4 @@ message JsLog {
message QueryResult { message QueryResult {
string data = 1; string data = 1;
} }
\ No newline at end of file
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/////////////////////////////////////////////////////
...@@ -342,4 +343,4 @@ message OwnerAttr { ...@@ -342,4 +343,4 @@ message OwnerAttr {
message OwnerAttrs { message OwnerAttrs {
repeated OwnerAttr items = 1; repeated OwnerAttr items = 1;
} }
\ No newline at end of file
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;
...@@ -22,4 +23,4 @@ message NormPut { ...@@ -22,4 +23,4 @@ message NormPut {
message NormGetKey { message NormGetKey {
bytes key = 1; bytes key = 1;
} }
\ No newline at end of file
This diff is collapsed.
syntax = "proto3"; syntax = "proto3";
package types; package types;
option go_package = "../types";
//事件 //事件
message OracleStatus { message OracleStatus {
...@@ -92,4 +93,4 @@ message ReceiptOracle { ...@@ -92,4 +93,4 @@ message ReceiptOracle {
message ReplyOracleStatusList { message ReplyOracleStatusList {
repeated OracleStatus status = 1; //状态集 repeated OracleStatus status = 1; //状态集
} }
\ No newline at end of file
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 {
...@@ -511,4 +512,4 @@ message BlsPubKey{ ...@@ -511,4 +512,4 @@ message BlsPubKey{
service paracross { service paracross {
rpc IsSync(ReqNil) returns (IsCaughtUp) {} rpc IsSync(ReqNil) returns (IsCaughtUp) {}
} }
\ No newline at end of file
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