fat

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2019 License: MIT Imports: 11 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChainID

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

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

func NameIDs

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

NameIDs returns valid NameIDs

func ValidIdentityChainID

func ValidIdentityChainID(chainID factom.Bytes) bool

ValidIdentityChainID returns true if the chainID matches the pattern for an Identity Chain ID.

The Identity Chain specification can be found here: https://github.com/FactomProject/FactomDocs/blob/master/Identity.md#factom-identity-chain-creation

func ValidIdentityNameIDs

func ValidIdentityNameIDs(nameIDs []factom.Bytes) bool

ValidIdentityNameIDs returns true if the nameIDs match the pattern for a valid Identity Chain. The nameIDs for a chain are the ExtIDs of the first entry in the chain.

The Identity Chain specification can be found here: https://github.com/FactomProject/FactomDocs/blob/master/Identity.md#factom-identity-chain-creation

func ValidTokenNameIDs

func ValidTokenNameIDs(nameIDs []factom.Bytes) bool

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

Types

type Entry

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

	factom.Entry `json:"-"`
}

Entry has variables and methods common to all fat0 entries.

func (*Entry) MarshalEntry

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

func (Entry) MetadataJSONLen

func (e Entry) MetadataJSONLen() int

func (Entry) RCDHash

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

RCDHash returns the SHA256d hash of the first external ID of the entry, which should be the RCD of the IDKey of the issuing Identity.

func (*Entry) Sign

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

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

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

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 Identity

type Identity struct {
	ChainID   *factom.Bytes32
	IDKey     *factom.RCDHash
	Height    uint64
	Timestamp time.Time
}

Identity represents the Token Issuer's Identity Chain and the public IDKey used to sign Issuance and coinbase Transaction Entries.

func (*Identity) Get

func (i *Identity) Get() error

Get validates i.ChainID as an Identity Chain and parses out the IDKey.

Get returns any networking or marshaling errors, but not JSON RPC or chain parsing errors. To check if the Identity has been successfully populated, call IsPopulated().

func (Identity) IsPopulated

func (i Identity) IsPopulated() bool

IsPopulated returns true if the Identity has been populated with an IDKey.

type Issuance

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

	Symbol string `json:"symbol,omitempty"`
	Entry
}

Issuance represents the Issuance of a token.

func NewIssuance

func NewIssuance(entry factom.Entry) Issuance

NewIssuance returns an Issuance initialized with the given entry.

func (*Issuance) MarshalEntry

func (i *Issuance) MarshalEntry() error

MarshalEntry marshals the entry content as an Issuance.

func (Issuance) MarshalJSON

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

func (*Issuance) UnmarshalEntry

func (i *Issuance) UnmarshalEntry() error

UnmarshalEntry unmarshals the entry content as an Issuance.

func (*Issuance) UnmarshalJSON

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

func (*Issuance) Valid

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

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

func (Issuance) ValidData

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

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

type Type uint64
const (
	TypeFAT0 Type = iota
	TypeFAT1
)

func (Type) IsValid

func (t Type) IsValid() bool

func (Type) MarshalJSON

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

func (*Type) Set

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

func (Type) String

func (t Type) String() string

func (*Type) UnmarshalJSON

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

Directories

Path Synopsis
Package 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 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.

Jump to

Keyboard shortcuts

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