Skip to content

Commit

Permalink
Revert "Add event util (#134)"
Browse files Browse the repository at this point in the history
This reverts commit 545f191.
  • Loading branch information
nkysg committed Mar 3, 2023
1 parent a15e61c commit 47dba14
Show file tree
Hide file tree
Showing 15 changed files with 37 additions and 83 deletions.
5 changes: 1 addition & 4 deletions build/StarcoinFramework/BuildInfo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,6 @@ compiled_package_info:
? address: "0x00000000000000000000000000000001"
name: Event
: StarcoinFramework
? address: "0x00000000000000000000000000000001"
name: EventUtil
: StarcoinFramework
? address: "0x00000000000000000000000000000001"
name: FixedPoint32
: StarcoinFramework
Expand Down Expand Up @@ -321,7 +318,7 @@ compiled_package_info:
? address: "0x00000000000000000000000000000001"
name: YieldFarmingV2
: StarcoinFramework
source_digest: 988F0323FAFB181295E294FC2838DC0C7C8BC8C7801B8320594FBD82E3FC7C67
source_digest: 5E08A2774FAADBD05F5E98290A4B05E6D4D5AA4DB5123B79F6015AC8574B75F8
build_flags:
dev_mode: false
test_mode: false
Expand Down
1 change: 0 additions & 1 deletion build/StarcoinFramework/docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ This is the root document for the Move StarcoinFramework module documentation. T
- [`0x1::Epoch`](Epoch.md#0x1_Epoch)
- [`0x1::Errors`](Errors.md#0x1_Errors)
- [`0x1::Event`](Event.md#0x1_Event)
- [`0x1::EventUtil`](EventUtil.md#0x1_EventUtil)
- [`0x1::FixedPoint32`](FixedPoint32.md#0x1_FixedPoint32)
- [`0x1::Genesis`](Genesis.md#0x1_Genesis)
- [`0x1::GenesisNFT`](GenesisNFT.md#0x1_GenesisNFT)
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/daospace/dao_grant.exp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ task 5 'run'. lines 13-21:

task 8 'run'. lines 123-136:
{
"gas_used": 8209548,
"gas_used": 8205741,
"status": "Executed"
}

Expand Down
2 changes: 1 addition & 1 deletion integration-tests/daospace/dao_proposal.exp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ processed 42 tasks

task 7 'run'. lines 169-182:
{
"gas_used": 8206751,
"gas_used": 8202944,
"status": "Executed"
}

Expand Down
2 changes: 1 addition & 1 deletion integration-tests/daospace/dao_upgrade.exp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ processed 18 tasks

task 3 'run'. lines 7-15:
{
"gas_used": 6487178,
"gas_used": 6483371,
"status": "Executed"
}

Expand Down
2 changes: 1 addition & 1 deletion integration-tests/daospace/dao_upgrade_incompatible.exp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ processed 19 tasks

task 3 'run'. lines 7-15:
{
"gas_used": 6487178,
"gas_used": 6483371,
"status": "Executed"
}

Expand Down
14 changes: 7 additions & 7 deletions integration-tests/daospace/stake_to_sbt_plugin.exp
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@ processed 18 tasks

task 4 'run'. lines 19-27:
{
"gas_used": 6487178,
"gas_used": 6483371,
"status": "Executed"
}

task 6 'run'. lines 71-79:
{
"gas_used": 1688073,
"gas_used": 1684266,
"status": "Executed"
}

task 7 'run'. lines 81-117:
{
"gas_used": 655792,
"gas_used": 652577,
"status": "Executed"
}

Expand Down Expand Up @@ -42,25 +42,25 @@ task 10 'run'. lines 134-147:

task 11 'run'. lines 149-165:
{
"gas_used": 423057,
"gas_used": 419842,
"status": "Executed"
}

task 13 'run'. lines 169-182:
{
"gas_used": 220601,
"gas_used": 217386,
"status": "Executed"
}

task 14 'run'. lines 184-200:
{
"gas_used": 544264,
"gas_used": 541049,
"status": "Executed"
}

task 16 'run'. lines 204-219:
{
"gas_used": 229566,
"gas_used": 226351,
"status": "Executed"
}

Expand Down
2 changes: 1 addition & 1 deletion integration-tests/daospace/xdao.exp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ processed 8 tasks

task 2 'run'. lines 7-14:
{
"gas_used": 6487178,
"gas_used": 6483371,
"status": "Executed"
}

Expand Down
2 changes: 1 addition & 1 deletion integration-tests/daospaceplugin/mint_proposal_plugin.exp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ processed 30 tasks

task 5 'run'. lines 11-18:
{
"gas_used": 6487178,
"gas_used": 6483371,
"status": "Executed"
}

Expand Down
2 changes: 1 addition & 1 deletion integration-tests/daospaceplugin/salary_gov_plugin.exp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ processed 21 tasks

task 7 'run'. lines 252-266:
{
"gas_used": 8164713,
"gas_used": 8160906,
"status": "Executed"
}

Expand Down
2 changes: 1 addition & 1 deletion integration-tests/starcoin_dao/starcoin_dao.exp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ processed 4 tasks

task 3 'run'. lines 8-16:
{
"gas_used": 6487178,
"gas_used": 6483371,
"status": "Executed"
}
4 changes: 2 additions & 2 deletions integration-tests/starcoin_dao/starcoin_onchain_config.exp
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ processed 24 tasks

task 4 'run'. lines 9-17:
{
"gas_used": 6479978,
"gas_used": 6476171,
"status": "Executed"
}

task 5 'run'. lines 19-33:
{
"gas_used": 590106,
"gas_used": 586891,
"status": "Executed"
}

Expand Down
4 changes: 2 additions & 2 deletions integration-tests/starcoin_dao/starcoin_upgrade_module.exp
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ processed 27 tasks

task 4 'run'. lines 9-17:
{
"gas_used": 6479978,
"gas_used": 6476171,
"status": "Executed"
}

task 5 'run'. lines 19-33:
{
"gas_used": 590106,
"gas_used": 586891,
"status": "Executed"
}

Expand Down
36 changes: 0 additions & 36 deletions sources/EventUtil.move

This file was deleted.

40 changes: 17 additions & 23 deletions sources/daospace/DAOSpace.move
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ module StarcoinFramework::DAOSpace {
use StarcoinFramework::SnapshotUtil;
use StarcoinFramework::Block;
use StarcoinFramework::DAOPluginMarketplace;
use StarcoinFramework::EventUtil;

friend StarcoinFramework::StarcoinDAO;

Expand Down Expand Up @@ -728,12 +727,7 @@ module StarcoinFramework::DAOSpace {
});
}

public fun set_member_image<DAOT: store, PluginT>(
_cap: &DAOMemberCap<DAOT, PluginT>,
member_addr: address,
image_data: Option::Option<vector<u8>>,
image_url: Option::Option<vector<u8>>
) acquires DAONFTUpdateCapHolder {
public fun set_member_image<DAOT: store, PluginT>(_cap: &DAOMemberCap<DAOT, PluginT>, member_addr: address, image_data:Option::Option<vector<u8>>, image_url:Option::Option<vector<u8>>) acquires DAONFTUpdateCapHolder{
ensure_member<DAOT>(member_addr);

let dao_address = dao_address<DAOT>();
Expand Down Expand Up @@ -785,24 +779,24 @@ module StarcoinFramework::DAOSpace {
}

/// Plugin event
public fun init_plugin_event<
DAOT: store,
PluginT: store,
EventT: store + drop
>(_cap: &DAOPluginEventCap<DAOT, PluginT>) acquires DAOAccountCapHolder {
public fun init_plugin_event<DAOT: store,
PluginT: store,
EventT: store + drop>(_cap: &DAOPluginEventCap<DAOT, PluginT>)
acquires DAOAccountCapHolder {
let dao_signer = dao_signer<DAOT>();
EventUtil::init_event<EventT>(&dao_signer);
assert!(!exists<PluginEvent<DAOT, PluginT, EventT>>(dao_address<DAOT>()), Errors::invalid_state(ERR_ALREADY_INIT));
move_to(&dao_signer, PluginEvent<DAOT, PluginT, EventT> {
event_handle: Event::new_event_handle<EventT>(&dao_signer)
});
}

public fun emit_plugin_event<
DAOT: store,
PluginT: store,
EventT: store + drop
>(
_cap: &DAOPluginEventCap<DAOT, PluginT>,
event: EventT
) {
EventUtil::emit_event(dao_address<DAOT>(), event);
public fun emit_plugin_event<DAOT: store,
PluginT: store,
EventT: store + drop>(_cap: &DAOPluginEventCap<DAOT, PluginT>,
event: EventT) acquires PluginEvent {
let dao_address = dao_address<DAOT>();
let plugin_event = borrow_global_mut<PluginEvent<DAOT, PluginT, EventT>>(dao_address);
Event::emit_event(&mut plugin_event.event_handle, event);
}


Expand Down Expand Up @@ -880,7 +874,7 @@ module StarcoinFramework::DAOSpace {
let dao_address = dao_address<DAOT>();
let account_address = Signer::address_of(sender);

if (!exists<GrantEvent<PluginT>>(dao_address)){
if(! exists<GrantEvent<PluginT>>(dao_address)){
move_to(&dao_signer, GrantEvent<PluginT>{
create_grant_event_handler:Event::new_event_handle<GrantCreateEvent<PluginT>>(&dao_signer),
revoke_grant_event_handler:Event::new_event_handle<GrantRevokeEvent<PluginT>>(&dao_signer),
Expand Down

0 comments on commit 47dba14

Please sign in to comment.