sebak: boscoin.io/sebak/lib/transaction/operation Index | Files

package operation

import "boscoin.io/sebak/lib/transaction/operation"

Index

Package Files

collect_tx_fee.go congress_voting.go congress_voting_result.go create_account.go inflation.go inflation_pf.go operation.go payment.go test.go unfreezing_request.go

func IsNormalOperation Uses

func IsNormalOperation(t OperationType) bool

type Body Uses

type Body interface {
    //
    // Check that this transaction is self consistent
    //
    // This routine is used by the transaction checker and thus is part of consensus
    //
    // Params:
    //   config = Consensus configuration
    //
    // Returns:
    //   An `error` if that transaction is invalid, `nil` otherwise
    //
    IsWellFormed(common.Config) error
    HasFee() bool
}

func UnmarshalBodyJSON Uses

func UnmarshalBodyJSON(t OperationType, b []byte) (Body, error)

type CollectTxFee Uses

type CollectTxFee struct {
    Target    string        `json:"target"`
    Amount    common.Amount `json:"amount"`
    Txs       uint64        `json:"txs"`
    Height    uint64        `json:"block-height"`
    BlockHash string        `json:"block-hash"`
    TotalTxs  uint64        `json:"total-txs"`
    TotalOps  uint64        `json:"total-ops"`
}

OperationBodyTransactionFee is the operation to send the collected transacton fee to certain account. To prevent the hash duplication of transaction, OperationBodyTransactionFee has block related data.

func NewCollectTxFee Uses

func NewCollectTxFee(
    target string,
    amount common.Amount,
    txs uint64,
    blockHeight uint64,
    blockHash string,
    totalTxs uint64,
) CollectTxFee

func (CollectTxFee) GetAmount Uses

func (o CollectTxFee) GetAmount() common.Amount

func (CollectTxFee) HasFee Uses

func (o CollectTxFee) HasFee() bool

func (CollectTxFee) IsWellFormed Uses

func (o CollectTxFee) IsWellFormed(common.Config) (err error)

func (CollectTxFee) TargetAddress Uses

func (o CollectTxFee) TargetAddress() string

type CongressVoting Uses

type CongressVoting struct {
    Contract string `json:"contract"`
    Voting   struct {
        Start uint64 `json:"start"`
        End   uint64 `json:"end"`
    }   `json:"voting"`
    FundingAddress string        `json:"funding_address"`
    Amount         common.Amount `json:"amount"`
}

func NewCongressVoting Uses

func NewCongressVoting(contract string, start, end uint64, amount common.Amount, fundingAddress string) CongressVoting

func (CongressVoting) HasFee Uses

func (o CongressVoting) HasFee() bool

func (CongressVoting) IsWellFormed Uses

func (o CongressVoting) IsWellFormed(common.Config) (err error)

type CongressVotingResult Uses

type CongressVotingResult struct {
    BallotStamps struct {
        Hash string   `json:"hash"`
        Urls []string `json:"urls"`
    }   `json:"ballot_stamps"`
    Voters struct {
        Hash string   `json:"hash"`
        Urls []string `json:"urls"`
    }   `json:"voters"`
    Result struct {
        Count uint64 `json:"count"`
        Yes   uint64 `json:"yes"`
        No    uint64 `json:"no"`
        ABS   uint64 `json:"abs"`
    }   `json:"result"`
    CongressVotingHash string `json:"congress_voting_hash"`
    Membership         struct {
        Hash string   `json:"hash"`
        Urls []string `json:"urls"`
    }   `json:"membership"`
}

func NewCongressVotingResult Uses

func NewCongressVotingResult(
    ballotHash string, ballotUrls []string,
    votersHash string, votersUrls []string,
    membershipHash string, membershipUrls []string,
    resultCount, resultYes, resultNo, resultABS uint64,
    congressVotingHash string,
) CongressVotingResult

func (CongressVotingResult) HasFee Uses

func (o CongressVotingResult) HasFee() bool

func (CongressVotingResult) IsWellFormed Uses

func (o CongressVotingResult) IsWellFormed(common.Config) (err error)

type CreateAccount Uses

type CreateAccount struct {
    Target string        `json:"target"`
    Amount common.Amount `json:"amount"`
    Linked string        `json:"linked,omitempty"`
}

func NewCreateAccount Uses

func NewCreateAccount(target string, amount common.Amount, linked string) CreateAccount

func (CreateAccount) GetAmount Uses

func (o CreateAccount) GetAmount() common.Amount

func (CreateAccount) HasFee Uses

func (o CreateAccount) HasFee() bool

func (CreateAccount) IsWellFormed Uses

func (o CreateAccount) IsWellFormed(common.Config) (err error)

Implement transaction/operation : IsWellFormed

func (CreateAccount) TargetAddress Uses

func (o CreateAccount) TargetAddress() string
type Header struct {
    Type OperationType `json:"type"`
}

