multiversx-flash-loan-patterns

Implement atomic flash loan patterns with reentrancy guards on MultiversX smart contracts.

12|5|Updated Jan 28, 2026
One-click install
npx skills add https://github.com/multiversx/mx-ai-skills --skill multiversx-flash-loan-patterns
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: multiversx-flash-loan-patterns
Source: https://github.com/multiversx/mx-ai-skills/tree/main/skills/multiversx-flash-loan-patterns
Command: npx skills add https://github.com/multiversx/mx-ai-skills --skill multiversx-flash-loan-patterns

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill provides a robust pattern to securely implement operations that temporarily lend assets, execute arbitrary logic via a callback, and verify repayment within a single atomic transaction on MultiversX.

Core Features & Use Cases

  • Atomic Transactions: Ensures that lending, execution, and verification happen as a single, indivisible unit. If repayment fails, the entire transaction reverts.
  • Security Guards: Implements essential checks like reentrancy guards, same-shard validation, and endpoint validation to prevent exploits.
  • Use Case: Ideal for implementing flash loans, atomic swaps with verification, or temporary grants where assets are borrowed and must be returned within the same transaction.

Quick Start

Use the multiversx-flash-loan-patterns skill to implement an atomic operation for lending tokens and executing a callback.

Frequently Asked Questions about multiversx-flash-loan-patterns

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I implement a secure flash loan in a MultiversX smart contract?

To implement a secure flash loan on MultiversX, use an atomic transaction pattern that temporarily lends assets, executes external logic via a callback, and verifies repayment within a single block.

What security checks are needed for atomic transactions on MultiversX DeFi protocols?

Secure atomic transactions on MultiversX require reentrancy guards, same-shard validation, endpoint validation, and strict repayment verification to prevent exploits during the callback execution.

Why does a flash loan transaction revert if repayment fails on MultiversX?

A flash loan transaction reverts if repayment fails because the lending, execution, and verification steps are designed as a single indivisible atomic transaction, ensuring the state returns to its original position.

Can I use atomic operations for temporary token grants without a full flash loan?

Yes, atomic operations can be used for temporary grants or atomic swaps with verification, allowing assets to be borrowed and conditionally returned within the same transaction without needing a standalone flash loan.

Do I need same-shard validation for MultiversX smart contract flash loans?

Yes, same-shard validation is an essential security guard for MultiversX flash loans, ensuring that the lending, callback execution, and repayment processes occur on the same shard for atomic consistency.

What is the multiversx-flash-loan-patterns skill used for?

The multiversx-flash-loan-patterns skill provides a secure and atomic pattern for implementing flash loan functionalities, ensuring safe temporary lending, callback execution, and repayment verification on MultiversX.