Skip to content

Commit

Permalink
Merge branch 'main' into fix/stratDisplay
Browse files Browse the repository at this point in the history
  • Loading branch information
Majorfi authored Oct 30, 2023
2 parents 68e7cd3 + 33eb18f commit 51f4791
Show file tree
Hide file tree
Showing 27 changed files with 916 additions and 196 deletions.
11 changes: 10 additions & 1 deletion apps/common/contexts/useWallet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ import {
OPT_YVOP_VELO_STAKING_CONTRACT,
OPT_YVOP_WETH_STAKING_CONTRACT,
OPT_YVSNX_USDC_STAKING_CONTRACT,
OPT_YVSTERN_ERN_STAKING_CONTRACT,
OPT_YVSTG_USDC_STAKING_CONTRACT,
OPT_YVSUSCUSDC_STAKING_CONTRACT,
OPT_YVTBTC_WBTC_STAKING_CONTRACT,
OPT_YVTBTC_WETH_STAKING_CONTRACT,
Expand Down Expand Up @@ -180,7 +182,14 @@ export const WalletContextApp = memo(function WalletContextApp({children}: {chil
{chainID: 10, address: OPT_YVTBTC_WETH_STAKING_CONTRACT, symbol: 'yvVelo-tBTC-WETH', decimals: 18},
{chainID: 10, address: OPT_YVTBTC_WBTC_STAKING_CONTRACT, symbol: 'yvVelo-tBTC-WBTC', decimals: 18},
{chainID: 10, address: OPT_YVOP_WETH_STAKING_CONTRACT, symbol: 'yvVelo-OP-WETH', decimals: 18},
{chainID: 10, address: OPT_YVWUSDRV2_USDC_STAKING_CONTRACT, symbol: 'yvVelo-wUSDRv2-USDC', decimals: 18}
{
chainID: 10,
address: OPT_YVWUSDRV2_USDC_STAKING_CONTRACT,
symbol: 'yvVelo-wUSDRv2-USDC',
decimals: 18
},
{chainID: 10, address: OPT_YVSTERN_ERN_STAKING_CONTRACT, symbol: 'yvVelo-stERN-ERN', decimals: 18},
{chainID: 10, address: OPT_YVSTG_USDC_STAKING_CONTRACT, symbol: 'yvVelo-STG-USDC', decimals: 18}
]
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@ export function VaultDetailsQuickActionsButtons({currentVault}: {currentVault: T
** Wrapper to decide if we should use the partner contract or not
**************************************************************************/
const isAboveAllowance = toBigInt(actionParams.amount.raw) > toBigInt(allowanceFrom?.raw);
const isButtonBusy = txStatusApprove.pending || status !== 'success';

if (
isWithdrawing && //If user is withdrawing ...
Expand Down Expand Up @@ -192,7 +191,7 @@ export function VaultDetailsQuickActionsButtons({currentVault}: {currentVault: T
}

if (
(isButtonBusy || isAboveAllowance) && //If the button is busy or the amount is above the allowance ...
(txStatusApprove.pending || isAboveAllowance) && //If the button is busy or the amount is above the allowance ...
((isDepositing && currentSolver === Solver.enum.Vanilla) || // ... and the user is depositing with Vanilla ...
currentSolver === Solver.enum.InternalMigration || // ... or the user is migrating ...
currentSolver === Solver.enum.Cowswap || // ... or the user is using Cowswap ...
Expand Down
8 changes: 4 additions & 4 deletions apps/vaults/components/details/tabs/VaultDetailsAbout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {useIsMounted} from '@react-hookz/web';
import {GraphForVaultEarnings} from '@vaults/components/graphs/GraphForVaultEarnings';
import {Renderable} from '@yearn-finance/web-lib/components/Renderable';
import {cl} from '@yearn-finance/web-lib/utils/cl';
import {formatPercent} from '@yearn-finance/web-lib/utils/format.number';
import {formatAmount, formatPercent} from '@yearn-finance/web-lib/utils/format.number';
import {parseMarkdown} from '@yearn-finance/web-lib/utils/helpers';
import {isZero} from '@yearn-finance/web-lib/utils/isZero';

Expand Down Expand Up @@ -156,20 +156,20 @@ export function VaultDetailsAbout({
</YearnFeesLineItem>
<YearnFeesLineItem label={'Management fee'}>
<b className={'font-number text-xl text-neutral-900'}>
{formatPercent((apr.fees.management || 0) / 100, 0)}
{`${formatAmount(apr.fees.management * 100, 0, 2)} %`}
</b>
</YearnFeesLineItem>
<YearnFeesLineItem label={'Performance fee'}>
<b className={'font-number text-xl text-neutral-500'}>
{formatPercent((apr.fees.performance || 0) / 100, 0)}
{`${formatAmount(apr.fees.performance * 100, 0, 2)} %`}
</b>
</YearnFeesLineItem>
{currentVault.category === 'Velodrome' || currentVault.category === 'Aerodrome' ? (
<YearnFeesLineItem
label={'keepVELO'}
tooltip={`Percentage of VELO locked in each harvest. This is used to boost ${currentVault.category} vault pools, and is offset via yvOP staking rewards.`}>
<b className={'font-number text-xl text-neutral-500'}>
{formatPercent(currentVault.apr.fees.keepVelo * 100, 0)}
{formatAmount(currentVault.apr.fees.keepVelo * 100, 0, 2)}
</b>
</YearnFeesLineItem>
) : null}
Expand Down
1 change: 0 additions & 1 deletion apps/vaults/components/list/VaultsListRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,6 @@ export function VaultHistoricalAPR({currentVault}: {currentVault: TYDaemonVault}
<Renderable
shouldRender={!(currentVault.apr?.type === 'new' && hasZeroAPR)}
fallback={'New'}>
{'⚡️ '}
<span
className={
'underline decoration-neutral-600/30 decoration-dotted underline-offset-4 transition-opacity hover:decoration-neutral-600'
Expand Down
14 changes: 10 additions & 4 deletions apps/vaults/constants/optRewards.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export const OPT_YVTBTC_WBTC_WITH_REWARDS = toAddress('0x00Cb8E36A9C40491A39e8bF
export const OPT_YVOP_WETH_WITH_REWARDS = toAddress('0xDdDCAeE873f2D9Df0E18a80709ef2B396d4a6EA5');
export const OPT_YVWUSDRV2_USDC_WITH_REWARDS = toAddress('0x43360FDd9546e3e77ac2e6793f53219729743293');
export const OPT_YVSTERN_ERN_WITH_REWARDS = toAddress('0xa7B550B3A80361d8e47E07616dC42f04c655881b');
export const OPT_YVSTG_USDC_WITH_REWARDS = toAddress('0xf6B272134A193Df5b04332e73184E5b40b8EB810');

export const OPT_YVETH_STAKING_CONTRACT = toAddress('0xE35Fec3895Dcecc7d2a91e8ae4fF3c0d43ebfFE0');
export const OPT_YVDAI_STAKING_CONTRACT = toAddress('0xf8126EF025651E1B313a6893Fcf4034F4F4bD2aA');
Expand Down Expand Up @@ -75,6 +76,7 @@ export const OPT_YVTBTC_WBTC_STAKING_CONTRACT = toAddress('0x9b26e8BD7EBc0177B06
export const OPT_YVOP_WETH_STAKING_CONTRACT = toAddress('0x885FeDaB0182699eC2f2663F776a04150ed6f7af');
export const OPT_YVWUSDRV2_USDC_STAKING_CONTRACT = toAddress('0xE00bdf935e4FeB3cB5e0601D88a999d30994605c');
export const OPT_YVSTERN_ERN_STAKING_CONTRACT = toAddress('0x80C3806ADF50EfAc542DD4B3657F4BE2C30E24b8');
export const OPT_YVSTG_USDC_STAKING_CONTRACT = toAddress('0x43eFf8d2B799b5072195DEDE0909479309D17fe8');

export const OPT_VAULTS_WITH_REWARDS = [
OPT_YVETH_WITH_REWARDS,
Expand Down Expand Up @@ -112,7 +114,8 @@ export const OPT_VAULTS_WITH_REWARDS = [
OPT_YVTBTC_WBTC_WITH_REWARDS,
OPT_YVOP_WETH_WITH_REWARDS,
OPT_YVWUSDRV2_USDC_WITH_REWARDS,
OPT_YVSTERN_ERN_WITH_REWARDS
OPT_YVSTERN_ERN_WITH_REWARDS,
OPT_YVSTG_USDC_WITH_REWARDS
];

export const OPT_REWARDS_TOKENS = [
Expand Down Expand Up @@ -151,7 +154,8 @@ export const OPT_REWARDS_TOKENS = [
OPT_YVTBTC_WBTC_STAKING_CONTRACT,
OPT_YVOP_WETH_STAKING_CONTRACT,
OPT_YVWUSDRV2_USDC_STAKING_CONTRACT,
OPT_YVSTERN_ERN_STAKING_CONTRACT
OPT_YVSTERN_ERN_STAKING_CONTRACT,
OPT_YVSTG_USDC_STAKING_CONTRACT
];

export const VAULT_TO_STACKING: TDict<TAddress> = {
Expand Down Expand Up @@ -190,7 +194,8 @@ export const VAULT_TO_STACKING: TDict<TAddress> = {
[OPT_YVTBTC_WBTC_STAKING_CONTRACT]: OPT_YVTBTC_WBTC_WITH_REWARDS,
[OPT_YVOP_WETH_STAKING_CONTRACT]: OPT_YVOP_WETH_WITH_REWARDS,
[OPT_YVWUSDRV2_USDC_STAKING_CONTRACT]: OPT_YVWUSDRV2_USDC_WITH_REWARDS,
[OPT_YVSTERN_ERN_STAKING_CONTRACT]: OPT_YVSTERN_ERN_WITH_REWARDS
[OPT_YVSTERN_ERN_STAKING_CONTRACT]: OPT_YVSTERN_ERN_WITH_REWARDS,
[OPT_YVSTG_USDC_STAKING_CONTRACT]: OPT_YVSTG_USDC_WITH_REWARDS
};

export const STACKING_TO_VAULT: TDict<TAddress> = {
Expand Down Expand Up @@ -229,5 +234,6 @@ export const STACKING_TO_VAULT: TDict<TAddress> = {
[OPT_YVTBTC_WBTC_WITH_REWARDS]: OPT_YVTBTC_WBTC_STAKING_CONTRACT,
[OPT_YVOP_WETH_WITH_REWARDS]: OPT_YVOP_WETH_STAKING_CONTRACT,
[OPT_YVWUSDRV2_USDC_WITH_REWARDS]: OPT_YVWUSDRV2_USDC_STAKING_CONTRACT,
[OPT_YVSTERN_ERN_WITH_REWARDS]: OPT_YVSTERN_ERN_STAKING_CONTRACT
[OPT_YVSTERN_ERN_WITH_REWARDS]: OPT_YVSTERN_ERN_STAKING_CONTRACT,
[OPT_YVSTG_USDC_WITH_REWARDS]: OPT_YVSTG_USDC_STAKING_CONTRACT
};
28 changes: 21 additions & 7 deletions apps/veyfi/components/RedeemTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,9 @@ export function RedeemTab(): ReactElement {
'Got dYFI, want YFI? You’ve come to the right place. Redeem dYFI for YFI by paying the redemption cost in ETH. Enjoy your cheap YFI anon.'
}
</p>
<b className={'mt-4 block'}>
<b
suppressHydrationWarning
className={'mt-4 block'}>
{`Current discount: ${formatAmount(Number(discount.normalized) * 100, 2, 2)}%`}
</b>
</div>
Expand All @@ -125,10 +127,14 @@ export function RedeemTab(): ReactElement {
error={redeemAmountError}
legend={
<div className={'flex flex-row justify-between'}>
<p className={'text-neutral-400'}>
<p
suppressHydrationWarning
className={'text-neutral-400'}>
{formatCounterValue(redeemAmount.normalized, dYFIPrice)}
</p>
<p className={'text-neutral-400'}>{`You have: ${formatAmount(
<p
suppressHydrationWarning
className={'text-neutral-400'}>{`You have: ${formatAmount(
dYFIBalance.normalized,
2,
6
Expand All @@ -142,13 +148,17 @@ export function RedeemTab(): ReactElement {
amount={ethRequired}
legend={
<div className={'flex flex-row justify-between'}>
<p className={'text-neutral-400'}>
<p
suppressHydrationWarning
className={'text-neutral-400'}>
{formatCounterValue(
ethRequired.normalized,
Number(ethBalance.price.normalized) ?? 0
)}
</p>
<p className={'text-neutral-400'}>{`You have: ${formatAmount(
<p
suppressHydrationWarning
className={'text-neutral-400'}>{`You have: ${formatAmount(
ethBalance.balance.normalized,
2,
6
Expand All @@ -163,10 +173,14 @@ export function RedeemTab(): ReactElement {
amount={redeemAmount}
legend={
<div className={'flex flex-row justify-between'}>
<p className={'text-neutral-400'}>
<p
suppressHydrationWarning
className={'text-neutral-400'}>
{formatCounterValue(redeemAmount.normalized, yfiPrice)}
</p>
<p className={'text-neutral-400'}>{`You have: ${formatAmount(
<p
suppressHydrationWarning
className={'text-neutral-400'}>{`You have: ${formatAmount(
yfiBalance.normalized,
2,
6
Expand Down
Loading

0 comments on commit 51f4791

Please sign in to comment.