Skip to content

Commit

Permalink
Add isCompatible flag to erc4626 registry
Browse files Browse the repository at this point in the history
Fixes #213
  • Loading branch information
mkflow27 committed Jan 21, 2025
1 parent 1ba0ffa commit 9b38ed5
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 47 deletions.
63 changes: 42 additions & 21 deletions erc4626/registry.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,91 +5,104 @@
"name": "MetaMorpho Gauntlet wETH Prime",
"summary": "unsafe",
"review": "./MorphoVaults/V1-Incompatible-Gauntlet.md",
"warnings": []
"warnings": [],
"isCompatible": "true"
},
"0xBEEF01735c132Ada46AA9aA4c54623cAA92A64CB": {
"asset": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"name": "MetaMorpho Steakhouse SteakUSDC",
"summary": "unsafe",
"review": "./MorphoVaults/V1-incompatible-Steakhouse.md",
"warnings": []
"warnings": [],
"isCompatible": "true"
},
"0xbEef047a543E45807105E51A8BBEFCc5950fcfBa": {
"asset": "0xdAC17F958D2ee523a2206206994597C13D831ec7",
"name": "MetaMorpho Steakhouse SteakUSDT",
"summary": "unsafe",
"review": "./MorphoVaults/V1-incompatible-Steakhouse.md",
"warnings": []
"warnings": [],
"isCompatible": "true"
},
"0xbEEFC01767ed5086f35deCb6C00e6C12bc7476C1": {
"asset": "0x7751E2F4b8ae93EF6B79d86419d42FE3295A4559",
"name": "MetaMorpho Coinshift-Steakhouse csUSDL",
"summary": "unsafe",
"review": "./MorphoVaults/V1-incompatible-Steakhouse.md",
"warnings": []
"warnings": [],
"isCompatible": "true"
},
"0xD4fa2D31b7968E448877f69A96DE69f5de8cD23E": {
"asset": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"name": "Aave Ethereum USDC",
"summary": "safe",
"review": "./StatATokenV2Review.md",
"warnings": []
"warnings": [],
"isCompatible": "true"
},
"0x0bfc9d54Fc184518A81162F8fB99c2eACa081202": {
"asset": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
"name": "Wrapped Aave Ethereum WETH",
"summary": "safe",
"review": "./StatATokenV2Review.md",
"warnings": []
"warnings": [],
"isCompatible": "true"
},
"0x7Bc3485026Ac48b6cf9BaF0A377477Fff5703Af8": {
"asset": "0xdAC17F958D2ee523a2206206994597C13D831ec7",
"name": "Wrapped Aave Ethereum USDT",
"summary": "safe",
"review": "./StatATokenV2Review.md",
"warnings": []
"warnings": [],
"isCompatible": "true"
},
"0x0FE906e030a44eF24CA8c7dC7B7c53A6C4F00ce9": {
"asset": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
"name": "Wrapped Aave Ethereum Lido WETH",
"summary": "safe",
"review": "./StatATokenV2Review.md",
"warnings": []
"warnings": [],
"isCompatible": "true"
},
"0x775F661b0bD1739349b9A2A3EF60be277c5d2D29": {
"asset": "0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0",
"name": "Wrapped Aave Ethereum Lido wstETH",
"summary": "safe",
"review": "./StatATokenV2Review.md",
"warnings": []
"warnings": [],
"isCompatible": "true"
},
"0x5F9D59db355b4A60501544637b00e94082cA575b": {
"asset": "0x4c9EDD5852cd905f086C759E8383e09bff1E68B3",
"name": "Wrapped Aave Ethereum USDe",
"summary": "safe",
"review": "./StatATokenV2Review.md",
"warnings": []
"warnings": [],
"isCompatible": "true"
},
"0xC71Ea051a5F82c67ADcF634c36FFE6334793D24C": {
"asset": "0x40D16FC0246aD3160Ccc09B8D0D3A2cD28aE6C2f",
"name": "Wrapped Aave Lido Ethereum GHO",
"summary": "safe",
"review": "./StatATokenV2Review.md",
"warnings": []
"warnings": [],
"isCompatible": "true"
},
"0xbEeFc011e94f43b8B7b455eBaB290C7Ab4E216f1": {
"asset": "0x7751E2F4b8ae93EF6B79d86419d42FE3295A4559",
"name": "MetaMorpho v1.1 Coinshift-Steakhouse csUSDL",
"summary": "safe",
"review": "./MorphoVaults/V1.1-Steakhouse.md",
"warnings": []
"warnings": [],
"isCompatible": "true"
},
"0x7204B7Dbf9412567835633B6F00C3Edc3a8D6330": {
"asset": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"name": "MetaMorpho v1.1 Coinshift-Steakhouse csUSDC",
"summary": "safe",
"review": "./MorphoVaults/V1.1-Steakhouse.md",
"warnings": []
"warnings": [],
"isCompatible": "true"
}
},
"gnosis": {
Expand All @@ -98,35 +111,40 @@
"name": "Aave Gnosis wstETH",
"summary": "safe",
"review": "./StatATokenV2Review.md",
"warnings": []
"warnings": [],
"isCompatible": "true"
},
"0x7c16f0185a26db0ae7a9377f23bc18ea7ce5d644": {
"asset": "0x9C58BAcC331c9aa871AFD802DB6379a98e80CEdb",
"name": "Aave Gnosis GNO",
"summary": "safe",
"review": "./StatATokenV2Review.md",
"warnings": []
"warnings": [],
"isCompatible": "true"
},
"0xaf204776c7245bf4147c2612bf6e5972ee483701": {
"asset": "0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d",
"name": "sDAI",
"summary": "safe",
"review": "./sDaiReview.md",
"warnings": ["buffer"]
"warnings": ["buffer"],
"isCompatible": "false"
},
"0x51350d88c1bd32cc6a79368c9fb70373fb71f375": {
"asset": "0x2a22f9c3b484c3629090FeED35F17Ff8F88f76F0",
"name": "Aave Gnosis USDCe",
"summary": "safe",
"review": "./StatATokenV2Review.md",
"warnings": []
"warnings": [],
"isCompatible": "true"
},
"0x57f664882F762FA37903FC864e2B633D384B411A": {
"asset": "0x6A023CCd1ff6F2045C3309768eAd9E68F978f6e1",
"name": "Wrapped Aave Gnosis WETH",
"summary": "safe",
"review": "./StatATokenV2Review.md",
"warnings": []
"warnings": [],
"isCompatible": "true"
}
},
"sepolia": {
Expand All @@ -135,21 +153,24 @@
"name": "Static Aave Ethereum DAI",
"summary": "safe",
"review": "./AaveV3.md",
"warnings": []
"warnings": [],
"isCompatible": "true"
},
"0x94a9d9ac8a22534e3faca9f4e7f2e2cf85d5e4c8": {
"asset": "0xff34b3d4aee8ddcd6f9afffb6fe49bd371b8a357",
"name": "Static Aave Ethereum USDT",
"summary": "safe",
"review": "./AaveV3.md",
"warnings": []
"warnings": [],
"isCompatible": "true"
},
"0x978206fAe13faF5a8d293FB614326B237684B750": {
"asset": "0xaa8e23fb1079ea71e0a56f48a2aa51851d8433d0",
"name": "Static Aave Ethereum USDC",
"summary": "safe",
"review": "./AaveV3.md",
"warnings": []
"warnings": [],
"isCompatible": "true"
}
}
}
65 changes: 39 additions & 26 deletions test/erc4626schema.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const fs = require('fs').promises;
const path = require('path');
const Ajv = require('ajv');
const ajv = new Ajv();
const fs = require("fs").promises
const path = require("path")
const Ajv = require("ajv")
const ajv = new Ajv()

// Define the schema for the ERC4626 registry
const schema = {
Expand All @@ -16,41 +16,54 @@ const schema = {
asset: { type: "string", pattern: "^0x[a-fA-F0-9]{40}$" },
name: { type: "string", minLength: 1 },
summary: { type: "string", enum: ["safe", "unsafe"] },
review: { type: "string", minLength: 1},
review: { type: "string", minLength: 1 },
warnings: { type: "array", items: { type: "string" } },
isCompatible: { type: "string", enum: ["true", "false"] },
},
required: ["asset", "name", "summary", "review", "warnings"]
}
}
}
required: [
"asset",
"name",
"summary",
"review",
"warnings",
"isCompatible",
],
},
},
},
},
additionalProperties: false
};
additionalProperties: false,
}

const validate = ajv.compile(schema);
const validate = ajv.compile(schema)

describe("ERC4626 Schema validation", () => {
test("should validate the ERC4626 registry", async () => {
const data = await fs.readFile("erc4626/registry.json", "utf8");
const registry = JSON.parse(data);
const valid = validate(registry);
const data = await fs.readFile("erc4626/registry.json", "utf8")
const registry = JSON.parse(data)
const valid = validate(registry)
if (!valid) {
console.log(validate.errors);
console.log(validate.errors)
}
expect(valid).toBe(true);
});
});
expect(valid).toBe(true)
})
})

describe("ERC4626 Review files exist", () => {
test("should check that all reviews exist", async () => {
const data = await fs.readFile("erc4626/registry.json", "utf8");
const registry = JSON.parse(data);
const reviews = [];
const data = await fs.readFile("erc4626/registry.json", "utf8")
const registry = JSON.parse(data)
const reviews = []

for (const network in registry) {
for (const address in registry[network]) {
const reviewPath = path.join(__dirname, '..','erc4626', registry[network][address].review);
reviews.push(reviewPath);
const reviewPath = path.join(
__dirname,
"..",
"erc4626",
registry[network][address].review,
)
reviews.push(reviewPath)
}
}

Expand All @@ -65,5 +78,5 @@ describe("ERC4626 Review files exist", () => {
}

expect(missingReviews.length).toBe(0)
});
});
})
})

0 comments on commit 9b38ed5

Please sign in to comment.