Contract 0x8bb50806D60c492c0004DAD5D9627DAA2d9732E6

 
Txn Hash Method
Block
From
To
Value [Txn Fee]
0x7699482f81855fe4fe3f5a0648355b6b83d9c8ddc5000885dabbf30d406586480x6080604058570752022-02-11 13:40:11104 days 17 mins ago0xb5af4138f0f33be0d6414eb25271b9c2dc245fb5 IN  Create: PollCreator0 ETH0.00449784749 ETH
[ Download CSV Export 
Parent Txn Hash Block From To Value
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
PollCreator

Compiler Version
v0.8.9+commit.e5eed63a

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion, MIT license

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 2 : Poll.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;

contract Poll {
    // The block at which the poll ends and votes can no longer be submitted.
    uint256 public endBlock;

    // Vote is emitted when an account submits a vote with 'choiceID'.
    // This event can be indexed to tally all votes for each choiceID
    event Vote(address indexed voter, uint256 choiceID);

    modifier isActive() {
        require(block.number <= endBlock, "poll is over");
        _;
    }

    constructor(uint256 _endBlock) {
        endBlock = _endBlock;
    }

    /**
     * @dev Vote for the poll's proposal.
     *      Reverts if the poll period is over.
     * @param _choiceID the ID of the option to vote for
     */
    function vote(uint256 _choiceID) external isActive {
        emit Vote(msg.sender, _choiceID);
    }

    /**
     * @dev Destroy the Poll contract after the poll has finished
     *      Reverts if the poll is still active
     */
    function destroy() external {
        require(block.number > endBlock, "poll is active");
        selfdestruct(payable(msg.sender));
    }
}

File 2 of 2 : PollCreator.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;

import "./Poll.sol";

interface IBondingManager {
    function transcoderTotalStake(address _addr) external view returns (uint256);

    function pendingStake(address _addr, uint256 _endRound) external view returns (uint256);
}

contract PollCreator {
    // 33.33%
    uint256 public constant QUORUM = 333300;
    // 50%
    uint256 public constant QUOTA = 500000;
    // 10 rounds
    uint256 public constant POLL_PERIOD = 10 * 5760;
    uint256 public constant POLL_CREATION_COST = 100 * 1 ether;

    IBondingManager public bondingManager;

    event PollCreated(address indexed poll, bytes proposal, uint256 endBlock, uint256 quorum, uint256 quota);

    constructor(address _bondingManagerAddr) {
        bondingManager = IBondingManager(_bondingManagerAddr);
    }

    /**
     * @notice Create a poll if caller has POLL_CREATION_COST LPT stake (own stake or stake delegated to it).
     * @param _proposal The IPFS multihash for the proposal.
     */
    function createPoll(bytes calldata _proposal) external {
        require(
            // pendingStake() ignores the second arg
            bondingManager.pendingStake(msg.sender, 0) >= POLL_CREATION_COST ||
                bondingManager.transcoderTotalStake(msg.sender) >= POLL_CREATION_COST,
            "PollCreator#createPoll: INSUFFICIENT_STAKE"
        );

        uint256 endBlock = block.number + POLL_PERIOD;
        Poll poll = new Poll(endBlock);

        emit PollCreated(address(poll), _proposal, endBlock, QUORUM, QUOTA);
    }
}

Settings
{
  "evmVersion": "london",
  "libraries": {},
  "metadata": {
    "bytecodeHash": "ipfs",
    "useLiteralContent": true
  },
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "remappings": [],
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "abi"
      ]
    }
  }
}

Contract ABI

[{"inputs":[{"internalType":"address","name":"_bondingManagerAddr","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"poll","type":"address"},{"indexed":false,"internalType":"bytes","name":"proposal","type":"bytes"},{"indexed":false,"internalType":"uint256","name":"endBlock","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"quorum","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"quota","type":"uint256"}],"name":"PollCreated","type":"event"},{"inputs":[],"name":"POLL_CREATION_COST","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"POLL_PERIOD","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"QUORUM","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"QUOTA","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"bondingManager","outputs":[{"internalType":"contract IBondingManager","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"_proposal","type":"bytes"}],"name":"createPoll","outputs":[],"stateMutability":"nonpayable","type":"function"}]

