Forkchoice Ethereum Mainnet

Address Contract Partially Verified

Address 0xbA0304273a54dfeC1Fc7f4BCCbf4b15519AEcF15
Balance 0 ETH
Nonce 1
Code Size 16206 bytes
Indexed Transactions 0 (1 on-chain, 0.7% indexed)
External Etherscan · Sourcify

Contract Bytecode

16206 bytes
0x6080604052600436106102505760003560e01c806392239dff11610139578063bfbcff1a116100b6578063d661dd311161007a578063d661dd3114610c3f578063d706be3114610c54578063dd78cb5914610d1f578063e4c0aaf414610d49578063e9c2416614610d7c578063f48a0b3114610da657610250565b8063bfbcff1a14610a34578063c104817d14610b68578063c2f2beea14610b92578063d294ccef14610ba7578063d36fdb1814610c1557610250565b8063a37b6ad4116100fd578063a37b6ad414610922578063adc7faba14610937578063b4d7953914610961578063ba7079ca14610994578063bb0b86ff14610a1f57610250565b806392239dff1461076a578063974121b21461079457806397e90e501461083e57806398eeadf0146108b3578063a1c2bf4d146108dd57610250565b806348f343f3116101d25780636cdc090f116101965780636cdc090f14610653578063787471a9146106685780637b9433831461067d578063873db1a7146106925780638a0d1e61146107075780638c88c1491461074057610250565b806348f343f3146104375780634aac84e5146104ee57806352bc0e60146105ac5780636bfb0d01146106295780636cc6cde11461063e57610250565b80632baf80ee116102195780632baf80ee14610378578063311a6c561461039e57806333e5d047146103ce5780633d4d3600146103f8578063416583411461042257610250565b806282a36d146102555780630c340a241461027c5780630c7ac7b6146102ad57806312ce3525146103375780631d51208514610363575b600080fd5b34801561026157600080fd5b5061026a610e28565b60408051918252519081900360200190f35b34801561028857600080fd5b50610291610e2e565b604080516001600160a01b039092168252519081900360200190f35b3480156102b957600080fd5b506102c2610e3d565b6040805160208082528351818301528351919283929083019185019080838360005b838110156102fc5781810151838201526020016102e4565b50505050905090810190601f1680156103295780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561034357600080fd5b506103616004803603602081101561035a57600080fd5b5035610eca565b005b34801561036f57600080fd5b5061026a610f1c565b6103616004803603604081101561038e57600080fd5b508035906020013560ff16610f22565b3480156103aa57600080fd5b50610361600480360360408110156103c157600080fd5b5080359060200135611703565b3480156103da57600080fd5b50610361600480360360208110156103f157600080fd5b503561190a565b34801561040457600080fd5b5061026a6004803603602081101561041b57600080fd5b503561195c565b34801561042e57600080fd5b5061026a61197a565b34801561044357600080fd5b506104616004803603602081101561045a57600080fd5b5035611980565b604051808060200183600381111561047557fe5b60ff168152602001828103825284818151815260200191508051906020019080838360005b838110156104b257818101518382015260200161049a565b50505050905090810190601f1680156104df5780820380516001836020036101000a031916815260200191505b50935050505060405180910390f35b3480156104fa57600080fd5b506105186004803603602081101561051157600080fd5b5035611a2a565b604051808060200184600381111561052c57fe5b60ff168152602001838152602001828103825285818151815260200191508051906020019080838360005b8381101561056f578181015183820152602001610557565b50505050905090810190601f16801561059c5780820380516001836020036101000a031916815260200191505b5094505050505060405180910390f35b3480156105b857600080fd5b506105f1600480360360808110156105cf57600080fd5b50803590602081013590604081013590606001356001600160a01b0316611aea565b6040518082606080838360005b838110156106165781810151838201526020016105fe565b5050505090500191505060405180910390f35b34801561063557600080fd5b5061026a611b9a565b34801561064a57600080fd5b50610291611ba1565b34801561065f57600080fd5b5061026a611bb0565b34801561067457600080fd5b5061026a611bb6565b34801561068957600080fd5b5061026a611bbc565b610361600480360360408110156106a857600080fd5b81359190810190604081016020820135600160201b8111156106c957600080fd5b8201836020820111156106db57600080fd5b803590602001918460018302840111600160201b831117156106fc57600080fd5b509092509050611bc2565b34801561071357600080fd5b5061026a6004803603604081101561072a57600080fd5b506001600160a01b03813516906020013561215a565b34801561074c57600080fd5b506103616004803603602081101561076357600080fd5b5035612177565b34801561077657600080fd5b506103616004803603602081101561078d57600080fd5b50356121c9565b3480156107a057600080fd5b506107ca600480360360608110156107b757600080fd5b508035906020810135906040013561221b565b60405184151581526020810184606080838360005b838110156107f75781810151838201526020016107df565b5050505090500183600360200280838360005b8381101561082257818101518382015260200161080a565b5050505090500182815260200194505050505060405180910390f35b6103616004803603604081101561085457600080fd5b81359190810190604081016020820135600160201b81111561087557600080fd5b82018360208201111561088757600080fd5b803590602001918460018302840111600160201b831117156108a857600080fd5b50909250905061233c565b3480156108bf57600080fd5b5061026a600480360360208110156108d657600080fd5b50356124ea565b3480156108e957600080fd5b506103616004803603608081101561090057600080fd5b506001600160a01b0381351690602081013590604081013590606001356124fc565b34801561092e57600080fd5b5061026a6127b0565b34801561094357600080fd5b506103616004803603602081101561095a57600080fd5b50356127b6565b34801561096d57600080fd5b506103616004803603602081101561098457600080fd5b50356001600160a01b0316612808565b3480156109a057600080fd5b50610361600480360360408110156109b757600080fd5b6001600160a01b038235169190810190604081016020820135600160201b8111156109e157600080fd5b8201836020820111156109f357600080fd5b803590602001918460018302840111600160201b83111715610a1457600080fd5b50909250905061288c565b348015610a2b57600080fd5b5061026a612900565b348015610a4057600080fd5b50610a6460048036036040811015610a5757600080fd5b5080359060200135612906565b604051808b1515151581526020018a81526020018981526020018815151515815260200187600360200280838360005b83811015610aac578181015183820152602001610a94565b50505050905001868152602001856002811115610ac557fe5b60ff168152602001846001600160a01b03166001600160a01b0316815260200180602001838152602001828103825284818151815260200191508051906020019080838360005b83811015610b24578181015183820152602001610b0c565b50505050905090810190601f168015610b515780820380516001836020036101000a031916815260200191505b509b50505050505050505050505060405180910390f35b348015610b7457600080fd5b5061036160048036036020811015610b8b57600080fd5b5035612a8a565b348015610b9e57600080fd5b5061026a612adc565b61036160048036036020811015610bbd57600080fd5b810190602081018135600160201b811115610bd757600080fd5b820183602082011115610be957600080fd5b803590602001918460018302840111600160201b83111715610c0a57600080fd5b509092509050612ae2565b348015610c2157600080fd5b5061036160048036036020811015610c3857600080fd5b5035612bc4565b348015610c4b57600080fd5b5061026a612c16565b348015610c6057600080fd5b5061036160048036036040811015610c7757600080fd5b810190602081018135600160201b811115610c9157600080fd5b820183602082011115610ca357600080fd5b803590602001918460018302840111600160201b83111715610cc457600080fd5b919390929091602081019035600160201b811115610ce157600080fd5b820183602082011115610cf357600080fd5b803590602001918460018302840111600160201b83111715610d1457600080fd5b509092509050612c1c565b348015610d2b57600080fd5b5061036160048036036020811015610d4257600080fd5b5035612d48565b348015610d5557600080fd5b5061036160048036036020811015610d6c57600080fd5b50356001600160a01b0316612d9a565b348015610d8857600080fd5b5061036160048036036020811015610d9f57600080fd5b5035612e09565b348015610db257600080fd5b5061036160048036036040811015610dc957600080fd5b81359190810190604081016020820135600160201b811115610dea57600080fd5b820183602082011115610dfc57600080fd5b803590602001918460018302840111600160201b83111715610e1d57600080fd5b509092509050613001565b60085481565b6003546001600160a01b031681565b60018054604080516020600284861615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610ec25780601f10610e9757610100808354040283529160200191610ec2565b820191906000526020600020905b815481529060010190602001808311610ea557829003601f168201915b505050505081565b6003546001600160a01b03163314610f17576040805162461bcd60e51b81526020600482018190526024820152600080516020613d97833981519152604482015290519081900360640190fd5b600c55565b600b5481565b6001816002811115610f3057fe5b1480610f4757506002816002811115610f4557fe5b145b610f88576040805162461bcd60e51b815260206004820152600d60248201526c24b73b30b634b21039b4b2329760991b604482015290519081900360640190fd5b60026000838152600e602052604090206001015460ff166003811115610faa57fe5b1480610fd5575060036000838152600e602052604090206001015460ff166003811115610fd357fe5b145b6110105760405162461bcd60e51b8152600401808060200182810382526025815260200180613ef56025913960400191505060405180910390fd5b6000828152600e602052604081206002018054600019810190811061103157fe5b60009182526020909120600b90910201805490915060ff166110845760405162461bcd60e51b8152600401808060200182810382526032815260200180613ec36032913960400191505060405180910390fd5b6000808260080160019054906101000a90046001600160a01b03166001600160a01b031663afe15cfb84600101546040518263ffffffff1660e01b815260040180828152602001915050604080518083038186803b1580156110e557600080fd5b505afa1580156110f9573d6000803e3d6000fd5b505050506040513d604081101561110f57600080fd5b508051602090910151909250905042821180159061112c57508042105b6111675760405162461bcd60e51b8152600401808060200182810382526034815260200180613d316034913960400191505060405180910390fd5b6000808460080160019054906101000a90046001600160a01b03166001600160a01b0316631c3db16d86600101546040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b1580156111c957600080fd5b505afa1580156111dd573d6000803e3d6000fd5b505050506040513d60208110156111f357600080fd5b5051600281111561120057fe5b90506000600182600281111561121257fe5b141561122057506002611238565b600282600281111561122e57fe5b1415611238575060015b80600281111561124457fe5b87600281111561125057fe5b1415806112635750600285850304854203105b61129e5760405162461bcd60e51b8152600401808060200182810382526045815260200180613db76045913960600191505060405180910390fd5b8160028111156112aa57fe5b8760028111156112b657fe5b14156112c657600a5492506112f4565b8060028111156112d257fe5b8760028111156112de57fe5b14156112ee57600b5492506112f4565b600c5492505b505060078401805460009190600019810190811061130e57fe5b60009182526020822060088801546001808a01546040805163791f8b7360e11b8152600481018381526024820192835260098e01805460026101009782161588026000190190911604604484018190526006999099029097019950939094046001600160a01b03169563f23f16e695929492939260640190849080156113d55780601f106113aa576101008083540402835291602001916113d5565b820191906000526020600020905b8154815290600101906020018083116113b857829003601f168201915b5050935050505060206040518083038186803b1580156113f457600080fd5b505afa158015611408573d6000803e3d6000fd5b505050506040513d602081101561141e57600080fd5b50519050600061145061271061143a848763ffffffff61312e16565b8161144157fe5b8491900463ffffffff61316416565b90506000611461848a333486613179565b90506001600e60008c81526020019081526020016000206002018054905003336001600160a01b03168b7fd2dc318ba4003f1a6794e033a06e7d6500078805db9f67674ca0bfd2f33c5f3d60018c6007018054905003858e604051808481526020018381526020018260028111156114d557fe5b60ff168152602001935050505060405180910390a481848a60028111156114f857fe5b6003811061150257fe5b0154106115b3576001846003018a600281111561151b57fe5b6003811061152557fe5b602091828204019190066101000a81548160ff02191690831515021790555060018860070180549050036001600e60008d815260200190815260200160002060020180549050038b7f2307dcf798ac8d587c57c5327f7a79292152779aa7f3a2931e817fa2b09d9ff38c6040518082600281111561159f57fe5b60ff16815260200191505060405180910390a45b600384015462010000900460ff1680156115d657506003840154610100900460ff165b156116f75760088801546001808a01546040805163093225f160e31b8152600481018381526024820192835260098e0180546002610100978216158802600019019091160460448401819052959096046001600160a01b0316956349912f88958a95949193606401908490801561168e5780601f106116635761010080835404028352916020019161168e565b820191906000526020600020905b81548152906001019060200180831161167157829003601f168201915b505093505050506000604051808303818588803b1580156116ae57600080fd5b505af11580156116c2573d6000803e3d6000fd5b50505060078a01805492506116db9150600183016139b9565b5060048401546116f1908463ffffffff61324916565b60048501555b50505050505050505050565b600081600281111561171157fe5b336000908152600f60209081526040808320878452825280832054808452600e9092528220600281018054949550919390929190600019810190811061175357fe5b6000918252602082206007600b90920201908101805491935090600019810190811061177b57fe5b906000526020600020906006020190506002548611156117da576040805162461bcd60e51b815260206004820152601560248201527424b73b30b634b210393ab634b7339037b83a34b7b760591b604482015290519081900360640190fd5b600882015461010090046001600160a01b0316331461182a5760405162461bcd60e51b8152600401808060200182810382526025815260200180613e466025913960400191505060405180910390fd5b600382015460ff161561186e5760405162461bcd60e51b8152600401808060200182810382526021815260200180613dfc6021913960400191505060405180910390fd5b600381015460ff6101009091041615156001141561188f57600194506118ac565b600381015462010000900460ff161515600114156118ac57600294505b86337f394027a5fa6e098a1191094d1719d6929b9abc535fcc0c8f448d6a4e756222768760028111156118db57fe5b60408051918252519081900360200190a3611901878660028111156118fc57fe5b613264565b50505050505050565b6003546001600160a01b03163314611957576040805162461bcd60e51b81526020600482018190526024820152600080516020613d97833981519152604482015290519081900360640190fd5b600455565b600d818154811061196957fe5b600091825260209091200154905081565b600c5481565b600e6020908152600091825260409182902080548351601f60026000196101006001861615020190931692909204918201849004840281018401909452808452909291839190830182828015611a175780601f106119ec57610100808354040283529160200191611a17565b820191906000526020600020905b8154815290600101906020018083116119fa57829003601f168201915b5050506001909301549192505060ff1682565b6000818152600e60209081526040808320600180820154600280840154845486516101009582161595909502600019011691909104601f8101879004870284018701909552848352606096958695859460ff9094169391859190830182828015611ad55780601f10611aaa57610100808354040283529160200191611ad5565b820191906000526020600020905b815481529060010190602001808311611ab857829003601f168201915b50505050509250935093509350509193909250565b611af26139e5565b6000858152600e6020526040812060028101805491929187908110611b1357fe5b90600052602060002090600b020190506000816007018681548110611b3457fe5b600091825260208083206001600160a01b03891684526005600690930201918201905260409182902082516060810190935290925060038282826020028201915b815481526020019060010190808311611b755750505050509350505050949350505050565b600d545b90565b6000546001600160a01b031681565b60095481565b60075481565b600a5481565b6000838152600e602052604090206002600182015460ff166003811115611be557fe5b1480611c0357506003600182015460ff166003811115611c0157fe5b145b611c3e5760405162461bcd60e51b8152600401808060200182810382526025815260200180613ef56025913960400191505060405180910390fd5b600281018054600091906000198101908110611c5657fe5b90600052602060002090600b02019050600854816002015442031115611cad5760405162461bcd60e51b8152600401808060200182810382526032815260200180613e6b6032913960400191505060405180910390fd5b805460ff1615611cee5760405162461bcd60e51b8152600401808060200182810382526032815260200180613d656032913960400191505060405180910390fd5b6006810180546001600160a01b03191633179055600781018054600091908290611d1457fe5b60009182526020808320600886015460405163f7434ea960e01b8152600481019384526009880180546002610100600183161581026000190190921604602484018190526006979097029094019750929091046001600160a01b03169363f7434ea99391829160449091019084908015611dcf5780601f10611da457610100808354040283529160200191611dcf565b820191906000526020600020905b815481529060010190602001808311611db257829003601f168201915b50509250505060206040518083038186803b158015611ded57600080fd5b505afa158015611e01573d6000803e3d6000fd5b505050506040513d6020811015611e1757600080fd5b5051905060006002600186015460ff166003811115611e3257fe5b14611e3f57600754611e43565b6006545b90506000611e57838363ffffffff61316416565b9050611e67846002333485613179565b508084600201541015611ec1576040805162461bcd60e51b815260206004820152601e60248201527f596f75206d7573742066756c6c792066756e6420796f757220736964652e0000604482015290519081900360640190fd5b60038401805462ff00001916620100001790556008850154600280546040805163c13517e160e01b8152600481018381526024820192835260098b0180546001811615610100908102600019019091169690960460448401819052959096046001600160a01b03169563c13517e1958a959491936064019084908015611f885780601f10611f5d57610100808354040283529160200191611f88565b820191906000526020600020905b815481529060010190602001808311611f6b57829003601f168201915b505093505050506020604051808303818588803b158015611fa857600080fd5b505af1158015611fbc573d6000803e3d6000fd5b50505050506040513d6020811015611fd357600080fd5b50516001868101829055600887015461010090046001600160a01b03166000908152600f60209081526040808320948352939052919091208a9055855460ff1916811786556007860180549161202b919083016139b9565b506004840154612041908463ffffffff61324916565b600485015560028601546040805160208082018d9052600019909301818301528151808203830181526060820180845281519190940120600189015460088a0154600a8b015490955260808301829052925190936001600160a01b0361010090910416917f74baab670a4015ab2f1b467c5252a96141a2573f2908e58a92081e80d3cfde3d919081900360a00190a387156116f757600886015460408051602080825281018b9052339284926101009091046001600160a01b0316917fdccf2f8b2cc26eafcd61905cba744cff4b81d14740725f6376390dc6298a6a3c918e918e9181908101848480828437600083820152604051601f909101601f19169092018290039550909350505050a450505050505050505050565b600f60209081526000928352604080842090915290825290205481565b6003546001600160a01b031633146121c4576040805162461bcd60e51b81526020600482018190526024820152600080516020613d97833981519152604482015290519081900360640190fd5b600555565b6003546001600160a01b03163314612216576040805162461bcd60e51b81526020600482018190526024820152600080516020613d97833981519152604482015290519081900360640190fd5b600b55565b60006122256139e5565b61222d6139e5565b6000868152600e602052604081206002810180548391908990811061224e57fe5b90600052602060002090600b02019050600081600701888154811061226f57fe5b90600052602060002090600602019050600182600701805490500388141581600001826003018360040154826003806020026040519081016040528092919082600380156122d2576020028201915b8154815260200190600101908083116122be575b5050604080516060810191829052949750869350600392509050826000855b825461010083900a900460ff1615158152602060019283018181049485019490930390920291018084116122f157905050505050509150965096509650965050505093509350935093565b60016000848152600e602052604090206001015460ff16600381111561235e57fe5b1461239a5760405162461bcd60e51b8152600401808060200182810382526026815260200180613e9d6026913960400191505060405180910390fd5b6000838152600e60205260409020811561244d57600281015460408051602080820188905281830184905282518083038401815260608301938490528051908201206000549184526080830187905292339284926001600160a01b0316917fdccf2f8b2cc26eafcd61905cba744cff4b81d14740725f6376390dc6298a6a3c918a918a91819060a001848480828437600083820152604051601f909101601f19169092018290039550909350505050a450505b805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181526124e492909184918301828280156124d75780601f106124ac576101008083540402835291602001916124d7565b820191906000526020600020905b8154815290600101906020018083116124ba57829003601f168201915b5050505050600554613499565b50505050565b60106020526000908152604090205481565b6000838152600e602052604081206002810180549192918590811061251d57fe5b90600052602060002090600b02019050600081600701848154811061253e57fe5b600091825260209091206003840154600690920201915060ff166125a9576040805162461bcd60e51b815260206004820152601960248201527f52657175657374206d757374206265207265736f6c7665642e00000000000000604482015290519081900360640190fd5b6003810154600090610100900460ff1615806125d05750600382015462010000900460ff16155b1561260157506001600160a01b03871660009081526005820160205260409020600281015460019091015401612767565b6000600884015460ff16600281111561261657fe5b14156126cb5760008083600101541161263057600061266c565b8260010154836002015460048501546001600160a01b038c1660009081526005870160205260409020929091019160010154028161266a57fe5b045b90506000808460020154116126825760006126be565b8360010154846002015460048601546001600160a01b038d166000908152600588016020526040902092909101916002015402816126bc57fe5b045b9190910191506127679050565b6008830154600090839060ff1660028111156126e357fe5b600381106126ed57fe5b0154116126fb576000612764565b6008830154829060ff16600281111561271057fe5b6003811061271a57fe5b015460048301546001600160a01b038a1660009081526005850160205260409020600886015460ff16600281111561274e57fe5b6003811061275857fe5b0154028161276257fe5b045b90505b6001600160a01b038816600081815260058401602052604080822060018101839055600201829055516108fc84150291849190818181858888f150505050505050505050505050565b60065481565b6003546001600160a01b03163314612803576040805162461bcd60e51b81526020600482018190526024820152600080516020613d97833981519152604482015290519081900360640190fd5b600a55565b6003546001600160a01b03163314612855576040805162461bcd60e51b81526020600482018190526024820152600080516020613d97833981519152604482015290519081900360640190fd5b6040516001600160a01b038216907fc86a04b722cdfef2134355447e1ebddd83d57a81cddda524d682811e222bc25090600090a250565b6003546001600160a01b031633146128d9576040805162461bcd60e51b81526020600482018190526024820152600080516020613d97833981519152604482015290519081900360640190fd5b600080546001600160a01b0319166001600160a01b0385161790556124e460018383613a03565b60045481565b6000806000806129146139e5565b60008060006060600080600e60008e81526020019081526020016000206002018c8154811061293f57fe5b60009182526020909120600b9091020180546001820154600283015460038085015460078601546008870154600a880154604080516060810191829052999a5060ff98891699979896979487169660048c01969495908416946101009094046001600160a01b03169360098d01939288919082845b81546001600160a01b031681526001909101906020018083116129b4575050855460408051602060026001851615610100026000190190941693909304601f8101849004840282018401909252818152959b5087945092508401905082828015612a5f5780601f10612a3457610100808354040283529160200191612a5f565b820191906000526020600020905b815481529060010190602001808311612a4257829003601f168201915b505050505091509a509a509a509a509a509a509a509a509a509a50509295989b9194979a5092959850565b6003546001600160a01b03163314612ad7576040805162461bcd60e51b81526020600482018190526024820152600080516020613d97833981519152604482015290519081900360640190fd5b600655565b60055481565b60008282604051808383808284376040519201829003909120945060009350612b0a92505050565b6000828152600e602052604090206001015460ff166003811115612b2a57fe5b14612b7c576040805162461bcd60e51b815260206004820181905260248201527f4974656d206d75737420626520616273656e7420746f2062652061646465642e604482015290519081900360640190fd5b612bbf83838080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152505060045491506134999050565b505050565b6003546001600160a01b03163314612c11576040805162461bcd60e51b81526020600482018190526024820152600080516020613d97833981519152604482015290519081900360640190fd5b600855565b61271081565b6003546001600160a01b03163314612c69576040805162461bcd60e51b81526020600482018190526024820152600080516020613d97833981519152604482015290519081900360640190fd5b600980546001019081905560408051602080825281018690526002909202917f61606860eb6c87306811e2695215385101daab53bd6ab4e9f9049aead9363c7d918791879181908101848480828437600083820152604051601f909101601f19169092018290039550909350505050a26009546002026001017f61606860eb6c87306811e2695215385101daab53bd6ab4e9f9049aead9363c7d838360405180806020018281038252848482818152602001925080828437600083820152604051601f909101601f19169092018290039550909350505050a250505050565b6003546001600160a01b03163314612d95576040805162461bcd60e51b81526020600482018190526024820152600080516020613d97833981519152604482015290519081900360640190fd5b600755565b6003546001600160a01b03163314612de7576040805162461bcd60e51b81526020600482018190526024820152600080516020613d97833981519152604482015290519081900360640190fd5b600380546001600160a01b0319166001600160a01b0392909216919091179055565b6000818152600e602052604081206002810180549192916000198101908110612e2e57fe5b90600052602060002090600b020190506008548160020154420311612e845760405162461bcd60e51b8152600401808060200182810382526028815260200180613d096028913960400191505060405180910390fd5b805460ff1615612ec55760405162461bcd60e51b8152600401808060200182810382526023815260200180613ce66023913960400191505060405180910390fd5b6002600183015460ff166003811115612eda57fe5b1415612ef8576001828101805460ff191682805b0217905550612f77565b6003600183015460ff166003811115612f0d57fe5b1415612f2a576001808301805460009260ff199091169083612eee565b6040805162461bcd60e51b815260206004820152601860248201527f5468657265206d757374206265206120726571756573742e0000000000000000604482015290519081900360640190fd5b60038101805460ff191660019081179091556007820154600284015460408051600081526020810194909452805160001993840194929093019287927f298f9b7df751fd9e63ad99b4f83c2509c67421163d60b5cc6573f40f24abe58192908290030190a460058101546002830154612bbf916001600160a01b03169085906000190160006124fc565b6000838152600e60205260408120600281018054919291600019810190811061302657fe5b60009182526020909120600b90910201600381015490915060ff161561307d5760405162461bcd60e51b8152600401808060200182810382526029815260200180613e1d6029913960400191505060405180910390fd5b600282015460408051602080820189905260001990930181830152815180820383018152606082019283905280519084012060088501549383526080820187905292339284926101009092046001600160a01b0316917fdccf2f8b2cc26eafcd61905cba744cff4b81d14740725f6376390dc6298a6a3c918a918a9190819060a001848480828437600083820152604051601f909101601f19169092018290039550909350505050a4505050505050565b60008261313d5750600061315e565b8282028284828161314a57fe5b04146131585760001961315a565b805b9150505b92915050565b6000828201838110156131585760001961315a565b600080806131af856131aa8a8a600281111561319157fe5b6003811061319b57fe5b0154879063ffffffff61324916565b613994565b6001600160a01b038816600090815260058b0160205260409020919350915082908860028111156131dc57fe5b600381106131e657fe5b018054909101905581888860028111156131fc57fe5b6003811061320657fe5b0180549091019055600488018054830190556040516001600160a01b0387169082156108fc029083906000818181858888f150949b9a5050505050505050505050565b60008282111561325b5750600061315e565b5080820361315e565b336000908152600f60209081526040808320858452825280832054808452600e90925282206002810180549293919260001981019081106132a157fe5b90600052602060002090600b0201905060008460028111156132bf57fe5b905060018160028111156132cf57fe5b141561333e576002600184015460ff1660038111156132ea57fe5b1415613305576001838101805460ff19169091179055613339565b6003600184015460ff16600381111561331a57fe5b1415613339576001808401805460009260ff1990911690835b02179055505b61339c565b6002600184015460ff16600381111561335357fe5b1415613370576001808401805460009260ff199091169083613333565b6003600184015460ff16600381111561338557fe5b141561339c576001838101805460ff191690911790555b60038201805460ff191660011790558460028111156133b757fe5b60088301805460ff191660018360028111156133cf57fe5b02179055506007820154600284015460408051600180825260208201528151600019948501949093019288927f298f9b7df751fd9e63ad99b4f83c2509c67421163d60b5cc6573f40f24abe581928290030190a4600081600281111561343157fe5b141561347e5761346b6004830160015b6003811061344b57fe5b015460028501546001600160a01b039091169086906000190160006124fc565b613479600483016002613441565b613491565b6134918260040182600281111561344157fe5b505050505050565b81516020808401919091206000818152600e83526040908190206002810154825180860185905280840182905283518082038501815260609091019093528251929094019190912091929091906135fb5784516134fc9083906020880190613a81565b50600d8054600180820183557fd7b6990105719101dabeb77144f2a3385c8033acd3af97e9423a695e81ad1eb5909101859055905460008581526010602090815260409182902060001993840190558151818152865460029581161561010002909401909316939093049282018390528392339287927f909f6b266555a57aee2c82ba6326605749e5eb297f67e1a4ad0bc9c7f0d013ee92889291829190820190849080156135ec5780601f106135c1576101008083540402835291602001916135ec565b820191906000526020600020905b8154815290600101906020018083116135cf57829003601f168201915b50509250505060405180910390a45b600282018054600091906136128260018301613aef565b8154811061361c57fe5b600091825260208220600b909102019150600184015460ff16600381111561364057fe5b14156136665760018301805460ff1916600290811790915560095402600a82015561369d565b60018084015460ff16600381111561367a57fe5b141561369d576001838101805460ff1916600317905560095460020201600a8201555b600581018054336001600160a01b031990911617905542600280830191909155600054600883018054610100600160a81b0319166101006001600160a01b0390931683021790556001805461370393600986019382841615026000190190911604613b1b565b506007810180546000919061371b82600183016139b9565b8154811061372557fe5b60009182526020808320600886015460405163f7434ea960e01b8152600481019384526009880180546002610100600183161581026000190190921604602484018190526006979097029094019750929091046001600160a01b03169363f7434ea993918291604490910190849080156137e05780601f106137b5576101008083540402835291602001916137e0565b820191906000526020600020905b8154815290600101906020018083116137c357829003601f168201915b50509250505060206040518083038186803b1580156137fe57600080fd5b505afa158015613812573d6000803e3d6000fd5b505050506040513d602081101561382857600080fd5b50519050600061383e828963ffffffff61316416565b905061384e836001333485613179565b5080836001015410156138a8576040805162461bcd60e51b815260206004820152601e60248201527f596f75206d7573742066756c6c792066756e6420796f757220736964652e0000604482015290519081900360640190fd5b60038301805461ff001916610100179055600784015460028701546040805160008082526020820152815160001994850194909301928b927f298f9b7df751fd9e63ad99b4f83c2509c67421163d60b5cc6573f40f24abe581928290030190a4600186015460ff16600381111561391b57fe5b60028701546040516000199091019089907f3df0d1fdcd07576fccf91c63cc392d4b6facc79e6df12df6482342e3ed9d3b2090600090a460028601546040518691600019019089907f6a1ec219a182810abe6f25702d9e60eabaaf29e7d1c87bc0a778b845be86e06190600090a4505050505050505050565b600080838311156139aa575082905060006139b2565b508190508083035b9250929050565b815481835581811115612bbf57600602816006028360005260206000209182019101612bbf9190613b90565b60405180606001604052806003906020820280388339509192915050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10613a445782800160ff19823516178555613a71565b82800160010185558215613a71579182015b82811115613a71578235825591602001919060010190613a56565b50613a7d929150613bc8565b5090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10613ac257805160ff1916838001178555613a71565b82800160010185558215613a71579182015b82811115613a71578251825591602001919060010190613ad4565b815481835581811115612bbf57600b0281600b028360005260206000209182019101612bbf9190613be2565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10613b545780548555613a71565b82800160010185558215613a7157600052602060002091601f016020900482015b82811115613a71578254825591600101919060010190613b75565b611b9e91905b80821115613a7d576000613baa8282613c61565b613bb8600383016000613c76565b5060006004820155600601613b96565b611b9e91905b80821115613a7d5760008155600101613bce565b611b9e91905b80821115613a7d57805460ff19908116825560006001830181905560028301819055600383018054909216909155613c236004830182613c61565b613c31600783016000613c7d565b6008820180546001600160a81b0319169055613c51600983016000613ca1565b506000600a820155600b01613be8565b50600081556001016000815560010160009055565b5060009055565b5080546000825560060290600052602060002090810190613c9e9190613b90565b50565b50805460018160011615610100020316600290046000825580601f10613cc75750613c9e565b601f016020900490600052602060002090810190613c9e9190613bc856fe54686520726571756573742073686f756c64206e6f742062652064697370757465642e54696d6520746f206368616c6c656e6765207468652072657175657374206d75737420706173732e436f6e747269627574696f6e73206d757374206265206d6164652077697468696e207468652061707065616c20706572696f642e54686520726571756573742073686f756c64206e6f74206861766520616c7265616479206265656e2064697370757465642e5468652063616c6c6572206d7573742062652074686520676f7665726e6f722e546865206c6f736572206d75737420636f6e7472696275746520647572696e67207468652066697273742068616c66206f66207468652061707065616c20706572696f642e5468652072657175657374206d757374206e6f74206265207265736f6c7665642e5468652064697370757465206d757374206e6f7420616c7265616479206265207265736f6c7665642e4f6e6c79207468652061726269747261746f722063616e206769766520612072756c696e674368616c6c656e676573206d757374206f6363757220647572696e6720746865206368616c6c656e676520706572696f642e4974656d206d757374206265207265676973746572656420746f2062652072656d6f7665642e412064697370757465206d7573742068617665206265656e2072616973656420746f2066756e6420616e2061707065616c2e546865206974656d206d757374206861766520612070656e64696e6720726571756573742ea265627a7a723158202b76a3b989021026f6f520f8072e015359dc6013901bf4abcb22d065fc1deae864736f6c63430005110032

Verified Source Code Partial Match

Compiler: v0.5.17+commit.d19bba13 EVM: istanbul Optimization: Yes (200 runs)
GeneralizedTCR.sol 1039 lines
/**
 *  @authors: [@mtsalenc]
 *  @reviewers: [@clesaege]
 *  @auditors: []
 *  @bounties: []
 *  @deployments: []
 */

pragma solidity ^0.5;


/**
 * @title CappedMath
 * @dev Math operations with caps for under and overflow.
 */
library CappedMath {
    uint constant private UINT_MAX = 2**256 - 1;

    /**
     * @dev Adds two unsigned integers, returns 2^256 - 1 on overflow.
     */
    function addCap(uint _a, uint _b) internal pure returns (uint) {
        uint c = _a + _b;
        return c >= _a ? c : UINT_MAX;
    }

    /**
     * @dev Subtracts two integers, returns 0 on underflow.
     */
    function subCap(uint _a, uint _b) internal pure returns (uint) {
        if (_b > _a)
            return 0;
        else
            return _a - _b;
    }

    /**
     * @dev Multiplies two unsigned integers, returns 2^256 - 1 on overflow.
     */
    function mulCap(uint _a, uint _b) internal pure returns (uint) {
        // Gas optimization: this is cheaper than requiring '_a' not being zero, but the
        // benefit is lost if '_b' is also tested.
        // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
        if (_a == 0)
            return 0;

        uint c = _a * _b;
        return c / _a == _b ? c : UINT_MAX;
    }
}


