Skip to content

Commit

Permalink
Merge pull request #26 from mangrovedao/feat/maxence/logicInOverlying
Browse files Browse the repository at this point in the history
feat: added logic to overlying
  • Loading branch information
maxencerb authored May 6, 2024
2 parents e7eccd7 + 9f28bcb commit d933a3a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changeset/shy-shrimps-clean.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@mangrovedao/mgv": patch
---

Added logic inside of the overlying in `GetBalanceResult`
13 changes: 8 additions & 5 deletions src/actions/balances.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { multicall } from 'viem/actions'
import type { Logic, OverlyingResponse } from '../addresses/logics/utils.js'
import type { Token } from '../addresses/tokens/utils.js'
import type { MarketParams } from '../types/actions/index.js'
import type { Prettify } from '../types/lib.js'
import { getAction } from '../utils/getAction.js'

/**
Expand All @@ -29,14 +28,18 @@ export type GetBalancesArgs<TLogics extends Logic[] = Logic[]> =
GetBalancesParams<TLogics> &
Omit<MulticallParameters, 'allowFailure' | 'contracts'>

type ExtendedOverlyingResponse = Prettify<OverlyingResponse & { token: Token }>

export type GetBalanceResult<TLogics extends Logic[] = Logic[]> = {
tokens: {
token: Token
balance: bigint
}[]
overlying: ExtendedOverlyingResponse[]
overlying: {
type: 'erc20' | 'erc721'
overlying: Address
available: boolean
token: Token
logic: TLogics[number]
}[]
logicBalances: {
token: Token
logic: TLogics[number]
Expand Down Expand Up @@ -117,7 +120,7 @@ export async function getBalances<TLogics extends Logic[] = Logic[]>(
overlying: zeroAddress,
available: false,
}
return { token, ...overlying }
return { token, logic, ...overlying }
}),
)

Expand Down

0 comments on commit d933a3a

Please sign in to comment.