generated from bgd-labs/bgd-forge-template
-
Notifications
You must be signed in to change notification settings - Fork 31
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
feat: pool upgrade #156
Merged
Merged
feat: pool upgrade #156
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
3bbbf42
feat: add freeze feature
sakulstra cd0978c
feat: add freeze feature to allove freezing/unfreezing v3 reserves
sakulstra 8f6972c
patch tests
sakulstra 30a8e19
Removed TODO from Snapshot link
eboadom 79d36ca
Update src/20240104_Multi_Patch/AaveV3Avalanche_Patch_20240104.sol
eboadom c1d1928
Removed TODO from readme
eboadom 5394bd6
fix: gnosis pool address
brotherlymite 825c3fc
156 cleanup (#157)
kyzia551 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import {confirm} from '@inquirer/prompts'; | ||
import {CodeArtifact, FEATURE, FeatureModule} from '../types'; | ||
import {FreezeUpdate} from './types'; | ||
import { | ||
assetsSelectPrompt, | ||
translateAssetToAssetLibUnderlying, | ||
} from '../prompts/assetsSelectPrompt'; | ||
|
||
export const freezeUpdates: FeatureModule<FreezeUpdate[]> = { | ||
value: FEATURE.FREEZE, | ||
description: 'Freeze/Unfreeze a reserve', | ||
async cli({pool}) { | ||
const response: FreezeUpdate[] = []; | ||
const assets = await assetsSelectPrompt({ | ||
message: 'Select the assets you want to change', | ||
pool, | ||
}); | ||
for (const asset of assets) { | ||
console.log(`collecting info for ${asset}`); | ||
response.push({ | ||
asset, | ||
shouldBeFrozen: await confirm({message: 'Should the asset be frozen?'}), | ||
}); | ||
} | ||
return response; | ||
}, | ||
build({pool, cfg}) { | ||
const response: CodeArtifact = { | ||
code: { | ||
execute: cfg.map( | ||
(cfg) => | ||
`${pool}.POOL_CONFIGURATOR.setReserveFreeze(${translateAssetToAssetLibUnderlying( | ||
cfg.asset, | ||
pool | ||
)}, false);` | ||
), | ||
}, | ||
}; | ||
return response; | ||
}, | ||
}; |
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
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
21 changes: 21 additions & 0 deletions
21
src/20240104_Multi_Patch/AaveV3Arbitrum_Patch_20240104.sol
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,21 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.0; | ||
|
||
import {AaveV3Arbitrum} from 'aave-address-book/AaveV3Arbitrum.sol'; | ||
import {PoolAddresses} from './PoolLibrary.sol'; | ||
import {AaveV3GenericPatch_20240104} from './AaveV3GenericPatch_20240104.sol'; | ||
|
||
/** | ||
* @title Patch | ||
* @author BGD Labs @bgdlabs | ||
* - Snapshot: N/A | ||
* - Discussion: https://governance.aave.com/t/pre-cautionary-measures-on-three-aave-v3-assets/16037 | ||
*/ | ||
contract AaveV3Arbitrum_Patch_20240104 is AaveV3GenericPatch_20240104 { | ||
constructor() | ||
AaveV3GenericPatch_20240104( | ||
PoolAddresses.ARBITRUM_POOL_IMPL_ADDRESS, | ||
AaveV3Arbitrum.POOL_ADDRESSES_PROVIDER | ||
) | ||
{} | ||
} |
16 changes: 16 additions & 0 deletions
16
src/20240104_Multi_Patch/AaveV3Arbitrum_Patch_20240104.t.sol
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,16 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.0; | ||
|
||
import {AaveV3Generic_Patch_20240104_Test} from './AaveV3Generic_Patch_20240104_Test.sol'; | ||
import {AaveV3Arbitrum_Patch_20240104} from './AaveV3Arbitrum_Patch_20240104.sol'; | ||
|
||
/** | ||
* @dev Test for AaveV3Arbitrum_Patch_20240104 | ||
* command: make test-contract filter=AaveV3Arbitrum_Patch_20240104 | ||
*/ | ||
contract AaveV3Arbitrum_Patch_20240104_Test is AaveV3Generic_Patch_20240104_Test { | ||
function setUp() public { | ||
vm.createSelectFork(vm.rpcUrl('arbitrum'), 167017329); | ||
proposal = address(new AaveV3Arbitrum_Patch_20240104()); | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
src/20240104_Multi_Patch/AaveV3Avalanche_Patch_20240104.sol
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,21 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.0; | ||
|
||
import {AaveV3Avalanche} from 'aave-address-book/AaveV3Avalanche.sol'; | ||
import {PoolAddresses} from './PoolLibrary.sol'; | ||
import {AaveV3GenericPatch_20240104} from './AaveV3GenericPatch_20240104.sol'; | ||
|
||
/** | ||
* @title Patch | ||
* @author BGD Labs @bgdlabs | ||
* - Snapshot: N/A | ||
* - Discussion: https://governance.aave.com/t/pre-cautionary-measures-on-three-aave-v3-assets/16037 | ||
*/ | ||
contract AaveV3Avalanche_Patch_20240104 is AaveV3GenericPatch_20240104 { | ||
constructor() | ||
AaveV3GenericPatch_20240104( | ||
PoolAddresses.AVALANCHE_POOL_IMPL_ADDRESS, | ||
AaveV3Avalanche.POOL_ADDRESSES_PROVIDER | ||
) | ||
{} | ||
} |
16 changes: 16 additions & 0 deletions
16
src/20240104_Multi_Patch/AaveV3Avalanche_Patch_20240104.t.sol
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,16 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.0; | ||
|
||
import {AaveV3Generic_Patch_20240104_Test} from './AaveV3Generic_Patch_20240104_Test.sol'; | ||
import {AaveV3Avalanche_Patch_20240104} from './AaveV3Avalanche_Patch_20240104.sol'; | ||
|
||
/** | ||
* @dev Test for AaveV3Avalanche_Patch_20240104 | ||
* command: make test-contract filter=AaveV3Avalanche_Patch_20240104 | ||
*/ | ||
contract AaveV3Avalanche_Patch_20240104_Test is AaveV3Generic_Patch_20240104_Test { | ||
function setUp() public { | ||
vm.createSelectFork(vm.rpcUrl('avalanche'), 39925983); | ||
proposal = address(new AaveV3Avalanche_Patch_20240104()); | ||
} | ||
} |
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,21 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.0; | ||
|
||
import {AaveV3Base} from 'aave-address-book/AaveV3Base.sol'; | ||
import {PoolAddresses} from './PoolLibrary.sol'; | ||
import {AaveV3GenericPatch_20240104} from './AaveV3GenericPatch_20240104.sol'; | ||
|
||
/** | ||
* @title Patch | ||
* @author BGD Labs @bgdlabs | ||
* - Snapshot: N/A | ||
* - Discussion: https://governance.aave.com/t/pre-cautionary-measures-on-three-aave-v3-assets/16037 | ||
*/ | ||
contract AaveV3Base_Patch_20240104 is AaveV3GenericPatch_20240104 { | ||
constructor() | ||
AaveV3GenericPatch_20240104( | ||
PoolAddresses.BASE_POOL_IMPL_ADDRESS, | ||
AaveV3Base.POOL_ADDRESSES_PROVIDER | ||
) | ||
{} | ||
} |
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,16 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.0; | ||
|
||
import {AaveV3Generic_Patch_20240104_Test} from './AaveV3Generic_Patch_20240104_Test.sol'; | ||
import {AaveV3Base_Patch_20240104} from './AaveV3Base_Patch_20240104.sol'; | ||
|
||
/** | ||
* @dev Test for AaveV3Base_Patch_20240104 | ||
* command: make test-contract filter=AaveV3Base_Patch_20240104 | ||
*/ | ||
contract AaveV3Base_Patch_20240104_Test is AaveV3Generic_Patch_20240104_Test { | ||
function setUp() public { | ||
vm.createSelectFork(vm.rpcUrl('base'), 8792857); | ||
proposal = address(new AaveV3Base_Patch_20240104()); | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
src/20240104_Multi_Patch/AaveV3Ethereum_Patch_20240104.sol
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,21 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.0; | ||
|
||
import {AaveV3Ethereum} from 'aave-address-book/AaveV3Ethereum.sol'; | ||
import {PoolAddresses} from './PoolLibrary.sol'; | ||
import {AaveV3GenericPatch_20240104} from './AaveV3GenericPatch_20240104.sol'; | ||
|
||
/** | ||
* @title Patch | ||
* @author BGD Labs @bgdlabs | ||
* - Snapshot: N/A | ||
* - Discussion: https://governance.aave.com/t/pre-cautionary-measures-on-three-aave-v3-assets/16037 | ||
*/ | ||
contract AaveV3Ethereum_Patch_20240104 is AaveV3GenericPatch_20240104 { | ||
constructor() | ||
AaveV3GenericPatch_20240104( | ||
PoolAddresses.ETHEREUM_POOL_IMPL_ADDRESS, | ||
AaveV3Ethereum.POOL_ADDRESSES_PROVIDER | ||
) | ||
{} | ||
} |
16 changes: 16 additions & 0 deletions
16
src/20240104_Multi_Patch/AaveV3Ethereum_Patch_20240104.t.sol
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,16 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.0; | ||
|
||
import {AaveV3Generic_Patch_20240104_Test} from './AaveV3Generic_Patch_20240104_Test.sol'; | ||
import {AaveV3Ethereum_Patch_20240104} from './AaveV3Ethereum_Patch_20240104.sol'; | ||
|
||
/** | ||
* @dev Test for AaveV3Ethereum_Patch_20240104 | ||
* command: make test-contract filter=AaveV3Ethereum_Patch_20240104 | ||
*/ | ||
contract AaveV3Ethereum_Patch_20240104_Test is AaveV3Generic_Patch_20240104_Test { | ||
function setUp() public { | ||
vm.createSelectFork(vm.rpcUrl('mainnet'), 18934274); | ||
proposal = address(new AaveV3Ethereum_Patch_20240104()); | ||
} | ||
} |
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,21 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.0; | ||
|
||
import {IProposalGenericExecutor} from 'aave-helpers/interfaces/IProposalGenericExecutor.sol'; | ||
import {IPoolAddressesProvider} from 'aave-address-book/AaveV3.sol'; | ||
import {Address} from 'solidity-utils/contracts/oz-common/Address.sol'; | ||
|
||
contract AaveV3GenericPatch_20240104 is IProposalGenericExecutor { | ||
address public immutable NEW_POOL_IMPL; | ||
IPoolAddressesProvider public immutable POOL_ADDRESSES_PROVIDER; | ||
|
||
constructor(address newPoolImpl, IPoolAddressesProvider poolAddressesProvider) { | ||
NEW_POOL_IMPL = newPoolImpl; | ||
POOL_ADDRESSES_PROVIDER = poolAddressesProvider; | ||
} | ||
|
||
function execute() external { | ||
require(Address.isContract(NEW_POOL_IMPL), 'CONTRACT_NON_YET_DEPLOYED'); | ||
POOL_ADDRESSES_PROVIDER.setPoolImpl(NEW_POOL_IMPL); | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
src/20240104_Multi_Patch/AaveV3Generic_Patch_20240104_Test.sol
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,16 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.0; | ||
|
||
import {ProtocolV3TestBase} from 'aave-helpers/ProtocolV3TestBase.sol'; | ||
|
||
contract AaveV3Generic_Patch_20240104_Test is ProtocolV3TestBase { | ||
address internal proposal; | ||
|
||
/** | ||
* @dev execution will fail because logic is not yet deployed | ||
*/ | ||
function testFail_defaultProposalExecution() public { | ||
require(proposal != address(0)); | ||
executePayload(vm, proposal); | ||
} | ||
} |
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,21 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.0; | ||
|
||
import {AaveV3Gnosis} from 'aave-address-book/AaveV3Gnosis.sol'; | ||
import {PoolAddresses} from './PoolLibrary.sol'; | ||
import {AaveV3GenericPatch_20240104} from './AaveV3GenericPatch_20240104.sol'; | ||
|
||
/** | ||
* @title Patch | ||
* @author BGD Labs @bgdlabs | ||
* - Snapshot: N/A | ||
* - Discussion: https://governance.aave.com/t/pre-cautionary-measures-on-three-aave-v3-assets/16037 | ||
*/ | ||
contract AaveV3Gnosis_Patch_20240104 is AaveV3GenericPatch_20240104 { | ||
constructor() | ||
AaveV3GenericPatch_20240104( | ||
PoolAddresses.GNOSIS_POOL_IMPL_ADDRESS, | ||
AaveV3Gnosis.POOL_ADDRESSES_PROVIDER | ||
) | ||
{} | ||
} |
16 changes: 16 additions & 0 deletions
16
src/20240104_Multi_Patch/AaveV3Gnosis_Patch_20240104.t.sol
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,16 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.0; | ||
|
||
import {AaveV3Generic_Patch_20240104_Test} from './AaveV3Generic_Patch_20240104_Test.sol'; | ||
import {AaveV3Gnosis_Patch_20240104} from './AaveV3Gnosis_Patch_20240104.sol'; | ||
|
||
/** | ||
* @dev Test for AaveV3Gnosis_Patch_20240104 | ||
* command: make test-contract filter=AaveV3Gnosis_Patch_20240104 | ||
*/ | ||
contract AaveV3Gnosis_Patch_20240104_Test is AaveV3Generic_Patch_20240104_Test { | ||
function setUp() public { | ||
vm.createSelectFork(vm.rpcUrl('gnosis'), 31781458); | ||
proposal = address(new AaveV3Gnosis_Patch_20240104()); | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
src/20240104_Multi_Patch/AaveV3Optimism_Patch_20240104.sol
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,21 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.0; | ||
|
||
import {AaveV3Optimism} from 'aave-address-book/AaveV3Optimism.sol'; | ||
import {PoolAddresses} from './PoolLibrary.sol'; | ||
import {AaveV3GenericPatch_20240104} from './AaveV3GenericPatch_20240104.sol'; | ||
|
||
/** | ||
* @title Patch | ||
* @author BGD Labs @bgdlabs | ||
* - Snapshot: N/A | ||
* - Discussion: https://governance.aave.com/t/pre-cautionary-measures-on-three-aave-v3-assets/16037 | ||
*/ | ||
contract AaveV3Optimism_Patch_20240104 is AaveV3GenericPatch_20240104 { | ||
constructor() | ||
AaveV3GenericPatch_20240104( | ||
PoolAddresses.OPTIMISM_POOL_IMPL_ADDRESS, | ||
AaveV3Optimism.POOL_ADDRESSES_PROVIDER | ||
) | ||
{} | ||
} |
16 changes: 16 additions & 0 deletions
16
src/20240104_Multi_Patch/AaveV3Optimism_Patch_20240104.t.sol
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,16 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.0; | ||
|
||
import {AaveV3Generic_Patch_20240104_Test} from './AaveV3Generic_Patch_20240104_Test.sol'; | ||
import {AaveV3Optimism_Patch_20240104} from './AaveV3Optimism_Patch_20240104.sol'; | ||
|
||
/** | ||
* @dev Test for AaveV3Optimism_Patch_20240104 | ||
* command: make test-contract filter=AaveV3Optimism_Patch_20240104 | ||
*/ | ||
contract AaveV3Optimism_Patch_20240104_Test is AaveV3Generic_Patch_20240104_Test { | ||
function setUp() public { | ||
vm.createSelectFork(vm.rpcUrl('optimism'), 114388130); | ||
proposal = address(new AaveV3Optimism_Patch_20240104()); | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
@kyzia551 Maybe we can make this contract abstract?