Skip to content
Closed
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
2 changes: 1 addition & 1 deletion lib/aave-address-book
Submodule aave-address-book updated 613 files
2 changes: 1 addition & 1 deletion lib/aave-v3-core
Submodule aave-v3-core updated 221 files
2 changes: 1 addition & 1 deletion lib/aave-v3-periphery
Submodule aave-v3-periphery updated 59 files
+1 −1 .eslintrc.json
+6 −0 .prettierrc
+56 −0 CHANGELOG.md
+4 −1 Dockerfile
+1 −1 README.md
+3 −1 contracts/adapters/paraswap/BaseParaSwapAdapter.sol
+10 −7 contracts/adapters/paraswap/BaseParaSwapBuyAdapter.sol
+10 −7 contracts/adapters/paraswap/BaseParaSwapSellAdapter.sol
+8 −6 contracts/adapters/paraswap/ParaSwapLiquiditySwapAdapter.sol
+10 −8 contracts/adapters/paraswap/ParaSwapRepayAdapter.sol
+86 −0 contracts/adapters/paraswap/ParaSwapWithdrawSwapAdapter.sol
+4 −5 contracts/libraries/DataTypesHelper.sol
+18 −23 contracts/misc/UiIncentiveDataProviderV3.sol
+11 −21 contracts/misc/UiPoolDataProviderV3.sol
+8 −10 contracts/misc/WalletBalanceProvider.sol
+4 −20 contracts/misc/WrappedTokenGatewayV3.sol
+1 −1 contracts/misc/interfaces/IERC20DetailedBytes.sol
+11 −9 contracts/misc/interfaces/IUiIncentiveDataProviderV3.sol
+10 −12 contracts/misc/interfaces/IUiPoolDataProviderV3.sol
+1 −5 contracts/misc/interfaces/IWETH.sol
+2 −10 contracts/misc/interfaces/IWrappedTokenGatewayV3.sol
+1 −5 contracts/mocks/ATokenMock.sol
+4 −3 contracts/mocks/MockBadTransferStrategy.sol
+33 −20 contracts/mocks/WETH9Mock.sol
+56 −4 contracts/mocks/testnet-helpers/Faucet.sol
+41 −5 contracts/mocks/testnet-helpers/IFaucet.sol
+23 −2 contracts/mocks/testnet-helpers/TestnetERC20.sol
+8 −10 contracts/rewards/EmissionManager.sol
+28 −42 contracts/rewards/RewardsController.sol
+29 −40 contracts/rewards/RewardsDistributor.sol
+1 −5 contracts/rewards/interfaces/IEmissionManager.sol
+8 −11 contracts/rewards/interfaces/IRewardsController.sol
+9 −18 contracts/rewards/interfaces/IRewardsDistributor.sol
+2 −10 contracts/rewards/interfaces/ITransferStrategyBase.sol
+14 −21 contracts/treasury/AaveEcosystemReserveV2.sol
+2 −10 contracts/treasury/AdminControlledEcosystemReserve.sol
+2 −10 contracts/treasury/Collector.sol
+2 −12 contracts/treasury/interfaces/IAaveEcosystemReserveController.sol
+2 −10 contracts/treasury/interfaces/IAdminControlledEcosystemReserve.sol
+2 −10 contracts/treasury/interfaces/ICollector.sol
+3 −1 contracts/treasury/interfaces/IStreamable.sol
+4 −5 contracts/treasury/libs/Address.sol
+5 −26 contracts/treasury/libs/SafeERC20.sol
+4 −3 docs/rewards/rewards-controller.md
+1 −1 docs/rewards/rewards-distributor.md
+14,104 −27,369 package-lock.json
+7 −6 package.json
+205 −12 test/faucet.spec.ts
+25 −4 test/helpers/make-suite.ts
+12 −12 test/paraswap/paraswapAdapters.liquiditySwap.spec.ts
+4 −4 test/paraswap/paraswapAdapters.repay.spec.ts
+982 −0 test/paraswap/paraswapAdapters.withdrawSwap.spec.ts
+1 −1 test/rewards/claim-all-on-behalf.spec.ts
+6 −2 test/rewards/claim-all-rewards-to-self.spec.ts
+9 −4 test/rewards/claim-all-rewards.spec.ts
+9 −2 test/rewards/claim-rewards-low-decimals.spec.ts
+0 −1 test/rewards/emission-manager.spec.ts
+1 −6 test/rewards/misc.spec.ts
+1 −3 tsconfig.json
2 changes: 1 addition & 1 deletion lib/solidity-utils
Submodule solidity-utils updated 78 files
+34 −2 .env.example
+20 −0 .github/workflows/comment.yml
+0 −12 .github/workflows/dispatch-draft-release.yml
+0 −20 .github/workflows/merge-main.yml
+46 −2 .github/workflows/tests.yml
+1 −0 .gitignore
+4 −0 .gitmodules
+15 −2 .prettierrc
+47 −0 Makefile
+32 −0 README.md
+60 −4 foundry.toml
+1 −1 lib/forge-std
+1 −0 lib/openzeppelin-contracts-upgradeable
+4 −4 package.json
+15 −0 script/DeployCreate3Factory.s.sol
+2 −2 script/DeployTransparentProxyFactory.s.sol
+6 −5 src/contracts/access-control/OwnableWithGuardian.sol
+73 −0 src/contracts/access-control/UpgradeableOwnableWithGuardian.sol
+10 −0 src/contracts/access-control/interfaces/IWithGuardian.sol
+149 −0 src/contracts/create3/Create3.sol
+33 −0 src/contracts/create3/Create3Factory.sol
+34 −0 src/contracts/create3/interfaces/ICreate3Factory.sol
+0 −61 src/contracts/emergency/EmergencyConsumer.sol
+0 −37 src/contracts/emergency/interfaces/ICLEmergencyOracle.sol
+0 −30 src/contracts/emergency/interfaces/IEmergencyConsumer.sol
+0 −249 src/contracts/oz-common/Address.sol
+0 −25 src/contracts/oz-common/Context.sol
+0 −84 src/contracts/oz-common/Ownable.sol
+0 −117 src/contracts/oz-common/SafeERC20.sol
+0 −89 src/contracts/oz-common/StorageSlot.sol
+0 −83 src/contracts/oz-common/interfaces/IERC20.sol
+0 −29 src/contracts/oz-common/interfaces/IERC20Metadata.sol
+2 −2 src/contracts/oz-common/interfaces/IERC20WithPermit.sol
+0 −61 src/contracts/oz-common/interfaces/draft-IERC20Permit.sol
+0 −38 src/contracts/transparent-proxy/ERC1967Proxy.sol
+0 −119 src/contracts/transparent-proxy/ERC1967Upgrade.sol
+0 −157 src/contracts/transparent-proxy/Initializable.sol
+0 −92 src/contracts/transparent-proxy/Proxy.sol
+0 −101 src/contracts/transparent-proxy/ProxyAdmin.sol
+5 −86 src/contracts/transparent-proxy/TransparentProxyFactory.sol
+131 −0 src/contracts/transparent-proxy/TransparentProxyFactoryBase.sol
+0 −138 src/contracts/transparent-proxy/TransparentUpgradeableProxy.sol
+0 −17 src/contracts/transparent-proxy/interfaces/IOwnable.sol
+15 −0 src/contracts/transparent-proxy/interfaces/IProxyAdminOzV4.sol
+23 −17 src/contracts/transparent-proxy/interfaces/ITransparentProxyFactory.sol
+156 −0 src/contracts/utils/ChainHelpers.sol
+21 −0 src/contracts/utils/PermissionlessRescuable.sol
+37 −0 src/contracts/utils/Rescuable.sol
+24 −0 src/contracts/utils/Rescuable721.sol
+36 −0 src/contracts/utils/RescuableACL.sol
+30 −0 src/contracts/utils/RescuableBase.sol
+162 −0 src/contracts/utils/ScriptUtils.sol
+30 −0 src/contracts/utils/interfaces/IPermissionlessRescuable.sol
+28 −0 src/contracts/utils/interfaces/IRescuable.sol
+35 −0 src/contracts/utils/interfaces/IRescuable721.sol
+39 −0 src/contracts/utils/interfaces/IRescuableBase.sol
+2 −2 src/deployments/Polygon.sol
+2 −2 src/deployments/Rinkeby.sol
+379 −0 src/mocks/ERC20.sol
+938 −0 src/mocks/ERC721.sol
+1 −1 src/mocks/MockImpl.sol
+12 −0 test/ChainHelperTest.t.sol
+0 −62 test/EmergencyConsumer.t.sol
+44 −12 test/OwnableWithGuardian.t.sol
+127 −0 test/PermissionlessRescuable.t.sol
+115 −0 test/Rescuable.t.sol
+76 −0 test/Rescuable721.t.sol
+117 −0 test/RescuableACL.t.sol
+55 −43 test/TransparentProxyFactory.t.sol
+67 −0 test/UpgradeableOwnableWithGuardian.t.sol
+70 −0 test/create3Test.t.sol
+10 −54 yarn.lock
+13 −0 zksync/script/DeployTransparentProxyFactoryZkSync.s.sol
+69 −0 zksync/src/contracts/transparent-proxy/TransparentProxyFactoryZkSync.sol
+10 −0 zksync/src/contracts/transparent-proxy/interfaces/ITransparentProxyFactoryZkSync.sol
+113 −0 zksync/src/contracts/utils/ScriptUtilsZkSync.sol
+10 −0 zksync/src/contracts/utils/interfaces/ICreate2Factory.sol
+124 −0 zksync/test/TransparentProxyFactoryZkSync.t.sol
2 changes: 1 addition & 1 deletion src/contracts/gho/UpgradeableGhoToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pragma solidity ^0.8.0;

