Git Product home page Git Product logo

nft-bot-v3's Introduction

NFT Bot for gTrade v6.x

This is the bot that executes limit orders for gTrade, the decentralized leveraged trading platform.

Run

Clone the repo & creat .env files

$ git clone [email protected]:GainsNetwork-org/nft-bot-v3.git
$ cp .env.polygon.example .env.polygon
$ cp .env.arbitrum.example .env.arbitrum
$ cp .env.mumbai.example .env.mumbai

Edit the .env.* files

(.env.polygon, .env.arbitrum and .env.mumbai)

  1. Set WSS_URLS to your dedicated WSS endpoints (comma separated list)
  2. Set PRIVATE_KEY to your account's private key
  3. Set PUBLIC_KEY to your account's public key
  4. Set ORACLE_ADDRESS to your Oracle contract address

Run the bots

$ docker-compose build
$ docker-compose up

Updating bots

To update all bot instances run the following:

docker-compose up --build --force-recreate -d

All Environment Variables

Name Description
LOG_LEVEL Sets the level at which the bot should log. Valid values are: error, warn, info, verbose, debug. Using debug will produce a massive amount of output and is not suggested except for initial setup or problem solving.
ENABLE_CONSOLE_LOGGING Whether or not log messages should be output to the console.
ENABLE_FS_LOGGING Whether or not log messages should be output to a log file. This will log into a .logs/<utc-date> directory each time the bot is started.
WSS_URLS The RPC endpoint URLs that should be used for all blockchain communication.
PRICES_URL The WSS endpoint where the Gains backend pricing service is running.
STORAGE_ADDRESS The address of the Gains Storage contract on chain.
PAIR_INFOS_ADDRESS The address of the Gains Pair Infos contract on chain.
PRIVATE_KEY The private key of your account that should be used to execute transactions. ⚠️ DO NOT PUBLISH THIS ANYWHERE. ⚠️
PUBLIC_KEY The public key of your account that should be used to execute transactions. IF ORACLE OPERATOR: Make sure this address is either owner() or authorized fulfiller on your oracle address in order to claim rewards.
EVENT_CONFIRMATIONS_SEC The number of seconds that must pass for an event coming from the blockchain to be considered as confirmed and safe for execution against.
MIN_PRIORITY_GWEI The minimum priority gas fee in GWEI that should be used when triggering orders.
MAX_GAS_PRICE_GWEI The maximum gas price in GWEI that should be used when triggering orders.
MAX_GAS_PER_TRANSACTION
PRIORITY_GWEI_MULTIPLIER A multiplier that can be applied to the current priority gas fee which was fetched from the polygon gas station.
VAULT_REFILL_ENABLED Whether or not you want the bot to participate in refilling the vault as a good citizen of the Gains Network.
CHECK_REFILL_SEC How frequently the vault refilling process should occur.
AUTO_HARVEST_SEC How frequently the bot will harvest any rewards earned from triggering orders.
FAILED_ORDER_TRIGGER_TIMEOUT_SEC How long the bot should wait before it will retry an order after it has failed to successfully process on chain.
OPEN_TRADES_REFRESH_SEC How frequently the bot should fully refresh trade data from the Gains smart contracts on chain. By default, the bot is keeping itself up to date based on delta events it's receiving from the chain so this isn't technically necessary, but it's a good fail safe in case the bot fails to hear about a certain even due to connectivity or other issues. Setting this to 0 will disable explicit refreshing and only ever keep state based on events it receives.
GAS_REFRESH_INTERVAL_SEC How frequently to get the latest gas prices from the gas station.
FETCH_TRADING_VARIABLES_REFRESH_INTERVAL_SEC How frequently trading variables should be refreshed from the Gains smart contracts on chain. There are many variables that go into the calculations of triggering order and these variables need to be freshed to ensure the bot is always using the latest numbers. This is always done at start up, but does not need to be done too frequently at runtime.
DRY_RUN Set to true to enable a "dry run" mode where the bot will do everything except submit the actual transactions to the chain for processing. This is good for initial setup to ensure everything is working as expected and other testing combined with a LOG_LEVEL of debug.
CHAIN_ID The ID of the block chain the bot is going to be interacting with. This defaults to 137 for Polygon's mainnet and you should only need to change it if you're targeting another chain.
NETWORK_ID The ID of the network of the block chain the bot is going to be interacting with. This defaults to 137 for Polygon's mainnet and you should only need to change it if you're targeting another chain.
CHAIN The name of the block chain the bot is going to be interacting with. This defaults to mainnet and you should only change it if you're targeting a different chain.
BASE_CHAIN The name of the base block chain the bot is going to be interacting with. This only needs to be set if you're testing on a network that is forked from a different chain. (e.g. testing on Polygon's Mumbai you would set this to goerli)
HARDFORK The ethereum hardfork of the block chain the bot is going to be interacting with. This defaults to london today and you should only need to change it if you're intending to target a different hardfork.
ENABLE_CONCURRENT_PRICE_UPDATE_PROCESSING Whether or not the bot should allow multiple price updates to be processed concurrently. This allows for faster reaction time when triggering orders rather than waiting on previous price update processing to complete. Defaults to true.
USE_MULTICALL Whether or not the bot should multicall fetching open orders and other information. Some RPC providers may restrict multicalls. Set to false to use call batching instead. Defaults to true
MAX_RETRIES How many times the bot should attempt to trigger an order. Set to -1 to disable.
ORACLE_ADDRESS FOR ORACLE OPERATORS ONLY: The address of your oracle. The PUBLIC_KEY you use to run the bot must either be an authorized fulfiller or the owner of the oracle contract

nft-bot-v3's People

Contributors

drub0y avatar gainsnetwork avatar 0xcrumb avatar thebuidler avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.