Skip to content

Commit

Permalink
chore: fully export aave and spark depositBorrow strategies
Browse files Browse the repository at this point in the history
  • Loading branch information
zerotucks committed Aug 25, 2023
1 parent d6e0297 commit d9076f6
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,12 @@ async function buildOperation(
dependencies: AaveLikeDepositBorrowDependencies,
): Promise<IOperation> {
const positionType: PositionType = 'Borrow'
const protocolOperations = resolveAaveLikeOperations(dependencies.protocolType, positionType)
const aaveLikeBorrowOperations = resolveAaveLikeOperations(
dependencies.protocolType,
positionType,
)

return protocolOperations.depositBorrow(
return aaveLikeBorrowOperations.depositBorrow(
depositArgs,
borrowArgs,
dependencies.addresses,
Expand Down
3 changes: 3 additions & 0 deletions packages/dma-library/src/strategies/index.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import { aave } from './aave'
import { ajna } from './ajna'
import buckets from './ajna/earn/buckets.json'
import { spark } from './spark'

export const strategies: {
aave: typeof aave
ajna: typeof ajna
spark: typeof spark
} = {
aave,
ajna,
spark,
}

export const ajnaBuckets = buckets
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { aaveLike } from '@dma-library/strategies/aave-like'

import { SparkDepositBorrow } from './types'

export const depositBorrow: SparkDepositBorrow = async (args, dependencies) => {
const protocolType = 'Spark' as const
return await aaveLike.borrow.depositBorrow(args, { ...dependencies, protocolType })
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { depositBorrow } from './deposit-borrow'
export { SparkDepositBorrow } from './types'
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import * as Strategies from '@dma-library/types/strategies'
import * as StrategyParams from '@dma-library/types/strategy-params'

export type SparkDepositBorrowArgs = StrategyParams.WithAaveLikeBorrowStrategyArgs &
StrategyParams.WithAaveLikeEntryToken &
StrategyParams.WithDepositCollateral &
StrategyParams.WithBorrowDebt

export type SparkDepositBorrowDependencies = StrategyParams.WithAaveLikeStrategyDependencies &
StrategyParams.WithOptionalSwap

export type IDepositBorrowStrategy = Strategies.IStrategy & {
simulation: Strategies.IStrategy['simulation'] & Strategies.WithOptionalSwapSimulation
}

export type SparkDepositBorrow = (
args: SparkDepositBorrowArgs,
dependencies: SparkDepositBorrowDependencies,
) => Promise<IDepositBorrowStrategy>
9 changes: 9 additions & 0 deletions packages/dma-library/src/strategies/spark/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { SparkDepositBorrow } from '@dma-library/strategies/spark/borrow/deposit-borrow/types'

import { depositBorrow as sparkDepositBorrow } from './borrow/deposit-borrow'

export const spark: {
depositBorrow: SparkDepositBorrow
} = {
depositBorrow: sparkDepositBorrow,
}
4 changes: 4 additions & 0 deletions packages/dma-library/src/types/strategy-params.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ export type WithAaveEntryToken = {
entryToken: { symbol: AAVETokens; precision?: number }
}

export type WithAaveLikeEntryToken = {
entryToken: { symbol: AaveLikeTokens; precision?: number }
}

export type WithAaveStrategyArgs = {
collateralToken: { symbol: AAVETokens; precision?: number }
debtToken: { symbol: AAVETokens; precision?: number }
Expand Down

0 comments on commit d9076f6

Please sign in to comment.