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: add entry for plugin marketplace function #199

Merged
Show file tree
Hide file tree
Changes from all commits
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
44 changes: 44 additions & 0 deletions sources/daospace/DAOExtensionPoint.move
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,11 @@ module StarcoinFramework::DAOExtensionPoint {
);
}

public fun has_star_plugin<ExtPointT>(sender: &signer): bool {
let sender_addr = Signer::address_of(sender);
return exists<Star<ExtPointT>>(sender_addr)
}

public fun star<ExtPointT>(sender: &signer) acquires Entry, ExtensionPointEventHandlers {
let sender_addr = Signer::address_of(sender);
assert!(!exists<Star<ExtPointT>>(sender_addr), Errors::invalid_state(ERR_STAR_ALREADY_STARED));
Expand Down Expand Up @@ -390,4 +395,43 @@ module StarcoinFramework::DAOExtensionPoint {
},
);
}

// public entrys
public(script) fun register_entry<ExtPointT: store>(sender: signer, name: vector<u8>, description: vector<u8>, types_d_ts:vector<u8>, dts_doc:vector<u8>,
labels: vector<vector<u8>>) acquires Registry, NFTMintCapHolder, RegistryEventHandlers {
let option_labels = if(Vector::length(&labels) == 0){
Option::none<vector<vector<u8>>>()
} else {
Option::some(labels)
};

register<ExtPointT>(&sender, name, description, types_d_ts, dts_doc, option_labels);
}

public(script) fun publish_version_entry<ExtPointT: store>(
sender: signer,
tag: vector<u8>,
types_d_ts:vector<u8>,
dts_doc: vector<u8>,
) acquires Entry, ExtensionPointEventHandlers {
publish_version<ExtPointT>(&sender, tag, types_d_ts, dts_doc);
}

public(script) fun update_entry<ExtPointT>(sender: signer, name: vector<u8>, description: vector<u8>, labels: vector<vector<u8>>) acquires Entry, ExtensionPointEventHandlers {
let option_labels = if(Vector::length(&labels) == 0){
Option::none<vector<vector<u8>>>()
} else {
Option::some(labels)
};

update<ExtPointT>(&sender, name, description, option_labels);
}

public(script) fun star_entry<ExtPointT:store>(sender: signer) acquires Entry, ExtensionPointEventHandlers {
star<ExtPointT>(&sender);
}

public(script) fun unstar_entry<ExtPointT:store>(sender: signer) acquires Star, Entry, ExtensionPointEventHandlers {
unstar<ExtPointT>(&sender);
}
}
9 changes: 9 additions & 0 deletions sources/daospace/DAOPluginMarketplace.move
Original file line number Diff line number Diff line change
Expand Up @@ -346,5 +346,14 @@ module StarcoinFramework::DAOPluginMarketplace {
},
);
}

// public entrys
public(script) fun star_plugin_entry<PluginT>(sender: signer) acquires PluginEntry, PluginEventHandlers {
star_plugin<PluginT>(&sender);
}

public(script) fun unstar_plugin_entry<PluginT>(sender: signer) acquires PluginEntry, Star, PluginEventHandlers {
unstar_plugin<PluginT>(&sender);
}
}