Skip to content

Commit

Permalink
v4.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Sluder committed Aug 15, 2023
1 parent ca477f0 commit c34c7c3
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 16 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

All notable changes to Dexter will be documented in this file.

## [v4.0.2]
- Fix pool identifiers & LP token for Minswap.

## [v4.0.1]
- Remove total LP tokens from fetched data. This data is not needed for swapping, and wastes a lot of network requests.
- Add `setProviderForDex()` to use different data providers for each DEX.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@indigo-labs/dexter",
"version": "4.0.1",
"version": "4.0.2",
"license": "MIT",
"author": "Zachary Sluder",
"keywords": [
Expand Down
21 changes: 8 additions & 13 deletions src/dex/minswap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import {
AssetAddress,
AssetBalance,
DatumParameters,
DefinitionConstr,
DefinitionField,
PayToAddress,
RequestConfig,
SwapFee,
Expand All @@ -16,7 +14,6 @@ import {
import { DefinitionBuilder } from '@app/definition-builder';
import { correspondingReserves } from '@app/utils';
import { AddressType, DatumParameterKey } from '@app/constants';
import pool from '@dex/definitions/minswap/pool';
import order from '@dex/definitions/minswap/order';
import { BaseApi } from '@dex/api/base-api';
import { MinswapApi } from '@dex/api/minswap-api';
Expand Down Expand Up @@ -106,16 +103,14 @@ export class Minswap extends BaseDex {
);

// Load additional pool information
const possibleLpTokens: Asset[] = utxo.assetBalances.filter((assetBalance: AssetBalance) => {
return assetBalance.asset !== 'lovelace' && assetBalance.asset.policyId === this.lpTokenPolicyId;
}).map((assetBalance: AssetBalance) => assetBalance.asset as Asset);

if (possibleLpTokens.length > 1) {
return undefined;
} else if (possibleLpTokens.length === 1) {
liquidityPool.lpToken = possibleLpTokens[0];
liquidityPool.identifier = possibleLpTokens[0].policyId;
}
const poolNft: Asset | undefined = utxo.assetBalances.find((assetBalance: AssetBalance) => {
return assetBalance.asset !== 'lovelace' && assetBalance.asset.policyId === this.poolNftPolicyId;
})?.asset as Asset;

if (! poolNft) return undefined;

liquidityPool.lpToken = new Asset(this.lpTokenPolicyId, poolNft.nameHex);
liquidityPool.identifier = poolNft.nameHex;

liquidityPool.poolFeePercent = 0.3;

Expand Down
4 changes: 2 additions & 2 deletions src/dex/wingriders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,12 @@ export class WingRiders extends BaseDex {
relevantAssets[assetAIndex].asset,
relevantAssets[assetBIndex].asset,
relevantAssets[assetAIndex].asset === 'lovelace'
? (assetAQuantity - MIN_POOL_ADA < 1_000_000)
? (assetAQuantity - MIN_POOL_ADA < 1_000_000n)
? assetAQuantity - MIN_POOL_ADA
: assetAQuantity
: assetAQuantity,
relevantAssets[assetBIndex].asset === 'lovelace'
? (assetBQuantity - MIN_POOL_ADA < 1_000_000)
? (assetBQuantity - MIN_POOL_ADA < 1_000_000n)
? assetBQuantity - MIN_POOL_ADA
: assetBQuantity
: assetBQuantity,
Expand Down

0 comments on commit c34c7c3

Please sign in to comment.