diff --git a/.gitignore b/.gitignore index f7d985a..09b6670 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,5 @@ build/ contract/oracle.wasm contract/*.sh src/*.sh +oracleconf.py +lib/ diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..c256190 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,22 @@ +# build environment +FROM node:14.5.0-alpine + +## ENV variables +ENV PERM=active + +WORKDIR /app +ENV PATH /app/node_modules/.bin:$PATH +COPY scripts/package.json ./ +COPY scripts/package-lock.json ./ +COPY scripts/docker-updater.js ./updater.js +COPY scripts/docker.env .env + + +RUN npm ci --silent +RUN npm install react-scripts@3.4.1 -g --silent + + +# Entrypoint +ADD scripts/start.sh / +RUN chmod +x /start.sh +CMD /start.sh diff --git a/Dockerfile-python b/Dockerfile-python new file mode 100644 index 0000000..1ca4849 --- /dev/null +++ b/Dockerfile-python @@ -0,0 +1,24 @@ +# build environment +FROM node:14.5.0-alpine + +## ENV variables +ENV PERM=active + +RUN apk add --update-cache \ + python3 \ + py3-pip \ + && pip3 install eospyo preprocessing \ + && rm -rf /var/cache/apk/* + +WORKDIR /app +ENV PATH /app/node_modules/.bin:$PATH +COPY scripts/docker-updater.py ./updater.py +COPY scripts/docker-python.conf oracleconf.py + + + + +# Entrypoint +ADD scripts/python-start.sh / +RUN chmod +x /python-start.sh +CMD /python-start.sh diff --git a/README.md b/README.md index 37f5f2c..06a0f6f 100644 --- a/README.md +++ b/README.md @@ -208,3 +208,57 @@ if you have `jq` installed, you can show the first record, which should contain ``` cleos get table --limit 100 delphioracle eosusd datapoints |jq .rows[0] ``` + +# Running the updater.js using Docker +## :exclamation: Updater in docker uses EOSJS v2 + +## ENV Variables + +|ENV & ARG |Value |Description | +|--------------------------|-------------------------------|-----------------------------------------------| +|**PRIVATE_KEY** |`5xxxxxxxxxxxx` | The prviate key of your permission | +|**BPNAME** |`sentnlagents` | Your BP account | +|**PERM** |`oracle` | If using Custom permission; defaults to active| +|**API** |`https://hyperion6.sentnl.io"` | Wax API endpoint | +|**CHAIN** |`wax` | The EOSIO Chain that hosts the delphioracle | +|**APIPORT** |`443` | The port of API endpoint | +|**APIKEY** |`XXXXXXXXXXXXX` | API key to min-api.cryptocompare.com | + +## Build the production container for Javascript version + +``` +docker build https://github.com/ankh2054/delphioracle.git -t delphioracle +``` + +## Build the production container for Python version + +``` +git pull https://github.com/ankh2054/delphioracle.git +docker build -f Dockerfile-python -t delphioracle.python . +``` + +## Run the container passing required ENV variables + + +### The following ENV variables need to be passed: + + +- **APIKEY** - The API key for min-api.cryptocompare.com +- **BPNAME** - The name of your bp account +- **PERM** - The permissions to sign the transaction with. Defaults to active. +- **PRIVATE_KEY** - The private associated with your EOSIO account +- **API** - The API endpoint you wish to use. +- **CHAIN** - The EOSIO Chain that hosts the delphioracle. :exclamation: Currently only WAX and EOS is supported. + +```Dockerfile: +docker run --name delphioracle.wax \ +-d -e "PRIVATE_KEY=xxxxxxxxxxxxx" \ +-e "BPNAME=sentnlagents" \ +-e "PERM=oracle" \ +-e "API=https://hyperion6.sentnl.io" \ +-e "APIPORT=4343" \ +-e "CHAIN=wax" \ +-e "APIKEY=XXXXXXXXXXX" \ +delphioracle +``` + diff --git a/bin/activate b/bin/activate new file mode 100644 index 0000000..68d0b26 --- /dev/null +++ b/bin/activate @@ -0,0 +1,83 @@ +# This file must be used with "source bin/activate" *from bash* +# you cannot run it directly + + +if [ "${BASH_SOURCE-}" = "$0" ]; then + echo "You must source this script: \$ source $0" >&2 + exit 33 +fi + +deactivate () { + unset -f pydoc >/dev/null 2>&1 || true + + # reset old environment variables + # ! [ -z ${VAR+_} ] returns true if VAR is declared at all + if ! [ -z "${_OLD_VIRTUAL_PATH:+_}" ] ; then + PATH="$_OLD_VIRTUAL_PATH" + export PATH + unset _OLD_VIRTUAL_PATH + fi + if ! [ -z "${_OLD_VIRTUAL_PYTHONHOME+_}" ] ; then + PYTHONHOME="$_OLD_VIRTUAL_PYTHONHOME" + export PYTHONHOME + unset _OLD_VIRTUAL_PYTHONHOME + fi + + # The hash command must be called to get it to forget past + # commands. Without forgetting past commands the $PATH changes + # we made may not be respected + hash -r 2>/dev/null + + if ! [ -z "${_OLD_VIRTUAL_PS1+_}" ] ; then + PS1="$_OLD_VIRTUAL_PS1" + export PS1 + unset _OLD_VIRTUAL_PS1 + fi + + unset VIRTUAL_ENV + if [ ! "${1-}" = "nondestructive" ] ; then + # Self destruct! + unset -f deactivate + fi +} + +# unset irrelevant variables +deactivate nondestructive + +VIRTUAL_ENV='/Users/charlesholtzkampf/sentnl/delphioracle' +if ([ "$OSTYPE" = "cygwin" ] || [ "$OSTYPE" = "msys" ]) && $(command -v cygpath &> /dev/null) ; then + VIRTUAL_ENV=$(cygpath -u "$VIRTUAL_ENV") +fi +export VIRTUAL_ENV + +_OLD_VIRTUAL_PATH="$PATH" +PATH="$VIRTUAL_ENV/bin:$PATH" +export PATH + +# unset PYTHONHOME if set +if ! [ -z "${PYTHONHOME+_}" ] ; then + _OLD_VIRTUAL_PYTHONHOME="$PYTHONHOME" + unset PYTHONHOME +fi + +if [ -z "${VIRTUAL_ENV_DISABLE_PROMPT-}" ] ; then + _OLD_VIRTUAL_PS1="${PS1-}" + if [ "x" != x ] ; then + PS1="() ${PS1-}" + else + PS1="(`basename \"$VIRTUAL_ENV\"`) ${PS1-}" + fi + export PS1 +fi + +# Make sure to unalias pydoc if it's already there +alias pydoc 2>/dev/null >/dev/null && unalias pydoc || true + +pydoc () { + python -m pydoc "$@" +} + +# The hash command must be called to get it to forget past +# commands. Without forgetting past commands the $PATH changes +# we made may not be respected +hash -r 2>/dev/null diff --git a/bin/activate.csh b/bin/activate.csh new file mode 100644 index 0000000..1056660 --- /dev/null +++ b/bin/activate.csh @@ -0,0 +1,55 @@ +# This file must be used with "source bin/activate.csh" *from csh*. +# You cannot run it directly. +# Created by Davide Di Blasi . + +set newline='\ +' + +alias deactivate 'test $?_OLD_VIRTUAL_PATH != 0 && setenv PATH "$_OLD_VIRTUAL_PATH:q" && unset _OLD_VIRTUAL_PATH; rehash; test $?_OLD_VIRTUAL_PROMPT != 0 && set prompt="$_OLD_VIRTUAL_PROMPT:q" && unset _OLD_VIRTUAL_PROMPT; unsetenv VIRTUAL_ENV; test "\!:*" != "nondestructive" && unalias deactivate && unalias pydoc' + +# Unset irrelevant variables. +deactivate nondestructive + +setenv VIRTUAL_ENV '/Users/charlesholtzkampf/sentnl/delphioracle' + +set _OLD_VIRTUAL_PATH="$PATH:q" +setenv PATH "$VIRTUAL_ENV:q/bin:$PATH:q" + + + +if ('' != "") then + set env_name = '() ' +else + set env_name = '('"$VIRTUAL_ENV:t:q"') ' +endif + +if ( $?VIRTUAL_ENV_DISABLE_PROMPT ) then + if ( $VIRTUAL_ENV_DISABLE_PROMPT == "" ) then + set do_prompt = "1" + else + set do_prompt = "0" + endif +else + set do_prompt = "1" +endif + +if ( $do_prompt == "1" ) then + # Could be in a non-interactive environment, + # in which case, $prompt is undefined and we wouldn't + # care about the prompt anyway. + if ( $?prompt ) then + set _OLD_VIRTUAL_PROMPT="$prompt:q" + if ( "$prompt:q" =~ *"$newline:q"* ) then + : + else + set prompt = "$env_name:q$prompt:q" + endif + endif +endif + +unset env_name +unset do_prompt + +alias pydoc python -m pydoc + +rehash diff --git a/bin/activate.fish b/bin/activate.fish new file mode 100644 index 0000000..b65855e --- /dev/null +++ b/bin/activate.fish @@ -0,0 +1,100 @@ +# This file must be used using `source bin/activate.fish` *within a running fish ( http://fishshell.com ) session*. +# Do not run it directly. + +function _bashify_path -d "Converts a fish path to something bash can recognize" + set fishy_path $argv + set bashy_path $fishy_path[1] + for path_part in $fishy_path[2..-1] + set bashy_path "$bashy_path:$path_part" + end + echo $bashy_path +end + +function _fishify_path -d "Converts a bash path to something fish can recognize" + echo $argv | tr ':' '\n' +end + +function deactivate -d 'Exit virtualenv mode and return to the normal environment.' + # reset old environment variables + if test -n "$_OLD_VIRTUAL_PATH" + # https://github.com/fish-shell/fish-shell/issues/436 altered PATH handling + if test (echo $FISH_VERSION | head -c 1) -lt 3 + set -gx PATH (_fishify_path "$_OLD_VIRTUAL_PATH") + else + set -gx PATH $_OLD_VIRTUAL_PATH + end + set -e _OLD_VIRTUAL_PATH + end + + if test -n "$_OLD_VIRTUAL_PYTHONHOME" + set -gx PYTHONHOME "$_OLD_VIRTUAL_PYTHONHOME" + set -e _OLD_VIRTUAL_PYTHONHOME + end + + if test -n "$_OLD_FISH_PROMPT_OVERRIDE" + and functions -q _old_fish_prompt + # Set an empty local `$fish_function_path` to allow the removal of `fish_prompt` using `functions -e`. + set -l fish_function_path + + # Erase virtualenv's `fish_prompt` and restore the original. + functions -e fish_prompt + functions -c _old_fish_prompt fish_prompt + functions -e _old_fish_prompt + set -e _OLD_FISH_PROMPT_OVERRIDE + end + + set -e VIRTUAL_ENV + + if test "$argv[1]" != 'nondestructive' + # Self-destruct! + functions -e pydoc + functions -e deactivate + functions -e _bashify_path + functions -e _fishify_path + end +end + +# Unset irrelevant variables. +deactivate nondestructive + +set -gx VIRTUAL_ENV '/Users/charlesholtzkampf/sentnl/delphioracle' + +# https://github.com/fish-shell/fish-shell/issues/436 altered PATH handling +if test (echo $FISH_VERSION | head -c 1) -lt 3 + set -gx _OLD_VIRTUAL_PATH (_bashify_path $PATH) +else + set -gx _OLD_VIRTUAL_PATH $PATH +end +set -gx PATH "$VIRTUAL_ENV"'/bin' $PATH + +# Unset `$PYTHONHOME` if set. +if set -q PYTHONHOME + set -gx _OLD_VIRTUAL_PYTHONHOME $PYTHONHOME + set -e PYTHONHOME +end + +function pydoc + python -m pydoc $argv +end + +if test -z "$VIRTUAL_ENV_DISABLE_PROMPT" + # Copy the current `fish_prompt` function as `_old_fish_prompt`. + functions -c fish_prompt _old_fish_prompt + + function fish_prompt + # Run the user's prompt first; it might depend on (pipe)status. + set -l prompt (_old_fish_prompt) + + # Prompt override provided? + # If not, just prepend the environment name. + if test -n '' + printf '(%s) ' '' + else + printf '(%s) ' (basename "$VIRTUAL_ENV") + end + + string join -- \n $prompt # handle multi-line prompts + end + + set -gx _OLD_FISH_PROMPT_OVERRIDE "$VIRTUAL_ENV" +end diff --git a/bin/activate.nu b/bin/activate.nu new file mode 100644 index 0000000..4919638 --- /dev/null +++ b/bin/activate.nu @@ -0,0 +1,117 @@ +# virtualenv activation module +# Activate with `overlay use activate.nu` +# Deactivate with `deactivate`, as usual +# +# To customize the overlay name, you can call `overlay use activate.nu as foo`, +# but then simply `deactivate` won't work because it is just an alias to hide +# the "activate" overlay. You'd need to call `overlay hide foo` manually. + +export-env { + def is-string [x] { + ($x | describe) == 'string' + } + + def has-env [name: string] { + $name in (env).name + } + + # Emulates a `test -z`, but btter as it handles e.g 'false' + def is-env-true [name: string] { + if (has-env $name) { + # Try to parse 'true', '0', '1', and fail if not convertible + let parsed = do -i { $env | get $name | into bool } + if ($parsed | describe) == 'bool' { + $parsed + } else { + not ($env | get $name | is-empty) + } + } else { + false + } + } + + let is_windows = ($nu.os-info.name | str downcase) == 'windows' + let virtual_env = '/Users/charlesholtzkampf/sentnl/delphioracle' + let bin = 'bin' + let path_sep = (char esep) + let path_name = if $is_windows { + if (has-env 'Path') { + 'Path' + } else { + 'PATH' + } + } else { + 'PATH' + } + + let old_path = ( + if $is_windows { + if (has-env 'Path') { + $env.Path + } else { + $env.PATH + } + } else { + $env.PATH + } | if (is-string $in) { + # if Path/PATH is a string, make it a list + $in | split row $path_sep | path expand + } else { + $in + } + ) + + let venv_path = ([$virtual_env $bin] | path join) + let new_path = ($old_path | prepend $venv_path | str collect $path_sep) + + let new_env = { + $path_name : $new_path + VIRTUAL_ENV : $virtual_env + } + + let new_env = if (is-env-true 'VIRTUAL_ENV_DISABLE_PROMPT') { + $new_env + } else { + # Creating the new prompt for the session + let virtual_prompt = if ('' == '') { + $'(char lparen)($virtual_env | path basename)(char rparen) ' + } else { + '() ' + } + + # Back up the old prompt builder + let old_prompt_command = if (has-env 'VIRTUAL_ENV') and (has-env '_OLD_PROMPT_COMMAND') { + $env._OLD_PROMPT_COMMAND + } else { + if (has-env 'PROMPT_COMMAND') { + $env.PROMPT_COMMAND + } else { + '' + } + } + + # If there is no default prompt, then only the env is printed in the prompt + let new_prompt = if (has-env 'PROMPT_COMMAND') { + if ($old_prompt_command | describe) == 'block' { + { $'($virtual_prompt)(do $old_prompt_command)' } + } else { + { $'($virtual_prompt)($old_prompt_command)' } + } + } else { + { $'($virtual_prompt)' } + } + + $new_env | merge { + _OLD_VIRTUAL_PATH : ($old_path | str collect $path_sep) + _OLD_PROMPT_COMMAND : $old_prompt_command + PROMPT_COMMAND : $new_prompt + VIRTUAL_PROMPT : $virtual_prompt + } + } + + # Environment variables that will be loaded as the virtual env + load-env $new_env +} + +export alias pydoc = python -m pydoc +export alias deactivate = overlay hide activate diff --git a/bin/activate.ps1 b/bin/activate.ps1 new file mode 100644 index 0000000..04c2472 --- /dev/null +++ b/bin/activate.ps1 @@ -0,0 +1,60 @@ +$script:THIS_PATH = $myinvocation.mycommand.path +$script:BASE_DIR = Split-Path (Resolve-Path "$THIS_PATH/..") -Parent + +function global:deactivate([switch] $NonDestructive) { + if (Test-Path variable:_OLD_VIRTUAL_PATH) { + $env:PATH = $variable:_OLD_VIRTUAL_PATH + Remove-Variable "_OLD_VIRTUAL_PATH" -Scope global + } + + if (Test-Path function:_old_virtual_prompt) { + $function:prompt = $function:_old_virtual_prompt + Remove-Item function:\_old_virtual_prompt + } + + if ($env:VIRTUAL_ENV) { + Remove-Item env:VIRTUAL_ENV -ErrorAction SilentlyContinue + } + + if (!$NonDestructive) { + # Self destruct! + Remove-Item function:deactivate + Remove-Item function:pydoc + } +} + +function global:pydoc { + python -m pydoc $args +} + +# unset irrelevant variables +deactivate -nondestructive + +$VIRTUAL_ENV = $BASE_DIR +$env:VIRTUAL_ENV = $VIRTUAL_ENV + +New-Variable -Scope global -Name _OLD_VIRTUAL_PATH -Value $env:PATH + +$env:PATH = "$env:VIRTUAL_ENV/bin:" + $env:PATH +if (!$env:VIRTUAL_ENV_DISABLE_PROMPT) { + function global:_old_virtual_prompt { + "" + } + $function:_old_virtual_prompt = $function:prompt + + if ("" -ne "") { + function global:prompt { + # Add the custom prefix to the existing prompt + $previous_prompt_value = & $function:_old_virtual_prompt + ("() " + $previous_prompt_value) + } + } + else { + function global:prompt { + # Add a prefix to the current prompt, but don't discard it. + $previous_prompt_value = & $function:_old_virtual_prompt + $new_prompt_value = "($( Split-Path $env:VIRTUAL_ENV -Leaf )) " + ($new_prompt_value + $previous_prompt_value) + } + } +} diff --git a/bin/activate_this.py b/bin/activate_this.py new file mode 100644 index 0000000..bb4beb0 --- /dev/null +++ b/bin/activate_this.py @@ -0,0 +1,31 @@ +"""Activate virtualenv for current interpreter: + +Use exec(open(this_file).read(), {'__file__': this_file}). + +This can be used when you must use an existing Python interpreter, not the virtualenv bin/python. +""" +import os +import site +import sys + +try: + abs_file = os.path.abspath(__file__) +except NameError: + raise AssertionError("You must use exec(open(this_file).read(), {'__file__': this_file}))") + +bin_dir = os.path.dirname(abs_file) +base = bin_dir[: -len("bin") - 1] # strip away the bin part from the __file__, plus the path separator + +# prepend bin to PATH (this file is inside the bin directory) +os.environ["PATH"] = os.pathsep.join([bin_dir] + os.environ.get("PATH", "").split(os.pathsep)) +os.environ["VIRTUAL_ENV"] = base # virtual env is right above bin directory + +# add the virtual environments libraries to the host python import mechanism +prev_length = len(sys.path) +for lib in "../lib/python3.11/site-packages".split(os.pathsep): + path = os.path.realpath(os.path.join(bin_dir, lib)) + site.addsitedir(path.decode("utf-8") if "" else path) +sys.path[:] = sys.path[prev_length:] + sys.path[0:prev_length] + +sys.real_prefix = sys.prefix +sys.prefix = base diff --git a/bin/base58 b/bin/base58 new file mode 100755 index 0000000..6944f92 --- /dev/null +++ b/bin/base58 @@ -0,0 +1,8 @@ +#!/Users/charlesholtzkampf/sentnl/delphioracle/bin/python +# -*- coding: utf-8 -*- +import re +import sys +from base58.__main__ import main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/bin/cryptotool b/bin/cryptotool new file mode 100644 index 0000000..4f40101 --- /dev/null +++ b/bin/cryptotool @@ -0,0 +1,60 @@ +#!/usr/bin/python +from cryptos import * +import json + +coins = { + 'bch': BitcoinCash, + 'btc': Bitcoin, + 'dash': Dash, + 'doge': Doge, + 'ltc': Litecoin +} + +if len(sys.argv) == 1: + print("pybtctool ...") +else: + coin = Bitcoin + testnet = False + cmdargs, preargs, kwargs = [], [], {} + i = 2 + # Process first arg tag + if sys.argv[1] == '-s': + preargs.extend(re.findall(r'\S\S*', sys.stdin.read())) + elif sys.argv[1] == '-B': + preargs.extend([sys.stdin.read()]) + elif sys.argv[1] == '-b': + preargs.extend([sys.stdin.read()[:-1]]) + elif sys.argv[1] == '-j': + preargs.extend([json.loads(sys.stdin.read())]) + elif sys.argv[1] == '-J': + preargs.extend(json.loads(sys.stdin.read())) + else: + i = 1 + while i < len(sys.argv): + if sys.argv[i] == '--testnet': + testnet = True + i += 1 + elif sys.argv[i] == '--coin': + coinname = sys.argv[i+1].lower() + try: + coin = coins[coinname] + except KeyError: + raise Exception('Coin %s not recognised. Choose from: %s ' % (coin, ','.join(coins.keys()))) + i += 2 + elif sys.argv[i][:2] == '--': + kwargs[sys.argv[i][2:]] = sys.argv[i+1] + i += 2 + else: + cmdargs.append(sys.argv[i]) + i += 1 + cmd = cmdargs[0] + args = preargs + cmdargs[1:] + try: + c = coin(testnet=testnet) + o = getattr(c, cmd)(*args, **kwargs) + except AttributeError: + o = vars()[cmd](*args, **kwargs) + if isinstance(o, (list, dict)): + print(json.dumps(o)) + else: + print(o) diff --git a/bin/demo b/bin/demo new file mode 100755 index 0000000..d936be8 --- /dev/null +++ b/bin/demo @@ -0,0 +1,40 @@ +#!/Users/charlesholtzkampf/sentnl/delphioracle/bin/python +''' +Demo console script exemplifying use of the preprocessing package +''' + + +from preprocessing.text import (convert_html_entities, keyword_tokenize, lowercase, + preprocess_text, remove_esc_chars, remove_numbers, + remove_unbound_punct, remove_urls) + + +def main(): + ''' + Demo function applying the preprocessing package + ''' + + text_list = ["this text is a test comprised of keywords & stopwords.", + "it is comprised of .. punctuation artifacts AND CAPITAL LETTERS", + "sometimes it\nhas escape\ncharacters as well. 2017 don't forget", + "I can include urls like https://example.com", + "../?>? .../,,,"] + + print("using, in order: convert_html_entities, lowercase, remove_esc_chars, remove_numbers, " + "remove_urls, remove_unbound_punct and keyword_tokenize...\n") + + for text_string in text_list: + print("raw text:", repr(text_string)) + print("clean text:", repr(preprocess_text(text_string, [ + convert_html_entities, + lowercase, + remove_esc_chars, + remove_numbers, + remove_urls, + remove_unbound_punct, + keyword_tokenize + ])), "\n") + + +if __name__ == "__main__": + main() diff --git a/bin/httpx b/bin/httpx new file mode 100755 index 0000000..0cfbc6b --- /dev/null +++ b/bin/httpx @@ -0,0 +1,8 @@ +#!/Users/charlesholtzkampf/sentnl/delphioracle/bin/python +# -*- coding: utf-8 -*- +import re +import sys +from httpx import main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/bin/normalizer b/bin/normalizer new file mode 100755 index 0000000..cb0dc2e --- /dev/null +++ b/bin/normalizer @@ -0,0 +1,8 @@ +#!/Users/charlesholtzkampf/sentnl/delphioracle/bin/python +# -*- coding: utf-8 -*- +import re +import sys +from charset_normalizer.cli.normalizer import cli_detect +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(cli_detect()) diff --git a/bin/pip b/bin/pip new file mode 100755 index 0000000..8801b4a --- /dev/null +++ b/bin/pip @@ -0,0 +1,8 @@ +#!/Users/charlesholtzkampf/sentnl/delphioracle/bin/python +# -*- coding: utf-8 -*- +import re +import sys +from pip._internal.cli.main import main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/bin/pip-3.11 b/bin/pip-3.11 new file mode 100755 index 0000000..8801b4a --- /dev/null +++ b/bin/pip-3.11 @@ -0,0 +1,8 @@ +#!/Users/charlesholtzkampf/sentnl/delphioracle/bin/python +# -*- coding: utf-8 -*- +import re +import sys +from pip._internal.cli.main import main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/bin/pip3 b/bin/pip3 new file mode 100755 index 0000000..8801b4a --- /dev/null +++ b/bin/pip3 @@ -0,0 +1,8 @@ +#!/Users/charlesholtzkampf/sentnl/delphioracle/bin/python +# -*- coding: utf-8 -*- +import re +import sys +from pip._internal.cli.main import main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/bin/pip3.11 b/bin/pip3.11 new file mode 100755 index 0000000..8801b4a --- /dev/null +++ b/bin/pip3.11 @@ -0,0 +1,8 @@ +#!/Users/charlesholtzkampf/sentnl/delphioracle/bin/python +# -*- coding: utf-8 -*- +import re +import sys +from pip._internal.cli.main import main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/bin/python b/bin/python new file mode 120000 index 0000000..79ab74b --- /dev/null +++ b/bin/python @@ -0,0 +1 @@ +/usr/local/bin/python3 \ No newline at end of file diff --git a/bin/python3 b/bin/python3 new file mode 120000 index 0000000..d8654aa --- /dev/null +++ b/bin/python3 @@ -0,0 +1 @@ +python \ No newline at end of file diff --git a/bin/python3.11 b/bin/python3.11 new file mode 120000 index 0000000..d8654aa --- /dev/null +++ b/bin/python3.11 @@ -0,0 +1 @@ +python \ No newline at end of file diff --git a/bin/wheel b/bin/wheel new file mode 100755 index 0000000..53cf6a1 --- /dev/null +++ b/bin/wheel @@ -0,0 +1,8 @@ +#!/Users/charlesholtzkampf/sentnl/delphioracle/bin/python +# -*- coding: utf-8 -*- +import re +import sys +from wheel.cli import main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/bin/wheel-3.11 b/bin/wheel-3.11 new file mode 100755 index 0000000..53cf6a1 --- /dev/null +++ b/bin/wheel-3.11 @@ -0,0 +1,8 @@ +#!/Users/charlesholtzkampf/sentnl/delphioracle/bin/python +# -*- coding: utf-8 -*- +import re +import sys +from wheel.cli import main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/bin/wheel3 b/bin/wheel3 new file mode 100755 index 0000000..53cf6a1 --- /dev/null +++ b/bin/wheel3 @@ -0,0 +1,8 @@ +#!/Users/charlesholtzkampf/sentnl/delphioracle/bin/python +# -*- coding: utf-8 -*- +import re +import sys +from wheel.cli import main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/bin/wheel3.11 b/bin/wheel3.11 new file mode 100755 index 0000000..53cf6a1 --- /dev/null +++ b/bin/wheel3.11 @@ -0,0 +1,8 @@ +#!/Users/charlesholtzkampf/sentnl/delphioracle/bin/python +# -*- coding: utf-8 -*- +import re +import sys +from wheel.cli import main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/build/.gitkeep b/build/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/pyvenv.cfg b/pyvenv.cfg new file mode 100644 index 0000000..2a50948 --- /dev/null +++ b/pyvenv.cfg @@ -0,0 +1,8 @@ +home = /usr/local/bin +implementation = CPython +version_info = 3.11.2.final.0 +virtualenv = 20.17.1 +include-system-site-packages = false +base-prefix = /Library/Frameworks/Python.framework/Versions/3.11 +base-exec-prefix = /Library/Frameworks/Python.framework/Versions/3.11 +base-executable = /usr/local/bin/python3 diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..05a6b3c --- /dev/null +++ b/requirements.txt @@ -0,0 +1,21 @@ +anyio==3.5.0 +base58==2.1.1 +certifi==2021.10.8 +charset-normalizer==2.0.12 +cryptos==1.36 +eospyo==0.5.4 +h11==0.12.0 +httpcore==0.14.7 +httpx==0.21.3 +idna==3.3 +nltk==3.2.4 +preprocessing==0.1.13 +pydantic==1.9.0 +requests==2.27.1 +rfc3986==1.5.0 +six==1.16.0 +sniffio==1.2.0 +sphinx-rtd-theme==0.2.4 +typing-extensions==4.2.0 +ueosio==0.2.6 +urllib3==1.26.9 \ No newline at end of file diff --git a/scripts/__pycache__/oracleconf.cpython-311.pyc b/scripts/__pycache__/oracleconf.cpython-311.pyc new file mode 100644 index 0000000..ed5ee51 Binary files /dev/null and b/scripts/__pycache__/oracleconf.cpython-311.pyc differ diff --git a/scripts/docker-python.conf b/scripts/docker-python.conf new file mode 100644 index 0000000..6bb1957 --- /dev/null +++ b/scripts/docker-python.conf @@ -0,0 +1,16 @@ +import preprocessing + +main = { + "EOS_PROTOCOL":"https", + "EOS_HOST":"", + "EOS_PORT":"", + "EOS_KEY":"", + "EOS_CHAIN":"", + "ORACLE":"bpname", + "CONTRACT":"delphioracle", + "FREQ":"15000", + "ORACLE_PERMISSION":"permission", + "CHAIN":"", + "APIKEY":"" +} + diff --git a/scripts/docker-updater.js b/scripts/docker-updater.js new file mode 100644 index 0000000..9fc102f --- /dev/null +++ b/scripts/docker-updater.js @@ -0,0 +1,84 @@ +// EOSJS version 2 used +const { Api, JsonRpc, RpcError } = require('eosjs'); +const fetch = require('node-fetch'); +const { TextEncoder, TextDecoder } = require('util'); +const { JsSignatureProvider } = require('eosjs/dist/eosjs-jssig'); +const axios = require('axios'); +const dotenv = require('dotenv'); + +dotenv.load(); + +var chain = process.env.CHAIN; +var priceUrl = ""; +var usdpair = ""; +var btcpair = ""; + +// Switch priceURL depending on EOSIO Chain provided via .env +switch (chain) { + case "wax": + priceUrl = "https://min-api.cryptocompare.com/data/price?fsym=WAXP&tsyms=BTC,USD"; + usdpair = "waxpusd"; + btcpair = "waxpbtc"; + break; + case "eos": + priceUrl = "https://min-api.cryptocompare.com/data/price?fsym=EOS&tsyms=BTC,USD"; + usdpair = "eosusd"; + btcpair = "eosbtc"; + break; + default: + var priceUrl = "https://min-api.cryptocompare.com/data/price?fsym=WAXP&tsyms=BTC,USD"; + +} + +const owner = process.env.ORACLE; +const oracleContract = process.env.CONTRACT; +const defaultPrivateKey = process.env.EOS_KEY; +const permission = process.env.ORACLE_PERMISSION; +const httpEndpoint = process.env.EOS_PROTOCOL + "://" + process.env.EOS_HOST + ":" + process.env.EOS_PORT; + +console.log(owner,oracleContract,permission) +const rpc = new JsonRpc(httpEndpoint, { fetch }); +const signatureProvider = new JsSignatureProvider([defaultPrivateKey]); +const api = new Api({ rpc, signatureProvider, textDecoder: new TextDecoder(), textEncoder: new TextEncoder() }); + + +const eosmain = async (quotes2) => { + try { + const result = await api.transact({ + actions: [{ + account: oracleContract, + name: 'write', + authorization: [{ + actor: owner, + permission: permission, + }], + data: { + owner: owner, + quotes: quotes2 + }, + }] + }, { + blocksBehind: 3, + expireSeconds: 30, + }); + console.dir(result); + } catch (e) { + console.log('\nCaught exception: ' + e); + if (e instanceof RpcError) + console.log(JSON.stringify(e.json, null, 2)); + } + } + +function writequotes(){ + axios + .get(priceUrl) + .then(response => { + //Assign repsonse to quotes + const quotes2 = [{"value": Math.round((response.data.BTC)* 100000000), pair: btcpair }, {"value": Math.round((response.data.USD)* 10000), pair: usdpair }] + console.log(quotes2) + //Call eos.contracts method + eosmain(quotes2) + }) +} + +writequotes(); \ No newline at end of file diff --git a/scripts/docker-updater.py b/scripts/docker-updater.py new file mode 100644 index 0000000..4182fba --- /dev/null +++ b/scripts/docker-updater.py @@ -0,0 +1,85 @@ +import json +import requests +import eospyo +import oracleconf as cfg +from pydantic import HttpUrl + +EOS_PROTOCOL = cfg.main["EOS_PROTOCOL"] +EOS_HOST = cfg.main["EOS_HOST"] +EOS_PORT = cfg.main["EOS_PORT"] +EOS_KEY = cfg.main["EOS_KEY"] +EOS_CHAIN = cfg.main["EOS_CHAIN"] +ORACLE = cfg.main["ORACLE"] +CONTRACT = cfg.main["CONTRACT"] +ORACLE_PERMISSION = cfg.main["ORACLE_PERMISSION"] +FREQ = cfg.main["FREQ"] +CHAIN = cfg.main["CHAIN"] +APIKEY = cfg.main["APIKEY"] + + +class MyNetwork(eospyo.Net): + host: HttpUrl = EOS_HOST + + +#data = '[ + +auth = eospyo.Authorization( + actor=ORACLE, + permission=ORACLE_PERMISSION, +) + + +def getPrice(): + response = requests.get("https://min-api.cryptocompare.com/data/pricemulti?fsyms=USD,WAXP&tsyms=USDT,USDC,BTC,USD,ETH,EOS&api_key="+APIKEY) + json_response = response.json() + BTC = round(json_response['WAXP']['BTC']*100000000) + USD = round(json_response['WAXP']['USD']*10000) + EOS = round(json_response['WAXP']['EOS']*1000000) + ETH = round(json_response['WAXP']['ETH']*100000000) + USDUSDT = round(json_response['USD']['USDT']* 10000) + USDUSDC = round(json_response['USD']['USDC']* 10000) + data = [ + {'value': BTC, 'pair': 'waxpbtc' }, + {'value': USD, 'pair': 'waxpusd' }, + {'value': EOS, 'pair': 'waxpeos' }, + {'value': ETH, 'pair': 'waxpeth' }, + {'value': USDUSDT, 'pair': 'usdtusd' }, + {'value': USDUSDC, 'pair': 'usdcusd' } + ] + print(data) + return data + + +pricedata = getPrice() + +action = eospyo.Action( + account=CONTRACT, # this is the contract account + name="write", # this is the action name + data={ + 'owner': ORACLE, + 'quotes': pricedata + }, + authorization=[auth], +) + +raw_transaction = eospyo.Transaction(actions=[action]) + + +print("Link transaction to the network") +#net = eospyo.WaxMainnet() +net = MyNetwork() +# notice that eospyo returns a new object instead of change in place +linked_transaction = raw_transaction.link(net=net) + + +print("Sign transaction") +key = EOS_KEY +signed_transaction = linked_transaction.sign(key=key) + + +print("Send") +resp = signed_transaction.send() + +print("Printing the response") +resp_fmt = json.dumps(resp, indent=4) +print(f"Response:\n{resp_fmt}") diff --git a/scripts/docker.env b/scripts/docker.env new file mode 100644 index 0000000..93f5bc4 --- /dev/null +++ b/scripts/docker.env @@ -0,0 +1,10 @@ +EOS_PROTOCOL='https' +EOS_HOST='' +EOS_PORT='' +EOS_KEY='' +EOS_CHAIN='' +ORACLE="bpname" +CONTRACT="delphioracle" +FREQ=15000 +ORACLE_PERMISSION="permission" +CHAIN='' diff --git a/scripts/package-lock.json b/scripts/package-lock.json index 3b63d66..332ae08 100644 --- a/scripts/package-lock.json +++ b/scripts/package-lock.json @@ -9,10 +9,10 @@ "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.10.0.tgz", "integrity": "sha512-nffhOpkymDECQyR0mnsUtoCE8RlX38G0rYP+wgLWFyZuUyuuojSSvi/+euOiQBIn63whYwYVIIH1TvE3tu4OEg==", "requires": { - "fast-deep-equal": "2.0.1", - "fast-json-stable-stringify": "2.0.0", - "json-schema-traverse": "0.4.1", - "uri-js": "4.2.2" + "fast-deep-equal": "^2.0.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" } }, "asn1": { @@ -20,7 +20,7 @@ "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", "requires": { - "safer-buffer": "2.1.2" + "safer-buffer": "~2.1.0" } }, "assert-plus": { @@ -43,21 +43,12 @@ "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.8.0.tgz", "integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ==" }, - "babel-runtime": { - "version": "6.26.0", - "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz", - "integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=", + "axios": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.19.2.tgz", + "integrity": "sha512-fjgm5MvRHLhx+osE2xoekY70AhARk3a6hkN+3Io1jc00jtquGvxYlKlsFUhmUET0V5te6CcZI7lcv2Ym61mjHA==", "requires": { - "core-js": "2.5.7", - "regenerator-runtime": "0.11.1" - } - }, - "base-x": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/base-x/-/base-x-3.0.4.tgz", - "integrity": "sha512-UYOadoSIkEI/VrRGSG6qp93rp2WdokiAiNYDfGW5qURAY8GiAQkvMbwNNSDYiVJopqv4gCna7xqf4rrNGp+5AA==", - "requires": { - "safe-buffer": "5.1.2" + "follow-redirects": "1.5.10" } }, "bcrypt-pbkdf": { @@ -65,81 +56,24 @@ "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", "requires": { - "tweetnacl": "0.14.5" + "tweetnacl": "^0.14.3" } }, - "bigi": { - "version": "1.4.2", - "resolved": "https://registry.npmjs.org/bigi/-/bigi-1.4.2.tgz", - "integrity": "sha1-nGZalfiLiwj8Bc/XMfVhhZ1yWCU=" - }, - "binaryen": { - "version": "37.0.0", - "resolved": "https://registry.npmjs.org/binaryen/-/binaryen-37.0.0.tgz", - "integrity": "sha512-ACBhSXtQvZvJZ8LNM5R/8HTk57Nr4J+HIrGfIfbIM9OpyaMePsXMgzVt+cMcCgX+sm4bmq5ed0kGgxd9RZ3Kkw==" - }, "bn.js": { - "version": "4.11.8", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.8.tgz", - "integrity": "sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA==" - }, - "browserify-aes": { - "version": "1.2.0", - "resolved": "http://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz", - "integrity": "sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA==", - "requires": { - "buffer-xor": "1.0.3", - "cipher-base": "1.0.4", - "create-hash": "1.2.0", - "evp_bytestokey": "1.0.3", - "inherits": "2.0.3", - "safe-buffer": "5.1.2" - } - }, - "bs58": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/bs58/-/bs58-4.0.1.tgz", - "integrity": "sha1-vhYedsNU9veIrkBx9j806MTwpCo=", - "requires": { - "base-x": "3.0.4" - } + "version": "4.11.9", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.9.tgz", + "integrity": "sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw==" }, - "buffer-xor": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/buffer-xor/-/buffer-xor-1.0.3.tgz", - "integrity": "sha1-JuYe0UIvtw3ULm42cp7VHYVf6Nk=" - }, - "bytebuffer": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/bytebuffer/-/bytebuffer-5.0.1.tgz", - "integrity": "sha1-WC7qSxqHO20CCkjVjfhfC7ps/d0=", - "requires": { - "long": "3.2.0" - } - }, - "camel-case": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/camel-case/-/camel-case-3.0.0.tgz", - "integrity": "sha1-yjw2iKTpzzpM2nd9xNy8cTJJz3M=", - "requires": { - "no-case": "2.3.2", - "upper-case": "1.1.3" - } + "brorand": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", + "integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=" }, "caseless": { "version": "0.12.0", "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" }, - "cipher-base": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.4.tgz", - "integrity": "sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q==", - "requires": { - "inherits": "2.0.3", - "safe-buffer": "5.1.2" - } - }, "colors": { "version": "1.3.3", "resolved": "https://registry.npmjs.org/colors/-/colors-1.3.3.tgz", @@ -150,50 +84,28 @@ "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", "requires": { - "delayed-stream": "1.0.0" + "delayed-stream": "~1.0.0" } }, - "core-js": { - "version": "2.5.7", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.7.tgz", - "integrity": "sha512-RszJCAxg/PP6uzXVXL6BsxSXx/B05oJAQ2vkJRjyjrEcNVycaqOmNb5OTxZPE3xa5gwZduqza6L9JOCenh/Ecw==" - }, "core-util-is": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" }, - "create-hash": { - "version": "1.2.0", - "resolved": "http://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz", - "integrity": "sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg==", - "requires": { - "cipher-base": "1.0.4", - "inherits": "2.0.3", - "md5.js": "1.3.5", - "ripemd160": "2.0.2", - "sha.js": "2.4.11" - } - }, - "create-hmac": { - "version": "1.1.7", - "resolved": "http://registry.npmjs.org/create-hmac/-/create-hmac-1.1.7.tgz", - "integrity": "sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg==", - "requires": { - "cipher-base": "1.0.4", - "create-hash": "1.2.0", - "inherits": "2.0.3", - "ripemd160": "2.0.2", - "safe-buffer": "5.1.2", - "sha.js": "2.4.11" - } - }, "dashdash": { "version": "1.14.1", "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", "requires": { - "assert-plus": "1.0.0" + "assert-plus": "^1.0.0" + } + }, + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "requires": { + "ms": "2.0.0" } }, "delayed-stream": { @@ -211,71 +123,32 @@ "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", "requires": { - "jsbn": "0.1.1", - "safer-buffer": "2.1.2" - } - }, - "ecurve": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/ecurve/-/ecurve-1.0.6.tgz", - "integrity": "sha512-/BzEjNfiSuB7jIWKcS/z8FK9jNjmEWvUV2YZ4RLSmcDtP7Lq0m6FvDuSnJpBlDpGRpfRQeTLGLBI8H+kEv0r+w==", - "requires": { - "bigi": "1.4.2", - "safe-buffer": "5.1.2" + "jsbn": "~0.1.0", + "safer-buffer": "^2.1.0" } }, - "encoding": { - "version": "0.1.12", - "resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.12.tgz", - "integrity": "sha1-U4tm8+5izRq1HsMjgp0flIDHS+s=", + "elliptic": { + "version": "6.5.3", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.3.tgz", + "integrity": "sha512-IMqzv5wNQf+E6aHeIqATs0tOLeOTwj1QKbRcS3jBbYkl5oLAserA8yJTT7/VyHUYG91PRmPyeQDObKLPpeS4dw==", "requires": { - "iconv-lite": "0.4.24" + "bn.js": "^4.4.0", + "brorand": "^1.0.1", + "hash.js": "^1.0.0", + "hmac-drbg": "^1.0.0", + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.0" } }, "eosjs": { - "version": "16.0.9", - "resolved": "https://registry.npmjs.org/eosjs/-/eosjs-16.0.9.tgz", - "integrity": "sha512-aYgzbgH2RhnmYVzEmK4AD6UIboJI54PGYQUesv2i8rCqYhWij+xQx7PtALJ481cxZnQgmFn8s2KMkgG07P5/Ug==", + "version": "21.0.2", + "resolved": "https://registry.npmjs.org/eosjs/-/eosjs-21.0.2.tgz", + "integrity": "sha512-oRrjfzS6An825IupBGKnn9UXqVUSEpjKw5xH17OYtrlOoJdlDN97yuDITSTVOqBeryIBxHvss59FFgnx4c+YEg==", "requires": { - "babel-runtime": "6.26.0", - "binaryen": "37.0.0", - "create-hash": "1.2.0", - "eosjs-api": "7.0.4", - "eosjs-ecc": "4.0.4", - "fcbuffer": "2.2.2" - } - }, - "eosjs-api": { - "version": "7.0.4", - "resolved": "https://registry.npmjs.org/eosjs-api/-/eosjs-api-7.0.4.tgz", - "integrity": "sha512-oLbM39rcyWYkqu6nIEQ50I92yT2vvD7WZPZ3FujbydG2ssR5Re/uSvbkFfZTB02g3I4D+UDUA1jd65HlM7r3MQ==", - "requires": { - "camel-case": "3.0.0", - "isomorphic-fetch": "2.2.1" - } - }, - "eosjs-ecc": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/eosjs-ecc/-/eosjs-ecc-4.0.4.tgz", - "integrity": "sha512-9wAYefts4TidHOu+eN9nAisZdWpUzlUimZrB63oP7+/s4xRNJEn2Vvep2ICRODpxpidbshM1L7WaSYW9oiV5gA==", - "requires": { - "bigi": "1.4.2", - "browserify-aes": "1.2.0", - "bs58": "4.0.1", - "bytebuffer": "5.0.1", - "create-hash": "1.2.0", - "create-hmac": "1.1.7", - "ecurve": "1.0.6", - "randombytes": "2.0.6" - } - }, - "evp_bytestokey": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/evp_bytestokey/-/evp_bytestokey-1.0.3.tgz", - "integrity": "sha512-/f2Go4TognH/KvCISP7OUsHn85hT9nUkxxA9BEWxFn+Oj9o8ZNLm/40hdlgSLyuOimsrTKLUMEorQexp/aPQeA==", - "requires": { - "md5.js": "1.3.5", - "safe-buffer": "5.1.2" + "elliptic": "6.5.3", + "hash.js": "1.1.7", + "pako": "1.0.11" } }, "extend": { @@ -298,14 +171,12 @@ "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=" }, - "fcbuffer": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/fcbuffer/-/fcbuffer-2.2.2.tgz", - "integrity": "sha512-4OhDYe3F3iToKkqao6aj72XcvEjCB4p06U8Wy30lYcLQTp2ispBf2cCyeymKPJQGnbG5wpBa2PraaWWJuZVnUg==", + "follow-redirects": { + "version": "1.5.10", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.5.10.tgz", + "integrity": "sha512-0V5l4Cizzvqt5D44aTXbFZz+FtyXV1vrDN6qrelxtfYQKW0KO0W2T/hkE8xvGa/540LkZlkaUjO4ailYTFtHVQ==", "requires": { - "bn.js": "4.11.8", - "bytebuffer": "5.0.1", - "ieee-float": "0.6.0" + "debug": "=3.1.0" } }, "forever-agent": { @@ -318,9 +189,9 @@ "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", "requires": { - "asynckit": "0.4.0", - "combined-stream": "1.0.8", - "mime-types": "2.1.24" + "asynckit": "^0.4.0", + "combined-stream": "^1.0.6", + "mime-types": "^2.1.12" } }, "getpass": { @@ -328,7 +199,7 @@ "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", "requires": { - "assert-plus": "1.0.0" + "assert-plus": "^1.0.0" } }, "har-schema": { @@ -341,17 +212,27 @@ "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.3.tgz", "integrity": "sha512-sNvOCzEQNr/qrvJgc3UG/kD4QtlHycrzwS+6mfTrrSq97BvaYcPZZI1ZSqGSPR73Cxn4LKTD4PttRwfU7jWq5g==", "requires": { - "ajv": "6.10.0", - "har-schema": "2.0.0" + "ajv": "^6.5.5", + "har-schema": "^2.0.0" + } + }, + "hash.js": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz", + "integrity": "sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==", + "requires": { + "inherits": "^2.0.3", + "minimalistic-assert": "^1.0.1" } }, - "hash-base": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-3.0.4.tgz", - "integrity": "sha1-X8hoaEfs1zSZQDMZprCj8/auSRg=", + "hmac-drbg": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", + "integrity": "sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=", "requires": { - "inherits": "2.0.3", - "safe-buffer": "5.1.2" + "hash.js": "^1.0.3", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.1" } }, "http-signature": { @@ -359,48 +240,21 @@ "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", "requires": { - "assert-plus": "1.0.0", - "jsprim": "1.4.1", - "sshpk": "1.16.1" + "assert-plus": "^1.0.0", + "jsprim": "^1.2.2", + "sshpk": "^1.7.0" } }, - "iconv-lite": { - "version": "0.4.24", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", - "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", - "requires": { - "safer-buffer": "2.1.2" - } - }, - "ieee-float": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/ieee-float/-/ieee-float-0.6.0.tgz", - "integrity": "sha1-poqFa6HvUR5/oOfn4VXDpjZCpV0=" - }, "inherits": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" - }, - "is-stream": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", - "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=" + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" }, "is-typedarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" }, - "isomorphic-fetch": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/isomorphic-fetch/-/isomorphic-fetch-2.2.1.tgz", - "integrity": "sha1-YRrhrPFPXoH3KVB0coGf6XM1WKk=", - "requires": { - "node-fetch": "1.7.3", - "whatwg-fetch": "3.0.0" - } - }, "isstream": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", @@ -437,26 +291,6 @@ "verror": "1.10.0" } }, - "long": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/long/-/long-3.2.0.tgz", - "integrity": "sha1-2CG3E4yhy1gcFymQ7xTbIAtcR0s=" - }, - "lower-case": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/lower-case/-/lower-case-1.1.4.tgz", - "integrity": "sha1-miyr0bno4K6ZOkv31YdcOcQujqw=" - }, - "md5.js": { - "version": "1.3.5", - "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz", - "integrity": "sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg==", - "requires": { - "hash-base": "3.0.4", - "inherits": "2.0.3", - "safe-buffer": "5.1.2" - } - }, "mime-db": { "version": "1.40.0", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.40.0.tgz", @@ -470,28 +304,36 @@ "mime-db": "1.40.0" } }, - "no-case": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/no-case/-/no-case-2.3.2.tgz", - "integrity": "sha512-rmTZ9kz+f3rCvK2TD1Ue/oZlns7OGoIWP4fc3llxxRXlOkHKoWPPWJOfFYpITabSow43QJbRIoHQXtt10VldyQ==", - "requires": { - "lower-case": "1.1.4" - } + "minimalistic-assert": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", + "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==" + }, + "minimalistic-crypto-utils": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", + "integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo=" + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" }, "node-fetch": { - "version": "1.7.3", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-1.7.3.tgz", - "integrity": "sha512-NhZ4CsKx7cYm2vSrBAr2PvFOe6sWDf0UYLRqA6svUYg7+/TSfVAu49jYC4BvQ4Sms9SZgdqGBgroqfDhJdTyKQ==", - "requires": { - "encoding": "0.1.12", - "is-stream": "1.1.0" - } + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.0.tgz", + "integrity": "sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA==" }, "oauth-sign": { "version": "0.9.0", "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==" }, + "pako": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.11.tgz", + "integrity": "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==" + }, "performance-now": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", @@ -512,53 +354,31 @@ "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==" }, - "randombytes": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.0.6.tgz", - "integrity": "sha512-CIQ5OFxf4Jou6uOKe9t1AOgqpeU5fd70A8NPdHSGeYXqXsPe6peOwI0cUl88RWZ6sP1vPMV3avd/R6cZ5/sP1A==", - "requires": { - "safe-buffer": "5.1.2" - } - }, - "regenerator-runtime": { - "version": "0.11.1", - "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz", - "integrity": "sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg==" - }, "request": { "version": "2.88.0", "resolved": "https://registry.npmjs.org/request/-/request-2.88.0.tgz", "integrity": "sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg==", "requires": { - "aws-sign2": "0.7.0", - "aws4": "1.8.0", - "caseless": "0.12.0", - "combined-stream": "1.0.8", - "extend": "3.0.2", - "forever-agent": "0.6.1", - "form-data": "2.3.3", - "har-validator": "5.1.3", - "http-signature": "1.2.0", - "is-typedarray": "1.0.0", - "isstream": "0.1.2", - "json-stringify-safe": "5.0.1", - "mime-types": "2.1.24", - "oauth-sign": "0.9.0", - "performance-now": "2.1.0", - "qs": "6.5.2", - "safe-buffer": "5.1.2", - "tough-cookie": "2.4.3", - "tunnel-agent": "0.6.0", - "uuid": "3.3.2" - } - }, - "ripemd160": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/ripemd160/-/ripemd160-2.0.2.tgz", - "integrity": "sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA==", - "requires": { - "hash-base": "3.0.4", - "inherits": "2.0.3" + "aws-sign2": "~0.7.0", + "aws4": "^1.8.0", + "caseless": "~0.12.0", + "combined-stream": "~1.0.6", + "extend": "~3.0.2", + "forever-agent": "~0.6.1", + "form-data": "~2.3.2", + "har-validator": "~5.1.0", + "http-signature": "~1.2.0", + "is-typedarray": "~1.0.0", + "isstream": "~0.1.2", + "json-stringify-safe": "~5.0.1", + "mime-types": "~2.1.19", + "oauth-sign": "~0.9.0", + "performance-now": "^2.1.0", + "qs": "~6.5.2", + "safe-buffer": "^5.1.2", + "tough-cookie": "~2.4.3", + "tunnel-agent": "^0.6.0", + "uuid": "^3.3.2" } }, "safe-buffer": { @@ -571,29 +391,20 @@ "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" }, - "sha.js": { - "version": "2.4.11", - "resolved": "http://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", - "integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==", - "requires": { - "inherits": "2.0.3", - "safe-buffer": "5.1.2" - } - }, "sshpk": { "version": "1.16.1", "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz", "integrity": "sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg==", "requires": { - "asn1": "0.2.4", - "assert-plus": "1.0.0", - "bcrypt-pbkdf": "1.0.2", - "dashdash": "1.14.1", - "ecc-jsbn": "0.1.2", - "getpass": "0.1.7", - "jsbn": "0.1.1", - "safer-buffer": "2.1.2", - "tweetnacl": "0.14.5" + "asn1": "~0.2.3", + "assert-plus": "^1.0.0", + "bcrypt-pbkdf": "^1.0.0", + "dashdash": "^1.12.0", + "ecc-jsbn": "~0.1.1", + "getpass": "^0.1.1", + "jsbn": "~0.1.0", + "safer-buffer": "^2.0.2", + "tweetnacl": "~0.14.0" } }, "tough-cookie": { @@ -601,8 +412,8 @@ "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.4.3.tgz", "integrity": "sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ==", "requires": { - "psl": "1.1.33", - "punycode": "1.4.1" + "psl": "^1.1.24", + "punycode": "^1.4.1" }, "dependencies": { "punycode": { @@ -617,7 +428,7 @@ "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", "requires": { - "safe-buffer": "5.1.2" + "safe-buffer": "^5.0.1" } }, "tweetnacl": { @@ -625,17 +436,12 @@ "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=" }, - "upper-case": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/upper-case/-/upper-case-1.1.3.tgz", - "integrity": "sha1-9rRQHC7EzdJrp4vnIilh3ndiFZg=" - }, "uri-js": { "version": "4.2.2", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz", "integrity": "sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==", "requires": { - "punycode": "2.1.1" + "punycode": "^2.1.0" } }, "uuid": { @@ -648,15 +454,10 @@ "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", "requires": { - "assert-plus": "1.0.0", + "assert-plus": "^1.0.0", "core-util-is": "1.0.2", - "extsprintf": "1.3.0" + "extsprintf": "^1.2.0" } - }, - "whatwg-fetch": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-3.0.0.tgz", - "integrity": "sha512-9GSJUgz1D4MfyKU7KRqwOjXCXTqWdFNvEr7eUBYchQiVc744mqK/MzXPNR2WsPkmkOa4ywfg8C2n8h+13Bey1Q==" } } } diff --git a/scripts/package.json b/scripts/package.json index 6b7255e..8f5cd6c 100644 --- a/scripts/package.json +++ b/scripts/package.json @@ -9,9 +9,11 @@ "author": "Guillaume Babin-Tremblay", "license": "ISC", "dependencies": { - "eosjs": "^16.0.9", + "axios": "^0.19.2", + "colors": "*", "dotenv": "^6.0.0", - "request": "*", - "colors": "*" + "eosjs": "^21.0.2", + "node-fetch": "^2.6.0", + "request": "*" } } diff --git a/scripts/python-start.sh b/scripts/python-start.sh new file mode 100644 index 0000000..8c85da8 --- /dev/null +++ b/scripts/python-start.sh @@ -0,0 +1,51 @@ +## Docker initial entry script + +conf_setup() { + +cd /app +echo "Adding private key to .env" +sed -i "s//$PRIVATE_KEY/" oracleconf.py +echo "Adding Block Producer to oracleconf.py" +sed -i "s/bpname/$BPNAME/" oracleconf.py +echo "Adding permission" +sed -i "s/permission/$PERM/" oracleconf.py +echo "Setting API" +sed -i "s//$API/" oracleconf.py +echo "Setting API PORT" +sed -i "s//$APIPORT/" oracleconf.py +echo "Setting API KEY" +sed -i "s//$APIKEY/" oracleconf.py + + +# Setting chain ID +waxid="1064487b3cd1a897ce03ae5b6a865651747e2e152090f99c1d19d44e01aea5a4" +eosid="aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906" + +echo "Setting the chain ID" +if [[ $CHAIN = "wax" ]] +then + sed -i "s//$waxid/" oracleconf.py + sed -i "s//wax/" oracleconf.py +fi +if [[ $CHAIN == 'eos' ]] +then + sed -i "s//$eosid/" oracleconf.py + sed -i "s//eos/" oracleconf.py +fi + +} + +run_oracle(){ +while [ 1 ] +do + cd /app + python3 updater.py + sleep 60 +done +} + +# Running functions +conf_setup +run_oracle + + diff --git a/scripts/sample.env b/scripts/sample.env index a0d65c0..40d1e76 100644 --- a/scripts/sample.env +++ b/scripts/sample.env @@ -6,4 +6,5 @@ EOS_CHAIN='aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906' ORACLE="eostitantest" CONTRACT="delphioracle" FREQ=15000 -ORACLE_PERMISSION="active" \ No newline at end of file +ORACLE_PERMISSION="active" + diff --git a/scripts/start.sh b/scripts/start.sh new file mode 100644 index 0000000..2f19177 --- /dev/null +++ b/scripts/start.sh @@ -0,0 +1,51 @@ +## Docker initial entry script + +env_setup() { + +cd /app +echo "Adding private key to .env" +sed -i "s//$PRIVATE_KEY/" .env +echo "Adding Block Producer to .env" +sed -i "s/bpname/$BPNAME/" .env +echo "Adding permission" +sed -i "s/permission/$PERM/" .env +echo "Setting API" +sed -i "s//$API/" .env +echo "Setting API PORT" +sed -i "s//$APIPORT/" .env +echo "Setting API KEY" +sed -i "s//$APIKEY/" .env + + +# Setting chain ID +waxid="1064487b3cd1a897ce03ae5b6a865651747e2e152090f99c1d19d44e01aea5a4" +eosid="aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906" + +echo "Setting the chain ID" +if [[ $CHAIN = "wax" ]] +then + sed -i "s//$waxid/" .env + sed -i "s//wax/" .env +fi +if [[ $CHAIN == 'eos' ]] +then + sed -i "s//$eosid/" .env + sed -i "s//eos/" .env +fi + +} + +run_oracle(){ +while [ 1 ] +do + cd /app + node updater.js + sleep 60 +done +} + +# Running functions +env_setup +run_oracle + +