Commit fc048466 authored by clabby's avatar clabby Committed by GitHub

Add latest game search to DGF (#9258)

parent 602d5b9a
......@@ -28,10 +28,16 @@ var (
_ = event.NewSubscription
)
// IDisputeGameFactoryGameSearchResult is an auto generated low-level Go binding around an user-defined struct.
type IDisputeGameFactoryGameSearchResult struct {
Index *big.Int
Metadata [32]byte
}
// DisputeGameFactoryMetaData contains all meta data concerning the DisputeGameFactory contract.
var DisputeGameFactoryMetaData = &bind.MetaData{
ABI: "[{\"type\":\"constructor\",\"inputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"create\",\"inputs\":[{\"name\":\"_gameType\",\"type\":\"uint32\",\"internalType\":\"GameType\"},{\"name\":\"_rootClaim\",\"type\":\"bytes32\",\"internalType\":\"Claim\"},{\"name\":\"_extraData\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[{\"name\":\"proxy_\",\"type\":\"address\",\"internalType\":\"contractIDisputeGame\"}],\"stateMutability\":\"payable\"},{\"type\":\"function\",\"name\":\"gameAtIndex\",\"inputs\":[{\"name\":\"_index\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"gameType_\",\"type\":\"uint32\",\"internalType\":\"GameType\"},{\"name\":\"timestamp_\",\"type\":\"uint64\",\"internalType\":\"Timestamp\"},{\"name\":\"proxy_\",\"type\":\"address\",\"internalType\":\"contractIDisputeGame\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"gameCount\",\"inputs\":[],\"outputs\":[{\"name\":\"gameCount_\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"gameImpls\",\"inputs\":[{\"name\":\"\",\"type\":\"uint32\",\"internalType\":\"GameType\"}],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"contractIDisputeGame\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"games\",\"inputs\":[{\"name\":\"_gameType\",\"type\":\"uint32\",\"internalType\":\"GameType\"},{\"name\":\"_rootClaim\",\"type\":\"bytes32\",\"internalType\":\"Claim\"},{\"name\":\"_extraData\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[{\"name\":\"proxy_\",\"type\":\"address\",\"internalType\":\"contractIDisputeGame\"},{\"name\":\"timestamp_\",\"type\":\"uint64\",\"internalType\":\"Timestamp\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getGameUUID\",\"inputs\":[{\"name\":\"_gameType\",\"type\":\"uint32\",\"internalType\":\"GameType\"},{\"name\":\"_rootClaim\",\"type\":\"bytes32\",\"internalType\":\"Claim\"},{\"name\":\"_extraData\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[{\"name\":\"uuid_\",\"type\":\"bytes32\",\"internalType\":\"Hash\"}],\"stateMutability\":\"pure\"},{\"type\":\"function\",\"name\":\"initBonds\",\"inputs\":[{\"name\":\"\",\"type\":\"uint32\",\"internalType\":\"GameType\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"initialize\",\"inputs\":[{\"name\":\"_owner\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"owner\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"renounceOwnership\",\"inputs\":[],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"setImplementation\",\"inputs\":[{\"name\":\"_gameType\",\"type\":\"uint32\",\"internalType\":\"GameType\"},{\"name\":\"_impl\",\"type\":\"address\",\"internalType\":\"contractIDisputeGame\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"setInitBond\",\"inputs\":[{\"name\":\"_gameType\",\"type\":\"uint32\",\"internalType\":\"GameType\"},{\"name\":\"_initBond\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"transferOwnership\",\"inputs\":[{\"name\":\"newOwner\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"version\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"string\",\"internalType\":\"string\"}],\"stateMutability\":\"view\"},{\"type\":\"event\",\"name\":\"DisputeGameCreated\",\"inputs\":[{\"name\":\"disputeProxy\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"gameType\",\"type\":\"uint32\",\"indexed\":true,\"internalType\":\"GameType\"},{\"name\":\"rootClaim\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"Claim\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"ImplementationSet\",\"inputs\":[{\"name\":\"impl\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"gameType\",\"type\":\"uint32\",\"indexed\":true,\"internalType\":\"GameType\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"InitBondUpdated\",\"inputs\":[{\"name\":\"gameType\",\"type\":\"uint32\",\"indexed\":true,\"internalType\":\"GameType\"},{\"name\":\"newBond\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"Initialized\",\"inputs\":[{\"name\":\"version\",\"type\":\"uint8\",\"indexed\":false,\"internalType\":\"uint8\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"OwnershipTransferred\",\"inputs\":[{\"name\":\"previousOwner\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"newOwner\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"error\",\"name\":\"GameAlreadyExists\",\"inputs\":[{\"name\":\"uuid\",\"type\":\"bytes32\",\"internalType\":\"Hash\"}]},{\"type\":\"error\",\"name\":\"InsufficientBond\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"NoImplementation\",\"inputs\":[{\"name\":\"gameType\",\"type\":\"uint32\",\"internalType\":\"GameType\"}]}]",
Bin: "0x60806040523480156200001157600080fd5b506200001e600062000024565b62000292565b600054610100900460ff1615808015620000455750600054600160ff909116105b8062000075575062000062306200016260201b62000a4d1760201c565b15801562000075575060005460ff166001145b620000de5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084015b60405180910390fd5b6000805460ff19166001179055801562000102576000805461ff0019166101001790555b6200010c62000171565b6200011782620001d9565b80156200015e576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050565b6001600160a01b03163b151590565b600054610100900460ff16620001cd5760405162461bcd60e51b815260206004820152602b60248201526000805160206200131683398151915260448201526a6e697469616c697a696e6760a81b6064820152608401620000d5565b620001d76200022b565b565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff16620002875760405162461bcd60e51b815260206004820152602b60248201526000805160206200131683398151915260448201526a6e697469616c697a696e6760a81b6064820152608401620000d5565b620001d733620001d9565b61107480620002a26000396000f3fe6080604052600436106100dd5760003560e01c8063715018a61161007f57806396cd97201161005957806396cd9720146102db578063bb8aa1fc146102fb578063c4d66de81461035c578063f2fde38b1461037c57600080fd5b8063715018a61461028857806382ecf2f61461029d5780638da5cb5b146102b057600080fd5b80634d1975b4116100bb5780634d1975b41461019157806354fd4d50146101b05780635f0150cb146102065780636593dc6e1461025b57600080fd5b806314f6b1a3146100e25780631b685b9e146101045780631e33424014610171575b600080fd5b3480156100ee57600080fd5b506101026100fd366004610e0a565b61039c565b005b34801561011057600080fd5b5061014761011f366004610e41565b60656020526000908152604090205473ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b34801561017d57600080fd5b5061010261018c366004610e63565b610426565b34801561019d57600080fd5b506068545b604051908152602001610168565b3480156101bc57600080fd5b506101f96040518060400160405280600581526020017f302e302e3800000000000000000000000000000000000000000000000000000081525081565b6040516101689190610e8d565b34801561021257600080fd5b50610226610221366004610f00565b610472565b6040805173ffffffffffffffffffffffffffffffffffffffff909316835267ffffffffffffffff909116602083015201610168565b34801561026757600080fd5b506101a2610276366004610e41565b60666020526000908152604090205481565b34801561029457600080fd5b506101026104c5565b6101476102ab366004610f00565b6104d9565b3480156102bc57600080fd5b5060335473ffffffffffffffffffffffffffffffffffffffff16610147565b3480156102e757600080fd5b506101a26102f6366004610f00565b61075f565b34801561030757600080fd5b5061031b610316366004610f87565b610798565b6040805163ffffffff909416845267ffffffffffffffff909216602084015273ffffffffffffffffffffffffffffffffffffffff1690820152606001610168565b34801561036857600080fd5b50610102610377366004610fa0565b6107fa565b34801561038857600080fd5b50610102610397366004610fa0565b610996565b6103a4610a69565b63ffffffff821660008181526065602052604080822080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8616908117909155905190917fff513d80e2c7fa487608f70a618dfbc0cf415699dc69588c747e8c71566c88de91a35050565b61042e610a69565b63ffffffff8216600081815260666020526040808220849055518392917f74d6665c4b26d5596a5aa13d3014e0c06af4d322075a797f87b03cd4c5bc91ca91a35050565b60008060006104838787878761075f565b60009081526067602052604090205473ffffffffffffffffffffffffffffffffffffffff81169860a09190911c67ffffffffffffffff16975095505050505050565b6104cd610a69565b6104d76000610aea565b565b63ffffffff841660009081526065602052604081205473ffffffffffffffffffffffffffffffffffffffff1680610549576040517f031c6de400000000000000000000000000000000000000000000000000000000815263ffffffff871660048201526024015b60405180910390fd5b63ffffffff8616600090815260666020526040902054341015610598576040517fe92c469f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6105fb8585856040516020016105b093929190610fbd565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081840301815291905273ffffffffffffffffffffffffffffffffffffffff831690610b61565b91508173ffffffffffffffffffffffffffffffffffffffff16638129fc1c346040518263ffffffff1660e01b81526004016000604051808303818588803b15801561064557600080fd5b505af1158015610659573d6000803e3d6000fd5b5050505050600061066c8787878761075f565b600081815260676020526040902054909150156106b8576040517f014f6fe500000000000000000000000000000000000000000000000000000000815260048101829052602401610540565b60004260a01b60e089901b178417600083815260676020526040808220839055606880546001810182559083527fa2153420d844928b4421650203c77babc8b33d7f2e7b450e2966db0c220977530183905551919250889163ffffffff8b169173ffffffffffffffffffffffffffffffffffffffff8816917f5b565efe82411da98814f356d0e7bcb8f0219b8d970307c5afb4a6903a8b2e359190a4505050949350505050565b6000848484846040516020016107789493929190610fd7565b604051602081830303815290604052805190602001209050949350505050565b60008060006107ed606885815481106107b3576107b3611038565b906000526020600020015460e081901c9160a082901c67ffffffffffffffff169173ffffffffffffffffffffffffffffffffffffffff1690565b9196909550909350915050565b600054610100900460ff161580801561081a5750600054600160ff909116105b806108345750303b158015610834575060005460ff166001145b6108c0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152608401610540565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055801561091e57600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff166101001790555b610926610c95565b61092f82610aea565b801561099257600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050565b61099e610a69565b73ffffffffffffffffffffffffffffffffffffffff8116610a41576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610540565b610a4a81610aea565b50565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b60335473ffffffffffffffffffffffffffffffffffffffff1633146104d7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610540565b6033805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60006002825101603f8101600a81036040518360581b8260e81b177f6100003d81600a3d39f3363d3d373d3d3d3d610000806035363936013d7300001781528660601b601e8201527f5af43d3d93803e603357fd5bf300000000000000000000000000000000000000603282015285519150603f8101602087015b60208410610c1957805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09093019260209182019101610bdc565b517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff602085900360031b1b16815260f085901b9083015282816000f0945084610c86577febfef1880000000000000000000000000000000000000000000000000000000060005260206000fd5b90910160405250909392505050565b600054610100900460ff16610d2c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e670000000000000000000000000000000000000000006064820152608401610540565b6104d7600054610100900460ff16610dc6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e670000000000000000000000000000000000000000006064820152608401610540565b6104d733610aea565b803563ffffffff81168114610de357600080fd5b919050565b73ffffffffffffffffffffffffffffffffffffffff81168114610a4a57600080fd5b60008060408385031215610e1d57600080fd5b610e2683610dcf565b91506020830135610e3681610de8565b809150509250929050565b600060208284031215610e5357600080fd5b610e5c82610dcf565b9392505050565b60008060408385031215610e7657600080fd5b610e7f83610dcf565b946020939093013593505050565b600060208083528351808285015260005b81811015610eba57858101830151858201604001528201610e9e565b81811115610ecc576000604083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016929092016040019392505050565b60008060008060608587031215610f1657600080fd5b610f1f85610dcf565b935060208501359250604085013567ffffffffffffffff80821115610f4357600080fd5b818701915087601f830112610f5757600080fd5b813581811115610f6657600080fd5b886020828501011115610f7857600080fd5b95989497505060200194505050565b600060208284031215610f9957600080fd5b5035919050565b600060208284031215610fb257600080fd5b8135610e5c81610de8565b838152818360208301376000910160200190815292915050565b63ffffffff8516815283602082015260606040820152816060820152818360808301376000818301608090810191909152601f9092017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01601019392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fdfea164736f6c634300080f000a496e697469616c697a61626c653a20636f6e7472616374206973206e6f742069",
ABI: "[{\"type\":\"constructor\",\"inputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"create\",\"inputs\":[{\"name\":\"_gameType\",\"type\":\"uint32\",\"internalType\":\"GameType\"},{\"name\":\"_rootClaim\",\"type\":\"bytes32\",\"internalType\":\"Claim\"},{\"name\":\"_extraData\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[{\"name\":\"proxy_\",\"type\":\"address\",\"internalType\":\"contractIDisputeGame\"}],\"stateMutability\":\"payable\"},{\"type\":\"function\",\"name\":\"findLatestGames\",\"inputs\":[{\"name\":\"_gameType\",\"type\":\"uint32\",\"internalType\":\"GameType\"},{\"name\":\"_start\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"_n\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"games_\",\"type\":\"tuple[]\",\"internalType\":\"structIDisputeGameFactory.GameSearchResult[]\",\"components\":[{\"name\":\"index\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"metadata\",\"type\":\"bytes32\",\"internalType\":\"GameId\"}]}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"gameAtIndex\",\"inputs\":[{\"name\":\"_index\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"gameType_\",\"type\":\"uint32\",\"internalType\":\"GameType\"},{\"name\":\"timestamp_\",\"type\":\"uint64\",\"internalType\":\"Timestamp\"},{\"name\":\"proxy_\",\"type\":\"address\",\"internalType\":\"contractIDisputeGame\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"gameCount\",\"inputs\":[],\"outputs\":[{\"name\":\"gameCount_\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"gameImpls\",\"inputs\":[{\"name\":\"\",\"type\":\"uint32\",\"internalType\":\"GameType\"}],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"contractIDisputeGame\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"games\",\"inputs\":[{\"name\":\"_gameType\",\"type\":\"uint32\",\"internalType\":\"GameType\"},{\"name\":\"_rootClaim\",\"type\":\"bytes32\",\"internalType\":\"Claim\"},{\"name\":\"_extraData\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[{\"name\":\"proxy_\",\"type\":\"address\",\"internalType\":\"contractIDisputeGame\"},{\"name\":\"timestamp_\",\"type\":\"uint64\",\"internalType\":\"Timestamp\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getGameUUID\",\"inputs\":[{\"name\":\"_gameType\",\"type\":\"uint32\",\"internalType\":\"GameType\"},{\"name\":\"_rootClaim\",\"type\":\"bytes32\",\"internalType\":\"Claim\"},{\"name\":\"_extraData\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[{\"name\":\"uuid_\",\"type\":\"bytes32\",\"internalType\":\"Hash\"}],\"stateMutability\":\"pure\"},{\"type\":\"function\",\"name\":\"initBonds\",\"inputs\":[{\"name\":\"\",\"type\":\"uint32\",\"internalType\":\"GameType\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"initialize\",\"inputs\":[{\"name\":\"_owner\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"owner\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"renounceOwnership\",\"inputs\":[],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"setImplementation\",\"inputs\":[{\"name\":\"_gameType\",\"type\":\"uint32\",\"internalType\":\"GameType\"},{\"name\":\"_impl\",\"type\":\"address\",\"internalType\":\"contractIDisputeGame\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"setInitBond\",\"inputs\":[{\"name\":\"_gameType\",\"type\":\"uint32\",\"internalType\":\"GameType\"},{\"name\":\"_initBond\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"transferOwnership\",\"inputs\":[{\"name\":\"newOwner\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"version\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"string\",\"internalType\":\"string\"}],\"stateMutability\":\"view\"},{\"type\":\"event\",\"name\":\"DisputeGameCreated\",\"inputs\":[{\"name\":\"disputeProxy\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"gameType\",\"type\":\"uint32\",\"indexed\":true,\"internalType\":\"GameType\"},{\"name\":\"rootClaim\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"Claim\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"ImplementationSet\",\"inputs\":[{\"name\":\"impl\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"gameType\",\"type\":\"uint32\",\"indexed\":true,\"internalType\":\"GameType\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"InitBondUpdated\",\"inputs\":[{\"name\":\"gameType\",\"type\":\"uint32\",\"indexed\":true,\"internalType\":\"GameType\"},{\"name\":\"newBond\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"Initialized\",\"inputs\":[{\"name\":\"version\",\"type\":\"uint8\",\"indexed\":false,\"internalType\":\"uint8\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"OwnershipTransferred\",\"inputs\":[{\"name\":\"previousOwner\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"newOwner\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"error\",\"name\":\"GameAlreadyExists\",\"inputs\":[{\"name\":\"uuid\",\"type\":\"bytes32\",\"internalType\":\"Hash\"}]},{\"type\":\"error\",\"name\":\"InsufficientBond\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"NoImplementation\",\"inputs\":[{\"name\":\"gameType\",\"type\":\"uint32\",\"internalType\":\"GameType\"}]}]",
Bin: "0x60806040523480156200001157600080fd5b506200001e600062000024565b62000292565b600054610100900460ff1615808015620000455750600054600160ff909116105b8062000075575062000062306200016260201b62000b721760201c565b15801562000075575060005460ff166001145b620000de5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084015b60405180910390fd5b6000805460ff19166001179055801562000102576000805461ff0019166101001790555b6200010c62000171565b6200011782620001d9565b80156200015e576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050565b6001600160a01b03163b151590565b600054610100900460ff16620001cd5760405162461bcd60e51b815260206004820152602b6024820152600080516020620014f483398151915260448201526a6e697469616c697a696e6760a81b6064820152608401620000d5565b620001d76200022b565b565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff16620002875760405162461bcd60e51b815260206004820152602b6024820152600080516020620014f483398151915260448201526a6e697469616c697a696e6760a81b6064820152608401620000d5565b620001d733620001d9565b61125280620002a26000396000f3fe6080604052600436106100e85760003560e01c80636593dc6e1161008a57806396cd97201161005957806396cd972014610313578063bb8aa1fc14610333578063c4d66de814610394578063f2fde38b146103b457600080fd5b80636593dc6e14610293578063715018a6146102c057806382ecf2f6146102d55780638da5cb5b146102e857600080fd5b8063254bd683116100c6578063254bd6831461019c5780634d1975b4146101c957806354fd4d50146101e85780635f0150cb1461023e57600080fd5b806314f6b1a3146100ed5780631b685b9e1461010f5780631e3342401461017c575b600080fd5b3480156100f957600080fd5b5061010d610108366004610f2f565b6103d4565b005b34801561011b57600080fd5b5061015261012a366004610f66565b60656020526000908152604090205473ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b34801561018857600080fd5b5061010d610197366004610f81565b61045e565b3480156101a857600080fd5b506101bc6101b7366004610fab565b6104aa565b6040516101739190610fde565b3480156101d557600080fd5b506068545b604051908152602001610173565b3480156101f457600080fd5b506102316040518060400160405280600581526020017f302e302e3900000000000000000000000000000000000000000000000000000081525081565b604051610173919061102d565b34801561024a57600080fd5b5061025e6102593660046110a0565b610597565b6040805173ffffffffffffffffffffffffffffffffffffffff909316835267ffffffffffffffff909116602083015201610173565b34801561029f57600080fd5b506101da6102ae366004610f66565b60666020526000908152604090205481565b3480156102cc57600080fd5b5061010d6105ea565b6101526102e33660046110a0565b6105fe565b3480156102f457600080fd5b5060335473ffffffffffffffffffffffffffffffffffffffff16610152565b34801561031f57600080fd5b506101da61032e3660046110a0565b610884565b34801561033f57600080fd5b5061035361034e366004611127565b6108bd565b6040805163ffffffff909416845267ffffffffffffffff909216602084015273ffffffffffffffffffffffffffffffffffffffff1690820152606001610173565b3480156103a057600080fd5b5061010d6103af366004611140565b61091f565b3480156103c057600080fd5b5061010d6103cf366004611140565b610abb565b6103dc610b8e565b63ffffffff821660008181526065602052604080822080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8616908117909155905190917fff513d80e2c7fa487608f70a618dfbc0cf415699dc69588c747e8c71566c88de91a35050565b610466610b8e565b63ffffffff8216600081815260666020526040808220849055518392917f74d6665c4b26d5596a5aa13d3014e0c06af4d322075a797f87b03cd4c5bc91ca91a35050565b606854606090831015806104bc575081155b610590575060408051600583901b8101602001909152825b83811161058e576000606882815481106104f0576104f061115d565b600091825260209091200154905060e081901c60ff808816908216036105655760018451018452604051806040016040528084815260200183815250846001865161053b919061118c565b8151811061054b5761054b61115d565b60200260200101819052508484511061056557505061058e565b50507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff016104d4565b505b9392505050565b60008060006105a887878787610884565b60009081526067602052604090205473ffffffffffffffffffffffffffffffffffffffff81169860a09190911c67ffffffffffffffff16975095505050505050565b6105f2610b8e565b6105fc6000610c0f565b565b63ffffffff841660009081526065602052604081205473ffffffffffffffffffffffffffffffffffffffff168061066e576040517f031c6de400000000000000000000000000000000000000000000000000000000815263ffffffff871660048201526024015b60405180910390fd5b63ffffffff86166000908152606660205260409020543410156106bd576040517fe92c469f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6107208585856040516020016106d5939291906111ca565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081840301815291905273ffffffffffffffffffffffffffffffffffffffff831690610c86565b91508173ffffffffffffffffffffffffffffffffffffffff16638129fc1c346040518263ffffffff1660e01b81526004016000604051808303818588803b15801561076a57600080fd5b505af115801561077e573d6000803e3d6000fd5b5050505050600061079187878787610884565b600081815260676020526040902054909150156107dd576040517f014f6fe500000000000000000000000000000000000000000000000000000000815260048101829052602401610665565b60004260a01b60e089901b178417600083815260676020526040808220839055606880546001810182559083527fa2153420d844928b4421650203c77babc8b33d7f2e7b450e2966db0c220977530183905551919250889163ffffffff8b169173ffffffffffffffffffffffffffffffffffffffff8816917f5b565efe82411da98814f356d0e7bcb8f0219b8d970307c5afb4a6903a8b2e359190a4505050949350505050565b60008484848460405160200161089d94939291906111e4565b604051602081830303815290604052805190602001209050949350505050565b6000806000610912606885815481106108d8576108d861115d565b906000526020600020015460e081901c9160a082901c67ffffffffffffffff169173ffffffffffffffffffffffffffffffffffffffff1690565b9196909550909350915050565b600054610100900460ff161580801561093f5750600054600160ff909116105b806109595750303b158015610959575060005460ff166001145b6109e5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152608401610665565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790558015610a4357600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff166101001790555b610a4b610dba565b610a5482610c0f565b8015610ab757600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050565b610ac3610b8e565b73ffffffffffffffffffffffffffffffffffffffff8116610b66576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610665565b610b6f81610c0f565b50565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b60335473ffffffffffffffffffffffffffffffffffffffff1633146105fc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610665565b6033805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60006002825101603f8101600a81036040518360581b8260e81b177f6100003d81600a3d39f3363d3d373d3d3d3d610000806035363936013d7300001781528660601b601e8201527f5af43d3d93803e603357fd5bf300000000000000000000000000000000000000603282015285519150603f8101602087015b60208410610d3e57805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09093019260209182019101610d01565b517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff602085900360031b1b16815260f085901b9083015282816000f0945084610dab577febfef1880000000000000000000000000000000000000000000000000000000060005260206000fd5b90910160405250909392505050565b600054610100900460ff16610e51576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e670000000000000000000000000000000000000000006064820152608401610665565b6105fc600054610100900460ff16610eeb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e670000000000000000000000000000000000000000006064820152608401610665565b6105fc33610c0f565b803563ffffffff81168114610f0857600080fd5b919050565b73ffffffffffffffffffffffffffffffffffffffff81168114610b6f57600080fd5b60008060408385031215610f4257600080fd5b610f4b83610ef4565b91506020830135610f5b81610f0d565b809150509250929050565b600060208284031215610f7857600080fd5b61059082610ef4565b60008060408385031215610f9457600080fd5b610f9d83610ef4565b946020939093013593505050565b600080600060608486031215610fc057600080fd5b610fc984610ef4565b95602085013595506040909401359392505050565b602080825282518282018190526000919060409081850190868401855b8281101561102057815180518552860151868501529284019290850190600101610ffb565b5091979650505050505050565b600060208083528351808285015260005b8181101561105a5785810183015185820160400152820161103e565b8181111561106c576000604083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016929092016040019392505050565b600080600080606085870312156110b657600080fd5b6110bf85610ef4565b935060208501359250604085013567ffffffffffffffff808211156110e357600080fd5b818701915087601f8301126110f757600080fd5b81358181111561110657600080fd5b88602082850101111561111857600080fd5b95989497505060200194505050565b60006020828403121561113957600080fd5b5035919050565b60006020828403121561115257600080fd5b813561059081610f0d565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6000828210156111c5577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b500390565b838152818360208301376000910160200190815292915050565b63ffffffff8516815283602082015260606040820152816060820152818360808301376000818301608090810191909152601f9092017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0160101939250505056fea164736f6c634300080f000a496e697469616c697a61626c653a20636f6e7472616374206973206e6f742069",
}
// DisputeGameFactoryABI is the input ABI used to generate the binding from.
......@@ -201,6 +207,37 @@ func (_DisputeGameFactory *DisputeGameFactoryTransactorRaw) Transact(opts *bind.
return _DisputeGameFactory.Contract.contract.Transact(opts, method, params...)
}
// FindLatestGames is a free data retrieval call binding the contract method 0x254bd683.
//
// Solidity: function findLatestGames(uint32 _gameType, uint256 _start, uint256 _n) view returns((uint256,bytes32)[] games_)
func (_DisputeGameFactory *DisputeGameFactoryCaller) FindLatestGames(opts *bind.CallOpts, _gameType uint32, _start *big.Int, _n *big.Int) ([]IDisputeGameFactoryGameSearchResult, error) {
var out []interface{}
err := _DisputeGameFactory.contract.Call(opts, &out, "findLatestGames", _gameType, _start, _n)
if err != nil {
return *new([]IDisputeGameFactoryGameSearchResult), err
}
out0 := *abi.ConvertType(out[0], new([]IDisputeGameFactoryGameSearchResult)).(*[]IDisputeGameFactoryGameSearchResult)
return out0, err
}
// FindLatestGames is a free data retrieval call binding the contract method 0x254bd683.
//
// Solidity: function findLatestGames(uint32 _gameType, uint256 _start, uint256 _n) view returns((uint256,bytes32)[] games_)
func (_DisputeGameFactory *DisputeGameFactorySession) FindLatestGames(_gameType uint32, _start *big.Int, _n *big.Int) ([]IDisputeGameFactoryGameSearchResult, error) {
return _DisputeGameFactory.Contract.FindLatestGames(&_DisputeGameFactory.CallOpts, _gameType, _start, _n)
}
// FindLatestGames is a free data retrieval call binding the contract method 0x254bd683.
//
// Solidity: function findLatestGames(uint32 _gameType, uint256 _start, uint256 _n) view returns((uint256,bytes32)[] games_)
func (_DisputeGameFactory *DisputeGameFactoryCallerSession) FindLatestGames(_gameType uint32, _start *big.Int, _n *big.Int) ([]IDisputeGameFactoryGameSearchResult, error) {
return _DisputeGameFactory.Contract.FindLatestGames(&_DisputeGameFactory.CallOpts, _gameType, _start, _n)
}
// GameAtIndex is a free data retrieval call binding the contract method 0xbb8aa1fc.
//
// Solidity: function gameAtIndex(uint256 _index) view returns(uint32 gameType_, uint64 timestamp_, address proxy_)
......
......@@ -13,7 +13,7 @@ const DisputeGameFactoryStorageLayoutJSON = "{\"storage\":[{\"astId\":1000,\"con
var DisputeGameFactoryStorageLayout = new(solc.StorageLayout)
var DisputeGameFactoryDeployedBin = "0x6080604052600436106100dd5760003560e01c8063715018a61161007f57806396cd97201161005957806396cd9720146102db578063bb8aa1fc146102fb578063c4d66de81461035c578063f2fde38b1461037c57600080fd5b8063715018a61461028857806382ecf2f61461029d5780638da5cb5b146102b057600080fd5b80634d1975b4116100bb5780634d1975b41461019157806354fd4d50146101b05780635f0150cb146102065780636593dc6e1461025b57600080fd5b806314f6b1a3146100e25780631b685b9e146101045780631e33424014610171575b600080fd5b3480156100ee57600080fd5b506101026100fd366004610e0a565b61039c565b005b34801561011057600080fd5b5061014761011f366004610e41565b60656020526000908152604090205473ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b34801561017d57600080fd5b5061010261018c366004610e63565b610426565b34801561019d57600080fd5b506068545b604051908152602001610168565b3480156101bc57600080fd5b506101f96040518060400160405280600581526020017f302e302e3800000000000000000000000000000000000000000000000000000081525081565b6040516101689190610e8d565b34801561021257600080fd5b50610226610221366004610f00565b610472565b6040805173ffffffffffffffffffffffffffffffffffffffff909316835267ffffffffffffffff909116602083015201610168565b34801561026757600080fd5b506101a2610276366004610e41565b60666020526000908152604090205481565b34801561029457600080fd5b506101026104c5565b6101476102ab366004610f00565b6104d9565b3480156102bc57600080fd5b5060335473ffffffffffffffffffffffffffffffffffffffff16610147565b3480156102e757600080fd5b506101a26102f6366004610f00565b61075f565b34801561030757600080fd5b5061031b610316366004610f87565b610798565b6040805163ffffffff909416845267ffffffffffffffff909216602084015273ffffffffffffffffffffffffffffffffffffffff1690820152606001610168565b34801561036857600080fd5b50610102610377366004610fa0565b6107fa565b34801561038857600080fd5b50610102610397366004610fa0565b610996565b6103a4610a69565b63ffffffff821660008181526065602052604080822080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8616908117909155905190917fff513d80e2c7fa487608f70a618dfbc0cf415699dc69588c747e8c71566c88de91a35050565b61042e610a69565b63ffffffff8216600081815260666020526040808220849055518392917f74d6665c4b26d5596a5aa13d3014e0c06af4d322075a797f87b03cd4c5bc91ca91a35050565b60008060006104838787878761075f565b60009081526067602052604090205473ffffffffffffffffffffffffffffffffffffffff81169860a09190911c67ffffffffffffffff16975095505050505050565b6104cd610a69565b6104d76000610aea565b565b63ffffffff841660009081526065602052604081205473ffffffffffffffffffffffffffffffffffffffff1680610549576040517f031c6de400000000000000000000000000000000000000000000000000000000815263ffffffff871660048201526024015b60405180910390fd5b63ffffffff8616600090815260666020526040902054341015610598576040517fe92c469f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6105fb8585856040516020016105b093929190610fbd565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081840301815291905273ffffffffffffffffffffffffffffffffffffffff831690610b61565b91508173ffffffffffffffffffffffffffffffffffffffff16638129fc1c346040518263ffffffff1660e01b81526004016000604051808303818588803b15801561064557600080fd5b505af1158015610659573d6000803e3d6000fd5b5050505050600061066c8787878761075f565b600081815260676020526040902054909150156106b8576040517f014f6fe500000000000000000000000000000000000000000000000000000000815260048101829052602401610540565b60004260a01b60e089901b178417600083815260676020526040808220839055606880546001810182559083527fa2153420d844928b4421650203c77babc8b33d7f2e7b450e2966db0c220977530183905551919250889163ffffffff8b169173ffffffffffffffffffffffffffffffffffffffff8816917f5b565efe82411da98814f356d0e7bcb8f0219b8d970307c5afb4a6903a8b2e359190a4505050949350505050565b6000848484846040516020016107789493929190610fd7565b604051602081830303815290604052805190602001209050949350505050565b60008060006107ed606885815481106107b3576107b3611038565b906000526020600020015460e081901c9160a082901c67ffffffffffffffff169173ffffffffffffffffffffffffffffffffffffffff1690565b9196909550909350915050565b600054610100900460ff161580801561081a5750600054600160ff909116105b806108345750303b158015610834575060005460ff166001145b6108c0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152608401610540565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055801561091e57600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff166101001790555b610926610c95565b61092f82610aea565b801561099257600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050565b61099e610a69565b73ffffffffffffffffffffffffffffffffffffffff8116610a41576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610540565b610a4a81610aea565b50565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b60335473ffffffffffffffffffffffffffffffffffffffff1633146104d7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610540565b6033805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60006002825101603f8101600a81036040518360581b8260e81b177f6100003d81600a3d39f3363d3d373d3d3d3d610000806035363936013d7300001781528660601b601e8201527f5af43d3d93803e603357fd5bf300000000000000000000000000000000000000603282015285519150603f8101602087015b60208410610c1957805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09093019260209182019101610bdc565b517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff602085900360031b1b16815260f085901b9083015282816000f0945084610c86577febfef1880000000000000000000000000000000000000000000000000000000060005260206000fd5b90910160405250909392505050565b600054610100900460ff16610d2c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e670000000000000000000000000000000000000000006064820152608401610540565b6104d7600054610100900460ff16610dc6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e670000000000000000000000000000000000000000006064820152608401610540565b6104d733610aea565b803563ffffffff81168114610de357600080fd5b919050565b73ffffffffffffffffffffffffffffffffffffffff81168114610a4a57600080fd5b60008060408385031215610e1d57600080fd5b610e2683610dcf565b91506020830135610e3681610de8565b809150509250929050565b600060208284031215610e5357600080fd5b610e5c82610dcf565b9392505050565b60008060408385031215610e7657600080fd5b610e7f83610dcf565b946020939093013593505050565b600060208083528351808285015260005b81811015610eba57858101830151858201604001528201610e9e565b81811115610ecc576000604083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016929092016040019392505050565b60008060008060608587031215610f1657600080fd5b610f1f85610dcf565b935060208501359250604085013567ffffffffffffffff80821115610f4357600080fd5b818701915087601f830112610f5757600080fd5b813581811115610f6657600080fd5b886020828501011115610f7857600080fd5b95989497505060200194505050565b600060208284031215610f9957600080fd5b5035919050565b600060208284031215610fb257600080fd5b8135610e5c81610de8565b838152818360208301376000910160200190815292915050565b63ffffffff8516815283602082015260606040820152816060820152818360808301376000818301608090810191909152601f9092017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01601019392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fdfea164736f6c634300080f000a"
var DisputeGameFactoryDeployedBin = "0x6080604052600436106100e85760003560e01c80636593dc6e1161008a57806396cd97201161005957806396cd972014610313578063bb8aa1fc14610333578063c4d66de814610394578063f2fde38b146103b457600080fd5b80636593dc6e14610293578063715018a6146102c057806382ecf2f6146102d55780638da5cb5b146102e857600080fd5b8063254bd683116100c6578063254bd6831461019c5780634d1975b4146101c957806354fd4d50146101e85780635f0150cb1461023e57600080fd5b806314f6b1a3146100ed5780631b685b9e1461010f5780631e3342401461017c575b600080fd5b3480156100f957600080fd5b5061010d610108366004610f2f565b6103d4565b005b34801561011b57600080fd5b5061015261012a366004610f66565b60656020526000908152604090205473ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b34801561018857600080fd5b5061010d610197366004610f81565b61045e565b3480156101a857600080fd5b506101bc6101b7366004610fab565b6104aa565b6040516101739190610fde565b3480156101d557600080fd5b506068545b604051908152602001610173565b3480156101f457600080fd5b506102316040518060400160405280600581526020017f302e302e3900000000000000000000000000000000000000000000000000000081525081565b604051610173919061102d565b34801561024a57600080fd5b5061025e6102593660046110a0565b610597565b6040805173ffffffffffffffffffffffffffffffffffffffff909316835267ffffffffffffffff909116602083015201610173565b34801561029f57600080fd5b506101da6102ae366004610f66565b60666020526000908152604090205481565b3480156102cc57600080fd5b5061010d6105ea565b6101526102e33660046110a0565b6105fe565b3480156102f457600080fd5b5060335473ffffffffffffffffffffffffffffffffffffffff16610152565b34801561031f57600080fd5b506101da61032e3660046110a0565b610884565b34801561033f57600080fd5b5061035361034e366004611127565b6108bd565b6040805163ffffffff909416845267ffffffffffffffff909216602084015273ffffffffffffffffffffffffffffffffffffffff1690820152606001610173565b3480156103a057600080fd5b5061010d6103af366004611140565b61091f565b3480156103c057600080fd5b5061010d6103cf366004611140565b610abb565b6103dc610b8e565b63ffffffff821660008181526065602052604080822080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8616908117909155905190917fff513d80e2c7fa487608f70a618dfbc0cf415699dc69588c747e8c71566c88de91a35050565b610466610b8e565b63ffffffff8216600081815260666020526040808220849055518392917f74d6665c4b26d5596a5aa13d3014e0c06af4d322075a797f87b03cd4c5bc91ca91a35050565b606854606090831015806104bc575081155b610590575060408051600583901b8101602001909152825b83811161058e576000606882815481106104f0576104f061115d565b600091825260209091200154905060e081901c60ff808816908216036105655760018451018452604051806040016040528084815260200183815250846001865161053b919061118c565b8151811061054b5761054b61115d565b60200260200101819052508484511061056557505061058e565b50507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff016104d4565b505b9392505050565b60008060006105a887878787610884565b60009081526067602052604090205473ffffffffffffffffffffffffffffffffffffffff81169860a09190911c67ffffffffffffffff16975095505050505050565b6105f2610b8e565b6105fc6000610c0f565b565b63ffffffff841660009081526065602052604081205473ffffffffffffffffffffffffffffffffffffffff168061066e576040517f031c6de400000000000000000000000000000000000000000000000000000000815263ffffffff871660048201526024015b60405180910390fd5b63ffffffff86166000908152606660205260409020543410156106bd576040517fe92c469f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6107208585856040516020016106d5939291906111ca565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081840301815291905273ffffffffffffffffffffffffffffffffffffffff831690610c86565b91508173ffffffffffffffffffffffffffffffffffffffff16638129fc1c346040518263ffffffff1660e01b81526004016000604051808303818588803b15801561076a57600080fd5b505af115801561077e573d6000803e3d6000fd5b5050505050600061079187878787610884565b600081815260676020526040902054909150156107dd576040517f014f6fe500000000000000000000000000000000000000000000000000000000815260048101829052602401610665565b60004260a01b60e089901b178417600083815260676020526040808220839055606880546001810182559083527fa2153420d844928b4421650203c77babc8b33d7f2e7b450e2966db0c220977530183905551919250889163ffffffff8b169173ffffffffffffffffffffffffffffffffffffffff8816917f5b565efe82411da98814f356d0e7bcb8f0219b8d970307c5afb4a6903a8b2e359190a4505050949350505050565b60008484848460405160200161089d94939291906111e4565b604051602081830303815290604052805190602001209050949350505050565b6000806000610912606885815481106108d8576108d861115d565b906000526020600020015460e081901c9160a082901c67ffffffffffffffff169173ffffffffffffffffffffffffffffffffffffffff1690565b9196909550909350915050565b600054610100900460ff161580801561093f5750600054600160ff909116105b806109595750303b158015610959575060005460ff166001145b6109e5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152608401610665565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790558015610a4357600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff166101001790555b610a4b610dba565b610a5482610c0f565b8015610ab757600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050565b610ac3610b8e565b73ffffffffffffffffffffffffffffffffffffffff8116610b66576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610665565b610b6f81610c0f565b50565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b60335473ffffffffffffffffffffffffffffffffffffffff1633146105fc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610665565b6033805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60006002825101603f8101600a81036040518360581b8260e81b177f6100003d81600a3d39f3363d3d373d3d3d3d610000806035363936013d7300001781528660601b601e8201527f5af43d3d93803e603357fd5bf300000000000000000000000000000000000000603282015285519150603f8101602087015b60208410610d3e57805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09093019260209182019101610d01565b517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff602085900360031b1b16815260f085901b9083015282816000f0945084610dab577febfef1880000000000000000000000000000000000000000000000000000000060005260206000fd5b90910160405250909392505050565b600054610100900460ff16610e51576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e670000000000000000000000000000000000000000006064820152608401610665565b6105fc600054610100900460ff16610eeb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e670000000000000000000000000000000000000000006064820152608401610665565b6105fc33610c0f565b803563ffffffff81168114610f0857600080fd5b919050565b73ffffffffffffffffffffffffffffffffffffffff81168114610b6f57600080fd5b60008060408385031215610f4257600080fd5b610f4b83610ef4565b91506020830135610f5b81610f0d565b809150509250929050565b600060208284031215610f7857600080fd5b61059082610ef4565b60008060408385031215610f9457600080fd5b610f9d83610ef4565b946020939093013593505050565b600080600060608486031215610fc057600080fd5b610fc984610ef4565b95602085013595506040909401359392505050565b602080825282518282018190526000919060409081850190868401855b8281101561102057815180518552860151868501529284019290850190600101610ffb565b5091979650505050505050565b600060208083528351808285015260005b8181101561105a5785810183015185820160400152820161103e565b8181111561106c576000604083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016929092016040019392505050565b600080600080606085870312156110b657600080fd5b6110bf85610ef4565b935060208501359250604085013567ffffffffffffffff808211156110e357600080fd5b818701915087601f8301126110f757600080fd5b81358181111561110657600080fd5b88602082850101111561111857600080fd5b95989497505060200194505050565b60006020828403121561113957600080fd5b5035919050565b60006020828403121561115257600080fd5b813561059081610f0d565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6000828210156111c5577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b500390565b838152818360208301376000910160200190815292915050565b63ffffffff8516815283602082015260606040820152816060820152818360808301376000818301608090810191909152601f9092017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0160101939250505056fea164736f6c634300080f000a"
func init() {
......
......@@ -88,8 +88,8 @@
"sourceCodeHash": "0x1afb1d392e8f6a58ff86ea7f648e0d1756d4ba8d0d964279d58a390deaa53b7e"
},
"src/dispute/DisputeGameFactory.sol": {
"initCodeHash": "0x56a9edbde3365f51454f6e0f12e136f4f19c0cdb10e89467be00129bb72f139e",
"sourceCodeHash": "0x01c757935c87dcf2faa7f16bcf29cfb29b90c671a874f983067614670147b11d"
"initCodeHash": "0xbb8c4273acaede381fe88e6974e073fac363c7ec21618af737df2d3118608665",
"sourceCodeHash": "0x78a030cd808a997f4b82c4fa284d6c394dae9d1fafeccb8783059a3b60bfb0ce"
},
"src/dispute/FaultDisputeGame.sol": {
"initCodeHash": "0xe410bdcc3f0e8e71ddb609d1a0c21a40e1b06debeb55de6aff1452c8dda4af0b",
......
......@@ -1079,6 +1079,30 @@
"length": 41,
"filename_relative": "src/universal/CrossDomainMessenger.sol"
},
{
"id": "ef5cd67f78205ab8eebc31cd1bf78fa51ac2f8ab4d776a5d08bed46c9f1d13fc",
"impact": "Medium",
"confidence": "High",
"check": "tautology",
"description": "DisputeGameFactory.findLatestGames(GameType,uint256,uint256) (src/dispute/DisputeGameFactory.sol#137-177) contains a tautology or contradiction:\n\t- i >= 0 && i <= _start (src/dispute/DisputeGameFactory.sol#157)\n",
"type": "function",
"name": "findLatestGames",
"start": 5076,
"length": 1595,
"filename_relative": "src/dispute/DisputeGameFactory.sol"
},
{
"id": "ef5cd67f78205ab8eebc31cd1bf78fa51ac2f8ab4d776a5d08bed46c9f1d13fc",
"impact": "Medium",
"confidence": "High",
"check": "tautology",
"description": "DisputeGameFactory.findLatestGames(GameType,uint256,uint256) (src/dispute/DisputeGameFactory.sol#137-177) contains a tautology or contradiction:\n\t- i >= 0 && i <= _start (src/dispute/DisputeGameFactory.sol#157)\n",
"type": "node",
"name": "i >= 0 && i <= _start",
"start": 5923,
"length": 21,
"filename_relative": "src/dispute/DisputeGameFactory.sol"
},
{
"id": "0369380fef18a61639eac6a12773df792e9969e7bb20eddde54ccf3a263a0987",
"impact": "Medium",
......
......@@ -33,6 +33,47 @@
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [
{
"internalType": "GameType",
"name": "_gameType",
"type": "uint32"
},
{
"internalType": "uint256",
"name": "_start",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "_n",
"type": "uint256"
}
],
"name": "findLatestGames",
"outputs": [
{
"components": [
{
"internalType": "uint256",
"name": "index",
"type": "uint256"
},
{
"internalType": "GameId",
"name": "metadata",
"type": "bytes32"
}
],
"internalType": "struct IDisputeGameFactory.GameSearchResult[]",
"name": "games_",
"type": "tuple[]"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
......
......@@ -24,8 +24,8 @@ contract DisputeGameFactory is OwnableUpgradeable, IDisputeGameFactory, ISemver
using ClonesWithImmutableArgs for address;
/// @notice Semantic version.
/// @custom:semver 0.0.8
string public constant version = "0.0.8";
/// @custom:semver 0.0.9
string public constant version = "0.0.9";
/// @inheritdoc IDisputeGameFactory
mapping(GameType => IDisputeGame) public gameImpls;
......@@ -133,6 +133,49 @@ contract DisputeGameFactory is OwnableUpgradeable, IDisputeGameFactory, ISemver
uuid_ = Hash.wrap(keccak256(abi.encode(_gameType, _rootClaim, _extraData)));
}
/// @inheritdoc IDisputeGameFactory
function findLatestGames(
GameType _gameType,
uint256 _start,
uint256 _n
)
external
view
returns (GameSearchResult[] memory games_)
{
// If the `_start` index is greater than or equal to the game array length or `_n == 0`, return an empty array.
if (_start >= _disputeGameList.length || _n == 0) return games_;
// Allocate enough memory for the full array, but start the array's length at `0`. We may not use all of the
// memory allocated, but we don't know ahead of time the final size of the array.
assembly {
games_ := mload(0x40)
mstore(0x40, add(games_, add(0x20, shl(0x05, _n))))
}
// Perform a reverse linear search for the `_n` most recent games of type `_gameType`.
for (uint256 i = _start; i >= 0 && i <= _start;) {
GameId id = _disputeGameList[i];
(GameType gameType,,) = id.unpack();
if (gameType.raw() == _gameType.raw()) {
// Increase the size of the `games_` array by 1.
// SAFETY: We can safely lazily allocate memory here because we pre-allocated enough memory for the max
// possible size of the array.
assembly {
mstore(games_, add(mload(games_), 0x01))
}
games_[games_.length - 1] = GameSearchResult({ index: i, metadata: id });
if (games_.length >= _n) break;
}
unchecked {
i--;
}
}
}
/// @inheritdoc IDisputeGameFactory
function setImplementation(GameType _gameType, IDisputeGame _impl) external onlyOwner {
gameImpls[_gameType] = _impl;
......
......@@ -24,6 +24,12 @@ interface IDisputeGameFactory {
/// @param newBond The new bond (in wei) for initializing the game type.
event InitBondUpdated(GameType indexed gameType, uint256 indexed newBond);
/// @notice Information about a dispute game found in a `findLatestGames` search.
struct GameSearchResult {
uint256 index;
GameId metadata;
}
/// @notice The total number of dispute games created by this factory.
/// @return gameCount_ The total number of dispute games created by this factory.
function gameCount() external view returns (uint256 gameCount_);
......@@ -111,4 +117,18 @@ interface IDisputeGameFactory {
external
pure
returns (Hash uuid_);
/// @notice Finds the `_n` most recent `GameId`'s of type `_gameType` starting at `_start`. If there are less than
/// `_n` games of type `_gameType` starting at `_start`, then the returned array will be shorter than `_n`.
/// @param _gameType The type of game to find.
/// @param _start The index to start the reverse search from.
/// @param _n The number of games to find.
function findLatestGames(
GameType _gameType,
uint256 _start,
uint256 _n
)
external
view
returns (GameSearchResult[] memory games_);
}
......@@ -5,7 +5,7 @@ import "src/libraries/DisputeTypes.sol";
import "src/libraries/DisputeErrors.sol";
import { Test } from "forge-std/Test.sol";
import { DisputeGameFactory } from "src/dispute/DisputeGameFactory.sol";
import { DisputeGameFactory, IDisputeGameFactory } from "src/dispute/DisputeGameFactory.sol";
import { IDisputeGame } from "src/dispute/interfaces/IDisputeGame.sol";
import { Proxy } from "src/universal/Proxy.sol";
import { CommonTest } from "test/setup/CommonTest.sol";
......@@ -236,6 +236,114 @@ contract DisputeGameFactory_TransferOwnership_Test is DisputeGameFactory_Init {
}
}
contract DisputeGameFactory_FindLatestGames_Test is DisputeGameFactory_Init {
function setUp() public override {
super.setUp();
// Set three implementations to the same `FakeClone` contract.
for (uint8 i; i < 3; i++) {
GameType lgt = GameType.wrap(i);
factory.setImplementation(lgt, IDisputeGame(address(fakeClone)));
factory.setInitBond(lgt, 0);
}
}
/// @dev Tests that `findLatestGames` returns an empty array when the passed starting index is greater than or equal
/// to the game count.
function testFuzz_findLatestGames_greaterThanLength_succeeds(uint256 _start) public {
// Create some dispute games of varying game types.
for (uint256 i; i < 1 << 5; i++) {
factory.create(GameType.wrap(uint8(i % 2)), Claim.wrap(bytes32(i)), abi.encode(i));
}
// Bound the starting index to a number greater than the length of the game list.
uint256 gameCount = factory.gameCount();
_start = bound(_start, gameCount, type(uint256).max);
// The array's length should always be 0.
IDisputeGameFactory.GameSearchResult[] memory games = factory.findLatestGames(GameTypes.CANNON, _start, 1);
assertEq(games.length, 0);
}
/// @dev Tests that `findLatestGames` returns the correct games.
function test_findLatestGames_static_succeeds() public {
// Create some dispute games of varying game types.
for (uint256 i; i < 1 << 5; i++) {
factory.create(GameType.wrap(uint8(i % 3)), Claim.wrap(bytes32(i)), abi.encode(i));
}
uint256 gameCount = factory.gameCount();
IDisputeGameFactory.GameSearchResult[] memory games =
factory.findLatestGames(GameType.wrap(0), gameCount - 1, 1);
assertEq(games.length, 1);
assertEq(games[0].index, 30);
(GameType gameType, Timestamp createdAt, IDisputeGame game) = games[0].metadata.unpack();
assertEq(gameType.raw(), 0);
assertEq(createdAt.raw(), block.timestamp);
games = factory.findLatestGames(GameType.wrap(1), gameCount - 1, 1);
assertEq(games.length, 1);
assertEq(games[0].index, 31);
(gameType, createdAt, game) = games[0].metadata.unpack();
assertEq(gameType.raw(), 1);
assertEq(createdAt.raw(), block.timestamp);
games = factory.findLatestGames(GameType.wrap(2), gameCount - 1, 1);
assertEq(games.length, 1);
assertEq(games[0].index, 29);
(gameType, createdAt, game) = games[0].metadata.unpack();
assertEq(gameType.raw(), 2);
assertEq(createdAt.raw(), block.timestamp);
}
/// @dev Tests that `findLatestGames` returns the correct games, if there are less than `_n` games of the given type
/// available.
function test_findLatestGames_lessThanNAvailable_succeeds() public {
// Create some dispute games of varying game types.
factory.create(GameType.wrap(1), Claim.wrap(bytes32(0)), abi.encode(0));
factory.create(GameType.wrap(1), Claim.wrap(bytes32(uint256(1))), abi.encode(1));
for (uint256 i; i < 1 << 3; i++) {
factory.create(GameType.wrap(0), Claim.wrap(bytes32(i)), abi.encode(i));
}
uint256 gameCount = factory.gameCount();
IDisputeGameFactory.GameSearchResult[] memory games =
factory.findLatestGames(GameType.wrap(2), gameCount - 1, 5);
assertEq(games.length, 0);
games = factory.findLatestGames(GameType.wrap(1), gameCount - 1, 5);
assertEq(games.length, 2);
assertEq(games[0].index, 1);
assertEq(games[1].index, 0);
}
/// @dev Tests that the expected number of games are returned when `findLatestGames` is called.
function testFuzz_findLatestGames_correctAmount_succeeds(
uint256 _numGames,
uint256 _numSearchedGames,
uint256 _n
)
public
{
_numGames = bound(_numGames, 0, 1 << 8);
_numSearchedGames = bound(_numSearchedGames, 0, _numGames);
_n = bound(_n, 0, _numSearchedGames);
// Create `_numGames` dispute games, with at least `_numSearchedGames` games.
for (uint256 i; i < _numGames; i++) {
uint8 gameType = i < _numSearchedGames ? 0 : 1;
factory.create(GameType.wrap(gameType), Claim.wrap(bytes32(i)), abi.encode(i));
}
// Ensure that the correct number of games are returned.
uint256 start = _numGames == 0 ? 0 : _numGames - 1;
IDisputeGameFactory.GameSearchResult[] memory games = factory.findLatestGames(GameType.wrap(0), start, _n);
assertEq(games.length, _n);
}
}
/// @dev A fake clone used for testing the `DisputeGameFactory` contract's `create` function.
contract FakeClone {
function initialize() external payable {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment