Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GSW-488] Swap Route #237

Merged
merged 22 commits into from
Dec 1, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
b312ce0
fix: Change sqrt calculation expression
jinoosss Nov 20, 2023
cd4e374
fix: Fix pool bin data
jinoosss Nov 20, 2023
46430d4
[GSW-556] feat: Implement a function to find all swap paths
jinoosss Nov 20, 2023
1c2800e
fix: Fix pool data model
jinoosss Nov 20, 2023
ddbd39c
feat: Implement a SwapRouter
jinoosss Nov 26, 2023
47bff0b
[GSW-556] feat: Implements Swap Router
jinoosss Nov 28, 2023
25e1de4
[GSW-556] feat: Implements Swap Router
jinoosss Nov 29, 2023
c491b0c
chore: Update project environment
jinoosss Nov 29, 2023
e5e4c4a
[GSW-556] feat: Implements Swap Router
jinoosss Nov 29, 2023
dfc6b4c
[GSW-581] feat: Add test environments and test cases
jinoosss Nov 29, 2023
e7c077a
[GSW-556] feat: Implements Swap Router
jinoosss Nov 29, 2023
a94474b
[GSW-581] feat: Add test environments and test cases
jinoosss Nov 29, 2023
aa2a11a
chore: Update package.json
jinoosss Nov 29, 2023
a820364
fix: Remove unused line
jinoosss Nov 29, 2023
87f9bee
chore: Update yarn version
jinoosss Nov 30, 2023
e89015a
fix: Remove unused modules
jinoosss Nov 30, 2023
c09410c
chore: Update build cache
jinoosss Nov 30, 2023
2bcf2bc
chore: Update action scripts
jinoosss Nov 30, 2023
ea316ff
Merge pull request #234 from gnoswap-labs/GSW-556-calculate-swap-pool…
jinoosss Nov 30, 2023
cb97f64
[GSW-593] feat: Change swap router key generation (#236)
jinoosss Dec 1, 2023
a9b2dde
[GSW-450] feat: Implement Swap Expected Result Details (#235)
jinoosss Dec 1, 2023
0c9c273
fix: Change provider
jinoosss Dec 1, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/web/src/models/pool/mapper/pool-info-mapper.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { PoolInfoResponse } from "@repositories/pool/response/pool-info-response";
import { rawByX96 } from "@utils/swap-utils";
import { rawBySqrtX96 } from "@utils/swap-utils";
import { PoolInfoModel } from "../pool-info-model";

export class PoolInfoMapper {
Expand All @@ -8,7 +8,7 @@ export class PoolInfoMapper {
throw new Error("mapper error");
}
const sqrtPriceX96 = response.response.data.sqrt_price_x96;
const price = rawByX96(sqrtPriceX96);
const price = rawBySqrtX96(sqrtPriceX96);

return {
poolPath: response.response.data.pool_path,
Expand Down
16 changes: 7 additions & 9 deletions packages/web/src/models/pool/pool-bin-model.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
export interface PoolBinModel {
binId: string;

poolId: string;
poolPath: string;

currentTick: number;

reserveA: number;
tokenAAmount: number;

reserveB: number;
tokenBAmount: number;

totalSupply: number;
minTick: number;

lpTokenId: string;
maxTick: number;

timestamp: string;
liquidity: number;

annualizedFeeGrowth: number;
apr: number;
}
2 changes: 1 addition & 1 deletion packages/web/src/models/pool/pool-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export interface PoolModel {

bins: PoolBinModel[];

topBin: PoolBinModel;
topBin: PoolBinModel | null;

tvl: AmountModel;

Expand Down
9 changes: 9 additions & 0 deletions packages/web/src/models/swap/estimated-route-model.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { RouteModel } from "./route-model";

export interface EstimatedRouteModel extends RouteModel {
quote: number;

inputAmount: number;

outputAmount: number;
}
5 changes: 5 additions & 0 deletions packages/web/src/models/swap/route-model.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { PoolModel } from "@models/pool/pool-model";

export interface RouteModel {
pools: PoolModel[];
}
12 changes: 1 addition & 11 deletions packages/web/src/repositories/pool/mock/pool-detail.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,6 @@
"tickSpacing": 10,
"bins": [],
"resolvedBins": [],
"topBin": {
"binId": "",
"poolId": "",
"currentTick": 0,
"reserveA": 0,
"reserveB": 0,
"totalSupply": 0,
"lpTokenId": "",
"timestamp": "0001-01-01T00:00:00Z",
"annualizedFeeGrowth": 0
}
"topBin": null
}
}
Loading