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

feature / lz gated modules #26

Open
wants to merge 16 commits into
base: master
Choose a base branch
from

Conversation

imthatcarlos
Copy link

@imthatcarlos imthatcarlos commented Dec 30, 2022

New features

  • new modules LZGatedFollowModule, LZGatedCollectModule, and LZGatedReferenceModule to do cross-chain token gating
  • supporting lz contracts LZGatedProxy, LzApp, NonblockingLzApp, and SimpleLzApp
  • new mocha tests
  • new hardhat tasks

Example (LZGatedFollowModule)

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

TODO

  • fix newly failing test in /lz-gated-follow-module.spec.ts
  • fix cause for event MessageFailed being emitted when the tx actually succeeds
  • improve fee estimates
  • improve gas estimates
  • ask lz team: latency between #send on source chain and #lzReceive on destination chain can be between 5-30min+ (goerli => mumbai) => testnet infra was updated, not an issue on mainnet ✅

@height
Copy link

height bot commented Dec 30, 2022

Link Height tasks by mentioning a task ID in the pull request title or commit messages, or description and comments with the keyword link (e.g. "Link T-123").

💡Tip: You can also use "Close T-X" to automatically close a task when the pull request is merged.

…to lzgatedproxy; update tests + tasks to use estimateFees* functions
…efailed OR executes noblocking; impr: better tests for message failed; impr: updated readme for tasks; new testnet deployment
Copy link
Member

@donosonaumczuk donosonaumczuk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey guys, good work!

There are lot of files that we are adding to the repo that are not necessarily ad-hoc for the Lens modules, but instead generic LayerZero contracts. It would be nice if you import your core repo as a dependency instead, or even create a separate repo that can be used as dependency if some of the files are not included in your core repo.

The idea is to avoid increasing the amount of files here when are not 100% related to the code of each of the Lens modules. Same reason why I am asking to remove some duplicated mocks from the PR.

contracts/lz/LzApp.sol Outdated Show resolved Hide resolved
contracts/lz/NonblockingLzApp.sol Outdated Show resolved Hide resolved
contracts/lz/SimpleLzApp.sol Outdated Show resolved Hide resolved
contracts/lz/interfaces/ILayerZeroEndpoint.sol Outdated Show resolved Hide resolved
contracts/lz/interfaces/ILayerZeroReceiver.sol Outdated Show resolved Hide resolved
contracts/lz/libraries/LzLib.sol Outdated Show resolved Hide resolved
contracts/lz/mocks/LZEndpointMock.sol Outdated Show resolved Hide resolved
contracts/mocks/ERC20Mock.sol Outdated Show resolved Hide resolved
contracts/mocks/ERC721Mock.sol Outdated Show resolved Hide resolved
@imthatcarlos
Copy link
Author

thanks for the feedback @donosonaumczuk 🙏 I resolved all comments and pushed changes

  • imported the @layerzerolabs/solidity-examples package for the lz contracts + deleted all the extra files
  • opted to re-using the LzApp instead of my SimpleLzApp; all i had to do was not process messages received
  • used the exiting mocks
  • add LzEndpointMock in the typechain config externalArtifacts; only runs for tests, lmk if that works

@imthatcarlos imthatcarlos changed the title [WIP] feature / lz gated modules feature / lz gated modules Mar 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants