Contract 0x3752D67bfBe945a89787c7F6758A47C2D52988d4

Txn Hash Method
Block
From
To
Value [Txn Fee]
0x23a9dcf30b7a9e414a52f18a1c6df84c8069a3261daa06ef4b2d1e6d986e7b63Vote30737762021-03-19 0:48:48218 days 3 hrs ago0xd40e0c6473a93381ce7c829ba34a6192426cc0c5 IN  0x3752d67bfbe945a89787c7f6758a47c2d52988d40 HT0.0000467051
0x13735bdb281599fb1b601af917e9752a43fb2036cf7c9d45dfe39dde3120ed87Vote30299002021-03-17 12:15:00219 days 15 hrs ago0x1826a1e85875fb744efd8aec0d58850f0982dd1f IN  0x3752d67bfbe945a89787c7f6758a47c2d52988d40 HT0.0000467051
0x6deb9f2f0dfeb6b263d80fa7922db58dd49ce6acadf57b03432c9b8797213f18Vote30231042021-03-17 6:35:12219 days 21 hrs ago0x1b59dedbb86d9992c614735c1983aa5ed5a1d6e6 IN  0x3752d67bfbe945a89787c7f6758a47c2d52988d40 HT0.0000467051
0xf47783b46ed02d8b408cbda9e3017150d4f18d3208f655ce3318f57908c168dbVote30192142021-03-17 3:20:42220 days 35 mins ago0x6ea9ac2548ed1e22549ba7a7c3d66b18ad19e06c IN  0x3752d67bfbe945a89787c7f6758a47c2d52988d40 HT0.0000467051
0x98ad7ae26563ae35d708bda3bdc473a783629d9866e3d51024cbd5bea4e2ebabVote29972222021-03-16 9:01:06220 days 18 hrs ago0xab2dd970e9a4647d4f86e98f902dbdf58c459e66 IN  0x3752d67bfbe945a89787c7f6758a47c2d52988d40 HT0.0000467051
0x7258e47ec781c4c4de9fc98b7d157334d419bbd787eb4809074414d4880ac063Vote29962752021-03-16 8:13:45220 days 19 hrs ago0x76d2ddce6b781e66c4b184c82fbf4f94346cfb0d IN  0x3752d67bfbe945a89787c7f6758a47c2d52988d40 HT0.0000467051
0x0ebf967b50ffc13fa97da2166fd5f2e9dbcb8cee9f78222be5f94b4a0c0f4fa4Vote29962302021-03-16 8:11:30220 days 19 hrs ago0x722372ebb00b8350efc81f22590d28915e2c847e IN  0x3752d67bfbe945a89787c7f6758a47c2d52988d40 HT0.0000467051
0x28f44bd984b7983b224a9e147754d85a04319586dc417d37c478ef921fce722aVote29961572021-03-16 8:07:51220 days 19 hrs ago0x9a04522ee9e33027a6cff2280388b8d9b77d1e5f IN  0x3752d67bfbe945a89787c7f6758a47c2d52988d40 HT0.0000467051
0x4810dc99d96ce36286931c840ebb2d4432c7017c5af11d2adeb63926f81d9abcVote29953412021-03-16 7:27:03220 days 20 hrs ago0x5b984a638506797d1e6e50b4e310d8ab377d3f49 IN  0x3752d67bfbe945a89787c7f6758a47c2d52988d40 HT0.0000467051
0x9e8bdf60b73dc0fe38d3bdf8bd25f8fa53305be08ebc33ba56c026ea86eb734dInitialize Vote29931132021-03-16 5:35:39220 days 22 hrs ago0x05d8bf0182858079815d385cce77df7b2836c1da IN  0x3752d67bfbe945a89787c7f6758a47c2d52988d40 HT0.0001890921
0x161bd9d5fc10091f3c424ee6dd713260e218afdcac17ff764b9b294ce845b5c90x6080604029921792021-03-16 4:48:57220 days 23 hrs ago0x05d8bf0182858079815d385cce77df7b2836c1da IN  Contract Creation0 HT0.0005489051
[ Download CSV Export 
Parent Txn Hash Block From To Value
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
DeriVote

Compiler Version
v0.8.1+commit.df193b15

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion, MIT license
/**
 *Submitted for verification at hecoinfo.com on 2021-03-16
*/

// SPDX-License-Identifier: MIT

pragma solidity >=0.8.0 <0.9.0;

contract DeriVote {

    event Vote(address indexed voter, uint256 indexed votingId, uint256 votingOption);

    string public constant name = 'DeriVote';

    uint256 public votingId;

    uint256 public numVotingOptions;

    uint256 public votingDeadline;

    // Record voting topic for a specific voting id of `votingId`
    mapping (uint256 => string) public votingTopics;

    // Record voting option for voters
    // `votingOption` starts from 1, 1 means the first votingTopic, 0 is reserved for no voting
    mapping (uint256 => mapping (address => uint256)) public votingOptions;

    address public controller;

    constructor () {
        controller = msg.sender;
    }

    function setController(address newController) public {
        require(msg.sender == controller, 'DeriVote.setController: only controller');
        controller = newController;
    }

    function initializeVote(string memory topic, uint256 nOptions, uint256 deadline) public {
        require(msg.sender == controller, 'DeriVote.initializeVote: only controller');
        require(block.timestamp > votingDeadline, 'DeriVote.initializeVote: still in voting');
        require(deadline > block.timestamp, 'DeriVote.initializeVote: deadline not valid');

        votingId += 1;
        numVotingOptions = nOptions;
        votingDeadline = deadline;
        votingTopics[votingId] = topic;
    }

    function vote(uint256 votingOption) public {
        require(block.timestamp <= votingDeadline, 'DeriVote.vote: voting expired');
        require(votingOption > 0 && votingOption <= numVotingOptions, 'DeriVote.vote: invalid voting option');
        votingOptions[votingId][msg.sender] = votingOption;

        emit Vote(msg.sender, votingId, votingOption);
    }

}

Contract Security Audit

Contract ABI

[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"voter","type":"address"},{"indexed":true,"internalType":"uint256","name":"votingId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"votingOption","type":"uint256"}],"name":"Vote","type":"event"},{"inputs":[],"name":"controller","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"topic","type":"string"},{"internalType":"uint256","name":"nOptions","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"initializeVote","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"numVotingOptions","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newController","type":"address"}],"name":"setController","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"votingOption","type":"uint256"}],"name":"vote","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"votingDeadline","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"votingId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"}],"name":"votingOptions","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"votingTopics","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"}]

