Skip to content

Commit

Permalink
feat: add zero lend
Browse files Browse the repository at this point in the history
  • Loading branch information
KedziaPawel committed Jan 23, 2025
1 parent 1582ecd commit 92134e8
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 5 deletions.
30 changes: 29 additions & 1 deletion packages/environment/src/assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ export type Asset =
| StaderAsset
| SynthetixAsset
| UniswapV2PoolAsset
| YearnVaultV2Asset;
| YearnVaultV2Asset
| ZeroLendAaveV3LRTBTCAsset
| ZeroLendAaveV3RWAStablecoinsAsset;

export enum AssetType {
AAVE_V2 = "aave-v2",
Expand All @@ -91,6 +93,8 @@ export enum AssetType {
MAPLE_V1 = "maple-v1",
MAPLE_V2 = "maple-v2",
ERC_4626 = "erc-4626",
ZERO_LEND_AAVE_V3_LRT_BTC = "zero-lend-aave-v3-lrt-btc",
ZERO_LEND_AAVE_V3_RWA_STABLECOINS = "zero-lend-aave-v3-rwa-stablecoins",
}

export interface StaderAsset extends AssetBase {
Expand Down Expand Up @@ -121,6 +125,30 @@ export interface AaveV3Asset extends AssetBase {
readonly underlying: Address;
}

export interface ZeroLendAaveV3LRTBTCAsset extends AssetBase {
readonly type: AssetType.ZERO_LEND_AAVE_V3_LRT_BTC;
/**
* Underlying Asset.
*/
readonly underlying: Address;
}

export interface ZeroLendAaveV3RWAStablecoinsAsset extends AssetBase {
readonly type: AssetType.ZERO_LEND_AAVE_V3_RWA_STABLECOINS;
/**
* Underlying Asset.
*/
readonly underlying: Address;
}

export interface ZeroLendAaveV3LRTBTCAsset extends AssetBase {
readonly type: AssetType.ZERO_LEND_AAVE_V3_LRT_BTC;
/**
* Underlying Asset.
*/
readonly underlying: Address;
}

export interface CompoundV2Asset extends AssetBase {
readonly type: AssetType.COMPOUND_V2;
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ import { environment } from "../utils/fixtures.js";

const client = getClient(environment.network.id);

const aaveV3Assets = environment.getAssets({ types: [AssetType.AAVE_V3] });
const aaveV3LikeAssets = environment.getAssets({
types: [AssetType.AAVE_V3, AssetType.ZERO_LEND_AAVE_V3_LRT_BTC, AssetType.ZERO_LEND_AAVE_V3_RWA_STABLECOINS],
});
const assets = environment.getAssets();

test.each(aaveV3Assets)("aave V3 underlying is correct: $symbol ($name): $id", async (asset) => {
test.each(aaveV3LikeAssets)("aave V3 like underlying is correct: $symbol ($name): $id", async (asset) => {
// check if underlying is correct
const checksum = await getUnderlyingAssetAddressUpperCase(client, { asset: asset.id });
expect(checksum.toLowerCase(), "Actual underlying asset does not match expected").toBe(asset.underlying);
Expand All @@ -21,7 +23,7 @@ test.each(aaveV3Assets)("aave V3 underlying is correct: $symbol ($name): $id", a
"Underlying asset not found in the environment",
).toBe(1);

// check if underlying asset is registerd
// check if underlying asset is registered
expect(
asset.registered ? environment.getAsset(asset.underlying).registered : true,
"Underlying asset not registered",
Expand Down
2 changes: 1 addition & 1 deletion packages/environment/test/assets/aave.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ test.each(aave)("aave underlying is correct: $symbol ($name): $id", async (asset

expect(checksum.toLowerCase(), "Actual underlying asset does not match expected").toBe(asset.underlying);

// check if underlying asset is registerd
// check if underlying asset is regiseterd
expect(
asset.registered ? environment.getAsset(asset.underlying).registered : true,
"Underlying asset not registered",
Expand Down
2 changes: 2 additions & 0 deletions packages/environment/test/assets/schema.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ suite.each(assets)("$symbol ($name): $id", (asset) => {
validate(AaveSchema, asset);
break;
}
case AssetType.ZERO_LEND_AAVE_V3_LRT_BTC:
case AssetType.ZERO_LEND_AAVE_V3_RWA_STABLECOINS:
case AssetType.AAVE_V3: {
validate(AaveV3Schema, asset);
break;
Expand Down

0 comments on commit 92134e8

Please sign in to comment.