Feat: Soroban Smart Contract Abstraction Layer - #53
Merged
Conversation
🤖 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>
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
Changes
Added
SorobanContractabstract base class and@Contractdecorator for type-safe contract interactionsAdded
ContractRegistryServicefor centralized contract metadata, versioning, and active version managementAdded
ContractUpgradeManagerwith preflight compatibility checks, state migration, and rollback supportAdded
ContractEventDecoderwith ABI-aware decoding and schema-based validationAdded
GasOptimizationEngineusing historical data to predict and optimize transaction feesAdded
MultisigTransactionBuildersupporting batched invocations, threshold management, and MEV protectionAdded
SwapPoolContractas example contract implementation extending the base classAdded state import/export methods (
listStorageKeys,exportContractState,importContractState) toContractStateServiceFixed truncated duplicate
invalidateContractmethod that caused 30 TypeScript compilation errorsWired all new services into
StellarModuleas providers and exports with barrel re-exportsChecklist
npm run lintpasses.npx tsc --noEmitpasses (no type errors).npm run lintpasses.npx tsc --noEmitpasses (no type errors).npm run buildsucceeds.npm testpasses, and I added/updated tests for my change where itmade sense.
stellarmodulestellarmoduleservices (no direct Horizon/RPC calls from feature modules).
Notes for Reviewers
SwapPoolContractis a reference implementation — real contract types should extendSorobanContractwith the@ContractdecoratorContractUpgradeManager.migrateContractStaterelies on the newlistStorageKeys/exportContractState/importContractStatemethods inContractStateServiceGasOptimizationEnginehistory is in-memory only — consider persisting to Redis for production useContractEventDecoder.decodeWithAbiis a placeholder that delegates to the SDK — a full ABI-aware decoder would improve event parsing fidelityMultisigTransactionBuilder.applyMevProtectionis a stub — production MEV protection needs Horizon sequence number constraint integration