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
550958aa
Commit
550958aa
authored
Oct 22, 2019
by
pengjun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#617 add issuance contract
parent
85aa1039
Hide whitespace changes
Inline
Side-by-side
Showing
30 changed files
with
4190 additions
and
326 deletions
+4190
-326
cmd.go
plugin/dapp/collateralize/commands/cmd.go
+7
-18
collateralizedb.go
plugin/dapp/collateralize/executor/collateralizedb.go
+55
-75
exec.go
plugin/dapp/collateralize/executor/exec.go
+6
-0
exec_del_local.go
plugin/dapp/collateralize/executor/exec_del_local.go
+6
-0
exec_local.go
plugin/dapp/collateralize/executor/exec_local.go
+5
-0
keys.go
plugin/dapp/collateralize/executor/keys.go
+0
-5
collateralize.proto
plugin/dapp/collateralize/proto/collateralize.proto
+3
-9
collateralize.go
plugin/dapp/collateralize/types/collateralize.go
+14
-49
collateralize.pb.go
plugin/dapp/collateralize/types/collateralize.pb.go
+109
-169
tx.go
plugin/dapp/collateralize/types/tx.go
+0
-1
Makefile
plugin/dapp/issuance/cmd/Makefile
+4
-0
build.sh
plugin/dapp/issuance/cmd/build.sh
+15
-0
cmd.go
plugin/dapp/issuance/commands/cmd.go
+343
-0
doc.go
plugin/dapp/issuance/executor/doc.go
+9
-0
exec.go
plugin/dapp/issuance/executor/exec.go
+40
-0
exec_del_local.go
plugin/dapp/issuance/executor/exec_del_local.go
+74
-0
exec_local.go
plugin/dapp/issuance/executor/exec_local.go
+71
-0
issuance.go
plugin/dapp/issuance/executor/issuance.go
+156
-0
issuancedb.go
plugin/dapp/issuance/executor/issuancedb.go
+963
-0
keys.go
plugin/dapp/issuance/executor/keys.go
+53
-0
query.go
plugin/dapp/issuance/executor/query.go
+142
-0
plugin.go
plugin/dapp/issuance/plugin.go
+21
-0
Makefile
plugin/dapp/issuance/proto/Makefile
+2
-0
create_protobuf.sh
plugin/dapp/issuance/proto/create_protobuf.sh
+4
-0
issuance.proto
plugin/dapp/issuance/proto/issuance.proto
+170
-0
errors.go
plugin/dapp/issuance/types/errors.go
+25
-0
issuance.go
plugin/dapp/issuance/types/issuance.go
+298
-0
issuance.pb.go
plugin/dapp/issuance/types/issuance.pb.go
+1504
-0
tx.go
plugin/dapp/issuance/types/tx.go
+46
-0
types.go
plugin/dapp/issuance/types/types.go
+45
-0
No files found.
plugin/dapp/collateralize/commands/cmd.go
View file @
550958aa
...
@@ -237,7 +237,7 @@ func CollateralizeManageRawTxCmd() *cobra.Command {
...
@@ -237,7 +237,7 @@ func CollateralizeManageRawTxCmd() *cobra.Command {
Short
:
"manage a collateralize"
,
Short
:
"manage a collateralize"
,
Run
:
CollateralizeManage
,
Run
:
CollateralizeManage
,
}
}
addCollateralize
Clos
eFlags
(
cmd
)
addCollateralize
Manag
eFlags
(
cmd
)
return
cmd
return
cmd
}
}
...
@@ -246,7 +246,6 @@ func addCollateralizeManageFlags(cmd *cobra.Command) {
...
@@ -246,7 +246,6 @@ func addCollateralizeManageFlags(cmd *cobra.Command) {
cmd
.
Flags
()
.
Float32P
(
"liquidationRatio"
,
"l"
,
0
,
"liquidationRatio"
)
cmd
.
Flags
()
.
Float32P
(
"liquidationRatio"
,
"l"
,
0
,
"liquidationRatio"
)
cmd
.
Flags
()
.
Float32P
(
"stabilityFeeRatio"
,
"s"
,
0
,
"stabilityFeeRatio"
)
cmd
.
Flags
()
.
Float32P
(
"stabilityFeeRatio"
,
"s"
,
0
,
"stabilityFeeRatio"
)
cmd
.
Flags
()
.
Uint64P
(
"period"
,
"p"
,
0
,
"period"
)
cmd
.
Flags
()
.
Uint64P
(
"period"
,
"p"
,
0
,
"period"
)
cmd
.
Flags
()
.
StringP
(
"addr"
,
"a"
,
""
,
"addr"
)
}
}
func
CollateralizeManage
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
func
CollateralizeManage
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
...
@@ -255,22 +254,12 @@ func CollateralizeManage(cmd *cobra.Command, args []string) {
...
@@ -255,22 +254,12 @@ func CollateralizeManage(cmd *cobra.Command, args []string) {
liquidationRatio
,
_
:=
cmd
.
Flags
()
.
GetFloat32
(
"liquidationRatio"
)
liquidationRatio
,
_
:=
cmd
.
Flags
()
.
GetFloat32
(
"liquidationRatio"
)
stabilityFeeRatio
,
_
:=
cmd
.
Flags
()
.
GetFloat32
(
"stabilityFeeRatio"
)
stabilityFeeRatio
,
_
:=
cmd
.
Flags
()
.
GetFloat32
(
"stabilityFeeRatio"
)
period
,
_
:=
cmd
.
Flags
()
.
GetUint64
(
"period"
)
period
,
_
:=
cmd
.
Flags
()
.
GetUint64
(
"period"
)
addr
,
_
:=
cmd
.
Flags
()
.
GetString
(
"addr"
)
params
:=
&
rpctypes
.
CreateTxIn
{
var
params
*
rpctypes
.
CreateTxIn
Execer
:
types
.
ExecName
(
pkt
.
CollateralizeX
),
if
addr
==
""
{
ActionName
:
"CollateralizeManage"
,
params
=
&
rpctypes
.
CreateTxIn
{
Payload
:
[]
byte
(
fmt
.
Sprintf
(
"{
\"
debtCeiling
\"
:%d,
\"
liquidationRatio
\"
:%f,
\"
stabilityFeeRatio
\"
:%f,
\"
period
\"
:%s,}"
,
Execer
:
types
.
ExecName
(
pkt
.
CollateralizeX
),
debtCeiling
,
liquidationRatio
,
stabilityFeeRatio
,
period
)),
ActionName
:
"CollateralizeManage"
,
Payload
:
[]
byte
(
fmt
.
Sprintf
(
"{
\"
debtCeiling
\"
:%d,
\"
liquidationRatio
\"
:%f,
\"
stabilityFeeRatio
\"
:%f,
\"
period
\"
:%s,}"
,
debtCeiling
,
liquidationRatio
,
stabilityFeeRatio
,
period
)),
}
}
else
{
params
=
&
rpctypes
.
CreateTxIn
{
Execer
:
types
.
ExecName
(
pkt
.
CollateralizeX
),
ActionName
:
"CollateralizeManage"
,
Payload
:
[]
byte
(
fmt
.
Sprintf
(
"{[
\"
addr
\"
:%s]}"
,
addr
)),
}
}
}
var
res
string
var
res
string
...
...
plugin/dapp/collateralize/executor/collateralizedb.go
View file @
550958aa
...
@@ -12,6 +12,7 @@ import (
...
@@ -12,6 +12,7 @@ import (
"github.com/33cn/chain33/types"
"github.com/33cn/chain33/types"
pty
"github.com/33cn/plugin/plugin/dapp/collateralize/types"
pty
"github.com/33cn/plugin/plugin/dapp/collateralize/types"
tokenE
"github.com/33cn/plugin/plugin/dapp/token/executor"
tokenE
"github.com/33cn/plugin/plugin/dapp/token/executor"
issuanceE
"github.com/33cn/plugin/plugin/dapp/issuance/types"
)
)
// List control
// List control
...
@@ -67,7 +68,7 @@ func ConfigKey() (key []byte) {
...
@@ -67,7 +68,7 @@ func ConfigKey() (key []byte) {
// Key for CollateralizeAddrConfig
// Key for CollateralizeAddrConfig
func
AddrKey
()
(
key
[]
byte
)
{
func
AddrKey
()
(
key
[]
byte
)
{
key
=
append
(
key
,
[]
byte
(
"mavl-"
+
pty
.
Collateraliz
eX
+
"addr"
)
...
)
key
=
append
(
key
,
[]
byte
(
"mavl-"
+
issuanceE
.
Issuanc
eX
+
"addr"
)
...
)
return
key
return
key
}
}
...
@@ -164,11 +165,11 @@ func (action *Action) GetAppendReceiptLog(collateralize *pty.Collateralize, preS
...
@@ -164,11 +165,11 @@ func (action *Action) GetAppendReceiptLog(collateralize *pty.Collateralize, preS
}
}
// GetFeedReceiptLog generate logs for Collateralize price feed action
// GetFeedReceiptLog generate logs for Collateralize price feed action
func
(
action
*
Action
)
GetFeedReceiptLog
(
collateralize
*
pty
.
Collateralize
,
borrowRecord
*
pty
.
BorrowRecord
,
preStatus
int32
)
*
types
.
ReceiptLog
{
func
(
action
*
Action
)
GetFeedReceiptLog
(
collateralize
*
pty
.
Collateralize
,
borrowRecord
*
pty
.
BorrowRecord
)
*
types
.
ReceiptLog
{
log
:=
&
types
.
ReceiptLog
{}
log
:=
&
types
.
ReceiptLog
{}
log
.
Ty
=
pty
.
TyLogCollateralizeFeed
log
.
Ty
=
pty
.
TyLogCollateralizeFeed
c
:=
action
.
GetCollCommonRecipt
(
collateralize
,
p
reStatus
)
c
:=
action
.
GetCollCommonRecipt
(
collateralize
,
borrowRecord
.
P
reStatus
)
c
.
AccountAddr
=
borrowRecord
.
AccountAddr
c
.
AccountAddr
=
borrowRecord
.
AccountAddr
c
.
RecordStatus
=
borrowRecord
.
Status
c
.
RecordStatus
=
borrowRecord
.
Status
...
@@ -228,60 +229,34 @@ func (action *Action) CollateralizeManage(manage *pty.CollateralizeManage) (*typ
...
@@ -228,60 +229,34 @@ func (action *Action) CollateralizeManage(manage *pty.CollateralizeManage) (*typ
return
nil
,
pty
.
ErrPermissionDeny
return
nil
,
pty
.
ErrPermissionDeny
}
}
if
manage
.
Cfg
!=
nil
{
// 配置借贷参数
// 配置借贷参数
if
manage
.
DebtCeiling
<
0
||
manage
.
LiquidationRatio
<
0
||
manage
.
LiquidationRatio
>=
1
||
config
:=
manage
.
Cfg
manage
.
StabilityFeeRatio
<
0
||
manage
.
StabilityFeeRatio
>=
1
{
if
config
.
DebtCeiling
<
0
||
config
.
LiquidationRatio
<
0
||
config
.
LiquidationRatio
>=
1
||
return
nil
,
pty
.
ErrRiskParam
config
.
StabilityFeeRatio
<
0
||
config
.
StabilityFeeRatio
>=
1
{
return
nil
,
pty
.
ErrRiskParam
}
collConfig
:=
&
pty
.
CollateralizeConfig
{}
collConfig
.
StabilityFeeRatio
=
config
.
StabilityFeeRatio
collConfig
.
Period
=
config
.
Period
collConfig
.
LiquidationRatio
=
config
.
LiquidationRatio
collConfig
.
DebtCeiling
=
config
.
DebtCeiling
value
:=
types
.
Encode
(
collConfig
)
action
.
db
.
Set
(
ConfigKey
(),
value
)
kv
=
append
(
kv
,
&
types
.
KeyValue
{
Key
:
ConfigKey
(),
Value
:
value
})
}
else
if
manage
.
Addr
!=
nil
{
// 添加大户地址
data
,
err
:=
action
.
db
.
Get
(
AddrKey
())
if
err
!=
nil
{
if
err
!=
types
.
ErrNotFound
{
clog
.
Error
(
"CollateralizeManage"
,
"error"
,
err
)
return
nil
,
err
}
value
:=
types
.
Encode
(
manage
.
Addr
)
action
.
db
.
Set
(
AddrKey
(),
value
)
kv
=
append
(
kv
,
&
types
.
KeyValue
{
Key
:
AddrKey
(),
Value
:
value
})
}
else
{
var
addrStore
pty
.
CollateralizeAddr
err
=
types
.
Decode
(
data
,
&
addrStore
)
if
err
!=
nil
{
clog
.
Debug
(
"CollateralizeManage"
,
"decode"
,
err
)
return
nil
,
err
}
addrStore
.
SuperAddrs
=
append
(
addrStore
.
SuperAddrs
,
manage
.
Addr
.
SuperAddrs
...
)
value
:=
types
.
Encode
(
&
addrStore
)
action
.
db
.
Set
(
AddrKey
(),
value
)
kv
=
append
(
kv
,
&
types
.
KeyValue
{
Key
:
AddrKey
(),
Value
:
value
})
}
}
}
collConfig
:=
&
pty
.
CollateralizeManage
{}
collConfig
.
StabilityFeeRatio
=
manage
.
StabilityFeeRatio
collConfig
.
Period
=
manage
.
Period
collConfig
.
LiquidationRatio
=
manage
.
LiquidationRatio
collConfig
.
DebtCeiling
=
manage
.
DebtCeiling
value
:=
types
.
Encode
(
collConfig
)
action
.
db
.
Set
(
ConfigKey
(),
value
)
kv
=
append
(
kv
,
&
types
.
KeyValue
{
Key
:
ConfigKey
(),
Value
:
value
})
receipt
=
&
types
.
Receipt
{
Ty
:
types
.
ExecOk
,
KV
:
kv
,
Logs
:
nil
}
receipt
=
&
types
.
Receipt
{
Ty
:
types
.
ExecOk
,
KV
:
kv
,
Logs
:
nil
}
return
receipt
,
nil
return
receipt
,
nil
}
}
func
(
action
*
Action
)
getCollateralizeConfig
()
(
*
pty
.
Collateralize
Config
,
error
)
{
func
(
action
*
Action
)
getCollateralizeConfig
()
(
*
pty
.
Collateralize
Manage
,
error
)
{
data
,
err
:=
action
.
db
.
Get
(
ConfigKey
())
data
,
err
:=
action
.
db
.
Get
(
ConfigKey
())
if
err
!=
nil
{
if
err
!=
nil
{
clog
.
Debug
(
"getCollateralizeConfig"
,
"error"
,
err
)
clog
.
Debug
(
"getCollateralizeConfig"
,
"error"
,
err
)
return
nil
,
err
return
nil
,
err
}
}
var
collCfg
pty
.
Collateralize
Config
var
collCfg
pty
.
Collateralize
Manage
err
=
types
.
Decode
(
data
,
&
collCfg
)
err
=
types
.
Decode
(
data
,
&
collCfg
)
if
err
!=
nil
{
if
err
!=
nil
{
clog
.
Debug
(
"getCollateralizeConfig"
,
"decode"
,
err
)
clog
.
Debug
(
"getCollateralizeConfig"
,
"decode"
,
err
)
...
@@ -358,10 +333,10 @@ func (action *Action) CollateralizeCreate(create *pty.CollateralizeCreate) (*typ
...
@@ -358,10 +333,10 @@ func (action *Action) CollateralizeCreate(create *pty.CollateralizeCreate) (*typ
kv
=
append
(
kv
,
receipt
.
KV
...
)
kv
=
append
(
kv
,
receipt
.
KV
...
)
// 获取借贷配置
// 获取借贷配置
var
collcfg
*
pty
.
Collateralize
Config
var
collcfg
*
pty
.
Collateralize
Manage
cfg
,
err
:=
action
.
getCollateralizeConfig
()
cfg
,
err
:=
action
.
getCollateralizeConfig
()
if
err
!=
nil
{
if
err
!=
nil
{
collcfg
=
&
pty
.
Collateralize
Config
{
DebtCeiling
:
DefaultDebtCeiling
,
LiquidationRatio
:
DefaultLiquidationRatio
,
StabilityFeeRatio
:
DefaultStabilityFeeRation
,
Period
:
DefaultPeriod
}
collcfg
=
&
pty
.
Collateralize
Manage
{
DebtCeiling
:
DefaultDebtCeiling
,
LiquidationRatio
:
DefaultLiquidationRatio
,
StabilityFeeRatio
:
DefaultStabilityFeeRation
,
Period
:
DefaultPeriod
}
}
else
{
}
else
{
collcfg
=
cfg
collcfg
=
cfg
}
}
...
@@ -477,6 +452,12 @@ func (action *Action) CollateralizeBorrow(borrow *pty.CollateralizeBorrow) (*typ
...
@@ -477,6 +452,12 @@ func (action *Action) CollateralizeBorrow(borrow *pty.CollateralizeBorrow) (*typ
return
nil
,
err
return
nil
,
err
}
}
// 状态检查
if
collateralize
.
Status
==
pty
.
CollateralizeStatusClose
{
clog
.
Error
(
"CollateralizeBorrow"
,
"CollID"
,
collateralize
.
CollateralizeId
,
"addr"
,
action
.
fromaddr
,
"execaddr"
,
action
.
execaddr
,
"status"
,
collateralize
.
Status
,
"err"
,
pty
.
ErrCollateralizeStatus
)
return
nil
,
pty
.
ErrCollateralizeStatus
}
// 一个地址在一期借贷中只允许借出一次
// 一个地址在一期借贷中只允许借出一次
for
_
,
record
:=
range
collateralize
.
BorrowRecords
{
for
_
,
record
:=
range
collateralize
.
BorrowRecords
{
if
record
.
AccountAddr
==
action
.
fromaddr
{
if
record
.
AccountAddr
==
action
.
fromaddr
{
...
@@ -487,12 +468,6 @@ func (action *Action) CollateralizeBorrow(borrow *pty.CollateralizeBorrow) (*typ
...
@@ -487,12 +468,6 @@ func (action *Action) CollateralizeBorrow(borrow *pty.CollateralizeBorrow) (*typ
coll
:=
&
CollateralizeDB
{
*
collateralize
}
coll
:=
&
CollateralizeDB
{
*
collateralize
}
preStatus
:=
coll
.
Status
preStatus
:=
coll
.
Status
// 状态检查
if
coll
.
Status
==
pty
.
CollateralizeStatusClose
{
clog
.
Error
(
"CollateralizeBorrow"
,
"CollID"
,
coll
.
CollateralizeId
,
"addr"
,
action
.
fromaddr
,
"execaddr"
,
action
.
execaddr
,
"status"
,
coll
.
Status
,
"err"
,
pty
.
ErrCollateralizeStatus
)
return
nil
,
pty
.
ErrCollateralizeStatus
}
// 借贷金额检查
// 借贷金额检查
if
borrow
.
GetValue
()
<=
0
{
if
borrow
.
GetValue
()
<=
0
{
clog
.
Error
(
"CollateralizeBorrow"
,
"CollID"
,
coll
.
CollateralizeId
,
"addr"
,
action
.
fromaddr
,
"execaddr"
,
action
.
execaddr
,
"borrow value"
,
borrow
.
GetValue
(),
"err"
,
types
.
ErrInvalidParam
)
clog
.
Error
(
"CollateralizeBorrow"
,
"CollID"
,
coll
.
CollateralizeId
,
"addr"
,
action
.
fromaddr
,
"execaddr"
,
action
.
execaddr
,
"borrow value"
,
borrow
.
GetValue
(),
"err"
,
types
.
ErrInvalidParam
)
...
@@ -662,6 +637,7 @@ func (action *Action) CollateralizeRepay(repay *pty.CollateralizeRepay) (*types.
...
@@ -662,6 +637,7 @@ func (action *Action) CollateralizeRepay(repay *pty.CollateralizeRepay) (*types.
kv
=
append
(
kv
,
receipt
.
KV
...
)
kv
=
append
(
kv
,
receipt
.
KV
...
)
// 借贷记录关闭
// 借贷记录关闭
borrowRecord
.
PreStatus
=
borrowRecord
.
Status
borrowRecord
.
Status
=
pty
.
CollateralizeUserStatusClose
borrowRecord
.
Status
=
pty
.
CollateralizeUserStatusClose
// 保存
// 保存
...
@@ -751,6 +727,13 @@ func (action *Action) CollateralizeAppend(cAppend *pty.CollateralizeAppend) (*ty
...
@@ -751,6 +727,13 @@ func (action *Action) CollateralizeAppend(cAppend *pty.CollateralizeAppend) (*ty
borrowRecord
.
CollateralValue
+=
cAppend
.
CollateralValue
borrowRecord
.
CollateralValue
+=
cAppend
.
CollateralValue
borrowRecord
.
CollateralPrice
=
lastPrice
borrowRecord
.
CollateralPrice
=
lastPrice
borrowRecord
.
LiquidationPrice
=
calcLiquidationPrice
(
borrowRecord
.
DebtValue
,
borrowRecord
.
CollateralValue
)
borrowRecord
.
LiquidationPrice
=
calcLiquidationPrice
(
borrowRecord
.
DebtValue
,
borrowRecord
.
CollateralValue
)
if
borrowRecord
.
LiquidationPrice
*
PriceWarningRate
<
lastPrice
{
// 告警解除
if
borrowRecord
.
Status
==
pty
.
CollateralizeUserStatusWarning
{
borrowRecord
.
PreStatus
=
borrowRecord
.
Status
borrowRecord
.
Status
=
pty
.
CollateralizeStatusCreated
}
}
// 记录当前借贷的最高自动清算价格
// 记录当前借贷的最高自动清算价格
coll
.
LatestLiquidationPrice
=
getLatestLiquidationPrice
(
&
coll
.
Collateralize
)
coll
.
LatestLiquidationPrice
=
getLatestLiquidationPrice
(
&
coll
.
Collateralize
)
...
@@ -836,9 +819,11 @@ func (action *Action) systemLiquidation(coll *pty.Collateralize, price float32)
...
@@ -836,9 +819,11 @@ func (action *Action) systemLiquidation(coll *pty.Collateralize, price float32)
collDB
:=
&
CollateralizeDB
{
*
coll
}
collDB
:=
&
CollateralizeDB
{
*
coll
}
for
index
,
borrowRecord
:=
range
coll
.
BorrowRecords
{
for
index
,
borrowRecord
:=
range
coll
.
BorrowRecords
{
var
preStatus
int32
if
borrowRecord
.
LiquidationPrice
*
PriceWarningRate
<
price
{
if
borrowRecord
.
LiquidationPrice
*
PriceWarningRate
<
price
{
if
borrowRecord
.
Status
==
pty
.
CollateralizeUserStatusSystemLiquidate
{
borrowRecord
.
Status
=
borrowRecord
.
PreStatus
borrowRecord
.
PreStatus
=
pty
.
CollateralizeUserStatusSystemLiquidate
}
continue
continue
}
}
...
@@ -862,16 +847,16 @@ func (action *Action) systemLiquidation(coll *pty.Collateralize, price float32)
...
@@ -862,16 +847,16 @@ func (action *Action) systemLiquidation(coll *pty.Collateralize, price float32)
// 借贷记录清算
// 借贷记录清算
borrowRecord
.
LiquidateTime
=
action
.
blocktime
borrowRecord
.
LiquidateTime
=
action
.
blocktime
p
reStatus
=
borrowRecord
.
Status
borrowRecord
.
P
reStatus
=
borrowRecord
.
Status
borrowRecord
.
Status
=
pty
.
CollateralizeUserStatusSystemLiquidate
borrowRecord
.
Status
=
pty
.
CollateralizeUserStatusSystemLiquidate
coll
.
BorrowRecords
=
append
(
coll
.
BorrowRecords
[
:
index
],
coll
.
BorrowRecords
[
index
+
1
:
]
...
)
coll
.
BorrowRecords
=
append
(
coll
.
BorrowRecords
[
:
index
],
coll
.
BorrowRecords
[
index
+
1
:
]
...
)
coll
.
InvalidRecords
=
append
(
coll
.
InvalidRecords
,
borrowRecord
)
coll
.
InvalidRecords
=
append
(
coll
.
InvalidRecords
,
borrowRecord
)
}
else
{
}
else
{
p
reStatus
=
borrowRecord
.
Status
borrowRecord
.
P
reStatus
=
borrowRecord
.
Status
borrowRecord
.
Status
=
pty
.
CollateralizeUserStatusWarning
borrowRecord
.
Status
=
pty
.
CollateralizeUserStatusWarning
}
}
log
:=
action
.
GetFeedReceiptLog
(
coll
,
borrowRecord
,
preStatus
)
log
:=
action
.
GetFeedReceiptLog
(
coll
,
borrowRecord
)
logs
=
append
(
logs
,
log
)
logs
=
append
(
logs
,
log
)
}
}
...
@@ -892,8 +877,6 @@ func (action *Action) expireLiquidation(coll *pty.Collateralize) (*types.Receipt
...
@@ -892,8 +877,6 @@ func (action *Action) expireLiquidation(coll *pty.Collateralize) (*types.Receipt
collDB
:=
&
CollateralizeDB
{
*
coll
}
collDB
:=
&
CollateralizeDB
{
*
coll
}
for
index
,
borrowRecord
:=
range
coll
.
BorrowRecords
{
for
index
,
borrowRecord
:=
range
coll
.
BorrowRecords
{
var
preStatus
int32
if
borrowRecord
.
ExpireTime
-
ExpireWarningTime
>
action
.
blocktime
{
if
borrowRecord
.
ExpireTime
-
ExpireWarningTime
>
action
.
blocktime
{
continue
continue
}
}
...
@@ -918,16 +901,16 @@ func (action *Action) expireLiquidation(coll *pty.Collateralize) (*types.Receipt
...
@@ -918,16 +901,16 @@ func (action *Action) expireLiquidation(coll *pty.Collateralize) (*types.Receipt
// 借贷记录清算
// 借贷记录清算
borrowRecord
.
LiquidateTime
=
action
.
blocktime
borrowRecord
.
LiquidateTime
=
action
.
blocktime
p
reStatus
=
borrowRecord
.
Status
borrowRecord
.
P
reStatus
=
borrowRecord
.
Status
borrowRecord
.
Status
=
pty
.
CollateralizeUserStatusExpireLiquidate
borrowRecord
.
Status
=
pty
.
CollateralizeUserStatusExpireLiquidate
coll
.
BorrowRecords
=
append
(
coll
.
BorrowRecords
[
:
index
],
coll
.
BorrowRecords
[
index
+
1
:
]
...
)
coll
.
BorrowRecords
=
append
(
coll
.
BorrowRecords
[
:
index
],
coll
.
BorrowRecords
[
index
+
1
:
]
...
)
coll
.
InvalidRecords
=
append
(
coll
.
InvalidRecords
,
borrowRecord
)
coll
.
InvalidRecords
=
append
(
coll
.
InvalidRecords
,
borrowRecord
)
}
else
{
}
else
{
p
reStatus
=
borrowRecord
.
Status
borrowRecord
.
P
reStatus
=
borrowRecord
.
Status
borrowRecord
.
Status
=
pty
.
CollateralizeUserStatusExpire
borrowRecord
.
Status
=
pty
.
CollateralizeUserStatusExpire
}
}
log
:=
action
.
GetFeedReceiptLog
(
coll
,
borrowRecord
,
preStatus
)
log
:=
action
.
GetFeedReceiptLog
(
coll
,
borrowRecord
)
logs
=
append
(
logs
,
log
)
logs
=
append
(
logs
,
log
)
}
}
...
@@ -991,17 +974,6 @@ func (action *Action) CollateralizeFeed(feed *pty.CollateralizeFeed) (*types.Rec
...
@@ -991,17 +974,6 @@ func (action *Action) CollateralizeFeed(feed *pty.CollateralizeFeed) (*types.Rec
continue
continue
}
}
// 系统清算判断
if
coll
.
LatestLiquidationPrice
*
PriceWarningRate
>=
price
{
receipt
,
err
:=
action
.
systemLiquidation
(
coll
,
price
)
if
err
!=
nil
{
clog
.
Error
(
"CollateralizePriceFeed"
,
"Collateralize ID"
,
coll
.
CollateralizeId
,
"system liquidation error"
,
err
)
continue
}
logs
=
append
(
logs
,
receipt
.
Logs
...
)
kv
=
append
(
kv
,
receipt
.
KV
...
)
}
// 超时清算判断
// 超时清算判断
if
coll
.
LatestExpireTime
-
ExpireWarningTime
<=
action
.
blocktime
{
if
coll
.
LatestExpireTime
-
ExpireWarningTime
<=
action
.
blocktime
{
receipt
,
err
:=
action
.
expireLiquidation
(
coll
)
receipt
,
err
:=
action
.
expireLiquidation
(
coll
)
...
@@ -1012,6 +984,15 @@ func (action *Action) CollateralizeFeed(feed *pty.CollateralizeFeed) (*types.Rec
...
@@ -1012,6 +984,15 @@ func (action *Action) CollateralizeFeed(feed *pty.CollateralizeFeed) (*types.Rec
logs
=
append
(
logs
,
receipt
.
Logs
...
)
logs
=
append
(
logs
,
receipt
.
Logs
...
)
kv
=
append
(
kv
,
receipt
.
KV
...
)
kv
=
append
(
kv
,
receipt
.
KV
...
)
}
}
// 系统清算判断
receipt
,
err
:=
action
.
systemLiquidation
(
coll
,
price
)
if
err
!=
nil
{
clog
.
Error
(
"CollateralizePriceFeed"
,
"Collateralize ID"
,
coll
.
CollateralizeId
,
"system liquidation error"
,
err
)
continue
}
logs
=
append
(
logs
,
receipt
.
Logs
...
)
kv
=
append
(
kv
,
receipt
.
KV
...
)
}
}
var
priceRecord
pty
.
AssetPriceRecord
var
priceRecord
pty
.
AssetPriceRecord
...
@@ -1024,7 +1005,6 @@ func (action *Action) CollateralizeFeed(feed *pty.CollateralizeFeed) (*types.Rec
...
@@ -1024,7 +1005,6 @@ func (action *Action) CollateralizeFeed(feed *pty.CollateralizeFeed) (*types.Rec
}
else
{
}
else
{
priceRecord
.
BtyPrice
=
price
priceRecord
.
BtyPrice
=
price
}
}
priceRecord
.
PreRecordTime
=
priceRecord
.
RecordTime
priceRecord
.
RecordTime
=
action
.
blocktime
priceRecord
.
RecordTime
=
action
.
blocktime
// 喂价记录
// 喂价记录
...
...
plugin/dapp/collateralize/executor/exec.go
View file @
550958aa
...
@@ -44,3 +44,9 @@ func (c *Collateralize) Exec_Close(payload *pty.CollateralizeClose, tx *types.Tr
...
@@ -44,3 +44,9 @@ func (c *Collateralize) Exec_Close(payload *pty.CollateralizeClose, tx *types.Tr
actiondb
:=
NewCollateralizeAction
(
c
,
tx
,
index
)
actiondb
:=
NewCollateralizeAction
(
c
,
tx
,
index
)
return
actiondb
.
CollateralizeClose
(
payload
)
return
actiondb
.
CollateralizeClose
(
payload
)
}
}
// Exec_Close Action
func
(
c
*
Collateralize
)
Exec_Manage
(
payload
*
pty
.
CollateralizeManage
,
tx
*
types
.
Transaction
,
index
int
)
(
*
types
.
Receipt
,
error
)
{
actiondb
:=
NewCollateralizeAction
(
c
,
tx
,
index
)
return
actiondb
.
CollateralizeManage
(
payload
)
}
plugin/dapp/collateralize/executor/exec_del_local.go
View file @
550958aa
...
@@ -77,4 +77,9 @@ func (c *Collateralize) ExecDelLocal_Feed(payload *pty.CollateralizeFeed, tx *ty
...
@@ -77,4 +77,9 @@ func (c *Collateralize) ExecDelLocal_Feed(payload *pty.CollateralizeFeed, tx *ty
// ExecDelLocal_Close Action
// ExecDelLocal_Close Action
func
(
c
*
Collateralize
)
ExecDelLocal_Close
(
payload
*
pty
.
CollateralizeClose
,
tx
*
types
.
Transaction
,
receiptData
*
types
.
ReceiptData
,
index
int
)
(
*
types
.
LocalDBSet
,
error
)
{
func
(
c
*
Collateralize
)
ExecDelLocal_Close
(
payload
*
pty
.
CollateralizeClose
,
tx
*
types
.
Transaction
,
receiptData
*
types
.
ReceiptData
,
index
int
)
(
*
types
.
LocalDBSet
,
error
)
{
return
c
.
execDelLocal
(
tx
,
receiptData
)
return
c
.
execDelLocal
(
tx
,
receiptData
)
}
// 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/exec_local.go
View file @
550958aa
...
@@ -76,3 +76,8 @@ func (c *Collateralize) ExecLocal_Feed(payload *pty.CollateralizeFeed, tx *types
...
@@ -76,3 +76,8 @@ func (c *Collateralize) ExecLocal_Feed(payload *pty.CollateralizeFeed, tx *types
func
(
c
*
Collateralize
)
ExecLocal_Close
(
payload
*
pty
.
CollateralizeClose
,
tx
*
types
.
Transaction
,
receiptData
*
types
.
ReceiptData
,
index
int
)
(
*
types
.
LocalDBSet
,
error
)
{
func
(
c
*
Collateralize
)
ExecLocal_Close
(
payload
*
pty
.
CollateralizeClose
,
tx
*
types
.
Transaction
,
receiptData
*
types
.
ReceiptData
,
index
int
)
(
*
types
.
LocalDBSet
,
error
)
{
return
c
.
execLocal
(
tx
,
receiptData
)
return
c
.
execLocal
(
tx
,
receiptData
)
}
}
// ExecLocal_Manage Action
func
(
c
*
Collateralize
)
ExecLocal_Manage
(
payload
*
pty
.
CollateralizeManage
,
tx
*
types
.
Transaction
,
receiptData
*
types
.
ReceiptData
,
index
int
)
(
*
types
.
LocalDBSet
,
error
)
{
return
c
.
execLocal
(
tx
,
receiptData
)
}
plugin/dapp/collateralize/executor/keys.go
View file @
550958aa
...
@@ -11,11 +11,6 @@ func calcCollateralizeKey(collateralizeID string, index int64) []byte {
...
@@ -11,11 +11,6 @@ func calcCollateralizeKey(collateralizeID string, index int64) []byte {
return
[]
byte
(
key
)
return
[]
byte
(
key
)
}
}
func
calcCollateralizePrefix
()
[]
byte
{
key
:=
fmt
.
Sprintf
(
"LODB-Collateralize-ID:"
)
return
[]
byte
(
key
)
}
func
calcCollateralizeStatusPrefix
(
status
int32
)
[]
byte
{
func
calcCollateralizeStatusPrefix
(
status
int32
)
[]
byte
{
key
:=
fmt
.
Sprintf
(
"LODB-Collateralize-status-index:%d"
,
status
)
key
:=
fmt
.
Sprintf
(
"LODB-Collateralize-status-index:%d"
,
status
)
return
[]
byte
(
key
)
return
[]
byte
(
key
)
...
...
plugin/dapp/collateralize/proto/collateralize.proto
View file @
550958aa
...
@@ -31,6 +31,7 @@ message BorrowRecord {
...
@@ -31,6 +31,7 @@ message BorrowRecord {
int32
status
=
7
;
//抵押状态,是否被清算
int32
status
=
7
;
//抵押状态,是否被清算
int64
liquidateTime
=
8
;
//清算时间
int64
liquidateTime
=
8
;
//清算时间
int64
expireTime
=
9
;
//超时清算时间
int64
expireTime
=
9
;
//超时清算时间
int32
preStatus
=
10
;
//上一次抵押状态,用于告警恢复
}
}
// 资产价格记录
// 资产价格记录
...
@@ -39,7 +40,6 @@ message AssetPriceRecord {
...
@@ -39,7 +40,6 @@ message AssetPriceRecord {
float
btyPrice
=
2
;
//bty价格
float
btyPrice
=
2
;
//bty价格
float
btcPrice
=
3
;
//btc价格
float
btcPrice
=
3
;
//btc价格
float
ethPrice
=
4
;
//eth价格
float
ethPrice
=
4
;
//eth价格
int64
preRecordTime
=
5
;
//上一次记录时间
}
}
// action
// action
...
@@ -57,11 +57,6 @@ message CollateralizeAction {
...
@@ -57,11 +57,6 @@ message CollateralizeAction {
}
}
message
CollateralizeManage
{
message
CollateralizeManage
{
CollateralizeConfig
cfg
=
1
;
//借贷配置
CollateralizeAddr
addr
=
2
;
//地址配置
}
message
CollateralizeConfig
{
int64
debtCeiling
=
1
;
//单用户可借出的限额(ccny)
int64
debtCeiling
=
1
;
//单用户可借出的限额(ccny)
float
liquidationRatio
=
2
;
//清算比例
float
liquidationRatio
=
2
;
//清算比例
float
stabilityFeeRatio
=
3
;
//稳定费
float
stabilityFeeRatio
=
3
;
//稳定费
...
@@ -141,9 +136,8 @@ message RepCollateralizeCurrentInfo {
...
@@ -141,9 +136,8 @@ message RepCollateralizeCurrentInfo {
int64
debtCeiling
=
3
;
//单用户可借出的限额(ccny)
int64
debtCeiling
=
3
;
//单用户可借出的限额(ccny)
float
liquidationRatio
=
4
;
//清算比例
float
liquidationRatio
=
4
;
//清算比例
float
stabilityFeeRatio
=
5
;
//稳定费
float
stabilityFeeRatio
=
5
;
//稳定费
int64
liquidationPenalty
=
6
;
//清算罚金
string
createAddr
=
6
;
//创建人地址
string
createAddr
=
7
;
//创建人地址
int64
balance
=
7
;
//剩余可借贷金额(ccny)
int64
balance
=
8
;
//剩余可借贷金额(ccny)
}
}
// 根据ID列表查询多期借贷信息
// 根据ID列表查询多期借贷信息
...
...
plugin/dapp/collateralize/types/collateralize.go
View file @
550958aa
...
@@ -116,11 +116,7 @@ func (Collateralize CollateralizeType) CreateTx(action string, message json.RawM
...
@@ -116,11 +116,7 @@ func (Collateralize CollateralizeType) CreateTx(action string, message json.RawM
llog
.
Error
(
"CreateTx"
,
"Error"
,
err
)
llog
.
Error
(
"CreateTx"
,
"Error"
,
err
)
return
nil
,
types
.
ErrInvalidParam
return
nil
,
types
.
ErrInvalidParam
}
}
if
param
.
Addr
!=
nil
{
return
CreateRawCollateralizeManageTx
(
&
param
)
return
CreateRawCollateralizeManageAddrTx
(
&
param
)
}
return
CreateRawCollateralizeManageConfigTx
(
&
param
)
}
else
{
}
else
{
return
nil
,
types
.
ErrNotSupport
return
nil
,
types
.
ErrNotSupport
}
}
...
@@ -178,13 +174,13 @@ func CreateRawCollateralizeBorrowTx(parm *CollateralizeBorrowTx) (*types.Transac
...
@@ -178,13 +174,13 @@ func CreateRawCollateralizeBorrowTx(parm *CollateralizeBorrowTx) (*types.Transac
CollateralizeId
:
parm
.
CollateralizeID
,
CollateralizeId
:
parm
.
CollateralizeID
,
Value
:
parm
.
Value
,
Value
:
parm
.
Value
,
}
}
B
orrow
:=
&
CollateralizeAction
{
b
orrow
:=
&
CollateralizeAction
{
Ty
:
CollateralizeActionBorrow
,
Ty
:
CollateralizeActionBorrow
,
Value
:
&
CollateralizeAction_Borrow
{
v
},
Value
:
&
CollateralizeAction_Borrow
{
v
},
}
}
tx
:=
&
types
.
Transaction
{
tx
:=
&
types
.
Transaction
{
Execer
:
[]
byte
(
types
.
ExecName
(
CollateralizeX
)),
Execer
:
[]
byte
(
types
.
ExecName
(
CollateralizeX
)),
Payload
:
types
.
Encode
(
B
orrow
),
Payload
:
types
.
Encode
(
b
orrow
),
Fee
:
parm
.
Fee
,
Fee
:
parm
.
Fee
,
To
:
address
.
ExecAddress
(
types
.
ExecName
(
CollateralizeX
)),
To
:
address
.
ExecAddress
(
types
.
ExecName
(
CollateralizeX
)),
}
}
...
@@ -207,13 +203,13 @@ func CreateRawCollateralizeRepayTx(parm *CollateralizeRepayTx) (*types.Transacti
...
@@ -207,13 +203,13 @@ func CreateRawCollateralizeRepayTx(parm *CollateralizeRepayTx) (*types.Transacti
CollateralizeId
:
parm
.
CollateralizeID
,
CollateralizeId
:
parm
.
CollateralizeID
,
Value
:
parm
.
Value
,
Value
:
parm
.
Value
,
}
}
R
epay
:=
&
CollateralizeAction
{
r
epay
:=
&
CollateralizeAction
{
Ty
:
CollateralizeActionRepay
,
Ty
:
CollateralizeActionRepay
,
Value
:
&
CollateralizeAction_Repay
{
v
},
Value
:
&
CollateralizeAction_Repay
{
v
},
}
}
tx
:=
&
types
.
Transaction
{
tx
:=
&
types
.
Transaction
{
Execer
:
[]
byte
(
types
.
ExecName
(
CollateralizeX
)),
Execer
:
[]
byte
(
types
.
ExecName
(
CollateralizeX
)),
Payload
:
types
.
Encode
(
R
epay
),
Payload
:
types
.
Encode
(
r
epay
),
Fee
:
parm
.
Fee
,
Fee
:
parm
.
Fee
,
To
:
address
.
ExecAddress
(
types
.
ExecName
(
CollateralizeX
)),
To
:
address
.
ExecAddress
(
types
.
ExecName
(
CollateralizeX
)),
}
}
...
@@ -236,13 +232,13 @@ func CreateRawCollateralizeAppendTx(parm *CollateralizeAppendTx) (*types.Transac
...
@@ -236,13 +232,13 @@ func CreateRawCollateralizeAppendTx(parm *CollateralizeAppendTx) (*types.Transac
CollateralizeId
:
parm
.
CollateralizeID
,
CollateralizeId
:
parm
.
CollateralizeID
,
CollateralValue
:
parm
.
Value
,
CollateralValue
:
parm
.
Value
,
}
}
Repay
:=
&
CollateralizeAction
{
append
:=
&
CollateralizeAction
{
Ty
:
CollateralizeActionAppend
,
Ty
:
CollateralizeActionAppend
,
Value
:
&
CollateralizeAction_Append
{
v
},
Value
:
&
CollateralizeAction_Append
{
v
},
}
}
tx
:=
&
types
.
Transaction
{
tx
:=
&
types
.
Transaction
{
Execer
:
[]
byte
(
types
.
ExecName
(
CollateralizeX
)),
Execer
:
[]
byte
(
types
.
ExecName
(
CollateralizeX
)),
Payload
:
types
.
Encode
(
Repay
),
Payload
:
types
.
Encode
(
append
),
Fee
:
parm
.
Fee
,
Fee
:
parm
.
Fee
,
To
:
address
.
ExecAddress
(
types
.
ExecName
(
CollateralizeX
)),
To
:
address
.
ExecAddress
(
types
.
ExecName
(
CollateralizeX
)),
}
}
...
@@ -265,13 +261,13 @@ func CreateRawCollateralizeFeedTx(parm *CollateralizeFeedTx) (*types.Transaction
...
@@ -265,13 +261,13 @@ func CreateRawCollateralizeFeedTx(parm *CollateralizeFeedTx) (*types.Transaction
Price
:
parm
.
Price
,
Price
:
parm
.
Price
,
Volume
:
parm
.
Volume
,
Volume
:
parm
.
Volume
,
}
}
F
eed
:=
&
CollateralizeAction
{
f
eed
:=
&
CollateralizeAction
{
Ty
:
CollateralizeActionFeed
,
Ty
:
CollateralizeActionFeed
,
Value
:
&
CollateralizeAction_Feed
{
v
},
Value
:
&
CollateralizeAction_Feed
{
v
},
}
}
tx
:=
&
types
.
Transaction
{
tx
:=
&
types
.
Transaction
{
Execer
:
[]
byte
(
types
.
ExecName
(
CollateralizeX
)),
Execer
:
[]
byte
(
types
.
ExecName
(
CollateralizeX
)),
Payload
:
types
.
Encode
(
F
eed
),
Payload
:
types
.
Encode
(
f
eed
),
Fee
:
parm
.
Fee
,
Fee
:
parm
.
Fee
,
To
:
address
.
ExecAddress
(
types
.
ExecName
(
CollateralizeX
)),
To
:
address
.
ExecAddress
(
types
.
ExecName
(
CollateralizeX
)),
}
}
...
@@ -312,28 +308,27 @@ func CreateRawCollateralizeCloseTx(parm *CollateralizeCloseTx) (*types.Transacti
...
@@ -312,28 +308,27 @@ func CreateRawCollateralizeCloseTx(parm *CollateralizeCloseTx) (*types.Transacti
return
tx
,
nil
return
tx
,
nil
}
}
// CreateRawCollateralizeManage
Config
Tx method
// CreateRawCollateralizeManageTx method
func
CreateRawCollateralizeManage
Config
Tx
(
parm
*
CollateralizeManageTx
)
(
*
types
.
Transaction
,
error
)
{
func
CreateRawCollateralizeManageTx
(
parm
*
CollateralizeManageTx
)
(
*
types
.
Transaction
,
error
)
{
if
parm
==
nil
{
if
parm
==
nil
{
llog
.
Error
(
"CreateRawCollateralizeManageTx"
,
"parm"
,
parm
)
llog
.
Error
(
"CreateRawCollateralizeManageTx"
,
"parm"
,
parm
)
return
nil
,
types
.
ErrInvalidParam
return
nil
,
types
.
ErrInvalidParam
}
}
v
:=
&
CollateralizeManage
{}
v
:=
&
CollateralizeManage
{
v
.
Cfg
=
&
CollateralizeConfig
{
DebtCeiling
:
parm
.
DebtCeiling
,
DebtCeiling
:
parm
.
DebtCeiling
,
LiquidationRatio
:
parm
.
LiquidationRatio
,
LiquidationRatio
:
parm
.
LiquidationRatio
,
StabilityFeeRatio
:
parm
.
StabilityFeeRatio
,
StabilityFeeRatio
:
parm
.
StabilityFeeRatio
,
Period
:
parm
.
Period
,
Period
:
parm
.
Period
,
}
}
clos
e
:=
&
CollateralizeAction
{
manag
e
:=
&
CollateralizeAction
{
Ty
:
CollateralizeActionManage
,
Ty
:
CollateralizeActionManage
,
Value
:
&
CollateralizeAction_Manage
{
v
},
Value
:
&
CollateralizeAction_Manage
{
v
},
}
}
tx
:=
&
types
.
Transaction
{
tx
:=
&
types
.
Transaction
{
Execer
:
[]
byte
(
types
.
ExecName
(
CollateralizeX
)),
Execer
:
[]
byte
(
types
.
ExecName
(
CollateralizeX
)),
Payload
:
types
.
Encode
(
clos
e
),
Payload
:
types
.
Encode
(
manag
e
),
Fee
:
parm
.
Fee
,
Fee
:
parm
.
Fee
,
To
:
address
.
ExecAddress
(
types
.
ExecName
(
CollateralizeX
)),
To
:
address
.
ExecAddress
(
types
.
ExecName
(
CollateralizeX
)),
}
}
...
@@ -345,32 +340,3 @@ func CreateRawCollateralizeManageConfigTx(parm *CollateralizeManageTx) (*types.T
...
@@ -345,32 +340,3 @@ func CreateRawCollateralizeManageConfigTx(parm *CollateralizeManageTx) (*types.T
}
}
return
tx
,
nil
return
tx
,
nil
}
}
// CreateRawCollateralizeManageAddrTx method
func
CreateRawCollateralizeManageAddrTx
(
parm
*
CollateralizeManageTx
)
(
*
types
.
Transaction
,
error
)
{
if
parm
==
nil
{
llog
.
Error
(
"CreateRawCollateralizeManageTx"
,
"parm"
,
parm
)
return
nil
,
types
.
ErrInvalidParam
}
v
:=
&
CollateralizeManage
{}
v
.
Addr
=
&
CollateralizeAddr
{
SuperAddrs
:
parm
.
Addr
}
close
:=
&
CollateralizeAction
{
Ty
:
CollateralizeActionManage
,
Value
:
&
CollateralizeAction_Manage
{
v
},
}
tx
:=
&
types
.
Transaction
{
Execer
:
[]
byte
(
types
.
ExecName
(
CollateralizeX
)),
Payload
:
types
.
Encode
(
close
),
Fee
:
parm
.
Fee
,
To
:
address
.
ExecAddress
(
types
.
ExecName
(
CollateralizeX
)),
}
name
:=
types
.
ExecName
(
CollateralizeX
)
tx
,
err
:=
types
.
FormatTx
(
name
,
tx
)
if
err
!=
nil
{
return
nil
,
err
}
return
tx
,
nil
}
\ No newline at end of file
plugin/dapp/collateralize/types/collateralize.pb.go
View file @
550958aa
...
@@ -175,6 +175,7 @@ type BorrowRecord struct {
...
@@ -175,6 +175,7 @@ type BorrowRecord struct {
Status
int32
`protobuf:"varint,7,opt,name=status,proto3" json:"status,omitempty"`
Status
int32
`protobuf:"varint,7,opt,name=status,proto3" json:"status,omitempty"`
LiquidateTime
int64
`protobuf:"varint,8,opt,name=liquidateTime,proto3" json:"liquidateTime,omitempty"`
LiquidateTime
int64
`protobuf:"varint,8,opt,name=liquidateTime,proto3" json:"liquidateTime,omitempty"`
ExpireTime
int64
`protobuf:"varint,9,opt,name=expireTime,proto3" json:"expireTime,omitempty"`
ExpireTime
int64
`protobuf:"varint,9,opt,name=expireTime,proto3" json:"expireTime,omitempty"`
PreStatus
int32
`protobuf:"varint,10,opt,name=preStatus,proto3" json:"preStatus,omitempty"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
XXX_unrecognized
[]
byte
`json:"-"`
XXX_unrecognized
[]
byte
`json:"-"`
XXX_sizecache
int32
`json:"-"`
XXX_sizecache
int32
`json:"-"`
...
@@ -268,13 +269,19 @@ func (m *BorrowRecord) GetExpireTime() int64 {
...
@@ -268,13 +269,19 @@ func (m *BorrowRecord) GetExpireTime() int64 {
return
0
return
0
}
}
func
(
m
*
BorrowRecord
)
GetPreStatus
()
int32
{
if
m
!=
nil
{
return
m
.
PreStatus
}
return
0
}
// 资产价格记录
// 资产价格记录
type
AssetPriceRecord
struct
{
type
AssetPriceRecord
struct
{
RecordTime
int64
`protobuf:"varint,1,opt,name=recordTime,proto3" json:"recordTime,omitempty"`
RecordTime
int64
`protobuf:"varint,1,opt,name=recordTime,proto3" json:"recordTime,omitempty"`
BtyPrice
float32
`protobuf:"fixed32,2,opt,name=btyPrice,proto3" json:"btyPrice,omitempty"`
BtyPrice
float32
`protobuf:"fixed32,2,opt,name=btyPrice,proto3" json:"btyPrice,omitempty"`
BtcPrice
float32
`protobuf:"fixed32,3,opt,name=btcPrice,proto3" json:"btcPrice,omitempty"`
BtcPrice
float32
`protobuf:"fixed32,3,opt,name=btcPrice,proto3" json:"btcPrice,omitempty"`
EthPrice
float32
`protobuf:"fixed32,4,opt,name=ethPrice,proto3" json:"ethPrice,omitempty"`
EthPrice
float32
`protobuf:"fixed32,4,opt,name=ethPrice,proto3" json:"ethPrice,omitempty"`
PreRecordTime
int64
`protobuf:"varint,5,opt,name=preRecordTime,proto3" json:"preRecordTime,omitempty"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
XXX_unrecognized
[]
byte
`json:"-"`
XXX_unrecognized
[]
byte
`json:"-"`
XXX_sizecache
int32
`json:"-"`
XXX_sizecache
int32
`json:"-"`
...
@@ -333,13 +340,6 @@ func (m *AssetPriceRecord) GetEthPrice() float32 {
...
@@ -333,13 +340,6 @@ func (m *AssetPriceRecord) GetEthPrice() float32 {
return
0
return
0
}
}
func
(
m
*
AssetPriceRecord
)
GetPreRecordTime
()
int64
{
if
m
!=
nil
{
return
m
.
PreRecordTime
}
return
0
}
// action
// action
type
CollateralizeAction
struct
{
type
CollateralizeAction
struct
{
// Types that are valid to be assigned to Value:
// Types that are valid to be assigned to Value:
...
@@ -505,11 +505,13 @@ func (*CollateralizeAction) XXX_OneofWrappers() []interface{} {
...
@@ -505,11 +505,13 @@ func (*CollateralizeAction) XXX_OneofWrappers() []interface{} {
}
}
type
CollateralizeManage
struct
{
type
CollateralizeManage
struct
{
Cfg
*
CollateralizeConfig
`protobuf:"bytes,1,opt,name=cfg,proto3" json:"cfg,omitempty"`
DebtCeiling
int64
`protobuf:"varint,1,opt,name=debtCeiling,proto3" json:"debtCeiling,omitempty"`
Addr
*
CollateralizeAddr
`protobuf:"bytes,2,opt,name=addr,proto3" json:"addr,omitempty"`
LiquidationRatio
float32
`protobuf:"fixed32,2,opt,name=liquidationRatio,proto3" json:"liquidationRatio,omitempty"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
StabilityFeeRatio
float32
`protobuf:"fixed32,3,opt,name=stabilityFeeRatio,proto3" json:"stabilityFeeRatio,omitempty"`
XXX_unrecognized
[]
byte
`json:"-"`
Period
int64
`protobuf:"varint,4,opt,name=period,proto3" json:"period,omitempty"`
XXX_sizecache
int32
`json:"-"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
XXX_unrecognized
[]
byte
`json:"-"`
XXX_sizecache
int32
`json:"-"`
}
}
func
(
m
*
CollateralizeManage
)
Reset
()
{
*
m
=
CollateralizeManage
{}
}
func
(
m
*
CollateralizeManage
)
Reset
()
{
*
m
=
CollateralizeManage
{}
}
...
@@ -537,77 +539,28 @@ func (m *CollateralizeManage) XXX_DiscardUnknown() {
...
@@ -537,77 +539,28 @@ func (m *CollateralizeManage) XXX_DiscardUnknown() {
var
xxx_messageInfo_CollateralizeManage
proto
.
InternalMessageInfo
var
xxx_messageInfo_CollateralizeManage
proto
.
InternalMessageInfo
func
(
m
*
CollateralizeManage
)
GetCfg
()
*
CollateralizeConfig
{
func
(
m
*
CollateralizeManage
)
GetDebtCeiling
()
int64
{
if
m
!=
nil
{
return
m
.
Cfg
}
return
nil
}
func
(
m
*
CollateralizeManage
)
GetAddr
()
*
CollateralizeAddr
{
if
m
!=
nil
{
return
m
.
Addr
}
return
nil
}
type
CollateralizeConfig
struct
{
DebtCeiling
int64
`protobuf:"varint,1,opt,name=debtCeiling,proto3" json:"debtCeiling,omitempty"`
LiquidationRatio
float32
`protobuf:"fixed32,2,opt,name=liquidationRatio,proto3" json:"liquidationRatio,omitempty"`
StabilityFeeRatio
float32
`protobuf:"fixed32,3,opt,name=stabilityFeeRatio,proto3" json:"stabilityFeeRatio,omitempty"`
Period
int64
`protobuf:"varint,4,opt,name=period,proto3" json:"period,omitempty"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
XXX_unrecognized
[]
byte
`json:"-"`
XXX_sizecache
int32
`json:"-"`
}
func
(
m
*
CollateralizeConfig
)
Reset
()
{
*
m
=
CollateralizeConfig
{}
}
func
(
m
*
CollateralizeConfig
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
CollateralizeConfig
)
ProtoMessage
()
{}
func
(
*
CollateralizeConfig
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_a988fb4a61381972
,
[]
int
{
5
}
}
func
(
m
*
CollateralizeConfig
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_CollateralizeConfig
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
CollateralizeConfig
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_CollateralizeConfig
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
CollateralizeConfig
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_CollateralizeConfig
.
Merge
(
m
,
src
)
}
func
(
m
*
CollateralizeConfig
)
XXX_Size
()
int
{
return
xxx_messageInfo_CollateralizeConfig
.
Size
(
m
)
}
func
(
m
*
CollateralizeConfig
)
XXX_DiscardUnknown
()
{
xxx_messageInfo_CollateralizeConfig
.
DiscardUnknown
(
m
)
}
var
xxx_messageInfo_CollateralizeConfig
proto
.
InternalMessageInfo
func
(
m
*
CollateralizeConfig
)
GetDebtCeiling
()
int64
{
if
m
!=
nil
{
if
m
!=
nil
{
return
m
.
DebtCeiling
return
m
.
DebtCeiling
}
}
return
0
return
0
}
}
func
(
m
*
Collateralize
Config
)
GetLiquidationRatio
()
float32
{
func
(
m
*
Collateralize
Manage
)
GetLiquidationRatio
()
float32
{
if
m
!=
nil
{
if
m
!=
nil
{
return
m
.
LiquidationRatio
return
m
.
LiquidationRatio
}
}
return
0
return
0
}
}
func
(
m
*
Collateralize
Config
)
GetStabilityFeeRatio
()
float32
{
func
(
m
*
Collateralize
Manage
)
GetStabilityFeeRatio
()
float32
{
if
m
!=
nil
{
if
m
!=
nil
{
return
m
.
StabilityFeeRatio
return
m
.
StabilityFeeRatio
}
}
return
0
return
0
}
}
func
(
m
*
Collateralize
Config
)
GetPeriod
()
int64
{
func
(
m
*
Collateralize
Manage
)
GetPeriod
()
int64
{
if
m
!=
nil
{
if
m
!=
nil
{
return
m
.
Period
return
m
.
Period
}
}
...
@@ -625,7 +578,7 @@ func (m *CollateralizeAddr) Reset() { *m = CollateralizeAddr{} }
...
@@ -625,7 +578,7 @@ func (m *CollateralizeAddr) Reset() { *m = CollateralizeAddr{} }
func
(
m
*
CollateralizeAddr
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
m
*
CollateralizeAddr
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
CollateralizeAddr
)
ProtoMessage
()
{}
func
(
*
CollateralizeAddr
)
ProtoMessage
()
{}
func
(
*
CollateralizeAddr
)
Descriptor
()
([]
byte
,
[]
int
)
{
func
(
*
CollateralizeAddr
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_a988fb4a61381972
,
[]
int
{
6
}
return
fileDescriptor_a988fb4a61381972
,
[]
int
{
5
}
}
}
func
(
m
*
CollateralizeAddr
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
func
(
m
*
CollateralizeAddr
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
...
@@ -665,7 +618,7 @@ func (m *CollateralizeCreate) Reset() { *m = CollateralizeCreate{} }
...
@@ -665,7 +618,7 @@ func (m *CollateralizeCreate) Reset() { *m = CollateralizeCreate{} }
func
(
m
*
CollateralizeCreate
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
m
*
CollateralizeCreate
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
CollateralizeCreate
)
ProtoMessage
()
{}
func
(
*
CollateralizeCreate
)
ProtoMessage
()
{}
func
(
*
CollateralizeCreate
)
Descriptor
()
([]
byte
,
[]
int
)
{
func
(
*
CollateralizeCreate
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_a988fb4a61381972
,
[]
int
{
7
}
return
fileDescriptor_a988fb4a61381972
,
[]
int
{
6
}
}
}
func
(
m
*
CollateralizeCreate
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
func
(
m
*
CollateralizeCreate
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
...
@@ -706,7 +659,7 @@ func (m *CollateralizeBorrow) Reset() { *m = CollateralizeBorrow{} }
...
@@ -706,7 +659,7 @@ func (m *CollateralizeBorrow) Reset() { *m = CollateralizeBorrow{} }
func
(
m
*
CollateralizeBorrow
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
m
*
CollateralizeBorrow
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
CollateralizeBorrow
)
ProtoMessage
()
{}
func
(
*
CollateralizeBorrow
)
ProtoMessage
()
{}
func
(
*
CollateralizeBorrow
)
Descriptor
()
([]
byte
,
[]
int
)
{
func
(
*
CollateralizeBorrow
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_a988fb4a61381972
,
[]
int
{
8
}
return
fileDescriptor_a988fb4a61381972
,
[]
int
{
7
}
}
}
func
(
m
*
CollateralizeBorrow
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
func
(
m
*
CollateralizeBorrow
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
...
@@ -754,7 +707,7 @@ func (m *CollateralizeRepay) Reset() { *m = CollateralizeRepay{} }
...
@@ -754,7 +707,7 @@ func (m *CollateralizeRepay) Reset() { *m = CollateralizeRepay{} }
func
(
m
*
CollateralizeRepay
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
m
*
CollateralizeRepay
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
CollateralizeRepay
)
ProtoMessage
()
{}
func
(
*
CollateralizeRepay
)
ProtoMessage
()
{}
func
(
*
CollateralizeRepay
)
Descriptor
()
([]
byte
,
[]
int
)
{
func
(
*
CollateralizeRepay
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_a988fb4a61381972
,
[]
int
{
9
}
return
fileDescriptor_a988fb4a61381972
,
[]
int
{
8
}
}
}
func
(
m
*
CollateralizeRepay
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
func
(
m
*
CollateralizeRepay
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
...
@@ -802,7 +755,7 @@ func (m *CollateralizeAppend) Reset() { *m = CollateralizeAppend{} }
...
@@ -802,7 +755,7 @@ func (m *CollateralizeAppend) Reset() { *m = CollateralizeAppend{} }
func
(
m
*
CollateralizeAppend
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
m
*
CollateralizeAppend
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
CollateralizeAppend
)
ProtoMessage
()
{}
func
(
*
CollateralizeAppend
)
ProtoMessage
()
{}
func
(
*
CollateralizeAppend
)
Descriptor
()
([]
byte
,
[]
int
)
{
func
(
*
CollateralizeAppend
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_a988fb4a61381972
,
[]
int
{
10
}
return
fileDescriptor_a988fb4a61381972
,
[]
int
{
9
}
}
}
func
(
m
*
CollateralizeAppend
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
func
(
m
*
CollateralizeAppend
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
...
@@ -851,7 +804,7 @@ func (m *CollateralizeFeed) Reset() { *m = CollateralizeFeed{} }
...
@@ -851,7 +804,7 @@ func (m *CollateralizeFeed) Reset() { *m = CollateralizeFeed{} }
func
(
m
*
CollateralizeFeed
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
m
*
CollateralizeFeed
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
CollateralizeFeed
)
ProtoMessage
()
{}
func
(
*
CollateralizeFeed
)
ProtoMessage
()
{}
func
(
*
CollateralizeFeed
)
Descriptor
()
([]
byte
,
[]
int
)
{
func
(
*
CollateralizeFeed
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_a988fb4a61381972
,
[]
int
{
1
1
}
return
fileDescriptor_a988fb4a61381972
,
[]
int
{
1
0
}
}
}
func
(
m
*
CollateralizeFeed
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
func
(
m
*
CollateralizeFeed
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
...
@@ -905,7 +858,7 @@ func (m *CollateralizeClose) Reset() { *m = CollateralizeClose{} }
...
@@ -905,7 +858,7 @@ func (m *CollateralizeClose) Reset() { *m = CollateralizeClose{} }
func
(
m
*
CollateralizeClose
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
m
*
CollateralizeClose
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
CollateralizeClose
)
ProtoMessage
()
{}
func
(
*
CollateralizeClose
)
ProtoMessage
()
{}
func
(
*
CollateralizeClose
)
Descriptor
()
([]
byte
,
[]
int
)
{
func
(
*
CollateralizeClose
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_a988fb4a61381972
,
[]
int
{
1
2
}
return
fileDescriptor_a988fb4a61381972
,
[]
int
{
1
1
}
}
}
func
(
m
*
CollateralizeClose
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
func
(
m
*
CollateralizeClose
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
...
@@ -951,7 +904,7 @@ func (m *ReceiptCollateralize) Reset() { *m = ReceiptCollateralize{} }
...
@@ -951,7 +904,7 @@ func (m *ReceiptCollateralize) Reset() { *m = ReceiptCollateralize{} }
func
(
m
*
ReceiptCollateralize
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
m
*
ReceiptCollateralize
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
ReceiptCollateralize
)
ProtoMessage
()
{}
func
(
*
ReceiptCollateralize
)
ProtoMessage
()
{}
func
(
*
ReceiptCollateralize
)
Descriptor
()
([]
byte
,
[]
int
)
{
func
(
*
ReceiptCollateralize
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_a988fb4a61381972
,
[]
int
{
1
3
}
return
fileDescriptor_a988fb4a61381972
,
[]
int
{
1
2
}
}
}
func
(
m
*
ReceiptCollateralize
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
func
(
m
*
ReceiptCollateralize
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
...
@@ -1035,7 +988,7 @@ func (m *CollateralizeRecord) Reset() { *m = CollateralizeRecord{} }
...
@@ -1035,7 +988,7 @@ func (m *CollateralizeRecord) Reset() { *m = CollateralizeRecord{} }
func
(
m
*
CollateralizeRecord
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
m
*
CollateralizeRecord
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
CollateralizeRecord
)
ProtoMessage
()
{}
func
(
*
CollateralizeRecord
)
ProtoMessage
()
{}
func
(
*
CollateralizeRecord
)
Descriptor
()
([]
byte
,
[]
int
)
{
func
(
*
CollateralizeRecord
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_a988fb4a61381972
,
[]
int
{
1
4
}
return
fileDescriptor_a988fb4a61381972
,
[]
int
{
1
3
}
}
}
func
(
m
*
CollateralizeRecord
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
func
(
m
*
CollateralizeRecord
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
...
@@ -1089,7 +1042,7 @@ func (m *CollateralizeRecords) Reset() { *m = CollateralizeRecords{} }
...
@@ -1089,7 +1042,7 @@ func (m *CollateralizeRecords) Reset() { *m = CollateralizeRecords{} }
func
(
m
*
CollateralizeRecords
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
m
*
CollateralizeRecords
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
CollateralizeRecords
)
ProtoMessage
()
{}
func
(
*
CollateralizeRecords
)
ProtoMessage
()
{}
func
(
*
CollateralizeRecords
)
Descriptor
()
([]
byte
,
[]
int
)
{
func
(
*
CollateralizeRecords
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_a988fb4a61381972
,
[]
int
{
1
5
}
return
fileDescriptor_a988fb4a61381972
,
[]
int
{
1
4
}
}
}
func
(
m
*
CollateralizeRecords
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
func
(
m
*
CollateralizeRecords
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
...
@@ -1129,7 +1082,7 @@ func (m *ReqCollateralizeInfo) Reset() { *m = ReqCollateralizeInfo{} }
...
@@ -1129,7 +1082,7 @@ func (m *ReqCollateralizeInfo) Reset() { *m = ReqCollateralizeInfo{} }
func
(
m
*
ReqCollateralizeInfo
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
m
*
ReqCollateralizeInfo
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
ReqCollateralizeInfo
)
ProtoMessage
()
{}
func
(
*
ReqCollateralizeInfo
)
ProtoMessage
()
{}
func
(
*
ReqCollateralizeInfo
)
Descriptor
()
([]
byte
,
[]
int
)
{
func
(
*
ReqCollateralizeInfo
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_a988fb4a61381972
,
[]
int
{
1
6
}
return
fileDescriptor_a988fb4a61381972
,
[]
int
{
1
5
}
}
}
func
(
m
*
ReqCollateralizeInfo
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
func
(
m
*
ReqCollateralizeInfo
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
...
@@ -1164,9 +1117,8 @@ type RepCollateralizeCurrentInfo struct {
...
@@ -1164,9 +1117,8 @@ type RepCollateralizeCurrentInfo struct {
DebtCeiling
int64
`protobuf:"varint,3,opt,name=debtCeiling,proto3" json:"debtCeiling,omitempty"`
DebtCeiling
int64
`protobuf:"varint,3,opt,name=debtCeiling,proto3" json:"debtCeiling,omitempty"`
LiquidationRatio
float32
`protobuf:"fixed32,4,opt,name=liquidationRatio,proto3" json:"liquidationRatio,omitempty"`
LiquidationRatio
float32
`protobuf:"fixed32,4,opt,name=liquidationRatio,proto3" json:"liquidationRatio,omitempty"`
StabilityFeeRatio
float32
`protobuf:"fixed32,5,opt,name=stabilityFeeRatio,proto3" json:"stabilityFeeRatio,omitempty"`
StabilityFeeRatio
float32
`protobuf:"fixed32,5,opt,name=stabilityFeeRatio,proto3" json:"stabilityFeeRatio,omitempty"`
LiquidationPenalty
int64
`protobuf:"varint,6,opt,name=liquidationPenalty,proto3" json:"liquidationPenalty,omitempty"`
CreateAddr
string
`protobuf:"bytes,6,opt,name=createAddr,proto3" json:"createAddr,omitempty"`
CreateAddr
string
`protobuf:"bytes,7,opt,name=createAddr,proto3" json:"createAddr,omitempty"`
Balance
int64
`protobuf:"varint,7,opt,name=balance,proto3" json:"balance,omitempty"`
Balance
int64
`protobuf:"varint,8,opt,name=balance,proto3" json:"balance,omitempty"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
XXX_unrecognized
[]
byte
`json:"-"`
XXX_unrecognized
[]
byte
`json:"-"`
XXX_sizecache
int32
`json:"-"`
XXX_sizecache
int32
`json:"-"`
...
@@ -1176,7 +1128,7 @@ func (m *RepCollateralizeCurrentInfo) Reset() { *m = RepCollateralizeCur
...
@@ -1176,7 +1128,7 @@ func (m *RepCollateralizeCurrentInfo) Reset() { *m = RepCollateralizeCur
func
(
m
*
RepCollateralizeCurrentInfo
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
m
*
RepCollateralizeCurrentInfo
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
RepCollateralizeCurrentInfo
)
ProtoMessage
()
{}
func
(
*
RepCollateralizeCurrentInfo
)
ProtoMessage
()
{}
func
(
*
RepCollateralizeCurrentInfo
)
Descriptor
()
([]
byte
,
[]
int
)
{
func
(
*
RepCollateralizeCurrentInfo
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_a988fb4a61381972
,
[]
int
{
1
7
}
return
fileDescriptor_a988fb4a61381972
,
[]
int
{
1
6
}
}
}
func
(
m
*
RepCollateralizeCurrentInfo
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
func
(
m
*
RepCollateralizeCurrentInfo
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
...
@@ -1232,13 +1184,6 @@ func (m *RepCollateralizeCurrentInfo) GetStabilityFeeRatio() float32 {
...
@@ -1232,13 +1184,6 @@ func (m *RepCollateralizeCurrentInfo) GetStabilityFeeRatio() float32 {
return
0
return
0
}
}
func
(
m
*
RepCollateralizeCurrentInfo
)
GetLiquidationPenalty
()
int64
{
if
m
!=
nil
{
return
m
.
LiquidationPenalty
}
return
0
}
func
(
m
*
RepCollateralizeCurrentInfo
)
GetCreateAddr
()
string
{
func
(
m
*
RepCollateralizeCurrentInfo
)
GetCreateAddr
()
string
{
if
m
!=
nil
{
if
m
!=
nil
{
return
m
.
CreateAddr
return
m
.
CreateAddr
...
@@ -1265,7 +1210,7 @@ func (m *ReqCollateralizeInfos) Reset() { *m = ReqCollateralizeInfos{} }
...
@@ -1265,7 +1210,7 @@ func (m *ReqCollateralizeInfos) Reset() { *m = ReqCollateralizeInfos{} }
func
(
m
*
ReqCollateralizeInfos
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
m
*
ReqCollateralizeInfos
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
ReqCollateralizeInfos
)
ProtoMessage
()
{}
func
(
*
ReqCollateralizeInfos
)
ProtoMessage
()
{}
func
(
*
ReqCollateralizeInfos
)
Descriptor
()
([]
byte
,
[]
int
)
{
func
(
*
ReqCollateralizeInfos
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_a988fb4a61381972
,
[]
int
{
1
8
}
return
fileDescriptor_a988fb4a61381972
,
[]
int
{
1
7
}
}
}
func
(
m
*
ReqCollateralizeInfos
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
func
(
m
*
ReqCollateralizeInfos
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
...
@@ -1305,7 +1250,7 @@ func (m *RepCollateralizeCurrentInfos) Reset() { *m = RepCollateralizeCu
...
@@ -1305,7 +1250,7 @@ func (m *RepCollateralizeCurrentInfos) Reset() { *m = RepCollateralizeCu
func
(
m
*
RepCollateralizeCurrentInfos
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
m
*
RepCollateralizeCurrentInfos
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
RepCollateralizeCurrentInfos
)
ProtoMessage
()
{}
func
(
*
RepCollateralizeCurrentInfos
)
ProtoMessage
()
{}
func
(
*
RepCollateralizeCurrentInfos
)
Descriptor
()
([]
byte
,
[]
int
)
{
func
(
*
RepCollateralizeCurrentInfos
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_a988fb4a61381972
,
[]
int
{
1
9
}
return
fileDescriptor_a988fb4a61381972
,
[]
int
{
1
8
}
}
}
func
(
m
*
RepCollateralizeCurrentInfos
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
func
(
m
*
RepCollateralizeCurrentInfos
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
...
@@ -1345,7 +1290,7 @@ func (m *ReqCollateralizeByStatus) Reset() { *m = ReqCollateralizeByStat
...
@@ -1345,7 +1290,7 @@ func (m *ReqCollateralizeByStatus) Reset() { *m = ReqCollateralizeByStat
func
(
m
*
ReqCollateralizeByStatus
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
m
*
ReqCollateralizeByStatus
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
ReqCollateralizeByStatus
)
ProtoMessage
()
{}
func
(
*
ReqCollateralizeByStatus
)
ProtoMessage
()
{}
func
(
*
ReqCollateralizeByStatus
)
Descriptor
()
([]
byte
,
[]
int
)
{
func
(
*
ReqCollateralizeByStatus
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_a988fb4a61381972
,
[]
int
{
20
}
return
fileDescriptor_a988fb4a61381972
,
[]
int
{
19
}
}
}
func
(
m
*
ReqCollateralizeByStatus
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
func
(
m
*
ReqCollateralizeByStatus
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
...
@@ -1385,7 +1330,7 @@ func (m *ReqCollateralizeByAddr) Reset() { *m = ReqCollateralizeByAddr{}
...
@@ -1385,7 +1330,7 @@ func (m *ReqCollateralizeByAddr) Reset() { *m = ReqCollateralizeByAddr{}
func
(
m
*
ReqCollateralizeByAddr
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
m
*
ReqCollateralizeByAddr
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
ReqCollateralizeByAddr
)
ProtoMessage
()
{}
func
(
*
ReqCollateralizeByAddr
)
ProtoMessage
()
{}
func
(
*
ReqCollateralizeByAddr
)
Descriptor
()
([]
byte
,
[]
int
)
{
func
(
*
ReqCollateralizeByAddr
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_a988fb4a61381972
,
[]
int
{
2
1
}
return
fileDescriptor_a988fb4a61381972
,
[]
int
{
2
0
}
}
}
func
(
m
*
ReqCollateralizeByAddr
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
func
(
m
*
ReqCollateralizeByAddr
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
...
@@ -1425,7 +1370,7 @@ func (m *RepCollateralizeIDs) Reset() { *m = RepCollateralizeIDs{} }
...
@@ -1425,7 +1370,7 @@ func (m *RepCollateralizeIDs) Reset() { *m = RepCollateralizeIDs{} }
func
(
m
*
RepCollateralizeIDs
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
m
*
RepCollateralizeIDs
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
RepCollateralizeIDs
)
ProtoMessage
()
{}
func
(
*
RepCollateralizeIDs
)
ProtoMessage
()
{}
func
(
*
RepCollateralizeIDs
)
Descriptor
()
([]
byte
,
[]
int
)
{
func
(
*
RepCollateralizeIDs
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_a988fb4a61381972
,
[]
int
{
2
2
}
return
fileDescriptor_a988fb4a61381972
,
[]
int
{
2
1
}
}
}
func
(
m
*
RepCollateralizeIDs
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
func
(
m
*
RepCollateralizeIDs
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
...
@@ -1466,7 +1411,7 @@ func (m *ReqCollateralizeBorrowInfoByAddr) Reset() { *m = ReqCollaterali
...
@@ -1466,7 +1411,7 @@ func (m *ReqCollateralizeBorrowInfoByAddr) Reset() { *m = ReqCollaterali
func
(
m
*
ReqCollateralizeBorrowInfoByAddr
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
m
*
ReqCollateralizeBorrowInfoByAddr
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
ReqCollateralizeBorrowInfoByAddr
)
ProtoMessage
()
{}
func
(
*
ReqCollateralizeBorrowInfoByAddr
)
ProtoMessage
()
{}
func
(
*
ReqCollateralizeBorrowInfoByAddr
)
Descriptor
()
([]
byte
,
[]
int
)
{
func
(
*
ReqCollateralizeBorrowInfoByAddr
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_a988fb4a61381972
,
[]
int
{
2
3
}
return
fileDescriptor_a988fb4a61381972
,
[]
int
{
2
2
}
}
}
func
(
m
*
ReqCollateralizeBorrowInfoByAddr
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
func
(
m
*
ReqCollateralizeBorrowInfoByAddr
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
...
@@ -1514,7 +1459,7 @@ func (m *ReqCollateralizeBorrowInfoByStatus) Reset() { *m = ReqCollatera
...
@@ -1514,7 +1459,7 @@ func (m *ReqCollateralizeBorrowInfoByStatus) Reset() { *m = ReqCollatera
func
(
m
*
ReqCollateralizeBorrowInfoByStatus
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
m
*
ReqCollateralizeBorrowInfoByStatus
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
ReqCollateralizeBorrowInfoByStatus
)
ProtoMessage
()
{}
func
(
*
ReqCollateralizeBorrowInfoByStatus
)
ProtoMessage
()
{}
func
(
*
ReqCollateralizeBorrowInfoByStatus
)
Descriptor
()
([]
byte
,
[]
int
)
{
func
(
*
ReqCollateralizeBorrowInfoByStatus
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_a988fb4a61381972
,
[]
int
{
2
4
}
return
fileDescriptor_a988fb4a61381972
,
[]
int
{
2
3
}
}
}
func
(
m
*
ReqCollateralizeBorrowInfoByStatus
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
func
(
m
*
ReqCollateralizeBorrowInfoByStatus
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
...
@@ -1561,7 +1506,7 @@ func (m *RepCollateralizeBorrowInfos) Reset() { *m = RepCollateralizeBor
...
@@ -1561,7 +1506,7 @@ func (m *RepCollateralizeBorrowInfos) Reset() { *m = RepCollateralizeBor
func
(
m
*
RepCollateralizeBorrowInfos
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
m
*
RepCollateralizeBorrowInfos
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
RepCollateralizeBorrowInfos
)
ProtoMessage
()
{}
func
(
*
RepCollateralizeBorrowInfos
)
ProtoMessage
()
{}
func
(
*
RepCollateralizeBorrowInfos
)
Descriptor
()
([]
byte
,
[]
int
)
{
func
(
*
RepCollateralizeBorrowInfos
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_a988fb4a61381972
,
[]
int
{
2
5
}
return
fileDescriptor_a988fb4a61381972
,
[]
int
{
2
4
}
}
}
func
(
m
*
RepCollateralizeBorrowInfos
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
func
(
m
*
RepCollateralizeBorrowInfos
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
...
@@ -1595,7 +1540,6 @@ func init() {
...
@@ -1595,7 +1540,6 @@ func init() {
proto
.
RegisterType
((
*
AssetPriceRecord
)(
nil
),
"types.AssetPriceRecord"
)
proto
.
RegisterType
((
*
AssetPriceRecord
)(
nil
),
"types.AssetPriceRecord"
)
proto
.
RegisterType
((
*
CollateralizeAction
)(
nil
),
"types.CollateralizeAction"
)
proto
.
RegisterType
((
*
CollateralizeAction
)(
nil
),
"types.CollateralizeAction"
)
proto
.
RegisterType
((
*
CollateralizeManage
)(
nil
),
"types.CollateralizeManage"
)
proto
.
RegisterType
((
*
CollateralizeManage
)(
nil
),
"types.CollateralizeManage"
)
proto
.
RegisterType
((
*
CollateralizeConfig
)(
nil
),
"types.CollateralizeConfig"
)
proto
.
RegisterType
((
*
CollateralizeAddr
)(
nil
),
"types.CollateralizeAddr"
)
proto
.
RegisterType
((
*
CollateralizeAddr
)(
nil
),
"types.CollateralizeAddr"
)
proto
.
RegisterType
((
*
CollateralizeCreate
)(
nil
),
"types.CollateralizeCreate"
)
proto
.
RegisterType
((
*
CollateralizeCreate
)(
nil
),
"types.CollateralizeCreate"
)
proto
.
RegisterType
((
*
CollateralizeBorrow
)(
nil
),
"types.CollateralizeBorrow"
)
proto
.
RegisterType
((
*
CollateralizeBorrow
)(
nil
),
"types.CollateralizeBorrow"
)
...
@@ -1621,76 +1565,72 @@ func init() {
...
@@ -1621,76 +1565,72 @@ func init() {
func
init
()
{
proto
.
RegisterFile
(
"collateralize.proto"
,
fileDescriptor_a988fb4a61381972
)
}
func
init
()
{
proto
.
RegisterFile
(
"collateralize.proto"
,
fileDescriptor_a988fb4a61381972
)
}
var
fileDescriptor_a988fb4a61381972
=
[]
byte
{
var
fileDescriptor_a988fb4a61381972
=
[]
byte
{
// 1125 bytes of a gzipped FileDescriptorProto
// 1064 bytes of a gzipped FileDescriptorProto
0x1f
,
0x8b
,
0x08
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x02
,
0xff
,
0xcc
,
0x57
,
0xef
,
0x6e
,
0xe3
,
0x44
,
0x1f
,
0x8b
,
0x08
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x02
,
0xff
,
0xdc
,
0x57
,
0xdd
,
0x6e
,
0xe3
,
0x44
,
0x10
,
0x3f
,
0xdb
,
0xf9
,
0xd3
,
0x4c
,
0xae
,
0xa5
,
0xb7
,
0x2d
,
0x95
,
0x29
,
0xd5
,
0x29
,
0x5a
,
0x21
,
0x14
,
0x5e
,
0xdb
,
0x49
,
0xda
,
0x9e
,
0xb4
,
0xa5
,
0x3b
,
0x2d
,
0x95
,
0x29
,
0xab
,
0x2a
,
0x1a
,
0x21
,
0x11
,
0x41
,
0x55
,
0x89
,
0xde
,
0x09
,
0x71
,
0x42
,
0x42
,
0xb4
,
0x39
,
0x4e
,
0x17
,
0x74
,
0x48
,
0xc8
,
0x11
,
0xc1
,
0xaa
,
0x12
,
0xd9
,
0x15
,
0x62
,
0x85
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0
,
0xbf
,
0xda
,
0xc0
,
0x5b
,
0xf5
,
0x99
,
0x60
,
0x18
,
0x70
,
0x0a
,
0x0e
,
0x00
,
0x00
,
0x1c
,
0x9f
,
0x02
,
0xdf
,
0x64
,
0x41
,
0x87
,
0xbd
,
0xbd
,
0x8d
,
0x32
,
0x41
,
0x76
,
0x2d
,
0x41
,
0x5f
,
0x37
,
0x9b
,
0xa6
,
0xb4
,
0x53
,
0xb0
,
0x8f
,
0xa1
,
0xa3
,
0x3a
,
0x54
,
0x97
,
0x6b
,
0xe5
,
0x4f
,
0x21
,
0x0d
,
0x99
,
0x74
,
0xe8
,
0xe7
,
0xe9
,
0x93
,
0x7f
,
0x03
,
0x00
,
0x00
,
0xff
,
0xff
,
0x90
,
0x50
,
0xc3
,
0x44
,
0xb5
,
0x0e
,
0x00
,
0x00
,
}
}
plugin/dapp/collateralize/types/tx.go
View file @
550958aa
...
@@ -50,6 +50,5 @@ type CollateralizeManageTx struct {
...
@@ -50,6 +50,5 @@ type CollateralizeManageTx struct {
LiquidationRatio
float32
`json:"liquidationRatio"`
LiquidationRatio
float32
`json:"liquidationRatio"`
StabilityFeeRatio
float32
`json:"stabilityFeeRatio"`
StabilityFeeRatio
float32
`json:"stabilityFeeRatio"`
Period
int64
`json:"period"`
Period
int64
`json:"period"`
Addr
[]
string
`json:"addr"`
Fee
int64
`json:"fee"`
Fee
int64
`json:"fee"`
}
}
plugin/dapp/issuance/cmd/Makefile
0 → 100644
View file @
550958aa
all
:
chmod
+x ./build.sh
./build.sh
$(OUT)
$(FLAG)
\ No newline at end of file
plugin/dapp/issuance/cmd/build.sh
0 → 100644
View file @
550958aa
#!/bin/sh
strpwd
=
$(
pwd
)
strcmd
=
${
strpwd
##*dapp/
}
strapp
=
${
strcmd
%/cmd*
}
OUT_DIR
=
"
${
1
}
/
$strapp
"
#FLAG=$2
mkdir
-p
"
${
OUT_DIR
}
"
cp
./build/
*
"
${
OUT_DIR
}
"
OUT_TESTDIR
=
"
${
1
}
/dapptest/
$strapp
"
mkdir
-p
"
${
OUT_TESTDIR
}
"
cp
./build/test-rpc.sh
"
${
OUT_TESTDIR
}
"
plugin/dapp/issuance/commands/cmd.go
0 → 100644
View file @
550958aa
package
commands
import
(
"fmt"
"github.com/spf13/cobra"
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"
"strconv"
)
// IssuanceCmd 斗牛游戏命令行
func
IssuanceCmd
()
*
cobra
.
Command
{
cmd
:=
&
cobra
.
Command
{
Use
:
"issuance"
,
Short
:
"Issuance command"
,
Args
:
cobra
.
MinimumNArgs
(
1
),
}
cmd
.
AddCommand
(
IssuanceCreateRawTxCmd
(),
IssuanceDebtRawTxCmd
(),
IssuanceRepayRawTxCmd
(),
IssuancePriceFeedRawTxCmd
(),
IssuanceCloseRawTxCmd
(),
IssuanceManageRawTxCmd
(),
IssuanceQueryCmd
(),
)
return
cmd
}
// IssuanceCreateRawTxCmd 生成开始交易命令行
func
IssuanceCreateRawTxCmd
()
*
cobra
.
Command
{
cmd
:=
&
cobra
.
Command
{
Use
:
"create"
,
Short
:
"Create a issuance"
,
Run
:
IssuanceCreate
,
}
addIssuanceCreateFlags
(
cmd
)
return
cmd
}
func
addIssuanceCreateFlags
(
cmd
*
cobra
.
Command
)
{
cmd
.
Flags
()
.
Uint64P
(
"balance"
,
"b"
,
0
,
"balance"
)
cmd
.
Flags
()
.
Uint64P
(
"debtCeiling"
,
"d"
,
0
,
"debtCeiling"
)
cmd
.
Flags
()
.
Float32P
(
"liquidationRatio"
,
"l"
,
0
,
"liquidationRatio"
)
cmd
.
Flags
()
.
Uint64P
(
"period"
,
"p"
,
0
,
"period"
)
}
func
IssuanceCreate
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
rpcLaddr
,
_
:=
cmd
.
Flags
()
.
GetString
(
"rpc_laddr"
)
balance
,
_
:=
cmd
.
Flags
()
.
GetUint64
(
"balance"
)
debtCeiling
,
_
:=
cmd
.
Flags
()
.
GetUint64
(
"debtCeiling"
)
liquidationRatio
,
_
:=
cmd
.
Flags
()
.
GetFloat32
(
"liquidationRatio"
)
period
,
_
:=
cmd
.
Flags
()
.
GetUint64
(
"period"
)
params
:=
&
rpctypes
.
CreateTxIn
{
Execer
:
types
.
ExecName
(
pkt
.
IssuanceX
),
ActionName
:
"IssuanceCreate"
,
Payload
:
[]
byte
(
fmt
.
Sprintf
(
"{
\"
balance
\"
:%d,
\"
debtCeiling
\"
:%d,
\"
liquidationRatio
\"
:%f,
\"
period
\"
:%d,}"
,
balance
,
debtCeiling
,
liquidationRatio
,
period
)),
}
var
res
string
ctx
:=
jsonrpc
.
NewRPCCtx
(
rpcLaddr
,
"Chain33.CreateTransaction"
,
params
,
&
res
)
ctx
.
RunWithoutMarshal
()
}
// IssuanceDebtRawTxCmd 生成开始交易命令行
func
IssuanceDebtRawTxCmd
()
*
cobra
.
Command
{
cmd
:=
&
cobra
.
Command
{
Use
:
"debt"
,
Short
:
"Debt a issuance"
,
Run
:
IssuanceDebt
,
}
addIssuanceDebtFlags
(
cmd
)
return
cmd
}
func
addIssuanceDebtFlags
(
cmd
*
cobra
.
Command
)
{
cmd
.
Flags
()
.
StringP
(
"issuanceID"
,
"g"
,
""
,
"issuance ID"
)
cmd
.
MarkFlagRequired
(
"issuanceID"
)
cmd
.
Flags
()
.
Uint64P
(
"value"
,
"v"
,
0
,
"value"
)
cmd
.
MarkFlagRequired
(
"value"
)
}
func
IssuanceDebt
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
rpcLaddr
,
_
:=
cmd
.
Flags
()
.
GetString
(
"rpc_laddr"
)
issuanceID
,
_
:=
cmd
.
Flags
()
.
GetString
(
"issuanceID"
)
value
,
_
:=
cmd
.
Flags
()
.
GetUint64
(
"value"
)
params
:=
&
rpctypes
.
CreateTxIn
{
Execer
:
types
.
ExecName
(
pkt
.
IssuanceX
),
ActionName
:
"IssuanceDebt"
,
Payload
:
[]
byte
(
fmt
.
Sprintf
(
"{
\"
issuanceID
\"
:%s,
\"
value
\"
:%d}"
,
issuanceID
,
value
)),
}
var
res
string
ctx
:=
jsonrpc
.
NewRPCCtx
(
rpcLaddr
,
"Chain33.CreateTransaction"
,
params
,
&
res
)
ctx
.
RunWithoutMarshal
()
}
// IssuanceRepayRawTxCmd 生成开始交易命令行
func
IssuanceRepayRawTxCmd
()
*
cobra
.
Command
{
cmd
:=
&
cobra
.
Command
{
Use
:
"repay"
,
Short
:
"Repay a issuance"
,
Run
:
IssuanceRepay
,
}
addIssuanceRepayFlags
(
cmd
)
return
cmd
}
func
addIssuanceRepayFlags
(
cmd
*
cobra
.
Command
)
{
cmd
.
Flags
()
.
StringP
(
"issuanceID"
,
"g"
,
""
,
"issuance ID"
)
cmd
.
MarkFlagRequired
(
"issuanceID"
)
}
func
IssuanceRepay
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
rpcLaddr
,
_
:=
cmd
.
Flags
()
.
GetString
(
"rpc_laddr"
)
issuanceID
,
_
:=
cmd
.
Flags
()
.
GetString
(
"issuanceID"
)
params
:=
&
rpctypes
.
CreateTxIn
{
Execer
:
types
.
ExecName
(
pkt
.
IssuanceX
),
ActionName
:
"IssuanceRepay"
,
Payload
:
[]
byte
(
fmt
.
Sprintf
(
"{
\"
issuanceID
\"
:%s}"
,
issuanceID
)),
}
var
res
string
ctx
:=
jsonrpc
.
NewRPCCtx
(
rpcLaddr
,
"Chain33.CreateTransaction"
,
params
,
&
res
)
ctx
.
RunWithoutMarshal
()
}
// IssuancePriceFeedRawTxCmd 生成开始交易命令行
func
IssuancePriceFeedRawTxCmd
()
*
cobra
.
Command
{
cmd
:=
&
cobra
.
Command
{
Use
:
"feed"
,
Short
:
"price feed"
,
Run
:
IssuancePriceFeed
,
}
addIssuancePriceFeedFlags
(
cmd
)
return
cmd
}
func
addIssuancePriceFeedFlags
(
cmd
*
cobra
.
Command
)
{
cmd
.
Flags
()
.
Float32P
(
"price"
,
"p"
,
0
,
"price"
)
cmd
.
MarkFlagRequired
(
"price"
)
cmd
.
Flags
()
.
Uint64P
(
"volume"
,
"v"
,
0
,
"volume"
)
cmd
.
MarkFlagRequired
(
"volume"
)
}
func
IssuancePriceFeed
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
rpcLaddr
,
_
:=
cmd
.
Flags
()
.
GetString
(
"rpc_laddr"
)
price
,
_
:=
cmd
.
Flags
()
.
GetFloat32
(
"price"
)
volume
,
_
:=
cmd
.
Flags
()
.
GetUint64
(
"volume"
)
params
:=
&
rpctypes
.
CreateTxIn
{
Execer
:
types
.
ExecName
(
pkt
.
IssuanceX
),
ActionName
:
"IssuancePriceFeed"
,
Payload
:
[]
byte
(
fmt
.
Sprintf
(
"{[
\"
price
\"
:%s],[
\"
volume
\"
:%d]}"
,
price
,
volume
)),
}
var
res
string
ctx
:=
jsonrpc
.
NewRPCCtx
(
rpcLaddr
,
"Chain33.CreateTransaction"
,
params
,
&
res
)
ctx
.
RunWithoutMarshal
()
}
// IssuanceCloseRawTxCmd 生成开始交易命令行
func
IssuanceCloseRawTxCmd
()
*
cobra
.
Command
{
cmd
:=
&
cobra
.
Command
{
Use
:
"close"
,
Short
:
"close a issuance"
,
Run
:
IssuanceClose
,
}
addIssuanceCloseFlags
(
cmd
)
return
cmd
}
func
addIssuanceCloseFlags
(
cmd
*
cobra
.
Command
)
{
cmd
.
Flags
()
.
StringP
(
"issuanceID"
,
"g"
,
""
,
"issuance ID"
)
cmd
.
MarkFlagRequired
(
"issuanceID"
)
}
func
IssuanceClose
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
rpcLaddr
,
_
:=
cmd
.
Flags
()
.
GetString
(
"rpc_laddr"
)
issuanceID
,
_
:=
cmd
.
Flags
()
.
GetString
(
"issuanceID"
)
params
:=
&
rpctypes
.
CreateTxIn
{
Execer
:
types
.
ExecName
(
pkt
.
IssuanceX
),
ActionName
:
"IssuanceClose"
,
Payload
:
[]
byte
(
fmt
.
Sprintf
(
"{
\"
issuanceID
\"
:%s}"
,
issuanceID
)),
}
var
res
string
ctx
:=
jsonrpc
.
NewRPCCtx
(
rpcLaddr
,
"Chain33.CreateTransaction"
,
params
,
&
res
)
ctx
.
RunWithoutMarshal
()
}
// IssuanceManageRawTxCmd 生成开始交易命令行
func
IssuanceManageRawTxCmd
()
*
cobra
.
Command
{
cmd
:=
&
cobra
.
Command
{
Use
:
"manage"
,
Short
:
"manage a issuance"
,
Run
:
IssuanceManage
,
}
addIssuanceManageFlags
(
cmd
)
return
cmd
}
func
addIssuanceManageFlags
(
cmd
*
cobra
.
Command
)
{
cmd
.
Flags
()
.
StringP
(
"addr"
,
"a"
,
""
,
"addr"
)
}
func
IssuanceManage
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
rpcLaddr
,
_
:=
cmd
.
Flags
()
.
GetString
(
"rpc_laddr"
)
addr
,
_
:=
cmd
.
Flags
()
.
GetString
(
"addr"
)
params
:=
&
rpctypes
.
CreateTxIn
{
Execer
:
types
.
ExecName
(
pkt
.
IssuanceX
),
ActionName
:
"IssuanceManage"
,
Payload
:
[]
byte
(
fmt
.
Sprintf
(
"{[
\"
addr
\"
:%s]}"
,
addr
)),
}
var
res
string
ctx
:=
jsonrpc
.
NewRPCCtx
(
rpcLaddr
,
"Chain33.CreateTransaction"
,
params
,
&
res
)
ctx
.
RunWithoutMarshal
()
}
// IssuanceQueryCmd 查询命令行
func
IssuanceQueryCmd
()
*
cobra
.
Command
{
cmd
:=
&
cobra
.
Command
{
Use
:
"query"
,
Short
:
"Query result"
,
Run
:
IssuanceQuery
,
}
addIssuanceQueryFlags
(
cmd
)
return
cmd
}
func
addIssuanceQueryFlags
(
cmd
*
cobra
.
Command
)
{
cmd
.
Flags
()
.
StringP
(
"issuanceID"
,
"g"
,
""
,
"issuance ID"
)
cmd
.
Flags
()
.
StringP
(
"address"
,
"a"
,
""
,
"address"
)
cmd
.
Flags
()
.
StringP
(
"index"
,
"i"
,
""
,
"index"
)
cmd
.
Flags
()
.
StringP
(
"status"
,
"s"
,
""
,
"status"
)
cmd
.
Flags
()
.
StringP
(
"issuanceIDs"
,
"d"
,
""
,
"issuance IDs"
)
}
func
IssuanceQuery
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
rpcLaddr
,
_
:=
cmd
.
Flags
()
.
GetString
(
"rpc_laddr"
)
issuanceID
,
_
:=
cmd
.
Flags
()
.
GetString
(
"issuanceID"
)
address
,
_
:=
cmd
.
Flags
()
.
GetString
(
"address"
)
statusStr
,
_
:=
cmd
.
Flags
()
.
GetString
(
"status"
)
// indexstr, _ := cmd.Flags().GetString("index")
issuanceIDs
,
_
:=
cmd
.
Flags
()
.
GetString
(
"issuanceIDs"
)
var
params
rpctypes
.
Query4Jrpc
params
.
Execer
=
pkt
.
IssuanceX
//if indexstr != "" {
// index, err := strconv.ParseInt(indexstr, 10, 64)
// if err != nil {
// fmt.Println(err)
// cmd.Help()
// return
// }
// req.Index = index
//}
status
,
err
:=
strconv
.
ParseInt
(
statusStr
,
10
,
32
)
if
err
!=
nil
{
fmt
.
Println
(
err
)
cmd
.
Help
()
return
}
if
issuanceID
!=
""
{
if
statusStr
!=
""
{
params
.
FuncName
=
"IssuanceDebtInfoByStatus"
req
:=
&
pkt
.
ReqIssuanceDebtInfoByStatus
{
IssuanceId
:
issuanceID
,
Status
:
int32
(
status
),
}
params
.
Payload
=
types
.
MustPBToJSON
(
req
)
var
res
pkt
.
RepIssuanceDebtInfos
ctx
:=
jsonrpc
.
NewRPCCtx
(
rpcLaddr
,
"Chain33.Query"
,
params
,
&
res
)
ctx
.
Run
()
}
else
if
address
!=
""
{
params
.
FuncName
=
"IssuanceDebtInfoByAddr"
req
:=
&
pkt
.
ReqIssuanceDebtInfoByAddr
{
IssuanceId
:
issuanceID
,
Addr
:
address
,
}
params
.
Payload
=
types
.
MustPBToJSON
(
req
)
var
res
pkt
.
RepIssuanceDebtInfos
ctx
:=
jsonrpc
.
NewRPCCtx
(
rpcLaddr
,
"Chain33.Query"
,
params
,
&
res
)
ctx
.
Run
()
}
else
{
params
.
FuncName
=
"IssuanceInfoByID"
req
:=
&
pkt
.
ReqIssuanceInfo
{
IssuanceId
:
issuanceID
,
}
params
.
Payload
=
types
.
MustPBToJSON
(
req
)
var
res
pkt
.
RepIssuanceCurrentInfo
ctx
:=
jsonrpc
.
NewRPCCtx
(
rpcLaddr
,
"Chain33.Query"
,
params
,
&
res
)
ctx
.
Run
()
}
}
else
if
address
!=
""
{
params
.
FuncName
=
"IssuanceByAddr"
req
:=
&
pkt
.
ReqIssuanceByAddr
{
Addr
:
address
}
params
.
Payload
=
types
.
MustPBToJSON
(
req
)
var
res
pkt
.
RepIssuanceIDs
ctx
:=
jsonrpc
.
NewRPCCtx
(
rpcLaddr
,
"Chain33.Query"
,
params
,
&
res
)
ctx
.
Run
()
}
else
if
statusStr
!=
""
{
params
.
FuncName
=
"IssuanceByStatus"
req
:=
&
pkt
.
ReqIssuanceByStatus
{
Status
:
int32
(
status
)}
params
.
Payload
=
types
.
MustPBToJSON
(
req
)
var
res
pkt
.
RepIssuanceIDs
ctx
:=
jsonrpc
.
NewRPCCtx
(
rpcLaddr
,
"Chain33.Query"
,
params
,
&
res
)
ctx
.
Run
()
}
else
if
issuanceIDs
!=
""
{
params
.
FuncName
=
"IssuanceInfoByIDs"
var
issuanceIDsS
[]
string
issuanceIDsS
=
append
(
issuanceIDsS
,
issuanceIDs
)
issuanceIDsS
=
append
(
issuanceIDsS
,
issuanceIDs
)
req
:=
&
pkt
.
ReqIssuanceInfos
{
IssuanceIds
:
issuanceIDsS
}
params
.
Payload
=
types
.
MustPBToJSON
(
req
)
var
res
pkt
.
RepIssuanceCurrentInfos
ctx
:=
jsonrpc
.
NewRPCCtx
(
rpcLaddr
,
"Chain33.Query"
,
params
,
&
res
)
ctx
.
Run
()
}
else
{
fmt
.
Println
(
"Error: requeres at least one of gameID, address or status"
)
cmd
.
Help
()
}
}
plugin/dapp/issuance/executor/doc.go
0 → 100644
View file @
550958aa
// Copyright Fuzamei Corp. 2018 All Rights Reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package
executor
/*
waiting for update
*/
plugin/dapp/issuance/executor/exec.go
0 → 100644
View file @
550958aa
// Copyright Fuzamei Corp. 2018 All Rights Reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package
executor
import
(
"github.com/33cn/chain33/types"
pty
"github.com/33cn/plugin/plugin/dapp/issuance/types"
)
// Exec_Create Action
func
(
c
*
Issuance
)
Exec_Create
(
payload
*
pty
.
IssuanceCreate
,
tx
*
types
.
Transaction
,
index
int
)
(
*
types
.
Receipt
,
error
)
{
actiondb
:=
NewIssuanceAction
(
c
,
tx
,
index
)
return
actiondb
.
IssuanceCreate
(
payload
)
}
// Exec_Borrow Action
func
(
c
*
Issuance
)
Exec_Borrow
(
payload
*
pty
.
IssuanceDebt
,
tx
*
types
.
Transaction
,
index
int
)
(
*
types
.
Receipt
,
error
)
{
actiondb
:=
NewIssuanceAction
(
c
,
tx
,
index
)
return
actiondb
.
IssuanceDebt
(
payload
)
}
// Exec_Repay Action
func
(
c
*
Issuance
)
Exec_Repay
(
payload
*
pty
.
IssuanceRepay
,
tx
*
types
.
Transaction
,
index
int
)
(
*
types
.
Receipt
,
error
)
{
actiondb
:=
NewIssuanceAction
(
c
,
tx
,
index
)
return
actiondb
.
IssuanceRepay
(
payload
)
}
// Exec_Feed Action
func
(
c
*
Issuance
)
Exec_Feed
(
payload
*
pty
.
IssuanceFeed
,
tx
*
types
.
Transaction
,
index
int
)
(
*
types
.
Receipt
,
error
)
{
actiondb
:=
NewIssuanceAction
(
c
,
tx
,
index
)
return
actiondb
.
IssuanceFeed
(
payload
)
}
// Exec_Close Action
func
(
c
*
Issuance
)
Exec_Close
(
payload
*
pty
.
IssuanceClose
,
tx
*
types
.
Transaction
,
index
int
)
(
*
types
.
Receipt
,
error
)
{
actiondb
:=
NewIssuanceAction
(
c
,
tx
,
index
)
return
actiondb
.
IssuanceClose
(
payload
)
}
plugin/dapp/issuance/executor/exec_del_local.go
0 → 100644
View file @
550958aa
// Copyright Fuzamei Corp. 2018 All Rights Reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package
executor
import
(
"github.com/33cn/chain33/types"
pty
"github.com/33cn/plugin/plugin/dapp/issuance/types"
)
func
(
c
*
Issuance
)
execDelLocal
(
tx
*
types
.
Transaction
,
receiptData
*
types
.
ReceiptData
)
(
*
types
.
LocalDBSet
,
error
)
{
set
:=
&
types
.
LocalDBSet
{}
for
_
,
item
:=
range
receiptData
.
Logs
{
var
IssuanceLog
pty
.
ReceiptIssuance
err
:=
types
.
Decode
(
item
.
Log
,
&
IssuanceLog
)
if
err
!=
nil
{
return
nil
,
err
}
switch
item
.
Ty
{
case
pty
.
TyLogIssuanceCreate
:
kv
:=
c
.
deleteIssuanceStatus
(
&
IssuanceLog
)
set
.
KV
=
append
(
set
.
KV
,
kv
...
)
break
case
pty
.
TyLogIssuanceDebt
:
set
.
KV
=
append
(
set
.
KV
,
c
.
deleteIssuanceRecordStatus
(
&
IssuanceLog
)
...
)
set
.
KV
=
append
(
set
.
KV
,
c
.
deleteIssuanceAddr
(
&
IssuanceLog
)
...
)
break
case
pty
.
TyLogIssuanceRepay
:
set
.
KV
=
append
(
set
.
KV
,
c
.
deleteIssuanceRecordStatus
(
&
IssuanceLog
)
...
)
set
.
KV
=
append
(
set
.
KV
,
c
.
addIssuanceAddr
(
&
IssuanceLog
)
...
)
break
case
pty
.
TyLogIssuanceFeed
:
set
.
KV
=
append
(
set
.
KV
,
c
.
deleteIssuanceRecordStatus
(
&
IssuanceLog
)
...
)
if
IssuanceLog
.
RecordStatus
==
pty
.
IssuanceUserStatusSystemLiquidate
{
set
.
KV
=
append
(
set
.
KV
,
c
.
addIssuanceAddr
(
&
IssuanceLog
)
...
)
}
break
case
pty
.
TyLogIssuanceClose
:
kv
:=
c
.
addIssuanceStatus
(
&
IssuanceLog
)
set
.
KV
=
append
(
set
.
KV
,
kv
...
)
break
}
}
return
set
,
nil
}
// ExecDelLocal_Create Action
func
(
c
*
Issuance
)
ExecDelLocal_Create
(
payload
*
pty
.
IssuanceCreate
,
tx
*
types
.
Transaction
,
receiptData
*
types
.
ReceiptData
,
index
int
)
(
*
types
.
LocalDBSet
,
error
)
{
return
c
.
execDelLocal
(
tx
,
receiptData
)
}
// ExecDelLocal_Debt Action
func
(
c
*
Issuance
)
ExecDelLocal_Debt
(
payload
*
pty
.
IssuanceDebt
,
tx
*
types
.
Transaction
,
receiptData
*
types
.
ReceiptData
,
index
int
)
(
*
types
.
LocalDBSet
,
error
)
{
return
c
.
execDelLocal
(
tx
,
receiptData
)
}
// ExecDelLocal_Repay Action
func
(
c
*
Issuance
)
ExecDelLocal_Repay
(
payload
*
pty
.
IssuanceRepay
,
tx
*
types
.
Transaction
,
receiptData
*
types
.
ReceiptData
,
index
int
)
(
*
types
.
LocalDBSet
,
error
)
{
return
c
.
execDelLocal
(
tx
,
receiptData
)
}
// ExecDelLocal_Feed Action
func
(
c
*
Issuance
)
ExecDelLocal_Feed
(
payload
*
pty
.
IssuanceFeed
,
tx
*
types
.
Transaction
,
receiptData
*
types
.
ReceiptData
,
index
int
)
(
*
types
.
LocalDBSet
,
error
)
{
return
c
.
execDelLocal
(
tx
,
receiptData
)
}
// ExecDelLocal_Close Action
func
(
c
*
Issuance
)
ExecDelLocal_Close
(
payload
*
pty
.
IssuanceClose
,
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/exec_local.go
0 → 100644
View file @
550958aa
// Copyright Fuzamei Corp. 2018 All Rights Reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package
executor
import
(
//"github.com/33cn/chain33/common"
"github.com/33cn/chain33/types"
pty
"github.com/33cn/plugin/plugin/dapp/issuance/types"
)
func
(
c
*
Issuance
)
execLocal
(
tx
*
types
.
Transaction
,
receipt
*
types
.
ReceiptData
)
(
*
types
.
LocalDBSet
,
error
)
{
set
:=
&
types
.
LocalDBSet
{}
for
_
,
item
:=
range
receipt
.
Logs
{
var
IssuanceLog
pty
.
ReceiptIssuance
err
:=
types
.
Decode
(
item
.
Log
,
&
IssuanceLog
)
if
err
!=
nil
{
return
nil
,
err
}
switch
item
.
Ty
{
case
pty
.
TyLogIssuanceCreate
:
set
.
KV
=
append
(
set
.
KV
,
c
.
addIssuanceStatus
(
&
IssuanceLog
)
...
)
break
case
pty
.
TyLogIssuanceDebt
:
set
.
KV
=
append
(
set
.
KV
,
c
.
addIssuanceRecordStatus
(
&
IssuanceLog
)
...
)
set
.
KV
=
append
(
set
.
KV
,
c
.
addIssuanceAddr
(
&
IssuanceLog
)
...
)
break
case
pty
.
TyLogIssuanceRepay
:
set
.
KV
=
append
(
set
.
KV
,
c
.
addIssuanceRecordStatus
(
&
IssuanceLog
)
...
)
set
.
KV
=
append
(
set
.
KV
,
c
.
deleteIssuanceAddr
(
&
IssuanceLog
)
...
)
break
case
pty
.
TyLogIssuanceFeed
:
set
.
KV
=
append
(
set
.
KV
,
c
.
addIssuanceRecordStatus
(
&
IssuanceLog
)
...
)
if
IssuanceLog
.
RecordStatus
==
pty
.
IssuanceUserStatusSystemLiquidate
{
set
.
KV
=
append
(
set
.
KV
,
c
.
deleteIssuanceAddr
(
&
IssuanceLog
)
...
)
}
break
case
pty
.
TyLogIssuanceClose
:
set
.
KV
=
append
(
set
.
KV
,
c
.
deleteIssuanceStatus
(
&
IssuanceLog
)
...
)
break
}
}
return
set
,
nil
}
// ExecLocal_Create Action
func
(
c
*
Issuance
)
ExecLocal_Create
(
payload
*
pty
.
IssuanceCreate
,
tx
*
types
.
Transaction
,
receiptData
*
types
.
ReceiptData
,
index
int
)
(
*
types
.
LocalDBSet
,
error
)
{
return
c
.
execLocal
(
tx
,
receiptData
)
}
// ExecLocal_Debt Action
func
(
c
*
Issuance
)
ExecLocal_Debt
(
payload
*
pty
.
IssuanceDebt
,
tx
*
types
.
Transaction
,
receiptData
*
types
.
ReceiptData
,
index
int
)
(
*
types
.
LocalDBSet
,
error
)
{
return
c
.
execLocal
(
tx
,
receiptData
)
}
// ExecLocal_Repay Action
func
(
c
*
Issuance
)
ExecLocal_Repay
(
payload
*
pty
.
IssuanceRepay
,
tx
*
types
.
Transaction
,
receiptData
*
types
.
ReceiptData
,
index
int
)
(
*
types
.
LocalDBSet
,
error
)
{
return
c
.
execLocal
(
tx
,
receiptData
)
}
// ExecLocal_Feed Action
func
(
c
*
Issuance
)
ExecLocal_Feed
(
payload
*
pty
.
IssuanceFeed
,
tx
*
types
.
Transaction
,
receiptData
*
types
.
ReceiptData
,
index
int
)
(
*
types
.
LocalDBSet
,
error
)
{
return
c
.
execLocal
(
tx
,
receiptData
)
}
// ExecLocal_Close Action
func
(
c
*
Issuance
)
ExecLocal_Close
(
payload
*
pty
.
IssuanceClose
,
tx
*
types
.
Transaction
,
receiptData
*
types
.
ReceiptData
,
index
int
)
(
*
types
.
LocalDBSet
,
error
)
{
return
c
.
execLocal
(
tx
,
receiptData
)
}
plugin/dapp/issuance/executor/issuance.go
0 → 100644
View file @
550958aa
// Copyright Fuzamei Corp. 2018 All Rights Reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package
executor
import
(
log
"github.com/33cn/chain33/common/log/log15"
drivers
"github.com/33cn/chain33/system/dapp"
"github.com/33cn/chain33/types"
pty
"github.com/33cn/plugin/plugin/dapp/issuance/types"
)
var
clog
=
log
.
New
(
"module"
,
"execs.issuance"
)
var
driverName
=
pty
.
IssuanceX
func
init
()
{
ety
:=
types
.
LoadExecutorType
(
driverName
)
ety
.
InitFuncList
(
types
.
ListMethod
(
&
Issuance
{}))
}
type
subConfig
struct
{
ParaRemoteGrpcClient
string
`json:"paraRemoteGrpcClient"`
}
var
cfg
subConfig
// Init issuance
func
Init
(
name
string
,
sub
[]
byte
)
{
driverName
:=
GetName
()
if
name
!=
driverName
{
panic
(
"system dapp can't be rename"
)
}
if
sub
!=
nil
{
types
.
MustDecode
(
sub
,
&
cfg
)
}
drivers
.
Register
(
driverName
,
newIssuance
,
types
.
GetDappFork
(
driverName
,
"Enable"
))
}
// GetName for Issuance
func
GetName
()
string
{
return
newIssuance
()
.
GetName
()
}
// Issuance driver
type
Issuance
struct
{
drivers
.
DriverBase
}
func
newIssuance
()
drivers
.
Driver
{
c
:=
&
Issuance
{}
c
.
SetChild
(
c
)
c
.
SetExecutorType
(
types
.
LoadExecutorType
(
driverName
))
return
c
}
// GetDriverName for Issuance
func
(
c
*
Issuance
)
GetDriverName
()
string
{
return
pty
.
IssuanceX
}
func
(
c
*
Issuance
)
addIssuanceID
(
issuancelog
*
pty
.
ReceiptIssuance
)
(
kvs
[]
*
types
.
KeyValue
)
{
key
:=
calcIssuanceKey
(
issuancelog
.
IssuanceId
,
issuancelog
.
Index
)
record
:=
&
pty
.
IssuanceRecord
{
IssuanceId
:
issuancelog
.
IssuanceId
,
Index
:
issuancelog
.
Index
,
}
kv
:=
&
types
.
KeyValue
{
Key
:
key
,
Value
:
types
.
Encode
(
record
)}
kvs
=
append
(
kvs
,
kv
)
return
kvs
}
func
(
c
*
Issuance
)
deleteIssuanceID
(
issuancelog
*
pty
.
ReceiptIssuance
)
(
kvs
[]
*
types
.
KeyValue
)
{
key
:=
calcIssuanceKey
(
issuancelog
.
IssuanceId
,
issuancelog
.
Index
)
kv
:=
&
types
.
KeyValue
{
Key
:
key
,
Value
:
nil
}
kvs
=
append
(
kvs
,
kv
)
return
kvs
}
func
(
c
*
Issuance
)
addIssuanceStatus
(
issuancelog
*
pty
.
ReceiptIssuance
)
(
kvs
[]
*
types
.
KeyValue
)
{
key
:=
calcIssuanceStatusKey
(
issuancelog
.
Status
,
issuancelog
.
Index
)
record
:=
&
pty
.
IssuanceRecord
{
IssuanceId
:
issuancelog
.
IssuanceId
,
Index
:
issuancelog
.
Index
,
}
kv
:=
&
types
.
KeyValue
{
Key
:
key
,
Value
:
types
.
Encode
(
record
)}
kvs
=
append
(
kvs
,
kv
)
return
kvs
}
func
(
c
*
Issuance
)
deleteIssuanceStatus
(
issuancelog
*
pty
.
ReceiptIssuance
)
(
kvs
[]
*
types
.
KeyValue
)
{
key
:=
calcIssuanceStatusKey
(
issuancelog
.
Status
,
issuancelog
.
Index
)
kv
:=
&
types
.
KeyValue
{
Key
:
key
,
Value
:
nil
}
kvs
=
append
(
kvs
,
kv
)
return
kvs
}
func
(
c
*
Issuance
)
addIssuanceAddr
(
issuancelog
*
pty
.
ReceiptIssuance
)
(
kvs
[]
*
types
.
KeyValue
)
{
key
:=
calcIssuanceAddrKey
(
issuancelog
.
AccountAddr
,
issuancelog
.
Index
)
record
:=
&
pty
.
IssuanceRecord
{
IssuanceId
:
issuancelog
.
IssuanceId
,
Index
:
issuancelog
.
Index
,
}
kv
:=
&
types
.
KeyValue
{
Key
:
key
,
Value
:
types
.
Encode
(
record
)}
kvs
=
append
(
kvs
,
kv
)
return
kvs
}
func
(
c
*
Issuance
)
deleteIssuanceAddr
(
issuancelog
*
pty
.
ReceiptIssuance
)
(
kvs
[]
*
types
.
KeyValue
)
{
key
:=
calcIssuanceAddrKey
(
issuancelog
.
AccountAddr
,
issuancelog
.
Index
)
kv
:=
&
types
.
KeyValue
{
Key
:
key
,
Value
:
nil
}
kvs
=
append
(
kvs
,
kv
)
return
kvs
}
func
(
c
*
Issuance
)
addIssuanceRecordStatus
(
issuancelog
*
pty
.
ReceiptIssuance
)
(
kvs
[]
*
types
.
KeyValue
)
{
key
:=
calcIssuanceRecordStatusKey
(
issuancelog
.
RecordStatus
,
issuancelog
.
Index
)
record
:=
&
pty
.
IssuanceRecord
{
IssuanceId
:
issuancelog
.
IssuanceId
,
Addr
:
issuancelog
.
AccountAddr
,
Index
:
issuancelog
.
Index
,
}
kv
:=
&
types
.
KeyValue
{
Key
:
key
,
Value
:
types
.
Encode
(
record
)}
kvs
=
append
(
kvs
,
kv
)
return
kvs
}
func
(
c
*
Issuance
)
deleteIssuanceRecordStatus
(
issuancelog
*
pty
.
ReceiptIssuance
)
(
kvs
[]
*
types
.
KeyValue
)
{
key
:=
calcIssuanceRecordStatusKey
(
issuancelog
.
RecordStatus
,
issuancelog
.
Index
)
kv
:=
&
types
.
KeyValue
{
Key
:
key
,
Value
:
nil
}
kvs
=
append
(
kvs
,
kv
)
return
kvs
}
// CheckReceiptExecOk return true to check if receipt ty is ok
func
(
c
*
Issuance
)
CheckReceiptExecOk
()
bool
{
return
true
}
// ExecutorOrder 设置localdb的EnableRead
func
(
c
*
Issuance
)
ExecutorOrder
()
int64
{
if
types
.
IsFork
(
c
.
GetHeight
(),
"ForkLocalDBAccess"
)
{
return
drivers
.
ExecLocalSameTime
}
return
c
.
DriverBase
.
ExecutorOrder
()
}
\ No newline at end of file
plugin/dapp/issuance/executor/issuancedb.go
0 → 100644
View file @
550958aa
// Copyright Fuzamei Corp. 2018 All Rights Reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package
executor
import
(
"github.com/33cn/chain33/account"
"github.com/33cn/chain33/common"
dbm
"github.com/33cn/chain33/common/db"
"github.com/33cn/chain33/system/dapp"
"github.com/33cn/chain33/types"
pty
"github.com/33cn/plugin/plugin/dapp/issuance/types"
tokenE
"github.com/33cn/plugin/plugin/dapp/token/executor"
)
// List control
const
(
ListDESC
=
int32
(
0
)
// list降序
ListASC
=
int32
(
1
)
// list升序
DefultCount
=
int32
(
20
)
// 默认一次取多少条记录
MaxCount
=
int32
(
100
)
// 最多取100条
)
const
(
Coin
=
types
.
Coin
// 1e8
PriceWarningRate
=
1.3
// 价格提前预警率
ExpireWarningTime
=
3600
*
24
*
10
// 提前10天超时预警
)
const
(
priceFeedKey
=
"issuance-price-feed"
guarantorKey
=
"issuance-guarantor"
manageKey
=
"issuance-manage"
)
func
getManageKey
(
key
string
,
db
dbm
.
KV
)
([]
byte
,
error
)
{
manageKey
:=
types
.
ManageKey
(
key
)
value
,
err
:=
db
.
Get
([]
byte
(
manageKey
))
if
err
!=
nil
{
return
nil
,
err
}
return
value
,
nil
}
func
getGuarantorAddr
(
db
dbm
.
KV
)
(
string
,
error
)
{
value
,
err
:=
getManageKey
(
guarantorKey
,
db
)
if
err
!=
nil
{
clog
.
Error
(
"IssuancePriceFeed"
,
"getGuarantorAddr"
,
err
)
return
""
,
err
}
if
value
==
nil
{
clog
.
Error
(
"IssuancePriceFeed guarantorKey found nil value"
)
return
""
,
err
}
var
item
types
.
ConfigItem
err
=
types
.
Decode
(
value
,
&
item
)
if
err
!=
nil
{
clog
.
Error
(
"IssuancePriceFeed"
,
"getGuarantorAddr"
,
err
)
return
""
,
err
}
return
item
.
GetAddr
(),
nil
}
func
isRightAddr
(
key
string
,
addr
string
,
db
dbm
.
KV
)
bool
{
value
,
err
:=
getManageKey
(
key
,
db
)
if
err
!=
nil
{
clog
.
Error
(
"isRightAddr"
,
"Key"
,
key
)
return
false
}
if
value
==
nil
{
clog
.
Error
(
"isRightAddr"
,
"key"
,
key
,
"error"
,
"Found key nil value"
)
return
false
}
var
item
types
.
ConfigItem
err
=
types
.
Decode
(
value
,
&
item
)
if
err
!=
nil
{
clog
.
Error
(
"isRightAddr"
,
"Decode"
,
value
)
return
false
}
for
_
,
op
:=
range
item
.
GetArr
()
.
Value
{
if
op
==
addr
{
return
true
}
}
return
false
}
// IssuanceDB def
type
IssuanceDB
struct
{
pty
.
Issuance
}
// GetKVSet for IssuanceDB
func
(
issu
*
IssuanceDB
)
GetKVSet
()
(
kvset
[]
*
types
.
KeyValue
)
{
value
:=
types
.
Encode
(
&
issu
.
Issuance
)
kvset
=
append
(
kvset
,
&
types
.
KeyValue
{
Key
:
Key
(
issu
.
IssuanceId
),
Value
:
value
})
return
kvset
}
// Save for IssuanceDB
func
(
issu
*
IssuanceDB
)
Save
(
db
dbm
.
KV
)
{
set
:=
issu
.
GetKVSet
()
for
i
:=
0
;
i
<
len
(
set
);
i
++
{
db
.
Set
(
set
[
i
]
.
GetKey
(),
set
[
i
]
.
Value
)
}
}
// Key for Issuance
func
Key
(
id
string
)
(
key
[]
byte
)
{
key
=
append
(
key
,
[]
byte
(
"mavl-"
+
pty
.
IssuanceX
+
"-"
)
...
)
key
=
append
(
key
,
[]
byte
(
id
)
...
)
return
key
}
// Key for IssuanceAddrConfig
func
AddrKey
()
(
key
[]
byte
)
{
key
=
append
(
key
,
[]
byte
(
"mavl-"
+
pty
.
IssuanceX
+
"addr"
)
...
)
return
key
}
// 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
Issuance
*
Issuance
}
// NewIssuanceAction generate New Action
func
NewIssuanceAction
(
c
*
Issuance
,
tx
*
types
.
Transaction
,
index
int
)
*
Action
{
hash
:=
tx
.
Hash
()
fromaddr
:=
tx
.
From
()
tokenDb
,
err
:=
account
.
NewAccountDB
(
tokenE
.
GetName
(),
pty
.
CCNYTokenName
,
c
.
GetStateDB
())
if
err
!=
nil
{
clog
.
Error
(
"NewIssuanceAction"
,
"Get Account DB error"
,
"err"
,
err
)
return
nil
}
return
&
Action
{
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
}
}
// GetCollCommonRecipt generate logs for Issuance common action
func
(
action
*
Action
)
GetCollCommonRecipt
(
issuance
*
pty
.
Issuance
,
preStatus
int32
)
*
pty
.
ReceiptIssuance
{
c
:=
&
pty
.
ReceiptIssuance
{}
c
.
IssuanceId
=
issuance
.
IssuanceId
c
.
PreStatus
=
preStatus
c
.
Status
=
issuance
.
Status
c
.
Index
=
action
.
GetIndex
()
return
c
}
// GetCreateReceiptLog generate logs for Issuance create action
func
(
action
*
Action
)
GetCreateReceiptLog
(
issuance
*
pty
.
Issuance
,
preStatus
int32
)
*
types
.
ReceiptLog
{
log
:=
&
types
.
ReceiptLog
{}
log
.
Ty
=
pty
.
TyLogIssuanceCreate
c
:=
action
.
GetCollCommonRecipt
(
issuance
,
preStatus
)
log
.
Log
=
types
.
Encode
(
c
)
return
log
}
// GetDebtReceiptLog generate logs for Issuance debt action
func
(
action
*
Action
)
GetDebtReceiptLog
(
issuance
*
pty
.
Issuance
,
preStatus
int32
)
*
types
.
ReceiptLog
{
log
:=
&
types
.
ReceiptLog
{}
log
.
Ty
=
pty
.
TyLogIssuanceDebt
c
:=
action
.
GetCollCommonRecipt
(
issuance
,
preStatus
)
c
.
AccountAddr
=
action
.
fromaddr
log
.
Log
=
types
.
Encode
(
c
)
return
log
}
// GetRepayReceiptLog generate logs for Issuance Repay action
func
(
action
*
Action
)
GetRepayReceiptLog
(
issuance
*
pty
.
Issuance
,
preStatus
int32
)
*
types
.
ReceiptLog
{
log
:=
&
types
.
ReceiptLog
{}
log
.
Ty
=
pty
.
TyLogIssuanceRepay
c
:=
action
.
GetCollCommonRecipt
(
issuance
,
preStatus
)
log
.
Log
=
types
.
Encode
(
c
)
return
log
}
// GetFeedReceiptLog generate logs for Issuance price feed action
func
(
action
*
Action
)
GetFeedReceiptLog
(
issuance
*
pty
.
Issuance
,
debtRecord
*
pty
.
DebtRecord
)
*
types
.
ReceiptLog
{
log
:=
&
types
.
ReceiptLog
{}
log
.
Ty
=
pty
.
TyLogIssuanceFeed
c
:=
action
.
GetCollCommonRecipt
(
issuance
,
debtRecord
.
PreStatus
)
c
.
AccountAddr
=
debtRecord
.
AccountAddr
c
.
RecordStatus
=
debtRecord
.
Status
log
.
Log
=
types
.
Encode
(
c
)
return
log
}
// GetCloseReceiptLog generate logs for Issuance close action
func
(
action
*
Action
)
GetCloseReceiptLog
(
Issuance
*
pty
.
Issuance
,
preStatus
int32
)
*
types
.
ReceiptLog
{
log
:=
&
types
.
ReceiptLog
{}
log
.
Ty
=
pty
.
TyLogIssuanceClose
c
:=
action
.
GetCollCommonRecipt
(
Issuance
,
preStatus
)
log
.
Log
=
types
.
Encode
(
c
)
return
log
}
// GetIndex returns index in block
func
(
action
*
Action
)
GetIndex
()
int64
{
return
action
.
height
*
types
.
MaxTxsPerBlock
+
int64
(
action
.
index
)
}
func
getLatestLiquidationPrice
(
issu
*
pty
.
Issuance
)
float32
{
var
latest
float32
for
_
,
collRecord
:=
range
issu
.
DebtRecords
{
if
collRecord
.
LiquidationPrice
>
latest
{
latest
=
collRecord
.
LiquidationPrice
}
}
return
latest
}
func
getLatestExpireTime
(
issu
*
pty
.
Issuance
)
int64
{
var
latest
int64
=
0x7fffffffffffffff
for
_
,
collRecord
:=
range
issu
.
DebtRecords
{
if
collRecord
.
ExpireTime
<
latest
{
latest
=
collRecord
.
ExpireTime
}
}
return
latest
}
// IssuanceConfig 设置全局借贷参数(管理员权限)
func
(
action
*
Action
)
IssuanceManage
(
manage
*
pty
.
IssuanceManage
)
(
*
types
.
Receipt
,
error
)
{
var
kv
[]
*
types
.
KeyValue
var
receipt
*
types
.
Receipt
// 是否配置管理用户
if
!
isRightAddr
(
manageKey
,
action
.
fromaddr
,
action
.
db
)
{
clog
.
Error
(
"IssuanceManage"
,
"addr"
,
action
.
fromaddr
,
"error"
,
"Address has no permission to config"
)
return
nil
,
pty
.
ErrPermissionDeny
}
// 添加大户地址
data
,
err
:=
action
.
db
.
Get
(
AddrKey
())
if
err
!=
nil
{
if
err
!=
types
.
ErrNotFound
{
clog
.
Error
(
"IssuanceManage"
,
"error"
,
err
)
return
nil
,
err
}
value
:=
types
.
Encode
(
manage
)
action
.
db
.
Set
(
AddrKey
(),
value
)
kv
=
append
(
kv
,
&
types
.
KeyValue
{
Key
:
AddrKey
(),
Value
:
value
})
}
else
{
var
addrStore
pty
.
IssuanceManage
err
=
types
.
Decode
(
data
,
&
addrStore
)
if
err
!=
nil
{
clog
.
Debug
(
"IssuanceManage"
,
"decode"
,
err
)
return
nil
,
err
}
addrStore
.
SuperAddrs
=
append
(
addrStore
.
SuperAddrs
,
manage
.
SuperAddrs
...
)
value
:=
types
.
Encode
(
&
addrStore
)
action
.
db
.
Set
(
AddrKey
(),
value
)
kv
=
append
(
kv
,
&
types
.
KeyValue
{
Key
:
AddrKey
(),
Value
:
value
})
}
receipt
=
&
types
.
Receipt
{
Ty
:
types
.
ExecOk
,
KV
:
kv
,
Logs
:
nil
}
return
receipt
,
nil
}
func
(
action
*
Action
)
getSuperAddr
()
[]
string
{
data
,
err
:=
action
.
db
.
Get
(
AddrKey
())
if
err
!=
nil
{
clog
.
Error
(
"getSuperAddr"
,
"error"
,
err
)
return
nil
}
var
addrStore
pty
.
IssuanceManage
err
=
types
.
Decode
(
data
,
&
addrStore
)
if
err
!=
nil
{
clog
.
Debug
(
"getSuperAddr"
,
"decode"
,
err
)
return
nil
}
return
addrStore
.
SuperAddrs
}
func
isSuperAddr
(
super
[]
string
,
addr
string
)
bool
{
if
super
==
nil
||
len
(
super
)
==
0
{
return
false
}
for
_
,
superAddr
:=
range
super
{
if
superAddr
==
addr
{
return
true
}
}
return
false
}
// IssuanceCreate 创建借贷,持有一定数量ccny的用户可创建借贷,提供给其他用户借贷
func
(
action
*
Action
)
IssuanceCreate
(
create
*
pty
.
IssuanceCreate
)
(
*
types
.
Receipt
,
error
)
{
var
logs
[]
*
types
.
ReceiptLog
var
kv
[]
*
types
.
KeyValue
var
receipt
*
types
.
Receipt
// 是否配置管理用户
if
!
isRightAddr
(
manageKey
,
action
.
fromaddr
,
action
.
db
)
{
clog
.
Error
(
"IssuanceCreate"
,
"addr"
,
action
.
fromaddr
,
"error"
,
"Address has no permission to create"
)
return
nil
,
pty
.
ErrPermissionDeny
}
// 检查ccny余额
if
!
action
.
CheckExecTokenAccount
(
action
.
fromaddr
,
create
.
TotalBalance
,
false
)
{
return
nil
,
types
.
ErrInsufficientBalance
}
// 查找ID是否重复
issuanceID
:=
common
.
ToHex
(
action
.
txhash
)
_
,
err
:=
queryIssuanceByID
(
action
.
db
,
issuanceID
)
if
err
!=
types
.
ErrNotFound
{
clog
.
Error
(
"IssuanceCreate"
,
"IssuanceCreate repeated"
,
issuanceID
)
return
nil
,
pty
.
ErrIssuanceRepeatHash
}
// 冻结ccny
receipt
,
err
=
action
.
tokenAccount
.
ExecFrozen
(
action
.
fromaddr
,
action
.
execaddr
,
create
.
TotalBalance
)
if
err
!=
nil
{
clog
.
Error
(
"IssuanceCreate.Frozen"
,
"addr"
,
action
.
fromaddr
,
"execaddr"
,
action
.
execaddr
,
"amount"
,
create
.
TotalBalance
)
return
nil
,
err
}
logs
=
append
(
logs
,
receipt
.
Logs
...
)
kv
=
append
(
kv
,
receipt
.
KV
...
)
// 构造coll结构
issu
:=
&
IssuanceDB
{}
issu
.
IssuanceId
=
issuanceID
issu
.
LiquidationRatio
=
create
.
LiquidationRatio
issu
.
TotalBalance
=
create
.
TotalBalance
issu
.
Balance
=
create
.
TotalBalance
issu
.
DebtCeiling
=
create
.
DebtCeiling
issu
.
Period
=
create
.
Period
issu
.
CreateTime
=
action
.
blocktime
issu
.
IssuerAddr
=
action
.
fromaddr
issu
.
Status
=
pty
.
IssuanceActionCreate
clog
.
Debug
(
"IssuanceCreate created"
,
"IssuanceID"
,
issuanceID
,
"TotalBalance"
,
issu
.
TotalBalance
)
// 保存
issu
.
Save
(
action
.
db
)
kv
=
append
(
kv
,
issu
.
GetKVSet
()
...
)
receiptLog
:=
action
.
GetCreateReceiptLog
(
&
issu
.
Issuance
,
0
)
logs
=
append
(
logs
,
receiptLog
)
receipt
=
&
types
.
Receipt
{
Ty
:
types
.
ExecOk
,
KV
:
kv
,
Logs
:
logs
}
return
receipt
,
nil
}
// 根据最近抵押物价格计算需要冻结的BTY数量
func
getBtyNumToFrozen
(
value
int64
,
price
float32
,
ratio
float32
)
(
int64
,
error
)
{
if
price
==
0
{
clog
.
Error
(
"Bty price should greate to 0"
)
return
0
,
pty
.
ErrPriceInvalid
}
btyValue
:=
float32
(
value
)
/
ratio
btyNum
:=
int64
(
btyValue
/
price
)
+
1
return
btyNum
,
nil
}
// 获取最近抵押物价格
func
(
action
*
Action
)
getLatestPrice
(
db
dbm
.
KV
)
(
float32
,
error
)
{
data
,
err
:=
db
.
Get
(
calcIssuanceLatestPriceKey
())
if
err
!=
nil
{
clog
.
Debug
(
"getLatestPrice"
,
"get"
,
err
)
return
-
1
,
err
}
var
price
pty
.
AssetPriceRecord
//decode
err
=
types
.
Decode
(
data
,
&
price
)
if
err
!=
nil
{
clog
.
Debug
(
"getLatestPrice"
,
"decode"
,
err
)
return
-
1
,
err
}
return
price
.
BtyPrice
,
nil
}
// CheckExecAccountBalance 检查账户抵押物余额
func
(
action
*
Action
)
CheckExecAccountBalance
(
fromAddr
string
,
ToFrozen
,
ToActive
int64
)
bool
{
acc
:=
action
.
coinsAccount
.
LoadExecAccount
(
fromAddr
,
action
.
execaddr
)
if
acc
.
GetBalance
()
>=
ToFrozen
&&
acc
.
GetFrozen
()
>=
ToActive
{
return
true
}
return
false
}
// CheckExecAccount 检查账户token余额
func
(
action
*
Action
)
CheckExecTokenAccount
(
addr
string
,
amount
int64
,
isFrozen
bool
)
bool
{
acc
:=
action
.
tokenAccount
.
LoadExecAccount
(
addr
,
action
.
execaddr
)
if
isFrozen
{
if
acc
.
GetFrozen
()
>=
amount
{
return
true
}
}
else
{
if
acc
.
GetBalance
()
>=
amount
{
return
true
}
}
return
false
}
// IssuanceDebt 大户质押bty借出ccny
func
(
action
*
Action
)
IssuanceDebt
(
debt
*
pty
.
IssuanceDebt
)
(
*
types
.
Receipt
,
error
)
{
var
logs
[]
*
types
.
ReceiptLog
var
kv
[]
*
types
.
KeyValue
// 查找对应的借贷ID
issuance
,
err
:=
queryIssuanceByID
(
action
.
db
,
debt
.
IssuanceId
)
if
err
!=
nil
{
clog
.
Error
(
"IssuanceDebt"
,
"IssuanceId"
,
debt
.
IssuanceId
,
"err"
,
err
)
return
nil
,
err
}
// 状态检查
if
issuance
.
Status
==
pty
.
IssuanceStatusClose
{
clog
.
Error
(
"IssuanceDebt"
,
"CollID"
,
issuance
.
IssuanceId
,
"addr"
,
action
.
fromaddr
,
"execaddr"
,
action
.
execaddr
,
"status"
,
issuance
.
Status
,
"err"
,
pty
.
ErrIssuanceStatus
)
return
nil
,
pty
.
ErrIssuanceStatus
}
// 一个地址在一期借贷中只允许借出一次
for
_
,
record
:=
range
issuance
.
DebtRecords
{
if
record
.
AccountAddr
==
action
.
fromaddr
{
clog
.
Error
(
"IssuanceDebt"
,
"IssuanceId"
,
debt
.
IssuanceId
,
action
.
fromaddr
,
"execaddr"
,
action
.
execaddr
,
"err"
,
pty
.
ErrIssuanceAccountExist
)
return
nil
,
err
}
}
issu
:=
&
IssuanceDB
{
*
issuance
}
preStatus
:=
issu
.
Status
// 借贷金额检查
if
debt
.
GetValue
()
<=
0
{
clog
.
Error
(
"IssuanceDebt"
,
"CollID"
,
issu
.
IssuanceId
,
"addr"
,
action
.
fromaddr
,
"execaddr"
,
action
.
execaddr
,
"debt value"
,
debt
.
GetValue
(),
"err"
,
types
.
ErrInvalidParam
)
return
nil
,
types
.
ErrInvalidParam
}
// 借贷金额不超过个人限额
if
debt
.
GetValue
()
>
issu
.
DebtCeiling
{
clog
.
Error
(
"IssuanceDebt"
,
"CollID"
,
issu
.
IssuanceId
,
"addr"
,
action
.
fromaddr
,
"execaddr"
,
action
.
execaddr
,
"debt value"
,
debt
.
GetValue
(),
"err"
,
pty
.
ErrIssuanceExceedDebtCeiling
)
return
nil
,
pty
.
ErrIssuanceExceedDebtCeiling
}
// 借贷金额不超过当前可借贷金额
if
debt
.
GetValue
()
>
issu
.
Balance
{
clog
.
Error
(
"IssuanceDebt"
,
"CollID"
,
issu
.
IssuanceId
,
"addr"
,
action
.
fromaddr
,
"execaddr"
,
action
.
execaddr
,
"debt value"
,
debt
.
GetValue
(),
"err"
,
pty
.
ErrIssuanceLowBalance
)
return
nil
,
pty
.
ErrIssuanceLowBalance
}
clog
.
Debug
(
"IssuanceDebt"
,
"value"
,
debt
.
GetValue
())
// 获取抵押物价格
lastPrice
,
err
:=
action
.
getLatestPrice
(
action
.
db
)
if
err
!=
nil
{
clog
.
Error
(
"IssuanceDebt"
,
"CollID"
,
issu
.
IssuanceId
,
"addr"
,
action
.
fromaddr
,
"execaddr"
,
action
.
execaddr
,
"err"
,
err
)
return
nil
,
err
}
// 根据价格和需要借贷的金额,计算需要质押的抵押物数量
btyFrozen
,
err
:=
getBtyNumToFrozen
(
debt
.
Value
,
lastPrice
,
issu
.
LiquidationRatio
)
if
err
!=
nil
{
clog
.
Error
(
"IssuanceDebt"
,
"CollID"
,
issu
.
IssuanceId
,
"addr"
,
action
.
fromaddr
,
"execaddr"
,
action
.
execaddr
,
"err"
,
err
)
return
nil
,
err
}
// 检查抵押物账户余额
if
!
action
.
CheckExecAccountBalance
(
action
.
fromaddr
,
btyFrozen
,
0
)
{
clog
.
Error
(
"IssuanceDebt"
,
"CollID"
,
issu
.
IssuanceId
,
"addr"
,
action
.
fromaddr
,
"execaddr"
,
action
.
execaddr
,
"err"
,
types
.
ErrNoBalance
)
return
nil
,
types
.
ErrNoBalance
}
// 抵押物转账
receipt
,
err
:=
action
.
coinsAccount
.
ExecTransfer
(
action
.
fromaddr
,
issu
.
IssuerAddr
,
action
.
execaddr
,
btyFrozen
*
Coin
)
if
err
!=
nil
{
clog
.
Error
(
"IssuanceDebt.ExecTransfer"
,
"addr"
,
action
.
fromaddr
,
"execaddr"
,
action
.
execaddr
,
"amount"
,
btyFrozen
)
return
nil
,
err
}
logs
=
append
(
logs
,
receipt
.
Logs
...
)
kv
=
append
(
kv
,
receipt
.
KV
...
)
// 抵押物冻结
receipt
,
err
=
action
.
coinsAccount
.
ExecFrozen
(
issu
.
IssuerAddr
,
action
.
execaddr
,
btyFrozen
)
if
err
!=
nil
{
clog
.
Error
(
"IssuanceDebt.Frozen"
,
"addr"
,
issu
.
IssuerAddr
,
"execaddr"
,
action
.
execaddr
,
"amount"
,
btyFrozen
)
return
nil
,
err
}
logs
=
append
(
logs
,
receipt
.
Logs
...
)
kv
=
append
(
kv
,
receipt
.
KV
...
)
// 借出ccny
receipt
,
err
=
action
.
tokenAccount
.
ExecTransfer
(
issu
.
IssuerAddr
,
action
.
fromaddr
,
action
.
execaddr
,
debt
.
Value
)
if
err
!=
nil
{
clog
.
Error
(
"IssuanceDebt.ExecTokenTransfer"
,
"addr"
,
action
.
fromaddr
,
"execaddr"
,
action
.
execaddr
,
"amount"
,
debt
.
Value
)
return
nil
,
err
}
logs
=
append
(
logs
,
receipt
.
Logs
...
)
kv
=
append
(
kv
,
receipt
.
KV
...
)
// 构造借出记录
debtRecord
:=
&
pty
.
DebtRecord
{}
debtRecord
.
AccountAddr
=
action
.
fromaddr
debtRecord
.
CollateralValue
=
btyFrozen
debtRecord
.
StartTime
=
action
.
blocktime
debtRecord
.
CollateralPrice
=
lastPrice
debtRecord
.
DebtValue
=
debt
.
Value
debtRecord
.
LiquidationPrice
=
issu
.
LiquidationRatio
*
lastPrice
*
pty
.
IssuancePreLiquidationRatio
debtRecord
.
Status
=
pty
.
IssuanceUserStatusCreate
debtRecord
.
ExpireTime
=
action
.
blocktime
+
issu
.
Period
// 记录当前借贷的最高自动清算价格
if
issu
.
LatestLiquidationPrice
<
debtRecord
.
LiquidationPrice
{
issu
.
LatestLiquidationPrice
=
debtRecord
.
LiquidationPrice
}
// 保存
issu
.
DebtRecords
=
append
(
issu
.
DebtRecords
,
debtRecord
)
issu
.
CollateralValue
+=
btyFrozen
issu
.
DebtValue
+=
debt
.
Value
issu
.
Balance
-=
debt
.
Value
issu
.
Save
(
action
.
db
)
kv
=
append
(
kv
,
issu
.
GetKVSet
()
...
)
receiptLog
:=
action
.
GetDebtReceiptLog
(
&
issu
.
Issuance
,
preStatus
)
logs
=
append
(
logs
,
receiptLog
)
receipt
=
&
types
.
Receipt
{
Ty
:
types
.
ExecOk
,
KV
:
kv
,
Logs
:
logs
}
return
receipt
,
nil
}
// IssuanceRepay 用户主动清算
func
(
action
*
Action
)
IssuanceRepay
(
repay
*
pty
.
IssuanceRepay
)
(
*
types
.
Receipt
,
error
)
{
var
logs
[]
*
types
.
ReceiptLog
var
kv
[]
*
types
.
KeyValue
var
receipt
*
types
.
Receipt
// 找到相应的借贷
issuance
,
err
:=
queryIssuanceByID
(
action
.
db
,
repay
.
IssuanceId
)
if
err
!=
nil
{
clog
.
Error
(
"IssuanceRepay"
,
"CollID"
,
repay
.
IssuanceId
,
"err"
,
err
)
return
nil
,
err
}
issu
:=
&
IssuanceDB
{
*
issuance
}
preStatus
:=
issu
.
Status
// 状态检查
if
issu
.
Status
!=
pty
.
IssuanceStatusCreated
{
clog
.
Error
(
"IssuanceRepay"
,
"CollID"
,
repay
.
IssuanceId
,
"addr"
,
action
.
fromaddr
,
"execaddr"
,
action
.
execaddr
,
"err"
,
"status error"
,
"Status"
,
issu
.
Status
)
return
nil
,
pty
.
ErrIssuanceStatus
}
// 查找借出记录
var
debtRecord
*
pty
.
DebtRecord
var
index
int
for
i
,
record
:=
range
issu
.
DebtRecords
{
if
record
.
AccountAddr
==
action
.
fromaddr
{
debtRecord
=
record
index
=
i
break
}
}
if
debtRecord
==
nil
{
clog
.
Error
(
"IssuanceRepay"
,
"CollID"
,
repay
.
IssuanceId
,
"addr"
,
action
.
fromaddr
,
"execaddr"
,
action
.
execaddr
,
"err"
,
"Can not find debt record"
)
return
nil
,
pty
.
ErrRecordNotExist
}
// 检查
if
!
action
.
CheckExecTokenAccount
(
action
.
fromaddr
,
debtRecord
.
DebtValue
,
false
)
{
clog
.
Error
(
"IssuanceRepay"
,
"CollID"
,
issu
.
IssuanceId
,
"addr"
,
action
.
fromaddr
,
"execaddr"
,
action
.
execaddr
,
"err"
,
types
.
ErrInsufficientBalance
)
return
nil
,
types
.
ErrNoBalance
}
// ccny转移
receipt
,
err
=
action
.
tokenAccount
.
ExecTransfer
(
action
.
fromaddr
,
issu
.
IssuerAddr
,
action
.
execaddr
,
debtRecord
.
DebtValue
)
if
err
!=
nil
{
clog
.
Error
(
"IssuanceRepay.ExecTokenTransfer"
,
"addr"
,
action
.
fromaddr
,
"execaddr"
,
action
.
execaddr
,
"amount"
,
debtRecord
.
DebtValue
)
return
nil
,
err
}
logs
=
append
(
logs
,
receipt
.
Logs
...
)
kv
=
append
(
kv
,
receipt
.
KV
...
)
// 抵押物归还
receipt
,
err
=
action
.
coinsAccount
.
ExecTransferFrozen
(
issu
.
IssuerAddr
,
action
.
execaddr
,
action
.
execaddr
,
debtRecord
.
CollateralValue
)
if
err
!=
nil
{
clog
.
Error
(
"IssuanceRepay.ExecTransferFrozen"
,
"addr"
,
issu
.
IssuerAddr
,
"execaddr"
,
action
.
execaddr
,
"amount"
,
debtRecord
.
CollateralValue
)
return
nil
,
err
}
logs
=
append
(
logs
,
receipt
.
Logs
...
)
kv
=
append
(
kv
,
receipt
.
KV
...
)
// 借贷记录关闭
debtRecord
.
PreStatus
=
debtRecord
.
Status
debtRecord
.
Status
=
pty
.
IssuanceUserStatusClose
// 保存
issu
.
Balance
+=
debtRecord
.
DebtValue
issu
.
CollateralValue
-=
debtRecord
.
CollateralValue
issu
.
DebtValue
-=
debtRecord
.
DebtValue
issu
.
DebtRecords
=
append
(
issu
.
DebtRecords
[
:
index
],
issu
.
DebtRecords
[
index
+
1
:
]
...
)
issu
.
InvalidRecords
=
append
(
issu
.
InvalidRecords
,
debtRecord
)
issu
.
LatestLiquidationPrice
=
getLatestLiquidationPrice
(
&
issu
.
Issuance
)
issu
.
LatestExpireTime
=
getLatestExpireTime
(
&
issu
.
Issuance
)
issu
.
Save
(
action
.
db
)
kv
=
append
(
kv
,
issu
.
GetKVSet
()
...
)
receiptLog
:=
action
.
GetRepayReceiptLog
(
&
issu
.
Issuance
,
preStatus
)
logs
=
append
(
logs
,
receiptLog
)
receipt
=
&
types
.
Receipt
{
Ty
:
types
.
ExecOk
,
KV
:
kv
,
Logs
:
logs
}
return
receipt
,
nil
}
// 系统清算
func
(
action
*
Action
)
systemLiquidation
(
issu
*
pty
.
Issuance
,
price
float32
)
(
*
types
.
Receipt
,
error
)
{
var
logs
[]
*
types
.
ReceiptLog
var
kv
[]
*
types
.
KeyValue
collDB
:=
&
IssuanceDB
{
*
issu
}
for
index
,
debtRecord
:=
range
issu
.
DebtRecords
{
if
debtRecord
.
LiquidationPrice
*
PriceWarningRate
<
price
{
if
debtRecord
.
Status
==
pty
.
IssuanceUserStatusSystemLiquidate
{
debtRecord
.
Status
=
debtRecord
.
PreStatus
debtRecord
.
PreStatus
=
pty
.
IssuanceUserStatusSystemLiquidate
}
continue
}
if
debtRecord
.
LiquidationPrice
>=
price
{
getGuarantorAddr
,
err
:=
getGuarantorAddr
(
action
.
db
)
if
err
!=
nil
{
if
err
!=
nil
{
clog
.
Error
(
"systemLiquidation"
,
"getGuarantorAddr"
,
err
)
continue
}
}
// 抵押物转移
receipt
,
err
:=
action
.
coinsAccount
.
ExecTransferFrozen
(
action
.
fromaddr
,
getGuarantorAddr
,
action
.
execaddr
,
debtRecord
.
CollateralValue
)
if
err
!=
nil
{
clog
.
Error
(
"systemLiquidation"
,
"addr"
,
action
.
fromaddr
,
"execaddr"
,
action
.
execaddr
,
"amount"
,
debtRecord
.
CollateralValue
,
"err"
,
err
)
continue
}
logs
=
append
(
logs
,
receipt
.
Logs
...
)
kv
=
append
(
kv
,
receipt
.
KV
...
)
// 借贷记录清算
debtRecord
.
LiquidateTime
=
action
.
blocktime
debtRecord
.
PreStatus
=
debtRecord
.
Status
debtRecord
.
Status
=
pty
.
IssuanceUserStatusSystemLiquidate
issu
.
DebtRecords
=
append
(
issu
.
DebtRecords
[
:
index
],
issu
.
DebtRecords
[
index
+
1
:
]
...
)
issu
.
InvalidRecords
=
append
(
issu
.
InvalidRecords
,
debtRecord
)
}
else
{
debtRecord
.
PreStatus
=
debtRecord
.
Status
debtRecord
.
Status
=
pty
.
IssuanceUserStatusWarning
}
log
:=
action
.
GetFeedReceiptLog
(
issu
,
debtRecord
)
logs
=
append
(
logs
,
log
)
}
// 保存
issu
.
LatestLiquidationPrice
=
getLatestLiquidationPrice
(
issu
)
issu
.
LatestExpireTime
=
getLatestExpireTime
(
issu
)
collDB
.
Save
(
action
.
db
)
kv
=
append
(
kv
,
collDB
.
GetKVSet
()
...
)
receipt
:=
&
types
.
Receipt
{
Ty
:
types
.
ExecOk
,
KV
:
kv
,
Logs
:
logs
}
return
receipt
,
nil
}
// 超时清算
func
(
action
*
Action
)
expireLiquidation
(
issu
*
pty
.
Issuance
)
(
*
types
.
Receipt
,
error
)
{
var
logs
[]
*
types
.
ReceiptLog
var
kv
[]
*
types
.
KeyValue
collDB
:=
&
IssuanceDB
{
*
issu
}
for
index
,
debtRecord
:=
range
issu
.
DebtRecords
{
if
debtRecord
.
ExpireTime
-
ExpireWarningTime
>
action
.
blocktime
{
continue
}
if
debtRecord
.
ExpireTime
>=
action
.
blocktime
{
getGuarantorAddr
,
err
:=
getGuarantorAddr
(
action
.
db
)
if
err
!=
nil
{
if
err
!=
nil
{
clog
.
Error
(
"systemLiquidation"
,
"getGuarantorAddr"
,
err
)
continue
}
}
// 抵押物转移
receipt
,
err
:=
action
.
coinsAccount
.
ExecTransferFrozen
(
action
.
fromaddr
,
getGuarantorAddr
,
action
.
execaddr
,
debtRecord
.
CollateralValue
)
if
err
!=
nil
{
clog
.
Error
(
"systemLiquidation"
,
"addr"
,
action
.
fromaddr
,
"execaddr"
,
action
.
execaddr
,
"amount"
,
debtRecord
.
CollateralValue
,
"err"
,
err
)
continue
}
logs
=
append
(
logs
,
receipt
.
Logs
...
)
kv
=
append
(
kv
,
receipt
.
KV
...
)
// 借贷记录清算
debtRecord
.
LiquidateTime
=
action
.
blocktime
debtRecord
.
PreStatus
=
debtRecord
.
Status
debtRecord
.
Status
=
pty
.
IssuanceUserStatusExpireLiquidate
issu
.
DebtRecords
=
append
(
issu
.
DebtRecords
[
:
index
],
issu
.
DebtRecords
[
index
+
1
:
]
...
)
issu
.
InvalidRecords
=
append
(
issu
.
InvalidRecords
,
debtRecord
)
}
else
{
debtRecord
.
PreStatus
=
debtRecord
.
Status
debtRecord
.
Status
=
pty
.
IssuanceUserStatusExpire
}
log
:=
action
.
GetFeedReceiptLog
(
issu
,
debtRecord
)
logs
=
append
(
logs
,
log
)
}
// 保存
issu
.
LatestLiquidationPrice
=
getLatestLiquidationPrice
(
issu
)
issu
.
LatestExpireTime
=
getLatestExpireTime
(
issu
)
collDB
.
Save
(
action
.
db
)
kv
=
append
(
kv
,
collDB
.
GetKVSet
()
...
)
receipt
:=
&
types
.
Receipt
{
Ty
:
types
.
ExecOk
,
KV
:
kv
,
Logs
:
logs
}
return
receipt
,
nil
}
// 价格计算策略
func
pricePolicy
(
feed
*
pty
.
IssuanceFeed
)
float32
{
var
totalPrice
float32
var
totalVolume
int64
for
_
,
volume
:=
range
feed
.
Volume
{
totalVolume
+=
volume
}
for
i
,
price
:=
range
feed
.
Price
{
totalPrice
+=
price
*
float32
(
float64
(
feed
.
Volume
[
i
])
/
float64
(
totalVolume
))
}
return
totalPrice
}
// IssuanceFeed 喂价
func
(
action
*
Action
)
IssuanceFeed
(
feed
*
pty
.
IssuanceFeed
)
(
*
types
.
Receipt
,
error
)
{
var
logs
[]
*
types
.
ReceiptLog
var
kv
[]
*
types
.
KeyValue
if
feed
==
nil
||
len
(
feed
.
Price
)
==
0
||
len
(
feed
.
Price
)
!=
len
(
feed
.
Volume
)
{
clog
.
Error
(
"IssuancePriceFeed"
,
types
.
ErrInvalidParam
)
return
nil
,
types
.
ErrInvalidParam
}
// 是否后台管理用户
if
!
isRightAddr
(
priceFeedKey
,
action
.
fromaddr
,
action
.
db
)
{
clog
.
Error
(
"IssuancePriceFeed"
,
"addr"
,
action
.
fromaddr
,
"error"
,
"Address has no permission to feed price"
)
return
nil
,
pty
.
ErrPermissionDeny
}
price
:=
pricePolicy
(
feed
)
if
price
==
0
||
price
==
-
1
{
clog
.
Error
(
"IssuancePriceFeed"
,
"price"
,
price
,
"err"
,
pty
.
ErrPriceInvalid
)
return
nil
,
pty
.
ErrPriceInvalid
}
collIDRecords
,
err
:=
queryIssuanceByStatus
(
action
.
localDB
,
pty
.
IssuanceStatusCreated
)
if
err
!=
nil
{
clog
.
Error
(
"IssuancePriceFeed"
,
"get issuance record error"
,
err
)
return
nil
,
err
}
for
_
,
collID
:=
range
collIDRecords
{
issu
,
err
:=
queryIssuanceByID
(
action
.
db
,
collID
.
IssuanceId
)
if
err
!=
nil
{
clog
.
Error
(
"IssuancePriceFeed"
,
"Issuance ID"
,
issu
.
IssuanceId
,
"get issuance record by id error"
,
err
)
continue
}
// 超时清算判断
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
)
continue
}
logs
=
append
(
logs
,
receipt
.
Logs
...
)
kv
=
append
(
kv
,
receipt
.
KV
...
)
}
// 系统清算判断
receipt
,
err
:=
action
.
systemLiquidation
(
issu
,
price
)
if
err
!=
nil
{
clog
.
Error
(
"IssuancePriceFeed"
,
"Issuance ID"
,
issu
.
IssuanceId
,
"system liquidation error"
,
err
)
continue
}
logs
=
append
(
logs
,
receipt
.
Logs
...
)
kv
=
append
(
kv
,
receipt
.
KV
...
)
}
var
priceRecord
pty
.
AssetPriceRecord
priceRecord
.
BtyPrice
=
price
priceRecord
.
RecordTime
=
action
.
blocktime
// 喂价记录
pricekv
:=
&
types
.
KeyValue
{
Key
:
calcIssuancePriceKey
(
string
(
action
.
blocktime
)),
Value
:
types
.
Encode
(
&
priceRecord
)}
action
.
db
.
Set
(
pricekv
.
Key
,
pricekv
.
Value
)
kv
=
append
(
kv
,
pricekv
)
// 最近喂价记录
pricekv
=
&
types
.
KeyValue
{
Key
:
calcIssuanceLatestPriceKey
(),
Value
:
types
.
Encode
(
&
priceRecord
)}
action
.
db
.
Set
(
pricekv
.
Key
,
pricekv
.
Value
)
kv
=
append
(
kv
,
pricekv
)
receipt
:=
&
types
.
Receipt
{
Ty
:
types
.
ExecOk
,
KV
:
kv
,
Logs
:
logs
}
return
receipt
,
nil
}
// IssuanceClose 终止借贷
func
(
action
*
Action
)
IssuanceClose
(
close
*
pty
.
IssuanceClose
)
(
*
types
.
Receipt
,
error
)
{
var
logs
[]
*
types
.
ReceiptLog
var
kv
[]
*
types
.
KeyValue
issuance
,
err
:=
queryIssuanceByID
(
action
.
db
,
close
.
IssuanceId
)
if
err
!=
nil
{
clog
.
Error
(
"IssuanceClose"
,
"IssuanceId"
,
close
.
IssuanceId
,
"err"
,
err
)
return
nil
,
err
}
for
_
,
debtRecord
:=
range
issuance
.
DebtRecords
{
if
debtRecord
.
Status
!=
pty
.
IssuanceUserStatusClose
{
clog
.
Error
(
"IssuanceClose"
,
"IssuanceId"
,
close
.
IssuanceId
,
"addr"
,
action
.
fromaddr
,
"execaddr"
,
action
.
execaddr
,
"err"
,
pty
.
ErrIssuanceRecordNotEmpty
)
return
nil
,
pty
.
ErrIssuanceRecordNotEmpty
}
}
clog
.
Debug
(
"IssuanceClose"
,
"ID"
,
close
.
IssuanceId
)
issu
:=
&
IssuanceDB
{
*
issuance
}
preStatus
:=
issu
.
Status
issu
.
Status
=
pty
.
IssuanceStatusClose
issu
.
Save
(
action
.
db
)
kv
=
append
(
kv
,
issu
.
GetKVSet
()
...
)
receiptLog
:=
action
.
GetCloseReceiptLog
(
&
issu
.
Issuance
,
preStatus
)
logs
=
append
(
logs
,
receiptLog
)
return
&
types
.
Receipt
{
Ty
:
types
.
ExecOk
,
KV
:
kv
,
Logs
:
logs
},
nil
}
// 查找借贷
func
queryIssuanceByID
(
db
dbm
.
KV
,
IssuanceID
string
)
(
*
pty
.
Issuance
,
error
)
{
data
,
err
:=
db
.
Get
(
Key
(
IssuanceID
))
if
err
!=
nil
{
clog
.
Debug
(
"queryIssuanceByID"
,
"error"
,
err
)
return
nil
,
err
}
var
issu
pty
.
Issuance
err
=
types
.
Decode
(
data
,
&
issu
)
if
err
!=
nil
{
clog
.
Debug
(
"queryIssuanceByID"
,
"decode"
,
err
)
return
nil
,
err
}
return
&
issu
,
nil
}
func
queryIssuanceByStatus
(
localdb
dbm
.
Lister
,
status
int32
)
([]
*
pty
.
IssuanceRecord
,
error
)
{
data
,
err
:=
localdb
.
List
(
calcIssuanceStatusPrefix
(
status
),
nil
,
DefultCount
,
ListDESC
)
if
err
!=
nil
{
clog
.
Debug
(
"queryIssuancesByStatus"
,
"error"
,
err
)
return
nil
,
err
}
var
colls
[]
*
pty
.
IssuanceRecord
var
issu
pty
.
IssuanceRecord
for
_
,
collBytes
:=
range
data
{
err
=
types
.
Decode
(
collBytes
,
&
issu
)
if
err
!=
nil
{
clog
.
Debug
(
"queryIssuancesByStatus"
,
"decode"
,
err
)
return
nil
,
err
}
colls
=
append
(
colls
,
&
issu
)
}
return
colls
,
nil
}
func
queryIssuanceByAddr
(
localdb
dbm
.
Lister
,
addr
string
)
([]
*
pty
.
IssuanceRecord
,
error
)
{
data
,
err
:=
localdb
.
List
(
calcIssuanceAddrPrefix
(
addr
),
nil
,
DefultCount
,
ListDESC
)
if
err
!=
nil
{
clog
.
Debug
(
"queryIssuancesByAddr"
,
"error"
,
err
)
return
nil
,
err
}
var
colls
[]
*
pty
.
IssuanceRecord
var
issu
pty
.
IssuanceRecord
for
_
,
collBytes
:=
range
data
{
err
=
types
.
Decode
(
collBytes
,
&
issu
)
if
err
!=
nil
{
clog
.
Debug
(
"queryIssuancesByAddr"
,
"decode"
,
err
)
return
nil
,
err
}
colls
=
append
(
colls
,
&
issu
)
}
return
colls
,
nil
}
func
queryIssuanceRecordByStatus
(
localdb
dbm
.
Lister
,
status
int32
)
([]
*
pty
.
IssuanceRecord
,
error
)
{
data
,
err
:=
localdb
.
List
(
calcIssuanceRecordStatusPrefix
(
status
),
nil
,
DefultCount
,
ListDESC
)
if
err
!=
nil
{
clog
.
Debug
(
"queryIssuanceRecordByStatus"
,
"error"
,
err
)
return
nil
,
err
}
var
colls
[]
*
pty
.
IssuanceRecord
var
issu
pty
.
IssuanceRecord
for
_
,
collBytes
:=
range
data
{
err
=
types
.
Decode
(
collBytes
,
&
issu
)
if
err
!=
nil
{
clog
.
Debug
(
"queryIssuancesByStatus"
,
"decode"
,
err
)
return
nil
,
err
}
colls
=
append
(
colls
,
&
issu
)
}
return
colls
,
nil
}
plugin/dapp/issuance/executor/keys.go
0 → 100644
View file @
550958aa
// Copyright Fuzamei Corp. 2018 All Rights Reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package
executor
import
"fmt"
func
calcIssuanceKey
(
issuanceID
string
,
index
int64
)
[]
byte
{
key
:=
fmt
.
Sprintf
(
"LODB-Issuance-ID:%s:%018d"
,
issuanceID
,
index
)
return
[]
byte
(
key
)
}
func
calcIssuanceStatusPrefix
(
status
int32
)
[]
byte
{
key
:=
fmt
.
Sprintf
(
"LODB-Issuance-status-index:%d"
,
status
)
return
[]
byte
(
key
)
}
func
calcIssuanceStatusKey
(
status
int32
,
index
int64
)
[]
byte
{
key
:=
fmt
.
Sprintf
(
"LODB-Issuance-status:%d:%018d"
,
status
,
index
)
return
[]
byte
(
key
)
}
func
calcIssuanceAddrPrefix
(
addr
string
)
[]
byte
{
key
:=
fmt
.
Sprintf
(
"LODB-Issuance-addr:%s"
,
addr
)
return
[]
byte
(
key
)
}
func
calcIssuanceAddrKey
(
addr
string
,
index
int64
)
[]
byte
{
key
:=
fmt
.
Sprintf
(
"LODB-Issuance-addr:%s:%018d"
,
addr
,
index
)
return
[]
byte
(
key
)
}
func
calcIssuancePriceKey
(
time
string
)
[]
byte
{
key
:=
fmt
.
Sprintf
(
"LODB-Issuance-price:%s"
,
time
)
return
[]
byte
(
key
)
}
func
calcIssuanceLatestPriceKey
()
[]
byte
{
key
:=
fmt
.
Sprintf
(
"LODB-Issuance-latest-price"
)
return
[]
byte
(
key
)
}
func
calcIssuanceRecordStatusPrefix
(
status
int32
)
[]
byte
{
key
:=
fmt
.
Sprintf
(
"LODB-Issuance-record-status:%d"
,
status
)
return
[]
byte
(
key
)
}
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
0 → 100644
View file @
550958aa
// Copyright Fuzamei Corp. 2018 All Rights Reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package
executor
import
(
"github.com/33cn/chain33/types"
pty
"github.com/33cn/plugin/plugin/dapp/issuance/types"
)
func
(
c
*
Issuance
)
Query_IssuanceInfoByID
(
req
*
pty
.
ReqIssuanceInfo
)
(
types
.
Message
,
error
)
{
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
,
},
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
)
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
,
})
}
return
infos
,
nil
}
func
(
c
*
Issuance
)
Query_IssuanceByStatus
(
req
*
pty
.
ReqIssuanceByStatus
)
(
types
.
Message
,
error
)
{
ids
:=
&
pty
.
RepIssuanceIDs
{}
issuIDRecords
,
err
:=
queryIssuanceByStatus
(
c
.
GetLocalDB
(),
req
.
Status
)
if
err
!=
nil
{
clog
.
Error
(
"Query_IssuanceByStatus"
,
"get issuance record error"
,
err
)
return
nil
,
err
}
for
_
,
record
:=
range
issuIDRecords
{
ids
.
IDs
=
append
(
ids
.
IDs
,
record
.
IssuanceId
)
}
return
ids
,
nil
}
func
(
c
*
Issuance
)
Query_IssuanceByAddr
(
req
*
pty
.
ReqIssuanceByAddr
)
(
types
.
Message
,
error
)
{
ids
:=
&
pty
.
RepIssuanceIDs
{}
issuIDRecords
,
err
:=
queryIssuanceByAddr
(
c
.
GetLocalDB
(),
req
.
Addr
)
if
err
!=
nil
{
clog
.
Error
(
"Query_IssuanceByAddr"
,
"get issuance record error"
,
err
)
return
nil
,
err
}
for
_
,
record
:=
range
issuIDRecords
{
ids
.
IDs
=
append
(
ids
.
IDs
,
record
.
IssuanceId
)
}
return
ids
,
nil
}
func
(
c
*
Issuance
)
Query_IssuanceDebtInfoByAddr
(
req
*
pty
.
ReqIssuanceDebtInfoByAddr
)
(
types
.
Message
,
error
)
{
records
,
err
:=
queryIssuanceByAddr
(
c
.
GetLocalDB
(),
req
.
Addr
)
if
err
!=
nil
{
clog
.
Error
(
"Query_IssuanceDebtInfoByAddr"
,
"get issuance record error"
,
err
)
return
nil
,
err
}
ret
:=
&
pty
.
RepIssuanceDebtInfos
{}
for
_
,
record
:=
range
records
{
if
record
.
IssuanceId
==
req
.
IssuanceId
{
issu
,
err
:=
queryIssuanceByID
(
c
.
GetStateDB
(),
record
.
IssuanceId
)
if
err
!=
nil
{
clog
.
Error
(
"Query_IssuanceDebtInfoByAddr"
,
"get issuance record error"
,
err
)
return
nil
,
err
}
for
_
,
borrowRecord
:=
range
issu
.
DebtRecords
{
if
borrowRecord
.
AccountAddr
==
req
.
Addr
{
ret
.
Record
=
append
(
ret
.
Record
,
borrowRecord
)
}
}
for
_
,
borrowRecord
:=
range
issu
.
InvalidRecords
{
if
borrowRecord
.
AccountAddr
==
req
.
Addr
{
ret
.
Record
=
append
(
ret
.
Record
,
borrowRecord
)
}
}
}
}
return
nil
,
pty
.
ErrRecordNotExist
}
func
(
c
*
Issuance
)
Query_IssuanceDebtInfoByStatus
(
req
*
pty
.
ReqIssuanceDebtInfoByStatus
)
(
types
.
Message
,
error
)
{
records
,
err
:=
queryIssuanceRecordByStatus
(
c
.
GetLocalDB
(),
req
.
Status
)
if
err
!=
nil
{
clog
.
Error
(
"Query_IssuanceDebtInfoByAddr"
,
"get issuance record error"
,
err
)
return
nil
,
err
}
ret
:=
&
pty
.
RepIssuanceDebtInfos
{}
for
_
,
record
:=
range
records
{
issu
,
err
:=
queryIssuanceByID
(
c
.
GetStateDB
(),
record
.
IssuanceId
)
if
err
!=
nil
{
clog
.
Error
(
"Query_IssuanceDebtInfoByAddr"
,
"get issuance record error"
,
err
)
return
nil
,
err
}
for
_
,
borrowRecord
:=
range
issu
.
DebtRecords
{
if
borrowRecord
.
Status
==
req
.
Status
{
ret
.
Record
=
append
(
ret
.
Record
,
borrowRecord
)
}
}
for
_
,
borrowRecord
:=
range
issu
.
InvalidRecords
{
if
borrowRecord
.
Status
==
req
.
Status
{
ret
.
Record
=
append
(
ret
.
Record
,
borrowRecord
)
}
}
}
return
ret
,
nil
}
\ No newline at end of file
plugin/dapp/issuance/plugin.go
0 → 100644
View file @
550958aa
// Copyright Fuzamei Corp. 2018 All Rights Reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package
issuance
import
(
"github.com/33cn/chain33/pluginmgr"
"github.com/33cn/plugin/plugin/dapp/issuance/commands"
"github.com/33cn/plugin/plugin/dapp/issuance/executor"
"github.com/33cn/plugin/plugin/dapp/issuance/types"
)
func
init
()
{
pluginmgr
.
Register
(
&
pluginmgr
.
PluginBase
{
Name
:
types
.
IssuanceX
,
ExecName
:
executor
.
GetName
(),
Exec
:
executor
.
Init
,
Cmd
:
commands
.
IssuanceCmd
,
})
}
plugin/dapp/issuance/proto/Makefile
0 → 100644
View file @
550958aa
all
:
sh ./create_protobuf.sh
plugin/dapp/issuance/proto/create_protobuf.sh
0 → 100644
View file @
550958aa
#!/bin/sh
chain33_path
=
$(
go list
-f
'{{.Dir}}'
"github.com/33cn/chain33"
)
protoc
--go_out
=
plugins
=
grpc:../types ./
*
.proto
--proto_path
=
.
--proto_path
=
"
${
chain33_path
}
/types/proto/"
plugin/dapp/issuance/proto/issuance.proto
0 → 100644
View file @
550958aa
syntax
=
"proto3"
;
package
types
;
// 借贷信息
message
Issuance
{
string
issuanceId
=
1
;
//借贷ID,一期借贷对应一个ID
int64
totalBalance
=
2
;
//当期可借贷的总金额(ccny)
int64
debtCeiling
=
3
;
//单用户可借出的限额(ccny)
float
liquidationRatio
=
4
;
//清算比例
int64
collateralValue
=
5
;
//抵押物总数量(bty)
int64
debtValue
=
6
;
//产生的ccny数量
repeated
DebtRecord
debtRecords
=
7
;
//大户抵押记录
repeated
DebtRecord
invalidRecords
=
8
;
//大户抵押记录
int32
status
=
9
;
//当期借贷的状态,是否关闭
float
latestLiquidationPrice
=
10
;
//最高清算价格
int64
period
=
11
;
//借贷最大期限
int64
latestExpireTime
=
12
;
//最近超期时间
int64
createTime
=
13
;
//创建时间
int64
balance
=
14
;
//剩余可发行ccny
string
issuerAddr
=
15
;
//发行地址
}
// 抵押记录
message
DebtRecord
{
string
accountAddr
=
1
;
//借贷人地址
int64
startTime
=
2
;
//借贷时间
int64
collateralValue
=
3
;
//抵押物价值(bty)
float
collateralPrice
=
4
;
//抵押物价格
int64
debtValue
=
5
;
//债务价值(ccny)
float
liquidationPrice
=
6
;
//抵押物清算价格
int32
status
=
7
;
//抵押状态,是否被清算
int64
liquidateTime
=
8
;
//清算时间
int64
expireTime
=
9
;
//超时清算时间
int32
preStatus
=
10
;
//上一次抵押状态,用于告警恢复
}
// 资产价格记录
message
AssetPriceRecord
{
int64
recordTime
=
1
;
//价格记录时间
float
btyPrice
=
2
;
//bty价格
}
// action
message
IssuanceAction
{
oneof
value
{
IssuanceCreate
create
=
1
;
//创建一期借贷
IssuanceDebt
debt
=
2
;
//借贷
IssuanceRepay
repay
=
3
;
//清算
IssuanceFeed
feed
=
4
;
//喂价
IssuanceClose
close
=
5
;
//关闭
IssuanceManage
manage
=
6
;
//全局配置
}
int32
ty
=
10
;
}
message
IssuanceManage
{
repeated
string
superAddrs
=
1
;
//大户地址
}
// 创建借贷
message
IssuanceCreate
{
int64
totalBalance
=
1
;
//可借贷总金额
int64
debtCeiling
=
2
;
//单用户可借出的限额(ccny)
float
liquidationRatio
=
3
;
//清算比例
int64
period
=
4
;
//借贷最大期限
}
// 质押借出
message
IssuanceDebt
{
string
IssuanceId
=
1
;
//借贷期数ID
int64
value
=
2
;
//借贷价值(ccny)
}
// 质押清算
message
IssuanceRepay
{
string
IssuanceId
=
1
;
//借贷期数ID
}
// 喂价
message
IssuanceFeed
{
int32
collType
=
1
;
//抵押物价格类型(1,bty,2,btc,3,eth...)
repeated
float
price
=
2
;
//喂价
repeated
int64
volume
=
3
;
//成交量
}
// 借贷关闭
message
IssuanceClose
{
string
IssuanceId
=
1
;
//借贷期数ID
}
// exec_local 借贷信息
message
ReceiptIssuance
{
string
IssuanceId
=
1
;
string
accountAddr
=
2
;
int32
status
=
3
;
int32
preStatus
=
4
;
int64
index
=
5
;
int32
recordStatus
=
6
;
}
// exec_local 借贷记录信息
message
IssuanceRecord
{
string
IssuanceId
=
1
;
string
addr
=
2
;
int64
index
=
3
;
}
// exec_local 借贷记录信息列表
message
IssuanceRecords
{
repeated
IssuanceRecord
records
=
1
;
}
// 根据ID查询一期借贷信息
message
ReqIssuanceInfo
{
string
IssuanceId
=
1
;
}
// 返回一期借贷信息
message
RepIssuanceCurrentInfo
{
int32
status
=
1
;
//当期借贷的状态,是否关闭
int64
totalBalance
=
2
;
//当期可借贷的总金额(ccny)
int64
debtCeiling
=
3
;
//单用户可借出的限额(ccny)
float
liquidationRatio
=
4
;
//清算比例
int64
balance
=
5
;
//剩余可借贷金额(ccny)
int64
collateralValue
=
6
;
//抵押物总数量(bty)
int64
debtValue
=
7
;
//产生的ccny数量
}
// 根据ID列表查询多期借贷信息
message
ReqIssuanceInfos
{
repeated
string
IssuanceIds
=
1
;
}
// 返回多期借贷信息
message
RepIssuanceCurrentInfos
{
repeated
RepIssuanceCurrentInfo
infos
=
1
;
}
// 根据借贷状态查询
message
ReqIssuanceByStatus
{
int32
status
=
1
;
}
// 根据用户地址查询
message
ReqIssuanceByAddr
{
string
addr
=
1
;
}
// 返回借贷ID列表
message
RepIssuanceIDs
{
repeated
string
IDs
=
1
;
}
// 根据地址和借贷ID混合查询具体借贷记录
message
ReqIssuanceDebtInfoByAddr
{
string
IssuanceId
=
1
;
string
addr
=
2
;
}
// 根据状态和借贷ID混合查询具体借贷记录
message
ReqIssuanceDebtInfoByStatus
{
string
IssuanceId
=
1
;
int32
status
=
2
;
}
// 返回借贷记录
message
RepIssuanceDebtInfos
{
repeated
DebtRecord
record
=
1
;
}
plugin/dapp/issuance/types/errors.go
0 → 100644
View file @
550958aa
// Copyright Fuzamei Corp. 2018 All Rights Reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package
types
import
"errors"
// Errors for lottery
var
(
ErrRiskParam
=
errors
.
New
(
"ErrRiskParam"
)
ErrIssuanceRepeatHash
=
errors
.
New
(
"ErrIssuanceRepeatHash"
)
ErrIssuanceStatus
=
errors
.
New
(
"ErrIssuanceStatus"
)
ErrIssuanceExceedDebtCeiling
=
errors
.
New
(
"ErrIssuanceExceedDebtCeiling"
)
ErrPriceInvalid
=
errors
.
New
(
"ErrPriceInvalid"
)
ErrAssetType
=
errors
.
New
(
"ErrAssetType"
)
ErrRecordNotExist
=
errors
.
New
(
"ErrRecordNotExist"
)
ErrIssuanceErrCloser
=
errors
.
New
(
"ErrIssuanceErrCloser"
)
ErrRepayValueInsufficient
=
errors
.
New
(
"ErrRepayValueInsufficient"
)
ErrIssuanceAccountExist
=
errors
.
New
(
"ErrIssuanceAccountExist"
)
ErrIssuanceLowBalance
=
errors
.
New
(
"ErrIssuanceLowBalance"
)
ErrIssuanceBalanceInvalid
=
errors
.
New
(
"ErrIssuanceBalanceInvalid"
)
ErrPermissionDeny
=
errors
.
New
(
"ErrPermissionDeny"
)
ErrIssuanceRecordNotEmpty
=
errors
.
New
(
"ErrIssuanceRecordNotEmpty"
)
)
plugin/dapp/issuance/types/issuance.go
0 → 100644
View file @
550958aa
// Copyright Fuzamei Corp. 2018 All Rights Reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package
types
import
(
"encoding/json"
"reflect"
"github.com/33cn/chain33/common/address"
log
"github.com/33cn/chain33/common/log/log15"
"github.com/33cn/chain33/types"
)
var
(
llog
=
log
.
New
(
"module"
,
"exectype."
+
IssuanceX
)
)
func
init
()
{
types
.
AllowUserExec
=
append
(
types
.
AllowUserExec
,
[]
byte
(
IssuanceX
))
types
.
RegistorExecutor
(
IssuanceX
,
NewType
())
types
.
RegisterDappFork
(
IssuanceX
,
"Enable"
,
0
)
}
// IssuanceType def
type
IssuanceType
struct
{
types
.
ExecTypeBase
}
// NewType method
func
NewType
()
*
IssuanceType
{
c
:=
&
IssuanceType
{}
c
.
SetChild
(
c
)
return
c
}
// GetName 获取执行器名称
func
(
Issuance
*
IssuanceType
)
GetName
()
string
{
return
IssuanceX
}
// GetLogMap method
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"
},
TyLogIssuanceFeed
:
{
Ty
:
reflect
.
TypeOf
(
ReceiptIssuance
{}),
Name
:
"LogIssuanceFeed"
},
TyLogIssuanceClose
:
{
Ty
:
reflect
.
TypeOf
(
ReceiptIssuance
{}),
Name
:
"LogIssuanceClose"
},
}
}
// GetPayload method
func
(
Issuance
*
IssuanceType
)
GetPayload
()
types
.
Message
{
return
&
IssuanceAction
{}
}
// CreateTx method
func
(
Issuance
IssuanceType
)
CreateTx
(
action
string
,
message
json
.
RawMessage
)
(
*
types
.
Transaction
,
error
)
{
llog
.
Debug
(
"Issuance.CreateTx"
,
"action"
,
action
)
if
action
==
"IssuanceCreate"
{
var
param
IssuanceCreateTx
err
:=
json
.
Unmarshal
(
message
,
&
param
)
if
err
!=
nil
{
llog
.
Error
(
"CreateTx"
,
"Error"
,
err
)
return
nil
,
types
.
ErrInvalidParam
}
return
CreateRawIssuanceCreateTx
(
&
param
)
}
else
if
action
==
"IssuanceDebt"
{
var
param
IssuanceDebtTx
err
:=
json
.
Unmarshal
(
message
,
&
param
)
if
err
!=
nil
{
llog
.
Error
(
"CreateTx"
,
"Error"
,
err
)
return
nil
,
types
.
ErrInvalidParam
}
return
CreateRawIssuanceDebtTx
(
&
param
)
}
else
if
action
==
"IssuanceRepay"
{
var
param
IssuanceRepayTx
err
:=
json
.
Unmarshal
(
message
,
&
param
)
if
err
!=
nil
{
llog
.
Error
(
"CreateTx"
,
"Error"
,
err
)
return
nil
,
types
.
ErrInvalidParam
}
return
CreateRawIssuanceRepayTx
(
&
param
)
}
else
if
action
==
"IssuanceFeed"
{
var
param
IssuanceFeedTx
err
:=
json
.
Unmarshal
(
message
,
&
param
)
if
err
!=
nil
{
llog
.
Error
(
"CreateTx"
,
"Error"
,
err
)
return
nil
,
types
.
ErrInvalidParam
}
return
CreateRawIssuanceFeedTx
(
&
param
)
}
else
if
action
==
"IssuanceClose"
{
var
param
IssuanceCloseTx
err
:=
json
.
Unmarshal
(
message
,
&
param
)
if
err
!=
nil
{
llog
.
Error
(
"CreateTx"
,
"Error"
,
err
)
return
nil
,
types
.
ErrInvalidParam
}
return
CreateRawIssuanceCloseTx
(
&
param
)
}
else
if
action
==
"IssuanceManage"
{
var
param
IssuanceManageTx
err
:=
json
.
Unmarshal
(
message
,
&
param
)
if
err
!=
nil
{
llog
.
Error
(
"CreateTx"
,
"Error"
,
err
)
return
nil
,
types
.
ErrInvalidParam
}
return
CreateRawIssuanceManageTx
(
&
param
)
}
else
{
return
nil
,
types
.
ErrNotSupport
}
}
// GetTypeMap method
func
(
Issuance
IssuanceType
)
GetTypeMap
()
map
[
string
]
int32
{
return
map
[
string
]
int32
{
"Create"
:
IssuanceActionCreate
,
"Borrow"
:
IssuanceActionDebt
,
"Repay"
:
IssuanceActionRepay
,
"Feed"
:
IssuanceActionFeed
,
"Close"
:
IssuanceActionClose
,
"Manage"
:
IssuanceActionManage
,
}
}
// CreateRawIssuanceCreateTx method
func
CreateRawIssuanceCreateTx
(
parm
*
IssuanceCreateTx
)
(
*
types
.
Transaction
,
error
)
{
if
parm
==
nil
{
llog
.
Error
(
"CreateRawIssuanceCreateTx"
,
"parm"
,
parm
)
return
nil
,
types
.
ErrInvalidParam
}
v
:=
&
IssuanceCreate
{
TotalBalance
:
parm
.
TotalBalance
,
}
create
:=
&
IssuanceAction
{
Ty
:
IssuanceActionCreate
,
Value
:
&
IssuanceAction_Create
{
v
},
}
tx
:=
&
types
.
Transaction
{
Execer
:
[]
byte
(
types
.
ExecName
(
IssuanceX
)),
Payload
:
types
.
Encode
(
create
),
Fee
:
parm
.
Fee
,
To
:
address
.
ExecAddress
(
types
.
ExecName
(
IssuanceX
)),
}
name
:=
types
.
ExecName
(
IssuanceX
)
tx
,
err
:=
types
.
FormatTx
(
name
,
tx
)
if
err
!=
nil
{
return
nil
,
err
}
return
tx
,
nil
}
// CreateRawIssuanceDebtTx method
func
CreateRawIssuanceDebtTx
(
parm
*
IssuanceDebtTx
)
(
*
types
.
Transaction
,
error
)
{
if
parm
==
nil
{
llog
.
Error
(
"CreateRawIssuanceBorrowTx"
,
"parm"
,
parm
)
return
nil
,
types
.
ErrInvalidParam
}
v
:=
&
IssuanceDebt
{
IssuanceId
:
parm
.
IssuanceID
,
Value
:
parm
.
Value
,
}
debt
:=
&
IssuanceAction
{
Ty
:
IssuanceActionDebt
,
Value
:
&
IssuanceAction_Debt
{
v
},
}
tx
:=
&
types
.
Transaction
{
Execer
:
[]
byte
(
types
.
ExecName
(
IssuanceX
)),
Payload
:
types
.
Encode
(
debt
),
Fee
:
parm
.
Fee
,
To
:
address
.
ExecAddress
(
types
.
ExecName
(
IssuanceX
)),
}
name
:=
types
.
ExecName
(
IssuanceX
)
tx
,
err
:=
types
.
FormatTx
(
name
,
tx
)
if
err
!=
nil
{
return
nil
,
err
}
return
tx
,
nil
}
// CreateRawIssuanceRepayTx method
func
CreateRawIssuanceRepayTx
(
parm
*
IssuanceRepayTx
)
(
*
types
.
Transaction
,
error
)
{
if
parm
==
nil
{
llog
.
Error
(
"CreateRawIssuanceRepayTx"
,
"parm"
,
parm
)
return
nil
,
types
.
ErrInvalidParam
}
v
:=
&
IssuanceRepay
{
IssuanceId
:
parm
.
IssuanceID
,
}
repay
:=
&
IssuanceAction
{
Ty
:
IssuanceActionRepay
,
Value
:
&
IssuanceAction_Repay
{
v
},
}
tx
:=
&
types
.
Transaction
{
Execer
:
[]
byte
(
types
.
ExecName
(
IssuanceX
)),
Payload
:
types
.
Encode
(
repay
),
Fee
:
parm
.
Fee
,
To
:
address
.
ExecAddress
(
types
.
ExecName
(
IssuanceX
)),
}
name
:=
types
.
ExecName
(
IssuanceX
)
tx
,
err
:=
types
.
FormatTx
(
name
,
tx
)
if
err
!=
nil
{
return
nil
,
err
}
return
tx
,
nil
}
// CreateRawIssuanceFeedTx method
func
CreateRawIssuanceFeedTx
(
parm
*
IssuanceFeedTx
)
(
*
types
.
Transaction
,
error
)
{
if
parm
==
nil
{
llog
.
Error
(
"CreateRawIssuancePriceFeedTx"
,
"parm"
,
parm
)
return
nil
,
types
.
ErrInvalidParam
}
v
:=
&
IssuanceFeed
{
Price
:
parm
.
Price
,
Volume
:
parm
.
Volume
,
}
feed
:=
&
IssuanceAction
{
Ty
:
IssuanceActionFeed
,
Value
:
&
IssuanceAction_Feed
{
v
},
}
tx
:=
&
types
.
Transaction
{
Execer
:
[]
byte
(
types
.
ExecName
(
IssuanceX
)),
Payload
:
types
.
Encode
(
feed
),
Fee
:
parm
.
Fee
,
To
:
address
.
ExecAddress
(
types
.
ExecName
(
IssuanceX
)),
}
name
:=
types
.
ExecName
(
IssuanceX
)
tx
,
err
:=
types
.
FormatTx
(
name
,
tx
)
if
err
!=
nil
{
return
nil
,
err
}
return
tx
,
nil
}
// CreateRawIssuanceCloseTx method
func
CreateRawIssuanceCloseTx
(
parm
*
IssuanceCloseTx
)
(
*
types
.
Transaction
,
error
)
{
if
parm
==
nil
{
llog
.
Error
(
"CreateRawIssuanceCloseTx"
,
"parm"
,
parm
)
return
nil
,
types
.
ErrInvalidParam
}
v
:=
&
IssuanceClose
{
IssuanceId
:
parm
.
IssuanceID
,
}
close
:=
&
IssuanceAction
{
Ty
:
IssuanceActionClose
,
Value
:
&
IssuanceAction_Close
{
v
},
}
tx
:=
&
types
.
Transaction
{
Execer
:
[]
byte
(
types
.
ExecName
(
IssuanceX
)),
Payload
:
types
.
Encode
(
close
),
Fee
:
parm
.
Fee
,
To
:
address
.
ExecAddress
(
types
.
ExecName
(
IssuanceX
)),
}
name
:=
types
.
ExecName
(
IssuanceX
)
tx
,
err
:=
types
.
FormatTx
(
name
,
tx
)
if
err
!=
nil
{
return
nil
,
err
}
return
tx
,
nil
}
// CreateRawIssuanceManageTx method
func
CreateRawIssuanceManageTx
(
parm
*
IssuanceManageTx
)
(
*
types
.
Transaction
,
error
)
{
if
parm
==
nil
{
llog
.
Error
(
"CreateRawIssuanceManageTx"
,
"parm"
,
parm
)
return
nil
,
types
.
ErrInvalidParam
}
v
:=
&
IssuanceManage
{
SuperAddrs
:
parm
.
Addr
}
manage
:=
&
IssuanceAction
{
Ty
:
IssuanceActionManage
,
Value
:
&
IssuanceAction_Manage
{
v
},
}
tx
:=
&
types
.
Transaction
{
Execer
:
[]
byte
(
types
.
ExecName
(
IssuanceX
)),
Payload
:
types
.
Encode
(
manage
),
Fee
:
parm
.
Fee
,
To
:
address
.
ExecAddress
(
types
.
ExecName
(
IssuanceX
)),
}
name
:=
types
.
ExecName
(
IssuanceX
)
tx
,
err
:=
types
.
FormatTx
(
name
,
tx
)
if
err
!=
nil
{
return
nil
,
err
}
return
tx
,
nil
}
\ No newline at end of file
plugin/dapp/issuance/types/issuance.pb.go
0 → 100644
View file @
550958aa
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: issuance.proto
package
types
import
(
fmt
"fmt"
proto
"github.com/golang/protobuf/proto"
math
"math"
)
// Reference imports to suppress errors if they are not otherwise used.
var
_
=
proto
.
Marshal
var
_
=
fmt
.
Errorf
var
_
=
math
.
Inf
// This is a compile-time assertion to ensure that this generated file
// 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
.
ProtoPackageIsVersion3
// please upgrade the proto package
// 借贷信息
type
Issuance
struct
{
IssuanceId
string
`protobuf:"bytes,1,opt,name=issuanceId,proto3" json:"issuanceId,omitempty"`
TotalBalance
int64
`protobuf:"varint,2,opt,name=totalBalance,proto3" json:"totalBalance,omitempty"`
DebtCeiling
int64
`protobuf:"varint,3,opt,name=debtCeiling,proto3" json:"debtCeiling,omitempty"`
LiquidationRatio
float32
`protobuf:"fixed32,4,opt,name=liquidationRatio,proto3" json:"liquidationRatio,omitempty"`
CollateralValue
int64
`protobuf:"varint,5,opt,name=collateralValue,proto3" json:"collateralValue,omitempty"`
DebtValue
int64
`protobuf:"varint,6,opt,name=debtValue,proto3" json:"debtValue,omitempty"`
DebtRecords
[]
*
DebtRecord
`protobuf:"bytes,7,rep,name=debtRecords,proto3" json:"debtRecords,omitempty"`
InvalidRecords
[]
*
DebtRecord
`protobuf:"bytes,8,rep,name=invalidRecords,proto3" json:"invalidRecords,omitempty"`
Status
int32
`protobuf:"varint,9,opt,name=status,proto3" json:"status,omitempty"`
LatestLiquidationPrice
float32
`protobuf:"fixed32,10,opt,name=latestLiquidationPrice,proto3" json:"latestLiquidationPrice,omitempty"`
Period
int64
`protobuf:"varint,11,opt,name=period,proto3" json:"period,omitempty"`
LatestExpireTime
int64
`protobuf:"varint,12,opt,name=latestExpireTime,proto3" json:"latestExpireTime,omitempty"`
CreateTime
int64
`protobuf:"varint,13,opt,name=createTime,proto3" json:"createTime,omitempty"`
Balance
int64
`protobuf:"varint,14,opt,name=balance,proto3" json:"balance,omitempty"`
IssuerAddr
string
`protobuf:"bytes,15,opt,name=issuerAddr,proto3" json:"issuerAddr,omitempty"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
XXX_unrecognized
[]
byte
`json:"-"`
XXX_sizecache
int32
`json:"-"`
}
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
}
}
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
(
m
*
Issuance
)
XXX_Size
()
int
{
return
xxx_messageInfo_Issuance
.
Size
(
m
)
}
func
(
m
*
Issuance
)
XXX_DiscardUnknown
()
{
xxx_messageInfo_Issuance
.
DiscardUnknown
(
m
)
}
var
xxx_messageInfo_Issuance
proto
.
InternalMessageInfo
func
(
m
*
Issuance
)
GetIssuanceId
()
string
{
if
m
!=
nil
{
return
m
.
IssuanceId
}
return
""
}
func
(
m
*
Issuance
)
GetTotalBalance
()
int64
{
if
m
!=
nil
{
return
m
.
TotalBalance
}
return
0
}
func
(
m
*
Issuance
)
GetDebtCeiling
()
int64
{
if
m
!=
nil
{
return
m
.
DebtCeiling
}
return
0
}
func
(
m
*
Issuance
)
GetLiquidationRatio
()
float32
{
if
m
!=
nil
{
return
m
.
LiquidationRatio
}
return
0
}
func
(
m
*
Issuance
)
GetCollateralValue
()
int64
{
if
m
!=
nil
{
return
m
.
CollateralValue
}
return
0
}
func
(
m
*
Issuance
)
GetDebtValue
()
int64
{
if
m
!=
nil
{
return
m
.
DebtValue
}
return
0
}
func
(
m
*
Issuance
)
GetDebtRecords
()
[]
*
DebtRecord
{
if
m
!=
nil
{
return
m
.
DebtRecords
}
return
nil
}
func
(
m
*
Issuance
)
GetInvalidRecords
()
[]
*
DebtRecord
{
if
m
!=
nil
{
return
m
.
InvalidRecords
}
return
nil
}
func
(
m
*
Issuance
)
GetStatus
()
int32
{
if
m
!=
nil
{
return
m
.
Status
}
return
0
}
func
(
m
*
Issuance
)
GetLatestLiquidationPrice
()
float32
{
if
m
!=
nil
{
return
m
.
LatestLiquidationPrice
}
return
0
}
func
(
m
*
Issuance
)
GetPeriod
()
int64
{
if
m
!=
nil
{
return
m
.
Period
}
return
0
}
func
(
m
*
Issuance
)
GetLatestExpireTime
()
int64
{
if
m
!=
nil
{
return
m
.
LatestExpireTime
}
return
0
}
func
(
m
*
Issuance
)
GetCreateTime
()
int64
{
if
m
!=
nil
{
return
m
.
CreateTime
}
return
0
}
func
(
m
*
Issuance
)
GetBalance
()
int64
{
if
m
!=
nil
{
return
m
.
Balance
}
return
0
}
func
(
m
*
Issuance
)
GetIssuerAddr
()
string
{
if
m
!=
nil
{
return
m
.
IssuerAddr
}
return
""
}
// 抵押记录
type
DebtRecord
struct
{
AccountAddr
string
`protobuf:"bytes,1,opt,name=accountAddr,proto3" json:"accountAddr,omitempty"`
StartTime
int64
`protobuf:"varint,2,opt,name=startTime,proto3" json:"startTime,omitempty"`
CollateralValue
int64
`protobuf:"varint,3,opt,name=collateralValue,proto3" json:"collateralValue,omitempty"`
CollateralPrice
float32
`protobuf:"fixed32,4,opt,name=collateralPrice,proto3" json:"collateralPrice,omitempty"`
DebtValue
int64
`protobuf:"varint,5,opt,name=debtValue,proto3" json:"debtValue,omitempty"`
LiquidationPrice
float32
`protobuf:"fixed32,6,opt,name=liquidationPrice,proto3" json:"liquidationPrice,omitempty"`
Status
int32
`protobuf:"varint,7,opt,name=status,proto3" json:"status,omitempty"`
LiquidateTime
int64
`protobuf:"varint,8,opt,name=liquidateTime,proto3" json:"liquidateTime,omitempty"`
ExpireTime
int64
`protobuf:"varint,9,opt,name=expireTime,proto3" json:"expireTime,omitempty"`
PreStatus
int32
`protobuf:"varint,10,opt,name=preStatus,proto3" json:"preStatus,omitempty"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
XXX_unrecognized
[]
byte
`json:"-"`
XXX_sizecache
int32
`json:"-"`
}
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
}
}
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
(
m
*
DebtRecord
)
XXX_Size
()
int
{
return
xxx_messageInfo_DebtRecord
.
Size
(
m
)
}
func
(
m
*
DebtRecord
)
XXX_DiscardUnknown
()
{
xxx_messageInfo_DebtRecord
.
DiscardUnknown
(
m
)
}
var
xxx_messageInfo_DebtRecord
proto
.
InternalMessageInfo
func
(
m
*
DebtRecord
)
GetAccountAddr
()
string
{
if
m
!=
nil
{
return
m
.
AccountAddr
}
return
""
}
func
(
m
*
DebtRecord
)
GetStartTime
()
int64
{
if
m
!=
nil
{
return
m
.
StartTime
}
return
0
}
func
(
m
*
DebtRecord
)
GetCollateralValue
()
int64
{
if
m
!=
nil
{
return
m
.
CollateralValue
}
return
0
}
func
(
m
*
DebtRecord
)
GetCollateralPrice
()
float32
{
if
m
!=
nil
{
return
m
.
CollateralPrice
}
return
0
}
func
(
m
*
DebtRecord
)
GetDebtValue
()
int64
{
if
m
!=
nil
{
return
m
.
DebtValue
}
return
0
}
func
(
m
*
DebtRecord
)
GetLiquidationPrice
()
float32
{
if
m
!=
nil
{
return
m
.
LiquidationPrice
}
return
0
}
func
(
m
*
DebtRecord
)
GetStatus
()
int32
{
if
m
!=
nil
{
return
m
.
Status
}
return
0
}
func
(
m
*
DebtRecord
)
GetLiquidateTime
()
int64
{
if
m
!=
nil
{
return
m
.
LiquidateTime
}
return
0
}
func
(
m
*
DebtRecord
)
GetExpireTime
()
int64
{
if
m
!=
nil
{
return
m
.
ExpireTime
}
return
0
}
func
(
m
*
DebtRecord
)
GetPreStatus
()
int32
{
if
m
!=
nil
{
return
m
.
PreStatus
}
return
0
}
// 资产价格记录
type
AssetPriceRecord
struct
{
RecordTime
int64
`protobuf:"varint,1,opt,name=recordTime,proto3" json:"recordTime,omitempty"`
BtyPrice
float32
`protobuf:"fixed32,2,opt,name=btyPrice,proto3" json:"btyPrice,omitempty"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
XXX_unrecognized
[]
byte
`json:"-"`
XXX_sizecache
int32
`json:"-"`
}
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_7110f4228953d675
,
[]
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
(
m
*
AssetPriceRecord
)
XXX_Size
()
int
{
return
xxx_messageInfo_AssetPriceRecord
.
Size
(
m
)
}
func
(
m
*
AssetPriceRecord
)
XXX_DiscardUnknown
()
{
xxx_messageInfo_AssetPriceRecord
.
DiscardUnknown
(
m
)
}
var
xxx_messageInfo_AssetPriceRecord
proto
.
InternalMessageInfo
func
(
m
*
AssetPriceRecord
)
GetRecordTime
()
int64
{
if
m
!=
nil
{
return
m
.
RecordTime
}
return
0
}
func
(
m
*
AssetPriceRecord
)
GetBtyPrice
()
float32
{
if
m
!=
nil
{
return
m
.
BtyPrice
}
return
0
}
// action
type
IssuanceAction
struct
{
// Types that are valid to be assigned to Value:
// *IssuanceAction_Create
// *IssuanceAction_Debt
// *IssuanceAction_Repay
// *IssuanceAction_Feed
// *IssuanceAction_Close
// *IssuanceAction_Manage
Value
isIssuanceAction_Value
`protobuf_oneof:"value"`
Ty
int32
`protobuf:"varint,10,opt,name=ty,proto3" json:"ty,omitempty"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
XXX_unrecognized
[]
byte
`json:"-"`
XXX_sizecache
int32
`json:"-"`
}
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
}
}
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
(
m
*
IssuanceAction
)
XXX_Size
()
int
{
return
xxx_messageInfo_IssuanceAction
.
Size
(
m
)
}
func
(
m
*
IssuanceAction
)
XXX_DiscardUnknown
()
{
xxx_messageInfo_IssuanceAction
.
DiscardUnknown
(
m
)
}
var
xxx_messageInfo_IssuanceAction
proto
.
InternalMessageInfo
type
isIssuanceAction_Value
interface
{
isIssuanceAction_Value
()
}
type
IssuanceAction_Create
struct
{
Create
*
IssuanceCreate
`protobuf:"bytes,1,opt,name=create,proto3,oneof"`
}
type
IssuanceAction_Debt
struct
{
Debt
*
IssuanceDebt
`protobuf:"bytes,2,opt,name=debt,proto3,oneof"`
}
type
IssuanceAction_Repay
struct
{
Repay
*
IssuanceRepay
`protobuf:"bytes,3,opt,name=repay,proto3,oneof"`
}
type
IssuanceAction_Feed
struct
{
Feed
*
IssuanceFeed
`protobuf:"bytes,4,opt,name=feed,proto3,oneof"`
}
type
IssuanceAction_Close
struct
{
Close
*
IssuanceClose
`protobuf:"bytes,5,opt,name=close,proto3,oneof"`
}
type
IssuanceAction_Manage
struct
{
Manage
*
IssuanceManage
`protobuf:"bytes,6,opt,name=manage,proto3,oneof"`
}
func
(
*
IssuanceAction_Create
)
isIssuanceAction_Value
()
{}
func
(
*
IssuanceAction_Debt
)
isIssuanceAction_Value
()
{}
func
(
*
IssuanceAction_Repay
)
isIssuanceAction_Value
()
{}
func
(
*
IssuanceAction_Feed
)
isIssuanceAction_Value
()
{}
func
(
*
IssuanceAction_Close
)
isIssuanceAction_Value
()
{}
func
(
*
IssuanceAction_Manage
)
isIssuanceAction_Value
()
{}
func
(
m
*
IssuanceAction
)
GetValue
()
isIssuanceAction_Value
{
if
m
!=
nil
{
return
m
.
Value
}
return
nil
}
func
(
m
*
IssuanceAction
)
GetCreate
()
*
IssuanceCreate
{
if
x
,
ok
:=
m
.
GetValue
()
.
(
*
IssuanceAction_Create
);
ok
{
return
x
.
Create
}
return
nil
}
func
(
m
*
IssuanceAction
)
GetDebt
()
*
IssuanceDebt
{
if
x
,
ok
:=
m
.
GetValue
()
.
(
*
IssuanceAction_Debt
);
ok
{
return
x
.
Debt
}
return
nil
}
func
(
m
*
IssuanceAction
)
GetRepay
()
*
IssuanceRepay
{
if
x
,
ok
:=
m
.
GetValue
()
.
(
*
IssuanceAction_Repay
);
ok
{
return
x
.
Repay
}
return
nil
}
func
(
m
*
IssuanceAction
)
GetFeed
()
*
IssuanceFeed
{
if
x
,
ok
:=
m
.
GetValue
()
.
(
*
IssuanceAction_Feed
);
ok
{
return
x
.
Feed
}
return
nil
}
func
(
m
*
IssuanceAction
)
GetClose
()
*
IssuanceClose
{
if
x
,
ok
:=
m
.
GetValue
()
.
(
*
IssuanceAction_Close
);
ok
{
return
x
.
Close
}
return
nil
}
func
(
m
*
IssuanceAction
)
GetManage
()
*
IssuanceManage
{
if
x
,
ok
:=
m
.
GetValue
()
.
(
*
IssuanceAction_Manage
);
ok
{
return
x
.
Manage
}
return
nil
}
func
(
m
*
IssuanceAction
)
GetTy
()
int32
{
if
m
!=
nil
{
return
m
.
Ty
}
return
0
}
// XXX_OneofWrappers is for the internal use of the proto package.
func
(
*
IssuanceAction
)
XXX_OneofWrappers
()
[]
interface
{}
{
return
[]
interface
{}{
(
*
IssuanceAction_Create
)(
nil
),
(
*
IssuanceAction_Debt
)(
nil
),
(
*
IssuanceAction_Repay
)(
nil
),
(
*
IssuanceAction_Feed
)(
nil
),
(
*
IssuanceAction_Close
)(
nil
),
(
*
IssuanceAction_Manage
)(
nil
),
}
}
type
IssuanceManage
struct
{
SuperAddrs
[]
string
`protobuf:"bytes,1,rep,name=superAddrs,proto3" json:"superAddrs,omitempty"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
XXX_unrecognized
[]
byte
`json:"-"`
XXX_sizecache
int32
`json:"-"`
}
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
}
}
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
(
m
*
IssuanceManage
)
XXX_Size
()
int
{
return
xxx_messageInfo_IssuanceManage
.
Size
(
m
)
}
func
(
m
*
IssuanceManage
)
XXX_DiscardUnknown
()
{
xxx_messageInfo_IssuanceManage
.
DiscardUnknown
(
m
)
}
var
xxx_messageInfo_IssuanceManage
proto
.
InternalMessageInfo
func
(
m
*
IssuanceManage
)
GetSuperAddrs
()
[]
string
{
if
m
!=
nil
{
return
m
.
SuperAddrs
}
return
nil
}
// 创建借贷
type
IssuanceCreate
struct
{
TotalBalance
int64
`protobuf:"varint,1,opt,name=totalBalance,proto3" json:"totalBalance,omitempty"`
DebtCeiling
int64
`protobuf:"varint,2,opt,name=debtCeiling,proto3" json:"debtCeiling,omitempty"`
LiquidationRatio
float32
`protobuf:"fixed32,3,opt,name=liquidationRatio,proto3" json:"liquidationRatio,omitempty"`
Period
int64
`protobuf:"varint,4,opt,name=period,proto3" json:"period,omitempty"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
XXX_unrecognized
[]
byte
`json:"-"`
XXX_sizecache
int32
`json:"-"`
}
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
}
}
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
(
m
*
IssuanceCreate
)
XXX_Size
()
int
{
return
xxx_messageInfo_IssuanceCreate
.
Size
(
m
)
}
func
(
m
*
IssuanceCreate
)
XXX_DiscardUnknown
()
{
xxx_messageInfo_IssuanceCreate
.
DiscardUnknown
(
m
)
}
var
xxx_messageInfo_IssuanceCreate
proto
.
InternalMessageInfo
func
(
m
*
IssuanceCreate
)
GetTotalBalance
()
int64
{
if
m
!=
nil
{
return
m
.
TotalBalance
}
return
0
}
func
(
m
*
IssuanceCreate
)
GetDebtCeiling
()
int64
{
if
m
!=
nil
{
return
m
.
DebtCeiling
}
return
0
}
func
(
m
*
IssuanceCreate
)
GetLiquidationRatio
()
float32
{
if
m
!=
nil
{
return
m
.
LiquidationRatio
}
return
0
}
func
(
m
*
IssuanceCreate
)
GetPeriod
()
int64
{
if
m
!=
nil
{
return
m
.
Period
}
return
0
}
// 质押借出
type
IssuanceDebt
struct
{
IssuanceId
string
`protobuf:"bytes,1,opt,name=IssuanceId,proto3" json:"IssuanceId,omitempty"`
Value
int64
`protobuf:"varint,2,opt,name=value,proto3" json:"value,omitempty"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
XXX_unrecognized
[]
byte
`json:"-"`
XXX_sizecache
int32
`json:"-"`
}
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
}
}
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
(
m
*
IssuanceDebt
)
XXX_Size
()
int
{
return
xxx_messageInfo_IssuanceDebt
.
Size
(
m
)
}
func
(
m
*
IssuanceDebt
)
XXX_DiscardUnknown
()
{
xxx_messageInfo_IssuanceDebt
.
DiscardUnknown
(
m
)
}
var
xxx_messageInfo_IssuanceDebt
proto
.
InternalMessageInfo
func
(
m
*
IssuanceDebt
)
GetIssuanceId
()
string
{
if
m
!=
nil
{
return
m
.
IssuanceId
}
return
""
}
func
(
m
*
IssuanceDebt
)
GetValue
()
int64
{
if
m
!=
nil
{
return
m
.
Value
}
return
0
}
// 质押清算
type
IssuanceRepay
struct
{
IssuanceId
string
`protobuf:"bytes,1,opt,name=IssuanceId,proto3" json:"IssuanceId,omitempty"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
XXX_unrecognized
[]
byte
`json:"-"`
XXX_sizecache
int32
`json:"-"`
}
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
}
}
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
(
m
*
IssuanceRepay
)
XXX_Size
()
int
{
return
xxx_messageInfo_IssuanceRepay
.
Size
(
m
)
}
func
(
m
*
IssuanceRepay
)
XXX_DiscardUnknown
()
{
xxx_messageInfo_IssuanceRepay
.
DiscardUnknown
(
m
)
}
var
xxx_messageInfo_IssuanceRepay
proto
.
InternalMessageInfo
func
(
m
*
IssuanceRepay
)
GetIssuanceId
()
string
{
if
m
!=
nil
{
return
m
.
IssuanceId
}
return
""
}
// 喂价
type
IssuanceFeed
struct
{
CollType
int32
`protobuf:"varint,1,opt,name=collType,proto3" json:"collType,omitempty"`
Price
[]
float32
`protobuf:"fixed32,2,rep,packed,name=price,proto3" json:"price,omitempty"`
Volume
[]
int64
`protobuf:"varint,3,rep,packed,name=volume,proto3" json:"volume,omitempty"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
XXX_unrecognized
[]
byte
`json:"-"`
XXX_sizecache
int32
`json:"-"`
}
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
}
}
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
(
m
*
IssuanceFeed
)
XXX_Size
()
int
{
return
xxx_messageInfo_IssuanceFeed
.
Size
(
m
)
}
func
(
m
*
IssuanceFeed
)
XXX_DiscardUnknown
()
{
xxx_messageInfo_IssuanceFeed
.
DiscardUnknown
(
m
)
}
var
xxx_messageInfo_IssuanceFeed
proto
.
InternalMessageInfo
func
(
m
*
IssuanceFeed
)
GetCollType
()
int32
{
if
m
!=
nil
{
return
m
.
CollType
}
return
0
}
func
(
m
*
IssuanceFeed
)
GetPrice
()
[]
float32
{
if
m
!=
nil
{
return
m
.
Price
}
return
nil
}
func
(
m
*
IssuanceFeed
)
GetVolume
()
[]
int64
{
if
m
!=
nil
{
return
m
.
Volume
}
return
nil
}
// 借贷关闭
type
IssuanceClose
struct
{
IssuanceId
string
`protobuf:"bytes,1,opt,name=IssuanceId,proto3" json:"IssuanceId,omitempty"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
XXX_unrecognized
[]
byte
`json:"-"`
XXX_sizecache
int32
`json:"-"`
}
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
}
}
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
(
m
*
IssuanceClose
)
XXX_Size
()
int
{
return
xxx_messageInfo_IssuanceClose
.
Size
(
m
)
}
func
(
m
*
IssuanceClose
)
XXX_DiscardUnknown
()
{
xxx_messageInfo_IssuanceClose
.
DiscardUnknown
(
m
)
}
var
xxx_messageInfo_IssuanceClose
proto
.
InternalMessageInfo
func
(
m
*
IssuanceClose
)
GetIssuanceId
()
string
{
if
m
!=
nil
{
return
m
.
IssuanceId
}
return
""
}
// exec_local 借贷信息
type
ReceiptIssuance
struct
{
IssuanceId
string
`protobuf:"bytes,1,opt,name=IssuanceId,proto3" json:"IssuanceId,omitempty"`
AccountAddr
string
`protobuf:"bytes,2,opt,name=accountAddr,proto3" json:"accountAddr,omitempty"`
Status
int32
`protobuf:"varint,3,opt,name=status,proto3" json:"status,omitempty"`
PreStatus
int32
`protobuf:"varint,4,opt,name=preStatus,proto3" json:"preStatus,omitempty"`
Index
int64
`protobuf:"varint,5,opt,name=index,proto3" json:"index,omitempty"`
RecordStatus
int32
`protobuf:"varint,6,opt,name=recordStatus,proto3" json:"recordStatus,omitempty"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
XXX_unrecognized
[]
byte
`json:"-"`
XXX_sizecache
int32
`json:"-"`
}
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
}
}
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
(
m
*
ReceiptIssuance
)
XXX_Size
()
int
{
return
xxx_messageInfo_ReceiptIssuance
.
Size
(
m
)
}
func
(
m
*
ReceiptIssuance
)
XXX_DiscardUnknown
()
{
xxx_messageInfo_ReceiptIssuance
.
DiscardUnknown
(
m
)
}
var
xxx_messageInfo_ReceiptIssuance
proto
.
InternalMessageInfo
func
(
m
*
ReceiptIssuance
)
GetIssuanceId
()
string
{
if
m
!=
nil
{
return
m
.
IssuanceId
}
return
""
}
func
(
m
*
ReceiptIssuance
)
GetAccountAddr
()
string
{
if
m
!=
nil
{
return
m
.
AccountAddr
}
return
""
}
func
(
m
*
ReceiptIssuance
)
GetStatus
()
int32
{
if
m
!=
nil
{
return
m
.
Status
}
return
0
}
func
(
m
*
ReceiptIssuance
)
GetPreStatus
()
int32
{
if
m
!=
nil
{
return
m
.
PreStatus
}
return
0
}
func
(
m
*
ReceiptIssuance
)
GetIndex
()
int64
{
if
m
!=
nil
{
return
m
.
Index
}
return
0
}
func
(
m
*
ReceiptIssuance
)
GetRecordStatus
()
int32
{
if
m
!=
nil
{
return
m
.
RecordStatus
}
return
0
}
// exec_local 借贷记录信息
type
IssuanceRecord
struct
{
IssuanceId
string
`protobuf:"bytes,1,opt,name=IssuanceId,proto3" json:"IssuanceId,omitempty"`
Addr
string
`protobuf:"bytes,2,opt,name=addr,proto3" json:"addr,omitempty"`
Index
int64
`protobuf:"varint,3,opt,name=index,proto3" json:"index,omitempty"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
XXX_unrecognized
[]
byte
`json:"-"`
XXX_sizecache
int32
`json:"-"`
}
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
}
}
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
(
m
*
IssuanceRecord
)
XXX_Size
()
int
{
return
xxx_messageInfo_IssuanceRecord
.
Size
(
m
)
}
func
(
m
*
IssuanceRecord
)
XXX_DiscardUnknown
()
{
xxx_messageInfo_IssuanceRecord
.
DiscardUnknown
(
m
)
}
var
xxx_messageInfo_IssuanceRecord
proto
.
InternalMessageInfo
func
(
m
*
IssuanceRecord
)
GetIssuanceId
()
string
{
if
m
!=
nil
{
return
m
.
IssuanceId
}
return
""
}
func
(
m
*
IssuanceRecord
)
GetAddr
()
string
{
if
m
!=
nil
{
return
m
.
Addr
}
return
""
}
func
(
m
*
IssuanceRecord
)
GetIndex
()
int64
{
if
m
!=
nil
{
return
m
.
Index
}
return
0
}
// exec_local 借贷记录信息列表
type
IssuanceRecords
struct
{
Records
[]
*
IssuanceRecord
`protobuf:"bytes,1,rep,name=records,proto3" json:"records,omitempty"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
XXX_unrecognized
[]
byte
`json:"-"`
XXX_sizecache
int32
`json:"-"`
}
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
}
}
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
(
m
*
IssuanceRecords
)
XXX_Size
()
int
{
return
xxx_messageInfo_IssuanceRecords
.
Size
(
m
)
}
func
(
m
*
IssuanceRecords
)
XXX_DiscardUnknown
()
{
xxx_messageInfo_IssuanceRecords
.
DiscardUnknown
(
m
)
}
var
xxx_messageInfo_IssuanceRecords
proto
.
InternalMessageInfo
func
(
m
*
IssuanceRecords
)
GetRecords
()
[]
*
IssuanceRecord
{
if
m
!=
nil
{
return
m
.
Records
}
return
nil
}
// 根据ID查询一期借贷信息
type
ReqIssuanceInfo
struct
{
IssuanceId
string
`protobuf:"bytes,1,opt,name=IssuanceId,proto3" json:"IssuanceId,omitempty"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
XXX_unrecognized
[]
byte
`json:"-"`
XXX_sizecache
int32
`json:"-"`
}
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
}
}
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
(
m
*
ReqIssuanceInfo
)
XXX_Size
()
int
{
return
xxx_messageInfo_ReqIssuanceInfo
.
Size
(
m
)
}
func
(
m
*
ReqIssuanceInfo
)
XXX_DiscardUnknown
()
{
xxx_messageInfo_ReqIssuanceInfo
.
DiscardUnknown
(
m
)
}
var
xxx_messageInfo_ReqIssuanceInfo
proto
.
InternalMessageInfo
func
(
m
*
ReqIssuanceInfo
)
GetIssuanceId
()
string
{
if
m
!=
nil
{
return
m
.
IssuanceId
}
return
""
}
// 返回一期借贷信息
type
RepIssuanceCurrentInfo
struct
{
Status
int32
`protobuf:"varint,1,opt,name=status,proto3" json:"status,omitempty"`
TotalBalance
int64
`protobuf:"varint,2,opt,name=totalBalance,proto3" json:"totalBalance,omitempty"`
DebtCeiling
int64
`protobuf:"varint,3,opt,name=debtCeiling,proto3" json:"debtCeiling,omitempty"`
LiquidationRatio
float32
`protobuf:"fixed32,4,opt,name=liquidationRatio,proto3" json:"liquidationRatio,omitempty"`
Balance
int64
`protobuf:"varint,5,opt,name=balance,proto3" json:"balance,omitempty"`
CollateralValue
int64
`protobuf:"varint,6,opt,name=collateralValue,proto3" json:"collateralValue,omitempty"`
DebtValue
int64
`protobuf:"varint,7,opt,name=debtValue,proto3" json:"debtValue,omitempty"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
XXX_unrecognized
[]
byte
`json:"-"`
XXX_sizecache
int32
`json:"-"`
}
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
}
}
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
(
m
*
RepIssuanceCurrentInfo
)
XXX_Size
()
int
{
return
xxx_messageInfo_RepIssuanceCurrentInfo
.
Size
(
m
)
}
func
(
m
*
RepIssuanceCurrentInfo
)
XXX_DiscardUnknown
()
{
xxx_messageInfo_RepIssuanceCurrentInfo
.
DiscardUnknown
(
m
)
}
var
xxx_messageInfo_RepIssuanceCurrentInfo
proto
.
InternalMessageInfo
func
(
m
*
RepIssuanceCurrentInfo
)
GetStatus
()
int32
{
if
m
!=
nil
{
return
m
.
Status
}
return
0
}
func
(
m
*
RepIssuanceCurrentInfo
)
GetTotalBalance
()
int64
{
if
m
!=
nil
{
return
m
.
TotalBalance
}
return
0
}
func
(
m
*
RepIssuanceCurrentInfo
)
GetDebtCeiling
()
int64
{
if
m
!=
nil
{
return
m
.
DebtCeiling
}
return
0
}
func
(
m
*
RepIssuanceCurrentInfo
)
GetLiquidationRatio
()
float32
{
if
m
!=
nil
{
return
m
.
LiquidationRatio
}
return
0
}
func
(
m
*
RepIssuanceCurrentInfo
)
GetBalance
()
int64
{
if
m
!=
nil
{
return
m
.
Balance
}
return
0
}
func
(
m
*
RepIssuanceCurrentInfo
)
GetCollateralValue
()
int64
{
if
m
!=
nil
{
return
m
.
CollateralValue
}
return
0
}
func
(
m
*
RepIssuanceCurrentInfo
)
GetDebtValue
()
int64
{
if
m
!=
nil
{
return
m
.
DebtValue
}
return
0
}
// 根据ID列表查询多期借贷信息
type
ReqIssuanceInfos
struct
{
IssuanceIds
[]
string
`protobuf:"bytes,1,rep,name=IssuanceIds,proto3" json:"IssuanceIds,omitempty"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
XXX_unrecognized
[]
byte
`json:"-"`
XXX_sizecache
int32
`json:"-"`
}
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
}
}
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
(
m
*
ReqIssuanceInfos
)
XXX_Size
()
int
{
return
xxx_messageInfo_ReqIssuanceInfos
.
Size
(
m
)
}
func
(
m
*
ReqIssuanceInfos
)
XXX_DiscardUnknown
()
{
xxx_messageInfo_ReqIssuanceInfos
.
DiscardUnknown
(
m
)
}
var
xxx_messageInfo_ReqIssuanceInfos
proto
.
InternalMessageInfo
func
(
m
*
ReqIssuanceInfos
)
GetIssuanceIds
()
[]
string
{
if
m
!=
nil
{
return
m
.
IssuanceIds
}
return
nil
}
// 返回多期借贷信息
type
RepIssuanceCurrentInfos
struct
{
Infos
[]
*
RepIssuanceCurrentInfo
`protobuf:"bytes,1,rep,name=infos,proto3" json:"infos,omitempty"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
XXX_unrecognized
[]
byte
`json:"-"`
XXX_sizecache
int32
`json:"-"`
}
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
}
}
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
(
m
*
RepIssuanceCurrentInfos
)
XXX_Size
()
int
{
return
xxx_messageInfo_RepIssuanceCurrentInfos
.
Size
(
m
)
}
func
(
m
*
RepIssuanceCurrentInfos
)
XXX_DiscardUnknown
()
{
xxx_messageInfo_RepIssuanceCurrentInfos
.
DiscardUnknown
(
m
)
}
var
xxx_messageInfo_RepIssuanceCurrentInfos
proto
.
InternalMessageInfo
func
(
m
*
RepIssuanceCurrentInfos
)
GetInfos
()
[]
*
RepIssuanceCurrentInfo
{
if
m
!=
nil
{
return
m
.
Infos
}
return
nil
}
// 根据借贷状态查询
type
ReqIssuanceByStatus
struct
{
Status
int32
`protobuf:"varint,1,opt,name=status,proto3" json:"status,omitempty"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
XXX_unrecognized
[]
byte
`json:"-"`
XXX_sizecache
int32
`json:"-"`
}
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
}
}
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
(
m
*
ReqIssuanceByStatus
)
XXX_Size
()
int
{
return
xxx_messageInfo_ReqIssuanceByStatus
.
Size
(
m
)
}
func
(
m
*
ReqIssuanceByStatus
)
XXX_DiscardUnknown
()
{
xxx_messageInfo_ReqIssuanceByStatus
.
DiscardUnknown
(
m
)
}
var
xxx_messageInfo_ReqIssuanceByStatus
proto
.
InternalMessageInfo
func
(
m
*
ReqIssuanceByStatus
)
GetStatus
()
int32
{
if
m
!=
nil
{
return
m
.
Status
}
return
0
}
// 根据用户地址查询
type
ReqIssuanceByAddr
struct
{
Addr
string
`protobuf:"bytes,1,opt,name=addr,proto3" json:"addr,omitempty"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
XXX_unrecognized
[]
byte
`json:"-"`
XXX_sizecache
int32
`json:"-"`
}
func
(
m
*
ReqIssuanceByAddr
)
Reset
()
{
*
m
=
ReqIssuanceByAddr
{}
}
func
(
m
*
ReqIssuanceByAddr
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
ReqIssuanceByAddr
)
ProtoMessage
()
{}
func
(
*
ReqIssuanceByAddr
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_7110f4228953d675
,
[]
int
{
18
}
}
func
(
m
*
ReqIssuanceByAddr
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_ReqIssuanceByAddr
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
ReqIssuanceByAddr
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_ReqIssuanceByAddr
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
ReqIssuanceByAddr
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_ReqIssuanceByAddr
.
Merge
(
m
,
src
)
}
func
(
m
*
ReqIssuanceByAddr
)
XXX_Size
()
int
{
return
xxx_messageInfo_ReqIssuanceByAddr
.
Size
(
m
)
}
func
(
m
*
ReqIssuanceByAddr
)
XXX_DiscardUnknown
()
{
xxx_messageInfo_ReqIssuanceByAddr
.
DiscardUnknown
(
m
)
}
var
xxx_messageInfo_ReqIssuanceByAddr
proto
.
InternalMessageInfo
func
(
m
*
ReqIssuanceByAddr
)
GetAddr
()
string
{
if
m
!=
nil
{
return
m
.
Addr
}
return
""
}
// 返回借贷ID列表
type
RepIssuanceIDs
struct
{
IDs
[]
string
`protobuf:"bytes,1,rep,name=IDs,proto3" json:"IDs,omitempty"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
XXX_unrecognized
[]
byte
`json:"-"`
XXX_sizecache
int32
`json:"-"`
}
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
{
19
}
}
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
(
m
*
RepIssuanceIDs
)
XXX_Size
()
int
{
return
xxx_messageInfo_RepIssuanceIDs
.
Size
(
m
)
}
func
(
m
*
RepIssuanceIDs
)
XXX_DiscardUnknown
()
{
xxx_messageInfo_RepIssuanceIDs
.
DiscardUnknown
(
m
)
}
var
xxx_messageInfo_RepIssuanceIDs
proto
.
InternalMessageInfo
func
(
m
*
RepIssuanceIDs
)
GetIDs
()
[]
string
{
if
m
!=
nil
{
return
m
.
IDs
}
return
nil
}
// 根据地址和借贷ID混合查询具体借贷记录
type
ReqIssuanceDebtInfoByAddr
struct
{
IssuanceId
string
`protobuf:"bytes,1,opt,name=IssuanceId,proto3" json:"IssuanceId,omitempty"`
Addr
string
`protobuf:"bytes,2,opt,name=addr,proto3" json:"addr,omitempty"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
XXX_unrecognized
[]
byte
`json:"-"`
XXX_sizecache
int32
`json:"-"`
}
func
(
m
*
ReqIssuanceDebtInfoByAddr
)
Reset
()
{
*
m
=
ReqIssuanceDebtInfoByAddr
{}
}
func
(
m
*
ReqIssuanceDebtInfoByAddr
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
ReqIssuanceDebtInfoByAddr
)
ProtoMessage
()
{}
func
(
*
ReqIssuanceDebtInfoByAddr
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_7110f4228953d675
,
[]
int
{
20
}
}
func
(
m
*
ReqIssuanceDebtInfoByAddr
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_ReqIssuanceDebtInfoByAddr
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
ReqIssuanceDebtInfoByAddr
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_ReqIssuanceDebtInfoByAddr
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
ReqIssuanceDebtInfoByAddr
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_ReqIssuanceDebtInfoByAddr
.
Merge
(
m
,
src
)
}
func
(
m
*
ReqIssuanceDebtInfoByAddr
)
XXX_Size
()
int
{
return
xxx_messageInfo_ReqIssuanceDebtInfoByAddr
.
Size
(
m
)
}
func
(
m
*
ReqIssuanceDebtInfoByAddr
)
XXX_DiscardUnknown
()
{
xxx_messageInfo_ReqIssuanceDebtInfoByAddr
.
DiscardUnknown
(
m
)
}
var
xxx_messageInfo_ReqIssuanceDebtInfoByAddr
proto
.
InternalMessageInfo
func
(
m
*
ReqIssuanceDebtInfoByAddr
)
GetIssuanceId
()
string
{
if
m
!=
nil
{
return
m
.
IssuanceId
}
return
""
}
func
(
m
*
ReqIssuanceDebtInfoByAddr
)
GetAddr
()
string
{
if
m
!=
nil
{
return
m
.
Addr
}
return
""
}
// 根据状态和借贷ID混合查询具体借贷记录
type
ReqIssuanceDebtInfoByStatus
struct
{
IssuanceId
string
`protobuf:"bytes,1,opt,name=IssuanceId,proto3" json:"IssuanceId,omitempty"`
Status
int32
`protobuf:"varint,2,opt,name=status,proto3" json:"status,omitempty"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
XXX_unrecognized
[]
byte
`json:"-"`
XXX_sizecache
int32
`json:"-"`
}
func
(
m
*
ReqIssuanceDebtInfoByStatus
)
Reset
()
{
*
m
=
ReqIssuanceDebtInfoByStatus
{}
}
func
(
m
*
ReqIssuanceDebtInfoByStatus
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
ReqIssuanceDebtInfoByStatus
)
ProtoMessage
()
{}
func
(
*
ReqIssuanceDebtInfoByStatus
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_7110f4228953d675
,
[]
int
{
21
}
}
func
(
m
*
ReqIssuanceDebtInfoByStatus
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_ReqIssuanceDebtInfoByStatus
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
ReqIssuanceDebtInfoByStatus
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_ReqIssuanceDebtInfoByStatus
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
ReqIssuanceDebtInfoByStatus
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_ReqIssuanceDebtInfoByStatus
.
Merge
(
m
,
src
)
}
func
(
m
*
ReqIssuanceDebtInfoByStatus
)
XXX_Size
()
int
{
return
xxx_messageInfo_ReqIssuanceDebtInfoByStatus
.
Size
(
m
)
}
func
(
m
*
ReqIssuanceDebtInfoByStatus
)
XXX_DiscardUnknown
()
{
xxx_messageInfo_ReqIssuanceDebtInfoByStatus
.
DiscardUnknown
(
m
)
}
var
xxx_messageInfo_ReqIssuanceDebtInfoByStatus
proto
.
InternalMessageInfo
func
(
m
*
ReqIssuanceDebtInfoByStatus
)
GetIssuanceId
()
string
{
if
m
!=
nil
{
return
m
.
IssuanceId
}
return
""
}
func
(
m
*
ReqIssuanceDebtInfoByStatus
)
GetStatus
()
int32
{
if
m
!=
nil
{
return
m
.
Status
}
return
0
}
// 返回借贷记录
type
RepIssuanceDebtInfos
struct
{
Record
[]
*
DebtRecord
`protobuf:"bytes,1,rep,name=record,proto3" json:"record,omitempty"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
XXX_unrecognized
[]
byte
`json:"-"`
XXX_sizecache
int32
`json:"-"`
}
func
(
m
*
RepIssuanceDebtInfos
)
Reset
()
{
*
m
=
RepIssuanceDebtInfos
{}
}
func
(
m
*
RepIssuanceDebtInfos
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
RepIssuanceDebtInfos
)
ProtoMessage
()
{}
func
(
*
RepIssuanceDebtInfos
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_7110f4228953d675
,
[]
int
{
22
}
}
func
(
m
*
RepIssuanceDebtInfos
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_RepIssuanceDebtInfos
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
RepIssuanceDebtInfos
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_RepIssuanceDebtInfos
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
RepIssuanceDebtInfos
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_RepIssuanceDebtInfos
.
Merge
(
m
,
src
)
}
func
(
m
*
RepIssuanceDebtInfos
)
XXX_Size
()
int
{
return
xxx_messageInfo_RepIssuanceDebtInfos
.
Size
(
m
)
}
func
(
m
*
RepIssuanceDebtInfos
)
XXX_DiscardUnknown
()
{
xxx_messageInfo_RepIssuanceDebtInfos
.
DiscardUnknown
(
m
)
}
var
xxx_messageInfo_RepIssuanceDebtInfos
proto
.
InternalMessageInfo
func
(
m
*
RepIssuanceDebtInfos
)
GetRecord
()
[]
*
DebtRecord
{
if
m
!=
nil
{
return
m
.
Record
}
return
nil
}
func
init
()
{
proto
.
RegisterType
((
*
Issuance
)(
nil
),
"types.Issuance"
)
proto
.
RegisterType
((
*
DebtRecord
)(
nil
),
"types.DebtRecord"
)
proto
.
RegisterType
((
*
AssetPriceRecord
)(
nil
),
"types.AssetPriceRecord"
)
proto
.
RegisterType
((
*
IssuanceAction
)(
nil
),
"types.IssuanceAction"
)
proto
.
RegisterType
((
*
IssuanceManage
)(
nil
),
"types.IssuanceManage"
)
proto
.
RegisterType
((
*
IssuanceCreate
)(
nil
),
"types.IssuanceCreate"
)
proto
.
RegisterType
((
*
IssuanceDebt
)(
nil
),
"types.IssuanceDebt"
)
proto
.
RegisterType
((
*
IssuanceRepay
)(
nil
),
"types.IssuanceRepay"
)
proto
.
RegisterType
((
*
IssuanceFeed
)(
nil
),
"types.IssuanceFeed"
)
proto
.
RegisterType
((
*
IssuanceClose
)(
nil
),
"types.IssuanceClose"
)
proto
.
RegisterType
((
*
ReceiptIssuance
)(
nil
),
"types.ReceiptIssuance"
)
proto
.
RegisterType
((
*
IssuanceRecord
)(
nil
),
"types.IssuanceRecord"
)
proto
.
RegisterType
((
*
IssuanceRecords
)(
nil
),
"types.IssuanceRecords"
)
proto
.
RegisterType
((
*
ReqIssuanceInfo
)(
nil
),
"types.ReqIssuanceInfo"
)
proto
.
RegisterType
((
*
RepIssuanceCurrentInfo
)(
nil
),
"types.RepIssuanceCurrentInfo"
)
proto
.
RegisterType
((
*
ReqIssuanceInfos
)(
nil
),
"types.ReqIssuanceInfos"
)
proto
.
RegisterType
((
*
RepIssuanceCurrentInfos
)(
nil
),
"types.RepIssuanceCurrentInfos"
)
proto
.
RegisterType
((
*
ReqIssuanceByStatus
)(
nil
),
"types.ReqIssuanceByStatus"
)
proto
.
RegisterType
((
*
ReqIssuanceByAddr
)(
nil
),
"types.ReqIssuanceByAddr"
)
proto
.
RegisterType
((
*
RepIssuanceIDs
)(
nil
),
"types.RepIssuanceIDs"
)
proto
.
RegisterType
((
*
ReqIssuanceDebtInfoByAddr
)(
nil
),
"types.ReqIssuanceDebtInfoByAddr"
)
proto
.
RegisterType
((
*
ReqIssuanceDebtInfoByStatus
)(
nil
),
"types.ReqIssuanceDebtInfoByStatus"
)
proto
.
RegisterType
((
*
RepIssuanceDebtInfos
)(
nil
),
"types.RepIssuanceDebtInfos"
)
}
func
init
()
{
proto
.
RegisterFile
(
"issuance.proto"
,
fileDescriptor_7110f4228953d675
)
}
var
fileDescriptor_7110f4228953d675
=
[]
byte
{
// 996 bytes of a gzipped FileDescriptorProto
0x1f
,
0x8b
,
0x08
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x02
,
0xff
,
0xbc
,
0x56
,
0xdd
,
0x6e
,
0xe4
,
0x34
,
0x14
,
0x6e
,
0x92
,
0xf9
,
0x69
,
0xcf
,
0xb4
,
0xd3
,
0xae
,
0xb7
,
0x5b
,
0xc2
,
0xdf
,
0x6a
,
0x64
,
0x21
,
0x31
,
0x8b
,
0xa0
,
0x85
,
0x16
,
0x21
,
0x71
,
0xd9
,
0x1f
,
0x50
,
0x47
,
0x82
,
0x05
,
0x85
,
0x05
,
0x21
,
0xee
,
0xd2
,
0xc4
,
0x5d
,
0x45
,
0x4a
,
0x93
,
0x6c
,
0xec
,
0x54
,
0x3b
,
0xf7
,
0x3c
,
0x05
,
0xef
,
0xc2
,
0x0d
,
0xbc
,
0x0b
,
0xcf
,
0x81
,
0xce
,
0xb1
,
0x33
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xfe
,
0x25
,
0x1c
,
0x74
,
0x98
,
0x93
,
0x58
,
0x83
,
0x25
,
0xaa
,
0xee
,
0x39
,
0xcd
,
0x10
,
0x7f
,
0x0e
,
0xef
,
0xac
,
0xe7
,
0x4e
,
0xb2
,
0x33
,
0x14
,
0xf9
,
0x36
,
0xaf
,
0x95
,
0xfb
,
0xd0
,
0x28
,
0xb7
,
0x1e
,
0x1e
,
0x68
,
0x2c
,
0xff
,
0x0c
,
0x1e
,
0x37
,
0x4e
,
0x71
,
0xb1
,
0x34
,
0x86
,
0x7d
,
0x40
,
0x08
,
0xfe
,
0x31
,
0x3c
,
0x6a
,
0xc1
,
0xe9
,
0x4e
,
0xd4
,
0x8e
,
0x73
,
0xac
,
0xe3
,
0x38
,
0x87
,
0x69
,
0x63
,
0xe3
,
0xc5
,
0x95
,
0x64
,
0x07
,
0xe0
,
0x2d
,
0xae
,
0xea
,
0x9a
,
0xf0
,
0x2f
,
0xff
,
0x01
,
0xde
,
0x6d
,
0x24
,
0xc3
,
0x36
,
0x85
,
0x27
,
0x33
,
0x49
,
0xff
,
0x83
,
0xcd
,
0xf9
,
0xcf
,
0xf0
,
0xfe
,
0xda
,
0x84
,
0xa6
,
0xa8
,
0x4d
,
0x29
,
0x6d
,
0xd1
,
0x6e
,
0xab
,
0xe8
,
0x73
,
0x38
,
0x6c
,
0xd4
,
0x52
,
0xa7
,
0x95
,
0xec
,
0x19
,
0x8c
,
0xf4
,
0x35
,
0x30
,
0x8c
,
0xaf
,
0xf9
,
0x98
,
0x34
,
0x80
,
0x9b
,
0x11
,
0x7d
,
0xa9
,
0x9f
,
0xfd
,
0x1b
,
0x00
,
0x00
,
0xff
,
0xff
,
0x8c
,
0x5c
,
0x7b
,
0x9a
,
0xbb
,
0x0b
,
0x00
,
0x00
,
}
plugin/dapp/issuance/types/tx.go
0 → 100644
View file @
550958aa
// Copyright Fuzamei Corp. 2018 All Rights Reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package
types
// IssuanceCreateTx for construction
type
IssuanceCreateTx
struct
{
DebtCeiling
int64
`json:"debtCeiling"`
LiquidationRatio
float32
`json:"liquidationRatio"`
Period
int64
`json:"period"`
TotalBalance
int64
`json:"totalBalance"`
Fee
int64
`json:"fee"`
}
// IssuanceDebtTx for construction
type
IssuanceDebtTx
struct
{
IssuanceID
string
`json:"issuanceId"`
Value
int64
`json:"value"`
Fee
int64
`json:"fee"`
}
// IssuanceRepayTx for construction
type
IssuanceRepayTx
struct
{
IssuanceID
string
`json:"issuanceId"`
Fee
int64
`json:"fee"`
}
// IssuanceFeedTx for construction
type
IssuanceFeedTx
struct
{
Price
[]
float32
`json:"price"`
Volume
[]
int64
`json:"volume"`
Fee
int64
`json:"fee"`
}
// IssuanceCloseTx for construction
type
IssuanceCloseTx
struct
{
IssuanceID
string
`json:"issuanceId"`
Fee
int64
`json:"fee"`
}
// IssuanceManageTx for construction
type
IssuanceManageTx
struct
{
Addr
[]
string
`json:"addr"`
Fee
int64
`json:"fee"`
}
plugin/dapp/issuance/types/types.go
0 → 100644
View file @
550958aa
// Copyright Fuzamei Corp. 2018 All Rights Reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package
types
//Issuance op
const
(
IssuanceActionCreate
=
1
+
iota
// 创建借贷
IssuanceActionDebt
// 大户抵押
IssuanceActionRepay
// 大户清算
IssuanceActionFeed
// 发行合约喂价
IssuanceActionClose
// 关闭借贷
IssuanceActionManage
// 借贷管理
//log for Issuance
TyLogIssuanceCreate
=
741
TyLogIssuanceDebt
=
742
TyLogIssuanceRepay
=
743
TyLogIssuanceFeed
=
745
TyLogIssuanceClose
=
756
)
// Issuance name
const
(
IssuanceX
=
"issuance"
CCNYTokenName
=
"ccny"
IssuancePreLiquidationRatio
=
1.1
//TODO 预清算比例,抵押物价值跌到借出ccny价值110%的时候开始清算
)
//Issuance status
const
(
IssuanceStatusCreated
=
1
+
iota
IssuanceStatusClose
)
const
(
IssuanceUserStatusCreate
=
1
+
iota
IssuanceUserStatusWarning
IssuanceUserStatusSystemLiquidate
IssuanceUserStatusExpire
IssuanceUserStatusExpireLiquidate
IssuanceUserStatusClose
)
\ 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