Giter Site home page Giter Site logo

bluna-bot's Introduction

bLUNA Bot

Automates swapping between LUNA and bLUNA in the Terra blockchain via Terraswap.

Usage

This repository currently contains two packages:

  • bluna-bot-pkg: a helper library which contains the main logic and API calls needed
  • bluna-bot-cli: a node CLI wrapper for the bluna-bot-pkg package

If you just want to start using this, refer to bluna-bot-cli.

If you are a developer and want more freedom, you may refer to bluna-bot-pkg to create your own custom runner.

bluna-bot's People

Contributors

aaroncql avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

bluna-bot's Issues

Chain-ID required but not specified

My bot can't seem to execute the trade and encounters the error "chain-id required but not specified", with "Request failed with status code 401". Was wondering if anyone here could help me with this? :) Sorry for the noob question, I'm completely clueless about this!
Bot Error

Slippage

I know that you said slippage won't be affected by the min-gain and max-loss percentages. But sometimes unfortunately when those percentages are really tight, the slippage can still cause unprofitable trades. I know this can be fixed by accounting for this in the slippage as well as the min-gain and max-loss settings, but I was just wondering if it would be possible for you to make setting a specific slippage % be optional, but relying more on whether we still are within the min-gain and max-loss settings.

Basically, if a swap is attempted, before executing we make sure that the slippage hasn't exceeded the min-gain or max-loss, and using those as whether or not the swap gets cancelled or completed.

Thank you so much

Columbus 5

Is this bot still supported after Columbus 5 upgrade?

ATB in NUS CS!

Feature Request: Telegram Bot

Would it be possible to get the bot to send a summary to a Telegram bot?
I would love if my telegram bot could be telling me the current Luna > bLuna & bLuna > Luna swap rates constantly throughout the day (at the same interval set in the bot), and maybe even the option to message me when the bot has made a swap, and the details of the swap.

Just thought of this and tried to get it working myself with the Harpoon Protocol telegram bot, but if we already have a bot running, having it baked in to the same bot would be cool I think. Let me know what you think.

Error upon running bot

Hey, just getting an error when running the bot. Not sure if it's an issue, if it's me, or if it's Terra itself.
Thought I'd copy the error text here. Hopefully it's helpful, or you can tell me what I'm doing wrong ๐Ÿคฃ
Thank you for all your help.

