Skip to content

Commit 3047f76

Browse files
authored
Merge pull request #2421 from balancer/v3-canary
publish to prod
2 parents 64c4223 + 5135122 commit 3047f76

File tree

24 files changed

+297
-1573
lines changed

24 files changed

+297
-1573
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# backend
22

3+
## 1.56.1
4+
5+
### Patch Changes
6+
7+
- 2a2ea8a: SOR - Fix unwrapRates scaling
8+
- 4c84676: move pricing query to graphql
9+
- f9a6468: pricing query cleanup
10+
- 36aa8c9: add xlayer support
11+
312
## 1.56.0
413

514
### Minor Changes

apps/api/gql/generated-schema-ast.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ export const schema = gql`
115115
POLYGON
116116
SEPOLIA
117117
SONIC
118+
XLAYER
118119
ZKEVM
119120
}
120121

apps/api/gql/generated-schema.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ export type GqlChain =
109109
| 'POLYGON'
110110
| 'SEPOLIA'
111111
| 'SONIC'
112+
| 'XLAYER'
112113
| 'ZKEVM';
113114

114115
export interface GqlFeaturePoolGroupItemExternalLink {

apps/api/gql/schema/__mocks__/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ export enum GqlChain {
100100
POLYGON = 'POLYGON',
101101
SEPOLIA = 'SEPOLIA',
102102
SONIC = 'SONIC',
103+
XLAYER = 'XLAYER',
103104
ZKEVM = 'ZKEVM',
104105
}
105106

apps/api/gql/schema/base.gql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,5 @@ enum GqlChain {
1717
FRAXTAL
1818
MODE
1919
SONIC
20+
XLAYER
2021
}

apps/api/rest-routes.ts

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,6 @@ import {
44
beetsGetCirculatingSupplySonic,
55
beetsGetTotalSupplySonic,
66
} from '../../modules/beets/lib/beets';
7-
import { latestTokenPrice } from '../../modules/token/latest-token-price';
8-
import config from '../../config';
9-
import { Chain } from '@prisma/client';
10-
import * as crypto from 'crypto';
11-
12-
const isHexAddress = (addr: any) =>
13-
typeof addr === 'string' && addr.length === 42 && addr.startsWith('0x') && /^[0-9a-f]{40}$/i.test(addr.slice(2));
147

158
export function loadRestRoutes(app: Express) {
169
app.use('/health', (_, res) => res.sendStatus(200));
@@ -29,48 +22,4 @@ export function loadRestRoutes(app: Express) {
2922
res.send(result);
3023
});
3124
});
32-
33-
app.get('/price', async (req, res) => {
34-
res.type('application/json');
35-
36-
const chain = req.query.chain;
37-
const tokens = req.query.tokens && (req.query.tokens as string).split(',');
38-
39-
// Validate params
40-
if (typeof chain !== 'string' || !(chain in config)) {
41-
res.status(400).end();
42-
return;
43-
}
44-
45-
if (!Array.isArray(tokens) || tokens.length === 0 || !tokens.every(isHexAddress) || tokens.length > 8) {
46-
res.status(400).end();
47-
return;
48-
}
49-
50-
const prices = await latestTokenPrice(chain as Chain, tokens as string[]);
51-
52-
// Build response body
53-
const responseBody = { prices };
54-
const bodyString = JSON.stringify(responseBody);
55-
56-
// Generate strong ETag: MD5 hash of the body (fast for small JSON)
57-
const etag = crypto.createHash('md5').update(bodyString).digest('hex');
58-
59-
// Set ETag header
60-
res.set('ETag', `"${etag}"`);
61-
62-
// Check for conditional request
63-
const clientEtag = req.get('If-None-Match');
64-
if (clientEtag === `"${etag}"` || clientEtag === etag) {
65-
// Handle quoted/unquoted client headers
66-
res.status(304).end(); // Not modified: No body needed
67-
return;
68-
}
69-
70-
// Set caching headers (unchanged)
71-
res.set('Cache-Control', 'public, max-age=600, s-maxage=600, stale-while-revalidate=30, stale-if-error=86400');
72-
73-
// Send full response
74-
res.send(responseBody);
75-
});
7625
}

bun.lockb

1.14 KB
Binary file not shown.

config/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import modeConfig from './mode';
1414
import sonicConfig from './sonic';
1515
import hyperevmConfig from './hyperevm';
1616
import plasmaNetworkConfig from './plasma';
17+
import xlayerNetworkConfig from './xlayer';
1718

1819
export const DAYS_OF_HOURLY_PRICES = 100;
1920
export const BALANCES_SYNC_BLOCKS_MARGIN = 200;
@@ -34,4 +35,5 @@ export default {
3435
[Chain.SONIC]: sonicConfig,
3536
[Chain.HYPEREVM]: hyperevmConfig,
3637
[Chain.PLASMA]: plasmaNetworkConfig,
38+
[Chain.XLAYER]: xlayerNetworkConfig,
3739
};

config/plasma.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export default <NetworkData>{
5050
v3: {
5151
vaultAddress: '0xba1333333333a1ba1108e8412f11850a5c319ba9',
5252
protocolFeeController: '0xcacc7e1efeea8bb3af6d5720d12c1876aa6ee76b',
53-
routerAddress: '0xa8920455934da4d853faac1f94fe7bef72943ef1',
53+
routerAddress: '0x9da18982a33fd0c7051b19f0d7c76f2d5e7e017c',
5454
defaultSwapFeePercentage: '0.5',
5555
defaultYieldFeePercentage: '0.1',
5656
},

config/sonic.ts

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -170,25 +170,6 @@ export default <NetworkData>{
170170
{ type: 'path', token: '0x871a101dcf22fe4fe37be7b654098c801cba1c88', path: '$.beefy-besonic' },
171171
],
172172
},
173-
{
174-
url: 'https://api.goldsky.com/api/public/project_cmcccb4vz1nhh01x888di8lgk/subgraphs/mainstreet/0.0.1/gn',
175-
body: JSON.stringify({
176-
query: `{
177-
smsUsdStats(id: "statsSmsUsd") {
178-
apy
179-
}
180-
}`,
181-
}),
182-
headers: { 'Content-Type': 'application/json' },
183-
scale: 100,
184-
extractors: [
185-
{
186-
type: 'path',
187-
token: '0xc7990369da608c2f4903715e3bd22f2970536c29',
188-
path: '$.data.smsUsdStats.apy',
189-
},
190-
],
191-
},
192173
{
193174
url: 'https://yields.llama.fi/chart/104b3467-bba3-4923-851d-aa9e6ff47611',
194175
scale: 100,
@@ -201,7 +182,7 @@ export default <NetworkData>{
201182
],
202183
},
203184
{
204-
url: 'https://api.originprotocol.com/api/v2/os/apr/trailing/7?146',
185+
url: 'https://api.originprotocol.com/api/v2/os/apr/trailing/7',
205186
scale: 100,
206187
extractors: [{ type: 'path', token: '0x9f0df7799f6fdad409300080cff680f5a23df4b1', path: '$.apr' }],
207188
},

0 commit comments

Comments
 (0)