Skip to content
This repository has been archived by the owner on Feb 13, 2024. It is now read-only.

Account is not prepared for group exception #1

Closed
joemccann opened this issue Aug 10, 2021 · 7 comments
Closed

Account is not prepared for group exception #1

joemccann opened this issue Aug 10, 2021 · 7 comments

Comments

@joemccann
Copy link

joemccann commented Aug 10, 2021

Great writeup on how to run a liquidator. However, when I get to the dry run for running the liquidator I got the following exception and the liquidator terminates.

Exception: Account 'Dd8sgey2VD1uo5jBJfwJAdfi2GZAvULcoSqAy87jQGBT' is not prepared for group '2oogpTYm1sp6LPZAWD3bp2wsFpnV2kXL1s52yyFhW5vp'.

Any ideas?

@joemccann joemccann changed the title Account is no prepared for group exception Account is not prepared for group exception Aug 10, 2021
@OpinionatedGeek
Copy link
Contributor

There should be some error output before that, and that should describe the root problem. Can you share that?

If you're not seeing any error output before that, can you try passing the parameter --log-level INFO as well as the other parameters?

The 'is not prepared for group' is a general exception thrown after the AccountScout performs a bunch of checks and generates a report with errors and warnings. The liquidator can still run if there are some warnings, but errors mean there's a problem somewhere we need to deal with before the liquidator can safely, properly run.

@joemccann
Copy link
Author

Thanks for such a quick reply!

Here's the full output:

N|S /var/ mango-explorer liquidator --target "BTC:33%" --target "ETH:33%" --dry-run
2021-08-10 16:25:23 ⚠ root         
⚠ WARNING ⚠

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

    🥭 Mango Markets: https://mango.markets
    📄 Documentation: https://docs.mango.markets/
    💬 Discord: https://discord.gg/67jySBhxrg
    🐦 Twitter: https://twitter.com/mangomarkets
    🚧 Github: https://github.com/blockworks-foundation
    📧 Email: mailto:hello@blockworks.foundation

2021-08-10 16:25:23 ⓘ root         Context: « 𝙲𝚘𝚗𝚝𝚎𝚡𝚝:
    Cluster: mainnet-beta
    Cluster URL: https://solana-api.projectserum.com
    Program ID: 5fNfvyp5czQVX77yoACa3JJVEhdRaWjPuazuWgjhTqEH
    DEX Program ID: 9xQeWvG816bUx9EPjHmaT23yvVM2ZWbrrpZb9PusVFin
    Group Name: BTC_ETH_SOL_SRM_USDC
    Group ID: 2oogpTYm1sp6LPZAWD3bp2wsFpnV2kXL1s52yyFhW5vp
»
2021-08-10 16:25:23 ⓘ root         Wallet address: Dd8sgey2VD1uo5jBJfwJAdfi2GZAvULcoSqAy87jQGBT
2021-08-10 16:25:23 ⓘ root         Checking wallet accounts.
2021-08-10 16:25:39 ⓘ root         Wallet account report: « ScoutReport [Dd8sgey2VD1uo5jBJfwJAdfi2GZAvULcoSqAy87jQGBT]:
    Summary:
        Found 2 error(s) and 2 warning(s).

    Errors:
        Account 'Dd8sgey2VD1uo5jBJfwJAdfi2GZAvULcoSqAy87jQGBT' has no account for token 'Wrapped SOL', mint 'So11111111111111111111111111111111111111112'.
        Account 'Dd8sgey2VD1uo5jBJfwJAdfi2GZAvULcoSqAy87jQGBT' has no account for token 'Serum', mint 'SRMuApVNdxXokk5GT7XD5cUUgXMBCoAz2LHeuAoKWRt'.

    Warnings:
        No Serum open orders account for market 'Wrapped SOL/USD Coin' [9wFFyRfZBsuAha4YcuxcXLKwMxJR43S7fPfQLusDBzvT]'.
        No Serum open orders account for market 'Serum/USD Coin' [ByRys5tuUWDgL73G8JBAEfkdFf8JWBzPBDHsBVQ5vbQA]'.

    Details:
        Account 'Dd8sgey2VD1uo5jBJfwJAdfi2GZAvULcoSqAy87jQGBT' has 1 Wrapped Bitcoin (Sollet) token account(s) with mint '9n4nbM75f5Ui33ZbPYXn59EwSgE8CGsHtAeTH5YFeJ9E': [3C2ADDY4wy3n7ZHoEnBxLedAzTNe5aiJfT655LdkcdaY]
        Account 'Dd8sgey2VD1uo5jBJfwJAdfi2GZAvULcoSqAy87jQGBT' has 1 Wrapped Ethereum (Sollet) token account(s) with mint '2FPyTwcZLUg1MDrwsyoP4D6s1tM7hAkHYRjkNb5w6Pxk': [Fm765bTJpDe9nYbRqHgTgmPhMPy39eiCqqCT497sziGb]
        Account 'Dd8sgey2VD1uo5jBJfwJAdfi2GZAvULcoSqAy87jQGBT' has 1 USD Coin token account(s) with mint 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v': [ETrBARWJBMppYfaBw69kGzRn8J8RJX8mKWUAR4WaZnew]
        Serum open orders account for market 'Wrapped Bitcoin (Sollet)/USD Coin': « OpenOrders [F5Jf4GKejKhED4X3rgPRQH8dZTdMaAXi2SjPL43vQWL]:
            Flags: « SerumAccountFlags: initialized | open_orders »
            Program ID: 9xQeWvG816bUx9EPjHmaT23yvVM2ZWbrrpZb9PusVFin
            Market: A8YFbxQYFVqKZaoYJLLUVcQiWP7G2MeEgW5wsAQgMvFw
            Owner: Dd8sgey2VD1uo5jBJfwJAdfi2GZAvULcoSqAy87jQGBT
            Base Token: 0.00000000 of 0.00000000
            Quote Token: 0.00000000 of 0.00000000
            Referrer Rebate Accrued: 144872
            Orders:
                None
            Client IDs:
                None
        »
        Serum open orders account for market 'Wrapped Ethereum (Sollet)/USD Coin': « OpenOrders [8cwoi1gti8GsFYxhaEDEPqerwSvbLbhXp8kqmWFv2t6G]:
            Flags: « SerumAccountFlags: initialized | open_orders »
            Program ID: 9xQeWvG816bUx9EPjHmaT23yvVM2ZWbrrpZb9PusVFin
            Market: 4tSvZvnbyzHXLMTiFonMyxZoHmFqau1XArcRCVHLZ5gX
            Owner: Dd8sgey2VD1uo5jBJfwJAdfi2GZAvULcoSqAy87jQGBT
            Base Token: 0.00000000 of 0.00000000
            Quote Token: 0.00000000 of 0.00000000
            Referrer Rebate Accrued: 145031
            Orders:
                None
            Client IDs:
                None
        »
        Account 'Dd8sgey2VD1uo5jBJfwJAdfi2GZAvULcoSqAy87jQGBT' has no Mango Markets margin accounts.
