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.
* feat: add freeze feature * feat: add freeze feature to allove freezing/unfreezing v3 reserves fix: patch freeze feature feat: add patch proposal * patch tests * Removed TODO from Snapshot link * Update src/20240104_Multi_Patch/AaveV3Avalanche_Patch_20240104.sol Co-authored-by: miguelmtz <36620902+miguelmtzinf@users.noreply.github.com> * Removed TODO from readme * fix: gnosis pool address * 156 cleanup (#157) * 156 cleanup * remove boilerplate on run() of GenericDeploy * remove unused import * tests cleanup --------- Co-authored-by: eboado <ebdmrr@gmail.com> Co-authored-by: miguelmtz <36620902+miguelmtzinf@users.noreply.github.com> Co-authored-by: Harsh Pandey <harshsatishpandey@gmail.com> Co-authored-by: Andrey <kyzia.ru@gmail.com>
- Loading branch information
1 parent
1e29888
commit af9ef67
Showing
27 changed files
with
598 additions
and
7 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
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.
af9ef67
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 🌈