-
Notifications
You must be signed in to change notification settings - Fork 50
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
Updates batch unlock to only publish if needed #447
Conversation
let unlockingBadAccountCap = admin.capabilities.storage.issue<&{Address: UFix64}>(/storage/unlockingBadAccounts) | ||
admin.capabilities.publish(unlockingBadAccountCap, at: /public/unlockingBadAccounts) | ||
let unlockingBadAccountCap = admin.capabilities.get<&{Address: UFix64}>(/public/unlockingBadAccounts) | ||
if !unlockingBadAccountCap.check() { |
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.
check()
returns true if it exists?
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.
yes. 👍
let unlockingBadAccountCap = admin.capabilities.get<&{Address: UFix64}>(/public/unlockingBadAccounts) | ||
if !unlockingBadAccountCap.check() { | ||
let unlockingBadAccountCap = admin.capabilities.storage.issue<&{Address: UFix64}>(/storage/unlockingBadAccounts) | ||
admin.capabilities.unpublish(/public/unlockingBadAccounts) |
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.
I'm guessing unpublishing a non-existent path is just a no-op?
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.
correct, nothing will happen if there isn't anything there
admin.capabilities.publish(unlockingBadAccountCap, at: /public/unlockingBadAccounts) | ||
let unlockingBadAccountCap = admin.capabilities.get<&{Address: UFix64}>(/public/unlockingBadAccounts) | ||
if !unlockingBadAccountCap.check() { | ||
let unlockingBadAccountCap = admin.capabilities.storage.issue<&{Address: UFix64}>(/storage/unlockingBadAccounts) |
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.
i guess the extra let
is just shadowing this var, which isn't a problem since it's only used here in this if.
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, shouldn't be a problem to shadow it
Updates the transaction to unlock tokens in a batch of accounts to only publish a capability to the bad accounts dictionary if one already wasn't there
Edit: Also updates the emulator and CLI versions to ensure the tests pass and removes mentions of previewnet