Skip to content

Commit 374366d

Browse files
authored
Merge pull request #10940 from AugurProject/bruno/removing-dead-code
Bruno/removing dead code
2 parents 23dcd4f + 693b248 commit 374366d

File tree

9 files changed

+32
-253
lines changed

9 files changed

+32
-253
lines changed

packages/augur-comps/src/components/common/icons.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -629,8 +629,8 @@ export const ChevronFlipIcon = (
629629
fill="none"
630630
>
631631
<path
632-
fill-rule="evenodd"
633-
clip-rule="evenodd"
632+
fillRule="evenodd"
633+
clipRule="evenodd"
634634
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"
635635
fill="#8B959E"
636636
/>

packages/augur-simplified/src/modules/common/charts.tsx

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,6 @@ export const PriceHistoryChart = ({
188188
cash,
189189
}) => {
190190
const container = useRef(null);
191-
// eslint-disable-next-line
192-
const [forceRender, setForceRender] = useState(false);
193191
const { maxPriceBigNumber: maxPrice, minPriceBigNumber: minPrice } = market;
194192
const { priceTimeArray } = processPriceTimeData(
195193
formattedOutcomes,
@@ -235,15 +233,9 @@ export const PriceHistoryChart = ({
235233
}, [selectedOutcomes, options, priceTimeArray]);
236234

237235
useEffect(() => {
236+
// set no data chart and cleanup chart on dismount
238237
const chartContainer = container.current;
239-
NoDataToDisplay(Highcharts);
240-
const chart: HighcartsChart = Highcharts.charts.find(
241-
(chart: HighcartsChart) => chart?.renderTo === chartContainer
242-
);
243-
if (!chart || chart?.renderTo !== chartContainer) {
244-
// needs to be done because container ref is null on first load.
245-
setForceRender(true);
246-
}
238+
NoDataToDisplay(Highcharts);
247239
return () => {
248240
Highcharts.charts
249241
.find((chart: HighcartsChart) => chart?.renderTo === chartContainer)

packages/augur-simplified/src/modules/common/tables.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ export const PositionFooter = ({
187187
if (canClaimETH || !isETHClaim) {
188188
setPendingClaim(true);
189189
claimWinnings(account, [marketId], amm?.cash)
190-
.then((response) => {
190+
.then(response => {
191191
// handle transaction response here
192192
setPendingClaim(false);
193193
if (response) {
@@ -204,9 +204,9 @@ export const PositionFooter = ({
204204
});
205205
}
206206
})
207-
.catch((e) => {
207+
.catch(error => {
208208
setPendingClaim(false);
209-
// handle error here
209+
console.log('Error when trying to claim winnings: ', error?.message);
210210
});
211211
} else {
212212
// need to approve here

packages/augur-simplified/src/modules/constants.ts

Lines changed: 2 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,6 @@
11
import { MarketTypeName } from '@augurproject/sdk-lite';
2-
import { Icons, createBigNumber } from '@augurproject/augur-comps';
3-
const {
4-
EthIcon,
5-
UsdIcon,
6-
CryptoIcon,
7-
EntertainmentIcon,
8-
FinanceIcon,
9-
MedicalIcon,
10-
PoliticsIcon,
11-
SportsIcon,
12-
} = Icons;
2+
import { createBigNumber } from '@augurproject/augur-comps';
3+
134
// # Market Types
145
export const YES_NO = MarketTypeName.YesNo;
156
export const CATEGORICAL = MarketTypeName.Categorical;
@@ -20,24 +11,13 @@ export const MARKET = 'market';
2011
export const MARKETS = 'markets';
2112
export const PORTFOLIO = 'portfolio';
2213

23-
export const YES_NO_OUTCOMES_NAMES = ['Invalid', 'No', 'Yes'];
24-
// QUERY_PARAMS
25-
export const MARKET_ID_PARAM_NAME = 'id';
26-
export const AFFILIATE_NAME = 'r';
27-
export const THEME_NAME = 't';
28-
29-
export const OUTCOME_YES_NAME = 'Yes';
30-
export const OUTCOME_NO_NAME = 'No';
31-
export const OUTCOME_INVALID_NAME = 'Invalid';
32-
3314
// Directions
3415
export const BUY = 'buy';
3516
export const SELL = 'sell';
3617

3718
export const ADD_LIQUIDITY = 'add liquidity';
3819

3920
export const ETHER = createBigNumber(10).pow(18);
40-
export const GWEI_CONVERSION = 1000000000;
4121
export const TEN = createBigNumber(10, 10);
4222
export const ZERO = createBigNumber(0);
4323
export const ONE = createBigNumber(1);
@@ -46,10 +26,6 @@ export const THOUSAND = createBigNumber(1000);
4626
export const MILLION = THOUSAND.times(THOUSAND);
4727
export const BILLION = MILLION.times(THOUSAND);
4828
export const TRILLION = BILLION.times(THOUSAND);
49-
export const DAYS_IN_YEAR = createBigNumber(365);
50-
export const SEC_IN_DAY = createBigNumber(86400);
51-
export const PORTION_OF_INVALID_POOL_SELL = createBigNumber(0.5);
52-
export const PORTION_OF_CASH_INVALID_POOL = createBigNumber(0.1);
5329

5430
// # Asset Types
5531
export const ETH = 'ETH';
@@ -60,12 +36,6 @@ export const USDC = 'USDC';
6036
export const SHARES = 'SHARES';
6137
export const ALL_CURRENCIES = 'All Currencies';
6238

63-
export const CASH_LABEL_FORMATS = {
64-
ETH: { symbol: 'Ξ', prepend: true, displayDecimals: 4, icon: EthIcon },
65-
USDC: { symbol: '$', prepend: true, displayDecimals: 2, icon: UsdIcon },
66-
SHARES: { symbol: '', prepend: true, displayDecimals: 4, icon: null },
67-
};
68-
6939
// Portfolio table views
7040
export const POSITIONS = 'positions';
7141
export const LIQUIDITY = 'liquidity';
@@ -85,50 +55,22 @@ export const ALL_MARKETS = 'all markets';
8555

8656
// sub categories
8757
export const COVID = 'covid-19';
88-
export const ELECTORAL_COLLEGE = 'electoral college';
89-
export const FEDERAL_FUNDS = 'federal funds';
9058
export const REPUSD = 'REP USD';
91-
export const PRESIDENTIAL_ELECTION = 'electoral college';
92-
93-
export const POPULAR_CATEGORIES_ICONS = {
94-
[MEDICAL]: MedicalIcon,
95-
[POLITICS]: PoliticsIcon,
96-
[CRYPTO]: CryptoIcon,
97-
[FINANCE]: FinanceIcon,
98-
[SPORTS]: SportsIcon,
99-
[ENTERTAINMENT]: EntertainmentIcon,
100-
};
10159

10260
// side bar types
10361
export const NAVIGATION = 'NAVIGATION';
10462
export const FILTERS = 'FILTERS';
10563

106-
export const SIDEBAR_TYPES = {
107-
[NAVIGATION]: NAVIGATION,
108-
[FILTERS]: FILTERS,
109-
};
110-
11164
// transaction types
11265
export const ALL = 'all';
113-
export const SWAP = 'swap';
11466
export const ADD = 'add';
11567
export const REMOVE = 'remove';
11668

117-
export const INVALID_OUTCOME_ID = 0;
118-
export const NO_OUTCOME_ID = 1;
119-
export const YES_OUTCOME_ID = 2;
120-
12169
export const OPEN = 'Open';
12270
export const IN_SETTLEMENT = 'In settlement';
12371
export const RESOLVED = 'Resolved';
12472

125-
export const INSUFFICIENT_LIQUIDITY = 'Insufficent Liquidity';
126-
export const INSUFFICIENT_BALANCE = 'Insufficent Balance';
127-
export const OVER_SLIPPAGE = 'Over Slippage Tolerance';
12873
export const ENTER_AMOUNT = 'Enter Amount';
129-
export const ERROR_AMOUNT = 'Amount is not valid';
130-
export const CONNECT_ACCOUNT = 'Connect Account';
131-
export const SET_PRICES = 'Set Prices';
13274

13375
export const SETTINGS_SLIPPAGE = '2';
13476
// graph market status

packages/augur-simplified/src/modules/market/trading-form.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ const TradingForm = ({
360360
outputYesShares,
361361
userBalances
362362
)
363-
.then((response) => {
363+
.then(response => {
364364
if (response) {
365365
const { hash } = response;
366366
setAmount('');
@@ -379,9 +379,9 @@ const TradingForm = ({
379379
});
380380
}
381381
})
382-
.catch((e) => {
383-
//TODO: handle errors here
382+
.catch(error => {
384383
setWaitingToSign(false);
384+
console.log('Error when trying to trade: ', error?.message);
385385
});
386386
};
387387

packages/augur-simplified/src/modules/modal/modal-add-liquidity.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ const ModalAddLiquidity = ({
299299
return setBreakdown(defaultAddLiquidityBreakdown);
300300
}
301301
async function getResults() {
302-
let results = defaultAddLiquidityBreakdown;
302+
let results: LiquidityBreakdown;
303303
if (isRemove) {
304304
results = await getRemoveLiquidity(
305305
properties.marketId,
@@ -409,8 +409,8 @@ const ModalAddLiquidity = ({
409409
marketDescription: market.description,
410410
});
411411
})
412-
.catch((e) => {
413-
//TODO: handle errors here
412+
.catch(error => {
413+
console.log('Error when trying to remove AMM liquidity: ', error?.message);
414414
});
415415
} else {
416416
await doAmmLiquidity(
@@ -427,7 +427,7 @@ const ModalAddLiquidity = ({
427427
properties.priceYes,
428428
properties.symbolRoot
429429
)
430-
.then((response) => {
430+
.then(response => {
431431
const { hash } = response;
432432
addTransaction({
433433
hash,
@@ -440,8 +440,8 @@ const ModalAddLiquidity = ({
440440
marketDescription: market.description,
441441
});
442442
})
443-
.catch((e) => {
444-
// TODO: handle error
443+
.catch(error => {
444+
console.log('Error when trying to add AMM liquidity: ', error?.message);
445445
});
446446
}
447447
closeModal();

packages/augur-simplified/src/modules/portfolio/portfolio-view.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ const handleClaimAll = (
6969
if (from && canClaim) {
7070
setPendingClaim(true);
7171
claimWinnings(from, marketIds, cash)
72-
.then((response) => {
72+
.then(response => {
7373
// handle transaction response here
7474
setPendingClaim(false);
7575
if (response) {
@@ -86,9 +86,9 @@ const handleClaimAll = (
8686
});
8787
}
8888
})
89-
.catch((e) => {
89+
.catch(error => {
9090
setPendingClaim(false);
91-
// handle error here
91+
console.log('Error when trying to claim winnings: ', error?.message);
9292
});
9393
} else if (from) {
9494
const approveEth = async () => {

packages/augur-simplified/src/modules/stores/constants.ts

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -36,19 +36,3 @@ export const SIMPLIFIED_ACTIONS = {
3636
UPDATE_MARKETS_VIEW_SETTINGS: 'UPDATE_MARKETS_VIEW_SETTINGS',
3737
UPDATE_SETTINGS: 'UPDATE_SETTINGS',
3838
};
39-
40-
export const NETWORK_NAMES = {
41-
1: 'Mainnet',
42-
3: 'Ropsten',
43-
4: 'Rinkeby',
44-
5: 'Goerli',
45-
42: 'Kovan'
46-
};
47-
48-
export const NETWORK_BLOCK_REFRESH_TIME = {
49-
1: 15000,
50-
3: 5000,
51-
4: 5000,
52-
5: 5000,
53-
42: 5000,
54-
};

0 commit comments

Comments
 (0)