Skip to content

Commit 29434e5

Browse files
committed
removed unused wallet code
1 parent 7774ead commit 29434e5

File tree

2 files changed

+3
-188
lines changed

2 files changed

+3
-188
lines changed

op-nat/config.go

Lines changed: 3 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
package nat
22

33
import (
4-
"context"
54
"encoding/json"
65
"errors"
76
"fmt"
87
"math/big"
9-
"math/rand"
108
"os"
119
"path/filepath"
1210
"strconv"
@@ -15,23 +13,19 @@ import (
1513

1614
"github.com/ethereum-optimism/infra/op-nat/flags"
1715
"github.com/ethereum-optimism/infra/op-nat/network"
18-
"github.com/ethereum-optimism/infra/op-nat/wallet"
1916
"github.com/ethereum/go-ethereum/log"
2017
)
2118

2219
type Config struct {
2320
// Network config
24-
SC SuperchainManifest
21+
SC SuperchainManifest
22+
L1 *network.Network
23+
L2A *network.Network
2524

2625
// Test config
2726
TestDir string
2827
ValidatorConfig string
2928
TargetGate string
30-
Wallets []*wallet.Wallet
31-
32-
// Networks
33-
L1 *network.Network
34-
L2A *network.Network
3529

3630
Log log.Logger
3731
}
@@ -68,15 +62,6 @@ func NewConfig(ctx *cli.Context, log log.Logger, testDir string, validatorConfig
6862
return nil, fmt.Errorf("failed to parse kurtosis-devnet manifest: %w", err)
6963
}
7064

71-
wallets := []*wallet.Wallet{}
72-
for i, w := range manifest.L1.Wallets {
73-
w, err := wallet.NewWallet(w.PrivateKey, fmt.Sprintf("user-key-%s", i))
74-
if err != nil {
75-
log.Warn("error creating wallet", "err", err)
76-
}
77-
wallets = append(wallets, w)
78-
}
79-
8065
l1ID, err := strconv.Atoi(manifest.L1.ID)
8166
if err != nil {
8267
log.Warn("L1 Chain ID was not supplied, will skip l1 chain-id test")
@@ -120,7 +105,6 @@ func NewConfig(ctx *cli.Context, log log.Logger, testDir string, validatorConfig
120105
TargetGate: gate,
121106
L1: l1,
122107
L2A: l2A,
123-
Wallets: wallets,
124108
Log: log,
125109
}, nil
126110
}
@@ -138,43 +122,3 @@ func parseManifest(manifestPath string) (*SuperchainManifest, error) {
138122
return &superchainManifest, nil
139123

140124
}
141-
142-
// GetNetworks returns all of the networks in an array
143-
func (c *Config) GetNetworks() []*network.Network {
144-
return []*network.Network{
145-
c.L1,
146-
c.L2A,
147-
}
148-
}
149-
150-
func (c *Config) GetRandomWallet() *wallet.Wallet {
151-
randomIndex := rand.Intn(len(c.Wallets))
152-
return c.Wallets[randomIndex]
153-
}
154-
155-
// GetWalletWithBalance is used to find a wallet with a balance of atleast amount on a network
156-
func (c *Config) GetWalletWithBalance(ctx context.Context, network *network.Network, amount *big.Int) (*wallet.Wallet, error) {
157-
for _, w := range c.Wallets {
158-
balance, err := w.GetBalance(ctx, network)
159-
if err != nil {
160-
log.Error("error getting wallet balance",
161-
"wallet", w.Address(),
162-
"network", network.Name,
163-
)
164-
return nil, err
165-
}
166-
log.Info("",
167-
"wallet", w.Address(),
168-
"balance", balance,
169-
"network", network.Name,
170-
)
171-
// balance >= amount will return 0 or 1
172-
if balance.Cmp(amount) >= 0 {
173-
return w, nil
174-
}
175-
}
176-
return nil, fmt.Errorf("no wallet found with balance %d on network %s",
177-
amount,
178-
network.Name,
179-
)
180-
}

op-nat/wallet/wallet.go

Lines changed: 0 additions & 129 deletions
This file was deleted.

0 commit comments

Comments
 (0)