import {EnumerableSet} from '@openzeppelin/contracts/utils/structs/EnumerableSet.sol';
import {AccessControl} from '@openzeppelin/contracts/access/AccessControl.sol';
import {Initializable} from 'solidity-utils/contracts/transparent-proxy/Initializable.sol';
import {Initializable} from '@openzeppelin/contracts/proxy/utils/Initializable.sol';
import {UpgradeableERC20} from './UpgradeableERC20.sol';
import {IGhoToken} from './interfaces/IGhoToken.sol';

Expand Down
2 changes: 1 addition & 1 deletion src/contracts/misc/dependencies/AaveV3-1.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;

import {Address} from 'solidity-utils/contracts/oz-common/Address.sol';
import {Address} from '@openzeppelin/contracts/utils/Address.sol';
import {SafeCast} from '@openzeppelin/contracts/utils/math/SafeCast.sol';
import {IERC165} from '@openzeppelin/contracts/utils/introspection/IERC165.sol';
import {IPoolAddressesProvider} from '@aave/core-v3/contracts/interfaces/IPoolAddressesProvider.sol';
Expand Down
143 changes: 143 additions & 0 deletions src/script/DeployGsm4626.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;

import {Script, console2} from 'forge-std/Script.sol';
import {AaveV3Ethereum, AaveV3EthereumAssets} from 'aave-address-book/AaveV3Ethereum.sol';
import {GovernanceV3Ethereum} from 'aave-address-book/GovernanceV3Ethereum.sol';
import {MiscEthereum} from 'aave-address-book/MiscEthereum.sol';
import {TransparentProxyFactory} from 'solidity-utils/contracts/transparent-proxy/TransparentProxyFactory.sol';
import {IPoolAddressesProvider} from '@aave/core-v3/contracts/interfaces/IPoolAddressesProvider.sol';

