Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: remove sender of update_plugin #187

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
processed 10 tasks

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

task 7 'view'. lines 57-57:
task 7 'view'. lines 56-56:
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 59-67:
task 8 'run'. lines 58-66:
{
"gas_used": 135663,
"gas_used": 139490,
"status": "Executed"
}

task 9 'view'. lines 69-69:
task 9 'view'. lines 68-68:
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,14 +28,13 @@ 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,11 +317,10 @@ module StarcoinFramework::DAOPluginMarketplace {
return exists<Star<PluginT>>(sender_addr)
}

public fun update_plugin<PluginT>(sender: &signer, _witness: &PluginT, name: vector<u8>, description: vector<u8>, option_labels: Option<vector<vector<u8>>>) acquires PluginEntry, PluginEventHandlers {
public fun update_plugin<PluginT>(_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 @@ -339,12 +338,13 @@ 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,
},
);
}
}