diff --git a/Makefile b/Makefile index 7dd03fe..695d405 100644 --- a/Makefile +++ b/Makefile @@ -45,3 +45,7 @@ coverage: test .PHONY: docs docs: @cd docs && npm run dev + +.PHONY: generate +generate: + @go run ./pkg/rollups_contracts/generate diff --git a/internal/usecase/crowdfunding_usecase/finish_crowdfunding.go b/internal/usecase/crowdfunding_usecase/close_crowdfunding.go similarity index 100% rename from internal/usecase/crowdfunding_usecase/finish_crowdfunding.go rename to internal/usecase/crowdfunding_usecase/close_crowdfunding.go diff --git a/internal/usecase/crowdfunding_usecase/find_crowdfunding_by_creator.go b/internal/usecase/crowdfunding_usecase/find_crowdfunding_by_creator.go new file mode 100644 index 0000000..840784a --- /dev/null +++ b/internal/usecase/crowdfunding_usecase/find_crowdfunding_by_creator.go @@ -0,0 +1 @@ +package crowdfunding_usecase \ No newline at end of file diff --git a/internal/usecase/crowdfunding_usecase/settle_crowdfunding.go b/internal/usecase/crowdfunding_usecase/settle_crowdfunding.go new file mode 100644 index 0000000..840784a --- /dev/null +++ b/internal/usecase/crowdfunding_usecase/settle_crowdfunding.go @@ -0,0 +1 @@ +package crowdfunding_usecase \ No newline at end of file diff --git a/pkg/rollups_contracts/application.go b/pkg/rollups_contracts/application.go new file mode 100644 index 0000000..40786e8 --- /dev/null +++ b/pkg/rollups_contracts/application.go @@ -0,0 +1,990 @@ +// Code generated - DO NOT EDIT. +// This file is a generated binding and any manual changes will be lost. + +package rollups_contracts + +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 +) + +// OutputValidityProof is an auto generated low-level Go binding around an user-defined struct. +type OutputValidityProof struct { + OutputIndex uint64 + OutputHashesSiblings [][32]byte +} + +// ApplicationMetaData contains all meta data concerning the Application contract. +var ApplicationMetaData = &bind.MetaData{ + ABI: "[{\"inputs\":[{\"internalType\":\"contractIConsensus\",\"name\":\"consensus\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"initialOwner\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"templateHash\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"claim\",\"type\":\"bytes32\"}],\"name\":\"ClaimNotAccepted\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidOutputHashesSiblingsArrayLength\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"output\",\"type\":\"bytes\"}],\"name\":\"OutputNotExecutable\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"output\",\"type\":\"bytes\"}],\"name\":\"OutputNotReexecutable\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"OwnableInvalidOwner\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"OwnableUnauthorizedAccount\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ReentrancyGuardReentrantCall\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"contractIConsensus\",\"name\":\"newConsensus\",\"type\":\"address\"}],\"name\":\"NewConsensus\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"outputIndex\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"output\",\"type\":\"bytes\"}],\"name\":\"OutputExecuted\",\"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\":\"bytes\",\"name\":\"output\",\"type\":\"bytes\"},{\"components\":[{\"internalType\":\"uint64\",\"name\":\"outputIndex\",\"type\":\"uint64\"},{\"internalType\":\"bytes32[]\",\"name\":\"outputHashesSiblings\",\"type\":\"bytes32[]\"}],\"internalType\":\"structOutputValidityProof\",\"name\":\"proof\",\"type\":\"tuple\"}],\"name\":\"executeOutput\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getConsensus\",\"outputs\":[{\"internalType\":\"contractIConsensus\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getTemplateHash\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contractIConsensus\",\"name\":\"newConsensus\",\"type\":\"address\"}],\"name\":\"migrateToConsensus\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256[]\",\"name\":\"\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"\",\"type\":\"uint256[]\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"name\":\"onERC1155BatchReceived\",\"outputs\":[{\"internalType\":\"bytes4\",\"name\":\"\",\"type\":\"bytes4\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"name\":\"onERC1155Received\",\"outputs\":[{\"internalType\":\"bytes4\",\"name\":\"\",\"type\":\"bytes4\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"name\":\"onERC721Received\",\"outputs\":[{\"internalType\":\"bytes4\",\"name\":\"\",\"type\":\"bytes4\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"output\",\"type\":\"bytes\"},{\"components\":[{\"internalType\":\"uint64\",\"name\":\"outputIndex\",\"type\":\"uint64\"},{\"internalType\":\"bytes32[]\",\"name\":\"outputHashesSiblings\",\"type\":\"bytes32[]\"}],\"internalType\":\"structOutputValidityProof\",\"name\":\"proof\",\"type\":\"tuple\"}],\"name\":\"validateOutput\",\"outputs\":[],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"outputHash\",\"type\":\"bytes32\"},{\"components\":[{\"internalType\":\"uint64\",\"name\":\"outputIndex\",\"type\":\"uint64\"},{\"internalType\":\"bytes32[]\",\"name\":\"outputHashesSiblings\",\"type\":\"bytes32[]\"}],\"internalType\":\"structOutputValidityProof\",\"name\":\"proof\",\"type\":\"tuple\"}],\"name\":\"validateOutputHash\",\"outputs\":[],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"outputIndex\",\"type\":\"uint256\"}],\"name\":\"wasOutputExecuted\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}]", +} + +// ApplicationABI is the input ABI used to generate the binding from. +// Deprecated: Use ApplicationMetaData.ABI instead. +var ApplicationABI = ApplicationMetaData.ABI + +// Application is an auto generated Go binding around an Ethereum contract. +type Application struct { + ApplicationCaller // Read-only binding to the contract + ApplicationTransactor // Write-only binding to the contract + ApplicationFilterer // Log filterer for contract events +} + +// ApplicationCaller is an auto generated read-only Go binding around an Ethereum contract. +type ApplicationCaller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// ApplicationTransactor is an auto generated write-only Go binding around an Ethereum contract. +type ApplicationTransactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// ApplicationFilterer is an auto generated log filtering Go binding around an Ethereum contract events. +type ApplicationFilterer struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// ApplicationSession is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type ApplicationSession struct { + Contract *Application // 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 +} + +// ApplicationCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type ApplicationCallerSession struct { + Contract *ApplicationCaller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// ApplicationTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type ApplicationTransactorSession struct { + Contract *ApplicationTransactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// ApplicationRaw is an auto generated low-level Go binding around an Ethereum contract. +type ApplicationRaw struct { + Contract *Application // Generic contract binding to access the raw methods on +} + +// ApplicationCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type ApplicationCallerRaw struct { + Contract *ApplicationCaller // Generic read-only contract binding to access the raw methods on +} + +// ApplicationTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type ApplicationTransactorRaw struct { + Contract *ApplicationTransactor // Generic write-only contract binding to access the raw methods on +} + +// NewApplication creates a new instance of Application, bound to a specific deployed contract. +func NewApplication(address common.Address, backend bind.ContractBackend) (*Application, error) { + contract, err := bindApplication(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &Application{ApplicationCaller: ApplicationCaller{contract: contract}, ApplicationTransactor: ApplicationTransactor{contract: contract}, ApplicationFilterer: ApplicationFilterer{contract: contract}}, nil +} + +// NewApplicationCaller creates a new read-only instance of Application, bound to a specific deployed contract. +func NewApplicationCaller(address common.Address, caller bind.ContractCaller) (*ApplicationCaller, error) { + contract, err := bindApplication(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &ApplicationCaller{contract: contract}, nil +} + +// NewApplicationTransactor creates a new write-only instance of Application, bound to a specific deployed contract. +func NewApplicationTransactor(address common.Address, transactor bind.ContractTransactor) (*ApplicationTransactor, error) { + contract, err := bindApplication(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &ApplicationTransactor{contract: contract}, nil +} + +// NewApplicationFilterer creates a new log filterer instance of Application, bound to a specific deployed contract. +func NewApplicationFilterer(address common.Address, filterer bind.ContractFilterer) (*ApplicationFilterer, error) { + contract, err := bindApplication(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &ApplicationFilterer{contract: contract}, nil +} + +// bindApplication binds a generic wrapper to an already deployed contract. +func bindApplication(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := ApplicationMetaData.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 (_Application *ApplicationRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _Application.Contract.ApplicationCaller.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 (_Application *ApplicationRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Application.Contract.ApplicationTransactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_Application *ApplicationRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _Application.Contract.ApplicationTransactor.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 (_Application *ApplicationCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _Application.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 (_Application *ApplicationTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Application.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_Application *ApplicationTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _Application.Contract.contract.Transact(opts, method, params...) +} + +// GetConsensus is a free data retrieval call binding the contract method 0x179e740b. +// +// Solidity: function getConsensus() view returns(address) +func (_Application *ApplicationCaller) GetConsensus(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _Application.contract.Call(opts, &out, "getConsensus") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// GetConsensus is a free data retrieval call binding the contract method 0x179e740b. +// +// Solidity: function getConsensus() view returns(address) +func (_Application *ApplicationSession) GetConsensus() (common.Address, error) { + return _Application.Contract.GetConsensus(&_Application.CallOpts) +} + +// GetConsensus is a free data retrieval call binding the contract method 0x179e740b. +// +// Solidity: function getConsensus() view returns(address) +func (_Application *ApplicationCallerSession) GetConsensus() (common.Address, error) { + return _Application.Contract.GetConsensus(&_Application.CallOpts) +} + +// GetTemplateHash is a free data retrieval call binding the contract method 0x61b12c66. +// +// Solidity: function getTemplateHash() view returns(bytes32) +func (_Application *ApplicationCaller) GetTemplateHash(opts *bind.CallOpts) ([32]byte, error) { + var out []interface{} + err := _Application.contract.Call(opts, &out, "getTemplateHash") + + if err != nil { + return *new([32]byte), err + } + + out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) + + return out0, err + +} + +// GetTemplateHash is a free data retrieval call binding the contract method 0x61b12c66. +// +// Solidity: function getTemplateHash() view returns(bytes32) +func (_Application *ApplicationSession) GetTemplateHash() ([32]byte, error) { + return _Application.Contract.GetTemplateHash(&_Application.CallOpts) +} + +// GetTemplateHash is a free data retrieval call binding the contract method 0x61b12c66. +// +// Solidity: function getTemplateHash() view returns(bytes32) +func (_Application *ApplicationCallerSession) GetTemplateHash() ([32]byte, error) { + return _Application.Contract.GetTemplateHash(&_Application.CallOpts) +} + +// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. +// +// Solidity: function owner() view returns(address) +func (_Application *ApplicationCaller) Owner(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _Application.contract.Call(opts, &out, "owner") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. +// +// Solidity: function owner() view returns(address) +func (_Application *ApplicationSession) Owner() (common.Address, error) { + return _Application.Contract.Owner(&_Application.CallOpts) +} + +// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. +// +// Solidity: function owner() view returns(address) +func (_Application *ApplicationCallerSession) Owner() (common.Address, error) { + return _Application.Contract.Owner(&_Application.CallOpts) +} + +// SupportsInterface is a free data retrieval call binding the contract method 0x01ffc9a7. +// +// Solidity: function supportsInterface(bytes4 interfaceId) view returns(bool) +func (_Application *ApplicationCaller) SupportsInterface(opts *bind.CallOpts, interfaceId [4]byte) (bool, error) { + var out []interface{} + err := _Application.contract.Call(opts, &out, "supportsInterface", interfaceId) + + if err != nil { + return *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + + return out0, err + +} + +// SupportsInterface is a free data retrieval call binding the contract method 0x01ffc9a7. +// +// Solidity: function supportsInterface(bytes4 interfaceId) view returns(bool) +func (_Application *ApplicationSession) SupportsInterface(interfaceId [4]byte) (bool, error) { + return _Application.Contract.SupportsInterface(&_Application.CallOpts, interfaceId) +} + +// SupportsInterface is a free data retrieval call binding the contract method 0x01ffc9a7. +// +// Solidity: function supportsInterface(bytes4 interfaceId) view returns(bool) +func (_Application *ApplicationCallerSession) SupportsInterface(interfaceId [4]byte) (bool, error) { + return _Application.Contract.SupportsInterface(&_Application.CallOpts, interfaceId) +} + +// ValidateOutput is a free data retrieval call binding the contract method 0xe88d39c0. +// +// Solidity: function validateOutput(bytes output, (uint64,bytes32[]) proof) view returns() +func (_Application *ApplicationCaller) ValidateOutput(opts *bind.CallOpts, output []byte, proof OutputValidityProof) error { + var out []interface{} + err := _Application.contract.Call(opts, &out, "validateOutput", output, proof) + + if err != nil { + return err + } + + return err + +} + +// ValidateOutput is a free data retrieval call binding the contract method 0xe88d39c0. +// +// Solidity: function validateOutput(bytes output, (uint64,bytes32[]) proof) view returns() +func (_Application *ApplicationSession) ValidateOutput(output []byte, proof OutputValidityProof) error { + return _Application.Contract.ValidateOutput(&_Application.CallOpts, output, proof) +} + +// ValidateOutput is a free data retrieval call binding the contract method 0xe88d39c0. +// +// Solidity: function validateOutput(bytes output, (uint64,bytes32[]) proof) view returns() +func (_Application *ApplicationCallerSession) ValidateOutput(output []byte, proof OutputValidityProof) error { + return _Application.Contract.ValidateOutput(&_Application.CallOpts, output, proof) +} + +// ValidateOutputHash is a free data retrieval call binding the contract method 0x08eb89ab. +// +// Solidity: function validateOutputHash(bytes32 outputHash, (uint64,bytes32[]) proof) view returns() +func (_Application *ApplicationCaller) ValidateOutputHash(opts *bind.CallOpts, outputHash [32]byte, proof OutputValidityProof) error { + var out []interface{} + err := _Application.contract.Call(opts, &out, "validateOutputHash", outputHash, proof) + + if err != nil { + return err + } + + return err + +} + +// ValidateOutputHash is a free data retrieval call binding the contract method 0x08eb89ab. +// +// Solidity: function validateOutputHash(bytes32 outputHash, (uint64,bytes32[]) proof) view returns() +func (_Application *ApplicationSession) ValidateOutputHash(outputHash [32]byte, proof OutputValidityProof) error { + return _Application.Contract.ValidateOutputHash(&_Application.CallOpts, outputHash, proof) +} + +// ValidateOutputHash is a free data retrieval call binding the contract method 0x08eb89ab. +// +// Solidity: function validateOutputHash(bytes32 outputHash, (uint64,bytes32[]) proof) view returns() +func (_Application *ApplicationCallerSession) ValidateOutputHash(outputHash [32]byte, proof OutputValidityProof) error { + return _Application.Contract.ValidateOutputHash(&_Application.CallOpts, outputHash, proof) +} + +// WasOutputExecuted is a free data retrieval call binding the contract method 0x71891db0. +// +// Solidity: function wasOutputExecuted(uint256 outputIndex) view returns(bool) +func (_Application *ApplicationCaller) WasOutputExecuted(opts *bind.CallOpts, outputIndex *big.Int) (bool, error) { + var out []interface{} + err := _Application.contract.Call(opts, &out, "wasOutputExecuted", outputIndex) + + if err != nil { + return *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + + return out0, err + +} + +// WasOutputExecuted is a free data retrieval call binding the contract method 0x71891db0. +// +// Solidity: function wasOutputExecuted(uint256 outputIndex) view returns(bool) +func (_Application *ApplicationSession) WasOutputExecuted(outputIndex *big.Int) (bool, error) { + return _Application.Contract.WasOutputExecuted(&_Application.CallOpts, outputIndex) +} + +// WasOutputExecuted is a free data retrieval call binding the contract method 0x71891db0. +// +// Solidity: function wasOutputExecuted(uint256 outputIndex) view returns(bool) +func (_Application *ApplicationCallerSession) WasOutputExecuted(outputIndex *big.Int) (bool, error) { + return _Application.Contract.WasOutputExecuted(&_Application.CallOpts, outputIndex) +} + +// ExecuteOutput is a paid mutator transaction binding the contract method 0x33137b76. +// +// Solidity: function executeOutput(bytes output, (uint64,bytes32[]) proof) returns() +func (_Application *ApplicationTransactor) ExecuteOutput(opts *bind.TransactOpts, output []byte, proof OutputValidityProof) (*types.Transaction, error) { + return _Application.contract.Transact(opts, "executeOutput", output, proof) +} + +// ExecuteOutput is a paid mutator transaction binding the contract method 0x33137b76. +// +// Solidity: function executeOutput(bytes output, (uint64,bytes32[]) proof) returns() +func (_Application *ApplicationSession) ExecuteOutput(output []byte, proof OutputValidityProof) (*types.Transaction, error) { + return _Application.Contract.ExecuteOutput(&_Application.TransactOpts, output, proof) +} + +// ExecuteOutput is a paid mutator transaction binding the contract method 0x33137b76. +// +// Solidity: function executeOutput(bytes output, (uint64,bytes32[]) proof) returns() +func (_Application *ApplicationTransactorSession) ExecuteOutput(output []byte, proof OutputValidityProof) (*types.Transaction, error) { + return _Application.Contract.ExecuteOutput(&_Application.TransactOpts, output, proof) +} + +// MigrateToConsensus is a paid mutator transaction binding the contract method 0xfc411683. +// +// Solidity: function migrateToConsensus(address newConsensus) returns() +func (_Application *ApplicationTransactor) MigrateToConsensus(opts *bind.TransactOpts, newConsensus common.Address) (*types.Transaction, error) { + return _Application.contract.Transact(opts, "migrateToConsensus", newConsensus) +} + +// MigrateToConsensus is a paid mutator transaction binding the contract method 0xfc411683. +// +// Solidity: function migrateToConsensus(address newConsensus) returns() +func (_Application *ApplicationSession) MigrateToConsensus(newConsensus common.Address) (*types.Transaction, error) { + return _Application.Contract.MigrateToConsensus(&_Application.TransactOpts, newConsensus) +} + +// MigrateToConsensus is a paid mutator transaction binding the contract method 0xfc411683. +// +// Solidity: function migrateToConsensus(address newConsensus) returns() +func (_Application *ApplicationTransactorSession) MigrateToConsensus(newConsensus common.Address) (*types.Transaction, error) { + return _Application.Contract.MigrateToConsensus(&_Application.TransactOpts, newConsensus) +} + +// OnERC1155BatchReceived is a paid mutator transaction binding the contract method 0xbc197c81. +// +// Solidity: function onERC1155BatchReceived(address , address , uint256[] , uint256[] , bytes ) returns(bytes4) +func (_Application *ApplicationTransactor) OnERC1155BatchReceived(opts *bind.TransactOpts, arg0 common.Address, arg1 common.Address, arg2 []*big.Int, arg3 []*big.Int, arg4 []byte) (*types.Transaction, error) { + return _Application.contract.Transact(opts, "onERC1155BatchReceived", arg0, arg1, arg2, arg3, arg4) +} + +// OnERC1155BatchReceived is a paid mutator transaction binding the contract method 0xbc197c81. +// +// Solidity: function onERC1155BatchReceived(address , address , uint256[] , uint256[] , bytes ) returns(bytes4) +func (_Application *ApplicationSession) OnERC1155BatchReceived(arg0 common.Address, arg1 common.Address, arg2 []*big.Int, arg3 []*big.Int, arg4 []byte) (*types.Transaction, error) { + return _Application.Contract.OnERC1155BatchReceived(&_Application.TransactOpts, arg0, arg1, arg2, arg3, arg4) +} + +// OnERC1155BatchReceived is a paid mutator transaction binding the contract method 0xbc197c81. +// +// Solidity: function onERC1155BatchReceived(address , address , uint256[] , uint256[] , bytes ) returns(bytes4) +func (_Application *ApplicationTransactorSession) OnERC1155BatchReceived(arg0 common.Address, arg1 common.Address, arg2 []*big.Int, arg3 []*big.Int, arg4 []byte) (*types.Transaction, error) { + return _Application.Contract.OnERC1155BatchReceived(&_Application.TransactOpts, arg0, arg1, arg2, arg3, arg4) +} + +// OnERC1155Received is a paid mutator transaction binding the contract method 0xf23a6e61. +// +// Solidity: function onERC1155Received(address , address , uint256 , uint256 , bytes ) returns(bytes4) +func (_Application *ApplicationTransactor) OnERC1155Received(opts *bind.TransactOpts, arg0 common.Address, arg1 common.Address, arg2 *big.Int, arg3 *big.Int, arg4 []byte) (*types.Transaction, error) { + return _Application.contract.Transact(opts, "onERC1155Received", arg0, arg1, arg2, arg3, arg4) +} + +// OnERC1155Received is a paid mutator transaction binding the contract method 0xf23a6e61. +// +// Solidity: function onERC1155Received(address , address , uint256 , uint256 , bytes ) returns(bytes4) +func (_Application *ApplicationSession) OnERC1155Received(arg0 common.Address, arg1 common.Address, arg2 *big.Int, arg3 *big.Int, arg4 []byte) (*types.Transaction, error) { + return _Application.Contract.OnERC1155Received(&_Application.TransactOpts, arg0, arg1, arg2, arg3, arg4) +} + +// OnERC1155Received is a paid mutator transaction binding the contract method 0xf23a6e61. +// +// Solidity: function onERC1155Received(address , address , uint256 , uint256 , bytes ) returns(bytes4) +func (_Application *ApplicationTransactorSession) OnERC1155Received(arg0 common.Address, arg1 common.Address, arg2 *big.Int, arg3 *big.Int, arg4 []byte) (*types.Transaction, error) { + return _Application.Contract.OnERC1155Received(&_Application.TransactOpts, arg0, arg1, arg2, arg3, arg4) +} + +// OnERC721Received is a paid mutator transaction binding the contract method 0x150b7a02. +// +// Solidity: function onERC721Received(address , address , uint256 , bytes ) returns(bytes4) +func (_Application *ApplicationTransactor) OnERC721Received(opts *bind.TransactOpts, arg0 common.Address, arg1 common.Address, arg2 *big.Int, arg3 []byte) (*types.Transaction, error) { + return _Application.contract.Transact(opts, "onERC721Received", arg0, arg1, arg2, arg3) +} + +// OnERC721Received is a paid mutator transaction binding the contract method 0x150b7a02. +// +// Solidity: function onERC721Received(address , address , uint256 , bytes ) returns(bytes4) +func (_Application *ApplicationSession) OnERC721Received(arg0 common.Address, arg1 common.Address, arg2 *big.Int, arg3 []byte) (*types.Transaction, error) { + return _Application.Contract.OnERC721Received(&_Application.TransactOpts, arg0, arg1, arg2, arg3) +} + +// OnERC721Received is a paid mutator transaction binding the contract method 0x150b7a02. +// +// Solidity: function onERC721Received(address , address , uint256 , bytes ) returns(bytes4) +func (_Application *ApplicationTransactorSession) OnERC721Received(arg0 common.Address, arg1 common.Address, arg2 *big.Int, arg3 []byte) (*types.Transaction, error) { + return _Application.Contract.OnERC721Received(&_Application.TransactOpts, arg0, arg1, arg2, arg3) +} + +// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. +// +// Solidity: function renounceOwnership() returns() +func (_Application *ApplicationTransactor) RenounceOwnership(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Application.contract.Transact(opts, "renounceOwnership") +} + +// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. +// +// Solidity: function renounceOwnership() returns() +func (_Application *ApplicationSession) RenounceOwnership() (*types.Transaction, error) { + return _Application.Contract.RenounceOwnership(&_Application.TransactOpts) +} + +// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. +// +// Solidity: function renounceOwnership() returns() +func (_Application *ApplicationTransactorSession) RenounceOwnership() (*types.Transaction, error) { + return _Application.Contract.RenounceOwnership(&_Application.TransactOpts) +} + +// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. +// +// Solidity: function transferOwnership(address newOwner) returns() +func (_Application *ApplicationTransactor) TransferOwnership(opts *bind.TransactOpts, newOwner common.Address) (*types.Transaction, error) { + return _Application.contract.Transact(opts, "transferOwnership", newOwner) +} + +// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. +// +// Solidity: function transferOwnership(address newOwner) returns() +func (_Application *ApplicationSession) TransferOwnership(newOwner common.Address) (*types.Transaction, error) { + return _Application.Contract.TransferOwnership(&_Application.TransactOpts, newOwner) +} + +// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. +// +// Solidity: function transferOwnership(address newOwner) returns() +func (_Application *ApplicationTransactorSession) TransferOwnership(newOwner common.Address) (*types.Transaction, error) { + return _Application.Contract.TransferOwnership(&_Application.TransactOpts, newOwner) +} + +// Receive is a paid mutator transaction binding the contract receive function. +// +// Solidity: receive() payable returns() +func (_Application *ApplicationTransactor) Receive(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Application.contract.RawTransact(opts, nil) // calldata is disallowed for receive function +} + +// Receive is a paid mutator transaction binding the contract receive function. +// +// Solidity: receive() payable returns() +func (_Application *ApplicationSession) Receive() (*types.Transaction, error) { + return _Application.Contract.Receive(&_Application.TransactOpts) +} + +// Receive is a paid mutator transaction binding the contract receive function. +// +// Solidity: receive() payable returns() +func (_Application *ApplicationTransactorSession) Receive() (*types.Transaction, error) { + return _Application.Contract.Receive(&_Application.TransactOpts) +} + +// ApplicationNewConsensusIterator is returned from FilterNewConsensus and is used to iterate over the raw logs and unpacked data for NewConsensus events raised by the Application contract. +type ApplicationNewConsensusIterator struct { + Event *ApplicationNewConsensus // 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 *ApplicationNewConsensusIterator) 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(ApplicationNewConsensus) + 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(ApplicationNewConsensus) + 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 *ApplicationNewConsensusIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ApplicationNewConsensusIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ApplicationNewConsensus represents a NewConsensus event raised by the Application contract. +type ApplicationNewConsensus struct { + NewConsensus common.Address + Raw types.Log // Blockchain specific contextual infos +} + +// FilterNewConsensus is a free log retrieval operation binding the contract event 0x4991c6f37185659e276ff918a96f3e20e6c5abcd8c9aab450dc19c2f7ad35cb5. +// +// Solidity: event NewConsensus(address newConsensus) +func (_Application *ApplicationFilterer) FilterNewConsensus(opts *bind.FilterOpts) (*ApplicationNewConsensusIterator, error) { + + logs, sub, err := _Application.contract.FilterLogs(opts, "NewConsensus") + if err != nil { + return nil, err + } + return &ApplicationNewConsensusIterator{contract: _Application.contract, event: "NewConsensus", logs: logs, sub: sub}, nil +} + +// WatchNewConsensus is a free log subscription operation binding the contract event 0x4991c6f37185659e276ff918a96f3e20e6c5abcd8c9aab450dc19c2f7ad35cb5. +// +// Solidity: event NewConsensus(address newConsensus) +func (_Application *ApplicationFilterer) WatchNewConsensus(opts *bind.WatchOpts, sink chan<- *ApplicationNewConsensus) (event.Subscription, error) { + + logs, sub, err := _Application.contract.WatchLogs(opts, "NewConsensus") + 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(ApplicationNewConsensus) + if err := _Application.contract.UnpackLog(event, "NewConsensus", 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 +} + +// ParseNewConsensus is a log parse operation binding the contract event 0x4991c6f37185659e276ff918a96f3e20e6c5abcd8c9aab450dc19c2f7ad35cb5. +// +// Solidity: event NewConsensus(address newConsensus) +func (_Application *ApplicationFilterer) ParseNewConsensus(log types.Log) (*ApplicationNewConsensus, error) { + event := new(ApplicationNewConsensus) + if err := _Application.contract.UnpackLog(event, "NewConsensus", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ApplicationOutputExecutedIterator is returned from FilterOutputExecuted and is used to iterate over the raw logs and unpacked data for OutputExecuted events raised by the Application contract. +type ApplicationOutputExecutedIterator struct { + Event *ApplicationOutputExecuted // 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 *ApplicationOutputExecutedIterator) 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(ApplicationOutputExecuted) + 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(ApplicationOutputExecuted) + 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 *ApplicationOutputExecutedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ApplicationOutputExecutedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ApplicationOutputExecuted represents a OutputExecuted event raised by the Application contract. +type ApplicationOutputExecuted struct { + OutputIndex uint64 + Output []byte + Raw types.Log // Blockchain specific contextual infos +} + +// FilterOutputExecuted is a free log retrieval operation binding the contract event 0xcad1f361c6e84664e892230291c8e8eb9555683e0a6a5ce8ea7b204ac0ac3676. +// +// Solidity: event OutputExecuted(uint64 outputIndex, bytes output) +func (_Application *ApplicationFilterer) FilterOutputExecuted(opts *bind.FilterOpts) (*ApplicationOutputExecutedIterator, error) { + + logs, sub, err := _Application.contract.FilterLogs(opts, "OutputExecuted") + if err != nil { + return nil, err + } + return &ApplicationOutputExecutedIterator{contract: _Application.contract, event: "OutputExecuted", logs: logs, sub: sub}, nil +} + +// WatchOutputExecuted is a free log subscription operation binding the contract event 0xcad1f361c6e84664e892230291c8e8eb9555683e0a6a5ce8ea7b204ac0ac3676. +// +// Solidity: event OutputExecuted(uint64 outputIndex, bytes output) +func (_Application *ApplicationFilterer) WatchOutputExecuted(opts *bind.WatchOpts, sink chan<- *ApplicationOutputExecuted) (event.Subscription, error) { + + logs, sub, err := _Application.contract.WatchLogs(opts, "OutputExecuted") + 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(ApplicationOutputExecuted) + if err := _Application.contract.UnpackLog(event, "OutputExecuted", 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 +} + +// ParseOutputExecuted is a log parse operation binding the contract event 0xcad1f361c6e84664e892230291c8e8eb9555683e0a6a5ce8ea7b204ac0ac3676. +// +// Solidity: event OutputExecuted(uint64 outputIndex, bytes output) +func (_Application *ApplicationFilterer) ParseOutputExecuted(log types.Log) (*ApplicationOutputExecuted, error) { + event := new(ApplicationOutputExecuted) + if err := _Application.contract.UnpackLog(event, "OutputExecuted", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ApplicationOwnershipTransferredIterator is returned from FilterOwnershipTransferred and is used to iterate over the raw logs and unpacked data for OwnershipTransferred events raised by the Application contract. +type ApplicationOwnershipTransferredIterator struct { + Event *ApplicationOwnershipTransferred // 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 *ApplicationOwnershipTransferredIterator) 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(ApplicationOwnershipTransferred) + 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(ApplicationOwnershipTransferred) + 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 *ApplicationOwnershipTransferredIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ApplicationOwnershipTransferredIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ApplicationOwnershipTransferred represents a OwnershipTransferred event raised by the Application contract. +type ApplicationOwnershipTransferred 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 (_Application *ApplicationFilterer) FilterOwnershipTransferred(opts *bind.FilterOpts, previousOwner []common.Address, newOwner []common.Address) (*ApplicationOwnershipTransferredIterator, 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 := _Application.contract.FilterLogs(opts, "OwnershipTransferred", previousOwnerRule, newOwnerRule) + if err != nil { + return nil, err + } + return &ApplicationOwnershipTransferredIterator{contract: _Application.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 (_Application *ApplicationFilterer) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *ApplicationOwnershipTransferred, 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 := _Application.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(ApplicationOwnershipTransferred) + if err := _Application.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 (_Application *ApplicationFilterer) ParseOwnershipTransferred(log types.Log) (*ApplicationOwnershipTransferred, error) { + event := new(ApplicationOwnershipTransferred) + if err := _Application.contract.UnpackLog(event, "OwnershipTransferred", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} diff --git a/pkg/rollups_contracts/cartesi_dapp.go b/pkg/rollups_contracts/cartesi_dapp.go deleted file mode 100644 index a60ad91..0000000 --- a/pkg/rollups_contracts/cartesi_dapp.go +++ /dev/null @@ -1,995 +0,0 @@ -// Code generated - DO NOT EDIT. -// This file is a generated binding and any manual changes will be lost. - -package rollups_crowdfundings - -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 -) - -// OutputValidityProof is an auto generated low-level Go binding around an user-defined struct. -type OutputValidityProof struct { - InputIndexWithinEpoch uint64 - OutputIndexWithinInput uint64 - OutputHashesRootHash [32]byte - VouchersEpochRootHash [32]byte - NoticesEpochRootHash [32]byte - MachineStateHash [32]byte - OutputHashInOutputHashesSiblings [][32]byte - OutputHashesInEpochSiblings [][32]byte -} - -// Proof is an auto generated low-level Go binding around an user-defined struct. -type Proof struct { - Validity OutputValidityProof - Context []byte -} - -// CartesiDAppMetaData contains all meta data concerning the CartesiDApp crowdfunding. -var CartesiDAppMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"internalType\":\"crowdfundingIConsensus\",\"name\":\"_consensus\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_owner\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"_templateHash\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"EtherTransferFailed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"IncorrectEpochHash\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"IncorrectOutputHashesRootHash\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"IncorrectOutputsEpochRootHash\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InputIndexOutOfClaimBounds\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OnlyDApp\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"VoucherReexecutionNotAllowed\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"crowdfundingIConsensus\",\"name\":\"newConsensus\",\"type\":\"address\"}],\"name\":\"NewConsensus\",\"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\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"voucherId\",\"type\":\"uint256\"}],\"name\":\"VoucherExecuted\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_destination\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_payload\",\"type\":\"bytes\"},{\"components\":[{\"components\":[{\"internalType\":\"uint64\",\"name\":\"inputIndexWithinEpoch\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"outputIndexWithinInput\",\"type\":\"uint64\"},{\"internalType\":\"bytes32\",\"name\":\"outputHashesRootHash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"vouchersEpochRootHash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"noticesEpochRootHash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"machineStateHash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32[]\",\"name\":\"outputHashInOutputHashesSiblings\",\"type\":\"bytes32[]\"},{\"internalType\":\"bytes32[]\",\"name\":\"outputHashesInEpochSiblings\",\"type\":\"bytes32[]\"}],\"internalType\":\"structOutputValidityProof\",\"name\":\"validity\",\"type\":\"tuple\"},{\"internalType\":\"bytes\",\"name\":\"context\",\"type\":\"bytes\"}],\"internalType\":\"structProof\",\"name\":\"_proof\",\"type\":\"tuple\"}],\"name\":\"executeVoucher\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getConsensus\",\"outputs\":[{\"internalType\":\"crowdfundingIConsensus\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getTemplateHash\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"crowdfundingIConsensus\",\"name\":\"_newConsensus\",\"type\":\"address\"}],\"name\":\"migrateToConsensus\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256[]\",\"name\":\"\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"\",\"type\":\"uint256[]\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"name\":\"onERC1155BatchReceived\",\"outputs\":[{\"internalType\":\"bytes4\",\"name\":\"\",\"type\":\"bytes4\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"name\":\"onERC1155Received\",\"outputs\":[{\"internalType\":\"bytes4\",\"name\":\"\",\"type\":\"bytes4\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"name\":\"onERC721Received\",\"outputs\":[{\"internalType\":\"bytes4\",\"name\":\"\",\"type\":\"bytes4\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"_notice\",\"type\":\"bytes\"},{\"components\":[{\"components\":[{\"internalType\":\"uint64\",\"name\":\"inputIndexWithinEpoch\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"outputIndexWithinInput\",\"type\":\"uint64\"},{\"internalType\":\"bytes32\",\"name\":\"outputHashesRootHash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"vouchersEpochRootHash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"noticesEpochRootHash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"machineStateHash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32[]\",\"name\":\"outputHashInOutputHashesSiblings\",\"type\":\"bytes32[]\"},{\"internalType\":\"bytes32[]\",\"name\":\"outputHashesInEpochSiblings\",\"type\":\"bytes32[]\"}],\"internalType\":\"structOutputValidityProof\",\"name\":\"validity\",\"type\":\"tuple\"},{\"internalType\":\"bytes\",\"name\":\"context\",\"type\":\"bytes\"}],\"internalType\":\"structProof\",\"name\":\"_proof\",\"type\":\"tuple\"}],\"name\":\"validateNotice\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_inputIndex\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_outputIndexWithinInput\",\"type\":\"uint256\"}],\"name\":\"wasVoucherExecuted\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_receiver\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_value\",\"type\":\"uint256\"}],\"name\":\"withdrawEther\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}]", -} - -// CartesiDAppABI is the input ABI used to generate the binding from. -// Deprecated: Use CartesiDAppMetaData.ABI instead. -var CartesiDAppABI = CartesiDAppMetaData.ABI - -// CartesiDApp is an auto generated Go binding around an Ethereum crowdfunding. -type CartesiDApp struct { - CartesiDAppCaller // Read-only binding to the crowdfunding - CartesiDAppTransactor // Write-only binding to the crowdfunding - CartesiDAppFilterer // Log filterer for crowdfunding events -} - -// CartesiDAppCaller is an auto generated read-only Go binding around an Ethereum crowdfunding. -type CartesiDAppCaller struct { - crowdfunding *bind.BoundContract // Generic crowdfunding wrapper for the low level calls -} - -// CartesiDAppTransactor is an auto generated write-only Go binding around an Ethereum crowdfunding. -type CartesiDAppTransactor struct { - crowdfunding *bind.BoundContract // Generic crowdfunding wrapper for the low level calls -} - -// CartesiDAppFilterer is an auto generated log filtering Go binding around an Ethereum crowdfunding events. -type CartesiDAppFilterer struct { - crowdfunding *bind.BoundContract // Generic crowdfunding wrapper for the low level calls -} - -// CartesiDAppSession is an auto generated Go binding around an Ethereum crowdfunding, -// with pre-set call and transact options. -type CartesiDAppSession struct { - Contract *CartesiDApp // Generic crowdfunding 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 -} - -// CartesiDAppCallerSession is an auto generated read-only Go binding around an Ethereum crowdfunding, -// with pre-set call options. -type CartesiDAppCallerSession struct { - Contract *CartesiDAppCaller // Generic crowdfunding caller binding to set the session for - CallOpts bind.CallOpts // Call options to use throughout this session -} - -// CartesiDAppTransactorSession is an auto generated write-only Go binding around an Ethereum crowdfunding, -// with pre-set transact options. -type CartesiDAppTransactorSession struct { - Contract *CartesiDAppTransactor // Generic crowdfunding transactor binding to set the session for - TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session -} - -// CartesiDAppRaw is an auto generated low-level Go binding around an Ethereum crowdfunding. -type CartesiDAppRaw struct { - Contract *CartesiDApp // Generic crowdfunding binding to access the raw methods on -} - -// CartesiDAppCallerRaw is an auto generated low-level read-only Go binding around an Ethereum crowdfunding. -type CartesiDAppCallerRaw struct { - Contract *CartesiDAppCaller // Generic read-only crowdfunding binding to access the raw methods on -} - -// CartesiDAppTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum crowdfunding. -type CartesiDAppTransactorRaw struct { - Contract *CartesiDAppTransactor // Generic write-only crowdfunding binding to access the raw methods on -} - -// NewCartesiDApp creates a new instance of CartesiDApp, bound to a specific deployed crowdfunding. -func NewCartesiDApp(address common.Address, backend bind.ContractBackend) (*CartesiDApp, error) { - crowdfunding, err := bindCartesiDApp(address, backend, backend, backend) - if err != nil { - return nil, err - } - return &CartesiDApp{CartesiDAppCaller: CartesiDAppCaller{crowdfunding: crowdfunding}, CartesiDAppTransactor: CartesiDAppTransactor{crowdfunding: crowdfunding}, CartesiDAppFilterer: CartesiDAppFilterer{crowdfunding: crowdfunding}}, nil -} - -// NewCartesiDAppCaller creates a new read-only instance of CartesiDApp, bound to a specific deployed crowdfunding. -func NewCartesiDAppCaller(address common.Address, caller bind.ContractCaller) (*CartesiDAppCaller, error) { - crowdfunding, err := bindCartesiDApp(address, caller, nil, nil) - if err != nil { - return nil, err - } - return &CartesiDAppCaller{crowdfunding: crowdfunding}, nil -} - -// NewCartesiDAppTransactor creates a new write-only instance of CartesiDApp, bound to a specific deployed crowdfunding. -func NewCartesiDAppTransactor(address common.Address, transactor bind.ContractTransactor) (*CartesiDAppTransactor, error) { - crowdfunding, err := bindCartesiDApp(address, nil, transactor, nil) - if err != nil { - return nil, err - } - return &CartesiDAppTransactor{crowdfunding: crowdfunding}, nil -} - -// NewCartesiDAppFilterer creates a new log filterer instance of CartesiDApp, bound to a specific deployed crowdfunding. -func NewCartesiDAppFilterer(address common.Address, filterer bind.ContractFilterer) (*CartesiDAppFilterer, error) { - crowdfunding, err := bindCartesiDApp(address, nil, nil, filterer) - if err != nil { - return nil, err - } - return &CartesiDAppFilterer{crowdfunding: crowdfunding}, nil -} - -// bindCartesiDApp binds a generic wrapper to an already deployed crowdfunding. -func bindCartesiDApp(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { - parsed, err := CartesiDAppMetaData.GetAbi() - if err != nil { - return nil, err - } - return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil -} - -// Call invokes the (constant) crowdfunding 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 (_CartesiDApp *CartesiDAppRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _CartesiDApp.Contract.CartesiDAppCaller.crowdfunding.Call(opts, result, method, params...) -} - -// Transfer initiates a plain transaction to move funds to the crowdfunding, calling -// its default method if one is available. -func (_CartesiDApp *CartesiDAppRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _CartesiDApp.Contract.CartesiDAppTransactor.crowdfunding.Transfer(opts) -} - -// Transact invokes the (paid) crowdfunding method with params as input values. -func (_CartesiDApp *CartesiDAppRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _CartesiDApp.Contract.CartesiDAppTransactor.crowdfunding.Transact(opts, method, params...) -} - -// Call invokes the (constant) crowdfunding 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 (_CartesiDApp *CartesiDAppCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _CartesiDApp.Contract.crowdfunding.Call(opts, result, method, params...) -} - -// Transfer initiates a plain transaction to move funds to the crowdfunding, calling -// its default method if one is available. -func (_CartesiDApp *CartesiDAppTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _CartesiDApp.Contract.crowdfunding.Transfer(opts) -} - -// Transact invokes the (paid) crowdfunding method with params as input values. -func (_CartesiDApp *CartesiDAppTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _CartesiDApp.Contract.crowdfunding.Transact(opts, method, params...) -} - -// GetConsensus is a free data retrieval call binding the crowdfunding method 0x179e740b. -// -// Solidity: function getConsensus() view returns(address) -func (_CartesiDApp *CartesiDAppCaller) GetConsensus(opts *bind.CallOpts) (common.Address, error) { - var out []interface{} - err := _CartesiDApp.crowdfunding.Call(opts, &out, "getConsensus") - - if err != nil { - return *new(common.Address), err - } - - out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) - - return out0, err - -} - -// GetConsensus is a free data retrieval call binding the crowdfunding method 0x179e740b. -// -// Solidity: function getConsensus() view returns(address) -func (_CartesiDApp *CartesiDAppSession) GetConsensus() (common.Address, error) { - return _CartesiDApp.Contract.GetConsensus(&_CartesiDApp.CallOpts) -} - -// GetConsensus is a free data retrieval call binding the crowdfunding method 0x179e740b. -// -// Solidity: function getConsensus() view returns(address) -func (_CartesiDApp *CartesiDAppCallerSession) GetConsensus() (common.Address, error) { - return _CartesiDApp.Contract.GetConsensus(&_CartesiDApp.CallOpts) -} - -// GetTemplateHash is a free data retrieval call binding the crowdfunding method 0x61b12c66. -// -// Solidity: function getTemplateHash() view returns(bytes32) -func (_CartesiDApp *CartesiDAppCaller) GetTemplateHash(opts *bind.CallOpts) ([32]byte, error) { - var out []interface{} - err := _CartesiDApp.crowdfunding.Call(opts, &out, "getTemplateHash") - - if err != nil { - return *new([32]byte), err - } - - out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) - - return out0, err - -} - -// GetTemplateHash is a free data retrieval call binding the crowdfunding method 0x61b12c66. -// -// Solidity: function getTemplateHash() view returns(bytes32) -func (_CartesiDApp *CartesiDAppSession) GetTemplateHash() ([32]byte, error) { - return _CartesiDApp.Contract.GetTemplateHash(&_CartesiDApp.CallOpts) -} - -// GetTemplateHash is a free data retrieval call binding the crowdfunding method 0x61b12c66. -// -// Solidity: function getTemplateHash() view returns(bytes32) -func (_CartesiDApp *CartesiDAppCallerSession) GetTemplateHash() ([32]byte, error) { - return _CartesiDApp.Contract.GetTemplateHash(&_CartesiDApp.CallOpts) -} - -// Owner is a free data retrieval call binding the crowdfunding method 0x8da5cb5b. -// -// Solidity: function owner() view returns(address) -func (_CartesiDApp *CartesiDAppCaller) Owner(opts *bind.CallOpts) (common.Address, error) { - var out []interface{} - err := _CartesiDApp.crowdfunding.Call(opts, &out, "owner") - - if err != nil { - return *new(common.Address), err - } - - out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) - - return out0, err - -} - -// Owner is a free data retrieval call binding the crowdfunding method 0x8da5cb5b. -// -// Solidity: function owner() view returns(address) -func (_CartesiDApp *CartesiDAppSession) Owner() (common.Address, error) { - return _CartesiDApp.Contract.Owner(&_CartesiDApp.CallOpts) -} - -// Owner is a free data retrieval call binding the crowdfunding method 0x8da5cb5b. -// -// Solidity: function owner() view returns(address) -func (_CartesiDApp *CartesiDAppCallerSession) Owner() (common.Address, error) { - return _CartesiDApp.Contract.Owner(&_CartesiDApp.CallOpts) -} - -// SupportsInterface is a free data retrieval call binding the crowdfunding method 0x01ffc9a7. -// -// Solidity: function supportsInterface(bytes4 interfaceId) view returns(bool) -func (_CartesiDApp *CartesiDAppCaller) SupportsInterface(opts *bind.CallOpts, interfaceId [4]byte) (bool, error) { - var out []interface{} - err := _CartesiDApp.crowdfunding.Call(opts, &out, "supportsInterface", interfaceId) - - if err != nil { - return *new(bool), err - } - - out0 := *abi.ConvertType(out[0], new(bool)).(*bool) - - return out0, err - -} - -// SupportsInterface is a free data retrieval call binding the crowdfunding method 0x01ffc9a7. -// -// Solidity: function supportsInterface(bytes4 interfaceId) view returns(bool) -func (_CartesiDApp *CartesiDAppSession) SupportsInterface(interfaceId [4]byte) (bool, error) { - return _CartesiDApp.Contract.SupportsInterface(&_CartesiDApp.CallOpts, interfaceId) -} - -// SupportsInterface is a free data retrieval call binding the crowdfunding method 0x01ffc9a7. -// -// Solidity: function supportsInterface(bytes4 interfaceId) view returns(bool) -func (_CartesiDApp *CartesiDAppCallerSession) SupportsInterface(interfaceId [4]byte) (bool, error) { - return _CartesiDApp.Contract.SupportsInterface(&_CartesiDApp.CallOpts, interfaceId) -} - -// ValidateNotice is a free data retrieval call binding the crowdfunding method 0x96487d46. -// -// Solidity: function validateNotice(bytes _notice, ((uint64,uint64,bytes32,bytes32,bytes32,bytes32,bytes32[],bytes32[]),bytes) _proof) view returns(bool) -func (_CartesiDApp *CartesiDAppCaller) ValidateNotice(opts *bind.CallOpts, _notice []byte, _proof Proof) (bool, error) { - var out []interface{} - err := _CartesiDApp.crowdfunding.Call(opts, &out, "validateNotice", _notice, _proof) - - if err != nil { - return *new(bool), err - } - - out0 := *abi.ConvertType(out[0], new(bool)).(*bool) - - return out0, err - -} - -// ValidateNotice is a free data retrieval call binding the crowdfunding method 0x96487d46. -// -// Solidity: function validateNotice(bytes _notice, ((uint64,uint64,bytes32,bytes32,bytes32,bytes32,bytes32[],bytes32[]),bytes) _proof) view returns(bool) -func (_CartesiDApp *CartesiDAppSession) ValidateNotice(_notice []byte, _proof Proof) (bool, error) { - return _CartesiDApp.Contract.ValidateNotice(&_CartesiDApp.CallOpts, _notice, _proof) -} - -// ValidateNotice is a free data retrieval call binding the crowdfunding method 0x96487d46. -// -// Solidity: function validateNotice(bytes _notice, ((uint64,uint64,bytes32,bytes32,bytes32,bytes32,bytes32[],bytes32[]),bytes) _proof) view returns(bool) -func (_CartesiDApp *CartesiDAppCallerSession) ValidateNotice(_notice []byte, _proof Proof) (bool, error) { - return _CartesiDApp.Contract.ValidateNotice(&_CartesiDApp.CallOpts, _notice, _proof) -} - -// WasVoucherExecuted is a free data retrieval call binding the crowdfunding method 0x9d9b1145. -// -// Solidity: function wasVoucherExecuted(uint256 _inputIndex, uint256 _outputIndexWithinInput) view returns(bool) -func (_CartesiDApp *CartesiDAppCaller) WasVoucherExecuted(opts *bind.CallOpts, _inputIndex *big.Int, _outputIndexWithinInput *big.Int) (bool, error) { - var out []interface{} - err := _CartesiDApp.crowdfunding.Call(opts, &out, "wasVoucherExecuted", _inputIndex, _outputIndexWithinInput) - - if err != nil { - return *new(bool), err - } - - out0 := *abi.ConvertType(out[0], new(bool)).(*bool) - - return out0, err - -} - -// WasVoucherExecuted is a free data retrieval call binding the crowdfunding method 0x9d9b1145. -// -// Solidity: function wasVoucherExecuted(uint256 _inputIndex, uint256 _outputIndexWithinInput) view returns(bool) -func (_CartesiDApp *CartesiDAppSession) WasVoucherExecuted(_inputIndex *big.Int, _outputIndexWithinInput *big.Int) (bool, error) { - return _CartesiDApp.Contract.WasVoucherExecuted(&_CartesiDApp.CallOpts, _inputIndex, _outputIndexWithinInput) -} - -// WasVoucherExecuted is a free data retrieval call binding the crowdfunding method 0x9d9b1145. -// -// Solidity: function wasVoucherExecuted(uint256 _inputIndex, uint256 _outputIndexWithinInput) view returns(bool) -func (_CartesiDApp *CartesiDAppCallerSession) WasVoucherExecuted(_inputIndex *big.Int, _outputIndexWithinInput *big.Int) (bool, error) { - return _CartesiDApp.Contract.WasVoucherExecuted(&_CartesiDApp.CallOpts, _inputIndex, _outputIndexWithinInput) -} - -// ExecuteVoucher is a paid mutator transaction binding the crowdfunding method 0x1250482f. -// -// Solidity: function executeVoucher(address _destination, bytes _payload, ((uint64,uint64,bytes32,bytes32,bytes32,bytes32,bytes32[],bytes32[]),bytes) _proof) returns(bool) -func (_CartesiDApp *CartesiDAppTransactor) ExecuteVoucher(opts *bind.TransactOpts, _destination common.Address, _payload []byte, _proof Proof) (*types.Transaction, error) { - return _CartesiDApp.crowdfunding.Transact(opts, "executeVoucher", _destination, _payload, _proof) -} - -// ExecuteVoucher is a paid mutator transaction binding the crowdfunding method 0x1250482f. -// -// Solidity: function executeVoucher(address _destination, bytes _payload, ((uint64,uint64,bytes32,bytes32,bytes32,bytes32,bytes32[],bytes32[]),bytes) _proof) returns(bool) -func (_CartesiDApp *CartesiDAppSession) ExecuteVoucher(_destination common.Address, _payload []byte, _proof Proof) (*types.Transaction, error) { - return _CartesiDApp.Contract.ExecuteVoucher(&_CartesiDApp.TransactOpts, _destination, _payload, _proof) -} - -// ExecuteVoucher is a paid mutator transaction binding the crowdfunding method 0x1250482f. -// -// Solidity: function executeVoucher(address _destination, bytes _payload, ((uint64,uint64,bytes32,bytes32,bytes32,bytes32,bytes32[],bytes32[]),bytes) _proof) returns(bool) -func (_CartesiDApp *CartesiDAppTransactorSession) ExecuteVoucher(_destination common.Address, _payload []byte, _proof Proof) (*types.Transaction, error) { - return _CartesiDApp.Contract.ExecuteVoucher(&_CartesiDApp.TransactOpts, _destination, _payload, _proof) -} - -// MigrateToConsensus is a paid mutator transaction binding the crowdfunding method 0xfc411683. -// -// Solidity: function migrateToConsensus(address _newConsensus) returns() -func (_CartesiDApp *CartesiDAppTransactor) MigrateToConsensus(opts *bind.TransactOpts, _newConsensus common.Address) (*types.Transaction, error) { - return _CartesiDApp.crowdfunding.Transact(opts, "migrateToConsensus", _newConsensus) -} - -// MigrateToConsensus is a paid mutator transaction binding the crowdfunding method 0xfc411683. -// -// Solidity: function migrateToConsensus(address _newConsensus) returns() -func (_CartesiDApp *CartesiDAppSession) MigrateToConsensus(_newConsensus common.Address) (*types.Transaction, error) { - return _CartesiDApp.Contract.MigrateToConsensus(&_CartesiDApp.TransactOpts, _newConsensus) -} - -// MigrateToConsensus is a paid mutator transaction binding the crowdfunding method 0xfc411683. -// -// Solidity: function migrateToConsensus(address _newConsensus) returns() -func (_CartesiDApp *CartesiDAppTransactorSession) MigrateToConsensus(_newConsensus common.Address) (*types.Transaction, error) { - return _CartesiDApp.Contract.MigrateToConsensus(&_CartesiDApp.TransactOpts, _newConsensus) -} - -// OnERC1155BatchReceived is a paid mutator transaction binding the crowdfunding method 0xbc197c81. -// -// Solidity: function onERC1155BatchReceived(address , address , uint256[] , uint256[] , bytes ) returns(bytes4) -func (_CartesiDApp *CartesiDAppTransactor) OnERC1155BatchReceived(opts *bind.TransactOpts, arg0 common.Address, arg1 common.Address, arg2 []*big.Int, arg3 []*big.Int, arg4 []byte) (*types.Transaction, error) { - return _CartesiDApp.crowdfunding.Transact(opts, "onERC1155BatchReceived", arg0, arg1, arg2, arg3, arg4) -} - -// OnERC1155BatchReceived is a paid mutator transaction binding the crowdfunding method 0xbc197c81. -// -// Solidity: function onERC1155BatchReceived(address , address , uint256[] , uint256[] , bytes ) returns(bytes4) -func (_CartesiDApp *CartesiDAppSession) OnERC1155BatchReceived(arg0 common.Address, arg1 common.Address, arg2 []*big.Int, arg3 []*big.Int, arg4 []byte) (*types.Transaction, error) { - return _CartesiDApp.Contract.OnERC1155BatchReceived(&_CartesiDApp.TransactOpts, arg0, arg1, arg2, arg3, arg4) -} - -// OnERC1155BatchReceived is a paid mutator transaction binding the crowdfunding method 0xbc197c81. -// -// Solidity: function onERC1155BatchReceived(address , address , uint256[] , uint256[] , bytes ) returns(bytes4) -func (_CartesiDApp *CartesiDAppTransactorSession) OnERC1155BatchReceived(arg0 common.Address, arg1 common.Address, arg2 []*big.Int, arg3 []*big.Int, arg4 []byte) (*types.Transaction, error) { - return _CartesiDApp.Contract.OnERC1155BatchReceived(&_CartesiDApp.TransactOpts, arg0, arg1, arg2, arg3, arg4) -} - -// OnERC1155Received is a paid mutator transaction binding the crowdfunding method 0xf23a6e61. -// -// Solidity: function onERC1155Received(address , address , uint256 , uint256 , bytes ) returns(bytes4) -func (_CartesiDApp *CartesiDAppTransactor) OnERC1155Received(opts *bind.TransactOpts, arg0 common.Address, arg1 common.Address, arg2 *big.Int, arg3 *big.Int, arg4 []byte) (*types.Transaction, error) { - return _CartesiDApp.crowdfunding.Transact(opts, "onERC1155Received", arg0, arg1, arg2, arg3, arg4) -} - -// OnERC1155Received is a paid mutator transaction binding the crowdfunding method 0xf23a6e61. -// -// Solidity: function onERC1155Received(address , address , uint256 , uint256 , bytes ) returns(bytes4) -func (_CartesiDApp *CartesiDAppSession) OnERC1155Received(arg0 common.Address, arg1 common.Address, arg2 *big.Int, arg3 *big.Int, arg4 []byte) (*types.Transaction, error) { - return _CartesiDApp.Contract.OnERC1155Received(&_CartesiDApp.TransactOpts, arg0, arg1, arg2, arg3, arg4) -} - -// OnERC1155Received is a paid mutator transaction binding the crowdfunding method 0xf23a6e61. -// -// Solidity: function onERC1155Received(address , address , uint256 , uint256 , bytes ) returns(bytes4) -func (_CartesiDApp *CartesiDAppTransactorSession) OnERC1155Received(arg0 common.Address, arg1 common.Address, arg2 *big.Int, arg3 *big.Int, arg4 []byte) (*types.Transaction, error) { - return _CartesiDApp.Contract.OnERC1155Received(&_CartesiDApp.TransactOpts, arg0, arg1, arg2, arg3, arg4) -} - -// OnERC721Received is a paid mutator transaction binding the crowdfunding method 0x150b7a02. -// -// Solidity: function onERC721Received(address , address , uint256 , bytes ) returns(bytes4) -func (_CartesiDApp *CartesiDAppTransactor) OnERC721Received(opts *bind.TransactOpts, arg0 common.Address, arg1 common.Address, arg2 *big.Int, arg3 []byte) (*types.Transaction, error) { - return _CartesiDApp.crowdfunding.Transact(opts, "onERC721Received", arg0, arg1, arg2, arg3) -} - -// OnERC721Received is a paid mutator transaction binding the crowdfunding method 0x150b7a02. -// -// Solidity: function onERC721Received(address , address , uint256 , bytes ) returns(bytes4) -func (_CartesiDApp *CartesiDAppSession) OnERC721Received(arg0 common.Address, arg1 common.Address, arg2 *big.Int, arg3 []byte) (*types.Transaction, error) { - return _CartesiDApp.Contract.OnERC721Received(&_CartesiDApp.TransactOpts, arg0, arg1, arg2, arg3) -} - -// OnERC721Received is a paid mutator transaction binding the crowdfunding method 0x150b7a02. -// -// Solidity: function onERC721Received(address , address , uint256 , bytes ) returns(bytes4) -func (_CartesiDApp *CartesiDAppTransactorSession) OnERC721Received(arg0 common.Address, arg1 common.Address, arg2 *big.Int, arg3 []byte) (*types.Transaction, error) { - return _CartesiDApp.Contract.OnERC721Received(&_CartesiDApp.TransactOpts, arg0, arg1, arg2, arg3) -} - -// RenounceOwnership is a paid mutator transaction binding the crowdfunding method 0x715018a6. -// -// Solidity: function renounceOwnership() returns() -func (_CartesiDApp *CartesiDAppTransactor) RenounceOwnership(opts *bind.TransactOpts) (*types.Transaction, error) { - return _CartesiDApp.crowdfunding.Transact(opts, "renounceOwnership") -} - -// RenounceOwnership is a paid mutator transaction binding the crowdfunding method 0x715018a6. -// -// Solidity: function renounceOwnership() returns() -func (_CartesiDApp *CartesiDAppSession) RenounceOwnership() (*types.Transaction, error) { - return _CartesiDApp.Contract.RenounceOwnership(&_CartesiDApp.TransactOpts) -} - -// RenounceOwnership is a paid mutator transaction binding the crowdfunding method 0x715018a6. -// -// Solidity: function renounceOwnership() returns() -func (_CartesiDApp *CartesiDAppTransactorSession) RenounceOwnership() (*types.Transaction, error) { - return _CartesiDApp.Contract.RenounceOwnership(&_CartesiDApp.TransactOpts) -} - -// TransferOwnership is a paid mutator transaction binding the crowdfunding method 0xf2fde38b. -// -// Solidity: function transferOwnership(address newOwner) returns() -func (_CartesiDApp *CartesiDAppTransactor) TransferOwnership(opts *bind.TransactOpts, newOwner common.Address) (*types.Transaction, error) { - return _CartesiDApp.crowdfunding.Transact(opts, "transferOwnership", newOwner) -} - -// TransferOwnership is a paid mutator transaction binding the crowdfunding method 0xf2fde38b. -// -// Solidity: function transferOwnership(address newOwner) returns() -func (_CartesiDApp *CartesiDAppSession) TransferOwnership(newOwner common.Address) (*types.Transaction, error) { - return _CartesiDApp.Contract.TransferOwnership(&_CartesiDApp.TransactOpts, newOwner) -} - -// TransferOwnership is a paid mutator transaction binding the crowdfunding method 0xf2fde38b. -// -// Solidity: function transferOwnership(address newOwner) returns() -func (_CartesiDApp *CartesiDAppTransactorSession) TransferOwnership(newOwner common.Address) (*types.Transaction, error) { - return _CartesiDApp.Contract.TransferOwnership(&_CartesiDApp.TransactOpts, newOwner) -} - -// WithdrawEther is a paid mutator transaction binding the crowdfunding method 0x522f6815. -// -// Solidity: function withdrawEther(address _receiver, uint256 _value) returns() -func (_CartesiDApp *CartesiDAppTransactor) WithdrawEther(opts *bind.TransactOpts, _receiver common.Address, _value *big.Int) (*types.Transaction, error) { - return _CartesiDApp.crowdfunding.Transact(opts, "withdrawEther", _receiver, _value) -} - -// WithdrawEther is a paid mutator transaction binding the crowdfunding method 0x522f6815. -// -// Solidity: function withdrawEther(address _receiver, uint256 _value) returns() -func (_CartesiDApp *CartesiDAppSession) WithdrawEther(_receiver common.Address, _value *big.Int) (*types.Transaction, error) { - return _CartesiDApp.Contract.WithdrawEther(&_CartesiDApp.TransactOpts, _receiver, _value) -} - -// WithdrawEther is a paid mutator transaction binding the crowdfunding method 0x522f6815. -// -// Solidity: function withdrawEther(address _receiver, uint256 _value) returns() -func (_CartesiDApp *CartesiDAppTransactorSession) WithdrawEther(_receiver common.Address, _value *big.Int) (*types.Transaction, error) { - return _CartesiDApp.Contract.WithdrawEther(&_CartesiDApp.TransactOpts, _receiver, _value) -} - -// Receive is a paid mutator transaction binding the crowdfunding receive function. -// -// Solidity: receive() payable returns() -func (_CartesiDApp *CartesiDAppTransactor) Receive(opts *bind.TransactOpts) (*types.Transaction, error) { - return _CartesiDApp.crowdfunding.RawTransact(opts, nil) // calldata is disallowed for receive function -} - -// Receive is a paid mutator transaction binding the crowdfunding receive function. -// -// Solidity: receive() payable returns() -func (_CartesiDApp *CartesiDAppSession) Receive() (*types.Transaction, error) { - return _CartesiDApp.Contract.Receive(&_CartesiDApp.TransactOpts) -} - -// Receive is a paid mutator transaction binding the crowdfunding receive function. -// -// Solidity: receive() payable returns() -func (_CartesiDApp *CartesiDAppTransactorSession) Receive() (*types.Transaction, error) { - return _CartesiDApp.Contract.Receive(&_CartesiDApp.TransactOpts) -} - -// CartesiDAppNewConsensusIterator is returned from FilterNewConsensus and is used to iterate over the raw logs and unpacked data for NewConsensus events raised by the CartesiDApp crowdfunding. -type CartesiDAppNewConsensusIterator struct { - Event *CartesiDAppNewConsensus // Event containing the crowdfunding specifics and raw log - - crowdfunding *bind.BoundContract // Generic crowdfunding 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 crowdfunding 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 *CartesiDAppNewConsensusIterator) 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(CartesiDAppNewConsensus) - if err := it.crowdfunding.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(CartesiDAppNewConsensus) - if err := it.crowdfunding.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 *CartesiDAppNewConsensusIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *CartesiDAppNewConsensusIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// CartesiDAppNewConsensus represents a NewConsensus event raised by the CartesiDApp crowdfunding. -type CartesiDAppNewConsensus struct { - NewConsensus common.Address - Raw types.Log // Blockchain specific contextual infos -} - -// FilterNewConsensus is a free log retrieval operation binding the crowdfunding event 0x4991c6f37185659e276ff918a96f3e20e6c5abcd8c9aab450dc19c2f7ad35cb5. -// -// Solidity: event NewConsensus(address newConsensus) -func (_CartesiDApp *CartesiDAppFilterer) FilterNewConsensus(opts *bind.FilterOpts) (*CartesiDAppNewConsensusIterator, error) { - - logs, sub, err := _CartesiDApp.crowdfunding.FilterLogs(opts, "NewConsensus") - if err != nil { - return nil, err - } - return &CartesiDAppNewConsensusIterator{crowdfunding: _CartesiDApp.crowdfunding, event: "NewConsensus", logs: logs, sub: sub}, nil -} - -// WatchNewConsensus is a free log subscription operation binding the crowdfunding event 0x4991c6f37185659e276ff918a96f3e20e6c5abcd8c9aab450dc19c2f7ad35cb5. -// -// Solidity: event NewConsensus(address newConsensus) -func (_CartesiDApp *CartesiDAppFilterer) WatchNewConsensus(opts *bind.WatchOpts, sink chan<- *CartesiDAppNewConsensus) (event.Subscription, error) { - - logs, sub, err := _CartesiDApp.crowdfunding.WatchLogs(opts, "NewConsensus") - 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(CartesiDAppNewConsensus) - if err := _CartesiDApp.crowdfunding.UnpackLog(event, "NewConsensus", 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 -} - -// ParseNewConsensus is a log parse operation binding the crowdfunding event 0x4991c6f37185659e276ff918a96f3e20e6c5abcd8c9aab450dc19c2f7ad35cb5. -// -// Solidity: event NewConsensus(address newConsensus) -func (_CartesiDApp *CartesiDAppFilterer) ParseNewConsensus(log types.Log) (*CartesiDAppNewConsensus, error) { - event := new(CartesiDAppNewConsensus) - if err := _CartesiDApp.crowdfunding.UnpackLog(event, "NewConsensus", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -// CartesiDAppOwnershipTransferredIterator is returned from FilterOwnershipTransferred and is used to iterate over the raw logs and unpacked data for OwnershipTransferred events raised by the CartesiDApp crowdfunding. -type CartesiDAppOwnershipTransferredIterator struct { - Event *CartesiDAppOwnershipTransferred // Event containing the crowdfunding specifics and raw log - - crowdfunding *bind.BoundContract // Generic crowdfunding 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 crowdfunding 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 *CartesiDAppOwnershipTransferredIterator) 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(CartesiDAppOwnershipTransferred) - if err := it.crowdfunding.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(CartesiDAppOwnershipTransferred) - if err := it.crowdfunding.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 *CartesiDAppOwnershipTransferredIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *CartesiDAppOwnershipTransferredIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// CartesiDAppOwnershipTransferred represents a OwnershipTransferred event raised by the CartesiDApp crowdfunding. -type CartesiDAppOwnershipTransferred struct { - PreviousOwner common.Address - NewOwner common.Address - Raw types.Log // Blockchain specific contextual infos -} - -// FilterOwnershipTransferred is a free log retrieval operation binding the crowdfunding event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. -// -// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) -func (_CartesiDApp *CartesiDAppFilterer) FilterOwnershipTransferred(opts *bind.FilterOpts, previousOwner []common.Address, newOwner []common.Address) (*CartesiDAppOwnershipTransferredIterator, 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 := _CartesiDApp.crowdfunding.FilterLogs(opts, "OwnershipTransferred", previousOwnerRule, newOwnerRule) - if err != nil { - return nil, err - } - return &CartesiDAppOwnershipTransferredIterator{crowdfunding: _CartesiDApp.crowdfunding, event: "OwnershipTransferred", logs: logs, sub: sub}, nil -} - -// WatchOwnershipTransferred is a free log subscription operation binding the crowdfunding event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. -// -// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) -func (_CartesiDApp *CartesiDAppFilterer) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *CartesiDAppOwnershipTransferred, 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 := _CartesiDApp.crowdfunding.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(CartesiDAppOwnershipTransferred) - if err := _CartesiDApp.crowdfunding.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 crowdfunding event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. -// -// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) -func (_CartesiDApp *CartesiDAppFilterer) ParseOwnershipTransferred(log types.Log) (*CartesiDAppOwnershipTransferred, error) { - event := new(CartesiDAppOwnershipTransferred) - if err := _CartesiDApp.crowdfunding.UnpackLog(event, "OwnershipTransferred", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -// CartesiDAppVoucherExecutedIterator is returned from FilterVoucherExecuted and is used to iterate over the raw logs and unpacked data for VoucherExecuted events raised by the CartesiDApp crowdfunding. -type CartesiDAppVoucherExecutedIterator struct { - Event *CartesiDAppVoucherExecuted // Event containing the crowdfunding specifics and raw log - - crowdfunding *bind.BoundContract // Generic crowdfunding 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 crowdfunding 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 *CartesiDAppVoucherExecutedIterator) 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(CartesiDAppVoucherExecuted) - if err := it.crowdfunding.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(CartesiDAppVoucherExecuted) - if err := it.crowdfunding.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 *CartesiDAppVoucherExecutedIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *CartesiDAppVoucherExecutedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// CartesiDAppVoucherExecuted represents a VoucherExecuted event raised by the CartesiDApp crowdfunding. -type CartesiDAppVoucherExecuted struct { - VoucherId *big.Int - Raw types.Log // Blockchain specific contextual infos -} - -// FilterVoucherExecuted is a free log retrieval operation binding the crowdfunding event 0x0eb7ee080f865f1cadc4f54daf58cc3b8879e888832867d13351edcec0fbdc54. -// -// Solidity: event VoucherExecuted(uint256 voucherId) -func (_CartesiDApp *CartesiDAppFilterer) FilterVoucherExecuted(opts *bind.FilterOpts) (*CartesiDAppVoucherExecutedIterator, error) { - - logs, sub, err := _CartesiDApp.crowdfunding.FilterLogs(opts, "VoucherExecuted") - if err != nil { - return nil, err - } - return &CartesiDAppVoucherExecutedIterator{crowdfunding: _CartesiDApp.crowdfunding, event: "VoucherExecuted", logs: logs, sub: sub}, nil -} - -// WatchVoucherExecuted is a free log subscription operation binding the crowdfunding event 0x0eb7ee080f865f1cadc4f54daf58cc3b8879e888832867d13351edcec0fbdc54. -// -// Solidity: event VoucherExecuted(uint256 voucherId) -func (_CartesiDApp *CartesiDAppFilterer) WatchVoucherExecuted(opts *bind.WatchOpts, sink chan<- *CartesiDAppVoucherExecuted) (event.Subscription, error) { - - logs, sub, err := _CartesiDApp.crowdfunding.WatchLogs(opts, "VoucherExecuted") - 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(CartesiDAppVoucherExecuted) - if err := _CartesiDApp.crowdfunding.UnpackLog(event, "VoucherExecuted", 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 -} - -// ParseVoucherExecuted is a log parse operation binding the crowdfunding event 0x0eb7ee080f865f1cadc4f54daf58cc3b8879e888832867d13351edcec0fbdc54. -// -// Solidity: event VoucherExecuted(uint256 voucherId) -func (_CartesiDApp *CartesiDAppFilterer) ParseVoucherExecuted(log types.Log) (*CartesiDAppVoucherExecuted, error) { - event := new(CartesiDAppVoucherExecuted) - if err := _CartesiDApp.crowdfunding.UnpackLog(event, "VoucherExecuted", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} diff --git a/pkg/rollups_contracts/eip712.go b/pkg/rollups_contracts/eip712.go new file mode 100644 index 0000000..7f17bf6 --- /dev/null +++ b/pkg/rollups_contracts/eip712.go @@ -0,0 +1,384 @@ +// Code generated - DO NOT EDIT. +// This file is a generated binding and any manual changes will be lost. + +package rollups_contracts + +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 +) + +// EIP712MetaData contains all meta data concerning the EIP712 contract. +var EIP712MetaData = &bind.MetaData{ + ABI: "[{\"inputs\":[],\"name\":\"InvalidShortString\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"str\",\"type\":\"string\"}],\"name\":\"StringTooLong\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[],\"name\":\"EIP712DomainChanged\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"eip712Domain\",\"outputs\":[{\"internalType\":\"bytes1\",\"name\":\"fields\",\"type\":\"bytes1\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"version\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"verifyingContract\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"salt\",\"type\":\"bytes32\"},{\"internalType\":\"uint256[]\",\"name\":\"extensions\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", +} + +// EIP712ABI is the input ABI used to generate the binding from. +// Deprecated: Use EIP712MetaData.ABI instead. +var EIP712ABI = EIP712MetaData.ABI + +// EIP712 is an auto generated Go binding around an Ethereum contract. +type EIP712 struct { + EIP712Caller // Read-only binding to the contract + EIP712Transactor // Write-only binding to the contract + EIP712Filterer // Log filterer for contract events +} + +// EIP712Caller is an auto generated read-only Go binding around an Ethereum contract. +type EIP712Caller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// EIP712Transactor is an auto generated write-only Go binding around an Ethereum contract. +type EIP712Transactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// EIP712Filterer is an auto generated log filtering Go binding around an Ethereum contract events. +type EIP712Filterer struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// EIP712Session is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type EIP712Session struct { + Contract *EIP712 // 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 +} + +// EIP712CallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type EIP712CallerSession struct { + Contract *EIP712Caller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// EIP712TransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type EIP712TransactorSession struct { + Contract *EIP712Transactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// EIP712Raw is an auto generated low-level Go binding around an Ethereum contract. +type EIP712Raw struct { + Contract *EIP712 // Generic contract binding to access the raw methods on +} + +// EIP712CallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type EIP712CallerRaw struct { + Contract *EIP712Caller // Generic read-only contract binding to access the raw methods on +} + +// EIP712TransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type EIP712TransactorRaw struct { + Contract *EIP712Transactor // Generic write-only contract binding to access the raw methods on +} + +// NewEIP712 creates a new instance of EIP712, bound to a specific deployed contract. +func NewEIP712(address common.Address, backend bind.ContractBackend) (*EIP712, error) { + contract, err := bindEIP712(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &EIP712{EIP712Caller: EIP712Caller{contract: contract}, EIP712Transactor: EIP712Transactor{contract: contract}, EIP712Filterer: EIP712Filterer{contract: contract}}, nil +} + +// NewEIP712Caller creates a new read-only instance of EIP712, bound to a specific deployed contract. +func NewEIP712Caller(address common.Address, caller bind.ContractCaller) (*EIP712Caller, error) { + contract, err := bindEIP712(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &EIP712Caller{contract: contract}, nil +} + +// NewEIP712Transactor creates a new write-only instance of EIP712, bound to a specific deployed contract. +func NewEIP712Transactor(address common.Address, transactor bind.ContractTransactor) (*EIP712Transactor, error) { + contract, err := bindEIP712(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &EIP712Transactor{contract: contract}, nil +} + +// NewEIP712Filterer creates a new log filterer instance of EIP712, bound to a specific deployed contract. +func NewEIP712Filterer(address common.Address, filterer bind.ContractFilterer) (*EIP712Filterer, error) { + contract, err := bindEIP712(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &EIP712Filterer{contract: contract}, nil +} + +// bindEIP712 binds a generic wrapper to an already deployed contract. +func bindEIP712(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := EIP712MetaData.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 (_EIP712 *EIP712Raw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _EIP712.Contract.EIP712Caller.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 (_EIP712 *EIP712Raw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _EIP712.Contract.EIP712Transactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_EIP712 *EIP712Raw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _EIP712.Contract.EIP712Transactor.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 (_EIP712 *EIP712CallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _EIP712.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 (_EIP712 *EIP712TransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _EIP712.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_EIP712 *EIP712TransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _EIP712.Contract.contract.Transact(opts, method, params...) +} + +// Eip712Domain is a free data retrieval call binding the contract method 0x84b0196e. +// +// Solidity: function eip712Domain() view returns(bytes1 fields, string name, string version, uint256 chainId, address verifyingContract, bytes32 salt, uint256[] extensions) +func (_EIP712 *EIP712Caller) Eip712Domain(opts *bind.CallOpts) (struct { + Fields [1]byte + Name string + Version string + ChainId *big.Int + VerifyingContract common.Address + Salt [32]byte + Extensions []*big.Int +}, error) { + var out []interface{} + err := _EIP712.contract.Call(opts, &out, "eip712Domain") + + outstruct := new(struct { + Fields [1]byte + Name string + Version string + ChainId *big.Int + VerifyingContract common.Address + Salt [32]byte + Extensions []*big.Int + }) + if err != nil { + return *outstruct, err + } + + outstruct.Fields = *abi.ConvertType(out[0], new([1]byte)).(*[1]byte) + outstruct.Name = *abi.ConvertType(out[1], new(string)).(*string) + outstruct.Version = *abi.ConvertType(out[2], new(string)).(*string) + outstruct.ChainId = *abi.ConvertType(out[3], new(*big.Int)).(**big.Int) + outstruct.VerifyingContract = *abi.ConvertType(out[4], new(common.Address)).(*common.Address) + outstruct.Salt = *abi.ConvertType(out[5], new([32]byte)).(*[32]byte) + outstruct.Extensions = *abi.ConvertType(out[6], new([]*big.Int)).(*[]*big.Int) + + return *outstruct, err + +} + +// Eip712Domain is a free data retrieval call binding the contract method 0x84b0196e. +// +// Solidity: function eip712Domain() view returns(bytes1 fields, string name, string version, uint256 chainId, address verifyingContract, bytes32 salt, uint256[] extensions) +func (_EIP712 *EIP712Session) Eip712Domain() (struct { + Fields [1]byte + Name string + Version string + ChainId *big.Int + VerifyingContract common.Address + Salt [32]byte + Extensions []*big.Int +}, error) { + return _EIP712.Contract.Eip712Domain(&_EIP712.CallOpts) +} + +// Eip712Domain is a free data retrieval call binding the contract method 0x84b0196e. +// +// Solidity: function eip712Domain() view returns(bytes1 fields, string name, string version, uint256 chainId, address verifyingContract, bytes32 salt, uint256[] extensions) +func (_EIP712 *EIP712CallerSession) Eip712Domain() (struct { + Fields [1]byte + Name string + Version string + ChainId *big.Int + VerifyingContract common.Address + Salt [32]byte + Extensions []*big.Int +}, error) { + return _EIP712.Contract.Eip712Domain(&_EIP712.CallOpts) +} + +// EIP712EIP712DomainChangedIterator is returned from FilterEIP712DomainChanged and is used to iterate over the raw logs and unpacked data for EIP712DomainChanged events raised by the EIP712 contract. +type EIP712EIP712DomainChangedIterator struct { + Event *EIP712EIP712DomainChanged // 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 *EIP712EIP712DomainChangedIterator) 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(EIP712EIP712DomainChanged) + 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(EIP712EIP712DomainChanged) + 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 *EIP712EIP712DomainChangedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *EIP712EIP712DomainChangedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// EIP712EIP712DomainChanged represents a EIP712DomainChanged event raised by the EIP712 contract. +type EIP712EIP712DomainChanged struct { + Raw types.Log // Blockchain specific contextual infos +} + +// FilterEIP712DomainChanged is a free log retrieval operation binding the contract event 0x0a6387c9ea3628b88a633bb4f3b151770f70085117a15f9bf3787cda53f13d31. +// +// Solidity: event EIP712DomainChanged() +func (_EIP712 *EIP712Filterer) FilterEIP712DomainChanged(opts *bind.FilterOpts) (*EIP712EIP712DomainChangedIterator, error) { + + logs, sub, err := _EIP712.contract.FilterLogs(opts, "EIP712DomainChanged") + if err != nil { + return nil, err + } + return &EIP712EIP712DomainChangedIterator{contract: _EIP712.contract, event: "EIP712DomainChanged", logs: logs, sub: sub}, nil +} + +// WatchEIP712DomainChanged is a free log subscription operation binding the contract event 0x0a6387c9ea3628b88a633bb4f3b151770f70085117a15f9bf3787cda53f13d31. +// +// Solidity: event EIP712DomainChanged() +func (_EIP712 *EIP712Filterer) WatchEIP712DomainChanged(opts *bind.WatchOpts, sink chan<- *EIP712EIP712DomainChanged) (event.Subscription, error) { + + logs, sub, err := _EIP712.contract.WatchLogs(opts, "EIP712DomainChanged") + 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(EIP712EIP712DomainChanged) + if err := _EIP712.contract.UnpackLog(event, "EIP712DomainChanged", 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 +} + +// ParseEIP712DomainChanged is a log parse operation binding the contract event 0x0a6387c9ea3628b88a633bb4f3b151770f70085117a15f9bf3787cda53f13d31. +// +// Solidity: event EIP712DomainChanged() +func (_EIP712 *EIP712Filterer) ParseEIP712DomainChanged(log types.Log) (*EIP712EIP712DomainChanged, error) { + event := new(EIP712EIP712DomainChanged) + if err := _EIP712.contract.UnpackLog(event, "EIP712DomainChanged", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} diff --git a/pkg/rollups_contracts/erc20_portal.go b/pkg/rollups_contracts/erc20_portal.go index ed36f1a..da60c80 100644 --- a/pkg/rollups_contracts/erc20_portal.go +++ b/pkg/rollups_contracts/erc20_portal.go @@ -1,7 +1,7 @@ // Code generated - DO NOT EDIT. // This file is a generated binding and any manual changes will be lost. -package rollups_crowdfundings +package rollups_contracts import ( "errors" @@ -29,111 +29,111 @@ var ( _ = abi.ConvertType ) -// ERC20PortalMetaData contains all meta data concerning the ERC20Portal crowdfunding. +// ERC20PortalMetaData contains all meta data concerning the ERC20Portal contract. var ERC20PortalMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"internalType\":\"crowdfundingIInputBox\",\"name\":\"_inputBox\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"crowdfundingIERC20\",\"name\":\"_token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_dapp\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"_execLayerData\",\"type\":\"bytes\"}],\"name\":\"depositERC20Tokens\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getInputBox\",\"outputs\":[{\"internalType\":\"crowdfundingIInputBox\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", + ABI: "[{\"inputs\":[{\"internalType\":\"contractIInputBox\",\"name\":\"inputBox\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"ERC20TransferFailed\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"contractIERC20\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"appContract\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"execLayerData\",\"type\":\"bytes\"}],\"name\":\"depositERC20Tokens\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getInputBox\",\"outputs\":[{\"internalType\":\"contractIInputBox\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", } // ERC20PortalABI is the input ABI used to generate the binding from. // Deprecated: Use ERC20PortalMetaData.ABI instead. var ERC20PortalABI = ERC20PortalMetaData.ABI -// ERC20Portal is an auto generated Go binding around an Ethereum crowdfunding. +// ERC20Portal is an auto generated Go binding around an Ethereum contract. type ERC20Portal struct { - ERC20PortalCaller // Read-only binding to the crowdfunding - ERC20PortalTransactor // Write-only binding to the crowdfunding - ERC20PortalFilterer // Log filterer for crowdfunding events + ERC20PortalCaller // Read-only binding to the contract + ERC20PortalTransactor // Write-only binding to the contract + ERC20PortalFilterer // Log filterer for contract events } -// ERC20PortalCaller is an auto generated read-only Go binding around an Ethereum crowdfunding. +// ERC20PortalCaller is an auto generated read-only Go binding around an Ethereum contract. type ERC20PortalCaller struct { - crowdfunding *bind.BoundContract // Generic crowdfunding wrapper for the low level calls + contract *bind.BoundContract // Generic contract wrapper for the low level calls } -// ERC20PortalTransactor is an auto generated write-only Go binding around an Ethereum crowdfunding. +// ERC20PortalTransactor is an auto generated write-only Go binding around an Ethereum contract. type ERC20PortalTransactor struct { - crowdfunding *bind.BoundContract // Generic crowdfunding wrapper for the low level calls + contract *bind.BoundContract // Generic contract wrapper for the low level calls } -// ERC20PortalFilterer is an auto generated log filtering Go binding around an Ethereum crowdfunding events. +// ERC20PortalFilterer is an auto generated log filtering Go binding around an Ethereum contract events. type ERC20PortalFilterer struct { - crowdfunding *bind.BoundContract // Generic crowdfunding wrapper for the low level calls + contract *bind.BoundContract // Generic contract wrapper for the low level calls } -// ERC20PortalSession is an auto generated Go binding around an Ethereum crowdfunding, +// ERC20PortalSession is an auto generated Go binding around an Ethereum contract, // with pre-set call and transact options. type ERC20PortalSession struct { - Contract *ERC20Portal // Generic crowdfunding binding to set the session for + Contract *ERC20Portal // 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 } -// ERC20PortalCallerSession is an auto generated read-only Go binding around an Ethereum crowdfunding, +// ERC20PortalCallerSession is an auto generated read-only Go binding around an Ethereum contract, // with pre-set call options. type ERC20PortalCallerSession struct { - Contract *ERC20PortalCaller // Generic crowdfunding caller binding to set the session for + Contract *ERC20PortalCaller // Generic contract caller binding to set the session for CallOpts bind.CallOpts // Call options to use throughout this session } -// ERC20PortalTransactorSession is an auto generated write-only Go binding around an Ethereum crowdfunding, +// ERC20PortalTransactorSession is an auto generated write-only Go binding around an Ethereum contract, // with pre-set transact options. type ERC20PortalTransactorSession struct { - Contract *ERC20PortalTransactor // Generic crowdfunding transactor binding to set the session for + Contract *ERC20PortalTransactor // Generic contract transactor binding to set the session for TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session } -// ERC20PortalRaw is an auto generated low-level Go binding around an Ethereum crowdfunding. +// ERC20PortalRaw is an auto generated low-level Go binding around an Ethereum contract. type ERC20PortalRaw struct { - Contract *ERC20Portal // Generic crowdfunding binding to access the raw methods on + Contract *ERC20Portal // Generic contract binding to access the raw methods on } -// ERC20PortalCallerRaw is an auto generated low-level read-only Go binding around an Ethereum crowdfunding. +// ERC20PortalCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. type ERC20PortalCallerRaw struct { - Contract *ERC20PortalCaller // Generic read-only crowdfunding binding to access the raw methods on + Contract *ERC20PortalCaller // Generic read-only contract binding to access the raw methods on } -// ERC20PortalTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum crowdfunding. +// ERC20PortalTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. type ERC20PortalTransactorRaw struct { - Contract *ERC20PortalTransactor // Generic write-only crowdfunding binding to access the raw methods on + Contract *ERC20PortalTransactor // Generic write-only contract binding to access the raw methods on } -// NewERC20Portal creates a new instance of ERC20Portal, bound to a specific deployed crowdfunding. +// NewERC20Portal creates a new instance of ERC20Portal, bound to a specific deployed contract. func NewERC20Portal(address common.Address, backend bind.ContractBackend) (*ERC20Portal, error) { - crowdfunding, err := bindERC20Portal(address, backend, backend, backend) + contract, err := bindERC20Portal(address, backend, backend, backend) if err != nil { return nil, err } - return &ERC20Portal{ERC20PortalCaller: ERC20PortalCaller{crowdfunding: crowdfunding}, ERC20PortalTransactor: ERC20PortalTransactor{crowdfunding: crowdfunding}, ERC20PortalFilterer: ERC20PortalFilterer{crowdfunding: crowdfunding}}, nil + return &ERC20Portal{ERC20PortalCaller: ERC20PortalCaller{contract: contract}, ERC20PortalTransactor: ERC20PortalTransactor{contract: contract}, ERC20PortalFilterer: ERC20PortalFilterer{contract: contract}}, nil } -// NewERC20PortalCaller creates a new read-only instance of ERC20Portal, bound to a specific deployed crowdfunding. +// NewERC20PortalCaller creates a new read-only instance of ERC20Portal, bound to a specific deployed contract. func NewERC20PortalCaller(address common.Address, caller bind.ContractCaller) (*ERC20PortalCaller, error) { - crowdfunding, err := bindERC20Portal(address, caller, nil, nil) + contract, err := bindERC20Portal(address, caller, nil, nil) if err != nil { return nil, err } - return &ERC20PortalCaller{crowdfunding: crowdfunding}, nil + return &ERC20PortalCaller{contract: contract}, nil } -// NewERC20PortalTransactor creates a new write-only instance of ERC20Portal, bound to a specific deployed crowdfunding. +// NewERC20PortalTransactor creates a new write-only instance of ERC20Portal, bound to a specific deployed contract. func NewERC20PortalTransactor(address common.Address, transactor bind.ContractTransactor) (*ERC20PortalTransactor, error) { - crowdfunding, err := bindERC20Portal(address, nil, transactor, nil) + contract, err := bindERC20Portal(address, nil, transactor, nil) if err != nil { return nil, err } - return &ERC20PortalTransactor{crowdfunding: crowdfunding}, nil + return &ERC20PortalTransactor{contract: contract}, nil } -// NewERC20PortalFilterer creates a new log filterer instance of ERC20Portal, bound to a specific deployed crowdfunding. +// NewERC20PortalFilterer creates a new log filterer instance of ERC20Portal, bound to a specific deployed contract. func NewERC20PortalFilterer(address common.Address, filterer bind.ContractFilterer) (*ERC20PortalFilterer, error) { - crowdfunding, err := bindERC20Portal(address, nil, nil, filterer) + contract, err := bindERC20Portal(address, nil, nil, filterer) if err != nil { return nil, err } - return &ERC20PortalFilterer{crowdfunding: crowdfunding}, nil + return &ERC20PortalFilterer{contract: contract}, nil } -// bindERC20Portal binds a generic wrapper to an already deployed crowdfunding. +// bindERC20Portal binds a generic wrapper to an already deployed contract. func bindERC20Portal(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { parsed, err := ERC20PortalMetaData.GetAbi() if err != nil { @@ -142,50 +142,50 @@ func bindERC20Portal(address common.Address, caller bind.ContractCaller, transac return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil } -// Call invokes the (constant) crowdfunding method with params as input values and +// 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 (_ERC20Portal *ERC20PortalRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _ERC20Portal.Contract.ERC20PortalCaller.crowdfunding.Call(opts, result, method, params...) + return _ERC20Portal.Contract.ERC20PortalCaller.contract.Call(opts, result, method, params...) } -// Transfer initiates a plain transaction to move funds to the crowdfunding, calling +// Transfer initiates a plain transaction to move funds to the contract, calling // its default method if one is available. func (_ERC20Portal *ERC20PortalRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _ERC20Portal.Contract.ERC20PortalTransactor.crowdfunding.Transfer(opts) + return _ERC20Portal.Contract.ERC20PortalTransactor.contract.Transfer(opts) } -// Transact invokes the (paid) crowdfunding method with params as input values. +// Transact invokes the (paid) contract method with params as input values. func (_ERC20Portal *ERC20PortalRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _ERC20Portal.Contract.ERC20PortalTransactor.crowdfunding.Transact(opts, method, params...) + return _ERC20Portal.Contract.ERC20PortalTransactor.contract.Transact(opts, method, params...) } -// Call invokes the (constant) crowdfunding method with params as input values and +// 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 (_ERC20Portal *ERC20PortalCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _ERC20Portal.Contract.crowdfunding.Call(opts, result, method, params...) + return _ERC20Portal.Contract.contract.Call(opts, result, method, params...) } -// Transfer initiates a plain transaction to move funds to the crowdfunding, calling +// Transfer initiates a plain transaction to move funds to the contract, calling // its default method if one is available. func (_ERC20Portal *ERC20PortalTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _ERC20Portal.Contract.crowdfunding.Transfer(opts) + return _ERC20Portal.Contract.contract.Transfer(opts) } -// Transact invokes the (paid) crowdfunding method with params as input values. +// Transact invokes the (paid) contract method with params as input values. func (_ERC20Portal *ERC20PortalTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _ERC20Portal.Contract.crowdfunding.Transact(opts, method, params...) + return _ERC20Portal.Contract.contract.Transact(opts, method, params...) } -// GetInputBox is a free data retrieval call binding the crowdfunding method 0x00aace9a. +// GetInputBox is a free data retrieval call binding the contract method 0x00aace9a. // // Solidity: function getInputBox() view returns(address) func (_ERC20Portal *ERC20PortalCaller) GetInputBox(opts *bind.CallOpts) (common.Address, error) { var out []interface{} - err := _ERC20Portal.crowdfunding.Call(opts, &out, "getInputBox") + err := _ERC20Portal.contract.Call(opts, &out, "getInputBox") if err != nil { return *new(common.Address), err @@ -197,37 +197,37 @@ func (_ERC20Portal *ERC20PortalCaller) GetInputBox(opts *bind.CallOpts) (common. } -// GetInputBox is a free data retrieval call binding the crowdfunding method 0x00aace9a. +// GetInputBox is a free data retrieval call binding the contract method 0x00aace9a. // // Solidity: function getInputBox() view returns(address) func (_ERC20Portal *ERC20PortalSession) GetInputBox() (common.Address, error) { return _ERC20Portal.Contract.GetInputBox(&_ERC20Portal.CallOpts) } -// GetInputBox is a free data retrieval call binding the crowdfunding method 0x00aace9a. +// GetInputBox is a free data retrieval call binding the contract method 0x00aace9a. // // Solidity: function getInputBox() view returns(address) func (_ERC20Portal *ERC20PortalCallerSession) GetInputBox() (common.Address, error) { return _ERC20Portal.Contract.GetInputBox(&_ERC20Portal.CallOpts) } -// DepositERC20Tokens is a paid mutator transaction binding the crowdfunding method 0x95854b81. +// DepositERC20Tokens is a paid mutator transaction binding the contract method 0x95854b81. // -// Solidity: function depositERC20Tokens(address _token, address _dapp, uint256 _amount, bytes _execLayerData) returns() -func (_ERC20Portal *ERC20PortalTransactor) DepositERC20Tokens(opts *bind.TransactOpts, _token common.Address, _dapp common.Address, _amount *big.Int, _execLayerData []byte) (*types.Transaction, error) { - return _ERC20Portal.crowdfunding.Transact(opts, "depositERC20Tokens", _token, _dapp, _amount, _execLayerData) +// Solidity: function depositERC20Tokens(address token, address appContract, uint256 value, bytes execLayerData) returns() +func (_ERC20Portal *ERC20PortalTransactor) DepositERC20Tokens(opts *bind.TransactOpts, token common.Address, appContract common.Address, value *big.Int, execLayerData []byte) (*types.Transaction, error) { + return _ERC20Portal.contract.Transact(opts, "depositERC20Tokens", token, appContract, value, execLayerData) } -// DepositERC20Tokens is a paid mutator transaction binding the crowdfunding method 0x95854b81. +// DepositERC20Tokens is a paid mutator transaction binding the contract method 0x95854b81. // -// Solidity: function depositERC20Tokens(address _token, address _dapp, uint256 _amount, bytes _execLayerData) returns() -func (_ERC20Portal *ERC20PortalSession) DepositERC20Tokens(_token common.Address, _dapp common.Address, _amount *big.Int, _execLayerData []byte) (*types.Transaction, error) { - return _ERC20Portal.Contract.DepositERC20Tokens(&_ERC20Portal.TransactOpts, _token, _dapp, _amount, _execLayerData) +// Solidity: function depositERC20Tokens(address token, address appContract, uint256 value, bytes execLayerData) returns() +func (_ERC20Portal *ERC20PortalSession) DepositERC20Tokens(token common.Address, appContract common.Address, value *big.Int, execLayerData []byte) (*types.Transaction, error) { + return _ERC20Portal.Contract.DepositERC20Tokens(&_ERC20Portal.TransactOpts, token, appContract, value, execLayerData) } -// DepositERC20Tokens is a paid mutator transaction binding the crowdfunding method 0x95854b81. +// DepositERC20Tokens is a paid mutator transaction binding the contract method 0x95854b81. // -// Solidity: function depositERC20Tokens(address _token, address _dapp, uint256 _amount, bytes _execLayerData) returns() -func (_ERC20Portal *ERC20PortalTransactorSession) DepositERC20Tokens(_token common.Address, _dapp common.Address, _amount *big.Int, _execLayerData []byte) (*types.Transaction, error) { - return _ERC20Portal.Contract.DepositERC20Tokens(&_ERC20Portal.TransactOpts, _token, _dapp, _amount, _execLayerData) +// Solidity: function depositERC20Tokens(address token, address appContract, uint256 value, bytes execLayerData) returns() +func (_ERC20Portal *ERC20PortalTransactorSession) DepositERC20Tokens(token common.Address, appContract common.Address, value *big.Int, execLayerData []byte) (*types.Transaction, error) { + return _ERC20Portal.Contract.DepositERC20Tokens(&_ERC20Portal.TransactOpts, token, appContract, value, execLayerData) } diff --git a/pkg/rollups_contracts/generate/main.go b/pkg/rollups_contracts/generate/main.go index 36faa17..b6ea05b 100644 --- a/pkg/rollups_contracts/generate/main.go +++ b/pkg/rollups_contracts/generate/main.go @@ -1,144 +1,194 @@ -// SPDX-License-Identifier: Apache-2.0 (see LICENSE) - -// This binary generates the Go bindings for the Cartesi Rollups crowdfundings. -// This binary should be called with `go generate` in the parent dir. -// First, it downloads the Cartesi Rollups npm package containing the crowdfundings. -// Then, it generates the bindings using abi-gen. -// Finally, it stores the bindings in the current directory. package main import ( "archive/tar" "compress/gzip" "encoding/json" + "fmt" "io" "log" + "log/slog" "net/http" "os" "github.com/ethereum/go-ethereum/accounts/abi/bind" ) -const rollupsCrowdfundingsUrl = "https://registry.npmjs.org/@cartesi/rollups/-/rollups-1.4.0.tgz" -const baseCrowdfundingsPath = "package/export/artifacts/crowdfundings/" -const bindingPkg = "rollups_crowdfundings" +const ( + openzeppelin = "https://registry.npmjs.org/@openzeppelin/contracts/-/contracts-5.0.2.tgz" + rollupsContractsUrl = "https://registry.npmjs.org/@cartesi/rollups/-/rollups-2.0.0-rc.10.tgz" + baseContractsPath = "package/export/artifacts/contracts/" + bindingPkg = "rollups_contracts" +) -type crowdfundingBinding struct { +type contractBinding struct { jsonPath string typeName string outFile string } -var bindings = []crowdfundingBinding{ +var bindings = []contractBinding{ + { + jsonPath: "package/build/contracts/EIP712.json", + typeName: "EIP712", + outFile: "./pkg/rollups_contracts/eip712.go", + }, { - jsonPath: baseCrowdfundingsPath + "inputs/InputBox.sol/InputBox.json", + jsonPath: baseContractsPath + "inputs/InputBox.sol/InputBox.json", typeName: "InputBox", - outFile: "./pkg/rollups_crowdfundings/input_box.go", + outFile: "./pkg/rollups_contracts/input_box.go", }, { - jsonPath: baseCrowdfundingsPath + "portals/ERC20Portal.sol/ERC20Portal.json", - typeName: "ERC20Portal", - outFile: "./pkg/rollups_crowdfundings/erc20_portal.go", + jsonPath: baseContractsPath + "dapp/Application.sol/Application.json", + typeName: "Application", + outFile: "./pkg/rollups_contracts/application.go", }, { - jsonPath: baseCrowdfundingsPath + "dapp/CartesiDApp.sol/CartesiDApp.json", - typeName: "CartesiDApp", - outFile: "./pkg/rollups_crowdfundings/cartesi_dapp.go", + jsonPath: baseContractsPath + "portals/ERC20Portal.sol/ERC20Portal.json", + typeName: "ERC20Portal", + outFile: "./pkg/rollups_contracts/erc20_portal.go", }, } func main() { - crowdfundingsZip := downloadCrowdfundings(rollupsCrowdfundingsUrl) - defer crowdfundingsZip.Close() - crowdfundingsTar := unzip(crowdfundingsZip) - defer crowdfundingsTar.Close() + // Configurar logs detalhados + slog.Info("Starting contract bindings generation") + + // Baixar e descompactar pacotes de contratos + contractsZip, err := downloadContracts(rollupsContractsUrl) + checkErr("download contracts", err) + defer contractsZip.Close() + contractsTar, err := unzip(contractsZip) + checkErr("unzip contracts", err) + defer contractsTar.Close() + + contractsOpenZeppelin, err := downloadContracts(openzeppelin) + checkErr("download OpenZeppelin contracts", err) + defer contractsOpenZeppelin.Close() + + contractsTarOpenZeppelin, err := unzip(contractsOpenZeppelin) + checkErr("unzip OpenZeppelin contracts", err) + defer contractsTarOpenZeppelin.Close() + + // Mapear arquivos necessários files := make(map[string]bool) for _, b := range bindings { files[b.jsonPath] = true } - contents := readFilesFromTar(crowdfundingsTar, files) + contents, err := readFilesFromTar(contractsTar, files) + checkErr("read files from tar (Rollups)", err) + + contentsZ, err := readFilesFromTar(contractsTarOpenZeppelin, files) + checkErr("read files from tar (OpenZeppelin)", err) + + // Mesclar conteúdos de ambos os pacotes + for key, content := range contentsZ { + contents[key] = content + } + + // Gerar bindings para cada contrato for _, b := range bindings { content := contents[b.jsonPath] if content == nil { - log.Fatal("missing contents for ", b.jsonPath) + log.Fatalf("missing contents for %s", b.jsonPath) } generateBinding(b, content) } + + slog.Info("Contract bindings generation completed successfully") } // Exit if there is any error. func checkErr(context string, err any) { if err != nil { - log.Fatal(context, ": ", err) + log.Fatalf("%s: %v", context, err) } } -// Download the crowdfundings from rollupsCrowdfundingsUrl. -// Return the buffer with the crowdfundings. -func downloadCrowdfundings(url string) io.ReadCloser { - log.Print("downloading crowdfundings from ", url) +// Download the contracts from the provided URL. +func downloadContracts(url string) (io.ReadCloser, error) { + slog.Info("Downloading contracts", slog.String("url", url)) response, err := http.Get(url) - checkErr("download tgz", err) + if err != nil { + return nil, fmt.Errorf("failed to download contracts from %s: %w", url, err) + } if response.StatusCode != http.StatusOK { - response.Body.Close() - log.Fatal("invalid status: ", response.Status) + defer response.Body.Close() + return nil, fmt.Errorf("failed to download contracts from %s: status code %s", url, response.Status) } - return response.Body + return response.Body, nil } -// Decompress the buffer with the crowdfundings. -func unzip(r io.Reader) io.ReadCloser { - log.Print("unziping crowdfundings") +// Decompress the buffer with the contracts. +func unzip(r io.Reader) (io.ReadCloser, error) { + slog.Info("Unzipping contracts") gzipReader, err := gzip.NewReader(r) - checkErr("unziping", err) - return gzipReader + if err != nil { + return nil, fmt.Errorf("failed to unzip: %w", err) + } + return gzipReader, nil } -// Read the required files from the tar. -// Return a map with the file contents. -func readFilesFromTar(r io.Reader, files map[string]bool) map[string][]byte { +// Read the required files from the tar archive. +func readFilesFromTar(r io.Reader, files map[string]bool) (map[string][]byte, error) { contents := make(map[string][]byte) tarReader := tar.NewReader(r) + for { header, err := tarReader.Next() if err == io.EOF { break // End of archive } - checkErr("read tar", err) + if err != nil { + return nil, fmt.Errorf("error while reading tar: %w", err) + } + if files[header.Name] { + slog.Info("Found file in tar", slog.String("name", header.Name)) contents[header.Name], err = io.ReadAll(tarReader) - checkErr("read tar", err) + if err != nil { + return nil, fmt.Errorf("error while reading file inside tar: %w", err) + } } } - return contents + return contents, nil } -// Get the .abi key from the json +// Extract the ABI from the contract JSON. func getAbi(rawJson []byte) []byte { var contents struct { Abi json.RawMessage `json:"abi"` } err := json.Unmarshal(rawJson, &contents) - checkErr("decode json", err) + checkErr("decode JSON", err) return contents.Abi } -// Generate the Go bindings for the crowdfundings. -func generateBinding(b crowdfundingBinding, content []byte) { +// Generate the Go bindings for the contracts. +func generateBinding(b contractBinding, content []byte) { + // Ensure the output directory exists + err := os.MkdirAll("./pkg/rollups_contracts", 0755) + checkErr("create output directory", err) + + // Prepare binding parameters + abi := getAbi(content) var ( sigs []map[string]string - abis = []string{string(getAbi(content))} + abis = []string{string(abi)} bins = []string{""} types = []string{b.typeName} libs = make(map[string]string) aliases = make(map[string]string) ) + + // Generate bindings code, err := bind.Bind(types, abis, bins, sigs, bindingPkg, bind.LangGo, libs, aliases) checkErr("generate binding", err) - const fileMode = 0600 - err = os.WriteFile(b.outFile, []byte(code), fileMode) + + // Write binding to file + err = os.WriteFile(b.outFile, []byte(code), 0600) checkErr("write binding file", err) - log.Print("generated binding ", b.outFile) + slog.Info("Generated binding", slog.String("file", b.outFile)) } diff --git a/pkg/rollups_contracts/input_box.go b/pkg/rollups_contracts/input_box.go index a29905a..cdea5ec 100644 --- a/pkg/rollups_contracts/input_box.go +++ b/pkg/rollups_contracts/input_box.go @@ -1,7 +1,7 @@ // Code generated - DO NOT EDIT. // This file is a generated binding and any manual changes will be lost. -package rollups_crowdfundings +package rollups_contracts import ( "errors" @@ -29,111 +29,111 @@ var ( _ = abi.ConvertType ) -// InputBoxMetaData contains all meta data concerning the InputBox crowdfunding. +// InputBoxMetaData contains all meta data concerning the InputBox contract. var InputBoxMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[],\"name\":\"InputSizeExceedsLimit\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"dapp\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"inputIndex\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"input\",\"type\":\"bytes\"}],\"name\":\"InputAdded\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_dapp\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_input\",\"type\":\"bytes\"}],\"name\":\"addInput\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_dapp\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_index\",\"type\":\"uint256\"}],\"name\":\"getInputHash\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_dapp\",\"type\":\"address\"}],\"name\":\"getNumberOfInputs\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", + ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"appContract\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"inputLength\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxInputLength\",\"type\":\"uint256\"}],\"name\":\"InputTooLarge\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"appContract\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"input\",\"type\":\"bytes\"}],\"name\":\"InputAdded\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"appContract\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"payload\",\"type\":\"bytes\"}],\"name\":\"addInput\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"appContract\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"getInputHash\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"appContract\",\"type\":\"address\"}],\"name\":\"getNumberOfInputs\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", } // InputBoxABI is the input ABI used to generate the binding from. // Deprecated: Use InputBoxMetaData.ABI instead. var InputBoxABI = InputBoxMetaData.ABI -// InputBox is an auto generated Go binding around an Ethereum crowdfunding. +// InputBox is an auto generated Go binding around an Ethereum contract. type InputBox struct { - InputBoxCaller // Read-only binding to the crowdfunding - InputBoxTransactor // Write-only binding to the crowdfunding - InputBoxFilterer // Log filterer for crowdfunding events + InputBoxCaller // Read-only binding to the contract + InputBoxTransactor // Write-only binding to the contract + InputBoxFilterer // Log filterer for contract events } -// InputBoxCaller is an auto generated read-only Go binding around an Ethereum crowdfunding. +// InputBoxCaller is an auto generated read-only Go binding around an Ethereum contract. type InputBoxCaller struct { - crowdfunding *bind.BoundContract // Generic crowdfunding wrapper for the low level calls + contract *bind.BoundContract // Generic contract wrapper for the low level calls } -// InputBoxTransactor is an auto generated write-only Go binding around an Ethereum crowdfunding. +// InputBoxTransactor is an auto generated write-only Go binding around an Ethereum contract. type InputBoxTransactor struct { - crowdfunding *bind.BoundContract // Generic crowdfunding wrapper for the low level calls + contract *bind.BoundContract // Generic contract wrapper for the low level calls } -// InputBoxFilterer is an auto generated log filtering Go binding around an Ethereum crowdfunding events. +// InputBoxFilterer is an auto generated log filtering Go binding around an Ethereum contract events. type InputBoxFilterer struct { - crowdfunding *bind.BoundContract // Generic crowdfunding wrapper for the low level calls + contract *bind.BoundContract // Generic contract wrapper for the low level calls } -// InputBoxSession is an auto generated Go binding around an Ethereum crowdfunding, +// InputBoxSession is an auto generated Go binding around an Ethereum contract, // with pre-set call and transact options. type InputBoxSession struct { - Contract *InputBox // Generic crowdfunding binding to set the session for + Contract *InputBox // 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 } -// InputBoxCallerSession is an auto generated read-only Go binding around an Ethereum crowdfunding, +// InputBoxCallerSession is an auto generated read-only Go binding around an Ethereum contract, // with pre-set call options. type InputBoxCallerSession struct { - Contract *InputBoxCaller // Generic crowdfunding caller binding to set the session for + Contract *InputBoxCaller // Generic contract caller binding to set the session for CallOpts bind.CallOpts // Call options to use throughout this session } -// InputBoxTransactorSession is an auto generated write-only Go binding around an Ethereum crowdfunding, +// InputBoxTransactorSession is an auto generated write-only Go binding around an Ethereum contract, // with pre-set transact options. type InputBoxTransactorSession struct { - Contract *InputBoxTransactor // Generic crowdfunding transactor binding to set the session for + Contract *InputBoxTransactor // Generic contract transactor binding to set the session for TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session } -// InputBoxRaw is an auto generated low-level Go binding around an Ethereum crowdfunding. +// InputBoxRaw is an auto generated low-level Go binding around an Ethereum contract. type InputBoxRaw struct { - Contract *InputBox // Generic crowdfunding binding to access the raw methods on + Contract *InputBox // Generic contract binding to access the raw methods on } -// InputBoxCallerRaw is an auto generated low-level read-only Go binding around an Ethereum crowdfunding. +// InputBoxCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. type InputBoxCallerRaw struct { - Contract *InputBoxCaller // Generic read-only crowdfunding binding to access the raw methods on + Contract *InputBoxCaller // Generic read-only contract binding to access the raw methods on } -// InputBoxTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum crowdfunding. +// InputBoxTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. type InputBoxTransactorRaw struct { - Contract *InputBoxTransactor // Generic write-only crowdfunding binding to access the raw methods on + Contract *InputBoxTransactor // Generic write-only contract binding to access the raw methods on } -// NewInputBox creates a new instance of InputBox, bound to a specific deployed crowdfunding. +// NewInputBox creates a new instance of InputBox, bound to a specific deployed contract. func NewInputBox(address common.Address, backend bind.ContractBackend) (*InputBox, error) { - crowdfunding, err := bindInputBox(address, backend, backend, backend) + contract, err := bindInputBox(address, backend, backend, backend) if err != nil { return nil, err } - return &InputBox{InputBoxCaller: InputBoxCaller{crowdfunding: crowdfunding}, InputBoxTransactor: InputBoxTransactor{crowdfunding: crowdfunding}, InputBoxFilterer: InputBoxFilterer{crowdfunding: crowdfunding}}, nil + return &InputBox{InputBoxCaller: InputBoxCaller{contract: contract}, InputBoxTransactor: InputBoxTransactor{contract: contract}, InputBoxFilterer: InputBoxFilterer{contract: contract}}, nil } -// NewInputBoxCaller creates a new read-only instance of InputBox, bound to a specific deployed crowdfunding. +// NewInputBoxCaller creates a new read-only instance of InputBox, bound to a specific deployed contract. func NewInputBoxCaller(address common.Address, caller bind.ContractCaller) (*InputBoxCaller, error) { - crowdfunding, err := bindInputBox(address, caller, nil, nil) + contract, err := bindInputBox(address, caller, nil, nil) if err != nil { return nil, err } - return &InputBoxCaller{crowdfunding: crowdfunding}, nil + return &InputBoxCaller{contract: contract}, nil } -// NewInputBoxTransactor creates a new write-only instance of InputBox, bound to a specific deployed crowdfunding. +// NewInputBoxTransactor creates a new write-only instance of InputBox, bound to a specific deployed contract. func NewInputBoxTransactor(address common.Address, transactor bind.ContractTransactor) (*InputBoxTransactor, error) { - crowdfunding, err := bindInputBox(address, nil, transactor, nil) + contract, err := bindInputBox(address, nil, transactor, nil) if err != nil { return nil, err } - return &InputBoxTransactor{crowdfunding: crowdfunding}, nil + return &InputBoxTransactor{contract: contract}, nil } -// NewInputBoxFilterer creates a new log filterer instance of InputBox, bound to a specific deployed crowdfunding. +// NewInputBoxFilterer creates a new log filterer instance of InputBox, bound to a specific deployed contract. func NewInputBoxFilterer(address common.Address, filterer bind.ContractFilterer) (*InputBoxFilterer, error) { - crowdfunding, err := bindInputBox(address, nil, nil, filterer) + contract, err := bindInputBox(address, nil, nil, filterer) if err != nil { return nil, err } - return &InputBoxFilterer{crowdfunding: crowdfunding}, nil + return &InputBoxFilterer{contract: contract}, nil } -// bindInputBox binds a generic wrapper to an already deployed crowdfunding. +// bindInputBox binds a generic wrapper to an already deployed contract. func bindInputBox(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { parsed, err := InputBoxMetaData.GetAbi() if err != nil { @@ -142,50 +142,50 @@ func bindInputBox(address common.Address, caller bind.ContractCaller, transactor return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil } -// Call invokes the (constant) crowdfunding method with params as input values and +// 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 (_InputBox *InputBoxRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _InputBox.Contract.InputBoxCaller.crowdfunding.Call(opts, result, method, params...) + return _InputBox.Contract.InputBoxCaller.contract.Call(opts, result, method, params...) } -// Transfer initiates a plain transaction to move funds to the crowdfunding, calling +// Transfer initiates a plain transaction to move funds to the contract, calling // its default method if one is available. func (_InputBox *InputBoxRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _InputBox.Contract.InputBoxTransactor.crowdfunding.Transfer(opts) + return _InputBox.Contract.InputBoxTransactor.contract.Transfer(opts) } -// Transact invokes the (paid) crowdfunding method with params as input values. +// Transact invokes the (paid) contract method with params as input values. func (_InputBox *InputBoxRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _InputBox.Contract.InputBoxTransactor.crowdfunding.Transact(opts, method, params...) + return _InputBox.Contract.InputBoxTransactor.contract.Transact(opts, method, params...) } -// Call invokes the (constant) crowdfunding method with params as input values and +// 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 (_InputBox *InputBoxCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _InputBox.Contract.crowdfunding.Call(opts, result, method, params...) + return _InputBox.Contract.contract.Call(opts, result, method, params...) } -// Transfer initiates a plain transaction to move funds to the crowdfunding, calling +// Transfer initiates a plain transaction to move funds to the contract, calling // its default method if one is available. func (_InputBox *InputBoxTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _InputBox.Contract.crowdfunding.Transfer(opts) + return _InputBox.Contract.contract.Transfer(opts) } -// Transact invokes the (paid) crowdfunding method with params as input values. +// Transact invokes the (paid) contract method with params as input values. func (_InputBox *InputBoxTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _InputBox.Contract.crowdfunding.Transact(opts, method, params...) + return _InputBox.Contract.contract.Transact(opts, method, params...) } -// GetInputHash is a free data retrieval call binding the crowdfunding method 0x677087c9. +// GetInputHash is a free data retrieval call binding the contract method 0x677087c9. // -// Solidity: function getInputHash(address _dapp, uint256 _index) view returns(bytes32) -func (_InputBox *InputBoxCaller) GetInputHash(opts *bind.CallOpts, _dapp common.Address, _index *big.Int) ([32]byte, error) { +// Solidity: function getInputHash(address appContract, uint256 index) view returns(bytes32) +func (_InputBox *InputBoxCaller) GetInputHash(opts *bind.CallOpts, appContract common.Address, index *big.Int) ([32]byte, error) { var out []interface{} - err := _InputBox.crowdfunding.Call(opts, &out, "getInputHash", _dapp, _index) + err := _InputBox.contract.Call(opts, &out, "getInputHash", appContract, index) if err != nil { return *new([32]byte), err @@ -197,26 +197,26 @@ func (_InputBox *InputBoxCaller) GetInputHash(opts *bind.CallOpts, _dapp common. } -// GetInputHash is a free data retrieval call binding the crowdfunding method 0x677087c9. +// GetInputHash is a free data retrieval call binding the contract method 0x677087c9. // -// Solidity: function getInputHash(address _dapp, uint256 _index) view returns(bytes32) -func (_InputBox *InputBoxSession) GetInputHash(_dapp common.Address, _index *big.Int) ([32]byte, error) { - return _InputBox.Contract.GetInputHash(&_InputBox.CallOpts, _dapp, _index) +// Solidity: function getInputHash(address appContract, uint256 index) view returns(bytes32) +func (_InputBox *InputBoxSession) GetInputHash(appContract common.Address, index *big.Int) ([32]byte, error) { + return _InputBox.Contract.GetInputHash(&_InputBox.CallOpts, appContract, index) } -// GetInputHash is a free data retrieval call binding the crowdfunding method 0x677087c9. +// GetInputHash is a free data retrieval call binding the contract method 0x677087c9. // -// Solidity: function getInputHash(address _dapp, uint256 _index) view returns(bytes32) -func (_InputBox *InputBoxCallerSession) GetInputHash(_dapp common.Address, _index *big.Int) ([32]byte, error) { - return _InputBox.Contract.GetInputHash(&_InputBox.CallOpts, _dapp, _index) +// Solidity: function getInputHash(address appContract, uint256 index) view returns(bytes32) +func (_InputBox *InputBoxCallerSession) GetInputHash(appContract common.Address, index *big.Int) ([32]byte, error) { + return _InputBox.Contract.GetInputHash(&_InputBox.CallOpts, appContract, index) } -// GetNumberOfInputs is a free data retrieval call binding the crowdfunding method 0x61a93c87. +// GetNumberOfInputs is a free data retrieval call binding the contract method 0x61a93c87. // -// Solidity: function getNumberOfInputs(address _dapp) view returns(uint256) -func (_InputBox *InputBoxCaller) GetNumberOfInputs(opts *bind.CallOpts, _dapp common.Address) (*big.Int, error) { +// Solidity: function getNumberOfInputs(address appContract) view returns(uint256) +func (_InputBox *InputBoxCaller) GetNumberOfInputs(opts *bind.CallOpts, appContract common.Address) (*big.Int, error) { var out []interface{} - err := _InputBox.crowdfunding.Call(opts, &out, "getNumberOfInputs", _dapp) + err := _InputBox.contract.Call(opts, &out, "getNumberOfInputs", appContract) if err != nil { return *new(*big.Int), err @@ -228,49 +228,49 @@ func (_InputBox *InputBoxCaller) GetNumberOfInputs(opts *bind.CallOpts, _dapp co } -// GetNumberOfInputs is a free data retrieval call binding the crowdfunding method 0x61a93c87. +// GetNumberOfInputs is a free data retrieval call binding the contract method 0x61a93c87. // -// Solidity: function getNumberOfInputs(address _dapp) view returns(uint256) -func (_InputBox *InputBoxSession) GetNumberOfInputs(_dapp common.Address) (*big.Int, error) { - return _InputBox.Contract.GetNumberOfInputs(&_InputBox.CallOpts, _dapp) +// Solidity: function getNumberOfInputs(address appContract) view returns(uint256) +func (_InputBox *InputBoxSession) GetNumberOfInputs(appContract common.Address) (*big.Int, error) { + return _InputBox.Contract.GetNumberOfInputs(&_InputBox.CallOpts, appContract) } -// GetNumberOfInputs is a free data retrieval call binding the crowdfunding method 0x61a93c87. +// GetNumberOfInputs is a free data retrieval call binding the contract method 0x61a93c87. // -// Solidity: function getNumberOfInputs(address _dapp) view returns(uint256) -func (_InputBox *InputBoxCallerSession) GetNumberOfInputs(_dapp common.Address) (*big.Int, error) { - return _InputBox.Contract.GetNumberOfInputs(&_InputBox.CallOpts, _dapp) +// Solidity: function getNumberOfInputs(address appContract) view returns(uint256) +func (_InputBox *InputBoxCallerSession) GetNumberOfInputs(appContract common.Address) (*big.Int, error) { + return _InputBox.Contract.GetNumberOfInputs(&_InputBox.CallOpts, appContract) } -// AddInput is a paid mutator transaction binding the crowdfunding method 0x1789cd63. +// AddInput is a paid mutator transaction binding the contract method 0x1789cd63. // -// Solidity: function addInput(address _dapp, bytes _input) returns(bytes32) -func (_InputBox *InputBoxTransactor) AddInput(opts *bind.TransactOpts, _dapp common.Address, _input []byte) (*types.Transaction, error) { - return _InputBox.crowdfunding.Transact(opts, "addInput", _dapp, _input) +// Solidity: function addInput(address appContract, bytes payload) returns(bytes32) +func (_InputBox *InputBoxTransactor) AddInput(opts *bind.TransactOpts, appContract common.Address, payload []byte) (*types.Transaction, error) { + return _InputBox.contract.Transact(opts, "addInput", appContract, payload) } -// AddInput is a paid mutator transaction binding the crowdfunding method 0x1789cd63. +// AddInput is a paid mutator transaction binding the contract method 0x1789cd63. // -// Solidity: function addInput(address _dapp, bytes _input) returns(bytes32) -func (_InputBox *InputBoxSession) AddInput(_dapp common.Address, _input []byte) (*types.Transaction, error) { - return _InputBox.Contract.AddInput(&_InputBox.TransactOpts, _dapp, _input) +// Solidity: function addInput(address appContract, bytes payload) returns(bytes32) +func (_InputBox *InputBoxSession) AddInput(appContract common.Address, payload []byte) (*types.Transaction, error) { + return _InputBox.Contract.AddInput(&_InputBox.TransactOpts, appContract, payload) } -// AddInput is a paid mutator transaction binding the crowdfunding method 0x1789cd63. +// AddInput is a paid mutator transaction binding the contract method 0x1789cd63. // -// Solidity: function addInput(address _dapp, bytes _input) returns(bytes32) -func (_InputBox *InputBoxTransactorSession) AddInput(_dapp common.Address, _input []byte) (*types.Transaction, error) { - return _InputBox.Contract.AddInput(&_InputBox.TransactOpts, _dapp, _input) +// Solidity: function addInput(address appContract, bytes payload) returns(bytes32) +func (_InputBox *InputBoxTransactorSession) AddInput(appContract common.Address, payload []byte) (*types.Transaction, error) { + return _InputBox.Contract.AddInput(&_InputBox.TransactOpts, appContract, payload) } -// InputBoxInputAddedIterator is returned from FilterInputAdded and is used to iterate over the raw logs and unpacked data for InputAdded events raised by the InputBox crowdfunding. +// InputBoxInputAddedIterator is returned from FilterInputAdded and is used to iterate over the raw logs and unpacked data for InputAdded events raised by the InputBox contract. type InputBoxInputAddedIterator struct { - Event *InputBoxInputAdded // Event containing the crowdfunding specifics and raw log + Event *InputBoxInputAdded // Event containing the contract specifics and raw log - crowdfunding *bind.BoundContract // Generic crowdfunding to use for unpacking event data + 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 crowdfunding events + 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 @@ -289,7 +289,7 @@ func (it *InputBoxInputAddedIterator) Next() bool { select { case log := <-it.logs: it.Event = new(InputBoxInputAdded) - if err := it.crowdfunding.UnpackLog(it.Event, it.event, log); err != nil { + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false } @@ -304,7 +304,7 @@ func (it *InputBoxInputAddedIterator) Next() bool { select { case log := <-it.logs: it.Event = new(InputBoxInputAdded) - if err := it.crowdfunding.UnpackLog(it.Event, it.event, log); err != nil { + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false } @@ -330,51 +330,50 @@ func (it *InputBoxInputAddedIterator) Close() error { return nil } -// InputBoxInputAdded represents a InputAdded event raised by the InputBox crowdfunding. +// InputBoxInputAdded represents a InputAdded event raised by the InputBox contract. type InputBoxInputAdded struct { - Dapp common.Address - InputIndex *big.Int - Sender common.Address - Input []byte - Raw types.Log // Blockchain specific contextual infos + AppContract common.Address + Index *big.Int + Input []byte + Raw types.Log // Blockchain specific contextual infos } -// FilterInputAdded is a free log retrieval operation binding the crowdfunding event 0x6aaa400068bf4ca337265e2a1e1e841f66b8597fd5b452fdc52a44bed28a0784. +// FilterInputAdded is a free log retrieval operation binding the contract event 0xc05d337121a6e8605c6ec0b72aa29c4210ffe6e5b9cefdd6a7058188a8f66f98. // -// Solidity: event InputAdded(address indexed dapp, uint256 indexed inputIndex, address sender, bytes input) -func (_InputBox *InputBoxFilterer) FilterInputAdded(opts *bind.FilterOpts, dapp []common.Address, inputIndex []*big.Int) (*InputBoxInputAddedIterator, error) { +// Solidity: event InputAdded(address indexed appContract, uint256 indexed index, bytes input) +func (_InputBox *InputBoxFilterer) FilterInputAdded(opts *bind.FilterOpts, appContract []common.Address, index []*big.Int) (*InputBoxInputAddedIterator, error) { - var dappRule []interface{} - for _, dappItem := range dapp { - dappRule = append(dappRule, dappItem) + var appContractRule []interface{} + for _, appContractItem := range appContract { + appContractRule = append(appContractRule, appContractItem) } - var inputIndexRule []interface{} - for _, inputIndexItem := range inputIndex { - inputIndexRule = append(inputIndexRule, inputIndexItem) + var indexRule []interface{} + for _, indexItem := range index { + indexRule = append(indexRule, indexItem) } - logs, sub, err := _InputBox.crowdfunding.FilterLogs(opts, "InputAdded", dappRule, inputIndexRule) + logs, sub, err := _InputBox.contract.FilterLogs(opts, "InputAdded", appContractRule, indexRule) if err != nil { return nil, err } - return &InputBoxInputAddedIterator{crowdfunding: _InputBox.crowdfunding, event: "InputAdded", logs: logs, sub: sub}, nil + return &InputBoxInputAddedIterator{contract: _InputBox.contract, event: "InputAdded", logs: logs, sub: sub}, nil } -// WatchInputAdded is a free log subscription operation binding the crowdfunding event 0x6aaa400068bf4ca337265e2a1e1e841f66b8597fd5b452fdc52a44bed28a0784. +// WatchInputAdded is a free log subscription operation binding the contract event 0xc05d337121a6e8605c6ec0b72aa29c4210ffe6e5b9cefdd6a7058188a8f66f98. // -// Solidity: event InputAdded(address indexed dapp, uint256 indexed inputIndex, address sender, bytes input) -func (_InputBox *InputBoxFilterer) WatchInputAdded(opts *bind.WatchOpts, sink chan<- *InputBoxInputAdded, dapp []common.Address, inputIndex []*big.Int) (event.Subscription, error) { +// Solidity: event InputAdded(address indexed appContract, uint256 indexed index, bytes input) +func (_InputBox *InputBoxFilterer) WatchInputAdded(opts *bind.WatchOpts, sink chan<- *InputBoxInputAdded, appContract []common.Address, index []*big.Int) (event.Subscription, error) { - var dappRule []interface{} - for _, dappItem := range dapp { - dappRule = append(dappRule, dappItem) + var appContractRule []interface{} + for _, appContractItem := range appContract { + appContractRule = append(appContractRule, appContractItem) } - var inputIndexRule []interface{} - for _, inputIndexItem := range inputIndex { - inputIndexRule = append(inputIndexRule, inputIndexItem) + var indexRule []interface{} + for _, indexItem := range index { + indexRule = append(indexRule, indexItem) } - logs, sub, err := _InputBox.crowdfunding.WatchLogs(opts, "InputAdded", dappRule, inputIndexRule) + logs, sub, err := _InputBox.contract.WatchLogs(opts, "InputAdded", appContractRule, indexRule) if err != nil { return nil, err } @@ -385,7 +384,7 @@ func (_InputBox *InputBoxFilterer) WatchInputAdded(opts *bind.WatchOpts, sink ch case log := <-logs: // New log arrived, parse the event and forward to the user event := new(InputBoxInputAdded) - if err := _InputBox.crowdfunding.UnpackLog(event, "InputAdded", log); err != nil { + if err := _InputBox.contract.UnpackLog(event, "InputAdded", log); err != nil { return err } event.Raw = log @@ -406,12 +405,12 @@ func (_InputBox *InputBoxFilterer) WatchInputAdded(opts *bind.WatchOpts, sink ch }), nil } -// ParseInputAdded is a log parse operation binding the crowdfunding event 0x6aaa400068bf4ca337265e2a1e1e841f66b8597fd5b452fdc52a44bed28a0784. +// ParseInputAdded is a log parse operation binding the contract event 0xc05d337121a6e8605c6ec0b72aa29c4210ffe6e5b9cefdd6a7058188a8f66f98. // -// Solidity: event InputAdded(address indexed dapp, uint256 indexed inputIndex, address sender, bytes input) +// Solidity: event InputAdded(address indexed appContract, uint256 indexed index, bytes input) func (_InputBox *InputBoxFilterer) ParseInputAdded(log types.Log) (*InputBoxInputAdded, error) { event := new(InputBoxInputAdded) - if err := _InputBox.crowdfunding.UnpackLog(event, "InputAdded", log); err != nil { + if err := _InputBox.contract.UnpackLog(event, "InputAdded", log); err != nil { return nil, err } event.Raw = log