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
bdf8e51e
Commit
bdf8e51e
authored
Dec 09, 2019
by
vipwzw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto ci
parent
5d9da776
Hide whitespace changes
Inline
Side-by-side
Showing
25 changed files
with
807 additions
and
584 deletions
+807
-584
build.sh
plugin/dapp/collateralize/cmd/build.sh
+0
-1
test-rpc.sh
plugin/dapp/collateralize/cmd/test/test-rpc.sh
+1
-1
cmd.go
plugin/dapp/collateralize/commands/cmd.go
+11
-10
collateralize.go
plugin/dapp/collateralize/executor/collateralize.go
+14
-15
collateralize_test.go
plugin/dapp/collateralize/executor/collateralize_test.go
+33
-40
collateralizedb.go
plugin/dapp/collateralize/executor/collateralizedb.go
+35
-35
exec_del_local.go
plugin/dapp/collateralize/executor/exec_del_local.go
+1
-2
keys.go
plugin/dapp/collateralize/executor/keys.go
+1
-2
query.go
plugin/dapp/collateralize/executor/query.go
+33
-34
collateralize.go
plugin/dapp/collateralize/types/collateralize.go
+23
-23
collateralize.pb.go
plugin/dapp/collateralize/types/collateralize.pb.go
+251
-122
tx.go
plugin/dapp/collateralize/types/tx.go
+23
-23
types.go
plugin/dapp/collateralize/types/types.go
+9
-10
test-rpc.sh
plugin/dapp/issuance/cmd/test/test-rpc.sh
+12
-12
cmd.go
plugin/dapp/issuance/commands/cmd.go
+9
-8
exec_del_local.go
plugin/dapp/issuance/executor/exec_del_local.go
+1
-2
issuance.go
plugin/dapp/issuance/executor/issuance.go
+15
-16
issuance_test.go
plugin/dapp/issuance/executor/issuance_test.go
+29
-34
issuancedb.go
plugin/dapp/issuance/executor/issuancedb.go
+25
-24
keys.go
plugin/dapp/issuance/executor/keys.go
+1
-2
query.go
plugin/dapp/issuance/executor/query.go
+25
-26
issuance.go
plugin/dapp/issuance/types/issuance.go
+11
-12
issuance.pb.go
plugin/dapp/issuance/types/issuance.pb.go
+221
-106
tx.go
plugin/dapp/issuance/types/tx.go
+15
-15
types.go
plugin/dapp/issuance/types/types.go
+8
-9
No files found.
plugin/dapp/collateralize/cmd/build.sh
View file @
bdf8e51e
...
...
@@ -7,4 +7,3 @@ strapp=${strcmd%/cmd*}
OUT_TESTDIR
=
"
${
1
}
/dapptest/
$strapp
"
mkdir
-p
"
${
OUT_TESTDIR
}
"
cp
./test/test-rpc.sh
"
${
OUT_TESTDIR
}
"
plugin/dapp/collateralize/cmd/test/test-rpc.sh
View file @
bdf8e51e
...
...
@@ -7,7 +7,7 @@ set -o pipefail
source
../dapp-test-common.sh
function
main
()
{
echo
"Collateralize cases has integrated in Issuance test"
echo
"Collateralize cases has integrated in Issuance test"
}
chain33_debug_function main
"
$1
"
plugin/dapp/collateralize/commands/cmd.go
View file @
bdf8e51e
...
...
@@ -2,12 +2,13 @@ package commands
import
(
"fmt"
"github.com/spf13/cobra"
"strconv"
jsonrpc
"github.com/33cn/chain33/rpc/jsonclient"
rpctypes
"github.com/33cn/chain33/rpc/types"
"github.com/33cn/chain33/types"
pkt
"github.com/33cn/plugin/plugin/dapp/collateralize/types"
"
strconv
"
"
github.com/spf13/cobra
"
)
// CollateralizeCmd 斗牛游戏命令行
...
...
@@ -308,7 +309,7 @@ func CollateralizeManage(cmd *cobra.Command, args []string) {
params
:=
&
rpctypes
.
CreateTxIn
{
Execer
:
cfg
.
ExecName
(
pkt
.
CollateralizeX
),
ActionName
:
"CollateralizeManage"
,
Payload
:
[]
byte
(
fmt
.
Sprintf
(
"{
\"
debtCeiling
\"
:%f,
\"
liquidationRatio
\"
:%f,
\"
stabilityFeeRatio
\"
:%f,
\"
period
\"
:%d,
\"
totalBalance
\"
:%f}"
,
Payload
:
[]
byte
(
fmt
.
Sprintf
(
"{
\"
debtCeiling
\"
:%f,
\"
liquidationRatio
\"
:%f,
\"
stabilityFeeRatio
\"
:%f,
\"
period
\"
:%d,
\"
totalBalance
\"
:%f}"
,
debtCeiling
,
liquidationRatio
,
stabilityFeeRatio
,
period
,
totalBalance
)),
}
...
...
@@ -416,13 +417,13 @@ func CollateralizeQuery(cmd *cobra.Command, args []string) {
}
if
collateralizeID
!=
""
{
if
address
!=
""
{
if
address
!=
""
{
params
.
FuncName
=
"CollateralizeRecordByAddr"
req
:=
&
pkt
.
ReqCollateralizeRecordByAddr
{
CollateralizeId
:
collateralizeID
,
Status
:
int32
(
status
),
Addr
:
address
,
Status
:
int32
(
status
),
Addr
:
address
,
}
params
.
Payload
=
types
.
MustPBToJSON
(
req
)
var
res
pkt
.
RepCollateralizeRecords
...
...
@@ -433,18 +434,18 @@ func CollateralizeQuery(cmd *cobra.Command, args []string) {
req
:=
&
pkt
.
ReqCollateralizeRecordByStatus
{
CollateralizeId
:
collateralizeID
,
Status
:
int32
(
status
),
Status
:
int32
(
status
),
}
params
.
Payload
=
types
.
MustPBToJSON
(
req
)
var
res
pkt
.
RepCollateralizeRecords
ctx
:=
jsonrpc
.
NewRPCCtx
(
rpcLaddr
,
"Chain33.Query"
,
params
,
&
res
)
ctx
.
Run
()
}
else
if
borrowID
!=
""
{
}
else
if
borrowID
!=
""
{
params
.
FuncName
=
"CollateralizeRecordByID"
req
:=
&
pkt
.
ReqCollateralizeRecord
{
CollateralizeId
:
collateralizeID
,
RecordId
:
borrowID
,
RecordId
:
borrowID
,
}
params
.
Payload
=
types
.
MustPBToJSON
(
req
)
var
res
pkt
.
RepCollateralizeRecord
...
...
@@ -472,7 +473,7 @@ func CollateralizeQuery(cmd *cobra.Command, args []string) {
}
else
if
statusStr
!=
""
{
params
.
FuncName
=
"CollateralizeByStatus"
req
:=
&
pkt
.
ReqCollateralizeByStatus
{
Status
:
int32
(
status
)}
req
:=
&
pkt
.
ReqCollateralizeByStatus
{
Status
:
int32
(
status
)}
params
.
Payload
=
types
.
MustPBToJSON
(
req
)
var
res
pkt
.
RepCollateralizeIDs
ctx
:=
jsonrpc
.
NewRPCCtx
(
rpcLaddr
,
"Chain33.Query"
,
params
,
&
res
)
...
...
plugin/dapp/collateralize/executor/collateralize.go
View file @
bdf8e51e
...
...
@@ -63,8 +63,8 @@ func (c *Collateralize) GetDriverName() string {
func
(
c
*
Collateralize
)
addCollateralizeID
(
collateralizeId
string
,
index
int64
)
(
kvs
[]
*
types
.
KeyValue
)
{
key
:=
calcCollateralizeKey
(
collateralizeId
,
index
)
record
:=
&
pty
.
CollateralizeRecord
{
CollateralizeId
:
collateralizeId
,
Index
:
index
,
CollateralizeId
:
collateralizeId
,
Index
:
index
,
}
kv
:=
&
types
.
KeyValue
{
Key
:
key
,
Value
:
types
.
Encode
(
record
)}
...
...
@@ -83,8 +83,8 @@ func (c *Collateralize) deleteCollateralizeID(collateralizeId string, index int6
func
(
c
*
Collateralize
)
addCollateralizeStatus
(
status
int32
,
collateralizeId
string
,
index
int64
)
(
kvs
[]
*
types
.
KeyValue
)
{
key
:=
calcCollateralizeStatusKey
(
status
,
index
)
record
:=
&
pty
.
CollateralizeRecord
{
CollateralizeId
:
collateralizeId
,
Index
:
index
,
CollateralizeId
:
collateralizeId
,
Index
:
index
,
}
kv
:=
&
types
.
KeyValue
{
Key
:
key
,
Value
:
types
.
Encode
(
record
)}
...
...
@@ -103,9 +103,9 @@ func (c *Collateralize) deleteCollateralizeStatus(status int32, index int64) (kv
func
(
c
*
Collateralize
)
addCollateralizeAddr
(
addr
string
,
collateralizeId
string
,
status
int32
,
index
int64
)
(
kvs
[]
*
types
.
KeyValue
)
{
key
:=
calcCollateralizeAddrKey
(
addr
,
index
)
record
:=
&
pty
.
CollateralizeRecord
{
CollateralizeId
:
collateralizeId
,
Status
:
status
,
Index
:
index
,
CollateralizeId
:
collateralizeId
,
Status
:
status
,
Index
:
index
,
}
kv
:=
&
types
.
KeyValue
{
Key
:
key
,
Value
:
types
.
Encode
(
record
)}
...
...
@@ -125,9 +125,9 @@ func (c *Collateralize) addCollateralizeRecordStatus(recordStatus int32, collate
key
:=
calcCollateralizeRecordStatusKey
(
recordStatus
,
index
)
record
:=
&
pty
.
CollateralizeRecord
{
CollateralizeId
:
collateralizeId
,
RecordId
:
recordId
,
Index
:
index
,
CollateralizeId
:
collateralizeId
,
RecordId
:
recordId
,
Index
:
index
,
}
kv
:=
&
types
.
KeyValue
{
Key
:
key
,
Value
:
types
.
Encode
(
record
)}
...
...
@@ -147,9 +147,9 @@ func (c *Collateralize) addCollateralizeRecordAddr(recordAddr string, collateral
key
:=
calcCollateralizeRecordAddrKey
(
recordAddr
,
index
)
record
:=
&
pty
.
CollateralizeRecord
{
CollateralizeId
:
collateralizeId
,
RecordId
:
recordId
,
Index
:
index
,
CollateralizeId
:
collateralizeId
,
RecordId
:
recordId
,
Index
:
index
,
}
kv
:=
&
types
.
KeyValue
{
Key
:
key
,
Value
:
types
.
Encode
(
record
)}
...
...
@@ -177,4 +177,4 @@ func (c *Collateralize) ExecutorOrder() int64 {
return
drivers
.
ExecLocalSameTime
}
return
c
.
DriverBase
.
ExecutorOrder
()
}
\ No newline at end of file
}
plugin/dapp/collateralize/executor/collateralize_test.go
View file @
bdf8e51e
package
executor
import
(
"github.com/33cn/chain33/client"
"testing"
"time"
"github.com/33cn/chain33/client"
"github.com/33cn/chain33/account"
apimock
"github.com/33cn/chain33/client/mocks"
"github.com/33cn/chain33/common"
...
...
@@ -40,7 +41,7 @@ var (
[]
byte
(
"1JRNjdEqp4LJ5fqycUBm9ayCKSeeskgMKR"
),
[]
byte
(
"12evczYyX9ZKPYvwSEvRkRyTjpSrJuLudg"
),
}
total
=
10000
*
types
.
Coin
total
=
10000
*
types
.
Coin
totalToken
=
100000
*
types
.
Coin
)
...
...
@@ -94,7 +95,7 @@ func initEnv() *execEnv {
Addr
:
string
(
Nodes
[
1
]),
}
accountBToken
:=
types
.
Account
{
Balance
:
types
.
Coin
/
10
,
Balance
:
types
.
Coin
/
10
,
Frozen
:
0
,
Addr
:
string
(
Nodes
[
1
]),
}
...
...
@@ -115,14 +116,14 @@ func initEnv() *execEnv {
accA
.
SaveExecAccount
(
execAddr
,
&
accountA
)
manageKeySet
(
"issuance-manage"
,
accountA
.
Addr
,
stateDB
)
addrKeySet
(
accountA
.
Addr
,
stateDB
)
tokenAccA
,
_
:=
account
.
NewAccountDB
(
cfg
,
tokenE
.
GetName
(),
pkt
.
CCNYTokenName
,
stateDB
)
tokenAccA
,
_
:=
account
.
NewAccountDB
(
cfg
,
tokenE
.
GetName
(),
pkt
.
CCNYTokenName
,
stateDB
)
tokenAccA
.
SaveExecAccount
(
execAddr
,
&
accountAToken
)
accB
:=
account
.
NewCoinsAccount
(
cfg
)
accB
.
SetDB
(
stateDB
)
accB
.
SaveExecAccount
(
execAddr
,
&
accountB
)
manageKeySet
(
"issuance-price-feed"
,
accountB
.
Addr
,
stateDB
)
tokenAccB
,
_
:=
account
.
NewAccountDB
(
cfg
,
tokenE
.
GetName
(),
pkt
.
CCNYTokenName
,
stateDB
)
tokenAccB
,
_
:=
account
.
NewAccountDB
(
cfg
,
tokenE
.
GetName
(),
pkt
.
CCNYTokenName
,
stateDB
)
tokenAccB
.
SaveExecAccount
(
execAddr
,
&
accountBToken
)
accC
:=
account
.
NewCoinsAccount
(
cfg
)
...
...
@@ -131,14 +132,14 @@ func initEnv() *execEnv {
manageKeySet
(
"issuance-guarantor"
,
accountC
.
Addr
,
stateDB
)
return
&
execEnv
{
blockTime
:
time
.
Now
()
.
Unix
(),
blockHeight
:
cfg
.
GetDappFork
(
pkt
.
CollateralizeX
,
"Enable"
),
difficulty
:
1539918074
,
kvdb
:
kvdb
,
api
:
api
,
db
:
stateDB
,
execAddr
:
execAddr
,
cfg
:
cfg
,
blockTime
:
time
.
Now
()
.
Unix
(),
blockHeight
:
cfg
.
GetDappFork
(
pkt
.
CollateralizeX
,
"Enable"
),
difficulty
:
1539918074
,
kvdb
:
kvdb
,
api
:
api
,
db
:
stateDB
,
execAddr
:
execAddr
,
cfg
:
cfg
,
}
}
...
...
@@ -185,7 +186,6 @@ func TestCollateralize(t *testing.T) {
env
.
kvdb
.
Set
(
kv
.
Key
,
kv
.
Value
)
}
// collateralize create
p1
:=
&
pkt
.
CollateralizeCreateTx
{
TotalBalance
:
1000
,
...
...
@@ -216,21 +216,20 @@ func TestCollateralize(t *testing.T) {
}
collateralizeID
:=
createTx
.
Hash
()
// query collateralize by id
res
,
err
:=
exec
.
Query
(
"CollateralizeInfoByID"
,
types
.
Encode
(
&
pkt
.
ReqCollateralizeInfo
{
CollateralizeId
:
common
.
ToHex
(
collateralizeID
)
,
}))
res
,
err
:=
exec
.
Query
(
"CollateralizeInfoByID"
,
types
.
Encode
(
&
pkt
.
ReqCollateralizeInfo
{
CollateralizeId
:
common
.
ToHex
(
collateralizeID
)}))
assert
.
Nil
(
t
,
err
)
assert
.
NotNil
(
t
,
res
)
// query collateralize by status
res
,
err
=
exec
.
Query
(
"CollateralizeByStatus"
,
types
.
Encode
(
&
pkt
.
ReqCollateralizeByStatus
{
Status
:
1
}))
res
,
err
=
exec
.
Query
(
"CollateralizeByStatus"
,
types
.
Encode
(
&
pkt
.
ReqCollateralizeByStatus
{
Status
:
1
}))
assert
.
Nil
(
t
,
err
)
assert
.
NotNil
(
t
,
res
)
// query collateralizes by ids
var
collateralizeIDsS
[]
string
collateralizeIDsS
=
append
(
collateralizeIDsS
,
common
.
ToHex
(
collateralizeID
))
res
,
err
=
exec
.
Query
(
"CollateralizeInfoByIDs"
,
types
.
Encode
(
&
pkt
.
ReqCollateralizeInfos
{
CollateralizeIds
:
collateralizeIDsS
}))
res
,
err
=
exec
.
Query
(
"CollateralizeInfoByIDs"
,
types
.
Encode
(
&
pkt
.
ReqCollateralizeInfos
{
CollateralizeIds
:
collateralizeIDsS
}))
assert
.
Nil
(
t
,
err
)
assert
.
NotNil
(
t
,
res
)
// collateralize price
p2
:=
&
pkt
.
CollateralizeFeedTx
{}
p2
.
Price
=
append
(
p2
.
Price
,
1
)
...
...
@@ -265,11 +264,10 @@ func TestCollateralize(t *testing.T) {
assert
.
Nil
(
t
,
err
)
assert
.
NotNil
(
t
,
res
)
// collateralize borrow
p4
:=
&
pkt
.
CollateralizeBorrowTx
{
CollateralizeID
:
common
.
ToHex
(
collateralizeID
),
Value
:
100
,
Value
:
100
,
}
createTx
,
err
=
pkt
.
CreateRawCollateralizeBorrowTx
(
env
.
cfg
,
p4
)
if
err
!=
nil
{
...
...
@@ -304,21 +302,20 @@ func TestCollateralize(t *testing.T) {
assert
.
NotNil
(
t
,
res
)
// query collateralize by status
res
,
err
=
exec
.
Query
(
"CollateralizeRecordByStatus"
,
types
.
Encode
(
&
pkt
.
ReqCollateralizeRecordByStatus
{
CollateralizeId
:
common
.
ToHex
(
collateralizeID
),
Status
:
1
}))
types
.
Encode
(
&
pkt
.
ReqCollateralizeRecordByStatus
{
CollateralizeId
:
common
.
ToHex
(
collateralizeID
),
Status
:
1
}))
assert
.
Nil
(
t
,
err
)
assert
.
NotNil
(
t
,
res
)
// query collateralize by addr
res
,
err
=
exec
.
Query
(
"CollateralizeRecordByAddr"
,
types
.
Encode
(
&
pkt
.
ReqCollateralizeRecordByAddr
{
CollateralizeId
:
common
.
ToHex
(
collateralizeID
),
Addr
:
string
(
Nodes
[
1
]),
Status
:
1
}))
types
.
Encode
(
&
pkt
.
ReqCollateralizeRecordByAddr
{
CollateralizeId
:
common
.
ToHex
(
collateralizeID
),
Addr
:
string
(
Nodes
[
1
]),
Status
:
1
}))
assert
.
Nil
(
t
,
err
)
assert
.
NotNil
(
t
,
res
)
// collateralize append
p5
:=
&
pkt
.
CollateralizeAppendTx
{
CollateralizeID
:
common
.
ToHex
(
collateralizeID
),
RecordID
:
common
.
ToHex
(
borrowID
),
Value
:
100
,
RecordID
:
common
.
ToHex
(
borrowID
),
Value
:
100
,
}
createTx
,
err
=
pkt
.
CreateRawCollateralizeAppendTx
(
env
.
cfg
,
p5
)
if
err
!=
nil
{
...
...
@@ -352,20 +349,19 @@ func TestCollateralize(t *testing.T) {
assert
.
NotNil
(
t
,
res
)
// query collateralize by status
res
,
err
=
exec
.
Query
(
"CollateralizeRecordByStatus"
,
types
.
Encode
(
&
pkt
.
ReqCollateralizeRecordByStatus
{
CollateralizeId
:
common
.
ToHex
(
collateralizeID
),
Status
:
1
}))
types
.
Encode
(
&
pkt
.
ReqCollateralizeRecordByStatus
{
CollateralizeId
:
common
.
ToHex
(
collateralizeID
),
Status
:
1
}))
assert
.
Nil
(
t
,
err
)
assert
.
NotNil
(
t
,
res
)
// query collateralize by addr
res
,
err
=
exec
.
Query
(
"CollateralizeRecordByAddr"
,
types
.
Encode
(
&
pkt
.
ReqCollateralizeRecordByAddr
{
CollateralizeId
:
common
.
ToHex
(
collateralizeID
),
Addr
:
string
(
Nodes
[
1
]),
Status
:
1
}))
types
.
Encode
(
&
pkt
.
ReqCollateralizeRecordByAddr
{
CollateralizeId
:
common
.
ToHex
(
collateralizeID
),
Addr
:
string
(
Nodes
[
1
]),
Status
:
1
}))
assert
.
Nil
(
t
,
err
)
assert
.
NotNil
(
t
,
res
)
// collateralize repay
p6
:=
&
pkt
.
CollateralizeRepayTx
{
CollateralizeID
:
common
.
ToHex
(
collateralizeID
),
RecordID
:
common
.
ToHex
(
borrowID
),
RecordID
:
common
.
ToHex
(
borrowID
),
}
createTx
,
err
=
pkt
.
CreateRawCollateralizeRepayTx
(
env
.
cfg
,
p6
)
if
err
!=
nil
{
...
...
@@ -394,20 +390,19 @@ func TestCollateralize(t *testing.T) {
}
// query collateralize by status
res
,
err
=
exec
.
Query
(
"CollateralizeRecordByStatus"
,
types
.
Encode
(
&
pkt
.
ReqCollateralizeRecordByStatus
{
CollateralizeId
:
common
.
ToHex
(
collateralizeID
),
Status
:
6
}))
types
.
Encode
(
&
pkt
.
ReqCollateralizeRecordByStatus
{
CollateralizeId
:
common
.
ToHex
(
collateralizeID
),
Status
:
6
}))
assert
.
Nil
(
t
,
err
)
assert
.
NotNil
(
t
,
res
)
// query collateralize by addr
res
,
err
=
exec
.
Query
(
"CollateralizeRecordByAddr"
,
types
.
Encode
(
&
pkt
.
ReqCollateralizeRecordByAddr
{
CollateralizeId
:
common
.
ToHex
(
collateralizeID
),
Addr
:
string
(
Nodes
[
1
]),
Status
:
6
}))
types
.
Encode
(
&
pkt
.
ReqCollateralizeRecordByAddr
{
CollateralizeId
:
common
.
ToHex
(
collateralizeID
),
Addr
:
string
(
Nodes
[
1
]),
Status
:
6
}))
assert
.
Nil
(
t
,
err
)
assert
.
NotNil
(
t
,
res
)
// collateralize liquidate
p7
:=
&
pkt
.
CollateralizeBorrowTx
{
CollateralizeID
:
common
.
ToHex
(
collateralizeID
),
Value
:
100
,
Value
:
100
,
}
createTx
,
err
=
pkt
.
CreateRawCollateralizeBorrowTx
(
env
.
cfg
,
p7
)
if
err
!=
nil
{
...
...
@@ -465,15 +460,14 @@ func TestCollateralize(t *testing.T) {
}
// query collateralize by status
res
,
err
=
exec
.
Query
(
"CollateralizeRecordByStatus"
,
types
.
Encode
(
&
pkt
.
ReqCollateralizeRecordByStatus
{
CollateralizeId
:
common
.
ToHex
(
collateralizeID
),
Status
:
3
}))
types
.
Encode
(
&
pkt
.
ReqCollateralizeRecordByStatus
{
CollateralizeId
:
common
.
ToHex
(
collateralizeID
),
Status
:
3
}))
assert
.
Nil
(
t
,
err
)
assert
.
NotNil
(
t
,
res
)
// expire liquidate
p9
:=
&
pkt
.
CollateralizeBorrowTx
{
CollateralizeID
:
common
.
ToHex
(
collateralizeID
),
Value
:
100
,
Value
:
100
,
}
createTx
,
err
=
pkt
.
CreateRawCollateralizeBorrowTx
(
env
.
cfg
,
p9
)
if
err
!=
nil
{
...
...
@@ -531,15 +525,14 @@ func TestCollateralize(t *testing.T) {
}
// query collateralize by status
res
,
err
=
exec
.
Query
(
"CollateralizeRecordByStatus"
,
types
.
Encode
(
&
pkt
.
ReqCollateralizeRecordByStatus
{
CollateralizeId
:
common
.
ToHex
(
collateralizeID
),
Status
:
5
}))
types
.
Encode
(
&
pkt
.
ReqCollateralizeRecordByStatus
{
CollateralizeId
:
common
.
ToHex
(
collateralizeID
),
Status
:
5
}))
assert
.
Nil
(
t
,
err
)
assert
.
NotNil
(
t
,
res
)
// collateralize retrieve
p11
:=
&
pkt
.
CollateralizeRetrieveTx
{
CollateralizeID
:
common
.
ToHex
(
collateralizeID
),
Balance
:
100
,
Balance
:
100
,
}
createTx
,
err
=
pkt
.
CreateRawCollateralizeRetrieveTx
(
env
.
cfg
,
p11
)
if
err
!=
nil
{
...
...
@@ -567,7 +560,7 @@ func TestCollateralize(t *testing.T) {
env
.
kvdb
.
Set
(
kv
.
Key
,
kv
.
Value
)
}
// query collateralize by status
res
,
err
=
exec
.
Query
(
"CollateralizeByStatus"
,
types
.
Encode
(
&
pkt
.
ReqCollateralizeByStatus
{
Status
:
1
}))
res
,
err
=
exec
.
Query
(
"CollateralizeByStatus"
,
types
.
Encode
(
&
pkt
.
ReqCollateralizeByStatus
{
Status
:
1
}))
assert
.
Nil
(
t
,
err
)
assert
.
NotNil
(
t
,
res
)
}
...
...
plugin/dapp/collateralize/executor/collateralizedb.go
View file @
bdf8e51e
...
...
@@ -6,6 +6,8 @@ package executor
import
(
"fmt"
"math"
"github.com/33cn/chain33/account"
"github.com/33cn/chain33/common"
dbm
"github.com/33cn/chain33/common/db"
...
...
@@ -14,7 +16,6 @@ import (
pty
"github.com/33cn/plugin/plugin/dapp/collateralize/types"
issuanceE
"github.com/33cn/plugin/plugin/dapp/issuance/types"
tokenE
"github.com/33cn/plugin/plugin/dapp/token/executor"
"math"
)
// List control
...
...
@@ -83,18 +84,18 @@ func PriceKey() (key []byte) {
// Action struct
type
Action
struct
{
coinsAccount
*
account
.
DB
// bty账户
tokenAccount
*
account
.
DB
// ccny账户
db
dbm
.
KV
localDB
dbm
.
Lister
txhash
[]
byte
fromaddr
string
blocktime
int64
height
int64
execaddr
string
difficulty
uint64
index
int
Collateralize
*
Collateralize
coinsAccount
*
account
.
DB
// bty账户
tokenAccount
*
account
.
DB
// ccny账户
db
dbm
.
KV
localDB
dbm
.
Lister
txhash
[]
byte
fromaddr
string
blocktime
int64
height
int64
execaddr
string
difficulty
uint64
index
int
Collateralize
*
Collateralize
}
// NewCollateralizeAction generate New Action
...
...
@@ -109,7 +110,7 @@ func NewCollateralizeAction(c *Collateralize, tx *types.Transaction, index int)
}
return
&
Action
{
coinsAccount
:
c
.
GetCoinsAccount
(),
tokenAccount
:
tokenDb
,
db
:
c
.
GetStateDB
(),
localDB
:
c
.
GetLocalDB
(),
coinsAccount
:
c
.
GetCoinsAccount
(),
tokenAccount
:
tokenDb
,
db
:
c
.
GetStateDB
(),
localDB
:
c
.
GetLocalDB
(),
txhash
:
hash
,
fromaddr
:
fromaddr
,
blocktime
:
c
.
GetBlockTime
(),
height
:
c
.
GetHeight
(),
execaddr
:
dapp
.
ExecAddress
(
string
(
tx
.
Execer
)),
difficulty
:
c
.
GetDifficulty
(),
index
:
index
,
Collateralize
:
c
}
}
...
...
@@ -283,7 +284,7 @@ func (action *Action) CollateralizeManage(manage *pty.CollateralizeManage) (*typ
collConfig
:=
&
pty
.
CollateralizeManage
{}
if
manage
.
StabilityFeeRatio
!=
0
{
collConfig
.
StabilityFeeRatio
=
manage
.
StabilityFeeRatio
}
else
{
}
else
{
collConfig
.
StabilityFeeRatio
=
manConfig
.
StabilityFeeRatio
}
...
...
@@ -336,7 +337,6 @@ func getCollateralizeConfig(db dbm.KV) (*pty.CollateralizeManage, error) {
return
&
collCfg
,
nil
}
func
isSuperAddr
(
addr
string
,
db
dbm
.
KV
)
bool
{
data
,
err
:=
db
.
Get
(
AddrKey
())
if
err
!=
nil
{
...
...
@@ -395,25 +395,25 @@ func (action *Action) CollateralizeCreate(create *pty.CollateralizeCreate) (*typ
// 参数检查
if
create
.
GetTotalBalance
()
<=
0
{
clog
.
Error
(
"CollateralizeCreate"
,
"addr"
,
action
.
fromaddr
,
"execaddr"
,
action
.
execaddr
,
"total balance"
,
create
.
GetTotalBalance
(),
"error"
,
types
.
ErrAmount
)
return
nil
,
types
.
ErrAmount
return
nil
,
types
.
ErrAmount
}
// 获取借贷配置
collcfg
,
err
:=
getCollateralizeConfig
(
action
.
db
)
if
err
!=
nil
{
clog
.
Error
(
"CollateralizeCreate.getCollateralizeConfig"
,
"addr"
,
action
.
fromaddr
,
"error"
,
err
)
return
nil
,
err
return
nil
,
err
}
// 判断当前可放贷金额
reBalance
,
err
:=
getCollBalance
(
collcfg
.
TotalBalance
,
action
.
localDB
,
action
.
db
)
if
err
!=
nil
{
clog
.
Error
(
"CollateralizeCreate.getCollBalance"
,
"addr"
,
action
.
fromaddr
,
"error"
,
err
)
return
nil
,
err
return
nil
,
err
}
if
reBalance
<
create
.
GetTotalBalance
()
{
clog
.
Error
(
"CollateralizeCreate.getCollBalance"
,
"addr"
,
action
.
fromaddr
,
"collBalance"
,
reBalance
,
"create.balance"
,
create
.
GetTotalBalance
(),
"error"
,
pty
.
ErrCollateralizeLowBalance
)
return
nil
,
pty
.
ErrCollateralizeLowBalance
return
nil
,
pty
.
ErrCollateralizeLowBalance
}
// 检查ccny余额
...
...
@@ -482,15 +482,15 @@ func (action *Action) CollateralizeCreate(create *pty.CollateralizeCreate) (*typ
}
// 根据最近抵押物价格计算需要冻结的BTY数量
func
getBtyNumToFrozen
(
value
int64
,
price
float64
,
ratio
float64
)
(
int64
,
error
)
{
func
getBtyNumToFrozen
(
value
int64
,
price
float64
,
ratio
float64
)
(
int64
,
error
)
{
if
price
==
0
{
clog
.
Error
(
"Bty price should greate to 0"
)
return
0
,
pty
.
ErrPriceInvalid
}
valueReal
:=
float64
(
value
)
/
1e8
btyValue
:=
valueReal
/
(
price
*
ratio
)
return
int64
(
math
.
Trunc
((
btyValue
+
0.0000001
)
*
1e4
))
*
1e4
,
nil
valueReal
:=
float64
(
value
)
/
1e8
btyValue
:=
valueReal
/
(
price
*
ratio
)
return
int64
(
math
.
Trunc
((
btyValue
+
0.0000001
)
*
1e4
))
*
1e4
,
nil
}
// 计算清算价格
...
...
@@ -567,7 +567,7 @@ func (action *Action) CollateralizeBorrow(borrow *pty.CollateralizeBorrow) (*typ
// 借贷金额检查
if
borrow
.
GetValue
()
<=
0
{
clog
.
Error
(
"CollateralizeBorrow"
,
"CollID"
,
coll
.
CollateralizeId
,
"addr"
,
action
.
fromaddr
,
"execaddr"
,
action
.
execaddr
,
"borrow value"
,
borrow
.
GetValue
(),
"error"
,
types
.
ErrInvalidParam
)
return
nil
,
types
.
ErrAmount
return
nil
,
types
.
ErrAmount
}
// 借贷金额不超过个人限额
...
...
@@ -703,8 +703,8 @@ func (action *Action) CollateralizeRepay(repay *pty.CollateralizeRepay) (*types.
}
// 借贷金额+利息
fee
:=
(
float64
(
borrowRecord
.
DebtValue
)
/
1e8
)
*
float64
(
coll
.
StabilityFeeRatio
)
realRepay
:=
borrowRecord
.
DebtValue
+
int64
(
math
.
Trunc
((
fee
+
0.0000001
)
*
1e4
))
*
1e4
fee
:=
(
float64
(
borrowRecord
.
DebtValue
)
/
1e8
)
*
float64
(
coll
.
StabilityFeeRatio
)
realRepay
:=
borrowRecord
.
DebtValue
+
int64
(
math
.
Trunc
((
fee
+
0.0000001
)
*
1e4
))
*
1e4
// 检查
if
!
action
.
CheckExecTokenAccount
(
action
.
fromaddr
,
realRepay
,
false
)
{
...
...
@@ -770,7 +770,7 @@ func (action *Action) CollateralizeAppend(cAppend *pty.CollateralizeAppend) (*ty
// 参数检查
if
cAppend
.
GetCollateralValue
()
<=
0
{
clog
.
Error
(
"CollateralizeAppend"
,
"addr"
,
action
.
fromaddr
,
"execaddr"
,
action
.
execaddr
,
"append value"
,
cAppend
.
GetCollateralValue
(),
"error"
,
types
.
ErrAmount
)
return
nil
,
types
.
ErrAmount
return
nil
,
types
.
ErrAmount
}
// 查找对应的借贷ID
...
...
@@ -838,7 +838,7 @@ func (action *Action) CollateralizeAppend(cAppend *pty.CollateralizeAppend) (*ty
borrowRecord
.
CollateralValue
+=
cAppend
.
CollateralValue
borrowRecord
.
CollateralPrice
=
lastPrice
borrowRecord
.
LiquidationPrice
=
calcLiquidationPrice
(
borrowRecord
.
DebtValue
,
borrowRecord
.
CollateralValue
)
if
borrowRecord
.
LiquidationPrice
*
PriceWarningRate
<
lastPrice
{
if
borrowRecord
.
LiquidationPrice
*
PriceWarningRate
<
lastPrice
{
// 告警解除
if
borrowRecord
.
Status
==
pty
.
CollateralizeUserStatusWarning
{
borrowRecord
.
PreStatus
=
borrowRecord
.
Status
...
...
@@ -927,7 +927,7 @@ func (action *Action) systemLiquidation(coll *pty.Collateralize, price float64)
var
kv
[]
*
types
.
KeyValue
for
index
,
borrowRecord
:=
range
coll
.
BorrowRecords
{
if
borrowRecord
.
LiquidationPrice
*
PriceWarningRate
<
price
{
if
borrowRecord
.
LiquidationPrice
*
PriceWarningRate
<
price
{
if
borrowRecord
.
Status
==
pty
.
CollateralizeUserStatusWarning
{
borrowRecord
.
PreStatus
=
borrowRecord
.
Status
borrowRecord
.
Status
=
pty
.
CollateralizeUserStatusCreate
...
...
@@ -990,7 +990,7 @@ func (action *Action) expireLiquidation(coll *pty.Collateralize) (*types.Receipt
var
kv
[]
*
types
.
KeyValue
for
index
,
borrowRecord
:=
range
coll
.
BorrowRecords
{
if
borrowRecord
.
ExpireTime
-
ExpireWarningTime
>
action
.
blocktime
{
if
borrowRecord
.
ExpireTime
-
ExpireWarningTime
>
action
.
blocktime
{
continue
}
...
...
@@ -1057,7 +1057,7 @@ func pricePolicy(feed *pty.CollateralizeFeed) float64 {
}
for
i
,
price
:=
range
feed
.
Price
{
totalPrice
+=
price
*
(
float64
(
feed
.
Volume
[
i
])
/
float64
(
totalVolume
))
totalPrice
+=
price
*
(
float64
(
feed
.
Volume
[
i
])
/
float64
(
totalVolume
))
}
return
totalPrice
...
...
@@ -1098,7 +1098,7 @@ func (action *Action) CollateralizeFeed(feed *pty.CollateralizeFeed) (*types.Rec
}
// 超时清算判断
if
coll
.
LatestExpireTime
-
ExpireWarningTime
<=
action
.
blocktime
{
if
coll
.
LatestExpireTime
-
ExpireWarningTime
<=
action
.
blocktime
{
receipt
,
err
:=
action
.
expireLiquidation
(
coll
)
if
err
!=
nil
{
clog
.
Error
(
"CollateralizePriceFeed"
,
"Collateralize ID"
,
coll
.
CollateralizeId
,
"expire liquidation error"
,
err
)
...
...
@@ -1153,7 +1153,7 @@ func (action *Action) CollateralizeRetrieve(retrieve *pty.CollateralizeRetrieve)
clog
.
Error
(
"CollateralizeRetrieve"
,
"CollateralizeId"
,
retrieve
.
CollateralizeId
,
"error"
,
"balance error"
,
"retrieve balance"
,
retrieve
.
Balance
,
"available balance"
,
collateralize
.
Balance
)
return
nil
,
types
.
ErrAmount
}
// 解冻ccny
receipt
,
err
=
action
.
tokenAccount
.
ExecActive
(
action
.
fromaddr
,
action
.
execaddr
,
retrieve
.
Balance
)
if
err
!=
nil
{
...
...
@@ -1248,7 +1248,7 @@ func queryCollateralizeByAddr(localdb dbm.Lister, addr string, status int32, ind
clog
.
Debug
(
"queryCollateralizesByAddr"
,
"decode"
,
err
)
return
nil
,
err
}
if
status
==
0
||
coll
.
Status
==
status
{
if
status
==
0
||
coll
.
Status
==
status
{
ids
=
append
(
ids
,
coll
.
CollateralizeId
)
}
}
...
...
plugin/dapp/collateralize/executor/exec_del_local.go
View file @
bdf8e51e
...
...
@@ -105,4 +105,4 @@ func (c *Collateralize) ExecDelLocal_Retrieve(payload *pty.CollateralizeRetrieve
// ExecDelLocal_Manage Action
func
(
c
*
Collateralize
)
ExecDelLocal_Manage
(
payload
*
pty
.
CollateralizeManage
,
tx
*
types
.
Transaction
,
receiptData
*
types
.
ReceiptData
,
index
int
)
(
*
types
.
LocalDBSet
,
error
)
{
return
c
.
execDelLocal
(
tx
,
receiptData
)
}
\ No newline at end of file
}
plugin/dapp/collateralize/executor/keys.go
View file @
bdf8e51e
...
...
@@ -54,4 +54,4 @@ func calcCollateralizeRecordStatusPrefix(status string) []byte {
func
calcCollateralizeRecordStatusKey
(
status
int32
,
index
int64
)
[]
byte
{
key
:=
fmt
.
Sprintf
(
"LODB-collateralize-record-status:%d:%018d"
,
status
,
index
)
return
[]
byte
(
key
)
}
\ No newline at end of file
}
plugin/dapp/collateralize/executor/query.go
View file @
bdf8e51e
...
...
@@ -10,23 +10,23 @@ import (
)
func
(
c
*
Collateralize
)
Query_CollateralizeInfoByID
(
req
*
pty
.
ReqCollateralizeInfo
)
(
types
.
Message
,
error
)
{
coll
,
err
:=
queryCollateralizeByID
(
c
.
GetStateDB
(),
req
.
CollateralizeId
)
coll
,
err
:=
queryCollateralizeByID
(
c
.
GetStateDB
(),
req
.
CollateralizeId
)
if
err
!=
nil
{
clog
.
Error
(
"Query_CollateralizeInfoByID"
,
"id"
,
req
.
CollateralizeId
,
"error"
,
err
)
return
nil
,
err
}
info
:=
&
pty
.
RepCollateralizeCurrentInfo
{
Status
:
coll
.
Status
,
TotalBalance
:
coll
.
TotalBalance
,
DebtCeiling
:
coll
.
DebtCeiling
,
LiquidationRatio
:
coll
.
LiquidationRatio
,
StabilityFeeRatio
:
coll
.
StabilityFeeRatio
,
CreateAddr
:
coll
.
CreateAddr
,
Balance
:
coll
.
Balance
,
Period
:
coll
.
Period
,
CollateralizeId
:
coll
.
CollateralizeId
,
CollBalance
:
coll
.
CollBalance
,
info
:=
&
pty
.
RepCollateralizeCurrentInfo
{
Status
:
coll
.
Status
,
TotalBalance
:
coll
.
TotalBalance
,
DebtCeiling
:
coll
.
DebtCeiling
,
LiquidationRatio
:
coll
.
LiquidationRatio
,
StabilityFeeRatio
:
coll
.
StabilityFeeRatio
,
CreateAddr
:
coll
.
CreateAddr
,
Balance
:
coll
.
Balance
,
Period
:
coll
.
Period
,
CollateralizeId
:
coll
.
CollateralizeId
,
CollBalance
:
coll
.
CollBalance
,
}
info
.
BorrowRecords
=
append
(
info
.
BorrowRecords
,
coll
.
BorrowRecords
...
)
info
.
BorrowRecords
=
append
(
info
.
BorrowRecords
,
coll
.
InvalidRecords
...
)
...
...
@@ -37,23 +37,23 @@ func (c *Collateralize) Query_CollateralizeInfoByID(req *pty.ReqCollateralizeInf
func
(
c
*
Collateralize
)
Query_CollateralizeInfoByIDs
(
req
*
pty
.
ReqCollateralizeInfos
)
(
types
.
Message
,
error
)
{
infos
:=
&
pty
.
RepCollateralizeCurrentInfos
{}
for
_
,
id
:=
range
req
.
CollateralizeIds
{
coll
,
err
:=
queryCollateralizeByID
(
c
.
GetStateDB
(),
id
)
coll
,
err
:=
queryCollateralizeByID
(
c
.
GetStateDB
(),
id
)
if
err
!=
nil
{
clog
.
Error
(
"Query_CollateralizeInfoByID"
,
"id"
,
id
,
"error"
,
err
)
return
nil
,
err
}
info
:=
&
pty
.
RepCollateralizeCurrentInfo
{
Status
:
coll
.
Status
,
TotalBalance
:
coll
.
TotalBalance
,
DebtCeiling
:
coll
.
DebtCeiling
,
LiquidationRatio
:
coll
.
LiquidationRatio
,
StabilityFeeRatio
:
coll
.
StabilityFeeRatio
,
CreateAddr
:
coll
.
CreateAddr
,
Balance
:
coll
.
Balance
,
Period
:
coll
.
Period
,
CollateralizeId
:
coll
.
CollateralizeId
,
CollBalance
:
coll
.
CollBalance
,
info
:=
&
pty
.
RepCollateralizeCurrentInfo
{
Status
:
coll
.
Status
,
TotalBalance
:
coll
.
TotalBalance
,
DebtCeiling
:
coll
.
DebtCeiling
,
LiquidationRatio
:
coll
.
LiquidationRatio
,
StabilityFeeRatio
:
coll
.
StabilityFeeRatio
,
CreateAddr
:
coll
.
CreateAddr
,
Balance
:
coll
.
Balance
,
Period
:
coll
.
Period
,
CollateralizeId
:
coll
.
CollateralizeId
,
CollBalance
:
coll
.
CollBalance
,
}
info
.
BorrowRecords
=
append
(
info
.
BorrowRecords
,
coll
.
BorrowRecords
...
)
info
.
BorrowRecords
=
append
(
info
.
BorrowRecords
,
coll
.
InvalidRecords
...
)
...
...
@@ -111,7 +111,7 @@ func (c *Collateralize) Query_CollateralizeRecordByAddr(req *pty.ReqCollateraliz
if
req
.
Status
==
0
{
ret
.
Records
=
records
}
else
{
for
_
,
record
:=
range
records
{
for
_
,
record
:=
range
records
{
if
record
.
Status
==
req
.
Status
{
ret
.
Records
=
append
(
ret
.
Records
,
record
)
}
...
...
@@ -146,13 +146,13 @@ func (c *Collateralize) Query_CollateralizeConfig(req *pty.ReqCollateralizeRecor
}
ret
:=
&
pty
.
RepCollateralizeConfig
{
TotalBalance
:
config
.
TotalBalance
,
DebtCeiling
:
config
.
DebtCeiling
,
LiquidationRatio
:
config
.
LiquidationRatio
,
TotalBalance
:
config
.
TotalBalance
,
DebtCeiling
:
config
.
DebtCeiling
,
LiquidationRatio
:
config
.
LiquidationRatio
,
StabilityFeeRatio
:
config
.
StabilityFeeRatio
,
Period
:
config
.
Period
,
Balance
:
balance
,
CurrentTime
:
config
.
CurrentTime
,
Period
:
config
.
Period
,
Balance
:
balance
,
CurrentTime
:
config
.
CurrentTime
,
}
return
ret
,
nil
...
...
@@ -165,5 +165,5 @@ func (c *Collateralize) Query_CollateralizePrice(req *pty.ReqCollateralizeRecord
return
nil
,
err
}
return
&
pty
.
RepCollateralizePrice
{
Price
:
price
},
nil
}
\ No newline at end of file
return
&
pty
.
RepCollateralizePrice
{
Price
:
price
},
nil
}
plugin/dapp/collateralize/types/collateralize.go
View file @
bdf8e51e
...
...
@@ -53,12 +53,12 @@ func (collateralize *CollateralizeType) GetName() string {
// GetLogMap method
func
(
collateralize
*
CollateralizeType
)
GetLogMap
()
map
[
int64
]
*
types
.
LogInfo
{
return
map
[
int64
]
*
types
.
LogInfo
{
TyLogCollateralizeCreate
:
{
Ty
:
reflect
.
TypeOf
(
ReceiptCollateralize
{}),
Name
:
"LogCollateralizeCreate"
},
TyLogCollateralizeBorrow
:
{
Ty
:
reflect
.
TypeOf
(
ReceiptCollateralize
{}),
Name
:
"LogCollateralizeBorrow"
},
TyLogCollateralizeRepay
:
{
Ty
:
reflect
.
TypeOf
(
ReceiptCollateralize
{}),
Name
:
"LogCollateralizeRepay"
},
TyLogCollateralizeCreate
:
{
Ty
:
reflect
.
TypeOf
(
ReceiptCollateralize
{}),
Name
:
"LogCollateralizeCreate"
},
TyLogCollateralizeBorrow
:
{
Ty
:
reflect
.
TypeOf
(
ReceiptCollateralize
{}),
Name
:
"LogCollateralizeBorrow"
},
TyLogCollateralizeRepay
:
{
Ty
:
reflect
.
TypeOf
(
ReceiptCollateralize
{}),
Name
:
"LogCollateralizeRepay"
},
TyLogCollateralizeAppend
:
{
Ty
:
reflect
.
TypeOf
(
ReceiptCollateralize
{}),
Name
:
"LogCollateralizeAppend"
},
TyLogCollateralizeFeed
:
{
Ty
:
reflect
.
TypeOf
(
ReceiptCollateralize
{}),
Name
:
"LogCollateralizeFeed"
},
TyLogCollateralizeRetrieve
:
{
Ty
:
reflect
.
TypeOf
(
ReceiptCollateralize
{}),
Name
:
"LogCollateralizeRetrieve"
},
TyLogCollateralizeFeed
:
{
Ty
:
reflect
.
TypeOf
(
ReceiptCollateralize
{}),
Name
:
"LogCollateralizeFeed"
},
TyLogCollateralizeRetrieve
:
{
Ty
:
reflect
.
TypeOf
(
ReceiptCollateralize
{}),
Name
:
"LogCollateralizeRetrieve"
},
}
}
...
...
@@ -136,13 +136,13 @@ func (collateralize CollateralizeType) CreateTx(action string, message json.RawM
// GetTypeMap method
func
(
collateralize
CollateralizeType
)
GetTypeMap
()
map
[
string
]
int32
{
return
map
[
string
]
int32
{
"Create"
:
CollateralizeActionCreate
,
"Borrow"
:
CollateralizeActionBorrow
,
"Repay"
:
CollateralizeActionRepay
,
"Append"
:
CollateralizeActionAppend
,
"Feed"
:
CollateralizeActionFeed
,
"Retrieve"
:
CollateralizeActionRetrieve
,
"Manage"
:
CollateralizeActionManage
,
"Create"
:
CollateralizeActionCreate
,
"Borrow"
:
CollateralizeActionBorrow
,
"Repay"
:
CollateralizeActionRepay
,
"Append"
:
CollateralizeActionAppend
,
"Feed"
:
CollateralizeActionFeed
,
"Retrieve"
:
CollateralizeActionRetrieve
,
"Manage"
:
CollateralizeActionManage
,
}
}
...
...
@@ -154,7 +154,7 @@ func CreateRawCollateralizeCreateTx(cfg *types.Chain33Config, parm *Collateraliz
}
v
:=
&
CollateralizeCreate
{
TotalBalance
:
int64
(
math
.
Trunc
((
parm
.
TotalBalance
+
0.0000001
)
*
1e4
))
*
1e4
,
TotalBalance
:
int64
(
math
.
Trunc
((
parm
.
TotalBalance
+
0.0000001
)
*
1e4
))
*
1e4
,
}
create
:=
&
CollateralizeAction
{
Ty
:
CollateralizeActionCreate
,
...
...
@@ -183,7 +183,7 @@ func CreateRawCollateralizeBorrowTx(cfg *types.Chain33Config, parm *Collateraliz
v
:=
&
CollateralizeBorrow
{
CollateralizeId
:
parm
.
CollateralizeID
,
Value
:
int64
(
math
.
Trunc
((
parm
.
Value
+
0.0000001
)
*
1e4
))
*
1e4
,
Value
:
int64
(
math
.
Trunc
((
parm
.
Value
+
0.0000001
)
*
1e4
))
*
1e4
,
}
borrow
:=
&
CollateralizeAction
{
Ty
:
CollateralizeActionBorrow
,
...
...
@@ -212,7 +212,7 @@ func CreateRawCollateralizeRepayTx(cfg *types.Chain33Config, parm *Collateralize
v
:=
&
CollateralizeRepay
{
CollateralizeId
:
parm
.
CollateralizeID
,
RecordId
:
parm
.
RecordID
,
RecordId
:
parm
.
RecordID
,
}
repay
:=
&
CollateralizeAction
{
Ty
:
CollateralizeActionRepay
,
...
...
@@ -241,7 +241,7 @@ func CreateRawCollateralizeAppendTx(cfg *types.Chain33Config, parm *Collateraliz
v
:=
&
CollateralizeAppend
{
CollateralizeId
:
parm
.
CollateralizeID
,
RecordId
:
parm
.
RecordID
,
RecordId
:
parm
.
RecordID
,
CollateralValue
:
int64
(
math
.
Trunc
((
parm
.
Value
+
0.0000001
)
*
1e4
))
*
1e4
,
}
append
:=
&
CollateralizeAction
{
...
...
@@ -270,7 +270,7 @@ func CreateRawCollateralizeFeedTx(cfg *types.Chain33Config, parm *CollateralizeF
}
v
:=
&
CollateralizeFeed
{
Price
:
parm
.
Price
,
Price
:
parm
.
Price
,
Volume
:
parm
.
Volume
,
}
feed
:=
&
CollateralizeAction
{
...
...
@@ -300,7 +300,7 @@ func CreateRawCollateralizeRetrieveTx(cfg *types.Chain33Config, parm *Collateral
v
:=
&
CollateralizeRetrieve
{
CollateralizeId
:
parm
.
CollateralizeID
,
Balance
:
int64
(
math
.
Trunc
((
parm
.
Balance
+
0.0000001
)
*
1e4
))
*
1e4
,
Balance
:
int64
(
math
.
Trunc
((
parm
.
Balance
+
0.0000001
)
*
1e4
))
*
1e4
,
}
close
:=
&
CollateralizeAction
{
Ty
:
CollateralizeActionRetrieve
,
...
...
@@ -329,11 +329,11 @@ func CreateRawCollateralizeManageTx(cfg *types.Chain33Config, parm *Collateraliz
}
v
:=
&
CollateralizeManage
{
DebtCeiling
:
int64
(
math
.
Trunc
((
parm
.
DebtCeiling
+
0.0000001
)
*
1e4
))
*
1e4
,
LiquidationRatio
:
parm
.
LiquidationRatio
,
StabilityFeeRatio
:
parm
.
StabilityFeeRatio
,
Period
:
parm
.
Period
,
TotalBalance
:
int64
(
math
.
Trunc
((
parm
.
TotalBalance
+
0.0000001
)
*
1e4
))
*
1e4
,
DebtCeiling
:
int64
(
math
.
Trunc
((
parm
.
DebtCeiling
+
0.0000001
)
*
1e4
))
*
1e4
,
LiquidationRatio
:
parm
.
LiquidationRatio
,
StabilityFeeRatio
:
parm
.
StabilityFeeRatio
,
Period
:
parm
.
Period
,
TotalBalance
:
int64
(
math
.
Trunc
((
parm
.
TotalBalance
+
0.0000001
)
*
1e4
))
*
1e4
,
}
manage
:=
&
CollateralizeAction
{
...
...
plugin/dapp/collateralize/types/collateralize.pb.go
View file @
bdf8e51e
...
...
@@ -5,7 +5,9 @@ package types
import
(
fmt
"fmt"
proto
"github.com/golang/protobuf/proto"
math
"math"
)
...
...
@@ -18,7 +20,7 @@ var _ = math.Inf
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const
_
=
proto
.
ProtoPackageIsVersion
3
// please upgrade the proto package
const
_
=
proto
.
ProtoPackageIsVersion
2
// please upgrade the proto package
// 放贷信息
type
Collateralize
struct
{
...
...
@@ -48,17 +50,16 @@ func (m *Collateralize) Reset() { *m = Collateralize{} }
func
(
m
*
Collateralize
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
Collateralize
)
ProtoMessage
()
{}
func
(
*
Collateralize
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_
a988fb4a6138197
2
,
[]
int
{
0
}
return
fileDescriptor_
collateralize_d6354d222229855
2
,
[]
int
{
0
}
}
func
(
m
*
Collateralize
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_Collateralize
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
Collateralize
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_Collateralize
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
Collateralize
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_Collateralize
.
Merge
(
m
,
src
)
func
(
dst
*
Collateralize
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_Collateralize
.
Merge
(
dst
,
src
)
}
func
(
m
*
Collateralize
)
XXX_Size
()
int
{
return
xxx_messageInfo_Collateralize
.
Size
(
m
)
...
...
@@ -213,17 +214,16 @@ func (m *BorrowRecord) Reset() { *m = BorrowRecord{} }
func
(
m
*
BorrowRecord
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
BorrowRecord
)
ProtoMessage
()
{}
func
(
*
BorrowRecord
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_
a988fb4a6138197
2
,
[]
int
{
1
}
return
fileDescriptor_
collateralize_d6354d222229855
2
,
[]
int
{
1
}
}
func
(
m
*
BorrowRecord
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_BorrowRecord
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
BorrowRecord
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_BorrowRecord
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
BorrowRecord
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_BorrowRecord
.
Merge
(
m
,
src
)
func
(
dst
*
BorrowRecord
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_BorrowRecord
.
Merge
(
dst
,
src
)
}
func
(
m
*
BorrowRecord
)
XXX_Size
()
int
{
return
xxx_messageInfo_BorrowRecord
.
Size
(
m
)
...
...
@@ -347,17 +347,16 @@ func (m *AssetPriceRecord) Reset() { *m = AssetPriceRecord{} }
func
(
m
*
AssetPriceRecord
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
AssetPriceRecord
)
ProtoMessage
()
{}
func
(
*
AssetPriceRecord
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_
a988fb4a6138197
2
,
[]
int
{
2
}
return
fileDescriptor_
collateralize_d6354d222229855
2
,
[]
int
{
2
}
}
func
(
m
*
AssetPriceRecord
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_AssetPriceRecord
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
AssetPriceRecord
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_AssetPriceRecord
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
AssetPriceRecord
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_AssetPriceRecord
.
Merge
(
m
,
src
)
func
(
dst
*
AssetPriceRecord
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_AssetPriceRecord
.
Merge
(
dst
,
src
)
}
func
(
m
*
AssetPriceRecord
)
XXX_Size
()
int
{
return
xxx_messageInfo_AssetPriceRecord
.
Size
(
m
)
...
...
@@ -417,17 +416,16 @@ func (m *CollateralizeAction) Reset() { *m = CollateralizeAction{} }
func
(
m
*
CollateralizeAction
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
CollateralizeAction
)
ProtoMessage
()
{}
func
(
*
CollateralizeAction
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_
a988fb4a6138197
2
,
[]
int
{
3
}
return
fileDescriptor_
collateralize_d6354d222229855
2
,
[]
int
{
3
}
}
func
(
m
*
CollateralizeAction
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_CollateralizeAction
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
CollateralizeAction
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_CollateralizeAction
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
CollateralizeAction
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_CollateralizeAction
.
Merge
(
m
,
src
)
func
(
dst
*
CollateralizeAction
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_CollateralizeAction
.
Merge
(
dst
,
src
)
}
func
(
m
*
CollateralizeAction
)
XXX_Size
()
int
{
return
xxx_messageInfo_CollateralizeAction
.
Size
(
m
)
...
...
@@ -547,9 +545,9 @@ func (m *CollateralizeAction) GetTy() int32 {
return
0
}
// XXX_Oneof
Wrapper
s is for the internal use of the proto package.
func
(
*
CollateralizeAction
)
XXX_Oneof
Wrappers
()
[]
interface
{}
{
return
[]
interface
{}{
// XXX_Oneof
Func
s is for the internal use of the proto package.
func
(
*
CollateralizeAction
)
XXX_Oneof
Funcs
()
(
func
(
msg
proto
.
Message
,
b
*
proto
.
Buffer
)
error
,
func
(
msg
proto
.
Message
,
tag
,
wire
int
,
b
*
proto
.
Buffer
)
(
bool
,
error
),
func
(
msg
proto
.
Message
)
(
n
int
),
[]
interface
{})
{
return
_CollateralizeAction_OneofMarshaler
,
_CollateralizeAction_OneofUnmarshaler
,
_CollateralizeAction_OneofSizer
,
[]
interface
{}{
(
*
CollateralizeAction_Create
)(
nil
),
(
*
CollateralizeAction_Borrow
)(
nil
),
(
*
CollateralizeAction_Repay
)(
nil
),
...
...
@@ -560,6 +558,162 @@ func (*CollateralizeAction) XXX_OneofWrappers() []interface{} {
}
}
func
_CollateralizeAction_OneofMarshaler
(
msg
proto
.
Message
,
b
*
proto
.
Buffer
)
error
{
m
:=
msg
.
(
*
CollateralizeAction
)
// value
switch
x
:=
m
.
Value
.
(
type
)
{
case
*
CollateralizeAction_Create
:
b
.
EncodeVarint
(
1
<<
3
|
proto
.
WireBytes
)
if
err
:=
b
.
EncodeMessage
(
x
.
Create
);
err
!=
nil
{
return
err
}
case
*
CollateralizeAction_Borrow
:
b
.
EncodeVarint
(
2
<<
3
|
proto
.
WireBytes
)
if
err
:=
b
.
EncodeMessage
(
x
.
Borrow
);
err
!=
nil
{
return
err
}
case
*
CollateralizeAction_Repay
:
b
.
EncodeVarint
(
3
<<
3
|
proto
.
WireBytes
)
if
err
:=
b
.
EncodeMessage
(
x
.
Repay
);
err
!=
nil
{
return
err
}
case
*
CollateralizeAction_Append
:
b
.
EncodeVarint
(
4
<<
3
|
proto
.
WireBytes
)
if
err
:=
b
.
EncodeMessage
(
x
.
Append
);
err
!=
nil
{
return
err
}
case
*
CollateralizeAction_Feed
:
b
.
EncodeVarint
(
5
<<
3
|
proto
.
WireBytes
)
if
err
:=
b
.
EncodeMessage
(
x
.
Feed
);
err
!=
nil
{
return
err
}
case
*
CollateralizeAction_Retrieve
:
b
.
EncodeVarint
(
6
<<
3
|
proto
.
WireBytes
)
if
err
:=
b
.
EncodeMessage
(
x
.
Retrieve
);
err
!=
nil
{
return
err
}
case
*
CollateralizeAction_Manage
:
b
.
EncodeVarint
(
7
<<
3
|
proto
.
WireBytes
)
if
err
:=
b
.
EncodeMessage
(
x
.
Manage
);
err
!=
nil
{
return
err
}
case
nil
:
default
:
return
fmt
.
Errorf
(
"CollateralizeAction.Value has unexpected type %T"
,
x
)
}
return
nil
}
func
_CollateralizeAction_OneofUnmarshaler
(
msg
proto
.
Message
,
tag
,
wire
int
,
b
*
proto
.
Buffer
)
(
bool
,
error
)
{
m
:=
msg
.
(
*
CollateralizeAction
)
switch
tag
{
case
1
:
// value.create
if
wire
!=
proto
.
WireBytes
{
return
true
,
proto
.
ErrInternalBadWireType
}
msg
:=
new
(
CollateralizeCreate
)
err
:=
b
.
DecodeMessage
(
msg
)
m
.
Value
=
&
CollateralizeAction_Create
{
msg
}
return
true
,
err
case
2
:
// value.borrow
if
wire
!=
proto
.
WireBytes
{
return
true
,
proto
.
ErrInternalBadWireType
}
msg
:=
new
(
CollateralizeBorrow
)
err
:=
b
.
DecodeMessage
(
msg
)
m
.
Value
=
&
CollateralizeAction_Borrow
{
msg
}
return
true
,
err
case
3
:
// value.repay
if
wire
!=
proto
.
WireBytes
{
return
true
,
proto
.
ErrInternalBadWireType
}
msg
:=
new
(
CollateralizeRepay
)
err
:=
b
.
DecodeMessage
(
msg
)
m
.
Value
=
&
CollateralizeAction_Repay
{
msg
}
return
true
,
err
case
4
:
// value.append
if
wire
!=
proto
.
WireBytes
{
return
true
,
proto
.
ErrInternalBadWireType
}
msg
:=
new
(
CollateralizeAppend
)
err
:=
b
.
DecodeMessage
(
msg
)
m
.
Value
=
&
CollateralizeAction_Append
{
msg
}
return
true
,
err
case
5
:
// value.feed
if
wire
!=
proto
.
WireBytes
{
return
true
,
proto
.
ErrInternalBadWireType
}
msg
:=
new
(
CollateralizeFeed
)
err
:=
b
.
DecodeMessage
(
msg
)
m
.
Value
=
&
CollateralizeAction_Feed
{
msg
}
return
true
,
err
case
6
:
// value.retrieve
if
wire
!=
proto
.
WireBytes
{
return
true
,
proto
.
ErrInternalBadWireType
}
msg
:=
new
(
CollateralizeRetrieve
)
err
:=
b
.
DecodeMessage
(
msg
)
m
.
Value
=
&
CollateralizeAction_Retrieve
{
msg
}
return
true
,
err
case
7
:
// value.manage
if
wire
!=
proto
.
WireBytes
{
return
true
,
proto
.
ErrInternalBadWireType
}
msg
:=
new
(
CollateralizeManage
)
err
:=
b
.
DecodeMessage
(
msg
)
m
.
Value
=
&
CollateralizeAction_Manage
{
msg
}
return
true
,
err
default
:
return
false
,
nil
}
}
func
_CollateralizeAction_OneofSizer
(
msg
proto
.
Message
)
(
n
int
)
{
m
:=
msg
.
(
*
CollateralizeAction
)
// value
switch
x
:=
m
.
Value
.
(
type
)
{
case
*
CollateralizeAction_Create
:
s
:=
proto
.
Size
(
x
.
Create
)
n
+=
1
// tag and wire
n
+=
proto
.
SizeVarint
(
uint64
(
s
))
n
+=
s
case
*
CollateralizeAction_Borrow
:
s
:=
proto
.
Size
(
x
.
Borrow
)
n
+=
1
// tag and wire
n
+=
proto
.
SizeVarint
(
uint64
(
s
))
n
+=
s
case
*
CollateralizeAction_Repay
:
s
:=
proto
.
Size
(
x
.
Repay
)
n
+=
1
// tag and wire
n
+=
proto
.
SizeVarint
(
uint64
(
s
))
n
+=
s
case
*
CollateralizeAction_Append
:
s
:=
proto
.
Size
(
x
.
Append
)
n
+=
1
// tag and wire
n
+=
proto
.
SizeVarint
(
uint64
(
s
))
n
+=
s
case
*
CollateralizeAction_Feed
:
s
:=
proto
.
Size
(
x
.
Feed
)
n
+=
1
// tag and wire
n
+=
proto
.
SizeVarint
(
uint64
(
s
))
n
+=
s
case
*
CollateralizeAction_Retrieve
:
s
:=
proto
.
Size
(
x
.
Retrieve
)
n
+=
1
// tag and wire
n
+=
proto
.
SizeVarint
(
uint64
(
s
))
n
+=
s
case
*
CollateralizeAction_Manage
:
s
:=
proto
.
Size
(
x
.
Manage
)
n
+=
1
// tag and wire
n
+=
proto
.
SizeVarint
(
uint64
(
s
))
n
+=
s
case
nil
:
default
:
panic
(
fmt
.
Sprintf
(
"proto: unexpected type %T in oneof"
,
x
))
}
return
n
}
type
CollateralizeManage
struct
{
DebtCeiling
int64
`protobuf:"varint,1,opt,name=debtCeiling,proto3" json:"debtCeiling,omitempty"`
LiquidationRatio
float64
`protobuf:"fixed64,2,opt,name=liquidationRatio,proto3" json:"liquidationRatio,omitempty"`
...
...
@@ -576,17 +730,16 @@ func (m *CollateralizeManage) Reset() { *m = CollateralizeManage{} }
func
(
m
*
CollateralizeManage
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
CollateralizeManage
)
ProtoMessage
()
{}
func
(
*
CollateralizeManage
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_
a988fb4a6138197
2
,
[]
int
{
4
}
return
fileDescriptor_
collateralize_d6354d222229855
2
,
[]
int
{
4
}
}
func
(
m
*
CollateralizeManage
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_CollateralizeManage
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
CollateralizeManage
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_CollateralizeManage
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
CollateralizeManage
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_CollateralizeManage
.
Merge
(
m
,
src
)
func
(
dst
*
CollateralizeManage
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_CollateralizeManage
.
Merge
(
dst
,
src
)
}
func
(
m
*
CollateralizeManage
)
XXX_Size
()
int
{
return
xxx_messageInfo_CollateralizeManage
.
Size
(
m
)
...
...
@@ -650,17 +803,16 @@ func (m *CollateralizeAddr) Reset() { *m = CollateralizeAddr{} }
func
(
m
*
CollateralizeAddr
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
CollateralizeAddr
)
ProtoMessage
()
{}
func
(
*
CollateralizeAddr
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_
a988fb4a6138197
2
,
[]
int
{
5
}
return
fileDescriptor_
collateralize_d6354d222229855
2
,
[]
int
{
5
}
}
func
(
m
*
CollateralizeAddr
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_CollateralizeAddr
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
CollateralizeAddr
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_CollateralizeAddr
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
CollateralizeAddr
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_CollateralizeAddr
.
Merge
(
m
,
src
)
func
(
dst
*
CollateralizeAddr
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_CollateralizeAddr
.
Merge
(
dst
,
src
)
}
func
(
m
*
CollateralizeAddr
)
XXX_Size
()
int
{
return
xxx_messageInfo_CollateralizeAddr
.
Size
(
m
)
...
...
@@ -690,17 +842,16 @@ func (m *CollateralizeCreate) Reset() { *m = CollateralizeCreate{} }
func
(
m
*
CollateralizeCreate
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
CollateralizeCreate
)
ProtoMessage
()
{}
func
(
*
CollateralizeCreate
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_
a988fb4a6138197
2
,
[]
int
{
6
}
return
fileDescriptor_
collateralize_d6354d222229855
2
,
[]
int
{
6
}
}
func
(
m
*
CollateralizeCreate
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_CollateralizeCreate
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
CollateralizeCreate
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_CollateralizeCreate
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
CollateralizeCreate
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_CollateralizeCreate
.
Merge
(
m
,
src
)
func
(
dst
*
CollateralizeCreate
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_CollateralizeCreate
.
Merge
(
dst
,
src
)
}
func
(
m
*
CollateralizeCreate
)
XXX_Size
()
int
{
return
xxx_messageInfo_CollateralizeCreate
.
Size
(
m
)
...
...
@@ -731,17 +882,16 @@ func (m *CollateralizeBorrow) Reset() { *m = CollateralizeBorrow{} }
func
(
m
*
CollateralizeBorrow
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
CollateralizeBorrow
)
ProtoMessage
()
{}
func
(
*
CollateralizeBorrow
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_
a988fb4a6138197
2
,
[]
int
{
7
}
return
fileDescriptor_
collateralize_d6354d222229855
2
,
[]
int
{
7
}
}
func
(
m
*
CollateralizeBorrow
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_CollateralizeBorrow
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
CollateralizeBorrow
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_CollateralizeBorrow
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
CollateralizeBorrow
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_CollateralizeBorrow
.
Merge
(
m
,
src
)
func
(
dst
*
CollateralizeBorrow
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_CollateralizeBorrow
.
Merge
(
dst
,
src
)
}
func
(
m
*
CollateralizeBorrow
)
XXX_Size
()
int
{
return
xxx_messageInfo_CollateralizeBorrow
.
Size
(
m
)
...
...
@@ -779,17 +929,16 @@ func (m *CollateralizeRepay) Reset() { *m = CollateralizeRepay{} }
func
(
m
*
CollateralizeRepay
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
CollateralizeRepay
)
ProtoMessage
()
{}
func
(
*
CollateralizeRepay
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_
a988fb4a6138197
2
,
[]
int
{
8
}
return
fileDescriptor_
collateralize_d6354d222229855
2
,
[]
int
{
8
}
}
func
(
m
*
CollateralizeRepay
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_CollateralizeRepay
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
CollateralizeRepay
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_CollateralizeRepay
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
CollateralizeRepay
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_CollateralizeRepay
.
Merge
(
m
,
src
)
func
(
dst
*
CollateralizeRepay
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_CollateralizeRepay
.
Merge
(
dst
,
src
)
}
func
(
m
*
CollateralizeRepay
)
XXX_Size
()
int
{
return
xxx_messageInfo_CollateralizeRepay
.
Size
(
m
)
...
...
@@ -828,17 +977,16 @@ func (m *CollateralizeAppend) Reset() { *m = CollateralizeAppend{} }
func
(
m
*
CollateralizeAppend
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
CollateralizeAppend
)
ProtoMessage
()
{}
func
(
*
CollateralizeAppend
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_
a988fb4a6138197
2
,
[]
int
{
9
}
return
fileDescriptor_
collateralize_d6354d222229855
2
,
[]
int
{
9
}
}
func
(
m
*
CollateralizeAppend
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_CollateralizeAppend
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
CollateralizeAppend
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_CollateralizeAppend
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
CollateralizeAppend
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_CollateralizeAppend
.
Merge
(
m
,
src
)
func
(
dst
*
CollateralizeAppend
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_CollateralizeAppend
.
Merge
(
dst
,
src
)
}
func
(
m
*
CollateralizeAppend
)
XXX_Size
()
int
{
return
xxx_messageInfo_CollateralizeAppend
.
Size
(
m
)
...
...
@@ -884,17 +1032,16 @@ func (m *CollateralizeFeed) Reset() { *m = CollateralizeFeed{} }
func
(
m
*
CollateralizeFeed
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
CollateralizeFeed
)
ProtoMessage
()
{}
func
(
*
CollateralizeFeed
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_
a988fb4a6138197
2
,
[]
int
{
10
}
return
fileDescriptor_
collateralize_d6354d222229855
2
,
[]
int
{
10
}
}
func
(
m
*
CollateralizeFeed
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_CollateralizeFeed
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
CollateralizeFeed
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_CollateralizeFeed
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
CollateralizeFeed
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_CollateralizeFeed
.
Merge
(
m
,
src
)
func
(
dst
*
CollateralizeFeed
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_CollateralizeFeed
.
Merge
(
dst
,
src
)
}
func
(
m
*
CollateralizeFeed
)
XXX_Size
()
int
{
return
xxx_messageInfo_CollateralizeFeed
.
Size
(
m
)
...
...
@@ -939,17 +1086,16 @@ func (m *CollateralizeRetrieve) Reset() { *m = CollateralizeRetrieve{} }
func
(
m
*
CollateralizeRetrieve
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
CollateralizeRetrieve
)
ProtoMessage
()
{}
func
(
*
CollateralizeRetrieve
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_
a988fb4a6138197
2
,
[]
int
{
11
}
return
fileDescriptor_
collateralize_d6354d222229855
2
,
[]
int
{
11
}
}
func
(
m
*
CollateralizeRetrieve
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_CollateralizeRetrieve
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
CollateralizeRetrieve
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_CollateralizeRetrieve
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
CollateralizeRetrieve
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_CollateralizeRetrieve
.
Merge
(
m
,
src
)
func
(
dst
*
CollateralizeRetrieve
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_CollateralizeRetrieve
.
Merge
(
dst
,
src
)
}
func
(
m
*
CollateralizeRetrieve
)
XXX_Size
()
int
{
return
xxx_messageInfo_CollateralizeRetrieve
.
Size
(
m
)
...
...
@@ -993,17 +1139,16 @@ func (m *ReceiptCollateralize) Reset() { *m = ReceiptCollateralize{} }
func
(
m
*
ReceiptCollateralize
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
ReceiptCollateralize
)
ProtoMessage
()
{}
func
(
*
ReceiptCollateralize
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_
a988fb4a6138197
2
,
[]
int
{
12
}
return
fileDescriptor_
collateralize_d6354d222229855
2
,
[]
int
{
12
}
}
func
(
m
*
ReceiptCollateralize
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_ReceiptCollateralize
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
ReceiptCollateralize
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_ReceiptCollateralize
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
ReceiptCollateralize
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_ReceiptCollateralize
.
Merge
(
m
,
src
)
func
(
dst
*
ReceiptCollateralize
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_ReceiptCollateralize
.
Merge
(
dst
,
src
)
}
func
(
m
*
ReceiptCollateralize
)
XXX_Size
()
int
{
return
xxx_messageInfo_ReceiptCollateralize
.
Size
(
m
)
...
...
@@ -1086,17 +1231,16 @@ func (m *CollateralizeRecord) Reset() { *m = CollateralizeRecord{} }
func
(
m
*
CollateralizeRecord
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
CollateralizeRecord
)
ProtoMessage
()
{}
func
(
*
CollateralizeRecord
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_
a988fb4a6138197
2
,
[]
int
{
13
}
return
fileDescriptor_
collateralize_d6354d222229855
2
,
[]
int
{
13
}
}
func
(
m
*
CollateralizeRecord
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_CollateralizeRecord
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
CollateralizeRecord
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_CollateralizeRecord
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
CollateralizeRecord
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_CollateralizeRecord
.
Merge
(
m
,
src
)
func
(
dst
*
CollateralizeRecord
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_CollateralizeRecord
.
Merge
(
dst
,
src
)
}
func
(
m
*
CollateralizeRecord
)
XXX_Size
()
int
{
return
xxx_messageInfo_CollateralizeRecord
.
Size
(
m
)
...
...
@@ -1154,17 +1298,16 @@ func (m *CollateralizeRecords) Reset() { *m = CollateralizeRecords{} }
func
(
m
*
CollateralizeRecords
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
CollateralizeRecords
)
ProtoMessage
()
{}
func
(
*
CollateralizeRecords
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_
a988fb4a6138197
2
,
[]
int
{
14
}
return
fileDescriptor_
collateralize_d6354d222229855
2
,
[]
int
{
14
}
}
func
(
m
*
CollateralizeRecords
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_CollateralizeRecords
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
CollateralizeRecords
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_CollateralizeRecords
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
CollateralizeRecords
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_CollateralizeRecords
.
Merge
(
m
,
src
)
func
(
dst
*
CollateralizeRecords
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_CollateralizeRecords
.
Merge
(
dst
,
src
)
}
func
(
m
*
CollateralizeRecords
)
XXX_Size
()
int
{
return
xxx_messageInfo_CollateralizeRecords
.
Size
(
m
)
...
...
@@ -1194,17 +1337,16 @@ func (m *ReqCollateralizeInfo) Reset() { *m = ReqCollateralizeInfo{} }
func
(
m
*
ReqCollateralizeInfo
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
ReqCollateralizeInfo
)
ProtoMessage
()
{}
func
(
*
ReqCollateralizeInfo
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_
a988fb4a6138197
2
,
[]
int
{
15
}
return
fileDescriptor_
collateralize_d6354d222229855
2
,
[]
int
{
15
}
}
func
(
m
*
ReqCollateralizeInfo
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_ReqCollateralizeInfo
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
ReqCollateralizeInfo
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_ReqCollateralizeInfo
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
ReqCollateralizeInfo
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_ReqCollateralizeInfo
.
Merge
(
m
,
src
)
func
(
dst
*
ReqCollateralizeInfo
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_ReqCollateralizeInfo
.
Merge
(
dst
,
src
)
}
func
(
m
*
ReqCollateralizeInfo
)
XXX_Size
()
int
{
return
xxx_messageInfo_ReqCollateralizeInfo
.
Size
(
m
)
...
...
@@ -1244,17 +1386,16 @@ func (m *RepCollateralizeCurrentInfo) Reset() { *m = RepCollateralizeCur
func
(
m
*
RepCollateralizeCurrentInfo
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
RepCollateralizeCurrentInfo
)
ProtoMessage
()
{}
func
(
*
RepCollateralizeCurrentInfo
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_
a988fb4a6138197
2
,
[]
int
{
16
}
return
fileDescriptor_
collateralize_d6354d222229855
2
,
[]
int
{
16
}
}
func
(
m
*
RepCollateralizeCurrentInfo
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_RepCollateralizeCurrentInfo
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
RepCollateralizeCurrentInfo
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_RepCollateralizeCurrentInfo
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
RepCollateralizeCurrentInfo
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_RepCollateralizeCurrentInfo
.
Merge
(
m
,
src
)
func
(
dst
*
RepCollateralizeCurrentInfo
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_RepCollateralizeCurrentInfo
.
Merge
(
dst
,
src
)
}
func
(
m
*
RepCollateralizeCurrentInfo
)
XXX_Size
()
int
{
return
xxx_messageInfo_RepCollateralizeCurrentInfo
.
Size
(
m
)
...
...
@@ -1354,17 +1495,16 @@ func (m *ReqCollateralizeInfos) Reset() { *m = ReqCollateralizeInfos{} }
func
(
m
*
ReqCollateralizeInfos
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
ReqCollateralizeInfos
)
ProtoMessage
()
{}
func
(
*
ReqCollateralizeInfos
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_
a988fb4a6138197
2
,
[]
int
{
17
}
return
fileDescriptor_
collateralize_d6354d222229855
2
,
[]
int
{
17
}
}
func
(
m
*
ReqCollateralizeInfos
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_ReqCollateralizeInfos
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
ReqCollateralizeInfos
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_ReqCollateralizeInfos
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
ReqCollateralizeInfos
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_ReqCollateralizeInfos
.
Merge
(
m
,
src
)
func
(
dst
*
ReqCollateralizeInfos
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_ReqCollateralizeInfos
.
Merge
(
dst
,
src
)
}
func
(
m
*
ReqCollateralizeInfos
)
XXX_Size
()
int
{
return
xxx_messageInfo_ReqCollateralizeInfos
.
Size
(
m
)
...
...
@@ -1394,17 +1534,16 @@ func (m *RepCollateralizeCurrentInfos) Reset() { *m = RepCollateralizeCu
func
(
m
*
RepCollateralizeCurrentInfos
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
RepCollateralizeCurrentInfos
)
ProtoMessage
()
{}
func
(
*
RepCollateralizeCurrentInfos
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_
a988fb4a6138197
2
,
[]
int
{
18
}
return
fileDescriptor_
collateralize_d6354d222229855
2
,
[]
int
{
18
}
}
func
(
m
*
RepCollateralizeCurrentInfos
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_RepCollateralizeCurrentInfos
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
RepCollateralizeCurrentInfos
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_RepCollateralizeCurrentInfos
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
RepCollateralizeCurrentInfos
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_RepCollateralizeCurrentInfos
.
Merge
(
m
,
src
)
func
(
dst
*
RepCollateralizeCurrentInfos
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_RepCollateralizeCurrentInfos
.
Merge
(
dst
,
src
)
}
func
(
m
*
RepCollateralizeCurrentInfos
)
XXX_Size
()
int
{
return
xxx_messageInfo_RepCollateralizeCurrentInfos
.
Size
(
m
)
...
...
@@ -1435,17 +1574,16 @@ func (m *ReqCollateralizeByStatus) Reset() { *m = ReqCollateralizeByStat
func
(
m
*
ReqCollateralizeByStatus
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
ReqCollateralizeByStatus
)
ProtoMessage
()
{}
func
(
*
ReqCollateralizeByStatus
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_
a988fb4a6138197
2
,
[]
int
{
19
}
return
fileDescriptor_
collateralize_d6354d222229855
2
,
[]
int
{
19
}
}
func
(
m
*
ReqCollateralizeByStatus
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_ReqCollateralizeByStatus
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
ReqCollateralizeByStatus
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_ReqCollateralizeByStatus
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
ReqCollateralizeByStatus
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_ReqCollateralizeByStatus
.
Merge
(
m
,
src
)
func
(
dst
*
ReqCollateralizeByStatus
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_ReqCollateralizeByStatus
.
Merge
(
dst
,
src
)
}
func
(
m
*
ReqCollateralizeByStatus
)
XXX_Size
()
int
{
return
xxx_messageInfo_ReqCollateralizeByStatus
.
Size
(
m
)
...
...
@@ -1484,17 +1622,16 @@ func (m *ReqCollateralizeByAddr) Reset() { *m = ReqCollateralizeByAddr{}
func
(
m
*
ReqCollateralizeByAddr
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
ReqCollateralizeByAddr
)
ProtoMessage
()
{}
func
(
*
ReqCollateralizeByAddr
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_
a988fb4a6138197
2
,
[]
int
{
20
}
return
fileDescriptor_
collateralize_d6354d222229855
2
,
[]
int
{
20
}
}
func
(
m
*
ReqCollateralizeByAddr
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_ReqCollateralizeByAddr
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
ReqCollateralizeByAddr
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_ReqCollateralizeByAddr
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
ReqCollateralizeByAddr
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_ReqCollateralizeByAddr
.
Merge
(
m
,
src
)
func
(
dst
*
ReqCollateralizeByAddr
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_ReqCollateralizeByAddr
.
Merge
(
dst
,
src
)
}
func
(
m
*
ReqCollateralizeByAddr
)
XXX_Size
()
int
{
return
xxx_messageInfo_ReqCollateralizeByAddr
.
Size
(
m
)
...
...
@@ -1538,17 +1675,16 @@ func (m *RepCollateralizeIDs) Reset() { *m = RepCollateralizeIDs{} }
func
(
m
*
RepCollateralizeIDs
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
RepCollateralizeIDs
)
ProtoMessage
()
{}
func
(
*
RepCollateralizeIDs
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_
a988fb4a6138197
2
,
[]
int
{
21
}
return
fileDescriptor_
collateralize_d6354d222229855
2
,
[]
int
{
21
}
}
func
(
m
*
RepCollateralizeIDs
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_RepCollateralizeIDs
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
RepCollateralizeIDs
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_RepCollateralizeIDs
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
RepCollateralizeIDs
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_RepCollateralizeIDs
.
Merge
(
m
,
src
)
func
(
dst
*
RepCollateralizeIDs
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_RepCollateralizeIDs
.
Merge
(
dst
,
src
)
}
func
(
m
*
RepCollateralizeIDs
)
XXX_Size
()
int
{
return
xxx_messageInfo_RepCollateralizeIDs
.
Size
(
m
)
...
...
@@ -1581,17 +1717,16 @@ func (m *ReqCollateralizeRecordByAddr) Reset() { *m = ReqCollateralizeRe
func
(
m
*
ReqCollateralizeRecordByAddr
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
ReqCollateralizeRecordByAddr
)
ProtoMessage
()
{}
func
(
*
ReqCollateralizeRecordByAddr
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_
a988fb4a6138197
2
,
[]
int
{
22
}
return
fileDescriptor_
collateralize_d6354d222229855
2
,
[]
int
{
22
}
}
func
(
m
*
ReqCollateralizeRecordByAddr
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_ReqCollateralizeRecordByAddr
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
ReqCollateralizeRecordByAddr
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_ReqCollateralizeRecordByAddr
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
ReqCollateralizeRecordByAddr
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_ReqCollateralizeRecordByAddr
.
Merge
(
m
,
src
)
func
(
dst
*
ReqCollateralizeRecordByAddr
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_ReqCollateralizeRecordByAddr
.
Merge
(
dst
,
src
)
}
func
(
m
*
ReqCollateralizeRecordByAddr
)
XXX_Size
()
int
{
return
xxx_messageInfo_ReqCollateralizeRecordByAddr
.
Size
(
m
)
...
...
@@ -1644,17 +1779,16 @@ func (m *ReqCollateralizeRecordByStatus) Reset() { *m = ReqCollateralize
func
(
m
*
ReqCollateralizeRecordByStatus
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
ReqCollateralizeRecordByStatus
)
ProtoMessage
()
{}
func
(
*
ReqCollateralizeRecordByStatus
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_
a988fb4a6138197
2
,
[]
int
{
23
}
return
fileDescriptor_
collateralize_d6354d222229855
2
,
[]
int
{
23
}
}
func
(
m
*
ReqCollateralizeRecordByStatus
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_ReqCollateralizeRecordByStatus
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
ReqCollateralizeRecordByStatus
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_ReqCollateralizeRecordByStatus
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
ReqCollateralizeRecordByStatus
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_ReqCollateralizeRecordByStatus
.
Merge
(
m
,
src
)
func
(
dst
*
ReqCollateralizeRecordByStatus
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_ReqCollateralizeRecordByStatus
.
Merge
(
dst
,
src
)
}
func
(
m
*
ReqCollateralizeRecordByStatus
)
XXX_Size
()
int
{
return
xxx_messageInfo_ReqCollateralizeRecordByStatus
.
Size
(
m
)
...
...
@@ -1698,17 +1832,16 @@ func (m *RepCollateralizeRecords) Reset() { *m = RepCollateralizeRecords
func
(
m
*
RepCollateralizeRecords
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
RepCollateralizeRecords
)
ProtoMessage
()
{}
func
(
*
RepCollateralizeRecords
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_
a988fb4a6138197
2
,
[]
int
{
24
}
return
fileDescriptor_
collateralize_d6354d222229855
2
,
[]
int
{
24
}
}
func
(
m
*
RepCollateralizeRecords
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_RepCollateralizeRecords
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
RepCollateralizeRecords
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_RepCollateralizeRecords
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
RepCollateralizeRecords
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_RepCollateralizeRecords
.
Merge
(
m
,
src
)
func
(
dst
*
RepCollateralizeRecords
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_RepCollateralizeRecords
.
Merge
(
dst
,
src
)
}
func
(
m
*
RepCollateralizeRecords
)
XXX_Size
()
int
{
return
xxx_messageInfo_RepCollateralizeRecords
.
Size
(
m
)
...
...
@@ -1739,17 +1872,16 @@ func (m *ReqCollateralizeRecord) Reset() { *m = ReqCollateralizeRecord{}
func
(
m
*
ReqCollateralizeRecord
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
ReqCollateralizeRecord
)
ProtoMessage
()
{}
func
(
*
ReqCollateralizeRecord
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_
a988fb4a6138197
2
,
[]
int
{
25
}
return
fileDescriptor_
collateralize_d6354d222229855
2
,
[]
int
{
25
}
}
func
(
m
*
ReqCollateralizeRecord
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_ReqCollateralizeRecord
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
ReqCollateralizeRecord
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_ReqCollateralizeRecord
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
ReqCollateralizeRecord
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_ReqCollateralizeRecord
.
Merge
(
m
,
src
)
func
(
dst
*
ReqCollateralizeRecord
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_ReqCollateralizeRecord
.
Merge
(
dst
,
src
)
}
func
(
m
*
ReqCollateralizeRecord
)
XXX_Size
()
int
{
return
xxx_messageInfo_ReqCollateralizeRecord
.
Size
(
m
)
...
...
@@ -1786,17 +1918,16 @@ func (m *RepCollateralizeRecord) Reset() { *m = RepCollateralizeRecord{}
func
(
m
*
RepCollateralizeRecord
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
RepCollateralizeRecord
)
ProtoMessage
()
{}
func
(
*
RepCollateralizeRecord
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_
a988fb4a6138197
2
,
[]
int
{
26
}
return
fileDescriptor_
collateralize_d6354d222229855
2
,
[]
int
{
26
}
}
func
(
m
*
RepCollateralizeRecord
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_RepCollateralizeRecord
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
RepCollateralizeRecord
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_RepCollateralizeRecord
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
RepCollateralizeRecord
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_RepCollateralizeRecord
.
Merge
(
m
,
src
)
func
(
dst
*
RepCollateralizeRecord
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_RepCollateralizeRecord
.
Merge
(
dst
,
src
)
}
func
(
m
*
RepCollateralizeRecord
)
XXX_Size
()
int
{
return
xxx_messageInfo_RepCollateralizeRecord
.
Size
(
m
)
...
...
@@ -1832,17 +1963,16 @@ func (m *RepCollateralizeConfig) Reset() { *m = RepCollateralizeConfig{}
func
(
m
*
RepCollateralizeConfig
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
RepCollateralizeConfig
)
ProtoMessage
()
{}
func
(
*
RepCollateralizeConfig
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_
a988fb4a6138197
2
,
[]
int
{
27
}
return
fileDescriptor_
collateralize_d6354d222229855
2
,
[]
int
{
27
}
}
func
(
m
*
RepCollateralizeConfig
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_RepCollateralizeConfig
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
RepCollateralizeConfig
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_RepCollateralizeConfig
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
RepCollateralizeConfig
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_RepCollateralizeConfig
.
Merge
(
m
,
src
)
func
(
dst
*
RepCollateralizeConfig
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_RepCollateralizeConfig
.
Merge
(
dst
,
src
)
}
func
(
m
*
RepCollateralizeConfig
)
XXX_Size
()
int
{
return
xxx_messageInfo_RepCollateralizeConfig
.
Size
(
m
)
...
...
@@ -1914,17 +2044,16 @@ func (m *RepCollateralizePrice) Reset() { *m = RepCollateralizePrice{} }
func
(
m
*
RepCollateralizePrice
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
RepCollateralizePrice
)
ProtoMessage
()
{}
func
(
*
RepCollateralizePrice
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_
a988fb4a6138197
2
,
[]
int
{
28
}
return
fileDescriptor_
collateralize_d6354d222229855
2
,
[]
int
{
28
}
}
func
(
m
*
RepCollateralizePrice
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_RepCollateralizePrice
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
RepCollateralizePrice
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_RepCollateralizePrice
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
RepCollateralizePrice
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_RepCollateralizePrice
.
Merge
(
m
,
src
)
func
(
dst
*
RepCollateralizePrice
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_RepCollateralizePrice
.
Merge
(
dst
,
src
)
}
func
(
m
*
RepCollateralizePrice
)
XXX_Size
()
int
{
return
xxx_messageInfo_RepCollateralizePrice
.
Size
(
m
)
...
...
@@ -1974,9 +2103,9 @@ func init() {
proto
.
RegisterType
((
*
RepCollateralizePrice
)(
nil
),
"types.RepCollateralizePrice"
)
}
func
init
()
{
proto
.
RegisterFile
(
"collateralize.proto"
,
fileDescriptor_
a988fb4a6138197
2
)
}
func
init
()
{
proto
.
RegisterFile
(
"collateralize.proto"
,
fileDescriptor_
collateralize_d6354d222229855
2
)
}
var
fileDescriptor_
a988fb4a6138197
2
=
[]
byte
{
var
fileDescriptor_
collateralize_d6354d222229855
2
=
[]
byte
{
// 1273 bytes of a gzipped FileDescriptorProto
0x1f
,
0x8b
,
0x08
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x02
,
0xff
,
0xdc
,
0x58
,
0xdd
,
0x6e
,
0xdc
,
0x44
,
0x14
,
0xae
,
0xed
,
0xf5
,
0x6e
,
0xf6
,
0x6c
,
0x92
,
0xa6
,
0x93
,
0x34
,
0x98
,
0x10
,
0x45
,
0xab
,
0x11
,
...
...
plugin/dapp/collateralize/types/tx.go
View file @
bdf8e51e
...
...
@@ -6,52 +6,52 @@ package types
// CollateralizeCreateTx for construction
type
CollateralizeCreateTx
struct
{
TotalBalance
float64
`json:"totalBalance"`
Fee
int64
`json:"fee"`
TotalBalance
float64
`json:"totalBalance"`
Fee
int64
`json:"fee"`
}
// CollateralizeBorrowTx for construction
type
CollateralizeBorrowTx
struct
{
CollateralizeID
string
`json:"collateralizeId"`
Value
float64
`json:"value"`
Fee
int64
`json:"fee"`
CollateralizeID
string
`json:"collateralizeId"`
Value
float64
`json:"value"`
Fee
int64
`json:"fee"`
}
// CollateralizeRepayTx for construction
type
CollateralizeRepayTx
struct
{
CollateralizeID
string
`json:"collateralizeId"`
RecordID
string
`json:"recordID"`
Fee
int64
`json:"fee"`
RecordID
string
`json:"recordID"`
Fee
int64
`json:"fee"`
}
// CollateralizeAppednTx for construction
type
CollateralizeAppendTx
struct
{
CollateralizeID
string
`json:"collateralizeId"`
RecordID
string
`json:"recordID"`
Value
float64
`json:"value"`
Fee
int64
`json:"fee"`
CollateralizeID
string
`json:"collateralizeId"`
RecordID
string
`json:"recordID"`
Value
float64
`json:"value"`
Fee
int64
`json:"fee"`
}
// CollateralizeFeedTx for construction
type
CollateralizeFeedTx
struct
{
Price
[]
float64
`json:"price"`
Volume
[]
int64
`json:"volume"`
Fee
int64
`json:"fee"`
Price
[]
float64
`json:"price"`
Volume
[]
int64
`json:"volume"`
Fee
int64
`json:"fee"`
}
// CollateralizeRetrieveTx for construction
type
CollateralizeRetrieveTx
struct
{
CollateralizeID
string
`json:"collateralizeId"`
Balance
float64
`json:"Balance"`
Fee
int64
`json:"fee"`
CollateralizeID
string
`json:"collateralizeId"`
Balance
float64
`json:"Balance"`
Fee
int64
`json:"fee"`
}
// CollateralizeManageTx for construction
type
CollateralizeManageTx
struct
{
DebtCeiling
float64
`json:"debtCeiling"`
LiquidationRatio
float64
`json:"liquidationRatio"`
StabilityFeeRatio
float64
`json:"stabilityFeeRatio"`
Period
int64
`json:"period"`
TotalBalance
float64
`json:"totalBalance"`
Fee
int64
`json:"fee"`
DebtCeiling
float64
`json:"debtCeiling"`
LiquidationRatio
float64
`json:"liquidationRatio"`
StabilityFeeRatio
float64
`json:"stabilityFeeRatio"`
Period
int64
`json:"period"`
TotalBalance
float64
`json:"totalBalance"`
Fee
int64
`json:"fee"`
}
plugin/dapp/collateralize/types/types.go
View file @
bdf8e51e
...
...
@@ -15,18 +15,18 @@ const (
CollateralizeActionManage
//log for Collateralize
TyLogCollateralizeCreate
=
731
TyLogCollateralizeBorrow
=
732
TyLogCollateralizeRepay
=
733
TyLogCollateralizeAppend
=
734
TyLogCollateralizeFeed
=
735
TyLogCollateralizeRetrieve
=
736
TyLogCollateralizeCreate
=
731
TyLogCollateralizeBorrow
=
732
TyLogCollateralizeRepay
=
733
TyLogCollateralizeAppend
=
734
TyLogCollateralizeFeed
=
735
TyLogCollateralizeRetrieve
=
736
)
// Collateralize name
const
(
CollateralizeX
=
"collateralize"
CCNYTokenName
=
"CCNY"
CollateralizeX
=
"collateralize"
CCNYTokenName
=
"CCNY"
CollateralizePreLiquidationRatio
=
1.1
//TODO 预清算比例,抵押物价值跌到借出ccny价值110%的时候开始清算
)
...
...
@@ -50,4 +50,4 @@ const (
CollateralizeUserStatusExpire
CollateralizeUserStatusExpireLiquidate
CollateralizeUserStatusClose
)
\ No newline at end of file
)
plugin/dapp/issuance/cmd/test/test-rpc.sh
View file @
bdf8e51e
...
...
@@ -388,18 +388,18 @@ manage() {
echo
"========== # issuance add issuance-price-feed end =========="
chain33_BlockWait 1
${
MAIN_HTTP
}
# echo "========== # issuance add issuance-guarantor begin =========="
# tx=$(curl -ksd '{"method":"Chain33.CreateTransaction","params":[{"execer":"manage","actionName":"Modify","payload":{"key": "issuance-guarantor", "value":"'"${IssuanceAddr3}"'", "op":"add"}}]}' ${MAIN_HTTP} | jq -r ".result")
#
# data=$(curl -ksd '{"method":"Chain33.DecodeRawTransaction","params":[{"txHex":"'"$tx"'"}]}' ${MAIN_HTTP} | jq -r ".result.txs[0]")
# ok=$(jq '(.execer != "")' <<<"$data")
#
# [ "$ok" == true ]
# echo_rst "$FUNCNAME" "$?"
#
# chain33_SignRawTx "$tx" ${SystemManager} ${MAIN_HTTP}
# echo "========== # issuance add issuance-guarantor end =========="
# chain33_BlockWait 1 ${MAIN_HTTP}
# echo "========== # issuance add issuance-guarantor begin =========="
# tx=$(curl -ksd '{"method":"Chain33.CreateTransaction","params":[{"execer":"manage","actionName":"Modify","payload":{"key": "issuance-guarantor", "value":"'"${IssuanceAddr3}"'", "op":"add"}}]}' ${MAIN_HTTP} | jq -r ".result")
#
# data=$(curl -ksd '{"method":"Chain33.DecodeRawTransaction","params":[{"txHex":"'"$tx"'"}]}' ${MAIN_HTTP} | jq -r ".result.txs[0]")
# ok=$(jq '(.execer != "")' <<<"$data")
#
# [ "$ok" == true ]
# echo_rst "$FUNCNAME" "$?"
#
# chain33_SignRawTx "$tx" ${SystemManager} ${MAIN_HTTP}
# echo "========== # issuance add issuance-guarantor end =========="
# chain33_BlockWait 1 ${MAIN_HTTP}
}
token
()
{
...
...
plugin/dapp/issuance/commands/cmd.go
View file @
bdf8e51e
...
...
@@ -2,12 +2,13 @@ package commands
import
(
"fmt"
"strconv"
jsonrpc
"github.com/33cn/chain33/rpc/jsonclient"
rpctypes
"github.com/33cn/chain33/rpc/types"
"github.com/33cn/chain33/types"
pkt
"github.com/33cn/plugin/plugin/dapp/issuance/types"
"github.com/spf13/cobra"
"strconv"
)
// IssuanceCmd 斗牛游戏命令行
...
...
@@ -66,7 +67,7 @@ func IssuanceCreate(cmd *cobra.Command, args []string) {
params
:=
&
rpctypes
.
CreateTxIn
{
Execer
:
cfg
.
ExecName
(
pkt
.
IssuanceX
),
ActionName
:
"IssuanceCreate"
,
Payload
:
[]
byte
(
fmt
.
Sprintf
(
"{
\"
totalBalance
\"
:%f,
\"
debtCeiling
\"
:%f,
\"
liquidationRatio
\"
:%f,
\"
period
\"
:%d}"
,
Payload
:
[]
byte
(
fmt
.
Sprintf
(
"{
\"
totalBalance
\"
:%f,
\"
debtCeiling
\"
:%f,
\"
liquidationRatio
\"
:%f,
\"
period
\"
:%d}"
,
balance
,
debtCeiling
,
liquidationRatio
,
period
)),
}
...
...
@@ -351,8 +352,8 @@ func IssuanceQuery(cmd *cobra.Command, args []string) {
req
:=
&
pkt
.
ReqIssuanceRecordsByAddr
{
IssuanceId
:
issuanceID
,
Status
:
int32
(
status
),
Addr
:
address
,
Status
:
int32
(
status
),
Addr
:
address
,
}
params
.
Payload
=
types
.
MustPBToJSON
(
req
)
var
res
pkt
.
RepIssuanceRecords
...
...
@@ -363,18 +364,18 @@ func IssuanceQuery(cmd *cobra.Command, args []string) {
req
:=
&
pkt
.
ReqIssuanceRecordsByStatus
{
IssuanceId
:
issuanceID
,
Status
:
int32
(
status
),
Status
:
int32
(
status
),
}
params
.
Payload
=
types
.
MustPBToJSON
(
req
)
var
res
pkt
.
RepIssuanceRecords
ctx
:=
jsonrpc
.
NewRPCCtx
(
rpcLaddr
,
"Chain33.Query"
,
params
,
&
res
)
ctx
.
Run
()
}
else
if
debtID
!=
""
{
}
else
if
debtID
!=
""
{
params
.
FuncName
=
"IssuanceRecordByID"
req
:=
&
pkt
.
ReqIssuanceDebtInfo
{
IssuanceId
:
issuanceID
,
DebtId
:
debtID
,
DebtId
:
debtID
,
}
params
.
Payload
=
types
.
MustPBToJSON
(
req
)
var
res
pkt
.
RepIssuanceDebtInfo
...
...
@@ -394,7 +395,7 @@ func IssuanceQuery(cmd *cobra.Command, args []string) {
}
else
if
statusStr
!=
""
{
params
.
FuncName
=
"IssuanceByStatus"
req
:=
&
pkt
.
ReqIssuanceByStatus
{
Status
:
int32
(
status
)}
req
:=
&
pkt
.
ReqIssuanceByStatus
{
Status
:
int32
(
status
)}
params
.
Payload
=
types
.
MustPBToJSON
(
req
)
var
res
pkt
.
RepIssuanceIDs
ctx
:=
jsonrpc
.
NewRPCCtx
(
rpcLaddr
,
"Chain33.Query"
,
params
,
&
res
)
...
...
plugin/dapp/issuance/executor/exec_del_local.go
View file @
bdf8e51e
...
...
@@ -86,4 +86,4 @@ func (c *Issuance) ExecDelLocal_Close(payload *pty.IssuanceClose, tx *types.Tran
// ExecDelLocal_Manage Action
func
(
c
*
Issuance
)
ExecDelLocal_Manage
(
payload
*
pty
.
IssuanceManage
,
tx
*
types
.
Transaction
,
receiptData
*
types
.
ReceiptData
,
index
int
)
(
*
types
.
LocalDBSet
,
error
)
{
return
c
.
execDelLocal
(
tx
,
receiptData
)
}
\ No newline at end of file
}
plugin/dapp/issuance/executor/issuance.go
View file @
bdf8e51e
...
...
@@ -63,8 +63,8 @@ func (c *Issuance) GetDriverName() string {
func
(
c
*
Issuance
)
addIssuanceID
(
index
int64
,
issuanceId
string
)
(
kvs
[]
*
types
.
KeyValue
)
{
key
:=
calcIssuanceKey
(
issuanceId
,
index
)
record
:=
&
pty
.
IssuanceRecord
{
IssuanceId
:
issuanceId
,
Index
:
index
,
IssuanceId
:
issuanceId
,
Index
:
index
,
}
kv
:=
&
types
.
KeyValue
{
Key
:
key
,
Value
:
types
.
Encode
(
record
)}
...
...
@@ -83,8 +83,8 @@ func (c *Issuance) deleteIssuanceID(index int64, issuanceId string) (kvs []*type
func
(
c
*
Issuance
)
addIssuanceStatus
(
status
int32
,
index
int64
,
issuanceId
string
)
(
kvs
[]
*
types
.
KeyValue
)
{
key
:=
calcIssuanceStatusKey
(
status
,
index
)
record
:=
&
pty
.
IssuanceRecord
{
IssuanceId
:
issuanceId
,
Index
:
index
,
IssuanceId
:
issuanceId
,
Index
:
index
,
}
kv
:=
&
types
.
KeyValue
{
Key
:
key
,
Value
:
types
.
Encode
(
record
)}
...
...
@@ -103,9 +103,9 @@ func (c *Issuance) deleteIssuanceStatus(status int32, index int64) (kvs []*types
func
(
c
*
Issuance
)
addIssuanceRecordAddr
(
accountAddr
string
,
index
int64
,
debtId
string
,
issuanceId
string
)
(
kvs
[]
*
types
.
KeyValue
)
{
key
:=
calcIssuanceRecordAddrKey
(
accountAddr
,
index
)
record
:=
&
pty
.
IssuanceRecord
{
IssuanceId
:
issuanceId
,
DebtId
:
debtId
,
Index
:
index
,
IssuanceId
:
issuanceId
,
DebtId
:
debtId
,
Index
:
index
,
}
kv
:=
&
types
.
KeyValue
{
Key
:
key
,
Value
:
types
.
Encode
(
record
)}
...
...
@@ -125,10 +125,10 @@ func (c *Issuance) addIssuanceRecordStatus(recordStatus int32, accountAddr strin
key
:=
calcIssuanceRecordStatusKey
(
recordStatus
,
index
)
record
:=
&
pty
.
IssuanceRecord
{
IssuanceId
:
issuanceId
,
DebtId
:
debtId
,
Addr
:
accountAddr
,
Index
:
index
,
IssuanceId
:
issuanceId
,
DebtId
:
debtId
,
Addr
:
accountAddr
,
Index
:
index
,
}
kv
:=
&
types
.
KeyValue
{
Key
:
key
,
Value
:
types
.
Encode
(
record
)}
...
...
@@ -148,8 +148,8 @@ func (c *Issuance) addIssuancePriceRecord(recordTime int64, price float64) (kvs
key
:=
calcIssuancePriceKey
(
string
(
recordTime
))
record
:=
&
pty
.
IssuanceAssetPriceRecord
{
RecordTime
:
recordTime
,
BtyPrice
:
price
,
RecordTime
:
recordTime
,
BtyPrice
:
price
,
}
kv
:=
&
types
.
KeyValue
{
Key
:
key
,
Value
:
types
.
Encode
(
record
)}
kvs
=
append
(
kvs
,
kv
)
...
...
@@ -159,7 +159,7 @@ func (c *Issuance) addIssuancePriceRecord(recordTime int64, price float64) (kvs
func
(
c
*
Issuance
)
deleteIssuancePriceRecord
(
recordTime
int64
)
(
kvs
[]
*
types
.
KeyValue
)
{
key
:=
calcIssuancePriceKey
(
string
(
recordTime
))
kv
:=
&
types
.
KeyValue
{
Key
:
key
,
Value
:
nil
}
kv
:=
&
types
.
KeyValue
{
Key
:
key
,
Value
:
nil
}
kvs
=
append
(
kvs
,
kv
)
return
kvs
}
...
...
@@ -176,4 +176,4 @@ func (c *Issuance) ExecutorOrder() int64 {
return
drivers
.
ExecLocalSameTime
}
return
c
.
DriverBase
.
ExecutorOrder
()
}
\ No newline at end of file
}
plugin/dapp/issuance/executor/issuance_test.go
View file @
bdf8e51e
package
executor
import
(
"github.com/33cn/chain33/client"
"testing"
"time"
"github.com/33cn/chain33/client"
"github.com/33cn/chain33/account"
apimock
"github.com/33cn/chain33/client/mocks"
"github.com/33cn/chain33/common"
...
...
@@ -40,7 +41,7 @@ var (
[]
byte
(
"1JRNjdEqp4LJ5fqycUBm9ayCKSeeskgMKR"
),
[]
byte
(
"12evczYyX9ZKPYvwSEvRkRyTjpSrJuLudg"
),
}
total
=
10000
*
types
.
Coin
total
=
10000
*
types
.
Coin
totalToken
=
100000
*
types
.
Coin
)
...
...
@@ -96,7 +97,7 @@ func initEnv() *execEnv {
accA
.
SetDB
(
stateDB
)
accA
.
SaveExecAccount
(
execAddr
,
&
accountA
)
manageKeySet
(
"issuance-manage"
,
accountA
.
Addr
,
stateDB
)
tokenAccA
,
_
:=
account
.
NewAccountDB
(
cfg
,
tokenE
.
GetName
(),
pkt
.
CCNYTokenName
,
stateDB
)
tokenAccA
,
_
:=
account
.
NewAccountDB
(
cfg
,
tokenE
.
GetName
(),
pkt
.
CCNYTokenName
,
stateDB
)
tokenAccA
.
SaveExecAccount
(
execAddr
,
&
accountAToken
)
accB
:=
account
.
NewCoinsAccount
(
cfg
)
...
...
@@ -110,14 +111,14 @@ func initEnv() *execEnv {
manageKeySet
(
"issuance-guarantor"
,
accountC
.
Addr
,
stateDB
)
return
&
execEnv
{
blockTime
:
time
.
Now
()
.
Unix
(),
blockHeight
:
cfg
.
GetDappFork
(
pkt
.
IssuanceX
,
"Enable"
),
difficulty
:
1539918074
,
kvdb
:
kvdb
,
api
:
api
,
db
:
stateDB
,
execAddr
:
execAddr
,
cfg
:
cfg
,
blockTime
:
time
.
Now
()
.
Unix
(),
blockHeight
:
cfg
.
GetDappFork
(
pkt
.
IssuanceX
,
"Enable"
),
difficulty
:
1539918074
,
kvdb
:
kvdb
,
api
:
api
,
db
:
stateDB
,
execAddr
:
execAddr
,
cfg
:
cfg
,
}
}
...
...
@@ -126,10 +127,10 @@ func TestIssuance(t *testing.T) {
// issuance create
p1
:=
&
pkt
.
IssuanceCreateTx
{
TotalBalance
:
1000
,
DebtCeiling
:
100
,
TotalBalance
:
1000
,
DebtCeiling
:
100
,
LiquidationRatio
:
0.25
,
Period
:
5
,
Period
:
5
,
}
createTx
,
err
:=
pkt
.
CreateRawIssuanceCreateTx
(
env
.
cfg
,
p1
)
if
err
!=
nil
{
...
...
@@ -163,21 +164,20 @@ func TestIssuance(t *testing.T) {
}
issuanceID
:=
createTx
.
Hash
()
// query issuance by id
res
,
err
:=
exec
.
Query
(
"IssuanceInfoByID"
,
types
.
Encode
(
&
pkt
.
ReqIssuanceInfo
{
IssuanceId
:
common
.
ToHex
(
issuanceID
)
,
}))
res
,
err
:=
exec
.
Query
(
"IssuanceInfoByID"
,
types
.
Encode
(
&
pkt
.
ReqIssuanceInfo
{
IssuanceId
:
common
.
ToHex
(
issuanceID
)}))
assert
.
Nil
(
t
,
err
)
assert
.
NotNil
(
t
,
res
)
// query issuance by status
res
,
err
=
exec
.
Query
(
"IssuanceByStatus"
,
types
.
Encode
(
&
pkt
.
ReqIssuanceByStatus
{
Status
:
1
}))
res
,
err
=
exec
.
Query
(
"IssuanceByStatus"
,
types
.
Encode
(
&
pkt
.
ReqIssuanceByStatus
{
Status
:
1
}))
assert
.
Nil
(
t
,
err
)
assert
.
NotNil
(
t
,
res
)
// query issuances by ids
var
issuanceIDsS
[]
string
issuanceIDsS
=
append
(
issuanceIDsS
,
common
.
ToHex
(
issuanceID
))
res
,
err
=
exec
.
Query
(
"IssuanceInfoByIDs"
,
types
.
Encode
(
&
pkt
.
ReqIssuanceInfos
{
IssuanceIds
:
issuanceIDsS
}))
res
,
err
=
exec
.
Query
(
"IssuanceInfoByIDs"
,
types
.
Encode
(
&
pkt
.
ReqIssuanceInfos
{
IssuanceIds
:
issuanceIDsS
}))
assert
.
Nil
(
t
,
err
)
assert
.
NotNil
(
t
,
res
)
// issuance price
p2
:=
&
pkt
.
IssuanceFeedTx
{}
p2
.
Price
=
append
(
p2
.
Price
,
1
)
...
...
@@ -212,7 +212,6 @@ func TestIssuance(t *testing.T) {
assert
.
Nil
(
t
,
err
)
assert
.
NotNil
(
t
,
res
)
// issuance manage
p3
:=
&
pkt
.
IssuanceManageTx
{}
p3
.
Addr
=
append
(
p3
.
Addr
,
string
(
Nodes
[
1
]))
...
...
@@ -242,11 +241,10 @@ func TestIssuance(t *testing.T) {
env
.
kvdb
.
Set
(
kv
.
Key
,
kv
.
Value
)
}
// issuance debt
p4
:=
&
pkt
.
IssuanceDebtTx
{
IssuanceID
:
common
.
ToHex
(
issuanceID
),
Value
:
100
,
Value
:
100
,
}
createTx
,
err
=
pkt
.
CreateRawIssuanceDebtTx
(
env
.
cfg
,
p4
)
if
err
!=
nil
{
...
...
@@ -281,20 +279,19 @@ func TestIssuance(t *testing.T) {
assert
.
NotNil
(
t
,
res
)
// query issuance by status
res
,
err
=
exec
.
Query
(
"IssuanceRecordsByStatus"
,
types
.
Encode
(
&
pkt
.
ReqIssuanceRecordsByStatus
{
IssuanceId
:
common
.
ToHex
(
issuanceID
),
Status
:
1
}))
types
.
Encode
(
&
pkt
.
ReqIssuanceRecordsByStatus
{
IssuanceId
:
common
.
ToHex
(
issuanceID
),
Status
:
1
}))
assert
.
Nil
(
t
,
err
)
assert
.
NotNil
(
t
,
res
)
// query issuance by addr
res
,
err
=
exec
.
Query
(
"IssuanceRecordsByAddr"
,
types
.
Encode
(
&
pkt
.
ReqIssuanceRecordsByAddr
{
IssuanceId
:
common
.
ToHex
(
issuanceID
),
Addr
:
string
(
Nodes
[
1
]),
Status
:
1
}))
types
.
Encode
(
&
pkt
.
ReqIssuanceRecordsByAddr
{
IssuanceId
:
common
.
ToHex
(
issuanceID
),
Addr
:
string
(
Nodes
[
1
]),
Status
:
1
}))
assert
.
Nil
(
t
,
err
)
assert
.
NotNil
(
t
,
res
)
// issuance repay
p5
:=
&
pkt
.
IssuanceRepayTx
{
IssuanceID
:
common
.
ToHex
(
issuanceID
),
DebtID
:
common
.
ToHex
(
debtID
),
DebtID
:
common
.
ToHex
(
debtID
),
}
createTx
,
err
=
pkt
.
CreateRawIssuanceRepayTx
(
env
.
cfg
,
p5
)
if
err
!=
nil
{
...
...
@@ -323,20 +320,19 @@ func TestIssuance(t *testing.T) {
}
// query issuance by status
res
,
err
=
exec
.
Query
(
"IssuanceRecordsByStatus"
,
types
.
Encode
(
&
pkt
.
ReqIssuanceRecordsByStatus
{
IssuanceId
:
common
.
ToHex
(
issuanceID
),
Status
:
6
}))
types
.
Encode
(
&
pkt
.
ReqIssuanceRecordsByStatus
{
IssuanceId
:
common
.
ToHex
(
issuanceID
),
Status
:
6
}))
assert
.
Nil
(
t
,
err
)
assert
.
NotNil
(
t
,
res
)
// query issuance by addr
res
,
err
=
exec
.
Query
(
"IssuanceRecordsByAddr"
,
types
.
Encode
(
&
pkt
.
ReqIssuanceRecordsByAddr
{
IssuanceId
:
common
.
ToHex
(
issuanceID
),
Addr
:
string
(
Nodes
[
1
]),
Status
:
6
}))
types
.
Encode
(
&
pkt
.
ReqIssuanceRecordsByAddr
{
IssuanceId
:
common
.
ToHex
(
issuanceID
),
Addr
:
string
(
Nodes
[
1
]),
Status
:
6
}))
assert
.
Nil
(
t
,
err
)
assert
.
NotNil
(
t
,
res
)
// issuance liquidate
p6
:=
&
pkt
.
IssuanceDebtTx
{
IssuanceID
:
common
.
ToHex
(
issuanceID
),
Value
:
100
,
Value
:
100
,
}
createTx
,
err
=
pkt
.
CreateRawIssuanceDebtTx
(
env
.
cfg
,
p6
)
if
err
!=
nil
{
...
...
@@ -394,14 +390,14 @@ func TestIssuance(t *testing.T) {
}
// query issuance by status
res
,
err
=
exec
.
Query
(
"IssuanceRecordsByStatus"
,
types
.
Encode
(
&
pkt
.
ReqIssuanceRecordsByStatus
{
IssuanceId
:
common
.
ToHex
(
issuanceID
),
Status
:
3
}))
types
.
Encode
(
&
pkt
.
ReqIssuanceRecordsByStatus
{
IssuanceId
:
common
.
ToHex
(
issuanceID
),
Status
:
3
}))
assert
.
Nil
(
t
,
err
)
assert
.
NotNil
(
t
,
res
)
// expire liquidate
p8
:=
&
pkt
.
IssuanceDebtTx
{
IssuanceID
:
common
.
ToHex
(
issuanceID
),
Value
:
100
,
Value
:
100
,
}
createTx
,
err
=
pkt
.
CreateRawIssuanceDebtTx
(
env
.
cfg
,
p8
)
if
err
!=
nil
{
...
...
@@ -459,11 +455,10 @@ func TestIssuance(t *testing.T) {
}
// query issuance by status
res
,
err
=
exec
.
Query
(
"IssuanceRecordsByStatus"
,
types
.
Encode
(
&
pkt
.
ReqIssuanceRecordsByStatus
{
IssuanceId
:
common
.
ToHex
(
issuanceID
),
Status
:
5
}))
types
.
Encode
(
&
pkt
.
ReqIssuanceRecordsByStatus
{
IssuanceId
:
common
.
ToHex
(
issuanceID
),
Status
:
5
}))
assert
.
Nil
(
t
,
err
)
assert
.
NotNil
(
t
,
res
)
// issuance close
p10
:=
&
pkt
.
IssuanceCloseTx
{
IssuanceID
:
common
.
ToHex
(
issuanceID
),
...
...
@@ -494,7 +489,7 @@ func TestIssuance(t *testing.T) {
env
.
kvdb
.
Set
(
kv
.
Key
,
kv
.
Value
)
}
// query issuance by status
res
,
err
=
exec
.
Query
(
"IssuanceByStatus"
,
types
.
Encode
(
&
pkt
.
ReqIssuanceByStatus
{
Status
:
2
}))
res
,
err
=
exec
.
Query
(
"IssuanceByStatus"
,
types
.
Encode
(
&
pkt
.
ReqIssuanceByStatus
{
Status
:
2
}))
assert
.
Nil
(
t
,
err
)
assert
.
NotNil
(
t
,
res
)
}
...
...
plugin/dapp/issuance/executor/issuancedb.go
View file @
bdf8e51e
...
...
@@ -6,6 +6,8 @@ package executor
import
(
"fmt"
"math"
"github.com/33cn/chain33/account"
"github.com/33cn/chain33/common"
dbm
"github.com/33cn/chain33/common/db"
...
...
@@ -13,7 +15,6 @@ import (
"github.com/33cn/chain33/types"
pty
"github.com/33cn/plugin/plugin/dapp/issuance/types"
tokenE
"github.com/33cn/plugin/plugin/dapp/token/executor"
"math"
)
// List control
...
...
@@ -25,12 +26,12 @@ const (
)
const
(
Coin
=
types
.
Coin
// 1e8
DefaultDebtCeiling
=
100000
*
Coin
// 默认借贷限额
DefaultLiquidationRatio
=
0.25
// 默认质押比
DefaultPeriod
=
3600
*
24
*
365
// 默认合约限期
PriceWarningRate
=
1.3
// 价格提前预警率
ExpireWarningTime
=
3600
*
24
*
10
// 提前10天超时预警
Coin
=
types
.
Coin
// 1e8
DefaultDebtCeiling
=
100000
*
Coin
// 默认借贷限额
DefaultLiquidationRatio
=
0.25
// 默认质押比
DefaultPeriod
=
3600
*
24
*
365
// 默认合约限期
PriceWarningRate
=
1.3
// 价格提前预警率
ExpireWarningTime
=
3600
*
24
*
10
// 提前10天超时预警
)
func
getManageKey
(
key
string
,
db
dbm
.
KV
)
([]
byte
,
error
)
{
...
...
@@ -154,8 +155,8 @@ func PriceKey() (key []byte) {
// Action struct
type
Action
struct
{
coinsAccount
*
account
.
DB
// bty账户
tokenAccount
*
account
.
DB
// ccny账户
coinsAccount
*
account
.
DB
// bty账户
tokenAccount
*
account
.
DB
// ccny账户
db
dbm
.
KV
localDB
dbm
.
Lister
txhash
[]
byte
...
...
@@ -165,7 +166,7 @@ type Action struct {
execaddr
string
difficulty
uint64
index
int
Issuance
*
Issuance
Issuance
*
Issuance
}
// NewIssuanceAction generate New Action
...
...
@@ -180,7 +181,7 @@ func NewIssuanceAction(c *Issuance, tx *types.Transaction, index int) *Action {
}
return
&
Action
{
coinsAccount
:
c
.
GetCoinsAccount
(),
tokenAccount
:
tokenDb
,
db
:
c
.
GetStateDB
(),
localDB
:
c
.
GetLocalDB
(),
coinsAccount
:
c
.
GetCoinsAccount
(),
tokenAccount
:
tokenDb
,
db
:
c
.
GetStateDB
(),
localDB
:
c
.
GetLocalDB
(),
txhash
:
hash
,
fromaddr
:
fromaddr
,
blocktime
:
c
.
GetBlockTime
(),
height
:
c
.
GetHeight
(),
execaddr
:
dapp
.
ExecAddress
(
string
(
tx
.
Execer
)),
difficulty
:
c
.
GetDifficulty
(),
index
:
index
,
Issuance
:
c
}
}
...
...
@@ -339,7 +340,7 @@ func (action *Action) IssuanceManage(manage *pty.IssuanceManage) (*types.Receipt
value
:=
types
.
Encode
(
&
item
)
action
.
db
.
Set
(
AddrKey
(),
value
)
kv
=
append
(
kv
,
&
types
.
KeyValue
{
Key
:
AddrKey
(),
Value
:
value
})
kv
=
append
(
kv
,
&
types
.
KeyValue
{
Key
:
AddrKey
(),
Value
:
value
})
}
else
{
err
=
types
.
Decode
(
data
,
&
item
)
if
err
!=
nil
{
...
...
@@ -349,7 +350,7 @@ func (action *Action) IssuanceManage(manage *pty.IssuanceManage) (*types.Receipt
item
.
GetArr
()
.
Value
=
append
(
item
.
GetArr
()
.
Value
,
manage
.
SuperAddrs
...
)
value
:=
types
.
Encode
(
&
item
)
action
.
db
.
Set
(
AddrKey
(),
value
)
kv
=
append
(
kv
,
&
types
.
KeyValue
{
Key
:
AddrKey
(),
Value
:
value
})
kv
=
append
(
kv
,
&
types
.
KeyValue
{
Key
:
AddrKey
(),
Value
:
value
})
}
receipt
=
&
types
.
Receipt
{
Ty
:
types
.
ExecOk
,
KV
:
kv
,
Logs
:
nil
}
...
...
@@ -388,11 +389,11 @@ func (action *Action) IssuanceCreate(create *pty.IssuanceCreate) (*types.Receipt
// 参数检查
if
create
.
GetTotalBalance
()
<=
0
{
clog
.
Error
(
"IssuanceCreate"
,
"addr"
,
action
.
fromaddr
,
"execaddr"
,
action
.
execaddr
,
"total balance"
,
create
.
GetTotalBalance
(),
"error"
,
types
.
ErrAmount
)
return
nil
,
types
.
ErrAmount
return
nil
,
types
.
ErrAmount
}
if
create
.
DebtCeiling
<
0
||
create
.
LiquidationRatio
<
0
||
create
.
Period
<
0
{
if
create
.
DebtCeiling
<
0
||
create
.
LiquidationRatio
<
0
||
create
.
Period
<
0
{
clog
.
Error
(
"IssuanceCreate"
,
"addr"
,
action
.
fromaddr
,
"execaddr"
,
action
.
execaddr
,
"error"
,
types
.
ErrInvalidParam
)
return
nil
,
types
.
ErrInvalidParam
return
nil
,
types
.
ErrInvalidParam
}
// 检查ccny余额
...
...
@@ -456,14 +457,14 @@ func (action *Action) IssuanceCreate(create *pty.IssuanceCreate) (*types.Receipt
}
// 根据最近抵押物价格计算需要冻结的BTY数量
func
getBtyNumToFrozen
(
value
int64
,
price
float64
,
ratio
float64
)
(
int64
,
error
)
{
func
getBtyNumToFrozen
(
value
int64
,
price
float64
,
ratio
float64
)
(
int64
,
error
)
{
if
price
==
0
{
clog
.
Error
(
"Bty price should greate to 0"
)
return
0
,
pty
.
ErrPriceInvalid
}
valueReal
:=
float64
(
value
)
/
1e8
btyValue
:=
valueReal
/
(
price
*
ratio
)
valueReal
:=
float64
(
value
)
/
1e8
btyValue
:=
valueReal
/
(
price
*
ratio
)
return
int64
(
math
.
Trunc
((
btyValue
+
0.0000001
)
*
1e4
))
*
1e4
,
nil
}
...
...
@@ -537,7 +538,7 @@ func (action *Action) IssuanceDebt(debt *pty.IssuanceDebt) (*types.Receipt, erro
// 借贷金额检查
if
debt
.
GetValue
()
<=
0
{
clog
.
Error
(
"IssuanceDebt"
,
"CollID"
,
issu
.
IssuanceId
,
"addr"
,
action
.
fromaddr
,
"execaddr"
,
action
.
execaddr
,
"debt value"
,
debt
.
GetValue
(),
"error"
,
types
.
ErrInvalidParam
)
return
nil
,
types
.
ErrInvalidParam
return
nil
,
types
.
ErrInvalidParam
}
// 借贷金额不超过个人限额
...
...
@@ -735,7 +736,7 @@ func (action *Action) systemLiquidation(issu *pty.Issuance, price float64) (*typ
var
kv
[]
*
types
.
KeyValue
for
index
,
debtRecord
:=
range
issu
.
DebtRecords
{
if
debtRecord
.
LiquidationPrice
*
PriceWarningRate
<
price
{
if
debtRecord
.
LiquidationPrice
*
PriceWarningRate
<
price
{
if
debtRecord
.
Status
==
pty
.
IssuanceUserStatusWarning
{
debtRecord
.
PreStatus
=
debtRecord
.
Status
debtRecord
.
Status
=
pty
.
IssuanceUserStatusCreate
...
...
@@ -797,7 +798,7 @@ func (action *Action) expireLiquidation(issu *pty.Issuance) (*types.Receipt, err
var
kv
[]
*
types
.
KeyValue
for
index
,
debtRecord
:=
range
issu
.
DebtRecords
{
if
debtRecord
.
ExpireTime
-
ExpireWarningTime
>
action
.
blocktime
{
if
debtRecord
.
ExpireTime
-
ExpireWarningTime
>
action
.
blocktime
{
continue
}
...
...
@@ -862,7 +863,7 @@ func pricePolicy(feed *pty.IssuanceFeed) float64 {
return
0
}
for
i
,
price
:=
range
feed
.
Price
{
totalPrice
+=
price
*
(
float64
(
feed
.
Volume
[
i
])
/
float64
(
totalVolume
))
totalPrice
+=
price
*
(
float64
(
feed
.
Volume
[
i
])
/
float64
(
totalVolume
))
}
return
totalPrice
...
...
@@ -903,7 +904,7 @@ func (action *Action) IssuanceFeed(feed *pty.IssuanceFeed) (*types.Receipt, erro
}
// 超时清算判断
if
issu
.
LatestExpireTime
-
ExpireWarningTime
<=
action
.
blocktime
{
if
issu
.
LatestExpireTime
-
ExpireWarningTime
<=
action
.
blocktime
{
receipt
,
err
:=
action
.
expireLiquidation
(
issu
)
if
err
!=
nil
{
clog
.
Error
(
"IssuancePriceFeed"
,
"Issuance ID"
,
issu
.
IssuanceId
,
"expire liquidation error"
,
err
)
...
...
plugin/dapp/issuance/executor/keys.go
View file @
bdf8e51e
...
...
@@ -44,4 +44,4 @@ func calcIssuanceRecordStatusPrefix(status string) []byte {
func
calcIssuanceRecordStatusKey
(
status
int32
,
index
int64
)
[]
byte
{
key
:=
fmt
.
Sprintf
(
"LODB-issuance-record-status:%d:%018d"
,
status
,
index
)
return
[]
byte
(
key
)
}
\ No newline at end of file
}
plugin/dapp/issuance/executor/query.go
View file @
bdf8e51e
...
...
@@ -10,46 +10,46 @@ import (
)
func
(
c
*
Issuance
)
Query_IssuanceInfoByID
(
req
*
pty
.
ReqIssuanceInfo
)
(
types
.
Message
,
error
)
{
issu
,
err
:=
queryIssuanceByID
(
c
.
GetStateDB
(),
req
.
IssuanceId
)
issu
,
err
:=
queryIssuanceByID
(
c
.
GetStateDB
(),
req
.
IssuanceId
)
if
err
!=
nil
{
clog
.
Error
(
"Query_IssuanceInfoByID"
,
"id"
,
req
.
IssuanceId
,
"error"
,
err
)
return
nil
,
err
}
return
&
pty
.
RepIssuanceCurrentInfo
{
Status
:
issu
.
Status
,
TotalBalance
:
issu
.
TotalBalance
,
DebtCeiling
:
issu
.
DebtCeiling
,
LiquidationRatio
:
issu
.
LiquidationRatio
,
Balance
:
issu
.
Balance
,
CollateralValue
:
issu
.
CollateralValue
,
DebtValue
:
issu
.
DebtValue
,
Period
:
issu
.
Period
,
IssuId
:
issu
.
IssuanceId
,
CreateTime
:
issu
.
CreateTime
,
Status
:
issu
.
Status
,
TotalBalance
:
issu
.
TotalBalance
,
DebtCeiling
:
issu
.
DebtCeiling
,
LiquidationRatio
:
issu
.
LiquidationRatio
,
Balance
:
issu
.
Balance
,
CollateralValue
:
issu
.
CollateralValue
,
DebtValue
:
issu
.
DebtValue
,
Period
:
issu
.
Period
,
IssuId
:
issu
.
IssuanceId
,
CreateTime
:
issu
.
CreateTime
,
},
nil
}
func
(
c
*
Issuance
)
Query_IssuanceInfoByIDs
(
req
*
pty
.
ReqIssuanceInfos
)
(
types
.
Message
,
error
)
{
infos
:=
&
pty
.
RepIssuanceCurrentInfos
{}
for
_
,
id
:=
range
req
.
IssuanceIds
{
issu
,
err
:=
queryIssuanceByID
(
c
.
GetStateDB
(),
id
)
issu
,
err
:=
queryIssuanceByID
(
c
.
GetStateDB
(),
id
)
if
err
!=
nil
{
clog
.
Error
(
"Query_IssuanceInfoByID"
,
"id"
,
id
,
"error"
,
err
)
return
nil
,
err
}
infos
.
Infos
=
append
(
infos
.
Infos
,
&
pty
.
RepIssuanceCurrentInfo
{
Status
:
issu
.
Status
,
TotalBalance
:
issu
.
TotalBalance
,
DebtCeiling
:
issu
.
DebtCeiling
,
LiquidationRatio
:
issu
.
LiquidationRatio
,
Balance
:
issu
.
Balance
,
CollateralValue
:
issu
.
CollateralValue
,
DebtValue
:
issu
.
DebtValue
,
Period
:
issu
.
Period
,
IssuId
:
issu
.
IssuanceId
,
CreateTime
:
issu
.
CreateTime
,
Status
:
issu
.
Status
,
TotalBalance
:
issu
.
TotalBalance
,
DebtCeiling
:
issu
.
DebtCeiling
,
LiquidationRatio
:
issu
.
LiquidationRatio
,
Balance
:
issu
.
Balance
,
CollateralValue
:
issu
.
CollateralValue
,
DebtValue
:
issu
.
DebtValue
,
Period
:
issu
.
Period
,
IssuId
:
issu
.
IssuanceId
,
CreateTime
:
issu
.
CreateTime
,
})
}
...
...
@@ -91,7 +91,7 @@ func (c *Issuance) Query_IssuanceRecordsByAddr(req *pty.ReqIssuanceRecordsByAddr
if
req
.
Status
==
0
{
ret
.
Records
=
records
}
else
{
for
_
,
record
:=
range
records
{
for
_
,
record
:=
range
records
{
if
record
.
Status
==
req
.
Status
{
ret
.
Records
=
append
(
ret
.
Records
,
record
)
}
...
...
@@ -120,5 +120,5 @@ func (c *Issuance) Query_IssuancePrice(req *pty.ReqIssuanceRecordsByStatus) (typ
return
nil
,
err
}
return
&
pty
.
RepIssuancePrice
{
Price
:
price
},
nil
}
\ No newline at end of file
return
&
pty
.
RepIssuancePrice
{
Price
:
price
},
nil
}
plugin/dapp/issuance/types/issuance.go
View file @
bdf8e51e
...
...
@@ -54,8 +54,8 @@ func (issuance *IssuanceType) GetName() string {
func
(
issuance
*
IssuanceType
)
GetLogMap
()
map
[
int64
]
*
types
.
LogInfo
{
return
map
[
int64
]
*
types
.
LogInfo
{
TyLogIssuanceCreate
:
{
Ty
:
reflect
.
TypeOf
(
ReceiptIssuance
{}),
Name
:
"LogIssuanceCreate"
},
TyLogIssuanceDebt
:
{
Ty
:
reflect
.
TypeOf
(
ReceiptIssuance
{}),
Name
:
"LogIssuanceDebt"
},
TyLogIssuanceRepay
:
{
Ty
:
reflect
.
TypeOf
(
ReceiptIssuance
{}),
Name
:
"LogIssuanceRepay"
},
TyLogIssuanceDebt
:
{
Ty
:
reflect
.
TypeOf
(
ReceiptIssuance
{}),
Name
:
"LogIssuanceDebt"
},
TyLogIssuanceRepay
:
{
Ty
:
reflect
.
TypeOf
(
ReceiptIssuance
{}),
Name
:
"LogIssuanceRepay"
},
TyLogIssuanceFeed
:
{
Ty
:
reflect
.
TypeOf
(
ReceiptIssuance
{}),
Name
:
"LogIssuanceFeed"
},
TyLogIssuanceClose
:
{
Ty
:
reflect
.
TypeOf
(
ReceiptIssuance
{}),
Name
:
"LogIssuanceClose"
},
}
...
...
@@ -128,7 +128,7 @@ func (issuance IssuanceType) CreateTx(action string, message json.RawMessage) (*
func
(
issuance
IssuanceType
)
GetTypeMap
()
map
[
string
]
int32
{
return
map
[
string
]
int32
{
"Create"
:
IssuanceActionCreate
,
"Debt"
:
IssuanceActionDebt
,
"Debt"
:
IssuanceActionDebt
,
"Repay"
:
IssuanceActionRepay
,
"Feed"
:
IssuanceActionFeed
,
"Close"
:
IssuanceActionClose
,
...
...
@@ -144,10 +144,10 @@ func CreateRawIssuanceCreateTx(cfg *types.Chain33Config, parm *IssuanceCreateTx)
}
v
:=
&
IssuanceCreate
{
TotalBalance
:
int64
(
math
.
Trunc
((
parm
.
TotalBalance
+
0.0000001
)
*
1e4
))
*
1e4
,
DebtCeiling
:
int64
(
math
.
Trunc
((
parm
.
DebtCeiling
+
0.0000001
)
*
1e4
))
*
1e4
,
TotalBalance
:
int64
(
math
.
Trunc
((
parm
.
TotalBalance
+
0.0000001
)
*
1e4
))
*
1e4
,
DebtCeiling
:
int64
(
math
.
Trunc
((
parm
.
DebtCeiling
+
0.0000001
)
*
1e4
))
*
1e4
,
LiquidationRatio
:
parm
.
LiquidationRatio
,
Period
:
parm
.
Period
,
Period
:
parm
.
Period
,
}
create
:=
&
IssuanceAction
{
Ty
:
IssuanceActionCreate
,
...
...
@@ -176,7 +176,7 @@ func CreateRawIssuanceDebtTx(cfg *types.Chain33Config, parm *IssuanceDebtTx) (*t
v
:=
&
IssuanceDebt
{
IssuanceId
:
parm
.
IssuanceID
,
Value
:
int64
(
math
.
Trunc
((
parm
.
Value
+
0.0000001
)
*
1e4
))
*
1e4
,
Value
:
int64
(
math
.
Trunc
((
parm
.
Value
+
0.0000001
)
*
1e4
))
*
1e4
,
}
debt
:=
&
IssuanceAction
{
Ty
:
IssuanceActionDebt
,
...
...
@@ -205,7 +205,7 @@ func CreateRawIssuanceRepayTx(cfg *types.Chain33Config, parm *IssuanceRepayTx) (
v
:=
&
IssuanceRepay
{
IssuanceId
:
parm
.
IssuanceID
,
DebtId
:
parm
.
DebtID
,
DebtId
:
parm
.
DebtID
,
}
repay
:=
&
IssuanceAction
{
Ty
:
IssuanceActionRepay
,
...
...
@@ -233,7 +233,7 @@ func CreateRawIssuanceFeedTx(cfg *types.Chain33Config, parm *IssuanceFeedTx) (*t
}
v
:=
&
IssuanceFeed
{
Price
:
parm
.
Price
,
Price
:
parm
.
Price
,
Volume
:
parm
.
Volume
,
}
feed
:=
&
IssuanceAction
{
...
...
@@ -290,7 +290,7 @@ func CreateRawIssuanceManageTx(cfg *types.Chain33Config, parm *IssuanceManageTx)
return
nil
,
types
.
ErrInvalidParam
}
v
:=
&
IssuanceManage
{
SuperAddrs
:
parm
.
Addr
}
v
:=
&
IssuanceManage
{
SuperAddrs
:
parm
.
Addr
}
manage
:=
&
IssuanceAction
{
Ty
:
IssuanceActionManage
,
...
...
@@ -309,4 +309,4 @@ func CreateRawIssuanceManageTx(cfg *types.Chain33Config, parm *IssuanceManageTx)
return
nil
,
err
}
return
tx
,
nil
}
\ No newline at end of file
}
plugin/dapp/issuance/types/issuance.pb.go
View file @
bdf8e51e
...
...
@@ -5,7 +5,9 @@ package types
import
(
fmt
"fmt"
proto
"github.com/golang/protobuf/proto"
math
"math"
)
...
...
@@ -18,7 +20,7 @@ var _ = math.Inf
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const
_
=
proto
.
ProtoPackageIsVersion
3
// please upgrade the proto package
const
_
=
proto
.
ProtoPackageIsVersion
2
// please upgrade the proto package
// 发行信息
type
Issuance
struct
{
...
...
@@ -48,17 +50,16 @@ func (m *Issuance) Reset() { *m = Issuance{} }
func
(
m
*
Issuance
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
Issuance
)
ProtoMessage
()
{}
func
(
*
Issuance
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_
7110f4228953d675
,
[]
int
{
0
}
return
fileDescriptor_
issuance_c7d54cbbda1bfbd2
,
[]
int
{
0
}
}
func
(
m
*
Issuance
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_Issuance
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
Issuance
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_Issuance
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
Issuance
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_Issuance
.
Merge
(
m
,
src
)
func
(
dst
*
Issuance
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_Issuance
.
Merge
(
dst
,
src
)
}
func
(
m
*
Issuance
)
XXX_Size
()
int
{
return
xxx_messageInfo_Issuance
.
Size
(
m
)
...
...
@@ -213,17 +214,16 @@ func (m *DebtRecord) Reset() { *m = DebtRecord{} }
func
(
m
*
DebtRecord
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
DebtRecord
)
ProtoMessage
()
{}
func
(
*
DebtRecord
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_
7110f4228953d675
,
[]
int
{
1
}
return
fileDescriptor_
issuance_c7d54cbbda1bfbd2
,
[]
int
{
1
}
}
func
(
m
*
DebtRecord
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_DebtRecord
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
DebtRecord
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_DebtRecord
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
DebtRecord
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_DebtRecord
.
Merge
(
m
,
src
)
func
(
dst
*
DebtRecord
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_DebtRecord
.
Merge
(
dst
,
src
)
}
func
(
m
*
DebtRecord
)
XXX_Size
()
int
{
return
xxx_messageInfo_DebtRecord
.
Size
(
m
)
...
...
@@ -345,17 +345,16 @@ func (m *IssuanceAssetPriceRecord) Reset() { *m = IssuanceAssetPriceReco
func
(
m
*
IssuanceAssetPriceRecord
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
IssuanceAssetPriceRecord
)
ProtoMessage
()
{}
func
(
*
IssuanceAssetPriceRecord
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_
7110f4228953d675
,
[]
int
{
2
}
return
fileDescriptor_
issuance_c7d54cbbda1bfbd2
,
[]
int
{
2
}
}
func
(
m
*
IssuanceAssetPriceRecord
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_IssuanceAssetPriceRecord
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
IssuanceAssetPriceRecord
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_IssuanceAssetPriceRecord
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
IssuanceAssetPriceRecord
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_IssuanceAssetPriceRecord
.
Merge
(
m
,
src
)
func
(
dst
*
IssuanceAssetPriceRecord
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_IssuanceAssetPriceRecord
.
Merge
(
dst
,
src
)
}
func
(
m
*
IssuanceAssetPriceRecord
)
XXX_Size
()
int
{
return
xxx_messageInfo_IssuanceAssetPriceRecord
.
Size
(
m
)
...
...
@@ -400,17 +399,16 @@ func (m *IssuanceAction) Reset() { *m = IssuanceAction{} }
func
(
m
*
IssuanceAction
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
IssuanceAction
)
ProtoMessage
()
{}
func
(
*
IssuanceAction
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_
7110f4228953d675
,
[]
int
{
3
}
return
fileDescriptor_
issuance_c7d54cbbda1bfbd2
,
[]
int
{
3
}
}
func
(
m
*
IssuanceAction
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_IssuanceAction
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
IssuanceAction
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_IssuanceAction
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
IssuanceAction
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_IssuanceAction
.
Merge
(
m
,
src
)
func
(
dst
*
IssuanceAction
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_IssuanceAction
.
Merge
(
dst
,
src
)
}
func
(
m
*
IssuanceAction
)
XXX_Size
()
int
{
return
xxx_messageInfo_IssuanceAction
.
Size
(
m
)
...
...
@@ -517,9 +515,9 @@ func (m *IssuanceAction) GetTy() int32 {
return
0
}
// XXX_Oneof
Wrapper
s is for the internal use of the proto package.
func
(
*
IssuanceAction
)
XXX_Oneof
Wrappers
()
[]
interface
{}
{
return
[]
interface
{}{
// XXX_Oneof
Func
s is for the internal use of the proto package.
func
(
*
IssuanceAction
)
XXX_Oneof
Funcs
()
(
func
(
msg
proto
.
Message
,
b
*
proto
.
Buffer
)
error
,
func
(
msg
proto
.
Message
,
tag
,
wire
int
,
b
*
proto
.
Buffer
)
(
bool
,
error
),
func
(
msg
proto
.
Message
)
(
n
int
),
[]
interface
{})
{
return
_IssuanceAction_OneofMarshaler
,
_IssuanceAction_OneofUnmarshaler
,
_IssuanceAction_OneofSizer
,
[]
interface
{}{
(
*
IssuanceAction_Create
)(
nil
),
(
*
IssuanceAction_Debt
)(
nil
),
(
*
IssuanceAction_Repay
)(
nil
),
...
...
@@ -529,6 +527,144 @@ func (*IssuanceAction) XXX_OneofWrappers() []interface{} {
}
}
func
_IssuanceAction_OneofMarshaler
(
msg
proto
.
Message
,
b
*
proto
.
Buffer
)
error
{
m
:=
msg
.
(
*
IssuanceAction
)
// value
switch
x
:=
m
.
Value
.
(
type
)
{
case
*
IssuanceAction_Create
:
b
.
EncodeVarint
(
1
<<
3
|
proto
.
WireBytes
)
if
err
:=
b
.
EncodeMessage
(
x
.
Create
);
err
!=
nil
{
return
err
}
case
*
IssuanceAction_Debt
:
b
.
EncodeVarint
(
2
<<
3
|
proto
.
WireBytes
)
if
err
:=
b
.
EncodeMessage
(
x
.
Debt
);
err
!=
nil
{
return
err
}
case
*
IssuanceAction_Repay
:
b
.
EncodeVarint
(
3
<<
3
|
proto
.
WireBytes
)
if
err
:=
b
.
EncodeMessage
(
x
.
Repay
);
err
!=
nil
{
return
err
}
case
*
IssuanceAction_Feed
:
b
.
EncodeVarint
(
4
<<
3
|
proto
.
WireBytes
)
if
err
:=
b
.
EncodeMessage
(
x
.
Feed
);
err
!=
nil
{
return
err
}
case
*
IssuanceAction_Close
:
b
.
EncodeVarint
(
5
<<
3
|
proto
.
WireBytes
)
if
err
:=
b
.
EncodeMessage
(
x
.
Close
);
err
!=
nil
{
return
err
}
case
*
IssuanceAction_Manage
:
b
.
EncodeVarint
(
6
<<
3
|
proto
.
WireBytes
)
if
err
:=
b
.
EncodeMessage
(
x
.
Manage
);
err
!=
nil
{
return
err
}
case
nil
:
default
:
return
fmt
.
Errorf
(
"IssuanceAction.Value has unexpected type %T"
,
x
)
}
return
nil
}
func
_IssuanceAction_OneofUnmarshaler
(
msg
proto
.
Message
,
tag
,
wire
int
,
b
*
proto
.
Buffer
)
(
bool
,
error
)
{
m
:=
msg
.
(
*
IssuanceAction
)
switch
tag
{
case
1
:
// value.create
if
wire
!=
proto
.
WireBytes
{
return
true
,
proto
.
ErrInternalBadWireType
}
msg
:=
new
(
IssuanceCreate
)
err
:=
b
.
DecodeMessage
(
msg
)
m
.
Value
=
&
IssuanceAction_Create
{
msg
}
return
true
,
err
case
2
:
// value.debt
if
wire
!=
proto
.
WireBytes
{
return
true
,
proto
.
ErrInternalBadWireType
}
msg
:=
new
(
IssuanceDebt
)
err
:=
b
.
DecodeMessage
(
msg
)
m
.
Value
=
&
IssuanceAction_Debt
{
msg
}
return
true
,
err
case
3
:
// value.repay
if
wire
!=
proto
.
WireBytes
{
return
true
,
proto
.
ErrInternalBadWireType
}
msg
:=
new
(
IssuanceRepay
)
err
:=
b
.
DecodeMessage
(
msg
)
m
.
Value
=
&
IssuanceAction_Repay
{
msg
}
return
true
,
err
case
4
:
// value.feed
if
wire
!=
proto
.
WireBytes
{
return
true
,
proto
.
ErrInternalBadWireType
}
msg
:=
new
(
IssuanceFeed
)
err
:=
b
.
DecodeMessage
(
msg
)
m
.
Value
=
&
IssuanceAction_Feed
{
msg
}
return
true
,
err
case
5
:
// value.close
if
wire
!=
proto
.
WireBytes
{
return
true
,
proto
.
ErrInternalBadWireType
}
msg
:=
new
(
IssuanceClose
)
err
:=
b
.
DecodeMessage
(
msg
)
m
.
Value
=
&
IssuanceAction_Close
{
msg
}
return
true
,
err
case
6
:
// value.manage
if
wire
!=
proto
.
WireBytes
{
return
true
,
proto
.
ErrInternalBadWireType
}
msg
:=
new
(
IssuanceManage
)
err
:=
b
.
DecodeMessage
(
msg
)
m
.
Value
=
&
IssuanceAction_Manage
{
msg
}
return
true
,
err
default
:
return
false
,
nil
}
}
func
_IssuanceAction_OneofSizer
(
msg
proto
.
Message
)
(
n
int
)
{
m
:=
msg
.
(
*
IssuanceAction
)
// value
switch
x
:=
m
.
Value
.
(
type
)
{
case
*
IssuanceAction_Create
:
s
:=
proto
.
Size
(
x
.
Create
)
n
+=
1
// tag and wire
n
+=
proto
.
SizeVarint
(
uint64
(
s
))
n
+=
s
case
*
IssuanceAction_Debt
:
s
:=
proto
.
Size
(
x
.
Debt
)
n
+=
1
// tag and wire
n
+=
proto
.
SizeVarint
(
uint64
(
s
))
n
+=
s
case
*
IssuanceAction_Repay
:
s
:=
proto
.
Size
(
x
.
Repay
)
n
+=
1
// tag and wire
n
+=
proto
.
SizeVarint
(
uint64
(
s
))
n
+=
s
case
*
IssuanceAction_Feed
:
s
:=
proto
.
Size
(
x
.
Feed
)
n
+=
1
// tag and wire
n
+=
proto
.
SizeVarint
(
uint64
(
s
))
n
+=
s
case
*
IssuanceAction_Close
:
s
:=
proto
.
Size
(
x
.
Close
)
n
+=
1
// tag and wire
n
+=
proto
.
SizeVarint
(
uint64
(
s
))
n
+=
s
case
*
IssuanceAction_Manage
:
s
:=
proto
.
Size
(
x
.
Manage
)
n
+=
1
// tag and wire
n
+=
proto
.
SizeVarint
(
uint64
(
s
))
n
+=
s
case
nil
:
default
:
panic
(
fmt
.
Sprintf
(
"proto: unexpected type %T in oneof"
,
x
))
}
return
n
}
type
IssuanceManage
struct
{
SuperAddrs
[]
string
`protobuf:"bytes,1,rep,name=superAddrs,proto3" json:"superAddrs,omitempty"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
...
...
@@ -540,17 +676,16 @@ func (m *IssuanceManage) Reset() { *m = IssuanceManage{} }
func
(
m
*
IssuanceManage
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
IssuanceManage
)
ProtoMessage
()
{}
func
(
*
IssuanceManage
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_
7110f4228953d675
,
[]
int
{
4
}
return
fileDescriptor_
issuance_c7d54cbbda1bfbd2
,
[]
int
{
4
}
}
func
(
m
*
IssuanceManage
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_IssuanceManage
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
IssuanceManage
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_IssuanceManage
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
IssuanceManage
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_IssuanceManage
.
Merge
(
m
,
src
)
func
(
dst
*
IssuanceManage
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_IssuanceManage
.
Merge
(
dst
,
src
)
}
func
(
m
*
IssuanceManage
)
XXX_Size
()
int
{
return
xxx_messageInfo_IssuanceManage
.
Size
(
m
)
...
...
@@ -583,17 +718,16 @@ func (m *IssuanceCreate) Reset() { *m = IssuanceCreate{} }
func
(
m
*
IssuanceCreate
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
IssuanceCreate
)
ProtoMessage
()
{}
func
(
*
IssuanceCreate
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_
7110f4228953d675
,
[]
int
{
5
}
return
fileDescriptor_
issuance_c7d54cbbda1bfbd2
,
[]
int
{
5
}
}
func
(
m
*
IssuanceCreate
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_IssuanceCreate
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
IssuanceCreate
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_IssuanceCreate
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
IssuanceCreate
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_IssuanceCreate
.
Merge
(
m
,
src
)
func
(
dst
*
IssuanceCreate
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_IssuanceCreate
.
Merge
(
dst
,
src
)
}
func
(
m
*
IssuanceCreate
)
XXX_Size
()
int
{
return
xxx_messageInfo_IssuanceCreate
.
Size
(
m
)
...
...
@@ -645,17 +779,16 @@ func (m *IssuanceDebt) Reset() { *m = IssuanceDebt{} }
func
(
m
*
IssuanceDebt
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
IssuanceDebt
)
ProtoMessage
()
{}
func
(
*
IssuanceDebt
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_
7110f4228953d675
,
[]
int
{
6
}
return
fileDescriptor_
issuance_c7d54cbbda1bfbd2
,
[]
int
{
6
}
}
func
(
m
*
IssuanceDebt
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_IssuanceDebt
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
IssuanceDebt
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_IssuanceDebt
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
IssuanceDebt
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_IssuanceDebt
.
Merge
(
m
,
src
)
func
(
dst
*
IssuanceDebt
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_IssuanceDebt
.
Merge
(
dst
,
src
)
}
func
(
m
*
IssuanceDebt
)
XXX_Size
()
int
{
return
xxx_messageInfo_IssuanceDebt
.
Size
(
m
)
...
...
@@ -693,17 +826,16 @@ func (m *IssuanceRepay) Reset() { *m = IssuanceRepay{} }
func
(
m
*
IssuanceRepay
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
IssuanceRepay
)
ProtoMessage
()
{}
func
(
*
IssuanceRepay
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_
7110f4228953d675
,
[]
int
{
7
}
return
fileDescriptor_
issuance_c7d54cbbda1bfbd2
,
[]
int
{
7
}
}
func
(
m
*
IssuanceRepay
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_IssuanceRepay
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
IssuanceRepay
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_IssuanceRepay
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
IssuanceRepay
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_IssuanceRepay
.
Merge
(
m
,
src
)
func
(
dst
*
IssuanceRepay
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_IssuanceRepay
.
Merge
(
dst
,
src
)
}
func
(
m
*
IssuanceRepay
)
XXX_Size
()
int
{
return
xxx_messageInfo_IssuanceRepay
.
Size
(
m
)
...
...
@@ -742,17 +874,16 @@ func (m *IssuanceFeed) Reset() { *m = IssuanceFeed{} }
func
(
m
*
IssuanceFeed
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
IssuanceFeed
)
ProtoMessage
()
{}
func
(
*
IssuanceFeed
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_
7110f4228953d675
,
[]
int
{
8
}
return
fileDescriptor_
issuance_c7d54cbbda1bfbd2
,
[]
int
{
8
}
}
func
(
m
*
IssuanceFeed
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_IssuanceFeed
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
IssuanceFeed
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_IssuanceFeed
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
IssuanceFeed
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_IssuanceFeed
.
Merge
(
m
,
src
)
func
(
dst
*
IssuanceFeed
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_IssuanceFeed
.
Merge
(
dst
,
src
)
}
func
(
m
*
IssuanceFeed
)
XXX_Size
()
int
{
return
xxx_messageInfo_IssuanceFeed
.
Size
(
m
)
...
...
@@ -796,17 +927,16 @@ func (m *IssuanceClose) Reset() { *m = IssuanceClose{} }
func
(
m
*
IssuanceClose
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
IssuanceClose
)
ProtoMessage
()
{}
func
(
*
IssuanceClose
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_
7110f4228953d675
,
[]
int
{
9
}
return
fileDescriptor_
issuance_c7d54cbbda1bfbd2
,
[]
int
{
9
}
}
func
(
m
*
IssuanceClose
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_IssuanceClose
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
IssuanceClose
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_IssuanceClose
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
IssuanceClose
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_IssuanceClose
.
Merge
(
m
,
src
)
func
(
dst
*
IssuanceClose
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_IssuanceClose
.
Merge
(
dst
,
src
)
}
func
(
m
*
IssuanceClose
)
XXX_Size
()
int
{
return
xxx_messageInfo_IssuanceClose
.
Size
(
m
)
...
...
@@ -844,17 +974,16 @@ func (m *ReceiptIssuance) Reset() { *m = ReceiptIssuance{} }
func
(
m
*
ReceiptIssuance
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
ReceiptIssuance
)
ProtoMessage
()
{}
func
(
*
ReceiptIssuance
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_
7110f4228953d675
,
[]
int
{
10
}
return
fileDescriptor_
issuance_c7d54cbbda1bfbd2
,
[]
int
{
10
}
}
func
(
m
*
ReceiptIssuance
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_ReceiptIssuance
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
ReceiptIssuance
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_ReceiptIssuance
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
ReceiptIssuance
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_ReceiptIssuance
.
Merge
(
m
,
src
)
func
(
dst
*
ReceiptIssuance
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_ReceiptIssuance
.
Merge
(
dst
,
src
)
}
func
(
m
*
ReceiptIssuance
)
XXX_Size
()
int
{
return
xxx_messageInfo_ReceiptIssuance
.
Size
(
m
)
...
...
@@ -943,17 +1072,16 @@ func (m *IssuanceRecord) Reset() { *m = IssuanceRecord{} }
func
(
m
*
IssuanceRecord
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
IssuanceRecord
)
ProtoMessage
()
{}
func
(
*
IssuanceRecord
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_
7110f4228953d675
,
[]
int
{
11
}
return
fileDescriptor_
issuance_c7d54cbbda1bfbd2
,
[]
int
{
11
}
}
func
(
m
*
IssuanceRecord
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_IssuanceRecord
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
IssuanceRecord
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_IssuanceRecord
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
IssuanceRecord
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_IssuanceRecord
.
Merge
(
m
,
src
)
func
(
dst
*
IssuanceRecord
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_IssuanceRecord
.
Merge
(
dst
,
src
)
}
func
(
m
*
IssuanceRecord
)
XXX_Size
()
int
{
return
xxx_messageInfo_IssuanceRecord
.
Size
(
m
)
...
...
@@ -1004,17 +1132,16 @@ func (m *IssuanceRecords) Reset() { *m = IssuanceRecords{} }
func
(
m
*
IssuanceRecords
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
IssuanceRecords
)
ProtoMessage
()
{}
func
(
*
IssuanceRecords
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_
7110f4228953d675
,
[]
int
{
12
}
return
fileDescriptor_
issuance_c7d54cbbda1bfbd2
,
[]
int
{
12
}
}
func
(
m
*
IssuanceRecords
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_IssuanceRecords
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
IssuanceRecords
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_IssuanceRecords
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
IssuanceRecords
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_IssuanceRecords
.
Merge
(
m
,
src
)
func
(
dst
*
IssuanceRecords
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_IssuanceRecords
.
Merge
(
dst
,
src
)
}
func
(
m
*
IssuanceRecords
)
XXX_Size
()
int
{
return
xxx_messageInfo_IssuanceRecords
.
Size
(
m
)
...
...
@@ -1044,17 +1171,16 @@ func (m *ReqIssuanceInfo) Reset() { *m = ReqIssuanceInfo{} }
func
(
m
*
ReqIssuanceInfo
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
ReqIssuanceInfo
)
ProtoMessage
()
{}
func
(
*
ReqIssuanceInfo
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_
7110f4228953d675
,
[]
int
{
13
}
return
fileDescriptor_
issuance_c7d54cbbda1bfbd2
,
[]
int
{
13
}
}
func
(
m
*
ReqIssuanceInfo
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_ReqIssuanceInfo
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
ReqIssuanceInfo
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_ReqIssuanceInfo
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
ReqIssuanceInfo
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_ReqIssuanceInfo
.
Merge
(
m
,
src
)
func
(
dst
*
ReqIssuanceInfo
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_ReqIssuanceInfo
.
Merge
(
dst
,
src
)
}
func
(
m
*
ReqIssuanceInfo
)
XXX_Size
()
int
{
return
xxx_messageInfo_ReqIssuanceInfo
.
Size
(
m
)
...
...
@@ -1093,17 +1219,16 @@ func (m *RepIssuanceCurrentInfo) Reset() { *m = RepIssuanceCurrentInfo{}
func
(
m
*
RepIssuanceCurrentInfo
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
RepIssuanceCurrentInfo
)
ProtoMessage
()
{}
func
(
*
RepIssuanceCurrentInfo
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_
7110f4228953d675
,
[]
int
{
14
}
return
fileDescriptor_
issuance_c7d54cbbda1bfbd2
,
[]
int
{
14
}
}
func
(
m
*
RepIssuanceCurrentInfo
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_RepIssuanceCurrentInfo
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
RepIssuanceCurrentInfo
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_RepIssuanceCurrentInfo
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
RepIssuanceCurrentInfo
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_RepIssuanceCurrentInfo
.
Merge
(
m
,
src
)
func
(
dst
*
RepIssuanceCurrentInfo
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_RepIssuanceCurrentInfo
.
Merge
(
dst
,
src
)
}
func
(
m
*
RepIssuanceCurrentInfo
)
XXX_Size
()
int
{
return
xxx_messageInfo_RepIssuanceCurrentInfo
.
Size
(
m
)
...
...
@@ -1196,17 +1321,16 @@ func (m *ReqIssuanceInfos) Reset() { *m = ReqIssuanceInfos{} }
func
(
m
*
ReqIssuanceInfos
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
ReqIssuanceInfos
)
ProtoMessage
()
{}
func
(
*
ReqIssuanceInfos
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_
7110f4228953d675
,
[]
int
{
15
}
return
fileDescriptor_
issuance_c7d54cbbda1bfbd2
,
[]
int
{
15
}
}
func
(
m
*
ReqIssuanceInfos
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_ReqIssuanceInfos
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
ReqIssuanceInfos
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_ReqIssuanceInfos
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
ReqIssuanceInfos
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_ReqIssuanceInfos
.
Merge
(
m
,
src
)
func
(
dst
*
ReqIssuanceInfos
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_ReqIssuanceInfos
.
Merge
(
dst
,
src
)
}
func
(
m
*
ReqIssuanceInfos
)
XXX_Size
()
int
{
return
xxx_messageInfo_ReqIssuanceInfos
.
Size
(
m
)
...
...
@@ -1236,17 +1360,16 @@ func (m *RepIssuanceCurrentInfos) Reset() { *m = RepIssuanceCurrentInfos
func
(
m
*
RepIssuanceCurrentInfos
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
RepIssuanceCurrentInfos
)
ProtoMessage
()
{}
func
(
*
RepIssuanceCurrentInfos
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_
7110f4228953d675
,
[]
int
{
16
}
return
fileDescriptor_
issuance_c7d54cbbda1bfbd2
,
[]
int
{
16
}
}
func
(
m
*
RepIssuanceCurrentInfos
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_RepIssuanceCurrentInfos
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
RepIssuanceCurrentInfos
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_RepIssuanceCurrentInfos
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
RepIssuanceCurrentInfos
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_RepIssuanceCurrentInfos
.
Merge
(
m
,
src
)
func
(
dst
*
RepIssuanceCurrentInfos
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_RepIssuanceCurrentInfos
.
Merge
(
dst
,
src
)
}
func
(
m
*
RepIssuanceCurrentInfos
)
XXX_Size
()
int
{
return
xxx_messageInfo_RepIssuanceCurrentInfos
.
Size
(
m
)
...
...
@@ -1277,17 +1400,16 @@ func (m *ReqIssuanceByStatus) Reset() { *m = ReqIssuanceByStatus{} }
func
(
m
*
ReqIssuanceByStatus
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
ReqIssuanceByStatus
)
ProtoMessage
()
{}
func
(
*
ReqIssuanceByStatus
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_
7110f4228953d675
,
[]
int
{
17
}
return
fileDescriptor_
issuance_c7d54cbbda1bfbd2
,
[]
int
{
17
}
}
func
(
m
*
ReqIssuanceByStatus
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_ReqIssuanceByStatus
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
ReqIssuanceByStatus
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_ReqIssuanceByStatus
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
ReqIssuanceByStatus
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_ReqIssuanceByStatus
.
Merge
(
m
,
src
)
func
(
dst
*
ReqIssuanceByStatus
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_ReqIssuanceByStatus
.
Merge
(
dst
,
src
)
}
func
(
m
*
ReqIssuanceByStatus
)
XXX_Size
()
int
{
return
xxx_messageInfo_ReqIssuanceByStatus
.
Size
(
m
)
...
...
@@ -1324,17 +1446,16 @@ func (m *RepIssuanceIDs) Reset() { *m = RepIssuanceIDs{} }
func
(
m
*
RepIssuanceIDs
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
RepIssuanceIDs
)
ProtoMessage
()
{}
func
(
*
RepIssuanceIDs
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_
7110f4228953d675
,
[]
int
{
18
}
return
fileDescriptor_
issuance_c7d54cbbda1bfbd2
,
[]
int
{
18
}
}
func
(
m
*
RepIssuanceIDs
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_RepIssuanceIDs
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
RepIssuanceIDs
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_RepIssuanceIDs
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
RepIssuanceIDs
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_RepIssuanceIDs
.
Merge
(
m
,
src
)
func
(
dst
*
RepIssuanceIDs
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_RepIssuanceIDs
.
Merge
(
dst
,
src
)
}
func
(
m
*
RepIssuanceIDs
)
XXX_Size
()
int
{
return
xxx_messageInfo_RepIssuanceIDs
.
Size
(
m
)
...
...
@@ -1367,17 +1488,16 @@ func (m *ReqIssuanceRecordsByAddr) Reset() { *m = ReqIssuanceRecordsByAd
func
(
m
*
ReqIssuanceRecordsByAddr
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
ReqIssuanceRecordsByAddr
)
ProtoMessage
()
{}
func
(
*
ReqIssuanceRecordsByAddr
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_
7110f4228953d675
,
[]
int
{
19
}
return
fileDescriptor_
issuance_c7d54cbbda1bfbd2
,
[]
int
{
19
}
}
func
(
m
*
ReqIssuanceRecordsByAddr
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_ReqIssuanceRecordsByAddr
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
ReqIssuanceRecordsByAddr
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_ReqIssuanceRecordsByAddr
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
ReqIssuanceRecordsByAddr
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_ReqIssuanceRecordsByAddr
.
Merge
(
m
,
src
)
func
(
dst
*
ReqIssuanceRecordsByAddr
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_ReqIssuanceRecordsByAddr
.
Merge
(
dst
,
src
)
}
func
(
m
*
ReqIssuanceRecordsByAddr
)
XXX_Size
()
int
{
return
xxx_messageInfo_ReqIssuanceRecordsByAddr
.
Size
(
m
)
...
...
@@ -1430,17 +1550,16 @@ func (m *ReqIssuanceRecordsByStatus) Reset() { *m = ReqIssuanceRecordsBy
func
(
m
*
ReqIssuanceRecordsByStatus
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
ReqIssuanceRecordsByStatus
)
ProtoMessage
()
{}
func
(
*
ReqIssuanceRecordsByStatus
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_
7110f4228953d675
,
[]
int
{
20
}
return
fileDescriptor_
issuance_c7d54cbbda1bfbd2
,
[]
int
{
20
}
}
func
(
m
*
ReqIssuanceRecordsByStatus
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_ReqIssuanceRecordsByStatus
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
ReqIssuanceRecordsByStatus
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_ReqIssuanceRecordsByStatus
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
ReqIssuanceRecordsByStatus
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_ReqIssuanceRecordsByStatus
.
Merge
(
m
,
src
)
func
(
dst
*
ReqIssuanceRecordsByStatus
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_ReqIssuanceRecordsByStatus
.
Merge
(
dst
,
src
)
}
func
(
m
*
ReqIssuanceRecordsByStatus
)
XXX_Size
()
int
{
return
xxx_messageInfo_ReqIssuanceRecordsByStatus
.
Size
(
m
)
...
...
@@ -1484,17 +1603,16 @@ func (m *RepIssuanceRecords) Reset() { *m = RepIssuanceRecords{} }
func
(
m
*
RepIssuanceRecords
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
RepIssuanceRecords
)
ProtoMessage
()
{}
func
(
*
RepIssuanceRecords
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_
7110f4228953d675
,
[]
int
{
21
}
return
fileDescriptor_
issuance_c7d54cbbda1bfbd2
,
[]
int
{
21
}
}
func
(
m
*
RepIssuanceRecords
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_RepIssuanceRecords
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
RepIssuanceRecords
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_RepIssuanceRecords
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
RepIssuanceRecords
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_RepIssuanceRecords
.
Merge
(
m
,
src
)
func
(
dst
*
RepIssuanceRecords
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_RepIssuanceRecords
.
Merge
(
dst
,
src
)
}
func
(
m
*
RepIssuanceRecords
)
XXX_Size
()
int
{
return
xxx_messageInfo_RepIssuanceRecords
.
Size
(
m
)
...
...
@@ -1525,17 +1643,16 @@ func (m *ReqIssuanceDebtInfo) Reset() { *m = ReqIssuanceDebtInfo{} }
func
(
m
*
ReqIssuanceDebtInfo
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
ReqIssuanceDebtInfo
)
ProtoMessage
()
{}
func
(
*
ReqIssuanceDebtInfo
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_
7110f4228953d675
,
[]
int
{
22
}
return
fileDescriptor_
issuance_c7d54cbbda1bfbd2
,
[]
int
{
22
}
}
func
(
m
*
ReqIssuanceDebtInfo
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_ReqIssuanceDebtInfo
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
ReqIssuanceDebtInfo
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_ReqIssuanceDebtInfo
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
ReqIssuanceDebtInfo
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_ReqIssuanceDebtInfo
.
Merge
(
m
,
src
)
func
(
dst
*
ReqIssuanceDebtInfo
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_ReqIssuanceDebtInfo
.
Merge
(
dst
,
src
)
}
func
(
m
*
ReqIssuanceDebtInfo
)
XXX_Size
()
int
{
return
xxx_messageInfo_ReqIssuanceDebtInfo
.
Size
(
m
)
...
...
@@ -1572,17 +1689,16 @@ func (m *RepIssuanceDebtInfo) Reset() { *m = RepIssuanceDebtInfo{} }
func
(
m
*
RepIssuanceDebtInfo
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
RepIssuanceDebtInfo
)
ProtoMessage
()
{}
func
(
*
RepIssuanceDebtInfo
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_
7110f4228953d675
,
[]
int
{
23
}
return
fileDescriptor_
issuance_c7d54cbbda1bfbd2
,
[]
int
{
23
}
}
func
(
m
*
RepIssuanceDebtInfo
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_RepIssuanceDebtInfo
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
RepIssuanceDebtInfo
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_RepIssuanceDebtInfo
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
RepIssuanceDebtInfo
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_RepIssuanceDebtInfo
.
Merge
(
m
,
src
)
func
(
dst
*
RepIssuanceDebtInfo
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_RepIssuanceDebtInfo
.
Merge
(
dst
,
src
)
}
func
(
m
*
RepIssuanceDebtInfo
)
XXX_Size
()
int
{
return
xxx_messageInfo_RepIssuanceDebtInfo
.
Size
(
m
)
...
...
@@ -1612,17 +1728,16 @@ func (m *RepIssuancePrice) Reset() { *m = RepIssuancePrice{} }
func
(
m
*
RepIssuancePrice
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
RepIssuancePrice
)
ProtoMessage
()
{}
func
(
*
RepIssuancePrice
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_
7110f4228953d675
,
[]
int
{
24
}
return
fileDescriptor_
issuance_c7d54cbbda1bfbd2
,
[]
int
{
24
}
}
func
(
m
*
RepIssuancePrice
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_RepIssuancePrice
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
RepIssuancePrice
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_RepIssuancePrice
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
RepIssuancePrice
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_RepIssuancePrice
.
Merge
(
m
,
src
)
func
(
dst
*
RepIssuancePrice
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_RepIssuancePrice
.
Merge
(
dst
,
src
)
}
func
(
m
*
RepIssuancePrice
)
XXX_Size
()
int
{
return
xxx_messageInfo_RepIssuancePrice
.
Size
(
m
)
...
...
@@ -1668,9 +1783,9 @@ func init() {
proto
.
RegisterType
((
*
RepIssuancePrice
)(
nil
),
"types.RepIssuancePrice"
)
}
func
init
()
{
proto
.
RegisterFile
(
"issuance.proto"
,
fileDescriptor_
7110f4228953d675
)
}
func
init
()
{
proto
.
RegisterFile
(
"issuance.proto"
,
fileDescriptor_
issuance_c7d54cbbda1bfbd2
)
}
var
fileDescriptor_
7110f4228953d675
=
[]
byte
{
var
fileDescriptor_
issuance_c7d54cbbda1bfbd2
=
[]
byte
{
// 1119 bytes of a gzipped FileDescriptorProto
0x1f
,
0x8b
,
0x08
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x02
,
0xff
,
0xbc
,
0x57
,
0xcd
,
0x6e
,
0xe4
,
0x44
,
0x10
,
0x8e
,
0xed
,
0xf1
,
0xfc
,
0xd4
,
0x24
,
0x93
,
0x6c
,
0x6f
,
0x36
,
0x58
,
0x2b
,
0x58
,
0x8d
,
0x2c
,
...
...
plugin/dapp/issuance/types/tx.go
View file @
bdf8e51e
...
...
@@ -6,42 +6,42 @@ package types
// IssuanceCreateTx for construction
type
IssuanceCreateTx
struct
{
DebtCeiling
float64
`json:"debtCeiling"`
LiquidationRatio
float64
`json:"liquidationRatio"`
Period
int64
`json:"period"`
TotalBalance
float64
`json:"totalBalance"`
Fee
int64
`json:"fee"`
DebtCeiling
float64
`json:"debtCeiling"`
LiquidationRatio
float64
`json:"liquidationRatio"`
Period
int64
`json:"period"`
TotalBalance
float64
`json:"totalBalance"`
Fee
int64
`json:"fee"`
}
// IssuanceDebtTx for construction
type
IssuanceDebtTx
struct
{
IssuanceID
string
`json:"issuanceId"`
Value
float64
`json:"value"`
Fee
int64
`json:"fee"`
IssuanceID
string
`json:"issuanceId"`
Value
float64
`json:"value"`
Fee
int64
`json:"fee"`
}
// IssuanceRepayTx for construction
type
IssuanceRepayTx
struct
{
IssuanceID
string
`json:"issuanceId"`
DebtID
string
`json:"debtId"`
Fee
int64
`json:"fee"`
Fee
int64
`json:"fee"`
}
// IssuanceFeedTx for construction
type
IssuanceFeedTx
struct
{
Price
[]
float64
`json:"price"`
Volume
[]
int64
`json:"volume"`
Fee
int64
`json:"fee"`
Price
[]
float64
`json:"price"`
Volume
[]
int64
`json:"volume"`
Fee
int64
`json:"fee"`
}
// IssuanceCloseTx for construction
type
IssuanceCloseTx
struct
{
IssuanceID
string
`json:"issuanceId"`
Fee
int64
`json:"fee"`
Fee
int64
`json:"fee"`
}
// IssuanceManageTx for construction
type
IssuanceManageTx
struct
{
Addr
[]
string
`json:"addr"`
Fee
int64
`json:"fee"`
Addr
[]
string
`json:"addr"`
Fee
int64
`json:"fee"`
}
plugin/dapp/issuance/types/types.go
View file @
bdf8e51e
...
...
@@ -14,17 +14,17 @@ const (
IssuanceActionManage
// 借贷管理
//log for Issuance
TyLogIssuanceCreate
=
741
TyLogIssuanceDebt
=
742
TyLogIssuanceRepay
=
743
TyLogIssuanceFeed
=
745
TyLogIssuanceClose
=
756
TyLogIssuanceCreate
=
741
TyLogIssuanceDebt
=
742
TyLogIssuanceRepay
=
743
TyLogIssuanceFeed
=
745
TyLogIssuanceClose
=
756
)
// Issuance name
const
(
IssuanceX
=
"issuance"
CCNYTokenName
=
"CCNY"
IssuanceX
=
"issuance"
CCNYTokenName
=
"CCNY"
IssuancePreLiquidationRatio
=
1.1
//TODO 预清算比例,抵押物价值跌到借出ccny价值110%的时候开始清算
)
...
...
@@ -47,4 +47,4 @@ const (
PriceFeedKey
=
"issuance-price-feed"
GuarantorKey
=
"issuance-guarantor"
ManageKey
=
"issuance-manage"
)
\ No newline at end of file
)
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