Skip to content

Commit 4f77b75

Browse files
committed
Debug tx
1 parent 85b9e88 commit 4f77b75

File tree

1 file changed

+15
-17
lines changed

1 file changed

+15
-17
lines changed
Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,32 @@
11
import "ExampleToken"
22

3-
// This transaction mints tokens and deposits them into account 0x02's vault
3+
// This transaction mints tokens and deposits them into the caller's vault
44
transaction {
55

66
// Local variable for storing the reference to the minter resource
7-
let mintingRef: auth(MintEntitlement) &ExampleToken.VaultMinter
7+
let mintingRef: &ExampleToken.VaultMinter
88

9-
// Local variable for storing the reference to the Vault of
10-
// the account that will receive the newly minted tokens
11-
var receiver: Capability<&ExampleToken.Vault{ExampleToken.Receiver}>
9+
// Local variable for storing the receiver capability of the caller
10+
var receiver: Capability<&{ExampleToken.Receiver}>
1211

1312
prepare(acct: auth(Storage, Capabilities) &Account) {
1413
// Borrow a reference to the stored, private minter resource
15-
self.mintingRef = acct.capabilities.storage.borrow<&ExampleToken.VaultMinter>(
16-
from: /storage/MainMinter
14+
let minter = acct.storage.borrow<&ExampleToken.VaultMinter>(
15+
from: /storage/CadenceFungibleTokenTutorialMinter
1716
) ?? panic("Could not borrow a reference to the minter")
17+
self.mintingRef = minter
1818

19-
// Get the public account object for account 0x02
20-
let recipient = getAccount(0x02)
21-
22-
// Get their public receiver capability
23-
self.receiver = recipient.capabilities.borrow<&ExampleToken.Vault{ExampleToken.Receiver}>(
24-
/public/MainReceiver
25-
) ?? panic("Could not borrow the receiver capability from account 0x02")
19+
// Issue a Receiver capability for the caller's Vault
20+
let receiverCap = acct.capabilities.storage.issue<&{ExampleToken.Receiver}>(
21+
/storage/CadenceFungibleTokenTutorialVault
22+
)
23+
self.receiver = receiverCap
2624
}
2725

2826
execute {
29-
// Mint 30 tokens and deposit them into the recipient's Vault
27+
// Mint 30 tokens and deposit them into the caller's Vault
3028
self.mintingRef.mintTokens(amount: 30.0, recipient: self.receiver)
3129

32-
log("30 tokens minted and deposited to account 0x02")
30+
log("30 tokens minted and deposited to the caller's account")
3331
}
34-
}
32+
}

0 commit comments

Comments
 (0)