Skip to content

Commit 66e3a61

Browse files
authored
Merge pull request #12 from yearn/metamerge
Metamerge
2 parents 23c902f + ac1568d commit 66e3a61

File tree

441 files changed

+21284
-203
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

441 files changed

+21284
-203
lines changed

.github/workflows/check.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Check Files
2+
on:
3+
push:
4+
branches:
5+
- master
6+
pull_request:
7+
branches:
8+
- master
9+
jobs:
10+
tests:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Check out github repository
14+
uses: actions/checkout@v2
15+
with:
16+
fetch-depth: 1
17+
18+
- name: Setup Python
19+
uses: actions/setup-python@v2
20+
with:
21+
python-version: "3.x"
22+
23+
- uses: actions/cache@v2
24+
with:
25+
path: ~/.cache/pip
26+
key: pip-${{ hashFiles('**/data/meta/_config/requirements.txt') }}
27+
restore-keys: |
28+
pip-
29+
- name: Install test dependencies
30+
run: pip install -r data/meta/_config/tests/requirements.txt
31+
32+
- name: Check address checksum
33+
run: python data/meta/_config/tests/check_checksum.py

.github/workflows/lint.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Validation
2+
on:
3+
push:
4+
branches:
5+
- master
6+
pull_request:
7+
jobs:
8+
lint:
9+
name: Lint data
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout repo
14+
uses: actions/checkout@v2
15+
16+
- name: Use Node 14.x
17+
uses: actions/setup-node@v1
18+
with:
19+
node-version: 14.x
20+
21+
- name: Install deps (with cache)
22+
uses: bahmutov/npm-install@v1
23+
24+
- name: Lint data
25+
run: |
26+
npm install -g prettier
27+
prettier --check ./data/meta/**/*.json
28+
29+
verify:
30+
name: Verify data
31+
runs-on: ubuntu-latest
32+
33+
steps:
34+
- name: Checkout repo
35+
uses: actions/checkout@v2
36+
37+
- name: Use Node 14.x
38+
uses: actions/setup-node@v1
39+
with:
40+
node-version: 14.x
41+
42+
- name: Install deps (with cache)
43+
uses: bahmutov/npm-install@v1
44+
45+
- name: Verify data
46+
run: node ./data/meta/_config/scripts/verify.mjs

.github/workflows/sync.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Deployment
2+
on:
3+
push:
4+
branches:
5+
- master
6+
jobs:
7+
sync:
8+
name: Verify and sync data to IPFS
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Checkout repo
13+
uses: actions/checkout@v2
14+
15+
- name: Use Node 14.x
16+
uses: actions/setup-node@v1
17+
with:
18+
node-version: 14.x
19+
20+
- name: Install deps (with cache)
21+
uses: bahmutov/npm-install@v1
22+
23+
- name: Verify data
24+
run: node ./data/meta/_config/scripts/verify.mjs
25+
26+
- name: Generate build artifact
27+
run: node ./data/meta/_config/scripts/build.mjs
28+
29+
- name: Upload to IPFS
30+
uses: aquiladev/ipfs-action@v0.3.0-alpha.1
31+
id: ipfs
32+
with:
33+
path: './build/'
34+
host: ${{ secrets.IPFS_HOST }}
35+
port: ${{ secrets.IPFS_PORT }}
36+
protocol: http
37+
38+
- name: Get Timestamp Action
39+
uses: nanzm/get-time-action@v1.1
40+
id: time
41+
with:
42+
format: 'YYYYMMDDHHmmss'
43+
44+
- name: Create Release
45+
uses: Hs1r1us/Release-AIO@v1.0
46+
env:
47+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
48+
with:
49+
tag_name: "${{ steps.time.outputs.time }}/${{ steps.ipfs.outputs.hash }}"
50+
release_name: ${{ steps.ipfs.outputs.hash }}
51+
body: '[ipfs://${{ steps.ipfs.outputs.hash }}](ipfs://${{ steps.ipfs.outputs.hash }}) - [ipfs.io](https://ipfs.io/ipfs/${{ steps.ipfs.outputs.hash }})'

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,5 @@ ystore
4545

4646
# build
4747
yDaemon
48+
build
49+
node_modules

