增加ETH(arbitrum)的支持
This commit is contained in:
parent
a4e2cb14cd
commit
0c8eb08e3f
@ -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({
|
||||
|
@ -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费需要换算成目标货币
|
||||
|
@ -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,
|
||||
|
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user