Bugfixes - liquidateTokenAndPerp, tokenBalance
This commit is contained in:
parent
2fc8605bc9
commit
40970da3ff
|
@ -827,8 +827,8 @@ function parseFillLog(
|
|||
let assetSymbol;
|
||||
let liabSymbol;
|
||||
|
||||
let assetType = eventData.assetType;
|
||||
let liabType = eventData.liabType;
|
||||
let assetType = eventData.assetType === 0 ? 'Token': 'Perp';
|
||||
let liabType = eventData.liabType === 0 ? 'Token': 'Perp';
|
||||
|
||||
let assetDecimals;
|
||||
let liabDecimals;
|
||||
|
@ -867,18 +867,17 @@ function parseFillLog(
|
|||
|
||||
let assetPrice =
|
||||
new I80F48(eventData.assetPrice).toNumber() *
|
||||
Math.pow(10, assetToken.decimals - quoteDecimals);
|
||||
Math.pow(10, assetDecimals - quoteDecimals);
|
||||
let liabPrice =
|
||||
new I80F48(eventData.liabPrice).toNumber() *
|
||||
Math.pow(10, liabToken.decimals - quoteDecimals);
|
||||
Math.pow(10, liabDecimals - quoteDecimals);
|
||||
|
||||
// TODO: confirm that this is correct
|
||||
let assetTransfer =
|
||||
new I80F48(eventData.assetTransfer).toNumber() /
|
||||
Math.pow(10, assetToken.decimals);
|
||||
Math.pow(10, assetDecimals);
|
||||
let liabTransfer =
|
||||
new I80F48(eventData.liabTransfer).toNumber() /
|
||||
Math.pow(10, liabToken.decimals);
|
||||
Math.pow(10, liabDecimals);
|
||||
|
||||
return {
|
||||
liqor: liqor,
|
||||
|
@ -1054,6 +1053,12 @@ function parseFillLog(
|
|||
let tokens = ids["groups"].find((e) => e["publicKey"] === mangoGroupPk)[
|
||||
"tokens"
|
||||
];
|
||||
let quoteSymbol = ids['groups'].find((e) => e['publicKey'] === mangoGroupPk)[
|
||||
'quoteSymbol'
|
||||
];
|
||||
let quoteDecimals = ids['groups']
|
||||
.find((e) => e['publicKey'] === mangoGroupPk)
|
||||
['tokens'].find((e) => e.symbol === quoteSymbol).decimals;
|
||||
|
||||
let mangoAccountPk = eventData.mangoAccount.toString();
|
||||
let tokenIndex = eventData.tokenIndex.toNumber();
|
||||
|
@ -1063,10 +1068,10 @@ function parseFillLog(
|
|||
let symbol = token.symbol;
|
||||
|
||||
let deposit = new I80F48(eventData.deposit)
|
||||
.div(I80F48.fromNumber(Math.pow(10, token.decimals)))
|
||||
.div(I80F48.fromNumber(Math.pow(10, token.decimals - quoteDecimals)))
|
||||
.toNumber();
|
||||
let borrow = new I80F48(eventData.borrow)
|
||||
.div(I80F48.fromNumber(Math.pow(10, token.decimals)))
|
||||
.div(I80F48.fromNumber(Math.pow(10, token.decimals - quoteDecimals)))
|
||||
.toNumber();
|
||||
|
||||
return {
|
||||
|
|
|
@ -141,6 +141,8 @@ async function insertTransactions(
|
|||
{ table: transactionsTable },
|
||||
);
|
||||
|
||||
console.log('Starting transaction inserts')
|
||||
|
||||
let batchSize = 1000;
|
||||
let client = await pool.connect();
|
||||
try {
|
||||
|
|
|
@ -77,6 +77,10 @@ export function parseTransactions(transactionsResult, mangoProgramId) {
|
|||
),
|
||||
);
|
||||
|
||||
// Anchor logging was deployed at slot 100936906 - use different parsing code before and after this slot
|
||||
const ancorDeploymentSlot = 100936906
|
||||
if (slot < ancorDeploymentSlot) {
|
||||
|
||||
// Populate instruction num and name for each instruction
|
||||
let ixNum = 1;
|
||||
for (const ix of instructions) {
|
||||
|
@ -88,9 +92,6 @@ export function parseTransactions(transactionsResult, mangoProgramId) {
|
|||
ixNum++;
|
||||
}
|
||||
|
||||
// Anchor logging was deployed at slot 100936906 - use different parsing code before and after this slot
|
||||
const ancorDeploymentSlot = 100936906
|
||||
if (slot < ancorDeploymentSlot) {
|
||||
jsonParser(parsedTransactions, result, instructions, signature, blockTime, slot, blockDatetime)
|
||||
} else {
|
||||
anchorParser(parsedTransactions, result, signature, blockTime, slot, blockDatetime)
|
||||
|
|
|
@ -44,7 +44,10 @@ async function processMangoTransactions(rawTransactionsPool, schema, limit) {
|
|||
"3KzZ5jYfwp6LyPUt5LFbbPLEEsYNYtdAA5hs2KAdZxqarFiVVUKJ7WFxYXf8xeFnbWwypEWpNRCeE1d3y4e5Sxrk", // FillLog
|
||||
"NGgdZu6YwNnFGoSMxc6ZgfUhSVy2rkB9BDY9yvYRLYZoteDSArWn5hDUGZuYCktC81jzGb6u9W6u7ab9mWutfQe", // SettlePnl
|
||||
"67axUM8Q6tvCCNa6Cq8JfR9pLCAf5wyqc7gy1eafEtA4kcYE9Gte1LT8b9ziEWhtLfaGim5t5ChYU5uaQLfteGTJ", // SettlePnl - Multiple
|
||||
"24hCHGXrf9nCnkioWf6HxtRqnQHGhhtTkARgA9tqkEmWb3uUzuE2oUU3so1JGNGZftCaBMjWek5rqAHRU3VAyQEJ" // Multiple net balances changes to the same (mangoAccount, token) pair
|
||||
"24hCHGXrf9nCnkioWf6HxtRqnQHGhhtTkARgA9tqkEmWb3uUzuE2oUU3so1JGNGZftCaBMjWek5rqAHRU3VAyQEJ", // Multiple net balances changes to the same (mangoAccount, token) pair
|
||||
"eu5yMAACP41tvHAMmhuRAqu9tW4ZJeVY37TqbJLYVaqavKNh1rQEH97QGq6j3Zm721dgjMs94qmLm9PiSPDcwfX", // force_settle_quote_positions
|
||||
"3twdGBA3Fz9Sbn4hS8AbHEcLomj8KyLVcB9P7ToiVP83cnHEHS7WFKgcsAa2TaDvYJ8emuhmBGWDybbtxVjgZXGt", // LiquidateTokenAndPerp
|
||||
"3nQBUy8naBUj7US3PiVkcUt75jV4bszuQEV2vYMgrbYJGTJAbseuQJ7HvCQBhpWZqUUWPCeT72px1ijWdd4zC5ZG" // netbalances
|
||||
];
|
||||
|
||||
let signaturesSql = signatures.map((e) => "'" + e + "'").join(',');
|
||||
|
|
Loading…
Reference in New Issue