node

package
v0.0.0-...-4a3476f Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2020 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// BurnAddress is the mainnet burn address
	BurnAddress = "EC2BURNFCT2PEGNETooo1oooo1oooo1oooo1oooo1oooo19wthin"

	// BurnAddress that can be used for all assets
	GlobalBurnAddress = "FA2BURNBABYBURNoooooooooooooooooooooooooooooooDGvNXy"

	// Global Burn Address as proper FAAddress
	FAGlobalBurnAddress factom.FAAddress

	// BurnRCD is the rcd representation of the burn address
	BurnRCD = [32]byte{}
)
View Source
var (
	OPRChain         = factom.NewBytes32("a642a8674f46696cc47fdb6b65f9c87b2a19c5ea8123b3d2f0c13b6f33a9d5ef")
	SPRChain         = factom.NewBytes32("d5e395125335a21cef0ceca528168e87fe929fdac1f156870c1b1be6502448b4")
	TransactionChain = factom.NewBytes32("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

	// V4OPRUpdate indicates the activation of additional currencies and ecdsa keys.
	// Estimated to be  Feb 12, 2020, 18:00 UTC
	V4OPRUpdate uint32 = 231620

	// V20HeightActivation indicates the activation of PegNet 2.0.
	// Estimated to be  Aug 19th 2020 14:00 UTC
	V20HeightActivation uint32 = 258796

	// Activation height for developer rewards
	V20DevRewardsHeightActivation uint32 = 260118

	// SprSignatureActivation indicates the activation of SPR Signature.
	// Estimated to be  Aug 28th 2020
	SprSignatureActivation uint32 = 260118
)
View Source
var (
	DeveloperRewardAddreses = []DevReward{
		{"Listing Tech Support", "FA2i9WZqJnaKbJxDY2AZdVgewE28uCcSwoFt8LJCMtGCC7tpCa2n", 10.00},
		{"Architecture Dev for PegNet 2.5", "FA37cGXKWMtf2MmHy3n1rMCYeLVuR5MpDaP4VXVeFavjJCJLYYez", 19.0},
		{"Trading Bots Work", "FA2wDRieaBrWeZHVuXXWUHY6t9nKCVCCKAMS5xknLUExuVAq3ziS", 9.0},
		{"Mining Pool Support / Dev/ Infra Hosting/ Gateway Operation", "FA3LDEA5fcskV6ZoFpKE84qPcjd7GYjEnswGHMZXL1V9d14wmgh3", 9.0},
		{"Media Tech Support", "FA381EygeEXjZzB6hNvxbE4oSUzHZMfvGByMZoW5UrG1gHEKJcNK", 8.0},
		{"Social Coverage User Support", "FA2DxkaTx1k2oGfbTqvwVMScSHHac7JFRiBjRngjRnqQpeBxsLhA", 8.0},
		{"pTrader + PIPs", "FA2Ersb227gn7eWJ2HPsHZ5QqxfMBZhSjwixQ44dAS17CtRXSDRU", 8.0},
		{"Desktop Wallet + PIPs", "FA2eFEVUzTQZxNp3LYYgjPaaHUfGmuvShhtBdGB2BBWMeByPCmJy", 8.0},
		{"Explorer + Mobile", "FA2T72oxBxXvnujNdsVUshqFM2qV1W4nJy33nkrpxbYQV8rFbUPP", 5.0},
		{"Prosper / Staking GUI Upgrades", "FA2cEaq1GdGfFjhymiTEzW24DocZFZHNBqe9qkT18YPaL5ZzsgRi", 5.0},
		{"Payment Intergrations Work", "FA2YhZBZbc4V858ao7dJuAqRC4iwA3MrbZs7BHUPK7Mq19yYdMwZ", 3.0},
		{"General Development Tasks", "FA3PYuvrsDvkhnekokVNrgLn7JiL5pChSBTtR9gZB1mVGFVB7JRD", 3.0},
		{"Gateway Ethereum Upgrade", "FA2Wy7AzeoBuaXYnGu67xa5zdNkmqTbPryUgpy7qVPvj46GRZkep", 2.0},
		{"Trading Tech Support", "FA2a2nXgkBg7pL5wrgm99rLZDGFs2T8jfTgMuia6ep8ZMkVtPe8E", 3.00},
	}
)

Hardcode developers who work active on PegNet to avoid manipulations from config files

contains the percentage distribution of the total 2000 defined in `pegnet` repo `modules/conversions/conversionlimit.go` as PerBlockDevelopers

TODO: in v2.5 move into special Developer Rewards Chain (DRC)

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 DevReward

type DevReward struct {
	DevGroup     string  // group or information about reward
	DevAddress   string  // FCT address where to send developer reward
	DevRewardPct float64 // % from total development rewards
}

Special structure for the Developer rewards

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) ApplyGradedSPRBlock

func (d *Pegnetd) ApplyGradedSPRBlock(tx *sql.Tx, gradedSPRBlock graderStake.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, rates map[fat2.PTicker]uint64) 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) DevelopersPayouts

func (d *Pegnetd) DevelopersPayouts(tx *sql.Tx, fLog *log.Entry, height uint32, heightTimestamp time.Time, developers []DevReward) error

Developers Reward Payouts implementation of PIP16 - distributed rewards collected for developers every 24h

func (*Pegnetd) GetAssetRates

func (d *Pegnetd) GetAssetRates(oprWinners []opr.AssetUint, sprWinners []opr.AssetUint) ([]opr.AssetUint, error)

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) GradeS

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

Grade Staking Price Records

func (*Pegnetd) NullifyBurnAddress

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

func (*Pegnetd) SnapshotPayouts

func (d *Pegnetd) SnapshotPayouts(tx *sql.Tx, fLog *log.Entry, rates map[fat2.PTicker]uint64, height uint32, heightTimestamp time.Time) error

SnapshotPayouts moves the current shapshot to the "past", and updates the current snapshot. Then it proceeds to do the snapshot staking payouts.

func (*Pegnetd) SyncBank

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

SyncBank will input the bank value for all heights >= V4OPRUpdate The bank table helps track the demand for peg at a given height. The bank is the total amount of PEG allowed to be issued for any given height.

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