Skip to content

feat(launchpad): Use DAO Proposal Single contract address in nft-launchpad contract config#1488

Merged
n0izn0iz merged 14 commits intomainfrom
feat-contract-nft-launchpad-dao-proposal
Feb 22, 2025
Merged

feat(launchpad): Use DAO Proposal Single contract address in nft-launchpad contract config#1488
n0izn0iz merged 14 commits intomainfrom
feat-contract-nft-launchpad-dao-proposal

Conversation

@WaDadidou
Copy link
Collaborator

@WaDadidou WaDadidou commented Jan 8, 2025

WIP zone in the code

// TODO:
// MAKE THE PROPOSAL


Why this PR ?

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

The front must not create a proposal. Also, there is too much back-and-forth between nft-launchpad contract, front and indexer.

The good way is to have the nft-launchpad contract as entry point for project approbation.
Also, the proposal must be created when the project is ready for review. The user don't have to create manually the proposal.
Then, indexer logic can be triggered from the nft-launchpad contract logic. This flow must be agnostic regarding to the front.

So, we'll execute DAO stuff from nft-launchpad contract. To do that, we'll need to store the DAO contract in the nft-launchpad contract config.
The DAO contract used to make the proposal is the Proposal Single one: https://github.com/DA0-DA0/dao-contracts/tree/development/contracts/proposal/dao-proposal-single.

To instantiate the nft-launchpad contact, we need to deploy/instantiate other contracts, so there are many changes in network-setup/scripts/

So, I've updated:

  • The nft-launchpad contract update_merkle_root logic. This is the place where to trigger the proposal creation (this PR's purpose)
  • The deploy/instantiate scripts for nft-launchpad contract (many changes here)
    proposal_id is emitted and will be stored in DB
  • The nft-launchpad contract config
  • The nft-launchpad multitest
  • The CosmWasmNFTLaunchpad feature
  • The deployTeritoriEcosystem script by adding missing DA0DA0 and NFTLaunchpad stuff
  • The structure of scripts folder, to be clearer and versatile. I modified some files here, and sliced "script" TS files and functions TS files
  • Wrong network variables in cw-address-list script
  • The createDaoMemberBased function from dao.ts to make it react-native agnostic: Now, we must pass clients to the function. So, we can use this function in scripts

The biggest changes

All the changes are made to satisfy the main work done on:


Current state

nft-launchpad/multitest.ts runs successfully, that means we can get the created Proposal ID when updating the Merkle Root.
==> When the author completes its collection, an associated proposal is created. The proposal id can be stored.
Have to fix the CI !

@WaDadidou WaDadidou self-assigned this Jan 8, 2025
@netlify
Copy link

netlify bot commented Jan 8, 2025

Deploy Preview for gno-dapp ready!

Name Link
🔨 Latest commit 2efc7ee
🔍 Latest deploy log https://app.netlify.com/sites/gno-dapp/deploys/67ba02c26faf3100087a07c1
😎 Deploy Preview https://deploy-preview-1488--gno-dapp.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@netlify
Copy link

netlify bot commented Jan 8, 2025

Deploy Preview for teritori-dapp ready!

Name Link
🔨 Latest commit 2efc7ee
🔍 Latest deploy log https://app.netlify.com/sites/teritori-dapp/deploys/67ba02c2321dd000085859af
😎 Deploy Preview https://deploy-preview-1488--teritori-dapp.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@WaDadidou WaDadidou requested review from n0izn0iz and removed request for n0izn0iz January 8, 2025 00:41
@WaDadidou WaDadidou changed the title feat(launchpad): Add DAO Proposal Single contract address in nft-launchpad contract config feat(launchpad): Use DAO Proposal Single contract address in nft-launchpad contract config Jan 8, 2025
@WaDadidou WaDadidou force-pushed the feat-contract-nft-launchpad-dao-proposal branch 2 times, most recently from 16add6e to 3d47178 Compare January 9, 2025 00:53
…chpad contract config, enhance nft-launchpad deploying scripts
@WaDadidou WaDadidou force-pushed the feat-contract-nft-launchpad-dao-proposal branch from 7127c7d to d4b1e0c Compare January 29, 2025 23:30
@WaDadidou WaDadidou marked this pull request as ready for review February 14, 2025 21:50
if let Some(proposal_single_contract) = changes.proposal_single_contract {
config.proposal_single_contract =
ctx.deps.api.addr_validate(&proposal_single_contract)?;
attributes.push(attr("new_name", proposal_single_contract.to_string()))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
attributes.push(attr("new_name", proposal_single_contract.to_string()))
attributes.push(attr("new_prop_contract", proposal_single_contract.to_string()))

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Oops yes, forgot this point. Commit will come

Comment on lines +183 to +185
msg: to_json_binary(&ExecuteMsg::DeployCollection {
collection_id: collection_id.clone(),
})?,
Copy link
Collaborator

Choose a reason for hiding this comment

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

where is the DeployCollection handler?

Copy link
Collaborator Author

@WaDadidou WaDadidou Feb 22, 2025

Choose a reason for hiding this comment

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

I though this would work https://github.com/TERITORI/teritori-dapp/blob/feat-contract-nft-launchpad-dao-proposal/rust/cw-contracts/nft-launchpad/src/contract.rs#L24-L27.
It's a custom message to put here:
https://github.com/DA0-DA0/dao-contracts/blob/main/packages/dao-voting/src/proposal.rs#L25-L27

    /// The messages that should be executed in response to this
    /// proposal passing.
    pub msgs: Vec<CosmosMsg<Empty>>,

"proposal_id".to_string(),
))?
.to_owned();

Copy link
Collaborator

Choose a reason for hiding this comment

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

so we do nothing with the proposal_id?

Copy link
Collaborator Author

@WaDadidou WaDadidou Feb 22, 2025

Choose a reason for hiding this comment

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

It's used in the indexer to update the DB (not merged), but we could store it onchain such as deploy_address or merkle_root

@n0izn0iz n0izn0iz merged commit fefe45d into main Feb 22, 2025
21 of 24 checks passed
@n0izn0iz n0izn0iz deleted the feat-contract-nft-launchpad-dao-proposal branch February 22, 2025 21:39
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