Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/chain_pusher/pkg/evm/interactor.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ func NewContractInteractor(
func (eci *ContractInteractor) ConnectHTTP(ctx context.Context, url string) error {
eci.logger.Info().Str("url", url).Msg("ConnectHTTP")

client, err := ethclient.Dial(url)
client, err := ethclient.DialContext(ctx, url)
if err != nil {
return fmt.Errorf("failed to connect to RPC: %w", err)
}
Expand Down
24 changes: 24 additions & 0 deletions apps/chain_pusher/pkg/evm/nonce_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,27 @@ func (n *LocalNonceManager) ResetNonce(ctx context.Context, ethClient *ethclient
n.nonce = nil
return nil
}

type NonceManagerType string

const (
NonceManagerTypeNoop NonceManagerType = "noop"
NonceManagerTypeServer NonceManagerType = "server"
NonceManagerTypeServerPending NonceManagerType = "serverPending"
NonceManagerTypeLocal NonceManagerType = "local"
)

func NewNonceManagerFromType(t NonceManagerType) (NonceManagerI, error) {
switch t {
case NonceManagerTypeNoop, "":
return NewNoopNonceManager(), nil
case NonceManagerTypeServer:
return NewServerNonceManager(false), nil
case NonceManagerTypeServerPending:
return NewServerNonceManager(true), nil
case NonceManagerTypeLocal:
return NewLocalNonceManager(), nil
default:
return nil, fmt.Errorf("unknown nonce manager type: %s", string(t))
}
}
25 changes: 0 additions & 25 deletions apps/chain_pusher/pkg/evm/push.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,12 @@ package evm

import (
"context"
"fmt"
"os"

"github.com/Stork-Oracle/stork-external/apps/chain_pusher/pkg/pusher"
"github.com/spf13/cobra"
)

type NonceManagerType string

const (
NonceManagerTypeNoop NonceManagerType = "noop"
NonceManagerTypeServer NonceManagerType = "server"
NonceManagerTypeServerPending NonceManagerType = "serverPending"
NonceManagerTypeLocal NonceManagerType = "local"
)

func NewNonceManagerFromType(t NonceManagerType) (NonceManagerI, error) {
switch t {
case NonceManagerTypeNoop, "":
return NewNoopNonceManager(), nil
case NonceManagerTypeServer:
return NewServerNonceManager(false), nil
case NonceManagerTypeServerPending:
return NewServerNonceManager(true), nil
case NonceManagerTypeLocal:
return NewLocalNonceManager(), nil
default:
return nil, fmt.Errorf("unknown nonce manager type: %s", string(t))
}
}

func NewPushCmd() *cobra.Command {
pushCmd := &cobra.Command{
Use: "evm",
Expand Down
Loading