types

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 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"
	EventTypeCreateClaim         = "create_claim"
	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"

	MsgCreateProjectTotalFee       = int64(1000000)
	MsgCreateProjectTransactionFee = int64(10000)
)

Variables

View Source
var (
	ProjectKey     = []byte{0x01}
	DocKey         = []byte{0x02}
	AccountMapKey  = []byte{0x03}
	WithdrawalsKey = []byte{0x04}
	ClaimsKey      = []byte{0x05}
)
View Source
var (
	KeyIxoDid                       = []byte("IxoDid")
	KeyProjectMinimumInitialFunding = []byte("ProjectMinimumInitialFunding")
	KeyOracleFeePercentage          = []byte("OracleFeePercentage")
	KeyNodeFeePercentage            = []byte("NodeFeePercentage")
)

Parameter store keys

View Source
var (
	ProjectDid    = "did:ixo:U7GK8p8rVhJMKhBVRCJJ8c"
	UserDid       = "did:ixo:4XJLBfGtWSGKSz4BeRxdun"
	ProjectPubKey = "FmwNAfvV2xEqHwszrVJVBR3JgQ8AFCQEVzo1p6x4L8VW"

	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:     "DummyTxHash",
	SenderDid:  UserDid,
	ProjectDid: ProjectDid,
	PubKey:     ProjectPubKey,
	Data:       MustMarshalJson(validProjectData),
}
View Source
var ValidProjectDoc = ProjectDoc{
	TxHash:     "DummyTxHash",
	SenderDid:  UserDid,
	ProjectDid: ProjectDid,
	PubKey:     ProjectPubKey,
	Status:     CreatedProject,
	Data:       MustMarshalJson(validProjectData),
}
View Source
var ValidUpdatedProjectDoc = ProjectDoc{
	TxHash:     "DummyTxHash",
	SenderDid:  UserDid,
	ProjectDid: ProjectDid,
	PubKey:     ProjectPubKey,
	Status:     PendingStatus,
	Data:       MustMarshalJson(validProjectData),
}
View Source
var ValidWithdrawalInfo = WithdrawalInfoDoc{
	ProjectDid:   ProjectDid,
	RecipientDid: UserDid,
	Amount:       sdk.NewCoin(ixo.IxoNativeToken, sdk.NewInt(10)),
}

Functions

func CheckNotEmpty

func CheckNotEmpty(value string, name string) (valid bool, err error)

func GetAccountMapKey added in v0.13.0

func GetAccountMapKey(projectDid did.Did) []byte

func GetClaimKey added in v0.13.0

func GetClaimKey(projectDid did.Did, claimId string) []byte

func GetClaimsKey added in v0.13.0

func GetClaimsKey(projectDid did.Did) []byte

func GetProjectKey added in v0.13.0

func GetProjectKey(projectDid did.Did) []byte

func GetWithdrawalsKey added in v0.13.0

func GetWithdrawalsKey(projectDid 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

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 Claim added in v0.13.0

type Claim struct {
	Id         string      `json:"id" yaml:"id"`
	ClaimerDid did.Did     `json:"claimer_did" yaml:"claimer_did"`
	Status     ClaimStatus `json:"status" yaml:"status"`
}

func NewClaim added in v0.13.0

func NewClaim(id string, claimerDid did.Did) Claim

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"`
}

func NewCreateAgentDoc added in v0.13.0

func NewCreateAgentDoc(agentDid did.Did, role string) CreateAgentDoc

type CreateClaimDoc

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

func NewCreateClaimDoc added in v0.13.0

func NewCreateClaimDoc(claimId string) CreateClaimDoc

type CreateEvaluationDoc

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

func NewCreateEvaluationDoc added in v0.13.0

func NewCreateEvaluationDoc(claimId string, status ClaimStatus) CreateEvaluationDoc

type FeeType added in v0.13.0

type FeeType string
const (
	FeeForService      FeeType = "FeeForService"
	OracleFee          FeeType = "OracleFee"
	Subscription       FeeType = "Subscription"
	RentalFee          FeeType = "RentalFee"
	OutcomePayment     FeeType = "OutcomePayment"
	InterestRepayment  FeeType = "InterestRepayment"
	LoanRepayment      FeeType = "LoanRepayment"
	IncomeDistribution FeeType = "IncomeDistribution"
	DisputeSettlement  FeeType = "DisputeSettlement"
)

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 [][]WithdrawalInfoDoc `json:"withdrawal_infos" yaml:"withdrawal_infos"`
	Claims           [][]Claim             `json:"claims" yaml:"claims"`
	Params           Params                `json:"params" yaml:"params"`
}

func DefaultGenesisState

func DefaultGenesisState() GenesisState

func NewGenesisState

func NewGenesisState(projectDocs []ProjectDoc, accountMaps []GenesisAccountMap,
	withdrawalInfos [][]WithdrawalInfoDoc, claims [][]Claim, 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() 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() 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() 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() 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() 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() 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() error

type Params

type Params struct {
	IxoDid                       did.Did   `json:"ixo_did" yaml:"ixo_did"`
	ProjectMinimumInitialFunding sdk.Coins `json:"project_minimum_initial_funding" yaml:"project_minimum_initial_funding"`
	OracleFeePercentage          sdk.Dec   `json:"oracle_fee_percentage" yaml:"oracle_fee_percentage"`
	NodeFeePercentage            sdk.Dec   `json:"node_fee_percentage" yaml:"node_fee_percentage"`
}

project parameters

func DefaultParams

func DefaultParams() Params

default project module parameters

func NewParams

func NewParams(projectMinimumInitialFunding sdk.Coins, ixoDid did.Did,
	oracleFeePercentage, nodeFeePercentage sdk.Dec) 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) GetProjectData added in v0.12.1

func (pd ProjectDoc) GetProjectData() (dataMap ProjectDataMap)

func (ProjectDoc) GetProjectFeesMap added in v0.13.0

func (pd ProjectDoc) GetProjectFeesMap() (feesMap ProjectFeesMap)

type ProjectFeesMap added in v0.13.0

type ProjectFeesMap struct {
	Context string `json:"@context" yaml:"@context"`
	Items   []ProjectFeesMapItem
}

func (ProjectFeesMap) GetPayTemplateId added in v0.13.0

func (pfm ProjectFeesMap) GetPayTemplateId(feeType FeeType) (string, error)

type ProjectFeesMapItem added in v0.14.0

type ProjectFeesMapItem struct {
	Type              FeeType `json:"@type" yaml:"@type"`
	PaymentTemplateId string  `json:"id" yaml:"id"`
}

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 UpdateAgentDoc

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

func NewUpdateAgentDoc added in v0.13.0

func NewUpdateAgentDoc(did did.Did, status AgentStatus, role string) UpdateAgentDoc

type UpdateProjectStatusDoc

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

func NewUpdateProjectStatusDoc added in v0.13.0

func NewUpdateProjectStatusDoc(status ProjectStatus, ethFundingTxnID string) UpdateProjectStatusDoc

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"`
}

func NewWithdrawFundsDoc added in v0.13.0

func NewWithdrawFundsDoc(projectDid, recipientDid did.Did, amount sdk.Int, isRefund bool) WithdrawFundsDoc

type WithdrawalInfoDoc added in v0.13.0

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

func NewWithdrawalInfoDoc added in v0.13.0

func NewWithdrawalInfoDoc(projectDid, recipientDid did.Did, amount sdk.Coin) WithdrawalInfoDoc

Jump to

Keyboard shortcuts

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