Skip to content

Commit

Permalink
Merge pull request #601 from beethovenxfi/v3-canary
Browse files Browse the repository at this point in the history
V3 canary
  • Loading branch information
franzns authored Dec 15, 2023
2 parents 59955a8 + 05c0e45 commit b177bb7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
3 changes: 1 addition & 2 deletions modules/sor/sor.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ export class SorService {
}

private async getSwap(input: GetSwapsInput, v1Service: SwapService = sorV1BalancerService) {
console.log(`Running SOR for ${input.swapAmount} ${input.tokenIn} > ${input.tokenOut}`);
const v1Start = +new Date();
const swapV1 = await v1Service.getSwapResult(input);
const v1Time = +new Date() - v1Start;
Expand Down Expand Up @@ -144,7 +143,7 @@ export class SorService {
const fp = (a: bigint, d: number) => Number(formatUnits(String(a), d));
const bn = (a: string, d: number) => BigInt(String(parseUnits(a, d)));
const prismaToken = await tokenService.getToken(resultToken, chain);
const decimals = prismaToken!.decimals;
const decimals = prismaToken ? prismaToken.decimals : 18; // most probably native asset
let v2Perf =
version === 'V1'
? 1 - fp(v1ResultAmount, decimals) / fp(v2ResultAmount, decimals) // negative perf means V1 is better
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"@aws-sdk/client-secrets-manager": "^3.195.0",
"@aws-sdk/client-sqs": "^3.137.0",
"@balancer-labs/sdk": "github:beethovenxfi/balancer-sdk#beethovenx-master",
"@balancer/sdk": "^0.4.0",
"@balancer/sdk": "^0.5.0",
"@ethersproject/address": "^5.6.0",
"@ethersproject/bignumber": "^5.6.0",
"@ethersproject/constants": "^5.6.0",
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2456,10 +2456,10 @@
graphology "^0.24.1"
isomorphic-fetch "^2.2.1"

"@balancer/sdk@^0.4.0":
version "0.4.0"
resolved "https://registry.yarnpkg.com/@balancer/sdk/-/sdk-0.4.0.tgz#9fe762e1b7f6cad574a1603bdc33e77c6e1ab426"
integrity sha512-g8ilzNSlk2Pdh7PUAyr88sD78GGDTOUJUpAhKBO5dN77Kk70ivyL6mNJBGpJqrjraoBygv6yQukV8yO5m0kiEw==
"@balancer/sdk@^0.5.0":
version "0.5.0"
resolved "https://registry.yarnpkg.com/@balancer/sdk/-/sdk-0.5.0.tgz#098b2fd019a0460c2ad13c20f1f6a058573a08d2"
integrity sha512-2ys18xZAfGvwJpQmStmX2O6b/QkIQQWHpm09/qk2oHDg/lhnYYY5otfs14QuEQubdlA3Kth0U0uAxMlc4NxN/w==
dependencies:
async-retry "^1.3.3"
decimal.js-light "^2.5.1"
Expand Down

0 comments on commit b177bb7

Please sign in to comment.