From f091f2bf69c33138c7961489ed0d0d133e669d71 Mon Sep 17 00:00:00 2001 From: Bojan Torma <121951004+bojan07@users.noreply.github.com> Date: Tue, 24 Oct 2023 05:30:51 -0400 Subject: [PATCH] feat(ui): apply diamond architecture to the remained or missed components (#824) * fix(review): updated contract names --- packages/dapp/components/layout/inventory.tsx | 91 +++-- packages/dapp/components/layout/sidebar.tsx | 2 +- .../components/lib/contracts-shortcuts.ts | 44 +-- .../contracts/use-deployed-contracts.tsx | 23 -- .../hooks/contracts/use-manager-managed.tsx | 102 ----- .../hooks/contracts/use-protocol-contracts.ts | 9 +- .../components/lib/hooks/use-balances.tsx | 19 +- .../dapp/components/lib/hooks/use-router.ts | 16 +- .../dapp/components/lib/hooks/use-trade.ts | 4 +- packages/dapp/components/lib/types.ts | 10 +- packages/dapp/components/lib/utils.ts | 12 +- .../components/monitor/metapool-monitor.tsx | 37 +- .../dapp/components/monitor/price-monitor.tsx | 111 +++--- .../dapp/components/monitor/token-monitor.tsx | 55 ++- ...pon-deposit.tsx => credit-nft-deposit.tsx} | 26 +- ...r-nft-redeem.tsx => credit-nft-redeem.tsx} | 59 +-- .../{debt-coupon.tsx => credit-nft.tsx} | 360 +++++++++--------- .../{ucr-redeem.tsx => credit-redeem.tsx} | 36 +- .../dapp/components/staking/deposit-share.tsx | 28 +- .../staking/staking-shares-explorer.tsx | 26 +- packages/dapp/components/ui/icons.tsx | 10 +- packages/dapp/components/ui/jsx-icons.tsx | 4 +- packages/dapp/components/ui/svgs.tsx | 8 +- packages/dapp/components/utils/contracts.ts | 26 +- packages/dapp/components/utils/local-data.ts | 10 +- packages/dapp/pages/credit-nft.tsx | 10 + packages/dapp/pages/credits.tsx | 16 +- packages/dapp/pages/debt-coupon.tsx | 10 - packages/dapp/pages/markets.tsx | 4 +- packages/dapp/pages/styles/queries.css | 3 + packages/dapp/pages/styles/ubiquity.css | 18 +- 31 files changed, 552 insertions(+), 637 deletions(-) delete mode 100644 packages/dapp/components/lib/hooks/contracts/use-deployed-contracts.tsx delete mode 100644 packages/dapp/components/lib/hooks/contracts/use-manager-managed.tsx rename packages/dapp/components/redeem/{debt-coupon-deposit.tsx => credit-nft-deposit.tsx} (73%) rename packages/dapp/components/redeem/{ucr-nft-redeem.tsx => credit-nft-redeem.tsx} (60%) rename packages/dapp/components/redeem/{debt-coupon.tsx => credit-nft.tsx} (59%) rename packages/dapp/components/redeem/{ucr-redeem.tsx => credit-redeem.tsx} (79%) create mode 100644 packages/dapp/pages/credit-nft.tsx delete mode 100644 packages/dapp/pages/debt-coupon.tsx diff --git a/packages/dapp/components/layout/inventory.tsx b/packages/dapp/components/layout/inventory.tsx index 964e0d2bf..05244228a 100644 --- a/packages/dapp/components/layout/inventory.tsx +++ b/packages/dapp/components/layout/inventory.tsx @@ -1,29 +1,35 @@ import Tippy from "@tippyjs/react"; import { BaseContract, BigNumber, ethers } from "ethers"; -import { useEffect } from "react"; +import { useState } from "react"; +import useEffectAsync from "../lib/hooks/use-effect-async"; import useWeb3 from "@/lib/hooks/use-web-3"; import icons from "@/ui/icons"; -import useManagerManaged from "../lib/hooks/contracts/use-manager-managed"; +import useProtocolContracts from "@/components/lib/hooks/contracts/use-protocol-contracts"; import useNamedContracts from "../lib/hooks/contracts/use-named-contracts"; import useBalances from "../lib/hooks/use-balances"; -import { ManagedContracts } from "../lib/hooks/contracts/use-manager-managed"; import { Balances } from "../lib/types"; +type ProtocolContracts = NonNullable>>; + const Inventory = () => { const { walletAddress } = useWeb3(); const [balances, refreshBalances] = useBalances(); - const managedContracts = useManagerManaged(); + const protocolContracts = useProtocolContracts(); const namedContracts = useNamedContracts(); + const [contracts, setContracts] = useState(); + + useEffectAsync(async () => { + const contract = await protocolContracts; + setContracts(contract); - useEffect(() => { if (walletAddress) { refreshBalances(); } }, [walletAddress]); - if (!walletAddress || !balances || !managedContracts || !namedContracts) { + if (!walletAddress || !balances || !namedContracts) { return null; } @@ -36,14 +42,14 @@ const Inventory = () => {
{/* cspell: disable-next-line */} - {showIfBalanceExists("uad", "uAD", "dollarToken")} + {showIfBalanceExists("dollar", "DOLLAR", "dollarToken")} {/* cspell: disable-next-line */} - {showIfBalanceExists("ucr", "uCR", "creditToken")} - {showIfBalanceExists("ucrNft", "uCR-NFT", "creditNft")} + {showIfBalanceExists("credit", "CREDIT", "creditToken")} + {showIfBalanceExists("creditNft", "CREDIT-NFT", "creditNft")} {/* cspell: disable-next-line */} - {showIfBalanceExists("ubq", "UBQ", "governanceToken")} + {showIfBalanceExists("governance", "GOVERNANCE", "governanceToken")} {showIfBalanceExists("_3crv", "3crv", "_3crvToken")} - {showIfBalanceExists("uad3crv", "uAD3CRV-f", "dollarMetapool")} + {showIfBalanceExists("dollar3crv", "dollar3CRV-f", "curveMetaPoolDollarTriPoolLp")} {showIfBalanceExists("usdc", "USDC", "usdc")} {showIfBalanceExists("dai", "DAI", "dai")} {showIfBalanceExists("usdt", "USDT", "usdt")} @@ -64,8 +70,8 @@ const Inventory = () => { } const balance = balances[key]; - if (Number(balance) && managedContracts) { - let selectedContract = managedContracts[id as keyof ManagedContracts] as BaseContract; + if (Number(balance) && contracts) { + let selectedContract = contracts[id as keyof ProtocolContracts] as BaseContract; if (!selectedContract && namedContracts) { selectedContract = namedContracts[key as keyof typeof namedContracts]; } @@ -86,33 +92,34 @@ interface TokenInterface { const Token = ({ balance, token, tokenAddr, accountAddr, decimals = 18 }: TokenInterface) => { const Svg = tokenSvg[token] || (() => <>); - const ethereum = window.ethereum; - const addTokenToWallet = async () => { - if (!ethereum?.request) { - return; - } - try { - const base64Img = icons.base64s[token.toLowerCase()]; - const wasAdded = await ethereum.request({ - method: "wallet_watchAsset", - params: { - type: "ERC20", - options: { - address: tokenAddr, - symbol: token, - decimals: decimals, - image: base64Img, + if (typeof window !== "undefined") { + const ethereum = window.ethereum; + if (!ethereum?.request) { + return; + } + try { + const base64Img = icons.base64s[token.toLowerCase()]; + const wasAdded = await ethereum.request({ + method: "wallet_watchAsset", + params: { + type: "ERC20", + options: { + address: tokenAddr, + symbol: token, + decimals: decimals, + image: base64Img, + }, }, - }, - }); - if (wasAdded) { - console.log("Thanks for your interest!"); - } else { - console.log("Your loss!"); + }); + if (wasAdded) { + console.log("Thanks for your interest!"); + } else { + console.log("Your loss!"); + } + } catch (error) { + console.log(error); } - } catch (error) { - console.log(error); } }; @@ -146,17 +153,17 @@ const Token = ({ balance, token, tokenAddr, accountAddr, decimals = 18 }: TokenI const tokenSvg = { // cspell: disable-next-line - uAD: () => icons.SVGs.uad, + DOLLAR: () => icons.SVGs.dollar, // cspell: disable-next-line - uCR: () => icons.SVGs.ucr, - "uCR-NFT": () => icons.SVGs.ucrNft, + CREDIT: () => icons.SVGs.credit, + "CREDIT-NFT": () => icons.SVGs.creditNft, // cspell: disable-next-line - UBQ: () => icons.SVGs.ubq, + GOVERNANCE: () => icons.SVGs.governance, USDC: () => icons.SVGs.usdc, DAI: () => icons.SVGs.dai, USDT: () => icons.SVGs.usdt, "3crv": () => , - "uAD3CRV-f": () => , + "dollar3CRV-f": () => , }; export default Inventory; diff --git a/packages/dapp/components/layout/sidebar.tsx b/packages/dapp/components/layout/sidebar.tsx index ef6672a03..c725e6197 100644 --- a/packages/dapp/components/layout/sidebar.tsx +++ b/packages/dapp/components/layout/sidebar.tsx @@ -19,7 +19,7 @@ const Sidebar = () => {
- +
Ubiquity Dollar (Beta) diff --git a/packages/dapp/components/lib/contracts-shortcuts.ts b/packages/dapp/components/lib/contracts-shortcuts.ts index be4f208be..6e0096253 100644 --- a/packages/dapp/components/lib/contracts-shortcuts.ts +++ b/packages/dapp/components/lib/contracts-shortcuts.ts @@ -42,33 +42,33 @@ export async function ensureERC1155Allowance(logName: string, contract: Contract // const toEtherNum = (n: BigNumber) => +n.toString() / 1e18; // const toNum = (n: BigNumber) => +n.toString(); -// export async function logBondingUbqInfo(contracts: Contracts) { -// const reserves = await contracts.ugovUadPair.getReserves(); -// const ubqReserve = +reserves.reserve0.toString(); -// const uadReserve = +reserves.reserve1.toString(); -// const ubqPrice = uadReserve / ubqReserve; -// console.log("uAD-UBQ Pool", uadReserve, ubqReserve); -// console.log("UBQ Price", ubqPrice); -// const ubqPerBlock = await contracts.masterChef.uGOVPerBlock(); -// const ubqMultiplier = await contracts.masterChef.uGOVmultiplier(); +// export async function logStakingGovernanceInfo(contracts: Contracts) { +// const reserves = await contracts.ugovDollarPair.getReserves(); +// const governanceReserve = +reserves.reserve0.toString(); +// const dollarReserve = +reserves.reserve1.toString(); +// const governancePrice = dollarReserve / governanceReserve; +// console.log("DOLLAR-GOVERNANCE Pool", dollarReserve, governanceReserve); +// console.log("GOVERNANCE Price", governancePrice); +// const governancePerBlock = await contracts.masterChef.uGOVPerBlock(); +// const governanceMultiplier = await contracts.masterChef.uGOVmultiplier(); // const ugovDivider = toNum(await contracts.masterChef.uGOVDivider()); -// console.log("UBQ per block", toEtherNum(ubqPerBlock)); -// console.log("UBQ Multiplier", toEtherNum(ubqMultiplier)); -// const actualUbqPerBlock = toEtherNum(ubqPerBlock.mul(ubqMultiplier).div(`${1e18}`)); -// console.log("Actual UBQ per block", actualUbqPerBlock); -// console.log("Extra UBQ per block to treasury", actualUbqPerBlock / ugovDivider); -// const blockCountInAWeek = toNum(await contracts.bonding.blockCountInAWeek()); +// console.log("GOVERNANCE per block", toEtherNum(governancePerBlock)); +// console.log("GOVERNANCE Multiplier", toEtherNum(governanceMultiplier)); +// const actualGovernancePerBlock = toEtherNum(governancePerBlock.mul(governanceMultiplier).div(`${1e18}`)); +// console.log("Actual GOVERNANCE per block", actualGovernancePerBlock); +// console.log("Extra GOVERNANCE per block to treasury", actualGovernancePerBlock / ugovDivider); +// const blockCountInAWeek = toNum(await contracts.staking.blockCountInAWeek()); // console.log("Block count in a week", blockCountInAWeek); -// const ubqPerWeek = actualUbqPerBlock * blockCountInAWeek; -// console.log("UBQ Minted per week", ubqPerWeek); -// console.log("Extra UBQ minted per week to treasury", ubqPerWeek / ugovDivider); +// const governancePerWeek = actualGovernancePerBlock * blockCountInAWeek; +// console.log("GOVERNANCE Minted per week", governancePerWeek); +// console.log("Extra GOVERNANCE minted per week to treasury", governancePerWeek / ugovDivider); // const DAYS_IN_A_YEAR = 365.2422; // const totalShares = toEtherNum(await contracts.masterChef.totalShares()); -// console.log("Total Bonding Shares", totalShares); -// const usdPerWeek = ubqPerWeek * ubqPrice; +// console.log("Total Staking Shares", totalShares); +// const usdPerWeek = governancePerWeek * governancePrice; // const usdPerDay = usdPerWeek / 7; // const usdPerYear = usdPerDay * DAYS_IN_A_YEAR; // console.log("USD Minted per day", usdPerDay); @@ -77,11 +77,11 @@ export async function ensureERC1155Allowance(logName: string, contract: Contract // const usdAsLp = 0.7460387929; // const bigNumberOneUsdAsLp = ethers.utils.parseEther(usdAsLp.toString()); -// const bondingDiscountMultiplier = await contracts.bonding.bondingDiscountMultiplier(); +// const stakingDiscountMultiplier = await contracts.staking.stakingDiscountMultiplier(); // const sharesResults = await Promise.all( // [1, 50, 100, 208].map(async (i) => { // const weeks = BigNumber.from(i.toString()); -// const shares = toEtherNum(await contracts.ubiquityFormulas.durationMultiply(bigNumberOneUsdAsLp, weeks, bondingDiscountMultiplier)); +// const shares = toEtherNum(await contracts.ubiquityFormulas.durationMultiply(bigNumberOneUsdAsLp, weeks, stakingDiscountMultiplier)); // return [i, shares]; // }) // ); diff --git a/packages/dapp/components/lib/hooks/contracts/use-deployed-contracts.tsx b/packages/dapp/components/lib/hooks/contracts/use-deployed-contracts.tsx deleted file mode 100644 index 33c5a5b59..000000000 --- a/packages/dapp/components/lib/hooks/contracts/use-deployed-contracts.tsx +++ /dev/null @@ -1,23 +0,0 @@ -import { getDebtCouponManagerContract, getUbiquityManagerContract } from "@/components/utils/contracts"; -import { useMemo } from "react"; -import useDeployedAddress from "../use-deployed-address"; -import useWeb3Provider from "../use-web-3-provider"; - -export type DeployedContracts = ReturnType | null; -const useDeployedContracts = () => { - const provider = useWeb3Provider(); - // cspell: disable-next-line - const [addr1, addr2] = useDeployedAddress("UbiquityAlgorithmicDollarManager", "DebtCouponManager"); - return useMemo( - () => - addr1 && addr2 && provider - ? { - manager: getUbiquityManagerContract(addr1, provider), - debtCouponManager: getDebtCouponManagerContract(addr2, provider), - } - : null, - [addr1, addr2, provider] - ); -}; - -export default useDeployedContracts; diff --git a/packages/dapp/components/lib/hooks/contracts/use-manager-managed.tsx b/packages/dapp/components/lib/hooks/contracts/use-manager-managed.tsx deleted file mode 100644 index cfee89c45..000000000 --- a/packages/dapp/components/lib/hooks/contracts/use-manager-managed.tsx +++ /dev/null @@ -1,102 +0,0 @@ -import { - getStakingShareContract, - getBondingV2Contract, - getDebtCouponContract, - getDollarMintCalculatorContract, - getERC20Contract, - getICouponsForDollarsCalculatorContract, - getIMetaPoolContract, - getIUARForDollarsCalculatorContract, - getMasterChefV2Contract, - getSushiSwapPoolContract, - getTWAPOracleContract, - getDollarContract, - getCreditContract, - getUbiquityFormulasContract, - getGovernanceContract, - getUniswapV2PairContract, -} from "@/components/utils/contracts"; -import { ManagerFacet } from "types"; -import { createContext, useContext, useEffect, useState } from "react"; -import { ChildrenShim } from "../children-shim-d"; -import useWeb3, { PossibleProviders } from "../use-web-3"; -import useDeployedContracts from "./use-deployed-contracts"; - -export type ManagedContracts = Awaited> | null; -export const ManagedContractsContext = createContext(null); - -export const ManagedContractsContextProvider: React.FC = ({ children }) => { - const { provider } = useWeb3(); - const deployedContracts = useDeployedContracts(); - const [managedContracts, setManagedContracts] = useState(null); - - useEffect(() => { - if (deployedContracts && provider) { - (async () => { - setManagedContracts(await connectManagerContracts(deployedContracts.manager, provider)); - })(); - } - }, [deployedContracts, provider]); - - return {children}; -}; - -async function connectManagerContracts(manager: ManagerFacet, provider: NonNullable) { - // 4 - const [ - dollarToken, - dollar3poolMarket, - twapOracle, - dollarMintCalc, - creditToken, - governanceToken, - _3crvToken, - stakingToken, - creditNft, - staking, - masterChef, - sushiSwapPool, - ubiquityFormulas, - creditCalculator, - ] = await Promise.all([ - manager.dollarTokenAddress(), - manager.stableSwapMetaPoolAddress(), - manager.twapOracleAddress(), - manager.dollarMintCalculatorAddress(), - manager.creditTokenAddress(), - manager.governanceTokenAddress(), - manager.curve3PoolTokenAddress(), - manager.stakingShareAddress(), - manager.creditNftAddress(), - manager.stakingContractAddress(), - manager.masterChefAddress(), - manager.sushiSwapPoolAddress(), - manager.formulasAddress(), - manager.creditCalculatorAddress(), - ]); - const creditNftCalculator = manager.address; - const sushiSwapPoolContract = getSushiSwapPoolContract(sushiSwapPool, provider); - - const governanceMarket = getUniswapV2PairContract(await sushiSwapPoolContract.pair(), provider); - - return { - dollarToken: getDollarContract(dollarToken, provider), - dollarMetapool: getIMetaPoolContract(dollar3poolMarket, provider), - dollarTwapOracle: getTWAPOracleContract(twapOracle, provider), - dollarMintCalculator: getDollarMintCalculatorContract(dollarMintCalc, provider), - creditToken: getCreditContract(creditToken, provider), - governanceToken: getGovernanceContract(governanceToken, provider), - _3crvToken: getERC20Contract(_3crvToken, provider), - stakingToken: getStakingShareContract(stakingToken, provider), - creditNft: getDebtCouponContract(creditNft, provider), - staking: getBondingV2Contract(staking, provider), - masterChef: getMasterChefV2Contract(masterChef, provider), - sushiSwapPool: sushiSwapPoolContract, - governanceMarket: governanceMarket, - ubiquityFormulas: getUbiquityFormulasContract(ubiquityFormulas, provider), - creditNftCalculator: getICouponsForDollarsCalculatorContract(creditNftCalculator, provider), - creditCalculator: getIUARForDollarsCalculatorContract(creditCalculator, provider), - }; -} - -export default () => useContext(ManagedContractsContext); diff --git a/packages/dapp/components/lib/hooks/contracts/use-protocol-contracts.ts b/packages/dapp/components/lib/hooks/contracts/use-protocol-contracts.ts index c6ac8a942..d5465b551 100644 --- a/packages/dapp/components/lib/hooks/contracts/use-protocol-contracts.ts +++ b/packages/dapp/components/lib/hooks/contracts/use-protocol-contracts.ts @@ -3,7 +3,7 @@ import { Contract, ethers } from "ethers"; import latestDeployment from "@ubiquity/contracts/broadcast/05_StakingShare.s.sol/31337/run-latest.json"; import useWeb3 from "../use-web-3"; -import { sushiSwapPoolAddress, dollar3poolMarketAddress } from "@/lib/utils"; +import { sushiSwapPoolAddress, dollar3poolMarketAddress, _3crvTokenAddress } from "@/lib/utils"; // contract build artifacts // separately deployed contracts @@ -32,6 +32,7 @@ import UbiquityPoolFacetArtifact from "@ubiquity/contracts/out/UbiquityPoolFacet // import SushiSwapPoolArtifact from "@ubiquity/contracts/out/SushiSwapPool.sol/SushiSwapPool.json"; import IMetaPoolArtifact from "@ubiquity/contracts/out/IMetaPool.sol/IMetaPool.json"; import UniswapV2PairABI from "@/components/config/abis/uniswap-v-2-pair.json"; +import ERC20ABI from "@/components/config/abis/erc-20.json"; /** * Returns all of the available protocol contracts @@ -88,6 +89,7 @@ const useProtocolContracts = async () => { ubiquityPoolFacet: Contract | null; sushiPoolGovernanceDollarLp: Contract | null; curveMetaPoolDollarTriPoolLp: Contract | null; + _3crvToken: Contract | null; } = { // separately deployed contracts (i.e. not part of the diamond) creditNft: null, @@ -114,6 +116,7 @@ const useProtocolContracts = async () => { // related contracts sushiPoolGovernanceDollarLp: null, curveMetaPoolDollarTriPoolLp: null, + _3crvToken: null, }; let diamondAddress = ""; @@ -170,6 +173,10 @@ const useProtocolContracts = async () => { const metaPoolContract = new ethers.Contract(dollar3poolMarketAddress, IMetaPoolArtifact.abi, provider); protocolContracts.curveMetaPoolDollarTriPoolLp = metaPoolContract; + // const _3crvTokenAddress = await protocolContracts.managerFacet.curve3PoolTokenAddress(); + const _3crvTokenContract = new ethers.Contract(_3crvTokenAddress, ERC20ABI, provider); + protocolContracts._3crvToken = _3crvTokenContract; + return protocolContracts; }; diff --git a/packages/dapp/components/lib/hooks/use-balances.tsx b/packages/dapp/components/lib/hooks/use-balances.tsx index 47a8262fb..b4a281e49 100644 --- a/packages/dapp/components/lib/hooks/use-balances.tsx +++ b/packages/dapp/components/lib/hooks/use-balances.tsx @@ -1,10 +1,9 @@ -import { erc1155BalanceOf, _3crvTokenAddress } from "@/lib/utils"; +import { erc1155BalanceOf } from "@/lib/utils"; import { createContext, useContext, useEffect, useState } from "react"; import useNamedContracts from "./contracts/use-named-contracts"; import useWalletAddress from "./use-wallet-address"; import { ChildrenShim } from "./children-shim-d"; import useProtocolContracts from "@/components/lib/hooks/contracts/use-protocol-contracts"; -import { getERC20Contract } from "@/components/utils/contracts"; import useWeb3 from "@/components/lib/hooks/use-web-3"; import { Balances } from "../types"; @@ -27,11 +26,9 @@ export const BalancesContextProvider: React.FC = ({ children }) => const contracts = await protocolContracts; if (contracts.creditNft && contracts.stakingShare) { - // const _3crvTokenAddress = await contracts.managerFacet?.curve3PoolTokenAddress(); - const _3crvTokenContract = getERC20Contract(_3crvTokenAddress, provider); - const [uad, _3crv, uad3crv, ucr, ubq, ucrNft, stakingShares, usdc, dai, usdt] = await Promise.all([ + const [dollar, _3crv, dollar3crv, credit, governance, creditNft, stakingShares, usdc, dai, usdt] = await Promise.all([ contracts.dollarToken?.balanceOf(walletAddress), - _3crvTokenContract.balanceOf(walletAddress), + contracts._3crvToken?.balanceOf(walletAddress), contracts.curveMetaPoolDollarTriPoolLp?.balanceOf(walletAddress), contracts.creditToken?.balanceOf(walletAddress), contracts.governanceToken?.balanceOf(walletAddress), @@ -42,12 +39,12 @@ export const BalancesContextProvider: React.FC = ({ children }) => namedContracts.usdt.balanceOf(walletAddress), ]); setBalances({ - uad, + dollar, _3crv, - uad3crv, - ucr, - ucrNft, - ubq, + dollar3crv, + credit, + creditNft, + governance, stakingShares, usdc, dai, diff --git a/packages/dapp/components/lib/hooks/use-router.ts b/packages/dapp/components/lib/hooks/use-router.ts index d2ccb730c..a1569017e 100644 --- a/packages/dapp/components/lib/hooks/use-router.ts +++ b/packages/dapp/components/lib/hooks/use-router.ts @@ -2,7 +2,7 @@ import { useEffect, useState } from "react"; import { AlphaRouter } from "@uniswap/smart-order-router"; import { Percent, TradeType } from "@uniswap/sdk-core"; import useWeb3 from "@/components/lib/hooks/use-web-3"; -import { uAD_TOKEN, uCR_TOKEN, USDC_TOKEN, USDT_TOKEN, DAI_TOKEN, parseAmount } from "../utils"; +import { DOLLAR_TOKEN, CREDIT_TOKEN, USDC_TOKEN, USDT_TOKEN, DAI_TOKEN, parseAmount } from "../utils"; const useRouter = (selectedToken: string, amountIn = "0"): [string | undefined, string | undefined] => { const { provider, walletAddress } = useWeb3(); @@ -11,7 +11,7 @@ const useRouter = (selectedToken: string, amountIn = "0"): [string | undefined, async function getQuote() { let selectedTokenObject; - const parsedAmountIn = parseAmount(amountIn, uCR_TOKEN); + const parsedAmountIn = parseAmount(amountIn, CREDIT_TOKEN); if (selectedToken === "USDC") { selectedTokenObject = USDC_TOKEN; @@ -20,25 +20,25 @@ const useRouter = (selectedToken: string, amountIn = "0"): [string | undefined, } else if (selectedToken === "USDT") { selectedTokenObject = USDT_TOKEN; } else { - selectedTokenObject = uAD_TOKEN; + selectedTokenObject = DOLLAR_TOKEN; } if (provider && walletAddress) { const router = new AlphaRouter({ chainId: 1, provider: provider }); - const route1 = await router.route(parsedAmountIn, uAD_TOKEN, TradeType.EXACT_INPUT, { + const route1 = await router.route(parsedAmountIn, DOLLAR_TOKEN, TradeType.EXACT_INPUT, { recipient: walletAddress, slippageTolerance: new Percent(5, 100), deadline: Math.floor(Date.now() / 1000 + 1800), }); setQuoteAmount(route1?.quote.toFixed(2)); - console.log("Expected uAD Value : ", route1?.quote.toFixed(2)); + console.log("Expected Dollar Value : ", route1?.quote.toFixed(2)); - if (route1 && selectedToken !== "uAD") { - const parsed_uAD_amount = parseAmount(route1.quote.toFixed(2), uAD_TOKEN); + if (route1 && selectedToken !== "DOLLAR") { + const parsed_dollar_amount = parseAmount(route1.quote.toFixed(2), DOLLAR_TOKEN); - const route2 = await router.route(parsed_uAD_amount, selectedTokenObject, TradeType.EXACT_INPUT, { + const route2 = await router.route(parsed_dollar_amount, selectedTokenObject, TradeType.EXACT_INPUT, { recipient: walletAddress, slippageTolerance: new Percent(5, 100), deadline: Math.floor(Date.now() / 1000 + 1800), diff --git a/packages/dapp/components/lib/hooks/use-trade.ts b/packages/dapp/components/lib/hooks/use-trade.ts index 0f68f3ec3..aacd6fa07 100644 --- a/packages/dapp/components/lib/hooks/use-trade.ts +++ b/packages/dapp/components/lib/hooks/use-trade.ts @@ -2,13 +2,13 @@ import { Percent, TradeType } from "@uniswap/sdk-core"; import { AlphaRouter } from "@uniswap/smart-order-router"; import { BigNumber } from "@ethersproject/bignumber"; import useWeb3 from "@/components/lib/hooks/use-web-3"; -import { uAD_TOKEN, USDC_TOKEN, USDT_TOKEN, DAI_TOKEN, parseAmount, V3_ROUTER_ADDRESS } from "../utils"; +import { DOLLAR_TOKEN, USDC_TOKEN, USDT_TOKEN, DAI_TOKEN, parseAmount, V3_ROUTER_ADDRESS } from "../utils"; const useTrade = async (selectedToken: string, amountIn = "0") => { const { provider, walletAddress } = useWeb3(); let selectedTokenObject; - const parsedAmountIn = parseAmount(amountIn, uAD_TOKEN); + const parsedAmountIn = parseAmount(amountIn, DOLLAR_TOKEN); if (selectedToken === "USDC") { selectedTokenObject = USDC_TOKEN; diff --git a/packages/dapp/components/lib/types.ts b/packages/dapp/components/lib/types.ts index f27dcabbf..11f6d653d 100644 --- a/packages/dapp/components/lib/types.ts +++ b/packages/dapp/components/lib/types.ts @@ -32,12 +32,12 @@ export interface PoolState { } export interface Balances { - uad: BigNumber; + dollar: BigNumber; _3crv: BigNumber; - uad3crv: BigNumber; - ucr: BigNumber; - ucrNft: BigNumber; - ubq: BigNumber; + dollar3crv: BigNumber; + credit: BigNumber; + creditNft: BigNumber; + governance: BigNumber; stakingShares: BigNumber; usdc: BigNumber; dai: BigNumber; diff --git a/packages/dapp/components/lib/utils.ts b/packages/dapp/components/lib/utils.ts index 022161a37..05537aca3 100644 --- a/packages/dapp/components/lib/utils.ts +++ b/packages/dapp/components/lib/utils.ts @@ -114,10 +114,10 @@ export const DAI_ADDRESS = "0x6b175474e89094c44da98b954eedeac495271d0f"; export const USDT_ADDRESS = "0xdac17f958d2ee523a2206206994597c13d831ec7"; // Uniswap Pool Addresses -export const uCR_uAD_ADDRESS = "0x429630355C3Ab8E7AceCD99B78BE2D37Bb939E27"; -export const uCR_USDC_ADDRESS = "0x895BEbB725be4b1B9168508b84a811c7710EfB3C"; -export const uCR_DAI_ADDRESS = "0x587B192f4c2c4C9115Ea1E0Fe4129d5188eC3728"; -export const uCR_USDT_ADDRESS = "0x9d498aB38Aa889AE0f4A865d30da2116ee9716bC"; +export const CREDIT_DOLLAR_ADDRESS = "0x429630355C3Ab8E7AceCD99B78BE2D37Bb939E27"; +export const CREDIT_USDC_ADDRESS = "0x895BEbB725be4b1B9168508b84a811c7710EfB3C"; +export const CREDIT_DAI_ADDRESS = "0x587B192f4c2c4C9115Ea1E0Fe4129d5188eC3728"; +export const CREDIT_USDT_ADDRESS = "0x9d498aB38Aa889AE0f4A865d30da2116ee9716bC"; // Uniswap Router address export const V3_ROUTER_ADDRESS = "0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45"; @@ -135,8 +135,8 @@ export const safeParseEther = (val: string) => { }; // Token entities -export const uCR_TOKEN = new Token(1, "0x5894cFEbFdEdBe61d01F20140f41c5c49AedAe97", 18, "uCR", "Ubiquity Credit"); -export const uAD_TOKEN = new Token(1, "0x0F644658510c95CB46955e55D7BA9DDa9E9fBEc6", 18, "uAD", "Ubiquity Algorithmic Dollar"); +export const CREDIT_TOKEN = new Token(1, "0x5894cFEbFdEdBe61d01F20140f41c5c49AedAe97", 18, "uCR", "Ubiquity Credit"); +export const DOLLAR_TOKEN = new Token(1, "0x0F644658510c95CB46955e55D7BA9DDa9E9fBEc6", 18, "uAD", "Ubiquity Algorithmic Dollar"); export const WETH_TOKEN = new Token(1, "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", 18, "WETH", "Wrapped Ether"); export const USDC_TOKEN = new Token(1, "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", 6, "USDC", "USD//C"); export const USDT_TOKEN = new Token(1, "0xdAC17F958D2ee523a2206206994597C13D831ec7", 6, "USDT", "Tether USD"); diff --git a/packages/dapp/components/monitor/metapool-monitor.tsx b/packages/dapp/components/monitor/metapool-monitor.tsx index 118082a1e..ee3c98d3d 100644 --- a/packages/dapp/components/monitor/metapool-monitor.tsx +++ b/packages/dapp/components/monitor/metapool-monitor.tsx @@ -1,8 +1,9 @@ -import { useEffect, useState } from "react"; +import { useState } from "react"; +import useEffectAsync from "../lib/hooks/use-effect-async"; import { formatEther } from "@/lib/format"; import useNamedContracts from "../lib/hooks/contracts/use-named-contracts"; -import useManagerManaged from "../lib/hooks/contracts/use-manager-managed"; +import useProtocolContracts from "@/components/lib/hooks/contracts/use-protocol-contracts"; // import Address from "./ui/Address"; import Balance from "./ui/balance"; // import { useConnectedContext } from "@/lib/connected"; @@ -10,29 +11,29 @@ import Balance from "./ui/balance"; type State = null | MetapoolMonitorProps; type MetapoolMonitorProps = { metaPoolAddress: string; - uadBalance: number; - crvBalance: number; + dollarTokenBalance: number; + curve3CrvTokenBalance: number; }; const MetapoolMonitorContainer = () => { - const { dollarMetapool: metaPool } = useManagerManaged() || {}; + const protocolContracts = useProtocolContracts(); const { curvePool } = useNamedContracts() || {}; const [metaPoolMonitorProps, setMetapoolMonitorProps] = useState(null); - useEffect(() => { + useEffectAsync(async () => { + const contracts = await protocolContracts; + const metaPool = contracts.curveMetaPoolDollarTriPoolLp; if (metaPool && curvePool) { - (async function () { - const [uadBalance, crvBalance] = await Promise.all([metaPool.balances(0), metaPool.balances(1)]); - - setMetapoolMonitorProps({ - metaPoolAddress: metaPool.address, - uadBalance: +formatEther(uadBalance), - crvBalance: +formatEther(crvBalance), - }); - })(); + const [dollarTokenBalance, curve3CrvTokenBalance] = await Promise.all([metaPool.balances(0), metaPool.balances(1)]); + + setMetapoolMonitorProps({ + metaPoolAddress: metaPool.address, + dollarTokenBalance: +formatEther(dollarTokenBalance), + curve3CrvTokenBalance: +formatEther(curve3CrvTokenBalance), + }); } - }, [metaPool, curvePool]); + }, [curvePool]); return metaPoolMonitorProps && ; }; @@ -42,8 +43,8 @@ const MetapoolMonitor = (props: MetapoolMonitorProps) => {

Metapool Balances

{/* cspell: disable-next-line */} - - + +
); }; diff --git a/packages/dapp/components/monitor/price-monitor.tsx b/packages/dapp/components/monitor/price-monitor.tsx index ccee25adc..bdba6f119 100644 --- a/packages/dapp/components/monitor/price-monitor.tsx +++ b/packages/dapp/components/monitor/price-monitor.tsx @@ -1,77 +1,88 @@ import { BigNumber, ethers } from "ethers"; -import { useEffect, useState } from "react"; +import { useState } from "react"; +import useEffectAsync from "../lib/hooks/use-effect-async"; import NAMED_ACCOUNTS from "../config/named-accounts.json"; import { formatEther, formatMwei } from "@/lib/format"; import useNamedContracts from "../lib/hooks/contracts/use-named-contracts"; -import useManagerManaged from "../lib/hooks/contracts/use-manager-managed"; +import useProtocolContracts, { ProtocolContracts } from "@/components/lib/hooks/contracts/use-protocol-contracts"; +// import Address from "./ui/Address"; import PriceExchange from "./ui/price-exchange"; type State = null | PriceMonitorProps; type PriceMonitorProps = { metaPoolAddress: string; daiUsdt: number; - uadUsdc: number; - uadDai: number; - uadUsdt: number; + dollarUsdc: number; + dollarDai: number; + dollarUsdt: number; twapAddress: string; - uadCrv: number; - crvUad: number; + dollarCrv: number; + crvDollar: number; dollarMintCalcAddress: string; dollarToBeMinted: number | null; }; -type ManagedContracts = NonNullable>>; type NamedContracts = NonNullable>>; -const fetchPrices = async ( - { dollarToken: uad, dollarMetapool: metaPool, dollarTwapOracle: twapOracle, dollarMintCalculator: dollarMintCalc }: ManagedContracts, - { curvePool }: NamedContracts -): Promise => { - const [[daiIndex, usdtIndex], [uadIndex, usdcIndex]] = await Promise.all([ - curvePool.get_coin_indices(metaPool.address, NAMED_ACCOUNTS.DAI, NAMED_ACCOUNTS.USDT), - curvePool.get_coin_indices(metaPool.address, uad.address, NAMED_ACCOUNTS.USDC), - ]); +const fetchPrices = async (protocolContracts: ProtocolContracts, { curvePool }: NamedContracts): Promise => { + const contracts = await protocolContracts; + if (contracts) { + const { + dollarToken: dollarToken, + curveMetaPoolDollarTriPoolLp: metaPool, + twapOracleDollar3poolFacet: twapOracle, + dollarMintCalculatorFacet: dollarMintCalc, + } = contracts; - const metaPoolGet = async (i1: BigNumber, i2: BigNumber): Promise => { - return await metaPool.get_dy_underlying(i1, i2, ethers.utils.parseEther("1")); - }; + if (dollarToken && metaPool && twapOracle && dollarMintCalc) { + const [[daiIndex, usdtIndex], [dollarIndex, usdcIndex]] = await Promise.all([ + curvePool.get_coin_indices(metaPool.address, NAMED_ACCOUNTS.DAI, NAMED_ACCOUNTS.USDT), + curvePool.get_coin_indices(metaPool.address, dollarToken.address, NAMED_ACCOUNTS.USDC), + ]); - const [daiUsdt, uadUsdc, uadDai, uadUsdt, uadCrv, crvUad] = await Promise.all([ - metaPoolGet(daiIndex, usdtIndex), - metaPoolGet(uadIndex, usdcIndex), - metaPoolGet(uadIndex, daiIndex), - metaPoolGet(uadIndex, usdtIndex), - twapOracle.consult(uad.address), - twapOracle.consult(NAMED_ACCOUNTS.curve3CrvToken), - ]); + const metaPoolGet = async (i1: BigNumber, i2: BigNumber): Promise => { + return await metaPool.get_dy_underlying(i1, i2, ethers.utils.parseEther("1")); + }; - return { - metaPoolAddress: metaPool.address, - daiUsdt: +formatMwei(daiUsdt), - uadUsdc: +formatMwei(uadUsdc), - uadDai: +formatEther(uadDai), - uadUsdt: +formatMwei(uadUsdt), - twapAddress: twapOracle.address, - uadCrv: +formatEther(uadCrv), - crvUad: +formatEther(crvUad), - dollarMintCalcAddress: dollarMintCalc.address, - dollarToBeMinted: uadCrv.gt(ethers.utils.parseEther("1")) ? +formatEther(await dollarMintCalc.getDollarsToMint()) : null, - }; + const [daiUsdt, dollarUsdc, dollarDai, dollarUsdt, dollarCrv, crvDollar] = await Promise.all([ + metaPoolGet(daiIndex, usdtIndex), + metaPoolGet(dollarIndex, usdcIndex), + metaPoolGet(dollarIndex, daiIndex), + metaPoolGet(dollarIndex, usdtIndex), + twapOracle.consult(dollarToken.address), + twapOracle.consult(NAMED_ACCOUNTS.curve3CrvToken), + ]); + + return { + metaPoolAddress: metaPool.address, + daiUsdt: +formatMwei(daiUsdt), + dollarUsdc: +formatMwei(dollarUsdc), + dollarDai: +formatEther(dollarDai), + dollarUsdt: +formatMwei(dollarUsdt), + twapAddress: twapOracle.address, + dollarCrv: +formatEther(dollarCrv), + crvDollar: +formatEther(crvDollar), + dollarMintCalcAddress: dollarMintCalc.address, + dollarToBeMinted: dollarCrv.gt(ethers.utils.parseEther("1")) ? +formatEther(await dollarMintCalc.getDollarsToMint()) : null, + }; + } + } }; const PriceMonitorContainer = () => { - const managedContracts = useManagerManaged(); const namedContracts = useNamedContracts(); + const protocolContracts = useProtocolContracts(); const [priceMonitorProps, setPriceMonitorProps] = useState(null); - useEffect(() => { - if (managedContracts && namedContracts) { - (async function () { - setPriceMonitorProps(await fetchPrices(managedContracts, namedContracts)); - })(); + useEffectAsync(async () => { + if (protocolContracts && namedContracts) { + const prices = await fetchPrices(protocolContracts, namedContracts); + if (prices) { + setPriceMonitorProps(prices); + } } - }, [managedContracts, namedContracts]); + }, [namedContracts]); return priceMonitorProps && ; }; @@ -81,18 +92,18 @@ const PriceMonitor = (props: PriceMonitorProps) => {

Spot

{/* cspell: disable-next-line */} - +

Time Weighted Average

{/* cspell: disable-next-line */} - + {/* cspell: disable-next-line */} - +

Dollar Minting

{props.dollarToBeMinted ? (
{/* cspell: disable-next-line */} - {props.dollarToBeMinted} uAD to be minted + {props.dollarToBeMinted} Dollar to be minted
) : ( "No minting needed" diff --git a/packages/dapp/components/monitor/token-monitor.tsx b/packages/dapp/components/monitor/token-monitor.tsx index 973b3f25e..33c2149fb 100644 --- a/packages/dapp/components/monitor/token-monitor.tsx +++ b/packages/dapp/components/monitor/token-monitor.tsx @@ -1,42 +1,39 @@ -import { useEffect, useState } from "react"; +import { useState } from "react"; import { formatEther } from "@/lib/format"; -import useDeployedContracts from "../lib/hooks/contracts/use-deployed-contracts"; -import useManagerManaged from "../lib/hooks/contracts/use-manager-managed"; +import useProtocolContracts from "@/components/lib/hooks/contracts/use-protocol-contracts"; // import Address from "./ui/Address"; import Balance from "./ui/balance"; +import useEffectAsync from "../lib/hooks/use-effect-async"; type State = null | TokenMonitorProps; type TokenMonitorProps = { - debtCouponAddress: string; - debtCouponManagerAddress: string; - totalOutstandingDebt: number; + creditNftAddress: string; + creditNftManagerAddress: string; + totalOutstandingCredit: number; totalRedeemable: number; }; const TokenMonitorContainer = () => { - const { debtCouponManager } = useDeployedContracts() || {}; - const { creditNft: debtCouponToken, dollarToken: uad } = useManagerManaged() || {}; - + const protocolContracts = useProtocolContracts(); const [tokenMonitorPRops, setTokenMonitorProps] = useState(null); - useEffect(() => { - if (debtCouponManager && debtCouponToken && uad) { - (async function () { - const [totalOutstandingDebt, totalRedeemable] = await Promise.all([ - debtCouponToken.getTotalOutstandingDebt(), - uad.balanceOf(debtCouponManager.address), - ]); - - setTokenMonitorProps({ - debtCouponAddress: debtCouponToken.address, - debtCouponManagerAddress: debtCouponManager.address, - totalOutstandingDebt: +formatEther(totalOutstandingDebt), - totalRedeemable: +formatEther(totalRedeemable), - }); - })(); + useEffectAsync(async () => { + const contracts = await protocolContracts; + if (contracts && contracts.creditNft && contracts.creditNftManagerFacet) { + const [totalOutstandingCredit, totalRedeemable] = await Promise.all([ + contracts.creditNft?.getTotalOutstandingDebt(), + contracts.dollarToken?.balanceOf(contracts.creditNftManagerFacet.address), + ]); + + setTokenMonitorProps({ + creditNftAddress: contracts.creditNft.address, + creditNftManagerAddress: contracts.creditNftManagerFacet.address, + totalOutstandingCredit: +formatEther(totalOutstandingCredit), + totalRedeemable: +formatEther(totalRedeemable), + }); } - }, [debtCouponManager, debtCouponToken, uad]); + }, []); return tokenMonitorPRops && ; }; @@ -46,12 +43,12 @@ const TokenMonitor = (props: TokenMonitorProps) => {

Credit Monitor

- - {/*
*/} + + {/*
*/}
- - {/*
*/} + + {/*
*/}
); diff --git a/packages/dapp/components/redeem/debt-coupon-deposit.tsx b/packages/dapp/components/redeem/credit-nft-deposit.tsx similarity index 73% rename from packages/dapp/components/redeem/debt-coupon-deposit.tsx rename to packages/dapp/components/redeem/credit-nft-deposit.tsx index a95767a33..9ac2d249b 100644 --- a/packages/dapp/components/redeem/debt-coupon-deposit.tsx +++ b/packages/dapp/components/redeem/credit-nft-deposit.tsx @@ -12,7 +12,7 @@ import useWalletAddress from "../lib/hooks/use-wallet-address"; import Button from "../ui/button"; import PositiveNumberInput from "../ui/positive-number-input"; -const UcrNftGenerator = () => { +const CreditNftGenerator = () => { const [walletAddress] = useWalletAddress(); const signer = useSigner(); const [balances, refreshBalances] = useBalances(); @@ -20,7 +20,7 @@ const UcrNftGenerator = () => { const protocolContracts = useProtocolContracts(); const [inputVal, setInputVal] = useState(""); - const [expectedDebtCoupon, setExpectedDebtCoupon] = useState(null); + const [expectedCreditNft, setExpectedCreditNft] = useState(null); if (!walletAddress || !signer) { return Connect wallet; @@ -30,11 +30,11 @@ const UcrNftGenerator = () => { return · · ·; } - const depositDollarForDebtCoupons = async (amount: BigNumber) => { + const depositDollarForCreditNfts = async (amount: BigNumber) => { const contracts = await protocolContracts; if (contracts.dollarToken && contracts.creditNftManagerFacet) { // cspell: disable-next-line - await ensureERC20Allowance("uCR -> CreditNftManagerFacet", contracts.dollarToken, amount, signer, contracts.creditNftManagerFacet.address); + await ensureERC20Allowance("CREDIT -> CreditNftManagerFacet", contracts.dollarToken, amount, signer, contracts.creditNftManagerFacet.address); await (await contracts.creditNftManagerFacet.connect(signer).exchangeDollarsForCreditNft(amount)).wait(); refreshBalances(); } @@ -44,9 +44,9 @@ const UcrNftGenerator = () => { const amount = extractValidAmount(); if (amount) { // cspell: disable-next-line - doTransaction("Burning uAD...", async () => { + doTransaction("Burning Dollar...", async () => { setInputVal(""); - await depositDollarForDebtCoupons(amount); + await depositDollarForCreditNfts(amount); }); } }; @@ -56,14 +56,14 @@ const UcrNftGenerator = () => { setInputVal(val); const amount = extractValidAmount(val); if (amount && contracts.creditNftRedemptionCalculatorFacet) { - setExpectedDebtCoupon(null); - setExpectedDebtCoupon(await contracts.creditNftRedemptionCalculatorFacet.connect(signer).getCreditNftAmount(amount)); + setExpectedCreditNft(null); + setExpectedCreditNft(await contracts.creditNftRedemptionCalculatorFacet.connect(signer).getCreditNftAmount(amount)); } }; const extractValidAmount = (val: string = inputVal): null | BigNumber => { const amount = safeParseEther(val); - return amount && amount.gt(BigNumber.from(0)) && amount.lte(balances.uad) ? amount : null; + return amount && amount.gt(BigNumber.from(0)) && amount.lte(balances.dollar) ? amount : null; }; const submitEnabled = !!(extractValidAmount() && !doingTransaction); @@ -71,14 +71,14 @@ const UcrNftGenerator = () => { return (
{/* cspell: disable-next-line */} - + - {expectedDebtCoupon && inputVal &&

expected uCR-NFT {formatEther(expectedDebtCoupon)}

} + {expectedCreditNft && inputVal &&

expected CREDIT-NFT {formatEther(expectedCreditNft)}

}
); }; -export default UcrNftGenerator; +export default CreditNftGenerator; diff --git a/packages/dapp/components/redeem/ucr-nft-redeem.tsx b/packages/dapp/components/redeem/credit-nft-redeem.tsx similarity index 60% rename from packages/dapp/components/redeem/ucr-nft-redeem.tsx rename to packages/dapp/components/redeem/credit-nft-redeem.tsx index 699bc6773..531ad648b 100644 --- a/packages/dapp/components/redeem/ucr-nft-redeem.tsx +++ b/packages/dapp/components/redeem/credit-nft-redeem.tsx @@ -13,7 +13,7 @@ import Button from "../ui/button"; import PositiveNumberInput from "../ui/positive-number-input"; import useEffectAsync from "../lib/hooks/use-effect-async"; -const UcrNftRedeem = () => { +const CreditNftRedeem = () => { const [walletAddress] = useWalletAddress(); const signer = useSigner(); const [, refreshBalances] = useBalances(); @@ -21,59 +21,62 @@ const UcrNftRedeem = () => { const protocolContracts = useProtocolContracts(); const [inputVal, setInputVal] = useState(""); - const [debtIds, setDebtIds] = useState(null); - const [debtBalances, setDebtBalances] = useState([]); - const [selectedDebtId, setSelectedDebtId] = useState(0); + const [creditIds, setCreditIds] = useState(null); + const [creditBalances, setCreditBalances] = useState([]); + const [selectedCreditId, setSelectedCreditId] = useState(0); const setMax = () => { - if (debtBalances[selectedDebtId]) { - setInputVal(ethers.utils.formatEther(debtBalances[selectedDebtId])); + if (creditBalances[selectedCreditId]) { + setInputVal(ethers.utils.formatEther(creditBalances[selectedCreditId])); } }; useEffectAsync(async () => { const contracts = await protocolContracts; if (contracts.creditNft && walletAddress) { - fetchDebts(walletAddress, contracts.creditNft); + fetchCredits(walletAddress, contracts.creditNft); } }, [walletAddress]); if (!walletAddress || !signer) return Connect wallet; - if (!protocolContracts || !debtIds) return · · ·; - if (debtIds.length === 0) return No uCR-NFT coupons; + if (!protocolContracts || !creditIds) return · · ·; + if (creditIds.length === 0) return No CREDIT-NFT Nfts; - async function fetchDebts(address: string, contract: Contract) { + async function fetchCredits(address: string, contract: Contract) { const ids = await contract.holderTokens(address); const newBalances = await Promise.all(ids.map(async (id: string) => await contract.balanceOf(address, id))); - setDebtIds(ids); - setSelectedDebtId(0); - setDebtBalances(newBalances); + setCreditIds(ids); + setSelectedCreditId(0); + setCreditBalances(newBalances); } const extractValidAmount = (val: string = inputVal): null | BigNumber => { const amount = safeParseEther(val); - const selectedCouponBalance = debtBalances[selectedDebtId]; - return amount && amount.gt(BigNumber.from(0)) && amount.lte(selectedCouponBalance) ? amount : null; + const selectedNftBalance = creditBalances[selectedCreditId]; + return amount && amount.gt(BigNumber.from(0)) && amount.lte(selectedNftBalance) ? amount : null; }; const handleRedeem = async () => { const amount = extractValidAmount(inputVal); if (amount) { - doTransaction("Redeeming uCR-NFT...", async () => { + doTransaction("Redeeming CREDIT-NFT...", async () => { setInputVal(""); - await redeemUcrNftForUad(amount); + await redeemCreditNftForDollar(amount); }); } }; - const redeemUcrNftForUad = async (amount: BigNumber) => { + const redeemCreditNftForDollar = async (amount: BigNumber) => { const contracts = await protocolContracts; - const debtId = debtIds[selectedDebtId]; + const creditId = creditIds[selectedCreditId]; if (contracts.creditNft && contracts.creditNftManagerFacet) { - if (debtId && (await ensureERC1155Allowance("uCR-NFT -> CreditNftManagerFacet", contracts.creditNft, signer, contracts.creditNftManagerFacet.address))) { - await (await contracts.creditNftManagerFacet.connect(signer).redeemCreditNft(debtId, amount)).wait(); + if ( + creditId && + (await ensureERC1155Allowance("CREDIT-NFT -> CreditNftManagerFacet", contracts.creditNft, signer, contracts.creditNftManagerFacet.address)) + ) { + await (await contracts.creditNftManagerFacet.connect(signer).redeemCreditNft(creditId, amount)).wait(); refreshBalances(); - fetchDebts(walletAddress, contracts.creditNft); + fetchCredits(walletAddress, contracts.creditNft); } } }; @@ -83,24 +86,24 @@ const UcrNftRedeem = () => { return (
- setSelectedCreditId(parseInt(ev.target.value))}> + {creditIds.map((creditId, i) => ( ))}
- +
setMax()}>MAX
); }; -export default UcrNftRedeem; +export default CreditNftRedeem; diff --git a/packages/dapp/components/redeem/debt-coupon.tsx b/packages/dapp/components/redeem/credit-nft.tsx similarity index 59% rename from packages/dapp/components/redeem/debt-coupon.tsx rename to packages/dapp/components/redeem/credit-nft.tsx index 2bc062d1d..e6b6d8dac 100644 --- a/packages/dapp/components/redeem/debt-coupon.tsx +++ b/packages/dapp/components/redeem/credit-nft.tsx @@ -10,31 +10,31 @@ import { Balances } from "../lib/types"; type Actions = { onRedeem: () => void; onSwap: (amount: number, unit: string) => void; - onBurn: (uadAmount: string, setErrMsg: Dispatch>) => void; + onBurn: (dollarAmount: string, setErrMsg: Dispatch>) => void; }; -type Coupon = { +type CreditNft = { amount: number; expiration: number; swap: { amount: number; unit: string }; }; -type Coupons = { +type CreditNfts = { // cspell: disable-next-line - uDEBT: Coupon[]; + creditNft: CreditNft[]; // cspell: disable-next-line stakingShare: number; // cspell: disable-next-line - uAR: number; + creditNftAmount: number; }; // cspell: disable-next-line -const uDEBT = "uDEBT"; +const CREDITNFT = "CREDITNFT"; // cspell: disable-next-line -const uAR = "uAR"; +const CREDIT = "CREDIT"; // eslint-disable-next-line @typescript-eslint/no-unused-vars -export const DebtCouponContainer = ({ protocolContracts, web3Provider, walletAddress, signer }: LoadedContext) => { +export const CreditNftContainer = ({ protocolContracts, web3Provider, walletAddress, signer }: LoadedContext) => { // eslint-disable-next-line @typescript-eslint/no-unused-vars const [balances, refreshBalances] = useBalances(); const [, doTransaction] = useTransactionLogger(); @@ -48,10 +48,10 @@ export const DebtCouponContainer = ({ protocolContracts, web3Provider, walletAdd onSwap: () => { console.log("onSwap"); }, - onBurn: async (uadAmount, setErrMsg) => { + onBurn: async (dollarAmount, setErrMsg) => { setErrMsg(""); // cspell: disable-next-line - await doTransaction("Burning uAD...", async () => {}); + await doTransaction("Burning DOLLAR...", async () => {}); }, }; @@ -61,104 +61,104 @@ export const DebtCouponContainer = ({ protocolContracts, web3Provider, walletAdd }; const cycleStartDate = 1637625600000; - const uarDeprecationRate = 0.0001; - const uarCurrentRewardPct = 0.05; - const uDebtDeprecationRate = 0.0015; - const uDebtCurrentRewardPct = 0.05; - const uDebtExpirationTime = 1640217600000; - const uDebtUbqRedemptionRate = 0.25; - const uadTotalSupply = 233000; + const creditDeprecationRate = 0.0001; + const creditCurrentRewardPct = 0.05; + const creditNftDeprecationRate = 0.0015; + const creditNftCurrentRewardPct = 0.05; + const creditNftExpirationTime = 1640217600000; + const creditNftGovernanceRedemptionRate = 0.25; + const dollarTotalSupply = 233000; const stakingShareTotalSupply = 10000; - const uarTotalSupply = 30000; - const uDebtTotalSupply = 12000; - const coupons: Coupons = { + const creditTotalSupply = 30000; + const creditNftTotalSupply = 12000; + const creditNfts: CreditNfts = { // cspell: disable-next-line - uDEBT: [ + creditNft: [ // cspell: disable-next-line - { amount: 1000, expiration: 1640390400000, swap: { amount: 800, unit: "uAR" } }, + { amount: 1000, expiration: 1640390400000, swap: { amount: 800, unit: "CREDIT" } }, // cspell: disable-next-line - { amount: 500, expiration: 1639526400000, swap: { amount: 125, unit: "uAR" } }, + { amount: 500, expiration: 1639526400000, swap: { amount: 125, unit: "CREDIT" } }, // cspell: disable-next-line - { amount: 666, expiration: 1636934400000, swap: { amount: 166.5, unit: "UBQ" } }, + { amount: 666, expiration: 1636934400000, swap: { amount: 166.5, unit: "GOVERNANCE" } }, ], // cspell: disable-next-line stakingShare: 1000, // cspell: disable-next-line - uAR: 3430, + creditNftAmount: 3430, }; return (
-

Debt Coupon

+

Credit Nft

{balances && ( - )}
); }; -type DebtCouponProps = { +type CreditNftProps = { twapPrice: BigNumber | null; balances: Balances; actions: Actions; cycleStartDate: number; - uarDeprecationRate: number; - uarCurrentRewardPct: number; - uDebtDeprecationRate: number; - uDebtCurrentRewardPct: number; - uDebtExpirationTime: number; - uDebtUbqRedemptionRate: number; - uadTotalSupply: number; + creditDeprecationRate: number; + creditCurrentRewardPct: number; + creditNftDeprecationRate: number; + creditNftCurrentRewardPct: number; + creditNftExpirationTime: number; + creditNftGovernanceRedemptionRate: number; + dollarTotalSupply: number; stakingShareSupply: number; - uarTotalSupply: number; - uDebtTotalSupply: number; - coupons: Coupons | null; + creditTotalSupply: number; + creditNftTotalSupply: number; + creditNfts: CreditNfts | null; priceIncreaseFormula: (amount: number) => Promise; }; -const DebtCoupon = memo( +const CreditNft = memo( ({ twapPrice, actions, cycleStartDate, - uarDeprecationRate, - uarCurrentRewardPct, - uDebtDeprecationRate, - uDebtCurrentRewardPct, - uDebtExpirationTime, - uDebtUbqRedemptionRate, - uadTotalSupply, + creditDeprecationRate, + creditCurrentRewardPct, + creditNftDeprecationRate, + creditNftCurrentRewardPct, + creditNftExpirationTime, + creditNftGovernanceRedemptionRate, + dollarTotalSupply, stakingShareSupply, - uarTotalSupply, - uDebtTotalSupply, - coupons, + creditTotalSupply, + creditNftTotalSupply, + creditNfts, priceIncreaseFormula, - }: DebtCouponProps) => { + }: CreditNftProps) => { const [formattedSwapPrice, setFormattedSwapPrice] = useState(""); // cspell: disable-next-line - const [selectedCurrency, selectCurrency] = useState(uDEBT); + const [selectedCurrency, selectCurrency] = useState(CREDITNFT); const [increasedValue, setIncreasedValue] = useState(0); const [errMsg, setErrMsg] = useState(); // eslint-disable-next-line @typescript-eslint/no-unused-vars - const [expectedCoupon, setExpectedCoupon] = useState(); - const [uadAmount, setUadAmount] = useState(""); + const [expectedCreditNft, setExpectedCreditNft] = useState(); + const [dollarAmount, setDollarAmount] = useState(""); const handleTabSelect = (tab: string) => { selectCurrency(tab); @@ -178,19 +178,19 @@ const DebtCoupon = memo( } }, [cycleStartDate]); - const calculatedUDebtExpirationTime = useMemo(() => { - if (uDebtExpirationTime) { - const diff = uDebtExpirationTime - Date.now(); + const calculatedCreditNftExpirationTime = useMemo(() => { + if (creditNftExpirationTime) { + const diff = creditNftExpirationTime - Date.now(); return formatTimeDiff(diff); } - }, [uDebtExpirationTime]); + }, [creditNftExpirationTime]); - const handleInputUAD = async (e: ChangeEvent) => { + const handleInputDOLLAR = async (e: ChangeEvent) => { setErrMsg(""); const missing = `Missing input value for`; const bignumberErr = `can't parse BigNumber from`; // cspell: disable-next-line - const subject = `uAD amount`; + const subject = `DOLLAR amount`; const amountEl = e.target as HTMLInputElement; const amountValue = amountEl?.value; if (!amountValue) { @@ -206,20 +206,20 @@ const DebtCoupon = memo( setErrMsg(`${subject} should be greater than 0`); return; } - setUadAmount(amountValue); + setDollarAmount(amountValue); }; const handleBurn = () => { - actions.onBurn(uadAmount, setErrMsg); + actions.onBurn(dollarAmount, setErrMsg); }; const isLessThanOne = () => parseFloat(formattedSwapPrice) <= 1; useEffect(() => { - if (uadAmount) { - // _expectedCoupon(uadAmount, contracts, selectedCurrency, setExpectedCoupon); + if (dollarAmount) { + // _expectedCreditNft(dollarAmount, contracts, selectedCurrency, setExpectedCreditNft); } - }, [uadAmount, selectedCurrency]); + }, [dollarAmount, selectedCurrency]); useEffect(() => { priceIncreaseFormula(10).then((value) => { @@ -233,30 +233,30 @@ const DebtCoupon = memo( {isLessThanOne() ? ( <> - ) : ( - )} @@ -265,79 +265,79 @@ const DebtCoupon = memo( } ); -type CouponsProps = { - uadTotalSupply: number; +type CreditNftsProps = { + dollarTotalSupply: number; stakingShareSupply: number; - uarTotalSupply: number; - uDebtTotalSupply: number; - coupons: Coupons | null; + creditTotalSupply: number; + creditNftTotalSupply: number; + creditNfts: CreditNfts | null; actions: Actions; }; -export const Coupons = ({ uadTotalSupply, stakingShareSupply, uarTotalSupply, uDebtTotalSupply, coupons, actions }: CouponsProps) => { +export const CreditNfts = ({ dollarTotalSupply, stakingShareSupply, creditTotalSupply, creditNftTotalSupply, creditNfts, actions }: CreditNftsProps) => { return ( <>
- Your Coupons + Your CreditNfts
- - + + ); }; -type CouponRedeemProps = { - coupons: Coupons | null; +type CreditNftRedeemProps = { + creditNfts: CreditNfts | null; actions: Actions; }; -export const CouponRedeem = ({ coupons, actions }: CouponRedeemProps) => { - const [uarAmount, setUarAmount] = useState(""); +export const CreditNftRedeem = ({ creditNfts, actions }: CreditNftRedeemProps) => { + const [creditAmount, setCreditAmount] = useState(""); const [stakingShareAmount, setStakingShareAmount] = useState(""); - const shouldDisableInput = (type: keyof Coupons) => { - if (!coupons) { + const shouldDisableInput = (type: keyof CreditNfts) => { + if (!creditNfts) { return true; // cspell: disable-next-line - } else if (type === "uAR") { + } else if (type === "creditNftAmount") { // cspell: disable-next-line - return !coupons.uAR || coupons.uAR <= 0; + return !creditNfts.creditNftAmount || creditNfts.creditNftAmount <= 0; // cspell: disable-next-line } else if (type === "stakingShare") { // cspell: disable-next-line - return !coupons.stakingShare || coupons.stakingShare <= 0; + return !creditNfts.stakingShare || creditNfts.stakingShare <= 0; } return false; }; - const handleInputUAR = async (e: ChangeEvent) => { + const handleInputCREDIT = async (e: ChangeEvent) => { // cspell: disable-next-line - if (!coupons || !coupons.uAR) { + if (!creditNfts || !creditNfts.creditNftAmount) { return; } const amountEl = e.target as HTMLInputElement; const amountValue = amountEl?.value; // cspell: disable-next-line - setUarAmount(`${constrainNumber(parseFloat(amountValue), 0, coupons.uAR)}`); + setCreditAmount(`${constrainNumber(parseFloat(amountValue), 0, creditNfts.creditNftAmount)}`); }; const handleInputStakingShare = async (e: ChangeEvent) => { // cspell: disable-next-line - if (!coupons || !coupons.stakingShare) { + if (!creditNfts || !creditNfts.stakingShare) { return; } const amountEl = e.target as HTMLInputElement; const amountValue = amountEl?.value; // cspell: disable-next-line - setStakingShareAmount(`${constrainNumber(parseFloat(amountValue), 0, coupons.stakingShare)}`); + setStakingShareAmount(`${constrainNumber(parseFloat(amountValue), 0, creditNfts.stakingShare)}`); }; - const uarToUDebtFormula = (amount: string) => { + const creditToCreditNftFormula = (amount: string) => { const parsedValue = parseFloat(amount); return isNaN(parsedValue) ? 0 : parsedValue * 0.9; }; @@ -349,7 +349,7 @@ export const CouponRedeem = ({ coupons, actions }: CouponRedeemProps) => {
{/* cspell: disable-next-line */} - Staking Share {coupons?.stakingShare.toLocaleString()} + Staking Share {creditNfts?.stakingShare.toLocaleString()}
{/* cspell: disable-next-line */} @@ -362,11 +362,11 @@ export const CouponRedeem = ({ coupons, actions }: CouponRedeemProps) => {
{/* cspell: disable-next-line */} - uAR {coupons?.uAR.toLocaleString()} - $2,120 + CREDIT {creditNfts?.creditNftAmount.toLocaleString()} - $2,120
{/* cspell: disable-next-line */} - +
@@ -378,9 +378,9 @@ export const CouponRedeem = ({ coupons, actions }: CouponRedeemProps) => {
{/* cspell: disable-next-line */} - {uarToUDebtFormula(uarAmount).toLocaleString()} uDEBT + {creditToCreditNftFormula(creditAmount).toLocaleString()} CREDIT NFT {/* cspell: disable-next-line */} - +
@@ -390,13 +390,13 @@ export const CouponRedeem = ({ coupons, actions }: CouponRedeemProps) => { }; type RewardCycleInfoProps = { - uadTotalSupply: number; + dollarTotalSupply: number; stakingShareSupply: number; - uarTotalSupply: number; - uDebtTotalSupply: number; + creditTotalSupply: number; + creditNftTotalSupply: number; }; -export const RewardCycleInfo = ({ uadTotalSupply, stakingShareSupply, uarTotalSupply, uDebtTotalSupply }: RewardCycleInfoProps) => { +export const RewardCycleInfo = ({ dollarTotalSupply, stakingShareSupply, creditTotalSupply, creditNftTotalSupply }: RewardCycleInfoProps) => { return ( <>
@@ -406,11 +406,11 @@ export const RewardCycleInfo = ({ uadTotalSupply, stakingShareSupply, uarTotalSu
{/* cspell: disable-next-line */} - uAD + DOLLAR
Total Supply
-
{uadTotalSupply.toLocaleString()}
+
{dollarTotalSupply.toLocaleString()}
Minted
@@ -425,7 +425,7 @@ export const RewardCycleInfo = ({ uadTotalSupply, stakingShareSupply, uarTotalSu
- Total debt + Total Credit NFT
@@ -435,13 +435,13 @@ export const RewardCycleInfo = ({ uadTotalSupply, stakingShareSupply, uarTotalSu
{/* cspell: disable-next-line */} -
uAR
-
{uarTotalSupply.toLocaleString()}
+
CREDIT
+
{creditTotalSupply.toLocaleString()}
{/* cspell: disable-next-line */} -
uDEBT
-
{uDebtTotalSupply.toLocaleString()}
+
CREDIT NFT
+
{creditNftTotalSupply.toLocaleString()}
@@ -462,35 +462,43 @@ export const RewardCycleInfo = ({ uadTotalSupply, stakingShareSupply, uarTotalSu ); }; -type UadBurningProps = { +type DollarBurningProps = { selectedCurrency: string; errMsg: string | undefined; - expectedCoupon: BigNumber | undefined; + expectedCreditNft: BigNumber | undefined; increasedValue: number; - handleInputUAD: (e: ChangeEvent) => Promise; + handleInputDOLLAR: (e: ChangeEvent) => Promise; handleTabSelect: (tab: string) => void; handleBurn: () => void; }; -export const UadBurning = ({ handleInputUAD, selectedCurrency, handleTabSelect, handleBurn, increasedValue, expectedCoupon, errMsg }: UadBurningProps) => { +export const DollarBurning = ({ + handleInputDOLLAR, + selectedCurrency, + handleTabSelect, + handleBurn, + increasedValue, + expectedCreditNft, + errMsg, +}: DollarBurningProps) => { return ( <>
{/* cspell: disable-next-line */} - uAD - + DOLLAR +

{errMsg}

- {expectedCoupon && ( + {expectedCreditNft && (

- expected {selectedCurrency} {ethers.utils.formatEther(expectedCoupon)} + expected {selectedCurrency} {ethers.utils.formatEther(expectedCreditNft)}

)}
@@ -501,21 +509,21 @@ export const UadBurning = ({ handleInputUAD, selectedCurrency, handleTabSelect, }; type PumpCycleProps = { - uarDeprecationRate: number; - uarCurrentRewardPct: number; - uDebtDeprecationRate: number; - uDebtCurrentRewardPct: number; - uDebtUbqRedemptionRate: number; - calculatedUDebtExpirationTime: string | undefined; + creditDeprecationRate: number; + creditCurrentRewardPct: number; + creditNftDeprecationRate: number; + creditNftCurrentRewardPct: number; + creditNftGovernanceRedemptionRate: number; + calculatedCreditNftExpirationTime: string | undefined; }; export const PumpCycle = ({ - uarDeprecationRate, - uarCurrentRewardPct, - uDebtDeprecationRate, - uDebtCurrentRewardPct, - uDebtUbqRedemptionRate, - calculatedUDebtExpirationTime, + creditDeprecationRate, + creditCurrentRewardPct, + creditNftDeprecationRate, + creditNftCurrentRewardPct, + creditNftGovernanceRedemptionRate, + calculatedCreditNftExpirationTime, }: PumpCycleProps) => { return ( <> @@ -525,16 +533,16 @@ export const PumpCycle = ({
{/* cspell: disable-next-line */} - Fungible (uAR) + Fungible (CREDIT) - + - + @@ -549,20 +557,20 @@ export const PumpCycle = ({
{/* cspell: disable-next-line */} - Non-fungible (uDEBT) + Non-fungible (CREDIT NFT)
Deprecation rate{uarDeprecationRate * 100}% / week{creditDeprecationRate * 100}% / week
Current reward %{uarCurrentRewardPct * 100}%{creditCurrentRewardPct * 100}%
Expires?
- + - + - +
Deprecation rate{uDebtDeprecationRate * 100}%{creditNftDeprecationRate * 100}%
Current reward %{uDebtCurrentRewardPct * 100}%{creditNftCurrentRewardPct * 100}%
Expires?After {calculatedUDebtExpirationTime}After {calculatedCreditNftExpirationTime}
@@ -571,7 +579,7 @@ export const PumpCycle = ({
{/* cspell: disable-next-line */} - Can be redeemed for UBQ at {uDebtUbqRedemptionRate * 100}% rate + Can be redeemed for GOVERNANCE at {creditNftGovernanceRedemptionRate * 100}% rate
Learn more
@@ -633,27 +641,27 @@ export const TwapPriceBar = ({ price, date }: TwapPriceBarProps) => {
{/* cspell: disable-next-line */} - {parseFloat(price) <= 1 ? "Burn uAD for debt coupons and help pump the price back up" : "Time to redeem debts coupons and help move the price down"} + {parseFloat(price) <= 1 ? "Burn DOLLAR for credit nfts and help pump the price back up" : "Time to redeem credits nfts and help move the price down"}
); }; -type CouponTableProps = { - coupons: Coupons | null; +type CreditNftTableProps = { + creditNfts: CreditNfts | null; onRedeem: Actions["onRedeem"]; onSwap: Actions["onSwap"]; }; -export const CouponTable = ({ coupons, onRedeem, onSwap }: CouponTableProps) => { +export const CreditNftTable = ({ creditNfts, onRedeem, onSwap }: CreditNftTableProps) => { return (
{/* cspell: disable-next-line */} - + @@ -662,9 +670,9 @@ export const CouponTable = ({ coupons, onRedeem, onSwap }: CouponTableProps) => {/* cspell: disable-next-line */} - {coupons && coupons.uDEBT && coupons.uDEBT.length + {creditNfts && creditNfts.creditNft && creditNfts.creditNft.length ? // cspell: disable-next-line - coupons.uDEBT.map((coupon, index) => ) + creditNfts.creditNft.map((creditNft, index) => ) : null}
uDEBTCREDIT NFT Expiration Swap
@@ -672,32 +680,32 @@ export const CouponTable = ({ coupons, onRedeem, onSwap }: CouponTableProps) => ); }; -type CouponRowProps = { - coupon: Coupon; +type CreditNftRowProps = { + creditNft: CreditNft; onRedeem: Actions["onRedeem"]; onSwap: Actions["onSwap"]; }; -export const CouponRow = ({ coupon, onRedeem, onSwap }: CouponRowProps) => { - const timeDiff = coupon.expiration - Date.now(); +export const CreditNftRow = ({ creditNft, onRedeem, onSwap }: CreditNftRowProps) => { + const timeDiff = creditNft.expiration - Date.now(); const handleSwap = () => { - onSwap(coupon.swap.amount, coupon.swap.unit); + onSwap(creditNft.swap.amount, creditNft.swap.unit); }; return ( - {coupon.amount.toLocaleString()} + {creditNft.amount.toLocaleString()} {formatTimeDiff(Math.abs(timeDiff))} {timeDiff < 0 ? " ago" : ""} - + {timeDiff > 0 ? : null} ); }; -export default withLoadedContext(DebtCouponContainer); +export default withLoadedContext(CreditNftContainer); diff --git a/packages/dapp/components/redeem/ucr-redeem.tsx b/packages/dapp/components/redeem/credit-redeem.tsx similarity index 79% rename from packages/dapp/components/redeem/ucr-redeem.tsx rename to packages/dapp/components/redeem/credit-redeem.tsx index 5e113c642..254c5f087 100644 --- a/packages/dapp/components/redeem/ucr-redeem.tsx +++ b/packages/dapp/components/redeem/credit-redeem.tsx @@ -15,7 +15,7 @@ import { SWAP_WIDGET_TOKEN_LIST, V3_ROUTER_ADDRESS } from "@/lib/utils"; import { getUniswapV3RouterContract } from "../utils/contracts"; import useWeb3 from "@/components/lib/hooks/use-web-3"; -const UcrRedeem = ({ twapInteger }: { twapInteger: number }) => { +const CreditRedeem = ({ twapInteger }: { twapInteger: number }) => { const { provider, walletAddress } = useWeb3(); const signer = useSigner(); const [balances, refreshBalances] = useBalances(); @@ -24,7 +24,7 @@ const UcrRedeem = ({ twapInteger }: { twapInteger: number }) => { const [inputVal, setInputVal] = useState("0"); // cspell: disable-next-line - const [selectedRedeemToken, setSelectedRedeemToken] = useState("uAD"); + const [selectedRedeemToken, setSelectedRedeemToken] = useState("DOLLAR"); const [quoteAmount, lastQuoteAmount] = useRouter(selectedRedeemToken, inputVal); const currentlyAbovePeg = twapInteger > 1; @@ -36,15 +36,15 @@ const UcrRedeem = ({ twapInteger }: { twapInteger: number }) => { return · · ·; } - const redeemUcr = async (amount: BigNumber) => { + const redeemCredit = async (amount: BigNumber) => { const contracts = await protocolContracts; if (contracts.creditToken && contracts.creditNftManagerFacet && contracts.dollarToken) { // cspell: disable-next-line - await ensureERC20Allowance("uCR -> CreditNftManagerFacet", contracts.creditToken, amount, signer, contracts.creditNftManagerFacet.address); + await ensureERC20Allowance("CREDIT -> CreditNftManagerFacet", contracts.creditToken, amount, signer, contracts.creditNftManagerFacet.address); await (await contracts.creditNftManagerFacet.connect(signer).burnCreditTokensForDollars(amount)).wait(); refreshBalances(); // cspell: disable-next-line - if (provider && quoteAmount && selectedRedeemToken !== "uAD") { + if (provider && quoteAmount && selectedRedeemToken !== "DOLLAR") { const routerContract = getUniswapV3RouterContract(V3_ROUTER_ADDRESS, provider); await (await routerContract.connect(signer).approveMax(contracts.dollarToken.address)).wait(); await useTrade(selectedRedeemToken, quoteAmount); @@ -57,22 +57,22 @@ const UcrRedeem = ({ twapInteger }: { twapInteger: number }) => { const amount = extractValidAmount(); if (amount) { // cspell: disable-next-line - doTransaction("Redeeming uCR...", async () => { + doTransaction("Redeeming CREDIT...", async () => { setInputVal(""); - await redeemUcr(amount); + await redeemCredit(amount); }); } }; const extractValidAmount = (val: string = inputVal): null | BigNumber => { const amount = safeParseEther(val); - return amount && amount.gt(BigNumber.from(0)) && amount.lte(balances.ucr) ? amount : null; + return amount && amount.gt(BigNumber.from(0)) && amount.lte(balances.credit) ? amount : null; }; const submitEnabled = !!(extractValidAmount() && !doingTransaction); const handleMax = () => { - const creditTokenValue = ethers.utils.formatEther(balances.ucr); + const creditTokenValue = ethers.utils.formatEther(balances.credit); setInputVal(parseInt(creditTokenValue).toString()); }; @@ -88,9 +88,9 @@ const UcrRedeem = ({ twapInteger }: { twapInteger: number }) => {

Please select a token to redeem for:

{/* cspell: disable-next-line */} - + {/* cspell: disable-next-line */} - + @@ -103,26 +103,26 @@ const UcrRedeem = ({ twapInteger }: { twapInteger: number }) => {
{/* cspell: disable-next-line */} - + MAX
{/* cspell: disable-next-line */} - {inputVal && selectedRedeemToken === "uAD" && quoteAmount && ( + {inputVal && selectedRedeemToken === "DOLLAR" && quoteAmount && (
{/* cspell: disable-next-line */} - {inputVal} uCR -> {quoteAmount} uAD. + {inputVal} CREDIT -> {quoteAmount} DOLLAR.
)} {/* cspell: disable-next-line */} - {inputVal && selectedRedeemToken !== "uAD" && quoteAmount && lastQuoteAmount && ( + {inputVal && selectedRedeemToken !== "DOLLAR" && quoteAmount && lastQuoteAmount && (
{/* cspell: disable-next-line */} - {inputVal} uCR -> {quoteAmount} uAD -> {lastQuoteAmount} {selectedRedeemToken}. + {inputVal} CREDIT -> {quoteAmount} DOLLAR -> {lastQuoteAmount} {selectedRedeemToken}.
)}
) : ( @@ -135,4 +135,4 @@ const UcrRedeem = ({ twapInteger }: { twapInteger: number }) => { ); }; -export default UcrRedeem; +export default CreditRedeem; diff --git a/packages/dapp/components/staking/deposit-share.tsx b/packages/dapp/components/staking/deposit-share.tsx index 7025bc992..a8adc7286 100644 --- a/packages/dapp/components/staking/deposit-share.tsx +++ b/packages/dapp/components/staking/deposit-share.tsx @@ -14,34 +14,34 @@ const MIN_WEEKS = 1; const MAX_WEEKS = 208; // cspell: disable-next-line -type PrefetchedConstants = { totalShares: number; usdPerWeek: number; bondingDiscountMultiplier: BigNumber }; +type PrefetchedConstants = { totalShares: number; usdPerWeek: number; stakingDiscountMultiplier: BigNumber }; async function prefetchConstants(contracts: NonNullable): Promise { const contract = await contracts; const reserves = await contract.sushiPoolGovernanceDollarLp?.getReserves(); - const ubqPrice = +reserves[0].toString() / +reserves[1].toString(); - const ubqPerBlock = await contract.chefFacet?.governancePerBlock(); - const ubqMultiplier = await contract.chefFacet?.governanceMultiplier(); - const actualUbqPerBlock = toEtherNum(ubqPerBlock.mul(ubqMultiplier).div(`${1e18}`)); + const governancePrice = +reserves[0].toString() / +reserves[1].toString(); + const governancePerBlock = await contract.chefFacet?.governancePerBlock(); + const governanceMultiplier = await contract.chefFacet?.governanceMultiplier(); + const actualGovernancePerBlock = toEtherNum(governancePerBlock.mul(governanceMultiplier).div(`${1e18}`)); const blockCountInAWeek = toNum(await contract.stakingFacet?.blockCountInAWeek()); - const ubqPerWeek = actualUbqPerBlock * blockCountInAWeek; + const governancePerWeek = actualGovernancePerBlock * blockCountInAWeek; const totalShares = toEtherNum(await contract.chefFacet?.totalShares()); - const usdPerWeek = ubqPerWeek * ubqPrice; + const usdPerWeek = governancePerWeek * governancePrice; // cspell: disable-next-line - const bondingDiscountMultiplier = await contract.stakingFacet?.stakingDiscountMultiplier(); + const stakingDiscountMultiplier = await contract.stakingFacet?.stakingDiscountMultiplier(); // cspell: disable-next-line - return { totalShares, usdPerWeek, bondingDiscountMultiplier }; + return { totalShares, usdPerWeek, stakingDiscountMultiplier }; } async function calculateApyForWeeks(contracts: NonNullable, prefetch: PrefetchedConstants, weeksNum: number): Promise { const contract = await contracts; // cspell: disable-next-line - const { totalShares, usdPerWeek, bondingDiscountMultiplier } = prefetch; + const { totalShares, usdPerWeek, stakingDiscountMultiplier } = prefetch; const DAYS_IN_A_YEAR = 365.2422; const usdAsLp = 0.7460387929; // TODO: Get this number from the Curve contract const bigNumberOneUsdAsLp = ethers.utils.parseEther(usdAsLp.toString()); const weeks = BigNumber.from(weeksNum.toString()); // cspell: disable-next-line - const shares = toEtherNum(contract.stakingFormulasFacet?.durationMultiply(bigNumberOneUsdAsLp, weeks, bondingDiscountMultiplier)); + const shares = toEtherNum(contract.stakingFormulasFacet?.durationMultiply(bigNumberOneUsdAsLp, weeks, stakingDiscountMultiplier)); const rewardsPerWeek = (shares / totalShares) * usdPerWeek; const yearlyYield = (rewardsPerWeek / 7) * DAYS_IN_A_YEAR * 100; return Math.round(yearlyYield * 100) / 100; @@ -63,7 +63,7 @@ const DepositShare = ({ onStake, disabled, maxLp, protocolContracts: contracts } function validateAmount(): string | null { if (amount) { const amountBig = ethers.utils.parseEther(amount); - if (amountBig.gt(maxLp)) return `You don't have enough uAD-3CRV tokens`; + if (amountBig.gt(maxLp)) return `You don't have enough DOLLAR-3CRV tokens`; } return null; } @@ -116,10 +116,10 @@ const DepositShare = ({ onStake, disabled, maxLp, protocolContracts: contracts } return (
{/* cspell: disable-next-line */} -

Stake liquidity to receive UBQ

+

Stake liquidity to receive GOVERNANCE

APR {currentApy ? `${currentApy}%` : aprBounds ? `${aprBounds[1]}%` : "..."}
- + ) : // cspell: disable-next-line governanceToken.gt(0) ? ( - ) : null} @@ -313,7 +319,7 @@ const StakingShareRow = ({ id, governanceToken, stake, weeksLeft, disabled, onWi
{/* cspell: disable-next-line */} - {formatEther(governanceToken)} + {formatEther(governanceToken)}
{weeksLeft <= 0 ? "Ready" : {weeksLeft}w} diff --git a/packages/dapp/components/ui/icons.tsx b/packages/dapp/components/ui/icons.tsx index 440a4ecc6..45744aa1d 100644 --- a/packages/dapp/components/ui/icons.tsx +++ b/packages/dapp/components/ui/icons.tsx @@ -7,10 +7,10 @@ const base64s = {} as Record; base64s["help"] = b64svg.concat(btoa(renderToString(SVGs.help))); base64s["liquidity"] = b64svg.concat(btoa(renderToString(SVGs.liquidity))); -base64s["uad"] = b64svg.concat(btoa(renderToString(SVGs.uad))); -base64s["ubq"] = b64svg.concat(btoa(renderToString(SVGs.ubq))); -base64s["ucr-nft"] = b64svg.concat(btoa(renderToString(SVGs.ucr))); -base64s["ucr"] = b64svg.concat(btoa(renderToString(SVGs.ucr))); +base64s["dollar"] = b64svg.concat(btoa(renderToString(SVGs.dollar))); +base64s["governance"] = b64svg.concat(btoa(renderToString(SVGs.governance))); +base64s["credit-nft"] = b64svg.concat(btoa(renderToString(SVGs.creditNft))); +base64s["credit"] = b64svg.concat(btoa(renderToString(SVGs.credit))); base64s["usdc"] = b64svg.concat(btoa(renderToString(SVGs.usdc))); base64s["dai"] = b64svg.concat(btoa(renderToString(SVGs.dai))); base64s["usdt"] = b64svg.concat(btoa(renderToString(SVGs.usdt))); @@ -20,6 +20,6 @@ base64s[ "3crv" ] = `data:image/webp;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAIGNIUk0AAHomAACAhAAA+gAAAIDoAAB1MAAA6mAAADqYAAAXcJy6UTwAABRvSURBVHgBvcEJsJ5Xfd/x7/8851ne7W66Wm1J3hckzBI2m4ADDnUcKBBSCIwb6IQUpyRThjRAZ8xAaYcB2kKSQrFDmoZJa5OYEuJSUnYKMRgcwPEiyxaOLUu6EpLu1b26992e5znn/DrYzpgyhpoM7edj/F9c95VvOH79V3a2R4//vNpwlQva42G+Iw1Kqehmtt4p7GQWWeoU2T7rZt+pi2r/9GnnPfCtl7z81NuvuTby/4HxOE68+a/tCx8YMn3+73T5xl2vmKT4xialp7RQZTLzJnqggUTXzGYFuUHXSKWsSY6VQW4HkP963eHWekfv7gfe9AvH/uE1Nzb8P2L8kKtv/ZLdcOkLdeMlu3bpwLG3jerwqxtoMAFJyGPkJua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+it92ZnTvb65bGSHpyrPXrrkgu/8W1af0X/D8AF7mqbPyT8AAAAAElFTkSuQmCC`; export default { SVGs, base64s }; diff --git a/packages/dapp/components/ui/jsx-icons.tsx b/packages/dapp/components/ui/jsx-icons.tsx index 670271a0c..57bda98dc 100644 --- a/packages/dapp/components/ui/jsx-icons.tsx +++ b/packages/dapp/components/ui/jsx-icons.tsx @@ -1,10 +1,10 @@ export const jsxSvgIcons = { - ubq: ( + governance: ( ), - uad: ( + dollar: ( diff --git a/packages/dapp/components/ui/svgs.tsx b/packages/dapp/components/ui/svgs.tsx index 5b8c1d258..34de90ee0 100644 --- a/packages/dapp/components/ui/svgs.tsx +++ b/packages/dapp/components/ui/svgs.tsx @@ -15,7 +15,7 @@ export default { ), - uad: ( + dollar: ( ), - ubq: ( + governance: ( ), - ucr: ( + credit: ( ), - ucrNft: ( + creditNft: ( { return getContract(_IJar.abi, address, provider) as IJar; }; -export const getDebtCouponManagerContract = (address: string, provider: Provider) => { - return getContract(_DebtCouponManager.abi, address, provider) as CreditNftManagerFacet; +export const getCreditNftManagerContract = (address: string, provider: Provider) => { + return getContract(_CreditNftManager.abi, address, provider) as CreditNftManagerFacet; }; export const getCurveFactoryContract = (address: string, provider: Provider) => { @@ -123,12 +123,12 @@ export const getStakingShareContract = (address: string, provider: Provider) => return getContract(_StakingToken.abi, address, provider) as StakingShare; }; -export const getBondingV2Contract = (address: string, provider: Provider) => { +export const getStakingV2Contract = (address: string, provider: Provider) => { return getContract(_Staking.abi, address, provider) as StakingFacet; }; -export const getDebtCouponContract = (address: string, provider: Provider) => { - return getContract(_DebtCoupon.abi, address, provider) as CreditNft; +export const getCreditNftContract = (address: string, provider: Provider) => { + return getContract(_CreditNft.abi, address, provider) as CreditNft; }; export const getTWAPOracleContract = (address: string, provider: Provider) => { @@ -139,12 +139,12 @@ export const getDollarMintCalculatorContract = (address: string, provider: Provi return getContract(_DollarMintCalculator.abi, address, provider) as DollarMintCalculatorFacet; }; -export const getICouponsForDollarsCalculatorContract = (address: string, provider: Provider) => { - return getContract(_ICouponsForDollarsCalculator.abi, address, provider) as CreditNftRedemptionCalculatorFacet; +export const getCreditNftRedemptionCalculatorContract = (address: string, provider: Provider) => { + return getContract(_ICreditNftRedemptionCalculator.abi, address, provider) as CreditNftRedemptionCalculatorFacet; }; -export const getIUARForDollarsCalculatorContract = (address: string, provider: Provider) => { - return getContract(_IUARForDollarsCalculator.abi, address, provider) as CreditRedemptionCalculatorFacet; +export const getCreditRedemptionCalculatorContract = (address: string, provider: Provider) => { + return getContract(_ICreditRedemptionCalculator.abi, address, provider) as CreditRedemptionCalculatorFacet; }; export const getIMetaPoolContract = (address: string, provider: Provider) => { diff --git a/packages/dapp/components/utils/local-data.ts b/packages/dapp/components/utils/local-data.ts index 7418d2f97..b0c29ad43 100644 --- a/packages/dapp/components/utils/local-data.ts +++ b/packages/dapp/components/utils/local-data.ts @@ -1,9 +1,9 @@ import { ethers } from "ethers"; import { getUbiquityManagerContract, - getERC20Contract, - getDebtCouponContract, - getDebtCouponManagerContract, + // getERC20Contract, + getCreditNftContract, + getCreditNftManagerContract, getTWAPOracleContract, getDollarContract, } from "@/components/utils/contracts"; @@ -37,8 +37,8 @@ export async function fetchData() { // NFTAddress const NFTMinter = ethers.Wallet.createRandom().address; - const CreditNftFacet = getDebtCouponContract(await diamondContract.creditNftAddress(), provider); - const CreditNftManager = getDebtCouponManagerContract(diamondAddress, provider); + const CreditNftFacet = getCreditNftContract(await diamondContract.creditNftAddress(), provider); + const CreditNftManager = getCreditNftManagerContract(diamondAddress, provider); const TWAPOracle = getTWAPOracleContract(await diamondContract.twapOracleAddress(), provider); { diff --git a/packages/dapp/pages/credit-nft.tsx b/packages/dapp/pages/credit-nft.tsx new file mode 100644 index 000000000..6e269fd85 --- /dev/null +++ b/packages/dapp/pages/credit-nft.tsx @@ -0,0 +1,10 @@ +import { FC } from "react"; +import CreditNft from "@/components/redeem/credit-nft"; +import useWalletAddress from "@/components/lib/hooks/use-wallet-address"; + +const CreditNftPage: FC = (): JSX.Element => { + const [walletAddress] = useWalletAddress(); + return
{walletAddress && }
; +}; + +export default CreditNftPage; diff --git a/packages/dapp/pages/credits.tsx b/packages/dapp/pages/credits.tsx index c5cf19de5..898a728b9 100644 --- a/packages/dapp/pages/credits.tsx +++ b/packages/dapp/pages/credits.tsx @@ -1,8 +1,8 @@ import { FC, useState } from "react"; 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 CreditRedeem from "@/components/redeem/credit-redeem"; +import CreditNftGenerator from "@/components/redeem/credit-nft-deposit"; +import CreditNftRedeem from "@/components/redeem/credit-nft-redeem"; 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"; @@ -29,16 +29,16 @@ const PriceStabilization: FC = (): JSX.Element => {
-
+

Generate Ubiquity Credit NFTs

- +
-
+

Redeem Ubiquity Credits

- - + +
diff --git a/packages/dapp/pages/debt-coupon.tsx b/packages/dapp/pages/debt-coupon.tsx deleted file mode 100644 index 9185c7927..000000000 --- a/packages/dapp/pages/debt-coupon.tsx +++ /dev/null @@ -1,10 +0,0 @@ -import { FC } from "react"; -import DebtCoupon from "@/components/redeem/debt-coupon"; -import useWalletAddress from "@/components/lib/hooks/use-wallet-address"; - -const DebtCouponPage: FC = (): JSX.Element => { - const [walletAddress] = useWalletAddress(); - return
{walletAddress && }
; -}; - -export default DebtCouponPage; diff --git a/packages/dapp/pages/markets.tsx b/packages/dapp/pages/markets.tsx index 3b5227e8c..73bcbf1ea 100644 --- a/packages/dapp/pages/markets.tsx +++ b/packages/dapp/pages/markets.tsx @@ -18,7 +18,7 @@ const Markets: FC = (): JSX.Element => {
- + LP @@ -28,7 +28,7 @@ const Markets: FC = (): JSX.Element => {
{/* cspell: disable-next-line */} - + LP diff --git a/packages/dapp/pages/styles/queries.css b/packages/dapp/pages/styles/queries.css index a50c6659b..afb9fb3b2 100644 --- a/packages/dapp/pages/styles/queries.css +++ b/packages/dapp/pages/styles/queries.css @@ -127,4 +127,7 @@ #Staking > tbody > tr > td:nth-child(4) { display: none; } + #Inventory { + bottom: 0; + } } diff --git a/packages/dapp/pages/styles/ubiquity.css b/packages/dapp/pages/styles/ubiquity.css index b3e2b00c0..92aea35f7 100644 --- a/packages/dapp/pages/styles/ubiquity.css +++ b/packages/dapp/pages/styles/ubiquity.css @@ -179,7 +179,7 @@ video { text-align: center; position: absolute; left: 0; - bottom: 0; + bottom: 32px; width: 100%; } #Inventory > div:nth-child(2) > div > div > div { @@ -566,23 +566,23 @@ td { aside { color: #bfbfbf; } -#MintUcr, -#RedeemUcr { +#MintCredit, +#RedeemCredit { opacity: 0.25; cursor: not-allowed; } -#MintUcr > div, -#RedeemUcr > div { +#MintCredit > div, +#RedeemCredit > div { pointer-events: none; } -#CreditOperations[data-twap^="0."] #MintUcr, -#CreditOperations[data-twap^="1."] #RedeemUcr { +#CreditOperations[data-twap^="0."] #MintCredit, +#CreditOperations[data-twap^="1."] #RedeemCredit { opacity: 1; display: inline-block; cursor: unset; } -#CreditOperations[data-twap^="0."] #MintUcr > div, -#CreditOperations[data-twap^="1."] #RedeemUcr > div { +#CreditOperations[data-twap^="0."] #MintCredit > div, +#CreditOperations[data-twap^="1."] #RedeemCredit > div { pointer-events: unset; } #Page404 {