From 4f3dfeb43d3ed7cf127ef0bdd038b2409e3f869c Mon Sep 17 00:00:00 2001 From: CounterFire2023 <136581895+CounterFire2023@users.noreply.github.com> Date: Thu, 13 Jul 2023 10:12:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=89=B9=E9=87=8Fmint?= =?UTF-8?q?=E6=95=B0=E9=87=8F=EF=BC=8C=20=E4=BF=AE=E6=94=B9arb=20one=20rpc?= =?UTF-8?q?=E5=9C=B0=E5=9D=80=EF=BC=8C=20=E9=82=AE=E4=BB=B6=E6=94=B9?= =?UTF-8?q?=E4=B8=BA=E5=8F=AF=E5=8F=91=E9=80=81=E5=A4=9A=E4=BA=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/chain/WalletReactor.ts | 7 +++++-- src/chain/allchain.ts | 2 +- src/common/Constants.ts | 6 +++--- src/controllers/workflow.controller.ts | 10 +++++----- src/queue/mail.queue.ts | 18 ++++++++++++------ 5 files changed, 26 insertions(+), 17 deletions(-) diff --git a/src/chain/WalletReactor.ts b/src/chain/WalletReactor.ts index 47a2589..9420c91 100644 --- a/src/chain/WalletReactor.ts +++ b/src/chain/WalletReactor.ts @@ -42,9 +42,11 @@ export class WalletReactor { let gas = await this.contract.methods .schedule(operation.targets, operation.values, operation.datas, operation.predecessor, operation.salt, seconds) .estimateGas({ from: this.account.address }) + // let nonce = await this.web3.eth.getTransactionCount(this.account.address) + let gasPrice = await this.web3.eth.getGasPrice() let res = await this.contract.methods .schedule(operation.targets, operation.values, operation.datas, operation.predecessor, operation.salt, seconds) - .send({ gas: (gas * 1.5) | 0 }) + .send({ gas: (gas * 1.51) | 0, gasPrice }) operation.transactionHash = res.transactionHash return operation } @@ -89,9 +91,10 @@ export class WalletReactor { let gas = await this.contract.methods .execute(operation.targets, operation.values, operation.datas, operation.predecessor, operation.salt) .estimateGas({ from: this.account.address }) + let gasPrice = await this.web3.eth.getGasPrice() let res = await this.contract.methods .execute(operation.targets, operation.values, operation.datas, operation.predecessor, operation.salt) - .send({ gas: (gas * 1.5) | 0 }) + .send({ gas: (gas * 1.5) | 0, gasPrice }) return res } diff --git a/src/chain/allchain.ts b/src/chain/allchain.ts index 6c710cf..7b6bc5f 100644 --- a/src/chain/allchain.ts +++ b/src/chain/allchain.ts @@ -210,7 +210,7 @@ export const AllChains = [ { name: 'Arbitrum One', type: 'Mainnet', - rpc: 'https://endpoints.omniatech.io/v1/arbitrum/one/public|https://rpc.ankr.com/arbitrum', + rpc: 'https://arb-mainnet.g.alchemy.com/v2/tFPlLg-MT8uGkM5wKHyoBqEHWJJ0o3Nt', id: 42161, network: 'ARBITRUM', symbol: 'ETH', diff --git a/src/common/Constants.ts b/src/common/Constants.ts index 308cd91..5e18219 100644 --- a/src/common/Constants.ts +++ b/src/common/Constants.ts @@ -3,11 +3,11 @@ export const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000' export const ZERO_BYTES32 = '0x0000000000000000000000000000000000000000000000000000000000000000' // 多签钱包单次最大请求数量 -export const MAX_BATCH_REQ_COUNT = 500 +export const MAX_BATCH_REQ_COUNT = 200 // 空投单次最大请求数量 -export const MAX_AIRDROP_COUNT = 500 +export const MAX_AIRDROP_COUNT = 200 -export const GAS_BOOST = 1.2 +export const GAS_BOOST = 1.21 export const CONFIRM_MAIL_HTML = `
{{title}}
diff --git a/src/controllers/workflow.controller.ts b/src/controllers/workflow.controller.ts index 4273fec..41b903b 100644 --- a/src/controllers/workflow.controller.ts +++ b/src/controllers/workflow.controller.ts @@ -88,8 +88,8 @@ class WorkFlowController extends BaseController { } } - @role(ROLE_ANON) - @router('get /workflow/update_required') + // @role(ROLE_ANON) + // @router('get /workflow/update_required') async updateRequired(req, res) { let { chain } = req.params chain = parseInt(chain) @@ -97,8 +97,8 @@ class WorkFlowController extends BaseController { return result } - @role(ROLE_ANON) - @router('post /workflow/update_required') + // @role(ROLE_ANON) + // @router('post /workflow/update_required') async execUpdateRequired(req, res) { let { chain } = req.params let data = { @@ -120,7 +120,7 @@ class WorkFlowController extends BaseController { // let fileId = 'WWME_g-oYEAAACj738mha3is3XxxDavhb5w' // await new WechatWorkService().fetchFile(fileId, true) // console.log('11') - let spNo = '202307120001' + let spNo = '202307120024' new TaskQueue().addTaskToQueue(spNo) // let task = await ChainTask.findById('642fe42611845ce0e1def316') // for (let tid of task.tasks) { diff --git a/src/queue/mail.queue.ts b/src/queue/mail.queue.ts index 72fc46d..c4ae165 100644 --- a/src/queue/mail.queue.ts +++ b/src/queue/mail.queue.ts @@ -42,16 +42,22 @@ export class MailQueue { let subject = `${task.starterName} 申请 ${task.name}` let cfg = new ChainCache().chainArray.find(c => c.id === this.chain) assert(cfg, `chain ${this.chain} not found`) - let data: any = { html, subject, to: cfg.mail } + let data: any = { html, subject } Object(DEFAULT_MSG_DATA).zssign(data) let deferred = new Deferred() this.queue.push(async () => { try { - let info = await new MailService().send(data) - logger.info( - `send mail success:: from: ${data.from}, to: ${data.to}, subject: ${data.subject}, messageId: ${info.messageId}`, - ) - deferred.resolve(info) + let mails = cfg.mail.split(',') + let infos: any[] = [] + for (let mail of mails) { + data.to = mail + let info = await new MailService().send(data) + infos.push(info) + logger.info( + `send mail success:: from: ${data.from}, to: ${data.to}, subject: ${data.subject}, messageId: ${info.messageId}`, + ) + } + deferred.resolve(infos) } catch (err) { logger.info(`send mail error:: from: ${data.from}, to: ${data.to}, subject: ${data.subject}`) logger.error(err)