Skip to content

Commit

Permalink
Merge pull request #64 from KenshiTech/v0.11.9
Browse files Browse the repository at this point in the history
V0.11.9
  • Loading branch information
pouya-eghbali authored Feb 24, 2024
2 parents 198903f + 07d1765 commit 4442a7e
Show file tree
Hide file tree
Showing 53 changed files with 6,567 additions and 413 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ node_modules
**/secrets.yaml
**/secrets.*.yaml
**/conf
docker/abi
**/context
**/.env
dist
**/data
Expand Down
28 changes: 19 additions & 9 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Parameters

Licensor: Kenshi
Licensed Work: Kenshi Unchained
The Licensed Work is (c) 2023 Kenshi.
The Licensed Work is (c) 2023-2024 Kenshi.
Additional Use Grant: You are granted the right to use the Licensed Work as-is,
exclusively on networks officially designated by Kenshi or
Unchained. This right is akin to the permissible use of
Expand All @@ -19,15 +19,25 @@ Additional Use Grant: You are granted the right to use the Licensed Work as-is,
research, personal network use, and academic purposes.
This clause is to facilitate access to the Licensed Work
for non-profit and developmental activities.


Additionally, entities with an annual revenue of less than
100,000 CHF are granted the right to operate the Licensed
Work on private networks for their internal business
operations free of charge. This concession is aimed at
supporting small businesses and startups in leveraging the
Licensed Work for their growth and innovation, without the
immediate financial burden of acquiring a commercial
license.

Operating the Licensed Work on private networks for
commercial purposes is prohibited unless a separate
commercial license is obtained from Kenshi. Commercial
purposes encompass any use involving monetary or other
forms of compensation, or as part of a commercial
offering or service. This restriction is to protect
Kenshi's commercial interests and ensure the Licensed
Work is appropriately licensed for commercial uses.
commercial purposes, outside of the aforementioned
exception, is prohibited unless a separate commercial
license is obtained from Kenshi. Commercial purposes
encompass any use involving monetary or other forms of
compensation, or as part of a commercial offering or
service. This restriction is to protect Kenshi's
commercial interests and ensure the Licensed Work is
appropriately licensed for commercial uses.

Change Date: Ten years from the date the Licensed Work is
published.
Expand Down
8 changes: 7 additions & 1 deletion conf.broker.yaml.template
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,26 @@ rpc:

plugins:
uniswap:
schedule:
ethereum: 5000

tokens:
- name: ethereum
chain: ethereum
pair: "0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640"
delta: 6
delta: 12
invert: true
unit: USDT

- name: arbitrum
chain: ethereum
pair: "0x59354356Ec5d56306791873f567d61EBf11dfbD5"
delta: 0
invert: false
unit: ETH

- name: bitcoin
chain: ethereum
pair: "0x9db9e0e53058c89e5b94e29621a205198648425b"
delta: 2
invert: false
Expand Down
8 changes: 7 additions & 1 deletion conf.remote.yaml.template
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,26 @@ rpc:

plugins:
uniswap:
schedule:
ethereum: 5000

tokens:
- name: ethereum
chain: ethereum
pair: "0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640"
delta: 6
delta: 12
invert: true
unit: USDT

- name: arbitrum
chain: ethereum
pair: "0x59354356Ec5d56306791873f567d61EBf11dfbD5"
delta: 0
invert: false
unit: ETH

- name: bitcoin
chain: ethereum
pair: "0x9db9e0e53058c89e5b94e29621a205198648425b"
delta: 2
invert: false
Expand Down
68 changes: 68 additions & 0 deletions conf.standalone.yaml.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
log: info
name: <name>

database:
url: postgres://<user>:<pass>@<host>:<port>/<db>?sslmode=disable

rpc:
ethereum:
- https://ethereum.publicnode.com
- https://eth.llamarpc.com
- wss://ethereum.publicnode.com
- https://eth.rpc.blxrbdn.com

arbitrum:
- https://arbitrum-one.publicnode.com
- https://arbitrum.llamarpc.com
- wss://arbitrum-one.publicnode.com
- https://arbitrum-one.public.blastapi.io

plugins:
logs:
schedule:
arbitrum: 100
ethereum: 5000

events:
- name: DAI
chain: ethereum
abi: ./abi/ERC20.json
event: Transfer
address: "0x6B175474E89094C44Da98b954EedeAC495271d0F"
from: 19271250
step: 8
confirmations: 8
store: true

uniswap:
schedule:
arbitrum: 100
ethereum: 5000

tokens:
- name: ethereum
chain: ethereum
pair: "0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640"
delta: 12
invert: true
unit: USDT
send: false
store: true

- name: arbitrum
chain: ethereum
pair: "0x59354356Ec5d56306791873f567d61EBf11dfbD5"
delta: 0
invert: false
unit: ETH
send: false
store: true

