Skip to content

Commit

Permalink
feat: add stable / lst filter options
Browse files Browse the repository at this point in the history
  • Loading branch information
chambaz committed Nov 24, 2023
1 parent 09223ce commit 7be2e17
Show file tree
Hide file tree
Showing 5 changed files with 216 additions and 196 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ export const AssetListFilters = () => {
<SelectContent>
<SelectItem value="all">All pools</SelectItem>
<SelectItem value="isolated">Isolated pools</SelectItem>
<SelectItem value="stable">Stablecoins</SelectItem>
<SelectItem value="lst">LSTs</SelectItem>
</SelectContent>
</Select>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { ExtendedBankInfo, Emissions } from "@mrgnlabs/marginfi-v2-ui-state";
import type { sortDirection } from "~/types";

export const STABLECOINS = ["USDC", "USDT", "UXD"];

export const LSTS = ["LST", "stSOL", "jitoSOL", "bSOL", "mSOL"];

export const sortApRate = (banks: ExtendedBankInfo[], isInLendingMode: boolean, direction: sortDirection) => {
return banks.sort((a, b) => {
const apRateA =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@ export const NewAssetBanner = ({ asset, image }: NewAssetBannerProps) => {

const deposit = React.useCallback(() => {
setLendingMode(LendingModes.LEND);
if (poolFilter === PoolTypes.ALL) setPoolFilter(PoolTypes.ALL);
if (poolFilter !== PoolTypes.ALL) setPoolFilter(PoolTypes.ALL);
setIsFilteredUserPositions(false);
setTimeout(() => highlightAsset(), 100);
}, [setLendingMode, poolFilter, setPoolFilter, asset, setIsFilteredUserPositions, highlightAsset]);

const borrow = React.useCallback(() => {
setLendingMode(LendingModes.BORROW);
if (poolFilter === PoolTypes.ALL) setPoolFilter(PoolTypes.ALL);
if (poolFilter !== PoolTypes.ALL) setPoolFilter(PoolTypes.ALL);
setIsFilteredUserPositions(false);
setTimeout(() => highlightAsset(), 100);
}, [setLendingMode, poolFilter, setPoolFilter, asset, setIsFilteredUserPositions, highlightAsset]);
Expand Down
Loading

0 comments on commit 7be2e17

Please sign in to comment.