Skip to content

TMP: Base polls #6

@Evert0x

Description

@Evert0x

TMP-6: Base polls


tmp: 6
title: Base polls
author: Evert Kors (@Evert0x)
discussions-to: #6
status: Draft
type: Module
created: 2021/01/19
requires (*optional):
replaces (*optional):


Simple Summary

Polls are native to every pool, this TMP describes basic functionalities for any poll.

Abstract

The following standard allows other poll modules to be built on top of.

Using a different storage pointer for every poll

Motivation

...

Specification

Interface

interface IBasePoll {
    function getStartTime(uint256 _id) external view returns (uint256);

    function getEndTime(uint256 _id) external view returns (uint256);

    function getYesCounter(uint256 _id) external view returns (uint256);

    function getNoCounter(uint256 _id) external view returns (uint256);

    function getTotalVoted(uint256 _id) external view returns (uint256);

    function getVoteByAddress(uint256 _id, address _address)
        external
        view
        returns (LibBasePollStorage.Vote memory);
}

Storage

  struct BaseStorage {
    uint256 pollCounter;
  }

  struct BasePollStorage {
    uint256 id;
    uint256 startTime;
    uint256 endTime;
    uint256 yesCounter;
    uint256 noCounter;
    uint256 totalVoted;
    mapping(address => Vote) votesByAddress;
  }

  struct Vote {
    uint256 time;
    uint256 weight;
    bool agree;
  }

Rationale

Backwards Compatibility

Reference Implementation

https://github.com/Evert0x/BasePoll

Security Considerations

Copyright

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions