diff --git a/.github/workflows/auto-deploy-test.yml b/.github/workflows/auto-deploy-test.yml index 958e677..bf809cc 100644 --- a/.github/workflows/auto-deploy-test.yml +++ b/.github/workflows/auto-deploy-test.yml @@ -13,6 +13,6 @@ jobs: with: node-version: v18.20.4 - run: | - echo "${{ vars.MINA_BRIDGE_BE_TEST }}" >> .env + echo "${{ secrets.MINA_BRIDGE_BE_TEST }}" >> .env docker build . -t mina-bridge:1.0.0 docker compose -f docker-compose.dev.yaml up -d --remove-orphans diff --git a/src/database/seeds/common_config.seed.ts b/src/database/seeds/common_config.seed.ts index 205e1c5..48df73e 100644 --- a/src/database/seeds/common_config.seed.ts +++ b/src/database/seeds/common_config.seed.ts @@ -3,7 +3,7 @@ import { DataSource } from 'typeorm'; import { Seeder } from 'typeorm-extension'; import { COMMOM_CONFIG_TIP, COMMON__CONFIG_DAILY_QUOTA, EAsset } from '../../constants/api.constant.js'; -import { ENetworkName } from '../../constants/blockchain.constant.js'; +import { ENetworkName, ETokenPairStatus } from '../../constants/blockchain.constant.js'; import { EEnvKey } from '../../constants/env.constant.js'; import { CommonConfig } from '../../modules/crawler/entities/common-config.entity.js'; @@ -21,12 +21,15 @@ export default class CommonConfigSeeder implements Seeder { asset: EAsset.ETH, fromAddress: '0x0000000000000000000000000000000000000000', toAddress: process.env[EEnvKey.MINA_TOKEN_BRIDGE_ADDRESS], + fromScAddress: process.env[EEnvKey.ETH_BRIDGE_CONTRACT_ADDRESS], + toScAddress: process.env[EEnvKey.MINA_BRIDGE_CONTRACT_ADDRESS], fromDecimal: 18, toDecimal: 9, fromSymbol: 'ETH', toSymbol: 'WETH', fromChain: ENetworkName.ETH, toChain: ENetworkName.MINA, + status:ETokenPairStatus.ENABLE }), ); } diff --git a/src/modules/crawler/crawler.evmbridge.ts b/src/modules/crawler/crawler.evmbridge.ts index 7172693..e7f1ac0 100644 --- a/src/modules/crawler/crawler.evmbridge.ts +++ b/src/modules/crawler/crawler.evmbridge.ts @@ -109,7 +109,7 @@ export class BlockchainEVMCrawler { networkFrom: ENetworkName.ETH, networkReceived: ENetworkName.MINA, tokenFromName: event.returnValues.tokenName, - tokenReceivedAddress: this.configService.get(EEnvKey.MINA_TOKEN_BRIDGE_ADDRESS), + tokenReceivedAddress: config.toAddress, txHashLock: event.transactionHash, receiveAddress: event.returnValues.receipt, blockNumber: event.blockNumber, diff --git a/src/modules/crawler/crawler.minabridge.ts b/src/modules/crawler/crawler.minabridge.ts index b56a0fc..1609284 100644 --- a/src/modules/crawler/crawler.minabridge.ts +++ b/src/modules/crawler/crawler.minabridge.ts @@ -113,7 +113,7 @@ export class SCBridgeMinaCrawler { }); // update total weth minted - const currentConfig = await configRepo.findOneBy({}); + const currentConfig = await configRepo.findOneBy({ toAddress: event.event.data.tokenAddress.toBase58() }); assert(currentConfig, 'comomn config not exist'); const newTotalEthMinted = new BigNumber(currentConfig.totalWethMinted).plus(existLockTx.amountReceived).toString(); @@ -142,7 +142,7 @@ export class SCBridgeMinaCrawler { } const fromTokenDecimal = this.configService.get(EEnvKey.DECIMAL_TOKEN_MINA), toTokenDecimal = this.configService.get(EEnvKey.DECIMAL_TOKEN_EVM); - const config = await configRepo.findOneBy({ fromAddress: event.event.data.tokenAddress.toBase58() }); + const config = await configRepo.findOneBy({ toAddress: event.event.data.tokenAddress.toBase58() }); assert(!!config?.bridgeFee, 'tip config undefined'); @@ -162,11 +162,11 @@ export class SCBridgeMinaCrawler { const eventUnlock: Partial = { senderAddress: JSON.parse(JSON.stringify(event.event.data.locker)), amountFrom: inputAmount, - tokenFromAddress: this.configService.get(EEnvKey.MINA_TOKEN_BRIDGE_ADDRESS), + tokenFromAddress: config.fromAddress, networkFrom: ENetworkName.MINA, networkReceived: ENetworkName.ETH, tokenFromName: EAsset.WETH, - tokenReceivedAddress: this.configService.get(EEnvKey.ETH_TOKEN_BRIDGE_ADDRESS), + tokenReceivedAddress: config.toAddress, txHashLock, receiveAddress: receiveAddress, blockNumber: +event.blockHeight.toString(),