Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
maxPrice: "1",
order: [],
},
assertions: function (output) {
assert.isNull(output);
},
});
test({
description: "single order",
params: {
type: 1,
minPrice: "0",
maxPrice: "1",
orderBookArray: [
"0x1", // orderId
speedomatic.fix("1.1111111", "hex"), // amount
speedomatic.fix("0.7777777", "hex"), // price
"0xb0b", // owner
speedomatic.fix("0.8641974", "hex"), // tokensEscrowed
speedomatic.fix("0", "hex"), // sharesEscrowed
"0xa", // betterOrderId
"0xb", // worseOrderId
"0x4a817c800", // gasPrice
],
},
assertions: function (output) {
assert.deepEqual(output, {
"0x1": {
amount: "1.1111",
fullPrecisionAmount: "1.1111111",
price: "0.7777",
fullPrecisionPrice: "0.7777777",
getOrder: function (p, callback) {
assert.deepEqual(p, {
_type: 1,
_market: "MARKET_ID",
_outcome: "OUTCOME_ID",
_orderId: "0xa"
});
callback(null, [
speedomatic.fix("1.1111111", "hex"), // amount
speedomatic.fix("0.7777777", "hex"), // price
"0xb0b", // owner
speedomatic.fix("0.8641974", "hex"), // tokensEscrowed
speedomatic.fix("0", "hex"), // sharesEscrowed
"0xa", // betterOrderId
"0xb", // worseOrderId
"0x4a817c800" // gasPrice
]);
}
}
getOrCacheDesignatedReportNoShowBond: function (p, callback) {
assert.deepEqual(p, { tx: { to: "UNIVERSE_ADDRESS", send: false } });
callback(null, speedomatic.fix("1", "string"));
},
getOrCacheValidityBond: function (p, callback) {
getOrCacheDesignatedReportNoShowBond: function (p, callback) {
assert.deepEqual(p, { tx: { to: "UNIVERSE_ADDRESS", send: false } });
callback(null, speedomatic.fix("1", "string"));
},
getOrCacheMarketCreationCost: function (p, callback) {
getOrCacheValidityBond: function (p, callback) {
assert.deepEqual(p, { tx: { to: "UNIVERSE_ADDRESS", send: false } });
callback(null, speedomatic.fix("3", "string"));
},
getOrCacheReportingFeeDivisor: function (p, callback) {
getOrCacheMarketCreationCost: function (p, callback) {
assert.deepEqual(p, { tx: { to: "UNIVERSE_ADDRESS", send: false } });
callback(null, speedomatic.fix("4.2", "string"));
},
},
assert.oneOf(p._fxpAmount, ["0x38d7ea4c68000", "0x110d9316ec000"]);
assert.strictEqual(p._price, "0x1388");
assert.strictEqual(p._tradeGroupId, "0x1");
assert.isFunction(p.onSent);
assert.isFunction(p.onSuccess);
assert.isFunction(p.onFailed);
if (p._fxpAmount === "0x38d7ea4c68000") {
assert.strictEqual(counter, 0);
counter++;
p.onSent({ hash: "TRANSACTION_HASH_1" });
p.onSuccess({ hash: "TRANSACTION_HASH_1", value: speedomatic.fix("4", "string") });
} else {
assert.strictEqual(counter, 1);
counter++;
p.onSent({ hash: "TRANSACTION_HASH_2" });
p.onSuccess({ hash: "TRANSACTION_HASH_2", value: speedomatic.fix("1", "string") });
}
},
},
"use strict";
var abi = require("../../../src/contracts/abi");
var speedomatic = require("speedomatic");
var encodeTransactionInputs = require("../../../src/api/encode-transaction-inputs");
var hashEventAbi = require("../../../src/events/hash-event-abi");
var marketCreatedEventAbi = abi.Augur.find(function (abi) {
return abi.type === "event" && abi.name === "MarketCreated";
});
var marketCreatedEventNonIndexedInputs = marketCreatedEventAbi.inputs.filter(function (abi) { return !abi.indexed; });
var marketCreatedParamTypes = marketCreatedEventNonIndexedInputs.map(function (abi) { return abi.type; });
var marketCreatedParamObject = {
market: "0xbb785f16f6aab68007e897ac3560378d8d6ffd16",
marketCreationFee: speedomatic.fix("0.010000000006", "hex"),
minPrice: "0x0",
maxPrice: speedomatic.fix("10000", "hex"),
marketType: "0x0",
description: "Will SpaceX successfully complete a manned flight to the International Space Station by the end of 2018?",
outcomes: [0, 0],
extraInfo: JSON.stringify({
resolutionSource: "http://www.spacex.com",
tags: ["SpaceX", "spaceflight"],
longDescription: "SpaceX hit a big milestone on Friday with NASA confirming on Friday that the Elon Musk-led space cargo business will launch astronauts to the International Space Station by 2017.\n\nLast year, the space agency tentatively awarded a $2.6 billion contract to SpaceX to carry crew to space. NASA’s announcement on Friday formalizes the deal, which involves SpaceX loading its Crew Dragon spacecraft with astronauts and sending them beyond the stratosphere.",
}),
};
module.exports = {
abi: marketCreatedEventAbi,
eventSignature: hashEventAbi(marketCreatedEventAbi),
params: marketCreatedParamObject,
calculateGasEstimates(gasPrice) {
const { submitMarketContribute, market } = this.props;
const { selectedOutcome, isMarketInValid, stakeInfo } = this.state;
if (createBigNumber(stakeInfo.repValue).gt(ZERO)) {
const amount = speedomatic.fix(stakeInfo.repValue, "hex");
submitMarketContribute({
estimateGas: true,
marketId: market.id,
selectedOutcome,
invalid: isMarketInValid,
amount,
history: null,
returnPath: null,
callback: (err, gasEstimateValue) => {
if (err) return console.error(err);
this.setState({
gasEstimate: formatGasCostToEther(
gasEstimateValue,
{ decimalsRounded: 4 },
gasPrice
function sendEther(p) {
return ethrpc.transact({
from: p.from,
to: p.to,
value: speedomatic.fix(p.etherToSend, "hex"),
returns: "null",
gas: "0xcf08",
}, p.meta.signer, p.meta.accountType, p.onSent, p.onSuccess, p.onFailed);
}