Giveth / vaultcontroller

Vault Architecture
GNU General Public License v3.0
0 stars 3 forks source link

24h time windows #27

Open adria0 opened 7 years ago

adria0 commented 7 years ago

The time window in checkMainTransfer creates a zero-second window if closingTime and openingTime are the same

        if ( closingTime >= openingTime ) {
            windowTimeLength = closingTime - openingTime ;
        } else {
            windowTimeLength = 86400 + closingTime - openingTime;
        }

To handle 24h windows, consider to change it to:

        if ( closingTime > openingTime ) {
            windowTimeLength = closingTime - openingTime ;
        } else {
            windowTimeLength = 86400 + closingTime - openingTime;
        }

The same issue is also in checkSpenderTransfer

jbaylina commented 7 years ago

We need to decide if we accept 0s windows (always closed) and 24h window (always open). I think that the best is to define the startTime 0-86399 and openWindow 0-86400.

This way we have the best of both and the calculus simplifies a lot.

Opinions?

GriffGreen commented 7 years ago

I dont like 0s windows... but love an option for always open (turning off this security feature)

jbaylina commented 7 years ago

Closing the transfers is a good way to hold the transfers temporally. For example if you go for vacations.

GriffGreen commented 7 years ago

Is this the right feature to implement closing the vault for a few days? if there is not a more straight forward feature that allows that functionality then 0s time does make sense!

:-D

dipenjoshi commented 7 years ago

We imagined not able to modify limits after the contract is deployed. But we'll leave that ability in the system for now. Regardless of open 24 hours/ closed 24 hours. some functionality like overflow, cancel vaults etc. should be able to work.

adria0 commented 7 years ago

Ok! We need to document it, then.