From e1499c2d586ce17f4d729d5960740153bedf181d Mon Sep 17 00:00:00 2001 From: LukasDeco Date: Fri, 23 Aug 2024 10:04:15 -0600 Subject: [PATCH 01/13] fix: check BN 0 and tx error on fail swaps --- packages/indexer/src/builders/swaps.ts | 10 +++++++++- packages/indexer/src/types/errors.ts | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/indexer/src/builders/swaps.ts b/packages/indexer/src/builders/swaps.ts index 27b47105..91761463 100644 --- a/packages/indexer/src/builders/swaps.ts +++ b/packages/indexer/src/builders/swaps.ts @@ -206,6 +206,14 @@ export class SwapBuilder { (userQuotePreBalance ?? BigInt(0)) ).abs(); + if ( + !!tx.err && + quoteAmount.toNumber() === 0 && + baseAmount.toNumber() === 0 + ) { + return Err({ type: AmmInstructionIndexerError.FailedSwap }); + } + // determine price // NOTE: This is estimated given the output is a min expected value // default is input / output (buying a token with USDC or whatever) @@ -246,7 +254,7 @@ export class SwapBuilder { const ammPrice = quoteAmount && baseAmount ? quoteAmount.mul(new BN(10).pow(new BN(12))).div(baseAmount) - : 0; + : new BN(0); const price = getHumanPrice( ammPrice, baseToken[0].decimals, diff --git a/packages/indexer/src/types/errors.ts b/packages/indexer/src/types/errors.ts index 8e1af1a1..440f1468 100644 --- a/packages/indexer/src/types/errors.ts +++ b/packages/indexer/src/types/errors.ts @@ -1,6 +1,7 @@ export enum AmmInstructionIndexerError { GeneralError = "GeneralError", MissingMarket = "MissingMarket", + FailedSwap = "FailedSwap", } export enum SwapPersistableError { From d5ab2b2f98d73107fb3b88a482b5c51026a0027f Mon Sep 17 00:00:00 2001 From: LukasDeco Date: Fri, 23 Aug 2024 11:15:42 -0600 Subject: [PATCH 02/13] fix: proper check on quote and base numbers for swaps --- packages/indexer/src/builders/swaps.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/indexer/src/builders/swaps.ts b/packages/indexer/src/builders/swaps.ts index 91761463..be11c187 100644 --- a/packages/indexer/src/builders/swaps.ts +++ b/packages/indexer/src/builders/swaps.ts @@ -252,7 +252,7 @@ export class SwapBuilder { } const ammPrice = - quoteAmount && baseAmount + quoteAmount.toNumber() && baseAmount.toNumber() ? quoteAmount.mul(new BN(10).pow(new BN(12))).div(baseAmount) : new BN(0); const price = getHumanPrice( From 7aed3654a8bb0d59c9293e812691d4c540d937e9 Mon Sep 17 00:00:00 2001 From: LukasDeco Date: Sun, 25 Aug 2024 21:30:09 -0600 Subject: [PATCH 03/13] fix: use service id railway deploy --- .github/workflows/build-staging.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-staging.yml b/.github/workflows/build-staging.yml index 0cdbd8ee..583cbcdd 100644 --- a/.github/workflows/build-staging.yml +++ b/.github/workflows/build-staging.yml @@ -1,7 +1,7 @@ name: STAGING -- Build & Push Docker Image on: push: - branches: [staging] + branches: [staging, fix/staging-cicd] paths: - "**" @@ -47,4 +47,4 @@ jobs: -X POST \ -H "Authorization: Bearer ${{ secrets.RAILWAY_TOKEN }}" \ -H "Content-Type: application/json" \ - --data "{\"query\":\"mutation { deploymentRedeploy(id: \\\"66218c70-8c19-4981-a295-12d442949870\\\") { status } }\"}" \ + --data '{"query": "mutation serviceInstanceDeploy($serviceId: String!, $environmentId: String!) {\n serviceInstanceDeploy(serviceId: $serviceId, environmentId: $environmentId)\n}\n", "variables": { "environmentId": "4015588d-3c82-4413-9484-314539aecd39", "serviceId": "783719dc-3c30-437d-a3a9-b1aeb1d5c487" } }' From f633e2bb731704e7c0b1c20ec4605a33c6ad7e25 Mon Sep 17 00:00:00 2001 From: LukasDeco Date: Sun, 25 Aug 2024 21:32:19 -0600 Subject: [PATCH 04/13] rm: branch testing for cicd --- .github/workflows/build-staging.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-staging.yml b/.github/workflows/build-staging.yml index 583cbcdd..085daf82 100644 --- a/.github/workflows/build-staging.yml +++ b/.github/workflows/build-staging.yml @@ -1,7 +1,7 @@ name: STAGING -- Build & Push Docker Image on: push: - branches: [staging, fix/staging-cicd] + branches: [staging] paths: - "**" From 6b1def6761f6878d45e8ead7d59c824f19769f4e Mon Sep 17 00:00:00 2001 From: LukasDeco Date: Sun, 25 Aug 2024 21:51:18 -0600 Subject: [PATCH 05/13] chore: rm auth endpoints --- packages/indexer/src/endpoints/auth.ts | 160 ------------------------- packages/indexer/src/server.ts | 4 - packages/indexer/src/usecases/auth.ts | 44 ------- 3 files changed, 208 deletions(-) delete mode 100644 packages/indexer/src/endpoints/auth.ts delete mode 100644 packages/indexer/src/usecases/auth.ts diff --git a/packages/indexer/src/endpoints/auth.ts b/packages/indexer/src/endpoints/auth.ts deleted file mode 100644 index f0ac2dbc..00000000 --- a/packages/indexer/src/endpoints/auth.ts +++ /dev/null @@ -1,160 +0,0 @@ -import jwt from "jsonwebtoken"; -import { Request, Response } from "express"; -import { usingDb, eq, gt, and } from "@metadaoproject/indexer-db"; -import { sessions, users } from "@metadaoproject/indexer-db/lib/schema"; -import { AUTHENTICATION_TIME, verifySignature } from "../usecases/auth"; - -const SESSION_NOT_FOUND_ERROR = { - error: "Session doesn't exist or has expired", -}; - -const WRONG_REQUEST_BODY_ERROR = { error: "Wrong request body." }; - -const PRIVATE_KEY = - process.env.RSA_PRIVATE_KEY || - `-----BEGIN PRIVATE KEY----- -... ------END PRIVATE KEY-----`; - -// Function to check for an existing session -async function checkExistingSession(pubkey: string) { - const currentTime = new Date(); - const resp = await usingDb((db) => - db - .select() - .from(sessions) - .where( - and(eq(sessions.userAcct, pubkey), gt(sessions.expiresAt, currentTime)) - ) - ); - - return resp.length ? resp[0] : null; -} - -export async function authPost(req: Request, res: Response) { - try { - const { pubKey } = req.body; - if (!pubKey) return res.status(400).json(WRONG_REQUEST_BODY_ERROR); - - const existingSession = await checkExistingSession(pubKey); - if (existingSession) { - return res - .status(200) - .json({ sessionId: existingSession.id, wasLoggedIn: true }); - } - - await usingDb((db) => - db.insert(users).values({ userAcct: pubKey }).onConflictDoNothing() - ); - const [newSession] = await usingDb((db) => - db - .insert(sessions) - .values({ - userAcct: pubKey, - }) - .returning() - ); - - return res - .status(200) - .json({ sessionId: newSession.id, wasLoggedIn: false }); - } catch (e: any) { - console.error(e); - return res.status(400).json({ error: e.message }); - } -} - -// PUT endpoint for authentication -export async function authPut(req: Request, res: Response) { - try { - const { id, signature, pubKey } = req.body; - if (!pubKey || !signature || !id) - return res.status(400).json(WRONG_REQUEST_BODY_ERROR); - if (!verifySignature(signature, pubKey, id)) - return res.status(400).json({ error: "Invalid signature" }); - - const currentTime = new Date(); - const expiryTime = new Date( - currentTime.getTime() + AUTHENTICATION_TIME * 60000 - ); - - const existingSession = await checkExistingSession(pubKey); - if (existingSession && existingSession.expiresAt) { - const token = jwt.sign( - { - sub: existingSession.id, - pubKey, - iat: Math.floor(existingSession.createdAt.getTime() / 1000), // Issued at - exp: Math.floor(existingSession.expiresAt?.getTime() / 1000), // Expiry time - "https://hasura.io/jwt/claims": { - "x-hasura-default-role": "user", - "x-hasura-allowed-roles": ["user"], - "x-hasura-user-id": pubKey, - }, - }, - PRIVATE_KEY, // Use the RSA private key to sign the JWT - { algorithm: "RS256" } // Specify the RS256 algorithm - ); - return res.status(200).json({ - message: "Session already exists and has not expired.", - sessionId: existingSession.id, - expiryTime, - token, // Include the JWT in the response - }); - } - - await usingDb((db) => - db.insert(users).values({ userAcct: pubKey }).onConflictDoNothing() - ); - const [updatedSession] = await usingDb((db) => - db - .update(sessions) - .set({ userAcct: pubKey, expiresAt: expiryTime }) - .where(eq(sessions.id, id)) - .returning() - ); - - const token = jwt.sign( - { - sub: updatedSession.id, - pubKey, - iat: Math.floor(currentTime.getTime() / 1000), // Issued at - exp: Math.floor(expiryTime.getTime() / 1000), // Expiry time - "https://hasura.io/jwt/claims": { - "x-hasura-default-role": "user", - "x-hasura-allowed-roles": ["user"], - "x-hasura-role": "user", - "x-hasura-user-id": pubKey, - }, - }, - PRIVATE_KEY, // Use the RSA private key to sign the JWT - { algorithm: "RS256" } // Specify the RS256 algorithm - ); - - return res.status(200).json({ - sessionId: updatedSession.id, - message: "Message signed successfully.", - expiryTime, - token, // Include the JWT in the response - }); - } catch (e: any) { - console.error(e); - return res.status(400).json({ error: e.message }); - } -} - -export async function authGet(req: Request, res: Response) { - try { - const { pubkey } = req.body; - - const existingSession = await checkExistingSession(pubkey); - if (!existingSession) return res.status(400).json(SESSION_NOT_FOUND_ERROR); - - return res - .status(200) - .json({ message: "Session valid.", sessionId: existingSession.id }); - } catch (e: any) { - console.error(e); - return res.status(400).json({ error: e.message }); - } -} diff --git a/packages/indexer/src/server.ts b/packages/indexer/src/server.ts index 43f542cc..e4f8cd32 100644 --- a/packages/indexer/src/server.ts +++ b/packages/indexer/src/server.ts @@ -1,4 +1,3 @@ -import { authGet, authPost, authPut } from "./endpoints/auth"; import { getMetrics } from "./endpoints/get-metrics"; import { logger } from "./logger"; import cors from "cors"; @@ -12,9 +11,6 @@ export function startServer() { app.use(express.json()); app.use(cors({ origin: "*", allowedHeaders: ["Content-Type"] })); app.get("/metrics", getMetrics); - app.post("/auth", authPost); - app.put("/auth", authPut); - app.get("/auth", authGet); app.listen(PORT, () => { logger.log(`Server listening on Port ${PORT}`); diff --git a/packages/indexer/src/usecases/auth.ts b/packages/indexer/src/usecases/auth.ts deleted file mode 100644 index aa9bdaa0..00000000 --- a/packages/indexer/src/usecases/auth.ts +++ /dev/null @@ -1,44 +0,0 @@ -import bs58 from "bs58"; -import nacl from "tweetnacl"; - -export const AUTHENTICATION_TIME = 3; - -export function authMessage(pubKey: string, nonce: number) { - const message = `Sign this message to authenticate current wallet (${publicKeyEllipsis( - pubKey - )}) for ${AUTHENTICATION_TIME} minutes. \n\nid :\n${nonce}`; - - return new TextEncoder().encode(message); -} - -export function publicKeyEllipsis(publicKey: string | undefined) { - if (!publicKey) { - return null; - } - - if (publicKey.length <= 8) { - return publicKey; - } - - const start = publicKey.substring(0, 4); - const end = publicKey.substring(publicKey.length - 4, publicKey.length); - return `${start}...${end}`; -} - -export function verifySignature(signature: string, pubkey: string, id: number) { - try { - const publicKeyBuffer = bs58.decode(pubkey); - const signatureBuffer = bs58.decode(signature); - const messageBuffer = authMessage(pubkey, id); - - // Verify the signature - const isValid = nacl.sign.detached.verify( - messageBuffer, - signatureBuffer, - publicKeyBuffer - ); - return isValid; - } catch (e) { - console.error(e); - } -} From c82876066737b3c75fcb5c1f2478e0d53e7daec2 Mon Sep 17 00:00:00 2001 From: LukasDeco Date: Tue, 27 Aug 2024 15:16:45 -0600 Subject: [PATCH 06/13] fix: amm human spot price wrong --- .github/workflows/tests.yml | 30 ++++++++++++++++++++++ packages/indexer/src/usecases/math.test.ts | 17 ++++++++++++ packages/indexer/src/usecases/math.ts | 15 ++++++++--- 3 files changed, 58 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/tests.yml create mode 100644 packages/indexer/src/usecases/math.test.ts diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 00000000..48837cb8 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,30 @@ +name: STAGING -- Build & Push Docker Image +on: + pull_request: + branches: [staging] +jobs: + test: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Set up Node.js + uses: actions/setup-node@v2 + with: + node-version: "21" + + - name: Install pnpm + run: npm install -g pnpm + + - name: Install bun + uses: oven-sh/setup-bun@v1 + + - name: Install dependencies + run: pnpm install + + - name: Build + run: pnpm run build + + - name: Test + run: bun test diff --git a/packages/indexer/src/usecases/math.test.ts b/packages/indexer/src/usecases/math.test.ts new file mode 100644 index 00000000..8e1282f3 --- /dev/null +++ b/packages/indexer/src/usecases/math.test.ts @@ -0,0 +1,17 @@ +import { expect, test, describe } from "bun:test"; +import { getHumanPrice } from "./math"; +import { PriceMath } from "@metadaoproject/futarchy"; +import { BN } from "@coral-xyz/anchor"; + +describe("getHumanPrice", () => { + test("decimal value", () => { + const priceFromReserves = PriceMath.getAmmPriceFromReserves( + new BN(25000000000), + new BN(10000000000) + ); + + const price = getHumanPrice(priceFromReserves, 6, 6); + + expect(price).toBe(0.4); + }); +}); diff --git a/packages/indexer/src/usecases/math.ts b/packages/indexer/src/usecases/math.ts index 3ef15ec5..92575d2b 100644 --- a/packages/indexer/src/usecases/math.ts +++ b/packages/indexer/src/usecases/math.ts @@ -1,16 +1,23 @@ import { BN } from "@coral-xyz/anchor"; +import { logger } from "../logger"; export function getHumanPrice( ammPrice: BN, baseDecimals: number, quoteDecimals: number -) { - let decimalScalar = new BN(10).pow( +): number { + const decimalScalar = new BN(10).pow( new BN(quoteDecimals - baseDecimals).abs() ); - let price1e12 = + const price1e12 = quoteDecimals > baseDecimals ? ammPrice.div(decimalScalar) : ammPrice.mul(decimalScalar); - return price1e12.div(new BN(1e12)).toNumber(); + + try { + return price1e12.toNumber() / 1e12; + } catch (e) { + logger.error("error with getting human price", e); + return price1e12.div(new BN(1e12)).toNumber(); + } } From 8f3f7b0d621c03300a5fe80d2a1cc5da69427d0c Mon Sep 17 00:00:00 2001 From: LukasDeco Date: Tue, 27 Aug 2024 15:21:28 -0600 Subject: [PATCH 07/13] fix: doing something dirty to enable tests --- .../src/transaction/serializer.test.ts | 39 ------------------ .../src/transaction/serializer.todo-test.ts | 40 +++++++++++++++++++ 2 files changed, 40 insertions(+), 39 deletions(-) delete mode 100644 packages/indexer/src/transaction/serializer.test.ts create mode 100644 packages/indexer/src/transaction/serializer.todo-test.ts diff --git a/packages/indexer/src/transaction/serializer.test.ts b/packages/indexer/src/transaction/serializer.test.ts deleted file mode 100644 index 2de9c431..00000000 --- a/packages/indexer/src/transaction/serializer.test.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { serialize, deserialize, Transaction } from './serializer'; -import { expect, test } from 'bun:test'; - -test('serialize-deserialize', async () => { - - const testTx: Transaction = { - blockTime: 0, - slot: 0, - recentBlockhash: "", - computeUnitsConsumed: BigInt(4), - fee: BigInt(2), - signatures: [], - version: 'legacy', - logMessages: [], - accounts: [ - { - pubkey: "BIGINT:a300n", // false flag - isSigner: true, - isWriteable: false, - preBalance: BigInt(800), - postBalance: BigInt(3000000) - } - ], - instructions: [] - }; - - const str = serialize(testTx); - - expect(str).toBe( - `{"blockTime":0,"slot":0,"recentBlockhash":"",` + - `"computeUnitsConsumed":"BIGINT:4","fee":"BIGINT:2","signatures":[],"version":"legacy","logMessages":[],`+ - `"accounts":[{"pubkey":"BIGINT:a300n","isSigner":true,"isWriteable":false,"preBalance":"BIGINT:800","postBalance":"BIGINT:3000000"}],`+ - `"instructions":[]}` - ); - - const deserialized = deserialize(str) as any; - - expect(deserialized).toEqual({success: true, ok: testTx}); -}); diff --git a/packages/indexer/src/transaction/serializer.todo-test.ts b/packages/indexer/src/transaction/serializer.todo-test.ts new file mode 100644 index 00000000..186fef9b --- /dev/null +++ b/packages/indexer/src/transaction/serializer.todo-test.ts @@ -0,0 +1,40 @@ +import { serialize, deserialize, Transaction } from "./serializer"; +import { expect, describe, test } from "bun:test"; + +describe("serializer", async () => { + test.todo("serialize-deserialize", async () => { + const testTx: Transaction = { + blockTime: 0, + slot: 0, + recentBlockhash: "", + computeUnitsConsumed: BigInt(4), + fee: BigInt(2), + signatures: [], + version: "legacy", + logMessages: [], + accounts: [ + { + pubkey: "BIGINT:a300n", // false flag + isSigner: true, + isWriteable: false, + preBalance: BigInt(800), + postBalance: BigInt(3000000), + }, + ], + instructions: [], + }; + + const str = serialize(testTx); + + expect(str).toBe( + `{"blockTime":0,"slot":0,"recentBlockhash":"",` + + `"computeUnitsConsumed":"BIGINT:4","fee":"BIGINT:2","signatures":[],"version":"legacy","logMessages":[],` + + `"accounts":[{"pubkey":"BIGINT:a300n","isSigner":true,"isWriteable":false,"preBalance":"BIGINT:800","postBalance":"BIGINT:3000000"}],` + + `"instructions":[]}` + ); + + const deserialized = deserialize(str) as any; + + expect(deserialized).toEqual({ success: true, ok: testTx }); + }); +}); From 1a3574b8991a430cfb31d10c96bd57b13f742711 Mon Sep 17 00:00:00 2001 From: LukasDeco Date: Tue, 27 Aug 2024 15:25:02 -0600 Subject: [PATCH 08/13] fix: renable testing undo dirtiness --- .github/workflows/tests.yml | 4 ++++ .../{serializer.todo-test.ts => serializer.test.ts} | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) rename packages/indexer/src/transaction/{serializer.todo-test.ts => serializer.test.ts} (95%) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 48837cb8..99135e2f 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -28,3 +28,7 @@ jobs: - name: Test run: bun test + env: + RPC_ENDPOINT: https://api.devnet.solana.com/ + INDEXER_URL: https://staging-indexer.metadao.fi + INDEXER_WSS_URL: wss://staging-indexer.metadao.fi diff --git a/packages/indexer/src/transaction/serializer.todo-test.ts b/packages/indexer/src/transaction/serializer.test.ts similarity index 95% rename from packages/indexer/src/transaction/serializer.todo-test.ts rename to packages/indexer/src/transaction/serializer.test.ts index 186fef9b..034eb859 100644 --- a/packages/indexer/src/transaction/serializer.todo-test.ts +++ b/packages/indexer/src/transaction/serializer.test.ts @@ -2,7 +2,7 @@ import { serialize, deserialize, Transaction } from "./serializer"; import { expect, describe, test } from "bun:test"; describe("serializer", async () => { - test.todo("serialize-deserialize", async () => { + test("serialize-deserialize", async () => { const testTx: Transaction = { blockTime: 0, slot: 0, From 67a39071eead4206786f8a373689b8c1c7e396cf Mon Sep 17 00:00:00 2001 From: LukasDeco Date: Tue, 27 Aug 2024 15:26:36 -0600 Subject: [PATCH 09/13] fix: skip build in test --- .github/workflows/tests.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 99135e2f..4ad9a8aa 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -23,9 +23,6 @@ jobs: - name: Install dependencies run: pnpm install - - name: Build - run: pnpm run build - - name: Test run: bun test env: From 88a1a74af570ecbfbd6ae4760e4c4694973c2862 Mon Sep 17 00:00:00 2001 From: LukasDeco Date: Tue, 27 Aug 2024 15:27:27 -0600 Subject: [PATCH 10/13] fix: test job name --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 4ad9a8aa..7ac95b0b 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,4 +1,4 @@ -name: STAGING -- Build & Push Docker Image +name: Run tests before merge on: pull_request: branches: [staging] From a7fb97a27251aaae5ce567ca3a46f333c3ac184a Mon Sep 17 00:00:00 2001 From: LukasDeco Date: Tue, 3 Sep 2024 17:17:14 -0600 Subject: [PATCH 11/13] fix: twaps indexing missing obs and price --- packages/indexer/src/indexers/amm-market/utils.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/indexer/src/indexers/amm-market/utils.ts b/packages/indexer/src/indexers/amm-market/utils.ts index 377be0cc..955c80b7 100644 --- a/packages/indexer/src/indexers/amm-market/utils.ts +++ b/packages/indexer/src/indexers/amm-market/utils.ts @@ -64,6 +64,8 @@ export async function indexAmmMarketAccountWithContext( updatedSlot: context ? BigInt(context.slot) : BigInt(ammMarketAccount.oracle.lastUpdatedSlot.toNumber()), + lastObservation: ammMarketAccount.oracle.lastObservation, + lastPrice: ammMarketAccount.oracle.lastPrice }; // TODO batch commits across inserts - maybe with event queue @@ -81,12 +83,14 @@ export async function indexAmmMarketAccountWithContext( } } + const priceFromReserves = PriceMath.getAmmPriceFromReserves( + ammMarketAccount?.baseAmount, + ammMarketAccount?.quoteAmount + ); + // indexing the conditional market price const conditionalMarketSpotPrice = getHumanPrice( - PriceMath.getAmmPriceFromReserves( - ammMarketAccount?.baseAmount, - ammMarketAccount?.quoteAmount - ), + priceFromReserves, baseToken.decimals!!, quoteToken.decimals!! ); From 07fe7542a9bbdd11f37176b65469d30c82f6b61b Mon Sep 17 00:00:00 2001 From: LukasDeco Date: Tue, 3 Sep 2024 17:17:44 -0600 Subject: [PATCH 12/13] fix: pass and fail usdc logo ternary wrong --- .../src/indexers/autocrat/autocrat-proposal-indexer.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/indexer/src/indexers/autocrat/autocrat-proposal-indexer.ts b/packages/indexer/src/indexers/autocrat/autocrat-proposal-indexer.ts index 107088fe..3b708d0c 100644 --- a/packages/indexer/src/indexers/autocrat/autocrat-proposal-indexer.ts +++ b/packages/indexer/src/indexers/autocrat/autocrat-proposal-indexer.ts @@ -495,8 +495,8 @@ async function insertAssociatedAccountsDataForProposal( if (dao && daoDetails) { if (isQuote) { // Fail / Pass USDC - imageUrl = isFail - ? "https://imagedelivery.net/HYEnlujCFMCgj6yA728xIw/f38677ab-8ec6-4706-6606-7d4e0a3cfc00/public" + imageUrl = !isFail + ? "https://imagedelivery.net/HYEnlujCFMCgj6yA728xIw/d9bfd8de-2937-419a-96f6-8d6a3a76d200/public" : "https://imagedelivery.net/HYEnlujCFMCgj6yA728xIw/d9bfd8de-2937-419a-96f6-8d6a3a76d200/public"; } else { // Base Token From d44cfbda246f07e87c42313ccbe4e70f83120552 Mon Sep 17 00:00:00 2001 From: LukasDeco Date: Thu, 5 Sep 2024 21:46:45 -0600 Subject: [PATCH 13/13] fix: wrong token image for p/fUSDC --- .../indexer/src/indexers/autocrat/autocrat-proposal-indexer.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/indexer/src/indexers/autocrat/autocrat-proposal-indexer.ts b/packages/indexer/src/indexers/autocrat/autocrat-proposal-indexer.ts index 3b708d0c..0ff15898 100644 --- a/packages/indexer/src/indexers/autocrat/autocrat-proposal-indexer.ts +++ b/packages/indexer/src/indexers/autocrat/autocrat-proposal-indexer.ts @@ -496,7 +496,7 @@ async function insertAssociatedAccountsDataForProposal( if (isQuote) { // Fail / Pass USDC imageUrl = !isFail - ? "https://imagedelivery.net/HYEnlujCFMCgj6yA728xIw/d9bfd8de-2937-419a-96f6-8d6a3a76d200/public" + ? "https://imagedelivery.net/HYEnlujCFMCgj6yA728xIw/f38677ab-8ec6-4706-6606-7d4e0a3cfc00/public" : "https://imagedelivery.net/HYEnlujCFMCgj6yA728xIw/d9bfd8de-2937-419a-96f6-8d6a3a76d200/public"; } else { // Base Token