types

package
v0.12.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 13, 2020 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EventTypeCreateProject       = "create_project"
	EventTypeUpdateProjectStatus = "update_project_status"
	EventTypeCreateAgent         = "create_agent"
	EventTypeUpdateAgent         = "update_agent"
	EventTypeCreateEvaluation    = "create_evaluation"
	EventTypeWithdrawFunds       = "withdraw_funds"

	AttributeKeyTxHash          = "tx_hash"
	AttributeKeySenderDid       = "sender_did"
	AttributeKeyProjectDid      = "project_did"
	AttributeKeyPubKey          = "pub_key"
	AttributeKeyRecipientDid    = "recipient_did"
	AttributeKeyAmount          = "amount"
	AttributeKeyIsRefund        = "is_refund"
	AttributeKeyClaimID         = "claim_id"
	AttributeKeyClaimStatus     = "claim_status"
	AttributeKeyAgentDid        = "agent_did"
	AttributeKeyAgentRole       = "role"
	AttributeKeyEthFundingTxnID = "eth_funding_txn_id"
	AttributeKeyUpdatedStatus   = "updated_status"

	AttributeValueCategory = ModuleName
)
View Source
const (
	ModuleName        = "project"
	DefaultParamspace = ModuleName
	StoreKey          = ModuleName
	RouterKey         = ModuleName
	QuerierRoute      = ModuleName
)
View Source
const (
	TypeMsgCreateProject       = "create-project"
	TypeMsgUpdateProjectStatus = "update-project-status"
	TypeMsgCreateAgent         = "create-agent"
	TypeMsgUpdateAgent         = "update-agent"
	TypeMsgCreateClaim         = "create-claim"
	TypeMsgCreateEvaluation    = "create-evaluation"
	TypeMsgWithdrawFunds       = "withdraw-funds"

	MsgCreateProjectFee            = int64(1000000)
	MsgCreateProjectTransactionFee = int64(10000)
)
View Source
const (
	DefaultCodespace sdk.CodespaceType = ModuleName
)

Variables

View Source
var (
	ProjectKey    = []byte{0x01}
	AccountKey    = []byte{0x02}
	WithdrawalKey = []byte{0x03}
)
View Source
var (
	KeyIxoDid                       = []byte("IxoDid")
	KeyProjectMinimumInitialFunding = []byte("ProjectMinimumInitialFunding")
)

Parameter store keys

View Source
var (
	ProjectDid       = "ProjectDid"
	ValidAddress1, _ = sdk.AccAddressFromHex("0F6A8D732716BA24B213D7C28984FBE1248D009D")
	ValidAccId1      = InternalAccountID(ValidAddress1.String())
)
View Source
var ModuleCdc *codec.Codec

ModuleCdc is the codec for the module

View Source
var StateTransitions = initStateTransitions()
View Source
var ValidCreateProjectMsg = MsgCreateProject{
	TxHash:     "SampleTxBytes",
	SenderDid:  "SenderDid",
	ProjectDid: ProjectDid,
	PubKey:     "PubKey",
	Data:       MustMarshalJson(validProjectData),
}
View Source
var ValidProjectDoc = ProjectDoc{
	TxHash:     "SampleTxHash",
	SenderDid:  "SenderDid",
	ProjectDid: ProjectDid,
	PubKey:     "PubKey",
	Status:     "CREATED",
	Data:       MustMarshalJson(validProjectData),
}
View Source
var ValidUpdatedProjectDoc = ProjectDoc{
	TxHash:     "SampleTxHash",
	SenderDid:  "SenderDid",
	ProjectDid: ProjectDid,
	PubKey:     "PubKey",
	Status:     "PENDING",
	Data:       MustMarshalJson(validProjectData),
}
View Source
var ValidWithdrawalInfo = WithdrawalInfo{
	ActionID:     "1",
	ProjectDid:   "6iftm1hHdaU6LJGKayRMev",
	RecipientDid: "6iftm1hHdaU6LJGKayRMev",
	Amount:       sdk.NewCoin(ixo.IxoNativeToken, sdk.NewInt(10)),
}

Functions

func CheckNotEmpty

func CheckNotEmpty(value string, name string) (valid bool, err sdk.Error)

func GetAccountPrefixKey

