🧰 Desub Contracts is a collection of Solidity smart contracts designed to facilitate decentralized recurring and one-time payments using cryptocurrencies for individuals and organizations.
These contracts leverage the decentralized nature of blockchain technology to provide a secure, transparent, and tamper-proof payment system that eliminates the need for intermediaries. Through the use of these contracts, users can create subscription-based services and charge fees in cryptocurrencies such as Ether, USDC, DAI, and other ERC-20 tokens. Additionally, the Desub Contracts offer features such as automatic payment processing, refund handling and convenience of the payment system.
SubscriptionData: Solify Smart contract for a subscription service that allows users to purchase subscription parameters using various ERC20 tokens. The contract allows the owner to set prices for each subscription parameter and specify the accepted ERC20 tokens. The contract also supports a discount system for subscriptions, where users can receive discounts based on the number of tokens they hold and the total amount of tokens they have staked.
The contract is designed to be owned by a governance entity and allows for multiple owners. The contract also implements the OpenZeppelin's Ownable and SafeERC20 libraries for added security and convenience.
The purpose of this contract is to enable a subscription-based service that can be paid for using various ERC20 tokens. It also provides a discount system to incentivize users to hold and stake tokens. The contract is useful for any subscription-based service that wants to accept payments in ERC20 tokens and incentivize users to hold and stake their tokens.
SubscriptionDePay: SubscriptionDePay is used for subscription payments. Its purpose is to enable users to subscribe to a service or product and pay for it periodically, such as monthly or annually. The contract can handle multiple ERC20 tokens for payments, and it ensures that users are charged the correct amount for their subscription.
The contract allows users to deposit ERC20 tokens to the contract, and it tracks the total amount deposited per token. It also keeps track of the total charges, withdrawals, and company revenue per token. The contract supports pausing the deposit and withdrawal functions temporarily.
The contract has different roles, including a Manager role that can modify contract data, a Treasury role responsible for managing the multisig account, a Company role for managing the multisig account of the company, and an Owner role responsible for core functions such as setting the treasury and company addresses.
The use case for this smart contract is to provide a secure and transparent way for businesses to manage subscription payments for their services or products. It can be used by subscription-based businesses such as media platforms, online services, and e-commerce sites.
To deploy this contract to an EVM supported blockchain of your choice, follow this step
npm install
- Edit the
.env.sample
file and add the correct details - Go to
hardhat.config.js
and add the network details - Make all neccessary changes in the
deploy
folder - Run the deployment script
npx hardhat --network [networkName] deploy
- Verify the deployed contract
npx hardhat --network [networkName] etherscan-verify [--api-key <apikey>] [--apiurl <url>]
ORnpx hardhat --network [networkName] sourcify
- Set the GovernanceAddress on SubscriptionData
- Call the addNewTokens(any ERC20 token) function on SubscriptionData
- Set to subscription parameters using updateParams functions
- Users can deposits and withdraw using userDeposit & userWithdraw
- Make call to chargeUser function to deduct the user's fund.
We encourage you to read the contribution guidelines to learn about our development process and how to propose bug fixes and improvements before submitting a pull request.
The Spheron community extends beyond issues and pull requests! You can support Spheron in many other ways as well.
For help, discussions or any other queries: Join us on Discord