Smart Contract

TestFlowCallbackHandlerFlat

A.7d19efcd8e5b4a4a.TestFlowCallbackHandlerFlat

Valid From

140,592,747

Deployed

1w ago
Feb 16, 2026, 08:35:37 PM UTC

Dependents

2 imports
1import FlowTransactionSchedulerFlat from 0x7d19efcd8e5b4a4a
2
3access(all) contract TestFlowCallbackHandlerFlat {
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: FlowTransactionSchedulerFlat.TransactionHandler {
10
11        access(FlowTransactionSchedulerFlat.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/testCallbackHandlerFlat
35        self.HandlerPublicPath = /public/testCallbackHandlerFlat
36    }
37}
38