func GetAccountPrefixKey(did did.Did) []byte

func GetProjectPrefixKey

func GetProjectPrefixKey(did did.Did) []byte

func GetWithdrawalPrefixKey

func GetWithdrawalPrefixKey(did did.Did) []byte

func MustMarshalJson added in v0.12.1

func MustMarshalJson(v interface{}) []byte

func ParamKeyTable

func ParamKeyTable() params.KeyTable

ParamTable for project module.

func RegisterCodec

func RegisterCodec(cdc *codec.Codec)

func ValidateGenesis

func ValidateGenesis(data GenesisState) error

noinspection GoUnusedParameter

func ValidateParams

func ValidateParams(params Params) error

validate params

Types

type AccountMap

type AccountMap map[InternalAccountID]sdk.AccAddress

type AgentStatus

type AgentStatus = string
const (
	PendingAgent  AgentStatus = "0"
	ApprovedAgent AgentStatus = "1"
	RevokedAgent  AgentStatus = "2"
)

type ClaimStatus

type ClaimStatus string
const (
	PendingClaim  ClaimStatus = "0"
	ApprovedClaim ClaimStatus = "1"
	RejectedClaim ClaimStatus = "2"
)

type CreateAgentDoc

type CreateAgentDoc struct {
	AgentDid did.Did `json:"did" yaml:"did"`
	Role     string  `json:"role" yaml:"role"`
}

type CreateClaimDoc

type CreateClaimDoc struct {
	ClaimID string `json:"claimID" yaml:"claimID"`
}

type CreateEvaluationDoc

type CreateEvaluationDoc struct {
	ClaimID string      `json:"claimID" yaml:"claimID"`
	Status  ClaimStatus `json:"status" yaml:"status"`
}

type GenesisAccountMap added in v0.12.1

type GenesisAccountMap map[string]sdk.AccAddress

type GenesisState

type GenesisState struct {
	ProjectDocs      []ProjectDoc        `json:"project_docs" yaml:"project_docs"`
	AccountMaps      []GenesisAccountMap `json:"account_maps" yaml:"account_maps"`
	WithdrawalsInfos [][]WithdrawalInfo  `json:"withdrawal_infos" yaml:"withdrawal_infos"`
	Params           Params              `json:"params" yaml:"params"`
}

func DefaultGenesisState

func DefaultGenesisState() GenesisState

func NewGenesisState

func NewGenesisState(projectDocs []ProjectDoc, accountMaps []GenesisAccountMap,
	withdrawalInfos [][]WithdrawalInfo, params Params) GenesisState

type InternalAccountID

type InternalAccountID string

func (InternalAccountID) ToAddressKey

func (id InternalAccountID) ToAddressKey(projectDid did.Did) string

type MsgCreateAgent

type MsgCreateAgent struct {
	TxHash     string         `json:"txHash" yaml:"txHash"`
	SenderDid  did.Did        `json:"senderDid" yaml:"senderDid"`
	ProjectDid did.Did        `json:"projectDid" yaml:"projectDid"`
	Data       CreateAgentDoc `json:"data" yaml:"data"`
}

func NewMsgCreateAgent

func NewMsgCreateAgent(txHash string, senderDid did.Did, createAgentDoc CreateAgentDoc, projectDid did.Did) MsgCreateAgent

func (MsgCreateAgent) GetSignBytes

func (msg MsgCreateAgent) GetSignBytes() []byte

func (MsgCreateAgent) GetSignerDid

func (msg MsgCreateAgent) GetSignerDid() did.Did

func (MsgCreateAgent) GetSigners

func (msg MsgCreateAgent) GetSigners() []sdk.AccAddress

func (MsgCreateAgent) Route

func (msg MsgCreateAgent) Route() string

func (MsgCreateAgent) String

func (msg MsgCreateAgent) String() string

func (MsgCreateAgent) Type

func (msg MsgCreateAgent) Type() string

func (MsgCreateAgent) ValidateBasic

func (msg MsgCreateAgent) ValidateBasic() sdk.Error

type MsgCreateClaim

