Skip to content

Commit 0b1dc97

Browse files
authored
chore: fund accounts in L2 genesis (#103)
1 parent d314a26 commit 0b1dc97

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

internal/artifacts.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,21 @@ func (b *ArtifactsBuilder) Build() (*Artifacts, error) {
276276
}
277277
}
278278

279+
// Update the allocs to include the same prefunded accounts as the L1 genesis.
280+
allocs := make(map[string]interface{})
281+
input["alloc"] = allocs
282+
for _, privStr := range prefundedAccounts {
283+
priv, err := getPrivKey(privStr)
284+
if err != nil {
285+
return nil, err
286+
}
287+
addr := ecrypto.PubkeyToAddress(priv.PublicKey)
288+
allocs[addr.String()] = map[string]interface{}{
289+
"balance": "0x10000000000000000000000",
290+
"nonce": "0x1",
291+
}
292+
}
293+
279294
newOpGenesis, err := overrideJSON(opGenesis, input)
280295
if err != nil {
281296
return nil, err

0 commit comments

Comments
 (0)