Skip to content

Commit dd618da

Browse files
committed
initial commit
0 parents  commit dd618da

File tree

115 files changed

+28486
-0
lines changed

Some content is hidden

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

115 files changed

+28486
-0
lines changed

.envrc_sample

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# There are many ways to manage TypeORM configurations.
2+
# Reference: https://github.com/typeorm/typeorm/blob/master/docs/using-ormconfig.md
3+
export TYPEORM_CONNECTION=postgres
4+
export TYPEORM_HOST=localhost
5+
export TYPEORM_USERNAME=terra
6+
export TYPEORM_PASSWORD=terra
7+
export TYPEORM_DATABASE=terra_fcd
8+
export TYPEORM_PORT=5432
9+
export TYPEORM_SYNCHRONIZE=false
10+
export TYPEORM_LOGGING=false
11+
export TYPEORM_ENTITIES=src/orm/*Entity.ts
12+
export TYPEORM_MIGRATIONS=src/orm/migration/*.ts
13+
14+
export SERVER_PORT=3060
15+
export CHAIN_ID=tequila-0004
16+
export LCD_URI=https://tequila-lcd.terra.dev
17+
export FCD_URI=https://tequila-fcd.terra.dev
18+
export RPC_URI=
19+
export MIRROR_GRAPH_URI=https://tequila-graph.mirror.finance/graphql
20+
export STATION_STATUS_JSON=https://terra.money/station/version-web.json
21+
export SENTRY_DSN=
22+
#export USE_LOG_FILE=true

.eslintrc.js

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
module.exports = {
2+
root: true,
3+
env: {
4+
browser: true,
5+
node: true,
6+
jasmine: true,
7+
},
8+
parser: '@typescript-eslint/parser',
9+
plugins: ['@typescript-eslint'],
10+
extends: [
11+
'eslint:recommended',
12+
'plugin:@typescript-eslint/eslint-recommended',
13+
'plugin:@typescript-eslint/recommended',
14+
],
15+
rules: {
16+
'@typescript-eslint/camelcase': 'off',
17+
'@typescript-eslint/no-namespace': 'off',
18+
'no-inner-declarations': 'off',
19+
// TODO: we have to figure out how to use eslint without below rules
20+
'@typescript-eslint/no-use-before-define': 'off',
21+
'@typescript-eslint/no-explicit-any': 'off',
22+
'@typescript-eslint/ban-ts-ignore': 'off',
23+
'@typescript-eslint/ban-ts-comment': 'off',
24+
'@typescript-eslint/no-var-requires': 'off',
25+
'@typescript-eslint/ban-types': 'off',
26+
'@typescript-eslint/explicit-module-boundary-types': 'off',
27+
},
28+
};

.github/workflows/codeql-analysis.yml

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# For most projects, this workflow file will not need changing; you simply need
2+
# to commit it to your repository.
3+
#
4+
# You may wish to alter this file to override the set of languages analyzed,
5+
# or to provide custom queries or build logic.
6+
#
7+
# ******** NOTE ********
8+
# We have attempted to detect the languages in your repository. Please check
9+
# the `language` matrix defined below to confirm you have the correct set of
10+
# supported CodeQL languages.
11+
#
12+
name: "CodeQL"
13+
14+
on:
15+
push:
16+
branches: [ main ]
17+
pull_request:
18+
# The branches below must be a subset of the branches above
19+
branches: [ main ]
20+
schedule:
21+
- cron: '38 0 * * 4'
22+
23+
jobs:
24+
analyze:
25+
name: Analyze
26+
runs-on: ubuntu-latest
27+
permissions:
28+
actions: read
29+
contents: read
30+
security-events: write
31+
32+
strategy:
33+
fail-fast: false
34+
matrix:
35+
language: [ 'javascript' ]
36+
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
37+
# Learn more:
38+
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
39+
40+
steps:
41+
- name: Checkout repository
42+
uses: actions/checkout@v2
43+
44+
# Initializes the CodeQL tools for scanning.
45+
- name: Initialize CodeQL
46+
uses: github/codeql-action/init@v1
47+
with:
48+
languages: ${{ matrix.language }}
49+
# If you wish to specify custom queries, you can do so here or in a config file.
50+
# By default, queries listed here will override any specified in a config file.
51+
# Prefix the list here with "+" to use these queries and those in the config file.
52+
# queries: ./path/to/local/query, your-org/your-repo/queries@main
53+
54+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
55+
# If this step fails, then you should remove it and run the build manually (see below)
56+
- name: Autobuild
57+
uses: github/codeql-action/autobuild@v1
58+
59+
# ℹ️ Command-line programs to run using the OS shell.
60+
# 📚 https://git.io/JvXDl
61+
62+
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
63+
# and modify them (or add more) to build your code if your project
64+
# uses a compiled language
65+
66+
#- run: |
67+
# make bootstrap
68+
# make release
69+
70+
- name: Perform CodeQL Analysis
71+
uses: github/codeql-action/analyze@v1

.github/workflows/default.yml

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: default
2+
3+
on:
4+
push:
5+
pull_request:
6+
branches:
7+
- master
8+
- develop
9+
10+
jobs:
11+
integration:
12+
runs-on: ubuntu-latest
13+
14+
container: "node:13"
15+
16+
steps:
17+
- uses: actions/checkout@v2
18+
19+
- name: Audit
20+
run: npm audit
21+
22+
delivery:
23+
runs-on: ubuntu-latest
24+
needs: integration
25+
26+
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
27+
28+
steps:
29+
- uses: actions/checkout@v2
30+
31+
- name: Set up Docker Buildx
32+
uses: docker/setup-buildx-action@v1
33+
34+
- name: Cache Docker layers
35+
uses: actions/cache@v2
36+
with:
37+
path: /tmp/.buildx-cache
38+
key: ${{ runner.os }}-buildx-${{ github.sha }}
39+
restore-keys: |
40+
${{ runner.os }}-buildx-
41+
42+
- name: Configure AWS credentials
43+
uses: aws-actions/configure-aws-credentials@v1
44+
with:
45+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }}
46+
aws-secret-access-key: ${{ secrets.AWS_SECRET_KEY }}
47+
aws-region: ap-northeast-2
48+
49+
- name: Login to Amazon ECR
50+
id: login-ecr
51+
uses: aws-actions/amazon-ecr-login@v1
52+
53+
- name: Login to DockerHub
54+
uses: docker/login-action@v1
55+
with:
56+
username: ${{ secrets.DOCKER_HUB_USERNAME }}
57+
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
58+
59+
- name: Build, tag, and push docker image to AWS ECR
60+
uses: docker/build-push-action@v2
61+
with:
62+
push: true
63+
tags: |
64+
${{ steps.login-ecr.outputs.registry }}/fcd:${{ github.sha }}
65+
${{ steps.login-ecr.outputs.registry }}/fcd:master
66+
${{ steps.login-ecr.outputs.registry }}/fcd:latest
67+
terramoney/fcd:latest
68+
cache-from: type=local,src=/tmp/.buildx-cache
69+
cache-to: type=local,dest=/tmp/.buildx-cache

.gitignore

+91
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
# macOS
2+
.DS_Store
3+
4+
# WebStorm
5+
.idea/
6+
7+
# Sublime
8+
*.sublime-*
9+
10+
# vscode
11+
.vscode/settings.json
12+
13+
# Logs
14+
logs
15+
*.log
16+
npm-debug.log*
17+
yarn-debug.log*
18+
yarn-error.log*
19+
20+
# Runtime data
21+
pids
22+
*.pid
23+
*.seed
24+
*.pid.lock
25+
26+
# Directory for instrumented libs generated by jscoverage/JSCover
27+
lib-cov
28+
29+
# Coverage directory used by tools like istanbul
30+
coverage
31+
32+
# nyc test coverage
33+
.nyc_output
34+
35+
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
36+
.grunt
37+
38+
# Bower dependency directory (https://bower.io/)
39+
bower_components
40+
41+
# node-waf configuration
42+
.lock-wscript
43+
44+
# Compiled binary addons (https://nodejs.org/api/addons.html)
45+
build/Release
46+
47+
# Dependency directories
48+
node_modules/
49+
jspm_packages/
50+
51+
# Optional npm cache directory
52+
.npm
53+
54+
# Optional eslint cache
55+
.eslintcache
56+
57+
# Optional REPL history
58+
.node_repl_history
59+
60+
# Output of 'npm pack'
61+
*.tgz
62+
63+
# Yarn Integrity file
64+
.yarn-integrity
65+
66+
# dotenv environment variables file
67+
.env
68+
69+
# SQLite databases
70+
*.sqlite
71+
72+
# DbSchema Project
73+
*.dbs
74+
*.dbs.bak
75+
76+
tmp/
77+
temp/
78+
dist/
79+
apidoc/
80+
static/
81+
ormlogs.log
82+
ormconfig*
83+
84+
public
85+
86+
#Jest coverage
87+
coverage/
88+
89+
logs/
90+
91+
.envrc

.husky/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
_

.husky/post-checkout

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
npm i

.husky/pre-commit

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
npx --no-install lint-staged

Dockerfile

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
FROM node:lts as builder
2+
3+
WORKDIR /app
4+
5+
COPY . .
6+
RUN npm ci
7+
8+
FROM node:lts-alpine
9+
10+
RUN apk add --no-cache tzdata
11+
12+
WORKDIR /app
13+
14+
COPY --from=builder /app/entrypoint.sh /app/package.json /app/package-lock.json /app/tsconfig.json ./
15+
COPY --from=builder /app/node_modules/ ./node_modules/
16+
COPY --from=builder /app/apidoc-template/ ./apidoc-template/
17+
COPY --from=builder /app/src/ ./src/
18+
19+
ENTRYPOINT [ "./entrypoint.sh" ]
20+
CMD [ "--help" ]

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2020-present, Terraform Labs PTE. LTD
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

0 commit comments

Comments
 (0)