Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

The platform will offer three subscription plans that users can choose from, and payment will be charged monthly in cUSD. We will also use the OpenZeppelin Defender autotask to handle the monthly subscription charges

License

NotificationsYou must be signed in to change notification settings

olulofe/celo-sage-payment-subscription-platform

Repository files navigation

In this tutorial, we will show you how to create a subscription platform using the Celo composer react-app and the hardhat package. The platform will offer three subscription plans that users can choose from, and payment will be charged monthly in cUSD. We will also use the OpenZeppelin Defender autotask to handle the monthly subscription charges and an email service to notify users of the charge status. By the end of this tutorial, you will have a working subscription platform and the knowledge to customize and build upon it for your own use case.

Setup

Install dependecies

//In root folderyarn

Create.env file inpackages/hardhat folder.

Paste the default inside

PRIVATE_KEY=0xba28d5cea192f121db5f1dd7f501532170bb7bb984c4d3747df3e251e529f77dACCOUNT_ADDRESS=0x81cb394E24e5AeA53C3BD6f3d48b43e9A3817CC6

Generate your own private key and address.

npx hardhat create-account

Fund your address with test tokens from Celo public faucethttps://celo.org/developers/faucet.

Run Test

npx hardhattest test/subscription-test.js --network hardhat

Deploy

Deploy contract on Alfajores

cd packages/hardhatyarn run deloycd packages/react-appyarn run dev

Transfer Ownership to Defender Relayer

Edit thescripts/transferOwnership.js file and change the addresses for the contract and relayer respectively

npx hardhat run scripts/transferOwnership.js

Subscribe to a plan

Run the script to give allowance to24 cUSD and subscribe to basic plan for 12 months.

npx hardhat run scripts/suscribe.js

Most preferabbly use Defender Admin to interact with the cUSD and PaymentSubscription contracts to perform this actions

Approve cUSD Spend

Admin Defender

Subscribe

Admin Defender

Further resources

About

The platform will offer three subscription plans that users can choose from, and payment will be charged monthly in cUSD. We will also use the OpenZeppelin Defender autotask to handle the monthly subscription charges

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp