Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
brunoguerios committed Jul 17, 2023
2 parents 626226f + 05f7732 commit 87224f8
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 10 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@balancer-labs/sor",
"version": "4.1.1-beta.12",
"version": "4.1.1-beta.13",
"license": "GPL-3.0-only",
"main": "dist/index.js",
"module": "dist/index.esm.js",
Expand All @@ -10,6 +10,7 @@
"prepack": "yarn build",
"test": "TS_NODE_PROJECT='tsconfig.testing.json' nyc mocha -r ts-node/register test/*.spec.ts --timeout 20000",
"test:only": "TS_NODE_PROJECT='tsconfig.testing.json' npx mocha -r ts-node/register --timeout 20000",
"example": "TS_NODE_PROJECT='tsconfig.testing.json' ts-node",
"coverage": "nyc report --reporter=text-lcov | coveralls",
"lint": "eslint ./src ./test --ext .ts --max-warnings 0",
"node": "npx hardhat node --tsconfig tsconfig.testing.json --fork $(. ./.env && echo $ALCHEMY_URL)",
Expand Down
4 changes: 2 additions & 2 deletions test/gyroEV2.integration.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { setUp } from './testScripts/utils';
dotenv.config();

const networkId = Network.POLYGON;
const { ALCHEMY_URL_POLYGON: jsonRpcUrl } = process.env;
const jsonRpcUrl = 'https://polygon-mainnet.infura.io/v3/' + process.env.INFURA;
const rpcUrl = 'http://127.0.0.1:8137';
const provider = new JsonRpcProvider(rpcUrl, networkId);
const blocknumber = 42173266;
Expand Down Expand Up @@ -64,7 +64,7 @@ const gyroEV2PoolWMATIC_stMATIC_POLYGON: SubgraphPoolBase = {
dSq: '0.9999999999999999988662409334210612',
};

