From 1c66b5e2e38e12b8363276a33674306951d7d076 Mon Sep 17 00:00:00 2001 From: James Tuckett Date: Mon, 22 Apr 2024 10:28:35 +0100 Subject: [PATCH 1/5] fix: addresses need to be lowercased when indexing in to config maps --- .../aave-v3/implementation/AaveV3DebtConfigMap.ts | 4 ++-- .../maker/implementation/MakerCollateralConfigMap.ts | 4 ++-- .../plugins/maker/implementation/MakerDebtConfigMap.ts | 4 ++-- .../spark/implementation/SparkCollateralConfigMap.ts | 4 ++-- .../plugins/spark/implementation/SparkDebtConfigMap.ts | 4 ++-- .../src/protocols/implementation/CollateralConfigMap.ts | 9 +++++++-- .../src/protocols/implementation/DebtConfigMap.ts | 9 +++++++-- 7 files changed, 24 insertions(+), 14 deletions(-) diff --git a/sdk/protocol-plugins/src/plugins/aave-v3/implementation/AaveV3DebtConfigMap.ts b/sdk/protocol-plugins/src/plugins/aave-v3/implementation/AaveV3DebtConfigMap.ts index c231de90d3..b3844926e9 100644 --- a/sdk/protocol-plugins/src/plugins/aave-v3/implementation/AaveV3DebtConfigMap.ts +++ b/sdk/protocol-plugins/src/plugins/aave-v3/implementation/AaveV3DebtConfigMap.ts @@ -21,11 +21,11 @@ export class AaveV3DebtConfigMap extends DebtConfigMap implements IAaveV3DebtCon } public override add(params: { debt: IToken; debtConfig: IAaveV3DebtConfig }): void { - this.record[params.debt.address.value] = AaveV3DebtConfig.createFrom(params.debtConfig) + this.record[this._lowerCaseAddress(params.debt.address.value)] = AaveV3DebtConfig.createFrom(params.debtConfig) } public override get(params: { token: IToken }): Maybe { - return this.record[params.token.address.value] + return this.record[this._lowerCaseAddress(params.token.address.value)] } } diff --git a/sdk/protocol-plugins/src/plugins/maker/implementation/MakerCollateralConfigMap.ts b/sdk/protocol-plugins/src/plugins/maker/implementation/MakerCollateralConfigMap.ts index 62adff798d..dd78e031bb 100644 --- a/sdk/protocol-plugins/src/plugins/maker/implementation/MakerCollateralConfigMap.ts +++ b/sdk/protocol-plugins/src/plugins/maker/implementation/MakerCollateralConfigMap.ts @@ -27,13 +27,13 @@ export class MakerCollateralConfigMap collateral: IToken collateralConfig: IMakerCollateralConfig }): void { - this.record[params.collateral.address.value] = MakerCollateralConfig.createFrom( + this.record[this._lowerCaseAddress(params.collateral.address.value)] = MakerCollateralConfig.createFrom( params.collateralConfig, ) } public override get(params: { token: IToken }): Maybe { - return this.record[params.token.address.value] + return this.record[this._lowerCaseAddress(params.token.address.value)] } } diff --git a/sdk/protocol-plugins/src/plugins/maker/implementation/MakerDebtConfigMap.ts b/sdk/protocol-plugins/src/plugins/maker/implementation/MakerDebtConfigMap.ts index 5bcd91dc0f..3b243e63b2 100644 --- a/sdk/protocol-plugins/src/plugins/maker/implementation/MakerDebtConfigMap.ts +++ b/sdk/protocol-plugins/src/plugins/maker/implementation/MakerDebtConfigMap.ts @@ -21,11 +21,11 @@ export class MakerDebtConfigMap extends DebtConfigMap implements IMakerDebtConfi } public override add(params: { debt: IToken; debtConfig: IMakerDebtConfig }): void { - this.record[params.debt.address.value] = MakerDebtConfig.createFrom(params.debtConfig) + this.record[this._lowerCaseAddress(params.debt.address.value)] = MakerDebtConfig.createFrom(params.debtConfig) } public override get(params: { token: IToken }): Maybe { - return this.record[params.token.address.value] + return this.record[this._lowerCaseAddress(params.token.address.value)] } } diff --git a/sdk/protocol-plugins/src/plugins/spark/implementation/SparkCollateralConfigMap.ts b/sdk/protocol-plugins/src/plugins/spark/implementation/SparkCollateralConfigMap.ts index 29d3b1ba5e..e5bf59a3fc 100644 --- a/sdk/protocol-plugins/src/plugins/spark/implementation/SparkCollateralConfigMap.ts +++ b/sdk/protocol-plugins/src/plugins/spark/implementation/SparkCollateralConfigMap.ts @@ -27,13 +27,13 @@ export class SparkCollateralConfigMap collateral: IToken collateralConfig: ISparkCollateralConfig }): void { - this.record[params.collateral.address.value] = SparkCollateralConfig.createFrom( + this.record[this._lowerCaseAddress(params.collateral.address.value)] = SparkCollateralConfig.createFrom( params.collateralConfig, ) } public override get(params: { token: IToken }): Maybe { - return this.record[params.token.address.value] + return this.record[this._lowerCaseAddress(params.token.address.value)] } } diff --git a/sdk/protocol-plugins/src/plugins/spark/implementation/SparkDebtConfigMap.ts b/sdk/protocol-plugins/src/plugins/spark/implementation/SparkDebtConfigMap.ts index 382469ca69..dafdb0ceba 100644 --- a/sdk/protocol-plugins/src/plugins/spark/implementation/SparkDebtConfigMap.ts +++ b/sdk/protocol-plugins/src/plugins/spark/implementation/SparkDebtConfigMap.ts @@ -21,11 +21,11 @@ export class SparkDebtConfigMap extends DebtConfigMap implements ISparkDebtConfi } public override add(params: { debt: IToken; debtConfig: ISparkDebtConfig }): void { - this.record[params.debt.address.value] = SparkDebtConfig.createFrom(params.debtConfig) + this.record[this._lowerCaseAddress(params.debt.address.value)] = SparkDebtConfig.createFrom(params.debtConfig) } public override get(params: { token: IToken }): Maybe { - return this.record[params.token.address.value] + return this.record[this._lowerCaseAddress(params.token.address.value)] } } diff --git a/sdk/sdk-common/src/protocols/implementation/CollateralConfigMap.ts b/sdk/sdk-common/src/protocols/implementation/CollateralConfigMap.ts index 6b1116dafa..51e4c3a86e 100644 --- a/sdk/sdk-common/src/protocols/implementation/CollateralConfigMap.ts +++ b/sdk/sdk-common/src/protocols/implementation/CollateralConfigMap.ts @@ -1,3 +1,4 @@ +import {HexData} from "../../common"; import { AddressValue } from '../../common/aliases/AddressValue' import { Maybe } from '../../common/aliases/Maybe' import { IToken } from '../../common/interfaces/IToken' @@ -20,13 +21,13 @@ export class CollateralConfigMap implements ICollateralConfigMap { } public add(params: { collateral: IToken; collateralConfig: ICollateralConfig }): void { - this.record[params.collateral.address.value] = CollateralConfig.createFrom( + this.record[this._lowerCaseAddress(params.collateral.address.value)] = CollateralConfig.createFrom( params.collateralConfig, ) } public get(params: { token: IToken }): Maybe { - return this.record[params.token.address.value] + return this.record[this._lowerCaseAddress(params.token.address.value)] } protected _importCollateralConfigMap(params: ICollateralConfigMap): void { @@ -34,6 +35,10 @@ export class CollateralConfigMap implements ICollateralConfigMap { this.add({ collateral: collateralConfig.token, collateralConfig }) }) } + + protected _lowerCaseAddress(address: HexData) { + return address.toLowerCase() as HexData + } } SerializationService.registerClass(CollateralConfigMap) diff --git a/sdk/sdk-common/src/protocols/implementation/DebtConfigMap.ts b/sdk/sdk-common/src/protocols/implementation/DebtConfigMap.ts index 5e0a735cb5..bc6b6b1ded 100644 --- a/sdk/sdk-common/src/protocols/implementation/DebtConfigMap.ts +++ b/sdk/sdk-common/src/protocols/implementation/DebtConfigMap.ts @@ -1,3 +1,4 @@ +import {HexData} from "../../common"; import { AddressValue } from '../../common/aliases/AddressValue' import { Maybe } from '../../common/aliases/Maybe' import { IToken } from '../../common/interfaces/IToken' @@ -21,11 +22,11 @@ export class DebtConfigMap implements IDebtConfigMap { } public add(params: { debt: IToken; debtConfig: IDebtConfig }): void { - this.record[params.debt.address.value] = DebtConfig.createFrom(params.debtConfig) + this.record[this._lowerCaseAddress(params.debt.address.value)] = DebtConfig.createFrom(params.debtConfig) } public get(params: { token: IToken }): Maybe { - return this.record[params.token.address.value] + return this.record[this._lowerCaseAddress(params.token.address.value)] } protected _importDebtConfigMap(params: IDebtConfigMap): void { @@ -33,6 +34,10 @@ export class DebtConfigMap implements IDebtConfigMap { this.add({ debt: debtConfig.token, debtConfig }) }) } + + protected _lowerCaseAddress(address: HexData) { + return address.toLowerCase() as HexData + } } SerializationService.registerClass(DebtConfigMap) From 32c71f1ed24536952c0aabfd78e7cb2eaef94fcb Mon Sep 17 00:00:00 2001 From: James Tuckett Date: Mon, 22 Apr 2024 10:50:55 +0100 Subject: [PATCH 2/5] test: add a test to confirm address lowercasing is working as expected --- .../integration/SparkProtocolPlugin.spec.ts | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/sdk/protocol-plugins/tests/integration/SparkProtocolPlugin.spec.ts b/sdk/protocol-plugins/tests/integration/SparkProtocolPlugin.spec.ts index dbb51ee7b6..1053267fb4 100644 --- a/sdk/protocol-plugins/tests/integration/SparkProtocolPlugin.spec.ts +++ b/sdk/protocol-plugins/tests/integration/SparkProtocolPlugin.spec.ts @@ -8,13 +8,14 @@ import { TokenAmount, Percentage, } from '@summerfi/sdk-common/common' -import { SparkProtocolPlugin } from '../../src/plugins/spark' +import {SparkLendingPool, SparkProtocolPlugin} from '../../src/plugins/spark' import { sparkPoolIdMock as validSparkPoolId } from '../mocks/SparkPoolIdMock' import { createProtocolPluginContext } from '../utils/CreateProtocolPluginContext' describe('Spark Protocol Plugin (Integration)', () => { let ctx: IProtocolPluginContext let sparkProtocolPlugin: SparkProtocolPlugin + let pool: SparkLendingPool beforeAll(async () => { ctx = await createProtocolPluginContext() sparkProtocolPlugin = new SparkProtocolPlugin({ @@ -84,7 +85,7 @@ describe('Spark Protocol Plugin (Integration)', () => { }) it('correctly populates debt configuration from blockchain data', async () => { - const pool = await sparkProtocolPlugin.getPool(validSparkPoolId) + pool = await sparkProtocolPlugin.getPool(validSparkPoolId) const mockDebtToken = Token.createFrom({ chainInfo: ChainInfo.createFrom({ chainId: 1, name: 'Ethereum' }), @@ -146,4 +147,18 @@ describe('Spark Protocol Plugin (Integration)', () => { const originationFee = config!.originationFee expect(originationFee).toBeInstanceOf(Percentage) }) + + it('resolves config maps for tokens sent with addresses in alternative formats', async () => { + const mockCollateralToken = Token.createFrom({ + chainInfo: ChainInfo.createFrom({ chainId: 1, name: 'Ethereum' }), + // NOTE: Address is different format to that expected by the protocol + address: Address.createFromEthereum({ value: '0xae78736cd615f374d3085123a210448e74fc6393' }), + symbol: 'RETH', + name: 'Rocket Ether', + decimals: 18, + }) + + const config = pool.collaterals.get({ token: mockCollateralToken }) + expect(config).toBeDefined() + }) }) From 4f00ce7326c499ee72609d164f2a7234f60cd96d Mon Sep 17 00:00:00 2001 From: James Tuckett Date: Mon, 22 Apr 2024 10:54:39 +0100 Subject: [PATCH 3/5] refactor: ConfigMap helper name --- .../aave-v3/implementation/AaveV3CollateralConfigMap.ts | 4 ++-- .../plugins/aave-v3/implementation/AaveV3DebtConfigMap.ts | 4 ++-- .../maker/implementation/MakerCollateralConfigMap.ts | 4 ++-- .../src/plugins/maker/implementation/MakerDebtConfigMap.ts | 4 ++-- .../spark/implementation/SparkCollateralConfigMap.ts | 4 ++-- .../src/plugins/spark/implementation/SparkDebtConfigMap.ts | 4 ++-- .../src/protocols/implementation/CollateralConfigMap.ts | 6 +++--- .../src/protocols/implementation/DebtConfigMap.ts | 6 +++--- 8 files changed, 18 insertions(+), 18 deletions(-) diff --git a/sdk/protocol-plugins/src/plugins/aave-v3/implementation/AaveV3CollateralConfigMap.ts b/sdk/protocol-plugins/src/plugins/aave-v3/implementation/AaveV3CollateralConfigMap.ts index 752881b0e4..cdfe39e6bd 100644 --- a/sdk/protocol-plugins/src/plugins/aave-v3/implementation/AaveV3CollateralConfigMap.ts +++ b/sdk/protocol-plugins/src/plugins/aave-v3/implementation/AaveV3CollateralConfigMap.ts @@ -27,13 +27,13 @@ export class AaveV3CollateralConfigMap collateral: IToken collateralConfig: IAaveV3CollateralConfig }): void { - this.record[params.collateral.address.value] = AaveV3CollateralConfig.createFrom( + this.record[this._formatRecordKey(params.collateral.address.value)] = AaveV3CollateralConfig.createFrom( params.collateralConfig, ) } public override get(params: { token: IToken }): Maybe { - return this.record[params.token.address.value] + return this.record[this._formatRecordKey(params.token.address.value)] } } diff --git a/sdk/protocol-plugins/src/plugins/aave-v3/implementation/AaveV3DebtConfigMap.ts b/sdk/protocol-plugins/src/plugins/aave-v3/implementation/AaveV3DebtConfigMap.ts index b3844926e9..8920996947 100644 --- a/sdk/protocol-plugins/src/plugins/aave-v3/implementation/AaveV3DebtConfigMap.ts +++ b/sdk/protocol-plugins/src/plugins/aave-v3/implementation/AaveV3DebtConfigMap.ts @@ -21,11 +21,11 @@ export class AaveV3DebtConfigMap extends DebtConfigMap implements IAaveV3DebtCon } public override add(params: { debt: IToken; debtConfig: IAaveV3DebtConfig }): void { - this.record[this._lowerCaseAddress(params.debt.address.value)] = AaveV3DebtConfig.createFrom(params.debtConfig) + this.record[this._formatRecordKey(params.debt.address.value)] = AaveV3DebtConfig.createFrom(params.debtConfig) } public override get(params: { token: IToken }): Maybe { - return this.record[this._lowerCaseAddress(params.token.address.value)] + return this.record[this._formatRecordKey(params.token.address.value)] } } diff --git a/sdk/protocol-plugins/src/plugins/maker/implementation/MakerCollateralConfigMap.ts b/sdk/protocol-plugins/src/plugins/maker/implementation/MakerCollateralConfigMap.ts index dd78e031bb..39268b3c1b 100644 --- a/sdk/protocol-plugins/src/plugins/maker/implementation/MakerCollateralConfigMap.ts +++ b/sdk/protocol-plugins/src/plugins/maker/implementation/MakerCollateralConfigMap.ts @@ -27,13 +27,13 @@ export class MakerCollateralConfigMap collateral: IToken collateralConfig: IMakerCollateralConfig }): void { - this.record[this._lowerCaseAddress(params.collateral.address.value)] = MakerCollateralConfig.createFrom( + this.record[this._formatRecordKey(params.collateral.address.value)] = MakerCollateralConfig.createFrom( params.collateralConfig, ) } public override get(params: { token: IToken }): Maybe { - return this.record[this._lowerCaseAddress(params.token.address.value)] + return this.record[this._formatRecordKey(params.token.address.value)] } } diff --git a/sdk/protocol-plugins/src/plugins/maker/implementation/MakerDebtConfigMap.ts b/sdk/protocol-plugins/src/plugins/maker/implementation/MakerDebtConfigMap.ts index 3b243e63b2..f50a5c5e4c 100644 --- a/sdk/protocol-plugins/src/plugins/maker/implementation/MakerDebtConfigMap.ts +++ b/sdk/protocol-plugins/src/plugins/maker/implementation/MakerDebtConfigMap.ts @@ -21,11 +21,11 @@ export class MakerDebtConfigMap extends DebtConfigMap implements IMakerDebtConfi } public override add(params: { debt: IToken; debtConfig: IMakerDebtConfig }): void { - this.record[this._lowerCaseAddress(params.debt.address.value)] = MakerDebtConfig.createFrom(params.debtConfig) + this.record[this._formatRecordKey(params.debt.address.value)] = MakerDebtConfig.createFrom(params.debtConfig) } public override get(params: { token: IToken }): Maybe { - return this.record[this._lowerCaseAddress(params.token.address.value)] + return this.record[this._formatRecordKey(params.token.address.value)] } } diff --git a/sdk/protocol-plugins/src/plugins/spark/implementation/SparkCollateralConfigMap.ts b/sdk/protocol-plugins/src/plugins/spark/implementation/SparkCollateralConfigMap.ts index e5bf59a3fc..345adb6b6d 100644 --- a/sdk/protocol-plugins/src/plugins/spark/implementation/SparkCollateralConfigMap.ts +++ b/sdk/protocol-plugins/src/plugins/spark/implementation/SparkCollateralConfigMap.ts @@ -27,13 +27,13 @@ export class SparkCollateralConfigMap collateral: IToken collateralConfig: ISparkCollateralConfig }): void { - this.record[this._lowerCaseAddress(params.collateral.address.value)] = SparkCollateralConfig.createFrom( + this.record[this._formatRecordKey(params.collateral.address.value)] = SparkCollateralConfig.createFrom( params.collateralConfig, ) } public override get(params: { token: IToken }): Maybe { - return this.record[this._lowerCaseAddress(params.token.address.value)] + return this.record[this._formatRecordKey(params.token.address.value)] } } diff --git a/sdk/protocol-plugins/src/plugins/spark/implementation/SparkDebtConfigMap.ts b/sdk/protocol-plugins/src/plugins/spark/implementation/SparkDebtConfigMap.ts index dafdb0ceba..6bba68b7e4 100644 --- a/sdk/protocol-plugins/src/plugins/spark/implementation/SparkDebtConfigMap.ts +++ b/sdk/protocol-plugins/src/plugins/spark/implementation/SparkDebtConfigMap.ts @@ -21,11 +21,11 @@ export class SparkDebtConfigMap extends DebtConfigMap implements ISparkDebtConfi } public override add(params: { debt: IToken; debtConfig: ISparkDebtConfig }): void { - this.record[this._lowerCaseAddress(params.debt.address.value)] = SparkDebtConfig.createFrom(params.debtConfig) + this.record[this._formatRecordKey(params.debt.address.value)] = SparkDebtConfig.createFrom(params.debtConfig) } public override get(params: { token: IToken }): Maybe { - return this.record[this._lowerCaseAddress(params.token.address.value)] + return this.record[this._formatRecordKey(params.token.address.value)] } } diff --git a/sdk/sdk-common/src/protocols/implementation/CollateralConfigMap.ts b/sdk/sdk-common/src/protocols/implementation/CollateralConfigMap.ts index 51e4c3a86e..2a2940e4de 100644 --- a/sdk/sdk-common/src/protocols/implementation/CollateralConfigMap.ts +++ b/sdk/sdk-common/src/protocols/implementation/CollateralConfigMap.ts @@ -21,13 +21,13 @@ export class CollateralConfigMap implements ICollateralConfigMap { } public add(params: { collateral: IToken; collateralConfig: ICollateralConfig }): void { - this.record[this._lowerCaseAddress(params.collateral.address.value)] = CollateralConfig.createFrom( + this.record[this._formatRecordKey(params.collateral.address.value)] = CollateralConfig.createFrom( params.collateralConfig, ) } public get(params: { token: IToken }): Maybe { - return this.record[this._lowerCaseAddress(params.token.address.value)] + return this.record[this._formatRecordKey(params.token.address.value)] } protected _importCollateralConfigMap(params: ICollateralConfigMap): void { @@ -36,7 +36,7 @@ export class CollateralConfigMap implements ICollateralConfigMap { }) } - protected _lowerCaseAddress(address: HexData) { + protected _formatRecordKey(address: HexData) { return address.toLowerCase() as HexData } } diff --git a/sdk/sdk-common/src/protocols/implementation/DebtConfigMap.ts b/sdk/sdk-common/src/protocols/implementation/DebtConfigMap.ts index bc6b6b1ded..adeeb35372 100644 --- a/sdk/sdk-common/src/protocols/implementation/DebtConfigMap.ts +++ b/sdk/sdk-common/src/protocols/implementation/DebtConfigMap.ts @@ -22,11 +22,11 @@ export class DebtConfigMap implements IDebtConfigMap { } public add(params: { debt: IToken; debtConfig: IDebtConfig }): void { - this.record[this._lowerCaseAddress(params.debt.address.value)] = DebtConfig.createFrom(params.debtConfig) + this.record[this._formatRecordKey(params.debt.address.value)] = DebtConfig.createFrom(params.debtConfig) } public get(params: { token: IToken }): Maybe { - return this.record[this._lowerCaseAddress(params.token.address.value)] + return this.record[this._formatRecordKey(params.token.address.value)] } protected _importDebtConfigMap(params: IDebtConfigMap): void { @@ -35,7 +35,7 @@ export class DebtConfigMap implements IDebtConfigMap { }) } - protected _lowerCaseAddress(address: HexData) { + protected _formatRecordKey(address: HexData) { return address.toLowerCase() as HexData } } From fd4022ebf556fb5167485d943df49c619da6a213 Mon Sep 17 00:00:00 2001 From: James Tuckett Date: Mon, 22 Apr 2024 11:13:37 +0100 Subject: [PATCH 4/5] fix: circular import --- .../src/protocols/implementation/CollateralConfigMap.ts | 2 +- sdk/sdk-common/src/protocols/implementation/DebtConfigMap.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sdk/sdk-common/src/protocols/implementation/CollateralConfigMap.ts b/sdk/sdk-common/src/protocols/implementation/CollateralConfigMap.ts index 2a2940e4de..f43cbb471e 100644 --- a/sdk/sdk-common/src/protocols/implementation/CollateralConfigMap.ts +++ b/sdk/sdk-common/src/protocols/implementation/CollateralConfigMap.ts @@ -1,4 +1,4 @@ -import {HexData} from "../../common"; +import {HexData} from "../../common/aliases/HexData"; import { AddressValue } from '../../common/aliases/AddressValue' import { Maybe } from '../../common/aliases/Maybe' import { IToken } from '../../common/interfaces/IToken' diff --git a/sdk/sdk-common/src/protocols/implementation/DebtConfigMap.ts b/sdk/sdk-common/src/protocols/implementation/DebtConfigMap.ts index adeeb35372..e272a0cf96 100644 --- a/sdk/sdk-common/src/protocols/implementation/DebtConfigMap.ts +++ b/sdk/sdk-common/src/protocols/implementation/DebtConfigMap.ts @@ -1,4 +1,4 @@ -import {HexData} from "../../common"; +import {HexData} from "../../common/aliases/HexData"; import { AddressValue } from '../../common/aliases/AddressValue' import { Maybe } from '../../common/aliases/Maybe' import { IToken } from '../../common/interfaces/IToken' From 1a49a8ea2895aa00c582fbff34aabccb908ab05e Mon Sep 17 00:00:00 2001 From: James Tuckett Date: Mon, 22 Apr 2024 11:19:13 +0100 Subject: [PATCH 5/5] chore: format fix --- .../aave-v3/implementation/AaveV3CollateralConfigMap.ts | 5 ++--- .../plugins/aave-v3/implementation/AaveV3DebtConfigMap.ts | 4 +++- .../maker/implementation/MakerCollateralConfigMap.ts | 5 ++--- .../src/plugins/maker/implementation/MakerDebtConfigMap.ts | 4 +++- .../spark/implementation/SparkCollateralConfigMap.ts | 5 ++--- .../src/plugins/spark/implementation/SparkDebtConfigMap.ts | 4 +++- .../tests/integration/SparkProtocolPlugin.spec.ts | 2 +- .../src/protocols/implementation/CollateralConfigMap.ts | 7 +++---- .../src/protocols/implementation/DebtConfigMap.ts | 6 ++++-- 9 files changed, 23 insertions(+), 19 deletions(-) diff --git a/sdk/protocol-plugins/src/plugins/aave-v3/implementation/AaveV3CollateralConfigMap.ts b/sdk/protocol-plugins/src/plugins/aave-v3/implementation/AaveV3CollateralConfigMap.ts index cdfe39e6bd..c7f67806c8 100644 --- a/sdk/protocol-plugins/src/plugins/aave-v3/implementation/AaveV3CollateralConfigMap.ts +++ b/sdk/protocol-plugins/src/plugins/aave-v3/implementation/AaveV3CollateralConfigMap.ts @@ -27,9 +27,8 @@ export class AaveV3CollateralConfigMap collateral: IToken collateralConfig: IAaveV3CollateralConfig }): void { - this.record[this._formatRecordKey(params.collateral.address.value)] = AaveV3CollateralConfig.createFrom( - params.collateralConfig, - ) + this.record[this._formatRecordKey(params.collateral.address.value)] = + AaveV3CollateralConfig.createFrom(params.collateralConfig) } public override get(params: { token: IToken }): Maybe { diff --git a/sdk/protocol-plugins/src/plugins/aave-v3/implementation/AaveV3DebtConfigMap.ts b/sdk/protocol-plugins/src/plugins/aave-v3/implementation/AaveV3DebtConfigMap.ts index 8920996947..42068b0cbd 100644 --- a/sdk/protocol-plugins/src/plugins/aave-v3/implementation/AaveV3DebtConfigMap.ts +++ b/sdk/protocol-plugins/src/plugins/aave-v3/implementation/AaveV3DebtConfigMap.ts @@ -21,7 +21,9 @@ export class AaveV3DebtConfigMap extends DebtConfigMap implements IAaveV3DebtCon } public override add(params: { debt: IToken; debtConfig: IAaveV3DebtConfig }): void { - this.record[this._formatRecordKey(params.debt.address.value)] = AaveV3DebtConfig.createFrom(params.debtConfig) + this.record[this._formatRecordKey(params.debt.address.value)] = AaveV3DebtConfig.createFrom( + params.debtConfig, + ) } public override get(params: { token: IToken }): Maybe { diff --git a/sdk/protocol-plugins/src/plugins/maker/implementation/MakerCollateralConfigMap.ts b/sdk/protocol-plugins/src/plugins/maker/implementation/MakerCollateralConfigMap.ts index 39268b3c1b..90fb3ba19a 100644 --- a/sdk/protocol-plugins/src/plugins/maker/implementation/MakerCollateralConfigMap.ts +++ b/sdk/protocol-plugins/src/plugins/maker/implementation/MakerCollateralConfigMap.ts @@ -27,9 +27,8 @@ export class MakerCollateralConfigMap collateral: IToken collateralConfig: IMakerCollateralConfig }): void { - this.record[this._formatRecordKey(params.collateral.address.value)] = MakerCollateralConfig.createFrom( - params.collateralConfig, - ) + this.record[this._formatRecordKey(params.collateral.address.value)] = + MakerCollateralConfig.createFrom(params.collateralConfig) } public override get(params: { token: IToken }): Maybe { diff --git a/sdk/protocol-plugins/src/plugins/maker/implementation/MakerDebtConfigMap.ts b/sdk/protocol-plugins/src/plugins/maker/implementation/MakerDebtConfigMap.ts index f50a5c5e4c..5e240bccfd 100644 --- a/sdk/protocol-plugins/src/plugins/maker/implementation/MakerDebtConfigMap.ts +++ b/sdk/protocol-plugins/src/plugins/maker/implementation/MakerDebtConfigMap.ts @@ -21,7 +21,9 @@ export class MakerDebtConfigMap extends DebtConfigMap implements IMakerDebtConfi } public override add(params: { debt: IToken; debtConfig: IMakerDebtConfig }): void { - this.record[this._formatRecordKey(params.debt.address.value)] = MakerDebtConfig.createFrom(params.debtConfig) + this.record[this._formatRecordKey(params.debt.address.value)] = MakerDebtConfig.createFrom( + params.debtConfig, + ) } public override get(params: { token: IToken }): Maybe { diff --git a/sdk/protocol-plugins/src/plugins/spark/implementation/SparkCollateralConfigMap.ts b/sdk/protocol-plugins/src/plugins/spark/implementation/SparkCollateralConfigMap.ts index 345adb6b6d..fe24746b36 100644 --- a/sdk/protocol-plugins/src/plugins/spark/implementation/SparkCollateralConfigMap.ts +++ b/sdk/protocol-plugins/src/plugins/spark/implementation/SparkCollateralConfigMap.ts @@ -27,9 +27,8 @@ export class SparkCollateralConfigMap collateral: IToken collateralConfig: ISparkCollateralConfig }): void { - this.record[this._formatRecordKey(params.collateral.address.value)] = SparkCollateralConfig.createFrom( - params.collateralConfig, - ) + this.record[this._formatRecordKey(params.collateral.address.value)] = + SparkCollateralConfig.createFrom(params.collateralConfig) } public override get(params: { token: IToken }): Maybe { diff --git a/sdk/protocol-plugins/src/plugins/spark/implementation/SparkDebtConfigMap.ts b/sdk/protocol-plugins/src/plugins/spark/implementation/SparkDebtConfigMap.ts index 6bba68b7e4..7f9a3518b5 100644 --- a/sdk/protocol-plugins/src/plugins/spark/implementation/SparkDebtConfigMap.ts +++ b/sdk/protocol-plugins/src/plugins/spark/implementation/SparkDebtConfigMap.ts @@ -21,7 +21,9 @@ export class SparkDebtConfigMap extends DebtConfigMap implements ISparkDebtConfi } public override add(params: { debt: IToken; debtConfig: ISparkDebtConfig }): void { - this.record[this._formatRecordKey(params.debt.address.value)] = SparkDebtConfig.createFrom(params.debtConfig) + this.record[this._formatRecordKey(params.debt.address.value)] = SparkDebtConfig.createFrom( + params.debtConfig, + ) } public override get(params: { token: IToken }): Maybe { diff --git a/sdk/protocol-plugins/tests/integration/SparkProtocolPlugin.spec.ts b/sdk/protocol-plugins/tests/integration/SparkProtocolPlugin.spec.ts index 1053267fb4..ecafe1c5a9 100644 --- a/sdk/protocol-plugins/tests/integration/SparkProtocolPlugin.spec.ts +++ b/sdk/protocol-plugins/tests/integration/SparkProtocolPlugin.spec.ts @@ -8,7 +8,7 @@ import { TokenAmount, Percentage, } from '@summerfi/sdk-common/common' -import {SparkLendingPool, SparkProtocolPlugin} from '../../src/plugins/spark' +import { SparkLendingPool, SparkProtocolPlugin } from '../../src/plugins/spark' import { sparkPoolIdMock as validSparkPoolId } from '../mocks/SparkPoolIdMock' import { createProtocolPluginContext } from '../utils/CreateProtocolPluginContext' diff --git a/sdk/sdk-common/src/protocols/implementation/CollateralConfigMap.ts b/sdk/sdk-common/src/protocols/implementation/CollateralConfigMap.ts index f43cbb471e..b8627a1c1b 100644 --- a/sdk/sdk-common/src/protocols/implementation/CollateralConfigMap.ts +++ b/sdk/sdk-common/src/protocols/implementation/CollateralConfigMap.ts @@ -1,4 +1,4 @@ -import {HexData} from "../../common/aliases/HexData"; +import { HexData } from '../../common/aliases/HexData' import { AddressValue } from '../../common/aliases/AddressValue' import { Maybe } from '../../common/aliases/Maybe' import { IToken } from '../../common/interfaces/IToken' @@ -21,9 +21,8 @@ export class CollateralConfigMap implements ICollateralConfigMap { } public add(params: { collateral: IToken; collateralConfig: ICollateralConfig }): void { - this.record[this._formatRecordKey(params.collateral.address.value)] = CollateralConfig.createFrom( - params.collateralConfig, - ) + this.record[this._formatRecordKey(params.collateral.address.value)] = + CollateralConfig.createFrom(params.collateralConfig) } public get(params: { token: IToken }): Maybe { diff --git a/sdk/sdk-common/src/protocols/implementation/DebtConfigMap.ts b/sdk/sdk-common/src/protocols/implementation/DebtConfigMap.ts index e272a0cf96..e4f0e59081 100644 --- a/sdk/sdk-common/src/protocols/implementation/DebtConfigMap.ts +++ b/sdk/sdk-common/src/protocols/implementation/DebtConfigMap.ts @@ -1,4 +1,4 @@ -import {HexData} from "../../common/aliases/HexData"; +import { HexData } from '../../common/aliases/HexData' import { AddressValue } from '../../common/aliases/AddressValue' import { Maybe } from '../../common/aliases/Maybe' import { IToken } from '../../common/interfaces/IToken' @@ -22,7 +22,9 @@ export class DebtConfigMap implements IDebtConfigMap { } public add(params: { debt: IToken; debtConfig: IDebtConfig }): void { - this.record[this._formatRecordKey(params.debt.address.value)] = DebtConfig.createFrom(params.debtConfig) + this.record[this._formatRecordKey(params.debt.address.value)] = DebtConfig.createFrom( + params.debtConfig, + ) } public get(params: { token: IToken }): Maybe {