diff --git a/Makefile b/Makefile index 5b9246d9..8096d7aa 100644 --- a/Makefile +++ b/Makefile @@ -20,13 +20,17 @@ bindings/WrappedNativeToken/WrappedNativeToken.go: hardhat mkdir -p bindings/WrappedNativeToken seer evm generate --package WrappedNativeToken --output bindings/WrappedNativeToken/WrappedNativeToken.go --hardhat web3/artifacts/contracts/token/WrappedNativeToken.sol/WrappedNativeToken.json --cli --struct WrappedNativeToken -bindings: bindings/ERC20/ERC20.go bindings/TokenFaucet/TokenFaucet.go bindings/WrappedNativeToken/WrappedNativeToken.go +bindings/Staker/Staker.go: hardhat + mkdir -p bindings/Staker + seer evm generate --package Staker --output bindings/Staker/Staker.go --hardhat web3/artifacts/contracts/staking/Staker.sol/Staker.json --cli --struct Staker + +bindings: bindings/ERC20/ERC20.go bindings/TokenFaucet/TokenFaucet.go bindings/WrappedNativeToken/WrappedNativeToken.go bindings/Staker/Staker.go test: npx hardhat test clean: - rm -rf bindings/ERC20/* bin/* bindings/TokenFaucet/* bindings/WrappedNativeToken/* + rm -rf bindings/ERC20/* bin/* bindings/TokenFaucet/* bindings/WrappedNativeToken/* bindings/Staker/* hardhat: cd web3 && npm install && npx hardhat compile diff --git a/bindings/Staker/Staker.go b/bindings/Staker/Staker.go new file mode 100644 index 00000000..ab780b92 --- /dev/null +++ b/bindings/Staker/Staker.go @@ -0,0 +1,4644 @@ +// This file was generated by seer: https://github.com/moonstream-to/seer. +// seer version: 0.1.3 +// seer command: seer evm generate --package Staker --cli --struct Staker --output bindings/Staker/Staker.go +// Code generated - DO NOT EDIT. +// This file is a generated binding and any manual changes will be lost. + +package Staker + +import ( + "errors" + "math/big" + "strings" + + "context" + + 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. + "encoding/hex" + "fmt" + "os" + "time" + + "github.com/ethereum/go-ethereum/accounts/keystore" + "github.com/ethereum/go-ethereum/ethclient" + "github.com/spf13/cobra" + "golang.org/x/term" +) + +var ( + _ = errors.New + _ = big.NewInt + _ = strings.NewReader + _ = ethereum.NotFound + _ = bind.Bind + _ = common.Big1 + _ = types.BloomLookup + _ = event.NewSubscription + _ = abi.ConvertType +) + +// StakerMetaData contains all meta data concerning the Staker contract. +var StakerMetaData = &bind.MetaData{ + ABI: "[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"ERC721EnumerableForbiddenBatchMint\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"ERC721IncorrectOwner\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"ERC721InsufficientApproval\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"approver\",\"type\":\"address\"}],\"name\":\"ERC721InvalidApprover\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"}],\"name\":\"ERC721InvalidOperator\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"ERC721InvalidOwner\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"}],\"name\":\"ERC721InvalidReceiver\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"ERC721InvalidSender\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"ERC721NonexistentToken\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"ERC721OutOfBoundsIndex\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidConfiguration\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidTokenType\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NonAdministrator\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ReentrancyGuardReentrantCall\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"approved\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"ApprovalForAll\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"poolID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"administrator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"transferable\",\"type\":\"bool\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"lockupSeconds\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"cooldownSeconds\",\"type\":\"uint256\"}],\"name\":\"StakingPoolConfigured\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"poolID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"tokenType\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"tokenAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"tokenID\",\"type\":\"uint256\"}],\"name\":\"StakingPoolCreated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"ERC1155_TOKEN_TYPE\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ERC20_TOKEN_TYPE\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ERC721_TOKEN_TYPE\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"NATIVE_TOKEN_TYPE\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"Pools\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"administrator\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenType\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"tokenAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenID\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"transferable\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"lockupSeconds\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"cooldownSeconds\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"Positions\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"poolID\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint64\",\"name\":\"stakeTimestamp\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"TotalPools\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenType\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"tokenAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenID\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"transferable\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"lockupSeconds\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"cooldownSeconds\",\"type\":\"uint256\"}],\"name\":\"createPool\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"getApproved\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"}],\"name\":\"isApprovedForAll\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"ownerOf\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"safeTransferFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"safeTransferFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"setApprovalForAll\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"symbol\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"tokenByIndex\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"tokenOfOwnerByIndex\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"tokenURI\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"poolID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"newAdministrator\",\"type\":\"address\"}],\"name\":\"transferPoolAdministration\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"poolID\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"changeTransferability\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"transferable\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"changeLockup\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"lockupSeconds\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"changeCooldown\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"cooldownSeconds\",\"type\":\"uint256\"}],\"name\":\"updatePoolConfiguration\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", + Bin: "0x60806040523480156200001157600080fd5b506040518060400160405280600c81526020017f47616d6537205374616b657200000000000000000000000000000000000000008152506040518060400160405280600881526020017f47375354414b455200000000000000000000000000000000000000000000000081525081600090816200008f91906200032c565b508060019081620000a191906200032c565b5050506001600a8190555062000413565b600081519050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806200013457607f821691505b6020821081036200014a5762000149620000ec565b5b50919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b600060088302620001b47fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8262000175565b620001c0868362000175565b95508019841693508086168417925050509392505050565b6000819050919050565b6000819050919050565b60006200020d620002076200020184620001d8565b620001e2565b620001d8565b9050919050565b6000819050919050565b6200022983620001ec565b62000241620002388262000214565b84845462000182565b825550505050565b600090565b6200025862000249565b620002658184846200021e565b505050565b5b818110156200028d57620002816000826200024e565b6001810190506200026b565b5050565b601f821115620002dc57620002a68162000150565b620002b18462000165565b81016020851015620002c1578190505b620002d9620002d08562000165565b8301826200026a565b50505b505050565b600082821c905092915050565b60006200030160001984600802620002e1565b1980831691505092915050565b60006200031c8383620002ee565b9150826002028217905092915050565b6200033782620000b2565b67ffffffffffffffff811115620003535762000352620000bd565b5b6200035f82546200011b565b6200036c82828562000291565b600060209050601f831160018114620003a457600084156200038f578287015190505b6200039b85826200030e565b8655506200040b565b601f198416620003b48662000150565b60005b82811015620003de57848901518255600182019150602085019450602081019050620003b7565b86831015620003fe5784890151620003fa601f891682620002ee565b8355505b6001600288020188555050505b505050505050565b61304680620004236000396000f3fe608060405234801561001057600080fd5b506004361061018d5760003560e01c806370a08231116100de578063a22cb46511610097578063c87b56dd11610071578063c87b56dd146104ae578063d2ba4409146104de578063e985e9c5146104fc578063f09e76a11461052c5761018d565b8063a22cb46514610458578063abd4ce7814610474578063b88d4fde146104925761018d565b806370a082311461036857806373caf0f71461039857806373dfccca146103ca57806377bd2e7814610400578063911e476c1461041e57806395d89b411461043a5761018d565b806323b872dd1161014b578063424b931111610125578063424b9311146102ce57806342842e0e146102ec5780634f6ccce7146103085780636352211e146103385761018d565b806323b872dd146102665780632f745c59146102825780633db26319146102b25761018d565b80627d0cec1461019257806301ffc9a7146101ae57806306fdde03146101de578063081812fc146101fc578063095ea7b31461022c57806318160ddd14610248575b600080fd5b6101ac60048036038101906101a7919061252e565b61054a565b005b6101c860048036038101906101c39190612628565b6106c7565b6040516101d59190612664565b60405180910390f35b6101e6610741565b6040516101f3919061270f565b60405180910390f35b61021660048036038101906102119190612731565b6107d3565b604051610223919061279f565b60405180910390f35b610246600480360381019061024191906127e6565b6107ef565b005b610250610805565b60405161025d9190612835565b60405180910390f35b610280600480360381019061027b9190612850565b610812565b005b61029c600480360381019061029791906127e6565b610914565b6040516102a99190612835565b60405180910390f35b6102cc60048036038101906102c791906128a3565b6109bd565b005b6102d6610b11565b6040516102e39190612835565b60405180910390f35b61030660048036038101906103019190612850565b610b17565b005b610322600480360381019061031d9190612731565b610b37565b60405161032f9190612835565b60405180910390f35b610352600480360381019061034d9190612731565b610bad565b60405161035f919061279f565b60405180910390f35b610382600480360381019061037d91906128e3565b610bbf565b60405161038f9190612835565b60405180910390f35b6103b260048036038101906103ad9190612731565b610c79565b6040516103c193929190612933565b60405180910390f35b6103e460048036038101906103df9190612731565b610cb7565b6040516103f7979695949392919061296a565b60405180910390f35b610408610d46565b6040516104159190612835565b60405180910390f35b610438600480360381019061043391906129d9565b610d4b565b005b61044261118c565b60405161044f919061270f565b60405180910390f35b610472600480360381019061046d9190612a66565b61121e565b005b61047c611234565b6040516104899190612835565b60405180910390f35b6104ac60048036038101906104a79190612bdb565b61123a565b005b6104c860048036038101906104c39190612731565b611257565b6040516104d5919061270f565b60405180910390f35b6104e66112c0565b6040516104f39190612835565b60405180910390f35b61051660048036038101906105119190612c5e565b6112c5565b6040516105239190612664565b60405180910390f35b610534611359565b6040516105419190612835565b60405180910390f35b6000600c600089815260200190815260200160002090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146105ea576040517f29f9fc8100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b861561060d57858160040160006101000a81548160ff0219169083151502179055505b841561061d578381600501819055505b821561062d578181600601819055505b8060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16887f8587d3b7f5e8e73d0f5be513ce84b6c7c9497e221295d831f57ba7ecc36589b58360040160009054906101000a900460ff16846005015485600601546040516106b593929190612c9e565b60405180910390a35050505050505050565b60007f780e9d63000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916148061073a57506107398261135f565b5b9050919050565b60606000805461075090612d04565b80601f016020809104026020016040519081016040528092919081815260200182805461077c90612d04565b80156107c95780601f1061079e576101008083540402835291602001916107c9565b820191906000526020600020905b8154815290600101906020018083116107ac57829003601f168201915b5050505050905090565b60006107de82611441565b506107e8826114c9565b9050919050565b61080182826107fc611506565b61150e565b5050565b6000600880549050905090565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036108845760006040517f64a0ae9200000000000000000000000000000000000000000000000000000000815260040161087b919061279f565b60405180910390fd5b60006108988383610893611506565b611520565b90508373ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161461090e578382826040517f64283d7b00000000000000000000000000000000000000000000000000000000815260040161090593929190612d35565b60405180910390fd5b50505050565b600061091f83610bbf565b82106109645782826040517fa57d13dc00000000000000000000000000000000000000000000000000000000815260040161095b929190612d6c565b60405180910390fd5b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600083815260200190815260200160002054905092915050565b6000600c600084815260200190815260200160002090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610a5d576040517f29f9fc8100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b818160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff16837f8587d3b7f5e8e73d0f5be513ce84b6c7c9497e221295d831f57ba7ecc36589b58360040160009054906101000a900460ff1684600501548560060154604051610b0493929190612c9e565b60405180910390a3505050565b600b5481565b610b328383836040518060200160405280600081525061123a565b505050565b6000610b41610805565b8210610b87576000826040517fa57d13dc000000000000000000000000000000000000000000000000000000008152600401610b7e929190612d6c565b60405180910390fd5b60088281548110610b9b57610b9a612d95565b5b90600052602060002001549050919050565b6000610bb882611441565b9050919050565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603610c325760006040517f89c62b64000000000000000000000000000000000000000000000000000000008152600401610c29919061279f565b60405180910390fd5b600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600d6020528060005260406000206000915090508060000154908060010154908060020160009054906101000a900467ffffffffffffffff16905083565b600c6020528060005260406000206000915090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060010154908060020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060030154908060040160009054906101000a900460ff16908060050154908060060154905087565b600181565b60018603610dcc57600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16141580610d90575060008414155b15610dc7576040517fc52a9bd300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610f76565b60148603610e4c57600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161480610e10575060008414155b15610e47576040517fc52a9bd300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610f75565b6102d18603610ecd57600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161480610e91575060008414155b15610ec8576040517fc52a9bd300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610f74565b6104838603610f4157600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1603610f3c576040517fc52a9bd300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610f73565b6040517fa1e9dd9d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5b5b5b6040518060e001604052803373ffffffffffffffffffffffffffffffffffffffff1681526020018781526020018673ffffffffffffffffffffffffffffffffffffffff168152602001858152602001841515815260200183815260200182815250600c6000600b54815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506020820151816001015560408201518160020160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506060820151816003015560808201518160040160006101000a81548160ff02191690831515021790555060a0820151816005015560c082015181600601559050508473ffffffffffffffffffffffffffffffffffffffff1686600b547f36b06296d9441695787e7cbfc0b9cfc5deeeabec4406a3a90d30a222103c2dc88760405161110f9190612835565b60405180910390a43373ffffffffffffffffffffffffffffffffffffffff16600b547f8587d3b7f5e8e73d0f5be513ce84b6c7c9497e221295d831f57ba7ecc36589b585858560405161116493929190612c9e565b60405180910390a3600b600081548092919061117f90612df3565b9190505550505050505050565b60606001805461119b90612d04565b80601f01602080910402602001604051908101604052809291908181526020018280546111c790612d04565b80156112145780601f106111e957610100808354040283529160200191611214565b820191906000526020600020905b8154815290600101906020018083116111f757829003601f168201915b5050505050905090565b611230611229611506565b838361163d565b5050565b61048381565b611245848484610812565b611251848484846117ac565b50505050565b606061126282611441565b50600061126d611963565b9050600081511161128d57604051806020016040528060008152506112b8565b806112978461197a565b6040516020016112a8929190612e77565b6040516020818303038152906040525b915050919050565b601481565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b6102d181565b60007f80ac58cd000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916148061142a57507f5b5e139f000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b8061143a575061143982611a48565b5b9050919050565b60008061144d83611ab2565b9050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036114c057826040517f7e2732890000000000000000000000000000000000000000000000000000000081526004016114b79190612835565b60405180910390fd5b80915050919050565b60006004600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b600033905090565b61151b8383836001611aef565b505050565b60008061152e858585611cb4565b9050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036115725761156d84611ece565b6115b1565b8473ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16146115b0576115af8185611f17565b5b5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16036115f3576115ee84612078565b611632565b8473ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614611631576116308585612149565b5b5b809150509392505050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036116ae57816040517f5b08ba180000000000000000000000000000000000000000000000000000000081526004016116a5919061279f565b60405180910390fd5b80600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c318360405161179f9190612664565b60405180910390a3505050565b60008373ffffffffffffffffffffffffffffffffffffffff163b111561195d578273ffffffffffffffffffffffffffffffffffffffff1663150b7a026117f0611506565b8685856040518563ffffffff1660e01b81526004016118129493929190612ef0565b6020604051808303816000875af192505050801561184e57506040513d601f19601f8201168201806040525081019061184b9190612f51565b60015b6118d2573d806000811461187e576040519150601f19603f3d011682016040523d82523d6000602084013e611883565b606091505b5060008151036118ca57836040517f64a0ae920000000000000000000000000000000000000000000000000000000081526004016118c1919061279f565b60405180910390fd5b805181602001fd5b63150b7a0260e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161461195b57836040517f64a0ae92000000000000000000000000000000000000000000000000000000008152600401611952919061279f565b60405180910390fd5b505b50505050565b606060405180602001604052806000815250905090565b606060006001611989846121d4565b01905060008167ffffffffffffffff8111156119a8576119a7612ab0565b5b6040519080825280601f01601f1916602001820160405280156119da5781602001600182028036833780820191505090505b509050600082602001820190505b600115611a3d578080600190039150507f3031323334353637383961626364656600000000000000000000000000000000600a86061a8153600a8581611a3157611a30612f7e565b5b049450600085036119e8575b819350505050919050565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b60006002600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b8080611b285750600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611c5c576000611b3884611441565b9050600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611ba357508273ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614155b8015611bb65750611bb481846112c5565b155b15611bf857826040517fa9fbf51f000000000000000000000000000000000000000000000000000000008152600401611bef919061279f565b60405180910390fd5b8115611c5a57838573ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45b505b836004600085815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050505050565b600080611cc084611ab2565b9050600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614611d0257611d01818486612327565b5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614611d9357611d44600085600080611aef565b6001600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055505b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614611e16576001600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055505b846002600086815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550838573ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4809150509392505050565b6008805490506009600083815260200190815260200160002081905550600881908060018154018082558091505060019003906000526020600020016000909190919091505550565b6000611f2283610bbf565b9050600060076000848152602001908152602001600020549050818114612007576000600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600084815260200190815260200160002054905080600660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600084815260200190815260200160002081905550816007600083815260200190815260200160002081905550505b6007600084815260200190815260200160002060009055600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008381526020019081526020016000206000905550505050565b6000600160088054905061208c9190612fad565b90506000600960008481526020019081526020016000205490506000600883815481106120bc576120bb612d95565b5b9060005260206000200154905080600883815481106120de576120dd612d95565b5b90600052602060002001819055508160096000838152602001908152602001600020819055506009600085815260200190815260200160002060009055600880548061212d5761212c612fe1565b5b6001900381819060005260206000200160009055905550505050565b6000600161215684610bbf565b6121609190612fad565b905081600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600083815260200190815260200160002081905550806007600084815260200190815260200160002081905550505050565b600080600090507a184f03e93ff9f4daa797ed6e38ed64bf6a1f0100000000000000008310612232577a184f03e93ff9f4daa797ed6e38ed64bf6a1f010000000000000000838161222857612227612f7e565b5b0492506040810190505b6d04ee2d6d415b85acef8100000000831061226f576d04ee2d6d415b85acef8100000000838161226557612264612f7e565b5b0492506020810190505b662386f26fc10000831061229e57662386f26fc10000838161229457612293612f7e565b5b0492506010810190505b6305f5e10083106122c7576305f5e10083816122bd576122bc612f7e565b5b0492506008810190505b61271083106122ec5761271083816122e2576122e1612f7e565b5b0492506004810190505b6064831061230f576064838161230557612304612f7e565b5b0492506002810190505b600a831061231e576001810190505b80915050919050565b6123328383836123eb565b6123e657600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036123a757806040517f7e27328900000000000000000000000000000000000000000000000000000000815260040161239e9190612835565b60405180910390fd5b81816040517f177e802f0000000000000000000000000000000000000000000000000000000081526004016123dd929190612d6c565b60405180910390fd5b505050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156124a357508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161480612464575061246384846112c5565b5b806124a257508273ffffffffffffffffffffffffffffffffffffffff1661248a836114c9565b73ffffffffffffffffffffffffffffffffffffffff16145b5b90509392505050565b6000604051905090565b600080fd5b600080fd5b6000819050919050565b6124d3816124c0565b81146124de57600080fd5b50565b6000813590506124f0816124ca565b92915050565b60008115159050919050565b61250b816124f6565b811461251657600080fd5b50565b60008135905061252881612502565b92915050565b600080600080600080600060e0888a03121561254d5761254c6124b6565b5b600061255b8a828b016124e1565b975050602061256c8a828b01612519565b965050604061257d8a828b01612519565b955050606061258e8a828b01612519565b945050608061259f8a828b016124e1565b93505060a06125b08a828b01612519565b92505060c06125c18a828b016124e1565b91505092959891949750929550565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b612605816125d0565b811461261057600080fd5b50565b600081359050612622816125fc565b92915050565b60006020828403121561263e5761263d6124b6565b5b600061264c84828501612613565b91505092915050565b61265e816124f6565b82525050565b60006020820190506126796000830184612655565b92915050565b600081519050919050565b600082825260208201905092915050565b60005b838110156126b957808201518184015260208101905061269e565b60008484015250505050565b6000601f19601f8301169050919050565b60006126e18261267f565b6126eb818561268a565b93506126fb81856020860161269b565b612704816126c5565b840191505092915050565b6000602082019050818103600083015261272981846126d6565b905092915050565b600060208284031215612747576127466124b6565b5b6000612755848285016124e1565b91505092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006127898261275e565b9050919050565b6127998161277e565b82525050565b60006020820190506127b46000830184612790565b92915050565b6127c38161277e565b81146127ce57600080fd5b50565b6000813590506127e0816127ba565b92915050565b600080604083850312156127fd576127fc6124b6565b5b600061280b858286016127d1565b925050602061281c858286016124e1565b9150509250929050565b61282f816124c0565b82525050565b600060208201905061284a6000830184612826565b92915050565b600080600060608486031215612869576128686124b6565b5b6000612877868287016127d1565b9350506020612888868287016127d1565b9250506040612899868287016124e1565b9150509250925092565b600080604083850312156128ba576128b96124b6565b5b60006128c8858286016124e1565b92505060206128d9858286016127d1565b9150509250929050565b6000602082840312156128f9576128f86124b6565b5b6000612907848285016127d1565b91505092915050565b600067ffffffffffffffff82169050919050565b61292d81612910565b82525050565b60006060820190506129486000830186612826565b6129556020830185612826565b6129626040830184612924565b949350505050565b600060e08201905061297f600083018a612790565b61298c6020830189612826565b6129996040830188612790565b6129a66060830187612826565b6129b36080830186612655565b6129c060a0830185612826565b6129cd60c0830184612826565b98975050505050505050565b60008060008060008060c087890312156129f6576129f56124b6565b5b6000612a0489828a016124e1565b9650506020612a1589828a016127d1565b9550506040612a2689828a016124e1565b9450506060612a3789828a01612519565b9350506080612a4889828a016124e1565b92505060a0612a5989828a016124e1565b9150509295509295509295565b60008060408385031215612a7d57612a7c6124b6565b5b6000612a8b858286016127d1565b9250506020612a9c85828601612519565b9150509250929050565b600080fd5b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b612ae8826126c5565b810181811067ffffffffffffffff82111715612b0757612b06612ab0565b5b80604052505050565b6000612b1a6124ac565b9050612b268282612adf565b919050565b600067ffffffffffffffff821115612b4657612b45612ab0565b5b612b4f826126c5565b9050602081019050919050565b82818337600083830152505050565b6000612b7e612b7984612b2b565b612b10565b905082815260208101848484011115612b9a57612b99612aab565b5b612ba5848285612b5c565b509392505050565b600082601f830112612bc257612bc1612aa6565b5b8135612bd2848260208601612b6b565b91505092915050565b60008060008060808587031215612bf557612bf46124b6565b5b6000612c03878288016127d1565b9450506020612c14878288016127d1565b9350506040612c25878288016124e1565b925050606085013567ffffffffffffffff811115612c4657612c456124bb565b5b612c5287828801612bad565b91505092959194509250565b60008060408385031215612c7557612c746124b6565b5b6000612c83858286016127d1565b9250506020612c94858286016127d1565b9150509250929050565b6000606082019050612cb36000830186612655565b612cc06020830185612826565b612ccd6040830184612826565b949350505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60006002820490506001821680612d1c57607f821691505b602082108103612d2f57612d2e612cd5565b5b50919050565b6000606082019050612d4a6000830186612790565b612d576020830185612826565b612d646040830184612790565b949350505050565b6000604082019050612d816000830185612790565b612d8e6020830184612826565b9392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000612dfe826124c0565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203612e3057612e2f612dc4565b5b600182019050919050565b600081905092915050565b6000612e518261267f565b612e5b8185612e3b565b9350612e6b81856020860161269b565b80840191505092915050565b6000612e838285612e46565b9150612e8f8284612e46565b91508190509392505050565b600081519050919050565b600082825260208201905092915050565b6000612ec282612e9b565b612ecc8185612ea6565b9350612edc81856020860161269b565b612ee5816126c5565b840191505092915050565b6000608082019050612f056000830187612790565b612f126020830186612790565b612f1f6040830185612826565b8181036060830152612f318184612eb7565b905095945050505050565b600081519050612f4b816125fc565b92915050565b600060208284031215612f6757612f666124b6565b5b6000612f7584828501612f3c565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000612fb8826124c0565b9150612fc3836124c0565b9250828203905081811115612fdb57612fda612dc4565b5b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fdfea264697066735822122033a3a5e693b8325d81cf7397b8e40302b4818fb263e8625f7c8e229a8c2c62dc64736f6c63430008180033", +} + +// StakerABI is the input ABI used to generate the binding from. +// Deprecated: Use StakerMetaData.ABI instead. +var StakerABI = StakerMetaData.ABI + +// StakerBin is the compiled bytecode used for deploying new contracts. +// Deprecated: Use StakerMetaData.Bin instead. +var StakerBin = StakerMetaData.Bin + +// DeployStaker deploys a new Ethereum contract, binding an instance of Staker to it. +func DeployStaker(auth *bind.TransactOpts, backend bind.ContractBackend) (common.Address, *types.Transaction, *Staker, error) { + parsed, err := StakerMetaData.GetAbi() + if err != nil { + return common.Address{}, nil, nil, err + } + if parsed == nil { + return common.Address{}, nil, nil, errors.New("GetABI returned nil") + } + + address, tx, contract, err := bind.DeployContract(auth, *parsed, common.FromHex(StakerBin), backend) + if err != nil { + return common.Address{}, nil, nil, err + } + return address, tx, &Staker{StakerCaller: StakerCaller{contract: contract}, StakerTransactor: StakerTransactor{contract: contract}, StakerFilterer: StakerFilterer{contract: contract}}, nil +} + +// Staker is an auto generated Go binding around an Ethereum contract. +type Staker struct { + StakerCaller // Read-only binding to the contract + StakerTransactor // Write-only binding to the contract + StakerFilterer // Log filterer for contract events +} + +// StakerCaller is an auto generated read-only Go binding around an Ethereum contract. +type StakerCaller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// StakerTransactor is an auto generated write-only Go binding around an Ethereum contract. +type StakerTransactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// StakerFilterer is an auto generated log filtering Go binding around an Ethereum contract events. +type StakerFilterer struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// StakerSession is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type StakerSession struct { + Contract *Staker // 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 +} + +// StakerCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type StakerCallerSession struct { + Contract *StakerCaller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// StakerTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type StakerTransactorSession struct { + Contract *StakerTransactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// StakerRaw is an auto generated low-level Go binding around an Ethereum contract. +type StakerRaw struct { + Contract *Staker // Generic contract binding to access the raw methods on +} + +// StakerCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type StakerCallerRaw struct { + Contract *StakerCaller // Generic read-only contract binding to access the raw methods on +} + +// StakerTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type StakerTransactorRaw struct { + Contract *StakerTransactor // Generic write-only contract binding to access the raw methods on +} + +// NewStaker creates a new instance of Staker, bound to a specific deployed contract. +func NewStaker(address common.Address, backend bind.ContractBackend) (*Staker, error) { + contract, err := bindStaker(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &Staker{StakerCaller: StakerCaller{contract: contract}, StakerTransactor: StakerTransactor{contract: contract}, StakerFilterer: StakerFilterer{contract: contract}}, nil +} + +// NewStakerCaller creates a new read-only instance of Staker, bound to a specific deployed contract. +func NewStakerCaller(address common.Address, caller bind.ContractCaller) (*StakerCaller, error) { + contract, err := bindStaker(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &StakerCaller{contract: contract}, nil +} + +// NewStakerTransactor creates a new write-only instance of Staker, bound to a specific deployed contract. +func NewStakerTransactor(address common.Address, transactor bind.ContractTransactor) (*StakerTransactor, error) { + contract, err := bindStaker(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &StakerTransactor{contract: contract}, nil +} + +// NewStakerFilterer creates a new log filterer instance of Staker, bound to a specific deployed contract. +func NewStakerFilterer(address common.Address, filterer bind.ContractFilterer) (*StakerFilterer, error) { + contract, err := bindStaker(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &StakerFilterer{contract: contract}, nil +} + +// bindStaker binds a generic wrapper to an already deployed contract. +func bindStaker(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := StakerMetaData.GetAbi() + if err != nil { + return nil, err + } + return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_Staker *StakerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _Staker.Contract.StakerCaller.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 (_Staker *StakerRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Staker.Contract.StakerTransactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_Staker *StakerRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _Staker.Contract.StakerTransactor.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 (_Staker *StakerCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _Staker.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 (_Staker *StakerTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Staker.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_Staker *StakerTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _Staker.Contract.contract.Transact(opts, method, params...) +} + +// ERC1155TOKENTYPE is a free data retrieval call binding the contract method 0xabd4ce78. +// +// Solidity: function ERC1155_TOKEN_TYPE() view returns(uint256) +func (_Staker *StakerCaller) ERC1155TOKENTYPE(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _Staker.contract.Call(opts, &out, "ERC1155_TOKEN_TYPE") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// ERC1155TOKENTYPE is a free data retrieval call binding the contract method 0xabd4ce78. +// +// Solidity: function ERC1155_TOKEN_TYPE() view returns(uint256) +func (_Staker *StakerSession) ERC1155TOKENTYPE() (*big.Int, error) { + return _Staker.Contract.ERC1155TOKENTYPE(&_Staker.CallOpts) +} + +// ERC1155TOKENTYPE is a free data retrieval call binding the contract method 0xabd4ce78. +// +// Solidity: function ERC1155_TOKEN_TYPE() view returns(uint256) +func (_Staker *StakerCallerSession) ERC1155TOKENTYPE() (*big.Int, error) { + return _Staker.Contract.ERC1155TOKENTYPE(&_Staker.CallOpts) +} + +// ERC20TOKENTYPE is a free data retrieval call binding the contract method 0xd2ba4409. +// +// Solidity: function ERC20_TOKEN_TYPE() view returns(uint256) +func (_Staker *StakerCaller) ERC20TOKENTYPE(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _Staker.contract.Call(opts, &out, "ERC20_TOKEN_TYPE") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// ERC20TOKENTYPE is a free data retrieval call binding the contract method 0xd2ba4409. +// +// Solidity: function ERC20_TOKEN_TYPE() view returns(uint256) +func (_Staker *StakerSession) ERC20TOKENTYPE() (*big.Int, error) { + return _Staker.Contract.ERC20TOKENTYPE(&_Staker.CallOpts) +} + +// ERC20TOKENTYPE is a free data retrieval call binding the contract method 0xd2ba4409. +// +// Solidity: function ERC20_TOKEN_TYPE() view returns(uint256) +func (_Staker *StakerCallerSession) ERC20TOKENTYPE() (*big.Int, error) { + return _Staker.Contract.ERC20TOKENTYPE(&_Staker.CallOpts) +} + +// ERC721TOKENTYPE is a free data retrieval call binding the contract method 0xf09e76a1. +// +// Solidity: function ERC721_TOKEN_TYPE() view returns(uint256) +func (_Staker *StakerCaller) ERC721TOKENTYPE(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _Staker.contract.Call(opts, &out, "ERC721_TOKEN_TYPE") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// ERC721TOKENTYPE is a free data retrieval call binding the contract method 0xf09e76a1. +// +// Solidity: function ERC721_TOKEN_TYPE() view returns(uint256) +func (_Staker *StakerSession) ERC721TOKENTYPE() (*big.Int, error) { + return _Staker.Contract.ERC721TOKENTYPE(&_Staker.CallOpts) +} + +// ERC721TOKENTYPE is a free data retrieval call binding the contract method 0xf09e76a1. +// +// Solidity: function ERC721_TOKEN_TYPE() view returns(uint256) +func (_Staker *StakerCallerSession) ERC721TOKENTYPE() (*big.Int, error) { + return _Staker.Contract.ERC721TOKENTYPE(&_Staker.CallOpts) +} + +// NATIVETOKENTYPE is a free data retrieval call binding the contract method 0x77bd2e78. +// +// Solidity: function NATIVE_TOKEN_TYPE() view returns(uint256) +func (_Staker *StakerCaller) NATIVETOKENTYPE(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _Staker.contract.Call(opts, &out, "NATIVE_TOKEN_TYPE") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// NATIVETOKENTYPE is a free data retrieval call binding the contract method 0x77bd2e78. +// +// Solidity: function NATIVE_TOKEN_TYPE() view returns(uint256) +func (_Staker *StakerSession) NATIVETOKENTYPE() (*big.Int, error) { + return _Staker.Contract.NATIVETOKENTYPE(&_Staker.CallOpts) +} + +// NATIVETOKENTYPE is a free data retrieval call binding the contract method 0x77bd2e78. +// +// Solidity: function NATIVE_TOKEN_TYPE() view returns(uint256) +func (_Staker *StakerCallerSession) NATIVETOKENTYPE() (*big.Int, error) { + return _Staker.Contract.NATIVETOKENTYPE(&_Staker.CallOpts) +} + +// Pools is a free data retrieval call binding the contract method 0x73dfccca. +// +// Solidity: function Pools(uint256 ) view returns(address administrator, uint256 tokenType, address tokenAddress, uint256 tokenID, bool transferable, uint256 lockupSeconds, uint256 cooldownSeconds) +func (_Staker *StakerCaller) Pools(opts *bind.CallOpts, arg0 *big.Int) (struct { + Administrator common.Address + TokenType *big.Int + TokenAddress common.Address + TokenID *big.Int + Transferable bool + LockupSeconds *big.Int + CooldownSeconds *big.Int +}, error) { + var out []interface{} + err := _Staker.contract.Call(opts, &out, "Pools", arg0) + + outstruct := new(struct { + Administrator common.Address + TokenType *big.Int + TokenAddress common.Address + TokenID *big.Int + Transferable bool + LockupSeconds *big.Int + CooldownSeconds *big.Int + }) + if err != nil { + return *outstruct, err + } + + outstruct.Administrator = *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + outstruct.TokenType = *abi.ConvertType(out[1], new(*big.Int)).(**big.Int) + outstruct.TokenAddress = *abi.ConvertType(out[2], new(common.Address)).(*common.Address) + outstruct.TokenID = *abi.ConvertType(out[3], new(*big.Int)).(**big.Int) + outstruct.Transferable = *abi.ConvertType(out[4], new(bool)).(*bool) + outstruct.LockupSeconds = *abi.ConvertType(out[5], new(*big.Int)).(**big.Int) + outstruct.CooldownSeconds = *abi.ConvertType(out[6], new(*big.Int)).(**big.Int) + + return *outstruct, err + +} + +// Pools is a free data retrieval call binding the contract method 0x73dfccca. +// +// Solidity: function Pools(uint256 ) view returns(address administrator, uint256 tokenType, address tokenAddress, uint256 tokenID, bool transferable, uint256 lockupSeconds, uint256 cooldownSeconds) +func (_Staker *StakerSession) Pools(arg0 *big.Int) (struct { + Administrator common.Address + TokenType *big.Int + TokenAddress common.Address + TokenID *big.Int + Transferable bool + LockupSeconds *big.Int + CooldownSeconds *big.Int +}, error) { + return _Staker.Contract.Pools(&_Staker.CallOpts, arg0) +} + +// Pools is a free data retrieval call binding the contract method 0x73dfccca. +// +// Solidity: function Pools(uint256 ) view returns(address administrator, uint256 tokenType, address tokenAddress, uint256 tokenID, bool transferable, uint256 lockupSeconds, uint256 cooldownSeconds) +func (_Staker *StakerCallerSession) Pools(arg0 *big.Int) (struct { + Administrator common.Address + TokenType *big.Int + TokenAddress common.Address + TokenID *big.Int + Transferable bool + LockupSeconds *big.Int + CooldownSeconds *big.Int +}, error) { + return _Staker.Contract.Pools(&_Staker.CallOpts, arg0) +} + +// Positions is a free data retrieval call binding the contract method 0x73caf0f7. +// +// Solidity: function Positions(uint256 ) view returns(uint256 poolID, uint256 amount, uint64 stakeTimestamp) +func (_Staker *StakerCaller) Positions(opts *bind.CallOpts, arg0 *big.Int) (struct { + PoolID *big.Int + Amount *big.Int + StakeTimestamp uint64 +}, error) { + var out []interface{} + err := _Staker.contract.Call(opts, &out, "Positions", arg0) + + outstruct := new(struct { + PoolID *big.Int + Amount *big.Int + StakeTimestamp uint64 + }) + if err != nil { + return *outstruct, err + } + + outstruct.PoolID = *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + outstruct.Amount = *abi.ConvertType(out[1], new(*big.Int)).(**big.Int) + outstruct.StakeTimestamp = *abi.ConvertType(out[2], new(uint64)).(*uint64) + + return *outstruct, err + +} + +// Positions is a free data retrieval call binding the contract method 0x73caf0f7. +// +// Solidity: function Positions(uint256 ) view returns(uint256 poolID, uint256 amount, uint64 stakeTimestamp) +func (_Staker *StakerSession) Positions(arg0 *big.Int) (struct { + PoolID *big.Int + Amount *big.Int + StakeTimestamp uint64 +}, error) { + return _Staker.Contract.Positions(&_Staker.CallOpts, arg0) +} + +// Positions is a free data retrieval call binding the contract method 0x73caf0f7. +// +// Solidity: function Positions(uint256 ) view returns(uint256 poolID, uint256 amount, uint64 stakeTimestamp) +func (_Staker *StakerCallerSession) Positions(arg0 *big.Int) (struct { + PoolID *big.Int + Amount *big.Int + StakeTimestamp uint64 +}, error) { + return _Staker.Contract.Positions(&_Staker.CallOpts, arg0) +} + +// TotalPools is a free data retrieval call binding the contract method 0x424b9311. +// +// Solidity: function TotalPools() view returns(uint256) +func (_Staker *StakerCaller) TotalPools(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _Staker.contract.Call(opts, &out, "TotalPools") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// TotalPools is a free data retrieval call binding the contract method 0x424b9311. +// +// Solidity: function TotalPools() view returns(uint256) +func (_Staker *StakerSession) TotalPools() (*big.Int, error) { + return _Staker.Contract.TotalPools(&_Staker.CallOpts) +} + +// TotalPools is a free data retrieval call binding the contract method 0x424b9311. +// +// Solidity: function TotalPools() view returns(uint256) +func (_Staker *StakerCallerSession) TotalPools() (*big.Int, error) { + return _Staker.Contract.TotalPools(&_Staker.CallOpts) +} + +// BalanceOf is a free data retrieval call binding the contract method 0x70a08231. +// +// Solidity: function balanceOf(address owner) view returns(uint256) +func (_Staker *StakerCaller) BalanceOf(opts *bind.CallOpts, owner common.Address) (*big.Int, error) { + var out []interface{} + err := _Staker.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 (_Staker *StakerSession) BalanceOf(owner common.Address) (*big.Int, error) { + return _Staker.Contract.BalanceOf(&_Staker.CallOpts, owner) +} + +// BalanceOf is a free data retrieval call binding the contract method 0x70a08231. +// +// Solidity: function balanceOf(address owner) view returns(uint256) +func (_Staker *StakerCallerSession) BalanceOf(owner common.Address) (*big.Int, error) { + return _Staker.Contract.BalanceOf(&_Staker.CallOpts, owner) +} + +// GetApproved is a free data retrieval call binding the contract method 0x081812fc. +// +// Solidity: function getApproved(uint256 tokenId) view returns(address) +func (_Staker *StakerCaller) GetApproved(opts *bind.CallOpts, tokenId *big.Int) (common.Address, error) { + var out []interface{} + err := _Staker.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 (_Staker *StakerSession) GetApproved(tokenId *big.Int) (common.Address, error) { + return _Staker.Contract.GetApproved(&_Staker.CallOpts, tokenId) +} + +// GetApproved is a free data retrieval call binding the contract method 0x081812fc. +// +// Solidity: function getApproved(uint256 tokenId) view returns(address) +func (_Staker *StakerCallerSession) GetApproved(tokenId *big.Int) (common.Address, error) { + return _Staker.Contract.GetApproved(&_Staker.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 (_Staker *StakerCaller) IsApprovedForAll(opts *bind.CallOpts, owner common.Address, operator common.Address) (bool, error) { + var out []interface{} + err := _Staker.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 (_Staker *StakerSession) IsApprovedForAll(owner common.Address, operator common.Address) (bool, error) { + return _Staker.Contract.IsApprovedForAll(&_Staker.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 (_Staker *StakerCallerSession) IsApprovedForAll(owner common.Address, operator common.Address) (bool, error) { + return _Staker.Contract.IsApprovedForAll(&_Staker.CallOpts, owner, operator) +} + +// Name is a free data retrieval call binding the contract method 0x06fdde03. +// +// Solidity: function name() view returns(string) +func (_Staker *StakerCaller) Name(opts *bind.CallOpts) (string, error) { + var out []interface{} + err := _Staker.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 (_Staker *StakerSession) Name() (string, error) { + return _Staker.Contract.Name(&_Staker.CallOpts) +} + +// Name is a free data retrieval call binding the contract method 0x06fdde03. +// +// Solidity: function name() view returns(string) +func (_Staker *StakerCallerSession) Name() (string, error) { + return _Staker.Contract.Name(&_Staker.CallOpts) +} + +// OwnerOf is a free data retrieval call binding the contract method 0x6352211e. +// +// Solidity: function ownerOf(uint256 tokenId) view returns(address) +func (_Staker *StakerCaller) OwnerOf(opts *bind.CallOpts, tokenId *big.Int) (common.Address, error) { + var out []interface{} + err := _Staker.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 (_Staker *StakerSession) OwnerOf(tokenId *big.Int) (common.Address, error) { + return _Staker.Contract.OwnerOf(&_Staker.CallOpts, tokenId) +} + +// OwnerOf is a free data retrieval call binding the contract method 0x6352211e. +// +// Solidity: function ownerOf(uint256 tokenId) view returns(address) +func (_Staker *StakerCallerSession) OwnerOf(tokenId *big.Int) (common.Address, error) { + return _Staker.Contract.OwnerOf(&_Staker.CallOpts, tokenId) +} + +// SupportsInterface is a free data retrieval call binding the contract method 0x01ffc9a7. +// +// Solidity: function supportsInterface(bytes4 interfaceId) view returns(bool) +func (_Staker *StakerCaller) SupportsInterface(opts *bind.CallOpts, interfaceId [4]byte) (bool, error) { + var out []interface{} + err := _Staker.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 (_Staker *StakerSession) SupportsInterface(interfaceId [4]byte) (bool, error) { + return _Staker.Contract.SupportsInterface(&_Staker.CallOpts, interfaceId) +} + +// SupportsInterface is a free data retrieval call binding the contract method 0x01ffc9a7. +// +// Solidity: function supportsInterface(bytes4 interfaceId) view returns(bool) +func (_Staker *StakerCallerSession) SupportsInterface(interfaceId [4]byte) (bool, error) { + return _Staker.Contract.SupportsInterface(&_Staker.CallOpts, interfaceId) +} + +// Symbol is a free data retrieval call binding the contract method 0x95d89b41. +// +// Solidity: function symbol() view returns(string) +func (_Staker *StakerCaller) Symbol(opts *bind.CallOpts) (string, error) { + var out []interface{} + err := _Staker.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 (_Staker *StakerSession) Symbol() (string, error) { + return _Staker.Contract.Symbol(&_Staker.CallOpts) +} + +// Symbol is a free data retrieval call binding the contract method 0x95d89b41. +// +// Solidity: function symbol() view returns(string) +func (_Staker *StakerCallerSession) Symbol() (string, error) { + return _Staker.Contract.Symbol(&_Staker.CallOpts) +} + +// TokenByIndex is a free data retrieval call binding the contract method 0x4f6ccce7. +// +// Solidity: function tokenByIndex(uint256 index) view returns(uint256) +func (_Staker *StakerCaller) TokenByIndex(opts *bind.CallOpts, index *big.Int) (*big.Int, error) { + var out []interface{} + err := _Staker.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 (_Staker *StakerSession) TokenByIndex(index *big.Int) (*big.Int, error) { + return _Staker.Contract.TokenByIndex(&_Staker.CallOpts, index) +} + +// TokenByIndex is a free data retrieval call binding the contract method 0x4f6ccce7. +// +// Solidity: function tokenByIndex(uint256 index) view returns(uint256) +func (_Staker *StakerCallerSession) TokenByIndex(index *big.Int) (*big.Int, error) { + return _Staker.Contract.TokenByIndex(&_Staker.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 (_Staker *StakerCaller) TokenOfOwnerByIndex(opts *bind.CallOpts, owner common.Address, index *big.Int) (*big.Int, error) { + var out []interface{} + err := _Staker.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 (_Staker *StakerSession) TokenOfOwnerByIndex(owner common.Address, index *big.Int) (*big.Int, error) { + return _Staker.Contract.TokenOfOwnerByIndex(&_Staker.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 (_Staker *StakerCallerSession) TokenOfOwnerByIndex(owner common.Address, index *big.Int) (*big.Int, error) { + return _Staker.Contract.TokenOfOwnerByIndex(&_Staker.CallOpts, owner, index) +} + +// TokenURI is a free data retrieval call binding the contract method 0xc87b56dd. +// +// Solidity: function tokenURI(uint256 tokenId) view returns(string) +func (_Staker *StakerCaller) TokenURI(opts *bind.CallOpts, tokenId *big.Int) (string, error) { + var out []interface{} + err := _Staker.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 (_Staker *StakerSession) TokenURI(tokenId *big.Int) (string, error) { + return _Staker.Contract.TokenURI(&_Staker.CallOpts, tokenId) +} + +// TokenURI is a free data retrieval call binding the contract method 0xc87b56dd. +// +// Solidity: function tokenURI(uint256 tokenId) view returns(string) +func (_Staker *StakerCallerSession) TokenURI(tokenId *big.Int) (string, error) { + return _Staker.Contract.TokenURI(&_Staker.CallOpts, tokenId) +} + +// TotalSupply is a free data retrieval call binding the contract method 0x18160ddd. +// +// Solidity: function totalSupply() view returns(uint256) +func (_Staker *StakerCaller) TotalSupply(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _Staker.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 (_Staker *StakerSession) TotalSupply() (*big.Int, error) { + return _Staker.Contract.TotalSupply(&_Staker.CallOpts) +} + +// TotalSupply is a free data retrieval call binding the contract method 0x18160ddd. +// +// Solidity: function totalSupply() view returns(uint256) +func (_Staker *StakerCallerSession) TotalSupply() (*big.Int, error) { + return _Staker.Contract.TotalSupply(&_Staker.CallOpts) +} + +// Approve is a paid mutator transaction binding the contract method 0x095ea7b3. +// +// Solidity: function approve(address to, uint256 tokenId) returns() +func (_Staker *StakerTransactor) Approve(opts *bind.TransactOpts, to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _Staker.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 (_Staker *StakerSession) Approve(to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _Staker.Contract.Approve(&_Staker.TransactOpts, to, tokenId) +} + +// Approve is a paid mutator transaction binding the contract method 0x095ea7b3. +// +// Solidity: function approve(address to, uint256 tokenId) returns() +func (_Staker *StakerTransactorSession) Approve(to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _Staker.Contract.Approve(&_Staker.TransactOpts, to, tokenId) +} + +// CreatePool is a paid mutator transaction binding the contract method 0x911e476c. +// +// Solidity: function createPool(uint256 tokenType, address tokenAddress, uint256 tokenID, bool transferable, uint256 lockupSeconds, uint256 cooldownSeconds) returns() +func (_Staker *StakerTransactor) CreatePool(opts *bind.TransactOpts, tokenType *big.Int, tokenAddress common.Address, tokenID *big.Int, transferable bool, lockupSeconds *big.Int, cooldownSeconds *big.Int) (*types.Transaction, error) { + return _Staker.contract.Transact(opts, "createPool", tokenType, tokenAddress, tokenID, transferable, lockupSeconds, cooldownSeconds) +} + +// CreatePool is a paid mutator transaction binding the contract method 0x911e476c. +// +// Solidity: function createPool(uint256 tokenType, address tokenAddress, uint256 tokenID, bool transferable, uint256 lockupSeconds, uint256 cooldownSeconds) returns() +func (_Staker *StakerSession) CreatePool(tokenType *big.Int, tokenAddress common.Address, tokenID *big.Int, transferable bool, lockupSeconds *big.Int, cooldownSeconds *big.Int) (*types.Transaction, error) { + return _Staker.Contract.CreatePool(&_Staker.TransactOpts, tokenType, tokenAddress, tokenID, transferable, lockupSeconds, cooldownSeconds) +} + +// CreatePool is a paid mutator transaction binding the contract method 0x911e476c. +// +// Solidity: function createPool(uint256 tokenType, address tokenAddress, uint256 tokenID, bool transferable, uint256 lockupSeconds, uint256 cooldownSeconds) returns() +func (_Staker *StakerTransactorSession) CreatePool(tokenType *big.Int, tokenAddress common.Address, tokenID *big.Int, transferable bool, lockupSeconds *big.Int, cooldownSeconds *big.Int) (*types.Transaction, error) { + return _Staker.Contract.CreatePool(&_Staker.TransactOpts, tokenType, tokenAddress, tokenID, transferable, lockupSeconds, cooldownSeconds) +} + +// SafeTransferFrom is a paid mutator transaction binding the contract method 0x42842e0e. +// +// Solidity: function safeTransferFrom(address from, address to, uint256 tokenId) returns() +func (_Staker *StakerTransactor) SafeTransferFrom(opts *bind.TransactOpts, from common.Address, to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _Staker.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 (_Staker *StakerSession) SafeTransferFrom(from common.Address, to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _Staker.Contract.SafeTransferFrom(&_Staker.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 (_Staker *StakerTransactorSession) SafeTransferFrom(from common.Address, to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _Staker.Contract.SafeTransferFrom(&_Staker.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 (_Staker *StakerTransactor) SafeTransferFrom0(opts *bind.TransactOpts, from common.Address, to common.Address, tokenId *big.Int, data []byte) (*types.Transaction, error) { + return _Staker.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 (_Staker *StakerSession) SafeTransferFrom0(from common.Address, to common.Address, tokenId *big.Int, data []byte) (*types.Transaction, error) { + return _Staker.Contract.SafeTransferFrom0(&_Staker.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 (_Staker *StakerTransactorSession) SafeTransferFrom0(from common.Address, to common.Address, tokenId *big.Int, data []byte) (*types.Transaction, error) { + return _Staker.Contract.SafeTransferFrom0(&_Staker.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 (_Staker *StakerTransactor) SetApprovalForAll(opts *bind.TransactOpts, operator common.Address, approved bool) (*types.Transaction, error) { + return _Staker.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 (_Staker *StakerSession) SetApprovalForAll(operator common.Address, approved bool) (*types.Transaction, error) { + return _Staker.Contract.SetApprovalForAll(&_Staker.TransactOpts, operator, approved) +} + +// SetApprovalForAll is a paid mutator transaction binding the contract method 0xa22cb465. +// +// Solidity: function setApprovalForAll(address operator, bool approved) returns() +func (_Staker *StakerTransactorSession) SetApprovalForAll(operator common.Address, approved bool) (*types.Transaction, error) { + return _Staker.Contract.SetApprovalForAll(&_Staker.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 (_Staker *StakerTransactor) TransferFrom(opts *bind.TransactOpts, from common.Address, to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _Staker.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 (_Staker *StakerSession) TransferFrom(from common.Address, to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _Staker.Contract.TransferFrom(&_Staker.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 (_Staker *StakerTransactorSession) TransferFrom(from common.Address, to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _Staker.Contract.TransferFrom(&_Staker.TransactOpts, from, to, tokenId) +} + +// TransferPoolAdministration is a paid mutator transaction binding the contract method 0x3db26319. +// +// Solidity: function transferPoolAdministration(uint256 poolID, address newAdministrator) returns() +func (_Staker *StakerTransactor) TransferPoolAdministration(opts *bind.TransactOpts, poolID *big.Int, newAdministrator common.Address) (*types.Transaction, error) { + return _Staker.contract.Transact(opts, "transferPoolAdministration", poolID, newAdministrator) +} + +// TransferPoolAdministration is a paid mutator transaction binding the contract method 0x3db26319. +// +// Solidity: function transferPoolAdministration(uint256 poolID, address newAdministrator) returns() +func (_Staker *StakerSession) TransferPoolAdministration(poolID *big.Int, newAdministrator common.Address) (*types.Transaction, error) { + return _Staker.Contract.TransferPoolAdministration(&_Staker.TransactOpts, poolID, newAdministrator) +} + +// TransferPoolAdministration is a paid mutator transaction binding the contract method 0x3db26319. +// +// Solidity: function transferPoolAdministration(uint256 poolID, address newAdministrator) returns() +func (_Staker *StakerTransactorSession) TransferPoolAdministration(poolID *big.Int, newAdministrator common.Address) (*types.Transaction, error) { + return _Staker.Contract.TransferPoolAdministration(&_Staker.TransactOpts, poolID, newAdministrator) +} + +// UpdatePoolConfiguration is a paid mutator transaction binding the contract method 0x007d0cec. +// +// Solidity: function updatePoolConfiguration(uint256 poolID, bool changeTransferability, bool transferable, bool changeLockup, uint256 lockupSeconds, bool changeCooldown, uint256 cooldownSeconds) returns() +func (_Staker *StakerTransactor) UpdatePoolConfiguration(opts *bind.TransactOpts, poolID *big.Int, changeTransferability bool, transferable bool, changeLockup bool, lockupSeconds *big.Int, changeCooldown bool, cooldownSeconds *big.Int) (*types.Transaction, error) { + return _Staker.contract.Transact(opts, "updatePoolConfiguration", poolID, changeTransferability, transferable, changeLockup, lockupSeconds, changeCooldown, cooldownSeconds) +} + +// UpdatePoolConfiguration is a paid mutator transaction binding the contract method 0x007d0cec. +// +// Solidity: function updatePoolConfiguration(uint256 poolID, bool changeTransferability, bool transferable, bool changeLockup, uint256 lockupSeconds, bool changeCooldown, uint256 cooldownSeconds) returns() +func (_Staker *StakerSession) UpdatePoolConfiguration(poolID *big.Int, changeTransferability bool, transferable bool, changeLockup bool, lockupSeconds *big.Int, changeCooldown bool, cooldownSeconds *big.Int) (*types.Transaction, error) { + return _Staker.Contract.UpdatePoolConfiguration(&_Staker.TransactOpts, poolID, changeTransferability, transferable, changeLockup, lockupSeconds, changeCooldown, cooldownSeconds) +} + +// UpdatePoolConfiguration is a paid mutator transaction binding the contract method 0x007d0cec. +// +// Solidity: function updatePoolConfiguration(uint256 poolID, bool changeTransferability, bool transferable, bool changeLockup, uint256 lockupSeconds, bool changeCooldown, uint256 cooldownSeconds) returns() +func (_Staker *StakerTransactorSession) UpdatePoolConfiguration(poolID *big.Int, changeTransferability bool, transferable bool, changeLockup bool, lockupSeconds *big.Int, changeCooldown bool, cooldownSeconds *big.Int) (*types.Transaction, error) { + return _Staker.Contract.UpdatePoolConfiguration(&_Staker.TransactOpts, poolID, changeTransferability, transferable, changeLockup, lockupSeconds, changeCooldown, cooldownSeconds) +} + +// StakerApprovalIterator is returned from FilterApproval and is used to iterate over the raw logs and unpacked data for Approval events raised by the Staker contract. +type StakerApprovalIterator struct { + Event *StakerApproval // 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 *StakerApprovalIterator) 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(StakerApproval) + 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(StakerApproval) + 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 *StakerApprovalIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *StakerApprovalIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// StakerApproval represents a Approval event raised by the Staker contract. +type StakerApproval 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 (_Staker *StakerFilterer) FilterApproval(opts *bind.FilterOpts, owner []common.Address, approved []common.Address, tokenId []*big.Int) (*StakerApprovalIterator, 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 := _Staker.contract.FilterLogs(opts, "Approval", ownerRule, approvedRule, tokenIdRule) + if err != nil { + return nil, err + } + return &StakerApprovalIterator{contract: _Staker.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 (_Staker *StakerFilterer) WatchApproval(opts *bind.WatchOpts, sink chan<- *StakerApproval, 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 := _Staker.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(StakerApproval) + if err := _Staker.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 (_Staker *StakerFilterer) ParseApproval(log types.Log) (*StakerApproval, error) { + event := new(StakerApproval) + if err := _Staker.contract.UnpackLog(event, "Approval", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// StakerApprovalForAllIterator is returned from FilterApprovalForAll and is used to iterate over the raw logs and unpacked data for ApprovalForAll events raised by the Staker contract. +type StakerApprovalForAllIterator struct { + Event *StakerApprovalForAll // 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 *StakerApprovalForAllIterator) 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(StakerApprovalForAll) + 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(StakerApprovalForAll) + 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 *StakerApprovalForAllIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *StakerApprovalForAllIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// StakerApprovalForAll represents a ApprovalForAll event raised by the Staker contract. +type StakerApprovalForAll 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 (_Staker *StakerFilterer) FilterApprovalForAll(opts *bind.FilterOpts, owner []common.Address, operator []common.Address) (*StakerApprovalForAllIterator, 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 := _Staker.contract.FilterLogs(opts, "ApprovalForAll", ownerRule, operatorRule) + if err != nil { + return nil, err + } + return &StakerApprovalForAllIterator{contract: _Staker.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 (_Staker *StakerFilterer) WatchApprovalForAll(opts *bind.WatchOpts, sink chan<- *StakerApprovalForAll, 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 := _Staker.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(StakerApprovalForAll) + if err := _Staker.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 (_Staker *StakerFilterer) ParseApprovalForAll(log types.Log) (*StakerApprovalForAll, error) { + event := new(StakerApprovalForAll) + if err := _Staker.contract.UnpackLog(event, "ApprovalForAll", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// StakerStakingPoolConfiguredIterator is returned from FilterStakingPoolConfigured and is used to iterate over the raw logs and unpacked data for StakingPoolConfigured events raised by the Staker contract. +type StakerStakingPoolConfiguredIterator struct { + Event *StakerStakingPoolConfigured // 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 *StakerStakingPoolConfiguredIterator) 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(StakerStakingPoolConfigured) + 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(StakerStakingPoolConfigured) + 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 *StakerStakingPoolConfiguredIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *StakerStakingPoolConfiguredIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// StakerStakingPoolConfigured represents a StakingPoolConfigured event raised by the Staker contract. +type StakerStakingPoolConfigured struct { + PoolID *big.Int + Administrator common.Address + Transferable bool + LockupSeconds *big.Int + CooldownSeconds *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterStakingPoolConfigured is a free log retrieval operation binding the contract event 0x8587d3b7f5e8e73d0f5be513ce84b6c7c9497e221295d831f57ba7ecc36589b5. +// +// Solidity: event StakingPoolConfigured(uint256 indexed poolID, address indexed administrator, bool transferable, uint256 lockupSeconds, uint256 cooldownSeconds) +func (_Staker *StakerFilterer) FilterStakingPoolConfigured(opts *bind.FilterOpts, poolID []*big.Int, administrator []common.Address) (*StakerStakingPoolConfiguredIterator, error) { + + var poolIDRule []interface{} + for _, poolIDItem := range poolID { + poolIDRule = append(poolIDRule, poolIDItem) + } + var administratorRule []interface{} + for _, administratorItem := range administrator { + administratorRule = append(administratorRule, administratorItem) + } + + logs, sub, err := _Staker.contract.FilterLogs(opts, "StakingPoolConfigured", poolIDRule, administratorRule) + if err != nil { + return nil, err + } + return &StakerStakingPoolConfiguredIterator{contract: _Staker.contract, event: "StakingPoolConfigured", logs: logs, sub: sub}, nil +} + +// WatchStakingPoolConfigured is a free log subscription operation binding the contract event 0x8587d3b7f5e8e73d0f5be513ce84b6c7c9497e221295d831f57ba7ecc36589b5. +// +// Solidity: event StakingPoolConfigured(uint256 indexed poolID, address indexed administrator, bool transferable, uint256 lockupSeconds, uint256 cooldownSeconds) +func (_Staker *StakerFilterer) WatchStakingPoolConfigured(opts *bind.WatchOpts, sink chan<- *StakerStakingPoolConfigured, poolID []*big.Int, administrator []common.Address) (event.Subscription, error) { + + var poolIDRule []interface{} + for _, poolIDItem := range poolID { + poolIDRule = append(poolIDRule, poolIDItem) + } + var administratorRule []interface{} + for _, administratorItem := range administrator { + administratorRule = append(administratorRule, administratorItem) + } + + logs, sub, err := _Staker.contract.WatchLogs(opts, "StakingPoolConfigured", poolIDRule, administratorRule) + 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(StakerStakingPoolConfigured) + if err := _Staker.contract.UnpackLog(event, "StakingPoolConfigured", 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 +} + +// ParseStakingPoolConfigured is a log parse operation binding the contract event 0x8587d3b7f5e8e73d0f5be513ce84b6c7c9497e221295d831f57ba7ecc36589b5. +// +// Solidity: event StakingPoolConfigured(uint256 indexed poolID, address indexed administrator, bool transferable, uint256 lockupSeconds, uint256 cooldownSeconds) +func (_Staker *StakerFilterer) ParseStakingPoolConfigured(log types.Log) (*StakerStakingPoolConfigured, error) { + event := new(StakerStakingPoolConfigured) + if err := _Staker.contract.UnpackLog(event, "StakingPoolConfigured", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// StakerStakingPoolCreatedIterator is returned from FilterStakingPoolCreated and is used to iterate over the raw logs and unpacked data for StakingPoolCreated events raised by the Staker contract. +type StakerStakingPoolCreatedIterator struct { + Event *StakerStakingPoolCreated // 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 *StakerStakingPoolCreatedIterator) 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(StakerStakingPoolCreated) + 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(StakerStakingPoolCreated) + 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 *StakerStakingPoolCreatedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *StakerStakingPoolCreatedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// StakerStakingPoolCreated represents a StakingPoolCreated event raised by the Staker contract. +type StakerStakingPoolCreated struct { + PoolID *big.Int + TokenType *big.Int + TokenAddress common.Address + TokenID *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterStakingPoolCreated is a free log retrieval operation binding the contract event 0x36b06296d9441695787e7cbfc0b9cfc5deeeabec4406a3a90d30a222103c2dc8. +// +// Solidity: event StakingPoolCreated(uint256 indexed poolID, uint256 indexed tokenType, address indexed tokenAddress, uint256 tokenID) +func (_Staker *StakerFilterer) FilterStakingPoolCreated(opts *bind.FilterOpts, poolID []*big.Int, tokenType []*big.Int, tokenAddress []common.Address) (*StakerStakingPoolCreatedIterator, error) { + + var poolIDRule []interface{} + for _, poolIDItem := range poolID { + poolIDRule = append(poolIDRule, poolIDItem) + } + var tokenTypeRule []interface{} + for _, tokenTypeItem := range tokenType { + tokenTypeRule = append(tokenTypeRule, tokenTypeItem) + } + var tokenAddressRule []interface{} + for _, tokenAddressItem := range tokenAddress { + tokenAddressRule = append(tokenAddressRule, tokenAddressItem) + } + + logs, sub, err := _Staker.contract.FilterLogs(opts, "StakingPoolCreated", poolIDRule, tokenTypeRule, tokenAddressRule) + if err != nil { + return nil, err + } + return &StakerStakingPoolCreatedIterator{contract: _Staker.contract, event: "StakingPoolCreated", logs: logs, sub: sub}, nil +} + +// WatchStakingPoolCreated is a free log subscription operation binding the contract event 0x36b06296d9441695787e7cbfc0b9cfc5deeeabec4406a3a90d30a222103c2dc8. +// +// Solidity: event StakingPoolCreated(uint256 indexed poolID, uint256 indexed tokenType, address indexed tokenAddress, uint256 tokenID) +func (_Staker *StakerFilterer) WatchStakingPoolCreated(opts *bind.WatchOpts, sink chan<- *StakerStakingPoolCreated, poolID []*big.Int, tokenType []*big.Int, tokenAddress []common.Address) (event.Subscription, error) { + + var poolIDRule []interface{} + for _, poolIDItem := range poolID { + poolIDRule = append(poolIDRule, poolIDItem) + } + var tokenTypeRule []interface{} + for _, tokenTypeItem := range tokenType { + tokenTypeRule = append(tokenTypeRule, tokenTypeItem) + } + var tokenAddressRule []interface{} + for _, tokenAddressItem := range tokenAddress { + tokenAddressRule = append(tokenAddressRule, tokenAddressItem) + } + + logs, sub, err := _Staker.contract.WatchLogs(opts, "StakingPoolCreated", poolIDRule, tokenTypeRule, tokenAddressRule) + 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(StakerStakingPoolCreated) + if err := _Staker.contract.UnpackLog(event, "StakingPoolCreated", 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 +} + +// ParseStakingPoolCreated is a log parse operation binding the contract event 0x36b06296d9441695787e7cbfc0b9cfc5deeeabec4406a3a90d30a222103c2dc8. +// +// Solidity: event StakingPoolCreated(uint256 indexed poolID, uint256 indexed tokenType, address indexed tokenAddress, uint256 tokenID) +func (_Staker *StakerFilterer) ParseStakingPoolCreated(log types.Log) (*StakerStakingPoolCreated, error) { + event := new(StakerStakingPoolCreated) + if err := _Staker.contract.UnpackLog(event, "StakingPoolCreated", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// StakerTransferIterator is returned from FilterTransfer and is used to iterate over the raw logs and unpacked data for Transfer events raised by the Staker contract. +type StakerTransferIterator struct { + Event *StakerTransfer // 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 *StakerTransferIterator) 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(StakerTransfer) + 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(StakerTransfer) + 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 *StakerTransferIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *StakerTransferIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// StakerTransfer represents a Transfer event raised by the Staker contract. +type StakerTransfer 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 (_Staker *StakerFilterer) FilterTransfer(opts *bind.FilterOpts, from []common.Address, to []common.Address, tokenId []*big.Int) (*StakerTransferIterator, 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 := _Staker.contract.FilterLogs(opts, "Transfer", fromRule, toRule, tokenIdRule) + if err != nil { + return nil, err + } + return &StakerTransferIterator{contract: _Staker.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 (_Staker *StakerFilterer) WatchTransfer(opts *bind.WatchOpts, sink chan<- *StakerTransfer, 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 := _Staker.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(StakerTransfer) + if err := _Staker.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 (_Staker *StakerFilterer) ParseTransfer(log types.Log) (*StakerTransfer, error) { + event := new(StakerTransfer) + if err := _Staker.contract.UnpackLog(event, "Transfer", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +func CreateStakerDeploymentCommand() *cobra.Command { + var keyfile, nonce, password, value, gasPrice, maxFeePerGas, maxPriorityFeePerGas, rpc string + var gasLimit uint64 + var simulate bool + var timeout uint + + cmd := &cobra.Command{ + Use: "deploy", + Short: "Deploy a new Staker contract", + PreRunE: func(cmd *cobra.Command, args []string) error { + if keyfile == "" { + return fmt.Errorf("--keystore not specified (this should be a path to an Ethereum account keystore file)") + } + + return nil + }, + RunE: func(cmd *cobra.Command, args []string) error { + client, clientErr := NewClient(rpc) + if clientErr != nil { + return clientErr + } + + key, keyErr := KeyFromFile(keyfile, password) + if keyErr != nil { + return keyErr + } + + chainIDCtx, cancelChainIDCtx := NewChainContext(timeout) + defer cancelChainIDCtx() + chainID, chainIDErr := client.ChainID(chainIDCtx) + if chainIDErr != nil { + return chainIDErr + } + + transactionOpts, transactionOptsErr := bind.NewKeyedTransactorWithChainID(key.PrivateKey, chainID) + if transactionOptsErr != nil { + return transactionOptsErr + } + + SetTransactionParametersFromArgs(transactionOpts, nonce, value, gasPrice, maxFeePerGas, maxPriorityFeePerGas, gasLimit, simulate) + + address, deploymentTransaction, _, deploymentErr := DeployStaker( + transactionOpts, + client, + ) + if deploymentErr != nil { + return deploymentErr + } + + cmd.Printf("Transaction hash: %s\nContract address: %s\n", deploymentTransaction.Hash().Hex(), address.Hex()) + if transactionOpts.NoSend { + estimationMessage := ethereum.CallMsg{ + From: transactionOpts.From, + Data: deploymentTransaction.Data(), + } + + gasEstimationCtx, cancelGasEstimationCtx := NewChainContext(timeout) + defer cancelGasEstimationCtx() + + gasEstimate, gasEstimateErr := client.EstimateGas(gasEstimationCtx, estimationMessage) + if gasEstimateErr != nil { + return gasEstimateErr + } + + transactionBinary, transactionBinaryErr := deploymentTransaction.MarshalBinary() + if transactionBinaryErr != nil { + return transactionBinaryErr + } + transactionBinaryHex := hex.EncodeToString(transactionBinary) + + cmd.Printf("Transaction: %s\nEstimated gas: %d\n", transactionBinaryHex, gasEstimate) + } else { + cmd.Println("Transaction submitted") + } + + return nil + }, + } + + cmd.Flags().StringVar(&rpc, "rpc", "", "URL of the JSONRPC API to use") + cmd.Flags().StringVar(&keyfile, "keyfile", "", "Path to the keystore file to use for the transaction") + cmd.Flags().StringVar(&password, "password", "", "Password to use to unlock the keystore (if not specified, you will be prompted for the password when the command executes)") + cmd.Flags().StringVar(&nonce, "nonce", "", "Nonce to use for the transaction") + cmd.Flags().StringVar(&value, "value", "", "Value to send with the transaction") + cmd.Flags().StringVar(&gasPrice, "gas-price", "", "Gas price to use for the transaction") + cmd.Flags().StringVar(&maxFeePerGas, "max-fee-per-gas", "", "Maximum fee per gas to use for the (EIP-1559) transaction") + cmd.Flags().StringVar(&maxPriorityFeePerGas, "max-priority-fee-per-gas", "", "Maximum priority fee per gas to use for the (EIP-1559) transaction") + cmd.Flags().Uint64Var(&gasLimit, "gas-limit", 0, "Gas limit for the transaction") + cmd.Flags().BoolVar(&simulate, "simulate", false, "Simulate the transaction without sending it") + cmd.Flags().UintVar(&timeout, "timeout", 60, "Timeout (in seconds) for interactions with the JSONRPC API") + + return cmd +} + +func CreateErc1155TokentypeCommand() *cobra.Command { + var contractAddressRaw, rpc string + var contractAddress common.Address + var timeout uint + + var blockNumberRaw, fromAddressRaw string + var pending bool + + var capture0 *big.Int + + cmd := &cobra.Command{ + Use: "erc-1155-tokentype", + Short: "Call the ERC1155TOKENTYPE view method on a Staker contract", + PreRunE: func(cmd *cobra.Command, args []string) error { + if contractAddressRaw == "" { + return fmt.Errorf("--contract not specified") + } else if !common.IsHexAddress(contractAddressRaw) { + return fmt.Errorf("--contract is not a valid Ethereum address") + } + contractAddress = common.HexToAddress(contractAddressRaw) + + return nil + }, + RunE: func(cmd *cobra.Command, args []string) error { + client, clientErr := NewClient(rpc) + if clientErr != nil { + return clientErr + } + + contract, contractErr := NewStaker(contractAddress, client) + if contractErr != nil { + return contractErr + } + + callOpts := bind.CallOpts{} + SetCallParametersFromArgs(&callOpts, pending, fromAddressRaw, blockNumberRaw) + + session := StakerCallerSession{ + Contract: &contract.StakerCaller, + CallOpts: callOpts, + } + + var callErr error + capture0, callErr = session.ERC1155TOKENTYPE() + if callErr != nil { + return callErr + } + + cmd.Printf("0: %s\n", capture0.String()) + + return nil + }, + } + + cmd.Flags().StringVar(&rpc, "rpc", "", "URL of the JSONRPC API to use") + cmd.Flags().StringVar(&blockNumberRaw, "block", "", "Block number at which to call the view method") + cmd.Flags().BoolVar(&pending, "pending", false, "Set this flag if it's ok to call the view method against pending state") + cmd.Flags().UintVar(&timeout, "timeout", 60, "Timeout (in seconds) for interactions with the JSONRPC API") + cmd.Flags().StringVar(&contractAddressRaw, "contract", "", "Address of the contract to interact with") + cmd.Flags().StringVar(&fromAddressRaw, "from", "", "Optional address for caller of the view method") + + return cmd +} +func CreateErc721TokentypeCommand() *cobra.Command { + var contractAddressRaw, rpc string + var contractAddress common.Address + var timeout uint + + var blockNumberRaw, fromAddressRaw string + var pending bool + + var capture0 *big.Int + + cmd := &cobra.Command{ + Use: "erc-721-tokentype", + Short: "Call the ERC721TOKENTYPE view method on a Staker contract", + PreRunE: func(cmd *cobra.Command, args []string) error { + if contractAddressRaw == "" { + return fmt.Errorf("--contract not specified") + } else if !common.IsHexAddress(contractAddressRaw) { + return fmt.Errorf("--contract is not a valid Ethereum address") + } + contractAddress = common.HexToAddress(contractAddressRaw) + + return nil + }, + RunE: func(cmd *cobra.Command, args []string) error { + client, clientErr := NewClient(rpc) + if clientErr != nil { + return clientErr + } + + contract, contractErr := NewStaker(contractAddress, client) + if contractErr != nil { + return contractErr + } + + callOpts := bind.CallOpts{} + SetCallParametersFromArgs(&callOpts, pending, fromAddressRaw, blockNumberRaw) + + session := StakerCallerSession{ + Contract: &contract.StakerCaller, + CallOpts: callOpts, + } + + var callErr error + capture0, callErr = session.ERC721TOKENTYPE() + if callErr != nil { + return callErr + } + + cmd.Printf("0: %s\n", capture0.String()) + + return nil + }, + } + + cmd.Flags().StringVar(&rpc, "rpc", "", "URL of the JSONRPC API to use") + cmd.Flags().StringVar(&blockNumberRaw, "block", "", "Block number at which to call the view method") + cmd.Flags().BoolVar(&pending, "pending", false, "Set this flag if it's ok to call the view method against pending state") + cmd.Flags().UintVar(&timeout, "timeout", 60, "Timeout (in seconds) for interactions with the JSONRPC API") + cmd.Flags().StringVar(&contractAddressRaw, "contract", "", "Address of the contract to interact with") + cmd.Flags().StringVar(&fromAddressRaw, "from", "", "Optional address for caller of the view method") + + return cmd +} +func CreatePositionsCommand() *cobra.Command { + var contractAddressRaw, rpc string + var contractAddress common.Address + var timeout uint + + var blockNumberRaw, fromAddressRaw string + var pending bool + + var arg0 *big.Int + var arg0Raw string + + var capture0 struct { + PoolID *big.Int + Amount *big.Int + StakeTimestamp uint64 + } + + cmd := &cobra.Command{ + Use: "positions", + Short: "Call the Positions view method on a Staker contract", + PreRunE: func(cmd *cobra.Command, args []string) error { + if contractAddressRaw == "" { + return fmt.Errorf("--contract not specified") + } else if !common.IsHexAddress(contractAddressRaw) { + return fmt.Errorf("--contract is not a valid Ethereum address") + } + contractAddress = common.HexToAddress(contractAddressRaw) + + if arg0Raw == "" { + return fmt.Errorf("--arg-0 argument not specified") + } + arg0 = new(big.Int) + arg0.SetString(arg0Raw, 0) + + return nil + }, + RunE: func(cmd *cobra.Command, args []string) error { + client, clientErr := NewClient(rpc) + if clientErr != nil { + return clientErr + } + + contract, contractErr := NewStaker(contractAddress, client) + if contractErr != nil { + return contractErr + } + + callOpts := bind.CallOpts{} + SetCallParametersFromArgs(&callOpts, pending, fromAddressRaw, blockNumberRaw) + + session := StakerCallerSession{ + Contract: &contract.StakerCaller, + CallOpts: callOpts, + } + + var callErr error + capture0, callErr = session.Positions( + arg0, + ) + if callErr != nil { + return callErr + } + + cmd.Printf("0: %v\n", capture0) + + return nil + }, + } + + cmd.Flags().StringVar(&rpc, "rpc", "", "URL of the JSONRPC API to use") + cmd.Flags().StringVar(&blockNumberRaw, "block", "", "Block number at which to call the view method") + cmd.Flags().BoolVar(&pending, "pending", false, "Set this flag if it's ok to call the view method against pending state") + cmd.Flags().UintVar(&timeout, "timeout", 60, "Timeout (in seconds) for interactions with the JSONRPC API") + cmd.Flags().StringVar(&contractAddressRaw, "contract", "", "Address of the contract to interact with") + cmd.Flags().StringVar(&fromAddressRaw, "from", "", "Optional address for caller of the view method") + + cmd.Flags().StringVar(&arg0Raw, "arg-0", "", "arg-0 argument") + + return cmd +} +func CreateTotalPoolsCommand() *cobra.Command { + var contractAddressRaw, rpc string + var contractAddress common.Address + var timeout uint + + var blockNumberRaw, fromAddressRaw string + var pending bool + + var capture0 *big.Int + + cmd := &cobra.Command{ + Use: "total-pools", + Short: "Call the TotalPools view method on a Staker contract", + PreRunE: func(cmd *cobra.Command, args []string) error { + if contractAddressRaw == "" { + return fmt.Errorf("--contract not specified") + } else if !common.IsHexAddress(contractAddressRaw) { + return fmt.Errorf("--contract is not a valid Ethereum address") + } + contractAddress = common.HexToAddress(contractAddressRaw) + + return nil + }, + RunE: func(cmd *cobra.Command, args []string) error { + client, clientErr := NewClient(rpc) + if clientErr != nil { + return clientErr + } + + contract, contractErr := NewStaker(contractAddress, client) + if contractErr != nil { + return contractErr + } + + callOpts := bind.CallOpts{} + SetCallParametersFromArgs(&callOpts, pending, fromAddressRaw, blockNumberRaw) + + session := StakerCallerSession{ + Contract: &contract.StakerCaller, + CallOpts: callOpts, + } + + var callErr error + capture0, callErr = session.TotalPools() + if callErr != nil { + return callErr + } + + cmd.Printf("0: %s\n", capture0.String()) + + return nil + }, + } + + cmd.Flags().StringVar(&rpc, "rpc", "", "URL of the JSONRPC API to use") + cmd.Flags().StringVar(&blockNumberRaw, "block", "", "Block number at which to call the view method") + cmd.Flags().BoolVar(&pending, "pending", false, "Set this flag if it's ok to call the view method against pending state") + cmd.Flags().UintVar(&timeout, "timeout", 60, "Timeout (in seconds) for interactions with the JSONRPC API") + cmd.Flags().StringVar(&contractAddressRaw, "contract", "", "Address of the contract to interact with") + cmd.Flags().StringVar(&fromAddressRaw, "from", "", "Optional address for caller of the view method") + + return cmd +} +func CreateGetApprovedCommand() *cobra.Command { + var contractAddressRaw, rpc string + var contractAddress common.Address + var timeout uint + + var blockNumberRaw, fromAddressRaw string + var pending bool + + var tokenId *big.Int + var tokenIdRaw string + + var capture0 common.Address + + cmd := &cobra.Command{ + Use: "get-approved", + Short: "Call the GetApproved view method on a Staker contract", + PreRunE: func(cmd *cobra.Command, args []string) error { + if contractAddressRaw == "" { + return fmt.Errorf("--contract not specified") + } else if !common.IsHexAddress(contractAddressRaw) { + return fmt.Errorf("--contract is not a valid Ethereum address") + } + contractAddress = common.HexToAddress(contractAddressRaw) + + if tokenIdRaw == "" { + return fmt.Errorf("--token-id argument not specified") + } + tokenId = new(big.Int) + tokenId.SetString(tokenIdRaw, 0) + + return nil + }, + RunE: func(cmd *cobra.Command, args []string) error { + client, clientErr := NewClient(rpc) + if clientErr != nil { + return clientErr + } + + contract, contractErr := NewStaker(contractAddress, client) + if contractErr != nil { + return contractErr + } + + callOpts := bind.CallOpts{} + SetCallParametersFromArgs(&callOpts, pending, fromAddressRaw, blockNumberRaw) + + session := StakerCallerSession{ + Contract: &contract.StakerCaller, + CallOpts: callOpts, + } + + var callErr error + capture0, callErr = session.GetApproved( + tokenId, + ) + if callErr != nil { + return callErr + } + + cmd.Printf("0: %s\n", capture0.Hex()) + + return nil + }, + } + + cmd.Flags().StringVar(&rpc, "rpc", "", "URL of the JSONRPC API to use") + cmd.Flags().StringVar(&blockNumberRaw, "block", "", "Block number at which to call the view method") + cmd.Flags().BoolVar(&pending, "pending", false, "Set this flag if it's ok to call the view method against pending state") + cmd.Flags().UintVar(&timeout, "timeout", 60, "Timeout (in seconds) for interactions with the JSONRPC API") + cmd.Flags().StringVar(&contractAddressRaw, "contract", "", "Address of the contract to interact with") + cmd.Flags().StringVar(&fromAddressRaw, "from", "", "Optional address for caller of the view method") + + cmd.Flags().StringVar(&tokenIdRaw, "token-id", "", "token-id argument") + + return cmd +} +func CreateOwnerOfCommand() *cobra.Command { + var contractAddressRaw, rpc string + var contractAddress common.Address + var timeout uint + + var blockNumberRaw, fromAddressRaw string + var pending bool + + var tokenId *big.Int + var tokenIdRaw string + + var capture0 common.Address + + cmd := &cobra.Command{ + Use: "owner-of", + Short: "Call the OwnerOf view method on a Staker contract", + PreRunE: func(cmd *cobra.Command, args []string) error { + if contractAddressRaw == "" { + return fmt.Errorf("--contract not specified") + } else if !common.IsHexAddress(contractAddressRaw) { + return fmt.Errorf("--contract is not a valid Ethereum address") + } + contractAddress = common.HexToAddress(contractAddressRaw) + + if tokenIdRaw == "" { + return fmt.Errorf("--token-id argument not specified") + } + tokenId = new(big.Int) + tokenId.SetString(tokenIdRaw, 0) + + return nil + }, + RunE: func(cmd *cobra.Command, args []string) error { + client, clientErr := NewClient(rpc) + if clientErr != nil { + return clientErr + } + + contract, contractErr := NewStaker(contractAddress, client) + if contractErr != nil { + return contractErr + } + + callOpts := bind.CallOpts{} + SetCallParametersFromArgs(&callOpts, pending, fromAddressRaw, blockNumberRaw) + + session := StakerCallerSession{ + Contract: &contract.StakerCaller, + CallOpts: callOpts, + } + + var callErr error + capture0, callErr = session.OwnerOf( + tokenId, + ) + if callErr != nil { + return callErr + } + + cmd.Printf("0: %s\n", capture0.Hex()) + + return nil + }, + } + + cmd.Flags().StringVar(&rpc, "rpc", "", "URL of the JSONRPC API to use") + cmd.Flags().StringVar(&blockNumberRaw, "block", "", "Block number at which to call the view method") + cmd.Flags().BoolVar(&pending, "pending", false, "Set this flag if it's ok to call the view method against pending state") + cmd.Flags().UintVar(&timeout, "timeout", 60, "Timeout (in seconds) for interactions with the JSONRPC API") + cmd.Flags().StringVar(&contractAddressRaw, "contract", "", "Address of the contract to interact with") + cmd.Flags().StringVar(&fromAddressRaw, "from", "", "Optional address for caller of the view method") + + cmd.Flags().StringVar(&tokenIdRaw, "token-id", "", "token-id argument") + + return cmd +} +func CreateSupportsInterfaceCommand() *cobra.Command { + var contractAddressRaw, rpc string + var contractAddress common.Address + var timeout uint + + var blockNumberRaw, fromAddressRaw string + var pending bool + + var interfaceId [4]byte + var interfaceIdRaw string + + var capture0 bool + + cmd := &cobra.Command{ + Use: "supports-interface", + Short: "Call the SupportsInterface view method on a Staker contract", + PreRunE: func(cmd *cobra.Command, args []string) error { + if contractAddressRaw == "" { + return fmt.Errorf("--contract not specified") + } else if !common.IsHexAddress(contractAddressRaw) { + return fmt.Errorf("--contract is not a valid Ethereum address") + } + contractAddress = common.HexToAddress(contractAddressRaw) + + var hexDecodeinterfaceIdErr error + + var intermediateinterfaceIdLeaf []byte + intermediateinterfaceIdLeaf, hexDecodeinterfaceIdErr = hex.DecodeString(interfaceIdRaw) + if hexDecodeinterfaceIdErr != nil { + return hexDecodeinterfaceIdErr + } + interfaceId = [4]byte(intermediateinterfaceIdLeaf[:4]) + + return nil + }, + RunE: func(cmd *cobra.Command, args []string) error { + client, clientErr := NewClient(rpc) + if clientErr != nil { + return clientErr + } + + contract, contractErr := NewStaker(contractAddress, client) + if contractErr != nil { + return contractErr + } + + callOpts := bind.CallOpts{} + SetCallParametersFromArgs(&callOpts, pending, fromAddressRaw, blockNumberRaw) + + session := StakerCallerSession{ + Contract: &contract.StakerCaller, + CallOpts: callOpts, + } + + var callErr error + capture0, callErr = session.SupportsInterface( + interfaceId, + ) + if callErr != nil { + return callErr + } + + cmd.Printf("0: %t\n", capture0) + + return nil + }, + } + + cmd.Flags().StringVar(&rpc, "rpc", "", "URL of the JSONRPC API to use") + cmd.Flags().StringVar(&blockNumberRaw, "block", "", "Block number at which to call the view method") + cmd.Flags().BoolVar(&pending, "pending", false, "Set this flag if it's ok to call the view method against pending state") + cmd.Flags().UintVar(&timeout, "timeout", 60, "Timeout (in seconds) for interactions with the JSONRPC API") + cmd.Flags().StringVar(&contractAddressRaw, "contract", "", "Address of the contract to interact with") + cmd.Flags().StringVar(&fromAddressRaw, "from", "", "Optional address for caller of the view method") + + cmd.Flags().StringVar(&interfaceIdRaw, "interface-id", "", "interface-id argument") + + return cmd +} +func CreateErc20TokentypeCommand() *cobra.Command { + var contractAddressRaw, rpc string + var contractAddress common.Address + var timeout uint + + var blockNumberRaw, fromAddressRaw string + var pending bool + + var capture0 *big.Int + + cmd := &cobra.Command{ + Use: "erc-20-tokentype", + Short: "Call the ERC20TOKENTYPE view method on a Staker contract", + PreRunE: func(cmd *cobra.Command, args []string) error { + if contractAddressRaw == "" { + return fmt.Errorf("--contract not specified") + } else if !common.IsHexAddress(contractAddressRaw) { + return fmt.Errorf("--contract is not a valid Ethereum address") + } + contractAddress = common.HexToAddress(contractAddressRaw) + + return nil + }, + RunE: func(cmd *cobra.Command, args []string) error { + client, clientErr := NewClient(rpc) + if clientErr != nil { + return clientErr + } + + contract, contractErr := NewStaker(contractAddress, client) + if contractErr != nil { + return contractErr + } + + callOpts := bind.CallOpts{} + SetCallParametersFromArgs(&callOpts, pending, fromAddressRaw, blockNumberRaw) + + session := StakerCallerSession{ + Contract: &contract.StakerCaller, + CallOpts: callOpts, + } + + var callErr error + capture0, callErr = session.ERC20TOKENTYPE() + if callErr != nil { + return callErr + } + + cmd.Printf("0: %s\n", capture0.String()) + + return nil + }, + } + + cmd.Flags().StringVar(&rpc, "rpc", "", "URL of the JSONRPC API to use") + cmd.Flags().StringVar(&blockNumberRaw, "block", "", "Block number at which to call the view method") + cmd.Flags().BoolVar(&pending, "pending", false, "Set this flag if it's ok to call the view method against pending state") + cmd.Flags().UintVar(&timeout, "timeout", 60, "Timeout (in seconds) for interactions with the JSONRPC API") + cmd.Flags().StringVar(&contractAddressRaw, "contract", "", "Address of the contract to interact with") + cmd.Flags().StringVar(&fromAddressRaw, "from", "", "Optional address for caller of the view method") + + return cmd +} +func CreateIsApprovedForAllCommand() *cobra.Command { + var contractAddressRaw, rpc string + var contractAddress common.Address + var timeout uint + + var blockNumberRaw, fromAddressRaw string + var pending bool + + var owner common.Address + var ownerRaw string + var operator common.Address + var operatorRaw string + + var capture0 bool + + cmd := &cobra.Command{ + Use: "is-approved-for-all", + Short: "Call the IsApprovedForAll view method on a Staker contract", + PreRunE: func(cmd *cobra.Command, args []string) error { + if contractAddressRaw == "" { + return fmt.Errorf("--contract not specified") + } else if !common.IsHexAddress(contractAddressRaw) { + return fmt.Errorf("--contract is not a valid Ethereum address") + } + contractAddress = common.HexToAddress(contractAddressRaw) + + if ownerRaw == "" { + return fmt.Errorf("--owner argument not specified") + } else if !common.IsHexAddress(ownerRaw) { + return fmt.Errorf("--owner argument is not a valid Ethereum address") + } + owner = common.HexToAddress(ownerRaw) + + if operatorRaw == "" { + return fmt.Errorf("--operator argument not specified") + } else if !common.IsHexAddress(operatorRaw) { + return fmt.Errorf("--operator argument is not a valid Ethereum address") + } + operator = common.HexToAddress(operatorRaw) + + return nil + }, + RunE: func(cmd *cobra.Command, args []string) error { + client, clientErr := NewClient(rpc) + if clientErr != nil { + return clientErr + } + + contract, contractErr := NewStaker(contractAddress, client) + if contractErr != nil { + return contractErr + } + + callOpts := bind.CallOpts{} + SetCallParametersFromArgs(&callOpts, pending, fromAddressRaw, blockNumberRaw) + + session := StakerCallerSession{ + Contract: &contract.StakerCaller, + CallOpts: callOpts, + } + + var callErr error + capture0, callErr = session.IsApprovedForAll( + owner, + operator, + ) + if callErr != nil { + return callErr + } + + cmd.Printf("0: %t\n", capture0) + + return nil + }, + } + + cmd.Flags().StringVar(&rpc, "rpc", "", "URL of the JSONRPC API to use") + cmd.Flags().StringVar(&blockNumberRaw, "block", "", "Block number at which to call the view method") + cmd.Flags().BoolVar(&pending, "pending", false, "Set this flag if it's ok to call the view method against pending state") + cmd.Flags().UintVar(&timeout, "timeout", 60, "Timeout (in seconds) for interactions with the JSONRPC API") + cmd.Flags().StringVar(&contractAddressRaw, "contract", "", "Address of the contract to interact with") + cmd.Flags().StringVar(&fromAddressRaw, "from", "", "Optional address for caller of the view method") + + cmd.Flags().StringVar(&ownerRaw, "owner", "", "owner argument") + cmd.Flags().StringVar(&operatorRaw, "operator", "", "operator argument") + + return cmd +} +func CreateNameCommand() *cobra.Command { + var contractAddressRaw, rpc string + var contractAddress common.Address + var timeout uint + + var blockNumberRaw, fromAddressRaw string + var pending bool + + var capture0 string + + cmd := &cobra.Command{ + Use: "name", + Short: "Call the Name view method on a Staker contract", + PreRunE: func(cmd *cobra.Command, args []string) error { + if contractAddressRaw == "" { + return fmt.Errorf("--contract not specified") + } else if !common.IsHexAddress(contractAddressRaw) { + return fmt.Errorf("--contract is not a valid Ethereum address") + } + contractAddress = common.HexToAddress(contractAddressRaw) + + return nil + }, + RunE: func(cmd *cobra.Command, args []string) error { + client, clientErr := NewClient(rpc) + if clientErr != nil { + return clientErr + } + + contract, contractErr := NewStaker(contractAddress, client) + if contractErr != nil { + return contractErr + } + + callOpts := bind.CallOpts{} + SetCallParametersFromArgs(&callOpts, pending, fromAddressRaw, blockNumberRaw) + + session := StakerCallerSession{ + Contract: &contract.StakerCaller, + CallOpts: callOpts, + } + + var callErr error + capture0, callErr = session.Name() + if callErr != nil { + return callErr + } + + cmd.Printf("0: %s\n", capture0) + + return nil + }, + } + + cmd.Flags().StringVar(&rpc, "rpc", "", "URL of the JSONRPC API to use") + cmd.Flags().StringVar(&blockNumberRaw, "block", "", "Block number at which to call the view method") + cmd.Flags().BoolVar(&pending, "pending", false, "Set this flag if it's ok to call the view method against pending state") + cmd.Flags().UintVar(&timeout, "timeout", 60, "Timeout (in seconds) for interactions with the JSONRPC API") + cmd.Flags().StringVar(&contractAddressRaw, "contract", "", "Address of the contract to interact with") + cmd.Flags().StringVar(&fromAddressRaw, "from", "", "Optional address for caller of the view method") + + return cmd +} +func CreateTokenUriCommand() *cobra.Command { + var contractAddressRaw, rpc string + var contractAddress common.Address + var timeout uint + + var blockNumberRaw, fromAddressRaw string + var pending bool + + var tokenId *big.Int + var tokenIdRaw string + + var capture0 string + + cmd := &cobra.Command{ + Use: "token-uri", + Short: "Call the TokenURI view method on a Staker contract", + PreRunE: func(cmd *cobra.Command, args []string) error { + if contractAddressRaw == "" { + return fmt.Errorf("--contract not specified") + } else if !common.IsHexAddress(contractAddressRaw) { + return fmt.Errorf("--contract is not a valid Ethereum address") + } + contractAddress = common.HexToAddress(contractAddressRaw) + + if tokenIdRaw == "" { + return fmt.Errorf("--token-id argument not specified") + } + tokenId = new(big.Int) + tokenId.SetString(tokenIdRaw, 0) + + return nil + }, + RunE: func(cmd *cobra.Command, args []string) error { + client, clientErr := NewClient(rpc) + if clientErr != nil { + return clientErr + } + + contract, contractErr := NewStaker(contractAddress, client) + if contractErr != nil { + return contractErr + } + + callOpts := bind.CallOpts{} + SetCallParametersFromArgs(&callOpts, pending, fromAddressRaw, blockNumberRaw) + + session := StakerCallerSession{ + Contract: &contract.StakerCaller, + CallOpts: callOpts, + } + + var callErr error + capture0, callErr = session.TokenURI( + tokenId, + ) + if callErr != nil { + return callErr + } + + cmd.Printf("0: %s\n", capture0) + + return nil + }, + } + + cmd.Flags().StringVar(&rpc, "rpc", "", "URL of the JSONRPC API to use") + cmd.Flags().StringVar(&blockNumberRaw, "block", "", "Block number at which to call the view method") + cmd.Flags().BoolVar(&pending, "pending", false, "Set this flag if it's ok to call the view method against pending state") + cmd.Flags().UintVar(&timeout, "timeout", 60, "Timeout (in seconds) for interactions with the JSONRPC API") + cmd.Flags().StringVar(&contractAddressRaw, "contract", "", "Address of the contract to interact with") + cmd.Flags().StringVar(&fromAddressRaw, "from", "", "Optional address for caller of the view method") + + cmd.Flags().StringVar(&tokenIdRaw, "token-id", "", "token-id argument") + + return cmd +} +func CreateTotalSupplyCommand() *cobra.Command { + var contractAddressRaw, rpc string + var contractAddress common.Address + var timeout uint + + var blockNumberRaw, fromAddressRaw string + var pending bool + + var capture0 *big.Int + + cmd := &cobra.Command{ + Use: "total-supply", + Short: "Call the TotalSupply view method on a Staker contract", + PreRunE: func(cmd *cobra.Command, args []string) error { + if contractAddressRaw == "" { + return fmt.Errorf("--contract not specified") + } else if !common.IsHexAddress(contractAddressRaw) { + return fmt.Errorf("--contract is not a valid Ethereum address") + } + contractAddress = common.HexToAddress(contractAddressRaw) + + return nil + }, + RunE: func(cmd *cobra.Command, args []string) error { + client, clientErr := NewClient(rpc) + if clientErr != nil { + return clientErr + } + + contract, contractErr := NewStaker(contractAddress, client) + if contractErr != nil { + return contractErr + } + + callOpts := bind.CallOpts{} + SetCallParametersFromArgs(&callOpts, pending, fromAddressRaw, blockNumberRaw) + + session := StakerCallerSession{ + Contract: &contract.StakerCaller, + CallOpts: callOpts, + } + + var callErr error + capture0, callErr = session.TotalSupply() + if callErr != nil { + return callErr + } + + cmd.Printf("0: %s\n", capture0.String()) + + return nil + }, + } + + cmd.Flags().StringVar(&rpc, "rpc", "", "URL of the JSONRPC API to use") + cmd.Flags().StringVar(&blockNumberRaw, "block", "", "Block number at which to call the view method") + cmd.Flags().BoolVar(&pending, "pending", false, "Set this flag if it's ok to call the view method against pending state") + cmd.Flags().UintVar(&timeout, "timeout", 60, "Timeout (in seconds) for interactions with the JSONRPC API") + cmd.Flags().StringVar(&contractAddressRaw, "contract", "", "Address of the contract to interact with") + cmd.Flags().StringVar(&fromAddressRaw, "from", "", "Optional address for caller of the view method") + + return cmd +} +func CreateNativetokentypeCommand() *cobra.Command { + var contractAddressRaw, rpc string + var contractAddress common.Address + var timeout uint + + var blockNumberRaw, fromAddressRaw string + var pending bool + + var capture0 *big.Int + + cmd := &cobra.Command{ + Use: "nativetokentype", + Short: "Call the NATIVETOKENTYPE view method on a Staker contract", + PreRunE: func(cmd *cobra.Command, args []string) error { + if contractAddressRaw == "" { + return fmt.Errorf("--contract not specified") + } else if !common.IsHexAddress(contractAddressRaw) { + return fmt.Errorf("--contract is not a valid Ethereum address") + } + contractAddress = common.HexToAddress(contractAddressRaw) + + return nil + }, + RunE: func(cmd *cobra.Command, args []string) error { + client, clientErr := NewClient(rpc) + if clientErr != nil { + return clientErr + } + + contract, contractErr := NewStaker(contractAddress, client) + if contractErr != nil { + return contractErr + } + + callOpts := bind.CallOpts{} + SetCallParametersFromArgs(&callOpts, pending, fromAddressRaw, blockNumberRaw) + + session := StakerCallerSession{ + Contract: &contract.StakerCaller, + CallOpts: callOpts, + } + + var callErr error + capture0, callErr = session.NATIVETOKENTYPE() + if callErr != nil { + return callErr + } + + cmd.Printf("0: %s\n", capture0.String()) + + return nil + }, + } + + cmd.Flags().StringVar(&rpc, "rpc", "", "URL of the JSONRPC API to use") + cmd.Flags().StringVar(&blockNumberRaw, "block", "", "Block number at which to call the view method") + cmd.Flags().BoolVar(&pending, "pending", false, "Set this flag if it's ok to call the view method against pending state") + cmd.Flags().UintVar(&timeout, "timeout", 60, "Timeout (in seconds) for interactions with the JSONRPC API") + cmd.Flags().StringVar(&contractAddressRaw, "contract", "", "Address of the contract to interact with") + cmd.Flags().StringVar(&fromAddressRaw, "from", "", "Optional address for caller of the view method") + + return cmd +} +func CreatePoolsCommand() *cobra.Command { + var contractAddressRaw, rpc string + var contractAddress common.Address + var timeout uint + + var blockNumberRaw, fromAddressRaw string + var pending bool + + var arg0 *big.Int + var arg0Raw string + + var capture0 struct { + Administrator common.Address + TokenType *big.Int + TokenAddress common.Address + TokenID *big.Int + Transferable bool + LockupSeconds *big.Int + CooldownSeconds *big.Int + } + + cmd := &cobra.Command{ + Use: "pools", + Short: "Call the Pools view method on a Staker contract", + PreRunE: func(cmd *cobra.Command, args []string) error { + if contractAddressRaw == "" { + return fmt.Errorf("--contract not specified") + } else if !common.IsHexAddress(contractAddressRaw) { + return fmt.Errorf("--contract is not a valid Ethereum address") + } + contractAddress = common.HexToAddress(contractAddressRaw) + + if arg0Raw == "" { + return fmt.Errorf("--arg-0 argument not specified") + } + arg0 = new(big.Int) + arg0.SetString(arg0Raw, 0) + + return nil + }, + RunE: func(cmd *cobra.Command, args []string) error { + client, clientErr := NewClient(rpc) + if clientErr != nil { + return clientErr + } + + contract, contractErr := NewStaker(contractAddress, client) + if contractErr != nil { + return contractErr + } + + callOpts := bind.CallOpts{} + SetCallParametersFromArgs(&callOpts, pending, fromAddressRaw, blockNumberRaw) + + session := StakerCallerSession{ + Contract: &contract.StakerCaller, + CallOpts: callOpts, + } + + var callErr error + capture0, callErr = session.Pools( + arg0, + ) + if callErr != nil { + return callErr + } + + cmd.Printf("0: %v\n", capture0) + + return nil + }, + } + + cmd.Flags().StringVar(&rpc, "rpc", "", "URL of the JSONRPC API to use") + cmd.Flags().StringVar(&blockNumberRaw, "block", "", "Block number at which to call the view method") + cmd.Flags().BoolVar(&pending, "pending", false, "Set this flag if it's ok to call the view method against pending state") + cmd.Flags().UintVar(&timeout, "timeout", 60, "Timeout (in seconds) for interactions with the JSONRPC API") + cmd.Flags().StringVar(&contractAddressRaw, "contract", "", "Address of the contract to interact with") + cmd.Flags().StringVar(&fromAddressRaw, "from", "", "Optional address for caller of the view method") + + cmd.Flags().StringVar(&arg0Raw, "arg-0", "", "arg-0 argument") + + return cmd +} +func CreateBalanceOfCommand() *cobra.Command { + var contractAddressRaw, rpc string + var contractAddress common.Address + var timeout uint + + var blockNumberRaw, fromAddressRaw string + var pending bool + + var owner common.Address + var ownerRaw string + + var capture0 *big.Int + + cmd := &cobra.Command{ + Use: "balance-of", + Short: "Call the BalanceOf view method on a Staker contract", + PreRunE: func(cmd *cobra.Command, args []string) error { + if contractAddressRaw == "" { + return fmt.Errorf("--contract not specified") + } else if !common.IsHexAddress(contractAddressRaw) { + return fmt.Errorf("--contract is not a valid Ethereum address") + } + contractAddress = common.HexToAddress(contractAddressRaw) + + if ownerRaw == "" { + return fmt.Errorf("--owner argument not specified") + } else if !common.IsHexAddress(ownerRaw) { + return fmt.Errorf("--owner argument is not a valid Ethereum address") + } + owner = common.HexToAddress(ownerRaw) + + return nil + }, + RunE: func(cmd *cobra.Command, args []string) error { + client, clientErr := NewClient(rpc) + if clientErr != nil { + return clientErr + } + + contract, contractErr := NewStaker(contractAddress, client) + if contractErr != nil { + return contractErr + } + + callOpts := bind.CallOpts{} + SetCallParametersFromArgs(&callOpts, pending, fromAddressRaw, blockNumberRaw) + + session := StakerCallerSession{ + Contract: &contract.StakerCaller, + CallOpts: callOpts, + } + + var callErr error + capture0, callErr = session.BalanceOf( + owner, + ) + if callErr != nil { + return callErr + } + + cmd.Printf("0: %s\n", capture0.String()) + + return nil + }, + } + + cmd.Flags().StringVar(&rpc, "rpc", "", "URL of the JSONRPC API to use") + cmd.Flags().StringVar(&blockNumberRaw, "block", "", "Block number at which to call the view method") + cmd.Flags().BoolVar(&pending, "pending", false, "Set this flag if it's ok to call the view method against pending state") + cmd.Flags().UintVar(&timeout, "timeout", 60, "Timeout (in seconds) for interactions with the JSONRPC API") + cmd.Flags().StringVar(&contractAddressRaw, "contract", "", "Address of the contract to interact with") + cmd.Flags().StringVar(&fromAddressRaw, "from", "", "Optional address for caller of the view method") + + cmd.Flags().StringVar(&ownerRaw, "owner", "", "owner argument") + + return cmd +} +func CreateSymbolCommand() *cobra.Command { + var contractAddressRaw, rpc string + var contractAddress common.Address + var timeout uint + + var blockNumberRaw, fromAddressRaw string + var pending bool + + var capture0 string + + cmd := &cobra.Command{ + Use: "symbol", + Short: "Call the Symbol view method on a Staker contract", + PreRunE: func(cmd *cobra.Command, args []string) error { + if contractAddressRaw == "" { + return fmt.Errorf("--contract not specified") + } else if !common.IsHexAddress(contractAddressRaw) { + return fmt.Errorf("--contract is not a valid Ethereum address") + } + contractAddress = common.HexToAddress(contractAddressRaw) + + return nil + }, + RunE: func(cmd *cobra.Command, args []string) error { + client, clientErr := NewClient(rpc) + if clientErr != nil { + return clientErr + } + + contract, contractErr := NewStaker(contractAddress, client) + if contractErr != nil { + return contractErr + } + + callOpts := bind.CallOpts{} + SetCallParametersFromArgs(&callOpts, pending, fromAddressRaw, blockNumberRaw) + + session := StakerCallerSession{ + Contract: &contract.StakerCaller, + CallOpts: callOpts, + } + + var callErr error + capture0, callErr = session.Symbol() + if callErr != nil { + return callErr + } + + cmd.Printf("0: %s\n", capture0) + + return nil + }, + } + + cmd.Flags().StringVar(&rpc, "rpc", "", "URL of the JSONRPC API to use") + cmd.Flags().StringVar(&blockNumberRaw, "block", "", "Block number at which to call the view method") + cmd.Flags().BoolVar(&pending, "pending", false, "Set this flag if it's ok to call the view method against pending state") + cmd.Flags().UintVar(&timeout, "timeout", 60, "Timeout (in seconds) for interactions with the JSONRPC API") + cmd.Flags().StringVar(&contractAddressRaw, "contract", "", "Address of the contract to interact with") + cmd.Flags().StringVar(&fromAddressRaw, "from", "", "Optional address for caller of the view method") + + return cmd +} +func CreateTokenByIndexCommand() *cobra.Command { + var contractAddressRaw, rpc string + var contractAddress common.Address + var timeout uint + + var blockNumberRaw, fromAddressRaw string + var pending bool + + var index *big.Int + var indexRaw string + + var capture0 *big.Int + + cmd := &cobra.Command{ + Use: "token-by-index", + Short: "Call the TokenByIndex view method on a Staker contract", + PreRunE: func(cmd *cobra.Command, args []string) error { + if contractAddressRaw == "" { + return fmt.Errorf("--contract not specified") + } else if !common.IsHexAddress(contractAddressRaw) { + return fmt.Errorf("--contract is not a valid Ethereum address") + } + contractAddress = common.HexToAddress(contractAddressRaw) + + if indexRaw == "" { + return fmt.Errorf("--index argument not specified") + } + index = new(big.Int) + index.SetString(indexRaw, 0) + + return nil + }, + RunE: func(cmd *cobra.Command, args []string) error { + client, clientErr := NewClient(rpc) + if clientErr != nil { + return clientErr + } + + contract, contractErr := NewStaker(contractAddress, client) + if contractErr != nil { + return contractErr + } + + callOpts := bind.CallOpts{} + SetCallParametersFromArgs(&callOpts, pending, fromAddressRaw, blockNumberRaw) + + session := StakerCallerSession{ + Contract: &contract.StakerCaller, + CallOpts: callOpts, + } + + var callErr error + capture0, callErr = session.TokenByIndex( + index, + ) + if callErr != nil { + return callErr + } + + cmd.Printf("0: %s\n", capture0.String()) + + return nil + }, + } + + cmd.Flags().StringVar(&rpc, "rpc", "", "URL of the JSONRPC API to use") + cmd.Flags().StringVar(&blockNumberRaw, "block", "", "Block number at which to call the view method") + cmd.Flags().BoolVar(&pending, "pending", false, "Set this flag if it's ok to call the view method against pending state") + cmd.Flags().UintVar(&timeout, "timeout", 60, "Timeout (in seconds) for interactions with the JSONRPC API") + cmd.Flags().StringVar(&contractAddressRaw, "contract", "", "Address of the contract to interact with") + cmd.Flags().StringVar(&fromAddressRaw, "from", "", "Optional address for caller of the view method") + + cmd.Flags().StringVar(&indexRaw, "index", "", "index argument") + + return cmd +} +func CreateTokenOfOwnerByIndexCommand() *cobra.Command { + var contractAddressRaw, rpc string + var contractAddress common.Address + var timeout uint + + var blockNumberRaw, fromAddressRaw string + var pending bool + + var owner common.Address + var ownerRaw string + var index *big.Int + var indexRaw string + + var capture0 *big.Int + + cmd := &cobra.Command{ + Use: "token-of-owner-by-index", + Short: "Call the TokenOfOwnerByIndex view method on a Staker contract", + PreRunE: func(cmd *cobra.Command, args []string) error { + if contractAddressRaw == "" { + return fmt.Errorf("--contract not specified") + } else if !common.IsHexAddress(contractAddressRaw) { + return fmt.Errorf("--contract is not a valid Ethereum address") + } + contractAddress = common.HexToAddress(contractAddressRaw) + + if ownerRaw == "" { + return fmt.Errorf("--owner argument not specified") + } else if !common.IsHexAddress(ownerRaw) { + return fmt.Errorf("--owner argument is not a valid Ethereum address") + } + owner = common.HexToAddress(ownerRaw) + + if indexRaw == "" { + return fmt.Errorf("--index argument not specified") + } + index = new(big.Int) + index.SetString(indexRaw, 0) + + return nil + }, + RunE: func(cmd *cobra.Command, args []string) error { + client, clientErr := NewClient(rpc) + if clientErr != nil { + return clientErr + } + + contract, contractErr := NewStaker(contractAddress, client) + if contractErr != nil { + return contractErr + } + + callOpts := bind.CallOpts{} + SetCallParametersFromArgs(&callOpts, pending, fromAddressRaw, blockNumberRaw) + + session := StakerCallerSession{ + Contract: &contract.StakerCaller, + CallOpts: callOpts, + } + + var callErr error + capture0, callErr = session.TokenOfOwnerByIndex( + owner, + index, + ) + if callErr != nil { + return callErr + } + + cmd.Printf("0: %s\n", capture0.String()) + + return nil + }, + } + + cmd.Flags().StringVar(&rpc, "rpc", "", "URL of the JSONRPC API to use") + cmd.Flags().StringVar(&blockNumberRaw, "block", "", "Block number at which to call the view method") + cmd.Flags().BoolVar(&pending, "pending", false, "Set this flag if it's ok to call the view method against pending state") + cmd.Flags().UintVar(&timeout, "timeout", 60, "Timeout (in seconds) for interactions with the JSONRPC API") + cmd.Flags().StringVar(&contractAddressRaw, "contract", "", "Address of the contract to interact with") + cmd.Flags().StringVar(&fromAddressRaw, "from", "", "Optional address for caller of the view method") + + cmd.Flags().StringVar(&ownerRaw, "owner", "", "owner argument") + cmd.Flags().StringVar(&indexRaw, "index", "", "index argument") + + return cmd +} + +func CreateSafeTransferFromCommand() *cobra.Command { + var keyfile, nonce, password, value, gasPrice, maxFeePerGas, maxPriorityFeePerGas, rpc, contractAddressRaw string + var gasLimit uint64 + var simulate bool + var timeout uint + var contractAddress common.Address + + var from0 common.Address + var from0Raw string + var to0 common.Address + var to0Raw string + var tokenId *big.Int + var tokenIdRaw string + + cmd := &cobra.Command{ + Use: "safe-transfer-from", + Short: "Execute the SafeTransferFrom method on a Staker contract", + PreRunE: func(cmd *cobra.Command, args []string) error { + if keyfile == "" { + return fmt.Errorf("--keystore not specified") + } + + if contractAddressRaw == "" { + return fmt.Errorf("--contract not specified") + } else if !common.IsHexAddress(contractAddressRaw) { + return fmt.Errorf("--contract is not a valid Ethereum address") + } + contractAddress = common.HexToAddress(contractAddressRaw) + + if from0Raw == "" { + return fmt.Errorf("--from-0 argument not specified") + } else if !common.IsHexAddress(from0Raw) { + return fmt.Errorf("--from-0 argument is not a valid Ethereum address") + } + from0 = common.HexToAddress(from0Raw) + + if to0Raw == "" { + return fmt.Errorf("--to-0 argument not specified") + } else if !common.IsHexAddress(to0Raw) { + return fmt.Errorf("--to-0 argument is not a valid Ethereum address") + } + to0 = common.HexToAddress(to0Raw) + + if tokenIdRaw == "" { + return fmt.Errorf("--token-id argument not specified") + } + tokenId = new(big.Int) + tokenId.SetString(tokenIdRaw, 0) + + return nil + }, + RunE: func(cmd *cobra.Command, args []string) error { + client, clientErr := NewClient(rpc) + if clientErr != nil { + return clientErr + } + + key, keyErr := KeyFromFile(keyfile, password) + if keyErr != nil { + return keyErr + } + + chainIDCtx, cancelChainIDCtx := NewChainContext(timeout) + defer cancelChainIDCtx() + chainID, chainIDErr := client.ChainID(chainIDCtx) + if chainIDErr != nil { + return chainIDErr + } + + transactionOpts, transactionOptsErr := bind.NewKeyedTransactorWithChainID(key.PrivateKey, chainID) + if transactionOptsErr != nil { + return transactionOptsErr + } + + SetTransactionParametersFromArgs(transactionOpts, nonce, value, gasPrice, maxFeePerGas, maxPriorityFeePerGas, gasLimit, simulate) + + contract, contractErr := NewStaker(contractAddress, client) + if contractErr != nil { + return contractErr + } + + session := StakerTransactorSession{ + Contract: &contract.StakerTransactor, + TransactOpts: *transactionOpts, + } + + transaction, transactionErr := session.SafeTransferFrom( + from0, + to0, + tokenId, + ) + if transactionErr != nil { + return transactionErr + } + + cmd.Printf("Transaction hash: %s\n", transaction.Hash().Hex()) + if transactionOpts.NoSend { + estimationMessage := ethereum.CallMsg{ + From: transactionOpts.From, + To: &contractAddress, + Data: transaction.Data(), + } + + gasEstimationCtx, cancelGasEstimationCtx := NewChainContext(timeout) + defer cancelGasEstimationCtx() + + gasEstimate, gasEstimateErr := client.EstimateGas(gasEstimationCtx, estimationMessage) + if gasEstimateErr != nil { + return gasEstimateErr + } + + transactionBinary, transactionBinaryErr := transaction.MarshalBinary() + if transactionBinaryErr != nil { + return transactionBinaryErr + } + transactionBinaryHex := hex.EncodeToString(transactionBinary) + + cmd.Printf("Transaction: %s\nEstimated gas: %d\n", transactionBinaryHex, gasEstimate) + } else { + cmd.Println("Transaction submitted") + } + + return nil + }, + } + + cmd.Flags().StringVar(&rpc, "rpc", "", "URL of the JSONRPC API to use") + cmd.Flags().StringVar(&keyfile, "keyfile", "", "Path to the keystore file to use for the transaction") + cmd.Flags().StringVar(&password, "password", "", "Password to use to unlock the keystore (if not specified, you will be prompted for the password when the command executes)") + cmd.Flags().StringVar(&nonce, "nonce", "", "Nonce to use for the transaction") + cmd.Flags().StringVar(&value, "value", "", "Value to send with the transaction") + cmd.Flags().StringVar(&gasPrice, "gas-price", "", "Gas price to use for the transaction") + cmd.Flags().StringVar(&maxFeePerGas, "max-fee-per-gas", "", "Maximum fee per gas to use for the (EIP-1559) transaction") + cmd.Flags().StringVar(&maxPriorityFeePerGas, "max-priority-fee-per-gas", "", "Maximum priority fee per gas to use for the (EIP-1559) transaction") + cmd.Flags().Uint64Var(&gasLimit, "gas-limit", 0, "Gas limit for the transaction") + cmd.Flags().BoolVar(&simulate, "simulate", false, "Simulate the transaction without sending it") + cmd.Flags().UintVar(&timeout, "timeout", 60, "Timeout (in seconds) for interactions with the JSONRPC API") + cmd.Flags().StringVar(&contractAddressRaw, "contract", "", "Address of the contract to interact with") + + cmd.Flags().StringVar(&from0Raw, "from-0", "", "from-0 argument") + cmd.Flags().StringVar(&to0Raw, "to-0", "", "to-0 argument") + cmd.Flags().StringVar(&tokenIdRaw, "token-id", "", "token-id argument") + + return cmd +} +func CreateSafeTransferFrom0Command() *cobra.Command { + var keyfile, nonce, password, value, gasPrice, maxFeePerGas, maxPriorityFeePerGas, rpc, contractAddressRaw string + var gasLimit uint64 + var simulate bool + var timeout uint + var contractAddress common.Address + + var from0 common.Address + var from0Raw string + var to0 common.Address + var to0Raw string + var tokenId *big.Int + var tokenIdRaw string + var data []byte + var dataRaw string + + cmd := &cobra.Command{ + Use: "safe-transfer-from-0", + Short: "Execute the SafeTransferFrom0 method on a Staker contract", + PreRunE: func(cmd *cobra.Command, args []string) error { + if keyfile == "" { + return fmt.Errorf("--keystore not specified") + } + + if contractAddressRaw == "" { + return fmt.Errorf("--contract not specified") + } else if !common.IsHexAddress(contractAddressRaw) { + return fmt.Errorf("--contract is not a valid Ethereum address") + } + contractAddress = common.HexToAddress(contractAddressRaw) + + if from0Raw == "" { + return fmt.Errorf("--from-0 argument not specified") + } else if !common.IsHexAddress(from0Raw) { + return fmt.Errorf("--from-0 argument is not a valid Ethereum address") + } + from0 = common.HexToAddress(from0Raw) + + if to0Raw == "" { + return fmt.Errorf("--to-0 argument not specified") + } else if !common.IsHexAddress(to0Raw) { + return fmt.Errorf("--to-0 argument is not a valid Ethereum address") + } + to0 = common.HexToAddress(to0Raw) + + if tokenIdRaw == "" { + return fmt.Errorf("--token-id argument not specified") + } + tokenId = new(big.Int) + tokenId.SetString(tokenIdRaw, 0) + + var hexDecodedataErr error + + data, hexDecodedataErr = hex.DecodeString(dataRaw) + if hexDecodedataErr != nil { + return hexDecodedataErr + } + + return nil + }, + RunE: func(cmd *cobra.Command, args []string) error { + client, clientErr := NewClient(rpc) + if clientErr != nil { + return clientErr + } + + key, keyErr := KeyFromFile(keyfile, password) + if keyErr != nil { + return keyErr + } + + chainIDCtx, cancelChainIDCtx := NewChainContext(timeout) + defer cancelChainIDCtx() + chainID, chainIDErr := client.ChainID(chainIDCtx) + if chainIDErr != nil { + return chainIDErr + } + + transactionOpts, transactionOptsErr := bind.NewKeyedTransactorWithChainID(key.PrivateKey, chainID) + if transactionOptsErr != nil { + return transactionOptsErr + } + + SetTransactionParametersFromArgs(transactionOpts, nonce, value, gasPrice, maxFeePerGas, maxPriorityFeePerGas, gasLimit, simulate) + + contract, contractErr := NewStaker(contractAddress, client) + if contractErr != nil { + return contractErr + } + + session := StakerTransactorSession{ + Contract: &contract.StakerTransactor, + TransactOpts: *transactionOpts, + } + + transaction, transactionErr := session.SafeTransferFrom0( + from0, + to0, + tokenId, + data, + ) + if transactionErr != nil { + return transactionErr + } + + cmd.Printf("Transaction hash: %s\n", transaction.Hash().Hex()) + if transactionOpts.NoSend { + estimationMessage := ethereum.CallMsg{ + From: transactionOpts.From, + To: &contractAddress, + Data: transaction.Data(), + } + + gasEstimationCtx, cancelGasEstimationCtx := NewChainContext(timeout) + defer cancelGasEstimationCtx() + + gasEstimate, gasEstimateErr := client.EstimateGas(gasEstimationCtx, estimationMessage) + if gasEstimateErr != nil { + return gasEstimateErr + } + + transactionBinary, transactionBinaryErr := transaction.MarshalBinary() + if transactionBinaryErr != nil { + return transactionBinaryErr + } + transactionBinaryHex := hex.EncodeToString(transactionBinary) + + cmd.Printf("Transaction: %s\nEstimated gas: %d\n", transactionBinaryHex, gasEstimate) + } else { + cmd.Println("Transaction submitted") + } + + return nil + }, + } + + cmd.Flags().StringVar(&rpc, "rpc", "", "URL of the JSONRPC API to use") + cmd.Flags().StringVar(&keyfile, "keyfile", "", "Path to the keystore file to use for the transaction") + cmd.Flags().StringVar(&password, "password", "", "Password to use to unlock the keystore (if not specified, you will be prompted for the password when the command executes)") + cmd.Flags().StringVar(&nonce, "nonce", "", "Nonce to use for the transaction") + cmd.Flags().StringVar(&value, "value", "", "Value to send with the transaction") + cmd.Flags().StringVar(&gasPrice, "gas-price", "", "Gas price to use for the transaction") + cmd.Flags().StringVar(&maxFeePerGas, "max-fee-per-gas", "", "Maximum fee per gas to use for the (EIP-1559) transaction") + cmd.Flags().StringVar(&maxPriorityFeePerGas, "max-priority-fee-per-gas", "", "Maximum priority fee per gas to use for the (EIP-1559) transaction") + cmd.Flags().Uint64Var(&gasLimit, "gas-limit", 0, "Gas limit for the transaction") + cmd.Flags().BoolVar(&simulate, "simulate", false, "Simulate the transaction without sending it") + cmd.Flags().UintVar(&timeout, "timeout", 60, "Timeout (in seconds) for interactions with the JSONRPC API") + cmd.Flags().StringVar(&contractAddressRaw, "contract", "", "Address of the contract to interact with") + + cmd.Flags().StringVar(&from0Raw, "from-0", "", "from-0 argument") + cmd.Flags().StringVar(&to0Raw, "to-0", "", "to-0 argument") + cmd.Flags().StringVar(&tokenIdRaw, "token-id", "", "token-id argument") + cmd.Flags().StringVar(&dataRaw, "data", "", "data argument") + + return cmd +} +func CreateSetApprovalForAllCommand() *cobra.Command { + var keyfile, nonce, password, value, gasPrice, maxFeePerGas, maxPriorityFeePerGas, rpc, contractAddressRaw string + var gasLimit uint64 + var simulate bool + var timeout uint + var contractAddress common.Address + + var operator common.Address + var operatorRaw string + var approved bool + var approvedRaw string + + cmd := &cobra.Command{ + Use: "set-approval-for-all", + Short: "Execute the SetApprovalForAll method on a Staker contract", + PreRunE: func(cmd *cobra.Command, args []string) error { + if keyfile == "" { + return fmt.Errorf("--keystore not specified") + } + + if contractAddressRaw == "" { + return fmt.Errorf("--contract not specified") + } else if !common.IsHexAddress(contractAddressRaw) { + return fmt.Errorf("--contract is not a valid Ethereum address") + } + contractAddress = common.HexToAddress(contractAddressRaw) + + if operatorRaw == "" { + return fmt.Errorf("--operator argument not specified") + } else if !common.IsHexAddress(operatorRaw) { + return fmt.Errorf("--operator argument is not a valid Ethereum address") + } + operator = common.HexToAddress(operatorRaw) + + approvedRawLower := strings.ToLower(approvedRaw) + switch approvedRawLower { + case "true", "t", "y", "yes", "1": + approved = true + case "false", "f", "n", "no", "0": + approved = false + default: + return fmt.Errorf("--approved argument is not valid (value: %s)", approvedRaw) + } + + return nil + }, + RunE: func(cmd *cobra.Command, args []string) error { + client, clientErr := NewClient(rpc) + if clientErr != nil { + return clientErr + } + + key, keyErr := KeyFromFile(keyfile, password) + if keyErr != nil { + return keyErr + } + + chainIDCtx, cancelChainIDCtx := NewChainContext(timeout) + defer cancelChainIDCtx() + chainID, chainIDErr := client.ChainID(chainIDCtx) + if chainIDErr != nil { + return chainIDErr + } + + transactionOpts, transactionOptsErr := bind.NewKeyedTransactorWithChainID(key.PrivateKey, chainID) + if transactionOptsErr != nil { + return transactionOptsErr + } + + SetTransactionParametersFromArgs(transactionOpts, nonce, value, gasPrice, maxFeePerGas, maxPriorityFeePerGas, gasLimit, simulate) + + contract, contractErr := NewStaker(contractAddress, client) + if contractErr != nil { + return contractErr + } + + session := StakerTransactorSession{ + Contract: &contract.StakerTransactor, + TransactOpts: *transactionOpts, + } + + transaction, transactionErr := session.SetApprovalForAll( + operator, + approved, + ) + if transactionErr != nil { + return transactionErr + } + + cmd.Printf("Transaction hash: %s\n", transaction.Hash().Hex()) + if transactionOpts.NoSend { + estimationMessage := ethereum.CallMsg{ + From: transactionOpts.From, + To: &contractAddress, + Data: transaction.Data(), + } + + gasEstimationCtx, cancelGasEstimationCtx := NewChainContext(timeout) + defer cancelGasEstimationCtx() + + gasEstimate, gasEstimateErr := client.EstimateGas(gasEstimationCtx, estimationMessage) + if gasEstimateErr != nil { + return gasEstimateErr + } + + transactionBinary, transactionBinaryErr := transaction.MarshalBinary() + if transactionBinaryErr != nil { + return transactionBinaryErr + } + transactionBinaryHex := hex.EncodeToString(transactionBinary) + + cmd.Printf("Transaction: %s\nEstimated gas: %d\n", transactionBinaryHex, gasEstimate) + } else { + cmd.Println("Transaction submitted") + } + + return nil + }, + } + + cmd.Flags().StringVar(&rpc, "rpc", "", "URL of the JSONRPC API to use") + cmd.Flags().StringVar(&keyfile, "keyfile", "", "Path to the keystore file to use for the transaction") + cmd.Flags().StringVar(&password, "password", "", "Password to use to unlock the keystore (if not specified, you will be prompted for the password when the command executes)") + cmd.Flags().StringVar(&nonce, "nonce", "", "Nonce to use for the transaction") + cmd.Flags().StringVar(&value, "value", "", "Value to send with the transaction") + cmd.Flags().StringVar(&gasPrice, "gas-price", "", "Gas price to use for the transaction") + cmd.Flags().StringVar(&maxFeePerGas, "max-fee-per-gas", "", "Maximum fee per gas to use for the (EIP-1559) transaction") + cmd.Flags().StringVar(&maxPriorityFeePerGas, "max-priority-fee-per-gas", "", "Maximum priority fee per gas to use for the (EIP-1559) transaction") + cmd.Flags().Uint64Var(&gasLimit, "gas-limit", 0, "Gas limit for the transaction") + cmd.Flags().BoolVar(&simulate, "simulate", false, "Simulate the transaction without sending it") + cmd.Flags().UintVar(&timeout, "timeout", 60, "Timeout (in seconds) for interactions with the JSONRPC API") + cmd.Flags().StringVar(&contractAddressRaw, "contract", "", "Address of the contract to interact with") + + cmd.Flags().StringVar(&operatorRaw, "operator", "", "operator argument") + cmd.Flags().StringVar(&approvedRaw, "approved", "", "approved argument (true, t, y, yes, 1 OR false, f, n, no, 0)") + + return cmd +} +func CreateTransferFromCommand() *cobra.Command { + var keyfile, nonce, password, value, gasPrice, maxFeePerGas, maxPriorityFeePerGas, rpc, contractAddressRaw string + var gasLimit uint64 + var simulate bool + var timeout uint + var contractAddress common.Address + + var from0 common.Address + var from0Raw string + var to0 common.Address + var to0Raw string + var tokenId *big.Int + var tokenIdRaw string + + cmd := &cobra.Command{ + Use: "transfer-from", + Short: "Execute the TransferFrom method on a Staker contract", + PreRunE: func(cmd *cobra.Command, args []string) error { + if keyfile == "" { + return fmt.Errorf("--keystore not specified") + } + + if contractAddressRaw == "" { + return fmt.Errorf("--contract not specified") + } else if !common.IsHexAddress(contractAddressRaw) { + return fmt.Errorf("--contract is not a valid Ethereum address") + } + contractAddress = common.HexToAddress(contractAddressRaw) + + if from0Raw == "" { + return fmt.Errorf("--from-0 argument not specified") + } else if !common.IsHexAddress(from0Raw) { + return fmt.Errorf("--from-0 argument is not a valid Ethereum address") + } + from0 = common.HexToAddress(from0Raw) + + if to0Raw == "" { + return fmt.Errorf("--to-0 argument not specified") + } else if !common.IsHexAddress(to0Raw) { + return fmt.Errorf("--to-0 argument is not a valid Ethereum address") + } + to0 = common.HexToAddress(to0Raw) + + if tokenIdRaw == "" { + return fmt.Errorf("--token-id argument not specified") + } + tokenId = new(big.Int) + tokenId.SetString(tokenIdRaw, 0) + + return nil + }, + RunE: func(cmd *cobra.Command, args []string) error { + client, clientErr := NewClient(rpc) + if clientErr != nil { + return clientErr + } + + key, keyErr := KeyFromFile(keyfile, password) + if keyErr != nil { + return keyErr + } + + chainIDCtx, cancelChainIDCtx := NewChainContext(timeout) + defer cancelChainIDCtx() + chainID, chainIDErr := client.ChainID(chainIDCtx) + if chainIDErr != nil { + return chainIDErr + } + + transactionOpts, transactionOptsErr := bind.NewKeyedTransactorWithChainID(key.PrivateKey, chainID) + if transactionOptsErr != nil { + return transactionOptsErr + } + + SetTransactionParametersFromArgs(transactionOpts, nonce, value, gasPrice, maxFeePerGas, maxPriorityFeePerGas, gasLimit, simulate) + + contract, contractErr := NewStaker(contractAddress, client) + if contractErr != nil { + return contractErr + } + + session := StakerTransactorSession{ + Contract: &contract.StakerTransactor, + TransactOpts: *transactionOpts, + } + + transaction, transactionErr := session.TransferFrom( + from0, + to0, + tokenId, + ) + if transactionErr != nil { + return transactionErr + } + + cmd.Printf("Transaction hash: %s\n", transaction.Hash().Hex()) + if transactionOpts.NoSend { + estimationMessage := ethereum.CallMsg{ + From: transactionOpts.From, + To: &contractAddress, + Data: transaction.Data(), + } + + gasEstimationCtx, cancelGasEstimationCtx := NewChainContext(timeout) + defer cancelGasEstimationCtx() + + gasEstimate, gasEstimateErr := client.EstimateGas(gasEstimationCtx, estimationMessage) + if gasEstimateErr != nil { + return gasEstimateErr + } + + transactionBinary, transactionBinaryErr := transaction.MarshalBinary() + if transactionBinaryErr != nil { + return transactionBinaryErr + } + transactionBinaryHex := hex.EncodeToString(transactionBinary) + + cmd.Printf("Transaction: %s\nEstimated gas: %d\n", transactionBinaryHex, gasEstimate) + } else { + cmd.Println("Transaction submitted") + } + + return nil + }, + } + + cmd.Flags().StringVar(&rpc, "rpc", "", "URL of the JSONRPC API to use") + cmd.Flags().StringVar(&keyfile, "keyfile", "", "Path to the keystore file to use for the transaction") + cmd.Flags().StringVar(&password, "password", "", "Password to use to unlock the keystore (if not specified, you will be prompted for the password when the command executes)") + cmd.Flags().StringVar(&nonce, "nonce", "", "Nonce to use for the transaction") + cmd.Flags().StringVar(&value, "value", "", "Value to send with the transaction") + cmd.Flags().StringVar(&gasPrice, "gas-price", "", "Gas price to use for the transaction") + cmd.Flags().StringVar(&maxFeePerGas, "max-fee-per-gas", "", "Maximum fee per gas to use for the (EIP-1559) transaction") + cmd.Flags().StringVar(&maxPriorityFeePerGas, "max-priority-fee-per-gas", "", "Maximum priority fee per gas to use for the (EIP-1559) transaction") + cmd.Flags().Uint64Var(&gasLimit, "gas-limit", 0, "Gas limit for the transaction") + cmd.Flags().BoolVar(&simulate, "simulate", false, "Simulate the transaction without sending it") + cmd.Flags().UintVar(&timeout, "timeout", 60, "Timeout (in seconds) for interactions with the JSONRPC API") + cmd.Flags().StringVar(&contractAddressRaw, "contract", "", "Address of the contract to interact with") + + cmd.Flags().StringVar(&from0Raw, "from-0", "", "from-0 argument") + cmd.Flags().StringVar(&to0Raw, "to-0", "", "to-0 argument") + cmd.Flags().StringVar(&tokenIdRaw, "token-id", "", "token-id argument") + + return cmd +} +func CreateTransferPoolAdministrationCommand() *cobra.Command { + var keyfile, nonce, password, value, gasPrice, maxFeePerGas, maxPriorityFeePerGas, rpc, contractAddressRaw string + var gasLimit uint64 + var simulate bool + var timeout uint + var contractAddress common.Address + + var poolID *big.Int + var poolIDRaw string + var newAdministrator common.Address + var newAdministratorRaw string + + cmd := &cobra.Command{ + Use: "transfer-pool-administration", + Short: "Execute the TransferPoolAdministration method on a Staker contract", + PreRunE: func(cmd *cobra.Command, args []string) error { + if keyfile == "" { + return fmt.Errorf("--keystore not specified") + } + + if contractAddressRaw == "" { + return fmt.Errorf("--contract not specified") + } else if !common.IsHexAddress(contractAddressRaw) { + return fmt.Errorf("--contract is not a valid Ethereum address") + } + contractAddress = common.HexToAddress(contractAddressRaw) + + if poolIDRaw == "" { + return fmt.Errorf("--pool-id argument not specified") + } + poolID = new(big.Int) + poolID.SetString(poolIDRaw, 0) + + if newAdministratorRaw == "" { + return fmt.Errorf("--new-administrator argument not specified") + } else if !common.IsHexAddress(newAdministratorRaw) { + return fmt.Errorf("--new-administrator argument is not a valid Ethereum address") + } + newAdministrator = common.HexToAddress(newAdministratorRaw) + + return nil + }, + RunE: func(cmd *cobra.Command, args []string) error { + client, clientErr := NewClient(rpc) + if clientErr != nil { + return clientErr + } + + key, keyErr := KeyFromFile(keyfile, password) + if keyErr != nil { + return keyErr + } + + chainIDCtx, cancelChainIDCtx := NewChainContext(timeout) + defer cancelChainIDCtx() + chainID, chainIDErr := client.ChainID(chainIDCtx) + if chainIDErr != nil { + return chainIDErr + } + + transactionOpts, transactionOptsErr := bind.NewKeyedTransactorWithChainID(key.PrivateKey, chainID) + if transactionOptsErr != nil { + return transactionOptsErr + } + + SetTransactionParametersFromArgs(transactionOpts, nonce, value, gasPrice, maxFeePerGas, maxPriorityFeePerGas, gasLimit, simulate) + + contract, contractErr := NewStaker(contractAddress, client) + if contractErr != nil { + return contractErr + } + + session := StakerTransactorSession{ + Contract: &contract.StakerTransactor, + TransactOpts: *transactionOpts, + } + + transaction, transactionErr := session.TransferPoolAdministration( + poolID, + newAdministrator, + ) + if transactionErr != nil { + return transactionErr + } + + cmd.Printf("Transaction hash: %s\n", transaction.Hash().Hex()) + if transactionOpts.NoSend { + estimationMessage := ethereum.CallMsg{ + From: transactionOpts.From, + To: &contractAddress, + Data: transaction.Data(), + } + + gasEstimationCtx, cancelGasEstimationCtx := NewChainContext(timeout) + defer cancelGasEstimationCtx() + + gasEstimate, gasEstimateErr := client.EstimateGas(gasEstimationCtx, estimationMessage) + if gasEstimateErr != nil { + return gasEstimateErr + } + + transactionBinary, transactionBinaryErr := transaction.MarshalBinary() + if transactionBinaryErr != nil { + return transactionBinaryErr + } + transactionBinaryHex := hex.EncodeToString(transactionBinary) + + cmd.Printf("Transaction: %s\nEstimated gas: %d\n", transactionBinaryHex, gasEstimate) + } else { + cmd.Println("Transaction submitted") + } + + return nil + }, + } + + cmd.Flags().StringVar(&rpc, "rpc", "", "URL of the JSONRPC API to use") + cmd.Flags().StringVar(&keyfile, "keyfile", "", "Path to the keystore file to use for the transaction") + cmd.Flags().StringVar(&password, "password", "", "Password to use to unlock the keystore (if not specified, you will be prompted for the password when the command executes)") + cmd.Flags().StringVar(&nonce, "nonce", "", "Nonce to use for the transaction") + cmd.Flags().StringVar(&value, "value", "", "Value to send with the transaction") + cmd.Flags().StringVar(&gasPrice, "gas-price", "", "Gas price to use for the transaction") + cmd.Flags().StringVar(&maxFeePerGas, "max-fee-per-gas", "", "Maximum fee per gas to use for the (EIP-1559) transaction") + cmd.Flags().StringVar(&maxPriorityFeePerGas, "max-priority-fee-per-gas", "", "Maximum priority fee per gas to use for the (EIP-1559) transaction") + cmd.Flags().Uint64Var(&gasLimit, "gas-limit", 0, "Gas limit for the transaction") + cmd.Flags().BoolVar(&simulate, "simulate", false, "Simulate the transaction without sending it") + cmd.Flags().UintVar(&timeout, "timeout", 60, "Timeout (in seconds) for interactions with the JSONRPC API") + cmd.Flags().StringVar(&contractAddressRaw, "contract", "", "Address of the contract to interact with") + + cmd.Flags().StringVar(&poolIDRaw, "pool-id", "", "pool-id argument") + cmd.Flags().StringVar(&newAdministratorRaw, "new-administrator", "", "new-administrator argument") + + return cmd +} +func CreateUpdatePoolConfigurationCommand() *cobra.Command { + var keyfile, nonce, password, value, gasPrice, maxFeePerGas, maxPriorityFeePerGas, rpc, contractAddressRaw string + var gasLimit uint64 + var simulate bool + var timeout uint + var contractAddress common.Address + + var poolID *big.Int + var poolIDRaw string + var changeTransferability bool + var changeTransferabilityRaw string + var transferable bool + var transferableRaw string + var changeLockup bool + var changeLockupRaw string + var lockupSeconds *big.Int + var lockupSecondsRaw string + var changeCooldown bool + var changeCooldownRaw string + var cooldownSeconds *big.Int + var cooldownSecondsRaw string + + cmd := &cobra.Command{ + Use: "update-pool-configuration", + Short: "Execute the UpdatePoolConfiguration method on a Staker contract", + PreRunE: func(cmd *cobra.Command, args []string) error { + if keyfile == "" { + return fmt.Errorf("--keystore not specified") + } + + if contractAddressRaw == "" { + return fmt.Errorf("--contract not specified") + } else if !common.IsHexAddress(contractAddressRaw) { + return fmt.Errorf("--contract is not a valid Ethereum address") + } + contractAddress = common.HexToAddress(contractAddressRaw) + + if poolIDRaw == "" { + return fmt.Errorf("--pool-id argument not specified") + } + poolID = new(big.Int) + poolID.SetString(poolIDRaw, 0) + + changeTransferabilityRawLower := strings.ToLower(changeTransferabilityRaw) + switch changeTransferabilityRawLower { + case "true", "t", "y", "yes", "1": + changeTransferability = true + case "false", "f", "n", "no", "0": + changeTransferability = false + default: + return fmt.Errorf("--change-transferability argument is not valid (value: %s)", changeTransferabilityRaw) + } + + transferableRawLower := strings.ToLower(transferableRaw) + switch transferableRawLower { + case "true", "t", "y", "yes", "1": + transferable = true + case "false", "f", "n", "no", "0": + transferable = false + default: + return fmt.Errorf("--transferable argument is not valid (value: %s)", transferableRaw) + } + + changeLockupRawLower := strings.ToLower(changeLockupRaw) + switch changeLockupRawLower { + case "true", "t", "y", "yes", "1": + changeLockup = true + case "false", "f", "n", "no", "0": + changeLockup = false + default: + return fmt.Errorf("--change-lockup argument is not valid (value: %s)", changeLockupRaw) + } + + if lockupSecondsRaw == "" { + return fmt.Errorf("--lockup-seconds argument not specified") + } + lockupSeconds = new(big.Int) + lockupSeconds.SetString(lockupSecondsRaw, 0) + + changeCooldownRawLower := strings.ToLower(changeCooldownRaw) + switch changeCooldownRawLower { + case "true", "t", "y", "yes", "1": + changeCooldown = true + case "false", "f", "n", "no", "0": + changeCooldown = false + default: + return fmt.Errorf("--change-cooldown argument is not valid (value: %s)", changeCooldownRaw) + } + + if cooldownSecondsRaw == "" { + return fmt.Errorf("--cooldown-seconds argument not specified") + } + cooldownSeconds = new(big.Int) + cooldownSeconds.SetString(cooldownSecondsRaw, 0) + + return nil + }, + RunE: func(cmd *cobra.Command, args []string) error { + client, clientErr := NewClient(rpc) + if clientErr != nil { + return clientErr + } + + key, keyErr := KeyFromFile(keyfile, password) + if keyErr != nil { + return keyErr + } + + chainIDCtx, cancelChainIDCtx := NewChainContext(timeout) + defer cancelChainIDCtx() + chainID, chainIDErr := client.ChainID(chainIDCtx) + if chainIDErr != nil { + return chainIDErr + } + + transactionOpts, transactionOptsErr := bind.NewKeyedTransactorWithChainID(key.PrivateKey, chainID) + if transactionOptsErr != nil { + return transactionOptsErr + } + + SetTransactionParametersFromArgs(transactionOpts, nonce, value, gasPrice, maxFeePerGas, maxPriorityFeePerGas, gasLimit, simulate) + + contract, contractErr := NewStaker(contractAddress, client) + if contractErr != nil { + return contractErr + } + + session := StakerTransactorSession{ + Contract: &contract.StakerTransactor, + TransactOpts: *transactionOpts, + } + + transaction, transactionErr := session.UpdatePoolConfiguration( + poolID, + changeTransferability, + transferable, + changeLockup, + lockupSeconds, + changeCooldown, + cooldownSeconds, + ) + if transactionErr != nil { + return transactionErr + } + + cmd.Printf("Transaction hash: %s\n", transaction.Hash().Hex()) + if transactionOpts.NoSend { + estimationMessage := ethereum.CallMsg{ + From: transactionOpts.From, + To: &contractAddress, + Data: transaction.Data(), + } + + gasEstimationCtx, cancelGasEstimationCtx := NewChainContext(timeout) + defer cancelGasEstimationCtx() + + gasEstimate, gasEstimateErr := client.EstimateGas(gasEstimationCtx, estimationMessage) + if gasEstimateErr != nil { + return gasEstimateErr + } + + transactionBinary, transactionBinaryErr := transaction.MarshalBinary() + if transactionBinaryErr != nil { + return transactionBinaryErr + } + transactionBinaryHex := hex.EncodeToString(transactionBinary) + + cmd.Printf("Transaction: %s\nEstimated gas: %d\n", transactionBinaryHex, gasEstimate) + } else { + cmd.Println("Transaction submitted") + } + + return nil + }, + } + + cmd.Flags().StringVar(&rpc, "rpc", "", "URL of the JSONRPC API to use") + cmd.Flags().StringVar(&keyfile, "keyfile", "", "Path to the keystore file to use for the transaction") + cmd.Flags().StringVar(&password, "password", "", "Password to use to unlock the keystore (if not specified, you will be prompted for the password when the command executes)") + cmd.Flags().StringVar(&nonce, "nonce", "", "Nonce to use for the transaction") + cmd.Flags().StringVar(&value, "value", "", "Value to send with the transaction") + cmd.Flags().StringVar(&gasPrice, "gas-price", "", "Gas price to use for the transaction") + cmd.Flags().StringVar(&maxFeePerGas, "max-fee-per-gas", "", "Maximum fee per gas to use for the (EIP-1559) transaction") + cmd.Flags().StringVar(&maxPriorityFeePerGas, "max-priority-fee-per-gas", "", "Maximum priority fee per gas to use for the (EIP-1559) transaction") + cmd.Flags().Uint64Var(&gasLimit, "gas-limit", 0, "Gas limit for the transaction") + cmd.Flags().BoolVar(&simulate, "simulate", false, "Simulate the transaction without sending it") + cmd.Flags().UintVar(&timeout, "timeout", 60, "Timeout (in seconds) for interactions with the JSONRPC API") + cmd.Flags().StringVar(&contractAddressRaw, "contract", "", "Address of the contract to interact with") + + cmd.Flags().StringVar(&poolIDRaw, "pool-id", "", "pool-id argument") + cmd.Flags().StringVar(&changeTransferabilityRaw, "change-transferability", "", "change-transferability argument (true, t, y, yes, 1 OR false, f, n, no, 0)") + cmd.Flags().StringVar(&transferableRaw, "transferable", "", "transferable argument (true, t, y, yes, 1 OR false, f, n, no, 0)") + cmd.Flags().StringVar(&changeLockupRaw, "change-lockup", "", "change-lockup argument (true, t, y, yes, 1 OR false, f, n, no, 0)") + cmd.Flags().StringVar(&lockupSecondsRaw, "lockup-seconds", "", "lockup-seconds argument") + cmd.Flags().StringVar(&changeCooldownRaw, "change-cooldown", "", "change-cooldown argument (true, t, y, yes, 1 OR false, f, n, no, 0)") + cmd.Flags().StringVar(&cooldownSecondsRaw, "cooldown-seconds", "", "cooldown-seconds argument") + + return cmd +} +func CreateApproveCommand() *cobra.Command { + var keyfile, nonce, password, value, gasPrice, maxFeePerGas, maxPriorityFeePerGas, rpc, contractAddressRaw string + var gasLimit uint64 + var simulate bool + var timeout uint + var contractAddress common.Address + + var to0 common.Address + var to0Raw string + var tokenId *big.Int + var tokenIdRaw string + + cmd := &cobra.Command{ + Use: "approve", + Short: "Execute the Approve method on a Staker contract", + PreRunE: func(cmd *cobra.Command, args []string) error { + if keyfile == "" { + return fmt.Errorf("--keystore not specified") + } + + if contractAddressRaw == "" { + return fmt.Errorf("--contract not specified") + } else if !common.IsHexAddress(contractAddressRaw) { + return fmt.Errorf("--contract is not a valid Ethereum address") + } + contractAddress = common.HexToAddress(contractAddressRaw) + + if to0Raw == "" { + return fmt.Errorf("--to-0 argument not specified") + } else if !common.IsHexAddress(to0Raw) { + return fmt.Errorf("--to-0 argument is not a valid Ethereum address") + } + to0 = common.HexToAddress(to0Raw) + + if tokenIdRaw == "" { + return fmt.Errorf("--token-id argument not specified") + } + tokenId = new(big.Int) + tokenId.SetString(tokenIdRaw, 0) + + return nil + }, + RunE: func(cmd *cobra.Command, args []string) error { + client, clientErr := NewClient(rpc) + if clientErr != nil { + return clientErr + } + + key, keyErr := KeyFromFile(keyfile, password) + if keyErr != nil { + return keyErr + } + + chainIDCtx, cancelChainIDCtx := NewChainContext(timeout) + defer cancelChainIDCtx() + chainID, chainIDErr := client.ChainID(chainIDCtx) + if chainIDErr != nil { + return chainIDErr + } + + transactionOpts, transactionOptsErr := bind.NewKeyedTransactorWithChainID(key.PrivateKey, chainID) + if transactionOptsErr != nil { + return transactionOptsErr + } + + SetTransactionParametersFromArgs(transactionOpts, nonce, value, gasPrice, maxFeePerGas, maxPriorityFeePerGas, gasLimit, simulate) + + contract, contractErr := NewStaker(contractAddress, client) + if contractErr != nil { + return contractErr + } + + session := StakerTransactorSession{ + Contract: &contract.StakerTransactor, + TransactOpts: *transactionOpts, + } + + transaction, transactionErr := session.Approve( + to0, + tokenId, + ) + if transactionErr != nil { + return transactionErr + } + + cmd.Printf("Transaction hash: %s\n", transaction.Hash().Hex()) + if transactionOpts.NoSend { + estimationMessage := ethereum.CallMsg{ + From: transactionOpts.From, + To: &contractAddress, + Data: transaction.Data(), + } + + gasEstimationCtx, cancelGasEstimationCtx := NewChainContext(timeout) + defer cancelGasEstimationCtx() + + gasEstimate, gasEstimateErr := client.EstimateGas(gasEstimationCtx, estimationMessage) + if gasEstimateErr != nil { + return gasEstimateErr + } + + transactionBinary, transactionBinaryErr := transaction.MarshalBinary() + if transactionBinaryErr != nil { + return transactionBinaryErr + } + transactionBinaryHex := hex.EncodeToString(transactionBinary) + + cmd.Printf("Transaction: %s\nEstimated gas: %d\n", transactionBinaryHex, gasEstimate) + } else { + cmd.Println("Transaction submitted") + } + + return nil + }, + } + + cmd.Flags().StringVar(&rpc, "rpc", "", "URL of the JSONRPC API to use") + cmd.Flags().StringVar(&keyfile, "keyfile", "", "Path to the keystore file to use for the transaction") + cmd.Flags().StringVar(&password, "password", "", "Password to use to unlock the keystore (if not specified, you will be prompted for the password when the command executes)") + cmd.Flags().StringVar(&nonce, "nonce", "", "Nonce to use for the transaction") + cmd.Flags().StringVar(&value, "value", "", "Value to send with the transaction") + cmd.Flags().StringVar(&gasPrice, "gas-price", "", "Gas price to use for the transaction") + cmd.Flags().StringVar(&maxFeePerGas, "max-fee-per-gas", "", "Maximum fee per gas to use for the (EIP-1559) transaction") + cmd.Flags().StringVar(&maxPriorityFeePerGas, "max-priority-fee-per-gas", "", "Maximum priority fee per gas to use for the (EIP-1559) transaction") + cmd.Flags().Uint64Var(&gasLimit, "gas-limit", 0, "Gas limit for the transaction") + cmd.Flags().BoolVar(&simulate, "simulate", false, "Simulate the transaction without sending it") + cmd.Flags().UintVar(&timeout, "timeout", 60, "Timeout (in seconds) for interactions with the JSONRPC API") + cmd.Flags().StringVar(&contractAddressRaw, "contract", "", "Address of the contract to interact with") + + cmd.Flags().StringVar(&to0Raw, "to-0", "", "to-0 argument") + cmd.Flags().StringVar(&tokenIdRaw, "token-id", "", "token-id argument") + + return cmd +} +func CreateCreatePoolCommand() *cobra.Command { + var keyfile, nonce, password, value, gasPrice, maxFeePerGas, maxPriorityFeePerGas, rpc, contractAddressRaw string + var gasLimit uint64 + var simulate bool + var timeout uint + var contractAddress common.Address + + var tokenType *big.Int + var tokenTypeRaw string + var tokenAddress common.Address + var tokenAddressRaw string + var tokenID *big.Int + var tokenIDRaw string + var transferable bool + var transferableRaw string + var lockupSeconds *big.Int + var lockupSecondsRaw string + var cooldownSeconds *big.Int + var cooldownSecondsRaw string + + cmd := &cobra.Command{ + Use: "create-pool", + Short: "Execute the CreatePool method on a Staker contract", + PreRunE: func(cmd *cobra.Command, args []string) error { + if keyfile == "" { + return fmt.Errorf("--keystore not specified") + } + + if contractAddressRaw == "" { + return fmt.Errorf("--contract not specified") + } else if !common.IsHexAddress(contractAddressRaw) { + return fmt.Errorf("--contract is not a valid Ethereum address") + } + contractAddress = common.HexToAddress(contractAddressRaw) + + if tokenTypeRaw == "" { + return fmt.Errorf("--token-type argument not specified") + } + tokenType = new(big.Int) + tokenType.SetString(tokenTypeRaw, 0) + + if tokenAddressRaw == "" { + return fmt.Errorf("--token-address argument not specified") + } else if !common.IsHexAddress(tokenAddressRaw) { + return fmt.Errorf("--token-address argument is not a valid Ethereum address") + } + tokenAddress = common.HexToAddress(tokenAddressRaw) + + if tokenIDRaw == "" { + return fmt.Errorf("--token-id argument not specified") + } + tokenID = new(big.Int) + tokenID.SetString(tokenIDRaw, 0) + + transferableRawLower := strings.ToLower(transferableRaw) + switch transferableRawLower { + case "true", "t", "y", "yes", "1": + transferable = true + case "false", "f", "n", "no", "0": + transferable = false + default: + return fmt.Errorf("--transferable argument is not valid (value: %s)", transferableRaw) + } + + if lockupSecondsRaw == "" { + return fmt.Errorf("--lockup-seconds argument not specified") + } + lockupSeconds = new(big.Int) + lockupSeconds.SetString(lockupSecondsRaw, 0) + + if cooldownSecondsRaw == "" { + return fmt.Errorf("--cooldown-seconds argument not specified") + } + cooldownSeconds = new(big.Int) + cooldownSeconds.SetString(cooldownSecondsRaw, 0) + + return nil + }, + RunE: func(cmd *cobra.Command, args []string) error { + client, clientErr := NewClient(rpc) + if clientErr != nil { + return clientErr + } + + key, keyErr := KeyFromFile(keyfile, password) + if keyErr != nil { + return keyErr + } + + chainIDCtx, cancelChainIDCtx := NewChainContext(timeout) + defer cancelChainIDCtx() + chainID, chainIDErr := client.ChainID(chainIDCtx) + if chainIDErr != nil { + return chainIDErr + } + + transactionOpts, transactionOptsErr := bind.NewKeyedTransactorWithChainID(key.PrivateKey, chainID) + if transactionOptsErr != nil { + return transactionOptsErr + } + + SetTransactionParametersFromArgs(transactionOpts, nonce, value, gasPrice, maxFeePerGas, maxPriorityFeePerGas, gasLimit, simulate) + + contract, contractErr := NewStaker(contractAddress, client) + if contractErr != nil { + return contractErr + } + + session := StakerTransactorSession{ + Contract: &contract.StakerTransactor, + TransactOpts: *transactionOpts, + } + + transaction, transactionErr := session.CreatePool( + tokenType, + tokenAddress, + tokenID, + transferable, + lockupSeconds, + cooldownSeconds, + ) + if transactionErr != nil { + return transactionErr + } + + cmd.Printf("Transaction hash: %s\n", transaction.Hash().Hex()) + if transactionOpts.NoSend { + estimationMessage := ethereum.CallMsg{ + From: transactionOpts.From, + To: &contractAddress, + Data: transaction.Data(), + } + + gasEstimationCtx, cancelGasEstimationCtx := NewChainContext(timeout) + defer cancelGasEstimationCtx() + + gasEstimate, gasEstimateErr := client.EstimateGas(gasEstimationCtx, estimationMessage) + if gasEstimateErr != nil { + return gasEstimateErr + } + + transactionBinary, transactionBinaryErr := transaction.MarshalBinary() + if transactionBinaryErr != nil { + return transactionBinaryErr + } + transactionBinaryHex := hex.EncodeToString(transactionBinary) + + cmd.Printf("Transaction: %s\nEstimated gas: %d\n", transactionBinaryHex, gasEstimate) + } else { + cmd.Println("Transaction submitted") + } + + return nil + }, + } + + cmd.Flags().StringVar(&rpc, "rpc", "", "URL of the JSONRPC API to use") + cmd.Flags().StringVar(&keyfile, "keyfile", "", "Path to the keystore file to use for the transaction") + cmd.Flags().StringVar(&password, "password", "", "Password to use to unlock the keystore (if not specified, you will be prompted for the password when the command executes)") + cmd.Flags().StringVar(&nonce, "nonce", "", "Nonce to use for the transaction") + cmd.Flags().StringVar(&value, "value", "", "Value to send with the transaction") + cmd.Flags().StringVar(&gasPrice, "gas-price", "", "Gas price to use for the transaction") + cmd.Flags().StringVar(&maxFeePerGas, "max-fee-per-gas", "", "Maximum fee per gas to use for the (EIP-1559) transaction") + cmd.Flags().StringVar(&maxPriorityFeePerGas, "max-priority-fee-per-gas", "", "Maximum priority fee per gas to use for the (EIP-1559) transaction") + cmd.Flags().Uint64Var(&gasLimit, "gas-limit", 0, "Gas limit for the transaction") + cmd.Flags().BoolVar(&simulate, "simulate", false, "Simulate the transaction without sending it") + cmd.Flags().UintVar(&timeout, "timeout", 60, "Timeout (in seconds) for interactions with the JSONRPC API") + cmd.Flags().StringVar(&contractAddressRaw, "contract", "", "Address of the contract to interact with") + + cmd.Flags().StringVar(&tokenTypeRaw, "token-type", "", "token-type argument") + cmd.Flags().StringVar(&tokenAddressRaw, "token-address", "", "token-address argument") + cmd.Flags().StringVar(&tokenIDRaw, "token-id", "", "token-id argument") + cmd.Flags().StringVar(&transferableRaw, "transferable", "", "transferable argument (true, t, y, yes, 1 OR false, f, n, no, 0)") + cmd.Flags().StringVar(&lockupSecondsRaw, "lockup-seconds", "", "lockup-seconds argument") + cmd.Flags().StringVar(&cooldownSecondsRaw, "cooldown-seconds", "", "cooldown-seconds argument") + + return cmd +} + +var ErrNoRPCURL error = errors.New("no RPC URL provided -- please pass an RPC URL from the command line or set the STAKER_RPC_URL environment variable") + +// Generates an Ethereum client to the JSONRPC API at the given URL. If rpcURL is empty, then it +// attempts to read the RPC URL from the STAKER_RPC_URL environment variable. If that is empty, +// too, then it returns an error. +func NewClient(rpcURL string) (*ethclient.Client, error) { + if rpcURL == "" { + rpcURL = os.Getenv("STAKER_RPC_URL") + } + + if rpcURL == "" { + return nil, ErrNoRPCURL + } + + client, err := ethclient.Dial(rpcURL) + return client, err +} + +// Creates a new context to be used when interacting with the chain client. +func NewChainContext(timeout uint) (context.Context, context.CancelFunc) { + baseCtx := context.Background() + parsedTimeout := time.Duration(timeout) * time.Second + ctx, cancel := context.WithTimeout(baseCtx, parsedTimeout) + return ctx, cancel +} + +// Unlocks a key from a keystore (byte contents of a keystore file) with the given password. +func UnlockKeystore(keystoreData []byte, password string) (*keystore.Key, error) { + key, err := keystore.DecryptKey(keystoreData, password) + return key, err +} + +// Loads a key from file, prompting the user for the password if it is not provided as a function argument. +func KeyFromFile(keystoreFile string, password string) (*keystore.Key, error) { + var emptyKey *keystore.Key + keystoreContent, readErr := os.ReadFile(keystoreFile) + if readErr != nil { + return emptyKey, readErr + } + + // If password is "", prompt user for password. + if password == "" { + fmt.Printf("Please provide a password for keystore (%s): ", keystoreFile) + passwordRaw, inputErr := term.ReadPassword(int(os.Stdin.Fd())) + if inputErr != nil { + return emptyKey, fmt.Errorf("error reading password: %s", inputErr.Error()) + } + fmt.Print("\n") + password = string(passwordRaw) + } + + key, err := UnlockKeystore(keystoreContent, password) + return key, err +} + +// This method is used to set the parameters on a view call from command line arguments (represented mostly as +// strings). +func SetCallParametersFromArgs(opts *bind.CallOpts, pending bool, fromAddress, blockNumber string) { + if pending { + opts.Pending = true + } + + if fromAddress != "" { + opts.From = common.HexToAddress(fromAddress) + } + + if blockNumber != "" { + opts.BlockNumber = new(big.Int) + opts.BlockNumber.SetString(blockNumber, 0) + } +} + +// This method is used to set the parameters on a transaction from command line arguments (represented mostly as +// strings). +func SetTransactionParametersFromArgs(opts *bind.TransactOpts, nonce, value, gasPrice, maxFeePerGas, maxPriorityFeePerGas string, gasLimit uint64, noSend bool) { + if nonce != "" { + opts.Nonce = new(big.Int) + opts.Nonce.SetString(nonce, 0) + } + + if value != "" { + opts.Value = new(big.Int) + opts.Value.SetString(value, 0) + } + + if gasPrice != "" { + opts.GasPrice = new(big.Int) + opts.GasPrice.SetString(gasPrice, 0) + } + + if maxFeePerGas != "" { + opts.GasFeeCap = new(big.Int) + opts.GasFeeCap.SetString(maxFeePerGas, 0) + } + + if maxPriorityFeePerGas != "" { + opts.GasTipCap = new(big.Int) + opts.GasTipCap.SetString(maxPriorityFeePerGas, 0) + } + + if gasLimit != 0 { + opts.GasLimit = gasLimit + } + + opts.NoSend = noSend +} + +func CreateStakerCommand() *cobra.Command { + cmd := &cobra.Command{ + Use: "staker", + Short: "Interact with the Staker contract", + Run: func(cmd *cobra.Command, args []string) { + cmd.Help() + }, + } + + cmd.SetOut(os.Stdout) + + DeployGroup := &cobra.Group{ + ID: "deploy", Title: "Commands which deploy contracts", + } + cmd.AddGroup(DeployGroup) + ViewGroup := &cobra.Group{ + ID: "view", Title: "Commands which view contract state", + } + TransactGroup := &cobra.Group{ + ID: "transact", Title: "Commands which submit transactions", + } + cmd.AddGroup(ViewGroup, TransactGroup) + + cmdDeployStaker := CreateStakerDeploymentCommand() + cmdDeployStaker.GroupID = DeployGroup.ID + cmd.AddCommand(cmdDeployStaker) + + cmdViewERC1155TOKENTYPE := CreateErc1155TokentypeCommand() + cmdViewERC1155TOKENTYPE.GroupID = ViewGroup.ID + cmd.AddCommand(cmdViewERC1155TOKENTYPE) + cmdViewERC721TOKENTYPE := CreateErc721TokentypeCommand() + cmdViewERC721TOKENTYPE.GroupID = ViewGroup.ID + cmd.AddCommand(cmdViewERC721TOKENTYPE) + cmdViewPositions := CreatePositionsCommand() + cmdViewPositions.GroupID = ViewGroup.ID + cmd.AddCommand(cmdViewPositions) + cmdViewTotalPools := CreateTotalPoolsCommand() + cmdViewTotalPools.GroupID = ViewGroup.ID + cmd.AddCommand(cmdViewTotalPools) + cmdViewGetApproved := CreateGetApprovedCommand() + cmdViewGetApproved.GroupID = ViewGroup.ID + cmd.AddCommand(cmdViewGetApproved) + cmdViewOwnerOf := CreateOwnerOfCommand() + cmdViewOwnerOf.GroupID = ViewGroup.ID + cmd.AddCommand(cmdViewOwnerOf) + cmdViewSupportsInterface := CreateSupportsInterfaceCommand() + cmdViewSupportsInterface.GroupID = ViewGroup.ID + cmd.AddCommand(cmdViewSupportsInterface) + cmdViewERC20TOKENTYPE := CreateErc20TokentypeCommand() + cmdViewERC20TOKENTYPE.GroupID = ViewGroup.ID + cmd.AddCommand(cmdViewERC20TOKENTYPE) + cmdViewIsApprovedForAll := CreateIsApprovedForAllCommand() + cmdViewIsApprovedForAll.GroupID = ViewGroup.ID + cmd.AddCommand(cmdViewIsApprovedForAll) + cmdViewName := CreateNameCommand() + cmdViewName.GroupID = ViewGroup.ID + cmd.AddCommand(cmdViewName) + cmdViewTokenURI := CreateTokenUriCommand() + cmdViewTokenURI.GroupID = ViewGroup.ID + cmd.AddCommand(cmdViewTokenURI) + cmdViewTotalSupply := CreateTotalSupplyCommand() + cmdViewTotalSupply.GroupID = ViewGroup.ID + cmd.AddCommand(cmdViewTotalSupply) + cmdViewNATIVETOKENTYPE := CreateNativetokentypeCommand() + cmdViewNATIVETOKENTYPE.GroupID = ViewGroup.ID + cmd.AddCommand(cmdViewNATIVETOKENTYPE) + cmdViewPools := CreatePoolsCommand() + cmdViewPools.GroupID = ViewGroup.ID + cmd.AddCommand(cmdViewPools) + cmdViewBalanceOf := CreateBalanceOfCommand() + cmdViewBalanceOf.GroupID = ViewGroup.ID + cmd.AddCommand(cmdViewBalanceOf) + cmdViewSymbol := CreateSymbolCommand() + cmdViewSymbol.GroupID = ViewGroup.ID + cmd.AddCommand(cmdViewSymbol) + cmdViewTokenByIndex := CreateTokenByIndexCommand() + cmdViewTokenByIndex.GroupID = ViewGroup.ID + cmd.AddCommand(cmdViewTokenByIndex) + cmdViewTokenOfOwnerByIndex := CreateTokenOfOwnerByIndexCommand() + cmdViewTokenOfOwnerByIndex.GroupID = ViewGroup.ID + cmd.AddCommand(cmdViewTokenOfOwnerByIndex) + + cmdTransactSafeTransferFrom := CreateSafeTransferFromCommand() + cmdTransactSafeTransferFrom.GroupID = TransactGroup.ID + cmd.AddCommand(cmdTransactSafeTransferFrom) + cmdTransactSafeTransferFrom0 := CreateSafeTransferFrom0Command() + cmdTransactSafeTransferFrom0.GroupID = TransactGroup.ID + cmd.AddCommand(cmdTransactSafeTransferFrom0) + cmdTransactSetApprovalForAll := CreateSetApprovalForAllCommand() + cmdTransactSetApprovalForAll.GroupID = TransactGroup.ID + cmd.AddCommand(cmdTransactSetApprovalForAll) + cmdTransactTransferFrom := CreateTransferFromCommand() + cmdTransactTransferFrom.GroupID = TransactGroup.ID + cmd.AddCommand(cmdTransactTransferFrom) + cmdTransactTransferPoolAdministration := CreateTransferPoolAdministrationCommand() + cmdTransactTransferPoolAdministration.GroupID = TransactGroup.ID + cmd.AddCommand(cmdTransactTransferPoolAdministration) + cmdTransactUpdatePoolConfiguration := CreateUpdatePoolConfigurationCommand() + cmdTransactUpdatePoolConfiguration.GroupID = TransactGroup.ID + cmd.AddCommand(cmdTransactUpdatePoolConfiguration) + cmdTransactApprove := CreateApproveCommand() + cmdTransactApprove.GroupID = TransactGroup.ID + cmd.AddCommand(cmdTransactApprove) + cmdTransactCreatePool := CreateCreatePoolCommand() + cmdTransactCreatePool.GroupID = TransactGroup.ID + cmd.AddCommand(cmdTransactCreatePool) + + return cmd +} diff --git a/cmd/game7/cmd.go b/cmd/game7/cmd.go index 68e1df1e..78de96c1 100644 --- a/cmd/game7/cmd.go +++ b/cmd/game7/cmd.go @@ -12,6 +12,7 @@ import ( "github.com/G7DAO/protocol/bindings/ArbitrumL2CustomGateway" "github.com/G7DAO/protocol/bindings/ArbitrumUpgradeExecutor" "github.com/G7DAO/protocol/bindings/ERC20Inbox" + "github.com/G7DAO/protocol/bindings/Staker" "github.com/G7DAO/protocol/bindings/TokenFaucet" "github.com/G7DAO/protocol/bridge" @@ -66,7 +67,10 @@ func CreateRootCommand() *cobra.Command { wrappedNativeTokenCmd := WrappedNativeToken.CreateWrappedNativeTokenCommand() wrappedNativeTokenCmd.Use = "wrapped-native-token" - rootCmd.AddCommand(completionCmd, versionCmd, tokenCmd, arbitrumL1OrbitCustomGatewayCmd, arbitrumL2CustomGatewayCmd, arbitrumUpgradeExecutorCmd, arbitrumL1OrbitGatewayRouterCmd, arbSysCmd, erc20InboxCmd, bridgeCmd, faucetCmd, accountsCmd, wrappedNativeTokenCmd) + stakerCmd := Staker.CreateStakerCommand() + stakerCmd.Use = "staker" + + rootCmd.AddCommand(completionCmd, versionCmd, tokenCmd, arbitrumL1OrbitCustomGatewayCmd, arbitrumL2CustomGatewayCmd, arbitrumUpgradeExecutorCmd, arbitrumL1OrbitGatewayRouterCmd, arbSysCmd, erc20InboxCmd, bridgeCmd, faucetCmd, accountsCmd, wrappedNativeTokenCmd, stakerCmd) // By default, cobra Command objects write to stderr. We have to forcibly set them to output to // stdout.