-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TestWrappedDepositDoesntWorkDifferentAddress (#32)
I think this meets the intent of the test, but not 100% sure: mint to wrong account Co-authored-by: ash <[email protected]>
- Loading branch information
1 parent
fdcbbef
commit 8cd20e3
Showing
2 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import "FungibleToken" | ||
import "FlowtyWrapped" | ||
import "NonFungibleToken" | ||
import "MetadataViews" | ||
import "WrappedEditions" | ||
|
||
transaction(address: Address, wrongAccount:Address, username: String, ticket: Int, totalNftsOwned: Int, floatCount: Int, favoriteCollections: [String], collections: [String]) { | ||
// local variable for storing the minter reference | ||
let minter: &FlowtyWrapped.Admin | ||
|
||
prepare(acct: AuthAccount) { | ||
//borrow a reference to the NFTMinter resource in storage | ||
self.minter = acct.borrow<&FlowtyWrapped.Admin>(from: FlowtyWrapped.AdminStoragePath) | ||
?? panic("Could not borrow a reference to the NFT minter") | ||
} | ||
|
||
execute { | ||
let wrapped2023Data = WrappedEditions.Wrapped2023Data( | ||
username, | ||
ticket, | ||
totalNftsOwned, | ||
floatCount, | ||
favoriteCollections, | ||
collections | ||
) | ||
let data: {String: AnyStruct} = { | ||
"wrapped": wrapped2023Data | ||
} | ||
let receiver = getAccount(wrongAccount).getCapability<&{NonFungibleToken.CollectionPublic}>(FlowtyWrapped.CollectionPublicPath).borrow()! | ||
let nft <- self.minter.mintNFT(editionName: "Flowty Wrapped 2023", address: address, data: data ) | ||
receiver.deposit(token: <-nft) | ||
|
||
} | ||
} |