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

feat(launchpad): Add backend, service, indexer, db #1432

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

WaDadidou
Copy link
Collaborator

@WaDadidou WaDadidou commented Nov 30, 2024

Extracted from #1024

Most work was done by @hthieu1110, thank you mate ❤️

It adds:

  • launchpad backend
  • launchpad service
  • ipfs service
  • one handler in dao indexer
  • launchpad indexer
  • launchpad API
  • merkletree functions

Copy link

netlify bot commented Nov 30, 2024

Deploy Preview for teritori-dapp failed.

Name Link
🔨 Latest commit f903116
🔍 Latest deploy log https://app.netlify.com/sites/teritori-dapp/deploys/67647e0fbec71a0008dd36ac

Copy link

netlify bot commented Nov 30, 2024

Deploy Preview for gno-dapp failed.

Name Link
🔨 Latest commit f903116
🔍 Latest deploy log https://app.netlify.com/sites/gno-dapp/deploys/67647e0f6af540000815fdec

Copy link
Member

@MikaelVallenet MikaelVallenet left a comment

Choose a reason for hiding this comment

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

I put some comments, feel free to answer so i can approve or request changes

api/launchpad/v1/launchpad.proto Show resolved Hide resolved
api/launchpad/v1/launchpad.proto Show resolved Hide resolved
api/launchpad/v1/launchpad.proto Show resolved Hide resolved
api/launchpad/v1/launchpad.proto Show resolved Hide resolved
string sender = 1;
string network_id = 2;
string project_id = 3;
string proposal_id = 4;
Copy link
Member

Choose a reason for hiding this comment

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

why is there a proposal id, if you want to create a proposal to approve a project request
or maybe i don't understand the purpose of this message

Copy link
Member

Choose a reason for hiding this comment

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

if this is about approving a project request what about: ApproveProjectRequestProposal

Copy link
Collaborator Author

@WaDadidou WaDadidou Dec 5, 2024

Choose a reason for hiding this comment

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

It's about updating the DB after creating+approving a proposal.
ProposeApproveProjectRequest is called after the proposal has been created, it's not used to create a proposal, we create the proposal on front using DA0 contract.

The flow in front is:

  • Make a proposal using DA0 DA0 (onchain)
  • Get the proposal id
  • Vote "yes" using DA0 DA0 (onchain)
  • Trigger ProposeApproveProject to update db (indexer)

This flow is here: https://github.com/TERITORI/teritori-dapp/blob/feat/cosmwasm-launchpad/packages/hooks/launchpad/useProposeApproveProject.ts#L30

I hope it makes sense ^^"

Copy link
Collaborator

@n0izn0iz n0izn0iz Dec 5, 2024

Choose a reason for hiding this comment

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

this should be the responsibility of an indexer handler, not triggered by an api call

Copy link
Collaborator Author

@WaDadidou WaDadidou Dec 7, 2024

Choose a reason for hiding this comment

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

this should be the responsibility of an indexer handler, not triggered by an api call

I will need some instructions to make this refacto.
Should we use that as entry point from front ? https://github.com/TERITORI/teritori-dapp/blob/feat/cosmwasm-launchpad/packages/hooks/launchpad/useProposeApproveProject.ts#L30
Which wasm action to listen ? This one ? https://github.com/TERITORI/teritori-dapp/blob/feat-launchpad-backend/go/internal/indexerhandler/handle.go#L325-L328

Copy link
Collaborator

@n0izn0iz n0izn0iz Dec 17, 2024

Choose a reason for hiding this comment

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

it would be the execute action on the dao contract in the top handler, but it's already handled and we need to listen to the submsg here really https://github.com/TERITORI/teritori-dapp/blob/feat-launchpad-backend/go/internal/indexerhandler/dao.go#L264
I'm not sure what is the correct action on the launchpad contract though, it would be the one proposed.

Copy link
Collaborator Author

@WaDadidou WaDadidou Dec 20, 2024

Choose a reason for hiding this comment

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

Hm ok, but we need to handle things before "deploy_collection".

  • Either we listen for "propose" (DAO) (Then trigger the indexer launchpad stuff)
  • Either we trigger ProposeApproveProject (Launchpad backend) (Then trigger the DAO stuff)
    No ?

So, the best should be the first proposition (DAO contract is the entry, and we just trigger sepcific stuff depending on the Proposed action).

Actually, we can listen for "propose" and actions when the proposal is executed ("update_members", "create_post", ect).
But we can"t listen for the things in between, like "propose XXX" (Not just "propose", not just waiting for execution, but "do things if a proposal for XXX is made")

This though comes here: https://github.com/TERITORI/teritori-dapp/blob/feat-launchpad-backend/go/internal/indexerhandler/handle.go#L325
Could we have something like case "propose.deploy_collection ?

What is the NFT Launchpad use case ?
We want to make a proposal + vote "yes" + update project status in DB. The vote and update DB should be placed after "propose" and before "deploy_collection".

go/internal/indexerhandler/launchpad.go Outdated Show resolved Hide resolved
go/internal/indexerhandler/launchpad.go Outdated Show resolved Hide resolved
go/internal/indexerhandler/launchpad.go Show resolved Hide resolved

switch provider {
case Pinata:
url = "https://api.pinata.cloud/psa"
Copy link
Member

Choose a reason for hiding this comment

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

i like to have const data like this on top of the file in a const so we can reuse-it and modify it easily from one place.I know it's used juste one time here, just personal preference, feel free to do what you feel is right

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Copy link
Collaborator

@n0izn0iz n0izn0iz left a comment

Choose a reason for hiding this comment

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

partial

api/launchpad/v1/launchpad.proto Outdated Show resolved Hide resolved
api/launchpad/v1/launchpad.proto Outdated Show resolved Hide resolved
api/launchpad/v1/launchpad.proto Outdated Show resolved Hide resolved
api/launchpad/v1/launchpad.proto Outdated Show resolved Hide resolved
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.

3 participants