import {Gsm4626} from 'src/contracts/facilitators/gsm/Gsm4626.sol';
import {FixedPriceStrategy4626} from 'src/contracts/facilitators/gsm/priceStrategy/FixedPriceStrategy4626.sol';
import {IGsm} from 'src/contracts/facilitators/gsm/interfaces/IGsm.sol';
import {OracleSwapFreezer} from 'src/contracts/facilitators/gsm/swapFreezer/OracleSwapFreezer.sol';

// GSM USDC
uint8 constant USDC_DECIMALS = 6;
uint128 constant USDC_EXPOSURE_CAP = 8_000_000e6;

// GSM USDT
uint8 constant USDT_DECIMALS = 6;
uint128 constant USDT_EXPOSURE_CAP = 16_000_000e6;

uint128 constant SWAP_FREEZE_LOWER_BOUND = 0.99e8;
uint128 constant SWAP_FREEZE_UPPER_BOUND = 1.01e8;
uint128 constant SWAP_UNFREEZE_LOWER_BOUND = 0.995e8;
uint128 constant SWAP_UNFREEZE_UPPER_BOUND = 1.005e8;
bool constant SWAP_UNFREEZE_ALLOWED = true;

contract DeployGsm4626 is Script {
function run() external {
uint256 deployerPrivateKey = vm.envUint('PRIVATE_KEY');
address deployerAddress = vm.addr(deployerPrivateKey);
console2.log('Deployer Address: ', deployerAddress);
console2.log('Deployer Balance: ', address(deployerAddress).balance);
console2.log('Block Number: ', block.number);
vm.startBroadcast(deployerPrivateKey);
_deploy();
vm.stopBroadcast();
}

function _deploy() internal {
// ------------------------------------------------
// 1. FixedPriceStrategy
// ------------------------------------------------
FixedPriceStrategy gsmUsdcPriceStrategy = new FixedPriceStrategy(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Must be FixedPriceStrategy4626

GSM_PRICE_RATIO,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this 1e18? don't see the definition of this constant

AaveV3EthereumAssets.USDC_UNDERLYING,
USDC_DECIMALS
);
console2.log('GSM USDC FixedPriceStrategy: ', address(gsmUsdcPriceStrategy));

FixedPriceStrategy gsmUsdtPriceStrategy = new FixedPriceStrategy(
GSM_PRICE_RATIO,
AaveV3EthereumAssets.USDT_UNDERLYING,
USDT_DECIMALS
);

// ------------------------------------------------
// 2. GSM implementations
// ------------------------------------------------
Gsm4626 gsmUsdcImpl = new Gsm4626(
AaveV3EthereumAssets.GHO_UNDERLYING,
AaveV3EthereumAssets.USDC_STATA_TOKEN,
address(gsmUsdcPriceStrategy)
);
console2.log('GSM stataUSDC Implementation: ', address(gsmUsdcImpl));

Gsm4626 gsmUsdtImpl = new Gsm4626(
AaveV3EthereumAssets.GHO_UNDERLYING,
AaveV3EthereumAssets.USDT_STATA_TOKEN,
address(gsmUsdtPriceStrategy)
);
console2.log('GSM stataUSDT Implementation: ', address(gsmUsdtImpl));

gsmUsdcImpl.initialize(
GovernanceV3Ethereum.EXECUTOR_LVL_1,
address(AaveV3Ethereum.COLLECTOR),
USDC_EXPOSURE_CAP
);
gsmUsdtImpl.initialize(
GovernanceV3Ethereum.EXECUTOR_LVL_1,
address(AaveV3Ethereum.COLLECTOR),
USDT_EXPOSURE_CAP
);

// ------------------------------------------------
// 3. GSM proxy deployment and initialization
// ------------------------------------------------
bytes memory gsmUsdcInitParams = abi.encodeWithSignature(
'initialize(address,address,uint128)',
GovernanceV3Ethereum.EXECUTOR_LVL_1,
address(AaveV3Ethereum.COLLECTOR),
USDC_EXPOSURE_CAP
);
address gsmUsdcProxy = TransaprentProxyFactory(MiscEthereum.TRANSPARENT_PROXY_FACTORY).create(
address(gsmUsdcImpl),
GovernanceV3Ethereum.EXECUTOR_LVL_1,
gsmUsdcInitParams
);
console2.log('GSM stataUSDC Proxy: ', gsmUsdcProxy);

bytes memory gsmUsdtInitParams = abi.encodeWithSignature(
'initialize(address,address,uint128)',
GovernanceV3Ethereum.EXECUTOR_LVL_1,
address(AaveV3Ethereum.COLLECTOR),
USDT_EXPOSURE_CAP
);
address gsmUsdtProxy = TransaprentProxyFactory(MiscEthereum.TRANSPARENT_PROXY_FACTORY).create(
address(gsmUsdtImpl),
GovernanceV3Ethereum.EXECUTOR_LVL_1,
gsmUsdtInitParams
);
console2.log('GSM stataUSDT Proxy: ', gsmUsdtProxy);

// ------------------------------------------------
// 4. OracleSwapFreezers
// ------------------------------------------------
OracleSwapFreezer gsmUsdcOracleSwapFreezer = new OracleSwapFreezer(
IGsm(gsmUsdcProxy),
AaveV3EthereumAssets.USDC_UNDERLYING,
IPoolAddressesProvider(address(AaveV3Ethereum.POOL_ADDRESSES_PROVIDER)),
SWAP_FREEZE_LOWER_BOUND,
SWAP_FREEZE_UPPER_BOUND,
SWAP_UNFREEZE_LOWER_BOUND,
SWAP_UNFREEZE_UPPER_BOUND,
SWAP_UNFREEZE_ALLOWED
);
console2.log('GSM stataUSDC OracleSwapFreezer: ', address(gsmUsdcOracleSwapFreezer));

OracleSwapFreezer gsmUsdtOracleSwapFreezer = new OracleSwapFreezer(
IGsm(gsmUsdtProxy),
AaveV3EthereumAssets.USDT_UNDERLYING,
IPoolAddressesProvider(address(AaveV3Ethereum.POOL_ADDRESSES_PROVIDER)),
SWAP_FREEZE_LOWER_BOUND,
SWAP_FREEZE_UPPER_BOUND,
SWAP_UNFREEZE_LOWER_BOUND,
SWAP_UNFREEZE_UPPER_BOUND,
SWAP_UNFREEZE_ALLOWED
);
console2.log('GSM stataUSDT OracleSwapFreezer: ', address(gsmUsdtOracleSwapFreezer));
}
}
2 changes: 1 addition & 1 deletion src/script/DeployGsmLaunch.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {Script, console2} from 'forge-std/Script.sol';
import {AaveV3Ethereum, AaveV3EthereumAssets} from 'aave-address-book/AaveV3Ethereum.sol';
import {GovernanceV3Ethereum} from 'aave-address-book/GovernanceV3Ethereum.sol';
import {MiscEthereum} from 'aave-address-book/MiscEthereum.sol';
import {TransparentUpgradeableProxy} from 'solidity-utils/contracts/transparent-proxy/TransparentUpgradeableProxy.sol';
import {TransparentUpgradeableProxy} from '@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol';
import {IPoolAddressesProvider} from '@aave/core-v3/contracts/interfaces/IPoolAddressesProvider.sol';
import {Gsm} from '../contracts/facilitators/gsm/Gsm.sol';
import {IGsm} from '../contracts/facilitators/gsm/interfaces/IGsm.sol';
Expand Down
2 changes: 1 addition & 1 deletion src/test/TestGhoBase.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ import {AdminUpgradeabilityProxy} from '@aave/core-v3/contracts/dependencies/ope
import {ERC20} from '@aave/core-v3/contracts/dependencies/openzeppelin/contracts/ERC20.sol';
import {StakedAaveV3} from 'aave-stk-v1-5/src/contracts/StakedAaveV3.sol';
import {ReserveConfiguration} from '@aave/core-v3/contracts/protocol/libraries/configuration/ReserveConfiguration.sol';
import {TransparentUpgradeableProxy} from 'solidity-utils/contracts/transparent-proxy/TransparentUpgradeableProxy.sol';
import {TransparentUpgradeableProxy} from '@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol';

