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

Modular Gho Stewards #414

Merged
merged 126 commits into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from 113 commits
Commits
Show all changes
126 commits
Select commit Hold shift + click to select a range
1997ee9
forge install: ccip
CheyenneAtapour Jul 8, 2024
de4d2f5
feat: add ability to change bridge limit
CheyenneAtapour Jul 8, 2024
d2f41fa
feat: add change rate limit
CheyenneAtapour Jul 8, 2024
1bc20cd
feat: add arb gho steward
CheyenneAtapour Jul 9, 2024
612ebe4
test: deploy gho pool in base test
CheyenneAtapour Jul 9, 2024
eb204c4
test: update bridge limit
CheyenneAtapour Jul 10, 2024
554ded7
test: update token pool rate limit
CheyenneAtapour Jul 10, 2024
703c063
test: arb gho steward tests wout rate limit
CheyenneAtapour Jul 11, 2024
2b87923
test: rate limit test
CheyenneAtapour Jul 11, 2024
cd06a01
feat: remove ccip dependencies
CheyenneAtapour Jul 18, 2024
d358066
feat: consolidate dependencies to 1 file
CheyenneAtapour Jul 20, 2024
b2d1c93
fix: rename dependency folder
CheyenneAtapour Jul 22, 2024
242aa04
fix: remove unnecessary code
CheyenneAtapour Jul 22, 2024
01acca6
feat: remove struct input for rate limit
CheyenneAtapour Jul 23, 2024
7312cf3
test: add more rate limit tests
CheyenneAtapour Jul 23, 2024
ff72dbf
test: use new remote pool
CheyenneAtapour Jul 23, 2024
0e1b728
feat: initial upload seperated interfaces
CheyenneAtapour Jul 23, 2024
677363a
feat: implement ccip steward
CheyenneAtapour Jul 24, 2024
56cf9d6
feat: implement gsm steward
CheyenneAtapour Jul 24, 2024
01e16d4
feat: implement gho aave steward
CheyenneAtapour Jul 24, 2024
fdf6c2b
fix: add get set facilitators
CheyenneAtapour Jul 24, 2024
c5298a1
chore: prettier
CheyenneAtapour Jul 24, 2024
ab18643
test: deploy new stewards
CheyenneAtapour Jul 25, 2024
e057ad9
test: eth ccip steward
CheyenneAtapour Jul 25, 2024
20ba63f
test: gho aave steward constructor
CheyenneAtapour Jul 25, 2024
c850a0d
test: gho aave steward
CheyenneAtapour Jul 25, 2024
091ce89
test: gho gsm steward
CheyenneAtapour Jul 25, 2024
f5edd0c
test: ccip steward arb
CheyenneAtapour Jul 25, 2024
e0a9b16
test: gho aave steward arb
CheyenneAtapour Jul 25, 2024
1194aa3
fix: remove old stewards
CheyenneAtapour Jul 25, 2024
97ce269
test: bucket capacity manager eth
CheyenneAtapour Jul 25, 2024
9d83320
test: bucket capacity manager arbitrum
CheyenneAtapour Jul 25, 2024
db4aa51
fix: remove gho borrow rate change
CheyenneAtapour Jul 26, 2024
8dd4da7
chore: remove ccip empty dir
CheyenneAtapour Jul 26, 2024
835e347
fix: put inherited interfaces at end per convention
CheyenneAtapour Jul 26, 2024
010ca6f
fix: risk council
CheyenneAtapour Jul 26, 2024
a5652ec
fix: document required roles
CheyenneAtapour Jul 26, 2024
05d78dd
fix: clarify required roles
CheyenneAtapour Jul 26, 2024
861adb5
chore: remove unnecessary comment
CheyenneAtapour Jul 29, 2024
489b7b7
fix: bridge limit flag for ccip steward
CheyenneAtapour Jul 30, 2024
b0d60a9
fix: rename bucket capacity manager
CheyenneAtapour Jul 30, 2024
e1285bf
fix: reorder functions per style guidelines
CheyenneAtapour Jul 30, 2024
eefe810
fix: remove ownable where not required
CheyenneAtapour Jul 30, 2024
279886b
fix: remove unused imports
CheyenneAtapour Jul 30, 2024
236e093
feat: add update gho supply cap
CheyenneAtapour Jul 30, 2024
c2a8c14
test: fuzz rate limit update
CheyenneAtapour Jul 30, 2024
0e01972
fix: grant roles in steward setup
CheyenneAtapour Jul 30, 2024
70ae6fc
fix: enforce bridge limit update conditions
CheyenneAtapour Jul 31, 2024
4c38368
fix: enforce rate limit update conditions
CheyenneAtapour Jul 31, 2024
dd539c4
test: add change ownership test
CheyenneAtapour Jul 31, 2024
135fce9
fix: replace functions with constants
CheyenneAtapour Jul 31, 2024
9359796
fix: change dependency structure
CheyenneAtapour Aug 1, 2024
25edbf7
feat: implement gsm fee strategy factory
CheyenneAtapour Aug 2, 2024
de43b37
fix: reorg files
CheyenneAtapour Aug 2, 2024
1762d1f
feat: add borrow rate update
CheyenneAtapour Aug 3, 2024
2015f8c
fix: use bps instead of ray
CheyenneAtapour Aug 6, 2024
df771f1
test: add back borrow rate tests
CheyenneAtapour Aug 6, 2024
158e021
feat: add all 4 params for borrow rate update
CheyenneAtapour Aug 6, 2024
d53d8e7
fix: rename fixed fee strategy factory
CheyenneAtapour Aug 6, 2024
fe8b115
fix: rename to getStrategyByFees
CheyenneAtapour Aug 6, 2024
7daef90
fix: minor fixes
CheyenneAtapour Aug 6, 2024
a6a6832
fix: remove unnecessary checks
CheyenneAtapour Aug 6, 2024
7e35891
fix: remove unnecessary getter
CheyenneAtapour Aug 6, 2024
5d6c8b8
feat: add timelocks to all steward functions
CheyenneAtapour Aug 7, 2024
586c327
fix: reorder functions
CheyenneAtapour Aug 7, 2024
5cefb60
fix: use internal constant for max borrow rate
CheyenneAtapour Aug 7, 2024
597855b
fix: remove comments
CheyenneAtapour Aug 7, 2024
335fbd1
fix: change from ray to bps
CheyenneAtapour Aug 7, 2024
f8ecd17
fix: name fixedFeeStrategyFactory
CheyenneAtapour Aug 7, 2024
9fb1e29
fix: comments
CheyenneAtapour Aug 7, 2024
3ad1f7e
fix: add docs
CheyenneAtapour Aug 7, 2024
66c7510
fix: remove unused strategy factory
CheyenneAtapour Aug 7, 2024
c8de856
fix: docs
CheyenneAtapour Aug 7, 2024
9e20b2a
test: bridge limit disabled
CheyenneAtapour Aug 7, 2024
d538a77
fix: comments and imports
CheyenneAtapour Aug 7, 2024
a03081b
fix: comments
CheyenneAtapour Aug 7, 2024
64f1ae8
fix: local variable for clarity
CheyenneAtapour Aug 7, 2024
bfe7393
test: revert case for ownership
CheyenneAtapour Aug 7, 2024
3617fd8
test: bucket capacity decrease
CheyenneAtapour Aug 7, 2024
b34db2f
fix: remove unneeded code
CheyenneAtapour Aug 7, 2024
577f656
feat: use pool configurator instead of engine
CheyenneAtapour Aug 8, 2024
561dbbe
fix: remove config engine
CheyenneAtapour Aug 8, 2024
207342d
feat: cut down dependencies
CheyenneAtapour Aug 8, 2024
bd71cd8
feat: put pool into separate file
CheyenneAtapour Aug 8, 2024
0302cdf
feat: cut unnecessary code from ccip pools
CheyenneAtapour Aug 8, 2024
2971b41
fix: put ccip pools in mock folder
CheyenneAtapour Aug 8, 2024
cf1b3d1
fix: move ccip pools to deps
CheyenneAtapour Aug 8, 2024
8b8c5e9
fix: added dev comment link to original
CheyenneAtapour Aug 8, 2024
77b4d54
fix: rename gho bucket steward
CheyenneAtapour Aug 8, 2024
879f742
fix: misc
CheyenneAtapour Aug 8, 2024
29ed300
fix: typo
CheyenneAtapour Aug 8, 2024
3b1123c
fix: do not deploy new borrow rate strategy
CheyenneAtapour Aug 8, 2024
24a6ba9
feat: remove ccip dependency
CheyenneAtapour Aug 9, 2024
81a0ed1
fix: add reduced interface
CheyenneAtapour Aug 9, 2024
1ded1e4
fix: remove unused events
CheyenneAtapour Aug 9, 2024
ab80340
fix: add missing docs
CheyenneAtapour Aug 9, 2024
3a1aadc
fix: function ordering
CheyenneAtapour Aug 9, 2024
2575898
fix: remove unused functions
CheyenneAtapour Aug 9, 2024
9eb0922
fix: remove unused functions
CheyenneAtapour Aug 9, 2024
4d3f137
fix: remove unused events
CheyenneAtapour Aug 9, 2024
957c84f
fix: comment to reflect new name
CheyenneAtapour Aug 9, 2024
1096260
fix: remove unused constant
CheyenneAtapour Aug 18, 2024
d92d7cc
fix: disallow updates with no changed values
CheyenneAtapour Aug 18, 2024
d1fcac2
test: no update checks
CheyenneAtapour Aug 19, 2024
255ddfa
fix: change risk config to borrow config, remove delay
CheyenneAtapour Aug 19, 2024
90770bd
feat: only owner can set borrow rate config
CheyenneAtapour Aug 19, 2024
5115df8
fix: remove check interest rate not set
CheyenneAtapour Aug 19, 2024
ef472d6
fix: update gsm fees works without set strategy
CheyenneAtapour Aug 20, 2024
b050051
test: add 2 of 3 remaining config tests
CheyenneAtapour Aug 20, 2024
2f4eeb7
test: variable rate slope 2 tests
CheyenneAtapour Aug 20, 2024
a229cc1
fix: address pr comments
CheyenneAtapour Aug 21, 2024
7440451
fix: requested changes
CheyenneAtapour Aug 21, 2024
0a09941
fix: requested changes
CheyenneAtapour Aug 22, 2024
a41f8a2
fix: clearer comments and tests
CheyenneAtapour Aug 23, 2024
fe72684
Fix CI (#422)
CheyenneAtapour Sep 4, 2024
4e645f6
test: add fork tests (#416)
CheyenneAtapour Sep 12, 2024
81265c1
fix: Change minimum delay to 1 day
CheyenneAtapour Sep 12, 2024
703087b
fix: Change borrow rate config to 5%
CheyenneAtapour Sep 12, 2024
945fcf8
fix: Change eth fork tests config to 5%
CheyenneAtapour Sep 13, 2024
c8b9c61
fix: Use 5% for config on arbitrum fork tests
CheyenneAtapour Sep 13, 2024
c9d5f9b
fix: Fix solc warnings
miguelmtzinf Sep 13, 2024
c82c63b
fix: add cleanups
miguelmtzinf Sep 13, 2024
f58767b
ci: Certora Review of Modular Gho Steward (#423)
MichaelMorami Sep 16, 2024
1d8a412
fix: Fix lint
miguelmtzinf Sep 16, 2024
82af653
feat: Add initial overview rough draft
CheyenneAtapour Sep 16, 2024
be4e4b6
docs: Rename and format
CheyenneAtapour Sep 17, 2024
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
21 changes: 0 additions & 21 deletions certora/steward/harness/GhoStewardV2_Harness.sol

This file was deleted.

3 changes: 3 additions & 0 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,7 @@ extra_output_files = ["metadata"]
optimizer = true
optimizer_runs = 200

[rpc_endpoints]
mainnet = "${RPC_MAINNET}"

# See more config options https://github.com/foundry-rs/foundry/tree/master/config
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

/**
* @title IFixedRateStrategyFactory
* @author Aave Labs
* @notice Defines the interface of the FixedRateStrategyFactory
*/
interface IFixedRateStrategyFactory {
/**
* @dev Emitted when a new strategy is created
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
/// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;

import {EnumerableSet} from '@openzeppelin/contracts/utils/structs/EnumerableSet.sol';
import {VersionedInitializable} from '@aave/core-v3/contracts/protocol/libraries/aave-upgradeability/VersionedInitializable.sol';
import {IFixedFeeStrategyFactory} from './interfaces/IFixedFeeStrategyFactory.sol';
import {IGsmFeeStrategy} from './interfaces/IGsmFeeStrategy.sol';
import {FixedFeeStrategy} from './FixedFeeStrategy.sol';

/**
* @title FixedFeeStrategyFactory
* @author Aave Labs
* @notice Factory contract to create and keep record of Gsm FixedFeeStrategy contracts
*/
contract FixedFeeStrategyFactory is VersionedInitializable, IFixedFeeStrategyFactory {
using EnumerableSet for EnumerableSet.AddressSet;

// Mapping of fee strategy contracts by buy and sell fees (buyFee => sellFee => feeStrategy)
mapping(uint256 => mapping(uint256 => address)) internal _gsmFeeStrategiesByFees;
EnumerableSet.AddressSet internal _gsmFeeStrategies;

/**
* @dev Initializer
* @param feeStrategiesList List of fee strategies
* @dev Assumes that the addresses provided are deployed FixedFeeStrategy contracts
*/
function initialize(address[] memory feeStrategiesList) external initializer {
for (uint256 i = 0; i < feeStrategiesList.length; i++) {
address feeStrategy = feeStrategiesList[i];
uint256 buyFee = IGsmFeeStrategy(feeStrategy).getBuyFee(1e4);
uint256 sellFee = IGsmFeeStrategy(feeStrategy).getSellFee(1e4);

_gsmFeeStrategiesByFees[buyFee][sellFee] = feeStrategy;
_gsmFeeStrategies.add(feeStrategy);

emit FeeStrategyCreated(feeStrategy, buyFee, sellFee);
}
}

///@inheritdoc IFixedFeeStrategyFactory
function createStrategies(
uint256[] memory buyFeeList,
uint256[] memory sellFeeList
) external returns (address[] memory) {
require(buyFeeList.length == sellFeeList.length, 'INVALID_FEE_LIST');
address[] memory strategies = new address[](buyFeeList.length);
for (uint256 i = 0; i < buyFeeList.length; i++) {
uint256 buyFee = buyFeeList[i];
uint256 sellFee = sellFeeList[i];
address cachedStrategy = _gsmFeeStrategiesByFees[buyFee][sellFee];

if (cachedStrategy == address(0)) {
cachedStrategy = address(new FixedFeeStrategy(buyFee, sellFee));
_gsmFeeStrategiesByFees[buyFee][sellFee] = cachedStrategy;
_gsmFeeStrategies.add(cachedStrategy);

emit FeeStrategyCreated(cachedStrategy, buyFee, sellFee);
}

strategies[i] = cachedStrategy;
}

return strategies;
}

///@inheritdoc IFixedFeeStrategyFactory
function getFixedFeeStrategies() external view returns (address[] memory) {
return _gsmFeeStrategies.values();
}

///@inheritdoc IFixedFeeStrategyFactory
function getFixedFeeStrategy(uint256 buyFee, uint256 sellFee) external view returns (address) {
return _gsmFeeStrategiesByFees[buyFee][sellFee];
}

///@inheritdoc IFixedFeeStrategyFactory
function REVISION() public pure virtual override returns (uint256) {
return 1;
}

/// @inheritdoc VersionedInitializable
function getRevision() internal pure virtual override returns (uint256) {
return REVISION();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

/**
* @title IFixedFeeStrategyFactory
* @author Aave Labs
* @notice Defines the interface of the FixedFeeStrategyFactory
*/
interface IFixedFeeStrategyFactory {
miguelmtzinf marked this conversation as resolved.
Show resolved Hide resolved
/**
* @dev Emitted when a new strategy is created
* @param strategy The address of the new Gsm fee strategy
* @param buyFee The buy fee of the new strategy
* @param sellFee The sell fee of the new strategy
*/
event FeeStrategyCreated(
address indexed strategy,
uint256 indexed buyFee,
uint256 indexed sellFee
);

/**
* @notice Creates new Gsm Fee strategy contracts from lists of buy and sell fees
* @dev Returns the address of a cached contract if a strategy with same fees already exists
* @param buyFeeList The list of buy fees for Gsm fee strategies
* @param sellFeeList The list of sell fees for Gsm fee strategies
* @return The list of Gsm fee strategy contracts
*/
function createStrategies(
uint256[] memory buyFeeList,
uint256[] memory sellFeeList
) external returns (address[] memory);

/**
* @notice Returns all the fee strategy contracts of the factory
* @return The list of fee strategy contracts
*/
function getFixedFeeStrategies() external view returns (address[] memory);

/**
* @notice Returns the fee strategy contract which corresponds to the given fees.
* @dev Returns `address(0)` if there is no fee strategy for the given fees
* @param buyFee The buy fee of the fee strategy contract
* @param sellFee The sell fee of the fee strategy contract
* @return The address of the fee strategy contract
*/
function getFixedFeeStrategy(uint256 buyFee, uint256 sellFee) external view returns (address);

/**
* @notice Returns the GsmFeeStrategyFactory revision number
* @return The revision number
*/
function REVISION() external pure returns (uint256);
}
Loading
Loading