/**
 *  @title IArbitrable
 *  @author Enrique Piqueras - <[email protected]>
 */

pragma solidity ^0.5;


/** @title IArbitrable
 *  Arbitrable interface.
 *  When developing arbitrable contracts, we need to:
 *  -Define the action taken when a ruling is received by the contract.
 *  -Allow dispute creation. For this a function must call arbitrator.createDispute.value(_fee)(_choices,_extraData);
 */
interface IArbitrable {

    /** @dev To be raised when a ruling is given.
     *  @param _arbitrator The arbitrator giving the ruling.
     *  @param _disputeID ID of the dispute in the Arbitrator contract.
     *  @param _ruling The ruling which was given.
     */
    event Ruling(IArbitrator indexed _arbitrator, uint indexed _disputeID, uint _ruling);

    /** @dev Give a ruling for a dispute. Must be called by the arbitrator.
     *  The purpose of this function is to ensure that the address calling it has the right to rule on the contract.
     *  @param _disputeID ID of the dispute in the Arbitrator contract.
     *  @param _ruling Ruling given by the arbitrator. Note that 0 is reserved for "Not able/wanting to make a decision".
     */
    function rule(uint _disputeID, uint _ruling) external;
}


/**
 *  @title Arbitrator
 *  @author Clément Lesaege - <[email protected]>
 */