608060405234801561001057600080fd5b506040516106be3803806106be83398101604081905261002f91610054565b600080546001600160a01b0319166001600160a01b0392909216919091179055610084565b60006020828403121561006657600080fd5b81516001600160a01b038116811461007d57600080fd5b9392505050565b61062b806100936000396000f3fe608060405234801561001057600080fd5b50600436106100625760003560e01c80632e80d9b614610067578063426eae45146100845780634d2942ab146100af5780635359fbc0146100c4578063a502303b146100d4578063cb61e46e146100de575b600080fd5b610071620515f481565b6040519081526020015b60405180910390f35b600054610097906001600160a01b031681565b6040516001600160a01b03909116815260200161007b565b6100c26100bd36600461030e565b6100e7565b005b61007168056bc75e2d6310000081565b6100716207a12081565b61007161e10081565b60008054604051634e85963d60e11b8152336004820152602481019290925268056bc75e2d63100000916001600160a01b0390911690639d0b2c7a9060440160206040518083038186803b15801561013e57600080fd5b505afa158015610152573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101769190610380565b10158061020557506000546040516327be77e560e21b815233600482015268056bc75e2d63100000916001600160a01b031690639ef9df949060240160206040518083038186803b1580156101ca57600080fd5b505afa1580156101de573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102029190610380565b10155b6102685760405162461bcd60e51b815260206004820152602a60248201527f506f6c6c43726561746f7223637265617465506f6c6c3a20494e53554646494360448201526949454e545f5354414b4560b01b606482015260840160405180910390fd5b600061027661e10043610399565b905060008160405161028790610301565b908152602001604051809103906000f0801580156102a9573d6000803e3d6000fd5b509050806001600160a01b03167f8afbc4e1826cefcfc1e64fd5ff7d8484e700867fdbe36e9b6db047c010a6229e858585620515f46207a1206040516102f39594939291906103bf565b60405180910390a250505050565b6101ef8061040783390190565b6000806020838503121561032157600080fd5b823567ffffffffffffffff8082111561033957600080fd5b818501915085601f83011261034d57600080fd5b81358181111561035c57600080fd5b86602082850101111561036e57600080fd5b60209290920196919550909350505050565b60006020828403121561039257600080fd5b5051919050565b600082198211156103ba57634e487b7160e01b600052601160045260246000fd5b500190565b60808152846080820152848660a0830137600060a08683010152600060a0601f19601f8801168301019050846020830152836040830152826060830152969550505050505056fe608060405234801561001057600080fd5b506040516101ef3803806101ef83398101604081905261002f91610037565b600055610050565b60006020828403121561004957600080fd5b5051919050565b6101908061005f6000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c80630121b93f14610046578063083c63231461005b57806383197ef014610076575b600080fd5b610059610054366004610141565b61007e565b005b61006460005481565b60405190815260200160405180910390f35b6100596100fc565b6000544311156100c45760405162461bcd60e51b815260206004820152600c60248201526b3837b6361034b99037bb32b960a11b60448201526064015b60405180910390fd5b60405181815233907ff668ead05c744b9178e571d2edb452e72baf6529c8d72160e64e59b50d865bd09060200160405180910390a250565b600054431161013e5760405162461bcd60e51b815260206004820152600e60248201526d706f6c6c2069732061637469766560901b60448201526064016100bb565b33ff5b60006020828403121561015357600080fd5b503591905056fea2646970667358221220e261c2ae86d579d3bb93dac7a0a4cdcb6fd8ec10e94802f7978fcf4892830b3464736f6c63430008090033a2646970667358221220a03dc095991cbc23c9a0899496e73acaccbf55bd4d692f3acc7edb3bf31b917864736f6c6343000809003300000000000000000000000035bcf3c30594191d53231e4ff333e8a770453e40

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

00000000000000000000000035bcf3c30594191d53231e4ff333e8a770453e40

-----Decoded View---------------
Arg [0] : _bondingManagerAddr (address): 0x35bcf3c30594191d53231e4ff333e8a770453e40

-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 00000000000000000000000035bcf3c30594191d53231e4ff333e8a770453e40


Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
Block Uncle Number Difficulty Gas Used Reward
Loading
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.