Skip to content

Commit

Permalink
fix: hardcoded some addresses and fixed prefetch-constants function
Browse files Browse the repository at this point in the history
  • Loading branch information
bojan07 committed Oct 6, 2023
1 parent 6972f9c commit 61ee7f7
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -160,13 +160,15 @@ const useProtocolContracts = async () => {
protocolContracts.ubiquityPoolFacet = new ethers.Contract(diamondAddress, UbiquityPoolFacetArtifact.abi, <Provider>provider);

// other related contracts
const sushiSwapPool = await protocolContracts.managerFacet.sushiSwapPoolAddress();
const sushiSwapPoolContract = new ethers.Contract(sushiSwapPool, SushiSwapPoolArtifact.abi, <Provider>provider);
const UniswapV2PairContract = new ethers.Contract(await sushiSwapPoolContract.pair(), UniswapV2PairABI, <Provider>provider);
// const sushiSwapPool = await protocolContracts.managerFacet.sushiSwapPoolAddress();
// const sushiSwapPoolContract = new ethers.Contract(sushiSwapPool, SushiSwapPoolArtifact.abi, <Provider>provider);
// const UniswapV2PairContract = new ethers.Contract(await sushiSwapPoolContract.pair(), UniswapV2PairABI, <Provider>provider);
const UniswapV2PairContract = new ethers.Contract("0x41e087485f47538752A1195D984109cB8Dc0E429", UniswapV2PairABI, <Provider>provider);
protocolContracts.sushiPoolGovernanceDollarLp = UniswapV2PairContract;

const dollar3poolMarket = await protocolContracts.managerFacet.stableSwapMetaPoolAddress();
const metaPoolContract = new ethers.Contract(dollar3poolMarket, IMetaPoolArtifact.abi, <Provider>provider);
// const dollar3poolMarket = await protocolContracts.managerFacet.stableSwapMetaPoolAddress();
// const metaPoolContract = new ethers.Contract(dollar3poolMarket, IMetaPoolArtifact.abi, <Provider>provider);
const metaPoolContract = new ethers.Contract("0x20955CB69Ae1515962177D164dfC9522feef567E", IMetaPoolArtifact.abi, <Provider>provider);
protocolContracts.curveMetaPoolDollarTriPoolLp = metaPoolContract;

return protocolContracts;
Expand Down
3 changes: 2 additions & 1 deletion packages/dapp/components/lib/hooks/use-balances.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ export const BalancesContextProvider: React.FC<ChildrenShim> = ({ children }) =>

const contracts = await protocolContracts;

const _3crvToken = await contracts.managerFacet!.curve3PoolTokenAddress();
// const _3crvToken = await contracts.managerFacet!.curve3PoolTokenAddress();
const _3crvToken = "0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490";
const _3crvTokenContract = getERC20Contract(_3crvToken, provider);

const [uad, _3crv, uad3crv, ucr, ubq, ucrNft, stakingShares, usdc, dai, usdt] = await Promise.all([
Expand Down
12 changes: 6 additions & 6 deletions packages/dapp/components/staking/deposit-share.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@ const MAX_WEEKS = 208;
type PrefetchedConstants = { totalShares: number; usdPerWeek: number; bondingDiscountMultiplier: BigNumber };
async function prefetchConstants(contracts: NonNullable<ProtocolContracts>): Promise<PrefetchedConstants> {
const contract = await contracts;
const reserves = contract.sushiPoolGovernanceDollarLp!.getReserves();
const reserves = await contract.sushiPoolGovernanceDollarLp!.getReserves();
const ubqPrice = +reserves[0].toString() / +reserves[1].toString();
const ubqPerBlock = contract.chefFacet!.governancePerBlock();
const ubqMultiplier = contract.chefFacet!.governanceMultiplier();
const ubqPerBlock = await contract.chefFacet!.governancePerBlock();
const ubqMultiplier = await contract.chefFacet!.governanceMultiplier();
const actualUbqPerBlock = toEtherNum(ubqPerBlock.mul(ubqMultiplier).div(`${1e18}`));
const blockCountInAWeek = toNum(contract.stakingFacet!.blockCountInAWeek());
const blockCountInAWeek = toNum(await contract.stakingFacet!.blockCountInAWeek());
const ubqPerWeek = actualUbqPerBlock * blockCountInAWeek;
const totalShares = toEtherNum(contract.chefFacet!.totalShares());
const totalShares = toEtherNum(await contract.chefFacet!.totalShares());
const usdPerWeek = ubqPerWeek * ubqPrice;
// cspell: disable-next-line
const bondingDiscountMultiplier = contract.stakingFacet!.stakingDiscountMultiplier();
const bondingDiscountMultiplier = await contract.stakingFacet!.stakingDiscountMultiplier();
// cspell: disable-next-line
return { totalShares, usdPerWeek, bondingDiscountMultiplier };
}
Expand Down

0 comments on commit 61ee7f7

Please sign in to comment.