Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: basedbot #484

Merged
merged 69 commits into from
Oct 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
964f15f
feat: basedbot
mindrunner Apr 20, 2024
68a8d9f
feat: eslint / prettier
mindrunner Jul 14, 2024
c129dfb
fix: end mining
mindrunner Jul 14, 2024
8e5e49e
fix: end mining
mindrunner Jul 14, 2024
649d017
feat: auto import R4
mindrunner Jul 14, 2024
5555b4a
fix: stop mining asteroid
mindrunner Jul 15, 2024
b24cdcb
fix: proper fuel account creation
mindrunner Jul 15, 2024
b688b58
fix: don't call endMine twice
mindrunner Jul 15, 2024
9ff1774
fix: logging
mindrunner Jul 16, 2024
1d2f79a
fix: logging
mindrunner Jul 16, 2024
b5fc476
fix: fix lumanite location
mindrunner Jul 16, 2024
f5f1ace
chore: mining strategies
mindrunner Aug 17, 2024
68097f7
chore: mine Rochinol
mindrunner Aug 26, 2024
1f4d363
chore: use correct sage program on atlasnet
mindrunner Aug 30, 2024
66bb1fc
chore: new atlasnet setup
mindrunner Aug 30, 2024
7f36ee0
chore: separate fleet strategies
mindrunner Sep 2, 2024
e586821
chore: bulk-mine strategy
mindrunner Sep 2, 2024
b1e1d2e
chore: bulk-mine strategy
mindrunner Sep 2, 2024
276da05
fix: faction
mindrunner Sep 2, 2024
4022abf
fix: optimise fc-strategies
mindrunner Sep 2, 2024
a25da70
fix: default to zero priority fee when cluster does not return any va…
mindrunner Sep 3, 2024
1af4f10
fix: fleet creation automation
mindrunner Sep 5, 2024
0f44647
fix: decouple game from player
mindrunner Sep 5, 2024
5a06464
feat: disband-all-strategy
mindrunner Sep 5, 2024
ecbffe2
feat: disband-all-strategy
mindrunner Sep 5, 2024
ef2502b
feat: disband-all-strategy
mindrunner Sep 5, 2024
86e2d78
fix: don't undock after disbanding
mindrunner Sep 6, 2024
e9ca7a0
feat: disband
mindrunner Sep 6, 2024
2855a7b
feat: disband
mindrunner Sep 8, 2024
b97b057
feat: disband
mindrunner Sep 8, 2024
78c484c
chore: rebase
mindrunner Sep 8, 2024
5724078
chore: rebase
mindrunner Sep 8, 2024
164ce4c
chore: more flexible fleet creation
mindrunner Sep 8, 2024
8ad24e3
chore: more flexible fleet creation
mindrunner Sep 8, 2024
1a66357
chore: more flexible fleet creation
mindrunner Sep 8, 2024
4e94db0
chore: more flexible fleet creation
mindrunner Sep 8, 2024
a1d697c
fix: linter
mindrunner Sep 9, 2024
3994c8b
fix: optimize fleet creation
mindrunner Sep 9, 2024
b402500
fix: optimize fleet creation
mindrunner Sep 9, 2024
2ca65ae
fix: more fleets
mindrunner Sep 9, 2024
73a0f8d
fix: disband mud
mindrunner Sep 9, 2024
5a0e1cb
fix: correct mud fleet size
mindrunner Sep 9, 2024
66285a0
fix: prevent overlong names
mindrunner Sep 9, 2024
bf3f580
chore: disband all
mindrunner Sep 12, 2024
7106615
fix: warp cooldown check before disband
mindrunner Sep 12, 2024
bb34b48
fix: warp cooldown check before disband
mindrunner Sep 12, 2024
e798e8b
fix: optimize transport
mindrunner Sep 16, 2024
2a3166d
fix: optimize transport
mindrunner Sep 16, 2024
1a45413
fix: optimize transport
mindrunner Sep 16, 2024
9ae9767
fix: proper refuel on return
mindrunner Sep 16, 2024
8c1aed4
fix: ammmo reloading
mindrunner Sep 16, 2024
a152cca
chore: lfg
mindrunner Sep 16, 2024
1dfb498
fix: transporters always subwarp
mindrunner Sep 16, 2024
a8924af
fix: logging
mindrunner Sep 16, 2024
fd709eb
fix: logging
mindrunner Sep 16, 2024
6df96a5
fix: optimize transport
mindrunner Sep 16, 2024
5c95e10
fix: optimize transport
mindrunner Sep 16, 2024
3fa1fcc
fix: optimize transport
mindrunner Sep 16, 2024
369834a
fix: optimize transport
mindrunner Sep 16, 2024
0b4bf20
fix: optimize transport
mindrunner Sep 17, 2024
f67d1bf
fix: optimize transport
mindrunner Sep 17, 2024
34e2e49
fix: force self destruct
mindrunner Sep 18, 2024
6787fc5
fix: force self destruct
mindrunner Sep 18, 2024
bf434d5
chore: respawn them
mindrunner Sep 18, 2024
ba8a348
chore: more fleets
mindrunner Sep 18, 2024
1303252
fix: hasCargo check for transporter at target base
mindrunner Sep 30, 2024
e4a346e
chore: update fleet name
mindrunner Oct 6, 2024
b72922a
chore: mine hydrogen
mindrunner Oct 7, 2024
219853a
chore: mine hydrogen
mindrunner Oct 8, 2024
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
212 changes: 120 additions & 92 deletions .eslintrc.js

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
- package-ecosystem: 'github-actions'
directory: '/'
schedule:
interval: "daily"
- package-ecosystem: "npm"
directory: "/"
interval: 'daily'
- package-ecosystem: 'npm'
directory: '/'
schedule:
interval: "daily"
interval: 'daily'
groups:
sentry:
patterns:
- "*sentry*"
- '*sentry*'
eslint:
patterns:
- "*eslint*"
- '*eslint*'
94 changes: 46 additions & 48 deletions .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
@@ -1,55 +1,53 @@
name: cicd

