Debugging
This commit is contained in:
parent
73c0ee9821
commit
9ec17b4d55
@ -268,7 +268,7 @@ function cancelOrder(type, id, proxySecret) {
|
||||
type: "cancel_order",
|
||||
order: type,
|
||||
id: id,
|
||||
timestamp: data.timestamp
|
||||
timestamp: request.timestamp
|
||||
}, proxySecret);
|
||||
console.debug(request);
|
||||
|
||||
|
||||
@ -303,14 +303,9 @@
|
||||
}
|
||||
|
||||
function refresh(init = false) {
|
||||
if (init) {
|
||||
if (init)
|
||||
console.info("init");
|
||||
try {
|
||||
proxy.secret;
|
||||
} catch (error) {
|
||||
console.warn(error);
|
||||
}
|
||||
} else
|
||||
else
|
||||
console.info("refresh");
|
||||
list_buy();
|
||||
list_sell();
|
||||
@ -381,7 +376,11 @@
|
||||
row.insertCell().textContent = o.unitValue;
|
||||
row.insertCell().textContent = new Date(o.tx_time);
|
||||
});
|
||||
|
||||
try {
|
||||
proxy.secret;
|
||||
} catch (error) {
|
||||
console.warn(error);
|
||||
}
|
||||
}).catch(error => {
|
||||
if (error instanceof ResponseError) {
|
||||
let response = JSON.parse(error.data)
|
||||
@ -390,6 +389,7 @@
|
||||
document.getElementById('user-container').style.display = "none";
|
||||
document.getElementById("login-form").style.display = "block";
|
||||
document.forms['login-form']["sid"].value = response.sid;
|
||||
proxy.clear();
|
||||
} else
|
||||
console.error(error);
|
||||
})
|
||||
|
||||
@ -107,7 +107,6 @@ function addSellOrder(floID, quantity, min_price) {
|
||||
DB.query("SELECT SUM(quantity) AS locked FROM SellOrder WHERE floID=?", [floID]).then(result => {
|
||||
let locked = result.pop()["locked"] || 0;
|
||||
let available = total - locked;
|
||||
console.debug(total, locked, available);
|
||||
if (available < quantity)
|
||||
return reject(INVALID("Insufficient FLO (Some FLO are locked in another sell order)"));
|
||||
DB.query("INSERT INTO SellOrder(floID, quantity, minPrice) VALUES (?, ?, ?)", [floID, quantity, min_price])
|
||||
@ -135,7 +134,6 @@ function addBuyOrder(floID, quantity, max_price) {
|
||||
DB.query("SELECT SUM(maxPrice * quantity) AS locked FROM BuyOrder WHERE floID=?", [floID]).then(result => {
|
||||
let locked = result.pop()["locked"] || 0;
|
||||
let available = total - locked;
|
||||
console.debug(total, locked, available);
|
||||
if (available < quantity * max_price)
|
||||
return reject(INVALID("Insufficient Rupee balance (Some rupee tokens are locked in another buy order)"));
|
||||
DB.query("INSERT INTO BuyOrder(floID, quantity, maxPrice) VALUES (?, ?, ?)", [floID, quantity, max_price])
|
||||
@ -569,7 +567,6 @@ function withdrawRupee(floID, amount) {
|
||||
DB.query("SELECT SUM(quantity) AS locked FROM SellOrder WHERE floID=?", [floID]).then(result => {
|
||||
let locked = result.pop()["locked"] || 0;
|
||||
let available = total - locked;
|
||||
console.debug(total, locked, available);
|
||||
if (available < required_flo)
|
||||
return reject(INVALID(`Insufficient FLO (Some FLO are locked in sell orders)! Required ${required_flo} FLO to withdraw tokens`));
|
||||
DB.query("SELECT rupeeBalance FROM Users WHERE floID=?", [floID]).then(result => {
|
||||
|
||||
@ -45,6 +45,7 @@ function validateRequest(request, sign, pubKey) {
|
||||
}
|
||||
|
||||
function storeRequest(floID, req_str, sign) {
|
||||
console.debug(floID, req_str);
|
||||
DB.query("INSERT INTO Request_Log (floID, request, sign) VALUES (?,?,?)", [floID, req_str, sign])
|
||||
.then(_ => null).catch(error => console.error(error));
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user