Skip to content

Commit

Permalink
feat: minor tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
brucedonovan committed Jun 17, 2021
1 parent ab68744 commit aa82dd6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
11 changes: 3 additions & 8 deletions src/components/YieldLiquidity.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
import { ethers } from 'ethers';
import { Box, ResponsiveContext, Text } from 'grommet';
import React, { useContext, useEffect, useState } from 'react';
import Loader from 'react-spinners/GridLoader';
import styled from 'styled-components';
import { UserContext } from '../contexts/UserContext';
import { useApr } from '../hooks/aprHook';
import { ActionType, ISeries, IUserContext } from '../types';
import { cleanValue, nFormatter } from '../utils/displayUtils';
import { buyBase, calculateAPR, secondsToFrom, sellBase } from '../utils/yieldMath';
import { ISeries, IUserContext } from '../types';
import { nFormatter } from '../utils/displayUtils';

interface IYieldApr {
input: string|undefined,
Expand All @@ -27,10 +24,9 @@ function YieldApr({ input }: IYieldApr) {

/* STATE FROM CONTEXT */
const { userState } = useContext(UserContext) as IUserContext;
const { activeAccount, assetMap, vaultMap, seriesMap, selectedSeriesId, selectedIlkId, selectedBaseId } = userState;
const { assetMap, seriesMap, selectedSeriesId, selectedBaseId } = userState;
const selectedBase = assetMap.get(selectedBaseId!);
const selectedSeries = seriesMap.get(selectedSeriesId!);
// const selectedIlk = assetMap.get(selectedIlkId!);

/* LOCAL STATE */
const [totalLiquidity, setTotalLiquidity] = useState<string>();
Expand All @@ -42,7 +38,6 @@ function YieldApr({ input }: IYieldApr) {
seriesMap && seriesMap.forEach((x:ISeries) => {
if (x.baseId === baseId) total = total.add(x.totalSupply);
});
console.log(ethers.utils.formatEther(total).toString());
setTotalLiquidity(ethers.utils.formatEther(total).toString());
}
}, [seriesMap, selectedBase]);
Expand Down
6 changes: 3 additions & 3 deletions src/hooks/borrowActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ export const useBorrowActions = () => {
const series = vault ? seriesMap.get(vault.seriesId) : seriesMap.get(selectedSeriesId);
const ilk = vault ? assetMap.get(vault.ilkId) : assetMap.get(selectedIlkId);

console.log(selectedSeriesId);
/* generate the reproducible txCode for tx tracking and tracing */
const txCode = getTxCode(ActionCodes.BORROW, series.id);

Expand All @@ -93,15 +92,16 @@ export const useBorrowActions = () => {
/* Include all the signatures gathered, if required */
...permits,

/* handle ETH deposit, if required */
..._addEth(_collInput, series),

/* If vault is null, build a new vault, else ignore */
{
operation: VAULT_OPS.BUILD,
args: [vaultId, selectedSeriesId, selectedIlkId],
series,
ignore: !!vault,
},
/* handle ETH deposit, if required */
..._addEth(_collInput, series),
{
operation: VAULT_OPS.SERVE,
args: [vaultId, account, _collInput, _input, MAX_128],
Expand Down

0 comments on commit aa82dd6

Please sign in to comment.