Giter Club home page Giter Club logo

liquidator-v3's Introduction

liquidator-v3

A script for liquidating undercollateralized account on Mango Markets.

Setup

To run the liquidator you will need:

  • A Solana account with some SOL deposited to cover transaction fees
  • A Mango Account with some collateral deposited
  • Your wallet keypair saved as a JSON file
  • node (v14+) and yarn
  • A clone of this repository
  • Dependencies installed with yarn install

Rebalancing

The liquidator will attempt to close all perp positions, and balance the tokens in the liqor account after each liquidation. By default it will sell all token assets into USDC. You can choose to maintain a certain amount of each asset through this process by editing the value in the TARGETS environment variable at the position of the asset. You can find the order of the assets in the 'oracles' property of the group in ids.json The program will attempt to make buy/sell orders during balancing to maintain this level.

Advanced Orders Triggering

The liquidator triggers advanced orders for users when their trigger condition is met. Upon successfully triggering the order, the liquidator wallet will receive 100x the transaction fee as a reward.

Run

yarn liquidator

The liquidator can be run in two different modes:

Mode 1: Scan for liquidatable accounts directly

The liquidator will connect to an RPC node websocket feed itself and request snapshots occasionally. This is simpler to get started with, as no separate service is needed to watch for potentially liquidatable accounts, but scanning for accounts can be slow.

To use this mode, leave LIQUIDATABLE_FEED_WEBSOCKET_ADDRESS unset.

Only this mode allows advanced order triggering.

Mode 2: Use a separate service to find liquidatable accounts

In this mode the https://github.com/blockworks-foundation/liquidatable-accounts-feed service provides information about potentially liquidatable accounts to the liquidator.

The external service is much faster at scanning for newly liquidatable accounts when the price cache is updated than Mode 1.

To use it, set up the liquidatable-accounts-feed service (probably on the same machine) and then set the liquidator's LIQUIDATABLE_FEED_WEBSOCKET_ADDRESS to the other service's websocket_server_bind_address.

This mode never triggers advanced orders.

Environment Variables

Variable Default Description
CLUSTER mainnet The Solana cluster to use
ENDPOINT_URL https://mango.rpcpool.com/946ef7337da3f5b8d3e4a34e7f88 Your RPC node endpoint
KEYPAIR ${HOME}/.config/solana/id.json The location of your wallet keypair
GROUP mainnet.1 Name of the group in ids.json to run the Liquidator against
TARGETS 0 0 0 0 0 0 0 0 Space separated list of the amount of each asset to maintain when rebalancing
INTERVAL 3500 Milliseconds to wait before checking for sick accounts
INTERVAL_ACCOUNTS 600000 Milliseconds to wait before reloading all Mango accounts
INTERVAL_WEBSOCKET 300000 Milliseconds to wait before reconnecting to the websocket
INTERVAL_REBALANCE 10000 Milliseconds to wait before doing another account rebalance
LIQOR_PK N/A Liqor Mango Account Public Key, by default uses the largest value account owned by the keypair
WEBHOOK_URL N/A Discord webhook URL to post liquidation events and errors to
LIAB_LIMIT 0.9 Percentage of your available margin to use when taking on liabilities
MIN_EQUITY 0 Minimum account equity required to liquidate
LIQUIDATABLE_FEED_WEBSOCKET_ADDRESS N/A Websocket URL of the liquidatable-accounts-feed service, see above
COMMITMENT_LEVEL processed Commitment level for the connection
CONFIRMATION_TIMEOUT 30000 Milliseconds to wait for transaction confirmation

You can add these variables to a .env file in the project root to load automatically on liquidator startup. For example:

ENDPOINT_URL=https://solana-api.projectserum.com
KEYPAIR=${HOME}/.config/solana/my-keypair.json
TARGETS=500 0.1 0.75 0 0 0 0 0

liquidator-v3's People

Contributors

ckamm avatar mschneider avatar odyzzey avatar ricardojmendez avatar riordanp avatar silas-x 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

liquidator-v3's Issues

Failed to liquidate account error, this.connection.getLatestBlockhash is not a function