type Inflation Uses

type Inflation struct {
    Target         string        `json:"target"`
    Amount         common.Amount `json:"amount"`
    InitialBalance common.Amount `json:"initial_balance"`
    Ratio          string        `json:"ratio"`
    Height         uint64        `json:"block-height"`
    BlockHash      string        `json:"block-hash"`
    TotalTxs       uint64        `json:"total-txs"`
    TotalOps       uint64        `json:"total-ops"`
}

Inflation is the operation to raise inflation in every block. To prevent the hash duplication of transaction, Inflation has block related data.

func NewOperationBodyInflation Uses

func NewOperationBodyInflation(
    target string,
    amount common.Amount,
    initialBalance common.Amount,
    blockHeight uint64,
    blockHash string,
    totalTxs uint64,
) Inflation

func (Inflation) GetAmount Uses

func (o Inflation) GetAmount() common.Amount

func (Inflation) HasFee Uses

func (o Inflation) HasFee() bool

func (Inflation) IsWellFormed Uses

func (o Inflation) IsWellFormed(common.Config) (err error)

func (Inflation) TargetAddress Uses

func (o Inflation) TargetAddress() string

type InflationPF Uses

type InflationPF struct {
    FundingAddress string        `json:"funding_address"`
    Amount         common.Amount `json:"amount"`
    VotingResult   string        `json:"voting-result"`
}

func NewInflationPF Uses

func NewInflationPF(
    fundingAddress string,
    amount common.Amount,
    votingResult string,
) InflationPF

func (InflationPF) GetAmount Uses

func (o InflationPF) GetAmount() common.Amount

func (InflationPF) HasFee Uses

func (o InflationPF) HasFee() bool

func (InflationPF) IsWellFormed Uses

func (o InflationPF) IsWellFormed(common.Config) (err error)

type Operation Uses

type Operation struct {
    H   Header
    B   Body
}

func MakeTestPayment Uses

func MakeTestPayment(amount int) Operation

func MakeTestPaymentTo Uses

func MakeTestPaymentTo(amount int, address string) Operation

func NewOperation Uses

func NewOperation(opb Body) (op Operation, err error)

func (*Operation) DecodeRLP Uses

func (op *Operation) DecodeRLP(s *common.RLPStream) error

Implement `common.Decoder`

func (Operation) EncodeRLP Uses

func (op Operation) EncodeRLP(w io.Writer) error

Implement `common.Encoder` The implementation MUST use value type, not pointer

func (Operation) HasFee Uses

func (o Operation) HasFee() bool

func (Operation) IsWellFormed Uses

func (o Operation) IsWellFormed(conf common.Config) (err error)

func (Operation) String Uses

func (o Operation) String() string

func (*Operation) UnmarshalJSON Uses

func (o *Operation) UnmarshalJSON(b []byte) (err error)

type OperationType Uses

type OperationType byte
const (
    TypeCreateAccount OperationType = iota
    TypePayment
    TypeCongressVoting
    TypeCongressVotingResult
    TypeCollectTxFee
    TypeInflation
    TypeUnfreezingRequest
    TypeInflationPF
)

func (OperationType) MarshalText Uses

func (ot OperationType) MarshalText() (text []byte, err error)

Implement encoding.TextMarshaler Also used in the API to avoid breaking clients

func (OperationType) String Uses

func (ot OperationType) String() string

Implement `fmt.Stringer`

func (*OperationType) UnmarshalText Uses

func (ot *OperationType) UnmarshalText(text []byte) (err error)

Implement encoding.TextUnmarshaler

type Payable Uses

type Payable interface {
    Body
    TargetAddress() string
    GetAmount() common.Amount
}

type Payment Uses

type Payment struct {
    Target string        `json:"target"`
    Amount common.Amount `json:"amount"`
}

func NewPayment Uses

func NewPayment(target string, amount common.Amount) Payment

func (Payment) GetAmount Uses

func (o Payment) GetAmount() common.Amount

func (Payment) HasFee Uses

func (o Payment) HasFee() bool

func (Payment) IsWellFormed Uses

func (o Payment) IsWellFormed(common.Config) (err error)

Implement transaction/operation : IsWellFormed

func (Payment) TargetAddress Uses

func (o Payment) TargetAddress() string

type Targetable Uses

type Targetable interface {
    TargetAddress() string
}

type UnfreezeRequest Uses

type UnfreezeRequest struct{}

func NewUnfreezeRequest Uses

func NewUnfreezeRequest() UnfreezeRequest

func (UnfreezeRequest) HasFee Uses

func (o UnfreezeRequest) HasFee() bool

func (UnfreezeRequest) IsWellFormed Uses

func (o UnfreezeRequest) IsWellFormed(common.Config) (err error)

Package operation imports 9 packages (graph) and is imported by 18 packages. Updated 2019-03-27. Refresh now. Tools for package owners.