diff --git a/.github/workflows/build-push-image.yml b/.github/workflows/build-push-image.yml index cf9b9936..1431d7e9 100644 --- a/.github/workflows/build-push-image.yml +++ b/.github/workflows/build-push-image.yml @@ -26,47 +26,47 @@ jobs: runs-on: dappradar-runner steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v3 - - name: Configure AWS credentials - uses: aws-actions/configure-aws-credentials@v2 - with: - aws-region: ${{ env.AWS_DEFAULT_REGION }} - role-to-assume: ${{ env.AWS_IAM_ROLE_GITHUB }} + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v2 + with: + aws-region: ${{ env.AWS_DEFAULT_REGION }} + role-to-assume: ${{ env.AWS_IAM_ROLE_GITHUB }} - - name: Authenticate to Amazon ECR - uses: aws-actions/amazon-ecr-login@v1 + - name: Authenticate to Amazon ECR + uses: aws-actions/amazon-ecr-login@v1 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - with: - driver: docker + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + with: + driver: docker - - name: Build Docker image - uses: docker/build-push-action@v4 - with: - context: . - tags: "${{ env.ECR_REPOSITORY_URL_APP }}:${{ env.IMAGE_TAG }}" - push: false + - name: Build Docker image + uses: docker/build-push-action@v4 + with: + context: . + tags: "${{ env.ECR_REPOSITORY_URL_APP }}:${{ env.IMAGE_TAG }}" + push: false - - name: Push Docker image - uses: docker/build-push-action@v4 - with: - context: . - tags: "${{ env.ECR_REPOSITORY_URL_APP }}:${{ env.IMAGE_TAG }}" - push: true + - name: Push Docker image + uses: docker/build-push-action@v4 + with: + context: . + tags: "${{ env.ECR_REPOSITORY_URL_APP }}:${{ env.IMAGE_TAG }}" + push: true - - name: Bake and push manifests - run: | - kubectl kustomize $MANIFESTS_PATH | \ - envsubst '$CONTAINER_IMAGE' | \ - flux push artifact oci://$OCI_IMAGE_URL_INFRA -f - \ - --source="$(git config --get remote.origin.url)" \ - --revision="$(git branch --show-current)@sha1:$(git rev-parse HEAD)" \ - --provider=aws && \ - flux tag artifact oci://$OCI_IMAGE_URL_INFRA \ - --tag $GITHUB_REF_NAME \ - --provider aws - env: - OCI_IMAGE_URL_INFRA: "${{ env.ECR_REPOSITORY_URL_INFRA }}:${{ env.IMAGE_TAG }}" - CONTAINER_IMAGE: "${{ env.ECR_REPOSITORY_URL_APP }}:${{ env.IMAGE_TAG }}" \ No newline at end of file + - name: Bake and push manifests + run: | + kubectl kustomize $MANIFESTS_PATH | \ + envsubst '$CONTAINER_IMAGE' | \ + flux push artifact oci://$OCI_IMAGE_URL_INFRA -f - \ + --source="$(git config --get remote.origin.url)" \ + --revision="$(git branch --show-current)@sha1:$(git rev-parse HEAD)" \ + --provider=aws && \ + flux tag artifact oci://$OCI_IMAGE_URL_INFRA \ + --tag $GITHUB_REF_NAME \ + --provider aws + env: + OCI_IMAGE_URL_INFRA: "${{ env.ECR_REPOSITORY_URL_INFRA }}:${{ env.IMAGE_TAG }}" + CONTAINER_IMAGE: "${{ env.ECR_REPOSITORY_URL_APP }}:${{ env.IMAGE_TAG }}" \ No newline at end of file diff --git a/kubernetes/base/kustomization.yml b/kubernetes/base/kustomization.yml index f9a26a3f..a588e9ff 100644 --- a/kubernetes/base/kustomization.yml +++ b/kubernetes/base/kustomization.yml @@ -5,4 +5,4 @@ resources: - service.yml - ingress.yml - secrets.yml -# - redis.yml +- redis.yml diff --git a/kubernetes/base/redis.yml b/kubernetes/base/redis.yml index 0da55443..b376cb69 100644 --- a/kubernetes/base/redis.yml +++ b/kubernetes/base/redis.yml @@ -14,7 +14,7 @@ spec: spec: containers: - name: defi-providers-redis - image: redis:7.0.11 + image: redis:7 imagePullPolicy: Always args: ["--requirepass", "$(REDIS_PASS)"] resources: diff --git a/src/factory/factory.service.ts b/src/factory/factory.service.ts index 16cb019d..20f5543d 100644 --- a/src/factory/factory.service.ts +++ b/src/factory/factory.service.ts @@ -1,4 +1,4 @@ -import { Injectable } from '@nestjs/common'; +import { Injectable, OnModuleInit } from '@nestjs/common'; import BigNumber from 'bignumber.js'; import { GetPoolAndTokenVolumesReply, @@ -28,7 +28,7 @@ interface IProvider { } @Injectable() -export class FactoryService { +export class FactoryService implements OnModuleInit { constructor(private readonly web3ProviderService: Web3ProviderService) {} async getTvl( req: GetTvlRequest, @@ -44,8 +44,6 @@ export class FactoryService { const block = parseInt(req.block) - basicUtil.getDelay(req.chain); const web3 = await this.web3ProviderService.getWeb3(req?.chain); let tvlData; - console.log('req', req); - if ( req?.autointegrationParams?.autointegrated === 'false' || req?.autointegrationParams?.autointegrated === undefined @@ -123,4 +121,12 @@ export class FactoryService { ): string { return `${__dirname}/providers/${chain}/${provider}/${path}`; } + + async onModuleInit() { + log.info({ + message: `Node Urls: ${JSON.stringify(nodeUrls)} config: + ${JSON.stringify(config)}`, + endpoint: 'printenv', + }); + } } diff --git a/src/factory/providers/zksync-era/eralend/index.ts b/src/factory/providers/zksync-era/eralend/index.ts index ca05eb58..7da1373e 100644 --- a/src/factory/providers/zksync-era/eralend/index.ts +++ b/src/factory/providers/zksync-era/eralend/index.ts @@ -21,6 +21,7 @@ async function tvl(params: ITvlParams): Promise> { web3, ); + const tokenBalances = {}; Object.keys(balances).forEach(function (key) { tokenBalances[key] = BigNumber(balances[key]); diff --git a/src/factory/providers/zksync-era/syncswap/classicPoolAbi.json b/src/factory/providers/zksync-era/syncswap/classicPoolAbi.json new file mode 100644 index 00000000..36b88b63 --- /dev/null +++ b/src/factory/providers/zksync-era/syncswap/classicPoolAbi.json @@ -0,0 +1,924 @@ +[ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "Expired", + "type": "error" + }, + { + "inputs": [], + "name": "InsufficientLiquidityMinted", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidSignature", + "type": "error" + }, + { + "inputs": [], + "name": "Overflow", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount0", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount1", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "liquidity", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + } + ], + "name": "Burn", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount0", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount1", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "liquidity", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + } + ], + "name": "Mint", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount0In", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount1In", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount0Out", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount1Out", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + } + ], + "name": "Swap", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "reserve0", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "reserve1", + "type": "uint256" + } + ], + "name": "Sync", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "inputs": [], + "name": "DOMAIN_SEPARATOR", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "allowance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + }, + { + "internalType": "address", + "name": "_sender", + "type": "address" + }, + { + "internalType": "address", + "name": "_callback", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_callbackData", + "type": "bytes" + } + ], + "name": "burn", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "internalType": "struct IPool.TokenAmount[]", + "name": "_amounts", + "type": "tuple[]" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + }, + { + "internalType": "address", + "name": "_sender", + "type": "address" + }, + { + "internalType": "address", + "name": "_callback", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_callbackData", + "type": "bytes" + } + ], + "name": "burnSingle", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "internalType": "struct IPool.TokenAmount", + "name": "_tokenAmount", + "type": "tuple" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "decimals", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_tokenOut", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amountOut", + "type": "uint256" + }, + { + "internalType": "address", + "name": "_sender", + "type": "address" + } + ], + "name": "getAmountIn", + "outputs": [ + { + "internalType": "uint256", + "name": "_amountIn", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_tokenIn", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amountIn", + "type": "uint256" + }, + { + "internalType": "address", + "name": "_sender", + "type": "address" + } + ], + "name": "getAmountOut", + "outputs": [ + { + "internalType": "uint256", + "name": "_amountOut", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getAssets", + "outputs": [ + { + "internalType": "address[]", + "name": "assets", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getProtocolFee", + "outputs": [ + { + "internalType": "uint24", + "name": "_protocolFee", + "type": "uint24" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getReserves", + "outputs": [ + { + "internalType": "uint256", + "name": "_reserve0", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_reserve1", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_sender", + "type": "address" + }, + { + "internalType": "address", + "name": "_tokenIn", + "type": "address" + }, + { + "internalType": "address", + "name": "_tokenOut", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "getSwapFee", + "outputs": [ + { + "internalType": "uint24", + "name": "_swapFee", + "type": "uint24" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "invariantLast", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "master", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + }, + { + "internalType": "address", + "name": "_sender", + "type": "address" + }, + { + "internalType": "address", + "name": "_callback", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_callbackData", + "type": "bytes" + } + ], + "name": "mint", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "nonces", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_owner", + "type": "address" + }, + { + "internalType": "address", + "name": "_spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_deadline", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "_v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "_r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "_s", + "type": "bytes32" + } + ], + "name": "permit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_owner", + "type": "address" + }, + { + "internalType": "address", + "name": "_spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_deadline", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "_signature", + "type": "bytes" + } + ], + "name": "permit2", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "poolType", + "outputs": [ + { + "internalType": "uint16", + "name": "", + "type": "uint16" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "reserve0", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "reserve1", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + }, + { + "internalType": "address", + "name": "_sender", + "type": "address" + }, + { + "internalType": "address", + "name": "_callback", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_callbackData", + "type": "bytes" + } + ], + "name": "swap", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "internalType": "struct IPool.TokenAmount", + "name": "_tokenAmount", + "type": "tuple" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "token0", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "token1", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_from", + "type": "address" + }, + { + "internalType": "address", + "name": "_to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "vault", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + } +] \ No newline at end of file diff --git a/src/util/logger/logger.ts b/src/util/logger/logger.ts index d2574644..13afe2ba 100644 --- a/src/util/logger/logger.ts +++ b/src/util/logger/logger.ts @@ -10,7 +10,6 @@ interface ILogger { configure({ appenders: { - console: { type: 'console' }, logstash: { type: `${__dirname}/appenders/logstashAppender`, }, @@ -25,7 +24,7 @@ configure({ }, categories: { default: { - appenders: ['console', '_slackError', '_logstash'], + appenders: ['_slackError', '_logstash'], level: 'all', }, },