diff --git a/appdatabase/migrations/sql/1644188994_recent_stickers.up.sql b/appdatabase/migrations/sql/1644188994_recent_stickers.up.sql new file mode 100644 index 000000000..025841550 --- /dev/null +++ b/appdatabase/migrations/sql/1644188994_recent_stickers.up.sql @@ -0,0 +1 @@ +UPDATE TABLE settings SET stickers_recent_stickers = NULL WHERE synthetic_id = 'id'; diff --git a/contracts/contracts.go b/contracts/contracts.go new file mode 100644 index 000000000..3202cd2e8 --- /dev/null +++ b/contracts/contracts.go @@ -0,0 +1,122 @@ +package contracts + +import ( + "github.com/ethereum/go-ethereum/common" + "github.com/status-im/status-go/contracts/registrar" + "github.com/status-im/status-go/contracts/resolver" + "github.com/status-im/status-go/contracts/snt" + "github.com/status-im/status-go/contracts/stickers" + "github.com/status-im/status-go/rpc" +) + +type ContractMaker struct { + RPCClient *rpc.Client +} + +func (c *ContractMaker) NewRegistry(chainID uint64) (*resolver.ENSRegistryWithFallback, error) { + contractAddr, err := resolver.ContractAddress(chainID) + if err != nil { + return nil, err + } + + backend, err := c.RPCClient.EthClient(chainID) + if err != nil { + return nil, err + } + + return resolver.NewENSRegistryWithFallback( + contractAddr, + backend, + ) +} + +func (c *ContractMaker) NewPublicResolver(chainID uint64, resolverAddress *common.Address) (*resolver.PublicResolver, error) { + backend, err := c.RPCClient.EthClient(chainID) + if err != nil { + return nil, err + } + + return resolver.NewPublicResolver(*resolverAddress, backend) +} + +func (c *ContractMaker) NewUsernameRegistrar(chainID uint64) (*registrar.UsernameRegistrar, error) { + contractAddr, err := registrar.ContractAddress(chainID) + if err != nil { + return nil, err + } + + backend, err := c.RPCClient.EthClient(chainID) + if err != nil { + return nil, err + } + + return registrar.NewUsernameRegistrar( + contractAddr, + backend, + ) +} + +func (c *ContractMaker) NewSNT(chainID uint64) (*snt.SNT, error) { + contractAddr, err := snt.ContractAddress(chainID) + if err != nil { + return nil, err + } + + backend, err := c.RPCClient.EthClient(chainID) + if err != nil { + return nil, err + } + + return snt.NewSNT(contractAddr, backend) +} + +func (c *ContractMaker) NewStickerType(chainID uint64) (*stickers.StickerType, error) { + contractAddr, err := stickers.StickerTypeContractAddress(chainID) + if err != nil { + return nil, err + } + + backend, err := c.RPCClient.EthClient(chainID) + if err != nil { + return nil, err + } + + return stickers.NewStickerType( + contractAddr, + backend, + ) +} + +func (c *ContractMaker) NewStickerMarket(chainID uint64) (*stickers.StickerMarket, error) { + contractAddr, err := stickers.StickerMarketContractAddress(chainID) + if err != nil { + return nil, err + } + + backend, err := c.RPCClient.EthClient(chainID) + if err != nil { + return nil, err + } + + return stickers.NewStickerMarket( + contractAddr, + backend, + ) +} + +func (c *ContractMaker) NewStickerPack(chainID uint64) (*stickers.StickerPack, error) { + contractAddr, err := stickers.StickerPackContractAddress(chainID) + if err != nil { + return nil, err + } + + backend, err := c.RPCClient.EthClient(chainID) + if err != nil { + return nil, err + } + + return stickers.NewStickerPack( + contractAddr, + backend, + ) +} diff --git a/services/wallet/ierc20/README.md b/contracts/ierc20/README.md similarity index 100% rename from services/wallet/ierc20/README.md rename to contracts/ierc20/README.md diff --git a/services/wallet/ierc20/doc.go b/contracts/ierc20/doc.go similarity index 100% rename from services/wallet/ierc20/doc.go rename to contracts/ierc20/doc.go diff --git a/services/wallet/ierc20/ierc20.go b/contracts/ierc20/ierc20.go similarity index 100% rename from services/wallet/ierc20/ierc20.go rename to contracts/ierc20/ierc20.go diff --git a/services/wallet/ierc20/ierc20.sol b/contracts/ierc20/ierc20.sol similarity index 100% rename from services/wallet/ierc20/ierc20.sol rename to contracts/ierc20/ierc20.sol diff --git a/services/ens/registrar/Registrar.sol b/contracts/registrar/Registrar.sol similarity index 100% rename from services/ens/registrar/Registrar.sol rename to contracts/registrar/Registrar.sol diff --git a/contracts/registrar/address.go b/contracts/registrar/address.go new file mode 100644 index 000000000..9149db394 --- /dev/null +++ b/contracts/registrar/address.go @@ -0,0 +1,22 @@ +package registrar + +import ( + "errors" + + "github.com/ethereum/go-ethereum/common" +) + +var errorNotAvailableOnChainID = errors.New("not available for chainID") + +var contractAddressByChainID = map[uint64]common.Address{ + 1: common.HexToAddress("0xDB5ac1a559b02E12F29fC0eC0e37Be8E046DEF49"), // mainnet + 3: common.HexToAddress("0xdaae165beb8c06e0b7613168138ebba774aff071"), // ropsten +} + +func ContractAddress(chainID uint64) (common.Address, error) { + addr, exists := contractAddressByChainID[chainID] + if !exists { + return *new(common.Address), errorNotAvailableOnChainID + } + return addr, nil +} diff --git a/services/ens/registrar/doc.go b/contracts/registrar/doc.go similarity index 100% rename from services/ens/registrar/doc.go rename to contracts/registrar/doc.go diff --git a/services/ens/registrar/registrar.go b/contracts/registrar/registrar.go similarity index 100% rename from services/ens/registrar/registrar.go rename to contracts/registrar/registrar.go diff --git a/contracts/resolver/address.go b/contracts/resolver/address.go new file mode 100644 index 000000000..c6a269f6d --- /dev/null +++ b/contracts/resolver/address.go @@ -0,0 +1,22 @@ +package resolver + +import ( + "errors" + + "github.com/ethereum/go-ethereum/common" +) + +var errorNotAvailableOnChainID = errors.New("not available for chainID") + +var contractAddressByChainID = map[uint64]common.Address{ + 1: common.HexToAddress("0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"), // mainnet + 3: common.HexToAddress("0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"), // ropsten +} + +func ContractAddress(chainID uint64) (common.Address, error) { + addr, exists := contractAddressByChainID[chainID] + if !exists { + return *new(common.Address), errorNotAvailableOnChainID + } + return addr, nil +} diff --git a/services/ens/resolver/doc.go b/contracts/resolver/doc.go similarity index 100% rename from services/ens/resolver/doc.go rename to contracts/resolver/doc.go diff --git a/services/ens/resolver/resolver.go b/contracts/resolver/resolver.go similarity index 100% rename from services/ens/resolver/resolver.go rename to contracts/resolver/resolver.go diff --git a/services/ens/resolver/resolver.sol b/contracts/resolver/resolver.sol similarity index 100% rename from services/ens/resolver/resolver.sol rename to contracts/resolver/resolver.sol diff --git a/contracts/snt/address.go b/contracts/snt/address.go new file mode 100644 index 000000000..b7fd241cf --- /dev/null +++ b/contracts/snt/address.go @@ -0,0 +1,22 @@ +package snt + +import ( + "errors" + + "github.com/ethereum/go-ethereum/common" +) + +var errorNotAvailableOnChainID = errors.New("not available for chainID") + +var contractAddressByChainID = map[uint64]common.Address{ + 1: common.HexToAddress("0x744d70fdbe2ba4cf95131626614a1763df805b9e"), // mainnet + 3: common.HexToAddress("0xc55cf4b03948d7ebc8b9e8bad92643703811d162"), // ropsten +} + +func ContractAddress(chainID uint64) (common.Address, error) { + addr, exists := contractAddressByChainID[chainID] + if !exists { + return *new(common.Address), errorNotAvailableOnChainID + } + return addr, nil +} diff --git a/contracts/snt/doc.go b/contracts/snt/doc.go new file mode 100644 index 000000000..1cb25942b --- /dev/null +++ b/contracts/snt/doc.go @@ -0,0 +1,3 @@ +package snt + +//go:generate abigen -sol snt.sol -pkg snt -out snt.go diff --git a/services/ens/erc20/erc20.go b/contracts/snt/snt.go similarity index 99% rename from services/ens/erc20/erc20.go rename to contracts/snt/snt.go index 8040632d4..2240aaaf0 100644 --- a/services/ens/erc20/erc20.go +++ b/contracts/snt/snt.go @@ -1,7 +1,7 @@ // Code generated - DO NOT EDIT. // This file is a generated binding and any manual changes will be lost. -package erc20 +package snt import ( "math/big" diff --git a/services/ens/erc20/erc20.sol b/contracts/snt/snt.sol similarity index 100% rename from services/ens/erc20/erc20.sol rename to contracts/snt/snt.sol diff --git a/contracts/stickers/address.go b/contracts/stickers/address.go new file mode 100644 index 000000000..04b608b06 --- /dev/null +++ b/contracts/stickers/address.go @@ -0,0 +1,48 @@ +package stickers + +import ( + "errors" + + "github.com/ethereum/go-ethereum/common" +) + +var errorNotAvailableOnChainID = errors.New("not available for chainID") + +var stickerTypeByChainID = map[uint64]common.Address{ + 1: common.HexToAddress("0x0577215622f43a39f4bc9640806dfea9b10d2a36"), // mainnet + 3: common.HexToAddress("0x8cc272396be7583c65bee82cd7b743c69a87287d"), // ropsten +} + +var stickerMarketByChainID = map[uint64]common.Address{ + 1: common.HexToAddress("0x12824271339304d3a9f7e096e62a2a7e73b4a7e7"), // mainnet + 3: common.HexToAddress("0x6CC7274aF9cE9572d22DFD8545Fb8c9C9Bcb48AD"), // ropsten +} + +var stickerPackByChainID = map[uint64]common.Address{ + 1: common.HexToAddress("0x110101156e8F0743948B2A61aFcf3994A8Fb172e"), // mainnet + 3: common.HexToAddress("0xf852198d0385c4b871e0b91804ecd47c6ba97351"), // ropsten +} + +func StickerTypeContractAddress(chainID uint64) (common.Address, error) { + addr, exists := stickerTypeByChainID[chainID] + if !exists { + return *new(common.Address), errorNotAvailableOnChainID + } + return addr, nil +} + +func StickerMarketContractAddress(chainID uint64) (common.Address, error) { + addr, exists := stickerMarketByChainID[chainID] + if !exists { + return *new(common.Address), errorNotAvailableOnChainID + } + return addr, nil +} + +func StickerPackContractAddress(chainID uint64) (common.Address, error) { + addr, exists := stickerPackByChainID[chainID] + if !exists { + return *new(common.Address), errorNotAvailableOnChainID + } + return addr, nil +} diff --git a/contracts/stickers/contracts.go b/contracts/stickers/contracts.go new file mode 100644 index 000000000..7919a28e4 --- /dev/null +++ b/contracts/stickers/contracts.go @@ -0,0 +1,17295 @@ +// Code generated - DO NOT EDIT. +// This file is a generated binding and any manual changes will be lost. + +package stickers + +import ( + "math/big" + "strings" + + ethereum "github.com/ethereum/go-ethereum" + "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/event" +) + +// Reference imports to suppress errors if they are not otherwise used. +var ( + _ = big.NewInt + _ = strings.NewReader + _ = ethereum.NotFound + _ = bind.Bind + _ = common.Big1 + _ = types.BloomLookup + _ = event.NewSubscription +) + +// AddressABI is the input ABI used to generate the binding from. +const AddressABI = "[]" + +// AddressBin is the compiled bytecode used for deploying new contracts. +var AddressBin = "0x60556023600b82828239805160001a607314601657fe5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea265627a7a723058204ac2d1ce23a620d918fd87b6474a14cc1d516f54bd777d9c7c388e2628c8131864736f6c634300050a0032" + +// DeployAddress deploys a new Ethereum contract, binding an instance of Address to it. +func DeployAddress(auth *bind.TransactOpts, backend bind.ContractBackend) (common.Address, *types.Transaction, *Address, error) { + parsed, err := abi.JSON(strings.NewReader(AddressABI)) + if err != nil { + return common.Address{}, nil, nil, err + } + + address, tx, contract, err := bind.DeployContract(auth, parsed, common.FromHex(AddressBin), backend) + if err != nil { + return common.Address{}, nil, nil, err + } + return address, tx, &Address{AddressCaller: AddressCaller{contract: contract}, AddressTransactor: AddressTransactor{contract: contract}, AddressFilterer: AddressFilterer{contract: contract}}, nil +} + +// Address is an auto generated Go binding around an Ethereum contract. +type Address struct { + AddressCaller // Read-only binding to the contract + AddressTransactor // Write-only binding to the contract + AddressFilterer // Log filterer for contract events +} + +// AddressCaller is an auto generated read-only Go binding around an Ethereum contract. +type AddressCaller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// AddressTransactor is an auto generated write-only Go binding around an Ethereum contract. +type AddressTransactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// AddressFilterer is an auto generated log filtering Go binding around an Ethereum contract events. +type AddressFilterer struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// AddressSession is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type AddressSession struct { + Contract *Address // 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 +} + +// AddressCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type AddressCallerSession struct { + Contract *AddressCaller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// AddressTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type AddressTransactorSession struct { + Contract *AddressTransactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// AddressRaw is an auto generated low-level Go binding around an Ethereum contract. +type AddressRaw struct { + Contract *Address // Generic contract binding to access the raw methods on +} + +// AddressCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type AddressCallerRaw struct { + Contract *AddressCaller // Generic read-only contract binding to access the raw methods on +} + +// AddressTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type AddressTransactorRaw struct { + Contract *AddressTransactor // Generic write-only contract binding to access the raw methods on +} + +// NewAddress creates a new instance of Address, bound to a specific deployed contract. +func NewAddress(address common.Address, backend bind.ContractBackend) (*Address, error) { + contract, err := bindAddress(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &Address{AddressCaller: AddressCaller{contract: contract}, AddressTransactor: AddressTransactor{contract: contract}, AddressFilterer: AddressFilterer{contract: contract}}, nil +} + +// NewAddressCaller creates a new read-only instance of Address, bound to a specific deployed contract. +func NewAddressCaller(address common.Address, caller bind.ContractCaller) (*AddressCaller, error) { + contract, err := bindAddress(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &AddressCaller{contract: contract}, nil +} + +// NewAddressTransactor creates a new write-only instance of Address, bound to a specific deployed contract. +func NewAddressTransactor(address common.Address, transactor bind.ContractTransactor) (*AddressTransactor, error) { + contract, err := bindAddress(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &AddressTransactor{contract: contract}, nil +} + +// NewAddressFilterer creates a new log filterer instance of Address, bound to a specific deployed contract. +func NewAddressFilterer(address common.Address, filterer bind.ContractFilterer) (*AddressFilterer, error) { + contract, err := bindAddress(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &AddressFilterer{contract: contract}, nil +} + +// bindAddress binds a generic wrapper to an already deployed contract. +func bindAddress(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := abi.JSON(strings.NewReader(AddressABI)) + 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 (_Address *AddressRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _Address.Contract.AddressCaller.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 (_Address *AddressRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Address.Contract.AddressTransactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_Address *AddressRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _Address.Contract.AddressTransactor.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 (_Address *AddressCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _Address.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 (_Address *AddressTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Address.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_Address *AddressTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _Address.Contract.contract.Transact(opts, method, params...) +} + +// ApproveAndCallFallBackABI is the input ABI used to generate the binding from. +const ApproveAndCallFallBackABI = "[{\"constant\":false,\"inputs\":[{\"name\":\"from\",\"type\":\"address\"},{\"name\":\"_amount\",\"type\":\"uint256\"},{\"name\":\"_token\",\"type\":\"address\"},{\"name\":\"_data\",\"type\":\"bytes\"}],\"name\":\"receiveApproval\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]" + +// ApproveAndCallFallBackFuncSigs maps the 4-byte function signature to its string representation. +var ApproveAndCallFallBackFuncSigs = map[string]string{ + "8f4ffcb1": "receiveApproval(address,uint256,address,bytes)", +} + +// ApproveAndCallFallBack is an auto generated Go binding around an Ethereum contract. +type ApproveAndCallFallBack struct { + ApproveAndCallFallBackCaller // Read-only binding to the contract + ApproveAndCallFallBackTransactor // Write-only binding to the contract + ApproveAndCallFallBackFilterer // Log filterer for contract events +} + +// ApproveAndCallFallBackCaller is an auto generated read-only Go binding around an Ethereum contract. +type ApproveAndCallFallBackCaller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// ApproveAndCallFallBackTransactor is an auto generated write-only Go binding around an Ethereum contract. +type ApproveAndCallFallBackTransactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// ApproveAndCallFallBackFilterer is an auto generated log filtering Go binding around an Ethereum contract events. +type ApproveAndCallFallBackFilterer struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// ApproveAndCallFallBackSession is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type ApproveAndCallFallBackSession struct { + Contract *ApproveAndCallFallBack // 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 +} + +// ApproveAndCallFallBackCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type ApproveAndCallFallBackCallerSession struct { + Contract *ApproveAndCallFallBackCaller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// ApproveAndCallFallBackTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type ApproveAndCallFallBackTransactorSession struct { + Contract *ApproveAndCallFallBackTransactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// ApproveAndCallFallBackRaw is an auto generated low-level Go binding around an Ethereum contract. +type ApproveAndCallFallBackRaw struct { + Contract *ApproveAndCallFallBack // Generic contract binding to access the raw methods on +} + +// ApproveAndCallFallBackCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type ApproveAndCallFallBackCallerRaw struct { + Contract *ApproveAndCallFallBackCaller // Generic read-only contract binding to access the raw methods on +} + +// ApproveAndCallFallBackTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type ApproveAndCallFallBackTransactorRaw struct { + Contract *ApproveAndCallFallBackTransactor // Generic write-only contract binding to access the raw methods on +} + +// NewApproveAndCallFallBack creates a new instance of ApproveAndCallFallBack, bound to a specific deployed contract. +func NewApproveAndCallFallBack(address common.Address, backend bind.ContractBackend) (*ApproveAndCallFallBack, error) { + contract, err := bindApproveAndCallFallBack(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &ApproveAndCallFallBack{ApproveAndCallFallBackCaller: ApproveAndCallFallBackCaller{contract: contract}, ApproveAndCallFallBackTransactor: ApproveAndCallFallBackTransactor{contract: contract}, ApproveAndCallFallBackFilterer: ApproveAndCallFallBackFilterer{contract: contract}}, nil +} + +// NewApproveAndCallFallBackCaller creates a new read-only instance of ApproveAndCallFallBack, bound to a specific deployed contract. +func NewApproveAndCallFallBackCaller(address common.Address, caller bind.ContractCaller) (*ApproveAndCallFallBackCaller, error) { + contract, err := bindApproveAndCallFallBack(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &ApproveAndCallFallBackCaller{contract: contract}, nil +} + +// NewApproveAndCallFallBackTransactor creates a new write-only instance of ApproveAndCallFallBack, bound to a specific deployed contract. +func NewApproveAndCallFallBackTransactor(address common.Address, transactor bind.ContractTransactor) (*ApproveAndCallFallBackTransactor, error) { + contract, err := bindApproveAndCallFallBack(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &ApproveAndCallFallBackTransactor{contract: contract}, nil +} + +// NewApproveAndCallFallBackFilterer creates a new log filterer instance of ApproveAndCallFallBack, bound to a specific deployed contract. +func NewApproveAndCallFallBackFilterer(address common.Address, filterer bind.ContractFilterer) (*ApproveAndCallFallBackFilterer, error) { + contract, err := bindApproveAndCallFallBack(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &ApproveAndCallFallBackFilterer{contract: contract}, nil +} + +// bindApproveAndCallFallBack binds a generic wrapper to an already deployed contract. +func bindApproveAndCallFallBack(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := abi.JSON(strings.NewReader(ApproveAndCallFallBackABI)) + 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 (_ApproveAndCallFallBack *ApproveAndCallFallBackRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _ApproveAndCallFallBack.Contract.ApproveAndCallFallBackCaller.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 (_ApproveAndCallFallBack *ApproveAndCallFallBackRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _ApproveAndCallFallBack.Contract.ApproveAndCallFallBackTransactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_ApproveAndCallFallBack *ApproveAndCallFallBackRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _ApproveAndCallFallBack.Contract.ApproveAndCallFallBackTransactor.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 (_ApproveAndCallFallBack *ApproveAndCallFallBackCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _ApproveAndCallFallBack.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 (_ApproveAndCallFallBack *ApproveAndCallFallBackTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _ApproveAndCallFallBack.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_ApproveAndCallFallBack *ApproveAndCallFallBackTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _ApproveAndCallFallBack.Contract.contract.Transact(opts, method, params...) +} + +// ReceiveApproval is a paid mutator transaction binding the contract method 0x8f4ffcb1. +// +// Solidity: function receiveApproval(address from, uint256 _amount, address _token, bytes _data) returns() +func (_ApproveAndCallFallBack *ApproveAndCallFallBackTransactor) ReceiveApproval(opts *bind.TransactOpts, from common.Address, _amount *big.Int, _token common.Address, _data []byte) (*types.Transaction, error) { + return _ApproveAndCallFallBack.contract.Transact(opts, "receiveApproval", from, _amount, _token, _data) +} + +// ReceiveApproval is a paid mutator transaction binding the contract method 0x8f4ffcb1. +// +// Solidity: function receiveApproval(address from, uint256 _amount, address _token, bytes _data) returns() +func (_ApproveAndCallFallBack *ApproveAndCallFallBackSession) ReceiveApproval(from common.Address, _amount *big.Int, _token common.Address, _data []byte) (*types.Transaction, error) { + return _ApproveAndCallFallBack.Contract.ReceiveApproval(&_ApproveAndCallFallBack.TransactOpts, from, _amount, _token, _data) +} + +// ReceiveApproval is a paid mutator transaction binding the contract method 0x8f4ffcb1. +// +// Solidity: function receiveApproval(address from, uint256 _amount, address _token, bytes _data) returns() +func (_ApproveAndCallFallBack *ApproveAndCallFallBackTransactorSession) ReceiveApproval(from common.Address, _amount *big.Int, _token common.Address, _data []byte) (*types.Transaction, error) { + return _ApproveAndCallFallBack.Contract.ReceiveApproval(&_ApproveAndCallFallBack.TransactOpts, from, _amount, _token, _data) +} + +// ControlledABI is the input ABI used to generate the binding from. +const ControlledABI = "[{\"constant\":false,\"inputs\":[{\"name\":\"_newController\",\"type\":\"address\"}],\"name\":\"changeController\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"controller\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"controller\",\"type\":\"address\"}],\"name\":\"NewController\",\"type\":\"event\"}]" + +// ControlledFuncSigs maps the 4-byte function signature to its string representation. +var ControlledFuncSigs = map[string]string{ + "3cebb823": "changeController(address)", + "f77c4791": "controller()", +} + +// Controlled is an auto generated Go binding around an Ethereum contract. +type Controlled struct { + ControlledCaller // Read-only binding to the contract + ControlledTransactor // Write-only binding to the contract + ControlledFilterer // Log filterer for contract events +} + +// ControlledCaller is an auto generated read-only Go binding around an Ethereum contract. +type ControlledCaller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// ControlledTransactor is an auto generated write-only Go binding around an Ethereum contract. +type ControlledTransactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// ControlledFilterer is an auto generated log filtering Go binding around an Ethereum contract events. +type ControlledFilterer struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// ControlledSession is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type ControlledSession struct { + Contract *Controlled // 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 +} + +// ControlledCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type ControlledCallerSession struct { + Contract *ControlledCaller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// ControlledTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type ControlledTransactorSession struct { + Contract *ControlledTransactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// ControlledRaw is an auto generated low-level Go binding around an Ethereum contract. +type ControlledRaw struct { + Contract *Controlled // Generic contract binding to access the raw methods on +} + +// ControlledCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type ControlledCallerRaw struct { + Contract *ControlledCaller // Generic read-only contract binding to access the raw methods on +} + +// ControlledTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type ControlledTransactorRaw struct { + Contract *ControlledTransactor // Generic write-only contract binding to access the raw methods on +} + +// NewControlled creates a new instance of Controlled, bound to a specific deployed contract. +func NewControlled(address common.Address, backend bind.ContractBackend) (*Controlled, error) { + contract, err := bindControlled(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &Controlled{ControlledCaller: ControlledCaller{contract: contract}, ControlledTransactor: ControlledTransactor{contract: contract}, ControlledFilterer: ControlledFilterer{contract: contract}}, nil +} + +// NewControlledCaller creates a new read-only instance of Controlled, bound to a specific deployed contract. +func NewControlledCaller(address common.Address, caller bind.ContractCaller) (*ControlledCaller, error) { + contract, err := bindControlled(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &ControlledCaller{contract: contract}, nil +} + +// NewControlledTransactor creates a new write-only instance of Controlled, bound to a specific deployed contract. +func NewControlledTransactor(address common.Address, transactor bind.ContractTransactor) (*ControlledTransactor, error) { + contract, err := bindControlled(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &ControlledTransactor{contract: contract}, nil +} + +// NewControlledFilterer creates a new log filterer instance of Controlled, bound to a specific deployed contract. +func NewControlledFilterer(address common.Address, filterer bind.ContractFilterer) (*ControlledFilterer, error) { + contract, err := bindControlled(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &ControlledFilterer{contract: contract}, nil +} + +// bindControlled binds a generic wrapper to an already deployed contract. +func bindControlled(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := abi.JSON(strings.NewReader(ControlledABI)) + 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 (_Controlled *ControlledRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _Controlled.Contract.ControlledCaller.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 (_Controlled *ControlledRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Controlled.Contract.ControlledTransactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_Controlled *ControlledRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _Controlled.Contract.ControlledTransactor.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 (_Controlled *ControlledCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _Controlled.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 (_Controlled *ControlledTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Controlled.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_Controlled *ControlledTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _Controlled.Contract.contract.Transact(opts, method, params...) +} + +// Controller is a free data retrieval call binding the contract method 0xf77c4791. +// +// Solidity: function controller() view returns(address) +func (_Controlled *ControlledCaller) Controller(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _Controlled.contract.Call(opts, &out, "controller") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// Controller is a free data retrieval call binding the contract method 0xf77c4791. +// +// Solidity: function controller() view returns(address) +func (_Controlled *ControlledSession) Controller() (common.Address, error) { + return _Controlled.Contract.Controller(&_Controlled.CallOpts) +} + +// Controller is a free data retrieval call binding the contract method 0xf77c4791. +// +// Solidity: function controller() view returns(address) +func (_Controlled *ControlledCallerSession) Controller() (common.Address, error) { + return _Controlled.Contract.Controller(&_Controlled.CallOpts) +} + +// ChangeController is a paid mutator transaction binding the contract method 0x3cebb823. +// +// Solidity: function changeController(address _newController) returns() +func (_Controlled *ControlledTransactor) ChangeController(opts *bind.TransactOpts, _newController common.Address) (*types.Transaction, error) { + return _Controlled.contract.Transact(opts, "changeController", _newController) +} + +// ChangeController is a paid mutator transaction binding the contract method 0x3cebb823. +// +// Solidity: function changeController(address _newController) returns() +func (_Controlled *ControlledSession) ChangeController(_newController common.Address) (*types.Transaction, error) { + return _Controlled.Contract.ChangeController(&_Controlled.TransactOpts, _newController) +} + +// ChangeController is a paid mutator transaction binding the contract method 0x3cebb823. +// +// Solidity: function changeController(address _newController) returns() +func (_Controlled *ControlledTransactorSession) ChangeController(_newController common.Address) (*types.Transaction, error) { + return _Controlled.Contract.ChangeController(&_Controlled.TransactOpts, _newController) +} + +// ControlledNewControllerIterator is returned from FilterNewController and is used to iterate over the raw logs and unpacked data for NewController events raised by the Controlled contract. +type ControlledNewControllerIterator struct { + Event *ControlledNewController // 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 *ControlledNewControllerIterator) 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(ControlledNewController) + 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(ControlledNewController) + 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 *ControlledNewControllerIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ControlledNewControllerIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ControlledNewController represents a NewController event raised by the Controlled contract. +type ControlledNewController struct { + Controller common.Address + Raw types.Log // Blockchain specific contextual infos +} + +// FilterNewController is a free log retrieval operation binding the contract event 0xe253457d9ad994ca9682fc3bbc38c890dca73a2d5ecee3809e548bac8b00d7c6. +// +// Solidity: event NewController(address controller) +func (_Controlled *ControlledFilterer) FilterNewController(opts *bind.FilterOpts) (*ControlledNewControllerIterator, error) { + + logs, sub, err := _Controlled.contract.FilterLogs(opts, "NewController") + if err != nil { + return nil, err + } + return &ControlledNewControllerIterator{contract: _Controlled.contract, event: "NewController", logs: logs, sub: sub}, nil +} + +// WatchNewController is a free log subscription operation binding the contract event 0xe253457d9ad994ca9682fc3bbc38c890dca73a2d5ecee3809e548bac8b00d7c6. +// +// Solidity: event NewController(address controller) +func (_Controlled *ControlledFilterer) WatchNewController(opts *bind.WatchOpts, sink chan<- *ControlledNewController) (event.Subscription, error) { + + logs, sub, err := _Controlled.contract.WatchLogs(opts, "NewController") + 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(ControlledNewController) + if err := _Controlled.contract.UnpackLog(event, "NewController", 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 +} + +// ParseNewController is a log parse operation binding the contract event 0xe253457d9ad994ca9682fc3bbc38c890dca73a2d5ecee3809e548bac8b00d7c6. +// +// Solidity: event NewController(address controller) +func (_Controlled *ControlledFilterer) ParseNewController(log types.Log) (*ControlledNewController, error) { + event := new(ControlledNewController) + if err := _Controlled.contract.UnpackLog(event, "NewController", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// CountersABI is the input ABI used to generate the binding from. +const CountersABI = "[]" + +// CountersBin is the compiled bytecode used for deploying new contracts. +var CountersBin = "0x60556023600b82828239805160001a607314601657fe5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea265627a7a72305820193672f67d2aa639c8aa98e64b12069d244224f2e0edeffcd9bd358a244322d364736f6c634300050a0032" + +// DeployCounters deploys a new Ethereum contract, binding an instance of Counters to it. +func DeployCounters(auth *bind.TransactOpts, backend bind.ContractBackend) (common.Address, *types.Transaction, *Counters, error) { + parsed, err := abi.JSON(strings.NewReader(CountersABI)) + if err != nil { + return common.Address{}, nil, nil, err + } + + address, tx, contract, err := bind.DeployContract(auth, parsed, common.FromHex(CountersBin), backend) + if err != nil { + return common.Address{}, nil, nil, err + } + return address, tx, &Counters{CountersCaller: CountersCaller{contract: contract}, CountersTransactor: CountersTransactor{contract: contract}, CountersFilterer: CountersFilterer{contract: contract}}, nil +} + +// Counters is an auto generated Go binding around an Ethereum contract. +type Counters struct { + CountersCaller // Read-only binding to the contract + CountersTransactor // Write-only binding to the contract + CountersFilterer // Log filterer for contract events +} + +// CountersCaller is an auto generated read-only Go binding around an Ethereum contract. +type CountersCaller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// CountersTransactor is an auto generated write-only Go binding around an Ethereum contract. +type CountersTransactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// CountersFilterer is an auto generated log filtering Go binding around an Ethereum contract events. +type CountersFilterer struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// CountersSession is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type CountersSession struct { + Contract *Counters // 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 +} + +// CountersCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type CountersCallerSession struct { + Contract *CountersCaller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// CountersTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type CountersTransactorSession struct { + Contract *CountersTransactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// CountersRaw is an auto generated low-level Go binding around an Ethereum contract. +type CountersRaw struct { + Contract *Counters // Generic contract binding to access the raw methods on +} + +// CountersCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type CountersCallerRaw struct { + Contract *CountersCaller // Generic read-only contract binding to access the raw methods on +} + +// CountersTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type CountersTransactorRaw struct { + Contract *CountersTransactor // Generic write-only contract binding to access the raw methods on +} + +// NewCounters creates a new instance of Counters, bound to a specific deployed contract. +func NewCounters(address common.Address, backend bind.ContractBackend) (*Counters, error) { + contract, err := bindCounters(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &Counters{CountersCaller: CountersCaller{contract: contract}, CountersTransactor: CountersTransactor{contract: contract}, CountersFilterer: CountersFilterer{contract: contract}}, nil +} + +// NewCountersCaller creates a new read-only instance of Counters, bound to a specific deployed contract. +func NewCountersCaller(address common.Address, caller bind.ContractCaller) (*CountersCaller, error) { + contract, err := bindCounters(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &CountersCaller{contract: contract}, nil +} + +// NewCountersTransactor creates a new write-only instance of Counters, bound to a specific deployed contract. +func NewCountersTransactor(address common.Address, transactor bind.ContractTransactor) (*CountersTransactor, error) { + contract, err := bindCounters(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &CountersTransactor{contract: contract}, nil +} + +// NewCountersFilterer creates a new log filterer instance of Counters, bound to a specific deployed contract. +func NewCountersFilterer(address common.Address, filterer bind.ContractFilterer) (*CountersFilterer, error) { + contract, err := bindCounters(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &CountersFilterer{contract: contract}, nil +} + +// bindCounters binds a generic wrapper to an already deployed contract. +func bindCounters(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := abi.JSON(strings.NewReader(CountersABI)) + 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 (_Counters *CountersRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _Counters.Contract.CountersCaller.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 (_Counters *CountersRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Counters.Contract.CountersTransactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_Counters *CountersRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _Counters.Contract.CountersTransactor.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 (_Counters *CountersCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _Counters.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 (_Counters *CountersTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Counters.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_Counters *CountersTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _Counters.Contract.contract.Transact(opts, method, params...) +} + +// ERC165ABI is the input ABI used to generate the binding from. +const ERC165ABI = "[{\"constant\":true,\"inputs\":[{\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"}]" + +// ERC165FuncSigs maps the 4-byte function signature to its string representation. +var ERC165FuncSigs = map[string]string{ + "01ffc9a7": "supportsInterface(bytes4)", +} + +// ERC165 is an auto generated Go binding around an Ethereum contract. +type ERC165 struct { + ERC165Caller // Read-only binding to the contract + ERC165Transactor // Write-only binding to the contract + ERC165Filterer // Log filterer for contract events +} + +// ERC165Caller is an auto generated read-only Go binding around an Ethereum contract. +type ERC165Caller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// ERC165Transactor is an auto generated write-only Go binding around an Ethereum contract. +type ERC165Transactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// ERC165Filterer is an auto generated log filtering Go binding around an Ethereum contract events. +type ERC165Filterer struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// ERC165Session is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type ERC165Session struct { + Contract *ERC165 // 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 +} + +// ERC165CallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type ERC165CallerSession struct { + Contract *ERC165Caller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// ERC165TransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type ERC165TransactorSession struct { + Contract *ERC165Transactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// ERC165Raw is an auto generated low-level Go binding around an Ethereum contract. +type ERC165Raw struct { + Contract *ERC165 // Generic contract binding to access the raw methods on +} + +// ERC165CallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type ERC165CallerRaw struct { + Contract *ERC165Caller // Generic read-only contract binding to access the raw methods on +} + +// ERC165TransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type ERC165TransactorRaw struct { + Contract *ERC165Transactor // Generic write-only contract binding to access the raw methods on +} + +// NewERC165 creates a new instance of ERC165, bound to a specific deployed contract. +func NewERC165(address common.Address, backend bind.ContractBackend) (*ERC165, error) { + contract, err := bindERC165(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &ERC165{ERC165Caller: ERC165Caller{contract: contract}, ERC165Transactor: ERC165Transactor{contract: contract}, ERC165Filterer: ERC165Filterer{contract: contract}}, nil +} + +// NewERC165Caller creates a new read-only instance of ERC165, bound to a specific deployed contract. +func NewERC165Caller(address common.Address, caller bind.ContractCaller) (*ERC165Caller, error) { + contract, err := bindERC165(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &ERC165Caller{contract: contract}, nil +} + +// NewERC165Transactor creates a new write-only instance of ERC165, bound to a specific deployed contract. +func NewERC165Transactor(address common.Address, transactor bind.ContractTransactor) (*ERC165Transactor, error) { + contract, err := bindERC165(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &ERC165Transactor{contract: contract}, nil +} + +// NewERC165Filterer creates a new log filterer instance of ERC165, bound to a specific deployed contract. +func NewERC165Filterer(address common.Address, filterer bind.ContractFilterer) (*ERC165Filterer, error) { + contract, err := bindERC165(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &ERC165Filterer{contract: contract}, nil +} + +// bindERC165 binds a generic wrapper to an already deployed contract. +func bindERC165(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := abi.JSON(strings.NewReader(ERC165ABI)) + 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 (_ERC165 *ERC165Raw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _ERC165.Contract.ERC165Caller.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 (_ERC165 *ERC165Raw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _ERC165.Contract.ERC165Transactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_ERC165 *ERC165Raw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _ERC165.Contract.ERC165Transactor.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 (_ERC165 *ERC165CallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _ERC165.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 (_ERC165 *ERC165TransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _ERC165.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_ERC165 *ERC165TransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _ERC165.Contract.contract.Transact(opts, method, params...) +} + +// SupportsInterface is a free data retrieval call binding the contract method 0x01ffc9a7. +// +// Solidity: function supportsInterface(bytes4 interfaceId) view returns(bool) +func (_ERC165 *ERC165Caller) SupportsInterface(opts *bind.CallOpts, interfaceId [4]byte) (bool, error) { + var out []interface{} + err := _ERC165.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 (_ERC165 *ERC165Session) SupportsInterface(interfaceId [4]byte) (bool, error) { + return _ERC165.Contract.SupportsInterface(&_ERC165.CallOpts, interfaceId) +} + +// SupportsInterface is a free data retrieval call binding the contract method 0x01ffc9a7. +// +// Solidity: function supportsInterface(bytes4 interfaceId) view returns(bool) +func (_ERC165 *ERC165CallerSession) SupportsInterface(interfaceId [4]byte) (bool, error) { + return _ERC165.Contract.SupportsInterface(&_ERC165.CallOpts, interfaceId) +} + +// ERC20ReceiverABI is the input ABI used to generate the binding from. +const ERC20ReceiverABI = "[{\"constant\":true,\"inputs\":[{\"name\":\"_token\",\"type\":\"address\"},{\"name\":\"_from\",\"type\":\"address\"}],\"name\":\"tokenBalanceOf\",\"outputs\":[{\"name\":\"fromTokenBalance\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_token\",\"type\":\"address\"}],\"name\":\"depositToken\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_token\",\"type\":\"address\"},{\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"depositToken\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_token\",\"type\":\"address\"},{\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"withdrawToken\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"token\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"TokenDeposited\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"token\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"TokenWithdrawn\",\"type\":\"event\"}]" + +// ERC20ReceiverFuncSigs maps the 4-byte function signature to its string representation. +var ERC20ReceiverFuncSigs = map[string]string{ + "2fd55265": "depositToken(address)", + "338b5dea": "depositToken(address,uint256)", + "1bea8006": "tokenBalanceOf(address,address)", + "9e281a98": "withdrawToken(address,uint256)", +} + +// ERC20ReceiverBin is the compiled bytecode used for deploying new contracts. +var ERC20ReceiverBin = "0x608060405234801561001057600080fd5b506105de806100206000396000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c80631bea8006146100515780632fd5526514610091578063338b5dea146100b95780639e281a98146100e5575b600080fd5b61007f6004803603604081101561006757600080fd5b506001600160a01b0381358116916020013516610111565b60408051918252519081900360200190f35b6100b7600480360360208110156100a757600080fd5b50356001600160a01b031661013a565b005b6100b7600480360360408110156100cf57600080fd5b506001600160a01b0381351690602001356101c3565b6100b7600480360360408110156100fb57600080fd5b506001600160a01b03813516906020013561028f565b6001600160a01b0391821660009081526020818152604080832093909416825291909152205490565b60408051636eb1769f60e11b8152336004820181905230602483015291516101c0929184916001600160a01b0383169163dd62ed3e916044808301926020929190829003018186803b15801561018f57600080fd5b505afa1580156101a3573d6000803e3d6000fd5b505050506040513d60208110156101b957600080fd5b505161029a565b50565b60408051636eb1769f60e11b8152336004820152306024820152905182916001600160a01b0385169163dd62ed3e91604480820192602092909190829003018186803b15801561021257600080fd5b505afa158015610226573d6000803e3d6000fd5b505050506040513d602081101561023c57600080fd5b50511015610280576040805162461bcd60e51b815260206004820152600c60248201526b10985908185c99dd5b595b9d60a21b604482015290519081900360640190fd5b61028b33838361029a565b5050565b61028b3383836103cc565b600081116102de576040805162461bcd60e51b815260206004820152600c60248201526b10985908185c99dd5b595b9d60a21b604482015290519081900360640190fd5b604080516323b872dd60e01b81526001600160a01b038581166004830152306024830152604482018490529151918416916323b872dd916064808201926020929091908290030181600087803b15801561033757600080fd5b505af115801561034b573d6000803e3d6000fd5b505050506040513d602081101561036157600080fd5b5051156103c7576001600160a01b0380831660008181526020818152604080832094881680845294825291829020805486019055815185815291517ff1444b5cad7ce70cb018d1b8edc8618fe303f3c7f034d8d572a6e27facbf2bef9281900390910190a35b505050565b60008111610410576040805162461bcd60e51b815260206004820152600c60248201526b10985908185c99dd5b595b9d60a21b604482015290519081900360640190fd5b6001600160a01b038083166000908152602081815260408083209387168352929052205481111561047d576040805162461bcd60e51b8152602060048201526012602482015271496e73756666696369656e742066756e647360701b604482015290519081900360640190fd5b6001600160a01b0380831660008181526020818152604080832094881680845294825280832080548790039055805163a9059cbb60e01b815260048101959095526024850186905251929363a9059cbb9360448083019491928390030190829087803b1580156104ec57600080fd5b505af1158015610500573d6000803e3d6000fd5b505050506040513d602081101561051657600080fd5b5051610559576040805162461bcd60e51b815260206004820152600d60248201526c151c985b9cd9995c8819985a5b609a1b604482015290519081900360640190fd5b826001600160a01b0316826001600160a01b03167f8210728e7c071f615b840ee026032693858fbcd5e5359e67e438c890f59e5620836040518082815260200191505060405180910390a350505056fea265627a7a7230582093297dcffa75bf23fd3bf05632e53a14144b540f034384b270c02f4609945c2964736f6c634300050a0032" + +// DeployERC20Receiver deploys a new Ethereum contract, binding an instance of ERC20Receiver to it. +func DeployERC20Receiver(auth *bind.TransactOpts, backend bind.ContractBackend) (common.Address, *types.Transaction, *ERC20Receiver, error) { + parsed, err := abi.JSON(strings.NewReader(ERC20ReceiverABI)) + if err != nil { + return common.Address{}, nil, nil, err + } + + address, tx, contract, err := bind.DeployContract(auth, parsed, common.FromHex(ERC20ReceiverBin), backend) + if err != nil { + return common.Address{}, nil, nil, err + } + return address, tx, &ERC20Receiver{ERC20ReceiverCaller: ERC20ReceiverCaller{contract: contract}, ERC20ReceiverTransactor: ERC20ReceiverTransactor{contract: contract}, ERC20ReceiverFilterer: ERC20ReceiverFilterer{contract: contract}}, nil +} + +// ERC20Receiver is an auto generated Go binding around an Ethereum contract. +type ERC20Receiver struct { + ERC20ReceiverCaller // Read-only binding to the contract + ERC20ReceiverTransactor // Write-only binding to the contract + ERC20ReceiverFilterer // Log filterer for contract events +} + +// ERC20ReceiverCaller is an auto generated read-only Go binding around an Ethereum contract. +type ERC20ReceiverCaller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// ERC20ReceiverTransactor is an auto generated write-only Go binding around an Ethereum contract. +type ERC20ReceiverTransactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// ERC20ReceiverFilterer is an auto generated log filtering Go binding around an Ethereum contract events. +type ERC20ReceiverFilterer struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// ERC20ReceiverSession is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type ERC20ReceiverSession struct { + Contract *ERC20Receiver // 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 +} + +// ERC20ReceiverCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type ERC20ReceiverCallerSession struct { + Contract *ERC20ReceiverCaller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// ERC20ReceiverTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type ERC20ReceiverTransactorSession struct { + Contract *ERC20ReceiverTransactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// ERC20ReceiverRaw is an auto generated low-level Go binding around an Ethereum contract. +type ERC20ReceiverRaw struct { + Contract *ERC20Receiver // Generic contract binding to access the raw methods on +} + +// ERC20ReceiverCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type ERC20ReceiverCallerRaw struct { + Contract *ERC20ReceiverCaller // Generic read-only contract binding to access the raw methods on +} + +// ERC20ReceiverTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type ERC20ReceiverTransactorRaw struct { + Contract *ERC20ReceiverTransactor // Generic write-only contract binding to access the raw methods on +} + +// NewERC20Receiver creates a new instance of ERC20Receiver, bound to a specific deployed contract. +func NewERC20Receiver(address common.Address, backend bind.ContractBackend) (*ERC20Receiver, error) { + contract, err := bindERC20Receiver(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &ERC20Receiver{ERC20ReceiverCaller: ERC20ReceiverCaller{contract: contract}, ERC20ReceiverTransactor: ERC20ReceiverTransactor{contract: contract}, ERC20ReceiverFilterer: ERC20ReceiverFilterer{contract: contract}}, nil +} + +// NewERC20ReceiverCaller creates a new read-only instance of ERC20Receiver, bound to a specific deployed contract. +func NewERC20ReceiverCaller(address common.Address, caller bind.ContractCaller) (*ERC20ReceiverCaller, error) { + contract, err := bindERC20Receiver(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &ERC20ReceiverCaller{contract: contract}, nil +} + +// NewERC20ReceiverTransactor creates a new write-only instance of ERC20Receiver, bound to a specific deployed contract. +func NewERC20ReceiverTransactor(address common.Address, transactor bind.ContractTransactor) (*ERC20ReceiverTransactor, error) { + contract, err := bindERC20Receiver(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &ERC20ReceiverTransactor{contract: contract}, nil +} + +// NewERC20ReceiverFilterer creates a new log filterer instance of ERC20Receiver, bound to a specific deployed contract. +func NewERC20ReceiverFilterer(address common.Address, filterer bind.ContractFilterer) (*ERC20ReceiverFilterer, error) { + contract, err := bindERC20Receiver(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &ERC20ReceiverFilterer{contract: contract}, nil +} + +// bindERC20Receiver binds a generic wrapper to an already deployed contract. +func bindERC20Receiver(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := abi.JSON(strings.NewReader(ERC20ReceiverABI)) + 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 (_ERC20Receiver *ERC20ReceiverRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _ERC20Receiver.Contract.ERC20ReceiverCaller.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 (_ERC20Receiver *ERC20ReceiverRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _ERC20Receiver.Contract.ERC20ReceiverTransactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_ERC20Receiver *ERC20ReceiverRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _ERC20Receiver.Contract.ERC20ReceiverTransactor.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 (_ERC20Receiver *ERC20ReceiverCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _ERC20Receiver.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 (_ERC20Receiver *ERC20ReceiverTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _ERC20Receiver.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_ERC20Receiver *ERC20ReceiverTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _ERC20Receiver.Contract.contract.Transact(opts, method, params...) +} + +// TokenBalanceOf is a free data retrieval call binding the contract method 0x1bea8006. +// +// Solidity: function tokenBalanceOf(address _token, address _from) view returns(uint256 fromTokenBalance) +func (_ERC20Receiver *ERC20ReceiverCaller) TokenBalanceOf(opts *bind.CallOpts, _token common.Address, _from common.Address) (*big.Int, error) { + var out []interface{} + err := _ERC20Receiver.contract.Call(opts, &out, "tokenBalanceOf", _token, _from) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// TokenBalanceOf is a free data retrieval call binding the contract method 0x1bea8006. +// +// Solidity: function tokenBalanceOf(address _token, address _from) view returns(uint256 fromTokenBalance) +func (_ERC20Receiver *ERC20ReceiverSession) TokenBalanceOf(_token common.Address, _from common.Address) (*big.Int, error) { + return _ERC20Receiver.Contract.TokenBalanceOf(&_ERC20Receiver.CallOpts, _token, _from) +} + +// TokenBalanceOf is a free data retrieval call binding the contract method 0x1bea8006. +// +// Solidity: function tokenBalanceOf(address _token, address _from) view returns(uint256 fromTokenBalance) +func (_ERC20Receiver *ERC20ReceiverCallerSession) TokenBalanceOf(_token common.Address, _from common.Address) (*big.Int, error) { + return _ERC20Receiver.Contract.TokenBalanceOf(&_ERC20Receiver.CallOpts, _token, _from) +} + +// DepositToken is a paid mutator transaction binding the contract method 0x2fd55265. +// +// Solidity: function depositToken(address _token) returns() +func (_ERC20Receiver *ERC20ReceiverTransactor) DepositToken(opts *bind.TransactOpts, _token common.Address) (*types.Transaction, error) { + return _ERC20Receiver.contract.Transact(opts, "depositToken", _token) +} + +// DepositToken is a paid mutator transaction binding the contract method 0x2fd55265. +// +// Solidity: function depositToken(address _token) returns() +func (_ERC20Receiver *ERC20ReceiverSession) DepositToken(_token common.Address) (*types.Transaction, error) { + return _ERC20Receiver.Contract.DepositToken(&_ERC20Receiver.TransactOpts, _token) +} + +// DepositToken is a paid mutator transaction binding the contract method 0x2fd55265. +// +// Solidity: function depositToken(address _token) returns() +func (_ERC20Receiver *ERC20ReceiverTransactorSession) DepositToken(_token common.Address) (*types.Transaction, error) { + return _ERC20Receiver.Contract.DepositToken(&_ERC20Receiver.TransactOpts, _token) +} + +// DepositToken0 is a paid mutator transaction binding the contract method 0x338b5dea. +// +// Solidity: function depositToken(address _token, uint256 _amount) returns() +func (_ERC20Receiver *ERC20ReceiverTransactor) DepositToken0(opts *bind.TransactOpts, _token common.Address, _amount *big.Int) (*types.Transaction, error) { + return _ERC20Receiver.contract.Transact(opts, "depositToken0", _token, _amount) +} + +// DepositToken0 is a paid mutator transaction binding the contract method 0x338b5dea. +// +// Solidity: function depositToken(address _token, uint256 _amount) returns() +func (_ERC20Receiver *ERC20ReceiverSession) DepositToken0(_token common.Address, _amount *big.Int) (*types.Transaction, error) { + return _ERC20Receiver.Contract.DepositToken0(&_ERC20Receiver.TransactOpts, _token, _amount) +} + +// DepositToken0 is a paid mutator transaction binding the contract method 0x338b5dea. +// +// Solidity: function depositToken(address _token, uint256 _amount) returns() +func (_ERC20Receiver *ERC20ReceiverTransactorSession) DepositToken0(_token common.Address, _amount *big.Int) (*types.Transaction, error) { + return _ERC20Receiver.Contract.DepositToken0(&_ERC20Receiver.TransactOpts, _token, _amount) +} + +// WithdrawToken is a paid mutator transaction binding the contract method 0x9e281a98. +// +// Solidity: function withdrawToken(address _token, uint256 _amount) returns() +func (_ERC20Receiver *ERC20ReceiverTransactor) WithdrawToken(opts *bind.TransactOpts, _token common.Address, _amount *big.Int) (*types.Transaction, error) { + return _ERC20Receiver.contract.Transact(opts, "withdrawToken", _token, _amount) +} + +// WithdrawToken is a paid mutator transaction binding the contract method 0x9e281a98. +// +// Solidity: function withdrawToken(address _token, uint256 _amount) returns() +func (_ERC20Receiver *ERC20ReceiverSession) WithdrawToken(_token common.Address, _amount *big.Int) (*types.Transaction, error) { + return _ERC20Receiver.Contract.WithdrawToken(&_ERC20Receiver.TransactOpts, _token, _amount) +} + +// WithdrawToken is a paid mutator transaction binding the contract method 0x9e281a98. +// +// Solidity: function withdrawToken(address _token, uint256 _amount) returns() +func (_ERC20Receiver *ERC20ReceiverTransactorSession) WithdrawToken(_token common.Address, _amount *big.Int) (*types.Transaction, error) { + return _ERC20Receiver.Contract.WithdrawToken(&_ERC20Receiver.TransactOpts, _token, _amount) +} + +// ERC20ReceiverTokenDepositedIterator is returned from FilterTokenDeposited and is used to iterate over the raw logs and unpacked data for TokenDeposited events raised by the ERC20Receiver contract. +type ERC20ReceiverTokenDepositedIterator struct { + Event *ERC20ReceiverTokenDeposited // 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 *ERC20ReceiverTokenDepositedIterator) 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(ERC20ReceiverTokenDeposited) + 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(ERC20ReceiverTokenDeposited) + 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 *ERC20ReceiverTokenDepositedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ERC20ReceiverTokenDepositedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ERC20ReceiverTokenDeposited represents a TokenDeposited event raised by the ERC20Receiver contract. +type ERC20ReceiverTokenDeposited struct { + Token common.Address + Sender common.Address + Amount *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterTokenDeposited is a free log retrieval operation binding the contract event 0xf1444b5cad7ce70cb018d1b8edc8618fe303f3c7f034d8d572a6e27facbf2bef. +// +// Solidity: event TokenDeposited(address indexed token, address indexed sender, uint256 amount) +func (_ERC20Receiver *ERC20ReceiverFilterer) FilterTokenDeposited(opts *bind.FilterOpts, token []common.Address, sender []common.Address) (*ERC20ReceiverTokenDepositedIterator, error) { + + var tokenRule []interface{} + for _, tokenItem := range token { + tokenRule = append(tokenRule, tokenItem) + } + var senderRule []interface{} + for _, senderItem := range sender { + senderRule = append(senderRule, senderItem) + } + + logs, sub, err := _ERC20Receiver.contract.FilterLogs(opts, "TokenDeposited", tokenRule, senderRule) + if err != nil { + return nil, err + } + return &ERC20ReceiverTokenDepositedIterator{contract: _ERC20Receiver.contract, event: "TokenDeposited", logs: logs, sub: sub}, nil +} + +// WatchTokenDeposited is a free log subscription operation binding the contract event 0xf1444b5cad7ce70cb018d1b8edc8618fe303f3c7f034d8d572a6e27facbf2bef. +// +// Solidity: event TokenDeposited(address indexed token, address indexed sender, uint256 amount) +func (_ERC20Receiver *ERC20ReceiverFilterer) WatchTokenDeposited(opts *bind.WatchOpts, sink chan<- *ERC20ReceiverTokenDeposited, token []common.Address, sender []common.Address) (event.Subscription, error) { + + var tokenRule []interface{} + for _, tokenItem := range token { + tokenRule = append(tokenRule, tokenItem) + } + var senderRule []interface{} + for _, senderItem := range sender { + senderRule = append(senderRule, senderItem) + } + + logs, sub, err := _ERC20Receiver.contract.WatchLogs(opts, "TokenDeposited", tokenRule, senderRule) + 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(ERC20ReceiverTokenDeposited) + if err := _ERC20Receiver.contract.UnpackLog(event, "TokenDeposited", 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 +} + +// ParseTokenDeposited is a log parse operation binding the contract event 0xf1444b5cad7ce70cb018d1b8edc8618fe303f3c7f034d8d572a6e27facbf2bef. +// +// Solidity: event TokenDeposited(address indexed token, address indexed sender, uint256 amount) +func (_ERC20Receiver *ERC20ReceiverFilterer) ParseTokenDeposited(log types.Log) (*ERC20ReceiverTokenDeposited, error) { + event := new(ERC20ReceiverTokenDeposited) + if err := _ERC20Receiver.contract.UnpackLog(event, "TokenDeposited", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ERC20ReceiverTokenWithdrawnIterator is returned from FilterTokenWithdrawn and is used to iterate over the raw logs and unpacked data for TokenWithdrawn events raised by the ERC20Receiver contract. +type ERC20ReceiverTokenWithdrawnIterator struct { + Event *ERC20ReceiverTokenWithdrawn // 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 *ERC20ReceiverTokenWithdrawnIterator) 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(ERC20ReceiverTokenWithdrawn) + 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(ERC20ReceiverTokenWithdrawn) + 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 *ERC20ReceiverTokenWithdrawnIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ERC20ReceiverTokenWithdrawnIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ERC20ReceiverTokenWithdrawn represents a TokenWithdrawn event raised by the ERC20Receiver contract. +type ERC20ReceiverTokenWithdrawn struct { + Token common.Address + Sender common.Address + Amount *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterTokenWithdrawn is a free log retrieval operation binding the contract event 0x8210728e7c071f615b840ee026032693858fbcd5e5359e67e438c890f59e5620. +// +// Solidity: event TokenWithdrawn(address indexed token, address indexed sender, uint256 amount) +func (_ERC20Receiver *ERC20ReceiverFilterer) FilterTokenWithdrawn(opts *bind.FilterOpts, token []common.Address, sender []common.Address) (*ERC20ReceiverTokenWithdrawnIterator, error) { + + var tokenRule []interface{} + for _, tokenItem := range token { + tokenRule = append(tokenRule, tokenItem) + } + var senderRule []interface{} + for _, senderItem := range sender { + senderRule = append(senderRule, senderItem) + } + + logs, sub, err := _ERC20Receiver.contract.FilterLogs(opts, "TokenWithdrawn", tokenRule, senderRule) + if err != nil { + return nil, err + } + return &ERC20ReceiverTokenWithdrawnIterator{contract: _ERC20Receiver.contract, event: "TokenWithdrawn", logs: logs, sub: sub}, nil +} + +// WatchTokenWithdrawn is a free log subscription operation binding the contract event 0x8210728e7c071f615b840ee026032693858fbcd5e5359e67e438c890f59e5620. +// +// Solidity: event TokenWithdrawn(address indexed token, address indexed sender, uint256 amount) +func (_ERC20Receiver *ERC20ReceiverFilterer) WatchTokenWithdrawn(opts *bind.WatchOpts, sink chan<- *ERC20ReceiverTokenWithdrawn, token []common.Address, sender []common.Address) (event.Subscription, error) { + + var tokenRule []interface{} + for _, tokenItem := range token { + tokenRule = append(tokenRule, tokenItem) + } + var senderRule []interface{} + for _, senderItem := range sender { + senderRule = append(senderRule, senderItem) + } + + logs, sub, err := _ERC20Receiver.contract.WatchLogs(opts, "TokenWithdrawn", tokenRule, senderRule) + 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(ERC20ReceiverTokenWithdrawn) + if err := _ERC20Receiver.contract.UnpackLog(event, "TokenWithdrawn", 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 +} + +// ParseTokenWithdrawn is a log parse operation binding the contract event 0x8210728e7c071f615b840ee026032693858fbcd5e5359e67e438c890f59e5620. +// +// Solidity: event TokenWithdrawn(address indexed token, address indexed sender, uint256 amount) +func (_ERC20Receiver *ERC20ReceiverFilterer) ParseTokenWithdrawn(log types.Log) (*ERC20ReceiverTokenWithdrawn, error) { + event := new(ERC20ReceiverTokenWithdrawn) + if err := _ERC20Receiver.contract.UnpackLog(event, "TokenWithdrawn", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ERC20TokenABI is the input ABI used to generate the binding from. +const ERC20TokenABI = "[{\"constant\":false,\"inputs\":[{\"name\":\"_spender\",\"type\":\"address\"},{\"name\":\"_value\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[{\"name\":\"success\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"name\":\"supply\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_from\",\"type\":\"address\"},{\"name\":\"_to\",\"type\":\"address\"},{\"name\":\"_value\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[{\"name\":\"success\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_owner\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"name\":\"balance\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_to\",\"type\":\"address\"},{\"name\":\"_value\",\"type\":\"uint256\"}],\"name\":\"transfer\",\"outputs\":[{\"name\":\"success\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_owner\",\"type\":\"address\"},{\"name\":\"_spender\",\"type\":\"address\"}],\"name\":\"allowance\",\"outputs\":[{\"name\":\"remaining\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"spender\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"}]" + +// ERC20TokenFuncSigs maps the 4-byte function signature to its string representation. +var ERC20TokenFuncSigs = map[string]string{ + "dd62ed3e": "allowance(address,address)", + "095ea7b3": "approve(address,uint256)", + "70a08231": "balanceOf(address)", + "18160ddd": "totalSupply()", + "a9059cbb": "transfer(address,uint256)", + "23b872dd": "transferFrom(address,address,uint256)", +} + +// ERC20Token is an auto generated Go binding around an Ethereum contract. +type ERC20Token struct { + ERC20TokenCaller // Read-only binding to the contract + ERC20TokenTransactor // Write-only binding to the contract + ERC20TokenFilterer // Log filterer for contract events +} + +// ERC20TokenCaller is an auto generated read-only Go binding around an Ethereum contract. +type ERC20TokenCaller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// ERC20TokenTransactor is an auto generated write-only Go binding around an Ethereum contract. +type ERC20TokenTransactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// ERC20TokenFilterer is an auto generated log filtering Go binding around an Ethereum contract events. +type ERC20TokenFilterer struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// ERC20TokenSession is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type ERC20TokenSession struct { + Contract *ERC20Token // 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 +} + +// ERC20TokenCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type ERC20TokenCallerSession struct { + Contract *ERC20TokenCaller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// ERC20TokenTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type ERC20TokenTransactorSession struct { + Contract *ERC20TokenTransactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// ERC20TokenRaw is an auto generated low-level Go binding around an Ethereum contract. +type ERC20TokenRaw struct { + Contract *ERC20Token // Generic contract binding to access the raw methods on +} + +// ERC20TokenCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type ERC20TokenCallerRaw struct { + Contract *ERC20TokenCaller // Generic read-only contract binding to access the raw methods on +} + +// ERC20TokenTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type ERC20TokenTransactorRaw struct { + Contract *ERC20TokenTransactor // Generic write-only contract binding to access the raw methods on +} + +// NewERC20Token creates a new instance of ERC20Token, bound to a specific deployed contract. +func NewERC20Token(address common.Address, backend bind.ContractBackend) (*ERC20Token, error) { + contract, err := bindERC20Token(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &ERC20Token{ERC20TokenCaller: ERC20TokenCaller{contract: contract}, ERC20TokenTransactor: ERC20TokenTransactor{contract: contract}, ERC20TokenFilterer: ERC20TokenFilterer{contract: contract}}, nil +} + +// NewERC20TokenCaller creates a new read-only instance of ERC20Token, bound to a specific deployed contract. +func NewERC20TokenCaller(address common.Address, caller bind.ContractCaller) (*ERC20TokenCaller, error) { + contract, err := bindERC20Token(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &ERC20TokenCaller{contract: contract}, nil +} + +// NewERC20TokenTransactor creates a new write-only instance of ERC20Token, bound to a specific deployed contract. +func NewERC20TokenTransactor(address common.Address, transactor bind.ContractTransactor) (*ERC20TokenTransactor, error) { + contract, err := bindERC20Token(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &ERC20TokenTransactor{contract: contract}, nil +} + +// NewERC20TokenFilterer creates a new log filterer instance of ERC20Token, bound to a specific deployed contract. +func NewERC20TokenFilterer(address common.Address, filterer bind.ContractFilterer) (*ERC20TokenFilterer, error) { + contract, err := bindERC20Token(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &ERC20TokenFilterer{contract: contract}, nil +} + +// bindERC20Token binds a generic wrapper to an already deployed contract. +func bindERC20Token(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := abi.JSON(strings.NewReader(ERC20TokenABI)) + 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 (_ERC20Token *ERC20TokenRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _ERC20Token.Contract.ERC20TokenCaller.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 (_ERC20Token *ERC20TokenRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _ERC20Token.Contract.ERC20TokenTransactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_ERC20Token *ERC20TokenRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _ERC20Token.Contract.ERC20TokenTransactor.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 (_ERC20Token *ERC20TokenCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _ERC20Token.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 (_ERC20Token *ERC20TokenTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _ERC20Token.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_ERC20Token *ERC20TokenTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _ERC20Token.Contract.contract.Transact(opts, method, params...) +} + +// Allowance is a free data retrieval call binding the contract method 0xdd62ed3e. +// +// Solidity: function allowance(address _owner, address _spender) view returns(uint256 remaining) +func (_ERC20Token *ERC20TokenCaller) Allowance(opts *bind.CallOpts, _owner common.Address, _spender common.Address) (*big.Int, error) { + var out []interface{} + err := _ERC20Token.contract.Call(opts, &out, "allowance", _owner, _spender) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// Allowance is a free data retrieval call binding the contract method 0xdd62ed3e. +// +// Solidity: function allowance(address _owner, address _spender) view returns(uint256 remaining) +func (_ERC20Token *ERC20TokenSession) Allowance(_owner common.Address, _spender common.Address) (*big.Int, error) { + return _ERC20Token.Contract.Allowance(&_ERC20Token.CallOpts, _owner, _spender) +} + +// Allowance is a free data retrieval call binding the contract method 0xdd62ed3e. +// +// Solidity: function allowance(address _owner, address _spender) view returns(uint256 remaining) +func (_ERC20Token *ERC20TokenCallerSession) Allowance(_owner common.Address, _spender common.Address) (*big.Int, error) { + return _ERC20Token.Contract.Allowance(&_ERC20Token.CallOpts, _owner, _spender) +} + +// BalanceOf is a free data retrieval call binding the contract method 0x70a08231. +// +// Solidity: function balanceOf(address _owner) view returns(uint256 balance) +func (_ERC20Token *ERC20TokenCaller) BalanceOf(opts *bind.CallOpts, _owner common.Address) (*big.Int, error) { + var out []interface{} + err := _ERC20Token.contract.Call(opts, &out, "balanceOf", _owner) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// BalanceOf is a free data retrieval call binding the contract method 0x70a08231. +// +// Solidity: function balanceOf(address _owner) view returns(uint256 balance) +func (_ERC20Token *ERC20TokenSession) BalanceOf(_owner common.Address) (*big.Int, error) { + return _ERC20Token.Contract.BalanceOf(&_ERC20Token.CallOpts, _owner) +} + +// BalanceOf is a free data retrieval call binding the contract method 0x70a08231. +// +// Solidity: function balanceOf(address _owner) view returns(uint256 balance) +func (_ERC20Token *ERC20TokenCallerSession) BalanceOf(_owner common.Address) (*big.Int, error) { + return _ERC20Token.Contract.BalanceOf(&_ERC20Token.CallOpts, _owner) +} + +// TotalSupply is a free data retrieval call binding the contract method 0x18160ddd. +// +// Solidity: function totalSupply() view returns(uint256 supply) +func (_ERC20Token *ERC20TokenCaller) TotalSupply(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _ERC20Token.contract.Call(opts, &out, "totalSupply") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// TotalSupply is a free data retrieval call binding the contract method 0x18160ddd. +// +// Solidity: function totalSupply() view returns(uint256 supply) +func (_ERC20Token *ERC20TokenSession) TotalSupply() (*big.Int, error) { + return _ERC20Token.Contract.TotalSupply(&_ERC20Token.CallOpts) +} + +// TotalSupply is a free data retrieval call binding the contract method 0x18160ddd. +// +// Solidity: function totalSupply() view returns(uint256 supply) +func (_ERC20Token *ERC20TokenCallerSession) TotalSupply() (*big.Int, error) { + return _ERC20Token.Contract.TotalSupply(&_ERC20Token.CallOpts) +} + +// Approve is a paid mutator transaction binding the contract method 0x095ea7b3. +// +// Solidity: function approve(address _spender, uint256 _value) returns(bool success) +func (_ERC20Token *ERC20TokenTransactor) Approve(opts *bind.TransactOpts, _spender common.Address, _value *big.Int) (*types.Transaction, error) { + return _ERC20Token.contract.Transact(opts, "approve", _spender, _value) +} + +// Approve is a paid mutator transaction binding the contract method 0x095ea7b3. +// +// Solidity: function approve(address _spender, uint256 _value) returns(bool success) +func (_ERC20Token *ERC20TokenSession) Approve(_spender common.Address, _value *big.Int) (*types.Transaction, error) { + return _ERC20Token.Contract.Approve(&_ERC20Token.TransactOpts, _spender, _value) +} + +// Approve is a paid mutator transaction binding the contract method 0x095ea7b3. +// +// Solidity: function approve(address _spender, uint256 _value) returns(bool success) +func (_ERC20Token *ERC20TokenTransactorSession) Approve(_spender common.Address, _value *big.Int) (*types.Transaction, error) { + return _ERC20Token.Contract.Approve(&_ERC20Token.TransactOpts, _spender, _value) +} + +// Transfer is a paid mutator transaction binding the contract method 0xa9059cbb. +// +// Solidity: function transfer(address _to, uint256 _value) returns(bool success) +func (_ERC20Token *ERC20TokenTransactor) Transfer(opts *bind.TransactOpts, _to common.Address, _value *big.Int) (*types.Transaction, error) { + return _ERC20Token.contract.Transact(opts, "transfer", _to, _value) +} + +// Transfer is a paid mutator transaction binding the contract method 0xa9059cbb. +// +// Solidity: function transfer(address _to, uint256 _value) returns(bool success) +func (_ERC20Token *ERC20TokenSession) Transfer(_to common.Address, _value *big.Int) (*types.Transaction, error) { + return _ERC20Token.Contract.Transfer(&_ERC20Token.TransactOpts, _to, _value) +} + +// Transfer is a paid mutator transaction binding the contract method 0xa9059cbb. +// +// Solidity: function transfer(address _to, uint256 _value) returns(bool success) +func (_ERC20Token *ERC20TokenTransactorSession) Transfer(_to common.Address, _value *big.Int) (*types.Transaction, error) { + return _ERC20Token.Contract.Transfer(&_ERC20Token.TransactOpts, _to, _value) +} + +// TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd. +// +// Solidity: function transferFrom(address _from, address _to, uint256 _value) returns(bool success) +func (_ERC20Token *ERC20TokenTransactor) TransferFrom(opts *bind.TransactOpts, _from common.Address, _to common.Address, _value *big.Int) (*types.Transaction, error) { + return _ERC20Token.contract.Transact(opts, "transferFrom", _from, _to, _value) +} + +// TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd. +// +// Solidity: function transferFrom(address _from, address _to, uint256 _value) returns(bool success) +func (_ERC20Token *ERC20TokenSession) TransferFrom(_from common.Address, _to common.Address, _value *big.Int) (*types.Transaction, error) { + return _ERC20Token.Contract.TransferFrom(&_ERC20Token.TransactOpts, _from, _to, _value) +} + +// TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd. +// +// Solidity: function transferFrom(address _from, address _to, uint256 _value) returns(bool success) +func (_ERC20Token *ERC20TokenTransactorSession) TransferFrom(_from common.Address, _to common.Address, _value *big.Int) (*types.Transaction, error) { + return _ERC20Token.Contract.TransferFrom(&_ERC20Token.TransactOpts, _from, _to, _value) +} + +// ERC20TokenApprovalIterator is returned from FilterApproval and is used to iterate over the raw logs and unpacked data for Approval events raised by the ERC20Token contract. +type ERC20TokenApprovalIterator struct { + Event *ERC20TokenApproval // 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 *ERC20TokenApprovalIterator) 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(ERC20TokenApproval) + 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(ERC20TokenApproval) + 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 *ERC20TokenApprovalIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ERC20TokenApprovalIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ERC20TokenApproval represents a Approval event raised by the ERC20Token contract. +type ERC20TokenApproval struct { + Owner common.Address + Spender common.Address + Value *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterApproval is a free log retrieval operation binding the contract event 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925. +// +// Solidity: event Approval(address indexed owner, address indexed spender, uint256 value) +func (_ERC20Token *ERC20TokenFilterer) FilterApproval(opts *bind.FilterOpts, owner []common.Address, spender []common.Address) (*ERC20TokenApprovalIterator, error) { + + var ownerRule []interface{} + for _, ownerItem := range owner { + ownerRule = append(ownerRule, ownerItem) + } + var spenderRule []interface{} + for _, spenderItem := range spender { + spenderRule = append(spenderRule, spenderItem) + } + + logs, sub, err := _ERC20Token.contract.FilterLogs(opts, "Approval", ownerRule, spenderRule) + if err != nil { + return nil, err + } + return &ERC20TokenApprovalIterator{contract: _ERC20Token.contract, event: "Approval", logs: logs, sub: sub}, nil +} + +// WatchApproval is a free log subscription operation binding the contract event 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925. +// +// Solidity: event Approval(address indexed owner, address indexed spender, uint256 value) +func (_ERC20Token *ERC20TokenFilterer) WatchApproval(opts *bind.WatchOpts, sink chan<- *ERC20TokenApproval, owner []common.Address, spender []common.Address) (event.Subscription, error) { + + var ownerRule []interface{} + for _, ownerItem := range owner { + ownerRule = append(ownerRule, ownerItem) + } + var spenderRule []interface{} + for _, spenderItem := range spender { + spenderRule = append(spenderRule, spenderItem) + } + + logs, sub, err := _ERC20Token.contract.WatchLogs(opts, "Approval", ownerRule, spenderRule) + 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(ERC20TokenApproval) + if err := _ERC20Token.contract.UnpackLog(event, "Approval", 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 +} + +// ParseApproval is a log parse operation binding the contract event 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925. +// +// Solidity: event Approval(address indexed owner, address indexed spender, uint256 value) +func (_ERC20Token *ERC20TokenFilterer) ParseApproval(log types.Log) (*ERC20TokenApproval, error) { + event := new(ERC20TokenApproval) + if err := _ERC20Token.contract.UnpackLog(event, "Approval", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ERC20TokenTransferIterator is returned from FilterTransfer and is used to iterate over the raw logs and unpacked data for Transfer events raised by the ERC20Token contract. +type ERC20TokenTransferIterator struct { + Event *ERC20TokenTransfer // 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 *ERC20TokenTransferIterator) 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(ERC20TokenTransfer) + 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(ERC20TokenTransfer) + 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 *ERC20TokenTransferIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ERC20TokenTransferIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ERC20TokenTransfer represents a Transfer event raised by the ERC20Token contract. +type ERC20TokenTransfer struct { + From common.Address + To common.Address + Value *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterTransfer is a free log retrieval operation binding the contract event 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef. +// +// Solidity: event Transfer(address indexed from, address indexed to, uint256 value) +func (_ERC20Token *ERC20TokenFilterer) FilterTransfer(opts *bind.FilterOpts, from []common.Address, to []common.Address) (*ERC20TokenTransferIterator, error) { + + var fromRule []interface{} + for _, fromItem := range from { + fromRule = append(fromRule, fromItem) + } + var toRule []interface{} + for _, toItem := range to { + toRule = append(toRule, toItem) + } + + logs, sub, err := _ERC20Token.contract.FilterLogs(opts, "Transfer", fromRule, toRule) + if err != nil { + return nil, err + } + return &ERC20TokenTransferIterator{contract: _ERC20Token.contract, event: "Transfer", logs: logs, sub: sub}, nil +} + +// WatchTransfer is a free log subscription operation binding the contract event 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef. +// +// Solidity: event Transfer(address indexed from, address indexed to, uint256 value) +func (_ERC20Token *ERC20TokenFilterer) WatchTransfer(opts *bind.WatchOpts, sink chan<- *ERC20TokenTransfer, from []common.Address, to []common.Address) (event.Subscription, error) { + + var fromRule []interface{} + for _, fromItem := range from { + fromRule = append(fromRule, fromItem) + } + var toRule []interface{} + for _, toItem := range to { + toRule = append(toRule, toItem) + } + + logs, sub, err := _ERC20Token.contract.WatchLogs(opts, "Transfer", fromRule, toRule) + 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(ERC20TokenTransfer) + if err := _ERC20Token.contract.UnpackLog(event, "Transfer", 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 +} + +// ParseTransfer is a log parse operation binding the contract event 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef. +// +// Solidity: event Transfer(address indexed from, address indexed to, uint256 value) +func (_ERC20Token *ERC20TokenFilterer) ParseTransfer(log types.Log) (*ERC20TokenTransfer, error) { + event := new(ERC20TokenTransfer) + if err := _ERC20Token.contract.UnpackLog(event, "Transfer", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ERC721ABI is the input ABI used to generate the binding from. +const ERC721ABI = "[{\"constant\":true,\"inputs\":[{\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"getApproved\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"to\",\"type\":\"address\"},{\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"from\",\"type\":\"address\"},{\"name\":\"to\",\"type\":\"address\"},{\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"from\",\"type\":\"address\"},{\"name\":\"to\",\"type\":\"address\"},{\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"safeTransferFrom\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"ownerOf\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"to\",\"type\":\"address\"},{\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"setApprovalForAll\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"from\",\"type\":\"address\"},{\"name\":\"to\",\"type\":\"address\"},{\"name\":\"tokenId\",\"type\":\"uint256\"},{\"name\":\"_data\",\"type\":\"bytes\"}],\"name\":\"safeTransferFrom\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"owner\",\"type\":\"address\"},{\"name\":\"operator\",\"type\":\"address\"}],\"name\":\"isApprovedForAll\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"to\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"approved\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"ApprovalForAll\",\"type\":\"event\"}]" + +// ERC721FuncSigs maps the 4-byte function signature to its string representation. +var ERC721FuncSigs = map[string]string{ + "095ea7b3": "approve(address,uint256)", + "70a08231": "balanceOf(address)", + "081812fc": "getApproved(uint256)", + "e985e9c5": "isApprovedForAll(address,address)", + "6352211e": "ownerOf(uint256)", + "42842e0e": "safeTransferFrom(address,address,uint256)", + "b88d4fde": "safeTransferFrom(address,address,uint256,bytes)", + "a22cb465": "setApprovalForAll(address,bool)", + "01ffc9a7": "supportsInterface(bytes4)", + "23b872dd": "transferFrom(address,address,uint256)", +} + +// ERC721Bin is the compiled bytecode used for deploying new contracts. +var ERC721Bin = "0x608060405234801561001057600080fd5b506100437f01ffc9a7000000000000000000000000000000000000000000000000000000006001600160e01b0361007a16565b6100757f80ac58cd000000000000000000000000000000000000000000000000000000006001600160e01b0361007a16565b610148565b7fffffffff00000000000000000000000000000000000000000000000000000000808216141561010b57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f4552433136353a20696e76616c696420696e7465726661636520696400000000604482015290519081900360640190fd5b7fffffffff00000000000000000000000000000000000000000000000000000000166000908152602081905260409020805460ff19166001179055565b610d23806101576000396000f3fe608060405234801561001057600080fd5b506004361061009e5760003560e01c80636352211e116100665780636352211e146101b157806370a08231146101ce578063a22cb46514610206578063b88d4fde14610234578063e985e9c5146102fa5761009e565b806301ffc9a7146100a3578063081812fc146100de578063095ea7b31461011757806323b872dd1461014557806342842e0e1461017b575b600080fd5b6100ca600480360360208110156100b957600080fd5b50356001600160e01b031916610328565b604080519115158252519081900360200190f35b6100fb600480360360208110156100f457600080fd5b5035610347565b604080516001600160a01b039092168252519081900360200190f35b6101436004803603604081101561012d57600080fd5b506001600160a01b0381351690602001356103a9565b005b6101436004803603606081101561015b57600080fd5b506001600160a01b038135811691602081013590911690604001356104ba565b6101436004803603606081101561019157600080fd5b506001600160a01b0381358116916020810135909116906040013561050f565b6100fb600480360360208110156101c757600080fd5b503561052a565b6101f4600480360360208110156101e457600080fd5b50356001600160a01b0316610584565b60408051918252519081900360200190f35b6101436004803603604081101561021c57600080fd5b506001600160a01b03813516906020013515156105ec565b6101436004803603608081101561024a57600080fd5b6001600160a01b0382358116926020810135909116916040820135919081019060808101606082013564010000000081111561028557600080fd5b82018360208201111561029757600080fd5b803590602001918460018302840111640100000000831117156102b957600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506106b8945050505050565b6100ca6004803603604081101561031057600080fd5b506001600160a01b0381358116916020013516610710565b6001600160e01b03191660009081526020819052604090205460ff1690565b60006103528261073e565b61038d5760405162461bcd60e51b815260040180806020018281038252602c815260200180610c48602c913960400191505060405180910390fd5b506000908152600260205260409020546001600160a01b031690565b60006103b48261052a565b9050806001600160a01b0316836001600160a01b031614156104075760405162461bcd60e51b8152600401808060200182810382526021815260200180610c9d6021913960400191505060405180910390fd5b336001600160a01b038216148061042357506104238133610710565b61045e5760405162461bcd60e51b8152600401808060200182810382526038815260200180610bbd6038913960400191505060405180910390fd5b60008281526002602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b6104c4338261075b565b6104ff5760405162461bcd60e51b8152600401808060200182810382526031815260200180610cbe6031913960400191505060405180910390fd5b61050a8383836107ff565b505050565b61050a838383604051806020016040528060008152506106b8565b6000818152600160205260408120546001600160a01b03168061057e5760405162461bcd60e51b8152600401808060200182810382526029815260200180610c1f6029913960400191505060405180910390fd5b92915050565b60006001600160a01b0382166105cb5760405162461bcd60e51b815260040180806020018281038252602a815260200180610bf5602a913960400191505060405180910390fd5b6001600160a01b038216600090815260036020526040902061057e90610943565b6001600160a01b03821633141561064a576040805162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c657200000000000000604482015290519081900360640190fd5b3360008181526004602090815260408083206001600160a01b03871680855290835292819020805460ff1916861515908117909155815190815290519293927f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31929181900390910190a35050565b6106c38484846104ba565b6106cf84848484610947565b61070a5760405162461bcd60e51b8152600401808060200182810382526032815260200180610b3b6032913960400191505060405180910390fd5b50505050565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205460ff1690565b6000908152600160205260409020546001600160a01b0316151590565b60006107668261073e565b6107a15760405162461bcd60e51b815260040180806020018281038252602c815260200180610b91602c913960400191505060405180910390fd5b60006107ac8361052a565b9050806001600160a01b0316846001600160a01b031614806107e75750836001600160a01b03166107dc84610347565b6001600160a01b0316145b806107f757506107f78185610710565b949350505050565b826001600160a01b03166108128261052a565b6001600160a01b0316146108575760405162461bcd60e51b8152600401808060200182810382526029815260200180610c746029913960400191505060405180910390fd5b6001600160a01b03821661089c5760405162461bcd60e51b8152600401808060200182810382526024815260200180610b6d6024913960400191505060405180910390fd5b6108a581610a7a565b6001600160a01b03831660009081526003602052604090206108c690610ab7565b6001600160a01b03821660009081526003602052604090206108e790610ace565b60008181526001602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b5490565b600061095b846001600160a01b0316610ad7565b610967575060016107f7565b604051630a85bd0160e11b815233600482018181526001600160a01b03888116602485015260448401879052608060648501908152865160848601528651600095928a169463150b7a029490938c938b938b939260a4019060208501908083838e5b838110156109e15781810151838201526020016109c9565b50505050905090810190601f168015610a0e5780820380516001836020036101000a031916815260200191505b5095505050505050602060405180830381600087803b158015610a3057600080fd5b505af1158015610a44573d6000803e3d6000fd5b505050506040513d6020811015610a5a57600080fd5b50516001600160e01b031916630a85bd0160e11b14915050949350505050565b6000818152600260205260409020546001600160a01b031615610ab457600081815260026020526040902080546001600160a01b03191690555b50565b8054610aca90600163ffffffff610add16565b9055565b80546001019055565b3b151590565b600082821115610b34576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b5090039056fe4552433732313a207472616e7366657220746f206e6f6e20455243373231526563656976657220696d706c656d656e7465724552433732313a207472616e7366657220746f20746865207a65726f20616464726573734552433732313a206f70657261746f7220717565727920666f72206e6f6e6578697374656e7420746f6b656e4552433732313a20617070726f76652063616c6c6572206973206e6f74206f776e6572206e6f7220617070726f76656420666f7220616c6c4552433732313a2062616c616e636520717565727920666f7220746865207a65726f20616464726573734552433732313a206f776e657220717565727920666f72206e6f6e6578697374656e7420746f6b656e4552433732313a20617070726f76656420717565727920666f72206e6f6e6578697374656e7420746f6b656e4552433732313a207472616e73666572206f6620746f6b656e2074686174206973206e6f74206f776e4552433732313a20617070726f76616c20746f2063757272656e74206f776e65724552433732313a207472616e736665722063616c6c6572206973206e6f74206f776e6572206e6f7220617070726f766564a265627a7a72305820a3ccfb1d8555fb9ba4c4373de30c4607c2a1f2ce6f3cc4608796563d0caedcf764736f6c634300050a0032" + +// DeployERC721 deploys a new Ethereum contract, binding an instance of ERC721 to it. +func DeployERC721(auth *bind.TransactOpts, backend bind.ContractBackend) (common.Address, *types.Transaction, *ERC721, error) { + parsed, err := abi.JSON(strings.NewReader(ERC721ABI)) + if err != nil { + return common.Address{}, nil, nil, err + } + + address, tx, contract, err := bind.DeployContract(auth, parsed, common.FromHex(ERC721Bin), backend) + if err != nil { + return common.Address{}, nil, nil, err + } + return address, tx, &ERC721{ERC721Caller: ERC721Caller{contract: contract}, ERC721Transactor: ERC721Transactor{contract: contract}, ERC721Filterer: ERC721Filterer{contract: contract}}, nil +} + +// ERC721 is an auto generated Go binding around an Ethereum contract. +type ERC721 struct { + ERC721Caller // Read-only binding to the contract + ERC721Transactor // Write-only binding to the contract + ERC721Filterer // Log filterer for contract events +} + +// ERC721Caller is an auto generated read-only Go binding around an Ethereum contract. +type ERC721Caller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// ERC721Transactor is an auto generated write-only Go binding around an Ethereum contract. +type ERC721Transactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// ERC721Filterer is an auto generated log filtering Go binding around an Ethereum contract events. +type ERC721Filterer struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// ERC721Session is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type ERC721Session struct { + Contract *ERC721 // 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 +} + +// ERC721CallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type ERC721CallerSession struct { + Contract *ERC721Caller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// ERC721TransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type ERC721TransactorSession struct { + Contract *ERC721Transactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// ERC721Raw is an auto generated low-level Go binding around an Ethereum contract. +type ERC721Raw struct { + Contract *ERC721 // Generic contract binding to access the raw methods on +} + +// ERC721CallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type ERC721CallerRaw struct { + Contract *ERC721Caller // Generic read-only contract binding to access the raw methods on +} + +// ERC721TransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type ERC721TransactorRaw struct { + Contract *ERC721Transactor // Generic write-only contract binding to access the raw methods on +} + +// NewERC721 creates a new instance of ERC721, bound to a specific deployed contract. +func NewERC721(address common.Address, backend bind.ContractBackend) (*ERC721, error) { + contract, err := bindERC721(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &ERC721{ERC721Caller: ERC721Caller{contract: contract}, ERC721Transactor: ERC721Transactor{contract: contract}, ERC721Filterer: ERC721Filterer{contract: contract}}, nil +} + +// NewERC721Caller creates a new read-only instance of ERC721, bound to a specific deployed contract. +func NewERC721Caller(address common.Address, caller bind.ContractCaller) (*ERC721Caller, error) { + contract, err := bindERC721(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &ERC721Caller{contract: contract}, nil +} + +// NewERC721Transactor creates a new write-only instance of ERC721, bound to a specific deployed contract. +func NewERC721Transactor(address common.Address, transactor bind.ContractTransactor) (*ERC721Transactor, error) { + contract, err := bindERC721(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &ERC721Transactor{contract: contract}, nil +} + +// NewERC721Filterer creates a new log filterer instance of ERC721, bound to a specific deployed contract. +func NewERC721Filterer(address common.Address, filterer bind.ContractFilterer) (*ERC721Filterer, error) { + contract, err := bindERC721(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &ERC721Filterer{contract: contract}, nil +} + +// bindERC721 binds a generic wrapper to an already deployed contract. +func bindERC721(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := abi.JSON(strings.NewReader(ERC721ABI)) + 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 (_ERC721 *ERC721Raw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _ERC721.Contract.ERC721Caller.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 (_ERC721 *ERC721Raw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _ERC721.Contract.ERC721Transactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_ERC721 *ERC721Raw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _ERC721.Contract.ERC721Transactor.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 (_ERC721 *ERC721CallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _ERC721.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 (_ERC721 *ERC721TransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _ERC721.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_ERC721 *ERC721TransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _ERC721.Contract.contract.Transact(opts, method, params...) +} + +// BalanceOf is a free data retrieval call binding the contract method 0x70a08231. +// +// Solidity: function balanceOf(address owner) view returns(uint256) +func (_ERC721 *ERC721Caller) BalanceOf(opts *bind.CallOpts, owner common.Address) (*big.Int, error) { + var out []interface{} + err := _ERC721.contract.Call(opts, &out, "balanceOf", owner) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// BalanceOf is a free data retrieval call binding the contract method 0x70a08231. +// +// Solidity: function balanceOf(address owner) view returns(uint256) +func (_ERC721 *ERC721Session) BalanceOf(owner common.Address) (*big.Int, error) { + return _ERC721.Contract.BalanceOf(&_ERC721.CallOpts, owner) +} + +// BalanceOf is a free data retrieval call binding the contract method 0x70a08231. +// +// Solidity: function balanceOf(address owner) view returns(uint256) +func (_ERC721 *ERC721CallerSession) BalanceOf(owner common.Address) (*big.Int, error) { + return _ERC721.Contract.BalanceOf(&_ERC721.CallOpts, owner) +} + +// GetApproved is a free data retrieval call binding the contract method 0x081812fc. +// +// Solidity: function getApproved(uint256 tokenId) view returns(address) +func (_ERC721 *ERC721Caller) GetApproved(opts *bind.CallOpts, tokenId *big.Int) (common.Address, error) { + var out []interface{} + err := _ERC721.contract.Call(opts, &out, "getApproved", tokenId) + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// GetApproved is a free data retrieval call binding the contract method 0x081812fc. +// +// Solidity: function getApproved(uint256 tokenId) view returns(address) +func (_ERC721 *ERC721Session) GetApproved(tokenId *big.Int) (common.Address, error) { + return _ERC721.Contract.GetApproved(&_ERC721.CallOpts, tokenId) +} + +// GetApproved is a free data retrieval call binding the contract method 0x081812fc. +// +// Solidity: function getApproved(uint256 tokenId) view returns(address) +func (_ERC721 *ERC721CallerSession) GetApproved(tokenId *big.Int) (common.Address, error) { + return _ERC721.Contract.GetApproved(&_ERC721.CallOpts, tokenId) +} + +// IsApprovedForAll is a free data retrieval call binding the contract method 0xe985e9c5. +// +// Solidity: function isApprovedForAll(address owner, address operator) view returns(bool) +func (_ERC721 *ERC721Caller) IsApprovedForAll(opts *bind.CallOpts, owner common.Address, operator common.Address) (bool, error) { + var out []interface{} + err := _ERC721.contract.Call(opts, &out, "isApprovedForAll", owner, operator) + + if err != nil { + return *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + + return out0, err + +} + +// IsApprovedForAll is a free data retrieval call binding the contract method 0xe985e9c5. +// +// Solidity: function isApprovedForAll(address owner, address operator) view returns(bool) +func (_ERC721 *ERC721Session) IsApprovedForAll(owner common.Address, operator common.Address) (bool, error) { + return _ERC721.Contract.IsApprovedForAll(&_ERC721.CallOpts, owner, operator) +} + +// IsApprovedForAll is a free data retrieval call binding the contract method 0xe985e9c5. +// +// Solidity: function isApprovedForAll(address owner, address operator) view returns(bool) +func (_ERC721 *ERC721CallerSession) IsApprovedForAll(owner common.Address, operator common.Address) (bool, error) { + return _ERC721.Contract.IsApprovedForAll(&_ERC721.CallOpts, owner, operator) +} + +// OwnerOf is a free data retrieval call binding the contract method 0x6352211e. +// +// Solidity: function ownerOf(uint256 tokenId) view returns(address) +func (_ERC721 *ERC721Caller) OwnerOf(opts *bind.CallOpts, tokenId *big.Int) (common.Address, error) { + var out []interface{} + err := _ERC721.contract.Call(opts, &out, "ownerOf", tokenId) + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// OwnerOf is a free data retrieval call binding the contract method 0x6352211e. +// +// Solidity: function ownerOf(uint256 tokenId) view returns(address) +func (_ERC721 *ERC721Session) OwnerOf(tokenId *big.Int) (common.Address, error) { + return _ERC721.Contract.OwnerOf(&_ERC721.CallOpts, tokenId) +} + +// OwnerOf is a free data retrieval call binding the contract method 0x6352211e. +// +// Solidity: function ownerOf(uint256 tokenId) view returns(address) +func (_ERC721 *ERC721CallerSession) OwnerOf(tokenId *big.Int) (common.Address, error) { + return _ERC721.Contract.OwnerOf(&_ERC721.CallOpts, tokenId) +} + +// SupportsInterface is a free data retrieval call binding the contract method 0x01ffc9a7. +// +// Solidity: function supportsInterface(bytes4 interfaceId) view returns(bool) +func (_ERC721 *ERC721Caller) SupportsInterface(opts *bind.CallOpts, interfaceId [4]byte) (bool, error) { + var out []interface{} + err := _ERC721.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 (_ERC721 *ERC721Session) SupportsInterface(interfaceId [4]byte) (bool, error) { + return _ERC721.Contract.SupportsInterface(&_ERC721.CallOpts, interfaceId) +} + +// SupportsInterface is a free data retrieval call binding the contract method 0x01ffc9a7. +// +// Solidity: function supportsInterface(bytes4 interfaceId) view returns(bool) +func (_ERC721 *ERC721CallerSession) SupportsInterface(interfaceId [4]byte) (bool, error) { + return _ERC721.Contract.SupportsInterface(&_ERC721.CallOpts, interfaceId) +} + +// Approve is a paid mutator transaction binding the contract method 0x095ea7b3. +// +// Solidity: function approve(address to, uint256 tokenId) returns() +func (_ERC721 *ERC721Transactor) Approve(opts *bind.TransactOpts, to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _ERC721.contract.Transact(opts, "approve", to, tokenId) +} + +// Approve is a paid mutator transaction binding the contract method 0x095ea7b3. +// +// Solidity: function approve(address to, uint256 tokenId) returns() +func (_ERC721 *ERC721Session) Approve(to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _ERC721.Contract.Approve(&_ERC721.TransactOpts, to, tokenId) +} + +// Approve is a paid mutator transaction binding the contract method 0x095ea7b3. +// +// Solidity: function approve(address to, uint256 tokenId) returns() +func (_ERC721 *ERC721TransactorSession) Approve(to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _ERC721.Contract.Approve(&_ERC721.TransactOpts, to, tokenId) +} + +// SafeTransferFrom is a paid mutator transaction binding the contract method 0x42842e0e. +// +// Solidity: function safeTransferFrom(address from, address to, uint256 tokenId) returns() +func (_ERC721 *ERC721Transactor) SafeTransferFrom(opts *bind.TransactOpts, from common.Address, to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _ERC721.contract.Transact(opts, "safeTransferFrom", from, to, tokenId) +} + +// SafeTransferFrom is a paid mutator transaction binding the contract method 0x42842e0e. +// +// Solidity: function safeTransferFrom(address from, address to, uint256 tokenId) returns() +func (_ERC721 *ERC721Session) SafeTransferFrom(from common.Address, to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _ERC721.Contract.SafeTransferFrom(&_ERC721.TransactOpts, from, to, tokenId) +} + +// SafeTransferFrom is a paid mutator transaction binding the contract method 0x42842e0e. +// +// Solidity: function safeTransferFrom(address from, address to, uint256 tokenId) returns() +func (_ERC721 *ERC721TransactorSession) SafeTransferFrom(from common.Address, to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _ERC721.Contract.SafeTransferFrom(&_ERC721.TransactOpts, from, to, tokenId) +} + +// SafeTransferFrom0 is a paid mutator transaction binding the contract method 0xb88d4fde. +// +// Solidity: function safeTransferFrom(address from, address to, uint256 tokenId, bytes _data) returns() +func (_ERC721 *ERC721Transactor) SafeTransferFrom0(opts *bind.TransactOpts, from common.Address, to common.Address, tokenId *big.Int, _data []byte) (*types.Transaction, error) { + return _ERC721.contract.Transact(opts, "safeTransferFrom0", from, to, tokenId, _data) +} + +// SafeTransferFrom0 is a paid mutator transaction binding the contract method 0xb88d4fde. +// +// Solidity: function safeTransferFrom(address from, address to, uint256 tokenId, bytes _data) returns() +func (_ERC721 *ERC721Session) SafeTransferFrom0(from common.Address, to common.Address, tokenId *big.Int, _data []byte) (*types.Transaction, error) { + return _ERC721.Contract.SafeTransferFrom0(&_ERC721.TransactOpts, from, to, tokenId, _data) +} + +// SafeTransferFrom0 is a paid mutator transaction binding the contract method 0xb88d4fde. +// +// Solidity: function safeTransferFrom(address from, address to, uint256 tokenId, bytes _data) returns() +func (_ERC721 *ERC721TransactorSession) SafeTransferFrom0(from common.Address, to common.Address, tokenId *big.Int, _data []byte) (*types.Transaction, error) { + return _ERC721.Contract.SafeTransferFrom0(&_ERC721.TransactOpts, from, to, tokenId, _data) +} + +// SetApprovalForAll is a paid mutator transaction binding the contract method 0xa22cb465. +// +// Solidity: function setApprovalForAll(address to, bool approved) returns() +func (_ERC721 *ERC721Transactor) SetApprovalForAll(opts *bind.TransactOpts, to common.Address, approved bool) (*types.Transaction, error) { + return _ERC721.contract.Transact(opts, "setApprovalForAll", to, approved) +} + +// SetApprovalForAll is a paid mutator transaction binding the contract method 0xa22cb465. +// +// Solidity: function setApprovalForAll(address to, bool approved) returns() +func (_ERC721 *ERC721Session) SetApprovalForAll(to common.Address, approved bool) (*types.Transaction, error) { + return _ERC721.Contract.SetApprovalForAll(&_ERC721.TransactOpts, to, approved) +} + +// SetApprovalForAll is a paid mutator transaction binding the contract method 0xa22cb465. +// +// Solidity: function setApprovalForAll(address to, bool approved) returns() +func (_ERC721 *ERC721TransactorSession) SetApprovalForAll(to common.Address, approved bool) (*types.Transaction, error) { + return _ERC721.Contract.SetApprovalForAll(&_ERC721.TransactOpts, to, approved) +} + +// TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd. +// +// Solidity: function transferFrom(address from, address to, uint256 tokenId) returns() +func (_ERC721 *ERC721Transactor) TransferFrom(opts *bind.TransactOpts, from common.Address, to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _ERC721.contract.Transact(opts, "transferFrom", from, to, tokenId) +} + +// TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd. +// +// Solidity: function transferFrom(address from, address to, uint256 tokenId) returns() +func (_ERC721 *ERC721Session) TransferFrom(from common.Address, to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _ERC721.Contract.TransferFrom(&_ERC721.TransactOpts, from, to, tokenId) +} + +// TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd. +// +// Solidity: function transferFrom(address from, address to, uint256 tokenId) returns() +func (_ERC721 *ERC721TransactorSession) TransferFrom(from common.Address, to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _ERC721.Contract.TransferFrom(&_ERC721.TransactOpts, from, to, tokenId) +} + +// ERC721ApprovalIterator is returned from FilterApproval and is used to iterate over the raw logs and unpacked data for Approval events raised by the ERC721 contract. +type ERC721ApprovalIterator struct { + Event *ERC721Approval // 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 *ERC721ApprovalIterator) 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(ERC721Approval) + 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(ERC721Approval) + 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 *ERC721ApprovalIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ERC721ApprovalIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ERC721Approval represents a Approval event raised by the ERC721 contract. +type ERC721Approval struct { + Owner common.Address + Approved common.Address + TokenId *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterApproval is a free log retrieval operation binding the contract event 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925. +// +// Solidity: event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId) +func (_ERC721 *ERC721Filterer) FilterApproval(opts *bind.FilterOpts, owner []common.Address, approved []common.Address, tokenId []*big.Int) (*ERC721ApprovalIterator, error) { + + var ownerRule []interface{} + for _, ownerItem := range owner { + ownerRule = append(ownerRule, ownerItem) + } + var approvedRule []interface{} + for _, approvedItem := range approved { + approvedRule = append(approvedRule, approvedItem) + } + var tokenIdRule []interface{} + for _, tokenIdItem := range tokenId { + tokenIdRule = append(tokenIdRule, tokenIdItem) + } + + logs, sub, err := _ERC721.contract.FilterLogs(opts, "Approval", ownerRule, approvedRule, tokenIdRule) + if err != nil { + return nil, err + } + return &ERC721ApprovalIterator{contract: _ERC721.contract, event: "Approval", logs: logs, sub: sub}, nil +} + +// WatchApproval is a free log subscription operation binding the contract event 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925. +// +// Solidity: event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId) +func (_ERC721 *ERC721Filterer) WatchApproval(opts *bind.WatchOpts, sink chan<- *ERC721Approval, owner []common.Address, approved []common.Address, tokenId []*big.Int) (event.Subscription, error) { + + var ownerRule []interface{} + for _, ownerItem := range owner { + ownerRule = append(ownerRule, ownerItem) + } + var approvedRule []interface{} + for _, approvedItem := range approved { + approvedRule = append(approvedRule, approvedItem) + } + var tokenIdRule []interface{} + for _, tokenIdItem := range tokenId { + tokenIdRule = append(tokenIdRule, tokenIdItem) + } + + logs, sub, err := _ERC721.contract.WatchLogs(opts, "Approval", ownerRule, approvedRule, tokenIdRule) + 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(ERC721Approval) + if err := _ERC721.contract.UnpackLog(event, "Approval", 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 +} + +// ParseApproval is a log parse operation binding the contract event 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925. +// +// Solidity: event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId) +func (_ERC721 *ERC721Filterer) ParseApproval(log types.Log) (*ERC721Approval, error) { + event := new(ERC721Approval) + if err := _ERC721.contract.UnpackLog(event, "Approval", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ERC721ApprovalForAllIterator is returned from FilterApprovalForAll and is used to iterate over the raw logs and unpacked data for ApprovalForAll events raised by the ERC721 contract. +type ERC721ApprovalForAllIterator struct { + Event *ERC721ApprovalForAll // 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 *ERC721ApprovalForAllIterator) 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(ERC721ApprovalForAll) + 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(ERC721ApprovalForAll) + 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 *ERC721ApprovalForAllIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ERC721ApprovalForAllIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ERC721ApprovalForAll represents a ApprovalForAll event raised by the ERC721 contract. +type ERC721ApprovalForAll struct { + Owner common.Address + Operator common.Address + Approved bool + Raw types.Log // Blockchain specific contextual infos +} + +// FilterApprovalForAll is a free log retrieval operation binding the contract event 0x17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31. +// +// Solidity: event ApprovalForAll(address indexed owner, address indexed operator, bool approved) +func (_ERC721 *ERC721Filterer) FilterApprovalForAll(opts *bind.FilterOpts, owner []common.Address, operator []common.Address) (*ERC721ApprovalForAllIterator, error) { + + var ownerRule []interface{} + for _, ownerItem := range owner { + ownerRule = append(ownerRule, ownerItem) + } + var operatorRule []interface{} + for _, operatorItem := range operator { + operatorRule = append(operatorRule, operatorItem) + } + + logs, sub, err := _ERC721.contract.FilterLogs(opts, "ApprovalForAll", ownerRule, operatorRule) + if err != nil { + return nil, err + } + return &ERC721ApprovalForAllIterator{contract: _ERC721.contract, event: "ApprovalForAll", logs: logs, sub: sub}, nil +} + +// WatchApprovalForAll is a free log subscription operation binding the contract event 0x17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31. +// +// Solidity: event ApprovalForAll(address indexed owner, address indexed operator, bool approved) +func (_ERC721 *ERC721Filterer) WatchApprovalForAll(opts *bind.WatchOpts, sink chan<- *ERC721ApprovalForAll, owner []common.Address, operator []common.Address) (event.Subscription, error) { + + var ownerRule []interface{} + for _, ownerItem := range owner { + ownerRule = append(ownerRule, ownerItem) + } + var operatorRule []interface{} + for _, operatorItem := range operator { + operatorRule = append(operatorRule, operatorItem) + } + + logs, sub, err := _ERC721.contract.WatchLogs(opts, "ApprovalForAll", ownerRule, operatorRule) + 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(ERC721ApprovalForAll) + if err := _ERC721.contract.UnpackLog(event, "ApprovalForAll", 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 +} + +// ParseApprovalForAll is a log parse operation binding the contract event 0x17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31. +// +// Solidity: event ApprovalForAll(address indexed owner, address indexed operator, bool approved) +func (_ERC721 *ERC721Filterer) ParseApprovalForAll(log types.Log) (*ERC721ApprovalForAll, error) { + event := new(ERC721ApprovalForAll) + if err := _ERC721.contract.UnpackLog(event, "ApprovalForAll", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ERC721TransferIterator is returned from FilterTransfer and is used to iterate over the raw logs and unpacked data for Transfer events raised by the ERC721 contract. +type ERC721TransferIterator struct { + Event *ERC721Transfer // 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 *ERC721TransferIterator) 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(ERC721Transfer) + 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(ERC721Transfer) + 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 *ERC721TransferIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ERC721TransferIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ERC721Transfer represents a Transfer event raised by the ERC721 contract. +type ERC721Transfer struct { + From common.Address + To common.Address + TokenId *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterTransfer is a free log retrieval operation binding the contract event 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef. +// +// Solidity: event Transfer(address indexed from, address indexed to, uint256 indexed tokenId) +func (_ERC721 *ERC721Filterer) FilterTransfer(opts *bind.FilterOpts, from []common.Address, to []common.Address, tokenId []*big.Int) (*ERC721TransferIterator, error) { + + var fromRule []interface{} + for _, fromItem := range from { + fromRule = append(fromRule, fromItem) + } + var toRule []interface{} + for _, toItem := range to { + toRule = append(toRule, toItem) + } + var tokenIdRule []interface{} + for _, tokenIdItem := range tokenId { + tokenIdRule = append(tokenIdRule, tokenIdItem) + } + + logs, sub, err := _ERC721.contract.FilterLogs(opts, "Transfer", fromRule, toRule, tokenIdRule) + if err != nil { + return nil, err + } + return &ERC721TransferIterator{contract: _ERC721.contract, event: "Transfer", logs: logs, sub: sub}, nil +} + +// WatchTransfer is a free log subscription operation binding the contract event 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef. +// +// Solidity: event Transfer(address indexed from, address indexed to, uint256 indexed tokenId) +func (_ERC721 *ERC721Filterer) WatchTransfer(opts *bind.WatchOpts, sink chan<- *ERC721Transfer, from []common.Address, to []common.Address, tokenId []*big.Int) (event.Subscription, error) { + + var fromRule []interface{} + for _, fromItem := range from { + fromRule = append(fromRule, fromItem) + } + var toRule []interface{} + for _, toItem := range to { + toRule = append(toRule, toItem) + } + var tokenIdRule []interface{} + for _, tokenIdItem := range tokenId { + tokenIdRule = append(tokenIdRule, tokenIdItem) + } + + logs, sub, err := _ERC721.contract.WatchLogs(opts, "Transfer", fromRule, toRule, tokenIdRule) + 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(ERC721Transfer) + if err := _ERC721.contract.UnpackLog(event, "Transfer", 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 +} + +// ParseTransfer is a log parse operation binding the contract event 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef. +// +// Solidity: event Transfer(address indexed from, address indexed to, uint256 indexed tokenId) +func (_ERC721 *ERC721Filterer) ParseTransfer(log types.Log) (*ERC721Transfer, error) { + event := new(ERC721Transfer) + if err := _ERC721.contract.UnpackLog(event, "Transfer", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ERC721EnumerableABI is the input ABI used to generate the binding from. +const ERC721EnumerableABI = "[{\"constant\":true,\"inputs\":[{\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"getApproved\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"to\",\"type\":\"address\"},{\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"from\",\"type\":\"address\"},{\"name\":\"to\",\"type\":\"address\"},{\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"owner\",\"type\":\"address\"},{\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"tokenOfOwnerByIndex\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"from\",\"type\":\"address\"},{\"name\":\"to\",\"type\":\"address\"},{\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"safeTransferFrom\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"tokenByIndex\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"ownerOf\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"to\",\"type\":\"address\"},{\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"setApprovalForAll\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"from\",\"type\":\"address\"},{\"name\":\"to\",\"type\":\"address\"},{\"name\":\"tokenId\",\"type\":\"uint256\"},{\"name\":\"_data\",\"type\":\"bytes\"}],\"name\":\"safeTransferFrom\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"owner\",\"type\":\"address\"},{\"name\":\"operator\",\"type\":\"address\"}],\"name\":\"isApprovedForAll\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"to\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"approved\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"ApprovalForAll\",\"type\":\"event\"}]" + +// ERC721EnumerableFuncSigs maps the 4-byte function signature to its string representation. +var ERC721EnumerableFuncSigs = map[string]string{ + "095ea7b3": "approve(address,uint256)", + "70a08231": "balanceOf(address)", + "081812fc": "getApproved(uint256)", + "e985e9c5": "isApprovedForAll(address,address)", + "6352211e": "ownerOf(uint256)", + "42842e0e": "safeTransferFrom(address,address,uint256)", + "b88d4fde": "safeTransferFrom(address,address,uint256,bytes)", + "a22cb465": "setApprovalForAll(address,bool)", + "01ffc9a7": "supportsInterface(bytes4)", + "4f6ccce7": "tokenByIndex(uint256)", + "2f745c59": "tokenOfOwnerByIndex(address,uint256)", + "18160ddd": "totalSupply()", + "23b872dd": "transferFrom(address,address,uint256)", +} + +// ERC721EnumerableBin is the compiled bytecode used for deploying new contracts. +var ERC721EnumerableBin = "0x608060405234801561001057600080fd5b506100437f01ffc9a7000000000000000000000000000000000000000000000000000000006001600160e01b036100ac16565b6100757f80ac58cd000000000000000000000000000000000000000000000000000000006001600160e01b036100ac16565b6100a77f780e9d63000000000000000000000000000000000000000000000000000000006001600160e01b036100ac16565b61017a565b7fffffffff00000000000000000000000000000000000000000000000000000000808216141561013d57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f4552433136353a20696e76616c696420696e7465726661636520696400000000604482015290519081900360640190fd5b7fffffffff00000000000000000000000000000000000000000000000000000000166000908152602081905260409020805460ff19166001179055565b611077806101896000396000f3fe608060405234801561001057600080fd5b50600436106100cf5760003560e01c806342842e0e1161008c57806370a082311161006657806370a0823114610262578063a22cb46514610288578063b88d4fde146102b6578063e985e9c51461037c576100cf565b806342842e0e146101f25780634f6ccce7146102285780636352211e14610245576100cf565b806301ffc9a7146100d4578063081812fc1461010f578063095ea7b31461014857806318160ddd1461017657806323b872dd146101905780632f745c59146101c6575b600080fd5b6100fb600480360360208110156100ea57600080fd5b50356001600160e01b0319166103aa565b604080519115158252519081900360200190f35b61012c6004803603602081101561012557600080fd5b50356103c9565b604080516001600160a01b039092168252519081900360200190f35b6101746004803603604081101561015e57600080fd5b506001600160a01b03813516906020013561042b565b005b61017e61053c565b60408051918252519081900360200190f35b610174600480360360608110156101a657600080fd5b506001600160a01b03813581169160208101359091169060400135610543565b61017e600480360360408110156101dc57600080fd5b506001600160a01b038135169060200135610598565b6101746004803603606081101561020857600080fd5b506001600160a01b03813581169160208101359091169060400135610617565b61017e6004803603602081101561023e57600080fd5b5035610632565b61012c6004803603602081101561025b57600080fd5b5035610698565b61017e6004803603602081101561027857600080fd5b50356001600160a01b03166106f2565b6101746004803603604081101561029e57600080fd5b506001600160a01b038135169060200135151561075a565b610174600480360360808110156102cc57600080fd5b6001600160a01b0382358116926020810135909116916040820135919081019060808101606082013564010000000081111561030757600080fd5b82018360208201111561031957600080fd5b8035906020019184600183028401116401000000008311171561033b57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610826945050505050565b6100fb6004803603604081101561039257600080fd5b506001600160a01b038135811691602001351661087e565b6001600160e01b03191660009081526020819052604090205460ff1690565b60006103d4826108ac565b61040f5760405162461bcd60e51b815260040180806020018281038252602c815260200180610f70602c913960400191505060405180910390fd5b506000908152600260205260409020546001600160a01b031690565b600061043682610698565b9050806001600160a01b0316836001600160a01b031614156104895760405162461bcd60e51b8152600401808060200182810382526021815260200180610fc56021913960400191505060405180910390fd5b336001600160a01b03821614806104a557506104a5813361087e565b6104e05760405162461bcd60e51b8152600401808060200182810382526038815260200180610ee56038913960400191505060405180910390fd5b60008281526002602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b6007545b90565b61054d33826108c9565b6105885760405162461bcd60e51b8152600401808060200182810382526031815260200180610fe66031913960400191505060405180910390fd5b61059383838361096d565b505050565b60006105a3836106f2565b82106105e05760405162461bcd60e51b815260040180806020018281038252602b815260200180610e38602b913960400191505060405180910390fd5b6001600160a01b038316600090815260056020526040902080548390811061060457fe5b9060005260206000200154905092915050565b61059383838360405180602001604052806000815250610826565b600061063c61053c565b82106106795760405162461bcd60e51b815260040180806020018281038252602c815260200180611017602c913960400191505060405180910390fd5b6007828154811061068657fe5b90600052602060002001549050919050565b6000818152600160205260408120546001600160a01b0316806106ec5760405162461bcd60e51b8152600401808060200182810382526029815260200180610f476029913960400191505060405180910390fd5b92915050565b60006001600160a01b0382166107395760405162461bcd60e51b815260040180806020018281038252602a815260200180610f1d602a913960400191505060405180910390fd5b6001600160a01b03821660009081526003602052604090206106ec9061098c565b6001600160a01b0382163314156107b8576040805162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c657200000000000000604482015290519081900360640190fd5b3360008181526004602090815260408083206001600160a01b03871680855290835292819020805460ff1916861515908117909155815190815290519293927f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31929181900390910190a35050565b610831848484610543565b61083d84848484610990565b6108785760405162461bcd60e51b8152600401808060200182810382526032815260200180610e636032913960400191505060405180910390fd5b50505050565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205460ff1690565b6000908152600160205260409020546001600160a01b0316151590565b60006108d4826108ac565b61090f5760405162461bcd60e51b815260040180806020018281038252602c815260200180610eb9602c913960400191505060405180910390fd5b600061091a83610698565b9050806001600160a01b0316846001600160a01b031614806109555750836001600160a01b031661094a846103c9565b6001600160a01b0316145b806109655750610965818561087e565b949350505050565b610978838383610ac3565b6109828382610c07565b6105938282610cfc565b5490565b60006109a4846001600160a01b0316610d3a565b6109b057506001610965565b604051630a85bd0160e11b815233600482018181526001600160a01b03888116602485015260448401879052608060648501908152865160848601528651600095928a169463150b7a029490938c938b938b939260a4019060208501908083838e5b83811015610a2a578181015183820152602001610a12565b50505050905090810190601f168015610a575780820380516001836020036101000a031916815260200191505b5095505050505050602060405180830381600087803b158015610a7957600080fd5b505af1158015610a8d573d6000803e3d6000fd5b505050506040513d6020811015610aa357600080fd5b50516001600160e01b031916630a85bd0160e11b14915050949350505050565b826001600160a01b0316610ad682610698565b6001600160a01b031614610b1b5760405162461bcd60e51b8152600401808060200182810382526029815260200180610f9c6029913960400191505060405180910390fd5b6001600160a01b038216610b605760405162461bcd60e51b8152600401808060200182810382526024815260200180610e956024913960400191505060405180910390fd5b610b6981610d40565b6001600160a01b0383166000908152600360205260409020610b8a90610d7d565b6001600160a01b0382166000908152600360205260409020610bab90610d94565b60008181526001602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b6001600160a01b038216600090815260056020526040812054610c3190600163ffffffff610d9d16565b600083815260066020526040902054909150808214610ccc576001600160a01b0384166000908152600560205260408120805484908110610c6e57fe5b906000526020600020015490508060056000876001600160a01b03166001600160a01b031681526020019081526020016000208381548110610cac57fe5b600091825260208083209091019290925591825260069052604090208190555b6001600160a01b0384166000908152600560205260409020805490610cf5906000198301610dfa565b5050505050565b6001600160a01b0390911660009081526005602081815260408084208054868652600684529185208290559282526001810183559183529091200155565b3b151590565b6000818152600260205260409020546001600160a01b031615610d7a57600081815260026020526040902080546001600160a01b03191690555b50565b8054610d9090600163ffffffff610d9d16565b9055565b80546001019055565b600082821115610df4576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b8154818355818111156105935760008381526020902061059391810190830161054091905b80821115610e335760008155600101610e1f565b509056fe455243373231456e756d657261626c653a206f776e657220696e646578206f7574206f6620626f756e64734552433732313a207472616e7366657220746f206e6f6e20455243373231526563656976657220696d706c656d656e7465724552433732313a207472616e7366657220746f20746865207a65726f20616464726573734552433732313a206f70657261746f7220717565727920666f72206e6f6e6578697374656e7420746f6b656e4552433732313a20617070726f76652063616c6c6572206973206e6f74206f776e6572206e6f7220617070726f76656420666f7220616c6c4552433732313a2062616c616e636520717565727920666f7220746865207a65726f20616464726573734552433732313a206f776e657220717565727920666f72206e6f6e6578697374656e7420746f6b656e4552433732313a20617070726f76656420717565727920666f72206e6f6e6578697374656e7420746f6b656e4552433732313a207472616e73666572206f6620746f6b656e2074686174206973206e6f74206f776e4552433732313a20617070726f76616c20746f2063757272656e74206f776e65724552433732313a207472616e736665722063616c6c6572206973206e6f74206f776e6572206e6f7220617070726f766564455243373231456e756d657261626c653a20676c6f62616c20696e646578206f7574206f6620626f756e6473a265627a7a72305820d36600a2a84ae264e8b4970e2833b107065e0164dcb1a253f6ddf7d613ed915064736f6c634300050a0032" + +// DeployERC721Enumerable deploys a new Ethereum contract, binding an instance of ERC721Enumerable to it. +func DeployERC721Enumerable(auth *bind.TransactOpts, backend bind.ContractBackend) (common.Address, *types.Transaction, *ERC721Enumerable, error) { + parsed, err := abi.JSON(strings.NewReader(ERC721EnumerableABI)) + if err != nil { + return common.Address{}, nil, nil, err + } + + address, tx, contract, err := bind.DeployContract(auth, parsed, common.FromHex(ERC721EnumerableBin), backend) + if err != nil { + return common.Address{}, nil, nil, err + } + return address, tx, &ERC721Enumerable{ERC721EnumerableCaller: ERC721EnumerableCaller{contract: contract}, ERC721EnumerableTransactor: ERC721EnumerableTransactor{contract: contract}, ERC721EnumerableFilterer: ERC721EnumerableFilterer{contract: contract}}, nil +} + +// ERC721Enumerable is an auto generated Go binding around an Ethereum contract. +type ERC721Enumerable struct { + ERC721EnumerableCaller // Read-only binding to the contract + ERC721EnumerableTransactor // Write-only binding to the contract + ERC721EnumerableFilterer // Log filterer for contract events +} + +// ERC721EnumerableCaller is an auto generated read-only Go binding around an Ethereum contract. +type ERC721EnumerableCaller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// ERC721EnumerableTransactor is an auto generated write-only Go binding around an Ethereum contract. +type ERC721EnumerableTransactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// ERC721EnumerableFilterer is an auto generated log filtering Go binding around an Ethereum contract events. +type ERC721EnumerableFilterer struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// ERC721EnumerableSession is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type ERC721EnumerableSession struct { + Contract *ERC721Enumerable // 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 +} + +// ERC721EnumerableCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type ERC721EnumerableCallerSession struct { + Contract *ERC721EnumerableCaller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// ERC721EnumerableTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type ERC721EnumerableTransactorSession struct { + Contract *ERC721EnumerableTransactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// ERC721EnumerableRaw is an auto generated low-level Go binding around an Ethereum contract. +type ERC721EnumerableRaw struct { + Contract *ERC721Enumerable // Generic contract binding to access the raw methods on +} + +// ERC721EnumerableCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type ERC721EnumerableCallerRaw struct { + Contract *ERC721EnumerableCaller // Generic read-only contract binding to access the raw methods on +} + +// ERC721EnumerableTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type ERC721EnumerableTransactorRaw struct { + Contract *ERC721EnumerableTransactor // Generic write-only contract binding to access the raw methods on +} + +// NewERC721Enumerable creates a new instance of ERC721Enumerable, bound to a specific deployed contract. +func NewERC721Enumerable(address common.Address, backend bind.ContractBackend) (*ERC721Enumerable, error) { + contract, err := bindERC721Enumerable(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &ERC721Enumerable{ERC721EnumerableCaller: ERC721EnumerableCaller{contract: contract}, ERC721EnumerableTransactor: ERC721EnumerableTransactor{contract: contract}, ERC721EnumerableFilterer: ERC721EnumerableFilterer{contract: contract}}, nil +} + +// NewERC721EnumerableCaller creates a new read-only instance of ERC721Enumerable, bound to a specific deployed contract. +func NewERC721EnumerableCaller(address common.Address, caller bind.ContractCaller) (*ERC721EnumerableCaller, error) { + contract, err := bindERC721Enumerable(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &ERC721EnumerableCaller{contract: contract}, nil +} + +// NewERC721EnumerableTransactor creates a new write-only instance of ERC721Enumerable, bound to a specific deployed contract. +func NewERC721EnumerableTransactor(address common.Address, transactor bind.ContractTransactor) (*ERC721EnumerableTransactor, error) { + contract, err := bindERC721Enumerable(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &ERC721EnumerableTransactor{contract: contract}, nil +} + +// NewERC721EnumerableFilterer creates a new log filterer instance of ERC721Enumerable, bound to a specific deployed contract. +func NewERC721EnumerableFilterer(address common.Address, filterer bind.ContractFilterer) (*ERC721EnumerableFilterer, error) { + contract, err := bindERC721Enumerable(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &ERC721EnumerableFilterer{contract: contract}, nil +} + +// bindERC721Enumerable binds a generic wrapper to an already deployed contract. +func bindERC721Enumerable(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := abi.JSON(strings.NewReader(ERC721EnumerableABI)) + 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 (_ERC721Enumerable *ERC721EnumerableRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _ERC721Enumerable.Contract.ERC721EnumerableCaller.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 (_ERC721Enumerable *ERC721EnumerableRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _ERC721Enumerable.Contract.ERC721EnumerableTransactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_ERC721Enumerable *ERC721EnumerableRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _ERC721Enumerable.Contract.ERC721EnumerableTransactor.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 (_ERC721Enumerable *ERC721EnumerableCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _ERC721Enumerable.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 (_ERC721Enumerable *ERC721EnumerableTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _ERC721Enumerable.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_ERC721Enumerable *ERC721EnumerableTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _ERC721Enumerable.Contract.contract.Transact(opts, method, params...) +} + +// BalanceOf is a free data retrieval call binding the contract method 0x70a08231. +// +// Solidity: function balanceOf(address owner) view returns(uint256) +func (_ERC721Enumerable *ERC721EnumerableCaller) BalanceOf(opts *bind.CallOpts, owner common.Address) (*big.Int, error) { + var out []interface{} + err := _ERC721Enumerable.contract.Call(opts, &out, "balanceOf", owner) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// BalanceOf is a free data retrieval call binding the contract method 0x70a08231. +// +// Solidity: function balanceOf(address owner) view returns(uint256) +func (_ERC721Enumerable *ERC721EnumerableSession) BalanceOf(owner common.Address) (*big.Int, error) { + return _ERC721Enumerable.Contract.BalanceOf(&_ERC721Enumerable.CallOpts, owner) +} + +// BalanceOf is a free data retrieval call binding the contract method 0x70a08231. +// +// Solidity: function balanceOf(address owner) view returns(uint256) +func (_ERC721Enumerable *ERC721EnumerableCallerSession) BalanceOf(owner common.Address) (*big.Int, error) { + return _ERC721Enumerable.Contract.BalanceOf(&_ERC721Enumerable.CallOpts, owner) +} + +// GetApproved is a free data retrieval call binding the contract method 0x081812fc. +// +// Solidity: function getApproved(uint256 tokenId) view returns(address) +func (_ERC721Enumerable *ERC721EnumerableCaller) GetApproved(opts *bind.CallOpts, tokenId *big.Int) (common.Address, error) { + var out []interface{} + err := _ERC721Enumerable.contract.Call(opts, &out, "getApproved", tokenId) + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// GetApproved is a free data retrieval call binding the contract method 0x081812fc. +// +// Solidity: function getApproved(uint256 tokenId) view returns(address) +func (_ERC721Enumerable *ERC721EnumerableSession) GetApproved(tokenId *big.Int) (common.Address, error) { + return _ERC721Enumerable.Contract.GetApproved(&_ERC721Enumerable.CallOpts, tokenId) +} + +// GetApproved is a free data retrieval call binding the contract method 0x081812fc. +// +// Solidity: function getApproved(uint256 tokenId) view returns(address) +func (_ERC721Enumerable *ERC721EnumerableCallerSession) GetApproved(tokenId *big.Int) (common.Address, error) { + return _ERC721Enumerable.Contract.GetApproved(&_ERC721Enumerable.CallOpts, tokenId) +} + +// IsApprovedForAll is a free data retrieval call binding the contract method 0xe985e9c5. +// +// Solidity: function isApprovedForAll(address owner, address operator) view returns(bool) +func (_ERC721Enumerable *ERC721EnumerableCaller) IsApprovedForAll(opts *bind.CallOpts, owner common.Address, operator common.Address) (bool, error) { + var out []interface{} + err := _ERC721Enumerable.contract.Call(opts, &out, "isApprovedForAll", owner, operator) + + if err != nil { + return *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + + return out0, err + +} + +// IsApprovedForAll is a free data retrieval call binding the contract method 0xe985e9c5. +// +// Solidity: function isApprovedForAll(address owner, address operator) view returns(bool) +func (_ERC721Enumerable *ERC721EnumerableSession) IsApprovedForAll(owner common.Address, operator common.Address) (bool, error) { + return _ERC721Enumerable.Contract.IsApprovedForAll(&_ERC721Enumerable.CallOpts, owner, operator) +} + +// IsApprovedForAll is a free data retrieval call binding the contract method 0xe985e9c5. +// +// Solidity: function isApprovedForAll(address owner, address operator) view returns(bool) +func (_ERC721Enumerable *ERC721EnumerableCallerSession) IsApprovedForAll(owner common.Address, operator common.Address) (bool, error) { + return _ERC721Enumerable.Contract.IsApprovedForAll(&_ERC721Enumerable.CallOpts, owner, operator) +} + +// OwnerOf is a free data retrieval call binding the contract method 0x6352211e. +// +// Solidity: function ownerOf(uint256 tokenId) view returns(address) +func (_ERC721Enumerable *ERC721EnumerableCaller) OwnerOf(opts *bind.CallOpts, tokenId *big.Int) (common.Address, error) { + var out []interface{} + err := _ERC721Enumerable.contract.Call(opts, &out, "ownerOf", tokenId) + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// OwnerOf is a free data retrieval call binding the contract method 0x6352211e. +// +// Solidity: function ownerOf(uint256 tokenId) view returns(address) +func (_ERC721Enumerable *ERC721EnumerableSession) OwnerOf(tokenId *big.Int) (common.Address, error) { + return _ERC721Enumerable.Contract.OwnerOf(&_ERC721Enumerable.CallOpts, tokenId) +} + +// OwnerOf is a free data retrieval call binding the contract method 0x6352211e. +// +// Solidity: function ownerOf(uint256 tokenId) view returns(address) +func (_ERC721Enumerable *ERC721EnumerableCallerSession) OwnerOf(tokenId *big.Int) (common.Address, error) { + return _ERC721Enumerable.Contract.OwnerOf(&_ERC721Enumerable.CallOpts, tokenId) +} + +// SupportsInterface is a free data retrieval call binding the contract method 0x01ffc9a7. +// +// Solidity: function supportsInterface(bytes4 interfaceId) view returns(bool) +func (_ERC721Enumerable *ERC721EnumerableCaller) SupportsInterface(opts *bind.CallOpts, interfaceId [4]byte) (bool, error) { + var out []interface{} + err := _ERC721Enumerable.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 (_ERC721Enumerable *ERC721EnumerableSession) SupportsInterface(interfaceId [4]byte) (bool, error) { + return _ERC721Enumerable.Contract.SupportsInterface(&_ERC721Enumerable.CallOpts, interfaceId) +} + +// SupportsInterface is a free data retrieval call binding the contract method 0x01ffc9a7. +// +// Solidity: function supportsInterface(bytes4 interfaceId) view returns(bool) +func (_ERC721Enumerable *ERC721EnumerableCallerSession) SupportsInterface(interfaceId [4]byte) (bool, error) { + return _ERC721Enumerable.Contract.SupportsInterface(&_ERC721Enumerable.CallOpts, interfaceId) +} + +// TokenByIndex is a free data retrieval call binding the contract method 0x4f6ccce7. +// +// Solidity: function tokenByIndex(uint256 index) view returns(uint256) +func (_ERC721Enumerable *ERC721EnumerableCaller) TokenByIndex(opts *bind.CallOpts, index *big.Int) (*big.Int, error) { + var out []interface{} + err := _ERC721Enumerable.contract.Call(opts, &out, "tokenByIndex", index) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// TokenByIndex is a free data retrieval call binding the contract method 0x4f6ccce7. +// +// Solidity: function tokenByIndex(uint256 index) view returns(uint256) +func (_ERC721Enumerable *ERC721EnumerableSession) TokenByIndex(index *big.Int) (*big.Int, error) { + return _ERC721Enumerable.Contract.TokenByIndex(&_ERC721Enumerable.CallOpts, index) +} + +// TokenByIndex is a free data retrieval call binding the contract method 0x4f6ccce7. +// +// Solidity: function tokenByIndex(uint256 index) view returns(uint256) +func (_ERC721Enumerable *ERC721EnumerableCallerSession) TokenByIndex(index *big.Int) (*big.Int, error) { + return _ERC721Enumerable.Contract.TokenByIndex(&_ERC721Enumerable.CallOpts, index) +} + +// TokenOfOwnerByIndex is a free data retrieval call binding the contract method 0x2f745c59. +// +// Solidity: function tokenOfOwnerByIndex(address owner, uint256 index) view returns(uint256) +func (_ERC721Enumerable *ERC721EnumerableCaller) TokenOfOwnerByIndex(opts *bind.CallOpts, owner common.Address, index *big.Int) (*big.Int, error) { + var out []interface{} + err := _ERC721Enumerable.contract.Call(opts, &out, "tokenOfOwnerByIndex", owner, index) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// TokenOfOwnerByIndex is a free data retrieval call binding the contract method 0x2f745c59. +// +// Solidity: function tokenOfOwnerByIndex(address owner, uint256 index) view returns(uint256) +func (_ERC721Enumerable *ERC721EnumerableSession) TokenOfOwnerByIndex(owner common.Address, index *big.Int) (*big.Int, error) { + return _ERC721Enumerable.Contract.TokenOfOwnerByIndex(&_ERC721Enumerable.CallOpts, owner, index) +} + +// TokenOfOwnerByIndex is a free data retrieval call binding the contract method 0x2f745c59. +// +// Solidity: function tokenOfOwnerByIndex(address owner, uint256 index) view returns(uint256) +func (_ERC721Enumerable *ERC721EnumerableCallerSession) TokenOfOwnerByIndex(owner common.Address, index *big.Int) (*big.Int, error) { + return _ERC721Enumerable.Contract.TokenOfOwnerByIndex(&_ERC721Enumerable.CallOpts, owner, index) +} + +// TotalSupply is a free data retrieval call binding the contract method 0x18160ddd. +// +// Solidity: function totalSupply() view returns(uint256) +func (_ERC721Enumerable *ERC721EnumerableCaller) TotalSupply(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _ERC721Enumerable.contract.Call(opts, &out, "totalSupply") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// TotalSupply is a free data retrieval call binding the contract method 0x18160ddd. +// +// Solidity: function totalSupply() view returns(uint256) +func (_ERC721Enumerable *ERC721EnumerableSession) TotalSupply() (*big.Int, error) { + return _ERC721Enumerable.Contract.TotalSupply(&_ERC721Enumerable.CallOpts) +} + +// TotalSupply is a free data retrieval call binding the contract method 0x18160ddd. +// +// Solidity: function totalSupply() view returns(uint256) +func (_ERC721Enumerable *ERC721EnumerableCallerSession) TotalSupply() (*big.Int, error) { + return _ERC721Enumerable.Contract.TotalSupply(&_ERC721Enumerable.CallOpts) +} + +// Approve is a paid mutator transaction binding the contract method 0x095ea7b3. +// +// Solidity: function approve(address to, uint256 tokenId) returns() +func (_ERC721Enumerable *ERC721EnumerableTransactor) Approve(opts *bind.TransactOpts, to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _ERC721Enumerable.contract.Transact(opts, "approve", to, tokenId) +} + +// Approve is a paid mutator transaction binding the contract method 0x095ea7b3. +// +// Solidity: function approve(address to, uint256 tokenId) returns() +func (_ERC721Enumerable *ERC721EnumerableSession) Approve(to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _ERC721Enumerable.Contract.Approve(&_ERC721Enumerable.TransactOpts, to, tokenId) +} + +// Approve is a paid mutator transaction binding the contract method 0x095ea7b3. +// +// Solidity: function approve(address to, uint256 tokenId) returns() +func (_ERC721Enumerable *ERC721EnumerableTransactorSession) Approve(to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _ERC721Enumerable.Contract.Approve(&_ERC721Enumerable.TransactOpts, to, tokenId) +} + +// SafeTransferFrom is a paid mutator transaction binding the contract method 0x42842e0e. +// +// Solidity: function safeTransferFrom(address from, address to, uint256 tokenId) returns() +func (_ERC721Enumerable *ERC721EnumerableTransactor) SafeTransferFrom(opts *bind.TransactOpts, from common.Address, to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _ERC721Enumerable.contract.Transact(opts, "safeTransferFrom", from, to, tokenId) +} + +// SafeTransferFrom is a paid mutator transaction binding the contract method 0x42842e0e. +// +// Solidity: function safeTransferFrom(address from, address to, uint256 tokenId) returns() +func (_ERC721Enumerable *ERC721EnumerableSession) SafeTransferFrom(from common.Address, to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _ERC721Enumerable.Contract.SafeTransferFrom(&_ERC721Enumerable.TransactOpts, from, to, tokenId) +} + +// SafeTransferFrom is a paid mutator transaction binding the contract method 0x42842e0e. +// +// Solidity: function safeTransferFrom(address from, address to, uint256 tokenId) returns() +func (_ERC721Enumerable *ERC721EnumerableTransactorSession) SafeTransferFrom(from common.Address, to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _ERC721Enumerable.Contract.SafeTransferFrom(&_ERC721Enumerable.TransactOpts, from, to, tokenId) +} + +// SafeTransferFrom0 is a paid mutator transaction binding the contract method 0xb88d4fde. +// +// Solidity: function safeTransferFrom(address from, address to, uint256 tokenId, bytes _data) returns() +func (_ERC721Enumerable *ERC721EnumerableTransactor) SafeTransferFrom0(opts *bind.TransactOpts, from common.Address, to common.Address, tokenId *big.Int, _data []byte) (*types.Transaction, error) { + return _ERC721Enumerable.contract.Transact(opts, "safeTransferFrom0", from, to, tokenId, _data) +} + +// SafeTransferFrom0 is a paid mutator transaction binding the contract method 0xb88d4fde. +// +// Solidity: function safeTransferFrom(address from, address to, uint256 tokenId, bytes _data) returns() +func (_ERC721Enumerable *ERC721EnumerableSession) SafeTransferFrom0(from common.Address, to common.Address, tokenId *big.Int, _data []byte) (*types.Transaction, error) { + return _ERC721Enumerable.Contract.SafeTransferFrom0(&_ERC721Enumerable.TransactOpts, from, to, tokenId, _data) +} + +// SafeTransferFrom0 is a paid mutator transaction binding the contract method 0xb88d4fde. +// +// Solidity: function safeTransferFrom(address from, address to, uint256 tokenId, bytes _data) returns() +func (_ERC721Enumerable *ERC721EnumerableTransactorSession) SafeTransferFrom0(from common.Address, to common.Address, tokenId *big.Int, _data []byte) (*types.Transaction, error) { + return _ERC721Enumerable.Contract.SafeTransferFrom0(&_ERC721Enumerable.TransactOpts, from, to, tokenId, _data) +} + +// SetApprovalForAll is a paid mutator transaction binding the contract method 0xa22cb465. +// +// Solidity: function setApprovalForAll(address to, bool approved) returns() +func (_ERC721Enumerable *ERC721EnumerableTransactor) SetApprovalForAll(opts *bind.TransactOpts, to common.Address, approved bool) (*types.Transaction, error) { + return _ERC721Enumerable.contract.Transact(opts, "setApprovalForAll", to, approved) +} + +// SetApprovalForAll is a paid mutator transaction binding the contract method 0xa22cb465. +// +// Solidity: function setApprovalForAll(address to, bool approved) returns() +func (_ERC721Enumerable *ERC721EnumerableSession) SetApprovalForAll(to common.Address, approved bool) (*types.Transaction, error) { + return _ERC721Enumerable.Contract.SetApprovalForAll(&_ERC721Enumerable.TransactOpts, to, approved) +} + +// SetApprovalForAll is a paid mutator transaction binding the contract method 0xa22cb465. +// +// Solidity: function setApprovalForAll(address to, bool approved) returns() +func (_ERC721Enumerable *ERC721EnumerableTransactorSession) SetApprovalForAll(to common.Address, approved bool) (*types.Transaction, error) { + return _ERC721Enumerable.Contract.SetApprovalForAll(&_ERC721Enumerable.TransactOpts, to, approved) +} + +// TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd. +// +// Solidity: function transferFrom(address from, address to, uint256 tokenId) returns() +func (_ERC721Enumerable *ERC721EnumerableTransactor) TransferFrom(opts *bind.TransactOpts, from common.Address, to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _ERC721Enumerable.contract.Transact(opts, "transferFrom", from, to, tokenId) +} + +// TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd. +// +// Solidity: function transferFrom(address from, address to, uint256 tokenId) returns() +func (_ERC721Enumerable *ERC721EnumerableSession) TransferFrom(from common.Address, to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _ERC721Enumerable.Contract.TransferFrom(&_ERC721Enumerable.TransactOpts, from, to, tokenId) +} + +// TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd. +// +// Solidity: function transferFrom(address from, address to, uint256 tokenId) returns() +func (_ERC721Enumerable *ERC721EnumerableTransactorSession) TransferFrom(from common.Address, to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _ERC721Enumerable.Contract.TransferFrom(&_ERC721Enumerable.TransactOpts, from, to, tokenId) +} + +// ERC721EnumerableApprovalIterator is returned from FilterApproval and is used to iterate over the raw logs and unpacked data for Approval events raised by the ERC721Enumerable contract. +type ERC721EnumerableApprovalIterator struct { + Event *ERC721EnumerableApproval // 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 *ERC721EnumerableApprovalIterator) 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(ERC721EnumerableApproval) + 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(ERC721EnumerableApproval) + 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 *ERC721EnumerableApprovalIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ERC721EnumerableApprovalIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ERC721EnumerableApproval represents a Approval event raised by the ERC721Enumerable contract. +type ERC721EnumerableApproval struct { + Owner common.Address + Approved common.Address + TokenId *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterApproval is a free log retrieval operation binding the contract event 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925. +// +// Solidity: event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId) +func (_ERC721Enumerable *ERC721EnumerableFilterer) FilterApproval(opts *bind.FilterOpts, owner []common.Address, approved []common.Address, tokenId []*big.Int) (*ERC721EnumerableApprovalIterator, error) { + + var ownerRule []interface{} + for _, ownerItem := range owner { + ownerRule = append(ownerRule, ownerItem) + } + var approvedRule []interface{} + for _, approvedItem := range approved { + approvedRule = append(approvedRule, approvedItem) + } + var tokenIdRule []interface{} + for _, tokenIdItem := range tokenId { + tokenIdRule = append(tokenIdRule, tokenIdItem) + } + + logs, sub, err := _ERC721Enumerable.contract.FilterLogs(opts, "Approval", ownerRule, approvedRule, tokenIdRule) + if err != nil { + return nil, err + } + return &ERC721EnumerableApprovalIterator{contract: _ERC721Enumerable.contract, event: "Approval", logs: logs, sub: sub}, nil +} + +// WatchApproval is a free log subscription operation binding the contract event 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925. +// +// Solidity: event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId) +func (_ERC721Enumerable *ERC721EnumerableFilterer) WatchApproval(opts *bind.WatchOpts, sink chan<- *ERC721EnumerableApproval, owner []common.Address, approved []common.Address, tokenId []*big.Int) (event.Subscription, error) { + + var ownerRule []interface{} + for _, ownerItem := range owner { + ownerRule = append(ownerRule, ownerItem) + } + var approvedRule []interface{} + for _, approvedItem := range approved { + approvedRule = append(approvedRule, approvedItem) + } + var tokenIdRule []interface{} + for _, tokenIdItem := range tokenId { + tokenIdRule = append(tokenIdRule, tokenIdItem) + } + + logs, sub, err := _ERC721Enumerable.contract.WatchLogs(opts, "Approval", ownerRule, approvedRule, tokenIdRule) + 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(ERC721EnumerableApproval) + if err := _ERC721Enumerable.contract.UnpackLog(event, "Approval", 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 +} + +// ParseApproval is a log parse operation binding the contract event 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925. +// +// Solidity: event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId) +func (_ERC721Enumerable *ERC721EnumerableFilterer) ParseApproval(log types.Log) (*ERC721EnumerableApproval, error) { + event := new(ERC721EnumerableApproval) + if err := _ERC721Enumerable.contract.UnpackLog(event, "Approval", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ERC721EnumerableApprovalForAllIterator is returned from FilterApprovalForAll and is used to iterate over the raw logs and unpacked data for ApprovalForAll events raised by the ERC721Enumerable contract. +type ERC721EnumerableApprovalForAllIterator struct { + Event *ERC721EnumerableApprovalForAll // 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 *ERC721EnumerableApprovalForAllIterator) 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(ERC721EnumerableApprovalForAll) + 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(ERC721EnumerableApprovalForAll) + 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 *ERC721EnumerableApprovalForAllIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ERC721EnumerableApprovalForAllIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ERC721EnumerableApprovalForAll represents a ApprovalForAll event raised by the ERC721Enumerable contract. +type ERC721EnumerableApprovalForAll struct { + Owner common.Address + Operator common.Address + Approved bool + Raw types.Log // Blockchain specific contextual infos +} + +// FilterApprovalForAll is a free log retrieval operation binding the contract event 0x17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31. +// +// Solidity: event ApprovalForAll(address indexed owner, address indexed operator, bool approved) +func (_ERC721Enumerable *ERC721EnumerableFilterer) FilterApprovalForAll(opts *bind.FilterOpts, owner []common.Address, operator []common.Address) (*ERC721EnumerableApprovalForAllIterator, error) { + + var ownerRule []interface{} + for _, ownerItem := range owner { + ownerRule = append(ownerRule, ownerItem) + } + var operatorRule []interface{} + for _, operatorItem := range operator { + operatorRule = append(operatorRule, operatorItem) + } + + logs, sub, err := _ERC721Enumerable.contract.FilterLogs(opts, "ApprovalForAll", ownerRule, operatorRule) + if err != nil { + return nil, err + } + return &ERC721EnumerableApprovalForAllIterator{contract: _ERC721Enumerable.contract, event: "ApprovalForAll", logs: logs, sub: sub}, nil +} + +// WatchApprovalForAll is a free log subscription operation binding the contract event 0x17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31. +// +// Solidity: event ApprovalForAll(address indexed owner, address indexed operator, bool approved) +func (_ERC721Enumerable *ERC721EnumerableFilterer) WatchApprovalForAll(opts *bind.WatchOpts, sink chan<- *ERC721EnumerableApprovalForAll, owner []common.Address, operator []common.Address) (event.Subscription, error) { + + var ownerRule []interface{} + for _, ownerItem := range owner { + ownerRule = append(ownerRule, ownerItem) + } + var operatorRule []interface{} + for _, operatorItem := range operator { + operatorRule = append(operatorRule, operatorItem) + } + + logs, sub, err := _ERC721Enumerable.contract.WatchLogs(opts, "ApprovalForAll", ownerRule, operatorRule) + 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(ERC721EnumerableApprovalForAll) + if err := _ERC721Enumerable.contract.UnpackLog(event, "ApprovalForAll", 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 +} + +// ParseApprovalForAll is a log parse operation binding the contract event 0x17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31. +// +// Solidity: event ApprovalForAll(address indexed owner, address indexed operator, bool approved) +func (_ERC721Enumerable *ERC721EnumerableFilterer) ParseApprovalForAll(log types.Log) (*ERC721EnumerableApprovalForAll, error) { + event := new(ERC721EnumerableApprovalForAll) + if err := _ERC721Enumerable.contract.UnpackLog(event, "ApprovalForAll", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ERC721EnumerableTransferIterator is returned from FilterTransfer and is used to iterate over the raw logs and unpacked data for Transfer events raised by the ERC721Enumerable contract. +type ERC721EnumerableTransferIterator struct { + Event *ERC721EnumerableTransfer // 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 *ERC721EnumerableTransferIterator) 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(ERC721EnumerableTransfer) + 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(ERC721EnumerableTransfer) + 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 *ERC721EnumerableTransferIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ERC721EnumerableTransferIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ERC721EnumerableTransfer represents a Transfer event raised by the ERC721Enumerable contract. +type ERC721EnumerableTransfer struct { + From common.Address + To common.Address + TokenId *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterTransfer is a free log retrieval operation binding the contract event 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef. +// +// Solidity: event Transfer(address indexed from, address indexed to, uint256 indexed tokenId) +func (_ERC721Enumerable *ERC721EnumerableFilterer) FilterTransfer(opts *bind.FilterOpts, from []common.Address, to []common.Address, tokenId []*big.Int) (*ERC721EnumerableTransferIterator, error) { + + var fromRule []interface{} + for _, fromItem := range from { + fromRule = append(fromRule, fromItem) + } + var toRule []interface{} + for _, toItem := range to { + toRule = append(toRule, toItem) + } + var tokenIdRule []interface{} + for _, tokenIdItem := range tokenId { + tokenIdRule = append(tokenIdRule, tokenIdItem) + } + + logs, sub, err := _ERC721Enumerable.contract.FilterLogs(opts, "Transfer", fromRule, toRule, tokenIdRule) + if err != nil { + return nil, err + } + return &ERC721EnumerableTransferIterator{contract: _ERC721Enumerable.contract, event: "Transfer", logs: logs, sub: sub}, nil +} + +// WatchTransfer is a free log subscription operation binding the contract event 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef. +// +// Solidity: event Transfer(address indexed from, address indexed to, uint256 indexed tokenId) +func (_ERC721Enumerable *ERC721EnumerableFilterer) WatchTransfer(opts *bind.WatchOpts, sink chan<- *ERC721EnumerableTransfer, from []common.Address, to []common.Address, tokenId []*big.Int) (event.Subscription, error) { + + var fromRule []interface{} + for _, fromItem := range from { + fromRule = append(fromRule, fromItem) + } + var toRule []interface{} + for _, toItem := range to { + toRule = append(toRule, toItem) + } + var tokenIdRule []interface{} + for _, tokenIdItem := range tokenId { + tokenIdRule = append(tokenIdRule, tokenIdItem) + } + + logs, sub, err := _ERC721Enumerable.contract.WatchLogs(opts, "Transfer", fromRule, toRule, tokenIdRule) + 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(ERC721EnumerableTransfer) + if err := _ERC721Enumerable.contract.UnpackLog(event, "Transfer", 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 +} + +// ParseTransfer is a log parse operation binding the contract event 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef. +// +// Solidity: event Transfer(address indexed from, address indexed to, uint256 indexed tokenId) +func (_ERC721Enumerable *ERC721EnumerableFilterer) ParseTransfer(log types.Log) (*ERC721EnumerableTransfer, error) { + event := new(ERC721EnumerableTransfer) + if err := _ERC721Enumerable.contract.UnpackLog(event, "Transfer", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ERC721FullABI is the input ABI used to generate the binding from. +const ERC721FullABI = "[{\"constant\":true,\"inputs\":[{\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"getApproved\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"to\",\"type\":\"address\"},{\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"from\",\"type\":\"address\"},{\"name\":\"to\",\"type\":\"address\"},{\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"owner\",\"type\":\"address\"},{\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"tokenOfOwnerByIndex\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"from\",\"type\":\"address\"},{\"name\":\"to\",\"type\":\"address\"},{\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"safeTransferFrom\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"tokenByIndex\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"ownerOf\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"symbol\",\"outputs\":[{\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"to\",\"type\":\"address\"},{\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"setApprovalForAll\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"from\",\"type\":\"address\"},{\"name\":\"to\",\"type\":\"address\"},{\"name\":\"tokenId\",\"type\":\"uint256\"},{\"name\":\"_data\",\"type\":\"bytes\"}],\"name\":\"safeTransferFrom\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"tokenURI\",\"outputs\":[{\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"owner\",\"type\":\"address\"},{\"name\":\"operator\",\"type\":\"address\"}],\"name\":\"isApprovedForAll\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"name\":\"name\",\"type\":\"string\"},{\"name\":\"symbol\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"to\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"approved\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"ApprovalForAll\",\"type\":\"event\"}]" + +// ERC721FullFuncSigs maps the 4-byte function signature to its string representation. +var ERC721FullFuncSigs = map[string]string{ + "095ea7b3": "approve(address,uint256)", + "70a08231": "balanceOf(address)", + "081812fc": "getApproved(uint256)", + "e985e9c5": "isApprovedForAll(address,address)", + "06fdde03": "name()", + "6352211e": "ownerOf(uint256)", + "42842e0e": "safeTransferFrom(address,address,uint256)", + "b88d4fde": "safeTransferFrom(address,address,uint256,bytes)", + "a22cb465": "setApprovalForAll(address,bool)", + "01ffc9a7": "supportsInterface(bytes4)", + "95d89b41": "symbol()", + "4f6ccce7": "tokenByIndex(uint256)", + "2f745c59": "tokenOfOwnerByIndex(address,uint256)", + "c87b56dd": "tokenURI(uint256)", + "18160ddd": "totalSupply()", + "23b872dd": "transferFrom(address,address,uint256)", +} + +// ERC721FullBin is the compiled bytecode used for deploying new contracts. +var ERC721FullBin = "0x60806040523480156200001157600080fd5b50604051620016b6380380620016b6833981810160405260408110156200003757600080fd5b8101908080516401000000008111156200005057600080fd5b820160208101848111156200006457600080fd5b81516401000000008111828201871017156200007f57600080fd5b505092919060200180516401000000008111156200009c57600080fd5b82016020810184811115620000b057600080fd5b8151640100000000811182820187101715620000cb57600080fd5b509093508492508391506200010b90507f01ffc9a7000000000000000000000000000000000000000000000000000000006001600160e01b03620001dd16565b6200013f7f80ac58cd000000000000000000000000000000000000000000000000000000006001600160e01b03620001dd16565b620001737f780e9d63000000000000000000000000000000000000000000000000000000006001600160e01b03620001dd16565b815162000188906009906020850190620002ac565b5080516200019e90600a906020840190620002ac565b50620001d37f5b5e139f000000000000000000000000000000000000000000000000000000006001600160e01b03620001dd16565b5050505062000351565b7fffffffff0000000000000000000000000000000000000000000000000000000080821614156200026f57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f4552433136353a20696e76616c696420696e7465726661636520696400000000604482015290519081900360640190fd5b7fffffffff00000000000000000000000000000000000000000000000000000000166000908152602081905260409020805460ff19166001179055565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10620002ef57805160ff19168380011785556200031f565b828001600101855582156200031f579182015b828111156200031f57825182559160200191906001019062000302565b506200032d92915062000331565b5090565b6200034e91905b808211156200032d576000815560010162000338565b90565b61135580620003616000396000f3fe608060405234801561001057600080fd5b50600436106101005760003560e01c80634f6ccce711610097578063a22cb46511610066578063a22cb4651461033e578063b88d4fde1461036c578063c87b56dd14610432578063e985e9c51461044f57610100565b80634f6ccce7146102d65780636352211e146102f357806370a082311461031057806395d89b411461033657610100565b806318160ddd116100d357806318160ddd1461022457806323b872dd1461023e5780632f745c591461027457806342842e0e146102a057610100565b806301ffc9a71461010557806306fdde0314610140578063081812fc146101bd578063095ea7b3146101f6575b600080fd5b61012c6004803603602081101561011b57600080fd5b50356001600160e01b03191661047d565b604080519115158252519081900360200190f35b61014861049c565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561018257818101518382015260200161016a565b50505050905090810190601f1680156101af5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101da600480360360208110156101d357600080fd5b5035610533565b604080516001600160a01b039092168252519081900360200190f35b6102226004803603604081101561020c57600080fd5b506001600160a01b038135169060200135610595565b005b61022c6106a6565b60408051918252519081900360200190f35b6102226004803603606081101561025457600080fd5b506001600160a01b038135811691602081013590911690604001356106ac565b61022c6004803603604081101561028a57600080fd5b506001600160a01b038135169060200135610701565b610222600480360360608110156102b657600080fd5b506001600160a01b03813581169160208101359091169060400135610780565b61022c600480360360208110156102ec57600080fd5b503561079b565b6101da6004803603602081101561030957600080fd5b5035610801565b61022c6004803603602081101561032657600080fd5b50356001600160a01b031661085b565b6101486108c3565b6102226004803603604081101561035457600080fd5b506001600160a01b0381351690602001351515610924565b6102226004803603608081101561038257600080fd5b6001600160a01b038235811692602081013590911691604082013591908101906080810160608201356401000000008111156103bd57600080fd5b8201836020820111156103cf57600080fd5b803590602001918460018302840111640100000000831117156103f157600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506109f0945050505050565b6101486004803603602081101561044857600080fd5b5035610a48565b61012c6004803603604081101561046557600080fd5b506001600160a01b0381358116916020013516610b2d565b6001600160e01b03191660009081526020819052604090205460ff1690565b60098054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156105285780601f106104fd57610100808354040283529160200191610528565b820191906000526020600020905b81548152906001019060200180831161050b57829003601f168201915b505050505090505b90565b600061053e82610b5b565b6105795760405162461bcd60e51b815260040180806020018281038252602c81526020018061121f602c913960400191505060405180910390fd5b506000908152600260205260409020546001600160a01b031690565b60006105a082610801565b9050806001600160a01b0316836001600160a01b031614156105f35760405162461bcd60e51b81526004018080602001828103825260218152602001806112a36021913960400191505060405180910390fd5b336001600160a01b038216148061060f575061060f8133610b2d565b61064a5760405162461bcd60e51b81526004018080602001828103825260388152602001806111946038913960400191505060405180910390fd5b60008281526002602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b60075490565b6106b63382610b78565b6106f15760405162461bcd60e51b81526004018080602001828103825260318152602001806112c46031913960400191505060405180910390fd5b6106fc838383610c1c565b505050565b600061070c8361085b565b82106107495760405162461bcd60e51b815260040180806020018281038252602b8152602001806110e7602b913960400191505060405180910390fd5b6001600160a01b038316600090815260056020526040902080548390811061076d57fe5b9060005260206000200154905092915050565b6106fc838383604051806020016040528060008152506109f0565b60006107a56106a6565b82106107e25760405162461bcd60e51b815260040180806020018281038252602c8152602001806112f5602c913960400191505060405180910390fd5b600782815481106107ef57fe5b90600052602060002001549050919050565b6000818152600160205260408120546001600160a01b0316806108555760405162461bcd60e51b81526004018080602001828103825260298152602001806111f66029913960400191505060405180910390fd5b92915050565b60006001600160a01b0382166108a25760405162461bcd60e51b815260040180806020018281038252602a8152602001806111cc602a913960400191505060405180910390fd5b6001600160a01b038216600090815260036020526040902061085590610c3b565b600a8054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156105285780601f106104fd57610100808354040283529160200191610528565b6001600160a01b038216331415610982576040805162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c657200000000000000604482015290519081900360640190fd5b3360008181526004602090815260408083206001600160a01b03871680855290835292819020805460ff1916861515908117909155815190815290519293927f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31929181900390910190a35050565b6109fb8484846106ac565b610a0784848484610c3f565b610a425760405162461bcd60e51b81526004018080602001828103825260328152602001806111126032913960400191505060405180910390fd5b50505050565b6060610a5382610b5b565b610a8e5760405162461bcd60e51b815260040180806020018281038252602f815260200180611274602f913960400191505060405180910390fd5b6000828152600b602090815260409182902080548351601f600260001961010060018616150201909316929092049182018490048402810184019094528084529091830182828015610b215780601f10610af657610100808354040283529160200191610b21565b820191906000526020600020905b815481529060010190602001808311610b0457829003601f168201915b50505050509050919050565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205460ff1690565b6000908152600160205260409020546001600160a01b0316151590565b6000610b8382610b5b565b610bbe5760405162461bcd60e51b815260040180806020018281038252602c815260200180611168602c913960400191505060405180910390fd5b6000610bc983610801565b9050806001600160a01b0316846001600160a01b03161480610c045750836001600160a01b0316610bf984610533565b6001600160a01b0316145b80610c145750610c148185610b2d565b949350505050565b610c27838383610d72565b610c318382610eb6565b6106fc8282610fab565b5490565b6000610c53846001600160a01b0316610fe9565b610c5f57506001610c14565b604051630a85bd0160e11b815233600482018181526001600160a01b03888116602485015260448401879052608060648501908152865160848601528651600095928a169463150b7a029490938c938b938b939260a4019060208501908083838e5b83811015610cd9578181015183820152602001610cc1565b50505050905090810190601f168015610d065780820380516001836020036101000a031916815260200191505b5095505050505050602060405180830381600087803b158015610d2857600080fd5b505af1158015610d3c573d6000803e3d6000fd5b505050506040513d6020811015610d5257600080fd5b50516001600160e01b031916630a85bd0160e11b14915050949350505050565b826001600160a01b0316610d8582610801565b6001600160a01b031614610dca5760405162461bcd60e51b815260040180806020018281038252602981526020018061124b6029913960400191505060405180910390fd5b6001600160a01b038216610e0f5760405162461bcd60e51b81526004018080602001828103825260248152602001806111446024913960400191505060405180910390fd5b610e1881610fef565b6001600160a01b0383166000908152600360205260409020610e399061102c565b6001600160a01b0382166000908152600360205260409020610e5a90611043565b60008181526001602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b6001600160a01b038216600090815260056020526040812054610ee090600163ffffffff61104c16565b600083815260066020526040902054909150808214610f7b576001600160a01b0384166000908152600560205260408120805484908110610f1d57fe5b906000526020600020015490508060056000876001600160a01b03166001600160a01b031681526020019081526020016000208381548110610f5b57fe5b600091825260208083209091019290925591825260069052604090208190555b6001600160a01b0384166000908152600560205260409020805490610fa49060001983016110a9565b5050505050565b6001600160a01b0390911660009081526005602081815260408084208054868652600684529185208290559282526001810183559183529091200155565b3b151590565b6000818152600260205260409020546001600160a01b03161561102957600081815260026020526040902080546001600160a01b03191690555b50565b805461103f90600163ffffffff61104c16565b9055565b80546001019055565b6000828211156110a3576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b8154818355818111156106fc576000838152602090206106fc91810190830161053091905b808211156110e257600081556001016110ce565b509056fe455243373231456e756d657261626c653a206f776e657220696e646578206f7574206f6620626f756e64734552433732313a207472616e7366657220746f206e6f6e20455243373231526563656976657220696d706c656d656e7465724552433732313a207472616e7366657220746f20746865207a65726f20616464726573734552433732313a206f70657261746f7220717565727920666f72206e6f6e6578697374656e7420746f6b656e4552433732313a20617070726f76652063616c6c6572206973206e6f74206f776e6572206e6f7220617070726f76656420666f7220616c6c4552433732313a2062616c616e636520717565727920666f7220746865207a65726f20616464726573734552433732313a206f776e657220717565727920666f72206e6f6e6578697374656e7420746f6b656e4552433732313a20617070726f76656420717565727920666f72206e6f6e6578697374656e7420746f6b656e4552433732313a207472616e73666572206f6620746f6b656e2074686174206973206e6f74206f776e4552433732314d657461646174613a2055524920717565727920666f72206e6f6e6578697374656e7420746f6b656e4552433732313a20617070726f76616c20746f2063757272656e74206f776e65724552433732313a207472616e736665722063616c6c6572206973206e6f74206f776e6572206e6f7220617070726f766564455243373231456e756d657261626c653a20676c6f62616c20696e646578206f7574206f6620626f756e6473a265627a7a723058200eac125700729013e70be2508bd9d5dfb4ac28a351b3b80ed8843f1781b5e7ae64736f6c634300050a0032" + +// DeployERC721Full deploys a new Ethereum contract, binding an instance of ERC721Full to it. +func DeployERC721Full(auth *bind.TransactOpts, backend bind.ContractBackend, name string, symbol string) (common.Address, *types.Transaction, *ERC721Full, error) { + parsed, err := abi.JSON(strings.NewReader(ERC721FullABI)) + if err != nil { + return common.Address{}, nil, nil, err + } + + address, tx, contract, err := bind.DeployContract(auth, parsed, common.FromHex(ERC721FullBin), backend, name, symbol) + if err != nil { + return common.Address{}, nil, nil, err + } + return address, tx, &ERC721Full{ERC721FullCaller: ERC721FullCaller{contract: contract}, ERC721FullTransactor: ERC721FullTransactor{contract: contract}, ERC721FullFilterer: ERC721FullFilterer{contract: contract}}, nil +} + +// ERC721Full is an auto generated Go binding around an Ethereum contract. +type ERC721Full struct { + ERC721FullCaller // Read-only binding to the contract + ERC721FullTransactor // Write-only binding to the contract + ERC721FullFilterer // Log filterer for contract events +} + +// ERC721FullCaller is an auto generated read-only Go binding around an Ethereum contract. +type ERC721FullCaller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// ERC721FullTransactor is an auto generated write-only Go binding around an Ethereum contract. +type ERC721FullTransactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// ERC721FullFilterer is an auto generated log filtering Go binding around an Ethereum contract events. +type ERC721FullFilterer struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// ERC721FullSession is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type ERC721FullSession struct { + Contract *ERC721Full // 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 +} + +// ERC721FullCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type ERC721FullCallerSession struct { + Contract *ERC721FullCaller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// ERC721FullTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type ERC721FullTransactorSession struct { + Contract *ERC721FullTransactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// ERC721FullRaw is an auto generated low-level Go binding around an Ethereum contract. +type ERC721FullRaw struct { + Contract *ERC721Full // Generic contract binding to access the raw methods on +} + +// ERC721FullCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type ERC721FullCallerRaw struct { + Contract *ERC721FullCaller // Generic read-only contract binding to access the raw methods on +} + +// ERC721FullTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type ERC721FullTransactorRaw struct { + Contract *ERC721FullTransactor // Generic write-only contract binding to access the raw methods on +} + +// NewERC721Full creates a new instance of ERC721Full, bound to a specific deployed contract. +func NewERC721Full(address common.Address, backend bind.ContractBackend) (*ERC721Full, error) { + contract, err := bindERC721Full(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &ERC721Full{ERC721FullCaller: ERC721FullCaller{contract: contract}, ERC721FullTransactor: ERC721FullTransactor{contract: contract}, ERC721FullFilterer: ERC721FullFilterer{contract: contract}}, nil +} + +// NewERC721FullCaller creates a new read-only instance of ERC721Full, bound to a specific deployed contract. +func NewERC721FullCaller(address common.Address, caller bind.ContractCaller) (*ERC721FullCaller, error) { + contract, err := bindERC721Full(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &ERC721FullCaller{contract: contract}, nil +} + +// NewERC721FullTransactor creates a new write-only instance of ERC721Full, bound to a specific deployed contract. +func NewERC721FullTransactor(address common.Address, transactor bind.ContractTransactor) (*ERC721FullTransactor, error) { + contract, err := bindERC721Full(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &ERC721FullTransactor{contract: contract}, nil +} + +// NewERC721FullFilterer creates a new log filterer instance of ERC721Full, bound to a specific deployed contract. +func NewERC721FullFilterer(address common.Address, filterer bind.ContractFilterer) (*ERC721FullFilterer, error) { + contract, err := bindERC721Full(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &ERC721FullFilterer{contract: contract}, nil +} + +// bindERC721Full binds a generic wrapper to an already deployed contract. +func bindERC721Full(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := abi.JSON(strings.NewReader(ERC721FullABI)) + 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 (_ERC721Full *ERC721FullRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _ERC721Full.Contract.ERC721FullCaller.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 (_ERC721Full *ERC721FullRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _ERC721Full.Contract.ERC721FullTransactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_ERC721Full *ERC721FullRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _ERC721Full.Contract.ERC721FullTransactor.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 (_ERC721Full *ERC721FullCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _ERC721Full.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 (_ERC721Full *ERC721FullTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _ERC721Full.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_ERC721Full *ERC721FullTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _ERC721Full.Contract.contract.Transact(opts, method, params...) +} + +// BalanceOf is a free data retrieval call binding the contract method 0x70a08231. +// +// Solidity: function balanceOf(address owner) view returns(uint256) +func (_ERC721Full *ERC721FullCaller) BalanceOf(opts *bind.CallOpts, owner common.Address) (*big.Int, error) { + var out []interface{} + err := _ERC721Full.contract.Call(opts, &out, "balanceOf", owner) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// BalanceOf is a free data retrieval call binding the contract method 0x70a08231. +// +// Solidity: function balanceOf(address owner) view returns(uint256) +func (_ERC721Full *ERC721FullSession) BalanceOf(owner common.Address) (*big.Int, error) { + return _ERC721Full.Contract.BalanceOf(&_ERC721Full.CallOpts, owner) +} + +// BalanceOf is a free data retrieval call binding the contract method 0x70a08231. +// +// Solidity: function balanceOf(address owner) view returns(uint256) +func (_ERC721Full *ERC721FullCallerSession) BalanceOf(owner common.Address) (*big.Int, error) { + return _ERC721Full.Contract.BalanceOf(&_ERC721Full.CallOpts, owner) +} + +// GetApproved is a free data retrieval call binding the contract method 0x081812fc. +// +// Solidity: function getApproved(uint256 tokenId) view returns(address) +func (_ERC721Full *ERC721FullCaller) GetApproved(opts *bind.CallOpts, tokenId *big.Int) (common.Address, error) { + var out []interface{} + err := _ERC721Full.contract.Call(opts, &out, "getApproved", tokenId) + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// GetApproved is a free data retrieval call binding the contract method 0x081812fc. +// +// Solidity: function getApproved(uint256 tokenId) view returns(address) +func (_ERC721Full *ERC721FullSession) GetApproved(tokenId *big.Int) (common.Address, error) { + return _ERC721Full.Contract.GetApproved(&_ERC721Full.CallOpts, tokenId) +} + +// GetApproved is a free data retrieval call binding the contract method 0x081812fc. +// +// Solidity: function getApproved(uint256 tokenId) view returns(address) +func (_ERC721Full *ERC721FullCallerSession) GetApproved(tokenId *big.Int) (common.Address, error) { + return _ERC721Full.Contract.GetApproved(&_ERC721Full.CallOpts, tokenId) +} + +// IsApprovedForAll is a free data retrieval call binding the contract method 0xe985e9c5. +// +// Solidity: function isApprovedForAll(address owner, address operator) view returns(bool) +func (_ERC721Full *ERC721FullCaller) IsApprovedForAll(opts *bind.CallOpts, owner common.Address, operator common.Address) (bool, error) { + var out []interface{} + err := _ERC721Full.contract.Call(opts, &out, "isApprovedForAll", owner, operator) + + if err != nil { + return *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + + return out0, err + +} + +// IsApprovedForAll is a free data retrieval call binding the contract method 0xe985e9c5. +// +// Solidity: function isApprovedForAll(address owner, address operator) view returns(bool) +func (_ERC721Full *ERC721FullSession) IsApprovedForAll(owner common.Address, operator common.Address) (bool, error) { + return _ERC721Full.Contract.IsApprovedForAll(&_ERC721Full.CallOpts, owner, operator) +} + +// IsApprovedForAll is a free data retrieval call binding the contract method 0xe985e9c5. +// +// Solidity: function isApprovedForAll(address owner, address operator) view returns(bool) +func (_ERC721Full *ERC721FullCallerSession) IsApprovedForAll(owner common.Address, operator common.Address) (bool, error) { + return _ERC721Full.Contract.IsApprovedForAll(&_ERC721Full.CallOpts, owner, operator) +} + +// Name is a free data retrieval call binding the contract method 0x06fdde03. +// +// Solidity: function name() view returns(string) +func (_ERC721Full *ERC721FullCaller) Name(opts *bind.CallOpts) (string, error) { + var out []interface{} + err := _ERC721Full.contract.Call(opts, &out, "name") + + if err != nil { + return *new(string), err + } + + out0 := *abi.ConvertType(out[0], new(string)).(*string) + + return out0, err + +} + +// Name is a free data retrieval call binding the contract method 0x06fdde03. +// +// Solidity: function name() view returns(string) +func (_ERC721Full *ERC721FullSession) Name() (string, error) { + return _ERC721Full.Contract.Name(&_ERC721Full.CallOpts) +} + +// Name is a free data retrieval call binding the contract method 0x06fdde03. +// +// Solidity: function name() view returns(string) +func (_ERC721Full *ERC721FullCallerSession) Name() (string, error) { + return _ERC721Full.Contract.Name(&_ERC721Full.CallOpts) +} + +// OwnerOf is a free data retrieval call binding the contract method 0x6352211e. +// +// Solidity: function ownerOf(uint256 tokenId) view returns(address) +func (_ERC721Full *ERC721FullCaller) OwnerOf(opts *bind.CallOpts, tokenId *big.Int) (common.Address, error) { + var out []interface{} + err := _ERC721Full.contract.Call(opts, &out, "ownerOf", tokenId) + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// OwnerOf is a free data retrieval call binding the contract method 0x6352211e. +// +// Solidity: function ownerOf(uint256 tokenId) view returns(address) +func (_ERC721Full *ERC721FullSession) OwnerOf(tokenId *big.Int) (common.Address, error) { + return _ERC721Full.Contract.OwnerOf(&_ERC721Full.CallOpts, tokenId) +} + +// OwnerOf is a free data retrieval call binding the contract method 0x6352211e. +// +// Solidity: function ownerOf(uint256 tokenId) view returns(address) +func (_ERC721Full *ERC721FullCallerSession) OwnerOf(tokenId *big.Int) (common.Address, error) { + return _ERC721Full.Contract.OwnerOf(&_ERC721Full.CallOpts, tokenId) +} + +// SupportsInterface is a free data retrieval call binding the contract method 0x01ffc9a7. +// +// Solidity: function supportsInterface(bytes4 interfaceId) view returns(bool) +func (_ERC721Full *ERC721FullCaller) SupportsInterface(opts *bind.CallOpts, interfaceId [4]byte) (bool, error) { + var out []interface{} + err := _ERC721Full.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 (_ERC721Full *ERC721FullSession) SupportsInterface(interfaceId [4]byte) (bool, error) { + return _ERC721Full.Contract.SupportsInterface(&_ERC721Full.CallOpts, interfaceId) +} + +// SupportsInterface is a free data retrieval call binding the contract method 0x01ffc9a7. +// +// Solidity: function supportsInterface(bytes4 interfaceId) view returns(bool) +func (_ERC721Full *ERC721FullCallerSession) SupportsInterface(interfaceId [4]byte) (bool, error) { + return _ERC721Full.Contract.SupportsInterface(&_ERC721Full.CallOpts, interfaceId) +} + +// Symbol is a free data retrieval call binding the contract method 0x95d89b41. +// +// Solidity: function symbol() view returns(string) +func (_ERC721Full *ERC721FullCaller) Symbol(opts *bind.CallOpts) (string, error) { + var out []interface{} + err := _ERC721Full.contract.Call(opts, &out, "symbol") + + if err != nil { + return *new(string), err + } + + out0 := *abi.ConvertType(out[0], new(string)).(*string) + + return out0, err + +} + +// Symbol is a free data retrieval call binding the contract method 0x95d89b41. +// +// Solidity: function symbol() view returns(string) +func (_ERC721Full *ERC721FullSession) Symbol() (string, error) { + return _ERC721Full.Contract.Symbol(&_ERC721Full.CallOpts) +} + +// Symbol is a free data retrieval call binding the contract method 0x95d89b41. +// +// Solidity: function symbol() view returns(string) +func (_ERC721Full *ERC721FullCallerSession) Symbol() (string, error) { + return _ERC721Full.Contract.Symbol(&_ERC721Full.CallOpts) +} + +// TokenByIndex is a free data retrieval call binding the contract method 0x4f6ccce7. +// +// Solidity: function tokenByIndex(uint256 index) view returns(uint256) +func (_ERC721Full *ERC721FullCaller) TokenByIndex(opts *bind.CallOpts, index *big.Int) (*big.Int, error) { + var out []interface{} + err := _ERC721Full.contract.Call(opts, &out, "tokenByIndex", index) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// TokenByIndex is a free data retrieval call binding the contract method 0x4f6ccce7. +// +// Solidity: function tokenByIndex(uint256 index) view returns(uint256) +func (_ERC721Full *ERC721FullSession) TokenByIndex(index *big.Int) (*big.Int, error) { + return _ERC721Full.Contract.TokenByIndex(&_ERC721Full.CallOpts, index) +} + +// TokenByIndex is a free data retrieval call binding the contract method 0x4f6ccce7. +// +// Solidity: function tokenByIndex(uint256 index) view returns(uint256) +func (_ERC721Full *ERC721FullCallerSession) TokenByIndex(index *big.Int) (*big.Int, error) { + return _ERC721Full.Contract.TokenByIndex(&_ERC721Full.CallOpts, index) +} + +// TokenOfOwnerByIndex is a free data retrieval call binding the contract method 0x2f745c59. +// +// Solidity: function tokenOfOwnerByIndex(address owner, uint256 index) view returns(uint256) +func (_ERC721Full *ERC721FullCaller) TokenOfOwnerByIndex(opts *bind.CallOpts, owner common.Address, index *big.Int) (*big.Int, error) { + var out []interface{} + err := _ERC721Full.contract.Call(opts, &out, "tokenOfOwnerByIndex", owner, index) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// TokenOfOwnerByIndex is a free data retrieval call binding the contract method 0x2f745c59. +// +// Solidity: function tokenOfOwnerByIndex(address owner, uint256 index) view returns(uint256) +func (_ERC721Full *ERC721FullSession) TokenOfOwnerByIndex(owner common.Address, index *big.Int) (*big.Int, error) { + return _ERC721Full.Contract.TokenOfOwnerByIndex(&_ERC721Full.CallOpts, owner, index) +} + +// TokenOfOwnerByIndex is a free data retrieval call binding the contract method 0x2f745c59. +// +// Solidity: function tokenOfOwnerByIndex(address owner, uint256 index) view returns(uint256) +func (_ERC721Full *ERC721FullCallerSession) TokenOfOwnerByIndex(owner common.Address, index *big.Int) (*big.Int, error) { + return _ERC721Full.Contract.TokenOfOwnerByIndex(&_ERC721Full.CallOpts, owner, index) +} + +// TokenURI is a free data retrieval call binding the contract method 0xc87b56dd. +// +// Solidity: function tokenURI(uint256 tokenId) view returns(string) +func (_ERC721Full *ERC721FullCaller) TokenURI(opts *bind.CallOpts, tokenId *big.Int) (string, error) { + var out []interface{} + err := _ERC721Full.contract.Call(opts, &out, "tokenURI", tokenId) + + if err != nil { + return *new(string), err + } + + out0 := *abi.ConvertType(out[0], new(string)).(*string) + + return out0, err + +} + +// TokenURI is a free data retrieval call binding the contract method 0xc87b56dd. +// +// Solidity: function tokenURI(uint256 tokenId) view returns(string) +func (_ERC721Full *ERC721FullSession) TokenURI(tokenId *big.Int) (string, error) { + return _ERC721Full.Contract.TokenURI(&_ERC721Full.CallOpts, tokenId) +} + +// TokenURI is a free data retrieval call binding the contract method 0xc87b56dd. +// +// Solidity: function tokenURI(uint256 tokenId) view returns(string) +func (_ERC721Full *ERC721FullCallerSession) TokenURI(tokenId *big.Int) (string, error) { + return _ERC721Full.Contract.TokenURI(&_ERC721Full.CallOpts, tokenId) +} + +// TotalSupply is a free data retrieval call binding the contract method 0x18160ddd. +// +// Solidity: function totalSupply() view returns(uint256) +func (_ERC721Full *ERC721FullCaller) TotalSupply(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _ERC721Full.contract.Call(opts, &out, "totalSupply") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// TotalSupply is a free data retrieval call binding the contract method 0x18160ddd. +// +// Solidity: function totalSupply() view returns(uint256) +func (_ERC721Full *ERC721FullSession) TotalSupply() (*big.Int, error) { + return _ERC721Full.Contract.TotalSupply(&_ERC721Full.CallOpts) +} + +// TotalSupply is a free data retrieval call binding the contract method 0x18160ddd. +// +// Solidity: function totalSupply() view returns(uint256) +func (_ERC721Full *ERC721FullCallerSession) TotalSupply() (*big.Int, error) { + return _ERC721Full.Contract.TotalSupply(&_ERC721Full.CallOpts) +} + +// Approve is a paid mutator transaction binding the contract method 0x095ea7b3. +// +// Solidity: function approve(address to, uint256 tokenId) returns() +func (_ERC721Full *ERC721FullTransactor) Approve(opts *bind.TransactOpts, to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _ERC721Full.contract.Transact(opts, "approve", to, tokenId) +} + +// Approve is a paid mutator transaction binding the contract method 0x095ea7b3. +// +// Solidity: function approve(address to, uint256 tokenId) returns() +func (_ERC721Full *ERC721FullSession) Approve(to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _ERC721Full.Contract.Approve(&_ERC721Full.TransactOpts, to, tokenId) +} + +// Approve is a paid mutator transaction binding the contract method 0x095ea7b3. +// +// Solidity: function approve(address to, uint256 tokenId) returns() +func (_ERC721Full *ERC721FullTransactorSession) Approve(to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _ERC721Full.Contract.Approve(&_ERC721Full.TransactOpts, to, tokenId) +} + +// SafeTransferFrom is a paid mutator transaction binding the contract method 0x42842e0e. +// +// Solidity: function safeTransferFrom(address from, address to, uint256 tokenId) returns() +func (_ERC721Full *ERC721FullTransactor) SafeTransferFrom(opts *bind.TransactOpts, from common.Address, to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _ERC721Full.contract.Transact(opts, "safeTransferFrom", from, to, tokenId) +} + +// SafeTransferFrom is a paid mutator transaction binding the contract method 0x42842e0e. +// +// Solidity: function safeTransferFrom(address from, address to, uint256 tokenId) returns() +func (_ERC721Full *ERC721FullSession) SafeTransferFrom(from common.Address, to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _ERC721Full.Contract.SafeTransferFrom(&_ERC721Full.TransactOpts, from, to, tokenId) +} + +// SafeTransferFrom is a paid mutator transaction binding the contract method 0x42842e0e. +// +// Solidity: function safeTransferFrom(address from, address to, uint256 tokenId) returns() +func (_ERC721Full *ERC721FullTransactorSession) SafeTransferFrom(from common.Address, to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _ERC721Full.Contract.SafeTransferFrom(&_ERC721Full.TransactOpts, from, to, tokenId) +} + +// SafeTransferFrom0 is a paid mutator transaction binding the contract method 0xb88d4fde. +// +// Solidity: function safeTransferFrom(address from, address to, uint256 tokenId, bytes _data) returns() +func (_ERC721Full *ERC721FullTransactor) SafeTransferFrom0(opts *bind.TransactOpts, from common.Address, to common.Address, tokenId *big.Int, _data []byte) (*types.Transaction, error) { + return _ERC721Full.contract.Transact(opts, "safeTransferFrom0", from, to, tokenId, _data) +} + +// SafeTransferFrom0 is a paid mutator transaction binding the contract method 0xb88d4fde. +// +// Solidity: function safeTransferFrom(address from, address to, uint256 tokenId, bytes _data) returns() +func (_ERC721Full *ERC721FullSession) SafeTransferFrom0(from common.Address, to common.Address, tokenId *big.Int, _data []byte) (*types.Transaction, error) { + return _ERC721Full.Contract.SafeTransferFrom0(&_ERC721Full.TransactOpts, from, to, tokenId, _data) +} + +// SafeTransferFrom0 is a paid mutator transaction binding the contract method 0xb88d4fde. +// +// Solidity: function safeTransferFrom(address from, address to, uint256 tokenId, bytes _data) returns() +func (_ERC721Full *ERC721FullTransactorSession) SafeTransferFrom0(from common.Address, to common.Address, tokenId *big.Int, _data []byte) (*types.Transaction, error) { + return _ERC721Full.Contract.SafeTransferFrom0(&_ERC721Full.TransactOpts, from, to, tokenId, _data) +} + +// SetApprovalForAll is a paid mutator transaction binding the contract method 0xa22cb465. +// +// Solidity: function setApprovalForAll(address to, bool approved) returns() +func (_ERC721Full *ERC721FullTransactor) SetApprovalForAll(opts *bind.TransactOpts, to common.Address, approved bool) (*types.Transaction, error) { + return _ERC721Full.contract.Transact(opts, "setApprovalForAll", to, approved) +} + +// SetApprovalForAll is a paid mutator transaction binding the contract method 0xa22cb465. +// +// Solidity: function setApprovalForAll(address to, bool approved) returns() +func (_ERC721Full *ERC721FullSession) SetApprovalForAll(to common.Address, approved bool) (*types.Transaction, error) { + return _ERC721Full.Contract.SetApprovalForAll(&_ERC721Full.TransactOpts, to, approved) +} + +// SetApprovalForAll is a paid mutator transaction binding the contract method 0xa22cb465. +// +// Solidity: function setApprovalForAll(address to, bool approved) returns() +func (_ERC721Full *ERC721FullTransactorSession) SetApprovalForAll(to common.Address, approved bool) (*types.Transaction, error) { + return _ERC721Full.Contract.SetApprovalForAll(&_ERC721Full.TransactOpts, to, approved) +} + +// TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd. +// +// Solidity: function transferFrom(address from, address to, uint256 tokenId) returns() +func (_ERC721Full *ERC721FullTransactor) TransferFrom(opts *bind.TransactOpts, from common.Address, to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _ERC721Full.contract.Transact(opts, "transferFrom", from, to, tokenId) +} + +// TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd. +// +// Solidity: function transferFrom(address from, address to, uint256 tokenId) returns() +func (_ERC721Full *ERC721FullSession) TransferFrom(from common.Address, to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _ERC721Full.Contract.TransferFrom(&_ERC721Full.TransactOpts, from, to, tokenId) +} + +// TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd. +// +// Solidity: function transferFrom(address from, address to, uint256 tokenId) returns() +func (_ERC721Full *ERC721FullTransactorSession) TransferFrom(from common.Address, to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _ERC721Full.Contract.TransferFrom(&_ERC721Full.TransactOpts, from, to, tokenId) +} + +// ERC721FullApprovalIterator is returned from FilterApproval and is used to iterate over the raw logs and unpacked data for Approval events raised by the ERC721Full contract. +type ERC721FullApprovalIterator struct { + Event *ERC721FullApproval // 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 *ERC721FullApprovalIterator) 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(ERC721FullApproval) + 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(ERC721FullApproval) + 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 *ERC721FullApprovalIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ERC721FullApprovalIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ERC721FullApproval represents a Approval event raised by the ERC721Full contract. +type ERC721FullApproval struct { + Owner common.Address + Approved common.Address + TokenId *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterApproval is a free log retrieval operation binding the contract event 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925. +// +// Solidity: event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId) +func (_ERC721Full *ERC721FullFilterer) FilterApproval(opts *bind.FilterOpts, owner []common.Address, approved []common.Address, tokenId []*big.Int) (*ERC721FullApprovalIterator, error) { + + var ownerRule []interface{} + for _, ownerItem := range owner { + ownerRule = append(ownerRule, ownerItem) + } + var approvedRule []interface{} + for _, approvedItem := range approved { + approvedRule = append(approvedRule, approvedItem) + } + var tokenIdRule []interface{} + for _, tokenIdItem := range tokenId { + tokenIdRule = append(tokenIdRule, tokenIdItem) + } + + logs, sub, err := _ERC721Full.contract.FilterLogs(opts, "Approval", ownerRule, approvedRule, tokenIdRule) + if err != nil { + return nil, err + } + return &ERC721FullApprovalIterator{contract: _ERC721Full.contract, event: "Approval", logs: logs, sub: sub}, nil +} + +// WatchApproval is a free log subscription operation binding the contract event 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925. +// +// Solidity: event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId) +func (_ERC721Full *ERC721FullFilterer) WatchApproval(opts *bind.WatchOpts, sink chan<- *ERC721FullApproval, owner []common.Address, approved []common.Address, tokenId []*big.Int) (event.Subscription, error) { + + var ownerRule []interface{} + for _, ownerItem := range owner { + ownerRule = append(ownerRule, ownerItem) + } + var approvedRule []interface{} + for _, approvedItem := range approved { + approvedRule = append(approvedRule, approvedItem) + } + var tokenIdRule []interface{} + for _, tokenIdItem := range tokenId { + tokenIdRule = append(tokenIdRule, tokenIdItem) + } + + logs, sub, err := _ERC721Full.contract.WatchLogs(opts, "Approval", ownerRule, approvedRule, tokenIdRule) + 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(ERC721FullApproval) + if err := _ERC721Full.contract.UnpackLog(event, "Approval", 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 +} + +// ParseApproval is a log parse operation binding the contract event 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925. +// +// Solidity: event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId) +func (_ERC721Full *ERC721FullFilterer) ParseApproval(log types.Log) (*ERC721FullApproval, error) { + event := new(ERC721FullApproval) + if err := _ERC721Full.contract.UnpackLog(event, "Approval", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ERC721FullApprovalForAllIterator is returned from FilterApprovalForAll and is used to iterate over the raw logs and unpacked data for ApprovalForAll events raised by the ERC721Full contract. +type ERC721FullApprovalForAllIterator struct { + Event *ERC721FullApprovalForAll // 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 *ERC721FullApprovalForAllIterator) 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(ERC721FullApprovalForAll) + 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(ERC721FullApprovalForAll) + 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 *ERC721FullApprovalForAllIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ERC721FullApprovalForAllIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ERC721FullApprovalForAll represents a ApprovalForAll event raised by the ERC721Full contract. +type ERC721FullApprovalForAll struct { + Owner common.Address + Operator common.Address + Approved bool + Raw types.Log // Blockchain specific contextual infos +} + +// FilterApprovalForAll is a free log retrieval operation binding the contract event 0x17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31. +// +// Solidity: event ApprovalForAll(address indexed owner, address indexed operator, bool approved) +func (_ERC721Full *ERC721FullFilterer) FilterApprovalForAll(opts *bind.FilterOpts, owner []common.Address, operator []common.Address) (*ERC721FullApprovalForAllIterator, error) { + + var ownerRule []interface{} + for _, ownerItem := range owner { + ownerRule = append(ownerRule, ownerItem) + } + var operatorRule []interface{} + for _, operatorItem := range operator { + operatorRule = append(operatorRule, operatorItem) + } + + logs, sub, err := _ERC721Full.contract.FilterLogs(opts, "ApprovalForAll", ownerRule, operatorRule) + if err != nil { + return nil, err + } + return &ERC721FullApprovalForAllIterator{contract: _ERC721Full.contract, event: "ApprovalForAll", logs: logs, sub: sub}, nil +} + +// WatchApprovalForAll is a free log subscription operation binding the contract event 0x17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31. +// +// Solidity: event ApprovalForAll(address indexed owner, address indexed operator, bool approved) +func (_ERC721Full *ERC721FullFilterer) WatchApprovalForAll(opts *bind.WatchOpts, sink chan<- *ERC721FullApprovalForAll, owner []common.Address, operator []common.Address) (event.Subscription, error) { + + var ownerRule []interface{} + for _, ownerItem := range owner { + ownerRule = append(ownerRule, ownerItem) + } + var operatorRule []interface{} + for _, operatorItem := range operator { + operatorRule = append(operatorRule, operatorItem) + } + + logs, sub, err := _ERC721Full.contract.WatchLogs(opts, "ApprovalForAll", ownerRule, operatorRule) + 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(ERC721FullApprovalForAll) + if err := _ERC721Full.contract.UnpackLog(event, "ApprovalForAll", 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 +} + +// ParseApprovalForAll is a log parse operation binding the contract event 0x17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31. +// +// Solidity: event ApprovalForAll(address indexed owner, address indexed operator, bool approved) +func (_ERC721Full *ERC721FullFilterer) ParseApprovalForAll(log types.Log) (*ERC721FullApprovalForAll, error) { + event := new(ERC721FullApprovalForAll) + if err := _ERC721Full.contract.UnpackLog(event, "ApprovalForAll", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ERC721FullTransferIterator is returned from FilterTransfer and is used to iterate over the raw logs and unpacked data for Transfer events raised by the ERC721Full contract. +type ERC721FullTransferIterator struct { + Event *ERC721FullTransfer // 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 *ERC721FullTransferIterator) 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(ERC721FullTransfer) + 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(ERC721FullTransfer) + 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 *ERC721FullTransferIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ERC721FullTransferIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ERC721FullTransfer represents a Transfer event raised by the ERC721Full contract. +type ERC721FullTransfer struct { + From common.Address + To common.Address + TokenId *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterTransfer is a free log retrieval operation binding the contract event 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef. +// +// Solidity: event Transfer(address indexed from, address indexed to, uint256 indexed tokenId) +func (_ERC721Full *ERC721FullFilterer) FilterTransfer(opts *bind.FilterOpts, from []common.Address, to []common.Address, tokenId []*big.Int) (*ERC721FullTransferIterator, error) { + + var fromRule []interface{} + for _, fromItem := range from { + fromRule = append(fromRule, fromItem) + } + var toRule []interface{} + for _, toItem := range to { + toRule = append(toRule, toItem) + } + var tokenIdRule []interface{} + for _, tokenIdItem := range tokenId { + tokenIdRule = append(tokenIdRule, tokenIdItem) + } + + logs, sub, err := _ERC721Full.contract.FilterLogs(opts, "Transfer", fromRule, toRule, tokenIdRule) + if err != nil { + return nil, err + } + return &ERC721FullTransferIterator{contract: _ERC721Full.contract, event: "Transfer", logs: logs, sub: sub}, nil +} + +// WatchTransfer is a free log subscription operation binding the contract event 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef. +// +// Solidity: event Transfer(address indexed from, address indexed to, uint256 indexed tokenId) +func (_ERC721Full *ERC721FullFilterer) WatchTransfer(opts *bind.WatchOpts, sink chan<- *ERC721FullTransfer, from []common.Address, to []common.Address, tokenId []*big.Int) (event.Subscription, error) { + + var fromRule []interface{} + for _, fromItem := range from { + fromRule = append(fromRule, fromItem) + } + var toRule []interface{} + for _, toItem := range to { + toRule = append(toRule, toItem) + } + var tokenIdRule []interface{} + for _, tokenIdItem := range tokenId { + tokenIdRule = append(tokenIdRule, tokenIdItem) + } + + logs, sub, err := _ERC721Full.contract.WatchLogs(opts, "Transfer", fromRule, toRule, tokenIdRule) + 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(ERC721FullTransfer) + if err := _ERC721Full.contract.UnpackLog(event, "Transfer", 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 +} + +// ParseTransfer is a log parse operation binding the contract event 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef. +// +// Solidity: event Transfer(address indexed from, address indexed to, uint256 indexed tokenId) +func (_ERC721Full *ERC721FullFilterer) ParseTransfer(log types.Log) (*ERC721FullTransfer, error) { + event := new(ERC721FullTransfer) + if err := _ERC721Full.contract.UnpackLog(event, "Transfer", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ERC721MetadataABI is the input ABI used to generate the binding from. +const ERC721MetadataABI = "[{\"constant\":true,\"inputs\":[{\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"getApproved\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"to\",\"type\":\"address\"},{\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"from\",\"type\":\"address\"},{\"name\":\"to\",\"type\":\"address\"},{\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"from\",\"type\":\"address\"},{\"name\":\"to\",\"type\":\"address\"},{\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"safeTransferFrom\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"ownerOf\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"symbol\",\"outputs\":[{\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"to\",\"type\":\"address\"},{\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"setApprovalForAll\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"from\",\"type\":\"address\"},{\"name\":\"to\",\"type\":\"address\"},{\"name\":\"tokenId\",\"type\":\"uint256\"},{\"name\":\"_data\",\"type\":\"bytes\"}],\"name\":\"safeTransferFrom\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"tokenURI\",\"outputs\":[{\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"owner\",\"type\":\"address\"},{\"name\":\"operator\",\"type\":\"address\"}],\"name\":\"isApprovedForAll\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"name\":\"name\",\"type\":\"string\"},{\"name\":\"symbol\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"to\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"approved\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"ApprovalForAll\",\"type\":\"event\"}]" + +// ERC721MetadataFuncSigs maps the 4-byte function signature to its string representation. +var ERC721MetadataFuncSigs = map[string]string{ + "095ea7b3": "approve(address,uint256)", + "70a08231": "balanceOf(address)", + "081812fc": "getApproved(uint256)", + "e985e9c5": "isApprovedForAll(address,address)", + "06fdde03": "name()", + "6352211e": "ownerOf(uint256)", + "42842e0e": "safeTransferFrom(address,address,uint256)", + "b88d4fde": "safeTransferFrom(address,address,uint256,bytes)", + "a22cb465": "setApprovalForAll(address,bool)", + "01ffc9a7": "supportsInterface(bytes4)", + "95d89b41": "symbol()", + "c87b56dd": "tokenURI(uint256)", + "23b872dd": "transferFrom(address,address,uint256)", +} + +// ERC721MetadataBin is the compiled bytecode used for deploying new contracts. +var ERC721MetadataBin = "0x60806040523480156200001157600080fd5b506040516200132938038062001329833981810160405260408110156200003757600080fd5b8101908080516401000000008111156200005057600080fd5b820160208101848111156200006457600080fd5b81516401000000008111828201871017156200007f57600080fd5b505092919060200180516401000000008111156200009c57600080fd5b82016020810184811115620000b057600080fd5b8151640100000000811182820187101715620000cb57600080fd5b509093506200010892507f01ffc9a7000000000000000000000000000000000000000000000000000000009150506001600160e01b03620001a416565b6200013c7f80ac58cd000000000000000000000000000000000000000000000000000000006001600160e01b03620001a416565b81516200015190600590602085019062000273565b5080516200016790600690602084019062000273565b506200019c7f5b5e139f000000000000000000000000000000000000000000000000000000006001600160e01b03620001a416565b505062000318565b7fffffffff0000000000000000000000000000000000000000000000000000000080821614156200023657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f4552433136353a20696e76616c696420696e7465726661636520696400000000604482015290519081900360640190fd5b7fffffffff00000000000000000000000000000000000000000000000000000000166000908152602081905260409020805460ff19166001179055565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10620002b657805160ff1916838001178555620002e6565b82800160010185558215620002e6579182015b82811115620002e6578251825591602001919060010190620002c9565b50620002f4929150620002f8565b5090565b6200031591905b80821115620002f45760008155600101620002ff565b90565b61100180620003286000396000f3fe608060405234801561001057600080fd5b50600436106100cf5760003560e01c80636352211e1161008c578063a22cb46511610066578063a22cb465146102bc578063b88d4fde146102ea578063c87b56dd146103b0578063e985e9c5146103cd576100cf565b80636352211e1461025f57806370a082311461027c57806395d89b41146102b4576100cf565b806301ffc9a7146100d457806306fdde031461010f578063081812fc1461018c578063095ea7b3146101c557806323b872dd146101f357806342842e0e14610229575b600080fd5b6100fb600480360360208110156100ea57600080fd5b50356001600160e01b0319166103fb565b604080519115158252519081900360200190f35b61011761041a565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610151578181015183820152602001610139565b50505050905090810190601f16801561017e5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101a9600480360360208110156101a257600080fd5b50356104b0565b604080516001600160a01b039092168252519081900360200190f35b6101f1600480360360408110156101db57600080fd5b506001600160a01b038135169060200135610512565b005b6101f16004803603606081101561020957600080fd5b506001600160a01b03813581169160208101359091169060400135610623565b6101f16004803603606081101561023f57600080fd5b506001600160a01b03813581169160208101359091169060400135610678565b6101a96004803603602081101561027557600080fd5b5035610693565b6102a26004803603602081101561029257600080fd5b50356001600160a01b03166106ed565b60408051918252519081900360200190f35b610117610755565b6101f1600480360360408110156102d257600080fd5b506001600160a01b03813516906020013515156107b6565b6101f16004803603608081101561030057600080fd5b6001600160a01b0382358116926020810135909116916040820135919081019060808101606082013564010000000081111561033b57600080fd5b82018360208201111561034d57600080fd5b8035906020019184600183028401116401000000008311171561036f57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610882945050505050565b610117600480360360208110156103c657600080fd5b50356108da565b6100fb600480360360408110156103e357600080fd5b506001600160a01b03813581169160200135166109bf565b6001600160e01b03191660009081526020819052604090205460ff1690565b60058054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156104a65780601f1061047b576101008083540402835291602001916104a6565b820191906000526020600020905b81548152906001019060200180831161048957829003601f168201915b5050505050905090565b60006104bb826109ed565b6104f65760405162461bcd60e51b815260040180806020018281038252602c815260200180610ef7602c913960400191505060405180910390fd5b506000908152600260205260409020546001600160a01b031690565b600061051d82610693565b9050806001600160a01b0316836001600160a01b031614156105705760405162461bcd60e51b8152600401808060200182810382526021815260200180610f7b6021913960400191505060405180910390fd5b336001600160a01b038216148061058c575061058c81336109bf565b6105c75760405162461bcd60e51b8152600401808060200182810382526038815260200180610e6c6038913960400191505060405180910390fd5b60008281526002602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b61062d3382610a0a565b6106685760405162461bcd60e51b8152600401808060200182810382526031815260200180610f9c6031913960400191505060405180910390fd5b610673838383610aae565b505050565b61067383838360405180602001604052806000815250610882565b6000818152600160205260408120546001600160a01b0316806106e75760405162461bcd60e51b8152600401808060200182810382526029815260200180610ece6029913960400191505060405180910390fd5b92915050565b60006001600160a01b0382166107345760405162461bcd60e51b815260040180806020018281038252602a815260200180610ea4602a913960400191505060405180910390fd5b6001600160a01b03821660009081526003602052604090206106e790610bf2565b60068054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156104a65780601f1061047b576101008083540402835291602001916104a6565b6001600160a01b038216331415610814576040805162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c657200000000000000604482015290519081900360640190fd5b3360008181526004602090815260408083206001600160a01b03871680855290835292819020805460ff1916861515908117909155815190815290519293927f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31929181900390910190a35050565b61088d848484610623565b61089984848484610bf6565b6108d45760405162461bcd60e51b8152600401808060200182810382526032815260200180610dea6032913960400191505060405180910390fd5b50505050565b60606108e5826109ed565b6109205760405162461bcd60e51b815260040180806020018281038252602f815260200180610f4c602f913960400191505060405180910390fd5b60008281526007602090815260409182902080548351601f6002600019610100600186161502019093169290920491820184900484028101840190945280845290918301828280156109b35780601f10610988576101008083540402835291602001916109b3565b820191906000526020600020905b81548152906001019060200180831161099657829003601f168201915b50505050509050919050565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205460ff1690565b6000908152600160205260409020546001600160a01b0316151590565b6000610a15826109ed565b610a505760405162461bcd60e51b815260040180806020018281038252602c815260200180610e40602c913960400191505060405180910390fd5b6000610a5b83610693565b9050806001600160a01b0316846001600160a01b03161480610a965750836001600160a01b0316610a8b846104b0565b6001600160a01b0316145b80610aa65750610aa681856109bf565b949350505050565b826001600160a01b0316610ac182610693565b6001600160a01b031614610b065760405162461bcd60e51b8152600401808060200182810382526029815260200180610f236029913960400191505060405180910390fd5b6001600160a01b038216610b4b5760405162461bcd60e51b8152600401808060200182810382526024815260200180610e1c6024913960400191505060405180910390fd5b610b5481610d29565b6001600160a01b0383166000908152600360205260409020610b7590610d66565b6001600160a01b0382166000908152600360205260409020610b9690610d7d565b60008181526001602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b5490565b6000610c0a846001600160a01b0316610d86565b610c1657506001610aa6565b604051630a85bd0160e11b815233600482018181526001600160a01b03888116602485015260448401879052608060648501908152865160848601528651600095928a169463150b7a029490938c938b938b939260a4019060208501908083838e5b83811015610c90578181015183820152602001610c78565b50505050905090810190601f168015610cbd5780820380516001836020036101000a031916815260200191505b5095505050505050602060405180830381600087803b158015610cdf57600080fd5b505af1158015610cf3573d6000803e3d6000fd5b505050506040513d6020811015610d0957600080fd5b50516001600160e01b031916630a85bd0160e11b14915050949350505050565b6000818152600260205260409020546001600160a01b031615610d6357600081815260026020526040902080546001600160a01b03191690555b50565b8054610d7990600163ffffffff610d8c16565b9055565b80546001019055565b3b151590565b600082821115610de3576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b5090039056fe4552433732313a207472616e7366657220746f206e6f6e20455243373231526563656976657220696d706c656d656e7465724552433732313a207472616e7366657220746f20746865207a65726f20616464726573734552433732313a206f70657261746f7220717565727920666f72206e6f6e6578697374656e7420746f6b656e4552433732313a20617070726f76652063616c6c6572206973206e6f74206f776e6572206e6f7220617070726f76656420666f7220616c6c4552433732313a2062616c616e636520717565727920666f7220746865207a65726f20616464726573734552433732313a206f776e657220717565727920666f72206e6f6e6578697374656e7420746f6b656e4552433732313a20617070726f76656420717565727920666f72206e6f6e6578697374656e7420746f6b656e4552433732313a207472616e73666572206f6620746f6b656e2074686174206973206e6f74206f776e4552433732314d657461646174613a2055524920717565727920666f72206e6f6e6578697374656e7420746f6b656e4552433732313a20617070726f76616c20746f2063757272656e74206f776e65724552433732313a207472616e736665722063616c6c6572206973206e6f74206f776e6572206e6f7220617070726f766564a265627a7a72305820bd2b77d3744be655b2627d14e3d21d805bc03b7c2ee4383fae4d61be2212f04a64736f6c634300050a0032" + +// DeployERC721Metadata deploys a new Ethereum contract, binding an instance of ERC721Metadata to it. +func DeployERC721Metadata(auth *bind.TransactOpts, backend bind.ContractBackend, name string, symbol string) (common.Address, *types.Transaction, *ERC721Metadata, error) { + parsed, err := abi.JSON(strings.NewReader(ERC721MetadataABI)) + if err != nil { + return common.Address{}, nil, nil, err + } + + address, tx, contract, err := bind.DeployContract(auth, parsed, common.FromHex(ERC721MetadataBin), backend, name, symbol) + if err != nil { + return common.Address{}, nil, nil, err + } + return address, tx, &ERC721Metadata{ERC721MetadataCaller: ERC721MetadataCaller{contract: contract}, ERC721MetadataTransactor: ERC721MetadataTransactor{contract: contract}, ERC721MetadataFilterer: ERC721MetadataFilterer{contract: contract}}, nil +} + +// ERC721Metadata is an auto generated Go binding around an Ethereum contract. +type ERC721Metadata struct { + ERC721MetadataCaller // Read-only binding to the contract + ERC721MetadataTransactor // Write-only binding to the contract + ERC721MetadataFilterer // Log filterer for contract events +} + +// ERC721MetadataCaller is an auto generated read-only Go binding around an Ethereum contract. +type ERC721MetadataCaller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// ERC721MetadataTransactor is an auto generated write-only Go binding around an Ethereum contract. +type ERC721MetadataTransactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// ERC721MetadataFilterer is an auto generated log filtering Go binding around an Ethereum contract events. +type ERC721MetadataFilterer struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// ERC721MetadataSession is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type ERC721MetadataSession struct { + Contract *ERC721Metadata // 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 +} + +// ERC721MetadataCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type ERC721MetadataCallerSession struct { + Contract *ERC721MetadataCaller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// ERC721MetadataTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type ERC721MetadataTransactorSession struct { + Contract *ERC721MetadataTransactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// ERC721MetadataRaw is an auto generated low-level Go binding around an Ethereum contract. +type ERC721MetadataRaw struct { + Contract *ERC721Metadata // Generic contract binding to access the raw methods on +} + +// ERC721MetadataCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type ERC721MetadataCallerRaw struct { + Contract *ERC721MetadataCaller // Generic read-only contract binding to access the raw methods on +} + +// ERC721MetadataTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type ERC721MetadataTransactorRaw struct { + Contract *ERC721MetadataTransactor // Generic write-only contract binding to access the raw methods on +} + +// NewERC721Metadata creates a new instance of ERC721Metadata, bound to a specific deployed contract. +func NewERC721Metadata(address common.Address, backend bind.ContractBackend) (*ERC721Metadata, error) { + contract, err := bindERC721Metadata(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &ERC721Metadata{ERC721MetadataCaller: ERC721MetadataCaller{contract: contract}, ERC721MetadataTransactor: ERC721MetadataTransactor{contract: contract}, ERC721MetadataFilterer: ERC721MetadataFilterer{contract: contract}}, nil +} + +// NewERC721MetadataCaller creates a new read-only instance of ERC721Metadata, bound to a specific deployed contract. +func NewERC721MetadataCaller(address common.Address, caller bind.ContractCaller) (*ERC721MetadataCaller, error) { + contract, err := bindERC721Metadata(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &ERC721MetadataCaller{contract: contract}, nil +} + +// NewERC721MetadataTransactor creates a new write-only instance of ERC721Metadata, bound to a specific deployed contract. +func NewERC721MetadataTransactor(address common.Address, transactor bind.ContractTransactor) (*ERC721MetadataTransactor, error) { + contract, err := bindERC721Metadata(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &ERC721MetadataTransactor{contract: contract}, nil +} + +// NewERC721MetadataFilterer creates a new log filterer instance of ERC721Metadata, bound to a specific deployed contract. +func NewERC721MetadataFilterer(address common.Address, filterer bind.ContractFilterer) (*ERC721MetadataFilterer, error) { + contract, err := bindERC721Metadata(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &ERC721MetadataFilterer{contract: contract}, nil +} + +// bindERC721Metadata binds a generic wrapper to an already deployed contract. +func bindERC721Metadata(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := abi.JSON(strings.NewReader(ERC721MetadataABI)) + 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 (_ERC721Metadata *ERC721MetadataRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _ERC721Metadata.Contract.ERC721MetadataCaller.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 (_ERC721Metadata *ERC721MetadataRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _ERC721Metadata.Contract.ERC721MetadataTransactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_ERC721Metadata *ERC721MetadataRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _ERC721Metadata.Contract.ERC721MetadataTransactor.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 (_ERC721Metadata *ERC721MetadataCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _ERC721Metadata.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 (_ERC721Metadata *ERC721MetadataTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _ERC721Metadata.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_ERC721Metadata *ERC721MetadataTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _ERC721Metadata.Contract.contract.Transact(opts, method, params...) +} + +// BalanceOf is a free data retrieval call binding the contract method 0x70a08231. +// +// Solidity: function balanceOf(address owner) view returns(uint256) +func (_ERC721Metadata *ERC721MetadataCaller) BalanceOf(opts *bind.CallOpts, owner common.Address) (*big.Int, error) { + var out []interface{} + err := _ERC721Metadata.contract.Call(opts, &out, "balanceOf", owner) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// BalanceOf is a free data retrieval call binding the contract method 0x70a08231. +// +// Solidity: function balanceOf(address owner) view returns(uint256) +func (_ERC721Metadata *ERC721MetadataSession) BalanceOf(owner common.Address) (*big.Int, error) { + return _ERC721Metadata.Contract.BalanceOf(&_ERC721Metadata.CallOpts, owner) +} + +// BalanceOf is a free data retrieval call binding the contract method 0x70a08231. +// +// Solidity: function balanceOf(address owner) view returns(uint256) +func (_ERC721Metadata *ERC721MetadataCallerSession) BalanceOf(owner common.Address) (*big.Int, error) { + return _ERC721Metadata.Contract.BalanceOf(&_ERC721Metadata.CallOpts, owner) +} + +// GetApproved is a free data retrieval call binding the contract method 0x081812fc. +// +// Solidity: function getApproved(uint256 tokenId) view returns(address) +func (_ERC721Metadata *ERC721MetadataCaller) GetApproved(opts *bind.CallOpts, tokenId *big.Int) (common.Address, error) { + var out []interface{} + err := _ERC721Metadata.contract.Call(opts, &out, "getApproved", tokenId) + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// GetApproved is a free data retrieval call binding the contract method 0x081812fc. +// +// Solidity: function getApproved(uint256 tokenId) view returns(address) +func (_ERC721Metadata *ERC721MetadataSession) GetApproved(tokenId *big.Int) (common.Address, error) { + return _ERC721Metadata.Contract.GetApproved(&_ERC721Metadata.CallOpts, tokenId) +} + +// GetApproved is a free data retrieval call binding the contract method 0x081812fc. +// +// Solidity: function getApproved(uint256 tokenId) view returns(address) +func (_ERC721Metadata *ERC721MetadataCallerSession) GetApproved(tokenId *big.Int) (common.Address, error) { + return _ERC721Metadata.Contract.GetApproved(&_ERC721Metadata.CallOpts, tokenId) +} + +// IsApprovedForAll is a free data retrieval call binding the contract method 0xe985e9c5. +// +// Solidity: function isApprovedForAll(address owner, address operator) view returns(bool) +func (_ERC721Metadata *ERC721MetadataCaller) IsApprovedForAll(opts *bind.CallOpts, owner common.Address, operator common.Address) (bool, error) { + var out []interface{} + err := _ERC721Metadata.contract.Call(opts, &out, "isApprovedForAll", owner, operator) + + if err != nil { + return *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + + return out0, err + +} + +// IsApprovedForAll is a free data retrieval call binding the contract method 0xe985e9c5. +// +// Solidity: function isApprovedForAll(address owner, address operator) view returns(bool) +func (_ERC721Metadata *ERC721MetadataSession) IsApprovedForAll(owner common.Address, operator common.Address) (bool, error) { + return _ERC721Metadata.Contract.IsApprovedForAll(&_ERC721Metadata.CallOpts, owner, operator) +} + +// IsApprovedForAll is a free data retrieval call binding the contract method 0xe985e9c5. +// +// Solidity: function isApprovedForAll(address owner, address operator) view returns(bool) +func (_ERC721Metadata *ERC721MetadataCallerSession) IsApprovedForAll(owner common.Address, operator common.Address) (bool, error) { + return _ERC721Metadata.Contract.IsApprovedForAll(&_ERC721Metadata.CallOpts, owner, operator) +} + +// Name is a free data retrieval call binding the contract method 0x06fdde03. +// +// Solidity: function name() view returns(string) +func (_ERC721Metadata *ERC721MetadataCaller) Name(opts *bind.CallOpts) (string, error) { + var out []interface{} + err := _ERC721Metadata.contract.Call(opts, &out, "name") + + if err != nil { + return *new(string), err + } + + out0 := *abi.ConvertType(out[0], new(string)).(*string) + + return out0, err + +} + +// Name is a free data retrieval call binding the contract method 0x06fdde03. +// +// Solidity: function name() view returns(string) +func (_ERC721Metadata *ERC721MetadataSession) Name() (string, error) { + return _ERC721Metadata.Contract.Name(&_ERC721Metadata.CallOpts) +} + +// Name is a free data retrieval call binding the contract method 0x06fdde03. +// +// Solidity: function name() view returns(string) +func (_ERC721Metadata *ERC721MetadataCallerSession) Name() (string, error) { + return _ERC721Metadata.Contract.Name(&_ERC721Metadata.CallOpts) +} + +// OwnerOf is a free data retrieval call binding the contract method 0x6352211e. +// +// Solidity: function ownerOf(uint256 tokenId) view returns(address) +func (_ERC721Metadata *ERC721MetadataCaller) OwnerOf(opts *bind.CallOpts, tokenId *big.Int) (common.Address, error) { + var out []interface{} + err := _ERC721Metadata.contract.Call(opts, &out, "ownerOf", tokenId) + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// OwnerOf is a free data retrieval call binding the contract method 0x6352211e. +// +// Solidity: function ownerOf(uint256 tokenId) view returns(address) +func (_ERC721Metadata *ERC721MetadataSession) OwnerOf(tokenId *big.Int) (common.Address, error) { + return _ERC721Metadata.Contract.OwnerOf(&_ERC721Metadata.CallOpts, tokenId) +} + +// OwnerOf is a free data retrieval call binding the contract method 0x6352211e. +// +// Solidity: function ownerOf(uint256 tokenId) view returns(address) +func (_ERC721Metadata *ERC721MetadataCallerSession) OwnerOf(tokenId *big.Int) (common.Address, error) { + return _ERC721Metadata.Contract.OwnerOf(&_ERC721Metadata.CallOpts, tokenId) +} + +// SupportsInterface is a free data retrieval call binding the contract method 0x01ffc9a7. +// +// Solidity: function supportsInterface(bytes4 interfaceId) view returns(bool) +func (_ERC721Metadata *ERC721MetadataCaller) SupportsInterface(opts *bind.CallOpts, interfaceId [4]byte) (bool, error) { + var out []interface{} + err := _ERC721Metadata.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 (_ERC721Metadata *ERC721MetadataSession) SupportsInterface(interfaceId [4]byte) (bool, error) { + return _ERC721Metadata.Contract.SupportsInterface(&_ERC721Metadata.CallOpts, interfaceId) +} + +// SupportsInterface is a free data retrieval call binding the contract method 0x01ffc9a7. +// +// Solidity: function supportsInterface(bytes4 interfaceId) view returns(bool) +func (_ERC721Metadata *ERC721MetadataCallerSession) SupportsInterface(interfaceId [4]byte) (bool, error) { + return _ERC721Metadata.Contract.SupportsInterface(&_ERC721Metadata.CallOpts, interfaceId) +} + +// Symbol is a free data retrieval call binding the contract method 0x95d89b41. +// +// Solidity: function symbol() view returns(string) +func (_ERC721Metadata *ERC721MetadataCaller) Symbol(opts *bind.CallOpts) (string, error) { + var out []interface{} + err := _ERC721Metadata.contract.Call(opts, &out, "symbol") + + if err != nil { + return *new(string), err + } + + out0 := *abi.ConvertType(out[0], new(string)).(*string) + + return out0, err + +} + +// Symbol is a free data retrieval call binding the contract method 0x95d89b41. +// +// Solidity: function symbol() view returns(string) +func (_ERC721Metadata *ERC721MetadataSession) Symbol() (string, error) { + return _ERC721Metadata.Contract.Symbol(&_ERC721Metadata.CallOpts) +} + +// Symbol is a free data retrieval call binding the contract method 0x95d89b41. +// +// Solidity: function symbol() view returns(string) +func (_ERC721Metadata *ERC721MetadataCallerSession) Symbol() (string, error) { + return _ERC721Metadata.Contract.Symbol(&_ERC721Metadata.CallOpts) +} + +// TokenURI is a free data retrieval call binding the contract method 0xc87b56dd. +// +// Solidity: function tokenURI(uint256 tokenId) view returns(string) +func (_ERC721Metadata *ERC721MetadataCaller) TokenURI(opts *bind.CallOpts, tokenId *big.Int) (string, error) { + var out []interface{} + err := _ERC721Metadata.contract.Call(opts, &out, "tokenURI", tokenId) + + if err != nil { + return *new(string), err + } + + out0 := *abi.ConvertType(out[0], new(string)).(*string) + + return out0, err + +} + +// TokenURI is a free data retrieval call binding the contract method 0xc87b56dd. +// +// Solidity: function tokenURI(uint256 tokenId) view returns(string) +func (_ERC721Metadata *ERC721MetadataSession) TokenURI(tokenId *big.Int) (string, error) { + return _ERC721Metadata.Contract.TokenURI(&_ERC721Metadata.CallOpts, tokenId) +} + +// TokenURI is a free data retrieval call binding the contract method 0xc87b56dd. +// +// Solidity: function tokenURI(uint256 tokenId) view returns(string) +func (_ERC721Metadata *ERC721MetadataCallerSession) TokenURI(tokenId *big.Int) (string, error) { + return _ERC721Metadata.Contract.TokenURI(&_ERC721Metadata.CallOpts, tokenId) +} + +// Approve is a paid mutator transaction binding the contract method 0x095ea7b3. +// +// Solidity: function approve(address to, uint256 tokenId) returns() +func (_ERC721Metadata *ERC721MetadataTransactor) Approve(opts *bind.TransactOpts, to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _ERC721Metadata.contract.Transact(opts, "approve", to, tokenId) +} + +// Approve is a paid mutator transaction binding the contract method 0x095ea7b3. +// +// Solidity: function approve(address to, uint256 tokenId) returns() +func (_ERC721Metadata *ERC721MetadataSession) Approve(to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _ERC721Metadata.Contract.Approve(&_ERC721Metadata.TransactOpts, to, tokenId) +} + +// Approve is a paid mutator transaction binding the contract method 0x095ea7b3. +// +// Solidity: function approve(address to, uint256 tokenId) returns() +func (_ERC721Metadata *ERC721MetadataTransactorSession) Approve(to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _ERC721Metadata.Contract.Approve(&_ERC721Metadata.TransactOpts, to, tokenId) +} + +// SafeTransferFrom is a paid mutator transaction binding the contract method 0x42842e0e. +// +// Solidity: function safeTransferFrom(address from, address to, uint256 tokenId) returns() +func (_ERC721Metadata *ERC721MetadataTransactor) SafeTransferFrom(opts *bind.TransactOpts, from common.Address, to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _ERC721Metadata.contract.Transact(opts, "safeTransferFrom", from, to, tokenId) +} + +// SafeTransferFrom is a paid mutator transaction binding the contract method 0x42842e0e. +// +// Solidity: function safeTransferFrom(address from, address to, uint256 tokenId) returns() +func (_ERC721Metadata *ERC721MetadataSession) SafeTransferFrom(from common.Address, to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _ERC721Metadata.Contract.SafeTransferFrom(&_ERC721Metadata.TransactOpts, from, to, tokenId) +} + +// SafeTransferFrom is a paid mutator transaction binding the contract method 0x42842e0e. +// +// Solidity: function safeTransferFrom(address from, address to, uint256 tokenId) returns() +func (_ERC721Metadata *ERC721MetadataTransactorSession) SafeTransferFrom(from common.Address, to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _ERC721Metadata.Contract.SafeTransferFrom(&_ERC721Metadata.TransactOpts, from, to, tokenId) +} + +// SafeTransferFrom0 is a paid mutator transaction binding the contract method 0xb88d4fde. +// +// Solidity: function safeTransferFrom(address from, address to, uint256 tokenId, bytes _data) returns() +func (_ERC721Metadata *ERC721MetadataTransactor) SafeTransferFrom0(opts *bind.TransactOpts, from common.Address, to common.Address, tokenId *big.Int, _data []byte) (*types.Transaction, error) { + return _ERC721Metadata.contract.Transact(opts, "safeTransferFrom0", from, to, tokenId, _data) +} + +// SafeTransferFrom0 is a paid mutator transaction binding the contract method 0xb88d4fde. +// +// Solidity: function safeTransferFrom(address from, address to, uint256 tokenId, bytes _data) returns() +func (_ERC721Metadata *ERC721MetadataSession) SafeTransferFrom0(from common.Address, to common.Address, tokenId *big.Int, _data []byte) (*types.Transaction, error) { + return _ERC721Metadata.Contract.SafeTransferFrom0(&_ERC721Metadata.TransactOpts, from, to, tokenId, _data) +} + +// SafeTransferFrom0 is a paid mutator transaction binding the contract method 0xb88d4fde. +// +// Solidity: function safeTransferFrom(address from, address to, uint256 tokenId, bytes _data) returns() +func (_ERC721Metadata *ERC721MetadataTransactorSession) SafeTransferFrom0(from common.Address, to common.Address, tokenId *big.Int, _data []byte) (*types.Transaction, error) { + return _ERC721Metadata.Contract.SafeTransferFrom0(&_ERC721Metadata.TransactOpts, from, to, tokenId, _data) +} + +// SetApprovalForAll is a paid mutator transaction binding the contract method 0xa22cb465. +// +// Solidity: function setApprovalForAll(address to, bool approved) returns() +func (_ERC721Metadata *ERC721MetadataTransactor) SetApprovalForAll(opts *bind.TransactOpts, to common.Address, approved bool) (*types.Transaction, error) { + return _ERC721Metadata.contract.Transact(opts, "setApprovalForAll", to, approved) +} + +// SetApprovalForAll is a paid mutator transaction binding the contract method 0xa22cb465. +// +// Solidity: function setApprovalForAll(address to, bool approved) returns() +func (_ERC721Metadata *ERC721MetadataSession) SetApprovalForAll(to common.Address, approved bool) (*types.Transaction, error) { + return _ERC721Metadata.Contract.SetApprovalForAll(&_ERC721Metadata.TransactOpts, to, approved) +} + +// SetApprovalForAll is a paid mutator transaction binding the contract method 0xa22cb465. +// +// Solidity: function setApprovalForAll(address to, bool approved) returns() +func (_ERC721Metadata *ERC721MetadataTransactorSession) SetApprovalForAll(to common.Address, approved bool) (*types.Transaction, error) { + return _ERC721Metadata.Contract.SetApprovalForAll(&_ERC721Metadata.TransactOpts, to, approved) +} + +// TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd. +// +// Solidity: function transferFrom(address from, address to, uint256 tokenId) returns() +func (_ERC721Metadata *ERC721MetadataTransactor) TransferFrom(opts *bind.TransactOpts, from common.Address, to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _ERC721Metadata.contract.Transact(opts, "transferFrom", from, to, tokenId) +} + +// TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd. +// +// Solidity: function transferFrom(address from, address to, uint256 tokenId) returns() +func (_ERC721Metadata *ERC721MetadataSession) TransferFrom(from common.Address, to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _ERC721Metadata.Contract.TransferFrom(&_ERC721Metadata.TransactOpts, from, to, tokenId) +} + +// TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd. +// +// Solidity: function transferFrom(address from, address to, uint256 tokenId) returns() +func (_ERC721Metadata *ERC721MetadataTransactorSession) TransferFrom(from common.Address, to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _ERC721Metadata.Contract.TransferFrom(&_ERC721Metadata.TransactOpts, from, to, tokenId) +} + +// ERC721MetadataApprovalIterator is returned from FilterApproval and is used to iterate over the raw logs and unpacked data for Approval events raised by the ERC721Metadata contract. +type ERC721MetadataApprovalIterator struct { + Event *ERC721MetadataApproval // 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 *ERC721MetadataApprovalIterator) 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(ERC721MetadataApproval) + 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(ERC721MetadataApproval) + 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 *ERC721MetadataApprovalIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ERC721MetadataApprovalIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ERC721MetadataApproval represents a Approval event raised by the ERC721Metadata contract. +type ERC721MetadataApproval struct { + Owner common.Address + Approved common.Address + TokenId *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterApproval is a free log retrieval operation binding the contract event 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925. +// +// Solidity: event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId) +func (_ERC721Metadata *ERC721MetadataFilterer) FilterApproval(opts *bind.FilterOpts, owner []common.Address, approved []common.Address, tokenId []*big.Int) (*ERC721MetadataApprovalIterator, error) { + + var ownerRule []interface{} + for _, ownerItem := range owner { + ownerRule = append(ownerRule, ownerItem) + } + var approvedRule []interface{} + for _, approvedItem := range approved { + approvedRule = append(approvedRule, approvedItem) + } + var tokenIdRule []interface{} + for _, tokenIdItem := range tokenId { + tokenIdRule = append(tokenIdRule, tokenIdItem) + } + + logs, sub, err := _ERC721Metadata.contract.FilterLogs(opts, "Approval", ownerRule, approvedRule, tokenIdRule) + if err != nil { + return nil, err + } + return &ERC721MetadataApprovalIterator{contract: _ERC721Metadata.contract, event: "Approval", logs: logs, sub: sub}, nil +} + +// WatchApproval is a free log subscription operation binding the contract event 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925. +// +// Solidity: event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId) +func (_ERC721Metadata *ERC721MetadataFilterer) WatchApproval(opts *bind.WatchOpts, sink chan<- *ERC721MetadataApproval, owner []common.Address, approved []common.Address, tokenId []*big.Int) (event.Subscription, error) { + + var ownerRule []interface{} + for _, ownerItem := range owner { + ownerRule = append(ownerRule, ownerItem) + } + var approvedRule []interface{} + for _, approvedItem := range approved { + approvedRule = append(approvedRule, approvedItem) + } + var tokenIdRule []interface{} + for _, tokenIdItem := range tokenId { + tokenIdRule = append(tokenIdRule, tokenIdItem) + } + + logs, sub, err := _ERC721Metadata.contract.WatchLogs(opts, "Approval", ownerRule, approvedRule, tokenIdRule) + 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(ERC721MetadataApproval) + if err := _ERC721Metadata.contract.UnpackLog(event, "Approval", 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 +} + +// ParseApproval is a log parse operation binding the contract event 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925. +// +// Solidity: event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId) +func (_ERC721Metadata *ERC721MetadataFilterer) ParseApproval(log types.Log) (*ERC721MetadataApproval, error) { + event := new(ERC721MetadataApproval) + if err := _ERC721Metadata.contract.UnpackLog(event, "Approval", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ERC721MetadataApprovalForAllIterator is returned from FilterApprovalForAll and is used to iterate over the raw logs and unpacked data for ApprovalForAll events raised by the ERC721Metadata contract. +type ERC721MetadataApprovalForAllIterator struct { + Event *ERC721MetadataApprovalForAll // 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 *ERC721MetadataApprovalForAllIterator) 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(ERC721MetadataApprovalForAll) + 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(ERC721MetadataApprovalForAll) + 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 *ERC721MetadataApprovalForAllIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ERC721MetadataApprovalForAllIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ERC721MetadataApprovalForAll represents a ApprovalForAll event raised by the ERC721Metadata contract. +type ERC721MetadataApprovalForAll struct { + Owner common.Address + Operator common.Address + Approved bool + Raw types.Log // Blockchain specific contextual infos +} + +// FilterApprovalForAll is a free log retrieval operation binding the contract event 0x17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31. +// +// Solidity: event ApprovalForAll(address indexed owner, address indexed operator, bool approved) +func (_ERC721Metadata *ERC721MetadataFilterer) FilterApprovalForAll(opts *bind.FilterOpts, owner []common.Address, operator []common.Address) (*ERC721MetadataApprovalForAllIterator, error) { + + var ownerRule []interface{} + for _, ownerItem := range owner { + ownerRule = append(ownerRule, ownerItem) + } + var operatorRule []interface{} + for _, operatorItem := range operator { + operatorRule = append(operatorRule, operatorItem) + } + + logs, sub, err := _ERC721Metadata.contract.FilterLogs(opts, "ApprovalForAll", ownerRule, operatorRule) + if err != nil { + return nil, err + } + return &ERC721MetadataApprovalForAllIterator{contract: _ERC721Metadata.contract, event: "ApprovalForAll", logs: logs, sub: sub}, nil +} + +// WatchApprovalForAll is a free log subscription operation binding the contract event 0x17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31. +// +// Solidity: event ApprovalForAll(address indexed owner, address indexed operator, bool approved) +func (_ERC721Metadata *ERC721MetadataFilterer) WatchApprovalForAll(opts *bind.WatchOpts, sink chan<- *ERC721MetadataApprovalForAll, owner []common.Address, operator []common.Address) (event.Subscription, error) { + + var ownerRule []interface{} + for _, ownerItem := range owner { + ownerRule = append(ownerRule, ownerItem) + } + var operatorRule []interface{} + for _, operatorItem := range operator { + operatorRule = append(operatorRule, operatorItem) + } + + logs, sub, err := _ERC721Metadata.contract.WatchLogs(opts, "ApprovalForAll", ownerRule, operatorRule) + 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(ERC721MetadataApprovalForAll) + if err := _ERC721Metadata.contract.UnpackLog(event, "ApprovalForAll", 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 +} + +// ParseApprovalForAll is a log parse operation binding the contract event 0x17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31. +// +// Solidity: event ApprovalForAll(address indexed owner, address indexed operator, bool approved) +func (_ERC721Metadata *ERC721MetadataFilterer) ParseApprovalForAll(log types.Log) (*ERC721MetadataApprovalForAll, error) { + event := new(ERC721MetadataApprovalForAll) + if err := _ERC721Metadata.contract.UnpackLog(event, "ApprovalForAll", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ERC721MetadataTransferIterator is returned from FilterTransfer and is used to iterate over the raw logs and unpacked data for Transfer events raised by the ERC721Metadata contract. +type ERC721MetadataTransferIterator struct { + Event *ERC721MetadataTransfer // 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 *ERC721MetadataTransferIterator) 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(ERC721MetadataTransfer) + 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(ERC721MetadataTransfer) + 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 *ERC721MetadataTransferIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ERC721MetadataTransferIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ERC721MetadataTransfer represents a Transfer event raised by the ERC721Metadata contract. +type ERC721MetadataTransfer struct { + From common.Address + To common.Address + TokenId *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterTransfer is a free log retrieval operation binding the contract event 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef. +// +// Solidity: event Transfer(address indexed from, address indexed to, uint256 indexed tokenId) +func (_ERC721Metadata *ERC721MetadataFilterer) FilterTransfer(opts *bind.FilterOpts, from []common.Address, to []common.Address, tokenId []*big.Int) (*ERC721MetadataTransferIterator, error) { + + var fromRule []interface{} + for _, fromItem := range from { + fromRule = append(fromRule, fromItem) + } + var toRule []interface{} + for _, toItem := range to { + toRule = append(toRule, toItem) + } + var tokenIdRule []interface{} + for _, tokenIdItem := range tokenId { + tokenIdRule = append(tokenIdRule, tokenIdItem) + } + + logs, sub, err := _ERC721Metadata.contract.FilterLogs(opts, "Transfer", fromRule, toRule, tokenIdRule) + if err != nil { + return nil, err + } + return &ERC721MetadataTransferIterator{contract: _ERC721Metadata.contract, event: "Transfer", logs: logs, sub: sub}, nil +} + +// WatchTransfer is a free log subscription operation binding the contract event 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef. +// +// Solidity: event Transfer(address indexed from, address indexed to, uint256 indexed tokenId) +func (_ERC721Metadata *ERC721MetadataFilterer) WatchTransfer(opts *bind.WatchOpts, sink chan<- *ERC721MetadataTransfer, from []common.Address, to []common.Address, tokenId []*big.Int) (event.Subscription, error) { + + var fromRule []interface{} + for _, fromItem := range from { + fromRule = append(fromRule, fromItem) + } + var toRule []interface{} + for _, toItem := range to { + toRule = append(toRule, toItem) + } + var tokenIdRule []interface{} + for _, tokenIdItem := range tokenId { + tokenIdRule = append(tokenIdRule, tokenIdItem) + } + + logs, sub, err := _ERC721Metadata.contract.WatchLogs(opts, "Transfer", fromRule, toRule, tokenIdRule) + 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(ERC721MetadataTransfer) + if err := _ERC721Metadata.contract.UnpackLog(event, "Transfer", 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 +} + +// ParseTransfer is a log parse operation binding the contract event 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef. +// +// Solidity: event Transfer(address indexed from, address indexed to, uint256 indexed tokenId) +func (_ERC721Metadata *ERC721MetadataFilterer) ParseTransfer(log types.Log) (*ERC721MetadataTransfer, error) { + event := new(ERC721MetadataTransfer) + if err := _ERC721Metadata.contract.UnpackLog(event, "Transfer", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// IERC165ABI is the input ABI used to generate the binding from. +const IERC165ABI = "[{\"constant\":true,\"inputs\":[{\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"}]" + +// IERC165FuncSigs maps the 4-byte function signature to its string representation. +var IERC165FuncSigs = map[string]string{ + "01ffc9a7": "supportsInterface(bytes4)", +} + +// IERC165 is an auto generated Go binding around an Ethereum contract. +type IERC165 struct { + IERC165Caller // Read-only binding to the contract + IERC165Transactor // Write-only binding to the contract + IERC165Filterer // Log filterer for contract events +} + +// IERC165Caller is an auto generated read-only Go binding around an Ethereum contract. +type IERC165Caller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// IERC165Transactor is an auto generated write-only Go binding around an Ethereum contract. +type IERC165Transactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// IERC165Filterer is an auto generated log filtering Go binding around an Ethereum contract events. +type IERC165Filterer struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// IERC165Session is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type IERC165Session struct { + Contract *IERC165 // 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 +} + +// IERC165CallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type IERC165CallerSession struct { + Contract *IERC165Caller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// IERC165TransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type IERC165TransactorSession struct { + Contract *IERC165Transactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// IERC165Raw is an auto generated low-level Go binding around an Ethereum contract. +type IERC165Raw struct { + Contract *IERC165 // Generic contract binding to access the raw methods on +} + +// IERC165CallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type IERC165CallerRaw struct { + Contract *IERC165Caller // Generic read-only contract binding to access the raw methods on +} + +// IERC165TransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type IERC165TransactorRaw struct { + Contract *IERC165Transactor // Generic write-only contract binding to access the raw methods on +} + +// NewIERC165 creates a new instance of IERC165, bound to a specific deployed contract. +func NewIERC165(address common.Address, backend bind.ContractBackend) (*IERC165, error) { + contract, err := bindIERC165(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &IERC165{IERC165Caller: IERC165Caller{contract: contract}, IERC165Transactor: IERC165Transactor{contract: contract}, IERC165Filterer: IERC165Filterer{contract: contract}}, nil +} + +// NewIERC165Caller creates a new read-only instance of IERC165, bound to a specific deployed contract. +func NewIERC165Caller(address common.Address, caller bind.ContractCaller) (*IERC165Caller, error) { + contract, err := bindIERC165(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &IERC165Caller{contract: contract}, nil +} + +// NewIERC165Transactor creates a new write-only instance of IERC165, bound to a specific deployed contract. +func NewIERC165Transactor(address common.Address, transactor bind.ContractTransactor) (*IERC165Transactor, error) { + contract, err := bindIERC165(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &IERC165Transactor{contract: contract}, nil +} + +// NewIERC165Filterer creates a new log filterer instance of IERC165, bound to a specific deployed contract. +func NewIERC165Filterer(address common.Address, filterer bind.ContractFilterer) (*IERC165Filterer, error) { + contract, err := bindIERC165(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &IERC165Filterer{contract: contract}, nil +} + +// bindIERC165 binds a generic wrapper to an already deployed contract. +func bindIERC165(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := abi.JSON(strings.NewReader(IERC165ABI)) + 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 (_IERC165 *IERC165Raw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _IERC165.Contract.IERC165Caller.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 (_IERC165 *IERC165Raw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _IERC165.Contract.IERC165Transactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_IERC165 *IERC165Raw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _IERC165.Contract.IERC165Transactor.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 (_IERC165 *IERC165CallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _IERC165.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 (_IERC165 *IERC165TransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _IERC165.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_IERC165 *IERC165TransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _IERC165.Contract.contract.Transact(opts, method, params...) +} + +// SupportsInterface is a free data retrieval call binding the contract method 0x01ffc9a7. +// +// Solidity: function supportsInterface(bytes4 interfaceId) view returns(bool) +func (_IERC165 *IERC165Caller) SupportsInterface(opts *bind.CallOpts, interfaceId [4]byte) (bool, error) { + var out []interface{} + err := _IERC165.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 (_IERC165 *IERC165Session) SupportsInterface(interfaceId [4]byte) (bool, error) { + return _IERC165.Contract.SupportsInterface(&_IERC165.CallOpts, interfaceId) +} + +// SupportsInterface is a free data retrieval call binding the contract method 0x01ffc9a7. +// +// Solidity: function supportsInterface(bytes4 interfaceId) view returns(bool) +func (_IERC165 *IERC165CallerSession) SupportsInterface(interfaceId [4]byte) (bool, error) { + return _IERC165.Contract.SupportsInterface(&_IERC165.CallOpts, interfaceId) +} + +// IERC721ABI is the input ABI used to generate the binding from. +const IERC721ABI = "[{\"constant\":true,\"inputs\":[{\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"getApproved\",\"outputs\":[{\"name\":\"operator\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"to\",\"type\":\"address\"},{\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"from\",\"type\":\"address\"},{\"name\":\"to\",\"type\":\"address\"},{\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"from\",\"type\":\"address\"},{\"name\":\"to\",\"type\":\"address\"},{\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"safeTransferFrom\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"ownerOf\",\"outputs\":[{\"name\":\"owner\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"name\":\"balance\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"operator\",\"type\":\"address\"},{\"name\":\"_approved\",\"type\":\"bool\"}],\"name\":\"setApprovalForAll\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"from\",\"type\":\"address\"},{\"name\":\"to\",\"type\":\"address\"},{\"name\":\"tokenId\",\"type\":\"uint256\"},{\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"safeTransferFrom\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"owner\",\"type\":\"address\"},{\"name\":\"operator\",\"type\":\"address\"}],\"name\":\"isApprovedForAll\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"to\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"approved\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"ApprovalForAll\",\"type\":\"event\"}]" + +// IERC721FuncSigs maps the 4-byte function signature to its string representation. +var IERC721FuncSigs = map[string]string{ + "095ea7b3": "approve(address,uint256)", + "70a08231": "balanceOf(address)", + "081812fc": "getApproved(uint256)", + "e985e9c5": "isApprovedForAll(address,address)", + "6352211e": "ownerOf(uint256)", + "42842e0e": "safeTransferFrom(address,address,uint256)", + "b88d4fde": "safeTransferFrom(address,address,uint256,bytes)", + "a22cb465": "setApprovalForAll(address,bool)", + "01ffc9a7": "supportsInterface(bytes4)", + "23b872dd": "transferFrom(address,address,uint256)", +} + +// IERC721 is an auto generated Go binding around an Ethereum contract. +type IERC721 struct { + IERC721Caller // Read-only binding to the contract + IERC721Transactor // Write-only binding to the contract + IERC721Filterer // Log filterer for contract events +} + +// IERC721Caller is an auto generated read-only Go binding around an Ethereum contract. +type IERC721Caller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// IERC721Transactor is an auto generated write-only Go binding around an Ethereum contract. +type IERC721Transactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// IERC721Filterer is an auto generated log filtering Go binding around an Ethereum contract events. +type IERC721Filterer struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// IERC721Session is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type IERC721Session struct { + Contract *IERC721 // 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 +} + +// IERC721CallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type IERC721CallerSession struct { + Contract *IERC721Caller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// IERC721TransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type IERC721TransactorSession struct { + Contract *IERC721Transactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// IERC721Raw is an auto generated low-level Go binding around an Ethereum contract. +type IERC721Raw struct { + Contract *IERC721 // Generic contract binding to access the raw methods on +} + +// IERC721CallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type IERC721CallerRaw struct { + Contract *IERC721Caller // Generic read-only contract binding to access the raw methods on +} + +// IERC721TransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type IERC721TransactorRaw struct { + Contract *IERC721Transactor // Generic write-only contract binding to access the raw methods on +} + +// NewIERC721 creates a new instance of IERC721, bound to a specific deployed contract. +func NewIERC721(address common.Address, backend bind.ContractBackend) (*IERC721, error) { + contract, err := bindIERC721(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &IERC721{IERC721Caller: IERC721Caller{contract: contract}, IERC721Transactor: IERC721Transactor{contract: contract}, IERC721Filterer: IERC721Filterer{contract: contract}}, nil +} + +// NewIERC721Caller creates a new read-only instance of IERC721, bound to a specific deployed contract. +func NewIERC721Caller(address common.Address, caller bind.ContractCaller) (*IERC721Caller, error) { + contract, err := bindIERC721(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &IERC721Caller{contract: contract}, nil +} + +// NewIERC721Transactor creates a new write-only instance of IERC721, bound to a specific deployed contract. +func NewIERC721Transactor(address common.Address, transactor bind.ContractTransactor) (*IERC721Transactor, error) { + contract, err := bindIERC721(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &IERC721Transactor{contract: contract}, nil +} + +// NewIERC721Filterer creates a new log filterer instance of IERC721, bound to a specific deployed contract. +func NewIERC721Filterer(address common.Address, filterer bind.ContractFilterer) (*IERC721Filterer, error) { + contract, err := bindIERC721(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &IERC721Filterer{contract: contract}, nil +} + +// bindIERC721 binds a generic wrapper to an already deployed contract. +func bindIERC721(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := abi.JSON(strings.NewReader(IERC721ABI)) + 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 (_IERC721 *IERC721Raw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _IERC721.Contract.IERC721Caller.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 (_IERC721 *IERC721Raw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _IERC721.Contract.IERC721Transactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_IERC721 *IERC721Raw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _IERC721.Contract.IERC721Transactor.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 (_IERC721 *IERC721CallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _IERC721.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 (_IERC721 *IERC721TransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _IERC721.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_IERC721 *IERC721TransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _IERC721.Contract.contract.Transact(opts, method, params...) +} + +// BalanceOf is a free data retrieval call binding the contract method 0x70a08231. +// +// Solidity: function balanceOf(address owner) view returns(uint256 balance) +func (_IERC721 *IERC721Caller) BalanceOf(opts *bind.CallOpts, owner common.Address) (*big.Int, error) { + var out []interface{} + err := _IERC721.contract.Call(opts, &out, "balanceOf", owner) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// BalanceOf is a free data retrieval call binding the contract method 0x70a08231. +// +// Solidity: function balanceOf(address owner) view returns(uint256 balance) +func (_IERC721 *IERC721Session) BalanceOf(owner common.Address) (*big.Int, error) { + return _IERC721.Contract.BalanceOf(&_IERC721.CallOpts, owner) +} + +// BalanceOf is a free data retrieval call binding the contract method 0x70a08231. +// +// Solidity: function balanceOf(address owner) view returns(uint256 balance) +func (_IERC721 *IERC721CallerSession) BalanceOf(owner common.Address) (*big.Int, error) { + return _IERC721.Contract.BalanceOf(&_IERC721.CallOpts, owner) +} + +// GetApproved is a free data retrieval call binding the contract method 0x081812fc. +// +// Solidity: function getApproved(uint256 tokenId) view returns(address operator) +func (_IERC721 *IERC721Caller) GetApproved(opts *bind.CallOpts, tokenId *big.Int) (common.Address, error) { + var out []interface{} + err := _IERC721.contract.Call(opts, &out, "getApproved", tokenId) + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// GetApproved is a free data retrieval call binding the contract method 0x081812fc. +// +// Solidity: function getApproved(uint256 tokenId) view returns(address operator) +func (_IERC721 *IERC721Session) GetApproved(tokenId *big.Int) (common.Address, error) { + return _IERC721.Contract.GetApproved(&_IERC721.CallOpts, tokenId) +} + +// GetApproved is a free data retrieval call binding the contract method 0x081812fc. +// +// Solidity: function getApproved(uint256 tokenId) view returns(address operator) +func (_IERC721 *IERC721CallerSession) GetApproved(tokenId *big.Int) (common.Address, error) { + return _IERC721.Contract.GetApproved(&_IERC721.CallOpts, tokenId) +} + +// IsApprovedForAll is a free data retrieval call binding the contract method 0xe985e9c5. +// +// Solidity: function isApprovedForAll(address owner, address operator) view returns(bool) +func (_IERC721 *IERC721Caller) IsApprovedForAll(opts *bind.CallOpts, owner common.Address, operator common.Address) (bool, error) { + var out []interface{} + err := _IERC721.contract.Call(opts, &out, "isApprovedForAll", owner, operator) + + if err != nil { + return *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + + return out0, err + +} + +// IsApprovedForAll is a free data retrieval call binding the contract method 0xe985e9c5. +// +// Solidity: function isApprovedForAll(address owner, address operator) view returns(bool) +func (_IERC721 *IERC721Session) IsApprovedForAll(owner common.Address, operator common.Address) (bool, error) { + return _IERC721.Contract.IsApprovedForAll(&_IERC721.CallOpts, owner, operator) +} + +// IsApprovedForAll is a free data retrieval call binding the contract method 0xe985e9c5. +// +// Solidity: function isApprovedForAll(address owner, address operator) view returns(bool) +func (_IERC721 *IERC721CallerSession) IsApprovedForAll(owner common.Address, operator common.Address) (bool, error) { + return _IERC721.Contract.IsApprovedForAll(&_IERC721.CallOpts, owner, operator) +} + +// OwnerOf is a free data retrieval call binding the contract method 0x6352211e. +// +// Solidity: function ownerOf(uint256 tokenId) view returns(address owner) +func (_IERC721 *IERC721Caller) OwnerOf(opts *bind.CallOpts, tokenId *big.Int) (common.Address, error) { + var out []interface{} + err := _IERC721.contract.Call(opts, &out, "ownerOf", tokenId) + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// OwnerOf is a free data retrieval call binding the contract method 0x6352211e. +// +// Solidity: function ownerOf(uint256 tokenId) view returns(address owner) +func (_IERC721 *IERC721Session) OwnerOf(tokenId *big.Int) (common.Address, error) { + return _IERC721.Contract.OwnerOf(&_IERC721.CallOpts, tokenId) +} + +// OwnerOf is a free data retrieval call binding the contract method 0x6352211e. +// +// Solidity: function ownerOf(uint256 tokenId) view returns(address owner) +func (_IERC721 *IERC721CallerSession) OwnerOf(tokenId *big.Int) (common.Address, error) { + return _IERC721.Contract.OwnerOf(&_IERC721.CallOpts, tokenId) +} + +// SupportsInterface is a free data retrieval call binding the contract method 0x01ffc9a7. +// +// Solidity: function supportsInterface(bytes4 interfaceId) view returns(bool) +func (_IERC721 *IERC721Caller) SupportsInterface(opts *bind.CallOpts, interfaceId [4]byte) (bool, error) { + var out []interface{} + err := _IERC721.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 (_IERC721 *IERC721Session) SupportsInterface(interfaceId [4]byte) (bool, error) { + return _IERC721.Contract.SupportsInterface(&_IERC721.CallOpts, interfaceId) +} + +// SupportsInterface is a free data retrieval call binding the contract method 0x01ffc9a7. +// +// Solidity: function supportsInterface(bytes4 interfaceId) view returns(bool) +func (_IERC721 *IERC721CallerSession) SupportsInterface(interfaceId [4]byte) (bool, error) { + return _IERC721.Contract.SupportsInterface(&_IERC721.CallOpts, interfaceId) +} + +// Approve is a paid mutator transaction binding the contract method 0x095ea7b3. +// +// Solidity: function approve(address to, uint256 tokenId) returns() +func (_IERC721 *IERC721Transactor) Approve(opts *bind.TransactOpts, to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _IERC721.contract.Transact(opts, "approve", to, tokenId) +} + +// Approve is a paid mutator transaction binding the contract method 0x095ea7b3. +// +// Solidity: function approve(address to, uint256 tokenId) returns() +func (_IERC721 *IERC721Session) Approve(to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _IERC721.Contract.Approve(&_IERC721.TransactOpts, to, tokenId) +} + +// Approve is a paid mutator transaction binding the contract method 0x095ea7b3. +// +// Solidity: function approve(address to, uint256 tokenId) returns() +func (_IERC721 *IERC721TransactorSession) Approve(to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _IERC721.Contract.Approve(&_IERC721.TransactOpts, to, tokenId) +} + +// SafeTransferFrom is a paid mutator transaction binding the contract method 0x42842e0e. +// +// Solidity: function safeTransferFrom(address from, address to, uint256 tokenId) returns() +func (_IERC721 *IERC721Transactor) SafeTransferFrom(opts *bind.TransactOpts, from common.Address, to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _IERC721.contract.Transact(opts, "safeTransferFrom", from, to, tokenId) +} + +// SafeTransferFrom is a paid mutator transaction binding the contract method 0x42842e0e. +// +// Solidity: function safeTransferFrom(address from, address to, uint256 tokenId) returns() +func (_IERC721 *IERC721Session) SafeTransferFrom(from common.Address, to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _IERC721.Contract.SafeTransferFrom(&_IERC721.TransactOpts, from, to, tokenId) +} + +// SafeTransferFrom is a paid mutator transaction binding the contract method 0x42842e0e. +// +// Solidity: function safeTransferFrom(address from, address to, uint256 tokenId) returns() +func (_IERC721 *IERC721TransactorSession) SafeTransferFrom(from common.Address, to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _IERC721.Contract.SafeTransferFrom(&_IERC721.TransactOpts, from, to, tokenId) +} + +// SafeTransferFrom0 is a paid mutator transaction binding the contract method 0xb88d4fde. +// +// Solidity: function safeTransferFrom(address from, address to, uint256 tokenId, bytes data) returns() +func (_IERC721 *IERC721Transactor) SafeTransferFrom0(opts *bind.TransactOpts, from common.Address, to common.Address, tokenId *big.Int, data []byte) (*types.Transaction, error) { + return _IERC721.contract.Transact(opts, "safeTransferFrom0", from, to, tokenId, data) +} + +// SafeTransferFrom0 is a paid mutator transaction binding the contract method 0xb88d4fde. +// +// Solidity: function safeTransferFrom(address from, address to, uint256 tokenId, bytes data) returns() +func (_IERC721 *IERC721Session) SafeTransferFrom0(from common.Address, to common.Address, tokenId *big.Int, data []byte) (*types.Transaction, error) { + return _IERC721.Contract.SafeTransferFrom0(&_IERC721.TransactOpts, from, to, tokenId, data) +} + +// SafeTransferFrom0 is a paid mutator transaction binding the contract method 0xb88d4fde. +// +// Solidity: function safeTransferFrom(address from, address to, uint256 tokenId, bytes data) returns() +func (_IERC721 *IERC721TransactorSession) SafeTransferFrom0(from common.Address, to common.Address, tokenId *big.Int, data []byte) (*types.Transaction, error) { + return _IERC721.Contract.SafeTransferFrom0(&_IERC721.TransactOpts, from, to, tokenId, data) +} + +// SetApprovalForAll is a paid mutator transaction binding the contract method 0xa22cb465. +// +// Solidity: function setApprovalForAll(address operator, bool _approved) returns() +func (_IERC721 *IERC721Transactor) SetApprovalForAll(opts *bind.TransactOpts, operator common.Address, _approved bool) (*types.Transaction, error) { + return _IERC721.contract.Transact(opts, "setApprovalForAll", operator, _approved) +} + +// SetApprovalForAll is a paid mutator transaction binding the contract method 0xa22cb465. +// +// Solidity: function setApprovalForAll(address operator, bool _approved) returns() +func (_IERC721 *IERC721Session) SetApprovalForAll(operator common.Address, _approved bool) (*types.Transaction, error) { + return _IERC721.Contract.SetApprovalForAll(&_IERC721.TransactOpts, operator, _approved) +} + +// SetApprovalForAll is a paid mutator transaction binding the contract method 0xa22cb465. +// +// Solidity: function setApprovalForAll(address operator, bool _approved) returns() +func (_IERC721 *IERC721TransactorSession) SetApprovalForAll(operator common.Address, _approved bool) (*types.Transaction, error) { + return _IERC721.Contract.SetApprovalForAll(&_IERC721.TransactOpts, operator, _approved) +} + +// TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd. +// +// Solidity: function transferFrom(address from, address to, uint256 tokenId) returns() +func (_IERC721 *IERC721Transactor) TransferFrom(opts *bind.TransactOpts, from common.Address, to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _IERC721.contract.Transact(opts, "transferFrom", from, to, tokenId) +} + +// TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd. +// +// Solidity: function transferFrom(address from, address to, uint256 tokenId) returns() +func (_IERC721 *IERC721Session) TransferFrom(from common.Address, to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _IERC721.Contract.TransferFrom(&_IERC721.TransactOpts, from, to, tokenId) +} + +// TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd. +// +// Solidity: function transferFrom(address from, address to, uint256 tokenId) returns() +func (_IERC721 *IERC721TransactorSession) TransferFrom(from common.Address, to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _IERC721.Contract.TransferFrom(&_IERC721.TransactOpts, from, to, tokenId) +} + +// IERC721ApprovalIterator is returned from FilterApproval and is used to iterate over the raw logs and unpacked data for Approval events raised by the IERC721 contract. +type IERC721ApprovalIterator struct { + Event *IERC721Approval // 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 *IERC721ApprovalIterator) 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(IERC721Approval) + 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(IERC721Approval) + 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 *IERC721ApprovalIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *IERC721ApprovalIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// IERC721Approval represents a Approval event raised by the IERC721 contract. +type IERC721Approval struct { + Owner common.Address + Approved common.Address + TokenId *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterApproval is a free log retrieval operation binding the contract event 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925. +// +// Solidity: event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId) +func (_IERC721 *IERC721Filterer) FilterApproval(opts *bind.FilterOpts, owner []common.Address, approved []common.Address, tokenId []*big.Int) (*IERC721ApprovalIterator, error) { + + var ownerRule []interface{} + for _, ownerItem := range owner { + ownerRule = append(ownerRule, ownerItem) + } + var approvedRule []interface{} + for _, approvedItem := range approved { + approvedRule = append(approvedRule, approvedItem) + } + var tokenIdRule []interface{} + for _, tokenIdItem := range tokenId { + tokenIdRule = append(tokenIdRule, tokenIdItem) + } + + logs, sub, err := _IERC721.contract.FilterLogs(opts, "Approval", ownerRule, approvedRule, tokenIdRule) + if err != nil { + return nil, err + } + return &IERC721ApprovalIterator{contract: _IERC721.contract, event: "Approval", logs: logs, sub: sub}, nil +} + +// WatchApproval is a free log subscription operation binding the contract event 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925. +// +// Solidity: event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId) +func (_IERC721 *IERC721Filterer) WatchApproval(opts *bind.WatchOpts, sink chan<- *IERC721Approval, owner []common.Address, approved []common.Address, tokenId []*big.Int) (event.Subscription, error) { + + var ownerRule []interface{} + for _, ownerItem := range owner { + ownerRule = append(ownerRule, ownerItem) + } + var approvedRule []interface{} + for _, approvedItem := range approved { + approvedRule = append(approvedRule, approvedItem) + } + var tokenIdRule []interface{} + for _, tokenIdItem := range tokenId { + tokenIdRule = append(tokenIdRule, tokenIdItem) + } + + logs, sub, err := _IERC721.contract.WatchLogs(opts, "Approval", ownerRule, approvedRule, tokenIdRule) + 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(IERC721Approval) + if err := _IERC721.contract.UnpackLog(event, "Approval", 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 +} + +// ParseApproval is a log parse operation binding the contract event 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925. +// +// Solidity: event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId) +func (_IERC721 *IERC721Filterer) ParseApproval(log types.Log) (*IERC721Approval, error) { + event := new(IERC721Approval) + if err := _IERC721.contract.UnpackLog(event, "Approval", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// IERC721ApprovalForAllIterator is returned from FilterApprovalForAll and is used to iterate over the raw logs and unpacked data for ApprovalForAll events raised by the IERC721 contract. +type IERC721ApprovalForAllIterator struct { + Event *IERC721ApprovalForAll // 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 *IERC721ApprovalForAllIterator) 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(IERC721ApprovalForAll) + 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(IERC721ApprovalForAll) + 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 *IERC721ApprovalForAllIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *IERC721ApprovalForAllIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// IERC721ApprovalForAll represents a ApprovalForAll event raised by the IERC721 contract. +type IERC721ApprovalForAll struct { + Owner common.Address + Operator common.Address + Approved bool + Raw types.Log // Blockchain specific contextual infos +} + +// FilterApprovalForAll is a free log retrieval operation binding the contract event 0x17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31. +// +// Solidity: event ApprovalForAll(address indexed owner, address indexed operator, bool approved) +func (_IERC721 *IERC721Filterer) FilterApprovalForAll(opts *bind.FilterOpts, owner []common.Address, operator []common.Address) (*IERC721ApprovalForAllIterator, error) { + + var ownerRule []interface{} + for _, ownerItem := range owner { + ownerRule = append(ownerRule, ownerItem) + } + var operatorRule []interface{} + for _, operatorItem := range operator { + operatorRule = append(operatorRule, operatorItem) + } + + logs, sub, err := _IERC721.contract.FilterLogs(opts, "ApprovalForAll", ownerRule, operatorRule) + if err != nil { + return nil, err + } + return &IERC721ApprovalForAllIterator{contract: _IERC721.contract, event: "ApprovalForAll", logs: logs, sub: sub}, nil +} + +// WatchApprovalForAll is a free log subscription operation binding the contract event 0x17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31. +// +// Solidity: event ApprovalForAll(address indexed owner, address indexed operator, bool approved) +func (_IERC721 *IERC721Filterer) WatchApprovalForAll(opts *bind.WatchOpts, sink chan<- *IERC721ApprovalForAll, owner []common.Address, operator []common.Address) (event.Subscription, error) { + + var ownerRule []interface{} + for _, ownerItem := range owner { + ownerRule = append(ownerRule, ownerItem) + } + var operatorRule []interface{} + for _, operatorItem := range operator { + operatorRule = append(operatorRule, operatorItem) + } + + logs, sub, err := _IERC721.contract.WatchLogs(opts, "ApprovalForAll", ownerRule, operatorRule) + 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(IERC721ApprovalForAll) + if err := _IERC721.contract.UnpackLog(event, "ApprovalForAll", 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 +} + +// ParseApprovalForAll is a log parse operation binding the contract event 0x17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31. +// +// Solidity: event ApprovalForAll(address indexed owner, address indexed operator, bool approved) +func (_IERC721 *IERC721Filterer) ParseApprovalForAll(log types.Log) (*IERC721ApprovalForAll, error) { + event := new(IERC721ApprovalForAll) + if err := _IERC721.contract.UnpackLog(event, "ApprovalForAll", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// IERC721TransferIterator is returned from FilterTransfer and is used to iterate over the raw logs and unpacked data for Transfer events raised by the IERC721 contract. +type IERC721TransferIterator struct { + Event *IERC721Transfer // 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 *IERC721TransferIterator) 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(IERC721Transfer) + 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(IERC721Transfer) + 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 *IERC721TransferIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *IERC721TransferIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// IERC721Transfer represents a Transfer event raised by the IERC721 contract. +type IERC721Transfer struct { + From common.Address + To common.Address + TokenId *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterTransfer is a free log retrieval operation binding the contract event 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef. +// +// Solidity: event Transfer(address indexed from, address indexed to, uint256 indexed tokenId) +func (_IERC721 *IERC721Filterer) FilterTransfer(opts *bind.FilterOpts, from []common.Address, to []common.Address, tokenId []*big.Int) (*IERC721TransferIterator, error) { + + var fromRule []interface{} + for _, fromItem := range from { + fromRule = append(fromRule, fromItem) + } + var toRule []interface{} + for _, toItem := range to { + toRule = append(toRule, toItem) + } + var tokenIdRule []interface{} + for _, tokenIdItem := range tokenId { + tokenIdRule = append(tokenIdRule, tokenIdItem) + } + + logs, sub, err := _IERC721.contract.FilterLogs(opts, "Transfer", fromRule, toRule, tokenIdRule) + if err != nil { + return nil, err + } + return &IERC721TransferIterator{contract: _IERC721.contract, event: "Transfer", logs: logs, sub: sub}, nil +} + +// WatchTransfer is a free log subscription operation binding the contract event 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef. +// +// Solidity: event Transfer(address indexed from, address indexed to, uint256 indexed tokenId) +func (_IERC721 *IERC721Filterer) WatchTransfer(opts *bind.WatchOpts, sink chan<- *IERC721Transfer, from []common.Address, to []common.Address, tokenId []*big.Int) (event.Subscription, error) { + + var fromRule []interface{} + for _, fromItem := range from { + fromRule = append(fromRule, fromItem) + } + var toRule []interface{} + for _, toItem := range to { + toRule = append(toRule, toItem) + } + var tokenIdRule []interface{} + for _, tokenIdItem := range tokenId { + tokenIdRule = append(tokenIdRule, tokenIdItem) + } + + logs, sub, err := _IERC721.contract.WatchLogs(opts, "Transfer", fromRule, toRule, tokenIdRule) + 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(IERC721Transfer) + if err := _IERC721.contract.UnpackLog(event, "Transfer", 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 +} + +// ParseTransfer is a log parse operation binding the contract event 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef. +// +// Solidity: event Transfer(address indexed from, address indexed to, uint256 indexed tokenId) +func (_IERC721 *IERC721Filterer) ParseTransfer(log types.Log) (*IERC721Transfer, error) { + event := new(IERC721Transfer) + if err := _IERC721.contract.UnpackLog(event, "Transfer", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// IERC721EnumerableABI is the input ABI used to generate the binding from. +const IERC721EnumerableABI = "[{\"constant\":true,\"inputs\":[{\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"getApproved\",\"outputs\":[{\"name\":\"operator\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"to\",\"type\":\"address\"},{\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"from\",\"type\":\"address\"},{\"name\":\"to\",\"type\":\"address\"},{\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"owner\",\"type\":\"address\"},{\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"tokenOfOwnerByIndex\",\"outputs\":[{\"name\":\"tokenId\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"from\",\"type\":\"address\"},{\"name\":\"to\",\"type\":\"address\"},{\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"safeTransferFrom\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"tokenByIndex\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"ownerOf\",\"outputs\":[{\"name\":\"owner\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"name\":\"balance\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"operator\",\"type\":\"address\"},{\"name\":\"_approved\",\"type\":\"bool\"}],\"name\":\"setApprovalForAll\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"from\",\"type\":\"address\"},{\"name\":\"to\",\"type\":\"address\"},{\"name\":\"tokenId\",\"type\":\"uint256\"},{\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"safeTransferFrom\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"owner\",\"type\":\"address\"},{\"name\":\"operator\",\"type\":\"address\"}],\"name\":\"isApprovedForAll\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"to\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"approved\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"ApprovalForAll\",\"type\":\"event\"}]" + +// IERC721EnumerableFuncSigs maps the 4-byte function signature to its string representation. +var IERC721EnumerableFuncSigs = map[string]string{ + "095ea7b3": "approve(address,uint256)", + "70a08231": "balanceOf(address)", + "081812fc": "getApproved(uint256)", + "e985e9c5": "isApprovedForAll(address,address)", + "6352211e": "ownerOf(uint256)", + "42842e0e": "safeTransferFrom(address,address,uint256)", + "b88d4fde": "safeTransferFrom(address,address,uint256,bytes)", + "a22cb465": "setApprovalForAll(address,bool)", + "01ffc9a7": "supportsInterface(bytes4)", + "4f6ccce7": "tokenByIndex(uint256)", + "2f745c59": "tokenOfOwnerByIndex(address,uint256)", + "18160ddd": "totalSupply()", + "23b872dd": "transferFrom(address,address,uint256)", +} + +// IERC721Enumerable is an auto generated Go binding around an Ethereum contract. +type IERC721Enumerable struct { + IERC721EnumerableCaller // Read-only binding to the contract + IERC721EnumerableTransactor // Write-only binding to the contract + IERC721EnumerableFilterer // Log filterer for contract events +} + +// IERC721EnumerableCaller is an auto generated read-only Go binding around an Ethereum contract. +type IERC721EnumerableCaller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// IERC721EnumerableTransactor is an auto generated write-only Go binding around an Ethereum contract. +type IERC721EnumerableTransactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// IERC721EnumerableFilterer is an auto generated log filtering Go binding around an Ethereum contract events. +type IERC721EnumerableFilterer struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// IERC721EnumerableSession is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type IERC721EnumerableSession struct { + Contract *IERC721Enumerable // 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 +} + +// IERC721EnumerableCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type IERC721EnumerableCallerSession struct { + Contract *IERC721EnumerableCaller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// IERC721EnumerableTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type IERC721EnumerableTransactorSession struct { + Contract *IERC721EnumerableTransactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// IERC721EnumerableRaw is an auto generated low-level Go binding around an Ethereum contract. +type IERC721EnumerableRaw struct { + Contract *IERC721Enumerable // Generic contract binding to access the raw methods on +} + +// IERC721EnumerableCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type IERC721EnumerableCallerRaw struct { + Contract *IERC721EnumerableCaller // Generic read-only contract binding to access the raw methods on +} + +// IERC721EnumerableTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type IERC721EnumerableTransactorRaw struct { + Contract *IERC721EnumerableTransactor // Generic write-only contract binding to access the raw methods on +} + +// NewIERC721Enumerable creates a new instance of IERC721Enumerable, bound to a specific deployed contract. +func NewIERC721Enumerable(address common.Address, backend bind.ContractBackend) (*IERC721Enumerable, error) { + contract, err := bindIERC721Enumerable(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &IERC721Enumerable{IERC721EnumerableCaller: IERC721EnumerableCaller{contract: contract}, IERC721EnumerableTransactor: IERC721EnumerableTransactor{contract: contract}, IERC721EnumerableFilterer: IERC721EnumerableFilterer{contract: contract}}, nil +} + +// NewIERC721EnumerableCaller creates a new read-only instance of IERC721Enumerable, bound to a specific deployed contract. +func NewIERC721EnumerableCaller(address common.Address, caller bind.ContractCaller) (*IERC721EnumerableCaller, error) { + contract, err := bindIERC721Enumerable(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &IERC721EnumerableCaller{contract: contract}, nil +} + +// NewIERC721EnumerableTransactor creates a new write-only instance of IERC721Enumerable, bound to a specific deployed contract. +func NewIERC721EnumerableTransactor(address common.Address, transactor bind.ContractTransactor) (*IERC721EnumerableTransactor, error) { + contract, err := bindIERC721Enumerable(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &IERC721EnumerableTransactor{contract: contract}, nil +} + +// NewIERC721EnumerableFilterer creates a new log filterer instance of IERC721Enumerable, bound to a specific deployed contract. +func NewIERC721EnumerableFilterer(address common.Address, filterer bind.ContractFilterer) (*IERC721EnumerableFilterer, error) { + contract, err := bindIERC721Enumerable(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &IERC721EnumerableFilterer{contract: contract}, nil +} + +// bindIERC721Enumerable binds a generic wrapper to an already deployed contract. +func bindIERC721Enumerable(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := abi.JSON(strings.NewReader(IERC721EnumerableABI)) + 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 (_IERC721Enumerable *IERC721EnumerableRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _IERC721Enumerable.Contract.IERC721EnumerableCaller.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 (_IERC721Enumerable *IERC721EnumerableRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _IERC721Enumerable.Contract.IERC721EnumerableTransactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_IERC721Enumerable *IERC721EnumerableRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _IERC721Enumerable.Contract.IERC721EnumerableTransactor.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 (_IERC721Enumerable *IERC721EnumerableCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _IERC721Enumerable.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 (_IERC721Enumerable *IERC721EnumerableTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _IERC721Enumerable.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_IERC721Enumerable *IERC721EnumerableTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _IERC721Enumerable.Contract.contract.Transact(opts, method, params...) +} + +// BalanceOf is a free data retrieval call binding the contract method 0x70a08231. +// +// Solidity: function balanceOf(address owner) view returns(uint256 balance) +func (_IERC721Enumerable *IERC721EnumerableCaller) BalanceOf(opts *bind.CallOpts, owner common.Address) (*big.Int, error) { + var out []interface{} + err := _IERC721Enumerable.contract.Call(opts, &out, "balanceOf", owner) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// BalanceOf is a free data retrieval call binding the contract method 0x70a08231. +// +// Solidity: function balanceOf(address owner) view returns(uint256 balance) +func (_IERC721Enumerable *IERC721EnumerableSession) BalanceOf(owner common.Address) (*big.Int, error) { + return _IERC721Enumerable.Contract.BalanceOf(&_IERC721Enumerable.CallOpts, owner) +} + +// BalanceOf is a free data retrieval call binding the contract method 0x70a08231. +// +// Solidity: function balanceOf(address owner) view returns(uint256 balance) +func (_IERC721Enumerable *IERC721EnumerableCallerSession) BalanceOf(owner common.Address) (*big.Int, error) { + return _IERC721Enumerable.Contract.BalanceOf(&_IERC721Enumerable.CallOpts, owner) +} + +// GetApproved is a free data retrieval call binding the contract method 0x081812fc. +// +// Solidity: function getApproved(uint256 tokenId) view returns(address operator) +func (_IERC721Enumerable *IERC721EnumerableCaller) GetApproved(opts *bind.CallOpts, tokenId *big.Int) (common.Address, error) { + var out []interface{} + err := _IERC721Enumerable.contract.Call(opts, &out, "getApproved", tokenId) + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// GetApproved is a free data retrieval call binding the contract method 0x081812fc. +// +// Solidity: function getApproved(uint256 tokenId) view returns(address operator) +func (_IERC721Enumerable *IERC721EnumerableSession) GetApproved(tokenId *big.Int) (common.Address, error) { + return _IERC721Enumerable.Contract.GetApproved(&_IERC721Enumerable.CallOpts, tokenId) +} + +// GetApproved is a free data retrieval call binding the contract method 0x081812fc. +// +// Solidity: function getApproved(uint256 tokenId) view returns(address operator) +func (_IERC721Enumerable *IERC721EnumerableCallerSession) GetApproved(tokenId *big.Int) (common.Address, error) { + return _IERC721Enumerable.Contract.GetApproved(&_IERC721Enumerable.CallOpts, tokenId) +} + +// IsApprovedForAll is a free data retrieval call binding the contract method 0xe985e9c5. +// +// Solidity: function isApprovedForAll(address owner, address operator) view returns(bool) +func (_IERC721Enumerable *IERC721EnumerableCaller) IsApprovedForAll(opts *bind.CallOpts, owner common.Address, operator common.Address) (bool, error) { + var out []interface{} + err := _IERC721Enumerable.contract.Call(opts, &out, "isApprovedForAll", owner, operator) + + if err != nil { + return *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + + return out0, err + +} + +// IsApprovedForAll is a free data retrieval call binding the contract method 0xe985e9c5. +// +// Solidity: function isApprovedForAll(address owner, address operator) view returns(bool) +func (_IERC721Enumerable *IERC721EnumerableSession) IsApprovedForAll(owner common.Address, operator common.Address) (bool, error) { + return _IERC721Enumerable.Contract.IsApprovedForAll(&_IERC721Enumerable.CallOpts, owner, operator) +} + +// IsApprovedForAll is a free data retrieval call binding the contract method 0xe985e9c5. +// +// Solidity: function isApprovedForAll(address owner, address operator) view returns(bool) +func (_IERC721Enumerable *IERC721EnumerableCallerSession) IsApprovedForAll(owner common.Address, operator common.Address) (bool, error) { + return _IERC721Enumerable.Contract.IsApprovedForAll(&_IERC721Enumerable.CallOpts, owner, operator) +} + +// OwnerOf is a free data retrieval call binding the contract method 0x6352211e. +// +// Solidity: function ownerOf(uint256 tokenId) view returns(address owner) +func (_IERC721Enumerable *IERC721EnumerableCaller) OwnerOf(opts *bind.CallOpts, tokenId *big.Int) (common.Address, error) { + var out []interface{} + err := _IERC721Enumerable.contract.Call(opts, &out, "ownerOf", tokenId) + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// OwnerOf is a free data retrieval call binding the contract method 0x6352211e. +// +// Solidity: function ownerOf(uint256 tokenId) view returns(address owner) +func (_IERC721Enumerable *IERC721EnumerableSession) OwnerOf(tokenId *big.Int) (common.Address, error) { + return _IERC721Enumerable.Contract.OwnerOf(&_IERC721Enumerable.CallOpts, tokenId) +} + +// OwnerOf is a free data retrieval call binding the contract method 0x6352211e. +// +// Solidity: function ownerOf(uint256 tokenId) view returns(address owner) +func (_IERC721Enumerable *IERC721EnumerableCallerSession) OwnerOf(tokenId *big.Int) (common.Address, error) { + return _IERC721Enumerable.Contract.OwnerOf(&_IERC721Enumerable.CallOpts, tokenId) +} + +// SupportsInterface is a free data retrieval call binding the contract method 0x01ffc9a7. +// +// Solidity: function supportsInterface(bytes4 interfaceId) view returns(bool) +func (_IERC721Enumerable *IERC721EnumerableCaller) SupportsInterface(opts *bind.CallOpts, interfaceId [4]byte) (bool, error) { + var out []interface{} + err := _IERC721Enumerable.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 (_IERC721Enumerable *IERC721EnumerableSession) SupportsInterface(interfaceId [4]byte) (bool, error) { + return _IERC721Enumerable.Contract.SupportsInterface(&_IERC721Enumerable.CallOpts, interfaceId) +} + +// SupportsInterface is a free data retrieval call binding the contract method 0x01ffc9a7. +// +// Solidity: function supportsInterface(bytes4 interfaceId) view returns(bool) +func (_IERC721Enumerable *IERC721EnumerableCallerSession) SupportsInterface(interfaceId [4]byte) (bool, error) { + return _IERC721Enumerable.Contract.SupportsInterface(&_IERC721Enumerable.CallOpts, interfaceId) +} + +// TokenByIndex is a free data retrieval call binding the contract method 0x4f6ccce7. +// +// Solidity: function tokenByIndex(uint256 index) view returns(uint256) +func (_IERC721Enumerable *IERC721EnumerableCaller) TokenByIndex(opts *bind.CallOpts, index *big.Int) (*big.Int, error) { + var out []interface{} + err := _IERC721Enumerable.contract.Call(opts, &out, "tokenByIndex", index) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// TokenByIndex is a free data retrieval call binding the contract method 0x4f6ccce7. +// +// Solidity: function tokenByIndex(uint256 index) view returns(uint256) +func (_IERC721Enumerable *IERC721EnumerableSession) TokenByIndex(index *big.Int) (*big.Int, error) { + return _IERC721Enumerable.Contract.TokenByIndex(&_IERC721Enumerable.CallOpts, index) +} + +// TokenByIndex is a free data retrieval call binding the contract method 0x4f6ccce7. +// +// Solidity: function tokenByIndex(uint256 index) view returns(uint256) +func (_IERC721Enumerable *IERC721EnumerableCallerSession) TokenByIndex(index *big.Int) (*big.Int, error) { + return _IERC721Enumerable.Contract.TokenByIndex(&_IERC721Enumerable.CallOpts, index) +} + +// TokenOfOwnerByIndex is a free data retrieval call binding the contract method 0x2f745c59. +// +// Solidity: function tokenOfOwnerByIndex(address owner, uint256 index) view returns(uint256 tokenId) +func (_IERC721Enumerable *IERC721EnumerableCaller) TokenOfOwnerByIndex(opts *bind.CallOpts, owner common.Address, index *big.Int) (*big.Int, error) { + var out []interface{} + err := _IERC721Enumerable.contract.Call(opts, &out, "tokenOfOwnerByIndex", owner, index) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// TokenOfOwnerByIndex is a free data retrieval call binding the contract method 0x2f745c59. +// +// Solidity: function tokenOfOwnerByIndex(address owner, uint256 index) view returns(uint256 tokenId) +func (_IERC721Enumerable *IERC721EnumerableSession) TokenOfOwnerByIndex(owner common.Address, index *big.Int) (*big.Int, error) { + return _IERC721Enumerable.Contract.TokenOfOwnerByIndex(&_IERC721Enumerable.CallOpts, owner, index) +} + +// TokenOfOwnerByIndex is a free data retrieval call binding the contract method 0x2f745c59. +// +// Solidity: function tokenOfOwnerByIndex(address owner, uint256 index) view returns(uint256 tokenId) +func (_IERC721Enumerable *IERC721EnumerableCallerSession) TokenOfOwnerByIndex(owner common.Address, index *big.Int) (*big.Int, error) { + return _IERC721Enumerable.Contract.TokenOfOwnerByIndex(&_IERC721Enumerable.CallOpts, owner, index) +} + +// TotalSupply is a free data retrieval call binding the contract method 0x18160ddd. +// +// Solidity: function totalSupply() view returns(uint256) +func (_IERC721Enumerable *IERC721EnumerableCaller) TotalSupply(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _IERC721Enumerable.contract.Call(opts, &out, "totalSupply") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// TotalSupply is a free data retrieval call binding the contract method 0x18160ddd. +// +// Solidity: function totalSupply() view returns(uint256) +func (_IERC721Enumerable *IERC721EnumerableSession) TotalSupply() (*big.Int, error) { + return _IERC721Enumerable.Contract.TotalSupply(&_IERC721Enumerable.CallOpts) +} + +// TotalSupply is a free data retrieval call binding the contract method 0x18160ddd. +// +// Solidity: function totalSupply() view returns(uint256) +func (_IERC721Enumerable *IERC721EnumerableCallerSession) TotalSupply() (*big.Int, error) { + return _IERC721Enumerable.Contract.TotalSupply(&_IERC721Enumerable.CallOpts) +} + +// Approve is a paid mutator transaction binding the contract method 0x095ea7b3. +// +// Solidity: function approve(address to, uint256 tokenId) returns() +func (_IERC721Enumerable *IERC721EnumerableTransactor) Approve(opts *bind.TransactOpts, to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _IERC721Enumerable.contract.Transact(opts, "approve", to, tokenId) +} + +// Approve is a paid mutator transaction binding the contract method 0x095ea7b3. +// +// Solidity: function approve(address to, uint256 tokenId) returns() +func (_IERC721Enumerable *IERC721EnumerableSession) Approve(to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _IERC721Enumerable.Contract.Approve(&_IERC721Enumerable.TransactOpts, to, tokenId) +} + +// Approve is a paid mutator transaction binding the contract method 0x095ea7b3. +// +// Solidity: function approve(address to, uint256 tokenId) returns() +func (_IERC721Enumerable *IERC721EnumerableTransactorSession) Approve(to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _IERC721Enumerable.Contract.Approve(&_IERC721Enumerable.TransactOpts, to, tokenId) +} + +// SafeTransferFrom is a paid mutator transaction binding the contract method 0x42842e0e. +// +// Solidity: function safeTransferFrom(address from, address to, uint256 tokenId) returns() +func (_IERC721Enumerable *IERC721EnumerableTransactor) SafeTransferFrom(opts *bind.TransactOpts, from common.Address, to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _IERC721Enumerable.contract.Transact(opts, "safeTransferFrom", from, to, tokenId) +} + +// SafeTransferFrom is a paid mutator transaction binding the contract method 0x42842e0e. +// +// Solidity: function safeTransferFrom(address from, address to, uint256 tokenId) returns() +func (_IERC721Enumerable *IERC721EnumerableSession) SafeTransferFrom(from common.Address, to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _IERC721Enumerable.Contract.SafeTransferFrom(&_IERC721Enumerable.TransactOpts, from, to, tokenId) +} + +// SafeTransferFrom is a paid mutator transaction binding the contract method 0x42842e0e. +// +// Solidity: function safeTransferFrom(address from, address to, uint256 tokenId) returns() +func (_IERC721Enumerable *IERC721EnumerableTransactorSession) SafeTransferFrom(from common.Address, to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _IERC721Enumerable.Contract.SafeTransferFrom(&_IERC721Enumerable.TransactOpts, from, to, tokenId) +} + +// SafeTransferFrom0 is a paid mutator transaction binding the contract method 0xb88d4fde. +// +// Solidity: function safeTransferFrom(address from, address to, uint256 tokenId, bytes data) returns() +func (_IERC721Enumerable *IERC721EnumerableTransactor) SafeTransferFrom0(opts *bind.TransactOpts, from common.Address, to common.Address, tokenId *big.Int, data []byte) (*types.Transaction, error) { + return _IERC721Enumerable.contract.Transact(opts, "safeTransferFrom0", from, to, tokenId, data) +} + +// SafeTransferFrom0 is a paid mutator transaction binding the contract method 0xb88d4fde. +// +// Solidity: function safeTransferFrom(address from, address to, uint256 tokenId, bytes data) returns() +func (_IERC721Enumerable *IERC721EnumerableSession) SafeTransferFrom0(from common.Address, to common.Address, tokenId *big.Int, data []byte) (*types.Transaction, error) { + return _IERC721Enumerable.Contract.SafeTransferFrom0(&_IERC721Enumerable.TransactOpts, from, to, tokenId, data) +} + +// SafeTransferFrom0 is a paid mutator transaction binding the contract method 0xb88d4fde. +// +// Solidity: function safeTransferFrom(address from, address to, uint256 tokenId, bytes data) returns() +func (_IERC721Enumerable *IERC721EnumerableTransactorSession) SafeTransferFrom0(from common.Address, to common.Address, tokenId *big.Int, data []byte) (*types.Transaction, error) { + return _IERC721Enumerable.Contract.SafeTransferFrom0(&_IERC721Enumerable.TransactOpts, from, to, tokenId, data) +} + +// SetApprovalForAll is a paid mutator transaction binding the contract method 0xa22cb465. +// +// Solidity: function setApprovalForAll(address operator, bool _approved) returns() +func (_IERC721Enumerable *IERC721EnumerableTransactor) SetApprovalForAll(opts *bind.TransactOpts, operator common.Address, _approved bool) (*types.Transaction, error) { + return _IERC721Enumerable.contract.Transact(opts, "setApprovalForAll", operator, _approved) +} + +// SetApprovalForAll is a paid mutator transaction binding the contract method 0xa22cb465. +// +// Solidity: function setApprovalForAll(address operator, bool _approved) returns() +func (_IERC721Enumerable *IERC721EnumerableSession) SetApprovalForAll(operator common.Address, _approved bool) (*types.Transaction, error) { + return _IERC721Enumerable.Contract.SetApprovalForAll(&_IERC721Enumerable.TransactOpts, operator, _approved) +} + +// SetApprovalForAll is a paid mutator transaction binding the contract method 0xa22cb465. +// +// Solidity: function setApprovalForAll(address operator, bool _approved) returns() +func (_IERC721Enumerable *IERC721EnumerableTransactorSession) SetApprovalForAll(operator common.Address, _approved bool) (*types.Transaction, error) { + return _IERC721Enumerable.Contract.SetApprovalForAll(&_IERC721Enumerable.TransactOpts, operator, _approved) +} + +// TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd. +// +// Solidity: function transferFrom(address from, address to, uint256 tokenId) returns() +func (_IERC721Enumerable *IERC721EnumerableTransactor) TransferFrom(opts *bind.TransactOpts, from common.Address, to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _IERC721Enumerable.contract.Transact(opts, "transferFrom", from, to, tokenId) +} + +// TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd. +// +// Solidity: function transferFrom(address from, address to, uint256 tokenId) returns() +func (_IERC721Enumerable *IERC721EnumerableSession) TransferFrom(from common.Address, to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _IERC721Enumerable.Contract.TransferFrom(&_IERC721Enumerable.TransactOpts, from, to, tokenId) +} + +// TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd. +// +// Solidity: function transferFrom(address from, address to, uint256 tokenId) returns() +func (_IERC721Enumerable *IERC721EnumerableTransactorSession) TransferFrom(from common.Address, to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _IERC721Enumerable.Contract.TransferFrom(&_IERC721Enumerable.TransactOpts, from, to, tokenId) +} + +// IERC721EnumerableApprovalIterator is returned from FilterApproval and is used to iterate over the raw logs and unpacked data for Approval events raised by the IERC721Enumerable contract. +type IERC721EnumerableApprovalIterator struct { + Event *IERC721EnumerableApproval // 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 *IERC721EnumerableApprovalIterator) 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(IERC721EnumerableApproval) + 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(IERC721EnumerableApproval) + 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 *IERC721EnumerableApprovalIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *IERC721EnumerableApprovalIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// IERC721EnumerableApproval represents a Approval event raised by the IERC721Enumerable contract. +type IERC721EnumerableApproval struct { + Owner common.Address + Approved common.Address + TokenId *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterApproval is a free log retrieval operation binding the contract event 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925. +// +// Solidity: event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId) +func (_IERC721Enumerable *IERC721EnumerableFilterer) FilterApproval(opts *bind.FilterOpts, owner []common.Address, approved []common.Address, tokenId []*big.Int) (*IERC721EnumerableApprovalIterator, error) { + + var ownerRule []interface{} + for _, ownerItem := range owner { + ownerRule = append(ownerRule, ownerItem) + } + var approvedRule []interface{} + for _, approvedItem := range approved { + approvedRule = append(approvedRule, approvedItem) + } + var tokenIdRule []interface{} + for _, tokenIdItem := range tokenId { + tokenIdRule = append(tokenIdRule, tokenIdItem) + } + + logs, sub, err := _IERC721Enumerable.contract.FilterLogs(opts, "Approval", ownerRule, approvedRule, tokenIdRule) + if err != nil { + return nil, err + } + return &IERC721EnumerableApprovalIterator{contract: _IERC721Enumerable.contract, event: "Approval", logs: logs, sub: sub}, nil +} + +// WatchApproval is a free log subscription operation binding the contract event 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925. +// +// Solidity: event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId) +func (_IERC721Enumerable *IERC721EnumerableFilterer) WatchApproval(opts *bind.WatchOpts, sink chan<- *IERC721EnumerableApproval, owner []common.Address, approved []common.Address, tokenId []*big.Int) (event.Subscription, error) { + + var ownerRule []interface{} + for _, ownerItem := range owner { + ownerRule = append(ownerRule, ownerItem) + } + var approvedRule []interface{} + for _, approvedItem := range approved { + approvedRule = append(approvedRule, approvedItem) + } + var tokenIdRule []interface{} + for _, tokenIdItem := range tokenId { + tokenIdRule = append(tokenIdRule, tokenIdItem) + } + + logs, sub, err := _IERC721Enumerable.contract.WatchLogs(opts, "Approval", ownerRule, approvedRule, tokenIdRule) + 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(IERC721EnumerableApproval) + if err := _IERC721Enumerable.contract.UnpackLog(event, "Approval", 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 +} + +// ParseApproval is a log parse operation binding the contract event 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925. +// +// Solidity: event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId) +func (_IERC721Enumerable *IERC721EnumerableFilterer) ParseApproval(log types.Log) (*IERC721EnumerableApproval, error) { + event := new(IERC721EnumerableApproval) + if err := _IERC721Enumerable.contract.UnpackLog(event, "Approval", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// IERC721EnumerableApprovalForAllIterator is returned from FilterApprovalForAll and is used to iterate over the raw logs and unpacked data for ApprovalForAll events raised by the IERC721Enumerable contract. +type IERC721EnumerableApprovalForAllIterator struct { + Event *IERC721EnumerableApprovalForAll // 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 *IERC721EnumerableApprovalForAllIterator) 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(IERC721EnumerableApprovalForAll) + 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(IERC721EnumerableApprovalForAll) + 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 *IERC721EnumerableApprovalForAllIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *IERC721EnumerableApprovalForAllIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// IERC721EnumerableApprovalForAll represents a ApprovalForAll event raised by the IERC721Enumerable contract. +type IERC721EnumerableApprovalForAll struct { + Owner common.Address + Operator common.Address + Approved bool + Raw types.Log // Blockchain specific contextual infos +} + +// FilterApprovalForAll is a free log retrieval operation binding the contract event 0x17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31. +// +// Solidity: event ApprovalForAll(address indexed owner, address indexed operator, bool approved) +func (_IERC721Enumerable *IERC721EnumerableFilterer) FilterApprovalForAll(opts *bind.FilterOpts, owner []common.Address, operator []common.Address) (*IERC721EnumerableApprovalForAllIterator, error) { + + var ownerRule []interface{} + for _, ownerItem := range owner { + ownerRule = append(ownerRule, ownerItem) + } + var operatorRule []interface{} + for _, operatorItem := range operator { + operatorRule = append(operatorRule, operatorItem) + } + + logs, sub, err := _IERC721Enumerable.contract.FilterLogs(opts, "ApprovalForAll", ownerRule, operatorRule) + if err != nil { + return nil, err + } + return &IERC721EnumerableApprovalForAllIterator{contract: _IERC721Enumerable.contract, event: "ApprovalForAll", logs: logs, sub: sub}, nil +} + +// WatchApprovalForAll is a free log subscription operation binding the contract event 0x17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31. +// +// Solidity: event ApprovalForAll(address indexed owner, address indexed operator, bool approved) +func (_IERC721Enumerable *IERC721EnumerableFilterer) WatchApprovalForAll(opts *bind.WatchOpts, sink chan<- *IERC721EnumerableApprovalForAll, owner []common.Address, operator []common.Address) (event.Subscription, error) { + + var ownerRule []interface{} + for _, ownerItem := range owner { + ownerRule = append(ownerRule, ownerItem) + } + var operatorRule []interface{} + for _, operatorItem := range operator { + operatorRule = append(operatorRule, operatorItem) + } + + logs, sub, err := _IERC721Enumerable.contract.WatchLogs(opts, "ApprovalForAll", ownerRule, operatorRule) + 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(IERC721EnumerableApprovalForAll) + if err := _IERC721Enumerable.contract.UnpackLog(event, "ApprovalForAll", 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 +} + +// ParseApprovalForAll is a log parse operation binding the contract event 0x17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31. +// +// Solidity: event ApprovalForAll(address indexed owner, address indexed operator, bool approved) +func (_IERC721Enumerable *IERC721EnumerableFilterer) ParseApprovalForAll(log types.Log) (*IERC721EnumerableApprovalForAll, error) { + event := new(IERC721EnumerableApprovalForAll) + if err := _IERC721Enumerable.contract.UnpackLog(event, "ApprovalForAll", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// IERC721EnumerableTransferIterator is returned from FilterTransfer and is used to iterate over the raw logs and unpacked data for Transfer events raised by the IERC721Enumerable contract. +type IERC721EnumerableTransferIterator struct { + Event *IERC721EnumerableTransfer // 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 *IERC721EnumerableTransferIterator) 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(IERC721EnumerableTransfer) + 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(IERC721EnumerableTransfer) + 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 *IERC721EnumerableTransferIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *IERC721EnumerableTransferIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// IERC721EnumerableTransfer represents a Transfer event raised by the IERC721Enumerable contract. +type IERC721EnumerableTransfer struct { + From common.Address + To common.Address + TokenId *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterTransfer is a free log retrieval operation binding the contract event 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef. +// +// Solidity: event Transfer(address indexed from, address indexed to, uint256 indexed tokenId) +func (_IERC721Enumerable *IERC721EnumerableFilterer) FilterTransfer(opts *bind.FilterOpts, from []common.Address, to []common.Address, tokenId []*big.Int) (*IERC721EnumerableTransferIterator, error) { + + var fromRule []interface{} + for _, fromItem := range from { + fromRule = append(fromRule, fromItem) + } + var toRule []interface{} + for _, toItem := range to { + toRule = append(toRule, toItem) + } + var tokenIdRule []interface{} + for _, tokenIdItem := range tokenId { + tokenIdRule = append(tokenIdRule, tokenIdItem) + } + + logs, sub, err := _IERC721Enumerable.contract.FilterLogs(opts, "Transfer", fromRule, toRule, tokenIdRule) + if err != nil { + return nil, err + } + return &IERC721EnumerableTransferIterator{contract: _IERC721Enumerable.contract, event: "Transfer", logs: logs, sub: sub}, nil +} + +// WatchTransfer is a free log subscription operation binding the contract event 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef. +// +// Solidity: event Transfer(address indexed from, address indexed to, uint256 indexed tokenId) +func (_IERC721Enumerable *IERC721EnumerableFilterer) WatchTransfer(opts *bind.WatchOpts, sink chan<- *IERC721EnumerableTransfer, from []common.Address, to []common.Address, tokenId []*big.Int) (event.Subscription, error) { + + var fromRule []interface{} + for _, fromItem := range from { + fromRule = append(fromRule, fromItem) + } + var toRule []interface{} + for _, toItem := range to { + toRule = append(toRule, toItem) + } + var tokenIdRule []interface{} + for _, tokenIdItem := range tokenId { + tokenIdRule = append(tokenIdRule, tokenIdItem) + } + + logs, sub, err := _IERC721Enumerable.contract.WatchLogs(opts, "Transfer", fromRule, toRule, tokenIdRule) + 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(IERC721EnumerableTransfer) + if err := _IERC721Enumerable.contract.UnpackLog(event, "Transfer", 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 +} + +// ParseTransfer is a log parse operation binding the contract event 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef. +// +// Solidity: event Transfer(address indexed from, address indexed to, uint256 indexed tokenId) +func (_IERC721Enumerable *IERC721EnumerableFilterer) ParseTransfer(log types.Log) (*IERC721EnumerableTransfer, error) { + event := new(IERC721EnumerableTransfer) + if err := _IERC721Enumerable.contract.UnpackLog(event, "Transfer", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// IERC721FullABI is the input ABI used to generate the binding from. +const IERC721FullABI = "[{\"constant\":true,\"inputs\":[{\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"getApproved\",\"outputs\":[{\"name\":\"operator\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"to\",\"type\":\"address\"},{\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"from\",\"type\":\"address\"},{\"name\":\"to\",\"type\":\"address\"},{\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"owner\",\"type\":\"address\"},{\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"tokenOfOwnerByIndex\",\"outputs\":[{\"name\":\"tokenId\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"from\",\"type\":\"address\"},{\"name\":\"to\",\"type\":\"address\"},{\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"safeTransferFrom\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"tokenByIndex\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"ownerOf\",\"outputs\":[{\"name\":\"owner\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"name\":\"balance\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"symbol\",\"outputs\":[{\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"operator\",\"type\":\"address\"},{\"name\":\"_approved\",\"type\":\"bool\"}],\"name\":\"setApprovalForAll\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"from\",\"type\":\"address\"},{\"name\":\"to\",\"type\":\"address\"},{\"name\":\"tokenId\",\"type\":\"uint256\"},{\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"safeTransferFrom\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"tokenURI\",\"outputs\":[{\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"owner\",\"type\":\"address\"},{\"name\":\"operator\",\"type\":\"address\"}],\"name\":\"isApprovedForAll\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"to\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"approved\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"ApprovalForAll\",\"type\":\"event\"}]" + +// IERC721FullFuncSigs maps the 4-byte function signature to its string representation. +var IERC721FullFuncSigs = map[string]string{ + "095ea7b3": "approve(address,uint256)", + "70a08231": "balanceOf(address)", + "081812fc": "getApproved(uint256)", + "e985e9c5": "isApprovedForAll(address,address)", + "06fdde03": "name()", + "6352211e": "ownerOf(uint256)", + "42842e0e": "safeTransferFrom(address,address,uint256)", + "b88d4fde": "safeTransferFrom(address,address,uint256,bytes)", + "a22cb465": "setApprovalForAll(address,bool)", + "01ffc9a7": "supportsInterface(bytes4)", + "95d89b41": "symbol()", + "4f6ccce7": "tokenByIndex(uint256)", + "2f745c59": "tokenOfOwnerByIndex(address,uint256)", + "c87b56dd": "tokenURI(uint256)", + "18160ddd": "totalSupply()", + "23b872dd": "transferFrom(address,address,uint256)", +} + +// IERC721Full is an auto generated Go binding around an Ethereum contract. +type IERC721Full struct { + IERC721FullCaller // Read-only binding to the contract + IERC721FullTransactor // Write-only binding to the contract + IERC721FullFilterer // Log filterer for contract events +} + +// IERC721FullCaller is an auto generated read-only Go binding around an Ethereum contract. +type IERC721FullCaller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// IERC721FullTransactor is an auto generated write-only Go binding around an Ethereum contract. +type IERC721FullTransactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// IERC721FullFilterer is an auto generated log filtering Go binding around an Ethereum contract events. +type IERC721FullFilterer struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// IERC721FullSession is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type IERC721FullSession struct { + Contract *IERC721Full // 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 +} + +// IERC721FullCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type IERC721FullCallerSession struct { + Contract *IERC721FullCaller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// IERC721FullTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type IERC721FullTransactorSession struct { + Contract *IERC721FullTransactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// IERC721FullRaw is an auto generated low-level Go binding around an Ethereum contract. +type IERC721FullRaw struct { + Contract *IERC721Full // Generic contract binding to access the raw methods on +} + +// IERC721FullCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type IERC721FullCallerRaw struct { + Contract *IERC721FullCaller // Generic read-only contract binding to access the raw methods on +} + +// IERC721FullTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type IERC721FullTransactorRaw struct { + Contract *IERC721FullTransactor // Generic write-only contract binding to access the raw methods on +} + +// NewIERC721Full creates a new instance of IERC721Full, bound to a specific deployed contract. +func NewIERC721Full(address common.Address, backend bind.ContractBackend) (*IERC721Full, error) { + contract, err := bindIERC721Full(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &IERC721Full{IERC721FullCaller: IERC721FullCaller{contract: contract}, IERC721FullTransactor: IERC721FullTransactor{contract: contract}, IERC721FullFilterer: IERC721FullFilterer{contract: contract}}, nil +} + +// NewIERC721FullCaller creates a new read-only instance of IERC721Full, bound to a specific deployed contract. +func NewIERC721FullCaller(address common.Address, caller bind.ContractCaller) (*IERC721FullCaller, error) { + contract, err := bindIERC721Full(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &IERC721FullCaller{contract: contract}, nil +} + +// NewIERC721FullTransactor creates a new write-only instance of IERC721Full, bound to a specific deployed contract. +func NewIERC721FullTransactor(address common.Address, transactor bind.ContractTransactor) (*IERC721FullTransactor, error) { + contract, err := bindIERC721Full(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &IERC721FullTransactor{contract: contract}, nil +} + +// NewIERC721FullFilterer creates a new log filterer instance of IERC721Full, bound to a specific deployed contract. +func NewIERC721FullFilterer(address common.Address, filterer bind.ContractFilterer) (*IERC721FullFilterer, error) { + contract, err := bindIERC721Full(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &IERC721FullFilterer{contract: contract}, nil +} + +// bindIERC721Full binds a generic wrapper to an already deployed contract. +func bindIERC721Full(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := abi.JSON(strings.NewReader(IERC721FullABI)) + 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 (_IERC721Full *IERC721FullRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _IERC721Full.Contract.IERC721FullCaller.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 (_IERC721Full *IERC721FullRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _IERC721Full.Contract.IERC721FullTransactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_IERC721Full *IERC721FullRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _IERC721Full.Contract.IERC721FullTransactor.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 (_IERC721Full *IERC721FullCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _IERC721Full.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 (_IERC721Full *IERC721FullTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _IERC721Full.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_IERC721Full *IERC721FullTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _IERC721Full.Contract.contract.Transact(opts, method, params...) +} + +// BalanceOf is a free data retrieval call binding the contract method 0x70a08231. +// +// Solidity: function balanceOf(address owner) view returns(uint256 balance) +func (_IERC721Full *IERC721FullCaller) BalanceOf(opts *bind.CallOpts, owner common.Address) (*big.Int, error) { + var out []interface{} + err := _IERC721Full.contract.Call(opts, &out, "balanceOf", owner) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// BalanceOf is a free data retrieval call binding the contract method 0x70a08231. +// +// Solidity: function balanceOf(address owner) view returns(uint256 balance) +func (_IERC721Full *IERC721FullSession) BalanceOf(owner common.Address) (*big.Int, error) { + return _IERC721Full.Contract.BalanceOf(&_IERC721Full.CallOpts, owner) +} + +// BalanceOf is a free data retrieval call binding the contract method 0x70a08231. +// +// Solidity: function balanceOf(address owner) view returns(uint256 balance) +func (_IERC721Full *IERC721FullCallerSession) BalanceOf(owner common.Address) (*big.Int, error) { + return _IERC721Full.Contract.BalanceOf(&_IERC721Full.CallOpts, owner) +} + +// GetApproved is a free data retrieval call binding the contract method 0x081812fc. +// +// Solidity: function getApproved(uint256 tokenId) view returns(address operator) +func (_IERC721Full *IERC721FullCaller) GetApproved(opts *bind.CallOpts, tokenId *big.Int) (common.Address, error) { + var out []interface{} + err := _IERC721Full.contract.Call(opts, &out, "getApproved", tokenId) + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// GetApproved is a free data retrieval call binding the contract method 0x081812fc. +// +// Solidity: function getApproved(uint256 tokenId) view returns(address operator) +func (_IERC721Full *IERC721FullSession) GetApproved(tokenId *big.Int) (common.Address, error) { + return _IERC721Full.Contract.GetApproved(&_IERC721Full.CallOpts, tokenId) +} + +// GetApproved is a free data retrieval call binding the contract method 0x081812fc. +// +// Solidity: function getApproved(uint256 tokenId) view returns(address operator) +func (_IERC721Full *IERC721FullCallerSession) GetApproved(tokenId *big.Int) (common.Address, error) { + return _IERC721Full.Contract.GetApproved(&_IERC721Full.CallOpts, tokenId) +} + +// IsApprovedForAll is a free data retrieval call binding the contract method 0xe985e9c5. +// +// Solidity: function isApprovedForAll(address owner, address operator) view returns(bool) +func (_IERC721Full *IERC721FullCaller) IsApprovedForAll(opts *bind.CallOpts, owner common.Address, operator common.Address) (bool, error) { + var out []interface{} + err := _IERC721Full.contract.Call(opts, &out, "isApprovedForAll", owner, operator) + + if err != nil { + return *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + + return out0, err + +} + +// IsApprovedForAll is a free data retrieval call binding the contract method 0xe985e9c5. +// +// Solidity: function isApprovedForAll(address owner, address operator) view returns(bool) +func (_IERC721Full *IERC721FullSession) IsApprovedForAll(owner common.Address, operator common.Address) (bool, error) { + return _IERC721Full.Contract.IsApprovedForAll(&_IERC721Full.CallOpts, owner, operator) +} + +// IsApprovedForAll is a free data retrieval call binding the contract method 0xe985e9c5. +// +// Solidity: function isApprovedForAll(address owner, address operator) view returns(bool) +func (_IERC721Full *IERC721FullCallerSession) IsApprovedForAll(owner common.Address, operator common.Address) (bool, error) { + return _IERC721Full.Contract.IsApprovedForAll(&_IERC721Full.CallOpts, owner, operator) +} + +// Name is a free data retrieval call binding the contract method 0x06fdde03. +// +// Solidity: function name() view returns(string) +func (_IERC721Full *IERC721FullCaller) Name(opts *bind.CallOpts) (string, error) { + var out []interface{} + err := _IERC721Full.contract.Call(opts, &out, "name") + + if err != nil { + return *new(string), err + } + + out0 := *abi.ConvertType(out[0], new(string)).(*string) + + return out0, err + +} + +// Name is a free data retrieval call binding the contract method 0x06fdde03. +// +// Solidity: function name() view returns(string) +func (_IERC721Full *IERC721FullSession) Name() (string, error) { + return _IERC721Full.Contract.Name(&_IERC721Full.CallOpts) +} + +// Name is a free data retrieval call binding the contract method 0x06fdde03. +// +// Solidity: function name() view returns(string) +func (_IERC721Full *IERC721FullCallerSession) Name() (string, error) { + return _IERC721Full.Contract.Name(&_IERC721Full.CallOpts) +} + +// OwnerOf is a free data retrieval call binding the contract method 0x6352211e. +// +// Solidity: function ownerOf(uint256 tokenId) view returns(address owner) +func (_IERC721Full *IERC721FullCaller) OwnerOf(opts *bind.CallOpts, tokenId *big.Int) (common.Address, error) { + var out []interface{} + err := _IERC721Full.contract.Call(opts, &out, "ownerOf", tokenId) + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// OwnerOf is a free data retrieval call binding the contract method 0x6352211e. +// +// Solidity: function ownerOf(uint256 tokenId) view returns(address owner) +func (_IERC721Full *IERC721FullSession) OwnerOf(tokenId *big.Int) (common.Address, error) { + return _IERC721Full.Contract.OwnerOf(&_IERC721Full.CallOpts, tokenId) +} + +// OwnerOf is a free data retrieval call binding the contract method 0x6352211e. +// +// Solidity: function ownerOf(uint256 tokenId) view returns(address owner) +func (_IERC721Full *IERC721FullCallerSession) OwnerOf(tokenId *big.Int) (common.Address, error) { + return _IERC721Full.Contract.OwnerOf(&_IERC721Full.CallOpts, tokenId) +} + +// SupportsInterface is a free data retrieval call binding the contract method 0x01ffc9a7. +// +// Solidity: function supportsInterface(bytes4 interfaceId) view returns(bool) +func (_IERC721Full *IERC721FullCaller) SupportsInterface(opts *bind.CallOpts, interfaceId [4]byte) (bool, error) { + var out []interface{} + err := _IERC721Full.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 (_IERC721Full *IERC721FullSession) SupportsInterface(interfaceId [4]byte) (bool, error) { + return _IERC721Full.Contract.SupportsInterface(&_IERC721Full.CallOpts, interfaceId) +} + +// SupportsInterface is a free data retrieval call binding the contract method 0x01ffc9a7. +// +// Solidity: function supportsInterface(bytes4 interfaceId) view returns(bool) +func (_IERC721Full *IERC721FullCallerSession) SupportsInterface(interfaceId [4]byte) (bool, error) { + return _IERC721Full.Contract.SupportsInterface(&_IERC721Full.CallOpts, interfaceId) +} + +// Symbol is a free data retrieval call binding the contract method 0x95d89b41. +// +// Solidity: function symbol() view returns(string) +func (_IERC721Full *IERC721FullCaller) Symbol(opts *bind.CallOpts) (string, error) { + var out []interface{} + err := _IERC721Full.contract.Call(opts, &out, "symbol") + + if err != nil { + return *new(string), err + } + + out0 := *abi.ConvertType(out[0], new(string)).(*string) + + return out0, err + +} + +// Symbol is a free data retrieval call binding the contract method 0x95d89b41. +// +// Solidity: function symbol() view returns(string) +func (_IERC721Full *IERC721FullSession) Symbol() (string, error) { + return _IERC721Full.Contract.Symbol(&_IERC721Full.CallOpts) +} + +// Symbol is a free data retrieval call binding the contract method 0x95d89b41. +// +// Solidity: function symbol() view returns(string) +func (_IERC721Full *IERC721FullCallerSession) Symbol() (string, error) { + return _IERC721Full.Contract.Symbol(&_IERC721Full.CallOpts) +} + +// TokenByIndex is a free data retrieval call binding the contract method 0x4f6ccce7. +// +// Solidity: function tokenByIndex(uint256 index) view returns(uint256) +func (_IERC721Full *IERC721FullCaller) TokenByIndex(opts *bind.CallOpts, index *big.Int) (*big.Int, error) { + var out []interface{} + err := _IERC721Full.contract.Call(opts, &out, "tokenByIndex", index) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// TokenByIndex is a free data retrieval call binding the contract method 0x4f6ccce7. +// +// Solidity: function tokenByIndex(uint256 index) view returns(uint256) +func (_IERC721Full *IERC721FullSession) TokenByIndex(index *big.Int) (*big.Int, error) { + return _IERC721Full.Contract.TokenByIndex(&_IERC721Full.CallOpts, index) +} + +// TokenByIndex is a free data retrieval call binding the contract method 0x4f6ccce7. +// +// Solidity: function tokenByIndex(uint256 index) view returns(uint256) +func (_IERC721Full *IERC721FullCallerSession) TokenByIndex(index *big.Int) (*big.Int, error) { + return _IERC721Full.Contract.TokenByIndex(&_IERC721Full.CallOpts, index) +} + +// TokenOfOwnerByIndex is a free data retrieval call binding the contract method 0x2f745c59. +// +// Solidity: function tokenOfOwnerByIndex(address owner, uint256 index) view returns(uint256 tokenId) +func (_IERC721Full *IERC721FullCaller) TokenOfOwnerByIndex(opts *bind.CallOpts, owner common.Address, index *big.Int) (*big.Int, error) { + var out []interface{} + err := _IERC721Full.contract.Call(opts, &out, "tokenOfOwnerByIndex", owner, index) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// TokenOfOwnerByIndex is a free data retrieval call binding the contract method 0x2f745c59. +// +// Solidity: function tokenOfOwnerByIndex(address owner, uint256 index) view returns(uint256 tokenId) +func (_IERC721Full *IERC721FullSession) TokenOfOwnerByIndex(owner common.Address, index *big.Int) (*big.Int, error) { + return _IERC721Full.Contract.TokenOfOwnerByIndex(&_IERC721Full.CallOpts, owner, index) +} + +// TokenOfOwnerByIndex is a free data retrieval call binding the contract method 0x2f745c59. +// +// Solidity: function tokenOfOwnerByIndex(address owner, uint256 index) view returns(uint256 tokenId) +func (_IERC721Full *IERC721FullCallerSession) TokenOfOwnerByIndex(owner common.Address, index *big.Int) (*big.Int, error) { + return _IERC721Full.Contract.TokenOfOwnerByIndex(&_IERC721Full.CallOpts, owner, index) +} + +// TokenURI is a free data retrieval call binding the contract method 0xc87b56dd. +// +// Solidity: function tokenURI(uint256 tokenId) view returns(string) +func (_IERC721Full *IERC721FullCaller) TokenURI(opts *bind.CallOpts, tokenId *big.Int) (string, error) { + var out []interface{} + err := _IERC721Full.contract.Call(opts, &out, "tokenURI", tokenId) + + if err != nil { + return *new(string), err + } + + out0 := *abi.ConvertType(out[0], new(string)).(*string) + + return out0, err + +} + +// TokenURI is a free data retrieval call binding the contract method 0xc87b56dd. +// +// Solidity: function tokenURI(uint256 tokenId) view returns(string) +func (_IERC721Full *IERC721FullSession) TokenURI(tokenId *big.Int) (string, error) { + return _IERC721Full.Contract.TokenURI(&_IERC721Full.CallOpts, tokenId) +} + +// TokenURI is a free data retrieval call binding the contract method 0xc87b56dd. +// +// Solidity: function tokenURI(uint256 tokenId) view returns(string) +func (_IERC721Full *IERC721FullCallerSession) TokenURI(tokenId *big.Int) (string, error) { + return _IERC721Full.Contract.TokenURI(&_IERC721Full.CallOpts, tokenId) +} + +// TotalSupply is a free data retrieval call binding the contract method 0x18160ddd. +// +// Solidity: function totalSupply() view returns(uint256) +func (_IERC721Full *IERC721FullCaller) TotalSupply(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _IERC721Full.contract.Call(opts, &out, "totalSupply") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// TotalSupply is a free data retrieval call binding the contract method 0x18160ddd. +// +// Solidity: function totalSupply() view returns(uint256) +func (_IERC721Full *IERC721FullSession) TotalSupply() (*big.Int, error) { + return _IERC721Full.Contract.TotalSupply(&_IERC721Full.CallOpts) +} + +// TotalSupply is a free data retrieval call binding the contract method 0x18160ddd. +// +// Solidity: function totalSupply() view returns(uint256) +func (_IERC721Full *IERC721FullCallerSession) TotalSupply() (*big.Int, error) { + return _IERC721Full.Contract.TotalSupply(&_IERC721Full.CallOpts) +} + +// Approve is a paid mutator transaction binding the contract method 0x095ea7b3. +// +// Solidity: function approve(address to, uint256 tokenId) returns() +func (_IERC721Full *IERC721FullTransactor) Approve(opts *bind.TransactOpts, to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _IERC721Full.contract.Transact(opts, "approve", to, tokenId) +} + +// Approve is a paid mutator transaction binding the contract method 0x095ea7b3. +// +// Solidity: function approve(address to, uint256 tokenId) returns() +func (_IERC721Full *IERC721FullSession) Approve(to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _IERC721Full.Contract.Approve(&_IERC721Full.TransactOpts, to, tokenId) +} + +// Approve is a paid mutator transaction binding the contract method 0x095ea7b3. +// +// Solidity: function approve(address to, uint256 tokenId) returns() +func (_IERC721Full *IERC721FullTransactorSession) Approve(to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _IERC721Full.Contract.Approve(&_IERC721Full.TransactOpts, to, tokenId) +} + +// SafeTransferFrom is a paid mutator transaction binding the contract method 0x42842e0e. +// +// Solidity: function safeTransferFrom(address from, address to, uint256 tokenId) returns() +func (_IERC721Full *IERC721FullTransactor) SafeTransferFrom(opts *bind.TransactOpts, from common.Address, to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _IERC721Full.contract.Transact(opts, "safeTransferFrom", from, to, tokenId) +} + +// SafeTransferFrom is a paid mutator transaction binding the contract method 0x42842e0e. +// +// Solidity: function safeTransferFrom(address from, address to, uint256 tokenId) returns() +func (_IERC721Full *IERC721FullSession) SafeTransferFrom(from common.Address, to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _IERC721Full.Contract.SafeTransferFrom(&_IERC721Full.TransactOpts, from, to, tokenId) +} + +// SafeTransferFrom is a paid mutator transaction binding the contract method 0x42842e0e. +// +// Solidity: function safeTransferFrom(address from, address to, uint256 tokenId) returns() +func (_IERC721Full *IERC721FullTransactorSession) SafeTransferFrom(from common.Address, to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _IERC721Full.Contract.SafeTransferFrom(&_IERC721Full.TransactOpts, from, to, tokenId) +} + +// SafeTransferFrom0 is a paid mutator transaction binding the contract method 0xb88d4fde. +// +// Solidity: function safeTransferFrom(address from, address to, uint256 tokenId, bytes data) returns() +func (_IERC721Full *IERC721FullTransactor) SafeTransferFrom0(opts *bind.TransactOpts, from common.Address, to common.Address, tokenId *big.Int, data []byte) (*types.Transaction, error) { + return _IERC721Full.contract.Transact(opts, "safeTransferFrom0", from, to, tokenId, data) +} + +// SafeTransferFrom0 is a paid mutator transaction binding the contract method 0xb88d4fde. +// +// Solidity: function safeTransferFrom(address from, address to, uint256 tokenId, bytes data) returns() +func (_IERC721Full *IERC721FullSession) SafeTransferFrom0(from common.Address, to common.Address, tokenId *big.Int, data []byte) (*types.Transaction, error) { + return _IERC721Full.Contract.SafeTransferFrom0(&_IERC721Full.TransactOpts, from, to, tokenId, data) +} + +// SafeTransferFrom0 is a paid mutator transaction binding the contract method 0xb88d4fde. +// +// Solidity: function safeTransferFrom(address from, address to, uint256 tokenId, bytes data) returns() +func (_IERC721Full *IERC721FullTransactorSession) SafeTransferFrom0(from common.Address, to common.Address, tokenId *big.Int, data []byte) (*types.Transaction, error) { + return _IERC721Full.Contract.SafeTransferFrom0(&_IERC721Full.TransactOpts, from, to, tokenId, data) +} + +// SetApprovalForAll is a paid mutator transaction binding the contract method 0xa22cb465. +// +// Solidity: function setApprovalForAll(address operator, bool _approved) returns() +func (_IERC721Full *IERC721FullTransactor) SetApprovalForAll(opts *bind.TransactOpts, operator common.Address, _approved bool) (*types.Transaction, error) { + return _IERC721Full.contract.Transact(opts, "setApprovalForAll", operator, _approved) +} + +// SetApprovalForAll is a paid mutator transaction binding the contract method 0xa22cb465. +// +// Solidity: function setApprovalForAll(address operator, bool _approved) returns() +func (_IERC721Full *IERC721FullSession) SetApprovalForAll(operator common.Address, _approved bool) (*types.Transaction, error) { + return _IERC721Full.Contract.SetApprovalForAll(&_IERC721Full.TransactOpts, operator, _approved) +} + +// SetApprovalForAll is a paid mutator transaction binding the contract method 0xa22cb465. +// +// Solidity: function setApprovalForAll(address operator, bool _approved) returns() +func (_IERC721Full *IERC721FullTransactorSession) SetApprovalForAll(operator common.Address, _approved bool) (*types.Transaction, error) { + return _IERC721Full.Contract.SetApprovalForAll(&_IERC721Full.TransactOpts, operator, _approved) +} + +// TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd. +// +// Solidity: function transferFrom(address from, address to, uint256 tokenId) returns() +func (_IERC721Full *IERC721FullTransactor) TransferFrom(opts *bind.TransactOpts, from common.Address, to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _IERC721Full.contract.Transact(opts, "transferFrom", from, to, tokenId) +} + +// TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd. +// +// Solidity: function transferFrom(address from, address to, uint256 tokenId) returns() +func (_IERC721Full *IERC721FullSession) TransferFrom(from common.Address, to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _IERC721Full.Contract.TransferFrom(&_IERC721Full.TransactOpts, from, to, tokenId) +} + +// TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd. +// +// Solidity: function transferFrom(address from, address to, uint256 tokenId) returns() +func (_IERC721Full *IERC721FullTransactorSession) TransferFrom(from common.Address, to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _IERC721Full.Contract.TransferFrom(&_IERC721Full.TransactOpts, from, to, tokenId) +} + +// IERC721FullApprovalIterator is returned from FilterApproval and is used to iterate over the raw logs and unpacked data for Approval events raised by the IERC721Full contract. +type IERC721FullApprovalIterator struct { + Event *IERC721FullApproval // 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 *IERC721FullApprovalIterator) 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(IERC721FullApproval) + 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(IERC721FullApproval) + 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 *IERC721FullApprovalIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *IERC721FullApprovalIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// IERC721FullApproval represents a Approval event raised by the IERC721Full contract. +type IERC721FullApproval struct { + Owner common.Address + Approved common.Address + TokenId *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterApproval is a free log retrieval operation binding the contract event 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925. +// +// Solidity: event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId) +func (_IERC721Full *IERC721FullFilterer) FilterApproval(opts *bind.FilterOpts, owner []common.Address, approved []common.Address, tokenId []*big.Int) (*IERC721FullApprovalIterator, error) { + + var ownerRule []interface{} + for _, ownerItem := range owner { + ownerRule = append(ownerRule, ownerItem) + } + var approvedRule []interface{} + for _, approvedItem := range approved { + approvedRule = append(approvedRule, approvedItem) + } + var tokenIdRule []interface{} + for _, tokenIdItem := range tokenId { + tokenIdRule = append(tokenIdRule, tokenIdItem) + } + + logs, sub, err := _IERC721Full.contract.FilterLogs(opts, "Approval", ownerRule, approvedRule, tokenIdRule) + if err != nil { + return nil, err + } + return &IERC721FullApprovalIterator{contract: _IERC721Full.contract, event: "Approval", logs: logs, sub: sub}, nil +} + +// WatchApproval is a free log subscription operation binding the contract event 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925. +// +// Solidity: event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId) +func (_IERC721Full *IERC721FullFilterer) WatchApproval(opts *bind.WatchOpts, sink chan<- *IERC721FullApproval, owner []common.Address, approved []common.Address, tokenId []*big.Int) (event.Subscription, error) { + + var ownerRule []interface{} + for _, ownerItem := range owner { + ownerRule = append(ownerRule, ownerItem) + } + var approvedRule []interface{} + for _, approvedItem := range approved { + approvedRule = append(approvedRule, approvedItem) + } + var tokenIdRule []interface{} + for _, tokenIdItem := range tokenId { + tokenIdRule = append(tokenIdRule, tokenIdItem) + } + + logs, sub, err := _IERC721Full.contract.WatchLogs(opts, "Approval", ownerRule, approvedRule, tokenIdRule) + 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(IERC721FullApproval) + if err := _IERC721Full.contract.UnpackLog(event, "Approval", 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 +} + +// ParseApproval is a log parse operation binding the contract event 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925. +// +// Solidity: event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId) +func (_IERC721Full *IERC721FullFilterer) ParseApproval(log types.Log) (*IERC721FullApproval, error) { + event := new(IERC721FullApproval) + if err := _IERC721Full.contract.UnpackLog(event, "Approval", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// IERC721FullApprovalForAllIterator is returned from FilterApprovalForAll and is used to iterate over the raw logs and unpacked data for ApprovalForAll events raised by the IERC721Full contract. +type IERC721FullApprovalForAllIterator struct { + Event *IERC721FullApprovalForAll // 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 *IERC721FullApprovalForAllIterator) 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(IERC721FullApprovalForAll) + 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(IERC721FullApprovalForAll) + 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 *IERC721FullApprovalForAllIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *IERC721FullApprovalForAllIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// IERC721FullApprovalForAll represents a ApprovalForAll event raised by the IERC721Full contract. +type IERC721FullApprovalForAll struct { + Owner common.Address + Operator common.Address + Approved bool + Raw types.Log // Blockchain specific contextual infos +} + +// FilterApprovalForAll is a free log retrieval operation binding the contract event 0x17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31. +// +// Solidity: event ApprovalForAll(address indexed owner, address indexed operator, bool approved) +func (_IERC721Full *IERC721FullFilterer) FilterApprovalForAll(opts *bind.FilterOpts, owner []common.Address, operator []common.Address) (*IERC721FullApprovalForAllIterator, error) { + + var ownerRule []interface{} + for _, ownerItem := range owner { + ownerRule = append(ownerRule, ownerItem) + } + var operatorRule []interface{} + for _, operatorItem := range operator { + operatorRule = append(operatorRule, operatorItem) + } + + logs, sub, err := _IERC721Full.contract.FilterLogs(opts, "ApprovalForAll", ownerRule, operatorRule) + if err != nil { + return nil, err + } + return &IERC721FullApprovalForAllIterator{contract: _IERC721Full.contract, event: "ApprovalForAll", logs: logs, sub: sub}, nil +} + +// WatchApprovalForAll is a free log subscription operation binding the contract event 0x17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31. +// +// Solidity: event ApprovalForAll(address indexed owner, address indexed operator, bool approved) +func (_IERC721Full *IERC721FullFilterer) WatchApprovalForAll(opts *bind.WatchOpts, sink chan<- *IERC721FullApprovalForAll, owner []common.Address, operator []common.Address) (event.Subscription, error) { + + var ownerRule []interface{} + for _, ownerItem := range owner { + ownerRule = append(ownerRule, ownerItem) + } + var operatorRule []interface{} + for _, operatorItem := range operator { + operatorRule = append(operatorRule, operatorItem) + } + + logs, sub, err := _IERC721Full.contract.WatchLogs(opts, "ApprovalForAll", ownerRule, operatorRule) + 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(IERC721FullApprovalForAll) + if err := _IERC721Full.contract.UnpackLog(event, "ApprovalForAll", 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 +} + +// ParseApprovalForAll is a log parse operation binding the contract event 0x17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31. +// +// Solidity: event ApprovalForAll(address indexed owner, address indexed operator, bool approved) +func (_IERC721Full *IERC721FullFilterer) ParseApprovalForAll(log types.Log) (*IERC721FullApprovalForAll, error) { + event := new(IERC721FullApprovalForAll) + if err := _IERC721Full.contract.UnpackLog(event, "ApprovalForAll", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// IERC721FullTransferIterator is returned from FilterTransfer and is used to iterate over the raw logs and unpacked data for Transfer events raised by the IERC721Full contract. +type IERC721FullTransferIterator struct { + Event *IERC721FullTransfer // 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 *IERC721FullTransferIterator) 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(IERC721FullTransfer) + 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(IERC721FullTransfer) + 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 *IERC721FullTransferIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *IERC721FullTransferIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// IERC721FullTransfer represents a Transfer event raised by the IERC721Full contract. +type IERC721FullTransfer struct { + From common.Address + To common.Address + TokenId *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterTransfer is a free log retrieval operation binding the contract event 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef. +// +// Solidity: event Transfer(address indexed from, address indexed to, uint256 indexed tokenId) +func (_IERC721Full *IERC721FullFilterer) FilterTransfer(opts *bind.FilterOpts, from []common.Address, to []common.Address, tokenId []*big.Int) (*IERC721FullTransferIterator, error) { + + var fromRule []interface{} + for _, fromItem := range from { + fromRule = append(fromRule, fromItem) + } + var toRule []interface{} + for _, toItem := range to { + toRule = append(toRule, toItem) + } + var tokenIdRule []interface{} + for _, tokenIdItem := range tokenId { + tokenIdRule = append(tokenIdRule, tokenIdItem) + } + + logs, sub, err := _IERC721Full.contract.FilterLogs(opts, "Transfer", fromRule, toRule, tokenIdRule) + if err != nil { + return nil, err + } + return &IERC721FullTransferIterator{contract: _IERC721Full.contract, event: "Transfer", logs: logs, sub: sub}, nil +} + +// WatchTransfer is a free log subscription operation binding the contract event 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef. +// +// Solidity: event Transfer(address indexed from, address indexed to, uint256 indexed tokenId) +func (_IERC721Full *IERC721FullFilterer) WatchTransfer(opts *bind.WatchOpts, sink chan<- *IERC721FullTransfer, from []common.Address, to []common.Address, tokenId []*big.Int) (event.Subscription, error) { + + var fromRule []interface{} + for _, fromItem := range from { + fromRule = append(fromRule, fromItem) + } + var toRule []interface{} + for _, toItem := range to { + toRule = append(toRule, toItem) + } + var tokenIdRule []interface{} + for _, tokenIdItem := range tokenId { + tokenIdRule = append(tokenIdRule, tokenIdItem) + } + + logs, sub, err := _IERC721Full.contract.WatchLogs(opts, "Transfer", fromRule, toRule, tokenIdRule) + 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(IERC721FullTransfer) + if err := _IERC721Full.contract.UnpackLog(event, "Transfer", 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 +} + +// ParseTransfer is a log parse operation binding the contract event 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef. +// +// Solidity: event Transfer(address indexed from, address indexed to, uint256 indexed tokenId) +func (_IERC721Full *IERC721FullFilterer) ParseTransfer(log types.Log) (*IERC721FullTransfer, error) { + event := new(IERC721FullTransfer) + if err := _IERC721Full.contract.UnpackLog(event, "Transfer", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// IERC721MetadataABI is the input ABI used to generate the binding from. +const IERC721MetadataABI = "[{\"constant\":true,\"inputs\":[{\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"getApproved\",\"outputs\":[{\"name\":\"operator\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"to\",\"type\":\"address\"},{\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"from\",\"type\":\"address\"},{\"name\":\"to\",\"type\":\"address\"},{\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"from\",\"type\":\"address\"},{\"name\":\"to\",\"type\":\"address\"},{\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"safeTransferFrom\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"ownerOf\",\"outputs\":[{\"name\":\"owner\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"name\":\"balance\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"symbol\",\"outputs\":[{\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"operator\",\"type\":\"address\"},{\"name\":\"_approved\",\"type\":\"bool\"}],\"name\":\"setApprovalForAll\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"from\",\"type\":\"address\"},{\"name\":\"to\",\"type\":\"address\"},{\"name\":\"tokenId\",\"type\":\"uint256\"},{\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"safeTransferFrom\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"tokenURI\",\"outputs\":[{\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"owner\",\"type\":\"address\"},{\"name\":\"operator\",\"type\":\"address\"}],\"name\":\"isApprovedForAll\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"to\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"approved\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"ApprovalForAll\",\"type\":\"event\"}]" + +// IERC721MetadataFuncSigs maps the 4-byte function signature to its string representation. +var IERC721MetadataFuncSigs = map[string]string{ + "095ea7b3": "approve(address,uint256)", + "70a08231": "balanceOf(address)", + "081812fc": "getApproved(uint256)", + "e985e9c5": "isApprovedForAll(address,address)", + "06fdde03": "name()", + "6352211e": "ownerOf(uint256)", + "42842e0e": "safeTransferFrom(address,address,uint256)", + "b88d4fde": "safeTransferFrom(address,address,uint256,bytes)", + "a22cb465": "setApprovalForAll(address,bool)", + "01ffc9a7": "supportsInterface(bytes4)", + "95d89b41": "symbol()", + "c87b56dd": "tokenURI(uint256)", + "23b872dd": "transferFrom(address,address,uint256)", +} + +// IERC721Metadata is an auto generated Go binding around an Ethereum contract. +type IERC721Metadata struct { + IERC721MetadataCaller // Read-only binding to the contract + IERC721MetadataTransactor // Write-only binding to the contract + IERC721MetadataFilterer // Log filterer for contract events +} + +// IERC721MetadataCaller is an auto generated read-only Go binding around an Ethereum contract. +type IERC721MetadataCaller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// IERC721MetadataTransactor is an auto generated write-only Go binding around an Ethereum contract. +type IERC721MetadataTransactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// IERC721MetadataFilterer is an auto generated log filtering Go binding around an Ethereum contract events. +type IERC721MetadataFilterer struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// IERC721MetadataSession is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type IERC721MetadataSession struct { + Contract *IERC721Metadata // 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 +} + +// IERC721MetadataCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type IERC721MetadataCallerSession struct { + Contract *IERC721MetadataCaller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// IERC721MetadataTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type IERC721MetadataTransactorSession struct { + Contract *IERC721MetadataTransactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// IERC721MetadataRaw is an auto generated low-level Go binding around an Ethereum contract. +type IERC721MetadataRaw struct { + Contract *IERC721Metadata // Generic contract binding to access the raw methods on +} + +// IERC721MetadataCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type IERC721MetadataCallerRaw struct { + Contract *IERC721MetadataCaller // Generic read-only contract binding to access the raw methods on +} + +// IERC721MetadataTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type IERC721MetadataTransactorRaw struct { + Contract *IERC721MetadataTransactor // Generic write-only contract binding to access the raw methods on +} + +// NewIERC721Metadata creates a new instance of IERC721Metadata, bound to a specific deployed contract. +func NewIERC721Metadata(address common.Address, backend bind.ContractBackend) (*IERC721Metadata, error) { + contract, err := bindIERC721Metadata(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &IERC721Metadata{IERC721MetadataCaller: IERC721MetadataCaller{contract: contract}, IERC721MetadataTransactor: IERC721MetadataTransactor{contract: contract}, IERC721MetadataFilterer: IERC721MetadataFilterer{contract: contract}}, nil +} + +// NewIERC721MetadataCaller creates a new read-only instance of IERC721Metadata, bound to a specific deployed contract. +func NewIERC721MetadataCaller(address common.Address, caller bind.ContractCaller) (*IERC721MetadataCaller, error) { + contract, err := bindIERC721Metadata(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &IERC721MetadataCaller{contract: contract}, nil +} + +// NewIERC721MetadataTransactor creates a new write-only instance of IERC721Metadata, bound to a specific deployed contract. +func NewIERC721MetadataTransactor(address common.Address, transactor bind.ContractTransactor) (*IERC721MetadataTransactor, error) { + contract, err := bindIERC721Metadata(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &IERC721MetadataTransactor{contract: contract}, nil +} + +// NewIERC721MetadataFilterer creates a new log filterer instance of IERC721Metadata, bound to a specific deployed contract. +func NewIERC721MetadataFilterer(address common.Address, filterer bind.ContractFilterer) (*IERC721MetadataFilterer, error) { + contract, err := bindIERC721Metadata(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &IERC721MetadataFilterer{contract: contract}, nil +} + +// bindIERC721Metadata binds a generic wrapper to an already deployed contract. +func bindIERC721Metadata(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := abi.JSON(strings.NewReader(IERC721MetadataABI)) + 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 (_IERC721Metadata *IERC721MetadataRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _IERC721Metadata.Contract.IERC721MetadataCaller.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 (_IERC721Metadata *IERC721MetadataRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _IERC721Metadata.Contract.IERC721MetadataTransactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_IERC721Metadata *IERC721MetadataRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _IERC721Metadata.Contract.IERC721MetadataTransactor.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 (_IERC721Metadata *IERC721MetadataCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _IERC721Metadata.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 (_IERC721Metadata *IERC721MetadataTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _IERC721Metadata.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_IERC721Metadata *IERC721MetadataTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _IERC721Metadata.Contract.contract.Transact(opts, method, params...) +} + +// BalanceOf is a free data retrieval call binding the contract method 0x70a08231. +// +// Solidity: function balanceOf(address owner) view returns(uint256 balance) +func (_IERC721Metadata *IERC721MetadataCaller) BalanceOf(opts *bind.CallOpts, owner common.Address) (*big.Int, error) { + var out []interface{} + err := _IERC721Metadata.contract.Call(opts, &out, "balanceOf", owner) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// BalanceOf is a free data retrieval call binding the contract method 0x70a08231. +// +// Solidity: function balanceOf(address owner) view returns(uint256 balance) +func (_IERC721Metadata *IERC721MetadataSession) BalanceOf(owner common.Address) (*big.Int, error) { + return _IERC721Metadata.Contract.BalanceOf(&_IERC721Metadata.CallOpts, owner) +} + +// BalanceOf is a free data retrieval call binding the contract method 0x70a08231. +// +// Solidity: function balanceOf(address owner) view returns(uint256 balance) +func (_IERC721Metadata *IERC721MetadataCallerSession) BalanceOf(owner common.Address) (*big.Int, error) { + return _IERC721Metadata.Contract.BalanceOf(&_IERC721Metadata.CallOpts, owner) +} + +// GetApproved is a free data retrieval call binding the contract method 0x081812fc. +// +// Solidity: function getApproved(uint256 tokenId) view returns(address operator) +func (_IERC721Metadata *IERC721MetadataCaller) GetApproved(opts *bind.CallOpts, tokenId *big.Int) (common.Address, error) { + var out []interface{} + err := _IERC721Metadata.contract.Call(opts, &out, "getApproved", tokenId) + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// GetApproved is a free data retrieval call binding the contract method 0x081812fc. +// +// Solidity: function getApproved(uint256 tokenId) view returns(address operator) +func (_IERC721Metadata *IERC721MetadataSession) GetApproved(tokenId *big.Int) (common.Address, error) { + return _IERC721Metadata.Contract.GetApproved(&_IERC721Metadata.CallOpts, tokenId) +} + +// GetApproved is a free data retrieval call binding the contract method 0x081812fc. +// +// Solidity: function getApproved(uint256 tokenId) view returns(address operator) +func (_IERC721Metadata *IERC721MetadataCallerSession) GetApproved(tokenId *big.Int) (common.Address, error) { + return _IERC721Metadata.Contract.GetApproved(&_IERC721Metadata.CallOpts, tokenId) +} + +// IsApprovedForAll is a free data retrieval call binding the contract method 0xe985e9c5. +// +// Solidity: function isApprovedForAll(address owner, address operator) view returns(bool) +func (_IERC721Metadata *IERC721MetadataCaller) IsApprovedForAll(opts *bind.CallOpts, owner common.Address, operator common.Address) (bool, error) { + var out []interface{} + err := _IERC721Metadata.contract.Call(opts, &out, "isApprovedForAll", owner, operator) + + if err != nil { + return *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + + return out0, err + +} + +// IsApprovedForAll is a free data retrieval call binding the contract method 0xe985e9c5. +// +// Solidity: function isApprovedForAll(address owner, address operator) view returns(bool) +func (_IERC721Metadata *IERC721MetadataSession) IsApprovedForAll(owner common.Address, operator common.Address) (bool, error) { + return _IERC721Metadata.Contract.IsApprovedForAll(&_IERC721Metadata.CallOpts, owner, operator) +} + +// IsApprovedForAll is a free data retrieval call binding the contract method 0xe985e9c5. +// +// Solidity: function isApprovedForAll(address owner, address operator) view returns(bool) +func (_IERC721Metadata *IERC721MetadataCallerSession) IsApprovedForAll(owner common.Address, operator common.Address) (bool, error) { + return _IERC721Metadata.Contract.IsApprovedForAll(&_IERC721Metadata.CallOpts, owner, operator) +} + +// Name is a free data retrieval call binding the contract method 0x06fdde03. +// +// Solidity: function name() view returns(string) +func (_IERC721Metadata *IERC721MetadataCaller) Name(opts *bind.CallOpts) (string, error) { + var out []interface{} + err := _IERC721Metadata.contract.Call(opts, &out, "name") + + if err != nil { + return *new(string), err + } + + out0 := *abi.ConvertType(out[0], new(string)).(*string) + + return out0, err + +} + +// Name is a free data retrieval call binding the contract method 0x06fdde03. +// +// Solidity: function name() view returns(string) +func (_IERC721Metadata *IERC721MetadataSession) Name() (string, error) { + return _IERC721Metadata.Contract.Name(&_IERC721Metadata.CallOpts) +} + +// Name is a free data retrieval call binding the contract method 0x06fdde03. +// +// Solidity: function name() view returns(string) +func (_IERC721Metadata *IERC721MetadataCallerSession) Name() (string, error) { + return _IERC721Metadata.Contract.Name(&_IERC721Metadata.CallOpts) +} + +// OwnerOf is a free data retrieval call binding the contract method 0x6352211e. +// +// Solidity: function ownerOf(uint256 tokenId) view returns(address owner) +func (_IERC721Metadata *IERC721MetadataCaller) OwnerOf(opts *bind.CallOpts, tokenId *big.Int) (common.Address, error) { + var out []interface{} + err := _IERC721Metadata.contract.Call(opts, &out, "ownerOf", tokenId) + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// OwnerOf is a free data retrieval call binding the contract method 0x6352211e. +// +// Solidity: function ownerOf(uint256 tokenId) view returns(address owner) +func (_IERC721Metadata *IERC721MetadataSession) OwnerOf(tokenId *big.Int) (common.Address, error) { + return _IERC721Metadata.Contract.OwnerOf(&_IERC721Metadata.CallOpts, tokenId) +} + +// OwnerOf is a free data retrieval call binding the contract method 0x6352211e. +// +// Solidity: function ownerOf(uint256 tokenId) view returns(address owner) +func (_IERC721Metadata *IERC721MetadataCallerSession) OwnerOf(tokenId *big.Int) (common.Address, error) { + return _IERC721Metadata.Contract.OwnerOf(&_IERC721Metadata.CallOpts, tokenId) +} + +// SupportsInterface is a free data retrieval call binding the contract method 0x01ffc9a7. +// +// Solidity: function supportsInterface(bytes4 interfaceId) view returns(bool) +func (_IERC721Metadata *IERC721MetadataCaller) SupportsInterface(opts *bind.CallOpts, interfaceId [4]byte) (bool, error) { + var out []interface{} + err := _IERC721Metadata.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 (_IERC721Metadata *IERC721MetadataSession) SupportsInterface(interfaceId [4]byte) (bool, error) { + return _IERC721Metadata.Contract.SupportsInterface(&_IERC721Metadata.CallOpts, interfaceId) +} + +// SupportsInterface is a free data retrieval call binding the contract method 0x01ffc9a7. +// +// Solidity: function supportsInterface(bytes4 interfaceId) view returns(bool) +func (_IERC721Metadata *IERC721MetadataCallerSession) SupportsInterface(interfaceId [4]byte) (bool, error) { + return _IERC721Metadata.Contract.SupportsInterface(&_IERC721Metadata.CallOpts, interfaceId) +} + +// Symbol is a free data retrieval call binding the contract method 0x95d89b41. +// +// Solidity: function symbol() view returns(string) +func (_IERC721Metadata *IERC721MetadataCaller) Symbol(opts *bind.CallOpts) (string, error) { + var out []interface{} + err := _IERC721Metadata.contract.Call(opts, &out, "symbol") + + if err != nil { + return *new(string), err + } + + out0 := *abi.ConvertType(out[0], new(string)).(*string) + + return out0, err + +} + +// Symbol is a free data retrieval call binding the contract method 0x95d89b41. +// +// Solidity: function symbol() view returns(string) +func (_IERC721Metadata *IERC721MetadataSession) Symbol() (string, error) { + return _IERC721Metadata.Contract.Symbol(&_IERC721Metadata.CallOpts) +} + +// Symbol is a free data retrieval call binding the contract method 0x95d89b41. +// +// Solidity: function symbol() view returns(string) +func (_IERC721Metadata *IERC721MetadataCallerSession) Symbol() (string, error) { + return _IERC721Metadata.Contract.Symbol(&_IERC721Metadata.CallOpts) +} + +// TokenURI is a free data retrieval call binding the contract method 0xc87b56dd. +// +// Solidity: function tokenURI(uint256 tokenId) view returns(string) +func (_IERC721Metadata *IERC721MetadataCaller) TokenURI(opts *bind.CallOpts, tokenId *big.Int) (string, error) { + var out []interface{} + err := _IERC721Metadata.contract.Call(opts, &out, "tokenURI", tokenId) + + if err != nil { + return *new(string), err + } + + out0 := *abi.ConvertType(out[0], new(string)).(*string) + + return out0, err + +} + +// TokenURI is a free data retrieval call binding the contract method 0xc87b56dd. +// +// Solidity: function tokenURI(uint256 tokenId) view returns(string) +func (_IERC721Metadata *IERC721MetadataSession) TokenURI(tokenId *big.Int) (string, error) { + return _IERC721Metadata.Contract.TokenURI(&_IERC721Metadata.CallOpts, tokenId) +} + +// TokenURI is a free data retrieval call binding the contract method 0xc87b56dd. +// +// Solidity: function tokenURI(uint256 tokenId) view returns(string) +func (_IERC721Metadata *IERC721MetadataCallerSession) TokenURI(tokenId *big.Int) (string, error) { + return _IERC721Metadata.Contract.TokenURI(&_IERC721Metadata.CallOpts, tokenId) +} + +// Approve is a paid mutator transaction binding the contract method 0x095ea7b3. +// +// Solidity: function approve(address to, uint256 tokenId) returns() +func (_IERC721Metadata *IERC721MetadataTransactor) Approve(opts *bind.TransactOpts, to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _IERC721Metadata.contract.Transact(opts, "approve", to, tokenId) +} + +// Approve is a paid mutator transaction binding the contract method 0x095ea7b3. +// +// Solidity: function approve(address to, uint256 tokenId) returns() +func (_IERC721Metadata *IERC721MetadataSession) Approve(to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _IERC721Metadata.Contract.Approve(&_IERC721Metadata.TransactOpts, to, tokenId) +} + +// Approve is a paid mutator transaction binding the contract method 0x095ea7b3. +// +// Solidity: function approve(address to, uint256 tokenId) returns() +func (_IERC721Metadata *IERC721MetadataTransactorSession) Approve(to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _IERC721Metadata.Contract.Approve(&_IERC721Metadata.TransactOpts, to, tokenId) +} + +// SafeTransferFrom is a paid mutator transaction binding the contract method 0x42842e0e. +// +// Solidity: function safeTransferFrom(address from, address to, uint256 tokenId) returns() +func (_IERC721Metadata *IERC721MetadataTransactor) SafeTransferFrom(opts *bind.TransactOpts, from common.Address, to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _IERC721Metadata.contract.Transact(opts, "safeTransferFrom", from, to, tokenId) +} + +// SafeTransferFrom is a paid mutator transaction binding the contract method 0x42842e0e. +// +// Solidity: function safeTransferFrom(address from, address to, uint256 tokenId) returns() +func (_IERC721Metadata *IERC721MetadataSession) SafeTransferFrom(from common.Address, to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _IERC721Metadata.Contract.SafeTransferFrom(&_IERC721Metadata.TransactOpts, from, to, tokenId) +} + +// SafeTransferFrom is a paid mutator transaction binding the contract method 0x42842e0e. +// +// Solidity: function safeTransferFrom(address from, address to, uint256 tokenId) returns() +func (_IERC721Metadata *IERC721MetadataTransactorSession) SafeTransferFrom(from common.Address, to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _IERC721Metadata.Contract.SafeTransferFrom(&_IERC721Metadata.TransactOpts, from, to, tokenId) +} + +// SafeTransferFrom0 is a paid mutator transaction binding the contract method 0xb88d4fde. +// +// Solidity: function safeTransferFrom(address from, address to, uint256 tokenId, bytes data) returns() +func (_IERC721Metadata *IERC721MetadataTransactor) SafeTransferFrom0(opts *bind.TransactOpts, from common.Address, to common.Address, tokenId *big.Int, data []byte) (*types.Transaction, error) { + return _IERC721Metadata.contract.Transact(opts, "safeTransferFrom0", from, to, tokenId, data) +} + +// SafeTransferFrom0 is a paid mutator transaction binding the contract method 0xb88d4fde. +// +// Solidity: function safeTransferFrom(address from, address to, uint256 tokenId, bytes data) returns() +func (_IERC721Metadata *IERC721MetadataSession) SafeTransferFrom0(from common.Address, to common.Address, tokenId *big.Int, data []byte) (*types.Transaction, error) { + return _IERC721Metadata.Contract.SafeTransferFrom0(&_IERC721Metadata.TransactOpts, from, to, tokenId, data) +} + +// SafeTransferFrom0 is a paid mutator transaction binding the contract method 0xb88d4fde. +// +// Solidity: function safeTransferFrom(address from, address to, uint256 tokenId, bytes data) returns() +func (_IERC721Metadata *IERC721MetadataTransactorSession) SafeTransferFrom0(from common.Address, to common.Address, tokenId *big.Int, data []byte) (*types.Transaction, error) { + return _IERC721Metadata.Contract.SafeTransferFrom0(&_IERC721Metadata.TransactOpts, from, to, tokenId, data) +} + +// SetApprovalForAll is a paid mutator transaction binding the contract method 0xa22cb465. +// +// Solidity: function setApprovalForAll(address operator, bool _approved) returns() +func (_IERC721Metadata *IERC721MetadataTransactor) SetApprovalForAll(opts *bind.TransactOpts, operator common.Address, _approved bool) (*types.Transaction, error) { + return _IERC721Metadata.contract.Transact(opts, "setApprovalForAll", operator, _approved) +} + +// SetApprovalForAll is a paid mutator transaction binding the contract method 0xa22cb465. +// +// Solidity: function setApprovalForAll(address operator, bool _approved) returns() +func (_IERC721Metadata *IERC721MetadataSession) SetApprovalForAll(operator common.Address, _approved bool) (*types.Transaction, error) { + return _IERC721Metadata.Contract.SetApprovalForAll(&_IERC721Metadata.TransactOpts, operator, _approved) +} + +// SetApprovalForAll is a paid mutator transaction binding the contract method 0xa22cb465. +// +// Solidity: function setApprovalForAll(address operator, bool _approved) returns() +func (_IERC721Metadata *IERC721MetadataTransactorSession) SetApprovalForAll(operator common.Address, _approved bool) (*types.Transaction, error) { + return _IERC721Metadata.Contract.SetApprovalForAll(&_IERC721Metadata.TransactOpts, operator, _approved) +} + +// TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd. +// +// Solidity: function transferFrom(address from, address to, uint256 tokenId) returns() +func (_IERC721Metadata *IERC721MetadataTransactor) TransferFrom(opts *bind.TransactOpts, from common.Address, to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _IERC721Metadata.contract.Transact(opts, "transferFrom", from, to, tokenId) +} + +// TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd. +// +// Solidity: function transferFrom(address from, address to, uint256 tokenId) returns() +func (_IERC721Metadata *IERC721MetadataSession) TransferFrom(from common.Address, to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _IERC721Metadata.Contract.TransferFrom(&_IERC721Metadata.TransactOpts, from, to, tokenId) +} + +// TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd. +// +// Solidity: function transferFrom(address from, address to, uint256 tokenId) returns() +func (_IERC721Metadata *IERC721MetadataTransactorSession) TransferFrom(from common.Address, to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _IERC721Metadata.Contract.TransferFrom(&_IERC721Metadata.TransactOpts, from, to, tokenId) +} + +// IERC721MetadataApprovalIterator is returned from FilterApproval and is used to iterate over the raw logs and unpacked data for Approval events raised by the IERC721Metadata contract. +type IERC721MetadataApprovalIterator struct { + Event *IERC721MetadataApproval // 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 *IERC721MetadataApprovalIterator) 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(IERC721MetadataApproval) + 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(IERC721MetadataApproval) + 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 *IERC721MetadataApprovalIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *IERC721MetadataApprovalIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// IERC721MetadataApproval represents a Approval event raised by the IERC721Metadata contract. +type IERC721MetadataApproval struct { + Owner common.Address + Approved common.Address + TokenId *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterApproval is a free log retrieval operation binding the contract event 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925. +// +// Solidity: event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId) +func (_IERC721Metadata *IERC721MetadataFilterer) FilterApproval(opts *bind.FilterOpts, owner []common.Address, approved []common.Address, tokenId []*big.Int) (*IERC721MetadataApprovalIterator, error) { + + var ownerRule []interface{} + for _, ownerItem := range owner { + ownerRule = append(ownerRule, ownerItem) + } + var approvedRule []interface{} + for _, approvedItem := range approved { + approvedRule = append(approvedRule, approvedItem) + } + var tokenIdRule []interface{} + for _, tokenIdItem := range tokenId { + tokenIdRule = append(tokenIdRule, tokenIdItem) + } + + logs, sub, err := _IERC721Metadata.contract.FilterLogs(opts, "Approval", ownerRule, approvedRule, tokenIdRule) + if err != nil { + return nil, err + } + return &IERC721MetadataApprovalIterator{contract: _IERC721Metadata.contract, event: "Approval", logs: logs, sub: sub}, nil +} + +// WatchApproval is a free log subscription operation binding the contract event 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925. +// +// Solidity: event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId) +func (_IERC721Metadata *IERC721MetadataFilterer) WatchApproval(opts *bind.WatchOpts, sink chan<- *IERC721MetadataApproval, owner []common.Address, approved []common.Address, tokenId []*big.Int) (event.Subscription, error) { + + var ownerRule []interface{} + for _, ownerItem := range owner { + ownerRule = append(ownerRule, ownerItem) + } + var approvedRule []interface{} + for _, approvedItem := range approved { + approvedRule = append(approvedRule, approvedItem) + } + var tokenIdRule []interface{} + for _, tokenIdItem := range tokenId { + tokenIdRule = append(tokenIdRule, tokenIdItem) + } + + logs, sub, err := _IERC721Metadata.contract.WatchLogs(opts, "Approval", ownerRule, approvedRule, tokenIdRule) + 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(IERC721MetadataApproval) + if err := _IERC721Metadata.contract.UnpackLog(event, "Approval", 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 +} + +// ParseApproval is a log parse operation binding the contract event 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925. +// +// Solidity: event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId) +func (_IERC721Metadata *IERC721MetadataFilterer) ParseApproval(log types.Log) (*IERC721MetadataApproval, error) { + event := new(IERC721MetadataApproval) + if err := _IERC721Metadata.contract.UnpackLog(event, "Approval", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// IERC721MetadataApprovalForAllIterator is returned from FilterApprovalForAll and is used to iterate over the raw logs and unpacked data for ApprovalForAll events raised by the IERC721Metadata contract. +type IERC721MetadataApprovalForAllIterator struct { + Event *IERC721MetadataApprovalForAll // 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 *IERC721MetadataApprovalForAllIterator) 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(IERC721MetadataApprovalForAll) + 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(IERC721MetadataApprovalForAll) + 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 *IERC721MetadataApprovalForAllIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *IERC721MetadataApprovalForAllIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// IERC721MetadataApprovalForAll represents a ApprovalForAll event raised by the IERC721Metadata contract. +type IERC721MetadataApprovalForAll struct { + Owner common.Address + Operator common.Address + Approved bool + Raw types.Log // Blockchain specific contextual infos +} + +// FilterApprovalForAll is a free log retrieval operation binding the contract event 0x17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31. +// +// Solidity: event ApprovalForAll(address indexed owner, address indexed operator, bool approved) +func (_IERC721Metadata *IERC721MetadataFilterer) FilterApprovalForAll(opts *bind.FilterOpts, owner []common.Address, operator []common.Address) (*IERC721MetadataApprovalForAllIterator, error) { + + var ownerRule []interface{} + for _, ownerItem := range owner { + ownerRule = append(ownerRule, ownerItem) + } + var operatorRule []interface{} + for _, operatorItem := range operator { + operatorRule = append(operatorRule, operatorItem) + } + + logs, sub, err := _IERC721Metadata.contract.FilterLogs(opts, "ApprovalForAll", ownerRule, operatorRule) + if err != nil { + return nil, err + } + return &IERC721MetadataApprovalForAllIterator{contract: _IERC721Metadata.contract, event: "ApprovalForAll", logs: logs, sub: sub}, nil +} + +// WatchApprovalForAll is a free log subscription operation binding the contract event 0x17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31. +// +// Solidity: event ApprovalForAll(address indexed owner, address indexed operator, bool approved) +func (_IERC721Metadata *IERC721MetadataFilterer) WatchApprovalForAll(opts *bind.WatchOpts, sink chan<- *IERC721MetadataApprovalForAll, owner []common.Address, operator []common.Address) (event.Subscription, error) { + + var ownerRule []interface{} + for _, ownerItem := range owner { + ownerRule = append(ownerRule, ownerItem) + } + var operatorRule []interface{} + for _, operatorItem := range operator { + operatorRule = append(operatorRule, operatorItem) + } + + logs, sub, err := _IERC721Metadata.contract.WatchLogs(opts, "ApprovalForAll", ownerRule, operatorRule) + 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(IERC721MetadataApprovalForAll) + if err := _IERC721Metadata.contract.UnpackLog(event, "ApprovalForAll", 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 +} + +// ParseApprovalForAll is a log parse operation binding the contract event 0x17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31. +// +// Solidity: event ApprovalForAll(address indexed owner, address indexed operator, bool approved) +func (_IERC721Metadata *IERC721MetadataFilterer) ParseApprovalForAll(log types.Log) (*IERC721MetadataApprovalForAll, error) { + event := new(IERC721MetadataApprovalForAll) + if err := _IERC721Metadata.contract.UnpackLog(event, "ApprovalForAll", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// IERC721MetadataTransferIterator is returned from FilterTransfer and is used to iterate over the raw logs and unpacked data for Transfer events raised by the IERC721Metadata contract. +type IERC721MetadataTransferIterator struct { + Event *IERC721MetadataTransfer // 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 *IERC721MetadataTransferIterator) 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(IERC721MetadataTransfer) + 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(IERC721MetadataTransfer) + 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 *IERC721MetadataTransferIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *IERC721MetadataTransferIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// IERC721MetadataTransfer represents a Transfer event raised by the IERC721Metadata contract. +type IERC721MetadataTransfer struct { + From common.Address + To common.Address + TokenId *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterTransfer is a free log retrieval operation binding the contract event 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef. +// +// Solidity: event Transfer(address indexed from, address indexed to, uint256 indexed tokenId) +func (_IERC721Metadata *IERC721MetadataFilterer) FilterTransfer(opts *bind.FilterOpts, from []common.Address, to []common.Address, tokenId []*big.Int) (*IERC721MetadataTransferIterator, error) { + + var fromRule []interface{} + for _, fromItem := range from { + fromRule = append(fromRule, fromItem) + } + var toRule []interface{} + for _, toItem := range to { + toRule = append(toRule, toItem) + } + var tokenIdRule []interface{} + for _, tokenIdItem := range tokenId { + tokenIdRule = append(tokenIdRule, tokenIdItem) + } + + logs, sub, err := _IERC721Metadata.contract.FilterLogs(opts, "Transfer", fromRule, toRule, tokenIdRule) + if err != nil { + return nil, err + } + return &IERC721MetadataTransferIterator{contract: _IERC721Metadata.contract, event: "Transfer", logs: logs, sub: sub}, nil +} + +// WatchTransfer is a free log subscription operation binding the contract event 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef. +// +// Solidity: event Transfer(address indexed from, address indexed to, uint256 indexed tokenId) +func (_IERC721Metadata *IERC721MetadataFilterer) WatchTransfer(opts *bind.WatchOpts, sink chan<- *IERC721MetadataTransfer, from []common.Address, to []common.Address, tokenId []*big.Int) (event.Subscription, error) { + + var fromRule []interface{} + for _, fromItem := range from { + fromRule = append(fromRule, fromItem) + } + var toRule []interface{} + for _, toItem := range to { + toRule = append(toRule, toItem) + } + var tokenIdRule []interface{} + for _, tokenIdItem := range tokenId { + tokenIdRule = append(tokenIdRule, tokenIdItem) + } + + logs, sub, err := _IERC721Metadata.contract.WatchLogs(opts, "Transfer", fromRule, toRule, tokenIdRule) + 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(IERC721MetadataTransfer) + if err := _IERC721Metadata.contract.UnpackLog(event, "Transfer", 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 +} + +// ParseTransfer is a log parse operation binding the contract event 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef. +// +// Solidity: event Transfer(address indexed from, address indexed to, uint256 indexed tokenId) +func (_IERC721Metadata *IERC721MetadataFilterer) ParseTransfer(log types.Log) (*IERC721MetadataTransfer, error) { + event := new(IERC721MetadataTransfer) + if err := _IERC721Metadata.contract.UnpackLog(event, "Transfer", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// IERC721ReceiverABI is the input ABI used to generate the binding from. +const IERC721ReceiverABI = "[{\"constant\":false,\"inputs\":[{\"name\":\"operator\",\"type\":\"address\"},{\"name\":\"from\",\"type\":\"address\"},{\"name\":\"tokenId\",\"type\":\"uint256\"},{\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"onERC721Received\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes4\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]" + +// IERC721ReceiverFuncSigs maps the 4-byte function signature to its string representation. +var IERC721ReceiverFuncSigs = map[string]string{ + "150b7a02": "onERC721Received(address,address,uint256,bytes)", +} + +// IERC721Receiver is an auto generated Go binding around an Ethereum contract. +type IERC721Receiver struct { + IERC721ReceiverCaller // Read-only binding to the contract + IERC721ReceiverTransactor // Write-only binding to the contract + IERC721ReceiverFilterer // Log filterer for contract events +} + +// IERC721ReceiverCaller is an auto generated read-only Go binding around an Ethereum contract. +type IERC721ReceiverCaller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// IERC721ReceiverTransactor is an auto generated write-only Go binding around an Ethereum contract. +type IERC721ReceiverTransactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// IERC721ReceiverFilterer is an auto generated log filtering Go binding around an Ethereum contract events. +type IERC721ReceiverFilterer struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// IERC721ReceiverSession is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type IERC721ReceiverSession struct { + Contract *IERC721Receiver // 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 +} + +// IERC721ReceiverCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type IERC721ReceiverCallerSession struct { + Contract *IERC721ReceiverCaller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// IERC721ReceiverTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type IERC721ReceiverTransactorSession struct { + Contract *IERC721ReceiverTransactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// IERC721ReceiverRaw is an auto generated low-level Go binding around an Ethereum contract. +type IERC721ReceiverRaw struct { + Contract *IERC721Receiver // Generic contract binding to access the raw methods on +} + +// IERC721ReceiverCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type IERC721ReceiverCallerRaw struct { + Contract *IERC721ReceiverCaller // Generic read-only contract binding to access the raw methods on +} + +// IERC721ReceiverTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type IERC721ReceiverTransactorRaw struct { + Contract *IERC721ReceiverTransactor // Generic write-only contract binding to access the raw methods on +} + +// NewIERC721Receiver creates a new instance of IERC721Receiver, bound to a specific deployed contract. +func NewIERC721Receiver(address common.Address, backend bind.ContractBackend) (*IERC721Receiver, error) { + contract, err := bindIERC721Receiver(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &IERC721Receiver{IERC721ReceiverCaller: IERC721ReceiverCaller{contract: contract}, IERC721ReceiverTransactor: IERC721ReceiverTransactor{contract: contract}, IERC721ReceiverFilterer: IERC721ReceiverFilterer{contract: contract}}, nil +} + +// NewIERC721ReceiverCaller creates a new read-only instance of IERC721Receiver, bound to a specific deployed contract. +func NewIERC721ReceiverCaller(address common.Address, caller bind.ContractCaller) (*IERC721ReceiverCaller, error) { + contract, err := bindIERC721Receiver(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &IERC721ReceiverCaller{contract: contract}, nil +} + +// NewIERC721ReceiverTransactor creates a new write-only instance of IERC721Receiver, bound to a specific deployed contract. +func NewIERC721ReceiverTransactor(address common.Address, transactor bind.ContractTransactor) (*IERC721ReceiverTransactor, error) { + contract, err := bindIERC721Receiver(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &IERC721ReceiverTransactor{contract: contract}, nil +} + +// NewIERC721ReceiverFilterer creates a new log filterer instance of IERC721Receiver, bound to a specific deployed contract. +func NewIERC721ReceiverFilterer(address common.Address, filterer bind.ContractFilterer) (*IERC721ReceiverFilterer, error) { + contract, err := bindIERC721Receiver(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &IERC721ReceiverFilterer{contract: contract}, nil +} + +// bindIERC721Receiver binds a generic wrapper to an already deployed contract. +func bindIERC721Receiver(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := abi.JSON(strings.NewReader(IERC721ReceiverABI)) + 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 (_IERC721Receiver *IERC721ReceiverRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _IERC721Receiver.Contract.IERC721ReceiverCaller.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 (_IERC721Receiver *IERC721ReceiverRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _IERC721Receiver.Contract.IERC721ReceiverTransactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_IERC721Receiver *IERC721ReceiverRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _IERC721Receiver.Contract.IERC721ReceiverTransactor.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 (_IERC721Receiver *IERC721ReceiverCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _IERC721Receiver.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 (_IERC721Receiver *IERC721ReceiverTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _IERC721Receiver.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_IERC721Receiver *IERC721ReceiverTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _IERC721Receiver.Contract.contract.Transact(opts, method, params...) +} + +// OnERC721Received is a paid mutator transaction binding the contract method 0x150b7a02. +// +// Solidity: function onERC721Received(address operator, address from, uint256 tokenId, bytes data) returns(bytes4) +func (_IERC721Receiver *IERC721ReceiverTransactor) OnERC721Received(opts *bind.TransactOpts, operator common.Address, from common.Address, tokenId *big.Int, data []byte) (*types.Transaction, error) { + return _IERC721Receiver.contract.Transact(opts, "onERC721Received", operator, from, tokenId, data) +} + +// OnERC721Received is a paid mutator transaction binding the contract method 0x150b7a02. +// +// Solidity: function onERC721Received(address operator, address from, uint256 tokenId, bytes data) returns(bytes4) +func (_IERC721Receiver *IERC721ReceiverSession) OnERC721Received(operator common.Address, from common.Address, tokenId *big.Int, data []byte) (*types.Transaction, error) { + return _IERC721Receiver.Contract.OnERC721Received(&_IERC721Receiver.TransactOpts, operator, from, tokenId, data) +} + +// OnERC721Received is a paid mutator transaction binding the contract method 0x150b7a02. +// +// Solidity: function onERC721Received(address operator, address from, uint256 tokenId, bytes data) returns(bytes4) +func (_IERC721Receiver *IERC721ReceiverTransactorSession) OnERC721Received(operator common.Address, from common.Address, tokenId *big.Int, data []byte) (*types.Transaction, error) { + return _IERC721Receiver.Contract.OnERC721Received(&_IERC721Receiver.TransactOpts, operator, from, tokenId, data) +} + +// SafeMathABI is the input ABI used to generate the binding from. +const SafeMathABI = "[]" + +// SafeMathBin is the compiled bytecode used for deploying new contracts. +var SafeMathBin = "0x60556023600b82828239805160001a607314601657fe5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea265627a7a7230582065f8678fbab15838ed684918f948dc69b859a195f9bc3976712965adc70ab9b364736f6c634300050a0032" + +// DeploySafeMath deploys a new Ethereum contract, binding an instance of SafeMath to it. +func DeploySafeMath(auth *bind.TransactOpts, backend bind.ContractBackend) (common.Address, *types.Transaction, *SafeMath, error) { + parsed, err := abi.JSON(strings.NewReader(SafeMathABI)) + if err != nil { + return common.Address{}, nil, nil, err + } + + address, tx, contract, err := bind.DeployContract(auth, parsed, common.FromHex(SafeMathBin), backend) + if err != nil { + return common.Address{}, nil, nil, err + } + return address, tx, &SafeMath{SafeMathCaller: SafeMathCaller{contract: contract}, SafeMathTransactor: SafeMathTransactor{contract: contract}, SafeMathFilterer: SafeMathFilterer{contract: contract}}, nil +} + +// SafeMath is an auto generated Go binding around an Ethereum contract. +type SafeMath struct { + SafeMathCaller // Read-only binding to the contract + SafeMathTransactor // Write-only binding to the contract + SafeMathFilterer // Log filterer for contract events +} + +// SafeMathCaller is an auto generated read-only Go binding around an Ethereum contract. +type SafeMathCaller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// SafeMathTransactor is an auto generated write-only Go binding around an Ethereum contract. +type SafeMathTransactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// SafeMathFilterer is an auto generated log filtering Go binding around an Ethereum contract events. +type SafeMathFilterer struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// SafeMathSession is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type SafeMathSession struct { + Contract *SafeMath // 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 +} + +// SafeMathCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type SafeMathCallerSession struct { + Contract *SafeMathCaller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// SafeMathTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type SafeMathTransactorSession struct { + Contract *SafeMathTransactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// SafeMathRaw is an auto generated low-level Go binding around an Ethereum contract. +type SafeMathRaw struct { + Contract *SafeMath // Generic contract binding to access the raw methods on +} + +// SafeMathCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type SafeMathCallerRaw struct { + Contract *SafeMathCaller // Generic read-only contract binding to access the raw methods on +} + +// SafeMathTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type SafeMathTransactorRaw struct { + Contract *SafeMathTransactor // Generic write-only contract binding to access the raw methods on +} + +// NewSafeMath creates a new instance of SafeMath, bound to a specific deployed contract. +func NewSafeMath(address common.Address, backend bind.ContractBackend) (*SafeMath, error) { + contract, err := bindSafeMath(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &SafeMath{SafeMathCaller: SafeMathCaller{contract: contract}, SafeMathTransactor: SafeMathTransactor{contract: contract}, SafeMathFilterer: SafeMathFilterer{contract: contract}}, nil +} + +// NewSafeMathCaller creates a new read-only instance of SafeMath, bound to a specific deployed contract. +func NewSafeMathCaller(address common.Address, caller bind.ContractCaller) (*SafeMathCaller, error) { + contract, err := bindSafeMath(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &SafeMathCaller{contract: contract}, nil +} + +// NewSafeMathTransactor creates a new write-only instance of SafeMath, bound to a specific deployed contract. +func NewSafeMathTransactor(address common.Address, transactor bind.ContractTransactor) (*SafeMathTransactor, error) { + contract, err := bindSafeMath(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &SafeMathTransactor{contract: contract}, nil +} + +// NewSafeMathFilterer creates a new log filterer instance of SafeMath, bound to a specific deployed contract. +func NewSafeMathFilterer(address common.Address, filterer bind.ContractFilterer) (*SafeMathFilterer, error) { + contract, err := bindSafeMath(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &SafeMathFilterer{contract: contract}, nil +} + +// bindSafeMath binds a generic wrapper to an already deployed contract. +func bindSafeMath(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := abi.JSON(strings.NewReader(SafeMathABI)) + 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 (_SafeMath *SafeMathRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _SafeMath.Contract.SafeMathCaller.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 (_SafeMath *SafeMathRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _SafeMath.Contract.SafeMathTransactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_SafeMath *SafeMathRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _SafeMath.Contract.SafeMathTransactor.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 (_SafeMath *SafeMathCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _SafeMath.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 (_SafeMath *SafeMathTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _SafeMath.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_SafeMath *SafeMathTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _SafeMath.Contract.contract.Transact(opts, method, params...) +} + +// StickerMarketABI is the input ABI used to generate the binding from. +const StickerMarketABI = "[{\"constant\":false,\"inputs\":[{\"name\":\"_packId\",\"type\":\"uint256\"},{\"name\":\"_limit\",\"type\":\"uint256\"}],\"name\":\"purgePack\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"snt\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"stickerType\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_owner\",\"type\":\"address\"},{\"name\":\"_packId\",\"type\":\"uint256\"}],\"name\":\"generateToken\",\"outputs\":[{\"name\":\"tokenId\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_value\",\"type\":\"uint256\"}],\"name\":\"setBurnRate\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_price\",\"type\":\"uint256\"},{\"name\":\"_donate\",\"type\":\"uint256\"},{\"name\":\"_category\",\"type\":\"bytes4[]\"},{\"name\":\"_owner\",\"type\":\"address\"},{\"name\":\"_contenthash\",\"type\":\"bytes\"},{\"name\":\"_fee\",\"type\":\"uint256\"}],\"name\":\"registerPack\",\"outputs\":[{\"name\":\"packId\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_newController\",\"type\":\"address\"}],\"name\":\"changeController\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"stickerPack\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_price\",\"type\":\"uint256\"},{\"name\":\"_donate\",\"type\":\"uint256\"},{\"name\":\"_category\",\"type\":\"bytes4[]\"},{\"name\":\"_owner\",\"type\":\"address\"},{\"name\":\"_contenthash\",\"type\":\"bytes\"}],\"name\":\"generatePack\",\"outputs\":[{\"name\":\"packId\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_state\",\"type\":\"uint8\"}],\"name\":\"setMarketState\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_from\",\"type\":\"address\"},{\"name\":\"_value\",\"type\":\"uint256\"},{\"name\":\"_token\",\"type\":\"address\"},{\"name\":\"_data\",\"type\":\"bytes\"}],\"name\":\"receiveApproval\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_value\",\"type\":\"uint256\"}],\"name\":\"setRegisterFee\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_tokenId\",\"type\":\"uint256\"}],\"name\":\"getTokenData\",\"outputs\":[{\"name\":\"category\",\"type\":\"bytes4[]\"},{\"name\":\"timestamp\",\"type\":\"uint256\"},{\"name\":\"contenthash\",\"type\":\"bytes\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"state\",\"outputs\":[{\"name\":\"\",\"type\":\"uint8\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_newController\",\"type\":\"address\"}],\"name\":\"migrate\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_token\",\"type\":\"address\"}],\"name\":\"claimTokens\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_packId\",\"type\":\"uint256\"},{\"name\":\"_destination\",\"type\":\"address\"},{\"name\":\"_price\",\"type\":\"uint256\"}],\"name\":\"buyToken\",\"outputs\":[{\"name\":\"tokenId\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"controller\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"name\":\"_snt\",\"type\":\"address\"},{\"name\":\"_stickerPack\",\"type\":\"address\"},{\"name\":\"_stickerType\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"_token\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"_controller\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"ClaimedTokens\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"state\",\"type\":\"uint8\"}],\"name\":\"MarketState\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"RegisterFee\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"BurnRate\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"packId\",\"type\":\"uint256\"},{\"indexed\":false,\"name\":\"dataPrice\",\"type\":\"uint256\"},{\"indexed\":false,\"name\":\"contenthash\",\"type\":\"bytes\"}],\"name\":\"Register\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"to\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"controller\",\"type\":\"address\"}],\"name\":\"NewController\",\"type\":\"event\"}]" + +// StickerMarketFuncSigs maps the 4-byte function signature to its string representation. +var StickerMarketFuncSigs = map[string]string{ + "f3e62640": "buyToken(uint256,address,uint256)", + "3cebb823": "changeController(address)", + "df8de3e7": "claimTokens(address)", + "f77c4791": "controller()", + "4c06dc17": "generatePack(uint256,uint256,bytes4[],address,bytes)", + "188b5372": "generateToken(address,uint256)", + "b09afec1": "getTokenData(uint256)", + "ce5494bb": "migrate(address)", + "00b3c91b": "purgePack(uint256,uint256)", + "8f4ffcb1": "receiveApproval(address,uint256,address,bytes)", + "1cf75710": "registerPack(uint256,uint256,bytes4[],address,bytes,uint256)", + "189d165e": "setBurnRate(uint256)", + "536b0445": "setMarketState(uint8)", + "92be2ab8": "setRegisterFee(uint256)", + "060eb520": "snt()", + "c19d93fb": "state()", + "4858b015": "stickerPack()", + "0ddd4c87": "stickerType()", +} + +// StickerMarketBin is the compiled bytecode used for deploying new contracts. +var StickerMarketBin = "0x60806040526000805460ff60a01b19167401000000000000000000000000000000000000000017905534801561003457600080fd5b506040516123423803806123428339818101604052606081101561005757600080fd5b5080516020820151604090920151600080546001600160a01b031916331790559091906001600160a01b0383166100ef57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f426164205f736e7420706172616d657465720000000000000000000000000000604482015290519081900360640190fd5b6001600160a01b03821661016457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f426164205f737469636b65725061636b20706172616d65746572000000000000604482015290519081900360640190fd5b6001600160a01b0381166101d957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f426164205f737469636b65725479706520706172616d65746572000000000000604482015290519081900360640190fd5b600380546001600160a01b039485166001600160a01b03199182161790915560048054938516938216939093179092556005805491909316911617905561211d806102256000396000f3fe608060405234801561001057600080fd5b50600436106101155760003560e01c8063536b0445116100a2578063c19d93fb11610071578063c19d93fb1461054d578063ce5494bb14610579578063df8de3e71461059f578063f3e62640146105c5578063f77c4791146105f757610115565b8063536b0445146103a25780638f4ffcb1146103c257806392be2ab81461044f578063b09afec11461046c57610115565b8063189d165e116100e9578063189d165e146101a95780631cf75710146101c65780633cebb8231461029d5780634858b015146102c35780634c06dc17146102cb57610115565b8062b3c91b1461011a578063060eb5201461013f5780630ddd4c8714610163578063188b53721461016b575b600080fd5b61013d6004803603604081101561013057600080fd5b50803590602001356105ff565b005b6101476106bb565b604080516001600160a01b039092168252519081900360200190f35b6101476106ca565b6101976004803603604081101561018157600080fd5b506001600160a01b0381351690602001356106d9565b60408051918252519081900360200190f35b61013d600480360360208110156101bf57600080fd5b50356107b7565b610197600480360360c08110156101dc57600080fd5b813591602081013591810190606081016040820135600160201b81111561020257600080fd5b82018360208201111561021457600080fd5b803590602001918460208302840111600160201b8311171561023557600080fd5b919390926001600160a01b0383351692604081019060200135600160201b81111561025f57600080fd5b82018360208201111561027157600080fd5b803590602001918460018302840111600160201b8311171561029257600080fd5b919350915035610897565b61013d600480360360208110156102b357600080fd5b50356001600160a01b031661091e565b6101476109c0565b610197600480360360a08110156102e157600080fd5b813591602081013591810190606081016040820135600160201b81111561030757600080fd5b82018360208201111561031957600080fd5b803590602001918460208302840111600160201b8311171561033a57600080fd5b919390926001600160a01b0383351692604081019060200135600160201b81111561036457600080fd5b82018360208201111561037657600080fd5b803590602001918460018302840111600160201b8311171561039757600080fd5b5090925090506109cf565b61013d600480360360208110156103b857600080fd5b503560ff16610b1d565b61013d600480360360808110156103d857600080fd5b6001600160a01b038235811692602081013592604082013590921691810190608081016060820135600160201b81111561041157600080fd5b82018360208201111561042357600080fd5b803590602001918460018302840111600160201b8311171561044457600080fd5b509092509050610bd7565b61013d6004803603602081101561046557600080fd5b5035610fc8565b6104896004803603602081101561048257600080fd5b5035611051565b604051808060200184815260200180602001838103835286818151815260200191508051906020019060200280838360005b838110156104d35781810151838201526020016104bb565b50505050905001838103825284818151815260200191508051906020019080838360005b8381101561050f5781810151838201526020016104f7565b50505050905090810190601f16801561053c5780820380516001836020036101000a031916815260200191505b509550505050505060405180910390f35b6105556111fe565b6040518082600481111561056557fe5b60ff16815260200191505060405180910390f35b61013d6004803603602081101561058f57600080fd5b50356001600160a01b031661120e565b61013d600480360360208110156105b557600080fd5b50356001600160a01b031661138a565b610197600480360360608110156105db57600080fd5b508035906001600160a01b0360208201351690604001356113f2565b610147611408565b6000546001600160a01b0316331461064d576040805162461bcd60e51b815260206004820152600c60248201526b155b985d5d1a1bdc9a5e995960a21b604482015290519081900360640190fd5b6005546040805162b3c91b60e01b8152600481018590526024810184905290516001600160a01b039092169162b3c91b9160448082019260009290919082900301818387803b15801561069f57600080fd5b505af11580156106b3573d6000803e3d6000fd5b505050505050565b6003546001600160a01b031681565b6005546001600160a01b031681565b600080546001600160a01b03163314610728576040805162461bcd60e51b815260206004820152600c60248201526b155b985d5d1a1bdc9a5e995960a21b604482015290519081900360640190fd5b6004805460408051630c45a9b960e11b81526001600160a01b0387811694820194909452602481018690529051929091169163188b5372916044808201926020929091908290030181600087803b15801561078257600080fd5b505af1158015610796573d6000803e3d6000fd5b505050506040513d60208110156107ac57600080fd5b505190505b92915050565b6000546001600160a01b03163314610805576040805162461bcd60e51b815260206004820152600c60248201526b155b985d5d1a1bdc9a5e995960a21b604482015290519081900360640190fd5b6002819055612710811115610861576040805162461bcd60e51b815260206004820152601b60248201527f63616e6e6f74206265206d6f7265207468656e203130302e3030250000000000604482015290519081900360640190fd5b6040805182815290517f59701ed6f46ff3f5c94b1b741d5b3f2968eb7a0ae31d2cf2a3a9f2153d18b5149181900360200190a150565b60006109113388888080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525050604080516020601f8b018190048102820181019092528981528b93508f92508e918b908b90819084018382808284376000920191909152508b9250611417915050565b9998505050505050505050565b6000546001600160a01b0316331461096c576040805162461bcd60e51b815260206004820152600c60248201526b155b985d5d1a1bdc9a5e995960a21b604482015290519081900360640190fd5b600080546001600160a01b0383166001600160a01b0319909116811790915560408051918252517fe253457d9ad994ca9682fc3bbc38c890dca73a2d5ecee3809e548bac8b00d7c69181900360200190a150565b6004546001600160a01b031681565b600080546001600160a01b03163314610a1e576040805162461bcd60e51b815260206004820152600c60248201526b155b985d5d1a1bdc9a5e995960a21b604482015290519081900360640190fd5b600554604051634c06dc1760e01b8152600481018a8152602482018a90526001600160a01b03878116606484015260a06044840190815260a484018a9052931692634c06dc17928c928c928c928c928c928c928c929190608481019060c401886020890280828437600083820152601f01601f191690910184810383528581526020019050858580828437600081840152601f19601f8201169050808301925050509950505050505050505050602060405180830381600087803b158015610ae557600080fd5b505af1158015610af9573d6000803e3d6000fd5b505050506040513d6020811015610b0f57600080fd5b505198975050505050505050565b6000546001600160a01b03163314610b6b576040805162461bcd60e51b815260206004820152600c60248201526b155b985d5d1a1bdc9a5e995960a21b604482015290519081900360640190fd5b6000805482919060ff60a01b1916600160a01b836004811115610b8a57fe5b02179055507f9f17f1d96f7bb1d5a573d638f26fdb9fa651427eb2e7b36481cd5e1351581e588160405180826004811115610bc157fe5b60ff16815260200191505060405180910390a150565b6003546001600160a01b03848116911614610c25576040805162461bcd60e51b81526020600482015260096024820152682130b2103a37b5b2b760b91b604482015290519081900360640190fd5b6001600160a01b0383163314610c6d576040805162461bcd60e51b81526020600482015260086024820152671098590818d85b1b60c21b604482015290519081900360640190fd5b6000610cae83838080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506116e192505050565b90506060610cf884848080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525060049250505060031986016116e8565b90506001600160e01b031982166303cf989960e61b1415610de6578051606014610d5b576040805162461bcd60e51b815260206004820152600f60248201526e084c2c840c8c2e8c240d8cadccee8d608b1b604482015290519081900360640190fd5b6000806000838060200190516060811015610d7557600080fd5b50805160208201516040909201519094509092509050888114610dd1576040805162461bcd60e51b815260206004820152600f60248201526e4261642070726963652076616c756560881b604482015290519081900360640190fd5b610ddd8a848484611768565b50505050610fbf565b6001600160e01b031982166301cf757160e41b1415610f875760bc81511015610e48576040805162461bcd60e51b815260206004820152600f60248201526e084c2c840c8c2e8c240d8cadccee8d608b1b604482015290519081900360640190fd5b60008060606000606060008680602001905160c0811015610e6857600080fd5b8151602083015160408401805192949193820192600160201b811115610e8d57600080fd5b82016020810184811115610ea057600080fd5b81518560208202830111600160201b82111715610ebc57600080fd5b50506020820151604090920180519194929391600160201b811115610ee057600080fd5b82016020810184811115610ef357600080fd5b8151600160201b811182820187101715610f0c57600080fd5b5050602090910151969c50949a5092985090965091945091925050508b8114610f6c576040805162461bcd60e51b815260206004820152600d60248201526c426164206665652076616c756560981b604482015290519081900360640190fd5b610f7b8d858589898787611417565b50505050505050610fbf565b6040805162461bcd60e51b81526020600482015260086024820152671098590818d85b1b60c21b604482015290519081900360640190fd5b50505050505050565b6000546001600160a01b03163314611016576040805162461bcd60e51b815260206004820152600c60248201526b155b985d5d1a1bdc9a5e995960a21b604482015290519081900360640190fd5b60018190556040805182815290517f1d4a2348bf98e0fa847f28a7db9967b1327ac954c312b659b65a860bb69591729181900360200190a150565b6005546004805460408051632951abd360e21b81529283018590525160609360009385936001600160a01b03928316936381ec792d939091169163a546af4c916024808301926020929190829003018186803b1580156110b057600080fd5b505afa1580156110c4573d6000803e3d6000fd5b505050506040513d60208110156110da57600080fd5b5051604080516001600160e01b031960e085901b1681526004810192909252516024808301926000929190829003018186803b15801561111957600080fd5b505afa15801561112d573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052606081101561115657600080fd5b810190808051600160201b81111561116d57600080fd5b8201602081018481111561118057600080fd5b81518560208202830111600160201b8211171561119c57600080fd5b50506020820151604090920180519194929391600160201b8111156111c057600080fd5b820160208101848111156111d357600080fd5b8151600160201b8111828201871017156111ec57600080fd5b50959a94995097509295505050505050565b600054600160a01b900460ff1681565b6000546001600160a01b0316331461125c576040805162461bcd60e51b815260206004820152600c60248201526b155b985d5d1a1bdc9a5e995960a21b604482015290519081900360640190fd5b6001600160a01b0381166112b7576040805162461bcd60e51b815260206004820152601760248201527f43616e6e6f7420756e73657420636f6e74726f6c6c6572000000000000000000604482015290519081900360640190fd5b60055460408051633cebb82360e01b81526001600160a01b03848116600483015291519190921691633cebb82391602480830192600092919082900301818387803b15801561130557600080fd5b505af1158015611319573d6000803e3d6000fd5b50506004805460408051633cebb82360e01b81526001600160a01b03878116948201949094529051929091169350633cebb823925060248082019260009290919082900301818387803b15801561136f57600080fd5b505af1158015611383573d6000803e3d6000fd5b5050505050565b6000546001600160a01b031633146113d8576040805162461bcd60e51b815260206004820152600c60248201526b155b985d5d1a1bdc9a5e995960a21b604482015290519081900360640190fd5b6000546113ef9082906001600160a01b0316611e07565b50565b600061140033858585611768565b949350505050565b6000546001600160a01b031681565b60006001600054600160a01b900460ff16600481111561143357fe5b148061146b57506000546001600160a01b03163314801561146b57506003600054600160a01b900460ff16600481111561146957fe5b145b6114ae576040805162461bcd60e51b815260206004820152600f60248201526e13585c9ad95d08111a5cd8589b1959608a1b604482015290519081900360640190fd5b60015482146114f5576040805162461bcd60e51b815260206004820152600e60248201526d556e65787065637465642066656560901b604482015290519081900360640190fd5b600154156115d05760035460008054600154604080516323b872dd60e01b81526001600160a01b038e81166004830152938416602482015260448101929092525191909316926323b872dd9260648083019360209390929083900390910190829087803b15801561156557600080fd5b505af1158015611579573d6000803e3d6000fd5b505050506040513d602081101561158f57600080fd5b50516115d0576040805162461bcd60e51b815260206004820152600b60248201526a109859081c185e5b595b9d60aa1b604482015290519081900360640190fd5b600554604051634c06dc1760e01b815260048101878152602482018790526001600160a01b03898116606484015260a0604484019081528b5160a48501528b519190941693634c06dc17938a938a938e938e938c9392608482019160c401906020808901910280838360005b8381101561165457818101518382015260200161163c565b50505050905001838103825284818151815260200191508051906020019080838360005b83811015611690578181015183820152602001611678565b50505050905090810190601f1680156116bd5780820380516001836020036101000a031916815260200191505b50975050505050505050602060405180830381600087803b158015610ae557600080fd5b6020015190565b6060818301845110156116fa57600080fd5b6060821580156117155760405191506020820160405261175f565b6040519150601f8416801560200281840101858101878315602002848b0101015b8183101561174e578051835260209283019201611736565b5050858452601f01601f1916604052505b50949350505050565b60006001600054600160a01b900460ff16600481111561178457fe5b14806117a757506002600054600160a01b900460ff1660048111156117a557fe5b145b806117de57506000546001600160a01b0316331480156117de57506003600054600160a01b900460ff1660048111156117dc57fe5b145b611821576040805162461bcd60e51b815260206004820152600f60248201526e13585c9ad95d08111a5cd8589b1959608a1b604482015290519081900360640190fd5b60055460408051634e1d1cd160e11b81526004810187905290516000928392839283926001600160a01b031691639c3a39a2916024808301926080929190829003018186803b15801561187357600080fd5b505afa158015611887573d6000803e3d6000fd5b505050506040513d608081101561189d57600080fd5b50805160208201516040830151606090930151919650945090925090506001600160a01b038416611900576040805162461bcd60e51b8152602060048201526008602482015267426164207061636b60c01b604482015290519081900360640190fd5b8261193d576040805162461bcd60e51b8152602060048201526008602482015267111a5cd8589b195960c21b604482015290519081900360640190fd5b81868114611980576040805162461bcd60e51b815260206004820152600b60248201526a57726f6e6720707269636560a81b604482015290519081900360640190fd5b600081116119c4576040805162461bcd60e51b815260206004820152600c60248201526b155b985d5d1a1bdc9a5e995960a21b604482015290519081900360640190fd5b6000811180156119d657506000600254115b15611b54576000611a046127106119f860025485611fa090919063ffffffff16565b9063ffffffff61200016565b9050611a16828263ffffffff61206a16565b6003546040805163f77c479160e01b815290519294506001600160a01b03909116916323b872dd918e91849163f77c4791916004808301926020929190829003018186803b158015611a6757600080fd5b505afa158015611a7b573d6000803e3d6000fd5b505050506040513d6020811015611a9157600080fd5b5051604080516001600160e01b031960e086901b1681526001600160a01b039384166004820152929091166024830152604482018590525160648083019260209291908290030181600087803b158015611aea57600080fd5b505af1158015611afe573d6000803e3d6000fd5b505050506040513d6020811015611b1457600080fd5b5051611b52576040805162461bcd60e51b81526020600482015260086024820152672130b210313ab93760c11b604482015290519081900360640190fd5b505b600081118015611b645750600082115b15611ca4576000611b816127106119f8848663ffffffff611fa016565b9050611b93828263ffffffff61206a16565b9150600360009054906101000a90046001600160a01b03166001600160a01b03166323b872dd8c6000809054906101000a90046001600160a01b0316846040518463ffffffff1660e01b815260040180846001600160a01b03166001600160a01b03168152602001836001600160a01b03166001600160a01b031681526020018281526020019350505050602060405180830381600087803b158015611c3857600080fd5b505af1158015611c4c573d6000803e3d6000fd5b505050506040513d6020811015611c6257600080fd5b5051611ca2576040805162461bcd60e51b815260206004820152600a60248201526942616420646f6e61746560b01b604482015290519081900360640190fd5b505b8015611d7357600354604080516323b872dd60e01b81526001600160a01b038d81166004830152888116602483015260448201859052915191909216916323b872dd9160648083019260209291908290030181600087803b158015611d0857600080fd5b505af1158015611d1c573d6000803e3d6000fd5b505050506040513d6020811015611d3257600080fd5b5051611d73576040805162461bcd60e51b815260206004820152600b60248201526a109859081c185e5b595b9d60aa1b604482015290519081900360640190fd5b6004805460408051630c45a9b960e11b81526001600160a01b038c811694820194909452602481018d90529051929091169163188b5372916044808201926020929091908290030181600087803b158015611dcd57600080fd5b505af1158015611de1573d6000803e3d6000fd5b505050506040513d6020811015611df757600080fd5b50519a9950505050505050505050565b60006001600160a01b038316611e5757506040513031906001600160a01b0383169082156108fc029083906000818181858888f19350505050158015611e51573d6000803e3d6000fd5b50611f50565b604080516370a0823160e01b8152306004820152905184916001600160a01b038316916370a0823191602480820192602092909190829003018186803b158015611ea057600080fd5b505afa158015611eb4573d6000803e3d6000fd5b505050506040513d6020811015611eca57600080fd5b50516040805163a9059cbb60e01b81526001600160a01b0386811660048301526024820184905291519294509083169163a9059cbb916044808201926020929091908290030181600087803b158015611f2257600080fd5b505af1158015611f36573d6000803e3d6000fd5b505050506040513d6020811015611f4c57600080fd5b5050505b816001600160a01b0316836001600160a01b03167ff931edb47c50b4b4104c187b5814a9aef5f709e17e2ecf9617e860cacade929c836040518082815260200191505060405180910390a3505050565b600082611faf575060006107b1565b82820282848281611fbc57fe5b0414611ff95760405162461bcd60e51b81526004018080602001828103825260218152602001806120c86021913960400191505060405180910390fd5b9392505050565b6000808211612056576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b600082848161206157fe5b04949350505050565b6000828211156120c1576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b5090039056fe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77a265627a7a72305820971710d153ac1b01c0aca1105f094801191b0fb63b51f8e87391df62ddabddb964736f6c634300050a0032" + +// DeployStickerMarket deploys a new Ethereum contract, binding an instance of StickerMarket to it. +func DeployStickerMarket(auth *bind.TransactOpts, backend bind.ContractBackend, _snt common.Address, _stickerPack common.Address, _stickerType common.Address) (common.Address, *types.Transaction, *StickerMarket, error) { + parsed, err := abi.JSON(strings.NewReader(StickerMarketABI)) + if err != nil { + return common.Address{}, nil, nil, err + } + + address, tx, contract, err := bind.DeployContract(auth, parsed, common.FromHex(StickerMarketBin), backend, _snt, _stickerPack, _stickerType) + if err != nil { + return common.Address{}, nil, nil, err + } + return address, tx, &StickerMarket{StickerMarketCaller: StickerMarketCaller{contract: contract}, StickerMarketTransactor: StickerMarketTransactor{contract: contract}, StickerMarketFilterer: StickerMarketFilterer{contract: contract}}, nil +} + +// StickerMarket is an auto generated Go binding around an Ethereum contract. +type StickerMarket struct { + StickerMarketCaller // Read-only binding to the contract + StickerMarketTransactor // Write-only binding to the contract + StickerMarketFilterer // Log filterer for contract events +} + +// StickerMarketCaller is an auto generated read-only Go binding around an Ethereum contract. +type StickerMarketCaller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// StickerMarketTransactor is an auto generated write-only Go binding around an Ethereum contract. +type StickerMarketTransactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// StickerMarketFilterer is an auto generated log filtering Go binding around an Ethereum contract events. +type StickerMarketFilterer struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// StickerMarketSession is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type StickerMarketSession struct { + Contract *StickerMarket // 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 +} + +// StickerMarketCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type StickerMarketCallerSession struct { + Contract *StickerMarketCaller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// StickerMarketTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type StickerMarketTransactorSession struct { + Contract *StickerMarketTransactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// StickerMarketRaw is an auto generated low-level Go binding around an Ethereum contract. +type StickerMarketRaw struct { + Contract *StickerMarket // Generic contract binding to access the raw methods on +} + +// StickerMarketCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type StickerMarketCallerRaw struct { + Contract *StickerMarketCaller // Generic read-only contract binding to access the raw methods on +} + +// StickerMarketTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type StickerMarketTransactorRaw struct { + Contract *StickerMarketTransactor // Generic write-only contract binding to access the raw methods on +} + +// NewStickerMarket creates a new instance of StickerMarket, bound to a specific deployed contract. +func NewStickerMarket(address common.Address, backend bind.ContractBackend) (*StickerMarket, error) { + contract, err := bindStickerMarket(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &StickerMarket{StickerMarketCaller: StickerMarketCaller{contract: contract}, StickerMarketTransactor: StickerMarketTransactor{contract: contract}, StickerMarketFilterer: StickerMarketFilterer{contract: contract}}, nil +} + +// NewStickerMarketCaller creates a new read-only instance of StickerMarket, bound to a specific deployed contract. +func NewStickerMarketCaller(address common.Address, caller bind.ContractCaller) (*StickerMarketCaller, error) { + contract, err := bindStickerMarket(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &StickerMarketCaller{contract: contract}, nil +} + +// NewStickerMarketTransactor creates a new write-only instance of StickerMarket, bound to a specific deployed contract. +func NewStickerMarketTransactor(address common.Address, transactor bind.ContractTransactor) (*StickerMarketTransactor, error) { + contract, err := bindStickerMarket(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &StickerMarketTransactor{contract: contract}, nil +} + +// NewStickerMarketFilterer creates a new log filterer instance of StickerMarket, bound to a specific deployed contract. +func NewStickerMarketFilterer(address common.Address, filterer bind.ContractFilterer) (*StickerMarketFilterer, error) { + contract, err := bindStickerMarket(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &StickerMarketFilterer{contract: contract}, nil +} + +// bindStickerMarket binds a generic wrapper to an already deployed contract. +func bindStickerMarket(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := abi.JSON(strings.NewReader(StickerMarketABI)) + 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 (_StickerMarket *StickerMarketRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _StickerMarket.Contract.StickerMarketCaller.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 (_StickerMarket *StickerMarketRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _StickerMarket.Contract.StickerMarketTransactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_StickerMarket *StickerMarketRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _StickerMarket.Contract.StickerMarketTransactor.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 (_StickerMarket *StickerMarketCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _StickerMarket.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 (_StickerMarket *StickerMarketTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _StickerMarket.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_StickerMarket *StickerMarketTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _StickerMarket.Contract.contract.Transact(opts, method, params...) +} + +// Controller is a free data retrieval call binding the contract method 0xf77c4791. +// +// Solidity: function controller() view returns(address) +func (_StickerMarket *StickerMarketCaller) Controller(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _StickerMarket.contract.Call(opts, &out, "controller") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// Controller is a free data retrieval call binding the contract method 0xf77c4791. +// +// Solidity: function controller() view returns(address) +func (_StickerMarket *StickerMarketSession) Controller() (common.Address, error) { + return _StickerMarket.Contract.Controller(&_StickerMarket.CallOpts) +} + +// Controller is a free data retrieval call binding the contract method 0xf77c4791. +// +// Solidity: function controller() view returns(address) +func (_StickerMarket *StickerMarketCallerSession) Controller() (common.Address, error) { + return _StickerMarket.Contract.Controller(&_StickerMarket.CallOpts) +} + +// GetTokenData is a free data retrieval call binding the contract method 0xb09afec1. +// +// Solidity: function getTokenData(uint256 _tokenId) view returns(bytes4[] category, uint256 timestamp, bytes contenthash) +func (_StickerMarket *StickerMarketCaller) GetTokenData(opts *bind.CallOpts, _tokenId *big.Int) (struct { + Category [][4]byte + Timestamp *big.Int + Contenthash []byte +}, error) { + var out []interface{} + err := _StickerMarket.contract.Call(opts, &out, "getTokenData", _tokenId) + + outstruct := new(struct { + Category [][4]byte + Timestamp *big.Int + Contenthash []byte + }) + if err != nil { + return *outstruct, err + } + + outstruct.Category = *abi.ConvertType(out[0], new([][4]byte)).(*[][4]byte) + outstruct.Timestamp = *abi.ConvertType(out[1], new(*big.Int)).(**big.Int) + outstruct.Contenthash = *abi.ConvertType(out[2], new([]byte)).(*[]byte) + + return *outstruct, err + +} + +// GetTokenData is a free data retrieval call binding the contract method 0xb09afec1. +// +// Solidity: function getTokenData(uint256 _tokenId) view returns(bytes4[] category, uint256 timestamp, bytes contenthash) +func (_StickerMarket *StickerMarketSession) GetTokenData(_tokenId *big.Int) (struct { + Category [][4]byte + Timestamp *big.Int + Contenthash []byte +}, error) { + return _StickerMarket.Contract.GetTokenData(&_StickerMarket.CallOpts, _tokenId) +} + +// GetTokenData is a free data retrieval call binding the contract method 0xb09afec1. +// +// Solidity: function getTokenData(uint256 _tokenId) view returns(bytes4[] category, uint256 timestamp, bytes contenthash) +func (_StickerMarket *StickerMarketCallerSession) GetTokenData(_tokenId *big.Int) (struct { + Category [][4]byte + Timestamp *big.Int + Contenthash []byte +}, error) { + return _StickerMarket.Contract.GetTokenData(&_StickerMarket.CallOpts, _tokenId) +} + +// Snt is a free data retrieval call binding the contract method 0x060eb520. +// +// Solidity: function snt() view returns(address) +func (_StickerMarket *StickerMarketCaller) Snt(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _StickerMarket.contract.Call(opts, &out, "snt") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// Snt is a free data retrieval call binding the contract method 0x060eb520. +// +// Solidity: function snt() view returns(address) +func (_StickerMarket *StickerMarketSession) Snt() (common.Address, error) { + return _StickerMarket.Contract.Snt(&_StickerMarket.CallOpts) +} + +// Snt is a free data retrieval call binding the contract method 0x060eb520. +// +// Solidity: function snt() view returns(address) +func (_StickerMarket *StickerMarketCallerSession) Snt() (common.Address, error) { + return _StickerMarket.Contract.Snt(&_StickerMarket.CallOpts) +} + +// State is a free data retrieval call binding the contract method 0xc19d93fb. +// +// Solidity: function state() view returns(uint8) +func (_StickerMarket *StickerMarketCaller) State(opts *bind.CallOpts) (uint8, error) { + var out []interface{} + err := _StickerMarket.contract.Call(opts, &out, "state") + + if err != nil { + return *new(uint8), err + } + + out0 := *abi.ConvertType(out[0], new(uint8)).(*uint8) + + return out0, err + +} + +// State is a free data retrieval call binding the contract method 0xc19d93fb. +// +// Solidity: function state() view returns(uint8) +func (_StickerMarket *StickerMarketSession) State() (uint8, error) { + return _StickerMarket.Contract.State(&_StickerMarket.CallOpts) +} + +// State is a free data retrieval call binding the contract method 0xc19d93fb. +// +// Solidity: function state() view returns(uint8) +func (_StickerMarket *StickerMarketCallerSession) State() (uint8, error) { + return _StickerMarket.Contract.State(&_StickerMarket.CallOpts) +} + +// StickerPack is a free data retrieval call binding the contract method 0x4858b015. +// +// Solidity: function stickerPack() view returns(address) +func (_StickerMarket *StickerMarketCaller) StickerPack(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _StickerMarket.contract.Call(opts, &out, "stickerPack") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// StickerPack is a free data retrieval call binding the contract method 0x4858b015. +// +// Solidity: function stickerPack() view returns(address) +func (_StickerMarket *StickerMarketSession) StickerPack() (common.Address, error) { + return _StickerMarket.Contract.StickerPack(&_StickerMarket.CallOpts) +} + +// StickerPack is a free data retrieval call binding the contract method 0x4858b015. +// +// Solidity: function stickerPack() view returns(address) +func (_StickerMarket *StickerMarketCallerSession) StickerPack() (common.Address, error) { + return _StickerMarket.Contract.StickerPack(&_StickerMarket.CallOpts) +} + +// StickerType is a free data retrieval call binding the contract method 0x0ddd4c87. +// +// Solidity: function stickerType() view returns(address) +func (_StickerMarket *StickerMarketCaller) StickerType(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _StickerMarket.contract.Call(opts, &out, "stickerType") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// StickerType is a free data retrieval call binding the contract method 0x0ddd4c87. +// +// Solidity: function stickerType() view returns(address) +func (_StickerMarket *StickerMarketSession) StickerType() (common.Address, error) { + return _StickerMarket.Contract.StickerType(&_StickerMarket.CallOpts) +} + +// StickerType is a free data retrieval call binding the contract method 0x0ddd4c87. +// +// Solidity: function stickerType() view returns(address) +func (_StickerMarket *StickerMarketCallerSession) StickerType() (common.Address, error) { + return _StickerMarket.Contract.StickerType(&_StickerMarket.CallOpts) +} + +// BuyToken is a paid mutator transaction binding the contract method 0xf3e62640. +// +// Solidity: function buyToken(uint256 _packId, address _destination, uint256 _price) returns(uint256 tokenId) +func (_StickerMarket *StickerMarketTransactor) BuyToken(opts *bind.TransactOpts, _packId *big.Int, _destination common.Address, _price *big.Int) (*types.Transaction, error) { + return _StickerMarket.contract.Transact(opts, "buyToken", _packId, _destination, _price) +} + +// BuyToken is a paid mutator transaction binding the contract method 0xf3e62640. +// +// Solidity: function buyToken(uint256 _packId, address _destination, uint256 _price) returns(uint256 tokenId) +func (_StickerMarket *StickerMarketSession) BuyToken(_packId *big.Int, _destination common.Address, _price *big.Int) (*types.Transaction, error) { + return _StickerMarket.Contract.BuyToken(&_StickerMarket.TransactOpts, _packId, _destination, _price) +} + +// BuyToken is a paid mutator transaction binding the contract method 0xf3e62640. +// +// Solidity: function buyToken(uint256 _packId, address _destination, uint256 _price) returns(uint256 tokenId) +func (_StickerMarket *StickerMarketTransactorSession) BuyToken(_packId *big.Int, _destination common.Address, _price *big.Int) (*types.Transaction, error) { + return _StickerMarket.Contract.BuyToken(&_StickerMarket.TransactOpts, _packId, _destination, _price) +} + +// ChangeController is a paid mutator transaction binding the contract method 0x3cebb823. +// +// Solidity: function changeController(address _newController) returns() +func (_StickerMarket *StickerMarketTransactor) ChangeController(opts *bind.TransactOpts, _newController common.Address) (*types.Transaction, error) { + return _StickerMarket.contract.Transact(opts, "changeController", _newController) +} + +// ChangeController is a paid mutator transaction binding the contract method 0x3cebb823. +// +// Solidity: function changeController(address _newController) returns() +func (_StickerMarket *StickerMarketSession) ChangeController(_newController common.Address) (*types.Transaction, error) { + return _StickerMarket.Contract.ChangeController(&_StickerMarket.TransactOpts, _newController) +} + +// ChangeController is a paid mutator transaction binding the contract method 0x3cebb823. +// +// Solidity: function changeController(address _newController) returns() +func (_StickerMarket *StickerMarketTransactorSession) ChangeController(_newController common.Address) (*types.Transaction, error) { + return _StickerMarket.Contract.ChangeController(&_StickerMarket.TransactOpts, _newController) +} + +// ClaimTokens is a paid mutator transaction binding the contract method 0xdf8de3e7. +// +// Solidity: function claimTokens(address _token) returns() +func (_StickerMarket *StickerMarketTransactor) ClaimTokens(opts *bind.TransactOpts, _token common.Address) (*types.Transaction, error) { + return _StickerMarket.contract.Transact(opts, "claimTokens", _token) +} + +// ClaimTokens is a paid mutator transaction binding the contract method 0xdf8de3e7. +// +// Solidity: function claimTokens(address _token) returns() +func (_StickerMarket *StickerMarketSession) ClaimTokens(_token common.Address) (*types.Transaction, error) { + return _StickerMarket.Contract.ClaimTokens(&_StickerMarket.TransactOpts, _token) +} + +// ClaimTokens is a paid mutator transaction binding the contract method 0xdf8de3e7. +// +// Solidity: function claimTokens(address _token) returns() +func (_StickerMarket *StickerMarketTransactorSession) ClaimTokens(_token common.Address) (*types.Transaction, error) { + return _StickerMarket.Contract.ClaimTokens(&_StickerMarket.TransactOpts, _token) +} + +// GeneratePack is a paid mutator transaction binding the contract method 0x4c06dc17. +// +// Solidity: function generatePack(uint256 _price, uint256 _donate, bytes4[] _category, address _owner, bytes _contenthash) returns(uint256 packId) +func (_StickerMarket *StickerMarketTransactor) GeneratePack(opts *bind.TransactOpts, _price *big.Int, _donate *big.Int, _category [][4]byte, _owner common.Address, _contenthash []byte) (*types.Transaction, error) { + return _StickerMarket.contract.Transact(opts, "generatePack", _price, _donate, _category, _owner, _contenthash) +} + +// GeneratePack is a paid mutator transaction binding the contract method 0x4c06dc17. +// +// Solidity: function generatePack(uint256 _price, uint256 _donate, bytes4[] _category, address _owner, bytes _contenthash) returns(uint256 packId) +func (_StickerMarket *StickerMarketSession) GeneratePack(_price *big.Int, _donate *big.Int, _category [][4]byte, _owner common.Address, _contenthash []byte) (*types.Transaction, error) { + return _StickerMarket.Contract.GeneratePack(&_StickerMarket.TransactOpts, _price, _donate, _category, _owner, _contenthash) +} + +// GeneratePack is a paid mutator transaction binding the contract method 0x4c06dc17. +// +// Solidity: function generatePack(uint256 _price, uint256 _donate, bytes4[] _category, address _owner, bytes _contenthash) returns(uint256 packId) +func (_StickerMarket *StickerMarketTransactorSession) GeneratePack(_price *big.Int, _donate *big.Int, _category [][4]byte, _owner common.Address, _contenthash []byte) (*types.Transaction, error) { + return _StickerMarket.Contract.GeneratePack(&_StickerMarket.TransactOpts, _price, _donate, _category, _owner, _contenthash) +} + +// GenerateToken is a paid mutator transaction binding the contract method 0x188b5372. +// +// Solidity: function generateToken(address _owner, uint256 _packId) returns(uint256 tokenId) +func (_StickerMarket *StickerMarketTransactor) GenerateToken(opts *bind.TransactOpts, _owner common.Address, _packId *big.Int) (*types.Transaction, error) { + return _StickerMarket.contract.Transact(opts, "generateToken", _owner, _packId) +} + +// GenerateToken is a paid mutator transaction binding the contract method 0x188b5372. +// +// Solidity: function generateToken(address _owner, uint256 _packId) returns(uint256 tokenId) +func (_StickerMarket *StickerMarketSession) GenerateToken(_owner common.Address, _packId *big.Int) (*types.Transaction, error) { + return _StickerMarket.Contract.GenerateToken(&_StickerMarket.TransactOpts, _owner, _packId) +} + +// GenerateToken is a paid mutator transaction binding the contract method 0x188b5372. +// +// Solidity: function generateToken(address _owner, uint256 _packId) returns(uint256 tokenId) +func (_StickerMarket *StickerMarketTransactorSession) GenerateToken(_owner common.Address, _packId *big.Int) (*types.Transaction, error) { + return _StickerMarket.Contract.GenerateToken(&_StickerMarket.TransactOpts, _owner, _packId) +} + +// Migrate is a paid mutator transaction binding the contract method 0xce5494bb. +// +// Solidity: function migrate(address _newController) returns() +func (_StickerMarket *StickerMarketTransactor) Migrate(opts *bind.TransactOpts, _newController common.Address) (*types.Transaction, error) { + return _StickerMarket.contract.Transact(opts, "migrate", _newController) +} + +// Migrate is a paid mutator transaction binding the contract method 0xce5494bb. +// +// Solidity: function migrate(address _newController) returns() +func (_StickerMarket *StickerMarketSession) Migrate(_newController common.Address) (*types.Transaction, error) { + return _StickerMarket.Contract.Migrate(&_StickerMarket.TransactOpts, _newController) +} + +// Migrate is a paid mutator transaction binding the contract method 0xce5494bb. +// +// Solidity: function migrate(address _newController) returns() +func (_StickerMarket *StickerMarketTransactorSession) Migrate(_newController common.Address) (*types.Transaction, error) { + return _StickerMarket.Contract.Migrate(&_StickerMarket.TransactOpts, _newController) +} + +// PurgePack is a paid mutator transaction binding the contract method 0x00b3c91b. +// +// Solidity: function purgePack(uint256 _packId, uint256 _limit) returns() +func (_StickerMarket *StickerMarketTransactor) PurgePack(opts *bind.TransactOpts, _packId *big.Int, _limit *big.Int) (*types.Transaction, error) { + return _StickerMarket.contract.Transact(opts, "purgePack", _packId, _limit) +} + +// PurgePack is a paid mutator transaction binding the contract method 0x00b3c91b. +// +// Solidity: function purgePack(uint256 _packId, uint256 _limit) returns() +func (_StickerMarket *StickerMarketSession) PurgePack(_packId *big.Int, _limit *big.Int) (*types.Transaction, error) { + return _StickerMarket.Contract.PurgePack(&_StickerMarket.TransactOpts, _packId, _limit) +} + +// PurgePack is a paid mutator transaction binding the contract method 0x00b3c91b. +// +// Solidity: function purgePack(uint256 _packId, uint256 _limit) returns() +func (_StickerMarket *StickerMarketTransactorSession) PurgePack(_packId *big.Int, _limit *big.Int) (*types.Transaction, error) { + return _StickerMarket.Contract.PurgePack(&_StickerMarket.TransactOpts, _packId, _limit) +} + +// ReceiveApproval is a paid mutator transaction binding the contract method 0x8f4ffcb1. +// +// Solidity: function receiveApproval(address _from, uint256 _value, address _token, bytes _data) returns() +func (_StickerMarket *StickerMarketTransactor) ReceiveApproval(opts *bind.TransactOpts, _from common.Address, _value *big.Int, _token common.Address, _data []byte) (*types.Transaction, error) { + return _StickerMarket.contract.Transact(opts, "receiveApproval", _from, _value, _token, _data) +} + +// ReceiveApproval is a paid mutator transaction binding the contract method 0x8f4ffcb1. +// +// Solidity: function receiveApproval(address _from, uint256 _value, address _token, bytes _data) returns() +func (_StickerMarket *StickerMarketSession) ReceiveApproval(_from common.Address, _value *big.Int, _token common.Address, _data []byte) (*types.Transaction, error) { + return _StickerMarket.Contract.ReceiveApproval(&_StickerMarket.TransactOpts, _from, _value, _token, _data) +} + +// ReceiveApproval is a paid mutator transaction binding the contract method 0x8f4ffcb1. +// +// Solidity: function receiveApproval(address _from, uint256 _value, address _token, bytes _data) returns() +func (_StickerMarket *StickerMarketTransactorSession) ReceiveApproval(_from common.Address, _value *big.Int, _token common.Address, _data []byte) (*types.Transaction, error) { + return _StickerMarket.Contract.ReceiveApproval(&_StickerMarket.TransactOpts, _from, _value, _token, _data) +} + +// RegisterPack is a paid mutator transaction binding the contract method 0x1cf75710. +// +// Solidity: function registerPack(uint256 _price, uint256 _donate, bytes4[] _category, address _owner, bytes _contenthash, uint256 _fee) returns(uint256 packId) +func (_StickerMarket *StickerMarketTransactor) RegisterPack(opts *bind.TransactOpts, _price *big.Int, _donate *big.Int, _category [][4]byte, _owner common.Address, _contenthash []byte, _fee *big.Int) (*types.Transaction, error) { + return _StickerMarket.contract.Transact(opts, "registerPack", _price, _donate, _category, _owner, _contenthash, _fee) +} + +// RegisterPack is a paid mutator transaction binding the contract method 0x1cf75710. +// +// Solidity: function registerPack(uint256 _price, uint256 _donate, bytes4[] _category, address _owner, bytes _contenthash, uint256 _fee) returns(uint256 packId) +func (_StickerMarket *StickerMarketSession) RegisterPack(_price *big.Int, _donate *big.Int, _category [][4]byte, _owner common.Address, _contenthash []byte, _fee *big.Int) (*types.Transaction, error) { + return _StickerMarket.Contract.RegisterPack(&_StickerMarket.TransactOpts, _price, _donate, _category, _owner, _contenthash, _fee) +} + +// RegisterPack is a paid mutator transaction binding the contract method 0x1cf75710. +// +// Solidity: function registerPack(uint256 _price, uint256 _donate, bytes4[] _category, address _owner, bytes _contenthash, uint256 _fee) returns(uint256 packId) +func (_StickerMarket *StickerMarketTransactorSession) RegisterPack(_price *big.Int, _donate *big.Int, _category [][4]byte, _owner common.Address, _contenthash []byte, _fee *big.Int) (*types.Transaction, error) { + return _StickerMarket.Contract.RegisterPack(&_StickerMarket.TransactOpts, _price, _donate, _category, _owner, _contenthash, _fee) +} + +// SetBurnRate is a paid mutator transaction binding the contract method 0x189d165e. +// +// Solidity: function setBurnRate(uint256 _value) returns() +func (_StickerMarket *StickerMarketTransactor) SetBurnRate(opts *bind.TransactOpts, _value *big.Int) (*types.Transaction, error) { + return _StickerMarket.contract.Transact(opts, "setBurnRate", _value) +} + +// SetBurnRate is a paid mutator transaction binding the contract method 0x189d165e. +// +// Solidity: function setBurnRate(uint256 _value) returns() +func (_StickerMarket *StickerMarketSession) SetBurnRate(_value *big.Int) (*types.Transaction, error) { + return _StickerMarket.Contract.SetBurnRate(&_StickerMarket.TransactOpts, _value) +} + +// SetBurnRate is a paid mutator transaction binding the contract method 0x189d165e. +// +// Solidity: function setBurnRate(uint256 _value) returns() +func (_StickerMarket *StickerMarketTransactorSession) SetBurnRate(_value *big.Int) (*types.Transaction, error) { + return _StickerMarket.Contract.SetBurnRate(&_StickerMarket.TransactOpts, _value) +} + +// SetMarketState is a paid mutator transaction binding the contract method 0x536b0445. +// +// Solidity: function setMarketState(uint8 _state) returns() +func (_StickerMarket *StickerMarketTransactor) SetMarketState(opts *bind.TransactOpts, _state uint8) (*types.Transaction, error) { + return _StickerMarket.contract.Transact(opts, "setMarketState", _state) +} + +// SetMarketState is a paid mutator transaction binding the contract method 0x536b0445. +// +// Solidity: function setMarketState(uint8 _state) returns() +func (_StickerMarket *StickerMarketSession) SetMarketState(_state uint8) (*types.Transaction, error) { + return _StickerMarket.Contract.SetMarketState(&_StickerMarket.TransactOpts, _state) +} + +// SetMarketState is a paid mutator transaction binding the contract method 0x536b0445. +// +// Solidity: function setMarketState(uint8 _state) returns() +func (_StickerMarket *StickerMarketTransactorSession) SetMarketState(_state uint8) (*types.Transaction, error) { + return _StickerMarket.Contract.SetMarketState(&_StickerMarket.TransactOpts, _state) +} + +// SetRegisterFee is a paid mutator transaction binding the contract method 0x92be2ab8. +// +// Solidity: function setRegisterFee(uint256 _value) returns() +func (_StickerMarket *StickerMarketTransactor) SetRegisterFee(opts *bind.TransactOpts, _value *big.Int) (*types.Transaction, error) { + return _StickerMarket.contract.Transact(opts, "setRegisterFee", _value) +} + +// SetRegisterFee is a paid mutator transaction binding the contract method 0x92be2ab8. +// +// Solidity: function setRegisterFee(uint256 _value) returns() +func (_StickerMarket *StickerMarketSession) SetRegisterFee(_value *big.Int) (*types.Transaction, error) { + return _StickerMarket.Contract.SetRegisterFee(&_StickerMarket.TransactOpts, _value) +} + +// SetRegisterFee is a paid mutator transaction binding the contract method 0x92be2ab8. +// +// Solidity: function setRegisterFee(uint256 _value) returns() +func (_StickerMarket *StickerMarketTransactorSession) SetRegisterFee(_value *big.Int) (*types.Transaction, error) { + return _StickerMarket.Contract.SetRegisterFee(&_StickerMarket.TransactOpts, _value) +} + +// StickerMarketBurnRateIterator is returned from FilterBurnRate and is used to iterate over the raw logs and unpacked data for BurnRate events raised by the StickerMarket contract. +type StickerMarketBurnRateIterator struct { + Event *StickerMarketBurnRate // 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 *StickerMarketBurnRateIterator) 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(StickerMarketBurnRate) + 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(StickerMarketBurnRate) + 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 *StickerMarketBurnRateIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *StickerMarketBurnRateIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// StickerMarketBurnRate represents a BurnRate event raised by the StickerMarket contract. +type StickerMarketBurnRate struct { + Value *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterBurnRate is a free log retrieval operation binding the contract event 0x59701ed6f46ff3f5c94b1b741d5b3f2968eb7a0ae31d2cf2a3a9f2153d18b514. +// +// Solidity: event BurnRate(uint256 value) +func (_StickerMarket *StickerMarketFilterer) FilterBurnRate(opts *bind.FilterOpts) (*StickerMarketBurnRateIterator, error) { + + logs, sub, err := _StickerMarket.contract.FilterLogs(opts, "BurnRate") + if err != nil { + return nil, err + } + return &StickerMarketBurnRateIterator{contract: _StickerMarket.contract, event: "BurnRate", logs: logs, sub: sub}, nil +} + +// WatchBurnRate is a free log subscription operation binding the contract event 0x59701ed6f46ff3f5c94b1b741d5b3f2968eb7a0ae31d2cf2a3a9f2153d18b514. +// +// Solidity: event BurnRate(uint256 value) +func (_StickerMarket *StickerMarketFilterer) WatchBurnRate(opts *bind.WatchOpts, sink chan<- *StickerMarketBurnRate) (event.Subscription, error) { + + logs, sub, err := _StickerMarket.contract.WatchLogs(opts, "BurnRate") + 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(StickerMarketBurnRate) + if err := _StickerMarket.contract.UnpackLog(event, "BurnRate", 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 +} + +// ParseBurnRate is a log parse operation binding the contract event 0x59701ed6f46ff3f5c94b1b741d5b3f2968eb7a0ae31d2cf2a3a9f2153d18b514. +// +// Solidity: event BurnRate(uint256 value) +func (_StickerMarket *StickerMarketFilterer) ParseBurnRate(log types.Log) (*StickerMarketBurnRate, error) { + event := new(StickerMarketBurnRate) + if err := _StickerMarket.contract.UnpackLog(event, "BurnRate", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// StickerMarketClaimedTokensIterator is returned from FilterClaimedTokens and is used to iterate over the raw logs and unpacked data for ClaimedTokens events raised by the StickerMarket contract. +type StickerMarketClaimedTokensIterator struct { + Event *StickerMarketClaimedTokens // 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 *StickerMarketClaimedTokensIterator) 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(StickerMarketClaimedTokens) + 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(StickerMarketClaimedTokens) + 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 *StickerMarketClaimedTokensIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *StickerMarketClaimedTokensIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// StickerMarketClaimedTokens represents a ClaimedTokens event raised by the StickerMarket contract. +type StickerMarketClaimedTokens struct { + Token common.Address + Controller common.Address + Amount *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterClaimedTokens is a free log retrieval operation binding the contract event 0xf931edb47c50b4b4104c187b5814a9aef5f709e17e2ecf9617e860cacade929c. +// +// Solidity: event ClaimedTokens(address indexed _token, address indexed _controller, uint256 _amount) +func (_StickerMarket *StickerMarketFilterer) FilterClaimedTokens(opts *bind.FilterOpts, _token []common.Address, _controller []common.Address) (*StickerMarketClaimedTokensIterator, error) { + + var _tokenRule []interface{} + for _, _tokenItem := range _token { + _tokenRule = append(_tokenRule, _tokenItem) + } + var _controllerRule []interface{} + for _, _controllerItem := range _controller { + _controllerRule = append(_controllerRule, _controllerItem) + } + + logs, sub, err := _StickerMarket.contract.FilterLogs(opts, "ClaimedTokens", _tokenRule, _controllerRule) + if err != nil { + return nil, err + } + return &StickerMarketClaimedTokensIterator{contract: _StickerMarket.contract, event: "ClaimedTokens", logs: logs, sub: sub}, nil +} + +// WatchClaimedTokens is a free log subscription operation binding the contract event 0xf931edb47c50b4b4104c187b5814a9aef5f709e17e2ecf9617e860cacade929c. +// +// Solidity: event ClaimedTokens(address indexed _token, address indexed _controller, uint256 _amount) +func (_StickerMarket *StickerMarketFilterer) WatchClaimedTokens(opts *bind.WatchOpts, sink chan<- *StickerMarketClaimedTokens, _token []common.Address, _controller []common.Address) (event.Subscription, error) { + + var _tokenRule []interface{} + for _, _tokenItem := range _token { + _tokenRule = append(_tokenRule, _tokenItem) + } + var _controllerRule []interface{} + for _, _controllerItem := range _controller { + _controllerRule = append(_controllerRule, _controllerItem) + } + + logs, sub, err := _StickerMarket.contract.WatchLogs(opts, "ClaimedTokens", _tokenRule, _controllerRule) + 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(StickerMarketClaimedTokens) + if err := _StickerMarket.contract.UnpackLog(event, "ClaimedTokens", 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 +} + +// ParseClaimedTokens is a log parse operation binding the contract event 0xf931edb47c50b4b4104c187b5814a9aef5f709e17e2ecf9617e860cacade929c. +// +// Solidity: event ClaimedTokens(address indexed _token, address indexed _controller, uint256 _amount) +func (_StickerMarket *StickerMarketFilterer) ParseClaimedTokens(log types.Log) (*StickerMarketClaimedTokens, error) { + event := new(StickerMarketClaimedTokens) + if err := _StickerMarket.contract.UnpackLog(event, "ClaimedTokens", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// StickerMarketMarketStateIterator is returned from FilterMarketState and is used to iterate over the raw logs and unpacked data for MarketState events raised by the StickerMarket contract. +type StickerMarketMarketStateIterator struct { + Event *StickerMarketMarketState // 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 *StickerMarketMarketStateIterator) 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(StickerMarketMarketState) + 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(StickerMarketMarketState) + 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 *StickerMarketMarketStateIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *StickerMarketMarketStateIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// StickerMarketMarketState represents a MarketState event raised by the StickerMarket contract. +type StickerMarketMarketState struct { + State uint8 + Raw types.Log // Blockchain specific contextual infos +} + +// FilterMarketState is a free log retrieval operation binding the contract event 0x9f17f1d96f7bb1d5a573d638f26fdb9fa651427eb2e7b36481cd5e1351581e58. +// +// Solidity: event MarketState(uint8 state) +func (_StickerMarket *StickerMarketFilterer) FilterMarketState(opts *bind.FilterOpts) (*StickerMarketMarketStateIterator, error) { + + logs, sub, err := _StickerMarket.contract.FilterLogs(opts, "MarketState") + if err != nil { + return nil, err + } + return &StickerMarketMarketStateIterator{contract: _StickerMarket.contract, event: "MarketState", logs: logs, sub: sub}, nil +} + +// WatchMarketState is a free log subscription operation binding the contract event 0x9f17f1d96f7bb1d5a573d638f26fdb9fa651427eb2e7b36481cd5e1351581e58. +// +// Solidity: event MarketState(uint8 state) +func (_StickerMarket *StickerMarketFilterer) WatchMarketState(opts *bind.WatchOpts, sink chan<- *StickerMarketMarketState) (event.Subscription, error) { + + logs, sub, err := _StickerMarket.contract.WatchLogs(opts, "MarketState") + 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(StickerMarketMarketState) + if err := _StickerMarket.contract.UnpackLog(event, "MarketState", 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 +} + +// ParseMarketState is a log parse operation binding the contract event 0x9f17f1d96f7bb1d5a573d638f26fdb9fa651427eb2e7b36481cd5e1351581e58. +// +// Solidity: event MarketState(uint8 state) +func (_StickerMarket *StickerMarketFilterer) ParseMarketState(log types.Log) (*StickerMarketMarketState, error) { + event := new(StickerMarketMarketState) + if err := _StickerMarket.contract.UnpackLog(event, "MarketState", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// StickerMarketNewControllerIterator is returned from FilterNewController and is used to iterate over the raw logs and unpacked data for NewController events raised by the StickerMarket contract. +type StickerMarketNewControllerIterator struct { + Event *StickerMarketNewController // 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 *StickerMarketNewControllerIterator) 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(StickerMarketNewController) + 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(StickerMarketNewController) + 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 *StickerMarketNewControllerIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *StickerMarketNewControllerIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// StickerMarketNewController represents a NewController event raised by the StickerMarket contract. +type StickerMarketNewController struct { + Controller common.Address + Raw types.Log // Blockchain specific contextual infos +} + +// FilterNewController is a free log retrieval operation binding the contract event 0xe253457d9ad994ca9682fc3bbc38c890dca73a2d5ecee3809e548bac8b00d7c6. +// +// Solidity: event NewController(address controller) +func (_StickerMarket *StickerMarketFilterer) FilterNewController(opts *bind.FilterOpts) (*StickerMarketNewControllerIterator, error) { + + logs, sub, err := _StickerMarket.contract.FilterLogs(opts, "NewController") + if err != nil { + return nil, err + } + return &StickerMarketNewControllerIterator{contract: _StickerMarket.contract, event: "NewController", logs: logs, sub: sub}, nil +} + +// WatchNewController is a free log subscription operation binding the contract event 0xe253457d9ad994ca9682fc3bbc38c890dca73a2d5ecee3809e548bac8b00d7c6. +// +// Solidity: event NewController(address controller) +func (_StickerMarket *StickerMarketFilterer) WatchNewController(opts *bind.WatchOpts, sink chan<- *StickerMarketNewController) (event.Subscription, error) { + + logs, sub, err := _StickerMarket.contract.WatchLogs(opts, "NewController") + 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(StickerMarketNewController) + if err := _StickerMarket.contract.UnpackLog(event, "NewController", 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 +} + +// ParseNewController is a log parse operation binding the contract event 0xe253457d9ad994ca9682fc3bbc38c890dca73a2d5ecee3809e548bac8b00d7c6. +// +// Solidity: event NewController(address controller) +func (_StickerMarket *StickerMarketFilterer) ParseNewController(log types.Log) (*StickerMarketNewController, error) { + event := new(StickerMarketNewController) + if err := _StickerMarket.contract.UnpackLog(event, "NewController", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// StickerMarketRegisterIterator is returned from FilterRegister and is used to iterate over the raw logs and unpacked data for Register events raised by the StickerMarket contract. +type StickerMarketRegisterIterator struct { + Event *StickerMarketRegister // 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 *StickerMarketRegisterIterator) 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(StickerMarketRegister) + 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(StickerMarketRegister) + 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 *StickerMarketRegisterIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *StickerMarketRegisterIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// StickerMarketRegister represents a Register event raised by the StickerMarket contract. +type StickerMarketRegister struct { + PackId *big.Int + DataPrice *big.Int + Contenthash []byte + Raw types.Log // Blockchain specific contextual infos +} + +// FilterRegister is a free log retrieval operation binding the contract event 0x977f348a33aa09ea5592a5999ead89ce5390634d548c226c6a32c8f18b93e082. +// +// Solidity: event Register(uint256 indexed packId, uint256 dataPrice, bytes contenthash) +func (_StickerMarket *StickerMarketFilterer) FilterRegister(opts *bind.FilterOpts, packId []*big.Int) (*StickerMarketRegisterIterator, error) { + + var packIdRule []interface{} + for _, packIdItem := range packId { + packIdRule = append(packIdRule, packIdItem) + } + + logs, sub, err := _StickerMarket.contract.FilterLogs(opts, "Register", packIdRule) + if err != nil { + return nil, err + } + return &StickerMarketRegisterIterator{contract: _StickerMarket.contract, event: "Register", logs: logs, sub: sub}, nil +} + +// WatchRegister is a free log subscription operation binding the contract event 0x977f348a33aa09ea5592a5999ead89ce5390634d548c226c6a32c8f18b93e082. +// +// Solidity: event Register(uint256 indexed packId, uint256 dataPrice, bytes contenthash) +func (_StickerMarket *StickerMarketFilterer) WatchRegister(opts *bind.WatchOpts, sink chan<- *StickerMarketRegister, packId []*big.Int) (event.Subscription, error) { + + var packIdRule []interface{} + for _, packIdItem := range packId { + packIdRule = append(packIdRule, packIdItem) + } + + logs, sub, err := _StickerMarket.contract.WatchLogs(opts, "Register", packIdRule) + 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(StickerMarketRegister) + if err := _StickerMarket.contract.UnpackLog(event, "Register", 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 +} + +// ParseRegister is a log parse operation binding the contract event 0x977f348a33aa09ea5592a5999ead89ce5390634d548c226c6a32c8f18b93e082. +// +// Solidity: event Register(uint256 indexed packId, uint256 dataPrice, bytes contenthash) +func (_StickerMarket *StickerMarketFilterer) ParseRegister(log types.Log) (*StickerMarketRegister, error) { + event := new(StickerMarketRegister) + if err := _StickerMarket.contract.UnpackLog(event, "Register", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// StickerMarketRegisterFeeIterator is returned from FilterRegisterFee and is used to iterate over the raw logs and unpacked data for RegisterFee events raised by the StickerMarket contract. +type StickerMarketRegisterFeeIterator struct { + Event *StickerMarketRegisterFee // 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 *StickerMarketRegisterFeeIterator) 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(StickerMarketRegisterFee) + 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(StickerMarketRegisterFee) + 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 *StickerMarketRegisterFeeIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *StickerMarketRegisterFeeIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// StickerMarketRegisterFee represents a RegisterFee event raised by the StickerMarket contract. +type StickerMarketRegisterFee struct { + Value *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterRegisterFee is a free log retrieval operation binding the contract event 0x1d4a2348bf98e0fa847f28a7db9967b1327ac954c312b659b65a860bb6959172. +// +// Solidity: event RegisterFee(uint256 value) +func (_StickerMarket *StickerMarketFilterer) FilterRegisterFee(opts *bind.FilterOpts) (*StickerMarketRegisterFeeIterator, error) { + + logs, sub, err := _StickerMarket.contract.FilterLogs(opts, "RegisterFee") + if err != nil { + return nil, err + } + return &StickerMarketRegisterFeeIterator{contract: _StickerMarket.contract, event: "RegisterFee", logs: logs, sub: sub}, nil +} + +// WatchRegisterFee is a free log subscription operation binding the contract event 0x1d4a2348bf98e0fa847f28a7db9967b1327ac954c312b659b65a860bb6959172. +// +// Solidity: event RegisterFee(uint256 value) +func (_StickerMarket *StickerMarketFilterer) WatchRegisterFee(opts *bind.WatchOpts, sink chan<- *StickerMarketRegisterFee) (event.Subscription, error) { + + logs, sub, err := _StickerMarket.contract.WatchLogs(opts, "RegisterFee") + 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(StickerMarketRegisterFee) + if err := _StickerMarket.contract.UnpackLog(event, "RegisterFee", 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 +} + +// ParseRegisterFee is a log parse operation binding the contract event 0x1d4a2348bf98e0fa847f28a7db9967b1327ac954c312b659b65a860bb6959172. +// +// Solidity: event RegisterFee(uint256 value) +func (_StickerMarket *StickerMarketFilterer) ParseRegisterFee(log types.Log) (*StickerMarketRegisterFee, error) { + event := new(StickerMarketRegisterFee) + if err := _StickerMarket.contract.UnpackLog(event, "RegisterFee", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// StickerMarketTransferIterator is returned from FilterTransfer and is used to iterate over the raw logs and unpacked data for Transfer events raised by the StickerMarket contract. +type StickerMarketTransferIterator struct { + Event *StickerMarketTransfer // 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 *StickerMarketTransferIterator) 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(StickerMarketTransfer) + 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(StickerMarketTransfer) + 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 *StickerMarketTransferIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *StickerMarketTransferIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// StickerMarketTransfer represents a Transfer event raised by the StickerMarket contract. +type StickerMarketTransfer struct { + From common.Address + To common.Address + Value *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterTransfer is a free log retrieval operation binding the contract event 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef. +// +// Solidity: event Transfer(address indexed from, address indexed to, uint256 indexed value) +func (_StickerMarket *StickerMarketFilterer) FilterTransfer(opts *bind.FilterOpts, from []common.Address, to []common.Address, value []*big.Int) (*StickerMarketTransferIterator, error) { + + var fromRule []interface{} + for _, fromItem := range from { + fromRule = append(fromRule, fromItem) + } + var toRule []interface{} + for _, toItem := range to { + toRule = append(toRule, toItem) + } + var valueRule []interface{} + for _, valueItem := range value { + valueRule = append(valueRule, valueItem) + } + + logs, sub, err := _StickerMarket.contract.FilterLogs(opts, "Transfer", fromRule, toRule, valueRule) + if err != nil { + return nil, err + } + return &StickerMarketTransferIterator{contract: _StickerMarket.contract, event: "Transfer", logs: logs, sub: sub}, nil +} + +// WatchTransfer is a free log subscription operation binding the contract event 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef. +// +// Solidity: event Transfer(address indexed from, address indexed to, uint256 indexed value) +func (_StickerMarket *StickerMarketFilterer) WatchTransfer(opts *bind.WatchOpts, sink chan<- *StickerMarketTransfer, from []common.Address, to []common.Address, value []*big.Int) (event.Subscription, error) { + + var fromRule []interface{} + for _, fromItem := range from { + fromRule = append(fromRule, fromItem) + } + var toRule []interface{} + for _, toItem := range to { + toRule = append(toRule, toItem) + } + var valueRule []interface{} + for _, valueItem := range value { + valueRule = append(valueRule, valueItem) + } + + logs, sub, err := _StickerMarket.contract.WatchLogs(opts, "Transfer", fromRule, toRule, valueRule) + 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(StickerMarketTransfer) + if err := _StickerMarket.contract.UnpackLog(event, "Transfer", 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 +} + +// ParseTransfer is a log parse operation binding the contract event 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef. +// +// Solidity: event Transfer(address indexed from, address indexed to, uint256 indexed value) +func (_StickerMarket *StickerMarketFilterer) ParseTransfer(log types.Log) (*StickerMarketTransfer, error) { + event := new(StickerMarketTransfer) + if err := _StickerMarket.contract.UnpackLog(event, "Transfer", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// StickerPackABI is the input ABI used to generate the binding from. +const StickerPackABI = "[{\"constant\":true,\"inputs\":[{\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"getApproved\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"to\",\"type\":\"address\"},{\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_owner\",\"type\":\"address\"},{\"name\":\"_packId\",\"type\":\"uint256\"}],\"name\":\"generateToken\",\"outputs\":[{\"name\":\"tokenId\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"from\",\"type\":\"address\"},{\"name\":\"to\",\"type\":\"address\"},{\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"owner\",\"type\":\"address\"},{\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"tokenOfOwnerByIndex\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_newController\",\"type\":\"address\"}],\"name\":\"changeController\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"from\",\"type\":\"address\"},{\"name\":\"to\",\"type\":\"address\"},{\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"safeTransferFrom\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"tokenByIndex\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"ownerOf\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"symbol\",\"outputs\":[{\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"tokenCount\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"to\",\"type\":\"address\"},{\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"setApprovalForAll\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"tokenPackId\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"from\",\"type\":\"address\"},{\"name\":\"to\",\"type\":\"address\"},{\"name\":\"tokenId\",\"type\":\"uint256\"},{\"name\":\"_data\",\"type\":\"bytes\"}],\"name\":\"safeTransferFrom\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"tokenURI\",\"outputs\":[{\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_token\",\"type\":\"address\"}],\"name\":\"claimTokens\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"owner\",\"type\":\"address\"},{\"name\":\"operator\",\"type\":\"address\"}],\"name\":\"isApprovedForAll\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"controller\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"to\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"approved\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"ApprovalForAll\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"_token\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"_controller\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"ClaimedTokens\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"controller\",\"type\":\"address\"}],\"name\":\"NewController\",\"type\":\"event\"}]" + +// StickerPackFuncSigs maps the 4-byte function signature to its string representation. +var StickerPackFuncSigs = map[string]string{ + "095ea7b3": "approve(address,uint256)", + "70a08231": "balanceOf(address)", + "3cebb823": "changeController(address)", + "df8de3e7": "claimTokens(address)", + "f77c4791": "controller()", + "188b5372": "generateToken(address,uint256)", + "081812fc": "getApproved(uint256)", + "e985e9c5": "isApprovedForAll(address,address)", + "06fdde03": "name()", + "6352211e": "ownerOf(uint256)", + "42842e0e": "safeTransferFrom(address,address,uint256)", + "b88d4fde": "safeTransferFrom(address,address,uint256,bytes)", + "a22cb465": "setApprovalForAll(address,bool)", + "01ffc9a7": "supportsInterface(bytes4)", + "95d89b41": "symbol()", + "4f6ccce7": "tokenByIndex(uint256)", + "9f181b5e": "tokenCount()", + "2f745c59": "tokenOfOwnerByIndex(address,uint256)", + "a546af4c": "tokenPackId(uint256)", + "c87b56dd": "tokenURI(uint256)", + "18160ddd": "totalSupply()", + "23b872dd": "transferFrom(address,address,uint256)", +} + +// StickerPackBin is the compiled bytecode used for deploying new contracts. +var StickerPackBin = "0x601360809081527f53746174757320537469636b6572205061636b0000000000000000000000000060a052610100604052600460c09081527f53544b500000000000000000000000000000000000000000000000000000000060e052600080546001600160a01b031916331790558181620000a37f01ffc9a7000000000000000000000000000000000000000000000000000000006001600160e01b036200017516565b620000d77f80ac58cd000000000000000000000000000000000000000000000000000000006001600160e01b036200017516565b6200010b7f780e9d63000000000000000000000000000000000000000000000000000000006001600160e01b036200017516565b81516200012090600a90602085019062000247565b5080516200013690600b90602084019062000247565b506200016b7f5b5e139f000000000000000000000000000000000000000000000000000000006001600160e01b036200017516565b50505050620002ec565b7fffffffff0000000000000000000000000000000000000000000000000000000080821614156200020757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f4552433136353a20696e76616c696420696e7465726661636520696400000000604482015290519081900360640190fd5b7fffffffff00000000000000000000000000000000000000000000000000000000166000908152600160208190526040909120805460ff19169091179055565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106200028a57805160ff1916838001178555620002ba565b82800160010185558215620002ba579182015b82811115620002ba5782518255916020019190600101906200029d565b50620002c8929150620002cc565b5090565b620002e991905b80821115620002c85760008155600101620002d3565b90565b61191080620002fc6000396000f3fe608060405234801561001057600080fd5b50600436106101425760003560e01c80636352211e116100b8578063a546af4c1161007c578063a546af4c14610408578063b88d4fde14610425578063c87b56dd146104eb578063df8de3e714610508578063e985e9c51461052e578063f77c47911461055c57610142565b80636352211e1461038757806370a08231146103a457806395d89b41146103ca5780639f181b5e146103d2578063a22cb465146103da57610142565b8063188b53721161010a578063188b53721461028057806323b872dd146102ac5780632f745c59146102e25780633cebb8231461030e57806342842e0e146103345780634f6ccce71461036a57610142565b806301ffc9a71461014757806306fdde0314610182578063081812fc146101ff578063095ea7b31461023857806318160ddd14610266575b600080fd5b61016e6004803603602081101561015d57600080fd5b50356001600160e01b031916610564565b604080519115158252519081900360200190f35b61018a610583565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101c45781810151838201526020016101ac565b50505050905090810190601f1680156101f15780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61021c6004803603602081101561021557600080fd5b503561061a565b604080516001600160a01b039092168252519081900360200190f35b6102646004803603604081101561024e57600080fd5b506001600160a01b03813516906020013561067c565b005b61026e61078d565b60408051918252519081900360200190f35b61026e6004803603604081101561029657600080fd5b506001600160a01b038135169060200135610793565b610264600480360360608110156102c257600080fd5b506001600160a01b0381358116916020810135909116906040013561080f565b61026e600480360360408110156102f857600080fd5b506001600160a01b038135169060200135610864565b6102646004803603602081101561032457600080fd5b50356001600160a01b03166108e3565b6102646004803603606081101561034a57600080fd5b506001600160a01b03813581169160208101359091169060400135610985565b61026e6004803603602081101561038057600080fd5b50356109a0565b61021c6004803603602081101561039d57600080fd5b5035610a06565b61026e600480360360208110156103ba57600080fd5b50356001600160a01b0316610a5a565b61018a610ac2565b61026e610b23565b610264600480360360408110156103f057600080fd5b506001600160a01b0381351690602001351515610b29565b61026e6004803603602081101561041e57600080fd5b5035610bf5565b6102646004803603608081101561043b57600080fd5b6001600160a01b0382358116926020810135909116916040820135919081019060808101606082013564010000000081111561047657600080fd5b82018360208201111561048857600080fd5b803590602001918460018302840111640100000000831117156104aa57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610c07945050505050565b61018a6004803603602081101561050157600080fd5b5035610c5f565b6102646004803603602081101561051e57600080fd5b50356001600160a01b0316610d44565b61016e6004803603604081101561054457600080fd5b506001600160a01b0381358116916020013516610dac565b61021c610dda565b6001600160e01b03191660009081526001602052604090205460ff1690565b600a8054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526060939092909183018282801561060f5780601f106105e45761010080835404028352916020019161060f565b820191906000526020600020905b8154815290600101906020018083116105f257829003601f168201915b505050505090505b90565b600061062582610de9565b6106605760405162461bcd60e51b815260040180806020018281038252602c8152602001806117da602c913960400191505060405180910390fd5b506000908152600360205260409020546001600160a01b031690565b600061068782610a06565b9050806001600160a01b0316836001600160a01b031614156106da5760405162461bcd60e51b815260040180806020018281038252602181526020018061185e6021913960400191505060405180910390fd5b336001600160a01b03821614806106f657506106f68133610dac565b6107315760405162461bcd60e51b815260040180806020018281038252603881526020018061174f6038913960400191505060405180910390fd5b60008281526003602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b60085490565b600080546001600160a01b031633146107e2576040805162461bcd60e51b815260206004820152600c60248201526b155b985d5d1a1bdc9a5e995960a21b604482015290519081900360640190fd5b50600e8054600181019091556000818152600d602052604090208290556108098382610e06565b92915050565b6108193382610e27565b6108545760405162461bcd60e51b815260040180806020018281038252603181526020018061187f6031913960400191505060405180910390fd5b61085f838383610ecb565b505050565b600061086f83610a5a565b82106108ac5760405162461bcd60e51b815260040180806020018281038252602b8152602001806116a2602b913960400191505060405180910390fd5b6001600160a01b03831660009081526006602052604090208054839081106108d057fe5b9060005260206000200154905092915050565b6000546001600160a01b03163314610931576040805162461bcd60e51b815260206004820152600c60248201526b155b985d5d1a1bdc9a5e995960a21b604482015290519081900360640190fd5b600080546001600160a01b0383166001600160a01b0319909116811790915560408051918252517fe253457d9ad994ca9682fc3bbc38c890dca73a2d5ecee3809e548bac8b00d7c69181900360200190a150565b61085f83838360405180602001604052806000815250610c07565b60006109aa61078d565b82106109e75760405162461bcd60e51b815260040180806020018281038252602c8152602001806118b0602c913960400191505060405180910390fd5b600882815481106109f457fe5b90600052602060002001549050919050565b6000818152600260205260408120546001600160a01b0316806108095760405162461bcd60e51b81526004018080602001828103825260298152602001806117b16029913960400191505060405180910390fd5b60006001600160a01b038216610aa15760405162461bcd60e51b815260040180806020018281038252602a815260200180611787602a913960400191505060405180910390fd5b6001600160a01b038216600090815260046020526040902061080990610eea565b600b8054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526060939092909183018282801561060f5780601f106105e45761010080835404028352916020019161060f565b600e5481565b6001600160a01b038216331415610b87576040805162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c657200000000000000604482015290519081900360640190fd5b3360008181526005602090815260408083206001600160a01b03871680855290835292819020805460ff1916861515908117909155815190815290519293927f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31929181900390910190a35050565b600d6020526000908152604090205481565b610c1284848461080f565b610c1e84848484610eee565b610c595760405162461bcd60e51b81526004018080602001828103825260328152602001806116cd6032913960400191505060405180910390fd5b50505050565b6060610c6a82610de9565b610ca55760405162461bcd60e51b815260040180806020018281038252602f81526020018061182f602f913960400191505060405180910390fd5b6000828152600c602090815260409182902080548351601f600260001961010060018616150201909316929092049182018490048402810184019094528084529091830182828015610d385780601f10610d0d57610100808354040283529160200191610d38565b820191906000526020600020905b815481529060010190602001808311610d1b57829003601f168201915b50505050509050919050565b6000546001600160a01b03163314610d92576040805162461bcd60e51b815260206004820152600c60248201526b155b985d5d1a1bdc9a5e995960a21b604482015290519081900360640190fd5b600054610da99082906001600160a01b0316611021565b50565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b6000546001600160a01b031681565b6000908152600260205260409020546001600160a01b0316151590565b610e1082826111ba565b610e1a82826112eb565b610e2381611329565b5050565b6000610e3282610de9565b610e6d5760405162461bcd60e51b815260040180806020018281038252602c815260200180611723602c913960400191505060405180910390fd5b6000610e7883610a06565b9050806001600160a01b0316846001600160a01b03161480610eb35750836001600160a01b0316610ea88461061a565b6001600160a01b0316145b80610ec35750610ec38185610dac565b949350505050565b610ed683838361136d565b610ee083826114b1565b61085f82826112eb565b5490565b6000610f02846001600160a01b03166115a6565b610f0e57506001610ec3565b604051630a85bd0160e11b815233600482018181526001600160a01b03888116602485015260448401879052608060648501908152865160848601528651600095928a169463150b7a029490938c938b938b939260a4019060208501908083838e5b83811015610f88578181015183820152602001610f70565b50505050905090810190601f168015610fb55780820380516001836020036101000a031916815260200191505b5095505050505050602060405180830381600087803b158015610fd757600080fd5b505af1158015610feb573d6000803e3d6000fd5b505050506040513d602081101561100157600080fd5b50516001600160e01b031916630a85bd0160e11b14915050949350505050565b60006001600160a01b03831661107157506040513031906001600160a01b0383169082156108fc029083906000818181858888f1935050505015801561106b573d6000803e3d6000fd5b5061116a565b604080516370a0823160e01b8152306004820152905184916001600160a01b038316916370a0823191602480820192602092909190829003018186803b1580156110ba57600080fd5b505afa1580156110ce573d6000803e3d6000fd5b505050506040513d60208110156110e457600080fd5b50516040805163a9059cbb60e01b81526001600160a01b0386811660048301526024820184905291519294509083169163a9059cbb916044808201926020929091908290030181600087803b15801561113c57600080fd5b505af1158015611150573d6000803e3d6000fd5b505050506040513d602081101561116657600080fd5b5050505b816001600160a01b0316836001600160a01b03167ff931edb47c50b4b4104c187b5814a9aef5f709e17e2ecf9617e860cacade929c836040518082815260200191505060405180910390a3505050565b6001600160a01b038216611215576040805162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f2061646472657373604482015290519081900360640190fd5b61121e81610de9565b15611270576040805162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604482015290519081900360640190fd5b600081815260026020908152604080832080546001600160a01b0319166001600160a01b0387169081179091558352600490915290206112af906115ac565b60405181906001600160a01b038416906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b6001600160a01b0390911660009081526006602081815260408084208054868652600784529185208290559282526001810183559183529091200155565b600880546000838152600960205260408120829055600182018355919091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30155565b826001600160a01b031661138082610a06565b6001600160a01b0316146113c55760405162461bcd60e51b81526004018080602001828103825260298152602001806118066029913960400191505060405180910390fd5b6001600160a01b03821661140a5760405162461bcd60e51b81526004018080602001828103825260248152602001806116ff6024913960400191505060405180910390fd5b611413816115b5565b6001600160a01b0383166000908152600460205260409020611434906115f0565b6001600160a01b0382166000908152600460205260409020611455906115ac565b60008181526002602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b6001600160a01b0382166000908152600660205260408120546114db90600163ffffffff61160716565b600083815260076020526040902054909150808214611576576001600160a01b038416600090815260066020526040812080548490811061151857fe5b906000526020600020015490508060066000876001600160a01b03166001600160a01b03168152602001908152602001600020838154811061155657fe5b600091825260208083209091019290925591825260079052604090208190555b6001600160a01b038416600090815260066020526040902080549061159f906000198301611664565b5050505050565b3b151590565b80546001019055565b6000818152600360205260409020546001600160a01b031615610da957600090815260036020526040902080546001600160a01b0319169055565b805461160390600163ffffffff61160716565b9055565b60008282111561165e576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b81548183558181111561085f5760008381526020902061085f91810190830161061791905b8082111561169d5760008155600101611689565b509056fe455243373231456e756d657261626c653a206f776e657220696e646578206f7574206f6620626f756e64734552433732313a207472616e7366657220746f206e6f6e20455243373231526563656976657220696d706c656d656e7465724552433732313a207472616e7366657220746f20746865207a65726f20616464726573734552433732313a206f70657261746f7220717565727920666f72206e6f6e6578697374656e7420746f6b656e4552433732313a20617070726f76652063616c6c6572206973206e6f74206f776e6572206e6f7220617070726f76656420666f7220616c6c4552433732313a2062616c616e636520717565727920666f7220746865207a65726f20616464726573734552433732313a206f776e657220717565727920666f72206e6f6e6578697374656e7420746f6b656e4552433732313a20617070726f76656420717565727920666f72206e6f6e6578697374656e7420746f6b656e4552433732313a207472616e73666572206f6620746f6b656e2074686174206973206e6f74206f776e4552433732314d657461646174613a2055524920717565727920666f72206e6f6e6578697374656e7420746f6b656e4552433732313a20617070726f76616c20746f2063757272656e74206f776e65724552433732313a207472616e736665722063616c6c6572206973206e6f74206f776e6572206e6f7220617070726f766564455243373231456e756d657261626c653a20676c6f62616c20696e646578206f7574206f6620626f756e6473a265627a7a72305820eb076376e246b05cfc5a94cb6f0e71dd465ffaf296d3dac655c16b2c8f4013db64736f6c634300050a0032" + +// DeployStickerPack deploys a new Ethereum contract, binding an instance of StickerPack to it. +func DeployStickerPack(auth *bind.TransactOpts, backend bind.ContractBackend) (common.Address, *types.Transaction, *StickerPack, error) { + parsed, err := abi.JSON(strings.NewReader(StickerPackABI)) + if err != nil { + return common.Address{}, nil, nil, err + } + + address, tx, contract, err := bind.DeployContract(auth, parsed, common.FromHex(StickerPackBin), backend) + if err != nil { + return common.Address{}, nil, nil, err + } + return address, tx, &StickerPack{StickerPackCaller: StickerPackCaller{contract: contract}, StickerPackTransactor: StickerPackTransactor{contract: contract}, StickerPackFilterer: StickerPackFilterer{contract: contract}}, nil +} + +// StickerPack is an auto generated Go binding around an Ethereum contract. +type StickerPack struct { + StickerPackCaller // Read-only binding to the contract + StickerPackTransactor // Write-only binding to the contract + StickerPackFilterer // Log filterer for contract events +} + +// StickerPackCaller is an auto generated read-only Go binding around an Ethereum contract. +type StickerPackCaller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// StickerPackTransactor is an auto generated write-only Go binding around an Ethereum contract. +type StickerPackTransactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// StickerPackFilterer is an auto generated log filtering Go binding around an Ethereum contract events. +type StickerPackFilterer struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// StickerPackSession is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type StickerPackSession struct { + Contract *StickerPack // 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 +} + +// StickerPackCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type StickerPackCallerSession struct { + Contract *StickerPackCaller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// StickerPackTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type StickerPackTransactorSession struct { + Contract *StickerPackTransactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// StickerPackRaw is an auto generated low-level Go binding around an Ethereum contract. +type StickerPackRaw struct { + Contract *StickerPack // Generic contract binding to access the raw methods on +} + +// StickerPackCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type StickerPackCallerRaw struct { + Contract *StickerPackCaller // Generic read-only contract binding to access the raw methods on +} + +// StickerPackTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type StickerPackTransactorRaw struct { + Contract *StickerPackTransactor // Generic write-only contract binding to access the raw methods on +} + +// NewStickerPack creates a new instance of StickerPack, bound to a specific deployed contract. +func NewStickerPack(address common.Address, backend bind.ContractBackend) (*StickerPack, error) { + contract, err := bindStickerPack(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &StickerPack{StickerPackCaller: StickerPackCaller{contract: contract}, StickerPackTransactor: StickerPackTransactor{contract: contract}, StickerPackFilterer: StickerPackFilterer{contract: contract}}, nil +} + +// NewStickerPackCaller creates a new read-only instance of StickerPack, bound to a specific deployed contract. +func NewStickerPackCaller(address common.Address, caller bind.ContractCaller) (*StickerPackCaller, error) { + contract, err := bindStickerPack(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &StickerPackCaller{contract: contract}, nil +} + +// NewStickerPackTransactor creates a new write-only instance of StickerPack, bound to a specific deployed contract. +func NewStickerPackTransactor(address common.Address, transactor bind.ContractTransactor) (*StickerPackTransactor, error) { + contract, err := bindStickerPack(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &StickerPackTransactor{contract: contract}, nil +} + +// NewStickerPackFilterer creates a new log filterer instance of StickerPack, bound to a specific deployed contract. +func NewStickerPackFilterer(address common.Address, filterer bind.ContractFilterer) (*StickerPackFilterer, error) { + contract, err := bindStickerPack(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &StickerPackFilterer{contract: contract}, nil +} + +// bindStickerPack binds a generic wrapper to an already deployed contract. +func bindStickerPack(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := abi.JSON(strings.NewReader(StickerPackABI)) + 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 (_StickerPack *StickerPackRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _StickerPack.Contract.StickerPackCaller.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 (_StickerPack *StickerPackRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _StickerPack.Contract.StickerPackTransactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_StickerPack *StickerPackRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _StickerPack.Contract.StickerPackTransactor.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 (_StickerPack *StickerPackCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _StickerPack.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 (_StickerPack *StickerPackTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _StickerPack.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_StickerPack *StickerPackTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _StickerPack.Contract.contract.Transact(opts, method, params...) +} + +// BalanceOf is a free data retrieval call binding the contract method 0x70a08231. +// +// Solidity: function balanceOf(address owner) view returns(uint256) +func (_StickerPack *StickerPackCaller) BalanceOf(opts *bind.CallOpts, owner common.Address) (*big.Int, error) { + var out []interface{} + err := _StickerPack.contract.Call(opts, &out, "balanceOf", owner) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// BalanceOf is a free data retrieval call binding the contract method 0x70a08231. +// +// Solidity: function balanceOf(address owner) view returns(uint256) +func (_StickerPack *StickerPackSession) BalanceOf(owner common.Address) (*big.Int, error) { + return _StickerPack.Contract.BalanceOf(&_StickerPack.CallOpts, owner) +} + +// BalanceOf is a free data retrieval call binding the contract method 0x70a08231. +// +// Solidity: function balanceOf(address owner) view returns(uint256) +func (_StickerPack *StickerPackCallerSession) BalanceOf(owner common.Address) (*big.Int, error) { + return _StickerPack.Contract.BalanceOf(&_StickerPack.CallOpts, owner) +} + +// Controller is a free data retrieval call binding the contract method 0xf77c4791. +// +// Solidity: function controller() view returns(address) +func (_StickerPack *StickerPackCaller) Controller(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _StickerPack.contract.Call(opts, &out, "controller") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// Controller is a free data retrieval call binding the contract method 0xf77c4791. +// +// Solidity: function controller() view returns(address) +func (_StickerPack *StickerPackSession) Controller() (common.Address, error) { + return _StickerPack.Contract.Controller(&_StickerPack.CallOpts) +} + +// Controller is a free data retrieval call binding the contract method 0xf77c4791. +// +// Solidity: function controller() view returns(address) +func (_StickerPack *StickerPackCallerSession) Controller() (common.Address, error) { + return _StickerPack.Contract.Controller(&_StickerPack.CallOpts) +} + +// GetApproved is a free data retrieval call binding the contract method 0x081812fc. +// +// Solidity: function getApproved(uint256 tokenId) view returns(address) +func (_StickerPack *StickerPackCaller) GetApproved(opts *bind.CallOpts, tokenId *big.Int) (common.Address, error) { + var out []interface{} + err := _StickerPack.contract.Call(opts, &out, "getApproved", tokenId) + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// GetApproved is a free data retrieval call binding the contract method 0x081812fc. +// +// Solidity: function getApproved(uint256 tokenId) view returns(address) +func (_StickerPack *StickerPackSession) GetApproved(tokenId *big.Int) (common.Address, error) { + return _StickerPack.Contract.GetApproved(&_StickerPack.CallOpts, tokenId) +} + +// GetApproved is a free data retrieval call binding the contract method 0x081812fc. +// +// Solidity: function getApproved(uint256 tokenId) view returns(address) +func (_StickerPack *StickerPackCallerSession) GetApproved(tokenId *big.Int) (common.Address, error) { + return _StickerPack.Contract.GetApproved(&_StickerPack.CallOpts, tokenId) +} + +// IsApprovedForAll is a free data retrieval call binding the contract method 0xe985e9c5. +// +// Solidity: function isApprovedForAll(address owner, address operator) view returns(bool) +func (_StickerPack *StickerPackCaller) IsApprovedForAll(opts *bind.CallOpts, owner common.Address, operator common.Address) (bool, error) { + var out []interface{} + err := _StickerPack.contract.Call(opts, &out, "isApprovedForAll", owner, operator) + + if err != nil { + return *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + + return out0, err + +} + +// IsApprovedForAll is a free data retrieval call binding the contract method 0xe985e9c5. +// +// Solidity: function isApprovedForAll(address owner, address operator) view returns(bool) +func (_StickerPack *StickerPackSession) IsApprovedForAll(owner common.Address, operator common.Address) (bool, error) { + return _StickerPack.Contract.IsApprovedForAll(&_StickerPack.CallOpts, owner, operator) +} + +// IsApprovedForAll is a free data retrieval call binding the contract method 0xe985e9c5. +// +// Solidity: function isApprovedForAll(address owner, address operator) view returns(bool) +func (_StickerPack *StickerPackCallerSession) IsApprovedForAll(owner common.Address, operator common.Address) (bool, error) { + return _StickerPack.Contract.IsApprovedForAll(&_StickerPack.CallOpts, owner, operator) +} + +// Name is a free data retrieval call binding the contract method 0x06fdde03. +// +// Solidity: function name() view returns(string) +func (_StickerPack *StickerPackCaller) Name(opts *bind.CallOpts) (string, error) { + var out []interface{} + err := _StickerPack.contract.Call(opts, &out, "name") + + if err != nil { + return *new(string), err + } + + out0 := *abi.ConvertType(out[0], new(string)).(*string) + + return out0, err + +} + +// Name is a free data retrieval call binding the contract method 0x06fdde03. +// +// Solidity: function name() view returns(string) +func (_StickerPack *StickerPackSession) Name() (string, error) { + return _StickerPack.Contract.Name(&_StickerPack.CallOpts) +} + +// Name is a free data retrieval call binding the contract method 0x06fdde03. +// +// Solidity: function name() view returns(string) +func (_StickerPack *StickerPackCallerSession) Name() (string, error) { + return _StickerPack.Contract.Name(&_StickerPack.CallOpts) +} + +// OwnerOf is a free data retrieval call binding the contract method 0x6352211e. +// +// Solidity: function ownerOf(uint256 tokenId) view returns(address) +func (_StickerPack *StickerPackCaller) OwnerOf(opts *bind.CallOpts, tokenId *big.Int) (common.Address, error) { + var out []interface{} + err := _StickerPack.contract.Call(opts, &out, "ownerOf", tokenId) + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// OwnerOf is a free data retrieval call binding the contract method 0x6352211e. +// +// Solidity: function ownerOf(uint256 tokenId) view returns(address) +func (_StickerPack *StickerPackSession) OwnerOf(tokenId *big.Int) (common.Address, error) { + return _StickerPack.Contract.OwnerOf(&_StickerPack.CallOpts, tokenId) +} + +// OwnerOf is a free data retrieval call binding the contract method 0x6352211e. +// +// Solidity: function ownerOf(uint256 tokenId) view returns(address) +func (_StickerPack *StickerPackCallerSession) OwnerOf(tokenId *big.Int) (common.Address, error) { + return _StickerPack.Contract.OwnerOf(&_StickerPack.CallOpts, tokenId) +} + +// SupportsInterface is a free data retrieval call binding the contract method 0x01ffc9a7. +// +// Solidity: function supportsInterface(bytes4 interfaceId) view returns(bool) +func (_StickerPack *StickerPackCaller) SupportsInterface(opts *bind.CallOpts, interfaceId [4]byte) (bool, error) { + var out []interface{} + err := _StickerPack.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 (_StickerPack *StickerPackSession) SupportsInterface(interfaceId [4]byte) (bool, error) { + return _StickerPack.Contract.SupportsInterface(&_StickerPack.CallOpts, interfaceId) +} + +// SupportsInterface is a free data retrieval call binding the contract method 0x01ffc9a7. +// +// Solidity: function supportsInterface(bytes4 interfaceId) view returns(bool) +func (_StickerPack *StickerPackCallerSession) SupportsInterface(interfaceId [4]byte) (bool, error) { + return _StickerPack.Contract.SupportsInterface(&_StickerPack.CallOpts, interfaceId) +} + +// Symbol is a free data retrieval call binding the contract method 0x95d89b41. +// +// Solidity: function symbol() view returns(string) +func (_StickerPack *StickerPackCaller) Symbol(opts *bind.CallOpts) (string, error) { + var out []interface{} + err := _StickerPack.contract.Call(opts, &out, "symbol") + + if err != nil { + return *new(string), err + } + + out0 := *abi.ConvertType(out[0], new(string)).(*string) + + return out0, err + +} + +// Symbol is a free data retrieval call binding the contract method 0x95d89b41. +// +// Solidity: function symbol() view returns(string) +func (_StickerPack *StickerPackSession) Symbol() (string, error) { + return _StickerPack.Contract.Symbol(&_StickerPack.CallOpts) +} + +// Symbol is a free data retrieval call binding the contract method 0x95d89b41. +// +// Solidity: function symbol() view returns(string) +func (_StickerPack *StickerPackCallerSession) Symbol() (string, error) { + return _StickerPack.Contract.Symbol(&_StickerPack.CallOpts) +} + +// TokenByIndex is a free data retrieval call binding the contract method 0x4f6ccce7. +// +// Solidity: function tokenByIndex(uint256 index) view returns(uint256) +func (_StickerPack *StickerPackCaller) TokenByIndex(opts *bind.CallOpts, index *big.Int) (*big.Int, error) { + var out []interface{} + err := _StickerPack.contract.Call(opts, &out, "tokenByIndex", index) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// TokenByIndex is a free data retrieval call binding the contract method 0x4f6ccce7. +// +// Solidity: function tokenByIndex(uint256 index) view returns(uint256) +func (_StickerPack *StickerPackSession) TokenByIndex(index *big.Int) (*big.Int, error) { + return _StickerPack.Contract.TokenByIndex(&_StickerPack.CallOpts, index) +} + +// TokenByIndex is a free data retrieval call binding the contract method 0x4f6ccce7. +// +// Solidity: function tokenByIndex(uint256 index) view returns(uint256) +func (_StickerPack *StickerPackCallerSession) TokenByIndex(index *big.Int) (*big.Int, error) { + return _StickerPack.Contract.TokenByIndex(&_StickerPack.CallOpts, index) +} + +// TokenCount is a free data retrieval call binding the contract method 0x9f181b5e. +// +// Solidity: function tokenCount() view returns(uint256) +func (_StickerPack *StickerPackCaller) TokenCount(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _StickerPack.contract.Call(opts, &out, "tokenCount") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// TokenCount is a free data retrieval call binding the contract method 0x9f181b5e. +// +// Solidity: function tokenCount() view returns(uint256) +func (_StickerPack *StickerPackSession) TokenCount() (*big.Int, error) { + return _StickerPack.Contract.TokenCount(&_StickerPack.CallOpts) +} + +// TokenCount is a free data retrieval call binding the contract method 0x9f181b5e. +// +// Solidity: function tokenCount() view returns(uint256) +func (_StickerPack *StickerPackCallerSession) TokenCount() (*big.Int, error) { + return _StickerPack.Contract.TokenCount(&_StickerPack.CallOpts) +} + +// TokenOfOwnerByIndex is a free data retrieval call binding the contract method 0x2f745c59. +// +// Solidity: function tokenOfOwnerByIndex(address owner, uint256 index) view returns(uint256) +func (_StickerPack *StickerPackCaller) TokenOfOwnerByIndex(opts *bind.CallOpts, owner common.Address, index *big.Int) (*big.Int, error) { + var out []interface{} + err := _StickerPack.contract.Call(opts, &out, "tokenOfOwnerByIndex", owner, index) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// TokenOfOwnerByIndex is a free data retrieval call binding the contract method 0x2f745c59. +// +// Solidity: function tokenOfOwnerByIndex(address owner, uint256 index) view returns(uint256) +func (_StickerPack *StickerPackSession) TokenOfOwnerByIndex(owner common.Address, index *big.Int) (*big.Int, error) { + return _StickerPack.Contract.TokenOfOwnerByIndex(&_StickerPack.CallOpts, owner, index) +} + +// TokenOfOwnerByIndex is a free data retrieval call binding the contract method 0x2f745c59. +// +// Solidity: function tokenOfOwnerByIndex(address owner, uint256 index) view returns(uint256) +func (_StickerPack *StickerPackCallerSession) TokenOfOwnerByIndex(owner common.Address, index *big.Int) (*big.Int, error) { + return _StickerPack.Contract.TokenOfOwnerByIndex(&_StickerPack.CallOpts, owner, index) +} + +// TokenPackId is a free data retrieval call binding the contract method 0xa546af4c. +// +// Solidity: function tokenPackId(uint256 ) view returns(uint256) +func (_StickerPack *StickerPackCaller) TokenPackId(opts *bind.CallOpts, arg0 *big.Int) (*big.Int, error) { + var out []interface{} + err := _StickerPack.contract.Call(opts, &out, "tokenPackId", arg0) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// TokenPackId is a free data retrieval call binding the contract method 0xa546af4c. +// +// Solidity: function tokenPackId(uint256 ) view returns(uint256) +func (_StickerPack *StickerPackSession) TokenPackId(arg0 *big.Int) (*big.Int, error) { + return _StickerPack.Contract.TokenPackId(&_StickerPack.CallOpts, arg0) +} + +// TokenPackId is a free data retrieval call binding the contract method 0xa546af4c. +// +// Solidity: function tokenPackId(uint256 ) view returns(uint256) +func (_StickerPack *StickerPackCallerSession) TokenPackId(arg0 *big.Int) (*big.Int, error) { + return _StickerPack.Contract.TokenPackId(&_StickerPack.CallOpts, arg0) +} + +// TokenURI is a free data retrieval call binding the contract method 0xc87b56dd. +// +// Solidity: function tokenURI(uint256 tokenId) view returns(string) +func (_StickerPack *StickerPackCaller) TokenURI(opts *bind.CallOpts, tokenId *big.Int) (string, error) { + var out []interface{} + err := _StickerPack.contract.Call(opts, &out, "tokenURI", tokenId) + + if err != nil { + return *new(string), err + } + + out0 := *abi.ConvertType(out[0], new(string)).(*string) + + return out0, err + +} + +// TokenURI is a free data retrieval call binding the contract method 0xc87b56dd. +// +// Solidity: function tokenURI(uint256 tokenId) view returns(string) +func (_StickerPack *StickerPackSession) TokenURI(tokenId *big.Int) (string, error) { + return _StickerPack.Contract.TokenURI(&_StickerPack.CallOpts, tokenId) +} + +// TokenURI is a free data retrieval call binding the contract method 0xc87b56dd. +// +// Solidity: function tokenURI(uint256 tokenId) view returns(string) +func (_StickerPack *StickerPackCallerSession) TokenURI(tokenId *big.Int) (string, error) { + return _StickerPack.Contract.TokenURI(&_StickerPack.CallOpts, tokenId) +} + +// TotalSupply is a free data retrieval call binding the contract method 0x18160ddd. +// +// Solidity: function totalSupply() view returns(uint256) +func (_StickerPack *StickerPackCaller) TotalSupply(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _StickerPack.contract.Call(opts, &out, "totalSupply") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// TotalSupply is a free data retrieval call binding the contract method 0x18160ddd. +// +// Solidity: function totalSupply() view returns(uint256) +func (_StickerPack *StickerPackSession) TotalSupply() (*big.Int, error) { + return _StickerPack.Contract.TotalSupply(&_StickerPack.CallOpts) +} + +// TotalSupply is a free data retrieval call binding the contract method 0x18160ddd. +// +// Solidity: function totalSupply() view returns(uint256) +func (_StickerPack *StickerPackCallerSession) TotalSupply() (*big.Int, error) { + return _StickerPack.Contract.TotalSupply(&_StickerPack.CallOpts) +} + +// Approve is a paid mutator transaction binding the contract method 0x095ea7b3. +// +// Solidity: function approve(address to, uint256 tokenId) returns() +func (_StickerPack *StickerPackTransactor) Approve(opts *bind.TransactOpts, to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _StickerPack.contract.Transact(opts, "approve", to, tokenId) +} + +// Approve is a paid mutator transaction binding the contract method 0x095ea7b3. +// +// Solidity: function approve(address to, uint256 tokenId) returns() +func (_StickerPack *StickerPackSession) Approve(to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _StickerPack.Contract.Approve(&_StickerPack.TransactOpts, to, tokenId) +} + +// Approve is a paid mutator transaction binding the contract method 0x095ea7b3. +// +// Solidity: function approve(address to, uint256 tokenId) returns() +func (_StickerPack *StickerPackTransactorSession) Approve(to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _StickerPack.Contract.Approve(&_StickerPack.TransactOpts, to, tokenId) +} + +// ChangeController is a paid mutator transaction binding the contract method 0x3cebb823. +// +// Solidity: function changeController(address _newController) returns() +func (_StickerPack *StickerPackTransactor) ChangeController(opts *bind.TransactOpts, _newController common.Address) (*types.Transaction, error) { + return _StickerPack.contract.Transact(opts, "changeController", _newController) +} + +// ChangeController is a paid mutator transaction binding the contract method 0x3cebb823. +// +// Solidity: function changeController(address _newController) returns() +func (_StickerPack *StickerPackSession) ChangeController(_newController common.Address) (*types.Transaction, error) { + return _StickerPack.Contract.ChangeController(&_StickerPack.TransactOpts, _newController) +} + +// ChangeController is a paid mutator transaction binding the contract method 0x3cebb823. +// +// Solidity: function changeController(address _newController) returns() +func (_StickerPack *StickerPackTransactorSession) ChangeController(_newController common.Address) (*types.Transaction, error) { + return _StickerPack.Contract.ChangeController(&_StickerPack.TransactOpts, _newController) +} + +// ClaimTokens is a paid mutator transaction binding the contract method 0xdf8de3e7. +// +// Solidity: function claimTokens(address _token) returns() +func (_StickerPack *StickerPackTransactor) ClaimTokens(opts *bind.TransactOpts, _token common.Address) (*types.Transaction, error) { + return _StickerPack.contract.Transact(opts, "claimTokens", _token) +} + +// ClaimTokens is a paid mutator transaction binding the contract method 0xdf8de3e7. +// +// Solidity: function claimTokens(address _token) returns() +func (_StickerPack *StickerPackSession) ClaimTokens(_token common.Address) (*types.Transaction, error) { + return _StickerPack.Contract.ClaimTokens(&_StickerPack.TransactOpts, _token) +} + +// ClaimTokens is a paid mutator transaction binding the contract method 0xdf8de3e7. +// +// Solidity: function claimTokens(address _token) returns() +func (_StickerPack *StickerPackTransactorSession) ClaimTokens(_token common.Address) (*types.Transaction, error) { + return _StickerPack.Contract.ClaimTokens(&_StickerPack.TransactOpts, _token) +} + +// GenerateToken is a paid mutator transaction binding the contract method 0x188b5372. +// +// Solidity: function generateToken(address _owner, uint256 _packId) returns(uint256 tokenId) +func (_StickerPack *StickerPackTransactor) GenerateToken(opts *bind.TransactOpts, _owner common.Address, _packId *big.Int) (*types.Transaction, error) { + return _StickerPack.contract.Transact(opts, "generateToken", _owner, _packId) +} + +// GenerateToken is a paid mutator transaction binding the contract method 0x188b5372. +// +// Solidity: function generateToken(address _owner, uint256 _packId) returns(uint256 tokenId) +func (_StickerPack *StickerPackSession) GenerateToken(_owner common.Address, _packId *big.Int) (*types.Transaction, error) { + return _StickerPack.Contract.GenerateToken(&_StickerPack.TransactOpts, _owner, _packId) +} + +// GenerateToken is a paid mutator transaction binding the contract method 0x188b5372. +// +// Solidity: function generateToken(address _owner, uint256 _packId) returns(uint256 tokenId) +func (_StickerPack *StickerPackTransactorSession) GenerateToken(_owner common.Address, _packId *big.Int) (*types.Transaction, error) { + return _StickerPack.Contract.GenerateToken(&_StickerPack.TransactOpts, _owner, _packId) +} + +// SafeTransferFrom is a paid mutator transaction binding the contract method 0x42842e0e. +// +// Solidity: function safeTransferFrom(address from, address to, uint256 tokenId) returns() +func (_StickerPack *StickerPackTransactor) SafeTransferFrom(opts *bind.TransactOpts, from common.Address, to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _StickerPack.contract.Transact(opts, "safeTransferFrom", from, to, tokenId) +} + +// SafeTransferFrom is a paid mutator transaction binding the contract method 0x42842e0e. +// +// Solidity: function safeTransferFrom(address from, address to, uint256 tokenId) returns() +func (_StickerPack *StickerPackSession) SafeTransferFrom(from common.Address, to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _StickerPack.Contract.SafeTransferFrom(&_StickerPack.TransactOpts, from, to, tokenId) +} + +// SafeTransferFrom is a paid mutator transaction binding the contract method 0x42842e0e. +// +// Solidity: function safeTransferFrom(address from, address to, uint256 tokenId) returns() +func (_StickerPack *StickerPackTransactorSession) SafeTransferFrom(from common.Address, to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _StickerPack.Contract.SafeTransferFrom(&_StickerPack.TransactOpts, from, to, tokenId) +} + +// SafeTransferFrom0 is a paid mutator transaction binding the contract method 0xb88d4fde. +// +// Solidity: function safeTransferFrom(address from, address to, uint256 tokenId, bytes _data) returns() +func (_StickerPack *StickerPackTransactor) SafeTransferFrom0(opts *bind.TransactOpts, from common.Address, to common.Address, tokenId *big.Int, _data []byte) (*types.Transaction, error) { + return _StickerPack.contract.Transact(opts, "safeTransferFrom0", from, to, tokenId, _data) +} + +// SafeTransferFrom0 is a paid mutator transaction binding the contract method 0xb88d4fde. +// +// Solidity: function safeTransferFrom(address from, address to, uint256 tokenId, bytes _data) returns() +func (_StickerPack *StickerPackSession) SafeTransferFrom0(from common.Address, to common.Address, tokenId *big.Int, _data []byte) (*types.Transaction, error) { + return _StickerPack.Contract.SafeTransferFrom0(&_StickerPack.TransactOpts, from, to, tokenId, _data) +} + +// SafeTransferFrom0 is a paid mutator transaction binding the contract method 0xb88d4fde. +// +// Solidity: function safeTransferFrom(address from, address to, uint256 tokenId, bytes _data) returns() +func (_StickerPack *StickerPackTransactorSession) SafeTransferFrom0(from common.Address, to common.Address, tokenId *big.Int, _data []byte) (*types.Transaction, error) { + return _StickerPack.Contract.SafeTransferFrom0(&_StickerPack.TransactOpts, from, to, tokenId, _data) +} + +// SetApprovalForAll is a paid mutator transaction binding the contract method 0xa22cb465. +// +// Solidity: function setApprovalForAll(address to, bool approved) returns() +func (_StickerPack *StickerPackTransactor) SetApprovalForAll(opts *bind.TransactOpts, to common.Address, approved bool) (*types.Transaction, error) { + return _StickerPack.contract.Transact(opts, "setApprovalForAll", to, approved) +} + +// SetApprovalForAll is a paid mutator transaction binding the contract method 0xa22cb465. +// +// Solidity: function setApprovalForAll(address to, bool approved) returns() +func (_StickerPack *StickerPackSession) SetApprovalForAll(to common.Address, approved bool) (*types.Transaction, error) { + return _StickerPack.Contract.SetApprovalForAll(&_StickerPack.TransactOpts, to, approved) +} + +// SetApprovalForAll is a paid mutator transaction binding the contract method 0xa22cb465. +// +// Solidity: function setApprovalForAll(address to, bool approved) returns() +func (_StickerPack *StickerPackTransactorSession) SetApprovalForAll(to common.Address, approved bool) (*types.Transaction, error) { + return _StickerPack.Contract.SetApprovalForAll(&_StickerPack.TransactOpts, to, approved) +} + +// TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd. +// +// Solidity: function transferFrom(address from, address to, uint256 tokenId) returns() +func (_StickerPack *StickerPackTransactor) TransferFrom(opts *bind.TransactOpts, from common.Address, to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _StickerPack.contract.Transact(opts, "transferFrom", from, to, tokenId) +} + +// TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd. +// +// Solidity: function transferFrom(address from, address to, uint256 tokenId) returns() +func (_StickerPack *StickerPackSession) TransferFrom(from common.Address, to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _StickerPack.Contract.TransferFrom(&_StickerPack.TransactOpts, from, to, tokenId) +} + +// TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd. +// +// Solidity: function transferFrom(address from, address to, uint256 tokenId) returns() +func (_StickerPack *StickerPackTransactorSession) TransferFrom(from common.Address, to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _StickerPack.Contract.TransferFrom(&_StickerPack.TransactOpts, from, to, tokenId) +} + +// StickerPackApprovalIterator is returned from FilterApproval and is used to iterate over the raw logs and unpacked data for Approval events raised by the StickerPack contract. +type StickerPackApprovalIterator struct { + Event *StickerPackApproval // 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 *StickerPackApprovalIterator) 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(StickerPackApproval) + 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(StickerPackApproval) + 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 *StickerPackApprovalIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *StickerPackApprovalIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// StickerPackApproval represents a Approval event raised by the StickerPack contract. +type StickerPackApproval struct { + Owner common.Address + Approved common.Address + TokenId *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterApproval is a free log retrieval operation binding the contract event 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925. +// +// Solidity: event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId) +func (_StickerPack *StickerPackFilterer) FilterApproval(opts *bind.FilterOpts, owner []common.Address, approved []common.Address, tokenId []*big.Int) (*StickerPackApprovalIterator, error) { + + var ownerRule []interface{} + for _, ownerItem := range owner { + ownerRule = append(ownerRule, ownerItem) + } + var approvedRule []interface{} + for _, approvedItem := range approved { + approvedRule = append(approvedRule, approvedItem) + } + var tokenIdRule []interface{} + for _, tokenIdItem := range tokenId { + tokenIdRule = append(tokenIdRule, tokenIdItem) + } + + logs, sub, err := _StickerPack.contract.FilterLogs(opts, "Approval", ownerRule, approvedRule, tokenIdRule) + if err != nil { + return nil, err + } + return &StickerPackApprovalIterator{contract: _StickerPack.contract, event: "Approval", logs: logs, sub: sub}, nil +} + +// WatchApproval is a free log subscription operation binding the contract event 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925. +// +// Solidity: event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId) +func (_StickerPack *StickerPackFilterer) WatchApproval(opts *bind.WatchOpts, sink chan<- *StickerPackApproval, owner []common.Address, approved []common.Address, tokenId []*big.Int) (event.Subscription, error) { + + var ownerRule []interface{} + for _, ownerItem := range owner { + ownerRule = append(ownerRule, ownerItem) + } + var approvedRule []interface{} + for _, approvedItem := range approved { + approvedRule = append(approvedRule, approvedItem) + } + var tokenIdRule []interface{} + for _, tokenIdItem := range tokenId { + tokenIdRule = append(tokenIdRule, tokenIdItem) + } + + logs, sub, err := _StickerPack.contract.WatchLogs(opts, "Approval", ownerRule, approvedRule, tokenIdRule) + 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(StickerPackApproval) + if err := _StickerPack.contract.UnpackLog(event, "Approval", 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 +} + +// ParseApproval is a log parse operation binding the contract event 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925. +// +// Solidity: event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId) +func (_StickerPack *StickerPackFilterer) ParseApproval(log types.Log) (*StickerPackApproval, error) { + event := new(StickerPackApproval) + if err := _StickerPack.contract.UnpackLog(event, "Approval", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// StickerPackApprovalForAllIterator is returned from FilterApprovalForAll and is used to iterate over the raw logs and unpacked data for ApprovalForAll events raised by the StickerPack contract. +type StickerPackApprovalForAllIterator struct { + Event *StickerPackApprovalForAll // 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 *StickerPackApprovalForAllIterator) 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(StickerPackApprovalForAll) + 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(StickerPackApprovalForAll) + 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 *StickerPackApprovalForAllIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *StickerPackApprovalForAllIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// StickerPackApprovalForAll represents a ApprovalForAll event raised by the StickerPack contract. +type StickerPackApprovalForAll struct { + Owner common.Address + Operator common.Address + Approved bool + Raw types.Log // Blockchain specific contextual infos +} + +// FilterApprovalForAll is a free log retrieval operation binding the contract event 0x17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31. +// +// Solidity: event ApprovalForAll(address indexed owner, address indexed operator, bool approved) +func (_StickerPack *StickerPackFilterer) FilterApprovalForAll(opts *bind.FilterOpts, owner []common.Address, operator []common.Address) (*StickerPackApprovalForAllIterator, error) { + + var ownerRule []interface{} + for _, ownerItem := range owner { + ownerRule = append(ownerRule, ownerItem) + } + var operatorRule []interface{} + for _, operatorItem := range operator { + operatorRule = append(operatorRule, operatorItem) + } + + logs, sub, err := _StickerPack.contract.FilterLogs(opts, "ApprovalForAll", ownerRule, operatorRule) + if err != nil { + return nil, err + } + return &StickerPackApprovalForAllIterator{contract: _StickerPack.contract, event: "ApprovalForAll", logs: logs, sub: sub}, nil +} + +// WatchApprovalForAll is a free log subscription operation binding the contract event 0x17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31. +// +// Solidity: event ApprovalForAll(address indexed owner, address indexed operator, bool approved) +func (_StickerPack *StickerPackFilterer) WatchApprovalForAll(opts *bind.WatchOpts, sink chan<- *StickerPackApprovalForAll, owner []common.Address, operator []common.Address) (event.Subscription, error) { + + var ownerRule []interface{} + for _, ownerItem := range owner { + ownerRule = append(ownerRule, ownerItem) + } + var operatorRule []interface{} + for _, operatorItem := range operator { + operatorRule = append(operatorRule, operatorItem) + } + + logs, sub, err := _StickerPack.contract.WatchLogs(opts, "ApprovalForAll", ownerRule, operatorRule) + 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(StickerPackApprovalForAll) + if err := _StickerPack.contract.UnpackLog(event, "ApprovalForAll", 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 +} + +// ParseApprovalForAll is a log parse operation binding the contract event 0x17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31. +// +// Solidity: event ApprovalForAll(address indexed owner, address indexed operator, bool approved) +func (_StickerPack *StickerPackFilterer) ParseApprovalForAll(log types.Log) (*StickerPackApprovalForAll, error) { + event := new(StickerPackApprovalForAll) + if err := _StickerPack.contract.UnpackLog(event, "ApprovalForAll", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// StickerPackClaimedTokensIterator is returned from FilterClaimedTokens and is used to iterate over the raw logs and unpacked data for ClaimedTokens events raised by the StickerPack contract. +type StickerPackClaimedTokensIterator struct { + Event *StickerPackClaimedTokens // 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 *StickerPackClaimedTokensIterator) 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(StickerPackClaimedTokens) + 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(StickerPackClaimedTokens) + 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 *StickerPackClaimedTokensIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *StickerPackClaimedTokensIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// StickerPackClaimedTokens represents a ClaimedTokens event raised by the StickerPack contract. +type StickerPackClaimedTokens struct { + Token common.Address + Controller common.Address + Amount *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterClaimedTokens is a free log retrieval operation binding the contract event 0xf931edb47c50b4b4104c187b5814a9aef5f709e17e2ecf9617e860cacade929c. +// +// Solidity: event ClaimedTokens(address indexed _token, address indexed _controller, uint256 _amount) +func (_StickerPack *StickerPackFilterer) FilterClaimedTokens(opts *bind.FilterOpts, _token []common.Address, _controller []common.Address) (*StickerPackClaimedTokensIterator, error) { + + var _tokenRule []interface{} + for _, _tokenItem := range _token { + _tokenRule = append(_tokenRule, _tokenItem) + } + var _controllerRule []interface{} + for _, _controllerItem := range _controller { + _controllerRule = append(_controllerRule, _controllerItem) + } + + logs, sub, err := _StickerPack.contract.FilterLogs(opts, "ClaimedTokens", _tokenRule, _controllerRule) + if err != nil { + return nil, err + } + return &StickerPackClaimedTokensIterator{contract: _StickerPack.contract, event: "ClaimedTokens", logs: logs, sub: sub}, nil +} + +// WatchClaimedTokens is a free log subscription operation binding the contract event 0xf931edb47c50b4b4104c187b5814a9aef5f709e17e2ecf9617e860cacade929c. +// +// Solidity: event ClaimedTokens(address indexed _token, address indexed _controller, uint256 _amount) +func (_StickerPack *StickerPackFilterer) WatchClaimedTokens(opts *bind.WatchOpts, sink chan<- *StickerPackClaimedTokens, _token []common.Address, _controller []common.Address) (event.Subscription, error) { + + var _tokenRule []interface{} + for _, _tokenItem := range _token { + _tokenRule = append(_tokenRule, _tokenItem) + } + var _controllerRule []interface{} + for _, _controllerItem := range _controller { + _controllerRule = append(_controllerRule, _controllerItem) + } + + logs, sub, err := _StickerPack.contract.WatchLogs(opts, "ClaimedTokens", _tokenRule, _controllerRule) + 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(StickerPackClaimedTokens) + if err := _StickerPack.contract.UnpackLog(event, "ClaimedTokens", 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 +} + +// ParseClaimedTokens is a log parse operation binding the contract event 0xf931edb47c50b4b4104c187b5814a9aef5f709e17e2ecf9617e860cacade929c. +// +// Solidity: event ClaimedTokens(address indexed _token, address indexed _controller, uint256 _amount) +func (_StickerPack *StickerPackFilterer) ParseClaimedTokens(log types.Log) (*StickerPackClaimedTokens, error) { + event := new(StickerPackClaimedTokens) + if err := _StickerPack.contract.UnpackLog(event, "ClaimedTokens", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// StickerPackNewControllerIterator is returned from FilterNewController and is used to iterate over the raw logs and unpacked data for NewController events raised by the StickerPack contract. +type StickerPackNewControllerIterator struct { + Event *StickerPackNewController // 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 *StickerPackNewControllerIterator) 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(StickerPackNewController) + 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(StickerPackNewController) + 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 *StickerPackNewControllerIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *StickerPackNewControllerIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// StickerPackNewController represents a NewController event raised by the StickerPack contract. +type StickerPackNewController struct { + Controller common.Address + Raw types.Log // Blockchain specific contextual infos +} + +// FilterNewController is a free log retrieval operation binding the contract event 0xe253457d9ad994ca9682fc3bbc38c890dca73a2d5ecee3809e548bac8b00d7c6. +// +// Solidity: event NewController(address controller) +func (_StickerPack *StickerPackFilterer) FilterNewController(opts *bind.FilterOpts) (*StickerPackNewControllerIterator, error) { + + logs, sub, err := _StickerPack.contract.FilterLogs(opts, "NewController") + if err != nil { + return nil, err + } + return &StickerPackNewControllerIterator{contract: _StickerPack.contract, event: "NewController", logs: logs, sub: sub}, nil +} + +// WatchNewController is a free log subscription operation binding the contract event 0xe253457d9ad994ca9682fc3bbc38c890dca73a2d5ecee3809e548bac8b00d7c6. +// +// Solidity: event NewController(address controller) +func (_StickerPack *StickerPackFilterer) WatchNewController(opts *bind.WatchOpts, sink chan<- *StickerPackNewController) (event.Subscription, error) { + + logs, sub, err := _StickerPack.contract.WatchLogs(opts, "NewController") + 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(StickerPackNewController) + if err := _StickerPack.contract.UnpackLog(event, "NewController", 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 +} + +// ParseNewController is a log parse operation binding the contract event 0xe253457d9ad994ca9682fc3bbc38c890dca73a2d5ecee3809e548bac8b00d7c6. +// +// Solidity: event NewController(address controller) +func (_StickerPack *StickerPackFilterer) ParseNewController(log types.Log) (*StickerPackNewController, error) { + event := new(StickerPackNewController) + if err := _StickerPack.contract.UnpackLog(event, "NewController", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// StickerPackTransferIterator is returned from FilterTransfer and is used to iterate over the raw logs and unpacked data for Transfer events raised by the StickerPack contract. +type StickerPackTransferIterator struct { + Event *StickerPackTransfer // 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 *StickerPackTransferIterator) 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(StickerPackTransfer) + 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(StickerPackTransfer) + 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 *StickerPackTransferIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *StickerPackTransferIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// StickerPackTransfer represents a Transfer event raised by the StickerPack contract. +type StickerPackTransfer struct { + From common.Address + To common.Address + TokenId *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterTransfer is a free log retrieval operation binding the contract event 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef. +// +// Solidity: event Transfer(address indexed from, address indexed to, uint256 indexed tokenId) +func (_StickerPack *StickerPackFilterer) FilterTransfer(opts *bind.FilterOpts, from []common.Address, to []common.Address, tokenId []*big.Int) (*StickerPackTransferIterator, error) { + + var fromRule []interface{} + for _, fromItem := range from { + fromRule = append(fromRule, fromItem) + } + var toRule []interface{} + for _, toItem := range to { + toRule = append(toRule, toItem) + } + var tokenIdRule []interface{} + for _, tokenIdItem := range tokenId { + tokenIdRule = append(tokenIdRule, tokenIdItem) + } + + logs, sub, err := _StickerPack.contract.FilterLogs(opts, "Transfer", fromRule, toRule, tokenIdRule) + if err != nil { + return nil, err + } + return &StickerPackTransferIterator{contract: _StickerPack.contract, event: "Transfer", logs: logs, sub: sub}, nil +} + +// WatchTransfer is a free log subscription operation binding the contract event 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef. +// +// Solidity: event Transfer(address indexed from, address indexed to, uint256 indexed tokenId) +func (_StickerPack *StickerPackFilterer) WatchTransfer(opts *bind.WatchOpts, sink chan<- *StickerPackTransfer, from []common.Address, to []common.Address, tokenId []*big.Int) (event.Subscription, error) { + + var fromRule []interface{} + for _, fromItem := range from { + fromRule = append(fromRule, fromItem) + } + var toRule []interface{} + for _, toItem := range to { + toRule = append(toRule, toItem) + } + var tokenIdRule []interface{} + for _, tokenIdItem := range tokenId { + tokenIdRule = append(tokenIdRule, tokenIdItem) + } + + logs, sub, err := _StickerPack.contract.WatchLogs(opts, "Transfer", fromRule, toRule, tokenIdRule) + 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(StickerPackTransfer) + if err := _StickerPack.contract.UnpackLog(event, "Transfer", 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 +} + +// ParseTransfer is a log parse operation binding the contract event 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef. +// +// Solidity: event Transfer(address indexed from, address indexed to, uint256 indexed tokenId) +func (_StickerPack *StickerPackFilterer) ParseTransfer(log types.Log) (*StickerPackTransfer, error) { + event := new(StickerPackTransfer) + if err := _StickerPack.contract.UnpackLog(event, "Transfer", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// StickerTypeABI is the input ABI used to generate the binding from. +const StickerTypeABI = "[{\"constant\":false,\"inputs\":[{\"name\":\"_packId\",\"type\":\"uint256\"},{\"name\":\"_limit\",\"type\":\"uint256\"}],\"name\":\"purgePack\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"getApproved\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"to\",\"type\":\"address\"},{\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"from\",\"type\":\"address\"},{\"name\":\"to\",\"type\":\"address\"},{\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"owner\",\"type\":\"address\"},{\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"tokenOfOwnerByIndex\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_newController\",\"type\":\"address\"}],\"name\":\"changeController\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"from\",\"type\":\"address\"},{\"name\":\"to\",\"type\":\"address\"},{\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"safeTransferFrom\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_price\",\"type\":\"uint256\"},{\"name\":\"_donate\",\"type\":\"uint256\"},{\"name\":\"_category\",\"type\":\"bytes4[]\"},{\"name\":\"_owner\",\"type\":\"address\"},{\"name\":\"_contenthash\",\"type\":\"bytes\"}],\"name\":\"generatePack\",\"outputs\":[{\"name\":\"packId\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"tokenByIndex\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"packCount\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"ownerOf\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_packId\",\"type\":\"uint256\"},{\"name\":\"_contenthash\",\"type\":\"bytes\"}],\"name\":\"setPackContenthash\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_packId\",\"type\":\"uint256\"}],\"name\":\"getPackSummary\",\"outputs\":[{\"name\":\"category\",\"type\":\"bytes4[]\"},{\"name\":\"timestamp\",\"type\":\"uint256\"},{\"name\":\"contenthash\",\"type\":\"bytes\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_packId\",\"type\":\"uint256\"},{\"name\":\"_price\",\"type\":\"uint256\"},{\"name\":\"_donate\",\"type\":\"uint256\"}],\"name\":\"setPackPrice\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"symbol\",\"outputs\":[{\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_packId\",\"type\":\"uint256\"}],\"name\":\"getPaymentData\",\"outputs\":[{\"name\":\"owner\",\"type\":\"address\"},{\"name\":\"mintable\",\"type\":\"bool\"},{\"name\":\"price\",\"type\":\"uint256\"},{\"name\":\"donate\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_category\",\"type\":\"bytes4\"}],\"name\":\"getCategoryLength\",\"outputs\":[{\"name\":\"size\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"to\",\"type\":\"address\"},{\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"setApprovalForAll\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_packId\",\"type\":\"uint256\"},{\"name\":\"_category\",\"type\":\"bytes4\"}],\"name\":\"addPackCategory\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_category\",\"type\":\"bytes4\"}],\"name\":\"getAvailablePacks\",\"outputs\":[{\"name\":\"availableIds\",\"type\":\"uint256[]\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_category\",\"type\":\"bytes4\"},{\"name\":\"_index\",\"type\":\"uint256\"}],\"name\":\"getCategoryPack\",\"outputs\":[{\"name\":\"packId\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_packId\",\"type\":\"uint256\"},{\"name\":\"_mintable\",\"type\":\"bool\"}],\"name\":\"setPackState\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"packs\",\"outputs\":[{\"name\":\"mintable\",\"type\":\"bool\"},{\"name\":\"timestamp\",\"type\":\"uint256\"},{\"name\":\"price\",\"type\":\"uint256\"},{\"name\":\"donate\",\"type\":\"uint256\"},{\"name\":\"contenthash\",\"type\":\"bytes\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"from\",\"type\":\"address\"},{\"name\":\"to\",\"type\":\"address\"},{\"name\":\"tokenId\",\"type\":\"uint256\"},{\"name\":\"_data\",\"type\":\"bytes\"}],\"name\":\"safeTransferFrom\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"tokenURI\",\"outputs\":[{\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_packId\",\"type\":\"uint256\"}],\"name\":\"getPackData\",\"outputs\":[{\"name\":\"category\",\"type\":\"bytes4[]\"},{\"name\":\"owner\",\"type\":\"address\"},{\"name\":\"mintable\",\"type\":\"bool\"},{\"name\":\"timestamp\",\"type\":\"uint256\"},{\"name\":\"price\",\"type\":\"uint256\"},{\"name\":\"contenthash\",\"type\":\"bytes\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_token\",\"type\":\"address\"}],\"name\":\"claimTokens\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_packId\",\"type\":\"uint256\"},{\"name\":\"_category\",\"type\":\"bytes4\"}],\"name\":\"removePackCategory\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"owner\",\"type\":\"address\"},{\"name\":\"operator\",\"type\":\"address\"}],\"name\":\"isApprovedForAll\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"controller\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"packId\",\"type\":\"uint256\"},{\"indexed\":false,\"name\":\"dataPrice\",\"type\":\"uint256\"},{\"indexed\":false,\"name\":\"contenthash\",\"type\":\"bytes\"},{\"indexed\":false,\"name\":\"mintable\",\"type\":\"bool\"}],\"name\":\"Register\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"packId\",\"type\":\"uint256\"},{\"indexed\":false,\"name\":\"dataPrice\",\"type\":\"uint256\"}],\"name\":\"PriceChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"packId\",\"type\":\"uint256\"},{\"indexed\":false,\"name\":\"mintable\",\"type\":\"bool\"}],\"name\":\"MintabilityChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"packid\",\"type\":\"uint256\"},{\"indexed\":false,\"name\":\"contenthash\",\"type\":\"bytes\"}],\"name\":\"ContenthashChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"category\",\"type\":\"bytes4\"},{\"indexed\":true,\"name\":\"packId\",\"type\":\"uint256\"}],\"name\":\"Categorized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"category\",\"type\":\"bytes4\"},{\"indexed\":true,\"name\":\"packId\",\"type\":\"uint256\"}],\"name\":\"Uncategorized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"packId\",\"type\":\"uint256\"}],\"name\":\"Unregister\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"to\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"approved\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"ApprovalForAll\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"_token\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"_controller\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"ClaimedTokens\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"controller\",\"type\":\"address\"}],\"name\":\"NewController\",\"type\":\"event\"}]" + +// StickerTypeFuncSigs maps the 4-byte function signature to its string representation. +var StickerTypeFuncSigs = map[string]string{ + "aeeaf3da": "addPackCategory(uint256,bytes4)", + "095ea7b3": "approve(address,uint256)", + "70a08231": "balanceOf(address)", + "3cebb823": "changeController(address)", + "df8de3e7": "claimTokens(address)", + "f77c4791": "controller()", + "4c06dc17": "generatePack(uint256,uint256,bytes4[],address,bytes)", + "081812fc": "getApproved(uint256)", + "b34b5825": "getAvailablePacks(bytes4)", + "9f9a9b63": "getCategoryLength(bytes4)", + "b5420d68": "getCategoryPack(bytes4,uint256)", + "d2bf36c0": "getPackData(uint256)", + "81ec792d": "getPackSummary(uint256)", + "9c3a39a2": "getPaymentData(uint256)", + "e985e9c5": "isApprovedForAll(address,address)", + "06fdde03": "name()", + "6352211e": "ownerOf(uint256)", + "61bd6725": "packCount()", + "b84c1392": "packs(uint256)", + "00b3c91b": "purgePack(uint256,uint256)", + "e8bb7143": "removePackCategory(uint256,bytes4)", + "42842e0e": "safeTransferFrom(address,address,uint256)", + "b88d4fde": "safeTransferFrom(address,address,uint256,bytes)", + "a22cb465": "setApprovalForAll(address,bool)", + "6a847981": "setPackContenthash(uint256,bytes)", + "9389c5b5": "setPackPrice(uint256,uint256,uint256)", + "b7f48211": "setPackState(uint256,bool)", + "01ffc9a7": "supportsInterface(bytes4)", + "95d89b41": "symbol()", + "4f6ccce7": "tokenByIndex(uint256)", + "2f745c59": "tokenOfOwnerByIndex(address,uint256)", + "c87b56dd": "tokenURI(uint256)", + "18160ddd": "totalSupply()", + "23b872dd": "transferFrom(address,address,uint256)", +} + +// StickerTypeBin is the compiled bytecode used for deploying new contracts. +var StickerTypeBin = "0x601e60809081527f53746174757320537469636b6572205061636b20417574686f7273686970000060a052610100604052600460c09081527f53544b410000000000000000000000000000000000000000000000000000000060e052600080546001600160a01b031916331790558181620000a37f01ffc9a7000000000000000000000000000000000000000000000000000000006001600160e01b036200017516565b620000d77f80ac58cd000000000000000000000000000000000000000000000000000000006001600160e01b036200017516565b6200010b7f780e9d63000000000000000000000000000000000000000000000000000000006001600160e01b036200017516565b81516200012090600a90602085019062000247565b5080516200013690600b90602084019062000247565b506200016b7f5b5e139f000000000000000000000000000000000000000000000000000000006001600160e01b036200017516565b50505050620002ec565b7fffffffff0000000000000000000000000000000000000000000000000000000080821614156200020757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f4552433136353a20696e76616c696420696e7465726661636520696400000000604482015290519081900360640190fd5b7fffffffff00000000000000000000000000000000000000000000000000000000166000908152600160208190526040909120805460ff19169091179055565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106200028a57805160ff1916838001178555620002ba565b82800160010185558215620002ba579182015b82811115620002ba5782518255916020019190600101906200029d565b50620002c8929150620002cc565b5090565b620002e991905b80821115620002c85760008155600101620002d3565b90565b61366080620002fc6000396000f3fe608060405234801561001057600080fd5b50600436106102055760003560e01c80639389c5b51161011a578063b7f48211116100ad578063d2bf36c01161007c578063d2bf36c014610a18578063df8de3e714610b24578063e8bb714314610b4a578063e985e9c514610b77578063f77c479114610ba557610205565b8063b7f482111461085d578063b84c139214610882578063b88d4fde14610937578063c87b56dd146109fb57610205565b8063a22cb465116100e9578063a22cb4651461075e578063aeeaf3da1461078c578063b34b5825146107b9578063b5420d681461083057610205565b80639389c5b5146106b957806395d89b41146106e25780639c3a39a2146106ea5780639f9a9b631461073757610205565b80633cebb8231161019d57806361bd67251161016c57806361bd6725146105185780636352211e146105205780636a8479811461053d57806370a08231146105b257806381ec792d146105d857610205565b80633cebb823146103c857806342842e0e146103ee5780634c06dc17146104245780634f6ccce7146104fb57610205565b8063095ea7b3116101d9578063095ea7b31461032057806318160ddd1461034c57806323b872dd146103665780632f745c591461039c57610205565b8062b3c91b1461020a57806301ffc9a71461022f57806306fdde031461026a578063081812fc146102e7575b600080fd5b61022d6004803603604081101561022057600080fd5b5080359060200135610bad565b005b6102566004803603602081101561024557600080fd5b50356001600160e01b031916610dc1565b604080519115158252519081900360200190f35b610272610de0565b6040805160208082528351818301528351919283929083019185019080838360005b838110156102ac578181015183820152602001610294565b50505050905090810190601f1680156102d95780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610304600480360360208110156102fd57600080fd5b5035610e77565b604080516001600160a01b039092168252519081900360200190f35b61022d6004803603604081101561033657600080fd5b506001600160a01b038135169060200135610ed9565b610354610fea565b60408051918252519081900360200190f35b61022d6004803603606081101561037c57600080fd5b506001600160a01b03813581169160208101359091169060400135610ff0565b610354600480360360408110156103b257600080fd5b506001600160a01b038135169060200135611045565b61022d600480360360208110156103de57600080fd5b50356001600160a01b03166110c4565b61022d6004803603606081101561040457600080fd5b506001600160a01b03813581169160208101359091169060400135611166565b610354600480360360a081101561043a57600080fd5b813591602081013591810190606081016040820135600160201b81111561046057600080fd5b82018360208201111561047257600080fd5b803590602001918460208302840111600160201b8311171561049357600080fd5b919390926001600160a01b0383351692604081019060200135600160201b8111156104bd57600080fd5b8201836020820111156104cf57600080fd5b803590602001918460018302840111600160201b831117156104f057600080fd5b509092509050611181565b6103546004803603602081101561051157600080fd5b50356113ca565b610354611430565b6103046004803603602081101561053657600080fd5b5035611436565b61022d6004803603604081101561055357600080fd5b81359190810190604081016020820135600160201b81111561057457600080fd5b82018360208201111561058657600080fd5b803590602001918460018302840111600160201b831117156105a757600080fd5b509092509050611490565b610354600480360360208110156105c857600080fd5b50356001600160a01b0316611561565b6105f5600480360360208110156105ee57600080fd5b50356115c9565b604051808060200184815260200180602001838103835286818151815260200191508051906020019060200280838360005b8381101561063f578181015183820152602001610627565b50505050905001838103825284818151815260200191508051906020019080838360005b8381101561067b578181015183820152602001610663565b50505050905090810190601f1680156106a85780820380516001836020036101000a031916815260200191505b509550505050505060405180910390f35b61022d600480360360608110156106cf57600080fd5b5080359060208101359060400135611750565b610272611868565b6107076004803603602081101561070057600080fd5b50356118c9565b604080516001600160a01b0390951685529215156020850152838301919091526060830152519081900360800190f35b6103546004803603602081101561074d57600080fd5b50356001600160e01b031916611a5e565b61022d6004803603604081101561077457600080fd5b506001600160a01b0381351690602001351515611a7a565b61022d600480360360408110156107a257600080fd5b50803590602001356001600160e01b031916611b46565b6107e0600480360360208110156107cf57600080fd5b50356001600160e01b031916611bd2565b60408051602080825283518183015283519192839290830191858101910280838360005b8381101561081c578181015183820152602001610804565b505050509050019250505060405180910390f35b6103546004803603604081101561084657600080fd5b506001600160e01b03198135169060200135611c3f565b61022d6004803603604081101561087357600080fd5b50803590602001351515611c64565b61089f6004803603602081101561089857600080fd5b5035611d43565b604051808615151515815260200185815260200184815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b838110156108f85781810151838201526020016108e0565b50505050905090810190601f1680156109255780820380516001836020036101000a031916815260200191505b50965050505050505060405180910390f35b61022d6004803603608081101561094d57600080fd5b6001600160a01b03823581169260208101359091169160408201359190810190608081016060820135600160201b81111561098757600080fd5b82018360208201111561099957600080fd5b803590602001918460018302840111600160201b831117156109ba57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550611e04945050505050565b61027260048036036020811015610a1157600080fd5b5035611e56565b610a3560048036036020811015610a2e57600080fd5b5035611f31565b6040518080602001876001600160a01b03166001600160a01b031681526020018615151515815260200185815260200184815260200180602001838103835289818151815260200191508051906020019060200280838360005b83811015610aa7578181015183820152602001610a8f565b50505050905001838103825284818151815260200191508051906020019080838360005b83811015610ae3578181015183820152602001610acb565b50505050905090810190601f168015610b105780820380516001836020036101000a031916815260200191505b509850505050505050505060405180910390f35b61022d60048036036020811015610b3a57600080fd5b50356001600160a01b03166120d9565b61022d60048036036040811015610b6057600080fd5b50803590602001356001600160e01b031916612141565b61025660048036036040811015610b8d57600080fd5b506001600160a01b03813581169160200135166121cd565b6103046121fb565b6000546001600160a01b03163314610bfb576040805162461bcd60e51b815260206004820152600c60248201526b155b985d5d1a1bdc9a5e995960a21b604482015290519081900360640190fd5b6000828152600f6020908152604091829020805483518184028101840190945280845260609392830182828015610c7e57602002820191906000526020600020906000905b82829054906101000a900460e01b6001600160e01b03191681526020019060040190602082600301049283019260010382029150808411610c405790505b5050505050905060008260001415610c9857508051610cdd565b8151831115610cda576040805162461bcd60e51b8152602060048201526009602482015268109859081b1a5b5a5d60ba1b604482015290519081900360640190fd5b50815b81518015610cea57600019015b60005b82811015610d1c57610d14868583850381518110610d0757fe5b602002602001015161220a565b600101610ced565b506000858152600f6020526040902054610dba57610d42610d3c86611436565b8661253a565b6000858152600f6020526040812090610d5b82826130d7565b60018201805460ff191690556000600283018190556003830181905560048301819055610d8c9060058401906130fc565b505060405185907f98f986773731debbbf041b73d7edaec62da3ff42b2116c45cd0001fb40ed908690600090a25b5050505050565b6001600160e01b03191660009081526001602052604090205460ff1690565b600a8054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610e6c5780601f10610e4157610100808354040283529160200191610e6c565b820191906000526020600020905b815481529060010190602001808311610e4f57829003601f168201915b505050505090505b90565b6000610e8282612586565b610ebd5760405162461bcd60e51b815260040180806020018281038252602c815260200180613505602c913960400191505060405180910390fd5b506000908152600360205260409020546001600160a01b031690565b6000610ee482611436565b9050806001600160a01b0316836001600160a01b03161415610f375760405162461bcd60e51b81526004018080602001828103825260218152602001806135896021913960400191505060405180910390fd5b336001600160a01b0382161480610f535750610f5381336121cd565b610f8e5760405162461bcd60e51b815260040180806020018281038252603881526020018061347a6038913960400191505060405180910390fd5b60008281526003602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b60085490565b610ffa33826125a3565b6110355760405162461bcd60e51b81526004018080602001828103825260318152602001806135aa6031913960400191505060405180910390fd5b611040838383612647565b505050565b600061105083611561565b821061108d5760405162461bcd60e51b815260040180806020018281038252602b81526020018061339c602b913960400191505060405180910390fd5b6001600160a01b03831660009081526006602052604090208054839081106110b157fe5b9060005260206000200154905092915050565b6000546001600160a01b03163314611112576040805162461bcd60e51b815260206004820152600c60248201526b155b985d5d1a1bdc9a5e995960a21b604482015290519081900360640190fd5b600080546001600160a01b0383166001600160a01b0319909116811790915560408051918252517fe253457d9ad994ca9682fc3bbc38c890dca73a2d5ecee3809e548bac8b00d7c69181900360200190a150565b61104083838360405180602001604052806000815250611e04565b600080546001600160a01b031633146111d0576040805162461bcd60e51b815260206004820152600c60248201526b155b985d5d1a1bdc9a5e995960a21b604482015290519081900360640190fd5b6127108711156112115760405162461bcd60e51b81526004018080602001828103825260318152602001806133f96031913960400191505060405180910390fd5b5060108054600181019091556112278482612666565b60408051600060c0820181815260e083019093529091829150815260200160011515815260200142815260200189815260200188815260200184848080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920182905250939094525050838152600f60209081526040909120835180519193506112bc928492910190613140565b5060208281015160018301805460ff191691151591909117905560408301516002830155606083015160038301556080830151600483015560a0830151805161130b92600585019201906131ec565b50905050807f8304dd8a0ecd1927e64564792f1147f0aca02ba211e48c2981bf7244a987797589858560016040518085815260200180602001831515151581526020018281038252858582818152602001925080828437600083820152604051601f909101601f191690920182900397509095505050505050a260005b858110156113be576113b6828888848181106113a057fe5b905060200201356001600160e01b031916612683565b600101611388565b50979650505050505050565b60006113d4610fea565b82106114115760405162461bcd60e51b815260040180806020018281038252602c8152602001806135db602c913960400191505060405180910390fd5b6008828154811061141e57fe5b90600052602060002001549050919050565b60105481565b6000818152600260205260408120546001600160a01b03168061148a5760405162461bcd60e51b81526004018080602001828103825260298152602001806134dc6029913960400191505060405180910390fd5b92915050565b6000546001600160a01b031633146114de576040805162461bcd60e51b815260206004820152600c60248201526b155b985d5d1a1bdc9a5e995960a21b604482015290519081900360640190fd5b827f6fd3fdff55b0feb6f24c338494b36929368cd564825688c741d54b8d7fa7beb9838360405180806020018281038252848482818152602001925080828437600083820152604051601f909101601f19169092018290039550909350505050a26000838152600f6020526040902061155b906005018383613266565b50505050565b60006001600160a01b0382166115a85760405162461bcd60e51b815260040180806020018281038252602a8152602001806134b2602a913960400191505060405180910390fd5b6001600160a01b038216600090815260046020526040902061148a906127c5565b6060600060606115d76132d4565b6000858152600f60209081526040918290208251815460e09381028201840190945260c08101848152909391928492849184018282801561166457602002820191906000526020600020906000905b82829054906101000a900460e01b6001600160e01b031916815260200190600401906020826003010492830192600103820291508084116116265790505b505050918352505060018281015460ff161515602080840191909152600280850154604080860191909152600386015460608601526004860154608086015260058601805482516101009682161596909602600019011692909204601f810184900484028501840190915280845260a090940193909183018282801561172b5780601f106117005761010080835404028352916020019161172b565b820191906000526020600020905b81548152906001019060200180831161170e57829003601f168201915b5050509190925250508151604083015160a09093015190989297509550909350505050565b82600061175c82611436565b9050336001600160a01b038216148061179257506001600160a01b0381161580159061179257506000546001600160a01b031633145b6117d2576040805162461bcd60e51b815260206004820152600c60248201526b155b985d5d1a1bdc9a5e995960a21b604482015290519081900360640190fd5b6127108311156118135760405162461bcd60e51b81526004018080602001828103825260318152602001806133f96031913960400191505060405180910390fd5b60408051858152905186917f8aa4fa52648a6d15edce8a179c792c86f3719d0cc3c572cf90f91948f0f2cb68919081900360200190a250506000928352600f6020526040909220600381019190915560040155565b600b8054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610e6c5780601f10610e4157610100808354040283529160200191610e6c565b6000806000806118d76132d4565b6000868152600f60209081526040918290208251815460e09381028201840190945260c08101848152909391928492849184018282801561196457602002820191906000526020600020906000905b82829054906101000a900460e01b6001600160e01b031916815260200190600401906020826003010492830192600103820291508084116119265790505b505050918352505060018281015460ff161515602080840191909152600280850154604080860191909152600386015460608601526004860154608086015260058601805482516101009682161596909602600019011692909204601f810184900484028501840190915280845260a0909401939091830182828015611a2b5780601f10611a0057610100808354040283529160200191611a2b565b820191906000526020600020905b815481529060010190602001808311611a0e57829003601f168201915b5050505050815250509050611a3f86611436565b8160200151826060015183608001519450945094509450509193509193565b6001600160e01b03191660009081526011602052604090205490565b6001600160a01b038216331415611ad8576040805162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c657200000000000000604482015290519081900360640190fd5b3360008181526005602090815260408083206001600160a01b03871680855290835292819020805460ff1916861515908117909155815190815290519293927f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31929181900390910190a35050565b816000611b5282611436565b9050336001600160a01b0382161480611b8857506001600160a01b03811615801590611b8857506000546001600160a01b031633145b611bc8576040805162461bcd60e51b815260206004820152600c60248201526b155b985d5d1a1bdc9a5e995960a21b604482015290519081900360640190fd5b61155b8484612683565b6001600160e01b03198116600090815260116020908152604091829020805483518184028101840190945280845260609392830182828015611c3357602002820191906000526020600020905b815481526020019060010190808311611c1f575b50505050509050919050565b6001600160e01b0319821660009081526011602052604081208054839081106110b157fe5b816000611c7082611436565b9050336001600160a01b0382161480611ca657506001600160a01b03811615801590611ca657506000546001600160a01b031633145b611ce6576040805162461bcd60e51b815260206004820152600c60248201526b155b985d5d1a1bdc9a5e995960a21b604482015290519081900360640190fd5b604080518415158152905185917f7a5b9103727f29409c14d2581e9710a1648b1354e667e1c803d4bda045159660919081900360200190a250506000918252600f6020526040909120600101805460ff1916911515919091179055565b600f60209081526000918252604091829020600180820154600280840154600385015460048601546005870180548a516101009882161598909802600019011694909404601f810189900489028701890190995288865260ff90941697919690959394929190830182828015611dfa5780601f10611dcf57610100808354040283529160200191611dfa565b820191906000526020600020905b815481529060010190602001808311611ddd57829003601f168201915b5050505050905085565b611e0f848484610ff0565b611e1b848484846127c9565b61155b5760405162461bcd60e51b81526004018080602001828103825260328152602001806133c76032913960400191505060405180910390fd5b6060611e6182612586565b611e9c5760405162461bcd60e51b815260040180806020018281038252602f81526020018061355a602f913960400191505060405180910390fd5b6000828152600c602090815260409182902080548351601f600260001961010060018616150201909316929092049182018490048402810184019094528084529091830182828015611c335780601f10611f0457610100808354040283529160200191611c33565b820191906000526020600020905b815481529060010190602001808311611f125750939695505050505050565b60606000806000806060611f436132d4565b6000888152600f60209081526040918290208251815460e09381028201840190945260c081018481529093919284928491840182828015611fd057602002820191906000526020600020906000905b82829054906101000a900460e01b6001600160e01b03191681526020019060040190602082600301049283019260010382029150808411611f925790505b505050918352505060018281015460ff161515602080840191909152600280850154604080860191909152600386015460608601526004860154608086015260058601805482516101009682161596909602600019011692909204601f810184900484028501840190915280845260a09094019390918301828280156120975780601f1061206c57610100808354040283529160200191612097565b820191906000526020600020905b81548152906001019060200180831161207a57829003601f168201915b505050505081525050905080600001516120b089611436565b60208301516040840151606085015160a090950151939c929b5090995097509195509350915050565b6000546001600160a01b03163314612127576040805162461bcd60e51b815260206004820152600c60248201526b155b985d5d1a1bdc9a5e995960a21b604482015290519081900360640190fd5b60005461213e9082906001600160a01b03166128fc565b50565b81600061214d82611436565b9050336001600160a01b038216148061218357506001600160a01b0381161580159061218357506000546001600160a01b031633145b6121c3576040805162461bcd60e51b815260206004820152600c60248201526b155b985d5d1a1bdc9a5e995960a21b604482015290519081900360640190fd5b61155b848461220a565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b6000546001600160a01b031681565b6001600160e01b03198116600090815260126020908152604080832085845290915290205480612277576040805162461bcd60e51b81526020600482015260136024820152724e6f742063617465676f72697a6564205b315d60681b604482015290519081900360640190fd5b6001600160e01b0319821660008181526012602090815260408083208784528252808320839055928252601190522054811461234c576001600160e01b031982166000908152601160205260408120805460001981019081106122d657fe5b906000526020600020015490508060116000856001600160e01b0319166001600160e01b0319168152602001908152602001600020600184038154811061231957fe5b60009182526020808320909101929092556001600160e01b03198516815260128252604080822093825292909152208190555b6001600160e01b03198216600090815260116020526040902080549061237690600019830161330c565b5060008381526013602090815260408083206001600160e01b031986168452909152902054806123e3576040805162461bcd60e51b81526020600482015260136024820152724e6f742063617465676f72697a6564205b325d60681b604482015290519081900360640190fd5b60008481526013602090815260408083206001600160e01b0319871684528252808320839055868352600f90915290205481146124dd576000848152600f602052604081208054600019810190811061243857fe5b90600052602060002090600891828204019190066004029054906101000a900460e01b905080600f6000878152602001908152602001600020600001600184038154811061248257fe5b600091825260208083206008830401805463ffffffff60079094166004026101000a938402191660e09590951c929092029390931790558681526013825260408082206001600160e01b031994909416825292909152208190555b6000848152600f602052604090208054906124fc906000198301613330565b5060405184906001600160e01b03198516907f9574a9d09dc883e69228a0eea15ed4da6e520b13cc84cca994c1787c234d78fe90600090a350505050565b6125448282612a95565b6000818152600c60205260409020546002600019610100600184161502019091160415612582576000818152600c60205260408120612582916130fc565b5050565b6000908152600260205260409020546001600160a01b0316151590565b60006125ae82612586565b6125e95760405162461bcd60e51b815260040180806020018281038252602c81526020018061344e602c913960400191505060405180910390fd5b60006125f483611436565b9050806001600160a01b0316846001600160a01b0316148061262f5750836001600160a01b031661262484610e77565b6001600160a01b0316145b8061263f575061263f81856121cd565b949350505050565b612652838383612ac1565b61265c8382612c05565b6110408282612cf3565b6126708282612d31565b61267a8282612cf3565b61258281612e62565b60008281526013602090815260408083206001600160e01b031985168452909152902054156126f9576040805162461bcd60e51b815260206004820152601860248201527f4475706c69636174652063617465676f72697a6174696f6e0000000000000000604482015290519081900360640190fd5b6001600160e01b0319811660008181526011602090815260408083208054600180820180845592865284862090910188905585855260128452828520888652845282852091909155600f835281842080549182018082559085528385206008830401805463ffffffff60079094166004026101000a938402191660e089901c93909302929092179091558684526013835281842085855290925280832091909155518492917f74186c4c4ee368ea5564982241efb7357014b52d6e195d026bc4fdfaa112691b91a35050565b5490565b60006127dd846001600160a01b0316612ea6565b6127e95750600161263f565b604051630a85bd0160e11b815233600482018181526001600160a01b03888116602485015260448401879052608060648501908152865160848601528651600095928a169463150b7a029490938c938b938b939260a4019060208501908083838e5b8381101561286357818101518382015260200161284b565b50505050905090810190601f1680156128905780820380516001836020036101000a031916815260200191505b5095505050505050602060405180830381600087803b1580156128b257600080fd5b505af11580156128c6573d6000803e3d6000fd5b505050506040513d60208110156128dc57600080fd5b50516001600160e01b031916630a85bd0160e11b14915050949350505050565b60006001600160a01b03831661294c57506040513031906001600160a01b0383169082156108fc029083906000818181858888f19350505050158015612946573d6000803e3d6000fd5b50612a45565b604080516370a0823160e01b8152306004820152905184916001600160a01b038316916370a0823191602480820192602092909190829003018186803b15801561299557600080fd5b505afa1580156129a9573d6000803e3d6000fd5b505050506040513d60208110156129bf57600080fd5b50516040805163a9059cbb60e01b81526001600160a01b0386811660048301526024820184905291519294509083169163a9059cbb916044808201926020929091908290030181600087803b158015612a1757600080fd5b505af1158015612a2b573d6000803e3d6000fd5b505050506040513d6020811015612a4157600080fd5b5050505b816001600160a01b0316836001600160a01b03167ff931edb47c50b4b4104c187b5814a9aef5f709e17e2ecf9617e860cacade929c836040518082815260200191505060405180910390a3505050565b612a9f8282612eac565b612aa98282612c05565b60008181526007602052604081205561258281612f83565b826001600160a01b0316612ad482611436565b6001600160a01b031614612b195760405162461bcd60e51b81526004018080602001828103825260298152602001806135316029913960400191505060405180910390fd5b6001600160a01b038216612b5e5760405162461bcd60e51b815260040180806020018281038252602481526020018061342a6024913960400191505060405180910390fd5b612b678161301f565b6001600160a01b0383166000908152600460205260409020612b889061305a565b6001600160a01b0382166000908152600460205260409020612ba990613071565b60008181526002602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b6001600160a01b038216600090815260066020526040812054612c2f90600163ffffffff61307a16565b600083815260076020526040902054909150808214612cca576001600160a01b0384166000908152600660205260408120805484908110612c6c57fe5b906000526020600020015490508060066000876001600160a01b03166001600160a01b031681526020019081526020016000208381548110612caa57fe5b600091825260208083209091019290925591825260079052604090208190555b6001600160a01b0384166000908152600660205260409020805490610dba90600019830161330c565b6001600160a01b0390911660009081526006602081815260408084208054868652600784529185208290559282526001810183559183529091200155565b6001600160a01b038216612d8c576040805162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f2061646472657373604482015290519081900360640190fd5b612d9581612586565b15612de7576040805162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604482015290519081900360640190fd5b600081815260026020908152604080832080546001600160a01b0319166001600160a01b038716908117909155835260049091529020612e2690613071565b60405181906001600160a01b038416906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b600880546000838152600960205260408120829055600182018355919091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30155565b3b151590565b816001600160a01b0316612ebf82611436565b6001600160a01b031614612f045760405162461bcd60e51b81526004018080602001828103825260258152602001806136076025913960400191505060405180910390fd5b612f0d8161301f565b6001600160a01b0382166000908152600460205260409020612f2e9061305a565b60008181526002602052604080822080546001600160a01b0319169055518291906001600160a01b038516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b600854600090612f9a90600163ffffffff61307a16565b60008381526009602052604081205460088054939450909284908110612fbc57fe5b906000526020600020015490508060088381548110612fd757fe5b6000918252602080832090910192909255828152600990915260409020829055600880549061300a90600019830161330c565b50505060009182525060096020526040812055565b6000818152600360205260409020546001600160a01b03161561213e57600090815260036020526040902080546001600160a01b0319169055565b805461306d90600163ffffffff61307a16565b9055565b80546001019055565b6000828211156130d1576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b50805460008255600701600890049060005260206000209081019061213e9190613360565b50805460018160011615610100020316600290046000825580601f10613122575061213e565b601f01602090049060005260206000209081019061213e9190613360565b828054828255906000526020600020906007016008900481019282156131dc5791602002820160005b838211156131aa57835183826101000a81548163ffffffff021916908360e01c02179055509260200192600401602081600301049283019260010302613169565b80156131da5782816101000a81549063ffffffff02191690556004016020816003010492830192600103026131aa565b505b506131e892915061337a565b5090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061322d57805160ff191683800117855561325a565b8280016001018555821561325a579182015b8281111561325a57825182559160200191906001019061323f565b506131e8929150613360565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106132a75782800160ff1982351617855561325a565b8280016001018555821561325a579182015b8281111561325a5782358255916020019190600101906132b9565b6040518060c0016040528060608152602001600015158152602001600081526020016000815260200160008152602001606081525090565b81548183558181111561104057600083815260209020611040918101908301613360565b81548183558181111561104057600701600890048160070160089004836000526020600020918201910161104091905b610e7491905b808211156131e85760008155600101613366565b610e7491905b808211156131e857805463ffffffff1916815560010161338056fe455243373231456e756d657261626c653a206f776e657220696e646578206f7574206f6620626f756e64734552433732313a207472616e7366657220746f206e6f6e20455243373231526563656976657220696d706c656d656e74657242616420617267756d656e742c205f646f6e6174652063616e6e6f74206265206d6f7265207468656e203130302e3030254552433732313a207472616e7366657220746f20746865207a65726f20616464726573734552433732313a206f70657261746f7220717565727920666f72206e6f6e6578697374656e7420746f6b656e4552433732313a20617070726f76652063616c6c6572206973206e6f74206f776e6572206e6f7220617070726f76656420666f7220616c6c4552433732313a2062616c616e636520717565727920666f7220746865207a65726f20616464726573734552433732313a206f776e657220717565727920666f72206e6f6e6578697374656e7420746f6b656e4552433732313a20617070726f76656420717565727920666f72206e6f6e6578697374656e7420746f6b656e4552433732313a207472616e73666572206f6620746f6b656e2074686174206973206e6f74206f776e4552433732314d657461646174613a2055524920717565727920666f72206e6f6e6578697374656e7420746f6b656e4552433732313a20617070726f76616c20746f2063757272656e74206f776e65724552433732313a207472616e736665722063616c6c6572206973206e6f74206f776e6572206e6f7220617070726f766564455243373231456e756d657261626c653a20676c6f62616c20696e646578206f7574206f6620626f756e64734552433732313a206275726e206f6620746f6b656e2074686174206973206e6f74206f776ea265627a7a72305820d13e91ff273089853480a46eb09bcff742389c8cbc4ade7f572b734eac6741bc64736f6c634300050a0032" + +// DeployStickerType deploys a new Ethereum contract, binding an instance of StickerType to it. +func DeployStickerType(auth *bind.TransactOpts, backend bind.ContractBackend) (common.Address, *types.Transaction, *StickerType, error) { + parsed, err := abi.JSON(strings.NewReader(StickerTypeABI)) + if err != nil { + return common.Address{}, nil, nil, err + } + + address, tx, contract, err := bind.DeployContract(auth, parsed, common.FromHex(StickerTypeBin), backend) + if err != nil { + return common.Address{}, nil, nil, err + } + return address, tx, &StickerType{StickerTypeCaller: StickerTypeCaller{contract: contract}, StickerTypeTransactor: StickerTypeTransactor{contract: contract}, StickerTypeFilterer: StickerTypeFilterer{contract: contract}}, nil +} + +// StickerType is an auto generated Go binding around an Ethereum contract. +type StickerType struct { + StickerTypeCaller // Read-only binding to the contract + StickerTypeTransactor // Write-only binding to the contract + StickerTypeFilterer // Log filterer for contract events +} + +// StickerTypeCaller is an auto generated read-only Go binding around an Ethereum contract. +type StickerTypeCaller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// StickerTypeTransactor is an auto generated write-only Go binding around an Ethereum contract. +type StickerTypeTransactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// StickerTypeFilterer is an auto generated log filtering Go binding around an Ethereum contract events. +type StickerTypeFilterer struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// StickerTypeSession is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type StickerTypeSession struct { + Contract *StickerType // 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 +} + +// StickerTypeCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type StickerTypeCallerSession struct { + Contract *StickerTypeCaller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// StickerTypeTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type StickerTypeTransactorSession struct { + Contract *StickerTypeTransactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// StickerTypeRaw is an auto generated low-level Go binding around an Ethereum contract. +type StickerTypeRaw struct { + Contract *StickerType // Generic contract binding to access the raw methods on +} + +// StickerTypeCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type StickerTypeCallerRaw struct { + Contract *StickerTypeCaller // Generic read-only contract binding to access the raw methods on +} + +// StickerTypeTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type StickerTypeTransactorRaw struct { + Contract *StickerTypeTransactor // Generic write-only contract binding to access the raw methods on +} + +// NewStickerType creates a new instance of StickerType, bound to a specific deployed contract. +func NewStickerType(address common.Address, backend bind.ContractBackend) (*StickerType, error) { + contract, err := bindStickerType(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &StickerType{StickerTypeCaller: StickerTypeCaller{contract: contract}, StickerTypeTransactor: StickerTypeTransactor{contract: contract}, StickerTypeFilterer: StickerTypeFilterer{contract: contract}}, nil +} + +// NewStickerTypeCaller creates a new read-only instance of StickerType, bound to a specific deployed contract. +func NewStickerTypeCaller(address common.Address, caller bind.ContractCaller) (*StickerTypeCaller, error) { + contract, err := bindStickerType(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &StickerTypeCaller{contract: contract}, nil +} + +// NewStickerTypeTransactor creates a new write-only instance of StickerType, bound to a specific deployed contract. +func NewStickerTypeTransactor(address common.Address, transactor bind.ContractTransactor) (*StickerTypeTransactor, error) { + contract, err := bindStickerType(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &StickerTypeTransactor{contract: contract}, nil +} + +// NewStickerTypeFilterer creates a new log filterer instance of StickerType, bound to a specific deployed contract. +func NewStickerTypeFilterer(address common.Address, filterer bind.ContractFilterer) (*StickerTypeFilterer, error) { + contract, err := bindStickerType(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &StickerTypeFilterer{contract: contract}, nil +} + +// bindStickerType binds a generic wrapper to an already deployed contract. +func bindStickerType(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := abi.JSON(strings.NewReader(StickerTypeABI)) + 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 (_StickerType *StickerTypeRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _StickerType.Contract.StickerTypeCaller.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 (_StickerType *StickerTypeRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _StickerType.Contract.StickerTypeTransactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_StickerType *StickerTypeRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _StickerType.Contract.StickerTypeTransactor.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 (_StickerType *StickerTypeCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _StickerType.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 (_StickerType *StickerTypeTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _StickerType.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_StickerType *StickerTypeTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _StickerType.Contract.contract.Transact(opts, method, params...) +} + +// BalanceOf is a free data retrieval call binding the contract method 0x70a08231. +// +// Solidity: function balanceOf(address owner) view returns(uint256) +func (_StickerType *StickerTypeCaller) BalanceOf(opts *bind.CallOpts, owner common.Address) (*big.Int, error) { + var out []interface{} + err := _StickerType.contract.Call(opts, &out, "balanceOf", owner) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// BalanceOf is a free data retrieval call binding the contract method 0x70a08231. +// +// Solidity: function balanceOf(address owner) view returns(uint256) +func (_StickerType *StickerTypeSession) BalanceOf(owner common.Address) (*big.Int, error) { + return _StickerType.Contract.BalanceOf(&_StickerType.CallOpts, owner) +} + +// BalanceOf is a free data retrieval call binding the contract method 0x70a08231. +// +// Solidity: function balanceOf(address owner) view returns(uint256) +func (_StickerType *StickerTypeCallerSession) BalanceOf(owner common.Address) (*big.Int, error) { + return _StickerType.Contract.BalanceOf(&_StickerType.CallOpts, owner) +} + +// Controller is a free data retrieval call binding the contract method 0xf77c4791. +// +// Solidity: function controller() view returns(address) +func (_StickerType *StickerTypeCaller) Controller(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _StickerType.contract.Call(opts, &out, "controller") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// Controller is a free data retrieval call binding the contract method 0xf77c4791. +// +// Solidity: function controller() view returns(address) +func (_StickerType *StickerTypeSession) Controller() (common.Address, error) { + return _StickerType.Contract.Controller(&_StickerType.CallOpts) +} + +// Controller is a free data retrieval call binding the contract method 0xf77c4791. +// +// Solidity: function controller() view returns(address) +func (_StickerType *StickerTypeCallerSession) Controller() (common.Address, error) { + return _StickerType.Contract.Controller(&_StickerType.CallOpts) +} + +// GetApproved is a free data retrieval call binding the contract method 0x081812fc. +// +// Solidity: function getApproved(uint256 tokenId) view returns(address) +func (_StickerType *StickerTypeCaller) GetApproved(opts *bind.CallOpts, tokenId *big.Int) (common.Address, error) { + var out []interface{} + err := _StickerType.contract.Call(opts, &out, "getApproved", tokenId) + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// GetApproved is a free data retrieval call binding the contract method 0x081812fc. +// +// Solidity: function getApproved(uint256 tokenId) view returns(address) +func (_StickerType *StickerTypeSession) GetApproved(tokenId *big.Int) (common.Address, error) { + return _StickerType.Contract.GetApproved(&_StickerType.CallOpts, tokenId) +} + +// GetApproved is a free data retrieval call binding the contract method 0x081812fc. +// +// Solidity: function getApproved(uint256 tokenId) view returns(address) +func (_StickerType *StickerTypeCallerSession) GetApproved(tokenId *big.Int) (common.Address, error) { + return _StickerType.Contract.GetApproved(&_StickerType.CallOpts, tokenId) +} + +// GetAvailablePacks is a free data retrieval call binding the contract method 0xb34b5825. +// +// Solidity: function getAvailablePacks(bytes4 _category) view returns(uint256[] availableIds) +func (_StickerType *StickerTypeCaller) GetAvailablePacks(opts *bind.CallOpts, _category [4]byte) ([]*big.Int, error) { + var out []interface{} + err := _StickerType.contract.Call(opts, &out, "getAvailablePacks", _category) + + if err != nil { + return *new([]*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new([]*big.Int)).(*[]*big.Int) + + return out0, err + +} + +// GetAvailablePacks is a free data retrieval call binding the contract method 0xb34b5825. +// +// Solidity: function getAvailablePacks(bytes4 _category) view returns(uint256[] availableIds) +func (_StickerType *StickerTypeSession) GetAvailablePacks(_category [4]byte) ([]*big.Int, error) { + return _StickerType.Contract.GetAvailablePacks(&_StickerType.CallOpts, _category) +} + +// GetAvailablePacks is a free data retrieval call binding the contract method 0xb34b5825. +// +// Solidity: function getAvailablePacks(bytes4 _category) view returns(uint256[] availableIds) +func (_StickerType *StickerTypeCallerSession) GetAvailablePacks(_category [4]byte) ([]*big.Int, error) { + return _StickerType.Contract.GetAvailablePacks(&_StickerType.CallOpts, _category) +} + +// GetCategoryLength is a free data retrieval call binding the contract method 0x9f9a9b63. +// +// Solidity: function getCategoryLength(bytes4 _category) view returns(uint256 size) +func (_StickerType *StickerTypeCaller) GetCategoryLength(opts *bind.CallOpts, _category [4]byte) (*big.Int, error) { + var out []interface{} + err := _StickerType.contract.Call(opts, &out, "getCategoryLength", _category) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// GetCategoryLength is a free data retrieval call binding the contract method 0x9f9a9b63. +// +// Solidity: function getCategoryLength(bytes4 _category) view returns(uint256 size) +func (_StickerType *StickerTypeSession) GetCategoryLength(_category [4]byte) (*big.Int, error) { + return _StickerType.Contract.GetCategoryLength(&_StickerType.CallOpts, _category) +} + +// GetCategoryLength is a free data retrieval call binding the contract method 0x9f9a9b63. +// +// Solidity: function getCategoryLength(bytes4 _category) view returns(uint256 size) +func (_StickerType *StickerTypeCallerSession) GetCategoryLength(_category [4]byte) (*big.Int, error) { + return _StickerType.Contract.GetCategoryLength(&_StickerType.CallOpts, _category) +} + +// GetCategoryPack is a free data retrieval call binding the contract method 0xb5420d68. +// +// Solidity: function getCategoryPack(bytes4 _category, uint256 _index) view returns(uint256 packId) +func (_StickerType *StickerTypeCaller) GetCategoryPack(opts *bind.CallOpts, _category [4]byte, _index *big.Int) (*big.Int, error) { + var out []interface{} + err := _StickerType.contract.Call(opts, &out, "getCategoryPack", _category, _index) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// GetCategoryPack is a free data retrieval call binding the contract method 0xb5420d68. +// +// Solidity: function getCategoryPack(bytes4 _category, uint256 _index) view returns(uint256 packId) +func (_StickerType *StickerTypeSession) GetCategoryPack(_category [4]byte, _index *big.Int) (*big.Int, error) { + return _StickerType.Contract.GetCategoryPack(&_StickerType.CallOpts, _category, _index) +} + +// GetCategoryPack is a free data retrieval call binding the contract method 0xb5420d68. +// +// Solidity: function getCategoryPack(bytes4 _category, uint256 _index) view returns(uint256 packId) +func (_StickerType *StickerTypeCallerSession) GetCategoryPack(_category [4]byte, _index *big.Int) (*big.Int, error) { + return _StickerType.Contract.GetCategoryPack(&_StickerType.CallOpts, _category, _index) +} + +// GetPackData is a free data retrieval call binding the contract method 0xd2bf36c0. +// +// Solidity: function getPackData(uint256 _packId) view returns(bytes4[] category, address owner, bool mintable, uint256 timestamp, uint256 price, bytes contenthash) +func (_StickerType *StickerTypeCaller) GetPackData(opts *bind.CallOpts, _packId *big.Int) (struct { + Category [][4]byte + Owner common.Address + Mintable bool + Timestamp *big.Int + Price *big.Int + Contenthash []byte +}, error) { + var out []interface{} + err := _StickerType.contract.Call(opts, &out, "getPackData", _packId) + + outstruct := new(struct { + Category [][4]byte + Owner common.Address + Mintable bool + Timestamp *big.Int + Price *big.Int + Contenthash []byte + }) + if err != nil { + return *outstruct, err + } + + outstruct.Category = *abi.ConvertType(out[0], new([][4]byte)).(*[][4]byte) + outstruct.Owner = *abi.ConvertType(out[1], new(common.Address)).(*common.Address) + outstruct.Mintable = *abi.ConvertType(out[2], new(bool)).(*bool) + outstruct.Timestamp = *abi.ConvertType(out[3], new(*big.Int)).(**big.Int) + outstruct.Price = *abi.ConvertType(out[4], new(*big.Int)).(**big.Int) + outstruct.Contenthash = *abi.ConvertType(out[5], new([]byte)).(*[]byte) + + return *outstruct, err + +} + +// GetPackData is a free data retrieval call binding the contract method 0xd2bf36c0. +// +// Solidity: function getPackData(uint256 _packId) view returns(bytes4[] category, address owner, bool mintable, uint256 timestamp, uint256 price, bytes contenthash) +func (_StickerType *StickerTypeSession) GetPackData(_packId *big.Int) (struct { + Category [][4]byte + Owner common.Address + Mintable bool + Timestamp *big.Int + Price *big.Int + Contenthash []byte +}, error) { + return _StickerType.Contract.GetPackData(&_StickerType.CallOpts, _packId) +} + +// GetPackData is a free data retrieval call binding the contract method 0xd2bf36c0. +// +// Solidity: function getPackData(uint256 _packId) view returns(bytes4[] category, address owner, bool mintable, uint256 timestamp, uint256 price, bytes contenthash) +func (_StickerType *StickerTypeCallerSession) GetPackData(_packId *big.Int) (struct { + Category [][4]byte + Owner common.Address + Mintable bool + Timestamp *big.Int + Price *big.Int + Contenthash []byte +}, error) { + return _StickerType.Contract.GetPackData(&_StickerType.CallOpts, _packId) +} + +// GetPackSummary is a free data retrieval call binding the contract method 0x81ec792d. +// +// Solidity: function getPackSummary(uint256 _packId) view returns(bytes4[] category, uint256 timestamp, bytes contenthash) +func (_StickerType *StickerTypeCaller) GetPackSummary(opts *bind.CallOpts, _packId *big.Int) (struct { + Category [][4]byte + Timestamp *big.Int + Contenthash []byte +}, error) { + var out []interface{} + err := _StickerType.contract.Call(opts, &out, "getPackSummary", _packId) + + outstruct := new(struct { + Category [][4]byte + Timestamp *big.Int + Contenthash []byte + }) + if err != nil { + return *outstruct, err + } + + outstruct.Category = *abi.ConvertType(out[0], new([][4]byte)).(*[][4]byte) + outstruct.Timestamp = *abi.ConvertType(out[1], new(*big.Int)).(**big.Int) + outstruct.Contenthash = *abi.ConvertType(out[2], new([]byte)).(*[]byte) + + return *outstruct, err + +} + +// GetPackSummary is a free data retrieval call binding the contract method 0x81ec792d. +// +// Solidity: function getPackSummary(uint256 _packId) view returns(bytes4[] category, uint256 timestamp, bytes contenthash) +func (_StickerType *StickerTypeSession) GetPackSummary(_packId *big.Int) (struct { + Category [][4]byte + Timestamp *big.Int + Contenthash []byte +}, error) { + return _StickerType.Contract.GetPackSummary(&_StickerType.CallOpts, _packId) +} + +// GetPackSummary is a free data retrieval call binding the contract method 0x81ec792d. +// +// Solidity: function getPackSummary(uint256 _packId) view returns(bytes4[] category, uint256 timestamp, bytes contenthash) +func (_StickerType *StickerTypeCallerSession) GetPackSummary(_packId *big.Int) (struct { + Category [][4]byte + Timestamp *big.Int + Contenthash []byte +}, error) { + return _StickerType.Contract.GetPackSummary(&_StickerType.CallOpts, _packId) +} + +// GetPaymentData is a free data retrieval call binding the contract method 0x9c3a39a2. +// +// Solidity: function getPaymentData(uint256 _packId) view returns(address owner, bool mintable, uint256 price, uint256 donate) +func (_StickerType *StickerTypeCaller) GetPaymentData(opts *bind.CallOpts, _packId *big.Int) (struct { + Owner common.Address + Mintable bool + Price *big.Int + Donate *big.Int +}, error) { + var out []interface{} + err := _StickerType.contract.Call(opts, &out, "getPaymentData", _packId) + + outstruct := new(struct { + Owner common.Address + Mintable bool + Price *big.Int + Donate *big.Int + }) + if err != nil { + return *outstruct, err + } + + outstruct.Owner = *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + outstruct.Mintable = *abi.ConvertType(out[1], new(bool)).(*bool) + outstruct.Price = *abi.ConvertType(out[2], new(*big.Int)).(**big.Int) + outstruct.Donate = *abi.ConvertType(out[3], new(*big.Int)).(**big.Int) + + return *outstruct, err + +} + +// GetPaymentData is a free data retrieval call binding the contract method 0x9c3a39a2. +// +// Solidity: function getPaymentData(uint256 _packId) view returns(address owner, bool mintable, uint256 price, uint256 donate) +func (_StickerType *StickerTypeSession) GetPaymentData(_packId *big.Int) (struct { + Owner common.Address + Mintable bool + Price *big.Int + Donate *big.Int +}, error) { + return _StickerType.Contract.GetPaymentData(&_StickerType.CallOpts, _packId) +} + +// GetPaymentData is a free data retrieval call binding the contract method 0x9c3a39a2. +// +// Solidity: function getPaymentData(uint256 _packId) view returns(address owner, bool mintable, uint256 price, uint256 donate) +func (_StickerType *StickerTypeCallerSession) GetPaymentData(_packId *big.Int) (struct { + Owner common.Address + Mintable bool + Price *big.Int + Donate *big.Int +}, error) { + return _StickerType.Contract.GetPaymentData(&_StickerType.CallOpts, _packId) +} + +// IsApprovedForAll is a free data retrieval call binding the contract method 0xe985e9c5. +// +// Solidity: function isApprovedForAll(address owner, address operator) view returns(bool) +func (_StickerType *StickerTypeCaller) IsApprovedForAll(opts *bind.CallOpts, owner common.Address, operator common.Address) (bool, error) { + var out []interface{} + err := _StickerType.contract.Call(opts, &out, "isApprovedForAll", owner, operator) + + if err != nil { + return *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + + return out0, err + +} + +// IsApprovedForAll is a free data retrieval call binding the contract method 0xe985e9c5. +// +// Solidity: function isApprovedForAll(address owner, address operator) view returns(bool) +func (_StickerType *StickerTypeSession) IsApprovedForAll(owner common.Address, operator common.Address) (bool, error) { + return _StickerType.Contract.IsApprovedForAll(&_StickerType.CallOpts, owner, operator) +} + +// IsApprovedForAll is a free data retrieval call binding the contract method 0xe985e9c5. +// +// Solidity: function isApprovedForAll(address owner, address operator) view returns(bool) +func (_StickerType *StickerTypeCallerSession) IsApprovedForAll(owner common.Address, operator common.Address) (bool, error) { + return _StickerType.Contract.IsApprovedForAll(&_StickerType.CallOpts, owner, operator) +} + +// Name is a free data retrieval call binding the contract method 0x06fdde03. +// +// Solidity: function name() view returns(string) +func (_StickerType *StickerTypeCaller) Name(opts *bind.CallOpts) (string, error) { + var out []interface{} + err := _StickerType.contract.Call(opts, &out, "name") + + if err != nil { + return *new(string), err + } + + out0 := *abi.ConvertType(out[0], new(string)).(*string) + + return out0, err + +} + +// Name is a free data retrieval call binding the contract method 0x06fdde03. +// +// Solidity: function name() view returns(string) +func (_StickerType *StickerTypeSession) Name() (string, error) { + return _StickerType.Contract.Name(&_StickerType.CallOpts) +} + +// Name is a free data retrieval call binding the contract method 0x06fdde03. +// +// Solidity: function name() view returns(string) +func (_StickerType *StickerTypeCallerSession) Name() (string, error) { + return _StickerType.Contract.Name(&_StickerType.CallOpts) +} + +// OwnerOf is a free data retrieval call binding the contract method 0x6352211e. +// +// Solidity: function ownerOf(uint256 tokenId) view returns(address) +func (_StickerType *StickerTypeCaller) OwnerOf(opts *bind.CallOpts, tokenId *big.Int) (common.Address, error) { + var out []interface{} + err := _StickerType.contract.Call(opts, &out, "ownerOf", tokenId) + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// OwnerOf is a free data retrieval call binding the contract method 0x6352211e. +// +// Solidity: function ownerOf(uint256 tokenId) view returns(address) +func (_StickerType *StickerTypeSession) OwnerOf(tokenId *big.Int) (common.Address, error) { + return _StickerType.Contract.OwnerOf(&_StickerType.CallOpts, tokenId) +} + +// OwnerOf is a free data retrieval call binding the contract method 0x6352211e. +// +// Solidity: function ownerOf(uint256 tokenId) view returns(address) +func (_StickerType *StickerTypeCallerSession) OwnerOf(tokenId *big.Int) (common.Address, error) { + return _StickerType.Contract.OwnerOf(&_StickerType.CallOpts, tokenId) +} + +// PackCount is a free data retrieval call binding the contract method 0x61bd6725. +// +// Solidity: function packCount() view returns(uint256) +func (_StickerType *StickerTypeCaller) PackCount(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _StickerType.contract.Call(opts, &out, "packCount") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// PackCount is a free data retrieval call binding the contract method 0x61bd6725. +// +// Solidity: function packCount() view returns(uint256) +func (_StickerType *StickerTypeSession) PackCount() (*big.Int, error) { + return _StickerType.Contract.PackCount(&_StickerType.CallOpts) +} + +// PackCount is a free data retrieval call binding the contract method 0x61bd6725. +// +// Solidity: function packCount() view returns(uint256) +func (_StickerType *StickerTypeCallerSession) PackCount() (*big.Int, error) { + return _StickerType.Contract.PackCount(&_StickerType.CallOpts) +} + +// Packs is a free data retrieval call binding the contract method 0xb84c1392. +// +// Solidity: function packs(uint256 ) view returns(bool mintable, uint256 timestamp, uint256 price, uint256 donate, bytes contenthash) +func (_StickerType *StickerTypeCaller) Packs(opts *bind.CallOpts, arg0 *big.Int) (struct { + Mintable bool + Timestamp *big.Int + Price *big.Int + Donate *big.Int + Contenthash []byte +}, error) { + var out []interface{} + err := _StickerType.contract.Call(opts, &out, "packs", arg0) + + outstruct := new(struct { + Mintable bool + Timestamp *big.Int + Price *big.Int + Donate *big.Int + Contenthash []byte + }) + if err != nil { + return *outstruct, err + } + + outstruct.Mintable = *abi.ConvertType(out[0], new(bool)).(*bool) + outstruct.Timestamp = *abi.ConvertType(out[1], new(*big.Int)).(**big.Int) + outstruct.Price = *abi.ConvertType(out[2], new(*big.Int)).(**big.Int) + outstruct.Donate = *abi.ConvertType(out[3], new(*big.Int)).(**big.Int) + outstruct.Contenthash = *abi.ConvertType(out[4], new([]byte)).(*[]byte) + + return *outstruct, err + +} + +// Packs is a free data retrieval call binding the contract method 0xb84c1392. +// +// Solidity: function packs(uint256 ) view returns(bool mintable, uint256 timestamp, uint256 price, uint256 donate, bytes contenthash) +func (_StickerType *StickerTypeSession) Packs(arg0 *big.Int) (struct { + Mintable bool + Timestamp *big.Int + Price *big.Int + Donate *big.Int + Contenthash []byte +}, error) { + return _StickerType.Contract.Packs(&_StickerType.CallOpts, arg0) +} + +// Packs is a free data retrieval call binding the contract method 0xb84c1392. +// +// Solidity: function packs(uint256 ) view returns(bool mintable, uint256 timestamp, uint256 price, uint256 donate, bytes contenthash) +func (_StickerType *StickerTypeCallerSession) Packs(arg0 *big.Int) (struct { + Mintable bool + Timestamp *big.Int + Price *big.Int + Donate *big.Int + Contenthash []byte +}, error) { + return _StickerType.Contract.Packs(&_StickerType.CallOpts, arg0) +} + +// SupportsInterface is a free data retrieval call binding the contract method 0x01ffc9a7. +// +// Solidity: function supportsInterface(bytes4 interfaceId) view returns(bool) +func (_StickerType *StickerTypeCaller) SupportsInterface(opts *bind.CallOpts, interfaceId [4]byte) (bool, error) { + var out []interface{} + err := _StickerType.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 (_StickerType *StickerTypeSession) SupportsInterface(interfaceId [4]byte) (bool, error) { + return _StickerType.Contract.SupportsInterface(&_StickerType.CallOpts, interfaceId) +} + +// SupportsInterface is a free data retrieval call binding the contract method 0x01ffc9a7. +// +// Solidity: function supportsInterface(bytes4 interfaceId) view returns(bool) +func (_StickerType *StickerTypeCallerSession) SupportsInterface(interfaceId [4]byte) (bool, error) { + return _StickerType.Contract.SupportsInterface(&_StickerType.CallOpts, interfaceId) +} + +// Symbol is a free data retrieval call binding the contract method 0x95d89b41. +// +// Solidity: function symbol() view returns(string) +func (_StickerType *StickerTypeCaller) Symbol(opts *bind.CallOpts) (string, error) { + var out []interface{} + err := _StickerType.contract.Call(opts, &out, "symbol") + + if err != nil { + return *new(string), err + } + + out0 := *abi.ConvertType(out[0], new(string)).(*string) + + return out0, err + +} + +// Symbol is a free data retrieval call binding the contract method 0x95d89b41. +// +// Solidity: function symbol() view returns(string) +func (_StickerType *StickerTypeSession) Symbol() (string, error) { + return _StickerType.Contract.Symbol(&_StickerType.CallOpts) +} + +// Symbol is a free data retrieval call binding the contract method 0x95d89b41. +// +// Solidity: function symbol() view returns(string) +func (_StickerType *StickerTypeCallerSession) Symbol() (string, error) { + return _StickerType.Contract.Symbol(&_StickerType.CallOpts) +} + +// TokenByIndex is a free data retrieval call binding the contract method 0x4f6ccce7. +// +// Solidity: function tokenByIndex(uint256 index) view returns(uint256) +func (_StickerType *StickerTypeCaller) TokenByIndex(opts *bind.CallOpts, index *big.Int) (*big.Int, error) { + var out []interface{} + err := _StickerType.contract.Call(opts, &out, "tokenByIndex", index) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// TokenByIndex is a free data retrieval call binding the contract method 0x4f6ccce7. +// +// Solidity: function tokenByIndex(uint256 index) view returns(uint256) +func (_StickerType *StickerTypeSession) TokenByIndex(index *big.Int) (*big.Int, error) { + return _StickerType.Contract.TokenByIndex(&_StickerType.CallOpts, index) +} + +// TokenByIndex is a free data retrieval call binding the contract method 0x4f6ccce7. +// +// Solidity: function tokenByIndex(uint256 index) view returns(uint256) +func (_StickerType *StickerTypeCallerSession) TokenByIndex(index *big.Int) (*big.Int, error) { + return _StickerType.Contract.TokenByIndex(&_StickerType.CallOpts, index) +} + +// TokenOfOwnerByIndex is a free data retrieval call binding the contract method 0x2f745c59. +// +// Solidity: function tokenOfOwnerByIndex(address owner, uint256 index) view returns(uint256) +func (_StickerType *StickerTypeCaller) TokenOfOwnerByIndex(opts *bind.CallOpts, owner common.Address, index *big.Int) (*big.Int, error) { + var out []interface{} + err := _StickerType.contract.Call(opts, &out, "tokenOfOwnerByIndex", owner, index) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// TokenOfOwnerByIndex is a free data retrieval call binding the contract method 0x2f745c59. +// +// Solidity: function tokenOfOwnerByIndex(address owner, uint256 index) view returns(uint256) +func (_StickerType *StickerTypeSession) TokenOfOwnerByIndex(owner common.Address, index *big.Int) (*big.Int, error) { + return _StickerType.Contract.TokenOfOwnerByIndex(&_StickerType.CallOpts, owner, index) +} + +// TokenOfOwnerByIndex is a free data retrieval call binding the contract method 0x2f745c59. +// +// Solidity: function tokenOfOwnerByIndex(address owner, uint256 index) view returns(uint256) +func (_StickerType *StickerTypeCallerSession) TokenOfOwnerByIndex(owner common.Address, index *big.Int) (*big.Int, error) { + return _StickerType.Contract.TokenOfOwnerByIndex(&_StickerType.CallOpts, owner, index) +} + +// TokenURI is a free data retrieval call binding the contract method 0xc87b56dd. +// +// Solidity: function tokenURI(uint256 tokenId) view returns(string) +func (_StickerType *StickerTypeCaller) TokenURI(opts *bind.CallOpts, tokenId *big.Int) (string, error) { + var out []interface{} + err := _StickerType.contract.Call(opts, &out, "tokenURI", tokenId) + + if err != nil { + return *new(string), err + } + + out0 := *abi.ConvertType(out[0], new(string)).(*string) + + return out0, err + +} + +// TokenURI is a free data retrieval call binding the contract method 0xc87b56dd. +// +// Solidity: function tokenURI(uint256 tokenId) view returns(string) +func (_StickerType *StickerTypeSession) TokenURI(tokenId *big.Int) (string, error) { + return _StickerType.Contract.TokenURI(&_StickerType.CallOpts, tokenId) +} + +// TokenURI is a free data retrieval call binding the contract method 0xc87b56dd. +// +// Solidity: function tokenURI(uint256 tokenId) view returns(string) +func (_StickerType *StickerTypeCallerSession) TokenURI(tokenId *big.Int) (string, error) { + return _StickerType.Contract.TokenURI(&_StickerType.CallOpts, tokenId) +} + +// TotalSupply is a free data retrieval call binding the contract method 0x18160ddd. +// +// Solidity: function totalSupply() view returns(uint256) +func (_StickerType *StickerTypeCaller) TotalSupply(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _StickerType.contract.Call(opts, &out, "totalSupply") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// TotalSupply is a free data retrieval call binding the contract method 0x18160ddd. +// +// Solidity: function totalSupply() view returns(uint256) +func (_StickerType *StickerTypeSession) TotalSupply() (*big.Int, error) { + return _StickerType.Contract.TotalSupply(&_StickerType.CallOpts) +} + +// TotalSupply is a free data retrieval call binding the contract method 0x18160ddd. +// +// Solidity: function totalSupply() view returns(uint256) +func (_StickerType *StickerTypeCallerSession) TotalSupply() (*big.Int, error) { + return _StickerType.Contract.TotalSupply(&_StickerType.CallOpts) +} + +// AddPackCategory is a paid mutator transaction binding the contract method 0xaeeaf3da. +// +// Solidity: function addPackCategory(uint256 _packId, bytes4 _category) returns() +func (_StickerType *StickerTypeTransactor) AddPackCategory(opts *bind.TransactOpts, _packId *big.Int, _category [4]byte) (*types.Transaction, error) { + return _StickerType.contract.Transact(opts, "addPackCategory", _packId, _category) +} + +// AddPackCategory is a paid mutator transaction binding the contract method 0xaeeaf3da. +// +// Solidity: function addPackCategory(uint256 _packId, bytes4 _category) returns() +func (_StickerType *StickerTypeSession) AddPackCategory(_packId *big.Int, _category [4]byte) (*types.Transaction, error) { + return _StickerType.Contract.AddPackCategory(&_StickerType.TransactOpts, _packId, _category) +} + +// AddPackCategory is a paid mutator transaction binding the contract method 0xaeeaf3da. +// +// Solidity: function addPackCategory(uint256 _packId, bytes4 _category) returns() +func (_StickerType *StickerTypeTransactorSession) AddPackCategory(_packId *big.Int, _category [4]byte) (*types.Transaction, error) { + return _StickerType.Contract.AddPackCategory(&_StickerType.TransactOpts, _packId, _category) +} + +// Approve is a paid mutator transaction binding the contract method 0x095ea7b3. +// +// Solidity: function approve(address to, uint256 tokenId) returns() +func (_StickerType *StickerTypeTransactor) Approve(opts *bind.TransactOpts, to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _StickerType.contract.Transact(opts, "approve", to, tokenId) +} + +// Approve is a paid mutator transaction binding the contract method 0x095ea7b3. +// +// Solidity: function approve(address to, uint256 tokenId) returns() +func (_StickerType *StickerTypeSession) Approve(to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _StickerType.Contract.Approve(&_StickerType.TransactOpts, to, tokenId) +} + +// Approve is a paid mutator transaction binding the contract method 0x095ea7b3. +// +// Solidity: function approve(address to, uint256 tokenId) returns() +func (_StickerType *StickerTypeTransactorSession) Approve(to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _StickerType.Contract.Approve(&_StickerType.TransactOpts, to, tokenId) +} + +// ChangeController is a paid mutator transaction binding the contract method 0x3cebb823. +// +// Solidity: function changeController(address _newController) returns() +func (_StickerType *StickerTypeTransactor) ChangeController(opts *bind.TransactOpts, _newController common.Address) (*types.Transaction, error) { + return _StickerType.contract.Transact(opts, "changeController", _newController) +} + +// ChangeController is a paid mutator transaction binding the contract method 0x3cebb823. +// +// Solidity: function changeController(address _newController) returns() +func (_StickerType *StickerTypeSession) ChangeController(_newController common.Address) (*types.Transaction, error) { + return _StickerType.Contract.ChangeController(&_StickerType.TransactOpts, _newController) +} + +// ChangeController is a paid mutator transaction binding the contract method 0x3cebb823. +// +// Solidity: function changeController(address _newController) returns() +func (_StickerType *StickerTypeTransactorSession) ChangeController(_newController common.Address) (*types.Transaction, error) { + return _StickerType.Contract.ChangeController(&_StickerType.TransactOpts, _newController) +} + +// ClaimTokens is a paid mutator transaction binding the contract method 0xdf8de3e7. +// +// Solidity: function claimTokens(address _token) returns() +func (_StickerType *StickerTypeTransactor) ClaimTokens(opts *bind.TransactOpts, _token common.Address) (*types.Transaction, error) { + return _StickerType.contract.Transact(opts, "claimTokens", _token) +} + +// ClaimTokens is a paid mutator transaction binding the contract method 0xdf8de3e7. +// +// Solidity: function claimTokens(address _token) returns() +func (_StickerType *StickerTypeSession) ClaimTokens(_token common.Address) (*types.Transaction, error) { + return _StickerType.Contract.ClaimTokens(&_StickerType.TransactOpts, _token) +} + +// ClaimTokens is a paid mutator transaction binding the contract method 0xdf8de3e7. +// +// Solidity: function claimTokens(address _token) returns() +func (_StickerType *StickerTypeTransactorSession) ClaimTokens(_token common.Address) (*types.Transaction, error) { + return _StickerType.Contract.ClaimTokens(&_StickerType.TransactOpts, _token) +} + +// GeneratePack is a paid mutator transaction binding the contract method 0x4c06dc17. +// +// Solidity: function generatePack(uint256 _price, uint256 _donate, bytes4[] _category, address _owner, bytes _contenthash) returns(uint256 packId) +func (_StickerType *StickerTypeTransactor) GeneratePack(opts *bind.TransactOpts, _price *big.Int, _donate *big.Int, _category [][4]byte, _owner common.Address, _contenthash []byte) (*types.Transaction, error) { + return _StickerType.contract.Transact(opts, "generatePack", _price, _donate, _category, _owner, _contenthash) +} + +// GeneratePack is a paid mutator transaction binding the contract method 0x4c06dc17. +// +// Solidity: function generatePack(uint256 _price, uint256 _donate, bytes4[] _category, address _owner, bytes _contenthash) returns(uint256 packId) +func (_StickerType *StickerTypeSession) GeneratePack(_price *big.Int, _donate *big.Int, _category [][4]byte, _owner common.Address, _contenthash []byte) (*types.Transaction, error) { + return _StickerType.Contract.GeneratePack(&_StickerType.TransactOpts, _price, _donate, _category, _owner, _contenthash) +} + +// GeneratePack is a paid mutator transaction binding the contract method 0x4c06dc17. +// +// Solidity: function generatePack(uint256 _price, uint256 _donate, bytes4[] _category, address _owner, bytes _contenthash) returns(uint256 packId) +func (_StickerType *StickerTypeTransactorSession) GeneratePack(_price *big.Int, _donate *big.Int, _category [][4]byte, _owner common.Address, _contenthash []byte) (*types.Transaction, error) { + return _StickerType.Contract.GeneratePack(&_StickerType.TransactOpts, _price, _donate, _category, _owner, _contenthash) +} + +// PurgePack is a paid mutator transaction binding the contract method 0x00b3c91b. +// +// Solidity: function purgePack(uint256 _packId, uint256 _limit) returns() +func (_StickerType *StickerTypeTransactor) PurgePack(opts *bind.TransactOpts, _packId *big.Int, _limit *big.Int) (*types.Transaction, error) { + return _StickerType.contract.Transact(opts, "purgePack", _packId, _limit) +} + +// PurgePack is a paid mutator transaction binding the contract method 0x00b3c91b. +// +// Solidity: function purgePack(uint256 _packId, uint256 _limit) returns() +func (_StickerType *StickerTypeSession) PurgePack(_packId *big.Int, _limit *big.Int) (*types.Transaction, error) { + return _StickerType.Contract.PurgePack(&_StickerType.TransactOpts, _packId, _limit) +} + +// PurgePack is a paid mutator transaction binding the contract method 0x00b3c91b. +// +// Solidity: function purgePack(uint256 _packId, uint256 _limit) returns() +func (_StickerType *StickerTypeTransactorSession) PurgePack(_packId *big.Int, _limit *big.Int) (*types.Transaction, error) { + return _StickerType.Contract.PurgePack(&_StickerType.TransactOpts, _packId, _limit) +} + +// RemovePackCategory is a paid mutator transaction binding the contract method 0xe8bb7143. +// +// Solidity: function removePackCategory(uint256 _packId, bytes4 _category) returns() +func (_StickerType *StickerTypeTransactor) RemovePackCategory(opts *bind.TransactOpts, _packId *big.Int, _category [4]byte) (*types.Transaction, error) { + return _StickerType.contract.Transact(opts, "removePackCategory", _packId, _category) +} + +// RemovePackCategory is a paid mutator transaction binding the contract method 0xe8bb7143. +// +// Solidity: function removePackCategory(uint256 _packId, bytes4 _category) returns() +func (_StickerType *StickerTypeSession) RemovePackCategory(_packId *big.Int, _category [4]byte) (*types.Transaction, error) { + return _StickerType.Contract.RemovePackCategory(&_StickerType.TransactOpts, _packId, _category) +} + +// RemovePackCategory is a paid mutator transaction binding the contract method 0xe8bb7143. +// +// Solidity: function removePackCategory(uint256 _packId, bytes4 _category) returns() +func (_StickerType *StickerTypeTransactorSession) RemovePackCategory(_packId *big.Int, _category [4]byte) (*types.Transaction, error) { + return _StickerType.Contract.RemovePackCategory(&_StickerType.TransactOpts, _packId, _category) +} + +// SafeTransferFrom is a paid mutator transaction binding the contract method 0x42842e0e. +// +// Solidity: function safeTransferFrom(address from, address to, uint256 tokenId) returns() +func (_StickerType *StickerTypeTransactor) SafeTransferFrom(opts *bind.TransactOpts, from common.Address, to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _StickerType.contract.Transact(opts, "safeTransferFrom", from, to, tokenId) +} + +// SafeTransferFrom is a paid mutator transaction binding the contract method 0x42842e0e. +// +// Solidity: function safeTransferFrom(address from, address to, uint256 tokenId) returns() +func (_StickerType *StickerTypeSession) SafeTransferFrom(from common.Address, to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _StickerType.Contract.SafeTransferFrom(&_StickerType.TransactOpts, from, to, tokenId) +} + +// SafeTransferFrom is a paid mutator transaction binding the contract method 0x42842e0e. +// +// Solidity: function safeTransferFrom(address from, address to, uint256 tokenId) returns() +func (_StickerType *StickerTypeTransactorSession) SafeTransferFrom(from common.Address, to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _StickerType.Contract.SafeTransferFrom(&_StickerType.TransactOpts, from, to, tokenId) +} + +// SafeTransferFrom0 is a paid mutator transaction binding the contract method 0xb88d4fde. +// +// Solidity: function safeTransferFrom(address from, address to, uint256 tokenId, bytes _data) returns() +func (_StickerType *StickerTypeTransactor) SafeTransferFrom0(opts *bind.TransactOpts, from common.Address, to common.Address, tokenId *big.Int, _data []byte) (*types.Transaction, error) { + return _StickerType.contract.Transact(opts, "safeTransferFrom0", from, to, tokenId, _data) +} + +// SafeTransferFrom0 is a paid mutator transaction binding the contract method 0xb88d4fde. +// +// Solidity: function safeTransferFrom(address from, address to, uint256 tokenId, bytes _data) returns() +func (_StickerType *StickerTypeSession) SafeTransferFrom0(from common.Address, to common.Address, tokenId *big.Int, _data []byte) (*types.Transaction, error) { + return _StickerType.Contract.SafeTransferFrom0(&_StickerType.TransactOpts, from, to, tokenId, _data) +} + +// SafeTransferFrom0 is a paid mutator transaction binding the contract method 0xb88d4fde. +// +// Solidity: function safeTransferFrom(address from, address to, uint256 tokenId, bytes _data) returns() +func (_StickerType *StickerTypeTransactorSession) SafeTransferFrom0(from common.Address, to common.Address, tokenId *big.Int, _data []byte) (*types.Transaction, error) { + return _StickerType.Contract.SafeTransferFrom0(&_StickerType.TransactOpts, from, to, tokenId, _data) +} + +// SetApprovalForAll is a paid mutator transaction binding the contract method 0xa22cb465. +// +// Solidity: function setApprovalForAll(address to, bool approved) returns() +func (_StickerType *StickerTypeTransactor) SetApprovalForAll(opts *bind.TransactOpts, to common.Address, approved bool) (*types.Transaction, error) { + return _StickerType.contract.Transact(opts, "setApprovalForAll", to, approved) +} + +// SetApprovalForAll is a paid mutator transaction binding the contract method 0xa22cb465. +// +// Solidity: function setApprovalForAll(address to, bool approved) returns() +func (_StickerType *StickerTypeSession) SetApprovalForAll(to common.Address, approved bool) (*types.Transaction, error) { + return _StickerType.Contract.SetApprovalForAll(&_StickerType.TransactOpts, to, approved) +} + +// SetApprovalForAll is a paid mutator transaction binding the contract method 0xa22cb465. +// +// Solidity: function setApprovalForAll(address to, bool approved) returns() +func (_StickerType *StickerTypeTransactorSession) SetApprovalForAll(to common.Address, approved bool) (*types.Transaction, error) { + return _StickerType.Contract.SetApprovalForAll(&_StickerType.TransactOpts, to, approved) +} + +// SetPackContenthash is a paid mutator transaction binding the contract method 0x6a847981. +// +// Solidity: function setPackContenthash(uint256 _packId, bytes _contenthash) returns() +func (_StickerType *StickerTypeTransactor) SetPackContenthash(opts *bind.TransactOpts, _packId *big.Int, _contenthash []byte) (*types.Transaction, error) { + return _StickerType.contract.Transact(opts, "setPackContenthash", _packId, _contenthash) +} + +// SetPackContenthash is a paid mutator transaction binding the contract method 0x6a847981. +// +// Solidity: function setPackContenthash(uint256 _packId, bytes _contenthash) returns() +func (_StickerType *StickerTypeSession) SetPackContenthash(_packId *big.Int, _contenthash []byte) (*types.Transaction, error) { + return _StickerType.Contract.SetPackContenthash(&_StickerType.TransactOpts, _packId, _contenthash) +} + +// SetPackContenthash is a paid mutator transaction binding the contract method 0x6a847981. +// +// Solidity: function setPackContenthash(uint256 _packId, bytes _contenthash) returns() +func (_StickerType *StickerTypeTransactorSession) SetPackContenthash(_packId *big.Int, _contenthash []byte) (*types.Transaction, error) { + return _StickerType.Contract.SetPackContenthash(&_StickerType.TransactOpts, _packId, _contenthash) +} + +// SetPackPrice is a paid mutator transaction binding the contract method 0x9389c5b5. +// +// Solidity: function setPackPrice(uint256 _packId, uint256 _price, uint256 _donate) returns() +func (_StickerType *StickerTypeTransactor) SetPackPrice(opts *bind.TransactOpts, _packId *big.Int, _price *big.Int, _donate *big.Int) (*types.Transaction, error) { + return _StickerType.contract.Transact(opts, "setPackPrice", _packId, _price, _donate) +} + +// SetPackPrice is a paid mutator transaction binding the contract method 0x9389c5b5. +// +// Solidity: function setPackPrice(uint256 _packId, uint256 _price, uint256 _donate) returns() +func (_StickerType *StickerTypeSession) SetPackPrice(_packId *big.Int, _price *big.Int, _donate *big.Int) (*types.Transaction, error) { + return _StickerType.Contract.SetPackPrice(&_StickerType.TransactOpts, _packId, _price, _donate) +} + +// SetPackPrice is a paid mutator transaction binding the contract method 0x9389c5b5. +// +// Solidity: function setPackPrice(uint256 _packId, uint256 _price, uint256 _donate) returns() +func (_StickerType *StickerTypeTransactorSession) SetPackPrice(_packId *big.Int, _price *big.Int, _donate *big.Int) (*types.Transaction, error) { + return _StickerType.Contract.SetPackPrice(&_StickerType.TransactOpts, _packId, _price, _donate) +} + +// SetPackState is a paid mutator transaction binding the contract method 0xb7f48211. +// +// Solidity: function setPackState(uint256 _packId, bool _mintable) returns() +func (_StickerType *StickerTypeTransactor) SetPackState(opts *bind.TransactOpts, _packId *big.Int, _mintable bool) (*types.Transaction, error) { + return _StickerType.contract.Transact(opts, "setPackState", _packId, _mintable) +} + +// SetPackState is a paid mutator transaction binding the contract method 0xb7f48211. +// +// Solidity: function setPackState(uint256 _packId, bool _mintable) returns() +func (_StickerType *StickerTypeSession) SetPackState(_packId *big.Int, _mintable bool) (*types.Transaction, error) { + return _StickerType.Contract.SetPackState(&_StickerType.TransactOpts, _packId, _mintable) +} + +// SetPackState is a paid mutator transaction binding the contract method 0xb7f48211. +// +// Solidity: function setPackState(uint256 _packId, bool _mintable) returns() +func (_StickerType *StickerTypeTransactorSession) SetPackState(_packId *big.Int, _mintable bool) (*types.Transaction, error) { + return _StickerType.Contract.SetPackState(&_StickerType.TransactOpts, _packId, _mintable) +} + +// TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd. +// +// Solidity: function transferFrom(address from, address to, uint256 tokenId) returns() +func (_StickerType *StickerTypeTransactor) TransferFrom(opts *bind.TransactOpts, from common.Address, to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _StickerType.contract.Transact(opts, "transferFrom", from, to, tokenId) +} + +// TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd. +// +// Solidity: function transferFrom(address from, address to, uint256 tokenId) returns() +func (_StickerType *StickerTypeSession) TransferFrom(from common.Address, to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _StickerType.Contract.TransferFrom(&_StickerType.TransactOpts, from, to, tokenId) +} + +// TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd. +// +// Solidity: function transferFrom(address from, address to, uint256 tokenId) returns() +func (_StickerType *StickerTypeTransactorSession) TransferFrom(from common.Address, to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _StickerType.Contract.TransferFrom(&_StickerType.TransactOpts, from, to, tokenId) +} + +// StickerTypeApprovalIterator is returned from FilterApproval and is used to iterate over the raw logs and unpacked data for Approval events raised by the StickerType contract. +type StickerTypeApprovalIterator struct { + Event *StickerTypeApproval // 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 *StickerTypeApprovalIterator) 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(StickerTypeApproval) + 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(StickerTypeApproval) + 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 *StickerTypeApprovalIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *StickerTypeApprovalIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// StickerTypeApproval represents a Approval event raised by the StickerType contract. +type StickerTypeApproval struct { + Owner common.Address + Approved common.Address + TokenId *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterApproval is a free log retrieval operation binding the contract event 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925. +// +// Solidity: event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId) +func (_StickerType *StickerTypeFilterer) FilterApproval(opts *bind.FilterOpts, owner []common.Address, approved []common.Address, tokenId []*big.Int) (*StickerTypeApprovalIterator, error) { + + var ownerRule []interface{} + for _, ownerItem := range owner { + ownerRule = append(ownerRule, ownerItem) + } + var approvedRule []interface{} + for _, approvedItem := range approved { + approvedRule = append(approvedRule, approvedItem) + } + var tokenIdRule []interface{} + for _, tokenIdItem := range tokenId { + tokenIdRule = append(tokenIdRule, tokenIdItem) + } + + logs, sub, err := _StickerType.contract.FilterLogs(opts, "Approval", ownerRule, approvedRule, tokenIdRule) + if err != nil { + return nil, err + } + return &StickerTypeApprovalIterator{contract: _StickerType.contract, event: "Approval", logs: logs, sub: sub}, nil +} + +// WatchApproval is a free log subscription operation binding the contract event 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925. +// +// Solidity: event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId) +func (_StickerType *StickerTypeFilterer) WatchApproval(opts *bind.WatchOpts, sink chan<- *StickerTypeApproval, owner []common.Address, approved []common.Address, tokenId []*big.Int) (event.Subscription, error) { + + var ownerRule []interface{} + for _, ownerItem := range owner { + ownerRule = append(ownerRule, ownerItem) + } + var approvedRule []interface{} + for _, approvedItem := range approved { + approvedRule = append(approvedRule, approvedItem) + } + var tokenIdRule []interface{} + for _, tokenIdItem := range tokenId { + tokenIdRule = append(tokenIdRule, tokenIdItem) + } + + logs, sub, err := _StickerType.contract.WatchLogs(opts, "Approval", ownerRule, approvedRule, tokenIdRule) + 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(StickerTypeApproval) + if err := _StickerType.contract.UnpackLog(event, "Approval", 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 +} + +// ParseApproval is a log parse operation binding the contract event 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925. +// +// Solidity: event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId) +func (_StickerType *StickerTypeFilterer) ParseApproval(log types.Log) (*StickerTypeApproval, error) { + event := new(StickerTypeApproval) + if err := _StickerType.contract.UnpackLog(event, "Approval", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// StickerTypeApprovalForAllIterator is returned from FilterApprovalForAll and is used to iterate over the raw logs and unpacked data for ApprovalForAll events raised by the StickerType contract. +type StickerTypeApprovalForAllIterator struct { + Event *StickerTypeApprovalForAll // 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 *StickerTypeApprovalForAllIterator) 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(StickerTypeApprovalForAll) + 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(StickerTypeApprovalForAll) + 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 *StickerTypeApprovalForAllIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *StickerTypeApprovalForAllIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// StickerTypeApprovalForAll represents a ApprovalForAll event raised by the StickerType contract. +type StickerTypeApprovalForAll struct { + Owner common.Address + Operator common.Address + Approved bool + Raw types.Log // Blockchain specific contextual infos +} + +// FilterApprovalForAll is a free log retrieval operation binding the contract event 0x17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31. +// +// Solidity: event ApprovalForAll(address indexed owner, address indexed operator, bool approved) +func (_StickerType *StickerTypeFilterer) FilterApprovalForAll(opts *bind.FilterOpts, owner []common.Address, operator []common.Address) (*StickerTypeApprovalForAllIterator, error) { + + var ownerRule []interface{} + for _, ownerItem := range owner { + ownerRule = append(ownerRule, ownerItem) + } + var operatorRule []interface{} + for _, operatorItem := range operator { + operatorRule = append(operatorRule, operatorItem) + } + + logs, sub, err := _StickerType.contract.FilterLogs(opts, "ApprovalForAll", ownerRule, operatorRule) + if err != nil { + return nil, err + } + return &StickerTypeApprovalForAllIterator{contract: _StickerType.contract, event: "ApprovalForAll", logs: logs, sub: sub}, nil +} + +// WatchApprovalForAll is a free log subscription operation binding the contract event 0x17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31. +// +// Solidity: event ApprovalForAll(address indexed owner, address indexed operator, bool approved) +func (_StickerType *StickerTypeFilterer) WatchApprovalForAll(opts *bind.WatchOpts, sink chan<- *StickerTypeApprovalForAll, owner []common.Address, operator []common.Address) (event.Subscription, error) { + + var ownerRule []interface{} + for _, ownerItem := range owner { + ownerRule = append(ownerRule, ownerItem) + } + var operatorRule []interface{} + for _, operatorItem := range operator { + operatorRule = append(operatorRule, operatorItem) + } + + logs, sub, err := _StickerType.contract.WatchLogs(opts, "ApprovalForAll", ownerRule, operatorRule) + 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(StickerTypeApprovalForAll) + if err := _StickerType.contract.UnpackLog(event, "ApprovalForAll", 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 +} + +// ParseApprovalForAll is a log parse operation binding the contract event 0x17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31. +// +// Solidity: event ApprovalForAll(address indexed owner, address indexed operator, bool approved) +func (_StickerType *StickerTypeFilterer) ParseApprovalForAll(log types.Log) (*StickerTypeApprovalForAll, error) { + event := new(StickerTypeApprovalForAll) + if err := _StickerType.contract.UnpackLog(event, "ApprovalForAll", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// StickerTypeCategorizedIterator is returned from FilterCategorized and is used to iterate over the raw logs and unpacked data for Categorized events raised by the StickerType contract. +type StickerTypeCategorizedIterator struct { + Event *StickerTypeCategorized // 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 *StickerTypeCategorizedIterator) 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(StickerTypeCategorized) + 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(StickerTypeCategorized) + 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 *StickerTypeCategorizedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *StickerTypeCategorizedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// StickerTypeCategorized represents a Categorized event raised by the StickerType contract. +type StickerTypeCategorized struct { + Category [4]byte + PackId *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterCategorized is a free log retrieval operation binding the contract event 0x74186c4c4ee368ea5564982241efb7357014b52d6e195d026bc4fdfaa112691b. +// +// Solidity: event Categorized(bytes4 indexed category, uint256 indexed packId) +func (_StickerType *StickerTypeFilterer) FilterCategorized(opts *bind.FilterOpts, category [][4]byte, packId []*big.Int) (*StickerTypeCategorizedIterator, error) { + + var categoryRule []interface{} + for _, categoryItem := range category { + categoryRule = append(categoryRule, categoryItem) + } + var packIdRule []interface{} + for _, packIdItem := range packId { + packIdRule = append(packIdRule, packIdItem) + } + + logs, sub, err := _StickerType.contract.FilterLogs(opts, "Categorized", categoryRule, packIdRule) + if err != nil { + return nil, err + } + return &StickerTypeCategorizedIterator{contract: _StickerType.contract, event: "Categorized", logs: logs, sub: sub}, nil +} + +// WatchCategorized is a free log subscription operation binding the contract event 0x74186c4c4ee368ea5564982241efb7357014b52d6e195d026bc4fdfaa112691b. +// +// Solidity: event Categorized(bytes4 indexed category, uint256 indexed packId) +func (_StickerType *StickerTypeFilterer) WatchCategorized(opts *bind.WatchOpts, sink chan<- *StickerTypeCategorized, category [][4]byte, packId []*big.Int) (event.Subscription, error) { + + var categoryRule []interface{} + for _, categoryItem := range category { + categoryRule = append(categoryRule, categoryItem) + } + var packIdRule []interface{} + for _, packIdItem := range packId { + packIdRule = append(packIdRule, packIdItem) + } + + logs, sub, err := _StickerType.contract.WatchLogs(opts, "Categorized", categoryRule, packIdRule) + 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(StickerTypeCategorized) + if err := _StickerType.contract.UnpackLog(event, "Categorized", 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 +} + +// ParseCategorized is a log parse operation binding the contract event 0x74186c4c4ee368ea5564982241efb7357014b52d6e195d026bc4fdfaa112691b. +// +// Solidity: event Categorized(bytes4 indexed category, uint256 indexed packId) +func (_StickerType *StickerTypeFilterer) ParseCategorized(log types.Log) (*StickerTypeCategorized, error) { + event := new(StickerTypeCategorized) + if err := _StickerType.contract.UnpackLog(event, "Categorized", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// StickerTypeClaimedTokensIterator is returned from FilterClaimedTokens and is used to iterate over the raw logs and unpacked data for ClaimedTokens events raised by the StickerType contract. +type StickerTypeClaimedTokensIterator struct { + Event *StickerTypeClaimedTokens // 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 *StickerTypeClaimedTokensIterator) 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(StickerTypeClaimedTokens) + 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(StickerTypeClaimedTokens) + 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 *StickerTypeClaimedTokensIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *StickerTypeClaimedTokensIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// StickerTypeClaimedTokens represents a ClaimedTokens event raised by the StickerType contract. +type StickerTypeClaimedTokens struct { + Token common.Address + Controller common.Address + Amount *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterClaimedTokens is a free log retrieval operation binding the contract event 0xf931edb47c50b4b4104c187b5814a9aef5f709e17e2ecf9617e860cacade929c. +// +// Solidity: event ClaimedTokens(address indexed _token, address indexed _controller, uint256 _amount) +func (_StickerType *StickerTypeFilterer) FilterClaimedTokens(opts *bind.FilterOpts, _token []common.Address, _controller []common.Address) (*StickerTypeClaimedTokensIterator, error) { + + var _tokenRule []interface{} + for _, _tokenItem := range _token { + _tokenRule = append(_tokenRule, _tokenItem) + } + var _controllerRule []interface{} + for _, _controllerItem := range _controller { + _controllerRule = append(_controllerRule, _controllerItem) + } + + logs, sub, err := _StickerType.contract.FilterLogs(opts, "ClaimedTokens", _tokenRule, _controllerRule) + if err != nil { + return nil, err + } + return &StickerTypeClaimedTokensIterator{contract: _StickerType.contract, event: "ClaimedTokens", logs: logs, sub: sub}, nil +} + +// WatchClaimedTokens is a free log subscription operation binding the contract event 0xf931edb47c50b4b4104c187b5814a9aef5f709e17e2ecf9617e860cacade929c. +// +// Solidity: event ClaimedTokens(address indexed _token, address indexed _controller, uint256 _amount) +func (_StickerType *StickerTypeFilterer) WatchClaimedTokens(opts *bind.WatchOpts, sink chan<- *StickerTypeClaimedTokens, _token []common.Address, _controller []common.Address) (event.Subscription, error) { + + var _tokenRule []interface{} + for _, _tokenItem := range _token { + _tokenRule = append(_tokenRule, _tokenItem) + } + var _controllerRule []interface{} + for _, _controllerItem := range _controller { + _controllerRule = append(_controllerRule, _controllerItem) + } + + logs, sub, err := _StickerType.contract.WatchLogs(opts, "ClaimedTokens", _tokenRule, _controllerRule) + 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(StickerTypeClaimedTokens) + if err := _StickerType.contract.UnpackLog(event, "ClaimedTokens", 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 +} + +// ParseClaimedTokens is a log parse operation binding the contract event 0xf931edb47c50b4b4104c187b5814a9aef5f709e17e2ecf9617e860cacade929c. +// +// Solidity: event ClaimedTokens(address indexed _token, address indexed _controller, uint256 _amount) +func (_StickerType *StickerTypeFilterer) ParseClaimedTokens(log types.Log) (*StickerTypeClaimedTokens, error) { + event := new(StickerTypeClaimedTokens) + if err := _StickerType.contract.UnpackLog(event, "ClaimedTokens", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// StickerTypeContenthashChangedIterator is returned from FilterContenthashChanged and is used to iterate over the raw logs and unpacked data for ContenthashChanged events raised by the StickerType contract. +type StickerTypeContenthashChangedIterator struct { + Event *StickerTypeContenthashChanged // 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 *StickerTypeContenthashChangedIterator) 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(StickerTypeContenthashChanged) + 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(StickerTypeContenthashChanged) + 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 *StickerTypeContenthashChangedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *StickerTypeContenthashChangedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// StickerTypeContenthashChanged represents a ContenthashChanged event raised by the StickerType contract. +type StickerTypeContenthashChanged struct { + Packid *big.Int + Contenthash []byte + Raw types.Log // Blockchain specific contextual infos +} + +// FilterContenthashChanged is a free log retrieval operation binding the contract event 0x6fd3fdff55b0feb6f24c338494b36929368cd564825688c741d54b8d7fa7beb9. +// +// Solidity: event ContenthashChanged(uint256 indexed packid, bytes contenthash) +func (_StickerType *StickerTypeFilterer) FilterContenthashChanged(opts *bind.FilterOpts, packid []*big.Int) (*StickerTypeContenthashChangedIterator, error) { + + var packidRule []interface{} + for _, packidItem := range packid { + packidRule = append(packidRule, packidItem) + } + + logs, sub, err := _StickerType.contract.FilterLogs(opts, "ContenthashChanged", packidRule) + if err != nil { + return nil, err + } + return &StickerTypeContenthashChangedIterator{contract: _StickerType.contract, event: "ContenthashChanged", logs: logs, sub: sub}, nil +} + +// WatchContenthashChanged is a free log subscription operation binding the contract event 0x6fd3fdff55b0feb6f24c338494b36929368cd564825688c741d54b8d7fa7beb9. +// +// Solidity: event ContenthashChanged(uint256 indexed packid, bytes contenthash) +func (_StickerType *StickerTypeFilterer) WatchContenthashChanged(opts *bind.WatchOpts, sink chan<- *StickerTypeContenthashChanged, packid []*big.Int) (event.Subscription, error) { + + var packidRule []interface{} + for _, packidItem := range packid { + packidRule = append(packidRule, packidItem) + } + + logs, sub, err := _StickerType.contract.WatchLogs(opts, "ContenthashChanged", packidRule) + 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(StickerTypeContenthashChanged) + if err := _StickerType.contract.UnpackLog(event, "ContenthashChanged", 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 +} + +// ParseContenthashChanged is a log parse operation binding the contract event 0x6fd3fdff55b0feb6f24c338494b36929368cd564825688c741d54b8d7fa7beb9. +// +// Solidity: event ContenthashChanged(uint256 indexed packid, bytes contenthash) +func (_StickerType *StickerTypeFilterer) ParseContenthashChanged(log types.Log) (*StickerTypeContenthashChanged, error) { + event := new(StickerTypeContenthashChanged) + if err := _StickerType.contract.UnpackLog(event, "ContenthashChanged", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// StickerTypeMintabilityChangedIterator is returned from FilterMintabilityChanged and is used to iterate over the raw logs and unpacked data for MintabilityChanged events raised by the StickerType contract. +type StickerTypeMintabilityChangedIterator struct { + Event *StickerTypeMintabilityChanged // 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 *StickerTypeMintabilityChangedIterator) 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(StickerTypeMintabilityChanged) + 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(StickerTypeMintabilityChanged) + 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 *StickerTypeMintabilityChangedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *StickerTypeMintabilityChangedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// StickerTypeMintabilityChanged represents a MintabilityChanged event raised by the StickerType contract. +type StickerTypeMintabilityChanged struct { + PackId *big.Int + Mintable bool + Raw types.Log // Blockchain specific contextual infos +} + +// FilterMintabilityChanged is a free log retrieval operation binding the contract event 0x7a5b9103727f29409c14d2581e9710a1648b1354e667e1c803d4bda045159660. +// +// Solidity: event MintabilityChanged(uint256 indexed packId, bool mintable) +func (_StickerType *StickerTypeFilterer) FilterMintabilityChanged(opts *bind.FilterOpts, packId []*big.Int) (*StickerTypeMintabilityChangedIterator, error) { + + var packIdRule []interface{} + for _, packIdItem := range packId { + packIdRule = append(packIdRule, packIdItem) + } + + logs, sub, err := _StickerType.contract.FilterLogs(opts, "MintabilityChanged", packIdRule) + if err != nil { + return nil, err + } + return &StickerTypeMintabilityChangedIterator{contract: _StickerType.contract, event: "MintabilityChanged", logs: logs, sub: sub}, nil +} + +// WatchMintabilityChanged is a free log subscription operation binding the contract event 0x7a5b9103727f29409c14d2581e9710a1648b1354e667e1c803d4bda045159660. +// +// Solidity: event MintabilityChanged(uint256 indexed packId, bool mintable) +func (_StickerType *StickerTypeFilterer) WatchMintabilityChanged(opts *bind.WatchOpts, sink chan<- *StickerTypeMintabilityChanged, packId []*big.Int) (event.Subscription, error) { + + var packIdRule []interface{} + for _, packIdItem := range packId { + packIdRule = append(packIdRule, packIdItem) + } + + logs, sub, err := _StickerType.contract.WatchLogs(opts, "MintabilityChanged", packIdRule) + 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(StickerTypeMintabilityChanged) + if err := _StickerType.contract.UnpackLog(event, "MintabilityChanged", 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 +} + +// ParseMintabilityChanged is a log parse operation binding the contract event 0x7a5b9103727f29409c14d2581e9710a1648b1354e667e1c803d4bda045159660. +// +// Solidity: event MintabilityChanged(uint256 indexed packId, bool mintable) +func (_StickerType *StickerTypeFilterer) ParseMintabilityChanged(log types.Log) (*StickerTypeMintabilityChanged, error) { + event := new(StickerTypeMintabilityChanged) + if err := _StickerType.contract.UnpackLog(event, "MintabilityChanged", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// StickerTypeNewControllerIterator is returned from FilterNewController and is used to iterate over the raw logs and unpacked data for NewController events raised by the StickerType contract. +type StickerTypeNewControllerIterator struct { + Event *StickerTypeNewController // 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 *StickerTypeNewControllerIterator) 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(StickerTypeNewController) + 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(StickerTypeNewController) + 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 *StickerTypeNewControllerIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *StickerTypeNewControllerIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// StickerTypeNewController represents a NewController event raised by the StickerType contract. +type StickerTypeNewController struct { + Controller common.Address + Raw types.Log // Blockchain specific contextual infos +} + +// FilterNewController is a free log retrieval operation binding the contract event 0xe253457d9ad994ca9682fc3bbc38c890dca73a2d5ecee3809e548bac8b00d7c6. +// +// Solidity: event NewController(address controller) +func (_StickerType *StickerTypeFilterer) FilterNewController(opts *bind.FilterOpts) (*StickerTypeNewControllerIterator, error) { + + logs, sub, err := _StickerType.contract.FilterLogs(opts, "NewController") + if err != nil { + return nil, err + } + return &StickerTypeNewControllerIterator{contract: _StickerType.contract, event: "NewController", logs: logs, sub: sub}, nil +} + +// WatchNewController is a free log subscription operation binding the contract event 0xe253457d9ad994ca9682fc3bbc38c890dca73a2d5ecee3809e548bac8b00d7c6. +// +// Solidity: event NewController(address controller) +func (_StickerType *StickerTypeFilterer) WatchNewController(opts *bind.WatchOpts, sink chan<- *StickerTypeNewController) (event.Subscription, error) { + + logs, sub, err := _StickerType.contract.WatchLogs(opts, "NewController") + 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(StickerTypeNewController) + if err := _StickerType.contract.UnpackLog(event, "NewController", 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 +} + +// ParseNewController is a log parse operation binding the contract event 0xe253457d9ad994ca9682fc3bbc38c890dca73a2d5ecee3809e548bac8b00d7c6. +// +// Solidity: event NewController(address controller) +func (_StickerType *StickerTypeFilterer) ParseNewController(log types.Log) (*StickerTypeNewController, error) { + event := new(StickerTypeNewController) + if err := _StickerType.contract.UnpackLog(event, "NewController", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// StickerTypePriceChangedIterator is returned from FilterPriceChanged and is used to iterate over the raw logs and unpacked data for PriceChanged events raised by the StickerType contract. +type StickerTypePriceChangedIterator struct { + Event *StickerTypePriceChanged // 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 *StickerTypePriceChangedIterator) 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(StickerTypePriceChanged) + 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(StickerTypePriceChanged) + 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 *StickerTypePriceChangedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *StickerTypePriceChangedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// StickerTypePriceChanged represents a PriceChanged event raised by the StickerType contract. +type StickerTypePriceChanged struct { + PackId *big.Int + DataPrice *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterPriceChanged is a free log retrieval operation binding the contract event 0x8aa4fa52648a6d15edce8a179c792c86f3719d0cc3c572cf90f91948f0f2cb68. +// +// Solidity: event PriceChanged(uint256 indexed packId, uint256 dataPrice) +func (_StickerType *StickerTypeFilterer) FilterPriceChanged(opts *bind.FilterOpts, packId []*big.Int) (*StickerTypePriceChangedIterator, error) { + + var packIdRule []interface{} + for _, packIdItem := range packId { + packIdRule = append(packIdRule, packIdItem) + } + + logs, sub, err := _StickerType.contract.FilterLogs(opts, "PriceChanged", packIdRule) + if err != nil { + return nil, err + } + return &StickerTypePriceChangedIterator{contract: _StickerType.contract, event: "PriceChanged", logs: logs, sub: sub}, nil +} + +// WatchPriceChanged is a free log subscription operation binding the contract event 0x8aa4fa52648a6d15edce8a179c792c86f3719d0cc3c572cf90f91948f0f2cb68. +// +// Solidity: event PriceChanged(uint256 indexed packId, uint256 dataPrice) +func (_StickerType *StickerTypeFilterer) WatchPriceChanged(opts *bind.WatchOpts, sink chan<- *StickerTypePriceChanged, packId []*big.Int) (event.Subscription, error) { + + var packIdRule []interface{} + for _, packIdItem := range packId { + packIdRule = append(packIdRule, packIdItem) + } + + logs, sub, err := _StickerType.contract.WatchLogs(opts, "PriceChanged", packIdRule) + 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(StickerTypePriceChanged) + if err := _StickerType.contract.UnpackLog(event, "PriceChanged", 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 +} + +// ParsePriceChanged is a log parse operation binding the contract event 0x8aa4fa52648a6d15edce8a179c792c86f3719d0cc3c572cf90f91948f0f2cb68. +// +// Solidity: event PriceChanged(uint256 indexed packId, uint256 dataPrice) +func (_StickerType *StickerTypeFilterer) ParsePriceChanged(log types.Log) (*StickerTypePriceChanged, error) { + event := new(StickerTypePriceChanged) + if err := _StickerType.contract.UnpackLog(event, "PriceChanged", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// StickerTypeRegisterIterator is returned from FilterRegister and is used to iterate over the raw logs and unpacked data for Register events raised by the StickerType contract. +type StickerTypeRegisterIterator struct { + Event *StickerTypeRegister // 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 *StickerTypeRegisterIterator) 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(StickerTypeRegister) + 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(StickerTypeRegister) + 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 *StickerTypeRegisterIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *StickerTypeRegisterIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// StickerTypeRegister represents a Register event raised by the StickerType contract. +type StickerTypeRegister struct { + PackId *big.Int + DataPrice *big.Int + Contenthash []byte + Mintable bool + Raw types.Log // Blockchain specific contextual infos +} + +// FilterRegister is a free log retrieval operation binding the contract event 0x8304dd8a0ecd1927e64564792f1147f0aca02ba211e48c2981bf7244a9877975. +// +// Solidity: event Register(uint256 indexed packId, uint256 dataPrice, bytes contenthash, bool mintable) +func (_StickerType *StickerTypeFilterer) FilterRegister(opts *bind.FilterOpts, packId []*big.Int) (*StickerTypeRegisterIterator, error) { + + var packIdRule []interface{} + for _, packIdItem := range packId { + packIdRule = append(packIdRule, packIdItem) + } + + logs, sub, err := _StickerType.contract.FilterLogs(opts, "Register", packIdRule) + if err != nil { + return nil, err + } + return &StickerTypeRegisterIterator{contract: _StickerType.contract, event: "Register", logs: logs, sub: sub}, nil +} + +// WatchRegister is a free log subscription operation binding the contract event 0x8304dd8a0ecd1927e64564792f1147f0aca02ba211e48c2981bf7244a9877975. +// +// Solidity: event Register(uint256 indexed packId, uint256 dataPrice, bytes contenthash, bool mintable) +func (_StickerType *StickerTypeFilterer) WatchRegister(opts *bind.WatchOpts, sink chan<- *StickerTypeRegister, packId []*big.Int) (event.Subscription, error) { + + var packIdRule []interface{} + for _, packIdItem := range packId { + packIdRule = append(packIdRule, packIdItem) + } + + logs, sub, err := _StickerType.contract.WatchLogs(opts, "Register", packIdRule) + 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(StickerTypeRegister) + if err := _StickerType.contract.UnpackLog(event, "Register", 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 +} + +// ParseRegister is a log parse operation binding the contract event 0x8304dd8a0ecd1927e64564792f1147f0aca02ba211e48c2981bf7244a9877975. +// +// Solidity: event Register(uint256 indexed packId, uint256 dataPrice, bytes contenthash, bool mintable) +func (_StickerType *StickerTypeFilterer) ParseRegister(log types.Log) (*StickerTypeRegister, error) { + event := new(StickerTypeRegister) + if err := _StickerType.contract.UnpackLog(event, "Register", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// StickerTypeTransferIterator is returned from FilterTransfer and is used to iterate over the raw logs and unpacked data for Transfer events raised by the StickerType contract. +type StickerTypeTransferIterator struct { + Event *StickerTypeTransfer // 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 *StickerTypeTransferIterator) 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(StickerTypeTransfer) + 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(StickerTypeTransfer) + 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 *StickerTypeTransferIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *StickerTypeTransferIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// StickerTypeTransfer represents a Transfer event raised by the StickerType contract. +type StickerTypeTransfer struct { + From common.Address + To common.Address + TokenId *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterTransfer is a free log retrieval operation binding the contract event 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef. +// +// Solidity: event Transfer(address indexed from, address indexed to, uint256 indexed tokenId) +func (_StickerType *StickerTypeFilterer) FilterTransfer(opts *bind.FilterOpts, from []common.Address, to []common.Address, tokenId []*big.Int) (*StickerTypeTransferIterator, error) { + + var fromRule []interface{} + for _, fromItem := range from { + fromRule = append(fromRule, fromItem) + } + var toRule []interface{} + for _, toItem := range to { + toRule = append(toRule, toItem) + } + var tokenIdRule []interface{} + for _, tokenIdItem := range tokenId { + tokenIdRule = append(tokenIdRule, tokenIdItem) + } + + logs, sub, err := _StickerType.contract.FilterLogs(opts, "Transfer", fromRule, toRule, tokenIdRule) + if err != nil { + return nil, err + } + return &StickerTypeTransferIterator{contract: _StickerType.contract, event: "Transfer", logs: logs, sub: sub}, nil +} + +// WatchTransfer is a free log subscription operation binding the contract event 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef. +// +// Solidity: event Transfer(address indexed from, address indexed to, uint256 indexed tokenId) +func (_StickerType *StickerTypeFilterer) WatchTransfer(opts *bind.WatchOpts, sink chan<- *StickerTypeTransfer, from []common.Address, to []common.Address, tokenId []*big.Int) (event.Subscription, error) { + + var fromRule []interface{} + for _, fromItem := range from { + fromRule = append(fromRule, fromItem) + } + var toRule []interface{} + for _, toItem := range to { + toRule = append(toRule, toItem) + } + var tokenIdRule []interface{} + for _, tokenIdItem := range tokenId { + tokenIdRule = append(tokenIdRule, tokenIdItem) + } + + logs, sub, err := _StickerType.contract.WatchLogs(opts, "Transfer", fromRule, toRule, tokenIdRule) + 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(StickerTypeTransfer) + if err := _StickerType.contract.UnpackLog(event, "Transfer", 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 +} + +// ParseTransfer is a log parse operation binding the contract event 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef. +// +// Solidity: event Transfer(address indexed from, address indexed to, uint256 indexed tokenId) +func (_StickerType *StickerTypeFilterer) ParseTransfer(log types.Log) (*StickerTypeTransfer, error) { + event := new(StickerTypeTransfer) + if err := _StickerType.contract.UnpackLog(event, "Transfer", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// StickerTypeUncategorizedIterator is returned from FilterUncategorized and is used to iterate over the raw logs and unpacked data for Uncategorized events raised by the StickerType contract. +type StickerTypeUncategorizedIterator struct { + Event *StickerTypeUncategorized // 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 *StickerTypeUncategorizedIterator) 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(StickerTypeUncategorized) + 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(StickerTypeUncategorized) + 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 *StickerTypeUncategorizedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *StickerTypeUncategorizedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// StickerTypeUncategorized represents a Uncategorized event raised by the StickerType contract. +type StickerTypeUncategorized struct { + Category [4]byte + PackId *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterUncategorized is a free log retrieval operation binding the contract event 0x9574a9d09dc883e69228a0eea15ed4da6e520b13cc84cca994c1787c234d78fe. +// +// Solidity: event Uncategorized(bytes4 indexed category, uint256 indexed packId) +func (_StickerType *StickerTypeFilterer) FilterUncategorized(opts *bind.FilterOpts, category [][4]byte, packId []*big.Int) (*StickerTypeUncategorizedIterator, error) { + + var categoryRule []interface{} + for _, categoryItem := range category { + categoryRule = append(categoryRule, categoryItem) + } + var packIdRule []interface{} + for _, packIdItem := range packId { + packIdRule = append(packIdRule, packIdItem) + } + + logs, sub, err := _StickerType.contract.FilterLogs(opts, "Uncategorized", categoryRule, packIdRule) + if err != nil { + return nil, err + } + return &StickerTypeUncategorizedIterator{contract: _StickerType.contract, event: "Uncategorized", logs: logs, sub: sub}, nil +} + +// WatchUncategorized is a free log subscription operation binding the contract event 0x9574a9d09dc883e69228a0eea15ed4da6e520b13cc84cca994c1787c234d78fe. +// +// Solidity: event Uncategorized(bytes4 indexed category, uint256 indexed packId) +func (_StickerType *StickerTypeFilterer) WatchUncategorized(opts *bind.WatchOpts, sink chan<- *StickerTypeUncategorized, category [][4]byte, packId []*big.Int) (event.Subscription, error) { + + var categoryRule []interface{} + for _, categoryItem := range category { + categoryRule = append(categoryRule, categoryItem) + } + var packIdRule []interface{} + for _, packIdItem := range packId { + packIdRule = append(packIdRule, packIdItem) + } + + logs, sub, err := _StickerType.contract.WatchLogs(opts, "Uncategorized", categoryRule, packIdRule) + 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(StickerTypeUncategorized) + if err := _StickerType.contract.UnpackLog(event, "Uncategorized", 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 +} + +// ParseUncategorized is a log parse operation binding the contract event 0x9574a9d09dc883e69228a0eea15ed4da6e520b13cc84cca994c1787c234d78fe. +// +// Solidity: event Uncategorized(bytes4 indexed category, uint256 indexed packId) +func (_StickerType *StickerTypeFilterer) ParseUncategorized(log types.Log) (*StickerTypeUncategorized, error) { + event := new(StickerTypeUncategorized) + if err := _StickerType.contract.UnpackLog(event, "Uncategorized", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// StickerTypeUnregisterIterator is returned from FilterUnregister and is used to iterate over the raw logs and unpacked data for Unregister events raised by the StickerType contract. +type StickerTypeUnregisterIterator struct { + Event *StickerTypeUnregister // 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 *StickerTypeUnregisterIterator) 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(StickerTypeUnregister) + 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(StickerTypeUnregister) + 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 *StickerTypeUnregisterIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *StickerTypeUnregisterIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// StickerTypeUnregister represents a Unregister event raised by the StickerType contract. +type StickerTypeUnregister struct { + PackId *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterUnregister is a free log retrieval operation binding the contract event 0x98f986773731debbbf041b73d7edaec62da3ff42b2116c45cd0001fb40ed9086. +// +// Solidity: event Unregister(uint256 indexed packId) +func (_StickerType *StickerTypeFilterer) FilterUnregister(opts *bind.FilterOpts, packId []*big.Int) (*StickerTypeUnregisterIterator, error) { + + var packIdRule []interface{} + for _, packIdItem := range packId { + packIdRule = append(packIdRule, packIdItem) + } + + logs, sub, err := _StickerType.contract.FilterLogs(opts, "Unregister", packIdRule) + if err != nil { + return nil, err + } + return &StickerTypeUnregisterIterator{contract: _StickerType.contract, event: "Unregister", logs: logs, sub: sub}, nil +} + +// WatchUnregister is a free log subscription operation binding the contract event 0x98f986773731debbbf041b73d7edaec62da3ff42b2116c45cd0001fb40ed9086. +// +// Solidity: event Unregister(uint256 indexed packId) +func (_StickerType *StickerTypeFilterer) WatchUnregister(opts *bind.WatchOpts, sink chan<- *StickerTypeUnregister, packId []*big.Int) (event.Subscription, error) { + + var packIdRule []interface{} + for _, packIdItem := range packId { + packIdRule = append(packIdRule, packIdItem) + } + + logs, sub, err := _StickerType.contract.WatchLogs(opts, "Unregister", packIdRule) + 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(StickerTypeUnregister) + if err := _StickerType.contract.UnpackLog(event, "Unregister", 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 +} + +// ParseUnregister is a log parse operation binding the contract event 0x98f986773731debbbf041b73d7edaec62da3ff42b2116c45cd0001fb40ed9086. +// +// Solidity: event Unregister(uint256 indexed packId) +func (_StickerType *StickerTypeFilterer) ParseUnregister(log types.Log) (*StickerTypeUnregister, error) { + event := new(StickerTypeUnregister) + if err := _StickerType.contract.UnpackLog(event, "Unregister", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// TokenClaimerABI is the input ABI used to generate the binding from. +const TokenClaimerABI = "[{\"constant\":false,\"inputs\":[{\"name\":\"_token\",\"type\":\"address\"}],\"name\":\"claimTokens\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"_token\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"_controller\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"ClaimedTokens\",\"type\":\"event\"}]" + +// TokenClaimerFuncSigs maps the 4-byte function signature to its string representation. +var TokenClaimerFuncSigs = map[string]string{ + "df8de3e7": "claimTokens(address)", +} + +// TokenClaimer is an auto generated Go binding around an Ethereum contract. +type TokenClaimer struct { + TokenClaimerCaller // Read-only binding to the contract + TokenClaimerTransactor // Write-only binding to the contract + TokenClaimerFilterer // Log filterer for contract events +} + +// TokenClaimerCaller is an auto generated read-only Go binding around an Ethereum contract. +type TokenClaimerCaller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// TokenClaimerTransactor is an auto generated write-only Go binding around an Ethereum contract. +type TokenClaimerTransactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// TokenClaimerFilterer is an auto generated log filtering Go binding around an Ethereum contract events. +type TokenClaimerFilterer struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// TokenClaimerSession is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type TokenClaimerSession struct { + Contract *TokenClaimer // 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 +} + +// TokenClaimerCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type TokenClaimerCallerSession struct { + Contract *TokenClaimerCaller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// TokenClaimerTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type TokenClaimerTransactorSession struct { + Contract *TokenClaimerTransactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// TokenClaimerRaw is an auto generated low-level Go binding around an Ethereum contract. +type TokenClaimerRaw struct { + Contract *TokenClaimer // Generic contract binding to access the raw methods on +} + +// TokenClaimerCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type TokenClaimerCallerRaw struct { + Contract *TokenClaimerCaller // Generic read-only contract binding to access the raw methods on +} + +// TokenClaimerTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type TokenClaimerTransactorRaw struct { + Contract *TokenClaimerTransactor // Generic write-only contract binding to access the raw methods on +} + +// NewTokenClaimer creates a new instance of TokenClaimer, bound to a specific deployed contract. +func NewTokenClaimer(address common.Address, backend bind.ContractBackend) (*TokenClaimer, error) { + contract, err := bindTokenClaimer(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &TokenClaimer{TokenClaimerCaller: TokenClaimerCaller{contract: contract}, TokenClaimerTransactor: TokenClaimerTransactor{contract: contract}, TokenClaimerFilterer: TokenClaimerFilterer{contract: contract}}, nil +} + +// NewTokenClaimerCaller creates a new read-only instance of TokenClaimer, bound to a specific deployed contract. +func NewTokenClaimerCaller(address common.Address, caller bind.ContractCaller) (*TokenClaimerCaller, error) { + contract, err := bindTokenClaimer(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &TokenClaimerCaller{contract: contract}, nil +} + +// NewTokenClaimerTransactor creates a new write-only instance of TokenClaimer, bound to a specific deployed contract. +func NewTokenClaimerTransactor(address common.Address, transactor bind.ContractTransactor) (*TokenClaimerTransactor, error) { + contract, err := bindTokenClaimer(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &TokenClaimerTransactor{contract: contract}, nil +} + +// NewTokenClaimerFilterer creates a new log filterer instance of TokenClaimer, bound to a specific deployed contract. +func NewTokenClaimerFilterer(address common.Address, filterer bind.ContractFilterer) (*TokenClaimerFilterer, error) { + contract, err := bindTokenClaimer(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &TokenClaimerFilterer{contract: contract}, nil +} + +// bindTokenClaimer binds a generic wrapper to an already deployed contract. +func bindTokenClaimer(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := abi.JSON(strings.NewReader(TokenClaimerABI)) + 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 (_TokenClaimer *TokenClaimerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _TokenClaimer.Contract.TokenClaimerCaller.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 (_TokenClaimer *TokenClaimerRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _TokenClaimer.Contract.TokenClaimerTransactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_TokenClaimer *TokenClaimerRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _TokenClaimer.Contract.TokenClaimerTransactor.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 (_TokenClaimer *TokenClaimerCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _TokenClaimer.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 (_TokenClaimer *TokenClaimerTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _TokenClaimer.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_TokenClaimer *TokenClaimerTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _TokenClaimer.Contract.contract.Transact(opts, method, params...) +} + +// ClaimTokens is a paid mutator transaction binding the contract method 0xdf8de3e7. +// +// Solidity: function claimTokens(address _token) returns() +func (_TokenClaimer *TokenClaimerTransactor) ClaimTokens(opts *bind.TransactOpts, _token common.Address) (*types.Transaction, error) { + return _TokenClaimer.contract.Transact(opts, "claimTokens", _token) +} + +// ClaimTokens is a paid mutator transaction binding the contract method 0xdf8de3e7. +// +// Solidity: function claimTokens(address _token) returns() +func (_TokenClaimer *TokenClaimerSession) ClaimTokens(_token common.Address) (*types.Transaction, error) { + return _TokenClaimer.Contract.ClaimTokens(&_TokenClaimer.TransactOpts, _token) +} + +// ClaimTokens is a paid mutator transaction binding the contract method 0xdf8de3e7. +// +// Solidity: function claimTokens(address _token) returns() +func (_TokenClaimer *TokenClaimerTransactorSession) ClaimTokens(_token common.Address) (*types.Transaction, error) { + return _TokenClaimer.Contract.ClaimTokens(&_TokenClaimer.TransactOpts, _token) +} + +// TokenClaimerClaimedTokensIterator is returned from FilterClaimedTokens and is used to iterate over the raw logs and unpacked data for ClaimedTokens events raised by the TokenClaimer contract. +type TokenClaimerClaimedTokensIterator struct { + Event *TokenClaimerClaimedTokens // 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 *TokenClaimerClaimedTokensIterator) 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(TokenClaimerClaimedTokens) + 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(TokenClaimerClaimedTokens) + 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 *TokenClaimerClaimedTokensIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *TokenClaimerClaimedTokensIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// TokenClaimerClaimedTokens represents a ClaimedTokens event raised by the TokenClaimer contract. +type TokenClaimerClaimedTokens struct { + Token common.Address + Controller common.Address + Amount *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterClaimedTokens is a free log retrieval operation binding the contract event 0xf931edb47c50b4b4104c187b5814a9aef5f709e17e2ecf9617e860cacade929c. +// +// Solidity: event ClaimedTokens(address indexed _token, address indexed _controller, uint256 _amount) +func (_TokenClaimer *TokenClaimerFilterer) FilterClaimedTokens(opts *bind.FilterOpts, _token []common.Address, _controller []common.Address) (*TokenClaimerClaimedTokensIterator, error) { + + var _tokenRule []interface{} + for _, _tokenItem := range _token { + _tokenRule = append(_tokenRule, _tokenItem) + } + var _controllerRule []interface{} + for _, _controllerItem := range _controller { + _controllerRule = append(_controllerRule, _controllerItem) + } + + logs, sub, err := _TokenClaimer.contract.FilterLogs(opts, "ClaimedTokens", _tokenRule, _controllerRule) + if err != nil { + return nil, err + } + return &TokenClaimerClaimedTokensIterator{contract: _TokenClaimer.contract, event: "ClaimedTokens", logs: logs, sub: sub}, nil +} + +// WatchClaimedTokens is a free log subscription operation binding the contract event 0xf931edb47c50b4b4104c187b5814a9aef5f709e17e2ecf9617e860cacade929c. +// +// Solidity: event ClaimedTokens(address indexed _token, address indexed _controller, uint256 _amount) +func (_TokenClaimer *TokenClaimerFilterer) WatchClaimedTokens(opts *bind.WatchOpts, sink chan<- *TokenClaimerClaimedTokens, _token []common.Address, _controller []common.Address) (event.Subscription, error) { + + var _tokenRule []interface{} + for _, _tokenItem := range _token { + _tokenRule = append(_tokenRule, _tokenItem) + } + var _controllerRule []interface{} + for _, _controllerItem := range _controller { + _controllerRule = append(_controllerRule, _controllerItem) + } + + logs, sub, err := _TokenClaimer.contract.WatchLogs(opts, "ClaimedTokens", _tokenRule, _controllerRule) + 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(TokenClaimerClaimedTokens) + if err := _TokenClaimer.contract.UnpackLog(event, "ClaimedTokens", 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 +} + +// ParseClaimedTokens is a log parse operation binding the contract event 0xf931edb47c50b4b4104c187b5814a9aef5f709e17e2ecf9617e860cacade929c. +// +// Solidity: event ClaimedTokens(address indexed _token, address indexed _controller, uint256 _amount) +func (_TokenClaimer *TokenClaimerFilterer) ParseClaimedTokens(log types.Log) (*TokenClaimerClaimedTokens, error) { + event := new(TokenClaimerClaimedTokens) + if err := _TokenClaimer.contract.UnpackLog(event, "ClaimedTokens", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} diff --git a/contracts/stickers/contracts.sol b/contracts/stickers/contracts.sol new file mode 100644 index 000000000..7a94ce351 --- /dev/null +++ b/contracts/stickers/contracts.sol @@ -0,0 +1,1948 @@ +pragma solidity ^0.5.0; + +/** + * @dev Wrappers over Solidity's arithmetic operations with added overflow + * checks. + * + * Arithmetic operations in Solidity wrap on overflow. This can easily result + * in bugs, because programmers usually assume that an overflow raises an + * error, which is the standard behavior in high level programming languages. + * `SafeMath` restores this intuition by reverting the transaction when an + * operation overflows. + * + * Using this library instead of the unchecked operations eliminates an entire + * class of bugs, so it's recommended to use it always. + */ +library SafeMath { + /** + * @dev Returns the addition of two unsigned integers, reverting on + * overflow. + * + * Counterpart to Solidity's `+` operator. + * + * Requirements: + * - Addition cannot overflow. + */ + function add(uint256 a, uint256 b) internal pure returns (uint256) { + uint256 c = a + b; + require(c >= a, "SafeMath: addition overflow"); + + return c; + } + + /** + * @dev Returns the subtraction of two unsigned integers, reverting on + * overflow (when the result is negative). + * + * Counterpart to Solidity's `-` operator. + * + * Requirements: + * - Subtraction cannot overflow. + */ + function sub(uint256 a, uint256 b) internal pure returns (uint256) { + require(b <= a, "SafeMath: subtraction overflow"); + uint256 c = a - b; + + return c; + } + + /** + * @dev Returns the multiplication of two unsigned integers, reverting on + * overflow. + * + * Counterpart to Solidity's `*` operator. + * + * Requirements: + * - Multiplication cannot overflow. + */ + function mul(uint256 a, uint256 b) internal pure returns (uint256) { + // Gas optimization: this is cheaper than requiring 'a' not being zero, but the + // benefit is lost if 'b' is also tested. + // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522 + if (a == 0) { + return 0; + } + + uint256 c = a * b; + require(c / a == b, "SafeMath: multiplication overflow"); + + return c; + } + + /** + * @dev Returns the integer division of two unsigned integers. Reverts on + * division by zero. The result is rounded towards zero. + * + * Counterpart to Solidity's `/` operator. Note: this function uses a + * `revert` opcode (which leaves remaining gas untouched) while Solidity + * uses an invalid opcode to revert (consuming all remaining gas). + * + * Requirements: + * - The divisor cannot be zero. + */ + function div(uint256 a, uint256 b) internal pure returns (uint256) { + // Solidity only automatically asserts when dividing by 0 + require(b > 0, "SafeMath: division by zero"); + uint256 c = a / b; + // assert(a == b * c + a % b); // There is no case in which this doesn't hold + + return c; + } + + /** + * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), + * Reverts when dividing by zero. + * + * Counterpart to Solidity's `%` operator. This function uses a `revert` + * opcode (which leaves remaining gas untouched) while Solidity uses an + * invalid opcode to revert (consuming all remaining gas). + * + * Requirements: + * - The divisor cannot be zero. + */ + function mod(uint256 a, uint256 b) internal pure returns (uint256) { + require(b != 0, "SafeMath: modulo by zero"); + return a % b; + } +} + + +/** + * @dev Collection of functions related to the address type, + */ +library Address { + /** + * @dev Returns true if `account` is a contract. + * + * This test is non-exhaustive, and there may be false-negatives: during the + * execution of a contract's constructor, its address will be reported as + * not containing a contract. + * + * > It is unsafe to assume that an address for which this function returns + * false is an externally-owned account (EOA) and not a contract. + */ + function isContract(address account) internal view returns (bool) { + // This method relies in extcodesize, which returns 0 for contracts in + // construction, since the code is only stored at the end of the + // constructor execution. + + uint256 size; + // solhint-disable-next-line no-inline-assembly + assembly { size := extcodesize(account) } + return size > 0; + } +} + + +contract Controlled { + event NewController(address controller); + /// @notice The address of the controller is the only address that can call + /// a function with this modifier + modifier onlyController { + require(msg.sender == controller, "Unauthorized"); + _; + } + + address payable public controller; + + constructor() internal { + controller = msg.sender; + } + + /// @notice Changes the controller of the contract + /// @param _newController The new controller of the contract + function changeController(address payable _newController) public onlyController { + controller = _newController; + emit NewController(_newController); + } +} + + +// Abstract contract for the full ERC 20 Token standard +// https://github.com/ethereum/EIPs/issues/20 + +interface ERC20Token { + + /** + * @notice send `_value` token to `_to` from `msg.sender` + * @param _to The address of the recipient + * @param _value The amount of token to be transferred + * @return Whether the transfer was successful or not + */ + function transfer(address _to, uint256 _value) external returns (bool success); + + /** + * @notice `msg.sender` approves `_spender` to spend `_value` tokens + * @param _spender The address of the account able to transfer the tokens + * @param _value The amount of tokens to be approved for transfer + * @return Whether the approval was successful or not + */ + function approve(address _spender, uint256 _value) external returns (bool success); + + /** + * @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from` + * @param _from The address of the sender + * @param _to The address of the recipient + * @param _value The amount of token to be transferred + * @return Whether the transfer was successful or not + */ + function transferFrom(address _from, address _to, uint256 _value) external returns (bool success); + + /** + * @param _owner The address from which the balance will be retrieved + * @return The balance + */ + function balanceOf(address _owner) external view returns (uint256 balance); + + /** + * @param _owner The address of the account owning tokens + * @param _spender The address of the account able to transfer the tokens + * @return Amount of remaining tokens allowed to spent + */ + function allowance(address _owner, address _spender) external view returns (uint256 remaining); + + /** + * @notice return total supply of tokens + */ + function totalSupply() external view returns (uint256 supply); + + event Transfer(address indexed from, address indexed to, uint256 value); + event Approval(address indexed owner, address indexed spender, uint256 value); +} + + +/** + * @dev Interface of the ERC165 standard, as defined in the + * [EIP](https://eips.ethereum.org/EIPS/eip-165). + * + * Implementers can declare support of contract interfaces, which can then be + * queried by others (`ERC165Checker`). + * + * For an implementation, see `ERC165`. + */ +interface IERC165 { + /** + * @dev Returns true if this contract implements the interface defined by + * `interfaceId`. See the corresponding + * [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified) + * to learn more about how these ids are created. + * + * This function call must use less than 30 000 gas. + */ + function supportsInterface(bytes4 interfaceId) external view returns (bool); +} + + +/** + * @title ERC721 token receiver interface + * @dev Interface for any contract that wants to support safeTransfers + * from ERC721 asset contracts. + */ +contract IERC721Receiver { + /** + * @notice Handle the receipt of an NFT + * @dev The ERC721 smart contract calls this function on the recipient + * after a `safeTransfer`. This function MUST return the function selector, + * otherwise the caller will revert the transaction. The selector to be + * returned can be obtained as `this.onERC721Received.selector`. This + * function MAY throw to revert and reject the transfer. + * Note: the ERC721 contract address is always the message sender. + * @param operator The address which called `safeTransferFrom` function + * @param from The address which previously owned the token + * @param tokenId The NFT identifier which is being transferred + * @param data Additional data with no specified format + * @return bytes4 `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))` + */ + function onERC721Received(address operator, address from, uint256 tokenId, bytes memory data) + public returns (bytes4); +} + + +/** + * @title Counters + * @author Matt Condon (@shrugs) + * @dev Provides counters that can only be incremented or decremented by one. This can be used e.g. to track the number + * of elements in a mapping, issuing ERC721 ids, or counting request ids. + * + * Include with `using Counters for Counters.Counter;` + * Since it is not possible to overflow a 256 bit integer with increments of one, `increment` can skip the SafeMath + * overflow check, thereby saving gas. This does assume however correct usage, in that the underlying `_value` is never + * directly accessed. + */ +library Counters { + using SafeMath for uint256; + + struct Counter { + // This variable should never be directly accessed by users of the library: interactions must be restricted to + // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add + // this feature: see https://github.com/ethereum/solidity/issues/4637 + uint256 _value; // default: 0 + } + + function current(Counter storage counter) internal view returns (uint256) { + return counter._value; + } + + function increment(Counter storage counter) internal { + counter._value += 1; + } + + function decrement(Counter storage counter) internal { + counter._value = counter._value.sub(1); + } +} + + +/** + * @dev Implementation of the `IERC165` interface. + * + * Contracts may inherit from this and call `_registerInterface` to declare + * their support of an interface. + */ +contract ERC165 is IERC165 { + /* + * bytes4(keccak256('supportsInterface(bytes4)')) == 0x01ffc9a7 + */ + bytes4 private constant _INTERFACE_ID_ERC165 = 0x01ffc9a7; + + /** + * @dev Mapping of interface ids to whether or not it's supported. + */ + mapping(bytes4 => bool) private _supportedInterfaces; + + constructor () internal { + // Derived contracts need only register support for their own interfaces, + // we register support for ERC165 itself here + _registerInterface(_INTERFACE_ID_ERC165); + } + + /** + * @dev See `IERC165.supportsInterface`. + * + * Time complexity O(1), guaranteed to always use less than 30 000 gas. + */ + function supportsInterface(bytes4 interfaceId) external view returns (bool) { + return _supportedInterfaces[interfaceId]; + } + + /** + * @dev Registers the contract as an implementer of the interface defined by + * `interfaceId`. Support of the actual ERC165 interface is automatic and + * registering its interface id is not required. + * + * See `IERC165.supportsInterface`. + * + * Requirements: + * + * - `interfaceId` cannot be the ERC165 invalid interface (`0xffffffff`). + */ + function _registerInterface(bytes4 interfaceId) internal { + require(interfaceId != 0xffffffff, "ERC165: invalid interface id"); + _supportedInterfaces[interfaceId] = true; + } +} + + +contract ERC20Receiver { + + event TokenDeposited(address indexed token, address indexed sender, uint256 amount); + event TokenWithdrawn(address indexed token, address indexed sender, uint256 amount); + + mapping (address => mapping(address => uint256)) tokenBalances; + + constructor() public { + } + + function depositToken( + ERC20Token _token + ) + external + { + _depositToken( + msg.sender, + _token, + _token.allowance( + msg.sender, + address(this) + ) + ); + } + + function withdrawToken( + ERC20Token _token, + uint256 _amount + ) + external + { + _withdrawToken(msg.sender, _token, _amount); + } + + function depositToken( + ERC20Token _token, + uint256 _amount + ) + external + { + require(_token.allowance(msg.sender, address(this)) >= _amount, "Bad argument"); + _depositToken(msg.sender, _token, _amount); + } + + function tokenBalanceOf( + ERC20Token _token, + address _from + ) + external + view + returns(uint256 fromTokenBalance) + { + return tokenBalances[address(_token)][_from]; + } + + function _depositToken( + address _from, + ERC20Token _token, + uint256 _amount + ) + private + { + require(_amount > 0, "Bad argument"); + if (_token.transferFrom(_from, address(this), _amount)) { + tokenBalances[address(_token)][_from] += _amount; + emit TokenDeposited(address(_token), _from, _amount); + } + } + + function _withdrawToken( + address _from, + ERC20Token _token, + uint256 _amount + ) + private + { + require(_amount > 0, "Bad argument"); + require(tokenBalances[address(_token)][_from] >= _amount, "Insufficient funds"); + tokenBalances[address(_token)][_from] -= _amount; + require(_token.transfer(_from, _amount), "Transfer fail"); + emit TokenWithdrawn(address(_token), _from, _amount); + } + +} + + +/** + * @dev Required interface of an ERC721 compliant contract. + */ +contract IERC721 is IERC165 { + event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); + event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); + event ApprovalForAll(address indexed owner, address indexed operator, bool approved); + + /** + * @dev Returns the number of NFTs in `owner`'s account. + */ + function balanceOf(address owner) public view returns (uint256 balance); + + /** + * @dev Returns the owner of the NFT specified by `tokenId`. + */ + function ownerOf(uint256 tokenId) public view returns (address owner); + + /** + * @dev Transfers a specific NFT (`tokenId`) from one account (`from`) to + * another (`to`). + * + * + * + * Requirements: + * - `from`, `to` cannot be zero. + * - `tokenId` must be owned by `from`. + * - If the caller is not `from`, it must be have been allowed to move this + * NFT by either `approve` or `setApproveForAll`. + */ + function safeTransferFrom(address from, address to, uint256 tokenId) public; + /** + * @dev Transfers a specific NFT (`tokenId`) from one account (`from`) to + * another (`to`). + * + * Requirements: + * - If the caller is not `from`, it must be approved to move this NFT by + * either `approve` or `setApproveForAll`. + */ + function transferFrom(address from, address to, uint256 tokenId) public; + function approve(address to, uint256 tokenId) public; + function getApproved(uint256 tokenId) public view returns (address operator); + + function setApprovalForAll(address operator, bool _approved) public; + function isApprovedForAll(address owner, address operator) public view returns (bool); + + + function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public; +} + + +/** + * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension + * @dev See https://eips.ethereum.org/EIPS/eip-721 + */ +contract IERC721Enumerable is IERC721 { + function totalSupply() public view returns (uint256); + function tokenOfOwnerByIndex(address owner, uint256 index) public view returns (uint256 tokenId); + + function tokenByIndex(uint256 index) public view returns (uint256); +} + + +/** + * @title ERC-721 Non-Fungible Token Standard, optional metadata extension + * @dev See https://eips.ethereum.org/EIPS/eip-721 + */ +contract IERC721Metadata is IERC721 { + function name() external view returns (string memory); + function symbol() external view returns (string memory); + function tokenURI(uint256 tokenId) external view returns (string memory); +} + + +contract TokenClaimer { + event ClaimedTokens(address indexed _token, address indexed _controller, uint256 _amount); + + function claimTokens(address _token) external; + /** + * @notice This method can be used by the controller to extract mistakenly + * sent tokens to this contract. + * @param _token The address of the token contract that you want to recover + * set to 0 in case you want to extract ether. + */ + function withdrawBalance(address _token, address payable _destination) + internal + { + uint256 balance; + if (_token == address(0)) { + balance = address(this).balance; + address(_destination).transfer(balance); + } else { + ERC20Token token = ERC20Token(_token); + balance = token.balanceOf(address(this)); + token.transfer(_destination, balance); + } + emit ClaimedTokens(_token, _destination, balance); + } +} + + +/** + * @title ERC721 Non-Fungible Token Standard basic implementation + * @dev see https://eips.ethereum.org/EIPS/eip-721 + */ +contract ERC721 is ERC165, IERC721 { + using SafeMath for uint256; + using Address for address; + using Counters for Counters.Counter; + + // Equals to `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))` + // which can be also obtained as `IERC721Receiver(0).onERC721Received.selector` + bytes4 private constant _ERC721_RECEIVED = 0x150b7a02; + + // Mapping from token ID to owner + mapping (uint256 => address) private _tokenOwner; + + // Mapping from token ID to approved address + mapping (uint256 => address) private _tokenApprovals; + + // Mapping from owner to number of owned token + mapping (address => Counters.Counter) private _ownedTokensCount; + + // Mapping from owner to operator approvals + mapping (address => mapping (address => bool)) private _operatorApprovals; + + /* + * bytes4(keccak256('balanceOf(address)')) == 0x70a08231 + * bytes4(keccak256('ownerOf(uint256)')) == 0x6352211e + * bytes4(keccak256('approve(address,uint256)')) == 0x095ea7b3 + * bytes4(keccak256('getApproved(uint256)')) == 0x081812fc + * bytes4(keccak256('setApprovalForAll(address,bool)')) == 0xa22cb465 + * bytes4(keccak256('isApprovedForAll(address,address)')) == 0xe985e9c + * bytes4(keccak256('transferFrom(address,address,uint256)')) == 0x23b872dd + * bytes4(keccak256('safeTransferFrom(address,address,uint256)')) == 0x42842e0e + * bytes4(keccak256('safeTransferFrom(address,address,uint256,bytes)')) == 0xb88d4fde + * + * => 0x70a08231 ^ 0x6352211e ^ 0x095ea7b3 ^ 0x081812fc ^ + * 0xa22cb465 ^ 0xe985e9c ^ 0x23b872dd ^ 0x42842e0e ^ 0xb88d4fde == 0x80ac58cd + */ + bytes4 private constant _INTERFACE_ID_ERC721 = 0x80ac58cd; + + constructor () public { + // register the supported interfaces to conform to ERC721 via ERC165 + _registerInterface(_INTERFACE_ID_ERC721); + } + + /** + * @dev Gets the balance of the specified address. + * @param owner address to query the balance of + * @return uint256 representing the amount owned by the passed address + */ + function balanceOf(address owner) public view returns (uint256) { + require(owner != address(0), "ERC721: balance query for the zero address"); + + return _ownedTokensCount[owner].current(); + } + + /** + * @dev Gets the owner of the specified token ID. + * @param tokenId uint256 ID of the token to query the owner of + * @return address currently marked as the owner of the given token ID + */ + function ownerOf(uint256 tokenId) public view returns (address) { + address owner = _tokenOwner[tokenId]; + require(owner != address(0), "ERC721: owner query for nonexistent token"); + + return owner; + } + + /** + * @dev Approves another address to transfer the given token ID + * The zero address indicates there is no approved address. + * There can only be one approved address per token at a given time. + * Can only be called by the token owner or an approved operator. + * @param to address to be approved for the given token ID + * @param tokenId uint256 ID of the token to be approved + */ + function approve(address to, uint256 tokenId) public { + address owner = ownerOf(tokenId); + require(to != owner, "ERC721: approval to current owner"); + + require(msg.sender == owner || isApprovedForAll(owner, msg.sender), + "ERC721: approve caller is not owner nor approved for all" + ); + + _tokenApprovals[tokenId] = to; + emit Approval(owner, to, tokenId); + } + + /** + * @dev Gets the approved address for a token ID, or zero if no address set + * Reverts if the token ID does not exist. + * @param tokenId uint256 ID of the token to query the approval of + * @return address currently approved for the given token ID + */ + function getApproved(uint256 tokenId) public view returns (address) { + require(_exists(tokenId), "ERC721: approved query for nonexistent token"); + + return _tokenApprovals[tokenId]; + } + + /** + * @dev Sets or unsets the approval of a given operator + * An operator is allowed to transfer all tokens of the sender on their behalf. + * @param to operator address to set the approval + * @param approved representing the status of the approval to be set + */ + function setApprovalForAll(address to, bool approved) public { + require(to != msg.sender, "ERC721: approve to caller"); + + _operatorApprovals[msg.sender][to] = approved; + emit ApprovalForAll(msg.sender, to, approved); + } + + /** + * @dev Tells whether an operator is approved by a given owner. + * @param owner owner address which you want to query the approval of + * @param operator operator address which you want to query the approval of + * @return bool whether the given operator is approved by the given owner + */ + function isApprovedForAll(address owner, address operator) public view returns (bool) { + return _operatorApprovals[owner][operator]; + } + + /** + * @dev Transfers the ownership of a given token ID to another address. + * Usage of this method is discouraged, use `safeTransferFrom` whenever possible. + * Requires the msg.sender to be the owner, approved, or operator. + * @param from current owner of the token + * @param to address to receive the ownership of the given token ID + * @param tokenId uint256 ID of the token to be transferred + */ + function transferFrom(address from, address to, uint256 tokenId) public { + //solhint-disable-next-line max-line-length + require(_isApprovedOrOwner(msg.sender, tokenId), "ERC721: transfer caller is not owner nor approved"); + + _transferFrom(from, to, tokenId); + } + + /** + * @dev Safely transfers the ownership of a given token ID to another address + * If the target address is a contract, it must implement `onERC721Received`, + * which is called upon a safe transfer, and return the magic value + * `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`; otherwise, + * the transfer is reverted. + * Requires the msg.sender to be the owner, approved, or operator + * @param from current owner of the token + * @param to address to receive the ownership of the given token ID + * @param tokenId uint256 ID of the token to be transferred + */ + function safeTransferFrom(address from, address to, uint256 tokenId) public { + safeTransferFrom(from, to, tokenId, ""); + } + + /** + * @dev Safely transfers the ownership of a given token ID to another address + * If the target address is a contract, it must implement `onERC721Received`, + * which is called upon a safe transfer, and return the magic value + * `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`; otherwise, + * the transfer is reverted. + * Requires the msg.sender to be the owner, approved, or operator + * @param from current owner of the token + * @param to address to receive the ownership of the given token ID + * @param tokenId uint256 ID of the token to be transferred + * @param _data bytes data to send along with a safe transfer check + */ + function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory _data) public { + transferFrom(from, to, tokenId); + require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); + } + + /** + * @dev Returns whether the specified token exists. + * @param tokenId uint256 ID of the token to query the existence of + * @return bool whether the token exists + */ + function _exists(uint256 tokenId) internal view returns (bool) { + address owner = _tokenOwner[tokenId]; + return owner != address(0); + } + + /** + * @dev Returns whether the given spender can transfer a given token ID. + * @param spender address of the spender to query + * @param tokenId uint256 ID of the token to be transferred + * @return bool whether the msg.sender is approved for the given token ID, + * is an operator of the owner, or is the owner of the token + */ + function _isApprovedOrOwner(address spender, uint256 tokenId) internal view returns (bool) { + require(_exists(tokenId), "ERC721: operator query for nonexistent token"); + address owner = ownerOf(tokenId); + return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender)); + } + + /** + * @dev Internal function to mint a new token. + * Reverts if the given token ID already exists. + * @param to The address that will own the minted token + * @param tokenId uint256 ID of the token to be minted + */ + function _mint(address to, uint256 tokenId) internal { + require(to != address(0), "ERC721: mint to the zero address"); + require(!_exists(tokenId), "ERC721: token already minted"); + + _tokenOwner[tokenId] = to; + _ownedTokensCount[to].increment(); + + emit Transfer(address(0), to, tokenId); + } + + /** + * @dev Internal function to burn a specific token. + * Reverts if the token does not exist. + * Deprecated, use _burn(uint256) instead. + * @param owner owner of the token to burn + * @param tokenId uint256 ID of the token being burned + */ + function _burn(address owner, uint256 tokenId) internal { + require(ownerOf(tokenId) == owner, "ERC721: burn of token that is not own"); + + _clearApproval(tokenId); + + _ownedTokensCount[owner].decrement(); + _tokenOwner[tokenId] = address(0); + + emit Transfer(owner, address(0), tokenId); + } + + /** + * @dev Internal function to burn a specific token. + * Reverts if the token does not exist. + * @param tokenId uint256 ID of the token being burned + */ + function _burn(uint256 tokenId) internal { + _burn(ownerOf(tokenId), tokenId); + } + + /** + * @dev Internal function to transfer ownership of a given token ID to another address. + * As opposed to transferFrom, this imposes no restrictions on msg.sender. + * @param from current owner of the token + * @param to address to receive the ownership of the given token ID + * @param tokenId uint256 ID of the token to be transferred + */ + function _transferFrom(address from, address to, uint256 tokenId) internal { + require(ownerOf(tokenId) == from, "ERC721: transfer of token that is not own"); + require(to != address(0), "ERC721: transfer to the zero address"); + + _clearApproval(tokenId); + + _ownedTokensCount[from].decrement(); + _ownedTokensCount[to].increment(); + + _tokenOwner[tokenId] = to; + + emit Transfer(from, to, tokenId); + } + + /** + * @dev Internal function to invoke `onERC721Received` on a target address. + * The call is not executed if the target address is not a contract. + * + * This function is deprecated. + * @param from address representing the previous owner of the given token ID + * @param to target address that will receive the tokens + * @param tokenId uint256 ID of the token to be transferred + * @param _data bytes optional data to send along with the call + * @return bool whether the call correctly returned the expected magic value + */ + function _checkOnERC721Received(address from, address to, uint256 tokenId, bytes memory _data) + internal returns (bool) + { + if (!to.isContract()) { + return true; + } + + bytes4 retval = IERC721Receiver(to).onERC721Received(msg.sender, from, tokenId, _data); + return (retval == _ERC721_RECEIVED); + } + + /** + * @dev Private function to clear current approval of a given token ID. + * @param tokenId uint256 ID of the token to be transferred + */ + function _clearApproval(uint256 tokenId) private { + if (_tokenApprovals[tokenId] != address(0)) { + _tokenApprovals[tokenId] = address(0); + } + } +} + + +/** + * @title ERC-721 Non-Fungible Token Standard, full implementation interface + * @dev See https://eips.ethereum.org/EIPS/eip-721 + */ +contract IERC721Full is IERC721, IERC721Enumerable, IERC721Metadata { + // solhint-disable-previous-line no-empty-blocks +} + + +/** + * @title ERC-721 Non-Fungible Token with optional enumeration extension logic + * @dev See https://eips.ethereum.org/EIPS/eip-721 + */ +contract ERC721Enumerable is ERC165, ERC721, IERC721Enumerable { + // Mapping from owner to list of owned token IDs + mapping(address => uint256[]) private _ownedTokens; + + // Mapping from token ID to index of the owner tokens list + mapping(uint256 => uint256) private _ownedTokensIndex; + + // Array with all token ids, used for enumeration + uint256[] private _allTokens; + + // Mapping from token id to position in the allTokens array + mapping(uint256 => uint256) private _allTokensIndex; + + /* + * bytes4(keccak256('totalSupply()')) == 0x18160ddd + * bytes4(keccak256('tokenOfOwnerByIndex(address,uint256)')) == 0x2f745c59 + * bytes4(keccak256('tokenByIndex(uint256)')) == 0x4f6ccce7 + * + * => 0x18160ddd ^ 0x2f745c59 ^ 0x4f6ccce7 == 0x780e9d63 + */ + bytes4 private constant _INTERFACE_ID_ERC721_ENUMERABLE = 0x780e9d63; + + /** + * @dev Constructor function. + */ + constructor () public { + // register the supported interface to conform to ERC721Enumerable via ERC165 + _registerInterface(_INTERFACE_ID_ERC721_ENUMERABLE); + } + + /** + * @dev Gets the token ID at a given index of the tokens list of the requested owner. + * @param owner address owning the tokens list to be accessed + * @param index uint256 representing the index to be accessed of the requested tokens list + * @return uint256 token ID at the given index of the tokens list owned by the requested address + */ + function tokenOfOwnerByIndex(address owner, uint256 index) public view returns (uint256) { + require(index < balanceOf(owner), "ERC721Enumerable: owner index out of bounds"); + return _ownedTokens[owner][index]; + } + + /** + * @dev Gets the total amount of tokens stored by the contract. + * @return uint256 representing the total amount of tokens + */ + function totalSupply() public view returns (uint256) { + return _allTokens.length; + } + + /** + * @dev Gets the token ID at a given index of all the tokens in this contract + * Reverts if the index is greater or equal to the total number of tokens. + * @param index uint256 representing the index to be accessed of the tokens list + * @return uint256 token ID at the given index of the tokens list + */ + function tokenByIndex(uint256 index) public view returns (uint256) { + require(index < totalSupply(), "ERC721Enumerable: global index out of bounds"); + return _allTokens[index]; + } + + /** + * @dev Internal function to transfer ownership of a given token ID to another address. + * As opposed to transferFrom, this imposes no restrictions on msg.sender. + * @param from current owner of the token + * @param to address to receive the ownership of the given token ID + * @param tokenId uint256 ID of the token to be transferred + */ + function _transferFrom(address from, address to, uint256 tokenId) internal { + super._transferFrom(from, to, tokenId); + + _removeTokenFromOwnerEnumeration(from, tokenId); + + _addTokenToOwnerEnumeration(to, tokenId); + } + + /** + * @dev Internal function to mint a new token. + * Reverts if the given token ID already exists. + * @param to address the beneficiary that will own the minted token + * @param tokenId uint256 ID of the token to be minted + */ + function _mint(address to, uint256 tokenId) internal { + super._mint(to, tokenId); + + _addTokenToOwnerEnumeration(to, tokenId); + + _addTokenToAllTokensEnumeration(tokenId); + } + + /** + * @dev Internal function to burn a specific token. + * Reverts if the token does not exist. + * Deprecated, use _burn(uint256) instead. + * @param owner owner of the token to burn + * @param tokenId uint256 ID of the token being burned + */ + function _burn(address owner, uint256 tokenId) internal { + super._burn(owner, tokenId); + + _removeTokenFromOwnerEnumeration(owner, tokenId); + // Since tokenId will be deleted, we can clear its slot in _ownedTokensIndex to trigger a gas refund + _ownedTokensIndex[tokenId] = 0; + + _removeTokenFromAllTokensEnumeration(tokenId); + } + + /** + * @dev Gets the list of token IDs of the requested owner. + * @param owner address owning the tokens + * @return uint256[] List of token IDs owned by the requested address + */ + function _tokensOfOwner(address owner) internal view returns (uint256[] storage) { + return _ownedTokens[owner]; + } + + /** + * @dev Private function to add a token to this extension's ownership-tracking data structures. + * @param to address representing the new owner of the given token ID + * @param tokenId uint256 ID of the token to be added to the tokens list of the given address + */ + function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private { + _ownedTokensIndex[tokenId] = _ownedTokens[to].length; + _ownedTokens[to].push(tokenId); + } + + /** + * @dev Private function to add a token to this extension's token tracking data structures. + * @param tokenId uint256 ID of the token to be added to the tokens list + */ + function _addTokenToAllTokensEnumeration(uint256 tokenId) private { + _allTokensIndex[tokenId] = _allTokens.length; + _allTokens.push(tokenId); + } + + /** + * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that + * while the token is not assigned a new owner, the _ownedTokensIndex mapping is _not_ updated: this allows for + * gas optimizations e.g. when performing a transfer operation (avoiding double writes). + * This has O(1) time complexity, but alters the order of the _ownedTokens array. + * @param from address representing the previous owner of the given token ID + * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address + */ + function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private { + // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and + // then delete the last slot (swap and pop). + + uint256 lastTokenIndex = _ownedTokens[from].length.sub(1); + uint256 tokenIndex = _ownedTokensIndex[tokenId]; + + // When the token to delete is the last token, the swap operation is unnecessary + if (tokenIndex != lastTokenIndex) { + uint256 lastTokenId = _ownedTokens[from][lastTokenIndex]; + + _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token + _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index + } + + // This also deletes the contents at the last position of the array + _ownedTokens[from].length--; + + // Note that _ownedTokensIndex[tokenId] hasn't been cleared: it still points to the old slot (now occupied by + // lastTokenId, or just over the end of the array if the token was the last one). + } + + /** + * @dev Private function to remove a token from this extension's token tracking data structures. + * This has O(1) time complexity, but alters the order of the _allTokens array. + * @param tokenId uint256 ID of the token to be removed from the tokens list + */ + function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private { + // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and + // then delete the last slot (swap and pop). + + uint256 lastTokenIndex = _allTokens.length.sub(1); + uint256 tokenIndex = _allTokensIndex[tokenId]; + + // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so + // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding + // an 'if' statement (like in _removeTokenFromOwnerEnumeration) + uint256 lastTokenId = _allTokens[lastTokenIndex]; + + _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token + _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index + + // This also deletes the contents at the last position of the array + _allTokens.length--; + _allTokensIndex[tokenId] = 0; + } +} + + +contract ERC721Metadata is ERC165, ERC721, IERC721Metadata { + // Token name + string private _name; + + // Token symbol + string private _symbol; + + // Optional mapping for token URIs + mapping(uint256 => string) private _tokenURIs; + + /* + * bytes4(keccak256('name()')) == 0x06fdde03 + * bytes4(keccak256('symbol()')) == 0x95d89b41 + * bytes4(keccak256('tokenURI(uint256)')) == 0xc87b56dd + * + * => 0x06fdde03 ^ 0x95d89b41 ^ 0xc87b56dd == 0x5b5e139f + */ + bytes4 private constant _INTERFACE_ID_ERC721_METADATA = 0x5b5e139f; + + /** + * @dev Constructor function + */ + constructor (string memory name, string memory symbol) public { + _name = name; + _symbol = symbol; + + // register the supported interfaces to conform to ERC721 via ERC165 + _registerInterface(_INTERFACE_ID_ERC721_METADATA); + } + + /** + * @dev Gets the token name. + * @return string representing the token name + */ + function name() external view returns (string memory) { + return _name; + } + + /** + * @dev Gets the token symbol. + * @return string representing the token symbol + */ + function symbol() external view returns (string memory) { + return _symbol; + } + + /** + * @dev Returns an URI for a given token ID. + * Throws if the token ID does not exist. May return an empty string. + * @param tokenId uint256 ID of the token to query + */ + function tokenURI(uint256 tokenId) external view returns (string memory) { + require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); + return _tokenURIs[tokenId]; + } + + /** + * @dev Internal function to set the token URI for a given token. + * Reverts if the token ID does not exist. + * @param tokenId uint256 ID of the token to set its URI + * @param uri string URI to assign + */ + function _setTokenURI(uint256 tokenId, string memory uri) internal { + require(_exists(tokenId), "ERC721Metadata: URI set of nonexistent token"); + _tokenURIs[tokenId] = uri; + } + + /** + * @dev Internal function to burn a specific token. + * Reverts if the token does not exist. + * Deprecated, use _burn(uint256) instead. + * @param owner owner of the token to burn + * @param tokenId uint256 ID of the token being burned by the msg.sender + */ + function _burn(address owner, uint256 tokenId) internal { + super._burn(owner, tokenId); + + // Clear metadata (if any) + if (bytes(_tokenURIs[tokenId]).length != 0) { + delete _tokenURIs[tokenId]; + } + } +} + + +/** + * @title Full ERC721 Token + * This implementation includes all the required and some optional functionality of the ERC721 standard + * Moreover, it includes approve all functionality using operator terminology + * @dev see https://eips.ethereum.org/EIPS/eip-721 + */ +contract ERC721Full is ERC721, ERC721Enumerable, ERC721Metadata { + constructor (string memory name, string memory symbol) public ERC721Metadata(name, symbol) { + // solhint-disable-previous-line no-empty-blocks + } +} + + +/** + * @author Ricardo Guilherme Schmidt (Status Research & Development GmbH) + */ +contract StickerPack is Controlled, TokenClaimer, ERC721Full("Status Sticker Pack","STKP") { + + mapping(uint256 => uint256) public tokenPackId; //packId + uint256 public tokenCount; //tokens buys + + /** + * @notice controller can generate tokens at will + * @param _owner account being included new token + * @param _packId pack being minted + * @return tokenId created + */ + function generateToken(address _owner, uint256 _packId) + external + onlyController + returns (uint256 tokenId) + { + tokenId = tokenCount++; + tokenPackId[tokenId] = _packId; + _mint(_owner, tokenId); + } + + /** + * @notice This method can be used by the controller to extract mistakenly + * sent tokens to this contract. + * @param _token The address of the token contract that you want to recover + * set to 0 in case you want to extract ether. + */ + function claimTokens(address _token) + external + onlyController + { + withdrawBalance(_token, controller); + } + + + +} + + +interface ApproveAndCallFallBack { + function receiveApproval(address from, uint256 _amount, address _token, bytes calldata _data) external; +} + + + + +/** + * @author Ricardo Guilherme Schmidt (Status Research & Development GmbH) + * StickerMarket allows any address register "StickerPack" which can be sold to any address in form of "StickerPack", an ERC721 token. + */ +contract StickerMarket is Controlled, TokenClaimer, ApproveAndCallFallBack { + using SafeMath for uint256; + + event ClaimedTokens(address indexed _token, address indexed _controller, uint256 _amount); + event MarketState(State state); + event RegisterFee(uint256 value); + event BurnRate(uint256 value); + + enum State { Invalid, Open, BuyOnly, Controlled, Closed } + + State public state = State.Open; + uint256 registerFee; + uint256 burnRate; + + //include global var to set burn rate/percentage + ERC20Token public snt; //payment token + StickerPack public stickerPack; + StickerType public stickerType; + + /** + * @dev can only be called when market is open or by controller on Controlled state + */ + modifier marketManagement { + require(state == State.Open || (msg.sender == controller && state == State.Controlled), "Market Disabled"); + _; + } + + /** + * @dev can only be called when market is open or buy-only state. + */ + modifier marketSell { + require(state == State.Open || state == State.BuyOnly || (msg.sender == controller && state == State.Controlled), "Market Disabled"); + _; + } + + /** + * @param _snt SNT token + */ + constructor( + ERC20Token _snt, + StickerPack _stickerPack, + StickerType _stickerType + ) + public + { + require(address(_snt) != address(0), "Bad _snt parameter"); + require(address(_stickerPack) != address(0), "Bad _stickerPack parameter"); + require(address(_stickerType) != address(0), "Bad _stickerType parameter"); + snt = _snt; + stickerPack = _stickerPack; + stickerType = _stickerType; + } + + /** + * @dev Mints NFT StickerPack in `msg.sender` account, and Transfers SNT using user allowance + * emit NonfungibleToken.Transfer(`address(0)`, `msg.sender`, `tokenId`) + * @notice buy a pack from market pack owner, including a StickerPack's token in msg.sender account with same metadata of `_packId` + * @param _packId id of market pack + * @param _destination owner of token being brought + * @param _price agreed price + * @return tokenId generated StickerPack token + */ + function buyToken( + uint256 _packId, + address _destination, + uint256 _price + ) + external + returns (uint256 tokenId) + { + return buy(msg.sender, _packId, _destination, _price); + } + + /** + * @dev emits StickerMarket.Register(`packId`, `_urlHash`, `_price`, `_contenthash`) + * @notice Registers to sell a sticker pack + * @param _price cost in wei to users minting this pack + * @param _donate value between 0-10000 representing percentage of `_price` that is donated to StickerMarket at every buy + * @param _category listing category + * @param _owner address of the beneficiary of buys + * @param _contenthash EIP1577 pack contenthash for listings + * @param _fee Fee msg.sender agrees to pay for this registration + * @return packId Market position of Sticker Pack data. + */ + function registerPack( + uint256 _price, + uint256 _donate, + bytes4[] calldata _category, + address _owner, + bytes calldata _contenthash, + uint256 _fee + ) + external + returns(uint256 packId) + { + packId = register(msg.sender, _category, _owner, _price, _donate, _contenthash, _fee); + } + + /** + * @notice MiniMeToken ApproveAndCallFallBack forwarder for registerPack and buyToken + * @param _from account calling "approve and buy" + * @param _value must be exactly whats being consumed + * @param _token must be exactly SNT contract + * @param _data abi encoded call + */ + function receiveApproval( + address _from, + uint256 _value, + address _token, + bytes calldata _data + ) + external + { + require(_token == address(snt), "Bad token"); + require(_token == address(msg.sender), "Bad call"); + bytes4 sig = abiDecodeSig(_data); + bytes memory cdata = slice(_data,4,_data.length-4); + if(sig == this.buyToken.selector){ + require(cdata.length == 96, "Bad data length"); + (uint256 packId, address owner, uint256 price) = abi.decode(cdata, (uint256, address, uint256)); + require(_value == price, "Bad price value"); + buy(_from, packId, owner, price); + } else if(sig == this.registerPack.selector) { + require(cdata.length >= 188, "Bad data length"); + (uint256 price, uint256 donate, bytes4[] memory category, address owner, bytes memory contenthash, uint256 fee) = abi.decode(cdata, (uint256,uint256,bytes4[],address,bytes,uint256)); + require(_value == fee, "Bad fee value"); + register(_from, category, owner, price, donate, contenthash, fee); + } else { + revert("Bad call"); + } + } + + /** + * @notice changes market state, only controller can call. + * @param _state new state + */ + function setMarketState(State _state) + external + onlyController + { + state = _state; + emit MarketState(_state); + } + + /** + * @notice changes register fee, only controller can call. + * @param _value total SNT cost of registration + */ + function setRegisterFee(uint256 _value) + external + onlyController + { + registerFee = _value; + emit RegisterFee(_value); + } + + /** + * @notice changes burn rate percentage, only controller can call. + * @param _value new value between 0 and 10000 + */ + function setBurnRate(uint256 _value) + external + onlyController + { + burnRate = _value; + require(_value <= 10000, "cannot be more then 100.00%"); + emit BurnRate(_value); + } + + /** + * @notice controller can generate packs at will + * @param _price cost in wei to users minting with _urlHash metadata + * @param _donate optional amount of `_price` that is donated to StickerMarket at every buy + * @param _category listing category + * @param _owner address of the beneficiary of buys + * @param _contenthash EIP1577 pack contenthash for listings + * @return packId Market position of Sticker Pack data. + */ + function generatePack( + uint256 _price, + uint256 _donate, + bytes4[] calldata _category, + address _owner, + bytes calldata _contenthash + ) + external + onlyController + returns(uint256 packId) + { + packId = stickerType.generatePack(_price, _donate, _category, _owner, _contenthash); + } + + /** + * @notice removes all market data about a marketed pack, can only be called by market controller + * @param _packId pack being purged + * @param _limit limits categories being purged + */ + function purgePack(uint256 _packId, uint256 _limit) + external + onlyController + { + stickerType.purgePack(_packId, _limit); + } + + /** + * @notice controller can generate tokens at will + * @param _owner account being included new token + * @param _packId pack being minted + * @return tokenId created + */ + function generateToken(address _owner, uint256 _packId) + external + onlyController + returns (uint256 tokenId) + { + return stickerPack.generateToken(_owner, _packId); + } + + /** + * @notice Change controller of stickerType + * @param _newController new controller of stickerType. + */ + function migrate(address payable _newController) + external + onlyController + { + require(_newController != address(0), "Cannot unset controller"); + stickerType.changeController(_newController); + stickerPack.changeController(_newController); + } + + /** + * @notice This method can be used by the controller to extract mistakenly + * sent tokens to this contract. + * @param _token The address of the token contract that you want to recover + * set to 0 in case you want to extract ether. + */ + function claimTokens(address _token) + external + onlyController + { + withdrawBalance(_token, controller); + } + + /** + * @notice returns pack data of token + * @param _tokenId user token being queried + * @return categories, registration time and contenthash + */ + function getTokenData(uint256 _tokenId) + external + view + returns ( + bytes4[] memory category, + uint256 timestamp, + bytes memory contenthash + ) + { + return stickerType.getPackSummary(stickerPack.tokenPackId(_tokenId)); + } + + /** + * @dev charges registerFee and register new pack to owner + * @param _caller payment account + * @param _category listing category + * @param _owner address of the beneficiary of buys + * @param _price cost in wei to users minting this pack + * @param _donate value between 0-10000 representing percentage of `_price` that is donated to StickerMarket at every buy + * @param _contenthash EIP1577 pack contenthash for listings + * @param _fee Fee msg.sender agrees to pay for this registrion + * @return created packId + */ + function register( + address _caller, + bytes4[] memory _category, + address _owner, + uint256 _price, + uint256 _donate, + bytes memory _contenthash, + uint256 _fee + ) + internal + marketManagement + returns(uint256 packId) + { + require(_fee == registerFee, "Unexpected fee"); + if(registerFee > 0){ + require(snt.transferFrom(_caller, controller, registerFee), "Bad payment"); + } + packId = stickerType.generatePack(_price, _donate, _category, _owner, _contenthash); + } + + /** + * @dev transfer SNT from buyer to pack owner and mint sticker pack token + * @param _caller payment account + * @param _packId id of market pack + * @param _destination owner of token being brought + * @param _price agreed price + * @return created tokenId + */ + function buy( + address _caller, + uint256 _packId, + address _destination, + uint256 _price + ) + internal + marketSell + returns (uint256 tokenId) + { + ( + address pack_owner, + bool pack_mintable, + uint256 pack_price, + uint256 pack_donate + ) = stickerType.getPaymentData(_packId); + require(pack_owner != address(0), "Bad pack"); + require(pack_mintable, "Disabled"); + uint256 amount = pack_price; + require(_price == amount, "Wrong price"); + require(amount > 0, "Unauthorized"); + if(amount > 0 && burnRate > 0) { + uint256 burned = amount.mul(burnRate).div(10000); + amount = amount.sub(burned); + require(snt.transferFrom(_caller, Controlled(address(snt)).controller(), burned), "Bad burn"); + } + if(amount > 0 && pack_donate > 0) { + uint256 donate = amount.mul(pack_donate).div(10000); + amount = amount.sub(donate); + require(snt.transferFrom(_caller, controller, donate), "Bad donate"); + } + if(amount > 0) { + require(snt.transferFrom(_caller, pack_owner, amount), "Bad payment"); + } + return stickerPack.generateToken(_destination, _packId); + } + + /** + * @dev decodes sig of abi encoded call + * @param _data abi encoded data + * @return sig (first 4 bytes) + */ + function abiDecodeSig(bytes memory _data) private pure returns(bytes4 sig){ + assembly { + sig := mload(add(_data, add(0x20, 0))) + } + } + + /** + * @dev get a slice of byte array + * @param _bytes source + * @param _start pointer + * @param _length size to read + * @return sliced bytes + */ + function slice(bytes memory _bytes, uint _start, uint _length) private pure returns (bytes memory) { + require(_bytes.length >= (_start + _length)); + + bytes memory tempBytes; + + assembly { + switch iszero(_length) + case 0 { + // Get a location of some free memory and store it in tempBytes as + // Solidity does for memory variables. + tempBytes := mload(0x40) + + // The first word of the slice result is potentially a partial + // word read from the original array. To read it, we calculate + // the length of that partial word and start copying that many + // bytes into the array. The first word we copy will start with + // data we don't care about, but the last `lengthmod` bytes will + // land at the beginning of the contents of the new array. When + // we're done copying, we overwrite the full first word with + // the actual length of the slice. + let lengthmod := and(_length, 31) + + // The multiplication in the next line is necessary + // because when slicing multiples of 32 bytes (lengthmod == 0) + // the following copy loop was copying the origin's length + // and then ending prematurely not copying everything it should. + let mc := add(add(tempBytes, lengthmod), mul(0x20, iszero(lengthmod))) + let end := add(mc, _length) + + for { + // The multiplication in the next line has the same exact purpose + // as the one above. + let cc := add(add(add(_bytes, lengthmod), mul(0x20, iszero(lengthmod))), _start) + } lt(mc, end) { + mc := add(mc, 0x20) + cc := add(cc, 0x20) + } { + mstore(mc, mload(cc)) + } + + mstore(tempBytes, _length) + + //update free-memory pointer + //allocating the array padded to 32 bytes like the compiler does now + mstore(0x40, and(add(mc, 31), not(31))) + } + //if we want a zero-length slice let's just return a zero-length array + default { + tempBytes := mload(0x40) + + mstore(0x40, add(tempBytes, 0x20)) + } + } + + return tempBytes; + } + + + // For ABI/web3.js purposes + // fired by StickerType + event Register(uint256 indexed packId, uint256 dataPrice, bytes contenthash); + // fired by StickerPack and MiniMeToken + event Transfer( + address indexed from, + address indexed to, + uint256 indexed value + ); +} + + + +/** + * @author Ricardo Guilherme Schmidt (Status Research & Development GmbH) + * StickerMarket allows any address register "StickerPack" which can be sold to any address in form of "StickerPack", an ERC721 token. + */ +contract StickerType is Controlled, TokenClaimer, ERC721Full("Status Sticker Pack Authorship","STKA") { + using SafeMath for uint256; + event Register(uint256 indexed packId, uint256 dataPrice, bytes contenthash, bool mintable); + event PriceChanged(uint256 indexed packId, uint256 dataPrice); + event MintabilityChanged(uint256 indexed packId, bool mintable); + event ContenthashChanged(uint256 indexed packid, bytes contenthash); + event Categorized(bytes4 indexed category, uint256 indexed packId); + event Uncategorized(bytes4 indexed category, uint256 indexed packId); + event Unregister(uint256 indexed packId); + + struct Pack { + bytes4[] category; + bool mintable; + uint256 timestamp; + uint256 price; //in "wei" + uint256 donate; //in "percent" + bytes contenthash; + } + + uint256 registerFee; + uint256 burnRate; + + mapping(uint256 => Pack) public packs; + uint256 public packCount; //pack registers + + + //auxilary views + mapping(bytes4 => uint256[]) private availablePacks; //array of available packs + mapping(bytes4 => mapping(uint256 => uint256)) private availablePacksIndex; //position on array of available packs + mapping(uint256 => mapping(bytes4 => uint256)) private packCategoryIndex; + + /** + * Can only be called by the pack owner, or by the controller if pack exists. + */ + modifier packOwner(uint256 _packId) { + address owner = ownerOf(_packId); + require((msg.sender == owner) || (owner != address(0) && msg.sender == controller), "Unauthorized"); + _; + } + + /** + * @notice controller can generate packs at will + * @param _price cost in wei to users minting with _urlHash metadata + * @param _donate optional amount of `_price` that is donated to StickerMarket at every buy + * @param _category listing category + * @param _owner address of the beneficiary of buys + * @param _contenthash EIP1577 pack contenthash for listings + * @return packId Market position of Sticker Pack data. + */ + function generatePack( + uint256 _price, + uint256 _donate, + bytes4[] calldata _category, + address _owner, + bytes calldata _contenthash + ) + external + onlyController + returns(uint256 packId) + { + require(_donate <= 10000, "Bad argument, _donate cannot be more then 100.00%"); + packId = packCount++; + _mint(_owner, packId); + packs[packId] = Pack(new bytes4[](0), true, block.timestamp, _price, _donate, _contenthash); + emit Register(packId, _price, _contenthash, true); + for(uint i = 0;i < _category.length; i++){ + addAvailablePack(packId, _category[i]); + } + } + + /** + * @notice removes all market data about a marketed pack, can only be called by market controller + * @param _packId position to be deleted + * @param _limit limit of categories to cleanup + */ + function purgePack(uint256 _packId, uint256 _limit) + external + onlyController + { + bytes4[] memory _category = packs[_packId].category; + uint limit; + if(_limit == 0) { + limit = _category.length; + } else { + require(_limit <= _category.length, "Bad limit"); + limit = _limit; + } + + uint256 len = _category.length; + if(len > 0){ + len--; + } + for(uint i = 0; i < limit; i++){ + removeAvailablePack(_packId, _category[len-i]); + } + + if(packs[_packId].category.length == 0){ + _burn(ownerOf(_packId), _packId); + delete packs[_packId]; + emit Unregister(_packId); + } + + } + + /** + * @notice changes contenthash of `_packId`, can only be called by controller + * @param _packId which market position is being altered + * @param _contenthash new contenthash + */ + function setPackContenthash(uint256 _packId, bytes calldata _contenthash) + external + onlyController + { + emit ContenthashChanged(_packId, _contenthash); + packs[_packId].contenthash = _contenthash; + } + + /** + * @notice This method can be used by the controller to extract mistakenly + * sent tokens to this contract. + * @param _token The address of the token contract that you want to recover + * set to 0 in case you want to extract ether. + */ + function claimTokens(address _token) + external + onlyController + { + withdrawBalance(_token, controller); + } + + /** + * @notice changes price of `_packId`, can only be called when market is open + * @param _packId pack id changing price settings + * @param _price cost in wei to users minting this pack + * @param _donate value between 0-10000 representing percentage of `_price` that is donated to StickerMarket at every buy + */ + function setPackPrice(uint256 _packId, uint256 _price, uint256 _donate) + external + packOwner(_packId) + { + require(_donate <= 10000, "Bad argument, _donate cannot be more then 100.00%"); + emit PriceChanged(_packId, _price); + packs[_packId].price = _price; + packs[_packId].donate = _donate; + } + + /** + * @notice add caregory in `_packId`, can only be called when market is open + * @param _packId pack adding category + * @param _category category to list + */ + function addPackCategory(uint256 _packId, bytes4 _category) + external + packOwner(_packId) + { + addAvailablePack(_packId, _category); + } + + /** + * @notice remove caregory in `_packId`, can only be called when market is open + * @param _packId pack removing category + * @param _category category to unlist + */ + function removePackCategory(uint256 _packId, bytes4 _category) + external + packOwner(_packId) + { + removeAvailablePack(_packId, _category); + } + + /** + * @notice Changes if pack is enabled for sell + * @param _packId position edit + * @param _mintable true to enable sell + */ + function setPackState(uint256 _packId, bool _mintable) + external + packOwner(_packId) + { + emit MintabilityChanged(_packId, _mintable); + packs[_packId].mintable = _mintable; + } + + /** + * @notice read available market ids in a category (might be slow) + * @param _category listing category + * @return array of market id registered + */ + function getAvailablePacks(bytes4 _category) + external + view + returns (uint256[] memory availableIds) + { + return availablePacks[_category]; + } + + /** + * @notice count total packs in a category + * @param _category listing category + * @return total number of packs in category + */ + function getCategoryLength(bytes4 _category) + external + view + returns (uint256 size) + { + size = availablePacks[_category].length; + } + + /** + * @notice read a packId in the category list at a specific index + * @param _category listing category + * @param _index index + * @return packId on index + */ + function getCategoryPack(bytes4 _category, uint256 _index) + external + view + returns (uint256 packId) + { + packId = availablePacks[_category][_index]; + } + + /** + * @notice returns all data from pack in market + * @param _packId pack id being queried + * @return categories, owner, mintable, price, donate and contenthash + */ + function getPackData(uint256 _packId) + external + view + returns ( + bytes4[] memory category, + address owner, + bool mintable, + uint256 timestamp, + uint256 price, + bytes memory contenthash + ) + { + Pack memory pack = packs[_packId]; + return ( + pack.category, + ownerOf(_packId), + pack.mintable, + pack.timestamp, + pack.price, + pack.contenthash + ); + } + + /** + * @notice returns all data from pack in market + * @param _packId pack id being queried + * @return categories, owner, mintable, price, donate and contenthash + */ + function getPackSummary(uint256 _packId) + external + view + returns ( + bytes4[] memory category, + uint256 timestamp, + bytes memory contenthash + ) + { + Pack memory pack = packs[_packId]; + return ( + pack.category, + pack.timestamp, + pack.contenthash + ); + } + + /** + * @notice returns payment data for migrated contract + * @param _packId pack id being queried + * @return owner, mintable, price and donate + */ + function getPaymentData(uint256 _packId) + external + view + returns ( + address owner, + bool mintable, + uint256 price, + uint256 donate + ) + { + Pack memory pack = packs[_packId]; + return ( + ownerOf(_packId), + pack.mintable, + pack.price, + pack.donate + ); + } + + /** + * @dev adds id from "available list" + * @param _packId altered pack + * @param _category listing category + */ + function addAvailablePack(uint256 _packId, bytes4 _category) private { + require(packCategoryIndex[_packId][_category] == 0, "Duplicate categorization"); + availablePacksIndex[_category][_packId] = availablePacks[_category].push(_packId); + packCategoryIndex[_packId][_category] = packs[_packId].category.push(_category); + emit Categorized(_category, _packId); + } + + /** + * @dev remove id from "available list" + * @param _packId altered pack + * @param _category listing category + */ + function removeAvailablePack(uint256 _packId, bytes4 _category) private { + uint pos = availablePacksIndex[_category][_packId]; + require(pos > 0, "Not categorized [1]"); + delete availablePacksIndex[_category][_packId]; + if(pos != availablePacks[_category].length){ + uint256 movedElement = availablePacks[_category][availablePacks[_category].length-1]; //tokenId; + availablePacks[_category][pos-1] = movedElement; + availablePacksIndex[_category][movedElement] = pos; + } + availablePacks[_category].length--; + + uint pos2 = packCategoryIndex[_packId][_category]; + require(pos2 > 0, "Not categorized [2]"); + delete packCategoryIndex[_packId][_category]; + if(pos2 != packs[_packId].category.length){ + bytes4 movedElement2 = packs[_packId].category[packs[_packId].category.length-1]; //tokenId; + packs[_packId].category[pos2-1] = movedElement2; + packCategoryIndex[_packId][movedElement2] = pos2; + } + packs[_packId].category.length--; + emit Uncategorized(_category, _packId); + + } + +} \ No newline at end of file diff --git a/contracts/stickers/doc.go b/contracts/stickers/doc.go new file mode 100644 index 000000000..8ebbfb5d7 --- /dev/null +++ b/contracts/stickers/doc.go @@ -0,0 +1,3 @@ +package stickers + +//go:generate abigen -sol contracts.sol -pkg stickers -out contracts.go diff --git a/go.mod b/go.mod index 20026a475..b3b48d4e6 100644 --- a/go.mod +++ b/go.mod @@ -73,4 +73,5 @@ require ( gopkg.in/go-playground/assert.v1 v1.2.1 // indirect gopkg.in/go-playground/validator.v9 v9.31.0 gopkg.in/natefinch/lumberjack.v2 v2.0.0 + olympos.io/encoding/edn v0.0.0-20201019073823-d3554ca0b0a3 ) diff --git a/go.sum b/go.sum index 4a26db401..ea7490cf4 100644 --- a/go.sum +++ b/go.sum @@ -1864,6 +1864,8 @@ modernc.org/ql v1.0.0/go.mod h1:xGVyrLIatPcO2C1JvI/Co8c0sr6y91HKFNy4pt9JXEY= modernc.org/sortutil v1.1.0/go.mod h1:ZyL98OQHJgH9IEfN71VsamvJgrtRX9Dj2gX+vH86L1k= modernc.org/strutil v1.1.0/go.mod h1:lstksw84oURvj9y3tn8lGvRxyRC1S2+g5uuIzNfIOBs= modernc.org/zappy v1.0.0/go.mod h1:hHe+oGahLVII/aTTyWK/b53VDHMAGCBYYeZ9sn83HC4= +olympos.io/encoding/edn v0.0.0-20201019073823-d3554ca0b0a3 h1:slmdOY3vp8a7KQbHkL+FLbvbkgMqmXojpFUO/jENuqQ= +olympos.io/encoding/edn v0.0.0-20201019073823-d3554ca0b0a3/go.mod h1:oVgVk4OWVDi43qWBEyGhXgYxt7+ED4iYNpTngSLX2Iw= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= diff --git a/multiaccounts/accounts/database.go b/multiaccounts/accounts/database.go index b58227219..84aa90f26 100644 --- a/multiaccounts/accounts/database.go +++ b/multiaccounts/accounts/database.go @@ -760,6 +760,21 @@ func (db *Database) GetMessagesFromContactsOnly() (bool, error) { return result, err } +func (db *Database) GetInstalledStickerPacks() (rst *json.RawMessage, err error) { + err = db.db.QueryRow("SELECT stickers_packs_installed FROM settings WHERE synthetic_id = 'id'").Scan(&rst) + return +} + +func (db *Database) GetPendingStickerPacks() (rst *json.RawMessage, err error) { + err = db.db.QueryRow("SELECT stickers_packs_pending FROM settings WHERE synthetic_id = 'id'").Scan(&rst) + return +} + +func (db *Database) GetRecentStickers() (rst *json.RawMessage, err error) { + err = db.db.QueryRow("SELECT stickers_recent_stickers FROM settings WHERE synthetic_id = 'id'").Scan(&rst) + return +} + func (db *Database) GetWalletAddress() (rst types.Address, err error) { err = db.db.QueryRow("SELECT address FROM accounts WHERE wallet = 1").Scan(&rst) return diff --git a/node/get_status_node.go b/node/get_status_node.go index a3f6fcb54..a952c5d2e 100644 --- a/node/get_status_node.go +++ b/node/get_status_node.go @@ -42,6 +42,7 @@ import ( "github.com/status-im/status-go/services/rpcfilters" "github.com/status-im/status-go/services/rpcstats" "github.com/status-im/status-go/services/status" + "github.com/status-im/status-go/services/stickers" "github.com/status-im/status-go/services/subscriptions" "github.com/status-im/status-go/services/wakuext" "github.com/status-im/status-go/services/wakuv2ext" @@ -113,6 +114,7 @@ type StatusNode struct { wakuV2ExtSrvc *wakuv2ext.Service ensSrvc *ens.Service gifSrvc *gif.Service + stickersSrvc *stickers.Service } // New makes new instance of StatusNode. @@ -422,6 +424,7 @@ func (n *StatusNode) stop() error { n.wakuV2Srvc = nil n.wakuV2ExtSrvc = nil n.ensSrvc = nil + n.stickersSrvc = nil n.publicMethods = make(map[string]bool) return nil diff --git a/node/status_node_services.go b/node/status_node_services.go index be7a69678..fbb79b824 100644 --- a/node/status_node_services.go +++ b/node/status_node_services.go @@ -35,6 +35,7 @@ import ( "github.com/status-im/status-go/services/rpcfilters" "github.com/status-im/status-go/services/rpcstats" "github.com/status-im/status-go/services/status" + "github.com/status-im/status-go/services/stickers" "github.com/status-im/status-go/services/subscriptions" "github.com/status-im/status-go/services/wakuext" "github.com/status-im/status-go/services/wakuv2ext" @@ -66,6 +67,7 @@ func (b *StatusNode) initServices(config *params.NodeConfig) error { services = append(services, b.personalService()) services = append(services, b.statusPublicService()) services = append(services, b.ensService()) + services = append(services, b.stickersService()) services = appendIf(config.EnableNTPSync, services, b.timeSource()) services = appendIf(b.appDB != nil && b.multiaccountsDB != nil, services, b.accountsService(accountsFeed)) services = appendIf(config.BrowsersConfig.Enabled, services, b.browsersService()) @@ -370,6 +372,13 @@ func (b *StatusNode) ensService() *ens.Service { return b.ensSrvc } +func (b *StatusNode) stickersService() *stickers.Service { + if b.stickersSrvc == nil { + b.stickersSrvc = stickers.NewService(b.appDB, b.rpcClient, b.gethAccountManager, b.rpcFiltersSrvc, b.config) + } + return b.stickersSrvc +} + func (b *StatusNode) gifService() *gif.Service { if b.gifSrvc == nil { b.gifSrvc = gif.NewService(accounts.NewDB(b.appDB)) diff --git a/services/ens/api.go b/services/ens/api.go index b1806b559..e7756c628 100644 --- a/services/ens/api.go +++ b/services/ens/api.go @@ -21,19 +21,20 @@ import ( "github.com/ethereum/go-ethereum/common/hexutil" ethTypes "github.com/ethereum/go-ethereum/core/types" "github.com/status-im/status-go/account" + "github.com/status-im/status-go/contracts" + "github.com/status-im/status-go/contracts/registrar" + "github.com/status-im/status-go/contracts/resolver" + "github.com/status-im/status-go/contracts/snt" "github.com/status-im/status-go/eth-node/types" "github.com/status-im/status-go/params" "github.com/status-im/status-go/rpc" - "github.com/status-im/status-go/services/ens/erc20" - "github.com/status-im/status-go/services/ens/registrar" - "github.com/status-im/status-go/services/ens/resolver" "github.com/status-im/status-go/services/rpcfilters" "github.com/status-im/status-go/transactions" ) func NewAPI(rpcClient *rpc.Client, accountsManager *account.GethManager, rpcFiltersSrvc *rpcfilters.Service, config *params.NodeConfig) *API { return &API{ - contractMaker: &contractMaker{ + contractMaker: &contracts.ContractMaker{ RPCClient: rpcClient, }, accountsManager: accountsManager, @@ -49,7 +50,7 @@ type uri struct { } type API struct { - contractMaker *contractMaker + contractMaker *contracts.ContractMaker accountsManager *account.GethManager rpcFiltersSrvc *rpcfilters.Service config *params.NodeConfig @@ -61,7 +62,7 @@ func (api *API) Resolver(ctx context.Context, chainID uint64, username string) ( return nil, err } - registry, err := api.contractMaker.newRegistry(chainID) + registry, err := api.contractMaker.NewRegistry(chainID) if err != nil { return nil, err } @@ -81,7 +82,7 @@ func (api *API) OwnerOf(ctx context.Context, chainID uint64, username string) (* return nil, err } - registry, err := api.contractMaker.newRegistry(chainID) + registry, err := api.contractMaker.NewRegistry(chainID) if err != nil { return nil, err } @@ -106,7 +107,7 @@ func (api *API) ContentHash(ctx context.Context, chainID uint64, username string return nil, err } - resolver, err := api.contractMaker.newPublicResolver(chainID, resolverAddress) + resolver, err := api.contractMaker.NewPublicResolver(chainID, resolverAddress) if err != nil { return nil, err } @@ -131,7 +132,7 @@ func (api *API) PublicKeyOf(ctx context.Context, chainID uint64, username string return "", err } - resolver, err := api.contractMaker.newPublicResolver(chainID, resolverAddress) + resolver, err := api.contractMaker.NewPublicResolver(chainID, resolverAddress) if err != nil { return "", err } @@ -155,7 +156,7 @@ func (api *API) AddressOf(ctx context.Context, chainID uint64, username string) return nil, err } - resolver, err := api.contractMaker.newPublicResolver(chainID, resolverAddress) + resolver, err := api.contractMaker.NewPublicResolver(chainID, resolverAddress) if err != nil { return nil, err } @@ -170,7 +171,7 @@ func (api *API) AddressOf(ctx context.Context, chainID uint64, username string) } func (api *API) ExpireAt(ctx context.Context, chainID uint64, username string) (string, error) { - registrar, err := api.contractMaker.newUsernameRegistrar(chainID) + registrar, err := api.contractMaker.NewUsernameRegistrar(chainID) if err != nil { return "", err } @@ -185,7 +186,7 @@ func (api *API) ExpireAt(ctx context.Context, chainID uint64, username string) ( } func (api *API) Price(ctx context.Context, chainID uint64) (string, error) { - registrar, err := api.contractMaker.newUsernameRegistrar(chainID) + registrar, err := api.contractMaker.NewUsernameRegistrar(chainID) if err != nil { return "", err } @@ -211,7 +212,7 @@ func (api *API) getSigner(chainID uint64, from types.Address, password string) b } func (api *API) Release(ctx context.Context, chainID uint64, txArgs transactions.SendTxArgs, password string, username string) (string, error) { - registrar, err := api.contractMaker.newUsernameRegistrar(chainID) + registrar, err := api.contractMaker.NewUsernameRegistrar(chainID) if err != nil { return "", err } @@ -242,7 +243,11 @@ func (api *API) ReleaseEstimate(ctx context.Context, chainID uint64, txArgs tran return 0, err } - registrarAddress := usernameRegistrarsByChainID[chainID] + registrarAddress, err := registrar.ContractAddress(chainID) + if err != nil { + return 0, err + } + return ethClient.EstimateGas(ctx, ethereum.CallMsg{ From: common.Address(txArgs.From), To: ®istrarAddress, @@ -252,7 +257,7 @@ func (api *API) ReleaseEstimate(ctx context.Context, chainID uint64, txArgs tran } func (api *API) Register(ctx context.Context, chainID uint64, txArgs transactions.SendTxArgs, password string, username string, pubkey string) (string, error) { - snt, err := api.contractMaker.newSNT(chainID) + snt, err := api.contractMaker.NewSNT(chainID) if err != nil { return "", err } @@ -275,10 +280,15 @@ func (api *API) Register(ctx context.Context, chainID uint64, txArgs transaction return "", err } + registrarAddress, err := registrar.ContractAddress(chainID) + if err != nil { + return "", err + } + txOpts := txArgs.ToTransactOpts(api.getSigner(chainID, txArgs.From, password)) tx, err := snt.ApproveAndCall( txOpts, - usernameRegistrarsByChainID[chainID], + registrarAddress, price, extraData, ) @@ -310,21 +320,28 @@ func (api *API) RegisterPrepareTxCallMsg(ctx context.Context, chainID uint64, tx return ethereum.CallMsg{}, err } - sntABI, err := abi.JSON(strings.NewReader(erc20.SNTABI)) + sntABI, err := abi.JSON(strings.NewReader(snt.SNTABI)) if err != nil { return ethereum.CallMsg{}, err } - data, err := sntABI.Pack("approveAndCall", usernameRegistrarsByChainID[chainID], price, extraData) + registrarAddress, err := registrar.ContractAddress(chainID) if err != nil { return ethereum.CallMsg{}, err } - contractAddress := sntByChainID[chainID] + data, err := sntABI.Pack("approveAndCall", registrarAddress, price, extraData) + if err != nil { + return ethereum.CallMsg{}, err + } + sntAddress, err := snt.ContractAddress(chainID) + if err != nil { + return ethereum.CallMsg{}, err + } return ethereum.CallMsg{ From: common.Address(txArgs.From), - To: &contractAddress, + To: &sntAddress, Value: big.NewInt(0), Data: data, }, nil @@ -364,7 +381,7 @@ func (api *API) SetPubKey(ctx context.Context, chainID uint64, txArgs transactio return "", err } - resolver, err := api.contractMaker.newPublicResolver(chainID, resolverAddress) + resolver, err := api.contractMaker.NewPublicResolver(chainID, resolverAddress) if err != nil { return "", err } diff --git a/services/ens/contracts.go b/services/ens/contracts.go deleted file mode 100644 index 58c8f00bf..000000000 --- a/services/ens/contracts.go +++ /dev/null @@ -1,86 +0,0 @@ -package ens - -import ( - "errors" - - "github.com/ethereum/go-ethereum/common" - "github.com/status-im/status-go/rpc" - "github.com/status-im/status-go/services/ens/erc20" - "github.com/status-im/status-go/services/ens/registrar" - "github.com/status-im/status-go/services/ens/resolver" -) - -var errorNotAvailableOnChainID = errors.New("not available for chainID") - -var resolversByChainID = map[uint64]common.Address{ - 1: common.HexToAddress("0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"), // mainnet - 3: common.HexToAddress("0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"), // ropsten -} - -var usernameRegistrarsByChainID = map[uint64]common.Address{ - 1: common.HexToAddress("0xDB5ac1a559b02E12F29fC0eC0e37Be8E046DEF49"), // mainnet - 3: common.HexToAddress("0xdaae165beb8c06e0b7613168138ebba774aff071"), // ropsten -} - -var sntByChainID = map[uint64]common.Address{ - 1: common.HexToAddress("0x744d70fdbe2ba4cf95131626614a1763df805b9e"), // mainnet - 3: common.HexToAddress("0xc55cf4b03948d7ebc8b9e8bad92643703811d162"), // ropsten -} - -type contractMaker struct { - RPCClient *rpc.Client -} - -func (c *contractMaker) newRegistry(chainID uint64) (*resolver.ENSRegistryWithFallback, error) { - if _, ok := resolversByChainID[chainID]; !ok { - return nil, errorNotAvailableOnChainID - } - - backend, err := c.RPCClient.EthClient(chainID) - if err != nil { - return nil, err - } - - return resolver.NewENSRegistryWithFallback( - resolversByChainID[chainID], - backend, - ) -} - -func (c *contractMaker) newPublicResolver(chainID uint64, resolverAddress *common.Address) (*resolver.PublicResolver, error) { - backend, err := c.RPCClient.EthClient(chainID) - if err != nil { - return nil, err - } - - return resolver.NewPublicResolver(*resolverAddress, backend) -} - -func (c *contractMaker) newUsernameRegistrar(chainID uint64) (*registrar.UsernameRegistrar, error) { - if _, ok := usernameRegistrarsByChainID[chainID]; !ok { - return nil, errorNotAvailableOnChainID - } - - backend, err := c.RPCClient.EthClient(chainID) - if err != nil { - return nil, err - } - - return registrar.NewUsernameRegistrar( - usernameRegistrarsByChainID[chainID], - backend, - ) -} - -func (c *contractMaker) newSNT(chainID uint64) (*erc20.SNT, error) { - if _, ok := sntByChainID[chainID]; !ok { - return nil, errorNotAvailableOnChainID - } - - backend, err := c.RPCClient.EthClient(chainID) - if err != nil { - return nil, err - } - - return erc20.NewSNT(sntByChainID[chainID], backend) -} diff --git a/services/ens/erc20/doc.go b/services/ens/erc20/doc.go deleted file mode 100644 index 4d6a26e5b..000000000 --- a/services/ens/erc20/doc.go +++ /dev/null @@ -1,3 +0,0 @@ -package erc20 - -//go:generate abigen -sol erc20.sol -pkg erc20 -out erc20.go diff --git a/services/stickers/api.go b/services/stickers/api.go new file mode 100644 index 000000000..0b80eee2e --- /dev/null +++ b/services/stickers/api.go @@ -0,0 +1,540 @@ +package stickers + +import ( + "context" + "database/sql" + "errors" + "io/ioutil" + "math/big" + "net/http" + "sync" + "time" + + "github.com/ipfs/go-cid" + "github.com/multiformats/go-multibase" + "github.com/wealdtech/go-multicodec" + "olympos.io/encoding/edn" + + "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/common/hexutil" + "github.com/ethereum/go-ethereum/log" + "github.com/status-im/status-go/account" + "github.com/status-im/status-go/contracts" + "github.com/status-im/status-go/contracts/stickers" + "github.com/status-im/status-go/eth-node/types" + "github.com/status-im/status-go/multiaccounts/accounts" + "github.com/status-im/status-go/params" + "github.com/status-im/status-go/rpc" + "github.com/status-im/status-go/services/rpcfilters" + "github.com/status-im/status-go/services/wallet/bigint" +) + +const ipfsGateway = ".ipfs.cf-ipfs.com" + +// ConnectionType constants +type stickerStatus int + +const ( + statusInstalled stickerStatus = iota + statusPurchased + statusPending +) + +type API struct { + contractMaker *contracts.ContractMaker + accountsManager *account.GethManager + accountsDB *accounts.Database + rpcFiltersSrvc *rpcfilters.Service + config *params.NodeConfig + ctx context.Context + client *http.Client +} + +type Sticker struct { + PackID *bigint.BigInt `json:"packID"` + URL string `json:"url,omitempty"` + Hash string `json:"hash,omitempty"` +} + +type StickerPack struct { + ID *bigint.BigInt `json:"id"` + Name string `json:"name"` + Author string `json:"author"` + Owner common.Address `json:"owner"` + Price *bigint.BigInt `json:"price"` + Preview string `json:"preview"` + Thumbnail string `json:"thumbnail"` + Stickers []Sticker `json:"stickers"` + + Status stickerStatus `json:"status"` +} + +type ednSticker struct { + Hash string +} + +type ednStickerPack struct { + Name string + Author string + Thumbnail string + Preview string + Stickers []ednSticker +} +type ednStickerPackInfo struct { + Meta ednStickerPack +} + +func NewAPI(ctx context.Context, appDB *sql.DB, rpcClient *rpc.Client, accountsManager *account.GethManager, rpcFiltersSrvc *rpcfilters.Service, config *params.NodeConfig) *API { + return &API{ + contractMaker: &contracts.ContractMaker{ + RPCClient: rpcClient, + }, + accountsManager: accountsManager, + accountsDB: accounts.NewDB(appDB), + rpcFiltersSrvc: rpcFiltersSrvc, + config: config, + ctx: ctx, + client: &http.Client{ + Timeout: time.Second * 5, + }, + } +} + +func (api *API) Market(chainID uint64) ([]StickerPack, error) { + // TODO: eventually this should be changed to include pagination + + accounts, err := api.accountsDB.GetAccounts() + if err != nil { + return nil, err + } + + allStickerPacks, err := api.getContractPacks(chainID) + if err != nil { + return nil, err + } + + purchasedPacks := make(map[uint]struct{}) + + purchasedPackChan := make(chan *big.Int) + errChan := make(chan error) + doneChan := make(chan struct{}, 1) + go api.getAccountsPurchasedPack(chainID, accounts, purchasedPackChan, errChan, doneChan) + + for { + select { + case err := <-errChan: + if err != nil { + return nil, err + } + case packID := <-purchasedPackChan: + if packID != nil { + purchasedPacks[uint(packID.Uint64())] = struct{}{} + } + + case <-doneChan: + // TODO: add an attribute to indicate if the sticker pack + // is bought, but the transaction is still pending confirmation. + var result []StickerPack + for _, pack := range allStickerPacks { + packID := uint(pack.ID.Uint64()) + _, isPurchased := purchasedPacks[packID] + if isPurchased { + pack.Status = statusPurchased + } + result = append(result, pack) + } + return result, nil + } + } +} + +func (api *API) execTokenPackID(chainID uint64, tokenIDs []*big.Int, resultChan chan<- *big.Int, errChan chan<- error, doneChan chan<- struct{}) { + defer close(doneChan) + defer close(errChan) + defer close(resultChan) + + stickerPack, err := api.contractMaker.NewStickerPack(chainID) + if err != nil { + errChan <- err + return + } + + callOpts := &bind.CallOpts{Context: api.ctx, Pending: false} + + wg := sync.WaitGroup{} + wg.Add(len(tokenIDs)) + for _, tokenID := range tokenIDs { + go func(tokenID *big.Int) { + defer wg.Done() + packID, err := stickerPack.TokenPackId(callOpts, tokenID) + if err != nil { + errChan <- err + return + } + resultChan <- packID + }(tokenID) + } + wg.Wait() +} + +func (api *API) getTokenPackIDs(chainID uint64, tokenIDs []*big.Int) ([]*big.Int, error) { + tokenPackIDChan := make(chan *big.Int) + errChan := make(chan error) + doneChan := make(chan struct{}, 1) + + go api.execTokenPackID(chainID, tokenIDs, tokenPackIDChan, errChan, doneChan) + + var tokenPackIDs []*big.Int + for { + select { + case <-doneChan: + return tokenPackIDs, nil + case err := <-errChan: + if err != nil { + return nil, err + } + case t := <-tokenPackIDChan: + if t != nil { + tokenPackIDs = append(tokenPackIDs, t) + } + } + } +} + +func (api *API) getPurchasedPackIDs(chainID uint64, account types.Address) ([]*big.Int, error) { + // TODO: this should be replaced in the future by something like TheGraph to reduce the number of requests to infura + + stickerPack, err := api.contractMaker.NewStickerPack(chainID) + if err != nil { + return nil, err + } + + callOpts := &bind.CallOpts{Context: api.ctx, Pending: false} + + balance, err := stickerPack.BalanceOf(callOpts, common.Address(account)) + if err != nil { + return nil, err + } + + tokenIDs, err := api.getTokenOwnerOfIndex(chainID, account, balance) + if err != nil { + return nil, err + } + + return api.getTokenPackIDs(chainID, tokenIDs) +} + +func hashToURL(hash []byte) (string, error) { + // contract response includes a contenthash, which needs to be decoded to reveal + // an IPFS identifier. Once decoded, download the content from IPFS. This content + // is in EDN format, ie https://ipfs.infura.io/ipfs/QmWVVLwVKCwkVNjYJrRzQWREVvEk917PhbHYAUhA1gECTM + // and it also needs to be decoded in to a nim type + + data, codec, err := multicodec.RemoveCodec(hash) + if err != nil { + return "", err + } + + codecName, err := multicodec.Name(codec) + if err != nil { + return "", err + } + + if codecName != "ipfs-ns" { + return "", errors.New("codecName is not ipfs-ns") + } + + thisCID, err := cid.Parse(data) + if err != nil { + return "", err + } + + str, err := thisCID.StringOfBase(multibase.Base32) + if err != nil { + return "", err + } + + return "https://" + str + ipfsGateway, nil +} + +func (api *API) fetchStickerPacks(chainID uint64, resultChan chan<- *StickerPack, errChan chan<- error, doneChan chan<- struct{}) { + defer close(doneChan) + defer close(errChan) + defer close(resultChan) + + installedPacks, err := api.Installed() + if err != nil { + errChan <- err + return + } + + pendingPacks, err := api.pendingStickerPacks() + if err != nil { + errChan <- err + return + } + + stickerType, err := api.contractMaker.NewStickerType(chainID) + if err != nil { + errChan <- err + return + } + + callOpts := &bind.CallOpts{Context: api.ctx, Pending: false} + + numPacks, err := stickerType.PackCount(callOpts) + if err != nil { + errChan <- err + return + } + + wg := sync.WaitGroup{} + wg.Add(int(numPacks.Int64())) + for i := uint64(0); i < numPacks.Uint64(); i++ { + go func(i uint64) { + defer wg.Done() + + packID := new(big.Int).SetUint64(i) + + _, exists := installedPacks[uint(i)] + if exists { + return // We already have the sticker pack data, no need to query it + } + + _, exists = pendingPacks[uint(i)] + if exists { + return // We already have the sticker pack data, no need to query it + } + + stickerPack, err := api.fetchPackData(stickerType, packID, true) + if err != nil { + log.Warn("Could not retrieve stickerpack data", "packID", packID, "error", err) + return + } + + resultChan <- stickerPack + }(i) + } + wg.Wait() +} + +func (api *API) fetchPackData(stickerType *stickers.StickerType, packID *big.Int, translateHashes bool) (*StickerPack, error) { + callOpts := &bind.CallOpts{Context: api.ctx, Pending: false} + + packData, err := stickerType.GetPackData(callOpts, packID) + if err != nil { + return nil, err + } + + packDetailsURL, err := hashToURL(packData.Contenthash) + if err != nil { + return nil, err + } + + stickerPack := &StickerPack{ + ID: &bigint.BigInt{Int: packID}, + Owner: packData.Owner, + Price: &bigint.BigInt{Int: packData.Price}, + } + + err = api.downloadIPFSData(stickerPack, packDetailsURL, translateHashes) + if err != nil { + return nil, err + } + + return stickerPack, nil +} + +func (api *API) downloadIPFSData(stickerPack *StickerPack, packDetailsURL string, translateHashes bool) error { + // This can be improved by adding a cache using packDetailsURL as key + + req, err := http.NewRequest(http.MethodGet, packDetailsURL, nil) + if err != nil { + return err + } + + resp, err := api.client.Do(req) + if err != nil { + return err + } + + defer func() { + if err := resp.Body.Close(); err != nil { + log.Error("failed to close the stickerpack request body", "err", err) + } + }() + + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return err + } + + return populateStickerPackAttributes(stickerPack, body, translateHashes) +} + +func populateStickerPackAttributes(stickerPack *StickerPack, ednSource []byte, translateHashes bool) error { + var stickerpackIPFSInfo ednStickerPackInfo + err := edn.Unmarshal(ednSource, &stickerpackIPFSInfo) + if err != nil { + return err + } + + stickerPack.Author = stickerpackIPFSInfo.Meta.Author + stickerPack.Name = stickerpackIPFSInfo.Meta.Name + + if translateHashes { + stickerPack.Preview, err = decodeStringHash(stickerpackIPFSInfo.Meta.Preview) + if err != nil { + return err + } + + stickerPack.Thumbnail, err = decodeStringHash(stickerpackIPFSInfo.Meta.Thumbnail) + if err != nil { + return err + } + } else { + stickerPack.Preview = stickerpackIPFSInfo.Meta.Preview + stickerPack.Thumbnail = stickerpackIPFSInfo.Meta.Thumbnail + } + + for _, s := range stickerpackIPFSInfo.Meta.Stickers { + url := "" + if translateHashes { + hash, err := hexutil.Decode("0x" + s.Hash) + if err != nil { + return err + } + + url, err = hashToURL(hash) + if err != nil { + return err + } + } + + stickerPack.Stickers = append(stickerPack.Stickers, Sticker{ + PackID: stickerPack.ID, + URL: url, + Hash: s.Hash, + }) + } + + return nil +} + +func decodeStringHash(input string) (string, error) { + hash, err := hexutil.Decode("0x" + input) + if err != nil { + return "", err + } + + url, err := hashToURL(hash) + if err != nil { + return "", err + } + + return url, nil +} + +func (api *API) getContractPacks(chainID uint64) ([]StickerPack, error) { + stickerPackChan := make(chan *StickerPack) + errChan := make(chan error) + doneChan := make(chan struct{}, 1) + + go api.fetchStickerPacks(chainID, stickerPackChan, errChan, doneChan) + + var packs []StickerPack + + for { + select { + case <-doneChan: + return packs, nil + case err := <-errChan: + if err != nil { + return nil, err + } + case pack := <-stickerPackChan: + if pack != nil { + packs = append(packs, *pack) + } + } + } +} + +func (api *API) getAccountsPurchasedPack(chainID uint64, accs []accounts.Account, resultChan chan<- *big.Int, errChan chan<- error, doneChan chan<- struct{}) { + defer close(doneChan) + defer close(errChan) + defer close(resultChan) + + wg := sync.WaitGroup{} + wg.Add(len(accs)) + for _, account := range accs { + go func(acc accounts.Account) { + defer wg.Done() + packs, err := api.getPurchasedPackIDs(chainID, acc.Address) + if err != nil { + errChan <- err + return + } + + for _, p := range packs { + resultChan <- p + } + }(account) + } + wg.Wait() +} + +func (api *API) execTokenOwnerOfIndex(chainID uint64, account types.Address, balance *big.Int, resultChan chan<- *big.Int, errChan chan<- error, doneChan chan<- struct{}) { + defer close(doneChan) + defer close(errChan) + defer close(resultChan) + + stickerPack, err := api.contractMaker.NewStickerPack(chainID) + if err != nil { + errChan <- err + return + } + + callOpts := &bind.CallOpts{Context: api.ctx, Pending: false} + + wg := sync.WaitGroup{} + wg.Add(int(balance.Int64())) + for i := uint64(0); i < balance.Uint64(); i++ { + go func(i uint64) { + defer wg.Done() + tokenID, err := stickerPack.TokenOfOwnerByIndex(callOpts, common.Address(account), new(big.Int).SetUint64(i)) + if err != nil { + errChan <- err + return + } + + resultChan <- tokenID + }(i) + } + wg.Wait() +} + +func (api *API) getTokenOwnerOfIndex(chainID uint64, account types.Address, balance *big.Int) ([]*big.Int, error) { + tokenIDChan := make(chan *big.Int) + errChan := make(chan error) + doneChan := make(chan struct{}, 1) + + go api.execTokenOwnerOfIndex(chainID, account, balance, tokenIDChan, errChan, doneChan) + + var tokenIDs []*big.Int + for { + select { + case <-doneChan: + return tokenIDs, nil + case err := <-errChan: + if err != nil { + return nil, err + } + case tokenID := <-tokenIDChan: + if tokenID != nil { + tokenIDs = append(tokenIDs, tokenID) + } + } + } +} diff --git a/services/stickers/install.go b/services/stickers/install.go new file mode 100644 index 000000000..9514ad00f --- /dev/null +++ b/services/stickers/install.go @@ -0,0 +1,139 @@ +package stickers + +import ( + "encoding/json" + "errors" + "math/big" + + "github.com/status-im/status-go/services/wallet/bigint" +) + +func (api *API) Install(chainID uint64, packID uint64) error { + installedPacks, err := api.installedStickerPacks() + if err != nil { + return err + } + + if _, exists := installedPacks[uint(packID)]; exists { + return errors.New("sticker pack is already installed") + } + + // TODO: this does not validate if the pack is purchased. Should it? + + stickerType, err := api.contractMaker.NewStickerType(chainID) + if err != nil { + return err + } + + stickerPack, err := api.fetchPackData(stickerType, new(big.Int).SetUint64(packID), false) + if err != nil { + return err + } + + installedPacks[uint(packID)] = *stickerPack + + err = api.accountsDB.SaveSetting("stickers/packs-installed", installedPacks) + if err != nil { + return err + } + + return nil +} + +func (api *API) installedStickerPacks() (map[uint]StickerPack, error) { + stickerPacks := make(map[uint]StickerPack) + + installedStickersJSON, err := api.accountsDB.GetInstalledStickerPacks() + if err != nil { + return nil, err + } + + if installedStickersJSON == nil { + return stickerPacks, nil + } + + err = json.Unmarshal(*installedStickersJSON, &stickerPacks) + if err != nil { + return nil, err + } + + return stickerPacks, nil +} + +func (api *API) Installed() (map[uint]StickerPack, error) { + stickerPacks, err := api.installedStickerPacks() + if err != nil { + return nil, err + } + + for packID, stickerPack := range stickerPacks { + stickerPack.Status = statusInstalled + + stickerPack.Preview, err = decodeStringHash(stickerPack.Preview) + if err != nil { + return nil, err + } + + stickerPack.Thumbnail, err = decodeStringHash(stickerPack.Thumbnail) + if err != nil { + return nil, err + } + + for i, sticker := range stickerPack.Stickers { + sticker.URL, err = decodeStringHash(sticker.Hash) + if err != nil { + return nil, err + } + stickerPack.Stickers[i] = sticker + } + + stickerPacks[packID] = stickerPack + } + + return stickerPacks, nil +} + +func (api *API) Uninstall(packID uint64) error { + installedPacks, err := api.installedStickerPacks() + if err != nil { + return err + } + + if _, exists := installedPacks[uint(packID)]; !exists { + return errors.New("sticker pack is not installed") + } + + delete(installedPacks, uint(packID)) + + err = api.accountsDB.SaveSetting("stickers/packs-installed", installedPacks) + if err != nil { + return err + } + + // Removing uninstalled pack from recent stickers + + recentStickers, err := api.recentStickers() + if err != nil { + return err + } + + pID := &bigint.BigInt{Int: new(big.Int).SetUint64(packID)} + idx := -1 + for i, r := range recentStickers { + if r.PackID.Cmp(pID.Int) == 0 { + idx = i + break + } + } + + if idx > -1 { + var newRecentStickers []Sticker + newRecentStickers = append(newRecentStickers, recentStickers[:idx]...) + if idx != len(recentStickers)-1 { + newRecentStickers = append(newRecentStickers, recentStickers[idx+1:]...) + } + return api.accountsDB.SaveSetting("stickers/recent-stickers", newRecentStickers) + } + + return nil +} diff --git a/services/stickers/pending.go b/services/stickers/pending.go new file mode 100644 index 000000000..157395b30 --- /dev/null +++ b/services/stickers/pending.go @@ -0,0 +1,81 @@ +package stickers + +import ( + "encoding/json" + "errors" + "math/big" +) + +func (api *API) AddPending(chainID uint64, packID uint64) error { + pendingPacks, err := api.pendingStickerPacks() + if err != nil { + return err + } + + if _, exists := pendingPacks[uint(packID)]; exists { + return errors.New("sticker pack is already pending") + } + + stickerType, err := api.contractMaker.NewStickerType(chainID) + if err != nil { + return err + } + + stickerPack, err := api.fetchPackData(stickerType, new(big.Int).SetUint64(packID), false) + if err != nil { + return err + } + + pendingPacks[uint(packID)] = *stickerPack + + return api.accountsDB.SaveSetting("stickers/packs-pending", pendingPacks) +} + +func (api *API) pendingStickerPacks() (map[uint]StickerPack, error) { + stickerPacks := make(map[uint]StickerPack) + + pendingStickersJSON, err := api.accountsDB.GetPendingStickerPacks() + if err != nil { + return nil, err + } + + if pendingStickersJSON == nil { + return stickerPacks, nil + } + + err = json.Unmarshal(*pendingStickersJSON, &stickerPacks) + if err != nil { + return nil, err + } + + return stickerPacks, nil +} + +func (api *API) Pending() (map[uint]StickerPack, error) { + stickerPacks, err := api.pendingStickerPacks() + if err != nil { + return nil, err + } + + for packID, stickerPack := range stickerPacks { + stickerPack.Status = statusPending + stickerPacks[packID] = stickerPack + } + + return stickerPacks, nil +} + +func (api *API) RemovePending(packID uint64) error { + pendingPacks, err := api.pendingStickerPacks() + if err != nil { + return err + } + + if _, exists := pendingPacks[uint(packID)]; !exists { + return errors.New("sticker pack is not pending") + } + + delete(pendingPacks, uint(packID)) + + return api.accountsDB.SaveSetting("stickers/packs-pending", pendingPacks) +} diff --git a/services/stickers/recent.go b/services/stickers/recent.go new file mode 100644 index 000000000..635340852 --- /dev/null +++ b/services/stickers/recent.go @@ -0,0 +1,72 @@ +package stickers + +import ( + "encoding/json" +) + +const maxNumberRecentStickers = 24 + +func (api *API) recentStickers() ([]Sticker, error) { + var recentStickersList []Sticker + + recentStickersJSON, err := api.accountsDB.GetRecentStickers() + if err != nil { + return nil, err + } + + if recentStickersJSON == nil { + return nil, nil + } + + err = json.Unmarshal(*recentStickersJSON, &recentStickersList) + if err != nil { + return nil, err + } + + return recentStickersList, nil +} + +func (api *API) Recent() ([]Sticker, error) { + recentStickersList, err := api.recentStickers() + if err != nil { + return nil, err + } + + for i, sticker := range recentStickersList { + sticker.URL, err = decodeStringHash(sticker.Hash) + if err != nil { + return nil, err + } + recentStickersList[i] = sticker + } + + return recentStickersList, nil +} + +func (api *API) AddRecent(sticker Sticker) error { + recentStickersList, err := api.recentStickers() + if err != nil { + return err + } + + // Remove duplicated + idx := -1 + for i, currSticker := range recentStickersList { + if currSticker.PackID.Cmp(sticker.PackID.Int) == 0 { + idx = i + } + } + if idx > -1 { + recentStickersList = append(recentStickersList[:idx], recentStickersList[idx+1:]...) + } + + sticker.URL = "" + + if len(recentStickersList) >= maxNumberRecentStickers { + recentStickersList = append([]Sticker{sticker}, recentStickersList[:maxNumberRecentStickers-1]...) + } else { + recentStickersList = append([]Sticker{sticker}, recentStickersList...) + } + + return api.accountsDB.SaveSetting("stickers/recent-stickers", recentStickersList) +} diff --git a/services/stickers/service.go b/services/stickers/service.go new file mode 100644 index 000000000..b24a5ab88 --- /dev/null +++ b/services/stickers/service.go @@ -0,0 +1,68 @@ +package stickers + +import ( + "context" + "database/sql" + + "github.com/ethereum/go-ethereum/p2p" + ethRpc "github.com/ethereum/go-ethereum/rpc" + "github.com/status-im/status-go/account" + "github.com/status-im/status-go/params" + "github.com/status-im/status-go/rpc" + "github.com/status-im/status-go/services/rpcfilters" +) + +// NewService initializes service instance. +func NewService(appDB *sql.DB, rpcClient *rpc.Client, accountsManager *account.GethManager, rpcFiltersSrvc *rpcfilters.Service, config *params.NodeConfig) *Service { + ctx, cancel := context.WithCancel(context.Background()) + + return &Service{ + appDB: appDB, + rpcClient: rpcClient, + accountsManager: accountsManager, + rpcFiltersSrvc: rpcFiltersSrvc, + config: config, + + ctx: ctx, + cancel: cancel, + } +} + +// Service is a browsers service. +type Service struct { + appDB *sql.DB + rpcClient *rpc.Client + accountsManager *account.GethManager + rpcFiltersSrvc *rpcfilters.Service + config *params.NodeConfig + + ctx context.Context + cancel context.CancelFunc +} + +// Start a service. +func (s *Service) Start() error { + return nil +} + +// Stop a service. +func (s *Service) Stop() error { + s.cancel() + return nil +} + +// APIs returns list of available RPC APIs. +func (s *Service) APIs() []ethRpc.API { + return []ethRpc.API{ + { + Namespace: "stickers", + Version: "0.1.0", + Service: NewAPI(s.ctx, s.appDB, s.rpcClient, s.accountsManager, s.rpcFiltersSrvc, s.config), + }, + } +} + +// Protocols returns list of p2p protocols. +func (s *Service) Protocols() []p2p.Protocol { + return nil +} diff --git a/services/stickers/transactions.go b/services/stickers/transactions.go new file mode 100644 index 000000000..f7b64467d --- /dev/null +++ b/services/stickers/transactions.go @@ -0,0 +1,140 @@ +package stickers + +import ( + "context" + "math/big" + "strings" + + "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" + ethTypes "github.com/ethereum/go-ethereum/core/types" + "github.com/status-im/status-go/contracts/snt" + "github.com/status-im/status-go/contracts/stickers" + "github.com/status-im/status-go/eth-node/types" + "github.com/status-im/status-go/transactions" +) + +func (api *API) getSigner(chainID uint64, from types.Address, password string) bind.SignerFn { + return func(addr common.Address, tx *ethTypes.Transaction) (*ethTypes.Transaction, error) { + selectedAccount, err := api.accountsManager.VerifyAccountPassword(api.config.KeyStoreDir, from.Hex(), password) + if err != nil { + return nil, err + } + s := ethTypes.NewLondonSigner(new(big.Int).SetUint64(chainID)) + return ethTypes.SignTx(tx, s, selectedAccount.PrivateKey) + } +} + +func (api *API) Buy(ctx context.Context, chainID uint64, txArgs transactions.SendTxArgs, packID *big.Int, password string) (string, error) { + err := api.AddPending(chainID, packID.Uint64()) + if err != nil { + return "", err + } + + snt, err := api.contractMaker.NewSNT(chainID) + if err != nil { + return "", err + } + + stickerType, err := api.contractMaker.NewStickerType(chainID) + if err != nil { + return "", err + } + + callOpts := &bind.CallOpts{Context: api.ctx, Pending: false} + + packInfo, err := stickerType.GetPackData(callOpts, packID) + if err != nil { + return "", err + } + + stickerMarketABI, err := abi.JSON(strings.NewReader(stickers.StickerMarketABI)) + if err != nil { + return "", err + } + + extraData, err := stickerMarketABI.Pack("buyToken", packID, packInfo.Price) + if err != nil { + return "", err + } + + stickerMarketAddress, err := stickers.StickerMarketContractAddress(chainID) + if err != nil { + return "", err + } + + txOpts := txArgs.ToTransactOpts(api.getSigner(chainID, txArgs.From, password)) + tx, err := snt.ApproveAndCall( + txOpts, + stickerMarketAddress, + packInfo.Price, + extraData, + ) + + if err != nil { + return "", err + } + + // TODO: track pending transaction (do this in ENS service too) + + go api.rpcFiltersSrvc.TriggerTransactionSentToUpstreamEvent(types.Hash(tx.Hash())) + return tx.Hash().String(), nil +} + +func (api *API) BuyEstimate(ctx context.Context, chainID uint64, txArgs transactions.SendTxArgs, packID *big.Int) (uint64, error) { + callOpts := &bind.CallOpts{Context: api.ctx, Pending: false} + + stickerType, err := api.contractMaker.NewStickerType(chainID) + if err != nil { + return 0, err + } + + packInfo, err := stickerType.GetPackData(callOpts, packID) + if err != nil { + return 0, err + } + + stickerMarketABI, err := abi.JSON(strings.NewReader(stickers.StickerMarketABI)) + if err != nil { + return 0, err + } + + extraData, err := stickerMarketABI.Pack("buyToken", packID, packInfo.Price) + if err != nil { + return 0, err + } + + sntABI, err := abi.JSON(strings.NewReader(snt.SNTABI)) + if err != nil { + return 0, err + } + + stickerMarketAddress, err := stickers.StickerMarketContractAddress(chainID) + if err != nil { + return 0, err + } + + data, err := sntABI.Pack("approveAndCall", stickerMarketAddress, packInfo.Price, extraData) + if err != nil { + return 0, err + } + + ethClient, err := api.contractMaker.RPCClient.EthClient(chainID) + if err != nil { + return 0, err + } + + sntAddress, err := snt.ContractAddress(chainID) + if err != nil { + return 0, err + } + + return ethClient.EstimateGas(ctx, ethereum.CallMsg{ + From: common.Address(txArgs.From), + To: &sntAddress, + Value: big.NewInt(0), + Data: data, + }) +} diff --git a/services/wallet/token.go b/services/wallet/token.go index 1121b9cce..40c2af884 100644 --- a/services/wallet/token.go +++ b/services/wallet/token.go @@ -12,9 +12,9 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/log" + "github.com/status-im/status-go/contracts/ierc20" "github.com/status-im/status-go/services/wallet/async" "github.com/status-im/status-go/services/wallet/chain" - "github.com/status-im/status-go/services/wallet/ierc20" ) var requestTimeout = 20 * time.Second diff --git a/vendor/modules.txt b/vendor/modules.txt index d79b6f58c..78e0afb08 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -687,3 +687,5 @@ gopkg.in/natefinch/npipe.v2 gopkg.in/urfave/cli.v1 # gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b gopkg.in/yaml.v3 +# olympos.io/encoding/edn v0.0.0-20201019073823-d3554ca0b0a3 +olympos.io/encoding/edn diff --git a/vendor/olympos.io/encoding/edn/.travis.yml b/vendor/olympos.io/encoding/edn/.travis.yml new file mode 100644 index 000000000..dba7b3366 --- /dev/null +++ b/vendor/olympos.io/encoding/edn/.travis.yml @@ -0,0 +1,4 @@ +language: go +sudo: false +go: + - 1.5 diff --git a/vendor/olympos.io/encoding/edn/LICENSE b/vendor/olympos.io/encoding/edn/LICENSE new file mode 100644 index 000000000..9efc5f36c --- /dev/null +++ b/vendor/olympos.io/encoding/edn/LICENSE @@ -0,0 +1,25 @@ +Copyright (c) 2015, The Go Authors, Jean Niklas L'orange +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this +list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation and/or +other materials provided with the distribution. + * Neither the name of Google Inc., the copyright holder nor the names of its +contributors may be used to endorse or promote products derived from this +software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/olympos.io/encoding/edn/README.md b/vendor/olympos.io/encoding/edn/README.md new file mode 100644 index 000000000..3d3944438 --- /dev/null +++ b/vendor/olympos.io/encoding/edn/README.md @@ -0,0 +1,116 @@ +# Go implementation of EDN, extensible data notation + +[![GoDoc](https://godoc.org/olympos.io/encoding/edn?status.svg)](https://godoc.org/olympos.io/encoding/edn) + +go-edn is a Golang library to read and write +[EDN](https://github.com/edn-format/edn) (extensible data notation), a subset of +Clojure used for transferring data between applications, much like JSON or XML. +EDN is also a very good language for configuration files, much like a JSON-like +version of YAML. + +This library is heavily influenced by the JSON library that ships with Go, and +people familiar with that package should know the basics of how this library +works. In fact, this should be close to a drop-in replacement for the +`encoding/json` package if you only use basic functionality. + +This implementation is complete, stable, and presumably also bug free. This +is why you don't see any changes in the repository. + +If you wonder why you should (or should not) use EDN, you can have a look at the +[why](docs/why.md) document. + +## Installation and Usage + +The import path for the package is `olympos.io/encoding/edn` + +To install it, run: + +```shell +go get olympos.io/encoding/edn +``` + +To use it in your project, you import `olympos.io/encoding/edn` and refer to it as `edn` +like this: + +```go +import "olympos.io/encoding/edn" + +//... + +edn.DoStuff() +``` + +The previous import path of this library was `gopkg.in/edn.v1`, which is still +permanently supported. + +## Quickstart + +You can follow http://blog.golang.org/json-and-go and replace every occurence of +JSON with EDN (and the JSON data with EDN data), and the text makes almost +perfect sense. The only caveat is that, since EDN is more general than JSON, go-edn +stores arbitrary maps on the form `map[interface{}]interface{}`. + +go-edn also ships with keywords, symbols and tags as types. + +For a longer introduction on how to use the library, see +[introduction.md](docs/introduction.md). If you're familiar with the JSON +package, then the [API Documentation](https://godoc.org/olympos.io/encoding/edn) might +be the only thing you need. + +## Example Usage + +Say you want to describe your pet forum's users as EDN. They have the following +types: + +```go +type Animal struct { + Name string + Type string `edn:"kind"` +} + +type Person struct { + Name string + Birthyear int `edn:"born"` + Pets []Animal +} +``` + +With go-edn, we can do as follows to read and write these types: + +```go +import "olympos.io/encoding/edn" + +//... + + +func ReturnData() (Person, error) { + data := `{:name "Hans", + :born 1970, + :pets [{:name "Cap'n Jack" :kind "Sparrow"} + {:name "Freddy" :kind "Cockatiel"}]}` + var user Person + err := edn.Unmarshal([]byte(data), &user) + // user '==' Person{"Hans", 1970, + // []Animal{{"Cap'n Jack", "Sparrow"}, {"Freddy", "Cockatiel"}}} + return user, err +} +``` + +If you want to write that user again, just `Marshal` it: + +```go +bs, err := edn.Marshal(user) +``` + +## Dependencies + +go-edn has no external dependencies, except the default Go library. However, as +it depends on `math/big.Float`, go-edn requires Go 1.5 or higher. + + +## License + +Copyright © 2015-2019 Jean Niklas L'orange and [contributors](https://github.com/go-edn/edn/graphs/contributors) + +Distributed under the BSD 3-clause license, which is available in the file +LICENSE. diff --git a/vendor/olympos.io/encoding/edn/compact.go b/vendor/olympos.io/encoding/edn/compact.go new file mode 100644 index 000000000..474c770b4 --- /dev/null +++ b/vendor/olympos.io/encoding/edn/compact.go @@ -0,0 +1,98 @@ +// Copyright 2015 Jean Niklas L'orange. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package edn + +import ( + "bytes" + "io" +) + +func tokNeedsDelim(t tokenType) bool { + switch t { + case tokenString, tokenListStart, tokenListEnd, tokenVectorStart, + tokenVectorEnd, tokenMapEnd, tokenMapStart, tokenSetStart, tokenDiscard, tokenError: + return false + } + return true +} + +func delimits(r rune) bool { + switch r { + case '{', '}', '[', ']', '(', ')', '\\', '"': + return true + } + return isWhitespace(r) +} + +// Compact appends to dst a compacted form of the EDN-encoded src. It does not +// remove discard values. +func Compact(dst *bytes.Buffer, src []byte) error { + origLen := dst.Len() + var lex lexer + lex.reset() + buf := bytes.NewBuffer(src) + start, pos := 0, 0 + needsDelim := false + prevIgnore := '\uFFFD' + r, size, err := buf.ReadRune() + for ; err == nil; r, size, err = buf.ReadRune() { + ls := lex.state(r) + ppos := pos + pos += size + switch ls { + case lexCont: + if ppos == start && needsDelim && !delimits(r) { + dst.WriteRune(prevIgnore) + } + continue + case lexIgnore: + prevIgnore = r + start = pos + case lexError: + dst.Truncate(origLen) + return lex.err + case lexEnd: + // here we might want to discard #_ and the like. Currently we don't. + dst.Write(src[start:pos]) + needsDelim = tokNeedsDelim(lex.token) + lex.reset() + start = pos + case lexEndPrev: + dst.Write(src[start:ppos]) + lex.reset() + lss := lex.state(r) + needsDelim = tokNeedsDelim(lex.token) + switch lss { + case lexIgnore: + prevIgnore = r + start = pos + case lexCont: + start = ppos + case lexEnd: + dst.WriteRune(r) + lex.reset() + start = pos + case lexEndPrev: + dst.Truncate(origLen) + return errInternal + case lexError: + dst.Truncate(origLen) + return lex.err + } + } + } + if err != io.EOF { + return err + } + ls := lex.eof() + switch ls { + case lexEnd: + dst.Write(src[start:pos]) + case lexError: + dst.Truncate(origLen) + return lex.err + } + return nil +} diff --git a/vendor/olympos.io/encoding/edn/decode.go b/vendor/olympos.io/encoding/edn/decode.go new file mode 100644 index 000000000..fb07613ad --- /dev/null +++ b/vendor/olympos.io/encoding/edn/decode.go @@ -0,0 +1,1678 @@ +// Copyright 2015 Jean Niklas L'orange. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package edn + +import ( + "bufio" + "bytes" + "errors" + "fmt" + "io" + "math/big" + "reflect" + "runtime" + "strconv" + "strings" + "unicode/utf8" +) + +var ( + errInternal = errors.New("Illegal internal parse state") + errNoneLeft = errors.New("No more tokens to read") + errUnexpected = errors.New("Unexpected token") + errIllegalRune = errors.New("Illegal rune form") +) + +type UnknownTagError struct { + tag []byte + value []byte + inType reflect.Type +} + +func (ute UnknownTagError) Error() string { + return fmt.Sprintf("Unable to decode %s%s into %s", string(ute.tag), + string(ute.value), ute.inType) +} + +// Unmarshal parses the EDN-encoded data and stores the result in the value +// pointed to by v. +// +// Unmarshal uses the inverse of the encodings that Marshal uses, allocating +// maps, slices, and pointers as necessary, with the following additional rules: +// +// First, if the value to store the result into implements edn.Unmarshaler, it +// is called. +// +// If the value is tagged and the tag is known, the EDN value is translated into +// the input of the tag convert function. If no error happens during converting, +// the result of the conversion is then coerced into v if possible. +// +// To unmarshal EDN into a pointer, Unmarshal first handles the case of the EDN +// being the EDN literal nil. In that case, Unmarshal sets the pointer to nil. +// Otherwise, Unmarshal unmarshals the EDN into the value pointed at by the +// pointer. If the pointer is nil, Unmarshal allocates a new value for it to +// point to. +// +// To unmarshal EDN into a struct, Unmarshal matches incoming object +// keys to the keys used by Marshal (either the struct field name or its tag), +// preferring an exact match but also accepting a case-insensitive match. +// +// To unmarshal EDN into an interface value, +// Unmarshal stores one of these in the interface value: +// +// bool, for EDN booleans +// float64, for EDN floats +// int64, for EDN integers +// int32, for EDN characters +// string, for EDN strings +// []interface{}, for EDN vectors and lists +// map[interface{}]interface{}, for EDN maps +// map[interface{}]bool, for EDN sets +// nil for EDN nil +// edn.Tag for unknown EDN tagged elements +// T for known EDN tagged elements, where T is the result of the converter function +// +// To unmarshal an EDN vector/list into a slice, Unmarshal resets the slice to +// nil and then appends each element to the slice. +// +// To unmarshal an EDN map into a Go map, Unmarshal replaces the map +// with an empty map and then adds key-value pairs from the object to +// the map. +// +// If a EDN value is not appropriate for a given target type, or if a EDN number +// overflows the target type, Unmarshal skips that field and completes the +// unmarshalling as best it can. If no more serious errors are encountered, +// Unmarshal returns an UnmarshalTypeError describing the earliest such error. +// +// The EDN nil value unmarshals into an interface, map, pointer, or slice by +// setting that Go value to nil. +// +// When unmarshaling strings, invalid UTF-8 or invalid UTF-16 surrogate pairs +// are not treated as an error. Instead, they are replaced by the Unicode +// replacement character U+FFFD. +// +func Unmarshal(data []byte, v interface{}) error { + return newDecoder(bufio.NewReader(bytes.NewBuffer(data))).Decode(v) +} + +// UnmarshalString works like Unmarshal, but accepts a string as input instead +// of a byte slice. +func UnmarshalString(data string, v interface{}) error { + return newDecoder(bufio.NewReader(bytes.NewBufferString(data))).Decode(v) +} + +// NewDecoder returns a new decoder that reads from r. +// +// The decoder introduces its own buffering and may read data from r beyond the +// EDN values requested. +func NewDecoder(r io.Reader) *Decoder { + return newDecoder(bufio.NewReader(r)) +} + +// Buffered returns a reader of the data remaining in the Decoder's buffer. The +// reader is valid until the next call to Decode. +func (d *Decoder) Buffered() *bufio.Reader { + return d.rd +} + +// AddTagFn adds a tag function to the decoder's TagMap. Note that TagMaps are +// mutable: If Decoder A and B share TagMap, then adding a tag function to one +// may modify both. +func (d *Decoder) AddTagFn(tagname string, fn interface{}) error { + return d.tagmap.AddTagFn(tagname, fn) +} + +// MustAddTagFn adds a tag function to the decoder's TagMap like AddTagFn, +// except this function also panics if the tag could not be added. +func (d *Decoder) MustAddTagFn(tagname string, fn interface{}) { + d.tagmap.MustAddTagFn(tagname, fn) +} + +// AddTagStruct adds a tag struct to the decoder's TagMap. Note that TagMaps are +// mutable: If Decoder A and B share TagMap, then adding a tag struct to one +// may modify both. +func (d *Decoder) AddTagStruct(tagname string, example interface{}) error { + return d.tagmap.AddTagStruct(tagname, example) +} + +// UseTagMap sets the TagMap provided as the TagMap for this decoder. +func (d *Decoder) UseTagMap(tm *TagMap) { + d.tagmap = tm +} + +// UseMathContext sets the given math context as default math context for this +// decoder. +func (d *Decoder) UseMathContext(mc MathContext) { + d.mc = &mc +} + +func (d *Decoder) mathContext() *MathContext { + if d.mc != nil { + return d.mc + } + return &GlobalMathContext +} + +// DisallowUnknownFields causes the Decoder to return an error when the +// destination is a struct and the input contains keys which do not match any +// non-ignored, exported fields in the destination. +func (d *Decoder) DisallowUnknownFields() { + d.disallowUnknownFields = true +} + +// Unmarshaler is the interface implemented by objects that can unmarshal an EDN +// description of themselves. The input can be assumed to be a valid encoding of +// an EDN value. UnmarshalEDN must copy the EDN data if it wishes to retain the +// data after returning. +type Unmarshaler interface { + UnmarshalEDN([]byte) error +} + +type parseState int + +const ( + parseToplevel = iota + parseList + parseVector + parseMap + parseSet + parseTagged + parseDiscard +) + +// A Decoder reads and decodes EDN objects from an input stream. +type Decoder struct { + disallowUnknownFields bool + + lex *lexer + savedError error + rd *bufio.Reader + tagmap *TagMap + mc *MathContext + // parser-specific + prevSlice []byte + prevTtype tokenType + undo bool + // if nextToken returned lexEndPrev, we must write the leftover value at + // next call to nextToken + hasLeftover bool + leftover rune +} + +// An InvalidUnmarshalError describes an invalid argument passed to Unmarshal. +// (The argument to Unmarshal must be a non-nil pointer.) +type InvalidUnmarshalError struct { + Type reflect.Type +} + +func (e *InvalidUnmarshalError) Error() string { + if e.Type == nil { + return "edn: Unmarshal(nil)" + } + + if e.Type.Kind() != reflect.Ptr { + return "edb: Unmarshal(non-pointer " + e.Type.String() + ")" + } + return "edn: Unmarshal(nil " + e.Type.String() + ")" +} + +// An UnmarshalTypeError describes a EDN value that was +// not appropriate for a value of a specific Go type. +type UnmarshalTypeError struct { + Value string // description of EDN value - "bool", "array", "number -5" + Type reflect.Type // type of Go value it could not be assigned to +} + +func (e *UnmarshalTypeError) Error() string { + return "edn: cannot unmarshal " + e.Value + " into Go value of type " + e.Type.String() +} + +// UnhashableError is an error which occurs when the decoder attempted to assign +// an unhashable key to a map or set. The position close to where value was +// found is provided to help debugging. +type UnhashableError struct { + Position int64 +} + +func (e *UnhashableError) Error() string { + return "edn: unhashable type at position " + strconv.FormatInt(e.Position, 10) + " in input" +} + +type UnknownFieldError struct { + Field string // the field name + Type reflect.Type // type of Go struct with a missing field +} + +func (e *UnknownFieldError) Error() string { + return "edn: cannot find a field '" + e.Field + "' in a struct " + e.Type.String() + " to unmarshal into" +} + +// Decode reads the next EDN-encoded value from its input and stores it in the +// value pointed to by v. +// +// See the documentation for Unmarshal for details about the conversion of EDN +// into a Go value. +func (d *Decoder) Decode(val interface{}) (err error) { + defer func() { + if r := recover(); r != nil { + // if unhashable, return ErrUnhashable. Else panic unless it's an error + // from the decoder itself. + if rerr, ok := r.(runtime.Error); ok { + if strings.Contains(rerr.Error(), "unhashable") { + err = &UnhashableError{Position: d.lex.position} + } else { + panic(r) + } + } else { + err = r.(error) + } + } + }() + + err = d.more() + if err != nil { + return err + } + + rv := reflect.ValueOf(val) + if rv.Kind() != reflect.Ptr || rv.IsNil() { + return &InvalidUnmarshalError{reflect.TypeOf(val)} + } + + d.value(rv) + + return nil +} + +func newDecoder(buf *bufio.Reader) *Decoder { + lex := lexer{} + lex.reset() + return &Decoder{ + lex: &lex, + rd: buf, + hasLeftover: false, + leftover: '\uFFFD', + tagmap: new(TagMap), + } +} + +func (d *Decoder) getTagFn(tagname string) *reflect.Value { + d.tagmap.RLock() + f, ok := d.tagmap.m[tagname] + d.tagmap.RUnlock() + if ok { + return &f + } + globalTags.RLock() + f, ok = globalTags.m[tagname] + globalTags.RUnlock() + if ok { + return &f + } + return nil +} + +func (d *Decoder) error(err error) { + panic(err) +} + +func (d *Decoder) doUndo(bs []byte, ttype tokenType) { + if d.undo { + d.error(errInternal) // this is LL(1), so this shouldn't happen + } + d.undo = true + d.prevSlice = bs + d.prevTtype = ttype +} + +// array consumes an array from d.data[d.off-1:], decoding into the value v. +// the first byte of the array ('[') has been read already. +func (d *Decoder) array(v reflect.Value, endType tokenType) { + // Check for unmarshaler. + u, pv := d.indirect(v, false) + if u != nil { + switch endType { + case tokenVectorEnd: + d.doUndo([]byte{'['}, tokenVectorStart) + case tokenListEnd: + d.doUndo([]byte{'('}, tokenListStart) + case tokenSetEnd: + d.doUndo([]byte{'#', '{'}, tokenSetStart) + } + bs, err := d.nextValueBytes() + if err == nil { + err = u.UnmarshalEDN(bs) + } + if err != nil { + d.error(err) + } + return + } + v = pv + + // Check type of target. + switch v.Kind() { + case reflect.Interface: + if v.NumMethod() == 0 { + // Decoding into nil interface? Switch to non-reflect code. + v.Set(reflect.ValueOf(d.arrayInterface(endType))) + return + } + // Otherwise it's invalid. + fallthrough + default: + d.error(&UnmarshalTypeError{"array", v.Type()}) + return + case reflect.Array: + case reflect.Slice: + break + } + + i := 0 + for { + // Look ahead for ] - can only happen on first iteration. + bs, ttype, err := d.nextToken() + if err != nil { + d.error(err) + } + if ttype == endType { + break + } + d.doUndo(bs, ttype) + + // Get element of array, growing if necessary. + if v.Kind() == reflect.Slice { + // Grow slice if necessary + if i >= v.Cap() { + newcap := v.Cap() + v.Cap()/2 + if newcap < 4 { + newcap = 4 + } + newv := reflect.MakeSlice(v.Type(), v.Len(), newcap) + reflect.Copy(newv, v) + v.Set(newv) + } + if i >= v.Len() { + v.SetLen(i + 1) + } + } + + if i < v.Len() { + // Decode into element. + d.value(v.Index(i)) + } else { + // Ran out of fixed array: skip. + d.value(reflect.Value{}) + } + i++ + } + + if i < v.Len() { + if v.Kind() == reflect.Array { + // Array. Zero the rest. + z := reflect.Zero(v.Type().Elem()) + for ; i < v.Len(); i++ { + v.Index(i).Set(z) + } + } else { + v.SetLen(i) + } + } + if i == 0 && v.Kind() == reflect.Slice { + v.Set(reflect.MakeSlice(v.Type(), 0, 0)) + } +} + +func (d *Decoder) arrayInterface(endType tokenType) interface{} { + var v = make([]interface{}, 0) + for { + // look out for endType + bs, tt, err := d.nextToken() + if err != nil { + d.error(err) + break + } + if tt == endType { + break + } + d.doUndo(bs, tt) + v = append(v, d.valueInterface()) + } + return v +} + +func (d *Decoder) value(v reflect.Value) { + if !v.IsValid() { + // read value and ignore it + d.valueInterface() + return + } + + bs, ttype, err := d.nextToken() + // check error first + if err != nil { + d.error(err) + return + } + switch ttype { + default: + d.error(errUnexpected) + case tokenSymbol, tokenKeyword, tokenString, tokenInt, tokenFloat, tokenChar: + d.literal(bs, ttype, v) + case tokenTag: + d.tag(bs, v) + case tokenListStart: + d.array(v, tokenListEnd) + case tokenVectorStart: + d.array(v, tokenVectorEnd) + case tokenSetStart: + d.set(v) + case tokenMapStart: + d.ednmap(v) + } +} + +func (d *Decoder) tag(tag []byte, v reflect.Value) { + // Check for unmarshaler. + u, pv := d.indirect(v, false) + if u != nil { + bs, err := d.nextValueBytes() + if err == nil { + err = u.UnmarshalEDN(append(append(tag, ' '), bs...)) + } + if err != nil { + d.error(err) + } + return + } + v = pv + + if v.Kind() == reflect.Interface && v.NumMethod() == 0 { + v.Set(reflect.ValueOf(d.tagInterface(tag))) + return + } + + fn := d.getTagFn(string(tag[1:])) + if fn == nil { + // So in theory we'd have to match against any interface that could be + // assignable to the Tag type, to ensure we would decode whenever possible. + // That is any interface that specifies any combination of the methods + // MarshalEDN, UnmarshalEDN and String. I'm not sure if that makes sense + // though, so I've punted this for now. + bs, err := d.nextValueBytes() + if err != nil { + d.error(err) + } + d.error(UnknownTagError{tag, bs, v.Type()}) + } else { + tfn := fn.Type() + var result reflect.Value + // if not func, just match on struct shape + if tfn.Kind() != reflect.Func { + result = reflect.New(tfn).Elem() + d.value(result) + } else { // otherwise match on input value and call the function + inVal := reflect.New(tfn.In(0)) + d.value(inVal) + res := fn.Call([]reflect.Value{inVal.Elem()}) + if err, ok := res[1].Interface().(error); ok && err != nil { + d.error(err) + } + result = res[0] + } + // result is not necessarily direct, so we have to make it direct, but + // *only* if it's NOT null at every step. Which leads to the question: How + // do we unify these values? This is particularly hairy if these are double + // pointers or bigger. + + // Currently we only attempt to solve this for results by checking if the + // result can be dereferenced into a value. The value will always be a + // non-pointer, so presumably we can assign it in this fashion as a + // temporary resolution. + if result.Type().AssignableTo(v.Type()) { + v.Set(result) + return + } + if result.Kind() == reflect.Ptr && !result.IsNil() && + result.Elem().Type().AssignableTo(v.Type()) { + // is res a non-nil pointer to a value we can assign to? If yes, then + // let's just do that. + v.Set(result.Elem()) + return + } + d.error(fmt.Errorf("Cannot assign %s to %s (tag issue?)", result.Type(), v.Type())) + } +} + +func (d *Decoder) tagInterface(tag []byte) interface{} { + fn := d.getTagFn(string(tag[1:])) + if fn == nil { + var t Tag + t.Tagname = string(tag[1:]) + t.Value = d.valueInterface() + return t + } else if fn.Type().Kind() != reflect.Func { + res := reflect.New(fn.Type()).Elem() + d.value(res) + return res.Interface() + } else { + tfn := fn.Type() + val := reflect.New(tfn.In(0)) + d.value(val) + res := fn.Call([]reflect.Value{val.Elem()}) + if err, ok := res[1].Interface().(error); ok && err != nil { + d.error(err) + } + return res[0].Interface() + } +} + +func (d *Decoder) valueInterface() interface{} { + bs, ttype, err := d.nextToken() + // check error first + if err != nil { + d.error(err) + return nil /// won't get here + } + switch ttype { + default: + d.error(errUnexpected) + return nil + case tokenSymbol, tokenKeyword, tokenString, tokenInt, tokenFloat, tokenChar: + return d.literalInterface(bs, ttype) + case tokenTag: + return d.tagInterface(bs) + case tokenListStart: + return d.arrayInterface(tokenListEnd) + case tokenVectorStart: + return d.arrayInterface(tokenVectorEnd) + case tokenSetStart: + return d.setInterface() + case tokenMapStart: + return d.ednmapInterface() + } + return nil +} + +func (d *Decoder) ednmap(v reflect.Value) { + // Check for unmarshaler. + u, pv := d.indirect(v, false) + if u != nil { + d.doUndo([]byte{'{'}, tokenMapStart) + bs, err := d.nextValueBytes() + if err == nil { + err = u.UnmarshalEDN(bs) + } + if err != nil { + d.error(err) + } + return + } + v = pv + + if v.Kind() == reflect.Interface && v.NumMethod() == 0 { + v.Set(reflect.ValueOf(d.ednmapInterface())) + return + } + + var keyType reflect.Type + + // Check type of target: Struct or map[T]U + switch v.Kind() { + case reflect.Map: + t := v.Type() + keyType = t.Key() + if v.IsNil() { + v.Set(reflect.MakeMap(t)) + } + case reflect.Struct: + + default: + d.error(&UnmarshalTypeError{"map", v.Type()}) + } + + // separate these to ease reading (theoretically fewer checks too) + if v.Kind() == reflect.Struct { + for { + bs, tt, err := d.nextToken() + if err != nil { + d.error(err) + } + if tt == tokenSetEnd { + break + } + skip := false + var key []byte + // The key can either be a symbol, a keyword or a string. We will skip + // anything that is not any of these values. + switch tt { + case tokenSymbol: + if bytes.Equal(bs, falseByte) || bytes.Equal(bs, trueByte) || bytes.Equal(bs, nilByte) { + skip = true + } + key = bs + case tokenKeyword: + key = bs[1:] + case tokenString: + k, ok := unquoteBytes(bs) + key = k + if !ok { + d.error(errInternal) + } + default: + skip = true + } + + if skip { // will panic if something bad happens, so this is fine + d.valueInterface() + continue + } + + var subv reflect.Value + var f *field + fields := cachedTypeFields(v.Type()) + for i := range fields { + ff := &fields[i] + if bytes.Equal(ff.nameBytes, key) { + f = ff + break + } + if f == nil && ff.equalFold(ff.nameBytes, key) { + f = ff + } + } + if f != nil { + subv = v + for _, i := range f.index { + if subv.Kind() == reflect.Ptr { + if subv.IsNil() { + subv.Set(reflect.New(subv.Type().Elem())) + } + subv = subv.Elem() + } + subv = subv.Field(i) + } + } else if d.disallowUnknownFields { + d.error(&UnknownFieldError{string(key), v.Type()}) + } + // If subv not set, value() will just skip. + d.value(subv) + } + // if not struct, then it is a map + } else if keyType.Kind() == reflect.Interface && keyType.NumMethod() == 0 { + // special case for unhashable key types + var mapElem reflect.Value + for { + bs, tt, err := d.nextToken() + if err != nil { + d.error(err) + } + if tt == tokenSetEnd { + break + } + d.doUndo(bs, tt) + + key := d.valueInterface() + elemType := v.Type().Elem() + if !mapElem.IsValid() { + mapElem = reflect.New(elemType).Elem() + } else { + mapElem.Set(reflect.Zero(elemType)) + } + subv := mapElem + d.value(subv) + + if key == nil { + v.SetMapIndex(reflect.New(keyType).Elem(), subv) + } else { + switch reflect.TypeOf(key).Kind() { + case reflect.Slice, reflect.Map: // bypass issues with unhashable types + v.SetMapIndex(reflect.ValueOf(&key), subv) + default: + v.SetMapIndex(reflect.ValueOf(key), subv) + } + } + } + } else { // default map case + var mapElem reflect.Value + for { + bs, tt, err := d.nextToken() + if err != nil { + d.error(err) + } + if tt == tokenSetEnd { + break + } + d.doUndo(bs, tt) + + // should we do the same as with mapElem? + key := reflect.New(keyType).Elem() + d.value(key) + + elemType := v.Type().Elem() + if !mapElem.IsValid() { + mapElem = reflect.New(elemType).Elem() + } else { + mapElem.Set(reflect.Zero(elemType)) + } + subv := mapElem + d.value(subv) + v.SetMapIndex(key, subv) + } + } +} + +func (d *Decoder) ednmapInterface() interface{} { + theMap := make(map[interface{}]interface{}, 0) + for { + bs, tt, err := d.nextToken() + if err != nil { + d.error(err) + } + if tt == tokenMapEnd { + break + } + d.doUndo(bs, tt) + key := d.valueInterface() + value := d.valueInterface() + // special case on nil here. nil is hashable, so use it as key. + if key == nil { + theMap[key] = value + } else { + switch reflect.TypeOf(key).Kind() { + case reflect.Slice, reflect.Map: // bypass issues with unhashable types + theMap[&key] = value + default: + theMap[key] = value + } + } + } + return theMap +} + +func (d *Decoder) set(v reflect.Value) { + // Check for unmarshaler. + u, pv := d.indirect(v, false) + if u != nil { + d.doUndo([]byte{'#', '{'}, tokenSetStart) + bs, err := d.nextValueBytes() + if err == nil { + err = u.UnmarshalEDN(bs) + } + if err != nil { + d.error(err) + } + return + } + v = pv + + var setValue reflect.Value + var keyType reflect.Type + + // Check type of target. + // TODO: accept option structs? -- i.e. structs where all fields are bools + // TODO: Also accept slices + switch v.Kind() { + case reflect.Map: + // map must have bool or struct{} value type + t := v.Type() + keyType = t.Key() + valKind := t.Elem().Kind() + switch valKind { + case reflect.Bool: + setValue = reflect.ValueOf(true) + case reflect.Struct: + // check if struct, and if so, ensure it has 0 fields + if t.Elem().NumField() != 0 { + d.error(&UnmarshalTypeError{"set", v.Type()}) + } + setValue = reflect.Zero(t.Elem()) + default: + d.error(&UnmarshalTypeError{"set", v.Type()}) + } + if v.IsNil() { + v.Set(reflect.MakeMap(t)) + } + case reflect.Slice, reflect.Array: + // Some extent of rechecking going on when we pass it to array, but it + // should be a constant factor only. + d.array(v, tokenSetEnd) + return + case reflect.Interface: + if v.NumMethod() == 0 { + // break out and use setInterface + v.Set(reflect.ValueOf(d.setInterface())) + return + } else { + d.error(&UnmarshalTypeError{"set", v.Type()}) + } + + default: + d.error(&UnmarshalTypeError{"set", v.Type()}) + } + + // special case here, to avoid panics when we have slices and maps as keys. + // Split out from code below to improve perf + if keyType.Kind() == reflect.Interface && keyType.NumMethod() == 0 { + for { + bs, tt, err := d.nextToken() + if err != nil { + d.error(err) + } + if tt == tokenSetEnd { + break + } + d.doUndo(bs, tt) + key := d.valueInterface() + // special case on nil here: Need to create a zero type of the specific + // keyType. As this is an interface, this will itself be nil. + if key == nil { + v.SetMapIndex(reflect.New(keyType).Elem(), setValue) + } else { + switch reflect.TypeOf(key).Kind() { + case reflect.Slice, reflect.Map: // bypass issues with unhashable types + v.SetMapIndex(reflect.ValueOf(&key), setValue) + default: + v.SetMapIndex(reflect.ValueOf(key), setValue) + } + } + } + } else { + for { + bs, tt, err := d.nextToken() + if err != nil { + d.error(err) + } + if tt == tokenSetEnd { + break + } + d.doUndo(bs, tt) + + key := reflect.New(keyType).Elem() + d.value(key) + v.SetMapIndex(key, setValue) + } + } + +} + +func (d *Decoder) setInterface() interface{} { + theSet := make(map[interface{}]bool, 0) + for { + bs, tt, err := d.nextToken() + if err != nil { + d.error(err) + } + if tt == tokenSetEnd { + break + } + d.doUndo(bs, tt) + key := d.valueInterface() + if key == nil { + theSet[key] = true + } else { + switch reflect.TypeOf(key).Kind() { + case reflect.Slice, reflect.Map: // bypass issues with unhashable types + theSet[&key] = true + default: + theSet[key] = true + } + } + } + return theSet +} + +var nilByte = []byte(`nil`) +var trueByte = []byte(`true`) +var falseByte = []byte(`false`) + +var symbolType = reflect.TypeOf(Symbol("")) +var keywordType = reflect.TypeOf(Keyword("")) +var byteSliceType = reflect.TypeOf([]byte(nil)) + +var bigFloatType = reflect.TypeOf((*big.Float)(nil)).Elem() +var bigIntType = reflect.TypeOf((*big.Int)(nil)).Elem() + +func (d *Decoder) literal(bs []byte, ttype tokenType, v reflect.Value) { + wantptr := ttype == tokenSymbol && bytes.Equal(nilByte, bs) + u, pv := d.indirect(v, wantptr) + if u != nil { + err := u.UnmarshalEDN(bs) + if err != nil { + d.error(err) + } + return + } + v = pv + switch ttype { + case tokenSymbol: + if wantptr { // nil + switch v.Kind() { + case reflect.Interface, reflect.Ptr, reflect.Map, reflect.Slice: + v.Set(reflect.Zero(v.Type())) + default: + d.error(&UnmarshalTypeError{"nil", v.Type()}) + } + } else if bytes.Equal(trueByte, bs) || bytes.Equal(falseByte, bs) { // true|false + value := bs[0] == 't' + switch v.Kind() { + default: + d.error(&UnmarshalTypeError{"bool", v.Type()}) + case reflect.Bool: + v.SetBool(value) + case reflect.Interface: + if v.NumMethod() == 0 { + v.Set(reflect.ValueOf(value)) + } else { + d.error(&UnmarshalTypeError{"bool", v.Type()}) + } + } + } else if v.Kind() == reflect.String && v.Type() == symbolType { // "actual" symbols + v.SetString(string(bs)) + } else if v.Kind() == reflect.Interface && v.NumMethod() == 0 { + v.Set(reflect.ValueOf(Symbol(string(bs)))) + } else { + d.error(&UnmarshalTypeError{"symbol", v.Type()}) + } + case tokenKeyword: + if v.Kind() == reflect.String && v.Type() == keywordType { // "actual" keywords + v.SetString(string(bs[1:])) + } else if v.Kind() == reflect.Interface && v.NumMethod() == 0 { + v.Set(reflect.ValueOf(Keyword(string(bs[1:])))) + } else { + d.error(&UnmarshalTypeError{"keyword", v.Type()}) + } + case tokenInt: + var s string + isBig := false + if bs[len(bs)-1] == 'N' { // can end with N, which we promptly ignore + // TODO: If the user expects a float and receives what is perceived as an + // int (ends with N), what is the sensible thing to do? + s = string(bs[:len(bs)-1]) + isBig = true + } else { + s = string(bs) + } + switch v.Kind() { + default: + switch v.Type() { + case bigIntType: + bi := v.Addr().Interface().(*big.Int) + _, ok := bi.SetString(s, 10) + if !ok { + d.error(errInternal) + } + case bigFloatType: + mc := d.mathContext() + bf := v.Addr().Interface().(*big.Float) + bf = bf.SetPrec(mc.Precision).SetMode(mc.Mode) + _, _, err := bf.Parse(s, 10) + if err != nil { // grumble grumble + d.error(errInternal) + } + default: + d.error(&UnmarshalTypeError{"int", v.Type()}) + } + case reflect.Interface: + if !isBig { + n, err := strconv.ParseInt(s, 10, 64) + if err != nil { + d.error(&UnmarshalTypeError{"int " + s, reflect.TypeOf(int64(0))}) + } + if v.NumMethod() != 0 { + d.error(&UnmarshalTypeError{"int", v.Type()}) + } + v.Set(reflect.ValueOf(n)) + } else { + bi := new(big.Int) + _, ok := bi.SetString(s, 10) + if !ok { + d.error(errInternal) + } + v.Set(reflect.ValueOf(bi)) + } + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + n, err := strconv.ParseInt(s, 10, 64) + if err != nil || v.OverflowInt(n) { + d.error(&UnmarshalTypeError{"int " + s, v.Type()}) + } + v.SetInt(n) + + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + n, err := strconv.ParseUint(s, 10, 64) + if err != nil || v.OverflowUint(n) { + d.error(&UnmarshalTypeError{"int " + s, v.Type()}) + } + v.SetUint(n) + + case reflect.Float32, reflect.Float64: + n, err := strconv.ParseFloat(s, v.Type().Bits()) + if err != nil || v.OverflowFloat(n) { + d.error(&UnmarshalTypeError{"int " + s, v.Type()}) + } + v.SetFloat(n) + } + + case tokenFloat: + var s string + isBig := false + if bs[len(bs)-1] == 'M' { // can end with M, which we promptly ignore + s = string(bs[:len(bs)-1]) + isBig = true + } else { + s = string(bs) + } + switch v.Kind() { + default: + switch v.Type() { + case bigFloatType: + mc := d.mathContext() + bf := v.Addr().Interface().(*big.Float) + bf = bf.SetPrec(mc.Precision).SetMode(mc.Mode) + _, _, err := bf.Parse(s, 10) + if err != nil { // grumble grumble + d.error(errInternal) + } + default: + d.error(&UnmarshalTypeError{"float", v.Type()}) + } + case reflect.Interface: + if !isBig { + n, err := strconv.ParseFloat(s, 64) + if err != nil { + d.error(&UnmarshalTypeError{"float " + s, reflect.TypeOf(float64(0))}) + } + if v.NumMethod() != 0 { + d.error(&UnmarshalTypeError{"float", v.Type()}) + } + v.Set(reflect.ValueOf(n)) + } else { + mc := d.mathContext() + bf := new(big.Float).SetPrec(mc.Precision).SetMode(mc.Mode) + _, _, err := bf.Parse(s, 10) + if err != nil { // grumble grumble + d.error(errInternal) + } + v.Set(reflect.ValueOf(bf)) + } + case reflect.Float32, reflect.Float64: + n, err := strconv.ParseFloat(s, v.Type().Bits()) + if err != nil || v.OverflowFloat(n) { + d.error(&UnmarshalTypeError{"float " + s, v.Type()}) + } + v.SetFloat(n) + } + case tokenChar: + r, err := toRune(bs) + if err != nil { + d.error(err) + } + switch v.Kind() { + default: + d.error(&UnmarshalTypeError{"rune", v.Type()}) + case reflect.Interface: + if v.NumMethod() != 0 { + d.error(&UnmarshalTypeError{"rune", v.Type()}) + } + v.Set(reflect.ValueOf(r)) + case reflect.Int32: // rune is an alias for int32 + v.SetInt(int64(r)) + } + case tokenString: + s, ok := unquoteBytes(bs) + if !ok { + d.error(errInternal) + } + switch v.Kind() { + default: + d.error(&UnmarshalTypeError{"string", v.Type()}) + case reflect.String: + v.SetString(string(s)) + case reflect.Interface: + if v.NumMethod() == 0 { + v.Set(reflect.ValueOf(string(s))) + } else { + d.error(&UnmarshalTypeError{"string", v.Type()}) + } + } + default: + d.error(errInternal) + } +} + +func (d *Decoder) literalInterface(bs []byte, ttype tokenType) interface{} { + switch ttype { + case tokenSymbol: + if bytes.Equal(nilByte, bs) { + return nil + } + if bytes.Equal(trueByte, bs) { + return true + } + if bytes.Equal(falseByte, bs) { + return false + } + return Symbol(string(bs)) + case tokenKeyword: + return Keyword(string(bs[1:])) + case tokenInt: + if bs[len(bs)-1] == 'N' { // can end with N + var bi big.Int + s := string(bs[:len(bs)-1]) + _, ok := bi.SetString(s, 10) + if !ok { + d.error(errInternal) + } + return bi + } else { + s := string(bs) + n, err := strconv.ParseInt(s, 10, 64) + if err != nil { + d.error(err) + } + return n + } + case tokenFloat: + var s string + if bs[len(bs)-1] == 'M' { // can end with M, which we promptly ignore + s = string(bs[:len(bs)-1]) + } else { + s = string(bs) + } + n, err := strconv.ParseFloat(s, 64) + if err != nil { + d.error(err) + } + return n + case tokenChar: + r, err := toRune(bs) + if err != nil { + d.error(err) + } + return r + case tokenString: + t, ok := unquote(bs) + if !ok { + d.error(errInternal) + } + return t + default: + d.error(errInternal) + return nil + } +} + +var ( + newlineBytes = []byte(`\newline`) + returnBytes = []byte(`\return`) + spaceBytes = []byte(`\space`) + tabBytes = []byte(`\tab`) + formfeedBytes = []byte(`\formfeed`) +) + +func toRune(bs []byte) (rune, error) { + // handle special cases first: + switch { + case bytes.Equal(bs, newlineBytes): + return '\n', nil + case bytes.Equal(bs, returnBytes): + return '\r', nil + case bytes.Equal(bs, spaceBytes): + return ' ', nil + case bytes.Equal(bs, tabBytes): + return '\t', nil + case bytes.Equal(bs, formfeedBytes): + return '\f', nil + case len(bs) == 6 && bs[1] == 'u': // I don't think unicode chars could be 5 bytes long? + return getu4(bs), nil + default: + r, size := utf8.DecodeRune(bs[1:]) + if r == utf8.RuneError && size == 1 { + return r, errIllegalRune + } + return r, nil + } +} + +// nextToken handles #_ +func (d *Decoder) nextToken() ([]byte, tokenType, error) { + bs, tt, err := d.rawToken() + if err != nil { + return bs, tt, err + } + switch tt { + case tokenDiscard: + err := d.traverseValue() + if err != nil { + return nil, tokenError, err + } + return d.nextToken() // again for discards + default: + return bs, tt, err + } +} + +func (d *Decoder) rawToken() ([]byte, tokenType, error) { + if d.undo { + d.undo = false + b := d.prevSlice + tt := d.prevTtype + d.prevSlice = nil + d.prevTtype = tokenError + return b, tt, nil + } + var val bytes.Buffer + d.lex.reset() + doIgnore := true + if d.hasLeftover { + d.hasLeftover = false + d.lex.position++ + switch d.lex.state(d.leftover) { + case lexCont: + val.WriteRune(d.leftover) + doIgnore = false + case lexEnd: + val.WriteRune(d.leftover) + return val.Bytes(), d.lex.token, nil + case lexEndPrev: + return nil, tokenError, errInternal + case lexError: + return nil, tokenError, d.lex.err + case lexIgnore: + // just ignore + } + } + if doIgnore { // ignore whitespace + readWhitespace: + for { + r, _, err := d.rd.ReadRune() + if err == io.EOF { + return nil, tokenError, errNoneLeft + } + if err != nil { + return nil, tokenError, err + } + d.lex.position++ + switch d.lex.state(r) { + case lexCont: // got a value, so continue on past doIgnoring + // TODO: This returns an error. Will it happen in practice? Probably? + val.WriteRune(r) + break readWhitespace + case lexError: + return nil, tokenError, d.lex.err + case lexEnd: + val.WriteRune(r) + return val.Bytes(), d.lex.token, nil + case lexEndPrev: + return nil, tokenError, errInternal + case lexIgnore: + // keep on reading + } + } + } + for { + r, _, err := d.rd.ReadRune() + var ls lexState + // this is not exactly perfect. + switch { + case err == io.EOF: + ls = d.lex.eof() + case err != nil: + return nil, tokenError, err + default: + d.lex.position++ + ls = d.lex.state(r) + } + switch ls { + case lexCont: + val.WriteRune(r) + case lexIgnore: + if err != io.EOF { + return nil, tokenError, errInternal + } else { + return nil, tokenError, errNoneLeft + } + case lexEnd: + if err != io.EOF { + val.WriteRune(r) + } + return val.Bytes(), d.lex.token, nil + case lexEndPrev: + d.hasLeftover = true + d.leftover = r + return val.Bytes(), d.lex.token, nil + case lexError: + return nil, tokenError, d.lex.err + } + } +} + +// traverseValue reads a single value and skips it -- whether it is a list, map +// or a literal. Doesn't validate its state. skips over discard tokens as well. +func (d *Decoder) traverseValue() error { + tstack := newTokenStack() + for { + _, tt, err := d.nextToken() + if err != nil { + return err + } + err = tstack.push(tt) + if err != nil || tstack.done() { + return err + } + } +} + +type tokenStackElem struct { + tt tokenType + count int +} + +type tokenStack struct { + toks []tokenStackElem + toplevel tokenType +} + +func newTokenStack() *tokenStack { + return &tokenStack{ + toks: nil, + toplevel: tokenError, + } +} + +func (t *tokenStack) done() bool { + return len(t.toks) == 0 && t.toplevel != tokenDiscard +} + +func (t *tokenStack) peek() tokenType { + return t.toks[len(t.toks)-1].tt +} + +func (t *tokenStack) peekCount() int { + return t.toks[len(t.toks)-1].count +} + +func (t *tokenStack) pop() { + t.toks = t.toks[:len(t.toks)-1] +} + +func (t *tokenStack) push(tt tokenType) error { + // retain toplevel value for done check + if len(t.toks) == 0 { + t.toplevel = tt + } + switch tt { + case tokenMapStart, tokenVectorStart, tokenListStart, tokenSetStart, tokenDiscard, tokenTag: + // append to toks, regardless + t.toks = append(t.toks, tokenStackElem{tt, 0}) + return nil + case tokenMapEnd: + if len(t.toks) == 0 || (t.peek() != tokenMapStart && t.peek() != tokenSetStart) { + return errUnexpected + } + t.pop() + case tokenListEnd: + if len(t.toks) == 0 || t.peek() != tokenListStart { + return errUnexpected + } + t.pop() + case tokenVectorEnd: + if len(t.toks) == 0 || t.peek() != tokenVectorStart { + return errUnexpected + } + t.pop() + default: + } + if len(t.toks) > 0 { + t.toks[len(t.toks)-1].count++ + } + // popping of discards and tags + for len(t.toks) > 0 && t.peek() == tokenTag { + t.pop() + if len(t.toks) > 0 { + t.toks[len(t.toks)-1].count++ + } + } + if len(t.toks) > 0 && t.peek() == tokenDiscard { + t.pop() + } + return nil +} + +// more removes whitespace and discards, and returns nil if there is more data. +// If the end of the stream is found, io.EOF is sent back. If an error happens +// while parsing a discard value, it is passed up. +func (d *Decoder) more() error { + if d.undo { + return nil + } + if d.hasLeftover && d.leftover == '#' { + // check if next rune is '_' + r, _, err := d.rd.ReadRune() + if err == io.EOF { + return errNoneLeft + } + if err != nil { + return err + } + if r != '_' { + // it's not discard, so let's just unread the rune + return d.rd.UnreadRune() + } + // need to consume a value + d.hasLeftover = false + d.leftover = '\uFFFD' + d.lex.position += 2 + err = d.traverseValue() + if err != nil { + return err + } + return d.more() + } + if d.hasLeftover && !isWhitespace(d.leftover) && d.leftover != ';' { + return nil + } + + // If we've come to this step, we need to read whitespace and -- if we find + // something suspicious, we need to check if it can be assumed to be + // whitespace. + d.lex.reset() + for { + var r rune + var err error + readWhitespace: + for { + r, _, err = d.rd.ReadRune() + if err != nil { + return err + // if we hit the end of the line, then we don't have more and we return + // io.EOF + } + d.lex.position++ + switch d.lex.state(r) { + case lexCont: // found something that looks like a value, so break out of whitespace loop + break readWhitespace + case lexError: + return d.lex.err + case lexEnd: // found a delimiter of some sort, so store it as leftover and return nil + d.hasLeftover = true + d.leftover = r + d.lex.position-- + return nil + case lexEndPrev: + return errInternal + case lexIgnore: + // keep on readin' + } + } + + if r == '#' { // the edge case again, so let's gobble + // check if next rune is '_' + r, _, err := d.rd.ReadRune() + if err == io.EOF { + return errNoneLeft + } + if err != nil { + return err + } + if r != '_' { + // it's not discard, so we unread the rune and put # as leftover + d.leftover = '#' + d.hasLeftover = true + d.lex.position-- + return d.rd.UnreadRune() + } + // need to consume a value + d.hasLeftover = false + d.leftover = '\uFFFD' + d.lex.position += 2 + err = d.traverseValue() + if err != nil { + return err + } + return d.more() + } else { // we could do unreadrune here too, would've been just as fine + d.hasLeftover = true + d.leftover = r + d.lex.position-- + return nil + } + } +} + +// Oh, asking about why this is so similar to the part above, eh? Yes, I would +// also consider this a crime. At least I use the same lexer. This is probably +// next on the list when I have people complaining about perf issues. +func (d *Decoder) nextValueBytes() ([]byte, error) { + // TODO: Ensure values inside maps come in pairs. + tstack := newTokenStack() + var val bytes.Buffer + if d.undo { + d.undo = false + b := d.prevSlice + tt := d.prevTtype + d.prevSlice = nil + d.prevTtype = tokenError + if tt == tokenDiscard { // should be impossible to get a tokenDiscard here? + return nil, errInternal + } + err := tstack.push(tt) + if err != nil || tstack.done() { + return val.Bytes(), err + } + val.Write(b) + } +readElems: + for { + d.lex.reset() + // Can't ignore whitespace in general. So I guess we just add it onto the buffer + readWs := true + if d.hasLeftover { + // we can have leftover from previous iteration. e.g. "foo[bar]" will have + // leftover "[" and "]" + d.hasLeftover = false + d.lex.position++ + val.WriteRune(d.leftover) + switch d.lex.state(d.leftover) { + case lexCont: + readWs = false + case lexEnd: + err := tstack.push(d.lex.token) + if err != nil || tstack.done() { + return val.Bytes(), err + } + d.lex.reset() + case lexEndPrev: + return nil, errInternal + case lexError: + return nil, d.lex.err + case lexIgnore: + // just keep going + } + } + if readWs { + readWhitespace: + // If we end up here, it means we expect at least one more token + for { + r, _, err := d.rd.ReadRune() + if err == io.EOF { + return nil, errNoneLeft + } + if err != nil { + return nil, err + } + d.lex.position++ + val.WriteRune(r) + switch d.lex.state(r) { + case lexCont: // found something that looks like a value, so break out of whitespace loop + break readWhitespace + case lexError: + return nil, d.lex.err + case lexEnd: + err := tstack.push(d.lex.token) + if err != nil || tstack.done() { + return val.Bytes(), err + } + // Here we'd usually continue on next iteration loop (which is safe + // and valid), but since we know we don't have any leftovers, we can + // just reset the lexer and keep attempting to read whitespace. + d.lex.reset() + case lexEndPrev: + return nil, errInternal + case lexIgnore: + // keep on readin' + } + } + } + // read element + for { + r, rlength, err := d.rd.ReadRune() + var ls lexState + // ugh, this is not exactly perfect. + switch { + case err == io.EOF: + ls = d.lex.eof() + case err != nil: + return nil, err + default: + d.lex.position++ + val.WriteRune(r) + ls = d.lex.state(r) + } + switch ls { + case lexCont: + // keep going + case lexIgnore: + if err != io.EOF { + return nil, errInternal + } else { + return nil, errNoneLeft + } + case lexEnd: + ioErr := err + err := tstack.push(d.lex.token) + if err != nil || tstack.done() { + return val.Bytes(), err + } + if ioErr == io.EOF /* && !tstack.done() */ { + return nil, errNoneLeft + } + continue readElems + case lexEndPrev: // if err == io.EOF then we cannot end up here. (Invariant forced by lexer) + val.Truncate(val.Len() - rlength) + d.hasLeftover = true + d.leftover = r + + err := tstack.push(d.lex.token) + if err != nil || tstack.done() { + return val.Bytes(), err + } + continue readElems + case lexError: + return nil, d.lex.err + } + } + } +} diff --git a/vendor/olympos.io/encoding/edn/edn_tags.go b/vendor/olympos.io/encoding/edn/edn_tags.go new file mode 100644 index 000000000..4097c0619 --- /dev/null +++ b/vendor/olympos.io/encoding/edn/edn_tags.go @@ -0,0 +1,142 @@ +// Copyright 2015 Jean Niklas L'orange. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package edn implements encoding and decoding of EDN values as defined in +// https://github.com/edn-format/edn. For a full introduction on how to use +// go-edn, see https://github.com/go-edn/edn/blob/v1/docs/introduction.md. Fully +// self-contained examples of go-edn can be found at +// https://github.com/go-edn/edn/tree/v1/examples. +// +// Note that the small examples in this package is not checking errors as +// persively as you should do when you use this package. This is done because +// I'd like the examples to be easily readable and understandable. The bigger +// examples provide proper error handling. +package edn + +import ( + "encoding/base64" + "errors" + "math/big" + "reflect" + "sync" + "time" +) + +var ( + ErrNotFunc = errors.New("Value is not a function") + ErrMismatchArities = errors.New("Function does not have single argument in, two argument out") + ErrNotConcrete = errors.New("Value is not a concrete non-function type") + ErrTagOverwritten = errors.New("Previous tag implementation was overwritten") +) + +var globalTags TagMap + +// A TagMap contains mappings from tag literals to functions and structs that is +// used when decoding. +type TagMap struct { + sync.RWMutex + m map[string]reflect.Value +} + +var errorType = reflect.TypeOf((*error)(nil)).Elem() + +// AddTagFn adds fn as a converter function for tagname tags to this TagMap. fn +// must have the signature func(T) (U, error), where T is the expected input +// type and U is the output type. See Decoder.AddTagFn for examples. +func (tm *TagMap) AddTagFn(tagname string, fn interface{}) error { + // TODO: check name + rfn := reflect.ValueOf(fn) + rtyp := rfn.Type() + if rtyp.Kind() != reflect.Func { + return ErrNotFunc + } + if rtyp.NumIn() != 1 || rtyp.NumOut() != 2 || !rtyp.Out(1).Implements(errorType) { + // ok to have variadic arity? + return ErrMismatchArities + } + return tm.addVal(tagname, rfn) +} + +// MustAddTagFn adds fn as a converter function for tagname tags to this TagMap +// like AddTagFn, except this function panics if the tag could not be added. +func (tm *TagMap) MustAddTagFn(tagname string, fn interface{}) { + if err := tm.AddTagFn(tagname, fn); err != nil { + panic(err) + } +} + +func (tm *TagMap) addVal(name string, val reflect.Value) error { + tm.Lock() + if tm.m == nil { + tm.m = map[string]reflect.Value{} + } + _, ok := tm.m[name] + tm.m[name] = val + tm.Unlock() + if ok { + return ErrTagOverwritten + } else { + return nil + } +} + +// AddTagFn adds fn as a converter function for tagname tags to the global +// TagMap. fn must have the signature func(T) (U, error), where T is the +// expected input type and U is the output type. See Decoder.AddTagFn for +// examples. +func AddTagFn(tagname string, fn interface{}) error { + return globalTags.AddTagFn(tagname, fn) +} + +// MustAddTagFn adds fn as a converter function for tagname tags to the global +// TagMap like AddTagFn, except this function panics if the tag could not be added. +func MustAddTagFn(tagname string, fn interface{}) { + globalTags.MustAddTagFn(tagname, fn) +} + +// AddTagStructs adds the struct as a matching struct for tagname tags to this +// TagMap. val can not be a channel, function, interface or an unsafe pointer. +// See Decoder.AddTagStruct for examples. +func (tm *TagMap) AddTagStruct(tagname string, val interface{}) error { + rstruct := reflect.ValueOf(val) + switch rstruct.Type().Kind() { + case reflect.Invalid, reflect.Chan, reflect.Func, reflect.Interface, reflect.UnsafePointer: + return ErrNotConcrete + } + return tm.addVal(tagname, rstruct) +} + +// AddTagStructs adds the struct as a matching struct for tagname tags to the +// global TagMap. val can not be a channel, function, interface or an unsafe +// pointer. See Decoder.AddTagStruct for examples. +func AddTagStruct(tagname string, val interface{}) error { + return globalTags.AddTagStruct(tagname, val) +} + +func init() { + err := AddTagFn("inst", func(s string) (time.Time, error) { + return time.Parse(time.RFC3339Nano, s) + }) + if err != nil { + panic(err) + } + err = AddTagFn("base64", base64.StdEncoding.DecodeString) + if err != nil { + panic(err) + } +} + +// A MathContext specifies the precision and rounding mode for +// `math/big.Float`s when decoding. +type MathContext struct { + Precision uint + Mode big.RoundingMode +} + +// The GlobalMathContext is the global MathContext. It is used if no other +// context is provided. See MathContext for example usage. +var GlobalMathContext = MathContext{ + Mode: big.ToNearestEven, + Precision: 192, +} diff --git a/vendor/olympos.io/encoding/edn/encode.go b/vendor/olympos.io/encoding/edn/encode.go new file mode 100644 index 000000000..5635dcd60 --- /dev/null +++ b/vendor/olympos.io/encoding/edn/encode.go @@ -0,0 +1,1422 @@ +// Copyright 2015 Jean Niklas L'orange. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Copyright 2010 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package edn + +import ( + "bytes" + "encoding/base64" + "io" + "math" + "math/big" + "reflect" + "runtime" + "sort" + "strconv" + "strings" + "sync" + "sync/atomic" + "time" + "unicode" + "unicode/utf8" +) + +// Marshal returns the EDN encoding of v. +// +// Marshal traverses the value v recursively. +// If an encountered value implements the Marshaler interface +// and is not a nil pointer, Marshal calls its MarshalEDN method +// to produce EDN. The nil pointer exception is not strictly necessary +// but mimics a similar, necessary exception in the behavior of +// UnmarshalEDN. +// +// Otherwise, Marshal uses the following type-dependent default encodings: +// +// Boolean values encode as EDN booleans. +// +// Integers encode as EDN integers. +// +// Floating point values encode as EDN floats. +// +// String values encode as EDN strings coerced to valid UTF-8, +// replacing invalid bytes with the Unicode replacement rune. +// The angle brackets "<" and ">" are escaped to "\u003c" and "\u003e" +// to keep some browsers from misinterpreting EDN output as HTML. +// Ampersand "&" is also escaped to "\u0026" for the same reason. +// +// Array and slice values encode as EDN arrays, except that +// []byte encodes as a base64-encoded string, and a nil slice +// encodes as the nil EDN value. +// +// Struct values encode as EDN maps. Each exported struct field +// becomes a member of the map unless +// - the field's tag is "-", or +// - the field is empty and its tag specifies the "omitempty" option. +// The empty values are false, 0, any +// nil pointer or interface value, and any array, slice, map, or string of +// length zero. The map's default key is the struct field name as a keyword, +// but can be specified in the struct field's tag value. The "edn" key in +// the struct field's tag value is the key name, followed by an optional comma +// and options. Examples: +// +// // Field is ignored by this package. +// Field int `edn:"-"` +// +// // Field appears in EDN as key :my-name. +// Field int `edn:"myName"` +// +// // Field appears in EDN as key :my-name and +// // the field is omitted from the object if its value is empty, +// // as defined above. +// Field int `edn:"my-name,omitempty"` +// +// // Field appears in EDN as key :field (the default), but +// // the field is skipped if empty. +// // Note the leading comma. +// Field int `edn:",omitempty"` +// +// The "str", "key" and "sym" options signals that a field name should be +// written as a string, keyword or symbol, respectively. If none are specified, +// then the default behaviour is to emit them as keywords. Examples: +// +// // Default behaviour: field name will be encoded as :foo +// Foo int +// +// // Encode Foo as string with name "string-foo" +// Foo int `edn:"string-foo,str"` +// +// // Encode Foo as symbol with name sym-foo +// Foo int `edn:"sym-foo,sym"` +// +// Anonymous struct fields are usually marshaled as if their inner exported fields +// were fields in the outer struct, subject to the usual Go visibility rules amended +// as described in the next paragraph. +// An anonymous struct field with a name given in its EDN tag is treated as +// having that name, rather than being anonymous. +// An anonymous struct field of interface type is treated the same as having +// that type as its name, rather than being anonymous. +// +// The Go visibility rules for struct fields are amended for EDN when +// deciding which field to marshal or unmarshal. If there are +// multiple fields at the same level, and that level is the least +// nested (and would therefore be the nesting level selected by the +// usual Go rules), the following extra rules apply: +// +// 1) Of those fields, if any are EDN-tagged, only tagged fields are considered, +// even if there are multiple untagged fields that would otherwise conflict. +// 2) If there is exactly one field (tagged or not according to the first rule), that is selected. +// 3) Otherwise there are multiple fields, and all are ignored; no error occurs. +// +// To force ignoring of an anonymous struct field in both current and earlier +// versions, give the field a EDN tag of "-". +// +// Map values usually encode as EDN maps. There are no limitations on the keys +// or values -- as long as they can be encoded to EDN, anything goes. Map values +// will be encoded as sets if their value type is either a bool or a struct with +// no fields. +// +// If you want to ensure that a value is encoded as a map, you can specify that +// as follows: +// +// // Encode Foo as a map, instead of the default set +// Foo map[int]bool `edn:",map"` +// +// Arrays and slices are encoded as vectors by default. As with maps and sets, +// you can specify that a field should be encoded as a list instead, by using +// the option "list": +// +// // Encode Foo as a list, instead of the default vector +// Foo []int `edn:",list"` +// +// Pointer values encode as the value pointed to. +// A nil pointer encodes as the nil EDN object. +// +// Interface values encode as the value contained in the interface. +// A nil interface value encodes as the nil EDN value. +// +// Channel, complex, and function values cannot be encoded in EDN. +// Attempting to encode such a value causes Marshal to return +// an UnsupportedTypeError. +// +// EDN cannot represent cyclic data structures and Marshal does not +// handle them. Passing cyclic structures to Marshal will result in +// an infinite recursion. +// +func Marshal(v interface{}) ([]byte, error) { + e := &encodeState{} + err := e.marshal(v) + if err != nil { + return nil, err + } + return e.Bytes(), nil +} + +// MarshalIndent is like Marshal but applies Indent to format the output. +func MarshalIndent(v interface{}, prefix, indent string) ([]byte, error) { + b, err := Marshal(v) + if err != nil { + return nil, err + } + var buf bytes.Buffer + err = Indent(&buf, b, prefix, indent) + if err != nil { + return nil, err + } + return buf.Bytes(), nil +} + +// MarshalPPrint is like Marshal but applies PPrint to format the output. +func MarshalPPrint(v interface{}, opts *PPrintOpts) ([]byte, error) { + b, err := Marshal(v) + if err != nil { + return nil, err + } + var buf bytes.Buffer + err = PPrint(&buf, b, opts) + if err != nil { + return nil, err + } + return buf.Bytes(), nil +} + +// An Encoder writes EDN values to an output stream. +type Encoder struct { + writer io.Writer + ec encodeState +} + +// NewEncoder returns a new encoder that writes to w. +func NewEncoder(w io.Writer) *Encoder { + return &Encoder{ + writer: w, + ec: encodeState{}, + } +} + +// Encode writes the EDN encoding of v to the stream, followed by a newline +// character. +// +// See the documentation for Marshal for details about the conversion of Go +// values to EDN. +func (e *Encoder) Encode(v interface{}) error { + e.ec.needsDelim = false + err := e.ec.marshal(v) + if err != nil { + e.ec.Reset() + return err + } + b := e.ec.Bytes() + e.ec.Reset() + _, err = e.writer.Write(b) + if err != nil { + return err + } + _, err = e.writer.Write([]byte{'\n'}) + return err +} + +// EncodeIndent writes the indented EDN encoding of v to the stream, followed by +// a newline character. +// +// See the documentation for MarshalIndent for details about the conversion of +// Go values to EDN. +func (e *Encoder) EncodeIndent(v interface{}, prefix, indent string) error { + e.ec.needsDelim = false + err := e.ec.marshal(v) + if err != nil { + e.ec.Reset() + return err + } + b := e.ec.Bytes() + var buf bytes.Buffer + err = Indent(&buf, b, prefix, indent) + e.ec.Reset() + if err != nil { + return err + } + _, err = e.writer.Write(buf.Bytes()) + if err != nil { + return err + } + _, err = e.writer.Write([]byte{'\n'}) + return err +} + +// EncodePPrint writes the pretty-printed EDN encoding of v to the stream, +// followed by a newline character. +// +// See the documentation for MarshalPPrint for details about the conversion of +// Go values to EDN. +func (e *Encoder) EncodePPrint(v interface{}, opts *PPrintOpts) error { + e.ec.needsDelim = false + err := e.ec.marshal(v) + if err != nil { + e.ec.Reset() + return err + } + b := e.ec.Bytes() + var buf bytes.Buffer + err = PPrint(&buf, b, opts) + e.ec.Reset() + if err != nil { + return err + } + _, err = e.writer.Write(buf.Bytes()) + if err != nil { + return err + } + _, err = e.writer.Write([]byte{'\n'}) + return err +} + +// Marshaler is the interface implemented by objects that +// can marshal themselves into valid EDN. +type Marshaler interface { + MarshalEDN() ([]byte, error) +} + +// An UnsupportedTypeError is returned by Marshal when attempting +// to encode an unsupported value type. +type UnsupportedTypeError struct { + Type reflect.Type +} + +func (e *UnsupportedTypeError) Error() string { + return "edn: unsupported type: " + e.Type.String() +} + +// An UnsupportedValueError is returned by Marshal when attempting to encode an +// unsupported value. Examples include the float values NaN and Infinity. +type UnsupportedValueError struct { + Value reflect.Value + Str string +} + +func (e *UnsupportedValueError) Error() string { + return "edn: unsupported value: " + e.Str +} + +// A MarshalerError is returned by Marshal when encoding a type with a +// MarshalEDN function fails. +type MarshalerError struct { + Type reflect.Type + Err error +} + +func (e *MarshalerError) Error() string { + return "edn: error calling MarshalEDN for type " + e.Type.String() + ": " + e.Err.Error() +} + +var hex = "0123456789abcdef" + +// An encodeState encodes EDN into a bytes.Buffer. +type encodeState struct { + bytes.Buffer // accumulated output + scratch [64]byte + needsDelim bool + mc *MathContext +} + +// mathContext returns the math context to use. If not set in the encodeState, +// the global math context is used. +func (e *encodeState) mathContext() *MathContext { + if e.mc != nil { + return e.mc + } + return &GlobalMathContext +} + +var encodeStatePool sync.Pool + +func newEncodeState() *encodeState { + if v := encodeStatePool.Get(); v != nil { + e := v.(*encodeState) + e.Reset() + return e + } + return new(encodeState) +} + +func (e *encodeState) marshal(v interface{}) (err error) { + defer func() { + if r := recover(); r != nil { + if _, ok := r.(runtime.Error); ok { + panic(r) + } + if s, ok := r.(string); ok { + panic(s) + } + err = r.(error) + } + }() + e.reflectValue(reflect.ValueOf(v)) + return nil +} + +func (e *encodeState) error(err error) { + panic(err) +} + +func isEmptyValue(v reflect.Value) bool { + switch v.Kind() { + case reflect.Array, reflect.Map, reflect.Slice, reflect.String: + return v.Len() == 0 + case reflect.Bool: + return !v.Bool() + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + return v.Int() == 0 + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + return v.Uint() == 0 + case reflect.Float32, reflect.Float64: + return v.Float() == 0 + case reflect.Interface, reflect.Ptr: + return v.IsNil() + } + return false +} + +func (e *encodeState) reflectValue(v reflect.Value) { + valueEncoder(v)(e, v) +} + +type encoderFunc func(e *encodeState, v reflect.Value) + +type typeAndTag struct { + t reflect.Type + ctype tagType +} + +var encoderCache struct { + sync.RWMutex + m map[typeAndTag]encoderFunc +} + +func valueEncoder(v reflect.Value) encoderFunc { + if !v.IsValid() { + return invalidValueEncoder + } + return typeEncoder(v.Type(), tagUndefined) +} + +func typeEncoder(t reflect.Type, tagType tagType) encoderFunc { + tac := typeAndTag{t, tagType} + encoderCache.RLock() + f := encoderCache.m[tac] + encoderCache.RUnlock() + if f != nil { + return f + } + couldUseJSON := readCanUseJSONTag() + + // To deal with recursive types, populate the map with an + // indirect func before we build it. This type waits on the + // real func (f) to be ready and then calls it. This indirect + // func is only used for recursive types. + encoderCache.Lock() + if encoderCache.m == nil { + encoderCache.m = make(map[typeAndTag]encoderFunc) + } + var wg sync.WaitGroup + wg.Add(1) + encoderCache.m[tac] = func(e *encodeState, v reflect.Value) { + wg.Wait() + f(e, v) + } + encoderCache.Unlock() + + // Compute fields without lock. + // Might duplicate effort but won't hold other computations back. + f = newTypeEncoder(t, tagType, true) + wg.Done() + encoderCache.Lock() + if couldUseJSON != readCanUseJSONTag() { + // cache has been invalidated, unlock and retry recursively. + encoderCache.Unlock() + return typeEncoder(t, tagType) + } + encoderCache.m[tac] = f + encoderCache.Unlock() + return f +} + +var ( + marshalerType = reflect.TypeOf(new(Marshaler)).Elem() + instType = reflect.TypeOf((*time.Time)(nil)).Elem() +) + +// newTypeEncoder constructs an encoderFunc for a type. +// The returned encoder only checks CanAddr when allowAddr is true. +func newTypeEncoder(t reflect.Type, tagType tagType, allowAddr bool) encoderFunc { + if t.Implements(marshalerType) { + return marshalerEncoder + } + if t.Kind() != reflect.Ptr && allowAddr { + if reflect.PtrTo(t).Implements(marshalerType) { + return newCondAddrEncoder(addrMarshalerEncoder, newTypeEncoder(t, tagType, false)) + } + } + + // Handle specific types first + switch t { + case bigIntType: + return bigIntEncoder + case bigFloatType: + return bigFloatEncoder + case instType: + return instEncoder + } + + switch t.Kind() { + case reflect.Bool: + return boolEncoder + case reflect.Int32: + if tagType == tagRune { + return runeEncoder + } + return intEncoder + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int64: + return intEncoder + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + return uintEncoder + case reflect.Float32: + return float32Encoder + case reflect.Float64: + return float64Encoder + case reflect.String: + return stringEncoder + case reflect.Interface: + return interfaceEncoder + case reflect.Struct: + return newStructEncoder(t, tagType) + case reflect.Map: + return newMapEncoder(t, tagType) + case reflect.Slice: + return newSliceEncoder(t, tagType) + case reflect.Array: + return newArrayEncoder(t, tagType) + case reflect.Ptr: + return newPtrEncoder(t, tagType) + default: + return unsupportedTypeEncoder + } +} + +func invalidValueEncoder(e *encodeState, v reflect.Value) { + e.writeNil() +} + +func marshalerEncoder(e *encodeState, v reflect.Value) { + if v.Kind() == reflect.Ptr && v.IsNil() { + e.writeNil() + return + } + m := v.Interface().(Marshaler) + b, err := m.MarshalEDN() + if err == nil { + // copy EDN into buffer, checking (token) validity. + e.ensureDelim() + err = Compact(&e.Buffer, b) + e.needsDelim = true + } + if err != nil { + e.error(&MarshalerError{v.Type(), err}) + } +} + +func addrMarshalerEncoder(e *encodeState, v reflect.Value) { + va := v.Addr() + if va.IsNil() { + e.writeNil() + return + } + m := va.Interface().(Marshaler) + b, err := m.MarshalEDN() + if err == nil { + // copy EDN into buffer, checking (token) validity. + e.ensureDelim() + err = Compact(&e.Buffer, b) + e.needsDelim = true + } + if err != nil { + e.error(&MarshalerError{v.Type(), err}) + } +} + +func boolEncoder(e *encodeState, v reflect.Value) { + e.ensureDelim() + if v.Bool() { + e.WriteString("true") + } else { + e.WriteString("false") + } + e.needsDelim = true +} + +func runeEncoder(e *encodeState, v reflect.Value) { + encodeRune(&e.Buffer, rune(v.Int())) + e.needsDelim = true +} + +func intEncoder(e *encodeState, v reflect.Value) { + e.ensureDelim() + b := strconv.AppendInt(e.scratch[:0], v.Int(), 10) + e.Write(b) + e.needsDelim = true +} + +func uintEncoder(e *encodeState, v reflect.Value) { + e.ensureDelim() + b := strconv.AppendUint(e.scratch[:0], v.Uint(), 10) + e.Write(b) + e.needsDelim = true +} + +func bigIntEncoder(e *encodeState, v reflect.Value) { + e.ensureDelim() + bi := v.Interface().(big.Int) + b := []byte(bi.String()) + e.Write(b) + e.WriteByte('N') + e.needsDelim = true +} + +func bigFloatEncoder(e *encodeState, v reflect.Value) { + e.ensureDelim() + bf := new(big.Float) + mc := e.mathContext() + val := v.Interface().(big.Float) + bf.Set(&val).SetMode(mc.Mode) + b := []byte(bf.Text('g', int(mc.Precision))) + e.Write(b) + e.WriteByte('M') + e.needsDelim = true +} + +func instEncoder(e *encodeState, v reflect.Value) { + e.ensureDelim() + t := v.Interface().(time.Time) + e.Write([]byte(t.Format(`#inst"` + time.RFC3339Nano + `"`))) +} + +type floatEncoder int // number of bits + +func (bits floatEncoder) encode(e *encodeState, v reflect.Value) { + f := v.Float() + if math.IsInf(f, 0) || math.IsNaN(f) { + e.error(&UnsupportedValueError{v, strconv.FormatFloat(f, 'g', -1, int(bits))}) + } + e.ensureDelim() + b := strconv.AppendFloat(e.scratch[:0], f, 'g', -1, int(bits)) + if ix := bytes.IndexAny(b, ".eE"); ix < 0 { + b = append(b, '.', '0') + } + e.Write(b) + e.needsDelim = true +} + +var ( + float32Encoder = (floatEncoder(32)).encode + float64Encoder = (floatEncoder(64)).encode +) + +func stringEncoder(e *encodeState, v reflect.Value) { + e.string(v.String()) +} + +func interfaceEncoder(e *encodeState, v reflect.Value) { + if v.IsNil() { + e.writeNil() + return + } + e.reflectValue(v.Elem()) +} + +func unsupportedTypeEncoder(e *encodeState, v reflect.Value) { + e.error(&UnsupportedTypeError{v.Type()}) +} + +type structEncoder struct { + fields []field + fieldEncs []encoderFunc +} + +func (se *structEncoder) encode(e *encodeState, v reflect.Value) { + e.WriteByte('{') + e.needsDelim = false + for i, f := range se.fields { + fv := fieldByIndex(v, f.index) + if !fv.IsValid() || f.omitEmpty && isEmptyValue(fv) { + continue + } + switch f.fnameType { + case emitKey: + e.ensureDelim() + e.WriteByte(':') + e.WriteString(f.name) + e.needsDelim = true + case emitString: + e.string(f.name) + e.needsDelim = false + case emitSym: + e.ensureDelim() + e.WriteString(f.name) + e.needsDelim = true + } + se.fieldEncs[i](e, fv) + } + e.WriteByte('}') + e.needsDelim = false +} + +func newStructEncoder(t reflect.Type, tagType tagType) encoderFunc { + fields := cachedTypeFields(t) + se := &structEncoder{ + fields: fields, + fieldEncs: make([]encoderFunc, len(fields)), + } + for i, f := range fields { + se.fieldEncs[i] = typeEncoder(typeByIndex(t, f.index), f.tagType) + } + return se.encode +} + +type mapEncoder struct { + keyEnc encoderFunc + elemEnc encoderFunc +} + +func (me *mapEncoder) encode(e *encodeState, v reflect.Value) { + if v.IsNil() { + e.writeNil() + return + } + e.WriteByte('{') + e.needsDelim = false + mk := v.MapKeys() + // NB: We don't get deterministic results here, because we don't iterate in a + // determinstic way. + for _, k := range mk { + if e.needsDelim { // bypass conventional whitespace to use commas instead + e.WriteByte(',') + e.needsDelim = false + } + me.keyEnc(e, k) + me.elemEnc(e, v.MapIndex(k)) + } + e.WriteByte('}') + e.needsDelim = false +} + +type mapSetEncoder struct { + keyEnc encoderFunc +} + +func (me *mapSetEncoder) encode(e *encodeState, v reflect.Value) { + if v.IsNil() { + e.writeNil() + return + } + e.ensureDelim() + e.WriteByte('#') + e.WriteByte('{') + e.needsDelim = false + mk := v.MapKeys() + // not deterministic this one either. + for _, k := range mk { + mval := v.MapIndex(k) + if mval.Kind() != reflect.Bool || mval.Bool() { + me.keyEnc(e, k) + } + } + e.WriteByte('}') + e.needsDelim = false +} + +func newMapEncoder(t reflect.Type, tagType tagType) encoderFunc { + canBeSet := false + switch t.Elem().Kind() { + case reflect.Struct: + if t.Elem().NumField() == 0 { + canBeSet = true + } + case reflect.Bool: + canBeSet = true + } + if (tagType == tagUndefined || tagType == tagSet) && canBeSet { + me := &mapSetEncoder{typeEncoder(t.Key(), tagUndefined)} + return me.encode + } + if tagType != tagUndefined && tagType != tagMap { + return unsupportedTypeEncoder + } + me := &mapEncoder{ + typeEncoder(t.Key(), tagUndefined), + typeEncoder(t.Elem(), tagUndefined), + } + return me.encode +} + +func encodeByteSlice(e *encodeState, v reflect.Value) { + if v.IsNil() { + e.writeNil() + return + } + s := v.Bytes() + e.ensureDelim() + e.WriteString(`#base64"`) + if len(s) < 1024 { + // for small buffers, using Encode directly is much faster. + dst := make([]byte, base64.StdEncoding.EncodedLen(len(s))) + base64.StdEncoding.Encode(dst, s) + e.Write(dst) + } else { + // for large buffers, avoid unnecessary extra temporary + // buffer space. + enc := base64.NewEncoder(base64.StdEncoding, e) + enc.Write(s) + enc.Close() + } + e.WriteByte('"') +} + +// sliceEncoder just wraps an arrayEncoder, checking to make sure the value isn't nil. +type sliceEncoder struct { + arrayEnc encoderFunc +} + +func (e *encodeState) ensureDelim() { + if e.needsDelim { + e.WriteByte(' ') + } +} + +func (e *encodeState) writeNil() { + e.ensureDelim() + e.WriteString("nil") + e.needsDelim = true +} + +func (se *sliceEncoder) encode(e *encodeState, v reflect.Value) { + if v.IsNil() { + e.writeNil() + return + } + se.arrayEnc(e, v) +} + +func newSliceEncoder(t reflect.Type, tagType tagType) encoderFunc { + // Byte slices get special treatment; arrays don't. + if t.Elem().Kind() == reflect.Uint8 { + return encodeByteSlice + } + enc := &sliceEncoder{newArrayEncoder(t, tagType)} + return enc.encode +} + +type arrayEncoder struct { + elemEnc encoderFunc +} + +func (ae *arrayEncoder) encode(e *encodeState, v reflect.Value) { + e.WriteByte('[') + e.needsDelim = false + n := v.Len() + for i := 0; i < n; i++ { + ae.elemEnc(e, v.Index(i)) + } + e.WriteByte(']') + e.needsDelim = false +} + +type listArrayEncoder struct { + elemEnc encoderFunc +} + +func (ae *listArrayEncoder) encode(e *encodeState, v reflect.Value) { + e.WriteByte('(') + e.needsDelim = false + n := v.Len() + for i := 0; i < n; i++ { + ae.elemEnc(e, v.Index(i)) + } + e.WriteByte(')') + e.needsDelim = false +} + +type setArrayEncoder struct { + elemEnc encoderFunc +} + +func (ae *setArrayEncoder) encode(e *encodeState, v reflect.Value) { + e.ensureDelim() + e.WriteByte('#') + e.WriteByte('{') + e.needsDelim = false + n := v.Len() + for i := 0; i < n; i++ { + ae.elemEnc(e, v.Index(i)) + } + e.WriteByte('}') + e.needsDelim = false +} + +func newArrayEncoder(t reflect.Type, tagType tagType) encoderFunc { + switch tagType { + case tagList: + enc := &listArrayEncoder{typeEncoder(t.Elem(), tagUndefined)} + return enc.encode + case tagSet: + enc := &setArrayEncoder{typeEncoder(t.Elem(), tagUndefined)} + return enc.encode + default: + enc := &arrayEncoder{typeEncoder(t.Elem(), tagUndefined)} + return enc.encode + } +} + +type ptrEncoder struct { + elemEnc encoderFunc +} + +func (pe *ptrEncoder) encode(e *encodeState, v reflect.Value) { + if v.IsNil() { + e.writeNil() + return + } + pe.elemEnc(e, v.Elem()) +} + +func newPtrEncoder(t reflect.Type, tagType tagType) encoderFunc { + enc := &ptrEncoder{typeEncoder(t.Elem(), tagType)} + return enc.encode +} + +type condAddrEncoder struct { + canAddrEnc, elseEnc encoderFunc +} + +func (ce *condAddrEncoder) encode(e *encodeState, v reflect.Value) { + if v.CanAddr() { + ce.canAddrEnc(e, v) + } else { + ce.elseEnc(e, v) + } +} + +// newCondAddrEncoder returns an encoder that checks whether its value +// CanAddr and delegates to canAddrEnc if so, else to elseEnc. +func newCondAddrEncoder(canAddrEnc, elseEnc encoderFunc) encoderFunc { + enc := &condAddrEncoder{canAddrEnc: canAddrEnc, elseEnc: elseEnc} + return enc.encode +} + +// NOTE: keep in sync with stringBytes below. +func (e *encodeState) string(s string) (int, error) { + len0 := e.Len() + e.WriteByte('"') + start := 0 + for i := 0; i < len(s); { + if b := s[i]; b < utf8.RuneSelf { + if 0x20 <= b && b != '\\' && b != '"' && b != '<' && b != '>' && b != '&' { + i++ + continue + } + if start < i { + e.WriteString(s[start:i]) + } + switch b { + case '\\', '"': + e.WriteByte('\\') + e.WriteByte(b) + case '\n': + e.WriteByte('\\') + e.WriteByte('n') + case '\r': + e.WriteByte('\\') + e.WriteByte('r') + case '\t': + e.WriteByte('\\') + e.WriteByte('t') + default: + // This encodes bytes < 0x20 except for \n and \r, + // as well as <, > and &. The latter are escaped because they + // can lead to security holes when user-controlled strings + // are rendered into EDN and served to some browsers. + e.WriteString(`\u00`) + e.WriteByte(hex[b>>4]) + e.WriteByte(hex[b&0xF]) + } + i++ + start = i + continue + } + c, size := utf8.DecodeRuneInString(s[i:]) + if c == utf8.RuneError && size == 1 { + if start < i { + e.WriteString(s[start:i]) + } + e.WriteString(`\ufffd`) + i += size + start = i + continue + } + i += size + } + if start < len(s) { + e.WriteString(s[start:]) + } + e.WriteByte('"') + e.needsDelim = false + return e.Len() - len0, nil +} + +// NOTE: keep in sync with string above. +func (e *encodeState) stringBytes(s []byte) (int, error) { + len0 := e.Len() + e.WriteByte('"') + start := 0 + for i := 0; i < len(s); { + if b := s[i]; b < utf8.RuneSelf { + if 0x20 <= b && b != '\\' && b != '"' && b != '<' && b != '>' && b != '&' { + i++ + continue + } + if start < i { + e.Write(s[start:i]) + } + switch b { + case '\\', '"': + e.WriteByte('\\') + e.WriteByte(b) + case '\n': + e.WriteByte('\\') + e.WriteByte('n') + case '\r': + e.WriteByte('\\') + e.WriteByte('r') + case '\t': + e.WriteByte('\\') + e.WriteByte('t') + default: + // This encodes bytes < 0x20 except for \n and \r, + // as well as <, >, and &. The latter are escaped because they + // can lead to security holes when user-controlled strings + // are rendered into EDN and served to some browsers. + e.WriteString(`\u00`) + e.WriteByte(hex[b>>4]) + e.WriteByte(hex[b&0xF]) + } + i++ + start = i + continue + } + c, size := utf8.DecodeRune(s[i:]) + if c == utf8.RuneError && size == 1 { + if start < i { + e.Write(s[start:i]) + } + e.WriteString(`\ufffd`) + i += size + start = i + continue + } + i += size + } + if start < len(s) { + e.Write(s[start:]) + } + e.WriteByte('"') + e.needsDelim = false + return e.Len() - len0, nil +} + +func isValidTag(s string) bool { + if s == "" { + return false + } + for _, c := range s { + switch { + case strings.ContainsRune("!#$%&()*+-./:<=>?@[]^_{|}~ ", c): + // Backslash and quote chars are reserved, but + // otherwise any punctuation chars are allowed + // in a tag name. + default: + if !unicode.IsLetter(c) && !unicode.IsDigit(c) { + return false + } + } + } + return true +} + +func fieldByIndex(v reflect.Value, index []int) reflect.Value { + for _, i := range index { + if v.Kind() == reflect.Ptr { + if v.IsNil() { + return reflect.Value{} + } + v = v.Elem() + } + v = v.Field(i) + } + return v +} + +func typeByIndex(t reflect.Type, index []int) reflect.Type { + for _, i := range index { + if t.Kind() == reflect.Ptr { + t = t.Elem() + } + t = t.Field(i).Type + } + return t +} + +// A field represents a single field found in a struct. +type field struct { + name string + nameBytes []byte // []byte(name) + equalFold func(s, t []byte) bool // bytes.EqualFold or equivalent + + tag bool + index []int + typ reflect.Type + omitEmpty bool + fnameType emitType + tagType tagType +} + +type emitType int + +const ( + emitSym emitType = iota + emitKey + emitString +) + +type tagType int + +const ( + tagUndefined tagType = iota + tagSet + tagMap + tagVec + tagList + tagRune +) + +func fillField(f field) field { + f.nameBytes = []byte(f.name) + f.equalFold = foldFunc(f.nameBytes) + return f +} + +// byName sorts field by name, breaking ties with depth, +// then breaking ties with "name came from edn tag", then +// breaking ties with index sequence. +type byName []field + +func (x byName) Len() int { return len(x) } + +func (x byName) Swap(i, j int) { x[i], x[j] = x[j], x[i] } + +func (x byName) Less(i, j int) bool { + if x[i].name != x[j].name { + return x[i].name < x[j].name + } + if len(x[i].index) != len(x[j].index) { + return len(x[i].index) < len(x[j].index) + } + if x[i].tag != x[j].tag { + return x[i].tag + } + return byIndex(x).Less(i, j) +} + +// byIndex sorts field by index sequence. +type byIndex []field + +func (x byIndex) Len() int { return len(x) } + +func (x byIndex) Swap(i, j int) { x[i], x[j] = x[j], x[i] } + +func (x byIndex) Less(i, j int) bool { + for k, xik := range x[i].index { + if k >= len(x[j].index) { + return false + } + if xik != x[j].index[k] { + return xik < x[j].index[k] + } + } + return len(x[i].index) < len(x[j].index) +} + +// typeFields returns a list of fields that edn should recognize for the given type. +// The algorithm is breadth-first search over the set of structs to include - the top struct +// and then any reachable anonymous structs. +func typeFields(t reflect.Type) []field { + // Anonymous fields to explore at the current level and the next. + current := []field{} + next := []field{{typ: t}} + + // Count of queued names for current level and the next. + count := map[reflect.Type]int{} + nextCount := map[reflect.Type]int{} + + // Types already visited at an earlier level. + visited := map[reflect.Type]bool{} + + // Fields found. + var fields []field + + for len(next) > 0 { + current, next = next, current[:0] + count, nextCount = nextCount, map[reflect.Type]int{} + + for _, f := range current { + if visited[f.typ] { + continue + } + visited[f.typ] = true + + // Scan f.typ for fields to include. + for i := 0; i < f.typ.NumField(); i++ { + sf := f.typ.Field(i) + if sf.PkgPath != "" && !sf.Anonymous { // unexported + continue + } + tag := sf.Tag.Get("edn") + if tag == "" && readCanUseJSONTag() { + tag = sf.Tag.Get("json") + } + if tag == "-" { + continue + } + name, opts := parseTag(tag) + if !isValidTag(name) { + name = "" + } + index := make([]int, len(f.index)+1) + copy(index, f.index) + index[len(f.index)] = i + + ft := sf.Type + if ft.Name() == "" && ft.Kind() == reflect.Ptr { + // Follow pointer. + ft = ft.Elem() + } + + // Add tagging rules: + var emit emitType + switch { + case opts.Contains("sym"): + emit = emitSym + case opts.Contains("str"): + emit = emitString + case opts.Contains("key"): + fallthrough + default: + emit = emitKey + } + // key, sym, str + + var tagType tagType // add tag rules + switch { + case opts.Contains("set"): + tagType = tagSet + case opts.Contains("map"): + tagType = tagMap + case opts.Contains("vector"): + tagType = tagVec + case opts.Contains("list"): + tagType = tagList + case opts.Contains("rune"): + tagType = tagRune + default: + tagType = tagUndefined + } + + // Record found field and index sequence. + if name != "" || !sf.Anonymous || ft.Kind() != reflect.Struct { + tagged := name != "" + if name == "" { + r := []rune(sf.Name) + r[0] = unicode.ToLower(r[0]) + name = string(r) + } + fields = append(fields, fillField(field{ + name: name, + tag: tagged, + index: index, + typ: ft, + omitEmpty: opts.Contains("omitempty"), + fnameType: emit, + tagType: tagType, + })) + if count[f.typ] > 1 { + // If there were multiple instances, add a second, + // so that the annihilation code will see a duplicate. + // It only cares about the distinction between 1 or 2, + // so don't bother generating any more copies. + fields = append(fields, fields[len(fields)-1]) + } + continue + } + + // Record new anonymous struct to explore in next round. + nextCount[ft]++ + if nextCount[ft] == 1 { + next = append(next, fillField(field{name: ft.Name(), index: index, typ: ft})) + } + } + } + } + + sort.Sort(byName(fields)) + + // Delete all fields that are hidden by the Go rules for embedded fields, + // except that fields with EDN tags are promoted. + + // The fields are sorted in primary order of name, secondary order + // of field index length. Loop over names; for each name, delete + // hidden fields by choosing the one dominant field that survives. + out := fields[:0] + for advance, i := 0, 0; i < len(fields); i += advance { + // One iteration per name. + // Find the sequence of fields with the name of this first field. + fi := fields[i] + name := fi.name + for advance = 1; i+advance < len(fields); advance++ { + fj := fields[i+advance] + if fj.name != name { + break + } + } + if advance == 1 { // Only one field with this name + out = append(out, fi) + continue + } + dominant, ok := dominantField(fields[i : i+advance]) + if ok { + out = append(out, dominant) + } + } + + fields = out + sort.Sort(byIndex(fields)) + + return fields +} + +// dominantField looks through the fields, all of which are known to +// have the same name, to find the single field that dominates the +// others using Go's embedding rules, modified by the presence of +// EDN tags. If there are multiple top-level fields, the boolean +// will be false: This condition is an error in Go and we skip all +// the fields. +func dominantField(fields []field) (field, bool) { + // The fields are sorted in increasing index-length order. The winner + // must therefore be one with the shortest index length. Drop all + // longer entries, which is easy: just truncate the slice. + length := len(fields[0].index) + tagged := -1 // Index of first tagged field. + for i, f := range fields { + if len(f.index) > length { + fields = fields[:i] + break + } + if f.tag { + if tagged >= 0 { + // Multiple tagged fields at the same level: conflict. + // Return no field. + return field{}, false + } + tagged = i + } + } + if tagged >= 0 { + return fields[tagged], true + } + // All remaining fields have the same length. If there's more than one, + // we have a conflict (two fields named "X" at the same level) and we + // return no field. + if len(fields) > 1 { + return field{}, false + } + return fields[0], true +} + +var canUseJSONTag int32 + +func readCanUseJSONTag() bool { + return atomic.LoadInt32(&canUseJSONTag) == 1 +} + +// UseJSONAsFallback can be set to true to let go-edn parse structs with +// information from the `json` tag for encoding and decoding type fields if not +// the `edn` tag field is set. This is not threadsafe: Encoding and decoding +// happening while this is called may return results that mix json and non-json +// tag reading. Preferably you call this in an init() function to ensure it is +// either set or unset. +func UseJSONAsFallback(val bool) { + set := int32(0) + if val { + set = 1 + } + + // Here comes the funny stuff: Cache invalidation. Right now we lock and + // unlock these independently of eachother, so it's fine to lock them in this + // order. However, if we decide to change this later on, the only reasonable + // change would be that you may grab the encoderCache lock before the + // fieldCache lock. Therefore we do it in this order, although it should not + // matter strictly speaking. + encoderCache.Lock() + fieldCache.Lock() + atomic.StoreInt32(&canUseJSONTag, set) + fieldCache.m = nil + encoderCache.m = nil + fieldCache.Unlock() + encoderCache.Unlock() +} + +var fieldCache struct { + sync.RWMutex + m map[reflect.Type][]field +} + +// cachedTypeFields is like typeFields but uses a cache to avoid repeated work. +func cachedTypeFields(t reflect.Type) []field { + fieldCache.RLock() + f := fieldCache.m[t] + fieldCache.RUnlock() + if f != nil { + return f + } + couldUseJSON := readCanUseJSONTag() + + // Compute fields without lock. + // Might duplicate effort but won't hold other computations back. + f = typeFields(t) + if f == nil { + f = []field{} + } + + fieldCache.Lock() + if couldUseJSON != readCanUseJSONTag() { + // cache has been invalidated, unlock and retry recursively. + fieldCache.Unlock() + return cachedTypeFields(t) + } + if fieldCache.m == nil { + fieldCache.m = map[reflect.Type][]field{} + } + fieldCache.m[t] = f + fieldCache.Unlock() + return f +} diff --git a/vendor/olympos.io/encoding/edn/extras.go b/vendor/olympos.io/encoding/edn/extras.go new file mode 100644 index 000000000..000ca2324 --- /dev/null +++ b/vendor/olympos.io/encoding/edn/extras.go @@ -0,0 +1,177 @@ +// Copyright 2010 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package edn + +import ( + "reflect" + "strconv" + "unicode/utf8" +) + +// getu4 decodes \uXXXX from the beginning of s, returning the hex value, +// or it returns -1. +func getu4(s []byte) rune { + if len(s) < 6 || s[0] != '\\' || s[1] != 'u' { + return -1 + } + r, err := strconv.ParseUint(string(s[2:6]), 16, 64) + if err != nil { + return -1 + } + return rune(r) +} + +// indirect walks down v allocating pointers as needed, +// until it gets to a non-pointer. +// if it encounters an Unmarshaler, indirect stops and returns that. +// if decodingNull is true, indirect stops at the last pointer so it can be set to nil. +func (d *Decoder) indirect(v reflect.Value, decodingNull bool) (Unmarshaler, reflect.Value) { + // If v is a named type and is addressable, + // start with its address, so that if the type has pointer methods, + // we find them. + if v.Kind() != reflect.Ptr && v.Type().Name() != "" && v.CanAddr() { + v = v.Addr() + } + for { + // Load value from interface, but only if the result will be + // usefully addressable. + if v.Kind() == reflect.Interface && !v.IsNil() { + e := v.Elem() + if e.Kind() == reflect.Ptr && !e.IsNil() && (!decodingNull || e.Elem().Kind() == reflect.Ptr) { + v = e + continue + } + } + + if v.Kind() != reflect.Ptr { + break + } + + if v.Elem().Kind() != reflect.Ptr && decodingNull && v.CanSet() { + break + } + if v.IsNil() { + v.Set(reflect.New(v.Type().Elem())) + } + if v.Type().NumMethod() > 0 { + if u, ok := v.Interface().(Unmarshaler); ok { + return u, reflect.Value{} + } + } + v = v.Elem() + } + return nil, v +} + +// unquote converts a quoted EDN string literal s into an actual string t. +// The rules are different than for Go, so cannot use strconv.Unquote. +func unquote(s []byte) (t string, ok bool) { + s, ok = unquoteBytes(s) + t = string(s) + return +} + +func unquoteBytes(s []byte) (t []byte, ok bool) { + if len(s) < 2 || s[0] != '"' || s[len(s)-1] != '"' { + return + } + s = s[1 : len(s)-1] + + // Check for unusual characters. If there are none, + // then no unquoting is needed, so return a slice of the + // original bytes. + r := 0 + for r < len(s) { + c := s[r] + if c == '\\' || c == '"' { + break + } + if c < utf8.RuneSelf { + r++ + continue + } + rr, size := utf8.DecodeRune(s[r:]) + if rr == utf8.RuneError && size == 1 { + break + } + r += size + } + if r == len(s) { + return s, true + } + + b := make([]byte, len(s)+2*utf8.UTFMax) + w := copy(b, s[0:r]) + for r < len(s) { + // Out of room? Can only happen if s is full of + // malformed UTF-8 and we're replacing each + // byte with RuneError. + if w >= len(b)-2*utf8.UTFMax { + nb := make([]byte, (len(b)+utf8.UTFMax)*2) + copy(nb, b[0:w]) + b = nb + } + switch c := s[r]; { + case c == '\\': + r++ + if r >= len(s) { + return + } + switch s[r] { + default: + return + case '"', '\\', '/', '\'': + b[w] = s[r] + r++ + w++ + case 'b': + b[w] = '\b' + r++ + w++ + case 'f': + b[w] = '\f' + r++ + w++ + case 'n': + b[w] = '\n' + r++ + w++ + case 'r': + b[w] = '\r' + r++ + w++ + case 't': + b[w] = '\t' + r++ + w++ + case 'u': + r-- + rr := getu4(s[r:]) + if rr < 0 { + return + } + r += 6 + w += utf8.EncodeRune(b[w:], rr) + } + + // Quote is invalid + case c == '"': + return + + // ASCII + case c < utf8.RuneSelf: + b[w] = c + r++ + w++ + + // Coerce to well-formed UTF-8. + default: + rr, size := utf8.DecodeRune(s[r:]) + r += size + w += utf8.EncodeRune(b[w:], rr) + } + } + return b[0:w], true +} diff --git a/vendor/olympos.io/encoding/edn/fold.go b/vendor/olympos.io/encoding/edn/fold.go new file mode 100644 index 000000000..f6ff95b1d --- /dev/null +++ b/vendor/olympos.io/encoding/edn/fold.go @@ -0,0 +1,143 @@ +// Copyright 2013 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package edn + +import ( + "bytes" + "unicode/utf8" +) + +const ( + caseMask = ^byte(0x20) // Mask to ignore case in ASCII. + kelvin = '\u212a' + smallLongEss = '\u017f' +) + +// foldFunc returns one of four different case folding equivalence +// functions, from most general (and slow) to fastest: +// +// 1) bytes.EqualFold, if the key s contains any non-ASCII UTF-8 +// 2) equalFoldRight, if s contains special folding ASCII ('k', 'K', 's', 'S') +// 3) asciiEqualFold, no special, but includes non-letters (including _) +// 4) simpleLetterEqualFold, no specials, no non-letters. +// +// The letters S and K are special because they map to 3 runes, not just 2: +// * S maps to s and to U+017F 'ſ' Latin small letter long s +// * k maps to K and to U+212A 'K' Kelvin sign +// See https://play.golang.org/p/tTxjOc0OGo +// +// The returned function is specialized for matching against s and +// should only be given s. It's not curried for performance reasons. +func foldFunc(s []byte) func(s, t []byte) bool { + nonLetter := false + special := false // special letter + for _, b := range s { + if b >= utf8.RuneSelf { + return bytes.EqualFold + } + upper := b & caseMask + if upper < 'A' || upper > 'Z' { + nonLetter = true + } else if upper == 'K' || upper == 'S' { + // See above for why these letters are special. + special = true + } + } + if special { + return equalFoldRight + } + if nonLetter { + return asciiEqualFold + } + return simpleLetterEqualFold +} + +// equalFoldRight is a specialization of bytes.EqualFold when s is +// known to be all ASCII (including punctuation), but contains an 's', +// 'S', 'k', or 'K', requiring a Unicode fold on the bytes in t. +// See comments on foldFunc. +func equalFoldRight(s, t []byte) bool { + for _, sb := range s { + if len(t) == 0 { + return false + } + tb := t[0] + if tb < utf8.RuneSelf { + if sb != tb { + sbUpper := sb & caseMask + if 'A' <= sbUpper && sbUpper <= 'Z' { + if sbUpper != tb&caseMask { + return false + } + } else { + return false + } + } + t = t[1:] + continue + } + // sb is ASCII and t is not. t must be either kelvin + // sign or long s; sb must be s, S, k, or K. + tr, size := utf8.DecodeRune(t) + switch sb { + case 's', 'S': + if tr != smallLongEss { + return false + } + case 'k', 'K': + if tr != kelvin { + return false + } + default: + return false + } + t = t[size:] + + } + if len(t) > 0 { + return false + } + return true +} + +// asciiEqualFold is a specialization of bytes.EqualFold for use when +// s is all ASCII (but may contain non-letters) and contains no +// special-folding letters. +// See comments on foldFunc. +func asciiEqualFold(s, t []byte) bool { + if len(s) != len(t) { + return false + } + for i, sb := range s { + tb := t[i] + if sb == tb { + continue + } + if ('a' <= sb && sb <= 'z') || ('A' <= sb && sb <= 'Z') { + if sb&caseMask != tb&caseMask { + return false + } + } else { + return false + } + } + return true +} + +// simpleLetterEqualFold is a specialization of bytes.EqualFold for +// use when s is all ASCII letters (no underscores, etc) and also +// doesn't contain 'k', 'K', 's', or 'S'. +// See comments on foldFunc. +func simpleLetterEqualFold(s, t []byte) bool { + if len(s) != len(t) { + return false + } + for i, b := range s { + if b&caseMask != t[i]&caseMask { + return false + } + } + return true +} diff --git a/vendor/olympos.io/encoding/edn/go.mod b/vendor/olympos.io/encoding/edn/go.mod new file mode 100644 index 000000000..1bbb4e536 --- /dev/null +++ b/vendor/olympos.io/encoding/edn/go.mod @@ -0,0 +1,3 @@ +module olympos.io/encoding/edn + +go 1.13 diff --git a/vendor/olympos.io/encoding/edn/lexer.go b/vendor/olympos.io/encoding/edn/lexer.go new file mode 100644 index 000000000..b8592ca28 --- /dev/null +++ b/vendor/olympos.io/encoding/edn/lexer.go @@ -0,0 +1,603 @@ +// Copyright 2015 Jean Niklas L'orange. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package edn + +import ( + "strconv" + u "unicode" +) + +type lexState int + +const ( + lexCont = lexState(iota) // continue reading + lexIgnore // values you can ignore, just whitespace and comments atm + lexEnd // value ended with input given in + lexEndPrev // value ended with previous input + lexError // erroneous input +) + +type tokenType int + +const ( // value types from lexer + tokenSymbol = tokenType(iota) + tokenKeyword + tokenString + tokenInt + tokenFloat + tokenTag + tokenChar + tokenListStart + tokenListEnd + tokenVectorStart + tokenVectorEnd + tokenMapStart + tokenMapEnd + tokenSetStart + tokenDiscard + + tokenError +) + +func (t tokenType) String() string { + switch t { + case tokenSymbol: + return "symbol" + case tokenKeyword: + return "keyword" + case tokenString: + return "string" + case tokenInt: + return "integer" + case tokenFloat: + return "float" + case tokenTag: + return "tag" + case tokenChar: + return "character" + case tokenListStart: + return "list start" + case tokenListEnd: + return "list end" + case tokenVectorStart: + return "vector start" + case tokenVectorEnd: + return "vector end" + case tokenMapStart: + return "map start" + case tokenMapEnd: + return "map/set end" + case tokenSetStart: + return "set start" + case tokenDiscard: + return "discard token" + case tokenError: + return "error" + default: + return "[unknown]" + } +} + +const tokenSetEnd = tokenMapEnd // sets ends the same way as maps do + +// A SyntaxError is a description of an EDN syntax error. +type SyntaxError struct { + msg string // description of error + Offset int64 // error occurred after reading Offset bytes +} + +func (e *SyntaxError) Error() string { + return e.msg +} + +func okSymbolFirst(r rune) bool { + switch r { + case '.', '*', '+', '!', '-', '_', '?', '$', '%', '&', '=', '<', '>': + return true + } + return false +} + +func okSymbol(r rune) bool { + switch r { + case '.', '*', '+', '!', '-', '_', '?', '$', '%', '&', '=', '<', '>', ':', '#', '\'': + return true + } + return false +} + +func isWhitespace(r rune) bool { + return u.IsSpace(r) || r == ',' +} + +type lexer struct { + state func(rune) lexState + err error + position int64 + token tokenType + + count int // counter is used in some functions within the lexer + expecting []rune // expecting is used to avoid duplication when we expect e.g. \newline +} + +func (l *lexer) reset() { + l.state = l.stateBegin + l.token = tokenType(-1) + l.err = nil +} + +func (l *lexer) eof() lexState { + if l.err != nil { + return lexError + } + lt := l.state(' ') + if lt == lexCont { + l.err = &SyntaxError{"unexpected end of EDN input", l.position} + lt = lexError + } + if l.err != nil { + return lexError + } + if lt == lexEndPrev { + return lexEnd + } + return lt +} + +func (l *lexer) stateBegin(r rune) lexState { + switch { + case isWhitespace(r): + return lexIgnore + case r == '{': + l.token = tokenMapStart + return lexEnd + case r == '}': + l.token = tokenMapEnd + return lexEnd + case r == '[': + l.token = tokenVectorStart + return lexEnd + case r == ']': + l.token = tokenVectorEnd + return lexEnd + case r == '(': + l.token = tokenListStart + return lexEnd + case r == ')': + l.token = tokenListEnd + return lexEnd + case r == '#': + l.state = l.statePound + return lexCont + case r == ':': + l.state = l.stateKeyword + return lexCont + case r == '/': // ohh, the lovely slash edge case + l.token = tokenSymbol + l.state = l.stateEndLit + return lexCont + case r == '+': + l.state = l.statePos + return lexCont + case r == '-': + l.state = l.stateNeg + return lexCont + case r == '.': + l.token = tokenSymbol + l.state = l.stateDotPre + return lexCont + case r == '"': + l.state = l.stateInString + return lexCont + case r == '\\': + l.state = l.stateChar + return lexCont + case okSymbolFirst(r) || u.IsLetter(r): + l.token = tokenSymbol + l.state = l.stateSym + return lexCont + case '0' < r && r <= '9': + l.state = l.state1 + return lexCont + case r == '0': + l.state = l.state0 + return lexCont + case r == ';': + l.state = l.stateComment + return lexIgnore + } + return l.error(r, "- unexpected rune") +} + +func (l *lexer) stateComment(r rune) lexState { + if r == '\n' { + l.state = l.stateBegin + } + return lexIgnore +} + +func (l *lexer) stateEndLit(r rune) lexState { + if isWhitespace(r) || r == '"' || r == '{' || r == '[' || r == '(' || r == ')' || r == ']' || r == '}' || r == '\\' || r == ';' { + return lexEndPrev + } + return l.error(r, "- unexpected rune after legal "+l.token.String()) +} + +func (l *lexer) stateKeyword(r rune) lexState { + switch { + case r == ':': + l.state = l.stateError + l.err = &SyntaxError{"EDN does not support namespace-qualified keywords", l.position} + return lexError + case r == '/': + l.state = l.stateError + l.err = &SyntaxError{"keywords cannot begin with /", l.position} + return lexError + case okSymbol(r) || u.IsLetter(r) || ('0' <= r && r <= '9'): + l.token = tokenKeyword + l.state = l.stateSym + return lexCont + } + return l.error(r, "after keyword start") +} + +// examples: 'foo' 'bar' +// we reuse this from the keyword states, so we don't set token at the end, +// but before we call this +func (l *lexer) stateSym(r rune) lexState { + switch { + case okSymbol(r) || u.IsLetter(r) || ('0' <= r && r <= '9'): + l.state = l.stateSym + return lexCont + case r == '/': + l.state = l.stateSlash + return lexCont + } + return l.stateEndLit(r) +} + +// example: 'foo/' +func (l *lexer) stateSlash(r rune) lexState { + switch { + case okSymbol(r) || u.IsLetter(r) || ('0' <= r && r <= '9'): + l.state = l.statePostSlash + return lexCont + } + return l.error(r, "directly after '/' in namespaced symbol") +} + +// example : 'foo/bar' +func (l *lexer) statePostSlash(r rune) lexState { + switch { + case okSymbol(r) || u.IsLetter(r) || ('0' <= r && r <= '9'): + l.state = l.statePostSlash + return lexCont + } + return l.stateEndLit(r) +} + +// example: '-' +func (l *lexer) stateNeg(r rune) lexState { + switch { + case r == '0': + l.state = l.state0 + return lexCont + case '1' <= r && r <= '9': + l.state = l.state1 + return lexCont + case okSymbol(r) || u.IsLetter(r): + l.token = tokenSymbol + l.state = l.stateSym + return lexCont + case r == '/': + l.token = tokenSymbol + l.state = l.stateSlash + return lexCont + } + l.token = tokenSymbol + return l.stateEndLit(r) +} + +// example: '+' +func (l *lexer) statePos(r rune) lexState { + switch { + case r == '0': + l.state = l.state0 + return lexCont + case '1' <= r && r <= '9': + l.state = l.state1 + return lexCont + case okSymbol(r) || u.IsLetter(r): + l.token = tokenSymbol + l.state = l.stateSym + return lexCont + case r == '/': + l.token = tokenSymbol + l.state = l.stateSlash + return lexCont + } + l.token = tokenSymbol + return l.stateEndLit(r) +} + +// value is '0' +func (l *lexer) state0(r rune) lexState { + switch { + case r == '.': + l.state = l.stateDot + return lexCont + case r == 'e' || r == 'E': + l.state = l.stateE + return lexCont + case r == 'M': // bigdecimal + l.token = tokenFloat + l.state = l.stateEndLit + return lexCont // must be ws or delimiter afterwards + case r == 'N': // bigint + l.token = tokenInt + l.state = l.stateEndLit + return lexCont // must be ws or delimiter afterwards + } + l.token = tokenInt + return l.stateEndLit(r) +} + +// anything but a result starting with 0. example '10', '34' +func (l *lexer) state1(r rune) lexState { + if '0' <= r && r <= '9' { + return lexCont + } + return l.state0(r) +} + +// example: '.', can only receive non-numerics here +func (l *lexer) stateDotPre(r rune) lexState { + switch { + case okSymbol(r) || u.IsLetter(r): + l.token = tokenSymbol + l.state = l.stateSym + return lexCont + case r == '/': + l.token = tokenSymbol + l.state = l.stateSlash + return lexCont + } + return l.stateEndLit(r) +} + +// after reading numeric values plus '.', example: '12.' +func (l *lexer) stateDot(r rune) lexState { + if '0' <= r && r <= '9' { + l.state = l.stateDot0 + return lexCont + } + // TODO (?): The spec says that there must be numbers after the dot, yet + // (clojure.edn/read-string "1.e1") returns 10.0 + return l.error(r, "after decimal point in numeric literal") +} + +// after reading numeric values plus '.', example: '12.34' +func (l *lexer) stateDot0(r rune) lexState { + switch { + case '0' <= r && r <= '9': + return lexCont + case r == 'e' || r == 'E': + l.state = l.stateE + return lexCont + case r == 'M': + l.token = tokenFloat + l.state = l.stateEndLit + return lexCont + } + l.token = tokenFloat + return l.stateEndLit(r) +} + +// stateE is the state after reading the mantissa and e in a number, +// such as after reading `314e` or `0.314e`. +func (l *lexer) stateE(r rune) lexState { + if r == '+' || r == '-' { + l.state = l.stateESign + return lexCont + } + return l.stateESign(r) +} + +// stateESign is the state after reading the mantissa, e, and sign in a number, +// such as after reading `314e-` or `0.314e+`. +func (l *lexer) stateESign(r rune) lexState { + if '0' <= r && r <= '9' { + l.state = l.stateE0 + return lexCont + } + return l.error(r, "in exponent of numeric literal") +} + +// stateE0 is the state after reading the mantissa, e, optional sign, +// and at least one digit of the exponent in a number, +// such as after reading `314e-2` or `0.314e+1` or `3.14e0`. +func (l *lexer) stateE0(r rune) lexState { + if '0' <= r && r <= '9' { + return lexCont + } + if r == 'M' { + l.token = tokenFloat + l.state = l.stateEndLit + return lexCont + } + l.token = tokenFloat + return l.stateEndLit(r) +} + +var ( + newlineRunes = []rune("newline") + returnRunes = []rune("return") + spaceRunes = []rune("space") + tabRunes = []rune("tab") + formfeedRunes = []rune("formfeed") +) + +// stateChar after a backslash ('\') +func (l *lexer) stateChar(r rune) lexState { + switch { + // oh my, I'm so happy that none of these share the same prefix. + case r == 'n': + l.count = 1 + l.expecting = newlineRunes + l.state = l.stateSpecialChar + return lexCont + case r == 'r': + l.count = 1 + l.expecting = returnRunes + l.state = l.stateSpecialChar + return lexCont + case r == 's': + l.count = 1 + l.expecting = spaceRunes + l.state = l.stateSpecialChar + return lexCont + case r == 't': + l.count = 1 + l.expecting = tabRunes + l.state = l.stateSpecialChar + return lexCont + case r == 'f': + l.count = 1 + l.expecting = formfeedRunes + l.state = l.stateSpecialChar + return lexCont + case r == 'u': + l.count = 0 + l.state = l.stateUnicodeChar + return lexCont + case isWhitespace(r): + l.state = l.stateError + l.err = &SyntaxError{"backslash cannot be followed by whitespace", l.position} + return lexError + } + // default is single name character + l.token = tokenChar + l.state = l.stateEndLit + return lexCont +} + +func (l *lexer) stateSpecialChar(r rune) lexState { + if r == l.expecting[l.count] { + l.count++ + if l.count == len(l.expecting) { + l.token = tokenChar + l.state = l.stateEndLit + return lexCont + } + return lexCont + } + if l.count != 1 { + return l.error(r, "after start of special character") + } + // it is likely just a normal character, like 'n' or 't' + l.token = tokenChar + return l.stateEndLit(r) +} + +func (l *lexer) stateUnicodeChar(r rune) lexState { + if '0' <= r && r <= '9' || 'a' <= r && r <= 'f' || 'A' <= r && r <= 'F' { + l.count++ + if l.count == 4 { + l.token = tokenChar + l.state = l.stateEndLit + } + return lexCont + } + if l.count != 0 { + return l.error(r, "after start of unicode character") + } + // likely just '\u' + l.token = tokenChar + return l.stateEndLit(r) +} + +// stateInString is the state after reading `"`. +func (l *lexer) stateInString(r rune) lexState { + if r == '"' { + l.token = tokenString + return lexEnd + } + if r == '\\' { + l.state = l.stateInStringEsc + return lexCont + } + return lexCont +} + +// stateInStringEsc is the state after reading `"\` during a quoted string. +func (l *lexer) stateInStringEsc(r rune) lexState { + switch r { + case 'b', 'f', 'n', 'r', 't', '\\', '/', '"': + l.state = l.stateInString + return lexCont + case 'u': + l.state = l.stateInStringEscU + l.count = 0 + return lexCont + } + return l.error(r, "in string escape code") +} + +// stateInStringEscU is the state after reading `"\u` and l.count elements in a +// quoted string. +func (l *lexer) stateInStringEscU(r rune) lexState { + if '0' <= r && r <= '9' || 'a' <= r && r <= 'f' || 'A' <= r && r <= 'F' { + l.count++ + if l.count == 4 { + l.state = l.stateInString + } + return lexCont + } + // numbers + return l.error(r, "in \\u hexadecimal character escape") +} + +// after reading the character '#' +func (l *lexer) statePound(r rune) lexState { + switch { + case r == '_': + l.token = tokenDiscard + return lexEnd + case r == '{': + l.token = tokenSetStart + return lexEnd + case u.IsLetter(r): + l.token = tokenTag + l.state = l.stateSym + return lexCont + } + return l.error(r, `after token starting with "#"`) +} + +func (l *lexer) stateError(r rune) lexState { + return lexError +} + +// error records an error and switches to the error state. +func (l *lexer) error(r rune, context string) lexState { + l.state = l.stateError + l.err = &SyntaxError{"invalid character " + quoteRune(r) + " " + context, l.position} + return lexError +} + +// quoteRune formats r as a quoted rune literal +func quoteRune(r rune) string { + // special cases - different from quoted strings + if r == '\'' { + return `'\''` + } + if r == '"' { + return `'"'` + } + + // use quoted string with different quotation marks + s := strconv.Quote(string(r)) + return "'" + s[1:len(s)-1] + "'" +} diff --git a/vendor/olympos.io/encoding/edn/pprint.go b/vendor/olympos.io/encoding/edn/pprint.go new file mode 100644 index 000000000..57f44afec --- /dev/null +++ b/vendor/olympos.io/encoding/edn/pprint.go @@ -0,0 +1,245 @@ +// Copyright 2015 Jean Niklas L'orange. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package edn + +import ( + "bytes" + "io" + "unicode/utf8" +) + +var ( + // we can't call it spaceBytes not to conflict with decode.go's spaceBytes. + spaceOutputBytes = []byte(" ") + commaOutputBytes = []byte(",") +) + +func newline(dst io.Writer, prefix, indent string, depth int) { + dst.Write([]byte{'\n'}) + dst.Write([]byte(prefix)) + for i := 0; i < depth; i++ { + dst.Write([]byte(indent)) + } +} + +// Indent writes to dst an indented form of the EDN-encoded src. Each EDN +// collection begins on a new, indented line beginning with prefix followed by +// one or more copies of indent according to the indentation nesting. The data +// written to dst does not begin with the prefix nor any indentation, and has +// no trailing newline, to make it easier to embed inside other formatted EDN +// data. +// +// Indent filters away whitespace, including comments and discards. +func Indent(dst *bytes.Buffer, src []byte, prefix, indent string) error { + origLen := dst.Len() + err := IndentStream(dst, bytes.NewBuffer(src), prefix, indent) + if err != nil { + dst.Truncate(origLen) + } + return err +} + +// IndentStream is an implementation of PPrint for generic readers and writers +func IndentStream(dst io.Writer, src io.Reader, prefix, indent string) error { + var lex lexer + lex.reset() + tokStack := newTokenStack() + curType := tokenError + curSize := 0 + d := NewDecoder(src) + depth := 0 + for { + bs, tt, err := d.nextToken() + if err != nil { + return err + } + err = tokStack.push(tt) + if err != nil { + return err + } + prevType := curType + prevSize := curSize + if len(tokStack.toks) > 0 { + curType = tokStack.peek() + curSize = tokStack.peekCount() + } + switch tt { + case tokenMapStart, tokenVectorStart, tokenListStart, tokenSetStart: + if prevType == tokenMapStart { + dst.Write([]byte{' '}) + } else if depth > 0 { + newline(dst, prefix, indent, depth) + } + dst.Write(bs) + depth++ + case tokenVectorEnd, tokenListEnd, tokenMapEnd: // tokenSetEnd == tokenMapEnd + depth-- + if prevSize > 0 { // suppress indent for empty collections + newline(dst, prefix, indent, depth) + } + // all of these are of length 1 in bytes, so utilise this for perf + dst.Write(bs) + case tokenTag: + // need to know what the previous type was. + switch prevType { + case tokenMapStart: + if prevSize%2 == 0 { // If previous size modulo 2 is equal to 0, we're a key + if prevSize > 0 { + dst.Write(commaOutputBytes) + } + newline(dst, prefix, indent, depth) + } else { // We're a value, add a space after the key + dst.Write(spaceOutputBytes) + } + dst.Write(bs) + dst.Write(spaceOutputBytes) + case tokenSetStart, tokenVectorStart, tokenListStart: + newline(dst, prefix, indent, depth) + dst.Write(bs) + dst.Write(spaceOutputBytes) + default: // tokenError or nested tag + dst.Write(bs) + dst.Write(spaceOutputBytes) + } + default: + switch prevType { + case tokenMapStart: + if prevSize%2 == 0 { // If previous size modulo 2 is equal to 0, we're a key + if prevSize > 0 { + dst.Write(commaOutputBytes) + } + newline(dst, prefix, indent, depth) + } else { // We're a value, add a space after the key + dst.Write(spaceOutputBytes) + } + dst.Write(bs) + case tokenSetStart, tokenVectorStart, tokenListStart: + newline(dst, prefix, indent, depth) + dst.Write(bs) + default: // toplevel or nested tag. This should collapse the whole tag tower + dst.Write(bs) + } + } + if tokStack.done() { + break + } + } + return nil +} + +// PPrintOpts is a configuration map for PPrint. The values in this struct has +// no effect as of now. +type PPrintOpts struct { + RightMargin int + MiserWidth int +} + +func pprintIndent(dst io.Writer, shift int) { + spaces := make([]byte, shift+1) + + spaces[0] = '\n' + + // TODO: This may be slower than caching the size as a byte slice + for i := 1; i <= shift; i++ { + spaces[i] = ' ' + } + + dst.Write(spaces) +} + +// PPrint writes to dst an indented form of the EDN-encoded src. This +// implementation attempts to write idiomatic/readable EDN values, in a fashion +// close to (but not quite equal to) clojure.pprint/pprint. +// +// PPrint filters away whitespace, including comments and discards. +func PPrint(dst *bytes.Buffer, src []byte, opt *PPrintOpts) error { + origLen := dst.Len() + err := PPrintStream(dst, bytes.NewBuffer(src), opt) + if err != nil { + dst.Truncate(origLen) + } + return err +} + +// PPrintStream is an implementation of PPrint for generic readers and writers +func PPrintStream(dst io.Writer, src io.Reader, opt *PPrintOpts) error { + var lex lexer + var col, prevCollStart, curSize int + var prevColl bool + + lex.reset() + tokStack := newTokenStack() + + shift := make([]int, 1, 8) // pre-allocate some space + curType := tokenError + d := NewDecoder(src) + + for { + bs, tt, err := d.nextToken() + if err != nil { + return err + } + err = tokStack.push(tt) + if err != nil { + return err + } + prevType := curType + prevSize := curSize + if len(tokStack.toks) > 0 { + curType = tokStack.peek() + curSize = tokStack.peekCount() + } + // Indentation + switch tt { + case tokenVectorEnd, tokenListEnd, tokenMapEnd: + default: + switch prevType { + case tokenMapStart: + if prevSize%2 == 0 && prevSize > 0 { + dst.Write(commaOutputBytes) + pprintIndent(dst, shift[len(shift)-1]) + col = shift[len(shift)-1] + } else if prevSize%2 == 1 { // We're a value, add a space after the key + dst.Write(spaceOutputBytes) + col++ + } + case tokenSetStart, tokenVectorStart, tokenListStart: + if prevColl { + // begin on new line where prevColl started + // This will look so strange for heterogenous maps. + pprintIndent(dst, prevCollStart) + col = prevCollStart + } else if prevSize > 0 { + dst.Write(spaceOutputBytes) + col++ + } + } + } + switch tt { + case tokenMapStart, tokenVectorStart, tokenListStart, tokenSetStart: + dst.Write(bs) + col += len(bs) // either 2 or 1 + shift = append(shift, col) // we only use maps for now, but we'll utilise this more thoroughly later on + case tokenVectorEnd, tokenListEnd, tokenMapEnd: // tokenSetEnd == tokenMapEnd + dst.Write(bs) // all of these are of length 1 in bytes, so this is ok + prevCollStart = shift[len(shift)-1] - 1 + shift = shift[:len(shift)-1] + case tokenTag: + bslen := utf8.RuneCount(bs) + dst.Write(bs) + dst.Write(spaceOutputBytes) + col += bslen + 1 + default: + bslen := utf8.RuneCount(bs) + dst.Write(bs) + col += bslen + } + prevColl = (tt == tokenMapEnd || tt == tokenVectorEnd || tt == tokenListEnd) + if tokStack.done() { + break + } + } + return nil +} diff --git a/vendor/olympos.io/encoding/edn/tags.go b/vendor/olympos.io/encoding/edn/tags.go new file mode 100644 index 000000000..b9d5c46a4 --- /dev/null +++ b/vendor/olympos.io/encoding/edn/tags.go @@ -0,0 +1,44 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package edn + +import ( + "strings" +) + +// tagOptions is the string following a comma in a struct field's "json" +// tag, or the empty string. It does not include the leading comma. +type tagOptions string + +// parseTag splits a struct field's json tag into its name and +// comma-separated options. +func parseTag(tag string) (string, tagOptions) { + if idx := strings.Index(tag, ","); idx != -1 { + return tag[:idx], tagOptions(tag[idx+1:]) + } + return tag, tagOptions("") +} + +// Contains reports whether a comma-separated list of options +// contains a particular substr flag. substr must be surrounded by a +// string boundary or commas. +func (o tagOptions) Contains(optionName string) bool { + if len(o) == 0 { + return false + } + s := string(o) + for s != "" { + var next string + i := strings.Index(s, ",") + if i >= 0 { + s, next = s[:i], s[i+1:] + } + if s == optionName { + return true + } + s = next + } + return false +} diff --git a/vendor/olympos.io/encoding/edn/types.go b/vendor/olympos.io/encoding/edn/types.go new file mode 100644 index 000000000..e45b2ee54 --- /dev/null +++ b/vendor/olympos.io/encoding/edn/types.go @@ -0,0 +1,149 @@ +// Copyright 2015-2017 Jean Niklas L'orange. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package edn + +import ( + "bufio" + "bytes" + "errors" + "fmt" +) + +// RawMessage is a raw encoded, but valid, EDN value. It implements Marshaler +// and Unmarshaler and can be used to delay EDN decoding or precompute an EDN +// encoding. +type RawMessage []byte + +// MarshalEDN returns m as the EDN encoding of m. +func (m RawMessage) MarshalEDN() ([]byte, error) { + if m == nil { + return []byte("nil"), nil + } + return m, nil +} + +// UnmarshalEDN sets *m to a copy of data. +func (m *RawMessage) UnmarshalEDN(data []byte) error { + if m == nil { + return errors.New("edn.RawMessage: UnmarshalEDN on nil pointer") + } + *m = append((*m)[0:0], data...) + return nil +} + +// A Keyword is an EDN keyword without : prepended in front. +type Keyword string + +func (k Keyword) String() string { + return fmt.Sprintf(":%s", string(k)) +} + +func (k Keyword) MarshalEDN() ([]byte, error) { + return []byte(k.String()), nil +} + +// A Symbol is an EDN symbol. +type Symbol string + +func (s Symbol) String() string { + return string(s) +} + +func (s Symbol) MarshalEDN() ([]byte, error) { + return []byte(s), nil +} + +// A Tag is a tagged value. The Tagname represents the name of the tag, and the +// Value is the value of the element. +type Tag struct { + Tagname string + Value interface{} +} + +func (t Tag) String() string { + return fmt.Sprintf("#%s %v", t.Tagname, t.Value) +} + +func (t Tag) MarshalEDN() ([]byte, error) { + str := []byte(fmt.Sprintf(`#%s `, t.Tagname)) + b, err := Marshal(t.Value) + if err != nil { + return nil, err + } + return append(str, b...), nil +} + +func (t *Tag) UnmarshalEDN(bs []byte) error { + // read actual tag, using the lexer. + var lex lexer + lex.reset() + buf := bufio.NewReader(bytes.NewBuffer(bs)) + start := 0 + endTag := 0 +tag: + for { + r, rlen, err := buf.ReadRune() + if err != nil { + return err + } + + ls := lex.state(r) + switch ls { + case lexIgnore: + start += rlen + endTag += rlen + case lexError: + return lex.err + case lexEndPrev: + break tag + case lexEnd: // unexpected, assuming tag which is not ending with lexEnd + return errUnexpected + case lexCont: + endTag += rlen + } + } + t.Tagname = string(bs[start+1 : endTag]) + return Unmarshal(bs[endTag:], &t.Value) +} + +// A Rune type is a wrapper for a rune. It can be used to encode runes as +// characters instead of int32 values. +type Rune rune + +func (r Rune) MarshalEDN() ([]byte, error) { + buf := bytes.NewBuffer(make([]byte, 0, 10)) + encodeRune(buf, rune(r)) + return buf.Bytes(), nil +} + +func encodeRune(buf *bytes.Buffer, r rune) { + const hex = "0123456789abcdef" + if !isWhitespace(r) { + buf.WriteByte('\\') + buf.WriteRune(r) + } else { + switch r { + case '\b': + buf.WriteString(`\backspace`) + case '\f': + buf.WriteString(`\formfeed`) + case '\n': + buf.WriteString(`\newline`) + case '\r': + buf.WriteString(`\return`) + case '\t': + buf.WriteString(`\tab`) + case ' ': + buf.WriteString(`\space`) + default: + buf.WriteByte('\\') + buf.WriteByte('u') + buf.WriteByte(hex[r>>12&0xF]) + buf.WriteByte(hex[r>>8&0xF]) + buf.WriteByte(hex[r>>4&0xF]) + buf.WriteByte(hex[r&0xF]) + } + } +}