contracts

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2021 License: MIT Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TellorAddress            = "0x88dF592F8eb5D7Bd38bFeF7dEb0fBc02cf3778a0"
	TellorAddressRinkeby     = TellorAddress
	TellorAddressGoerli      = "0xe5e09e1C64Eab3cA8bCAD722b0966B69931879ae"
	TellorAddressGoerliProxy = "0x84Ec18B070D84e347eE6B7D5fA2d9fcFfbf759bA" // Proxy contract for testing.
	TellorAddressHardhat     = "0x8920050E1126125a27A4EaC5122AD3586c056E51"

	WithdrawStakeGasLimit          = 50_000
	RequestStakingWithdrawGasLimit = 100_000
	TallyGasLimit                  = 150_000
	DepositStakeGasLimit           = 160_000
	UnlockFeeGasLimit              = 300_000
	VoteGasUSage                   = 200_000
	NewDisputeGasLimit             = 700_000
	SubmitMiningSolutionGasLimit   = 3_000_000

	MethodNameSubmit     = "submitMiningSolution"
	MethodNameNewDispute = "beginDispute"

	EventNameNewTask    = "NewChallenge"
	EventNameNewSubmit  = "NonceSubmitted"
	EventNameNewValue   = "NewValue"
	EventNameTally      = "DisputeVoteTallied"
	EventNameNewDispute = "NewDispute"
	// When creating the bindings the Transfer event is aliased as Trasnfered
	// because it collides with the same function name.
	EventNameTransfer        = "Transferred"
	EventNameNewVote         = "Voted"
	EventNameContractUpgrade = "NewTellorAddress"

	DefaultDisputeVotingWindow = 24 * 2 * time.Hour // 2 days to vote for a dispute.
	DefaultDisputeUnlockWindow = 24 * time.Hour     // 1 day to wait after a dispute before can get the dispute fee.
)

Variables

View Source
var (
	BPoolABI          = balancer.BPoolABI
	BTokenABI         = balancer.BTokenABI
	IERC20ABI         = uniswap.IERC20ABI
	IUniswapV2PairABI = uniswap.IUniswapV2PairABI
	TellorABI         = tellor.ITellorABI
)
View Source
var DefaultParams = Params{
	DisputeVotingWindow: DefaultDisputeVotingWindow,
	DisputeUnlockWindow: DefaultDisputeUnlockWindow,
}

Functions

func CreateTellorTx added in v0.3.0

func CreateTellorTx(
	ctx context.Context,
	prvKey *ecdsa.PrivateKey,
	to common.Address,
	client *ethclient.Client,
	netID int64,
	gasLimit uint64,
	gasMaxFee float64,
	methodName string,
	args []interface{},
) (*types.Transaction, string, error)

func GetTellorAddress

func GetTellorAddress(netID int64) (common.Address, error)

func LastSubmit

func LastSubmit(contract TellorCaller, reporter common.Address) (time.Duration, *time.Time, error)

func ReporterStatusName added in v0.2.0

func ReporterStatusName(statusID int64) string

func Slot

func Slot(caller TellorCaller) (*big.Int, error)

Types

type DisputeLog

type DisputeLog struct {
	ID           int64
	DataID       int64
	DataVal      float64
	DataTime     time.Time
	Executed     bool
	Passed       bool
	Disputer     common.Address
	Disputed     common.Address
	DisputedSlot uint64
	Tally        float64
	Votes        uint64
	Created      time.Time
	Ends         time.Time
	Fee          float64
	TxHash       common.Hash
}

func GetDisputeInfo

func GetDisputeInfo(ctx context.Context, disputeID *big.Int, contract TellorCaller) (*DisputeLog, error)

func GetDisputeLogs

func GetDisputeLogs(
	ctx context.Context,
	client *ethclient.Client,
	contract TellorCaller,
	lookBackDuration time.Duration,
) ([]*DisputeLog, error)

type ITellor

type ITellor struct {
	*tellor.ITellor
	// contains filtered or unexported fields
}

func NewITellor

func NewITellor(
	ctx context.Context,
	logger log.Logger,
	client *ethclient.Client,
	netID int64,
	address common.Address,
	params Params,
) (*ITellor, error)

func (*ITellor) Abi

func (self *ITellor) Abi() abi.ABI

func (*ITellor) AbiRaw added in v0.3.0

func (self *ITellor) AbiRaw() string

func (*ITellor) Addr

func (self *ITellor) Addr() common.Address

func (*ITellor) DisputeUnlockWindow

func (self *ITellor) DisputeUnlockWindow() time.Duration

func (*ITellor) DisputeVotingWindow

func (self *ITellor) DisputeVotingWindow() time.Duration

func (*ITellor) NetID

func (self *ITellor) NetID() int64

func (*ITellor) UnpackLog

func (self *ITellor) UnpackLog(out interface{}, event string, log types.Log) error

func (*ITellor) WatchLogs

func (self *ITellor) WatchLogs(opts *bind.WatchOpts, name string, query ...[]interface{}) (chan types.Log, event.Subscription, error)

type ITellorFilterer

type ITellorFilterer struct {
	*tellor.TellorFilterer
	*tellor.ExtensionFilterer
}

func NewITellorFilterer

func NewITellorFilterer(addr common.Address, client *ethclient.Client) (*ITellorFilterer, error)

type ITellorProxy added in v0.3.0

type ITellorProxy struct {
	*tellor_proxy.Reporter
	Address common.Address
}

func NewITellorProxy added in v0.3.0

