From 1910f20f4062bd9088ec854f19a5e00c109f3611 Mon Sep 17 00:00:00 2001 From: WGB5445 <919603023@qq.com> Date: Thu, 13 Oct 2022 14:59:35 +0800 Subject: [PATCH 1/5] Add title and introduction --- .../InstallPluginProposalPlugin.mv | Bin 1195 -> 1207 bytes .../bytecode_modules/MemberProposalPlugin.mv | Bin 1582 -> 1622 bytes .../docs/InstallPluginProposalPlugin.md | 6 +- .../docs/MemberProposalPlugin.md | 24 +-- .../InstallPluginProposalPlugin.mvsm | Bin 4603 -> 4786 bytes .../source_maps/MemberProposalPlugin.mvsm | Bin 7976 -> 8708 bytes integration-tests/daospace/dao_proposal.exp | 4 +- integration-tests/daospace/dao_proposal.move | 2 +- .../daospace/dao_proposal_rejected.move | 2 +- .../daospaceplugin/gas_oracle_plugin.exp | 2 +- .../daospaceplugin/gas_oracle_plugin.move | 2 +- .../daospaceplugin/mint_proposal_plugin.exp | 2 +- .../daospaceplugin/mint_proposal_plugin.move | 2 +- .../daospaceplugin/salary_gov_plugin.move | 4 +- .../starcoin_dao/starcoin_onchain_config.exp | 4 +- .../starcoin_dao/starcoin_onchain_config.move | 2 +- .../starcoin_dao/starcoin_upgrade_module.exp | 2 +- .../starcoin_dao/starcoin_upgrade_module.move | 2 +- sources/OnChainStarcoinDAOConfig.move | 168 ++++++++++-------- sources/daospace/DAOSpace.move | 12 +- sources/daospaceplugin/AnyMemberPlugin.move | 8 +- .../daospaceplugin/ConfigProposalPlugin.move | 12 +- .../GasOracleProposalPlugin.move | 16 +- .../daospaceplugin/GrantProposalPlugin.move | 24 +-- .../InstallPluginProposalPlugin.move | 4 +- .../daospaceplugin/MemberProposalPlugin.move | 16 +- .../daospaceplugin/MintProposalPlugin.move | 16 +- sources/daospaceplugin/StakeToSBTPlugin.move | 30 +++- sources/daospaceplugin/TreasuryPlugin.move | 8 +- .../daospaceplugin/UpgradeModulePlugin.move | 16 +- 30 files changed, 223 insertions(+), 167 deletions(-) diff --git a/build/StarcoinFramework/bytecode_modules/InstallPluginProposalPlugin.mv b/build/StarcoinFramework/bytecode_modules/InstallPluginProposalPlugin.mv index 8e331c7fc6b50a37cbef651252687daefb4cd72f..37ea5ee01b8088761948a5d212eb3edeb0b06122 100644 GIT binary patch delta 110 zcmZ3@xt()@q|8f3_C?H-nK`zy39uby>ty6Q$Iioji=Bz*4*Qacrn@-V*m$@&n7Ej@ zCVp`cU}xiIX5wVvWMt#v1c_~SU_8&HAj~Pm$iu1K5C**li2(}62Mi0+2LcS#2cVHPx&;IV3=NJ1`G+aNCD3R91#f;0SpEX1~>o=1q%T=01N~U1q%QR1PcNR1Cuud EfK)jV{r~^~ diff --git a/build/StarcoinFramework/bytecode_modules/MemberProposalPlugin.mv b/build/StarcoinFramework/bytecode_modules/MemberProposalPlugin.mv index 69df9a7888839df03f0d39ec250b92821df795c5..6180de3a21fec05ed9a0a4c97785905e75ce85ed 100644 GIT binary patch delta 323 zcmY+7y-Gwu426@-Zzj2Oe*{?+VQsV(t8t&gH}MhdwiM-xy|rLt=|kArZnbY9+BzdH zB7u-E=bYqO-}Uxj@krs`zS{T}2fvAHOk1Axi=Xb!KUVBDQ7hM)HNgLwyc$x2Ufs@V z+>d3x#MKbI7-Hb6b2~FX;F^7P#zrs4^hwueJfZfvFQ7SDR3^=CKinKH*4WVMr0@4WziAk{-BqRWo48J=oPJ9YgvqT86ci8^MJm0vhizqOL cov~!{EgSx_rKeCcF^>CXQ0QP>lu>}-8(oSVjsO4v delta 247 zcmYL=txiKh5QXPwcXsEeH}tB~q)8Pd2n6av(sx1f6v!rZC08Qw6&OSX4}ijAc?p6- zur~>38QRelo-l?CJClsY-ci< zW4y(i$l^>2+Ik%ixXr1p_2rtr>F!c{j9E7uAlgS1%Tb*}J%xGk>gL)*xY2-XUO8aF xxt%wpHJ?og4ZCn~cQhFo2?+qTgU00S$+F4#lpublic fun create_proposal<DAOT: store, ToInstallPluginT: store>(sender: &signer, required_caps: vector<DAOSpace::CapType>, description: vector<u8>, action_delay: u64) +
public fun create_proposal<DAOT: store, ToInstallPluginT: store>(sender: &signer, required_caps: vector<DAOSpace::CapType>, title: vector<u8>, introduction: vector<u8>, description: vector<u8>, action_delay: u64)
 
@@ -159,7 +159,7 @@ Implementation -
public fun create_proposal<DAOT: store, ToInstallPluginT: store>(sender: &signer, required_caps: vector<CapType>, description: vector<u8>, action_delay: u64){
+
public fun create_proposal<DAOT: store, ToInstallPluginT: store>(sender: &signer, required_caps: vector<CapType>, title:vector<u8>, introduction:vector<u8>, description: vector<u8>, action_delay: u64){
     let witness = InstallPluginProposalPlugin{};
 
     let cap = DAOSpace::acquire_proposal_cap<DAOT, InstallPluginProposalPlugin>(&witness);
@@ -167,7 +167,7 @@
         required_caps,
     };
 
-    DAOSpace::create_proposal(&cap, sender, action, description, action_delay);
+    DAOSpace::create_proposal(&cap, sender, action, title, introduction, description, action_delay);
 }
 
diff --git a/build/StarcoinFramework/docs/MemberProposalPlugin.md b/build/StarcoinFramework/docs/MemberProposalPlugin.md index 5539887c..0d24f9ac 100644 --- a/build/StarcoinFramework/docs/MemberProposalPlugin.md +++ b/build/StarcoinFramework/docs/MemberProposalPlugin.md @@ -197,7 +197,7 @@ -
public fun create_proposal<DAOT: store>(sender: &signer, description: vector<u8>, member: address, image_data: vector<u8>, image_url: vector<u8>, init_sbt: u128, action_delay: u64)
+
public fun create_proposal<DAOT: store>(sender: &signer, title: vector<u8>, introduction: vector<u8>, description: vector<u8>, member: address, image_data: vector<u8>, image_url: vector<u8>, init_sbt: u128, action_delay: u64)
 