pragma solidity ^0.5;


/** @title Arbitrator
 *  Arbitrator abstract contract.
 *  When developing arbitrator contracts we need to:
 *  -Define the functions for dispute creation (createDispute) and appeal (appeal). Don't forget to store the arbitrated contract and the disputeID (which should be unique, may nbDisputes).
 *  -Define the functions for cost display (arbitrationCost and appealCost).
 *  -Allow giving rulings. For this a function must call arbitrable.rule(disputeID, ruling).
 */
interface IArbitrator {

    enum DisputeStatus {Waiting, Appealable, Solved}


    /** @dev To be emitted when a dispute is created.
     *  @param _disputeID ID of the dispute.
     *  @param _arbitrable The contract which created the dispute.
     */
    event DisputeCreation(uint indexed _disputeID, IArbitrable indexed _arbitrable);

    /** @dev To be emitted when a dispute can be appealed.
     *  @param _disputeID ID of the dispute.
     */
    event AppealPossible(uint indexed _disputeID, IArbitrable indexed _arbitrable);

    /** @dev To be emitted when the current ruling is appealed.
     *  @param _disputeID ID of the dispute.
     *  @param _arbitrable The contract which created the dispute.
     */
    event AppealDecision(uint indexed _disputeID, IArbitrable indexed _arbitrable);

    /** @dev Create a dispute. Must be called by the arbitrable contract.
     *  Must be paid at least arbitrationCost(_extraData).
     *  @param _choices Amount of choices the arbitrator can make in this dispute.
     *  @param _extraData Can be used to give additional info on the dispute to be created.
     *  @return disputeID ID of the dispute created.
     */
    function createDispute(uint _choices, bytes calldata _extraData) external payable returns(uint disputeID);

    /** @dev Compute the cost of arbitration. It is recommended not to increase it often, as it can be highly time and gas consuming for the arbitrated contracts to cope with fee augmentation.
     *  @param _extraData Can be used to give additional info on the dispute to be created.
     *  @return cost Amount to be paid.
     */
    function arbitrationCost(bytes calldata _extraData) external view returns(uint cost);

    /** @dev Appeal a ruling. Note that it has to be called before the arbitrator contract calls rule.
     *  @param _disputeID ID of the dispute to be appealed.
     *  @param _extraData Can be used to give extra info on the appeal.
     */
    function appeal(uint _disputeID, bytes calldata _extraData) external payable;

    /** @dev Compute the cost of appeal. It is recommended not to increase it often, as it can be higly time and gas consuming for the arbitrated contracts to cope with fee augmentation.
     *  @param _disputeID ID of the dispute to be appealed.
     *  @param _extraData Can be used to give additional info on the dispute to be created.
     *  @return cost Amount to be paid.
     */
    function appealCost(uint _disputeID, bytes calldata _extraData) external view returns(uint cost);

    /** @dev Compute the start and end of the dispute's current or next appeal period, if possible. If not known or appeal is impossible: should return (0, 0).
     *  @param _disputeID ID of the dispute.
     *  @return The start and end of the period.
     */
    function appealPeriod(uint _disputeID) external view returns(uint start, uint end);

    /** @dev Return the status of a dispute.
     *  @param _disputeID ID of the dispute to rule.
     *  @return status The status of the dispute.
     */
    function disputeStatus(uint _disputeID) external view returns(DisputeStatus status);

    /** @dev Return the current ruling of a dispute. This is useful for parties to know if they should appeal.
     *  @param _disputeID ID of the dispute.
     *  @return ruling The ruling which has been given or the one which will be given if there is no appeal.
     */
    function currentRuling(uint _disputeID) external view returns(uint ruling);

}


pragma solidity ^0.5;


/** @title IEvidence
 *  ERC-1497: Evidence Standard
 */
interface IEvidence {

    /** @dev To be emitted when meta-evidence is submitted.
     *  @param _metaEvidenceID Unique identifier of meta-evidence.
     *  @param _evidence A link to the meta-evidence JSON.
     */
    event MetaEvidence(uint indexed _metaEvidenceID, string _evidence);