608060405234801561001057600080fd5b50600580546001600160a01b03191633179055610895806100326000396000f3fe608060405234801561001057600080fd5b506004361061009e5760003560e01c806352e30d1b1161006657806352e30d1b146100fb57806353e61a611461010e57806382160cdc1461012157806392eefe9b14610134578063f77c4791146101475761009e565b80630121b93f146100a3578063036ee850146100b857806306fdde03146100d65780631c6a31e0146100eb57806342ea2fa4146100f3575b600080fd5b6100b66100b136600461059a565b61015c565b005b6100c061020f565b6040516100cd91906107e1565b60405180910390f35b6100de610215565b6040516100cd91906105f1565b6100c0610239565b6100c061023f565b6100de61010936600461059a565b610245565b6100b661011c3660046104de565b6102df565b6100c061012f3660046105b2565b610390565b6100b66101423660046104bd565b6103ad565b61014f6103f9565b6040516100cd91906105dd565b6002544211156101875760405162461bcd60e51b815260040161017e906106d6565b60405180910390fd5b60008111801561019957506001548111155b6101b55760405162461bcd60e51b815260040161017e90610755565b600080548152600460209081526040808320338085529252808320849055915491517fafd3f234c1f8e944129b26b206d98e5752ad3336a4059938b4a3e990e9588530906102049085906107e1565b60405180910390a350565b60025481565b6040518060400160405280600881526020016744657269566f746560c01b81525081565b60005481565b60015481565b6003602052600090815260409020805461025e9061080e565b80601f016020809104026020016040519081016040528092919081815260200182805461028a9061080e565b80156102d75780601f106102ac576101008083540402835291602001916102d7565b820191906000526020600020905b8154815290600101906020018083116102ba57829003601f168201915b505050505081565b6005546001600160a01b031633146103095760405162461bcd60e51b815260040161017e90610799565b600254421161032a5760405162461bcd60e51b815260040161017e9061070d565b4281116103495760405162461bcd60e51b815260040161017e9061068b565b600160008082825461035b91906107ea565b909155505060018290556002819055600080548152600360209081526040909120845161038a92860190610408565b50505050565b600460209081526000928352604080842090915290825290205481565b6005546001600160a01b031633146103d75760405162461bcd60e51b815260040161017e90610644565b600580546001600160a01b0319166001600160a01b0392909216919091179055565b6005546001600160a01b031681565b8280546104149061080e565b90600052602060002090601f016020900481019282610436576000855561047c565b82601f1061044f57805160ff191683800117855561047c565b8280016001018555821561047c579182015b8281111561047c578251825591602001919060010190610461565b5061048892915061048c565b5090565b5b80821115610488576000815560010161048d565b80356001600160a01b03811681146104b857600080fd5b919050565b6000602082840312156104ce578081fd5b6104d7826104a1565b9392505050565b6000806000606084860312156104f2578182fd5b833567ffffffffffffffff80821115610509578384fd5b818601915086601f83011261051c578384fd5b81358181111561052e5761052e610849565b604051601f8201601f19908116603f0116810190838211818310171561055657610556610849565b8160405282815289602084870101111561056e578687fd5b826020860160208301379182016020908101969096525097938601359650505060409093013592509050565b6000602082840312156105ab578081fd5b5035919050565b600080604083850312156105c4578182fd5b823591506105d4602084016104a1565b90509250929050565b6001600160a01b0391909116815260200190565b6000602080835283518082850152825b8181101561061d57858101830151858201604001528201610601565b8181111561062e5783604083870101525b50601f01601f1916929092016040019392505050565b60208082526027908201527f44657269566f74652e736574436f6e74726f6c6c65723a206f6e6c7920636f6e6040820152663a3937b63632b960c91b606082015260800190565b6020808252602b908201527f44657269566f74652e696e697469616c697a65566f74653a20646561646c696e60408201526a19481b9bdd081d985b1a5960aa1b606082015260800190565b6020808252601d908201527f44657269566f74652e766f74653a20766f74696e672065787069726564000000604082015260600190565b60208082526028908201527f44657269566f74652e696e697469616c697a65566f74653a207374696c6c20696040820152676e20766f74696e6760c01b606082015260800190565b60208082526024908201527f44657269566f74652e766f74653a20696e76616c696420766f74696e67206f706040820152633a34b7b760e11b606082015260800190565b60208082526028908201527f44657269566f74652e696e697469616c697a65566f74653a206f6e6c7920636f604082015267373a3937b63632b960c11b606082015260800190565b90815260200190565b6000821982111561080957634e487b7160e01b81526011600452602481fd5b500190565b60028104600182168061082257607f821691505b6020821081141561084357634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052604160045260246000fdfea2646970667358221220ca7338ab05b0951667e51186ff8a2eb29cd3241eb6ce538877834a86dd9e825864736f6c63430008010033