Error: getaddrinfo ENOTFOUND lcd.terra.dev
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:69:26) {
  errno: -3008,
  code: 'ENOTFOUND',
  syscall: 'getaddrinfo',
  hostname: 'lcd.terra.dev',
  config: {
    url: '/wasm/contracts/terra1kc87mu460fwkqte29rquh4hc20m54fxwtsx7gp/store',
    method: 'get',
    headers: { Accept: 'application/json', 'User-Agent': 'axios/0.21.1' },
    params: {
      query_msg: '{"balance":{"address":"terra1m43rpw28grr3530j4rl99g0t7cmgqzh7rah9g8"}}'
    },
    baseURL: 'https://lcd.terra.dev',
    transformRequest: [ [Function: transformRequest] ],
    transformResponse: [ [Function: transformResponse] ],
    timeout: 0,
    adapter: [Function: httpAdapter],
    xsrfCookieName: 'XSRF-TOKEN',
    xsrfHeaderName: 'X-XSRF-TOKEN',
    maxContentLength: -1,
    maxBodyLength: -1,
    validateStatus: [Function: validateStatus],
    data: undefined
  },
  request: <ref *1> Writable {
    _writableState: WritableState {
      objectMode: false,
      highWaterMark: 16384,
      finalCalled: false,
      needDrain: false,
      ending: false,
      ended: false,
      finished: false,
      destroyed: false,
      decodeStrings: true,
      defaultEncoding: 'utf8',
      length: 0,
      writing: false,
      corked: 0,
      sync: true,
      bufferProcessing: false,
      onwrite: [Function: bound onwrite],
      writecb: null,
      writelen: 0,
      afterWriteTickInfo: null,
      buffered: [],
      bufferedIndex: 0,
      allBuffers: true,
      allNoop: true,
      pendingcb: 0,
      prefinished: false,
      errorEmitted: false,
      emitClose: true,
      autoDestroy: true,
      errored: null,
      closed: false
    },
    _events: [Object: null prototype] {
      response: [Function: handleResponse],
      error: [Function: handleRequestError]
    },
    _eventsCount: 2,
    _maxListeners: undefined,
    _options: {
      maxRedirects: 21,
      maxBodyLength: 10485760,
      protocol: 'https:',
      path: '/wasm/contracts/terra1kc87mu460fwkqte29rquh4hc20m54fxwtsx7gp/store?query_msg=%7B%22balance%22:%7B%22address%22:%22terra1m43rpw28grr3530j4rl99g0t7cmgqzh7rah9g8%22%7D%7D',
      method: 'GET',
      headers: [Object],
      agent: undefined,
      agents: [Object],
      auth: undefined,
      hostname: 'lcd.terra.dev',
      port: null,
      nativeProtocols: [Object],
      pathname: '/wasm/contracts/terra1kc87mu460fwkqte29rquh4hc20m54fxwtsx7gp/store',
      search: '?query_msg=%7B%22balance%22:%7B%22address%22:%22terra1m43rpw28grr3530j4rl99g0t7cmgqzh7rah9g8%22%7D%7D'
    },
    _ended: true,
    _ending: true,
    _redirectCount: 0,
    _redirects: [],
    _requestBodyLength: 0,
    _requestBodyBuffers: [],
    _onNativeResponse: [Function (anonymous)],
    _currentRequest: ClientRequest {
      _events: [Object: null prototype],
      _eventsCount: 7,
      _maxListeners: undefined,
      outputData: [],
      outputSize: 0,
      writable: true,
      destroyed: false,
      _last: true,
      chunkedEncoding: false,
      shouldKeepAlive: false,
      _defaultKeepAlive: true,
      useChunkedEncodingByDefault: false,
      sendDate: false,
      _removedConnection: false,
      _removedContLen: false,
      _removedTE: false,
      _contentLength: 0,
      _hasBody: true,
      _trailer: '',
      finished: true,
      _headerSent: true,
      socket: [TLSSocket],
      _header: 'GET /wasm/contracts/terra1kc87mu460fwkqte29rquh4hc20m54fxwtsx7gp/store?query_msg=%7B%22balance%22:%7B%22address%22:%22terra1m43rpw28grr3530j4rl99g0t7cmgqzh7rah9g8%22%7D%7D HTTP/1.1\r\n' +
        'Accept: application/json\r\n' +
        'User-Agent: axios/0.21.1\r\n' +
        'Host: lcd.terra.dev\r\n' +
        'Connection: close\r\n' +
        '\r\n',
      _keepAliveTimeout: 0,
      _onPendingData: [Function: noopPendingOutput],
      agent: [Agent],
      socketPath: undefined,
      method: 'GET',
      maxHeaderSize: undefined,
      insecureHTTPParser: undefined,
      path: '/wasm/contracts/terra1kc87mu460fwkqte29rquh4hc20m54fxwtsx7gp/store?query_msg=%7B%22balance%22:%7B%22address%22:%22terra1m43rpw28grr3530j4rl99g0t7cmgqzh7rah9g8%22%7D%7D',
      _ended: false,
      res: null,
      aborted: false,
      timeoutCb: null,
      upgradeOrConnect: false,
      parser: null,
      maxHeadersCount: null,
      reusedSocket: false,
      host: 'lcd.terra.dev',
      protocol: 'https:',
      _redirectable: [Circular *1],
      [Symbol(kCapture)]: false,
      [Symbol(kNeedDrain)]: false,
      [Symbol(corked)]: 0,
      [Symbol(kOutHeaders)]: [Object: null prototype]
    },
    _currentUrl: 'https://lcd.terra.dev/wasm/contracts/terra1kc87mu460fwkqte29rquh4hc20m54fxwtsx7gp/store?query_msg=%7B%22balance%22:%7B%22address%22:%22terra1m43rpw28grr3530j4rl99g0t7cmgqzh7rah9g8%22%7D%7D',
    [Symbol(kCapture)]: false
  },
  response: undefined,
  isAxiosError: true,
  toJSON: [Function: toJSON]
}

Unknown error encountered! Stopping program...

feat: separate swap amount settings for luna and bluna

Separate current minSwapAmount and maxSwapAmount to 4 different settings: minLunaSwapAmount, maxLunaSwapAmount, minBlunaSwapAmount, and maxBlunaSwapAmount.

This allows for more use cases like limiting the max amount of luna to be swapped, but always allowing all bluna to be swapped back to luna.

bug: slippage cannot be set resulting in unfavourable swaps

The bot was triggered to make a swap at a gain of 6.7%, but by the time it swapped, it was only 1%.
Luna to bLuna swap: https://finder.terra.money/columbus-4/tx/4B88F20887941A57725C25B7EE0FA4FC712BA31DC66DF34CC0D319FFD72D3D64

bLuna to Luna swap: https://finder.terra.money/columbus-4/tx/EB367C33DE33B4ACE250172E1AD41C1B2C0E0F65069F1CA6C568BC33F3160EA2

Obviously it shouldn't have swapped at this low of a gain percentage. I've also noticed since the update that every transaction now has 2 Contracts. "Executed increase_allowance" and "Executed swap", I'm not sure what increase_allowance does, but the first swap was correct in the amount of bluna that should've been received, but by the time it executed swap, it was missed.

Could you shed any light on this for me so I can understand?

Thank you

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.