Skip to content

Commit 715a908

Browse files
committed
feat: add getStoredRates for pools
1 parent 7383355 commit 715a908

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
"lint": "eslint src --ext .ts",
2222
"lint:fix": "eslint src --fix",
2323
"watch": "tsc --watch",
24-
"watch:lib": "rm -rf lib && tsc --watch --project tsconfig.build.json"
24+
"watch:lib": "rm -rf lib && tsc --watch --project tsconfig.build.json",
25+
"test-build": "npm run build && rm -rf /Users/denisfedorov/WebstormProjects/web3/app/src/lib && cp -R lib /Users/denisfedorov/WebstormProjects/web3/app/src/lib"
2526
},
2627
"type": "module",
2728
"devDependencies": {

src/pools/PoolTemplate.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2010,6 +2010,15 @@ export class PoolTemplate extends CorePool {
20102010
return this.wrappedCoins.map(() => BN(1))
20112011
}
20122012

2013+
public async getStoredRates(useUnderlying = false): Promise<string[]> {
2014+
try {
2015+
const storedRatesBN = await this._storedRatesBN(useUnderlying);
2016+
return storedRatesBN.map(rate => rate.toString());
2017+
} catch (error) {
2018+
throw new Error(`Failed to get stored rates for pool ${this.name}: ${error instanceof Error ? error.message : 'Unknown error'}`);
2019+
}
2020+
}
2021+
20132022
_underlyingPrices = async (): Promise<number[]> => {
20142023
const promises = [];
20152024
for (const addr of this.underlyingCoinAddresses) {

0 commit comments

Comments
 (0)