ethereum

package
v0.0.0-...-477c745 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2020 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const FactomAnchorABI = "" /* 1839-byte string literal not displayed */

FactomAnchorABI is the input ABI used to generate the binding from.

View Source
const FactomAnchorBin = `` /* 1596-byte string literal not displayed */

FactomAnchorBin is the compiled bytecode used for deploying new contracts.

Variables

View Source
var ContractAddress string
View Source
var EthGasStationAddress string
View Source
var GasLimit uint64
View Source
var IgnoreWrongEntries bool
View Source
var WalletAddress string
View Source
var WalletKey string
View Source
var WalletPassword string
View Source
var WindowSize uint32

Functions

func AnchorBlockWindow

func AnchorBlockWindow(dbo *database.AnchorDatabaseOverlay, height uint32, isMandatory bool) (*database.PendingTxInfo, error)

func AnchorBlockWindowWithOptions

func AnchorBlockWindowWithOptions(dbo *database.AnchorDatabaseOverlay, height uint32, isMandatory bool, nonce uint64, gasPrice *big.Int) (*database.PendingTxInfo, error)

AnchorBlockWindow creates a Merkle root of all Directory Blocks from height to (height - size + 1), and then submits that MR to Ethereum.

func AnchorBlocksIntoEthereum

func AnchorBlocksIntoEthereum(dbo *database.AnchorDatabaseOverlay) error

AnchorBlocksIntoEthereum submits an Ethereum anchor for the oldest window of directory blocks that hasn't been anchored yet, unless we are all caught up on the backlog, then it will submit an anchor for the newest window

func CheckBalance

func CheckBalance() (int64, error)

func CheckIfEthSynced

func CheckIfEthSynced() (bool, error)

func LoadConfig

func LoadConfig(c *config.AnchorConfig)

func SendAnchor

func SendAnchor(height int64, merkleRoot string, nonce uint64, gasPrice *big.Int) (*types.Transaction, error)

func SynchronizeEthereumData

func SynchronizeEthereumData(dbo *database.AnchorDatabaseOverlay) (int, error)

SynchronizeEthereumData quickly checks for recently confirmed anchor events in our smart contract and returns the number of new transactions that were found

Types

type FactomAnchor

type FactomAnchor struct {
	FactomAnchorCaller     // Read-only binding to the contract
	FactomAnchorTransactor // Write-only binding to the contract
	FactomAnchorFilterer   // Log filterer for contract events
}

FactomAnchor is an auto generated Go binding around an Ethereum contract.

func DeployFactomAnchor

func DeployFactomAnchor(auth *bind.TransactOpts, backend bind.ContractBackend) (common.Address, *types.Transaction, *FactomAnchor, error)

DeployFactomAnchor deploys a new Ethereum contract, binding an instance of FactomAnchor to it.

func NewFactomAnchor

func NewFactomAnchor(address common.Address, backend bind.ContractBackend) (*FactomAnchor, error)

NewFactomAnchor creates a new instance of FactomAnchor, bound to a specific deployed contract.

type FactomAnchorAnchorMade

type FactomAnchorAnchorMade struct {
	Height     *big.Int
	MerkleRoot *big.Int
	Raw        types.Log // Blockchain specific contextual infos
}

FactomAnchorAnchorMade represents a AnchorMade event raised by the FactomAnchor contract.

type FactomAnchorAnchorMadeIterator

type FactomAnchorAnchorMadeIterator struct {
	Event *FactomAnchorAnchorMade // Event containing the contract specifics and raw log
	// contains filtered or unexported fields
}

FactomAnchorAnchorMadeIterator is returned from FilterAnchorMade and is used to iterate over the raw logs and unpacked data for AnchorMade events raised by the FactomAnchor contract.

func (*FactomAnchorAnchorMadeIterator) Close

Close terminates the iteration process, releasing any pending underlying resources.

func (*FactomAnchorAnchorMadeIterator) Error

Error returns any retrieval or parsing error occurred during filtering.

func (*FactomAnchorAnchorMadeIterator) Next

Next advances the iterator to the subsequent event, returning whether there are any more events found. In case of a retrieval or parsing error, false is returned and Error() can be queried for the exact failure.

type FactomAnchorAnchoringFrozen

type FactomAnchorAnchoringFrozen struct {
	Height *big.Int
	Raw    types.Log // Blockchain specific contextual infos
}

FactomAnchorAnchoringFrozen represents a AnchoringFrozen event raised by the FactomAnchor contract.

type FactomAnchorAnchoringFrozenIterator

type FactomAnchorAnchoringFrozenIterator struct {
	Event *FactomAnchorAnchoringFrozen // Event containing the contract specifics and raw log
	// contains filtered or unexported fields
}

FactomAnchorAnchoringFrozenIterator is returned from FilterAnchoringFrozen and is used to iterate over the raw logs and unpacked data for AnchoringFrozen events raised by the FactomAnchor contract.

func (*FactomAnchorAnchoringFrozenIterator) Close

Close terminates the iteration process, releasing any pending underlying resources.

func (*FactomAnchorAnchoringFrozenIterator) Error

Error returns any retrieval or parsing error occurred during filtering.

func (*FactomAnchorAnchoringFrozenIterator) Next

Next advances the iterator to the subsequent event, returning whether there are any more events found. In case of a retrieval or parsing error, false is returned and Error() can be queried for the exact failure.

type FactomAnchorCaller

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

FactomAnchorCaller is an auto generated read-only Go binding around an Ethereum contract.

func NewFactomAnchorCaller

func NewFactomAnchorCaller(address common.Address, caller bind.ContractCaller) (*FactomAnchorCaller, error)

NewFactomAnchorCaller creates a new read-only instance of FactomAnchor, bound to a specific deployed contract.

func (*FactomAnchorCaller) Anchors

func (_FactomAnchor *FactomAnchorCaller) Anchors(opts *bind.CallOpts, arg0 *big.Int) (*big.Int, error)

Anchors is a free data retrieval call binding the contract method 0x368b733e.

Solidity: function anchors( uint256) constant returns(MerkleRoot uint256)

func (*FactomAnchorCaller) CheckFrozen

func (_FactomAnchor *FactomAnchorCaller) CheckFrozen(opts *bind.CallOpts) (bool, error)

CheckFrozen is a free data retrieval call binding the contract method 0x98fb22fd.

Solidity: function checkFrozen() constant returns(bool)

func (*FactomAnchorCaller) Creator

func (_FactomAnchor *FactomAnchorCaller) Creator(opts *bind.CallOpts) (common.Address, error)

Creator is a free data retrieval call binding the contract method 0x02d05d3f.

Solidity: function creator() constant returns(address)

func (*FactomAnchorCaller) Frozen

func (_FactomAnchor *FactomAnchorCaller) Frozen(opts *bind.CallOpts) (bool, error)

Frozen is a free data retrieval call binding the contract method 0x054f7d9c.

Solidity: function frozen() constant returns(bool)

func (*FactomAnchorCaller) GetAnchor

func (_FactomAnchor *FactomAnchorCaller) GetAnchor(opts *bind.CallOpts, blockNumber *big.Int) (*big.Int, error)

GetAnchor is a free data retrieval call binding the contract method 0x4c7df18f.

Solidity: function getAnchor(blockNumber uint256) constant returns(uint256)

type FactomAnchorCallerRaw

type FactomAnchorCallerRaw struct {
	Contract *FactomAnchorCaller // Generic read-only contract binding to access the raw methods on
}

FactomAnchorCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract.

func (*FactomAnchorCallerRaw) Call

