contracts

package
v0.0.1-hotfix Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2021 License: MIT Imports: 17 Imported by: 0

README

Contracts

Contains all code to launch, and interact with smart contracts on a blockchain.

All contracts are generalized by interfaces in order to simplify test logic across different chains.

Documentation

Overview

Package contracts handles deployment, management, and interactions of smart contracts on various chains

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIConsumer

type APIConsumer interface {
	Address() string
	Fund(fromWallet client.BlockchainWallet, ethAmount, linkAmount *big.Float) error
	Data(ctx context.Context) (*big.Int, error)
	CreateRequestTo(
		fromWallet client.BlockchainWallet,
		oracleAddr string,
		jobID [32]byte,
		payment *big.Int,
		url string,
		path string,
		times *big.Int,
	) error
}

type BlockHashStore

type BlockHashStore interface {
	Address() string
}

type ContractDeployer

type ContractDeployer interface {
	DeployStorageContract(fromWallet client.BlockchainWallet) (Storage, error)
	DeployAPIConsumer(fromWallet client.BlockchainWallet, linkAddr string) (APIConsumer, error)
	DeployOracle(fromWallet client.BlockchainWallet, linkAddr string) (Oracle, error)
	DeployReadAccessController(fromWallet client.BlockchainWallet) (ReadAccessController, error)
	DeployFlags(fromWallet client.BlockchainWallet, rac string) (Flags, error)
	DeployDeviationFlaggingValidator(
		fromWallet client.BlockchainWallet,
		flags string,
		flaggingThreshold *big.Int,
	) (DeviationFlaggingValidator, error)
	DeployFluxAggregatorContract(
		fromWallet client.BlockchainWallet,
		fluxOptions FluxAggregatorOptions,
	) (FluxAggregator, error)
	DeployLinkTokenContract(fromWallet client.BlockchainWallet) (LinkToken, error)
	DeployOffChainAggregator(
		fromWallet client.BlockchainWallet,
		offchainOptions OffchainOptions,
	) (OffchainAggregator, error)
	DeployVRFContract(fromWallet client.BlockchainWallet) (VRF, error)
	DeployMockETHLINKFeed(fromWallet client.BlockchainWallet, answer *big.Int) (MockETHLINKFeed, error)
	DeployMockGasFeed(fromWallet client.BlockchainWallet, answer *big.Int) (MockGasFeed, error)
	DeployUpkeepRegistrationRequests(fromWallet client.BlockchainWallet, linkAddr string, minLinkJuels *big.Int) (UpkeepRegistrar, error)
	DeployKeeperRegistry(
		fromWallet client.BlockchainWallet,
		opts *KeeperRegistryOpts,
	) (KeeperRegistry, error)
	DeployKeeperConsumer(fromWallet client.BlockchainWallet, updateInterval *big.Int) (KeeperConsumer, error)
	DeployVRFConsumer(fromWallet client.BlockchainWallet, linkAddr string, coordinatorAddr string) (VRFConsumer, error)
	DeployVRFCoordinator(fromWallet client.BlockchainWallet, linkAddr string, bhsAddr string) (VRFCoordinator, error)
	DeployBlockhashStore(fromWallet client.BlockchainWallet) (BlockHashStore, error)
}

ContractDeployer is an interface for abstracting the contract deployment methods across network implementations

func NewContractDeployer

func NewContractDeployer(bcClient client.BlockchainClient) (ContractDeployer, error)

NewContractDeployer returns an instance of a contract deployer based on the client type

type DeviationFlaggingValidator

type DeviationFlaggingValidator interface {
	Address() string
}

DeviationFlaggingValidator contract used as an external validator, fox ex. in flux monitor rounds validation

type EthereumAPIConsumer

type EthereumAPIConsumer struct {
	// contains filtered or unexported fields
}

EthereumAPIConsumer API consumer for job type "directrequest" tests

func (*EthereumAPIConsumer) Address

func (e *EthereumAPIConsumer) Address() string

func (*EthereumAPIConsumer) CreateRequestTo

func (e *EthereumAPIConsumer) CreateRequestTo(
	fromWallet client.BlockchainWallet,
	oracleAddr string,
	jobID [32]byte,
	payment *big.Int,
	url string,
	path string,
	times *big.Int,
) error

CreateRequestTo creates request to an oracle for particular jobID with params

func (*EthereumAPIConsumer) Data

func (e *EthereumAPIConsumer) Data(ctx context.Context) (*big.Int, error)

func (*EthereumAPIConsumer) Fund

func (e *EthereumAPIConsumer) Fund(fromWallet client.BlockchainWallet, ethAmount, linkAmount *big.Float) error

type EthereumBlockhashStore

type EthereumBlockhashStore struct {
	// contains filtered or unexported fields
}

EthereumBlockhashStore represents a blockhash store for VRF contract

func (*EthereumBlockhashStore) Address

func (v *EthereumBlockhashStore) Address() string

type EthereumContractDeployer

type EthereumContractDeployer struct {
	// contains filtered or unexported fields
}

