Skip to content

Feat: Soroban Smart Contract Abstraction Layer - #53

Merged
akargi merged 20 commits into
Chulilee:mainfrom
memplethee-lab:feat/Sorobon
Aug 22, 2026
Merged

Feat: Soroban Smart Contract Abstraction Layer#53
akargi merged 20 commits into
Chulilee:mainfrom
memplethee-lab:feat/Sorobon

Conversation

@memplethee-lab

Copy link
Copy Markdown
Contributor

Closes #48

Summary

Adds a Soroban Smart Contract Abstraction Layer that provides a type-safe, object-oriented interface for interacting with Soroban contracts. Includes a contract registry, upgrade manager with state migration, event decoder, gas optimization engine, and multisig transaction builder with MEV protection.

Related Issues

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that changes existing behaviour)
  • Documentation only
  • Refactor / chore (no functional change)

Changes

  • Added SorobanContract abstract base class and @Contract decorator for type-safe contract interactions

  • Added ContractRegistryService for centralized contract metadata, versioning, and active version management

  • Added ContractUpgradeManager with preflight compatibility checks, state migration, and rollback support

  • Added ContractEventDecoder with ABI-aware decoding and schema-based validation

  • Added GasOptimizationEngine using historical data to predict and optimize transaction fees

  • Added MultisigTransactionBuilder supporting batched invocations, threshold management, and MEV protection

  • Added SwapPoolContract as example contract implementation extending the base class

  • Added state import/export methods (listStorageKeys, exportContractState, importContractState) to ContractStateService

  • Fixed truncated duplicate invalidateContract method that caused 30 TypeScript compilation errors

  • Wired all new services into StellarModule as providers and exports with barrel re-exports

Checklist

  • I have read the CONTRIBUTING guide.
  • npm run lint passes.
  • npx tsc --noEmit passes (no type errors).
  • I have read the CONTRIBUTING guide.
  • npm run lint passes.
  • npx tsc --noEmit passes (no type errors).
  • npm run build succeeds.
  • npm test passes, and I added/updated tests for my change where it
    made sense.
  • Any Stellar/Soroban network access goes through the stellar module
  • Any Stellar/Soroban network access goes through the stellar module
    services (no direct Horizon/RPC calls from feature modules).
  • I did not commit secrets, private keys, or mainnet credentials.
  • I did not commit secrets, private keys, or mainnet credentials.

Notes for Reviewers

  • The SwapPoolContract is a reference implementation — real contract types should extend SorobanContract with the @Contract decorator
  • ContractUpgradeManager.migrateContractState relies on the new listStorageKeys/exportContractState/importContractState methods in ContractStateService
  • The GasOptimizationEngine history is in-memory only — consider persisting to Redis for production use
  • ContractEventDecoder.decodeWithAbi is a placeholder that delegates to the SDK — a full ABI-aware decoder would improve event parsing fidelity
  • MultisigTransactionBuilder.applyMevProtection is a stub — production MEV protection needs Horizon sequence number constraint integration

memplethee-lab and others added 20 commits August 22, 2026 17:37
🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
Introduces an abstract base class for type-safe Soroban contract
interactions and a decorator for automatic contract type registration.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
…gement

Provides centralized registry for tracking deployed contracts, versions,
capabilities, and active version management with type-based indexing.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
Handles contract version upgrades including preflight compatibility checks,
state migration between versions, and rollback capabilities.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
Automatic event name extraction, ABI-aware decoding, and schema-based
validation for contract events with batch processing support.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
…tion

Uses historical gas usage data to predict and optimize transaction fees
with adaptive safety buffers and batch opportunity detection.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
Supports batching multiple contract invocations into single transactions,
multi-signature threshold management, and sequential execution constraints.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
Demonstrates swap pool usage, multi-signature transactions, and
contract upgrades with the new type-safe abstraction layer.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
…t/export

Fixes syntax errors caused by a duplicate truncated invalidateContract
method. Adds listStorageKeys, exportContractState, and
importContractState methods for state migration support.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
Register all new services as providers and exports. Add SwapPoolContract
as example implementation. Update barrel exports in index.ts.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
@memplethee-lab memplethee-lab changed the title Feat/sorobon Feat: Soroban Smart Contract Abstraction Layer Aug 22, 2026
@akargi
akargi merged commit a2cdc2b into Chulilee:main Aug 22, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Soroban Smart Contract Abstraction Layer

2 participants