multiversx-cache-patterns
OfficialOptimize MultiversX gas costs with caching.
Authormultiversx
Version1.0.0
Installs0
System Documentation
What problem does it solve?
This Skill addresses the high gas costs associated with frequent storage reads and writes in MultiversX smart contracts, providing patterns to significantly reduce transaction fees.
Core Features & Use Cases
- Write-Back Caching: Implements a
Drop-based cache to load state into memory, perform in-memory mutations, and commit all changes atomically on scope exit. - Read-Only Caching: Offers a pattern for view functions or read-heavy operations where state changes are not required, avoiding unnecessary storage reads.
- Computed Values: Enables caching of derived values within the cache struct itself, preventing repeated computations and storage reads.
- Use Case: For DeFi protocols or any gas-sensitive contract that performs multiple storage operations per transaction, this skill allows intermediate reads and writes to be free (in-memory), only incurring storage costs on initial load and final commit.
Quick Start
Implement the write-back cache pattern in your MultiversX smart contract endpoint by creating a StorageCache instance at the beginning of the function.
Dependency Matrix
Required Modules
None requiredComponents
Standard package💻 Claude Code Installation
Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.
Please help me install this Skill: Name: multiversx-cache-patterns Download link: https://github.com/multiversx/mx-ai-skills/archive/main.zip#multiversx-cache-patterns Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
Agent Skills Search Helper
Install a tiny helper to your Agent, search and equip skill from 223,000+ vetted skills library on demand.