Skip to content

Commit 44f08c4

Browse files
authored
Merge pull request #142 from pegnet/staging
Pegnet 2.0
2 parents 7a6d381 + 81d1ce2 commit 44f08c4

File tree

20 files changed

+1535
-55
lines changed

20 files changed

+1535
-55
lines changed

cmd/args.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ func CustomArgOrderValidationBuilder(strict bool, valids ...func(cmd *cobra.Comm
5151

5252
// ArgValidatorAssetAndAll checks for valid asset or 'all'
5353
func ArgValidatorAssetOrP(cmd *cobra.Command, arg string) error {
54-
list := opr.V4Assets
54+
list := opr.V5Assets
5555
for _, an := range list {
5656
if strings.ToLower(arg) == strings.ToLower(an) {
5757
return nil

cmd/root.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ func always(cmd *cobra.Command, args []string) {
153153

154154
if testingact, _ := cmd.Flags().GetInt32("testingact"); testingact >= 0 {
155155
fat2.Fat2RCDEActivation = uint32(testingact)
156-
node.V4OPRUpdate = uint32(testingact)
156+
node.V20HeightActivation = uint32(testingact)
157157
// Also updaet hardfork
158158
pegnet.Hardforks[1].ActivationHeight = uint32(testingact)
159159
}

fat/fat2/pticker.go

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,27 @@ const (
5454
PTickerATOM
5555
PTickerBAT
5656
PTickerXTZ
57+
// V5 Additions
58+
PTickerHBAR
59+
PTickerNEO
60+
PTickerCRO
61+
PTickerETC
62+
PTickerONT
63+
PTickerDOGE
64+
PTickerVET
65+
PTickerHT
66+
PTickerALGO
67+
PTickerDGB
68+
PTickerAED
69+
PTickerARS
70+
PTickerTWD
71+
PTickerRWF
72+
PTickerKES
73+
PTickerUGX
74+
PTickerTZS
75+
PTickerBIF
76+
PTickerETB
77+
PTickerNGN
5778
PTickerMax
5879
)
5980

@@ -101,6 +122,27 @@ var validPTickerStrings = []string{
101122
"pATOM",
102123
"pBAT",
103124
"pXTZ",
125+
// V5 Additions
126+
"pHBAR",
127+
"pNEO",
128+
"pCRO",
129+
"pETC",
130+
"pONT",
131+
"pDOGE",
132+
"pVET",
133+
"pHT",
134+
"pALGO",
135+
"pDGB",
136+
"pAED",
137+
"pARS",
138+
"pTWD",
139+
"pRWF",
140+
"pKES",
141+
"pUGX",
142+
"pTZS",
143+
"pBIF",
144+
"pETB",
145+
"pNGN",
104146
}
105147

106148
var validPTickers = func() map[string]PTicker {

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ require (
66
github.com/AdamSLevy/jsonrpc2/v13 v13.0.1
77
github.com/Factom-Asset-Tokens/factom v0.0.0-20191114224337-71de98ff5b3e
88
github.com/mattn/go-sqlite3 v1.11.0
9-
github.com/pegnet/pegnet v0.4.1-0.20200203165724-3fc45a9a417a
9+
github.com/pegnet/pegnet v0.5.1-0.20200818235029-f2d40e4adef5
1010
github.com/rs/cors v1.7.0
1111
github.com/sirupsen/logrus v1.4.2
1212
github.com/spf13/cobra v0.0.5

go.sum

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,12 @@ github.com/pegnet/pegnet v0.1.0-rc4.0.20200203154732-7279aa20fb8e h1:3HVpD9thq/V
252252
github.com/pegnet/pegnet v0.1.0-rc4.0.20200203154732-7279aa20fb8e/go.mod h1:Fy8Qohe9zIuqO9Q/ZOLUNpP2kuiFqxjevzaS3IL62+E=
253253
github.com/pegnet/pegnet v0.4.1-0.20200203165724-3fc45a9a417a h1:JWKI8cKFamD9yYr4Gq7EMzFBxjCQM/NI5K7V0wKse4U=
254254
github.com/pegnet/pegnet v0.4.1-0.20200203165724-3fc45a9a417a/go.mod h1:Fy8Qohe9zIuqO9Q/ZOLUNpP2kuiFqxjevzaS3IL62+E=
255+
github.com/pegnet/pegnet v0.5.1-0.20200723222201-c2cae6127a81 h1:CPsIntmwrXaKJSXnxT3vP3iK3KQ9ZVLOHD7e6HXICOo=
256+
github.com/pegnet/pegnet v0.5.1-0.20200723222201-c2cae6127a81/go.mod h1:Fy8Qohe9zIuqO9Q/ZOLUNpP2kuiFqxjevzaS3IL62+E=
257+
github.com/pegnet/pegnet v0.5.1-0.20200817185314-09e233fbd64d h1:bvSLli3ILdKD6bGmu8memh1+QY3KIrJ3OtvOm/tpKwo=
258+
github.com/pegnet/pegnet v0.5.1-0.20200817185314-09e233fbd64d/go.mod h1:Fy8Qohe9zIuqO9Q/ZOLUNpP2kuiFqxjevzaS3IL62+E=
259+
github.com/pegnet/pegnet v0.5.1-0.20200818235029-f2d40e4adef5 h1:596jFEFyLWRfodqyOgF+OXt+VtfMZnoYfq+Jq/1Oq/c=
260+
github.com/pegnet/pegnet v0.5.1-0.20200818235029-f2d40e4adef5/go.mod h1:Fy8Qohe9zIuqO9Q/ZOLUNpP2kuiFqxjevzaS3IL62+E=
255261
github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc=
256262
github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
257263
github.com/peterh/liner v1.1.1-0.20190123174540-a2c9a5303de7/go.mod h1:CRroGNssyjTd/qIG2FyxByd2S8JEAZXBl4qUrZf8GS0=

node/burns.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,21 @@
11
package node
22

3-
import "encoding/hex"
3+
import (
4+
"encoding/hex"
5+
6+
"github.com/Factom-Asset-Tokens/factom"
7+
)
48

59
var (
610
// BurnAddress is the mainnet burn address
711
BurnAddress = "EC2BURNFCT2PEGNETooo1oooo1oooo1oooo1oooo1oooo19wthin"
12+
13+
// BurnAddress that can be used for all assets
14+
GlobalBurnAddress = "FA2BURNBABYBURNoooooooooooooooooooooooooooooooDGvNXy"
15+
16+
// Global Burn Address as proper FAAddress
17+
FAGlobalBurnAddress factom.FAAddress
18+
819
// BurnRCD is the rcd representation of the burn address
920
BurnRCD = [32]byte{}
1021
)

node/devs.go

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
package node
2+
3+
// Special structure for the Developer rewards
4+
type DevReward struct {
5+
DevGroup string // group or information about reward
6+
DevAddress string // FCT address where to send developer reward
7+
DevRewardPct float64 // % from total development rewards
8+
}
9+
10+
// Hardcode developers who work active on PegNet to avoid manipulations from config files
11+
//
12+
// contains the percentage distribution of the total 2000
13+
// defined in `pegnet` repo `modules/conversions/conversionlimit.go` as PerBlockDevelopers
14+
//
15+
// TODO: in v2.5 move into special Developer Rewards Chain (DRC)
16+
var (
17+
DeveloperRewardAddreses = []DevReward{
18+
{"Listing Tech Support", "FA2i9WZqJnaKbJxDY2AZdVgewE28uCcSwoFt8LJCMtGCC7tpCa2n", 10.00},
19+
{"Architecture Dev for PegNet 2.5", "FA37cGXKWMtf2MmHy3n1rMCYeLVuR5MpDaP4VXVeFavjJCJLYYez", 9.0},
20+
{"Trading Bots Work", "FA2wDRieaBrWeZHVuXXWUHY6t9nKCVCCKAMS5xknLUExuVAq3ziS", 9.0},
21+
{"Mining Pool Support / Dev/ Infra Hosting/ Gateway Operation", "FA3LDEA5fcskV6ZoFpKE84qPcjd7GYjEnswGHMZXL1V9d14wmgh3", 9.0},
22+
{"Media Tech Support", "FA381EygeEXjZzB6hNvxbE4oSUzHZMfvGByMZoW5UrG1gHEKJcNK", 8.0},
23+
{"Social Coverage User Support", "FA2DxkaTx1k2oGfbTqvwVMScSHHac7JFRiBjRngjRnqQpeBxsLhA", 8.0},
24+
{"pTrader + PIPs", "FA2Ersb227gn7eWJ2HPsHZ5QqxfMBZhSjwixQ44dAS17CtRXSDRU", 8.0},
25+
{"Desktop Wallet + PIPs", " FA2eFEVUzTQZxNp3LYYgjPaaHUfGmuvShhtBdGB2BBWMeByPCmJy", 8.0},
26+
{"DeFi Integrations + PIPs Work", "FA2z6Nnaj8a5nXmwZD8tYhDENAx8ciVE3xeNeixKiFj22vZEZEdT", 8.0},
27+
{"Explorer + Mobile", " FA2T72oxBxXvnujNdsVUshqFM2qV1W4nJy33nkrpxbYQV8rFbUPP", 5.0},
28+
{"Prosper / Staking GUI Upgrades", "FA2cEaq1GdGfFjhymiTEzW24DocZFZHNBqe9qkT18YPaL5ZzsgRi", 5.0},
29+
{"Payment Intergrations Work", "FA2YhZBZbc4V858ao7dJuAqRC4iwA3MrbZs7BHUPK7Mq19yYdMwZ", 3.0},
30+
{"General Development Tasks", "FA3PYuvrsDvkhnekokVNrgLn7JiL5pChSBTtR9gZB1mVGFVB7JRD", 3.0},
31+
{"Gateway Ethereum Upgrade", "FA2Wy7AzeoBuaXYnGu67xa5zdNkmqTbPryUgpy7qVPvj46GRZkep", 2.0},
32+
{"Statistics & Visualizations of PegNet", "FA3dsCiKGzwrTALfX4T2CKv8wCmNMxwJx3jS4jz1ST9fwge9Wrnm", 2.0},
33+
{"Trading Tech Support", "FA2a2nXgkBg7pL5wrgm99rLZDGFs2T8jfTgMuia6ep8ZMkVtPe8E", 3.00},
34+
}
35+
)

node/node.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import (
1717

1818
var (
1919
OPRChain = factom.NewBytes32("a642a8674f46696cc47fdb6b65f9c87b2a19c5ea8123b3d2f0c13b6f33a9d5ef")
20+
SPRChain = factom.NewBytes32("d5e395125335a21cef0ceca528168e87fe929fdac1f156870c1b1be6502448b4")
2021
TransactionChain = factom.NewBytes32("cffce0f409ebba4ed236d49d89c70e4bd1f1367d86402a3363366683265a242d")
2122

2223
// Acivation Heights
@@ -50,6 +51,10 @@ var (
5051
// V4OPRUpdate indicates the activation of additional currencies and ecdsa keys.
5152
// Estimated to be Feb 12, 2020, 18:00 UTC
5253
V4OPRUpdate uint32 = 231620
54+
55+
// V20HeightActivation indicates the activation of PegNet 2.0.
56+
// Estimated to be Aug 19th 2020 14:00 UTC
57+
V20HeightActivation uint32 = 258796
5358
)
5459

5560
func SetAllActivations(act uint32) {
@@ -62,6 +67,7 @@ func SetAllActivations(act uint32) {
6267
PEGFreeFloatingPriceActivation = act
6368
fat2.Fat2RCDEActivation = act
6469
V4OPRUpdate = act
70+
V20HeightActivation = act
6571
}
6672

6773
type Pegnetd struct {
@@ -105,6 +111,18 @@ func NewPegnetd(ctx context.Context, conf *viper.Viper) (*Pegnetd, error) {
105111
}
106112
}
107113

114+
// init burn address
115+
FAGlobalBurnAddress, err := factom.NewFAAddress(GlobalBurnAddress)
116+
if err != nil {
117+
log.WithFields(log.Fields{
118+
"error": err,
119+
}).Info("error getting burn address")
120+
}
121+
122+
log.WithFields(log.Fields{
123+
"addr": FAGlobalBurnAddress,
124+
}).Info("burn address loaded")
125+
108126
grader.InitLX()
109127
return n, nil
110128
}

node/opr.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ func (d *Pegnetd) Grade(ctx context.Context, block *factom.EBlock) (grader.Grade
3030
if block.Height >= V4OPRUpdate {
3131
ver = 4
3232
}
33+
if block.Height >= V20HeightActivation {
34+
ver = 5
35+
}
3336

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

0 commit comments

Comments
 (0)