type MsgCreateClaim struct {
	TxHash     string         `json:"txHash" yaml:"txHash"`
	SenderDid  did.Did        `json:"senderDid" yaml:"senderDid"`
	ProjectDid did.Did        `json:"projectDid" yaml:"projectDid"`
	Data       CreateClaimDoc `json:"data" yaml:"data"`
}

func NewMsgCreateClaim

func NewMsgCreateClaim(txHash string, senderDid did.Did, createClaimDoc CreateClaimDoc, projectDid did.Did) MsgCreateClaim

func (MsgCreateClaim) GetSignBytes

func (msg MsgCreateClaim) GetSignBytes() []byte

func (MsgCreateClaim) GetSignerDid

func (msg MsgCreateClaim) GetSignerDid() did.Did

func (MsgCreateClaim) GetSigners

func (msg MsgCreateClaim) GetSigners() []sdk.AccAddress

func (MsgCreateClaim) Route

func (msg MsgCreateClaim) Route() string

func (MsgCreateClaim) String

func (msg MsgCreateClaim) String() string

func (MsgCreateClaim) Type

func (msg MsgCreateClaim) Type() string

func (MsgCreateClaim) ValidateBasic

func (msg MsgCreateClaim) ValidateBasic() sdk.Error

type MsgCreateEvaluation

type MsgCreateEvaluation struct {
	TxHash     string              `json:"txHash" yaml:"txHash"`
	SenderDid  did.Did             `json:"senderDid" yaml:"senderDid"`
	ProjectDid did.Did             `json:"projectDid" yaml:"projectDid"`
	Data       CreateEvaluationDoc `json:"data" yaml:"data"`
}

func NewMsgCreateEvaluation

func NewMsgCreateEvaluation(txHash string, senderDid did.Did, createEvaluationDoc CreateEvaluationDoc, projectDid did.Did) MsgCreateEvaluation

func (MsgCreateEvaluation) GetSignBytes

func (msg MsgCreateEvaluation) GetSignBytes() []byte

func (MsgCreateEvaluation) GetSignerDid

func (msg MsgCreateEvaluation) GetSignerDid() did.Did

func (MsgCreateEvaluation) GetSigners

func (msg MsgCreateEvaluation) GetSigners() []sdk.AccAddress

func (MsgCreateEvaluation) Route

func (msg MsgCreateEvaluation) Route() string

func (MsgCreateEvaluation) String

func (msg MsgCreateEvaluation) String() string

func (MsgCreateEvaluation) Type

func (msg MsgCreateEvaluation) Type() string

func (MsgCreateEvaluation) ValidateBasic

func (msg MsgCreateEvaluation) ValidateBasic() sdk.Error

type MsgCreateProject

type MsgCreateProject struct {
	TxHash     string          `json:"txHash" yaml:"txHash"`
	SenderDid  did.Did         `json:"senderDid" yaml:"senderDid"`
	ProjectDid did.Did         `json:"projectDid" yaml:"projectDid"`
	PubKey     string          `json:"pubKey" yaml:"pubKey"`
	Data       json.RawMessage `json:"data" yaml:"data"`
}

func NewMsgCreateProject

func NewMsgCreateProject(senderDid did.Did, projectData json.RawMessage,
	projectDid did.Did, pubKey string) MsgCreateProject

func (MsgCreateProject) GetPubKey

func (msg MsgCreateProject) GetPubKey() string

func (MsgCreateProject) GetSignBytes

func (msg MsgCreateProject) GetSignBytes() []byte

func (MsgCreateProject) GetSignerDid

func (msg MsgCreateProject) GetSignerDid() did.Did

func (MsgCreateProject) GetSigners

func (msg MsgCreateProject) GetSigners() []sdk.AccAddress

func (MsgCreateProject) Route

func (msg MsgCreateProject) Route() string

func (MsgCreateProject) String

func (msg MsgCreateProject) String() string

func (MsgCreateProject) ToStdSignMsg

func (msg MsgCreateProject) ToStdSignMsg(fee int64) auth.StdSignMsg

func (MsgCreateProject) Type

func (msg MsgCreateProject) Type() string

func (MsgCreateProject) ValidateBasic

func (msg MsgCreateProject) ValidateBasic() sdk.Error

type MsgUpdateAgent

