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

0idUInt64
191315024220341
1amountUFix64
12.25000000

Cadence Script

1import FungibleToken from 0xf233dcee88fe0abe
2import FlowToken from 0x1654653399040a61
3
4import FlowRewards from 0xa45ead1cf1ca9eda
5import FlowRewardsMetadataViews from 0xa45ead1cf1ca9eda
6
7/// Adds a lockup to an existing FlowRewards NFT
8///
9/// @param id: The ID of the NFT to add the lockup to
10/// @param amount: The amount of FLOW to lockup
11///
12/// @emits FlowRewards.Locked
13///
14transaction(id: UInt64, amount: UFix64) {
15
16    let preLockupTotal: UFix64
17    let nft: &FlowRewards.NFT
18    let funds: @FlowToken.Vault
19
20    prepare(signer: auth(BorrowValue) &Account) {
21
22        let sourceVault = signer.storage.borrow<auth(FungibleToken.Withdraw) &FlowToken.Vault>(
23                from: /storage/flowTokenVault
24            ) ?? panic("Could not borrow a reference to signer's Flow Vault")
25        self.funds <- sourceVault.withdraw(amount: amount) as! @FlowToken.Vault
26
27        let collection = signer.storage.borrow<&FlowRewards.Collection>(from: FlowRewards.CollectionStoragePath)
28            ?? panic("Could not borrow a reference to signer's FlowRewards Collection")
29        self.nft = collection.borrowNFT(id) as! &FlowRewards.NFT?
30            ?? panic("NFT with id ".concat(id.toString()).concat(" not found"))
31
32        self.preLockupTotal = (self.nft.resolveView(Type<FlowRewardsMetadataViews.LockOverview>()) as! FlowRewardsMetadataViews.LockOverview?)!.totalLocked
33    }
34
35    execute {
36        self.nft.addLockup(<-self.funds)
37    }
38
39    post {
40        FlowRewards.getLockupTotal(forNFT: id) == self.preLockupTotal + amount: "Lockup failed"
41    }
42}