diff --git a/Makefile b/Makefile index 7b1fdb5..481e439 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ .PHONY: clean generate regenerate test docs redocs forge -build: forge bin/trailmix +build: forge bin/trailmix bin/jj rebuild: clean generate build @@ -8,12 +8,19 @@ bin/trailmix: mkdir -p bin go build -o bin/trailmix ./trailmix +bin/jj: bindings/JackpotJunction/JackpotJunction.go + mkdir -p bin + go build -o bin/jj ./jj + +bindings/JackpotJunction/JackpotJunction.go: forge + mkdir -p bindings/JackpotJunction + seer evm generate --package JackpotJunction --output bindings/JackpotJunction/JackpotJunction.go --foundry out/JackpotJunction.sol/JackpotJunction.json --cli --struct JackpotJunction + test: forge test -vvv clean: - rm -rf out/* - rm stamper/TokenboundERC20.go stamper/BindingERC721.go + rm -rf out/* bin/* forge: forge build diff --git a/bindings/JackpotJunction/JackpotJunction.go b/bindings/JackpotJunction/JackpotJunction.go new file mode 100644 index 0000000..6e7aded --- /dev/null +++ b/bindings/JackpotJunction/JackpotJunction.go @@ -0,0 +1,5056 @@ +// This file was generated by seer: https://github.com/moonstream-to/seer. +// seer version: 0.1.3 +// seer command: seer evm generate --package JackpotJunction --cli --foundry out/JackpotJunction.sol/JackpotJunction.json --struct JackpotJunction --output bindings/JackpotJunction/JackpotJunction.go +// Code generated - DO NOT EDIT. +// This file is a generated binding and any manual changes will be lost. + +package JackpotJunction + +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" + "encoding/json" + "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 +) + +// JackpotJunctionMetaData contains all meta data concerning the JackpotJunction contract. +var JackpotJunctionMetaData = &bind.MetaData{ + ABI: "[{\"type\":\"constructor\",\"inputs\":[{\"name\":\"blocksToAct\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"costToRoll\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"costToReroll\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"nonpayable\"},{\"type\":\"receive\",\"stateMutability\":\"payable\"},{\"type\":\"function\",\"name\":\"BlocksToAct\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"CostToReroll\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"CostToRoll\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"CurrentTier\",\"inputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"ImprovedOutcomesCumulativeMass\",\"inputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"LastRollBlock\",\"inputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"UnmodifiedOutcomesCumulativeMass\",\"inputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"accept\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"acceptWithCards\",\"inputs\":[{\"name\":\"wagonCover\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"wagonBody\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"wheels\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"beastTrain\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"balanceOf\",\"inputs\":[{\"name\":\"account\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"id\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"balanceOfBatch\",\"inputs\":[{\"name\":\"accounts\",\"type\":\"address[]\",\"internalType\":\"address[]\"},{\"name\":\"ids\",\"type\":\"uint256[]\",\"internalType\":\"uint256[]\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint256[]\",\"internalType\":\"uint256[]\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"burn\",\"inputs\":[{\"name\":\"poolID\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"amount\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"burnBatch\",\"inputs\":[{\"name\":\"poolIDs\",\"type\":\"uint256[]\",\"internalType\":\"uint256[]\"},{\"name\":\"amounts\",\"type\":\"uint256[]\",\"internalType\":\"uint256[]\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"craft\",\"inputs\":[{\"name\":\"poolID\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"numOutputs\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"newPoolID\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"genera\",\"inputs\":[{\"name\":\"poolID\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"itemType\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"terrainType\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"tier\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"pure\"},{\"type\":\"function\",\"name\":\"isApprovedForAll\",\"inputs\":[{\"name\":\"account\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"operator\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[{\"name\":\"\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"outcome\",\"inputs\":[{\"name\":\"degenerate\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"bonus\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"roll\",\"inputs\":[],\"outputs\":[],\"stateMutability\":\"payable\"},{\"type\":\"function\",\"name\":\"safeBatchTransferFrom\",\"inputs\":[{\"name\":\"from\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"to\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"ids\",\"type\":\"uint256[]\",\"internalType\":\"uint256[]\"},{\"name\":\"values\",\"type\":\"uint256[]\",\"internalType\":\"uint256[]\"},{\"name\":\"data\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"safeTransferFrom\",\"inputs\":[{\"name\":\"from\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"to\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"id\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"value\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"data\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"sampleImprovedOutcomesCumulativeMass\",\"inputs\":[{\"name\":\"entropy\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"sampleUnmodifiedOutcomeCumulativeMass\",\"inputs\":[{\"name\":\"entropy\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"setApprovalForAll\",\"inputs\":[{\"name\":\"operator\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"approved\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"supportsInterface\",\"inputs\":[{\"name\":\"interfaceId\",\"type\":\"bytes4\",\"internalType\":\"bytes4\"}],\"outputs\":[{\"name\":\"\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"uri\",\"inputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"\",\"type\":\"string\",\"internalType\":\"string\"}],\"stateMutability\":\"view\"},{\"type\":\"event\",\"name\":\"ApprovalForAll\",\"inputs\":[{\"name\":\"account\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"operator\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"approved\",\"type\":\"bool\",\"indexed\":false,\"internalType\":\"bool\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"Award\",\"inputs\":[{\"name\":\"player\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"outcome\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"value\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"Roll\",\"inputs\":[{\"name\":\"player\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"TierUnlocked\",\"inputs\":[{\"name\":\"itemType\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"terrainType\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"tier\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"poolID\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"TransferBatch\",\"inputs\":[{\"name\":\"operator\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"from\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"to\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"ids\",\"type\":\"uint256[]\",\"indexed\":false,\"internalType\":\"uint256[]\"},{\"name\":\"values\",\"type\":\"uint256[]\",\"indexed\":false,\"internalType\":\"uint256[]\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"TransferSingle\",\"inputs\":[{\"name\":\"operator\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"from\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"to\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"id\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"},{\"name\":\"value\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"URI\",\"inputs\":[{\"name\":\"value\",\"type\":\"string\",\"indexed\":false,\"internalType\":\"string\"},{\"name\":\"id\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"error\",\"name\":\"DeadlineExceeded\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"ERC1155InsufficientBalance\",\"inputs\":[{\"name\":\"sender\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"balance\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"needed\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"tokenId\",\"type\":\"uint256\",\"internalType\":\"uint256\"}]},{\"type\":\"error\",\"name\":\"ERC1155InvalidApprover\",\"inputs\":[{\"name\":\"approver\",\"type\":\"address\",\"internalType\":\"address\"}]},{\"type\":\"error\",\"name\":\"ERC1155InvalidArrayLength\",\"inputs\":[{\"name\":\"idsLength\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"valuesLength\",\"type\":\"uint256\",\"internalType\":\"uint256\"}]},{\"type\":\"error\",\"name\":\"ERC1155InvalidOperator\",\"inputs\":[{\"name\":\"operator\",\"type\":\"address\",\"internalType\":\"address\"}]},{\"type\":\"error\",\"name\":\"ERC1155InvalidReceiver\",\"inputs\":[{\"name\":\"receiver\",\"type\":\"address\",\"internalType\":\"address\"}]},{\"type\":\"error\",\"name\":\"ERC1155InvalidSender\",\"inputs\":[{\"name\":\"sender\",\"type\":\"address\",\"internalType\":\"address\"}]},{\"type\":\"error\",\"name\":\"ERC1155MissingApprovalForAll\",\"inputs\":[{\"name\":\"operator\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"owner\",\"type\":\"address\",\"internalType\":\"address\"}]},{\"type\":\"error\",\"name\":\"InsufficientItems\",\"inputs\":[{\"name\":\"poolID\",\"type\":\"uint256\",\"internalType\":\"uint256\"}]},{\"type\":\"error\",\"name\":\"InsufficientValue\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"InvalidItem\",\"inputs\":[{\"name\":\"poolID\",\"type\":\"uint256\",\"internalType\":\"uint256\"}]},{\"type\":\"error\",\"name\":\"ReentrancyGuardReentrantCall\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"WaitForTick\",\"inputs\":[]}]", + Bin: "0x610120604052620800006080908152620e3d6660a052620fd6ff60c052620ffff660e05262100000610100526200003b9060049060056200019e565b506040805160a081018252620729238152620d66896020820152620fc37291810191909152620ffff16060820152621000006080820152620000829060099060056200019e565b503480156200009057600080fd5b50604051620022dc380380620022dc833981016040819052620000b391620001ff565b6040518060600160405280602c8152602001620022b0602c9139620000d8816200018c565b506001600355600e8390556010829055601181905560005b6004811015620001825760005b60078110156200016c57600081837f4b4325b9305cc4ce94c0e31c581c16ade0808971cfac8470d7a9c67ddbc9f629816200013a84600462000244565b62000146919062000264565b60405190815260200160405180910390a48062000163816200027a565b915050620000fd565b508062000179816200027a565b915050620000f0565b5050505062000407565b60026200019a82826200033b565b5050565b8260058101928215620001d6579160200282015b82811115620001d6578251829062ffffff16905591602001919060010190620001b2565b50620001e4929150620001e8565b5090565b5b80821115620001e45760008155600101620001e9565b6000806000606084860312156200021557600080fd5b8351925060208401519150604084015190509250925092565b634e487b7160e01b600052601160045260246000fd5b80820281158282048414176200025e576200025e6200022e565b92915050565b808201808211156200025e576200025e6200022e565b6000600182016200028f576200028f6200022e565b5060010190565b634e487b7160e01b600052604160045260246000fd5b600181811c90821680620002c157607f821691505b602082108103620002e257634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200033657600081815260208120601f850160051c81016020861015620003115750805b601f850160051c820191505b8181101562000332578281556001016200031d565b5050505b505050565b81516001600160401b0381111562000357576200035762000296565b6200036f81620003688454620002ac565b84620002e8565b602080601f831160018114620003a757600084156200038e5750858301515b600019600386901b1c1916600185901b17855562000332565b600085815260208120601f198616915b82811015620003d857888601518255948401946001909101908401620003b7565b5085821015620003f75787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b611e9980620004176000396000f3fe6080604052600436106101695760003560e01c80636c08995d116100d1578063b870fe801161008a578063dd88fa7f11610064578063dd88fa7f1461043b578063e985e9c514610473578063ecefbad814610493578063f242432a146104b357600080fd5b8063b870fe8014610407578063be59cce31461041d578063cd5e3c5d1461043357600080fd5b80636c08995d1461033a5780637d2a9f541461035a57806383ca4b6f1461037a5780639a0facc21461039a578063a22cb465146103c7578063b390c0ab146103e757600080fd5b80632eb2c2d6116101235780632eb2c2d6146102755780633a134f78146102975780633a259e6a146102b7578063418145cf146102d75780634e1273f4146102f757806350b8aa921461032457600080fd5b8062fdd58e1461017557806301ffc9a7146101a85780630e89341c146101d857806318ce0a4b146102055780632852b71c14610225578063289137a11461025557600080fd5b3661017057005b600080fd5b34801561018157600080fd5b50610195610190366004611727565b6104d3565b6040519081526020015b60405180910390f35b3480156101b457600080fd5b506101c86101c336600461176a565b6104fb565b604051901515815260200161019f565b3480156101e457600080fd5b506101f86101f336600461178e565b61054b565b60405161019f91906117ed565b34801561021157600080fd5b5061019561022036600461178e565b6105df565b34801561023157600080fd5b5061023a6105f6565b6040805193845260208401929092529082015260600161019f565b34801561026157600080fd5b50610195610270366004611800565b61064e565b34801561028157600080fd5b50610295610290366004611968565b610769565b005b3480156102a357600080fd5b5061023a6102b236600461178e565b6107d0565b3480156102c357600080fd5b5061023a6102d2366004611a12565b61080d565b3480156102e357600080fd5b506101956102f236600461178e565b61098b565b34801561030357600080fd5b50610317610312366004611a4e565b61099b565b60405161019f9190611b49565b34801561033057600080fd5b5061019560105481565b34801561034657600080fd5b5061019561035536600461178e565b610a70565b34801561036657600080fd5b5061023a610375366004611b5c565b610ad3565b34801561038657600080fd5b50610295610395366004611b8e565b610d92565b3480156103a657600080fd5b506101956103b5366004611bdb565b600f6020526000908152604090205481565b3480156103d357600080fd5b506102956103e2366004611a12565b610da1565b3480156103f357600080fd5b50610295610402366004611800565b610dac565b34801561041357600080fd5b5061019560115481565b34801561042957600080fd5b50610195600e5481565b610295610db7565b34801561044757600080fd5b50610195610456366004611800565b601260209081526000928352604080842090915290825290205481565b34801561047f57600080fd5b506101c861048e366004611bf6565b610e3e565b34801561049f57600080fd5b506101956104ae36600461178e565b610e6c565b3480156104bf57600080fd5b506102956104ce366004611c29565b610eb8565b6000818152602081815260408083206001600160a01b03861684529091529020545b92915050565b60006001600160e01b03198216636cdb3d1360e11b148061052c57506001600160e01b031982166303a24d0760e21b145b806104f557506301ffc9a760e01b6001600160e01b03198316146104f5565b60606002805461055a90611c8e565b80601f016020809104026020016040519081016040528092919081815260200182805461058690611c8e565b80156105d35780601f106105a8576101008083540402835291602001916105d3565b820191906000526020600020905b8154815290600101906020018083116105b657829003601f168201915b50505050509050919050565b600981600581106105ef57600080fd5b0154905081565b6000806000610603610f17565b600080600061061333600061080d565b9250925092506106238282610f41565b610638336000908152600f6020526040812055565b919450925090506106496001600355565b909192565b6000610658610f17565b610663826002611cde565b61066d33856104d3565b101561069457604051633bf0eca360e21b8152600481018490526024015b60405180910390fd5b61069f83601c611cf5565b90506106b633846106b1856002611cde565b610ff3565b6106d133828460405180602001604052806000815250611062565b60008060006106df846107d0565b6000838152601260209081526040808320858452909152902054929550909350915081111561075c57600083815260126020908152604080832085845282529182902083905590518581528291849186917f4b4325b9305cc4ce94c0e31c581c16ade0808971cfac8470d7a9c67ddbc9f629910160405180910390a45b5050506104f56001600355565b336001600160a01b038616811480159061078a57506107888682610e3e565b155b156107bb5760405163711bec9160e11b81526001600160a01b0380831660048301528716602482015260440161068b565b6107c886868686866110bf565b505050505050565b600080806107df601c85611d1e565b905060046107ee601c86611d32565b6107f89190611d1e565b9150610805600485611d32565b949193509150565b6001600160a01b0382166000908152600f60205260408120548190819043116108495760405163bfc2936d60e01b815260040160405180910390fd5b600e546001600160a01b0386166000908152600f602052604090205461086f9190611cf5565b43111561088f5760405163559895a360e01b815260040160405180910390fd5b6001600160a01b0385166000908152600f60205260408120544090856108bf576108b882610a70565b90506108cb565b6108c882610e6c565b90505b60008160010361092b5760006108f760076e3fffffffffffffffffffffffffffff601487901c16611d32565b9050600061090a6004608a87901c611d32565b905080610918836004611cde565b6109229190611cf5565b9250505061097d565b8160020361095d5760105461094590600181901c90611cf5565b90504760061c81111561095857504760061c5b61097d565b8160030361096f57504760061c61097d565b8160040361097d57504760011c5b919450925090509250925092565b600481600581106105ef57600080fd5b606081518351146109cc5781518351604051635b05999160e01b81526004810192909252602482015260440161068b565b6000835167ffffffffffffffff8111156109e8576109e8611822565b604051908082528060200260200182016040528015610a11578160200160208202803683370190505b50905060005b8451811015610a6857602080820286010151610a3b906020808402870101516104d3565b828281518110610a4d57610a4d611d46565b6020908102919091010152610a6181611d5c565b9050610a17565b509392505050565b6000620fffff82166004820154811015610a8d5750600092915050565b600554811015610aa05750600192915050565b600654811015610ab35750600292915050565b600460035b0154811015610aca5750600392915050565b50600492915050565b6000806000610ae0610f17565b60008080600080610af08c6107d0565b91945090925090508215610b1a57604051633d39bacf60e11b8152600481018d905260240161068b565b610b24338d6104d3565b600003610b4757604051633bf0eca360e21b8152600481018d905260240161068b565b6000838152601260209081526040808320848452909152902054829003610b6d57600194505b8093508415610c0a57610b7f8b6107d0565b919450909250905060018314610bab57604051633d39bacf60e11b8152600481018c905260240161068b565b610bb5338c6104d3565b600003610bd857604051633bf0eca360e21b8152600481018c905260240161068b565b600083815260126020908152604080832084845290915290205482141580610c005750838114155b15610c0a57600094505b8415610ca457610c198a6107d0565b919450909250905060028314610c4557604051633d39bacf60e11b8152600481018b905260240161068b565b610c4f338b6104d3565b600003610c7257604051633bf0eca360e21b8152600481018b905260240161068b565b600083815260126020908152604080832084845290915290205482141580610c9a5750838114155b15610ca457600094505b8415610d3e57610cb3896107d0565b919450909250905060038314610cdf57604051633d39bacf60e11b8152600481018a905260240161068b565b610ce9338a6104d3565b600003610d0c57604051633bf0eca360e21b8152600481018a905260240161068b565b600083815260126020908152604080832084845290915290205482141580610d345750838114155b15610d3e57600094505b6000806000610d4d338961080d565b925092509250610d5d8282610f41565b610d72336000908152600f6020526040812055565b919950975095505050505050610d886001600355565b9450945094915050565b610d9d33838361111f565b5050565b610d9d33838361116a565b610d9d338383610ff3565b601054600e54336000908152600f6020526040902054610dd79190611cf5565b4311610de257506011545b80341015610e035760405163044044a560e21b815260040160405180910390fd5b336000818152600f6020526040808220439055517f663b85167cccb9640fb0a935c4853ea50b0f3dd07d2590ca19942153136cef569190a250565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205460ff1690565b6000620fffff82166009820154811015610e895750600092915050565b600a54811015610e9c5750600192915050565b600b54811015610eaf5750600292915050565b60096003610ab8565b336001600160a01b0386168114801590610ed95750610ed78682610e3e565b155b15610f0a5760405163711bec9160e11b81526001600160a01b0380831660048301528716602482015260440161068b565b6107c88686868686611200565b600260035403610f3a57604051633ee5aeb560e01b815260040160405180910390fd5b6002600355565b81600103610f6a57610f653382600160405180602001604052806000815250611062565b610fb8565b8160021480610f795750816003145b80610f845750816004145b15610fb857604051339082156108fc029083906000818181858888f19350505050158015610fb6573d6000803e3d6000fd5b505b604051818152829033907f1187560d7b166b3122e71aedb88f19cf2f33b2d141b513fde3ca2562d19d1bcb9060200160405180910390a35050565b6001600160a01b03831661101c57604051626a0d4560e21b81526000600482015260240161068b565b604080516001808252602082018590528183019081526060820184905260a0820190925260006080820181815291929161105b9187918590859061128e565b5050505050565b6001600160a01b03841661108c57604051632bfa23e760e11b81526000600482015260240161068b565b604080516001808252602082018690528183019081526060820185905260808201909252906107c860008784848761128e565b6001600160a01b0384166110e957604051632bfa23e760e11b81526000600482015260240161068b565b6001600160a01b03851661111257604051626a0d4560e21b81526000600482015260240161068b565b61105b858585858561128e565b6001600160a01b03831661114857604051626a0d4560e21b81526000600482015260240161068b565b61116583600084846040518060200160405280600081525061128e565b505050565b6001600160a01b0382166111935760405162ced3e160e81b81526000600482015260240161068b565b6001600160a01b03838116600081815260016020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b6001600160a01b03841661122a57604051632bfa23e760e11b81526000600482015260240161068b565b6001600160a01b03851661125357604051626a0d4560e21b81526000600482015260240161068b565b60408051600180825260208201869052818301908152606082018590526080820190925290611285878784848761128e565b50505050505050565b61129a858585856112e1565b6001600160a01b0384161561105b57825133906001036112d357602084810151908401516112cc8389898585896114fe565b50506107c8565b6107c8818787878787611622565b80518251146113105781518151604051635b05999160e01b81526004810192909252602482015260440161068b565b3360005b835181101561141f576020818102858101820151908501909101516001600160a01b038816156113c7576000828152602081815260408083206001600160a01b038c168452909152902054818110156113a0576040516303dee4c560e01b81526001600160a01b038a16600482015260248101829052604481018390526064810184905260840161068b565b6000838152602081815260408083206001600160a01b038d16845290915290209082900390555b6001600160a01b0387161561140c576000828152602081815260408083206001600160a01b038b16845290915281208054839290611406908490611cf5565b90915550505b50508061141890611d5c565b9050611314565b5082516001036114a05760208301516000906020840151909150856001600160a01b0316876001600160a01b0316846001600160a01b03167fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f628585604051611491929190918252602082015260400190565b60405180910390a4505061105b565b836001600160a01b0316856001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb86866040516114ef929190611d75565b60405180910390a45050505050565b6001600160a01b0384163b156107c85760405163f23a6e6160e01b81526001600160a01b0385169063f23a6e61906115429089908990889088908890600401611da3565b6020604051808303816000875af192505050801561157d575060408051601f3d908101601f1916820190925261157a91810190611de8565b60015b6115e6573d8080156115ab576040519150601f19603f3d011682016040523d82523d6000602084013e6115b0565b606091505b5080516000036115de57604051632bfa23e760e11b81526001600160a01b038616600482015260240161068b565b805181602001fd5b6001600160e01b0319811663f23a6e6160e01b1461128557604051632bfa23e760e11b81526001600160a01b038616600482015260240161068b565b6001600160a01b0384163b156107c85760405163bc197c8160e01b81526001600160a01b0385169063bc197c81906116669089908990889088908890600401611e05565b6020604051808303816000875af19250505080156116a1575060408051601f3d908101601f1916820190925261169e91810190611de8565b60015b6116cf573d8080156115ab576040519150601f19603f3d011682016040523d82523d6000602084013e6115b0565b6001600160e01b0319811663bc197c8160e01b1461128557604051632bfa23e760e11b81526001600160a01b038616600482015260240161068b565b80356001600160a01b038116811461172257600080fd5b919050565b6000806040838503121561173a57600080fd5b6117438361170b565b946020939093013593505050565b6001600160e01b03198116811461176757600080fd5b50565b60006020828403121561177c57600080fd5b813561178781611751565b9392505050565b6000602082840312156117a057600080fd5b5035919050565b6000815180845260005b818110156117cd576020818501810151868301820152016117b1565b506000602082860101526020601f19601f83011685010191505092915050565b60208152600061178760208301846117a7565b6000806040838503121561181357600080fd5b50508035926020909101359150565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561186157611861611822565b604052919050565b600067ffffffffffffffff82111561188357611883611822565b5060051b60200190565b600082601f83011261189e57600080fd5b813560206118b36118ae83611869565b611838565b82815260059290921b840181019181810190868411156118d257600080fd5b8286015b848110156118ed57803583529183019183016118d6565b509695505050505050565b600082601f83011261190957600080fd5b813567ffffffffffffffff81111561192357611923611822565b611936601f8201601f1916602001611838565b81815284602083860101111561194b57600080fd5b816020850160208301376000918101602001919091529392505050565b600080600080600060a0868803121561198057600080fd5b6119898661170b565b94506119976020870161170b565b9350604086013567ffffffffffffffff808211156119b457600080fd5b6119c089838a0161188d565b945060608801359150808211156119d657600080fd5b6119e289838a0161188d565b935060808801359150808211156119f857600080fd5b50611a05888289016118f8565b9150509295509295909350565b60008060408385031215611a2557600080fd5b611a2e8361170b565b915060208301358015158114611a4357600080fd5b809150509250929050565b60008060408385031215611a6157600080fd5b823567ffffffffffffffff80821115611a7957600080fd5b818501915085601f830112611a8d57600080fd5b81356020611a9d6118ae83611869565b82815260059290921b84018101918181019089841115611abc57600080fd5b948201945b83861015611ae157611ad28661170b565b82529482019490820190611ac1565b96505086013592505080821115611af757600080fd5b50611b048582860161188d565b9150509250929050565b600081518084526020808501945080840160005b83811015611b3e57815187529582019590820190600101611b22565b509495945050505050565b6020815260006117876020830184611b0e565b60008060008060808587031215611b7257600080fd5b5050823594602084013594506040840135936060013592509050565b60008060408385031215611ba157600080fd5b823567ffffffffffffffff80821115611bb957600080fd5b611bc58683870161188d565b93506020850135915080821115611af757600080fd5b600060208284031215611bed57600080fd5b6117878261170b565b60008060408385031215611c0957600080fd5b611c128361170b565b9150611c206020840161170b565b90509250929050565b600080600080600060a08688031215611c4157600080fd5b611c4a8661170b565b9450611c586020870161170b565b93506040860135925060608601359150608086013567ffffffffffffffff811115611c8257600080fd5b611a05888289016118f8565b600181811c90821680611ca257607f821691505b602082108103611cc257634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b80820281158282048414176104f5576104f5611cc8565b808201808211156104f5576104f5611cc8565b634e487b7160e01b600052601260045260246000fd5b600082611d2d57611d2d611d08565b500490565b600082611d4157611d41611d08565b500690565b634e487b7160e01b600052603260045260246000fd5b600060018201611d6e57611d6e611cc8565b5060010190565b604081526000611d886040830185611b0e565b8281036020840152611d9a8185611b0e565b95945050505050565b6001600160a01b03868116825285166020820152604081018490526060810183905260a060808201819052600090611ddd908301846117a7565b979650505050505050565b600060208284031215611dfa57600080fd5b815161178781611751565b6001600160a01b0386811682528516602082015260a060408201819052600090611e3190830186611b0e565b8281036060840152611e438186611b0e565b90508281036080840152611e5781856117a7565b9897505050505050505056fea2646970667358221220250b9ba4770740c0b3115320d4be080de849eb069459f51485db99668d6ef6b164736f6c6343000814003368747470733a2f2f6769746875622e636f6d2f6d6f6f6e73747265616d2d746f2f646567656e2d747261696c", +} + +// JackpotJunctionABI is the input ABI used to generate the binding from. +// Deprecated: Use JackpotJunctionMetaData.ABI instead. +var JackpotJunctionABI = JackpotJunctionMetaData.ABI + +// JackpotJunctionBin is the compiled bytecode used for deploying new contracts. +// Deprecated: Use JackpotJunctionMetaData.Bin instead. +var JackpotJunctionBin = JackpotJunctionMetaData.Bin + +// DeployJackpotJunction deploys a new Ethereum contract, binding an instance of JackpotJunction to it. +func DeployJackpotJunction(auth *bind.TransactOpts, backend bind.ContractBackend, blocksToAct *big.Int, costToRoll *big.Int, costToReroll *big.Int) (common.Address, *types.Transaction, *JackpotJunction, error) { + parsed, err := JackpotJunctionMetaData.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(JackpotJunctionBin), backend, blocksToAct, costToRoll, costToReroll) + if err != nil { + return common.Address{}, nil, nil, err + } + return address, tx, &JackpotJunction{JackpotJunctionCaller: JackpotJunctionCaller{contract: contract}, JackpotJunctionTransactor: JackpotJunctionTransactor{contract: contract}, JackpotJunctionFilterer: JackpotJunctionFilterer{contract: contract}}, nil +} + +// JackpotJunction is an auto generated Go binding around an Ethereum contract. +type JackpotJunction struct { + JackpotJunctionCaller // Read-only binding to the contract + JackpotJunctionTransactor // Write-only binding to the contract + JackpotJunctionFilterer // Log filterer for contract events +} + +// JackpotJunctionCaller is an auto generated read-only Go binding around an Ethereum contract. +type JackpotJunctionCaller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// JackpotJunctionTransactor is an auto generated write-only Go binding around an Ethereum contract. +type JackpotJunctionTransactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// JackpotJunctionFilterer is an auto generated log filtering Go binding around an Ethereum contract events. +type JackpotJunctionFilterer struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// JackpotJunctionSession is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type JackpotJunctionSession struct { + Contract *JackpotJunction // 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 +} + +// JackpotJunctionCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type JackpotJunctionCallerSession struct { + Contract *JackpotJunctionCaller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// JackpotJunctionTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type JackpotJunctionTransactorSession struct { + Contract *JackpotJunctionTransactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// JackpotJunctionRaw is an auto generated low-level Go binding around an Ethereum contract. +type JackpotJunctionRaw struct { + Contract *JackpotJunction // Generic contract binding to access the raw methods on +} + +// JackpotJunctionCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type JackpotJunctionCallerRaw struct { + Contract *JackpotJunctionCaller // Generic read-only contract binding to access the raw methods on +} + +// JackpotJunctionTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type JackpotJunctionTransactorRaw struct { + Contract *JackpotJunctionTransactor // Generic write-only contract binding to access the raw methods on +} + +// NewJackpotJunction creates a new instance of JackpotJunction, bound to a specific deployed contract. +func NewJackpotJunction(address common.Address, backend bind.ContractBackend) (*JackpotJunction, error) { + contract, err := bindJackpotJunction(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &JackpotJunction{JackpotJunctionCaller: JackpotJunctionCaller{contract: contract}, JackpotJunctionTransactor: JackpotJunctionTransactor{contract: contract}, JackpotJunctionFilterer: JackpotJunctionFilterer{contract: contract}}, nil +} + +// NewJackpotJunctionCaller creates a new read-only instance of JackpotJunction, bound to a specific deployed contract. +func NewJackpotJunctionCaller(address common.Address, caller bind.ContractCaller) (*JackpotJunctionCaller, error) { + contract, err := bindJackpotJunction(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &JackpotJunctionCaller{contract: contract}, nil +} + +// NewJackpotJunctionTransactor creates a new write-only instance of JackpotJunction, bound to a specific deployed contract. +func NewJackpotJunctionTransactor(address common.Address, transactor bind.ContractTransactor) (*JackpotJunctionTransactor, error) { + contract, err := bindJackpotJunction(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &JackpotJunctionTransactor{contract: contract}, nil +} + +// NewJackpotJunctionFilterer creates a new log filterer instance of JackpotJunction, bound to a specific deployed contract. +func NewJackpotJunctionFilterer(address common.Address, filterer bind.ContractFilterer) (*JackpotJunctionFilterer, error) { + contract, err := bindJackpotJunction(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &JackpotJunctionFilterer{contract: contract}, nil +} + +// bindJackpotJunction binds a generic wrapper to an already deployed contract. +func bindJackpotJunction(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := JackpotJunctionMetaData.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 (_JackpotJunction *JackpotJunctionRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _JackpotJunction.Contract.JackpotJunctionCaller.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 (_JackpotJunction *JackpotJunctionRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _JackpotJunction.Contract.JackpotJunctionTransactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_JackpotJunction *JackpotJunctionRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _JackpotJunction.Contract.JackpotJunctionTransactor.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 (_JackpotJunction *JackpotJunctionCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _JackpotJunction.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 (_JackpotJunction *JackpotJunctionTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _JackpotJunction.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_JackpotJunction *JackpotJunctionTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _JackpotJunction.Contract.contract.Transact(opts, method, params...) +} + +// BlocksToAct is a free data retrieval call binding the contract method 0xbe59cce3. +// +// Solidity: function BlocksToAct() view returns(uint256) +func (_JackpotJunction *JackpotJunctionCaller) BlocksToAct(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _JackpotJunction.contract.Call(opts, &out, "BlocksToAct") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// BlocksToAct is a free data retrieval call binding the contract method 0xbe59cce3. +// +// Solidity: function BlocksToAct() view returns(uint256) +func (_JackpotJunction *JackpotJunctionSession) BlocksToAct() (*big.Int, error) { + return _JackpotJunction.Contract.BlocksToAct(&_JackpotJunction.CallOpts) +} + +// BlocksToAct is a free data retrieval call binding the contract method 0xbe59cce3. +// +// Solidity: function BlocksToAct() view returns(uint256) +func (_JackpotJunction *JackpotJunctionCallerSession) BlocksToAct() (*big.Int, error) { + return _JackpotJunction.Contract.BlocksToAct(&_JackpotJunction.CallOpts) +} + +// CostToReroll is a free data retrieval call binding the contract method 0xb870fe80. +// +// Solidity: function CostToReroll() view returns(uint256) +func (_JackpotJunction *JackpotJunctionCaller) CostToReroll(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _JackpotJunction.contract.Call(opts, &out, "CostToReroll") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// CostToReroll is a free data retrieval call binding the contract method 0xb870fe80. +// +// Solidity: function CostToReroll() view returns(uint256) +func (_JackpotJunction *JackpotJunctionSession) CostToReroll() (*big.Int, error) { + return _JackpotJunction.Contract.CostToReroll(&_JackpotJunction.CallOpts) +} + +// CostToReroll is a free data retrieval call binding the contract method 0xb870fe80. +// +// Solidity: function CostToReroll() view returns(uint256) +func (_JackpotJunction *JackpotJunctionCallerSession) CostToReroll() (*big.Int, error) { + return _JackpotJunction.Contract.CostToReroll(&_JackpotJunction.CallOpts) +} + +// CostToRoll is a free data retrieval call binding the contract method 0x50b8aa92. +// +// Solidity: function CostToRoll() view returns(uint256) +func (_JackpotJunction *JackpotJunctionCaller) CostToRoll(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _JackpotJunction.contract.Call(opts, &out, "CostToRoll") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// CostToRoll is a free data retrieval call binding the contract method 0x50b8aa92. +// +// Solidity: function CostToRoll() view returns(uint256) +func (_JackpotJunction *JackpotJunctionSession) CostToRoll() (*big.Int, error) { + return _JackpotJunction.Contract.CostToRoll(&_JackpotJunction.CallOpts) +} + +// CostToRoll is a free data retrieval call binding the contract method 0x50b8aa92. +// +// Solidity: function CostToRoll() view returns(uint256) +func (_JackpotJunction *JackpotJunctionCallerSession) CostToRoll() (*big.Int, error) { + return _JackpotJunction.Contract.CostToRoll(&_JackpotJunction.CallOpts) +} + +// CurrentTier is a free data retrieval call binding the contract method 0xdd88fa7f. +// +// Solidity: function CurrentTier(uint256 , uint256 ) view returns(uint256) +func (_JackpotJunction *JackpotJunctionCaller) CurrentTier(opts *bind.CallOpts, arg0 *big.Int, arg1 *big.Int) (*big.Int, error) { + var out []interface{} + err := _JackpotJunction.contract.Call(opts, &out, "CurrentTier", arg0, arg1) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// CurrentTier is a free data retrieval call binding the contract method 0xdd88fa7f. +// +// Solidity: function CurrentTier(uint256 , uint256 ) view returns(uint256) +func (_JackpotJunction *JackpotJunctionSession) CurrentTier(arg0 *big.Int, arg1 *big.Int) (*big.Int, error) { + return _JackpotJunction.Contract.CurrentTier(&_JackpotJunction.CallOpts, arg0, arg1) +} + +// CurrentTier is a free data retrieval call binding the contract method 0xdd88fa7f. +// +// Solidity: function CurrentTier(uint256 , uint256 ) view returns(uint256) +func (_JackpotJunction *JackpotJunctionCallerSession) CurrentTier(arg0 *big.Int, arg1 *big.Int) (*big.Int, error) { + return _JackpotJunction.Contract.CurrentTier(&_JackpotJunction.CallOpts, arg0, arg1) +} + +// ImprovedOutcomesCumulativeMass is a free data retrieval call binding the contract method 0x18ce0a4b. +// +// Solidity: function ImprovedOutcomesCumulativeMass(uint256 ) view returns(uint256) +func (_JackpotJunction *JackpotJunctionCaller) ImprovedOutcomesCumulativeMass(opts *bind.CallOpts, arg0 *big.Int) (*big.Int, error) { + var out []interface{} + err := _JackpotJunction.contract.Call(opts, &out, "ImprovedOutcomesCumulativeMass", arg0) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// ImprovedOutcomesCumulativeMass is a free data retrieval call binding the contract method 0x18ce0a4b. +// +// Solidity: function ImprovedOutcomesCumulativeMass(uint256 ) view returns(uint256) +func (_JackpotJunction *JackpotJunctionSession) ImprovedOutcomesCumulativeMass(arg0 *big.Int) (*big.Int, error) { + return _JackpotJunction.Contract.ImprovedOutcomesCumulativeMass(&_JackpotJunction.CallOpts, arg0) +} + +// ImprovedOutcomesCumulativeMass is a free data retrieval call binding the contract method 0x18ce0a4b. +// +// Solidity: function ImprovedOutcomesCumulativeMass(uint256 ) view returns(uint256) +func (_JackpotJunction *JackpotJunctionCallerSession) ImprovedOutcomesCumulativeMass(arg0 *big.Int) (*big.Int, error) { + return _JackpotJunction.Contract.ImprovedOutcomesCumulativeMass(&_JackpotJunction.CallOpts, arg0) +} + +// LastRollBlock is a free data retrieval call binding the contract method 0x9a0facc2. +// +// Solidity: function LastRollBlock(address ) view returns(uint256) +func (_JackpotJunction *JackpotJunctionCaller) LastRollBlock(opts *bind.CallOpts, arg0 common.Address) (*big.Int, error) { + var out []interface{} + err := _JackpotJunction.contract.Call(opts, &out, "LastRollBlock", arg0) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// LastRollBlock is a free data retrieval call binding the contract method 0x9a0facc2. +// +// Solidity: function LastRollBlock(address ) view returns(uint256) +func (_JackpotJunction *JackpotJunctionSession) LastRollBlock(arg0 common.Address) (*big.Int, error) { + return _JackpotJunction.Contract.LastRollBlock(&_JackpotJunction.CallOpts, arg0) +} + +// LastRollBlock is a free data retrieval call binding the contract method 0x9a0facc2. +// +// Solidity: function LastRollBlock(address ) view returns(uint256) +func (_JackpotJunction *JackpotJunctionCallerSession) LastRollBlock(arg0 common.Address) (*big.Int, error) { + return _JackpotJunction.Contract.LastRollBlock(&_JackpotJunction.CallOpts, arg0) +} + +// UnmodifiedOutcomesCumulativeMass is a free data retrieval call binding the contract method 0x418145cf. +// +// Solidity: function UnmodifiedOutcomesCumulativeMass(uint256 ) view returns(uint256) +func (_JackpotJunction *JackpotJunctionCaller) UnmodifiedOutcomesCumulativeMass(opts *bind.CallOpts, arg0 *big.Int) (*big.Int, error) { + var out []interface{} + err := _JackpotJunction.contract.Call(opts, &out, "UnmodifiedOutcomesCumulativeMass", arg0) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// UnmodifiedOutcomesCumulativeMass is a free data retrieval call binding the contract method 0x418145cf. +// +// Solidity: function UnmodifiedOutcomesCumulativeMass(uint256 ) view returns(uint256) +func (_JackpotJunction *JackpotJunctionSession) UnmodifiedOutcomesCumulativeMass(arg0 *big.Int) (*big.Int, error) { + return _JackpotJunction.Contract.UnmodifiedOutcomesCumulativeMass(&_JackpotJunction.CallOpts, arg0) +} + +// UnmodifiedOutcomesCumulativeMass is a free data retrieval call binding the contract method 0x418145cf. +// +// Solidity: function UnmodifiedOutcomesCumulativeMass(uint256 ) view returns(uint256) +func (_JackpotJunction *JackpotJunctionCallerSession) UnmodifiedOutcomesCumulativeMass(arg0 *big.Int) (*big.Int, error) { + return _JackpotJunction.Contract.UnmodifiedOutcomesCumulativeMass(&_JackpotJunction.CallOpts, arg0) +} + +// BalanceOf is a free data retrieval call binding the contract method 0x00fdd58e. +// +// Solidity: function balanceOf(address account, uint256 id) view returns(uint256) +func (_JackpotJunction *JackpotJunctionCaller) BalanceOf(opts *bind.CallOpts, account common.Address, id *big.Int) (*big.Int, error) { + var out []interface{} + err := _JackpotJunction.contract.Call(opts, &out, "balanceOf", account, id) + + 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 0x00fdd58e. +// +// Solidity: function balanceOf(address account, uint256 id) view returns(uint256) +func (_JackpotJunction *JackpotJunctionSession) BalanceOf(account common.Address, id *big.Int) (*big.Int, error) { + return _JackpotJunction.Contract.BalanceOf(&_JackpotJunction.CallOpts, account, id) +} + +// BalanceOf is a free data retrieval call binding the contract method 0x00fdd58e. +// +// Solidity: function balanceOf(address account, uint256 id) view returns(uint256) +func (_JackpotJunction *JackpotJunctionCallerSession) BalanceOf(account common.Address, id *big.Int) (*big.Int, error) { + return _JackpotJunction.Contract.BalanceOf(&_JackpotJunction.CallOpts, account, id) +} + +// BalanceOfBatch is a free data retrieval call binding the contract method 0x4e1273f4. +// +// Solidity: function balanceOfBatch(address[] accounts, uint256[] ids) view returns(uint256[]) +func (_JackpotJunction *JackpotJunctionCaller) BalanceOfBatch(opts *bind.CallOpts, accounts []common.Address, ids []*big.Int) ([]*big.Int, error) { + var out []interface{} + err := _JackpotJunction.contract.Call(opts, &out, "balanceOfBatch", accounts, ids) + + if err != nil { + return *new([]*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new([]*big.Int)).(*[]*big.Int) + + return out0, err + +} + +// BalanceOfBatch is a free data retrieval call binding the contract method 0x4e1273f4. +// +// Solidity: function balanceOfBatch(address[] accounts, uint256[] ids) view returns(uint256[]) +func (_JackpotJunction *JackpotJunctionSession) BalanceOfBatch(accounts []common.Address, ids []*big.Int) ([]*big.Int, error) { + return _JackpotJunction.Contract.BalanceOfBatch(&_JackpotJunction.CallOpts, accounts, ids) +} + +// BalanceOfBatch is a free data retrieval call binding the contract method 0x4e1273f4. +// +// Solidity: function balanceOfBatch(address[] accounts, uint256[] ids) view returns(uint256[]) +func (_JackpotJunction *JackpotJunctionCallerSession) BalanceOfBatch(accounts []common.Address, ids []*big.Int) ([]*big.Int, error) { + return _JackpotJunction.Contract.BalanceOfBatch(&_JackpotJunction.CallOpts, accounts, ids) +} + +// Genera is a free data retrieval call binding the contract method 0x3a134f78. +// +// Solidity: function genera(uint256 poolID) pure returns(uint256 itemType, uint256 terrainType, uint256 tier) +func (_JackpotJunction *JackpotJunctionCaller) Genera(opts *bind.CallOpts, poolID *big.Int) (struct { + ItemType *big.Int + TerrainType *big.Int + Tier *big.Int +}, error) { + var out []interface{} + err := _JackpotJunction.contract.Call(opts, &out, "genera", poolID) + + outstruct := new(struct { + ItemType *big.Int + TerrainType *big.Int + Tier *big.Int + }) + if err != nil { + return *outstruct, err + } + + outstruct.ItemType = *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + outstruct.TerrainType = *abi.ConvertType(out[1], new(*big.Int)).(**big.Int) + outstruct.Tier = *abi.ConvertType(out[2], new(*big.Int)).(**big.Int) + + return *outstruct, err + +} + +// Genera is a free data retrieval call binding the contract method 0x3a134f78. +// +// Solidity: function genera(uint256 poolID) pure returns(uint256 itemType, uint256 terrainType, uint256 tier) +func (_JackpotJunction *JackpotJunctionSession) Genera(poolID *big.Int) (struct { + ItemType *big.Int + TerrainType *big.Int + Tier *big.Int +}, error) { + return _JackpotJunction.Contract.Genera(&_JackpotJunction.CallOpts, poolID) +} + +// Genera is a free data retrieval call binding the contract method 0x3a134f78. +// +// Solidity: function genera(uint256 poolID) pure returns(uint256 itemType, uint256 terrainType, uint256 tier) +func (_JackpotJunction *JackpotJunctionCallerSession) Genera(poolID *big.Int) (struct { + ItemType *big.Int + TerrainType *big.Int + Tier *big.Int +}, error) { + return _JackpotJunction.Contract.Genera(&_JackpotJunction.CallOpts, poolID) +} + +// IsApprovedForAll is a free data retrieval call binding the contract method 0xe985e9c5. +// +// Solidity: function isApprovedForAll(address account, address operator) view returns(bool) +func (_JackpotJunction *JackpotJunctionCaller) IsApprovedForAll(opts *bind.CallOpts, account common.Address, operator common.Address) (bool, error) { + var out []interface{} + err := _JackpotJunction.contract.Call(opts, &out, "isApprovedForAll", account, 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 account, address operator) view returns(bool) +func (_JackpotJunction *JackpotJunctionSession) IsApprovedForAll(account common.Address, operator common.Address) (bool, error) { + return _JackpotJunction.Contract.IsApprovedForAll(&_JackpotJunction.CallOpts, account, operator) +} + +// IsApprovedForAll is a free data retrieval call binding the contract method 0xe985e9c5. +// +// Solidity: function isApprovedForAll(address account, address operator) view returns(bool) +func (_JackpotJunction *JackpotJunctionCallerSession) IsApprovedForAll(account common.Address, operator common.Address) (bool, error) { + return _JackpotJunction.Contract.IsApprovedForAll(&_JackpotJunction.CallOpts, account, operator) +} + +// Outcome is a free data retrieval call binding the contract method 0x3a259e6a. +// +// Solidity: function outcome(address degenerate, bool bonus) view returns(uint256, uint256, uint256) +func (_JackpotJunction *JackpotJunctionCaller) Outcome(opts *bind.CallOpts, degenerate common.Address, bonus bool) (*big.Int, *big.Int, *big.Int, error) { + var out []interface{} + err := _JackpotJunction.contract.Call(opts, &out, "outcome", degenerate, bonus) + + if err != nil { + return *new(*big.Int), *new(*big.Int), *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + out1 := *abi.ConvertType(out[1], new(*big.Int)).(**big.Int) + out2 := *abi.ConvertType(out[2], new(*big.Int)).(**big.Int) + + return out0, out1, out2, err + +} + +// Outcome is a free data retrieval call binding the contract method 0x3a259e6a. +// +// Solidity: function outcome(address degenerate, bool bonus) view returns(uint256, uint256, uint256) +func (_JackpotJunction *JackpotJunctionSession) Outcome(degenerate common.Address, bonus bool) (*big.Int, *big.Int, *big.Int, error) { + return _JackpotJunction.Contract.Outcome(&_JackpotJunction.CallOpts, degenerate, bonus) +} + +// Outcome is a free data retrieval call binding the contract method 0x3a259e6a. +// +// Solidity: function outcome(address degenerate, bool bonus) view returns(uint256, uint256, uint256) +func (_JackpotJunction *JackpotJunctionCallerSession) Outcome(degenerate common.Address, bonus bool) (*big.Int, *big.Int, *big.Int, error) { + return _JackpotJunction.Contract.Outcome(&_JackpotJunction.CallOpts, degenerate, bonus) +} + +// SampleImprovedOutcomesCumulativeMass is a free data retrieval call binding the contract method 0xecefbad8. +// +// Solidity: function sampleImprovedOutcomesCumulativeMass(uint256 entropy) view returns(uint256) +func (_JackpotJunction *JackpotJunctionCaller) SampleImprovedOutcomesCumulativeMass(opts *bind.CallOpts, entropy *big.Int) (*big.Int, error) { + var out []interface{} + err := _JackpotJunction.contract.Call(opts, &out, "sampleImprovedOutcomesCumulativeMass", entropy) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// SampleImprovedOutcomesCumulativeMass is a free data retrieval call binding the contract method 0xecefbad8. +// +// Solidity: function sampleImprovedOutcomesCumulativeMass(uint256 entropy) view returns(uint256) +func (_JackpotJunction *JackpotJunctionSession) SampleImprovedOutcomesCumulativeMass(entropy *big.Int) (*big.Int, error) { + return _JackpotJunction.Contract.SampleImprovedOutcomesCumulativeMass(&_JackpotJunction.CallOpts, entropy) +} + +// SampleImprovedOutcomesCumulativeMass is a free data retrieval call binding the contract method 0xecefbad8. +// +// Solidity: function sampleImprovedOutcomesCumulativeMass(uint256 entropy) view returns(uint256) +func (_JackpotJunction *JackpotJunctionCallerSession) SampleImprovedOutcomesCumulativeMass(entropy *big.Int) (*big.Int, error) { + return _JackpotJunction.Contract.SampleImprovedOutcomesCumulativeMass(&_JackpotJunction.CallOpts, entropy) +} + +// SampleUnmodifiedOutcomeCumulativeMass is a free data retrieval call binding the contract method 0x6c08995d. +// +// Solidity: function sampleUnmodifiedOutcomeCumulativeMass(uint256 entropy) view returns(uint256) +func (_JackpotJunction *JackpotJunctionCaller) SampleUnmodifiedOutcomeCumulativeMass(opts *bind.CallOpts, entropy *big.Int) (*big.Int, error) { + var out []interface{} + err := _JackpotJunction.contract.Call(opts, &out, "sampleUnmodifiedOutcomeCumulativeMass", entropy) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// SampleUnmodifiedOutcomeCumulativeMass is a free data retrieval call binding the contract method 0x6c08995d. +// +// Solidity: function sampleUnmodifiedOutcomeCumulativeMass(uint256 entropy) view returns(uint256) +func (_JackpotJunction *JackpotJunctionSession) SampleUnmodifiedOutcomeCumulativeMass(entropy *big.Int) (*big.Int, error) { + return _JackpotJunction.Contract.SampleUnmodifiedOutcomeCumulativeMass(&_JackpotJunction.CallOpts, entropy) +} + +// SampleUnmodifiedOutcomeCumulativeMass is a free data retrieval call binding the contract method 0x6c08995d. +// +// Solidity: function sampleUnmodifiedOutcomeCumulativeMass(uint256 entropy) view returns(uint256) +func (_JackpotJunction *JackpotJunctionCallerSession) SampleUnmodifiedOutcomeCumulativeMass(entropy *big.Int) (*big.Int, error) { + return _JackpotJunction.Contract.SampleUnmodifiedOutcomeCumulativeMass(&_JackpotJunction.CallOpts, entropy) +} + +// SupportsInterface is a free data retrieval call binding the contract method 0x01ffc9a7. +// +// Solidity: function supportsInterface(bytes4 interfaceId) view returns(bool) +func (_JackpotJunction *JackpotJunctionCaller) SupportsInterface(opts *bind.CallOpts, interfaceId [4]byte) (bool, error) { + var out []interface{} + err := _JackpotJunction.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 (_JackpotJunction *JackpotJunctionSession) SupportsInterface(interfaceId [4]byte) (bool, error) { + return _JackpotJunction.Contract.SupportsInterface(&_JackpotJunction.CallOpts, interfaceId) +} + +// SupportsInterface is a free data retrieval call binding the contract method 0x01ffc9a7. +// +// Solidity: function supportsInterface(bytes4 interfaceId) view returns(bool) +func (_JackpotJunction *JackpotJunctionCallerSession) SupportsInterface(interfaceId [4]byte) (bool, error) { + return _JackpotJunction.Contract.SupportsInterface(&_JackpotJunction.CallOpts, interfaceId) +} + +// Uri is a free data retrieval call binding the contract method 0x0e89341c. +// +// Solidity: function uri(uint256 ) view returns(string) +func (_JackpotJunction *JackpotJunctionCaller) Uri(opts *bind.CallOpts, arg0 *big.Int) (string, error) { + var out []interface{} + err := _JackpotJunction.contract.Call(opts, &out, "uri", arg0) + + if err != nil { + return *new(string), err + } + + out0 := *abi.ConvertType(out[0], new(string)).(*string) + + return out0, err + +} + +// Uri is a free data retrieval call binding the contract method 0x0e89341c. +// +// Solidity: function uri(uint256 ) view returns(string) +func (_JackpotJunction *JackpotJunctionSession) Uri(arg0 *big.Int) (string, error) { + return _JackpotJunction.Contract.Uri(&_JackpotJunction.CallOpts, arg0) +} + +// Uri is a free data retrieval call binding the contract method 0x0e89341c. +// +// Solidity: function uri(uint256 ) view returns(string) +func (_JackpotJunction *JackpotJunctionCallerSession) Uri(arg0 *big.Int) (string, error) { + return _JackpotJunction.Contract.Uri(&_JackpotJunction.CallOpts, arg0) +} + +// Accept is a paid mutator transaction binding the contract method 0x2852b71c. +// +// Solidity: function accept() returns(uint256, uint256, uint256) +func (_JackpotJunction *JackpotJunctionTransactor) Accept(opts *bind.TransactOpts) (*types.Transaction, error) { + return _JackpotJunction.contract.Transact(opts, "accept") +} + +// Accept is a paid mutator transaction binding the contract method 0x2852b71c. +// +// Solidity: function accept() returns(uint256, uint256, uint256) +func (_JackpotJunction *JackpotJunctionSession) Accept() (*types.Transaction, error) { + return _JackpotJunction.Contract.Accept(&_JackpotJunction.TransactOpts) +} + +// Accept is a paid mutator transaction binding the contract method 0x2852b71c. +// +// Solidity: function accept() returns(uint256, uint256, uint256) +func (_JackpotJunction *JackpotJunctionTransactorSession) Accept() (*types.Transaction, error) { + return _JackpotJunction.Contract.Accept(&_JackpotJunction.TransactOpts) +} + +// AcceptWithCards is a paid mutator transaction binding the contract method 0x7d2a9f54. +// +// Solidity: function acceptWithCards(uint256 wagonCover, uint256 wagonBody, uint256 wheels, uint256 beastTrain) returns(uint256, uint256, uint256) +func (_JackpotJunction *JackpotJunctionTransactor) AcceptWithCards(opts *bind.TransactOpts, wagonCover *big.Int, wagonBody *big.Int, wheels *big.Int, beastTrain *big.Int) (*types.Transaction, error) { + return _JackpotJunction.contract.Transact(opts, "acceptWithCards", wagonCover, wagonBody, wheels, beastTrain) +} + +// AcceptWithCards is a paid mutator transaction binding the contract method 0x7d2a9f54. +// +// Solidity: function acceptWithCards(uint256 wagonCover, uint256 wagonBody, uint256 wheels, uint256 beastTrain) returns(uint256, uint256, uint256) +func (_JackpotJunction *JackpotJunctionSession) AcceptWithCards(wagonCover *big.Int, wagonBody *big.Int, wheels *big.Int, beastTrain *big.Int) (*types.Transaction, error) { + return _JackpotJunction.Contract.AcceptWithCards(&_JackpotJunction.TransactOpts, wagonCover, wagonBody, wheels, beastTrain) +} + +// AcceptWithCards is a paid mutator transaction binding the contract method 0x7d2a9f54. +// +// Solidity: function acceptWithCards(uint256 wagonCover, uint256 wagonBody, uint256 wheels, uint256 beastTrain) returns(uint256, uint256, uint256) +func (_JackpotJunction *JackpotJunctionTransactorSession) AcceptWithCards(wagonCover *big.Int, wagonBody *big.Int, wheels *big.Int, beastTrain *big.Int) (*types.Transaction, error) { + return _JackpotJunction.Contract.AcceptWithCards(&_JackpotJunction.TransactOpts, wagonCover, wagonBody, wheels, beastTrain) +} + +// Burn is a paid mutator transaction binding the contract method 0xb390c0ab. +// +// Solidity: function burn(uint256 poolID, uint256 amount) returns() +func (_JackpotJunction *JackpotJunctionTransactor) Burn(opts *bind.TransactOpts, poolID *big.Int, amount *big.Int) (*types.Transaction, error) { + return _JackpotJunction.contract.Transact(opts, "burn", poolID, amount) +} + +// Burn is a paid mutator transaction binding the contract method 0xb390c0ab. +// +// Solidity: function burn(uint256 poolID, uint256 amount) returns() +func (_JackpotJunction *JackpotJunctionSession) Burn(poolID *big.Int, amount *big.Int) (*types.Transaction, error) { + return _JackpotJunction.Contract.Burn(&_JackpotJunction.TransactOpts, poolID, amount) +} + +// Burn is a paid mutator transaction binding the contract method 0xb390c0ab. +// +// Solidity: function burn(uint256 poolID, uint256 amount) returns() +func (_JackpotJunction *JackpotJunctionTransactorSession) Burn(poolID *big.Int, amount *big.Int) (*types.Transaction, error) { + return _JackpotJunction.Contract.Burn(&_JackpotJunction.TransactOpts, poolID, amount) +} + +// BurnBatch is a paid mutator transaction binding the contract method 0x83ca4b6f. +// +// Solidity: function burnBatch(uint256[] poolIDs, uint256[] amounts) returns() +func (_JackpotJunction *JackpotJunctionTransactor) BurnBatch(opts *bind.TransactOpts, poolIDs []*big.Int, amounts []*big.Int) (*types.Transaction, error) { + return _JackpotJunction.contract.Transact(opts, "burnBatch", poolIDs, amounts) +} + +// BurnBatch is a paid mutator transaction binding the contract method 0x83ca4b6f. +// +// Solidity: function burnBatch(uint256[] poolIDs, uint256[] amounts) returns() +func (_JackpotJunction *JackpotJunctionSession) BurnBatch(poolIDs []*big.Int, amounts []*big.Int) (*types.Transaction, error) { + return _JackpotJunction.Contract.BurnBatch(&_JackpotJunction.TransactOpts, poolIDs, amounts) +} + +// BurnBatch is a paid mutator transaction binding the contract method 0x83ca4b6f. +// +// Solidity: function burnBatch(uint256[] poolIDs, uint256[] amounts) returns() +func (_JackpotJunction *JackpotJunctionTransactorSession) BurnBatch(poolIDs []*big.Int, amounts []*big.Int) (*types.Transaction, error) { + return _JackpotJunction.Contract.BurnBatch(&_JackpotJunction.TransactOpts, poolIDs, amounts) +} + +// Craft is a paid mutator transaction binding the contract method 0x289137a1. +// +// Solidity: function craft(uint256 poolID, uint256 numOutputs) returns(uint256 newPoolID) +func (_JackpotJunction *JackpotJunctionTransactor) Craft(opts *bind.TransactOpts, poolID *big.Int, numOutputs *big.Int) (*types.Transaction, error) { + return _JackpotJunction.contract.Transact(opts, "craft", poolID, numOutputs) +} + +// Craft is a paid mutator transaction binding the contract method 0x289137a1. +// +// Solidity: function craft(uint256 poolID, uint256 numOutputs) returns(uint256 newPoolID) +func (_JackpotJunction *JackpotJunctionSession) Craft(poolID *big.Int, numOutputs *big.Int) (*types.Transaction, error) { + return _JackpotJunction.Contract.Craft(&_JackpotJunction.TransactOpts, poolID, numOutputs) +} + +// Craft is a paid mutator transaction binding the contract method 0x289137a1. +// +// Solidity: function craft(uint256 poolID, uint256 numOutputs) returns(uint256 newPoolID) +func (_JackpotJunction *JackpotJunctionTransactorSession) Craft(poolID *big.Int, numOutputs *big.Int) (*types.Transaction, error) { + return _JackpotJunction.Contract.Craft(&_JackpotJunction.TransactOpts, poolID, numOutputs) +} + +// Roll is a paid mutator transaction binding the contract method 0xcd5e3c5d. +// +// Solidity: function roll() payable returns() +func (_JackpotJunction *JackpotJunctionTransactor) Roll(opts *bind.TransactOpts) (*types.Transaction, error) { + return _JackpotJunction.contract.Transact(opts, "roll") +} + +// Roll is a paid mutator transaction binding the contract method 0xcd5e3c5d. +// +// Solidity: function roll() payable returns() +func (_JackpotJunction *JackpotJunctionSession) Roll() (*types.Transaction, error) { + return _JackpotJunction.Contract.Roll(&_JackpotJunction.TransactOpts) +} + +// Roll is a paid mutator transaction binding the contract method 0xcd5e3c5d. +// +// Solidity: function roll() payable returns() +func (_JackpotJunction *JackpotJunctionTransactorSession) Roll() (*types.Transaction, error) { + return _JackpotJunction.Contract.Roll(&_JackpotJunction.TransactOpts) +} + +// SafeBatchTransferFrom is a paid mutator transaction binding the contract method 0x2eb2c2d6. +// +// Solidity: function safeBatchTransferFrom(address from, address to, uint256[] ids, uint256[] values, bytes data) returns() +func (_JackpotJunction *JackpotJunctionTransactor) SafeBatchTransferFrom(opts *bind.TransactOpts, from common.Address, to common.Address, ids []*big.Int, values []*big.Int, data []byte) (*types.Transaction, error) { + return _JackpotJunction.contract.Transact(opts, "safeBatchTransferFrom", from, to, ids, values, data) +} + +// SafeBatchTransferFrom is a paid mutator transaction binding the contract method 0x2eb2c2d6. +// +// Solidity: function safeBatchTransferFrom(address from, address to, uint256[] ids, uint256[] values, bytes data) returns() +func (_JackpotJunction *JackpotJunctionSession) SafeBatchTransferFrom(from common.Address, to common.Address, ids []*big.Int, values []*big.Int, data []byte) (*types.Transaction, error) { + return _JackpotJunction.Contract.SafeBatchTransferFrom(&_JackpotJunction.TransactOpts, from, to, ids, values, data) +} + +// SafeBatchTransferFrom is a paid mutator transaction binding the contract method 0x2eb2c2d6. +// +// Solidity: function safeBatchTransferFrom(address from, address to, uint256[] ids, uint256[] values, bytes data) returns() +func (_JackpotJunction *JackpotJunctionTransactorSession) SafeBatchTransferFrom(from common.Address, to common.Address, ids []*big.Int, values []*big.Int, data []byte) (*types.Transaction, error) { + return _JackpotJunction.Contract.SafeBatchTransferFrom(&_JackpotJunction.TransactOpts, from, to, ids, values, data) +} + +// SafeTransferFrom is a paid mutator transaction binding the contract method 0xf242432a. +// +// Solidity: function safeTransferFrom(address from, address to, uint256 id, uint256 value, bytes data) returns() +func (_JackpotJunction *JackpotJunctionTransactor) SafeTransferFrom(opts *bind.TransactOpts, from common.Address, to common.Address, id *big.Int, value *big.Int, data []byte) (*types.Transaction, error) { + return _JackpotJunction.contract.Transact(opts, "safeTransferFrom", from, to, id, value, data) +} + +// SafeTransferFrom is a paid mutator transaction binding the contract method 0xf242432a. +// +// Solidity: function safeTransferFrom(address from, address to, uint256 id, uint256 value, bytes data) returns() +func (_JackpotJunction *JackpotJunctionSession) SafeTransferFrom(from common.Address, to common.Address, id *big.Int, value *big.Int, data []byte) (*types.Transaction, error) { + return _JackpotJunction.Contract.SafeTransferFrom(&_JackpotJunction.TransactOpts, from, to, id, value, data) +} + +// SafeTransferFrom is a paid mutator transaction binding the contract method 0xf242432a. +// +// Solidity: function safeTransferFrom(address from, address to, uint256 id, uint256 value, bytes data) returns() +func (_JackpotJunction *JackpotJunctionTransactorSession) SafeTransferFrom(from common.Address, to common.Address, id *big.Int, value *big.Int, data []byte) (*types.Transaction, error) { + return _JackpotJunction.Contract.SafeTransferFrom(&_JackpotJunction.TransactOpts, from, to, id, value, data) +} + +// SetApprovalForAll is a paid mutator transaction binding the contract method 0xa22cb465. +// +// Solidity: function setApprovalForAll(address operator, bool approved) returns() +func (_JackpotJunction *JackpotJunctionTransactor) SetApprovalForAll(opts *bind.TransactOpts, operator common.Address, approved bool) (*types.Transaction, error) { + return _JackpotJunction.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 (_JackpotJunction *JackpotJunctionSession) SetApprovalForAll(operator common.Address, approved bool) (*types.Transaction, error) { + return _JackpotJunction.Contract.SetApprovalForAll(&_JackpotJunction.TransactOpts, operator, approved) +} + +// SetApprovalForAll is a paid mutator transaction binding the contract method 0xa22cb465. +// +// Solidity: function setApprovalForAll(address operator, bool approved) returns() +func (_JackpotJunction *JackpotJunctionTransactorSession) SetApprovalForAll(operator common.Address, approved bool) (*types.Transaction, error) { + return _JackpotJunction.Contract.SetApprovalForAll(&_JackpotJunction.TransactOpts, operator, approved) +} + +// Receive is a paid mutator transaction binding the contract receive function. +// +// Solidity: receive() payable returns() +func (_JackpotJunction *JackpotJunctionTransactor) Receive(opts *bind.TransactOpts) (*types.Transaction, error) { + return _JackpotJunction.contract.RawTransact(opts, nil) // calldata is disallowed for receive function +} + +// Receive is a paid mutator transaction binding the contract receive function. +// +// Solidity: receive() payable returns() +func (_JackpotJunction *JackpotJunctionSession) Receive() (*types.Transaction, error) { + return _JackpotJunction.Contract.Receive(&_JackpotJunction.TransactOpts) +} + +// Receive is a paid mutator transaction binding the contract receive function. +// +// Solidity: receive() payable returns() +func (_JackpotJunction *JackpotJunctionTransactorSession) Receive() (*types.Transaction, error) { + return _JackpotJunction.Contract.Receive(&_JackpotJunction.TransactOpts) +} + +// JackpotJunctionApprovalForAllIterator is returned from FilterApprovalForAll and is used to iterate over the raw logs and unpacked data for ApprovalForAll events raised by the JackpotJunction contract. +type JackpotJunctionApprovalForAllIterator struct { + Event *JackpotJunctionApprovalForAll // 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 *JackpotJunctionApprovalForAllIterator) 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(JackpotJunctionApprovalForAll) + 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(JackpotJunctionApprovalForAll) + 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 *JackpotJunctionApprovalForAllIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *JackpotJunctionApprovalForAllIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// JackpotJunctionApprovalForAll represents a ApprovalForAll event raised by the JackpotJunction contract. +type JackpotJunctionApprovalForAll struct { + Account 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 account, address indexed operator, bool approved) +func (_JackpotJunction *JackpotJunctionFilterer) FilterApprovalForAll(opts *bind.FilterOpts, account []common.Address, operator []common.Address) (*JackpotJunctionApprovalForAllIterator, error) { + + var accountRule []interface{} + for _, accountItem := range account { + accountRule = append(accountRule, accountItem) + } + var operatorRule []interface{} + for _, operatorItem := range operator { + operatorRule = append(operatorRule, operatorItem) + } + + logs, sub, err := _JackpotJunction.contract.FilterLogs(opts, "ApprovalForAll", accountRule, operatorRule) + if err != nil { + return nil, err + } + return &JackpotJunctionApprovalForAllIterator{contract: _JackpotJunction.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 account, address indexed operator, bool approved) +func (_JackpotJunction *JackpotJunctionFilterer) WatchApprovalForAll(opts *bind.WatchOpts, sink chan<- *JackpotJunctionApprovalForAll, account []common.Address, operator []common.Address) (event.Subscription, error) { + + var accountRule []interface{} + for _, accountItem := range account { + accountRule = append(accountRule, accountItem) + } + var operatorRule []interface{} + for _, operatorItem := range operator { + operatorRule = append(operatorRule, operatorItem) + } + + logs, sub, err := _JackpotJunction.contract.WatchLogs(opts, "ApprovalForAll", accountRule, 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(JackpotJunctionApprovalForAll) + if err := _JackpotJunction.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 account, address indexed operator, bool approved) +func (_JackpotJunction *JackpotJunctionFilterer) ParseApprovalForAll(log types.Log) (*JackpotJunctionApprovalForAll, error) { + event := new(JackpotJunctionApprovalForAll) + if err := _JackpotJunction.contract.UnpackLog(event, "ApprovalForAll", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// JackpotJunctionAwardIterator is returned from FilterAward and is used to iterate over the raw logs and unpacked data for Award events raised by the JackpotJunction contract. +type JackpotJunctionAwardIterator struct { + Event *JackpotJunctionAward // 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 *JackpotJunctionAwardIterator) 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(JackpotJunctionAward) + 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(JackpotJunctionAward) + 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 *JackpotJunctionAwardIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *JackpotJunctionAwardIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// JackpotJunctionAward represents a Award event raised by the JackpotJunction contract. +type JackpotJunctionAward struct { + Player common.Address + Outcome *big.Int + Value *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterAward is a free log retrieval operation binding the contract event 0x1187560d7b166b3122e71aedb88f19cf2f33b2d141b513fde3ca2562d19d1bcb. +// +// Solidity: event Award(address indexed player, uint256 indexed outcome, uint256 value) +func (_JackpotJunction *JackpotJunctionFilterer) FilterAward(opts *bind.FilterOpts, player []common.Address, outcome []*big.Int) (*JackpotJunctionAwardIterator, error) { + + var playerRule []interface{} + for _, playerItem := range player { + playerRule = append(playerRule, playerItem) + } + var outcomeRule []interface{} + for _, outcomeItem := range outcome { + outcomeRule = append(outcomeRule, outcomeItem) + } + + logs, sub, err := _JackpotJunction.contract.FilterLogs(opts, "Award", playerRule, outcomeRule) + if err != nil { + return nil, err + } + return &JackpotJunctionAwardIterator{contract: _JackpotJunction.contract, event: "Award", logs: logs, sub: sub}, nil +} + +// WatchAward is a free log subscription operation binding the contract event 0x1187560d7b166b3122e71aedb88f19cf2f33b2d141b513fde3ca2562d19d1bcb. +// +// Solidity: event Award(address indexed player, uint256 indexed outcome, uint256 value) +func (_JackpotJunction *JackpotJunctionFilterer) WatchAward(opts *bind.WatchOpts, sink chan<- *JackpotJunctionAward, player []common.Address, outcome []*big.Int) (event.Subscription, error) { + + var playerRule []interface{} + for _, playerItem := range player { + playerRule = append(playerRule, playerItem) + } + var outcomeRule []interface{} + for _, outcomeItem := range outcome { + outcomeRule = append(outcomeRule, outcomeItem) + } + + logs, sub, err := _JackpotJunction.contract.WatchLogs(opts, "Award", playerRule, outcomeRule) + 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(JackpotJunctionAward) + if err := _JackpotJunction.contract.UnpackLog(event, "Award", 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 +} + +// ParseAward is a log parse operation binding the contract event 0x1187560d7b166b3122e71aedb88f19cf2f33b2d141b513fde3ca2562d19d1bcb. +// +// Solidity: event Award(address indexed player, uint256 indexed outcome, uint256 value) +func (_JackpotJunction *JackpotJunctionFilterer) ParseAward(log types.Log) (*JackpotJunctionAward, error) { + event := new(JackpotJunctionAward) + if err := _JackpotJunction.contract.UnpackLog(event, "Award", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// JackpotJunctionRollIterator is returned from FilterRoll and is used to iterate over the raw logs and unpacked data for Roll events raised by the JackpotJunction contract. +type JackpotJunctionRollIterator struct { + Event *JackpotJunctionRoll // 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 *JackpotJunctionRollIterator) 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(JackpotJunctionRoll) + 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(JackpotJunctionRoll) + 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 *JackpotJunctionRollIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *JackpotJunctionRollIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// JackpotJunctionRoll represents a Roll event raised by the JackpotJunction contract. +type JackpotJunctionRoll struct { + Player common.Address + Raw types.Log // Blockchain specific contextual infos +} + +// FilterRoll is a free log retrieval operation binding the contract event 0x663b85167cccb9640fb0a935c4853ea50b0f3dd07d2590ca19942153136cef56. +// +// Solidity: event Roll(address indexed player) +func (_JackpotJunction *JackpotJunctionFilterer) FilterRoll(opts *bind.FilterOpts, player []common.Address) (*JackpotJunctionRollIterator, error) { + + var playerRule []interface{} + for _, playerItem := range player { + playerRule = append(playerRule, playerItem) + } + + logs, sub, err := _JackpotJunction.contract.FilterLogs(opts, "Roll", playerRule) + if err != nil { + return nil, err + } + return &JackpotJunctionRollIterator{contract: _JackpotJunction.contract, event: "Roll", logs: logs, sub: sub}, nil +} + +// WatchRoll is a free log subscription operation binding the contract event 0x663b85167cccb9640fb0a935c4853ea50b0f3dd07d2590ca19942153136cef56. +// +// Solidity: event Roll(address indexed player) +func (_JackpotJunction *JackpotJunctionFilterer) WatchRoll(opts *bind.WatchOpts, sink chan<- *JackpotJunctionRoll, player []common.Address) (event.Subscription, error) { + + var playerRule []interface{} + for _, playerItem := range player { + playerRule = append(playerRule, playerItem) + } + + logs, sub, err := _JackpotJunction.contract.WatchLogs(opts, "Roll", playerRule) + 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(JackpotJunctionRoll) + if err := _JackpotJunction.contract.UnpackLog(event, "Roll", 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 +} + +// ParseRoll is a log parse operation binding the contract event 0x663b85167cccb9640fb0a935c4853ea50b0f3dd07d2590ca19942153136cef56. +// +// Solidity: event Roll(address indexed player) +func (_JackpotJunction *JackpotJunctionFilterer) ParseRoll(log types.Log) (*JackpotJunctionRoll, error) { + event := new(JackpotJunctionRoll) + if err := _JackpotJunction.contract.UnpackLog(event, "Roll", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// JackpotJunctionTierUnlockedIterator is returned from FilterTierUnlocked and is used to iterate over the raw logs and unpacked data for TierUnlocked events raised by the JackpotJunction contract. +type JackpotJunctionTierUnlockedIterator struct { + Event *JackpotJunctionTierUnlocked // 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 *JackpotJunctionTierUnlockedIterator) 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(JackpotJunctionTierUnlocked) + 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(JackpotJunctionTierUnlocked) + 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 *JackpotJunctionTierUnlockedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *JackpotJunctionTierUnlockedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// JackpotJunctionTierUnlocked represents a TierUnlocked event raised by the JackpotJunction contract. +type JackpotJunctionTierUnlocked struct { + ItemType *big.Int + TerrainType *big.Int + Tier *big.Int + PoolID *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterTierUnlocked is a free log retrieval operation binding the contract event 0x4b4325b9305cc4ce94c0e31c581c16ade0808971cfac8470d7a9c67ddbc9f629. +// +// Solidity: event TierUnlocked(uint256 indexed itemType, uint256 indexed terrainType, uint256 indexed tier, uint256 poolID) +func (_JackpotJunction *JackpotJunctionFilterer) FilterTierUnlocked(opts *bind.FilterOpts, itemType []*big.Int, terrainType []*big.Int, tier []*big.Int) (*JackpotJunctionTierUnlockedIterator, error) { + + var itemTypeRule []interface{} + for _, itemTypeItem := range itemType { + itemTypeRule = append(itemTypeRule, itemTypeItem) + } + var terrainTypeRule []interface{} + for _, terrainTypeItem := range terrainType { + terrainTypeRule = append(terrainTypeRule, terrainTypeItem) + } + var tierRule []interface{} + for _, tierItem := range tier { + tierRule = append(tierRule, tierItem) + } + + logs, sub, err := _JackpotJunction.contract.FilterLogs(opts, "TierUnlocked", itemTypeRule, terrainTypeRule, tierRule) + if err != nil { + return nil, err + } + return &JackpotJunctionTierUnlockedIterator{contract: _JackpotJunction.contract, event: "TierUnlocked", logs: logs, sub: sub}, nil +} + +// WatchTierUnlocked is a free log subscription operation binding the contract event 0x4b4325b9305cc4ce94c0e31c581c16ade0808971cfac8470d7a9c67ddbc9f629. +// +// Solidity: event TierUnlocked(uint256 indexed itemType, uint256 indexed terrainType, uint256 indexed tier, uint256 poolID) +func (_JackpotJunction *JackpotJunctionFilterer) WatchTierUnlocked(opts *bind.WatchOpts, sink chan<- *JackpotJunctionTierUnlocked, itemType []*big.Int, terrainType []*big.Int, tier []*big.Int) (event.Subscription, error) { + + var itemTypeRule []interface{} + for _, itemTypeItem := range itemType { + itemTypeRule = append(itemTypeRule, itemTypeItem) + } + var terrainTypeRule []interface{} + for _, terrainTypeItem := range terrainType { + terrainTypeRule = append(terrainTypeRule, terrainTypeItem) + } + var tierRule []interface{} + for _, tierItem := range tier { + tierRule = append(tierRule, tierItem) + } + + logs, sub, err := _JackpotJunction.contract.WatchLogs(opts, "TierUnlocked", itemTypeRule, terrainTypeRule, tierRule) + 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(JackpotJunctionTierUnlocked) + if err := _JackpotJunction.contract.UnpackLog(event, "TierUnlocked", 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 +} + +// ParseTierUnlocked is a log parse operation binding the contract event 0x4b4325b9305cc4ce94c0e31c581c16ade0808971cfac8470d7a9c67ddbc9f629. +// +// Solidity: event TierUnlocked(uint256 indexed itemType, uint256 indexed terrainType, uint256 indexed tier, uint256 poolID) +func (_JackpotJunction *JackpotJunctionFilterer) ParseTierUnlocked(log types.Log) (*JackpotJunctionTierUnlocked, error) { + event := new(JackpotJunctionTierUnlocked) + if err := _JackpotJunction.contract.UnpackLog(event, "TierUnlocked", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// JackpotJunctionTransferBatchIterator is returned from FilterTransferBatch and is used to iterate over the raw logs and unpacked data for TransferBatch events raised by the JackpotJunction contract. +type JackpotJunctionTransferBatchIterator struct { + Event *JackpotJunctionTransferBatch // 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 *JackpotJunctionTransferBatchIterator) 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(JackpotJunctionTransferBatch) + 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(JackpotJunctionTransferBatch) + 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 *JackpotJunctionTransferBatchIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *JackpotJunctionTransferBatchIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// JackpotJunctionTransferBatch represents a TransferBatch event raised by the JackpotJunction contract. +type JackpotJunctionTransferBatch struct { + Operator common.Address + From common.Address + To common.Address + Ids []*big.Int + Values []*big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterTransferBatch is a free log retrieval operation binding the contract event 0x4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb. +// +// Solidity: event TransferBatch(address indexed operator, address indexed from, address indexed to, uint256[] ids, uint256[] values) +func (_JackpotJunction *JackpotJunctionFilterer) FilterTransferBatch(opts *bind.FilterOpts, operator []common.Address, from []common.Address, to []common.Address) (*JackpotJunctionTransferBatchIterator, error) { + + var operatorRule []interface{} + for _, operatorItem := range operator { + operatorRule = append(operatorRule, operatorItem) + } + var fromRule []interface{} + for _, fromItem := range from { + fromRule = append(fromRule, fromItem) + } + var toRule []interface{} + for _, toItem := range to { + toRule = append(toRule, toItem) + } + + logs, sub, err := _JackpotJunction.contract.FilterLogs(opts, "TransferBatch", operatorRule, fromRule, toRule) + if err != nil { + return nil, err + } + return &JackpotJunctionTransferBatchIterator{contract: _JackpotJunction.contract, event: "TransferBatch", logs: logs, sub: sub}, nil +} + +// WatchTransferBatch is a free log subscription operation binding the contract event 0x4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb. +// +// Solidity: event TransferBatch(address indexed operator, address indexed from, address indexed to, uint256[] ids, uint256[] values) +func (_JackpotJunction *JackpotJunctionFilterer) WatchTransferBatch(opts *bind.WatchOpts, sink chan<- *JackpotJunctionTransferBatch, operator []common.Address, from []common.Address, to []common.Address) (event.Subscription, error) { + + var operatorRule []interface{} + for _, operatorItem := range operator { + operatorRule = append(operatorRule, operatorItem) + } + var fromRule []interface{} + for _, fromItem := range from { + fromRule = append(fromRule, fromItem) + } + var toRule []interface{} + for _, toItem := range to { + toRule = append(toRule, toItem) + } + + logs, sub, err := _JackpotJunction.contract.WatchLogs(opts, "TransferBatch", operatorRule, fromRule, toRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(JackpotJunctionTransferBatch) + if err := _JackpotJunction.contract.UnpackLog(event, "TransferBatch", 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 +} + +// ParseTransferBatch is a log parse operation binding the contract event 0x4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb. +// +// Solidity: event TransferBatch(address indexed operator, address indexed from, address indexed to, uint256[] ids, uint256[] values) +func (_JackpotJunction *JackpotJunctionFilterer) ParseTransferBatch(log types.Log) (*JackpotJunctionTransferBatch, error) { + event := new(JackpotJunctionTransferBatch) + if err := _JackpotJunction.contract.UnpackLog(event, "TransferBatch", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// JackpotJunctionTransferSingleIterator is returned from FilterTransferSingle and is used to iterate over the raw logs and unpacked data for TransferSingle events raised by the JackpotJunction contract. +type JackpotJunctionTransferSingleIterator struct { + Event *JackpotJunctionTransferSingle // 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 *JackpotJunctionTransferSingleIterator) 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(JackpotJunctionTransferSingle) + 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(JackpotJunctionTransferSingle) + 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 *JackpotJunctionTransferSingleIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *JackpotJunctionTransferSingleIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// JackpotJunctionTransferSingle represents a TransferSingle event raised by the JackpotJunction contract. +type JackpotJunctionTransferSingle struct { + Operator common.Address + From common.Address + To common.Address + Id *big.Int + Value *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterTransferSingle is a free log retrieval operation binding the contract event 0xc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62. +// +// Solidity: event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value) +func (_JackpotJunction *JackpotJunctionFilterer) FilterTransferSingle(opts *bind.FilterOpts, operator []common.Address, from []common.Address, to []common.Address) (*JackpotJunctionTransferSingleIterator, error) { + + var operatorRule []interface{} + for _, operatorItem := range operator { + operatorRule = append(operatorRule, operatorItem) + } + var fromRule []interface{} + for _, fromItem := range from { + fromRule = append(fromRule, fromItem) + } + var toRule []interface{} + for _, toItem := range to { + toRule = append(toRule, toItem) + } + + logs, sub, err := _JackpotJunction.contract.FilterLogs(opts, "TransferSingle", operatorRule, fromRule, toRule) + if err != nil { + return nil, err + } + return &JackpotJunctionTransferSingleIterator{contract: _JackpotJunction.contract, event: "TransferSingle", logs: logs, sub: sub}, nil +} + +// WatchTransferSingle is a free log subscription operation binding the contract event 0xc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62. +// +// Solidity: event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value) +func (_JackpotJunction *JackpotJunctionFilterer) WatchTransferSingle(opts *bind.WatchOpts, sink chan<- *JackpotJunctionTransferSingle, operator []common.Address, from []common.Address, to []common.Address) (event.Subscription, error) { + + var operatorRule []interface{} + for _, operatorItem := range operator { + operatorRule = append(operatorRule, operatorItem) + } + var fromRule []interface{} + for _, fromItem := range from { + fromRule = append(fromRule, fromItem) + } + var toRule []interface{} + for _, toItem := range to { + toRule = append(toRule, toItem) + } + + logs, sub, err := _JackpotJunction.contract.WatchLogs(opts, "TransferSingle", operatorRule, fromRule, toRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(JackpotJunctionTransferSingle) + if err := _JackpotJunction.contract.UnpackLog(event, "TransferSingle", 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 +} + +// ParseTransferSingle is a log parse operation binding the contract event 0xc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62. +// +// Solidity: event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value) +func (_JackpotJunction *JackpotJunctionFilterer) ParseTransferSingle(log types.Log) (*JackpotJunctionTransferSingle, error) { + event := new(JackpotJunctionTransferSingle) + if err := _JackpotJunction.contract.UnpackLog(event, "TransferSingle", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// JackpotJunctionURIIterator is returned from FilterURI and is used to iterate over the raw logs and unpacked data for URI events raised by the JackpotJunction contract. +type JackpotJunctionURIIterator struct { + Event *JackpotJunctionURI // 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 *JackpotJunctionURIIterator) 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(JackpotJunctionURI) + 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(JackpotJunctionURI) + 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 *JackpotJunctionURIIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *JackpotJunctionURIIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// JackpotJunctionURI represents a URI event raised by the JackpotJunction contract. +type JackpotJunctionURI struct { + Value string + Id *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterURI is a free log retrieval operation binding the contract event 0x6bb7ff708619ba0610cba295a58592e0451dee2622938c8755667688daf3529b. +// +// Solidity: event URI(string value, uint256 indexed id) +func (_JackpotJunction *JackpotJunctionFilterer) FilterURI(opts *bind.FilterOpts, id []*big.Int) (*JackpotJunctionURIIterator, error) { + + var idRule []interface{} + for _, idItem := range id { + idRule = append(idRule, idItem) + } + + logs, sub, err := _JackpotJunction.contract.FilterLogs(opts, "URI", idRule) + if err != nil { + return nil, err + } + return &JackpotJunctionURIIterator{contract: _JackpotJunction.contract, event: "URI", logs: logs, sub: sub}, nil +} + +// WatchURI is a free log subscription operation binding the contract event 0x6bb7ff708619ba0610cba295a58592e0451dee2622938c8755667688daf3529b. +// +// Solidity: event URI(string value, uint256 indexed id) +func (_JackpotJunction *JackpotJunctionFilterer) WatchURI(opts *bind.WatchOpts, sink chan<- *JackpotJunctionURI, id []*big.Int) (event.Subscription, error) { + + var idRule []interface{} + for _, idItem := range id { + idRule = append(idRule, idItem) + } + + logs, sub, err := _JackpotJunction.contract.WatchLogs(opts, "URI", idRule) + 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(JackpotJunctionURI) + if err := _JackpotJunction.contract.UnpackLog(event, "URI", 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 +} + +// ParseURI is a log parse operation binding the contract event 0x6bb7ff708619ba0610cba295a58592e0451dee2622938c8755667688daf3529b. +// +// Solidity: event URI(string value, uint256 indexed id) +func (_JackpotJunction *JackpotJunctionFilterer) ParseURI(log types.Log) (*JackpotJunctionURI, error) { + event := new(JackpotJunctionURI) + if err := _JackpotJunction.contract.UnpackLog(event, "URI", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +func CreateJackpotJunctionDeploymentCommand() *cobra.Command { + var keyfile, nonce, password, value, gasPrice, maxFeePerGas, maxPriorityFeePerGas, rpc string + var gasLimit uint64 + var simulate bool + var timeout uint + + var blocksToAct *big.Int + var blocksToActRaw string + var costToRoll *big.Int + var costToRollRaw string + var costToReroll *big.Int + var costToRerollRaw string + + cmd := &cobra.Command{ + Use: "deploy", + Short: "Deploy a new JackpotJunction 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)") + } + + if blocksToActRaw == "" { + return fmt.Errorf("--blocks-to-act argument not specified") + } + blocksToAct = new(big.Int) + blocksToAct.SetString(blocksToActRaw, 0) + + if costToRollRaw == "" { + return fmt.Errorf("--cost-to-roll argument not specified") + } + costToRoll = new(big.Int) + costToRoll.SetString(costToRollRaw, 0) + + if costToRerollRaw == "" { + return fmt.Errorf("--cost-to-reroll argument not specified") + } + costToReroll = new(big.Int) + costToReroll.SetString(costToRerollRaw, 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) + + address, deploymentTransaction, _, deploymentErr := DeployJackpotJunction( + transactionOpts, + client, + blocksToAct, + costToRoll, + costToReroll, + ) + 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") + + cmd.Flags().StringVar(&blocksToActRaw, "blocks-to-act", "", "blocks-to-act argument") + cmd.Flags().StringVar(&costToRollRaw, "cost-to-roll", "", "cost-to-roll argument") + cmd.Flags().StringVar(&costToRerollRaw, "cost-to-reroll", "", "cost-to-reroll argument") + + return cmd +} + +func CreateBlocksToActCommand() *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: "blocks-to-act", + Short: "Call the BlocksToAct view method on a JackpotJunction 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 := NewJackpotJunction(contractAddress, client) + if contractErr != nil { + return contractErr + } + + callOpts := bind.CallOpts{} + SetCallParametersFromArgs(&callOpts, pending, fromAddressRaw, blockNumberRaw) + + session := JackpotJunctionCallerSession{ + Contract: &contract.JackpotJunctionCaller, + CallOpts: callOpts, + } + + var callErr error + capture0, callErr = session.BlocksToAct() + 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 CreateCostToRollCommand() *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: "cost-to-roll", + Short: "Call the CostToRoll view method on a JackpotJunction 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 := NewJackpotJunction(contractAddress, client) + if contractErr != nil { + return contractErr + } + + callOpts := bind.CallOpts{} + SetCallParametersFromArgs(&callOpts, pending, fromAddressRaw, blockNumberRaw) + + session := JackpotJunctionCallerSession{ + Contract: &contract.JackpotJunctionCaller, + CallOpts: callOpts, + } + + var callErr error + capture0, callErr = session.CostToRoll() + 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 CreateSampleImprovedOutcomesCumulativeMassCommand() *cobra.Command { + var contractAddressRaw, rpc string + var contractAddress common.Address + var timeout uint + + var blockNumberRaw, fromAddressRaw string + var pending bool + + var entropy *big.Int + var entropyRaw string + + var capture0 *big.Int + + cmd := &cobra.Command{ + Use: "sample-improved-outcomes-cumulative-mass", + Short: "Call the SampleImprovedOutcomesCumulativeMass view method on a JackpotJunction 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 entropyRaw == "" { + return fmt.Errorf("--entropy argument not specified") + } + entropy = new(big.Int) + entropy.SetString(entropyRaw, 0) + + return nil + }, + RunE: func(cmd *cobra.Command, args []string) error { + client, clientErr := NewClient(rpc) + if clientErr != nil { + return clientErr + } + + contract, contractErr := NewJackpotJunction(contractAddress, client) + if contractErr != nil { + return contractErr + } + + callOpts := bind.CallOpts{} + SetCallParametersFromArgs(&callOpts, pending, fromAddressRaw, blockNumberRaw) + + session := JackpotJunctionCallerSession{ + Contract: &contract.JackpotJunctionCaller, + CallOpts: callOpts, + } + + var callErr error + capture0, callErr = session.SampleImprovedOutcomesCumulativeMass( + entropy, + ) + 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(&entropyRaw, "entropy", "", "entropy argument") + + return cmd +} +func CreateCostToRerollCommand() *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: "cost-to-reroll", + Short: "Call the CostToReroll view method on a JackpotJunction 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 := NewJackpotJunction(contractAddress, client) + if contractErr != nil { + return contractErr + } + + callOpts := bind.CallOpts{} + SetCallParametersFromArgs(&callOpts, pending, fromAddressRaw, blockNumberRaw) + + session := JackpotJunctionCallerSession{ + Contract: &contract.JackpotJunctionCaller, + CallOpts: callOpts, + } + + var callErr error + capture0, callErr = session.CostToReroll() + 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 CreateImprovedOutcomesCumulativeMassCommand() *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 *big.Int + + cmd := &cobra.Command{ + Use: "improved-outcomes-cumulative-mass", + Short: "Call the ImprovedOutcomesCumulativeMass view method on a JackpotJunction 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 := NewJackpotJunction(contractAddress, client) + if contractErr != nil { + return contractErr + } + + callOpts := bind.CallOpts{} + SetCallParametersFromArgs(&callOpts, pending, fromAddressRaw, blockNumberRaw) + + session := JackpotJunctionCallerSession{ + Contract: &contract.JackpotJunctionCaller, + CallOpts: callOpts, + } + + var callErr error + capture0, callErr = session.ImprovedOutcomesCumulativeMass( + arg0, + ) + 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(&arg0Raw, "arg-0", "", "arg-0 argument") + + 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 account common.Address + var accountRaw 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 JackpotJunction 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 accountRaw == "" { + return fmt.Errorf("--account argument not specified") + } else if !common.IsHexAddress(accountRaw) { + return fmt.Errorf("--account argument is not a valid Ethereum address") + } + account = common.HexToAddress(accountRaw) + + 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 := NewJackpotJunction(contractAddress, client) + if contractErr != nil { + return contractErr + } + + callOpts := bind.CallOpts{} + SetCallParametersFromArgs(&callOpts, pending, fromAddressRaw, blockNumberRaw) + + session := JackpotJunctionCallerSession{ + Contract: &contract.JackpotJunctionCaller, + CallOpts: callOpts, + } + + var callErr error + capture0, callErr = session.IsApprovedForAll( + account, + 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(&accountRaw, "account", "", "account argument") + cmd.Flags().StringVar(&operatorRaw, "operator", "", "operator 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 JackpotJunction 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 := NewJackpotJunction(contractAddress, client) + if contractErr != nil { + return contractErr + } + + callOpts := bind.CallOpts{} + SetCallParametersFromArgs(&callOpts, pending, fromAddressRaw, blockNumberRaw) + + session := JackpotJunctionCallerSession{ + Contract: &contract.JackpotJunctionCaller, + 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 CreateUriCommand() *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 string + + cmd := &cobra.Command{ + Use: "uri", + Short: "Call the Uri view method on a JackpotJunction 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 := NewJackpotJunction(contractAddress, client) + if contractErr != nil { + return contractErr + } + + callOpts := bind.CallOpts{} + SetCallParametersFromArgs(&callOpts, pending, fromAddressRaw, blockNumberRaw) + + session := JackpotJunctionCallerSession{ + Contract: &contract.JackpotJunctionCaller, + CallOpts: callOpts, + } + + var callErr error + capture0, callErr = session.Uri( + arg0, + ) + 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(&arg0Raw, "arg-0", "", "arg-0 argument") + + return cmd +} +func CreateLastRollBlockCommand() *cobra.Command { + var contractAddressRaw, rpc string + var contractAddress common.Address + var timeout uint + + var blockNumberRaw, fromAddressRaw string + var pending bool + + var arg0 common.Address + var arg0Raw string + + var capture0 *big.Int + + cmd := &cobra.Command{ + Use: "last-roll-block", + Short: "Call the LastRollBlock view method on a JackpotJunction 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") + } else if !common.IsHexAddress(arg0Raw) { + return fmt.Errorf("--arg-0 argument is not a valid Ethereum address") + } + arg0 = common.HexToAddress(arg0Raw) + + return nil + }, + RunE: func(cmd *cobra.Command, args []string) error { + client, clientErr := NewClient(rpc) + if clientErr != nil { + return clientErr + } + + contract, contractErr := NewJackpotJunction(contractAddress, client) + if contractErr != nil { + return contractErr + } + + callOpts := bind.CallOpts{} + SetCallParametersFromArgs(&callOpts, pending, fromAddressRaw, blockNumberRaw) + + session := JackpotJunctionCallerSession{ + Contract: &contract.JackpotJunctionCaller, + CallOpts: callOpts, + } + + var callErr error + capture0, callErr = session.LastRollBlock( + arg0, + ) + 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(&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 account common.Address + var accountRaw string + var id *big.Int + var idRaw string + + var capture0 *big.Int + + cmd := &cobra.Command{ + Use: "balance-of", + Short: "Call the BalanceOf view method on a JackpotJunction 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 accountRaw == "" { + return fmt.Errorf("--account argument not specified") + } else if !common.IsHexAddress(accountRaw) { + return fmt.Errorf("--account argument is not a valid Ethereum address") + } + account = common.HexToAddress(accountRaw) + + if idRaw == "" { + return fmt.Errorf("--id argument not specified") + } + id = new(big.Int) + id.SetString(idRaw, 0) + + return nil + }, + RunE: func(cmd *cobra.Command, args []string) error { + client, clientErr := NewClient(rpc) + if clientErr != nil { + return clientErr + } + + contract, contractErr := NewJackpotJunction(contractAddress, client) + if contractErr != nil { + return contractErr + } + + callOpts := bind.CallOpts{} + SetCallParametersFromArgs(&callOpts, pending, fromAddressRaw, blockNumberRaw) + + session := JackpotJunctionCallerSession{ + Contract: &contract.JackpotJunctionCaller, + CallOpts: callOpts, + } + + var callErr error + capture0, callErr = session.BalanceOf( + account, + id, + ) + 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(&accountRaw, "account", "", "account argument") + cmd.Flags().StringVar(&idRaw, "id", "", "id argument") + + return cmd +} +func CreateBalanceOfBatchCommand() *cobra.Command { + var contractAddressRaw, rpc string + var contractAddress common.Address + var timeout uint + + var blockNumberRaw, fromAddressRaw string + var pending bool + + var accounts []common.Address + var accountsRaw string + var ids []*big.Int + var idsRaw string + + var capture0 []*big.Int + + cmd := &cobra.Command{ + Use: "balance-of-batch", + Short: "Call the BalanceOfBatch view method on a JackpotJunction 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 accountsRaw == "" { + return fmt.Errorf("--accounts argument not specified") + } else if strings.HasPrefix(accountsRaw, "@") { + filename := strings.TrimPrefix(accountsRaw, "@") + contents, readErr := os.ReadFile(filename) + if readErr != nil { + return readErr + } + unmarshalErr := json.Unmarshal(contents, &accounts) + if unmarshalErr != nil { + return unmarshalErr + } + } else { + unmarshalErr := json.Unmarshal([]byte(accountsRaw), &accounts) + if unmarshalErr != nil { + return unmarshalErr + } + } + + if idsRaw == "" { + return fmt.Errorf("--ids argument not specified") + } else if strings.HasPrefix(idsRaw, "@") { + filename := strings.TrimPrefix(idsRaw, "@") + contents, readErr := os.ReadFile(filename) + if readErr != nil { + return readErr + } + unmarshalErr := json.Unmarshal(contents, &ids) + if unmarshalErr != nil { + return unmarshalErr + } + } else { + unmarshalErr := json.Unmarshal([]byte(idsRaw), &ids) + if unmarshalErr != nil { + return unmarshalErr + } + } + + return nil + }, + RunE: func(cmd *cobra.Command, args []string) error { + client, clientErr := NewClient(rpc) + if clientErr != nil { + return clientErr + } + + contract, contractErr := NewJackpotJunction(contractAddress, client) + if contractErr != nil { + return contractErr + } + + callOpts := bind.CallOpts{} + SetCallParametersFromArgs(&callOpts, pending, fromAddressRaw, blockNumberRaw) + + session := JackpotJunctionCallerSession{ + Contract: &contract.JackpotJunctionCaller, + CallOpts: callOpts, + } + + var callErr error + capture0, callErr = session.BalanceOfBatch( + accounts, + ids, + ) + 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(&accountsRaw, "accounts", "", "accounts argument") + cmd.Flags().StringVar(&idsRaw, "ids", "", "ids argument") + + return cmd +} +func CreateGeneraCommand() *cobra.Command { + var contractAddressRaw, rpc string + var contractAddress common.Address + var timeout uint + + var blockNumberRaw, fromAddressRaw string + var pending bool + + var poolID *big.Int + var poolIDRaw string + + var capture0 struct { + ItemType *big.Int + TerrainType *big.Int + Tier *big.Int + } + + cmd := &cobra.Command{ + Use: "genera", + Short: "Call the Genera view method on a JackpotJunction 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 poolIDRaw == "" { + return fmt.Errorf("--pool-id argument not specified") + } + poolID = new(big.Int) + poolID.SetString(poolIDRaw, 0) + + return nil + }, + RunE: func(cmd *cobra.Command, args []string) error { + client, clientErr := NewClient(rpc) + if clientErr != nil { + return clientErr + } + + contract, contractErr := NewJackpotJunction(contractAddress, client) + if contractErr != nil { + return contractErr + } + + callOpts := bind.CallOpts{} + SetCallParametersFromArgs(&callOpts, pending, fromAddressRaw, blockNumberRaw) + + session := JackpotJunctionCallerSession{ + Contract: &contract.JackpotJunctionCaller, + CallOpts: callOpts, + } + + var callErr error + capture0, callErr = session.Genera( + poolID, + ) + 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(&poolIDRaw, "pool-id", "", "pool-id argument") + + return cmd +} +func CreateOutcomeCommand() *cobra.Command { + var contractAddressRaw, rpc string + var contractAddress common.Address + var timeout uint + + var blockNumberRaw, fromAddressRaw string + var pending bool + + var degenerate common.Address + var degenerateRaw string + var bonus bool + var bonusRaw string + + var capture0 *big.Int + var capture1 *big.Int + var capture2 *big.Int + + cmd := &cobra.Command{ + Use: "outcome", + Short: "Call the Outcome view method on a JackpotJunction 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 degenerateRaw == "" { + return fmt.Errorf("--degenerate argument not specified") + } else if !common.IsHexAddress(degenerateRaw) { + return fmt.Errorf("--degenerate argument is not a valid Ethereum address") + } + degenerate = common.HexToAddress(degenerateRaw) + + bonusRawLower := strings.ToLower(bonusRaw) + switch bonusRawLower { + case "true", "t", "y", "yes", "1": + bonus = true + case "false", "f", "n", "no", "0": + bonus = false + default: + return fmt.Errorf("--bonus argument is not valid (value: %s)", bonusRaw) + } + + return nil + }, + RunE: func(cmd *cobra.Command, args []string) error { + client, clientErr := NewClient(rpc) + if clientErr != nil { + return clientErr + } + + contract, contractErr := NewJackpotJunction(contractAddress, client) + if contractErr != nil { + return contractErr + } + + callOpts := bind.CallOpts{} + SetCallParametersFromArgs(&callOpts, pending, fromAddressRaw, blockNumberRaw) + + session := JackpotJunctionCallerSession{ + Contract: &contract.JackpotJunctionCaller, + CallOpts: callOpts, + } + + var callErr error + capture0, capture1, capture2, callErr = session.Outcome( + degenerate, + bonus, + ) + if callErr != nil { + return callErr + } + + cmd.Printf("0: %s\n", capture0.String()) + cmd.Printf("1: %s\n", capture1.String()) + cmd.Printf("2: %s\n", capture2.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(°enerateRaw, "degenerate", "", "degenerate argument") + cmd.Flags().StringVar(&bonusRaw, "bonus", "", "bonus argument (true, t, y, yes, 1 OR false, f, n, no, 0)") + + return cmd +} +func CreateSampleUnmodifiedOutcomeCumulativeMassCommand() *cobra.Command { + var contractAddressRaw, rpc string + var contractAddress common.Address + var timeout uint + + var blockNumberRaw, fromAddressRaw string + var pending bool + + var entropy *big.Int + var entropyRaw string + + var capture0 *big.Int + + cmd := &cobra.Command{ + Use: "sample-unmodified-outcome-cumulative-mass", + Short: "Call the SampleUnmodifiedOutcomeCumulativeMass view method on a JackpotJunction 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 entropyRaw == "" { + return fmt.Errorf("--entropy argument not specified") + } + entropy = new(big.Int) + entropy.SetString(entropyRaw, 0) + + return nil + }, + RunE: func(cmd *cobra.Command, args []string) error { + client, clientErr := NewClient(rpc) + if clientErr != nil { + return clientErr + } + + contract, contractErr := NewJackpotJunction(contractAddress, client) + if contractErr != nil { + return contractErr + } + + callOpts := bind.CallOpts{} + SetCallParametersFromArgs(&callOpts, pending, fromAddressRaw, blockNumberRaw) + + session := JackpotJunctionCallerSession{ + Contract: &contract.JackpotJunctionCaller, + CallOpts: callOpts, + } + + var callErr error + capture0, callErr = session.SampleUnmodifiedOutcomeCumulativeMass( + entropy, + ) + 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(&entropyRaw, "entropy", "", "entropy argument") + + return cmd +} +func CreateCurrentTierCommand() *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 arg1 *big.Int + var arg1Raw string + + var capture0 *big.Int + + cmd := &cobra.Command{ + Use: "current-tier", + Short: "Call the CurrentTier view method on a JackpotJunction 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) + + if arg1Raw == "" { + return fmt.Errorf("--arg-1 argument not specified") + } + arg1 = new(big.Int) + arg1.SetString(arg1Raw, 0) + + return nil + }, + RunE: func(cmd *cobra.Command, args []string) error { + client, clientErr := NewClient(rpc) + if clientErr != nil { + return clientErr + } + + contract, contractErr := NewJackpotJunction(contractAddress, client) + if contractErr != nil { + return contractErr + } + + callOpts := bind.CallOpts{} + SetCallParametersFromArgs(&callOpts, pending, fromAddressRaw, blockNumberRaw) + + session := JackpotJunctionCallerSession{ + Contract: &contract.JackpotJunctionCaller, + CallOpts: callOpts, + } + + var callErr error + capture0, callErr = session.CurrentTier( + arg0, + arg1, + ) + 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(&arg0Raw, "arg-0", "", "arg-0 argument") + cmd.Flags().StringVar(&arg1Raw, "arg-1", "", "arg-1 argument") + + return cmd +} +func CreateUnmodifiedOutcomesCumulativeMassCommand() *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 *big.Int + + cmd := &cobra.Command{ + Use: "unmodified-outcomes-cumulative-mass", + Short: "Call the UnmodifiedOutcomesCumulativeMass view method on a JackpotJunction 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 := NewJackpotJunction(contractAddress, client) + if contractErr != nil { + return contractErr + } + + callOpts := bind.CallOpts{} + SetCallParametersFromArgs(&callOpts, pending, fromAddressRaw, blockNumberRaw) + + session := JackpotJunctionCallerSession{ + Contract: &contract.JackpotJunctionCaller, + CallOpts: callOpts, + } + + var callErr error + capture0, callErr = session.UnmodifiedOutcomesCumulativeMass( + arg0, + ) + 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(&arg0Raw, "arg-0", "", "arg-0 argument") + + return cmd +} + +func CreateAcceptWithCardsCommand() *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 wagonCover *big.Int + var wagonCoverRaw string + var wagonBody *big.Int + var wagonBodyRaw string + var wheels *big.Int + var wheelsRaw string + var beastTrain *big.Int + var beastTrainRaw string + + cmd := &cobra.Command{ + Use: "accept-with-cards", + Short: "Execute the AcceptWithCards method on a JackpotJunction 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 wagonCoverRaw == "" { + return fmt.Errorf("--wagon-cover argument not specified") + } + wagonCover = new(big.Int) + wagonCover.SetString(wagonCoverRaw, 0) + + if wagonBodyRaw == "" { + return fmt.Errorf("--wagon-body argument not specified") + } + wagonBody = new(big.Int) + wagonBody.SetString(wagonBodyRaw, 0) + + if wheelsRaw == "" { + return fmt.Errorf("--wheels argument not specified") + } + wheels = new(big.Int) + wheels.SetString(wheelsRaw, 0) + + if beastTrainRaw == "" { + return fmt.Errorf("--beast-train argument not specified") + } + beastTrain = new(big.Int) + beastTrain.SetString(beastTrainRaw, 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 := NewJackpotJunction(contractAddress, client) + if contractErr != nil { + return contractErr + } + + session := JackpotJunctionTransactorSession{ + Contract: &contract.JackpotJunctionTransactor, + TransactOpts: *transactionOpts, + } + + transaction, transactionErr := session.AcceptWithCards( + wagonCover, + wagonBody, + wheels, + beastTrain, + ) + 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(&wagonCoverRaw, "wagon-cover", "", "wagon-cover argument") + cmd.Flags().StringVar(&wagonBodyRaw, "wagon-body", "", "wagon-body argument") + cmd.Flags().StringVar(&wheelsRaw, "wheels", "", "wheels argument") + cmd.Flags().StringVar(&beastTrainRaw, "beast-train", "", "beast-train argument") + + return cmd +} +func CreateBurnCommand() *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 amount *big.Int + var amountRaw string + + cmd := &cobra.Command{ + Use: "burn", + Short: "Execute the Burn method on a JackpotJunction 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 amountRaw == "" { + return fmt.Errorf("--amount argument not specified") + } + amount = new(big.Int) + amount.SetString(amountRaw, 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 := NewJackpotJunction(contractAddress, client) + if contractErr != nil { + return contractErr + } + + session := JackpotJunctionTransactorSession{ + Contract: &contract.JackpotJunctionTransactor, + TransactOpts: *transactionOpts, + } + + transaction, transactionErr := session.Burn( + poolID, + amount, + ) + 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(&amountRaw, "amount", "", "amount 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 JackpotJunction 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 := NewJackpotJunction(contractAddress, client) + if contractErr != nil { + return contractErr + } + + session := JackpotJunctionTransactorSession{ + Contract: &contract.JackpotJunctionTransactor, + 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 CreateReceiveCommand() *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 + + cmd := &cobra.Command{ + Use: "receive", + Short: "Execute the Receive method on a JackpotJunction 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) + + 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 := NewJackpotJunction(contractAddress, client) + if contractErr != nil { + return contractErr + } + + session := JackpotJunctionTransactorSession{ + Contract: &contract.JackpotJunctionTransactor, + TransactOpts: *transactionOpts, + } + + transaction, transactionErr := session.Receive() + 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") + + return cmd +} +func CreateAcceptCommand() *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 + + cmd := &cobra.Command{ + Use: "accept", + Short: "Execute the Accept method on a JackpotJunction 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) + + 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 := NewJackpotJunction(contractAddress, client) + if contractErr != nil { + return contractErr + } + + session := JackpotJunctionTransactorSession{ + Contract: &contract.JackpotJunctionTransactor, + TransactOpts: *transactionOpts, + } + + transaction, transactionErr := session.Accept() + 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") + + return cmd +} +func CreateBurnBatchCommand() *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 poolIDs []*big.Int + var poolIDsRaw string + var amounts []*big.Int + var amountsRaw string + + cmd := &cobra.Command{ + Use: "burn-batch", + Short: "Execute the BurnBatch method on a JackpotJunction 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 poolIDsRaw == "" { + return fmt.Errorf("--pool-i-ds argument not specified") + } else if strings.HasPrefix(poolIDsRaw, "@") { + filename := strings.TrimPrefix(poolIDsRaw, "@") + contents, readErr := os.ReadFile(filename) + if readErr != nil { + return readErr + } + unmarshalErr := json.Unmarshal(contents, &poolIDs) + if unmarshalErr != nil { + return unmarshalErr + } + } else { + unmarshalErr := json.Unmarshal([]byte(poolIDsRaw), &poolIDs) + if unmarshalErr != nil { + return unmarshalErr + } + } + + if amountsRaw == "" { + return fmt.Errorf("--amounts argument not specified") + } else if strings.HasPrefix(amountsRaw, "@") { + filename := strings.TrimPrefix(amountsRaw, "@") + contents, readErr := os.ReadFile(filename) + if readErr != nil { + return readErr + } + unmarshalErr := json.Unmarshal(contents, &amounts) + if unmarshalErr != nil { + return unmarshalErr + } + } else { + unmarshalErr := json.Unmarshal([]byte(amountsRaw), &amounts) + if unmarshalErr != nil { + return unmarshalErr + } + } + + 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 := NewJackpotJunction(contractAddress, client) + if contractErr != nil { + return contractErr + } + + session := JackpotJunctionTransactorSession{ + Contract: &contract.JackpotJunctionTransactor, + TransactOpts: *transactionOpts, + } + + transaction, transactionErr := session.BurnBatch( + poolIDs, + amounts, + ) + 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(&poolIDsRaw, "pool-i-ds", "", "pool-i-ds argument") + cmd.Flags().StringVar(&amountsRaw, "amounts", "", "amounts argument") + + return cmd +} +func CreateCraftCommand() *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 numOutputs *big.Int + var numOutputsRaw string + + cmd := &cobra.Command{ + Use: "craft", + Short: "Execute the Craft method on a JackpotJunction 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 numOutputsRaw == "" { + return fmt.Errorf("--num-outputs argument not specified") + } + numOutputs = new(big.Int) + numOutputs.SetString(numOutputsRaw, 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 := NewJackpotJunction(contractAddress, client) + if contractErr != nil { + return contractErr + } + + session := JackpotJunctionTransactorSession{ + Contract: &contract.JackpotJunctionTransactor, + TransactOpts: *transactionOpts, + } + + transaction, transactionErr := session.Craft( + poolID, + numOutputs, + ) + 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(&numOutputsRaw, "num-outputs", "", "num-outputs argument") + + return cmd +} +func CreateRollCommand() *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 + + cmd := &cobra.Command{ + Use: "roll", + Short: "Execute the Roll method on a JackpotJunction 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) + + 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 := NewJackpotJunction(contractAddress, client) + if contractErr != nil { + return contractErr + } + + session := JackpotJunctionTransactorSession{ + Contract: &contract.JackpotJunctionTransactor, + TransactOpts: *transactionOpts, + } + + transaction, transactionErr := session.Roll() + 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") + + return cmd +} +func CreateSafeBatchTransferFromCommand() *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 ids []*big.Int + var idsRaw string + var values []*big.Int + var valuesRaw string + var data []byte + var dataRaw string + + cmd := &cobra.Command{ + Use: "safe-batch-transfer-from", + Short: "Execute the SafeBatchTransferFrom method on a JackpotJunction 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 idsRaw == "" { + return fmt.Errorf("--ids argument not specified") + } else if strings.HasPrefix(idsRaw, "@") { + filename := strings.TrimPrefix(idsRaw, "@") + contents, readErr := os.ReadFile(filename) + if readErr != nil { + return readErr + } + unmarshalErr := json.Unmarshal(contents, &ids) + if unmarshalErr != nil { + return unmarshalErr + } + } else { + unmarshalErr := json.Unmarshal([]byte(idsRaw), &ids) + if unmarshalErr != nil { + return unmarshalErr + } + } + + if valuesRaw == "" { + return fmt.Errorf("--values argument not specified") + } else if strings.HasPrefix(valuesRaw, "@") { + filename := strings.TrimPrefix(valuesRaw, "@") + contents, readErr := os.ReadFile(filename) + if readErr != nil { + return readErr + } + unmarshalErr := json.Unmarshal(contents, &values) + if unmarshalErr != nil { + return unmarshalErr + } + } else { + unmarshalErr := json.Unmarshal([]byte(valuesRaw), &values) + if unmarshalErr != nil { + return unmarshalErr + } + } + + 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 := NewJackpotJunction(contractAddress, client) + if contractErr != nil { + return contractErr + } + + session := JackpotJunctionTransactorSession{ + Contract: &contract.JackpotJunctionTransactor, + TransactOpts: *transactionOpts, + } + + transaction, transactionErr := session.SafeBatchTransferFrom( + from0, + to0, + ids, + values, + 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(&idsRaw, "ids", "", "ids argument") + cmd.Flags().StringVar(&valuesRaw, "values", "", "values argument") + cmd.Flags().StringVar(&dataRaw, "data", "", "data 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 id *big.Int + var idRaw string + var value0 *big.Int + var value0Raw string + var data []byte + var dataRaw string + + cmd := &cobra.Command{ + Use: "safe-transfer-from", + Short: "Execute the SafeTransferFrom method on a JackpotJunction 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 idRaw == "" { + return fmt.Errorf("--id argument not specified") + } + id = new(big.Int) + id.SetString(idRaw, 0) + + if value0Raw == "" { + return fmt.Errorf("--value-0 argument not specified") + } + value0 = new(big.Int) + value0.SetString(value0Raw, 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 := NewJackpotJunction(contractAddress, client) + if contractErr != nil { + return contractErr + } + + session := JackpotJunctionTransactorSession{ + Contract: &contract.JackpotJunctionTransactor, + TransactOpts: *transactionOpts, + } + + transaction, transactionErr := session.SafeTransferFrom( + from0, + to0, + id, + value0, + 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(&idRaw, "id", "", "id argument") + cmd.Flags().StringVar(&value0Raw, "value-0", "", "value-0 argument") + cmd.Flags().StringVar(&dataRaw, "data", "", "data argument") + + return cmd +} + +var ErrNoRPCURL error = errors.New("no RPC URL provided -- please pass an RPC URL from the command line or set the JACKPOT_JUNCTION_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 JACKPOT_JUNCTION_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("JACKPOT_JUNCTION_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 CreateJackpotJunctionCommand() *cobra.Command { + cmd := &cobra.Command{ + Use: "jackpot-junction", + Short: "Interact with the JackpotJunction 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) + + cmdDeployJackpotJunction := CreateJackpotJunctionDeploymentCommand() + cmdDeployJackpotJunction.GroupID = DeployGroup.ID + cmd.AddCommand(cmdDeployJackpotJunction) + + cmdViewBlocksToAct := CreateBlocksToActCommand() + cmdViewBlocksToAct.GroupID = ViewGroup.ID + cmd.AddCommand(cmdViewBlocksToAct) + cmdViewCostToRoll := CreateCostToRollCommand() + cmdViewCostToRoll.GroupID = ViewGroup.ID + cmd.AddCommand(cmdViewCostToRoll) + cmdViewSampleImprovedOutcomesCumulativeMass := CreateSampleImprovedOutcomesCumulativeMassCommand() + cmdViewSampleImprovedOutcomesCumulativeMass.GroupID = ViewGroup.ID + cmd.AddCommand(cmdViewSampleImprovedOutcomesCumulativeMass) + cmdViewCostToReroll := CreateCostToRerollCommand() + cmdViewCostToReroll.GroupID = ViewGroup.ID + cmd.AddCommand(cmdViewCostToReroll) + cmdViewImprovedOutcomesCumulativeMass := CreateImprovedOutcomesCumulativeMassCommand() + cmdViewImprovedOutcomesCumulativeMass.GroupID = ViewGroup.ID + cmd.AddCommand(cmdViewImprovedOutcomesCumulativeMass) + cmdViewIsApprovedForAll := CreateIsApprovedForAllCommand() + cmdViewIsApprovedForAll.GroupID = ViewGroup.ID + cmd.AddCommand(cmdViewIsApprovedForAll) + cmdViewSupportsInterface := CreateSupportsInterfaceCommand() + cmdViewSupportsInterface.GroupID = ViewGroup.ID + cmd.AddCommand(cmdViewSupportsInterface) + cmdViewUri := CreateUriCommand() + cmdViewUri.GroupID = ViewGroup.ID + cmd.AddCommand(cmdViewUri) + cmdViewLastRollBlock := CreateLastRollBlockCommand() + cmdViewLastRollBlock.GroupID = ViewGroup.ID + cmd.AddCommand(cmdViewLastRollBlock) + cmdViewBalanceOf := CreateBalanceOfCommand() + cmdViewBalanceOf.GroupID = ViewGroup.ID + cmd.AddCommand(cmdViewBalanceOf) + cmdViewBalanceOfBatch := CreateBalanceOfBatchCommand() + cmdViewBalanceOfBatch.GroupID = ViewGroup.ID + cmd.AddCommand(cmdViewBalanceOfBatch) + cmdViewGenera := CreateGeneraCommand() + cmdViewGenera.GroupID = ViewGroup.ID + cmd.AddCommand(cmdViewGenera) + cmdViewOutcome := CreateOutcomeCommand() + cmdViewOutcome.GroupID = ViewGroup.ID + cmd.AddCommand(cmdViewOutcome) + cmdViewSampleUnmodifiedOutcomeCumulativeMass := CreateSampleUnmodifiedOutcomeCumulativeMassCommand() + cmdViewSampleUnmodifiedOutcomeCumulativeMass.GroupID = ViewGroup.ID + cmd.AddCommand(cmdViewSampleUnmodifiedOutcomeCumulativeMass) + cmdViewCurrentTier := CreateCurrentTierCommand() + cmdViewCurrentTier.GroupID = ViewGroup.ID + cmd.AddCommand(cmdViewCurrentTier) + cmdViewUnmodifiedOutcomesCumulativeMass := CreateUnmodifiedOutcomesCumulativeMassCommand() + cmdViewUnmodifiedOutcomesCumulativeMass.GroupID = ViewGroup.ID + cmd.AddCommand(cmdViewUnmodifiedOutcomesCumulativeMass) + + cmdTransactAcceptWithCards := CreateAcceptWithCardsCommand() + cmdTransactAcceptWithCards.GroupID = TransactGroup.ID + cmd.AddCommand(cmdTransactAcceptWithCards) + cmdTransactBurn := CreateBurnCommand() + cmdTransactBurn.GroupID = TransactGroup.ID + cmd.AddCommand(cmdTransactBurn) + cmdTransactSetApprovalForAll := CreateSetApprovalForAllCommand() + cmdTransactSetApprovalForAll.GroupID = TransactGroup.ID + cmd.AddCommand(cmdTransactSetApprovalForAll) + cmdTransactReceive := CreateReceiveCommand() + cmdTransactReceive.GroupID = TransactGroup.ID + cmd.AddCommand(cmdTransactReceive) + cmdTransactAccept := CreateAcceptCommand() + cmdTransactAccept.GroupID = TransactGroup.ID + cmd.AddCommand(cmdTransactAccept) + cmdTransactBurnBatch := CreateBurnBatchCommand() + cmdTransactBurnBatch.GroupID = TransactGroup.ID + cmd.AddCommand(cmdTransactBurnBatch) + cmdTransactCraft := CreateCraftCommand() + cmdTransactCraft.GroupID = TransactGroup.ID + cmd.AddCommand(cmdTransactCraft) + cmdTransactRoll := CreateRollCommand() + cmdTransactRoll.GroupID = TransactGroup.ID + cmd.AddCommand(cmdTransactRoll) + cmdTransactSafeBatchTransferFrom := CreateSafeBatchTransferFromCommand() + cmdTransactSafeBatchTransferFrom.GroupID = TransactGroup.ID + cmd.AddCommand(cmdTransactSafeBatchTransferFrom) + cmdTransactSafeTransferFrom := CreateSafeTransferFromCommand() + cmdTransactSafeTransferFrom.GroupID = TransactGroup.ID + cmd.AddCommand(cmdTransactSafeTransferFrom) + + return cmd +} diff --git a/go.mod b/go.mod index a10d093..586229f 100644 --- a/go.mod +++ b/go.mod @@ -2,9 +2,39 @@ module github.com/moonstream-to/degen-trail go 1.21.5 -require github.com/spf13/cobra v1.8.0 +require ( + github.com/ethereum/go-ethereum v1.14.3 + github.com/spf13/cobra v1.8.0 + golang.org/x/term v0.20.0 +) require ( + github.com/Microsoft/go-winio v0.6.1 // indirect + github.com/StackExchange/wmi v1.2.1 // indirect + github.com/bits-and-blooms/bitset v1.10.0 // indirect + github.com/btcsuite/btcd/btcec/v2 v2.2.0 // indirect + github.com/consensys/bavard v0.1.13 // indirect + github.com/consensys/gnark-crypto v0.12.1 // indirect + github.com/crate-crypto/go-kzg-4844 v1.0.0 // indirect + github.com/deckarep/golang-set/v2 v2.1.0 // indirect + github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect + github.com/ethereum/c-kzg-4844 v1.0.0 // indirect + github.com/fsnotify/fsnotify v1.6.0 // indirect + github.com/go-ole/go-ole v1.3.0 // indirect + github.com/google/uuid v1.3.0 // indirect + github.com/gorilla/websocket v1.4.2 // indirect + github.com/holiman/uint256 v1.2.4 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect + github.com/mmcloughlin/addchain v0.4.0 // indirect + github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect github.com/spf13/pflag v1.0.5 // indirect + github.com/supranational/blst v0.3.11 // indirect + github.com/tklauser/go-sysconf v0.3.12 // indirect + github.com/tklauser/numcpus v0.6.1 // indirect + golang.org/x/crypto v0.22.0 // indirect + golang.org/x/mod v0.17.0 // indirect + golang.org/x/sync v0.7.0 // indirect + golang.org/x/sys v0.20.0 // indirect + golang.org/x/tools v0.20.0 // indirect + rsc.io/tmplfunc v0.0.3 // indirect ) diff --git a/go.sum b/go.sum index d0e8c2c..18b54be 100644 --- a/go.sum +++ b/go.sum @@ -1,10 +1,201 @@ +github.com/DataDog/zstd v1.4.5 h1:EndNeuB0l9syBZhut0wns3gV1hL8zX8LIu6ZiVHWLIQ= +github.com/DataDog/zstd v1.4.5/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= +github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= +github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= +github.com/StackExchange/wmi v1.2.1 h1:VIkavFPXSjcnS+O8yTq7NI32k0R5Aj+v39y29VYDOSA= +github.com/StackExchange/wmi v1.2.1/go.mod h1:rcmrprowKIVzvc+NUiLncP2uuArMWLCbu9SBzvHz7e8= +github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= +github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= +github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= +github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= +github.com/bits-and-blooms/bitset v1.10.0 h1:ePXTeiPEazB5+opbv5fr8umg2R/1NlzgDsyepwsSr88= +github.com/bits-and-blooms/bitset v1.10.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8= +github.com/btcsuite/btcd/btcec/v2 v2.2.0 h1:fzn1qaOt32TuLjFlkzYSsBC35Q3KUjT1SwPxiMSCF5k= +github.com/btcsuite/btcd/btcec/v2 v2.2.0/go.mod h1:U7MHm051Al6XmscBQ0BoNydpOTsFAn707034b5nY8zU= +github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 h1:q0rUy8C/TYNBQS1+CGKw68tLOFYSNEs0TFnxxnS9+4U= +github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= +github.com/cespare/cp v0.1.0 h1:SE+dxFebS7Iik5LK0tsi1k9ZCxEaFX4AjQmoyA+1dJk= +github.com/cespare/cp v0.1.0/go.mod h1:SOGHArjBr4JWaSDEVpWpo/hNg6RoKrls6Oh40hiwW+s= +github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= +github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/cockroachdb/errors v1.11.1 h1:xSEW75zKaKCWzR3OfxXUxgrk/NtT4G1MiOv5lWZazG8= +github.com/cockroachdb/errors v1.11.1/go.mod h1:8MUxA3Gi6b25tYlFEBGLf+D8aISL+M4MIpiWMSNRfxw= +github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b h1:r6VH0faHjZeQy818SGhaone5OnYfxFR/+AzdY3sf5aE= +github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b/go.mod h1:Vz9DsVWQQhf3vs21MhPMZpMGSht7O/2vFW2xusFUVOs= +github.com/cockroachdb/pebble v1.1.0 h1:pcFh8CdCIt2kmEpK0OIatq67Ln9uGDYY3d5XnE0LJG4= +github.com/cockroachdb/pebble v1.1.0/go.mod h1:sEHm5NOXxyiAoKWhoFxT8xMgd/f3RA6qUqQ1BXKrh2E= +github.com/cockroachdb/redact v1.1.5 h1:u1PMllDkdFfPWaNGMyLD1+so+aq3uUItthCFqzwPJ30= +github.com/cockroachdb/redact v1.1.5/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg= +github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 h1:zuQyyAKVxetITBuuhv3BI9cMrmStnpT18zmgmTxunpo= +github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06/go.mod h1:7nc4anLGjupUW/PeY5qiNYsdNXj7zopG+eqsS7To5IQ= +github.com/consensys/bavard v0.1.13 h1:oLhMLOFGTLdlda/kma4VOJazblc7IM5y5QPd2A/YjhQ= +github.com/consensys/bavard v0.1.13/go.mod h1:9ItSMtA/dXMAiL7BG6bqW2m3NdSEObYWoH223nGHukI= +github.com/consensys/gnark-crypto v0.12.1 h1:lHH39WuuFgVHONRl3J0LRBtuYdQTumFSDtJF7HpyG8M= +github.com/consensys/gnark-crypto v0.12.1/go.mod h1:v2Gy7L/4ZRosZ7Ivs+9SfUDr0f5UlG+EM5t7MPHiLuY= +github.com/cpuguy83/go-md2man/v2 v2.0.3 h1:qMCsGGgs+MAzDFyp9LpAe1Lqy/fY/qCovCm0qnXZOBM= github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/crate-crypto/go-ipa v0.0.0-20231025140028-3c0104f4b233 h1:d28BXYi+wUpz1KBmiF9bWrjEMacUEREV6MBi2ODnrfQ= +github.com/crate-crypto/go-ipa v0.0.0-20231025140028-3c0104f4b233/go.mod h1:geZJZH3SzKCqnz5VT0q/DyIG/tvu/dZk+VIfXicupJs= +github.com/crate-crypto/go-kzg-4844 v1.0.0 h1:TsSgHwrkTKecKJ4kadtHi4b3xHW5dCFUDFnUp1TsawI= +github.com/crate-crypto/go-kzg-4844 v1.0.0/go.mod h1:1kMhvPgI0Ky3yIa+9lFySEBUBXkYxeOi8ZF1sYioxhc= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/deckarep/golang-set/v2 v2.1.0 h1:g47V4Or+DUdzbs8FxCCmgb6VYd+ptPAngjM6dtGktsI= +github.com/deckarep/golang-set/v2 v2.1.0/go.mod h1:VAky9rY/yGXJOLEDv3OMci+7wtDpOF4IN+y82NBOac4= +github.com/decred/dcrd/crypto/blake256 v1.0.0 h1:/8DMNYp9SGi5f0w7uCm6d6M4OU2rGFK09Y2A4Xv7EE0= +github.com/decred/dcrd/crypto/blake256 v1.0.0/go.mod h1:sQl2p6Y26YV+ZOcSTP6thNdn47hh8kt6rqSlvmrXFAc= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 h1:YLtO71vCjJRCBcrPMtQ9nqBsqpA1m5sE92cU+pd5Mcc= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1/go.mod h1:hyedUtir6IdtD/7lIxGeCxkaw7y45JueMRL4DIyJDKs= +github.com/ethereum/c-kzg-4844 v1.0.0 h1:0X1LBXxaEtYD9xsyj9B9ctQEZIpnvVDeoBx8aHEwTNA= +github.com/ethereum/c-kzg-4844 v1.0.0/go.mod h1:VewdlzQmpT5QSrVhbBuGoCdFJkpaJlO1aQputP83wc0= +github.com/ethereum/go-ethereum v1.14.3 h1:5zvnAqLtnCZrU9uod1JCvHWJbPMURzYFHfc2eHz4PHA= +github.com/ethereum/go-ethereum v1.14.3/go.mod h1:1STrq471D0BQbCX9He0hUj4bHxX2k6mt5nOQJhDNOJ8= +github.com/fjl/memsize v0.0.2 h1:27txuSD9or+NZlnOWdKUxeBzTAUkWCVh+4Gf2dWFOzA= +github.com/fjl/memsize v0.0.2/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0= +github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= +github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= +github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff h1:tY80oXqGNY4FhTFhk+o9oFHGINQ/+vhlm8HFzi6znCI= +github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww= +github.com/gballet/go-verkle v0.1.1-0.20231031103413-a67434b50f46 h1:BAIP2GihuqhwdILrV+7GJel5lyPV3u1+PgzrWLc0TkE= +github.com/gballet/go-verkle v0.1.1-0.20231031103413-a67434b50f46/go.mod h1:QNpY22eby74jVhqH4WhDLDwxc/vqsern6pW+u2kbkpc= +github.com/getsentry/sentry-go v0.18.0 h1:MtBW5H9QgdcJabtZcuJG80BMOwaBpkRDZkxRkNC1sN0= +github.com/getsentry/sentry-go v0.18.0/go.mod h1:Kgon4Mby+FJ7ZWHFUAZgVaIa8sxHtnRJRLTXZr51aKQ= +github.com/go-ole/go-ole v1.2.5/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= +github.com/go-ole/go-ole v1.3.0 h1:Dt6ye7+vXGIKZ7Xtk4s6/xVdGDQynvom7xCFEdWr6uE= +github.com/go-ole/go-ole v1.3.0/go.mod h1:5LS6F96DhAwUc7C+1HLexzMXY1xGRSryjyPPKW6zv78= +github.com/gofrs/flock v0.8.1 h1:+gYjHKf32LDeiEEFhQaotPbLuUXjY5ZqxKgXy7n59aw= +github.com/gofrs/flock v0.8.1/go.mod h1:F1TvTiK9OcQqauNUHlbJvyl9Qa1QvF/gOUDKA14jxHU= +github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= +github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= +github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg= +github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= +github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= +github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb h1:PBC98N2aIaM3XXiurYmW7fx4GZkL8feAMVq7nEjURHk= +github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= +github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/subcommands v1.2.0/go.mod h1:ZjhPrFU+Olkh9WazFPsl27BQ4UPiG37m3yTrtFlrHVk= +github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= +github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= +github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/hashicorp/go-bexpr v0.1.10 h1:9kuI5PFotCboP3dkDYFr/wi0gg0QVbSNz5oFRpxn4uE= +github.com/hashicorp/go-bexpr v0.1.10/go.mod h1:oxlubA2vC/gFVfX1A6JGp7ls7uCDlfJn732ehYYg+g0= +github.com/holiman/billy v0.0.0-20240216141850-2abb0c79d3c4 h1:X4egAf/gcS1zATw6wn4Ej8vjuVGxeHdan+bRb2ebyv4= +github.com/holiman/billy v0.0.0-20240216141850-2abb0c79d3c4/go.mod h1:5GuXa7vkL8u9FkFuWdVvfR5ix8hRB7DbOAaYULamFpc= +github.com/holiman/bloomfilter/v2 v2.0.3 h1:73e0e/V0tCydx14a0SCYS/EWCxgwLZ18CZcZKVu0fao= +github.com/holiman/bloomfilter/v2 v2.0.3/go.mod h1:zpoh+gs7qcpqrHr3dB55AMiJwo0iURXE7ZOP9L9hSkA= +github.com/holiman/uint256 v1.2.4 h1:jUc4Nk8fm9jZabQuqr2JzednajVmBpC+oiTiXZJEApU= +github.com/holiman/uint256 v1.2.4/go.mod h1:EOMSn4q6Nyt9P6efbI3bueV4e1b3dGlUCXeiRV4ng7E= +github.com/huin/goupnp v1.3.0 h1:UvLUlWDNpoUdYzb2TCn+MuTWtcjXKSza2n6CBdQ0xXc= +github.com/huin/goupnp v1.3.0/go.mod h1:gnGPsThkYa7bFi/KWmEysQRf48l2dvR5bxr2OFckNX8= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= +github.com/jackpal/go-nat-pmp v1.0.2 h1:KzKSgb7qkJvOUTqYl9/Hg/me3pWgBmERKrTGD7BdWus= +github.com/jackpal/go-nat-pmp v1.0.2/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc= +github.com/klauspost/compress v1.15.15 h1:EF27CXIuDsYJ6mmvtBRlEuB2UVOqHG1tAXgZ7yIO+lw= +github.com/klauspost/compress v1.15.15/go.mod h1:ZcK2JAFqKOpnBlxcLsJzYfrS9X1akm9fHZNnD9+Vo/4= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= +github.com/leanovate/gopter v0.2.9 h1:fQjYxZaynp97ozCzfOyOuAGOU4aU/z37zf/tOujFk7c= +github.com/leanovate/gopter v0.2.9/go.mod h1:U2L/78B+KVFIx2VmW6onHJQzXtFb+p5y3y2Sh+Jxxv8= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= +github.com/mattn/go-isatty v0.0.17 h1:BTarxUcIeDqL27Mc+vyvdWYSL28zpIhv3RoTdsLMPng= +github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= +github.com/mattn/go-runewidth v0.0.13 h1:lTGmDsbAYt5DmK6OnoV7EuIF1wEIFAcxld6ypU4OSgU= +github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= +github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 h1:I0XW9+e1XWDxdcEniV4rQAIOPUGDq67JSCiRCgGCZLI= +github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= +github.com/mitchellh/mapstructure v1.4.1 h1:CpVNEelQCZBooIPDn+AR3NpivK/TIKU8bDxdASFVQag= +github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/mitchellh/pointerstructure v1.2.0 h1:O+i9nHnXS3l/9Wu7r4NrEdwA2VFTicjUEN1uBnDo34A= +github.com/mitchellh/pointerstructure v1.2.0/go.mod h1:BRAsLI5zgXmw97Lf6s25bs8ohIXc3tViBH44KcwB2g4= +github.com/mmcloughlin/addchain v0.4.0 h1:SobOdjm2xLj1KkXN5/n0xTIWyZA2+s99UCY1iPfkHRY= +github.com/mmcloughlin/addchain v0.4.0/go.mod h1:A86O+tHqZLMNO4w6ZZ4FlVQEadcoqkyU72HC5wJ4RlU= +github.com/mmcloughlin/profile v0.1.1/go.mod h1:IhHD7q1ooxgwTgjxQYkACGA77oFTDdFVejUS1/tS/qU= +github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= +github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/prometheus/client_golang v1.12.0 h1:C+UIj/QWtmqY13Arb8kwMt5j34/0Z2iKamrJ+ryC0Gg= +github.com/prometheus/client_golang v1.12.0/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= +github.com/prometheus/client_model v0.2.1-0.20210607210712-147c58e9608a h1:CmF68hwI0XsOQ5UwlBopMi2Ow4Pbg32akc4KIVCOm+Y= +github.com/prometheus/client_model v0.2.1-0.20210607210712-147c58e9608a/go.mod h1:LDGWKZIo7rky3hgvBe+caln+Dr3dPggB5dvjtD7w9+w= +github.com/prometheus/common v0.32.1 h1:hWIdL3N2HoUx3B8j3YN9mWor0qhY/NlEKZEaXxuIRh4= +github.com/prometheus/common v0.32.1/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= +github.com/prometheus/procfs v0.7.3 h1:4jVXhlkAyzOScmCkXBTOLRLTz8EeU+eyjrwB/EPq0VU= +github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= +github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= +github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= +github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= +github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= +github.com/rs/cors v1.7.0 h1:+88SsELBHx5r+hZ8TCkggzSstaWNbDvThkVK8H6f9ik= +github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= +github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible h1:Bn1aCHHRnjv4Bl16T8rcaFjYSrGrIZvpiGO6P3Q4GpU= +github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= github.com/spf13/cobra v1.8.0 h1:7aJaZx1B85qltLMc546zn58BxxfZdR/W22ej9CFoEf0= github.com/spf13/cobra v1.8.0/go.mod h1:WXLWApfZ71AjXPya3WOlMsY9yMs7YeiHhFVlvLyhcho= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/status-im/keycard-go v0.2.0 h1:QDLFswOQu1r5jsycloeQh3bVU8n/NatHHaZobtDnDzA= +github.com/status-im/keycard-go v0.2.0/go.mod h1:wlp8ZLbsmrF6g6WjugPAx+IzoLrkdf9+mHxBEeo3Hbg= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/supranational/blst v0.3.11 h1:LyU6FolezeWAhvQk0k6O/d49jqgO52MSDDfYgbeoEm4= +github.com/supranational/blst v0.3.11/go.mod h1:jZJtfjgudtNl4en1tzwPIV3KjUnQUvG3/j+w+fVonLw= +github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 h1:epCh84lMvA70Z7CTTCmYQn2CKbY8j86K7/FAIr141uY= +github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc= +github.com/tklauser/go-sysconf v0.3.12 h1:0QaGUFOdQaIVdPgfITYzaTegZvdCjmYO52cSFAEVmqU= +github.com/tklauser/go-sysconf v0.3.12/go.mod h1:Ho14jnntGE1fpdOqQEEaiKRpvIavV0hSfmBq8nJbHYI= +github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+Fk= +github.com/tklauser/numcpus v0.6.1/go.mod h1:1XfjsgE2zo8GVw7POkMbHENHzVg3GzmoZ9fESEdAacY= +github.com/tyler-smith/go-bip39 v1.1.0 h1:5eUemwrMargf3BSLRRCalXT93Ns6pQJIjYQN2nyfOP8= +github.com/tyler-smith/go-bip39 v1.1.0/go.mod h1:gUYDtqQw1JS3ZJ8UWVcGTGqqr6YIN3CWg+kkNaLt55U= +github.com/urfave/cli/v2 v2.25.7 h1:VAzn5oq403l5pHjc4OhD54+XGO9cdKVL/7lDjF+iKUs= +github.com/urfave/cli/v2 v2.25.7/go.mod h1:8qnjx1vcq5s2/wpsqoZFndg2CE5tNFyrTvS6SinrnYQ= +github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU= +github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8= +golang.org/x/crypto v0.22.0 h1:g1v0xeRhjcugydODzvb3mEM9SQ0HGp9s/nh3COQ/C30= +golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M= +golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa h1:FRnLl4eNAQl8hwxVVC17teOw8kdjVDVAiFMtgUdTSRQ= +golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa/go.mod h1:zk2irFbV9DP96SEBUUAy67IdHUaZuSnrz1n472HUCLE= +golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= +golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= +golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y= +golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/term v0.20.0 h1:VnkxpohqXaOBYJtBmEppKUG6mXpi+4O6purfc2+sMhw= +golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= +golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= +golang.org/x/tools v0.20.0 h1:hz/CVckiOxybQvFw6h7b/q80NTr9IUQb4s1IIzW7KNY= +golang.org/x/tools v0.20.0/go.mod h1:WvitBU7JJf6A4jOdg4S1tviW9bhUxkgeCui/0JHctQg= +google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= +google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/natefinch/lumberjack.v2 v2.0.0 h1:1Lc07Kr7qY4U2YPouBjpCLxpiyxIVoxqXgkXLknAOE8= +gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +rsc.io/tmplfunc v0.0.3 h1:53XFQh69AfOa8Tw0Jm7t+GV7KZhOi6jzsCzTtKbMvzU= +rsc.io/tmplfunc v0.0.3/go.mod h1:AG3sTPzElb1Io3Yg4voV9AGZJuleGAwaVRxL9M49PhA= diff --git a/jj/cmd.go b/jj/cmd.go new file mode 100644 index 0000000..48a16c2 --- /dev/null +++ b/jj/cmd.go @@ -0,0 +1,99 @@ +package main + +import ( + "os" + + "github.com/spf13/cobra" + + "github.com/moonstream-to/degen-trail/bindings/JackpotJunction" + "github.com/moonstream-to/degen-trail/jj/version" +) + +func CreateRootCommand() *cobra.Command { + // rootCmd represents the base command when called without any subcommands + rootCmd := &cobra.Command{ + Use: "jj", + Short: "jj: The Jackpot Junction CLI", + Run: func(cmd *cobra.Command, args []string) { + cmd.Help() + }, + } + + completionCmd := CreateCompletionCommand(rootCmd) + versionCmd := CreateVersionCommand() + contractCmd := JackpotJunction.CreateJackpotJunctionCommand() + contractCmd.Use = "contract" + rootCmd.AddCommand(completionCmd, versionCmd, contractCmd) + + // By default, cobra Command objects write to stderr. We have to forcibly set them to output to + // stdout. + rootCmd.SetOut(os.Stdout) + + return rootCmd +} + +func CreateCompletionCommand(rootCmd *cobra.Command) *cobra.Command { + completionCmd := &cobra.Command{ + Use: "completion", + Short: "Generate shell completion scripts for jj", + Long: `Generate shell completion scripts for jj. + +The command for each shell will print a completion script to stdout. You can source this script to get +completions in your current shell session. You can add this script to the completion directory for your +shell to get completions for all future sessions. + +For example, to activate bash completions in your current shell: + $ . <(jj completion bash) + +To add jj completions for all bash sessions: + $ jj completion bash > /etc/bash_completion.d/jj_completions`, + } + + bashCompletionCmd := &cobra.Command{ + Use: "bash", + Short: "bash completions for jj", + Run: func(cmd *cobra.Command, args []string) { + rootCmd.GenBashCompletion(cmd.OutOrStdout()) + }, + } + + zshCompletionCmd := &cobra.Command{ + Use: "zsh", + Short: "zsh completions for jj", + Run: func(cmd *cobra.Command, args []string) { + rootCmd.GenZshCompletion(cmd.OutOrStdout()) + }, + } + + fishCompletionCmd := &cobra.Command{ + Use: "fish", + Short: "fish completions for jj", + Run: func(cmd *cobra.Command, args []string) { + rootCmd.GenFishCompletion(cmd.OutOrStdout(), true) + }, + } + + powershellCompletionCmd := &cobra.Command{ + Use: "powershell", + Short: "powershell completions for jj", + Run: func(cmd *cobra.Command, args []string) { + rootCmd.GenPowerShellCompletion(cmd.OutOrStdout()) + }, + } + + completionCmd.AddCommand(bashCompletionCmd, zshCompletionCmd, fishCompletionCmd, powershellCompletionCmd) + + return completionCmd +} + +func CreateVersionCommand() *cobra.Command { + versionCmd := &cobra.Command{ + Use: "version", + Short: "Print the version of jj that you are currently using", + Run: func(cmd *cobra.Command, args []string) { + cmd.Println(version.JJVersion) + }, + } + + return versionCmd +} diff --git a/jj/main.go b/jj/main.go new file mode 100644 index 0000000..1e05a86 --- /dev/null +++ b/jj/main.go @@ -0,0 +1,15 @@ +package main + +import ( + "fmt" + "os" +) + +func main() { + command := CreateRootCommand() + err := command.Execute() + if err != nil { + fmt.Println(err.Error()) + os.Exit(1) + } +} diff --git a/jj/version/version.go b/jj/version/version.go new file mode 100644 index 0000000..bb1fc5a --- /dev/null +++ b/jj/version/version.go @@ -0,0 +1,3 @@ +package version + +var JJVersion string = "0.0.1" diff --git a/src/JackpotJunction.sol b/src/JackpotJunction.sol index 7d2c61e..a1cabb6 100644 --- a/src/JackpotJunction.sol +++ b/src/JackpotJunction.sol @@ -65,6 +65,8 @@ contract JackpotJunction is ERC1155, ReentrancyGuard { } } + receive() external payable {} + function genera(uint256 poolID) public pure returns (uint256 itemType, uint256 terrainType, uint256 tier) { tier = poolID / 28; terrainType = (poolID % 28) / 4; @@ -114,7 +116,7 @@ contract JackpotJunction is ERC1155, ReentrancyGuard { emit Roll(msg.sender); } - function _entropy(address degenerate) internal virtual view returns (uint256) { + function _entropy(address degenerate) internal view virtual returns (uint256) { return uint256(blockhash(LastRollBlock[degenerate])); } @@ -169,9 +171,14 @@ contract JackpotJunction is ERC1155, ReentrancyGuard { emit Award(msg.sender, _outcome, value); } + function _clearRoll() internal { + LastRollBlock[msg.sender] = 0; + } + function accept() external nonReentrant returns (uint256, uint256, uint256) { (uint256 entropy, uint256 _outcome, uint256 value) = outcome(msg.sender, false); _award(_outcome, value); + _clearRoll(); return (entropy, _outcome, value); } @@ -241,6 +248,7 @@ contract JackpotJunction is ERC1155, ReentrancyGuard { (uint256 entropy, uint256 _outcome, uint256 value) = outcome(msg.sender, bonus); _award(_outcome, value); + _clearRoll(); return (entropy, _outcome, value); } diff --git a/src/nfts.sol b/src/nfts.sol index b50a741..8bcb797 100644 --- a/src/nfts.sol +++ b/src/nfts.sol @@ -118,32 +118,36 @@ contract DegenTrailNFT is ERC721, ERC721Enumerable, PlayerBandit { stats[tokenID] = DegenTrailStats(kind, speed, fight, repair, recovery); } - function _metadataName(uint256 tokenID, DegenTrailStats memory stat) internal virtual view returns (string memory) { + function _metadataName(uint256 tokenID, DegenTrailStats memory stat) + internal + view + virtual + returns (string memory) + { return string(abi.encodePacked(tokenID)); } - function _metadataKind(uint256 kind) internal virtual view returns (string memory) { + function _metadataKind(uint256 kind) internal view virtual returns (string memory) { return string(abi.encodePacked(kind)); } function metadataJSONBytes(uint256 tokenID) public view returns (bytes memory) { DegenTrailStats memory stat = stats[tokenID]; - return - abi.encodePacked( - '{"name": "', - _metadataName(tokenID, stat), - '","kind":', - _metadataKind(stat.kind), - ',"speed":', - stat.speed, - ',"fight":', - stat.fight, - ',"repair":', - stat.repair, - ',"recovery":', - stat.recovery, - "}" - ); + return abi.encodePacked( + '{"name": "', + _metadataName(tokenID, stat), + '","kind":', + _metadataKind(stat.kind), + ',"speed":', + stat.speed, + ',"fight":', + stat.fight, + ',"repair":', + stat.repair, + ',"recovery":', + stat.recovery, + "}" + ); } function metadataJSON(uint256 tokenID) external view returns (string memory) { diff --git a/test/JackpotJunction.t.sol b/test/JackpotJunction.t.sol index d7eb273..944bf0c 100644 --- a/test/JackpotJunction.t.sol +++ b/test/JackpotJunction.t.sol @@ -7,7 +7,9 @@ import "../src/JackpotJunction.sol"; contract TestableJackpotJunction is JackpotJunction { uint256 public Entropy; - constructor(uint256 blocksToAct, uint256 costToRoll, uint256 costToReroll) JackpotJunction(blocksToAct, costToRoll, costToReroll) {} + constructor(uint256 blocksToAct, uint256 costToRoll, uint256 costToReroll) + JackpotJunction(blocksToAct, costToRoll, costToReroll) + {} function setEntropy(uint256 value) public { Entropy = value; @@ -128,6 +130,14 @@ contract JackpotJunctionTest is Test { assertEq(game.sampleImprovedOutcomesCumulativeMass(469283 + 408934 + 154857 + 15487 + 15), 0); } + function test_fund_game() public { + vm.startPrank(player1); + + vm.deal(player1, 1 ether); + + payable(address(game)).transfer(1 ether); + } + function test_roll() public { vm.startPrank(player1); @@ -153,7 +163,7 @@ contract JackpotJunctionTest is Test { function test_reroll_cost_not_applied_after_block_deadline() public { vm.startPrank(player1); - vm.deal(player1, 1000*costToRoll); + vm.deal(player1, 1000 * costToRoll); vm.deal(address(game), 1000000 ether); game.roll{value: costToRoll}(); @@ -164,12 +174,12 @@ contract JackpotJunctionTest is Test { assertLt(costToReroll, costToRoll); game.roll{value: costToReroll}(); - assertEq(player1.balance, 999*costToRoll); + assertEq(player1.balance, 999 * costToRoll); } function test_reroll_cost_applied_at_block_deadline() public { vm.startPrank(player1); - vm.deal(player1, 1000*costToRoll); + vm.deal(player1, 1000 * costToRoll); vm.deal(address(game), 1000000 ether); game.roll{value: costToRoll}(); @@ -178,10 +188,9 @@ contract JackpotJunctionTest is Test { game.roll{value: costToReroll}(); - assertEq(player1.balance, 999*costToRoll - costToReroll); + assertEq(player1.balance, 999 * costToRoll - costToReroll); } - function test_outcome_reverts_before_tick() public { vm.startPrank(player1); @@ -218,7 +227,6 @@ contract JackpotJunctionTest is Test { (uint256 entropy,,) = game.outcome(player1, false); assertEq(entropy, expectedEntropy); } - } contract JackpotJunctionPlayTest is Test { @@ -282,13 +290,55 @@ contract JackpotJunctionPlayTest is Test { game.acceptWithCards(0, 1, 2, 3); } + function test_reroll_cost_not_applied_after_acceptance() public { + vm.startPrank(player1); + vm.deal(player1, 1000 * costToRoll); + vm.deal(address(game), 1000000 ether); + + game.roll{value: costToRoll}(); + vm.roll(block.number + game.BlocksToAct()); + game.roll{value: costToReroll}(); + + vm.roll(block.number + 1); + game.accept(); + + assertLt(costToReroll, costToRoll); + vm.roll(block.number + 1); + + vm.expectRevert(JackpotJunction.InsufficientValue.selector); + game.roll{value: costToReroll}(); + + game.roll{value: costToRoll}(); + } + + function test_reroll_cost_not_applied_after_acceptance_with_cards() public { + vm.startPrank(player2); + vm.deal(player2, 1000 * costToRoll); + vm.deal(address(game), 1000000 ether); + + game.roll{value: costToRoll}(); + vm.roll(block.number + game.BlocksToAct()); + game.roll{value: costToReroll}(); + + vm.roll(block.number + 1); + game.acceptWithCards(0, 1, 2, 3); + + assertLt(costToReroll, costToRoll); + vm.roll(block.number + 1); + + vm.expectRevert(JackpotJunction.InsufficientValue.selector); + game.roll{value: costToReroll}(); + + game.roll{value: costToRoll}(); + } + function test_nothing_then_item() public { uint256 actualEntropy; uint256 actualOutcome; uint256 actualValue; vm.startPrank(player1); - vm.deal(player1, 1000*costToRoll); + vm.deal(player1, 1000 * costToRoll); vm.deal(address(game), 1000000 ether); vm.expectEmit(); @@ -313,18 +363,18 @@ contract JackpotJunctionPlayTest is Test { (actualEntropy, actualOutcome, actualValue) = game.outcome(player1, false); assertEq(actualEntropy, game.Entropy()); assertEq(actualOutcome, 1); - assertEq(actualValue, 4*terrainType + itemType); + assertEq(actualValue, 4 * terrainType + itemType); - assertEq(game.balanceOf(player1, 4*terrainType + itemType), 0); + assertEq(game.balanceOf(player1, 4 * terrainType + itemType), 0); vm.expectEmit(); - emit Award(player1, 1, 4*terrainType + itemType); + emit Award(player1, 1, 4 * terrainType + itemType); (actualEntropy, actualOutcome, actualValue) = game.accept(); assertEq(actualEntropy, game.Entropy()); assertEq(actualOutcome, 1); - assertEq(actualValue, 4*terrainType + itemType); + assertEq(actualValue, 4 * terrainType + itemType); - assertEq(game.balanceOf(player1, 4*terrainType + itemType), 1); + assertEq(game.balanceOf(player1, 4 * terrainType + itemType), 1); } function test_nothing_then_small_reward() public { @@ -335,7 +385,7 @@ contract JackpotJunctionPlayTest is Test { uint256 initialGameBalance = 1000000 ether; vm.startPrank(player1); - vm.deal(player1, 1000*costToRoll); + vm.deal(player1, 1000 * costToRoll); vm.deal(address(game), initialGameBalance); game.roll{value: costToRoll}(); @@ -363,8 +413,12 @@ contract JackpotJunctionPlayTest is Test { assertEq(actualOutcome, 2); assertEq(actualValue, game.CostToRoll() + (game.CostToRoll() >> 1)); - assertEq(address(game).balance, initialGameBalance + game.CostToRoll() + game.CostToReroll() - (game.CostToRoll() + (game.CostToRoll() >> 1))); - assertEq(player1.balance, 1000*game.CostToRoll() + (game.CostToRoll() >> 1) - game.CostToReroll()); + assertEq( + address(game).balance, + initialGameBalance + game.CostToRoll() + game.CostToReroll() + - (game.CostToRoll() + (game.CostToRoll() >> 1)) + ); + assertEq(player1.balance, 1000 * game.CostToRoll() + (game.CostToRoll() >> 1) - game.CostToReroll()); } function test_nothing_then_medium_reward() public { @@ -375,7 +429,7 @@ contract JackpotJunctionPlayTest is Test { uint256 initialGameBalance = 1000000 ether; vm.startPrank(player1); - vm.deal(player1, 1000*costToRoll); + vm.deal(player1, 1000 * costToRoll); vm.deal(address(game), initialGameBalance); game.roll{value: costToRoll}(); @@ -403,8 +457,12 @@ contract JackpotJunctionPlayTest is Test { assertEq(actualOutcome, 3); assertEq(actualValue, (initialGameBalance + game.CostToRoll() + game.CostToReroll()) >> 6); - assertEq(address(game).balance, initialGameBalance + game.CostToRoll() + game.CostToReroll() - ((initialGameBalance + game.CostToRoll() + game.CostToReroll()) >> 6)); - assertEq(player1.balance, 999*game.CostToRoll()- game.CostToReroll() + actualValue); + assertEq( + address(game).balance, + initialGameBalance + game.CostToRoll() + game.CostToReroll() + - ((initialGameBalance + game.CostToRoll() + game.CostToReroll()) >> 6) + ); + assertEq(player1.balance, 999 * game.CostToRoll() - game.CostToReroll() + actualValue); } function test_nothing_then_large_reward() public { @@ -415,7 +473,7 @@ contract JackpotJunctionPlayTest is Test { uint256 initialGameBalance = 1000000 ether; vm.startPrank(player1); - vm.deal(player1, 1000*costToRoll); + vm.deal(player1, 1000 * costToRoll); vm.deal(address(game), initialGameBalance); game.roll{value: costToRoll}(); @@ -443,8 +501,12 @@ contract JackpotJunctionPlayTest is Test { assertEq(actualOutcome, 4); assertEq(actualValue, (initialGameBalance + game.CostToRoll() + game.CostToReroll()) >> 1); - assertEq(address(game).balance, initialGameBalance + game.CostToRoll() + game.CostToReroll() - ((initialGameBalance + game.CostToRoll() + game.CostToReroll()) >> 1)); - assertEq(player1.balance, 999*game.CostToRoll()- game.CostToReroll() + actualValue); + assertEq( + address(game).balance, + initialGameBalance + game.CostToRoll() + game.CostToReroll() + - ((initialGameBalance + game.CostToRoll() + game.CostToReroll()) >> 1) + ); + assertEq(player1.balance, 999 * game.CostToRoll() - game.CostToReroll() + actualValue); } function test_bonus_nothing_then_item() public { @@ -453,7 +515,7 @@ contract JackpotJunctionPlayTest is Test { uint256 actualValue; vm.startPrank(player2); - vm.deal(player2, 1000*costToRoll); + vm.deal(player2, 1000 * costToRoll); vm.deal(address(game), 1000000 ether); game.roll{value: costToRoll}(); @@ -474,16 +536,16 @@ contract JackpotJunctionPlayTest is Test { (actualEntropy, actualOutcome, actualValue) = game.outcome(player2, true); assertEq(actualEntropy, game.Entropy()); assertEq(actualOutcome, 1); - assertEq(actualValue, 4*terrainType + itemType); + assertEq(actualValue, 4 * terrainType + itemType); - assertEq(game.balanceOf(player2, 4*terrainType + itemType), 1); + assertEq(game.balanceOf(player2, 4 * terrainType + itemType), 1); (actualEntropy, actualOutcome, actualValue) = game.acceptWithCards(0, 1, 2, 3); assertEq(actualEntropy, game.Entropy()); assertEq(actualOutcome, 1); - assertEq(actualValue, 4*terrainType + itemType); + assertEq(actualValue, 4 * terrainType + itemType); - assertEq(game.balanceOf(player2, 4*terrainType + itemType), 2); + assertEq(game.balanceOf(player2, 4 * terrainType + itemType), 2); } function test_bonus_nothing_then_small_reward() public { @@ -494,7 +556,7 @@ contract JackpotJunctionPlayTest is Test { uint256 initialGameBalance = 1000000 ether; vm.startPrank(player2); - vm.deal(player2, 1000*costToRoll); + vm.deal(player2, 1000 * costToRoll); vm.deal(address(game), initialGameBalance); game.roll{value: costToRoll}(); @@ -522,8 +584,12 @@ contract JackpotJunctionPlayTest is Test { assertEq(actualOutcome, 2); assertEq(actualValue, game.CostToRoll() + (game.CostToRoll() >> 1)); - assertEq(address(game).balance, initialGameBalance + game.CostToRoll() + game.CostToReroll() - (game.CostToRoll() + (game.CostToRoll() >> 1))); - assertEq(player2.balance, 1000*game.CostToRoll() + (game.CostToRoll() >> 1) - game.CostToReroll()); + assertEq( + address(game).balance, + initialGameBalance + game.CostToRoll() + game.CostToReroll() + - (game.CostToRoll() + (game.CostToRoll() >> 1)) + ); + assertEq(player2.balance, 1000 * game.CostToRoll() + (game.CostToRoll() >> 1) - game.CostToReroll()); } function test_bonus_nothing_then_medium_reward() public { @@ -534,7 +600,7 @@ contract JackpotJunctionPlayTest is Test { uint256 initialGameBalance = 1000000 ether; vm.startPrank(player2); - vm.deal(player2, 1000*costToRoll); + vm.deal(player2, 1000 * costToRoll); vm.deal(address(game), initialGameBalance); game.roll{value: costToRoll}(); @@ -562,8 +628,12 @@ contract JackpotJunctionPlayTest is Test { assertEq(actualOutcome, 3); assertEq(actualValue, (initialGameBalance + game.CostToRoll() + game.CostToReroll()) >> 6); - assertEq(address(game).balance, initialGameBalance + game.CostToRoll() + game.CostToReroll() - ((initialGameBalance + game.CostToRoll() + game.CostToReroll()) >> 6)); - assertEq(player2.balance, 999*game.CostToRoll()- game.CostToReroll() + actualValue); + assertEq( + address(game).balance, + initialGameBalance + game.CostToRoll() + game.CostToReroll() + - ((initialGameBalance + game.CostToRoll() + game.CostToReroll()) >> 6) + ); + assertEq(player2.balance, 999 * game.CostToRoll() - game.CostToReroll() + actualValue); } function test_bonus_nothing_then_large_reward() public { @@ -574,7 +644,7 @@ contract JackpotJunctionPlayTest is Test { uint256 initialGameBalance = 1000000 ether; vm.startPrank(player2); - vm.deal(player2, 1000*costToRoll); + vm.deal(player2, 1000 * costToRoll); vm.deal(address(game), initialGameBalance); game.roll{value: costToRoll}(); @@ -602,15 +672,19 @@ contract JackpotJunctionPlayTest is Test { assertEq(actualOutcome, 4); assertEq(actualValue, (initialGameBalance + game.CostToRoll() + game.CostToReroll()) >> 1); - assertEq(address(game).balance, initialGameBalance + game.CostToRoll() + game.CostToReroll() - ((initialGameBalance + game.CostToRoll() + game.CostToReroll()) >> 1)); - assertEq(player2.balance, 999*game.CostToRoll()- game.CostToReroll() + actualValue); + assertEq( + address(game).balance, + initialGameBalance + game.CostToRoll() + game.CostToReroll() + - ((initialGameBalance + game.CostToRoll() + game.CostToReroll()) >> 1) + ); + assertEq(player2.balance, 999 * game.CostToRoll() - game.CostToReroll() + actualValue); } function test_bonus_acceptance_fails_with_incorrect_item_types() public { uint256 initialGameBalance = 1000000 ether; vm.startPrank(player2); - vm.deal(player2, 1000*costToRoll); + vm.deal(player2, 1000 * costToRoll); vm.deal(address(game), initialGameBalance); game.roll{value: costToRoll}(); @@ -635,7 +709,7 @@ contract JackpotJunctionPlayTest is Test { game.acceptWithCards(0, 1, 2, 2); assertEq(address(game).balance, initialGameBalance + game.CostToRoll() + game.CostToReroll()); - assertEq(player2.balance, 999*game.CostToRoll() - game.CostToReroll()); + assertEq(player2.balance, 999 * game.CostToRoll() - game.CostToReroll()); } function test_bonus_is_not_applied_if_cover_is_not_max_tier() public { @@ -646,7 +720,7 @@ contract JackpotJunctionPlayTest is Test { uint256 initialGameBalance = 1000000 ether; vm.startPrank(player2); - vm.deal(player2, 1000*costToRoll); + vm.deal(player2, 1000 * costToRoll); vm.deal(address(game), initialGameBalance); game.roll{value: costToRoll}(); @@ -655,7 +729,6 @@ contract JackpotJunctionPlayTest is Test { game.setEntropy(game.UnmodifiedOutcomesCumulativeMass(0) - 1); game.roll{value: costToReroll}(); - vm.roll(block.number + 1); game.mint(player1, 28, 1); @@ -678,7 +751,7 @@ contract JackpotJunctionPlayTest is Test { uint256 initialGameBalance = 1000000 ether; vm.startPrank(player2); - vm.deal(player2, 1000*costToRoll); + vm.deal(player2, 1000 * costToRoll); vm.deal(address(game), initialGameBalance); game.roll{value: costToRoll}(); @@ -709,7 +782,7 @@ contract JackpotJunctionPlayTest is Test { uint256 initialGameBalance = 1000000 ether; vm.startPrank(player2); - vm.deal(player2, 1000*costToRoll); + vm.deal(player2, 1000 * costToRoll); vm.deal(address(game), initialGameBalance); game.roll{value: costToRoll}(); @@ -740,7 +813,7 @@ contract JackpotJunctionPlayTest is Test { uint256 initialGameBalance = 1000000 ether; vm.startPrank(player2); - vm.deal(player2, 1000*costToRoll); + vm.deal(player2, 1000 * costToRoll); vm.deal(address(game), initialGameBalance); game.roll{value: costToRoll}(); @@ -771,7 +844,7 @@ contract JackpotJunctionPlayTest is Test { uint256 initialGameBalance = 1000000 ether; vm.startPrank(player2); - vm.deal(player2, 1000*costToRoll); + vm.deal(player2, 1000 * costToRoll); vm.deal(address(game), initialGameBalance); game.roll{value: costToRoll}(); @@ -795,7 +868,7 @@ contract JackpotJunctionPlayTest is Test { uint256 initialGameBalance = 1000000 ether; vm.startPrank(player2); - vm.deal(player2, 1000*costToRoll); + vm.deal(player2, 1000 * costToRoll); vm.deal(address(game), initialGameBalance); game.roll{value: costToRoll}(); @@ -819,7 +892,7 @@ contract JackpotJunctionPlayTest is Test { uint256 initialGameBalance = 1000000 ether; vm.startPrank(player2); - vm.deal(player2, 1000*costToRoll); + vm.deal(player2, 1000 * costToRoll); vm.deal(address(game), initialGameBalance); game.roll{value: costToRoll}(); @@ -843,7 +916,7 @@ contract JackpotJunctionPlayTest is Test { uint256 initialGameBalance = 1000000 ether; vm.startPrank(player2); - vm.deal(player2, 1000*costToRoll); + vm.deal(player2, 1000 * costToRoll); vm.deal(address(game), initialGameBalance); game.roll{value: costToRoll}(); @@ -945,7 +1018,7 @@ contract JackpotJunctionPlayTest is Test { uint256 inputPoolID = 92384 * 28 + 4 * j + i; uint256 numOutputs = 19283498; game.burn(inputPoolID, game.balanceOf(player2, inputPoolID)); - game.mint(player2, inputPoolID, 2*numOutputs - 1); + game.mint(player2, inputPoolID, 2 * numOutputs - 1); vm.expectRevert(abi.encodeWithSelector(JackpotJunction.InsufficientItems.selector, inputPoolID)); game.craft(inputPoolID, numOutputs); }