node

package
v0.3.1-0...-218028b Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2019 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// BurnAddress is the mainnet burn address
	BurnAddress = "EC2BURNFCT2PEGNETooo1oooo1oooo1oooo1oooo1oooo19wthin"
	// BurnRCD is the rcd representation of the burn address
	BurnRCD = [32]byte{}
)
View Source
var (
	OPRChain         = *factom.NewBytes32FromString("a642a8674f46696cc47fdb6b65f9c87b2a19c5ea8123b3d2f0c13b6f33a9d5ef")
	TransactionChain = *factom.NewBytes32FromString("cffce0f409ebba4ed236d49d89c70e4bd1f1367d86402a3363366683265a242d")

	PegnetActivation    uint32 = 206421
	GradingV2Activation uint32 = 210330

	// TransactionConversionActivation indicates when tx/conversions go live on mainnet.
	// Target Activation Height is Oct 7, 2019 15 UTC
	TransactionConversionActivation uint32 = 213237

	// This is when PEG is priced by the market cap equation
	// Estimated to be Oct 14 2019, 15:00:00 UTC
	PEGPricingActivation uint32 = 214287

	// OneWaypFCTConversions makes pFCT a 1 way conversion. This means pFCT->pXXX,
	// but no asset can go into pFCT. AKA pXXX -/> pFCT.
	// The only way to aquire pFCT is to burn FCT. The burn command will remain.
	// Estimated to be Nov 25, 2019 17:47:00 UTC
	OneWaypFCTConversions uint32 = 220346

	// Once this is activated, a maximum amount of PEG of 5,000 can be
	// converted per block. At a future height, a dynamic bank should be used.
	// Estimated to be  Dec 9, 2019, 17:00 UTC
	PegnetConversionLimitActivation uint32 = 222270

	// This is when PEG price is determined by the exchange price
	// Estimated to be  Dec 9, 2019, 17:00 UTC
	PEGFreeFloatingPriceActivation uint32 = 222270
)

Functions

func ComputeChainIDFromFields

func ComputeChainIDFromFields(fields [][]byte) [32]byte

ComputeChainIDFromFields Takes the binary fields that define a chainID and hashes them together to create the ChainID expected by the APIs. These fields are treated as binary, but could be simple text, like: "Bob's" "Favorite" "Chain"

func ComputeChainIDFromStrings

func ComputeChainIDFromStrings(fields []string) [32]byte

ComputeChainIDFromStrings Take a set of strings, and compute the chainID. If you have binary fields, you can call factom.ComputeChainIDFromFields directly.

func FactomClientFromConfig

func FactomClientFromConfig(conf *viper.Viper) *factom.Client

func SetAllActivations

func SetAllActivations(act uint32)

Types

type Pegnetd

type Pegnetd struct {
	FactomClient *factom.Client
	Config       *viper.Viper

	Sync   *pegnet.BlockSync
	Pegnet *pegnet.Pegnet
}

func NewPegnetd

func NewPegnetd(ctx context.Context, conf *viper.Viper) (*Pegnetd, error)

func (*Pegnetd) ApplyFactoidBlock

func (d *Pegnetd) ApplyFactoidBlock(ctx context.Context, tx *sql.Tx, dblock *factom.DBlock) error

ApplyFactoidBlock applies the FCT burns that occurred within the given DBlock. If an error is returned, the sql.Tx should be rolled back by the caller.

func (*Pegnetd) ApplyGradedOPRBlock

func (d *Pegnetd) ApplyGradedOPRBlock(tx *sql.Tx, gradedBlock grader.GradedBlock, timestamp time.Time) error

ApplyGradedOPRBlock pays out PEG to the winners of the given GradedBlock. If an error is returned, the sql.Tx should be rolled back by the caller.

func (*Pegnetd) ApplyTransactionBatchesInHolding

func (d *Pegnetd) ApplyTransactionBatchesInHolding(ctx context.Context, sqlTx *sql.Tx, currentHeight uint32) error

ApplyTransactionBatchesInHolding attempts to apply the transaction batches from previous blocks that were put into holding because they contained conversions. If an error is returned, the sql.Tx should be rolled back by the caller.

func (*Pegnetd) ApplyTransactionBlock

func (d *Pegnetd) ApplyTransactionBlock(sqlTx *sql.Tx, eblock *factom.EBlock) error

ApplyTransactionBlock puts conversion-containing transaction batches into holding, and applys the balance updates for all transaction batches able to be executed immediately. If an error is returned, the sql.Tx should be rolled back by the caller.

func (*Pegnetd) DBlockSync

func (d *Pegnetd) DBlockSync(ctx context.Context)

DBlockSync iterates through dblocks and syncs the various chains

func (*Pegnetd) GetCurrentSync

func (d *Pegnetd) GetCurrentSync() uint32

func (*Pegnetd) Grade

func (d *Pegnetd) Grade(ctx context.Context, block *factom.EBlock) (grader.GradedBlock, error)

func (*Pegnetd) SyncBlock

func (d *Pegnetd) SyncBlock(ctx context.Context, tx *sql.Tx, height uint32) error

If SyncBlock returns no error, than that height was synced and saved. If any part of the sync fails, the whole sync should be rolled back and not applied. An error should then be returned. The context should be respected if it is cancelled

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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