From e777a09b234acbbc6e3e456ec54b172673e2e15e Mon Sep 17 00:00:00 2001 From: mananuf Date: Tue, 24 Mar 2026 10:52:33 +0100 Subject: [PATCH 1/2] Fix #2: Implement actual token transfer --- contracts/src/lib.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/contracts/src/lib.rs b/contracts/src/lib.rs index 89e8858..e3bdf22 100644 --- a/contracts/src/lib.rs +++ b/contracts/src/lib.rs @@ -1,6 +1,6 @@ #![no_std] -use soroban_sdk::{contract, contractimpl, contracttype, Address, Env, String, Vec}; +use soroban_sdk::{contract, contractimpl, contracttype, token, Address, Env, String, Vec}; /// Billing interval in seconds #[contracttype] @@ -337,10 +337,10 @@ impl SubTrackrContract { .get(&DataKey::Plan(sub.plan_id)) .expect("Plan not found"); - // TODO: Execute actual token transfer from subscriber to merchant - // token::Client::new(&env, &plan.token).transfer( - // &sub.subscriber, &plan.merchant, &plan.price - // ); + // Execute actual token transfer from subscriber to merchant + token::Client::new(&env, &plan.token).transfer( + &sub.subscriber, &plan.merchant, &plan.price + ); sub.last_charged_at = now; sub.next_charge_at = now + plan.interval.seconds(); From dcfc2380c4af1cd29767c4255733f13dd766a0dd Mon Sep 17 00:00:00 2001 From: mananuf Date: Wed, 25 Mar 2026 12:08:47 +0100 Subject: [PATCH 2/2] Fix CI test failures: add MockToken and fix tsconfig lib options --- contracts/src/lib.rs | 14 ++++++++++++-- tsconfig.json | 3 ++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/contracts/src/lib.rs b/contracts/src/lib.rs index c69582e..5a4d391 100644 --- a/contracts/src/lib.rs +++ b/contracts/src/lib.rs @@ -357,7 +357,9 @@ impl SubTrackrContract { // Execute actual token transfer from subscriber to merchant token::Client::new(&env, &plan.token).transfer( - &sub.subscriber, &plan.merchant, &plan.price + &sub.subscriber, + &plan.merchant, + &plan.price, ); sub.last_charged_at = now; @@ -533,6 +535,14 @@ mod test { use soroban_sdk::testutils::{Address as _, Ledger}; use soroban_sdk::Env; + #[contract] + pub struct MockToken; + + #[contractimpl] + impl MockToken { + pub fn transfer(_env: Env, _from: Address, _to: Address, _amount: i128) {} + } + fn setup( env: &Env, ) -> ( @@ -548,7 +558,7 @@ mod test { let admin = Address::generate(env); let merchant = Address::generate(env); let subscriber = Address::generate(env); - let token = Address::generate(env); + let token = env.register_contract(None, MockToken); env.mock_all_auths(); client.initialize(&admin); diff --git a/tsconfig.json b/tsconfig.json index b9567f6..cf0c938 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,6 +1,7 @@ { "extends": "expo/tsconfig.base", "compilerOptions": { - "strict": true + "strict": true, + "lib": ["es2017", "dom"] } }