Draft templates/cross chain dca#34
Conversation
Signed-off-by: mmyslblocky <michal.myslinski@blockydevs.com>
Signed-off-by: mmyslblocky <michal.myslinski@blockydevs.com>
Wiz Scan Summary
To detect these findings earlier in the dev lifecycle, try using Wiz Code VS Code Extension. |
There was a problem hiding this comment.
Good detail in packages/cross-chain-dca/README.md, but template branches should treat the project-root README.md as canonical. Right now it still reads like the base scaffold from main (blank / payments-scheduler / hedera-demo), with cross-chain-dca added as a row in the table.
For draft-templates/cross-chain-dca, I'd suggest making the root README fully template-specific: what this template does, prerequisites, setup, deploy, test, and frontend — and link to packages/cross-chain-dca/README.md only for lower-level/package details. We can disregard the inherited main README content rather than trying to maintain both audiences in one file.
Also let's add to the prerequisites a way for users to get sepolia eth into their wallet as it can be cumbersome. Personally I used: https://sepolia-faucet.pk910.de/
Not sure it's actually the best option.
|
Template structure doesn't match Introducing packages/cross-chain-dca as a separate workspace breaks how our templates are consumed. Template branches are expected to follow the standard layout: with As-is, this PR adds Suggestion: fold the contract work into |
|
Missing This branch doesn't include a npx create-scaffold-hbar@latest --template cross-chain-dcaSpecifically,
|
web3buidlerz
left a comment
There was a problem hiding this comment.
Overall the code looks good to me, just some small tweaks to improve UX/DX
| ); | ||
|
|
||
| bool ok = (code == RESPONSE_SUCCESS); | ||
| emit ScheduleAttempted(planId, code, ok); |
There was a problem hiding this comment.
Schedule failure is silent
payments-scheduler reverts on scheduleCall failure; here you only emit ScheduleAttempted. A plan can be created with no future executions if scheduling fails (capacity, expiry, etc.).
Options:
- Revert on initial schedule failure in
createPlan - Pause plan + expose
reschedule(planId) - Pre-check
hasScheduleCapacitybefore scheduling
| deadline: block.timestamp + 300, | ||
| amountIn: amountIn, | ||
| amountOutMinimum: minAmountOut, | ||
| sqrtPriceLimitX96: 0 |
There was a problem hiding this comment.
Swap output custody
Swap proceeds (recipient: address(this)) accumulate in the executor. Only the contract owner (deployer) can withdrawToken — not the Hedera plan creator. Fine for a demo, but please call this out prominently in README/frontend so users don't expect user-owned DCA positions on Sepolia.
Overall — nice work 👍We ran through the template on testnet and the important stuff works: Hedera orchestration, scheduling, and cross-chain execution all behave as described. That's a solid foundation — clearly a lot of thought went into the architecture and scripts. The feedback above is really about two buckets:
Neither changes the underlying design — just gets this ready for the scaffold-hbar ecosystem. Looking forward to the next iteration. |
Signed-off-by: mmyslblocky <michal.myslinski@blockydevs.com>
Signed-off-by: mmyslblocky <michal.myslinski@blockydevs.com>
Signed-off-by: mmyslblocky <michal.myslinski@blockydevs.com>
Signed-off-by: mmyslblocky <michal.myslinski@blockydevs.com>
Signed-off-by: mmyslblocky <michal.myslinski@blockydevs.com>
Signed-off-by: mmyslblocky <michal.myslinski@blockydevs.com>
Signed-off-by: mmyslblocky <michal.myslinski@blockydevs.com>
|
Thank you for your comments during the code review. They helped me better understand the code structure and conventions used in this repository. I have addressed all the points and followed all the recommendations you provided. I hope the updated code now meets the standards and requirements of your repository. |
Signed-off-by: mmyslblocky <michal.myslinski@blockydevs.com>
Thanks @mmyslblocky I will bump this with @web3buidlerz |
|
I am sorry I was on holiday and missed your changes. I am going over them and will do a test for this branch. Will be back with a confirmation asap. Thanks for your contribution! |
|
Great stuff, managed to get through it all. Overall everything is great now, app is functional, structure and readmes are helpful and project structure consistent with already existing templates. I identified a couple of possible issues that we might want to check before we merge:
Step 9/10 failed with HTTP 503 from Sourcify: "Service Unavailable - API v1 Brownout" Because deployAll.ts treats step 9 as a hard failure, step 10 (Sepolia/Etherscan verification) never ran, even though the functional deployment (steps 1–8) was already complete.
Other then that everything is great! |
|
Ok, thank you very much for the review :) . I will look into these two last issues tomorrow and resolve it and get back to you then |
|
@web3buidlerz ok, I resolved the last two points you mentioned
|
|
@mmyslblocky great stuff, looks good, I think we can proceed and merge this one. |
|
@web3buidlerz Thanks! Great to hear that :) |

Cross-Chain DCA Template
This PR adds a cross-chain DCA (Dollar-Cost Averaging) template as a new
packages/cross-chain-dcapackage, demonstrating Hedera as a cross-chain orchestration layer for automated DeFi workflows.Architecture
DcaOrchestratorstores DCA plans and uses the Hedera Schedule Service (HIP-1215) to trigger recurring executions entirely on-chain with no off-chain keepers required.callContractonly — no token bridging).DcaExecutorreceives GMP messages and swaps USDC for the target token via Uniswap v3.What's Included
Smart Contracts (
packages/cross-chain-dca/)DcaOrchestrator.sol— Hedera-side plan manager with self-rescheduling via the Schedule Service precompile.AxelarMessageSender.sol—IBridgeSenderimplementation for Axelar GMP; bridge abstraction makes it swappable.DcaExecutor.sol— Sepolia-side executor that receives GMP messages and executes Uniswap v3 swaps.AxelarMessageReceiver.sol— AxelarIAxelarExecutablebridge between GMP andDcaExecutor.Scripts
deploy-all.sh— Single-command full deployment (Hedera → Sepolia →deployedContracts.tsgeneration).Notable Design Decisions
Self-Rescheduling
No off-chain keeper is required. The orchestrator schedules its next execution during every execution cycle using the Hedera Schedule Service precompile.
Instruction-Only Bridging
The executor is pre-funded with USDC on Sepolia. Token bridging is intentionally out of scope for this template and documented as a future enhancement.
Bridge Abstraction
DcaOrchestratordepends on theIBridgeSenderinterface rather than Axelar directly. Supporting a different bridge provider only requires implementing a newIBridgeSendercontract.Additional Information