This Soroban smart contract implements multi-signature functionality with time-locks for large splits in the StellarSplit application.
The contract enables secure handling of high-value splits by requiring multiple signatures and enforcing time delays before execution. This provides additional security layers for large transactions.
- Multi-signature Requirements: Configurable number of signatures needed
- Time Locks: Enforceable delays before execution
- Signature Collection: Track and validate participant approvals
- Cancellation Mechanism: Admin can cancel splits when necessary
- Emergency Override: Admin can execute splits immediately in emergencies
Initializes the contract with an admin address. Must be called before any other operations.
create_multisig_split(env: Env, split_id: String, required_sigs: u32, time_lock: u64) -> Result<(), MultisigError>
Creates a new multi-signature split with the specified parameters:
split_id: Unique identifier for the splitrequired_sigs: Number of signatures required (minimum 1)time_lock: Time delay in seconds before execution is allowed
Allows a signer to add their signature to a split. Returns true if the split can now be executed.
Executes a split once all required signatures are collected and the time lock has expired.
Allows the admin to cancel a split with a reason. Only the admin can perform this action.
Allows the admin to execute a split immediately, bypassing signature and time lock requirements.
Returns detailed information about a split including current status and signatures.
Checks if a split can be executed (all signatures collected and time lock expired).
- Pending: Created but no signatures yet
- Active: At least one signature collected
- Executed: Successfully executed
- Cancelled: Cancelled by admin
- Expired: Time lock expired without execution
SplitAlreadyExists: Split ID already in useSplitNotFound: Split does not existInvalidThreshold: Invalid signature threshold or time lockAlreadySigned: Signer has already signed this splitNotAuthorized: Operation not authorizedTimeLockNotExpired: Time lock has not expired yetInsufficientSignatures: Not enough signatures collectedSplitNotActive: Split is not in active stateSplitAlreadyExecuted: Split already executed or cancelled
cd contracts/multi-sig-splits
cargo build --target wasm32-unknown-unknown --releasecd contracts/multi-sig-splits
cargo test- Only the admin can cancel splits or perform emergency overrides
- Time locks prevent rushed executions
- Duplicate signatures are prevented
- All state changes emit events for tracking
This contract should be integrated with the main split escrow contract to provide enhanced security for high-value transactions. The split creation process should check transaction amounts and automatically use multi-sig for large values.