EthereumContractDeployer provides the implementations for deploying ETH (EVM) based contracts

func NewEthereumContractDeployer

func NewEthereumContractDeployer(ethClient *client.EthereumClient) *EthereumContractDeployer

NewEthereumContractDeployer returns an instantiated instance of the ETH contract deployer

func (*EthereumContractDeployer) DeployAPIConsumer

func (e *EthereumContractDeployer) DeployAPIConsumer(fromWallet client.BlockchainWallet, linkAddr string) (APIConsumer, error)

DeployAPIConsumer deploys api consumer for oracle

func (*EthereumContractDeployer) DeployBlockhashStore

func (e *EthereumContractDeployer) DeployBlockhashStore(fromWallet client.BlockchainWallet) (BlockHashStore, error)

DeployBlockhashStore deploys blockhash store used with VRF contract

func (*EthereumContractDeployer) DeployDeviationFlaggingValidator

func (e *EthereumContractDeployer) DeployDeviationFlaggingValidator(
	fromWallet client.BlockchainWallet,
	flags string,
	flaggingThreshold *big.Int,
) (DeviationFlaggingValidator, error)

DeployDeviationFlaggingValidator deploys deviation flagging validator contract

func (*EthereumContractDeployer) DeployFlags

func (e *EthereumContractDeployer) DeployFlags(
	fromWallet client.BlockchainWallet,
	rac string,
) (Flags, error)

DeployFlags deploys flags contract

func (*EthereumContractDeployer) DeployFluxAggregatorContract

func (e *EthereumContractDeployer) DeployFluxAggregatorContract(
	fromWallet client.BlockchainWallet,
	fluxOptions FluxAggregatorOptions,
) (FluxAggregator, error)

DeployFluxAggregatorContract deploys the Flux Aggregator Contract on an EVM chain

func (*EthereumContractDeployer) DeployKeeperConsumer

func (e *EthereumContractDeployer) DeployKeeperConsumer(fromWallet client.BlockchainWallet, updateInterval *big.Int) (KeeperConsumer, error)

func (*EthereumContractDeployer) DeployKeeperRegistry

func (e *EthereumContractDeployer) DeployKeeperRegistry(
	fromWallet client.BlockchainWallet,
	opts *KeeperRegistryOpts,
) (KeeperRegistry, error)

func (*EthereumContractDeployer) DeployLinkTokenContract

func (e *EthereumContractDeployer) DeployLinkTokenContract(fromWallet client.BlockchainWallet) (LinkToken, error)

DeployLinkTokenContract deploys a Link Token contract to an EVM chain

func (*EthereumContractDeployer) DeployMockETHLINKFeed

func (e *EthereumContractDeployer) DeployMockETHLINKFeed(fromWallet client.BlockchainWallet, answer *big.Int) (MockETHLINKFeed, error)

func (*EthereumContractDeployer) DeployMockGasFeed

func (e *EthereumContractDeployer) DeployMockGasFeed(fromWallet client.BlockchainWallet, answer *big.Int) (MockGasFeed, error)

func (*EthereumContractDeployer) DeployOffChainAggregator

func (e *EthereumContractDeployer) DeployOffChainAggregator(
	fromWallet client.BlockchainWallet,
	offchainOptions OffchainOptions,
) (OffchainAggregator, error)

DeployOffChainAggregator deploys the offchain aggregation contract to the EVM chain

func (*EthereumContractDeployer) DeployOracle

func (e *EthereumContractDeployer) DeployOracle(fromWallet client.BlockchainWallet, linkAddr string) (Oracle, error)

DeployOracle deploys oracle for consumer test

func (*EthereumContractDeployer) DeployReadAccessController

func (e *EthereumContractDeployer) DeployReadAccessController(
	fromWallet client.BlockchainWallet,
) (ReadAccessController, error)

DeployReadAccessController deploys read/write access controller contract

func (*EthereumContractDeployer) DeployStorageContract

func (e *EthereumContractDeployer) DeployStorageContract(fromWallet client.BlockchainWallet) (Storage, error)

DeployStorageContract deploys a vanilla storage contract that is a value store

func (*EthereumContractDeployer) DeployUpkeepRegistrationRequests

func (e *EthereumContractDeployer) DeployUpkeepRegistrationRequests(fromWallet client.BlockchainWallet, linkAddr string, minLinkJuels *big.Int) (UpkeepRegistrar, error)

func (*EthereumContractDeployer) DeployVRFConsumer

func (e *EthereumContractDeployer) DeployVRFConsumer(fromWallet client.BlockchainWallet, linkAddr string, coordinatorAddr string) (VRFConsumer, error)

DeployVRFConsumer deploys VRF consumer contract

func (*EthereumContractDeployer) DeployVRFContract

func (e *EthereumContractDeployer) DeployVRFContract(fromWallet client.BlockchainWallet) (VRF, error)

DeployVRFContract deploy VRF contract

func (*EthereumContractDeployer) DeployVRFCoordinator