on:
push:
branches: [ "*" ]
pull_request:
branches: [ "main" ]
push:
branches: ['*']
pull_request:
branches: ['main']

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/install
- run: pnpm run build

build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/install
- run: pnpm run build
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/install
- run: pnpm run lint

lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/install
- run: pnpm run lint

release:
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/install
- run: pnpm run build
- run: pnpm install --frozen-lockfile --ignore-scripts --prod
- uses: docker/metadata-action@v5
id: metadata
with:
images: runmymind/fleetbot
tags: |
type=schedule
type=ref,event=branch
type=ref,event=tag
type=ref,event=pr
type=sha
type=raw,value=latest,enable={{is_default_branch}}
- uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: int128/kaniko-action@v1
with:
push: true
file: ./docker/Dockerfile
tags: ${{ steps.metadata.outputs.tags }}
labels: ${{ steps.metadata.outputs.labels }}
cache: true
cache-repository: runmymind/fleetbot/cache
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/install
- run: pnpm run build
- run: pnpm install --frozen-lockfile --ignore-scripts --prod
- uses: docker/metadata-action@v5
id: metadata
with:
images: runmymind/fleetbot
tags: |
type=schedule
type=ref,event=branch
type=ref,event=tag
type=ref,event=pr
type=sha
type=raw,value=latest,enable={{is_default_branch}}
- uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: int128/kaniko-action@v1
with:
push: true
file: ./docker/Dockerfile
tags: ${{ steps.metadata.outputs.tags }}
labels: ${{ steps.metadata.outputs.labels }}
cache: true
cache-repository: runmymind/fleetbot/cache
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@
/node_modules
.env*
!.env.example
.prettierrc
*.iml

6 changes: 6 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"semi": false,
"singleQuote": true,
"trailingComma": "all",
"endOfLine": "auto"
}
38 changes: 19 additions & 19 deletions .yamllint.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
extends: default

ignore: |
node_modules
node_modules

rules:
braces:
min-spaces-inside: 1
max-spaces-inside: 1
brackets:
min-spaces-inside: 1
max-spaces-inside: 1
document-start: disable
document-end:
present: false
empty-lines:
max: 1
max-start: 0
max-end: 0
empty-values: enable
line-length: disable
octal-values: enable
truthy:
level: error
braces:
min-spaces-inside: 1
max-spaces-inside: 1
brackets:
min-spaces-inside: 1
max-spaces-inside: 1
document-start: disable
document-end:
present: false
empty-lines:
max: 1
max-start: 0
max-end: 0
empty-values: enable
line-length: disable
octal-values: enable
truthy:
level: error
52 changes: 34 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,28 +47,33 @@
</details>

<!-- ABOUT -->

## About The Project

fleetbot is an automatic fleet refill service bot for <a href='https://play.staratlas.com/fleet/'>Star Atlas SCORE</a>,
an early stage mini-game in the Star Atlas universe.
`fleetbot` contains of four core components:

### resource manager

The resource manager makes sure that `fleetbot` always has enough `R4`. (FOOD, TOOL, FUEL and AMMO). Basically it
calculates how much is needed for a given time period based on users and their burn. As soon as `fleetbot` runs low on a
particular resource, it uses the official Star Atlas marketplace to restock them.

### bookkeeper

The bookkeeper manages user's accounts, handles deposits and withdrawals and keeps track of individual balances. Since
all user's funds are kept in one wallet, this needs to be baked by a persistence layer to store additional information
which can not efficiently be read from the blockchain itself.

### refill service

The most crucial part for `fleetbot` users. Checks your fleets and refills them as soon as they run out of resources.
Ships aren't getting full refills by default, but only what is really needed. This leaves the option for the user to
manually add resources as well.

