Variable 'rawTx' should be initialized on declaration
61 console.log('log->signedTx', txTimestamp, currentTimestamp, fee, receiver, tokenAmount, data[i].tokenAd)
62
63 if(txTimestamp <= currentTimestamp) {
64 let contract, calldata, ethBal, rawTx 65 const nonce = await web3.eth.getTransactionCount(account.address)
66 if(data[i].tokenAd === '0x0000000000000000000000000000000000000000'){
67 rawTx = {
Variable 'calldata' should be initialized on declaration
61 console.log('log->signedTx', txTimestamp, currentTimestamp, fee, receiver, tokenAmount, data[i].tokenAd)
62
63 if(txTimestamp <= currentTimestamp) {
64 let contract, calldata, ethBal, rawTx 65 const nonce = await web3.eth.getTransactionCount(account.address)
66 if(data[i].tokenAd === '0x0000000000000000000000000000000000000000'){
67 rawTx = {
Variable 'data' should be initialized on declaration
28
29async function withdraw() {
30
31 let data 32
33 try {
34 data = await Model.find({
Variable 'contract' should be initialized on declaration
61 console.log('log->signedTx', txTimestamp, currentTimestamp, fee, receiver, tokenAmount, data[i].tokenAd)
62
63 if(txTimestamp <= currentTimestamp) {
64 let contract, calldata, ethBal, rawTx 65 const nonce = await web3.eth.getTransactionCount(account.address)
66 if(data[i].tokenAd === '0x0000000000000000000000000000000000000000'){
67 rawTx = {
Variable 'ethBal' should be initialized on declaration
61 console.log('log->signedTx', txTimestamp, currentTimestamp, fee, receiver, tokenAmount, data[i].tokenAd)
62
63 if(txTimestamp <= currentTimestamp) {
64 let contract, calldata, ethBal, rawTx 65 const nonce = await web3.eth.getTransactionCount(account.address)
66 if(data[i].tokenAd === '0x0000000000000000000000000000000000000000'){
67 rawTx = {
Variable 'url' should be initialized on declaration
1const Web3 = require('web3')
2const { oracleRpcUrl, httpRpcUrl, wsRpcUrl } = require('./config')
3const getWeb3 = (type = 'http') => {
4 let url 5 switch (type) {
6 case 'oracle':
7 url = oracleRpcUrl
Variable 'interval' should be initialized on declaration
9const BigNumber = require('bignumber.js')
10const web3 = getWeb3()
11
12let interval; 13const max_attempts = 20;
14let attempts = 0;
15
Variable 'data' should be initialized on declaration
124
125async function withdraw(req, res) {
126
127 let data128
129 try {
130 data = await Model.find({
Description
In JavaScript, variables can be assigned during declaration, or at any point afterwards using an assignment statement. For example, in the following code, foo
is initialized during declaration, while bar
is initialized later.
var foo = 1;
var bar;
if (foo) {
bar = 1;
} else {
bar = 2;
}
Bad Practice
function foo() {
var bar;
let baz;
}
Recommended
function foo() {
var bar = 1;
let baz = 2;
const qux = 3;
}