Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
sidecar-client-chain33
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
link33
sidecar-client-chain33
Commits
7546549f
Commit
7546549f
authored
May 26, 2023
by
suyanlong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add execType and symbols pair
parent
e22100b0
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
32 additions
and
4 deletions
+32
-4
config.go
config/config.go
+2
-0
evmxgo.go
evmxgo/evmxgo.go
+12
-3
evmxgo.toml
evmxgo/evmxgo.toml
+5
-0
paracross.go
paracross/paracross.go
+9
-1
paracross.toml
paracross/paracross.toml
+4
-0
No files found.
config/config.go
View file @
7546549f
...
...
@@ -45,10 +45,12 @@ type Chain33 struct {
HeightDiff
int64
`mapstructure:"height_diff" json:"height_diff"`
// 高度差
Fee
int64
`mapstructure:"Fee" json:"Fee"`
// 单笔交易的手续费
Step
int64
`mapstructure:"step" json:"step"`
// 步长
ExecType
int64
`mapstructure:"exec_type" json:"exec_type"`
// 执行器类型:0、1
EventFilter
string
`mapstructure:"event_filter" toml:"event_filter" json:"event_filter"`
TimeoutHeight
int64
`mapstructure:"timeout_height" json:"timeout_height"`
IsTest
bool
`mapstructure:"is_test" json:"is_test"`
Symbol
string
`mapstructure:"symbol" json:"symbol"`
Symbols
map
[
string
]
string
`mapstructure:"symbols" json:"symbols"`
}
type
Service
struct
{
...
...
evmxgo/evmxgo.go
View file @
7546549f
...
...
@@ -334,8 +334,17 @@ func (e *Evmxgo) pollAppChain() chan *types.Event {
burnEvent
:=
action
.
BurnMap
e
.
logger
.
Info
(
"printf burnEvent"
,
"burnEvent"
,
util
.
FormatJSON
(
action
))
amount
:=
burnEvent
.
Amount
symbol
:=
burnEvent
.
Symbol
isRun
:=
false
if
len
(
e
.
config
.
Chain33
.
Symbols
)
!=
0
{
symbol
,
isRun
=
e
.
config
.
Chain33
.
Symbols
[
symbol
]
}
else
{
isRun
=
strings
.
ToLower
(
burnEvent
.
Symbol
)
==
strings
.
ToLower
(
e
.
config
.
Chain33
.
Symbol
)
}
// 销毁指定的token
if
strings
.
ToLower
(
burnEvent
.
Symbol
)
==
strings
.
ToLower
(
e
.
config
.
Chain33
.
Symbol
)
{
if
isRun
{
// extra, _ := util.FromHex(burnEvent.Extra)
// 已销毁
burnAddress
:=
burnEvent
.
Recipient
...
...
@@ -354,8 +363,8 @@ func (e *Evmxgo) pollAppChain() chan *types.Event {
Payload
:
&
types
.
MapAssetInfo
{
EventType
:
types
.
EventType_Burn
,
BurnAddress
:
burnAddress
,
BurnAmount
:
cast
.
ToInt64
(
burnEvent
.
A
mount
),
Symbol
:
types
.
Symbol
(
burnEvent
.
S
ymbol
),
BurnAmount
:
cast
.
ToInt64
(
a
mount
),
Symbol
:
types
.
Symbol
(
s
ymbol
),
Height
:
height1
,
Nonce
:
tx
.
Nonce
,
// Extra: extra, //TODO
...
...
evmxgo/evmxgo.toml
View file @
7546549f
...
...
@@ -14,6 +14,11 @@ chain_id = 0
step
=
10
symbol
=
"BTY"
[chain33.symbols]
#BTY = "BTY"
#YCC = "YCC"
[log]
#日志级别
level
=
"trace"
...
...
paracross/paracross.go
View file @
7546549f
...
...
@@ -164,7 +164,7 @@ func (p *Paracross) Initialize(configPath string, ID string, extra []byte) error
p
.
isTest
=
chain33Config
.
Chain33
.
IsTest
p
.
paraHeight
=
atomic
.
NewInt64
(
-
2
)
// TODO
// 判断执行器地址类型
if
strings
.
ToUpper
(
chain33Config
.
Chain33
.
Symbol
)
==
"YCC"
{
if
chain33Config
.
Chain33
.
ExecType
==
2
{
// 执行器地址类型,YCC是以太坊地址类型。
execAddress
,
err
:=
address
.
GetExecAddress
(
p
.
title
+
execer
,
2
)
if
err
!=
nil
{
...
...
@@ -734,6 +734,14 @@ func (p *Paracross) SubmitIBTP(ibtp *pb.IBTP) (*pb.SubmitIBTPResponse, error) {
// 第一次提交。
tokenSymbol
:=
p
.
chain33Config
.
Chain33
.
Symbol
symbol
:=
strings
.
ToLower
(
p
.
chain33Config
.
Chain33
.
Symbol
)
isRun
:=
false
if
len
(
p
.
chain33Config
.
Chain33
.
Symbols
)
!=
0
{
symbol
,
isRun
=
p
.
chain33Config
.
Chain33
.
Symbols
[
event
.
Payload
.
Symbol
]
if
!
isRun
{
symbol
=
""
}
}
if
symbol
==
"ycc"
||
symbol
==
"bty"
{
// 主链的token映射到平行链: coins.xxx
tokenSymbol
=
fmt
.
Sprintf
(
"coins.%s"
,
symbol
)
...
...
paracross/paracross.toml
View file @
7546549f
...
...
@@ -14,7 +14,11 @@ fee = 100000
#被监听链ID
chain_id
=
0
step
=
10
exec_type
=
0
symbol
=
"BTY"
[chain33.symbols]
#BTY = "BTY"
#YCC = "YCC"
[log]
#日志级别
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment