Skip to content

Commit

Permalink
Revert "feat: remove sender of update_plugin (#187)"
Browse files Browse the repository at this point in the history
This reverts commit cb21b0a.
  • Loading branch information
nkysg committed Mar 2, 2023
1 parent d714796 commit 5a4b4c1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
processed 10 tasks

task 6 'run'. lines 46-54:
task 6 'run'. lines 47-55:
{
"gas_used": 235944,
"status": "Executed"
}

task 7 'view'. lines 56-56:
task 7 'view'. lines 57-57:
store key 0x00000000000000000000000000000001::DAOPluginMarketplace::PluginEntry<0x662ba5a1a1da0f1c70a9762c7eeb7aaf::TestPlugin::TestPlugin> {
id: 11
name: 54657374506c7567696e
Expand All @@ -21,13 +21,13 @@ store key 0x00000000000000000000000000000001::DAOPluginMarketplace::PluginEntry<
updated_at: 10
}

task 8 'run'. lines 58-66:
task 8 'run'. lines 59-67:
{
"gas_used": 139490,
"gas_used": 135663,
"status": "Executed"
}

task 9 'view'. lines 68-68:
task 9 'view'. lines 69-69:
store key 0x00000000000000000000000000000001::DAOPluginMarketplace::PluginEntry<0x662ba5a1a1da0f1c70a9762c7eeb7aaf::TestPlugin::TestPlugin> {
id: 11
name: 54657374506c7567696e
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,14 @@ module creator::TestPlugin {
);
}

public(script) fun update_plugin(_sender: signer) {
public(script) fun update_plugin(sender: signer) {
let labels = Vector::empty<vector<u8>>();
Vector::push_back<vector<u8>>(&mut labels, b"OS=Starcoin");
Vector::push_back<vector<u8>>(&mut labels, b"Store=IPFS");

let witness = TestPlugin{};
DAOPluginMarketplace::update_plugin<TestPlugin>(
&sender,
&witness,
NAME,
b"ipfs://description2",
Expand Down
8 changes: 4 additions & 4 deletions sources/daospace/DAOPluginMarketplace.move
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ module StarcoinFramework::DAOPluginMarketplace {
}

struct UpdatePluginInfoEvent<phantom PluginT> has drop, store{
sender: address,
id: u64,
type: TypeInfo,
name: vector<u8>,
description:vector<u8>,
labels: vector<vector<u8>>
Expand Down Expand Up @@ -317,10 +317,11 @@ module StarcoinFramework::DAOPluginMarketplace {
return exists<Star<PluginT>>(sender_addr)
}

public fun update_plugin<PluginT>(_witness: &PluginT, name: vector<u8>, description: vector<u8>, option_labels: Option<vector<vector<u8>>>) acquires PluginEntry, PluginEventHandlers {
public fun update_plugin<PluginT>(sender: &signer, _witness: &PluginT, name: vector<u8>, description: vector<u8>, option_labels: Option<vector<vector<u8>>>) acquires PluginEntry, PluginEventHandlers {
assert_string_length(&name, MAX_INPUT_LEN);
assert_string_length(&description, MAX_TEXT_LEN);

let sender_addr = Signer::address_of(sender);
let plugin = borrow_global_mut<PluginEntry<PluginT>>(CoreAddresses::GENESIS_ADDRESS());

plugin.name = name;
Expand All @@ -338,13 +339,12 @@ module StarcoinFramework::DAOPluginMarketplace {
let plugin_event_handlers = borrow_global_mut<PluginEventHandlers<PluginT>>(CoreAddresses::GENESIS_ADDRESS());
Event::emit_event(&mut plugin_event_handlers.update_plugin,
UpdatePluginInfoEvent {
sender: sender_addr,
id: *&plugin.id,
type: TypeInfo::type_of<PluginT>(),
name: *&plugin.name,
description: *&plugin.description,
labels: *&plugin.labels,
},
);
}
}

0 comments on commit 5a4b4c1

Please sign in to comment.