Skip to content
Merged
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
102 changes: 102 additions & 0 deletions packages/blue-sdk/src/addresses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -716,6 +716,54 @@ const _addressesRegistry = {
chainlinkOracleFactory: "0xc2c167BC5cBD833ce58239e85073258F10aD4DF6",
preLiquidationFactory: "0xB83d2D5CAE5Fc64a408cA82447445442Fe249fe3",
},
[ChainId.EdenMainnet]: {
morpho: "0xF050a2BB0468FF23cF2964AC182196C94D6815C3",
permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
bundler3: {
bundler3: "0x4D403d6a3D25A865Ed57caef884f076E0fa00eCa",
generalAdapter1: "0x9B05CCA3299E3558a324f72aaB4D404625557B3D",
},
adaptiveCurveIrm: "0x08A7b3a39E5425d616Cc9c046cf96B5eF21a139f",
vaultV2Factory: "0x9aaCAA01F5e6BC876D07f023744E3E0A456a64cf",
morphoMarketV1AdapterV2Factory:
"0x59e8C53D383F22b6371b5833504dfAa4136aE6f7",
registryList: "0xB78BA19a8Bf3202DA7036ec1830222FDC5e0297e",
chainlinkOracleFactory: "0xD6202eFF2e869dc473EB13c38Cc787835Bf8B6df",
preLiquidationFactory: "0x83346d9fc31a239Ae1739672AD84A567C7beF529",
wNative: "0x00000000000000000000000000000000ce1E571a",
},
[ChainId.PharosMainnet]: {
morpho: "0x18573fA18fd17dDfD790B4a5B5b2977aad3b4Efb",
permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
bundler3: {
bundler3: "0x3c90c09F8c5d927a117F681fB924952DbbD99120",
generalAdapter1: "0x0A5819708bCAD9C716dFD58ecB58cF91399A53f8",
},
adaptiveCurveIrm: "0xD5E02889C13230458506CC842347c4E62F8cDF3a",
vaultV2Factory: "0x8E01ed1E1A41029b3137FcE9Aa880c0A54827498",
morphoMarketV1AdapterV2Factory:
"0xe510e1fcC429943cA3455A7bfBD79f0307Cd8403",
registryList: "0xbe858d729548eB49BbFA05Acd3674ca8cdaAdD4b",
chainlinkOracleFactory: "0xb8118256d8Aa950ec0B26a0b8Be7C6c1a858f6a3",
preLiquidationFactory: "0x37511F85B0Eff260d429f693247339dC91C76f90",
wNative: "0x52C48d4213107b20bC583832b0d951FB9CA8F0B0",
},
[ChainId.GensynMainnet]: {
morpho: "0x8c45B34999883FF4B47cD3be095D585682cd9227",
permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
bundler3: {
bundler3: "0xE09314FE5Fc41FEc8f3e6042085dD3CeE24c877c",
generalAdapter1: "0x79e6825ccb881d276f988a5dA8125e1c6BEa07Ae",
},
adaptiveCurveIrm: "0x549EFFAE58F9Db253AAF60fbCeC8B4cB74a952A8",
vaultV2Factory: "0xe2558155AEcEF57cAADB98e39b0538ab0ae95693",
morphoMarketV1AdapterV2Factory:
"0x155134544AE2Ec3AB23034BF620538482C5E3c40",
registryList: "0xdaE77f687883D656Aa4dc7fF89c0c891510C61A5",
chainlinkOracleFactory: "0xf9b22d1652ce918CfC5d102269801AFbfEFa85F9",
preLiquidationFactory: "0x57C88ACAbd4Fa19257104ECCF64ccA34e5eB8961",
wNative: "0x4200000000000000000000000000000000000006",
},
} as const;

