Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: refactor credits page to diamond contract #801

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions packages/dapp/pages/credits.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,26 @@ import DollarPrice from "@/components/redeem/dollar-price";
import UcrRedeem from "@/components/redeem/ucr-redeem";
import UcrNftGenerator from "@/components/redeem/debt-coupon-deposit";
import UcrNftRedeem from "@/components/redeem/ucr-nft-redeem";
import useManagerManaged from "@/components/lib/hooks/contracts/use-manager-managed";
import useProtocolContracts from "@/components/lib/hooks/contracts/use-protocol-contracts";
import useEffectAsync from "@/components/lib/hooks/use-effect-async";
// import DisabledBlurredMessage from "@/components/ui/DisabledBlurredMessage";
import dynamic from "next/dynamic";
const WalletConnectionWall = dynamic(() => import("@/components/ui/wallet-connection-wall"), { ssr: false }); //@note Fix: (Hydration Error)

const PriceStabilization: FC = (): JSX.Element => {
const [twapInteger, setTwapInteger] = useState<number>(0);
const managedContracts = useManagerManaged();
const protocolContracts = useProtocolContracts();

useEffectAsync(async () => {
if (managedContracts) {
const twapPrice = await managedContracts.dollarTwapOracle.consult(managedContracts.dollarToken.address);
if (protocolContracts) {
const dollarTokenAddress = protocolContracts.managerFacet && (await protocolContracts.managerFacet.dollarTokenAddress());
const twapPrice = protocolContracts.twapOracleDollar3poolFacet && (await protocolContracts.twapOracleDollar3poolFacet.consult(dollarTokenAddress));
if (twapPrice) {
const twapPriceInteger = (twapPrice as unknown as number) / 1e18;
setTwapInteger(twapPriceInteger);
}
}
}, [managedContracts]);
}, [protocolContracts]);

return (
<WalletConnectionWall>
Expand Down
Loading