Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
dc94c5b
feat: per-contract version() view returning semver string
Jun 28, 2026
8918a6a
fix(vault): repair broken test function signatures
Jun 28, 2026
2193723
fix(vault): remove duplicate broadcast() from second contractimpl block
Jun 28, 2026
05e3788
fix: repair all broken merge artifacts in settlement and vault
Jun 28, 2026
cea1db2
fix: pagination token param, test receive_payment 6 args, dev balance…
Jun 28, 2026
d718758
fix: re-export SettlementError from errors module, add mod errors/mig…
Jun 28, 2026
5f4770e
fix:SettlementError with all variants in lib.rs, remove mod errors du…
Jun 28, 2026
91e94ee
sync: add mod types
Jun 28, 2026
d999c15
fix: get_ttl trait imports for Instance and Persistent
Jun 28, 2026
9d39b9f
fix: get_ttl trait import in revenue_pool, fix CalloraRevenuePool nam…
Jun 28, 2026
581e6e5
fix(test): remove extra arg from try_withdraw_developer_balance, add …
Jun 28, 2026
1abd315
feat: implement checkpoint/current_checkpoint, fix OverDraft variant,…
Jun 28, 2026
2f1fab7
fix: implement checkpoint, fix test arg counts, fix OverDraft variant…
Jun 28, 2026
4a6fe5c
fix: add Instance/Persistent trait imports for get_ttl in cfg(test) b…
Jun 28, 2026
f6158c7
fix: add Instance/Persistent trait imports for get_ttl in vault
Jun 28, 2026
21d8383
fix: revert all vault changes to match main
Jun 28, 2026
a9defce
fix(vault): remove duplicate broadcast and get_max_deduct functions, …
Jun 28, 2026
47755ee
fix(vault): add missing closing brace for first contractimpl block
Jun 28, 2026
7257162
fix(vault): add missing developer to DeductItem tests, u16→u32::MAX, …
Jun 28, 2026
0c95ef2
fix(vault): u16→u32 for max_fee_bps, add token arg to receive_payment…
Jun 28, 2026
afdc936
fix(settlement): restore from pre-broken-merge base + add checkpoint …
Jun 28, 2026
166d703
fix: re-add version() view function after lib.rs restore
Jun 28, 2026
8d493ee
fix: resolve compilation errors - DeveloperBalance 2-arg, DeveloperCl…
Jun 29, 2026
cf35129
fix: repair test syntax + naming
Jun 29, 2026
cd1dbd8
fix: attempt test compilation fixes (token alias, withdraw args, miss…
Jun 29, 2026
9eaac32
fix: resolve test compilation errors on version-view (token alias, wi…
Jun 29, 2026
d07f5f9
fix: remove unused alloc import (global allocator error) and update u…
Jun 29, 2026
8cf166b
fix: resolve merge conflict in revenue_pool lib.rs
Jun 29, 2026
4f6c75e
ci: re-trigger workflow for PR #590
Jun 29, 2026
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
9 changes: 3 additions & 6 deletions contracts/helpers/src/snapshot_diff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,14 @@ impl<K, V> Change<K, V> {
///
/// # Ordering Guarantees
/// The resulting change list is guaranteed to be sorted in a stable, deterministic order based
/// on the `Ord` implementation of the key. This ensures consistent diff reports regardless of
/// on the `Ord` implementation of the key. This ensures consistent diff reports regardless of
/// the input ordering of elements.
///
/// # Efficiency
/// The snapshots are loaded into `BTreeMap` structures in $O(N \log N + M \log M)$ time,
/// and then compared in a single linear $O(N + M)$ pass. The final list of changes is
/// sorted in $O(C \log C)$ where $C$ is the number of changes.
pub fn diff_snapshots<K, V>(
before: &[(K, V)],
after: &[(K, V)],
) -> Vec<Change<K, V>>
pub fn diff_snapshots<K, V>(before: &[(K, V)], after: &[(K, V)]) -> Vec<Change<K, V>>
where
K: Ord + Clone,
V: PartialEq + Clone,
Expand Down Expand Up @@ -117,9 +114,9 @@ where
#[cfg(test)]
mod tests {
use super::*;
use alloc::vec;
use alloc::string::String;
use alloc::string::ToString;
use alloc::vec;

#[test]
fn test_identical_snapshots() {
Expand Down
5 changes: 4 additions & 1 deletion contracts/revenue_pool/src/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,9 @@ mod tests {
#[test]
fn test_event_admin_broadcast_bytes() {
let env = Env::default();
assert_eq!(event_admin_broadcast(&env), Symbol::new(&env, "admin_broadcast"));
assert_eq!(
event_admin_broadcast(&env),
Symbol::new(&env, "admin_broadcast")
);
}
}
16 changes: 13 additions & 3 deletions contracts/revenue_pool/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#![no_std]
#![warn(missing_docs)]

use soroban_sdk::{
contract, contracterror, contractimpl, contracttype, token, Address, BytesN, Env, Map, String, Symbol, Vec,
contract, contracterror, contractimpl, contracttype, token, Address, BytesN, Env, Map, String,
Symbol, Vec,
};

/// Revenue settlement contract: receives USDC from vault deducts and distributes to developers.
Expand Down Expand Up @@ -85,7 +87,6 @@ pub struct StorageEntryTtl {
pub bump_amount: u32,
}


/// TTL bump constants for instance storage archival risk mitigation.
/// Soroban archives ledger entries after ~7 days (631 ledgers) of inactivity.
/// Bumping TTL ensures state remains accessible for critical operations.
Expand Down Expand Up @@ -152,6 +153,15 @@ impl RevenuePool {
.expect("revenue pool not initialized")
}

/// Return the contract semver string.
///
/// Read-only view returning the Cargo package version embedded at
/// compile time, enabling off-chain tooling to detect capability
/// deltas after upgrades.
pub fn version(_env: Env) -> soroban_sdk::String {
soroban_sdk::String::from_str(&_env, env!("CARGO_PKG_VERSION"))
}

/// Initiate replacement of the current admin. Only the existing admin may call this.
/// The new admin must call `claim_admin` to complete the transfer.
///
Expand Down Expand Up @@ -898,6 +908,7 @@ impl RevenuePool {
let instance_ttl = {
#[cfg(any(test, feature = "testutils"))]
{
use soroban_sdk::testutils::storage::Instance;
env.storage().instance().get_ttl()
}
#[cfg(not(any(test, feature = "testutils")))]
Expand All @@ -918,7 +929,6 @@ impl RevenuePool {
}
}


mod events;
/// Split `payments` into consecutive chunks of at most `chunk_size` legs each,
/// preserving order.
Expand Down
17 changes: 17 additions & 0 deletions contracts/revenue_pool/src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1569,3 +1569,20 @@ fn deposit_yield_rejects_zero_amount() {
client.init(&admin, &usdc_address);
client.deposit_yield(&admin, &0, &Symbol::new(&env, "fees"));
}

// ---------------------------------------------------------------------------
// version
// ---------------------------------------------------------------------------

#[test]
fn version_returns_semver_string() {
let env = Env::default();
let admin = Address::generate(&env);
let usdc = env.register_stellar_asset_contract_v2(admin.clone());
let contract = env.register(RevenuePool, ());
let client = RevenuePoolClient::new(&env, &contract);
env.mock_all_auths();
client.init(&admin, &usdc.address());
let v = client.version();
assert_eq!(v, String::from_str(&env, env!("CARGO_PKG_VERSION")));
}
5 changes: 4 additions & 1 deletion contracts/revenue_pool/src/test_error_codes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ fn error_code_docs_list_every_revenue_pool_code() {
];

for line in expected_lines {
assert!(docs.contains(line), "missing revenue-pool docs line: {line}");
assert!(
docs.contains(line),
"missing revenue-pool docs line: {line}"
);
}
}
6 changes: 2 additions & 4 deletions contracts/revenue_pool/src/test_proptest.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@

extern crate std;

use crate::{RevenuePool, RevenuePoolClient, Severity};
use crate::{RevenuePool, RevenuePoolClient};
use proptest::prelude::*;
use proptest::strategy::ValueTree;
use soroban_sdk::testutils::Address as _;
use soroban_sdk::token::{self, StellarAssetClient};
use soroban_sdk::{Address, Env};
use soroban_sdk::Vec as SorobanVec;
use soroban_sdk::{Address, Env};
use std::panic::{catch_unwind, AssertUnwindSafe};

fn create_usdc<'a>(
Expand Down
16 changes: 7 additions & 9 deletions contracts/settlement/src/admin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@

use soroban_sdk::{Address, Env, Vec};

use crate::{
events, timelock, AdminMigrationEvent, CalloraSettlement, SettlementError, StorageKey,
};
use crate::types::AdminMigrationEvent;
use crate::{events, timelock, CalloraSettlement, SettlementError, StorageKey};

fn require_admin(env: &Env, caller: &Address) {
caller.require_auth();
Expand Down Expand Up @@ -38,7 +37,10 @@ pub(crate) fn propose_balance_migration(env: &Env, caller: &Address, from: &Addr
let amount: i128 = env
.storage()
.persistent()
.get(&StorageKey::DeveloperBalance(from.clone(), usdc_token.clone()))
.get(&StorageKey::DeveloperBalance(
from.clone(),
usdc_token.clone(),
))
.unwrap_or(0);
if amount <= 0 {
env.panic_with_error(SettlementError::NoDeveloperBalance);
Expand Down Expand Up @@ -76,11 +78,7 @@ pub(crate) fn execute_balance_migration(env: &Env, caller: &Address, from: &Addr
let source_key = StorageKey::DeveloperBalance(from.clone(), usdc_token.clone());
let destination_key = StorageKey::DeveloperBalance(migration.to.clone(), usdc_token.clone());

let source_balance: i128 = env
.storage()
.persistent()
.get(&source_key)
.unwrap_or(0);
let source_balance: i128 = env.storage().persistent().get(&source_key).unwrap_or(0);
let new_source_balance = source_balance
.checked_sub(migration.amount)
.filter(|b| *b >= 0)
Expand Down
4 changes: 3 additions & 1 deletion contracts/settlement/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,7 @@ pub enum SettlementError {
MigrationNotFound = 20,
TimelockNotExpired = 21,
MigrationBalanceChanged = 22,
MinimumBalanceRequired = 23,
OverDraft = 23,
InvalidClaimWindow = 24,
ClaimWindowClosed = 25,
}
10 changes: 9 additions & 1 deletion contracts/settlement/src/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,11 @@ pub fn event_admin_migration(env: &Env) -> Symbol {
Symbol::new(env, "admin_migration")
}

/// Returns the Symbol for a checkpoint snapshot.
pub fn event_checkpoint_created(env: &Env) -> Symbol {
Symbol::new(env, "checkpoint_created")
}

#[cfg(test)]
mod tests {
use super::*;
Expand Down Expand Up @@ -209,7 +214,10 @@ mod tests {
#[test]
fn test_event_admin_broadcast_bytes() {
let env = Env::default();
assert_eq!(event_admin_broadcast(&env), Symbol::new(&env, "admin_broadcast"));
assert_eq!(
event_admin_broadcast(&env),
Symbol::new(&env, "admin_broadcast")
);
}

#[test]
Expand Down
Loading
Loading