You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If there are any functions that modify privileged state that also need to be callable from external code, use [entitlements] for the access modifiers for those functions:
5637
5637
5638
5638
```cadence
5639
-
/// Simplified Vault implementation
5639
+
/// Declare Entitlements at the contract level — entitlements are
5640
+
/// namespaced to their contract and referenced by access modifiers
5641
+
/// on the contract's resources, structs, and functions.
5642
+
access(all) entitlement Owner
5643
+
5640
5644
/// Simplified Bank Account implementation
5641
5645
access(all) resource BankAccount {
5642
5646
5643
-
/// Declare Entitlements for state-modifying functions
5644
-
access(all) entitlement Owner
5645
-
5646
5647
/// Fields should default to access(self) just to be safe
5647
5648
access(self) var balance: UFix64
5648
5649
@@ -5694,7 +5695,7 @@ When issuing a capability, a capability of the same type might already be presen
5694
5695
var flowTokenVaultCap: Capability<auth(FungibleToken.Withdraw) &FlowToken.Vault>? = nil
5695
5696
5696
5697
// Get all the capabilities that have already been issued for the desired storage path
5697
-
let flowTokenVaultCaps = account.capabilities.storage.getControllers(forPath: /storage/flowTokenVault)
5698
+
let flowTokenVaultCaps = signer.capabilities.storage.getControllers(forPath: /storage/flowTokenVault)
5698
5699
5699
5700
// Iterate through them to see if there is already one of the needed type
5700
5701
for cap in flowTokenVaultCaps {
@@ -5708,7 +5709,7 @@ When issuing a capability, a capability of the same type might already be presen
5708
5709
// issue a new one
5709
5710
if flowTokenVaultCap == nil {
5710
5711
// issue a new entitled capability to the flow token vault
If there are any functions that modify privileged state that also need to be callable from external code, use [entitlements] for the access modifiers for those functions:
457260
457260
457261
457261
```cadence
457262
-
/// Simplified Vault implementation
457262
+
/// Declare Entitlements at the contract level — entitlements are
457263
+
/// namespaced to their contract and referenced by access modifiers
457264
+
/// on the contract's resources, structs, and functions.
457265
+
access(all) entitlement Owner
457266
+
457263
457267
/// Simplified Bank Account implementation
457264
457268
access(all) resource BankAccount {
457265
457269
457266
-
/// Declare Entitlements for state-modifying functions
457267
-
access(all) entitlement Owner
457268
-
457269
457270
/// Fields should default to access(self) just to be safe
457270
457271
access(self) var balance: UFix64
457271
457272
@@ -457317,7 +457318,7 @@ When issuing a capability, a capability of the same type might already be presen
457317
457318
var flowTokenVaultCap: Capability<auth(FungibleToken.Withdraw) &FlowToken.Vault>? = nil
457318
457319
457319
457320
// Get all the capabilities that have already been issued for the desired storage path
457320
-
let flowTokenVaultCaps = account.capabilities.storage.getControllers(forPath: /storage/flowTokenVault)
457321
+
let flowTokenVaultCaps = signer.capabilities.storage.getControllers(forPath: /storage/flowTokenVault)
457321
457322
457322
457323
// Iterate through them to see if there is already one of the needed type
457323
457324
for cap in flowTokenVaultCaps {
@@ -457331,7 +457332,7 @@ When issuing a capability, a capability of the same type might already be presen
457331
457332
// issue a new one
457332
457333
if flowTokenVaultCap == nil {
457333
457334
// issue a new entitled capability to the flow token vault
0 commit comments