    /** @dev To be raised when evidence is submitted. Should point to the resource (evidences are not to be stored on chain due to gas considerations).
     *  @param _arbitrator The arbitrator of the contract.
     *  @param _evidenceGroupID Unique identifier of the evidence group the evidence belongs to.
     *  @param _party The address of the party submiting the evidence. Note that 0x0 refers to evidence not submitted by any party.
     *  @param _evidence A URI to the evidence JSON file whose name should be its keccak256 hash followed by .json.
     */
    event Evidence(IArbitrator indexed _arbitrator, uint indexed _evidenceGroupID, address indexed _party, string _evidence);

    /** @dev To be emitted when a dispute is created to link the correct meta-evidence to the disputeID.
     *  @param _arbitrator The arbitrator of the contract.
     *  @param _disputeID ID of the dispute in the Arbitrator contract.
     *  @param _metaEvidenceID Unique identifier of meta-evidence.
     *  @param _evidenceGroupID Unique identifier of the evidence group that is linked to this dispute.
     */
    event Dispute(IArbitrator indexed _arbitrator, uint indexed _disputeID, uint _metaEvidenceID, uint _evidenceGroupID);

}


/**
 *  @authors: [@unknownunknown1, @mtsalenc]
 *  @reviewers: [@clesaege*, @ferittuncer, @satello*, @remedcu]
 *  @auditors: []
 *  @bounties: [{ link: https://github.com/kleros/tcr/issues/20, maxPayout: 25 ETH }]
 *  @deployments: []
 */

pragma solidity ^0.5.16;


/* solium-disable max-len */
/* solium-disable security/no-block-members */
/* solium-disable security/no-send */ // It is the user responsibility to accept ETH.

/**
 *  @title GeneralizedTCR
 *  This contract is a curated registry for any types of items. Just like a TCR contract it features the request-challenge protocol and appeal fees crowdfunding.
 */
contract GeneralizedTCR is IArbitrable, IEvidence {
    using CappedMath for uint;

    /* Enums */

    enum Status {
        Absent, // The item is not in the registry.
        Registered, // The item is in the registry.
        RegistrationRequested, // The item has a request to be added to the registry.
        ClearingRequested // The item has a request to be removed from the registry.
    }

    enum Party {
        None, // Party per default when there is no challenger or requester. Also used for unconclusive ruling.
        Requester, // Party that made the request to change a status.
        Challenger // Party that challenges the request to change a status.
    }

    /* Structs */

    struct Item {
        bytes data; // The data describing the item.
        Status status; // The current status of the item.
        Request[] requests; // List of status change requests made for the item in the form requests[requestID].
    }

    // Arrays with 3 elements map with the Party enum for better readability:
    // - 0: is unused, matches `Party.None`.
    // - 1: for `Party.Requester`.
    // - 2: for `Party.Challenger`.
    struct Request {
        bool disputed; // True if a dispute was raised.
        uint disputeID; // ID of the dispute, if any.
        uint submissionTime; // Time when the request was made. Used to track when the challenge period ends.
        bool resolved; // True if the request was executed and/or any raised disputes were resolved.
        address payable[3] parties; // Address of requester and challenger, if any, in the form parties[party].
        Round[] rounds; // Tracks each round of a dispute in the form rounds[roundID].
        Party ruling; // The final ruling given, if any.
        IArbitrator arbitrator; // The arbitrator trusted to solve disputes for this request.
        bytes arbitratorExtraData; // The extra data for the trusted arbitrator of this request.
        uint metaEvidenceID; // The meta evidence to be used in a dispute for this case.
    }

    struct Round {
        uint[3] amountPaid; // Tracks the sum paid for each Party in this round. Includes arbitration fees, fee stakes and deposits.
        bool[3] hasPaid; // True if the Party has fully paid its fee in this round.
        uint feeRewards; // Sum of reimbursable fees and stake rewards available to the parties that made contributions to the side that ultimately wins a dispute.
        mapping(address => uint[3]) contributions; // Maps contributors to their contributions for each side in the form contributions[address][party].
    }

    /* Storage */

    IArbitrator public arbitrator; // The arbitrator contract.
    bytes public arbitratorExtraData; // Extra data for the arbitrator contract.

    uint RULING_OPTIONS = 2; // The amount of non 0 choices the arbitrator can give.

    address public governor; // The address that can make changes to the parameters of the contract.
    uint public submissionBaseDeposit; // The base deposit to submit an item.
    uint public removalBaseDeposit; // The base deposit to remove an item.
    uint public submissionChallengeBaseDeposit; // The base deposit to challenge a submission.
    uint public removalChallengeBaseDeposit; // The base deposit to challenge a removal request.
    uint public challengePeriodDuration; // The time after which a request becomes executable if not challenged.
    uint public metaEvidenceUpdates; // The number of times the meta evidence has been updated. Used to track the latest meta evidence ID.

    // Multipliers are in basis points.
    uint public winnerStakeMultiplier; // Multiplier for calculating the fee stake paid by the party that won the previous round.
    uint public loserStakeMultiplier; // Multiplier for calculating the fee stake paid by the party that lost the previous round.
    uint public sharedStakeMultiplier; // Multiplier for calculating the fee stake that must be paid in the case where arbitrator refused to arbitrate.
    uint public constant MULTIPLIER_DIVISOR = 10000; // Divisor parameter for multipliers.

    bytes32[] public itemList; // List of IDs of all submitted items.
    mapping(bytes32 => Item) public items; // Maps the item ID to its data in the form items[_itemID].
    mapping(address => mapping(uint => bytes32)) public arbitratorDisputeIDToItem;  // Maps a dispute ID to the ID of the item with the disputed request in the form arbitratorDisputeIDToItem[arbitrator][disputeID].
    mapping(bytes32 => uint) public itemIDtoIndex; // Maps an item's ID to its position in the list in the form itemIDtoIndex[itemID].

     /* Modifiers */

    modifier onlyGovernor {require(msg.sender == governor, "The caller must be the governor."); _;}

    /* Events */

    /**
     *  @dev Emitted when a party makes a request, raises a dispute or when a request is resolved.
     *  @param _itemID The ID of the affected item.
     *  @param _requestIndex The index of the request.
     *  @param _roundIndex The index of the round.
     *  @param _disputed Whether the request is disputed.
     *  @param _resolved Whether the request is executed.
     */
    event ItemStatusChange(
      bytes32 indexed _itemID,
      uint indexed _requestIndex,
      uint indexed _roundIndex,
      bool _disputed,
      bool _resolved
    );

    /**
     *  @dev Emitted when someone submits an item for the first time.
     *  @param _itemID The ID of the new item.
     *  @param _submitter The address of the requester.
     *  @param _evidenceGroupID Unique identifier of the evidence group the evidence belongs to.
     *  @param _data The item data.
     */
    event ItemSubmitted(
      bytes32 indexed _itemID,
      address indexed _submitter,
      uint indexed _evidenceGroupID,
      bytes _data
    );

    /**
     *  @dev Emitted when someone submits a request.
     *  @param _itemID The ID of the affected item.
     *  @param _requestIndex The index of the latest request.
     *  @param _requestType Whether it is a registration or a removal request.
     */
    event RequestSubmitted(
      bytes32 indexed _itemID,
      uint indexed _requestIndex,
      Status indexed _requestType
    );

    /**
     *  @dev Emitted when someone submits a request. This is useful to quickly find an item and request from an evidence event and vice-versa.
     *  @param _itemID The ID of the affected item.
     *  @param _requestIndex The index of the latest request.
     *  @param _evidenceGroupID The evidence group ID used for this request.
     */
    event RequestEvidenceGroupID(
      bytes32 indexed _itemID,
      uint indexed _requestIndex,
      uint indexed _evidenceGroupID
    );

    /**
     *  @dev Emitted when a party contributes to an appeal.
     *  @param _itemID The ID of the item.
     *  @param _contributor The address making the contribution.
     *  @param _request The index of the request.
     *  @param _round The index of the round receiving the contribution.
     *  @param _amount The amount of the contribution.
     *  @param _side The party receiving the contribution.
     */
    event AppealContribution(
        bytes32 indexed _itemID,
        address indexed _contributor,
        uint indexed _request,
        uint _round,
        uint _amount,
        Party _side
    );

    /** @dev Emitted when one of the parties successfully paid its appeal fees.
     *  @param _itemID The ID of the item.
     *  @param _request The index of the request.
     *  @param _round The index of the round.
     *  @param _side The side that is fully funded.
     */
    event HasPaidAppealFee(
      bytes32 indexed _itemID,
      uint indexed _request,
      uint indexed _round,
      Party _side
    );

    /** @dev Emitted when the address of the connected TCR is set. The connected TCR is an instance of the Generalized TCR contract where each item is the address of a TCR related to this one.
     *  @param _connectedTCR The address of the connected TCR.
     */
    event ConnectedTCRSet(address indexed _connectedTCR);

    /**
     *  @dev Deploy the arbitrable curated registry.
     *  @param _arbitrator Arbitrator to resolve potential disputes. The arbitrator is trusted to support appeal periods and not reenter.
     *  @param _arbitratorExtraData Extra data for the trusted arbitrator contract.
     *  @param _connectedTCR The address of the TCR that stores related TCR addresses. This parameter can be left empty.
     *  @param _registrationMetaEvidence The URI of the meta evidence object for registration requests.
     *  @param _clearingMetaEvidence The URI of the meta evidence object for clearing requests.
     *  @param _governor The trusted governor of this contract.
     *  @param _submissionBaseDeposit The base deposit to submit an item.
     *  @param _removalBaseDeposit The base deposit to remove an item.
     *  @param _submissionChallengeBaseDeposit The base deposit to challenge a submission.
     *  @param _removalChallengeBaseDeposit The base deposit to challenge a removal request.
     *  @param _challengePeriodDuration The time in seconds parties have to challenge a request.
     *  @param _stakeMultipliers Multipliers of the arbitration cost in basis points (see MULTIPLIER_DIVISOR) as follows:
     *  - The multiplier applied to each party's fee stake for a round when there is no winner/loser in the previous round (e.g. when the arbitrator refused to arbitrate).
     *  - The multiplier applied to the winner's fee stake for the subsequent round.
     *  - The multiplier applied to the loser's fee stake for the subsequent round.
     */
    constructor(
        IArbitrator _arbitrator,
        bytes memory _arbitratorExtraData,
        address _connectedTCR,
        string memory _registrationMetaEvidence,
        string memory _clearingMetaEvidence,
        address _governor,
        uint _submissionBaseDeposit,
        uint _removalBaseDeposit,
        uint _submissionChallengeBaseDeposit,
        uint _removalChallengeBaseDeposit,
        uint _challengePeriodDuration,
        uint[3] memory _stakeMultipliers
    ) public {
        emit MetaEvidence(0, _registrationMetaEvidence);
        emit MetaEvidence(1, _clearingMetaEvidence);
        emit ConnectedTCRSet(_connectedTCR);

        arbitrator = _arbitrator;
        arbitratorExtraData = _arbitratorExtraData;
        governor = _governor;
        submissionBaseDeposit = _submissionBaseDeposit;
        removalBaseDeposit = _removalBaseDeposit;
        submissionChallengeBaseDeposit = _submissionChallengeBaseDeposit;
        removalChallengeBaseDeposit = _removalChallengeBaseDeposit;
        challengePeriodDuration = _challengePeriodDuration;
        sharedStakeMultiplier = _stakeMultipliers[0];
        winnerStakeMultiplier = _stakeMultipliers[1];
        loserStakeMultiplier = _stakeMultipliers[2];
    }

    /* External and Public */

    // ************************ //
    // *       Requests       * //
    // ************************ //

    /** @dev Submit a request to register an item. Accepts enough ETH to cover the deposit, reimburses the rest.
     *  @param _item The data describing the item.
     */
    function addItem(bytes calldata _item) external payable {
        bytes32 itemID = keccak256(_item);
        require(items[itemID].status == Status.Absent, "Item must be absent to be added.");
        requestStatusChange(_item, submissionBaseDeposit);
    }

    /** @dev Submit a request to remove an item from the list. Accepts enough ETH to cover the deposit, reimburses the rest.
     *  @param _itemID The ID of the item to remove.
     *  @param _evidence A link to an evidence using its URI. Ignored if not provided.
     */
    function removeItem(bytes32 _itemID,  string calldata _evidence) external payable {
        require(items[_itemID].status == Status.Registered, "Item must be registered to be removed.");
        Item storage item = items[_itemID];

        // Emit evidence if it was provided.
        if (bytes(_evidence).length > 0) {
            // Using `length` instead of `length - 1` because a new request will be added on requestStatusChange().
            uint requestIndex = item.requests.length;
            uint evidenceGroupID = uint(keccak256(abi.encodePacked(_itemID, requestIndex)));

            emit Evidence(arbitrator, evidenceGroupID, msg.sender, _evidence);
        }

        requestStatusChange(item.data, removalBaseDeposit);
    }

    /** @dev Challenges the request of the item. Accepts enough ETH to cover the deposit, reimburses the rest.
     *  @param _itemID The ID of the item which request to challenge.
     *  @param _evidence A link to an evidence using its URI. Ignored if not provided.
     */
    function challengeRequest(bytes32 _itemID, string calldata _evidence) external payable {
        Item storage item = items[_itemID];

        require(
            item.status == Status.RegistrationRequested || item.status == Status.ClearingRequested,
            "The item must have a pending request."
        );

        Request storage request = item.requests[item.requests.length - 1];
        require(now - request.submissionTime <= challengePeriodDuration, "Challenges must occur during the challenge period.");
        require(!request.disputed, "The request should not have already been disputed.");

        request.parties[uint(Party.Challenger)] = msg.sender;

        Round storage round = request.rounds[0];
        uint arbitrationCost = request.arbitrator.arbitrationCost(request.arbitratorExtraData);
        uint challengerBaseDeposit = item.status == Status.RegistrationRequested
            ? submissionChallengeBaseDeposit
            : removalChallengeBaseDeposit;
        uint totalCost = arbitrationCost.addCap(challengerBaseDeposit);
        contribute(round, Party.Challenger, msg.sender, msg.value, totalCost);
        require(round.amountPaid[uint(Party.Challenger)] >= totalCost, "You must fully fund your side.");
        round.hasPaid[uint(Party.Challenger)] = true;

        // Raise a dispute.
        request.disputeID = request.arbitrator.createDispute.value(arbitrationCost)(RULING_OPTIONS, request.arbitratorExtraData);
        arbitratorDisputeIDToItem[address(request.arbitrator)][request.disputeID] = _itemID;
        request.disputed = true;
        request.rounds.length++;
        round.feeRewards = round.feeRewards.subCap(arbitrationCost);

        uint evidenceGroupID = uint(keccak256(abi.encodePacked(_itemID, item.requests.length - 1)));
        emit Dispute(
            request.arbitrator,
            request.disputeID,
            request.metaEvidenceID,
            evidenceGroupID
        );

        if (bytes(_evidence).length > 0) {
            emit Evidence(request.arbitrator, evidenceGroupID, msg.sender, _evidence);
        }
    }

    /** @dev Takes up to the total amount required to fund a side of an appeal. Reimburses the rest. Creates an appeal if both sides are fully funded.
     *  @param _itemID The ID of the item which request to fund.
     *  @param _side The recipient of the contribution.
     */
    function fundAppeal(bytes32 _itemID, Party _side) external payable {
        require(_side == Party.Requester || _side == Party.Challenger, "Invalid side.");
        require(
            items[_itemID].status == Status.RegistrationRequested || items[_itemID].status == Status.ClearingRequested,
            "The item must have a pending request."
        );
        Request storage request = items[_itemID].requests[items[_itemID].requests.length - 1];
        require(request.disputed, "A dispute must have been raised to fund an appeal.");
        (uint appealPeriodStart, uint appealPeriodEnd) = request.arbitrator.appealPeriod(request.disputeID);
        require(
            now >= appealPeriodStart && now < appealPeriodEnd,
            "Contributions must be made within the appeal period."
        );

        /* solium-disable indentation */
        uint multiplier;
        {
            Party winner = Party(request.arbitrator.currentRuling(request.disputeID));
            Party loser;
            if (winner == Party.Requester)
                loser = Party.Challenger;
            else if (winner == Party.Challenger)
                loser = Party.Requester;
            require(_side != loser || (now-appealPeriodStart < (appealPeriodEnd-appealPeriodStart)/2), "The loser must contribute during the first half of the appeal period.");


            if (_side == winner)
                multiplier = winnerStakeMultiplier;
            else if (_side == loser)
                multiplier = loserStakeMultiplier;
            else
                multiplier = sharedStakeMultiplier;
        }
        /* solium-enable indentation */

        Round storage round = request.rounds[request.rounds.length - 1];
        uint appealCost = request.arbitrator.appealCost(request.disputeID, request.arbitratorExtraData);
        uint totalCost = appealCost.addCap((appealCost.mulCap(multiplier)) / MULTIPLIER_DIVISOR);
        uint contribution = contribute(round, _side, msg.sender, msg.value, totalCost);

        emit AppealContribution(
            _itemID,
            msg.sender,
            items[_itemID].requests.length - 1,
            request.rounds.length - 1,
            contribution,
            _side
        );

        if (round.amountPaid[uint(_side)] >= totalCost) {
            round.hasPaid[uint(_side)] = true;
            emit HasPaidAppealFee(_itemID, items[_itemID].requests.length - 1, request.rounds.length - 1, _side);
        }

        // Raise appeal if both sides are fully funded.
        if (round.hasPaid[uint(Party.Challenger)] && round.hasPaid[uint(Party.Requester)]) {
            request.arbitrator.appeal.value(appealCost)(request.disputeID, request.arbitratorExtraData);
            request.rounds.length++;
            round.feeRewards = round.feeRewards.subCap(appealCost);
        }
    }

    /** @dev Reimburses contributions if no disputes were raised. If a dispute was raised, sends the fee stake rewards and reimbursements proportionally to the contributions made to the winner of a dispute.
     *  @param _beneficiary The address that made contributions to a request.
     *  @param _itemID The ID of the item submission to withdraw from.
     *  @param _request The request from which to withdraw from.
     *  @param _round The round from which to withdraw from.
     */
    function withdrawFeesAndRewards(address payable _beneficiary, bytes32 _itemID, uint _request, uint _round) public {
        Item storage item = items[_itemID];
        Request storage request = item.requests[_request];
        Round storage round = request.rounds[_round];
        require(request.resolved, "Request must be resolved.");

        uint reward;
        if (!round.hasPaid[uint(Party.Requester)] || !round.hasPaid[uint(Party.Challenger)]) {
            // Reimburse if not enough fees were raised to appeal the ruling.
            reward = round.contributions[_beneficiary][uint(Party.Requester)] + round.contributions[_beneficiary][uint(Party.Challenger)];
        } else if (request.ruling == Party.None) {
            // Reimburse unspent fees proportionally if there is no winner or loser.
            uint rewardRequester = round.amountPaid[uint(Party.Requester)] > 0
                ? (round.contributions[_beneficiary][uint(Party.Requester)] * round.feeRewards) / (round.amountPaid[uint(Party.Challenger)] + round.amountPaid[uint(Party.Requester)])
                : 0;
            uint rewardChallenger = round.amountPaid[uint(Party.Challenger)] > 0
                ? (round.contributions[_beneficiary][uint(Party.Challenger)] * round.feeRewards) / (round.amountPaid[uint(Party.Challenger)] + round.amountPaid[uint(Party.Requester)])
                : 0;

            reward = rewardRequester + rewardChallenger;
        } else {
            // Reward the winner.
            reward = round.amountPaid[uint(request.ruling)] > 0
                ? (round.contributions[_beneficiary][uint(request.ruling)] * round.feeRewards) / round.amountPaid[uint(request.ruling)]
                : 0;

        }
        round.contributions[_beneficiary][uint(Party.Requester)] = 0;
        round.contributions[_beneficiary][uint(Party.Challenger)] = 0;

        _beneficiary.send(reward);
    }

    /** @dev Executes an unchallenged request if the challenge period has passed.
     *  @param _itemID The ID of the item to execute.
     */
    function executeRequest(bytes32 _itemID) external {
        Item storage item = items[_itemID];
        Request storage request = item.requests[item.requests.length - 1];
        require(
            now - request.submissionTime > challengePeriodDuration,
            "Time to challenge the request must pass."
        );
        require(!request.disputed, "The request should not be disputed.");

        if (item.status == Status.RegistrationRequested)
            item.status = Status.Registered;
        else if (item.status == Status.ClearingRequested)
            item.status = Status.Absent;
        else
            revert("There must be a request.");

        request.resolved = true;
        emit ItemStatusChange(_itemID, item.requests.length - 1, request.rounds.length - 1, false, true);

        withdrawFeesAndRewards(request.parties[uint(Party.Requester)], _itemID, item.requests.length - 1, 0); // Automatically withdraw for the requester.
    }

    /** @dev Give a ruling for a dispute. Can only be called by the arbitrator. TRUSTED.
     *  Accounts for the situation where the winner loses a case due to paying less appeal fees than expected.
     *  @param _disputeID ID of the dispute in the arbitrator contract.
     *  @param _ruling Ruling given by the arbitrator. Note that 0 is reserved for "Refused to arbitrate".
     */
    function rule(uint _disputeID, uint _ruling) public {
        Party resultRuling = Party(_ruling);
        bytes32 itemID = arbitratorDisputeIDToItem[msg.sender][_disputeID];
        Item storage item = items[itemID];

        Request storage request = item.requests[item.requests.length - 1];
        Round storage round = request.rounds[request.rounds.length - 1];
        require(_ruling <= RULING_OPTIONS, "Invalid ruling option");
        require(address(request.arbitrator) == msg.sender, "Only the arbitrator can give a ruling");
        require(!request.resolved, "The request must not be resolved.");

        // The ruling is inverted if the loser paid its fees.
        if (round.hasPaid[uint(Party.Requester)] == true) // If one side paid its fees, the ruling is in its favor. Note that if the other side had also paid, an appeal would have been created.
            resultRuling = Party.Requester;
        else if (round.hasPaid[uint(Party.Challenger)] == true)
            resultRuling = Party.Challenger;

        emit Ruling(IArbitrator(msg.sender), _disputeID, uint(resultRuling));
        executeRuling(_disputeID, uint(resultRuling));
    }

    /** @dev Submit a reference to evidence. EVENT.
     *  @param _itemID The ID of the item which the evidence is related to.
     *  @param _evidence A link to an evidence using its URI.
     */
    function submitEvidence(bytes32 _itemID, string calldata _evidence) external {
        Item storage item = items[_itemID];
        Request storage request = item.requests[item.requests.length - 1];
        require(!request.resolved, "The dispute must not already be resolved.");

        uint evidenceGroupID = uint(keccak256(abi.encodePacked(_itemID, item.requests.length - 1)));
        emit Evidence(request.arbitrator, evidenceGroupID, msg.sender, _evidence);
    }

    // ************************ //
    // *      Governance      * //
    // ************************ //

    /** @dev Change the duration of the challenge period.
     *  @param _challengePeriodDuration The new duration of the challenge period.
     */
    function changeTimeToChallenge(uint _challengePeriodDuration) external onlyGovernor {
        challengePeriodDuration = _challengePeriodDuration;
    }

    /** @dev Change the base amount required as a deposit to submit an item.
     *  @param _submissionBaseDeposit The new base amount of wei required to submit an item.
     */
    function changeSubmissionBaseDeposit(uint _submissionBaseDeposit) external onlyGovernor {
        submissionBaseDeposit = _submissionBaseDeposit;
    }

    /** @dev Change the base amount required as a deposit to remove an item.
     *  @param _removalBaseDeposit The new base amount of wei required to remove an item.
     */
    function changeRemovalBaseDeposit(uint _removalBaseDeposit) external onlyGovernor {
        removalBaseDeposit = _removalBaseDeposit;
    }

    /** @dev Change the base amount required as a deposit to challenge a submission.
     *  @param _submissionChallengeBaseDeposit The new base amount of wei required to challenge a submission.
     */
    function changeSubmissionChallengeBaseDeposit(uint _submissionChallengeBaseDeposit) external onlyGovernor {
        submissionChallengeBaseDeposit = _submissionChallengeBaseDeposit;
    }

    /** @dev Change the base amount required as a deposit to challenge a removal request.
     *  @param _removalChallengeBaseDeposit The new base amount of wei required to challenge a removal request.
     */
    function changeRemovalChallengeBaseDeposit(uint _removalChallengeBaseDeposit) external onlyGovernor {
        removalChallengeBaseDeposit = _removalChallengeBaseDeposit;
    }

    /** @dev Change the governor of the curated registry.
     *  @param _governor The address of the new governor.
     */
    function changeGovernor(address _governor) external onlyGovernor {
        governor = _governor;
    }

    /** @dev Change the proportion of arbitration fees that must be paid as fee stake by parties when there is no winner or loser.
     *  @param _sharedStakeMultiplier Multiplier of arbitration fees that must be paid as fee stake. In basis points.
     */
    function changeSharedStakeMultiplier(uint _sharedStakeMultiplier) external onlyGovernor {
        sharedStakeMultiplier = _sharedStakeMultiplier;
    }

    /** @dev Change the proportion of arbitration fees that must be paid as fee stake by the winner of the previous round.
     *  @param _winnerStakeMultiplier Multiplier of arbitration fees that must be paid as fee stake. In basis points.
     */
    function changeWinnerStakeMultiplier(uint _winnerStakeMultiplier) external onlyGovernor {
        winnerStakeMultiplier = _winnerStakeMultiplier;
    }

    /** @dev Change the proportion of arbitration fees that must be paid as fee stake by the party that lost the previous round.
     *  @param _loserStakeMultiplier Multiplier of arbitration fees that must be paid as fee stake. In basis points.
     */
    function changeLoserStakeMultiplier(uint _loserStakeMultiplier) external onlyGovernor {
        loserStakeMultiplier = _loserStakeMultiplier;
    }

    /** @dev Change the arbitrator to be used for disputes that may be raised. The arbitrator is trusted to support appeal periods and not reenter.
     *  @param _arbitrator The new trusted arbitrator to be used in disputes.
     *  @param _arbitratorExtraData The extra data used by the new arbitrator.
     */
    function changeArbitrator(IArbitrator _arbitrator, bytes calldata _arbitratorExtraData) external onlyGovernor {
        arbitrator = _arbitrator;
        arbitratorExtraData = _arbitratorExtraData;
    }

    /** @dev Change the address of connectedTCR, the Generalized TCR instance that stores addresses of TCRs related to this one.
     *  @param _connectedTCR The address of the connectedTCR contract to use.
     */
    function changeConnectedTCR(address _connectedTCR) external onlyGovernor {
        emit ConnectedTCRSet(_connectedTCR);
    }

    /** @dev Update the meta evidence used for disputes.
     *  @param _registrationMetaEvidence The meta evidence to be used for future registration request disputes.
     *  @param _clearingMetaEvidence The meta evidence to be used for future clearing request disputes.
     */
    function changeMetaEvidence(string calldata _registrationMetaEvidence, string calldata _clearingMetaEvidence) external onlyGovernor {
        metaEvidenceUpdates++;
        emit MetaEvidence(2 * metaEvidenceUpdates, _registrationMetaEvidence);
        emit MetaEvidence(2 * metaEvidenceUpdates + 1, _clearingMetaEvidence);
    }

    /* Internal */

    /** @dev Submit a request to change item's status. Accepts enough ETH to cover the deposit, reimburses the rest.
     *  @param _item The data describing the item.
     *  @param _baseDeposit The base deposit for the request.
     */
    function requestStatusChange(bytes memory _item, uint _baseDeposit) internal {
        bytes32 itemID = keccak256(_item);
        Item storage item = items[itemID];

        // Using `length` instead of `length - 1` as index because a new request will be added.
        uint evidenceGroupID = uint(keccak256(abi.encodePacked(itemID, item.requests.length)));
        if (item.requests.length == 0) {
            item.data = _item;
            itemList.push(itemID);
            itemIDtoIndex[itemID] = itemList.length - 1;

            emit ItemSubmitted(itemID, msg.sender, evidenceGroupID, item.data);
        }

        Request storage request = item.requests[item.requests.length++];
        if (item.status == Status.Absent) {
            item.status = Status.RegistrationRequested;
            request.metaEvidenceID = 2 * metaEvidenceUpdates;
        } else if (item.status == Status.Registered) {
            item.status = Status.ClearingRequested;
            request.metaEvidenceID = 2 * metaEvidenceUpdates + 1;
        }

        request.parties[uint(Party.Requester)] = msg.sender;
        request.submissionTime = now;
        request.arbitrator = arbitrator;
        request.arbitratorExtraData = arbitratorExtraData;

        Round storage round = request.rounds[request.rounds.length++];

        uint arbitrationCost = request.arbitrator.arbitrationCost(request.arbitratorExtraData);
        uint totalCost = arbitrationCost.addCap(_baseDeposit);
        contribute(round, Party.Requester, msg.sender, msg.value, totalCost);
        require(round.amountPaid[uint(Party.Requester)] >= totalCost, "You must fully fund your side.");
        round.hasPaid[uint(Party.Requester)] = true;

        emit ItemStatusChange(itemID, item.requests.length - 1, request.rounds.length - 1, false, false);
        emit RequestSubmitted(itemID, item.requests.length - 1, item.status);
        emit RequestEvidenceGroupID(itemID, item.requests.length - 1, evidenceGroupID);
    }

    /** @dev Returns the contribution value and remainder from available ETH and required amount.
     *  @param _available The amount of ETH available for the contribution.
     *  @param _requiredAmount The amount of ETH required for the contribution.
     *  @return taken The amount of ETH taken.
     *  @return remainder The amount of ETH left from the contribution.
     */
    function calculateContribution(uint _available, uint _requiredAmount)
        internal
        pure
        returns(uint taken, uint remainder)
    {
        if (_requiredAmount > _available)
            return (_available, 0); // Take whatever is available, return 0 as leftover ETH.
        else
            return (_requiredAmount, _available - _requiredAmount);
    }

    /** @dev Make a fee contribution.
     *  @param _round The round to contribute.
     *  @param _side The side for which to contribute.
     *  @param _contributor The contributor.
     *  @param _amount The amount contributed.
     *  @param _totalRequired The total amount required for this side.
     *  @return The amount of appeal fees contributed.
     */
    function contribute(Round storage _round, Party _side, address payable _contributor, uint _amount, uint _totalRequired) internal returns (uint) {
        // Take up to the amount necessary to fund the current round at the current costs.
        uint contribution; // Amount contributed.
        uint remainingETH; // Remaining ETH to send back.
        (contribution, remainingETH) = calculateContribution(_amount, _totalRequired.subCap(_round.amountPaid[uint(_side)]));
        _round.contributions[_contributor][uint(_side)] += contribution;
        _round.amountPaid[uint(_side)] += contribution;
        _round.feeRewards += contribution;

        // Reimburse leftover ETH.
        _contributor.send(remainingETH); // Deliberate use of send in order to not block the contract in case of reverting fallback.

        return contribution;
    }

    /** @dev Execute the ruling of a dispute.
     *  @param _disputeID ID of the dispute in the arbitrator contract.
     *  @param _ruling Ruling given by the arbitrator. Note that 0 is reserved for "Refused to arbitrate".
     */
    function executeRuling(uint _disputeID, uint _ruling) internal {
        bytes32 itemID = arbitratorDisputeIDToItem[msg.sender][_disputeID];
        Item storage item = items[itemID];
        Request storage request = item.requests[item.requests.length - 1];

        Party winner = Party(_ruling);

        if (winner == Party.Requester) { // Execute Request.
            if (item.status == Status.RegistrationRequested)
                item.status = Status.Registered;
            else if (item.status == Status.ClearingRequested)
                item.status = Status.Absent;
        } else {
            if (item.status == Status.RegistrationRequested)
                item.status = Status.Absent;
            else if (item.status == Status.ClearingRequested)
                item.status = Status.Registered;
        }

        request.resolved = true;
        request.ruling = Party(_ruling);

        emit ItemStatusChange(itemID, item.requests.length - 1, request.rounds.length - 1, true, true);

        // Automatically withdraw first deposits and reimbursements (first round only).
        if (winner == Party.None) {
            withdrawFeesAndRewards(request.parties[uint(Party.Requester)], itemID, item.requests.length - 1, 0);
            withdrawFeesAndRewards(request.parties[uint(Party.Challenger)], itemID, item.requests.length - 1, 0);
        } else {
            withdrawFeesAndRewards(request.parties[uint(winner)], itemID, item.requests.length - 1, 0);
        }
    }

    // ************************ //
    // *       Getters        * //
    // ************************ //

    /** @dev Returns the number of items that were submitted. Includes items that never made it to the list or were later removed.
     *  @return count The number of items on the list.
     */
    function itemCount() external view returns (uint count) {
        return itemList.length;
    }

    /** @dev Gets the contributions made by a party for a given round of a request.
     *  @param _itemID The ID of the item.
     *  @param _request The request to query.
     *  @param _round The round to query.
     *  @param _contributor The address of the contributor.
     *  @return contributions The contributions.
     */
    function getContributions(
        bytes32 _itemID,
        uint _request,
        uint _round,
        address _contributor
    ) external view returns(uint[3] memory contributions) {
        Item storage item = items[_itemID];
        Request storage request = item.requests[_request];
        Round storage round = request.rounds[_round];
        contributions = round.contributions[_contributor];
    }

    /** @dev Returns item's information. Includes length of requests array.
     *  @param _itemID The ID of the queried item.
     *  @return data The data describing the item.
     *  @return status The current status of the item.
     *  @return numberOfRequests Length of list of status change requests made for the item.
     */
    function getItemInfo(bytes32 _itemID)
        external
        view
        returns (
            bytes memory data,
            Status status,
            uint numberOfRequests
        )
    {
        Item storage item = items[_itemID];
        return (
            item.data,
            item.status,
            item.requests.length
        );
    }

    /** @dev Gets information on a request made for the item.
     *  @param _itemID The ID of the queried item.
     *  @param _request The request to be queried.
     *  @return disputed True if a dispute was raised.
     *  @return disputeID ID of the dispute, if any..
     *  @return submissionTime Time when the request was made.
     *  @return resolved True if the request was executed and/or any raised disputes were resolved.
     *  @return parties Address of requester and challenger, if any.
     *  @return numberOfRounds Number of rounds of dispute.
     *  @return ruling The final ruling given, if any.
     *  @return arbitrator The arbitrator trusted to solve disputes for this request.
     *  @return arbitratorExtraData The extra data for the trusted arbitrator of this request.
     *  @return metaEvidenceID The meta evidence to be used in a dispute for this case.
     */
    function getRequestInfo(bytes32 _itemID, uint _request)
        external
        view
        returns (
            bool disputed,
            uint disputeID,
            uint submissionTime,
            bool resolved,
            address payable[3] memory parties,
            uint numberOfRounds,
            Party ruling,
            IArbitrator arbitrator,
            bytes memory arbitratorExtraData,
            uint metaEvidenceID
        )
    {
        Request storage request = items[_itemID].requests[_request];
        return (
            request.disputed,
            request.disputeID,
            request.submissionTime,
            request.resolved,
            request.parties,
            request.rounds.length,
            request.ruling,
            request.arbitrator,
            request.arbitratorExtraData,
            request.metaEvidenceID
        );
    }

    /** @dev Gets the information of a round of a request.
     *  @param _itemID The ID of the queried item.
     *  @param _request The request to be queried.
     *  @param _round The round to be queried.
     *  @return appealed Whether appealed or not.
     *  @return amountPaid Tracks the sum paid for each Party in this round.
     *  @return hasPaid True if the Party has fully paid its fee in this round.
     *  @return feeRewards Sum of reimbursable fees and stake rewards available to the parties that made contributions to the side that ultimately wins a dispute.
     */
    function getRoundInfo(bytes32 _itemID, uint _request, uint _round)
        external
        view
        returns (
            bool appealed,
            uint[3] memory amountPaid,
            bool[3] memory hasPaid,
            uint feeRewards
        )
    {
        Item storage item = items[_itemID];
        Request storage request = item.requests[_request];
        Round storage round = request.rounds[_round];
        return (
            _round != (request.rounds.length - 1),
            round.amountPaid,
            round.hasPaid,
            round.feeRewards
        );
    }
}

