Skip to content

Commit

Permalink
Merge pull request #109 from yearn/hot-fix-total-assets
Browse files Browse the repository at this point in the history
Get totalAssets from rpc instead of ydaemon (temporary)
  • Loading branch information
murderteeth authored Nov 4, 2022
2 parents ce6658a + cb903d4 commit b539ec5
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/context/useApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const yDaemonVaultToSeafoodVault = (vault, chain) => ({
},
version: vault.version,
want: vault.token.address,
totalAssets: BigNumber.from(vault.tvl.total_assets),
totalAssets: null,
governance: vault.details.governance,
totalDebt: undefined,
decimals: vault.decimals,
Expand Down Expand Up @@ -107,7 +107,8 @@ export const AppProvider = ({children}) => {
abi: vault043Abi,
calls: [
{reference: 'totalDebt', methodName: 'totalDebt', methodParameters: []},
{reference: 'debtRatio', methodName: 'debtRatio', methodParameters: []}
{reference: 'debtRatio', methodName: 'debtRatio', methodParameters: []},
{reference: 'totalAssets', methodName: 'totalAssets', methodParameters: []}
]
}));

Expand All @@ -121,7 +122,8 @@ export const AppProvider = ({children}) => {
type: 'vault',
address: vault.address,
totalDebt: BigNumber.from(results[0].returnValues[0]),
debtRatio: results[1].returnValues[0] ? BigNumber.from(results[1].returnValues[0]) : undefined
debtRatio: results[1].returnValues[0] ? BigNumber.from(results[1].returnValues[0]) : undefined,
totalAssets: results[2].returnValues[0] ? BigNumber.from(results[2].returnValues[0]) : undefined
});
});
return parsed;
Expand Down Expand Up @@ -186,6 +188,7 @@ export const AppProvider = ({children}) => {
if(vault) {
vault.totalDebt = update.totalDebt;
vault.debtRatio = update.debtRatio;
vault.totalAssets = update.totalAssets;
}
} else if(update.type === 'strategy') {
const strategy = strategies.find(s =>
Expand Down

1 comment on commit b539ec5

@vercel
Copy link

@vercel vercel bot commented on b539ec5 Nov 4, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

seafood – ./

seafood.yearn.watch
seafood.yearn.farm
dashboard-ui-pi.vercel.app
seafood-git-main.yearn.farm

Please sign in to comment.