dapp-quiz/quiz/quiz.go
2023-09-28 10:41:29 +02:00

287 lines
16 KiB
Go

// Code generated - DO NOT EDIT.
// This file is a generated binding and any manual changes will be lost.
package quiz
import (
"errors"
"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 (
_ = errors.New
_ = big.NewInt
_ = strings.NewReader
_ = ethereum.NotFound
_ = bind.Bind
_ = common.Big1
_ = types.BloomLookup
_ = event.NewSubscription
_ = abi.ConvertType
)
// QuizMetaData contains all meta data concerning the Quiz contract.
var QuizMetaData = &bind.MetaData{
ABI: "[{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_qn\",\"type\":\"string\"},{\"internalType\":\"bytes32\",\"name\":\"_ans\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"checkBoard\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"question\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_ans\",\"type\":\"bytes32\"}],\"name\":\"sendAnswer\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]",
Bin: "0x608060405234801562000010575f80fd5b506040516200096f3803806200096f833981810160405281019062000036919062000213565b815f9081620000469190620004ae565b5080600181905550505062000592565b5f604051905090565b5f80fd5b5f80fd5b5f80fd5b5f80fd5b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b620000b7826200006f565b810181811067ffffffffffffffff82111715620000d957620000d86200007f565b5b80604052505050565b5f620000ed62000056565b9050620000fb8282620000ac565b919050565b5f67ffffffffffffffff8211156200011d576200011c6200007f565b5b62000128826200006f565b9050602081019050919050565b5f5b838110156200015457808201518184015260208101905062000137565b5f8484015250505050565b5f620001756200016f8462000100565b620000e2565b9050828152602081018484840111156200019457620001936200006b565b5b620001a184828562000135565b509392505050565b5f82601f830112620001c057620001bf62000067565b5b8151620001d28482602086016200015f565b91505092915050565b5f819050919050565b620001ef81620001db565b8114620001fa575f80fd5b50565b5f815190506200020d81620001e4565b92915050565b5f80604083850312156200022c576200022b6200005f565b5b5f83015167ffffffffffffffff8111156200024c576200024b62000063565b5b6200025a85828601620001a9565b92505060206200026d85828601620001fd565b9150509250929050565b5f81519050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b5f6002820490506001821680620002c657607f821691505b602082108103620002dc57620002db62000281565b5b50919050565b5f819050815f5260205f209050919050565b5f6020601f8301049050919050565b5f82821b905092915050565b5f60088302620003407fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8262000303565b6200034c868362000303565b95508019841693508086168417925050509392505050565b5f819050919050565b5f819050919050565b5f62000396620003906200038a8462000364565b6200036d565b62000364565b9050919050565b5f819050919050565b620003b18362000376565b620003c9620003c0826200039d565b8484546200030f565b825550505050565b5f90565b620003df620003d1565b620003ec818484620003a6565b505050565b5b818110156200041357620004075f82620003d5565b600181019050620003f2565b5050565b601f82111562000462576200042c81620002e2565b6200043784620002f4565b8101602085101562000447578190505b6200045f6200045685620002f4565b830182620003f1565b50505b505050565b5f82821c905092915050565b5f620004845f198460080262000467565b1980831691505092915050565b5f6200049e838362000473565b9150826002028217905092915050565b620004b98262000277565b67ffffffffffffffff811115620004d557620004d46200007f565b5b620004e18254620002ae565b620004ee82828562000417565b5f60209050601f83116001811462000524575f84156200050f578287015190505b6200051b858262000491565b8655506200058a565b601f1984166200053486620002e2565b5f5b828110156200055d5784890151825560018201915060208501945060208101905062000536565b868310156200057d578489015162000579601f89168262000473565b8355505b6001600288020188555050505b505050505050565b6103cf80620005a05f395ff3fe608060405234801561000f575f80fd5b506004361061003f575f3560e01c806317d1653c146100435780633fad9ae01461007357806377f46bff14610091575b5f80fd5b61005d60048036038101906100589190610234565b6100af565b60405161006a9190610279565b60405180910390f35b61007b6100c4565b604051610088919061031c565b60405180910390f35b61009961014f565b6040516100a69190610279565b60405180910390f35b5f6100bd826001541461019f565b9050919050565b5f80546100d090610369565b80601f01602080910402602001604051908101604052809291908181526020018280546100fc90610369565b80156101475780601f1061011e57610100808354040283529160200191610147565b820191905f5260205f20905b81548152906001019060200180831161012a57829003601f168201915b505050505081565b5f60025f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f9054906101000a900460ff16905090565b5f8160025f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f6101000a81548160ff02191690831515021790555060019050919050565b5f80fd5b5f819050919050565b61021381610201565b811461021d575f80fd5b50565b5f8135905061022e8161020a565b92915050565b5f60208284031215610249576102486101fd565b5b5f61025684828501610220565b91505092915050565b5f8115159050919050565b6102738161025f565b82525050565b5f60208201905061028c5f83018461026a565b92915050565b5f81519050919050565b5f82825260208201905092915050565b5f5b838110156102c95780820151818401526020810190506102ae565b5f8484015250505050565b5f601f19601f8301169050919050565b5f6102ee82610292565b6102f8818561029c565b93506103088185602086016102ac565b610311816102d4565b840191505092915050565b5f6020820190508181035f83015261033481846102e4565b905092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b5f600282049050600182168061038057607f821691505b6020821081036103935761039261033c565b5b5091905056fea26469706673582212203b43da39773c8f47d07b68874cd450d17e39b1ce12855ac60675ae0ba9c90d8b64736f6c63430008150033",
}
// QuizABI is the input ABI used to generate the binding from.
// Deprecated: Use QuizMetaData.ABI instead.
var QuizABI = QuizMetaData.ABI
// QuizBin is the compiled bytecode used for deploying new contracts.
// Deprecated: Use QuizMetaData.Bin instead.
var QuizBin = QuizMetaData.Bin
// DeployQuiz deploys a new Ethereum contract, binding an instance of Quiz to it.
func DeployQuiz(auth *bind.TransactOpts, backend bind.ContractBackend, _qn string, _ans [32]byte) (common.Address, *types.Transaction, *Quiz, error) {
parsed, err := QuizMetaData.GetAbi()
if err != nil {
return common.Address{}, nil, nil, err
}
if parsed == nil {
return common.Address{}, nil, nil, errors.New("GetABI returned nil")
}
address, tx, contract, err := bind.DeployContract(auth, *parsed, common.FromHex(QuizBin), backend, _qn, _ans)
if err != nil {
return common.Address{}, nil, nil, err
}
return address, tx, &Quiz{QuizCaller: QuizCaller{contract: contract}, QuizTransactor: QuizTransactor{contract: contract}, QuizFilterer: QuizFilterer{contract: contract}}, nil
}
// Quiz is an auto generated Go binding around an Ethereum contract.
type Quiz struct {
QuizCaller // Read-only binding to the contract
QuizTransactor // Write-only binding to the contract
QuizFilterer // Log filterer for contract events
}
// QuizCaller is an auto generated read-only Go binding around an Ethereum contract.
type QuizCaller struct {
contract *bind.BoundContract // Generic contract wrapper for the low level calls
}
// QuizTransactor is an auto generated write-only Go binding around an Ethereum contract.
type QuizTransactor struct {
contract *bind.BoundContract // Generic contract wrapper for the low level calls
}
// QuizFilterer is an auto generated log filtering Go binding around an Ethereum contract events.
type QuizFilterer struct {
contract *bind.BoundContract // Generic contract wrapper for the low level calls
}
// QuizSession is an auto generated Go binding around an Ethereum contract,
// with pre-set call and transact options.
type QuizSession struct {
Contract *Quiz // 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
}
// QuizCallerSession is an auto generated read-only Go binding around an Ethereum contract,
// with pre-set call options.
type QuizCallerSession struct {
Contract *QuizCaller // Generic contract caller binding to set the session for
CallOpts bind.CallOpts // Call options to use throughout this session
}
// QuizTransactorSession is an auto generated write-only Go binding around an Ethereum contract,
// with pre-set transact options.
type QuizTransactorSession struct {
Contract *QuizTransactor // Generic contract transactor binding to set the session for
TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session
}
// QuizRaw is an auto generated low-level Go binding around an Ethereum contract.
type QuizRaw struct {
Contract *Quiz // Generic contract binding to access the raw methods on
}
// QuizCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract.
type QuizCallerRaw struct {
Contract *QuizCaller // Generic read-only contract binding to access the raw methods on
}
// QuizTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract.
type QuizTransactorRaw struct {
Contract *QuizTransactor // Generic write-only contract binding to access the raw methods on
}
// NewQuiz creates a new instance of Quiz, bound to a specific deployed contract.
func NewQuiz(address common.Address, backend bind.ContractBackend) (*Quiz, error) {
contract, err := bindQuiz(address, backend, backend, backend)
if err != nil {
return nil, err
}
return &Quiz{QuizCaller: QuizCaller{contract: contract}, QuizTransactor: QuizTransactor{contract: contract}, QuizFilterer: QuizFilterer{contract: contract}}, nil
}
// NewQuizCaller creates a new read-only instance of Quiz, bound to a specific deployed contract.
func NewQuizCaller(address common.Address, caller bind.ContractCaller) (*QuizCaller, error) {
contract, err := bindQuiz(address, caller, nil, nil)
if err != nil {
return nil, err
}
return &QuizCaller{contract: contract}, nil
}
// NewQuizTransactor creates a new write-only instance of Quiz, bound to a specific deployed contract.
func NewQuizTransactor(address common.Address, transactor bind.ContractTransactor) (*QuizTransactor, error) {
contract, err := bindQuiz(address, nil, transactor, nil)
if err != nil {
return nil, err
}
return &QuizTransactor{contract: contract}, nil
}
// NewQuizFilterer creates a new log filterer instance of Quiz, bound to a specific deployed contract.
func NewQuizFilterer(address common.Address, filterer bind.ContractFilterer) (*QuizFilterer, error) {
contract, err := bindQuiz(address, nil, nil, filterer)
if err != nil {
return nil, err
}
return &QuizFilterer{contract: contract}, nil
}
// bindQuiz binds a generic wrapper to an already deployed contract.
func bindQuiz(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) {
parsed, err := QuizMetaData.GetAbi()
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 (_Quiz *QuizRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error {
return _Quiz.Contract.QuizCaller.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 (_Quiz *QuizRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {
return _Quiz.Contract.QuizTransactor.contract.Transfer(opts)
}
// Transact invokes the (paid) contract method with params as input values.
func (_Quiz *QuizRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {
return _Quiz.Contract.QuizTransactor.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 (_Quiz *QuizCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error {
return _Quiz.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 (_Quiz *QuizTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {
return _Quiz.Contract.contract.Transfer(opts)
}
// Transact invokes the (paid) contract method with params as input values.
func (_Quiz *QuizTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {
return _Quiz.Contract.contract.Transact(opts, method, params...)
}
// CheckBoard is a free data retrieval call binding the contract method 0x77f46bff.
//
// Solidity: function checkBoard() view returns(bool)
func (_Quiz *QuizCaller) CheckBoard(opts *bind.CallOpts) (bool, error) {
var out []interface{}
err := _Quiz.contract.Call(opts, &out, "checkBoard")
if err != nil {
return *new(bool), err
}
out0 := *abi.ConvertType(out[0], new(bool)).(*bool)
return out0, err
}
// CheckBoard is a free data retrieval call binding the contract method 0x77f46bff.
//
// Solidity: function checkBoard() view returns(bool)
func (_Quiz *QuizSession) CheckBoard() (bool, error) {
return _Quiz.Contract.CheckBoard(&_Quiz.CallOpts)
}
// CheckBoard is a free data retrieval call binding the contract method 0x77f46bff.
//
// Solidity: function checkBoard() view returns(bool)
func (_Quiz *QuizCallerSession) CheckBoard() (bool, error) {
return _Quiz.Contract.CheckBoard(&_Quiz.CallOpts)
}
// Question is a free data retrieval call binding the contract method 0x3fad9ae0.
//
// Solidity: function question() view returns(string)
func (_Quiz *QuizCaller) Question(opts *bind.CallOpts) (string, error) {
var out []interface{}
err := _Quiz.contract.Call(opts, &out, "question")
if err != nil {
return *new(string), err
}
out0 := *abi.ConvertType(out[0], new(string)).(*string)
return out0, err
}
// Question is a free data retrieval call binding the contract method 0x3fad9ae0.
//
// Solidity: function question() view returns(string)
func (_Quiz *QuizSession) Question() (string, error) {
return _Quiz.Contract.Question(&_Quiz.CallOpts)
}
// Question is a free data retrieval call binding the contract method 0x3fad9ae0.
//
// Solidity: function question() view returns(string)
func (_Quiz *QuizCallerSession) Question() (string, error) {
return _Quiz.Contract.Question(&_Quiz.CallOpts)
}
// SendAnswer is a paid mutator transaction binding the contract method 0x17d1653c.
//
// Solidity: function sendAnswer(bytes32 _ans) returns(bool)
func (_Quiz *QuizTransactor) SendAnswer(opts *bind.TransactOpts, _ans [32]byte) (*types.Transaction, error) {
return _Quiz.contract.Transact(opts, "sendAnswer", _ans)
}
// SendAnswer is a paid mutator transaction binding the contract method 0x17d1653c.
//
// Solidity: function sendAnswer(bytes32 _ans) returns(bool)
func (_Quiz *QuizSession) SendAnswer(_ans [32]byte) (*types.Transaction, error) {
return _Quiz.Contract.SendAnswer(&_Quiz.TransactOpts, _ans)
}
// SendAnswer is a paid mutator transaction binding the contract method 0x17d1653c.
//
// Solidity: function sendAnswer(bytes32 _ans) returns(bool)
func (_Quiz *QuizTransactorSession) SendAnswer(_ans [32]byte) (*types.Transaction, error) {
return _Quiz.Contract.SendAnswer(&_Quiz.TransactOpts, _ans)
}