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

Cross Chain DAO Tutorial #542

Merged
merged 46 commits into from Mar 27, 2023
Merged

Cross Chain DAO Tutorial #542

merged 46 commits into from Mar 27, 2023

Conversation

jboetticher
Copy link
Contributor

@jboetticher jboetticher commented Feb 13, 2023

Description

Added a tutorial on the smart contracts & design of a cross-chain DAO.

I tried slimming it down a little from its draft version, but it might have ended up longer due to the extra images. This is what I tried to focus on:

  • Architecture
  • Focus on problems & options
  • How a DAO works
  • Special parts that are changed in the conversion from single chain to cross chain DAO

This is what I tried to omit:

  • Using hardhat
  • Testing / deploying

The tutorial is likely still hard to follow, and some things might only make sense to me because I wrote the smart contracts, so feel free to leave critiques on structure and explanations.

Draft Description:

The tutorial is currently massive and hard to follow, so I'm looking into ways to slim it down and add additional visuals to help explain the architecture and potential alternate architectures better. It's also very rough as I could feel my mind melting near the end.

Feel free to ignore this draft PR if you don't want to provide feedback on it yet, but if you have a lot of time to quickly gloss over it to simply tell me what parts were most confusing, it would be helpful. But don't do it too fast... I need a break from this 😧

Checklist

  • If this requires translations for the moonbeam-docs-cn repo, I have created a ticket for the translations in Jira
  • If images have been added, I have run the compress-images.py script to compress the images.
  • If this page requires a disclaimer, I have added one

After Translation Requirements

  • Will need to create PR in moonbeam-docs repo to remove images
  • Will need to create PR in moonbeam-docs repo to remove variables
  • Will need to create PR in moonbeam-mkdocs repo to add redirects for Chinese site
  • No additional PRs are required after the translations are done

Items to be Updated

Please list any of the items that will need to be added or deleted after the translations are done here.

@jboetticher
Copy link
Contributor Author

Here's a neat trick to improve the function selectors, so that you don't have to double wrap with abi.encode

https://github.com/LayerZero-Labs/solidity-examples/blob/6d463b7d5f2da6ff0872d443341f468f3a56fc55/contracts/token/oft/OFTCore.sol#L40

Base automatically changed from tutorials to master February 24, 2023 15:24
@jboetticher jboetticher marked this pull request as ready for review March 9, 2023 00:59
@jboetticher
Copy link
Contributor Author

I tried slimming it down a little from its draft version, but it might have ended up longer due to the extra images. This is what I tried to focus on:

  • Architecture
  • Focus on problems & options
  • How a DAO works
  • Special parts that are changed in the conversion from single chain to cross chain DAO

This is what I tried to omit:

  • Using hardhat
  • Testing / deploying

The tutorial is likely still hard to follow, and some things might only make sense to me because I wrote the smart contracts, so feel free to leave critiques on structure and explanations.

tutorials/interoperability/cross-chain-dao.md Outdated Show resolved Hide resolved
tutorials/interoperability/cross-chain-dao.md Outdated Show resolved Hide resolved
tutorials/interoperability/cross-chain-dao.md Outdated Show resolved Hide resolved
tutorials/interoperability/cross-chain-dao.md Outdated Show resolved Hide resolved
tutorials/interoperability/cross-chain-dao.md Outdated Show resolved Hide resolved

There are many ways to architecture a cross-chain DApp. You could make a more distributed system, where data and logic are distributed to multiple chains to maximize their use. On the other end of the spectrum, you could use a hub-and-spoke model: where the main logic and data are stored on a single chain, and cross-chain messages will interact with it.

![Cross Chain DAO](/images/tutorials/interoperability/cross-chain-dao/cross-chain-dao-2.png)
Copy link
Contributor

Choose a reason for hiding this comment

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

wouldn't the snapshot be taken before it is sent to the spoke chain?

tutorials/interoperability/cross-chain-dao.md Outdated Show resolved Hide resolved
tutorials/interoperability/cross-chain-dao.md Outdated Show resolved Hide resolved
tutorials/interoperability/cross-chain-dao.md Outdated Show resolved Hide resolved
tutorials/interoperability/cross-chain-dao.md Outdated Show resolved Hide resolved
@eshaben
Copy link
Contributor

eshaben commented Mar 22, 2023

@albertov19 this is ready for you to review now if you wanna take a look 👀

@eshaben eshaben requested a review from albertov19 March 22, 2023 21:56
Copy link
Contributor

@eshaben eshaben left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@albertov19 albertov19 left a comment

Choose a reason for hiding this comment

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

LGTM!

@eshaben do you feel we should organize the left hand side navigation to be alphabetical? If so, connected contracts should be above XCM

tutorials/interoperability/cross-chain-dao.md Show resolved Hide resolved
@albertov19
Copy link
Contributor

Also I did do a commit, please review :)

jboetticher and others added 2 commits March 27, 2023 07:50
Co-authored-by: Erin Shaben <eshaben@icloud.com>
Copy link
Contributor

@albertov19 albertov19 left a comment

Choose a reason for hiding this comment

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

LGTM! Great job

@eshaben eshaben merged commit acb0493 into master Mar 27, 2023
1 check passed
@eshaben eshaben deleted the j2-cross-chain-dao branch March 27, 2023 15:23
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.

None yet

3 participants