mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2025-01-05 10:32:19 +00:00
751f62615d
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.
40 lines
775 B
Go
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
|
|
}
|