Skip to content
This repository was archived by the owner on Oct 31, 2022. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Publish Docker image

on:
push:
branches:
- "main"
tags:
- "v*"
pull_request:
branches:
- "main"

jobs:
build-and-push-image:
name: Build and release docker image
runs-on: ubuntu-latest

permissions:
packages: write
contents: read

steps:
- name: Check out the repo
uses: actions/checkout@v2

- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v3
with:
images: ghcr.io/${{ github.repository }}

- name: Build and push Docker images
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
test.js
*.log
*.json
*.out
*.out
.env
7 changes: 7 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM denoland/deno:alpine-1.12.1

WORKDIR /app

COPY . .

CMD ["run", "--allow-all", "index.js"]
4 changes: 2 additions & 2 deletions icx_bot_btc_maker.js
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ async function outputStatistics() {
sendAlarm(`[btc maker] Order size: ${objStatistics["btcInOrder"]}, BTC balance: ${btcBalance}, dBTC balance: ${dbtcBalance}, DFI Token balance: ${dfiTokenBalance}, DFI UTXO balance: ${dfiUtxoBalance}, Total btc amount in HTLC: ${btcInHtlc}`);
}

(async() => {
export default async () => {
try{
if (ownerAddress == null) {
console.error("Please define DFI_ADDRESS in environment variable");
Expand Down Expand Up @@ -503,4 +503,4 @@ async function outputStatistics() {
}catch(e) {
console.error(e);
}
})();
}
4 changes: 2 additions & 2 deletions icx_bot_dbtc_maker.js
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ async function removeExpiredHtlc() {
}
}

(async() => {
export default async () => {
try{
if (ownerAddress == null) {
console.error("Please define DFI_ADDRESS in environment variable");
Expand Down Expand Up @@ -525,4 +525,4 @@ async function removeExpiredHtlc() {
}catch(e) {
console.error(e);
}
})();
}
17 changes: 17 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import btcMakerBot from "./icx_bot_btc_maker.js";
import dbtcMakerBot from "./icx_bot_dbtc_maker.js";

// TYPE = DBTC | BTC
const makerType = Deno.env.get("TYPE");

switch (makerType) {
case "DBTC":
dbtcMakerBot();
break;
case "BTC":
btcMakerBot();
break;
default:
console.error("Please define TYPE in environment variable");
break;
}
2 changes: 1 addition & 1 deletion util.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Base64 } from "https://deno.land/x/bb64/mod.ts";
import Kia from "https://deno.land/x/kia@0.3.0/mod.ts";
import { createHash } from "https://deno.land/std@0.74.0/hash/mod.ts";
import { cryptoRandomString } from "https://deno.land/x/crypto_random_string@1.0.0/mod.ts"
import { decodeString } from "https://deno.land/std/encoding/hex.ts"
import { decodeString } from "https://deno.land/std@0.100.0/encoding/hex.ts"

const rpcAddress = Deno.env.get("RPC_ADDRESS");
const rpcPort = Deno.env.get("RPC_PORT");
Expand Down
2 changes: 1 addition & 1 deletion util1.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Base64 } from "https://deno.land/x/bb64/mod.ts";
import Kia from "https://deno.land/x/kia@0.3.0/mod.ts";
import { createHash } from "https://deno.land/std@0.74.0/hash/mod.ts";
import { cryptoRandomString } from "https://deno.land/x/crypto_random_string@1.0.0/mod.ts"
import { decodeString } from "https://deno.land/std/encoding/hex.ts"
import { decodeString } from "https://deno.land/std@0.100.0/encoding/hex.ts"

const rpcAddress = Deno.args[0];
const rpcPort = Deno.args[1];
Expand Down