fix: 完善工单
This commit is contained in:
@@ -2,18 +2,31 @@
|
||||
// 该脚本只用于系统账户对用户进行提现转账
|
||||
const { ERC20 } = require('../utils/erc20');
|
||||
const { inject } = require('./Provider');
|
||||
const { USDTAddr } = require('./constant');
|
||||
// const { USDTAddr } = require('./constant');
|
||||
const crypto = require('../utils/crypto');
|
||||
|
||||
const RootAccount = inject(function (SysConfig) {
|
||||
const ROOTSECWORD = inject(function (SysConfig) {
|
||||
const { ROOTSECWORD } = SysConfig;
|
||||
return ERC20.fromMnemonic(ROOTSECWORD, USDTAddr);
|
||||
return ROOTSECWORD;
|
||||
});
|
||||
const VICCONTRACTADDR = inject(function (SysConfig) {
|
||||
const { VICCONTRACTADDR } = SysConfig;
|
||||
return VICCONTRACTADDR;
|
||||
});
|
||||
const VICSECWORD = inject(function (SysConfig) {
|
||||
const { VICSECWORD } = SysConfig;
|
||||
return VICSECWORD;
|
||||
});
|
||||
|
||||
module.exports = {
|
||||
async sendUSDT2User (toAddress, amount, option = {}) {
|
||||
return await RootAccount.transfer(toAddress, amount, option);
|
||||
const { path } = option;
|
||||
const kp = crypto.secword2keypair(ROOTSECWORD, { path });
|
||||
const account = new ERC20(kp.seckey);
|
||||
return await account.transfer(toAddress, amount, option);
|
||||
},
|
||||
async sendVIC2User (toAddress, amount, option = {}) {
|
||||
return await RootAccount.transfer(toAddress, amount, Object.assign(option, { decimals: 18 }));
|
||||
const account = ERC20.fromMnemonic(VICSECWORD, VICCONTRACTADDR);
|
||||
return await account.transfer(toAddress, amount, Object.assign(option, { decimals: 18 }));
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user