From 14e285673d9861a64b14a16398f104c1c4d01ad2 Mon Sep 17 00:00:00 2001 From: Sorin Petreasca Date: Wed, 7 Feb 2024 15:42:41 +0200 Subject: [PATCH] Added README for Subscription Fee SC --- subscription-fee/README.md | 31 +++++++++++++++++++++++++++++++ subscription-fee/src/lib.rs | 3 +++ subscription-fee/wasm/src/lib.rs | 5 +++-- 3 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 subscription-fee/README.md diff --git a/subscription-fee/README.md b/subscription-fee/README.md new file mode 100644 index 0000000..606cf1a --- /dev/null +++ b/subscription-fee/README.md @@ -0,0 +1,31 @@ +# Subscription Fee Smart Contract + +The Smart Contract provides a comprehensive set of functionalities for managing subscription services and fees on the MultiversX blockchain. It allows users to register services, subscribe to services, deposit funds, withdraw funds, and perform various other actions related to managing subscription services and fees. + +The code consists of multiple modules and endpoints that handle various operations related to subscription services, fees, pair actions, among others. + +Let's break down the key components and functionalities of the Smart Contract: + +## Initialization + +Defines the initialization function for setting up the SC with the mandatory variables. + +## Service Module + +Manages the registration, approval, and subscription of services. It also defines the structure of a service, including payment information and subscription epochs. The module allows the service provider to register or add extra services, unregister services, and the users to subscribe/unsubscribe to/from those said services. + +## Fees Module + +Handles the addition of accepted fee tokens, setting minimum deposit values, user deposits, and fund withdrawals. + +## Common Storage Module + +Contains storage mappers and views for various data storage and retrieval operations used by other modules. + +## Pair Actions Module + +Deals with pair related operations and price queries. Provides functions for adding/removing pair addresses and retrieving token prices. + +## Subtract Payments Module + +Handles the subtraction of payments for subscribed services. Uses a custom result type for successful or failed price queries, to have a more flexible code output. diff --git a/subscription-fee/src/lib.rs b/subscription-fee/src/lib.rs index 562807b..5d9b6df 100644 --- a/subscription-fee/src/lib.rs +++ b/subscription-fee/src/lib.rs @@ -52,4 +52,7 @@ pub trait SubscriptionFee: .set_if_empty(min_stable_token_deposit_value); self.add_accepted_fees_tokens(accepted_tokens); } + + #[upgrade] + fn upgrade(&self) {} } diff --git a/subscription-fee/wasm/src/lib.rs b/subscription-fee/wasm/src/lib.rs index 0d3f0cc..2fcc7f3 100644 --- a/subscription-fee/wasm/src/lib.rs +++ b/subscription-fee/wasm/src/lib.rs @@ -5,9 +5,9 @@ //////////////////////////////////////////////////// // Init: 1 -// Endpoints: 20 +// Endpoints: 21 // Async Callback (empty): 1 -// Total number of exported functions: 22 +// Total number of exported functions: 23 #![no_std] @@ -22,6 +22,7 @@ multiversx_sc_wasm_adapter::endpoints! { subscription_fee ( init => init + upgrade => upgrade addAcceptedFeesTokens => add_accepted_fees_tokens setMinDepositValue => set_min_deposit_value deposit => deposit