Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/deprecate wido #435

Merged
merged 2 commits into from
Nov 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
- Release the V3 vaults
- Release the multichain config
- Fix the zap balances fetching to use the multichain endpoint rather than the currently connected one
- Deprecate Wido due to project end-of-life

# 0.1.25 (28/08/2023)

Expand Down
1 change: 0 additions & 1 deletion apps/common/schemas/yDaemonTokenListBalances.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ const SOLVER = [
'InternalMigration',
'OptimismBooster',
'Cowswap',
'Wido',
'Portals',
'None'
] as const;
Expand Down
16 changes: 8 additions & 8 deletions apps/common/utils/externalZapOutTokenList.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"logoURI": "https://tokens.1inch.io/0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee.png",
"decimals": 18,
"balance": "0",
"supportedZaps": ["Wido", "Portals", "Cowswap"]
"supportedZaps": ["Portals", "Cowswap"]
},
{
"chainID": 1,
Expand All @@ -17,7 +17,7 @@
"logoURI": "https://tokens.1inch.io/0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2.png",
"decimals": 18,
"balance": "0",
"supportedZaps": ["Wido", "Portals", "Cowswap"]
"supportedZaps": ["Portals", "Cowswap"]
},
{
"chainID": 1,
Expand All @@ -27,7 +27,7 @@
"logoURI": "https://tokens.1inch.io/0x2260fac5e5542a773aa44fbcfedf7c193bc2c599.png",
"decimals": 8,
"balance": "0",
"supportedZaps": ["Wido", "Portals", "Cowswap"]
"supportedZaps": ["Portals", "Cowswap"]
},
{
"chainID": 1,
Expand All @@ -37,7 +37,7 @@
"logoURI": "https://tokens.1inch.io/0x6b175474e89094c44da98b954eedeac495271d0f.png",
"decimals": 18,
"balance": "0",
"supportedZaps": ["Wido", "Portals", "Cowswap"]
"supportedZaps": ["Portals", "Cowswap"]
},
{
"chainID": 1,
Expand All @@ -47,7 +47,7 @@
"logoURI": "https://tokens.1inch.io/0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48.png",
"decimals": 6,
"balance": "0",
"supportedZaps": ["Wido", "Portals", "Cowswap"]
"supportedZaps": ["Portals", "Cowswap"]
},
{
"chainID": 1,
Expand All @@ -57,7 +57,7 @@
"logoURI": "https://tokens.1inch.io/0xdac17f958d2ee523a2206206994597c13d831ec7.png",
"decimals": 6,
"balance": "0",
"supportedZaps": ["Wido", "Portals", "Cowswap"]
"supportedZaps": ["Portals", "Cowswap"]
},
{
"chainID": 1,
Expand All @@ -67,7 +67,7 @@
"logoURI": "https://tokens.1inch.io/0x0bc529c00c6401aef6d220be8c6ea1667f6ad93e.png",
"decimals": 18,
"balance": "0",
"supportedZaps": ["Wido", "Portals", "Cowswap"]
"supportedZaps": ["Portals", "Cowswap"]
},
{
"chainID": 1,
Expand All @@ -77,6 +77,6 @@
"logoURI": "https://tokens.1inch.io/0xd533a949740bb3306d119cc777fa900ba034cd52.png",
"decimals": 18,
"balance": "0",
"supportedZaps": ["Wido", "Portals", "Cowswap"]
"supportedZaps": ["Portals", "Cowswap"]
}
]
22 changes: 2 additions & 20 deletions apps/vaults-v3/components/SettingsPopover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ function ZapSection({chainID}: {chainID: number}): ReactElement {

const currentZapProvider = useMemo((): TSolver => {
if (chainID !== 1 && zapProvider === 'Cowswap') {
return 'Wido';
return 'Portals';
}
return zapProvider;
}, [chainID, zapProvider]);
Expand All @@ -110,19 +110,6 @@ function ZapSection({chainID}: {chainID: number}): ReactElement {
 {'using CoW Swap.'}
</legend>
</Renderable>
<Renderable shouldRender={currentZapProvider === Solver.enum.Wido}>
<legend className={'text-xs text-neutral-500'}>
{'Submit an order via'}&nbsp;
<a
className={'underline'}
href={'https://www.joinwido.com/'}
target={'_blank'}
rel={'noreferrer'}>
{'Wido'}
</a>
&nbsp;{'(0.3% fee).'}
</legend>
</Renderable>
<Renderable shouldRender={currentZapProvider === Solver.enum.Portals}>
<legend className={'text-xs text-neutral-500'}>
{'Submit an order via'}&nbsp;
Expand All @@ -139,7 +126,7 @@ function ZapSection({chainID}: {chainID: number}): ReactElement {
<select
id={'zapProvider'}
onChange={(e): void => set_zapProvider(e.target.value as TSolver)}
value={!isSolverDisabled(chainID)[currentZapProvider] ? currentZapProvider : Solver.enum.Wido}
value={!isSolverDisabled(chainID)[currentZapProvider] ? currentZapProvider : Solver.enum.Portals}
className={
'mt-1 h-10 w-full overflow-x-scroll rounded-lg border-none bg-neutral-100 p-2 outline-none scrollbar-none'
}>
Expand All @@ -150,11 +137,6 @@ function ZapSection({chainID}: {chainID: number}): ReactElement {
{Solver.enum.Cowswap}
</option>
) : null}
<option
disabled={isSolverDisabled(chainID)[Solver.enum.Wido]}
value={Solver.enum.Wido}>
{Solver.enum.Wido}
</option>
<option
disabled={isSolverDisabled(chainID)[Solver.enum.Portals]}
value={Solver.enum.Portals}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,7 @@ export function VaultDetailsQuickActionsButtons({currentVault}: {currentVault: T
toRefresh.push({address: toAddress(currentVault.staking.address), chainID});
}
await refresh(toRefresh);
} else if (
Solver.enum.Cowswap === currentSolver ||
Solver.enum.Portals === currentSolver ||
Solver.enum.Wido === currentSolver
) {
} else if (Solver.enum.Cowswap === currentSolver || Solver.enum.Portals === currentSolver) {
if (isDepositing) {
//refresh input from zap wallet, refresh output from default
await Promise.all([
Expand Down Expand Up @@ -171,7 +167,6 @@ export function VaultDetailsQuickActionsButtons({currentVault}: {currentVault: T
((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 ...
currentSolver === Solver.enum.Wido || // ... or the user is using Wido ...
currentSolver === Solver.enum.Portals || // ... or the user is using Portals ...
currentSolver === Solver.enum.PartnerContract || // ... or the user is using the Partner contract ...
currentSolver === Solver.enum.OptimismBooster) // ... or the user is using the Optimism Booster ... // ... then we need to approve the from token
Expand Down
18 changes: 5 additions & 13 deletions apps/vaults/components/SettingsPopover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export function SettingsPopover({vault}: TSettingPopover): ReactElement {

const currentZapProvider = useMemo((): TSolver => {
if (vault.chainID !== 1 && zapProvider === 'Cowswap') {
return 'Wido';
return 'Portals';
}
return zapProvider;
}, [vault.chainID, zapProvider]);
Expand Down Expand Up @@ -71,7 +71,7 @@ export function SettingsPopover({vault}: TSettingPopover): ReactElement {
value={
!isSolverDisabled(vault.chainID)[currentZapProvider]
? currentZapProvider
: Solver.enum.Wido
: Solver.enum.Portals
}
className={
'mt-1 h-10 w-full overflow-x-scroll border-none bg-neutral-100 p-2 outline-none scrollbar-none'
Expand All @@ -83,11 +83,6 @@ export function SettingsPopover({vault}: TSettingPopover): ReactElement {
{Solver.enum.Cowswap}
</option>
) : null}
<option
disabled={isSolverDisabled(vault.chainID)[Solver.enum.Wido]}
value={Solver.enum.Wido}>
{Solver.enum.Wido}
</option>
<option
disabled={isSolverDisabled(vault.chainID)[Solver.enum.Portals]}
value={Solver.enum.Portals}>
Expand All @@ -107,22 +102,19 @@ export function SettingsPopover({vault}: TSettingPopover): ReactElement {
&nbsp;{'using CoW Swap.'}
</legend>
</Renderable>
<Renderable shouldRender={currentZapProvider === Solver.enum.Wido}>
<Renderable shouldRender={currentZapProvider === Solver.enum.Portals}>
<legend className={'ml-2 text-xs text-neutral-500'}>
{'Submit an order via'}&nbsp;
<a
className={'underline'}
href={'https://www.joinwido.com/'}
href={'https://portals.fi/'}
target={'_blank'}
rel={'noreferrer'}>
{'Wido'}
{'Portals'}
</a>
&nbsp;{'(0.3% fee).'}
</legend>
</Renderable>
<Renderable shouldRender={currentZapProvider === Solver.enum.Portals}>
<legend>&nbsp;</legend>
</Renderable>
</div>
<div className={'flex flex-col space-y-1'}>
<Label>{'Slippage'}</Label>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,7 @@ export function VaultDetailsQuickActionsButtons({currentVault}: {currentVault: T
toRefresh.push({address: toAddress(currentVault.staking.address), chainID});
}
await refresh(toRefresh);
} else if (
Solver.enum.Cowswap === currentSolver ||
Solver.enum.Portals === currentSolver ||
Solver.enum.Wido === currentSolver
) {
} else if (Solver.enum.Cowswap === currentSolver || Solver.enum.Portals === currentSolver) {
if (isDepositing) {
//refresh input from zap wallet, refresh output from default
await Promise.all([
Expand Down Expand Up @@ -169,7 +165,6 @@ export function VaultDetailsQuickActionsButtons({currentVault}: {currentVault: T
((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 ...
currentSolver === Solver.enum.Wido || // ... or the user is using Wido ...
currentSolver === Solver.enum.Portals || // ... or the user is using Portals ...
currentSolver === Solver.enum.PartnerContract || // ... or the user is using the Partner contract ...
currentSolver === Solver.enum.OptimismBooster) // ... or the user is using the Optimism Booster ... // ... then we need to approve the from token
Expand Down
16 changes: 2 additions & 14 deletions apps/vaults/contexts/useSolver.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {useSolverOptimismBooster} from '@vaults/hooks/useSolverOptimismBooster';
import {useSolverPartnerContract} from '@vaults/hooks/useSolverPartnerContract';
import {useSolverPortals} from '@vaults/hooks/useSolverPortals';
import {useSolverVanilla} from '@vaults/hooks/useSolverVanilla';
import {useSolverWido} from '@vaults/hooks/useSolverWido';
import {serialize} from '@wagmi/core';
import {useWeb3} from '@yearn-finance/web-lib/contexts/useWeb3';
import {toAddress} from '@yearn-finance/web-lib/utils/address';
Expand All @@ -28,7 +27,6 @@ export const isSolverDisabled = (vaultChainID: number): TDict<boolean> => {
[Solver.enum.InternalMigration]: false,
[Solver.enum.OptimismBooster]: false,
[Solver.enum.Cowswap]: false,
[Solver.enum.Wido]: false,
[Solver.enum.Portals]: vaultChainID === 10 || false,
[Solver.enum.None]: false
};
Expand Down Expand Up @@ -60,7 +58,6 @@ export function WithSolverContextApp({children}: {children: React.ReactElement})
const {currentVault, actionParams, currentSolver, isDepositing} = useActionFlow();
const executionNonce = useRef<number>(0);
const cowswap = useSolverCowswap();
const wido = useSolverWido();
const vanilla = useSolverVanilla();
const portals = useSolverPortals();
const chainCoin = useSolverChainCoin();
Expand Down Expand Up @@ -132,11 +129,9 @@ export function WithSolverContextApp({children}: {children: React.ReactElement})
};

switch (currentSolver) {
case Solver.enum.Wido:
case Solver.enum.Portals:
case Solver.enum.Cowswap: {
const [widoQuote, cowswapQuote, portalsQuote] = await Promise.allSettled([
wido.init(request, currentSolver === Solver.enum.Wido),
const [cowswapQuote, portalsQuote] = await Promise.allSettled([
cowswap.init(request, currentSolver === Solver.enum.Cowswap),
portals.init(request, currentSolver === Solver.enum.Portals)
]);
Expand All @@ -149,7 +144,6 @@ export function WithSolverContextApp({children}: {children: React.ReactElement})
} = {};

[
{solver: Solver.enum.Wido, quote: widoQuote, ctx: wido},
{
solver: Solver.enum.Cowswap,
quote: cowswapQuote,
Expand All @@ -171,12 +165,7 @@ export function WithSolverContextApp({children}: {children: React.ReactElement})
ctx: vanilla
};

const solverPriority = [
Solver.enum.Wido,
Solver.enum.Cowswap,
Solver.enum.Portals,
Solver.enum.None
];
const solverPriority = [Solver.enum.Cowswap, Solver.enum.Portals, Solver.enum.None];

const newSolverPriority = [
currentSolver,
Expand Down Expand Up @@ -270,7 +259,6 @@ export function WithSolverContextApp({children}: {children: React.ReactElement})
address,
isDepositing,
currentSolver,
wido,
cowswap,
portals,
vanilla,
Expand Down
Loading
Loading