.prettierignore

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# General
2+
.DS_STORE
3+
.prettierignore
4+
.gitignore
5+
.gitattributes
6+
.env
7+
.env.example
8+
9+
# JS
10+
node_modules
11+
yarn.lock
12+
api/*
13+
*.go
14+
*.sol

.prettierrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"tabWidth": 2,
3+
"printWidth": 80
4+
}

cmd/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313

1414
var chains = []uint64{1, 10, 250, 42161}
1515

16-
// var chains = []uint64{10}
16+
// var chains = []uint64{250}
1717

1818
func waitGroupSummonDaemons(wg *sync.WaitGroup, chainID uint64, delay time.Duration) {
1919
daemons.SummonDaemons(chainID, delay)

data/meta/_config/README.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Yearn metadata storage
2+
3+
[![Validation](https://github.com/yearn/ydaemon/workflows/Validation/badge.svg)](https://github.com/yearn/ydaemon/actions?query=workflow%3AValidation)
4+
[![Styled With Prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://prettier.io/)
5+
6+
## What?
7+
8+
This repo contains all the metadata of the yearn ecosystem. Contents of the
9+
[`meta`](./data/meta) directory are synced to IPFS for storage, accessible through
10+
our gateway [meta.yearn.network](https://meta.yearn.network). Consistency of
11+
the stored data is verified by smalls scripts and schemas.
12+
13+
## Adding documents
14+
15+
Any document can be added to the [`meta`](./data/meta) directory, but there are some
16+
special checks to ensure consistency and ease of accessibility:
17+
18+
- All JSON files that share names with the files in the [`schema`](./data/meta/_config/schema)
19+
directory must follow the defined schema, otherwise verification will fail.
20+
- Any folder that begins with `0x` is considered as an address. The address must
21+
be checksummed, otherwise verification will fail.
22+
- All files named `index.json` will be ignored by git and will be
23+
overwritten by the indexing process. (see [indexing](#indexes))
24+
25+
26+
## Adding schemas
27+
28+
Schemas can be created in the root of the [`schema`](./data/meta/_config/schema) folder. For
29+
syntax you can take a look at the [JSON schema specs](https://json-schema.org).
30+
The [AJV](https://github.com/ajv-validator/ajv) library is used to validate the
31+
data with the provided schemas.
32+
33+
## Syncing with IPFS
34+
35+
After each commit to main, direct or as a result of a merged pull request, a
36+
sync to IPFS is triggered.
37+
38+
## Indexes
39+
40+
Before each deployment the [`meta`](./data/meta) directory is scanned and an
41+
`index.json` file is generated inside each directory (root included). The file
42+
follows the [`index.json` schema](./data/meta/_config/schema/index.json) and will contain
43+
information about the files and folders stored in that directory. For an example
44+
see [meta.yearn.network/index.json](https://meta.yearn.network/json)
45+
46+
## Translations
47+
48+
Anything under protocols, strategies, and tokens are able to be translated. In the json files listed, we have locale codes and the English text to be translated. The name (if applicable) and description are what should be translated. If you dont see your locale code, make an issue and it will be added manually. To update new json's with the locale information run the python script `toLocale.py` located in the scripts folder.
49+
50+
## Helpful links
51+
52+
- 🌐 [Live site](https://yearn.network)
53+
- ⚖️ [Governance forum](https://gov.yearn.finance)
54+
- 📑 [Documentation](https://docs.yearn.finance)
55+
56+
## Contributing
57+
58+
Code style follows prettier conventions (`yarn format`). Commit messages follow [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/).
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"$id": "chain-settings.json",
4+
"title": "Chain Settings",
5+
"description": "Preferences about what services are available for a chain",
6+
"type": "object",
7+
"properties": {
8+
"simulationsEnabled": {
9+
"type": "boolean"
10+
},
11+
"zapsEnabled": {
12+
"type": "boolean"
13+
}
14+
},
15+
"required": ["simulationsEnabled", "zapsEnabled"]
16+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"$id": "index.json",
4+
"title": "Meta index",
5+
"description": "Filesystem index file",
6+
"type": "object",
7+
"properties": {
8+
"files": {
9+
"type": "array",
10+
"items": {
11+
"type": "string"
12+
}
13+
},
14+
"dirs": {
15+
"type": "array",
16+
"items": {
17+
"type": "string"
18+
}
19+
}
20+
},
21+
"required": ["files", "dirs"]
22+
}

0 commit comments

Comments
 (0)