Skip to content

Commit

Permalink
Merge pull request #164 from blend-capital/block-list
Browse files Browse the repository at this point in the history
BlockedPools
  • Loading branch information
Ryang-21 authored Oct 28, 2024
2 parents 7ba05ce + 9ca7852 commit d8f4abb
Show file tree
Hide file tree
Showing 9 changed files with 42 additions and 26 deletions.
3 changes: 2 additions & 1 deletion .env.production
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ NEXT_PUBLIC_HORIZON_URL=https://horizon.stellar.org
NEXT_PUBLIC_PASSPHRASE=Public Global Stellar Network ; September 2015
NEXT_PUBLIC_BACKSTOP=CAO3AGAMZVRMHITL36EJ2VZQWKYRPWMQAPDQD5YEOF3GIF7T44U4JAL3
NEXT_PUBLIC_USDC_ISSUER=GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN
NEXT_PUBLIC_BLND_ISSUER=GDJEHTBE6ZHUXSWFI642DCGLUOECLHPF3KSXHPXTSTJ7E3JF6MQ5EZYY
NEXT_PUBLIC_BLND_ISSUER=GDJEHTBE6ZHUXSWFI642DCGLUOECLHPF3KSXHPXTSTJ7E3JF6MQ5EZYY
NEXT_PUBLIC_BLOCKED_POOLS='CBVOPI6QC6OWVCOEZDCFELAGQNAOHUS4CWOKAVADKQZXVSWR2R5IAKO7'
3 changes: 2 additions & 1 deletion .env.testnet
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ NEXT_PUBLIC_HORIZON_URL=https://horizon-testnet.stellar.org
NEXT_PUBLIC_PASSPHRASE=Test SDF Network ; September 2015
NEXT_PUBLIC_BACKSTOP=CDJQJS3TLZ6LEWSBOZ2E6QEZZ4NS3JU5LDT2BT7A4UHWAXPLSNE6MM37
NEXT_PUBLIC_USDC_ISSUER=GATALTGTWIOT6BUDBCZM3Q4OQ4BO2COLOAZ7IYSKPLC2PMSOPPGF5V56
NEXT_PUBLIC_BLND_ISSUER=GATALTGTWIOT6BUDBCZM3Q4OQ4BO2COLOAZ7IYSKPLC2PMSOPPGF5V56
NEXT_PUBLIC_BLND_ISSUER=GATALTGTWIOT6BUDBCZM3Q4OQ4BO2COLOAZ7IYSKPLC2PMSOPPGF5V56
NEXT_PUBLIC_BLOCKED_POOLS=''
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "blend-ui",
"version": "1.1.4",
"version": "1.1.5",
"private": true,
"type": "module",
"scripts": {
Expand Down
15 changes: 9 additions & 6 deletions src/components/pool/PoolMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { PoolHeader } from './PoolHeader';
export const PoolMenu: React.FC<PoolComponentProps> = ({ poolId }) => {
const theme = useTheme();
const router = useRouter();
const { trackedPools } = useSettings();
const { trackedPools, blockedPools } = useSettings();
const pathname = router.pathname;

const [anchorEl, setAnchorEl] = React.useState<null | HTMLElement>(null);
Expand Down Expand Up @@ -52,11 +52,14 @@ export const PoolMenu: React.FC<PoolComponentProps> = ({ poolId }) => {
}}
>
{trackedPools.length > 0 &&
Array.from(trackedPools.values()).map((pool) => (
<MenuItem onClick={() => handleClickMenuItem(pool.id)} key={pool.id}>
<PoolHeader name={pool.name} />
</MenuItem>
))}
Array.from(trackedPools.values()).map((pool) => {
if (!blockedPools.includes(pool.id))
return (
<MenuItem onClick={() => handleClickMenuItem(pool.id)} key={pool.id}>
<PoolHeader name={pool.name} />
</MenuItem>
);
})}
</Menu>
</>
);
Expand Down
9 changes: 3 additions & 6 deletions src/components/withdraw/WithdrawAnvil.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import { TxOverview } from '../common/TxOverview';
import { toUSDBalance } from '../common/USDBalance';
import { Value } from '../common/Value';
import { ValueChange } from '../common/ValueChange';
import { PoolOracleError } from '../pool/PoolOracleErrorBanner';

