Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] feature / lz gated follow, reference, collect modules #3

Closed
wants to merge 16 commits into from

Conversation

imthatcarlos
Copy link
Contributor

@imthatcarlos imthatcarlos commented Dec 9, 2022

cross-chain, token gated follow + reference + collect modules

lz-gated-follow-module@2x (1)

  1. lensprotocol.lens has set their gated follow data. A new follower must have 50 AAVE on Optimism.
  2. carlosbeltran.lens wishes to follow - fetches the requirements and generates the signature for #followWithSig
  3. anyone (ex: a relayer) can submit the follow requirements + the signature to the LZGatedProxy contract on Optimism, which relays the payload to the LZGatedFollowModule contract on Polygon via LayerZero
  • TLDR; the token balance check happens on Optimism, and the follow tx on Polygon

LZGatedFollowModule.sol

A Lens Follow Module that allows profile holders to gate their following with ERC20 or ERC721 balances held on other chains

  • a profile initializes this module with a supported layerzero chain id and a erc20/erc721 contract + balance to check against
  • another user wishes to follow, they read the requirements using gatedFollowPerProfile which points to the chain/token/balance
  • user generates followWithSigData for a given profile
  • user (or relayer) submits this sig along with appropriate input to the LZGatedProxy contract on the other chain
  • LZGatedProxy makes the token check, and relays the message to the LZGatedFollowModule on polygon
  • LZGatedFollowModule contract validates the input, submits sig to LensHub#followWithSig
  • follow ✅

LZGatedReferenceModule.sol

A Lens Reference Module that allows publication creators to gate who can comment/mirror their post with ERC20 or ERC721 balances held on other chains.

  • pretty much same flow as above

LZGatedCollectModule.sol

A Lens Collect Module that allows publication creators to gate who can collect their post with ERC20 or ERC721 balances held on other chains.

  • pretty much same flow as above

LZGatedProxy.sol

This contract acts as a proxy for LZGatedFollowModule, LZGatedReferenceModule, and LZGatedCollectModule in order to read token balances from remote contracts on any chain supported by LayerZero.

  • we deploy one of these on any EVM chain to be supported by the modules, wire up for trusted lz messaging
  • when a user wishes to follow/comment/mirror/collect - they sign the correct data payload and submit along with the correct gate data
  • the contract makes the token balance check against the erc20/erc721 contact defined
  • if all good, relay the payload to our module contract on polygon

TODO

  • fill in comments
  • fill in tests
  • LZGatedCollectModule
  • testnet deployment
  • estimate gas
  • end to end test

@imthatcarlos imthatcarlos added the wip work in progress label Dec 9, 2022
@imthatcarlos imthatcarlos changed the title [WIP] feature / lz gated follow and reference modules [WIP] feature / lz gated follow, reference, collect modules Dec 12, 2022
@imthatcarlos
Copy link
Contributor Author

Closing in favor of the PR in the lens modules repo: lens-protocol/modules#26

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wip work in progress
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant