@@ -133,6 +133,8 @@ impl NftLaunchpad {
133133 merkle_root : String ,
134134 ) -> Result < Response , ContractError > {
135135 let storage = ctx. deps . storage ;
136+ let config = self . config . load ( ctx. deps . storage ) ?;
137+
136138
137139 let mut collection = self
138140 . collections
@@ -155,72 +157,51 @@ impl NftLaunchpad {
155157 // Update collection
156158 self . collections . save ( storage, collection_id, & collection) ?;
157159
158- Ok ( Response :: new ( )
159- . add_attribute ( "action" , "update_merkle_root" )
160- . add_attribute ( "merkle_root" , merkle_root) )
161- }
162160
163- #[ msg( exec) ]
164- pub fn deploy_collection (
165- & self ,
166- ctx : ExecCtx ,
167- collection_id : String ,
168- ) -> Result < Response , ContractError > {
169- let sender = ctx. info . sender . to_string ( ) ;
170- let config = self . config . load ( ctx. deps . storage ) ?;
171161
172- // Only allow launchpad_admin to deploy
173- if sender != config. admin {
174- return Err ( ContractError :: WrongDeployer ) ;
175- }
162+ // TODO:
163+ // MAKE THE PROPOSAL
176164
177- let collection = self
178- . collections
179- . load ( ctx. deps . storage , collection_id. to_owned ( ) )
180- . map_err ( |_| ContractError :: CollectionNotFound ) ?;
181165
182- // Do not allow to deploy collection if merkle root is not set
183- if collection . metadatas_merkle_root . is_none ( ) {
184- return Err ( ContractError :: MerkleRootMissing ) ;
185- }
166+
167+ // verify proposal_id exists using DA0 contract
168+
169+ // vote yes to this proposal
186170
187- let nft_code_id = config. nft_code_id ;
188-
189- // NOTE: cannot use wasm_instantiate because we need to specify admin
190- let instantiate_msg = WasmMsg :: Instantiate {
191- admin : Some ( sender. clone ( ) ) ,
192- code_id : nft_code_id,
193- msg : to_json_binary ( & Tr721InstantiateMsg {
194- admin : sender. clone ( ) ,
195- name : collection. name . clone ( ) ,
196- symbol : collection. symbol . clone ( ) ,
197- minter : sender,
198- launchpad_contract : "launchpad_contract" . to_string ( ) ,
199- mint_info : Tr721MintInfo {
200- metadatas_merkle_root : collection. metadatas_merkle_root . unwrap ( ) ,
201- tokens_count : collection. tokens_count ,
202- royalty_address : collection. royalty_address ,
203- royalty_percentage : collection. royalty_percentage ,
204- } ,
205- mint_periods : collection. mint_periods ,
171+ // emit "project_id"
172+
173+ // with indexer, listen to vote_approve_project and trigger UpdateApprovedProject
174+
175+ let proposal_contract_addr = config. dao_proposal_single_contract_addr ;
176+
177+ let proposal_msg = WasmMsg :: Execute {
178+ contract_addr : proposal_contract_addr. to_string ( ) ,
179+ msg : to_json_binary ( & dao_contracts:: msg:: ExecuteMsg :: Propose {
180+ title : format ! ( "Approve Merkle Root Update for {}" , collection_id) ,
181+ description : format ! (
182+ "Update the Merkle root for collection {} to {}." ,
183+ collection_id, merkle_root
184+ ) ,
185+ msgs : vec ! [ cosmwasm_std:: CosmosMsg :: Wasm ( WasmMsg :: Execute {
186+ contract_addr: ctx. env. contract. address. to_string( ) ,
187+ msg: to_json_binary( & Self :: msg( ) . approve_merkle_root_update {
188+ collection_id: collection_id. clone( ) ,
189+ } ) ?,
190+ funds: vec![ ] ,
191+ } ) ] ,
206192 } ) ?,
207193 funds : vec ! [ ] ,
208- label : format ! (
209- "TR721 codeId:{} collectionId:{} symbol:{}" ,
210- nft_code_id, collection_id, collection. symbol
211- ) ,
212194 } ;
213195
214- // Update instantiating collection id
215- self . instantiating_collection_id
216- . save ( ctx. deps . storage , & collection_id) ?;
217196
218- let submessage = SubMsg :: reply_on_success ( instantiate_msg, INSTANTIATE_REPLY_ID ) ;
219197
220198 Ok ( Response :: new ( )
221- . add_submessage ( submessage)
222- . add_attribute ( "action" , "collection_deployed" )
223- . add_attribute ( "collection_id" , collection_id) )
199+ // TODO:
200+ // .add_message(makeProposalMsg)
201+ . add_attribute ( "action" , "update_merkle_root" )
202+ . add_attribute ( "merkle_root" , merkle_root) )
203+ // TODO:
204+ // .add_attribute("proposal_id", proposal_id))
224205 }
225206
226207 #[ msg( query) ]
@@ -274,6 +255,7 @@ pub struct Config {
274255 pub nft_code_id : u64 ,
275256 pub admin : Addr ,
276257 pub owner : Addr ,
258+ pub dao_proposal_single_contract_addr : Addr ,
277259}
278260
279261#[ cw_serde]
@@ -282,6 +264,7 @@ pub struct ConfigChanges {
282264 pub nft_code_id : Option < u64 > ,
283265 pub admin : Option < String > ,
284266 pub owner : Option < String > ,
267+ pub dao_proposal_single_contract_addr : Option < Addr > ,
285268}
286269
287270#[ cw_serde]
0 commit comments