diff --git a/packages/stores/src/account/osmosis/index.ts b/packages/stores/src/account/osmosis/index.ts index 6a3fedfa13..c83a0c7784 100644 --- a/packages/stores/src/account/osmosis/index.ts +++ b/packages/stores/src/account/osmosis/index.ts @@ -51,6 +51,7 @@ import { DeliverTxResponse, SignOptions } from "../types"; import { findNewClPositionId } from "./tx-response"; const DEFAULT_SLIPPAGE = "2.5"; +const HIGH_DEFAULT_SLIPPAGE = "15"; export interface OsmosisAccount { osmosis: OsmosisAccountImpl; @@ -1414,7 +1415,7 @@ export class OsmosisAccountImpl { * https://docs.osmosis.zone/developing/modules/spec-gamm.html#exit-pool * @param poolId Id of pool to exit. * @param shareInAmount LP shares to redeem. - * @param maxSlippage Max tolerated slippage. Default: 2.5. + * @param maxSlippage Max tolerated slippage. Default: 2.5, 15 with high precision amounts. * @param memo Transaction memo. * @param onFulfill Callback to handle tx fullfillment given raw response. */ @@ -1444,6 +1445,12 @@ export class OsmosisAccountImpl { makeExitPoolMsg.shareCoinDecimals ); + // If the token amount is very large, indicating high precision, + // increase slippage tolerance to allow for the high precision. + if (poolAssets.some(({ amount }) => amount.length > 18)) { + maxSlippage = HIGH_DEFAULT_SLIPPAGE; + } + const maxSlippageDec = new Dec(maxSlippage).quo( DecUtils.getTenExponentNInPrecisionRange(2) );