An approach to capture MEV from Unlock Protocol's recurring membership subscriptions.
Warning: This repo is an experimental proof-of-concept and NOT ready for production use! I strongly recommend testing it on the Rinkeby test-network first.
This repo is intended as an inspiration for MEV searchers to support the Unlock Protocol ecosystem by automatically renewing the memberships of subscribed members. I hope you'll find the code and coments helpful.
Since Unlock Protocol released version 10 of its PublicLock contract, there is a new method called renewMembershipFor
, which allows anyone to renew the expired key of a membership subscriber.
The MEV search can be broken down into four steps:
- Find relevant locks
- Find relevant subscribers
- Find profitable MEV opportunities
- Extract value (renew memberships)
Copy .env.sample
and save it as .env
with your RINKEBY_RPC_URL
(e.g. from Alchemy). If you want to make transactions in the final step, you can insert your PRIVATE_KEY
, too.
Run the script of each step and watch the output
directory for results:
npx hardhat run scripts/01-find-locks.js --network testnet
npx hardhat run scripts/02-find-subscribers.js --network testnet
npx hardhat run scripts/03-find-profitable.js --network testnet
npx hardhat run scripts/04-renew-memberships.js --network testnet
Or simply serially run all with npm start
.