Skip to content

Commit 4bad33a

Browse files
committed
fix: clear selected positions on v3 migration page
1 parent 9b244bd commit 4bad33a

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

pages/v3-migration.page.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export default function V3Migration() {
2828
const { currentAccount, loading: web3Loading } = useWeb3Context();
2929
const { isPermissionsLoading } = usePermissions();
3030
const setCurrentMarketForMigration = useRootStore((state) => state.setCurrentMarketForMigration);
31+
const resetMigrationSelectedAssets = useRootStore((state) => state.resetMigrationSelectedAssets);
3132

3233
const currentTimeStamp = useCurrentTimestamp(5);
3334

@@ -58,6 +59,12 @@ export default function V3Migration() {
5859
}
5960
}, [setCurrentMarketForMigration]);
6061

62+
useEffect(() => {
63+
if (resetMigrationSelectedAssets) {
64+
resetMigrationSelectedAssets();
65+
}
66+
}, [resetMigrationSelectedAssets]);
67+
6168
usePoolDataV3Subscription();
6269

6370
return (

src/store/v3MigrationSlice.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ export type V3MigrationSlice = {
5252
signedPermits?: V3MigrationHelperSignedPermit[]
5353
) => Promise<EthereumTransactionTypeExtended[]>;
5454
setCurrentMarketForMigration: () => void;
55+
resetMigrationSelectedAssets: () => void;
5556
};
5657

5758
export const createV3MigrationSlice: StateCreator<
@@ -136,16 +137,19 @@ export const createV3MigrationSlice: StateCreator<
136137
})
137138
);
138139
},
140+
resetMigrationSelectedAssets: () => {
141+
set({
142+
selectedMigrationBorrowAssets: {},
143+
selectedMigrationSupplyAssets: {},
144+
});
145+
},
139146
getApprovePermitsForSelectedAssets: async () => {
140147
const timestamp = dayjs().unix();
141148
const approvalPermitsForMigrationAssets = await Promise.all(
142149
selectUserSupplyIncreasedReservesForMigrationPermits(get(), timestamp).map(
143150
async ({ reserve, increasedAmount }): Promise<Approval> => {
144-
const { getTokenData } = new ERC20Service(get().jsonRpcProvider());
145-
const { decimals } = await getTokenData(reserve.aTokenAddress);
146-
const convertedAmount = valueToWei(increasedAmount, decimals);
147151
return {
148-
amount: convertedAmount,
152+
amount: increasedAmount,
149153
underlyingAsset: reserve.aTokenAddress,
150154
permitType: 'MIGRATOR',
151155
};

0 commit comments

Comments
 (0)