### telegram bot

To interact with `fleetbot`, telegram can be used. See telegram section further down for more information.

<p align="right">(<a href="#readme-top">back to top</a>)</p>
Expand All @@ -80,6 +85,7 @@ To interact with `fleetbot`, telegram can be used. See telegram section further
<p align="right">(<a href="#readme-top">back to top</a>)</p>

<!-- USAGE -->

## Usage

`fleetbot` can be used in several ways, depending on user's preference. To be fully aware of what the bot is actually doing
Expand All @@ -90,24 +96,27 @@ everyone, there are more convenient solutions available as well.

To compile and run the source code, the following prerequisites are needed:

* node environment
* empty postgres database
* telegram bot
* unused solana wallet
- node environment
- empty postgres database
- telegram bot
- unused solana wallet

See `.env.example` for required information. Create a copy (`.env.`) and configure the environment.

1. clone repo
```sh
git clone https://github.com/mindrunner/fleetbot.git
```

```sh
git clone https://github.com/mindrunner/fleetbot.git
```

2. install dependencies

```sh
npm install
```

3. run database migrations

```sh
npm run typeorm migration:run
```
Expand All @@ -123,6 +132,7 @@ An official docker image is available and automatically build from `main` branch
to use `docker-compose`.

Example compose file:

```
version: '3.5'

Expand Down Expand Up @@ -155,7 +165,9 @@ For convenience, there is an officially hosted `fleetbot` available at `https://
See the following section on how to interact with the bot on telegram.

<!-- TELEGRAM -->

## Telegram

Interaction with `fleetbot` is possible with telegram. The bot has a `/help` command which explains all important
commands. Usage should be pretty straight forward as follows:

Expand Down Expand Up @@ -209,18 +221,18 @@ Commands for verified users:

<p align="right">(<a href="#readme-top">back to top</a>)</p>


<!-- ROADMAP -->

## Roadmap

- [] Migrate to SPL-Token 0.3.x interface
- [] Migrate to SPL-Token 0.3.x interface

See the [open issues](https://github.com/mindrunner/fleetbot/issues) for a full list of proposed features (and known issues).

<p align="right">(<a href="#readme-top">back to top</a>)</p>


<!-- CONTRIBUTING -->

## Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated**.
Expand All @@ -237,34 +249,40 @@ Don't forget to give the project a star! Thanks again!
<p align="right">(<a href="#readme-top">back to top</a>)</p>

<!-- DISCLAIMER -->

## Disclaimer

Before using this service or code, do your own research about crypto-world, metaverses, wallets and all the potential
danger in this universe.

- `fleetbot` is not responsible for any loss of funds
- `fleetbot` will never DM you
- `fleetbot` will never ask you for seed phrases or private keys
- `fleetbot` is not responsible for any loss of funds
- `fleetbot` will never DM you
- `fleetbot` will never ask you for seed phrases or private keys

<p align="right">(<a href="#readme-top">back to top</a>)</p>

<!-- LICENSE -->

## License

Distributed under the MIT License. See `LICENSE` for more information.

<p align="right">(<a href="#readme-top">back to top</a>)</p>

<!-- DONATIONS -->

## Donations

`fleetbot` accepts donations in `SOL`, `POLIS` or `USDC` at the same addresses it operates:
* fleetbot.sol
* ANDqa82T21G1RXwxpbf9v7jZXXfFSeezaUf7MJGTH6BZ

<p align="right">(<a href="#readme-top">back to top</a>)</p>
- fleetbot.sol
- ANDqa82T21G1RXwxpbf9v7jZXXfFSeezaUf7MJGTH6BZ

<p align="right">(<a href="#readme-top">back to top</a>)</p>

<!-- MARKDOWN LINKS & IMAGES -->
<!-- https://www.markdownguide.org/basic-syntax/#reference-style-links -->

[contributors-shield]: https://img.shields.io/github/contributors/mindrunner/fleetbot.svg?style=for-the-badge
[contributors-url]: https://github.com/mindrunner/fleetbot/graphs/contributors
[forks-shield]: https://img.shields.io/github/forks/mindrunner/fleetbot.svg?style=for-the-badge
Expand All @@ -275,7 +293,5 @@ Distributed under the MIT License. See `LICENSE` for more information.
[issues-url]: https://github.com/mindrunner/fleetbot/issues
[license-shield]: https://img.shields.io/github/license/mindrunner/fleetbot.svg?style=for-the-badge
[license-url]: https://github.com/mindrunner/fleetbot/blob/master/LICENSE

[node.js]: https://img.shields.io/badge/node.js-000000?style=for-the-badge&logo=nextdotjs&logoColor=white
[Node-url]: https://nodejs.org

3 changes: 3 additions & 0 deletions docker/scripts/basedbot.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

node main/basedbot
Loading