create_token.lua 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. --- Create token.
  2. -- Depends on tokenomics
  3. -- @module create_token
  4. local create_token = {
  5. name = "Create a token",
  6. slug = "create_token",
  7. desc = "Creates an org token",
  8. hide = false;
  9. }
  10. create_token.data = {
  11. }
  12. create_token.config = {
  13. token_name = "token",
  14. approval_module = false
  15. }
  16. --- Initiate function
  17. -- @function create_toke:initiate
  18. -- @param result Callback if this module is embedded in other modules
  19. function create_token:initiate(result)
  20. modpol.interactions.text_query(
  21. self.initiator,
  22. "Token name (alpha-numeric, no spaces):",
  23. function(input)
  24. self.config.token_name = input
  25. self:call_module(
  26. "tokenomics",
  27. self.initiator,
  28. {
  29. approval_module = self.config.approval_module,
  30. token_slug = self.config.token_name
  31. },
  32. function(input2)
  33. modpol.interactions.org_dashboard(
  34. self.initiator, self.org.name)
  35. if result then result() end
  36. -- call this wherever process might end:
  37. self.org:delete_process(self.id)
  38. end
  39. )
  40. modpol.interactions.org_dashboard(
  41. self.initiator, self.org.name)
  42. end
  43. )
  44. end
  45. modpol.modules.create_token = create_token