-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
token-2022: Add Pausable extension #7562
Conversation
#### Problem Users want a more Ethereum-style token experience by being able to "pause" their token, similar to the "Pausable" interface. When a mint is paused, tokens cannot be minted, burned, or transferred. #### Summary of changes Add the extension and some tests. It covers the following interactions: * mint / mint-checked * burn / burn-checked * transfer / transfer-checked / transfer-with-fee * confidential transfer / confidential transfer with fee * confidential mint / confidential burn Unfortunately, the confidential mint / burn extension doesn't have testing, so I couldn't get a full end-to-end test for it. Also note that it's still possible to: * move withheld tokens * initialize token accounts * close token accounts * set authority * freeze / thaw * approve / revoke * almost every other bit of extension management
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks very good! I could only find very minor things/comments.
For the confidential mint/burn, I am planning on just adding the token-client code myself, so I'll just go ahead and add the suitable tests for the pausable extension then when I add the other tests for confidential mint/burn.
@@ -397,6 +398,12 @@ fn process_deposit( | |||
let mint_data = &mint_info.data.borrow_mut(); | |||
let mint = PodStateWithExtensions::<PodMint>::unpack(mint_data)?; | |||
|
|||
if let Ok(extension) = mint.get_extension::<PausableConfig>() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yeah, sorry, I forgot to mention this in the PR description. Do you think that makes sense? If the mint is paused, should people be able to move tokens between their confidential and non-confidential balance? I was thinking yes. I'll update the comment and also add tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I think it makes sense either way. Way back when we first started out on token22, we were able to deposit and withdraw funds to other accounts, so deposit/withdraw were another way to transfer funds. We have since restricted deposit/withdraw to work within same accounts only, but some intuition from that time remains, which makes me feel that pausing deposits/withdraws makes sense. Given this, the current changes looks good to me!
Ok this should be ready for another look |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Things look good to me assuming that we stick with pausing deposits and withdraws!
I'll land this as is, and we can always remove it later |
Problem
Users want a more Ethereum-style token experience by being able to "pause" their token, similar to the "Pausable" interface. When a mint is paused, tokens cannot be minted, burned, or transferred.
Summary of changes
Add the extension and some tests. It covers the following interactions:
Unfortunately, the confidential mint / burn extension doesn't have testing, so I couldn't get a full end-to-end test for it.
Also note that it's still possible to:
cc @gitteri @jnwng