@metamask-institutional/defi-adapters / IProtocolAdapter / IProtocolAdapter
IProtocolAdapter.IProtocolAdapter
- getProtocolDetails
- getProtocolTokens
- getPositions
- getProtocolTokenToUnderlyingTokenRate
- getWithdrawals
- getDeposits
- getTotalValueLocked
- getProfits
- getApy
- getApr
• protocolId: Protocol
Unique identifier of the protocol.
• chainId: Chain
Unique identifier of the blockchain network.
• productId: string
Unique identifier for this protocol adapter
▸ getProtocolDetails(): ProtocolDetails
Object containing details about the protocol such as name and description.
Remarks
Returns high level metadata for the protocol
▸ getProtocolTokens(): Promise
<Erc20Metadata
[]>
An array of objects detailing the protocol tokens.
Remarks
Returns array of pool tokens (lp tokens) for the protocol
▸ getPositions(input
): Promise
<ProtocolPosition
[]>
Name | Type | Description |
---|---|---|
input |
GetPositionsInput |
Object with user-address and optional blockNumber override. |
An array of objects detailing the user positions.
Remarks
Returns array of user positions opened in this protocol
▸ getProtocolTokenToUnderlyingTokenRate(input
): Promise
<ProtocolTokenUnderlyingRate
>
Name | Type | Description |
---|---|---|
input |
GetConversionRateInput |
Object with protocol-token-address and optional blockNumber override. |
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
▸ getWithdrawals(input
): Promise
<MovementsByBlock
[]>
Name | Type | Description |
---|---|---|
input |
GetEventsInput |
Object specifying user-address, protocol-token-address (pool), and the block range. |
Array of objects detailing withdrawal events within the specified block range.
Remarks
Returns the user's withdrawals from a position
▸ getDeposits(input
): Promise
<MovementsByBlock
[]>
Name | Type | Description |
---|---|---|
input |
GetEventsInput |
Object specifying user-address, protocol-token-address (pool), and the block range. |
Array of objects detailing deposit events within the specified block range.
Remarks
Returns the user's deposits to a position
▸ getTotalValueLocked(input
): Promise
<ProtocolTokenTvl
[]>
Name | Type | Description |
---|---|---|
input |
GetTotalValueLockedInput |
Object with optional blockNumber override. |
An array of objects detailing the total value locked in each protocol pool.
Remarks
Returns the Tvl per pool defined in the underlying token
▸ getProfits(input
): Promise
<ProfitsWithRange
>
Name | Type | Description |
---|---|---|
input |
GetProfitsInput |
Object specifying user-address and the block range for the profit calculation. |
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.
▸ getApy(input
): Promise
<ProtocolTokenApy
>
Name | Type | Description |
---|---|---|
input |
GetApyInput |
Object with protocol-token-address and optional blockNumber override. |
Object detailing the Annual Percentage Yield for each protocol pool without reward APY.
Remarks
Returns Apy per pool
▸ getApr(input
): Promise
<ProtocolTokenApr
>
Name | Type | Description |
---|---|---|
input |
GetAprInput |
Object with protocol-token-address and optional blockNumber override. |
Object detailing the Annual Percentage Rate without reward APR for each protocol pool.
Remarks
Returns Apr made per pool