From 84247dbb6fd94b5c4661398eb0a84baa7aaf663f Mon Sep 17 00:00:00 2001 From: gmbronco <83549293+gmbronco@users.noreply.github.com> Date: Mon, 3 Feb 2025 09:59:07 +0100 Subject: [PATCH 1/2] sUSDs - base (#1553) --- .changeset/popular-actors-notice.md | 5 +++ config/base.ts | 4 ++ .../apr-data-sources/yb-apr-handlers/index.ts | 1 + .../yb-apr-handlers/sources/index.ts | 1 + .../sources/susds-apr-handler.ts | 44 +++++++++++++++++++ 5 files changed, 55 insertions(+) create mode 100644 .changeset/popular-actors-notice.md create mode 100644 modules/pool/lib/apr-data-sources/yb-apr-handlers/sources/susds-apr-handler.ts diff --git a/.changeset/popular-actors-notice.md b/.changeset/popular-actors-notice.md new file mode 100644 index 000000000..c7df7c37b --- /dev/null +++ b/.changeset/popular-actors-notice.md @@ -0,0 +1,5 @@ +--- +'backend': patch +--- + +sUSDs - base diff --git a/config/base.ts b/config/base.ts index 6ca854395..c804c9612 100644 --- a/config/base.ts +++ b/config/base.ts @@ -67,6 +67,10 @@ export default { }, }, ybAprConfig: { + susds: { + oracle: '0x65d946e533748a998b1f0e430803e39a6388f7a1', + token: '0x5875eee11cf8398102fdad704c9e96607675467a', + }, morpho: { tokens: {}, }, diff --git a/modules/pool/lib/apr-data-sources/yb-apr-handlers/index.ts b/modules/pool/lib/apr-data-sources/yb-apr-handlers/index.ts index 10d054294..2ed87d305 100644 --- a/modules/pool/lib/apr-data-sources/yb-apr-handlers/index.ts +++ b/modules/pool/lib/apr-data-sources/yb-apr-handlers/index.ts @@ -31,6 +31,7 @@ const sourceToHandler = { sftmx: sources.SftmxAprHandler, sts: sources.StsAprHandler, silo: sources.SiloAprHandler, + susds: sources.SUSDSAprHandler, }; export class YbAprHandlers { diff --git a/modules/pool/lib/apr-data-sources/yb-apr-handlers/sources/index.ts b/modules/pool/lib/apr-data-sources/yb-apr-handlers/sources/index.ts index 6cf86e915..3c23024e8 100644 --- a/modules/pool/lib/apr-data-sources/yb-apr-handlers/sources/index.ts +++ b/modules/pool/lib/apr-data-sources/yb-apr-handlers/sources/index.ts @@ -20,6 +20,7 @@ export * from './teth'; export * from './morpho-apr-handler'; export * from './morpho-token-apr-handler'; export * from './usdl-apr-handler'; +export * from './susds-apr-handler'; // These need a refactor, because they depend on the network context export * from './sftmx-apr-handler'; export * from './sts-apr-handler'; diff --git a/modules/pool/lib/apr-data-sources/yb-apr-handlers/sources/susds-apr-handler.ts b/modules/pool/lib/apr-data-sources/yb-apr-handlers/sources/susds-apr-handler.ts new file mode 100644 index 000000000..83dcf2934 --- /dev/null +++ b/modules/pool/lib/apr-data-sources/yb-apr-handlers/sources/susds-apr-handler.ts @@ -0,0 +1,44 @@ +import { AprHandler } from '../types'; +import config from '../../../../../../config'; +import { createPublicClient, http, parseAbiItem } from 'viem'; +import { base } from 'viem/chains'; + +const client = createPublicClient({ + chain: base, + transport: http(config.BASE.rpcUrl), +}); + +const ssrOracle = '0x65d946e533748a998b1f0e430803e39a6388f7a1'; + +export class SUSDSAprHandler implements AprHandler { + group = 'MAKER'; + private oracle: string; + private token: string; + + constructor({ oracle, token }: { oracle: string; token: string }) { + this.oracle = oracle; + this.token = token; + } + + async getAprs() { + const aprs: { [p: string]: { apr: number; isIbYield: boolean; group: string } } = {}; + try { + const apr = await client.readContract({ + abi: [parseAbiItem('function getAPR() view returns (uint256)')], + address: this.oracle as `0x${string}`, + functionName: 'getAPR', + }); + + const tokenApr = Number(apr) * 10 ** -27; + + aprs[this.token] = { + apr: tokenApr, + isIbYield: false, + group: this.group, + }; + } catch (error) { + console.error(`sUSDS APR Failed for token ${this.token}: `, error); + } + return aprs; + } +} From fe9adc6bfc922c48f2df7dd935828582a7de4179 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 3 Feb 2025 10:18:02 +0100 Subject: [PATCH 2/2] Version Packages (#1554) --- .changeset/popular-actors-notice.md | 5 ----- CHANGELOG.md | 6 ++++++ package.json | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) delete mode 100644 .changeset/popular-actors-notice.md diff --git a/.changeset/popular-actors-notice.md b/.changeset/popular-actors-notice.md deleted file mode 100644 index c7df7c37b..000000000 --- a/.changeset/popular-actors-notice.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'backend': patch ---- - -sUSDs - base diff --git a/CHANGELOG.md b/CHANGELOG.md index d0e0e2561..401f278fa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # backend +## 1.31.2 + +### Patch Changes + +- 84247db: sUSDs - base + ## 1.31.1 ### Patch Changes diff --git a/package.json b/package.json index 92876c5a2..f33cabd88 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "backend", - "version": "1.31.1", + "version": "1.31.2", "description": "Backend service for Beethoven X and Balancer", "repository": "https://github.com/balancer/backend", "author": "Beethoven X",