Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
plugin
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
link33
plugin
Commits
e7901f80
Commit
e7901f80
authored
Nov 01, 2021
by
hezhengjun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modify evmxgo
parent
6e383173
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
11 deletions
+12
-11
evmxgodb.go
plugin/dapp/evmxgo/executor/evmxgodb.go
+5
-5
parse.go
plugin/dapp/evmxgo/executor/parse.go
+3
-2
evmxgo.proto
plugin/dapp/evmxgo/proto/evmxgo.proto
+4
-4
No files found.
plugin/dapp/evmxgo/executor/evmxgodb.go
View file @
e7901f80
...
...
@@ -16,7 +16,7 @@ type evmxgoDB struct {
evmxgo
evmxgotypes
.
Evmxgo
}
func
newEvmxgoDB
(
cfg
*
types
.
Chain33Config
,
mint
*
evmxgotypes
.
EvmxgoMint
,
creator
string
,
height
int64
)
*
evmxgoDB
{
func
newEvmxgoDB
(
mint
*
evmxgotypes
.
EvmxgoMint
)
*
evmxgoDB
{
e
:=
&
evmxgoDB
{}
e
.
evmxgo
.
Symbol
=
mint
.
GetSymbol
()
return
e
...
...
@@ -69,7 +69,7 @@ func safeAdd(balance, amount int64) (int64, error) {
return
balance
+
amount
,
nil
}
func
(
e
*
evmxgoDB
)
mint
(
db
dbm
.
KV
,
addr
string
,
amount
int64
)
([]
*
types
.
KeyValue
,
[]
*
types
.
ReceiptLog
,
error
)
{
func
(
e
*
evmxgoDB
)
mint
(
amount
int64
)
([]
*
types
.
KeyValue
,
[]
*
types
.
ReceiptLog
,
error
)
{
newTotal
,
err
:=
safeAdd
(
e
.
evmxgo
.
Total
,
amount
)
if
err
!=
nil
{
return
nil
,
nil
,
err
...
...
@@ -273,10 +273,10 @@ func (action *evmxgoAction) mint(mint *evmxgotypes.EvmxgoMint, tx2lock *types.Tr
return
nil
,
evmxgotypes
.
ErrEvmxgoSymbolNotAllowedMint
}
evmxgodb
=
newEvmxgoDB
(
cfg
,
mint
,
action
.
fromaddr
,
action
.
heigh
t
)
evmxgodb
=
newEvmxgoDB
(
min
t
)
}
kvs
,
logs
,
err
:=
evmxgodb
.
mint
(
action
.
db
,
action
.
fromaddr
,
mint
.
Amount
)
kvs
,
logs
,
err
:=
evmxgodb
.
mint
(
mint
.
Amount
)
if
err
!=
nil
{
elog
.
Error
(
"evmxgo mint "
,
"symbol"
,
mint
.
GetSymbol
(),
"error"
,
err
,
"from"
,
action
.
fromaddr
)
return
nil
,
err
...
...
@@ -287,7 +287,7 @@ func (action *evmxgoAction) mint(mint *evmxgotypes.EvmxgoMint, tx2lock *types.Tr
return
nil
,
err
}
elog
.
Debug
(
"mint"
,
"evmxgo.Symbol"
,
mint
.
Symbol
,
"evmxgo.Amount"
,
mint
.
Amount
)
receipt
,
err
:=
evmxgoAccount
.
Mint
(
action
.
fromaddr
,
mint
.
Amount
)
receipt
,
err
:=
evmxgoAccount
.
Mint
(
mint
.
Recipient
,
mint
.
Amount
)
if
err
!=
nil
{
return
nil
,
err
}
...
...
plugin/dapp/evmxgo/executor/parse.go
View file @
e7901f80
...
...
@@ -14,6 +14,7 @@ const (
)
//solidity interface: function lock(address _recipient, address _token, uint256 _amount)
//铸币交易的接收人必须与发起lock交易时填写的接收地址一致
func
checkMinePara
(
mint
*
evmxgotypes
.
EvmxgoMint
,
tx2lock
*
types
.
Transaction
)
error
{
unpack
,
err
:=
chain33Abi
.
Unpack
(
tx2lock
.
Payload
,
LockMethod
,
bridgevmxgo
.
BridgeBankABI
)
if
err
!=
nil
{
...
...
@@ -22,7 +23,7 @@ func checkMinePara(mint *evmxgotypes.EvmxgoMint, tx2lock *types.Transaction) err
for
_
,
para
:=
range
unpack
{
switch
para
.
Name
{
case
"_recipient"
:
if
mint
.
Address
!=
para
.
Value
{
if
mint
.
Recipient
!=
para
.
Value
{
return
errors
.
New
(
"Not consitent recipient address"
)
}
case
"_amount"
:
...
...
@@ -31,7 +32,7 @@ func checkMinePara(mint *evmxgotypes.EvmxgoMint, tx2lock *types.Transaction) err
}
case
"_token"
:
if
mint
.
Token
!=
para
.
Value
{
if
mint
.
Bridge
Token
!=
para
.
Value
{
return
errors
.
New
(
"Not consitent token Address"
)
}
}
...
...
plugin/dapp/evmxgo/proto/evmxgo.proto
View file @
e7901f80
...
...
@@ -19,10 +19,10 @@ message EvmxgoAction {
}
message
EvmxgoMint
{
string
symbol
=
1
;
int64
amount
=
2
;
string
address
=
3
;
string
token
=
4
;
string
symbol
=
1
;
int64
amount
=
2
;
string
bridgeToken
=
3
;
string
recipient
=
4
;
}
message
EvmxgoBurn
{
...
...
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