»
2021-08-10 16:25:39 🛑 root         Liquidator stopped because of exception: Account 'Dd8sgey2VD1uo5jBJfwJAdfi2GZAvULcoSqAy87jQGBT' is not prepared for group '2oogpTYm1sp6LPZAWD3bp2wsFpnV2kXL1s52yyFhW5vp'. - Traceback (most recent call last):
  File "/home/jovyan/work/bin/liquidator", line 106, in <module>
    raise Exception(f"Account '{wallet.address}' is not prepared for group '{group.address}'.")
Exception: Account 'Dd8sgey2VD1uo5jBJfwJAdfi2GZAvULcoSqAy87jQGBT' is not prepared for group '2oogpTYm1sp6LPZAWD3bp2wsFpnV2kXL1s52yyFhW5vp'.

2021-08-10 16:25:39 ⓘ root         Liquidator completed.

@OpinionatedGeek
Copy link
Contributor

Aha. OK. The root problem is that Mango now has 5 tokens in its Group (BTC, ETH, SOL, SRM, USDC) not the old 3 tokens (BTC, ETH, USDT). That Quickstart is a bit out of date. Sorry.

(You could just run the liquidator against the old Group - it's still there but doesn't see too much action these days. The equivalent command for you would be: mango-explorer liquidator --group-name BTC_ETH_USDT --target "BTC:33%" --target "ETH:33%" --dry-run )

The exception is saying that you don't have SPL token accounts for SRM and Wrapped SOL. You need those accounts to exist so that if you liquidate someone, their tokens can go to your account. It's probably better to have some of those tokens in your account so you can provide them if they're needed for liquidations.

SOL is tricky because it's not a 'real' SPL token in Solana, it's the native token. To use it as an SPL token it needs to be 'wrapped' in an SPL-compatible wrapper.

Also, the quote token changed from USDT to USDC. That isn't mentioned in the error (it's likely you already have a USDC token account), but it is something you'll need to address.

So, to get up and running:

  • Convert some or all of your USDT to USDC
  • Buy (or acquire) some SRM
  • 'Wrap' some SOL, using the command wrap-sol

Apologies for the inconvenience.

@joemccann
Copy link
Author

awesome thanks! I can update the walkthru in a PR if I get it running.

@OpinionatedGeek
Copy link
Contributor

You are welcome to, of course, but it will need to be completely re-done for V3 anyway (happening soon!) so it may not be the best use of your time.

@namnh06
Copy link

namnh06 commented Sep 15, 2021

For who still got issue with this:
mango-explorer group-balance-wallet --group-name BTC_ETH_SOL_SRM_USDC --target "BTC:0.004" --target "ETH:0.05" --target "SOL:2" --target "SRM:20"
this one uses for Liquidator v2, cannot use percentage anymore.

@OpinionatedGeek
Copy link
Contributor

Thanks - yes, the current V2 code no longer accepts percentage targets for rebalancing. (It caused problems in some situations and didn't seem worth the benefit it provided.)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants