Smart Contract

TestFlowCallbackHandlerV2

A.7d19efcd8e5b4a4a.TestFlowCallbackHandlerV2

Valid From

138,180,427

Deployed

1w ago
Feb 15, 2026, 09:13:13 PM UTC

Dependents

4 imports
1import FlowTransactionSchedulerV2 from 0x7d19efcd8e5b4a4a
2
3access(all) contract TestFlowCallbackHandlerV2 {
4    access(all) let HandlerStoragePath: StoragePath
5    access(all) let HandlerPublicPath: PublicPath
6    
7    access(all) event CallbackExecuted(data: String)
8
9    access(all) resource Handler: FlowTransactionSchedulerV2.TransactionHandler {
10        
11        access(FlowTransactionSchedulerV2.Execute) 
12        fun executeTransaction(id: UInt64, data: AnyStruct?) {
13            if let stringRef = data as? &String {
14                if *stringRef == "fail" {
15                    panic("Callback execution failed as requested")
16                }
17                emit CallbackExecuted(data: *stringRef)
18            } else if let string: String = data as? String {
19                if string == "fail" {
20                    panic("Callback execution failed as requested")
21                }
22                emit CallbackExecuted(data: string)
23            } else {
24                emit CallbackExecuted(data: "bloop")
25            }
26        }
27    }
28
29    access(all) fun createHandler(): @Handler {
30        return <- create Handler()
31    }
32
33    access(all) init() {
34        self.HandlerStoragePath = /storage/testCallbackHandlerV2
35        self.HandlerPublicPath = /public/testCallbackHandlerV2
36    }
37}