Receiver Contracts
Receivers deployed on Stacks mainnet, with their live approval status on the core. Templates show what you can build.
STX Flash Loans
Live on MainnetCore: SP20XD46NGAX05ZQZDKFYCCX49A3852BQABNP0VG5.flashstack-stx-core
Strategy Templates
Build your ownThese are reference implementations showing what you can build with flash loans. Deploy your own version and request whitelisting.
Flash-loan-powered vault liquidator — template for lending protocol liquidations.
Borrow STX, deposit as collateral, borrow again — builds leveraged yield positions.
Atomically swap one collateral type for another without closing your position.
Auto-compound yield by flash-loaning to claim rewards and redeploy.
Build Your Own Receiver
Implement stx-flash-receiver-trait: one function. Lock it to the core with a contract-caller check and repay a hardcoded core, never the core argument. Receivers without this could be drained and were de-approved (finding F-10). Then deploy and DM us to get whitelisted. If your strategy can't repay, the entire tx reverts.
;; Hardened receiver: only the core may call it, and it
;; repays a hardcoded core, never the core argument (F-10)
(impl-trait
'SP3TGRVG7DKGFVRTTVGGS60S59R916FWB4DAB9STZ.stx-flash-receiver-trait.stx-flash-receiver-trait)
(define-constant FLASH-CORE
'SP20XD46NGAX05ZQZDKFYCCX49A3852BQABNP0VG5.flashstack-stx-core)
(define-public (execute-stx-flash (amount uint) (core principal))
(let ((raw-fee (/ (* amount u5) u10000)) ;; 0.05%
(owed (+ amount (if (> raw-fee u0) raw-fee u1))))
(asserts! (is-eq contract-caller FLASH-CORE) (err u401))
(asserts! (is-eq core FLASH-CORE) (err u401))
;; --- YOUR STRATEGY HERE ---
;; arbitrage, liquidate, swap...
(as-contract (stx-transfer? owed tx-sender FLASH-CORE))))
;; Deploy, then ask to be approved on the core