couger-inc / cream

zkCREAM is zk-SNARK based anonymized voting application using a token mixer
https://zkcre.am
GNU General Public License v3.0
41 stars 8 forks source link

[New feature] Add voting deadline for contracts #45

Closed kazuakiishiguro closed 3 years ago

kazuakiishiguro commented 3 years ago

Passing something like votingDurationSeconds to contract's constructor() to setup voting duration.

The motivation for adding this feature is to allow for batch processing after the deadline by having a deadline for voting.

kazuakiishiguro commented 3 years ago

Implementing #46 will also accomplish this goal at the same time.

kazuakiishiguro commented 3 years ago

add something like

require(block.timestamp < maci.calcSignUpDeadline())

or use maci's modifier


modifier isBeforeSignUpDeadline() {
        require(block.timestamp < calcSignUpDeadline(), "MACI: the sign-up period has passed");
        _;
    }

    /*
     * Ensures that the calling function only continues execution if the
     * current block time is after or equal to the sign-up deadline.
     */
    modifier isAfterSignUpDeadline() {
        require(block.timestamp >= calcSignUpDeadline(), "MACI: the sign-up period is not over");
        _;
    }
kazuakiishiguro commented 3 years ago

Added 9b607a57aca7c6587c2af58fb4c78b0a4452ef24