oracle

package
v1.1.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2021 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var OracleABI = OracleMetaData.ABI

OracleABI is the input ABI used to generate the binding from. Deprecated: Use OracleMetaData.ABI instead.

View Source
var OracleMetaData = &bind.MetaData{
	ABI: "[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"fileHash\",\"type\":\"bytes32\"}],\"name\":\"clear\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"fileHash\",\"type\":\"bytes32\"}],\"name\":\"get\",\"outputs\":[{\"internalType\":\"bytes32[]\",\"name\":\"\",\"type\":\"bytes32[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"fileHash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"adr\",\"type\":\"bytes32\"}],\"name\":\"remove\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"fileHash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"adr\",\"type\":\"bytes32\"}],\"name\":\"set\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]",
}

OracleMetaData contains all meta data concerning the Oracle contract.

Functions

This section is empty.

Types

type AuthInfo

type AuthInfo interface {
	// CheckAutoInfo Check validate of an auth_info from chain
	CheckAutoInfo([]byte) bool
	// ReportInvalidAuthInfo Report invalid auth_info to chain
	ReportInvalidAuthInfo([]byte, chan ChainResult)
}

type Balance

type Balance interface {
	// GetPeerBalance Get the balance of peer account
	GetPeerBalance(peer boson.Address) *big.Int
}

type ChainOracle

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

func NewServer

func NewServer(logger logging.Logger, backend *ethclient.Client, address string) (*ChainOracle, error)

func (*ChainOracle) CheckAutoInfo

func (ora *ChainOracle) CheckAutoInfo([]byte) bool

func (*ChainOracle) DataStoreFinished

func (ora *ChainOracle) DataStoreFinished(cid boson.Address, dataLen uint64, salt uint64, proof []byte, resCh chan ChainResult)

func (*ChainOracle) GetCid

func (ora *ChainOracle) GetCid(aufsUri string) []byte

func (*ChainOracle) GetNodesFromCid

func (ora *ChainOracle) GetNodesFromCid(cid []byte) []boson.Address

func (*ChainOracle) GetPeerBalance

func (ora *ChainOracle) GetPeerBalance(peer boson.Address) *big.Int

func (*ChainOracle) GetReceivedAmount

func (ora *ChainOracle) GetReceivedAmount(peer boson.Address) *big.Int

func (*ChainOracle) GetSentAmount

func (ora *ChainOracle) GetSentAmount(peer boson.Address) *big.Int

func (*ChainOracle) GetSourceNodes

func (ora *ChainOracle) GetSourceNodes(aufsUri string) []boson.Address

func (*ChainOracle) OnStoreMatched

func (ora *ChainOracle) OnStoreMatched(cid boson.Address, dataLen uint64, salt uint64, address boson.Address)

func (*ChainOracle) PeerPrice

func (ora *ChainOracle) PeerPrice(address boson.Address) uint64

func (*ChainOracle) Price

func (ora *ChainOracle) Price() uint64

func (*ChainOracle) ReportInvalidAuthInfo

func (ora *ChainOracle) ReportInvalidAuthInfo([]byte, chan ChainResult)

func (*ChainOracle) ReportSignedAmount

func (ora *ChainOracle) ReportSignedAmount(voucher []byte, signature []byte, resCh chan ChainResult)

func (*ChainOracle) SetPrice

func (ora *ChainOracle) SetPrice(value uint64, signature []byte, resCh chan ChainResult)

type ChainResult

type ChainResult struct {
	//success bool
	TxHash []byte
}

type ChequeBook

type ChequeBook interface {
	// GetSentAmount Get data traffic amount from this peer to target peer
	GetSentAmount(peer boson.Address) *big.Int
	// GetReceivedAmount Get data traffic amount from target to this peer
	GetReceivedAmount(peer boson.Address) *big.Int
	// ReportSignedAmount voucher is singed by counter-part peer, signature including my addr
	ReportSignedAmount(voucher []byte, signature []byte, resCh chan ChainResult)
}

type Oracle

type Oracle struct {
	OracleCaller     // Read-only binding to the contract
	OracleTransactor // Write-only binding to the contract
	OracleFilterer   // Log filterer for contract events
}

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

func NewOracle

func NewOracle(address common.Address, backend bind.ContractBackend) (*Oracle, error)

NewOracle creates a new instance of Oracle, bound to a specific deployed contract.

type OracleCaller

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

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

func NewOracleCaller

func NewOracleCaller(address common.Address, caller bind.ContractCaller) (*OracleCaller, error)

NewOracleCaller creates a new read-only instance of Oracle, bound to a specific deployed contract.

func (*OracleCaller) Get

func (_Oracle *OracleCaller) Get(opts *bind.CallOpts, fileHash [32]byte) ([][32]byte, error)

Get is a free data retrieval call binding the contract method 0x8eaa6ac0.

Solidity: function get(bytes32 fileHash) view returns(bytes32[])

func (*OracleCaller) Owner

func (_Oracle *OracleCaller) Owner(opts *bind.CallOpts) (common.Address, error)

Owner is a free data retrieval call binding the contract method 0x8da5cb5b.

Solidity: function owner() view returns(address)

type OracleCallerRaw

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

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

func (*OracleCallerRaw) Call

func (_Oracle *OracleCallerRaw) 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 OracleCallerSession

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

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

func (*OracleCallerSession) Get

func (_Oracle *OracleCallerSession) Get(fileHash [32]byte) ([][32]byte, error)

Get is a free data retrieval call binding the contract method 0x8eaa6ac0.

Solidity: function get(bytes32 fileHash) view returns(bytes32[])

