Skip to content

A subscription router PoC for a recurring payment plugin to an ERC4337-compatible smart account

Notifications You must be signed in to change notification settings

JO-OLADEJI/erc4337-subscriptions

Repository files navigation

ERC-4337 Subscriptions: PoC

Using a recurring payment plugin on a BiconomySmartAccount v2.

The RecurringPaymentsModule contract allows for a user to setup a subscription agreement using the initForSmartAccount() function. The SubscriptionRouter contract is responsible for receiving subscription payments using extendSubscription(). A defaultOperator address set on the router can execute extending the subscriptions on behalf of a smart account using extendSubscriptionByOperator().

Setup

  • Clone repository and install dependencies
git clone https://github.com/JO-OLADEJI/erc4337-subscriptions.git
yarn install

# install deps for the PoC script
cd client
yarn install
  • Create .env file in root folder and add your private key to deploy contracts
EOA_SIGNER = "0x<<your-private-key>>"
  • Setup defaultOperator address for SubscriptionRouter in ./deploy-config.json

  • Compile and deploy contracts

yarn compile
yarn deploy
  • Copy deployed contract addresses to ./data/addresses.json

PoC Script

  • Create .env file in the ./client folder and add the following private keys
# private key of EOA linked to smart account
EOA_SIGNER  =  "0x<<eoa-private-key>>"

# optional: private key of defaultOperator set on the SubscriptionRouter contract
# for extending a subscription agreement on behalf of smart account
ROUTER_DEFAULT_OPERATOR = "0x<<defaultOperator-private-key>>"
  • Run PoC script
yarn start

References

About

A subscription router PoC for a recurring payment plugin to an ERC4337-compatible smart account

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published