Skip to content

Commit

Permalink
Merge pull request #142 from pegnet/staging
Browse files Browse the repository at this point in the history
Pegnet 2.0
  • Loading branch information
StarNeit authored Aug 18, 2020
2 parents 7a6d381 + 81d1ce2 commit 44f08c4
Show file tree
Hide file tree
Showing 20 changed files with 1,535 additions and 55 deletions.
2 changes: 1 addition & 1 deletion cmd/args.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func CustomArgOrderValidationBuilder(strict bool, valids ...func(cmd *cobra.Comm

// ArgValidatorAssetAndAll checks for valid asset or 'all'
func ArgValidatorAssetOrP(cmd *cobra.Command, arg string) error {
list := opr.V4Assets
list := opr.V5Assets
for _, an := range list {
if strings.ToLower(arg) == strings.ToLower(an) {
return nil
Expand Down
2 changes: 1 addition & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ func always(cmd *cobra.Command, args []string) {

if testingact, _ := cmd.Flags().GetInt32("testingact"); testingact >= 0 {
fat2.Fat2RCDEActivation = uint32(testingact)
node.V4OPRUpdate = uint32(testingact)
node.V20HeightActivation = uint32(testingact)
// Also updaet hardfork
pegnet.Hardforks[1].ActivationHeight = uint32(testingact)
}
Expand Down
42 changes: 42 additions & 0 deletions fat/fat2/pticker.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,27 @@ const (
PTickerATOM
PTickerBAT
PTickerXTZ
// V5 Additions
PTickerHBAR
PTickerNEO
PTickerCRO
PTickerETC
PTickerONT
PTickerDOGE
PTickerVET
PTickerHT
PTickerALGO
PTickerDGB
PTickerAED
PTickerARS
PTickerTWD
PTickerRWF
PTickerKES
PTickerUGX
PTickerTZS
PTickerBIF
PTickerETB
PTickerNGN
PTickerMax
)

Expand Down Expand Up @@ -101,6 +122,27 @@ var validPTickerStrings = []string{
"pATOM",
"pBAT",
"pXTZ",
// V5 Additions
"pHBAR",
"pNEO",
"pCRO",
"pETC",
"pONT",
"pDOGE",
"pVET",
"pHT",
"pALGO",
"pDGB",
"pAED",
"pARS",
"pTWD",
"pRWF",
"pKES",
"pUGX",
"pTZS",
"pBIF",
"pETB",
"pNGN",
}

var validPTickers = func() map[string]PTicker {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require (
github.com/AdamSLevy/jsonrpc2/v13 v13.0.1
github.com/Factom-Asset-Tokens/factom v0.0.0-20191114224337-71de98ff5b3e
github.com/mattn/go-sqlite3 v1.11.0
github.com/pegnet/pegnet v0.4.1-0.20200203165724-3fc45a9a417a
github.com/pegnet/pegnet v0.5.1-0.20200818235029-f2d40e4adef5
github.com/rs/cors v1.7.0
github.com/sirupsen/logrus v1.4.2
github.com/spf13/cobra v0.0.5
Expand Down
6 changes: 6 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,12 @@ github.com/pegnet/pegnet v0.1.0-rc4.0.20200203154732-7279aa20fb8e h1:3HVpD9thq/V
github.com/pegnet/pegnet v0.1.0-rc4.0.20200203154732-7279aa20fb8e/go.mod h1:Fy8Qohe9zIuqO9Q/ZOLUNpP2kuiFqxjevzaS3IL62+E=
github.com/pegnet/pegnet v0.4.1-0.20200203165724-3fc45a9a417a h1:JWKI8cKFamD9yYr4Gq7EMzFBxjCQM/NI5K7V0wKse4U=
github.com/pegnet/pegnet v0.4.1-0.20200203165724-3fc45a9a417a/go.mod h1:Fy8Qohe9zIuqO9Q/ZOLUNpP2kuiFqxjevzaS3IL62+E=
github.com/pegnet/pegnet v0.5.1-0.20200723222201-c2cae6127a81 h1:CPsIntmwrXaKJSXnxT3vP3iK3KQ9ZVLOHD7e6HXICOo=
github.com/pegnet/pegnet v0.5.1-0.20200723222201-c2cae6127a81/go.mod h1:Fy8Qohe9zIuqO9Q/ZOLUNpP2kuiFqxjevzaS3IL62+E=
github.com/pegnet/pegnet v0.5.1-0.20200817185314-09e233fbd64d h1:bvSLli3ILdKD6bGmu8memh1+QY3KIrJ3OtvOm/tpKwo=
github.com/pegnet/pegnet v0.5.1-0.20200817185314-09e233fbd64d/go.mod h1:Fy8Qohe9zIuqO9Q/ZOLUNpP2kuiFqxjevzaS3IL62+E=
github.com/pegnet/pegnet v0.5.1-0.20200818235029-f2d40e4adef5 h1:596jFEFyLWRfodqyOgF+OXt+VtfMZnoYfq+Jq/1Oq/c=
github.com/pegnet/pegnet v0.5.1-0.20200818235029-f2d40e4adef5/go.mod h1:Fy8Qohe9zIuqO9Q/ZOLUNpP2kuiFqxjevzaS3IL62+E=
github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc=
github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
github.com/peterh/liner v1.1.1-0.20190123174540-a2c9a5303de7/go.mod h1:CRroGNssyjTd/qIG2FyxByd2S8JEAZXBl4qUrZf8GS0=
Expand Down
13 changes: 12 additions & 1 deletion node/burns.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
package node

import "encoding/hex"
import (
"encoding/hex"

"github.com/Factom-Asset-Tokens/factom"
)

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{}
)
Expand Down
35 changes: 35 additions & 0 deletions node/devs.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package node

// Special structure for the Developer rewards
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
}

// 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)
var (
DeveloperRewardAddreses = []DevReward{
{"Listing Tech Support", "FA2i9WZqJnaKbJxDY2AZdVgewE28uCcSwoFt8LJCMtGCC7tpCa2n", 10.00},
{"Architecture Dev for PegNet 2.5", "FA37cGXKWMtf2MmHy3n1rMCYeLVuR5MpDaP4VXVeFavjJCJLYYez", 9.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},
{"DeFi Integrations + PIPs Work", "FA2z6Nnaj8a5nXmwZD8tYhDENAx8ciVE3xeNeixKiFj22vZEZEdT", 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},
{"Statistics & Visualizations of PegNet", "FA3dsCiKGzwrTALfX4T2CKv8wCmNMxwJx3jS4jz1ST9fwge9Wrnm", 2.0},
{"Trading Tech Support", "FA2a2nXgkBg7pL5wrgm99rLZDGFs2T8jfTgMuia6ep8ZMkVtPe8E", 3.00},
}
)
18 changes: 18 additions & 0 deletions node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (

var (
OPRChain = factom.NewBytes32("a642a8674f46696cc47fdb6b65f9c87b2a19c5ea8123b3d2f0c13b6f33a9d5ef")
SPRChain = factom.NewBytes32("d5e395125335a21cef0ceca528168e87fe929fdac1f156870c1b1be6502448b4")
TransactionChain = factom.NewBytes32("cffce0f409ebba4ed236d49d89c70e4bd1f1367d86402a3363366683265a242d")

// Acivation Heights
Expand Down Expand Up @@ -50,6 +51,10 @@ var (
// 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
)

func SetAllActivations(act uint32) {
Expand All @@ -62,6 +67,7 @@ func SetAllActivations(act uint32) {
PEGFreeFloatingPriceActivation = act
fat2.Fat2RCDEActivation = act
V4OPRUpdate = act
V20HeightActivation = act
}

type Pegnetd struct {
Expand Down Expand Up @@ -105,6 +111,18 @@ func NewPegnetd(ctx context.Context, conf *viper.Viper) (*Pegnetd, error) {
}
}

// init burn address
FAGlobalBurnAddress, err := factom.NewFAAddress(GlobalBurnAddress)
if err != nil {
log.WithFields(log.Fields{
"error": err,
}).Info("error getting burn address")
}

log.WithFields(log.Fields{
"addr": FAGlobalBurnAddress,
}).Info("burn address loaded")

grader.InitLX()
return n, nil
}
Expand Down
3 changes: 3 additions & 0 deletions node/opr.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ func (d *Pegnetd) Grade(ctx context.Context, block *factom.EBlock) (grader.Grade
if block.Height >= V4OPRUpdate {
ver = 4
}
if block.Height >= V20HeightActivation {
ver = 5
}

var prevWinners []string = nil
prev, err := d.Pegnet.SelectPreviousWinners(ctx, block.Height)
Expand Down
Loading

0 comments on commit 44f08c4

Please sign in to comment.