diff --git a/src/constants/addresses.ts b/src/constants/addresses.ts
index f84ea1a72..77d209dae 100644
--- a/src/constants/addresses.ts
+++ b/src/constants/addresses.ts
@@ -52,6 +52,11 @@ export const DAI_ADDRESSES = {
[NetworkId.MAINNET]: "0x6b175474e89094c44da98b954eedeac495271d0f",
};
+export const USDS_ADDRESSES = {
+ [NetworkId.MAINNET]: "0xdC035D45d973E3EC169d2276DDab16f1e407384F",
+ [NetworkId.TESTNET_GOERLI]: "",
+};
+
export const WETH_ADDRESSES = {
[NetworkId.MAINNET]: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
};
@@ -142,7 +147,7 @@ export const BALANCER_VAULT_ADDRESSSES = {
};
export const RANGE_OPERATOR_ADDRESSES = {
- [NetworkId.MAINNET]: "0x0AE561226896dA978EaDA0Bec4a7d3CfAE04f506",
+ [NetworkId.MAINNET]: "0x6417F206a0a6628Da136C0Faa39026d0134D2b52",
[NetworkId.TESTNET_GOERLI]: "0x6620592f9bdffAbadcea644a35946E7b93EaaF56",
};
diff --git a/src/views/Range/RangeConfirmationModal.tsx b/src/views/Range/RangeConfirmationModal.tsx
index 48e3db11e..3d021858a 100644
--- a/src/views/Range/RangeConfirmationModal.tsx
+++ b/src/views/Range/RangeConfirmationModal.tsx
@@ -84,7 +84,9 @@ const RangeConfirmationModal = (props: {
Price of OHM
- {props.swapPrice} DAI
+
+ {props.swapPrice} {props.reserveSymbol}
+
diff --git a/src/views/Range/RangeInputForm.tsx b/src/views/Range/RangeInputForm.tsx
index 034165226..afbe3026b 100644
--- a/src/views/Range/RangeInputForm.tsx
+++ b/src/views/Range/RangeInputForm.tsx
@@ -1,9 +1,9 @@
-import { Box } from "@mui/material";
+import { Box, SvgIcon } from "@mui/material";
import { SwapCollection } from "@olympusdao/component-library";
import { OHMTokenProps, SwapCard } from "@olympusdao/component-library";
import React from "react";
+import usdsIcon from "src/assets/tokens/usds.svg?react";
import { DecimalBigNumber } from "src/helpers/DecimalBigNumber/DecimalBigNumber";
-
/**
* Component for Displaying RangeInputForm
*/
@@ -36,22 +36,33 @@ const RangeInputForm = (props: {
const trimmedOhmBalance = ohmBalance.toString({ decimals: 2 });
const trimmedReserveBalance = reserveBalance.toString({ decimals: 2 });
- const ReserveInput = () => (
- onChangeReserveAmount(event.currentTarget.value)}
- endString={`Max`}
- endStringOnClick={() => hasPrice && onChangeReserveAmount(reserveBalance.toString())}
- token={reserveSymbol}
- type="string"
- info={`Balance: ${trimmedReserveBalance} ${reserveSymbol}`}
- disabled={!hasPrice}
- />
- );
+ const ReserveInput = () => {
+ const token =
+ reserveSymbol === ("USDS" as OHMTokenProps["name"]) ? (
+
+
+ USDS
+
+ ) : (
+ reserveSymbol
+ );
+ return (
+ onChangeReserveAmount(event.currentTarget.value)}
+ endString={`Max`}
+ endStringOnClick={() => hasPrice && onChangeReserveAmount(reserveBalance.toString())}
+ token={token}
+ type="string"
+ info={`Balance: ${trimmedReserveBalance} ${reserveSymbol}`}
+ disabled={!hasPrice}
+ />
+ );
+ };
const OhmInput = () => (
{
*/
export const OperatorReserveSymbol = () => {
const networks = useTestableNetworks();
- const contract = RANGE_CONTRACT.getEthersContract(networks.MAINNET);
+ const contract = RANGE_OPERATOR_CONTRACT.getEthersContract(networks.MAINNET);
const {
data = { symbol: "", reserveAddress: "" },
isFetched,
@@ -445,3 +445,13 @@ export const RangeNextBeat = () => {
});
return { data, isFetched, isLoading };
};
+
+export const useRangeCheckActive = () => {
+ const networks = useTestableNetworks();
+ const contract = RANGE_OPERATOR_CONTRACT.getEthersContract(networks.MAINNET);
+ const { data, isFetched, isLoading } = useQuery(["getRangeCheckActive", networks.MAINNET], async () => {
+ const active = await contract.active();
+ return active;
+ });
+ return { data, isFetched, isLoading };
+};
diff --git a/src/views/Range/index.tsx b/src/views/Range/index.tsx
index fbfc77fb4..430a79939 100644
--- a/src/views/Range/index.tsx
+++ b/src/views/Range/index.tsx
@@ -13,7 +13,7 @@ import { useNavigate } from "react-router-dom";
import { Link as RouterLink } from "react-router-dom";
import PageTitle from "src/components/PageTitle";
import { WalletConnectedGuard } from "src/components/WalletConnectedGuard";
-import { DAI_ADDRESSES, OHM_ADDRESSES } from "src/constants/addresses";
+import { OHM_ADDRESSES, USDS_ADDRESSES } from "src/constants/addresses";
import { formatNumber, parseBigNumber } from "src/helpers";
import CountdownTimer from "src/helpers/CountdownTimer";
import { DecimalBigNumber } from "src/helpers/DecimalBigNumber/DecimalBigNumber";
@@ -29,6 +29,7 @@ import {
RangeBondMaxPayout,
RangeData,
RangeNextBeat,
+ useRangeCheckActive,
} from "src/views/Range/hooks";
import RangeChart from "src/views/Range/RangeChart";
import RangeConfirmationModal from "src/views/Range/RangeConfirmationModal";
@@ -46,6 +47,7 @@ export const Range = () => {
const networks = useTestableNetworks();
const { chain = { id: 1 } } = useNetwork();
const { data: rangeData, isLoading: rangeDataLoading } = RangeData();
+ const { data: isActive } = useRangeCheckActive();
usePathForNetwork({ pathName: "range", networkID: chain.id, navigate });
const {
@@ -58,19 +60,19 @@ export const Range = () => {
const [reserveAmount, setReserveAmount] = useState("");
const [ohmAmount, setOhmAmount] = useState("");
- const { data: reserveBalance = new DecimalBigNumber("0", 18) } = useBalance(DAI_ADDRESSES)[networks.MAINNET];
+ const { data: reserveBalance = new DecimalBigNumber("0", 18) } = useBalance(USDS_ADDRESSES)[networks.MAINNET];
const { data: ohmBalance = new DecimalBigNumber("0", 9) } = useBalance(OHM_ADDRESSES)[networks.MAINNET];
const { data: currentPrice } = OperatorPrice();
const { data: lastPrice } = LastSnapshotPrice();
const { data: currentMarketPrices } = useGetDefillamaPrice({
- addresses: [DAI_ADDRESSES[1], OHM_ADDRESSES[1]],
+ addresses: [USDS_ADDRESSES[1], OHM_ADDRESSES[1]],
});
const { data: nextBeat } = RangeNextBeat();
- const daiPriceUSD = currentMarketPrices?.[`ethereum:${DAI_ADDRESSES[1]}`].price;
+ const usdsPriceUSD = currentMarketPrices?.[`ethereum:${USDS_ADDRESSES[1]}`].price;
const ohmPriceUSD = currentMarketPrices?.[`ethereum:${OHM_ADDRESSES[1]}`].price;
- const marketOhmPriceDAI = daiPriceUSD && ohmPriceUSD ? ohmPriceUSD / daiPriceUSD : undefined;
+ const marketOhmPriceUSDS = usdsPriceUSD && ohmPriceUSD ? ohmPriceUSD / usdsPriceUSD : undefined;
const maxString = sellActive ? `Max You Can Sell` : `Max You Can Buy`;
@@ -112,12 +114,12 @@ export const Range = () => {
// Set sell active if market price is defined and is below lower cushion OR if there is a active lower bond market.
useEffect(() => {
if (
- (marketOhmPriceDAI && marketOhmPriceDAI < parseBigNumber(rangeData.low.cushion.price, 18)) ||
+ (marketOhmPriceUSDS && marketOhmPriceUSDS < parseBigNumber(rangeData.low.cushion.price, 18)) ||
bidPrice.activeBondMarket
) {
setSellActive(true);
}
- }, [rangeData.low.cushion.price, marketOhmPriceDAI]);
+ }, [rangeData.low.cushion.price, marketOhmPriceUSDS]);
const maxBalanceString = `${formatNumber(maxCapacity, 2)} ${buyAsset} (${formatNumber(
sellActive ? maxCapacity / bidPrice.price : maxCapacity * askPrice.price,
@@ -146,7 +148,9 @@ export const Range = () => {
const swapPriceFormatted = formatNumber(swapPrice, 2);
const discount =
- (marketOhmPriceDAI && (marketOhmPriceDAI - swapPrice) / (sellActive ? -marketOhmPriceDAI : marketOhmPriceDAI)) || 0;
+ (marketOhmPriceUSDS &&
+ (marketOhmPriceUSDS - swapPrice) / (sellActive ? -marketOhmPriceUSDS : marketOhmPriceUSDS)) ||
+ 0;
const hasPrice = (sellActive && askPrice.price) || (!sellActive && bidPrice.price) ? true : false;
@@ -164,7 +168,7 @@ export const Range = () => {
name="Range Bound Stability"
subtitle={
- Swap DAI or OHM directly with the treasury.{" "}
+ Swap ${reserveSymbol} or OHM directly with the treasury.{" "}
{
<>
@@ -232,6 +236,13 @@ export const Range = () => {
)}
+ {!isActive && (
+
+
+ RBS Operator is currently inactive
+
+
+ )}