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

feat: 3.2.0 #345

Merged
merged 22 commits into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions .assets/17f6b65b666e033f6d757eab80af272608f3179e.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions .assets/229e4f50d5cb7a04464c2bd175ef23d256e2d25d.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions .assets/23e67c7d46dd80f36d580b243c5716c84080a34f.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions .assets/3f4ff4e3916b8e502cabc40483a392da51ad678a.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions .assets/4023527fa4852947cff1f02ae9ff00ea9bc77719.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions .assets/47b0af3d54a5c5cfec9387787b9ad4e8de5bce63.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions .assets/5f6eef0835ac19ee0c898e4b760d8970954291bf.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions .assets/64fd6acec636adec0e975e8031f8e3f7fb87bb7d.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions .assets/772fdedb24491c4dde9a73af5e1fd183523d5024.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions .assets/838ead98a9ae093ded1390e58ff2a328cd8e29a4.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions .assets/8a8a0e067285eb92c25c539be301949997ccd175.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions .assets/8f48c9478437c54125028a1d71100121cc58dcd0.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions .assets/952932c7b15c44b006f762abc15f3c37d87b04d9.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions .assets/9b3ea57ff4b19f392d36203fa741c94e83a96393.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions .assets/bf52f4b65079681aa65fd69327e3061d269fe51d.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions .assets/c6f6294fedb5e5b5fc418d2c7861ece2c2bdef75.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions .assets/ea9358e636f19fd911c6b5fcbe0f3b0c33f010bb.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions .assets/ee98e9626d6dd42942fdaf5d08078961de8bf38f.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions .assets/fefe2c9708de2db1319f2fac935bcc21796a28c0.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
[submodule "lib/forge-std"]
path = lib/forge-std
url = https://github.com/foundry-rs/forge-std
[submodule "lib/solidity-utils"]
path = lib/solidity-utils
url = https://github.com/bgd-labs/solidity-utils
[submodule "lib/aave-address-book"]
path = lib/aave-address-book
url = https://github.com/bgd-labs/aave-address-book
2,088 changes: 2 additions & 2,086 deletions diffs/default_before_default_after.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/aave-address-book
Submodule aave-address-book updated 142 files
1 change: 0 additions & 1 deletion lib/solidity-utils
Submodule solidity-utils deleted from 5d728d
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"test": "tests"
},
"scripts": {
"prettier": "prettier --write 'src/**/*.sol'",
"lint:fix": "prettier --write 'src/**/*.sol'",
"prettier:tests": "prettier --write 'tests/**/*.sol'"
},
"repository": {
Expand All @@ -26,6 +26,6 @@
"prettier-plugin-solidity": "^1.1.3"
},
"dependencies": {
"@bgd-labs/aave-cli": "0.16.2"
"@bgd-labs/aave-cli": "1.0.0"
}
}
5 changes: 2 additions & 3 deletions remappings.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
aave-address-book/=lib/aave-address-book/src/
aave-v3-origin/=lib/aave-address-book/lib/aave-v3-origin/src/
aave-v3-core/=lib/aave-address-book/lib/aave-v3-origin/src/core
aave-v3-periphery/=lib/aave-address-book/lib/aave-v3-origin/src/periphery
aave-v3-origin-tests/=lib/aave-address-book/lib/aave-v3-origin/tests
forge-std/=lib/forge-std/src/
solidity-utils/=lib/solidity-utils/src/
solidity-utils/=lib/aave-address-book/lib/aave-v3-origin/lib/solidity-utils/src/
2 changes: 1 addition & 1 deletion scripts/RiskStewards.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pragma solidity ^0.8.0;