func (e *EthereumContractDeployer) DeployVRFCoordinator(fromWallet client.BlockchainWallet, linkAddr string, bhsAddr string) (VRFCoordinator, error)

DeployVRFCoordinator deploys VRF coordinator contract

type EthereumDeviationFlaggingValidator

type EthereumDeviationFlaggingValidator struct {
	// contains filtered or unexported fields
}

EthereumDeviationFlaggingValidator represents deviation flagging validator contract

func (*EthereumDeviationFlaggingValidator) Address

type EthereumFlags

type EthereumFlags struct {
	// contains filtered or unexported fields
}

EthereumFlags represents flags contract

func (*EthereumFlags) Address

func (e *EthereumFlags) Address() string

func (*EthereumFlags) GetFlag

func (e *EthereumFlags) GetFlag(ctx context.Context, addr string) (bool, error)

GetFlag returns boolean if a flag was set for particular address

type EthereumFluxAggregator

type EthereumFluxAggregator struct {
	// contains filtered or unexported fields
}

EthereumFluxAggregator represents the basic flux aggregation contract

func (*EthereumFluxAggregator) Address

func (f *EthereumFluxAggregator) Address() string

func (*EthereumFluxAggregator) Description

func (f *EthereumFluxAggregator) Description(ctxt context.Context) (string, error)

Description returns the description of the flux aggregator contract

func (*EthereumFluxAggregator) Fund

func (f *EthereumFluxAggregator) Fund(fromWallet client.BlockchainWallet, ethAmount, linkAmount *big.Float) error

Fund sends specified currencies to the contract

func (*EthereumFluxAggregator) GetContractData

func (f *EthereumFluxAggregator) GetContractData(ctx context.Context) (*FluxAggregatorData, error)

GetContractData retrieves basic data for the flux aggregator contract

func (*EthereumFluxAggregator) GetOracles

func (f *EthereumFluxAggregator) GetOracles(ctx context.Context) ([]string, error)

func (*EthereumFluxAggregator) LatestRoundData

func (f *EthereumFluxAggregator) LatestRoundData(ctx context.Context) (RoundData, error)

func (*EthereumFluxAggregator) LatestRoundID

func (f *EthereumFluxAggregator) LatestRoundID(ctx context.Context, blockNumber *big.Int) (*big.Int, error)

func (*EthereumFluxAggregator) PaymentAmount

func (f *EthereumFluxAggregator) PaymentAmount(ctx context.Context) (*big.Int, error)

func (*EthereumFluxAggregator) RequestNewRound

func (f *EthereumFluxAggregator) RequestNewRound(ctx context.Context, fromWallet client.BlockchainWallet) error

func (*EthereumFluxAggregator) SetOracles

SetOracles allows the ability to add and/or remove oracles from the contract, and to set admins

func (*EthereumFluxAggregator) SetRequesterPermissions

func (f *EthereumFluxAggregator) SetRequesterPermissions(ctx context.Context, fromWallet client.BlockchainWallet, addr common.Address, authorized bool, roundsDelay uint32) error

func (*EthereumFluxAggregator) UpdateAvailableFunds

func (f *EthereumFluxAggregator) UpdateAvailableFunds(ctx context.Context, fromWallet client.BlockchainWallet) error

func (*EthereumFluxAggregator) WatchSubmissionReceived

func (f *EthereumFluxAggregator) WatchSubmissionReceived(ctx context.Context, eventChan chan<- *SubmissionEvent) error

WatchSubmissionReceived subscribes to any submissions on a flux feed

func (*EthereumFluxAggregator) WithdrawPayment

func (f *EthereumFluxAggregator) WithdrawPayment(
	ctx context.Context,
	caller client.BlockchainWallet,
	from common.Address,
	to common.Address,
	amount *big.Int) error

func (*EthereumFluxAggregator) WithdrawablePayment

func (f *EthereumFluxAggregator) WithdrawablePayment(ctx context.Context, addr common.Address) (*big.Int, error)

type EthereumKeeperConsumer

type EthereumKeeperConsumer struct {
	// contains filtered or unexported fields
}

EthereumKeeperConsumer represents keeper consumer (upkeep) contract

func (*EthereumKeeperConsumer) Address

func (v *EthereumKeeperConsumer) Address() string

func (*EthereumKeeperConsumer) Counter

func (v *EthereumKeeperConsumer) Counter(ctx context.Context) (*big.Int, error)

func (*EthereumKeeperConsumer) Fund

func (v *EthereumKeeperConsumer) Fund(fromWallet client.BlockchainWallet, ethAmount, linkAmount *big.Float) error

type EthereumKeeperRegistry

type EthereumKeeperRegistry struct {
	// contains filtered or unexported fields
}

EthereumKeeperRegistry represents keeper registry contract

func (*EthereumKeeperRegistry) AddUpkeepFunds

func (v *EthereumKeeperRegistry) AddUpkeepFunds(fromWallet client.BlockchainWallet, id *big.Int, amount *big.Int) error

AddUpkeepFunds adds link for particular upkeep id

func (*EthereumKeeperRegistry) Address

