create_token.lua 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. --- Create token.
  2. -- Depends on tokenomics
  3. -- @module create_token
  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. create_token.data = {
  11. }
  12. create_token.config = {
  13. token_name = ""
  14. }
  15. --- Initiate function
  16. -- @function create_toke:initiate
  17. -- @param result Callback if this module is embedded in other modules
  18. function create_token:initiate(result)
  19. modpol.interactions.text_query(
  20. self.initiator,
  21. "Token name (alpha-numeric, no spaces):",
  22. function(input)
  23. self.config.token_name = input
  24. self:call_module(
  25. "tokenomics",
  26. self.initiator,
  27. {
  28. consent = true,
  29. token_slug = self.config.token_name
  30. },
  31. function(input2)
  32. modpol.interactions.org_dashboard(
  33. self.initiator, self.org.name)
  34. if result then result() end
  35. -- call this wherever process might end:
  36. self.org:delete_process(self.id)
  37. end
  38. )
  39. modpol.interactions.org_dashboard(
  40. self.initiator, self.org.name)
  41. end
  42. )
  43. end
  44. modpol.modules.create_token = create_token