Skip to content

Commit

Permalink
fix: merge main
Browse files Browse the repository at this point in the history
  • Loading branch information
sakulstra committed Nov 2, 2023
2 parents 3ca0be1 + 6045393 commit 9ec0e12
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
12 changes: 7 additions & 5 deletions generator/features/__snapshots__/assetListing.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,11 @@ contract AaveV3Ethereum_Test_20231023 is AaveV3PayloadEthereum {
using SafeERC20 for IERC20;
address public constant PSP = 0xcAfE001067cDEF266AfB7Eb5A286dCFD277f3dE5;
uint256 internal constant PSP_SEED_AMOUNT = 10 ** 18;
function _postExecute() internal override {
IERC20(PSP).forceApprove(address(AaveV3Ethereum.POOL), 10 ** 18);
AaveV3Ethereum.POOL.supply(PSP, 10 ** 18, address(AaveV3Ethereum.COLLECTOR), 0);
IERC20(PSP).forceApprove(address(AaveV3Ethereum.POOL), PSP_SEED_AMOUNT);
AaveV3Ethereum.POOL.supply(PSP, PSP_SEED_AMOUNT, address(AaveV3Ethereum.COLLECTOR), 0);
}
function newListings() public pure override returns (IAaveV3ConfigEngine.Listing[] memory) {
Expand Down Expand Up @@ -166,7 +167,7 @@ contract AaveV3Ethereum_Test_20231023_Test is ProtocolV3TestBase {
AaveV3Ethereum_Test_20231023 internal proposal;
function setUp() public {
vm.createSelectFork(vm.rpcUrl('mainnet'), 18479488);
vm.createSelectFork(vm.rpcUrl('mainnet'), 18484053);
proposal = new AaveV3Ethereum_Test_20231023();
}
Expand Down Expand Up @@ -246,10 +247,11 @@ exports[`feature: assetListing > should return reasonable code 1`] = `
"code": {
"constants": [
"address public constant PSP = 0xcAfE001067cDEF266AfB7Eb5A286dCFD277f3dE5;",
"uint256 internal constant PSP_SEED_AMOUNT = 10 ** 18;",
],
"execute": [
"IERC20(PSP).forceApprove(address(AaveV3Ethereum.POOL), 10 ** 18);
AaveV3Ethereum.POOL.supply(PSP, 10 ** 18, address(AaveV3Ethereum.COLLECTOR), 0);",
"IERC20(PSP).forceApprove(address(AaveV3Ethereum.POOL), PSP_SEED_AMOUNT);
AaveV3Ethereum.POOL.supply(PSP, PSP_SEED_AMOUNT, address(AaveV3Ethereum.COLLECTOR), 0);",
],
"fn": [
"function newListings() public pure override returns (IAaveV3ConfigEngine.Listing[] memory) {
Expand Down
11 changes: 8 additions & 3 deletions generator/features/assetListing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,16 @@ export const assetListing: FeatureModule<Listing[]> = {
build(opt, pool, cfg) {
const response: CodeArtifact = {
code: {
constants: cfg.map((cfg) => `address public constant ${cfg.assetSymbol} = ${cfg.asset};`),
constants: cfg
.map((cfg) => [
`address public constant ${cfg.assetSymbol} = ${cfg.asset};`,
`uint256 internal constant ${cfg.assetSymbol}_SEED_AMOUNT = 10 ** ${cfg.decimals};`,
])
.flat(),
execute: cfg.map(
(cfg) =>
`IERC20(${cfg.assetSymbol}).forceApprove(address(${pool}.POOL), 10 ** ${cfg.decimals});
${pool}.POOL.supply(${cfg.assetSymbol}, 10 ** ${cfg.decimals}, address(${pool}.COLLECTOR), 0);`
`IERC20(${cfg.assetSymbol}).forceApprove(address(${pool}.POOL), ${cfg.assetSymbol}_SEED_AMOUNT);
${pool}.POOL.supply(${cfg.assetSymbol}, ${cfg.assetSymbol}_SEED_AMOUNT, address(${pool}.COLLECTOR), 0);`
),
fn: [
`function newListings() public pure override returns (IAaveV3ConfigEngine.Listing[] memory) {
Expand Down

0 comments on commit 9ec0e12

Please sign in to comment.