Failed to liquidate account 2doMDoNXGoT64j7AumDR4uSgq3N37ZXZRAUCEHuZR4A1: TypeError: this.connection.getLatestBlockhash is not a function

Is this an error due to the server or from the type script?
Failed to liquidate account 7BNrgWmyha1dVgJ6j8gFHi1Tom6Mrac4du1jp9tncDq4: TypeError: this.connection.getLatestBlockhash is not a function at MangoClient.<anonymous> (/Users/yii/Documents/Code/liquidator-v3/node_modules/@blockworks-foundation/mango-client/src/client.ts:236:48)

Cannot Push this onto Heroku

Intention:
Even with a simple node app.js file to simply print "hello world" on the screen, while having the liquidator script run in the background does not work because you can't push a yarn.lock file whose dependencies do not match the package.json's onto Heroku.

Is there a fix around this?

Error from Heroku and when running "yarn check --prodution --verify-tree":

error "@solana/web3.js#borsh#@types/bn.js" is wrong version: expected "^4.11.5", got "5.1.0"
error "@solana/web3.js#secp256k1#elliptic#bn.js" is wrong version: expected "^4.11.9", got "5.1.3"

Error from Heroku and when running "yarn check":
error Lockfile does not contain pattern: "@solana/[email protected]"
error Lockfile does not contain pattern: "bn.js@^5.2.0"

Error from Heroku push:

-----> Build failed
! Outdated Yarn lockfile
Your application contains a Yarn lockfile (yarn.lock) which does not
match the dependencies in package.json. This can happen if you use npm
to install or update a dependency instead of Yarn.
Please run the following command in your application directory and check
in the new yarn.lock file:
$ yarn install
$ git add yarn.lock
$ git commit -m "Updated Yarn lockfile"
$ git push heroku main

Error Question

Started awaiting confirmation for 5G9A2K82Ni21yfePd2d1gidwu7ajjh9H7jNGB3Rtpg77cYE8nYakVJaL5cWUdVSPaVcNeBbuBh2BdKSS4CLuh5po size: 804

Failed to liquidate account 5YT87jzUhwHyKeYg1KYhJm1nr1HJ3UCZfZcFgsKB7feV: Error: Transaction failed: MangoErrorCode::NotLiquidatable; src/processor.rs:3276

Could not match OpenOrdersAccount to MangoAccount

What does "Could not match OpenOrdersAccount to MangoAccount" mean by this?
Is it the taker or maker account?

out of memory error

It keeps trying to liquidate the same account and eventually runs out of memory with the following error:

Perps:
Market: Base Pos / Quote Pos / Unsettled Funding / Health
MNGO-PERP: 0.0000 / 0.0000 / 0.0000 / 0.0000
BTC-PERP: 0.0000 / 0.0000 / 0.0000 / 0.0000
ETH-PERP: 0.0000 / 0.0000 / 0.0000 / 0.0000
SOL-PERP: 0.0000 / 0.0000 / 0.0000 / 0.0000
SRM-PERP: 0.0000 / 0.0000 / 0.0000 / 0.0000
RAY-PERP: 0.0000 / 0.0000 / 0.0000 / 0.0000
FTT-PERP: 0.0000 / 0.0000 / 0.0000 / 0.0000
ADA-PERP: 0.0000 / 0.0000 / 0.0000 / 0.0000
Started awaiting confirmation for 56CCRHz99auuEuEKovEV3AAvBoT9nsFyZrxCqp1mFWVHreF4DWDGobNQwRGgxuj9p37Z66pXt8Q3cXieHLt35JUX size: 483
Mon, 15 Nov 2021 11:39:31 GMT sending tx 56CCRHz99auuEuEKovEV3AAvBoT9nsFyZrxCqp1mFWVHreF4DWDGobNQwRGgxuj9p37Z66pXt8Q3cXieHLt35JUX
Liquidated account 75Zbdkoh7ym9zeYe5Zgukfe8PHHo3EFgrsy3bqapoyHB
Refreshing accounts...
Sick account 75Zbdkoh7ym9zeYe5Zgukfe8PHHo3EFgrsy3bqapoyHB health ratio: -99.76381300873988777766
MangoAccount 75Zbdkoh7ym9zeYe5Zgukfe8PHHo3EFgrsy3bqapoyHB
Owner: DLEeT1kZ6q5kHPsSyAYz67SGDn2qHPsVt1HaGDsKc8L
Maint Health Ratio: -99.7638
Maint Health: -17.2531
Init Health: -18.8298
Equity: 0.3256
isBankrupt: false
beingLiquidated: true
Spot:
Token: Net Balance / Base In Orders / Quote In Orders
BTC: -0.0000 / 0.0000 / 0.0000
SOL: 0.0000 / 0.0000 / 0.0000
Perps:
Market: Base Pos / Quote Pos / Unsettled Funding / Health
MNGO-PERP: 0.0000 / 0.0000 / 0.0000 / 0.0000
BTC-PERP: 0.0000 / 0.0000 / 0.0000 / 0.0000
ETH-PERP: 0.0000 / 0.0000 / 0.0000 / 0.0000
SOL-PERP: 0.0000 / 0.0000 / 0.0000 / 0.0000
SRM-PERP: 0.0000 / 0.0000 / 0.0000 / 0.0000
RAY-PERP: 0.0000 / 0.0000 / 0.0000 / 0.0000
FTT-PERP: 0.0000 / 0.0000 / 0.0000 / 0.0000
ADA-PERP: 0.0000 / 0.0000 / 0.0000 / 0.0000
Started awaiting confirmation for 5tLb1cT2fKbrrxiBYcVZ8MurCniXJZFEgaFyAaQjqoQG12Q6SB3ZNyn9CYrKS6edKQ31gh9fTTTcWVKD6qTgZ61b size: 483
Mon, 15 Nov 2021 11:39:42 GMT sending tx 5tLb1cT2fKbrrxiBYcVZ8MurCniXJZFEgaFyAaQjqoQG12Q6SB3ZNyn9CYrKS6edKQ31gh9fTTTcWVKD6qTgZ61b
REST confirmed 5tLb1cT2fKbrrxiBYcVZ8MurCniXJZFEgaFyAaQjqoQG12Q6SB3ZNyn9CYrKS6edKQ31gh9fTTTcWVKD6qTgZ61b {
confirmationStatus: 'processed',
confirmations: 0,
err: null,
slot: 106999639,
status: { Ok: null }
}
Liquidated account 75Zbdkoh7ym9zeYe5Zgukfe8PHHo3EFgrsy3bqapoyHB

<--- Last few GCs --->

