Skip to content

Commit

Permalink
Remove more code
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefan-Ethernal committed Nov 6, 2023
1 parent ba4ea5d commit f2259d4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 28 deletions.
3 changes: 2 additions & 1 deletion command/genesis/predeploy/genesis_predeploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ package predeploy
import (
"fmt"

"github.com/spf13/cobra"

"github.com/0xPolygon/polygon-edge/command"
"github.com/0xPolygon/polygon-edge/command/helper"
"github.com/spf13/cobra"
)

func GetCommand() *cobra.Command {
Expand Down
32 changes: 5 additions & 27 deletions command/genesis/predeploy/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,14 @@ const (
)

var (
errInvalidPredeployAddress = errors.New("invalid predeploy address provided")
errAddressTaken = errors.New("the provided predeploy address is taken")
errReservedPredeployAddress = errors.New("the provided predeploy address is reserved")
errInvalidAddress = fmt.Errorf(
errInvalidPredeployAddress = errors.New("invalid predeploy address provided")
errAddressTaken = errors.New("the provided predeploy address is taken")
errInvalidAddress = fmt.Errorf(
"the provided predeploy address must be >= %s", predeployAddressMin.String(),
)
)

var (
predeployAddressMin = types.StringToAddress("01100")
reservedAddresses = []types.Address{}
)

var (
params = &predeployParams{}
params = &predeployParams{}
)

type predeployParams struct {
Expand Down Expand Up @@ -77,26 +70,11 @@ func (p *predeployParams) initPredeployAddress() error {
return errInvalidPredeployAddress
}

address := types.StringToAddress(p.addressRaw)
if isReservedAddress(address) {
return errReservedPredeployAddress
}

p.address = address
p.address = types.StringToAddress(p.addressRaw)

return nil
}

func isReservedAddress(address types.Address) bool {
for _, reservedAddress := range reservedAddresses {
if address == reservedAddress {
return true
}
}

return false
}

func (p *predeployParams) verifyMinAddress() error {
address, err := hex.DecodeHexToBig(p.address.String())
if err != nil {
Expand Down

0 comments on commit f2259d4

Please sign in to comment.