github.com/DapperCollectives/CAST/backend@v0.0.0-20230921221157-1350c8be7c96/main/cadence/nba/transactions/admin/add_play_to_set.cdc (about) 1 import TopShot from 0xf8d6e0586b0a20c7 2 3 // This transaction is how a Top Shot admin adds a created play to a set 4 5 // Parameters: 6 // 7 // setID: the ID of the set to which a created play is added 8 // playID: the ID of the play being added 9 10 transaction(setID: UInt32, playID: UInt32) { 11 12 // Local variable for the topshot Admin object 13 let adminRef: &TopShot.Admin 14 15 prepare(acct: AuthAccount) { 16 17 // borrow a reference to the Admin resource in storage 18 self.adminRef = acct.borrow<&TopShot.Admin>(from: /storage/TopShotAdmin) 19 ?? panic("Could not borrow a reference to the Admin resource") 20 } 21 22 execute { 23 24 // Borrow a reference to the set to be added to 25 let setRef = self.adminRef.borrowSet(setID: setID) 26 27 // Add the specified play ID 28 setRef.addPlay(playID: playID) 29 } 30 31 post { 32 33 TopShot.getPlaysInSet(setID: setID)!.contains(playID): 34 "set does not contain playID" 35 } 36 }