- name: bitcoin
chain: ethereum
pair: "0x9db9e0e53058c89e5b94e29621a205198648425b"
delta: 2
invert: false
unit: USDT
send: false
store: true
14 changes: 13 additions & 1 deletion conf.worker.yaml.template
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
log: info
name: <name>

broker:
uri: wss://shinobi.brokers.kenshi.io

rpc:
ethereum:
- https://ethereum.publicnode.com
Expand All @@ -10,21 +13,30 @@ rpc:

plugins:
uniswap:
schedule:
ethereum: 5000

tokens:
- name: ethereum
chain: ethereum
pair: "0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640"
delta: 6
delta: 12
invert: true
unit: USDT
send: true

- name: arbitrum
chain: ethereum
pair: "0x59354356Ec5d56306791873f567d61EBf11dfbD5"
delta: 0
invert: false
unit: ETH
send: true

- name: bitcoin
chain: ethereum
pair: "0x9db9e0e53058c89e5b94e29621a205198648425b"
delta: 2
invert: false
unit: USDT
send: true
49 changes: 34 additions & 15 deletions docker/compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,38 @@ services:
# profiles: ["broker"]
# restart: always

#postgres:
# image: postgres:16.1
# container_name: postgres
# hostname: postgres
# env_file:
# - .env
# volumes:
# - ./data:/var/lib/postgresql/data
# profiles: ["broker"]
# restart: always
# healthcheck:
# test: ["CMD-SHELL", "pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB"]
# interval: 10s
# timeout: 5s
# retries: 5
unchained_standalone:
image: ghcr.io/kenshitech/unchained:latest
container_name: unchained_standalone
hostname: unchained_standalone
volumes:
- ./conf:/app/conf
- ./abi:/app/abi
- ./context:/app/context
depends_on:
postgres:
condition: service_healthy
environment:
- UNCHAINED_NODE_TYPE=standalone
- UNCHAINED_CMD=worker
profiles: ["standalone"]
restart: always

postgres:
image: postgres:16.1
container_name: postgres
hostname: postgres
env_file:
- .env
volumes:
- ./data:/var/lib/postgresql/data
profiles: ["standalone"]
restart: always
healthcheck:
test: ["CMD-SHELL", "pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB"]
interval: 10s
timeout: 5s
retries: 5

#grafana:
# image: grafana/grafana-oss:latest
Expand All @@ -54,8 +71,10 @@ services:
hostname: unchained_worker
volumes:
- ./conf:/app/conf
- ./context:/app/context
environment:
- UNCHAINED_NODE_TYPE=worker
- UNCHAINED_CMD=worker
profiles: ["worker"]
restart: always

Expand Down
10 changes: 1 addition & 9 deletions docker/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,4 @@

echo "Running a $UNCHAINED_NODE_TYPE node."

#if [ $UNCHAINED_NODE_TYPE = "broker" ]; then
# unchained postgres migrate conf.yaml
# retVal=$?
# if [ $retVal -ne 0 ]; then
# exit $retVal
# fi
#fi

