Summary
Add subscription-based payment model where clients can subscribe to agent services with recurring XLM payments and automatic renewal.
Motivation
Pay-per-task is not always optimal. Subscriptions provide predictable costs for clients and stable income for agents.
Acceptance Criteria
create_subscription function with duration, payment amount, and agent
Subscription stored with start time, end time, and payment schedule
renew_subscription extends duration with new payment
cancel_subscription with prorated refund
check_subscription verifies if subscription is active
Auto-renewal support (opt-in)
Events: SubscriptionCreated, SubscriptionRenewed, SubscriptionCancelled, PaymentProcessed
Unit tests for create, renew, cancel, and expiry
Files to Modify
File
Action
smart-contracts/contracts/agent_registry/src/lib.rs
Add subscription functions
smart-contracts/contracts/agent_registry/src/types.rs
Add Subscription struct
smart-contracts/contracts/agent_registry/src/errors.rs
Add subscription error codes
smart-contracts/contracts/agent_registry/src/events.rs
Add subscription events
smart-contracts/contracts/agent_registry/src/test.rs
Add subscription tests
How to Contribute
Create branch feat/agent-subscriptions
Design subscription storage structure
Implement create/renew/cancel functions
Add prorated refund calculation
Write comprehensive unit tests
Run cargo test and cargo clippy before submitting PR
Summary
Add subscription-based payment model where clients can subscribe to agent services with recurring XLM payments and automatic renewal.
Motivation
Pay-per-task is not always optimal. Subscriptions provide predictable costs for clients and stable income for agents.
Acceptance Criteria
create_subscriptionfunction with duration, payment amount, and agentrenew_subscriptionextends duration with new paymentcancel_subscriptionwith prorated refundcheck_subscriptionverifies if subscription is activeSubscriptionCreated,SubscriptionRenewed,SubscriptionCancelled,PaymentProcessedFiles to Modify
smart-contracts/contracts/agent_registry/src/lib.rssmart-contracts/contracts/agent_registry/src/types.rssmart-contracts/contracts/agent_registry/src/errors.rssmart-contracts/contracts/agent_registry/src/events.rssmart-contracts/contracts/agent_registry/src/test.rsHow to Contribute
feat/agent-subscriptionscargo testandcargo clippybefore submitting PR