type MsgUpdateAgent struct {
	TxHash     string         `json:"txHash" yaml:"txHash"`
	SenderDid  did.Did        `json:"senderDid" yaml:"senderDid"`
	ProjectDid did.Did        `json:"projectDid" yaml:"projectDid"`
	Data       UpdateAgentDoc `json:"data" yaml:"data"`
}

func NewMsgUpdateAgent

func NewMsgUpdateAgent(txHash string, senderDid did.Did, updateAgentDoc UpdateAgentDoc, projectDid did.Did) MsgUpdateAgent

func (MsgUpdateAgent) GetSignBytes

func (msg MsgUpdateAgent) GetSignBytes() []byte

func (MsgUpdateAgent) GetSignerDid

func (msg MsgUpdateAgent) GetSignerDid() did.Did

func (MsgUpdateAgent) GetSigners

func (msg MsgUpdateAgent) GetSigners() []sdk.AccAddress

func (MsgUpdateAgent) Route

func (msg MsgUpdateAgent) Route() string

func (MsgUpdateAgent) String

func (msg MsgUpdateAgent) String() string

func (MsgUpdateAgent) Type

func (msg MsgUpdateAgent) Type() string

func (MsgUpdateAgent) ValidateBasic

func (msg MsgUpdateAgent) ValidateBasic() sdk.Error

type MsgUpdateProjectStatus

type MsgUpdateProjectStatus struct {
	TxHash     string                 `json:"txHash" yaml:"txHash"`
	SenderDid  did.Did                `json:"senderDid" yaml:"senderDid"`
	ProjectDid did.Did                `json:"projectDid" yaml:"projectDid"`
	Data       UpdateProjectStatusDoc `json:"data" yaml:"data"`
}

func NewMsgUpdateProjectStatus

func NewMsgUpdateProjectStatus(senderDid did.Did, updateProjectStatusDoc UpdateProjectStatusDoc, projectDid did.Did) MsgUpdateProjectStatus

func (MsgUpdateProjectStatus) GetSignBytes

func (msg MsgUpdateProjectStatus) GetSignBytes() []byte

func (MsgUpdateProjectStatus) GetSignerDid

func (msg MsgUpdateProjectStatus) GetSignerDid() did.Did

func (MsgUpdateProjectStatus) GetSigners

func (msg MsgUpdateProjectStatus) GetSigners() []sdk.AccAddress

func (MsgUpdateProjectStatus) Route

func (msg MsgUpdateProjectStatus) Route() string

func (MsgUpdateProjectStatus) Type

func (msg MsgUpdateProjectStatus) Type() string

func (MsgUpdateProjectStatus) ValidateBasic

func (msg MsgUpdateProjectStatus) ValidateBasic() sdk.Error

type MsgWithdrawFunds

type MsgWithdrawFunds struct {
	SenderDid did.Did          `json:"senderDid" yaml:"senderDid"`
	Data      WithdrawFundsDoc `json:"data" yaml:"data"`
}

func NewMsgWithdrawFunds

func NewMsgWithdrawFunds(senderDid did.Did, data WithdrawFundsDoc) MsgWithdrawFunds

func (MsgWithdrawFunds) GetSignBytes

func (msg MsgWithdrawFunds) GetSignBytes() []byte

func (MsgWithdrawFunds) GetSignerDid

func (msg MsgWithdrawFunds) GetSignerDid() did.Did

func (MsgWithdrawFunds) GetSigners

func (msg MsgWithdrawFunds) GetSigners() []sdk.AccAddress

func (MsgWithdrawFunds) Route

func (msg MsgWithdrawFunds) Route() string

func (MsgWithdrawFunds) String

func (msg MsgWithdrawFunds) String() string

func (MsgWithdrawFunds) Type

func (msg MsgWithdrawFunds) Type() string

func (MsgWithdrawFunds) ValidateBasic

func (msg MsgWithdrawFunds) ValidateBasic() sdk.Error

type Params

type Params struct {
	IxoDid                       did.Did `json:"ixo_did" yaml:"ixo_did"`
	ProjectMinimumInitialFunding sdk.Int `json:"project_minimum_initial_funding" yaml:"project_minimum_initial_funding"`
}

project parameters

func DefaultParams

func DefaultParams() Params

default project module parameters

func NewParams

