Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

An improvement in pausable.sol #723

Closed
AyushyaChitransh opened this issue Feb 6, 2018 · 3 comments
Closed

An improvement in pausable.sol #723

AyushyaChitransh opened this issue Feb 6, 2018 · 3 comments
Labels
feature New contracts, functions, or helpers.

Comments

@AyushyaChitransh
Copy link

🎉 Description

Togglable

As of its current implementation, pausable.sol works as a toggle switch to turn_on and turn_off certain functionalities. If we just want to have a toggle functionality, then we can inherit a different contract with name like togglable. The name pausable leads to notions of time.

Pausable

If we are to have a pausable contract, it should have variables like startTime and endTime defined in itself. Then pausable would be able to track duration of how long it was paused and update the endTime when it is resumed.

AyushyaChitransh added a commit to AyushyaChitransh/zeppelin-solidity that referenced this issue Feb 6, 2018
Earlier: Pausable.sol worked as a toggle switch to turn on/off any functionality

Now: Pausable.sol will work with contract that use the time variables defined in pausable contract. Pause will 'pause' a function and resume will 'resume' that function along with updations in the endTime.

closes OpenZeppelin#723
@federicobond
Copy link
Contributor

Hi @AyushyaChitransh! Thanks for your suggestion. Do you have a use case in mind that benefits from this sort of time-tracking being performed on-chain?

@federicobond federicobond added the feature New contracts, functions, or helpers. label Feb 8, 2018
@AyushyaChitransh
Copy link
Author

@federicobond Pausable instinctively refers to something which has been continuing in time, hence time-tracking. Anything that requires to be paused, will pause something which has a duration. And the integrity of that duration is retained by resume function

Use cases:

  • ICOs generally have a starting time and an ending time, so they would benefit if pause worked as pause and on resume it updated end time to adjust the original duration.

I cannot think of any other popular use case as of now.

@federicobond
Copy link
Contributor

Thank you for your answer @AyushyaChitransh. I think we are best keeping the current Pausable behaviour minimal for now, since it's not a requirement that we have seen coming up for most use cases, and it would be easy to add if required.

At OpenZeppelin, we aim to cover the most general use cases with well audited contracts. This requires us to be very careful with any extra assumptions that we make about how they will be used, especially considering that each extra storage slot used costs quite a bit of gas.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New contracts, functions, or helpers.
Projects
None yet
Development

No branches or pull requests

2 participants