func (_FactomAnchor *FactomAnchorCallerRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error

Call invokes the (constant) contract method with params as input values and sets the output to result. The result type might be a single field for simple returns, a slice of interfaces for anonymous returns and a struct for named returns.

type FactomAnchorCallerSession

type FactomAnchorCallerSession struct {
	Contract *FactomAnchorCaller // Generic contract caller binding to set the session for
	CallOpts bind.CallOpts       // Call options to use throughout this session
}

FactomAnchorCallerSession is an auto generated read-only Go binding around an Ethereum contract, with pre-set call options.

func (*FactomAnchorCallerSession) Anchors

func (_FactomAnchor *FactomAnchorCallerSession) Anchors(arg0 *big.Int) (*big.Int, error)

Anchors is a free data retrieval call binding the contract method 0x368b733e.

Solidity: function anchors( uint256) constant returns(MerkleRoot uint256)

func (*FactomAnchorCallerSession) CheckFrozen

func (_FactomAnchor *FactomAnchorCallerSession) CheckFrozen() (bool, error)

CheckFrozen is a free data retrieval call binding the contract method 0x98fb22fd.

Solidity: function checkFrozen() constant returns(bool)

func (*FactomAnchorCallerSession) Creator

func (_FactomAnchor *FactomAnchorCallerSession) Creator() (common.Address, error)

Creator is a free data retrieval call binding the contract method 0x02d05d3f.

Solidity: function creator() constant returns(address)

func (*FactomAnchorCallerSession) Frozen

func (_FactomAnchor *FactomAnchorCallerSession) Frozen() (bool, error)

Frozen is a free data retrieval call binding the contract method 0x054f7d9c.

Solidity: function frozen() constant returns(bool)

func (*FactomAnchorCallerSession) GetAnchor

func (_FactomAnchor *FactomAnchorCallerSession) GetAnchor(blockNumber *big.Int) (*big.Int, error)

GetAnchor is a free data retrieval call binding the contract method 0x4c7df18f.

Solidity: function getAnchor(blockNumber uint256) constant returns(uint256)

type FactomAnchorFilterer

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

FactomAnchorFilterer is an auto generated log filtering Go binding around an Ethereum contract events.

func NewFactomAnchorFilterer

func NewFactomAnchorFilterer(address common.Address, filterer bind.ContractFilterer) (*FactomAnchorFilterer, error)

NewFactomAnchorFilterer creates a new log filterer instance of FactomAnchor, bound to a specific deployed contract.

func (*FactomAnchorFilterer) FilterAnchorMade

func (_FactomAnchor *FactomAnchorFilterer) FilterAnchorMade(opts *bind.FilterOpts) (*FactomAnchorAnchorMadeIterator, error)

FilterAnchorMade is a free log retrieval operation binding the contract event 0x1c6a33c0de150a46e5647f4482e93d30f3a966487eb86e762d69319ab9a6e6b6.

Solidity: e AnchorMade(height uint256, merkleRoot uint256)

func (*FactomAnchorFilterer) FilterAnchoringFrozen

func (_FactomAnchor *FactomAnchorFilterer) FilterAnchoringFrozen(opts *bind.FilterOpts) (*FactomAnchorAnchoringFrozenIterator, error)

FilterAnchoringFrozen is a free log retrieval operation binding the contract event 0x02392dea61af8262e6609d1b99522854b729caa208dbccef7fd70f9508293aa7.

Solidity: e AnchoringFrozen(height uint256)

func (*FactomAnchorFilterer) WatchAnchorMade

func (_FactomAnchor *FactomAnchorFilterer) WatchAnchorMade(opts *bind.WatchOpts, sink chan<- *FactomAnchorAnchorMade) (event.Subscription, error)

WatchAnchorMade is a free log subscription operation binding the contract event 0x1c6a33c0de150a46e5647f4482e93d30f3a966487eb86e762d69319ab9a6e6b6.

Solidity: e AnchorMade(height uint256, merkleRoot uint256)

func (*FactomAnchorFilterer) WatchAnchoringFrozen

func (_FactomAnchor *FactomAnchorFilterer) WatchAnchoringFrozen(opts *bind.WatchOpts, sink chan<- *FactomAnchorAnchoringFrozen) (event.Subscription, error)

WatchAnchoringFrozen is a free log subscription operation binding the contract event 0x02392dea61af8262e6609d1b99522854b729caa208dbccef7fd70f9508293aa7.

Solidity: e AnchoringFrozen(height uint256)

type FactomAnchorRaw

type FactomAnchorRaw struct {
	Contract *FactomAnchor // Generic contract binding to access the raw methods on
}

FactomAnchorRaw is an auto generated low-level Go binding around an Ethereum contract.

func (*FactomAnchorRaw) Call

func (_FactomAnchor *FactomAnchorRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error

Call invokes the (constant) contract method with params as input values and sets the output to result. The result type might be a single field for simple returns, a slice of interfaces for anonymous returns and a struct for named returns.

func (*FactomAnchorRaw) Transact

func (_FactomAnchor *FactomAnchorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error)

Transact invokes the (paid) contract method with params as input values.

func (*FactomAnchorRaw) Transfer

func (_FactomAnchor *FactomAnchorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error)

Transfer initiates a plain transaction to move funds to the contract, calling its default method if one is available.

type FactomAnchorSession

type FactomAnchorSession struct {
	Contract     *FactomAnchor     // Generic contract binding to set the session for
	CallOpts     bind.CallOpts     // Call options to use throughout this session
	TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session
}

FactomAnchorSession is an auto generated Go binding around an Ethereum contract, with pre-set call and transact options.

func (*FactomAnchorSession) Anchors

func (_FactomAnchor *FactomAnchorSession) Anchors(arg0 *big.Int) (*big.Int, error)

Anchors is a free data retrieval call binding the contract method 0x368b733e.

Solidity: function anchors( uint256) constant returns(MerkleRoot uint256)

func (*FactomAnchorSession) CheckFrozen

func (_FactomAnchor *FactomAnchorSession) CheckFrozen() (bool, error)

CheckFrozen is a free data retrieval call binding the contract method 0x98fb22fd.

Solidity: function checkFrozen() constant returns(bool)

func (*FactomAnchorSession) Creator

func (_FactomAnchor *FactomAnchorSession) Creator() (common.Address, error)

Creator is a free data retrieval call binding the contract method 0x02d05d3f.

Solidity: function creator() constant returns(address)

func (*FactomAnchorSession) Freeze

func (_FactomAnchor *FactomAnchorSession) Freeze(height *big.Int) (*types.Transaction, error)

Freeze is a paid mutator transaction binding the contract method 0xd7a78db8.

Solidity: function freeze(height uint256) returns()

func (*FactomAnchorSession) Frozen

func (_FactomAnchor *FactomAnchorSession) Frozen() (bool, error)

Frozen is a free data retrieval call binding the contract method 0x054f7d9c.

Solidity: function frozen() constant returns(bool)

func (*FactomAnchorSession) GetAnchor

func (_FactomAnchor *FactomAnchorSession) GetAnchor(blockNumber *big.Int) (*big.Int, error)

GetAnchor is a free data retrieval call binding the contract method 0x4c7df18f.

Solidity: function getAnchor(blockNumber uint256) constant returns(uint256)

func (*FactomAnchorSession) SetAnchor

func (_FactomAnchor *FactomAnchorSession) SetAnchor(blockNumber *big.Int, merkleRoot *big.Int) (*types.Transaction, error)

SetAnchor is a paid mutator transaction binding the contract method 0xbbcc0c80.

Solidity: function setAnchor(blockNumber uint256, merkleRoot uint256) returns()

type FactomAnchorTransactor

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

FactomAnchorTransactor is an auto generated write-only Go binding around an Ethereum contract.

func NewFactomAnchorTransactor

func NewFactomAnchorTransactor(address common.Address, transactor bind.ContractTransactor) (*FactomAnchorTransactor, error)

NewFactomAnchorTransactor creates a new write-only instance of FactomAnchor, bound to a specific deployed contract.

func (*FactomAnchorTransactor) Freeze

func (_FactomAnchor *FactomAnchorTransactor) Freeze(opts *bind.TransactOpts, height *big.Int) (*types.Transaction, error)

Freeze is a paid mutator transaction binding the contract method 0xd7a78db8.

Solidity: function freeze(height uint256) returns()

func (*FactomAnchorTransactor) SetAnchor

func (_FactomAnchor *FactomAnchorTransactor) SetAnchor(opts *bind.TransactOpts, blockNumber *big.Int, merkleRoot *big.Int) (*types.Transaction, error)

SetAnchor is a paid mutator transaction binding the contract method 0xbbcc0c80.

Solidity: function setAnchor(blockNumber uint256, merkleRoot uint256) returns()

type FactomAnchorTransactorRaw

type FactomAnchorTransactorRaw struct {
	Contract *FactomAnchorTransactor // Generic write-only contract binding to access the raw methods on
}

FactomAnchorTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract.

func (*FactomAnchorTransactorRaw) Transact

func (_FactomAnchor *FactomAnchorTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error)

Transact invokes the (paid) contract method with params as input values.

func (*FactomAnchorTransactorRaw) Transfer

func (_FactomAnchor *FactomAnchorTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error)

Transfer initiates a plain transaction to move funds to the contract, calling its default method if one is available.

type FactomAnchorTransactorSession

type FactomAnchorTransactorSession struct {
	Contract     *FactomAnchorTransactor // Generic contract transactor binding to set the session for
	TransactOpts bind.TransactOpts       // Transaction auth options to use throughout this session
}

FactomAnchorTransactorSession is an auto generated write-only Go binding around an Ethereum contract, with pre-set transact options.

func (*FactomAnchorTransactorSession) Freeze

func (_FactomAnchor *FactomAnchorTransactorSession) Freeze(height *big.Int) (*types.Transaction, error)

Freeze is a paid mutator transaction binding the contract method 0xd7a78db8.

Solidity: function freeze(height uint256) returns()

func (*FactomAnchorTransactorSession) SetAnchor

func (_FactomAnchor *FactomAnchorTransactorSession) SetAnchor(blockNumber *big.Int, merkleRoot *big.Int) (*types.Transaction, error)

SetAnchor is a paid mutator transaction binding the contract method 0xbbcc0c80.

Solidity: function setAnchor(blockNumber uint256, merkleRoot uint256) returns()

type GasPriceEstimates

type GasPriceEstimates struct {
	BlockNumber uint64
	BlockTime   float64
	Speed       float64
	SafeLow     *big.Int
	SafeLowWait float64
	Average     *big.Int
	AverageWait float64
	Fast        *big.Int
	FastWait    float64
	Fastest     *big.Int
	FastestWait float64
}

GasPriceEstimates holds multiple price estimates (in Wei) and their corresponding wait times (in minutes)

func GetGasPriceEstimates

func GetGasPriceEstimates(url string) (*GasPriceEstimates, error)

GetGasPriceEstimates polls the ethgasstation API at the given URL and returns its most recent estimates

Jump to

Keyboard shortcuts

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