./unchained $UNCHAINED_NODE_TYPE -c conf/conf.$UNCHAINED_NODE_TYPE.yaml -s conf/secrets.$UNCHAINED_NODE_TYPE.yaml
./unchained $UNCHAINED_CMD -c conf/conf.$UNCHAINED_NODE_TYPE.yaml -s conf/secrets.$UNCHAINED_NODE_TYPE.yaml -x context/$UNCHAINED_NODE_TYPE
7 changes: 4 additions & 3 deletions docker/unchained.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ usage() {
echo "Usage: $0 [node] [options]"
echo "Node:"
#echo " broker - Manage unchained broker node"
#echo " remote - Manage unchained remote node"
echo " worker - Manage unchained worker node"
#echo " remote - Manage unchained remote node"
echo " worker - Manage unchained worker node"
echo " standalone - Manage unchained standalone node"
echo "Options:"
echo " Additional options passed directly to 'docker compose'"
echo "Examples:"
Expand All @@ -29,7 +30,7 @@ if ! docker compose version &>/dev/null; then
exit 1
fi

if [ ! $1 == 'worker' ]; then #&& [ ! $1 == 'remote' ] && [ ! $1 == 'lite' ] || [ -z $2 ]; then
if [ ! $1 == 'worker' ] && [ ! $1 == 'standalone' ]; then #&& [ ! $1 == 'remote' ] && [ ! $1 == 'lite' ] || [ -z $2 ]; then
usage
exit 1
fi
Expand Down
4 changes: 2 additions & 2 deletions go.work.sum
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ github.com/aws/aws-sdk-go-v2/service/sts v1.23.2/go.mod h1:Eows6e1uQEsc4ZaHANmsP
github.com/aws/smithy-go v1.15.0/go.mod h1:Tg+OJXh4MB2R/uN61Ko2f6hTZwB/ZYGOtib8J3gBHzA=
github.com/bits-and-blooms/bitset v1.7.0/go.mod h1:gIdJ4wp64HaoK2YrL1Q5/N7Y16edYb8uY+O0FJTyyDA=
github.com/btcsuite/btcd v0.20.1-beta h1:Ik4hyJqN8Jfyv3S4AGBOmyouMsYE3EdYODkMbQjwPGw=
github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko=
github.com/chromedp/cdproto v0.0.0-20230802225258-3cf4e6d46a89/go.mod h1:GKljq0VrfU4D5yc+2qA6OVr8pmO/MBbPEWqWQ/oqGEs=
github.com/chromedp/chromedp v0.9.2/go.mod h1:LkSXJKONWTCHAfQasKFUZI+mxqS4tZqhmtGzzhLsnLs=
github.com/chromedp/sysutil v1.0.0/go.mod h1:kgWmDdq8fTzXYcKIBqIYvRRTnYb9aNS9moAV0xufSww=
Expand All @@ -48,7 +49,6 @@ github.com/gobwas/httphead v0.1.0/go.mod h1:O/RXo79gxV8G+RqlR/otEwx4Q36zl9rqC5u1
github.com/gobwas/pool v0.2.1/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6WezmKEw=
github.com/gobwas/ws v1.2.1/go.mod h1:hRKAFb8wOxFROYNsT1bqfWnhX+b5MFeJM9r2ZSwg/KY=
github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I=
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU=
github.com/google/pprof v0.0.0-20230207041349-798e818bf904/go.mod h1:uglQLonpP8qtYCYyzA+8c/9qtqgA3qsXGYqCPKARAFg=
Expand Down Expand Up @@ -96,6 +96,7 @@ github.com/nats-io/nats.go v1.31.0/go.mod h1:di3Bm5MLsoB4Bx61CBTsxuarI36WbhAwOm8
github.com/nats-io/nkeys v0.4.6/go.mod h1:4DxZNzenSVd1cYQoAa8948QY3QDjrHfcfVADymtkpts=
github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c=
github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc=
github.com/peterh/liner v1.1.1-0.20190123174540-a2c9a5303de7/go.mod h1:CRroGNssyjTd/qIG2FyxByd2S8JEAZXBl4qUrZf8GS0=
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
github.com/pkg/sftp v1.13.6/go.mod h1:tz1ryNURKu77RL+GuCzmoJYxQczL3wLNNpPWagdg4Qk=
Expand All @@ -111,7 +112,6 @@ go.etcd.io/etcd/api/v3 v3.5.10/go.mod h1:TidfmT4Uycad3NM/o25fG3J07odo4GBB9hoxaod
go.etcd.io/etcd/client/pkg/v3 v3.5.10/go.mod h1:DYivfIviIuQ8+/lCq4vcxuseg2P2XbHygkKwFo9fc8U=
go.etcd.io/etcd/client/v2 v2.305.10/go.mod h1:m3CKZi69HzilhVqtPDcjhSGp+kA1OmbNn0qamH80xjA=
go.etcd.io/etcd/client/v3 v3.5.10/go.mod h1:RVeBnDz2PUEZqTpgqwAtUd8nAPf5kjyFyND7P1VkOKc=
go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo=
go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
go.uber.org/automaxprocs v1.5.2/go.mod h1:eRbA25aqJrxAbsLO0xy5jVwPt7FQnRgjW+efnwa1WM0=
go.uber.org/zap v1.21.0/go.mod h1:wjWOCqI0f2ZZrJF/UufIOkiC8ii6tm1iqIsLo76RfJw=
Expand Down
14 changes: 13 additions & 1 deletion quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,9 @@ config:
log: info
name: <name>

broker:
uri: wss://shinobi.brokers.kenshi.io

rpc:
ethereum:
- https://ethereum.publicnode.com
Expand All @@ -208,24 +211,33 @@ rpc:

plugins:
uniswap:
schedule:
ethereum: 5000

tokens:
- name: ethereum
chain: ethereum
pair: "0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640"
delta: 6
delta: 12
invert: true
unit: USDT
send: true

- name: arbitrum
chain: ethereum
pair: "0x59354356Ec5d56306791873f567d61EBf11dfbD5"
delta: 0
invert: false
unit: ETH
send: true

- name: bitcoin
chain: ethereum
pair: "0x9db9e0e53058c89e5b94e29621a205198648425b"
delta: 2
invert: false
unit: USDT
send: true
```
Save the above configuration in a file named `conf.yaml` on your system and make
Expand Down
Loading

0 comments on commit 4442a7e

Please sign in to comment.