Read Contract

MULTIPLIER_DIVISOR 0xd661dd31 → uint256
arbitrator 0x6cc6cde1 → address
arbitratorDisputeIDToItem 0x8a0d1e61 → bytes32
arbitratorExtraData 0x0c7ac7b6 → bytes
challengePeriodDuration 0x0082a36d → uint256
getContributions 0x52bc0e60 → uint256[3]
getItemInfo 0x4aac84e5 → bytes, uint8, uint256
getRequestInfo 0xbfbcff1a → bool, uint256, uint256, bool, address[3], uint256, uint8, address, bytes, uint256
getRoundInfo 0x974121b2 → bool, uint256[3], bool[3], uint256
governor 0x0c340a24 → address
itemCount 0x6bfb0d01 → uint256
itemIDtoIndex 0x98eeadf0 → uint256
itemList 0x3d4d3600 → bytes32
items 0x48f343f3 → bytes, uint8
loserStakeMultiplier 0x1d512085 → uint256
metaEvidenceUpdates 0x6cdc090f → uint256
removalBaseDeposit 0xc2f2beea → uint256
removalChallengeBaseDeposit 0x787471a9 → uint256
sharedStakeMultiplier 0x41658341 → uint256
submissionBaseDeposit 0xbb0b86ff → uint256
submissionChallengeBaseDeposit 0xa37b6ad4 → uint256
winnerStakeMultiplier 0x7b943383 → uint256

