zkpminer

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2022 License: GPL-3.0 Imports: 28 Imported by: 1

Documentation

Index

Constants

View Source
const (
	COINBASEINTERVAL = types.CoinBaseInterval
	SUBMITADVANCE    = types.SubmitAdvance
	RPCTIMEOUT       = time.Minute
)
View Source
const PledgeABI = "" /* 12951-byte string literal not displayed */

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

Variables

View Source
var (
	ErrorMinerWorkerOutOfRange    = errors.New("miner's workers reach MaxWorkerCnt, can not add more workers")
	ErrorLocalMinerWithoutBackend = errors.New("new local miner with nil backend")
	ErrorBlockHeaderSubscribe     = errors.New("block header subscribe error")
)
View Source
var (
	NotCliqueConsensusError = errors.New("no clique engine, invalid Evanesco node")
	NotEffectiveAddrError   = errors.New("miner address not staked or not in valid time period")
	ZKPProofVerifyError     = errors.New("ZKP proof verify failed")
	NotPledgeCoinbaseError  = errors.New("coinbase address conflict, check the coinbase address setting in Fortress")
	StopMinerError          = errors.New("submit error connection closed stop mining")
)
View Source
var (
	InvalidStepError = errors.New("invalid task step")
	ZKPProofError    = errors.New("zkp prove error")
)
View Source
var (
	InvalidTaskStepErr = errors.New("invalid task step")
)
View Source
var NewHeaderTimeoutDuration = time.Minute
View Source
var PledgeContract = common.HexToAddress("0x5C54891860a1b7fec6B6bb1B4402e990503785FD")
View Source
var RetryJitterMaxDuration = 1000 //millisecond
View Source
var RetryWSRPCWaitDuration = time.Second * 5
View Source
var WSUrlTryRound = 5

Functions

func Fatalf

func Fatalf(format string, args ...interface{})

func Iseffective

func Iseffective(miner common.Address, server *rpc.Server) (bool, common.Address)

Types

type Backend

type Backend interface {
	BlockChain() *core.BlockChain
	EventMux() *event.TypeMux
}

type Config

type Config struct {
	MinerList        []keypair.Key
	MaxWorkerCnt     int32
	MaxTaskCnt       int32
	CoinbaseInterval uint64
	SubmitAdvance    uint64
	CoinbaseAddr     common.Address
	WsUrl            []string
	RpcTimeout       time.Duration
	PkPath           string
}

func DefaultConfig

func DefaultConfig() Config

func (*Config) Customize

func (config *Config) Customize(minerList []keypair.Key, coinbase common.Address, url []string, pkPath string)

type Explorer

type Explorer interface {
	GetHeaderChan() chan types.HeaderShort
	GetHeaderByNum(num uint64) *types.Header
}

type Height

type Height uint64

type LocalExplorer

type LocalExplorer struct {
	Backend
	// contains filtered or unexported fields
}

func (*LocalExplorer) GetHeaderByNum

func (l *LocalExplorer) GetHeaderByNum(num uint64) *types.Header

func (*LocalExplorer) GetHeaderChan

func (l *LocalExplorer) GetHeaderChan() chan types.HeaderShort

type Miner

type Miner struct {
	MaxWorkerCnt int32
	MaxTaskCnt   int32
	CoinbaseAddr common.Address
	Workers      map[common.Address]*Worker
	// contains filtered or unexported fields
}

func NewLocalMiner

func NewLocalMiner(config Config, backend Backend) (*Miner, error)

func NewMiner

func NewMiner(config Config) (*Miner, error)

func (*Miner) Close

func (m *Miner) Close()

func (*Miner) CloseWorker

func (m *Miner) CloseWorker(addr common.Address)

func (*Miner) Loop

func (m *Miner) Loop()

func (*Miner) NewScanner

func (m *Miner) NewScanner(explorer Explorer)

func (*Miner) NewWorker

func (m *Miner) NewWorker(minerKey keypair.Key)

func (*Miner) StartScanner

func (m *Miner) StartScanner()

func (*Miner) StartWorker

func (m *Miner) StartWorker(addr common.Address)

func (*Miner) StopWorker

func (m *Miner) StopWorker(addr common.Address)

type Pledge

type Pledge struct {
	PledgeCaller     // Read-only binding to the contract
	PledgeTransactor // Write-only binding to the contract
	PledgeFilterer   // Log filterer for contract events
}

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

func NewPledge

func NewPledge(address common.Address, backend bind.ContractBackend) (*Pledge, error)

NewPledge creates a new instance of Pledge, bound to a specific deployed contract.

type PledgeCaller

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

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

func NewPledgeCaller

func NewPledgeCaller(address common.Address, caller bind.ContractCaller) (*PledgeCaller, error)

NewPledgeCaller creates a new read-only instance of Pledge, bound to a specific deployed contract.

func (*PledgeCaller) AllowWithdraw

func (_Pledge *PledgeCaller) AllowWithdraw(opts *bind.CallOpts, _index *big.Int, _curTime *big.Int) (bool, error)

AllowWithdraw is a free data retrieval call binding the contract method 0xa3bd4585.

Solidity: function allowWithdraw(uint256 _index, uint256 _curTime) view returns(bool)

func (*PledgeCaller) BorrowsRecard

func (_Pledge *PledgeCaller) BorrowsRecard(opts *bind.CallOpts, arg0 *big.Int) (struct {
	Index     *big.Int
	User      common.Address
	DepositAt uint32
	ExpireAt  uint32
	Nodes     uint32
	Amount    *big.Int
	Settled   bool
}, error)

BorrowsRecard is a free data retrieval call binding the contract method 0xe9d1fd0d.

Solidity: function borrowsRecard(uint256 ) view returns(uint256 index, address user, uint32 depositAt, uint32 expireAt, uint32 nodes, uint256 amount, bool settled)

func (*PledgeCaller) GetAddressQLF

func (_Pledge *PledgeCaller) GetAddressQLF(opts *bind.CallOpts) (common.Address, error)

GetAddressQLF is a free data retrieval call binding the contract method 0xa2de3904.

Solidity: function getAddressQLF() view returns(address)

func (*PledgeCaller) GetBlockTime

func (_Pledge *PledgeCaller) GetBlockTime(opts *bind.CallOpts) (*big.Int, error)

GetBlockTime is a free data retrieval call binding the contract method 0x87ceff09.

Solidity: function getBlockTime() view returns(uint256 time)

func (*PledgeCaller) GetBorrowsRecard

func (_Pledge *PledgeCaller) GetBorrowsRecard(opts *bind.CallOpts) ([]PledgeUserInfo, error)

GetBorrowsRecard is a free data retrieval call binding the contract method 0xecf57d4e.

Solidity: function getBorrowsRecard() view returns((uint256,address,uint32,uint32,uint32,uint256,bool)[])

func (*PledgeCaller) GetDepositsCoinbaseAddr

func (_Pledge *PledgeCaller) GetDepositsCoinbaseAddr(opts *bind.CallOpts, _sender common.Address) (common.Address, error)

