diff --git a/src/controllers/alchemy.controller.ts b/src/controllers/alchemy.controller.ts index b08d02a..2306942 100644 --- a/src/controllers/alchemy.controller.ts +++ b/src/controllers/alchemy.controller.ts @@ -135,7 +135,7 @@ class AlchemyController extends BaseController { @router('get /pay/alchemy/can_i_buy_treasury') async canIBuyEth(req, res) { let user = req.user - let crypto = 'ETH' + let crypto = process.env.CF_ETH_NAME let today = new Date() today.setHours(0, 0, 0, 0) let count = await PayRecord.countDocuments({ diff --git a/src/controllers/alchemyout.controller.ts b/src/controllers/alchemyout.controller.ts index 5abb8a8..6f1db3a 100644 --- a/src/controllers/alchemyout.controller.ts +++ b/src/controllers/alchemyout.controller.ts @@ -111,7 +111,7 @@ class AlchemyOutController extends BaseController { } let price = await new PriceSvr().fetchPrice({ crypto: 'ETH', network: 'ARBITRUM', fiat: 'USD' }) let priceToSend = '0.1' - if (crypto.toLowerCase() === 'eth') { + if (crypto.toLowerCase() === 'eth' || crypto.toLowerCase() === process.env.CF_ETH_NAME.toLowerCase()) { priceToSend = price + '' } // 20230717 沟通, gas费需要换算成目标货币 diff --git a/src/queue/transfer.queue.ts b/src/queue/transfer.queue.ts index 982bdef..9a6402c 100644 --- a/src/queue/transfer.queue.ts +++ b/src/queue/transfer.queue.ts @@ -44,6 +44,8 @@ export class TransferQueue { let address if (token === 'agor') { address = 'eth' + } else if (token === 'eth') { + address = 'eth' } else { let env = task.env ? task.env.toLowerCase() : 'dev' address = chainCfg.tokens[`${token}_${env}`] @@ -73,7 +75,7 @@ export class TransferQueue { type: 3, }, ] - if (token === 'agor' || token === 'eth') { + if (token === 'agor' || token === 'eth' || token === process.env.CF_ETH_NAME.toLowerCase()) { datas = [ { from: record.from, diff --git a/src/service/alchemy.svr.ts b/src/service/alchemy.svr.ts index 33cf4f2..0dfdcba 100644 --- a/src/service/alchemy.svr.ts +++ b/src/service/alchemy.svr.ts @@ -231,7 +231,8 @@ export async function queryFiat() { * @returns */ export async function calcNetworkFee(crypto: string, cryptoPrice: string, ethPrice?: string) { - let gasLimit = await new GasSvr().estimateGas({ crypto, network: 'ARBITRUM' }) + let tmp = crypto.toLowerCase() === process.env.CF_ETH_NAME.toLowerCase() ? 'ETH' : crypto + let gasLimit = await new GasSvr().estimateGas({ crypto: tmp, network: 'ARBITRUM' }) // let gas = gas * 0.0000000001 const gasPriceArb = '100,000,000' // arbitrum one 上gasprice固定为0.1Gwei let eth = toBigInt(gasLimit) * toBigInt(gasPriceArb)