export const WithdrawAnvil: React.FC<ReserveComponentProps> = ({ poolId, assetId }) => {
const theme = useTheme();
Expand Down Expand Up @@ -128,20 +127,18 @@ export const WithdrawAnvil: React.FC<ReserveComponentProps> = ({ poolId, assetId
if (pool === undefined || reserve === undefined) {
return <Skeleton />;
}
if (poolOracle === undefined) {
return <PoolOracleError />;
}

const curPositionsEstimate =
pool && poolOracle && poolUser
? PositionsEstimate.build(pool, poolOracle, poolUser.positions)
: undefined;
const newPoolUser = parsedSimResult && new PoolUser(walletAddress, parsedSimResult, new Map());
const newPositionsEstimate =
pool && parsedSimResult
pool && parsedSimResult && poolOracle
? PositionsEstimate.build(pool, poolOracle, parsedSimResult)
: undefined;

const assetToBase = poolOracle.getPriceFloat(assetId);
const assetToBase = poolOracle?.getPriceFloat(assetId);

const curBorrowCap = curPositionsEstimate?.borrowCap;
const nextBorrowCap = newPositionsEstimate?.borrowCap;
Expand Down
5 changes: 5 additions & 0 deletions src/contexts/settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export interface ISettingsContext {
setShowLend: (showLend: boolean) => void;
showJoinPool: boolean;
setShowJoinPool: (showJoinPool: boolean) => void;
blockedPools: string[];
}

const SettingsContext = React.createContext<ISettingsContext | undefined>(undefined);
Expand All @@ -60,6 +61,9 @@ export const SettingsProvider = ({ children = null as any }) => {
);

const trackedPools = JSON.parse(trackedPoolsString || '[]') as TrackedPool[];
const [blockedPools, setBlockedPools] = useState<string[]>(
(process.env.NEXT_PUBLIC_BLOCKED_POOLS || '').split(',')
);

let viewType: ViewType;
if (mobile) viewType = ViewType.MOBILE;
Expand Down Expand Up @@ -105,6 +109,7 @@ export const SettingsProvider = ({ children = null as any }) => {
setShowLend,
showJoinPool,
setShowJoinPool,
blockedPools,
}}
>
{children}
Expand Down
6 changes: 5 additions & 1 deletion src/pages/backstop-token.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,11 @@ const BackstopToken: NextPage = () => {
width={viewType === ViewType.REGULAR ? SectionSize.THIRD : SectionSize.TILE}
sx={{ alignItems: 'center', justifyContent: 'flex-start', padding: '12px' }}
>
<Icon src={'/icons/tokens/usdc.svg'} alt={`usdc icon`} sx={{ marginRight: '12px' }} />
<Icon
src={'https://www.centre.io/images/usdc/usdc-icon-86074d9d49.png'}
alt={`usdc icon`}
sx={{ marginRight: '12px' }}
/>
<StackedText
title="Your USDC Balance"
titleColor="inherit"
Expand Down
21 changes: 13 additions & 8 deletions src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ import { Divider } from '../components/common/Divider';
import { Row } from '../components/common/Row';
import { SectionBase } from '../components/common/SectionBase';
import { MarketCard } from '../components/markets/MarketCard';
import { useSettings } from '../contexts';
import { useBackstop } from '../hooks/api';

const Markets: NextPage = () => {
const { data: backstop } = useBackstop();

const [currentIndex, setCurrentIndex] = useState(0);
const { blockedPools } = useSettings();

const rewardZone = [...(backstop?.config?.rewardZone ?? [])].reverse();

Expand All @@ -27,14 +29,17 @@ const Markets: NextPage = () => {
</SectionBase>
</Row>
<Divider />
{rewardZone.slice(0, currentIndex + 1).map((poolId, index) => (
<MarketCard
key={poolId}
poolId={poolId}
index={index}
onLoaded={handlePoolLoaded}
></MarketCard>
))}
{rewardZone.slice(0, currentIndex + 1).map((poolId, index) => {
if (!blockedPools.includes(poolId))
return (
<MarketCard
key={poolId}
poolId={poolId}
index={index}
onLoaded={handlePoolLoaded}
></MarketCard>
);
})}
</>
);
};
Expand Down

1 comment on commit d8f4abb

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit was deployed on ipfs

Please sign in to comment.