Request form
Basic DAO
  • DAO
  • Governance
  • Docs
    Source
    ChefGPT

    Basic DAO

    A very simple implementation of a DAO. Voting period is locked in at 1 week, and the voting delay is 1 block. There is no delay on approved proposals.

    COUNTING_MODE() :
    See {IGovernor-COUNTING_MODE}.
    castVote(uint256,uint8) :
    See {IGovernor-castVote}.
    castVoteBySig(uint256,uint8,uint8,bytes32,bytes32) :
    See {IGovernor-castVoteBySig}.
    castVoteWithReason(uint256,uint8,string) :
    See {IGovernor-castVoteWithReason}.
    castVoteWithReasonAndParams(uint256,uint8,string,bytes) :
    See {IGovernor-castVoteWithReasonAndParams}.
    castVoteWithReasonAndParamsBySig(uint256,uint8,string,bytes,uint8,bytes32,bytes32) :
    See {IGovernor-castVoteWithReasonAndParamsBySig}.
    execute(address[],uint256[],bytes[],bytes32) :
    See {IGovernor-execute}.
    getVotes(address,uint256) :
    See {IGovernor-getVotes}.
    getVotesWithParams(address,uint256,bytes) :
    See {IGovernor-getVotesWithParams}.
    hasVoted(uint256,address) :
    See {IGovernor-hasVoted}.
    hashProposal(address[],uint256[],bytes[],bytes32) :
    See {IGovernor-hashProposal}. The proposal id is produced by hashing the RLC encoded `targets` array, the `values` array, the `calldatas` array and the descriptionHash (bytes32 which itself is the keccak256 hash of the description string). This proposal id can be produced from the proposal data which is part of the {ProposalCreated} event. It can even be computed in advance, before the proposal is submitted. Note that the chainId and the governor address are not part of the proposal id computation. Consequently, the same proposal (with same operation and same description) will have the same id if submitted on multiple governors across multiple networks. This also means that in order to execute the same operation twice (on the same governor) the proposer will have to change the description in order to avoid proposal id conflicts.
    name() :
    See {IGovernor-name}.
    onERC1155BatchReceived(address,address,uint256[],uint256[],bytes) :
    See {IERC1155Receiver-onERC1155BatchReceived}.
    onERC1155Received(address,address,uint256,uint256,bytes) :
    See {IERC1155Receiver-onERC1155Received}.
    onERC721Received(address,address,uint256,bytes) :
    See {IERC721Receiver-onERC721Received}.
    proposalDeadline(uint256) :
    See {IGovernor-proposalDeadline}.
    proposalSnapshot(uint256) :
    See {IGovernor-proposalSnapshot}.
    proposalThreshold() :
    Part of the Governor Bravo's interface: _"The number of votes required in order for a voter to become a proposer"_.
    proposalVotes(uint256) :
    Accessor to the internal vote counts.
    propose(address[],uint256[],bytes[],string) :
    See {IGovernor-propose}.
    quorumDenominator() :
    Returns the quorum denominator. Defaults to 100, but may be overridden.
    quorumNumerator() :
    Returns the current quorum numerator. See {quorumDenominator}.
    relay(address,uint256,bytes) :
    Relays a transaction or function call to an arbitrary target. In cases where the governance executor is some contract other than the governor itself, like when using a timelock, this function can be invoked in a governance proposal to recover tokens or Ether that was sent to the governor contract by mistake. Note that if the executor is simply the governor itself, use of `relay` is redundant.
    state(uint256) :
    See {IGovernor-state}.
    supportsInterface(bytes4) :
    See {IERC165-supportsInterface}.
    updateQuorumNumerator(uint256) :
    Changes the quorum numerator. Emits a {QuorumNumeratorUpdated} event. Requirements: - Must be called through a governance proposal. - New numerator must be smaller or equal to the denominator.
    version() :
    See {IGovernor-version}.
    votingDelay() :
    Delay, in number of block, between the proposal is created and the vote starts. This can be increassed to leave time for users to buy voting power, of delegate it, before the voting of a proposal starts.
    votingPeriod() :
    Delay, in number of blocks, between the vote start and vote ends. NOTE: The {votingDelay} can delay the start of the vote. This must be considered when setting the voting duration compared to the voting delay.
    basic-dao.sol
    Governor.sol
    GovernorCountingSimple.sol
    GovernorVotes.sol
    GovernorVotesQuorumFraction.sol
    IERC721Receiver.sol
    IERC1155Receiver.sol
    ECDSA.sol
    draft-EIP712.sol
    ERC165.sol
    SafeCast.sol
    DoubleEndedQueue.sol
    Address.sol
    Context.sol
    Timers.sol
    IGovernor.sol
    IERC165.sol
    Strings.sol
    IVotes.sol
    Checkpoints.sol
    Math.sol
    ABI:
    Bytecode:

    408 downloads

    Solidity Version

    0.8.12

    Creator

    Cookbook
    Cookbook / Basic DAO
  • DAO
  • Governance
  • Docs
    Source
    ChefGPT
    Expand
    Share

    Basic DAO

    A very simple implementation of a DAO. Voting period is locked in at 1 week, and the voting delay is 1 block. There is no delay on approved proposals.

    COUNTING_MODE() :
    See {IGovernor-COUNTING_MODE}.
    castVote(uint256,uint8) :
    See {IGovernor-castVote}.
    castVoteBySig(uint256,uint8,uint8,bytes32,bytes32) :
    See {IGovernor-castVoteBySig}.
    castVoteWithReason(uint256,uint8,string) :
    See {IGovernor-castVoteWithReason}.
    castVoteWithReasonAndParams(uint256,uint8,string,bytes) :
    See {IGovernor-castVoteWithReasonAndParams}.
    castVoteWithReasonAndParamsBySig(uint256,uint8,string,bytes,uint8,bytes32,bytes32) :
    See {IGovernor-castVoteWithReasonAndParamsBySig}.
    execute(address[],uint256[],bytes[],bytes32) :
    See {IGovernor-execute}.
    getVotes(address,uint256) :
    See {IGovernor-getVotes}.
    getVotesWithParams(address,uint256,bytes) :
    See {IGovernor-getVotesWithParams}.
    hasVoted(uint256,address) :
    See {IGovernor-hasVoted}.
    hashProposal(address[],uint256[],bytes[],bytes32) :
    See {IGovernor-hashProposal}. The proposal id is produced by hashing the RLC encoded `targets` array, the `values` array, the `calldatas` array and the descriptionHash (bytes32 which itself is the keccak256 hash of the description string). This proposal id can be produced from the proposal data which is part of the {ProposalCreated} event. It can even be computed in advance, before the proposal is submitted. Note that the chainId and the governor address are not part of the proposal id computation. Consequently, the same proposal (with same operation and same description) will have the same id if submitted on multiple governors across multiple networks. This also means that in order to execute the same operation twice (on the same governor) the proposer will have to change the description in order to avoid proposal id conflicts.
    name() :
    See {IGovernor-name}.
    onERC1155BatchReceived(address,address,uint256[],uint256[],bytes) :
    See {IERC1155Receiver-onERC1155BatchReceived}.
    onERC1155Received(address,address,uint256,uint256,bytes) :
    See {IERC1155Receiver-onERC1155Received}.
    onERC721Received(address,address,uint256,bytes) :
    See {IERC721Receiver-onERC721Received}.
    proposalDeadline(uint256) :
    See {IGovernor-proposalDeadline}.
    proposalSnapshot(uint256) :
    See {IGovernor-proposalSnapshot}.
    proposalThreshold() :
    Part of the Governor Bravo's interface: _"The number of votes required in order for a voter to become a proposer"_.
    proposalVotes(uint256) :
    Accessor to the internal vote counts.
    propose(address[],uint256[],bytes[],string) :
    See {IGovernor-propose}.
    quorumDenominator() :
    Returns the quorum denominator. Defaults to 100, but may be overridden.
    quorumNumerator() :
    Returns the current quorum numerator. See {quorumDenominator}.
    relay(address,uint256,bytes) :
    Relays a transaction or function call to an arbitrary target. In cases where the governance executor is some contract other than the governor itself, like when using a timelock, this function can be invoked in a governance proposal to recover tokens or Ether that was sent to the governor contract by mistake. Note that if the executor is simply the governor itself, use of `relay` is redundant.
    state(uint256) :
    See {IGovernor-state}.
    supportsInterface(bytes4) :
    See {IERC165-supportsInterface}.
    updateQuorumNumerator(uint256) :
    Changes the quorum numerator. Emits a {QuorumNumeratorUpdated} event. Requirements: - Must be called through a governance proposal. - New numerator must be smaller or equal to the denominator.
    version() :
    See {IGovernor-version}.
    votingDelay() :
    Delay, in number of block, between the proposal is created and the vote starts. This can be increassed to leave time for users to buy voting power, of delegate it, before the voting of a proposal starts.
    votingPeriod() :
    Delay, in number of blocks, between the vote start and vote ends. NOTE: The {votingDelay} can delay the start of the vote. This must be considered when setting the voting duration compared to the voting delay.
    basic-dao.sol
    Governor.sol
    GovernorCountingSimple.sol
    GovernorVotes.sol
    GovernorVotesQuorumFraction.sol
    IERC721Receiver.sol
    IERC1155Receiver.sol
    ECDSA.sol
    draft-EIP712.sol
    ERC165.sol
    SafeCast.sol
    DoubleEndedQueue.sol
    Address.sol
    Context.sol
    Timers.sol
    IGovernor.sol
    IERC165.sol
    Strings.sol
    IVotes.sol
    Checkpoints.sol
    Math.sol
    ABI:
    Bytecode:

    Get Cookin'
    star icon408

    408 downloads

    Solidity Version

    0.8.12

    Creator

    Cookbook