A flash loan smart contract coordinates borrowing, borrower logic, and repayment checks within one transaction. If the lender’s required conditions are not met, the transaction can revert rather than leave the loan outstanding. The exact callback and settlement rules depend on the particular contract and network; atomic execution does not guarantee that the borrower’s operation succeeds or is profitable.
What a flash loan smart contract does
A smart contract is code and data deployed through cryptographically signed transactions on a blockchain network. In a flash-loan arrangement, a lender contract makes assets available under conditions that require the borrowing and settlement process to occur as part of one transaction. The borrower’s contract uses a callback—a function the lender calls during that process—to run its requested logic before the lender checks the outcome.
The key property is transaction atomicity: the transaction is treated as one execution, not as separate completed steps that can be independently kept. Smart-contract execution requires participating nodes to derive the same result, with execution results recorded on the blockchain. If execution cannot satisfy the conditions, the transaction may be reverted under the network and contract’s rules.
This describes a mechanism, not a universal product. Which assets can be borrowed, how the callback is structured, and what must be returned are implementation-specific. A flash loan is therefore distinct from an ordinary loan that can remain outstanding after a transaction ends: the lender’s contract enforces its own settlement condition during the transaction.
The transaction lifecycle: request, callback, and settlement
A typical flow has three participants or roles: the borrower’s contract, the lender contract, and the blockchain network executing the transaction. A wallet or application may help construct and submit the transaction, but the lender’s code and borrower’s code govern the onchain interactions described here.
- Request: The borrower’s contract calls the lender contract with a request, which may specify assets and amounts. The supported request format and terms are determined by that lender’s implementation.
- Callback: The lender makes the requested assets available and calls the borrower’s designated callback within the same transaction. The borrower contract runs its logic while the assets are available. That logic may involve other contract calls, so its result depends on those interactions and the execution conditions at that time.
- Settlement check: After the callback returns, the lender checks whether its repayment and other required conditions have been met. The particular contract defines what it checks and how it accounts for any required amount.
- Completion or reversion: If the checks pass, execution can complete with the loan settled according to the contract’s rules. If a required condition fails, the transaction can revert. The outcome is specific to the code and network; it should not be assumed that every system implements the same callback, repayment check, or failure path.
The callback is the central handoff. It lets the borrower’s contract perform its operations before the lender makes its final settlement decision. But a callback is not a promise that the borrower will receive the expected result. It is a point in execution at which the borrower’s logic and any called contracts must behave as required for the complete transaction to succeed.
Atomic borrowing is not the same as guaranteed success
Atomicity constrains the outcome of the transaction; it does not guarantee that the borrower’s logic will work, that the desired assets will be available, or that the transaction will produce a gain. The contract may enforce repayment while the borrower’s intended operation still fails to achieve its objective. A reverted transaction is a failed execution, not evidence that the strategy would have succeeded if it were allowed to continue.
Nor does “revert” necessarily mean that attempting the transaction has no cost. On Ethereum, smart-contract deployment and execution are constrained by gas. The exact cost and treatment of failed execution depend on the network’s rules and the transaction involved, so readers should not infer a universal fee outcome from the word “atomic.”
Asset support, fees, availability, and operating constraints are also not properties of flash loans as a general concept. They depend on the particular lender, contracts, assets, and network. Without implementation-specific evidence, claims that a mechanism supports a given asset, is currently available, or has a particular cost should not be generalized.
Contract assumptions and failure points
The flow depends on the lender and borrower contracts agreeing on the callback and settlement behavior. If the borrower does not respond as expected, cannot meet the lender’s repayment condition, or encounters an execution failure during its logic, the transaction may not complete. A contract can enforce only the conditions encoded in its implementation; the existence of an enforcement check alone does not establish that the entire interaction is correct or safe.
Interactions with other contracts add dependencies. A borrower’s callback can rely on external code and on conditions that may differ by transaction execution. Public transaction visibility, execution ordering, pool depth, and price impact can affect an AMM swap before block inclusion. That is a general feature of public-blockchain AMM execution, not a claim that every flash loan uses an AMM or that ordering determines every outcome.
A useful conceptual review asks where assets move, what the callback is expected to do, which conditions the lender checks afterward, and what happens when any step fails. This is not an implementation or audit procedure. Deployment decisions require attention to the exact code and its dependencies, not just a high-level description of a flash-loan pattern.
What to verify before relying on a flash-loan mechanism
For a specific mechanism, check authoritative, current materials for the relevant contract and network. Confirm the callback sequence, repayment conditions, supported assets, fees, and operational constraints from implementation-specific documentation or code rather than assuming uniform terms.
Look for security-review evidence and read its stated scope. An audit or review is evidence about the work it covered, not a guarantee that all contract behavior, dependencies, or future conditions are safe. For legal, regulatory, tax, or compliance questions, consult qualified sources specific to the relevant jurisdiction; the transaction lifecycle described here does not answer those questions.
Sources and references
- Introduction to smart contracts — ethereum.org; retrieved 2026-10-19.
- Smart contract - Glossary — National Institute of Standards and Technology; retrieved 2026-10-19.
- Smart contract - Glossary — National Institute of Standards and Technology; retrieved 2026-10-18.