Major improvements on policy configuration

- Bugfixes on change_policy
- Replaced _consent modules with configurable modules
This commit is contained in:
Nathan Schneider
2022-08-09 17:00:24 -06:00
parent 78ea89559f
commit 22a2048d5a
21 changed files with 253 additions and 379 deletions

View File

@ -1,5 +1,4 @@
--- Tokenomics.
-- Depends on consent
-- @module tokenomics
local tokenomics = {
@ -14,14 +13,13 @@ tokenomics.data = {
}
--- Config for module
-- @field consent Require consent to create?
-- @field token_variables the data that goes into the token
-- @field token_slug A no-spaces slug for the token
-- @field initial_treasury Quantity in org treasury
-- @field negative_spend Boolean: can users spend negative tokens? (for mutual credit)
-- @field balances Table of user balances
tokenomics.config = {
consent = false,
approval_module = false,
token_slug = "token",
token_variables = {
treasury = 0,
@ -43,29 +41,25 @@ function tokenomics:initiate(result)
self.initiator, "Token slug taken, aborting")
self.org:delete_process(self.id)
else
if self.config.consent then
self:call_module(
"consent",
self.initiator,
{
prompt = "Create token "..
self.config.token_slug.."?",
votes_required = #self.org.members
},
function()
modpol.interactions.message_org(
self.initiator, self.org.id,
"Consent reached: creating token "..
self.config.token_slug)
self:create_token()
end
)
else
self:create_token()
end
self:call_module(
self.config.approval_module,
self.initiator,
{
prompt = "Create token " ..
self.config.token_slug .. "?"
},
function()
modpol.interactions.message_org(
self.initiator, self.org.id,
"Creating token " ..
self.config.token_slug)
self:create_token()
end
)
end
end
--- Create token
-- @function tokenomics:create_token
function tokenomics:create_token()