Skip to content

Commit

Permalink
More
Browse files Browse the repository at this point in the history
  • Loading branch information
haydenshively committed Jun 3, 2024
1 parent 184d377 commit 36a8c0d
Show file tree
Hide file tree
Showing 15 changed files with 42 additions and 66 deletions.
6 changes: 3 additions & 3 deletions earn/src/components/advanced/modal/BorrowModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { Token } from 'shared/lib/data/Token';
import useChain from 'shared/lib/hooks/UseChain';
import { formatNumberInput, truncateDecimals } from 'shared/lib/util/Numbers';
import styled from 'styled-components';
import { Address, encodeFunctionData, WriteContractReturnType } from 'viem';
import { Address, encodeFunctionData, formatEther, WriteContractReturnType } from 'viem';
import { useAccount, useSimulateContract, useWriteContract } from 'wagmi';

import { BorrowerNftBorrower } from '../../../data/hooks/useDeprecatedMarginAccountShim';
Expand Down Expand Up @@ -322,7 +322,7 @@ export default function BorrowModal(props: BorrowModalProps) {
</Text>
{etherToSend > 0n && (
<Text size='XS' color={TERTIARY_COLOR} className='overflow-hidden text-ellipsis'>
You will need to provide an additional {GN.fromBigInt(etherToSend, 18).toString(GNFormat.DECIMAL)} ETH to
You will need to provide an additional {formatEther(etherToSend)} ETH to
cover the gas fees in the event that you are liquidated.
</Text>
)}
Expand All @@ -348,7 +348,7 @@ export default function BorrowModal(props: BorrowModalProps) {
setPendingTxn={setPendingTxn}
/>
<Text size='XS' color={TERTIARY_COLOR} className='w-full mt-2'>
By using our service, you agree to our{' '}
By using this interface, you agree to our{' '}
<a href={TERMS_OF_SERVICE_URL} className='underline' rel='noreferrer' target='_blank'>
Terms of Service
</a>{' '}
Expand Down
2 changes: 1 addition & 1 deletion earn/src/components/advanced/modal/ClearWarningModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ export default function ClearWarningModal(props: ClearWarningModalProps) {
setPendingTxn={setPendingTxn}
/>
<Text size='XS' color={TERTIARY_COLOR} className='w-full mt-2'>
By using our service, you agree to our{' '}
By using this interface, you agree to our{' '}
<a href={TERMS_OF_SERVICE_URL} className='underline' rel='noreferrer' target='_blank'>
Terms of Service
</a>{' '}
Expand Down
10 changes: 8 additions & 2 deletions earn/src/components/advanced/modal/NewSmartWalletModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ import Pagination from 'shared/lib/components/common/Pagination';
import { Text } from 'shared/lib/components/common/Typography';
import { ALOE_II_BORROWER_NFT_ADDRESS } from 'shared/lib/data/constants/ChainSpecific';
import { TERMS_OF_SERVICE_URL } from 'shared/lib/data/constants/Values';
import { Token } from 'shared/lib/data/Token';
import useChain from 'shared/lib/hooks/UseChain';
import { generateBytes12Salt } from 'shared/lib/util/Salt';
import styled from 'styled-components';
import { Address } from 'viem';
import { useAccount, useSimulateContract, useWriteContract } from 'wagmi';

import { ReactComponent as SearchIcon } from '../../../assets/svg/search.svg';
import { UniswapPoolInfo } from '../../../data/MarginAccount';
import SmartWalletButton from '../SmartWalletButton';

const ITEMS_PER_PAGE = 5;
Expand All @@ -30,6 +30,12 @@ const SmartWalletOptionsPage = styled.div`
min-height: 212px;
`;

type UniswapPoolInfo = {
token0: Token;
token1: Token;
fee: number;
};

type CreateSmartWalletButtonProps = {
poolAddress: string;
uniswapPoolInfo: UniswapPoolInfo;
Expand Down Expand Up @@ -210,7 +216,7 @@ export default function NewSmartWalletModal(props: NewSmartWalletModalProps) {
setPendingTxn={setPendingTxn}
/>
<Text size='XS' color={TERTIARY_COLOR} className='w-full mt-2'>
By using our service, you agree to our{' '}
By using this interface, you agree to our{' '}
<a href={TERMS_OF_SERVICE_URL} className='underline' rel='noreferrer' target='_blank'>
Terms of Service
</a>{' '}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ export default function RemoveCollateralModal(props: RemoveCollateralModalProps)
setPendingTxn={setPendingTxn}
/>
<Text size='XS' color={TERTIARY_COLOR} className='w-full mt-2'>
By using our service, you agree to our{' '}
By using this interface, you agree to our{' '}
<a href={TERMS_OF_SERVICE_URL} className='underline' rel='noreferrer' target='_blank'>
Terms of Service
</a>{' '}
Expand Down
2 changes: 1 addition & 1 deletion earn/src/components/advanced/modal/RepayModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ export default function RepayModal(props: RepayModalProps) {
/>
)}
<Text size='XS' color={TERTIARY_COLOR} className='w-full mt-2'>
By using our service, you agree to our{' '}
By using this interface, you agree to our{' '}
<a href={TERMS_OF_SERVICE_URL} className='underline' rel='noreferrer' target='_blank'>
Terms of Service
</a>{' '}
Expand Down
2 changes: 1 addition & 1 deletion earn/src/components/advanced/modal/WithdrawAnteModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ export default function WithdrawAnteModal(props: WithdrawAnteModalProps) {
setPendingTxn={setPendingTxn}
/>
<Text size='XS' color={TERTIARY_COLOR} className='w-full mt-2'>
By using our service, you agree to our{' '}
By using this interface, you agree to our{' '}
<a href={TERMS_OF_SERVICE_URL} className='underline' rel='noreferrer' target='_blank'>
Terms of Service
</a>{' '}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ export function WithdrawUniswapNFTModal(props: WithdrawUniswapNFTModalProps) {
setPendingTxn={setPendingTxn}
/>
<Text size='XS' color={TERTIARY_COLOR} className='w-full mt-2'>
By using our service, you agree to our{' '}
By using this interface, you agree to our{' '}
<a href={TERMS_OF_SERVICE_URL} className='underline' rel='noreferrer' target='_blank'>
Terms of Service
</a>{' '}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ export function AddCollateralTab(props: AddCollateralTabProps) {
setPendingTxn={setPendingTxn}
/>
<Text size='XS' color={TERTIARY_COLOR} className='w-full mt-2'>
By using our service, you agree to our{' '}
By using this interface, you agree to our{' '}
<a href={TERMS_OF_SERVICE_URL} className='underline' rel='noreferrer' target='_blank'>
Terms of Service
</a>{' '}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ export function AddUniswapNFTAsCollateralTab(props: AddUniswapNFTAsCollateralTab
setPendingTxn={setPendingTxn}
/>
<Text size='XS' color={TERTIARY_COLOR} className='w-full mt-2'>
By using our service, you agree to our{' '}
By using this interface, you agree to our{' '}
<a href={TERMS_OF_SERVICE_URL} className='underline' rel='noreferrer' target='_blank'>
Terms of Service
</a>{' '}
Expand Down
2 changes: 1 addition & 1 deletion earn/src/components/boost/ImportBoostWidget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ export default function ImportBoostWidget(props: ImportBoostWidgetProps) {
{buttonState.label}
</FilledGradientButton>
<Text size='XS' color={TERTIARY_COLOR} className='w-full text-start mt-2'>
By using our service, you agree to our{' '}
By using this interface, you agree to our{' '}
<a href={TERMS_OF_SERVICE_URL} className='underline' rel='noreferrer' target='_blank'>
Terms of Service
</a>{' '}
Expand Down
5 changes: 0 additions & 5 deletions earn/src/data/GlobalStats.ts

This file was deleted.

40 changes: 0 additions & 40 deletions earn/src/data/MarginAccount.ts

This file was deleted.

Empty file.
4 changes: 0 additions & 4 deletions earn/src/data/RedeemRewardReponse.ts

This file was deleted.

27 changes: 23 additions & 4 deletions earn/src/data/hooks/useDeprecatedMarginAccountShim.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,32 @@ import { useMemo } from 'react';

import Big from 'big.js';
import { borrowerNftAbi } from 'shared/lib/abis/BorrowerNft';
import { NumericFeeTierToEnum } from 'shared/lib/data/FeeTier';
import { GNFormat } from 'shared/lib/data/GoodNumber';
import { Assets, Liabilities } from 'shared/lib/data/Borrower';
import { FeeTier, NumericFeeTierToEnum } from 'shared/lib/data/FeeTier';
import { GN, GNFormat } from 'shared/lib/data/GoodNumber';
import { LendingPair } from 'shared/lib/data/LendingPair';
import { Token } from 'shared/lib/data/Token';
import { BorrowerNft } from 'shared/lib/hooks/UseBorrowerNft';
import { GetContractEventsReturnType } from 'viem';
import { Address, GetContractEventsReturnType, Hex } from 'viem';

import { MarginAccount } from '../MarginAccount';
export type MarginAccount = {
address: Address;
uniswapPool: Address;
token0: Token;
token1: Token;
feeTier: FeeTier;
assets: Assets;
liabilities: Liabilities;
sqrtPriceX96: Big;
health: number;
lender0: Address;
lender1: Address;
iv: number;
nSigma: number;
userDataHex: Hex;
warningTime: number;
ethBalance?: GN;
};

export type BorrowerNftBorrower = MarginAccount & {
tokenId: string;
Expand Down

0 comments on commit 36a8c0d

Please sign in to comment.