GetDepositsCoinbaseAddr is a free data retrieval call binding the contract method 0xaaaca3cc.

Solidity: function getDepositsCoinbaseAddr(address _sender) view returns(address)

func (*PledgeCaller) GetLendingAccount

func (_Pledge *PledgeCaller) GetLendingAccount(opts *bind.CallOpts) (struct {
	TotalBorrow     *big.Int
	NotExpireBorrow *big.Int
	ExpireBorrow    *big.Int
}, error)

GetLendingAccount is a free data retrieval call binding the contract method 0xc86f1b71.

Solidity: function getLendingAccount() view returns(uint256 _totalBorrow, uint256 _notExpireBorrow, uint256 _expireBorrow)

func (*PledgeCaller) GetUserDeposits

func (_Pledge *PledgeCaller) GetUserDeposits(opts *bind.CallOpts, user common.Address) ([]PledgeUserInfo, error)

GetUserDeposits is a free data retrieval call binding the contract method 0x2a5bf6d2.

Solidity: function getUserDeposits(address user) view returns((uint256,address,uint32,uint32,uint32,uint256,bool)[])

func (*PledgeCaller) GetUserDepositsLending

func (_Pledge *PledgeCaller) GetUserDepositsLending(opts *bind.CallOpts) ([]*big.Int, error)

GetUserDepositsLending is a free data retrieval call binding the contract method 0xbebdca09.

Solidity: function getUserDepositsLending() view returns(uint256[])

func (*PledgeCaller) GetUserDepositsMininAddr

func (_Pledge *PledgeCaller) GetUserDepositsMininAddr(opts *bind.CallOpts, user common.Address) ([]common.Address, error)

GetUserDepositsMininAddr is a free data retrieval call binding the contract method 0xee4f542c.

Solidity: function getUserDepositsMininAddr(address user) view returns(address[])

func (*PledgeCaller) GetUserDepositsMininAddrLength

func (_Pledge *PledgeCaller) GetUserDepositsMininAddrLength(opts *bind.CallOpts) (*big.Int, error)

GetUserDepositsMininAddrLength is a free data retrieval call binding the contract method 0x9cf205bd.

Solidity: function getUserDepositsMininAddrLength() view returns(uint256)

func (*PledgeCaller) GetUserLendingDeposits

func (_Pledge *PledgeCaller) GetUserLendingDeposits(opts *bind.CallOpts, _sender common.Address) ([]PledgeUserInfo, error)

GetUserLendingDeposits is a free data retrieval call binding the contract method 0x013f9435.

Solidity: function getUserLendingDeposits(address _sender) view returns((uint256,address,uint32,uint32,uint32,uint256,bool)[])

func (*PledgeCaller) GetUserWithdraws

func (_Pledge *PledgeCaller) GetUserWithdraws(opts *bind.CallOpts, user common.Address) ([]PledgeWithdrawInfo, error)

GetUserWithdraws is a free data retrieval call binding the contract method 0x515d223a.

Solidity: function getUserWithdraws(address user) view returns((uint256,uint256,uint256,uint256)[])

func (*PledgeCaller) GetisWhiteList

func (_Pledge *PledgeCaller) GetisWhiteList(opts *bind.CallOpts) (bool, error)

GetisWhiteList is a free data retrieval call binding the contract method 0x2154d560.

Solidity: function getisWhiteList() view returns(bool)

func (*PledgeCaller) IsExtisAddress

func (_Pledge *PledgeCaller) IsExtisAddress(opts *bind.CallOpts, user common.Address) (bool, error)

IsExtisAddress is a free data retrieval call binding the contract method 0x2480f68c.

Solidity: function isExtisAddress(address user) view returns(bool)

func (*PledgeCaller) IsExtisBathAddress

func (_Pledge *PledgeCaller) IsExtisBathAddress(opts *bind.CallOpts, users []common.Address) (bool, error)

IsExtisBathAddress is a free data retrieval call binding the contract method 0xc3d30934.

Solidity: function isExtisBathAddress(address[] users) view returns(bool)

func (*PledgeCaller) IsValidateWhite

func (_Pledge *PledgeCaller) IsValidateWhite(opts *bind.CallOpts, user common.Address) (bool, error)

IsValidateWhite is a free data retrieval call binding the contract method 0xac574946.

Solidity: function isValidateWhite(address user) view returns(bool)

func (*PledgeCaller) Iseffective

func (_Pledge *PledgeCaller) Iseffective(opts *bind.CallOpts, user common.Address) (bool, error)

Iseffective is a free data retrieval call binding the contract method 0x13e286c4.

Solidity: function iseffective(address user) view returns(bool)

func (*PledgeCaller) IseffectiveNew

func (_Pledge *PledgeCaller) IseffectiveNew(opts *bind.CallOpts, user common.Address) (bool, common.Address, error)

IseffectiveNew is a free data retrieval call binding the contract method 0xb39a8baa.

Solidity: function iseffectiveNew(address user) view returns(bool, address)

func (*PledgeCaller) MinPledgeAmount

func (_Pledge *PledgeCaller) MinPledgeAmount(opts *bind.CallOpts) (*big.Int, error)

MinPledgeAmount is a free data retrieval call binding the contract method 0xec555e91.

Solidity: function minPledgeAmount() view returns(uint256)

func (*PledgeCaller) Owner

func (_Pledge *PledgeCaller) Owner(opts *bind.CallOpts) (common.Address, error)

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

Solidity: function owner() view returns(address)

func (*PledgeCaller) TotalBorrows

func (_Pledge *PledgeCaller) TotalBorrows(opts *bind.CallOpts) (*big.Int, error)

TotalBorrows is a free data retrieval call binding the contract method 0x47bd3718.

Solidity: function totalBorrows() view returns(uint256)

func (*PledgeCaller) UserDepositsLending

func (_Pledge *PledgeCaller) UserDepositsLending(opts *bind.CallOpts, arg0 common.Address, arg1 *big.Int) (*big.Int, error)

UserDepositsLending is a free data retrieval call binding the contract method 0xb787774a.

Solidity: function userDepositsLending(address , uint256 ) view returns(uint256)

type PledgeCallerRaw

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

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

func (*PledgeCallerRaw) Call

