Skip to content

Commit

Permalink
fix: applied new name convention
Browse files Browse the repository at this point in the history
  • Loading branch information
bojan07 committed Oct 5, 2023
1 parent 9ad50ee commit 1ce1d35
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ const useProtocolContracts = async () => {
twapOracleDollar3poolFacet: Contract | null,
ubiquityPoolFacet: Contract | null,
// related contracts
governanceMarket: Contract | null,
metaPool: Contract | null,
sushiPoolGovernanceDollarLp: Contract | null,
curveMetaPoolDollarTriPoolLp: Contract | null,
} = {
// separately deployed contracts (i.e. not part of the diamond)
creditNft: null,
Expand All @@ -112,8 +112,8 @@ const useProtocolContracts = async () => {
twapOracleDollar3poolFacet: null,
ubiquityPoolFacet: null,
// related contracts
governanceMarket: null,
metaPool: null,
sushiPoolGovernanceDollarLp: null,
curveMetaPoolDollarTriPoolLp: null,
};

let diamondAddress = '';
Expand Down Expand Up @@ -162,12 +162,12 @@ const useProtocolContracts = async () => {
// other related contracts
const sushiSwapPool = await protocolContracts.managerFacet.sushiSwapPoolAddress();
const sushiSwapPoolContract = new ethers.Contract(sushiSwapPool, SushiSwapPoolArtifact.abi, <Provider>provider);
const governanceMarket = new ethers.Contract(await sushiSwapPoolContract.pair(), UniswapV2PairABI, <Provider>provider);
protocolContracts.governanceMarket = governanceMarket;
const UniswapV2PairContract = new ethers.Contract(await sushiSwapPoolContract.pair(), UniswapV2PairABI, <Provider>provider);
protocolContracts.sushiPoolGovernanceDollarLp = UniswapV2PairContract;

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

return protocolContracts;
};
Expand Down
2 changes: 1 addition & 1 deletion packages/dapp/components/redeem/lib/use-prices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const usePrices = (): [BigNumber | null, BigNumber | null, () => Promise<void>]

const dollarTokenAddress = await contracts.managerFacet!.dollarTokenAddress();
const newTwapPrice = await contracts.twapOracleDollar3poolFacet!.consult(dollarTokenAddress);
const newSpotPrice = await contracts.metaPool!["get_dy(int128,int128,uint256)"](0, 1, utils.parseEther("1"));
const newSpotPrice = await contracts.curveMetaPoolDollarTriPoolLp!["get_dy(int128,int128,uint256)"](0, 1, utils.parseEther("1"));
setTwapPrice(newTwapPrice);
setSpotPrice(newSpotPrice);

Expand Down
12 changes: 6 additions & 6 deletions packages/dapp/components/staking/bonding-shares-explorer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export const BondingSharesExplorerContainer = ({ protocolContracts, web3Provider
useAsyncInit(fetchSharesInformation);
async function fetchSharesInformation(processedShareId?: ShareData["id"]) {
// cspell: disable-next-line
const { stakingFacet: bonding, chefFacet, stakingShare: bondingToken, metaPool } = await protocolContracts;
const { stakingFacet: bonding, chefFacet, stakingShare: bondingToken, curveMetaPoolDollarTriPoolLp } = await protocolContracts;
console.time("BondingShareExplorerContainer contract loading");
const currentBlock = await web3Provider.getBlockNumber();
// cspell: disable-next-line
Expand All @@ -61,7 +61,7 @@ export const BondingSharesExplorerContainer = ({ protocolContracts, web3Provider
// cspell: disable-next-line
const bondingShareIds = await bondingToken!.holderTokens(walletAddress);

const walletLpBalance = await metaPool!.balanceOf(walletAddress);
const walletLpBalance = await curveMetaPoolDollarTriPoolLp!.balanceOf(walletAddress);

const shares: ShareData[] = [];
await Promise.all(
Expand Down Expand Up @@ -168,20 +168,20 @@ export const BondingSharesExplorerContainer = ({ protocolContracts, web3Provider

onStake: useCallback(
async ({ amount, weeks }) => {
const { stakingFacet: bonding, metaPool } = await protocolContracts;
const { stakingFacet: bonding, curveMetaPoolDollarTriPoolLp } = await protocolContracts;
if (!model || model.processing.length) return;
console.log(`Staking ${amount} for ${weeks} weeks`);
doTransaction("Staking...", async () => {});

// cspell: disable-next-line
const allowance = await metaPool!.allowance(walletAddress, bonding!.address);
const allowance = await curveMetaPoolDollarTriPoolLp!.allowance(walletAddress, bonding!.address);
console.log("allowance", ethers.utils.formatEther(allowance));
console.log("lpsAmount", ethers.utils.formatEther(amount));
if (allowance.lt(amount)) {
// cspell: disable-next-line
await performTransaction(metaPool!.connect(signer).approve(bonding!.address, amount));
await performTransaction(curveMetaPoolDollarTriPoolLp!.connect(signer).approve(bonding!.address, amount));
// cspell: disable-next-line
const allowance2 = await metaPool!.allowance(walletAddress, bonding!.address);
const allowance2 = await curveMetaPoolDollarTriPoolLp!.allowance(walletAddress, bonding!.address);
console.log("allowance2", ethers.utils.formatEther(allowance2));
}
// cspell: disable-next-line
Expand Down
2 changes: 1 addition & 1 deletion packages/dapp/components/staking/deposit-share.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ 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.governanceMarket!.getReserves();
const reserves = contract.sushiPoolGovernanceDollarLp!.getReserves();
const ubqPrice = +reserves[0].toString() / +reserves[1].toString();
const ubqPerBlock = contract.chefFacet!.governancePerBlock();
const ubqMultiplier = contract.chefFacet!.governanceMultiplier();
Expand Down

0 comments on commit 1ce1d35

Please sign in to comment.