describe('gyroEV2: WMATIC-stMATIC integration tests', () => {
describe.skip('gyroEV2: WMATIC-stMATIC integration tests', () => {
let sor: SOR;
const funds = {
sender: AddressZero,
Expand Down
1 change: 1 addition & 0 deletions test/lib/coingeckoTokenPriceService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export class CoingeckoTokenPriceService implements TokenPriceService {
const data = await response.json();

if (
data[tokenAddress.toLowerCase()] === undefined ||
data[tokenAddress.toLowerCase()][this.nativeAssetId] === undefined
) {
throw Error('No price returned from Coingecko');
Expand Down
1 change: 1 addition & 0 deletions test/lib/subgraphPoolDataService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ export const Query: { [chainId: number]: string } = {
137: queryWithLinear,
42161: queryWithLinear,
100: queryWithLinear,
1101: queryWithLinear,
};

export class SubgraphPoolDataService implements PoolDataService {
Expand Down
41 changes: 40 additions & 1 deletion test/testScripts/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export enum Network {
ARBITRUM = 42161,
OPTIMISM = 10,
GNOSIS = 100,
ZKEVM = 1101,
}

export const SOR_CONFIG: Record<Network, SorConfig> = {
Expand Down Expand Up @@ -109,7 +110,18 @@ export const SOR_CONFIG: Record<Network, SorConfig> = {
connectingTokens: [
{
symbol: 'weth',
address: '0x82af49447d8a07e3bd95bd0d56f35241523fbab1',
address: '0x6A023CCd1ff6F2045C3309768eAd9E68F978f6e1',
},
],
},
[Network.ZKEVM]: {
chainId: Network.ZKEVM, //1101
vault: '0xBA12222222228d8Ba445958a75a0704d566BF2C8',
weth: '0x4f9a0e7fd2bf6067db6994cf12e4495df938e6e9',
connectingTokens: [
{
symbol: 'weth',
address: '0x4f9a0e7fd2bf6067db6994cf12e4495df938e6e9',
},
],
},
Expand All @@ -121,6 +133,7 @@ export const PROVIDER_URLS = {
[Network.POLYGON]: `https://polygon-mainnet.infura.io/v3/${process.env.INFURA}`,
[Network.ARBITRUM]: `https://arbitrum-mainnet.infura.io/v3/${process.env.INFURA}`,
[Network.GNOSIS]: `https://poa-xdai.gateway.pokt.network/v1/lb/91bc0e12a76e7a84dd76189d`,
[Network.ZKEVM]: `${process.env.RPC_URL_ZKEVM}`,
};

export const MULTIADDR: { [chainId: number]: string } = {
Expand All @@ -133,6 +146,7 @@ export const MULTIADDR: { [chainId: number]: string } = {
42161: '0x269ff446d9892c9e19082564df3f5e8741e190a1',
99: '0xeefba1e63905ef1d7acba5a8513c70307c1ce441',
100: '0xbb6fab6b627947dae0a75808250d8b2652952cb5',
1101: '0xca11bde05977b3631167028862be2a173976ca11',
};

export const SUBGRAPH_URLS = {
Expand All @@ -144,6 +158,7 @@ export const SUBGRAPH_URLS = {
'https://api.thegraph.com/subgraphs/name/balancer-labs/balancer-polygon-v2-beta',
[Network.ARBITRUM]: `https://api.thegraph.com/subgraphs/name/balancer-labs/balancer-arbitrum-v2`,
[Network.GNOSIS]: `https://api.thegraph.com/subgraphs/name/balancer-labs/balancer-gnosis-chain-v2`,
[Network.ZKEVM]: `https://api.studio.thegraph.com/query/24660/balancer-polygon-zk-v2/version/latest`,
};

// This is the same across networks
Expand Down Expand Up @@ -462,4 +477,28 @@ export const ADDRESSES = {
symbol: 'USDT',
},
},
[Network.GOERLI]: {
DAI: {
address: '0xb8096bc53c3ce4c11ebb0069da0341d75264b104',
decimals: 18,
symbol: 'DAI',
},
USDC: {
address: '0xdabd33683bafdd448968ab6d6f47c3535c64bf0c',
decimals: 6,
symbol: 'USDC',
},
},
[Network.ZKEVM]: {
USDT: {
address: '0x1e4a5963abfd975d8c9021ce480b42188849d41d',
decimals: 6,
symbol: 'USDT',
},
USDC: {
address: '0xA8CE8aee21bC2A48a5EF670afCc9274C7bbbC035',
decimals: 6,
symbol: 'USDC',
},
},
};
2 changes: 1 addition & 1 deletion test/xaveFxPool.integration.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ dotenv.config();

let sor: SOR;
const networkId = Network.MAINNET;
const jsonRpcUrl = process.env.ALCHEMY_URL;
const jsonRpcUrl = 'https://mainnet.infura.io/v3/' + process.env.INFURA;
const rpcUrl = 'http://127.0.0.1:8545';
const provider = new JsonRpcProvider(rpcUrl, networkId);
const blocknumber = 16797531;
Expand Down
6 changes: 3 additions & 3 deletions test/xaveFxPool.polygon.integration.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// yarn test:only test/xaveFxPool-polygon.integration.spec.ts
// yarn test:only test/xaveFxPool.polygon.integration.spec.ts
import dotenv from 'dotenv';
import { JsonRpcProvider } from '@ethersproject/providers';
import { SOR, SubgraphPoolBase, SwapTypes } from '../src';
Expand All @@ -20,7 +20,7 @@ dotenv.config();

let sor: SOR;
const networkId = Network.POLYGON;
const jsonRpcUrl = process.env.ALCHEMY_URL_POLYGON;
const jsonRpcUrl = 'https://polygon-mainnet.infura.io/v3/' + process.env.INFURA;
const rpcUrl = 'http://127.0.0.1:8137';
const provider = new JsonRpcProvider(rpcUrl, networkId);
const blocknumber = 43667355;
Expand Down Expand Up @@ -72,7 +72,7 @@ const xaveFxPoolXSGD_USDC_POLYGON: SubgraphPoolBase = {
epsilon: '0.0005',
};

describe('xaveFxPool: DAI-USDC integration (Polygon) tests', () => {
describe.skip('xaveFxPool: DAI-USDC integration (Polygon) tests', () => {
context('test swaps vs queryBatchSwap', () => {
// Setup chain
before(async function () {
Expand Down
4 changes: 2 additions & 2 deletions test/xaveFxPool.wStable.integration.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// yarn test:only test/xaveFxPoolBug.integration.spec.ts
// yarn test:only test/xaveFxPool.wStable.integration.spec.ts
import dotenv from 'dotenv';
import { expect } from 'chai';
import { JsonRpcProvider } from '@ethersproject/providers';
Expand All @@ -15,7 +15,7 @@ dotenv.config();

let sor: SOR;
const networkId = Network.MAINNET;
const jsonRpcUrl = process.env.ALCHEMY_URL;
const jsonRpcUrl = 'https://mainnet.infura.io/v3/' + process.env.INFURA;
const rpcUrl = 'http://127.0.0.1:8545';
const provider = new JsonRpcProvider(rpcUrl, networkId);
const blocknumber = 17129117;
Expand Down

0 comments on commit 87224f8

Please sign in to comment.