func (_Pledge *PledgeCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error

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

type PledgeCallerSession

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

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

func (*PledgeCallerSession) AllowWithdraw

func (_Pledge *PledgeCallerSession) AllowWithdraw(_index *big.Int, _curTime *big.Int) (bool, error)

AllowWithdraw is a free data retrieval call binding the contract method 0xa3bd4585.

Solidity: function allowWithdraw(uint256 _index, uint256 _curTime) view returns(bool)

func (*PledgeCallerSession) BorrowsRecard

func (_Pledge *PledgeCallerSession) BorrowsRecard(arg0 *big.Int) (struct {
	Index     *big.Int
	User      common.Address
	DepositAt uint32
	ExpireAt  uint32
	Nodes     uint32
	Amount    *big.Int
	Settled   bool
}, error)

BorrowsRecard is a free data retrieval call binding the contract method 0xe9d1fd0d.

Solidity: function borrowsRecard(uint256 ) view returns(uint256 index, address user, uint32 depositAt, uint32 expireAt, uint32 nodes, uint256 amount, bool settled)

func (*PledgeCallerSession) GetAddressQLF

func (_Pledge *PledgeCallerSession) GetAddressQLF() (common.Address, error)

GetAddressQLF is a free data retrieval call binding the contract method 0xa2de3904.

Solidity: function getAddressQLF() view returns(address)

func (*PledgeCallerSession) GetBlockTime

func (_Pledge *PledgeCallerSession) GetBlockTime() (*big.Int, error)

GetBlockTime is a free data retrieval call binding the contract method 0x87ceff09.

Solidity: function getBlockTime() view returns(uint256 time)

func (*PledgeCallerSession) GetBorrowsRecard

func (_Pledge *PledgeCallerSession) GetBorrowsRecard() ([]PledgeUserInfo, error)

GetBorrowsRecard is a free data retrieval call binding the contract method 0xecf57d4e.

Solidity: function getBorrowsRecard() view returns((uint256,address,uint32,uint32,uint32,uint256,bool)[])

func (*PledgeCallerSession) GetDepositsCoinbaseAddr

func (_Pledge *PledgeCallerSession) GetDepositsCoinbaseAddr(_sender common.Address) (common.Address, error)

GetDepositsCoinbaseAddr is a free data retrieval call binding the contract method 0xaaaca3cc.

Solidity: function getDepositsCoinbaseAddr(address _sender) view returns(address)

func (*PledgeCallerSession) GetLendingAccount

func (_Pledge *PledgeCallerSession) GetLendingAccount() (struct {
	TotalBorrow     *big.Int
	NotExpireBorrow *big.Int
	ExpireBorrow    *big.Int
}, error)

GetLendingAccount is a free data retrieval call binding the contract method 0xc86f1b71.

Solidity: function getLendingAccount() view returns(uint256 _totalBorrow, uint256 _notExpireBorrow, uint256 _expireBorrow)

func (*PledgeCallerSession) GetUserDeposits

func (_Pledge *PledgeCallerSession) GetUserDeposits(user common.Address) ([]PledgeUserInfo, error)

GetUserDeposits is a free data retrieval call binding the contract method 0x2a5bf6d2.

Solidity: function getUserDeposits(address user) view returns((uint256,address,uint32,uint32,uint32,uint256,bool)[])

func (*PledgeCallerSession) GetUserDepositsLending

func (_Pledge *PledgeCallerSession) GetUserDepositsLending() ([]*big.Int, error)

GetUserDepositsLending is a free data retrieval call binding the contract method 0xbebdca09.

Solidity: function getUserDepositsLending() view returns(uint256[])

func (*PledgeCallerSession) GetUserDepositsMininAddr

func (_Pledge *PledgeCallerSession) GetUserDepositsMininAddr(user common.Address) ([]common.Address, error)

GetUserDepositsMininAddr is a free data retrieval call binding the contract method 0xee4f542c.

Solidity: function getUserDepositsMininAddr(address user) view returns(address[])

func (*PledgeCallerSession) GetUserDepositsMininAddrLength

func (_Pledge *PledgeCallerSession) GetUserDepositsMininAddrLength() (*big.Int, error)

GetUserDepositsMininAddrLength is a free data retrieval call binding the contract method 0x9cf205bd.

Solidity: function getUserDepositsMininAddrLength() view returns(uint256)

func (*PledgeCallerSession) GetUserLendingDeposits

func (_Pledge *PledgeCallerSession) GetUserLendingDeposits(_sender common.Address) ([]PledgeUserInfo, error)

GetUserLendingDeposits is a free data retrieval call binding the contract method 0x013f9435.

Solidity: function getUserLendingDeposits(address _sender) view returns((uint256,address,uint32,uint32,uint32,uint256,bool)[])

func (*PledgeCallerSession) GetUserWithdraws

func (_Pledge *PledgeCallerSession) GetUserWithdraws(user common.Address) ([]PledgeWithdrawInfo, error)

GetUserWithdraws is a free data retrieval call binding the contract method 0x515d223a.

Solidity: function getUserWithdraws(address user) view returns((uint256,uint256,uint256,uint256)[])

func (*PledgeCallerSession) GetisWhiteList

func (_Pledge *PledgeCallerSession) GetisWhiteList() (bool, error)

GetisWhiteList is a free data retrieval call binding the contract method 0x2154d560.

Solidity: function getisWhiteList() view returns(bool)

func (*PledgeCallerSession) IsExtisAddress

func (_Pledge *PledgeCallerSession) IsExtisAddress(user common.Address) (bool, error)

IsExtisAddress is a free data retrieval call binding the contract method 0x2480f68c.

Solidity: function isExtisAddress(address user) view returns(bool)

func (*PledgeCallerSession) IsExtisBathAddress

func (_Pledge *PledgeCallerSession) IsExtisBathAddress(users []common.Address) (bool, error)

IsExtisBathAddress is a free data retrieval call binding the contract method 0xc3d30934.

Solidity: function isExtisBathAddress(address[] users) view returns(bool)

func (*PledgeCallerSession) IsValidateWhite

func (_Pledge *PledgeCallerSession) IsValidateWhite(user common.Address) (bool, error)

IsValidateWhite is a free data retrieval call binding the contract method 0xac574946.

Solidity: function isValidateWhite(address user) view returns(bool)

func (*PledgeCallerSession) Iseffective

func (_Pledge *PledgeCallerSession) Iseffective(user common.Address) (bool, error)

Iseffective is a free data retrieval call binding the contract method 0x13e286c4.

Solidity: function iseffective(address user) view returns(bool)

func (*PledgeCallerSession) IseffectiveNew

func (_Pledge *PledgeCallerSession) IseffectiveNew(user common.Address) (bool, common.Address, error)

IseffectiveNew is a free data retrieval call binding the contract method 0xb39a8baa.

Solidity: function iseffectiveNew(address user) view returns(bool, address)

func (*PledgeCallerSession) MinPledgeAmount

func (_Pledge *PledgeCallerSession) MinPledgeAmount() (*big.Int, error)

MinPledgeAmount is a free data retrieval call binding the contract method 0xec555e91.

Solidity: function minPledgeAmount() view returns(uint256)

func (*PledgeCallerSession) Owner

func (_Pledge *PledgeCallerSession) Owner() (common.Address, error)

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

Solidity: function owner() view returns(address)

func (*PledgeCallerSession) TotalBorrows

func (_Pledge *PledgeCallerSession) TotalBorrows() (*big.Int, error)

TotalBorrows is a free data retrieval call binding the contract method 0x47bd3718.

Solidity: function totalBorrows() view returns(uint256)

func (*PledgeCallerSession) UserDepositsLending

func (_Pledge *PledgeCallerSession) UserDepositsLending(arg0 common.Address, arg1 *big.Int) (*big.Int, error)

UserDepositsLending is a free data retrieval call binding the contract method 0xb787774a.

Solidity: function userDepositsLending(address , uint256 ) view returns(uint256)

type PledgeDeposit

type PledgeDeposit struct {
	Index  *big.Int
	User   common.Address
	Amount *big.Int
	Raw    types.Log // Blockchain specific contextual infos
}

PledgeDeposit represents a Deposit event raised by the Pledge contract.

type PledgeDepositIterator

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

PledgeDepositIterator is returned from FilterDeposit and is used to iterate over the raw logs and unpacked data for Deposit events raised by the Pledge contract.

func (*PledgeDepositIterator) Close

func (it *PledgeDepositIterator) Close() error

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

func (*PledgeDepositIterator) Error

func (it *PledgeDepositIterator) Error() error

Error returns any retrieval or parsing error occurred during filtering.

func (*PledgeDepositIterator) Next

func (it *PledgeDepositIterator) Next() bool

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

type PledgeFilterer

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

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

func NewPledgeFilterer

func NewPledgeFilterer(address common.Address, filterer bind.ContractFilterer) (*PledgeFilterer, error)

NewPledgeFilterer creates a new log filterer instance of Pledge, bound to a specific deployed contract.

func (*PledgeFilterer) FilterDeposit

func (_Pledge *PledgeFilterer) FilterDeposit(opts *bind.FilterOpts, user []common.Address) (*PledgeDepositIterator, error)

FilterDeposit is a free log retrieval operation binding the contract event 0xeaa18152488ce5959073c9c79c88ca90b3d96c00de1f118cfaad664c3dab06b9.

Solidity: event Deposit(uint256 index, address indexed user, uint256 amount)

func (*PledgeFilterer) FilterOwnershipTransferred

func (_Pledge *PledgeFilterer) FilterOwnershipTransferred(opts *bind.FilterOpts, previousOwner []common.Address, newOwner []common.Address) (*PledgeOwnershipTransferredIterator, error)

FilterOwnershipTransferred is a free log retrieval operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0.

Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner)

func (*PledgeFilterer) FilterWithdraw

func (_Pledge *PledgeFilterer) FilterWithdraw(opts *bind.FilterOpts, user []common.Address) (*PledgeWithdrawIterator, error)

FilterWithdraw is a free log retrieval operation binding the contract event 0x9da6493a92039daf47d1f2d7a782299c5994c6323eb1e972f69c432089ec52bf.

Solidity: event Withdraw(uint256 index, address indexed user, uint256 amount)

func (*PledgeFilterer) ParseDeposit

func (_Pledge *PledgeFilterer) ParseDeposit(log types.Log) (*PledgeDeposit, error)

ParseDeposit is a log parse operation binding the contract event 0xeaa18152488ce5959073c9c79c88ca90b3d96c00de1f118cfaad664c3dab06b9.

Solidity: event Deposit(uint256 index, address indexed user, uint256 amount)

func (*PledgeFilterer) ParseOwnershipTransferred

func (_Pledge *PledgeFilterer) ParseOwnershipTransferred(log types.Log) (*PledgeOwnershipTransferred, error)

ParseOwnershipTransferred is a log parse operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0.

Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner)

func (*PledgeFilterer) ParseWithdraw

func (_Pledge *PledgeFilterer) ParseWithdraw(log types.Log) (*PledgeWithdraw, error)

ParseWithdraw is a log parse operation binding the contract event 0x9da6493a92039daf47d1f2d7a782299c5994c6323eb1e972f69c432089ec52bf.

Solidity: event Withdraw(uint256 index, address indexed user, uint256 amount)

func (*PledgeFilterer) WatchDeposit

func (_Pledge *PledgeFilterer) WatchDeposit(opts *bind.WatchOpts, sink chan<- *PledgeDeposit, user []common.Address) (event.Subscription, error)

WatchDeposit is a free log subscription operation binding the contract event 0xeaa18152488ce5959073c9c79c88ca90b3d96c00de1f118cfaad664c3dab06b9.

Solidity: event Deposit(uint256 index, address indexed user, uint256 amount)

func (*PledgeFilterer) WatchOwnershipTransferred

func (_Pledge *PledgeFilterer) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *PledgeOwnershipTransferred, previousOwner []common.Address, newOwner []common.Address) (event.Subscription, error)

WatchOwnershipTransferred is a free log subscription operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0.

Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner)

func (*PledgeFilterer) WatchWithdraw

func (_Pledge *PledgeFilterer) WatchWithdraw(opts *bind.WatchOpts, sink chan<- *PledgeWithdraw, user []common.Address) (event.Subscription, error)

WatchWithdraw is a free log subscription operation binding the contract event 0x9da6493a92039daf47d1f2d7a782299c5994c6323eb1e972f69c432089ec52bf.

Solidity: event Withdraw(uint256 index, address indexed user, uint256 amount)

type PledgeOwnershipTransferred

type PledgeOwnershipTransferred struct {
	PreviousOwner common.Address
	NewOwner      common.Address
	Raw           types.Log // Blockchain specific contextual infos
}

PledgeOwnershipTransferred represents a OwnershipTransferred event raised by the Pledge contract.

type PledgeOwnershipTransferredIterator

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

PledgeOwnershipTransferredIterator is returned from FilterOwnershipTransferred and is used to iterate over the raw logs and unpacked data for OwnershipTransferred events raised by the Pledge contract.

func (*PledgeOwnershipTransferredIterator) Close

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

func (*PledgeOwnershipTransferredIterator) Error

Error returns any retrieval or parsing error occurred during filtering.

func (*PledgeOwnershipTransferredIterator) Next

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

type PledgeRaw

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

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

func (*PledgeRaw) Call

