Skip to content

Commit

Permalink
Publish Stage (#3831)
Browse files Browse the repository at this point in the history
* Mattupham/fe 1067 portfolio v3 update 0 change values to be green and up (#3823)

* add threshold updates

* Clean up logs

* [Limit Orders]: SQS Active Order Query (#3828)

* fix: increased cache time and refetch interval for active orders

* fix: even longer cache

* fix: WIP batch query implementation

* fix: longer delay between batches

* fix: batch size/timing

* fix: vercel max duration

* fix: wired in sqs query for active orders

* fix: build

* fix: filled orders styling

* fix: remove claimable orders test data

* fix: further reduced queries

* feat: moved orders query to passthrough

* fix: moved active orders to local router

* fix: altered orders cache to be more responsive

* chore: post typing fixes for active orders sqs query

* fix: reverted unnecessary changes

* feat: removed pool restriction on orderbooks

* Clean up formatter (#3829)

* Clean up formatter

* Remove log

* update no price data

* add pr notification yaml (#3830)

Co-authored-by: Michael Millington <>

* fix lint issue (#3832)

* Handle PricePretty and Lint issue

* add search from query param for earn (#3836)

* Update search from query param

* Do not log subsequent chart interaction events / Handle last event tracking (#3834)

* Handle last event tracking

* Clean up

* Clean up types

* Update event properties

* Add types for event options

* Fix lint

* Update MATIC -> POL (#3835)

* Update MATIC -> POL

* Update tests

* feat: feature flag for sqs active orders (#3837)

* [Limit Orders]: Fix date display for order history (#3833)

* fix: date display for order history

* fix: undid feature flag changes

* fix: typing issue

* [Limit Orders]: Price to Tick Crash Handler (#3838)

* fix: price to tick error handling

* feat: added swap source to swap amplitude events

---------

Co-authored-by: Matt Upham <[email protected]>

* Update IBC overrides to use POL (#3839)

---------

Co-authored-by: Matt Upham <[email protected]>
Co-authored-by: Connor Barr <[email protected]>
Co-authored-by: Max Millington <[email protected]>
  • Loading branch information
4 people authored Sep 10, 2024
1 parent 5eafe10 commit bd1936c
Show file tree
Hide file tree
Showing 52 changed files with 493 additions and 181 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/pr-notification.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: PR Notification
on:
pull_request:
types: [opened, reopened]
branches:
- master
jobs:
slack-notification:
runs-on: ubuntu-latest
steps:
- name: Slack Notification
uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
text: New PR opened to master branch
author_name: GitHub Action
fields: repo,message,commit,author,action,eventName,ref,workflow
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_ANNOUNCEMENT_WEBHOOK_URL }}
6 changes: 3 additions & 3 deletions packages/bridge/src/__tests__/mock-asset-lists.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1445,7 +1445,7 @@ export const MockAssetLists: AssetList[] = [
sourceDenom: "wmatic-wei",
coinMinimalDenom:
"ibc/AB589511ED0DD5FA56171A39978AFBF1371DB986EC1C3526CE138A16377E39BB",
symbol: "MATIC",
symbol: "POL",
decimals: 18,
logoURIs: {
png: "https://raw.githubusercontent.com/cosmos/chain-registry/master/_non-cosmos/polygon/images/matic-purple.png",
Expand Down Expand Up @@ -1506,15 +1506,15 @@ export const MockAssetLists: AssetList[] = [
chainType: "evm",
chainId: 137,
address: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
symbol: "MATIC",
symbol: "POL",
decimals: 18,
logoURIs: {
png: "https://raw.githubusercontent.com/cosmos/chain-registry/master/_non-cosmos/polygon/images/matic-purple.png",
svg: "https://raw.githubusercontent.com/cosmos/chain-registry/master/_non-cosmos/polygon/images/matic-purple.svg",
},
},
],
variantGroupKey: "MATIC",
variantGroupKey: "POL",
name: "Polygon",
isAlloyed: false,
verified: true,
Expand Down
2 changes: 1 addition & 1 deletion packages/bridge/src/squid/__tests__/mocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1977,7 +1977,7 @@ export const MockChains = [
chainId: 137,
nativeCurrency: {
name: "Polygon",
symbol: "MATIC",
symbol: "POL",
decimals: 18,
icon: "https://raw.githubusercontent.com/axelarnetwork/axelar-docs/main/public/images/chains/polygon.svg",
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ describe("SquidBridgeProvider", () => {
chainId: 137,
nativeCurrency: {
name: "Polygon",
symbol: "MATIC",
symbol: "POL",
decimals: 18,
icon: "https://raw.githubusercontent.com/axelarnetwork/axelar-docs/main/public/images/chains/polygon.svg",
},
Expand Down
8 changes: 4 additions & 4 deletions packages/server/src/queries/__tests__/mock-asset-lists.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1447,7 +1447,7 @@ export const AssetLists: AssetList[] = [
sourceDenom: "wmatic-wei",
coinMinimalDenom:
"ibc/AB589511ED0DD5FA56171A39978AFBF1371DB986EC1C3526CE138A16377E39BB",
symbol: "MATIC",
symbol: "POL",
decimals: 18,
logoURIs: {
png: "https://raw.githubusercontent.com/cosmos/chain-registry/master/_non-cosmos/polygon/images/matic-purple.png",
Expand Down Expand Up @@ -1508,22 +1508,22 @@ export const AssetLists: AssetList[] = [
chainType: "evm",
chainId: 137,
address: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
symbol: "MATIC",
symbol: "POL",
decimals: 18,
logoURIs: {
png: "https://raw.githubusercontent.com/cosmos/chain-registry/master/_non-cosmos/polygon/images/matic-purple.png",
svg: "https://raw.githubusercontent.com/cosmos/chain-registry/master/_non-cosmos/polygon/images/matic-purple.svg",
},
},
],
variantGroupKey: "MATIC",
variantGroupKey: "POL",
name: "Polygon",
isAlloyed: false,
verified: true,
unstable: false,
disabled: false,
preview: false,
relative_image_url: "/tokens/generated/matic.png",
relative_image_url: "/tokens/generated/pol.png",
},
{
chainName: "axelar",
Expand Down
47 changes: 44 additions & 3 deletions packages/server/src/queries/complex/orderbooks/active-orders.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import { Dec, Int } from "@keplr-wallet/unit";
import { tickToPrice } from "@osmosis-labs/math";
import { Chain } from "@osmosis-labs/types";
import { AssetList, Chain } from "@osmosis-labs/types";
import { getAssetFromAssetList } from "@osmosis-labs/utils";
import cachified, { CacheEntry } from "cachified";
import dayjs from "dayjs";
import { LRUCache } from "lru-cache";

import { DEFAULT_LRU_OPTIONS } from "../../../utils/cache";
import { LimitOrder, queryOrderbookActiveOrders } from "../../osmosis";
import { queryActiveOrdersSQS } from "../../sidecar/orderbooks";
import {
getOrderbookTickState,
getOrderbookTickUnrealizedCancels,
Expand All @@ -16,6 +17,46 @@ import type { MappedLimitOrder, OrderStatus } from "./types";

const activeOrdersCache = new LRUCache<string, CacheEntry>(DEFAULT_LRU_OPTIONS);

export function getOrderbookActiveOrdersSQS({
userOsmoAddress,
assetList,
}: {
userOsmoAddress: string;
assetList: AssetList[];
}) {
return cachified({
cache: activeOrdersCache,
key: `orderbookActiveOrders-sqs-${userOsmoAddress}`,
ttl: 5000, // 5 seconds
getFreshValue: () =>
queryActiveOrdersSQS({
userOsmoAddress,
}).then(async ({ orders }) => {
const mappedOrders: MappedLimitOrder[] = orders.map((o) => {
return {
...o,
price: new Dec(o.price),
quantity: parseInt(o.quantity),
placed_quantity: parseInt(o.placed_quantity),
percentClaimed: new Dec(o.percentClaimed),
totalFilled: parseInt(o.totalFilled),
percentFilled: new Dec(o.percentFilled),
quoteAsset: getAssetFromAssetList({
coinMinimalDenom: o.quote_asset.symbol,
assetLists: assetList,
}),
baseAsset: getAssetFromAssetList({
coinMinimalDenom: o.base_asset.symbol,
assetLists: assetList,
}),
output: new Dec(o.output),
};
});
return mappedOrders;
}),
});
}

export function getOrderbookActiveOrders({
orderbookAddress,
userOsmoAddress,
Expand All @@ -32,7 +73,7 @@ export function getOrderbookActiveOrders({
return cachified({
cache: activeOrdersCache,
key: `orderbookActiveOrders-${orderbookAddress}-${userOsmoAddress}`,
ttl: 2000, // 2 seconds
ttl: 10000, // 10 seconds
getFreshValue: () =>
queryOrderbookActiveOrders({
orderbookAddress,
Expand Down Expand Up @@ -152,7 +193,7 @@ async function getTickInfoAndTransformOrders(
output,
quoteAsset,
baseAsset,
placed_at: dayjs(parseInt(o.placed_at) / 1_000).unix(),
placed_at: dayjs(o.placed_at / 1000).unix(),
};
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,11 @@ async function mapHistoricalToMapped(
order_direction: o.order_direction,
order_id: parseInt(o.order_id),
owner: userAddress,
placed_at:
dayjs(
o.place_timestamp && o.place_timestamp.length > 0
? o.place_timestamp
: 0
).unix() * 1000,
placed_at: dayjs(
o.place_timestamp && o.place_timestamp.length > 0
? o.place_timestamp
: 0
).unix(),
placed_quantity: parseInt(o.quantity),
placedQuantityMin,
quantityMin,
Expand Down
18 changes: 8 additions & 10 deletions packages/server/src/queries/complex/orderbooks/pools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,14 @@ export function getOrderbookPools() {
ttl: 1000 * 60 * 60, // 1 hour
getFreshValue: () =>
queryCanonicalOrderbooks().then(async (data) => {
return data
.filter((o) => o.pool_id < 2065)
.map((orderbook) => {
return {
baseDenom: orderbook.base,
quoteDenom: orderbook.quote,
contractAddress: orderbook.contract_address,
poolId: orderbook.pool_id.toString(),
};
}) as Orderbook[];
return data.map((orderbook) => {
return {
baseDenom: orderbook.base,
quoteDenom: orderbook.quote,
contractAddress: orderbook.contract_address,
poolId: orderbook.pool_id.toString(),
};
}) as Orderbook[];
}),
});
}
4 changes: 2 additions & 2 deletions packages/server/src/queries/complex/orderbooks/tick-state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export function getOrderbookTickState({
key: `orderbookTickInfo-${orderbookAddress}-${tickIds
.sort((a, b) => a - b)
.join(",")}`,
ttl: 1000 * 6, // 6 seconds
ttl: 1000 * 10, // 6 seconds
getFreshValue: () =>
queryOrderbookTicks({ orderbookAddress, chainList, tickIds }).then(
({ data }) => data.ticks
Expand All @@ -46,7 +46,7 @@ export function getOrderbookTickUnrealizedCancels({
key: `orderbookTickUnrealizedCancels-${orderbookAddress}-${tickIds
.sort((a, b) => a - b)
.join(",")}`,
ttl: 1000 * 6, // 6 seconds
ttl: 1000 * 10, // 10 seconds
getFreshValue: () =>
queryOrderbookTickUnrealizedCancelsById({
orderbookAddress,
Expand Down
2 changes: 1 addition & 1 deletion packages/server/src/queries/osmosis/orderbooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export interface LimitOrder {
etas: string;
claim_bounty?: string;
placed_quantity: string;
placed_at: string;
placed_at: number;
}

interface OrderbookActiveOrdersResponse {
Expand Down
40 changes: 40 additions & 0 deletions packages/server/src/queries/sidecar/orderbooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,47 @@ export type CanonicalOrderbooksResponse = {
contract_address: string;
}[];

export interface SQSActiveOrder {
tick_id: number;
order_id: number;
order_direction: "bid" | "ask";
owner: string;
quantity: string;
etas: string;
placed_quantity: string;
placed_at: number;
price: string;
percentClaimed: string;
totalFilled: string;
percentFilled: string;
orderbookAddress: string;
status: "open" | "partiallyFilled";
output: string;
quote_asset: {
symbol: string;
};
base_asset: {
symbol: string;
};
}

export type ActiveOrdersResponse = {
orders: SQSActiveOrder[];
};

export async function queryCanonicalOrderbooks() {
const url = new URL("/pools/canonical-orderbooks", SIDECAR_BASE_URL);
return await apiClient<CanonicalOrderbooksResponse>(url.toString());
}

export async function queryActiveOrdersSQS({
userOsmoAddress,
}: {
userOsmoAddress: string;
}) {
const url = new URL(
`/passthrough/active-orders?userOsmoAddress=${userOsmoAddress}`,
SIDECAR_BASE_URL
);
return await apiClient<ActiveOrdersResponse>(url.toString());
}
8 changes: 4 additions & 4 deletions packages/stores/src/tests/mock-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2401,7 +2401,7 @@ export const MockAssetList: AssetList[] = [
sourceDenom: "wmatic-wei",
coinMinimalDenom:
"ibc/AB589511ED0DD5FA56171A39978AFBF1371DB986EC1C3526CE138A16377E39BB",
symbol: "MATIC",
symbol: "POL",
decimals: 18,
logoURIs: {
png: "https://raw.githubusercontent.com/cosmos/chain-registry/master/_non-cosmos/polygon/images/matic-purple.png",
Expand Down Expand Up @@ -2462,22 +2462,22 @@ export const MockAssetList: AssetList[] = [
chainType: "evm",
chainId: 137,
address: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
symbol: "MATIC",
symbol: "POL",
decimals: 18,
logoURIs: {
png: "https://raw.githubusercontent.com/cosmos/chain-registry/master/_non-cosmos/polygon/images/matic-purple.png",
svg: "https://raw.githubusercontent.com/cosmos/chain-registry/master/_non-cosmos/polygon/images/matic-purple.svg",
},
},
],
variantGroupKey: "MATIC",
variantGroupKey: "POL",
name: "Polygon",
isAlloyed: false,
verified: true,
unstable: false,
disabled: false,
preview: false,
relative_image_url: "/tokens/generated/matic.png",
relative_image_url: "/tokens/generated/pol.png",
},
{
chainName: "axelar",
Expand Down
8 changes: 4 additions & 4 deletions packages/trpc/src/__tests_e2e__/mock-asset-lists.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1447,7 +1447,7 @@ export const AssetLists: AssetList[] = [
sourceDenom: "wmatic-wei",
coinMinimalDenom:
"ibc/AB589511ED0DD5FA56171A39978AFBF1371DB986EC1C3526CE138A16377E39BB",
symbol: "MATIC",
symbol: "POL",
decimals: 18,
logoURIs: {
png: "https://raw.githubusercontent.com/cosmos/chain-registry/master/_non-cosmos/polygon/images/matic-purple.png",
Expand Down Expand Up @@ -1508,22 +1508,22 @@ export const AssetLists: AssetList[] = [
chainType: "evm",
chainId: 137,
address: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
symbol: "MATIC",
symbol: "POL",
decimals: 18,
logoURIs: {
png: "https://raw.githubusercontent.com/cosmos/chain-registry/master/_non-cosmos/polygon/images/matic-purple.png",
svg: "https://raw.githubusercontent.com/cosmos/chain-registry/master/_non-cosmos/polygon/images/matic-purple.svg",
},
},
],
variantGroupKey: "MATIC",
variantGroupKey: "POL",
name: "Polygon",
isAlloyed: false,
verified: true,
unstable: false,
disabled: false,
preview: false,
relative_image_url: "/tokens/generated/matic.png",
relative_image_url: "/tokens/generated/pol.png",
},
{
chainName: "axelar",
Expand Down
Loading

0 comments on commit bd1936c

Please sign in to comment.