create_token.lua 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. --- create_token
  2. -- @module create_token
  3. -- depends on tokenomics
  4. local create_token = {
  5. name = "Create a token (consent)",
  6. slug = "create_token",
  7. desc = "With org consent, creates an org token",
  8. hide = false;
  9. }
  10. --- (Required) Data for module
  11. -- Variables that module uses during the course of a process
  12. -- Can be blank
  13. create_token.data = {
  14. }
  15. create_token.config = {
  16. token_name = ""
  17. }
  18. --- (Required): initiate function
  19. -- @param result (optional) Callback if this module is embedded in other modules
  20. -- @function initiate
  21. function create_token:initiate(result)
  22. modpol.interactions.text_query(
  23. self.initiator,
  24. "Token name (alpha-numeric, no spaces):",
  25. function(input)
  26. self.config.token_name = input
  27. self:call_module(
  28. "tokenomics",
  29. self.initiator,
  30. {
  31. consent = true,
  32. token_slug = self.config.token_name
  33. },
  34. function(input2)
  35. modpol.interactions.org_dashboard(
  36. self.initiator, self.org.name)
  37. if result then result() end
  38. -- call this wherever process might end:
  39. self.org:delete_process(self.id)
  40. end
  41. )
  42. modpol.interactions.org_dashboard(
  43. self.initiator, self.org.name)
  44. end
  45. )
  46. end
  47. --- (Required) Add to module table
  48. modpol.modules.create_token = create_token