Skip to content

Commit

Permalink
chore: rework logoURI logic, fix yaml files with issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Xaroz committed Jan 3, 2025
1 parent adb58ce commit 73389f4
Show file tree
Hide file tree
Showing 13 changed files with 24 additions and 11 deletions.
2 changes: 1 addition & 1 deletion chains/metertestnet/metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ blockExplorers:
name: Meter Testnet Explorer
url: https://scan.meter.io/
chainId: 83
deployers:
deployer:
name: JaunePomme
url: https://github.com/JaunePomme
displayName: Meter testnet
Expand Down
3 changes: 3 additions & 0 deletions chains/u2utestnet/metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ blockExplorers:
name: u2uscan
url: https://testnet.u2uscan.xyz
chainId: 2484
deployer:
name: junayedmh
url: https://github.com/JunayedMh
displayName: U2U Testnet
domainId: 2484
isTestnet: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ tokens:
- token: ethereum|polygon|0x93b637AEA6a0dF51E8E24E49C62da34f616491c5
- token: ethereum|prom|0xd9c95e2ad330E11D7Dfa58f18504049f625E955e
decimals: 6
logoURI: /deployments/warp_routes/USDC/logo.svg
name: USD Coin
standard: EvmHypCollateral
symbol: USDC
Expand Down
2 changes: 2 additions & 0 deletions deployments/warp_routes/USDC/bsc-polygon-prom-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ tokens:
- token: ethereum|polygon|0xFDf46770Da4F907c09aEd92299552DC9c7996d99
- token: ethereum|prom|0x424712Bec7c94a0F804c50F77B641A24F33A138e
decimals: 18
logoURI: /deployments/warp_routes/USDC/logo.svg
name: USD Coin
standard: EvmHypCollateral
symbol: USDC
Expand All @@ -16,6 +17,7 @@ tokens:
- token: ethereum|bsc|0x647eeD57dFDd335f9B6f2a9DbDFe09f166b1AdaC
- token: ethereum|prom|0x424712Bec7c94a0F804c50F77B641A24F33A138e
decimals: 18
logoURI: /deployments/warp_routes/USDC/logo.svg
name: USD Coin
standard: EvmHypSynthetic
symbol: USDC
Expand Down
2 changes: 2 additions & 0 deletions deployments/warp_routes/USDT/bsc-polygon-prom-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ tokens:
- token: ethereum|polygon|0xd9765D5fE176493808202e63E6B73b523D6A1C3A
- token: ethereum|prom|0xDf6C58ec668daB037373BC49215722c2b0664484
decimals: 18
logoURI: /deployments/warp_routes/USDT/logo.svg
name: Tether USD
standard: EvmHypCollateral
symbol: USDT
Expand All @@ -16,6 +17,7 @@ tokens:
- token: ethereum|bsc|0x74e19D0c1828be422dDCd367a6ADa8CA7003d1a9
- token: ethereum|prom|0xDf6C58ec668daB037373BC49215722c2b0664484
decimals: 18
logoURI: /deployments/warp_routes/USDT/logo.svg
name: Tether USD
standard: EvmHypSynthetic
symbol: USDT
Expand Down
25 changes: 15 additions & 10 deletions scripts/validate-file-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const invalidTestnetChains = [];
// warp routes errors
const noConfigFileError = [];
const noLogoFileError = [];
const noLogoURIError = [];
const logoURIError = [];
const unorderedChainNamesError = [];

function validateChains() {
Expand Down Expand Up @@ -91,15 +91,20 @@ function validateConfigFiles(entryPath) {
const configFilePath = path.join(entryPath, configFile);
const configData = readYaml(configFilePath);

let foundLogoURIs = 0;

if ('tokens' in configData) {
configData.tokens.forEach((token) => {
if (!('logoURI' in token)) {
noLogoURIError.push({
chainName: token.chainName || 'unknown',
path: configFilePath,
});
foundLogoURIs++;
}
});

// if no entry found, skip check
if (foundLogoURIs === 0) return;

// otherwise all tokens must contain logoURI,
if (foundLogoURIs !== configData.tokens.length) logoURIError.push(configFilePath);
}
});
}
Expand All @@ -117,7 +122,7 @@ function validateWarpRoutes() {
const entryPath = path.join(warpRoutesDir, entry.name);

// check if logo file exists
const logoFile = fs.readdirSync(entryPath).find((file) => file.includes('logo.svg'));
const logoFile = fs.readdirSync(entryPath).find((file) => file.includes('logo'));
if (!logoFile) noLogoFileError.push(entryPath);

validateConfigFiles(entryPath);
Expand All @@ -132,7 +137,7 @@ function validateErrors() {
invalidTestnetChains.length +
noConfigFileError.length +
noLogoFileError.length +
noLogoURIError.length +
logoURIError.length +
unorderedChainNamesError.length;

if (errorCount === 0) return;
Expand All @@ -154,10 +159,10 @@ function validateErrors() {
if (noConfigFileError.length > 0)
console.error('Error: no config file at paths:', noConfigFileError);

if (noLogoFileError.length > 0)
console.error('Error: logo.svg file missing at:', noLogoFileError);
if (noLogoFileError.length > 0) console.error('Error: logo file missing at:', noLogoFileError);

if (noLogoURIError.length > 0) console.error('Error: Missing field logoURI at:', noLogoURIError);
if (logoURIError.length > 0)
console.error('Error: All tokens must contain logoURI field:', logoURIError);

if (unorderedChainNamesError.length > 0)
console.error(
Expand Down

0 comments on commit 73389f4

Please sign in to comment.