export type ChainDeployments<Addresses = ChainAddresses> = {
Expand Down Expand Up @@ -1228,6 +1276,51 @@ const _deployments = {
chainlinkOracleFactory: 2375626n,
preLiquidationFactory: 2375010n,
},
[ChainId.EdenMainnet]: {
morpho: 53363569n,
permit2: 52269150n,
bundler3: {
bundler3: 53363569n,
generalAdapter1: 53363569n,
},
adaptiveCurveIrm: 53363569n,
vaultV2Factory: 53366326n,
morphoMarketV1AdapterV2Factory: 53367797n,
registryList: 53367797n,
chainlinkOracleFactory: 53364880n,
preLiquidationFactory: 53364880n,
wNative: 0n,
},
[ChainId.PharosMainnet]: {
morpho: 4202147n,
permit2: 0n,
bundler3: {
bundler3: 4202147n,
generalAdapter1: 4202147n,
},
adaptiveCurveIrm: 4202147n,
vaultV2Factory: 4240410n,
morphoMarketV1AdapterV2Factory: 4240521n,
registryList: 4240521n,
chainlinkOracleFactory: 4202252n,
preLiquidationFactory: 4202252n,
wNative: 1617294n,
},
[ChainId.GensynMainnet]: {
morpho: 7520470n,
permit2: 0n,
bundler3: {
bundler3: 7520470n,
generalAdapter1: 7520470n,
},
adaptiveCurveIrm: 7520470n,
vaultV2Factory: 7520624n,
morphoMarketV1AdapterV2Factory: 7520701n,
registryList: 7520701n,
chainlinkOracleFactory: 7520548n,
preLiquidationFactory: 7520548n,
wNative: 0n,
},
} as const satisfies Record<ChainId, ChainDeployments>;

export type AddressLabel = DottedKeys<(typeof _addressesRegistry)[ChainId]>;
Expand Down Expand Up @@ -1355,6 +1448,15 @@ const _unwrappedTokensMapping: Record<number, Record<Address, Address>> = {
[ChainId.SoneiumMainnet]: {
[_addressesRegistry[ChainId.SoneiumMainnet].wNative]: NATIVE_ADDRESS,
},
[ChainId.EdenMainnet]: {
[_addressesRegistry[ChainId.EdenMainnet].wNative]: NATIVE_ADDRESS,
},
[ChainId.PharosMainnet]: {
[_addressesRegistry[ChainId.PharosMainnet].wNative]: NATIVE_ADDRESS,
},
[ChainId.GensynMainnet]: {
[_addressesRegistry[ChainId.GensynMainnet].wNative]: NATIVE_ADDRESS,
},
};

export function getUnwrappedToken(wrappedToken: Address, chainId: number) {
Expand Down
24 changes: 24 additions & 0 deletions packages/blue-sdk/src/chain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ export enum ChainId {
BscMainnet = 56,
SoneiumMainnet = 1868,
TempoMainnet = 4217,
EdenMainnet = 714,
PharosMainnet = 1672,
GensynMainnet = 685689,
}

export interface ChainMetadata {
Expand Down Expand Up @@ -305,5 +308,26 @@ export namespace ChainUtils {
identifier: "tempo",
hasReliableNativeBalance: false,
},
[ChainId.EdenMainnet]: {
name: "Eden",
id: ChainId.EdenMainnet,
nativeCurrency: { name: "TIA", symbol: "TIA", decimals: 18 },
explorerUrl: "https://eden.blockscout.com",
identifier: "eden",
},
[ChainId.PharosMainnet]: {
name: "Pharos",
id: ChainId.PharosMainnet,
nativeCurrency: { name: "PharosCoin", symbol: "PROS", decimals: 18 },
explorerUrl: "https://pharosscan.xyz",
identifier: "pharos",
},
[ChainId.GensynMainnet]: {
name: "Gensyn",
id: ChainId.GensynMainnet,
nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
explorerUrl: "https://gensyn-mainnet.explorer.alchemy.com",
identifier: "gensyn",
},
} satisfies Record<ChainId, ChainMetadata>;
}
118 changes: 118 additions & 0 deletions packages/blue-sdk/test/unit/addresses.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ import { describe, expect, test } from "vitest";
import {
type ChainAddresses,
ChainId,
NATIVE_ADDRESS,
addresses,
addressesRegistry,
deployments,
getChainAddresses,
getUnwrappedToken,
registerCustomAddresses,
Expand Down Expand Up @@ -82,6 +84,122 @@ describe("addresses", () => {
);
});