// GHO contracts
import {GhoAToken} from '../contracts/facilitators/aave/tokens/GhoAToken.sol';
Expand Down
2 changes: 1 addition & 1 deletion src/test/TestGhoStewardsForkRemote.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pragma solidity ^0.8.0;
import 'forge-std/Test.sol';
import {IAccessControl} from '@openzeppelin/contracts/access/IAccessControl.sol';
import {IACLManager} from '@aave/core-v3/contracts/interfaces/IACLManager.sol';
import {TransparentUpgradeableProxy} from 'solidity-utils/contracts/transparent-proxy/TransparentUpgradeableProxy.sol';
import {TransparentUpgradeableProxy} from '@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol';
import {AaveV3Arbitrum} from 'aave-address-book/AaveV3Arbitrum.sol';
import {MiscArbitrum} from 'aave-address-book/MiscArbitrum.sol';
import {IPoolAddressesProvider, IPoolDataProvider} from 'aave-address-book/AaveV3.sol';
Expand Down
2 changes: 1 addition & 1 deletion src/test/mocks/MockUpgradeable.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import {Initializable} from 'solidity-utils/contracts/transparent-proxy/Initializable.sol';
import {Initializable} from '@openzeppelin/contracts/proxy/utils/Initializable.sol';

/**
* @dev Mock contract to test upgrades, not to be used in production.
Expand Down
2 changes: 1 addition & 1 deletion src/test/mocks/MockUpgradeableBurnMintTokenPool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pragma solidity ^0.8.0;

import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol';
import {SafeERC20} from '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';
import {Initializable} from 'solidity-utils/contracts/transparent-proxy/Initializable.sol';
import {Initializable} from '@openzeppelin/contracts/proxy/utils/Initializable.sol';
import {EnumerableSet} from '@openzeppelin/contracts/utils/structs/EnumerableSet.sol';
import {RateLimiter} from 'src/contracts/misc/dependencies/Ccip.sol';
import {IRouter} from 'src/contracts/misc/dependencies/Ccip.sol';
Expand Down
2 changes: 1 addition & 1 deletion src/test/mocks/MockUpgradeableLockReleaseTokenPool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pragma solidity ^0.8.0;

import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol';
import {SafeERC20} from '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';
import {Initializable} from 'solidity-utils/contracts/transparent-proxy/Initializable.sol';
import {Initializable} from '@openzeppelin/contracts/proxy/utils/Initializable.sol';
import {EnumerableSet} from '@openzeppelin/contracts/utils/structs/EnumerableSet.sol';
import {RateLimiter} from 'src/contracts/misc/dependencies/Ccip.sol';
import {IRouter} from 'src/contracts/misc/dependencies/Ccip.sol';
Expand Down
Loading