Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update tooling #261

Merged
merged 1 commit into from
Mar 21, 2024
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
5 changes: 4 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@ out
lib
cache
node_modules
diffs
diffs
broadcast
etherscan
.assets
3 changes: 2 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,6 @@
"bracketSpacing": false
}
}
]
],
"plugins": ["prettier-plugin-solidity"]
}
4 changes: 2 additions & 2 deletions generator/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ async function fetchPoolOptions(pool: PoolIdentifier) {
pool,
cfg: poolConfigs[pool]!.configs[feature],
cache: poolConfigs[pool]!.cache,
})
}),
);
}
}
Expand All @@ -135,7 +135,7 @@ if (options.configFile) {
pool,
cfg: poolConfigs[pool]!.configs[feature],
cache: poolConfigs[pool]!.cache,
})
}),
);
}
} else {
Expand Down
1 change: 0 additions & 1 deletion generator/features/__snapshots__/assetListing.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ import {IAaveV3ConfigEngine} from 'aave-helpers/v3-config-engine/IAaveV3ConfigEn
import {IV3RateStrategyFactory} from 'aave-helpers/v3-config-engine/IV3RateStrategyFactory.sol';
import {IERC20} from 'solidity-utils/contracts/oz-common/interfaces/IERC20.sol';
import {SafeERC20} from 'solidity-utils/contracts/oz-common/SafeERC20.sol';

/**
* @title test
* @author test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ pragma solidity ^0.8.0;
import {AaveV3EthereumAssets} from 'aave-address-book/AaveV3Ethereum.sol';
import {AaveV3PayloadEthereum} from 'aave-helpers/v3-config-engine/AaveV3PayloadEthereum.sol';
import {IAaveV3ConfigEngine} from 'aave-helpers/v3-config-engine/IAaveV3ConfigEngine.sol';

/**
* @title test
* @author test
Expand Down
1 change: 0 additions & 1 deletion generator/features/__snapshots__/rateUpdates.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ import {AaveV2PayloadEthereumAMM} from 'aave-helpers/v2-config-engine/AaveV2Payl
import {EngineFlags} from 'aave-helpers/v3-config-engine/EngineFlags.sol';
import {IAaveV2ConfigEngine} from 'aave-helpers/v2-config-engine/IAaveV2ConfigEngine.sol';
import {IV2RateStrategyFactory} from 'aave-helpers/v2-config-engine/IV2RateStrategyFactory.sol';

/**
* @title test
* @author test
Expand Down
58 changes: 29 additions & 29 deletions generator/features/assetListing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,33 +111,33 @@ function generateAssetListingSol(cfg: Listing) {
rateStrategyParams: IV3RateStrategyFactory.RateStrategyParams({
optimalUsageRatio: ${translateJsPercentToSol(
cfg.rateStrategyParams.optimalUtilizationRate,
true
true,
)},
baseVariableBorrowRate: ${translateJsPercentToSol(
cfg.rateStrategyParams.baseVariableBorrowRate,
true
true,
)},
variableRateSlope1: ${translateJsPercentToSol(
cfg.rateStrategyParams.variableRateSlope1,
true
true,
)},
variableRateSlope2: ${translateJsPercentToSol(
cfg.rateStrategyParams.variableRateSlope2,
true
true,
)},
stableRateSlope1: ${translateJsPercentToSol(cfg.rateStrategyParams.stableRateSlope1, true)},
stableRateSlope2: ${translateJsPercentToSol(cfg.rateStrategyParams.stableRateSlope2, true)},
baseStableRateOffset: ${translateJsPercentToSol(
cfg.rateStrategyParams.baseStableRateOffset,
true
true,
)},
stableRateExcessOffset: ${translateJsPercentToSol(
cfg.rateStrategyParams.stableRateExcessOffset,
true
true,
)},
optimalStableToTotalDebtRatio: ${translateJsPercentToSol(
cfg.rateStrategyParams.optimalStableToTotalDebtRatio,
true
true,
)}
})`;
}
Expand Down Expand Up @@ -167,7 +167,7 @@ export const assetListing: FeatureModule<Listing[]> = {
execute: cfg.map(
(cfg) =>
`IERC20(${cfg.assetSymbol}).forceApprove(address(${pool}.POOL), ${cfg.assetSymbol}_SEED_AMOUNT);
${pool}.POOL.supply(${cfg.assetSymbol}, ${cfg.assetSymbol}_SEED_AMOUNT, address(${pool}.COLLECTOR), 0);`
${pool}.POOL.supply(${cfg.assetSymbol}, ${cfg.assetSymbol}_SEED_AMOUNT, address(${pool}.COLLECTOR), 0);`,
),
fn: [
`function newListings() public pure override returns (IAaveV3ConfigEngine.Listing[] memory) {
Expand All @@ -179,7 +179,7 @@ export const assetListing: FeatureModule<Listing[]> = {
.map(
(cfg, ix) => `listings[${ix}] = IAaveV3ConfigEngine.Listing({
${generateAssetListingSol(cfg)}
});`
});`,
)
.join('\n')}

Expand All @@ -193,7 +193,7 @@ export const assetListing: FeatureModule<Listing[]> = {
${TEST_EXECUTE_PROPOSAL}
(address aTokenAddress, , ) = ${pool}.AAVE_PROTOCOL_DATA_PROVIDER.getReserveTokensAddresses(proposal.${cfg.assetSymbol}());
assertGe(IERC20(aTokenAddress).balanceOf(address(${pool}.COLLECTOR)), 10 ** ${cfg.decimals});
}`
}`,
),
},
aip: {
Expand All @@ -205,50 +205,50 @@ export const assetListing: FeatureModule<Listing[]> = {
listingTemplate += `| Borrowable | ${cfg.enabledToBorrow} |\n`;
listingTemplate += `| Collateral Enabled | ${!!cfg.liqThreshold} |\n`;
listingTemplate += `| Supply Cap (${cfg.assetSymbol}) | ${transformNumberToHumanReadable(
cfg.supplyCap
cfg.supplyCap,
)} |\n`;
listingTemplate += `| Borrow Cap (${cfg.assetSymbol}) | ${transformNumberToHumanReadable(
cfg.borrowCap
cfg.borrowCap,
)} |\n`;
listingTemplate += `| Debt Ceiling | USD ${transformNumberToHumanReadable(
cfg.debtCeiling
cfg.debtCeiling,
)} |\n`;
listingTemplate += `| LTV | ${transformNumberToPercent(cfg.ltv)} |\n`;
listingTemplate += `| LT | ${transformNumberToPercent(cfg.liqThreshold)} |\n`;
listingTemplate += `| Liquidation Bonus | ${transformNumberToPercent(cfg.liqBonus)} |\n`;
listingTemplate += `| Liquidation Protocol Fee | ${transformNumberToPercent(
cfg.liqProtocolFee
cfg.liqProtocolFee,
)} |\n`;
listingTemplate += `| Reserve Factor | ${transformNumberToPercent(
cfg.reserveFactor
cfg.reserveFactor,
)} |\n`;
listingTemplate += `| Base Variable Borrow Rate | ${transformNumberToPercent(
cfg.rateStrategyParams.baseVariableBorrowRate
cfg.rateStrategyParams.baseVariableBorrowRate,
)} |\n`;
listingTemplate += `| Variable Slope 1 | ${transformNumberToPercent(
cfg.rateStrategyParams.variableRateSlope1
cfg.rateStrategyParams.variableRateSlope1,
)} |\n`;
listingTemplate += `| Variable Slope 2 | ${transformNumberToPercent(
cfg.rateStrategyParams.variableRateSlope2
cfg.rateStrategyParams.variableRateSlope2,
)} |\n`;
listingTemplate += `| Uoptimal | ${transformNumberToPercent(
cfg.rateStrategyParams.optimalUtilizationRate
cfg.rateStrategyParams.optimalUtilizationRate,
)} |\n`;
listingTemplate += `| Stable Borrowing | ${cfg.stableRateModeEnabled} |\n`;
listingTemplate += `| Stable Slope1 | ${transformNumberToPercent(
cfg.rateStrategyParams.stableRateSlope1
cfg.rateStrategyParams.stableRateSlope1,
)} |\n`;
listingTemplate += `| Stable Slope2 | ${transformNumberToPercent(
cfg.rateStrategyParams.stableRateSlope2
cfg.rateStrategyParams.stableRateSlope2,
)} |\n`;
listingTemplate += `| Base Stable Rate Offset | ${transformNumberToPercent(
cfg.rateStrategyParams.baseStableRateOffset!
cfg.rateStrategyParams.baseStableRateOffset!,
)} |\n`;
listingTemplate += `| Stable Rate Excess Offset | ${transformNumberToPercent(
cfg.rateStrategyParams.stableRateExcessOffset!
cfg.rateStrategyParams.stableRateExcessOffset!,
)} |\n`;
listingTemplate += `| Optimal Stable To Total Debt Ratio | ${transformNumberToPercent(
cfg.rateStrategyParams.optimalStableToTotalDebtRatio!
cfg.rateStrategyParams.optimalStableToTotalDebtRatio!,
)} |\n`;
listingTemplate += `| Flashloanable | ${cfg.flashloanable} |\n`;
listingTemplate += `| Siloed Borrowing | ${cfg.withSiloedBorrowing} |\n`;
Expand Down Expand Up @@ -280,13 +280,13 @@ export const assetListingCustom: FeatureModule<ListingWithCustomImpl[]> = {
constants: cfg.map(
(cfg) =>
`address public constant ${cfg.base.assetSymbol} = ${translateJsAddressToSol(
cfg.base.asset
)};`
cfg.base.asset,
)};`,
),
execute: cfg.map(
(cfg) =>
`IERC20(${cfg.base.assetSymbol}).forceApprove(address(${pool}.POOL), 10 ** ${cfg.base.decimals});
${pool}.POOL.supply(${cfg.base.assetSymbol}, 10 ** ${cfg.base.decimals}, ${pool}.COLLECTOR, 0);`
${pool}.POOL.supply(${cfg.base.assetSymbol}, 10 ** ${cfg.base.decimals}, ${pool}.COLLECTOR, 0);`,
),
fn: [
`function newListingsCustom() public pure override returns (IAaveV3ConfigEngine.ListingWithCustomImpl[] memory) {
Expand All @@ -305,7 +305,7 @@ export const assetListingCustom: FeatureModule<ListingWithCustomImpl[]> = {
sToken: ${translateJsAddressToSol(cfg.implementations.sToken)}
})
})
);`
);`,
)
.join('\n')}

Expand All @@ -319,7 +319,7 @@ export const assetListingCustom: FeatureModule<ListingWithCustomImpl[]> = {
${TEST_EXECUTE_PROPOSAL}
(address aTokenAddress, , ) = ${pool}.AAVE_PROTOCOL_DATA_PROVIDER.getReserveTokensAddresses(proposal.${cfg.base.assetSymbol}());
assertGte(IERC20(aTokenAddress).balanceOf(${pool}.COLLECTOR), 10 ** ${cfg.base.decimals});
}`
}`,
),
},
};
Expand Down
2 changes: 1 addition & 1 deletion generator/features/borrowsUpdates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export const borrowsUpdates: FeatureModule<BorrowUpdates> = {
borrowableInIsolation: ${translateJsBoolToSol(cfg.borrowableInIsolation)},
withSiloedBorrowing: ${translateJsBoolToSol(cfg.withSiloedBorrowing)},
reserveFactor: ${translateJsPercentToSol(cfg.reserveFactor)}
});`
});`,
)
.join('\n')}

Expand Down
2 changes: 1 addition & 1 deletion generator/features/capsUpdates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export const capsUpdates: FeatureModule<CapsUpdates> = {
asset: ${translateAssetToAssetLibUnderlying(cfg.asset, pool)},
supplyCap: ${translateJsNumberToSol(cfg.supplyCap)},
borrowCap: ${translateJsNumberToSol(cfg.borrowCap)}
});`
});`,
)
.join('\n')}

Expand Down
4 changes: 2 additions & 2 deletions generator/features/collateralsUpdates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {percentPrompt, translateJsPercentToSol} from '../prompts/percentPrompt';

export async function fetchCollateralUpdate(
pool: PoolIdentifier,
required?: boolean
required?: boolean,
): Promise<CollateralUpdatePartial> {
return {
ltv: await percentPrompt({
Expand Down Expand Up @@ -74,7 +74,7 @@ export const collateralsUpdates: FeatureModule<CollateralUpdates> = {
liqBonus: ${translateJsPercentToSol(cfg.liqBonus)},
debtCeiling: ${translateJsNumberToSol(cfg.debtCeiling)},
liqProtocolFee: ${translateJsPercentToSol(cfg.liqProtocolFee)}
});`
});`,
)
.join('\n')}

Expand Down
2 changes: 1 addition & 1 deletion generator/features/eModesAssets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export const eModeAssets: FeatureModule<EmodeAssetUpdates> = {
(cfg, ix) => `assetEModeUpdates[${ix}] = IAaveV3ConfigEngine.AssetEModeUpdate({
asset: ${translateAssetToAssetLibUnderlying(cfg.asset, pool)},
eModeCategory: ${cfg.eModeCategory}
});`
});`,
)
.join('\n')}

Expand Down
4 changes: 2 additions & 2 deletions generator/features/eModesUpdates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {percentPrompt, translateJsPercentToSol} from '../prompts/percentPrompt';

async function fetchEmodeCategoryUpdate<T extends boolean>(
eModeCategory: string | number,
required?: T
required?: T,
): Promise<EModeCategoryUpdate> {
return {
eModeCategory,
Expand Down Expand Up @@ -104,7 +104,7 @@ export const eModeUpdates: FeatureModule<EmodeUpdates> = {
liqBonus: ${translateJsPercentToSol(cfg.liqBonus)},
priceSource: ${translateJsAddressToSol(cfg.priceSource)},
label: ${stringOrKeepCurrent(cfg.label)}
});`
});`,
)
.join('\n')}

Expand Down
4 changes: 2 additions & 2 deletions generator/features/freeze.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ export const freezeUpdates: FeatureModule<FreezeUpdate[]> = {
(cfg) =>
`${pool}.POOL_CONFIGURATOR.setReserveFreeze(${translateAssetToAssetLibUnderlying(
cfg.asset,
pool
)}, ${cfg.shouldBeFrozen});`
pool,
)}, ${cfg.shouldBeFrozen});`,
),
},
};
Expand Down
2 changes: 1 addition & 1 deletion generator/features/priceFeedsUpdates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export const priceFeedsUpdates: FeatureModule<PriceFeedUpdate[]> = {
(cfg, ix) => `priceFeedUpdates[${ix}] = IAaveV3ConfigEngine.PriceFeedUpdate({
asset: ${translateAssetToAssetLibUnderlying(cfg.asset, pool)},
priceFeed: ${translateJsAddressToSol(cfg.priceFeed)}
});`
});`,
)
.join('\n')}

Expand Down
26 changes: 13 additions & 13 deletions generator/features/rateUpdates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,24 +90,24 @@ export const rateUpdatesV2: FeatureModule<RateStrategyUpdate[]> = {
params: IV2RateStrategyFactory.RateStrategyParams({
optimalUtilizationRate: ${translateJsPercentToSol(
cfg.params.optimalUtilizationRate,
true
true,
)},
baseVariableBorrowRate: ${translateJsPercentToSol(
cfg.params.baseVariableBorrowRate,
true
true,
)},
variableRateSlope1: ${translateJsPercentToSol(
cfg.params.variableRateSlope1,
true
true,
)},
variableRateSlope2: ${translateJsPercentToSol(
cfg.params.variableRateSlope2,
true
true,
)},
stableRateSlope1: ${translateJsPercentToSol(cfg.params.stableRateSlope1, true)},
stableRateSlope2: ${translateJsPercentToSol(cfg.params.stableRateSlope2, true)}
})
});`
});`,
)
.join('\n')}

Expand Down Expand Up @@ -157,36 +157,36 @@ export const rateUpdatesV3: FeatureModule<RateStrategyUpdate[]> = {
params: IV3RateStrategyFactory.RateStrategyParams({
optimalUsageRatio: ${translateJsPercentToSol(
cfg.params.optimalUtilizationRate,
true
true,
)},
baseVariableBorrowRate: ${translateJsPercentToSol(
cfg.params.baseVariableBorrowRate,
true
true,
)},
variableRateSlope1: ${translateJsPercentToSol(
cfg.params.variableRateSlope1,
true
true,
)},
variableRateSlope2: ${translateJsPercentToSol(
cfg.params.variableRateSlope2,
true
true,
)},
stableRateSlope1: ${translateJsPercentToSol(cfg.params.stableRateSlope1, true)},
stableRateSlope2: ${translateJsPercentToSol(cfg.params.stableRateSlope2, true)},
baseStableRateOffset: ${translateJsPercentToSol(
cfg.params.baseStableRateOffset!,
true
true,
)},
stableRateExcessOffset: ${translateJsPercentToSol(
cfg.params.stableRateExcessOffset!,
true
true,
)},
optimalStableToTotalDebtRatio: ${translateJsPercentToSol(
cfg.params.optimalStableToTotalDebtRatio!,
true
true,
)}
})
});`
});`,
)
.join('\n')}

Expand Down
Loading
Loading