test.each([
{
chainId: 685689,
expectedAddresses: {
morpho: "0x8c45B34999883FF4B47cD3be095D585682cd9227",
permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
bundler3: {
bundler3: "0xE09314FE5Fc41FEc8f3e6042085dD3CeE24c877c",
generalAdapter1: "0x79e6825ccb881d276f988a5dA8125e1c6BEa07Ae",
},
adaptiveCurveIrm: "0x549EFFAE58F9Db253AAF60fbCeC8B4cB74a952A8",
vaultV2Factory: "0xe2558155AEcEF57cAADB98e39b0538ab0ae95693",
morphoMarketV1AdapterV2Factory:
"0x155134544AE2Ec3AB23034BF620538482C5E3c40",
registryList: "0xdaE77f687883D656Aa4dc7fF89c0c891510C61A5",
chainlinkOracleFactory: "0xf9b22d1652ce918CfC5d102269801AFbfEFa85F9",
preLiquidationFactory: "0x57C88ACAbd4Fa19257104ECCF64ccA34e5eB8961",
wNative: "0x4200000000000000000000000000000000000006",
},
expectedDeployments: {
morpho: 7520470n,
permit2: 0n,
bundler3: {
bundler3: 7520470n,
generalAdapter1: 7520470n,
},
adaptiveCurveIrm: 7520470n,
vaultV2Factory: 7520624n,
morphoMarketV1AdapterV2Factory: 7520701n,
registryList: 7520701n,
chainlinkOracleFactory: 7520548n,
preLiquidationFactory: 7520548n,
wNative: 0n,
},
},
{
chainId: 1672,
expectedAddresses: {
morpho: "0x18573fA18fd17dDfD790B4a5B5b2977aad3b4Efb",
permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
bundler3: {
bundler3: "0x3c90c09F8c5d927a117F681fB924952DbbD99120",
generalAdapter1: "0x0A5819708bCAD9C716dFD58ecB58cF91399A53f8",
},
adaptiveCurveIrm: "0xD5E02889C13230458506CC842347c4E62F8cDF3a",
vaultV2Factory: "0x8E01ed1E1A41029b3137FcE9Aa880c0A54827498",
morphoMarketV1AdapterV2Factory:
"0xe510e1fcC429943cA3455A7bfBD79f0307Cd8403",
registryList: "0xbe858d729548eB49BbFA05Acd3674ca8cdaAdD4b",
chainlinkOracleFactory: "0xb8118256d8Aa950ec0B26a0b8Be7C6c1a858f6a3",
preLiquidationFactory: "0x37511F85B0Eff260d429f693247339dC91C76f90",
wNative: "0x52C48d4213107b20bC583832b0d951FB9CA8F0B0",
},
expectedDeployments: {
morpho: 4202147n,
permit2: 0n,
bundler3: {
bundler3: 4202147n,
generalAdapter1: 4202147n,
},
adaptiveCurveIrm: 4202147n,
vaultV2Factory: 4240410n,
morphoMarketV1AdapterV2Factory: 4240521n,
registryList: 4240521n,
chainlinkOracleFactory: 4202252n,
preLiquidationFactory: 4202252n,
wNative: 1617294n,
},
},
{
chainId: 714,
expectedAddresses: {
morpho: "0xF050a2BB0468FF23cF2964AC182196C94D6815C3",
permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
bundler3: {
bundler3: "0x4D403d6a3D25A865Ed57caef884f076E0fa00eCa",
generalAdapter1: "0x9B05CCA3299E3558a324f72aaB4D404625557B3D",
},
adaptiveCurveIrm: "0x08A7b3a39E5425d616Cc9c046cf96B5eF21a139f",
vaultV2Factory: "0x9aaCAA01F5e6BC876D07f023744E3E0A456a64cf",
morphoMarketV1AdapterV2Factory:
"0x59e8C53D383F22b6371b5833504dfAa4136aE6f7",
registryList: "0xB78BA19a8Bf3202DA7036ec1830222FDC5e0297e",
chainlinkOracleFactory: "0xD6202eFF2e869dc473EB13c38Cc787835Bf8B6df",
preLiquidationFactory: "0x83346d9fc31a239Ae1739672AD84A567C7beF529",
wNative: "0x00000000000000000000000000000000ce1E571a",
},
expectedDeployments: {
morpho: 53363569n,
permit2: 52269150n,
bundler3: {
bundler3: 53363569n,
generalAdapter1: 53363569n,
},
adaptiveCurveIrm: 53363569n,
vaultV2Factory: 53366326n,
morphoMarketV1AdapterV2Factory: 53367797n,
registryList: 53367797n,
chainlinkOracleFactory: 53364880n,
preLiquidationFactory: 53364880n,
wNative: 0n,
},
},
])(
"should expose era-2 addresses for chain $chainId",
({ chainId, expectedAddresses, expectedDeployments }) => {
expect(getChainAddresses(chainId)).toMatchObject(expectedAddresses);
expect((deployments as Record<number, unknown>)[chainId]).toMatchObject(
expectedDeployments,
);
expect(
getUnwrappedToken(expectedAddresses.wNative as `0x${string}`, chainId),
).toEqual(NATIVE_ADDRESS);
},
);

