erigon-pulse/cmd/devnet/services/context.go
Mark Holt 751f62615d
Devnet sync events (#7911)
This request implements an end to end Polygon state sync in the devnet.

It does this by deploying smart contracts ont the L2 & L2 chain which
follow the polygon fx portal model with security checks removed to
simplify the code. The sync events generated are routed through a local
mock heimdal - to avoid the consensus process for testing purposes.

The commit also includes support code to help the delivery of additional
contract based scenratios.
2023-07-20 23:10:18 +01:00

40 lines
775 B
Go

package services
import (
"context"
"github.com/ledgerwatch/erigon/cmd/devnet/devnet"
"github.com/ledgerwatch/erigon/cmd/devnet/services/accounts"
"github.com/ledgerwatch/erigon/cmd/devnet/services/bor"
)
type ctxKey int
const (
ckFaucet ctxKey = iota
)
func Faucet(ctx context.Context) *accounts.Faucet {
if network := devnet.CurrentNetwork(ctx); network != nil {
for _, service := range network.Services {
if faucet, ok := service.(*accounts.Faucet); ok {
return faucet
}
}
}
return nil
}
func Heimdall(ctx context.Context) *bor.Heimdall {
if network := devnet.CurrentNetwork(ctx); network != nil {
for _, service := range network.Services {
if heimdall, ok := service.(*bor.Heimdall); ok {
return heimdall
}
}
}
return nil
}