fatd: github.com/Factom-Asset-Tokens/fatd/fat Index | Files | Directories

package fat

import "github.com/Factom-Asset-Tokens/fatd/fat"


Package Files

chainid.go entry.go issuance.go type.go

func ChainID Uses

func ChainID(tokenID string, issuerChainID factom.Bytes32) factom.Bytes32

ChainID returns the chain ID for a given token ID and issuer Chain ID.

func Coinbase Uses

func Coinbase() factom.FAAddress

func NameIDs Uses

func NameIDs(tokenID string, issuerChainID factom.Bytes32) []factom.Bytes

NameIDs returns valid NameIDs

func ValidTokenNameIDs Uses

func ValidTokenNameIDs(nameIDs []factom.Bytes) bool

ValidTokenNameIDs returns true if the nameIDs match the pattern for a valid token chain.

type Entry Uses

type Entry struct {
    Metadata json.RawMessage `json:"metadata,omitempty"`

    factom.Entry `json:"-"`

Entry has variables and methods common to all fat0 entries.

func (Entry) FAAddress Uses

func (e Entry) FAAddress(rcdSigID int) factom.FAAddress

FAAddress computes the FAAddress corresponding to the rcdSigID'th RCD/Sig pair.

func (*Entry) MarshalEntry Uses

func (e *Entry) MarshalEntry(v interface{}) error

func (Entry) MetadataJSONLen Uses

func (e Entry) MetadataJSONLen() int

func (*Entry) Sign Uses

func (e *Entry) Sign(signingSet ...factom.RCDPrivateKey)

Sign the RCD/Sig ID Salt + Timestamp Salt + Chain ID Salt + Content of the factom.Entry and add the RCD + signature pairs for the given addresses to the ExtIDs. This clears any existing ExtIDs.

func (Entry) UnmarshalEntry Uses

func (e Entry) UnmarshalEntry(v interface{}) error

UnmarshalEntry unmarshals the content of the factom.Entry into the provided variable v, disallowing all unknown fields.

func (Entry) ValidExtIDs Uses

func (e Entry) ValidExtIDs(numRCDSigPairs int) error

ValidExtIDs validates the structure of the ExtIDs of the factom.Entry to make sure that it has a valid timestamp salt and a valid set of RCD/signature pairs.

type Issuance Uses

type Issuance struct {
    Type   Type  `json:"type"`
    Supply int64 `json:"supply"`

    Symbol string `json:"symbol,omitempty"`

Issuance represents the Issuance of a token.

func NewIssuance Uses

func NewIssuance(entry factom.Entry) Issuance

NewIssuance returns an Issuance initialized with the given entry.

func (*Issuance) MarshalEntry Uses

func (i *Issuance) MarshalEntry() error

MarshalEntry marshals the entry content as an Issuance.

func (Issuance) MarshalJSON Uses

func (i Issuance) MarshalJSON() ([]byte, error)

func (*Issuance) UnmarshalEntry Uses

func (i *Issuance) UnmarshalEntry() error

UnmarshalEntry unmarshals the entry content as an Issuance.

func (*Issuance) UnmarshalJSON Uses

func (i *Issuance) UnmarshalJSON(data []byte) error

func (*Issuance) Valid Uses

func (i *Issuance) Valid(idKey factom.IDKey) error

Valid performs all validation checks and returns nil if i is a valid Issuance.

func (Issuance) ValidData Uses

func (i Issuance) ValidData() error

ValidData validates the Issuance data and returns nil if no errors are present. ValidData assumes that the entry content has been unmarshaled.

func (Issuance) ValidExtIDs Uses

func (i Issuance) ValidExtIDs() error

ValidExtIDs validates the structure of the external IDs of the entry to make sure that it has an RCD and signature. It does not validate the content of the RCD or signature.

type Type Uses

type Type uint64
const (
    TypeFAT0 Type = iota

func (Type) IsValid Uses

func (t Type) IsValid() bool

func (Type) MarshalJSON Uses

func (t Type) MarshalJSON() ([]byte, error)

func (*Type) Set Uses

func (t *Type) Set(s string) error

func (Type) String Uses

func (t Type) String() string

func (*Type) UnmarshalJSON Uses

func (t *Type) UnmarshalJSON(data []byte) error


fat0Package fat0 provides data types corresponding to valid FAT-0 entries for Transaction and Issuance as well as methods for validating the structure and content of the factom entry.

Package fat imports 11 packages (graph) and is imported by 6 packages. Updated 2019-08-17. Refresh now. Tools for package owners.