Deployed ByteCode Sourcemap

70:1802:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1499:368;;;;;;:::i;:::-;;:::i;:::-;;308:29;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;187:40;;;:::i;:::-;;;;;;;:::i;236:23::-;;;:::i;268:31::-;;;:::i;413:47::-;;;;;;:::i;:::-;;:::i;977:514::-;;;;;;:::i;:::-;;:::i;606:70::-;;;;;;:::i;:::-;;:::i;784:185::-;;;;;;:::i;:::-;;:::i;685:25::-;;;:::i;:::-;;;;;;;:::i;1499:368::-;1580:14;;1561:15;:33;;1553:75;;;;-1:-1:-1;;;1553:75:0;;;;;;;:::i;:::-;;;;;;;;;1662:1;1647:12;:16;:52;;;;;1683:16;;1667:12;:32;;1647:52;1639:101;;;;-1:-1:-1;;;1639:101:0;;;;;;;:::i;:::-;1751:23;1765:8;;1751:23;;:13;:23;;;;;;;;1775:10;1751:35;;;;;;;;:50;;;1836:8;;1819:40;;;;;;1789:12;;1819:40;:::i;:::-;;;;;;;;1499:368;:::o;308:29::-;;;;:::o;187:40::-;;;;;;;;;;;;;;-1:-1:-1;;;187:40:0;;;;:::o;236:23::-;;;;:::o;268:31::-;;;;:::o;413:47::-;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;977:514::-;1098:10;;-1:-1:-1;;;;;1098:10:0;1084;:24;1076:77;;;;-1:-1:-1;;;1076:77:0;;;;;;;:::i;:::-;1190:14;;1172:15;:32;1164:85;;;;-1:-1:-1;;;1164:85:0;;;;;;;:::i;:::-;1279:15;1268:8;:26;1260:82;;;;-1:-1:-1;;;1260:82:0;;;;;;;:::i;:::-;1367:1;1355:8;;:13;;;;;;;:::i;:::-;;;;-1:-1:-1;;1379:16:0;:27;;;1417:14;:25;;;-1:-1:-1;1466:8:0;;1453:22;;:12;:22;;;;;;;;:30;;;;;;;;:::i;:::-;;977:514;;;:::o;606:70::-;;;;;;;;;;;;;;;;;;;;;;;;:::o;784:185::-;870:10;;-1:-1:-1;;;;;870:10:0;856;:24;848:76;;;;-1:-1:-1;;;848:76:0;;;;;;;:::i;:::-;935:10;:26;;-1:-1:-1;;;;;;935:26:0;-1:-1:-1;;;;;935:26:0;;;;;;;;;;784:185::o;685:25::-;;;-1:-1:-1;;;;;685:25:0;;:::o;-1:-1:-1:-;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;:::o;:::-;;;;;;;;;;;;;;;14:175:1;84:20;;-1:-1:-1;;;;;133:31:1;;123:42;;113:2;;179:1;176;169:12;113:2;65:124;;;:::o;194:198::-;;306:2;294:9;285:7;281:23;277:32;274:2;;;327:6;319;312:22;274:2;355:31;376:9;355:31;:::i;:::-;345:41;264:128;-1:-1:-1;;;264:128:1:o;397:1113::-;;;;553:2;541:9;532:7;528:23;524:32;521:2;;;574:6;566;559:22;521:2;619:9;606:23;648:18;689:2;681:6;678:14;675:2;;;710:6;702;695:22;675:2;753:6;742:9;738:22;728:32;;798:7;791:4;787:2;783:13;779:27;769:2;;825:6;817;810:22;769:2;866;853:16;888:2;884;881:10;878:2;;;894:18;;:::i;:::-;969:2;963:9;937:2;1023:13;;-1:-1:-1;;1019:22:1;;;1043:2;1015:31;1011:40;999:53;;;1067:18;;;1087:22;;;1064:46;1061:2;;;1113:18;;:::i;:::-;1153:10;1149:2;1142:22;1188:2;1180:6;1173:18;1230:7;1223:4;1218:2;1214;1210:11;1206:22;1203:35;1200:2;;;1256:6;1248;1241:22;1200:2;1321;1314:4;1310:2;1306:13;1299:4;1291:6;1287:17;1274:50;1344:15;;;1361:4;1340:26;;;1333:42;;;;-1:-1:-1;1348:6:1;1432:20;;;1419:34;;-1:-1:-1;;;1500:2:1;1485:18;;;1472:32;;-1:-1:-1;511:999:1;-1:-1:-1;511:999:1:o;1515:190::-;;1627:2;1615:9;1606:7;1602:23;1598:32;1595:2;;;1648:6;1640;1633:22;1595:2;-1:-1:-1;1676:23:1;;1585:120;-1:-1:-1;1585:120:1:o;1710:266::-;;;1839:2;1827:9;1818:7;1814:23;1810:32;1807:2;;;1860:6;1852;1845:22;1807:2;1901:9;1888:23;1878:33;;1930:40;1966:2;1955:9;1951:18;1930:40;:::i;:::-;1920:50;;1797:179;;;;;:::o;1981:203::-;-1:-1:-1;;;;;2145:32:1;;;;2127:51;;2115:2;2100:18;;2082:102::o;2189:603::-;;2330:2;2359;2348:9;2341:21;2391:6;2385:13;2434:6;2429:2;2418:9;2414:18;2407:34;2459:4;2472:140;2486:6;2483:1;2480:13;2472:140;;;2581:14;;;2577:23;;2571:30;2547:17;;;2566:2;2543:26;2536:66;2501:10;;2472:140;;;2630:6;2627:1;2624:13;2621:2;;;2700:4;2695:2;2686:6;2675:9;2671:22;2667:31;2660:45;2621:2;-1:-1:-1;2776:2:1;2755:15;-1:-1:-1;;2751:29:1;2736:45;;;;2783:2;2732:54;;2310:482;-1:-1:-1;;;2310:482:1:o;2797:403::-;2999:2;2981:21;;;3038:2;3018:18;;;3011:30;3077:34;3072:2;3057:18;;3050:62;-1:-1:-1;;;3143:2:1;3128:18;;3121:37;3190:3;3175:19;;2971:229::o;3205:407::-;3407:2;3389:21;;;3446:2;3426:18;;;3419:30;3485:34;3480:2;3465:18;;3458:62;-1:-1:-1;;;3551:2:1;3536:18;;3529:41;3602:3;3587:19;;3379:233::o;3617:353::-;3819:2;3801:21;;;3858:2;3838:18;;;3831:30;3897:31;3892:2;3877:18;;3870:59;3961:2;3946:18;;3791:179::o;3975:404::-;4177:2;4159:21;;;4216:2;4196:18;;;4189:30;4255:34;4250:2;4235:18;;4228:62;-1:-1:-1;;;4321:2:1;4306:18;;4299:38;4369:3;4354:19;;4149:230::o;4384:400::-;4586:2;4568:21;;;4625:2;4605:18;;;4598:30;4664:34;4659:2;4644:18;;4637:62;-1:-1:-1;;;4730:2:1;4715:18;;4708:34;4774:3;4759:19;;4558:226::o;4789:404::-;4991:2;4973:21;;;5030:2;5010:18;;;5003:30;5069:34;5064:2;5049:18;;5042:62;-1:-1:-1;;;5135:2:1;5120:18;;5113:38;5183:3;5168:19;;4963:230::o;5198:177::-;5344:25;;;5332:2;5317:18;;5299:76::o;5380:229::-;;5451:1;5447:6;5444:1;5441:13;5438:2;;;-1:-1:-1;;;5477:33:1;;5533:4;5530:1;5523:15;5563:4;5484:3;5551:17;5438:2;-1:-1:-1;5594:9:1;;5428:181::o;5614:380::-;5699:1;5689:12;;5746:1;5736:12;;;5757:2;;5811:4;5803:6;5799:17;5789:27;;5757:2;5864;5856:6;5853:14;5833:18;5830:38;5827:2;;;5910:10;5905:3;5901:20;5898:1;5891:31;5945:4;5942:1;5935:15;5973:4;5970:1;5963:15;5827:2;;5669:325;;;:::o;5999:127::-;6060:10;6055:3;6051:20;6048:1;6041:31;6091:4;6088:1;6081:15;6115:4;6112:1;6105:15

Swarm Source

ipfs://ca7338ab05b0951667e51186ff8a2eb29cd3241eb6ce538877834a86dd9e8258
Block Transaction Gas Used Reward
Age Block Fee Address Jailed Incoming
Block Uncle Number Difficulty Gas Used Reward
Loading
Loading