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
16 changes: 16 additions & 0 deletions packages/client/src/test-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,22 @@ export const ETHEREUM_DAI_ADDRESS = evmAddress(
'0x6B175474E89094C44Da98b954EedeAC495271d0F',
);

export const ETHEREUM_HUB_CORE_ADDRESS = evmAddress(
'0x7E7c3EDCa4D39D0aFBD468Dec89cdEaF0AC770d3',
);

export const ETHEREUM_SPOKE_CORE_ADDRESS = evmAddress(
'0x89914a22E30CDf88A06e801E407ca82520210a79',
);

export const ETHEREUM_HUB_GOB_ADDRESS = evmAddress(
'0xc2C1Da9815f7aFa00Fe49d5B8b5fBeE454FF1caA',
);

export const ETHEREUM_SPOKE_GOB_ADDRESS = evmAddress(
'0x89914a22E30CDf88A06e801E407ca82520210a79',
);

export const ETHEREUM_MARKET_ETH_CORRELATED_EMODE_CATEGORY = 1;

const ETHEREUM_FORK_RPC_URL = import.meta.env.ETHEREUM_TENDERLY_PUBLIC_RPC;
Expand Down
159 changes: 94 additions & 65 deletions packages/spec/misc/__snapshots__/hub.spec.ts.snap
Original file line number Diff line number Diff line change
@@ -1,59 +1,113 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`Aave V4 Hub Scenarios > Given a user who wants to list available hubs > When fetching hubs by chain ID(s) > Then it should return the expected data for each hub 1`] = `
exports[`Aave V4 Hub Scenarios > Given a user who wants to know assets in a hub > When fetching assets in a hub > Then it should return the expected data for assets in a hub 1`] = `
{
"__typename": "Hub",
"address": "0x4BB8658261CCF575Cb6148a257BE34b36D3D057f",
"chain": {
"__typename": "Chain",
"chainId": 1,
"explorerUrl": "https://etherscan.io",
"icon": "https://statics.aave.com/ethereum.svg",
"isTestnet": false,
"name": "Ethereum",
"nativeInfo": {
"__typename": "TokenInfo",
"decimals": 18,
"icon": "https://statics.aave.com/ethereum.svg",
"name": "Ether",
"symbol": "ETH",
"__typename": "HubAsset",
"assetId": "0",
"hub": Any<Object>,
"settings": {
"__typename": "HubAssetSettings",
"feeReceiver": "0x4B643A17BB9Bc4186617fD4F29A75Ae4350F6e53",
"irStrategy": "0xa5ea1c565fd011897233CA97b610B3f167253BBB",
"liquidityFee": {
"__typename": "PercentValue",
"decimals": 4,
"formatted": "10.00",
"raw": 1000n,
"value": "0.10",
},
"nativeWrappedToken": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
"reinvestmentController": null,
},
"name": "ISO Stable",
"summary": Any<Object>,
"underlying": {
"__typename": "Erc20Token",
"address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"chain": {
"__typename": "Chain",
"chainId": 1,
"explorerUrl": "https://etherscan.io",
"icon": "https://statics.aave.com/ethereum.svg",
"isTestnet": false,
"name": "Ethereum",
"nativeInfo": {
"__typename": "TokenInfo",
"decimals": 18,
"icon": "https://statics.aave.com/ethereum.svg",
"name": "Ether",
"symbol": "ETH",
},
"nativeWrappedToken": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
},
"info": {
"__typename": "TokenInfo",
"decimals": 6,
"icon": "https://token-logos.family.co/asset?id=1:0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48&token=USDC",
"name": "USD Coin",
"symbol": "USDC",
},
"isWrappedNativeToken": false,
"permitSupported": true,
},
"userState": null,
}
`;

exports[`Aave V4 Hub Scenarios > Given a user who wants to list available hubs > When fetching hubs by chain ID(s) > Then it should return the expected data for each hub 2`] = `
exports[`Aave V4 Hub Scenarios > Given a user who wants to know assets in a hub > When fetching assets in a hub > Then it should return the expected data for assets in a hub 2`] = `
{
"__typename": "Hub",
"address": "0x7E7c3EDCa4D39D0aFBD468Dec89cdEaF0AC770d3",
"chain": {
"__typename": "Chain",
"chainId": 1,
"explorerUrl": "https://etherscan.io",
"icon": "https://statics.aave.com/ethereum.svg",
"isTestnet": false,
"name": "Ethereum",
"nativeInfo": {
"__typename": "HubAsset",
"assetId": "1",
"hub": Any<Object>,
"settings": {
"__typename": "HubAssetSettings",
"feeReceiver": "0x4B643A17BB9Bc4186617fD4F29A75Ae4350F6e53",
"irStrategy": "0xa5ea1c565fd011897233CA97b610B3f167253BBB",
"liquidityFee": {
"__typename": "PercentValue",
"decimals": 4,
"formatted": "10.00",
"raw": 1000n,
"value": "0.10",
},
"reinvestmentController": null,
},
"summary": Any<Object>,
"underlying": {
"__typename": "Erc20Token",
"address": "0x9D39A5DE30e57443BfF2A8307A4256c8797A3497",
"chain": {
"__typename": "Chain",
"chainId": 1,
"explorerUrl": "https://etherscan.io",
"icon": "https://statics.aave.com/ethereum.svg",
"isTestnet": false,
"name": "Ethereum",
"nativeInfo": {
"__typename": "TokenInfo",
"decimals": 18,
"icon": "https://statics.aave.com/ethereum.svg",
"name": "Ether",
"symbol": "ETH",
},
"nativeWrappedToken": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
},
"info": {
"__typename": "TokenInfo",
"decimals": 18,
"icon": "https://statics.aave.com/ethereum.svg",
"name": "Ether",
"symbol": "ETH",
"icon": "https://token-logos.family.co/asset?id=1:0x9D39A5DE30e57443BfF2A8307A4256c8797A3497&token=sUSDe",
"name": "Staked USDe",
"symbol": "sUSDe",
},
"nativeWrappedToken": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
"isWrappedNativeToken": false,
"permitSupported": true,
},
"name": "Core",
"summary": Any<Object>,
"userState": null,
}
`;

exports[`Aave V4 Hub Scenarios > Given a user who wants to list available hubs > When fetching hubs by chain ID(s) > Then it should return the expected data for each hub 3`] = `
exports[`Aave V4 Hub Scenarios > Given a user who wants to list available hubs > When fetching hubs by chain ID(s) > Then it should return the expected data for each hub 1`] = `
{
"__typename": "Hub",
"address": "0xA5f18dFE4f0380b6C40411D7Ddb2c04034276805",
"address": "0x4BB8658261CCF575Cb6148a257BE34b36D3D057f",
"chain": {
"__typename": "Chain",
"chainId": 1,
Expand All @@ -70,12 +124,12 @@ exports[`Aave V4 Hub Scenarios > Given a user who wants to list available hubs >
},
"nativeWrappedToken": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
},
"name": "ISO Gov",
"name": "ISO Stable",
"summary": Any<Object>,
}
`;

exports[`Aave V4 Hub Scenarios > Given a user who wants to list available hubs > When fetching hubs by tokens) > Then it should return the expected data for each hub 1`] = `
exports[`Aave V4 Hub Scenarios > Given a user who wants to list available hubs > When fetching hubs by chain ID(s) > Then it should return the expected data for each hub 2`] = `
{
"__typename": "Hub",
"address": "0x7E7c3EDCa4D39D0aFBD468Dec89cdEaF0AC770d3",
Expand All @@ -100,7 +154,7 @@ exports[`Aave V4 Hub Scenarios > Given a user who wants to list available hubs >
}
`;

exports[`Aave V4 Hub Scenarios > Given a user who wants to list available hubs > When fetching hubs by tokens) > Then it should return the expected data for each hub 2`] = `
exports[`Aave V4 Hub Scenarios > Given a user who wants to list available hubs > When fetching hubs by chain ID(s) > Then it should return the expected data for each hub 3`] = `
{
"__typename": "Hub",
"address": "0xA5f18dFE4f0380b6C40411D7Ddb2c04034276805",
Expand All @@ -124,28 +178,3 @@ exports[`Aave V4 Hub Scenarios > Given a user who wants to list available hubs >
"summary": Any<Object>,
}
`;

exports[`Aave V4 Hub Scenarios > Given a user who wants to list available hubs > When fetching hubs by tokens) > Then it should return the expected data for each hub 3`] = `
{
"__typename": "Hub",
"address": "0x4BB8658261CCF575Cb6148a257BE34b36D3D057f",
"chain": {
"__typename": "Chain",
"chainId": 1,
"explorerUrl": "https://etherscan.io",
"icon": "https://statics.aave.com/ethereum.svg",
"isTestnet": false,
"name": "Ethereum",
"nativeInfo": {
"__typename": "TokenInfo",
"decimals": 18,
"icon": "https://statics.aave.com/ethereum.svg",
"name": "Ether",
"symbol": "ETH",
},
"nativeWrappedToken": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
},
"name": "ISO Stable",
"summary": Any<Object>,
}
`;
8 changes: 7 additions & 1 deletion packages/spec/misc/hub.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,13 @@ describe('Aave V4 Hub Scenarios', () => {
});
assertOk(result);
assertNonEmptyArray(result.value);
expect(result.value).toMatchObject(listHubs.value[0]);
result.value.forEach((asset) => {
expect(asset).toMatchSnapshot({
hub: expect.any(Object),
summary: expect.any(Object),
});
expect(asset.hub.address).toBe(listHubs.value[0]!.address);
});
});
});
});
Expand Down
Loading