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
40b5c96c
Commit
40b5c96c
authored
Dec 21, 2021
by
hezhengjun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
set amount after correct by different decimal
parent
e80678c4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
13 deletions
+9
-13
ethereum.go
plugin/dapp/cross2eth/ebrelayer/relayer/ethereum/ethereum.go
+9
-10
types.go
...dapp/cross2eth/ebrelayer/relayer/ethereum/ethtxs/types.go
+0
-3
No files found.
plugin/dapp/cross2eth/ebrelayer/relayer/ethereum/ethereum.go
View file @
40b5c96c
...
@@ -538,7 +538,7 @@ func (ethRelayer *Relayer4Ethereum) checkPermissionWithinOneDay(withdrawTx *ebTy
...
@@ -538,7 +538,7 @@ func (ethRelayer *Relayer4Ethereum) checkPermissionWithinOneDay(withdrawTx *ebTy
totalAlready
.
Add
(
totalAlready
,
AmountInt
)
totalAlready
.
Add
(
totalAlready
,
AmountInt
)
if
totalAlready
.
Cmp
(
withdrawPara
.
AmountPerDay
)
>
0
{
if
totalAlready
.
Cmp
(
withdrawPara
.
AmountPerDay
)
>
0
{
relayerLog
.
Error
(
"checkPermissionWithinOneDay"
,
"No withdraw parameter configured for symbol "
,
withdrawTx
.
Symbol
)
relayerLog
.
Error
(
"checkPermissionWithinOneDay"
,
"No withdraw parameter configured for symbol "
,
withdrawTx
.
Symbol
)
return
nil
,
errors
.
New
(
"ErrWithdrawAmount
TooBig
"
)
return
nil
,
errors
.
New
(
"ErrWithdrawAmount
BigThanQuota
"
)
}
}
relayerLog
.
Info
(
"checkPermissionWithinOneDay"
,
"total withdraw already"
,
totalAlready
,
"Chain33Sender"
,
withdrawTx
.
Chain33Sender
,
relayerLog
.
Info
(
"checkPermissionWithinOneDay"
,
"total withdraw already"
,
totalAlready
,
"Chain33Sender"
,
withdrawTx
.
Chain33Sender
,
"Symbol"
,
withdrawTx
.
Symbol
)
"Symbol"
,
withdrawTx
.
Symbol
)
...
@@ -554,7 +554,6 @@ func (ethRelayer *Relayer4Ethereum) handleLogWithdraw(chain33Msg *events.Chain33
...
@@ -554,7 +554,6 @@ func (ethRelayer *Relayer4Ethereum) handleLogWithdraw(chain33Msg *events.Chain33
Chain33Sender
:
chain33Msg
.
Chain33Sender
.
String
(),
Chain33Sender
:
chain33Msg
.
Chain33Sender
.
String
(),
EthereumReceiver
:
chain33Msg
.
EthereumReceiver
.
String
(),
EthereumReceiver
:
chain33Msg
.
EthereumReceiver
.
String
(),
Symbol
:
chain33Msg
.
Symbol
,
Symbol
:
chain33Msg
.
Symbol
,
Amount
:
chain33Msg
.
Amount
.
String
(),
TxHashOnChain33
:
common
.
Bytes2Hex
(
chain33Msg
.
TxHash
),
TxHashOnChain33
:
common
.
Bytes2Hex
(
chain33Msg
.
TxHash
),
Nonce
:
chain33Msg
.
Nonce
,
Nonce
:
chain33Msg
.
Nonce
,
Year
:
int32
(
year
),
Year
:
int32
(
year
),
...
@@ -589,12 +588,6 @@ func (ethRelayer *Relayer4Ethereum) handleLogWithdraw(chain33Msg *events.Chain33
...
@@ -589,12 +588,6 @@ func (ethRelayer *Relayer4Ethereum) handleLogWithdraw(chain33Msg *events.Chain33
return
return
}
}
//检查用户提币权限是否得到满足:比如是否超过累计提币额度
var
feeAmount
*
big
.
Int
if
feeAmount
,
err
=
ethRelayer
.
checkPermissionWithinOneDay
(
withdrawTx
);
nil
!=
err
{
return
}
tokenAddr
:=
common
.
HexToAddress
(
withdrawFromChain33TokenInfo
.
Address
)
tokenAddr
:=
common
.
HexToAddress
(
withdrawFromChain33TokenInfo
.
Address
)
//从chain33进行withdraw回来的token需要根据精度进行相应的缩放
//从chain33进行withdraw回来的token需要根据精度进行相应的缩放
if
8
!=
withdrawFromChain33TokenInfo
.
Decimal
{
if
8
!=
withdrawFromChain33TokenInfo
.
Decimal
{
...
@@ -618,11 +611,17 @@ func (ethRelayer *Relayer4Ethereum) handleLogWithdraw(chain33Msg *events.Chain33
...
@@ -618,11 +611,17 @@ func (ethRelayer *Relayer4Ethereum) handleLogWithdraw(chain33Msg *events.Chain33
chain33Msg
.
Amount
.
Div
(
chain33Msg
.
Amount
,
big
.
NewInt
(
value
))
chain33Msg
.
Amount
.
Div
(
chain33Msg
.
Amount
,
big
.
NewInt
(
value
))
}
}
}
}
relayerLog
.
Info
(
"handleLogWithdraw"
,
"token address"
,
tokenAddr
.
String
(),
"amount"
,
chain33Msg
.
Amount
.
String
(),
withdrawTx
.
Amount
=
chain33Msg
.
Amount
.
String
()
relayerLog
.
Info
(
"handleLogWithdraw"
,
"token address"
,
tokenAddr
.
String
(),
"amount"
,
withdrawTx
.
Amount
,
"Receiver on Ethereum"
,
chain33Msg
.
EthereumReceiver
.
String
())
"Receiver on Ethereum"
,
chain33Msg
.
EthereumReceiver
.
String
())
//检查用户提币权限是否得到满足:比如是否超过累计提币额度
var
feeAmount
*
big
.
Int
if
feeAmount
,
err
=
ethRelayer
.
checkPermissionWithinOneDay
(
withdrawTx
);
nil
!=
err
{
return
}
if
chain33Msg
.
Amount
.
Cmp
(
feeAmount
)
<
0
{
if
chain33Msg
.
Amount
.
Cmp
(
feeAmount
)
<
0
{
relayerLog
.
Error
(
"handleLogWithdraw"
,
"ErrWithdrawAmountLessThanFee feeAmount"
,
feeAmount
.
String
(),
"Withdraw Amount"
,
chain33Msg
.
Amount
.
String
())
relayerLog
.
Error
(
"handleLogWithdraw"
,
"ErrWithdrawAmountLessThanFee feeAmount"
,
feeAmount
.
String
(),
"Withdraw Amount"
,
chain33Msg
.
Amount
.
String
())
err
=
errors
.
New
(
"ErrWithdrawAmount
LessThan
Fee"
)
err
=
errors
.
New
(
"ErrWithdrawAmount
Can'tPay4
Fee"
)
return
return
}
}
amount2transfer
:=
chain33Msg
.
Amount
.
Sub
(
chain33Msg
.
Amount
,
feeAmount
)
amount2transfer
:=
chain33Msg
.
Amount
.
Sub
(
chain33Msg
.
Amount
,
feeAmount
)
...
...
plugin/dapp/cross2eth/ebrelayer/relayer/ethereum/ethtxs/types.go
View file @
40b5c96c
...
@@ -9,9 +9,6 @@ import (
...
@@ -9,9 +9,6 @@ import (
//const ...
//const ...
const
(
const
(
X2Eth
=
"x2ethereum"
BurnAction
=
"Chain33ToEthBurn"
LockAction
=
"Chain33ToEthLock"
EthNullAddr
=
"0x0000000000000000000000000000000000000000"
EthNullAddr
=
"0x0000000000000000000000000000000000000000"
)
)
...
...
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