@@ -206,7 +206,7 @@ Implementation -
public fun create_proposal<DAOT: store>(sender: &signer, description: vector<u8>, member: address, image_data:vector<u8>, image_url:vector<u8>, init_sbt: u128, action_delay: u64){
+
public fun create_proposal<DAOT: store>(sender: &signer, title:vector<u8>, introduction:vector<u8>, description: vector<u8>, member: address, image_data:vector<u8>, image_url:vector<u8>, init_sbt: u128, action_delay: u64){
     let witness = MemberProposalPlugin{};
     let cap = DAOSpace::acquire_proposal_cap<DAOT, MemberProposalPlugin>(&witness);
     let action = MemberJoinAction{
@@ -217,7 +217,7 @@
     };
     assert!(!DAOSpace::is_exist_member_offer<DAOT>(member), Errors::already_published(ERR_MEMBER_OFFER_EXIST));
     assert!(!DAOSpace::is_member<DAOT>(member), Errors::already_published(ERR_MEMBER_EXIST));
-    DAOSpace::create_proposal(&cap, sender, action, description, action_delay);
+    DAOSpace::create_proposal(&cap, sender, action, title, introduction, description, action_delay);
 }
 
@@ -231,7 +231,7 @@ -
public(script) fun create_proposal_entry<DAOT: store>(sender: signer, description: vector<u8>, member: address, image_data: vector<u8>, image_url: vector<u8>, init_sbt: u128, action_delay: u64)
+
public(script) fun create_proposal_entry<DAOT: store>(sender: signer, title: vector<u8>, introduction: vector<u8>, description: vector<u8>, member: address, image_data: vector<u8>, image_url: vector<u8>, init_sbt: u128, action_delay: u64)
 
@@ -240,8 +240,8 @@ Implementation -
public (script) fun create_proposal_entry<DAOT: store>(sender: signer, description: vector<u8>, member: address, image_data:vector<u8>, image_url:vector<u8>, init_sbt: u128, action_delay: u64){
-    create_proposal<DAOT>(&sender, description, member, image_data, image_url, init_sbt, action_delay);
+
public (script) fun create_proposal_entry<DAOT: store>(sender: signer, title:vector<u8>, introduction:vector<u8>, description: vector<u8>, member: address, image_data:vector<u8>, image_url:vector<u8>, init_sbt: u128, action_delay: u64){
+    create_proposal<DAOT>(&sender, title, introduction, description, member, image_data, image_url, init_sbt, action_delay);
 }
 
@@ -307,7 +307,7 @@ -
public fun install_plugin_proposal<DAOT: store>(sender: &signer, description: vector<u8>, action_delay: u64)
+
public fun install_plugin_proposal<DAOT: store>(sender: &signer, title: vector<u8>, introduction: vector<u8>, description: vector<u8>, action_delay: u64)
 
@@ -316,8 +316,8 @@ Implementation -
public fun install_plugin_proposal<DAOT:store>(sender:&signer, description: vector<u8>,action_delay:u64){
-    InstallPluginProposalPlugin::create_proposal<DAOT, MemberJoinAction>(sender, required_caps(), description, action_delay);
+
public fun install_plugin_proposal<DAOT:store>(sender:&signer, title:vector<u8>, introduction:vector<u8>, description: vector<u8>,action_delay:u64){
+    InstallPluginProposalPlugin::create_proposal<DAOT, MemberJoinAction>(sender, required_caps(), title, introduction, description, action_delay);
 }
 
@@ -331,7 +331,7 @@ -
public(script) fun install_plugin_proposal_entry<DAOT: store>(sender: signer, description: vector<u8>, action_delay: u64)
+
public(script) fun install_plugin_proposal_entry<DAOT: store>(sender: signer, title: vector<u8>, introduction: vector<u8>, description: vector<u8>, action_delay: u64)
 
@@ -340,8 +340,8 @@ Implementation -
public (script) fun install_plugin_proposal_entry<DAOT:store>(sender:signer, description: vector<u8>, action_delay:u64){
-    install_plugin_proposal<DAOT>(&sender, description, action_delay);
+
public (script) fun install_plugin_proposal_entry<DAOT:store>(sender:signer, title:vector<u8>, introduction:vector<u8>, description: vector<u8>, action_delay:u64){
+    install_plugin_proposal<DAOT>(&sender, title, introduction, description, action_delay);
 }
 
diff --git a/build/StarcoinFramework/source_maps/InstallPluginProposalPlugin.mvsm b/build/StarcoinFramework/source_maps/InstallPluginProposalPlugin.mvsm index 056bb4e0a6bee2499e093d71a5f75f8e9739f8c7..96475ca8c32d4afa932626cc7b1bd6d357fb2134 100644 GIT binary patch literal 4786 zcmbW4NoW&c7>55gX}V0+YN{TrA{ab~P%natxZsA0Sg>GKFvez-(R4CRrY^W3UZgId zD0M;H5JkkJ8-kZY71VmLda)ivQ4|Ye@!-Mbnc5LOy;BR%q40d)pZWgz-~9QOTD|^s za^I|~HE~l|zN>TXiwg@S0)PLNj9cm!{Y);`kZarQxDAE8 zmoH`p|0^}-o9MfUhD}gX)0qFKQ=_WPP}Le#D)9)?nLv~u#=@Emx@TyX=_kC6(*>pR zh4WX+r+R?-2!=e49*W*VB2l#6tX)u3>BH@ZVFkOj%_-Q~baTcls;VDUSP5gwe8fm!h%*=SKT4oV|tV+wZ) zSl-~*S=z~}6F(h)9>hmEzrPUE-oQ6v5UZ;8R;4iyq598y5sD77SO*L(z!NN!gs8#P z$O`L#eU}@*9&Z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3;%;0k|bu75nJn*4*ax;EBbUXIBbWf0bAW#ys94@61 zYk$T`+KG(3aZL&^Qy6RScH-7tBBd_VD{Ek2XiI;YC#9Hx6eA58|illbliITspIw) z{oaC(+X1W}pyM{gi7x{kx6`o}fsWg0!={eg8q5Y5D^sU>*esLgcFfZ-PMSwqq4SvI zrRiE1z{jI}2d&FhO-|6y7ivH5d)Mb0sjiE^@Fwv^tB><1%yLY9oW1e&ab8NlRiKY^ V4c1Q3H?rASyFefOW~_r?%x`K&bYB1f diff --git a/build/StarcoinFramework/source_maps/MemberProposalPlugin.mvsm b/build/StarcoinFramework/source_maps/MemberProposalPlugin.mvsm index 25ac95639a91a49c369e17de9029eff3c245f073..ec5b72f4f5a2f2f384279422eeac61a6c5688ed1 100644 GIT binary patch literal 8708 zcmb7}TWnNS6o${VWqL1zlv?E?rUC**Qwm1GOKT{mN@=+m8e$x$ogh(Qqx(Q1&AAcztPF{u!sDB)5cK#-u~cUq3&?caywd!gT6=d#z{ zYwa`jbzf~cdum?Cq2-^d)&XWdS2xlqy|i*Q3aKI6 z(Yqjfa7b$+sz&r+ABL<*ERqT)8&YaOFLEE`g$CYJFlbNV5WK6%3K4`wsllbdw=VnrIn%jxD6UIpMO{_2AE@{4j<=A7TxelujN~C!N z>lEB0%`dS|!#HWWS069UtZYgPOps;)Rw3Lg%_6K(Fj1Oguu5Q(G{<3;!DMNcV?7F` z(yYLm15>2g&s(p-ykDA*H5UvTy%<_MnDu0B$b_9|Oal>*)S_!%ZX~*gS-GZ#g+6cM@*@X20=oX|CYa3+B#kL)57wBfC3u_-_%b2xTJ)qkf z$J!4Dul_h%KbS4`KQJ#rn&I*5Z^tF6a^pA8&A~`mb-DTY#gOS?WgW*q3+AVtbJ&-_ zcxC;J+zW==!$H&|kTZC~3mO~;UdXeo<&gLP%Q6_Wm}@)_re}y!+;X5vk_qi z*o~?ea3}G$f?mK8tZkqdu=@`50$nR>pLI?W?*izvPCwRV z&}W_We9OuQeb%``yaG&p))|d89`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^hSSgD`A)v|1y-^LvRIs>`k-o^V8^kFkm^VXPSF2EP|;0Ca=D4r>r} zga0ztPS6ehGg!NzP-b&C)?T<=n#-|vE8fid(_)S=Qzkkza+xoHjSY z=RLo>Ar|QhhGX*M%eRTVjzDg(GZJz;-Eho)?6Zt}18nP6HaW@%j+xBWKi+JJt#dUE zs~mK$DzR39&Q%B22GEslAHTB~Q`f6Eu?~Q)S7u#xy&5Op1<>`%9tZSyLQmKIkg6 zfS6U7x(az#HCVJ>?OaZeg5B-@7-ladT3%88xLY8eSMF{2J0Y&O)gcCa2;P~L*Gz6U z#T4{4GXtv>^fgn4RRQ{%S%_5w`kMKQ3Dsii2HLZhfyIr~j@Acu3Ezmh32YO-1@{Gr zC*iN*?}4}yKEi-cz*`-e@IMg$2A%M8Sjkgu5}t~c2Rh-S#LUOk3HPi5uqYQTOxyL2 zIEmyfQwVDY!#rOv*J0uv1HD}1SU%3XJ|CZXzY$Xx n>>R8-a1wHAnwtFeHTAdEH2G^<>h5kPH<$cZLv5}3gU|UFe8P}n diff --git a/integration-tests/daospace/dao_proposal.exp b/integration-tests/daospace/dao_proposal.exp index 60eafac8..7086d922 100644 --- a/integration-tests/daospace/dao_proposal.exp +++ b/integration-tests/daospace/dao_proposal.exp @@ -60,7 +60,7 @@ task 22 'run'. lines 300-311: task 23 'run'. lines 314-338: { - "gas_used": 476235, + "gas_used": 482246, "status": "Executed" } @@ -109,7 +109,7 @@ task 34 'run'. lines 403-416: task 36 'run'. lines 421-436: { - "gas_used": 106454, + "gas_used": 106598, "status": "Executed" } diff --git a/integration-tests/daospace/dao_proposal.move b/integration-tests/daospace/dao_proposal.move index 16206126..9294b35e 100644 --- a/integration-tests/daospace/dao_proposal.move +++ b/integration-tests/daospace/dao_proposal.move @@ -104,7 +104,7 @@ module creator::DAOHelper { total, receiver, }; - let proposal_id = DAOSpace::create_proposal(&cap, sender, action, b"ipfs://description", action_delay); + let proposal_id = DAOSpace::create_proposal(&cap, sender, action,b"ipfs://description",b"ipfs://description", b"ipfs://description", action_delay); checkpoint(proposal_id); proposal_id diff --git a/integration-tests/daospace/dao_proposal_rejected.move b/integration-tests/daospace/dao_proposal_rejected.move index d17589a9..866038aa 100644 --- a/integration-tests/daospace/dao_proposal_rejected.move +++ b/integration-tests/daospace/dao_proposal_rejected.move @@ -81,7 +81,7 @@ module creator::DAOHelper { total, receiver, }; - let proposal_id = DAOSpace::create_proposal(&cap, sender, action, b"ipfs://description", action_delay); + let proposal_id = DAOSpace::create_proposal(&cap, sender, action,b"ipfs://description",b"ipfs://description", b"ipfs://description", action_delay); checkpoint(proposal_id); proposal_id diff --git a/integration-tests/daospaceplugin/gas_oracle_plugin.exp b/integration-tests/daospaceplugin/gas_oracle_plugin.exp index 38b178cc..218726b0 100644 --- a/integration-tests/daospaceplugin/gas_oracle_plugin.exp +++ b/integration-tests/daospaceplugin/gas_oracle_plugin.exp @@ -32,7 +32,7 @@ task 16 'run'. lines 142-151: task 17 'run'. lines 154-179: { - "gas_used": 449602, + "gas_used": 457891, "status": "Executed" } diff --git a/integration-tests/daospaceplugin/gas_oracle_plugin.move b/integration-tests/daospaceplugin/gas_oracle_plugin.move index c709fb7f..251d9e68 100644 --- a/integration-tests/daospaceplugin/gas_oracle_plugin.move +++ b/integration-tests/daospaceplugin/gas_oracle_plugin.move @@ -162,7 +162,7 @@ script { fun main(account: signer) { let description = b"oracle select proposal"; let action_delay = 0; - GasOracleProposalPlugin::create_oracle_add_proposal(account, description, action_delay, @alice); + GasOracleProposalPlugin::create_oracle_add_proposal(account, b"oracle select proposal",b"oracle select proposal", description, action_delay, @alice); let proposal = DAOSpace::proposal(1); let proposer = DAOSpace::proposal_proposer(&proposal); let (start_time, end_time) = DAOSpace::proposal_time(&proposal); diff --git a/integration-tests/daospaceplugin/mint_proposal_plugin.exp b/integration-tests/daospaceplugin/mint_proposal_plugin.exp index 836f7775..851f01a1 100644 --- a/integration-tests/daospaceplugin/mint_proposal_plugin.exp +++ b/integration-tests/daospaceplugin/mint_proposal_plugin.exp @@ -55,7 +55,7 @@ task 19 'run'. lines 164-173: task 20 'run'. lines 175-206: { - "gas_used": 450230, + "gas_used": 455659, "status": "Executed" } diff --git a/integration-tests/daospaceplugin/mint_proposal_plugin.move b/integration-tests/daospaceplugin/mint_proposal_plugin.move index e1354dfd..68fb4c1b 100644 --- a/integration-tests/daospaceplugin/mint_proposal_plugin.move +++ b/integration-tests/daospaceplugin/mint_proposal_plugin.move @@ -186,7 +186,7 @@ script { let amount = 100000; let action_delay = 0; MintProposalPlugin::create_mint_proposal( - &sender, description, @bob, amount, action_delay); + &sender,b"mint to bob", b"mint to bob", description, @bob, amount, action_delay); let proposal = DAOSpace::proposal(1); diff --git a/integration-tests/daospaceplugin/salary_gov_plugin.move b/integration-tests/daospaceplugin/salary_gov_plugin.move index de3bbcd7..6874569b 100644 --- a/integration-tests/daospaceplugin/salary_gov_plugin.move +++ b/integration-tests/daospaceplugin/salary_gov_plugin.move @@ -161,14 +161,14 @@ module creator::SalaryGovPlugin { } /// Create proposal for specific admin account - public(script) fun create_boss_elect_proposal(sender: signer, description: vector, action_delay: u64) { + public(script) fun create_boss_elect_proposal(sender: signer, title:vector, introduction:vector, description: vector, action_delay: u64) { let witness = SalaryGovPlugin {}; let cap = DAOSpace::acquire_proposal_cap(&witness); let action = BossProposalAction { boss: Signer::address_of(&sender) }; - DAOSpace::create_proposal(&cap, &sender, action, description, action_delay); + DAOSpace::create_proposal(&cap, &sender, action, title, introduction, description, action_delay); } public(script) fun execute_proposal(sender: signer, proposal_id: u64) { diff --git a/integration-tests/starcoin_dao/starcoin_onchain_config.exp b/integration-tests/starcoin_dao/starcoin_onchain_config.exp index f3cbd4e9..54f79b20 100644 --- a/integration-tests/starcoin_dao/starcoin_onchain_config.exp +++ b/integration-tests/starcoin_dao/starcoin_onchain_config.exp @@ -38,7 +38,7 @@ task 21 'run'. lines 111-120: task 22 'run'. lines 123-132: { - "gas_used": 448939, + "gas_used": 455310, "status": "Executed" } @@ -98,7 +98,7 @@ task 40 'run'. lines 232-248: task 41 'run'. lines 250-261: { - "gas_used": 164164, + "gas_used": 164212, "status": { "MoveAbort": { "location": { diff --git a/integration-tests/starcoin_dao/starcoin_onchain_config.move b/integration-tests/starcoin_dao/starcoin_onchain_config.move index b438ac24..444d4b85 100644 --- a/integration-tests/starcoin_dao/starcoin_onchain_config.move +++ b/integration-tests/starcoin_dao/starcoin_onchain_config.move @@ -127,7 +127,7 @@ script { fun propose (sender: signer){ assert!(RewardConfig::reward_delay() == 1, 101); - OnChainStarcoinDAOConfig::propose_update_reward_config(&sender, b"update", 5 , 3600000); + OnChainStarcoinDAOConfig::propose_update_reward_config(&sender, b"update",b"update",b"update", 5 , 3600000); } } diff --git a/integration-tests/starcoin_dao/starcoin_upgrade_module.exp b/integration-tests/starcoin_dao/starcoin_upgrade_module.exp index 972c31eb..8402cf49 100644 --- a/integration-tests/starcoin_dao/starcoin_upgrade_module.exp +++ b/integration-tests/starcoin_dao/starcoin_upgrade_module.exp @@ -38,7 +38,7 @@ task 21 'run'. lines 111-120: task 23 'run'. lines 127-137: { - "gas_used": 434673, + "gas_used": 440770, "status": "Executed" } diff --git a/integration-tests/starcoin_dao/starcoin_upgrade_module.move b/integration-tests/starcoin_dao/starcoin_upgrade_module.move index 8997ea21..3a4ef65d 100644 --- a/integration-tests/starcoin_dao/starcoin_upgrade_module.move +++ b/integration-tests/starcoin_dao/starcoin_upgrade_module.move @@ -131,7 +131,7 @@ script{ //alice create proposal fun create_proposal(sender: signer, package_hash: vector){ - UpgradeModulePlugin::create_proposal(&sender, b"Upgrade module", 3600000, package_hash, 1, true); + UpgradeModulePlugin::create_proposal(&sender,b"Upgrade module", b"Upgrade module" ,b"Upgrade module", 3600000, package_hash, 1, true); } } // check: EXECUTED diff --git a/sources/OnChainStarcoinDAOConfig.move b/sources/OnChainStarcoinDAOConfig.move index 8b2bbccb..a18df76b 100644 --- a/sources/OnChainStarcoinDAOConfig.move +++ b/sources/OnChainStarcoinDAOConfig.move @@ -9,19 +9,21 @@ module StarcoinFramework::OnChainStarcoinDAOConfig { use StarcoinFramework::ConfigProposalPlugin; public fun propose_update_consensus_config(account: &signer, - description: vector, - uncle_rate_target: u64, - base_block_time_target: u64, - base_reward_per_block: u128, - base_reward_per_uncle_percent: u64, - epoch_block_count: u64, - base_block_difficulty_window: u64, - min_block_time_target: u64, - max_block_time_target: u64, - base_max_uncles_per_block: u64, - base_block_gas_limit: u64, - strategy: u8, - exec_delay: u64) { + title:vector, + introduction:vector, + description: vector, + uncle_rate_target: u64, + base_block_time_target: u64, + base_reward_per_block: u128, + base_reward_per_uncle_percent: u64, + epoch_block_count: u64, + base_block_difficulty_window: u64, + min_block_time_target: u64, + max_block_time_target: u64, + base_max_uncles_per_block: u64, + base_block_gas_limit: u64, + strategy: u8, + exec_delay: u64) { let consensus_config = ConsensusConfig::new_consensus_config(uncle_rate_target, base_block_time_target, base_reward_per_block, @@ -33,10 +35,12 @@ module StarcoinFramework::OnChainStarcoinDAOConfig { base_max_uncles_per_block, base_block_gas_limit, strategy); - ConfigProposalPlugin::create_proposal(account, description, exec_delay, consensus_config); + ConfigProposalPlugin::create_proposal(account, title, introduction, description, exec_delay, consensus_config); } public ( script ) fun propose_update_consensus_config_entry(account: signer, + title:vector, + introduction:vector, description: vector, uncle_rate_target: u64, base_block_time_target: u64, @@ -51,6 +55,8 @@ module StarcoinFramework::OnChainStarcoinDAOConfig { strategy: u8, exec_delay: u64) { propose_update_consensus_config(&account, + title, + introduction, description, uncle_rate_target, base_block_time_target, @@ -71,56 +77,68 @@ module StarcoinFramework::OnChainStarcoinDAOConfig { } public fun propose_update_reward_config(account: &signer, + title:vector, + introduction:vector, description: vector, reward_delay: u64, exec_delay: u64) { let reward_config = RewardConfig::new_reward_config(reward_delay); - ConfigProposalPlugin::create_proposal(account, description, exec_delay, reward_config); + ConfigProposalPlugin::create_proposal(account, title, introduction, description, exec_delay, reward_config); } public ( script ) fun propose_update_reward_config_entry(account: signer, - description: vector, - reward_delay: u64, - exec_delay: u64) { - propose_update_reward_config(&account, description, reward_delay, exec_delay); + title:vector, + introduction:vector, + description: vector, + reward_delay: u64, + exec_delay: u64) { + propose_update_reward_config(&account, title, introduction, description, reward_delay, exec_delay); } spec propose_update_reward_config { pragma verify = false; } public fun propose_update_txn_publish_option(account: &signer, - description: vector, - script_allowed: bool, - module_publishing_allowed: bool, - exec_delay: u64) { + title:vector, + introduction:vector, + description: vector, + script_allowed: bool, + module_publishing_allowed: bool, + exec_delay: u64) { let txn_publish_option = TransactionPublishOption::new_transaction_publish_option(script_allowed, module_publishing_allowed); - ConfigProposalPlugin::create_proposal(account, description, exec_delay, txn_publish_option); + ConfigProposalPlugin::create_proposal(account, title, introduction, description, exec_delay, txn_publish_option); } public ( script ) fun propose_update_txn_publish_option_entry(account: signer, - description: vector, - script_allowed: bool, - module_publishing_allowed: bool, - exec_delay: u64) { - propose_update_txn_publish_option(&account, description, script_allowed, module_publishing_allowed, exec_delay); + title:vector, + introduction:vector, + description: vector, + script_allowed: bool, + module_publishing_allowed: bool, + exec_delay: u64) { + propose_update_txn_publish_option(&account, title, introduction, description, script_allowed, module_publishing_allowed, exec_delay); } spec propose_update_txn_publish_option { pragma verify = false; } public fun propose_update_txn_timeout_config(account: &signer, - description: vector, - duration_seconds: u64, - exec_delay: u64) { + title:vector, + introduction:vector, + description: vector, + duration_seconds: u64, + exec_delay: u64) { let txn_timeout_config = TransactionTimeoutConfig::new_transaction_timeout_config(duration_seconds); - ConfigProposalPlugin::create_proposal(account, description, exec_delay, txn_timeout_config); + ConfigProposalPlugin::create_proposal(account, title, introduction, description, exec_delay, txn_timeout_config); } public ( script ) fun propose_update_txn_timeout_config_entry(account: signer, - description: vector, - duration_seconds: u64, - exec_delay: u64) { - propose_update_txn_timeout_config(&account,description,duration_seconds,exec_delay); + title:vector, + introduction:vector, + description: vector, + duration_seconds: u64, + exec_delay: u64) { + propose_update_txn_timeout_config(&account, title, introduction,description,duration_seconds,exec_delay); } spec propose_update_txn_timeout_config { @@ -128,21 +146,23 @@ module StarcoinFramework::OnChainStarcoinDAOConfig { } public fun propose_update_vm_config(account: &signer, - description: vector, - instruction_schedule: vector, - native_schedule: vector, - global_memory_per_byte_cost: u64, - global_memory_per_byte_write_cost: u64, - min_transaction_gas_units: u64, - large_transaction_cutoff: u64, - instrinsic_gas_per_byte: u64, - maximum_number_of_gas_units: u64, - min_price_per_gas_unit: u64, - max_price_per_gas_unit: u64, - max_transaction_size_in_bytes: u64, - gas_unit_scaling_factor: u64, - default_account_size: u64, - exec_delay: u64, ) { + title:vector, + introduction:vector, + description: vector, + instruction_schedule: vector, + native_schedule: vector, + global_memory_per_byte_cost: u64, + global_memory_per_byte_write_cost: u64, + min_transaction_gas_units: u64, + large_transaction_cutoff: u64, + instrinsic_gas_per_byte: u64, + maximum_number_of_gas_units: u64, + min_price_per_gas_unit: u64, + max_price_per_gas_unit: u64, + max_transaction_size_in_bytes: u64, + gas_unit_scaling_factor: u64, + default_account_size: u64, + exec_delay: u64, ) { let vm_config = VMConfig::new_vm_config(instruction_schedule, native_schedule, global_memory_per_byte_cost, @@ -156,26 +176,30 @@ module StarcoinFramework::OnChainStarcoinDAOConfig { max_transaction_size_in_bytes, gas_unit_scaling_factor, default_account_size); - ConfigProposalPlugin::create_proposal(account, description, exec_delay, vm_config); + ConfigProposalPlugin::create_proposal(account, title, introduction, description, exec_delay, vm_config); } public (script) fun propose_update_vm_config_entry(account: signer, - description: vector, - instruction_schedule: vector, - native_schedule: vector, - global_memory_per_byte_cost: u64, - global_memory_per_byte_write_cost: u64, - min_transaction_gas_units: u64, - large_transaction_cutoff: u64, - instrinsic_gas_per_byte: u64, - maximum_number_of_gas_units: u64, - min_price_per_gas_unit: u64, - max_price_per_gas_unit: u64, - max_transaction_size_in_bytes: u64, - gas_unit_scaling_factor: u64, - default_account_size: u64, - exec_delay: u64, ) { + title:vector, + introduction:vector, + description: vector, + instruction_schedule: vector, + native_schedule: vector, + global_memory_per_byte_cost: u64, + global_memory_per_byte_write_cost: u64, + min_transaction_gas_units: u64, + large_transaction_cutoff: u64, + instrinsic_gas_per_byte: u64, + maximum_number_of_gas_units: u64, + min_price_per_gas_unit: u64, + max_price_per_gas_unit: u64, + max_transaction_size_in_bytes: u64, + gas_unit_scaling_factor: u64, + default_account_size: u64, + exec_delay: u64, ) { propose_update_vm_config(&account, + title, + introduction, description, instruction_schedule, native_schedule, @@ -197,12 +221,12 @@ module StarcoinFramework::OnChainStarcoinDAOConfig { pragma verify = false; } - public fun propose_update_move_language_version(account: &signer, description: vector, new_version: u64, exec_delay: u64) { + public fun propose_update_move_language_version(account: &signer, title:vector, introduction:vector, description: vector, new_version: u64, exec_delay: u64) { let lang_version = LanguageVersion::new(new_version); - ConfigProposalPlugin::create_proposal(account, description, exec_delay, lang_version); + ConfigProposalPlugin::create_proposal(account, title, introduction, description, exec_delay, lang_version); } - public(script) fun propose_update_move_language_version_entry(account: signer, description: vector, new_version: u64, exec_delay: u64) { - propose_update_move_language_version(&account, description, new_version, exec_delay); + public(script) fun propose_update_move_language_version_entry(account: signer, title:vector, introduction:vector, description: vector, new_version: u64, exec_delay: u64) { + propose_update_move_language_version(&account, title, introduction, description, new_version, exec_delay); } } \ No newline at end of file diff --git a/sources/daospace/DAOSpace.move b/sources/daospace/DAOSpace.move index a6e12fcc..64660cc9 100644 --- a/sources/daospace/DAOSpace.move +++ b/sources/daospace/DAOSpace.move @@ -1516,6 +1516,10 @@ module StarcoinFramework::DAOSpace { id: u64, /// creator of the proposal proposer: address, + /// title of proposal + title: vector, + /// introduction of proposal , short introduction + introduction:vector, /// description of proposal , ipfs:// description:vector, /// when voting begins. @@ -1626,6 +1630,8 @@ module StarcoinFramework::DAOSpace { struct ProposalCreatedEvent has drop, store { /// dao id dao_id: u64, + /// title + title: vector, /// the proposal id. proposal_id: u64, /// description of proposal , ipfs:// @@ -1668,6 +1674,8 @@ module StarcoinFramework::DAOSpace { _cap: &DAOProposalCap, sender: &signer, action: ActionT, + title: vector, + introduction: vector, description: vector, action_delay: u64, ): u64 acquires DAO, GlobalProposals, DAOAccountCapHolder, ProposalActions, ProposalEvent, GlobalProposalActions { @@ -1695,6 +1703,8 @@ module StarcoinFramework::DAOSpace { let proposal = Proposal { id: proposal_id, proposer, + title: copy title, + introduction: copy introduction, description: copy description, start_time, end_time: start_time + voting_period, @@ -1762,7 +1772,7 @@ module StarcoinFramework::DAOSpace { let dao_id = dao_id(dao_address); let proposal_event = borrow_global_mut>(dao_address); Event::emit_event(&mut proposal_event.proposal_create_event, - ProposalCreatedEvent { dao_id, proposal_id, description: copy description, proposer }, + ProposalCreatedEvent { dao_id, proposal_id, title, description: copy description, proposer }, ); proposal_id diff --git a/sources/daospaceplugin/AnyMemberPlugin.move b/sources/daospaceplugin/AnyMemberPlugin.move index 0add11bd..870272c5 100644 --- a/sources/daospaceplugin/AnyMemberPlugin.move +++ b/sources/daospaceplugin/AnyMemberPlugin.move @@ -49,12 +49,12 @@ module StarcoinFramework::AnyMemberPlugin{ join(&sender, image_data, image_url); } - public fun install_plugin_proposal(sender:&signer, description: vector, action_delay:u64){ - InstallPluginProposalPlugin::create_proposal(sender, required_caps(), description, action_delay); + public fun install_plugin_proposal(sender:&signer, title:vector, introduction:vector, description: vector, action_delay:u64){ + InstallPluginProposalPlugin::create_proposal(sender, required_caps(), title, introduction, description, action_delay); } - public (script) fun install_plugin_proposal_entry(sender:signer, description: vector, action_delay:u64){ - install_plugin_proposal(&sender, description, action_delay); + public (script) fun install_plugin_proposal_entry(sender:signer, title:vector, introduction:vector, description: vector, action_delay:u64){ + install_plugin_proposal(&sender, title, introduction, description, action_delay); } } \ No newline at end of file diff --git a/sources/daospaceplugin/ConfigProposalPlugin.move b/sources/daospaceplugin/ConfigProposalPlugin.move index 5bbc0227..1a3960ad 100644 --- a/sources/daospaceplugin/ConfigProposalPlugin.move +++ b/sources/daospaceplugin/ConfigProposalPlugin.move @@ -40,7 +40,7 @@ module StarcoinFramework::ConfigProposalPlugin { caps } - public fun create_proposal(sender: &signer, description: vector,action_delay: u64, config: ConfigT) { + public fun create_proposal(sender: &signer, title:vector, introduction:vector, description: vector,action_delay: u64, config: ConfigT) { let witness = ConfigProposalPlugin{}; let cap = DAOSpace::acquire_proposal_cap(&witness); let action = ConfigProposalAction{ @@ -49,7 +49,7 @@ module StarcoinFramework::ConfigProposalPlugin { DAOSpace::create_proposal< DAOT, ConfigProposalPlugin, - ConfigProposalAction>(&cap, sender, action, description, action_delay); + ConfigProposalAction>(&cap, sender, action, title, introduction, description, action_delay); } public fun execute_proposal(sender: &signer, proposal_id: u64) { @@ -70,12 +70,12 @@ module StarcoinFramework::ConfigProposalPlugin { execute_proposal(&sender, proposal_id); } - public fun install_plugin_proposal(sender:&signer, description: vector, action_delay:u64){ - InstallPluginProposalPlugin::create_proposal(sender, required_caps(), description, action_delay); + public fun install_plugin_proposal(sender:&signer, title:vector, introduction:vector, description: vector, action_delay:u64){ + InstallPluginProposalPlugin::create_proposal(sender, required_caps(), title, introduction, description, action_delay); } - public (script) fun install_plugin_proposal_entry(sender:signer, description: vector, action_delay:u64){ - install_plugin_proposal(&sender, description, action_delay); + public (script) fun install_plugin_proposal_entry(sender:signer, title:vector, introduction:vector, description: vector, action_delay:u64){ + install_plugin_proposal(&sender, title, introduction, description, action_delay); } } \ No newline at end of file diff --git a/sources/daospaceplugin/GasOracleProposalPlugin.move b/sources/daospaceplugin/GasOracleProposalPlugin.move index 61ff4078..00a19afd 100644 --- a/sources/daospaceplugin/GasOracleProposalPlugin.move +++ b/sources/daospaceplugin/GasOracleProposalPlugin.move @@ -61,13 +61,13 @@ module StarcoinFramework::GasOracleProposalPlugin { caps } - public(script) fun create_oracle_add_proposal(sender: signer, description: vector, action_delay: u64, source_address: address) { + public(script) fun create_oracle_add_proposal(sender: signer, title:vector, introduction:vector, description: vector, action_delay: u64, source_address: address) { let witness = GasOracleProposalPlugin{}; let cap = DAOSpace::acquire_proposal_cap(&witness); let action = OracleSourceAddAction{ source_address }; - DAOSpace::create_proposal(&cap, &sender, action, description, action_delay); + DAOSpace::create_proposal(&cap, &sender, action, title, introduction, description, action_delay); } public(script) fun execute_oracle_add_proposal(sender: signer, proposal_id: u64) { @@ -89,13 +89,13 @@ module StarcoinFramework::GasOracleProposalPlugin { DAOSpace::save(&storage_cap, OracleSources{ source_addresses }); } - public(script) fun create_oracle_remove_proposal(sender: signer, description: vector, action_delay: u64, source_address: address) { + public(script) fun create_oracle_remove_proposal(sender: signer, title:vector, introduction:vector, description: vector, action_delay: u64, source_address: address) { let witness = GasOracleProposalPlugin{}; let cap = DAOSpace::acquire_proposal_cap(&witness); let action = OracleSourceRemoveAction{ source_address }; - DAOSpace::create_proposal(&cap, &sender, action, description, action_delay); + DAOSpace::create_proposal(&cap, &sender, action, title, introduction, description, action_delay); } public(script) fun execute_oracle_remove_proposal(sender: signer, proposal_id: u64) { @@ -118,11 +118,11 @@ module StarcoinFramework::GasOracleProposalPlugin { PriceOracleAggregator::latest_price_average_aggregator>(&source_addresses, ORACLE_UPDATED_IN) } - public fun install_plugin_proposal(sender: &signer, description: vector, action_delay: u64) { - InstallPluginProposalPlugin::create_proposal(sender, required_caps(), description, action_delay); + public fun install_plugin_proposal(sender: &signer, title:vector, introduction:vector, description: vector, action_delay: u64) { + InstallPluginProposalPlugin::create_proposal(sender, required_caps(), title, introduction, description, action_delay); } - public(script) fun install_plugin_proposal_entry(sender: signer, description: vector, action_delay: u64) { - install_plugin_proposal(&sender, description, action_delay); + public(script) fun install_plugin_proposal_entry(sender: signer, title:vector, introduction:vector, description: vector, action_delay: u64) { + install_plugin_proposal(&sender, title, introduction, description, action_delay); } } \ No newline at end of file diff --git a/sources/daospaceplugin/GrantProposalPlugin.move b/sources/daospaceplugin/GrantProposalPlugin.move index 77fab278..87417d9f 100644 --- a/sources/daospaceplugin/GrantProposalPlugin.move +++ b/sources/daospaceplugin/GrantProposalPlugin.move @@ -61,7 +61,7 @@ module StarcoinFramework::GrantProposalPlugin{ const ERR_GRANTTREASURY_WITHDRAW_TOO_MORE :u64 = 102; const ERR_SENDER_NOT_SAME :u64 = 103; - public fun create_grant_proposal(sender: &signer, description: vector,grantee: address, total: u128, start_time:u64, period: u64, action_delay:u64){ + public fun create_grant_proposal(sender: &signer, title:vector, introduction:vector, description: vector,grantee: address, total: u128, start_time:u64, period: u64, action_delay:u64){ let witness = GrantProposalPlugin{}; let cap = DAOSpace::acquire_proposal_cap(&witness); let action = GrantCreateAction{ @@ -70,11 +70,11 @@ module StarcoinFramework::GrantProposalPlugin{ start_time:start_time, period:period }; - DAOSpace::create_proposal(&cap, sender, action, description, action_delay); + DAOSpace::create_proposal(&cap, sender, action, title, introduction, description, action_delay); } - public (script) fun create_grant_proposal_entry(sender: signer, description: vector,grantee: address, total: u128, start_time:u64, period: u64, action_delay:u64){ - create_grant_proposal(&sender, description, grantee, total, start_time, period, action_delay); + public (script) fun create_grant_proposal_entry(sender: signer, title:vector, introduction:vector, description: vector,grantee: address, total: u128, start_time:u64, period: u64, action_delay:u64){ + create_grant_proposal(&sender, title, introduction, description, grantee, total, start_time, period, action_delay); } public fun execute_grant_proposal(sender: &signer, proposal_id: u64){ @@ -90,15 +90,15 @@ module StarcoinFramework::GrantProposalPlugin{ execute_grant_proposal(&sender, proposal_id); } - public fun create_grant_revoke_proposal(sender: &signer, description: vector, grantee:address, action_delay:u64){ + public fun create_grant_revoke_proposal(sender: &signer, title:vector, introduction:vector, description: vector, grantee:address, action_delay:u64){ let witness = GrantProposalPlugin{}; let cap = DAOSpace::acquire_proposal_cap(&witness); let action = GrantRevokeAction{ grantee }; - DAOSpace::create_proposal(&cap, sender, action, description, action_delay); + DAOSpace::create_proposal(&cap, sender, action, title, introduction, description, action_delay); } - public (script) fun create_grant_revoke_proposal_entry(sender: signer, description: vector, grantee:address, action_delay:u64){ - create_grant_revoke_proposal(&sender, description, grantee, action_delay); + public (script) fun create_grant_revoke_proposal_entry(sender: signer, title:vector, introduction:vector, description: vector, grantee:address, action_delay:u64){ + create_grant_revoke_proposal(&sender, title, introduction, description, grantee, action_delay); } public fun execute_grant_revoke_proposal(sender: &signer, proposal_id: u64){ @@ -113,12 +113,12 @@ module StarcoinFramework::GrantProposalPlugin{ execute_grant_revoke_proposal(&sender, proposal_id); } - public fun install_plugin_proposal(sender: &signer, description: vector, action_delay:u64){ - InstallPluginProposalPlugin::create_proposal(sender, required_caps(), description, action_delay); + public fun install_plugin_proposal(sender: &signer, title:vector, introduction:vector, description: vector, action_delay:u64){ + InstallPluginProposalPlugin::create_proposal(sender, required_caps(), title, introduction, description, action_delay); } - public (script) fun install_plugin_proposal_entry(sender:signer, description: vector, action_delay:u64){ - install_plugin_proposal(&sender, description, action_delay); + public (script) fun install_plugin_proposal_entry(sender:signer, title:vector, introduction:vector, description: vector, action_delay:u64){ + install_plugin_proposal(&sender, title, introduction, description, action_delay); } } \ No newline at end of file diff --git a/sources/daospaceplugin/InstallPluginProposalPlugin.move b/sources/daospaceplugin/InstallPluginProposalPlugin.move index 9aafe56c..d4f41680 100644 --- a/sources/daospaceplugin/InstallPluginProposalPlugin.move +++ b/sources/daospaceplugin/InstallPluginProposalPlugin.move @@ -40,7 +40,7 @@ module StarcoinFramework::InstallPluginProposalPlugin{ } //TODO how to unify arguments. - public fun create_proposal(sender: &signer, required_caps: vector, description: vector, action_delay: u64){ + public fun create_proposal(sender: &signer, required_caps: vector, title:vector, introduction:vector, description: vector, action_delay: u64){ let witness = InstallPluginProposalPlugin{}; let cap = DAOSpace::acquire_proposal_cap(&witness); @@ -48,7 +48,7 @@ module StarcoinFramework::InstallPluginProposalPlugin{ required_caps, }; - DAOSpace::create_proposal(&cap, sender, action, description, action_delay); + DAOSpace::create_proposal(&cap, sender, action, title, introduction, description, action_delay); } public fun execute_proposal(sender: &signer, proposal_id: u64){ diff --git a/sources/daospaceplugin/MemberProposalPlugin.move b/sources/daospaceplugin/MemberProposalPlugin.move index 11400038..8683fb84 100644 --- a/sources/daospaceplugin/MemberProposalPlugin.move +++ b/sources/daospaceplugin/MemberProposalPlugin.move @@ -47,7 +47,7 @@ module StarcoinFramework::MemberProposalPlugin{ caps } - public fun create_proposal(sender: &signer, description: vector, member: address, image_data:vector, image_url:vector, init_sbt: u128, action_delay: u64){ + public fun create_proposal(sender: &signer, title:vector, introduction:vector, description: vector, member: address, image_data:vector, image_url:vector, init_sbt: u128, action_delay: u64){ let witness = MemberProposalPlugin{}; let cap = DAOSpace::acquire_proposal_cap(&witness); let action = MemberJoinAction{ @@ -58,11 +58,11 @@ module StarcoinFramework::MemberProposalPlugin{ }; assert!(!DAOSpace::is_exist_member_offer(member), Errors::already_published(ERR_MEMBER_OFFER_EXIST)); assert!(!DAOSpace::is_member(member), Errors::already_published(ERR_MEMBER_EXIST)); - DAOSpace::create_proposal(&cap, sender, action, description, action_delay); + DAOSpace::create_proposal(&cap, sender, action, title, introduction, description, action_delay); } - public (script) fun create_proposal_entry(sender: signer, description: vector, member: address, image_data:vector, image_url:vector, init_sbt: u128, action_delay: u64){ - create_proposal(&sender, description, member, image_data, image_url, init_sbt, action_delay); + public (script) fun create_proposal_entry(sender: signer, title:vector, introduction:vector, description: vector, member: address, image_data:vector, image_url:vector, init_sbt: u128, action_delay: u64){ + create_proposal(&sender, title, introduction, description, member, image_data, image_url, init_sbt, action_delay); } public fun execute_proposal(sender: &signer, proposal_id: u64){ @@ -77,12 +77,12 @@ module StarcoinFramework::MemberProposalPlugin{ execute_proposal(&sender, proposal_id); } - public fun install_plugin_proposal(sender:&signer, description: vector,action_delay:u64){ - InstallPluginProposalPlugin::create_proposal(sender, required_caps(), description, action_delay); + public fun install_plugin_proposal(sender:&signer, title:vector, introduction:vector, description: vector,action_delay:u64){ + InstallPluginProposalPlugin::create_proposal(sender, required_caps(), title, introduction, description, action_delay); } - public (script) fun install_plugin_proposal_entry(sender:signer, description: vector, action_delay:u64){ - install_plugin_proposal(&sender, description, action_delay); + public (script) fun install_plugin_proposal_entry(sender:signer, title:vector, introduction:vector, description: vector, action_delay:u64){ + install_plugin_proposal(&sender, title, introduction, description, action_delay); } } \ No newline at end of file diff --git a/sources/daospaceplugin/MintProposalPlugin.move b/sources/daospaceplugin/MintProposalPlugin.move index f058124f..3da9b717 100644 --- a/sources/daospaceplugin/MintProposalPlugin.move +++ b/sources/daospaceplugin/MintProposalPlugin.move @@ -60,18 +60,18 @@ module StarcoinFramework::MintProposalPlugin{ delegate_token_mint_cap(&sender); } - public fun create_mint_proposal(sender: &signer, description: vector, receiver: address, amount: u128, action_delay: u64){ + public fun create_mint_proposal(sender: &signer, title:vector, introduction:vector, description: vector, receiver: address, amount: u128, action_delay: u64){ let witness = MintProposalPlugin{}; let cap = DAOSpace::acquire_proposal_cap(&witness); let action = MintTokenAction{ receiver, amount, }; - DAOSpace::create_proposal(&cap, sender, action, description, action_delay); + DAOSpace::create_proposal(&cap, sender, action, title, introduction, description, action_delay); } - public (script) fun create_mint_proposal_entry(sender: signer, description: vector, receiver: address, amount: u128, action_delay: u64){ - create_mint_proposal(&sender, description, receiver, amount, action_delay); + public (script) fun create_mint_proposal_entry(sender: signer, title:vector, introduction:vector, description: vector, receiver: address, amount: u128, action_delay: u64){ + create_mint_proposal(&sender, description, title, introduction, receiver, amount, action_delay); } public fun execute_mint_proposal(sender: &signer, proposal_id: u64){ @@ -87,12 +87,12 @@ module StarcoinFramework::MintProposalPlugin{ execute_mint_proposal(&sender, proposal_id); } - public fun install_plugin_proposal(sender:&signer, description: vector, action_delay:u64){ - InstallPluginProposalPlugin::create_proposal(sender, required_caps(), description, action_delay); + public fun install_plugin_proposal(sender:&signer, title:vector, introduction:vector, description: vector, action_delay:u64){ + InstallPluginProposalPlugin::create_proposal(sender,required_caps(), title, introduction, description, action_delay); } - public (script) fun install_plugin_proposal_entry(sender:signer, description: vector, action_delay:u64){ - install_plugin_proposal(&sender, description, action_delay); + public (script) fun install_plugin_proposal_entry(sender:signer, title:vector, introduction:vector, description: vector, action_delay:u64){ + install_plugin_proposal(&sender, title, introduction, description, action_delay); } } \ No newline at end of file diff --git a/sources/daospaceplugin/StakeToSBTPlugin.move b/sources/daospaceplugin/StakeToSBTPlugin.move index 81c252bf..c1fcc843 100644 --- a/sources/daospaceplugin/StakeToSBTPlugin.move +++ b/sources/daospaceplugin/StakeToSBTPlugin.move @@ -434,6 +434,8 @@ module StarcoinFramework::StakeToSBTPlugin { /// Create proposal that to specific a weight for a locktime public fun create_weight_proposal( sender: &signer, + title:vector, + introduction:vector, description: vector, lock_time: u64, weight: u64, @@ -444,21 +446,25 @@ module StarcoinFramework::StakeToSBTPlugin { let cap = DAOSpace::acquire_proposal_cap(&witness); DAOSpace::create_proposal(&cap, sender, LockWeight { - lock_time, - weight, - }, + lock_time, + weight, + }, + title, + introduction, description, action_delay); } public(script) fun create_weight_proposal_entry( sender: signer, + title:vector, + introduction:vector, description: vector, lock_time: u64, weight: u64, action_delay: u64 ) { - create_weight_proposal(&sender, description, lock_time, weight, action_delay); + create_weight_proposal(&sender,title, introduction, description, lock_time, weight, action_delay); } public fun execute_weight_proposal( @@ -491,6 +497,8 @@ module StarcoinFramework::StakeToSBTPlugin { /// Create proposal that to accept a token type, which allow user to convert amount of token to SBT public fun create_token_accept_proposal( sender: &signer, + title:vector, + introduction:vector, description: vector, action_delay: u64 ) { @@ -502,6 +510,8 @@ module StarcoinFramework::StakeToSBTPlugin { &cap, sender, AcceptTokenCap {}, + title, + introduction, description, action_delay ); @@ -509,10 +519,12 @@ module StarcoinFramework::StakeToSBTPlugin { public(script) fun create_token_accept_proposal_entry( sender: signer, + title:vector, + introduction:vector, description: vector, action_delay: u64 ) { - create_token_accept_proposal(&sender, description, action_delay); + create_token_accept_proposal(&sender, title, introduction, description, action_delay); } public fun execute_token_accept_proposal( @@ -542,12 +554,16 @@ module StarcoinFramework::StakeToSBTPlugin { public fun install_plugin_proposal( sender: &signer, + title:vector, + introduction:vector, description: vector, action_delay: u64 ) { InstallPluginProposalPlugin::create_proposal( sender, required_caps(), + title, + introduction, description, action_delay ); @@ -555,10 +571,12 @@ module StarcoinFramework::StakeToSBTPlugin { public(script) fun install_plugin_proposal_entry( sender: signer, + title:vector, + introduction:vector, description: vector, action_delay: u64 ) { - install_plugin_proposal(&sender, description, action_delay); + install_plugin_proposal(&sender, title, introduction, description, action_delay); } /// Called by script diff --git a/sources/daospaceplugin/TreasuryPlugin.move b/sources/daospaceplugin/TreasuryPlugin.move index 8feffbb4..fde718d0 100644 --- a/sources/daospaceplugin/TreasuryPlugin.move +++ b/sources/daospaceplugin/TreasuryPlugin.move @@ -80,6 +80,8 @@ module StarcoinFramework::TreasuryPlugin { public fun create_withdraw_proposal( sender: &signer, + title:vector, + introduction:vector, description: vector, receiver: address, amount: u128, @@ -95,18 +97,20 @@ module StarcoinFramework::TreasuryPlugin { amount, period, }; - DAOSpace::create_proposal(&cap, sender, action, description, action_delay); + DAOSpace::create_proposal(&cap, sender, action, title, introduction, description, action_delay); } public(script) fun create_withdraw_proposal_entry( sender: signer, + title:vector, + introduction:vector, description: vector, receiver: address, amount: u128, period: u64, action_delay: u64) { - create_withdraw_proposal(&sender, description, receiver, amount, period, action_delay); + create_withdraw_proposal(&sender, title, introduction, description, receiver, amount, period, action_delay); } public fun execute_withdraw_proposal(sender: &signer, proposal_id: u64) acquires WithdrawCapabilityHolder { diff --git a/sources/daospaceplugin/UpgradeModulePlugin.move b/sources/daospaceplugin/UpgradeModulePlugin.move index 15e030da..9137e4dd 100644 --- a/sources/daospaceplugin/UpgradeModulePlugin.move +++ b/sources/daospaceplugin/UpgradeModulePlugin.move @@ -41,7 +41,7 @@ module StarcoinFramework::UpgradeModulePlugin { caps } - public fun create_proposal(sender: &signer, description: vector, action_delay:u64, package_hash: vector, version: u64, enforced: bool) { + public fun create_proposal(sender: &signer, title:vector, introduction:vector, description: vector, action_delay:u64, package_hash: vector, version: u64, enforced: bool) { let witness = UpgradeModulePlugin{}; let cap = DAOSpace::acquire_proposal_cap(&witness); let action = UpgradeModuleAction{ @@ -52,11 +52,11 @@ module StarcoinFramework::UpgradeModulePlugin { DAOSpace::create_proposal< DAOT, UpgradeModulePlugin, - UpgradeModuleAction>(&cap, sender, action, description, action_delay); + UpgradeModuleAction>(&cap, sender, action, title, introduction, description, action_delay); } - public (script) fun create_proposal_entry (sender: signer, description: vector, action_delay:u64, package_hash: vector, version: u64, enforced: bool) { - create_proposal(&sender,description, action_delay, package_hash, version, enforced); + public (script) fun create_proposal_entry (sender: signer, title:vector, introduction:vector, description: vector, action_delay:u64, package_hash: vector, version: u64, enforced: bool) { + create_proposal(&sender, title, introduction, description, action_delay, package_hash, version, enforced); } public fun execute_proposal(sender: &signer, proposal_id: u64) { @@ -81,11 +81,11 @@ module StarcoinFramework::UpgradeModulePlugin { execute_proposal(&sender, proposal_id); } - public fun install_plugin_proposal(sender:&signer, description: vector, action_delay:u64){ - InstallPluginProposalPlugin::create_proposal(sender, required_caps(), description, action_delay); + public fun install_plugin_proposal(sender:&signer, title:vector, introduction:vector, description: vector, action_delay:u64){ + InstallPluginProposalPlugin::create_proposal(sender,required_caps(), title, introduction, description, action_delay); } - public (script) fun install_plugin_proposal_entry(sender:signer, description: vector, action_delay:u64){ - install_plugin_proposal(&sender, description, action_delay); + public (script) fun install_plugin_proposal_entry(sender:signer, title:vector, introduction:vector, description: vector, action_delay:u64){ + install_plugin_proposal(&sender, title, introduction, description, action_delay); } } \ No newline at end of file From 1291641a9d6fdd2df991614731488c0b25667068 Mon Sep 17 00:00:00 2001 From: WGB5445 <919603023@qq.com> Date: Thu, 13 Oct 2022 22:20:54 +0800 Subject: [PATCH 2/5] [Feature] Simple map (#182) * Add SimpleMap * Add SimpleMap --- build/StarcoinFramework/docs/README.md | 1 + sources/SimpleMap.move | 229 +++++++++++++++++++++++++ 2 files changed, 230 insertions(+) create mode 100644 sources/SimpleMap.move diff --git a/build/StarcoinFramework/docs/README.md b/build/StarcoinFramework/docs/README.md index 36698df5..30df7bc4 100644 --- a/build/StarcoinFramework/docs/README.md +++ b/build/StarcoinFramework/docs/README.md @@ -93,6 +93,7 @@ This is the root document for the Move StarcoinFramework module documentation. T - [`0x1::Signature`](Signature.md#0x1_Signature) - [`0x1::SignedInteger64`](SignedInteger64.md#0x1_SignedInteger64) - [`0x1::Signer`](Signer.md#0x1_Signer) +- [`0x1::SimpleMap`](SimpleMap.md#0x1_SimpleMap) - [`0x1::SnapshotUtil`](SnapshotUtil.md#0x1_SnapshotUtil) - [`0x1::StakeToSBTPlugin`](StakeToSBTPlugin.md#0x1_StakeToSBTPlugin) - [`0x1::StarcoinDAO`](StarcoinDAO.md#0x1_StarcoinDAO) diff --git a/sources/SimpleMap.move b/sources/SimpleMap.move new file mode 100644 index 00000000..8a8df0c1 --- /dev/null +++ b/sources/SimpleMap.move @@ -0,0 +1,229 @@ +/// This module provides a solution for sorted maps, that is it has the properties that +/// 1) Keys point to Values +/// 2) Each Key must be unique +/// 3) A Key can be found within O(Log N) time +/// 4) The data is stored as sorted by Key +/// 5) Adds and removals take O(N) time +module StarcoinFramework::SimpleMap { + + use StarcoinFramework::Errors; + use StarcoinFramework::Option; + use StarcoinFramework::Vector; + use StarcoinFramework::Compare; + use StarcoinFramework::BCS; + + spec module { + pragma verify = false; + pragma aborts_if_is_strict = true; + } + + /// Map key already exists + const EKEY_ALREADY_EXISTS: u64 = 1; + /// Map key is not found + const EKEY_NOT_FOUND: u64 = 2; + + struct SimpleMap has copy, drop, store { + data: vector>, + } + + struct Element has copy, drop, store { + key: Key, + value: Value, + } + + public fun length(map: &SimpleMap): u64 { + Vector::length(&map.data) + } + + public fun create(): SimpleMap { + SimpleMap { + data: Vector::empty(), + } + } + + public fun borrow( + map: &SimpleMap, + key: &Key, + ): &Value { + let (maybe_idx, _) = find(map, key); + assert!(Option::is_some(&maybe_idx), Errors::invalid_argument(EKEY_NOT_FOUND)); + let idx = Option::extract(&mut maybe_idx); + &Vector::borrow(&map.data, idx).value + } + + public fun borrow_mut( + map: &mut SimpleMap, + key: &Key, + ): &mut Value { + let (maybe_idx, _) = find(map, key); + assert!(Option::is_some(&maybe_idx), Errors::invalid_argument(EKEY_NOT_FOUND)); + let idx = Option::extract(&mut maybe_idx); + &mut Vector::borrow_mut(&mut map.data, idx).value + } + + public fun contains_key( + map: &SimpleMap, + key: &Key, + ): bool { + let (maybe_idx, _) = find(map, key); + Option::is_some(&maybe_idx) + } + + public fun destroy_empty(map: SimpleMap) { + let SimpleMap { data } = map; + Vector::destroy_empty(data); + } + + public fun add( + map: &mut SimpleMap, + key: Key, + value: Value, + ) { + let (maybe_idx, maybe_placement) = find(map, &key); + assert!(Option::is_none(&maybe_idx), Errors::invalid_argument(EKEY_ALREADY_EXISTS)); + + // Append to the end and then swap elements until the list is ordered again + Vector::push_back(&mut map.data, Element { key, value }); + + let placement = Option::extract(&mut maybe_placement); + let end = Vector::length(&map.data) - 1; + while (placement < end) { + Vector::swap(&mut map.data, placement, end); + placement = placement + 1; + }; + } + + public fun remove( + map: &mut SimpleMap, + key: &Key, + ): (Key, Value) { + let (maybe_idx, _) = find(map, key); + assert!(Option::is_some(&maybe_idx), Errors::invalid_argument(EKEY_NOT_FOUND)); + + let placement = Option::extract(&mut maybe_idx); + let end = Vector::length(&map.data) - 1; + + while (placement < end) { + Vector::swap(&mut map.data, placement, placement + 1); + placement = placement + 1; + }; + + let Element { key, value } = Vector::pop_back(&mut map.data); + (key, value) + } + + fun find( + map: &SimpleMap, + key: &Key, + ): (Option::Option, Option::Option) { + let length = Vector::length(&map.data); + + if (length == 0) { + return (Option::none(), Option::some(0)) + }; + + let left = 0; + let right = length; + + while (left != right) { + let mid = left + (right - left) / 2; + let potential_key = &Vector::borrow(&map.data, mid).key; + if (Compare::is_less_than(Compare::cmp_bytes(&BCS::to_bytes(potential_key), &BCS::to_bytes(key)))) { + left = mid + 1; + } else { + right = mid; + }; + }; + + if (left != length && key == &Vector::borrow(&map.data, left).key) { + (Option::some(left), Option::none()) + } else { + (Option::none(), Option::some(left)) + } + } + + #[test] + public fun add_remove_many() { + let map = create(); + + assert!(length(&map) == 0, 0); + assert!(!contains_key(&map, &3), 1); + add(&mut map, 3, 1); + assert!(length(&map) == 1, 2); + assert!(contains_key(&map, &3), 3); + assert!(borrow(&map, &3) == &1, 4); + *borrow_mut(&mut map, &3) = 2; + assert!(borrow(&map, &3) == &2, 5); + + assert!(!contains_key(&map, &2), 6); + add(&mut map, 2, 5); + assert!(length(&map) == 2, 7); + assert!(contains_key(&map, &2), 8); + assert!(borrow(&map, &2) == &5, 9); + *borrow_mut(&mut map, &2) = 9; + assert!(borrow(&map, &2) == &9, 10); + + remove(&mut map, &2); + assert!(length(&map) == 1, 11); + assert!(!contains_key(&map, &2), 12); + assert!(borrow(&map, &3) == &2, 13); + + remove(&mut map, &3); + assert!(length(&map) == 0, 14); + assert!(!contains_key(&map, &3), 15); + + destroy_empty(map); + } + + #[test] + public fun test_several() { + let map = create(); + add(&mut map, 6, 6); + add(&mut map, 1, 1); + add(&mut map, 5, 5); + add(&mut map, 2, 2); + add(&mut map, 3, 3); + add(&mut map, 0, 0); + add(&mut map, 7, 7); + add(&mut map, 4, 4); + + let idx = 0; + while (idx < Vector::length(&map.data)) { + assert!(idx == Vector::borrow(&map.data, idx).key, idx); + idx = idx + 1; + }; + + remove(&mut map, &0); + remove(&mut map, &1); + remove(&mut map, &2); + remove(&mut map, &3); + remove(&mut map, &4); + remove(&mut map, &5); + remove(&mut map, &6); + remove(&mut map, &7); + + destroy_empty(map); + } + + #[test] + #[expected_failure] + public fun add_twice() { + let map = create(); + add(&mut map, 3, 1); + add(&mut map, 3, 1); + + remove(&mut map, &3); + destroy_empty(map); + } + + #[test] + #[expected_failure] + public fun remove_twice() { + let map = create(); + add(&mut map, 3, 1); + remove(&mut map, &3); + remove(&mut map, &3); + + destroy_empty(map); + } +} From ab6dbb99a54666719e5d92b571537d1b81b99a08 Mon Sep 17 00:00:00 2001 From: WGB5445 <919603023@qq.com> Date: Fri, 14 Oct 2022 19:56:01 +0800 Subject: [PATCH 3/5] description -> extend --- integration-tests/daospace/dao_proposal.exp | 4 ++-- integration-tests/daospace/dao_proposal.move | 2 +- .../daospace/dao_proposal_rejected.move | 2 +- sources/daospace/DAOSpace.move | 14 +++++++------- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/integration-tests/daospace/dao_proposal.exp b/integration-tests/daospace/dao_proposal.exp index 7086d922..8b848889 100644 --- a/integration-tests/daospace/dao_proposal.exp +++ b/integration-tests/daospace/dao_proposal.exp @@ -60,7 +60,7 @@ task 22 'run'. lines 300-311: task 23 'run'. lines 314-338: { - "gas_used": 482246, + "gas_used": 479496, "status": "Executed" } @@ -109,7 +109,7 @@ task 34 'run'. lines 403-416: task 36 'run'. lines 421-436: { - "gas_used": 106598, + "gas_used": 106530, "status": "Executed" } diff --git a/integration-tests/daospace/dao_proposal.move b/integration-tests/daospace/dao_proposal.move index 9294b35e..2a2081c2 100644 --- a/integration-tests/daospace/dao_proposal.move +++ b/integration-tests/daospace/dao_proposal.move @@ -104,7 +104,7 @@ module creator::DAOHelper { total, receiver, }; - let proposal_id = DAOSpace::create_proposal(&cap, sender, action,b"ipfs://description",b"ipfs://description", b"ipfs://description", action_delay); + let proposal_id = DAOSpace::create_proposal(&cap, sender, action,b"title",b"ipfs://introduction", b"ipfs://extend", action_delay); checkpoint(proposal_id); proposal_id diff --git a/integration-tests/daospace/dao_proposal_rejected.move b/integration-tests/daospace/dao_proposal_rejected.move index 866038aa..3bc74443 100644 --- a/integration-tests/daospace/dao_proposal_rejected.move +++ b/integration-tests/daospace/dao_proposal_rejected.move @@ -81,7 +81,7 @@ module creator::DAOHelper { total, receiver, }; - let proposal_id = DAOSpace::create_proposal(&cap, sender, action,b"ipfs://description",b"ipfs://description", b"ipfs://description", action_delay); + let proposal_id = DAOSpace::create_proposal(&cap, sender, action,b"title",b"ipfs://introduction", b"ipfs://extend", action_delay); checkpoint(proposal_id); proposal_id diff --git a/sources/daospace/DAOSpace.move b/sources/daospace/DAOSpace.move index 64660cc9..f24e7766 100644 --- a/sources/daospace/DAOSpace.move +++ b/sources/daospace/DAOSpace.move @@ -1520,8 +1520,8 @@ module StarcoinFramework::DAOSpace { title: vector, /// introduction of proposal , short introduction introduction:vector, - /// description of proposal , ipfs:// - description:vector, + /// extend of proposal , ipfs:// | { "title":"xxxxx",........ } + extend:vector, /// when voting begins. start_time: u64, /// when voting ends. @@ -1634,8 +1634,8 @@ module StarcoinFramework::DAOSpace { title: vector, /// the proposal id. proposal_id: u64, - /// description of proposal , ipfs:// - description: vector, + /// extend of proposal , ipfs:// | { "title":"xxxxx",........ } + extend: vector, /// proposer is the user who create the proposal. proposer: address, } @@ -1676,7 +1676,7 @@ module StarcoinFramework::DAOSpace { action: ActionT, title: vector, introduction: vector, - description: vector, + extend: vector, action_delay: u64, ): u64 acquires DAO, GlobalProposals, DAOAccountCapHolder, ProposalActions, ProposalEvent, GlobalProposalActions { // check DAO member @@ -1705,7 +1705,7 @@ module StarcoinFramework::DAOSpace { proposer, title: copy title, introduction: copy introduction, - description: copy description, + extend: copy extend, start_time, end_time: start_time + voting_period, yes_votes: 0, @@ -1772,7 +1772,7 @@ module StarcoinFramework::DAOSpace { let dao_id = dao_id(dao_address); let proposal_event = borrow_global_mut>(dao_address); Event::emit_event(&mut proposal_event.proposal_create_event, - ProposalCreatedEvent { dao_id, proposal_id, title, description: copy description, proposer }, + ProposalCreatedEvent { dao_id, proposal_id, title, extend: copy extend, proposer }, ); proposal_id From 2291bebce4cd06659f36fe531105a6a7997c8334 Mon Sep 17 00:00:00 2001 From: WGB5445 <919603023@qq.com> Date: Mon, 17 Oct 2022 10:02:41 +0800 Subject: [PATCH 4/5] Event add introduction --- integration-tests/daospace/dao_proposal.exp | 2 +- integration-tests/daospaceplugin/gas_oracle_plugin.exp | 2 +- integration-tests/daospaceplugin/mint_proposal_plugin.exp | 2 +- integration-tests/starcoin_dao/starcoin_onchain_config.exp | 2 +- integration-tests/starcoin_dao/starcoin_upgrade_module.exp | 2 +- sources/daospace/DAOSpace.move | 4 +++- 6 files changed, 8 insertions(+), 6 deletions(-) diff --git a/integration-tests/daospace/dao_proposal.exp b/integration-tests/daospace/dao_proposal.exp index 8b848889..26ffa3bd 100644 --- a/integration-tests/daospace/dao_proposal.exp +++ b/integration-tests/daospace/dao_proposal.exp @@ -60,7 +60,7 @@ task 22 'run'. lines 300-311: task 23 'run'. lines 314-338: { - "gas_used": 479496, + "gas_used": 480715, "status": "Executed" } diff --git a/integration-tests/daospaceplugin/gas_oracle_plugin.exp b/integration-tests/daospaceplugin/gas_oracle_plugin.exp index de2c9832..ac95b43f 100644 --- a/integration-tests/daospaceplugin/gas_oracle_plugin.exp +++ b/integration-tests/daospaceplugin/gas_oracle_plugin.exp @@ -38,7 +38,7 @@ task 16 'run'. lines 140-149: task 17 'run'. lines 152-177: { - "gas_used": 457891, + "gas_used": 459302, "status": "Executed" } diff --git a/integration-tests/daospaceplugin/mint_proposal_plugin.exp b/integration-tests/daospaceplugin/mint_proposal_plugin.exp index 851f01a1..a2b8a61b 100644 --- a/integration-tests/daospaceplugin/mint_proposal_plugin.exp +++ b/integration-tests/daospaceplugin/mint_proposal_plugin.exp @@ -55,7 +55,7 @@ task 19 'run'. lines 164-173: task 20 'run'. lines 175-206: { - "gas_used": 455659, + "gas_used": 456366, "status": "Executed" } diff --git a/integration-tests/starcoin_dao/starcoin_onchain_config.exp b/integration-tests/starcoin_dao/starcoin_onchain_config.exp index 54f79b20..3504442d 100644 --- a/integration-tests/starcoin_dao/starcoin_onchain_config.exp +++ b/integration-tests/starcoin_dao/starcoin_onchain_config.exp @@ -38,7 +38,7 @@ task 21 'run'. lines 111-120: task 22 'run'. lines 123-132: { - "gas_used": 455310, + "gas_used": 455697, "status": "Executed" } diff --git a/integration-tests/starcoin_dao/starcoin_upgrade_module.exp b/integration-tests/starcoin_dao/starcoin_upgrade_module.exp index 8402cf49..a7ac8b29 100644 --- a/integration-tests/starcoin_dao/starcoin_upgrade_module.exp +++ b/integration-tests/starcoin_dao/starcoin_upgrade_module.exp @@ -38,7 +38,7 @@ task 21 'run'. lines 111-120: task 23 'run'. lines 127-137: { - "gas_used": 440770, + "gas_used": 441669, "status": "Executed" } diff --git a/sources/daospace/DAOSpace.move b/sources/daospace/DAOSpace.move index f24e7766..8e020cfa 100644 --- a/sources/daospace/DAOSpace.move +++ b/sources/daospace/DAOSpace.move @@ -1634,6 +1634,8 @@ module StarcoinFramework::DAOSpace { title: vector, /// the proposal id. proposal_id: u64, + /// introduction of proposal , short introduction + introduction:vector, /// extend of proposal , ipfs:// | { "title":"xxxxx",........ } extend: vector, /// proposer is the user who create the proposal. @@ -1772,7 +1774,7 @@ module StarcoinFramework::DAOSpace { let dao_id = dao_id(dao_address); let proposal_event = borrow_global_mut>(dao_address); Event::emit_event(&mut proposal_event.proposal_create_event, - ProposalCreatedEvent { dao_id, proposal_id, title, extend: copy extend, proposer }, + ProposalCreatedEvent { dao_id, proposal_id, title, introduction: copy introduction, extend: copy extend, proposer }, ); proposal_id From 082ab0e8c306ef4cb02466fe078b6685c4434202 Mon Sep 17 00:00:00 2001 From: WGB5445 <919603023@qq.com> Date: Mon, 17 Oct 2022 10:03:46 +0800 Subject: [PATCH 5/5] megre --- .../InstallPluginProposalPlugin.mv | Bin 1192 -> 1204 bytes .../bytecode_modules/MemberProposalPlugin.mv | Bin 1579 -> 1619 bytes .../InstallPluginProposalPlugin.mvsm | Bin 4562 -> 4745 bytes .../source_maps/MemberProposalPlugin.mvsm | Bin 7935 -> 8667 bytes 4 files changed, 0 insertions(+), 0 deletions(-) diff --git a/build/StarcoinFramework/bytecode_modules/InstallPluginProposalPlugin.mv b/build/StarcoinFramework/bytecode_modules/InstallPluginProposalPlugin.mv index fe1c7189780d590625af0084f0883677f46105d9..1f808b8c5e849d3ad7acdf4e1456f0713cc2ca97 100644 GIT binary patch delta 110 zcmZ3%xrK9rq|6IO_Jz!onK`zw39ubu>ty6Q%g)1nlbwm@Hv6K9rn@-V*m$@&n7Ej@ zCVp`cU}xiIX5wVvWMt#v1c_~SU_8g9Aj~Pm$iu864mN2blwt0|=}J5C*&ki2(}52Mi0*2LcS!2cD5Nx&;IV3=NJ1`G+aNCD0Q91#f;0SpEX1~>o=1q%T=01N~U1q%QR1PcNR1Curc EeorJ3>i_@% diff --git a/build/StarcoinFramework/bytecode_modules/MemberProposalPlugin.mv b/build/StarcoinFramework/bytecode_modules/MemberProposalPlugin.mv index 0963bddeef98634a94ee35b2f413dbc803cee9e8..07a46954c60d36a25450d6992b837e21e682814e 100644 GIT binary patch delta 323 zcmY+7y-Gwu426@-Zzj2Oe*{?+;a1v;)woaLi}(yyyPcq1u(lOTOW(o9-pWUit(_4U zkwD0ob58QC?|OH%dZe(}R~z5r;6LIP( z_hVVEa6JSsh8Vc&+|DcyxM5$NvC+#+JGwdN3AN9C0nN!Or=Urkig;CFNm9oNv`e<& zY)%9);F!)T(riu}LdBc~q!SbplVUMQNB}4qes@-!_!O#Ui4fr6xc!ZJxpmieK z0#*0id+NiV{PtkIqx{3Kp}dq;dMjJhcbWWC?(fdOPI7XksH7Aa@_(k}OwQQPVlexB zi5DJ|F$qZTWq!n)82VbC8-3H&sZ8j@I5hD7;aQ^>V;2jqmaUkYOyH)}aKncNn6c_{ zN80ewg3xhv12aQSjggQ5P)6uX#uhYcnjhlzSu&`3Y1>F?k>a1!_9!DjDRsZC90sWC IRt*S#0XhO2iU0rr diff --git a/build/StarcoinFramework/source_maps/InstallPluginProposalPlugin.mvsm b/build/StarcoinFramework/source_maps/InstallPluginProposalPlugin.mvsm index cc57719117b3254f06677fa63b91fa5ebe6d10a2..6701109f3a4b9a43dadbf612269553f86354326d 100644 GIT binary patch literal 4745 zcmb7{OK1~O6o#iwnzT)-v1z-|g>Dpu3T}KMC}MpfXcQH(+7Oyi2h(Jlq-a&7qQ(bW z@qwV?#)Y;B?raMMU9`IKvGK7G3*uwhD2h_43%{uy(bYdGe2c<&&dr=V_s>oH$FBP` zX3oF0e5c(|y=Z9T<+MP-zo=3Xwi1NdPu;zg7>6#V#3Gd+a zLAk$anBu5)15&;nyZ*<41&^(U^PRfG~L~*l4ckEPC&IZ3s~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7ZT2GAk0 z9jg&^i0r~@0UaW*nN2IE4v~kLFF}WhxBogsMi}`G=ny%N^%iu9crSXX43RZO#?*t3 zn+B}CP%e8;@Qh8E71DIAec|T?+)WL!k*zihfE@D1b+AdZtUq9%)_1+zwx6|~S z0iCyVSOE^R&f6-ib)fUMa>3MjTaUR9blz@VFe_#3bYKoZl{9ZM_gk2Yr0H6>!N;pS zh&JS^CM)3Q!*c?6()GC+s$1Y!ykb65b)rsThA{PU_Qu!8xt4x)ppSDs)-lk>c^TGm M(8t-v>IP$e15WCcQvd(} diff --git a/build/StarcoinFramework/source_maps/MemberProposalPlugin.mvsm b/build/StarcoinFramework/source_maps/MemberProposalPlugin.mvsm index 374006151264301f94b7effe856472d3c8b5a89a..210035bef6617cb08863324793da2f07cf6e230f 100644 GIT binary patch literal 8667 zcmb7}X>3$g7>4h3nXbS<*(q)XlucR%4GD`?3POUALX9F}GIVZWq@4~k(*The6h(-p ziO?8KAP|j0A+e$Y5m699G(n6|L0Re#Do8LOAV?x5K9_O~|K4+(Jb&8foV%RwobUT? zt2XDa{jS%%-rH7%FMmC8Y0xyx5IuRhi`%5j{@5P-XX0^O&&wR7F% z^kiM4E)}VnUQ<6W7SC{;Dly^j%yiA0ElZgpX6tD&<6xXJ3$Gk!iiH=!SpWg~ET8Zk z-+IpyP|sq_T>XNIgN`#40$CHvr_EFo55p{lykN?WN8P0IN8^r%>~t($<0^X!<}@gb z#nZ{UXnl1$Ru@-;W;0+u6hz%rbuyN)8B>qH41%?{qe@+(0kskGW3`caZa5lAN7RrF z=uMEPUgUpG9@?V zI8HO*KBC+&@eXvjk1F>l-sui^q;fCd{SCp6r&Ri@s4Kmxt0M{J4#67^Ig4WHxSL8T z|0eG(6WW6a|?>3X=1v&G#}@{9}7LC*%fOX^ps`@%d>k) zGZ!lfeWf`ID*^qa`2^NND3+$VdVgtdV7?FF9%;Ug^ V&DXFz`#xzd#cF{PY3{>1 z0t2ME8S5wvl%~1*AZgxUzMJr%G;d*L*6T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