From 21ea151e422d12ff3b2c307875daea744aa29dc2 Mon Sep 17 00:00:00 2001 From: lorbke Date: Sat, 16 Nov 2024 22:58:53 +0700 Subject: [PATCH] redeploy with additional (untested) getter functions --- .../Deploy.s.sol/480/run-1731772700.json | 58 +++ .../Deploy.s.sol/480/run-latest.json | 36 +- packages/foundry/contracts/HumanOracle.sol | 33 ++ .../foundry/contractsToVerify/ByteHasher.sol | 12 + .../foundry/contractsToVerify/HumanOracle.sol | 348 ++++++++++++++++++ .../foundry/contractsToVerify/IWorldID.sol | 21 ++ .../src/contracts/deployedContracts.ts | 64 +++- .../nextjs/contracts/deployedContracts.ts | 64 +++- 8 files changed, 616 insertions(+), 20 deletions(-) create mode 100644 packages/foundry/broadcast/Deploy.s.sol/480/run-1731772700.json create mode 100644 packages/foundry/contractsToVerify/ByteHasher.sol create mode 100644 packages/foundry/contractsToVerify/HumanOracle.sol create mode 100644 packages/foundry/contractsToVerify/IWorldID.sol diff --git a/packages/foundry/broadcast/Deploy.s.sol/480/run-1731772700.json b/packages/foundry/broadcast/Deploy.s.sol/480/run-1731772700.json new file mode 100644 index 0000000..36191eb --- /dev/null +++ b/packages/foundry/broadcast/Deploy.s.sol/480/run-1731772700.json @@ -0,0 +1,58 @@ +{ + "transactions": [ + { + "hash": "0x91c345819408c9191d1357caa37c007fbc833bbcadb4803fa9091975d27c0d71", + "transactionType": "CREATE", + "contractName": "HumanOracle", + "contractAddress": "0x0bb141ef91dec0d190aa01b6d6d9d840cc3d04cc", + "function": null, + "arguments": [ + "0x17B354dD2595411ff79041f930e491A4Df39A278", + "1", + "app_485be80eb191bba1e603c1aeb6743660", + "registration" + ], + "transaction": { + "from": "0x4639b9f663c14bad89ddcc16966e85bc81dccd40", + "gas": "0x1eb230", + "value": "0x0", + "input": "0x60c0604052600160805234801561001557600080fd5b50604051611cf5380380611cf583398101604081905261003491610199565b600080546001600160a01b0319166001600160a01b0386161790556080839052604051610094906100829061006d90859060200161022b565b60408051601f198184030181529190526100a1565b8260405160200161006d929190610247565b60a0525061026d92505050565b60006008826040516020016100b6919061022b565b60408051601f198184030181529190528051602090910120901c92915050565b634e487b7160e01b600052604160045260246000fd5b60005b838110156101075781810151838201526020016100ef565b50506000910152565b600082601f83011261012157600080fd5b81516001600160401b0381111561013a5761013a6100d6565b604051601f8201601f19908116603f011681016001600160401b0381118282101715610168576101686100d6565b60405281815283820160200185101561018057600080fd5b6101918260208301602087016100ec565b949350505050565b600080600080608085870312156101af57600080fd5b84516001600160a01b03811681146101c657600080fd5b6020860151604087015191955093506001600160401b038111156101e957600080fd5b6101f587828801610110565b606087015190935090506001600160401b0381111561021357600080fd5b61021f87828801610110565b91505092959194509250565b6000825161023d8184602087016100ec565b9190910192915050565b8281526000825161025f8160208501602087016100ec565b919091016020019392505050565b60805160a051611a636102926000396000610611015260006105d30152611a636000f3fe608060405234801561001057600080fd5b50600436106100cf5760003560e01c8063aa607a941161008c578063d270a03311610066578063d270a0331461020e578063e6b7c0e514610221578063efef28bb14610234578063f6e2c2291461024757600080fd5b8063aa607a94146101d3578063b7420702146101e8578063c8382a33146101fb57600080fd5b80630bfb7059146100d4578063163f7522146100f4578063753e9ef01461011757806391e40730146101425780639c1f819814610174578063a87430ba14610197575b600080fd5b6100dc61025a565b6040516100eb939291906113f5565b60405180910390f35b61010761010236600461144f565b6103d8565b60405190151581526020016100eb565b60005461012a906001600160a01b031681565b6040516001600160a01b0390911681526020016100eb565b61016661015036600461146a565b6001602081905260009182526040909120015481565b6040519081526020016100eb565b61018761018236600461146a565b61040b565b6040516100eb9493929190611483565b6101be6101a536600461144f565b6002602052600090815260409020805460019091015482565b604080519283526020830191909152016100eb565b6101e66101e13660046114cd565b6104de565b005b6101666101f636600461146a565b610712565b61010761020936600461146a565b6107fa565b61010761021c36600461146a565b610814565b6101e661022f36600461150c565b61085e565b6101e6610242366004611583565b610afe565b610107610255366004611632565b610cef565b6060806060600061026a60035490565b9050806001600160401b038111156102845761028461165c565b6040519080825280602002602001820160405280156102ad578160200160208202803683370190505b509350806001600160401b038111156102c8576102c861165c565b6040519080825280602002602001820160405280156102fb57816020015b60608152602001906001900390816102e65790505b509250806001600160401b038111156103165761031661165c565b60405190808252806020026020018201604052801561033f578160200160208202803683370190505b50915060005b818110156103d1578085828151811061036057610360611672565b60200260200101818152505061037581610d1f565b84828151811061038757610387611672565b60200260200101819052506103ac816000908152600160208190526040909120015490565b8382815181106103be576103be611672565b6020908102919091010152600101610345565b5050909192565b6001600160a01b038116600090815260026020526040812054156103fe57506001919050565b506000919050565b919050565b60608060006060600061042a8660009081526001602052604090205490565b6000878152600160208190526040909120015493509050806001600160401b038111156104595761045961165c565b604051908082528060200260200182016040528015610482578160200160208202803683370190505b50915060005b818110156104bf5761049a8782610dd5565b8382815181106104ac576104ac611672565b6020908102919091010152600101610488565b506104c986610d1f565b6104d287610e0f565b94509450509193509193565b33600090815260026020526040902054156105395760405162461bcd60e51b815260206004820152601660248201527507573657220616c7265616479207369676e65642075760541b60448201526064015b60405180910390fd5b600082815260046020526040902054339060ff16151560010361059e5760405162461bcd60e51b815260206004820152601e60248201527f6e756c6c69666965724861736820616c7265616479206578697374696e6700006044820152606401610530565b6000546040516bffffffffffffffffffffffff19606084901b1660208201526001600160a01b0390911690633bc778e39086907f00000000000000000000000000000000000000000000000000000000000000009061060e90603401604051602081830303815290604052610f0c565b877f0000000000000000000000000000000000000000000000000000000000000000886040518763ffffffff1660e01b815260040161065296959493929190611688565b60006040518083038186803b15801561066a57600080fd5b505afa15801561067e573d6000803e3d6000fd5b5050506000848152600460209081526040808320805460ff1916600190811790915581518083018352888152438185019081526001600160a01b038816808752600286529584902082518082559151930183905583519081529384019190915293507f47c8e83729a89f8b0c23b722e4c21f48295ddfcd683910c564e11e6b6037d01c910160405180910390a25050505050565b6000814361071f82610f41565b61072883610f6f565b61073291906116d6565b106107735760405162461bcd60e51b8152602060048201526011602482015270766f7465207374696c6c2061637469766560781b6044820152606401610530565b6000838152600160208181526040808420338086526002909101909252909220805460ff1916909117905560006107aa8286610f9d565b905084826001600160a01b03167ff01da32686223933d8a18a391060918c7f11a3648639edd87ae013e2e2731743836040516107e891815260200190565b60405180910390a39250505b50919050565b600061080582611015565b4311156103fe57506001919050565b600081815260016020526040812054339060005b818110156108535761083b838683611033565b1561084b57506001949350505050565b600101610828565b506000949350505050565b8261086881610f6f565b3360009081526002602052604090206001015411156108d55760405162461bcd60e51b815260206004820152602360248201527f7573657220776173206372656174656420616674657220766f74696e6720626560448201526233bab760e91b6064820152608401610530565b3360009081526002602052604081205490036109275760405162461bcd60e51b815260206004820152601160248201527075736572206e6f74206578697374696e6760781b6044820152606401610530565b600084815260016020526040812054859133905b828110156109a2576000610950838684611033565b90508015156001036109995760405162461bcd60e51b81526020600482015260126024820152711d5cd95c88185b1c9958591e481d9bdd195960721b6044820152606401610530565b5060010161093b565b5086436109ae82610f6f565b11156109f35760405162461bcd60e51b81526020600482015260146024820152731d9bdd19481a185cc81b9bdd081cdd185c9d195960621b6044820152606401610530565b436109fd82610f41565b610a0683610f6f565b610a1091906116d6565b1015610a4f5760405162461bcd60e51b815260206004820152600e60248201526d1d9bdd19481a185cc8195b99195960921b6044820152606401610530565b6005861115610aa05760405162461bcd60e51b815260206004820152601760248201527f6d6178207374616b696e6720616d6f756e7420697320350000000000000000006044820152606401610530565b33610aad818a8a8a611094565b60408051898152602081018990528a916001600160a01b038416917f65658daa50ece7e5d9b3c4700c400745f04137171d9d6896eed2f10437013ee7910160405180910390a3505050505050505050565b6003546040805160a08101825282815281516020601f8a0181900481028201810190935288815260009280830191908b908b9081908401838280828437600092019190915250505090825250602001610b578789611719565b81526020808201879052604090910185905260038054600181018255600091909152825160059091027fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b810191825591830151929350839290917fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85c0190610bde9082611884565b5060408201518051610bfa916002840191602090910190611248565b5060608201518160030155608082015181600401555050610c1a8261114d565b60038281548110610c2d57610c2d611672565b9060005260206000209060050201600001547f6912e5abe531ca5f3b6f973f97278ab6731cdec0178a7b3c2c7a5822a3f1732b60038481548110610c7357610c73611672565b906000526020600020906005020160010160038581548110610c9757610c97611672565b90600052602060002090600502016003015460038681548110610cbc57610cbc611672565b906000526020600020906005020160040154604051610cdd93929190611942565b60405180910390a25050505050505050565b60008181526001602090815260408083206001600160a01b038616845260020190915290205460ff165b92915050565b606060038281548110610d3457610d34611672565b90600052602060002090600502016001018054610d5090611801565b80601f0160208091040260200160405190810160405280929190818152602001828054610d7c90611801565b8015610dc95780601f10610d9e57610100808354040283529160200191610dc9565b820191906000526020600020905b815481529060010190602001808311610dac57829003601f168201915b50505050509050919050565b6000828152600160205260408120805483908110610df557610df5611672565b906000526020600020906002020160000154905092915050565b606060038281548110610e2457610e24611672565b9060005260206000209060050201600201805480602002602001604051908101604052809291908181526020016000905b82821015610f01578382906000526020600020018054610e7490611801565b80601f0160208091040260200160405190810160405280929190818152602001828054610ea090611801565b8015610eed5780601f10610ec257610100808354040283529160200191610eed565b820191906000526020600020905b815481529060010190602001808311610ed057829003601f168201915b505050505081526020019060010190610e55565b505050509050919050565b6000600882604051602001610f2191906119d8565b60408051601f198184030181529190528051602090910120901c92915050565b600060038281548110610f5657610f56611672565b9060005260206000209060050201600401549050919050565b600060038281548110610f8457610f84611672565b9060005260206000209060050201600301549050919050565b600080610fa9836111aa565b9050610fb6848483611033565b610fc4576000915050610d19565b6000610fd18585846111f6565b600085815260016020819052604082200154919250610ff08685610dd5565b9050600083610fff83856119f4565b6110099190611a16565b98975050505050505050565b600061102082610f41565b61102983610f6f565b610d1991906116d6565b600082815260016020526040812080548390811061105357611053611672565b600091825260208083206001600160a01b038816845260016002909302019190910190526040902054156110895750600161108d565b5060005b9392505050565b60008381526001602052604090208054829190849081106110b7576110b7611672565b600091825260208083206001600160a01b038916845260016002909302018201815260408084209490945586835252208054829190849081106110fc576110fc611672565b9060005260206000209060020201600001600082825461111c91906116d6565b9091555050600083815260016020819052604082200180548392906111429084906116d6565b909155505050505050565b6000818152600160205260408120600380549192918490811061117257611172611672565b6000918252602082206002600590920201015491505b818110156111a457825460019081018455600084905201611188565b50505050565b60008181526001602052604081205460008060005b838110156111ed5760006111d38783610dd5565b9050808410156111e4578093508192505b506001016111bf565b50949350505050565b600082815260016020526040812080548390811061121657611216611672565b600091825260208083206001600160a01b03881684526001600290930201919091019052604090205490509392505050565b82805482825590600052602060002090810192821561128e579160200282015b8281111561128e578251829061127e9082611884565b5091602001919060010190611268565b5061129a92915061129e565b5090565b8082111561129a5760006112b282826112bb565b5060010161129e565b5080546112c790611801565b6000825580601f106112d7575050565b601f0160209004906000526020600020908101906112f591906112f8565b50565b5b8082111561129a57600081556001016112f9565b600081518084526020840193506020830160005b8281101561133f578151865260209586019590910190600101611321565b5093949350505050565b60005b8381101561136457818101518382015260200161134c565b50506000910152565b60008151808452611385816020860160208601611349565b601f01601f19169290920160200192915050565b600082825180855260208501945060208160051b8301016020850160005b838110156113e957601f198584030188526113d383835161136d565b60209889019890935091909101906001016113b7565b50909695505050505050565b606081526000611408606083018661130d565b828103602084015261141a8186611399565b9050828103604084015261142e818561130d565b9695505050505050565b80356001600160a01b038116811461040657600080fd5b60006020828403121561146157600080fd5b61108d82611438565b60006020828403121561147c57600080fd5b5035919050565b608081526000611496608083018761136d565b82810360208401526114a88187611399565b905084604084015282810360608401526114c2818561130d565b979650505050505050565b600080600061014084860312156114e357600080fd5b833592506020840135915061014084018510156114ff57600080fd5b6040840190509250925092565b60008060006060848603121561152157600080fd5b505081359360208301359350604090920135919050565b60008083601f84011261154a57600080fd5b5081356001600160401b0381111561156157600080fd5b6020830191508360208260051b850101111561157c57600080fd5b9250929050565b6000806000806000806080878903121561159c57600080fd5b86356001600160401b038111156115b257600080fd5b8701601f810189136115c357600080fd5b80356001600160401b038111156115d957600080fd5b8960208284010111156115eb57600080fd5b6020918201975095508701356001600160401b0381111561160b57600080fd5b61161789828a01611538565b979a9699509760408101359660609091013595509350505050565b6000806040838503121561164557600080fd5b61164e83611438565b946020939093013593505050565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b60006101a0820190508782528660208301528560408301528460608301528360808301526101008360a0840137979650505050505050565b634e487b7160e01b600052601160045260246000fd5b80820180821115610d1957610d196116c0565b604051601f8201601f191681016001600160401b03811182821017156117115761171161165c565b604052919050565b60006001600160401b038311156117325761173261165c565b8260051b611742602082016116e9565b8481529083019060208101903683111561175b57600080fd5b845b838110156117f75780356001600160401b0381111561177b57600080fd5b860136601f82011261178c57600080fd5b80356001600160401b038111156117a5576117a561165c565b6117b8601f8201601f19166020016116e9565b8181523660208385010111156117cd57600080fd5b8160208401602083013760006020838301015280865250505060208301925060208101905061175d565b5095945050505050565b600181811c9082168061181557607f821691505b6020821081036107f457634e487b7160e01b600052602260045260246000fd5b601f82111561187f57806000526020600020601f840160051c8101602085101561185c5750805b601f840160051c820191505b8181101561187c5760008155600101611868565b50505b505050565b81516001600160401b0381111561189d5761189d61165c565b6118b1816118ab8454611801565b84611835565b6020601f8211600181146118e557600083156118cd5750848201515b600019600385901b1c1916600184901b17845561187c565b600084815260208120601f198516915b8281101561191557878501518255602094850194600190920191016118f5565b50848210156119335786840151600019600387901b60f8161c191681555b50505050600190811b01905550565b60608152600080855461195481611801565b8060608601526001821660008114611973576001811461198f576119c3565b60ff1983166080870152608082151560051b87010193506119c3565b88600052602060002060005b838110156119ba5781548882016080015260019091019060200161199b565b87016080019450505b50505060208301949094525060400152919050565b600082516119ea818460208701611349565b9190910192915050565b600082611a1157634e487b7160e01b600052601260045260246000fd5b500490565b8082028115828204841417610d1957610d196116c056fea2646970667358221220934be5fbbd5c6b0b433721036287b075ebc00e87bdd7b0b1ba095294a2f63ea264736f6c634300081c003300000000000000000000000017b354dd2595411ff79041f930e491a4df39a2780000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000246170705f343835626538306562313931626261316536303363316165623637343336363000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c726567697374726174696f6e0000000000000000000000000000000000000000", + "nonce": "0xf", + "chainId": "0x1e0" + }, + "additionalContracts": [], + "isFixedGasLimit": false + } + ], + "receipts": [ + { + "status": "0x1", + "cumulativeGasUsed": "0x1f653c", + "logs": [], + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "type": "0x0", + "transactionHash": "0x91c345819408c9191d1357caa37c007fbc833bbcadb4803fa9091975d27c0d71", + "transactionIndex": "0x2", + "blockHash": "0xadcfbb2939fc5ada20ee3ade45e224af9c1df1b0f37f248b82c9c672caa79699", + "blockNumber": "0x5ee322", + "gasUsed": "0x179ea5", + "effectiveGasPrice": "0xf433c", + "blobGasUsed": "0x0", + "from": "0x4639b9f663c14bad89ddcc16966e85bc81dccd40", + "to": null, + "contractAddress": "0x0bb141ef91dec0d190aa01b6d6d9d840cc3d04cc", + "l1BaseFeeScalar": "0x21f9", + "l1BlobBaseFee": "0x384cf5f4e", + "l1BlobBaseFeeScalar": "0xc5f4f", + "l1Fee": "0x3b67b11a71c3", + "l1GasPrice": "0x427ec6729", + "l1GasUsed": "0x114fd" + } + ], + "libraries": [], + "pending": [], + "returns": {}, + "timestamp": 1731772700, + "chain": 480, + "commit": "6fb4f13" +} \ No newline at end of file diff --git a/packages/foundry/broadcast/Deploy.s.sol/480/run-latest.json b/packages/foundry/broadcast/Deploy.s.sol/480/run-latest.json index 643e01d..36191eb 100644 --- a/packages/foundry/broadcast/Deploy.s.sol/480/run-latest.json +++ b/packages/foundry/broadcast/Deploy.s.sol/480/run-latest.json @@ -1,10 +1,10 @@ { "transactions": [ { - "hash": "0x0082633a98a48859e13227617ed038c3f26cc25749d52889d78886d6e766e52b", + "hash": "0x91c345819408c9191d1357caa37c007fbc833bbcadb4803fa9091975d27c0d71", "transactionType": "CREATE", "contractName": "HumanOracle", - "contractAddress": "0xd458ac0643add160a344b94b2dd165e6acb3bed5", + "contractAddress": "0x0bb141ef91dec0d190aa01b6d6d9d840cc3d04cc", "function": null, "arguments": [ "0x17B354dD2595411ff79041f930e491A4Df39A278", @@ -14,10 +14,10 @@ ], "transaction": { "from": "0x4639b9f663c14bad89ddcc16966e85bc81dccd40", - "gas": "0x1d101d", + "gas": "0x1eb230", "value": "0x0", - "input": "0x60c0604052600160805234801561001557600080fd5b50604051611b78380380611b7883398101604081905261003491610199565b600080546001600160a01b0319166001600160a01b0386161790556080839052604051610094906100829061006d90859060200161022b565b60408051601f198184030181529190526100a1565b8260405160200161006d929190610247565b60a0525061026d92505050565b60006008826040516020016100b6919061022b565b60408051601f198184030181529190528051602090910120901c92915050565b634e487b7160e01b600052604160045260246000fd5b60005b838110156101075781810151838201526020016100ef565b50506000910152565b600082601f83011261012157600080fd5b81516001600160401b0381111561013a5761013a6100d6565b604051601f8201601f19908116603f011681016001600160401b0381118282101715610168576101686100d6565b60405281815283820160200185101561018057600080fd5b6101918260208301602087016100ec565b949350505050565b600080600080608085870312156101af57600080fd5b84516001600160a01b03811681146101c657600080fd5b6020860151604087015191955093506001600160401b038111156101e957600080fd5b6101f587828801610110565b606087015190935090506001600160401b0381111561021357600080fd5b61021f87828801610110565b91505092959194509250565b6000825161023d8184602087016100ec565b9190910192915050565b8281526000825161025f8160208501602087016100ec565b919091016020019392505050565b60805160a0516118e661029260003960006105a20152600061056401526118e66000f3fe608060405234801561001057600080fd5b506004361061009e5760003560e01c8063a87430ba11610066578063a87430ba14610166578063aa607a94146101a2578063b7420702146101b7578063e6b7c0e5146101ca578063efef28bb146101dd57600080fd5b80630bfb7059146100a3578063163f7522146100c3578063753e9ef0146100e657806391e40730146101115780639c1f819814610143575b600080fd5b6100ab6101f0565b6040516100ba939291906112ab565b60405180910390f35b6100d66100d13660046112ee565b61036e565b60405190151581526020016100ba565b6000546100f9906001600160a01b031681565b6040516001600160a01b0390911681526020016100ba565b61013561011f366004611317565b6001602081905260009182526040909120015481565b6040519081526020016100ba565b610156610151366004611317565b61039c565b6040516100ba9493929190611330565b61018d6101743660046112ee565b6002602052600090815260409020805460019091015482565b604080519283526020830191909152016100ba565b6101b56101b036600461137a565b61046f565b005b6101356101c5366004611317565b6106a3565b6101b56101d83660046113b9565b610761565b6101b56101eb366004611430565b610a01565b6060806060600061020060035490565b9050806001600160401b0381111561021a5761021a6114df565b604051908082528060200260200182016040528015610243578160200160208202803683370190505b509350806001600160401b0381111561025e5761025e6114df565b60405190808252806020026020018201604052801561029157816020015b606081526020019060019003908161027c5790505b509250806001600160401b038111156102ac576102ac6114df565b6040519080825280602002602001820160405280156102d5578160200160208202803683370190505b50915060005b8181101561036757808582815181106102f6576102f66114f5565b60200260200101818152505061030b81610bf2565b84828151811061031d5761031d6114f5565b6020026020010181905250610342816000908152600160208190526040909120015490565b838281518110610354576103546114f5565b60209081029190910101526001016102db565b5050909192565b6001600160a01b0381166000908152600260205260408120541561039457506001919050565b506000919050565b6060806000606060006103bb8660009081526001602052604090205490565b6000878152600160208190526040909120015493509050806001600160401b038111156103ea576103ea6114df565b604051908082528060200260200182016040528015610413578160200160208202803683370190505b50915060005b818110156104505761042b8782610ca8565b83828151811061043d5761043d6114f5565b6020908102919091010152600101610419565b5061045a86610bf2565b61046387610ce3565b94509450509193509193565b33600090815260026020526040902054156104ca5760405162461bcd60e51b815260206004820152601660248201527507573657220616c7265616479207369676e65642075760541b60448201526064015b60405180910390fd5b600082815260046020526040902054339060ff16151560010361052f5760405162461bcd60e51b815260206004820152601e60248201527f6e756c6c69666965724861736820616c7265616479206578697374696e67000060448201526064016104c1565b6000546040516bffffffffffffffffffffffff19606084901b1660208201526001600160a01b0390911690633bc778e39086907f00000000000000000000000000000000000000000000000000000000000000009061059f90603401604051602081830303815290604052610de0565b877f0000000000000000000000000000000000000000000000000000000000000000886040518763ffffffff1660e01b81526004016105e39695949392919061150b565b60006040518083038186803b1580156105fb57600080fd5b505afa15801561060f573d6000803e3d6000fd5b5050506000848152600460209081526040808320805460ff1916600190811790915581518083018352888152438185019081526001600160a01b038816808752600286529584902082518082559151930183905583519081529384019190915293507f47c8e83729a89f8b0c23b722e4c21f48295ddfcd683910c564e11e6b6037d01c910160405180910390a25050505050565b600081436106b082610e15565b6106b983610e43565b6106c39190611559565b106107045760405162461bcd60e51b8152602060048201526011602482015270766f7465207374696c6c2061637469766560781b60448201526064016104c1565b3360006107118286610e71565b905084826001600160a01b03167ff01da32686223933d8a18a391060918c7f11a3648639edd87ae013e2e27317438360405161074f91815260200190565b60405180910390a39250505b50919050565b8261076b81610e43565b3360009081526002602052604090206001015411156107d85760405162461bcd60e51b815260206004820152602360248201527f7573657220776173206372656174656420616674657220766f74696e6720626560448201526233bab760e91b60648201526084016104c1565b33600090815260026020526040812054900361082a5760405162461bcd60e51b815260206004820152601160248201527075736572206e6f74206578697374696e6760781b60448201526064016104c1565b600084815260016020526040812054859133905b828110156108a5576000610853838684610ee9565b905080151560010361089c5760405162461bcd60e51b81526020600482015260126024820152711d5cd95c88185b1c9958591e481d9bdd195960721b60448201526064016104c1565b5060010161083e565b5086436108b182610e43565b11156108f65760405162461bcd60e51b81526020600482015260146024820152731d9bdd19481a185cc81b9bdd081cdd185c9d195960621b60448201526064016104c1565b4361090082610e15565b61090983610e43565b6109139190611559565b10156109525760405162461bcd60e51b815260206004820152600e60248201526d1d9bdd19481a185cc8195b99195960921b60448201526064016104c1565b60058611156109a35760405162461bcd60e51b815260206004820152601760248201527f6d6178207374616b696e6720616d6f756e74206973203500000000000000000060448201526064016104c1565b336109b0818a8a8a610f4a565b60408051898152602081018990528a916001600160a01b038416917f65658daa50ece7e5d9b3c4700c400745f04137171d9d6896eed2f10437013ee7910160405180910390a3505050505050505050565b6003546040805160a08101825282815281516020601f8a0181900481028201810190935288815260009280830191908b908b9081908401838280828437600092019190915250505090825250602001610a5a878961159c565b81526020808201879052604090910185905260038054600181018255600091909152825160059091027fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b810191825591830151929350839290917fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85c0190610ae19082611707565b5060408201518051610afd9160028401916020909101906110fe565b5060608201518160030155608082015181600401555050610b1d82611003565b60038281548110610b3057610b306114f5565b9060005260206000209060050201600001547f6912e5abe531ca5f3b6f973f97278ab6731cdec0178a7b3c2c7a5822a3f1732b60038481548110610b7657610b766114f5565b906000526020600020906005020160010160038581548110610b9a57610b9a6114f5565b90600052602060002090600502016003015460038681548110610bbf57610bbf6114f5565b906000526020600020906005020160040154604051610be0939291906117c5565b60405180910390a25050505050505050565b606060038281548110610c0757610c076114f5565b90600052602060002090600502016001018054610c2390611684565b80601f0160208091040260200160405190810160405280929190818152602001828054610c4f90611684565b8015610c9c5780601f10610c7157610100808354040283529160200191610c9c565b820191906000526020600020905b815481529060010190602001808311610c7f57829003601f168201915b50505050509050919050565b6000828152600160205260408120805483908110610cc857610cc86114f5565b90600052602060002090600202016000015490505b92915050565b606060038281548110610cf857610cf86114f5565b9060005260206000209060050201600201805480602002602001604051908101604052809291908181526020016000905b82821015610dd5578382906000526020600020018054610d4890611684565b80601f0160208091040260200160405190810160405280929190818152602001828054610d7490611684565b8015610dc15780601f10610d9657610100808354040283529160200191610dc1565b820191906000526020600020905b815481529060010190602001808311610da457829003601f168201915b505050505081526020019060010190610d29565b505050509050919050565b6000600882604051602001610df5919061185b565b60408051601f198184030181529190528051602090910120901c92915050565b600060038281548110610e2a57610e2a6114f5565b9060005260206000209060050201600401549050919050565b600060038281548110610e5857610e586114f5565b9060005260206000209060050201600301549050919050565b600080610e7d83611060565b9050610e8a848483610ee9565b610e98576000915050610cdd565b6000610ea58585846110ac565b600085815260016020819052604082200154919250610ec48685610ca8565b9050600083610ed38385611877565b610edd9190611899565b98975050505050505050565b6000828152600160205260408120805483908110610f0957610f096114f5565b600091825260208083206001600160a01b03881684526001600290930201919091019052604090205415610f3f57506001610f43565b5060005b9392505050565b6000838152600160205260409020805482919084908110610f6d57610f6d6114f5565b600091825260208083206001600160a01b03891684526001600290930201820181526040808420949094558683525220805482919084908110610fb257610fb26114f5565b90600052602060002090600202016000016000828254610fd29190611559565b909155505060008381526001602081905260408220018054839290610ff8908490611559565b909155505050505050565b60008181526001602052604081206003805491929184908110611028576110286114f5565b6000918252602082206002600590920201015491505b8181101561105a5782546001908101845560008490520161103e565b50505050565b60008181526001602052604081205460008060005b838110156110a35760006110898783610ca8565b90508084101561109a578093508192505b50600101611075565b50949350505050565b60008281526001602052604081208054839081106110cc576110cc6114f5565b600091825260208083206001600160a01b03881684526001600290930201919091019052604090205490509392505050565b828054828255906000526020600020908101928215611144579160200282015b8281111561114457825182906111349082611707565b509160200191906001019061111e565b50611150929150611154565b5090565b808211156111505760006111688282611171565b50600101611154565b50805461117d90611684565b6000825580601f1061118d575050565b601f0160209004906000526020600020908101906111ab91906111ae565b50565b5b8082111561115057600081556001016111af565b600081518084526020840193506020830160005b828110156111f55781518652602095860195909101906001016111d7565b5093949350505050565b60005b8381101561121a578181015183820152602001611202565b50506000910152565b6000815180845261123b8160208601602086016111ff565b601f01601f19169290920160200192915050565b600082825180855260208501945060208160051b8301016020850160005b8381101561129f57601f19858403018852611289838351611223565b602098890198909350919091019060010161126d565b50909695505050505050565b6060815260006112be60608301866111c3565b82810360208401526112d0818661124f565b905082810360408401526112e481856111c3565b9695505050505050565b60006020828403121561130057600080fd5b81356001600160a01b0381168114610f4357600080fd5b60006020828403121561132957600080fd5b5035919050565b6080815260006113436080830187611223565b8281036020840152611355818761124f565b9050846040840152828103606084015261136f81856111c3565b979650505050505050565b6000806000610140848603121561139057600080fd5b833592506020840135915061014084018510156113ac57600080fd5b6040840190509250925092565b6000806000606084860312156113ce57600080fd5b505081359360208301359350604090920135919050565b60008083601f8401126113f757600080fd5b5081356001600160401b0381111561140e57600080fd5b6020830191508360208260051b850101111561142957600080fd5b9250929050565b6000806000806000806080878903121561144957600080fd5b86356001600160401b0381111561145f57600080fd5b8701601f8101891361147057600080fd5b80356001600160401b0381111561148657600080fd5b89602082840101111561149857600080fd5b6020918201975095508701356001600160401b038111156114b857600080fd5b6114c489828a016113e5565b979a9699509760408101359660609091013595509350505050565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b60006101a0820190508782528660208301528560408301528460608301528360808301526101008360a0840137979650505050505050565b634e487b7160e01b600052601160045260246000fd5b80820180821115610cdd57610cdd611543565b604051601f8201601f191681016001600160401b0381118282101715611594576115946114df565b604052919050565b60006001600160401b038311156115b5576115b56114df565b8260051b6115c56020820161156c565b848152908301906020810190368311156115de57600080fd5b845b8381101561167a5780356001600160401b038111156115fe57600080fd5b860136601f82011261160f57600080fd5b80356001600160401b03811115611628576116286114df565b61163b601f8201601f191660200161156c565b81815236602083850101111561165057600080fd5b816020840160208301376000602083830101528086525050506020830192506020810190506115e0565b5095945050505050565b600181811c9082168061169857607f821691505b60208210810361075b57634e487b7160e01b600052602260045260246000fd5b601f82111561170257806000526020600020601f840160051c810160208510156116df5750805b601f840160051c820191505b818110156116ff57600081556001016116eb565b50505b505050565b81516001600160401b03811115611720576117206114df565b6117348161172e8454611684565b846116b8565b6020601f82116001811461176857600083156117505750848201515b600019600385901b1c1916600184901b1784556116ff565b600084815260208120601f198516915b828110156117985787850151825560209485019460019092019101611778565b50848210156117b65786840151600019600387901b60f8161c191681555b50505050600190811b01905550565b6060815260008085546117d781611684565b80606086015260018216600081146117f6576001811461181257611846565b60ff1983166080870152608082151560051b8701019350611846565b88600052602060002060005b8381101561183d5781548882016080015260019091019060200161181e565b87016080019450505b50505060208301949094525060400152919050565b6000825161186d8184602087016111ff565b9190910192915050565b60008261189457634e487b7160e01b600052601260045260246000fd5b500490565b8082028115828204841417610cdd57610cdd61154356fea2646970667358221220c4bfe9e7d7f5d5c42b8974ce69eb4c813a3330bc89527737a1f784bf380d9b5c64736f6c634300081c003300000000000000000000000017b354dd2595411ff79041f930e491a4df39a2780000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000246170705f343835626538306562313931626261316536303363316165623637343336363000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c726567697374726174696f6e0000000000000000000000000000000000000000", - "nonce": "0xb", + "input": "0x60c0604052600160805234801561001557600080fd5b50604051611cf5380380611cf583398101604081905261003491610199565b600080546001600160a01b0319166001600160a01b0386161790556080839052604051610094906100829061006d90859060200161022b565b60408051601f198184030181529190526100a1565b8260405160200161006d929190610247565b60a0525061026d92505050565b60006008826040516020016100b6919061022b565b60408051601f198184030181529190528051602090910120901c92915050565b634e487b7160e01b600052604160045260246000fd5b60005b838110156101075781810151838201526020016100ef565b50506000910152565b600082601f83011261012157600080fd5b81516001600160401b0381111561013a5761013a6100d6565b604051601f8201601f19908116603f011681016001600160401b0381118282101715610168576101686100d6565b60405281815283820160200185101561018057600080fd5b6101918260208301602087016100ec565b949350505050565b600080600080608085870312156101af57600080fd5b84516001600160a01b03811681146101c657600080fd5b6020860151604087015191955093506001600160401b038111156101e957600080fd5b6101f587828801610110565b606087015190935090506001600160401b0381111561021357600080fd5b61021f87828801610110565b91505092959194509250565b6000825161023d8184602087016100ec565b9190910192915050565b8281526000825161025f8160208501602087016100ec565b919091016020019392505050565b60805160a051611a636102926000396000610611015260006105d30152611a636000f3fe608060405234801561001057600080fd5b50600436106100cf5760003560e01c8063aa607a941161008c578063d270a03311610066578063d270a0331461020e578063e6b7c0e514610221578063efef28bb14610234578063f6e2c2291461024757600080fd5b8063aa607a94146101d3578063b7420702146101e8578063c8382a33146101fb57600080fd5b80630bfb7059146100d4578063163f7522146100f4578063753e9ef01461011757806391e40730146101425780639c1f819814610174578063a87430ba14610197575b600080fd5b6100dc61025a565b6040516100eb939291906113f5565b60405180910390f35b61010761010236600461144f565b6103d8565b60405190151581526020016100eb565b60005461012a906001600160a01b031681565b6040516001600160a01b0390911681526020016100eb565b61016661015036600461146a565b6001602081905260009182526040909120015481565b6040519081526020016100eb565b61018761018236600461146a565b61040b565b6040516100eb9493929190611483565b6101be6101a536600461144f565b6002602052600090815260409020805460019091015482565b604080519283526020830191909152016100eb565b6101e66101e13660046114cd565b6104de565b005b6101666101f636600461146a565b610712565b61010761020936600461146a565b6107fa565b61010761021c36600461146a565b610814565b6101e661022f36600461150c565b61085e565b6101e6610242366004611583565b610afe565b610107610255366004611632565b610cef565b6060806060600061026a60035490565b9050806001600160401b038111156102845761028461165c565b6040519080825280602002602001820160405280156102ad578160200160208202803683370190505b509350806001600160401b038111156102c8576102c861165c565b6040519080825280602002602001820160405280156102fb57816020015b60608152602001906001900390816102e65790505b509250806001600160401b038111156103165761031661165c565b60405190808252806020026020018201604052801561033f578160200160208202803683370190505b50915060005b818110156103d1578085828151811061036057610360611672565b60200260200101818152505061037581610d1f565b84828151811061038757610387611672565b60200260200101819052506103ac816000908152600160208190526040909120015490565b8382815181106103be576103be611672565b6020908102919091010152600101610345565b5050909192565b6001600160a01b038116600090815260026020526040812054156103fe57506001919050565b506000919050565b919050565b60608060006060600061042a8660009081526001602052604090205490565b6000878152600160208190526040909120015493509050806001600160401b038111156104595761045961165c565b604051908082528060200260200182016040528015610482578160200160208202803683370190505b50915060005b818110156104bf5761049a8782610dd5565b8382815181106104ac576104ac611672565b6020908102919091010152600101610488565b506104c986610d1f565b6104d287610e0f565b94509450509193509193565b33600090815260026020526040902054156105395760405162461bcd60e51b815260206004820152601660248201527507573657220616c7265616479207369676e65642075760541b60448201526064015b60405180910390fd5b600082815260046020526040902054339060ff16151560010361059e5760405162461bcd60e51b815260206004820152601e60248201527f6e756c6c69666965724861736820616c7265616479206578697374696e6700006044820152606401610530565b6000546040516bffffffffffffffffffffffff19606084901b1660208201526001600160a01b0390911690633bc778e39086907f00000000000000000000000000000000000000000000000000000000000000009061060e90603401604051602081830303815290604052610f0c565b877f0000000000000000000000000000000000000000000000000000000000000000886040518763ffffffff1660e01b815260040161065296959493929190611688565b60006040518083038186803b15801561066a57600080fd5b505afa15801561067e573d6000803e3d6000fd5b5050506000848152600460209081526040808320805460ff1916600190811790915581518083018352888152438185019081526001600160a01b038816808752600286529584902082518082559151930183905583519081529384019190915293507f47c8e83729a89f8b0c23b722e4c21f48295ddfcd683910c564e11e6b6037d01c910160405180910390a25050505050565b6000814361071f82610f41565b61072883610f6f565b61073291906116d6565b106107735760405162461bcd60e51b8152602060048201526011602482015270766f7465207374696c6c2061637469766560781b6044820152606401610530565b6000838152600160208181526040808420338086526002909101909252909220805460ff1916909117905560006107aa8286610f9d565b905084826001600160a01b03167ff01da32686223933d8a18a391060918c7f11a3648639edd87ae013e2e2731743836040516107e891815260200190565b60405180910390a39250505b50919050565b600061080582611015565b4311156103fe57506001919050565b600081815260016020526040812054339060005b818110156108535761083b838683611033565b1561084b57506001949350505050565b600101610828565b506000949350505050565b8261086881610f6f565b3360009081526002602052604090206001015411156108d55760405162461bcd60e51b815260206004820152602360248201527f7573657220776173206372656174656420616674657220766f74696e6720626560448201526233bab760e91b6064820152608401610530565b3360009081526002602052604081205490036109275760405162461bcd60e51b815260206004820152601160248201527075736572206e6f74206578697374696e6760781b6044820152606401610530565b600084815260016020526040812054859133905b828110156109a2576000610950838684611033565b90508015156001036109995760405162461bcd60e51b81526020600482015260126024820152711d5cd95c88185b1c9958591e481d9bdd195960721b6044820152606401610530565b5060010161093b565b5086436109ae82610f6f565b11156109f35760405162461bcd60e51b81526020600482015260146024820152731d9bdd19481a185cc81b9bdd081cdd185c9d195960621b6044820152606401610530565b436109fd82610f41565b610a0683610f6f565b610a1091906116d6565b1015610a4f5760405162461bcd60e51b815260206004820152600e60248201526d1d9bdd19481a185cc8195b99195960921b6044820152606401610530565b6005861115610aa05760405162461bcd60e51b815260206004820152601760248201527f6d6178207374616b696e6720616d6f756e7420697320350000000000000000006044820152606401610530565b33610aad818a8a8a611094565b60408051898152602081018990528a916001600160a01b038416917f65658daa50ece7e5d9b3c4700c400745f04137171d9d6896eed2f10437013ee7910160405180910390a3505050505050505050565b6003546040805160a08101825282815281516020601f8a0181900481028201810190935288815260009280830191908b908b9081908401838280828437600092019190915250505090825250602001610b578789611719565b81526020808201879052604090910185905260038054600181018255600091909152825160059091027fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b810191825591830151929350839290917fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85c0190610bde9082611884565b5060408201518051610bfa916002840191602090910190611248565b5060608201518160030155608082015181600401555050610c1a8261114d565b60038281548110610c2d57610c2d611672565b9060005260206000209060050201600001547f6912e5abe531ca5f3b6f973f97278ab6731cdec0178a7b3c2c7a5822a3f1732b60038481548110610c7357610c73611672565b906000526020600020906005020160010160038581548110610c9757610c97611672565b90600052602060002090600502016003015460038681548110610cbc57610cbc611672565b906000526020600020906005020160040154604051610cdd93929190611942565b60405180910390a25050505050505050565b60008181526001602090815260408083206001600160a01b038616845260020190915290205460ff165b92915050565b606060038281548110610d3457610d34611672565b90600052602060002090600502016001018054610d5090611801565b80601f0160208091040260200160405190810160405280929190818152602001828054610d7c90611801565b8015610dc95780601f10610d9e57610100808354040283529160200191610dc9565b820191906000526020600020905b815481529060010190602001808311610dac57829003601f168201915b50505050509050919050565b6000828152600160205260408120805483908110610df557610df5611672565b906000526020600020906002020160000154905092915050565b606060038281548110610e2457610e24611672565b9060005260206000209060050201600201805480602002602001604051908101604052809291908181526020016000905b82821015610f01578382906000526020600020018054610e7490611801565b80601f0160208091040260200160405190810160405280929190818152602001828054610ea090611801565b8015610eed5780601f10610ec257610100808354040283529160200191610eed565b820191906000526020600020905b815481529060010190602001808311610ed057829003601f168201915b505050505081526020019060010190610e55565b505050509050919050565b6000600882604051602001610f2191906119d8565b60408051601f198184030181529190528051602090910120901c92915050565b600060038281548110610f5657610f56611672565b9060005260206000209060050201600401549050919050565b600060038281548110610f8457610f84611672565b9060005260206000209060050201600301549050919050565b600080610fa9836111aa565b9050610fb6848483611033565b610fc4576000915050610d19565b6000610fd18585846111f6565b600085815260016020819052604082200154919250610ff08685610dd5565b9050600083610fff83856119f4565b6110099190611a16565b98975050505050505050565b600061102082610f41565b61102983610f6f565b610d1991906116d6565b600082815260016020526040812080548390811061105357611053611672565b600091825260208083206001600160a01b038816845260016002909302019190910190526040902054156110895750600161108d565b5060005b9392505050565b60008381526001602052604090208054829190849081106110b7576110b7611672565b600091825260208083206001600160a01b038916845260016002909302018201815260408084209490945586835252208054829190849081106110fc576110fc611672565b9060005260206000209060020201600001600082825461111c91906116d6565b9091555050600083815260016020819052604082200180548392906111429084906116d6565b909155505050505050565b6000818152600160205260408120600380549192918490811061117257611172611672565b6000918252602082206002600590920201015491505b818110156111a457825460019081018455600084905201611188565b50505050565b60008181526001602052604081205460008060005b838110156111ed5760006111d38783610dd5565b9050808410156111e4578093508192505b506001016111bf565b50949350505050565b600082815260016020526040812080548390811061121657611216611672565b600091825260208083206001600160a01b03881684526001600290930201919091019052604090205490509392505050565b82805482825590600052602060002090810192821561128e579160200282015b8281111561128e578251829061127e9082611884565b5091602001919060010190611268565b5061129a92915061129e565b5090565b8082111561129a5760006112b282826112bb565b5060010161129e565b5080546112c790611801565b6000825580601f106112d7575050565b601f0160209004906000526020600020908101906112f591906112f8565b50565b5b8082111561129a57600081556001016112f9565b600081518084526020840193506020830160005b8281101561133f578151865260209586019590910190600101611321565b5093949350505050565b60005b8381101561136457818101518382015260200161134c565b50506000910152565b60008151808452611385816020860160208601611349565b601f01601f19169290920160200192915050565b600082825180855260208501945060208160051b8301016020850160005b838110156113e957601f198584030188526113d383835161136d565b60209889019890935091909101906001016113b7565b50909695505050505050565b606081526000611408606083018661130d565b828103602084015261141a8186611399565b9050828103604084015261142e818561130d565b9695505050505050565b80356001600160a01b038116811461040657600080fd5b60006020828403121561146157600080fd5b61108d82611438565b60006020828403121561147c57600080fd5b5035919050565b608081526000611496608083018761136d565b82810360208401526114a88187611399565b905084604084015282810360608401526114c2818561130d565b979650505050505050565b600080600061014084860312156114e357600080fd5b833592506020840135915061014084018510156114ff57600080fd5b6040840190509250925092565b60008060006060848603121561152157600080fd5b505081359360208301359350604090920135919050565b60008083601f84011261154a57600080fd5b5081356001600160401b0381111561156157600080fd5b6020830191508360208260051b850101111561157c57600080fd5b9250929050565b6000806000806000806080878903121561159c57600080fd5b86356001600160401b038111156115b257600080fd5b8701601f810189136115c357600080fd5b80356001600160401b038111156115d957600080fd5b8960208284010111156115eb57600080fd5b6020918201975095508701356001600160401b0381111561160b57600080fd5b61161789828a01611538565b979a9699509760408101359660609091013595509350505050565b6000806040838503121561164557600080fd5b61164e83611438565b946020939093013593505050565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b60006101a0820190508782528660208301528560408301528460608301528360808301526101008360a0840137979650505050505050565b634e487b7160e01b600052601160045260246000fd5b80820180821115610d1957610d196116c0565b604051601f8201601f191681016001600160401b03811182821017156117115761171161165c565b604052919050565b60006001600160401b038311156117325761173261165c565b8260051b611742602082016116e9565b8481529083019060208101903683111561175b57600080fd5b845b838110156117f75780356001600160401b0381111561177b57600080fd5b860136601f82011261178c57600080fd5b80356001600160401b038111156117a5576117a561165c565b6117b8601f8201601f19166020016116e9565b8181523660208385010111156117cd57600080fd5b8160208401602083013760006020838301015280865250505060208301925060208101905061175d565b5095945050505050565b600181811c9082168061181557607f821691505b6020821081036107f457634e487b7160e01b600052602260045260246000fd5b601f82111561187f57806000526020600020601f840160051c8101602085101561185c5750805b601f840160051c820191505b8181101561187c5760008155600101611868565b50505b505050565b81516001600160401b0381111561189d5761189d61165c565b6118b1816118ab8454611801565b84611835565b6020601f8211600181146118e557600083156118cd5750848201515b600019600385901b1c1916600184901b17845561187c565b600084815260208120601f198516915b8281101561191557878501518255602094850194600190920191016118f5565b50848210156119335786840151600019600387901b60f8161c191681555b50505050600190811b01905550565b60608152600080855461195481611801565b8060608601526001821660008114611973576001811461198f576119c3565b60ff1983166080870152608082151560051b87010193506119c3565b88600052602060002060005b838110156119ba5781548882016080015260019091019060200161199b565b87016080019450505b50505060208301949094525060400152919050565b600082516119ea818460208701611349565b9190910192915050565b600082611a1157634e487b7160e01b600052601260045260246000fd5b500490565b8082028115828204841417610d1957610d196116c056fea2646970667358221220934be5fbbd5c6b0b433721036287b075ebc00e87bdd7b0b1ba095294a2f63ea264736f6c634300081c003300000000000000000000000017b354dd2595411ff79041f930e491a4df39a2780000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000246170705f343835626538306562313931626261316536303363316165623637343336363000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c726567697374726174696f6e0000000000000000000000000000000000000000", + "nonce": "0xf", "chainId": "0x1e0" }, "additionalContracts": [], @@ -27,32 +27,32 @@ "receipts": [ { "status": "0x1", - "cumulativeGasUsed": "0x17bee3", + "cumulativeGasUsed": "0x1f653c", "logs": [], "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", "type": "0x0", - "transactionHash": "0x0082633a98a48859e13227617ed038c3f26cc25749d52889d78886d6e766e52b", + "transactionHash": "0x91c345819408c9191d1357caa37c007fbc833bbcadb4803fa9091975d27c0d71", "transactionIndex": "0x2", - "blockHash": "0x2c856d2da532c0d7dc7882afb0973f508b6f410f2a5b88f95acf390b032c08f7", - "blockNumber": "0x5ed85f", - "gasUsed": "0x165cf4", - "effectiveGasPrice": "0xf433a", + "blockHash": "0xadcfbb2939fc5ada20ee3ade45e224af9c1df1b0f37f248b82c9c672caa79699", + "blockNumber": "0x5ee322", + "gasUsed": "0x179ea5", + "effectiveGasPrice": "0xf433c", "blobGasUsed": "0x0", "from": "0x4639b9f663c14bad89ddcc16966e85bc81dccd40", "to": null, - "contractAddress": "0xd458ac0643add160a344b94b2dd165e6acb3bed5", + "contractAddress": "0x0bb141ef91dec0d190aa01b6d6d9d840cc3d04cc", "l1BaseFeeScalar": "0x21f9", - "l1BlobBaseFee": "0x76b5324b4", + "l1BlobBaseFee": "0x384cf5f4e", "l1BlobBaseFeeScalar": "0xc5f4f", - "l1Fee": "0x6b2312efb8fa", - "l1GasPrice": "0x34c220d7b", - "l1GasUsed": "0x108c1" + "l1Fee": "0x3b67b11a71c3", + "l1GasPrice": "0x427ec6729", + "l1GasUsed": "0x114fd" } ], "libraries": [], "pending": [], "returns": {}, - "timestamp": 1731767191, + "timestamp": 1731772700, "chain": 480, - "commit": "6770434" + "commit": "6fb4f13" } \ No newline at end of file diff --git a/packages/foundry/contracts/HumanOracle.sol b/packages/foundry/contracts/HumanOracle.sol index 720dcb8..fabab7b 100644 --- a/packages/foundry/contracts/HumanOracle.sol +++ b/packages/foundry/contracts/HumanOracle.sol @@ -26,6 +26,7 @@ contract HumanOracle { struct Stake { Option[] answers; uint256 totalStake; + mapping (address => bool) hasUserClaimed; } struct Vote { @@ -159,6 +160,7 @@ contract HumanOracle { function claimRewardForVote(uint256 voteId) voteEnded(voteId) external returns (uint256) { address userAddr = address(msg.sender); + setUserHasClaimedToTrueForVote(userAddr, voteId); uint256 payout = getStakeResolvedUserAmount(userAddr, voteId); emit RewardClaimed(userAddr, voteId, payout); return payout; @@ -224,6 +226,29 @@ contract HumanOracle { return (ids, questions, totalStakes); } + function isVotingOver(uint256 voteId) external view returns (bool) { + if (block.number > getVoteEndBlock(voteId)) { + return true; + } else { + return false; + } + } + + function hasUserVotedForVote(uint256 voteId) external view returns (bool) { + address userAddr = address(msg.sender); + uint256 answerCount = getStakeAnswerCount(voteId); + for (uint i = 0; i < answerCount; i++) { + if (hasUserVotedForStakeAnswer(userAddr, voteId, i)) { + return true; + } + } + return false; + } + + function getUserHasClaimedForVote(address userAddr, uint256 voteId) external view returns (bool) { + return stakesForVoteIds[voteId].hasUserClaimed[userAddr]; + } + // internal // stake related @@ -241,6 +266,10 @@ contract HumanOracle { stakesForVoteIds[voteId].totalStake += amount; } + function setUserHasClaimedToTrueForVote(address userAddr, uint256 voteId) internal { + stakesForVoteIds[voteId].hasUserClaimed[userAddr] = true; + } + function getStakeResolvedUserAmount(address userAddr, uint256 voteId) internal view returns (uint256 amount) { uint256 highestStakeAnswerIndex = getStakeHighestAnswerIndex(voteId); if (!hasUserVotedForStakeAnswer(userAddr, voteId, highestStakeAnswerIndex)) { @@ -312,4 +341,8 @@ contract HumanOracle { function getVoteDurationInBlocks(uint256 voteId) internal view returns (uint256 durationInBlocks) { return votes[voteId].durationInBlocks; } + + function getVoteEndBlock(uint256 voteId) internal view returns (uint256 endBlock) { + return getVoteStartBlock(voteId) + getVoteDurationInBlocks(voteId); + } } \ No newline at end of file diff --git a/packages/foundry/contractsToVerify/ByteHasher.sol b/packages/foundry/contractsToVerify/ByteHasher.sol new file mode 100644 index 0000000..2162ad5 --- /dev/null +++ b/packages/foundry/contractsToVerify/ByteHasher.sol @@ -0,0 +1,12 @@ +// SPDX-License-Identifier: UNLICENSED +pragma solidity ^0.8.28; + +library ByteHasher { + /// @dev Creates a keccak256 hash of a bytestring. + /// @param value The bytestring to hash + /// @return The hash of the specified value + /// @dev `>> 8` makes sure that the result is included in our field + function hashToField(bytes memory value) internal pure returns (uint256) { + return uint256(keccak256(abi.encodePacked(value))) >> 8; + } +} \ No newline at end of file diff --git a/packages/foundry/contractsToVerify/HumanOracle.sol b/packages/foundry/contractsToVerify/HumanOracle.sol new file mode 100644 index 0000000..f2a80ec --- /dev/null +++ b/packages/foundry/contractsToVerify/HumanOracle.sol @@ -0,0 +1,348 @@ +//SPDX-License-Identifier: MIT +pragma solidity ^0.8.28; + +import {IWorldID} from "./IWorldID.sol"; +import {ByteHasher} from "./ByteHasher.sol"; +// import "forge-std/console.sol"; + +contract HumanOracle { + + using ByteHasher for bytes; + + // ==================== + // ====== Structs ===== + // ==================== + + struct User { + uint256 nullifierHash; + uint256 createdAtBlock; + } + + struct Option { + uint256 totalStake; + mapping (address => uint256) userStakes; + } + + struct Stake { + Option[] answers; + uint256 totalStake; + mapping (address => bool) hasUserClaimed; + } + + struct Vote { + uint256 id; + string question; + string[] answers; + uint256 startBlock; + uint256 durationInBlocks; + } + + // ==================== + // ==== Variables ===== + // ==================== + + // public + IWorldID public worldId; + mapping (uint256 => Stake) public stakesForVoteIds; + mapping (address => User) public users; + Vote[] votes; + + // private + mapping (uint256 => bool) private registeredNullifierHashes; + uint256 internal immutable groupId = 1; + uint256 internal immutable externalNullifierHash; + + + // ==================== + // ====== Events ====== + // ==================== + + event UserRegistered(address indexed user, uint256 nullifierHash, uint256 createdAtBlock); + + event VoteCreated(uint256 indexed voteId, string question, uint256 startBlock, uint256 durationInBlocks); + + event VoteSubmitted(address indexed user, uint256 indexed voteId, uint256 answerIndex, uint256 stakeAmount); + + event RewardClaimed(address indexed user, uint256 indexed voteId, uint256 rewardAmount); + + // ==================== + // ==== Modifiers ===== + // ==================== + + modifier onlyNewUser() { + require(users[msg.sender].nullifierHash == uint256(0), "user already signed up"); + _; + } + + modifier hasNotVoted(uint256 voteId) { + uint256 answerCount = getStakeAnswerCount(voteId); + address userAddr = address(msg.sender); + for (uint i = 0; i < answerCount; i++) { + bool hasVoted = hasUserVotedForStakeAnswer(userAddr, voteId, i); + if (hasVoted == true) { + revert("user already voted"); + } + } + _; + } + + modifier voteActive(uint256 voteId) { + require(getVoteStartBlock(voteId) <= block.number, "vote has not started"); + require(getVoteStartBlock(voteId) + getVoteDurationInBlocks(voteId) >= block.number, "vote has ended"); + _; + } + + modifier voteEnded(uint256 voteId) { + require(getVoteStartBlock(voteId) + getVoteDurationInBlocks(voteId) < block.number, "vote still active"); + _; + } + + modifier userExists() { + if (users[address(msg.sender)].nullifierHash == 0) { + revert("user not existing"); + } + _; + } + + modifier userOldEnough(uint256 voteId) { + if (users[address(msg.sender)].createdAtBlock > getVoteStartBlock(voteId)) { + revert("user was created after voting begun"); + } + _; + } + + // ==================== + // === Constructor ==== + // ==================== + + constructor(address _worldIdAddr, uint256 _groupId, string memory _appId, string memory _action) { + worldId = IWorldID(_worldIdAddr); + groupId = _groupId; + externalNullifierHash = abi.encodePacked(abi.encodePacked(_appId).hashToField(), _action).hashToField(); + } + + // ==================== + // ==== Functions ===== + // ==================== + + // external + + function signUpWithWorldId(uint256 merkleRoot, uint256 nullifierHash, uint256[8] calldata proof) onlyNewUser() external { + address userAddr = address(msg.sender); + + if (registeredNullifierHashes[nullifierHash] == true) { + revert ("nullifierHash already existing"); + } + worldId.verifyProof( + merkleRoot, + groupId, + abi.encodePacked(userAddr).hashToField(), + nullifierHash, + externalNullifierHash, + proof + ); + registeredNullifierHashes[nullifierHash] = true; + + User memory newUser = User({ + nullifierHash: nullifierHash, + createdAtBlock: block.number + }); + users[userAddr] = newUser; + emit UserRegistered(userAddr, users[userAddr].nullifierHash, users[userAddr].createdAtBlock); + } + + function submitVotingDecisionWithStake(uint256 voteId, uint256 answerIndex, uint256 amount) userOldEnough(voteId) userExists() hasNotVoted(voteId) voteActive(voteId) external { + require(amount <= 5, "max staking amount is 5"); + address userAddr = address(msg.sender); + stakeForAnswer(userAddr, voteId, answerIndex, amount); + emit VoteSubmitted(userAddr, voteId, answerIndex, amount); + } + + function claimRewardForVote(uint256 voteId) voteEnded(voteId) external returns (uint256) { + address userAddr = address(msg.sender); + setUserHasClaimedToTrueForVote(userAddr, voteId); + uint256 payout = getStakeResolvedUserAmount(userAddr, voteId); + emit RewardClaimed(userAddr, voteId, payout); + return payout; + } + + function isUserRegistered(address userAddr) external view returns (bool) { + if (users[userAddr].nullifierHash != 0) { + return true; + } else { + return false; + } + } + + function createVote(string calldata question, string[] calldata answers, uint256 startBlock, uint256 durationInBlocks) external { + uint256 voteId = votes.length; + Vote memory newVote = Vote({ + id: voteId, + question: question, + answers: answers, + startBlock: startBlock, + durationInBlocks: durationInBlocks + }); + votes.push(newVote); + + createNewStake(voteId); + + emit VoteCreated(votes[voteId].id, votes[voteId].question, votes[voteId].startBlock, votes[voteId].durationInBlocks); + } + + function getVotingPage(uint256 voteId) external view returns ( + string memory question, + string[] memory answers, + uint256 totalStake, + uint256[] memory stakePerAnswer + ) { + uint256 answerCount = getStakeAnswerCount(voteId); + totalStake = getStakeTotalStake(voteId); + stakePerAnswer = new uint256[](answerCount); + + for (uint i = 0; i < answerCount; i++) { + stakePerAnswer[i] = getStakeAnswerStake(voteId, i); + } + + return (getVoteQuestion(voteId), getVoteAnswers(voteId), totalStake, stakePerAnswer); + } + + function getVotingList() external view returns ( + uint256[] memory ids, + string[] memory questions, + uint256[] memory totalStakes + ) { + uint256 voteCount = getVoteCount(); + ids = new uint256[](voteCount); + questions = new string[](voteCount); + totalStakes = new uint256[](voteCount); + + for (uint i = 0; i < voteCount; i++) { + ids[i] = i; + questions[i] = getVoteQuestion(i); + totalStakes[i] = getStakeTotalStake(i); + } + + return (ids, questions, totalStakes); + } + + function isVotingOver(uint256 voteId) external view returns (bool) { + if (block.number > getVoteEndBlock(voteId)) { + return true; + } else { + return false; + } + } + + function hasUserVotedForVote(uint256 voteId) external view returns (bool) { + address userAddr = address(msg.sender); + uint256 answerCount = getStakeAnswerCount(voteId); + for (uint i = 0; i < answerCount; i++) { + if (hasUserVotedForStakeAnswer(userAddr, voteId, i)) { + return true; + } + } + return false; + } + + function getUserHasClaimedForVote(address userAddr, uint256 voteId) external view returns (bool) { + return stakesForVoteIds[voteId].hasUserClaimed[userAddr]; + } + + // internal + + // stake related + function createNewStake(uint256 voteId) internal { + Stake storage newStake = stakesForVoteIds[voteId]; + uint256 answerCount = votes[voteId].answers.length; + for (uint i = 0; i < answerCount; i++) { + newStake.answers.push(); + } + } + + function stakeForAnswer(address userAddr, uint256 voteId, uint256 answerIndex, uint256 amount) internal { + stakesForVoteIds[voteId].answers[answerIndex].userStakes[userAddr] = amount; + stakesForVoteIds[voteId].answers[answerIndex].totalStake += amount; + stakesForVoteIds[voteId].totalStake += amount; + } + + function setUserHasClaimedToTrueForVote(address userAddr, uint256 voteId) internal { + stakesForVoteIds[voteId].hasUserClaimed[userAddr] = true; + } + + function getStakeResolvedUserAmount(address userAddr, uint256 voteId) internal view returns (uint256 amount) { + uint256 highestStakeAnswerIndex = getStakeHighestAnswerIndex(voteId); + if (!hasUserVotedForStakeAnswer(userAddr, voteId, highestStakeAnswerIndex)) { + return 0; + } + uint256 userStake = getUserStakeOfStakeAnswer(userAddr, voteId, highestStakeAnswerIndex); + uint256 totalStake = getStakeTotalStake(voteId); + uint256 answerStake = getStakeAnswerStake(voteId, highestStakeAnswerIndex); + uint256 userPayout = totalStake / answerStake * userStake; + return userPayout; + } + + function getStakeHighestAnswerIndex(uint256 voteId) internal view returns (uint256 answerIndex) { + uint256 answerCount = getStakeAnswerCount(voteId); + uint256 highestAmount = 0; + uint256 highestIndex = 0; + + for (uint i = 0; i < answerCount; i++) { + uint256 answerStake = getStakeAnswerStake(voteId, i); + if (highestAmount < answerStake) { + highestAmount = answerStake; + highestIndex = i; + } + } + return highestIndex; + } + + function getStakeAnswerStake(uint256 voteId, uint256 answerIndex) internal view returns (uint256 stake) { + return stakesForVoteIds[voteId].answers[answerIndex].totalStake; + } + + function getStakeAnswerCount(uint256 voteId) internal view returns (uint256 count) { + return stakesForVoteIds[voteId].answers.length; + } + + function getStakeTotalStake(uint256 voteId) internal view returns (uint256 stake) { + return stakesForVoteIds[voteId].totalStake; + } + + function hasUserVotedForStakeAnswer(address userAddr, uint256 voteId, uint256 answerIndex) internal view returns (bool voted) { + if (stakesForVoteIds[voteId].answers[answerIndex].userStakes[userAddr] != 0) { + return true; + } else { + return false; + } + } + + function getUserStakeOfStakeAnswer(address userAddr, uint256 voteId, uint256 answerIndex) internal view returns (uint256 amount) { + return stakesForVoteIds[voteId].answers[answerIndex].userStakes[userAddr]; + } + + // vote related + function getVoteCount() internal view returns (uint256 count) { + return votes.length; + } + + function getVoteQuestion(uint256 voteId) internal view returns (string memory question) { + return votes[voteId].question; + } + + function getVoteAnswers(uint256 voteId) internal view returns (string[] memory answers) { + return votes[voteId].answers; + } + + function getVoteStartBlock(uint256 voteId) internal view returns (uint256 startBlock) { + return votes[voteId].startBlock; + } + + function getVoteDurationInBlocks(uint256 voteId) internal view returns (uint256 durationInBlocks) { + return votes[voteId].durationInBlocks; + } + + function getVoteEndBlock(uint256 voteId) internal view returns (uint256 endBlock) { + return getVoteStartBlock(voteId) + getVoteDurationInBlocks(voteId); + } +} \ No newline at end of file diff --git a/packages/foundry/contractsToVerify/IWorldID.sol b/packages/foundry/contractsToVerify/IWorldID.sol new file mode 100644 index 0000000..7fe28b9 --- /dev/null +++ b/packages/foundry/contractsToVerify/IWorldID.sol @@ -0,0 +1,21 @@ +//SPDX-License-Identifier: MIT +pragma solidity ^0.8.10; + +interface IWorldID { + /// @notice Reverts if the zero-knowledge proof is invalid. + /// @param root The of the Merkle tree + /// @param groupId The id of the Semaphore group + /// @param signalHash A keccak256 hash of the Semaphore signal + /// @param nullifierHash The nullifier hash + /// @param externalNullifierHash A keccak256 hash of the external nullifier + /// @param proof The zero-knowledge proof + /// @dev Note that a double-signaling check is not included here, and should be carried by the caller. + function verifyProof( + uint256 root, + uint256 groupId, + uint256 signalHash, + uint256 nullifierHash, + uint256 externalNullifierHash, + uint256[8] calldata proof + ) external view; +} diff --git a/packages/nextjs-app/src/contracts/deployedContracts.ts b/packages/nextjs-app/src/contracts/deployedContracts.ts index 87cff2b..46269b0 100644 --- a/packages/nextjs-app/src/contracts/deployedContracts.ts +++ b/packages/nextjs-app/src/contracts/deployedContracts.ts @@ -289,7 +289,7 @@ const deployedContracts = { }, 480: { HumanOracle: { - address: "0xd458ac0643add160a344b94b2dd165e6acb3bed5", + address: "0x0bb141ef91dec0d190aa01b6d6d9d840cc3d04cc", abi: [ { type: "constructor", @@ -364,6 +364,30 @@ const deployedContracts = { outputs: [], stateMutability: "nonpayable", }, + { + type: "function", + name: "getUserHasClaimedForVote", + inputs: [ + { + name: "userAddr", + type: "address", + internalType: "address", + }, + { + name: "voteId", + type: "uint256", + internalType: "uint256", + }, + ], + outputs: [ + { + name: "", + type: "bool", + internalType: "bool", + }, + ], + stateMutability: "view", + }, { type: "function", name: "getVotingList", @@ -421,6 +445,25 @@ const deployedContracts = { ], stateMutability: "view", }, + { + type: "function", + name: "hasUserVotedForVote", + inputs: [ + { + name: "voteId", + type: "uint256", + internalType: "uint256", + }, + ], + outputs: [ + { + name: "", + type: "bool", + internalType: "bool", + }, + ], + stateMutability: "view", + }, { type: "function", name: "isUserRegistered", @@ -440,6 +483,25 @@ const deployedContracts = { ], stateMutability: "view", }, + { + type: "function", + name: "isVotingOver", + inputs: [ + { + name: "voteId", + type: "uint256", + internalType: "uint256", + }, + ], + outputs: [ + { + name: "", + type: "bool", + internalType: "bool", + }, + ], + stateMutability: "view", + }, { type: "function", name: "signUpWithWorldId", diff --git a/packages/nextjs/contracts/deployedContracts.ts b/packages/nextjs/contracts/deployedContracts.ts index 57b41c4..52f6cec 100644 --- a/packages/nextjs/contracts/deployedContracts.ts +++ b/packages/nextjs/contracts/deployedContracts.ts @@ -290,7 +290,7 @@ const deployedContracts = { }, 480: { HumanOracle: { - address: "0xd458ac0643add160a344b94b2dd165e6acb3bed5", + address: "0x0bb141ef91dec0d190aa01b6d6d9d840cc3d04cc", abi: [ { type: "constructor", @@ -365,6 +365,30 @@ const deployedContracts = { outputs: [], stateMutability: "nonpayable", }, + { + type: "function", + name: "getUserHasClaimedForVote", + inputs: [ + { + name: "userAddr", + type: "address", + internalType: "address", + }, + { + name: "voteId", + type: "uint256", + internalType: "uint256", + }, + ], + outputs: [ + { + name: "", + type: "bool", + internalType: "bool", + }, + ], + stateMutability: "view", + }, { type: "function", name: "getVotingList", @@ -422,6 +446,25 @@ const deployedContracts = { ], stateMutability: "view", }, + { + type: "function", + name: "hasUserVotedForVote", + inputs: [ + { + name: "voteId", + type: "uint256", + internalType: "uint256", + }, + ], + outputs: [ + { + name: "", + type: "bool", + internalType: "bool", + }, + ], + stateMutability: "view", + }, { type: "function", name: "isUserRegistered", @@ -441,6 +484,25 @@ const deployedContracts = { ], stateMutability: "view", }, + { + type: "function", + name: "isVotingOver", + inputs: [ + { + name: "voteId", + type: "uint256", + internalType: "uint256", + }, + ], + outputs: [ + { + name: "", + type: "bool", + internalType: "bool", + }, + ], + stateMutability: "view", + }, { type: "function", name: "signUpWithWorldId",