func (v *EthereumKeeperRegistry) Address() string

func (*EthereumKeeperRegistry) Fund

func (v *EthereumKeeperRegistry) Fund(fromWallet client.BlockchainWallet, ethAmount, linkAmount *big.Float) error

func (*EthereumKeeperRegistry) GetKeeperInfo

func (v *EthereumKeeperRegistry) GetKeeperInfo(ctx context.Context, keeperAddr string) (*KeeperInfo, error)

func (*EthereumKeeperRegistry) GetKeeperList

func (v *EthereumKeeperRegistry) GetKeeperList(ctx context.Context) ([]string, error)

GetKeeperList get list of all registered keeper addresses

func (*EthereumKeeperRegistry) GetUpkeepInfo

func (v *EthereumKeeperRegistry) GetUpkeepInfo(ctx context.Context, id *big.Int) (*UpkeepInfo, error)

GetUpkeepInfo gets upkeep info

func (*EthereumKeeperRegistry) RegisterUpkeep

func (v *EthereumKeeperRegistry) RegisterUpkeep(fromWallet client.BlockchainWallet, target string, gasLimit uint32, admin string, checkData []byte) error

RegisterUpkeep registers contract to perform upkeep

func (*EthereumKeeperRegistry) SetKeepers

func (v *EthereumKeeperRegistry) SetKeepers(fromWallet client.BlockchainWallet, keepers []string, payees []string) error

func (*EthereumKeeperRegistry) SetRegistrar

func (v *EthereumKeeperRegistry) SetRegistrar(fromWallet client.BlockchainWallet, registrarAddr string) error

type EthereumLinkToken

type EthereumLinkToken struct {
	// contains filtered or unexported fields
}

EthereumLinkToken represents a LinkToken address

func (*EthereumLinkToken) Address

func (l *EthereumLinkToken) Address() string

func (*EthereumLinkToken) Approve

func (l *EthereumLinkToken) Approve(fromWallet client.BlockchainWallet, to string, amount *big.Int) error

func (*EthereumLinkToken) BalanceOf

func (l *EthereumLinkToken) BalanceOf(ctx context.Context, addr common.Address) (*big.Int, error)

func (*EthereumLinkToken) Fund

func (l *EthereumLinkToken) Fund(fromWallet client.BlockchainWallet, ethAmount *big.Float) error

Fund the LINK Token contract with ETH to distribute the token

func (*EthereumLinkToken) Name

func (l *EthereumLinkToken) Name(ctxt context.Context) (string, error)

Name returns the name of the link token

func (*EthereumLinkToken) Transfer

func (l *EthereumLinkToken) Transfer(fromWallet client.BlockchainWallet, to string, amount *big.Int) error

func (*EthereumLinkToken) TransferAndCall

func (l *EthereumLinkToken) TransferAndCall(fromWallet client.BlockchainWallet, to string, amount *big.Int, data []byte) error

type EthereumMockETHLINKFeed

type EthereumMockETHLINKFeed struct {
	// contains filtered or unexported fields
}

EthereumMockETHLINKFeed represents mocked ETH/LINK feed contract

func (*EthereumMockETHLINKFeed) Address

func (v *EthereumMockETHLINKFeed) Address() string

type EthereumMockGASFeed

type EthereumMockGASFeed struct {
	// contains filtered or unexported fields
}

EthereumMockGASFeed represents mocked Gas feed contract

func (*EthereumMockGASFeed) Address

func (v *EthereumMockGASFeed) Address() string

type EthereumOffchainAggregator

type EthereumOffchainAggregator struct {
	// contains filtered or unexported fields
}

EthereumOffchainAggregator represents the offchain aggregation contract

func (*EthereumOffchainAggregator) Address

func (o *EthereumOffchainAggregator) Address() string

func (*EthereumOffchainAggregator) Fund

func (o *EthereumOffchainAggregator) Fund(fromWallet client.BlockchainWallet, ethAmount, linkAmount *big.Float) error

Fund sends specified currencies to the contract

func (*EthereumOffchainAggregator) GetContractData

GetContractData retrieves basic data for the offchain aggregator contract

func (*EthereumOffchainAggregator) GetLatestAnswer

func (o *EthereumOffchainAggregator) GetLatestAnswer(ctxt context.Context) (*big.Int, error)

GetLatestAnswer returns the latest answer from the OCR contract

func (*EthereumOffchainAggregator) GetLatestRound

func (o *EthereumOffchainAggregator) GetLatestRound(ctxt context.Context) (*RoundData, error)

GetLatestRound returns data from the latest round

Link returns the LINK contract address on the EVM chain

func (*EthereumOffchainAggregator) RequestNewRound

func (o *EthereumOffchainAggregator) RequestNewRound(fromWallet client.BlockchainWallet) error

RequestNewRound requests the OCR contract to create a new round

func (*EthereumOffchainAggregator) SetConfig

func (o *EthereumOffchainAggregator) SetConfig(
	fromWallet client.BlockchainWallet,
	chainlinkNodes []client.Chainlink,
	ocrConfig OffChainAggregatorConfig,
) error

