Smart Contract

DCATransactionHandlerMinimal

A.ca7ee55e4fc3251a.DCATransactionHandlerMinimal

Valid From

135,624,126

Deployed

5d ago
Feb 23, 2026, 12:44:34 AM UTC

Dependents

3 imports
1import FlowTransactionScheduler from 0xe467b9dd11fa00df
2import DCAControllerUnified from 0xca7ee55e4fc3251a
3import DCAPlanUnified from 0xca7ee55e4fc3251a
4import FungibleToken from 0xf233dcee88fe0abe
5import FlowToken from 0x1654653399040a61
6
7/// DCATransactionHandlerMinimal: Absolutely minimal handler (~50 lines)
8/// Tests if scheduler can execute Unified controller operations WITHOUT EVM
9access(all) contract DCATransactionHandlerMinimal {
10
11    access(all) struct SimpleData {
12        access(all) let planId: UInt64
13        init(planId: UInt64) { self.planId = planId }
14    }
15
16    access(all) event Started(transactionId: UInt64, planId: UInt64)
17    access(all) event Completed(transactionId: UInt64, planId: UInt64)
18    access(all) event Failed(transactionId: UInt64, planId: UInt64, reason: String)
19
20    access(all) resource Handler: FlowTransactionScheduler.TransactionHandler {
21        access(self) let controllerCap: Capability<auth(DCAControllerUnified.Owner) &DCAControllerUnified.Controller>
22
23        init(controllerCap: Capability<auth(DCAControllerUnified.Owner) &DCAControllerUnified.Controller>) {
24            pre { controllerCap.check(): "Invalid controller" }
25            self.controllerCap = controllerCap
26        }
27
28        access(FlowTransactionScheduler.Execute) fun executeTransaction(id: UInt64, data: AnyStruct?) {
29            let txData = data as! SimpleData? ?? panic("SimpleData required")
30            emit Started(transactionId: id, planId: txData.planId)
31
32            let controller = self.controllerCap.borrow() ?? panic("No controller")
33            let plan = controller.borrowPlan(id: txData.planId) ?? panic("No plan")
34
35            // Just record execution - NO swap, NO EVM
36            plan.recordExecution(amountIn: plan.amountPerInterval, amountOut: 0.0)
37
38            emit Completed(transactionId: id, planId: txData.planId)
39        }
40
41        access(all) view fun getViews(): [Type] { return [Type<StoragePath>()] }
42        access(all) fun resolveView(_ view: Type): AnyStruct? { return /storage/DCATransactionHandlerMinimal }
43    }
44
45    access(all) fun createHandler(controllerCap: Capability<auth(DCAControllerUnified.Owner) &DCAControllerUnified.Controller>): @Handler {
46        return <- create Handler(controllerCap: controllerCap)
47    }
48
49    access(all) fun createData(planId: UInt64): SimpleData { return SimpleData(planId: planId) }
50}
51