- Contract name:
- SmartMeterReadsRegistry
- Optimization enabled
- false
- Compiler version
- v0.5.17+commit.d19bba13
- EVM Version
- default
- Verified at
- 2020-06-19T12:21:30.140211Z
Contract source code
contract SmartMeterReadsRegistry {uint constant public DAILY_BUCKET = 3600 * 24;event NewReadStored(address indexed meter, uint indexed bucket, address operator, uint timestamp, bytes data);function store(address meter, bytes memory data, uint timestamp, uint bucket) public {if (timestamp > now) {revert("Future timestamp provided");}emit NewReadStored(meter, bucket, msg.sender, timestamp, data);}function storeWithDailyBucket(address meter, bytes memory data, uint timestamp) public {uint bucket = timestamp - (timestamp % DAILY_BUCKET);store(meter, data, timestamp, bucket);}}
Contract ABI
[{"type":"event","name":"NewReadStored","inputs":[{"type":"address","name":"meter","internalType":"address","indexed":true},{"type":"uint256","name":"bucket","internalType":"uint256","indexed":true},{"type":"address","name":"operator","internalType":"address","indexed":false},{"type":"uint256","name":"timestamp","internalType":"uint256","indexed":false},{"type":"bytes","name":"data","internalType":"bytes","indexed":false}],"anonymous":false},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"DAILY_BUCKET","inputs":[],"constant":true},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"store","inputs":[{"type":"address","name":"meter","internalType":"address"},{"type":"bytes","name":"data","internalType":"bytes"},{"type":"uint256","name":"timestamp","internalType":"uint256"},{"type":"uint256","name":"bucket","internalType":"uint256"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"storeWithDailyBucket","inputs":[{"type":"address","name":"meter","internalType":"address"},{"type":"bytes","name":"data","internalType":"bytes"},{"type":"uint256","name":"timestamp","internalType":"uint256"}],"constant":false}]
Deployed ByteCode
0x608060405234801561001057600080fd5b50600436106100415760003560e01c8063af3f9c1714610046578063c6f5ed7514610135578063fb88dee814610153575b600080fd5b6101336004803603608081101561005c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019064010000000081111561009957600080fd5b8201836020820111156100ab57600080fd5b803590602001918460018302840111640100000000831117156100cd57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505091929192908035906020019092919080359060200190929190505050610238565b005b61013d6103a4565b6040518082815260200191505060405180910390f35b6102366004803603606081101561016957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001906401000000008111156101a657600080fd5b8201836020820111156101b857600080fd5b803590602001918460018302840111640100000000831117156101da57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290803590602001909291905050506103ab565b005b428211156102ae576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260198152602001807f4675747572652074696d657374616d702070726f76696465640000000000000081525060200191505060405180910390fd5b808473ffffffffffffffffffffffffffffffffffffffff167f935eafed300fc1744e1b8189319d379651752523123284062d1b210fd3007176338587604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b83811015610362578082015181840152602081019050610347565b50505050905090810190601f16801561038f5780820380516001836020036101000a031916815260200191505b5094505050505060405180910390a350505050565b6201518081565b60006201518082816103b957fe5b06820390506103ca84848484610238565b5050505056fea265627a7a72315820f6b45c3c0cc4cab23d87e25bdd2a46d8843b8787f61c4607efb3060287ef8c7f64736f6c63430005110032