SetConfig sets offchain reporting protocol configuration including participating oracles

func (*EthereumOffchainAggregator) SetPayees

func (o *EthereumOffchainAggregator) SetPayees(
	fromWallet client.BlockchainWallet,
	transmitters, payees []common.Address,
) error

SetPayees sets wallets for the contract to pay out to?

type EthereumOracle

type EthereumOracle struct {
	// contains filtered or unexported fields
}

EthereumOracle oracle for "directrequest" job tests

func (*EthereumOracle) Address

func (e *EthereumOracle) Address() string

func (*EthereumOracle) Fund

func (e *EthereumOracle) Fund(fromWallet client.BlockchainWallet, ethAmount, linkAmount *big.Float) error

func (*EthereumOracle) SetFulfillmentPermission

func (e *EthereumOracle) SetFulfillmentPermission(fromWallet client.BlockchainWallet, address string, allowed bool) error

SetFulfillmentPermission sets fulfillment permission for particular address

type EthereumReadAccessController

type EthereumReadAccessController struct {
	// contains filtered or unexported fields
}

EthereumReadAccessController represents read access controller contract

func (*EthereumReadAccessController) AddAccess

func (e *EthereumReadAccessController) AddAccess(fromWallet client.BlockchainWallet, addr string) error

AddAccess grants access to particular address to raise a flag

func (*EthereumReadAccessController) Address

func (e *EthereumReadAccessController) Address() string

func (*EthereumReadAccessController) DisableAccessCheck

func (e *EthereumReadAccessController) DisableAccessCheck(fromWallet client.BlockchainWallet) error

DisableAccessCheck disables all access checks

type EthereumStorage

type EthereumStorage struct {
	// contains filtered or unexported fields
}

EthereumStorage acts as a conduit for the ethereum version of the storage contract

func (*EthereumStorage) Get

func (e *EthereumStorage) Get(ctxt context.Context) (*big.Int, error)

Get retrieves a set value from the storage contract

func (*EthereumStorage) Set

func (e *EthereumStorage) Set(value *big.Int) error

Set sets a value in the storage contract

type EthereumUpkeepRegistrationRequests

type EthereumUpkeepRegistrationRequests struct {
	// contains filtered or unexported fields
}

EthereumUpkeepRegistrationRequests keeper contract to register upkeeps

func (*EthereumUpkeepRegistrationRequests) Address

func (*EthereumUpkeepRegistrationRequests) EncodeRegisterRequest

func (v *EthereumUpkeepRegistrationRequests) EncodeRegisterRequest(
	name string,
	email []byte,
	upkeepAddr string,
	gasLimit uint32,
	adminAddr string,
	checkData []byte,
	amount *big.Int,
	source uint8,
) ([]byte, error)

EncodeRegisterRequest encodes register request to call it through link token TransferAndCall

func (*EthereumUpkeepRegistrationRequests) Fund

func (v *EthereumUpkeepRegistrationRequests) Fund(fromWallet client.BlockchainWallet, ethAmount, linkAmount *big.Float) error

func (*EthereumUpkeepRegistrationRequests) SetRegistrarConfig

func (v *EthereumUpkeepRegistrationRequests) SetRegistrarConfig(
	fromWallet client.BlockchainWallet,
	autoRegister bool,
	windowSizeBlocks uint32,
	allowedPerWindow uint16,
	registryAddr string,
	minLinkJuels *big.Int,
) error

SetRegistrarConfig sets registrar config, allowing auto register or pending requests for manual registration

type EthereumVRF

type EthereumVRF struct {
	// contains filtered or unexported fields
}

EthereumVRF represents a VRF contract

func (*EthereumVRF) Fund

func (v *EthereumVRF) Fund(fromWallet client.BlockchainWallet, ethAmount, linkAmount *big.Float) error

Fund sends specified currencies to the contract

func (*EthereumVRF) ProofLength

func (v *EthereumVRF) ProofLength(ctxt context.Context) (*big.Int, error)

ProofLength returns the PROOFLENGTH call from the VRF contract

type EthereumVRFConsumer

type EthereumVRFConsumer struct {
	// contains filtered or unexported fields
}

EthereumVRFConsumer represents VRF consumer contract

func (*EthereumVRFConsumer) Address

func (v *EthereumVRFConsumer) Address() string

func (*EthereumVRFConsumer) Fund

func (v *EthereumVRFConsumer) Fund(fromWallet client.BlockchainWallet, ethAmount, linkAmount *big.Float) error

func (*EthereumVRFConsumer) RandomnessOutput

func (v *EthereumVRFConsumer) RandomnessOutput(ctx context.Context) (*big.Int, error)

func (*EthereumVRFConsumer) RequestRandomness

func (v *EthereumVRFConsumer) RequestRandomness(fromWallet client.BlockchainWallet, hash [32]byte, fee *big.Int) error

type EthereumVRFCoordinator

type EthereumVRFCoordinator struct {
	// contains filtered or unexported fields
}

