Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
module.exports = async (done) => {
// Get command-line arguments (remove args from truffle)
let args = process.argv.splice(4);
// Validate arguments
if (args.length != 2) done('Incorrect number of arguments. Please enter: node address, average load.');
if (!Web3.utils.isAddress(args[0])) done('Node address is invalid.');
// Parse arguments
let [nodeAddress, averageLoad] = args;
// Get contract dependencies
const rocketNodeStatus = await RocketNodeStatus.deployed();
// Estimate gas required to check in
let gasEstimate = await rocketNodeStatus.nodeCheckin.estimateGas(averageLoad, {from: nodeAddress});
// Check in
let result = await rocketNodeStatus.nodeCheckin(averageLoad, {from: nodeAddress, gas: parseInt(gasEstimate) + 100000});
// Complete
done('Node successfully checked in: ' + args.join(', '));
fs.readdirSync(`${tokensDirectory}/${folder}`).forEach(file => {
if (
path.extname(file) === '.json' &&
web3.utils.isAddress(file.replace('.json', ''))
) {
const fullPath = `${tokensDirectory}/${folder}/${file}`;
const obj = JSON.parse(fs.readFileSync(fullPath, 'utf8'));
validateObject(constraints, obj, fullPath);
if (validate(obj, constraints) !== undefined) {
const errs = validate(obj, constraints);
Object.keys(errs).forEach(key => {
console.error(
`${errs[key][0]} for ${file} in ${tokensDirectory}/${folder}`
);
});
process.exit(1);
}
} else {
console.error('Incorrect file name or file extension');
process.exit(1);
conversionRate,
conversionRateDecimals,
requiredPriceOracleDecimals
) {
if (!(auxiliaryWeb3 instanceof Web3)) {
throw new TypeError(`Mandatory Parameter 'auxiliaryWeb3' is missing or invalid: ${auxiliaryWeb3}`);
}
if (!Web3.utils.isAddress(organization)) {
const err = new TypeError(`Invalid organization address ${organization}.`);
return Promise.reject(err);
}
if (!Web3.utils.isAddress(eip20Token)) {
const err = new TypeError(`Invalid eip20Token address ${eip20Token}.`);
return Promise.reject(err);
}
if (!Web3.utils.isAddress(tokenRules)) {
const err = new TypeError(`Invalid tokenRules address ${tokenRules}.`);
return Promise.reject(err);
}
if (!baseCurrencyCode) {
const err = new TypeError(`baseCurrencyCode is invalid or missing ${baseCurrencyCode}.`);
return Promise.reject(err);
}
const abiBinProvider = new AbiBinProvider();
const bin = abiBinProvider.getBIN(ContractName);
const bytesBaseCurrencyCode = auxiliaryWeb3.utils.stringToHex(baseCurrencyCode);
const args = [
organization,
eip20Token,
bytesBaseCurrencyCode,
Web3Single.prototype.setUpOptions = function (_options) {
if (!_options)
_options = {};
if (!_options.numberOfConfirmation)
_options.numberOfConfirmation = 0;
if (_options.gasPrice)
_options.gasPrice = new WEB3.utils.BN(_options.gasPrice);
if (_options.gas)
_options.gas = new WEB3.utils.BN(_options.gas);
return _options;
};
/**
.then(({ data }) =>
this.setState({ balance: Web3.utils.fromWei(data.balance) })
)
function toChecksumAddress(address) {
const Web3 = require('web3');
return Web3.utils.toChecksumAddress(address);
}
import axios from 'axios';
import { Wallet } from '@/services/Wallets/Wallet.js';
import { StringHelper } from '@/services/helper';
import { Ethereum } from '@/services/Wallets/Ethereum.js';
import { TokenERC721 } from '@/services/Wallets/Collectibles/TokenERC721';
const Web3 = require('web3');
const BN = Web3.utils.BN;
const BigNumber = require('bignumber.js');
const EthereumTx = require('ethereumjs-tx');
const abi = require('@/contracts/Wallet/CryptoStrikers.json');
export class CryptoStrikers extends TokenERC721 {
constructor() {
super();
this.className = 'CryptoStrikers';
this.isToken = true;
this.contractAddress = '0xdcaad9fd9a74144d226dbf94ce6162ca9f09ed7e';
this.decimals = 0;
this.customToken = true;
this.title = 'CryptoStrikers';
this.name = 'STRK';
approveBountyAmount(txOptions) {
if (!txOptions) {
const err = new TypeError(`Invalid transaction options: ${txOptions}.`);
return Promise.reject(err);
}
if (!Web3.utils.isAddress(txOptions.from)) {
const err = new TypeError(`Invalid from address: ${txOptions.from}.`);
return Promise.reject(err);
}
return this.getBaseTokenContract().then((eip20BaseToken) => {
return this.getBounty().then((bounty) =>
eip20BaseToken.approve(this.address, bounty, txOptions),
);
});
}
onClick={(e) => this.queryAsset(Web3.utils.asciiToHex(this.state.hashValue))}>
Check owner