Skip to content

Latest commit

 

History

History
310 lines (169 loc) · 10.2 KB

IProtocolAdapter.IProtocolAdapter.md

File metadata and controls

310 lines (169 loc) · 10.2 KB

@metamask-institutional/defi-adapters / IProtocolAdapter / IProtocolAdapter

Interface: IProtocolAdapter

IProtocolAdapter.IProtocolAdapter

Table of contents

Properties

Methods

Properties

protocolId

protocolId: Protocol

Unique identifier of the protocol.

Defined in

IProtocolAdapter.ts:26


chainId

chainId: Chain

Unique identifier of the blockchain network.

Defined in

IProtocolAdapter.ts:31


productId

productId: string

Unique identifier for this protocol adapter

Defined in

IProtocolAdapter.ts:36

Methods

getProtocolDetails

getProtocolDetails(): ProtocolDetails

Returns

ProtocolDetails

Object containing details about the protocol such as name and description.

Remarks

Returns high level metadata for the protocol

Defined in

IProtocolAdapter.ts:43


getProtocolTokens

getProtocolTokens(): Promise<Erc20Metadata[]>

Returns

Promise<Erc20Metadata[]>

An array of objects detailing the protocol tokens.

Remarks

Returns array of pool tokens (lp tokens) for the protocol

Defined in

IProtocolAdapter.ts:50


getPositions

getPositions(input): Promise<ProtocolPosition[]>

Parameters

Name Type Description
input GetPositionsInput Object with user-address and optional blockNumber override.

Returns

Promise<ProtocolPosition[]>

An array of objects detailing the user positions.

Remarks

Returns array of user positions opened in this protocol

Defined in

IProtocolAdapter.ts:59


getProtocolTokenToUnderlyingTokenRate

getProtocolTokenToUnderlyingTokenRate(input): Promise<ProtocolTokenUnderlyingRate>

Parameters

Name Type Description
input GetConversionRateInput Object with protocol-token-address and optional blockNumber override.

Returns

Promise<ProtocolTokenUnderlyingRate>

Object detailing the price per share of the protocol token.

Remarks

Returns "price" of lp-tokens in the form of the underlying tokens

Defined in

IProtocolAdapter.ts:68


getWithdrawals

getWithdrawals(input): Promise<MovementsByBlock[]>

Parameters

Name Type Description
input GetEventsInput Object specifying user-address, protocol-token-address (pool), and the block range.

Returns

Promise<MovementsByBlock[]>

Array of objects detailing withdrawal events within the specified block range.

Remarks

Returns the user's withdrawals from a position

Defined in

IProtocolAdapter.ts:79


getDeposits

getDeposits(input): Promise<MovementsByBlock[]>

Parameters

Name Type Description
input GetEventsInput Object specifying user-address, protocol-token-address (pool), and the block range.

Returns

Promise<MovementsByBlock[]>

Array of objects detailing deposit events within the specified block range.

Remarks

Returns the user's deposits to a position

Defined in

IProtocolAdapter.ts:88


getTotalValueLocked

getTotalValueLocked(input): Promise<ProtocolTokenTvl[]>

Parameters

Name Type Description
input GetTotalValueLockedInput Object with optional blockNumber override.

Returns

Promise<ProtocolTokenTvl[]>

An array of objects detailing the total value locked in each protocol pool.

Remarks

Returns the Tvl per pool defined in the underlying token

Defined in

IProtocolAdapter.ts:97


getProfits

getProfits(input): Promise<ProfitsWithRange>

Parameters

Name Type Description
input GetProfitsInput Object specifying user-address and the block range for the profit calculation.

Returns

Promise<ProfitsWithRange>

Object containing the starting and ending block numbers, and an array of objects detailing the profit information for each token.

Remarks

Returns the user's profits made on open positions. Accepts blockNumber override.

Defined in

IProtocolAdapter.ts:108


getApy

getApy(input): Promise<ProtocolTokenApy>

Parameters

Name Type Description
input GetApyInput Object with protocol-token-address and optional blockNumber override.

Returns

Promise<ProtocolTokenApy>

Object detailing the Annual Percentage Yield for each protocol pool without reward APY.

Remarks

Returns Apy per pool

Defined in

IProtocolAdapter.ts:117


getApr

getApr(input): Promise<ProtocolTokenApr>

Parameters

Name Type Description
input GetAprInput Object with protocol-token-address and optional blockNumber override.

Returns

Promise<ProtocolTokenApr>

Object detailing the Annual Percentage Rate without reward APR for each protocol pool.

Remarks

Returns Apr made per pool

Defined in

IProtocolAdapter.ts:126