EthereumVRFCoordinator represents VRF coordinator contract

func (*EthereumVRFCoordinator) Address

func (v *EthereumVRFCoordinator) Address() string

func (*EthereumVRFCoordinator) HashOfKey

func (v *EthereumVRFCoordinator) HashOfKey(ctx context.Context, pubKey [2]*big.Int) ([32]byte, error)

func (*EthereumVRFCoordinator) RegisterProvingKey

func (v *EthereumVRFCoordinator) RegisterProvingKey(
	fromWallet client.BlockchainWallet,
	fee *big.Int,
	oracleAddr string,
	publicProvingKey [2]*big.Int,
	jobID [32]byte,
) error

type Flags

type Flags interface {
	Address() string
	GetFlag(ctx context.Context, addr string) (bool, error)
}

Flags flags contract interface

type FluxAggregator

type FluxAggregator interface {
	Address() string
	Fund(fromWallet client.BlockchainWallet, ethAmount, linkAmount *big.Float) error
	LatestRoundID(ctx context.Context, blockNumber *big.Int) (*big.Int, error)
	LatestRoundData(ctx context.Context) (RoundData, error)
	GetContractData(ctxt context.Context) (*FluxAggregatorData, error)
	UpdateAvailableFunds(ctx context.Context, fromWallet client.BlockchainWallet) error
	PaymentAmount(ctx context.Context) (*big.Int, error)
	RequestNewRound(ctx context.Context, fromWallet client.BlockchainWallet) error
	WithdrawPayment(ctx context.Context, caller client.BlockchainWallet, from common.Address, to common.Address, amount *big.Int) error
	WithdrawablePayment(ctx context.Context, addr common.Address) (*big.Int, error)
	GetOracles(ctx context.Context) ([]string, error)
	SetOracles(client.BlockchainWallet, FluxAggregatorSetOraclesOptions) error
	Description(ctxt context.Context) (string, error)
	SetRequesterPermissions(ctx context.Context, fromWallet client.BlockchainWallet, addr common.Address, authorized bool, roundsDelay uint32) error
	WatchSubmissionReceived(ctx context.Context, eventChan chan<- *SubmissionEvent) error
}

type FluxAggregatorData

type FluxAggregatorData struct {
	AllocatedFunds  *big.Int         // The amount of payment yet to be withdrawn by oracles
	AvailableFunds  *big.Int         // The amount of future funding available to oracles
	LatestRoundData RoundData        // Data about the latest round
	Oracles         []common.Address // Addresses of oracles on the contract
}

type FluxAggregatorOptions

type FluxAggregatorOptions struct {
	PaymentAmount *big.Int       // The amount of LINK paid to each oracle per submission, in wei (units of 10⁻¹⁸ LINK)
	Timeout       uint32         // The number of seconds after the previous round that are allowed to lapse before allowing an oracle to skip an unfinished round
	Validator     common.Address // An optional contract address for validating external validation of answers
	MinSubValue   *big.Int       // An immutable check for a lower bound of what submission values are accepted from an oracle
	MaxSubValue   *big.Int       // An immutable check for an upper bound of what submission values are accepted from an oracle
	Decimals      uint8          // The number of decimals to offset the answer by
	Description   string         // A short description of what is being reported
}

func DefaultFluxAggregatorOptions

func DefaultFluxAggregatorOptions() FluxAggregatorOptions

DefaultFluxAggregatorOptions produces some basic defaults for a flux aggregator contract

type FluxAggregatorRoundConfirmer

type FluxAggregatorRoundConfirmer struct {
	// contains filtered or unexported fields
}

FluxAggregatorRoundConfirmer is a header subscription that awaits for a certain flux round to be completed

func NewFluxAggregatorRoundConfirmer

func NewFluxAggregatorRoundConfirmer(
	contract FluxAggregator,
	roundID *big.Int,
	timeout time.Duration,
) *FluxAggregatorRoundConfirmer

NewFluxAggregatorRoundConfirmer provides a new instance of a FluxAggregatorRoundConfirmer

func (*FluxAggregatorRoundConfirmer) ReceiveBlock

func (f *FluxAggregatorRoundConfirmer) ReceiveBlock(block *types.Block) error

ReceiveBlock will query the latest FluxAggregator round and check to see whether the round has confirmed

func (*FluxAggregatorRoundConfirmer) Wait

Wait is a blocking function that will wait until the round has confirmed, and timeout if the deadline has passed

type FluxAggregatorSetOraclesOptions

type FluxAggregatorSetOraclesOptions struct {
	AddList            []common.Address // oracle addresses to add
	RemoveList         []common.Address // oracle addresses to remove
	AdminList          []common.Address // oracle addresses to become admin
	MinSubmissions     uint32           // min amount of submissions in round
	MaxSubmissions     uint32           // max amount of submissions in round
	RestartDelayRounds uint32           // rounds to wait after oracles has changed
}

type JobByInstance

type JobByInstance struct {
	ID       string
	Instance string
}

JobByInstance helper struct to match job + instance ID