import 'solidity-utils/contracts/utils/ScriptUtils.sol';
import {CapsPlusRiskSteward} from '../src/riskstewards/CapsPlusRiskSteward.sol';
import {IAaveV3ConfigEngine} from 'aave-v3-origin/periphery/contracts/v3-config-engine/IAaveV3ConfigEngine.sol';
import {IAaveV3ConfigEngine} from 'aave-v3-origin/contracts/extensions/v3-config-engine/IAaveV3ConfigEngine.sol';
import {AaveV3Ethereum} from 'aave-address-book/AaveV3Ethereum.sol';
import {AaveV3Polygon} from 'aave-address-book/AaveV3Polygon.sol';
import {AaveV3Avalanche} from 'aave-address-book/AaveV3Avalanche.sol';
Expand Down
17 changes: 13 additions & 4 deletions src/GovV3Helpers.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {Vm} from 'forge-std/Vm.sol';
import {ChainIds, ChainHelpers} from 'solidity-utils/contracts/utils/ChainHelpers.sol';
import {IpfsUtils} from './IpfsUtils.sol';
import {console2} from 'forge-std/console2.sol';
import {ProxyHelpers} from 'aave-v3-origin-tests/utils/ProxyHelpers.sol';
import {PayloadsControllerUtils, IGovernancePowerStrategy, IPayloadsControllerCore, IGovernanceCore} from 'aave-address-book/GovernanceV3.sol';
import {IVotingMachineWithProofs} from 'aave-address-book/governance-v3/IVotingMachineWithProofs.sol';
import {IVotingPortal} from 'aave-address-book/governance-v3/IVotingPortal.sol';
Expand All @@ -24,7 +25,6 @@ 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 {ProxyHelpers} from './ProxyHelpers.sol';
import {Create2UtilsZkSync} from 'solidity-utils/../zksync/src/contracts/utils/ScriptUtilsZkSync.sol';