[13604:0x130008000] 157593 ms: Scavenge (reduce) 2045.1 (2082.8) -> 2044.7 (2083.3) MB, 3.5 / 0.0 ms (average mu = 0.315, current mu = 0.264) allocation failure
[13604:0x130008000] 159614 ms: Mark-sweep (reduce) 2045.6 (2083.3) -> 2045.1 (2084.1) MB, 1516.9 / 0.0 ms (+ 60.0 ms in 12 steps since start of marking, biggest step 11.8 ms, walltime since start of marking 1587 ms) (average mu = 0.273, current mu = 0.

<--- JS stacktrace --->

FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
1: 0x100f2f380 node::Abort() [/usr/local/bin/node]
2: 0x100f2f508 node::errors::TryCatchScope::~TryCatchScope() [/usr/local/bin/node]
3: 0x10107b8a4 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/usr/local/bin/node]
4: 0x10107b838 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/usr/local/bin/node]
5: 0x101217da4 v8::internal::Heap::GarbageCollectionReasonToString(v8::internal::GarbageCollectionReason) [/usr/local/bin/node]
6: 0x1012168e4 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/usr/local/bin/node]
7: 0x101221998 v8::internal::Heap::AllocateRawWithLightRetrySlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/usr/local/bin/node]
8: 0x101221a2c v8::internal::Heap::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/usr/local/bin/node]
9: 0x1011f4e6c v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationType, v8::internal::AllocationOrigin) [/usr/local/bin/node]
10: 0x101527788 v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [/usr/local/bin/node]
11: 0x10183158c Builtins_CEntry_Return1_DontSaveFPRegs_ArgvOnStack_NoBuiltinExit [/usr/local/bin/node]
12: 0x10189be18 Builtins_CreateTypedArray [/usr/local/bin/node]
13: 0x105a6288c
14: 0x105b4d0cc
15: 0x105b4be1c
16: 0x1017c5cb8 Builtins_InterpreterEntryTrampoline [/usr/local/bin/node]
17: 0x1017c5cb8 Builtins_InterpreterEntryTrampoline [/usr/local/bin/node]
18: 0x10184c008 Builtins_ArrayMap [/usr/local/bin/node]
19: 0x1017c5cb8 Builtins_InterpreterEntryTrampoline [/usr/local/bin/node]
20: 0x1017f6fac Builtins_GeneratorPrototypeNext [/usr/local/bin/node]
21: 0x1017c5cb8 Builtins_InterpreterEntryTrampoline [/usr/local/bin/node]
22: 0x101877898 Builtins_PromiseFulfillReactionJob [/usr/local/bin/node]
23: 0x1017e7734 Builtins_RunMicrotasks [/usr/local/bin/node]
24: 0x1017c3984 Builtins_JSRunMicrotasksEntry [/usr/local/bin/node]
25: 0x1011a502c v8::internal::(anonymous namespace)::Invoke(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&) [/usr/local/bin/node]
26: 0x1011a5460 v8::internal::(anonymous namespace)::InvokeWithTryCatch(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&) [/usr/local/bin/node]
27: 0x1011a5528 v8::internal::Execution::TryRunMicrotasks(v8::internal::Isolate*, v8::internal::MicrotaskQueue*, v8::internal::MaybeHandlev8::internal::Object) [/usr/local/bin/node]
28: 0x1011c81e8 v8::internal::MicrotaskQueue::RunMicrotasks(v8::internal::Isolate
) [/usr/local/bin/node]
29: 0x1011c8064 v8::internal::MicrotaskQueue::PerformCheckpoint(v8::Isolate*) [/usr/local/bin/node]
30: 0x1017c8354 Builtins_CallApiCallback [/usr/local/bin/node]
31: 0x105b1cc90
32: 0x1017c3aac Builtins_JSEntryTrampoline [/usr/local/bin/node]
33: 0x1017c3744 Builtins_JSEntry [/usr/local/bin/node]
34: 0x1011a5064 v8::internal::(anonymous namespace)::Invoke(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&) [/usr/local/bin/node]
35: 0x1011a46f8 v8::internal::Execution::Call(v8::internal::Isolate*, v8::internal::Handlev8::internal::Object, v8::internal::Handlev8::internal::Object, int, v8::internal::Handlev8::internal::Object) [/usr/local/bin/node]
36: 0x101097534 v8::Function::Call(v8::Localv8::Context, v8::Localv8::Value, int, v8::Localv8::Value
) [/usr/local/bin/node]
37: 0x100e7ee40 node::InternalCallbackScope::Close() [/usr/local/bin/node]
38: 0x100e7f36c node::InternalMakeCallback(node::Environment*, v8::Localv8::Object, v8::Localv8::Object, v8::Localv8::Function, int, v8::Localv8::Value, node::async_context) [/usr/local/bin/node]
39: 0x100e944ac node::AsyncWrap::MakeCallback(v8::Localv8::Function, int, v8::Localv8::Value
) [/usr/local/bin/node]
40: 0x100fca338 node::(anonymous namespace)::CompressionStream<node::(anonymous namespace)::ZlibContext>::AfterThreadPoolWork(int) [/usr/local/bin/node]
41: 0x1017a40f4 uv__work_done [/usr/local/bin/node]
42: 0x1017a7854 uv__async_io [/usr/local/bin/node]
43: 0x1017b9568 uv__io_poll [/usr/local/bin/node]
44: 0x1017a7ce4 uv_run [/usr/local/bin/node]
45: 0x100e7fe00 node::SpinEventLoop(node::Environment*) [/usr/local/bin/node]
46: 0x100f686c0 node::NodeMainInstance::Run(int*, node::Environment*) [/usr/local/bin/node]
47: 0x100f6838c node::NodeMainInstance::Run(node::EnvSerializeInfo const*) [/usr/local/bin/node]
48: 0x100f0134c node::Start(int, char**) [/usr/local/bin/node]
49: 0x1056f90f4
error Command failed with signal "SIGABRT".
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Issue with liquidations

