Skip to content

Commit

Permalink
Merge pull request #10940 from AugurProject/bruno/removing-dead-code
Browse files Browse the repository at this point in the history
Bruno/removing dead code
  • Loading branch information
JohnDanz authored Mar 30, 2021
2 parents 23dcd4f + 693b248 commit 374366d
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 253 deletions.
4 changes: 2 additions & 2 deletions packages/augur-comps/src/components/common/icons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -629,8 +629,8 @@ export const ChevronFlipIcon = (
fill="none"
>
<path
fill-rule="evenodd"
clip-rule="evenodd"
fillRule="evenodd"
clipRule="evenodd"
d="M4.11612 6.61612C4.60427 6.12796 5.39573 6.12796 5.88388 6.61612L10 10.7322L14.1161 6.61612C14.6043 6.12796 15.3957 6.12796 15.8839 6.61612C16.372 7.10427 16.372 7.89573 15.8839 8.38388L10.8839 13.3839C10.3957 13.872 9.60427 13.872 9.11612 13.3839L4.11612 8.38388C3.62796 7.89573 3.62796 7.10427 4.11612 6.61612Z"
fill="#8B959E"
/>
Expand Down
12 changes: 2 additions & 10 deletions packages/augur-simplified/src/modules/common/charts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,6 @@ export const PriceHistoryChart = ({
cash,
}) => {
const container = useRef(null);
// eslint-disable-next-line
const [forceRender, setForceRender] = useState(false);
const { maxPriceBigNumber: maxPrice, minPriceBigNumber: minPrice } = market;
const { priceTimeArray } = processPriceTimeData(
formattedOutcomes,
Expand Down Expand Up @@ -235,15 +233,9 @@ export const PriceHistoryChart = ({
}, [selectedOutcomes, options, priceTimeArray]);

useEffect(() => {
// set no data chart and cleanup chart on dismount
const chartContainer = container.current;
NoDataToDisplay(Highcharts);
const chart: HighcartsChart = Highcharts.charts.find(
(chart: HighcartsChart) => chart?.renderTo === chartContainer
);
if (!chart || chart?.renderTo !== chartContainer) {
// needs to be done because container ref is null on first load.
setForceRender(true);
}
NoDataToDisplay(Highcharts);
return () => {
Highcharts.charts
.find((chart: HighcartsChart) => chart?.renderTo === chartContainer)
Expand Down
6 changes: 3 additions & 3 deletions packages/augur-simplified/src/modules/common/tables.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ export const PositionFooter = ({
if (canClaimETH || !isETHClaim) {
setPendingClaim(true);
claimWinnings(account, [marketId], amm?.cash)
.then((response) => {
.then(response => {
// handle transaction response here
setPendingClaim(false);
if (response) {
Expand All @@ -204,9 +204,9 @@ export const PositionFooter = ({
});
}
})
.catch((e) => {
.catch(error => {
setPendingClaim(false);
// handle error here
console.log('Error when trying to claim winnings: ', error?.message);
});
} else {
// need to approve here
Expand Down
62 changes: 2 additions & 60 deletions packages/augur-simplified/src/modules/constants.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
import { MarketTypeName } from '@augurproject/sdk-lite';
import { Icons, createBigNumber } from '@augurproject/augur-comps';
const {
EthIcon,
UsdIcon,
CryptoIcon,
EntertainmentIcon,
FinanceIcon,
MedicalIcon,
PoliticsIcon,
SportsIcon,
} = Icons;
import { createBigNumber } from '@augurproject/augur-comps';

// # Market Types
export const YES_NO = MarketTypeName.YesNo;
export const CATEGORICAL = MarketTypeName.Categorical;
Expand All @@ -20,24 +11,13 @@ export const MARKET = 'market';
export const MARKETS = 'markets';
export const PORTFOLIO = 'portfolio';

export const YES_NO_OUTCOMES_NAMES = ['Invalid', 'No', 'Yes'];
// QUERY_PARAMS
export const MARKET_ID_PARAM_NAME = 'id';
export const AFFILIATE_NAME = 'r';
export const THEME_NAME = 't';

export const OUTCOME_YES_NAME = 'Yes';
export const OUTCOME_NO_NAME = 'No';
export const OUTCOME_INVALID_NAME = 'Invalid';

// Directions
export const BUY = 'buy';
export const SELL = 'sell';

export const ADD_LIQUIDITY = 'add liquidity';

export const ETHER = createBigNumber(10).pow(18);
export const GWEI_CONVERSION = 1000000000;
export const TEN = createBigNumber(10, 10);
export const ZERO = createBigNumber(0);
export const ONE = createBigNumber(1);
Expand All @@ -46,10 +26,6 @@ export const THOUSAND = createBigNumber(1000);
export const MILLION = THOUSAND.times(THOUSAND);
export const BILLION = MILLION.times(THOUSAND);
export const TRILLION = BILLION.times(THOUSAND);
export const DAYS_IN_YEAR = createBigNumber(365);
export const SEC_IN_DAY = createBigNumber(86400);
export const PORTION_OF_INVALID_POOL_SELL = createBigNumber(0.5);
export const PORTION_OF_CASH_INVALID_POOL = createBigNumber(0.1);

// # Asset Types
export const ETH = 'ETH';
Expand All @@ -60,12 +36,6 @@ export const USDC = 'USDC';
export const SHARES = 'SHARES';
export const ALL_CURRENCIES = 'All Currencies';

export const CASH_LABEL_FORMATS = {
ETH: { symbol: 'Ξ', prepend: true, displayDecimals: 4, icon: EthIcon },
USDC: { symbol: '$', prepend: true, displayDecimals: 2, icon: UsdIcon },
SHARES: { symbol: '', prepend: true, displayDecimals: 4, icon: null },
};

// Portfolio table views
export const POSITIONS = 'positions';
export const LIQUIDITY = 'liquidity';
Expand All @@ -85,50 +55,22 @@ export const ALL_MARKETS = 'all markets';

// sub categories
export const COVID = 'covid-19';
export const ELECTORAL_COLLEGE = 'electoral college';
export const FEDERAL_FUNDS = 'federal funds';
export const REPUSD = 'REP USD';
export const PRESIDENTIAL_ELECTION = 'electoral college';

export const POPULAR_CATEGORIES_ICONS = {
[MEDICAL]: MedicalIcon,
[POLITICS]: PoliticsIcon,
[CRYPTO]: CryptoIcon,
[FINANCE]: FinanceIcon,
[SPORTS]: SportsIcon,
[ENTERTAINMENT]: EntertainmentIcon,
};

// side bar types
export const NAVIGATION = 'NAVIGATION';
export const FILTERS = 'FILTERS';

export const SIDEBAR_TYPES = {
[NAVIGATION]: NAVIGATION,
[FILTERS]: FILTERS,
};

// transaction types
export const ALL = 'all';
export const SWAP = 'swap';
export const ADD = 'add';
export const REMOVE = 'remove';

export const INVALID_OUTCOME_ID = 0;
export const NO_OUTCOME_ID = 1;
export const YES_OUTCOME_ID = 2;

export const OPEN = 'Open';
export const IN_SETTLEMENT = 'In settlement';
export const RESOLVED = 'Resolved';

export const INSUFFICIENT_LIQUIDITY = 'Insufficent Liquidity';
export const INSUFFICIENT_BALANCE = 'Insufficent Balance';
export const OVER_SLIPPAGE = 'Over Slippage Tolerance';
export const ENTER_AMOUNT = 'Enter Amount';
export const ERROR_AMOUNT = 'Amount is not valid';
export const CONNECT_ACCOUNT = 'Connect Account';
export const SET_PRICES = 'Set Prices';

export const SETTINGS_SLIPPAGE = '2';
// graph market status
Expand Down
6 changes: 3 additions & 3 deletions packages/augur-simplified/src/modules/market/trading-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ const TradingForm = ({
outputYesShares,
userBalances
)
.then((response) => {
.then(response => {
if (response) {
const { hash } = response;
setAmount('');
Expand All @@ -379,9 +379,9 @@ const TradingForm = ({
});
}
})
.catch((e) => {
//TODO: handle errors here
.catch(error => {
setWaitingToSign(false);
console.log('Error when trying to trade: ', error?.message);
});
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ const ModalAddLiquidity = ({
return setBreakdown(defaultAddLiquidityBreakdown);
}
async function getResults() {
let results = defaultAddLiquidityBreakdown;
let results: LiquidityBreakdown;
if (isRemove) {
results = await getRemoveLiquidity(
properties.marketId,
Expand Down Expand Up @@ -409,8 +409,8 @@ const ModalAddLiquidity = ({
marketDescription: market.description,
});
})
.catch((e) => {
//TODO: handle errors here
.catch(error => {
console.log('Error when trying to remove AMM liquidity: ', error?.message);
});
} else {
await doAmmLiquidity(
Expand All @@ -427,7 +427,7 @@ const ModalAddLiquidity = ({
properties.priceYes,
properties.symbolRoot
)
.then((response) => {
.then(response => {
const { hash } = response;
addTransaction({
hash,
Expand All @@ -440,8 +440,8 @@ const ModalAddLiquidity = ({
marketDescription: market.description,
});
})
.catch((e) => {
// TODO: handle error
.catch(error => {
console.log('Error when trying to add AMM liquidity: ', error?.message);
});
}
closeModal();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ const handleClaimAll = (
if (from && canClaim) {
setPendingClaim(true);
claimWinnings(from, marketIds, cash)
.then((response) => {
.then(response => {
// handle transaction response here
setPendingClaim(false);
if (response) {
Expand All @@ -86,9 +86,9 @@ const handleClaimAll = (
});
}
})
.catch((e) => {
.catch(error => {
setPendingClaim(false);
// handle error here
console.log('Error when trying to claim winnings: ', error?.message);
});
} else if (from) {
const approveEth = async () => {
Expand Down
16 changes: 0 additions & 16 deletions packages/augur-simplified/src/modules/stores/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,3 @@ export const SIMPLIFIED_ACTIONS = {
UPDATE_MARKETS_VIEW_SETTINGS: 'UPDATE_MARKETS_VIEW_SETTINGS',
UPDATE_SETTINGS: 'UPDATE_SETTINGS',
};

export const NETWORK_NAMES = {
1: 'Mainnet',
3: 'Ropsten',
4: 'Rinkeby',
5: 'Goerli',
42: 'Kovan'
};

export const NETWORK_BLOCK_REFRESH_TIME = {
1: 15000,
3: 5000,
4: 5000,
5: 5000,
42: 5000,
};
Loading

0 comments on commit 374366d

Please sign in to comment.