upgrade-stellar-contracts

Automate secure WASM upgrades for Stellar Soroban contracts.

Updated Oct 17, 2025
One-click install
npx skills add https://github.com/iamcapote/emptyrepo --skill upgrade-stellar-contracts-iamcapote
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: upgrade-stellar-contracts
Source: https://github.com/iamcapote/emptyrepo/tree/main/skills/allied/openzeppelin-skills/skills/upgrade-stellar-contracts
Command: npx skills add https://github.com/iamcapote/emptyrepo --skill upgrade-stellar-contracts-iamcapote

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Stellar Soroban contracts often require evolution while maintaining live deployments. This Skill provides a clear, governance-friendly path for upgradeability, atomic upgrades, and cross-version storage safety to prevent data loss.

Core Features & Use Cases

  • Upgradeable and UpgradeableMigratable contracts via derive macros to update WASM without breaking storage
  • Atomic upgrade-and-migrate pattern using an Upgrader contract to execute upgrade and migration in a single operation
  • Guidance on storage key compatibility to preserve existing state across upgrades
  • Testing workflows to validate upgrade paths on local testnets or dev networks

Quick Start

Deploy V1 and then upgrade to V2 using the Upgrader pattern, ensuring that state remains consistent after the upgrade.

Frequently Asked Questions about upgrade-stellar-contracts

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

FAQPage Schema
How do I upgrade a Stellar Soroban contract without losing storage state?

To upgrade Soroban contracts safely, you apply storage-key safety checks to preserve existing state and use upgradeable derive macros. This ensures cross-version compatibility and prevents data loss during native WASM replacement.

What is the atomic upgrade-and-migrate pattern for Soroban smart contracts?

The atomic upgrade-and-migrate pattern uses an Upgrader contract to execute both the WASM replacement and state migration in a single operation. This guarantees that contract upgrades and migrations succeed or fail together without partial execution.

Do I need OpenZeppelin modules to implement upgradeability in Soroban?

Yes, implementing secure Soroban contract upgrades requires the OpenZeppelin Stellar Soroban upgradeable module. It provides the necessary Upgradeable and UpgradeableMigratable derive macros and foundational logic for native WASM replacement.

How do I test a Soroban contract upgrade path before deploying to mainnet?

You validate Soroban contract upgrade paths by deploying and testing on local testnets or dev networks. This workflow verifies that storage key compatibility and state migrations remain consistent before executing mainnet upgrades.

What is the difference between Upgradeable and UpgradeableMigratable contracts in Soroban?

Upgradeable contracts support direct native WASM replacement, while UpgradeableMigratable contracts add state migration logic. The migratable variant enables atomic upgrade-and-migrate patterns to transform existing storage data safely during the WASM update.

Why do Soroban contract upgrades break existing storage keys?

Soroban contract upgrades break existing storage keys when cross-version compatibility is ignored. Applying storage-key safety checks and derive macros prevents data loss by ensuring new contract versions correctly map and preserve prior state structures.