Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions contracts/factory/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -440,10 +440,20 @@ impl DripFactory {

/// Returns the deployed contract address for `stream_id`, or `None` if the
/// ID was never created (or the stream has been archived from storage).
///
/// Extends the entry's persistent TTL on read so frequently-resolved
/// streams stay alive without relying solely on the bounded TTL walker
/// (`bump_persistent_bucket`), which can only touch `BATCH_LIMIT` (8)
/// entries per maintenance call — insufficient for a large registry.
pub fn stream_address(env: Env, stream_id: u64) -> Option<Address> {
env.storage()
.persistent()
.get(&DataKey::StreamAddr(stream_id))
let key = DataKey::StreamAddr(stream_id);
let addr: Option<Address> = env.storage().persistent().get(&key);
if addr.is_some() {
env.storage()
.persistent()
.extend_ttl(&key, ttl::THRESHOLD, ttl::EXTEND_TO);
}
addr
}

/// Permissionlessly advance migration of one sender's legacy index into
Expand Down
3 changes: 3 additions & 0 deletions contracts/stream/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ pub enum Error {
ReentrancyForbidden = 16,
OperatorAlreadySet = 17,
NotInitialized = 18,
/// The recipient is invalid (e.g. the all-zero Stellar account address, or identical to `sender`).
InvalidRecipient = 19,
/// The stream's `start_time` is in the past at initialization.
BackdatedStream = 20,
/// The stream has accrued tokens but is not funded enough to cover the requested withdrawal.
StreamUnderfunded = 21,
}