Hello,

I've been playing around and testing out the liquidator bot. So far it's pretty awesome and I've enjoyed learning about how it works and the general liquidation process. That being said, I haven't actually been successful in performing a liquidation. I have run the bot for 24+ hours and have come across quite a few errors which I wanted to point out below.

The most common error I've encountered is Transaction failed: MangoErrorCode::InvalidParam. From my understanding, this error results when you were not the first to execute the liquidation as mentioned in Issue #7

Fri, 03 Dec 2021 19:18:18 GMT  sending tx  4vdD9PBUX86FMCScc55gNLPnym1Wpi1Pk3GMC7He8mAsDtmgEcTqkbj1hjY9G2BAdMr9u8yx5r3UcDBt2ct5VKSG
REST error for 4vdD9PBUX86FMCScc55gNLPnym1Wpi1Pk3GMC7He8mAsDtmgEcTqkbj1hjY9G2BAdMr9u8yx5r3UcDBt2ct5VKSG {
  confirmationStatus: 'processed',
  confirmations: 0,
  err: { InstructionError: [ 0, [Object] ] },
  slot: 109910945,
  status: { Err: { InstructionError: [Array] } }
}
Failed to execute trigger order for 31mrAbssy2w5ZpDgJgQU7UAFfRPSTbQNBXrTqn1LUyEM Error: Transaction failed: MangoErrorCode::InvalidParam; src/processor.rs:4524
    at MangoClient.<anonymous> (C:\Users\zarko\Desktop\MangoLiq\liquidator-v3\node_modules\@blockworks-foundation\mango-client\src\client.ts:276:21)
    at Generator.next (<anonymous>)
    at fulfilled (C:\Users\zarko\Desktop\MangoLiq\liquidator-v3\node_modules\@blockworks-foundation\mango-client\lib\src\client.js:5:58)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)

Besides this error, I have experienced the following timeout issue. This error usually results after the CLI spams sending tx for a few minutes.

Timed out for txid 3W1yF5z5Hn64DuxC7vyibXxbuEysvBk7XjmQNChtczLT5ZFsBARzZW9Rj3oA75oVeexw3po2GfPQsXHYZaB4yMpV
Failed to execute trigger order for 3mZEubS5b3wyZrVSrALU1JpEUdnFELAvFzdyEmCYYbDT Error: Timed out awaiting confirmation on transaction

I've also experienced this error as well:
Failed to liquidate account 3cj8aQtAFe2rzXhYVP2wUBZJVutSeKJDCh3bkjwJukce Error: "BlockhashNotFound"

This one:
Could not match OpenOrdersAccount to MangoAccount

And this one as well:
Failed to liquidate account 8zq5hsJgtCDvMe432N1gzjmyetzrutse8XwjgeWCyFCh Error: Transaction failed: MangoErrorCode::InvalidPriceCache Cache the oracle price to resolve; src/state.rs:588

I'm not sure if all of these errors are related or are completely different issues.

Finally, after observing the logs and going through them, I thought I had found a few examples of where the bot managed to liquidate successfully as the following was displayed on the logs:

Watching accounts... Liquidated account 7nx81DsbC7rmANwZbykVxR3TsQ1HXBhVhAaGYi5TKt41

Unfortunately, after checking Mango Markets > History > Liquidations nothing shows up and the starting balance has not changed.

I apologize for the long post. I was just curious if you could provide some more insight on why these errors are occurring and also if this is normal or out of the ordinary. The bot has been running during a pretty volatile day in the markets so I excepted to have at least one successful liquidation.

Any help would be greatly appreciated. Thank you in advance!

EDIT: I'm using the default .env config. I have also tried playing around and modifying INTERVAL, INTERVAL_ACCOUNTS, and INTERVAL_WEBSOCKET so they are faster however, the same issues still persist. My test mango account currently has a small amount of $140 USDC as collateral.

