/ src / services / StkAbptMigrationService.ts
StkAbptMigrationService.ts
 1  import { AaveSafetyModule } from '@bgd-labs/aave-address-book';
 2  import { SignatureLike } from '@ethersproject/bytes';
 3  
 4  export class StkAbptMigrationService {
 5    private async getService() {
 6      const StkABPTMigrationService = (await import('@aave/contract-helpers')).StkABPTMigratorService;
 7      return new StkABPTMigrationService(AaveSafetyModule.STK_ABPT_STK_AAVE_WSTETH_BPTV2_MIGRATOR);
 8    }
 9  
10    async migrate(user: string, amount: string, outAmountMin: string) {
11      const service = await this.getService();
12      return service.migrate(user, amount, ['0', '0'], outAmountMin);
13    }
14  
15    async migrateWithPermit(
16      user: string,
17      amount: string,
18      outAmountMin: string,
19      signature: SignatureLike,
20      deadline: string
21    ) {
22      const service = await this.getService();
23      return service.migrateWithPermit({
24        user,
25        amount,
26        tokenOutAmountsMin: ['0', '0'],
27        poolOutAmountMin: outAmountMin,
28        signature,
29        deadline,
30      });
31    }
32  }