test("should throw when overriding existing address", () => {
const randomAddress1 = randomAddress();

Expand Down
37 changes: 37 additions & 0 deletions packages/blue-sdk/test/unit/chain.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,41 @@ describe("ChainUtils", () => {
test("should default to reliable native balance for unknown chains", () => {
expect(ChainUtils.hasReliableNativeBalance(99999)).toBe(true);
});

test.each([
[
685689,
{
name: "Gensyn",
explorerUrl: "https://gensyn-mainnet.explorer.alchemy.com",
identifier: "gensyn",
nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
},
],
[
1672,
{
name: "Pharos",
explorerUrl: "https://pharosscan.xyz",
identifier: "pharos",
nativeCurrency: { name: "PharosCoin", symbol: "PROS", decimals: 18 },
},
],
[
714,
{
name: "Eden",
explorerUrl: "https://eden.blockscout.com",
identifier: "eden",
nativeCurrency: { name: "TIA", symbol: "TIA", decimals: 18 },
},
],
])("should expose metadata for chain %i", (chainId, expectedMetadata) => {
expect(
(ChainUtils.CHAIN_METADATA as Record<number, unknown>)[chainId],
).toMatchObject({
id: chainId,
...expectedMetadata,
});
});
});
15 changes: 15 additions & 0 deletions packages/liquidation-sdk-viem/src/addresses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,9 @@ export const midasConfigs: Record<ChainId, Record<Address, MidasConfig>> = {
[ChainId.BscMainnet]: {},
[ChainId.SoneiumMainnet]: {},
[ChainId.TempoMainnet]: {},
[ChainId.EdenMainnet]: {},
[ChainId.PharosMainnet]: {},
[ChainId.GensynMainnet]: {},
};

export const preLiquidationFactoryConfigs: Record<
Expand Down Expand Up @@ -276,4 +279,16 @@ export const preLiquidationFactoryConfigs: Record<
address: addressesRegistry[ChainId.TempoMainnet].preLiquidationFactory,
startBlock: deployments[ChainId.TempoMainnet].preLiquidationFactory,
},
[ChainId.EdenMainnet]: {
address: addressesRegistry[ChainId.EdenMainnet].preLiquidationFactory,
startBlock: deployments[ChainId.EdenMainnet].preLiquidationFactory,
},
[ChainId.PharosMainnet]: {
address: addressesRegistry[ChainId.PharosMainnet].preLiquidationFactory,
startBlock: deployments[ChainId.PharosMainnet].preLiquidationFactory,
},
[ChainId.GensynMainnet]: {
address: addressesRegistry[ChainId.GensynMainnet].preLiquidationFactory,
startBlock: deployments[ChainId.GensynMainnet].preLiquidationFactory,
},
};
Loading