@stabilitydao/host 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/npm.yml +19 -0
- package/.github/workflows/prettier.yml +25 -0
- package/.github/workflows/test.yml +29 -0
- package/.prettierignore +4 -0
- package/.prettierrc +1 -0
- package/LICENSE +674 -0
- package/README.md +35 -0
- package/jest.config.js +9 -0
- package/logo.png +0 -0
- package/out/index.js +30 -0
- package/package.json +28 -0
- package/src/activity/builder.ts +141 -0
- package/src/activity/index.ts +34 -0
- package/src/agents.ts +31 -0
- package/src/api.ts +51 -0
- package/src/assets.ts +1579 -0
- package/src/chains.ts +604 -0
- package/src/host.ts +1212 -0
- package/src/index.ts +36 -0
- package/src/storage/daoMetaData.ts +312 -0
- package/src/storage/daos.ts +306 -0
- package/src/tokenlist.json +1938 -0
- package/tests/assets.test.ts +61 -0
- package/tests/chains.test.ts +22 -0
- package/tests/host.test.ts +811 -0
- package/tsconfig.json +18 -0
package/README.md
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Host: A Cozy Home for DAOs
|
|
2
|
+
|
|
3
|
+
<p align="left">
|
|
4
|
+
<a href="https://dao.host">
|
|
5
|
+
<img src="/logo.png" title="Infrastructure layer for strategic DeFi Assets Management">
|
|
6
|
+
</a>
|
|
7
|
+
</p>
|
|
8
|
+
|
|
9
|
+
Unit Status: PROTOTYPE
|
|
10
|
+
|
|
11
|
+
**Host** is an Operating System of Self-developing Decentralized Autonomous Organizations.
|
|
12
|
+
|
|
13
|
+
This repository contains the core Host integration library and its typescript implementation.
|
|
14
|
+
|
|
15
|
+
## Library contents
|
|
16
|
+
|
|
17
|
+
- `src/api.ts` Host API types
|
|
18
|
+
- `src/host.ts` Host typescript implementation.
|
|
19
|
+
- `src/daos.ts` All deployed DAOs dump for apps.
|
|
20
|
+
- `src/chains.ts` Blockchain data.
|
|
21
|
+
- `src/tokenlist.json` Supported tokens.
|
|
22
|
+
- `src/assets.ts` Extended assets data (description, website, colors).
|
|
23
|
+
|
|
24
|
+
## Use
|
|
25
|
+
|
|
26
|
+
```shell
|
|
27
|
+
#coming soon
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Develop
|
|
31
|
+
|
|
32
|
+
```shell
|
|
33
|
+
yarn coverage
|
|
34
|
+
yarn prettier --write .
|
|
35
|
+
```
|
package/jest.config.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
preset: "ts-jest",
|
|
3
|
+
transform: { "^.+\\.ts?$": "ts-jest" },
|
|
4
|
+
testEnvironment: "node",
|
|
5
|
+
testRegex: "/tests/.*\\.(test|spec)?\\.(ts|tsx)$",
|
|
6
|
+
moduleFileExtensions: ["ts", "tsx", "js", "jsx", "json", "node"],
|
|
7
|
+
modulePathIgnorePatterns: ["out"],
|
|
8
|
+
collectCoverageFrom: ["src/**/*.ts"],
|
|
9
|
+
};
|
package/logo.png
ADDED
|
Binary file
|
package/out/index.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getDAOUnit = exports.daoMetaData = exports.daos = exports.UnitType = exports.UnitStatus = exports.Host = exports.LifecyclePhase = exports.Activity = exports.getAsset = exports.assets = exports.tokenlist = exports.getChainByName = exports.ChainStatus = exports.ChainName = exports.chainStatusInfo = exports.chains = void 0;
|
|
7
|
+
const chains_1 = require("./chains");
|
|
8
|
+
Object.defineProperty(exports, "chains", { enumerable: true, get: function () { return chains_1.chains; } });
|
|
9
|
+
Object.defineProperty(exports, "chainStatusInfo", { enumerable: true, get: function () { return chains_1.chainStatusInfo; } });
|
|
10
|
+
Object.defineProperty(exports, "ChainName", { enumerable: true, get: function () { return chains_1.ChainName; } });
|
|
11
|
+
Object.defineProperty(exports, "ChainStatus", { enumerable: true, get: function () { return chains_1.ChainStatus; } });
|
|
12
|
+
Object.defineProperty(exports, "getChainByName", { enumerable: true, get: function () { return chains_1.getChainByName; } });
|
|
13
|
+
const tokenlist_json_1 = __importDefault(require("./tokenlist.json"));
|
|
14
|
+
exports.tokenlist = tokenlist_json_1.default;
|
|
15
|
+
const assets_1 = require("./assets");
|
|
16
|
+
Object.defineProperty(exports, "assets", { enumerable: true, get: function () { return assets_1.assets; } });
|
|
17
|
+
Object.defineProperty(exports, "getAsset", { enumerable: true, get: function () { return assets_1.getAsset; } });
|
|
18
|
+
const activity_1 = require("./activity");
|
|
19
|
+
Object.defineProperty(exports, "Activity", { enumerable: true, get: function () { return activity_1.Activity; } });
|
|
20
|
+
const host_1 = require("./host");
|
|
21
|
+
Object.defineProperty(exports, "LifecyclePhase", { enumerable: true, get: function () { return host_1.LifecyclePhase; } });
|
|
22
|
+
Object.defineProperty(exports, "Host", { enumerable: true, get: function () { return host_1.Host; } });
|
|
23
|
+
Object.defineProperty(exports, "UnitStatus", { enumerable: true, get: function () { return host_1.UnitStatus; } });
|
|
24
|
+
Object.defineProperty(exports, "UnitType", { enumerable: true, get: function () { return host_1.UnitType; } });
|
|
25
|
+
Object.defineProperty(exports, "getDAOUnit", { enumerable: true, get: function () { return host_1.getDAOUnit; } });
|
|
26
|
+
const daos_1 = require("./storage/daos");
|
|
27
|
+
Object.defineProperty(exports, "daos", { enumerable: true, get: function () { return daos_1.daos; } });
|
|
28
|
+
const daoMetaData_1 = require("./storage/daoMetaData");
|
|
29
|
+
Object.defineProperty(exports, "daoMetaData", { enumerable: true, get: function () { return daoMetaData_1.daoMetaData; } });
|
|
30
|
+
//# sourceMappingURL=index.js.map
|
package/package.json
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@stabilitydao/host",
|
|
3
|
+
"version": "0.2.1",
|
|
4
|
+
"description": "Host library",
|
|
5
|
+
"main": "out/index.js",
|
|
6
|
+
"types": "out/index.d.ts",
|
|
7
|
+
"repository": "https://github.com/stabilitydao/host.git",
|
|
8
|
+
"author": "Host Dev",
|
|
9
|
+
"license": "GPL-3.0",
|
|
10
|
+
"private": false,
|
|
11
|
+
"scripts": {
|
|
12
|
+
"host": "ts-node tools/overview.ts",
|
|
13
|
+
"overview": "ts-node tools/overview.ts",
|
|
14
|
+
"build": "tsc",
|
|
15
|
+
"test": "jest",
|
|
16
|
+
"coverage": "jest --collect-coverage",
|
|
17
|
+
"postbuild": "shx cp src/tokenlist.json out/"
|
|
18
|
+
},
|
|
19
|
+
"devDependencies": {
|
|
20
|
+
"@types/jest": "^30.0.0",
|
|
21
|
+
"jest": "^30.2.0",
|
|
22
|
+
"prettier": "^3.7.4",
|
|
23
|
+
"shx": "^0.4.0",
|
|
24
|
+
"ts-jest": "^29.4.6",
|
|
25
|
+
"ts-node": "^10.9.2",
|
|
26
|
+
"typescript": "^5.9.3"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/**
|
|
2
|
+
BUILDER activity.
|
|
3
|
+
BUILDER is a team of engineers managed by DAOs.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { UnitComponentCategory } from "../host";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
BUILDER data.
|
|
10
|
+
|
|
11
|
+
@alpha
|
|
12
|
+
@interface
|
|
13
|
+
*/
|
|
14
|
+
export interface IBuilderActivity {
|
|
15
|
+
/** Safe multisig account of dev team */
|
|
16
|
+
multisig: string[];
|
|
17
|
+
/** Tracked Github repositories where development going on */
|
|
18
|
+
repo: string[];
|
|
19
|
+
/** Engineers */
|
|
20
|
+
workers: IWorker[];
|
|
21
|
+
/** Conveyors of unit components. */
|
|
22
|
+
conveyors: IConveyor[];
|
|
23
|
+
/** Pools of development tasks. */
|
|
24
|
+
pools: IPool[];
|
|
25
|
+
/** Total salaries paid */
|
|
26
|
+
burnRate: {
|
|
27
|
+
/** Period of burning. Can be 1 month or any other. */
|
|
28
|
+
period: string;
|
|
29
|
+
/** How much USD was spent during period. */
|
|
30
|
+
usdAmount: number;
|
|
31
|
+
}[];
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
Engineer hired by a DAO. Can be human or machine (AI agent).
|
|
36
|
+
|
|
37
|
+
@alpha
|
|
38
|
+
@interface
|
|
39
|
+
*/
|
|
40
|
+
export interface IWorker {
|
|
41
|
+
/** Github username */
|
|
42
|
+
github: string;
|
|
43
|
+
/** USD hourly rate */
|
|
44
|
+
rate?: number;
|
|
45
|
+
/** USD xTOKEN hourly rate */
|
|
46
|
+
xRate?: number;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Pool of development tasks. A set of open github issues.
|
|
51
|
+
* @interface
|
|
52
|
+
*/
|
|
53
|
+
export interface IPool {
|
|
54
|
+
/** Pool is always linked to a set of units. */
|
|
55
|
+
unitIds: string[];
|
|
56
|
+
/** Short name of the pool. */
|
|
57
|
+
name: string;
|
|
58
|
+
/** Label on github repositories identifying relation to the pool. */
|
|
59
|
+
label: IGithubLabel;
|
|
60
|
+
/** What need to be done by the pool? */
|
|
61
|
+
description?: string;
|
|
62
|
+
/** Each solved task in the pool must have an artifact of specified type. */
|
|
63
|
+
artifacts?: ArtifactType[];
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Conveyor belt for building a components for units.
|
|
68
|
+
* @interface
|
|
69
|
+
*/
|
|
70
|
+
export interface IConveyor {
|
|
71
|
+
/** Linked unit */
|
|
72
|
+
unitId: string;
|
|
73
|
+
componentCategory: UnitComponentCategory;
|
|
74
|
+
name: string;
|
|
75
|
+
symbol: string;
|
|
76
|
+
type: string;
|
|
77
|
+
label: IGithubLabel;
|
|
78
|
+
description: string;
|
|
79
|
+
issueTitleTemplate: string;
|
|
80
|
+
taskIdIs: string;
|
|
81
|
+
steps: IConveyorStep[];
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export interface IGithubLabel {
|
|
85
|
+
name: string;
|
|
86
|
+
description: string;
|
|
87
|
+
color: string;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export interface IGithubUser {
|
|
91
|
+
username: string;
|
|
92
|
+
img: string;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export interface IGithubIssue {
|
|
96
|
+
repo: string;
|
|
97
|
+
id: number;
|
|
98
|
+
title: string;
|
|
99
|
+
labels: IGithubLabel[];
|
|
100
|
+
assignees: IGithubUser;
|
|
101
|
+
body?: string;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export const enum ArtifactType {
|
|
105
|
+
URL_UI = "URL to UI page",
|
|
106
|
+
URL_RELEASE = "Github package release link",
|
|
107
|
+
DEPLOYMENT_ADDRESSES = "Deployment addresses",
|
|
108
|
+
URL_API = "API endpoint",
|
|
109
|
+
URL_STATIC = "Static content URL",
|
|
110
|
+
CONTRACT_ADDRESS = "Address of deployed contract",
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export interface IConveyorStep {
|
|
114
|
+
name: string;
|
|
115
|
+
issues: {
|
|
116
|
+
repo: string;
|
|
117
|
+
taskList?: string[];
|
|
118
|
+
issueTemplate?: string;
|
|
119
|
+
body?: string;
|
|
120
|
+
generator?: string;
|
|
121
|
+
}[];
|
|
122
|
+
artifacts?: ArtifactType[];
|
|
123
|
+
result?: string;
|
|
124
|
+
guide?: string;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export interface IBuildersMemory {
|
|
128
|
+
[tokenSymbol: string]: {
|
|
129
|
+
openIssues: {
|
|
130
|
+
total: { [repo: string]: number };
|
|
131
|
+
pools: { [poolName: string]: IGithubIssue[] };
|
|
132
|
+
};
|
|
133
|
+
conveyors: {
|
|
134
|
+
[conveyorName: string]: {
|
|
135
|
+
[taskId: string]: {
|
|
136
|
+
[stepName: string]: IGithubIssue[];
|
|
137
|
+
};
|
|
138
|
+
};
|
|
139
|
+
};
|
|
140
|
+
};
|
|
141
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { UnitType } from "../host";
|
|
2
|
+
|
|
3
|
+
/** Organization activities supported by OS. */
|
|
4
|
+
export enum Activity {
|
|
5
|
+
/** Owner of Decentralized Finance protocols */
|
|
6
|
+
DEFI = "DEFI",
|
|
7
|
+
/** Owner of Maximum Extractable Value tools */
|
|
8
|
+
MEV = "MEV",
|
|
9
|
+
/** BUILDER is a team of engineers managed by DAOs. */
|
|
10
|
+
BUILDER = "BUILDER",
|
|
11
|
+
/** Owner of Software as a Service business */
|
|
12
|
+
//SAAS_OPERATOR = "SAAS_OPERATOR",
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const activities: {
|
|
16
|
+
[activity in Activity]: {
|
|
17
|
+
title: string;
|
|
18
|
+
unitTypes: UnitType[];
|
|
19
|
+
description?: string;
|
|
20
|
+
};
|
|
21
|
+
} = {
|
|
22
|
+
[Activity.DEFI]: {
|
|
23
|
+
title: "Decentralized Finance Protocol Operator",
|
|
24
|
+
unitTypes: [UnitType.DEFI_PROTOCOL],
|
|
25
|
+
},
|
|
26
|
+
[Activity.MEV]: {
|
|
27
|
+
title: "Maximum Extractable Value tools",
|
|
28
|
+
unitTypes: [UnitType.MEV_SEARCHER],
|
|
29
|
+
},
|
|
30
|
+
[Activity.BUILDER]: {
|
|
31
|
+
title: "Team of engineers with multisig wallet.",
|
|
32
|
+
unitTypes: [],
|
|
33
|
+
},
|
|
34
|
+
};
|
package/src/agents.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Agent is highly abstract and high-level entity that follow role directives.
|
|
3
|
+
* Agents are owned by DAOs built on Host.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export interface IAgent {
|
|
7
|
+
api: string[];
|
|
8
|
+
roles: AgentRole[];
|
|
9
|
+
name: string;
|
|
10
|
+
directives?: string[];
|
|
11
|
+
image?: string;
|
|
12
|
+
telegram?: `@${string}`;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const enum AgentRole {
|
|
16
|
+
OPERATOR = "OPERATOR",
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface IAgentRuntime {
|
|
20
|
+
machineIDs: string[];
|
|
21
|
+
providers: {
|
|
22
|
+
name: string;
|
|
23
|
+
image: string;
|
|
24
|
+
queries: number;
|
|
25
|
+
}[];
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export const emptyRuntime: IAgentRuntime = {
|
|
29
|
+
machineIDs: [],
|
|
30
|
+
providers: [],
|
|
31
|
+
};
|
package/src/api.ts
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { IBuildersMemory } from "./activity/builder";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
Hot memory with indexed and aggregated data. OS API reply.
|
|
5
|
+
@interface
|
|
6
|
+
*/
|
|
7
|
+
export interface IOSMemory {
|
|
8
|
+
/** Prices of assets */
|
|
9
|
+
prices: Prices;
|
|
10
|
+
|
|
11
|
+
/** Total Value Locked in blockchains */
|
|
12
|
+
chainTvl: { [chainId: string]: number };
|
|
13
|
+
|
|
14
|
+
/** DAO runtime data. Updates each minute or faster. */
|
|
15
|
+
daos: {
|
|
16
|
+
[symbol: string]: IDAOAPIData;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
/** Instant Updates by subscribing to github application webhooks */
|
|
20
|
+
builders: IBuildersMemory;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface IDAOAPIData {
|
|
24
|
+
/** Price from Stability interchain oracle */
|
|
25
|
+
oraclePrice: string;
|
|
26
|
+
/** Coingecko price */
|
|
27
|
+
coingeckoPrice?: string;
|
|
28
|
+
/** Data for total revenue chart */
|
|
29
|
+
revenueChart: RevenueChart;
|
|
30
|
+
/** Extracted on-chain data */
|
|
31
|
+
onChainData: {
|
|
32
|
+
[chainId: string]: {
|
|
33
|
+
stakingAPR: number;
|
|
34
|
+
staked: number;
|
|
35
|
+
units: {
|
|
36
|
+
[unitId: string]: {
|
|
37
|
+
pendingRevenue: number;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export type Prices = {
|
|
45
|
+
[symbol: string]: {
|
|
46
|
+
price: string;
|
|
47
|
+
priceChange: number;
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export type RevenueChart = Record<number, string>;
|