Consistent Transaction Errors

When running the liquidator, two errors consistently appear:

  1. Transaction failed: MangoErrorCode::InvalidParam
  2. Transaction failed: MangoErrorCode::TriggerConditionFalse The trigger condition for this TriggerOrder is not met

Any thoughts on how to resolve these errors?

Full logs follow:

Executing order for account H1bT2TXvQgVeUnS7bo1ZToov9oPqn7NmXFGsuf5JAf3Z
Started awaiting confirmation for 5oidV1QFLsCWLUsg1Qc8pzoYoYqsoaBYbR4XUz5atojSJaaK4Eg8P4RBYw2LsPNiJGYmB4GAtPVLhFC3c8LeNKSX size: 439
Thu, 02 Dec 2021 15:28:58 GMT  sending tx  5oidV1QFLsCWLUsg1Qc8pzoYoYqsoaBYbR4XUz5atojSJaaK4Eg8P4RBYw2LsPNiJGYmB4GAtPVLhFC3c8LeNKSX
Failed to execute trigger order for H1bT2TXvQgVeUnS7bo1ZToov9oPqn7NmXFGsuf5JAf3Z Error: Transaction failed: MangoErrorCode::InvalidParam; src/processor.rs:4524
    at MangoClient.<anonymous> (/home/ubuntu/liquidator-v3/node_modules/@blockworks-foundation/mango-client/src/client.ts:277:21)
    at Generator.next (<anonymous>)
    at fulfilled (/home/ubuntu/liquidator-v3/node_modules/@blockworks-foundation/mango-client/lib/src/client.js:5:58)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
Refreshing accounts...
getAllMangoAccounts: 28.811s
Fetched 13138 accounts
Refreshing accounts...
Watching accounts...
getAllMangoAccounts: 31.274s
Fetched 13138 accounts
Executing order for account H1bT2TXvQgVeUnS7bo1ZToov9oPqn7NmXFGsuf5JAf3Z
Started awaiting confirmation for 5hjoztFDmZMeNXV9YCuSnYNLmBZj7AQQPkhbDoqeGgU4myGyee1aY5AzrHuWjuaCPXR2wAamZSZ5DovPumMyE3HK size: 439
Thu, 02 Dec 2021 15:33:19 GMT  sending tx  5hjoztFDmZMeNXV9YCuSnYNLmBZj7AQQPkhbDoqeGgU4myGyee1aY5AzrHuWjuaCPXR2wAamZSZ5DovPumMyE3HK
Thu, 02 Dec 2021 15:33:21 GMT  sending tx  5hjoztFDmZMeNXV9YCuSnYNLmBZj7AQQPkhbDoqeGgU4myGyee1aY5AzrHuWjuaCPXR2wAamZSZ5DovPumMyE3HK
Thu, 02 Dec 2021 15:33:23 GMT  sending tx  5hjoztFDmZMeNXV9YCuSnYNLmBZj7AQQPkhbDoqeGgU4myGyee1aY5AzrHuWjuaCPXR2wAamZSZ5DovPumMyE3HK
Thu, 02 Dec 2021 15:33:25 GMT  sending tx  5hjoztFDmZMeNXV9YCuSnYNLmBZj7AQQPkhbDoqeGgU4myGyee1aY5AzrHuWjuaCPXR2wAamZSZ5DovPumMyE3HK
Failed to execute trigger order for H1bT2TXvQgVeUnS7bo1ZToov9oPqn7NmXFGsuf5JAf3Z Error: Transaction failed: MangoErrorCode::TriggerConditionFalse The trigger condition for this TriggerOrder is not met; src/processor.rs:4550
    at MangoClient.<anonymous> (/home/ubuntu/liquidator-v3/node_modules/@blockworks-foundation/mango-client/src/client.ts:277:21)
    at Generator.next (<anonymous>)
    at fulfilled (/home/ubuntu/liquidator-v3/node_modules/@blockworks-foundation/mango-client/lib/src/client.js:5:58)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
Executing order for account H1bT2TXvQgVeUnS7bo1ZToov9oPqn7NmXFGsuf5JAf3Z
Started awaiting confirmation for 38Cc1N6T3e2hUkAq69gcNQsCMkYSFCSbqQkHx14oAscNzKKnD2BjmCrS3FRFRHYXsYMbJEYhwRAHHhzbHmiPyWYr size: 439
Thu, 02 Dec 2021 15:33:58 GMT  sending tx  38Cc1N6T3e2hUkAq69gcNQsCMkYSFCSbqQkHx14oAscNzKKnD2BjmCrS3FRFRHYXsYMbJEYhwRAHHhzbHmiPyWYr
Thu, 02 Dec 2021 15:34:00 GMT  sending tx  38Cc1N6T3e2hUkAq69gcNQsCMkYSFCSbqQkHx14oAscNzKKnD2BjmCrS3FRFRHYXsYMbJEYhwRAHHhzbHmiPyWYr
Thu, 02 Dec 2021 15:34:02 GMT  sending tx  38Cc1N6T3e2hUkAq69gcNQsCMkYSFCSbqQkHx14oAscNzKKnD2BjmCrS3FRFRHYXsYMbJEYhwRAHHhzbHmiPyWYr
REST error for 38Cc1N6T3e2hUkAq69gcNQsCMkYSFCSbqQkHx14oAscNzKKnD2BjmCrS3FRFRHYXsYMbJEYhwRAHHhzbHmiPyWYr {
  slot: 109734384,
  confirmations: 0,
  status: { Err: { InstructionError: [Array] } },
  err: { InstructionError: [ 0, [Object] ] },
  confirmationStatus: 'processed'
}
Failed to execute trigger order for H1bT2TXvQgVeUnS7bo1ZToov9oPqn7NmXFGsuf5JAf3Z Error: Transaction failed: MangoErrorCode::InvalidParam; src/processor.rs:4524
    at MangoClient.<anonymous> (/home/ubuntu/liquidator-v3/node_modules/@blockworks-foundation/mango-client/src/client.ts:277:21)
    at Generator.next (<anonymous>)
    at fulfilled (/home/ubuntu/liquidator-v3/node_modules/@blockworks-foundation/mango-client/lib/src/client.js:5:58)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

Issues with connecting to Mango

I've been running into a few errors like these:
Error reloading accounts Error: 522 undefined:
Sometimes 525, sometimes 521 and so on, followed by a dump of the web site. Is this expected, or is there anything I can do to avoid it?

Question: Advanced orders handling in the code

Thank you so much for providing us this code base. I got a perhaps a newbie questions:

There is a section in the code where you have:

if(checkTriggers) on advanced orders. I looked into the code.

What is the purpose of this section of codes? and it created an object mangoAccountsWithAOs, but seems like it was not used anywhere after?

I am asking because there's a lot of api requests that keeps on fetching getMultipleAccounts()

Screen Shot 2022-07-10 at 23 04 19

Error about 'data' of 'object null' as it is null

At some point I am getting this error

Error checking accounts: TypeError: Cannot destructure property 'data' of 'object null' as it is null.
    at C:\Users\Administrator\Desktop\liquidator-v3\node_modules\@blockworks-foundation\mango-client\src\utils\utils.ts:463:8
    at Array.map (<anonymous>)
    at C:\Users\Administrator\Desktop\liquidator-v3\node_modules\@blockworks-foundation\mango-client\src\utils\utils.ts:462:28
    at Generator.next (<anonymous>)

How do I resolve this issue?

Some error questions

fHgVTd6vMCuPZQYkKWG2XmRq8eFHRKHm8w93dg5Whgr
Failed to execute trigger order for fHgVTd6vMCuPZQYkKWG2XmRq8eFHRKHm8w93dg5Whgr: TypeError: this.connection.getLatestBlockhash is not a function
Executing order for account fHgVTd6vMCuPZQYkKWG2XmRq8eFHRKHm8w93dg5Whgr
Failed to execute trigger order for fHgVTd6vMCuPZQYkKWG2XmRq8eFHRKHm8w93dg5Whgr: TypeError: this.connection.getLatestBlockhash is not a function

Hi,Why do these errors occur?

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.