type KeeperConsumer

type KeeperConsumer interface {
	Address() string
	Fund(fromWallet client.BlockchainWallet, ethAmount, linkAmount *big.Float) error
	Counter(ctx context.Context) (*big.Int, error)
}

type KeeperInfo

type KeeperInfo struct {
	Payee   string
	Active  bool
	Balance *big.Int
}

KeeperInfo keeper status and balance info

type KeeperRegistry

type KeeperRegistry interface {
	Address() string
	Fund(fromWallet client.BlockchainWallet, ethAmount, linkAmount *big.Float) error
	SetRegistrar(fromWallet client.BlockchainWallet, registrarAddr string) error
	AddUpkeepFunds(fromWallet client.BlockchainWallet, id *big.Int, amount *big.Int) error
	GetUpkeepInfo(ctx context.Context, id *big.Int) (*UpkeepInfo, error)
	GetKeeperInfo(ctx context.Context, keeperAddr string) (*KeeperInfo, error)
	SetKeepers(fromWallet client.BlockchainWallet, keepers []string, payees []string) error
	GetKeeperList(ctx context.Context) ([]string, error)
	RegisterUpkeep(fromWallet client.BlockchainWallet, target string, gasLimit uint32, admin string, checkData []byte) error
}

type KeeperRegistryOpts

type KeeperRegistryOpts struct {
	LinkAddr             string
	ETHFeedAddr          string
	GasFeedAddr          string
	PaymentPremiumPPB    uint32
	BlockCountPerTurn    *big.Int
	CheckGasLimit        uint32
	StalenessSeconds     *big.Int
	GasCeilingMultiplier uint16
	FallbackGasPrice     *big.Int
	FallbackLinkPrice    *big.Int
}

KeeperRegistryOpts opts to deploy keeper registry

type LinkToken

type LinkToken interface {
	Address() string
	Approve(fromWallet client.BlockchainWallet, to string, amount *big.Int) error
	Transfer(fromWallet client.BlockchainWallet, to string, amount *big.Int) error
	BalanceOf(ctx context.Context, addr common.Address) (*big.Int, error)
	TransferAndCall(fromWallet client.BlockchainWallet, to string, amount *big.Int, data []byte) error
	Fund(fromWallet client.BlockchainWallet, ethAmount *big.Float) error
	Name(context.Context) (string, error)
}

type MockETHLINKFeed

type MockETHLINKFeed interface {
	Address() string
}

type MockGasFeed

type MockGasFeed interface {
	Address() string
}

type OffChainAggregatorConfig

type OffChainAggregatorConfig struct {
	DeltaProgress    time.Duration // The duration in which a leader must achieve progress or be replaced
	DeltaResend      time.Duration // The interval at which nodes resend NEWEPOCH messages
	DeltaRound       time.Duration // The duration after which a new round is started
	DeltaGrace       time.Duration // The duration of the grace period during which delayed oracles can still submit observations
	DeltaC           time.Duration // Limits how often updates are transmitted to the contract as long as the median isn’t changing by more then AlphaPPB
	AlphaPPB         uint64        // Allows larger changes of the median to be reported immediately, bypassing DeltaC
	DeltaStage       time.Duration // Used to stagger stages of the transmission protocol. Multiple Ethereum blocks must be mineable in this period
	RMax             uint8         // The maximum number of rounds in an epoch
	S                []int         // Transmission Schedule
	F                int           // The allowed number of "bad" oracles
	N                int           // The number of oracles
	OracleIdentities []ocrConfigHelper.OracleIdentityExtra
}

https://uploads-ssl.webflow.com/5f6b7190899f41fb70882d08/603651a1101106649eef6a53_chainlink-ocr-protocol-paper-02-24-20.pdf

func DefaultOffChainAggregatorConfig

func DefaultOffChainAggregatorConfig(numberNodes int) OffChainAggregatorConfig

DefaultOffChainAggregatorConfig returns some base defaults for configuring an OCR contract

type OffchainAggregator

type OffchainAggregator interface {
	Address() string
	Fund(fromWallet client.BlockchainWallet, nativeAmount, linkAmount *big.Float) error
	GetContractData(ctxt context.Context) (*OffchainAggregatorData, error)
	SetConfig(
		fromWallet client.BlockchainWallet,
		chainlinkNodes []client.Chainlink,
		ocrConfig OffChainAggregatorConfig,
	) error
	SetPayees(client.BlockchainWallet, []common.Address, []common.Address) error
	RequestNewRound(fromWallet client.BlockchainWallet) error
	Link(ctxt context.Context) (common.Address, error)
	GetLatestAnswer(ctxt context.Context) (*big.Int, error)
	GetLatestRound(ctxt context.Context) (*RoundData, error)
}

type OffchainAggregatorData

type OffchainAggregatorData struct {
	LatestRoundData RoundData // Data about the latest round
}

type OffchainAggregatorRoundConfirmer

type OffchainAggregatorRoundConfirmer struct {
	// contains filtered or unexported fields
}