func NewParams(projectMinimumInitialFunding sdk.Int, ixoDid did.Did) Params

func (*Params) ParamSetPairs

func (p *Params) ParamSetPairs() params.ParamSetPairs

Implements params.ParamSet

func (Params) String

func (p Params) String() string

type ProjectDataMap added in v0.12.1

type ProjectDataMap map[string]json.RawMessage

type ProjectDoc

type ProjectDoc struct {
	TxHash     string          `json:"txHash" yaml:"txHash"`
	ProjectDid did.Did         `json:"projectDid" yaml:"projectDid"`
	SenderDid  did.Did         `json:"senderDid" yaml:"senderDid"`
	PubKey     string          `json:"pubKey" yaml:"pubKey"`
	Status     ProjectStatus   `json:"status" yaml:"status"`
	Data       json.RawMessage `json:"data" yaml:"data"`
}

func NewProjectDoc added in v0.12.1

func NewProjectDoc(txHash string, projectDid, senderDid did.Did,
	pubKey string, status ProjectStatus, data json.RawMessage) ProjectDoc

func (ProjectDoc) GetEvaluatorPay

func (pd ProjectDoc) GetEvaluatorPay() int64

func (ProjectDoc) GetProjectData added in v0.12.1

func (pd ProjectDoc) GetProjectData() ProjectDataMap

func (ProjectDoc) GetProjectDid added in v0.12.1

func (pd ProjectDoc) GetProjectDid() did.Did

func (ProjectDoc) GetPubKey added in v0.12.1

func (pd ProjectDoc) GetPubKey() string

func (ProjectDoc) GetSenderDid added in v0.12.1

func (pd ProjectDoc) GetSenderDid() did.Did

func (ProjectDoc) GetStatus added in v0.12.1

func (pd ProjectDoc) GetStatus() ProjectStatus

func (*ProjectDoc) SetStatus added in v0.12.1

func (pd *ProjectDoc) SetStatus(status ProjectStatus)

type ProjectStatus

type ProjectStatus string
const (
	NullStatus     ProjectStatus = ""
	CreatedProject ProjectStatus = "CREATED"
	PendingStatus  ProjectStatus = "PENDING"
	FundedStatus   ProjectStatus = "FUNDED"
	StartedStatus  ProjectStatus = "STARTED"
	StoppedStatus  ProjectStatus = "STOPPED"
	PaidoutStatus  ProjectStatus = "PAIDOUT"
)

func (ProjectStatus) IsValidProgressionFrom

func (next ProjectStatus) IsValidProgressionFrom(prev ProjectStatus) bool

type ProjectStatusTransitionMap

type ProjectStatusTransitionMap map[ProjectStatus][]ProjectStatus

type StoredProjectDoc

type StoredProjectDoc interface {
	GetEvaluatorPay() int64
	GetProjectDid() did.Did
	GetSenderDid() did.Did
	GetPubKey() string
	GetStatus() ProjectStatus
	SetStatus(status ProjectStatus)
}

type UpdateAgentDoc

type UpdateAgentDoc struct {
	Did    did.Did     `json:"did" yaml:"did"`
	Status AgentStatus `json:"status" yaml:"status"`
	Role   string      `json:"role" yaml:"role"`
}

type UpdateProjectStatusDoc

type UpdateProjectStatusDoc struct {
	Status          ProjectStatus `json:"status" yaml:"status"`
	EthFundingTxnID string        `json:"ethFundingTxnID" yaml:"ethFundingTxnID"`
}

type WithdrawFundsDoc

type WithdrawFundsDoc struct {
	ProjectDid   did.Did `json:"projectDid" yaml:"projectDid"`
	RecipientDid did.Did `json:"recipientDid" yaml:"recipientDid"`
	Amount       sdk.Int `json:"amount" yaml:"amount"`
	IsRefund     bool    `json:"isRefund" yaml:"isRefund"`
}

type WithdrawalInfo

type WithdrawalInfo struct {
	ActionID     string   `json:"actionID" yaml:"actionID"`
	ProjectDid   did.Did  `json:"projectDid" yaml:"projectDid"`
	RecipientDid did.Did  `json:"recipientDid" yaml:"recipientDid"`
	Amount       sdk.Coin `json:"amount" yaml:"amount"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL