TransactionSEALED

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

Transaction ID

Timestamp

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

Block Height

86,041,824

Computation

0

Proposerseq:36 key:0

Authorizers

1

Transaction Summary

Transaction

Script Arguments

0amountUnderlyingToRedeemUFix64
100.00000000

Cadence Script

1import FlowToken from 0x1654653399040a61
2import FungibleToken from 0xf233dcee88fe0abe
3import LendingPool from 0x7492e2f9b4acea9a
4import LendingComptroller from 0xf80cb737bfe7c792
5import LendingConfig from 0x2df970b6cdee5735
6import LendingInterfaces from 0x2df970b6cdee5735
7
8transaction(amountUnderlyingToRedeem: UFix64) {
9    let tokenVault: &FlowToken.Vault
10    let userCertificate: &{LendingInterfaces.IdentityCertificate}
11
12    prepare(signer: auth(Storage, Capabilities) &Account) {
13        let storagePath = /storage/flowTokenVault
14        let receiverPath = /public/flowTokenReceiver
15        let balancePath = /public/flowTokenBalance
16        if (signer.storage.borrow<&FlowToken.Vault>(from: storagePath) == nil) {
17            signer.storage.save(<-FlowToken.createEmptyVault(vaultType: Type<@FlowToken.Vault>()), to: storagePath)
18            signer.capabilities.publish(
19                signer.capabilities.storage.issue<&{FungibleToken.Receiver}>(storagePath),
20                at: receiverPath
21            )
22            signer.capabilities.publish(
23                signer.capabilities.storage.issue<&{FungibleToken.Balance}>(storagePath),
24                at: balancePath
25            )
26        }
27        self.tokenVault = signer.storage.borrow<&FlowToken.Vault>(from: storagePath) ?? panic("cannot borrow reference to FlowToken Vault")
28
29        // Get protocol-issued user certificate
30        if (signer.storage.borrow<&{LendingInterfaces.IdentityCertificate}>(from: LendingConfig.UserCertificateStoragePath) == nil) {
31            destroy <-signer.storage.load<@AnyResource>(from: LendingConfig.UserCertificateStoragePath)
32            let userCertificate <- LendingComptroller.IssueUserCertificate()
33            signer.storage.save(<-userCertificate, to: LendingConfig.UserCertificateStoragePath)
34        }
35        self.userCertificate = signer.storage.borrow<&{LendingInterfaces.IdentityCertificate}>(from: LendingConfig.UserCertificateStoragePath)
36            ?? panic("cannot borrow reference to UserCertificate")
37    }
38
39    execute {
40        let redeemedVault <- LendingPool.redeemUnderlying(userCertificate: self.userCertificate, numUnderlyingToRedeem: amountUnderlyingToRedeem)
41        self.tokenVault.deposit(from: <-redeemedVault)
42    }
43}