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

Create and test PausableToken Contract #206

Merged
merged 1 commit into from
May 3, 2017

Conversation

DavidKnott
Copy link
Contributor

@DavidKnott DavidKnott commented Apr 24, 2017

Creates PausableToken contract that inherits from the StandardTokenContract.
Change Pauable contract to use pause as opposed to emergency
PausableToken has an owner who is able to:

Pause all token transfers
Unpause all token transfers

This contract was created in response to issue #194
It's fully tested in PausableToken.js and all tests are passing.

@maraoz
Copy link
Contributor

maraoz commented Apr 24, 2017

Amazing work @DavidKnott!!! Thanks a lot.
Do you mind refactoring the code so that it inherits from Pausable?
(https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/lifecycle/Pausable.sol)

I actually like the modifier and event names better here, so if you can also modify Pausable to adopt this new names that would be great.
What do you think?

BTW, if you haven't already, please join our slack, I'd like to have a chat with you and thank you for your contributions :)
https://slack.openzeppelin.org/

@DavidKnott
Copy link
Contributor Author

Thanks for looking it over so quickly @maraoz! I like that idea, I'll integrate it with the Pause contract and change the names to match the PauseToken.

@DavidKnott
Copy link
Contributor Author

@maraoz I changed the Pausable contract like we talked about before. I think the modifier '''canTransfer''' makes sense for allowing transactions only when they're not paused but cannotTransfer seems a bit confusing to me (the functionality is that it allows stuff to occur only when paused). What do you think?

@maraoz
Copy link
Contributor

maraoz commented Apr 25, 2017

@DavidKnott I think Pausable should have no mentions to transfers, I would call the methods pause, unpause, and the modifiers ifPaused or whenPaused and whenNotPaused

if (stopped) {
throw;
}
bool public transfersPaused = false;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bool public paused = false;?

bool public transfersPaused = false;

modifier canTransfer() {
if (transfersPaused) throw;
_;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whenNotPaused

throw;
}

modifier cannotTransfer {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whenPaused

function emergencyStop() external onlyOwner {
stopped = true;
// called by the owner to pause transfers, triggers stopped state
function pauseTransfers() onlyOwner canTransfer returns (bool) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pause

function release() external onlyOwner onlyInEmergency {
stopped = false;
// called by the owner to allow transfers, returns to normal state
function unpauseTransfers() onlyOwner cannotTransfer returns (bool) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unpause

@DavidKnott DavidKnott force-pushed the create-pausable-token branch 2 times, most recently from 671b869 to 927ef98 Compare April 25, 2017 17:47
@DavidKnott
Copy link
Contributor Author

@maraoz thanks for the feedback, I took all mentions of transactions out of the Pausable contract (tried to make it as modular as possible). Do you see anything else that needs to be changed?

@maraoz
Copy link
Contributor

maraoz commented May 3, 2017

LGTM, many thanks for the contribution!

@maraoz maraoz merged commit f7a7fc3 into OpenZeppelin:master May 3, 2017
ProphetDaniel pushed a commit to classicdelta/Smart-Contracts that referenced this pull request Mar 9, 2018
…oken

Create and test PausableToken Contract
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants