-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathSetup_Account.cdc
More file actions
29 lines (22 loc) · 978 Bytes
/
Setup_Account.cdc
File metadata and controls
29 lines (22 loc) · 978 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// Setup Account
import NftlyToken from 0x7303e5fa678041e4
// This transaction configures an account to store and receive tokens defined by
// the ExampleToken contract.
transaction {
prepare(acct: AuthAccount) {
// Create a new empty Vault object
let vaultA <- NftlyToken.createEmptyVault()
// Store the vault in the account storage
acct.save<@NftlyToken.Vault>(<-vaultA, to: /storage/MainVault)
log("Empty Vault stored")
// Create a public Receiver capability to the Vault
let ReceiverRef = acct.link<&NftlyToken.Vault{NftlyToken.Receiver, NftlyToken.Balance}>(/public/MainReceiver, target: /storage/MainVault)
log("References created")
}
post {
// Check that the capabilities were created correctly
getAccount(0x7696fcb681c1137e).getCapability<&NftlyToken.Vault{NftlyToken.Receiver}>(/public/MainReceiver)
.check():
"Vault Receiver Reference was not created correctly"
}
}