graph

package
v0.0.0-...-c0e68af Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 24, 2024 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const SiteVerifyUrl = "https://challenges.cloudflare.com/turnstile/v0/siteverify"

SiteVerifyUrl to use to check Turnstile with

View Source
const StakerCutoff = 10_000

StakerCutoff to require before allowing to use the faucet

View Source
const TimeToLive = 10 * time.Second

!!! WARNING !!! The code below was going to be deleted when updating resolvers. It has been copied here so you have one last chance to move it out of harms way if you want. There are two reasons this happens:

  • When renaming or deleting a resolver the old code will be put in here. You can safely delete it when you're done.
  • You have helper methods in this file. Move them out to keep these resolver files clean.
View Source
const UrlModeratorsGraph = "https://moderators.fluidity.money/"

UrlModeratorsGraph to ask whether a user is currently staking and their point threshold

Variables

This section is empty.

Functions

func IsContract

func IsContract(c *ethclient.Client, ctx context.Context, a ethCommon.Address) (bool, error)

IsContract test by checking the contract size with Geth to see if it's greater than 0.

func IsUserStaker

func IsUserStaker(wallet string) (bool, error)

func IsValidWallet

func IsValidWallet(a string) bool

func NewExecutableSchema

func NewExecutableSchema(cfg Config) graphql.ExecutableSchema

NewExecutableSchema creates an ExecutableSchema from the ResolverRoot interface.

func VerifyTurnstile

func VerifyTurnstile(secret, key string) (bool, error)

VerifyTurnstile by making a request to Cloudflare, returning an error if it happens, and false if we can't verify them upstream.

Types

type ComplexityRoot

type ComplexityRoot struct {
	Mutation struct {
		RequestTokens func(childComplexity int, wallet string, turnstileToken string) int
	}

	Query struct {
		Healthcheck func(childComplexity int) int
	}
}

type Config

type Config struct {
	Schema     *ast.Schema
	Resolvers  ResolverRoot
	Directives DirectiveRoot
	Complexity ComplexityRoot
}

type DirectiveRoot

type DirectiveRoot struct {
}

type FaucetReq

type FaucetReq struct {
	Addr     ethCommon.Address
	IsStaker bool
	Resp     chan error
}

FaucetReq to an IP address given, assuming they passed the restrictions.

type MutationResolver

type MutationResolver interface {
	RequestTokens(ctx context.Context, wallet string, turnstileToken string) (string, error)
}

type QueryResolver

type QueryResolver interface {
	Healthcheck(ctx context.Context) (int, error)
}

type Resolver

type Resolver struct {
	DB              *gorm.DB   // db used to look up any fields that are missing from a request.
	F               features.F // features to have enabled when requested
	C               config.C   // config for connecting to the right endpoints
	TurnstileSecret string     // Turnstile secret to use for verification
}

func (*Resolver) Mutation

func (r *Resolver) Mutation() MutationResolver

Mutation returns MutationResolver implementation.

func (*Resolver) Query

func (r *Resolver) Query() QueryResolver

Query returns QueryResolver implementation.

type ResolverRoot

type ResolverRoot interface {
	Mutation() MutationResolver
	Query() QueryResolver
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL