generated from bgd-labs/bgd-forge-template
-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: refactor address input (#31)
* feat: refactor address input * fix: update snapshot * fix: refactor address input * fix: update snapshots * fix: remove unused code * refactor: move asset select as well * fix: remove test * fix: also migrate assets select * fix: add priceFeedsTest * fix: patch some issues in eMode updates * fix: remove accidentally comitted test * fix: bump highest eMode
- Loading branch information
Showing
23 changed files
with
549 additions
and
198 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
192 changes: 192 additions & 0 deletions
192
generator/features/__snapshots__/priceFeedsUpdate.spec.ts.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,192 @@ | ||
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html | ||
|
||
exports[`feature: priceFeedsUpdates > should properly generate files 1`] = ` | ||
{ | ||
"aip": "--- | ||
title: \\"test\\" | ||
author: \\"test\\" | ||
discussions: \\"test\\" | ||
--- | ||
## Simple Summary | ||
## Motivation | ||
## Specification | ||
## References | ||
- Implementation: [AaveV3Ethereum](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20231023_AaveV3Ethereum_Test/AaveV3Ethereum_Test_20231023.sol) | ||
- Tests: [AaveV3Ethereum](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20231023_AaveV3Ethereum_Test/AaveV3Ethereum_Test_20231023.t.sol) | ||
- [Snapshot](test) | ||
- [Discussion](test) | ||
## Copyright | ||
Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/). | ||
", | ||
"jsonConfig": "{ | ||
\\"rootOptions\\": { | ||
\\"pools\\": [ | ||
\\"AaveV3Ethereum\\" | ||
], | ||
\\"title\\": \\"test\\", | ||
\\"shortName\\": \\"Test\\", | ||
\\"date\\": \\"20231023\\", | ||
\\"author\\": \\"test\\", | ||
\\"discussion\\": \\"test\\", | ||
\\"snapshot\\": \\"test\\" | ||
}, | ||
\\"poolOptions\\": { | ||
\\"AaveV3Ethereum\\": { | ||
\\"configs\\": { | ||
\\"PRICE_FEEDS_UPDATE\\": [ | ||
{ | ||
\\"asset\\": \\"DAI\\", | ||
\\"priceFeed\\": \\"0xae7ab96520de3a18e5e111b5eaab095312d7fe84\\" | ||
} | ||
] | ||
}, | ||
\\"features\\": [ | ||
\\"PRICE_FEEDS_UPDATE\\" | ||
] | ||
} | ||
} | ||
}", | ||
"payloads": [ | ||
{ | ||
"contractName": "AaveV3Ethereum_Test_20231023", | ||
"payload": "// SPDX-License-Identifier: MIT | ||
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 | ||
* - Snapshot: test | ||
* - Discussion: test | ||
*/ | ||
contract AaveV3Ethereum_Test_20231023 is AaveV3PayloadEthereum { | ||
function priceFeedsUpdates() | ||
public | ||
pure | ||
override | ||
returns (IAaveV3ConfigEngine.PriceFeedUpdate[] memory) | ||
{ | ||
IAaveV3ConfigEngine.PriceFeedUpdate[] | ||
memory priceFeedUpdates = new IAaveV3ConfigEngine.PriceFeedUpdate[](1); | ||
priceFeedUpdates[0] = IAaveV3ConfigEngine.PriceFeedUpdate({ | ||
asset: AaveV3EthereumAssets.DAI_UNDERLYING, | ||
priceFeed: 0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84 | ||
}); | ||
return priceFeedUpdates; | ||
} | ||
} | ||
", | ||
"test": "// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.0; | ||
import {AaveV3Ethereum} from 'aave-address-book/AaveV3Ethereum.sol'; | ||
import 'forge-std/Test.sol'; | ||
import {ProtocolV3TestBase, ReserveConfig} from 'aave-helpers/ProtocolV3TestBase.sol'; | ||
import {AaveV3Ethereum_Test_20231023} from './AaveV3Ethereum_Test_20231023.sol'; | ||
/** | ||
* @dev Test for AaveV3Ethereum_Test_20231023 | ||
* command: make test-contract filter=AaveV3Ethereum_Test_20231023 | ||
*/ | ||
contract AaveV3Ethereum_Test_20231023_Test is ProtocolV3TestBase { | ||
AaveV3Ethereum_Test_20231023 internal proposal; | ||
function setUp() public { | ||
vm.createSelectFork(vm.rpcUrl('mainnet'), 18487480); | ||
proposal = new AaveV3Ethereum_Test_20231023(); | ||
} | ||
/** | ||
* @dev executes the generic test suite including e2e and config snapshots | ||
*/ | ||
function test_defaultProposalExecution() public { | ||
defaultTest('AaveV3Ethereum_Test_20231023', AaveV3Ethereum.POOL, address(proposal)); | ||
} | ||
} | ||
", | ||
}, | ||
], | ||
"script": "// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.0; | ||
import {GovV3Helpers, IPayloadsControllerCore, PayloadsControllerUtils} from 'aave-helpers/GovV3Helpers.sol'; | ||
import {EthereumScript} from 'aave-helpers/ScriptUtils.sol'; | ||
import {AaveV3Ethereum_Test_20231023} from './AaveV3Ethereum_Test_20231023.sol'; | ||
/** | ||
* @dev Deploy Ethereum | ||
* command: make deploy-ledger contract=src/20231023_AaveV3Ethereum_Test/Test_20231023.s.sol:DeployEthereum chain=mainnet | ||
*/ | ||
contract DeployEthereum is EthereumScript { | ||
function run() external broadcast { | ||
// deploy payloads | ||
AaveV3Ethereum_Test_20231023 payload0 = new AaveV3Ethereum_Test_20231023(); | ||
// compose action | ||
IPayloadsControllerCore.ExecutionAction[] | ||
memory actions = new IPayloadsControllerCore.ExecutionAction[](1); | ||
actions[0] = GovV3Helpers.buildAction(address(payload0)); | ||
// register action at payloadsController | ||
GovV3Helpers.createPayload(actions); | ||
} | ||
} | ||
/** | ||
* @dev Create Proposal | ||
* command: make deploy-ledger contract=src/20231023_AaveV3Ethereum_Test/Test_20231023.s.sol:CreateProposal chain=mainnet | ||
*/ | ||
contract CreateProposal is EthereumScript { | ||
function run() external { | ||
// create payloads | ||
PayloadsControllerUtils.Payload[] memory payloads = new PayloadsControllerUtils.Payload[](1); | ||
// compose actions for validation | ||
IPayloadsControllerCore.ExecutionAction[] | ||
memory actionsEthereum = new IPayloadsControllerCore.ExecutionAction[](1); | ||
actionsEthereum[0] = GovV3Helpers.buildAction(address(0)); | ||
payloads[0] = GovV3Helpers.buildMainnetPayload(vm, actionsEthereum); | ||
// create proposal | ||
vm.startBroadcast(); | ||
GovV3Helpers.createProposal2_5( | ||
payloads, | ||
GovV3Helpers.ipfsHashFile(vm, 'src/20231023_AaveV3Ethereum_Test/Test.md') | ||
); | ||
} | ||
} | ||
", | ||
} | ||
`; | ||
exports[`feature: priceFeedsUpdates > should return reasonable code 1`] = ` | ||
{ | ||
"code": { | ||
"fn": [ | ||
"function priceFeedsUpdates() public pure override returns (IAaveV3ConfigEngine.PriceFeedUpdate[] memory) { | ||
IAaveV3ConfigEngine.PriceFeedUpdate[] memory priceFeedUpdates = new IAaveV3ConfigEngine.PriceFeedUpdate[](1); | ||
priceFeedUpdates[0] = IAaveV3ConfigEngine.PriceFeedUpdate({ | ||
asset: AaveV3EthereumAssets.DAI_UNDERLYING, | ||
priceFeed: 0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84 | ||
}); | ||
return priceFeedUpdates; | ||
}", | ||
], | ||
}, | ||
} | ||
`; |
Oops, something went wrong.
b8d4bbb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Foundry report
Build log
Test success 🌈