Skip to content

Commit

Permalink
fix(rubicon): Correct Rubicon definition name, fix Bath Token decimal…
Browse files Browse the repository at this point in the history
… issues, and add labels (Zapper-fi#933)
  • Loading branch information
bghughes authored and volt62 committed Aug 2, 2022
1 parent 6c4ba2a commit 5ead02b
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 17 deletions.
33 changes: 20 additions & 13 deletions src/apps/rubicon/optimism/rubicon.bath-token.token-fetcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,19 +54,6 @@ export class OptimismRubiconBathTokenTokenFetcher implements PositionFetcher<App
network,
});

// Request the symbol, decimals, ands supply for the Bath Token
const [symbol, decimals, supplyRaw] = await Promise.all([
multicall.wrap(contract).symbol(),
multicall.wrap(contract).decimals(),
multicall.wrap(contract).totalSupply(),
]);

// Denormalize the supply
const supply = Number(supplyRaw) / 10 ** decimals;

// *******price ************
// A user can deposit base tokens like WETH or USDC

// Request the underlying token address and ratio for the Bath Token
const [underlyingTokenAddressRaw, ratioRaw] = await Promise.all([
multicall
Expand All @@ -79,6 +66,26 @@ export class OptimismRubiconBathTokenTokenFetcher implements PositionFetcher<App
.catch(() => 'Convert to assets failed'),
]);

const underlyingERC20 = this.rubiconContractFactory.bathToken({
address: underlyingTokenAddressRaw,
network,
});

// http://localhost:5001/apps/rubicon/tokens?groupIds[]=bathToken&network=optimism

// Request the symbol, decimals, ands supply for the Bath Token
const [symbol, decimals, supplyRaw] = await Promise.all([
multicall.wrap(contract).symbol(),
multicall.wrap(underlyingERC20).decimals(),
multicall.wrap(contract).totalSupply(),
]);

// Denormalize the supply
const supply = Number(supplyRaw) / 10 ** decimals;

// *******price ************
// A user can deposit base tokens like WETH or USDC

// Find the underlying token in our dependencies.
// Note: If it is not found, then we have not indexed the underlying token, and we cannot
// index the Bath Token since its price depends on the underlying token price.
Expand Down
14 changes: 10 additions & 4 deletions src/apps/rubicon/rubicon.definition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Network } from '~types/network.interface';

export const RUBICON_DEFINITION = appDefinition({
id: 'rubicon',
name: 'rubicon',
name: 'Rubicon',
description: 'Rubicon is the order book exchange standard of Ethereum',
url: 'https://app.rubicon.finance',

Expand All @@ -26,14 +26,20 @@ export const RUBICON_DEFINITION = appDefinition({
AppTag.LIQUID_STAKING,
],

keywords: [],
links: {},
keywords: ['dex', 'orderBook', 'ethereum', 'CLOBmaxis', 'rbcn'],

links: {
github: 'https://github.com/rubiconDeFi',
twitter: 'https://twitter.com/rubicondefi',
discord: 'https://discord.com/invite/E7pS24J',
medium: 'https://medium.com/rubicon-finance',
},

supportedNetworks: {
[Network.OPTIMISM_MAINNET]: [AppAction.VIEW],
},

primaryColor: '#fff',
primaryColor: '#ba2f2a',
});

@Register.AppDefinition(RUBICON_DEFINITION.id)
Expand Down

0 comments on commit 5ead02b

Please sign in to comment.