func (*OracleCallerSession) Owner

func (_Oracle *OracleCallerSession) Owner() (common.Address, error)

Owner is a free data retrieval call binding the contract method 0x8da5cb5b.

Solidity: function owner() view returns(address)

type OracleFilterer

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

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

func NewOracleFilterer

func NewOracleFilterer(address common.Address, filterer bind.ContractFilterer) (*OracleFilterer, error)

NewOracleFilterer creates a new log filterer instance of Oracle, bound to a specific deployed contract.

type OracleRaw

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

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

func (*OracleRaw) Call

func (_Oracle *OracleRaw) 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 (*OracleRaw) Transact

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

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

func (*OracleRaw) Transfer

func (_Oracle *OracleRaw) 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 OracleSession

type OracleSession struct {
	Contract     *Oracle           // 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
}

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

func (*OracleSession) Clear

func (_Oracle *OracleSession) Clear(fileHash [32]byte) (*types.Transaction, error)

Clear is a paid mutator transaction binding the contract method 0x97040a45.

Solidity: function clear(bytes32 fileHash) returns()

func (*OracleSession) Get

func (_Oracle *OracleSession) Get(fileHash [32]byte) ([][32]byte, error)

Get is a free data retrieval call binding the contract method 0x8eaa6ac0.

Solidity: function get(bytes32 fileHash) view returns(bytes32[])

func (*OracleSession) Owner

func (_Oracle *OracleSession) Owner() (common.Address, error)

Owner is a free data retrieval call binding the contract method 0x8da5cb5b.

Solidity: function owner() view returns(address)

func (*OracleSession) Remove

func (_Oracle *OracleSession) Remove(fileHash [32]byte, adr [32]byte) (*types.Transaction, error)

Remove is a paid mutator transaction binding the contract method 0xb10e4172.

Solidity: function remove(bytes32 fileHash, bytes32 adr) returns()

func (*OracleSession) Set

func (_Oracle *OracleSession) Set(fileHash [32]byte, adr [32]byte) (*types.Transaction, error)

Set is a paid mutator transaction binding the contract method 0xf71f7a25.

Solidity: function set(bytes32 fileHash, bytes32 adr) returns()

type OracleTransactor

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

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

func NewOracleTransactor

func NewOracleTransactor(address common.Address, transactor bind.ContractTransactor) (*OracleTransactor, error)

NewOracleTransactor creates a new write-only instance of Oracle, bound to a specific deployed contract.

func (*OracleTransactor) Clear

func (_Oracle *OracleTransactor) Clear(opts *bind.TransactOpts, fileHash [32]byte) (*types.Transaction, error)

Clear is a paid mutator transaction binding the contract method 0x97040a45.

Solidity: function clear(bytes32 fileHash) returns()

func (*OracleTransactor) Remove

func (_Oracle *OracleTransactor) Remove(opts *bind.TransactOpts, fileHash [32]byte, adr [32]byte) (*types.Transaction, error)

Remove is a paid mutator transaction binding the contract method 0xb10e4172.

Solidity: function remove(bytes32 fileHash, bytes32 adr) returns()

func (*OracleTransactor) Set

func (_Oracle *OracleTransactor) Set(opts *bind.TransactOpts, fileHash [32]byte, adr [32]byte) (*types.Transaction, error)

Set is a paid mutator transaction binding the contract method 0xf71f7a25.

Solidity: function set(bytes32 fileHash, bytes32 adr) returns()

type OracleTransactorRaw

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

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

func (*OracleTransactorRaw) Transact

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

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

func (*OracleTransactorRaw) Transfer

func (_Oracle *OracleTransactorRaw) 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 OracleTransactorSession

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

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

func (*OracleTransactorSession) Clear

func (_Oracle *OracleTransactorSession) Clear(fileHash [32]byte) (*types.Transaction, error)

Clear is a paid mutator transaction binding the contract method 0x97040a45.

Solidity: function clear(bytes32 fileHash) returns()

func (*OracleTransactorSession) Remove

func (_Oracle *OracleTransactorSession) Remove(fileHash [32]byte, adr [32]byte) (*types.Transaction, error)

Remove is a paid mutator transaction binding the contract method 0xb10e4172.

Solidity: function remove(bytes32 fileHash, bytes32 adr) returns()

func (*OracleTransactorSession) Set

func (_Oracle *OracleTransactorSession) Set(fileHash [32]byte, adr [32]byte) (*types.Transaction, error)

Set is a paid mutator transaction binding the contract method 0xf71f7a25.

Solidity: function set(bytes32 fileHash, bytes32 adr) returns()

type Price

type Price interface {
	// PeerPrice Get price for specified node
	PeerPrice(address boson.Address) uint64
	// Price Get common price from chain
	Price() uint64
	// SetPrice set price for this peer
	SetPrice(value uint64, signature []byte, resCh chan ChainResult)
}

type Resolver

type Resolver interface {
	// GetCid Resolve cid from  uri
	GetCid(aufsUri string) []byte

	// GetNodesFromCid  Get source nodes of specified cid
	GetNodesFromCid([]byte) []boson.Address

	// GetSourceNodes  Short hand function, get storage nodes from uri
	GetSourceNodes(aufsUri string) []boson.Address

	// OnStoreMatched Notification when new data req matched
	OnStoreMatched(cid boson.Address, dataLen uint64, salt uint64, address boson.Address)

	// DataStoreFinished when data retrieved and saved, use this function to report onchain
	DataStoreFinished(cid boson.Address, dataLen uint64, salt uint64, proof []byte, resCh chan ChainResult)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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