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

Add entitlement for locked account creator #423

Merged
merged 2 commits into from
Apr 24, 2024

Conversation

joshuahannan
Copy link
Member

Adds an entitlement to the LockedTokens contract for adding account information to the LockedTokenAdmin resource
Need to confirm if this will require a custom migration or not
Also updates the README and flow.json to use correct import addresses

@joshuahannan joshuahannan changed the base branch from master to stable-cadence April 24, 2024 14:56
}

// account creators store this resource in their account
// in order to be able to register accounts who have locked tokens
access(all) resource LockedAccountCreator: LockedAccountCreatorPublic, AddAccount {

access(self) var addAccountCapability: Capability<&TokenAdminCollection>?
access(self) var addAccountCapability: Capability<auth(LockedTokens.AccountCreator) &TokenAdminCollection>?
Copy link
Member Author

Choose a reason for hiding this comment

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

This will be migrated by default, correct? We don't need a custom migration for this?

Copy link
Contributor

@sisyphusSmiling sisyphusSmiling Apr 24, 2024

Choose a reason for hiding this comment

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

I believe so since the prior capability was on the resource, but I'd want to double check with @turbolent

Copy link
Member

Choose a reason for hiding this comment

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

Please try migrating the contract and see if the entitlement is inferred to be required now. From what I can see, it should and no custom migration should be required (if someone had a &TokenAdminCollection before, they now need auth(LockedTokens.AccountCreator) to keep using it the same way)

@@ -661,14 +661,16 @@ access(all) contract LockedTokens {
}
}

access(all) entitlement AccountCreator
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
access(all) entitlement AccountCreator
access(all) entitlement AccountCreator

Copy link
Contributor

@sisyphusSmiling sisyphusSmiling left a comment

Choose a reason for hiding this comment

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

Approving to unblock as I think this should migrate just fine. But might be worth a sanity check from someone more familiar with migration patterns

@joshuahannan joshuahannan merged commit 272832a into stable-cadence Apr 24, 2024
2 checks passed
@joshuahannan joshuahannan deleted the add-entitlement branch April 24, 2024 16:43
joshuahannan added a commit that referenced this pull request Jun 12, 2024
* update to view functions for stable cadence

* Update to newest Stable Cadence Preview (#371)

* update to view functions for stable cadence

* remove unreachable code

* update templates to Stable Cadence

* update to Stable Cadence preview 4

* update for stable cadence

* fix parse error

---------

Co-authored-by: Josh Hannan <[email protected]>
Co-authored-by: Bastian Müller <[email protected]>

* remove casting and fix conflicts

* integrate ft and nft stable cadence changes, use access, view, and entitlements

* use v2 ft and nft

* use string for nft import

* update token deps

* update token deps

* update nft dependecy

* update nft dep

* update ft dep

* add more view

* update FlowToken contract getter to explicitly use metadata views

* implement new standard methods

* update nft dependency

* update ft dep

* fix FungibleToken.Vault types and imports

* remove view from copy

* add correct vault type

* remove views and update balances

* use vault interface type

* remove restricted types

* remove AnyStruct

* remove type restrictions

* fix view modifiers in epoch contracts

* remove view for dkgCompleted

* remove non-view methods from pre-conditions

* use setter methods in QC

* remove pub from QC

* add fun keyword

* use setters for fields and use getBalance

* use view keyword

* remove restricted types from flow epoch

* use setters in FlowEpoch

* correct metadata types

* use UInt64 in NodeVersionBeacon

* dont use restricted types in locked tokens and staking collection

* make LockedTokens compatible with FungibleToken

* use entitlement for manager

* correct entitlement syntax

* fix entitlement issues with locked tokens

* fix entitlement issues with staking collection

* fix entitlement return types

* add withdrawable to machine account functions

* replace addresses and fix transactions and scripts

* fixes to epoch tests

* update to latest token standards and update locked tokens transactions

* Update contracts

* Update more contracts

* Update contracts

* Update contarcts and transactions

* go mod tidy

* Update flow-sdk

* Update more contracts

* Update ft/nft deps

* Generate assets

* Update more cadence codes

* Update staking collection

* Update go mods

* Fix typo

* Replace get()+borrow() with borrow()

* Refactor code

* Update go-sdk and flow-nft versions

* Fix publish_voter transaction

* Update to Cadence v1.0.0-preview.1

* Apply suggestions from code review

Co-authored-by: Bastian Müller <[email protected]>

* Refactor code

* fix and improve syntax

* use optional chaining and nil-coaelescing instead of force-unwrapping

* Update get_total_balance.cdc

* make sure epoch contracts work with capability controllers and entitlements

* update dependencies and add public burn tokens method

* remove view from getRandomSourceHistoryPage and use account.storage

* remove custom destructors and fix entitlement usage

* get all go tests passing for cadence 1.0

* make ci

* make ci

* update random source transactions

* update cli version for CI

* update go version

* Update Cadence version (#406)

* update Withdrawable and createEmptyVault

* update createEmpty in staking

* use Burner and update dependencies

* update to SDK v1.0.0-M1

* update NFT contracts, remove replace statements

* update to Cadence v1.0.0-M3

* update to Cadence v1.0.0-M3 and SDK v1.0.0-M1

* remove getBalance, add isAvailableToWithdraw

* update ft and nft deps

* update emulator dependencies and get tests passing

* use FungibleToken.Balance instead of FlowToken.Vault

* use correct public path types

* update imports

* go mod tidy

* add fungible token switchboard

* fix switchboard

* update error messages for ledger transactions

* add updated manifests with new account, FT, and NFT transactions and removed locked token staking txs

* update account transactions to use simple arguments

* update manifest to include both styles of token transfer transactions:

* update emulator dependency

* use string args for NFT contracts

* update collection machine account transactions to not use keylist entry

* Update contract getter methods to use env (#410)

* update import addresses to better format and use env

* update deps

* update go mod

* re-add lockedaccountinfo

* update ft and nft dependencies

* get address replacement working in tests and add event emission restrictions for FlowToken

* update to latest emulator, cadence, and token standards versions

* Update README

* Don't copy dictionary in getEpochMetadata (#413)

* Don't copy dictionary in getEpochMetadata

* update NFT contracts

* update ft dependency

* update token standard dependencies

* make ci

* fix algorithm typo and test names

* update nft transactions

* fix typos in transactions

* update nft dependencies

* Add entitlement for locked account creator (#423)

* update deps, add entitlement for locked account creator

* make ci

* update ft dependencies

* remove optional chaining in FlowStakingCollection

* remove optional chaining

* update nft imports and remove unnecessary Burner import from FlowToken

* update dependencies

* Improve random distribution (#428)

* better use of  revertible random with correct types

* improve random distribution

* address PR comments and add entitlements to LockedTokens.TokenManager

* remove UseTokens entitlement

* use view more and update nft deps

* make ci

* add view modifiers

* update dependencies

---------

Co-authored-by: Daniel Sainati <[email protected]>
Co-authored-by: Bastian Müller <[email protected]>
Co-authored-by: Supun Setunga <[email protected]>
Co-authored-by: Bastian Müller <[email protected]>
Co-authored-by: Janez Podhostnik <[email protected]>
Co-authored-by: Tarak Ben Youssef <[email protected]>
kc1116 pushed a commit that referenced this pull request Jun 20, 2024
* update deps, add entitlement for locked account creator

* make ci
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.

3 participants