Skip to content
This repository has been archived by the owner on Nov 14, 2023. It is now read-only.

Commit

Permalink
Merge branch 'bifrost' of https://github.com/irisnet/irishub-sync int…
Browse files Browse the repository at this point in the history
…o bifrostU
  • Loading branch information
weichang-x committed Sep 3, 2020
2 parents d1af2d8 + 3853401 commit ba92053
Show file tree
Hide file tree
Showing 11 changed files with 79 additions and 144 deletions.
6 changes: 4 additions & 2 deletions cdc/cdc.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ import (
"github.com/irismod/coinswap"
"github.com/cosmos/cosmos-sdk/x/auth/tx"
"github.com/cosmos/cosmos-sdk/std"
"github.com/cosmos/cosmos-sdk/codec/types"
ctypes "github.com/cosmos/cosmos-sdk/codec/types"
"github.com/cosmos/cosmos-sdk/simapp/params"
"github.com/irisnet/irishub-sync/types"
)

var (
Expand Down Expand Up @@ -55,9 +56,10 @@ func init() {
config.SetBech32PrefixForValidator(address.Bech32PrefixValAddr, address.Bech32PrefixValPub)
config.SetBech32PrefixForConsensusNode(address.Bech32PrefixConsAddr, address.Bech32PrefixConsPub)
config.Seal()
types.Bech32AccountAddrPrefix = sdk.GetConfig().GetBech32AccountAddrPrefix()

amino := codec.New()
interfaceRegistry := types.NewInterfaceRegistry()
interfaceRegistry := ctypes.NewInterfaceRegistry()
moduleBasics.RegisterInterfaces(interfaceRegistry)
sdk.RegisterInterfaces(interfaceRegistry)
marshaler := codec.NewProtoCodec(interfaceRegistry)
Expand Down
10 changes: 5 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ go 1.14
require (
github.com/cosmos/cosmos-sdk v0.34.4-0.20200825201020-d9fd4d2ca9a3
github.com/go-kit/kit v0.10.0
github.com/irismod/coinswap v0.0.0-20200828021228-f86e9736690e
github.com/irismod/htlc v0.0.0-20200830023142-e3da67f16b03
github.com/irismod/coinswap v0.0.0-20200901103745-f38672ac63ec
github.com/irismod/htlc v0.0.0-20200901103718-c3bf89708dce
github.com/irismod/nft v1.1.1-0.20200827095318-d16861212579
github.com/irismod/record v1.1.1-0.20200827095301-3e27fc43ae73
github.com/irismod/service v1.1.1-0.20200831103113-6c6a5a77d22f
github.com/irismod/token v1.1.1-0.20200831162307-f05f6766f5b7
github.com/irisnet/irishub v0.16.3-0.20200901032435-08bf001a1c1b
github.com/irismod/service v1.1.1-0.20200901115916-d898b826bf10
github.com/irismod/token v1.1.1-0.20200901121217-d3aa04e760e3
github.com/irisnet/irishub v1.0.0-alpha
github.com/jolestar/go-commons-pool v2.0.0+incompatible
github.com/pkg/errors v0.9.1
github.com/prometheus/client_golang v1.7.1
Expand Down
34 changes: 10 additions & 24 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -281,36 +281,22 @@ github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmK
github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo=
github.com/irismod/coinswap v0.0.0-20200828021228-f86e9736690e h1:JBe0/lz5FaReCT7/lhyj5m2colOJKTdnhL2tgJ4MBlA=
github.com/irismod/coinswap v0.0.0-20200828021228-f86e9736690e/go.mod h1:3la+nTlqlISVLQTt9+kC4hBIvFe5J1VuJvOne9Zes7c=
github.com/irismod/htlc v0.0.0-20200828011507-7176034a189a h1:kj8zlgVw+5wx5YW4cpU06c4AXKP+X+htN+ntO0qEOx4=
github.com/irismod/htlc v0.0.0-20200828011507-7176034a189a/go.mod h1:bP5l2IbAVZAZXPrQmXrghEgWpyakNJfeoxmPq0d1SI8=
github.com/irismod/htlc v0.0.0-20200830023142-e3da67f16b03 h1:pcv8+KhlsswyTwKNFw5+L3ous0zJ/MJ+JDFU9WVPxKk=
github.com/irismod/htlc v0.0.0-20200830023142-e3da67f16b03/go.mod h1:bP5l2IbAVZAZXPrQmXrghEgWpyakNJfeoxmPq0d1SI8=
github.com/irismod/coinswap v0.0.0-20200901103745-f38672ac63ec h1:wcYq2UgKpIxCYSvtB9/NDFUfZ9n1I8WqdCzlvZzPnHg=
github.com/irismod/coinswap v0.0.0-20200901103745-f38672ac63ec/go.mod h1:3la+nTlqlISVLQTt9+kC4hBIvFe5J1VuJvOne9Zes7c=
github.com/irismod/htlc v0.0.0-20200901103718-c3bf89708dce h1:4+oBsP9xtUBiH77X/rFZRLA1Xy63q+dSyVl7hgVIVYI=
github.com/irismod/htlc v0.0.0-20200901103718-c3bf89708dce/go.mod h1:bP5l2IbAVZAZXPrQmXrghEgWpyakNJfeoxmPq0d1SI8=
github.com/irismod/nft v1.1.1-0.20200827095318-d16861212579 h1:UJQlLX7dGxp/WFm/Z5Rp1Ja3O/CY7qup9c1lEuVKX0Q=
github.com/irismod/nft v1.1.1-0.20200827095318-d16861212579/go.mod h1:l9EvpP0UKDYrmT/MRWM2FrmKpfYZJWbDR9srG7fylzA=
github.com/irismod/record v1.1.1-0.20200827095301-3e27fc43ae73 h1:DjsV6syYu1na1O0w3hlfAROOUPOCJCIPegJTMQt3X0U=
github.com/irismod/record v1.1.1-0.20200827095301-3e27fc43ae73/go.mod h1:slwVI+gGuBJo1OJPv0vw/GFeRPs9KB8K+0aecfmGSps=
github.com/irismod/service v1.1.1-0.20200828020549-9b948317f24d h1:+CEarP0r7vbk32z4sfTT4xDnrgUf9m8d2zhfV9sQYfI=
github.com/irismod/service v1.1.1-0.20200828020549-9b948317f24d/go.mod h1:ID4dmeafXHw8pFLDynH7l4mGIXetd5jrtFmY4qnxpHU=
github.com/irismod/service v1.1.1-0.20200830041912-b2ced48a06ab h1:y/+fLhlrag+oiY/kLo9AU1wkI/s3nm3g0GEuOXiqpkw=
github.com/irismod/service v1.1.1-0.20200830041912-b2ced48a06ab/go.mod h1:ID4dmeafXHw8pFLDynH7l4mGIXetd5jrtFmY4qnxpHU=
github.com/irismod/service v1.1.1-0.20200831103113-6c6a5a77d22f h1:9ekSaU+Gu7rHrGWqaebCtQuBTtMYcfJcP8ONjy3JDNs=
github.com/irismod/service v1.1.1-0.20200831103113-6c6a5a77d22f/go.mod h1:ID4dmeafXHw8pFLDynH7l4mGIXetd5jrtFmY4qnxpHU=
github.com/irismod/token v1.1.1-0.20200828081910-fe351310ac96 h1:h/6mimW300AVA/9oRtkNRwyZmKO3a/7OrU9B9OS2TSw=
github.com/irismod/token v1.1.1-0.20200828081910-fe351310ac96/go.mod h1:hOxUjOsE1biJa8ReBzY58rz3ZJeglth+HbU2iftcZik=
github.com/irismod/token v1.1.1-0.20200831030503-21db6eea21a9 h1:QhKFUbibk0JKOyx+h5dka4AidA0e3OJVbtp5qDGirEw=
github.com/irismod/token v1.1.1-0.20200831030503-21db6eea21a9/go.mod h1:hOxUjOsE1biJa8ReBzY58rz3ZJeglth+HbU2iftcZik=
github.com/irismod/token v1.1.1-0.20200831162307-f05f6766f5b7 h1:l4mZfU301OxcqH+vwM54Ag16V/hAmKXXZPCdE89k3zc=
github.com/irismod/token v1.1.1-0.20200831162307-f05f6766f5b7/go.mod h1:hOxUjOsE1biJa8ReBzY58rz3ZJeglth+HbU2iftcZik=
github.com/irismod/service v1.1.1-0.20200901115916-d898b826bf10 h1:4j83EDZdLFUL4BHJUQBV24jjVEm+gET0acx3axVlhE0=
github.com/irismod/service v1.1.1-0.20200901115916-d898b826bf10/go.mod h1:ID4dmeafXHw8pFLDynH7l4mGIXetd5jrtFmY4qnxpHU=
github.com/irismod/token v1.1.1-0.20200901121217-d3aa04e760e3 h1:vt4wkKr7Qy4fTc2wETWpogi4uD22CQG0f6l2Dx+XPdY=
github.com/irismod/token v1.1.1-0.20200901121217-d3aa04e760e3/go.mod h1:hOxUjOsE1biJa8ReBzY58rz3ZJeglth+HbU2iftcZik=
github.com/irisnet/cosmos-sdk v0.34.4-0.20200827085823-7b1a0adbfd1e h1:UWcFWDRtMxKOaRfApfwcByxAzeYpwPGCRUXtIhj0kL0=
github.com/irisnet/cosmos-sdk v0.34.4-0.20200827085823-7b1a0adbfd1e/go.mod h1:HXb9uKlB4sR4BFP32aSboY1Se4QhbFbYcJN6Dexil2U=
github.com/irisnet/irishub v0.16.3-0.20200831021034-1583d2aafa80 h1:y6sBo0Ym/I4GnLC1brdUwfFniUwQ59id2fS0AdoUge0=
github.com/irisnet/irishub v0.16.3-0.20200831021034-1583d2aafa80/go.mod h1:YYgBCOaayqSyOfHh5JT083Lfhn+GoBxsTOdrjwU0Uh8=
github.com/irisnet/irishub v0.16.3-0.20200831075309-f4e51719ab32 h1:O/Hzsn3UHIG3ERlTUgsC4lm6nmJesZ/RK2j/3151Irw=
github.com/irisnet/irishub v0.16.3-0.20200831075309-f4e51719ab32/go.mod h1:Ox7qjm/vGyu/Jt8u2Q/zf70myNY3R+W6CMRBwqKAyZo=
github.com/irisnet/irishub v0.16.3-0.20200901032435-08bf001a1c1b h1:I2SD+M3nWb3DgYMnBME+BVw7aSt7ry0pzuLqe0rsa9M=
github.com/irisnet/irishub v0.16.3-0.20200901032435-08bf001a1c1b/go.mod h1:mzqDJ8SjXX8SdW8AI7u/hhKg6clBS32z+FL9G3fVpEU=
github.com/irisnet/irishub v1.0.0-alpha h1:Pc4XTLnws1nHSKJhexFiaRhAbkwsncTfW7W4KMR/EvE=
github.com/irisnet/irishub v1.0.0-alpha/go.mod h1:72C76aMvM/5cZkyfe8bnzrOMvT99rsaVI+gFzshKITI=
github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k=
github.com/jmhodges/levigo v1.0.0 h1:q5EC36kV79HWeTBWsod3mG11EgStG3qArTKcvlksN1U=
Expand Down
23 changes: 2 additions & 21 deletions msg/staking/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"encoding/json"
"github.com/irisnet/irishub-sync/util/constant"
"github.com/irisnet/irishub-sync/store"
"strconv"
)

func HandleTxMsg(msgData sdk.Msg, docTx *document.CommonTx) (*document.CommonTx, bool) {
Expand Down Expand Up @@ -91,21 +90,15 @@ func HandleTxMsg(msgData sdk.Msg, docTx *document.CommonTx) (*document.CommonTx,
if len(docTx.Msgs) > 1 {
return docTx, true
}
shares := ParseFloat(msg.Amount.Amount.String())
docTx.From = msg.DelegatorAddress.String()
docTx.To = msg.ValidatorAddress.String()

coin := store.Coin{
Amount: shares,
}
docTx.Amount = []store.Coin{coin}
docTx.Amount = []store.Coin{types.ParseCoin(msg.Amount.String())}
docTx.Type = constant.TxTypeStakeBeginUnbonding
case new(types.MsgBeginRedelegate).Type():
var msg types.MsgBeginRedelegate
data, _ := json.Marshal(msgData)
json.Unmarshal(data, &msg)


txMsg := DocTxMsgBeginRedelegate{}
txMsg.BuildMsg(msg)
docTx.Msgs = append(docTx.Msgs, document.DocTxMsg{
Expand All @@ -117,20 +110,15 @@ func HandleTxMsg(msgData sdk.Msg, docTx *document.CommonTx) (*document.CommonTx,
if len(docTx.Msgs) > 1 {
return docTx, true
}
shares := ParseFloat(msg.Amount.Amount.String())
docTx.From = msg.ValidatorSrcAddress.String()
docTx.To = msg.ValidatorDstAddress.String()
coin := store.Coin{
Amount: shares,
}
docTx.Amount = []store.Coin{coin}
docTx.Amount = []store.Coin{types.ParseCoin(msg.Amount.String())}
docTx.Type = constant.TxTypeBeginRedelegate
case new(types.MsgUnjail).Type():
var msg types.MsgUnjail
data, _ := json.Marshal(msgData)
json.Unmarshal(data, &msg)


txMsg := DocTxMsgUnjail{}
txMsg.BuildMsg(msg)
docTx.Msgs = append(docTx.Msgs, document.DocTxMsg{
Expand All @@ -148,11 +136,4 @@ func HandleTxMsg(msgData sdk.Msg, docTx *document.CommonTx) (*document.CommonTx,
ok = false
}
return docTx, ok
}
func ParseFloat(s string) float64 {
f, err := strconv.ParseFloat(s, 64)
if err != nil {
return 0
}
return f
}
37 changes: 27 additions & 10 deletions msg/token/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,59 +16,76 @@ func HandleTxMsg(msgData sdk.Msg, docTx *document.CommonTx) (*document.CommonTx,
data, _ := json.Marshal(msgData)
json.Unmarshal(data, &msg)

docTx.From = msg.Owner.String()
docTx.Type = constant.TxTypeAssetIssueToken
txMsg := DocTxMsgIssueToken{}
txMsg.BuildMsg(msg)
docTx.Msgs = append(docTx.Msgs, document.DocTxMsg{
Type: txMsg.Type(),
Msg: &txMsg,
})
docTx.Addrs = append(docTx.Addrs, txMsg.Owner)
docTx.Types = append(docTx.Types, txMsg.Type())
if len(docTx.Msgs) > 1 {
return docTx, true
}
docTx.From = msg.Owner.String()
docTx.Type = constant.TxTypeAssetIssueToken
case new(types.MsgEditToken).Type():
var msg types.MsgEditToken
data, _ := json.Marshal(msgData)
json.Unmarshal(data, &msg)

docTx.From = msg.Owner.String()
docTx.Type = constant.TxTypeAssetEditToken
txMsg := DocTxMsgEditToken{}
txMsg.BuildMsg(msg)
docTx.Msgs = append(docTx.Msgs, document.DocTxMsg{
Type: txMsg.Type(),
Msg: &txMsg,
})
docTx.Addrs = append(docTx.Addrs, txMsg.Owner)
docTx.Types = append(docTx.Types, txMsg.Type())
if len(docTx.Msgs) > 1 {
return docTx, true
}
docTx.From = msg.Owner.String()
docTx.Type = constant.TxTypeAssetEditToken
case new(types.MsgMintToken).Type():
var msg types.MsgMintToken
data, _ := json.Marshal(msgData)
json.Unmarshal(data, &msg)

docTx.From = msg.Owner.String()
docTx.To = msg.To.String()
docTx.Type = constant.TxTypeAssetMintToken

txMsg := DocTxMsgMintToken{}
txMsg.BuildMsg(msg)
docTx.Msgs = append(docTx.Msgs, document.DocTxMsg{
Type: txMsg.Type(),
Msg: &txMsg,
})
docTx.Addrs = append(docTx.Addrs, txMsg.Owner, txMsg.To)
docTx.Types = append(docTx.Types, txMsg.Type())
if len(docTx.Msgs) > 1 {
return docTx, true
}
docTx.From = msg.Owner.String()
docTx.To = msg.To.String()
docTx.Type = constant.TxTypeAssetMintToken
case new(types.MsgTransferTokenOwner).Type():
var msg types.MsgTransferTokenOwner
data, _ := json.Marshal(msgData)
json.Unmarshal(data, &msg)

docTx.From = msg.SrcOwner.String()
docTx.To = msg.DstOwner.String()
docTx.Type = constant.TxTypeAssetTransferTokenOwner
txMsg := DocTxMsgTransferTokenOwner{}
txMsg.BuildMsg(msg)
docTx.Msgs = append(docTx.Msgs, document.DocTxMsg{
Type: txMsg.Type(),
Msg: &txMsg,
})
docTx.Addrs = append(docTx.Addrs, txMsg.SrcOwner, txMsg.DstOwner)
docTx.Types = append(docTx.Types, txMsg.Type())
if len(docTx.Msgs) > 1 {
return docTx, true
}
docTx.From = msg.SrcOwner.String()
docTx.To = msg.DstOwner.String()
docTx.Type = constant.TxTypeAssetTransferTokenOwner
default:
ok = false
}
Expand Down
9 changes: 4 additions & 5 deletions types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,10 @@ var (
MustUnmarshalDelegation = staketypes.MustUnmarshalDelegation
MustUnmarshalUBD = staketypes.MustUnmarshalUBD

Bech32AccountAddrPrefix string = sdk.GetConfig().GetBech32AccountAddrPrefix()
RegisterCodec = sdk.RegisterCodec
AccAddressFromBech32 = sdk.AccAddressFromBech32
AccAddressFromHex = sdk.AccAddressFromHex
Bech32AccountAddrPrefix string
RegisterCodec = sdk.RegisterCodec
AccAddressFromBech32 = sdk.AccAddressFromBech32
AccAddressFromHex = sdk.AccAddressFromHex
//BondStatusToString = types.BondStatusToString

NewDecFromStr = sdk.NewDecFromStr
Expand All @@ -170,7 +170,6 @@ var (
//moduleBasics = module.NewBasicManager()
)


//
func ParseCoins(coinsStr string) (coins store.Coins) {
coinsStr = strings.TrimSpace(coinsStr)
Expand Down
14 changes: 2 additions & 12 deletions util/constant/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ package constant
const (
TxTypeTransfer = "Transfer"
TxTypeMultiSend = "MultiSend"
TxTypeBurn = "Burn"
TxTypeSetMemoRegexp = "SetMemoRegexp"
TxTypeStakeCreateValidator = "CreateValidator"
TxTypeStakeEditValidator = "EditValidator"
TxTypeStakeDelegate = "Delegate"
Expand All @@ -25,9 +23,6 @@ const (
TxTypeAssetEditToken = "EditToken"
TxTypeAssetMintToken = "MintToken"
TxTypeAssetTransferTokenOwner = "TransferTokenOwner"
TxTypeAssetCreateGateway = "CreateGateway"
TxTypeAssetEditGateway = "EditGateway"
TxTypeAssetTransferGatewayOwner = "TransferGatewayOwner"

TxTypeNFTMint = "NFTMint"
TxTypeNFTEdit = "NFTEdit"
Expand Down Expand Up @@ -79,11 +74,9 @@ const (
EnvNameDbDataBase = "DB_DATABASE"

EnvNameSerNetworkFullNode = "SER_BC_FULL_NODE"
EnvNameSerNetworkChainId = "SER_BC_CHAIN_ID"
EnvNameWorkerNumCreateTask = "WORKER_NUM_CREATE_TASK"
EnvNameWorkerNumExecuteTask = "WORKER_NUM_EXECUTE_TASK"

EnvNameNetwork = "NETWORK"

EnvLogFileName = "LOG_FILE_NAME"
EnvLogFileMaxSize = "LOG_FILE_MAX_SIZE"
Expand All @@ -95,15 +88,12 @@ const (
StoreNameStake = "stake"
StoreDefaultEndPath = "key"

StatusUnspecified = "Unspecified"
StatusDepositPeriod = "DepositPeriod"
StatusVotingPeriod = "VotingPeriod"
StatusPassed = "Passed"
StatusRejected = "Rejected"

NetworkMainnet = "mainnet"

// define coin unit
IrisAttoUnit = "iris-atto"
StatusFailed = "Failed"

TrueStr = "true"
FalseStr = "false"
Expand Down
4 changes: 4 additions & 0 deletions util/helper/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/irisnet/irishub-sync/msg/random"
"github.com/irisnet/irishub-sync/msg/bank"
"github.com/irisnet/irishub-sync/msg/token"
"github.com/irisnet/irishub-sync/store/document"
)

Expand Down Expand Up @@ -62,5 +63,8 @@ func HandleMsg(msgData sdk.Msg, tx *document.CommonTx) (*document.CommonTx, bool
if RandomTx, ok := random.HandleTxMsg(msgData, tx); ok {
return RandomTx, ok
}
if TokenTx, ok := token.HandleTxMsg(msgData, tx); ok {
return TokenTx, ok
}
return tx, false
}
45 changes: 18 additions & 27 deletions util/helper/proposal.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,16 @@ import (
"github.com/irisnet/irishub-sync/util/constant"
)

var ProposalStatusName = map[int32]string{
0: constant.StatusUnspecified,
1: constant.StatusDepositPeriod,
2: constant.StatusVotingPeriod,
3: constant.StatusPassed,
4: constant.StatusRejected,
5: constant.StatusFailed,
}

func GetProposal(proposalID uint64) (proposal document.Proposal, err error) {
//cdc := types.GetCodec()

res, err := Query(types.KeyProposal(proposalID), "gov", constant.StoreDefaultEndPath)
if len(res) == 0 || err != nil {
Expand All @@ -22,8 +30,11 @@ func GetProposal(proposalID uint64) (proposal document.Proposal, err error) {
proposal.ProposalId = proposalID
proposal.Title = txtpropo.Title
proposal.Description = txtpropo.Description
proposal.Status = propo.Status.String()
//proposal.Type = txtpropo.ProposalType()
if stat, ok := ProposalStatusName[int32(propo.Status)]; ok {
proposal.Status = stat
} else {
proposal.Status = propo.Status.String()
}

proposal.SubmitTime = propo.SubmitTime
proposal.VotingStartTime = propo.VotingStartTime
Expand All @@ -34,31 +45,11 @@ func GetProposal(proposalID uint64) (proposal document.Proposal, err error) {

tallyResult := propo.FinalTallyResult
proposal.TallyResult = document.PTallyResult{
Yes: tallyResult.Yes.String(),
Abstain: tallyResult.Abstain.String(),
No: tallyResult.No.String(),
NoWithVeto: tallyResult.NoWithVeto.String(),
//SystemVotingPower: tallyResult.SystemVotingPower.String(),
Yes: tallyResult.Yes.String(),
Abstain: tallyResult.Abstain.String(),
No: tallyResult.No.String(),
NoWithVeto: tallyResult.NoWithVeto.String(),
}

return
}

//func GetVotes(proposalID uint64) (pVotes []document.PVote, err error) {
// cdc := types.GetCodec()
//
// res, err := QuerySubspace(types.KeyVotesSubspace(proposalID), "gov")
// if len(res) == 0 || err != nil {
// return pVotes, err
// }
// for i := 0; i < len(res); i++ {
// var vote types.SdkVote
// cdc.MustUnmarshalBinaryBare(res[i].Value, &vote)
// v := document.PVote{
// Voter: vote.Voter.String(),
// Option: vote.Option.String(),
// }
// pVotes = append(pVotes, v)
// }
// return
//}
Loading

0 comments on commit ba92053

Please sign in to comment.