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
25622437
Commit
25622437
authored
Mar 14, 2020
by
mdj33
Committed by
vipwzw
Mar 18, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
toAddr not null
parent
34a3ec00
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
9 deletions
+13
-9
test-rpc.sh
plugin/dapp/paracross/cmd/test/test-rpc.sh
+1
-1
paracross.go
plugin/dapp/paracross/commands/paracross.go
+1
-0
action.go
plugin/dapp/paracross/executor/action.go
+11
-8
No files found.
plugin/dapp/paracross/cmd/test/test-rpc.sh
View file @
25622437
...
...
@@ -248,7 +248,7 @@ function paracross_txgroupex() {
local
trade_exec_name
=
"
$para_title
.trade"
# 资产从主链转移到平行链
req
=
'"method":"Chain33.CreateTransaction","params":[{"execer":"'
"
${
paracross_execer_name
}
"
'","actionName":"CrossAssetTransfer","payload":{"assetExec":"'
"
${
coins_exec
}
"
'","assetSymbol":"'
"
${
bty_symbol
}
"
'","amount":'
${
amount_transfer
}
'}}]'
req
=
'"method":"Chain33.CreateTransaction","params":[{"execer":"'
"
${
paracross_execer_name
}
"
'","actionName":"CrossAssetTransfer","payload":{"assetExec":"'
"
${
coins_exec
}
"
'","assetSymbol":"'
"
${
bty_symbol
}
"
'","
toAddr":"'
"
${
para_test_addr
}
"
'","
amount":'
${
amount_transfer
}
'}}]'
echo
"
$req
"
resp
=
$(
curl
-ksd
"{
$req
}"
"
${
para_ip
}
"
)
echo
"
$resp
"
...
...
plugin/dapp/paracross/commands/paracross.go
View file @
25622437
...
...
@@ -256,6 +256,7 @@ func addCreateCrossAssetTransferFlags(cmd *cobra.Command) {
cmd
.
MarkFlagRequired
(
"symbol"
)
cmd
.
Flags
()
.
StringP
(
"to"
,
"t"
,
""
,
"transfer to account"
)
cmd
.
MarkFlagRequired
(
"to"
)
cmd
.
Flags
()
.
Float64P
(
"amount"
,
"a"
,
0
,
"transaction amount"
)
cmd
.
MarkFlagRequired
(
"amount"
)
...
...
plugin/dapp/paracross/executor/action.go
View file @
25622437
...
...
@@ -1007,9 +1007,12 @@ func (a *action) execCrossTxs(status *pt.ParacrossNodeStatus) (*types.Receipt, e
return
&
receipt
,
nil
}
func
(
a
*
action
)
assetTransferMainCheck
(
cfg
*
types
.
Chain33Config
)
error
{
func
(
a
*
action
)
assetTransferMainCheck
(
cfg
*
types
.
Chain33Config
,
transfer
*
types
.
AssetsTransfer
)
error
{
//主链如果没有nodegroup配置,也不允许跨链,直接返回错误,平行链也不会执行
if
cfg
.
IsDappFork
(
a
.
height
,
pt
.
ParaX
,
pt
.
ForkParaAssetTransferRbk
)
{
if
len
(
transfer
.
To
)
==
0
{
return
errors
.
Wrap
(
types
.
ErrInvalidParam
,
"toAddr should not be null"
)
}
return
a
.
isAllowTransfer
()
}
return
nil
...
...
@@ -1022,7 +1025,7 @@ func (a *action) AssetTransfer(transfer *types.AssetsTransfer) (*types.Receipt,
//主链如果没有nodegroup配置,也不允许跨链,直接返回错误,平行链也不会执行
if
!
isPara
{
err
:=
a
.
assetTransferMainCheck
(
cfg
)
err
:=
a
.
assetTransferMainCheck
(
cfg
,
transfer
)
if
err
!=
nil
{
return
nil
,
errors
.
Wrap
(
err
,
"AssetTransfer check"
)
}
...
...
@@ -1044,6 +1047,9 @@ func (a *action) assetWithdrawMainCheck(cfg *types.Chain33Config, withdraw *type
//rbk fork后 如果没有nodegroup conf,也不允许跨链
if
cfg
.
IsDappFork
(
a
.
height
,
pt
.
ParaX
,
pt
.
ForkParaAssetTransferRbk
)
{
if
len
(
withdraw
.
To
)
==
0
{
return
errors
.
Wrap
(
types
.
ErrInvalidParam
,
"toAddr should not be null"
)
}
err
:=
a
.
isAllowTransfer
()
if
err
!=
nil
{
return
errors
.
Wrap
(
err
,
"AssetWithdraw not allow"
)
...
...
@@ -1082,9 +1088,9 @@ func (a *action) crossAssetTransferMainCheck(transfer *pt.CrossAssetTransfer) er
return
errors
.
Wrap
(
err
,
"not Allow"
)
}
if
len
(
transfer
.
AssetExec
)
==
0
||
len
(
transfer
.
AssetSymbol
)
==
0
||
transfer
.
Amount
==
0
{
return
errors
.
Wrapf
(
types
.
ErrInvalidParam
,
"exec=%s, symbol=%s, amount=%d should not be null"
,
transfer
.
AssetExec
,
transfer
.
AssetSymbol
,
transfer
.
Amount
)
if
len
(
transfer
.
AssetExec
)
==
0
||
len
(
transfer
.
AssetSymbol
)
==
0
||
transfer
.
Amount
==
0
||
len
(
transfer
.
ToAddr
)
==
0
{
return
errors
.
Wrapf
(
types
.
ErrInvalidParam
,
"exec=%s, symbol=%s, amount=%d
,toAddr=%s
should not be null"
,
transfer
.
AssetExec
,
transfer
.
AssetSymbol
,
transfer
.
Amount
,
transfer
.
ToAddr
)
}
return
nil
}
...
...
@@ -1106,9 +1112,6 @@ func (a *action) CrossAssetTransfer(transfer *pt.CrossAssetTransfer) (*types.Rec
return
nil
,
errors
.
Wrap
(
types
.
ErrNotSupport
,
"not Allow before ForkRootHash"
)
}
if
len
(
transfer
.
ToAddr
)
==
0
{
transfer
.
ToAddr
=
a
.
tx
.
From
()
}
act
,
err
:=
getCrossAction
(
transfer
,
string
(
a
.
tx
.
Execer
))
if
act
==
pt
.
ParacrossNoneTransfer
{
return
nil
,
errors
.
Wrap
(
err
,
"non action"
)
...
...
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