add: ethereum rpc wallet operation, send transaction method, smart contracts golang artifacts
This commit is contained in:
parent
04c559eaa7
commit
cfc246a3a1
3
.gitignore
vendored
3
.gitignore
vendored
@ -16,4 +16,5 @@ vendor/
|
||||
.vscode/
|
||||
|
||||
# Environment files
|
||||
.env
|
||||
.env
|
||||
eth-contracts/node_modules
|
193
contracts/Aggregator.go
Normal file
193
contracts/Aggregator.go
Normal file
@ -0,0 +1,193 @@
|
||||
// Code generated - DO NOT EDIT.
|
||||
// This file is a generated binding and any manual changes will be lost.
|
||||
|
||||
package contracts
|
||||
|
||||
import (
|
||||
"math/big"
|
||||
"strings"
|
||||
|
||||
ethereum "github.com/ethereum/go-ethereum"
|
||||
"github.com/ethereum/go-ethereum/accounts/abi"
|
||||
"github.com/ethereum/go-ethereum/accounts/abi/bind"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/core/types"
|
||||
"github.com/ethereum/go-ethereum/event"
|
||||
)
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var (
|
||||
_ = big.NewInt
|
||||
_ = strings.NewReader
|
||||
_ = ethereum.NotFound
|
||||
_ = bind.Bind
|
||||
_ = common.Big1
|
||||
_ = types.BloomLookup
|
||||
_ = event.NewSubscription
|
||||
)
|
||||
|
||||
// SmartcontractsABI is the input ABI used to generate the binding from.
|
||||
const SmartcontractsABI = "[{\"inputs\":[{\"internalType\":\"contractWhitelist\",\"name\":\"_whitelist\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"reqID\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"data\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"callbackAddress\",\"type\":\"address\"},{\"internalType\":\"bytes4\",\"name\":\"callbackMethodID\",\"type\":\"bytes4\"}],\"name\":\"collectData\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]"
|
||||
|
||||
// Smartcontracts is an auto generated Go binding around an Ethereum contract.
|
||||
type Smartcontracts struct {
|
||||
SmartcontractsCaller // Read-only binding to the contract
|
||||
SmartcontractsTransactor // Write-only binding to the contract
|
||||
SmartcontractsFilterer // Log filterer for contract events
|
||||
}
|
||||
|
||||
// SmartcontractsCaller is an auto generated read-only Go binding around an Ethereum contract.
|
||||
type SmartcontractsCaller struct {
|
||||
contract *bind.BoundContract // Generic contract wrapper for the low level calls
|
||||
}
|
||||
|
||||
// SmartcontractsTransactor is an auto generated write-only Go binding around an Ethereum contract.
|
||||
type SmartcontractsTransactor struct {
|
||||
contract *bind.BoundContract // Generic contract wrapper for the low level calls
|
||||
}
|
||||
|
||||
// SmartcontractsFilterer is an auto generated log filtering Go binding around an Ethereum contract events.
|
||||
type SmartcontractsFilterer struct {
|
||||
contract *bind.BoundContract // Generic contract wrapper for the low level calls
|
||||
}
|
||||
|
||||
// SmartcontractsSession is an auto generated Go binding around an Ethereum contract,
|
||||
// with pre-set call and transact options.
|
||||
type SmartcontractsSession struct {
|
||||
Contract *Smartcontracts // 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
|
||||
}
|
||||
|
||||
// SmartcontractsCallerSession is an auto generated read-only Go binding around an Ethereum contract,
|
||||
// with pre-set call options.
|
||||
type SmartcontractsCallerSession struct {
|
||||
Contract *SmartcontractsCaller // Generic contract caller binding to set the session for
|
||||
CallOpts bind.CallOpts // Call options to use throughout this session
|
||||
}
|
||||
|
||||
// SmartcontractsTransactorSession is an auto generated write-only Go binding around an Ethereum contract,
|
||||
// with pre-set transact options.
|
||||
type SmartcontractsTransactorSession struct {
|
||||
Contract *SmartcontractsTransactor // Generic contract transactor binding to set the session for
|
||||
TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session
|
||||
}
|
||||
|
||||
// SmartcontractsRaw is an auto generated low-level Go binding around an Ethereum contract.
|
||||
type SmartcontractsRaw struct {
|
||||
Contract *Smartcontracts // Generic contract binding to access the raw methods on
|
||||
}
|
||||
|
||||
// SmartcontractsCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract.
|
||||
type SmartcontractsCallerRaw struct {
|
||||
Contract *SmartcontractsCaller // Generic read-only contract binding to access the raw methods on
|
||||
}
|
||||
|
||||
// SmartcontractsTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract.
|
||||
type SmartcontractsTransactorRaw struct {
|
||||
Contract *SmartcontractsTransactor // Generic write-only contract binding to access the raw methods on
|
||||
}
|
||||
|
||||
// NewSmartcontracts creates a new instance of Smartcontracts, bound to a specific deployed contract.
|
||||
func NewSmartcontracts(address common.Address, backend bind.ContractBackend) (*Smartcontracts, error) {
|
||||
contract, err := bindSmartcontracts(address, backend, backend, backend)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &Smartcontracts{SmartcontractsCaller: SmartcontractsCaller{contract: contract}, SmartcontractsTransactor: SmartcontractsTransactor{contract: contract}, SmartcontractsFilterer: SmartcontractsFilterer{contract: contract}}, nil
|
||||
}
|
||||
|
||||
// NewSmartcontractsCaller creates a new read-only instance of Smartcontracts, bound to a specific deployed contract.
|
||||
func NewSmartcontractsCaller(address common.Address, caller bind.ContractCaller) (*SmartcontractsCaller, error) {
|
||||
contract, err := bindSmartcontracts(address, caller, nil, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &SmartcontractsCaller{contract: contract}, nil
|
||||
}
|
||||
|
||||
// NewSmartcontractsTransactor creates a new write-only instance of Smartcontracts, bound to a specific deployed contract.
|
||||
func NewSmartcontractsTransactor(address common.Address, transactor bind.ContractTransactor) (*SmartcontractsTransactor, error) {
|
||||
contract, err := bindSmartcontracts(address, nil, transactor, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &SmartcontractsTransactor{contract: contract}, nil
|
||||
}
|
||||
|
||||
// NewSmartcontractsFilterer creates a new log filterer instance of Smartcontracts, bound to a specific deployed contract.
|
||||
func NewSmartcontractsFilterer(address common.Address, filterer bind.ContractFilterer) (*SmartcontractsFilterer, error) {
|
||||
contract, err := bindSmartcontracts(address, nil, nil, filterer)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &SmartcontractsFilterer{contract: contract}, nil
|
||||
}
|
||||
|
||||
// bindSmartcontracts binds a generic wrapper to an already deployed contract.
|
||||
func bindSmartcontracts(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) {
|
||||
parsed, err := abi.JSON(strings.NewReader(SmartcontractsABI))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil
|
||||
}
|
||||
|
||||
// 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 (_Smartcontracts *SmartcontractsRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error {
|
||||
return _Smartcontracts.Contract.SmartcontractsCaller.contract.Call(opts, result, method, params...)
|
||||
}
|
||||
|
||||
// Transfer initiates a plain transaction to move funds to the contract, calling
|
||||
// its default method if one is available.
|
||||
func (_Smartcontracts *SmartcontractsRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {
|
||||
return _Smartcontracts.Contract.SmartcontractsTransactor.contract.Transfer(opts)
|
||||
}
|
||||
|
||||
// Transact invokes the (paid) contract method with params as input values.
|
||||
func (_Smartcontracts *SmartcontractsRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {
|
||||
return _Smartcontracts.Contract.SmartcontractsTransactor.contract.Transact(opts, method, params...)
|
||||
}
|
||||
|
||||
// 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 (_Smartcontracts *SmartcontractsCallerRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error {
|
||||
return _Smartcontracts.Contract.contract.Call(opts, result, method, params...)
|
||||
}
|
||||
|
||||
// Transfer initiates a plain transaction to move funds to the contract, calling
|
||||
// its default method if one is available.
|
||||
func (_Smartcontracts *SmartcontractsTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {
|
||||
return _Smartcontracts.Contract.contract.Transfer(opts)
|
||||
}
|
||||
|
||||
// Transact invokes the (paid) contract method with params as input values.
|
||||
func (_Smartcontracts *SmartcontractsTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {
|
||||
return _Smartcontracts.Contract.contract.Transact(opts, method, params...)
|
||||
}
|
||||
|
||||
// CollectData is a paid mutator transaction binding the contract method 0x05187092.
|
||||
//
|
||||
// Solidity: function collectData(uint256 reqID, string data, address callbackAddress, bytes4 callbackMethodID) returns()
|
||||
func (_Smartcontracts *SmartcontractsTransactor) CollectData(opts *bind.TransactOpts, reqID *big.Int, data string, callbackAddress common.Address, callbackMethodID [4]byte) (*types.Transaction, error) {
|
||||
return _Smartcontracts.contract.Transact(opts, "collectData", reqID, data, callbackAddress, callbackMethodID)
|
||||
}
|
||||
|
||||
// CollectData is a paid mutator transaction binding the contract method 0x05187092.
|
||||
//
|
||||
// Solidity: function collectData(uint256 reqID, string data, address callbackAddress, bytes4 callbackMethodID) returns()
|
||||
func (_Smartcontracts *SmartcontractsSession) CollectData(reqID *big.Int, data string, callbackAddress common.Address, callbackMethodID [4]byte) (*types.Transaction, error) {
|
||||
return _Smartcontracts.Contract.CollectData(&_Smartcontracts.TransactOpts, reqID, data, callbackAddress, callbackMethodID)
|
||||
}
|
||||
|
||||
// CollectData is a paid mutator transaction binding the contract method 0x05187092.
|
||||
//
|
||||
// Solidity: function collectData(uint256 reqID, string data, address callbackAddress, bytes4 callbackMethodID) returns()
|
||||
func (_Smartcontracts *SmartcontractsTransactorSession) CollectData(reqID *big.Int, data string, callbackAddress common.Address, callbackMethodID [4]byte) (*types.Transaction, error) {
|
||||
return _Smartcontracts.Contract.CollectData(&_Smartcontracts.TransactOpts, reqID, data, callbackAddress, callbackMethodID)
|
||||
}
|
573
contracts/Mediator.go
Normal file
573
contracts/Mediator.go
Normal file
@ -0,0 +1,573 @@
|
||||
// Code generated - DO NOT EDIT.
|
||||
// This file is a generated binding and any manual changes will be lost.
|
||||
|
||||
package contracts
|
||||
|
||||
import (
|
||||
"math/big"
|
||||
"strings"
|
||||
|
||||
ethereum "github.com/ethereum/go-ethereum"
|
||||
"github.com/ethereum/go-ethereum/accounts/abi"
|
||||
"github.com/ethereum/go-ethereum/accounts/abi/bind"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/core/types"
|
||||
"github.com/ethereum/go-ethereum/event"
|
||||
)
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var (
|
||||
_ = big.NewInt
|
||||
_ = strings.NewReader
|
||||
_ = ethereum.NotFound
|
||||
_ = bind.Bind
|
||||
_ = common.Big1
|
||||
_ = types.BloomLookup
|
||||
_ = event.NewSubscription
|
||||
)
|
||||
|
||||
// SmartcontractsABI is the input ABI used to generate the binding from.
|
||||
const SmartcontractsABI = "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_oracleEmitter\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_aggregator\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"reqID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"data\",\"type\":\"string\"}],\"name\":\"DataReceived\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"reqID\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"data\",\"type\":\"string\"}],\"name\":\"_receiveDataCallback\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"isOwner\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"requestType\",\"type\":\"string\"}],\"name\":\"request\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]"
|
||||
|
||||
// Smartcontracts is an auto generated Go binding around an Ethereum contract.
|
||||
type Smartcontracts struct {
|
||||
SmartcontractsCaller // Read-only binding to the contract
|
||||
SmartcontractsTransactor // Write-only binding to the contract
|
||||
SmartcontractsFilterer // Log filterer for contract events
|
||||
}
|
||||
|
||||
// SmartcontractsCaller is an auto generated read-only Go binding around an Ethereum contract.
|
||||
type SmartcontractsCaller struct {
|
||||
contract *bind.BoundContract // Generic contract wrapper for the low level calls
|
||||
}
|
||||
|
||||
// SmartcontractsTransactor is an auto generated write-only Go binding around an Ethereum contract.
|
||||
type SmartcontractsTransactor struct {
|
||||
contract *bind.BoundContract // Generic contract wrapper for the low level calls
|
||||
}
|
||||
|
||||
// SmartcontractsFilterer is an auto generated log filtering Go binding around an Ethereum contract events.
|
||||
type SmartcontractsFilterer struct {
|
||||
contract *bind.BoundContract // Generic contract wrapper for the low level calls
|
||||
}
|
||||
|
||||
// SmartcontractsSession is an auto generated Go binding around an Ethereum contract,
|
||||
// with pre-set call and transact options.
|
||||
type SmartcontractsSession struct {
|
||||
Contract *Smartcontracts // 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
|
||||
}
|
||||
|
||||
// SmartcontractsCallerSession is an auto generated read-only Go binding around an Ethereum contract,
|
||||
// with pre-set call options.
|
||||
type SmartcontractsCallerSession struct {
|
||||
Contract *SmartcontractsCaller // Generic contract caller binding to set the session for
|
||||
CallOpts bind.CallOpts // Call options to use throughout this session
|
||||
}
|
||||
|
||||
// SmartcontractsTransactorSession is an auto generated write-only Go binding around an Ethereum contract,
|
||||
// with pre-set transact options.
|
||||
type SmartcontractsTransactorSession struct {
|
||||
Contract *SmartcontractsTransactor // Generic contract transactor binding to set the session for
|
||||
TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session
|
||||
}
|
||||
|
||||
// SmartcontractsRaw is an auto generated low-level Go binding around an Ethereum contract.
|
||||
type SmartcontractsRaw struct {
|
||||
Contract *Smartcontracts // Generic contract binding to access the raw methods on
|
||||
}
|
||||
|
||||
// SmartcontractsCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract.
|
||||
type SmartcontractsCallerRaw struct {
|
||||
Contract *SmartcontractsCaller // Generic read-only contract binding to access the raw methods on
|
||||
}
|
||||
|
||||
// SmartcontractsTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract.
|
||||
type SmartcontractsTransactorRaw struct {
|
||||
Contract *SmartcontractsTransactor // Generic write-only contract binding to access the raw methods on
|
||||
}
|
||||
|
||||
// NewSmartcontracts creates a new instance of Smartcontracts, bound to a specific deployed contract.
|
||||
func NewSmartcontracts(address common.Address, backend bind.ContractBackend) (*Smartcontracts, error) {
|
||||
contract, err := bindSmartcontracts(address, backend, backend, backend)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &Smartcontracts{SmartcontractsCaller: SmartcontractsCaller{contract: contract}, SmartcontractsTransactor: SmartcontractsTransactor{contract: contract}, SmartcontractsFilterer: SmartcontractsFilterer{contract: contract}}, nil
|
||||
}
|
||||
|
||||
// NewSmartcontractsCaller creates a new read-only instance of Smartcontracts, bound to a specific deployed contract.
|
||||
func NewSmartcontractsCaller(address common.Address, caller bind.ContractCaller) (*SmartcontractsCaller, error) {
|
||||
contract, err := bindSmartcontracts(address, caller, nil, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &SmartcontractsCaller{contract: contract}, nil
|
||||
}
|
||||
|
||||
// NewSmartcontractsTransactor creates a new write-only instance of Smartcontracts, bound to a specific deployed contract.
|
||||
func NewSmartcontractsTransactor(address common.Address, transactor bind.ContractTransactor) (*SmartcontractsTransactor, error) {
|
||||
contract, err := bindSmartcontracts(address, nil, transactor, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &SmartcontractsTransactor{contract: contract}, nil
|
||||
}
|
||||
|
||||
// NewSmartcontractsFilterer creates a new log filterer instance of Smartcontracts, bound to a specific deployed contract.
|
||||
func NewSmartcontractsFilterer(address common.Address, filterer bind.ContractFilterer) (*SmartcontractsFilterer, error) {
|
||||
contract, err := bindSmartcontracts(address, nil, nil, filterer)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &SmartcontractsFilterer{contract: contract}, nil
|
||||
}
|
||||
|
||||
// bindSmartcontracts binds a generic wrapper to an already deployed contract.
|
||||
func bindSmartcontracts(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) {
|
||||
parsed, err := abi.JSON(strings.NewReader(SmartcontractsABI))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil
|
||||
}
|
||||
|
||||
// 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 (_Smartcontracts *SmartcontractsRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error {
|
||||
return _Smartcontracts.Contract.SmartcontractsCaller.contract.Call(opts, result, method, params...)
|
||||
}
|
||||
|
||||
// Transfer initiates a plain transaction to move funds to the contract, calling
|
||||
// its default method if one is available.
|
||||
func (_Smartcontracts *SmartcontractsRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {
|
||||
return _Smartcontracts.Contract.SmartcontractsTransactor.contract.Transfer(opts)
|
||||
}
|
||||
|
||||
// Transact invokes the (paid) contract method with params as input values.
|
||||
func (_Smartcontracts *SmartcontractsRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {
|
||||
return _Smartcontracts.Contract.SmartcontractsTransactor.contract.Transact(opts, method, params...)
|
||||
}
|
||||
|
||||
// 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 (_Smartcontracts *SmartcontractsCallerRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error {
|
||||
return _Smartcontracts.Contract.contract.Call(opts, result, method, params...)
|
||||
}
|
||||
|
||||
// Transfer initiates a plain transaction to move funds to the contract, calling
|
||||
// its default method if one is available.
|
||||
func (_Smartcontracts *SmartcontractsTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {
|
||||
return _Smartcontracts.Contract.contract.Transfer(opts)
|
||||
}
|
||||
|
||||
// Transact invokes the (paid) contract method with params as input values.
|
||||
func (_Smartcontracts *SmartcontractsTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {
|
||||
return _Smartcontracts.Contract.contract.Transact(opts, method, params...)
|
||||
}
|
||||
|
||||
// IsOwner is a free data retrieval call binding the contract method 0x8f32d59b.
|
||||
//
|
||||
// Solidity: function isOwner() view returns(bool)
|
||||
func (_Smartcontracts *SmartcontractsCaller) IsOwner(opts *bind.CallOpts) (bool, error) {
|
||||
var (
|
||||
ret0 = new(bool)
|
||||
)
|
||||
out := ret0
|
||||
err := _Smartcontracts.contract.Call(opts, out, "isOwner")
|
||||
return *ret0, err
|
||||
}
|
||||
|
||||
// IsOwner is a free data retrieval call binding the contract method 0x8f32d59b.
|
||||
//
|
||||
// Solidity: function isOwner() view returns(bool)
|
||||
func (_Smartcontracts *SmartcontractsSession) IsOwner() (bool, error) {
|
||||
return _Smartcontracts.Contract.IsOwner(&_Smartcontracts.CallOpts)
|
||||
}
|
||||
|
||||
// IsOwner is a free data retrieval call binding the contract method 0x8f32d59b.
|
||||
//
|
||||
// Solidity: function isOwner() view returns(bool)
|
||||
func (_Smartcontracts *SmartcontractsCallerSession) IsOwner() (bool, error) {
|
||||
return _Smartcontracts.Contract.IsOwner(&_Smartcontracts.CallOpts)
|
||||
}
|
||||
|
||||
// Owner is a free data retrieval call binding the contract method 0x8da5cb5b.
|
||||
//
|
||||
// Solidity: function owner() view returns(address)
|
||||
func (_Smartcontracts *SmartcontractsCaller) Owner(opts *bind.CallOpts) (common.Address, error) {
|
||||
var (
|
||||
ret0 = new(common.Address)
|
||||
)
|
||||
out := ret0
|
||||
err := _Smartcontracts.contract.Call(opts, out, "owner")
|
||||
return *ret0, err
|
||||
}
|
||||
|
||||
// Owner is a free data retrieval call binding the contract method 0x8da5cb5b.
|
||||
//
|
||||
// Solidity: function owner() view returns(address)
|
||||
func (_Smartcontracts *SmartcontractsSession) Owner() (common.Address, error) {
|
||||
return _Smartcontracts.Contract.Owner(&_Smartcontracts.CallOpts)
|
||||
}
|
||||
|
||||
// Owner is a free data retrieval call binding the contract method 0x8da5cb5b.
|
||||
//
|
||||
// Solidity: function owner() view returns(address)
|
||||
func (_Smartcontracts *SmartcontractsCallerSession) Owner() (common.Address, error) {
|
||||
return _Smartcontracts.Contract.Owner(&_Smartcontracts.CallOpts)
|
||||
}
|
||||
|
||||
// ReceiveDataCallback is a paid mutator transaction binding the contract method 0xfd55592a.
|
||||
//
|
||||
// Solidity: function _receiveDataCallback(uint256 reqID, string data) returns()
|
||||
func (_Smartcontracts *SmartcontractsTransactor) ReceiveDataCallback(opts *bind.TransactOpts, reqID *big.Int, data string) (*types.Transaction, error) {
|
||||
return _Smartcontracts.contract.Transact(opts, "_receiveDataCallback", reqID, data)
|
||||
}
|
||||
|
||||
// ReceiveDataCallback is a paid mutator transaction binding the contract method 0xfd55592a.
|
||||
//
|
||||
// Solidity: function _receiveDataCallback(uint256 reqID, string data) returns()
|
||||
func (_Smartcontracts *SmartcontractsSession) ReceiveDataCallback(reqID *big.Int, data string) (*types.Transaction, error) {
|
||||
return _Smartcontracts.Contract.ReceiveDataCallback(&_Smartcontracts.TransactOpts, reqID, data)
|
||||
}
|
||||
|
||||
// ReceiveDataCallback is a paid mutator transaction binding the contract method 0xfd55592a.
|
||||
//
|
||||
// Solidity: function _receiveDataCallback(uint256 reqID, string data) returns()
|
||||
func (_Smartcontracts *SmartcontractsTransactorSession) ReceiveDataCallback(reqID *big.Int, data string) (*types.Transaction, error) {
|
||||
return _Smartcontracts.Contract.ReceiveDataCallback(&_Smartcontracts.TransactOpts, reqID, data)
|
||||
}
|
||||
|
||||
// Request is a paid mutator transaction binding the contract method 0x2c199889.
|
||||
//
|
||||
// Solidity: function request(string requestType) returns(uint256)
|
||||
func (_Smartcontracts *SmartcontractsTransactor) Request(opts *bind.TransactOpts, requestType string) (*types.Transaction, error) {
|
||||
return _Smartcontracts.contract.Transact(opts, "request", requestType)
|
||||
}
|
||||
|
||||
// Request is a paid mutator transaction binding the contract method 0x2c199889.
|
||||
//
|
||||
// Solidity: function request(string requestType) returns(uint256)
|
||||
func (_Smartcontracts *SmartcontractsSession) Request(requestType string) (*types.Transaction, error) {
|
||||
return _Smartcontracts.Contract.Request(&_Smartcontracts.TransactOpts, requestType)
|
||||
}
|
||||
|
||||
// Request is a paid mutator transaction binding the contract method 0x2c199889.
|
||||
//
|
||||
// Solidity: function request(string requestType) returns(uint256)
|
||||
func (_Smartcontracts *SmartcontractsTransactorSession) Request(requestType string) (*types.Transaction, error) {
|
||||
return _Smartcontracts.Contract.Request(&_Smartcontracts.TransactOpts, requestType)
|
||||
}
|
||||
|
||||
// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b.
|
||||
//
|
||||
// Solidity: function transferOwnership(address newOwner) returns()
|
||||
func (_Smartcontracts *SmartcontractsTransactor) TransferOwnership(opts *bind.TransactOpts, newOwner common.Address) (*types.Transaction, error) {
|
||||
return _Smartcontracts.contract.Transact(opts, "transferOwnership", newOwner)
|
||||
}
|
||||
|
||||
// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b.
|
||||
//
|
||||
// Solidity: function transferOwnership(address newOwner) returns()
|
||||
func (_Smartcontracts *SmartcontractsSession) TransferOwnership(newOwner common.Address) (*types.Transaction, error) {
|
||||
return _Smartcontracts.Contract.TransferOwnership(&_Smartcontracts.TransactOpts, newOwner)
|
||||
}
|
||||
|
||||
// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b.
|
||||
//
|
||||
// Solidity: function transferOwnership(address newOwner) returns()
|
||||
func (_Smartcontracts *SmartcontractsTransactorSession) TransferOwnership(newOwner common.Address) (*types.Transaction, error) {
|
||||
return _Smartcontracts.Contract.TransferOwnership(&_Smartcontracts.TransactOpts, newOwner)
|
||||
}
|
||||
|
||||
// SmartcontractsDataReceivedIterator is returned from FilterDataReceived and is used to iterate over the raw logs and unpacked data for DataReceived events raised by the Smartcontracts contract.
|
||||
type SmartcontractsDataReceivedIterator struct {
|
||||
Event *SmartcontractsDataReceived // Event containing the contract specifics and raw log
|
||||
|
||||
contract *bind.BoundContract // Generic contract to use for unpacking event data
|
||||
event string // Event name to use for unpacking event data
|
||||
|
||||
logs chan types.Log // Log channel receiving the found contract events
|
||||
sub ethereum.Subscription // Subscription for errors, completion and termination
|
||||
done bool // Whether the subscription completed delivering logs
|
||||
fail error // Occurred error to stop iteration
|
||||
}
|
||||
|
||||
// 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.
|
||||
func (it *SmartcontractsDataReceivedIterator) Next() bool {
|
||||
// If the iterator failed, stop iterating
|
||||
if it.fail != nil {
|
||||
return false
|
||||
}
|
||||
// If the iterator completed, deliver directly whatever's available
|
||||
if it.done {
|
||||
select {
|
||||
case log := <-it.logs:
|
||||
it.Event = new(SmartcontractsDataReceived)
|
||||
if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil {
|
||||
it.fail = err
|
||||
return false
|
||||
}
|
||||
it.Event.Raw = log
|
||||
return true
|
||||
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
// Iterator still in progress, wait for either a data or an error event
|
||||
select {
|
||||
case log := <-it.logs:
|
||||
it.Event = new(SmartcontractsDataReceived)
|
||||
if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil {
|
||||
it.fail = err
|
||||
return false
|
||||
}
|
||||
it.Event.Raw = log
|
||||
return true
|
||||
|
||||
case err := <-it.sub.Err():
|
||||
it.done = true
|
||||
it.fail = err
|
||||
return it.Next()
|
||||
}
|
||||
}
|
||||
|
||||
// Error returns any retrieval or parsing error occurred during filtering.
|
||||
func (it *SmartcontractsDataReceivedIterator) Error() error {
|
||||
return it.fail
|
||||
}
|
||||
|
||||
// Close terminates the iteration process, releasing any pending underlying
|
||||
// resources.
|
||||
func (it *SmartcontractsDataReceivedIterator) Close() error {
|
||||
it.sub.Unsubscribe()
|
||||
return nil
|
||||
}
|
||||
|
||||
// SmartcontractsDataReceived represents a DataReceived event raised by the Smartcontracts contract.
|
||||
type SmartcontractsDataReceived struct {
|
||||
ReqID *big.Int
|
||||
Data string
|
||||
Raw types.Log // Blockchain specific contextual infos
|
||||
}
|
||||
|
||||
// FilterDataReceived is a free log retrieval operation binding the contract event 0x761d45cf346740607c4bed1616ffece636d5449d76d1213886d4a76b76318653.
|
||||
//
|
||||
// Solidity: event DataReceived(uint256 reqID, string data)
|
||||
func (_Smartcontracts *SmartcontractsFilterer) FilterDataReceived(opts *bind.FilterOpts) (*SmartcontractsDataReceivedIterator, error) {
|
||||
|
||||
logs, sub, err := _Smartcontracts.contract.FilterLogs(opts, "DataReceived")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &SmartcontractsDataReceivedIterator{contract: _Smartcontracts.contract, event: "DataReceived", logs: logs, sub: sub}, nil
|
||||
}
|
||||
|
||||
// WatchDataReceived is a free log subscription operation binding the contract event 0x761d45cf346740607c4bed1616ffece636d5449d76d1213886d4a76b76318653.
|
||||
//
|
||||
// Solidity: event DataReceived(uint256 reqID, string data)
|
||||
func (_Smartcontracts *SmartcontractsFilterer) WatchDataReceived(opts *bind.WatchOpts, sink chan<- *SmartcontractsDataReceived) (event.Subscription, error) {
|
||||
|
||||
logs, sub, err := _Smartcontracts.contract.WatchLogs(opts, "DataReceived")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return event.NewSubscription(func(quit <-chan struct{}) error {
|
||||
defer sub.Unsubscribe()
|
||||
for {
|
||||
select {
|
||||
case log := <-logs:
|
||||
// New log arrived, parse the event and forward to the user
|
||||
event := new(SmartcontractsDataReceived)
|
||||
if err := _Smartcontracts.contract.UnpackLog(event, "DataReceived", log); err != nil {
|
||||
return err
|
||||
}
|
||||
event.Raw = log
|
||||
|
||||
select {
|
||||
case sink <- event:
|
||||
case err := <-sub.Err():
|
||||
return err
|
||||
case <-quit:
|
||||
return nil
|
||||
}
|
||||
case err := <-sub.Err():
|
||||
return err
|
||||
case <-quit:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}), nil
|
||||
}
|
||||
|
||||
// ParseDataReceived is a log parse operation binding the contract event 0x761d45cf346740607c4bed1616ffece636d5449d76d1213886d4a76b76318653.
|
||||
//
|
||||
// Solidity: event DataReceived(uint256 reqID, string data)
|
||||
func (_Smartcontracts *SmartcontractsFilterer) ParseDataReceived(log types.Log) (*SmartcontractsDataReceived, error) {
|
||||
event := new(SmartcontractsDataReceived)
|
||||
if err := _Smartcontracts.contract.UnpackLog(event, "DataReceived", log); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return event, nil
|
||||
}
|
||||
|
||||
// SmartcontractsOwnershipTransferredIterator is returned from FilterOwnershipTransferred and is used to iterate over the raw logs and unpacked data for OwnershipTransferred events raised by the Smartcontracts contract.
|
||||
type SmartcontractsOwnershipTransferredIterator struct {
|
||||
Event *SmartcontractsOwnershipTransferred // Event containing the contract specifics and raw log
|
||||
|
||||
contract *bind.BoundContract // Generic contract to use for unpacking event data
|
||||
event string // Event name to use for unpacking event data
|
||||
|
||||
logs chan types.Log // Log channel receiving the found contract events
|
||||
sub ethereum.Subscription // Subscription for errors, completion and termination
|
||||
done bool // Whether the subscription completed delivering logs
|
||||
fail error // Occurred error to stop iteration
|
||||
}
|
||||
|
||||
// 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.
|
||||
func (it *SmartcontractsOwnershipTransferredIterator) Next() bool {
|
||||
// If the iterator failed, stop iterating
|
||||
if it.fail != nil {
|
||||
return false
|
||||
}
|
||||
// If the iterator completed, deliver directly whatever's available
|
||||
if it.done {
|
||||
select {
|
||||
case log := <-it.logs:
|
||||
it.Event = new(SmartcontractsOwnershipTransferred)
|
||||
if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil {
|
||||
it.fail = err
|
||||
return false
|
||||
}
|
||||
it.Event.Raw = log
|
||||
return true
|
||||
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
// Iterator still in progress, wait for either a data or an error event
|
||||
select {
|
||||
case log := <-it.logs:
|
||||
it.Event = new(SmartcontractsOwnershipTransferred)
|
||||
if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil {
|
||||
it.fail = err
|
||||
return false
|
||||
}
|
||||
it.Event.Raw = log
|
||||
return true
|
||||
|
||||
case err := <-it.sub.Err():
|
||||
it.done = true
|
||||
it.fail = err
|
||||
return it.Next()
|
||||
}
|
||||
}
|
||||
|
||||
// Error returns any retrieval or parsing error occurred during filtering.
|
||||
func (it *SmartcontractsOwnershipTransferredIterator) Error() error {
|
||||
return it.fail
|
||||
}
|
||||
|
||||
// Close terminates the iteration process, releasing any pending underlying
|
||||
// resources.
|
||||
func (it *SmartcontractsOwnershipTransferredIterator) Close() error {
|
||||
it.sub.Unsubscribe()
|
||||
return nil
|
||||
}
|
||||
|
||||
// SmartcontractsOwnershipTransferred represents a OwnershipTransferred event raised by the Smartcontracts contract.
|
||||
type SmartcontractsOwnershipTransferred struct {
|
||||
PreviousOwner common.Address
|
||||
NewOwner common.Address
|
||||
Raw types.Log // Blockchain specific contextual infos
|
||||
}
|
||||
|
||||
// FilterOwnershipTransferred is a free log retrieval operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0.
|
||||
//
|
||||
// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner)
|
||||
func (_Smartcontracts *SmartcontractsFilterer) FilterOwnershipTransferred(opts *bind.FilterOpts, previousOwner []common.Address, newOwner []common.Address) (*SmartcontractsOwnershipTransferredIterator, error) {
|
||||
|
||||
var previousOwnerRule []interface{}
|
||||
for _, previousOwnerItem := range previousOwner {
|
||||
previousOwnerRule = append(previousOwnerRule, previousOwnerItem)
|
||||
}
|
||||
var newOwnerRule []interface{}
|
||||
for _, newOwnerItem := range newOwner {
|
||||
newOwnerRule = append(newOwnerRule, newOwnerItem)
|
||||
}
|
||||
|
||||
logs, sub, err := _Smartcontracts.contract.FilterLogs(opts, "OwnershipTransferred", previousOwnerRule, newOwnerRule)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &SmartcontractsOwnershipTransferredIterator{contract: _Smartcontracts.contract, event: "OwnershipTransferred", logs: logs, sub: sub}, nil
|
||||
}
|
||||
|
||||
// WatchOwnershipTransferred is a free log subscription operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0.
|
||||
//
|
||||
// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner)
|
||||
func (_Smartcontracts *SmartcontractsFilterer) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *SmartcontractsOwnershipTransferred, previousOwner []common.Address, newOwner []common.Address) (event.Subscription, error) {
|
||||
|
||||
var previousOwnerRule []interface{}
|
||||
for _, previousOwnerItem := range previousOwner {
|
||||
previousOwnerRule = append(previousOwnerRule, previousOwnerItem)
|
||||
}
|
||||
var newOwnerRule []interface{}
|
||||
for _, newOwnerItem := range newOwner {
|
||||
newOwnerRule = append(newOwnerRule, newOwnerItem)
|
||||
}
|
||||
|
||||
logs, sub, err := _Smartcontracts.contract.WatchLogs(opts, "OwnershipTransferred", previousOwnerRule, newOwnerRule)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return event.NewSubscription(func(quit <-chan struct{}) error {
|
||||
defer sub.Unsubscribe()
|
||||
for {
|
||||
select {
|
||||
case log := <-logs:
|
||||
// New log arrived, parse the event and forward to the user
|
||||
event := new(SmartcontractsOwnershipTransferred)
|
||||
if err := _Smartcontracts.contract.UnpackLog(event, "OwnershipTransferred", log); err != nil {
|
||||
return err
|
||||
}
|
||||
event.Raw = log
|
||||
|
||||
select {
|
||||
case sink <- event:
|
||||
case err := <-sub.Err():
|
||||
return err
|
||||
case <-quit:
|
||||
return nil
|
||||
}
|
||||
case err := <-sub.Err():
|
||||
return err
|
||||
case <-quit:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}), nil
|
||||
}
|
||||
|
||||
// ParseOwnershipTransferred is a log parse operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0.
|
||||
//
|
||||
// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner)
|
||||
func (_Smartcontracts *SmartcontractsFilterer) ParseOwnershipTransferred(log types.Log) (*SmartcontractsOwnershipTransferred, error) {
|
||||
event := new(SmartcontractsOwnershipTransferred)
|
||||
if err := _Smartcontracts.contract.UnpackLog(event, "OwnershipTransferred", log); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return event, nil
|
||||
}
|
329
contracts/OracleEmitter.go
Normal file
329
contracts/OracleEmitter.go
Normal file
@ -0,0 +1,329 @@
|
||||
// Code generated - DO NOT EDIT.
|
||||
// This file is a generated binding and any manual changes will be lost.
|
||||
|
||||
package contracts
|
||||
|
||||
import (
|
||||
"math/big"
|
||||
"strings"
|
||||
|
||||
ethereum "github.com/ethereum/go-ethereum"
|
||||
"github.com/ethereum/go-ethereum/accounts/abi"
|
||||
"github.com/ethereum/go-ethereum/accounts/abi/bind"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/core/types"
|
||||
"github.com/ethereum/go-ethereum/event"
|
||||
)
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var (
|
||||
_ = big.NewInt
|
||||
_ = strings.NewReader
|
||||
_ = ethereum.NotFound
|
||||
_ = bind.Bind
|
||||
_ = common.Big1
|
||||
_ = types.BloomLookup
|
||||
_ = event.NewSubscription
|
||||
)
|
||||
|
||||
// SmartcontractsABI is the input ABI used to generate the binding from.
|
||||
const SmartcontractsABI = "[{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"string\",\"name\":\"requestType\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"callbackAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes4\",\"name\":\"callbackMethodID\",\"type\":\"bytes4\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"requestID\",\"type\":\"uint256\"}],\"name\":\"NewOracleRequest\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"requestType\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"callbackAddress\",\"type\":\"address\"},{\"internalType\":\"bytes4\",\"name\":\"callbackMethodID\",\"type\":\"bytes4\"}],\"name\":\"requestOracles\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]"
|
||||
|
||||
// Smartcontracts is an auto generated Go binding around an Ethereum contract.
|
||||
type Smartcontracts struct {
|
||||
SmartcontractsCaller // Read-only binding to the contract
|
||||
SmartcontractsTransactor // Write-only binding to the contract
|
||||
SmartcontractsFilterer // Log filterer for contract events
|
||||
}
|
||||
|
||||
// SmartcontractsCaller is an auto generated read-only Go binding around an Ethereum contract.
|
||||
type SmartcontractsCaller struct {
|
||||
contract *bind.BoundContract // Generic contract wrapper for the low level calls
|
||||
}
|
||||
|
||||
// SmartcontractsTransactor is an auto generated write-only Go binding around an Ethereum contract.
|
||||
type SmartcontractsTransactor struct {
|
||||
contract *bind.BoundContract // Generic contract wrapper for the low level calls
|
||||
}
|
||||
|
||||
// SmartcontractsFilterer is an auto generated log filtering Go binding around an Ethereum contract events.
|
||||
type SmartcontractsFilterer struct {
|
||||
contract *bind.BoundContract // Generic contract wrapper for the low level calls
|
||||
}
|
||||
|
||||
// SmartcontractsSession is an auto generated Go binding around an Ethereum contract,
|
||||
// with pre-set call and transact options.
|
||||
type SmartcontractsSession struct {
|
||||
Contract *Smartcontracts // 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
|
||||
}
|
||||
|
||||
// SmartcontractsCallerSession is an auto generated read-only Go binding around an Ethereum contract,
|
||||
// with pre-set call options.
|
||||
type SmartcontractsCallerSession struct {
|
||||
Contract *SmartcontractsCaller // Generic contract caller binding to set the session for
|
||||
CallOpts bind.CallOpts // Call options to use throughout this session
|
||||
}
|
||||
|
||||
// SmartcontractsTransactorSession is an auto generated write-only Go binding around an Ethereum contract,
|
||||
// with pre-set transact options.
|
||||
type SmartcontractsTransactorSession struct {
|
||||
Contract *SmartcontractsTransactor // Generic contract transactor binding to set the session for
|
||||
TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session
|
||||
}
|
||||
|
||||
// SmartcontractsRaw is an auto generated low-level Go binding around an Ethereum contract.
|
||||
type SmartcontractsRaw struct {
|
||||
Contract *Smartcontracts // Generic contract binding to access the raw methods on
|
||||
}
|
||||
|
||||
// SmartcontractsCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract.
|
||||
type SmartcontractsCallerRaw struct {
|
||||
Contract *SmartcontractsCaller // Generic read-only contract binding to access the raw methods on
|
||||
}
|
||||
|
||||
// SmartcontractsTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract.
|
||||
type SmartcontractsTransactorRaw struct {
|
||||
Contract *SmartcontractsTransactor // Generic write-only contract binding to access the raw methods on
|
||||
}
|
||||
|
||||
// NewSmartcontracts creates a new instance of Smartcontracts, bound to a specific deployed contract.
|
||||
func NewSmartcontracts(address common.Address, backend bind.ContractBackend) (*Smartcontracts, error) {
|
||||
contract, err := bindSmartcontracts(address, backend, backend, backend)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &Smartcontracts{SmartcontractsCaller: SmartcontractsCaller{contract: contract}, SmartcontractsTransactor: SmartcontractsTransactor{contract: contract}, SmartcontractsFilterer: SmartcontractsFilterer{contract: contract}}, nil
|
||||
}
|
||||
|
||||
// NewSmartcontractsCaller creates a new read-only instance of Smartcontracts, bound to a specific deployed contract.
|
||||
func NewSmartcontractsCaller(address common.Address, caller bind.ContractCaller) (*SmartcontractsCaller, error) {
|
||||
contract, err := bindSmartcontracts(address, caller, nil, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &SmartcontractsCaller{contract: contract}, nil
|
||||
}
|
||||
|
||||
// NewSmartcontractsTransactor creates a new write-only instance of Smartcontracts, bound to a specific deployed contract.
|
||||
func NewSmartcontractsTransactor(address common.Address, transactor bind.ContractTransactor) (*SmartcontractsTransactor, error) {
|
||||
contract, err := bindSmartcontracts(address, nil, transactor, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &SmartcontractsTransactor{contract: contract}, nil
|
||||
}
|
||||
|
||||
// NewSmartcontractsFilterer creates a new log filterer instance of Smartcontracts, bound to a specific deployed contract.
|
||||
func NewSmartcontractsFilterer(address common.Address, filterer bind.ContractFilterer) (*SmartcontractsFilterer, error) {
|
||||
contract, err := bindSmartcontracts(address, nil, nil, filterer)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &SmartcontractsFilterer{contract: contract}, nil
|
||||
}
|
||||
|
||||
// bindSmartcontracts binds a generic wrapper to an already deployed contract.
|
||||
func bindSmartcontracts(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) {
|
||||
parsed, err := abi.JSON(strings.NewReader(SmartcontractsABI))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil
|
||||
}
|
||||
|
||||
// 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 (_Smartcontracts *SmartcontractsRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error {
|
||||
return _Smartcontracts.Contract.SmartcontractsCaller.contract.Call(opts, result, method, params...)
|
||||
}
|
||||
|
||||
// Transfer initiates a plain transaction to move funds to the contract, calling
|
||||
// its default method if one is available.
|
||||
func (_Smartcontracts *SmartcontractsRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {
|
||||
return _Smartcontracts.Contract.SmartcontractsTransactor.contract.Transfer(opts)
|
||||
}
|
||||
|
||||
// Transact invokes the (paid) contract method with params as input values.
|
||||
func (_Smartcontracts *SmartcontractsRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {
|
||||
return _Smartcontracts.Contract.SmartcontractsTransactor.contract.Transact(opts, method, params...)
|
||||
}
|
||||
|
||||
// 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 (_Smartcontracts *SmartcontractsCallerRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error {
|
||||
return _Smartcontracts.Contract.contract.Call(opts, result, method, params...)
|
||||
}
|
||||
|
||||
// Transfer initiates a plain transaction to move funds to the contract, calling
|
||||
// its default method if one is available.
|
||||
func (_Smartcontracts *SmartcontractsTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {
|
||||
return _Smartcontracts.Contract.contract.Transfer(opts)
|
||||
}
|
||||
|
||||
// Transact invokes the (paid) contract method with params as input values.
|
||||
func (_Smartcontracts *SmartcontractsTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {
|
||||
return _Smartcontracts.Contract.contract.Transact(opts, method, params...)
|
||||
}
|
||||
|
||||
// RequestOracles is a paid mutator transaction binding the contract method 0xcae2f480.
|
||||
//
|
||||
// Solidity: function requestOracles(string requestType, address callbackAddress, bytes4 callbackMethodID) returns(uint256)
|
||||
func (_Smartcontracts *SmartcontractsTransactor) RequestOracles(opts *bind.TransactOpts, requestType string, callbackAddress common.Address, callbackMethodID [4]byte) (*types.Transaction, error) {
|
||||
return _Smartcontracts.contract.Transact(opts, "requestOracles", requestType, callbackAddress, callbackMethodID)
|
||||
}
|
||||
|
||||
// RequestOracles is a paid mutator transaction binding the contract method 0xcae2f480.
|
||||
//
|
||||
// Solidity: function requestOracles(string requestType, address callbackAddress, bytes4 callbackMethodID) returns(uint256)
|
||||
func (_Smartcontracts *SmartcontractsSession) RequestOracles(requestType string, callbackAddress common.Address, callbackMethodID [4]byte) (*types.Transaction, error) {
|
||||
return _Smartcontracts.Contract.RequestOracles(&_Smartcontracts.TransactOpts, requestType, callbackAddress, callbackMethodID)
|
||||
}
|
||||
|
||||
// RequestOracles is a paid mutator transaction binding the contract method 0xcae2f480.
|
||||
//
|
||||
// Solidity: function requestOracles(string requestType, address callbackAddress, bytes4 callbackMethodID) returns(uint256)
|
||||
func (_Smartcontracts *SmartcontractsTransactorSession) RequestOracles(requestType string, callbackAddress common.Address, callbackMethodID [4]byte) (*types.Transaction, error) {
|
||||
return _Smartcontracts.Contract.RequestOracles(&_Smartcontracts.TransactOpts, requestType, callbackAddress, callbackMethodID)
|
||||
}
|
||||
|
||||
// SmartcontractsNewOracleRequestIterator is returned from FilterNewOracleRequest and is used to iterate over the raw logs and unpacked data for NewOracleRequest events raised by the Smartcontracts contract.
|
||||
type SmartcontractsNewOracleRequestIterator struct {
|
||||
Event *SmartcontractsNewOracleRequest // Event containing the contract specifics and raw log
|
||||
|
||||
contract *bind.BoundContract // Generic contract to use for unpacking event data
|
||||
event string // Event name to use for unpacking event data
|
||||
|
||||
logs chan types.Log // Log channel receiving the found contract events
|
||||
sub ethereum.Subscription // Subscription for errors, completion and termination
|
||||
done bool // Whether the subscription completed delivering logs
|
||||
fail error // Occurred error to stop iteration
|
||||
}
|
||||
|
||||
// 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.
|
||||
func (it *SmartcontractsNewOracleRequestIterator) Next() bool {
|
||||
// If the iterator failed, stop iterating
|
||||
if it.fail != nil {
|
||||
return false
|
||||
}
|
||||
// If the iterator completed, deliver directly whatever's available
|
||||
if it.done {
|
||||
select {
|
||||
case log := <-it.logs:
|
||||
it.Event = new(SmartcontractsNewOracleRequest)
|
||||
if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil {
|
||||
it.fail = err
|
||||
return false
|
||||
}
|
||||
it.Event.Raw = log
|
||||
return true
|
||||
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
// Iterator still in progress, wait for either a data or an error event
|
||||
select {
|
||||
case log := <-it.logs:
|
||||
it.Event = new(SmartcontractsNewOracleRequest)
|
||||
if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil {
|
||||
it.fail = err
|
||||
return false
|
||||
}
|
||||
it.Event.Raw = log
|
||||
return true
|
||||
|
||||
case err := <-it.sub.Err():
|
||||
it.done = true
|
||||
it.fail = err
|
||||
return it.Next()
|
||||
}
|
||||
}
|
||||
|
||||
// Error returns any retrieval or parsing error occurred during filtering.
|
||||
func (it *SmartcontractsNewOracleRequestIterator) Error() error {
|
||||
return it.fail
|
||||
}
|
||||
|
||||
// Close terminates the iteration process, releasing any pending underlying
|
||||
// resources.
|
||||
func (it *SmartcontractsNewOracleRequestIterator) Close() error {
|
||||
it.sub.Unsubscribe()
|
||||
return nil
|
||||
}
|
||||
|
||||
// SmartcontractsNewOracleRequest represents a NewOracleRequest event raised by the Smartcontracts contract.
|
||||
type SmartcontractsNewOracleRequest struct {
|
||||
RequestType string
|
||||
CallbackAddress common.Address
|
||||
CallbackMethodID [4]byte
|
||||
RequestID *big.Int
|
||||
Raw types.Log // Blockchain specific contextual infos
|
||||
}
|
||||
|
||||
// FilterNewOracleRequest is a free log retrieval operation binding the contract event 0xc1a7df69ed0404441720a3eb710f322985ecbbe4f31934587bee703efe04427a.
|
||||
//
|
||||
// Solidity: event NewOracleRequest(string requestType, address callbackAddress, bytes4 callbackMethodID, uint256 requestID)
|
||||
func (_Smartcontracts *SmartcontractsFilterer) FilterNewOracleRequest(opts *bind.FilterOpts) (*SmartcontractsNewOracleRequestIterator, error) {
|
||||
|
||||
logs, sub, err := _Smartcontracts.contract.FilterLogs(opts, "NewOracleRequest")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &SmartcontractsNewOracleRequestIterator{contract: _Smartcontracts.contract, event: "NewOracleRequest", logs: logs, sub: sub}, nil
|
||||
}
|
||||
|
||||
// WatchNewOracleRequest is a free log subscription operation binding the contract event 0xc1a7df69ed0404441720a3eb710f322985ecbbe4f31934587bee703efe04427a.
|
||||
//
|
||||
// Solidity: event NewOracleRequest(string requestType, address callbackAddress, bytes4 callbackMethodID, uint256 requestID)
|
||||
func (_Smartcontracts *SmartcontractsFilterer) WatchNewOracleRequest(opts *bind.WatchOpts, sink chan<- *SmartcontractsNewOracleRequest) (event.Subscription, error) {
|
||||
|
||||
logs, sub, err := _Smartcontracts.contract.WatchLogs(opts, "NewOracleRequest")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return event.NewSubscription(func(quit <-chan struct{}) error {
|
||||
defer sub.Unsubscribe()
|
||||
for {
|
||||
select {
|
||||
case log := <-logs:
|
||||
// New log arrived, parse the event and forward to the user
|
||||
event := new(SmartcontractsNewOracleRequest)
|
||||
if err := _Smartcontracts.contract.UnpackLog(event, "NewOracleRequest", log); err != nil {
|
||||
return err
|
||||
}
|
||||
event.Raw = log
|
||||
|
||||
select {
|
||||
case sink <- event:
|
||||
case err := <-sub.Err():
|
||||
return err
|
||||
case <-quit:
|
||||
return nil
|
||||
}
|
||||
case err := <-sub.Err():
|
||||
return err
|
||||
case <-quit:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}), nil
|
||||
}
|
||||
|
||||
// ParseNewOracleRequest is a log parse operation binding the contract event 0xc1a7df69ed0404441720a3eb710f322985ecbbe4f31934587bee703efe04427a.
|
||||
//
|
||||
// Solidity: event NewOracleRequest(string requestType, address callbackAddress, bytes4 callbackMethodID, uint256 requestID)
|
||||
func (_Smartcontracts *SmartcontractsFilterer) ParseNewOracleRequest(log types.Log) (*SmartcontractsNewOracleRequest, error) {
|
||||
event := new(SmartcontractsNewOracleRequest)
|
||||
if err := _Smartcontracts.contract.UnpackLog(event, "NewOracleRequest", log); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return event, nil
|
||||
}
|
397
contracts/Ownable.go
Normal file
397
contracts/Ownable.go
Normal file
@ -0,0 +1,397 @@
|
||||
// Code generated - DO NOT EDIT.
|
||||
// This file is a generated binding and any manual changes will be lost.
|
||||
|
||||
package contracts
|
||||
|
||||
import (
|
||||
"math/big"
|
||||
"strings"
|
||||
|
||||
ethereum "github.com/ethereum/go-ethereum"
|
||||
"github.com/ethereum/go-ethereum/accounts/abi"
|
||||
"github.com/ethereum/go-ethereum/accounts/abi/bind"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/core/types"
|
||||
"github.com/ethereum/go-ethereum/event"
|
||||
)
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var (
|
||||
_ = big.NewInt
|
||||
_ = strings.NewReader
|
||||
_ = ethereum.NotFound
|
||||
_ = bind.Bind
|
||||
_ = common.Big1
|
||||
_ = types.BloomLookup
|
||||
_ = event.NewSubscription
|
||||
)
|
||||
|
||||
// SmartcontractsABI is the input ABI used to generate the binding from.
|
||||
const SmartcontractsABI = "[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"isOwner\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]"
|
||||
|
||||
// Smartcontracts is an auto generated Go binding around an Ethereum contract.
|
||||
type Smartcontracts struct {
|
||||
SmartcontractsCaller // Read-only binding to the contract
|
||||
SmartcontractsTransactor // Write-only binding to the contract
|
||||
SmartcontractsFilterer // Log filterer for contract events
|
||||
}
|
||||
|
||||
// SmartcontractsCaller is an auto generated read-only Go binding around an Ethereum contract.
|
||||
type SmartcontractsCaller struct {
|
||||
contract *bind.BoundContract // Generic contract wrapper for the low level calls
|
||||
}
|
||||
|
||||
// SmartcontractsTransactor is an auto generated write-only Go binding around an Ethereum contract.
|
||||
type SmartcontractsTransactor struct {
|
||||
contract *bind.BoundContract // Generic contract wrapper for the low level calls
|
||||
}
|
||||
|
||||
// SmartcontractsFilterer is an auto generated log filtering Go binding around an Ethereum contract events.
|
||||
type SmartcontractsFilterer struct {
|
||||
contract *bind.BoundContract // Generic contract wrapper for the low level calls
|
||||
}
|
||||
|
||||
// SmartcontractsSession is an auto generated Go binding around an Ethereum contract,
|
||||
// with pre-set call and transact options.
|
||||
type SmartcontractsSession struct {
|
||||
Contract *Smartcontracts // 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
|
||||
}
|
||||
|
||||
// SmartcontractsCallerSession is an auto generated read-only Go binding around an Ethereum contract,
|
||||
// with pre-set call options.
|
||||
type SmartcontractsCallerSession struct {
|
||||
Contract *SmartcontractsCaller // Generic contract caller binding to set the session for
|
||||
CallOpts bind.CallOpts // Call options to use throughout this session
|
||||
}
|
||||
|
||||
// SmartcontractsTransactorSession is an auto generated write-only Go binding around an Ethereum contract,
|
||||
// with pre-set transact options.
|
||||
type SmartcontractsTransactorSession struct {
|
||||
Contract *SmartcontractsTransactor // Generic contract transactor binding to set the session for
|
||||
TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session
|
||||
}
|
||||
|
||||
// SmartcontractsRaw is an auto generated low-level Go binding around an Ethereum contract.
|
||||
type SmartcontractsRaw struct {
|
||||
Contract *Smartcontracts // Generic contract binding to access the raw methods on
|
||||
}
|
||||
|
||||
// SmartcontractsCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract.
|
||||
type SmartcontractsCallerRaw struct {
|
||||
Contract *SmartcontractsCaller // Generic read-only contract binding to access the raw methods on
|
||||
}
|
||||
|
||||
// SmartcontractsTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract.
|
||||
type SmartcontractsTransactorRaw struct {
|
||||
Contract *SmartcontractsTransactor // Generic write-only contract binding to access the raw methods on
|
||||
}
|
||||
|
||||
// NewSmartcontracts creates a new instance of Smartcontracts, bound to a specific deployed contract.
|
||||
func NewSmartcontracts(address common.Address, backend bind.ContractBackend) (*Smartcontracts, error) {
|
||||
contract, err := bindSmartcontracts(address, backend, backend, backend)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &Smartcontracts{SmartcontractsCaller: SmartcontractsCaller{contract: contract}, SmartcontractsTransactor: SmartcontractsTransactor{contract: contract}, SmartcontractsFilterer: SmartcontractsFilterer{contract: contract}}, nil
|
||||
}
|
||||
|
||||
// NewSmartcontractsCaller creates a new read-only instance of Smartcontracts, bound to a specific deployed contract.
|
||||
func NewSmartcontractsCaller(address common.Address, caller bind.ContractCaller) (*SmartcontractsCaller, error) {
|
||||
contract, err := bindSmartcontracts(address, caller, nil, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &SmartcontractsCaller{contract: contract}, nil
|
||||
}
|
||||
|
||||
// NewSmartcontractsTransactor creates a new write-only instance of Smartcontracts, bound to a specific deployed contract.
|
||||
func NewSmartcontractsTransactor(address common.Address, transactor bind.ContractTransactor) (*SmartcontractsTransactor, error) {
|
||||
contract, err := bindSmartcontracts(address, nil, transactor, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &SmartcontractsTransactor{contract: contract}, nil
|
||||
}
|
||||
|
||||
// NewSmartcontractsFilterer creates a new log filterer instance of Smartcontracts, bound to a specific deployed contract.
|
||||
func NewSmartcontractsFilterer(address common.Address, filterer bind.ContractFilterer) (*SmartcontractsFilterer, error) {
|
||||
contract, err := bindSmartcontracts(address, nil, nil, filterer)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &SmartcontractsFilterer{contract: contract}, nil
|
||||
}
|
||||
|
||||
// bindSmartcontracts binds a generic wrapper to an already deployed contract.
|
||||
func bindSmartcontracts(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) {
|
||||
parsed, err := abi.JSON(strings.NewReader(SmartcontractsABI))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil
|
||||
}
|
||||
|
||||
// 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 (_Smartcontracts *SmartcontractsRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error {
|
||||
return _Smartcontracts.Contract.SmartcontractsCaller.contract.Call(opts, result, method, params...)
|
||||
}
|
||||
|
||||
// Transfer initiates a plain transaction to move funds to the contract, calling
|
||||
// its default method if one is available.
|
||||
func (_Smartcontracts *SmartcontractsRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {
|
||||
return _Smartcontracts.Contract.SmartcontractsTransactor.contract.Transfer(opts)
|
||||
}
|
||||
|
||||
// Transact invokes the (paid) contract method with params as input values.
|
||||
func (_Smartcontracts *SmartcontractsRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {
|
||||
return _Smartcontracts.Contract.SmartcontractsTransactor.contract.Transact(opts, method, params...)
|
||||
}
|
||||
|
||||
// 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 (_Smartcontracts *SmartcontractsCallerRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error {
|
||||
return _Smartcontracts.Contract.contract.Call(opts, result, method, params...)
|
||||
}
|
||||
|
||||
// Transfer initiates a plain transaction to move funds to the contract, calling
|
||||
// its default method if one is available.
|
||||
func (_Smartcontracts *SmartcontractsTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {
|
||||
return _Smartcontracts.Contract.contract.Transfer(opts)
|
||||
}
|
||||
|
||||
// Transact invokes the (paid) contract method with params as input values.
|
||||
func (_Smartcontracts *SmartcontractsTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {
|
||||
return _Smartcontracts.Contract.contract.Transact(opts, method, params...)
|
||||
}
|
||||
|
||||
// IsOwner is a free data retrieval call binding the contract method 0x8f32d59b.
|
||||
//
|
||||
// Solidity: function isOwner() view returns(bool)
|
||||
func (_Smartcontracts *SmartcontractsCaller) IsOwner(opts *bind.CallOpts) (bool, error) {
|
||||
var (
|
||||
ret0 = new(bool)
|
||||
)
|
||||
out := ret0
|
||||
err := _Smartcontracts.contract.Call(opts, out, "isOwner")
|
||||
return *ret0, err
|
||||
}
|
||||
|
||||
// IsOwner is a free data retrieval call binding the contract method 0x8f32d59b.
|
||||
//
|
||||
// Solidity: function isOwner() view returns(bool)
|
||||
func (_Smartcontracts *SmartcontractsSession) IsOwner() (bool, error) {
|
||||
return _Smartcontracts.Contract.IsOwner(&_Smartcontracts.CallOpts)
|
||||
}
|
||||
|
||||
// IsOwner is a free data retrieval call binding the contract method 0x8f32d59b.
|
||||
//
|
||||
// Solidity: function isOwner() view returns(bool)
|
||||
func (_Smartcontracts *SmartcontractsCallerSession) IsOwner() (bool, error) {
|
||||
return _Smartcontracts.Contract.IsOwner(&_Smartcontracts.CallOpts)
|
||||
}
|
||||
|
||||
// Owner is a free data retrieval call binding the contract method 0x8da5cb5b.
|
||||
//
|
||||
// Solidity: function owner() view returns(address)
|
||||
func (_Smartcontracts *SmartcontractsCaller) Owner(opts *bind.CallOpts) (common.Address, error) {
|
||||
var (
|
||||
ret0 = new(common.Address)
|
||||
)
|
||||
out := ret0
|
||||
err := _Smartcontracts.contract.Call(opts, out, "owner")
|
||||
return *ret0, err
|
||||
}
|
||||
|
||||
// Owner is a free data retrieval call binding the contract method 0x8da5cb5b.
|
||||
//
|
||||
// Solidity: function owner() view returns(address)
|
||||
func (_Smartcontracts *SmartcontractsSession) Owner() (common.Address, error) {
|
||||
return _Smartcontracts.Contract.Owner(&_Smartcontracts.CallOpts)
|
||||
}
|
||||
|
||||
// Owner is a free data retrieval call binding the contract method 0x8da5cb5b.
|
||||
//
|
||||
// Solidity: function owner() view returns(address)
|
||||
func (_Smartcontracts *SmartcontractsCallerSession) Owner() (common.Address, error) {
|
||||
return _Smartcontracts.Contract.Owner(&_Smartcontracts.CallOpts)
|
||||
}
|
||||
|
||||
// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b.
|
||||
//
|
||||
// Solidity: function transferOwnership(address newOwner) returns()
|
||||
func (_Smartcontracts *SmartcontractsTransactor) TransferOwnership(opts *bind.TransactOpts, newOwner common.Address) (*types.Transaction, error) {
|
||||
return _Smartcontracts.contract.Transact(opts, "transferOwnership", newOwner)
|
||||
}
|
||||
|
||||
// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b.
|
||||
//
|
||||
// Solidity: function transferOwnership(address newOwner) returns()
|
||||
func (_Smartcontracts *SmartcontractsSession) TransferOwnership(newOwner common.Address) (*types.Transaction, error) {
|
||||
return _Smartcontracts.Contract.TransferOwnership(&_Smartcontracts.TransactOpts, newOwner)
|
||||
}
|
||||
|
||||
// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b.
|
||||
//
|
||||
// Solidity: function transferOwnership(address newOwner) returns()
|
||||
func (_Smartcontracts *SmartcontractsTransactorSession) TransferOwnership(newOwner common.Address) (*types.Transaction, error) {
|
||||
return _Smartcontracts.Contract.TransferOwnership(&_Smartcontracts.TransactOpts, newOwner)
|
||||
}
|
||||
|
||||
// SmartcontractsOwnershipTransferredIterator is returned from FilterOwnershipTransferred and is used to iterate over the raw logs and unpacked data for OwnershipTransferred events raised by the Smartcontracts contract.
|
||||
type SmartcontractsOwnershipTransferredIterator struct {
|
||||
Event *SmartcontractsOwnershipTransferred // Event containing the contract specifics and raw log
|
||||
|
||||
contract *bind.BoundContract // Generic contract to use for unpacking event data
|
||||
event string // Event name to use for unpacking event data
|
||||
|
||||
logs chan types.Log // Log channel receiving the found contract events
|
||||
sub ethereum.Subscription // Subscription for errors, completion and termination
|
||||
done bool // Whether the subscription completed delivering logs
|
||||
fail error // Occurred error to stop iteration
|
||||
}
|
||||
|
||||
// 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.
|
||||
func (it *SmartcontractsOwnershipTransferredIterator) Next() bool {
|
||||
// If the iterator failed, stop iterating
|
||||
if it.fail != nil {
|
||||
return false
|
||||
}
|
||||
// If the iterator completed, deliver directly whatever's available
|
||||
if it.done {
|
||||
select {
|
||||
case log := <-it.logs:
|
||||
it.Event = new(SmartcontractsOwnershipTransferred)
|
||||
if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil {
|
||||
it.fail = err
|
||||
return false
|
||||
}
|
||||
it.Event.Raw = log
|
||||
return true
|
||||
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
// Iterator still in progress, wait for either a data or an error event
|
||||
select {
|
||||
case log := <-it.logs:
|
||||
it.Event = new(SmartcontractsOwnershipTransferred)
|
||||
if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil {
|
||||
it.fail = err
|
||||
return false
|
||||
}
|
||||
it.Event.Raw = log
|
||||
return true
|
||||
|
||||
case err := <-it.sub.Err():
|
||||
it.done = true
|
||||
it.fail = err
|
||||
return it.Next()
|
||||
}
|
||||
}
|
||||
|
||||
// Error returns any retrieval or parsing error occurred during filtering.
|
||||
func (it *SmartcontractsOwnershipTransferredIterator) Error() error {
|
||||
return it.fail
|
||||
}
|
||||
|
||||
// Close terminates the iteration process, releasing any pending underlying
|
||||
// resources.
|
||||
func (it *SmartcontractsOwnershipTransferredIterator) Close() error {
|
||||
it.sub.Unsubscribe()
|
||||
return nil
|
||||
}
|
||||
|
||||
// SmartcontractsOwnershipTransferred represents a OwnershipTransferred event raised by the Smartcontracts contract.
|
||||
type SmartcontractsOwnershipTransferred struct {
|
||||
PreviousOwner common.Address
|
||||
NewOwner common.Address
|
||||
Raw types.Log // Blockchain specific contextual infos
|
||||
}
|
||||
|
||||
// FilterOwnershipTransferred is a free log retrieval operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0.
|
||||
//
|
||||
// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner)
|
||||
func (_Smartcontracts *SmartcontractsFilterer) FilterOwnershipTransferred(opts *bind.FilterOpts, previousOwner []common.Address, newOwner []common.Address) (*SmartcontractsOwnershipTransferredIterator, error) {
|
||||
|
||||
var previousOwnerRule []interface{}
|
||||
for _, previousOwnerItem := range previousOwner {
|
||||
previousOwnerRule = append(previousOwnerRule, previousOwnerItem)
|
||||
}
|
||||
var newOwnerRule []interface{}
|
||||
for _, newOwnerItem := range newOwner {
|
||||
newOwnerRule = append(newOwnerRule, newOwnerItem)
|
||||
}
|
||||
|
||||
logs, sub, err := _Smartcontracts.contract.FilterLogs(opts, "OwnershipTransferred", previousOwnerRule, newOwnerRule)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &SmartcontractsOwnershipTransferredIterator{contract: _Smartcontracts.contract, event: "OwnershipTransferred", logs: logs, sub: sub}, nil
|
||||
}
|
||||
|
||||
// WatchOwnershipTransferred is a free log subscription operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0.
|
||||
//
|
||||
// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner)
|
||||
func (_Smartcontracts *SmartcontractsFilterer) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *SmartcontractsOwnershipTransferred, previousOwner []common.Address, newOwner []common.Address) (event.Subscription, error) {
|
||||
|
||||
var previousOwnerRule []interface{}
|
||||
for _, previousOwnerItem := range previousOwner {
|
||||
previousOwnerRule = append(previousOwnerRule, previousOwnerItem)
|
||||
}
|
||||
var newOwnerRule []interface{}
|
||||
for _, newOwnerItem := range newOwner {
|
||||
newOwnerRule = append(newOwnerRule, newOwnerItem)
|
||||
}
|
||||
|
||||
logs, sub, err := _Smartcontracts.contract.WatchLogs(opts, "OwnershipTransferred", previousOwnerRule, newOwnerRule)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return event.NewSubscription(func(quit <-chan struct{}) error {
|
||||
defer sub.Unsubscribe()
|
||||
for {
|
||||
select {
|
||||
case log := <-logs:
|
||||
// New log arrived, parse the event and forward to the user
|
||||
event := new(SmartcontractsOwnershipTransferred)
|
||||
if err := _Smartcontracts.contract.UnpackLog(event, "OwnershipTransferred", log); err != nil {
|
||||
return err
|
||||
}
|
||||
event.Raw = log
|
||||
|
||||
select {
|
||||
case sink <- event:
|
||||
case err := <-sub.Err():
|
||||
return err
|
||||
case <-quit:
|
||||
return nil
|
||||
}
|
||||
case err := <-sub.Err():
|
||||
return err
|
||||
case <-quit:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}), nil
|
||||
}
|
||||
|
||||
// ParseOwnershipTransferred is a log parse operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0.
|
||||
//
|
||||
// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner)
|
||||
func (_Smartcontracts *SmartcontractsFilterer) ParseOwnershipTransferred(log types.Log) (*SmartcontractsOwnershipTransferred, error) {
|
||||
event := new(SmartcontractsOwnershipTransferred)
|
||||
if err := _Smartcontracts.contract.UnpackLog(event, "OwnershipTransferred", log); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return event, nil
|
||||
}
|
491
contracts/Whitelist.go
Normal file
491
contracts/Whitelist.go
Normal file
@ -0,0 +1,491 @@
|
||||
// Code generated - DO NOT EDIT.
|
||||
// This file is a generated binding and any manual changes will be lost.
|
||||
|
||||
package contracts
|
||||
|
||||
import (
|
||||
"math/big"
|
||||
"strings"
|
||||
|
||||
ethereum "github.com/ethereum/go-ethereum"
|
||||
"github.com/ethereum/go-ethereum/accounts/abi"
|
||||
"github.com/ethereum/go-ethereum/accounts/abi/bind"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/core/types"
|
||||
"github.com/ethereum/go-ethereum/event"
|
||||
)
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var (
|
||||
_ = big.NewInt
|
||||
_ = strings.NewReader
|
||||
_ = ethereum.NotFound
|
||||
_ = bind.Bind
|
||||
_ = common.Big1
|
||||
_ = types.BloomLookup
|
||||
_ = event.NewSubscription
|
||||
)
|
||||
|
||||
// SmartcontractsABI is the input ABI used to generate the binding from.
|
||||
const SmartcontractsABI = "[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"nodeAccount\",\"type\":\"address\"}],\"name\":\"addNode\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getNodes\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"isOwner\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"nodes\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"nodeAccount\",\"type\":\"address\"}],\"name\":\"removeNode\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]"
|
||||
|
||||
// Smartcontracts is an auto generated Go binding around an Ethereum contract.
|
||||
type Smartcontracts struct {
|
||||
SmartcontractsCaller // Read-only binding to the contract
|
||||
SmartcontractsTransactor // Write-only binding to the contract
|
||||
SmartcontractsFilterer // Log filterer for contract events
|
||||
}
|
||||
|
||||
// SmartcontractsCaller is an auto generated read-only Go binding around an Ethereum contract.
|
||||
type SmartcontractsCaller struct {
|
||||
contract *bind.BoundContract // Generic contract wrapper for the low level calls
|
||||
}
|
||||
|
||||
// SmartcontractsTransactor is an auto generated write-only Go binding around an Ethereum contract.
|
||||
type SmartcontractsTransactor struct {
|
||||
contract *bind.BoundContract // Generic contract wrapper for the low level calls
|
||||
}
|
||||
|
||||
// SmartcontractsFilterer is an auto generated log filtering Go binding around an Ethereum contract events.
|
||||
type SmartcontractsFilterer struct {
|
||||
contract *bind.BoundContract // Generic contract wrapper for the low level calls
|
||||
}
|
||||
|
||||
// SmartcontractsSession is an auto generated Go binding around an Ethereum contract,
|
||||
// with pre-set call and transact options.
|
||||
type SmartcontractsSession struct {
|
||||
Contract *Smartcontracts // 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
|
||||
}
|
||||
|
||||
// SmartcontractsCallerSession is an auto generated read-only Go binding around an Ethereum contract,
|
||||
// with pre-set call options.
|
||||
type SmartcontractsCallerSession struct {
|
||||
Contract *SmartcontractsCaller // Generic contract caller binding to set the session for
|
||||
CallOpts bind.CallOpts // Call options to use throughout this session
|
||||
}
|
||||
|
||||
// SmartcontractsTransactorSession is an auto generated write-only Go binding around an Ethereum contract,
|
||||
// with pre-set transact options.
|
||||
type SmartcontractsTransactorSession struct {
|
||||
Contract *SmartcontractsTransactor // Generic contract transactor binding to set the session for
|
||||
TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session
|
||||
}
|
||||
|
||||
// SmartcontractsRaw is an auto generated low-level Go binding around an Ethereum contract.
|
||||
type SmartcontractsRaw struct {
|
||||
Contract *Smartcontracts // Generic contract binding to access the raw methods on
|
||||
}
|
||||
|
||||
// SmartcontractsCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract.
|
||||
type SmartcontractsCallerRaw struct {
|
||||
Contract *SmartcontractsCaller // Generic read-only contract binding to access the raw methods on
|
||||
}
|
||||
|
||||
// SmartcontractsTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract.
|
||||
type SmartcontractsTransactorRaw struct {
|
||||
Contract *SmartcontractsTransactor // Generic write-only contract binding to access the raw methods on
|
||||
}
|
||||
|
||||
// NewSmartcontracts creates a new instance of Smartcontracts, bound to a specific deployed contract.
|
||||
func NewSmartcontracts(address common.Address, backend bind.ContractBackend) (*Smartcontracts, error) {
|
||||
contract, err := bindSmartcontracts(address, backend, backend, backend)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &Smartcontracts{SmartcontractsCaller: SmartcontractsCaller{contract: contract}, SmartcontractsTransactor: SmartcontractsTransactor{contract: contract}, SmartcontractsFilterer: SmartcontractsFilterer{contract: contract}}, nil
|
||||
}
|
||||
|
||||
// NewSmartcontractsCaller creates a new read-only instance of Smartcontracts, bound to a specific deployed contract.
|
||||
func NewSmartcontractsCaller(address common.Address, caller bind.ContractCaller) (*SmartcontractsCaller, error) {
|
||||
contract, err := bindSmartcontracts(address, caller, nil, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &SmartcontractsCaller{contract: contract}, nil
|
||||
}
|
||||
|
||||
// NewSmartcontractsTransactor creates a new write-only instance of Smartcontracts, bound to a specific deployed contract.
|
||||
func NewSmartcontractsTransactor(address common.Address, transactor bind.ContractTransactor) (*SmartcontractsTransactor, error) {
|
||||
contract, err := bindSmartcontracts(address, nil, transactor, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &SmartcontractsTransactor{contract: contract}, nil
|
||||
}
|
||||
|
||||
// NewSmartcontractsFilterer creates a new log filterer instance of Smartcontracts, bound to a specific deployed contract.
|
||||
func NewSmartcontractsFilterer(address common.Address, filterer bind.ContractFilterer) (*SmartcontractsFilterer, error) {
|
||||
contract, err := bindSmartcontracts(address, nil, nil, filterer)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &SmartcontractsFilterer{contract: contract}, nil
|
||||
}
|
||||
|
||||
// bindSmartcontracts binds a generic wrapper to an already deployed contract.
|
||||
func bindSmartcontracts(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) {
|
||||
parsed, err := abi.JSON(strings.NewReader(SmartcontractsABI))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil
|
||||
}
|
||||
|
||||
// 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 (_Smartcontracts *SmartcontractsRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error {
|
||||
return _Smartcontracts.Contract.SmartcontractsCaller.contract.Call(opts, result, method, params...)
|
||||
}
|
||||
|
||||
// Transfer initiates a plain transaction to move funds to the contract, calling
|
||||
// its default method if one is available.
|
||||
func (_Smartcontracts *SmartcontractsRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {
|
||||
return _Smartcontracts.Contract.SmartcontractsTransactor.contract.Transfer(opts)
|
||||
}
|
||||
|
||||
// Transact invokes the (paid) contract method with params as input values.
|
||||
func (_Smartcontracts *SmartcontractsRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {
|
||||
return _Smartcontracts.Contract.SmartcontractsTransactor.contract.Transact(opts, method, params...)
|
||||
}
|
||||
|
||||
// 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 (_Smartcontracts *SmartcontractsCallerRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error {
|
||||
return _Smartcontracts.Contract.contract.Call(opts, result, method, params...)
|
||||
}
|
||||
|
||||
// Transfer initiates a plain transaction to move funds to the contract, calling
|
||||
// its default method if one is available.
|
||||
func (_Smartcontracts *SmartcontractsTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {
|
||||
return _Smartcontracts.Contract.contract.Transfer(opts)
|
||||
}
|
||||
|
||||
// Transact invokes the (paid) contract method with params as input values.
|
||||
func (_Smartcontracts *SmartcontractsTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {
|
||||
return _Smartcontracts.Contract.contract.Transact(opts, method, params...)
|
||||
}
|
||||
|
||||
// GetNodes is a free data retrieval call binding the contract method 0xe29581aa.
|
||||
//
|
||||
// Solidity: function getNodes() view returns(address[])
|
||||
func (_Smartcontracts *SmartcontractsCaller) GetNodes(opts *bind.CallOpts) ([]common.Address, error) {
|
||||
var (
|
||||
ret0 = new([]common.Address)
|
||||
)
|
||||
out := ret0
|
||||
err := _Smartcontracts.contract.Call(opts, out, "getNodes")
|
||||
return *ret0, err
|
||||
}
|
||||
|
||||
// GetNodes is a free data retrieval call binding the contract method 0xe29581aa.
|
||||
//
|
||||
// Solidity: function getNodes() view returns(address[])
|
||||
func (_Smartcontracts *SmartcontractsSession) GetNodes() ([]common.Address, error) {
|
||||
return _Smartcontracts.Contract.GetNodes(&_Smartcontracts.CallOpts)
|
||||
}
|
||||
|
||||
// GetNodes is a free data retrieval call binding the contract method 0xe29581aa.
|
||||
//
|
||||
// Solidity: function getNodes() view returns(address[])
|
||||
func (_Smartcontracts *SmartcontractsCallerSession) GetNodes() ([]common.Address, error) {
|
||||
return _Smartcontracts.Contract.GetNodes(&_Smartcontracts.CallOpts)
|
||||
}
|
||||
|
||||
// IsOwner is a free data retrieval call binding the contract method 0x8f32d59b.
|
||||
//
|
||||
// Solidity: function isOwner() view returns(bool)
|
||||
func (_Smartcontracts *SmartcontractsCaller) IsOwner(opts *bind.CallOpts) (bool, error) {
|
||||
var (
|
||||
ret0 = new(bool)
|
||||
)
|
||||
out := ret0
|
||||
err := _Smartcontracts.contract.Call(opts, out, "isOwner")
|
||||
return *ret0, err
|
||||
}
|
||||
|
||||
// IsOwner is a free data retrieval call binding the contract method 0x8f32d59b.
|
||||
//
|
||||
// Solidity: function isOwner() view returns(bool)
|
||||
func (_Smartcontracts *SmartcontractsSession) IsOwner() (bool, error) {
|
||||
return _Smartcontracts.Contract.IsOwner(&_Smartcontracts.CallOpts)
|
||||
}
|
||||
|
||||
// IsOwner is a free data retrieval call binding the contract method 0x8f32d59b.
|
||||
//
|
||||
// Solidity: function isOwner() view returns(bool)
|
||||
func (_Smartcontracts *SmartcontractsCallerSession) IsOwner() (bool, error) {
|
||||
return _Smartcontracts.Contract.IsOwner(&_Smartcontracts.CallOpts)
|
||||
}
|
||||
|
||||
// Nodes is a free data retrieval call binding the contract method 0x1c53c280.
|
||||
//
|
||||
// Solidity: function nodes(uint256 ) view returns(address)
|
||||
func (_Smartcontracts *SmartcontractsCaller) Nodes(opts *bind.CallOpts, arg0 *big.Int) (common.Address, error) {
|
||||
var (
|
||||
ret0 = new(common.Address)
|
||||
)
|
||||
out := ret0
|
||||
err := _Smartcontracts.contract.Call(opts, out, "nodes", arg0)
|
||||
return *ret0, err
|
||||
}
|
||||
|
||||
// Nodes is a free data retrieval call binding the contract method 0x1c53c280.
|
||||
//
|
||||
// Solidity: function nodes(uint256 ) view returns(address)
|
||||
func (_Smartcontracts *SmartcontractsSession) Nodes(arg0 *big.Int) (common.Address, error) {
|
||||
return _Smartcontracts.Contract.Nodes(&_Smartcontracts.CallOpts, arg0)
|
||||
}
|
||||
|
||||
// Nodes is a free data retrieval call binding the contract method 0x1c53c280.
|
||||
//
|
||||
// Solidity: function nodes(uint256 ) view returns(address)
|
||||
func (_Smartcontracts *SmartcontractsCallerSession) Nodes(arg0 *big.Int) (common.Address, error) {
|
||||
return _Smartcontracts.Contract.Nodes(&_Smartcontracts.CallOpts, arg0)
|
||||
}
|
||||
|
||||
// Owner is a free data retrieval call binding the contract method 0x8da5cb5b.
|
||||
//
|
||||
// Solidity: function owner() view returns(address)
|
||||
func (_Smartcontracts *SmartcontractsCaller) Owner(opts *bind.CallOpts) (common.Address, error) {
|
||||
var (
|
||||
ret0 = new(common.Address)
|
||||
)
|
||||
out := ret0
|
||||
err := _Smartcontracts.contract.Call(opts, out, "owner")
|
||||
return *ret0, err
|
||||
}
|
||||
|
||||
// Owner is a free data retrieval call binding the contract method 0x8da5cb5b.
|
||||
//
|
||||
// Solidity: function owner() view returns(address)
|
||||
func (_Smartcontracts *SmartcontractsSession) Owner() (common.Address, error) {
|
||||
return _Smartcontracts.Contract.Owner(&_Smartcontracts.CallOpts)
|
||||
}
|
||||
|
||||
// Owner is a free data retrieval call binding the contract method 0x8da5cb5b.
|
||||
//
|
||||
// Solidity: function owner() view returns(address)
|
||||
func (_Smartcontracts *SmartcontractsCallerSession) Owner() (common.Address, error) {
|
||||
return _Smartcontracts.Contract.Owner(&_Smartcontracts.CallOpts)
|
||||
}
|
||||
|
||||
// AddNode is a paid mutator transaction binding the contract method 0x9d95f1cc.
|
||||
//
|
||||
// Solidity: function addNode(address nodeAccount) returns()
|
||||
func (_Smartcontracts *SmartcontractsTransactor) AddNode(opts *bind.TransactOpts, nodeAccount common.Address) (*types.Transaction, error) {
|
||||
return _Smartcontracts.contract.Transact(opts, "addNode", nodeAccount)
|
||||
}
|
||||
|
||||
// AddNode is a paid mutator transaction binding the contract method 0x9d95f1cc.
|
||||
//
|
||||
// Solidity: function addNode(address nodeAccount) returns()
|
||||
func (_Smartcontracts *SmartcontractsSession) AddNode(nodeAccount common.Address) (*types.Transaction, error) {
|
||||
return _Smartcontracts.Contract.AddNode(&_Smartcontracts.TransactOpts, nodeAccount)
|
||||
}
|
||||
|
||||
// AddNode is a paid mutator transaction binding the contract method 0x9d95f1cc.
|
||||
//
|
||||
// Solidity: function addNode(address nodeAccount) returns()
|
||||
func (_Smartcontracts *SmartcontractsTransactorSession) AddNode(nodeAccount common.Address) (*types.Transaction, error) {
|
||||
return _Smartcontracts.Contract.AddNode(&_Smartcontracts.TransactOpts, nodeAccount)
|
||||
}
|
||||
|
||||
// RemoveNode is a paid mutator transaction binding the contract method 0xb2b99ec9.
|
||||
//
|
||||
// Solidity: function removeNode(address nodeAccount) returns()
|
||||
func (_Smartcontracts *SmartcontractsTransactor) RemoveNode(opts *bind.TransactOpts, nodeAccount common.Address) (*types.Transaction, error) {
|
||||
return _Smartcontracts.contract.Transact(opts, "removeNode", nodeAccount)
|
||||
}
|
||||
|
||||
// RemoveNode is a paid mutator transaction binding the contract method 0xb2b99ec9.
|
||||
//
|
||||
// Solidity: function removeNode(address nodeAccount) returns()
|
||||
func (_Smartcontracts *SmartcontractsSession) RemoveNode(nodeAccount common.Address) (*types.Transaction, error) {
|
||||
return _Smartcontracts.Contract.RemoveNode(&_Smartcontracts.TransactOpts, nodeAccount)
|
||||
}
|
||||
|
||||
// RemoveNode is a paid mutator transaction binding the contract method 0xb2b99ec9.
|
||||
//
|
||||
// Solidity: function removeNode(address nodeAccount) returns()
|
||||
func (_Smartcontracts *SmartcontractsTransactorSession) RemoveNode(nodeAccount common.Address) (*types.Transaction, error) {
|
||||
return _Smartcontracts.Contract.RemoveNode(&_Smartcontracts.TransactOpts, nodeAccount)
|
||||
}
|
||||
|
||||
// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b.
|
||||
//
|
||||
// Solidity: function transferOwnership(address newOwner) returns()
|
||||
func (_Smartcontracts *SmartcontractsTransactor) TransferOwnership(opts *bind.TransactOpts, newOwner common.Address) (*types.Transaction, error) {
|
||||
return _Smartcontracts.contract.Transact(opts, "transferOwnership", newOwner)
|
||||
}
|
||||
|
||||
// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b.
|
||||
//
|
||||
// Solidity: function transferOwnership(address newOwner) returns()
|
||||
func (_Smartcontracts *SmartcontractsSession) TransferOwnership(newOwner common.Address) (*types.Transaction, error) {
|
||||
return _Smartcontracts.Contract.TransferOwnership(&_Smartcontracts.TransactOpts, newOwner)
|
||||
}
|
||||
|
||||
// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b.
|
||||
//
|
||||
// Solidity: function transferOwnership(address newOwner) returns()
|
||||
func (_Smartcontracts *SmartcontractsTransactorSession) TransferOwnership(newOwner common.Address) (*types.Transaction, error) {
|
||||
return _Smartcontracts.Contract.TransferOwnership(&_Smartcontracts.TransactOpts, newOwner)
|
||||
}
|
||||
|
||||
// SmartcontractsOwnershipTransferredIterator is returned from FilterOwnershipTransferred and is used to iterate over the raw logs and unpacked data for OwnershipTransferred events raised by the Smartcontracts contract.
|
||||
type SmartcontractsOwnershipTransferredIterator struct {
|
||||
Event *SmartcontractsOwnershipTransferred // Event containing the contract specifics and raw log
|
||||
|
||||
contract *bind.BoundContract // Generic contract to use for unpacking event data
|
||||
event string // Event name to use for unpacking event data
|
||||
|
||||
logs chan types.Log // Log channel receiving the found contract events
|
||||
sub ethereum.Subscription // Subscription for errors, completion and termination
|
||||
done bool // Whether the subscription completed delivering logs
|
||||
fail error // Occurred error to stop iteration
|
||||
}
|
||||
|
||||
// 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.
|
||||
func (it *SmartcontractsOwnershipTransferredIterator) Next() bool {
|
||||
// If the iterator failed, stop iterating
|
||||
if it.fail != nil {
|
||||
return false
|
||||
}
|
||||
// If the iterator completed, deliver directly whatever's available
|
||||
if it.done {
|
||||
select {
|
||||
case log := <-it.logs:
|
||||
it.Event = new(SmartcontractsOwnershipTransferred)
|
||||
if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil {
|
||||
it.fail = err
|
||||
return false
|
||||
}
|
||||
it.Event.Raw = log
|
||||
return true
|
||||
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
// Iterator still in progress, wait for either a data or an error event
|
||||
select {
|
||||
case log := <-it.logs:
|
||||
it.Event = new(SmartcontractsOwnershipTransferred)
|
||||
if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil {
|
||||
it.fail = err
|
||||
return false
|
||||
}
|
||||
it.Event.Raw = log
|
||||
return true
|
||||
|
||||
case err := <-it.sub.Err():
|
||||
it.done = true
|
||||
it.fail = err
|
||||
return it.Next()
|
||||
}
|
||||
}
|
||||
|
||||
// Error returns any retrieval or parsing error occurred during filtering.
|
||||
func (it *SmartcontractsOwnershipTransferredIterator) Error() error {
|
||||
return it.fail
|
||||
}
|
||||
|
||||
// Close terminates the iteration process, releasing any pending underlying
|
||||
// resources.
|
||||
func (it *SmartcontractsOwnershipTransferredIterator) Close() error {
|
||||
it.sub.Unsubscribe()
|
||||
return nil
|
||||
}
|
||||
|
||||
// SmartcontractsOwnershipTransferred represents a OwnershipTransferred event raised by the Smartcontracts contract.
|
||||
type SmartcontractsOwnershipTransferred struct {
|
||||
PreviousOwner common.Address
|
||||
NewOwner common.Address
|
||||
Raw types.Log // Blockchain specific contextual infos
|
||||
}
|
||||
|
||||
// FilterOwnershipTransferred is a free log retrieval operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0.
|
||||
//
|
||||
// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner)
|
||||
func (_Smartcontracts *SmartcontractsFilterer) FilterOwnershipTransferred(opts *bind.FilterOpts, previousOwner []common.Address, newOwner []common.Address) (*SmartcontractsOwnershipTransferredIterator, error) {
|
||||
|
||||
var previousOwnerRule []interface{}
|
||||
for _, previousOwnerItem := range previousOwner {
|
||||
previousOwnerRule = append(previousOwnerRule, previousOwnerItem)
|
||||
}
|
||||
var newOwnerRule []interface{}
|
||||
for _, newOwnerItem := range newOwner {
|
||||
newOwnerRule = append(newOwnerRule, newOwnerItem)
|
||||
}
|
||||
|
||||
logs, sub, err := _Smartcontracts.contract.FilterLogs(opts, "OwnershipTransferred", previousOwnerRule, newOwnerRule)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &SmartcontractsOwnershipTransferredIterator{contract: _Smartcontracts.contract, event: "OwnershipTransferred", logs: logs, sub: sub}, nil
|
||||
}
|
||||
|
||||
// WatchOwnershipTransferred is a free log subscription operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0.
|
||||
//
|
||||
// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner)
|
||||
func (_Smartcontracts *SmartcontractsFilterer) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *SmartcontractsOwnershipTransferred, previousOwner []common.Address, newOwner []common.Address) (event.Subscription, error) {
|
||||
|
||||
var previousOwnerRule []interface{}
|
||||
for _, previousOwnerItem := range previousOwner {
|
||||
previousOwnerRule = append(previousOwnerRule, previousOwnerItem)
|
||||
}
|
||||
var newOwnerRule []interface{}
|
||||
for _, newOwnerItem := range newOwner {
|
||||
newOwnerRule = append(newOwnerRule, newOwnerItem)
|
||||
}
|
||||
|
||||
logs, sub, err := _Smartcontracts.contract.WatchLogs(opts, "OwnershipTransferred", previousOwnerRule, newOwnerRule)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return event.NewSubscription(func(quit <-chan struct{}) error {
|
||||
defer sub.Unsubscribe()
|
||||
for {
|
||||
select {
|
||||
case log := <-logs:
|
||||
// New log arrived, parse the event and forward to the user
|
||||
event := new(SmartcontractsOwnershipTransferred)
|
||||
if err := _Smartcontracts.contract.UnpackLog(event, "OwnershipTransferred", log); err != nil {
|
||||
return err
|
||||
}
|
||||
event.Raw = log
|
||||
|
||||
select {
|
||||
case sink <- event:
|
||||
case err := <-sub.Err():
|
||||
return err
|
||||
case <-quit:
|
||||
return nil
|
||||
}
|
||||
case err := <-sub.Err():
|
||||
return err
|
||||
case <-quit:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}), nil
|
||||
}
|
||||
|
||||
// ParseOwnershipTransferred is a log parse operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0.
|
||||
//
|
||||
// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner)
|
||||
func (_Smartcontracts *SmartcontractsFilterer) ParseOwnershipTransferred(log types.Log) (*SmartcontractsOwnershipTransferred, error) {
|
||||
event := new(SmartcontractsOwnershipTransferred)
|
||||
if err := _Smartcontracts.contract.UnpackLog(event, "OwnershipTransferred", log); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return event, nil
|
||||
}
|
6
eth-contracts/.env-sample
Normal file
6
eth-contracts/.env-sample
Normal file
@ -0,0 +1,6 @@
|
||||
# Ropsten
|
||||
WEB3_NETWORK_ID=3
|
||||
WEB3_INFURA_ID=please provide
|
||||
MNEMONIC=please provide
|
||||
ACCOUNT_ADDR=please provide
|
||||
PRIVATE_KEY=please provie
|
3
eth-contracts/README.md
Normal file
3
eth-contracts/README.md
Normal file
@ -0,0 +1,3 @@
|
||||
# P2P Oracle Smart Contracts
|
||||
|
||||
Smart contracts to work with Secured Finance P2P oracle network.
|
1
eth-contracts/build/Aggregator.abi
Normal file
1
eth-contracts/build/Aggregator.abi
Normal file
@ -0,0 +1 @@
|
||||
[{"inputs":[{"internalType":"contract Whitelist","name":"_whitelist","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"uint256","name":"reqID","type":"uint256"},{"internalType":"string","name":"data","type":"string"},{"internalType":"address","name":"callbackAddress","type":"address"},{"internalType":"bytes4","name":"callbackMethodID","type":"bytes4"}],"name":"collectData","outputs":[],"stateMutability":"nonpayable","type":"function"}]
|
1
eth-contracts/build/Mediator.abi
Normal file
1
eth-contracts/build/Mediator.abi
Normal file
@ -0,0 +1 @@
|
||||
[{"inputs":[{"internalType":"address","name":"_oracleEmitter","type":"address"},{"internalType":"address","name":"_aggregator","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"reqID","type":"uint256"},{"indexed":false,"internalType":"string","name":"data","type":"string"}],"name":"DataReceived","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[{"internalType":"uint256","name":"reqID","type":"uint256"},{"internalType":"string","name":"data","type":"string"}],"name":"_receiveDataCallback","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"isOwner","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"requestType","type":"string"}],"name":"request","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]
|
1
eth-contracts/build/OracleEmitter.abi
Normal file
1
eth-contracts/build/OracleEmitter.abi
Normal file
@ -0,0 +1 @@
|
||||
[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"requestType","type":"string"},{"indexed":false,"internalType":"address","name":"callbackAddress","type":"address"},{"indexed":false,"internalType":"bytes4","name":"callbackMethodID","type":"bytes4"},{"indexed":false,"internalType":"uint256","name":"requestID","type":"uint256"}],"name":"NewOracleRequest","type":"event"},{"inputs":[{"internalType":"string","name":"requestType","type":"string"},{"internalType":"address","name":"callbackAddress","type":"address"},{"internalType":"bytes4","name":"callbackMethodID","type":"bytes4"}],"name":"requestOracles","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"}]
|
1
eth-contracts/build/Ownable.abi
Normal file
1
eth-contracts/build/Ownable.abi
Normal file
@ -0,0 +1 @@
|
||||
[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[],"name":"isOwner","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]
|
1
eth-contracts/build/Whitelist.abi
Normal file
1
eth-contracts/build/Whitelist.abi
Normal file
@ -0,0 +1 @@
|
||||
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[{"internalType":"address","name":"nodeAccount","type":"address"}],"name":"addNode","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getNodes","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isOwner","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"nodes","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"nodeAccount","type":"address"}],"name":"removeNode","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]
|
25
eth-contracts/contracts/Aggregator.sol
Normal file
25
eth-contracts/contracts/Aggregator.sol
Normal file
@ -0,0 +1,25 @@
|
||||
//SPDX-License-Identifier: MIT
|
||||
pragma solidity >= 0.5.0 < 0.7.0;
|
||||
|
||||
import "./Whitelist.sol";
|
||||
|
||||
contract Aggregator {
|
||||
Whitelist whitelist;
|
||||
|
||||
constructor(Whitelist _whitelist) public {
|
||||
whitelist = _whitelist;
|
||||
}
|
||||
|
||||
function collectData(uint256 reqID, string memory data, address callbackAddress, bytes4 callbackMethodID) public {
|
||||
address[] memory nodes = whitelist.getNodes();
|
||||
bool nodeInTheList = false;
|
||||
for (uint256 i = 0; i < nodes.length-1; i++) {
|
||||
if (nodes[i] == msg.sender) {
|
||||
nodeInTheList = true;
|
||||
}
|
||||
}
|
||||
require(nodeInTheList);
|
||||
(bool success,) = callbackAddress.call(abi.encode(callbackMethodID, reqID, data));
|
||||
require(success);
|
||||
}
|
||||
}
|
29
eth-contracts/contracts/Mediator.sol
Normal file
29
eth-contracts/contracts/Mediator.sol
Normal file
@ -0,0 +1,29 @@
|
||||
//SPDX-License-Identifier: MIT
|
||||
pragma solidity >= 0.5.0 < 0.7.0;
|
||||
|
||||
import "./vendor/Ownable.sol";
|
||||
import "./OracleEmitter.sol";
|
||||
|
||||
contract Mediator is Ownable {
|
||||
event DataReceived(
|
||||
uint256 reqID,
|
||||
string data
|
||||
);
|
||||
|
||||
OracleEmitter oracleEmitter;
|
||||
address aggregator;
|
||||
|
||||
constructor(address _oracleEmitter, address _aggregator) public Ownable() {
|
||||
oracleEmitter = OracleEmitter(_oracleEmitter);
|
||||
aggregator = _aggregator;
|
||||
}
|
||||
|
||||
function request(string memory requestType) public returns (uint256) {
|
||||
return oracleEmitter.requestOracles(requestType, address(this), bytes4(keccak256("_receiveDataCallback(uint256, string)")));
|
||||
}
|
||||
|
||||
function _receiveDataCallback(uint256 reqID, string memory data) public {
|
||||
require(msg.sender == aggregator);
|
||||
emit DataReceived(reqID, data);
|
||||
}
|
||||
}
|
19
eth-contracts/contracts/OracleEmitter.sol
Normal file
19
eth-contracts/contracts/OracleEmitter.sol
Normal file
@ -0,0 +1,19 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
pragma solidity >=0.4.21 <0.7.0;
|
||||
|
||||
contract OracleEmitter {
|
||||
uint256 requestCounter;
|
||||
|
||||
event NewOracleRequest(
|
||||
string requestType,
|
||||
address callbackAddress,
|
||||
bytes4 callbackMethodID,
|
||||
uint256 requestID
|
||||
);
|
||||
|
||||
function requestOracles(string memory requestType, address callbackAddress, bytes4 callbackMethodID) public returns (uint256) {
|
||||
requestCounter++;
|
||||
emit NewOracleRequest(requestType, callbackAddress, callbackMethodID, requestCounter);
|
||||
return requestCounter;
|
||||
}
|
||||
}
|
34
eth-contracts/contracts/Whitelist.sol
Normal file
34
eth-contracts/contracts/Whitelist.sol
Normal file
@ -0,0 +1,34 @@
|
||||
//SPDX-License-Identifier: MIT
|
||||
pragma solidity >= 0.5.0 < 0.7.0;
|
||||
|
||||
import "./vendor/Ownable.sol";
|
||||
|
||||
contract Whitelist is Ownable {
|
||||
address[] public nodes;
|
||||
|
||||
constructor() public Ownable() {
|
||||
}
|
||||
|
||||
function addNode(address nodeAccount) public onlyOwner {
|
||||
nodes.push(nodeAccount);
|
||||
}
|
||||
|
||||
function removeNode(address nodeAccount) public onlyOwner {
|
||||
for (uint256 i = 0; i <= nodes.length-1; i++){
|
||||
if (nodes[i] == nodeAccount) {
|
||||
for (uint256 j = i; j < nodes.length-1; j++){
|
||||
nodes[j] = nodes[j+1];
|
||||
}
|
||||
delete nodes[nodes.length-1];
|
||||
if (nodes.length == 1) {
|
||||
delete nodes;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getNodes() public view returns (address[] memory) {
|
||||
return nodes;
|
||||
}
|
||||
}
|
18
eth-contracts/migrations/1_initial_migration.js
Normal file
18
eth-contracts/migrations/1_initial_migration.js
Normal file
@ -0,0 +1,18 @@
|
||||
const Whitelist = artifacts.require("Whitelist");
|
||||
const OracleEmitter = artifacts.require("OracleEmitter");
|
||||
const Aggregator = artifacts.require("Aggregator");
|
||||
const Mediator = artifacts.require("Mediator");
|
||||
|
||||
module.exports = function (deployer) {
|
||||
return deployer
|
||||
.then(() => {
|
||||
return deployer.deploy(Whitelist);
|
||||
})
|
||||
.then(() => {
|
||||
return deployer.deploy(OracleEmitter);
|
||||
}).then(() => {
|
||||
return deployer.deploy(Aggregator, Whitelist.address);
|
||||
}).then(() => {
|
||||
return deployer.deploy(Mediator, OracleEmitter.address, Aggregator.address);
|
||||
});
|
||||
};
|
4631
eth-contracts/package-lock.json
generated
Normal file
4631
eth-contracts/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
19
eth-contracts/package.json
Normal file
19
eth-contracts/package.json
Normal file
@ -0,0 +1,19 @@
|
||||
{
|
||||
"name": "p2p-oracle-smart-contracts",
|
||||
"version": "0.0.1",
|
||||
"description": "Smart contracts for p2p oracle network",
|
||||
"main": "truffle-config.js",
|
||||
"directories": {
|
||||
"test": "test"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"author": "",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@truffle/hdwallet-provider": "^1.0.40",
|
||||
"dotenv": "^8.2.0",
|
||||
"truffle": "^5.1.37"
|
||||
}
|
||||
}
|
0
eth-contracts/test/.gitkeep
Normal file
0
eth-contracts/test/.gitkeep
Normal file
41
eth-contracts/truffle-config.js
Normal file
41
eth-contracts/truffle-config.js
Normal file
@ -0,0 +1,41 @@
|
||||
require('dotenv').config();
|
||||
const customProvider = (mnemonic, rpcEndpoint) => () =>
|
||||
new HDWalletProvider(mnemonic, rpcEndpoint);
|
||||
|
||||
const infuraProvider = (network) =>
|
||||
customProvider(
|
||||
process.env.MNEMONIC || process.env.PRIVATE_KEY || '',
|
||||
`https://${network}.infura.io/v3/${process.env.WEB3_INFURA_ID}`,
|
||||
);
|
||||
|
||||
const ropstenProvider = infuraProvider('ropsten');
|
||||
|
||||
module.exports = {
|
||||
networks: {
|
||||
development: {
|
||||
host: "127.0.0.1", // Localhost (default: none)
|
||||
port: 7545, // Standard Ethereum port (default: none)
|
||||
network_id: "*", // Any network (default: none)
|
||||
},
|
||||
ropsten: {
|
||||
provider: ropstenProvider,
|
||||
network_id: 3,
|
||||
// gasPrice: 5000000000,
|
||||
// gas: 4500000,
|
||||
// gasPrice: 10000000000,
|
||||
// confirmations: 0, // # of confs to wait between deployments. (default: 0)
|
||||
skipDryRun: true,
|
||||
},
|
||||
},
|
||||
compilers: {
|
||||
solc: {
|
||||
version: '0.6.12',
|
||||
settings: {
|
||||
optimizer: {
|
||||
enabled: true, // Default: false
|
||||
runs: 0, // Default: 200
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
};
|
13
go.mod
13
go.mod
@ -5,8 +5,11 @@ go 1.14
|
||||
require (
|
||||
github.com/deckarep/golang-set v1.7.1
|
||||
github.com/dgrijalva/jwt-go v3.2.0+incompatible
|
||||
github.com/edsrzf/mmap-go v1.0.0 // indirect
|
||||
github.com/ethereum/go-ethereum v1.9.5
|
||||
github.com/gballet/go-libpcsclite v0.0.0-20191108122812-4678299bea08 // indirect
|
||||
github.com/ipfs/go-log v1.0.4
|
||||
github.com/karalabe/usb v0.0.0-20191104083709-911d15fe12a9 // indirect
|
||||
github.com/libp2p/go-libp2p v0.10.2
|
||||
github.com/libp2p/go-libp2p-core v0.6.1
|
||||
github.com/libp2p/go-libp2p-discovery v0.5.0
|
||||
@ -15,6 +18,14 @@ require (
|
||||
github.com/libp2p/go-libp2p-peerstore v0.2.6
|
||||
github.com/libp2p/go-libp2p-pubsub v0.3.3
|
||||
github.com/multiformats/go-multiaddr v0.2.2
|
||||
github.com/renproject/mercury v0.3.14
|
||||
github.com/olekukonko/tablewriter v0.0.4 // indirect
|
||||
github.com/pborman/uuid v1.2.0 // indirect
|
||||
github.com/renproject/hyperdrive v1.2.0
|
||||
github.com/rjeczalik/notify v0.9.2 // indirect
|
||||
github.com/rs/cors v1.7.0 // indirect
|
||||
github.com/spf13/viper v1.7.1
|
||||
github.com/status-im/keycard-go v0.0.0-20200402102358-957c09536969 // indirect
|
||||
github.com/tyler-smith/go-bip39 v1.0.2 // indirect
|
||||
github.com/wsddn/go-ecdh v0.0.0-20161211032359-48726bab9208 // indirect
|
||||
golang.org/x/crypto v0.0.0-20200423211502-4bdfaf469ed5
|
||||
)
|
||||
|
58
go.sum
58
go.sum
@ -23,11 +23,13 @@ github.com/AndreasBriese/bbloom v0.0.0-20190306092124-e2d15f34fcf9/go.mod h1:bOv
|
||||
github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
|
||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
|
||||
github.com/DataDog/zstd v1.3.6-0.20190409195224-796139022798/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo=
|
||||
github.com/DataDog/zstd v1.4.1/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo=
|
||||
github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0=
|
||||
github.com/Kubuxu/go-os-helper v0.0.1/go.mod h1:N8B+I7vPCT80IcP58r50u4+gEEcsZETFUpAzWW2ep1Y=
|
||||
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
|
||||
github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo=
|
||||
github.com/Shopify/sarama v1.23.1/go.mod h1:XLH1GYJnLVE0XCr6KdJGVJRTwY30moWNJ4sERjXX6fs=
|
||||
github.com/Shopify/sarama v1.26.1/go.mod h1:NbSGBSSndYaIhRcBtY9V0U7AyH+x71bG668AuWys/yU=
|
||||
github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI=
|
||||
github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g=
|
||||
@ -45,7 +47,10 @@ github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kd
|
||||
github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ=
|
||||
github.com/apache/thrift v0.13.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ=
|
||||
github.com/aristanetworks/fsnotify v1.4.2/go.mod h1:D/rtu7LpjYM8tRJphJ0hUBYpjai8SfX+aSNsWDTq/Ks=
|
||||
github.com/aristanetworks/glog v0.0.0-20180419172825-c15b03b3054f/go.mod h1:KASm+qXFKs/xjSoWn30NrWBBvdTTQq+UjkhjEJHfSFA=
|
||||
github.com/aristanetworks/glog v0.0.0-20191112221043-67e8567f59f3/go.mod h1:KASm+qXFKs/xjSoWn30NrWBBvdTTQq+UjkhjEJHfSFA=
|
||||
github.com/aristanetworks/goarista v0.0.0-20200224203130-895b4c57c44d h1:dp3WUsx0f1TjLuuuDIrt4N/NmN/nlsgWbhJ4JICq8dE=
|
||||
github.com/aristanetworks/goarista v0.0.0-20200224203130-895b4c57c44d/go.mod h1:fc4cJJjY+PlmFYIjSFJ/OPWG8R2B/ue7+q2YbMkirTo=
|
||||
github.com/aristanetworks/goarista v0.0.0-20200310212843-2da4c1f5881b h1:VBFuX8nQQ57A6OGYGOLugx/Sc488F0nNIdTtcmNq9qE=
|
||||
github.com/aristanetworks/goarista v0.0.0-20200310212843-2da4c1f5881b/go.mod h1:QZe5Yh80Hp1b6JxQdpfSEEe8X7hTyTEZSosSrFf/oJE=
|
||||
github.com/aristanetworks/splunk-hec-go v0.3.3/go.mod h1:1VHO9r17b0K7WmOlLb9nTk/2YanvOEnLMUgsFrxBROc=
|
||||
@ -80,6 +85,7 @@ github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13P
|
||||
github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA=
|
||||
github.com/btcsuite/btcutil v0.0.0-20190207003914-4c204d697803/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg=
|
||||
github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg=
|
||||
github.com/btcsuite/btcutil v1.0.1/go.mod h1:j9HUFwoQRsZL3V4n+qG+CUnEGHOarIxfC3Le2Yhbcts=
|
||||
github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg=
|
||||
github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY=
|
||||
github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc=
|
||||
@ -121,6 +127,7 @@ github.com/cskr/pubsub v1.0.2 h1:vlOzMhl6PFn60gRlTQQsIfVwaPB/B/8MziK8FhEPt/0=
|
||||
github.com/cskr/pubsub v1.0.2/go.mod h1:/8MzYXk/NJAz782G8RPkFzXTZVu63VotefPnR9TIRis=
|
||||
github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davidlazar/go-crypto v0.0.0-20170701192655-dcfb0a7ac018 h1:6xT9KW8zLC5IlbaIF5Q7JNieBoACT7iW0YTxQHR0in0=
|
||||
github.com/davidlazar/go-crypto v0.0.0-20170701192655-dcfb0a7ac018/go.mod h1:rQYf4tfk5sSwFsnDg3qYaBxSjsD9S8+59vW0dKUgme4=
|
||||
@ -155,6 +162,7 @@ github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5m
|
||||
github.com/eapache/go-resiliency v1.2.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs=
|
||||
github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU=
|
||||
github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I=
|
||||
github.com/edsrzf/mmap-go v1.0.0 h1:CEBF7HpRnUCSJgGUb5h1Gm7e3VkmVDrR8lvWVLtrOFw=
|
||||
github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M=
|
||||
github.com/elastic/gosigar v0.10.5 h1:GzPQ+78RaAb4J63unidA/JavQRKrB6s8IOzN6Ib59jo=
|
||||
github.com/elastic/gosigar v0.10.5/go.mod h1:cdorVVzy1fhmEqmtgqkoE3bYtCfSCkVyjTyCIo22xvs=
|
||||
@ -177,6 +185,7 @@ github.com/frankban/quicktest v1.7.2/go.mod h1:jaStnuzAqU1AJdCO0l53JDCJrVDKcS03D
|
||||
github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I=
|
||||
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
|
||||
github.com/garyburd/redigo v1.6.0/go.mod h1:NR3MbYisc3/PwhQ00EMzDiPmrwpPxAn5GI05/YaO1SY=
|
||||
github.com/gballet/go-libpcsclite v0.0.0-20191108122812-4678299bea08 h1:f6D9Hr8xV8uYKlyuj8XIruxlh9WjVjdh1gIicAS7ays=
|
||||
github.com/gballet/go-libpcsclite v0.0.0-20191108122812-4678299bea08/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww=
|
||||
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
|
||||
github.com/gliderlabs/ssh v0.1.1/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0=
|
||||
@ -227,11 +236,13 @@ github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi
|
||||
github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
|
||||
github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
|
||||
github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
|
||||
github.com/golang/protobuf v1.4.0 h1:oOuy+ugB+P/kBdUnG5QaMXSIyJ1q38wWSojYCb3z5VQ=
|
||||
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
|
||||
github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8=
|
||||
github.com/golang/protobuf v1.4.2 h1:+Z5KGCizgyZCbGh1KZqA0fcLLkwbsjIzS4aV2v7wJX0=
|
||||
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
|
||||
github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
|
||||
github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4=
|
||||
github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
|
||||
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
|
||||
github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
|
||||
@ -323,6 +334,7 @@ github.com/huin/goupnp v1.0.0 h1:wg75sLpL6DZqwHQN6E1Cfk6mtfzS45z8OV+ic+DtHRo=
|
||||
github.com/huin/goupnp v1.0.0/go.mod h1:n9v9KO1tAxYH82qOn+UTIFQDmx5n1Zxd/ClZDMX7Bnc=
|
||||
github.com/huin/goutil v0.0.0-20170803182201-1ca381bf3150/go.mod h1:PpLOETDnJ0o3iZrZfqZzyLl6l7F3c6L1oWn7OICBi6o=
|
||||
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
|
||||
github.com/influxdata/influxdb1-client v0.0.0-20190809212627-fc22c7df067e/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo=
|
||||
github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo=
|
||||
github.com/ipfs/go-cid v0.0.1/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM=
|
||||
github.com/ipfs/go-cid v0.0.2/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM=
|
||||
@ -380,6 +392,7 @@ github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8/go.mod h1:Ly/wlsj
|
||||
github.com/jbenet/goprocess v0.1.3/go.mod h1:5yspPrukOVuOLORacaBi858NqyClJPQxYZlqdZVfqY4=
|
||||
github.com/jbenet/goprocess v0.1.4 h1:DRGOFReOMqqDNXwW70QkacFW0YN9QnwLV0Vqk+3oU0o=
|
||||
github.com/jbenet/goprocess v0.1.4/go.mod h1:5yspPrukOVuOLORacaBi858NqyClJPQxYZlqdZVfqY4=
|
||||
github.com/jcmturner/gofork v0.0.0-20190328161633-dc7c13fece03/go.mod h1:MK8+TM0La+2rjBD4jE12Kj1pCCxK7d2LK/UM3ncEo0o=
|
||||
github.com/jcmturner/gofork v1.0.0/go.mod h1:MK8+TM0La+2rjBD4jE12Kj1pCCxK7d2LK/UM3ncEo0o=
|
||||
github.com/jellevandenhooff/dkim v0.0.0-20150330215556-f50fe3d243e1/go.mod h1:E0B/fFc00Y+Rasa88328GlI/XbtyysCtTHZS8h7IrBU=
|
||||
github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
|
||||
@ -403,6 +416,7 @@ github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7V
|
||||
github.com/kabukky/httpscerts v0.0.0-20150320125433-617593d7dcb3 h1:Iy7Ifq2ysilWU4QlCx/97OoI4xT1IV7i8byT/EyIT/M=
|
||||
github.com/kabukky/httpscerts v0.0.0-20150320125433-617593d7dcb3/go.mod h1:BYpt4ufZiIGv2nXn4gMxnfKV306n3mWXgNu/d2TqdTU=
|
||||
github.com/kami-zh/go-capturer v0.0.0-20171211120116-e492ea43421d/go.mod h1:P2viExyCEfeWGU259JnaQ34Inuec4R38JCyBx2edgD0=
|
||||
github.com/karalabe/usb v0.0.0-20191104083709-911d15fe12a9 h1:ZHuwnjpP8LsVsUYqTqeVAI+GfDfJ6UNPrExZF+vX/DQ=
|
||||
github.com/karalabe/usb v0.0.0-20191104083709-911d15fe12a9/go.mod h1:Od972xHfMJowv7NGVDiWVxk2zxnWgjLlJzE+F4F7AGU=
|
||||
github.com/kilic/bls12-381 v0.0.0-20200607163746-32e1441c8a9f h1:qET3Wx0v8tMtoTOQnsJXVvqvCopSf48qobR6tcJuDHo=
|
||||
github.com/kilic/bls12-381 v0.0.0-20200607163746-32e1441c8a9f/go.mod h1:XXfR6YFCRSrkEXbNlIyDsgXVNJWVUV30m/ebkVy9n6s=
|
||||
@ -412,7 +426,9 @@ github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+o
|
||||
github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4=
|
||||
github.com/klauspost/compress v1.9.8/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A=
|
||||
github.com/klauspost/compress v1.10.1/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs=
|
||||
github.com/klauspost/cpuid v1.2.1/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek=
|
||||
github.com/klauspost/cpuid v1.2.3/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek=
|
||||
github.com/klauspost/reedsolomon v1.9.2/go.mod h1:CwCi+NUr9pqSVktrkN+Ondf06rkhYZ/pcNv7fu+8Un4=
|
||||
github.com/klauspost/reedsolomon v1.9.3/go.mod h1:CwCi+NUr9pqSVktrkN+Ondf06rkhYZ/pcNv7fu+8Un4=
|
||||
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
||||
github.com/konsorten/go-windows-terminal-sequences v1.0.3 h1:CE8S1cTafDpPvMhIxNJKvHsGVBgn1xWYf1NbHQhywc8=
|
||||
@ -640,6 +656,7 @@ github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNx
|
||||
github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
|
||||
github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
|
||||
github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
|
||||
github.com/mattn/go-runewidth v0.0.7 h1:Ei8KR0497xHyKJPAv59M1dkC+rOZCMBJ+t3fZ+twI54=
|
||||
github.com/mattn/go-runewidth v0.0.7/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
|
||||
github.com/mattn/go-xmlrpc v0.0.3/go.mod h1:mqc2dz7tP5x5BKlCahN/n+hs7OSZKJkS9JsHNBRlrxA=
|
||||
github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU=
|
||||
@ -750,10 +767,12 @@ github.com/oklog/oklog v0.3.2/go.mod h1:FCV+B7mhrz4o+ueLpx+KqkyXRGMWOYEvfiXtdGtb
|
||||
github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA=
|
||||
github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U=
|
||||
github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo=
|
||||
github.com/olekukonko/tablewriter v0.0.4 h1:vHD/YYe1Wolo78koG299f7V/VAS08c6IpCLn+Ejf/w8=
|
||||
github.com/olekukonko/tablewriter v0.0.4/go.mod h1:zq6QwlOf5SlnkVbMSr5EoBv3636FWnp+qbPhuoO21uA=
|
||||
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||
github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||
github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||
github.com/onsi/ginkgo v1.9.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||
github.com/onsi/ginkgo v1.10.1/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||
github.com/onsi/ginkgo v1.11.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||
github.com/onsi/ginkgo v1.12.0/go.mod h1:oUhWkIvk5aDxtKvDDuw8gItl8pKl42LzjC9KZE0HfGg=
|
||||
@ -786,10 +805,12 @@ github.com/openzipkin/zipkin-go v0.2.1/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnh
|
||||
github.com/openzipkin/zipkin-go v0.2.2/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4=
|
||||
github.com/pact-foundation/pact-go v1.0.4/go.mod h1:uExwJY4kCzNPcHRj+hCR/HBbOOIwwtUjcrb0b5/5kLM=
|
||||
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
|
||||
github.com/pborman/uuid v1.2.0 h1:J7Q5mO4ysT1dv8hyrUGHb9+ooztCXu1D8MY8DZYsu3g=
|
||||
github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k=
|
||||
github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc=
|
||||
github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
|
||||
github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9iaPbIdPPGyKcA8hKdoy6hAWba7Yac=
|
||||
github.com/pierrec/lz4 v0.0.0-20190327172049-315a67e90e41/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc=
|
||||
github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc=
|
||||
github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY=
|
||||
github.com/pierrec/lz4 v2.4.1+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY=
|
||||
@ -805,6 +826,7 @@ github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXP
|
||||
github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829/go.mod h1:p2iRAGwDERtqlqzRXnrOVns+ignqQo//hLXqYxZYVNs=
|
||||
github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso=
|
||||
github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo=
|
||||
github.com/prometheus/client_golang v1.1.0/go.mod h1:I1FGZT9+L76gKKOs5djB6ezCbFQP1xR9D75/vuwEF3g=
|
||||
github.com/prometheus/client_golang v1.3.0/go.mod h1:hJaj2vgQTGQmVCsAACORcieXFeDPbaTKGT+JTgUa3og=
|
||||
github.com/prometheus/client_golang v1.4.1/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU=
|
||||
github.com/prometheus/client_golang v1.6.0 h1:YVPodQOcK15POxhgARIvnDRVpLcuK8mglnMrWfyrw6A=
|
||||
@ -821,6 +843,7 @@ github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7q
|
||||
github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
|
||||
github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
|
||||
github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
|
||||
github.com/prometheus/common v0.6.0/go.mod h1:eBmuwkDJBwy6iBfxCBob6t6dR6ENT/y+J+Zk0j9GMYc=
|
||||
github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA=
|
||||
github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4=
|
||||
github.com/prometheus/common v0.10.0 h1:RyRA7RzGXQZiW+tGMr7sxa85G1z0yOpM1qq5c8lNawc=
|
||||
@ -831,20 +854,35 @@ github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R
|
||||
github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
|
||||
github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
|
||||
github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
|
||||
github.com/prometheus/procfs v0.0.3/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDaekg4FpcdQ=
|
||||
github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A=
|
||||
github.com/prometheus/procfs v0.0.10/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A=
|
||||
github.com/prometheus/procfs v0.0.11/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU=
|
||||
github.com/prometheus/procfs v0.1.0 h1:jhMy6QXfi3y2HEzFoyuCj40z4OZIIHHPtFyCMftmvKA=
|
||||
github.com/prometheus/procfs v0.1.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU=
|
||||
github.com/prometheus/tsdb v0.7.1 h1:YZcsG11NqnK4czYLrWd9mpEuAJIHVQLwdrleYfszMAA=
|
||||
github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU=
|
||||
github.com/prometheus/tsdb v0.10.0/go.mod h1:oi49uRhEe9dPUTlS3JRZOwJuVi6tmh10QSgwXEyGCt4=
|
||||
github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
|
||||
github.com/rcrowley/go-metrics v0.0.0-20190826022208-cac0b30c2563/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
|
||||
github.com/renproject/abi v0.4.1 h1:UbrC6CSGi7T2VBhKZO9EzRyvCpmTDV+gHCb+WVVTZiQ=
|
||||
github.com/renproject/abi v0.4.1/go.mod h1:Ug37KRS/um6elthcIgCRrzDfyJquVE+4RYBS6ykbOQI=
|
||||
github.com/renproject/hyperdrive v1.0.0/go.mod h1:kFiXW7enjQ5jzwprSr64B5HSCNvnXHfkLzz84R2gA/w=
|
||||
github.com/renproject/hyperdrive v1.2.0 h1:aOPUCALbXYyKKhDLHdvcQK8M2pRx3joWnHuiFXdQjYE=
|
||||
github.com/renproject/hyperdrive v1.2.0/go.mod h1:QVT8rcqmCPDfjdlyswoYj+rLS8sqrwD6c4u0N6MQ4Po=
|
||||
github.com/renproject/id v0.1.1/go.mod h1:i4OJzgjl4XLcU7nfU9UshX7PaBVpnTk3gEVj8dKa6f8=
|
||||
github.com/renproject/id v0.2.2 h1:hQH74EK5GjzG588EVJ7m5nnXfJd36mmq/ipkYcL8vAc=
|
||||
github.com/renproject/id v0.2.2/go.mod h1:xEoepH7Jze4l+gJxzSh9yRt634XyiM1j9si+WS2Emsc=
|
||||
github.com/renproject/kv v1.0.3/go.mod h1:B+LKu5xLj9t65LrbsSyzTcgLcPdWCd0qxFEtNB7NRo8=
|
||||
github.com/renproject/mercury v0.3.14 h1:hrYuFDdrgxev9WZaJ9qs7gzGbnY0a53MGxH0NQ7ACM0=
|
||||
github.com/renproject/mercury v0.3.14/go.mod h1:Di/sXId2UQ9faJjHzOEYECacsJOwObg5avF2NPsfpas=
|
||||
github.com/renproject/phi v0.0.0-20190713013721-51f586bc4816/go.mod h1:Hrxx2ONVpfByficRjyRd1trecalYr0lo7Z0akx8UXqg=
|
||||
github.com/renproject/phi v0.1.0 h1:ZOn7QeDribk/uV46OhQWcTLxyuLg7P+xR1Hfl5cOQuI=
|
||||
github.com/renproject/phi v0.1.0/go.mod h1:Hrxx2ONVpfByficRjyRd1trecalYr0lo7Z0akx8UXqg=
|
||||
github.com/renproject/surge v1.1.1/go.mod h1:UnnFYpLSD0T9MzCcyHjbNdmxiQsDVyBDCuqcbhcaLCY=
|
||||
github.com/renproject/surge v1.1.2 h1:Yy3pTlRyaMJGLfn64JHgCnWs3cWbRJjE+aFxZXRGfWU=
|
||||
github.com/renproject/surge v1.1.2/go.mod h1:UnnFYpLSD0T9MzCcyHjbNdmxiQsDVyBDCuqcbhcaLCY=
|
||||
github.com/rjeczalik/notify v0.9.2 h1:MiTWrPj55mNDHEiIX5YUSKefw/+lCQVoAFmD6oQm5w8=
|
||||
github.com/rjeczalik/notify v0.9.2/go.mod h1:aErll2f0sUX9PXZnVNyeiObbmTlk5jnMoCa4QEjJeqM=
|
||||
github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
|
||||
github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ=
|
||||
@ -887,6 +925,7 @@ github.com/shurcooL/webdavfs v0.0.0-20170829043945-18c3829fa133/go.mod h1:hKmq5k
|
||||
github.com/siebenmann/go-kstat v0.0.0-20160321171754-d34789b79745/go.mod h1:G81aIFAMS9ECrwBYR9YxhlPjWgrItd+Kje78O6+uqm8=
|
||||
github.com/sirupsen/logrus v1.2.0 h1:juTguoYk5qI21pwyTXY3B3Y5cOTH3ZUyZCg1v/mihuo=
|
||||
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
|
||||
github.com/sirupsen/logrus v1.4.2 h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4=
|
||||
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
|
||||
github.com/sirupsen/logrus v1.6.0 h1:UBcNElsrwanuuMsnGSlYmtmgbb23qDR5dG+6X6Oo89I=
|
||||
github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88=
|
||||
@ -921,6 +960,8 @@ github.com/spf13/viper v1.7.1 h1:pM5oEahlgWv/WnHXpgbKz7iLIxRf65tye2Ci+XFK5sk=
|
||||
github.com/spf13/viper v1.7.1/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg=
|
||||
github.com/src-d/envconfig v1.0.0/go.mod h1:Q9YQZ7BKITldTBnoxsE5gOeB5y66RyPXeue/R4aaNBc=
|
||||
github.com/status-im/keycard-go v0.0.0-20200107115650-f38e9a19958e/go.mod h1:RZLeN1LMWmRsyYjvAu+I6Dm9QmlDaIIt+Y+4Kd7Tp+Q=
|
||||
github.com/status-im/keycard-go v0.0.0-20200402102358-957c09536969 h1:Oo2KZNP70KE0+IUJSidPj/BFS/RXNHmKIJOdckzml2E=
|
||||
github.com/status-im/keycard-go v0.0.0-20200402102358-957c09536969/go.mod h1:RZLeN1LMWmRsyYjvAu+I6Dm9QmlDaIIt+Y+4Kd7Tp+Q=
|
||||
github.com/steakknife/bloomfilter v0.0.0-20180922174646-6819c0d2a570 h1:gIlAHnH1vJb5vwEjIp5kBj/eu99p/bl0Ay2goiPe5xE=
|
||||
github.com/steakknife/bloomfilter v0.0.0-20180922174646-6819c0d2a570/go.mod h1:8OR4w3TdeIHIh1g6EMY5p0gVNOovcWC+1vpc7naMuAw=
|
||||
github.com/steakknife/hamming v0.0.0-20180906055917-c99c65617cd3 h1:njlZPzLwU639dk2kqnCPPv+wNjq7Xb6EfUxe/oX0/NM=
|
||||
@ -938,13 +979,17 @@ github.com/stretchr/testify v1.6.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
|
||||
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s=
|
||||
github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw=
|
||||
github.com/syndtr/goleveldb v1.0.0 h1:fBdIW9lB4Iz0n9khmH8w27SJ3QEJ7+IgjPEwGSZiFdE=
|
||||
github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpPAyBWyWuQ=
|
||||
github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07/go.mod h1:kDXzergiv9cbyO7IOYJZWg1U88JhDg3PB6klq9Hg2pA=
|
||||
github.com/templexxx/cpufeat v0.0.0-20180724012125-cef66df7f161/go.mod h1:wM7WEvslTq+iOEAMDLSzhVuOt5BRZ05WirO+b09GHQU=
|
||||
github.com/templexxx/xor v0.0.0-20181023030647-4e92f724b73b/go.mod h1:5XA7W9S6mni3h5uvOC75dA3m9CCCaS83lltmc0ukdi4=
|
||||
github.com/templexxx/xor v0.0.0-20191217153810-f85b25db303b/go.mod h1:5XA7W9S6mni3h5uvOC75dA3m9CCCaS83lltmc0ukdi4=
|
||||
github.com/tjfoc/gmsm v1.0.1/go.mod h1:XxO4hdhhrzAd+G4CjDqaOkd0hUzmtPR/d3EiBBMn/wc=
|
||||
github.com/tjfoc/gmsm v1.3.0/go.mod h1:HaUcFuY0auTiaHB9MHFGCPx5IaLhTUd2atbCFBQXn9w=
|
||||
github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
|
||||
github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
|
||||
github.com/tyler-smith/go-bip39 v1.0.2 h1:+t3w+KwLXO6154GNJY+qUtIxLTmFjfUmpguQT1OlOT8=
|
||||
github.com/tyler-smith/go-bip39 v1.0.2/go.mod h1:sJ5fKU0s6JVwZjjcUEX2zFOnvq0ASQ2K9Zr6cf67kNs=
|
||||
github.com/uber/jaeger-client-go v2.15.0+incompatible/go.mod h1:WVhlPFC8FDjOFMMWRy2pZqQJSXxYSwNYOkTr/Z6d3Kk=
|
||||
github.com/uber/jaeger-client-go v2.23.1+incompatible h1:uArBYHQR0HqLFFAypI7RsWTzPSj/bDpmZZuQjMLSg1A=
|
||||
@ -973,12 +1018,14 @@ github.com/whyrusleeping/multiaddr-filter v0.0.0-20160516205228-e903e4adabd7 h1:
|
||||
github.com/whyrusleeping/multiaddr-filter v0.0.0-20160516205228-e903e4adabd7/go.mod h1:X2c0RVCI1eSUFI8eLcY3c0423ykwiUdxLJtkDvruhjI=
|
||||
github.com/whyrusleeping/timecache v0.0.0-20160911033111-cfcb2f1abfee h1:lYbXeSvJi5zk5GLKVuid9TVjS9a0OmLIDKTfoZBL6Ow=
|
||||
github.com/whyrusleeping/timecache v0.0.0-20160911033111-cfcb2f1abfee/go.mod h1:m2aV4LZI4Aez7dP5PMyVKEHhUyEJ/RjmPEDOpDvudHg=
|
||||
github.com/wsddn/go-ecdh v0.0.0-20161211032359-48726bab9208 h1:1cngl9mPEoITZG8s8cVcUy5CeIBYhEESkOB7m6Gmkrk=
|
||||
github.com/wsddn/go-ecdh v0.0.0-20161211032359-48726bab9208/go.mod h1:IotVbo4F+mw0EzQ08zFqg7pK3FebNXpaMsRy2RT+Ees=
|
||||
github.com/x-cray/logrus-prefixed-formatter v0.5.2/go.mod h1:2duySbKsL6M18s5GU7VPsoEPHyzalCE06qoARUCeBBE=
|
||||
github.com/xdg/scram v0.0.0-20180814205039-7eeb5667e42c/go.mod h1:lB8K/P019DLNhemzwFU4jHLhdvlE6uDZjXFejJXr49I=
|
||||
github.com/xdg/stringprep v1.0.0/go.mod h1:Jhud4/sHMO4oL310DaZAKk9ZaJ08SJfe+sJh0HrGL1Y=
|
||||
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
|
||||
github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q=
|
||||
github.com/xtaci/kcp-go v5.4.5+incompatible/go.mod h1:bN6vIwHQbfHaHtFpEssmWsN45a+AZwO7eyRCmEIbtvE=
|
||||
github.com/xtaci/kcp-go v5.4.20+incompatible/go.mod h1:bN6vIwHQbfHaHtFpEssmWsN45a+AZwO7eyRCmEIbtvE=
|
||||
github.com/xtaci/lossyconn v0.0.0-20190602105132-8df528c0c9ae/go.mod h1:gXtu8J62kEgmN++bm9BVICuT/e8yiLI2KFobd/TRFsE=
|
||||
go.dedis.ch/fixbuf v1.0.3 h1:hGcV9Cd/znUxlusJ64eAlExS+5cJDIyTyEG+otu5wQs=
|
||||
@ -1034,6 +1081,7 @@ golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnf
|
||||
golang.org/x/crypto v0.0.0-20190225124518-7f87c0fbb88b/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20190313024323-a1f597ede03a/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20190404164418-38d8ce5564a5/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE=
|
||||
golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20190513172903-22d7a77e9e5f/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
@ -1041,9 +1089,12 @@ golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8U
|
||||
golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20190618222545-ea8f1a30c443/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20190911031432-227b76d455e7/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550 h1:ObdrDkeb4kJdCP557AjRjq69pTHfNouLtWZG7j9rPN8=
|
||||
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20191219195013-becbf705a915/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||
golang.org/x/crypto v0.0.0-20200115085410-6d4e4cb37c7d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||
golang.org/x/crypto v0.0.0-20200128174031-69ecbb4d6d5d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||
golang.org/x/crypto v0.0.0-20200204104054-c9f3fb736b72/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||
golang.org/x/crypto v0.0.0-20200221231518-2aa609cf4a9d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||
@ -1098,6 +1149,7 @@ golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLL
|
||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20190912160710-24e19bdeb0f2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20190921015927-1a5e07d1ff72/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20190923162816-aa69164e4478 h1:l5EDrHhldLYb3ZRHDUhXF7Om7MvYXnkV9/iQNo1lX6g=
|
||||
golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
@ -1140,6 +1192,7 @@ golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5h
|
||||
golang.org/x/sys v0.0.0-20190228124157-a34e9553db1e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190316082340-a2f829d7f35f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190405154228-4b34438f7a67/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190411185658-b44545bcd369/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
@ -1151,9 +1204,11 @@ golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7w
|
||||
golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190801041406-cbf593c0f2f3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190902133755-9109b7679e13/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190912141932-bc967efca4b8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191008105621-543471e840be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191025090151-53bf42e6b339/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
@ -1203,6 +1258,7 @@ golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgw
|
||||
golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
|
||||
golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20190912185636-87d9f09c5d89/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
@ -1275,6 +1331,7 @@ google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQ
|
||||
google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
|
||||
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
|
||||
google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
||||
google.golang.org/protobuf v1.23.0 h1:4MY060fB1DLGMB/7MBTLnwQUY6+F09GEiz6SsrNqyzM=
|
||||
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
||||
google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
||||
google.golang.org/protobuf v1.24.0 h1:UhZDfRO8JRQru4/+LlLE0BRKGF8L+PICnvYZmx/fEGA=
|
||||
@ -1294,6 +1351,7 @@ gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
|
||||
gopkg.in/jcmturner/aescts.v1 v1.0.1/go.mod h1:nsR8qBOg+OucoIW+WMhB3GspUQXq9XorLnQb9XtvcOo=
|
||||
gopkg.in/jcmturner/dnsutils.v1 v1.0.1/go.mod h1:m3v+5svpVOhtFAP/wSz+yzh4Mc0Fg7eRhxkJMWSIz9Q=
|
||||
gopkg.in/jcmturner/goidentity.v3 v3.0.0/go.mod h1:oG2kH0IvSYNIu80dVAyu/yoefjq1mNfM5bm88whjWx4=
|
||||
gopkg.in/jcmturner/gokrb5.v7 v7.2.3/go.mod h1:l8VISx+WGYp+Fp7KRbsiUuXTTOnxIc3Tuvyavf11/WM=
|
||||
gopkg.in/jcmturner/gokrb5.v7 v7.5.0/go.mod h1:l8VISx+WGYp+Fp7KRbsiUuXTTOnxIc3Tuvyavf11/WM=
|
||||
gopkg.in/jcmturner/rpc.v1 v1.1.0/go.mod h1:YIdkC4XfD6GXbzje11McwsDuOlZQSb9W4vfLvuNnlv8=
|
||||
gopkg.in/redis.v4 v4.2.4/go.mod h1:8KREHdypkCEojGKQcjMqAODMICIVwZAONWq8RowTITA=
|
||||
|
@ -2,50 +2,131 @@ package rpcclient
|
||||
|
||||
import (
|
||||
"context"
|
||||
"crypto/ecdsa"
|
||||
"fmt"
|
||||
"log"
|
||||
"io/ioutil"
|
||||
"math/big"
|
||||
|
||||
"github.com/ethereum/go-ethereum"
|
||||
"github.com/ethereum/go-ethereum/accounts/keystore"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
"github.com/ethereum/go-ethereum/core/types"
|
||||
"github.com/ethereum/go-ethereum/crypto"
|
||||
"github.com/ethereum/go-ethereum/ethclient"
|
||||
"github.com/ipfs/go-log"
|
||||
)
|
||||
|
||||
type ethereumClient struct {
|
||||
httpClient *ethclient.Client
|
||||
wsClient *ethclient.Client
|
||||
logger log.Logger
|
||||
HttpClient *ethclient.Client
|
||||
WsClient *ethclient.Client
|
||||
Logger *log.ZapEventLogger
|
||||
}
|
||||
|
||||
type EthereumClient interface {
|
||||
Connect(context.Context, string) error
|
||||
Balance(context.Context, common.Address) (*big.Int, error)
|
||||
Balance(context.Context, string) (*big.Int, error)
|
||||
SubscribeOnSmartContractEvents(context.Context, string)
|
||||
GenerateAddressFromPrivateKey(string) string
|
||||
SendTransaction(string, string, int64) string
|
||||
createKeyStore(string) string
|
||||
importKeyStore(string, string) string
|
||||
}
|
||||
|
||||
func (c *ethereumClient) Connect(ctx context.Context, url string, connectionType string) error {
|
||||
client, err := ethclient.Dial(url)
|
||||
if err != nil {
|
||||
c.logger.Fatal(err)
|
||||
c.Logger.Fatal(err)
|
||||
}
|
||||
if connectionType == "websocket" {
|
||||
c.wsClient = client
|
||||
c.WsClient = client
|
||||
} else {
|
||||
c.httpClient = client
|
||||
c.HttpClient = client
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Balance returns the balance of the given ethereum address.
|
||||
func (c *ethereumClient) Balance(ctx context.Context, address common.Address) (*big.Int, error) {
|
||||
value, err := c.httpClient.BalanceAt(ctx, address, nil)
|
||||
func (c *ethereumClient) Balance(ctx context.Context, address string) (*big.Int, error) {
|
||||
ethereumAddress := common.HexToAddress(address)
|
||||
value, err := c.HttpClient.BalanceAt(ctx, ethereumAddress, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return value, nil
|
||||
}
|
||||
|
||||
func (c *ethereumClient) SendTransaction(private_key, to string, amount int64) string {
|
||||
privateKey, err := crypto.HexToECDSA(private_key)
|
||||
if err != nil {
|
||||
c.Logger.Fatal("Failed to parse private key", err)
|
||||
}
|
||||
|
||||
publicKey := privateKey.Public()
|
||||
publicKeyECDSA, ok := publicKey.(*ecdsa.PublicKey)
|
||||
if !ok {
|
||||
c.Logger.Fatal("Cannot assert type: publicKey is not of type *ecdsa.PublicKey", err)
|
||||
}
|
||||
|
||||
fromAddress := crypto.PubkeyToAddress(*publicKeyECDSA)
|
||||
nonce, err := c.HttpClient.PendingNonceAt(context.Background(), fromAddress)
|
||||
if err != nil {
|
||||
c.Logger.Fatal("Failed to generate wallet nonce value", err)
|
||||
}
|
||||
|
||||
value := big.NewInt(amount)
|
||||
gasLimit := uint64(21000) // in units
|
||||
gasPrice, err := c.HttpClient.SuggestGasPrice(context.Background())
|
||||
if err != nil {
|
||||
c.Logger.Fatal("Failed to suggest new gas price", err)
|
||||
}
|
||||
|
||||
toAddress := common.HexToAddress(to)
|
||||
var data []byte
|
||||
tx := types.NewTransaction(nonce, toAddress, value, gasLimit, gasPrice, data)
|
||||
|
||||
chainID, err := c.HttpClient.NetworkID(context.Background())
|
||||
if err != nil {
|
||||
c.Logger.Fatal("Failed to get network ID", err)
|
||||
}
|
||||
|
||||
signedTx, err := types.SignTx(tx, types.NewEIP155Signer(chainID), privateKey)
|
||||
if err != nil {
|
||||
c.Logger.Fatal("Failed to sign transaction", err)
|
||||
}
|
||||
|
||||
err = c.HttpClient.SendTransaction(context.Background(), signedTx)
|
||||
if err != nil {
|
||||
c.Logger.Fatal("Failed to send signed transaction", err)
|
||||
}
|
||||
|
||||
TxHash := signedTx.Hash().Hex()
|
||||
|
||||
c.Logger.Info("Transaction sent: %s", TxHash)
|
||||
|
||||
return TxHash
|
||||
}
|
||||
|
||||
func (c *ethereumClient) GenerateAddressFromPrivateKey(private_key string) string {
|
||||
privateKey, err := crypto.HexToECDSA(private_key)
|
||||
if err != nil {
|
||||
c.Logger.Fatal("Failed to generate private key", err)
|
||||
}
|
||||
|
||||
publicKey := privateKey.Public()
|
||||
publicKeyECDSA, ok := publicKey.(*ecdsa.PublicKey)
|
||||
if !ok {
|
||||
c.Logger.Fatal("cannot assert type: publicKey is not of type *ecdsa.PublicKey")
|
||||
}
|
||||
|
||||
publicKeyBytes := crypto.FromECDSAPub(publicKeyECDSA)
|
||||
c.Logger.Info(hexutil.Encode(publicKeyBytes)[4:])
|
||||
|
||||
address := crypto.PubkeyToAddress(*publicKeyECDSA).Hex()
|
||||
|
||||
return address
|
||||
}
|
||||
|
||||
func (c *ethereumClient) SubscribeOnSmartContractEvents(ctx context.Context, address string) {
|
||||
contractAddress := common.HexToAddress(address)
|
||||
query := ethereum.FilterQuery{
|
||||
@ -53,18 +134,43 @@ func (c *ethereumClient) SubscribeOnSmartContractEvents(ctx context.Context, add
|
||||
}
|
||||
|
||||
logs := make(chan types.Log)
|
||||
sub, err := c.wsClient.SubscribeFilterLogs(context.Background(), query, logs)
|
||||
sub, err := c.WsClient.SubscribeFilterLogs(context.Background(), query, logs)
|
||||
if err != nil {
|
||||
c.logger.Fatal(err)
|
||||
c.Logger.Fatal(err)
|
||||
}
|
||||
|
||||
for {
|
||||
select {
|
||||
case err := <-sub.Err():
|
||||
c.logger.Fatal(err)
|
||||
c.Logger.Fatal(err)
|
||||
case vLog := <-logs:
|
||||
fmt.Println(vLog) // pointer to event log
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func (c *ethereumClient) createKeyStore(password string) string {
|
||||
ks := keystore.NewKeyStore("./wallets", keystore.StandardScryptN, keystore.StandardScryptP)
|
||||
account, err := ks.NewAccount(password)
|
||||
if err != nil {
|
||||
c.Logger.Fatal("Failed to create new keystore", err)
|
||||
}
|
||||
|
||||
return account.Address.Hex()
|
||||
}
|
||||
|
||||
func (c *ethereumClient) importKeyStore(filePath string, password string) string {
|
||||
ks := keystore.NewKeyStore("./wallets", keystore.StandardScryptN, keystore.StandardScryptP)
|
||||
jsonBytes, err := ioutil.ReadFile(filePath)
|
||||
if err != nil {
|
||||
c.Logger.Fatal("Failed to read keystore file", err)
|
||||
}
|
||||
|
||||
account, err := ks.Import(jsonBytes, password, password)
|
||||
if err != nil {
|
||||
c.Logger.Fatal("Failed to import keystore", err)
|
||||
}
|
||||
|
||||
return account.Address.Hex()
|
||||
}
|
||||
|
1
rpcclient/lotus.go
Normal file
1
rpcclient/lotus.go
Normal file
@ -0,0 +1 @@
|
||||
package rpcclient
|
Loading…
Reference in New Issue
Block a user