diff --git a/build/StarcoinFramework/BuildInfo.yaml b/build/StarcoinFramework/BuildInfo.yaml index d6053e95..8c8b8093 100644 --- a/build/StarcoinFramework/BuildInfo.yaml +++ b/build/StarcoinFramework/BuildInfo.yaml @@ -306,7 +306,7 @@ compiled_package_info: ? address: "0x00000000000000000000000000000001" name: YieldFarmingV2 : StarcoinFramework - source_digest: A710EE5A9CB99AFE86615AD5840E39342DB78E8FB0F5F9509550D55526BF054D + source_digest: 695F4208154FB109E223367B79D9AD3C30261C91BF6F595A3B9D2226BC5103B0 build_flags: dev_mode: false test_mode: false diff --git a/integration-tests/daospace/dao_ext.exp b/integration-tests/daospace/dao_ext.exp deleted file mode 100644 index 746d1a3e..00000000 --- a/integration-tests/daospace/dao_ext.exp +++ /dev/null @@ -1,19 +0,0 @@ -processed 9 tasks - -task 6 'run'. lines 56-65: -{ - "gas_used": 917082, - "status": "Executed" -} - -task 7 'run'. lines 67-76: -{ - "gas_used": 63423, - "status": "Executed" -} - -task 8 'run'. lines 78-87: -{ - "gas_used": 63423, - "status": "Executed" -} diff --git a/integration-tests/daospace/dao_ext.move b/integration-tests/daospace/dao_ext.move deleted file mode 100644 index f4d05b6c..00000000 --- a/integration-tests/daospace/dao_ext.move +++ /dev/null @@ -1,87 +0,0 @@ -//# init -n dev - -//# faucet --addr creator --amount 100000000000 - -//# faucet --addr alice --amount 10000000000 - -//# faucet --addr bob --amount 10000000000 - -//# publish -module creator::DAOHelper { - use StarcoinFramework::DAOAccount; - use StarcoinFramework::DAOSpace; - use StarcoinFramework::Option; - - struct X has store, copy, drop { - value: u64, - } - - const NAME: vector = b"X"; - - /// directly upgrade the sender account to DAOAccount and create DAO - public(script) fun create_dao( - sender: signer, - voting_delay: u64, - voting_period: u64, - voting_quorum_rate: u8, - min_action_delay: u64, - min_proposal_deposit: u128, ) { - let dao_account_cap = DAOAccount::upgrade_to_dao(sender); - - - //let dao_signer = DAOAccount::dao_signer(&dao_account_cap); - let config = DAOSpace::new_dao_config( - voting_delay, - voting_period, - voting_quorum_rate, - min_action_delay, - min_proposal_deposit, - ); - let dao_ext = X { value: 0}; - let dao_root_cap = DAOSpace::create_dao(dao_account_cap, *&NAME, Option::none>(), Option::none>(), b"ipfs://description", dao_ext, config); - - DAOSpace::burn_root_cap(dao_root_cap); - } - - public fun modify_ext(value: u64): u64 { - let witness = X { value: 0 }; - let X { value: old_value } = DAOSpace::take_ext(&witness); - DAOSpace::save_ext(X { value }); - old_value - } -} - -//# block --author 0x1 --timestamp 86400000 - -//# run --signers creator -script { - use creator::DAOHelper; - - fun main(sender: signer) { - // time unit is millsecond - DAOHelper::create_dao(sender, 10000, 3600000, 2, 10000, 10); - } -} -// check: EXECUTED - -//# run --signers alice -script { - use creator::DAOHelper; - - fun main(_sender: signer) { - let ext_value = DAOHelper::modify_ext(123); - assert!(ext_value == 0, 101); - } -} -// check: EXECUTED - -//# run --signers bob -script { - use creator::DAOHelper; - - fun main(_sender: signer) { - let ext_value = DAOHelper::modify_ext(234); - assert!(ext_value == 123, 101); - } -} -// check: EXECUTED diff --git a/sources/daospace/DAOSpace.move b/sources/daospace/DAOSpace.move index c0c1eb97..d05a006b 100644 --- a/sources/daospace/DAOSpace.move +++ b/sources/daospace/DAOSpace.move @@ -30,7 +30,6 @@ module StarcoinFramework::DAOSpace { const ERR_NFT_ERROR: u64 = 104; const ERR_ALREADY_INIT: u64 = 105; const ERR_TOKEN_ERROR: u64 = 106; - const ERR_DAO_EXT: u64 = 107; /// member const ERR_EXPECT_MEMBER: u64 = 200; @@ -194,8 +193,6 @@ module StarcoinFramework::DAOSpace { Vector::push_back(&mut caps, member_cap_type()); Vector::push_back(&mut caps, proposal_cap_type()); Vector::push_back(&mut caps, grant_cap_type()); - Vector::push_back(&mut caps, token_mint_cap_type()); - Vector::push_back(&mut caps, token_burn_cap_type()); caps } @@ -343,31 +340,12 @@ module StarcoinFramework::DAOSpace { DAORootCap{} } - /// Upgrade account to DAO account and create DAO + // Upgrade account to DAO account and create DAO public fun upgrade_to_dao(sender: signer, name: vector, image_data:Option::Option>, image_url:Option::Option>, description:vector, ext: DAOT, config: DAOConfig): DAORootCap acquires DAOEvent{ let cap = DAOAccount::upgrade_to_dao(sender); create_dao(cap, name, image_data, image_url, description, ext, config) } - /// Take ext from DAOExt - public fun take_ext(_witness: &DAOT): DAOT - acquires DAOExt { - let dao_addr = dao_address(); - assert!(exists>(dao_addr), Errors::not_published(ERR_DAO_EXT)); - let DAOExt { ext } = move_from>(dao_addr); - ext - } - - /// Save ext to DAOExt - public fun save_ext(ext: DAOT) acquires DAOAccountCapHolder { - let dao_addr = dao_address(); - assert!(!exists>(dao_addr), Errors::already_published(ERR_DAO_EXT)); - let dao_signer = dao_signer(); - move_to(&dao_signer, DAOExt{ - ext - }); - } - /// Burn the root cap after init the DAO public fun burn_root_cap(cap: DAORootCap) { let DAORootCap{} = cap;