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

Custom export formats #532

Closed
kristoferlund opened this issue Jul 29, 2022 · 4 comments · Fixed by #549
Closed

Custom export formats #532

kristoferlund opened this issue Jul 29, 2022 · 4 comments · Fixed by #549
Assignees
Labels
api dashboard enhancement New feature or request

Comments

@kristoferlund
Copy link
Member

kristoferlund commented Jul 29, 2022

Custom export formats will allow communities to create token distribution files etc without having to rely on separate tools such as RAD.

To begin with we will make a simple setup where we allow for one custom export format.

A custom export takes the raw period receiver data and transforms it into another format. The custom format transformer (map) should also accept parameters (context) such as:

  • The token distribution budget
  • Token name to distribute
  • ... any context parameter

I believe we might be able to use this library to perform the transform: https://github.com/bozzltron/node-json-transform

Specs

  • Raw data is the summarized period receiver data. No individual praise items included but the summarised score for the period in question.
  • Three global settings:
    • CUSTOM_EXPORT_MAP: url pointing to a JSON object containing the export map/transformer. We will want to setup a separate repo for the transformers to allow for the community to contribute new transformers.
    • CUSTOM_EXPORT_CONTEXT: JSON object with the default inputs used by the transform
    • CUSTOM_EXPORT_CSV_FORMAT: Boolean
      • true: Export in csv format
      • false: Export in JSON format
  • Period settings: map, context and format:
    • Period settings inherit and override global defaults
    • These settings should not be locked when quantification has begun
  • Button on the period summary page: Custom export

First transformer

Let's start with creating a transform to the csv format needed by Aragon Finance.

Output CSV:

[ADDRESS], [AMOUNT], [TOKEN NAME]
[ADDRESS], [AMOUNT], [TOKEN NAME]
[ADDRESS], [AMOUNT], [TOKEN NAME]

Context:

{
  budget: 1000,
  token: 'TEC'
}
  • ADDRESS: Praise receiver address
  • AMOUNT: praiseScore / context.totalPraiseScore * context.budget
  • TOKEN: context.token

totalPraiseScore is added to the context by the transformer at runtime along with other parameters that might be needed by the transform: receiverCount, … what else?

@kristoferlund kristoferlund added enhancement New feature or request api dashboard labels Jul 29, 2022
@kristoferlund
Copy link
Member Author

The following needs to be added to the context object by the system.

totalPraiseScore   // sum of all praise scores for a period)
csWalletAddress  // Address to send CS support payment to
csSupportPercentage  // The percentage amount to support CS with

UI

  • Button next to Export on Period page: "Distribute"
  • Dialog
    • Message: TBD..
    • Allow admin to change amount to support CS with. Default: 2%
  • @kristoferlund make wireframe

@kristoferlund
Copy link
Member Author

  • Create new endpoint /exportSummary
  • Do transform in frontend

@kristoferlund
Copy link
Member Author

Wrap the transformer JSON to be able to giv it a name:

{
name: "Aragon Token Distribution",
map: {
  list: ...
  item: ...
  }
}

@kristoferlund
Copy link
Member Author

@nebs-dev perhaps also include context defaults in the JSON map? These can be used before transform starts to verify that transform has all values it needs.

{
"name": "Aragon Token Distribution",
"contextDefaults" : {
  "tokenName": "XXX",
  "budget": 100
},
"map": {
  "list": ...
  "item": ...
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api dashboard enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants