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
716ccb68
Commit
716ccb68
authored
Aug 19, 2021
by
mdj33
Committed by
vipwzw
Aug 26, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix ut
parent
7847aa74
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
10 deletions
+25
-10
exchangedb.go
plugin/dapp/exchange/executor/exchangedb.go
+1
-1
account.go
plugin/dapp/paracross/executor/account.go
+4
-4
relaydb_test.go
plugin/dapp/relay/executor/relaydb_test.go
+4
-1
trade.go
plugin/dapp/trade/commands/trade.go
+16
-4
No files found.
plugin/dapp/exchange/executor/exchangedb.go
View file @
716ccb68
...
...
@@ -85,7 +85,7 @@ func CheckCount(count int32) bool {
//CheckAmount 最小交易 1coin
func
CheckAmount
(
amount
,
coinPrecision
int64
)
bool
{
if
amount
<
coinPrecision
||
amount
>=
types
.
MaxCoin
{
if
amount
<
coinPrecision
||
amount
>=
types
.
MaxCoin
*
coinPrecision
{
return
false
}
return
true
...
...
plugin/dapp/paracross/executor/account.go
View file @
716ccb68
...
...
@@ -41,8 +41,8 @@ func NewMainAccount(cfg *types.Chain33Config, paraTitle, paraExecName, paraSymbo
}
func
assetDepositBalance
(
acc
*
account
.
DB
,
addr
string
,
amount
int64
)
(
*
types
.
Receipt
,
error
)
{
if
err
:=
acc
.
CheckAmount
(
amount
);
err
!=
nil
{
return
nil
,
err
if
!
acc
.
CheckAmount
(
amount
)
{
return
nil
,
types
.
ErrAmount
}
acc1
:=
acc
.
LoadAccount
(
addr
)
copyacc
:=
*
acc1
...
...
@@ -66,8 +66,8 @@ func assetDepositBalance(acc *account.DB, addr string, amount int64) (*types.Rec
}
func
assetWithdrawBalance
(
acc
*
account
.
DB
,
addr
string
,
amount
int64
)
(
*
types
.
Receipt
,
error
)
{
if
err
:=
acc
.
CheckAmount
(
amount
);
err
!=
nil
{
return
nil
,
err
if
!
acc
.
CheckAmount
(
amount
)
{
return
nil
,
types
.
ErrAmount
}
acc1
:=
acc
.
LoadAccount
(
addr
)
if
acc1
.
Balance
-
amount
<
0
{
...
...
plugin/dapp/relay/executor/relaydb_test.go
View file @
716ccb68
...
...
@@ -5,6 +5,7 @@
package
executor
import
(
"strings"
"testing"
apimock
"github.com/33cn/chain33/client/mocks"
...
...
@@ -39,7 +40,9 @@ func (s *suiteRelayLog) SetupSuite() {
}
s
.
db
=
new
(
mocks
.
KV
)
s
.
log
=
newRelayLog
(
order
)
cfg
:=
types
.
NewChain33Config
(
strings
.
Replace
(
types
.
GetDefaultCfgstring
(),
"Title=
\"
local
\"
"
,
"Title=
\"
chain33
\"
"
,
1
))
s
.
log
=
newRelayLog
(
order
,
cfg
)
}
func
(
s
*
suiteRelayLog
)
TestSave
()
{
...
...
plugin/dapp/trade/commands/trade.go
View file @
716ccb68
...
...
@@ -542,10 +542,16 @@ func tokenSell(cmd *cobra.Command, args []string) {
fmt
.
Fprintln
(
os
.
Stderr
,
errors
.
Wrapf
(
err
,
"FormatFloatDisplay2Value.fee"
))
return
}
totalInt64
:=
int64
(
total
*
1e8
/
1e6
)
//缺省一手是0.01个coin,如果精度小于100,就是1
oneHand
:=
int64
(
1
)
if
cfg
.
CoinPrecision
>
1e2
{
oneHand
=
cfg
.
CoinPrecision
/
1e2
}
totalInt64
:=
int64
(
total
*
float64
(
cfg
.
CoinPrecision
)
/
float64
(
oneHand
))
params
:=
&
pty
.
TradeSellTx
{
TokenSymbol
:
symbol
,
AmountPerBoardlot
:
1e6
,
AmountPerBoardlot
:
oneHand
,
MinBoardlot
:
min
,
PricePerBoardlot
:
priceInt64
,
TotalBoardlot
:
totalInt64
,
...
...
@@ -710,10 +716,16 @@ func tokenBuyLimit(cmd *cobra.Command, args []string) {
fmt
.
Fprintln
(
os
.
Stderr
,
errors
.
Wrapf
(
err
,
"FormatFloatDisplay2Value.fee"
))
return
}
totalInt64
:=
int64
(
total
*
1e8
/
1e6
)
//缺省一手是0.01个coin,如果精度小于100,就是1
oneHand
:=
int64
(
1
)
if
cfg
.
CoinPrecision
>
1e2
{
oneHand
=
cfg
.
CoinPrecision
/
1e2
}
totalInt64
:=
int64
(
total
*
float64
(
cfg
.
CoinPrecision
)
/
float64
(
oneHand
))
params
:=
&
pty
.
TradeBuyLimitTx
{
TokenSymbol
:
symbol
,
AmountPerBoardlot
:
1e6
,
AmountPerBoardlot
:
oneHand
,
MinBoardlot
:
min
,
PricePerBoardlot
:
priceInt64
,
TotalBoardlot
:
totalInt64
,
...
...
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