func NewITellorProxy(ctx context.Context, contractAddr common.Address, client *ethclient.Client, netID int64) (*ITellorProxy, error)

type ITellorTest

type ITellorTest struct {
	*tellor_testing.ITellor
	Address common.Address
}

func NewITellorTest

func NewITellorTest(ctx context.Context, contractAddr common.Address, client *ethclient.Client, netID int64) (*ITellorTest, error)

type NewTellorAddress

type NewTellorAddress = tellor.ExtensionNewTellorAddress

type Params

type Params struct {
	DisputeVotingWindow time.Duration
	DisputeUnlockWindow time.Duration
}

type RewardQuerier

type RewardQuerier interface {
	// Returns the current reward in percent relative to the provided tx cost.
	Query(ctx context.Context, txCostGwei float64) (int64, error)
}

type SubmitBlock

type SubmitBlock struct {
	Timestamp   *big.Int
	DataIDs     [5]*big.Int
	FinalValues map[int64]*big.Int
	Reporters   map[int64][5]common.Address
	Values      map[int64][5]*big.Int
}

func GetSubmitLogs

func GetSubmitLogs(
	ctx context.Context,
	client *ethclient.Client,
	contract TellorCaller,
	from int64,
	lookBackDuration time.Duration,
) ([]SubmitBlock, error)

func NewSubmitBlock

func NewSubmitBlock() SubmitBlock

type TellorCaller added in v0.3.0

type TellorCaller interface {
	GetUintVar(opts *bind.CallOpts, _data [32]byte) (*big.Int, error)
	SubmitMiningSolution(opts *bind.TransactOpts, _nonce string, _requestId [5]*big.Int, _value [5]*big.Int) (*types.Transaction, error)
	GetStakerInfo(opts *bind.CallOpts, _staker common.Address) (*big.Int, *big.Int, error)
	GetNewCurrentVariables(opts *bind.CallOpts) (struct {
		Challenge  [32]byte
		RequestIds [5]*big.Int
		Difficulty *big.Int
		Tip        *big.Int
	}, error)
	Addr() common.Address
	NetID() int64
	Abi() abi.ABI
	AbiRaw() string
	BalanceOf(opts *bind.CallOpts, _user common.Address) (*big.Int, error)
	GetAllDisputeVars(opts *bind.CallOpts, _disputeId *big.Int) ([32]byte, bool, bool, bool, common.Address, common.Address, common.Address, [9]*big.Int, *big.Int, error)
	GetDisputeUintVars(opts *bind.CallOpts, _disputeId *big.Int, _data [32]byte) (*big.Int, error)
	TallyVotes(opts *bind.TransactOpts, _disputeId *big.Int) (*types.Transaction, error)
	UnlockDisputeFee(opts *bind.TransactOpts, _disputeId *big.Int) (*types.Transaction, error)
	DepositStake(opts *bind.TransactOpts) (*types.Transaction, error)
	UnpackLog(out interface{}, event string, log types.Log) error
	WatchLogs(opts *bind.WatchOpts, name string, query ...[]interface{}) (chan types.Log, event.Subscription, error)
	DisputeVotingWindow() time.Duration
	DisputeUnlockWindow() time.Duration
	GetMinersByRequestIdAndTimestamp(opts *bind.CallOpts, _requestId *big.Int, _timestamp *big.Int) ([5]common.Address, error)
	GetSubmissionsByTimestamp(opts *bind.CallOpts, _requestId *big.Int, _timestamp *big.Int) ([5]*big.Int, error)
	GetNewValueCountbyRequestId(opts *bind.CallOpts, _requestId *big.Int) (*big.Int, error)
	GetTimestampbyRequestIDandIndex(opts *bind.CallOpts, _requestID *big.Int, _index *big.Int) (*big.Int, error)
	GetRequestUintVars(opts *bind.CallOpts, _requestId *big.Int, _data [32]byte) (*big.Int, error)
	BeginDispute(opts *bind.TransactOpts, _requestId *big.Int, _timestamp *big.Int, _minerIndex *big.Int) (*types.Transaction, error)
	DidVote(opts *bind.CallOpts, _disputeId *big.Int, _address common.Address) (bool, error)
	Vote(opts *bind.TransactOpts, _disputeId *big.Int, _supportsDispute bool) (*types.Transaction, error)
	WithdrawStake(opts *bind.TransactOpts) (*types.Transaction, error)
	RequestStakingWithdraw(opts *bind.TransactOpts) (*types.Transaction, error)
	Transfer(*bind.TransactOpts, common.Address, *big.Int) (*types.Transaction, error)
	Approve(opts *bind.TransactOpts, dst common.Address, amt *big.Int) (*types.Transaction, error)
}

type TellorDisputeVoteTallied

type TellorDisputeVoteTallied = tellor.ExtensionDisputeVoteTallied

func GetTallyLogs

func GetTallyLogs(
	ctx context.Context,
	client *ethclient.Client,
	contract TellorCaller,
	lookBackDuration time.Duration,
) ([]*TellorDisputeVoteTallied, error)

type TellorNewChallenge

type TellorNewChallenge = tellor.TellorNewChallenge

type TellorNewDispute

type TellorNewDispute = tellor.TellorNewDispute

type TellorNewValue

type TellorNewValue = tellor.TellorNewValue

type TellorNonceSubmitted

type TellorNonceSubmitted = tellor.TellorNonceSubmitted

type TellorTransferred

type TellorTransferred = tellor.TellorTransferred

type TellorVoted

type TellorVoted = tellor.TellorVoted

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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