Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bridge commands relocation #19

Merged
merged 11 commits into from
Nov 28, 2023
12 changes: 9 additions & 3 deletions command/bridge/bridge.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ package bridge
import (
"github.com/spf13/cobra"

deploy "github.com/0xPolygon/polygon-edge/command/bridge/deploy"
depositERC1155 "github.com/0xPolygon/polygon-edge/command/bridge/deposit/erc1155"
depositERC20 "github.com/0xPolygon/polygon-edge/command/bridge/deposit/erc20"
depositERC721 "github.com/0xPolygon/polygon-edge/command/bridge/deposit/erc721"
"github.com/0xPolygon/polygon-edge/command/bridge/exit"
"github.com/0xPolygon/polygon-edge/command/bridge/mint"
"github.com/0xPolygon/polygon-edge/command/bridge/fund"
"github.com/0xPolygon/polygon-edge/command/bridge/server"
withdrawERC1155 "github.com/0xPolygon/polygon-edge/command/bridge/withdraw/erc1155"
withdrawERC20 "github.com/0xPolygon/polygon-edge/command/bridge/withdraw/erc20"
withdrawERC721 "github.com/0xPolygon/polygon-edge/command/bridge/withdraw/erc721"
Expand Down Expand Up @@ -41,7 +43,11 @@ func registerSubcommands(baseCmd *cobra.Command) {
withdrawERC1155.GetCommand(),
// bridge exit
exit.GetCommand(),
// bridge mint erc-20
mint.GetCommand(),
// bridge deploy
deploy.GetCommand(),
// bridge server
server.GetCommand(),
// bridge fund
fund.GetCommand(),
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import (

"github.com/0xPolygon/polygon-edge/chain"
"github.com/0xPolygon/polygon-edge/command"
"github.com/0xPolygon/polygon-edge/command/bridge/helper"
cmdHelper "github.com/0xPolygon/polygon-edge/command/helper"
"github.com/0xPolygon/polygon-edge/command/rootchain/helper"
"github.com/0xPolygon/polygon-edge/consensus/polybft"
"github.com/0xPolygon/polygon-edge/consensus/polybft/contractsapi"
"github.com/0xPolygon/polygon-edge/consensus/polybft/contractsapi/artifact"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"github.com/umbracle/ethgo/testutil"

"github.com/0xPolygon/polygon-edge/command"
"github.com/0xPolygon/polygon-edge/command/rootchain/helper"
"github.com/0xPolygon/polygon-edge/command/bridge/helper"
"github.com/0xPolygon/polygon-edge/consensus/polybft"
"github.com/0xPolygon/polygon-edge/consensus/polybft/contractsapi"
"github.com/0xPolygon/polygon-edge/consensus/polybft/validator"
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion command/bridge/deposit/erc1155/deposit_erc1155.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

"github.com/0xPolygon/polygon-edge/command"
"github.com/0xPolygon/polygon-edge/command/bridge/common"
"github.com/0xPolygon/polygon-edge/command/rootchain/helper"
"github.com/0xPolygon/polygon-edge/command/bridge/helper"
"github.com/0xPolygon/polygon-edge/consensus/polybft/contractsapi"
helperCommon "github.com/0xPolygon/polygon-edge/helper/common"
"github.com/0xPolygon/polygon-edge/txrelayer"
Expand Down
2 changes: 1 addition & 1 deletion command/bridge/deposit/erc20/deposit_erc20.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

"github.com/0xPolygon/polygon-edge/command"
"github.com/0xPolygon/polygon-edge/command/bridge/common"
"github.com/0xPolygon/polygon-edge/command/rootchain/helper"
"github.com/0xPolygon/polygon-edge/command/bridge/helper"
"github.com/0xPolygon/polygon-edge/consensus/polybft/contractsapi"
helperCommon "github.com/0xPolygon/polygon-edge/helper/common"
"github.com/0xPolygon/polygon-edge/txrelayer"
Expand Down
2 changes: 1 addition & 1 deletion command/bridge/deposit/erc721/deposit_erc721.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

"github.com/0xPolygon/polygon-edge/command"
"github.com/0xPolygon/polygon-edge/command/bridge/common"
"github.com/0xPolygon/polygon-edge/command/rootchain/helper"
"github.com/0xPolygon/polygon-edge/command/bridge/helper"
"github.com/0xPolygon/polygon-edge/consensus/polybft/contractsapi"
helperCommon "github.com/0xPolygon/polygon-edge/helper/common"
"github.com/0xPolygon/polygon-edge/txrelayer"
Expand Down
2 changes: 1 addition & 1 deletion command/bridge/exit/exit.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import (

"github.com/0xPolygon/polygon-edge/command"
"github.com/0xPolygon/polygon-edge/command/bridge/common"
"github.com/0xPolygon/polygon-edge/command/bridge/helper"
cmdHelper "github.com/0xPolygon/polygon-edge/command/helper"
"github.com/0xPolygon/polygon-edge/command/rootchain/helper"
"github.com/0xPolygon/polygon-edge/consensus/polybft/contractsapi"
"github.com/0xPolygon/polygon-edge/txrelayer"
"github.com/0xPolygon/polygon-edge/types"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"golang.org/x/sync/errgroup"

"github.com/0xPolygon/polygon-edge/command"
"github.com/0xPolygon/polygon-edge/command/rootchain/helper"
"github.com/0xPolygon/polygon-edge/command/bridge/helper"
polybftsecrets "github.com/0xPolygon/polygon-edge/command/secrets/init"
"github.com/0xPolygon/polygon-edge/txrelayer"
"github.com/0xPolygon/polygon-edge/types"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"fmt"
"math/big"

bridgeHelper "github.com/0xPolygon/polygon-edge/command/bridge/helper"
cmdhelper "github.com/0xPolygon/polygon-edge/command/helper"
rootHelper "github.com/0xPolygon/polygon-edge/command/rootchain/helper"
"github.com/0xPolygon/polygon-edge/types"
)

Expand All @@ -33,11 +33,11 @@ type fundParams struct {

func (fp *fundParams) validateFlags() error {
if len(fp.addresses) == 0 {
return rootHelper.ErrNoAddressesProvided
return bridgeHelper.ErrNoAddressesProvided
}

if len(fp.amounts) != len(fp.addresses) {
return rootHelper.ErrInconsistentLength
return bridgeHelper.ErrInconsistentLength
}

for _, addr := range fp.addresses {
Expand All @@ -58,7 +58,7 @@ func (fp *fundParams) validateFlags() error {

if fp.mintStakeToken {
if fp.stakeTokenAddr == "" {
return rootHelper.ErrMandatoryStakeToken
return bridgeHelper.ErrMandatoryStakeToken
}

if err := types.IsValidAddress(fp.stakeTokenAddr); err != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (

"github.com/stretchr/testify/require"

rootHelper "github.com/0xPolygon/polygon-edge/command/rootchain/helper"
bridgeHelper "github.com/0xPolygon/polygon-edge/command/bridge/helper"
"github.com/0xPolygon/polygon-edge/types"
)

Expand Down Expand Up @@ -55,7 +55,7 @@ func Test_validateFlags(t *testing.T) {
amounts: []string{"10", "20"},
}
},
err: rootHelper.ErrMandatoryStakeToken.Error(),
err: bridgeHelper.ErrMandatoryStakeToken.Error(),
},
{
// stake token address omitted
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"github.com/spf13/cobra"

"github.com/0xPolygon/polygon-edge/command"
"github.com/0xPolygon/polygon-edge/command/rootchain/helper"
"github.com/0xPolygon/polygon-edge/command/bridge/helper"
"github.com/0xPolygon/polygon-edge/helper/common"
)

Expand Down
2 changes: 1 addition & 1 deletion command/bridge/withdraw/erc1155/withdraw_erc1155.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (

"github.com/0xPolygon/polygon-edge/command"
"github.com/0xPolygon/polygon-edge/command/bridge/common"
"github.com/0xPolygon/polygon-edge/command/rootchain/helper"
"github.com/0xPolygon/polygon-edge/command/bridge/helper"
"github.com/0xPolygon/polygon-edge/consensus/polybft/contractsapi"
"github.com/0xPolygon/polygon-edge/contracts"
helperCommon "github.com/0xPolygon/polygon-edge/helper/common"
Expand Down
2 changes: 1 addition & 1 deletion command/bridge/withdraw/erc20/withdraw_erc20.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (

"github.com/0xPolygon/polygon-edge/command"
"github.com/0xPolygon/polygon-edge/command/bridge/common"
"github.com/0xPolygon/polygon-edge/command/rootchain/helper"
"github.com/0xPolygon/polygon-edge/command/bridge/helper"
"github.com/0xPolygon/polygon-edge/consensus/polybft/contractsapi"
"github.com/0xPolygon/polygon-edge/contracts"
helperCommon "github.com/0xPolygon/polygon-edge/helper/common"
Expand Down
2 changes: 1 addition & 1 deletion command/bridge/withdraw/erc721/withdraw_erc721.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (

"github.com/0xPolygon/polygon-edge/command"
"github.com/0xPolygon/polygon-edge/command/bridge/common"
"github.com/0xPolygon/polygon-edge/command/rootchain/helper"
"github.com/0xPolygon/polygon-edge/command/bridge/helper"
"github.com/0xPolygon/polygon-edge/consensus/polybft/contractsapi"
"github.com/0xPolygon/polygon-edge/contracts"
helperCommon "github.com/0xPolygon/polygon-edge/helper/common"
Expand Down
18 changes: 9 additions & 9 deletions command/genesis/polybft_params.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,6 @@ func (p *genesisParams) generateChainConfig(o command.OutputFormatter) error {

chainConfig.Params.BurnContract = make(map[uint64]types.Address, 1)
chainConfig.Params.BurnContract[0] = types.ZeroAddress
chainConfig.Genesis.BaseFee = p.parsedBaseFeeConfig.baseFee
chainConfig.Genesis.BaseFeeEM = p.parsedBaseFeeConfig.baseFeeEM
chainConfig.Genesis.BaseFeeChangeDenom = p.parsedBaseFeeConfig.baseFeeChangeDenom

// deploy genesis contracts
allocs, err := p.deployContracts(rewardTokenByteCode, polyBftConfig, chainConfig)
Expand Down Expand Up @@ -215,12 +212,15 @@ func (p *genesisParams) generateChainConfig(o command.OutputFormatter) error {

// populate genesis parameters
chainConfig.Genesis = &chain.Genesis{
GasLimit: p.blockGasLimit,
Difficulty: 0,
Alloc: allocs,
ExtraData: genesisExtraData,
GasUsed: command.DefaultGenesisGasUsed,
Mixhash: polybft.PolyBFTMixDigest,
GasLimit: p.blockGasLimit,
Difficulty: 0,
Alloc: allocs,
ExtraData: genesisExtraData,
GasUsed: command.DefaultGenesisGasUsed,
Mixhash: polybft.PolyBFTMixDigest,
BaseFee: p.parsedBaseFeeConfig.baseFee,
BaseFeeEM: p.parsedBaseFeeConfig.baseFeeEM,
BaseFeeChangeDenom: p.parsedBaseFeeConfig.baseFeeChangeDenom,
}

if len(p.contractDeployerAllowListAdmin) != 0 {
Expand Down
35 changes: 0 additions & 35 deletions command/license/license.go

This file was deleted.

44 changes: 0 additions & 44 deletions command/license/result.go

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"fmt"

"github.com/0xPolygon/polygon-edge/command"
rootHelper "github.com/0xPolygon/polygon-edge/command/bridge/helper"
"github.com/0xPolygon/polygon-edge/command/helper"
rootHelper "github.com/0xPolygon/polygon-edge/command/rootchain/helper"
polybftsecrets "github.com/0xPolygon/polygon-edge/command/secrets/init"
"github.com/0xPolygon/polygon-edge/txrelayer"
"github.com/0xPolygon/polygon-edge/types"
Expand Down
2 changes: 1 addition & 1 deletion command/bridge/mint/params.go → command/mint/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"fmt"
"math/big"

rootHelper "github.com/0xPolygon/polygon-edge/command/bridge/helper"
"github.com/0xPolygon/polygon-edge/command/helper"
rootHelper "github.com/0xPolygon/polygon-edge/command/rootchain/helper"
"github.com/0xPolygon/polygon-edge/types"
)

Expand Down
10 changes: 4 additions & 6 deletions command/root/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,16 @@ import (
"github.com/0xPolygon/polygon-edge/command/bridge"
"github.com/0xPolygon/polygon-edge/command/genesis"
"github.com/0xPolygon/polygon-edge/command/helper"
"github.com/0xPolygon/polygon-edge/command/license"
"github.com/0xPolygon/polygon-edge/command/mint"
"github.com/0xPolygon/polygon-edge/command/monitor"
"github.com/0xPolygon/polygon-edge/command/peers"
"github.com/0xPolygon/polygon-edge/command/polybft"
"github.com/0xPolygon/polygon-edge/command/regenesis"
"github.com/0xPolygon/polygon-edge/command/rootchain"
"github.com/0xPolygon/polygon-edge/command/secrets"
polybftsecrets "github.com/0xPolygon/polygon-edge/command/secrets/init"
"github.com/0xPolygon/polygon-edge/command/server"
"github.com/0xPolygon/polygon-edge/command/status"
"github.com/0xPolygon/polygon-edge/command/txpool"
"github.com/0xPolygon/polygon-edge/command/validator"
"github.com/0xPolygon/polygon-edge/command/version"
)

Expand Down Expand Up @@ -49,16 +48,15 @@ func (rc *RootCommand) registerSubCommands() {
status.GetCommand(),
secrets.GetCommand(),
peers.GetCommand(),
rootchain.GetCommand(),
monitor.GetCommand(),
backup.GetCommand(),
genesis.GetCommand(),
server.GetCommand(),
license.GetCommand(),
polybftsecrets.GetCommand(),
polybft.GetCommand(),
bridge.GetCommand(),
regenesis.GetCommand(),
mint.GetCommand(),
validator.GetCommand(),
)
}

Expand Down
41 changes: 0 additions & 41 deletions command/rootchain/README.md

This file was deleted.

Loading
Loading