Skip to content

Commit

Permalink
fix: move implements to logic module
Browse files Browse the repository at this point in the history
  • Loading branch information
Bob Lu committed Jul 22, 2024
1 parent ac0cbe9 commit 68898bc
Show file tree
Hide file tree
Showing 25 changed files with 83 additions and 51 deletions.
6 changes: 5 additions & 1 deletion src/logics/aave-v2/logic.borrow.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Service } from './service';
import * as aavev2 from 'src/modules/aavev2';
import * as core from '@protocolink/core';
import { protocolId, supportedChainIds } from './configs';
import { providers } from 'ethers';

Expand All @@ -9,7 +10,10 @@ export type BorrowLogicOptions = aavev2.BorrowLogicOptions;

export type BorrowLogicTokenList = aavev2.BorrowLogicTokenList;

export class BorrowLogic extends aavev2.BorrowLogic {
export class BorrowLogic
extends aavev2.BorrowLogic
implements core.LogicTokenListInterface, core.LogicBuilderInterface
{
static protocolId = protocolId;
static readonly supportedChainIds = supportedChainIds;

Expand Down
2 changes: 1 addition & 1 deletion src/logics/aave-v2/logic.deposit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ export class DepositLogic extends aavev2.DepositLogics {
async getTokenList() {
const reserveTokens = await this.service.getSupplyTokens();

return aavev2.createDepositTokenList(reserveTokens, 'rToken');
return aavev2.createDepositTokenList(reserveTokens, 'aToken');
}
}
6 changes: 5 additions & 1 deletion src/logics/aave-v2/logic.repay.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Service } from './service';
import * as aavev2 from 'src/modules/aavev2';
import * as core from '@protocolink/core';
import { protocolId, supportedChainIds } from './configs';
import { providers } from 'ethers';

Expand All @@ -9,7 +10,10 @@ export type RepayLogicParams = aavev2.RepayLogicParams;

export type RepayLogicFields = aavev2.RepayLogicFields;

export class RepayLogic extends aavev2.RepayLogic {
export class RepayLogic
extends aavev2.RepayLogic
implements core.LogicTokenListInterface, core.LogicOracleInterface, core.LogicBuilderInterface
{
static protocolId = protocolId;
static readonly supportedChainIds = supportedChainIds;

Expand Down
6 changes: 5 additions & 1 deletion src/logics/aave-v2/logic.withdraw.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Service } from './service';
import * as aavev2 from 'src/modules/aavev2';
import * as core from '@protocolink/core';
import { protocolId, supportedChainIds } from './configs';
import { providers } from 'ethers';

Expand All @@ -11,7 +12,10 @@ export type WithdrawLogicFields = aavev2.WithdrawLogicFields;

export type WithdrawLogicOptions = aavev2.WithdrawLogicOptions;

export class WithdrawLogic extends aavev2.WithdrawLogic {
export class WithdrawLogic
extends aavev2.WithdrawLogic
implements core.LogicTokenListInterface, core.LogicOracleInterface, core.LogicBuilderInterface
{
static protocolId = protocolId;
static readonly supportedChainIds = supportedChainIds;

Expand Down
6 changes: 5 additions & 1 deletion src/logics/aave-v3/logic.borrow.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Service } from './service';
import * as aavev3 from 'src/modules/aavev3';
import * as core from '@protocolink/core';
import { protocolId, supportedChainIds } from './configs';
import { providers } from 'ethers';

Expand All @@ -9,7 +10,10 @@ export type BorrowLogicFields = aavev3.BorrowLogicFields;

export type BorrowLogicOptions = aavev3.BorrowLogicOptions;

export class BorrowLogic extends aavev3.BorrowLogic {
export class BorrowLogic
extends aavev3.BorrowLogic
implements core.LogicTokenListInterface, core.LogicBuilderInterface
{
static protocolId = protocolId;
static readonly supportedChainIds = supportedChainIds;

Expand Down
6 changes: 5 additions & 1 deletion src/logics/aave-v3/logic.repay.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Service } from './service';
import * as aavev3 from 'src/modules/aavev3';
import * as core from '@protocolink/core';
import { protocolId, supportedChainIds } from './configs';
import { providers } from 'ethers';

Expand All @@ -9,7 +10,10 @@ export type RepayLogicParams = aavev3.RepayLogicParams;

export type RepayLogicFields = aavev3.RepayLogicFields;

export class RepayLogic extends aavev3.RepayLogic {
export class RepayLogic
extends aavev3.RepayLogic
implements core.LogicTokenListInterface, core.LogicOracleInterface, core.LogicBuilderInterface
{
static protocolId = protocolId;
static readonly supportedChainIds = supportedChainIds;

Expand Down
6 changes: 5 additions & 1 deletion src/logics/aave-v3/logic.supply.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Service } from './service';
import * as aavev3 from 'src/modules/aavev3';
import * as core from '@protocolink/core';
import { protocolId, supportedChainIds } from './configs';
import { providers } from 'ethers';

Expand All @@ -11,7 +12,10 @@ export type SupplyLogicFields = aavev3.SupplyLogicFields;

export type SupplyLogicOptions = aavev3.SupplyLogicOptions;

export class SupplyLogic extends aavev3.SupplyLogics {
export class SupplyLogic
extends aavev3.SupplyLogics
implements core.LogicTokenListInterface, core.LogicOracleInterface, core.LogicBuilderInterface
{
static protocolId = protocolId;
static readonly supportedChainIds = supportedChainIds;

Expand Down
6 changes: 5 additions & 1 deletion src/logics/aave-v3/logic.withdraw.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Service } from './service';
import * as aavev3 from 'src/modules/aavev3';
import * as core from '@protocolink/core';
import { protocolId, supportedChainIds } from './configs';
import { providers } from 'ethers';

Expand All @@ -11,7 +12,10 @@ export type WithdrawLogicFields = aavev3.WithdrawLogicFields;

export type WithdrawLogicOptions = aavev3.WithdrawLogicOptions;

export class WithdrawLogic extends aavev3.WithdrawLogic {
export class WithdrawLogic
extends aavev3.WithdrawLogic
implements core.LogicTokenListInterface, core.LogicOracleInterface, core.LogicBuilderInterface
{
static protocolId = protocolId;
static readonly supportedChainIds = supportedChainIds;

Expand Down
6 changes: 5 additions & 1 deletion src/logics/radiant-v2/logic.borrow.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Service } from './service';
import * as aavev2 from 'src/modules/aavev2';
import * as core from '@protocolink/core';
import { protocolId, supportedChainIds } from './configs';
import { providers } from 'ethers';

Expand All @@ -9,7 +10,10 @@ export type BorrowLogicOptions = aavev2.BorrowLogicOptions;

export type BorrowLogicTokenList = aavev2.BorrowLogicTokenList;

export class BorrowLogic extends aavev2.BorrowLogic {
export class BorrowLogic
extends aavev2.BorrowLogic
implements core.LogicTokenListInterface, core.LogicBuilderInterface
{
static protocolId = protocolId;
static readonly supportedChainIds = supportedChainIds;

Expand Down
2 changes: 1 addition & 1 deletion src/logics/radiant-v2/logic.deposit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ export class DepositLogic extends aavev2.DepositLogics {
async getTokenList() {
const reserveTokens = await this.service.getSupplyTokens();

return aavev2.createDepositTokenList(reserveTokens, 'aToken');
return aavev2.createDepositTokenList(reserveTokens, 'rToken');
}
}
6 changes: 5 additions & 1 deletion src/logics/radiant-v2/logic.repay.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Service } from './service';
import * as aavev2 from 'src/modules/aavev2';
import * as core from '@protocolink/core';
import { protocolId, supportedChainIds } from './configs';
import { providers } from 'ethers';

Expand All @@ -9,7 +10,10 @@ export type RepayLogicParams = aavev2.RepayLogicParams;

export type RepayLogicFields = aavev2.RepayLogicFields;

export class RepayLogic extends aavev2.RepayLogic {
export class RepayLogic
extends aavev2.RepayLogic
implements core.LogicTokenListInterface, core.LogicOracleInterface, core.LogicBuilderInterface
{
static protocolId = protocolId;
static readonly supportedChainIds = supportedChainIds;

Expand Down
6 changes: 5 additions & 1 deletion src/logics/radiant-v2/logic.withdraw.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Service } from './service';
import * as aavev2 from 'src/modules/aavev2';
import * as core from '@protocolink/core';
import { protocolId, supportedChainIds } from './configs';
import { providers } from 'ethers';

Expand All @@ -11,7 +12,10 @@ export type WithdrawLogicFields = aavev2.WithdrawLogicFields;

export type WithdrawLogicOptions = aavev2.WithdrawLogicOptions;

export class WithdrawLogic extends aavev2.WithdrawLogic {
export class WithdrawLogic
extends aavev2.WithdrawLogic
implements core.LogicTokenListInterface, core.LogicOracleInterface, core.LogicBuilderInterface
{
static protocolId = protocolId;
static readonly supportedChainIds = supportedChainIds;

Expand Down
6 changes: 5 additions & 1 deletion src/logics/spark/logic.borrow.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Service } from './service';
import * as aavev3 from 'src/modules/aavev3';
import * as core from '@protocolink/core';
import { protocolId, supportedChainIds } from './configs';
import { providers } from 'ethers';

Expand All @@ -9,7 +10,10 @@ export type BorrowLogicFields = aavev3.BorrowLogicFields;

export type BorrowLogicOptions = aavev3.BorrowLogicOptions;

export class BorrowLogic extends aavev3.BorrowLogic {
export class BorrowLogic
extends aavev3.BorrowLogic
implements core.LogicTokenListInterface, core.LogicBuilderInterface
{
static protocolId = protocolId;
static readonly supportedChainIds = supportedChainIds;

Expand Down
6 changes: 5 additions & 1 deletion src/logics/spark/logic.repay.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Service } from './service';
import * as aavev3 from 'src/modules/aavev3';
import * as core from '@protocolink/core';
import { protocolId, supportedChainIds } from './configs';
import { providers } from 'ethers';

Expand All @@ -9,7 +10,10 @@ export type RepayLogicParams = aavev3.RepayLogicParams;

export type RepayLogicFields = aavev3.RepayLogicFields;

export class RepayLogic extends aavev3.RepayLogic {
export class RepayLogic
extends aavev3.RepayLogic
implements core.LogicTokenListInterface, core.LogicOracleInterface, core.LogicBuilderInterface
{
static protocolId = protocolId;
static readonly supportedChainIds = supportedChainIds;

Expand Down
6 changes: 5 additions & 1 deletion src/logics/spark/logic.supply.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Service } from './service';
import * as aavev3 from 'src/modules/aavev3';
import * as core from '@protocolink/core';
import { protocolId, supportedChainIds } from './configs';
import { providers } from 'ethers';

Expand All @@ -11,7 +12,10 @@ export type SupplyLogicFields = aavev3.SupplyLogicFields;

export type SupplyLogicOptions = aavev3.SupplyLogicOptions;

export class SupplyLogic extends aavev3.SupplyLogics {
export class SupplyLogic
extends aavev3.SupplyLogics
implements core.LogicTokenListInterface, core.LogicOracleInterface, core.LogicBuilderInterface
{
static protocolId = protocolId;
static readonly supportedChainIds = supportedChainIds;

Expand Down
6 changes: 5 additions & 1 deletion src/logics/spark/logic.withdraw.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Service } from './service';
import * as aavev3 from 'src/modules/aavev3';
import * as core from '@protocolink/core';
import { protocolId, supportedChainIds } from './configs';
import { providers } from 'ethers';

Expand All @@ -11,7 +12,10 @@ export type WithdrawLogicFields = aavev3.WithdrawLogicFields;

export type WithdrawLogicOptions = aavev3.WithdrawLogicOptions;

export class WithdrawLogic extends aavev3.WithdrawLogic {
export class WithdrawLogic
extends aavev3.WithdrawLogic
implements core.LogicTokenListInterface, core.LogicOracleInterface, core.LogicBuilderInterface
{
static protocolId = protocolId;
static readonly supportedChainIds = supportedChainIds;

Expand Down
5 changes: 1 addition & 4 deletions src/modules/aavev2/logic.borrow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@ export type BorrowLogicFields = core.TokenOutFields<{ interestRateMode: Interest

export type BorrowLogicOptions = Pick<core.GlobalOptions, 'account'>;

export abstract class BorrowLogic
extends core.Logic
implements core.LogicTokenListInterface, core.LogicBuilderInterface
{
export abstract class BorrowLogic extends core.Logic {
static id = 'borrow';
public readonly service: serviceType;

Expand Down
5 changes: 1 addition & 4 deletions src/modules/aavev2/logic.deposit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@ export type DepositLogicFields = core.TokenToTokenExactInFields<{ referralCode?:

export type DepositLogicOptions = Pick<core.GlobalOptions, 'account'>;

export abstract class DepositLogics
extends core.Logic
implements core.LogicTokenListInterface, core.LogicOracleInterface, core.LogicBuilderInterface
{
export abstract class DepositLogics extends core.Logic {
static id = 'deposit';
public readonly service: serviceType;

Expand Down
5 changes: 1 addition & 4 deletions src/modules/aavev2/logic.repay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@ export type RepayLogicParams = core.RepayParams<{ interestRateMode: InterestRate

export type RepayLogicFields = core.RepayFields<{ interestRateMode: InterestRateMode }>;

export abstract class RepayLogic
extends core.Logic
implements core.LogicTokenListInterface, core.LogicOracleInterface, core.LogicBuilderInterface
{
export abstract class RepayLogic extends core.Logic {
static id = 'repay';
public readonly service: serviceType;

Expand Down
5 changes: 1 addition & 4 deletions src/modules/aavev2/logic.withdraw.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@ export type WithdrawLogicFields = core.TokenToTokenExactInFields;

export type WithdrawLogicOptions = Pick<core.GlobalOptions, 'account'>;

export abstract class WithdrawLogic
extends core.Logic
implements core.LogicTokenListInterface, core.LogicOracleInterface, core.LogicBuilderInterface
{
export abstract class WithdrawLogic extends core.Logic {
static id = 'withdraw';
public readonly service: serviceType;

Expand Down
5 changes: 1 addition & 4 deletions src/modules/aavev3/logic.borrow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@ export type BorrowLogicFields = core.TokenOutFields<{ interestRateMode: Interest

export type BorrowLogicOptions = Pick<core.GlobalOptions, 'account'>;

export abstract class BorrowLogic
extends core.Logic
implements core.LogicTokenListInterface, core.LogicBuilderInterface
{
export abstract class BorrowLogic extends core.Logic {
static id = 'borrow';
public readonly service: serviceType;

Expand Down
5 changes: 1 addition & 4 deletions src/modules/aavev3/logic.repay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@ export type RepayLogicParams = core.RepayParams<{ interestRateMode: InterestRate

export type RepayLogicFields = core.RepayFields<{ interestRateMode: InterestRateMode }>;

export abstract class RepayLogic
extends core.Logic
implements core.LogicTokenListInterface, core.LogicOracleInterface, core.LogicBuilderInterface
{
export abstract class RepayLogic extends core.Logic {
static id = 'repay';
public readonly service: serviceType;

Expand Down
5 changes: 1 addition & 4 deletions src/modules/aavev3/logic.supply.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@ export type SupplyLogicFields = core.TokenToTokenExactInFields<{ referralCode?:

export type SupplyLogicOptions = Pick<core.GlobalOptions, 'account'>;

export abstract class SupplyLogics
extends core.Logic
implements core.LogicTokenListInterface, core.LogicOracleInterface, core.LogicBuilderInterface
{
export abstract class SupplyLogics extends core.Logic {
static id = 'supply';
public readonly service: serviceType;

Expand Down
5 changes: 1 addition & 4 deletions src/modules/aavev3/logic.withdraw.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@ export type WithdrawLogicFields = core.TokenToTokenExactInFields;

export type WithdrawLogicOptions = Pick<core.GlobalOptions, 'account'>;

export abstract class WithdrawLogic
extends core.Logic
implements core.LogicTokenListInterface, core.LogicOracleInterface, core.LogicBuilderInterface
{
export abstract class WithdrawLogic extends core.Logic {
static id = 'withdraw';
public readonly service: serviceType;

Expand Down
Loading

0 comments on commit 68898bc

Please sign in to comment.