Skip to content

Commit 5f0be0f

Browse files
mgrabinagrothem
andauthored
swap with aave collateral approval not using eip712 domain (#2549)
Co-authored-by: Mark Grothe <[email protected]>
1 parent 6350937 commit 5f0be0f

File tree

7 files changed

+17
-35
lines changed

7 files changed

+17
-35
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@
3131
"test:coverage": "jest --coverage"
3232
},
3333
"dependencies": {
34-
"@aave/contract-helpers": "1.36.0",
35-
"@aave/math-utils": "1.36.0",
34+
"@aave/contract-helpers": "1.36.1",
35+
"@aave/math-utils": "1.36.1",
3636
"@amplitude/analytics-browser": "^2.13.0",
3737
"@bgd-labs/aave-address-book": "^4.25.1",
3838
"@cowprotocol/app-data": "^3.1.0",

src/helpers/useGovernanceDelegate.tsx

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -252,13 +252,8 @@ export const useGovernanceDelegate = (
252252

253253
const unsignedPayloads: string[] = [];
254254
for (const tx of delegationParameters) {
255-
if (delegationType !== DelegationType.ALL) {
256-
const payload = await delegationTokenService.prepareV3DelegateByTypeSignature(tx);
257-
unsignedPayloads.push(payload);
258-
} else {
259-
const payload = await delegationTokenService.prepareV3DelegateByTypeSignature(tx);
260-
unsignedPayloads.push(payload);
261-
}
255+
const payload = await delegationTokenService.prepareV3DelegateByTypeSignature(tx);
256+
unsignedPayloads.push(payload);
262257
}
263258
try {
264259
const signedPayload: SignatureLike[] = [];
@@ -303,7 +298,6 @@ export const useGovernanceDelegate = (
303298
} else {
304299
let txs: EthereumTransactionTypeExtended[] = [];
305300
if (delegationType === DelegationType.ALL) {
306-
// TODO check if this is working as normal
307301
txs = await delegate({
308302
delegatee,
309303
governanceToken:
@@ -312,13 +306,8 @@ export const useGovernanceDelegate = (
312306
: delegationTokenType === DelegationTokenType.STKAAVE
313307
? governanceV3Config.votingAssets.stkAaveTokenAddress
314308
: governanceV3Config.votingAssets.aAaveTokenAddress,
315-
// delegationTokenType === DelegationTokenType.AAVE
316-
// ? governanceConfig.aaveTokenAddress
317-
// : governanceConfig.stkAaveTokenAddress,
318309
});
319310
} else {
320-
// TODO check if this is working as normal
321-
322311
txs = await delegateByType({
323312
delegatee,
324313
delegationType: delegationType.toString(),
@@ -328,9 +317,6 @@ export const useGovernanceDelegate = (
328317
: delegationTokenType === DelegationTokenType.STKAAVE
329318
? governanceV3Config.votingAssets.stkAaveTokenAddress
330319
: governanceV3Config.votingAssets.aAaveTokenAddress,
331-
// delegationTokenType === DelegationTokenType.AAVE
332-
// ? governanceConfig.aaveTokenAddress
333-
// : governanceConfig.stkAaveTokenAddress,
334320
});
335321
}
336322
setActionTx(txs[0]);

src/hooks/paraswap/useCollateralRepaySwap.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,7 @@ export const useCollateralRepaySwap = ({
127127
} catch (e) {
128128
console.error(e);
129129
const message =
130-
convertParaswapErrorMessage(e.message) ||
131-
'There was an issue fetching data from Velora';
130+
convertParaswapErrorMessage(e.message) || 'There was an issue fetching data from Velora';
132131
setError(message);
133132
} finally {
134133
setLoading(false);

src/hooks/paraswap/useCollateralSwap.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,7 @@ export const useCollateralSwap = ({
108108
} catch (e) {
109109
console.error(e);
110110
const message =
111-
convertParaswapErrorMessage(e.message) ||
112-
'There was an issue fetching data from Velora';
111+
convertParaswapErrorMessage(e.message) || 'There was an issue fetching data from Velora';
113112
setError(message);
114113
} finally {
115114
setLoading(false);

src/hooks/paraswap/useDebtSwitch.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,7 @@ export const useDebtSwitch = ({
111111
} catch (e) {
112112
console.error(e);
113113
const message =
114-
convertParaswapErrorMessage(e.message) ||
115-
'There was an issue fetching data from Velora';
114+
convertParaswapErrorMessage(e.message) || 'There was an issue fetching data from Velora';
116115
setError(message);
117116
} finally {
118117
setLoading(false);

src/store/poolSlice.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -713,17 +713,16 @@ export const createPoolSlice: StateCreator<
713713
},
714714
},
715715
generateSignatureRequest: async ({ token, amount, deadline, spender }, opts = {}) => {
716-
const v3Tokens = [
716+
const v3TokensWithEip712DomainSupport = [
717717
AaveV3Ethereum.ASSETS.AAVE.UNDERLYING.toLowerCase(),
718-
AaveV3Ethereum.ASSETS.AAVE.A_TOKEN.toLowerCase(),
719718
AaveSafetyModule.STK_AAVE.toLowerCase(),
720719
];
721720

722721
const provider = get().jsonRpcProvider(opts.chainId);
723722

724723
let name = '';
725724
let version = '1';
726-
if (v3Tokens.includes(token.toLowerCase())) {
725+
if (v3TokensWithEip712DomainSupport.includes(token.toLowerCase())) {
727726
const aaveV3TokenService = new AaveTokenV3Service(token, provider);
728727
const domain = await aaveV3TokenService.getEip712Domain();
729728
name = domain.name;

yarn.lock

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@
22
# yarn lockfile v1
33

44

5-
6-
version "1.36.0"
7-
resolved "https://registry.yarnpkg.com/@aave/contract-helpers/-/contract-helpers-1.36.0.tgz#0041fe515436cce982d8ea26e3bd1393032dee9a"
8-
integrity sha512-3Wb3O2Oc/AKd3/CEp8x4vpkRnXHF9tilLVx5fPkLIcuIpHlHSnWQalci9UZsOun9fIy5a1Dm+CsLNO++onWYAg==
5+
6+
version "1.36.1"
7+
resolved "https://registry.yarnpkg.com/@aave/contract-helpers/-/contract-helpers-1.36.1.tgz#729735e6be4f8a1872e1e3400591485fc2198b76"
8+
integrity sha512-Ppoz11WRA3bjkZqnRA0a/txjfb67fVWh+ucgtN/RR45WI9oDsEmtYsqAwiNR3egvigSeyJASFeei0ijGGoFifw==
99
dependencies:
1010
isomorphic-unfetch "^3.1.0"
1111

12-
13-
version "1.36.0"
14-
resolved "https://registry.yarnpkg.com/@aave/math-utils/-/math-utils-1.36.0.tgz#485d2f6d9858648049bdb25c14e515486749b006"
15-
integrity sha512-fVmHyFVMzFTU1+pxGCwr8egR7xDTLDwG1RoB3q9OCCROLf4sPl+vRFd1tejoJSsKQ+IJK7QG1mk0ygdjujl2JA==
12+
13+
version "1.36.1"
14+
resolved "https://registry.yarnpkg.com/@aave/math-utils/-/math-utils-1.36.1.tgz#3e501962de3700250c213c981ea47b36a8e37a54"
15+
integrity sha512-rR1sbDX1IFb1B1TLdi8hZANvtviPeU8hfpLuHC9cwlXluujCdHttnNVODwco1J5d2k6KxnNnc0DZJj2yV7nLTQ==
1616

1717
"@adobe/css-tools@^4.0.1":
1818
version "4.4.1"

0 commit comments

Comments
 (0)