TransactionSEALED

○▪*▒█$~@╳?╱○●▒▒◇□$$◇$█&!░◇▓~■╱&╳▒~□╳&╳█■@█╳◆╲●▒*▒$█╳╲@╳*▪░%□█○&#

Transaction ID

Timestamp

Sep 05, 2024, 12:47:02 PM UTC
1y ago

Block Height

86,041,824

Computation

0

Proposerseq:3 key:1

Authorizers

1

Transaction Summary

Transaction

Script Arguments

0amountUFix64
7.39321248

Cadence Script

1import NonFungibleToken from 0x1d7e57aa55817448
2import FungibleToken from 0xf233dcee88fe0abe
3import MetadataViews from 0x1d7e57aa55817448
4import FlowToken from 0x1654653399040a61
5
6import FlowRewards from 0xa45ead1cf1ca9eda
7
8/// Locks a given amount of FLOW tokens in the Flow Rewards contract
9///
10/// @param amount: The amount of FLOW tokens to lock
11///
12/// @emits FlowRewards.Minted, FlowRewards.Locked, FlowRewards.Deposit
13///
14transaction(amount: UFix64) {
15
16    var newID: UInt64?
17    let collection: &FlowRewards.Collection
18    let funds: @FlowToken.Vault
19
20    prepare(signer: auth(BorrowValue, SaveValue, IssueStorageCapabilityController, PublishCapability, UnpublishCapability) &Account) {
21        self.newID = nil
22
23        let sourceVault = signer.storage.borrow<auth(FungibleToken.Withdraw) &FlowToken.Vault>(
24                from: /storage/flowTokenVault
25            ) ?? panic("Could not borrow a reference to signer's Flow Vault")
26        self.funds <- sourceVault.withdraw(amount: amount) as! @FlowToken.Vault
27        
28        if signer.storage.type(at: FlowRewards.CollectionStoragePath) == nil {
29            let newCollection <- FlowRewards.createEmptyCollection(nftType: Type<@FlowRewards.NFT>())
30            signer.storage.save(<-newCollection, to: FlowRewards.CollectionStoragePath)
31            signer.capabilities.unpublish(FlowRewards.CollectionPublicPath)
32            let publicCap = signer.capabilities.storage.issue<&FlowRewards.Collection>(
33                    FlowRewards.CollectionStoragePath
34                )
35            signer.capabilities.publish(publicCap, at: FlowRewards.CollectionPublicPath)
36        }
37
38        self.collection = signer.storage.borrow<&FlowRewards.Collection>(from: FlowRewards.CollectionStoragePath)
39            ?? panic("The signer does not have a Flow Rewards Collection initialized for their account.")
40    }
41
42    execute {
43        self.newID = self.collection.initLock(<-self.funds)
44    }
45
46    post {
47        self.newID != nil: "Locking failed"
48        self.collection.borrowNFT(self.newID!) != nil: "NFT was not deposited to Collection"
49    }
50}