diff --git a/build/StarcoinFramework/BuildInfo.yaml b/build/StarcoinFramework/BuildInfo.yaml index fb98db1e..854fb4c6 100644 --- a/build/StarcoinFramework/BuildInfo.yaml +++ b/build/StarcoinFramework/BuildInfo.yaml @@ -327,7 +327,7 @@ compiled_package_info: ? address: "0x00000000000000000000000000000001" name: YieldFarmingV2 : StarcoinFramework - source_digest: BA11C8B16393EE8048481F812F0038A5D20D703FD7F7B2B9BD5F49840B6703E1 + source_digest: 8EF29F90FF139AC49CC2FE59DA218D959B0B29842ABFA2203CAC3C96153AF336 build_flags: dev_mode: false test_mode: false diff --git a/build/StarcoinFramework/bytecode_modules/InstallPluginProposalPlugin.mv b/build/StarcoinFramework/bytecode_modules/InstallPluginProposalPlugin.mv index 446d9386..fdaafbbd 100644 Binary files a/build/StarcoinFramework/bytecode_modules/InstallPluginProposalPlugin.mv and b/build/StarcoinFramework/bytecode_modules/InstallPluginProposalPlugin.mv differ diff --git a/build/StarcoinFramework/bytecode_modules/MemberProposalPlugin.mv b/build/StarcoinFramework/bytecode_modules/MemberProposalPlugin.mv index 546e74b4..4a639247 100644 Binary files a/build/StarcoinFramework/bytecode_modules/MemberProposalPlugin.mv and b/build/StarcoinFramework/bytecode_modules/MemberProposalPlugin.mv differ diff --git a/build/StarcoinFramework/docs/InstallPluginProposalPlugin.md b/build/StarcoinFramework/docs/InstallPluginProposalPlugin.md index 15545487..b23499d4 100644 --- a/build/StarcoinFramework/docs/InstallPluginProposalPlugin.md +++ b/build/StarcoinFramework/docs/InstallPluginProposalPlugin.md @@ -56,7 +56,7 @@ -
struct InstallPluginAction<ToInstallPluginT> has drop, store
+struct InstallPluginAction<ToInstallPluginT> has store
diff --git a/build/StarcoinFramework/docs/MemberProposalPlugin.md b/build/StarcoinFramework/docs/MemberProposalPlugin.md
index 2a62401b..aae9005a 100644
--- a/build/StarcoinFramework/docs/MemberProposalPlugin.md
+++ b/build/StarcoinFramework/docs/MemberProposalPlugin.md
@@ -60,7 +60,7 @@
-struct MemberJoinAction has drop, store
+struct MemberJoinAction has store
diff --git a/build/StarcoinFramework/source_maps/InstallPluginProposalPlugin.mvsm b/build/StarcoinFramework/source_maps/InstallPluginProposalPlugin.mvsm
index c6ebf5b6..1eb33805 100644
Binary files a/build/StarcoinFramework/source_maps/InstallPluginProposalPlugin.mvsm and b/build/StarcoinFramework/source_maps/InstallPluginProposalPlugin.mvsm differ
diff --git a/build/StarcoinFramework/source_maps/MemberProposalPlugin.mvsm b/build/StarcoinFramework/source_maps/MemberProposalPlugin.mvsm
index 9db469f8..5cbe9a66 100644
Binary files a/build/StarcoinFramework/source_maps/MemberProposalPlugin.mvsm and b/build/StarcoinFramework/source_maps/MemberProposalPlugin.mvsm differ
diff --git a/integration-tests/daospace/dao_proposal.exp b/integration-tests/daospace/dao_proposal.exp
index aa4fd8fa..0ddf23b1 100644
--- a/integration-tests/daospace/dao_proposal.exp
+++ b/integration-tests/daospace/dao_proposal.exp
@@ -1,42 +1,42 @@
processed 42 tasks
-task 7 'run'. lines 158-169:
+task 7 'run'. lines 169-180:
{
"gas_used": 1809468,
"status": "Executed"
}
-task 8 'run'. lines 171-185:
+task 8 'run'. lines 182-196:
{
"gas_used": 109239,
"status": "Executed"
}
-task 9 'run'. lines 187-212:
+task 9 'run'. lines 198-223:
{
"gas_used": 306386,
"status": "Executed"
}
-task 11 'run'. lines 217-233:
+task 11 'run'. lines 228-244:
{
"gas_used": 239832,
"status": "Executed"
}
-task 12 'run'. lines 235-251:
+task 12 'run'. lines 246-262:
{
"gas_used": 239832,
"status": "Executed"
}
-task 16 'run'. lines 259-273:
+task 16 'run'. lines 270-284:
{
"gas_used": 104944,
"status": "Executed"
}
-task 19 'run'. lines 280-293:
+task 19 'run'. lines 291-304:
{
"gas_used": 532278,
"status": {
@@ -52,46 +52,46 @@ task 19 'run'. lines 280-293:
}
}
-task 22 'run'. lines 300-311:
+task 22 'run'. lines 311-322:
{
"gas_used": 577624,
"status": "Executed"
}
-task 23 'run'. lines 314-338:
+task 23 'run'. lines 325-349:
{
"gas_used": 476235,
"status": "Executed"
}
-task 25 'run'. lines 342-351:
+task 25 'run'. lines 353-362:
{
"gas_used": 11943,
"status": "Executed"
}
-task 26 'call'. lines 353-353:
+task 26 'call'. lines 364-364:
"0xb5d577dc9ce59725e29886632e69ecdf/1/0x00000000000000000000000000000001::IdentifierNFT::IdentifierNFT<0x00000000000000000000000000000001::DAOSpace::DAOMember<0x662ba5a1a1da0f1c70a9762c7eeb7aaf::DAOHelper::X>,0x00000000000000000000000000000001::DAOSpace::DAOMemberBody<0x662ba5a1a1da0f1c70a9762c7eeb7aaf::DAOHelper::X>>"
-task 28 'run'. lines 357-376:
+task 28 'run'. lines 368-387:
{
"gas_used": 6523189,
"status": "Executed"
}
-task 29 'call'. lines 379-379:
+task 29 'call'. lines 390-390:
"0xa7dcef9aef26202fce82a7c7d6672afb/1/0x00000000000000000000000000000001::IdentifierNFT::IdentifierNFT<0x00000000000000000000000000000001::DAOSpace::DAOMember<0x662ba5a1a1da0f1c70a9762c7eeb7aaf::DAOHelper::X>,0x00000000000000000000000000000001::DAOSpace::DAOMemberBody<0x662ba5a1a1da0f1c70a9762c7eeb7aaf::DAOHelper::X>>"
-task 31 'run'. lines 383-396:
+task 31 'run'. lines 394-407:
{
"gas_used": 6195892,
"status": "Executed"
}
-task 32 'call'. lines 399-399:
+task 32 'call'. lines 410-410:
"0x3d4926eeda5b14b0ac979269ee79e40e/1/0x00000000000000000000000000000001::IdentifierNFT::IdentifierNFT<0x00000000000000000000000000000001::DAOSpace::DAOMember<0x662ba5a1a1da0f1c70a9762c7eeb7aaf::DAOHelper::X>,0x00000000000000000000000000000001::DAOSpace::DAOMemberBody<0x662ba5a1a1da0f1c70a9762c7eeb7aaf::DAOHelper::X>>"
-task 34 'run'. lines 403-416:
+task 34 'run'. lines 414-427:
{
"gas_used": 35135,
"status": {
@@ -107,20 +107,20 @@ task 34 'run'. lines 403-416:
}
}
-task 36 'run'. lines 421-436:
+task 36 'run'. lines 432-447:
{
"gas_used": 106454,
"status": "Executed"
}
-task 39 'run'. lines 444-454:
+task 39 'run'. lines 455-465:
{
"gas_used": 115442,
"status": "Executed"
}
-task 41 'run'. lines 459-471:
+task 41 'run'. lines 470-482:
{
- "gas_used": 452403,
+ "gas_used": 451300,
"status": "Executed"
}
diff --git a/integration-tests/daospace/dao_proposal.move b/integration-tests/daospace/dao_proposal.move
index b5c00a48..3fe4ba81 100644
--- a/integration-tests/daospace/dao_proposal.move
+++ b/integration-tests/daospace/dao_proposal.move
@@ -1,4 +1,4 @@
-//# init -n dev
+//# init -n dev --debug
//// creator address is 0x662ba5a1a1da0f1c70a9762c7eeb7aaf
//# faucet --addr creator --amount 100000000000
@@ -10,6 +10,17 @@
//# faucet --addr cindy --amount 10000000000
+
+////# run --signers creator
+//script{
+// use StarcoinFramework::StdlibUpgradeScripts;
+//
+// fun main(){
+// StdlibUpgradeScripts::upgrade_from_v11_to_v12();
+// }
+//}
+//// check: EXECUTED
+
//# publish
module creator::DAOHelper {
use StarcoinFramework::DAOPluginMarketplace;
@@ -62,7 +73,7 @@ module creator::DAOHelper {
struct XPlugin has store, drop{}
- struct XAction has store, drop {
+ struct XAction has store {
total: u128,
receiver: address,
}
diff --git a/integration-tests/daospace/dao_proposal_rejected.move b/integration-tests/daospace/dao_proposal_rejected.move
index 558d0258..7b827946 100644
--- a/integration-tests/daospace/dao_proposal_rejected.move
+++ b/integration-tests/daospace/dao_proposal_rejected.move
@@ -61,7 +61,7 @@ module creator::DAOHelper {
struct XPlugin has store, drop{}
- struct XAction has store, drop {
+ struct XAction has store {
total: u128,
receiver: address,
}
diff --git a/integration-tests/daospaceplugin/gas_oracle_plugin.exp b/integration-tests/daospaceplugin/gas_oracle_plugin.exp
index 9857e329..2f7a142d 100644
--- a/integration-tests/daospaceplugin/gas_oracle_plugin.exp
+++ b/integration-tests/daospaceplugin/gas_oracle_plugin.exp
@@ -59,6 +59,6 @@ task 24 'run'. lines 221-229:
task 26 'run'. lines 234-251:
{
- "gas_used": 582817,
+ "gas_used": 581714,
"status": "Executed"
}
diff --git a/integration-tests/daospaceplugin/mint_proposal_plugin.exp b/integration-tests/daospaceplugin/mint_proposal_plugin.exp
index 42c14d12..b4d4724c 100644
--- a/integration-tests/daospaceplugin/mint_proposal_plugin.exp
+++ b/integration-tests/daospaceplugin/mint_proposal_plugin.exp
@@ -76,6 +76,6 @@ task 26 'run'. lines 232-246:
task 28 'run'. lines 250-271:
{
- "gas_used": 515357,
+ "gas_used": 514254,
"status": "Executed"
}
diff --git a/integration-tests/daospaceplugin/salary_gov_plugin.move b/integration-tests/daospaceplugin/salary_gov_plugin.move
index 4e118381..dcf9f743 100644
--- a/integration-tests/daospaceplugin/salary_gov_plugin.move
+++ b/integration-tests/daospaceplugin/salary_gov_plugin.move
@@ -31,7 +31,7 @@ module creator::SalaryGovPlugin {
last_receive_time: u64,
}
- struct BossProposalAction has key, store, drop {
+ struct BossProposalAction has key, store {
boss: address,
}
diff --git a/integration-tests/starcoin_dao/starcoin_onchain_config.exp b/integration-tests/starcoin_dao/starcoin_onchain_config.exp
index 3494ac28..8aebeec4 100644
--- a/integration-tests/starcoin_dao/starcoin_onchain_config.exp
+++ b/integration-tests/starcoin_dao/starcoin_onchain_config.exp
@@ -1,4 +1,4 @@
-processed 42 tasks
+processed 41 tasks
task 11 'run'. lines 23-37:
{
@@ -92,22 +92,6 @@ task 38 'run'. lines 219-228:
task 40 'run'. lines 232-248:
{
- "gas_used": 496864,
+ "gas_used": 495761,
"status": "Executed"
}
-
-task 41 'run'. lines 250-261:
-{
- "gas_used": 164164,
- "status": {
- "MoveAbort": {
- "location": {
- "Module": {
- "address": "0x00000000000000000000000000000001",
- "name": "DAOSpace"
- }
- },
- "abort_code": "103175"
- }
- }
-}
diff --git a/integration-tests/starcoin_dao/starcoin_onchain_config.move b/integration-tests/starcoin_dao/starcoin_onchain_config.move
index b438ac24..494bff51 100644
--- a/integration-tests/starcoin_dao/starcoin_onchain_config.move
+++ b/integration-tests/starcoin_dao/starcoin_onchain_config.move
@@ -245,17 +245,4 @@ script{
}
}
-// check: EXECUTED
-
-//# run --signers alice
-script{
- use StarcoinFramework::DAOSpace;
- use StarcoinFramework::StarcoinDAO::StarcoinDAO;
-
- fun execute_proposal(sender: signer){
- assert!(DAOSpace::proposal_state(1) == 8 , 104);
- DAOSpace::clean_proposal_by_id(&sender, 1);
- let _ = DAOSpace::proposal(1);
- }
-}
-// check: ABORT, code 103175, proposal 1 not exist.
\ No newline at end of file
+// check: EXECUTED
\ No newline at end of file
diff --git a/integration-tests/starcoin_dao/starcoin_upgrade_module.exp b/integration-tests/starcoin_dao/starcoin_upgrade_module.exp
index 95f663a4..55fa605a 100644
--- a/integration-tests/starcoin_dao/starcoin_upgrade_module.exp
+++ b/integration-tests/starcoin_dao/starcoin_upgrade_module.exp
@@ -1,4 +1,4 @@
-processed 45 tasks
+processed 44 tasks
task 11 'run'. lines 23-37:
{
@@ -92,22 +92,6 @@ task 39 'run'. lines 227-236:
task 41 'run'. lines 240-252:
{
- "gas_used": 519740,
+ "gas_used": 518637,
"status": "Executed"
}
-
-task 44 'run'. lines 258-269:
-{
- "gas_used": 148462,
- "status": {
- "MoveAbort": {
- "location": {
- "Module": {
- "address": "0x00000000000000000000000000000001",
- "name": "DAOSpace"
- }
- },
- "abort_code": "103175"
- }
- }
-}
diff --git a/integration-tests/starcoin_dao/starcoin_upgrade_module.move b/integration-tests/starcoin_dao/starcoin_upgrade_module.move
index 8997ea21..eeec087e 100644
--- a/integration-tests/starcoin_dao/starcoin_upgrade_module.move
+++ b/integration-tests/starcoin_dao/starcoin_upgrade_module.move
@@ -246,7 +246,7 @@ script{
fun execute_proposal(sender: signer){
assert!(DAOSpace::proposal_state(1) == 7 , 103);
UpgradeModulePlugin::execute_proposal(&sender, 1);
- assert!(DAOSpace::proposal_state(1) == 8 , 104);
+ assert!(DAOSpace::proposal_state(1) == 8 , 103);
}
}
// check: EXECUTED
@@ -254,16 +254,3 @@ script{
//# block --author=0x3 --timestamp 93880000
//# deploy {{$.package[0].file}} --signers alice
-
-//# run --signers alice
-script{
- use StarcoinFramework::DAOSpace;
- use StarcoinFramework::StarcoinDAO::StarcoinDAO;
-
- fun execute_proposal(sender: signer){
- assert!(DAOSpace::proposal_state(1) == 8 , 104);
- DAOSpace::clean_proposals(&sender);
- let _ = DAOSpace::proposal(1);
- }
-}
-// check: ABORT, code 103175, proposal 1 not exist.
\ No newline at end of file
diff --git a/sources/daospace/DAOSpace.move b/sources/daospace/DAOSpace.move
index dddef2c7..cdce9563 100644
--- a/sources/daospace/DAOSpace.move
+++ b/sources/daospace/DAOSpace.move
@@ -26,8 +26,7 @@ module StarcoinFramework::DAOSpace {
use StarcoinFramework::ASCII;
friend StarcoinFramework::StarcoinDAO;
-
- const MAX_PROPOSALS: u64 = 1000;
+
const ERR_NO_GRANTED: u64 = 100;
const ERR_REPEAT_ELEMENT: u64 = 101;
@@ -56,7 +55,6 @@ module StarcoinFramework::DAOSpace {
const ERR_PROPOSAL_NOT_EXIST: u64 = 403;
const ERR_QUORUM_RATE_INVALID: u64 = 404;
const ERR_PROPOSAL_ACTION_INDEX_NOT_EXIST: u64 = 405;
- const ERR_PROPOSAL_OUT_OF_LIMIT: u64 = 406;
/// action
const ERR_ACTION_MUST_EXIST: u64 = 500;
@@ -1312,7 +1310,7 @@ module StarcoinFramework::DAOSpace {
}
/// Every ActionT keep a vector in the DAO account
- struct ProposalActions has key {
+ struct ProposalActions has key {
actions: vector>,
}
@@ -1408,14 +1406,12 @@ module StarcoinFramework::DAOSpace {
proposal_id: u64,
/// the sender.
sender: address,
- /// proposal state after the action: EXTRACTED or REJECTED
- state: u8,
}
/// propose a proposal.
/// `action`: the actual action to execute.
/// `action_delay`: the delay to execute after the proposal is agreed
- public fun create_proposal(
+ public fun create_proposal(
_cap: &DAOProposalCap,
sender: &signer,
action: ActionT,
@@ -1474,8 +1470,8 @@ module StarcoinFramework::DAOSpace {
let actions = Vector::singleton(proposal_action);
// check ProposalActions is exists
if(exists>(dao_address)){
+ //TODO add limit to max action before support Table.
let current_actions = borrow_global_mut>(dao_address);
- assert!(Vector::length(¤t_actions.actions) < MAX_PROPOSALS, Errors::limit_exceeded(ERR_PROPOSAL_OUT_OF_LIMIT));
Vector::append(&mut current_actions.actions, actions);
}else{
move_to(&dao_signer, ProposalActions{
@@ -1486,9 +1482,8 @@ module StarcoinFramework::DAOSpace {
let proposal_action_indexs = Vector::singleton(proposal_action_index);
// check GlobalProposalActions is exists
if(exists(dao_address)){
+ //TODO add limit to max global proposal action indexs before support Table
let current_global_proposal_actions = borrow_global_mut(dao_address);
- assert!(Vector::length(¤t_global_proposal_actions.proposal_action_indexs) < MAX_PROPOSALS,
- Errors::limit_exceeded(ERR_PROPOSAL_OUT_OF_LIMIT));
Vector::append(&mut current_global_proposal_actions.proposal_action_indexs, proposal_action_indexs);
}else{
move_to(&dao_signer, GlobalProposalActions{
@@ -1499,9 +1494,8 @@ module StarcoinFramework::DAOSpace {
let proposals = Vector::singleton(proposal);
// check GlobalProposals is exists
if(exists(dao_address)){
+ //TODO add limit to max global proposal before support Table
let current_global_proposals = borrow_global_mut(dao_address);
- assert!(Vector::length(¤t_global_proposals.proposals) < MAX_PROPOSALS,
- Errors::limit_exceeded(ERR_PROPOSAL_OUT_OF_LIMIT));
Vector::append(&mut current_global_proposals.proposals, proposals);
}else{
move_to(&dao_signer, GlobalProposals{
@@ -1692,7 +1686,7 @@ module StarcoinFramework::DAOSpace {
// Execute the proposal and return the action.
- public fun execute_proposal(
+ public fun execute_proposal(
_cap: &DAOProposalCap,
sender: &signer,
proposal_id: u64,
@@ -1703,71 +1697,26 @@ module StarcoinFramework::DAOSpace {
let sender_addr = Signer::address_of(sender);
assert!(exists>(dao_address), Errors::invalid_state(ERR_PROPOSAL_ACTIONS_NOT_EXIST));
- let (actionT, deposit) = take_proposal_action(dao_address, proposal_id);
-
- let global_proposals = borrow_global_mut(dao_address);
- let proposal = borrow_proposal(global_proposals, proposal_id);
-
- Account::deposit(proposal.proposer, deposit);
+ let actionT = take_proposal_action(dao_address, proposal_id);
// emit event
let dao_id = dao_id(dao_address);
let proposal_event = borrow_global_mut>(dao_address);
Event::emit_event(&mut proposal_event.proposal_action_event,
- ProposalActionEvent { dao_id, proposal_id, sender: sender_addr, state: EXTRACTED }
+ ProposalActionEvent { dao_id, proposal_id, sender: sender_addr }
);
actionT
}
- // Clean proposals that have been rejected or executed.
- public fun clean_proposals(_sender: &signer)
- acquires GlobalProposals, GlobalProposalActions {
- let dao_address = dao_address();
- let global_proposals = borrow_global_mut(dao_address);
-
- let i = 0;
- let len = Vector::length(&global_proposals.proposals);
- while(i < len){
- let proposal = Vector::borrow(&global_proposals.proposals, i);
- let state = proposal_state_with_proposal(proposal);
- if (state == EXTRACTED || state == REJECTED) {
- let _ = Vector::remove(&mut global_proposals.proposals, i);
- len = len - 1;
- } else {
- i = i + 1;
- }
- };
- }
-
- public (script) fun clean_proposals_entry(sender: signer)
- acquires GlobalProposals, GlobalProposalActions {
- clean_proposals(&sender);
- }
-
- // Clean specific proposal by proposal id, only for rejected or executed proposals
- public fun clean_proposal_by_id(_sender: &signer, proposal_id: u64)
- acquires GlobalProposals, GlobalProposalActions {
- let dao_address = dao_address();
- let global_proposals = borrow_global_mut(dao_address);
- let proposal = borrow_proposal(global_proposals, proposal_id);
- let state = proposal_state_with_proposal(proposal);
- assert!(state == EXTRACTED || state == REJECTED, Errors::invalid_state(ERR_PROPOSAL_STATE_INVALID));
-
- let _ = remove_proposal(global_proposals, proposal_id);
- }
-
- public (script) fun clean_proposal_by_id_entry(sender: signer, proposal_id: u64)
- acquires GlobalProposals, GlobalProposalActions {
- clean_proposal_by_id(&sender, proposal_id)
- }
-
- fun take_proposal_action(dao_address: address, proposal_id: u64): (ActionT, Token)
- acquires ProposalActions, GlobalProposalActions {
+ fun take_proposal_action(dao_address: address, proposal_id: u64): ActionT acquires ProposalActions, GlobalProposals, GlobalProposalActions {
let actions = borrow_global_mut>(dao_address);
let index_opt = find_action(&actions.actions, proposal_id);
assert!(Option::is_some(&index_opt), Errors::invalid_argument(ERR_ACTION_INDEX_INVALID));
+ let global_proposals = borrow_global(dao_address);
+ let proposal = borrow_proposal(global_proposals, proposal_id);
+
let index = Option::extract(&mut index_opt);
let ProposalAction{ proposal_id:_, deposit, action} = Vector::remove(&mut actions.actions, index);
@@ -1778,24 +1727,22 @@ module StarcoinFramework::DAOSpace {
let propopsal_action_index = Option::extract(&mut proposal_action_index_opt);
let ProposalActionIndex{ proposal_id:_,} = Vector::remove(&mut global_proposal_actions.proposal_action_indexs, propopsal_action_index);
- (action, deposit)
+ Account::deposit(proposal.proposer, deposit);
+ action
}
- fun remove_proposal(proposals: &mut GlobalProposals, proposal_id: u64): Proposal {
- let i = 0;
- let len = Vector::length(&proposals.proposals);
- while(i < len){
- let proposal = Vector::borrow(&proposals.proposals, i);
- if(proposal.id == proposal_id){
- let proposal = Vector::remove(&mut proposals.proposals, i);
- return proposal
- };
- i = i + 1;
- };
- abort Errors::invalid_argument(ERR_PROPOSAL_NOT_EXIST)
+ fun take_proposal_token(dao_address: address, proposal_id: u64):Token acquires ProposalActions {
+ let actions = borrow_global_mut>(dao_address);
+ let index_opt = find_action(&actions.actions, proposal_id);
+ assert!(Option::is_some(&index_opt), Errors::invalid_argument(ERR_ACTION_INDEX_INVALID));
+
+ let index = Option::extract(&mut index_opt);
+ let deposit = &mut Vector::borrow_mut(&mut actions.actions, index).deposit;
+ let amount = Token::value(deposit);
+ Token::withdraw(deposit, amount)
}
- fun find_action(actions: &vector>, proposal_id: u64): Option{
+ fun find_action(actions: &vector>, proposal_id: u64): Option{
let i = 0;
let len = Vector::length(actions);
while(i < len){
@@ -1856,29 +1803,20 @@ module StarcoinFramework::DAOSpace {
/// Proposals are rejected when their nowithveto option reaches a certain threshold
/// A portion of the pledged tokens will be rewarded to the executor who executes the proposal
- public fun reject_proposal(sender: &signer, proposal_id: u64)
- acquires DAO, ProposalEvent, ProposalActions, GlobalProposals, GlobalProposalActions{
+ public fun reject_proposal(sender: &signer, proposal_id: u64) acquires ProposalActions, GlobalProposals, GlobalProposalActions{
// Only REJECTED proposal's action can be burn token.
assert!(proposal_state(proposal_id) == REJECTED, Errors::invalid_state(ERR_PROPOSAL_STATE_INVALID));
let dao_address = dao_address();
assert!(exists>(dao_address), Errors::invalid_state(ERR_PROPOSAL_ACTIONS_NOT_EXIST));
- let (_, token) = take_proposal_action(dao_address, proposal_id);
+ let token = take_proposal_token(dao_address, proposal_id);
// Part of the token is awarded to whoever executes this method , TODO: 10 %
let award_amount = Token::value(&token) / 10;
let (burn_token , award_token) = Token::split(token, award_amount);
Account::deposit(Signer::address_of(sender), award_token);
STC::burn(burn_token);
-
- // emit event
- let dao_id = dao_id(dao_address);
- let proposal_event = borrow_global_mut>(dao_address);
- Event::emit_event(&mut proposal_event.proposal_action_event,
- ProposalActionEvent { dao_id, proposal_id, sender: Signer::address_of(sender), state: REJECTED }
- );
}
- public (script) fun reject_proposal_entry(sender: signer, proposal_id: u64)
- acquires DAO, ProposalEvent, ProposalActions, GlobalProposals, GlobalProposalActions{
+ public (script) fun reject_proposal_entry(sender: signer, proposal_id: u64) acquires ProposalActions, GlobalProposals, GlobalProposalActions{
reject_proposal(&sender, proposal_id);
}
diff --git a/sources/daospaceplugin/ConfigProposalPlugin.move b/sources/daospaceplugin/ConfigProposalPlugin.move
index e83c65bc..32373d60 100644
--- a/sources/daospaceplugin/ConfigProposalPlugin.move
+++ b/sources/daospaceplugin/ConfigProposalPlugin.move
@@ -9,7 +9,7 @@ module StarcoinFramework::ConfigProposalPlugin {
struct ConfigProposalPlugin has store, drop{}
- struct ConfigProposalAction has store, drop {
+ struct ConfigProposalAction has store {
config: ConfigT,
}
@@ -43,7 +43,7 @@ module StarcoinFramework::ConfigProposalPlugin {
caps
}
- public fun create_proposal(sender: &signer, description: vector,action_delay: u64, config: ConfigT) {
+ public fun create_proposal(sender: &signer, description: vector,action_delay: u64, config: ConfigT) {
let witness = ConfigProposalPlugin{};
let cap = DAOSpace::acquire_proposal_cap(&witness);
let action = ConfigProposalAction{
diff --git a/sources/daospaceplugin/GasOracleProposalPlugin.move b/sources/daospaceplugin/GasOracleProposalPlugin.move
index 4d86addf..d060b432 100644
--- a/sources/daospaceplugin/GasOracleProposalPlugin.move
+++ b/sources/daospaceplugin/GasOracleProposalPlugin.move
@@ -21,11 +21,11 @@ module StarcoinFramework::GasOracleProposalPlugin {
precision: u8
}
- struct OracleSourceAddAction has store, drop {
+ struct OracleSourceAddAction has store {
source_address: address
}
- struct OracleSourceRemoveAction has store, drop {
+ struct OracleSourceRemoveAction has store {
source_address: address
}
diff --git a/sources/daospaceplugin/GrantProposalPlugin.move b/sources/daospaceplugin/GrantProposalPlugin.move
index 484b51a6..7e8c5e69 100644
--- a/sources/daospaceplugin/GrantProposalPlugin.move
+++ b/sources/daospaceplugin/GrantProposalPlugin.move
@@ -11,14 +11,14 @@ module StarcoinFramework::GrantProposalPlugin{
struct GrantProposalPlugin has store, drop{}
- struct GrantCreateAction has store, drop {
+ struct GrantCreateAction has store {
grantee: address,
total: u128,
start_time:u64,
period:u64
}
- struct GrantConfigAction has store, drop {
+ struct GrantConfigAction has store {
old_grantee: address,
new_grantee:address,
total: u128,
@@ -26,7 +26,7 @@ module StarcoinFramework::GrantProposalPlugin{
period:u64
}
- struct GrantRevokeAction has store, drop {
+ struct GrantRevokeAction has store {
grantee:address
}
diff --git a/sources/daospaceplugin/InstallPluginProposalPlugin.move b/sources/daospaceplugin/InstallPluginProposalPlugin.move
index 718b020d..f719d75b 100644
--- a/sources/daospaceplugin/InstallPluginProposalPlugin.move
+++ b/sources/daospaceplugin/InstallPluginProposalPlugin.move
@@ -8,7 +8,7 @@ module StarcoinFramework::InstallPluginProposalPlugin{
struct InstallPluginProposalPlugin has store, drop{}
- struct InstallPluginAction has store, drop {
+ struct InstallPluginAction has store {
required_caps: vector,
}
diff --git a/sources/daospaceplugin/MemberProposalPlugin.move b/sources/daospaceplugin/MemberProposalPlugin.move
index fc0de790..23d393b2 100644
--- a/sources/daospaceplugin/MemberProposalPlugin.move
+++ b/sources/daospaceplugin/MemberProposalPlugin.move
@@ -9,7 +9,7 @@ module StarcoinFramework::MemberProposalPlugin{
struct MemberProposalPlugin has store, drop{}
- struct MemberJoinAction has store, drop {
+ struct MemberJoinAction has store {
member: address,
init_sbt: u128,
image_url: vector ,
diff --git a/sources/daospaceplugin/StakeToSBTPlugin.move b/sources/daospaceplugin/StakeToSBTPlugin.move
index b10c492c..b17ffca3 100644
--- a/sources/daospaceplugin/StakeToSBTPlugin.move
+++ b/sources/daospaceplugin/StakeToSBTPlugin.move
@@ -73,7 +73,7 @@ module StarcoinFramework::StakeToSBTPlugin {
weight: u64,
}
- struct AcceptTokenCap has store, drop {}
+ struct AcceptTokenCap has store {}
/// Events
///
diff --git a/sources/daospaceplugin/UpgradeModulePlugin.move b/sources/daospaceplugin/UpgradeModulePlugin.move
index c669d829..90e05d6a 100644
--- a/sources/daospaceplugin/UpgradeModulePlugin.move
+++ b/sources/daospaceplugin/UpgradeModulePlugin.move
@@ -8,7 +8,7 @@ module StarcoinFramework::UpgradeModulePlugin {
struct UpgradeModulePlugin has store, drop{}
- struct UpgradeModuleAction has store, drop {
+ struct UpgradeModuleAction has store {
package_hash: vector,
version: u64,
enforced: bool