-
Notifications
You must be signed in to change notification settings - Fork 1
/
utils.go
29 lines (25 loc) · 1010 Bytes
/
utils.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package utils
import (
"github.com/FiboChain/fbc/libs/cosmos-sdk/codec"
sdk "github.com/FiboChain/fbc/libs/cosmos-sdk/types"
"io/ioutil"
)
// ManageWhiteListProposalJSON defines a ManageWhiteListProposalJSON with a deposit used to parse manage white list
// proposals from a JSON file.
type ManageWhiteListProposalJSON struct {
Title string `json:"title" yaml:"title"`
Description string `json:"description" yaml:"description"`
PoolName string `json:"pool_name" yaml:"pool_name"`
IsAdded bool `json:"is_added" yaml:"is_added"`
Deposit sdk.SysCoins `json:"deposit" yaml:"deposit"`
}
// ParseManageWhiteListProposalJSON parse json from proposal file to ManageWhiteListProposalJSON struct
func ParseManageWhiteListProposalJSON(cdc *codec.Codec, proposalFilePath string) (proposal ManageWhiteListProposalJSON,
err error) {
contents, err := ioutil.ReadFile(proposalFilePath)
if err != nil {
return
}
cdc.MustUnmarshalJSON(contents, &proposal)
return
}