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()
.
- 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 forSubscriptionRouter
in./deploy-config.json
-
Compile and deploy contracts
yarn compile
yarn deploy
- Copy deployed contract addresses to
./data/addresses.json
- 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