interfaces

package
v0.0.0-...-ac8a210 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Agent

type Agent interface {
	Send(ctx context.Context, wallet Wallet, contract *common.Contract, functionName string, value *big.Int, args ...interface{}) (string, error)
	Transfer(ctx context.Context, wallet Wallet, contract *common.Contract, value *big.Int) (string, error)
}

type BlockchainEnvironment

type BlockchainEnvironment interface {
	Setup(ctx context.Context) error
}

type Connection

type Connection interface {
	Migrate() error
	Clean() error
	GetDB() *gorm.DB
}

type ContractMapper

type ContractMapper interface {
	MapNewDTOToEntity(d *dto.NewContractDTO) *entities.Contract
	MapNewWithIdDTOToEntity(d *dto.NewContractWithIdDTO) *entities.Contract
	MapDTOToEntity(d *dto.ContractDTO) *entities.Contract
	MapEntityToDTO(c *entities.Contract) *dto.ContractDTO
	MapDTOToCommon(c *dto.ContractDTO) *common.Contract
}

type ContractPool

type ContractPool interface {
	Setup(ctx context.Context) error
}

type ContractRepo

type ContractRepo interface {
	Create(tx *gorm.DB, contract *entities.Contract) error
	Update(tx *gorm.DB, contract *entities.Contract) error
	FindAll(tx *gorm.DB) ([]entities.Contract, error)
	Find(tx *gorm.DB, id string) (*entities.Contract, error)
	FindByTaskId(tx *gorm.DB, taskId string) (*entities.Contract, error)
}

type ContractService

type ContractService interface {
	Find(contractId string) (*dto.ContractDTO, error)
	Get(contractId string) (*dto.ContractDTO, error)
	FindByTaskId(taskId string) (*dto.ContractDTO, error)
	Create(ctr *dto.NewContractDTO) (*dto.ContractDTO, error)
	CreateWithId(ctr *dto.NewContractWithIdDTO) (*dto.ContractDTO, error)
	Update(ctr *dto.ContractDTO) error
}

type ContractsController

type ContractsController interface {
	GetAgents(c *gin.Context)
}

type CronJob

type CronJob interface {
	Id() string
	CronConfig() string
	Handler()
}

type Deployer

type Deployer interface {
	Deploy(ctx context.Context, contract *common.Contract, args ...interface{}) (string, string, error)
}

type EventBus

type EventBus interface {
	Subscribe(topic string, fn interface{})
	SubscribeOnce(topic string, fn interface{})
	Unsubscribe(topic string, fn interface{})
	Publish(topic string, args ...interface{})
}

type FunctionMapper

type FunctionMapper interface {
	MapNewDTOToEntity(c *dto.NewFunctionDTO) *entities.Function
	MapDTOToEntity(c *dto.FunctionDTO) *entities.Function
	MapEntityToDTO(c *entities.Function) *dto.FunctionDTO
}

type FunctionRepo

type FunctionRepo interface {
	Get(tx *gorm.DB, id string) (*entities.Function, error)
	Create(tx *gorm.DB, function *entities.Function) error
	FindByContractId(tx *gorm.DB, contractId string) ([]entities.Function, error)
	FindConstructorByContractId(tx *gorm.DB, contractId string) (*entities.Function, error)
}

type FunctionService

type FunctionService interface {
	Get(functionId string) (*dto.FunctionDTO, error)
	Create(task *dto.NewFunctionDTO) (*dto.FunctionDTO, error)
	FindByContractId(contractId string) ([]*dto.FunctionDTO, error)
	FindConstructorByContractId(contractId string) (*dto.FunctionDTO, error)
}

type Fuzzer

type Fuzzer interface {
	GenerateInput(functionId string) ([]interface{}, error)
}

type FuzzerLeader

type FuzzerLeader interface {
	GetFuzzerStrategy(typ common.FuzzingType) (Fuzzer, error)
}

type GethService

type GethService interface {
	Deploy(ctx context.Context, contract *common.Contract, args ...interface{}) (string, string, error)
	BatchCall(ctx context.Context, contract *common.Contract, function *dto.FunctionDTO, inputsByTransactionId map[string][]interface{}) (map[string]string, map[string]error)
}

type HttpClient

type HttpClient interface {
	Do(*http.Request) (*http.Response, error)
}

type Listener

type Listener interface {
	Name() string
	StartListening(ctx context.Context)
}

type Manager

type Manager interface {
	Start()
	Shutdown()
}

type Oracle

type Oracle interface {
	Name() common.OracleType
	Detect(snapshot common.EventsSnapshot) bool
}

type PingController

type PingController interface {
	Ping(c *gin.Context)
}

type PowerSchedule

type PowerSchedule interface {
	RequestSeeds(functionId string, strategy common.PowerScheduleStrategy) ([][]interface{}, error)
}

type Reporter

type Reporter interface {
	SendOutput(ctx context.Context, report common.TaskReport) error
}

type ReporterService

type ReporterService interface {
	SendReport(ctx context.Context, report common.TaskReport) error
}

type Scheduler

type Scheduler interface {
	Start()
	Shutdown() context.Context
}

type Server

type Server interface {
	Start() error
	Shutdown(ctx context.Context) error
}

type SolidityCompiler

type SolidityCompiler interface {
	CompileSource(contractName string, source string) (*common.Contract, error)
}

type SolidityService

type SolidityService interface {
	GetTypeHandlerWithContext(typ abi.Type) (TypeHandler, error)
}

type TaskMapper

type TaskMapper interface {
	MapNewDTOToEntity(c *dto.NewTaskDTO) *entities.Task
	MapDTOToEntity(c *dto.TaskDTO) *entities.Task
	MapEntityToDTO(c *entities.Task) *dto.TaskDTO
}

type TaskRepo

type TaskRepo interface {
	Get(tx *gorm.DB, id string) (*entities.Task, error)
	Create(tx *gorm.DB, task *entities.Task) error
	Update(tx *gorm.DB, task *entities.Task) error
	FindNotFinishedTasksThatDontHaveIncompletedTransactions(tx *gorm.DB) ([]entities.Task, error)
	FindNotFinishedAndExpired(tx *gorm.DB) ([]entities.Task, error)
	FindNotFinishedAndHaveDeployedContract(tx *gorm.DB) ([]entities.Task, error)
	FindNotFinishedThatHaveDeployedContractAndLimitedPendingTransactions(tx *gorm.DB, limit int) ([]entities.Task, error)
}

type TaskService

type TaskService interface {
	Get(taskId string) (*dto.TaskDTO, error)
	Create(task *dto.NewTaskDTO) (*dto.TaskDTO, error)
	Update(task *dto.TaskDTO) error
	FindNotFinishedTasksThatDontHaveIncompletedTransactions() ([]*dto.TaskDTO, error)
	FindNotFinishedAndExpired() ([]*dto.TaskDTO, error)
	FindNotFinishedAndHaveDeployedContract() ([]*dto.TaskDTO, error)
	FindNotFinishedThatHaveDeployedContractAndLimitedPendingTransactions(limit int) ([]*dto.TaskDTO, error)
}

type TasksController

type TasksController interface {
	Start(c *gin.Context)
}

type Topic

type Topic[E any] interface {
	Publish(e E)
	Subscribe(fn interface{})
	Unsubscribe(fn interface{})
}

type TransactionMapper

type TransactionMapper interface {
	MapNewDTOToEntity(n *dto.NewTransactionDTO) *entities.Transaction
	MapDTOToEntity(c *dto.TransactionDTO) *entities.Transaction
	MapEntityToDTO(c *entities.Transaction) *dto.TransactionDTO
}

type TransactionRepo

type TransactionRepo interface {
	Get(tx *gorm.DB, id string) (*entities.Transaction, error)
	Create(tx *gorm.DB, transaction *entities.Transaction) error
	Update(tx *gorm.DB, transaction *entities.Transaction) error
	FindByBlockchainHash(tx *gorm.DB, blockchainHash string) (*entities.Transaction, error)
	FindByTaskId(tx *gorm.DB, taskId string) ([]entities.Transaction, error)
	FindDoneByTaskId(tx *gorm.DB, taskId string) ([]entities.Transaction, error)
	FindDoneTransactionsByFunctionIdAndOrderByTimestamp(tx *gorm.DB, functionId string, limit int64) ([]entities.Transaction, error)
	FindRunningAndCreatedBeforeThreshold(tx *gorm.DB, dateThreshold time.Time) ([]entities.Transaction, error)
}

type TransactionService

type TransactionService interface {
	Get(transactionId string) (*dto.TransactionDTO, error)
	Create(transaction *dto.NewTransactionDTO) (*dto.TransactionDTO, error)
	Update(transaction *dto.TransactionDTO) error
	BulkCreate(newTransactions []*dto.NewTransactionDTO) ([]*dto.TransactionDTO, error)
	BulkUpdate(updatedTransactions []*dto.TransactionDTO) error
	FindByHash(hash string) (*dto.TransactionDTO, error)
	FindByTaskId(taskId string) ([]*dto.TransactionDTO, error)
	FindDoneByTaskId(taskId string) ([]*dto.TransactionDTO, error)
	FindDoneTransactionsByFunctionIdAndOrderByTimestamp(functionId string, limit int64) ([]*dto.TransactionDTO, error)
	FindRunningAndCreatedBeforeThreshold(dateThreshold time.Time) ([]*dto.TransactionDTO, error)
}

type TransactionsController

type TransactionsController interface {
	StoreDetectedWeaknesses(c *gin.Context)
	StoreTransactionExecution(c *gin.Context)
}

type TypeHandler

type TypeHandler interface {
	GetValue() interface{}
	SetValue(value interface{})
	LoadSeedsAndChooseOneRandomly(seeds common.Seeds) error
	Serialize() string
	Deserialize(value string) error
	Generate() // Add Random provider to be mocked in tests
	GetMutators() []func()
}

type VandalClient

type VandalClient interface {
	Decompile(ctx context.Context, source string) ([]common.Block, []common.Function, error)
}

type VandalService

type VandalService interface {
	GetCFG(ctx context.Context, contract *common.Contract) (*common.CFG, error)
}

type Wallet

type Wallet interface {
	GetPrivateKey() *ecdsa.PrivateKey
	GetPrivateKeyHex() string
	GetPublicKey() *ecdsa.PublicKey
	GetPublicKeyHex() string
	GetAddress() gethcommon.Address
}

Jump to

Keyboard shortcuts

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