Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding AdditionalMetadata config #3

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[
{
"address": "0x59D9356E565Ab3A36dD77763Fc0d87fEaf85508C",
"name": "Mountain Protocol USD",
"symbol": "USDM",
"decimals": 18,
"underlyingTokens": [
{
"address": "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
"symbol": "USDC",
"name": "Token USDC",
"decimals": 6
}
]
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[
{
"address": "0x59D9356E565Ab3A36dD77763Fc0d87fEaf85508C",
"name": "Mountain Protocol USD",
"symbol": "USDM",
"decimals": 18,
"underlyingTokens": [
{
"address": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
"symbol": "USDC",
"name": "Token USDC",
"decimals": 6
}
]
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[
{
"address": "0x59D9356E565Ab3A36dD77763Fc0d87fEaf85508C",
"name": "Mountain Protocol USD",
"symbol": "USDM",
"decimals": 18,
"underlyingTokens": [
{
"address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"symbol": "USDC",
"name": "Token USDC",
"decimals": 6
}
]
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[
{
"address": "0x59D9356E565Ab3A36dD77763Fc0d87fEaf85508C",
"name": "Mountain Protocol USD",
"symbol": "USDM",
"decimals": 18,
"underlyingTokens": [
{
"address": "0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85",
"symbol": "USDC",
"name": "Token USDC",
"decimals": 6
}
]
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[
{
"address": "0x59D9356E565Ab3A36dD77763Fc0d87fEaf85508C",
"name": "Mountain Protocol USD",
"symbol": "USDM",
"decimals": 18,
"underlyingTokens": [
{
"address": "0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359",
"symbol": "USDC",
"name": "Token USDC",
"decimals": 6
}
]
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export class MountainProtocolUsdmAdapter extends SimplePoolAdapter<AdditionalMet
address: this.getUSDCAddress(),
symbol: 'USDC',
name: 'USD Coin',
decimals: 18,
decimals: 6,
},
],
},
Expand Down Expand Up @@ -103,7 +103,7 @@ export class MountainProtocolUsdmAdapter extends SimplePoolAdapter<AdditionalMet

const underlyingTokenBalance = {
...underlyingToken!,
balanceRaw: protocolTokenBalance.balanceRaw,
balanceRaw: BigInt(1 ** 6),
type: TokenType.Underlying,
}

Expand All @@ -117,8 +117,10 @@ export class MountainProtocolUsdmAdapter extends SimplePoolAdapter<AdditionalMet
PROTOCOL_TOKEN_ADDRESS,
)

// Always pegged one to one to underlying
const pricePerShareRaw = BigInt(10 ** protocolTokenMetadata.decimals)
// Not really clear how this works, but it seems that using USDC shares makes it work
// Basically if we were to set this to BigInt(10 ** 18) as any other ERC20
// The balance would add 12 extra 0's
const pricePerShareRaw = BigInt(10 ** underlyingToken!.decimals)

return [
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[
{
"address": "0x57F5E098CaD7A3D1Eed53991D4d66C45C9AF7812",
"name": "Wrapped Mountain Protocol USD",
"symbol": "wUSDM",
"decimals": 18,
"underlyingTokens": [
{
"address": "0x59D9356E565Ab3A36dD77763Fc0d87fEaf85508C",
"symbol": "USDM",
"name": "Mountain Protocol USD",
"decimals": 18
}
]
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[
{
"address": "0x57F5E098CaD7A3D1Eed53991D4d66C45C9AF7812",
"name": "Wrapped Mountain Protocol USD",
"symbol": "wUSDM",
"decimals": 18,
"underlyingTokens": [
{
"address": "0x59D9356E565Ab3A36dD77763Fc0d87fEaf85508C",
"symbol": "USDM",
"name": "Mountain Protocol USD",
"decimals": 18
}
]
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[
{
"address": "0x57F5E098CaD7A3D1Eed53991D4d66C45C9AF7812",
"name": "Wrapped Mountain Protocol USD",
"symbol": "wUSDM",
"decimals": 18,
"underlyingTokens": [
{
"address": "0x59D9356E565Ab3A36dD77763Fc0d87fEaf85508C",
"symbol": "USDM",
"name": "Mountain Protocol USD",
"decimals": 18
}
]
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[
{
"address": "0x57F5E098CaD7A3D1Eed53991D4d66C45C9AF7812",
"name": "Wrapped Mountain Protocol USD",
"symbol": "wUSDM",
"decimals": 18,
"underlyingTokens": [
{
"address": "0x59D9356E565Ab3A36dD77763Fc0d87fEaf85508C",
"symbol": "USDM",
"name": "Mountain Protocol USD",
"decimals": 18
}
]
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[
{
"address": "0x57F5E098CaD7A3D1Eed53991D4d66C45C9AF7812",
"name": "Wrapped Mountain Protocol USD",
"symbol": "wUSDM",
"decimals": 18,
"underlyingTokens": [
{
"address": "0x59D9356E565Ab3A36dD77763Fc0d87fEaf85508C",
"symbol": "USDM",
"name": "Mountain Protocol USD",
"decimals": 18
}
]
}
]
111 changes: 111 additions & 0 deletions packages/adapters-library/src/core/metadata/AdapterMetadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,27 @@ import StakeWiseOsEthEthereumProtocolToken from '../../adapters/stakewise/produc
import SwellSwEthEthereumProtocolToken from '../../adapters/swell/products/sw-eth/metadata/ethereum.protocol-token.json'

import LidoWstEthEthereumProtocolToken from '../../adapters/lido/products/wst-eth/metadata/ethereum.protocol-token.json'

import MountainProtocolUSDMEthereumProtocolToken from '../../adapters/mountain-protocol/products/usdm/metadata/ethereum.protocol-token.json'

import MountainProtocolUSDMArbitrumProtocolToken from '../../adapters/mountain-protocol/products/usdm/metadata/arbitrum.protocol-token.json'

import MountainProtocolUSDMPolygonProtocolToken from '../../adapters/mountain-protocol/products/usdm/metadata/polygon.protocol-token.json'

import MountainProtocolUSDMBaseProtocolToken from '../../adapters/mountain-protocol/products/usdm/metadata/base.protocol-token.json'

import MountainProtocolUSDMOptimismProtocolToken from '../../adapters/mountain-protocol/products/usdm/metadata/optimism.protocol-token.json'

import MountainProtocolWUSDMEthereumProtocolToken from '../../adapters/mountain-protocol/products/wusdm/metadata/ethereum.protocol-token.json'

import MountainProtocolWUSDMBaseProtocolToken from '../../adapters/mountain-protocol/products/wusdm/metadata/base.protocol-token.json'

import MountainProtocolWUSDMArbitrumProtocolToken from '../../adapters/mountain-protocol/products/wusdm/metadata/arbitrum.protocol-token.json'

import MountainProtocolWUSDMPolygonProtocolToken from '../../adapters/mountain-protocol/products/wusdm/metadata/polygon.protocol-token.json'

import MountainProtocolWUSDMOptimismProtocolToken from '../../adapters/mountain-protocol/products/wusdm/metadata/optimism.protocol-token.json'

import MorphoBlueVaultEthereumProtocolToken from '../../adapters/morpho-blue/products/vault/metadata/ethereum.protocol-token.json'

import MorphoBlueMarketSupplyBaseMarketSupply from '../../adapters/morpho-blue/products/market-supply/metadata/base.market-supply.json'
Expand Down Expand Up @@ -1353,6 +1374,96 @@ export const MetadataFiles = new Map<string, Json>([
}),
MorphoCompoundV2OptimizerSupplyEthereumOptimizerSupply,
],
[
metadataKey({
protocolId: Protocol.MountainProtocol,
productId: 'usdm',
chainId: Chain.Ethereum,
fileKey: 'protocol-token',
}),
MountainProtocolUSDMEthereumProtocolToken,
],
[
metadataKey({
protocolId: Protocol.MountainProtocol,
productId: 'usdm',
chainId: Chain.Polygon,
fileKey: 'protocol-token',
}),
MountainProtocolUSDMPolygonProtocolToken,
],
[
metadataKey({
protocolId: Protocol.MountainProtocol,
productId: 'usdm',
chainId: Chain.Arbitrum,
fileKey: 'protocol-token',
}),
MountainProtocolUSDMArbitrumProtocolToken,
],
[
metadataKey({
protocolId: Protocol.MountainProtocol,
productId: 'usdm',
chainId: Chain.Optimism,
fileKey: 'protocol-token',
}),
MountainProtocolUSDMOptimismProtocolToken,
],
[
metadataKey({
protocolId: Protocol.MountainProtocol,
productId: 'usdm',
chainId: Chain.Base,
fileKey: 'protocol-token',
}),
MountainProtocolUSDMBaseProtocolToken,
],
[
metadataKey({
protocolId: Protocol.MountainProtocol,
productId: 'wusdm',
chainId: Chain.Ethereum,
fileKey: 'protocol-token',
}),
MountainProtocolWUSDMEthereumProtocolToken,
],
[
metadataKey({
protocolId: Protocol.MountainProtocol,
productId: 'wusdm',
chainId: Chain.Polygon,
fileKey: 'protocol-token',
}),
MountainProtocolWUSDMPolygonProtocolToken,
],
[
metadataKey({
protocolId: Protocol.MountainProtocol,
productId: 'wusdm',
chainId: Chain.Arbitrum,
fileKey: 'protocol-token',
}),
MountainProtocolWUSDMArbitrumProtocolToken,
],
[
metadataKey({
protocolId: Protocol.MountainProtocol,
productId: 'wusdm',
chainId: Chain.Optimism,
fileKey: 'protocol-token',
}),
MountainProtocolWUSDMOptimismProtocolToken,
],
[
metadataKey({
protocolId: Protocol.MountainProtocol,
productId: 'wusdm',
chainId: Chain.Base,
fileKey: 'protocol-token',
}),
MountainProtocolWUSDMBaseProtocolToken,
],
[
metadataKey({
protocolId: Protocol.PancakeswapV2,
Expand Down