Design Details
- focus is on metadata, relationships, and social graph - not storing actual data.
- data ACL is a hierarchy. u control ur data, Roles have access to anything you would have, within the permissions given, including acting on others Entities that you have access to.
‣
Services
classDiagram
class API_Gateway {
+type : External Gateway
+desc : GraphQL API wrapping all internal services.
Applys auth middlesware and caching before forwarding requests
}
<<Service>> API_Gateway
class Graph_Node {
+type : Database
+desc : Indexes onchain data and makes it available via GraphQL API
+why? : probs less cheap than public network. Can always
loadbalance or failsafe to public network
}
<<Service>> Graph_Node
class Identity_EIP4361 {
+type : Identity
+desc : Accepts incoming signed messages from ETH wallets
and verifies the signature and data
+why? : lockdown cryptography and code supplychain tight
on this service bc it will back our entire ACL system.
}
<<Service>> Identity_EIP4361
class EIP4361_Contract {
+type : Identity
+desc : Contract on chain that verifies message signatures
+why? : lockdown cryptography and code supplychain tight
on this service bc it will back our entire ACL system.
}
<<Service>> Identity_EIP4361
class CRM_DB {
+type : Database
+desc : Stores all private + public data about Debt DAO marketplace
and ecosystem participants
}
<<Service>> CRM_DB
class Gas_Relay {
+type : Infra
+desc : Allows for EIP4361 authed users to send gas free meta tx
through our verified apps.
+why? : Incentive to signup to our service, provide CRM data, etc.
}
<<Service>> Gas_Relay
class Lambda_Bots {
+type : Infra
+desc : Serverless functions for executing bot scripts
(could be plugged into OZ Defender) for verified users
+why? : Incentive to signup to our service, provide CRM data, etc.
}
<<Service>> Lambda_Bots
class Discord {
+type : App
+desc : Consumes API_Gateway. Allows users to send commands to
retrieve public data or EIP4613 signed messages for private
data or send tx actions with our gas relay
}
<<Consumer>> Discord
class MarketplaceApp {
+type : App
+desc : Our normal webapp we all hate
}
<<Consumer>> MarketplaceApp
class CNC_Info {
+type : App
+desc : Displays indepth data analytics about relationships
between ecosystem participants, overall marketplace health, etc.
}
<<Consumer>> CNC_Info
class Monitoring_Bot {
+type : App
+desc : Sends notificaions of market data to users that
have subscribed to feeds
}
<<Consumer>> Monitoring_Bot
General read and write access across system
CNC_Info --> API_Gateway : READ
Discord --> API_Gateway : READ + WRITE
MarketplaceApp --> API_Gateway : READ
Monitoring_Bot --> API_Gateway : READ
Monitoring_Bot --> Discord : WRITE
API_Gateway --> Graph_Node : READ
API_Gateway --> CRM_DB : READ + WRITE
API_Gateway --> Gas_Relay : WRITE
API_Gateway --> Identity_EIP4361 : READ
Lambda_Bots --> GasRelay : WRITE
Lambda_Bots --> Discord : WRITE
Lambda_Bots --> Monitoring_Bot : WRITE
Services Exchanged and Value Flows
__pretty sure all these arrows are backwards__
API_Gateway --> Identity_EIP4361 : verify POST and private GET requests
API_Gateway --> Graph_Node : read onchain data from Debt DAO
smart contracts
API_Gateway --> CRM_DB : get metadata on marketplace actors
and onchain assets
CNC_Info --> CRM_DB : send product analytics data
Discord --> CRM_DB : backup messages for product analytics, track p2p interactions, train speech AIs for negotiating, etc.
MarketplaceApp --> CRM_DB : send product analytics data into db
‣
DB Schema
erDiagram
Entity {
string ID
string name
string description
string address "public address that they sign from to verify identity"
string ens "ENS name on reverse record for address"
Role default_role "role granted to view this Entities data to any unauthenticated requester"
Entity parent "direct controller of this asset. Any permissions on parent for requester are extended to parent."
}
Entity_Relationships {
Entity anarchist1 FK
Entity anarchist2 FK
string relationship_type
string description
}
Roles {
string name
string description
string allowed_fields "csv + object notation e.g. 'entity.address' gives access to only address while 'entity' gives them access to your entire profile"
}
Authorizations {
Roles role_granted FK
Entity authorizor FK
Entity actor FK "who is allowed to use Role permissions on authorizor's resources"
}
SocialProfile {
Entity owner FK
string twitter
string github "mainly for botcode but could be a Borrowers page"
string discord_server_invite_link
string forum
string governance_address "eth address or URL"
string debt_dao_discord_channel
}
Arbiter {
Entity actor FK
File policy FK
}
File {
Entity owner FK
string content_hash
number privacy_level
}
Bot_Config {
Entity bot FK
Enity owner FK "whoever controls this bot config"
number cron_frequency
number last_run
stirng data "JSON.stringify object params passed to bot"
}
Revenue_Contracts {
Entity rev_contract FK "Entity object of rev contract"
Entity owner FK
Entity operator FK
bool collateralized "if currently owned by a Line contract"
string spigoting_risks
}
Curations {
Entity curator FK
Entity curatee FK
string curator_type "Borrower, Lender, Curator"
Proposal deal FK "the end outcome of curation"
}
Proposals {
string proposalID PK "Mutual Consent autogenerated consent hash used as proposalId"
Entity target FK ""
string proposalType "add_credit | increase_credit | set_rates | buy_spigot | buy_rev_contract"
bool accepted
Entity lenderID FK
Entity borrowerID FK
Entity makerID FK "lender or borrower ID"
Entity takerID FK "lender or borrower ID"
}
Tags {
string name
string description
Tag parent FK
}
Entity }|--o{ Proposals : has
Entity }|..o{ Roles : has
Entity }|..o{ Authorizations : permisses
Entity }|..o{ Entity_Relationships : perceives
Entity ||--|| SocialProfile: socializes
Curations ||..|| Proposals : facilitated
Arbiter ||--|| File : policy
Arbiter ||--|| Entity : is
Entity }o..o{ Tags: categorized
Entity }|..o{ Authorizations: authorizes
Entity_Relationships }o..o{ Tags: categorized
Entity |o..o{ Bot_Config: user_configs
Entity |o..o{ Bot_Config: user_configs
Aggregations {
Entity source FK "Entity that data is being derived from - revenue = Spigot, debt = line/borrower, rates = Lender"
number data_timestamp_start "time that data being processed happened at"
number data_timestamp_end "the time until data is valid for Aggregation"
Entity bot FK "thing that did the scraping/calculations/etc for tracking"
number time_scraped "time that bot ran and added to db"
string metric "e.g. revenue_usd, dscr, lending_rate"
number one_day_avg_usd
number seven_day_avg_usd
number fourteen_day_avg_usd
number thirty_day_avg_usd
string asset_breakdown "csv of (token, %) e.g. 'DAI,80,ETH,20'"
string results "JSON.stringify "
}
Derivative_Aggeregations {
Aggregation derivative_agg
Aggregation base_agg "Data used for new aggregation e.g. RevAgg used for DebtAgg to calculate DSCR or a derivative based on orignal dataset"
}
Aggregations |o.-|{ Entity: analyzes
Derivative_Aggeregations }o..|| Aggregations: derives