Documentation
¶
Index ¶
- Variables
- func GetVirtualAddress(byteCode []byte, constructor []byte, nonce uint64) []byte
- type AppChannel
- type AppClient
- func (c *AppClient) DeleteAppChannel(cid string)
- func (c *AppClient) EnsureAppChannelDeployed(cid string) (ctype.Addr, error)
- func (c *AppClient) GetAppChannel(cid string) *AppChannel
- func (c *AppClient) GetAppChannelDeployedAddr(cid string) (ctype.Addr, error)
- func (c *AppClient) GetBooleanOutcome(cid string, query []byte) (bool, bool, error)
- func (c *AppClient) NewAppChannelOnVirtualContract(byteCode []byte, constructor []byte, nonce uint64) (string, error)
- func (c *AppClient) PutAppChannel(cid string, appChannel *AppChannel)
- type IBooleanCond
- type IBooleanCondCaller
- type IBooleanCondCallerRaw
- type IBooleanCondCallerSession
- type IBooleanCondFilterer
- type IBooleanCondRaw
- func (_IBooleanCond *IBooleanCondRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, ...) error
- func (_IBooleanCond *IBooleanCondRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error)
- func (_IBooleanCond *IBooleanCondRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error)
- type IBooleanCondSession
- type IBooleanCondTransactor
- type IBooleanCondTransactorRaw
- type IBooleanCondTransactorSession
Constants ¶
This section is empty.
Variables ¶
var IBooleanCondABI = IBooleanCondMetaData.ABI
IBooleanCondABI is the input ABI used to generate the binding from. Deprecated: Use IBooleanCondMetaData.ABI instead.
var IBooleanCondMetaData = &bind.MetaData{
ABI: "[{\"type\":\"function\",\"name\":\"getOutcome\",\"inputs\":[{\"name\":\"_query\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[{\"name\":\"\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"isFinalized\",\"inputs\":[{\"name\":\"_query\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[{\"name\":\"\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"view\"}]",
}
IBooleanCondMetaData contains all meta data concerning the IBooleanCond contract.
Functions ¶
func GetVirtualAddress ¶
GetVirtualAddress derives the deterministic virtual-contract address from `(bytecode, constructor, nonce)`. Used both at registration time (to compute the session id) and at deploy time (to look up the eventual on-chain address in the virt-resolver).
Types ¶
type AppChannel ¶
type AppChannel struct {
// contains filtered or unexported fields
}
AppChannel tracks a registered VIRTUAL_CONTRACT condition contract: the bytecode + constructor + nonce that determine its deterministic address, and (after the first deploy-on-query) the on-chain deployed address. All fields are unexported so external readers go through `AppClient` methods, which take `mu` to serialize the read-decide-write window in `deployIfNeeded`.
`mu` serializes deploy-on-query so concurrent callers can't both submit deploy transactions for the same channel. It is held across the on-chain deploy submission in `deployIfNeeded`; concurrent gRPC requests for the same cid serialize for ~one block time on the first query and pass straight through afterward. `IBooleanCond.IsFinalized` / `GetOutcome` in `GetBooleanOutcome` are called outside the lock so post-deploy reads do not block on each other.
type AppClient ¶
type AppClient struct {
// contains filtered or unexported fields
}
func NewAppClient ¶
func NewAppClient( nodeConfig common.GlobalNodeConfig, transactorPool *eth.TransactorPool, ) *AppClient
func (*AppClient) DeleteAppChannel ¶
DeleteAppChannel removes the in-memory bookkeeping for a registered virtual condition contract. It does not touch any on-chain state.
func (*AppClient) EnsureAppChannelDeployed ¶ added in v1.2.1
EnsureAppChannelDeployed deploys the registered virtual condition contract on-chain if it isn't already, and returns the deployed address. Useful for callers that need the contract on-chain but don't have a query to run (e.g. `PayResolver.resolvePaymentByConditions`, which calls `VirtContractResolver.resolve(virtAddr)` and reverts with "Nonexistent virtual address" otherwise).
func (*AppClient) GetAppChannel ¶
func (c *AppClient) GetAppChannel(cid string) *AppChannel
func (*AppClient) GetAppChannelDeployedAddr ¶
GetAppChannelDeployedAddr returns the on-chain deployed address of a registered virtual condition contract. If the contract has not been deployed yet, it probes the virt-resolver registry; returns an error if not deployed.
func (*AppClient) GetBooleanOutcome ¶
GetBooleanOutcome queries `IBooleanCond.{isFinalized,getOutcome}` for the registered condition contract, triggering deploy-on-query if the virtual contract has not been deployed yet. The same query bytes go to both calls (matches what `PayResolver` does on-chain). When `isFinalized` returns false `getOutcome` is not called — `PayResolver` short-circuits the same way, and a strict `IBooleanCond` is free to revert on `getOutcome` before finalization.
func (*AppClient) NewAppChannelOnVirtualContract ¶
func (c *AppClient) NewAppChannelOnVirtualContract( byteCode []byte, constructor []byte, nonce uint64) (string, error)
NewAppChannelOnVirtualContract registers a VIRTUAL_CONTRACT condition contract. The cnode stores the bytecode + constructor + nonce so that, when dispute resolution requires it, the contract can be deployed on-chain and queried via `IBooleanCond.{isFinalized,getOutcome}`. Returns the deterministic virtual-contract address (hex) used as the session id / `OnChainAddress` in `Condition` payloads.
func (*AppClient) PutAppChannel ¶
func (c *AppClient) PutAppChannel(cid string, appChannel *AppChannel)
type IBooleanCond ¶ added in v1.2.0
type IBooleanCond struct {
IBooleanCondCaller // Read-only binding to the contract
IBooleanCondTransactor // Write-only binding to the contract
IBooleanCondFilterer // Log filterer for contract events
}
IBooleanCond is an auto generated Go binding around an Ethereum contract.
func NewIBooleanCond ¶ added in v1.2.0
func NewIBooleanCond(address common.Address, backend bind.ContractBackend) (*IBooleanCond, error)
NewIBooleanCond creates a new instance of IBooleanCond, bound to a specific deployed contract.
type IBooleanCondCaller ¶ added in v1.2.0
type IBooleanCondCaller struct {
// contains filtered or unexported fields
}
IBooleanCondCaller is an auto generated read-only Go binding around an Ethereum contract.
func NewIBooleanCondCaller ¶ added in v1.2.0
func NewIBooleanCondCaller(address common.Address, caller bind.ContractCaller) (*IBooleanCondCaller, error)
NewIBooleanCondCaller creates a new read-only instance of IBooleanCond, bound to a specific deployed contract.
func (*IBooleanCondCaller) GetOutcome ¶ added in v1.2.0
func (_IBooleanCond *IBooleanCondCaller) GetOutcome(opts *bind.CallOpts, _query []byte) (bool, error)
GetOutcome is a free data retrieval call binding the contract method 0xea4ba8eb.
Solidity: function getOutcome(bytes _query) view returns(bool)
func (*IBooleanCondCaller) IsFinalized ¶ added in v1.2.0
func (_IBooleanCond *IBooleanCondCaller) IsFinalized(opts *bind.CallOpts, _query []byte) (bool, error)
IsFinalized is a free data retrieval call binding the contract method 0xbcdbda94.
Solidity: function isFinalized(bytes _query) view returns(bool)
type IBooleanCondCallerRaw ¶ added in v1.2.0
type IBooleanCondCallerRaw struct {
Contract *IBooleanCondCaller // Generic read-only contract binding to access the raw methods on
}
IBooleanCondCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract.
func (*IBooleanCondCallerRaw) Call ¶ added in v1.2.0
func (_IBooleanCond *IBooleanCondCallerRaw) 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 IBooleanCondCallerSession ¶ added in v1.2.0
type IBooleanCondCallerSession struct {
Contract *IBooleanCondCaller // Generic contract caller binding to set the session for
CallOpts bind.CallOpts // Call options to use throughout this session
}
IBooleanCondCallerSession is an auto generated read-only Go binding around an Ethereum contract, with pre-set call options.
func (*IBooleanCondCallerSession) GetOutcome ¶ added in v1.2.0
func (_IBooleanCond *IBooleanCondCallerSession) GetOutcome(_query []byte) (bool, error)
GetOutcome is a free data retrieval call binding the contract method 0xea4ba8eb.
Solidity: function getOutcome(bytes _query) view returns(bool)
func (*IBooleanCondCallerSession) IsFinalized ¶ added in v1.2.0
func (_IBooleanCond *IBooleanCondCallerSession) IsFinalized(_query []byte) (bool, error)
IsFinalized is a free data retrieval call binding the contract method 0xbcdbda94.
Solidity: function isFinalized(bytes _query) view returns(bool)
type IBooleanCondFilterer ¶ added in v1.2.0
type IBooleanCondFilterer struct {
// contains filtered or unexported fields
}
IBooleanCondFilterer is an auto generated log filtering Go binding around an Ethereum contract events.
func NewIBooleanCondFilterer ¶ added in v1.2.0
func NewIBooleanCondFilterer(address common.Address, filterer bind.ContractFilterer) (*IBooleanCondFilterer, error)
NewIBooleanCondFilterer creates a new log filterer instance of IBooleanCond, bound to a specific deployed contract.
type IBooleanCondRaw ¶ added in v1.2.0
type IBooleanCondRaw struct {
Contract *IBooleanCond // Generic contract binding to access the raw methods on
}
IBooleanCondRaw is an auto generated low-level Go binding around an Ethereum contract.
func (*IBooleanCondRaw) Call ¶ added in v1.2.0
func (_IBooleanCond *IBooleanCondRaw) 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 (*IBooleanCondRaw) Transact ¶ added in v1.2.0
func (_IBooleanCond *IBooleanCondRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error)
Transact invokes the (paid) contract method with params as input values.
func (*IBooleanCondRaw) Transfer ¶ added in v1.2.0
func (_IBooleanCond *IBooleanCondRaw) 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 IBooleanCondSession ¶ added in v1.2.0
type IBooleanCondSession struct {
Contract *IBooleanCond // 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
}
IBooleanCondSession is an auto generated Go binding around an Ethereum contract, with pre-set call and transact options.
func (*IBooleanCondSession) GetOutcome ¶ added in v1.2.0
func (_IBooleanCond *IBooleanCondSession) GetOutcome(_query []byte) (bool, error)
GetOutcome is a free data retrieval call binding the contract method 0xea4ba8eb.
Solidity: function getOutcome(bytes _query) view returns(bool)
func (*IBooleanCondSession) IsFinalized ¶ added in v1.2.0
func (_IBooleanCond *IBooleanCondSession) IsFinalized(_query []byte) (bool, error)
IsFinalized is a free data retrieval call binding the contract method 0xbcdbda94.
Solidity: function isFinalized(bytes _query) view returns(bool)
type IBooleanCondTransactor ¶ added in v1.2.0
type IBooleanCondTransactor struct {
// contains filtered or unexported fields
}
IBooleanCondTransactor is an auto generated write-only Go binding around an Ethereum contract.
func NewIBooleanCondTransactor ¶ added in v1.2.0
func NewIBooleanCondTransactor(address common.Address, transactor bind.ContractTransactor) (*IBooleanCondTransactor, error)
NewIBooleanCondTransactor creates a new write-only instance of IBooleanCond, bound to a specific deployed contract.
type IBooleanCondTransactorRaw ¶ added in v1.2.0
type IBooleanCondTransactorRaw struct {
Contract *IBooleanCondTransactor // Generic write-only contract binding to access the raw methods on
}
IBooleanCondTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract.
func (*IBooleanCondTransactorRaw) Transact ¶ added in v1.2.0
func (_IBooleanCond *IBooleanCondTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error)
Transact invokes the (paid) contract method with params as input values.
func (*IBooleanCondTransactorRaw) Transfer ¶ added in v1.2.0
func (_IBooleanCond *IBooleanCondTransactorRaw) 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 IBooleanCondTransactorSession ¶ added in v1.2.0
type IBooleanCondTransactorSession struct {
Contract *IBooleanCondTransactor // Generic contract transactor binding to set the session for
TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session
}
IBooleanCondTransactorSession is an auto generated write-only Go binding around an Ethereum contract, with pre-set transact options.