Skip to content

Commit

Permalink
fix: upgrade to use new utils (#369)
Browse files Browse the repository at this point in the history
  • Loading branch information
sakulstra authored Jan 30, 2025
1 parent 2496ce2 commit b4f5861
Show file tree
Hide file tree
Showing 47 changed files with 296 additions and 306 deletions.
6 changes: 3 additions & 3 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

version: 2
updates:
- package-ecosystem: "gitsubmodule" # See documentation for possible values
directory: "/" # Location of package manifests
- package-ecosystem: 'gitsubmodule' # See documentation for possible values
directory: '/' # Location of package manifests
schedule:
interval: "daily"
interval: 'daily'
7 changes: 7 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
lib
out
zkout
reports
cache
broadcast
diffs
310 changes: 145 additions & 165 deletions CHANGELOG.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion diffs/AMMTEST_before_AMMTEST_after.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

```json
{}
```
```
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@
}
}
}
```
```
2 changes: 1 addition & 1 deletion diffs/default_before_default_after.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@
}
}
}
```
```
28 changes: 14 additions & 14 deletions diffs/preTestV2RatesUpdates_postTestV2RatesUpdates.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@

#### USDC ([0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48](https://etherscan.io/address/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48))

| description | value before | value after |
| --- | --- | --- |
| interestRateStrategy | [0xF1722FBCAc1C49bA57a77c3F4373A4bb86a46e60](https://etherscan.io/address/0xF1722FBCAc1C49bA57a77c3F4373A4bb86a46e60) | [0x3c7eb05B1C910542EC236c541f183B07787cC3ff](https://etherscan.io/address/0x3c7eb05B1C910542EC236c541f183B07787cC3ff) |
| variableRateSlope1 | 6.5 % | 42 % |
| stableRateSlope1 | 2 % | 69 % |
| optimalUsageRatio | 90 % | 69 % |
| maxExcessUsageRatio | 10 % | 31 % |
| interestRate | ![before](/.assets/23e67c7d46dd80f36d580b243c5716c84080a34f.svg) | ![after](/.assets/64fd6acec636adec0e975e8031f8e3f7fb87bb7d.svg) |
| description | value before | value after |
| -------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| interestRateStrategy | [0x4e1494475048fa155F1D837B6bD51458bD170f48](https://etherscan.io/address/0x4e1494475048fa155F1D837B6bD51458bD170f48) | [0x8821c6B6cd3C45Ad8b5EF43168BBbD094b63a03c](https://etherscan.io/address/0x8821c6B6cd3C45Ad8b5EF43168BBbD094b63a03c) |
| variableRateSlope1 | 12.5 % | 42 % |
| stableRateSlope1 | 2 % | 69 % |
| optimalUsageRatio | 90 % | 69 % |
| maxExcessUsageRatio | 10 % | 31 % |
| interestRate | ![before](https://dash.onaave.com/api/static?variableRateSlope1=125000000000000000000000000&variableRateSlope2=600000000000000000000000000&optimalUsageRatio=900000000000000000000000000&baseVariableBorrowRate=0&maxVariableBorrowRate=undefined) | ![after](https://dash.onaave.com/api/static?variableRateSlope1=420000000000000000000000000&variableRateSlope2=600000000000000000000000000&optimalUsageRatio=690000000000000000000000000&baseVariableBorrowRate=0&maxVariableBorrowRate=undefined) |

## Raw diff

Expand All @@ -20,16 +20,16 @@
"reserves": {
"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48": {
"interestRateStrategy": {
"from": "0xF1722FBCAc1C49bA57a77c3F4373A4bb86a46e60",
"to": "0x3c7eb05B1C910542EC236c541f183B07787cC3ff"
"from": "0x4e1494475048fa155F1D837B6bD51458bD170f48",
"to": "0x8821c6B6cd3C45Ad8b5EF43168BBbD094b63a03c"
}
}
},
"strategies": {
"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48": {
"address": {
"from": "0xF1722FBCAc1C49bA57a77c3F4373A4bb86a46e60",
"to": "0x3c7eb05B1C910542EC236c541f183B07787cC3ff"
"from": "0x4e1494475048fa155F1D837B6bD51458bD170f48",
"to": "0x8821c6B6cd3C45Ad8b5EF43168BBbD094b63a03c"
},
"maxExcessUsageRatio": {
"from": "100000000000000000000000000",
Expand All @@ -44,10 +44,10 @@
"to": "690000000000000000000000000"
},
"variableRateSlope1": {
"from": "65000000000000000000000000",
"from": "125000000000000000000000000",
"to": "420000000000000000000000000"
}
}
}
}
```
```
2 changes: 1 addition & 1 deletion diffs/zksync_before_zksync_after.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

```json
{}
```
```
2 changes: 1 addition & 1 deletion lib/forge-std
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
"test": "tests"
},
"scripts": {
"lint:fix": "prettier --write 'src/**/*.sol'",
"prettier:tests": "prettier --write 'tests/**/*.sol'"
"lint:fix": "prettier --write ."
},
"repository": {
"type": "git",
Expand Down
11 changes: 3 additions & 8 deletions scripts/AaveSwapperDeployment.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,15 @@ pragma solidity ^0.8.0;

import {Script} from 'forge-std/Script.sol';
import {MiscEthereum} from 'aave-address-book/MiscEthereum.sol';
import {ITransparentProxyFactory, ProxyAdmin} from 'solidity-utils/contracts/transparent-proxy/interfaces/ITransparentProxyFactory.sol';

import {GovernanceV3Ethereum} from 'aave-address-book/GovernanceV3Ethereum.sol';
import {ITransparentProxyFactory} from 'solidity-utils/contracts/transparent-proxy/interfaces/ITransparentProxyFactory.sol';
import {AaveSwapper} from 'src/swaps/AaveSwapper.sol';

contract DeployAaveSwapper is Script {
function run() external {
vm.startBroadcast();

address aaveSwapper = address(new AaveSwapper());
ITransparentProxyFactory(MiscEthereum.TRANSPARENT_PROXY_FACTORY).create(
aaveSwapper,
ProxyAdmin(MiscEthereum.PROXY_ADMIN),
abi.encodeWithSelector(AaveSwapper.initialize.selector)
);
new AaveSwapper();

vm.stopBroadcast();
}
Expand Down
2 changes: 1 addition & 1 deletion scripts/DeployBridges.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

pragma solidity ^0.8.0;

import {IERC20} from 'solidity-utils/contracts/oz-common/interfaces/IERC20.sol';
import {IERC20} from 'openzeppelin-contracts/contracts/token/ERC20/IERC20.sol';
import {GovernanceV3Ethereum} from 'aave-address-book/GovernanceV3Ethereum.sol';
import {GovernanceV3Optimism} from 'aave-address-book/GovernanceV3Optimism.sol';
import {GovernanceV3Polygon} from 'aave-address-book/GovernanceV3Polygon.sol';
Expand Down
5 changes: 3 additions & 2 deletions scripts/V2RateStrategyFactory.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import {AaveV2EthereumAMM} from 'aave-address-book/AaveV2EthereumAMM.sol';
import {AaveV2Polygon} from 'aave-address-book/AaveV2Polygon.sol';
import {AaveV2Avalanche} from 'aave-address-book/AaveV2Avalanche.sol';
import 'solidity-utils/contracts/utils/ScriptUtils.sol';
import {ITransparentProxyFactory, ProxyAdmin} from 'solidity-utils/contracts/transparent-proxy/interfaces/ITransparentProxyFactory.sol';
import {GovernanceV3Ethereum} from 'aave-address-book/GovernanceV3Ethereum.sol';
import {ITransparentProxyFactory} from 'solidity-utils/contracts/transparent-proxy/interfaces/ITransparentProxyFactory.sol';
import {V2RateStrategyFactory} from '../src/v2-config-engine/V2RateStrategyFactory.sol';

library DeployV2RatesFactoryLib {
Expand Down Expand Up @@ -59,7 +60,7 @@ library DeployV2RatesFactoryLib {
V2RateStrategyFactory ratesFactory = V2RateStrategyFactory(
ITransparentProxyFactory(transparentProxyFactory).create(
address(new V2RateStrategyFactory(addressesProvider)),
ProxyAdmin(ownerForFactory),
ownerForFactory,
abi.encodeWithSelector(V2RateStrategyFactory.initialize.selector, uniqueStrategies)
)
);
Expand Down
4 changes: 2 additions & 2 deletions src/CollectorUtils.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ pragma solidity ^0.8.0;
import {IPool, DataTypes} from 'aave-address-book/AaveV3.sol';
import {ICollector} from 'aave-address-book/common/ICollector.sol';
import {ILendingPool, DataTypes as V2DataTypes} from 'aave-address-book/AaveV2.sol';
import {IERC20} from 'solidity-utils/contracts/oz-common/interfaces/IERC20.sol';
import {SafeERC20} from 'solidity-utils/contracts/oz-common/SafeERC20.sol';
import {IERC20} from 'openzeppelin-contracts/contracts/token/ERC20/IERC20.sol';
import {SafeERC20} from 'openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol';

import {AaveSwapper} from './swaps/AaveSwapper.sol';
import {IChainlinkAggregator} from './interfaces/IChainlinkAggregator.sol';
Expand Down
4 changes: 2 additions & 2 deletions src/CommonTestBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pragma solidity >=0.7.5 <0.9.0;
import 'forge-std/StdJson.sol';
import 'forge-std/Test.sol';
import {VmSafe} from 'forge-std/Vm.sol';
import {IERC20} from 'solidity-utils/contracts/oz-common/interfaces/IERC20.sol';
import {IERC20} from 'openzeppelin-contracts/contracts/token/ERC20/IERC20.sol';
import {MiscEthereum} from 'aave-address-book/MiscEthereum.sol';
import {AaveV2EthereumAssets} from 'aave-address-book/AaveV2Ethereum.sol';
import {AaveV3OptimismAssets} from 'aave-address-book/AaveV3Optimism.sol';
Expand Down Expand Up @@ -102,7 +102,7 @@ contract CommonTestBase is Test {
return true;
}
}
if(block.chainid == ChainIds.AVALANCHE) {
if (block.chainid == ChainIds.AVALANCHE) {
// AUSD
if (asset == 0x00000000eFE302BEAA2b3e6e1b18d08D69a9012a) {
vm.prank(0x2CD78aD719a8c74898c5283f5Bc70920D8A061fd);
Expand Down
3 changes: 1 addition & 2 deletions src/GovV3Helpers.sol
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import {GovernanceV3PolygonZkEvm} from 'aave-address-book/GovernanceV3PolygonZkE
import {GovernanceV3ZkSync} from 'aave-address-book/GovernanceV3ZkSync.sol';
import {GovernanceV3Linea} from 'aave-address-book/GovernanceV3Linea.sol';
import {MiscEthereum} from 'aave-address-book/MiscEthereum.sol';
import {Address} from 'solidity-utils/contracts/oz-common/Address.sol';
import {Create2Utils} from 'solidity-utils/contracts/utils/ScriptUtils.sol';
import {StorageHelpers} from './StorageHelpers.sol';
import {Create2UtilsZkSync} from 'solidity-utils/../zksync/src/contracts/utils/ScriptUtilsZkSync.sol';
Expand Down Expand Up @@ -399,7 +398,7 @@ library GovV3Helpers {
* @param payloadAddress address of the payload to execute
*/
function readyPayload(Vm vm, address payloadAddress) internal returns (uint40) {
require(Address.isContract(payloadAddress), 'PAYLOAD_ADDRESS_HAS_NO_CODE');
require(payloadAddress.code.length > 0, 'PAYLOAD_ADDRESS_HAS_NO_CODE');
IPayloadsControllerCore payloadsController = getPayloadsController(block.chainid);
IPayloadsControllerCore.ExecutionAction[]
memory actions = new IPayloadsControllerCore.ExecutionAction[](1);
Expand Down
6 changes: 3 additions & 3 deletions src/ProtocolV2TestBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ pragma solidity >=0.7.5 <0.9.0;

import 'forge-std/Test.sol';
import {IAaveOracle, ILendingPool, ILendingPoolAddressesProvider, ILendingPoolConfigurator, IAaveProtocolDataProvider, DataTypes, TokenData, ILendingRateOracle, IDefaultInterestRateStrategy} from 'aave-address-book/AaveV2.sol';
import {IERC20} from 'solidity-utils/contracts/oz-common/interfaces/IERC20.sol';
import {IERC20Metadata} from 'solidity-utils/contracts/oz-common/interfaces/IERC20Metadata.sol';
import {SafeERC20} from 'solidity-utils/contracts/oz-common/SafeERC20.sol';
import {IERC20} from 'openzeppelin-contracts/contracts/token/ERC20/IERC20.sol';
import {IERC20Metadata} from 'openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Metadata.sol';
import {SafeERC20} from 'openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol';
import {AaveV2EthereumAMM} from 'aave-address-book/AaveV2EthereumAMM.sol';
import {AaveV2EthereumAssets} from 'aave-address-book/AaveV2Ethereum.sol';
import {DiffUtils} from 'aave-v3-origin/../tests/utils/DiffUtils.sol';
Expand Down
6 changes: 3 additions & 3 deletions src/ProtocolV3TestBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ pragma solidity >=0.7.5 <0.9.0;

import 'forge-std/Test.sol';
import {IAaveOracle, IPool, IPoolAddressesProvider, IPoolDataProvider, IReserveInterestRateStrategy, DataTypes, IPoolConfigurator} from 'aave-address-book/AaveV3.sol';
import {IERC20} from 'solidity-utils/contracts/oz-common/interfaces/IERC20.sol';
import {IERC20Metadata} from 'solidity-utils/contracts/oz-common/interfaces/IERC20Metadata.sol';
import {SafeERC20} from 'solidity-utils/contracts/oz-common/SafeERC20.sol';
import {IERC20} from 'openzeppelin-contracts/contracts/token/ERC20/IERC20.sol';
import {IERC20Metadata} from 'openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Metadata.sol';
import {SafeERC20} from 'openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol';
import {ReserveConfiguration} from 'aave-v3-origin/contracts/protocol/libraries/configuration/ReserveConfiguration.sol';
import {IDefaultInterestRateStrategyV2} from 'aave-v3-origin/contracts/interfaces/IDefaultInterestRateStrategyV2.sol';
import {AaveV3EthereumAssets} from 'aave-address-book/AaveV3Ethereum.sol';
Expand Down
10 changes: 4 additions & 6 deletions src/bridges/arbitrum/AaveArbEthERC20Bridge.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

pragma solidity ^0.8.0;

import {IERC20} from 'solidity-utils/contracts/oz-common/interfaces/IERC20.sol';
import {SafeERC20} from 'solidity-utils/contracts/oz-common/SafeERC20.sol';
import {Ownable} from 'solidity-utils/contracts/oz-common/Ownable.sol';
import {IERC20} from 'openzeppelin-contracts/contracts/token/ERC20/IERC20.sol';
import {SafeERC20} from 'openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol';
import {Ownable} from 'openzeppelin-contracts/contracts/access/Ownable.sol';
import {Rescuable} from 'solidity-utils/contracts/utils/Rescuable.sol';
import {RescuableBase, IRescuableBase} from 'solidity-utils/contracts/utils/RescuableBase.sol';
import {AaveV3Ethereum} from 'aave-address-book/AaveV3Ethereum.sol';
Expand Down Expand Up @@ -61,9 +61,7 @@ contract AaveArbEthERC20Bridge is Ownable, Rescuable, IAaveArbEthERC20Bridge {
address public constant MAINNET_OUTBOX = 0x0B9857ae2D4A3DBe74ffE1d7DF045bb7F96E4840;

/// @param _owner The owner of the contract upon deployment
constructor(address _owner) {
_transferOwnership(_owner);
}
constructor(address _owner) Ownable(_owner) {}

/// @inheritdoc IAaveArbEthERC20Bridge
function bridge(
Expand Down
10 changes: 4 additions & 6 deletions src/bridges/optimism/AaveOpEthERC20Bridge.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

pragma solidity ^0.8.0;

import {IERC20} from 'solidity-utils/contracts/oz-common/interfaces/IERC20.sol';
import {SafeERC20} from 'solidity-utils/contracts/oz-common/SafeERC20.sol';
import {Ownable} from 'solidity-utils/contracts/oz-common/Ownable.sol';
import {IERC20} from 'openzeppelin-contracts/contracts/token/ERC20/IERC20.sol';
import {SafeERC20} from 'openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol';
import {Ownable} from 'openzeppelin-contracts/contracts/access/Ownable.sol';
import {Rescuable} from 'solidity-utils/contracts/utils/Rescuable.sol';
import {RescuableBase, IRescuableBase} from 'solidity-utils/contracts/utils/RescuableBase.sol';
import {AaveV3Ethereum} from 'aave-address-book/AaveV3Ethereum.sol';
Expand All @@ -25,9 +25,7 @@ contract AaveOpEthERC20Bridge is Ownable, Rescuable, IAaveOpEthERC20Bridge {
uint256 private _nonce;

/// @param _owner The owner of the contract upon deployment
constructor(address _owner) {
_transferOwnership(_owner);
}
constructor(address _owner) Ownable(_owner) {}

/// @inheritdoc IAaveOpEthERC20Bridge
function bridge(address token, address l1Token, uint256 amount) external onlyOwner {
Expand Down
10 changes: 4 additions & 6 deletions src/bridges/polygon/AavePolEthERC20Bridge.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

pragma solidity ^0.8.0;

import {IERC20} from 'solidity-utils/contracts/oz-common/interfaces/IERC20.sol';
import {SafeERC20} from 'solidity-utils/contracts/oz-common/SafeERC20.sol';
import {Ownable} from 'solidity-utils/contracts/oz-common/Ownable.sol';
import {IERC20} from 'openzeppelin-contracts/contracts/token/ERC20/IERC20.sol';
import {SafeERC20} from 'openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol';
import {Ownable} from 'openzeppelin-contracts/contracts/access/Ownable.sol';
import {Rescuable} from 'solidity-utils/contracts/utils/Rescuable.sol';
import {RescuableBase, IRescuableBase} from 'solidity-utils/contracts/utils/RescuableBase.sol';
import {AaveV3Ethereum} from 'aave-address-book/AaveV3Ethereum.sol';
Expand Down Expand Up @@ -45,9 +45,7 @@ contract AavePolEthERC20Bridge is Ownable, Rescuable, IAavePolEthERC20Bridge {
address public constant ROOT_CHAIN_MANAGER = 0xA0c68C638235ee32657e8f720a23ceC1bFc77C77;

/// @param _owner The owner of the contract upon deployment
constructor(address _owner) {
_transferOwnership(_owner);
}
constructor(address _owner) Ownable(_owner) {}

/// @inheritdoc IAavePolEthERC20Bridge
function bridge(address token, uint256 amount) external onlyOwner {
Expand Down
10 changes: 4 additions & 6 deletions src/bridges/polygon/AavePolEthPlasmaBridge.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

pragma solidity ^0.8.0;

import {IERC20} from 'solidity-utils/contracts/oz-common/interfaces/IERC20.sol';
import {SafeERC20} from 'solidity-utils/contracts/oz-common/SafeERC20.sol';
import {Ownable} from 'solidity-utils/contracts/oz-common/Ownable.sol';
import {IERC20} from 'openzeppelin-contracts/contracts/token/ERC20/IERC20.sol';
import {SafeERC20} from 'openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol';
import {Ownable} from 'openzeppelin-contracts/contracts/access/Ownable.sol';
import {Rescuable} from 'solidity-utils/contracts/utils/Rescuable.sol';
import {RescuableBase, IRescuableBase} from 'solidity-utils/contracts/utils/RescuableBase.sol';
import {AaveV3Ethereum} from 'aave-address-book/AaveV3Ethereum.sol';
Expand Down Expand Up @@ -60,9 +60,7 @@ contract AavePolEthPlasmaBridge is Ownable, Rescuable, IAavePolEthPlasmaBridge {
address public constant MATIC_POLYGON = 0x0000000000000000000000000000000000001010;

/// @param _owner The owner of the contract upon deployment
constructor(address _owner) {
_transferOwnership(_owner);
}
constructor(address _owner) Ownable(_owner) {}

/// @inheritdoc IAavePolEthPlasmaBridge
function bridge(uint256 amount) external onlyOwner {
Expand Down
2 changes: 1 addition & 1 deletion src/dependencies/DefaultReserveInterestRateStrategy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {IReserveInterestRateStrategy} from './IReserveInterestRateStrategy.sol';
import {WadRayMath} from '../dependencies/WadRayMath.sol';
import {PercentageMath} from '../dependencies/PercentageMath.sol';
import {ILendingPoolAddressesProvider, ILendingRateOracle} from 'aave-address-book/AaveV2.sol';
import {IERC20} from 'solidity-utils/contracts/oz-common/interfaces/IERC20.sol';
import {IERC20} from 'openzeppelin-contracts/contracts/token/ERC20/IERC20.sol';

/**
* @title DefaultReserveInterestRateStrategy contract
Expand Down
Loading

0 comments on commit b4f5861

Please sign in to comment.