interface IGovernance_V2_5 {
Expand Down Expand Up @@ -232,10 +232,19 @@ library GovV3Helpers {
return buildAction(payloadAddress);
}

function _getBytecodeHashFromArtifacts(Vm vm, string memory contractName) private view returns (bytes32 bytecodeHash) {
string memory artifactPath = string.concat('zkout/', contractName, '.sol/', contractName, '.json');
function _getBytecodeHashFromArtifacts(
Vm vm,
string memory contractName
) private view returns (bytes32 bytecodeHash) {
string memory artifactPath = string.concat(
'zkout/',
contractName,
'.sol/',
contractName,
'.json'
);
string memory artifact = vm.readFile(artifactPath);
bytecodeHash = vm.parseJsonBytes32(artifact, ".hash");
bytecodeHash = vm.parseJsonBytes32(artifact, '.hash');

require(bytecodeHash != (bytes32(0)), 'Unable to fetch bytecodeHash from the zkout artifacts');
return bytecodeHash;
Expand Down
2 changes: 1 addition & 1 deletion src/ProtocolV2TestBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {ChainIds} from 'solidity-utils/contracts/utils/ChainHelpers.sol';
import {IInitializableAdminUpgradeabilityProxy} from './interfaces/IInitializableAdminUpgradeabilityProxy.sol';
import {ExtendedAggregatorV2V3Interface} from './interfaces/ExtendedAggregatorV2V3Interface.sol';
import {CommonTestBase, ReserveTokens} from './CommonTestBase.sol';
import {ProxyHelpers} from './ProxyHelpers.sol';
import {ProxyHelpers} from 'aave-v3-origin/../tests/utils/ProxyHelpers.sol';

struct ReserveConfig {
string symbol;
Expand Down
89 changes: 55 additions & 34 deletions src/ProtocolV3TestBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@ import {IAaveOracle, IPool, IPoolAddressesProvider, IPoolDataProvider, IReserveI
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 {ReserveConfiguration} from 'aave-v3-origin/core/contracts/protocol/libraries/configuration/ReserveConfiguration.sol';
import {IDefaultInterestRateStrategyV2} from 'aave-v3-origin/core/contracts/interfaces/IDefaultInterestRateStrategyV2.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';
import {DiffUtils} from 'aave-v3-origin/../tests/utils/DiffUtils.sol';
import {ProtocolV3TestBase as RawProtocolV3TestBase, ReserveConfig} from 'aave-v3-origin/../tests/utils/ProtocolV3TestBase.sol';
import {DiffUtils} from 'aave-v3-origin-tests/utils/DiffUtils.sol';
import {ProtocolV3TestBase as RawProtocolV3TestBase, ReserveConfig} from 'aave-v3-origin-tests/utils/ProtocolV3TestBase.sol';
import {IInitializableAdminUpgradeabilityProxy} from './interfaces/IInitializableAdminUpgradeabilityProxy.sol';
import {ExtendedAggregatorV2V3Interface} from './interfaces/ExtendedAggregatorV2V3Interface.sol';
import {ProxyHelpers} from './ProxyHelpers.sol';
import {CommonTestBase, ReserveTokens} from './CommonTestBase.sol';
import {ILegacyDefaultInterestRateStrategy} from './dependencies/ILegacyDefaultInterestRateStrategy.sol';

Expand Down Expand Up @@ -317,35 +316,57 @@ contract ProtocolV3TestBase is RawProtocolV3TestBase, CommonTestBase {
return configuration.getIsVirtualAccActive();
}

function _logReserveConfig(ReserveConfig memory config) internal pure {
console.log('Symbol ', config.symbol);
console.log('Underlying address ', config.underlying);
console.log('AToken address ', config.aToken);
console.log('Stable debt token address ', config.stableDebtToken);
console.log('Variable debt token address ', config.variableDebtToken);
console.log('Decimals ', config.decimals);
console.log('LTV ', config.ltv);
console.log('Liquidation Threshold ', config.liquidationThreshold);
console.log('Liquidation Bonus ', config.liquidationBonus);
console.log('Liquidation protocol fee ', config.liquidationProtocolFee);
console.log('Reserve Factor ', config.reserveFactor);
console.log('Usage as collateral enabled ', (config.usageAsCollateralEnabled) ? 'Yes' : 'No');
console.log('Borrowing enabled ', (config.borrowingEnabled) ? 'Yes' : 'No');
console.log('Stable borrow rate enabled ', (config.stableBorrowRateEnabled) ? 'Yes' : 'No');
console.log('Supply cap ', config.supplyCap);
console.log('Borrow cap ', config.borrowCap);
console.log('Debt ceiling ', config.debtCeiling);
console.log('eMode category ', config.eModeCategory);
console.log('Interest rate strategy ', config.interestRateStrategy);
console.log('Is active ', (config.isActive) ? 'Yes' : 'No');
console.log('Is frozen ', (config.isFrozen) ? 'Yes' : 'No');
console.log('Is siloed ', (config.isSiloed) ? 'Yes' : 'No');
console.log('Is borrowable in isolation ', (config.isBorrowableInIsolation) ? 'Yes' : 'No');
console.log('Is flashloanable ', (config.isFlashloanable) ? 'Yes' : 'No');
console.log('Is virtual accounting active ', (config.virtualAccActive) ? 'Yes' : 'No');
console.log('Virtual balance ', config.virtualBalance);
console.log('-----');
console.log('-----');
function _writeEModeConfigs(string memory path, IPool pool) internal virtual override {
// keys for json stringification
string memory eModesKey = 'emodes';
string memory content = '{}';
vm.serializeJson(eModesKey, '{}');
uint8 emptyCounter = 0;
for (uint8 i = 0; i < 256; i++) {
try pool.getEModeCategoryCollateralConfig(i) returns (DataTypes.CollateralConfig memory cfg) {
if (cfg.liquidationThreshold == 0) {
if (++emptyCounter > 2) break;
} else {
string memory key = vm.toString(i);
vm.serializeJson(key, '{}');
vm.serializeUint(key, 'eModeCategory', i);
vm.serializeString(key, 'label', pool.getEModeCategoryLabel(i));
vm.serializeUint(key, 'ltv', cfg.ltv);
vm.serializeString(
key,
'collateralBitmap',
vm.toString(pool.getEModeCategoryCollateralBitmap(i))
);
vm.serializeString(
key,
'borrowableBitmap',
vm.toString(pool.getEModeCategoryBorrowableBitmap(i))
);
vm.serializeUint(key, 'liquidationThreshold', cfg.liquidationThreshold);
string memory object = vm.serializeUint(key, 'liquidationBonus', cfg.liquidationBonus);
content = vm.serializeString(eModesKey, key, object);
emptyCounter = 0;
}
} catch {
DataTypes.EModeCategoryLegacy memory category = pool.getEModeCategoryData(i);
if (category.liquidationThreshold == 0) {
if (++emptyCounter > 2) break;
} else {
string memory key = vm.toString(i);
vm.serializeJson(key, '{}');
vm.serializeUint(key, 'eModeCategory', i);
vm.serializeString(key, 'label', category.label);
vm.serializeUint(key, 'ltv', category.ltv);
vm.serializeUint(key, 'liquidationThreshold', category.liquidationThreshold);
vm.serializeUint(key, 'liquidationBonus', category.liquidationBonus);
string memory object = vm.serializeAddress(key, 'priceSource', category.priceSource);
content = vm.serializeString(eModesKey, key, object);
emptyCounter = 0;
}
}
}
string memory output = vm.serializeString('root', 'eModes', content);
vm.writeJson(output, path);
}

function _writeStrategyConfigs(
Expand Down
30 changes: 0 additions & 30 deletions src/ProxyHelpers.sol

This file was deleted.

21 changes: 19 additions & 2 deletions src/asset-manager/AaveWstethWithdrawer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {SafeERC20} from 'solidity-utils/contracts/oz-common/SafeERC20.sol';
import {OwnableWithGuardian} from 'solidity-utils/contracts/access-control/OwnableWithGuardian.sol';
import {Initializable} from 'solidity-utils/contracts/transparent-proxy/Initializable.sol';
import {Rescuable721, Rescuable} from 'solidity-utils/contracts/utils/Rescuable721.sol';
import {RescuableBase, IRescuableBase} from 'solidity-utils/contracts/utils/RescuableBase.sol';
import {AaveV3Ethereum, AaveV3EthereumAssets} from 'aave-address-book/AaveV3Ethereum.sol';
import {GovernanceV3Ethereum} from 'aave-address-book/GovernanceV3Ethereum.sol';
import {IAaveWstethWithdrawer, IWithdrawalQueueERC721, IWETH} from './interfaces/IAaveWstethWithdrawer.sol';
Expand All @@ -31,7 +32,12 @@ import {IAaveWstethWithdrawer, IWithdrawalQueueERC721, IWETH} from './interfaces
* @author defijesus.eth
* @notice Helper contract to natively withdraw wstETH to the collector
*/
contract AaveWstethWithdrawer is Initializable, OwnableWithGuardian, Rescuable721, IAaveWstethWithdrawer {
contract AaveWstethWithdrawer is
Initializable,
OwnableWithGuardian,
Rescuable721,
IAaveWstethWithdrawer
{
using SafeERC20 for IERC20;

/// auto incrementing index to store requestIds of withdrawals
Expand All @@ -58,7 +64,10 @@ contract AaveWstethWithdrawer is Initializable, OwnableWithGuardian, Rescuable72
/// @inheritdoc IAaveWstethWithdrawer
function startWithdraw(uint256[] calldata amounts) external onlyOwnerOrGuardian {
uint256 index = nextIndex++;
uint256[] memory rIds = WSTETH_WITHDRAWAL_QUEUE.requestWithdrawalsWstETH(amounts, address(this));
uint256[] memory rIds = WSTETH_WITHDRAWAL_QUEUE.requestWithdrawalsWstETH(
amounts,
address(this)
);

requestIds[index] = rIds;
emit StartedWithdrawal(amounts, index);
Expand Down Expand Up @@ -92,6 +101,14 @@ contract AaveWstethWithdrawer is Initializable, OwnableWithGuardian, Rescuable72
return owner();
}

/// @inheritdoc IRescuableBase
function maxRescue(
address erc20Token
) public view override(RescuableBase, IRescuableBase) returns (uint256) {
return type(uint256).max;
}

fallback() external payable {}

receive() external payable {}
}
3 changes: 1 addition & 2 deletions src/asset-manager/interfaces/IAaveWstethWithdrawer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ interface IAaveWstethWithdrawer {
}

interface IWithdrawalQueueERC721 {

/// @notice Request the batch of wstETH for withdrawal. Approvals for the passed amounts should be done before.
/// @param _amounts an array of wstETH amount values.
/// The standalone withdrawal request will be created for each item in the passed list.
Expand Down Expand Up @@ -72,4 +71,4 @@ interface IWithdrawalQueueERC721 {

interface IWETH {
function deposit() external payable;
}
}
8 changes: 8 additions & 0 deletions src/bridges/arbitrum/AaveArbEthERC20Bridge.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ 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 {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';
import {ChainIds} from 'solidity-utils/contracts/utils/ChainHelpers.sol';

Expand Down Expand Up @@ -113,4 +114,11 @@ contract AaveArbEthERC20Bridge is Ownable, Rescuable, IAaveArbEthERC20Bridge {
function whoCanRescue() public view override returns (address) {
return owner();
}

/// @inheritdoc IRescuableBase
function maxRescue(
address erc20Token
) public view override(RescuableBase, IRescuableBase) returns (uint256) {
return type(uint256).max;
}
}
8 changes: 8 additions & 0 deletions src/bridges/optimism/AaveOpEthERC20Bridge.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ 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 {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';
import {ChainIds} from 'solidity-utils/contracts/utils/ChainHelpers.sol';

Expand Down Expand Up @@ -54,4 +55,11 @@ contract AaveOpEthERC20Bridge is Ownable, Rescuable, IAaveOpEthERC20Bridge {
function whoCanRescue() public view override returns (address) {
return owner();
}

/// @inheritdoc IRescuableBase
function maxRescue(
address erc20Token
) public view override(RescuableBase, IRescuableBase) returns (uint256) {
return type(uint256).max;
}
}
8 changes: 8 additions & 0 deletions src/bridges/polygon/AavePolEthERC20Bridge.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ 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 {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';
import {AaveV2Polygon} from 'aave-address-book/AaveV2Polygon.sol';
import {ChainIds} from 'solidity-utils/contracts/utils/ChainHelpers.sol';
Expand Down Expand Up @@ -97,6 +98,13 @@ contract AavePolEthERC20Bridge is Ownable, Rescuable, IAavePolEthERC20Bridge {
return owner();
}

/// @inheritdoc IRescuableBase
function maxRescue(
address erc20Token
) public view override(RescuableBase, IRescuableBase) returns (uint256) {
return type(uint256).max;
}

receive() external payable {
if (block.chainid != ChainIds.MAINNET) revert InvalidChain();

Expand Down
8 changes: 8 additions & 0 deletions src/bridges/polygon/AavePolEthPlasmaBridge.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ 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 {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';
import {ChainIds} from 'solidity-utils/contracts/utils/ChainHelpers.sol';

Expand Down Expand Up @@ -102,6 +103,13 @@ contract AavePolEthPlasmaBridge is Ownable, Rescuable, IAavePolEthPlasmaBridge {
return owner();
}

/// @inheritdoc IRescuableBase
function maxRescue(
address erc20Token
) public view override(RescuableBase, IRescuableBase) returns (uint256) {
return type(uint256).max;
}

/// @dev Allows the contract to receive Matic on Polygon
receive() external payable {
if (block.chainid != ChainIds.POLYGON) revert InvalidChain();
Expand Down
Loading
Loading