Source a flow input by borrowing the amount from a flashloan provider, repaid within the same transaction.
Not public yet. Contact us to get early access.
flashloan sources a flow input by borrowing the amount from a flashloan provider instead of pulling it from the signer. The borrowed amount is made available to the flow as its input, so the rest of the flow can spend capital the user doesn’t hold upfront.Because a flashloan must be repaid in the same transaction, a flow that borrows via this materialiser must settle the loan (principal + the provider’s fee) before it ends — typically with one or more lifi.flashloanRepay ops. If the loan isn’t repaid, simulation reverts.Config:
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"LI.FI","description":"Get the best price execution for any swaps and bridging across EVM chains, Solana, Bitcoin and alt-VMs. Enable trading across all DEX aggregators, bridges, and intent-systems and save hundreds of developer hours.","colors":{"primary":"#5C67FF","light":"#fab6f4","dark":"#5C67FF"},"logo":{"light":"https://mintcdn.com/lifi/EmProAEgMrruLUbI/logo/light.png?fit=max\u0026auto=format\u0026n=EmProAEgMrruLUbI\u0026q=85\u0026s=f435348680e682acea6e3b9af339ed7a","dark":"https://mintcdn.com/lifi/EmProAEgMrruLUbI/logo/dark.png?fit=max\u0026auto=format\u0026n=EmProAEgMrruLUbI\u0026q=85\u0026s=d02539147db168291d7c711beb45d10b"},"favicon":"https://mintcdn.com/lifi/jEGN0oG6bNsdv0a3/logo/favicon.svg?fit=max\u0026auto=format\u0026n=jEGN0oG6bNsdv0a3\u0026q=85\u0026s=35fb6353ca8815e24daf1025135fef38","api":{"openapi":"openapi.yaml"},"appearance":{"default":"dark"},"background":{"color":{"light":"#FAFAFF","dark":"#000B29"}},"navbar":{"links":[{"href":"https://lifihelp.zendesk.com/hc/en-us","label":"Support"}],"primary":{"type":"button","label":"Get Started","href":"https://portal.li.fi/signup"}},"footer":{"socials":{"x":"https://x.com/lifiprotocol","github":"https://github.com/lifinance","website":"https://li.fi/"},"links":[{"header":"Company","items":[{"label":"Careers","href":"https://li.fi/careers"},{"label":"Brand Assets","href":"https://li.fi/brand-assets"},{"label":"About","href":"https://li.fi/"}]},{"header":"Tools","items":[{"label":"LI.FI Explorer","href":"https://explorer.li.fi/?utm_source=lifi\u0026utm_medium=footer_link_tools\u0026utm_campaign=lifi_to_explorer"}]},{"header":"Legal","items":[{"label":"Privacy Policy","href":"https://li.fi/legal/privacy-policy"},{"label":"Terms of Service","href":"https://li.fi/legal/terms-and-conditions"},{"label":"Imprint","href":"https://li.fi/legal/imprint"}]}]},"styling":{"eyebrows":"section","codeblocks":"system","latex":false},"integrations":{"ga4":{"measurementId":"G-NTE1P73M4Q"}},"contextual":{"options":["copy","view","chatgpt","claude"],"display":"header"},"navigation":{"languages":[{"language":"en","href":"introduction/introduction"},{"language":"zh-Hans","href":"zh-Hans/introduction/introduction"}]}},"deployment":{"deploymentMetadataValue":{"subdomain":"lifi","hasAudioNarration":false,"actualSubdomain":"lifi","customDomains":["docs.li.fi"],"gitSource":{"type":"github","owner":"lifinance","repo":"public-docs","deployBranch":"main","contentDirectory":"","isPrivate":true,"mountPath":"","label":""},"chroma":{"liveDeploymentHistoryId":"6ae4467b6255dab49421940b","collectionId":"fe96f741-47cb-43b3-b1b9-c7bfc174e641","schemaVersion":"v3","latestBuiltDeploymentHistoryId":"6ae4467b6255dab49421940b"},"entitlements":{"AI_CHAT":{"status":"ENABLED"},"WEB_MCP":{"status":"ENABLED"},"NARRATION":{"status":"ENABLED"}},"buildId":"6ae4467b6255dab49421940b","clientVersion":"0.0.4044","searchFilterCounts":[{"language":"en","tag":"Overview","count":48},{"language":"en","tag":"Composer","count":46},{"language":"zh-Hans","tag":"Composer","count":46},{"language":"zh-Hans","tag":"概述","count":44},{"language":"en","tag":"API Reference","count":34},{"language":"en","tag":"Intents \u0026 Solvers","count":32},{"language":"zh-Hans","tag":"意图与求解器","count":32},{"language":"en","tag":"Integrate via Composer API","count":30},{"language":"zh-Hans","tag":"通过 Composer API 集成","count":30},{"language":"zh-Hans","tag":"API 参考","count":29},{"language":"en","tag":"Reference","count":23},{"language":"en","tag":"For Agents","count":21},{"language":"en","tag":"Widget","count":20},{"language":"zh-Hans","tag":"Widget","count":20},{"language":"zh-Hans","tag":"参考文档","count":19},{"language":"en","tag":"Getting Started","count":16},{"language":"en","tag":"General API","count":16},{"language":"zh-Hans","tag":"通用 API","count":16},{"language":"zh-Hans","tag":"企业级功能","count":15},{"language":"zh-Hans","tag":"入门","count":14}]},"assistantConfig":{},"basePath":"","hasChatPermissions":true,"hasWebMcpPermissions":true,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"byok-sep-25","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"vite-origin","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-updated-9-15","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"sso-setup-deadline-banner","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":false},"customCss":[],"page":{"pagePath":"composer/composer-api/materialisers/flashloan","slug":"/composer/composer-api/materialisers/flashloan","pageMetadata":{"title":"flashloan","description":"Source a flow input by borrowing the amount from a flashloan provider, repaid within the same transaction.","href":"/composer/composer-api/materialisers/flashloan"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Source a flow input by borrowing the amount from a flashloan provider, repaid within the same transaction.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,tbody:`tbody`,td:`td`,th:`th`,thead:`thead`,tr:`tr`,..._provideComponents(),...props.components},{CodeBlock,Heading,Table,Warning}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Table)_missingMdxReference(`Table`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsx(Warning,{children:_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Not public yet.`}),` Contact us to get early access.`]})}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`flashloan`}),` sources a flow input by `,_jsx(_components.strong,{children:`borrowing`}),` the amount from a flashloan provider instead of pulling it from the signer. The borrowed amount is made available to the flow as its input, so the rest of the flow can spend capital the user doesn’t hold upfront.`]}),`\n`,_jsxs(_components.p,{children:[`Because a flashloan must be repaid in the same transaction, a flow that borrows via this materialiser `,_jsx(_components.strong,{children:`must`}),` settle the loan (principal + the provider’s fee) before it ends — typically with one or more `,_jsx(_components.a,{href:`/composer/composer-api/ops`,children:_jsx(_components.code,{children:`lifi.flashloanRepay`})}),` ops. If the loan isn’t repaid, simulation reverts.`]}),`\n`,_jsx(_components.p,{children:`Config:`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Field`}),_jsx(_components.th,{children:`Type`}),_jsx(_components.th,{children:`Notes`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`providerKind`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`'aave-v3' | 'erc3156' | 'balancer-v2' | 'morpho-blue'`})}),_jsx(_components.td,{children:`Which flashloan provider to borrow from. Fees vary by provider (e.g. Aave V3 charges 5 bps; Balancer V2 charges none).`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`amount`})}),_jsx(_components.td,{children:`integer string`}),_jsx(_components.td,{children:`The amount to borrow, in the token’s smallest units.`})]})]})]}),`\n`,_jsx(Heading,{level:`2`,id:`example`,children:`Example`}),`\n`,_jsx(_components.p,{children:`Borrow USDC via an Aave V3 flashloan and settle it within the flow:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`19`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`19`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` builder`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` sdk`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`flow`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`8453`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` name:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'flashloan-borrow'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` inputs:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` borrowed:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` resources`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`erc20`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`USDC`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`8453`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`),`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`});`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:\"// ... spend `builder.inputs.borrowed` across ops, then repay the loan\"})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:\"// (principal + fee) with `lifi.flashloanRepay` before the flow ends ...\"})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` request`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` sdk`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`request`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`builder`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`build`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(), {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` signer:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` OWNER`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` inputs:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` borrowed:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` materialisers`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`flashloan`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` providerKind:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'aave-v3'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` amount:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` '1000000000'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// 1,000 USDC (6 decimals)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }),`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`});`})}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`For a complete, tested flow that uses two concurrent flashloans to migrate a borrow position, see the `,_jsx(_components.a,{href:`/composer/composer-api/recipes/debt-migration`,children:`debt-migration recipe`}),` and `,_jsx(_components.a,{href:`https://github.com/lifinance/composer-sdk-examples/blob/main/examples/staged/aaveToMorphoDebtMigration.ts`,children:_jsx(_components.code,{children:`aaveToMorphoDebtMigration.ts`})}),`. For the minimal borrow-and-repay shape, see `,_jsx(_components.a,{href:`https://github.com/lifinance/composer-sdk-examples/blob/main/examples/staged/flashloanRepay.ts`,children:_jsx(_components.code,{children:`flashloanRepay.ts`})}),`.`]})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"codeStyling":"system","config":{},"pageMetadata":{"title":"flashloan","description":"Source a flow input by borrowing the amount from a flashloan provider, repaid within the same transaction.","href":"/composer/composer-api/materialisers/flashloan"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Example","slug":"example","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":["/_mintlify/custom/lifi/951d8dd0c2dbce84/plausible.js","/_mintlify/custom/lifi/8e3c41579c236ea7/scripts/translate-docs.js","/_mintlify/custom/lifi/b34903975490ec23/scripts/generate-md-redirects.js","/_mintlify/custom/lifi/516472b23ab068ad/scripts/check-links.js","/_mintlify/custom/lifi/70364f7a7384bb43/scripts/markdown-chunker.js","/_mintlify/custom/lifi/6c99617851837b30/scripts/translation-config.js","/_mintlify/custom/lifi/8f88293865b45873/scripts/verify-translation-coverage.js"],"subdomain":"lifi","siteName":"LI.FI","title":"flashloan - LI.FI","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{"en":{"href":"/composer/composer-api/materialisers/flashloan","matchLevel":0},"zh-Hans":{"href":"/zh-Hans/composer/composer-api/materialisers/flashloan","matchLevel":1}}},"lastModified":"2026-07-06T13:36:03.139Z","originalFileLocation":"composer/composer-api/materialisers/flashloan.mdx","locale":"en"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"dark\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Source a flow input by borrowing the amount from a flashloan provider, repaid within the same transaction.\">\u003cmeta data-mint-head name=\"application-name\" content=\"LI.FI\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/lifi/uhSlA1vHRUBoEVMw/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/lifi/uhSlA1vHRUBoEVMw/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/lifi/uhSlA1vHRUBoEVMw/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/lifi/uhSlA1vHRUBoEVMw/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/lifi/uhSlA1vHRUBoEVMw/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/lifi/uhSlA1vHRUBoEVMw/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/lifi/uhSlA1vHRUBoEVMw/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/lifi/uhSlA1vHRUBoEVMw/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/lifi/uhSlA1vHRUBoEVMw/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"flashloan - LI.FI\">\u003cmeta data-mint-head property=\"og:description\" content=\"Source a flow input by borrowing the amount from a flashloan provider, repaid within the same transaction.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"LI.FI\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.li.fi/composer/composer-api/materialisers/flashloan\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://lifi.mintlify.app/_mintlify/api/og/v2?division=Materialisers\u0026amp;title=flashloan\u0026amp;description=Source+a+flow+input+by+borrowing+the+amount+from+a+flashloan+provider%2C+repaid+within+the+same+transaction.\u0026amp;theme=bbd760f308f6962e114ab426\u0026amp;signature=f28f77e2568d0642d909931fccf66607278ee6f2b14166ec826ece4a46ed0259\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"flashloan - LI.FI\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Source a flow input by borrowing the amount from a flashloan provider, repaid within the same transaction.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://lifi.mintlify.app/_mintlify/api/og/v2?division=Materialisers\u0026amp;title=flashloan\u0026amp;description=Source+a+flow+input+by+borrowing+the+amount+from+a+flashloan+provider%2C+repaid+within+the+same+transaction.\u0026amp;theme=bbd760f308f6962e114ab426\u0026amp;signature=f28f77e2568d0642d909931fccf66607278ee6f2b14166ec826ece4a46ed0259\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/lifi/uhSlA1vHRUBoEVMw/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"LI.FI\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#5C67FF\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.li.fi/composer/composer-api/materialisers/flashloan\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/composer/composer-api/materialisers/flashloan.md\">\u003clink data-mint-head rel=\"alternate\" hreflang=\"en\" href=\"https://docs.li.fi/composer/composer-api/materialisers/flashloan\">\u003clink data-mint-head rel=\"alternate\" hreflang=\"zh-Hans\" href=\"https://docs.li.fi/zh-Hans/composer/composer-api/materialisers/flashloan\">\u003clink data-mint-head rel=\"alternate\" hreflang=\"x-default\" href=\"https://docs.li.fi/composer/composer-api/materialisers/flashloan\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.li.fi/#organization\",\"name\":\"LI.FI\",\"url\":\"https://docs.li.fi\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/lifi/EmProAEgMrruLUbI/logo/light.png?fit=max\u0026auto=format\u0026n=EmProAEgMrruLUbI\u0026q=85\u0026s=f435348680e682acea6e3b9af339ed7a\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.li.fi#website\",\"name\":\"LI.FI\",\"url\":\"https://docs.li.fi\",\"publisher\":{\"@id\":\"https://docs.li.fi/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.li.fi/composer/composer-api/materialisers/flashloan#webpage\",\"url\":\"https://docs.li.fi/composer/composer-api/materialisers/flashloan\",\"name\":\"flashloan\",\"description\":\"Source a flow input by borrowing the amount from a flashloan provider, repaid within the same transaction.\",\"dateModified\":\"2026-07-06T13:36:03.139Z\",\"isPartOf\":{\"@id\":\"https://docs.li.fi#website\"},\"breadcrumb\":{\"@id\":\"https://docs.li.fi/composer/composer-api/materialisers/flashloan#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.li.fi/composer/composer-api/materialisers/flashloan#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Integrate via Composer API\",\"item\":\"https://docs.li.fi/composer/composer-api/overview\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Reference\",\"item\":\"https://docs.li.fi/composer/composer-api/reference/flow-wire-format\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Materialisers\",\"item\":\"https://docs.li.fi/composer/composer-api/materialisers/index\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"flashloan\",\"item\":\"https://docs.li.fi/composer/composer-api/materialisers/flashloan\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.li.fi/composer/composer-api/materialisers/flashloan#article\",\"headline\":\"flashloan\",\"name\":\"flashloan\",\"description\":\"Source a flow input by borrowing the amount from a flashloan provider, repaid within the same transaction.\",\"url\":\"https://docs.li.fi/composer/composer-api/materialisers/flashloan\",\"mainEntityOfPage\":{\"@id\":\"https://docs.li.fi/composer/composer-api/materialisers/flashloan#webpage\"},\"dateModified\":\"2026-07-06T13:36:03.139Z\",\"publisher\":{\"@id\":\"https://docs.li.fi/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.li.fi#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"LI.FI\",\"creator\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","siteName":"LI.FI","nav":{"global":null,"languages":[{"language":"en","tabs":[{"tab":"Overview","pages":[{"title":"Overview","href":"/introduction/introduction"}]},{"tab":"Enterprise (New)","pages":[{"title":"Enterprise (New)","href":"/enterprise/overview"}]},{"tab":"API Reference","pages":[{"title":"API Reference","href":"/api-reference/introduction"}]},{"tab":"SDK","pages":[{"title":"SDK","href":"/sdk/overview"}]},{"tab":"Widget","pages":[{"title":"Widget","href":"/widget/overview"}]},{"tab":"Composer","groups":[{"group":"Introduction","pages":[{"title":"Overview","href":"/composer/overview"},{"title":"Composer 101","href":"/composer/composer-101"}]},{"group":"Integrate via Composer API","pages":[{"title":"Overview","href":"/composer/composer-api/overview"},{"group":"Integration Guides","pages":[{"title":"Quickstart","href":"/composer/composer-api/quickstart"},{"title":"Build a Flow","href":"/composer/composer-api/guides/build-a-flow"}]},{"group":"Concepts","pages":[{"title":"Flow Structure","href":"/composer/composer-api/concepts/flow-anatomy"},{"title":"Resource Model","href":"/composer/composer-api/concepts/resources-and-ports"},{"title":"References","href":"/composer/composer-api/concepts/ref-grammar"},{"title":"Execution Model","href":"/composer/composer-api/concepts/execution-model"},{"title":"Guards","href":"/composer/composer-api/concepts/simulation-and-guards"},{"title":"Terminal Resources","href":"/composer/composer-api/concepts/sweeping-and-amounts"}]},{"group":"Recipes","pages":[{"title":"Overview","href":"/composer/composer-api/recipes/index"},{"title":"Dust sweep","href":"/composer/composer-api/recipes/dust-sweep"},{"title":"Swap and Deposit","href":"/composer/composer-api/recipes/swap-and-zap"},{"title":"Split Deposits","href":"/composer/composer-api/recipes/split-and-zap"},{"title":"Debt Migration","href":"/composer/composer-api/recipes/debt-migration"}]},{"group":"Reference","pages":[{"title":"Flow Schema","href":"/composer/composer-api/reference/flow-wire-format"},{"title":"SDK Reference","href":"/composer/composer-api/reference/sdk-api"},{"title":"Errors","href":"/composer/composer-api/reference/error-codes"},{"title":"Addresses","href":"/composer/composer-api/reference/addresses"},{"group":"Ops","pages":[{"title":"Op Catalog","href":"/composer/composer-api/ops/index"},{"title":"lifi.swap","href":"/composer/composer-api/ops/lifi-swap"},{"title":"lifi.zap","href":"/composer/composer-api/ops/lifi-zap"},{"title":"core.call","href":"/composer/composer-api/ops/core-call"}]},{"group":"Materialisers","pages":[{"title":"Materialisers catalog","href":"/composer/composer-api/materialisers/index"},{"title":"balanceOf","href":"/composer/composer-api/materialisers/balance-of"},{"title":"call","href":"/composer/composer-api/materialisers/call"},{"title":"directDeposit","description":"Deposit tokens into the VM — native via msg.value, ERC-20 via transferFrom","href":"/composer/composer-api/materialisers/direct-deposit"},{"title":"flashloan","href":"/composer/composer-api/materialisers/flashloan"}]},{"group":"Guard Types","pages":[{"title":"Guards catalog","description":"Every guard registered in the compose manifest.","href":"/composer/composer-api/guards/index"},{"title":"slippage","href":"/composer/composer-api/guards/slippage"},{"title":"core.numericInvariant","href":"/composer/composer-api/guards/numeric-invariant"}]}]}]},{"group":"Integrate via LI.FI API","pages":[{"title":"Overview","href":"/composer/lifi-api/overview"},{"group":"Integration Guides","pages":[{"title":"Quickstart","href":"/composer/lifi-api/quickstart"},{"title":"API Integration","href":"/composer/lifi-api/guides/api-integration"},{"title":"SDK Integration","href":"/composer/lifi-api/guides/sdk-integration"},{"title":"Widget Integration","href":"/composer/lifi-api/guides/widget-integration"},{"title":"Cross-Chain Composer","href":"/composer/lifi-api/guides/cross-chain-compose"},{"title":"Withdrawals","href":"/composer/lifi-api/guides/withdrawals"},{"title":"Deposit Examples","href":"/composer/lifi-api/recipes/vault-deposits"}]},{"group":"Reference","pages":[{"title":"API Parameters","href":"/composer/lifi-api/reference/api-parameters"},{"title":"Error Handling","href":"/composer/lifi-api/reference/error-handling"},{"title":"Limitations","href":"/composer/lifi-api/reference/limitations"}]}]},{"group":"Resources","pages":[{"title":"Supported Protocols \u0026 Chains","href":"/composer/protocols-and-chains"},{"title":"New Protocol Onboarding","href":"/composer/for-protocols/integration-guide"},{"title":"Permissioned Products \u0026 Compliance","href":"/composer/permissioned-products-and-compliance"}]}]},{"tab":"Earn","pages":[{"title":"Earn","href":"/earn/overview"}]},{"tab":"Perps","pages":[{"title":"Perps","href":"/perps/overview"}]},{"tab":"Intents \u0026 Solvers","pages":[{"title":"Intents \u0026 Solvers","href":"/lifi-intents/introduction"}]},{"tab":"For Agents","pages":[{"title":"For Agents","href":"/agents/overview"}]},{"tab":"Widget Playground","href":"https://playground.li.fi/"},{"tab":"Bigmi","pages":[{"title":"Bigmi","href":"/bigmi/overview"}]},{"tab":"Guides","pages":[{"title":"Guides","href":"/guides/gas-options"}]},{"tab":"FAQs","pages":[{"title":"FAQs","href":"/faqs/fees-monetization"}]}]},{"language":"zh-Hans","pages":[{"title":"zh-Hans","href":"/zh-Hans/composer/composer-api/materialisers/flashloan"}]}]},"basePath":"","title":"flashloan - LI.FI","buildId":"dpl_DeHjVRGfFnhYQwHnfC2pjeXXv8h9","deploymentId":"dpl_DeHjVRGfFnhYQwHnfC2pjeXXv8h9","dynamics":[],"chunks":[]}