OffchainAggregatorRoundConfirmer is a header subscription that awaits for a certain OCR round to be completed

func NewOffchainAggregatorRoundConfirmer

func NewOffchainAggregatorRoundConfirmer(
	contract OffchainAggregator,
	roundID *big.Int,
	timeout time.Duration,
) *OffchainAggregatorRoundConfirmer

NewOffchainAggregatorRoundConfirmer provides a new instance of a OffchainAggregatorRoundConfirmer

func (*OffchainAggregatorRoundConfirmer) ReceiveBlock

func (o *OffchainAggregatorRoundConfirmer) ReceiveBlock(_ *types.Block) error

ReceiveBlock will query the latest OffchainAggregator round and check to see whether the round has confirmed

func (*OffchainAggregatorRoundConfirmer) Wait

Wait is a blocking function that will wait until the round has confirmed, and timeout if the deadline has passed

type OffchainOptions

type OffchainOptions struct {
	MaximumGasPrice           uint32         // The highest gas price for which transmitter will be compensated
	ReasonableGasPrice        uint32         // The transmitter will receive reward for gas prices under this value
	MicroLinkPerEth           uint32         // The reimbursement per ETH of gas cost, in 1e-6LINK units
	LinkGweiPerObservation    uint32         // The reward to the oracle for contributing an observation to a successfully transmitted report, in 1e-9LINK units
	LinkGweiPerTransmission   uint32         // The reward to the transmitter of a successful report, in 1e-9LINK units
	MinimumAnswer             *big.Int       // The lowest answer the median of a report is allowed to be
	MaximumAnswer             *big.Int       // The highest answer the median of a report is allowed to be
	BillingAccessController   common.Address // The access controller for billing admin functions
	RequesterAccessController common.Address // The access controller for requesting new rounds
	Decimals                  uint8          // Answers are stored in fixed-point format, with this many digits of precision
	Description               string         // A short description of what is being reported
}

func DefaultOffChainAggregatorOptions

func DefaultOffChainAggregatorOptions() OffchainOptions

DefaultOffChainAggregatorOptions returns some base defaults for deploying an OCR contract

type Oracle

type Oracle interface {
	Address() string
	Fund(fromWallet client.BlockchainWallet, ethAmount, linkAmount *big.Float) error
	SetFulfillmentPermission(fromWallet client.BlockchainWallet, address string, allowed bool) error
}

type ReadAccessController

type ReadAccessController interface {
	Address() string
	AddAccess(fromWallet client.BlockchainWallet, addr string) error
	DisableAccessCheck(fromWallet client.BlockchainWallet) error
}

ReadAccessController is read/write access controller, just named by interface

type RoundData

type RoundData struct {
	RoundId         *big.Int
	Answer          *big.Int
	StartedAt       *big.Int
	UpdatedAt       *big.Int
	AnsweredInRound *big.Int
}

type Storage

type Storage interface {
	Get(ctxt context.Context) (*big.Int, error)
	Set(*big.Int) error
}

type SubmissionEvent

type SubmissionEvent struct {
	Contract    common.Address
	Submission  *big.Int
	Round       uint32
	BlockNumber uint64
	Oracle      common.Address
}

type UpkeepInfo

type UpkeepInfo struct {
	Target              string
	ExecuteGas          uint32
	CheckData           []byte
	Balance             *big.Int
	LastKeeper          string
	Admin               string
	MaxValidBlocknumber uint64
}

UpkeepInfo keeper target info

type UpkeepRegistrar

type UpkeepRegistrar interface {
	Address() string
	SetRegistrarConfig(
		fromWallet client.BlockchainWallet,
		autoRegister bool,
		windowSizeBlocks uint32,
		allowedPerWindow uint16,
		registryAddr string,
		minLinkJuels *big.Int,
	) error
	EncodeRegisterRequest(
		name string,
		email []byte,
		upkeepAddr string,
		gasLimit uint32,
		adminAddr string,
		checkData []byte,
		amount *big.Int,
		source uint8,
	) ([]byte, error)
	Fund(fromWallet client.BlockchainWallet, ethAmount, linkAmount *big.Float) error
}

type VRF

type VRF interface {
	Fund(fromWallet client.BlockchainWallet, ethAmount, linkAmount *big.Float) error
	ProofLength(context.Context) (*big.Int, error)
}

type VRFConsumer

type VRFConsumer interface {
	RequestRandomness(fromWallet client.BlockchainWallet, hash [32]byte, fee *big.Int) error
	RandomnessOutput(ctx context.Context) (*big.Int, error)
	Fund(fromWallet client.BlockchainWallet, ethAmount, linkAmount *big.Float) error
}

type VRFCoordinator

type VRFCoordinator interface {
	RegisterProvingKey(
		fromWallet client.BlockchainWallet,
		fee *big.Int,
		oracleAddr string,
		publicProvingKey [2]*big.Int,
		jobID [32]byte,
	) error
	HashOfKey(ctx context.Context, pubKey [2]*big.Int) ([32]byte, error)
	Address() string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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