Skip to content

Commit

Permalink
feat: remove support for Wido solver
Browse files Browse the repository at this point in the history
  • Loading branch information
Majorfi committed Nov 27, 2023
1 parent 81a55c6 commit 6cd4337
Show file tree
Hide file tree
Showing 13 changed files with 44 additions and 1,075 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 0.2.0 (27/11/2023)

- Deprecate Wido due to project end-of-life

# 0.1.25 (28/08/2023)

- Gauge voting for veYFI under the `gauge-voting` feature flag
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 @@ -29,7 +28,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 @@ -61,7 +59,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 @@ -131,11 +128,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 @@ -148,7 +143,6 @@ export function WithSolverContextApp({children}: {children: React.ReactElement})
} = {};

[
{solver: Solver.enum.Wido, quote: widoQuote, ctx: wido},
{
solver: Solver.enum.Cowswap,
quote: cowswapQuote,
Expand All @@ -170,12 +164,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 @@ -266,7 +255,6 @@ export function WithSolverContextApp({children}: {children: React.ReactElement})
address,
isDepositing,
currentSolver,
wido,
cowswap,
portals,
vanilla,
Expand Down
Loading

0 comments on commit 6cd4337

Please sign in to comment.