func (_Pledge *PledgeRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error

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

func (*PledgeRaw) Transact

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

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

func (*PledgeRaw) Transfer

func (_Pledge *PledgeRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error)

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

type PledgeSession

type PledgeSession struct {
	Contract     *Pledge           // 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
}

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

func (*PledgeSession) AddMininAddr

func (_Pledge *PledgeSession) AddMininAddr(_address common.Address, _flag bool) (*types.Transaction, error)

AddMininAddr is a paid mutator transaction binding the contract method 0xf0cbcb68.

Solidity: function addMininAddr(address _address, bool _flag) returns()

func (*PledgeSession) AllowWithdraw

func (_Pledge *PledgeSession) AllowWithdraw(_index *big.Int, _curTime *big.Int) (bool, error)

AllowWithdraw is a free data retrieval call binding the contract method 0xa3bd4585.

Solidity: function allowWithdraw(uint256 _index, uint256 _curTime) view returns(bool)

func (*PledgeSession) BorrowsRecard

func (_Pledge *PledgeSession) BorrowsRecard(arg0 *big.Int) (struct {
	Index     *big.Int
	User      common.Address
	DepositAt uint32
	ExpireAt  uint32
	Nodes     uint32
	Amount    *big.Int
	Settled   bool
}, error)

BorrowsRecard is a free data retrieval call binding the contract method 0xe9d1fd0d.

Solidity: function borrowsRecard(uint256 ) view returns(uint256 index, address user, uint32 depositAt, uint32 expireAt, uint32 nodes, uint256 amount, bool settled)

func (*PledgeSession) Deposit

func (_Pledge *PledgeSession) Deposit(_nodes *big.Int, _amount *big.Int, _addrs []common.Address, _expiredAt *big.Int) (*types.Transaction, error)

Deposit is a paid mutator transaction binding the contract method 0xf13e0b13.

Solidity: function deposit(uint256 _nodes, uint256 _amount, address[] _addrs, uint256 _expiredAt) payable returns()

func (*PledgeSession) DepositLending

func (_Pledge *PledgeSession) DepositLending(_sender common.Address, _nodes *big.Int, _amount *big.Int, _expiredAt *big.Int, _addrs []common.Address) (*types.Transaction, error)

DepositLending is a paid mutator transaction binding the contract method 0xa0fb9f0d.

Solidity: function depositLending(address _sender, uint256 _nodes, uint256 _amount, uint256 _expiredAt, address[] _addrs) payable returns()

func (*PledgeSession) GetAddressQLF

func (_Pledge *PledgeSession) GetAddressQLF() (common.Address, error)

GetAddressQLF is a free data retrieval call binding the contract method 0xa2de3904.

Solidity: function getAddressQLF() view returns(address)

func (*PledgeSession) GetBlockTime

func (_Pledge *PledgeSession) GetBlockTime() (*big.Int, error)

GetBlockTime is a free data retrieval call binding the contract method 0x87ceff09.

Solidity: function getBlockTime() view returns(uint256 time)

func (*PledgeSession) GetBorrowsRecard

func (_Pledge *PledgeSession) GetBorrowsRecard() ([]PledgeUserInfo, error)

GetBorrowsRecard is a free data retrieval call binding the contract method 0xecf57d4e.

Solidity: function getBorrowsRecard() view returns((uint256,address,uint32,uint32,uint32,uint256,bool)[])

func (*PledgeSession) GetDepositsCoinbaseAddr

func (_Pledge *PledgeSession) GetDepositsCoinbaseAddr(_sender common.Address) (common.Address, error)

GetDepositsCoinbaseAddr is a free data retrieval call binding the contract method 0xaaaca3cc.

Solidity: function getDepositsCoinbaseAddr(address _sender) view returns(address)

func (*PledgeSession) GetLendingAccount

func (_Pledge *PledgeSession) GetLendingAccount() (struct {
	TotalBorrow     *big.Int
	NotExpireBorrow *big.Int
	ExpireBorrow    *big.Int
}, error)

GetLendingAccount is a free data retrieval call binding the contract method 0xc86f1b71.

Solidity: function getLendingAccount() view returns(uint256 _totalBorrow, uint256 _notExpireBorrow, uint256 _expireBorrow)

func (*PledgeSession) GetUserDeposits

func (_Pledge *PledgeSession) GetUserDeposits(user common.Address) ([]PledgeUserInfo, error)

GetUserDeposits is a free data retrieval call binding the contract method 0x2a5bf6d2.

Solidity: function getUserDeposits(address user) view returns((uint256,address,uint32,uint32,uint32,uint256,bool)[])

func (*PledgeSession) GetUserDepositsLending

func (_Pledge *PledgeSession) GetUserDepositsLending() ([]*big.Int, error)

GetUserDepositsLending is a free data retrieval call binding the contract method 0xbebdca09.

Solidity: function getUserDepositsLending() view returns(uint256[])

func (*PledgeSession) GetUserDepositsMininAddr

func (_Pledge *PledgeSession) GetUserDepositsMininAddr(user common.Address) ([]common.Address, error)

GetUserDepositsMininAddr is a free data retrieval call binding the contract method 0xee4f542c.

Solidity: function getUserDepositsMininAddr(address user) view returns(address[])

func (*PledgeSession) GetUserDepositsMininAddrLength

func (_Pledge *PledgeSession) GetUserDepositsMininAddrLength() (*big.Int, error)

GetUserDepositsMininAddrLength is a free data retrieval call binding the contract method 0x9cf205bd.

Solidity: function getUserDepositsMininAddrLength() view returns(uint256)

func (*PledgeSession) GetUserLendingDeposits

func (_Pledge *PledgeSession) GetUserLendingDeposits(_sender common.Address) ([]PledgeUserInfo, error)

GetUserLendingDeposits is a free data retrieval call binding the contract method 0x013f9435.

Solidity: function getUserLendingDeposits(address _sender) view returns((uint256,address,uint32,uint32,uint32,uint256,bool)[])

func (*PledgeSession) GetUserWithdraws

func (_Pledge *PledgeSession) GetUserWithdraws(user common.Address) ([]PledgeWithdrawInfo, error)

GetUserWithdraws is a free data retrieval call binding the contract method 0x515d223a.

Solidity: function getUserWithdraws(address user) view returns((uint256,uint256,uint256,uint256)[])

func (*PledgeSession) GetisWhiteList

func (_Pledge *PledgeSession) GetisWhiteList() (bool, error)

GetisWhiteList is a free data retrieval call binding the contract method 0x2154d560.

Solidity: function getisWhiteList() view returns(bool)

func (*PledgeSession) Initialize

func (_Pledge *PledgeSession) Initialize() (*types.Transaction, error)

Initialize is a paid mutator transaction binding the contract method 0x8129fc1c.

Solidity: function initialize() returns()

func (*PledgeSession) IsExtisAddress

func (_Pledge *PledgeSession) IsExtisAddress(user common.Address) (bool, error)

IsExtisAddress is a free data retrieval call binding the contract method 0x2480f68c.

Solidity: function isExtisAddress(address user) view returns(bool)

func (*PledgeSession) IsExtisBathAddress

func (_Pledge *PledgeSession) IsExtisBathAddress(users []common.Address) (bool, error)

IsExtisBathAddress is a free data retrieval call binding the contract method 0xc3d30934.

Solidity: function isExtisBathAddress(address[] users) view returns(bool)

func (*PledgeSession) IsValidateWhite

func (_Pledge *PledgeSession) IsValidateWhite(user common.Address) (bool, error)

IsValidateWhite is a free data retrieval call binding the contract method 0xac574946.

Solidity: function isValidateWhite(address user) view returns(bool)

func (*PledgeSession) Iseffective

func (_Pledge *PledgeSession) Iseffective(user common.Address) (bool, error)

Iseffective is a free data retrieval call binding the contract method 0x13e286c4.

Solidity: function iseffective(address user) view returns(bool)

func (*PledgeSession) IseffectiveNew

func (_Pledge *PledgeSession) IseffectiveNew(user common.Address) (bool, common.Address, error)

IseffectiveNew is a free data retrieval call binding the contract method 0xb39a8baa.

Solidity: function iseffectiveNew(address user) view returns(bool, address)

func (*PledgeSession) MinPledgeAmount

func (_Pledge *PledgeSession) MinPledgeAmount() (*big.Int, error)

MinPledgeAmount is a free data retrieval call binding the contract method 0xec555e91.

Solidity: function minPledgeAmount() view returns(uint256)

func (*PledgeSession) Owner

func (_Pledge *PledgeSession) Owner() (common.Address, error)

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

Solidity: function owner() view returns(address)

func (*PledgeSession) Receive

func (_Pledge *PledgeSession) Receive() (*types.Transaction, error)

Receive is a paid mutator transaction binding the contract receive function.

Solidity: receive() payable returns()

func (*PledgeSession) RenounceOwnership

func (_Pledge *PledgeSession) RenounceOwnership() (*types.Transaction, error)

RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6.

Solidity: function renounceOwnership() returns()

func (*PledgeSession) SetAddressQLF

func (_Pledge *PledgeSession) SetAddressQLF(_qlf common.Address, _isWhiteList bool) (*types.Transaction, error)

SetAddressQLF is a paid mutator transaction binding the contract method 0x13f3c4b9.

Solidity: function setAddressQLF(address _qlf, bool _isWhiteList) returns()

func (*PledgeSession) SetLockTime

func (_Pledge *PledgeSession) SetLockTime(_lockTime *big.Int) (*types.Transaction, error)

SetLockTime is a paid mutator transaction binding the contract method 0xae04d45d.

Solidity: function setLockTime(uint256 _lockTime) returns()

func (*PledgeSession) SetMinPledgeAmount

func (_Pledge *PledgeSession) SetMinPledgeAmount(_time *big.Int) (*types.Transaction, error)

SetMinPledgeAmount is a paid mutator transaction binding the contract method 0x573fe31f.

Solidity: function setMinPledgeAmount(uint256 _time) returns()

func (*PledgeSession) SetPaused

func (_Pledge *PledgeSession) SetPaused(_isDepositPaused bool, _isWithdrawPaused bool) (*types.Transaction, error)

SetPaused is a paid mutator transaction binding the contract method 0x6426be48.

Solidity: function setPaused(bool _isDepositPaused, bool _isWithdrawPaused) returns()

func (*PledgeSession) SetProjectStartTime

func (_Pledge *PledgeSession) SetProjectStartTime(_projectStartTime *big.Int) (*types.Transaction, error)

SetProjectStartTime is a paid mutator transaction binding the contract method 0xc6d1f78d.

Solidity: function setProjectStartTime(uint256 _projectStartTime) returns()

func (*PledgeSession) SetdataMigration

func (_Pledge *PledgeSession) SetdataMigration(_address common.Address, _expireAt *big.Int) (*types.Transaction, error)

SetdataMigration is a paid mutator transaction binding the contract method 0x6e2c9c91.

Solidity: function setdataMigration(address _address, uint256 _expireAt) returns()

func (*PledgeSession) TotalBorrows

func (_Pledge *PledgeSession) TotalBorrows() (*big.Int, error)

TotalBorrows is a free data retrieval call binding the contract method 0x47bd3718.

Solidity: function totalBorrows() view returns(uint256)

func (*PledgeSession) TransferOwnership

func (_Pledge *PledgeSession) TransferOwnership(newOwner common.Address) (*types.Transaction, error)

TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b.

Solidity: function transferOwnership(address newOwner) returns()

func (*PledgeSession) UpdateDepositsCoinbaseAddr

func (_Pledge *PledgeSession) UpdateDepositsCoinbaseAddr(_replace common.Address) (*types.Transaction, error)

UpdateDepositsCoinbaseAddr is a paid mutator transaction binding the contract method 0x01d3a7de.

Solidity: function updateDepositsCoinbaseAddr(address _replace) returns()

func (*PledgeSession) UpdateDepositsMininAddress

func (_Pledge *PledgeSession) UpdateDepositsMininAddress(_user common.Address, _oldAddress common.Address, _index *big.Int, _replace common.Address) (*types.Transaction, error)

UpdateDepositsMininAddress is a paid mutator transaction binding the contract method 0xc91048c7.

Solidity: function updateDepositsMininAddress(address _user, address _oldAddress, uint256 _index, address _replace) returns()

func (*PledgeSession) UserDepositsLending

func (_Pledge *PledgeSession) UserDepositsLending(arg0 common.Address, arg1 *big.Int) (*big.Int, error)

UserDepositsLending is a free data retrieval call binding the contract method 0xb787774a.

Solidity: function userDepositsLending(address , uint256 ) view returns(uint256)

func (*PledgeSession) Withdraw

func (_Pledge *PledgeSession) Withdraw(_index *big.Int, _receiver common.Address) (*types.Transaction, error)

Withdraw is a paid mutator transaction binding the contract method 0x00f714ce.

Solidity: function withdraw(uint256 _index, address _receiver) returns()

type PledgeTransactor

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

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

func NewPledgeTransactor

func NewPledgeTransactor(address common.Address, transactor bind.ContractTransactor) (*PledgeTransactor, error)

NewPledgeTransactor creates a new write-only instance of Pledge, bound to a specific deployed contract.

func (*PledgeTransactor) AddMininAddr

func (_Pledge *PledgeTransactor) AddMininAddr(opts *bind.TransactOpts, _address common.Address, _flag bool) (*types.Transaction, error)

AddMininAddr is a paid mutator transaction binding the contract method 0xf0cbcb68.

Solidity: function addMininAddr(address _address, bool _flag) returns()

func (*PledgeTransactor) Deposit

func (_Pledge *PledgeTransactor) Deposit(opts *bind.TransactOpts, _nodes *big.Int, _amount *big.Int, _addrs []common.Address, _expiredAt *big.Int) (*types.Transaction, error)

Deposit is a paid mutator transaction binding the contract method 0xf13e0b13.

Solidity: function deposit(uint256 _nodes, uint256 _amount, address[] _addrs, uint256 _expiredAt) payable returns()

func (*PledgeTransactor) DepositLending

func (_Pledge *PledgeTransactor) DepositLending(opts *bind.TransactOpts, _sender common.Address, _nodes *big.Int, _amount *big.Int, _expiredAt *big.Int, _addrs []common.Address) (*types.Transaction, error)

DepositLending is a paid mutator transaction binding the contract method 0xa0fb9f0d.

Solidity: function depositLending(address _sender, uint256 _nodes, uint256 _amount, uint256 _expiredAt, address[] _addrs) payable returns()

func (*PledgeTransactor) Initialize

func (_Pledge *PledgeTransactor) Initialize(opts *bind.TransactOpts) (*types.Transaction, error)

Initialize is a paid mutator transaction binding the contract method 0x8129fc1c.

Solidity: function initialize() returns()

func (*PledgeTransactor) Receive

func (_Pledge *PledgeTransactor) Receive(opts *bind.TransactOpts) (*types.Transaction, error)

Receive is a paid mutator transaction binding the contract receive function.

Solidity: receive() payable returns()

func (*PledgeTransactor) RenounceOwnership

func (_Pledge *PledgeTransactor) RenounceOwnership(opts *bind.TransactOpts) (*types.Transaction, error)

RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6.

Solidity: function renounceOwnership() returns()

func (*PledgeTransactor) SetAddressQLF

func (_Pledge *PledgeTransactor) SetAddressQLF(opts *bind.TransactOpts, _qlf common.Address, _isWhiteList bool) (*types.Transaction, error)

SetAddressQLF is a paid mutator transaction binding the contract method 0x13f3c4b9.

Solidity: function setAddressQLF(address _qlf, bool _isWhiteList) returns()

func (*PledgeTransactor) SetLockTime

func (_Pledge *PledgeTransactor) SetLockTime(opts *bind.TransactOpts, _lockTime *big.Int) (*types.Transaction, error)

SetLockTime is a paid mutator transaction binding the contract method 0xae04d45d.

Solidity: function setLockTime(uint256 _lockTime) returns()

func (*PledgeTransactor) SetMinPledgeAmount

func (_Pledge *PledgeTransactor) SetMinPledgeAmount(opts *bind.TransactOpts, _time *big.Int) (*types.Transaction, error)

SetMinPledgeAmount is a paid mutator transaction binding the contract method 0x573fe31f.

Solidity: function setMinPledgeAmount(uint256 _time) returns()

func (*PledgeTransactor) SetPaused

func (_Pledge *PledgeTransactor) SetPaused(opts *bind.TransactOpts, _isDepositPaused bool, _isWithdrawPaused bool) (*types.Transaction, error)

SetPaused is a paid mutator transaction binding the contract method 0x6426be48.

Solidity: function setPaused(bool _isDepositPaused, bool _isWithdrawPaused) returns()

func (*PledgeTransactor) SetProjectStartTime

func (_Pledge *PledgeTransactor) SetProjectStartTime(opts *bind.TransactOpts, _projectStartTime *big.Int) (*types.Transaction, error)

SetProjectStartTime is a paid mutator transaction binding the contract method 0xc6d1f78d.

Solidity: function setProjectStartTime(uint256 _projectStartTime) returns()

func (*PledgeTransactor) SetdataMigration

func (_Pledge *PledgeTransactor) SetdataMigration(opts *bind.TransactOpts, _address common.Address, _expireAt *big.Int) (*types.Transaction, error)

SetdataMigration is a paid mutator transaction binding the contract method 0x6e2c9c91.

Solidity: function setdataMigration(address _address, uint256 _expireAt) returns()

func (*PledgeTransactor) TransferOwnership

func (_Pledge *PledgeTransactor) TransferOwnership(opts *bind.TransactOpts, newOwner common.Address) (*types.Transaction, error)

TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b.

Solidity: function transferOwnership(address newOwner) returns()

func (*PledgeTransactor) UpdateDepositsCoinbaseAddr

func (_Pledge *PledgeTransactor) UpdateDepositsCoinbaseAddr(opts *bind.TransactOpts, _replace common.Address) (*types.Transaction, error)

UpdateDepositsCoinbaseAddr is a paid mutator transaction binding the contract method 0x01d3a7de.

Solidity: function updateDepositsCoinbaseAddr(address _replace) returns()

func (*PledgeTransactor) UpdateDepositsMininAddress

func (_Pledge *PledgeTransactor) UpdateDepositsMininAddress(opts *bind.TransactOpts, _user common.Address, _oldAddress common.Address, _index *big.Int, _replace common.Address) (*types.Transaction, error)

UpdateDepositsMininAddress is a paid mutator transaction binding the contract method 0xc91048c7.

Solidity: function updateDepositsMininAddress(address _user, address _oldAddress, uint256 _index, address _replace) returns()

func (*PledgeTransactor) Withdraw

func (_Pledge *PledgeTransactor) Withdraw(opts *bind.TransactOpts, _index *big.Int, _receiver common.Address) (*types.Transaction, error)

Withdraw is a paid mutator transaction binding the contract method 0x00f714ce.

Solidity: function withdraw(uint256 _index, address _receiver) returns()

type PledgeTransactorRaw

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

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

func (*PledgeTransactorRaw) Transact

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

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

func (*PledgeTransactorRaw) Transfer

func (_Pledge *PledgeTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error)

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

type PledgeTransactorSession

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

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

func (*PledgeTransactorSession) AddMininAddr

func (_Pledge *PledgeTransactorSession) AddMininAddr(_address common.Address, _flag bool) (*types.Transaction, error)

AddMininAddr is a paid mutator transaction binding the contract method 0xf0cbcb68.

Solidity: function addMininAddr(address _address, bool _flag) returns()

func (*PledgeTransactorSession) Deposit

func (_Pledge *PledgeTransactorSession) Deposit(_nodes *big.Int, _amount *big.Int, _addrs []common.Address, _expiredAt *big.Int) (*types.Transaction, error)

Deposit is a paid mutator transaction binding the contract method 0xf13e0b13.

Solidity: function deposit(uint256 _nodes, uint256 _amount, address[] _addrs, uint256 _expiredAt) payable returns()

func (*PledgeTransactorSession) DepositLending

func (_Pledge *PledgeTransactorSession) DepositLending(_sender common.Address, _nodes *big.Int, _amount *big.Int, _expiredAt *big.Int, _addrs []common.Address) (*types.Transaction, error)

DepositLending is a paid mutator transaction binding the contract method 0xa0fb9f0d.

Solidity: function depositLending(address _sender, uint256 _nodes, uint256 _amount, uint256 _expiredAt, address[] _addrs) payable returns()

func (*PledgeTransactorSession) Initialize

func (_Pledge *PledgeTransactorSession) Initialize() (*types.Transaction, error)

Initialize is a paid mutator transaction binding the contract method 0x8129fc1c.

Solidity: function initialize() returns()

func (*PledgeTransactorSession) Receive

func (_Pledge *PledgeTransactorSession) Receive() (*types.Transaction, error)

Receive is a paid mutator transaction binding the contract receive function.

Solidity: receive() payable returns()

func (*PledgeTransactorSession) RenounceOwnership

func (_Pledge *PledgeTransactorSession) RenounceOwnership() (*types.Transaction, error)

RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6.

Solidity: function renounceOwnership() returns()

func (*PledgeTransactorSession) SetAddressQLF

func (_Pledge *PledgeTransactorSession) SetAddressQLF(_qlf common.Address, _isWhiteList bool) (*types.Transaction, error)

SetAddressQLF is a paid mutator transaction binding the contract method 0x13f3c4b9.

Solidity: function setAddressQLF(address _qlf, bool _isWhiteList) returns()

func (*PledgeTransactorSession) SetLockTime

func (_Pledge *PledgeTransactorSession) SetLockTime(_lockTime *big.Int) (*types.Transaction, error)

SetLockTime is a paid mutator transaction binding the contract method 0xae04d45d.

Solidity: function setLockTime(uint256 _lockTime) returns()

func (*PledgeTransactorSession) SetMinPledgeAmount

func (_Pledge *PledgeTransactorSession) SetMinPledgeAmount(_time *big.Int) (*types.Transaction, error)

SetMinPledgeAmount is a paid mutator transaction binding the contract method 0x573fe31f.

Solidity: function setMinPledgeAmount(uint256 _time) returns()

func (*PledgeTransactorSession) SetPaused

func (_Pledge *PledgeTransactorSession) SetPaused(_isDepositPaused bool, _isWithdrawPaused bool) (*types.Transaction, error)

SetPaused is a paid mutator transaction binding the contract method 0x6426be48.

Solidity: function setPaused(bool _isDepositPaused, bool _isWithdrawPaused) returns()

func (*PledgeTransactorSession) SetProjectStartTime

func (_Pledge *PledgeTransactorSession) SetProjectStartTime(_projectStartTime *big.Int) (*types.Transaction, error)

SetProjectStartTime is a paid mutator transaction binding the contract method 0xc6d1f78d.

Solidity: function setProjectStartTime(uint256 _projectStartTime) returns()

func (*PledgeTransactorSession) SetdataMigration

func (_Pledge *PledgeTransactorSession) SetdataMigration(_address common.Address, _expireAt *big.Int) (*types.Transaction, error)

SetdataMigration is a paid mutator transaction binding the contract method 0x6e2c9c91.

Solidity: function setdataMigration(address _address, uint256 _expireAt) returns()

func (*PledgeTransactorSession) TransferOwnership

func (_Pledge *PledgeTransactorSession) TransferOwnership(newOwner common.Address) (*types.Transaction, error)

TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b.

Solidity: function transferOwnership(address newOwner) returns()

func (*PledgeTransactorSession) UpdateDepositsCoinbaseAddr

func (_Pledge *PledgeTransactorSession) UpdateDepositsCoinbaseAddr(_replace common.Address) (*types.Transaction, error)

UpdateDepositsCoinbaseAddr is a paid mutator transaction binding the contract method 0x01d3a7de.

Solidity: function updateDepositsCoinbaseAddr(address _replace) returns()

func (*PledgeTransactorSession) UpdateDepositsMininAddress

func (_Pledge *PledgeTransactorSession) UpdateDepositsMininAddress(_user common.Address, _oldAddress common.Address, _index *big.Int, _replace common.Address) (*types.Transaction, error)

UpdateDepositsMininAddress is a paid mutator transaction binding the contract method 0xc91048c7.

Solidity: function updateDepositsMininAddress(address _user, address _oldAddress, uint256 _index, address _replace) returns()

func (*PledgeTransactorSession) Withdraw

func (_Pledge *PledgeTransactorSession) Withdraw(_index *big.Int, _receiver common.Address) (*types.Transaction, error)

Withdraw is a paid mutator transaction binding the contract method 0x00f714ce.

Solidity: function withdraw(uint256 _index, address _receiver) returns()

type PledgeUserInfo

type PledgeUserInfo struct {
	Index     *big.Int
	User      common.Address
	DepositAt uint32
	ExpireAt  uint32
	Nodes     uint32
	Amount    *big.Int
	Settled   bool
}

PledgeUserInfo is an auto generated low-level Go binding around an user-defined struct.

type PledgeWithdraw

type PledgeWithdraw struct {
	Index  *big.Int
	User   common.Address
	Amount *big.Int
	Raw    types.Log // Blockchain specific contextual infos
}

PledgeWithdraw represents a Withdraw event raised by the Pledge contract.

type PledgeWithdrawInfo

type PledgeWithdrawInfo struct {
	Index      *big.Int
	WithdrawAt *big.Int
	UIndex     *big.Int
	WAmount    *big.Int
}

PledgeWithdrawInfo is an auto generated low-level Go binding around an user-defined struct.

type PledgeWithdrawIterator

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

PledgeWithdrawIterator is returned from FilterWithdraw and is used to iterate over the raw logs and unpacked data for Withdraw events raised by the Pledge contract.

func (*PledgeWithdrawIterator) Close

func (it *PledgeWithdrawIterator) Close() error

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

func (*PledgeWithdrawIterator) Error

func (it *PledgeWithdrawIterator) Error() error

Error returns any retrieval or parsing error occurred during filtering.

func (*PledgeWithdrawIterator) Next

func (it *PledgeWithdrawIterator) Next() bool

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

type RpcExplorer

type RpcExplorer struct {
	Client   *rpc.Client
	Sub      ethereum.Subscription
	HeaderCh chan types.HeaderShort

	WsUrl string
	// contains filtered or unexported fields
}

func (*RpcExplorer) GetHeaderByNum

func (r *RpcExplorer) GetHeaderByNum(num uint64) *types.Header

func (*RpcExplorer) GetHeaderChan

func (r *RpcExplorer) GetHeaderChan() chan types.HeaderShort

type Scanner

type Scanner struct {
	CoinbaseAddr            common.Address
	BestScore               *big.Int
	LastBlockHeight         Height
	CoinbaseInterval        Height
	LastCoinbaseHeight      Height
	LastCoinbaseHeaderShort types.HeaderShort
	// contains filtered or unexported fields
}

func (*Scanner) CleanStatus

func (s *Scanner) CleanStatus()

func (*Scanner) GetHeader

func (s *Scanner) GetHeader(height Height) (*types.Header, error)

todo: improve robustness, add some retries

func (*Scanner) IfCoinBase

func (s *Scanner) IfCoinBase(h types.HeaderShort) bool

func (*Scanner) IsClosed

func (s *Scanner) IsClosed() bool

func (*Scanner) IsRunning

func (s *Scanner) IsRunning() bool

func (*Scanner) IsUpdating

func (s *Scanner) IsUpdating() bool

func (*Scanner) Loop

func (s *Scanner) Loop()

func (*Scanner) NewTask

func (s *Scanner) NewTask(h types.HeaderShort) Task

func (*Scanner) Submit

func (s *Scanner) Submit(task *Task)

type Task

type Task struct {
	CoinbaseAddr common.Address

	Step TaskStep
	// contains filtered or unexported fields
}

func SetTaskMinerAddr

func SetTaskMinerAddr(template *Task, minerAddr common.Address) Task

SetTaskMinerAddr only use in TASKSTART step

func (*Task) SetCoinbaseAddr

func (t *Task) SetCoinbaseAddr(coinbaseAddr common.Address)

func (*Task) SetHeader

func (t *Task) SetHeader(h types.HeaderShort)

type TaskStep

type TaskStep int
const (
	TASKSTART TaskStep = iota
	TASKWAITCHALLENGEBLOCK
	TASKGETCHALLENGEBLOCK
	TASKPROBLEMSOLVED
	TASKSUBMITTED
)

type Worker

type Worker struct {
	MaxTaskCnt   int32
	CoinbaseAddr common.Address
	// contains filtered or unexported fields
}

func (*Worker) HandleChallengedTask

func (w *Worker) HandleChallengedTask(task *Task) error

func (*Worker) HandleStartTask

func (w *Worker) HandleStartTask(task *Task) error

func (*Worker) HandleTaskAfterChallenge

func (w *Worker) HandleTaskAfterChallenge(header types.HeaderShort, task *Task) error

func (*Worker) HandlerTaskBeforeChallenge

func (w *Worker) HandlerTaskBeforeChallenge(task *Task) error

func (*Worker) Loop

func (w *Worker) Loop()

func (*Worker) SignLottery

func (w *Worker) SignLottery(task *Task) error

func (*Worker) SolveProblem

func (w *Worker) SolveProblem(task *Task) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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