TransactionSEALED
?%╳█▒!□╱□&$▪██!%▒○@#░○█?▒╱?#□●&^&╱~●▫●◇@◆●@▫╲^^○%^▫▓○■%▪█▓█░&^●◇
Transaction ID
Execution Fee
0.00003374 FLOWTransaction Summary
Contract Call
Called FlowToken, FungibleToken, NonFungibleToken +6 more
Script Arguments
Copy:
0proposalIdUInt64
194613559716791
1choiceInt
2
Cadence Script
1import FlowToken from 0x1654653399040a61
2import FungibleToken from 0xf233dcee88fe0abe
3import NonFungibleToken from 0x1d7e57aa55817448
4import MetadataViews from 0x1d7e57aa55817448
5import Fixes from 0xd2abb5dbf5e08666
6import FixesInscriptionFactory from 0xd2abb5dbf5e08666
7import FRC20SemiNFT from 0xd2abb5dbf5e08666
8import FRC20Votes from 0xd2abb5dbf5e08666
9import FRC20VoteCommands from 0xd2abb5dbf5e08666
10
11transaction(
12 proposalId: UInt64,
13 choice: Int,
14) {
15 let voter: auth(NonFungibleToken.Withdraw) &FRC20Votes.VoterIdentity
16
17 prepare(acct: auth(Storage, Capabilities) &Account) {
18 /** ------------- Prepare the Inscription Store - Start ---------------- */
19 let storePath = Fixes.getFixesStoreStoragePath()
20 if acct.storage
21 .borrow<auth(Fixes.Manage) &Fixes.InscriptionsStore>(from: storePath) == nil {
22 acct.storage.save(<- Fixes.createInscriptionsStore(), to: storePath)
23 }
24
25 let store = acct.storage
26 .borrow<auth(Fixes.Manage) &Fixes.InscriptionsStore>(from: storePath)
27 ?? panic("Could not borrow a reference to the Inscriptions Store!")
28 /** ------------- End -------------------------------------------------- */
29
30 /** ------------- Start -- FRC20 Semi NFT Collection Initialization ------------ */
31 // ensure resource
32 if acct.storage.borrow<&AnyResource>(from: FRC20SemiNFT.CollectionStoragePath) == nil {
33 acct.storage.save(<- FRC20SemiNFT.createEmptyCollection(nftType: Type<@FRC20SemiNFT.NFT>()), to: FRC20SemiNFT.CollectionStoragePath)
34 }
35
36 // link to public capability
37 if acct
38 .capabilities.get<&FRC20SemiNFT.Collection>(FRC20SemiNFT.CollectionPublicPath)
39 .borrow() == nil {
40 acct.capabilities.unpublish(FRC20SemiNFT.CollectionPublicPath)
41 acct.capabilities.publish(
42 acct.capabilities.storage.issue<&FRC20SemiNFT.Collection>(
43 FRC20SemiNFT.CollectionStoragePath
44 ),
45 at: FRC20SemiNFT.CollectionPublicPath
46 )
47 }
48 /** ------------- End ---------------------------------------------------------- */
49
50 /** ------------- Initialize Voter Resource - Start -------------------- */
51 if acct.storage.borrow<&AnyResource>(from: FRC20Votes.VoterStoragePath) == nil {
52 // get private cap
53 let cap = acct.capabilities.storage
54 .issue<auth(NonFungibleToken.Withdraw, NonFungibleToken.Update) &FRC20SemiNFT.Collection>(FRC20SemiNFT.CollectionStoragePath)
55 acct.storage.save(<- FRC20Votes.createVoter(cap), to: FRC20Votes.VoterStoragePath)
56 }
57
58 // link to public capability
59 if acct
60 .capabilities
61 .get<&FRC20Votes.VoterIdentity>(FRC20Votes.VoterPublicPath)
62 .borrow() == nil {
63 acct.capabilities.unpublish(FRC20Votes.VoterPublicPath)
64 acct.capabilities.publish(
65 acct.capabilities.storage.issue<&FRC20Votes.VoterIdentity>(
66 FRC20Votes.VoterStoragePath
67 ),
68 at: FRC20Votes.VoterPublicPath
69 )
70 }
71 /** ------------- End -------------------------------------------------- */
72
73 self.voter = acct.storage.borrow<auth(NonFungibleToken.Withdraw) &FRC20Votes.VoterIdentity>(from: FRC20Votes.VoterStoragePath)
74 ?? panic("Could not borrow a reference to the Voter Resource!")
75 }
76
77 execute {
78 // Singleton Resources
79 let voteMgr = FRC20Votes.borrowVotesManager()
80 voteMgr.vote(voter: self.voter, proposalId: proposalId, choice: choice)
81 }
82}