Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
augur.rpc.eth.getBalance([marketMailboxAddress, "latest"], function (attoEthBalance) {
var ethBalance = speedomatic.bignum(attoEthBalance);
var combined = speedomatic.unfix(ethBalance.add(cashBalance), "string");
console.log(chalk.green.dim("Total balance:"), chalk.green(combined));
process.exit();
});
});
augur.rpc.eth.getBalance([account, "latest"], function (err, etherBalance) {
if (err) return console.error(err);
if (etherBalance == null) return console.error("rpc.eth.getBalance failed:", etherBalance);
var balances = {
reputation: speedomatic.unfix(reputationBalance, "string"),
ether: speedomatic.unfix(etherBalance, "string"),
};
console.log(chalk.cyan("Balances:"));
console.log("Ether: " + chalk.green(balances.ether));
console.log("Reputation: " + chalk.green(balances.reputation));
process.exit(0);
});
});
augur.rpc.eth.getBalance([account, "latest"], function (err, etherBalance) {
if (err) return console.error(err);
if (etherBalance == null) return console.error("rpc.eth.getBalance failed:", etherBalance);
var balances = {
reputation: speedomatic.unfix(reputationBalance, "string"),
ether: speedomatic.unfix(etherBalance, "string"),
};
console.log(chalk.cyan("Balances:"));
console.log("Ether: " + chalk.green(balances.ether));
console.log("Reputation: " + chalk.green(balances.reputation));
process.exit(0);
});
});
augur.rpc.eth.getBalance([address, "latest"], (err: any, attoEtherBalance: String) => {
if (err) return callback(err);
const etherBalance = speedomatic.unfix(attoEtherBalance, "string");
callback(null, etherBalance, address);
});
}
module.exports = function (positionInMarket) {
var numOutcomes, position, i;
if (!positionInMarket || positionInMarket.error) return positionInMarket;
numOutcomes = positionInMarket.length;
position = {};
for (i = 0; i < numOutcomes; ++i) {
position[i + 1] = speedomatic.unfix(speedomatic.hex(positionInMarket[i], true), "string");
}
return position;
};
var fullPrecisionAmount = speedomatic.unfix(order[0]);
var amount = roundToPrecision(fullPrecisionAmount, constants.MINIMUM_TRADE_SIZE);
if (amount === null) return null;
var fullPrecisionPrice = denormalizePrice({ minPrice: minPrice, maxPrice: maxPrice, normalizedPrice: speedomatic.unfixSigned(order[1]) });
var price = roundToPrecision(new BigNumber(fullPrecisionPrice, 10), constants.PRECISION.zero, round, roundingMode);
if (price === null) return null;
return {
amount: amount,
fullPrecisionAmount: fullPrecisionAmount.toFixed(),
price: price,
fullPrecisionPrice: fullPrecisionPrice,
owner: speedomatic.formatEthereumAddress(order[2]),
tokensEscrowed: speedomatic.unfix(order[3], "string"),
sharesEscrowed: speedomatic.unfix(order[4], "string"),
betterOrderId: speedomatic.formatInt256(order[5]),
worseOrderId: speedomatic.formatInt256(order[6]),
gasPrice: speedomatic.encodeNumberAsBase10String(order[7]),
};
};
var fullPrecisionAmount = speedomatic.unfix(order[0]);
var amount = roundToPrecision(fullPrecisionAmount, constants.MINIMUM_TRADE_SIZE);
if (amount === null) return null;
var fullPrecisionPrice = denormalizePrice({ minPrice: minPrice, maxPrice: maxPrice, normalizedPrice: speedomatic.unfixSigned(order[1]) });
var price = roundToPrecision(new BigNumber(fullPrecisionPrice, 10), constants.PRECISION.zero, round, roundingMode);
if (price === null) return null;
return {
amount: amount,
fullPrecisionAmount: fullPrecisionAmount.toFixed(),
price: price,
fullPrecisionPrice: fullPrecisionPrice,
owner: speedomatic.formatEthereumAddress(order[2]),
tokensEscrowed: speedomatic.unfix(order[3], "string"),
sharesEscrowed: speedomatic.unfix(order[4], "string"),
betterOrderId: speedomatic.formatInt256(order[5]),
worseOrderId: speedomatic.formatInt256(order[6]),
gasPrice: speedomatic.encodeNumberAsBase10String(order[7]),
};
};
function isSpecialValueConsensusOutcome(fxpConsensusOutcome, minValue, maxValue) {
var bnFxpConsensusOutcome, meanValue;
bnFxpConsensusOutcome = speedomatic.bignum(fxpConsensusOutcome);
if (bnFxpConsensusOutcome.eq(1)) {
return "0";
}
meanValue = speedomatic.fix(maxValue).plus(speedomatic.fix(minValue)).dividedBy(2);
if (bnFxpConsensusOutcome.eq(meanValue.plus(1))) {
return speedomatic.unfix(meanValue, "string");
}
return false;
}
export function formatGasCostToEther(num, opts, gasPrice) {
const gas = unfix(num, "number");
const estimatedGasCost = createBigNumber(gas).times(
createBigNumber(gasPrice)
);
return formatGasCost(estimatedGasCost, opts).rounded;
}
augur.rpc.eth.getBalance([address, "latest"], function (err, etherBalance) {
if (err) return callback(err);
if (etherBalance == null) return callback(new Error("rpc.eth.getBalance failed"));
return callback(null, {
reputation: speedomatic.unfix(reputationBalance, "string"),
ether: speedomatic.unfix(etherBalance, "string"),
});
});
});