Write Contract 20 functions

These functions modify contract state and require a wallet transaction to execute.

addItem 0xd294ccef
bytes _item
challengeRequest 0x873db1a7
bytes32 _itemID
string _evidence
changeArbitrator 0xba7079ca
address _arbitrator
bytes _arbitratorExtraData
changeConnectedTCR 0xb4d79539
address _connectedTCR
changeGovernor 0xe4c0aaf4
address _governor
changeLoserStakeMultiplier 0x92239dff
uint256 _loserStakeMultiplier
changeMetaEvidence 0xd706be31
string _registrationMetaEvidence
string _clearingMetaEvidence
changeRemovalBaseDeposit 0x8c88c149
uint256 _removalBaseDeposit
changeRemovalChallengeBaseDeposit 0xdd78cb59
uint256 _removalChallengeBaseDeposit
changeSharedStakeMultiplier 0x12ce3525
uint256 _sharedStakeMultiplier
changeSubmissionBaseDeposit 0x33e5d047
uint256 _submissionBaseDeposit
changeSubmissionChallengeBaseDeposit 0xc104817d
uint256 _submissionChallengeBaseDeposit
changeTimeToChallenge 0xd36fdb18
uint256 _challengePeriodDuration
changeWinnerStakeMultiplier 0xadc7faba
uint256 _winnerStakeMultiplier
executeRequest 0xe9c24166
bytes32 _itemID
fundAppeal 0x2baf80ee
bytes32 _itemID
uint8 _side
removeItem 0x97e90e50
bytes32 _itemID
string _evidence
rule 0x311a6c56
uint256 _disputeID
uint256 _ruling
submitEvidence 0xf48a0b31
bytes32 _itemID
string _evidence
withdrawFeesAndRewards 0xa1c2bf4d
address _beneficiary
bytes32 _itemID
uint256 _request
uint256 _round

Recent Transactions

This address has 1 on-chain transactions, but only 0.7% of the chain is indexed. Transactions will appear as indexing progresses. View on Etherscan →