OSDN Git Service

rename (#465)
[bytom/vapor.git] / protocol / bc / types / intrachain_output.go
1 package types
2
3 import (
4         "github.com/bytom/vapor/protocol/bc"
5 )
6
7 // IntraChainOutput satisfies the TypedOutput interface and represents a intra-chain transaction.
8 type IntraChainOutput struct {
9         OutputCommitment
10         // Unconsumed suffixes of the commitment and witness extensible strings.
11         CommitmentSuffix []byte
12 }
13
14 // NewIntraChainOutput create a new output struct
15 func NewIntraChainOutput(assetID bc.AssetID, amount uint64, controlProgram []byte) *TxOutput {
16         return &TxOutput{
17                 AssetVersion: 1,
18                 TypedOutput: &IntraChainOutput{
19                         OutputCommitment: OutputCommitment{
20                                 AssetAmount: bc.AssetAmount{
21                                         AssetId: &assetID,
22                                         Amount:  amount,
23                                 },
24                                 VMVersion:      1,
25                                 ControlProgram: controlProgram,
26                         },
27                 },
28         }
29 }
30
31 func (it *IntraChainOutput) OutputType() uint8 { return IntraChainOutputType }