Skip to content

Commit

Permalink
Add project bridge-validator
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelKim20 committed Mar 18, 2024
1 parent 5aeee55 commit c43ab37
Show file tree
Hide file tree
Showing 52 changed files with 5,998 additions and 47 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,17 @@ jobs:

runs-on: ${{ matrix.operating-system }}

services:
postgres:
image: postgres:14
env:
POSTGRES_USER: agora
POSTGRES_PASSWORD: 12345678
POSTGRES_DB: postgres
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5

strategy:
fail-fast: false
matrix:
Expand All @@ -31,3 +42,12 @@ jobs:
env:
REPORT_GAS: true
run: cd packages/contracts && yarn run test

- name: Copy env of Validator
run: cp packages/validator/env/.env.sample packages/validator/env/.env
- name: Check formatting of Validator
run: cd packages/validator && yarn run formatting:check
- name: Compile of Validator
run: cd packages/validator && yarn run build
- name: Run Hardhat Tests of Validator
run: cd packages/validator && yarn run test
19 changes: 19 additions & 0 deletions packages/validator/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
node_modules
artifacts
cache
coverage*
typechain-types
test
.git
.idea
.gitignore
.prettierignore
.prettierrc
.solhint.json
.solhintignore
docker-build.sh
docker-compose.yml
Dockerfile
LICENSE
README.md
tslint.json
142 changes: 142 additions & 0 deletions packages/validator/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
# Logs
logs/
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Snowpack dependency directory (https://snowpack.dev/)
web_modules/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional stylelint cache
.stylelintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local

# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache

# Next.js build output
.next
out

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# vuepress v2.x temp and cache directory
.temp
.cache

# Docusaurus cache and generated files
.docusaurus

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

# Stores VSCode versions used for testing VSCode extensions
.vscode-test

# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*

# WebStorm
.idea


typechain-types

#Hardhat files
cache
artifacts

9 changes: 9 additions & 0 deletions packages/validator/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
node_modules
artifacts
cache
coverage*
gasReporterOutput.json
typechain-types
.idea
env
docker
18 changes: 18 additions & 0 deletions packages/validator/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"arrowParens": "always",
"bracketSpacing": true,
"embeddedLanguageFormatting": "auto",
"htmlWhitespaceSensitivity": "css",
"insertPragma": false,
"jsxSingleQuote": false,
"printWidth": 120,
"proseWrap": "preserve",
"quoteProps": "as-needed",
"requirePragma": false,
"semi": true,
"singleQuote": false,
"tabWidth": 4,
"trailingComma": "es5",
"useTabs": false,
"vueIndentScriptAndStyle": false
}
7 changes: 7 additions & 0 deletions packages/validator/.solhint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "solhint:recommended",
"rules": {
"compiler-version": ["error", "^0.8.0"],
"func-visibility": ["warn", { "ignoreConstructors": true }]
}
}
1 change: 1 addition & 0 deletions packages/validator/.solhintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
13 changes: 13 additions & 0 deletions packages/validator/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM node:18-alpine

RUN apk add --update python3 g++ make yarn
RUN alias python=python3

WORKDIR /app/

ADD . /app/
COPY ./env/.env.sample /app/env/.env

RUN yarn install
RUN yarn run build
ENTRYPOINT [ "/app/docker/entrypoint.sh" ]
14 changes: 14 additions & 0 deletions packages/validator/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Copyright (c) 2023 BOSAGORA Foundation

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
1 change: 1 addition & 0 deletions packages/validator/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# bridge-validator
50 changes: 50 additions & 0 deletions packages/validator/config/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
################################################################################
## Network interface ##
################################################################################
server:
# Address to which we bind (default: 127.0.0.1)
address: "${HOST_IP}"
# Port on which we bind (default: 7070)
port: "${HOST_PORT}"

################################################################################
## Database options ##
################################################################################
database:
host: "${DATABASE_HOST}"
user: "${DATABASE_USER}"
password: "${DATABASE_PASSWORD}"
database: "${DATABASE_NAME}"
scheme: "${DATABASE_SCHEME}"
port: "${DATABASE_PORT}"
connectionTimeoutMillis: 5000
max: 100

################################################################################
## Logging options ##
################################################################################
logging:
# Values: error, warn, info, http, verbose, debug, silly
level: verbose

################################################################################
## Scheduler options ##
################################################################################
scheduler:
enable: true
items:
- name: bridge
enable: true
expression: "*/10 * * * * *"

bridge:
networkAContractAddress: "0x10Da82287982A7e3E718F9adE892a566F92C1Be2"
networkAName: "hardhat"
networkBContractAddress: "0x10Da82287982A7e3E718F9adE892a566F92C1Be2"
networkBName: "hardhat"
validators:
- "${BRIDGE_VALIDATOR1}"
- "${BRIDGE_VALIDATOR2}"
- "${BRIDGE_VALIDATOR3}"
- "${BRIDGE_VALIDATOR4}"
- "${BRIDGE_VALIDATOR5}"
50 changes: 50 additions & 0 deletions packages/validator/config/config_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
################################################################################
## Network interface ##
################################################################################
server:
# Address to which we bind (default: 127.0.0.1)
address: "${HOST_IP}"
# Port on which we bind (default: 7070)
port: 7501

################################################################################
## Database options ##
################################################################################
database:
host: "${DATABASE_HOST}"
user: "${DATABASE_USER}"
password: "${DATABASE_PASSWORD}"
database: "${DATABASE_NAME}"
scheme: "${DATABASE_SCHEME}"
port: "${DATABASE_PORT}"
connectionTimeoutMillis: 5000
max: 100

################################################################################
## Logging options ##
################################################################################
logging:
# Values: error, warn, info, http, verbose, debug, silly
level: verbose

################################################################################
## Scheduler options ##
################################################################################
scheduler:
enable: true
items:
- name: bridge
enable: true
expression: "*/10 * * * * *"

bridge:
networkAContractAddress: "0x10Da82287982A7e3E718F9adE892a566F92C1Be2"
networkAName: "hardhat"
networkBContractAddress: "0x10Da82287982A7e3E718F9adE892a566F92C1Be2"
networkBName: "hardhat"
validators:
- "${BRIDGE_VALIDATOR1}"
- "${BRIDGE_VALIDATOR2}"
- "${BRIDGE_VALIDATOR3}"
- "${BRIDGE_VALIDATOR4}"
- "${BRIDGE_VALIDATOR5}"
12 changes: 12 additions & 0 deletions packages/validator/contracts/Reference.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// SPDX-License-Identifier: AGPL-3.0-or-later

pragma solidity ^0.8.2;

import "loyalty-tokens/contracts/KIOS.sol";

import "dms-bridge-contracts/contracts/bridge/Bridge.sol";
import "dms-bridge-contracts/contracts/bridge/BridgeValidator.sol";
import "dms-bridge-contracts/contracts/interfaces/IBridge.sol";
import "dms-bridge-contracts/contracts/interfaces/IBridgeLiquidity.sol";
import "dms-bridge-contracts/contracts/interfaces/IBridgeValidator.sol";
import "loyalty-tokens/contracts/BIP20/BIP20DelegatedTransfer.sol";
Loading

0 comments on commit c43ab37

Please sign in to comment.