From 070729de68171ab4ba77152bdfd2496e55e19c17 Mon Sep 17 00:00:00 2001 From: Thrilok kumar Date: Wed, 13 Mar 2024 01:22:07 -0400 Subject: [PATCH 1/8] IGP12 --- contracts/payloads/IGP112/PayloadIGP12.sol | 614 ++++++++++++++++++ .../IGP112/libraries/bigMathMinified.sol | 156 +++++ .../IGP112/libraries/liquiditySlotsLink.sol | 101 +++ 3 files changed, 871 insertions(+) create mode 100644 contracts/payloads/IGP112/PayloadIGP12.sol create mode 100644 contracts/payloads/IGP112/libraries/bigMathMinified.sol create mode 100644 contracts/payloads/IGP112/libraries/liquiditySlotsLink.sol diff --git a/contracts/payloads/IGP112/PayloadIGP12.sol b/contracts/payloads/IGP112/PayloadIGP12.sol new file mode 100644 index 0000000..0c8777e --- /dev/null +++ b/contracts/payloads/IGP112/PayloadIGP12.sol @@ -0,0 +1,614 @@ +pragma solidity ^0.7.0; +pragma experimental ABIEncoderV2; + +import { BigMathMinified } from "./libraries/bigMathMinified.sol"; +import { LiquiditySlotsLink } from "./libraries/liquiditySlotsLink.sol"; + +interface IGovernorBravo { + function propose( + address[] memory targets, + uint[] memory values, + string[] memory signatures, + bytes[] memory calldatas, + string memory description + ) external returns (uint); + + function admin() external view returns (address); + + function timelock() external view returns (address); + + function votingDelay() external view returns (uint256); + + function votingPeriod() external view returns (uint256); +} + +interface ITimelock { + function admin() external view returns (address); +} + +interface IInstaIndex { + function changeMaster(address _newMaster) external; + function updateMaster() external; + function master() external view returns (address); +} + +interface AdminModuleStructs { + struct AddressBool { + address addr; + bool value; + } + + struct AddressUint256 { + address addr; + uint256 value; + } + + struct RateDataV1Params { + address token; + uint256 kink; + uint256 rateAtUtilizationZero; + uint256 rateAtUtilizationKink; + uint256 rateAtUtilizationMax; + } + + struct RateDataV2Params { + address token; + uint256 kink1; + uint256 kink2; + uint256 rateAtUtilizationZero; + uint256 rateAtUtilizationKink1; + uint256 rateAtUtilizationKink2; + uint256 rateAtUtilizationMax; + } + + struct TokenConfig { + address token; + uint256 fee; + uint256 threshold; + } + + struct UserSupplyConfig { + address user; + address token; + uint8 mode; + uint256 expandPercent; + uint256 expandDuration; + uint256 baseWithdrawalLimit; + } + + struct UserBorrowConfig { + address user; + address token; + uint8 mode; + uint256 expandPercent; + uint256 expandDuration; + uint256 baseDebtCeiling; + uint256 maxDebtCeiling; + } +} + +interface IFluidLiquidityAdmin { + /// @notice adds/removes auths. Auths generally could be contracts which can have restricted actions defined on contract. + /// auths can be helpful in reducing governance overhead where it's not needed. + /// @param authsStatus_ array of structs setting allowed status for an address. + /// status true => add auth, false => remove auth + function updateAuths(AdminModuleStructs.AddressBool[] calldata authsStatus_) external; + + /// @notice adds/removes guardians. Only callable by Governance. + /// @param guardiansStatus_ array of structs setting allowed status for an address. + /// status true => add guardian, false => remove guardian + function updateGuardians(AdminModuleStructs.AddressBool[] calldata guardiansStatus_) external; + + /// @notice changes the revenue collector address (contract that is sent revenue). Only callable by Governance. + /// @param revenueCollector_ new revenue collector address + function updateRevenueCollector(address revenueCollector_) external; + + /// @notice changes current status, e.g. for pausing or unpausing all user operations. Only callable by Auths. + /// @param newStatus_ new status + /// status = 2 -> pause, status = 1 -> resume. + function changeStatus(uint256 newStatus_) external; + + /// @notice update tokens rate data version 1. Only callable by Auths. + /// @param tokensRateData_ array of RateDataV1Params with rate data to set for each token + function updateRateDataV1s(AdminModuleStructs.RateDataV1Params[] calldata tokensRateData_) external; + + /// @notice update tokens rate data version 2. Only callable by Auths. + /// @param tokensRateData_ array of RateDataV2Params with rate data to set for each token + function updateRateDataV2s(AdminModuleStructs.RateDataV2Params[] calldata tokensRateData_) external; + + /// @notice updates token configs: fee charge on borrowers interest & storage update utilization threshold. + /// Only callable by Auths. + /// @param tokenConfigs_ contains token address, fee & utilization threshold + function updateTokenConfigs(AdminModuleStructs.TokenConfig[] calldata tokenConfigs_) external; + + /// @notice updates user classes: 0 is for new protocols, 1 is for established protocols. + /// Only callable by Auths. + /// @param userClasses_ struct array of uint256 value to assign for each user address + function updateUserClasses(AdminModuleStructs.AddressUint256[] calldata userClasses_) external; + + /// @notice sets user supply configs per token basis. Eg: with interest or interest-free and automated limits. + /// Only callable by Auths. + /// @param userSupplyConfigs_ struct array containing user supply config, see `UserSupplyConfig` struct for more info + function updateUserSupplyConfigs(AdminModuleStructs.UserSupplyConfig[] memory userSupplyConfigs_) external; + + /// @notice setting user borrow configs per token basis. Eg: with interest or interest-free and automated limits. + /// Only callable by Auths. + /// @param userBorrowConfigs_ struct array containing user borrow config, see `UserBorrowConfig` struct for more info + function updateUserBorrowConfigs(AdminModuleStructs.UserBorrowConfig[] memory userBorrowConfigs_) external; + + /// @notice pause operations for a particular user in class 0 (class 1 users can't be paused by guardians). + /// Only callable by Guardians. + /// @param user_ address of user to pause operations for + /// @param supplyTokens_ token addresses to pause withdrawals for + /// @param borrowTokens_ token addresses to pause borrowings for + function pauseUser(address user_, address[] calldata supplyTokens_, address[] calldata borrowTokens_) external; + + /// @notice unpause operations for a particular user in class 0 (class 1 users can't be paused by guardians). + /// Only callable by Guardians. + /// @param user_ address of user to unpause operations for + /// @param supplyTokens_ token addresses to unpause withdrawals for + /// @param borrowTokens_ token addresses to unpause borrowings for + function unpauseUser(address user_, address[] calldata supplyTokens_, address[] calldata borrowTokens_) external; + + /// @notice collects revenue for tokens to configured revenueCollector address. + /// @param tokens_ array of tokens to collect revenue for + /// @dev Note that this can revert if token balance is < revenueAmount (utilization > 100%) + function collectRevenue(address[] calldata tokens_) external; + + /// @notice gets the current updated exchange prices for n tokens and updates all prices, rates related data in storage. + /// @param tokens_ tokens to update exchange prices for + /// @return supplyExchangePrices_ new supply rates of overall system for each token + /// @return borrowExchangePrices_ new borrow rates of overall system for each token + function updateExchangePrices( + address[] calldata tokens_ + ) external returns (uint256[] memory supplyExchangePrices_, uint256[] memory borrowExchangePrices_); + + function readFromStorage(bytes32 slot_) external view returns (uint256 result_); +} + +interface IFluidVaultT1Factory { + function deployVault(address vaultDeploymentLogic_, bytes calldata vaultDeploymentData_) external returns (address vault_); +} + +interface IFluidVaultT1DeploymentLogic { + function vaultT1( + address supplyToken_, + address borrowToken_ + ) external; +} + + +interface IFluidVaultT1 { + /// @notice updates the Vault oracle to `newOracle_`. Must implement the FluidOracle interface. + function updateOracle(address newOracle_) external; + + /// @notice updates the all Vault core settings according to input params. + /// All input values are expected in 1e2 (1% = 100, 100% = 10_000). + function updateCoreSettings( + uint256 supplyRateMagnifier_, + uint256 borrowRateMagnifier_, + uint256 collateralFactor_, + uint256 liquidationThreshold_, + uint256 liquidationMaxLimit_, + uint256 withdrawGap_, + uint256 liquidationPenalty_, + uint256 borrowFee_ + ) external; + + /// @notice updates the allowed rebalancer to `newRebalancer_`. + function updateRebalancer(address newRebalancer_) external; + + /// @notice updates the supply rate magnifier to `supplyRateMagnifier_`. Input in 1e2 (1% = 100, 100% = 10_000). + function updateSupplyRateMagnifier(uint supplyRateMagnifier_) external; +} + +contract PayloadIGP12 { + uint256 public constant PROPOSAL_ID = 12; + + address public constant PROPOSER = + 0xA45f7bD6A5Ff45D31aaCE6bCD3d426D9328cea01; + + IGovernorBravo public constant GOVERNOR = + IGovernorBravo(0x0204Cd037B2ec03605CFdFe482D8e257C765fA1B); + ITimelock public constant TIMELOCK = + ITimelock(0x2386DC45AdDed673317eF068992F19421B481F4c); + + address public constant TEAM_MULTISIG = + 0x4F6F977aCDD1177DCD81aB83074855EcB9C2D49e; + + address public immutable ADDRESS_THIS; + + IFluidLiquidityAdmin public constant LIQUIDITY = IFluidLiquidityAdmin(0x52Aa899454998Be5b000Ad077a46Bbe360F4e497); + IFluidVaultT1Factory public constant VAULT_T1_FACTORY = IFluidVaultT1Factory(0x324c5Dc1fC42c7a4D43d92df1eBA58a54d13Bf2d); + IFluidVaultT1DeploymentLogic public constant VAULT_T1_DEPLOYMENT_LOGIC = IFluidVaultT1DeploymentLogic(0x15f6F562Ae136240AB9F4905cb50aCA54bCbEb5F); + + address public constant ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE; + address public constant WETH_ADDRESS = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2; + address public constant WSTETH_ADDRESS = 0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0; + address public constant USDC_ADDRESS = 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48; + address public constant USDT_ADDRESS = 0xdAC17F958D2ee523a2206206994597C13D831ec7; + + address public constant VAULT_ETH_USDC = address(0xeAbBfca72F8a8bf14C4ac59e69ECB2eB69F0811C); + address public constant VAULT_ETH_USDT = address(0xbEC491FeF7B4f666b270F9D5E5C3f443cBf20991); + address public constant VAULT_WSTETH_ETH = address(0xA0F83Fc5885cEBc0420ce7C7b139Adc80c4F4D91); + address public constant VAULT_WSTETH_USDC = address(0x51197586F6A9e2571868b6ffaef308f3bdfEd3aE); + address public constant VAULT_WSTETH_USDT = address(0x1c2bB46f36561bc4F05A94BD50916496aa501078); + + uint256 internal constant X14 = 0x3fff; + uint256 internal constant X18 = 0x3ffff; + uint256 internal constant X24 = 0xffffff; + uint256 internal constant X64 = 0xffffffffffffffff; + + constructor() { + ADDRESS_THIS = address(this); + } + + function propose(string memory description) external { + require(msg.sender == PROPOSER || msg.sender == TEAM_MULTISIG, "msg.sender-not-proposer-or-multisig"); + + uint256 totalActions = 1; + address[] memory targets = new address[](totalActions); + uint256[] memory values = new uint256[](totalActions); + string[] memory signatures = new string[](totalActions); + bytes[] memory calldatas = new bytes[](totalActions); + + // Action 1: call executePayload on timelock contract to execute payload related to Fluid + targets[0] = address(TIMELOCK); + values[0] = 0; + signatures[0] = "executePayload(address,string,bytes)"; + calldatas[0] = abi.encode(ADDRESS_THIS, "execute()", abi.encode()); + + uint256 proposedId = GOVERNOR.propose( + targets, + values, + signatures, + calldatas, + description + ); + + require(proposedId == PROPOSAL_ID, "PROPOSAL_IS_NOT_SAME"); + } + + function execute() external { + require(address(this) == address(TIMELOCK), "not-valid-caller"); + + // Action 1: Update supply expand percent to 20% for fUSDT on liquidity. + action1(); + + // Action 2: Update supply expand percent to 20% for fUSDC on liquidity. + action2(); + + // Action 3: Update supply expand percent to 20% for fWETH on liquidity. + action3(); + + // Action 4: Update supply expand percent to 25% and borrow expand percent to 20% for ETH/USDC vault on liquidity. + action4(); + + // Action 5: Update supply expand percent to 25% and borrow expand percent to 20% for ETH/USDT vault on liquidity. + action5(); + + // Action 6: Update supply expand percent to 25% and borrow expand percent to 20% for WSTETH/ETH vault on liquidity. + action6(); + + // Action 7: Update supply expand percent to 25% and borrow expand percent to 20% for WSTETH/USDC vault on liquidity. + action7(); + + // Action 8: Update supply expand percent to 25% and borrow expand percent to 20% for WSTETH/USDT vault on liquidity. + action8(); + + // @notice Action 9: Remove config handlers for vaults and lending tokens on liquidity. + action9(); + } + + function verifyProposal() external view {} + + /***********************************| + | Proposal Payload Actions | + |__________________________________*/ + + /// @notice Action 1: Update supply expand percent to 20% for fUSDT on liquidity. + function action1() internal { + address fUSDT = 0x5C20B550819128074FD538Edf79791733ccEdd18; + + AdminModuleStructs.UserSupplyConfig[] memory configs_ = new AdminModuleStructs.UserSupplyConfig[](); + configs_[0] = getUserSupplyData( + USDT_ADDRESS, + fUSDT + ); + + configs_[0].expandPercent = 20 * 1e2; // 20% + + LIQUIDITY.updateUserSupplyConfigs(configs_); + } + + /// @notice Action 2: Update supply expand percent to 20% for fUSDC on liquidity. + function action2() internal { + address fUSDC = address(0x9Fb7b4477576Fe5B32be4C1843aFB1e55F251B33); + + AdminModuleStructs.UserSupplyConfig[] memory configs_ = new AdminModuleStructs.UserSupplyConfig[](); + configs_[0] = getUserSupplyData( + USDC_ADDRESS, + fUSDC + ); + + configs_[0].expandPercent = 20 * 1e2; // 20% + + LIQUIDITY.updateUserSupplyConfigs(configs_); + } + + /// @notice Action 3: Update supply expand percent to 20% for fWETH on liquidity. + function action3() internal { + address fWETH = address(0x90551c1795392094FE6D29B758EcCD233cFAa260); + + AdminModuleStructs.UserSupplyConfig[] memory configs_ = new AdminModuleStructs.UserSupplyConfig[](); + configs_[0] = getUserSupplyData( + WETH_ADDRESS, + fWETH + ); + + configs_[0].expandPercent = 20 * 1e2; // 20% + + LIQUIDITY.updateUserSupplyConfigs(configs_); + } + + + /// @notice Action 4: Update supply expand percent to 25% and borrow expand percent to 20% for ETH/USDC vault on liquidity. + function action4() internal { + address user_ = VAULT_ETH_USDC; + address supplyToken_ = ETH_ADDRESS; + address borrowToken_ = USDC_ADDRESS; + + // Supply expand percent to 25% + AdminModuleStructs.UserSupplyConfig[] memory configs_ = new AdminModuleStructs.UserSupplyConfig[](); + configs_[0] = getUserSupplyData( + supplyToken_, + user_ + ); + + configs_[0].expandPercent = 25 * 1e2; // 25% + + LIQUIDITY.updateUserSupplyConfigs(configs_); + + // Borrow expand percent to 20% + AdminModuleStructs.UserBorrowConfig[] memory configs_ = new AdminModuleStructs.UserBorrowConfig[](); + configs_[0] = getUserBorrowData( + borrowToken_, + user_ + ); + + configs_[0].expandPercent = 20 * 1e2; // 20% + + LIQUIDITY.updateUserBorrowConfigs(configs_); + } + + /// @notice Action 5: Update supply expand percent to 25% and borrow expand percent to 20% for ETH/USDT vault on liquidity. + function action5() internal { + address user_ = VAULT_ETH_USDT; + address supplyToken_ = ETH_ADDRESS; + address borrowToken_ = USDT_ADDRESS; + + // Supply expand percent to 25% + AdminModuleStructs.UserSupplyConfig[] memory configs_ = new AdminModuleStructs.UserSupplyConfig[](); + configs_[0] = getUserSupplyData( + supplyToken_, + user_ + ); + + configs_[0].expandPercent = 25 * 1e2; // 25% + + LIQUIDITY.updateUserSupplyConfigs(configs_); + + // Borrow expand percent to 20% + AdminModuleStructs.UserBorrowConfig[] memory configs_ = new AdminModuleStructs.UserBorrowConfig[](); + configs_[0] = getUserBorrowData( + borrowToken_, + user_ + ); + + configs_[0].expandPercent = 20 * 1e2; // 20% + + LIQUIDITY.updateUserBorrowConfigs(configs_); + } + + /// @notice Action 6: Update supply expand percent to 25% and borrow expand percent to 20% for wstETH/ETH vault on liquidity. + function action6() internal { + address user_ = VAUTH_WSTETH_ETH; + address supplyToken_ = WSTETH_ADDRESS; + address borrowToken_ = ETH_ADDRESS; + + // Supply expand percent to 25% + AdminModuleStructs.UserSupplyConfig[] memory configs_ = new AdminModuleStructs.UserSupplyConfig[](); + configs_[0] = getUserSupplyData( + supplyToken_, + user_ + ); + + configs_[0].expandPercent = 25 * 1e2; // 25% + + LIQUIDITY.updateUserSupplyConfigs(configs_); + + // Borrow expand percent to 20% + AdminModuleStructs.UserBorrowConfig[] memory configs_ = new AdminModuleStructs.UserBorrowConfig[](); + configs_[0] = getUserBorrowData( + borrowToken_, + user_ + ); + + configs_[0].expandPercent = 20 * 1e2; // 20% + + LIQUIDITY.updateUserBorrowConfigs(configs_); + } + + /// @notice Action 7: Update supply expand percent to 25% and borrow expand percent to 20% for wstETH/USDC vault on liquidity. + function action7() internal { + address user_ = VAULT_WSTETH_USDC; + address supplyToken_ = WSTETH_ADDRESS; + address borrowToken_ = USDC_ADDRESS; + + // Supply expand percent to 25% + AdminModuleStructs.UserSupplyConfig[] memory configs_ = new AdminModuleStructs.UserSupplyConfig[](); + configs_[0] = getUserSupplyData( + supplyToken_, + user_ + ); + + configs_[0].expandPercent = 25 * 1e2; // 25% + + LIQUIDITY.updateUserSupplyConfigs(configs_); + + // Borrow expand percent to 20% + AdminModuleStructs.UserBorrowConfig[] memory configs_ = new AdminModuleStructs.UserBorrowConfig[](); + configs_[0] = getUserBorrowData( + borrowToken_, + user_ + ); + + configs_[0].expandPercent = 20 * 1e2; // 20% + + LIQUIDITY.updateUserBorrowConfigs(configs_); + } + + + /// @notice Action 8: Update supply expand percent to 25% and borrow expand percent to 20% for WSTETH/USDT vault on liquidity. + function action8() internal { + address user_ = VAULT_WSTETH_USDC; + address supplyToken_ = WSTETH_ADDRESS; + address borrowToken_ = USDT_ADDRESS; + + // Supply expand percent to 25% + AdminModuleStructs.UserSupplyConfig[] memory configs_ = new AdminModuleStructs.UserSupplyConfig[](); + configs_[0] = getUserSupplyData( + supplyToken_, + user_ + ); + + configs_[0].expandPercent = 25 * 1e2; // 25% + + LIQUIDITY.updateUserSupplyConfigs(configs_); + + // Borrow expand percent to 20% + AdminModuleStructs.UserBorrowConfig[] memory configs_ = new AdminModuleStructs.UserBorrowConfig[](); + configs_[0] = getUserBorrowData( + borrowToken_, + user_ + ); + + configs_[0].expandPercent = 20 * 1e2; // 20% + + LIQUIDITY.updateUserBorrowConfigs(configs_); + } + + /// @notice Action 9: Remove config handlers for vaults and lending tokens on liquidity. + function action9() internal { + AdminModuleStructs.AddressBool[] memory addrBools_ = new AdminModuleStructs.AddressBool[](8); + + + // fToken_fUSDC_LiquidityConfigHandler + addrBools_[0] = AdminModuleStructs.AddressBool({ + addr: 0x02AfbFA971299c2434E7a04565d9f5a1eD6180F1, + value: false + }) + + // fToken_fUSDT_LiquidityConfigHandler + addrBools_[1] = AdminModuleStructs.AddressBool({ + addr: 0xF45364EC2230c64B1AB0cE1E4c7E63F0a2078F30, + value: false + }) + + // fToken_fWETH_LiquidityConfigHandler + addrBools_[2] = AdminModuleStructs.AddressBool({ + addr: 0x580f8C04080347F5675CF67C1E90d935463148dC, + value: false + }) + + // Vault_ETH_USDC_LiquidityConfigHandler + addrBools_[3] = AdminModuleStructs.AddressBool({ + addr: 0xacdf9C61720A4D97Afa7f215ddDD56C2d1019FC9, + value: false + }) + + // Vault_ETH_USDT_LiquidityConfigHandler + addrBools_[4] = AdminModuleStructs.AddressBool({ + addr: 0x2274F61847703DBA28300BD7a0Fb3f1166Cb0E7C, + value: false + }) + + // Vault_wstETH_ETH_LiquidityConfigHandler + addrBools_[5] = AdminModuleStructs.AddressBool({ + addr: 0x28D64d5c85E9a0f0a33A481E71842255aeFf0Fe9, + value: false + }) + + // Vault_wstETH_USDC_LiquidityConfigHandler + addrBools_[6] = AdminModuleStructs.AddressBool({ + addr: 0xa66906140D5d413E40b1AE452B52DD1f162D47cA, + value: false + }) + + // Vault_wstETH_USDT_LiquidityConfigHandler + addrBools_[7] = AdminModuleStructs.AddressBool({ + addr: 0xB7AE8D080c7C26152e43DD6e8dcA7451BB33Be68, + value: false + }) + + LIQUIDITY.updateAuths(addrBools_); + } + + + + + /***********************************| + | Proposal Payload Helpers | + |__________________________________*/ + + function getUserSupplyData(address token_, address user_) internal returns(AdminModuleStructs.UserSupplyConfig memory config_) { + bytes32 _LIQUDITY_PROTOCOL_SUPPLY_SLOT = LiquiditySlotsLink.calculateDoubleMappingStorageSlot( + LiquiditySlotsLink.LIQUIDITY_USER_SUPPLY_DOUBLE_MAPPING_SLOT, + user_, + token_ + ); + + bytes32 userSupplyData_ = LIQUIDITY.readFromStorage(_LIQUDITY_PROTOCOL_SUPPLY_SLOT); + + config_ = AdminModuleStructs.UserSupplyConfig({ + user: user_, + token: token_, + mode: uint8(userSupplyData_ & 1), + expandPercent: (userSupplyData_ >> LiquiditySlotsLink.BITS_USER_SUPPLY_EXPAND_PERCENT) & X14, + expandDuration: (userSupplyData_ >> LiquiditySlotsLink.BITS_USER_SUPPLY_EXPAND_DURATION) & X24, + baseWithdrawalLimit: BigMathMinified.fromBigNumber( + (userSupplyData_ >> LiquiditySlotsLink.BITS_USER_SUPPLY_BASE_WITHDRAWAL_LIMIT) & X18, + DEFAULT_EXPONENT_SIZE, + DEFAULT_EXPONENT_MASK + ) + }); + } + + function getUserBorrowData(address token_, address user_) internal returns(AdminModuleStructs.UserBorrowConfig memory config_) { + bytes32 _LIQUDITY_PROTOCOL_BORROW_SLOT = LiquiditySlotsLink.calculateDoubleMappingStorageSlot( + LiquiditySlotsLink.LIQUIDITY_USER_BORROW_DOUBLE_MAPPING_SLOT, + user_, + token_ + ); + + userBorrowData_ = LIQUIDITY.readFromStorage(_LIQUDITY_PROTOCOL_BORROW_SLOT); + + config_ = AdminModuleStructs.UserBorrowConfig({ + user: user_, + token: token_, + mode: uint8(userBorrowData_ & 1), + expandPercent: (userBorrowData_ >> LiquiditySlotsLink.BITS_USER_BORROW_EXPAND_PERCENT) & X14;, + expandDuration: (userBorrowData_ >> LiquiditySlotsLink.BITS_USER_BORROW_EXPAND_DURATION) & X24, + baseDebtCeiling: BigMathMinified.fromBigNumber( + (userBorrowData_ >> LiquiditySlotsLink.BITS_USER_BORROW_BASE_BORROW_LIMIT) & X18, + DEFAULT_EXPONENT_SIZE, + DEFAULT_EXPONENT_MASK + ), + maxDebtCeiling: BigMathMinified.fromBigNumber( + (userBorrowData_ >> LiquiditySlotsLink.BITS_USER_BORROW_MAX_BORROW_LIMIT) & X18, + DEFAULT_EXPONENT_SIZE, + DEFAULT_EXPONENT_MASK + ) + }); + } +} diff --git a/contracts/payloads/IGP112/libraries/bigMathMinified.sol b/contracts/payloads/IGP112/libraries/bigMathMinified.sol new file mode 100644 index 0000000..374783e --- /dev/null +++ b/contracts/payloads/IGP112/libraries/bigMathMinified.sol @@ -0,0 +1,156 @@ +// SPDX-License-Identifier: BUSL-1.1 +pragma solidity 0.8.21; + +/// @title library that represents a number in BigNumber(coefficient and exponent) format to store in smaller bits. +/// @notice the number is divided into two parts: a coefficient and an exponent. This comes at a cost of losing some precision +/// at the end of the number because the exponent simply fills it with zeroes. This precision is oftentimes negligible and can +/// result in significant gas cost reduction due to storage space reduction. +/// Also note, a valid big number is as follows: if the exponent is > 0, then coefficient last bits should be occupied to have max precision. +/// @dev roundUp is more like a increase 1, which happens everytime for the same number. +/// roundDown simply sets trailing digits after coefficientSize to zero (floor), only once for the same number. +library BigMathMinified { + /// @dev constants to use for `roundUp` input param to increase readability + bool internal constant ROUND_DOWN = false; + bool internal constant ROUND_UP = true; + + /// @dev converts `normal` number to BigNumber with `exponent` and `coefficient` (or precision). + /// e.g.: + /// 5035703444687813576399599 (normal) = (coefficient[32bits], exponent[8bits])[40bits] + /// 5035703444687813576399599 (decimal) => 10000101010010110100000011111011110010100110100000000011100101001101001101011101111 (binary) + /// => 10000101010010110100000011111011000000000000000000000000000000000000000000000000000 + /// ^-------------------- 51(exponent) -------------- ^ + /// coefficient = 1000,0101,0100,1011,0100,0000,1111,1011 (2236301563) + /// exponent = 0011,0011 (51) + /// bigNumber = 1000,0101,0100,1011,0100,0000,1111,1011,0011,0011 (572493200179) + /// + /// @param normal number which needs to be converted into Big Number + /// @param coefficientSize at max how many bits of precision there should be (64 = uint64 (64 bits precision)) + /// @param exponentSize at max how many bits of exponent there should be (8 = uint8 (8 bits exponent)) + /// @param roundUp signals if result should be rounded down or up + /// @return bigNumber converted bigNumber (coefficient << exponent) + function toBigNumber( + uint256 normal, + uint256 coefficientSize, + uint256 exponentSize, + bool roundUp + ) internal pure returns (uint256 bigNumber) { + assembly { + let lastBit_ + let number_ := normal + if gt(number_, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF) { + number_ := shr(0x80, number_) + lastBit_ := 0x80 + } + if gt(number_, 0xFFFFFFFFFFFFFFFF) { + number_ := shr(0x40, number_) + lastBit_ := add(lastBit_, 0x40) + } + if gt(number_, 0xFFFFFFFF) { + number_ := shr(0x20, number_) + lastBit_ := add(lastBit_, 0x20) + } + if gt(number_, 0xFFFF) { + number_ := shr(0x10, number_) + lastBit_ := add(lastBit_, 0x10) + } + if gt(number_, 0xFF) { + number_ := shr(0x8, number_) + lastBit_ := add(lastBit_, 0x8) + } + if gt(number_, 0xF) { + number_ := shr(0x4, number_) + lastBit_ := add(lastBit_, 0x4) + } + if gt(number_, 0x3) { + number_ := shr(0x2, number_) + lastBit_ := add(lastBit_, 0x2) + } + if gt(number_, 0x1) { + lastBit_ := add(lastBit_, 1) + } + if gt(number_, 0) { + lastBit_ := add(lastBit_, 1) + } + if lt(lastBit_, coefficientSize) { + // for throw exception + lastBit_ := coefficientSize + } + let exponent := sub(lastBit_, coefficientSize) + let coefficient := shr(exponent, normal) + if and(roundUp, gt(exponent, 0)) { + // rounding up is only needed if exponent is > 0, as otherwise the coefficient fully holds the original number + coefficient := add(coefficient, 1) + if eq(shl(coefficientSize, 1), coefficient) { + // case were coefficient was e.g. 111, with adding 1 it became 1000 (in binary) and coefficientSize 3 bits + // final coefficient would exceed it's size. -> reduce coefficent to 100 and increase exponent by 1. + coefficient := shl(sub(coefficientSize, 1), 1) + exponent := add(exponent, 1) + } + } + if iszero(lt(exponent, shl(exponentSize, 1))) { + // if exponent is >= exponentSize, the normal number is too big to fit within + // BigNumber with too small sizes for coefficient and exponent + revert(0, 0) + } + bigNumber := shl(exponentSize, coefficient) + bigNumber := add(bigNumber, exponent) + } + } + + /// @dev get `normal` number from `bigNumber`, `exponentSize` and `exponentMask` + function fromBigNumber( + uint256 bigNumber, + uint256 exponentSize, + uint256 exponentMask + ) internal pure returns (uint256 normal) { + assembly { + let coefficient := shr(exponentSize, bigNumber) + let exponent := and(bigNumber, exponentMask) + normal := shl(exponent, coefficient) + } + } + + /// @dev gets the most significant bit `lastBit` of a `normal` number (length of given number of binary format). + /// e.g. + /// 5035703444687813576399599 = 10000101010010110100000011111011110010100110100000000011100101001101001101011101111 + /// lastBit = ^--------------------------------- 83 ----------------------------------------^ + function mostSignificantBit(uint256 normal) internal pure returns (uint lastBit) { + assembly { + let number_ := normal + if gt(normal, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF) { + number_ := shr(0x80, number_) + lastBit := 0x80 + } + if gt(number_, 0xFFFFFFFFFFFFFFFF) { + number_ := shr(0x40, number_) + lastBit := add(lastBit, 0x40) + } + if gt(number_, 0xFFFFFFFF) { + number_ := shr(0x20, number_) + lastBit := add(lastBit, 0x20) + } + if gt(number_, 0xFFFF) { + number_ := shr(0x10, number_) + lastBit := add(lastBit, 0x10) + } + if gt(number_, 0xFF) { + number_ := shr(0x8, number_) + lastBit := add(lastBit, 0x8) + } + if gt(number_, 0xF) { + number_ := shr(0x4, number_) + lastBit := add(lastBit, 0x4) + } + if gt(number_, 0x3) { + number_ := shr(0x2, number_) + lastBit := add(lastBit, 0x2) + } + if gt(number_, 0x1) { + lastBit := add(lastBit, 1) + } + if gt(number_, 0) { + lastBit := add(lastBit, 1) + } + } + } +} \ No newline at end of file diff --git a/contracts/payloads/IGP112/libraries/liquiditySlotsLink.sol b/contracts/payloads/IGP112/libraries/liquiditySlotsLink.sol new file mode 100644 index 0000000..afd30e2 --- /dev/null +++ b/contracts/payloads/IGP112/libraries/liquiditySlotsLink.sol @@ -0,0 +1,101 @@ +// SPDX-License-Identifier: BUSL-1.1 +pragma solidity 0.8.21; + +/// @notice library that helps in reading / working with storage slot data of Fluid Liquidity. +/// @dev as all data for Fluid Liquidity is internal, any data must be fetched directly through manual +/// slot reading through this library or, if gas usage is less important, through the FluidLiquidityResolver. +library LiquiditySlotsLink { + /// @dev storage slot for status at Liquidity + uint256 internal constant LIQUIDITY_STATUS_SLOT = 1; + /// @dev storage slot for auths mapping at Liquidity + uint256 internal constant LIQUIDITY_AUTHS_MAPPING_SLOT = 2; + /// @dev storage slot for guardians mapping at Liquidity + uint256 internal constant LIQUIDITY_GUARDIANS_MAPPING_SLOT = 3; + /// @dev storage slot for user class mapping at Liquidity + uint256 internal constant LIQUIDITY_USER_CLASS_MAPPING_SLOT = 4; + /// @dev storage slot for exchangePricesAndConfig mapping at Liquidity + uint256 internal constant LIQUIDITY_EXCHANGE_PRICES_MAPPING_SLOT = 5; + /// @dev storage slot for rateData mapping at Liquidity + uint256 internal constant LIQUIDITY_RATE_DATA_MAPPING_SLOT = 6; + /// @dev storage slot for totalAmounts mapping at Liquidity + uint256 internal constant LIQUIDITY_TOTAL_AMOUNTS_MAPPING_SLOT = 7; + /// @dev storage slot for user supply double mapping at Liquidity + uint256 internal constant LIQUIDITY_USER_SUPPLY_DOUBLE_MAPPING_SLOT = 8; + /// @dev storage slot for user borrow double mapping at Liquidity + uint256 internal constant LIQUIDITY_USER_BORROW_DOUBLE_MAPPING_SLOT = 9; + /// @dev storage slot for listed tokens array at Liquidity + uint256 internal constant LIQUIDITY_LISTED_TOKENS_ARRAY_SLOT = 10; + + // -------------------------------- + // @dev stacked uint256 storage slots bits position data for each: + + // ExchangePricesAndConfig + uint256 internal constant BITS_EXCHANGE_PRICES_BORROW_RATE = 0; + uint256 internal constant BITS_EXCHANGE_PRICES_FEE = 16; + uint256 internal constant BITS_EXCHANGE_PRICES_UTILIZATION = 30; + uint256 internal constant BITS_EXCHANGE_PRICES_UPDATE_THRESHOLD = 44; + uint256 internal constant BITS_EXCHANGE_PRICES_LAST_TIMESTAMP = 58; + uint256 internal constant BITS_EXCHANGE_PRICES_SUPPLY_EXCHANGE_PRICE = 91; + uint256 internal constant BITS_EXCHANGE_PRICES_BORROW_EXCHANGE_PRICE = 155; + uint256 internal constant BITS_EXCHANGE_PRICES_SUPPLY_RATIO = 219; + uint256 internal constant BITS_EXCHANGE_PRICES_BORROW_RATIO = 234; + + // RateData: + uint256 internal constant BITS_RATE_DATA_VERSION = 0; + // RateData: V1 + uint256 internal constant BITS_RATE_DATA_V1_RATE_AT_UTILIZATION_ZERO = 4; + uint256 internal constant BITS_RATE_DATA_V1_UTILIZATION_AT_KINK = 20; + uint256 internal constant BITS_RATE_DATA_V1_RATE_AT_UTILIZATION_KINK = 36; + uint256 internal constant BITS_RATE_DATA_V1_RATE_AT_UTILIZATION_MAX = 52; + // RateData: V2 + uint256 internal constant BITS_RATE_DATA_V2_RATE_AT_UTILIZATION_ZERO = 4; + uint256 internal constant BITS_RATE_DATA_V2_UTILIZATION_AT_KINK1 = 20; + uint256 internal constant BITS_RATE_DATA_V2_RATE_AT_UTILIZATION_KINK1 = 36; + uint256 internal constant BITS_RATE_DATA_V2_UTILIZATION_AT_KINK2 = 52; + uint256 internal constant BITS_RATE_DATA_V2_RATE_AT_UTILIZATION_KINK2 = 68; + uint256 internal constant BITS_RATE_DATA_V2_RATE_AT_UTILIZATION_MAX = 84; + + // TotalAmounts + uint256 internal constant BITS_TOTAL_AMOUNTS_SUPPLY_WITH_INTEREST = 0; + uint256 internal constant BITS_TOTAL_AMOUNTS_SUPPLY_INTEREST_FREE = 64; + uint256 internal constant BITS_TOTAL_AMOUNTS_BORROW_WITH_INTEREST = 128; + uint256 internal constant BITS_TOTAL_AMOUNTS_BORROW_INTEREST_FREE = 192; + + // UserSupplyData + uint256 internal constant BITS_USER_SUPPLY_MODE = 0; + uint256 internal constant BITS_USER_SUPPLY_AMOUNT = 1; + uint256 internal constant BITS_USER_SUPPLY_PREVIOUS_WITHDRAWAL_LIMIT = 65; + uint256 internal constant BITS_USER_SUPPLY_LAST_UPDATE_TIMESTAMP = 129; + uint256 internal constant BITS_USER_SUPPLY_EXPAND_PERCENT = 162; + uint256 internal constant BITS_USER_SUPPLY_EXPAND_DURATION = 176; + uint256 internal constant BITS_USER_SUPPLY_BASE_WITHDRAWAL_LIMIT = 200; + uint256 internal constant BITS_USER_SUPPLY_IS_PAUSED = 255; + + // UserBorrowData + uint256 internal constant BITS_USER_BORROW_MODE = 0; + uint256 internal constant BITS_USER_BORROW_AMOUNT = 1; + uint256 internal constant BITS_USER_BORROW_PREVIOUS_BORROW_LIMIT = 65; + uint256 internal constant BITS_USER_BORROW_LAST_UPDATE_TIMESTAMP = 129; + uint256 internal constant BITS_USER_BORROW_EXPAND_PERCENT = 162; + uint256 internal constant BITS_USER_BORROW_EXPAND_DURATION = 176; + uint256 internal constant BITS_USER_BORROW_BASE_BORROW_LIMIT = 200; + uint256 internal constant BITS_USER_BORROW_MAX_BORROW_LIMIT = 218; + uint256 internal constant BITS_USER_BORROW_IS_PAUSED = 255; + + // -------------------------------- + + /// @notice Calculating the slot ID for Liquidity contract for single mapping at `slot_` for `key_` + function calculateMappingStorageSlot(uint256 slot_, address key_) internal pure returns (bytes32) { + return keccak256(abi.encode(key_, slot_)); + } + + /// @notice Calculating the slot ID for Liquidity contract for double mapping at `slot_` for `key1_` and `key2_` + function calculateDoubleMappingStorageSlot( + uint256 slot_, + address key1_, + address key2_ + ) internal pure returns (bytes32) { + bytes32 intermediateSlot_ = keccak256(abi.encode(key1_, slot_)); + return keccak256(abi.encode(key2_, intermediateSlot_)); + } +} From 9e2295f07099071e475c7e7c53948da0a9a01c8a Mon Sep 17 00:00:00 2001 From: Thrilok kumar Date: Wed, 13 Mar 2024 21:11:51 -0400 Subject: [PATCH 2/8] fix folder name --- .../{IGP112 => IGP12}/PayloadIGP12.sol | 48 ++++++++++++++++++- .../libraries/bigMathMinified.sol | 0 .../libraries/liquiditySlotsLink.sol | 0 3 files changed, 46 insertions(+), 2 deletions(-) rename contracts/payloads/{IGP112 => IGP12}/PayloadIGP12.sol (92%) rename contracts/payloads/{IGP112 => IGP12}/libraries/bigMathMinified.sol (100%) rename contracts/payloads/{IGP112 => IGP12}/libraries/liquiditySlotsLink.sol (100%) diff --git a/contracts/payloads/IGP112/PayloadIGP12.sol b/contracts/payloads/IGP12/PayloadIGP12.sol similarity index 92% rename from contracts/payloads/IGP112/PayloadIGP12.sol rename to contracts/payloads/IGP12/PayloadIGP12.sol index 0c8777e..01b472f 100644 --- a/contracts/payloads/IGP112/PayloadIGP12.sol +++ b/contracts/payloads/IGP12/PayloadIGP12.sol @@ -555,12 +555,56 @@ contract PayloadIGP12 { } - - /***********************************| | Proposal Payload Helpers | |__________________________________*/ + function getSupplyTokenConfig(address token_, address user_, uint256 expandPercent) internal returns(AdminModuleStructs.UserSupplyConfig memory config_){ + bytes32 _LIQUDITY_PROTOCOL_SUPPLY_SLOT = LiquiditySlotsLink.calculateDoubleMappingStorageSlot( + LiquiditySlotsLink.LIQUIDITY_USER_SUPPLY_DOUBLE_MAPPING_SLOT, + user_, + token_ + ); + + bytes32 userSupplyData_ = LIQUIDITY.readFromStorage(_LIQUDITY_PROTOCOL_SUPPLY_SLOT); + + config_ = AdminModuleStructs.UserSupplyConfig({ + user: user_, + token: token_, + mode: uint8(userSupplyData_ & 1), + expandPercent: expandPercent, + expandDuration: (userSupplyData_ >> LiquiditySlotsLink.BITS_USER_SUPPLY_EXPAND_DURATION) & X24, + baseWithdrawalLimit: BigMathMinified.fromBigNumber( + (userSupplyData_ >> LiquiditySlotsLink.BITS_USER_SUPPLY_BASE_WITHDRAWAL_LIMIT) & X18, + DEFAULT_EXPONENT_SIZE, + DEFAULT_EXPONENT_MASK + ) + }); + } + + function getBorrowTokenConfig(address token_, address user_, uint256 expandPercent) internal returns(AdminModuleStructs.UserSupplyConfig memory config_){ + bytes32 _LIQUDITY_PROTOCOL_SUPPLY_SLOT = LiquiditySlotsLink.calculateDoubleMappingStorageSlot( + LiquiditySlotsLink.LIQUIDITY_USER_SUPPLY_DOUBLE_MAPPING_SLOT, + user_, + token_ + ); + + bytes32 userSupplyData_ = LIQUIDITY.readFromStorage(_LIQUDITY_PROTOCOL_SUPPLY_SLOT); + + config_ = AdminModuleStructs.UserSupplyConfig({ + user: user_, + token: token_, + mode: uint8(userSupplyData_ & 1), + expandPercent: expandPercent, + expandDuration: (userSupplyData_ >> LiquiditySlotsLink.BITS_USER_SUPPLY_EXPAND_DURATION) & X24, + baseWithdrawalLimit: BigMathMinified.fromBigNumber( + (userSupplyData_ >> LiquiditySlotsLink.BITS_USER_SUPPLY_BASE_WITHDRAWAL_LIMIT) & X18, + DEFAULT_EXPONENT_SIZE, + DEFAULT_EXPONENT_MASK + ) + }); + } + function getUserSupplyData(address token_, address user_) internal returns(AdminModuleStructs.UserSupplyConfig memory config_) { bytes32 _LIQUDITY_PROTOCOL_SUPPLY_SLOT = LiquiditySlotsLink.calculateDoubleMappingStorageSlot( LiquiditySlotsLink.LIQUIDITY_USER_SUPPLY_DOUBLE_MAPPING_SLOT, diff --git a/contracts/payloads/IGP112/libraries/bigMathMinified.sol b/contracts/payloads/IGP12/libraries/bigMathMinified.sol similarity index 100% rename from contracts/payloads/IGP112/libraries/bigMathMinified.sol rename to contracts/payloads/IGP12/libraries/bigMathMinified.sol diff --git a/contracts/payloads/IGP112/libraries/liquiditySlotsLink.sol b/contracts/payloads/IGP12/libraries/liquiditySlotsLink.sol similarity index 100% rename from contracts/payloads/IGP112/libraries/liquiditySlotsLink.sol rename to contracts/payloads/IGP12/libraries/liquiditySlotsLink.sol From 97fb3645a79aa94206c083314366d1bd23d4b818 Mon Sep 17 00:00:00 2001 From: Thrilok kumar Date: Thu, 14 Mar 2024 02:14:17 -0400 Subject: [PATCH 3/8] refactored --- contracts/payloads/IGP12/PayloadIGP12.sol | 326 ++++------------------ 1 file changed, 59 insertions(+), 267 deletions(-) diff --git a/contracts/payloads/IGP12/PayloadIGP12.sol b/contracts/payloads/IGP12/PayloadIGP12.sol index 01b472f..d7a1d3f 100644 --- a/contracts/payloads/IGP12/PayloadIGP12.sol +++ b/contracts/payloads/IGP12/PayloadIGP12.sol @@ -205,9 +205,12 @@ interface IFluidVaultT1 { contract PayloadIGP12 { uint256 public constant PROPOSAL_ID = 12; - address public constant PROPOSER = + address public constant PROPOSER_1 = 0xA45f7bD6A5Ff45D31aaCE6bCD3d426D9328cea01; + address public constant PROPOSER_2 = + 0x059A94A72951c0ae1cc1CE3BF0dB52421bbE8210; + IGovernorBravo public constant GOVERNOR = IGovernorBravo(0x0204Cd037B2ec03605CFdFe482D8e257C765fA1B); ITimelock public constant TIMELOCK = @@ -233,6 +236,10 @@ contract PayloadIGP12 { address public constant VAULT_WSTETH_ETH = address(0xA0F83Fc5885cEBc0420ce7C7b139Adc80c4F4D91); address public constant VAULT_WSTETH_USDC = address(0x51197586F6A9e2571868b6ffaef308f3bdfEd3aE); address public constant VAULT_WSTETH_USDT = address(0x1c2bB46f36561bc4F05A94BD50916496aa501078); + address public constant F_USDT = 0x5C20B550819128074FD538Edf79791733ccEdd18; + address public constant F_USDC = 0x9Fb7b4477576Fe5B32be4C1843aFB1e55F251B33; + address public constant F_WETH = 0x90551c1795392094FE6D29B758EcCD233cFAa260; + uint256 internal constant X14 = 0x3fff; uint256 internal constant X18 = 0x3ffff; @@ -244,7 +251,12 @@ contract PayloadIGP12 { } function propose(string memory description) external { - require(msg.sender == PROPOSER || msg.sender == TEAM_MULTISIG, "msg.sender-not-proposer-or-multisig"); + require( + msg.sender == PROPOSER_1 || + msg.sender == PROPOSER_2 || + msg.sender == TEAM_MULTISIG, + "msg.sender-not-allowed" + ); uint256 totalActions = 1; address[] memory targets = new address[](totalActions); @@ -272,32 +284,14 @@ contract PayloadIGP12 { function execute() external { require(address(this) == address(TIMELOCK), "not-valid-caller"); - // Action 1: Update supply expand percent to 20% for fUSDT on liquidity. + // Action 1: Update supply expand percent for all the protocols on Liquidity. action1(); - // Action 2: Update supply expand percent to 20% for fUSDC on liquidity. + // Action 2: Update borrow expand percent for all the protocols on Liquidity. action2(); - // Action 3: Update supply expand percent to 20% for fWETH on liquidity. + // Action 3: Remove config handlers for vaults and lending tokens on liquidity. action3(); - - // Action 4: Update supply expand percent to 25% and borrow expand percent to 20% for ETH/USDC vault on liquidity. - action4(); - - // Action 5: Update supply expand percent to 25% and borrow expand percent to 20% for ETH/USDT vault on liquidity. - action5(); - - // Action 6: Update supply expand percent to 25% and borrow expand percent to 20% for WSTETH/ETH vault on liquidity. - action6(); - - // Action 7: Update supply expand percent to 25% and borrow expand percent to 20% for WSTETH/USDC vault on liquidity. - action7(); - - // Action 8: Update supply expand percent to 25% and borrow expand percent to 20% for WSTETH/USDT vault on liquidity. - action8(); - - // @notice Action 9: Remove config handlers for vaults and lending tokens on liquidity. - action9(); } function verifyProposal() external view {} @@ -306,200 +300,41 @@ contract PayloadIGP12 { | Proposal Payload Actions | |__________________________________*/ - /// @notice Action 1: Update supply expand percent to 20% for fUSDT on liquidity. + /// @notice Action 1: Update supply expand percent for all the protocols on Liquidity. function action1() internal { - address fUSDT = 0x5C20B550819128074FD538Edf79791733ccEdd18; + AdminModuleStructs.UserSupplyConfig[] memory configs_ = new AdminModuleStructs.UserSupplyConfig[](8); - AdminModuleStructs.UserSupplyConfig[] memory configs_ = new AdminModuleStructs.UserSupplyConfig[](); - configs_[0] = getUserSupplyData( - USDT_ADDRESS, - fUSDT - ); + // Update to 20% + configs_[0] = getUserSupplyDataAndSetExpandPercent(USDT_ADDRESS, F_USDT, 20 * 1e2); + configs_[1] = getUserSupplyDataAndSetExpandPercent(USDC_ADDRESS, F_USDC, 20 * 1e2); + configs_[2] = getUserSupplyDataAndSetExpandPercent(WETH_ADDRESS, F_WETH, 20 * 1e2); - configs_[0].expandPercent = 20 * 1e2; // 20% + // Update to 25% + configs_[3] = getUserSupplyDataAndSetExpandPercent(ETH_ADDRESS, VAULT_ETH_USDC, 25 * 1e2); + configs_[4] = getUserSupplyDataAndSetExpandPercent(ETH_ADDRESS, VAULT_ETH_USDT, 25 * 1e2); + configs_[5] = getUserSupplyDataAndSetExpandPercent(WSTETH_ADDRESS, VAULT_WSTETH_USDC, 25 * 1e2); + configs_[6] = getUserSupplyDataAndSetExpandPercent(WSTETH_ADDRESS, VAULT_WSTETH_USDT, 25 * 1e2); + configs_[7] = getUserSupplyDataAndSetExpandPercent(WSTETH_ADDRESS, VAULT_WSTETH_ETH, 25 * 1e2); LIQUIDITY.updateUserSupplyConfigs(configs_); } - /// @notice Action 2: Update supply expand percent to 20% for fUSDC on liquidity. + /// @notice Action 2: Update borrow expand percent for all the protocols on Liquidity. function action2() internal { - address fUSDC = address(0x9Fb7b4477576Fe5B32be4C1843aFB1e55F251B33); + AdminModuleStructs.UserBorrowConfig[] memory configs_ = new AdminModuleStructs.UserBorrowConfig[](5); - AdminModuleStructs.UserSupplyConfig[] memory configs_ = new AdminModuleStructs.UserSupplyConfig[](); - configs_[0] = getUserSupplyData( - USDC_ADDRESS, - fUSDC - ); + // Update to 20% + configs_[1] = getUserBorrowDataAndSetExpandPercent(USDC_ADDRESS, VAULT_ETH_USDC, 20 * 1e2); + configs_[2] = getUserBorrowDataAndSetExpandPercent(USDT_ADDRESS, VAULT_ETH_USDT, 20 * 1e2); + configs_[3] = getUserBorrowDataAndSetExpandPercent(USDC_ADDRESS, VAULT_WSTETH_USDC, 20 * 1e2); + configs_[4] = getUserBorrowDataAndSetExpandPercent(USDT_ADDRESS, VAULT_WSTETH_USDT, 20 * 1e2); + configs_[5] = getUserBorrowDataAndSetExpandPercent(ETH_ADDRESS, VAULT_WSTETH_ETH, 20 * 1e2); - configs_[0].expandPercent = 20 * 1e2; // 20% - - LIQUIDITY.updateUserSupplyConfigs(configs_); + LIQUIDITY.updateUserBorrowConfigs(configs_); } - /// @notice Action 3: Update supply expand percent to 20% for fWETH on liquidity. + /// @notice Action 3: Remove config handlers for vaults and lending tokens on liquidity. function action3() internal { - address fWETH = address(0x90551c1795392094FE6D29B758EcCD233cFAa260); - - AdminModuleStructs.UserSupplyConfig[] memory configs_ = new AdminModuleStructs.UserSupplyConfig[](); - configs_[0] = getUserSupplyData( - WETH_ADDRESS, - fWETH - ); - - configs_[0].expandPercent = 20 * 1e2; // 20% - - LIQUIDITY.updateUserSupplyConfigs(configs_); - } - - - /// @notice Action 4: Update supply expand percent to 25% and borrow expand percent to 20% for ETH/USDC vault on liquidity. - function action4() internal { - address user_ = VAULT_ETH_USDC; - address supplyToken_ = ETH_ADDRESS; - address borrowToken_ = USDC_ADDRESS; - - // Supply expand percent to 25% - AdminModuleStructs.UserSupplyConfig[] memory configs_ = new AdminModuleStructs.UserSupplyConfig[](); - configs_[0] = getUserSupplyData( - supplyToken_, - user_ - ); - - configs_[0].expandPercent = 25 * 1e2; // 25% - - LIQUIDITY.updateUserSupplyConfigs(configs_); - - // Borrow expand percent to 20% - AdminModuleStructs.UserBorrowConfig[] memory configs_ = new AdminModuleStructs.UserBorrowConfig[](); - configs_[0] = getUserBorrowData( - borrowToken_, - user_ - ); - - configs_[0].expandPercent = 20 * 1e2; // 20% - - LIQUIDITY.updateUserBorrowConfigs(configs_); - } - - /// @notice Action 5: Update supply expand percent to 25% and borrow expand percent to 20% for ETH/USDT vault on liquidity. - function action5() internal { - address user_ = VAULT_ETH_USDT; - address supplyToken_ = ETH_ADDRESS; - address borrowToken_ = USDT_ADDRESS; - - // Supply expand percent to 25% - AdminModuleStructs.UserSupplyConfig[] memory configs_ = new AdminModuleStructs.UserSupplyConfig[](); - configs_[0] = getUserSupplyData( - supplyToken_, - user_ - ); - - configs_[0].expandPercent = 25 * 1e2; // 25% - - LIQUIDITY.updateUserSupplyConfigs(configs_); - - // Borrow expand percent to 20% - AdminModuleStructs.UserBorrowConfig[] memory configs_ = new AdminModuleStructs.UserBorrowConfig[](); - configs_[0] = getUserBorrowData( - borrowToken_, - user_ - ); - - configs_[0].expandPercent = 20 * 1e2; // 20% - - LIQUIDITY.updateUserBorrowConfigs(configs_); - } - - /// @notice Action 6: Update supply expand percent to 25% and borrow expand percent to 20% for wstETH/ETH vault on liquidity. - function action6() internal { - address user_ = VAUTH_WSTETH_ETH; - address supplyToken_ = WSTETH_ADDRESS; - address borrowToken_ = ETH_ADDRESS; - - // Supply expand percent to 25% - AdminModuleStructs.UserSupplyConfig[] memory configs_ = new AdminModuleStructs.UserSupplyConfig[](); - configs_[0] = getUserSupplyData( - supplyToken_, - user_ - ); - - configs_[0].expandPercent = 25 * 1e2; // 25% - - LIQUIDITY.updateUserSupplyConfigs(configs_); - - // Borrow expand percent to 20% - AdminModuleStructs.UserBorrowConfig[] memory configs_ = new AdminModuleStructs.UserBorrowConfig[](); - configs_[0] = getUserBorrowData( - borrowToken_, - user_ - ); - - configs_[0].expandPercent = 20 * 1e2; // 20% - - LIQUIDITY.updateUserBorrowConfigs(configs_); - } - - /// @notice Action 7: Update supply expand percent to 25% and borrow expand percent to 20% for wstETH/USDC vault on liquidity. - function action7() internal { - address user_ = VAULT_WSTETH_USDC; - address supplyToken_ = WSTETH_ADDRESS; - address borrowToken_ = USDC_ADDRESS; - - // Supply expand percent to 25% - AdminModuleStructs.UserSupplyConfig[] memory configs_ = new AdminModuleStructs.UserSupplyConfig[](); - configs_[0] = getUserSupplyData( - supplyToken_, - user_ - ); - - configs_[0].expandPercent = 25 * 1e2; // 25% - - LIQUIDITY.updateUserSupplyConfigs(configs_); - - // Borrow expand percent to 20% - AdminModuleStructs.UserBorrowConfig[] memory configs_ = new AdminModuleStructs.UserBorrowConfig[](); - configs_[0] = getUserBorrowData( - borrowToken_, - user_ - ); - - configs_[0].expandPercent = 20 * 1e2; // 20% - - LIQUIDITY.updateUserBorrowConfigs(configs_); - } - - - /// @notice Action 8: Update supply expand percent to 25% and borrow expand percent to 20% for WSTETH/USDT vault on liquidity. - function action8() internal { - address user_ = VAULT_WSTETH_USDC; - address supplyToken_ = WSTETH_ADDRESS; - address borrowToken_ = USDT_ADDRESS; - - // Supply expand percent to 25% - AdminModuleStructs.UserSupplyConfig[] memory configs_ = new AdminModuleStructs.UserSupplyConfig[](); - configs_[0] = getUserSupplyData( - supplyToken_, - user_ - ); - - configs_[0].expandPercent = 25 * 1e2; // 25% - - LIQUIDITY.updateUserSupplyConfigs(configs_); - - // Borrow expand percent to 20% - AdminModuleStructs.UserBorrowConfig[] memory configs_ = new AdminModuleStructs.UserBorrowConfig[](); - configs_[0] = getUserBorrowData( - borrowToken_, - user_ - ); - - configs_[0].expandPercent = 20 * 1e2; // 20% - - LIQUIDITY.updateUserBorrowConfigs(configs_); - } - - /// @notice Action 9: Remove config handlers for vaults and lending tokens on liquidity. - function action9() internal { AdminModuleStructs.AddressBool[] memory addrBools_ = new AdminModuleStructs.AddressBool[](8); @@ -507,49 +342,49 @@ contract PayloadIGP12 { addrBools_[0] = AdminModuleStructs.AddressBool({ addr: 0x02AfbFA971299c2434E7a04565d9f5a1eD6180F1, value: false - }) + }); // fToken_fUSDT_LiquidityConfigHandler addrBools_[1] = AdminModuleStructs.AddressBool({ addr: 0xF45364EC2230c64B1AB0cE1E4c7E63F0a2078F30, value: false - }) + }); // fToken_fWETH_LiquidityConfigHandler addrBools_[2] = AdminModuleStructs.AddressBool({ addr: 0x580f8C04080347F5675CF67C1E90d935463148dC, value: false - }) + }); // Vault_ETH_USDC_LiquidityConfigHandler addrBools_[3] = AdminModuleStructs.AddressBool({ addr: 0xacdf9C61720A4D97Afa7f215ddDD56C2d1019FC9, value: false - }) + }); // Vault_ETH_USDT_LiquidityConfigHandler addrBools_[4] = AdminModuleStructs.AddressBool({ addr: 0x2274F61847703DBA28300BD7a0Fb3f1166Cb0E7C, value: false - }) + }); // Vault_wstETH_ETH_LiquidityConfigHandler addrBools_[5] = AdminModuleStructs.AddressBool({ addr: 0x28D64d5c85E9a0f0a33A481E71842255aeFf0Fe9, value: false - }) + }); // Vault_wstETH_USDC_LiquidityConfigHandler addrBools_[6] = AdminModuleStructs.AddressBool({ addr: 0xa66906140D5d413E40b1AE452B52DD1f162D47cA, value: false - }) + }); // Vault_wstETH_USDT_LiquidityConfigHandler addrBools_[7] = AdminModuleStructs.AddressBool({ addr: 0xB7AE8D080c7C26152e43DD6e8dcA7451BB33Be68, value: false - }) + }); LIQUIDITY.updateAuths(addrBools_); } @@ -559,7 +394,11 @@ contract PayloadIGP12 { | Proposal Payload Helpers | |__________________________________*/ - function getSupplyTokenConfig(address token_, address user_, uint256 expandPercent) internal returns(AdminModuleStructs.UserSupplyConfig memory config_){ + function getUserSupplyDataAndSetExpandPercent( + address token_, + address user_, + uint256 expandPercent_ + ) internal returns(AdminModuleStructs.UserSupplyConfig memory config_){ bytes32 _LIQUDITY_PROTOCOL_SUPPLY_SLOT = LiquiditySlotsLink.calculateDoubleMappingStorageSlot( LiquiditySlotsLink.LIQUIDITY_USER_SUPPLY_DOUBLE_MAPPING_SLOT, user_, @@ -572,7 +411,7 @@ contract PayloadIGP12 { user: user_, token: token_, mode: uint8(userSupplyData_ & 1), - expandPercent: expandPercent, + expandPercent: expandPercent_, expandDuration: (userSupplyData_ >> LiquiditySlotsLink.BITS_USER_SUPPLY_EXPAND_DURATION) & X24, baseWithdrawalLimit: BigMathMinified.fromBigNumber( (userSupplyData_ >> LiquiditySlotsLink.BITS_USER_SUPPLY_BASE_WITHDRAWAL_LIMIT) & X18, @@ -582,7 +421,11 @@ contract PayloadIGP12 { }); } - function getBorrowTokenConfig(address token_, address user_, uint256 expandPercent) internal returns(AdminModuleStructs.UserSupplyConfig memory config_){ + function getBorrowTokenConfigAndSetExpandPercent( + address token_, + address user_, + uint256 expandPercent_ + ) internal returns(AdminModuleStructs.UserSupplyConfig memory config_){ bytes32 _LIQUDITY_PROTOCOL_SUPPLY_SLOT = LiquiditySlotsLink.calculateDoubleMappingStorageSlot( LiquiditySlotsLink.LIQUIDITY_USER_SUPPLY_DOUBLE_MAPPING_SLOT, user_, @@ -595,7 +438,7 @@ contract PayloadIGP12 { user: user_, token: token_, mode: uint8(userSupplyData_ & 1), - expandPercent: expandPercent, + expandPercent: expandPercent_, expandDuration: (userSupplyData_ >> LiquiditySlotsLink.BITS_USER_SUPPLY_EXPAND_DURATION) & X24, baseWithdrawalLimit: BigMathMinified.fromBigNumber( (userSupplyData_ >> LiquiditySlotsLink.BITS_USER_SUPPLY_BASE_WITHDRAWAL_LIMIT) & X18, @@ -604,55 +447,4 @@ contract PayloadIGP12 { ) }); } - - function getUserSupplyData(address token_, address user_) internal returns(AdminModuleStructs.UserSupplyConfig memory config_) { - bytes32 _LIQUDITY_PROTOCOL_SUPPLY_SLOT = LiquiditySlotsLink.calculateDoubleMappingStorageSlot( - LiquiditySlotsLink.LIQUIDITY_USER_SUPPLY_DOUBLE_MAPPING_SLOT, - user_, - token_ - ); - - bytes32 userSupplyData_ = LIQUIDITY.readFromStorage(_LIQUDITY_PROTOCOL_SUPPLY_SLOT); - - config_ = AdminModuleStructs.UserSupplyConfig({ - user: user_, - token: token_, - mode: uint8(userSupplyData_ & 1), - expandPercent: (userSupplyData_ >> LiquiditySlotsLink.BITS_USER_SUPPLY_EXPAND_PERCENT) & X14, - expandDuration: (userSupplyData_ >> LiquiditySlotsLink.BITS_USER_SUPPLY_EXPAND_DURATION) & X24, - baseWithdrawalLimit: BigMathMinified.fromBigNumber( - (userSupplyData_ >> LiquiditySlotsLink.BITS_USER_SUPPLY_BASE_WITHDRAWAL_LIMIT) & X18, - DEFAULT_EXPONENT_SIZE, - DEFAULT_EXPONENT_MASK - ) - }); - } - - function getUserBorrowData(address token_, address user_) internal returns(AdminModuleStructs.UserBorrowConfig memory config_) { - bytes32 _LIQUDITY_PROTOCOL_BORROW_SLOT = LiquiditySlotsLink.calculateDoubleMappingStorageSlot( - LiquiditySlotsLink.LIQUIDITY_USER_BORROW_DOUBLE_MAPPING_SLOT, - user_, - token_ - ); - - userBorrowData_ = LIQUIDITY.readFromStorage(_LIQUDITY_PROTOCOL_BORROW_SLOT); - - config_ = AdminModuleStructs.UserBorrowConfig({ - user: user_, - token: token_, - mode: uint8(userBorrowData_ & 1), - expandPercent: (userBorrowData_ >> LiquiditySlotsLink.BITS_USER_BORROW_EXPAND_PERCENT) & X14;, - expandDuration: (userBorrowData_ >> LiquiditySlotsLink.BITS_USER_BORROW_EXPAND_DURATION) & X24, - baseDebtCeiling: BigMathMinified.fromBigNumber( - (userBorrowData_ >> LiquiditySlotsLink.BITS_USER_BORROW_BASE_BORROW_LIMIT) & X18, - DEFAULT_EXPONENT_SIZE, - DEFAULT_EXPONENT_MASK - ), - maxDebtCeiling: BigMathMinified.fromBigNumber( - (userBorrowData_ >> LiquiditySlotsLink.BITS_USER_BORROW_MAX_BORROW_LIMIT) & X18, - DEFAULT_EXPONENT_SIZE, - DEFAULT_EXPONENT_MASK - ) - }); - } } From e8acd2fce7666e26f02a05287c9a17828bfee3ea Mon Sep 17 00:00:00 2001 From: Thrilok kumar Date: Thu, 14 Mar 2024 02:18:35 -0400 Subject: [PATCH 4/8] fixed --- contracts/payloads/IGP12/PayloadIGP12.sol | 34 ++++++++++++++--------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/contracts/payloads/IGP12/PayloadIGP12.sol b/contracts/payloads/IGP12/PayloadIGP12.sol index d7a1d3f..7d201af 100644 --- a/contracts/payloads/IGP12/PayloadIGP12.sol +++ b/contracts/payloads/IGP12/PayloadIGP12.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.7.0; +pragma solidity >=0.7.0; pragma experimental ABIEncoderV2; import { BigMathMinified } from "./libraries/bigMathMinified.sol"; @@ -246,6 +246,9 @@ contract PayloadIGP12 { uint256 internal constant X24 = 0xffffff; uint256 internal constant X64 = 0xffffffffffffffff; + uint256 internal constant DEFAULT_EXPONENT_SIZE = 8; + uint256 internal constant DEFAULT_EXPONENT_MASK = 0xff; + constructor() { ADDRESS_THIS = address(this); } @@ -398,14 +401,14 @@ contract PayloadIGP12 { address token_, address user_, uint256 expandPercent_ - ) internal returns(AdminModuleStructs.UserSupplyConfig memory config_){ + ) internal view returns(AdminModuleStructs.UserSupplyConfig memory config_){ bytes32 _LIQUDITY_PROTOCOL_SUPPLY_SLOT = LiquiditySlotsLink.calculateDoubleMappingStorageSlot( LiquiditySlotsLink.LIQUIDITY_USER_SUPPLY_DOUBLE_MAPPING_SLOT, user_, token_ ); - bytes32 userSupplyData_ = LIQUIDITY.readFromStorage(_LIQUDITY_PROTOCOL_SUPPLY_SLOT); + uint256 userSupplyData_ = LIQUIDITY.readFromStorage(_LIQUDITY_PROTOCOL_SUPPLY_SLOT); config_ = AdminModuleStructs.UserSupplyConfig({ user: user_, @@ -421,27 +424,32 @@ contract PayloadIGP12 { }); } - function getBorrowTokenConfigAndSetExpandPercent( + function getUserBorrowDataAndSetExpandPercent( address token_, address user_, uint256 expandPercent_ - ) internal returns(AdminModuleStructs.UserSupplyConfig memory config_){ - bytes32 _LIQUDITY_PROTOCOL_SUPPLY_SLOT = LiquiditySlotsLink.calculateDoubleMappingStorageSlot( - LiquiditySlotsLink.LIQUIDITY_USER_SUPPLY_DOUBLE_MAPPING_SLOT, + ) internal view returns(AdminModuleStructs.UserBorrowConfig memory config_) { + bytes32 _LIQUDITY_PROTOCOL_BORROW_SLOT = LiquiditySlotsLink.calculateDoubleMappingStorageSlot( + LiquiditySlotsLink.LIQUIDITY_USER_BORROW_DOUBLE_MAPPING_SLOT, user_, token_ ); - bytes32 userSupplyData_ = LIQUIDITY.readFromStorage(_LIQUDITY_PROTOCOL_SUPPLY_SLOT); + uint256 userBorrowData_ = LIQUIDITY.readFromStorage(_LIQUDITY_PROTOCOL_BORROW_SLOT); - config_ = AdminModuleStructs.UserSupplyConfig({ + config_ = AdminModuleStructs.UserBorrowConfig({ user: user_, token: token_, - mode: uint8(userSupplyData_ & 1), + mode: uint8(userBorrowData_ & 1), expandPercent: expandPercent_, - expandDuration: (userSupplyData_ >> LiquiditySlotsLink.BITS_USER_SUPPLY_EXPAND_DURATION) & X24, - baseWithdrawalLimit: BigMathMinified.fromBigNumber( - (userSupplyData_ >> LiquiditySlotsLink.BITS_USER_SUPPLY_BASE_WITHDRAWAL_LIMIT) & X18, + expandDuration: (userBorrowData_ >> LiquiditySlotsLink.BITS_USER_BORROW_EXPAND_DURATION) & X24, + baseDebtCeiling: BigMathMinified.fromBigNumber( + (userBorrowData_ >> LiquiditySlotsLink.BITS_USER_BORROW_BASE_BORROW_LIMIT) & X18, + DEFAULT_EXPONENT_SIZE, + DEFAULT_EXPONENT_MASK + ), + maxDebtCeiling: BigMathMinified.fromBigNumber( + (userBorrowData_ >> LiquiditySlotsLink.BITS_USER_BORROW_MAX_BORROW_LIMIT) & X18, DEFAULT_EXPONENT_SIZE, DEFAULT_EXPONENT_MASK ) From 5af017b9df8b9c6eb86f29b554cbdfef51a9552d Mon Sep 17 00:00:00 2001 From: Thrilok kumar Date: Thu, 14 Mar 2024 02:25:50 -0400 Subject: [PATCH 5/8] cleanup --- contracts/payloads/IGP12/PayloadIGP12.sol | 1 - 1 file changed, 1 deletion(-) diff --git a/contracts/payloads/IGP12/PayloadIGP12.sol b/contracts/payloads/IGP12/PayloadIGP12.sol index 7d201af..81f92b2 100644 --- a/contracts/payloads/IGP12/PayloadIGP12.sol +++ b/contracts/payloads/IGP12/PayloadIGP12.sol @@ -239,7 +239,6 @@ contract PayloadIGP12 { address public constant F_USDT = 0x5C20B550819128074FD538Edf79791733ccEdd18; address public constant F_USDC = 0x9Fb7b4477576Fe5B32be4C1843aFB1e55F251B33; address public constant F_WETH = 0x90551c1795392094FE6D29B758EcCD233cFAa260; - uint256 internal constant X14 = 0x3fff; uint256 internal constant X18 = 0x3ffff; From 0933347a97e82305b635bbb7b3f456e5d68adb5f Mon Sep 17 00:00:00 2001 From: Thrilok kumar Date: Thu, 14 Mar 2024 21:20:48 -0400 Subject: [PATCH 6/8] fix --- contracts/payloads/IGP12/PayloadIGP12.sol | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/contracts/payloads/IGP12/PayloadIGP12.sol b/contracts/payloads/IGP12/PayloadIGP12.sol index 81f92b2..62675b2 100644 --- a/contracts/payloads/IGP12/PayloadIGP12.sol +++ b/contracts/payloads/IGP12/PayloadIGP12.sol @@ -205,10 +205,10 @@ interface IFluidVaultT1 { contract PayloadIGP12 { uint256 public constant PROPOSAL_ID = 12; - address public constant PROPOSER_1 = + address public constant PROPOSER = 0xA45f7bD6A5Ff45D31aaCE6bCD3d426D9328cea01; - address public constant PROPOSER_2 = + address public constant PROPOSER_AVO_MULTISIG = 0x059A94A72951c0ae1cc1CE3BF0dB52421bbE8210; IGovernorBravo public constant GOVERNOR = @@ -254,9 +254,11 @@ contract PayloadIGP12 { function propose(string memory description) external { require( - msg.sender == PROPOSER_1 || - msg.sender == PROPOSER_2 || - msg.sender == TEAM_MULTISIG, + ( + msg.sender == PROPOSER || + msg.sender == TEAM_MULTISIG + ) || + address(this) == PROPOSER_AVO_MULTISIG, "msg.sender-not-allowed" ); From 3559f446dbc0efde6115670135fe70d631cff1e0 Mon Sep 17 00:00:00 2001 From: Thrilok kumar Date: Thu, 14 Mar 2024 23:05:44 -0400 Subject: [PATCH 7/8] fix --- contracts/payloads/IGP12/PayloadIGP12.sol | 12 ++++++------ scripts/deployIGP12.js | 22 ++++++++++++++++++++++ 2 files changed, 28 insertions(+), 6 deletions(-) create mode 100644 scripts/deployIGP12.js diff --git a/contracts/payloads/IGP12/PayloadIGP12.sol b/contracts/payloads/IGP12/PayloadIGP12.sol index 62675b2..3c89555 100644 --- a/contracts/payloads/IGP12/PayloadIGP12.sol +++ b/contracts/payloads/IGP12/PayloadIGP12.sol @@ -311,7 +311,7 @@ contract PayloadIGP12 { // Update to 20% configs_[0] = getUserSupplyDataAndSetExpandPercent(USDT_ADDRESS, F_USDT, 20 * 1e2); configs_[1] = getUserSupplyDataAndSetExpandPercent(USDC_ADDRESS, F_USDC, 20 * 1e2); - configs_[2] = getUserSupplyDataAndSetExpandPercent(WETH_ADDRESS, F_WETH, 20 * 1e2); + configs_[2] = getUserSupplyDataAndSetExpandPercent(ETH_ADDRESS, F_WETH, 20 * 1e2); // Update to 25% configs_[3] = getUserSupplyDataAndSetExpandPercent(ETH_ADDRESS, VAULT_ETH_USDC, 25 * 1e2); @@ -328,11 +328,11 @@ contract PayloadIGP12 { AdminModuleStructs.UserBorrowConfig[] memory configs_ = new AdminModuleStructs.UserBorrowConfig[](5); // Update to 20% - configs_[1] = getUserBorrowDataAndSetExpandPercent(USDC_ADDRESS, VAULT_ETH_USDC, 20 * 1e2); - configs_[2] = getUserBorrowDataAndSetExpandPercent(USDT_ADDRESS, VAULT_ETH_USDT, 20 * 1e2); - configs_[3] = getUserBorrowDataAndSetExpandPercent(USDC_ADDRESS, VAULT_WSTETH_USDC, 20 * 1e2); - configs_[4] = getUserBorrowDataAndSetExpandPercent(USDT_ADDRESS, VAULT_WSTETH_USDT, 20 * 1e2); - configs_[5] = getUserBorrowDataAndSetExpandPercent(ETH_ADDRESS, VAULT_WSTETH_ETH, 20 * 1e2); + configs_[0] = getUserBorrowDataAndSetExpandPercent(USDC_ADDRESS, VAULT_ETH_USDC, 20 * 1e2); + configs_[1] = getUserBorrowDataAndSetExpandPercent(USDT_ADDRESS, VAULT_ETH_USDT, 20 * 1e2); + configs_[2] = getUserBorrowDataAndSetExpandPercent(USDC_ADDRESS, VAULT_WSTETH_USDC, 20 * 1e2); + configs_[3] = getUserBorrowDataAndSetExpandPercent(USDT_ADDRESS, VAULT_WSTETH_USDT, 20 * 1e2); + configs_[4] = getUserBorrowDataAndSetExpandPercent(ETH_ADDRESS, VAULT_WSTETH_ETH, 20 * 1e2); LIQUIDITY.updateUserBorrowConfigs(configs_); } diff --git a/scripts/deployIGP12.js b/scripts/deployIGP12.js new file mode 100644 index 0000000..121ae7c --- /dev/null +++ b/scripts/deployIGP12.js @@ -0,0 +1,22 @@ +const hre = require("hardhat"); +const { ethers } = hre; + +async function main() { + const PayloadIGP12 = await ethers.getContractFactory("PayloadIGP12") + const payloadIGP12 = await PayloadIGP12.deploy() + await payloadIGP12.deployed() + + console.log("PayloadIGP12: ", payloadIGP12.address) + + await hre.run("verify:verify", { + address: payloadIGP12.address, + constructorArguments: [] + }) +} + +main() + .then(() => process.exit(0)) + .catch(error => { + console.error(error); + process.exit(1); + }); From aa839168a1f999a6c5fcc563c7b3a35885d6c3c8 Mon Sep 17 00:00:00 2001 From: Thrilok kumar Date: Thu, 14 Mar 2024 23:46:32 -0400 Subject: [PATCH 8/8] fix --- deployments/mainnet_1/PayloadIGP12.json | 1 + 1 file changed, 1 insertion(+) create mode 100644 deployments/mainnet_1/PayloadIGP12.json diff --git a/deployments/mainnet_1/PayloadIGP12.json b/deployments/mainnet_1/PayloadIGP12.json new file mode 100644 index 0000000..aba5a32 --- /dev/null +++ b/deployments/mainnet_1/PayloadIGP12.json @@ -0,0 +1 @@ +{"metadata":"{\"defaultCompiler\":{\"version\":\"0.7.3\"},\"sources\":{\"contracts/payloads/IGP12/PayloadIGP12.sol\":{\"content\":\"pragma solidity >=0.7.0;\\npragma experimental ABIEncoderV2;\\n\\nimport { BigMathMinified } from \\\"./libraries/bigMathMinified.sol\\\";\\nimport { LiquiditySlotsLink } from \\\"./libraries/liquiditySlotsLink.sol\\\";\\n\\ninterface IGovernorBravo {\\n function propose(\\n address[] memory targets,\\n uint[] memory values,\\n string[] memory signatures,\\n bytes[] memory calldatas,\\n string memory description\\n ) external returns (uint);\\n\\n function admin() external view returns (address);\\n\\n function timelock() external view returns (address);\\n\\n function votingDelay() external view returns (uint256);\\n\\n function votingPeriod() external view returns (uint256);\\n}\\n\\ninterface ITimelock {\\n function admin() external view returns (address);\\n}\\n\\ninterface IInstaIndex {\\n function changeMaster(address _newMaster) external;\\n function updateMaster() external;\\n function master() external view returns (address);\\n}\\n\\ninterface AdminModuleStructs {\\n struct AddressBool {\\n address addr;\\n bool value;\\n }\\n\\n struct AddressUint256 {\\n address addr;\\n uint256 value;\\n }\\n\\n struct RateDataV1Params {\\n address token;\\n uint256 kink;\\n uint256 rateAtUtilizationZero;\\n uint256 rateAtUtilizationKink;\\n uint256 rateAtUtilizationMax;\\n }\\n\\n struct RateDataV2Params {\\n address token;\\n uint256 kink1;\\n uint256 kink2;\\n uint256 rateAtUtilizationZero;\\n uint256 rateAtUtilizationKink1;\\n uint256 rateAtUtilizationKink2;\\n uint256 rateAtUtilizationMax;\\n }\\n\\n struct TokenConfig {\\n address token;\\n uint256 fee;\\n uint256 threshold;\\n }\\n\\n struct UserSupplyConfig {\\n address user;\\n address token;\\n uint8 mode;\\n uint256 expandPercent;\\n uint256 expandDuration;\\n uint256 baseWithdrawalLimit;\\n }\\n\\n struct UserBorrowConfig {\\n address user;\\n address token;\\n uint8 mode;\\n uint256 expandPercent;\\n uint256 expandDuration;\\n uint256 baseDebtCeiling;\\n uint256 maxDebtCeiling;\\n }\\n}\\n\\ninterface IFluidLiquidityAdmin {\\n /// @notice adds/removes auths. Auths generally could be contracts which can have restricted actions defined on contract.\\n /// auths can be helpful in reducing governance overhead where it's not needed.\\n /// @param authsStatus_ array of structs setting allowed status for an address.\\n /// status true => add auth, false => remove auth\\n function updateAuths(AdminModuleStructs.AddressBool[] calldata authsStatus_) external;\\n\\n /// @notice adds/removes guardians. Only callable by Governance.\\n /// @param guardiansStatus_ array of structs setting allowed status for an address.\\n /// status true => add guardian, false => remove guardian\\n function updateGuardians(AdminModuleStructs.AddressBool[] calldata guardiansStatus_) external;\\n\\n /// @notice changes the revenue collector address (contract that is sent revenue). Only callable by Governance.\\n /// @param revenueCollector_ new revenue collector address\\n function updateRevenueCollector(address revenueCollector_) external;\\n\\n /// @notice changes current status, e.g. for pausing or unpausing all user operations. Only callable by Auths.\\n /// @param newStatus_ new status\\n /// status = 2 -> pause, status = 1 -> resume.\\n function changeStatus(uint256 newStatus_) external;\\n\\n /// @notice update tokens rate data version 1. Only callable by Auths.\\n /// @param tokensRateData_ array of RateDataV1Params with rate data to set for each token\\n function updateRateDataV1s(AdminModuleStructs.RateDataV1Params[] calldata tokensRateData_) external;\\n\\n /// @notice update tokens rate data version 2. Only callable by Auths.\\n /// @param tokensRateData_ array of RateDataV2Params with rate data to set for each token\\n function updateRateDataV2s(AdminModuleStructs.RateDataV2Params[] calldata tokensRateData_) external;\\n\\n /// @notice updates token configs: fee charge on borrowers interest & storage update utilization threshold.\\n /// Only callable by Auths.\\n /// @param tokenConfigs_ contains token address, fee & utilization threshold\\n function updateTokenConfigs(AdminModuleStructs.TokenConfig[] calldata tokenConfigs_) external;\\n\\n /// @notice updates user classes: 0 is for new protocols, 1 is for established protocols.\\n /// Only callable by Auths.\\n /// @param userClasses_ struct array of uint256 value to assign for each user address\\n function updateUserClasses(AdminModuleStructs.AddressUint256[] calldata userClasses_) external;\\n\\n /// @notice sets user supply configs per token basis. Eg: with interest or interest-free and automated limits.\\n /// Only callable by Auths.\\n /// @param userSupplyConfigs_ struct array containing user supply config, see `UserSupplyConfig` struct for more info\\n function updateUserSupplyConfigs(AdminModuleStructs.UserSupplyConfig[] memory userSupplyConfigs_) external;\\n\\n /// @notice setting user borrow configs per token basis. Eg: with interest or interest-free and automated limits.\\n /// Only callable by Auths.\\n /// @param userBorrowConfigs_ struct array containing user borrow config, see `UserBorrowConfig` struct for more info\\n function updateUserBorrowConfigs(AdminModuleStructs.UserBorrowConfig[] memory userBorrowConfigs_) external;\\n\\n /// @notice pause operations for a particular user in class 0 (class 1 users can't be paused by guardians).\\n /// Only callable by Guardians.\\n /// @param user_ address of user to pause operations for\\n /// @param supplyTokens_ token addresses to pause withdrawals for\\n /// @param borrowTokens_ token addresses to pause borrowings for\\n function pauseUser(address user_, address[] calldata supplyTokens_, address[] calldata borrowTokens_) external;\\n\\n /// @notice unpause operations for a particular user in class 0 (class 1 users can't be paused by guardians).\\n /// Only callable by Guardians.\\n /// @param user_ address of user to unpause operations for\\n /// @param supplyTokens_ token addresses to unpause withdrawals for\\n /// @param borrowTokens_ token addresses to unpause borrowings for\\n function unpauseUser(address user_, address[] calldata supplyTokens_, address[] calldata borrowTokens_) external;\\n\\n /// @notice collects revenue for tokens to configured revenueCollector address.\\n /// @param tokens_ array of tokens to collect revenue for\\n /// @dev Note that this can revert if token balance is < revenueAmount (utilization > 100%)\\n function collectRevenue(address[] calldata tokens_) external;\\n\\n /// @notice gets the current updated exchange prices for n tokens and updates all prices, rates related data in storage.\\n /// @param tokens_ tokens to update exchange prices for\\n /// @return supplyExchangePrices_ new supply rates of overall system for each token\\n /// @return borrowExchangePrices_ new borrow rates of overall system for each token\\n function updateExchangePrices(\\n address[] calldata tokens_\\n ) external returns (uint256[] memory supplyExchangePrices_, uint256[] memory borrowExchangePrices_);\\n\\n function readFromStorage(bytes32 slot_) external view returns (uint256 result_);\\n}\\n\\ninterface IFluidVaultT1Factory {\\n function deployVault(address vaultDeploymentLogic_, bytes calldata vaultDeploymentData_) external returns (address vault_);\\n}\\n\\ninterface IFluidVaultT1DeploymentLogic {\\n function vaultT1(\\n address supplyToken_,\\n address borrowToken_\\n ) external;\\n}\\n\\n\\ninterface IFluidVaultT1 {\\n /// @notice updates the Vault oracle to `newOracle_`. Must implement the FluidOracle interface.\\n function updateOracle(address newOracle_) external;\\n\\n /// @notice updates the all Vault core settings according to input params.\\n /// All input values are expected in 1e2 (1% = 100, 100% = 10_000).\\n function updateCoreSettings(\\n uint256 supplyRateMagnifier_,\\n uint256 borrowRateMagnifier_,\\n uint256 collateralFactor_,\\n uint256 liquidationThreshold_,\\n uint256 liquidationMaxLimit_,\\n uint256 withdrawGap_,\\n uint256 liquidationPenalty_,\\n uint256 borrowFee_\\n ) external;\\n\\n /// @notice updates the allowed rebalancer to `newRebalancer_`.\\n function updateRebalancer(address newRebalancer_) external;\\n\\n /// @notice updates the supply rate magnifier to `supplyRateMagnifier_`. Input in 1e2 (1% = 100, 100% = 10_000).\\n function updateSupplyRateMagnifier(uint supplyRateMagnifier_) external;\\n}\\n\\ncontract PayloadIGP12 {\\n uint256 public constant PROPOSAL_ID = 12;\\n\\n address public constant PROPOSER =\\n 0xA45f7bD6A5Ff45D31aaCE6bCD3d426D9328cea01;\\n\\n address public constant PROPOSER_AVO_MULTISIG =\\n 0x059A94A72951c0ae1cc1CE3BF0dB52421bbE8210;\\n\\n IGovernorBravo public constant GOVERNOR =\\n IGovernorBravo(0x0204Cd037B2ec03605CFdFe482D8e257C765fA1B);\\n ITimelock public constant TIMELOCK =\\n ITimelock(0x2386DC45AdDed673317eF068992F19421B481F4c);\\n\\n address public constant TEAM_MULTISIG = \\n 0x4F6F977aCDD1177DCD81aB83074855EcB9C2D49e;\\n\\n address public immutable ADDRESS_THIS;\\n \\n IFluidLiquidityAdmin public constant LIQUIDITY = IFluidLiquidityAdmin(0x52Aa899454998Be5b000Ad077a46Bbe360F4e497);\\n IFluidVaultT1Factory public constant VAULT_T1_FACTORY = IFluidVaultT1Factory(0x324c5Dc1fC42c7a4D43d92df1eBA58a54d13Bf2d);\\n IFluidVaultT1DeploymentLogic public constant VAULT_T1_DEPLOYMENT_LOGIC = IFluidVaultT1DeploymentLogic(0x15f6F562Ae136240AB9F4905cb50aCA54bCbEb5F);\\n\\n address public constant ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;\\n address public constant WETH_ADDRESS = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;\\n address public constant WSTETH_ADDRESS = 0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0;\\n address public constant USDC_ADDRESS = 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48;\\n address public constant USDT_ADDRESS = 0xdAC17F958D2ee523a2206206994597C13D831ec7;\\n\\n address public constant VAULT_ETH_USDC = address(0xeAbBfca72F8a8bf14C4ac59e69ECB2eB69F0811C);\\n address public constant VAULT_ETH_USDT = address(0xbEC491FeF7B4f666b270F9D5E5C3f443cBf20991);\\n address public constant VAULT_WSTETH_ETH = address(0xA0F83Fc5885cEBc0420ce7C7b139Adc80c4F4D91);\\n address public constant VAULT_WSTETH_USDC = address(0x51197586F6A9e2571868b6ffaef308f3bdfEd3aE);\\n address public constant VAULT_WSTETH_USDT = address(0x1c2bB46f36561bc4F05A94BD50916496aa501078);\\n address public constant F_USDT = 0x5C20B550819128074FD538Edf79791733ccEdd18;\\n address public constant F_USDC = 0x9Fb7b4477576Fe5B32be4C1843aFB1e55F251B33;\\n address public constant F_WETH = 0x90551c1795392094FE6D29B758EcCD233cFAa260;\\n \\n uint256 internal constant X14 = 0x3fff;\\n uint256 internal constant X18 = 0x3ffff;\\n uint256 internal constant X24 = 0xffffff;\\n uint256 internal constant X64 = 0xffffffffffffffff;\\n\\n uint256 internal constant DEFAULT_EXPONENT_SIZE = 8;\\n uint256 internal constant DEFAULT_EXPONENT_MASK = 0xff;\\n\\n constructor() {\\n ADDRESS_THIS = address(this);\\n }\\n\\n function propose(string memory description) external {\\n require(\\n (\\n msg.sender == PROPOSER || \\n msg.sender == TEAM_MULTISIG\\n ) || \\n address(this) == PROPOSER_AVO_MULTISIG,\\n \\\"msg.sender-not-allowed\\\"\\n );\\n\\n uint256 totalActions = 1;\\n address[] memory targets = new address[](totalActions);\\n uint256[] memory values = new uint256[](totalActions);\\n string[] memory signatures = new string[](totalActions);\\n bytes[] memory calldatas = new bytes[](totalActions);\\n\\n // Action 1: call executePayload on timelock contract to execute payload related to Fluid\\n targets[0] = address(TIMELOCK);\\n values[0] = 0;\\n signatures[0] = \\\"executePayload(address,string,bytes)\\\";\\n calldatas[0] = abi.encode(ADDRESS_THIS, \\\"execute()\\\", abi.encode());\\n\\n uint256 proposedId = GOVERNOR.propose(\\n targets,\\n values,\\n signatures,\\n calldatas,\\n description\\n );\\n\\n require(proposedId == PROPOSAL_ID, \\\"PROPOSAL_IS_NOT_SAME\\\");\\n }\\n\\n function execute() external {\\n require(address(this) == address(TIMELOCK), \\\"not-valid-caller\\\");\\n\\n // Action 1: Update supply expand percent for all the protocols on Liquidity.\\n action1();\\n\\n // Action 2: Update borrow expand percent for all the protocols on Liquidity.\\n action2();\\n\\n // Action 3: Remove config handlers for vaults and lending tokens on liquidity. \\n action3();\\n }\\n\\n function verifyProposal() external view {}\\n\\n /***********************************|\\n | Proposal Payload Actions |\\n |__________________________________*/\\n\\n /// @notice Action 1: Update supply expand percent for all the protocols on Liquidity.\\n function action1() internal {\\n AdminModuleStructs.UserSupplyConfig[] memory configs_ = new AdminModuleStructs.UserSupplyConfig[](8);\\n\\n // Update to 20%\\n configs_[0] = getUserSupplyDataAndSetExpandPercent(USDT_ADDRESS, F_USDT, 20 * 1e2);\\n configs_[1] = getUserSupplyDataAndSetExpandPercent(USDC_ADDRESS, F_USDC, 20 * 1e2);\\n configs_[2] = getUserSupplyDataAndSetExpandPercent(ETH_ADDRESS, F_WETH, 20 * 1e2);\\n\\n // Update to 25%\\n configs_[3] = getUserSupplyDataAndSetExpandPercent(ETH_ADDRESS, VAULT_ETH_USDC, 25 * 1e2);\\n configs_[4] = getUserSupplyDataAndSetExpandPercent(ETH_ADDRESS, VAULT_ETH_USDT, 25 * 1e2);\\n configs_[5] = getUserSupplyDataAndSetExpandPercent(WSTETH_ADDRESS, VAULT_WSTETH_USDC, 25 * 1e2);\\n configs_[6] = getUserSupplyDataAndSetExpandPercent(WSTETH_ADDRESS, VAULT_WSTETH_USDT, 25 * 1e2);\\n configs_[7] = getUserSupplyDataAndSetExpandPercent(WSTETH_ADDRESS, VAULT_WSTETH_ETH, 25 * 1e2);\\n\\n LIQUIDITY.updateUserSupplyConfigs(configs_);\\n }\\n\\n /// @notice Action 2: Update borrow expand percent for all the protocols on Liquidity.\\n function action2() internal {\\n AdminModuleStructs.UserBorrowConfig[] memory configs_ = new AdminModuleStructs.UserBorrowConfig[](5);\\n\\n // Update to 20%\\n configs_[0] = getUserBorrowDataAndSetExpandPercent(USDC_ADDRESS, VAULT_ETH_USDC, 20 * 1e2);\\n configs_[1] = getUserBorrowDataAndSetExpandPercent(USDT_ADDRESS, VAULT_ETH_USDT, 20 * 1e2);\\n configs_[2] = getUserBorrowDataAndSetExpandPercent(USDC_ADDRESS, VAULT_WSTETH_USDC, 20 * 1e2);\\n configs_[3] = getUserBorrowDataAndSetExpandPercent(USDT_ADDRESS, VAULT_WSTETH_USDT, 20 * 1e2);\\n configs_[4] = getUserBorrowDataAndSetExpandPercent(ETH_ADDRESS, VAULT_WSTETH_ETH, 20 * 1e2);\\n\\n LIQUIDITY.updateUserBorrowConfigs(configs_);\\n }\\n\\n /// @notice Action 3: Remove config handlers for vaults and lending tokens on liquidity. \\n function action3() internal {\\n AdminModuleStructs.AddressBool[] memory addrBools_ = new AdminModuleStructs.AddressBool[](8);\\n\\n\\n // fToken_fUSDC_LiquidityConfigHandler\\n addrBools_[0] = AdminModuleStructs.AddressBool({\\n addr: 0x02AfbFA971299c2434E7a04565d9f5a1eD6180F1,\\n value: false\\n });\\n\\n // fToken_fUSDT_LiquidityConfigHandler\\n addrBools_[1] = AdminModuleStructs.AddressBool({\\n addr: 0xF45364EC2230c64B1AB0cE1E4c7E63F0a2078F30,\\n value: false\\n });\\n\\n // fToken_fWETH_LiquidityConfigHandler\\n addrBools_[2] = AdminModuleStructs.AddressBool({\\n addr: 0x580f8C04080347F5675CF67C1E90d935463148dC,\\n value: false\\n });\\n\\n // Vault_ETH_USDC_LiquidityConfigHandler\\n addrBools_[3] = AdminModuleStructs.AddressBool({\\n addr: 0xacdf9C61720A4D97Afa7f215ddDD56C2d1019FC9,\\n value: false\\n });\\n\\n // Vault_ETH_USDT_LiquidityConfigHandler\\n addrBools_[4] = AdminModuleStructs.AddressBool({\\n addr: 0x2274F61847703DBA28300BD7a0Fb3f1166Cb0E7C,\\n value: false\\n });\\n\\n // Vault_wstETH_ETH_LiquidityConfigHandler\\n addrBools_[5] = AdminModuleStructs.AddressBool({\\n addr: 0x28D64d5c85E9a0f0a33A481E71842255aeFf0Fe9,\\n value: false\\n });\\n\\n // Vault_wstETH_USDC_LiquidityConfigHandler\\n addrBools_[6] = AdminModuleStructs.AddressBool({\\n addr: 0xa66906140D5d413E40b1AE452B52DD1f162D47cA,\\n value: false\\n });\\n\\n // Vault_wstETH_USDT_LiquidityConfigHandler\\n addrBools_[7] = AdminModuleStructs.AddressBool({\\n addr: 0xB7AE8D080c7C26152e43DD6e8dcA7451BB33Be68,\\n value: false\\n });\\n\\n LIQUIDITY.updateAuths(addrBools_);\\n }\\n\\n\\n /***********************************|\\n | Proposal Payload Helpers |\\n |__________________________________*/\\n\\n function getUserSupplyDataAndSetExpandPercent(\\n address token_,\\n address user_,\\n uint256 expandPercent_\\n ) internal view returns(AdminModuleStructs.UserSupplyConfig memory config_){\\n bytes32 _LIQUDITY_PROTOCOL_SUPPLY_SLOT = LiquiditySlotsLink.calculateDoubleMappingStorageSlot(\\n LiquiditySlotsLink.LIQUIDITY_USER_SUPPLY_DOUBLE_MAPPING_SLOT,\\n user_,\\n token_\\n );\\n\\n uint256 userSupplyData_ = LIQUIDITY.readFromStorage(_LIQUDITY_PROTOCOL_SUPPLY_SLOT); \\n\\n config_ = AdminModuleStructs.UserSupplyConfig({\\n user: user_,\\n token: token_,\\n mode: uint8(userSupplyData_ & 1),\\n expandPercent: expandPercent_,\\n expandDuration: (userSupplyData_ >> LiquiditySlotsLink.BITS_USER_SUPPLY_EXPAND_DURATION) & X24,\\n baseWithdrawalLimit: BigMathMinified.fromBigNumber(\\n (userSupplyData_ >> LiquiditySlotsLink.BITS_USER_SUPPLY_BASE_WITHDRAWAL_LIMIT) & X18,\\n DEFAULT_EXPONENT_SIZE,\\n DEFAULT_EXPONENT_MASK\\n )\\n });\\n }\\n\\n function getUserBorrowDataAndSetExpandPercent(\\n address token_,\\n address user_,\\n uint256 expandPercent_\\n ) internal view returns(AdminModuleStructs.UserBorrowConfig memory config_) {\\n bytes32 _LIQUDITY_PROTOCOL_BORROW_SLOT = LiquiditySlotsLink.calculateDoubleMappingStorageSlot(\\n LiquiditySlotsLink.LIQUIDITY_USER_BORROW_DOUBLE_MAPPING_SLOT,\\n user_,\\n token_\\n );\\n\\n uint256 userBorrowData_ = LIQUIDITY.readFromStorage(_LIQUDITY_PROTOCOL_BORROW_SLOT);\\n\\n config_ = AdminModuleStructs.UserBorrowConfig({\\n user: user_,\\n token: token_,\\n mode: uint8(userBorrowData_ & 1),\\n expandPercent: expandPercent_,\\n expandDuration: (userBorrowData_ >> LiquiditySlotsLink.BITS_USER_BORROW_EXPAND_DURATION) & X24,\\n baseDebtCeiling: BigMathMinified.fromBigNumber(\\n (userBorrowData_ >> LiquiditySlotsLink.BITS_USER_BORROW_BASE_BORROW_LIMIT) & X18,\\n DEFAULT_EXPONENT_SIZE,\\n DEFAULT_EXPONENT_MASK\\n ),\\n maxDebtCeiling: BigMathMinified.fromBigNumber(\\n (userBorrowData_ >> LiquiditySlotsLink.BITS_USER_BORROW_MAX_BORROW_LIMIT) & X18,\\n DEFAULT_EXPONENT_SIZE,\\n DEFAULT_EXPONENT_MASK\\n )\\n });\\n }\\n}\\n\",\"versionPragma\":\">=0.7.0\"},\"contracts/payloads/IGP12/libraries/bigMathMinified.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\npragma solidity 0.8.21;\\n\\n/// @title library that represents a number in BigNumber(coefficient and exponent) format to store in smaller bits.\\n/// @notice the number is divided into two parts: a coefficient and an exponent. This comes at a cost of losing some precision\\n/// at the end of the number because the exponent simply fills it with zeroes. This precision is oftentimes negligible and can\\n/// result in significant gas cost reduction due to storage space reduction.\\n/// Also note, a valid big number is as follows: if the exponent is > 0, then coefficient last bits should be occupied to have max precision.\\n/// @dev roundUp is more like a increase 1, which happens everytime for the same number.\\n/// roundDown simply sets trailing digits after coefficientSize to zero (floor), only once for the same number.\\nlibrary BigMathMinified {\\n /// @dev constants to use for `roundUp` input param to increase readability\\n bool internal constant ROUND_DOWN = false;\\n bool internal constant ROUND_UP = true;\\n\\n /// @dev converts `normal` number to BigNumber with `exponent` and `coefficient` (or precision).\\n /// e.g.:\\n /// 5035703444687813576399599 (normal) = (coefficient[32bits], exponent[8bits])[40bits]\\n /// 5035703444687813576399599 (decimal) => 10000101010010110100000011111011110010100110100000000011100101001101001101011101111 (binary)\\n /// => 10000101010010110100000011111011000000000000000000000000000000000000000000000000000\\n /// ^-------------------- 51(exponent) -------------- ^\\n /// coefficient = 1000,0101,0100,1011,0100,0000,1111,1011 (2236301563)\\n /// exponent = 0011,0011 (51)\\n /// bigNumber = 1000,0101,0100,1011,0100,0000,1111,1011,0011,0011 (572493200179)\\n ///\\n /// @param normal number which needs to be converted into Big Number\\n /// @param coefficientSize at max how many bits of precision there should be (64 = uint64 (64 bits precision))\\n /// @param exponentSize at max how many bits of exponent there should be (8 = uint8 (8 bits exponent))\\n /// @param roundUp signals if result should be rounded down or up\\n /// @return bigNumber converted bigNumber (coefficient << exponent)\\n function toBigNumber(\\n uint256 normal,\\n uint256 coefficientSize,\\n uint256 exponentSize,\\n bool roundUp\\n ) internal pure returns (uint256 bigNumber) {\\n assembly {\\n let lastBit_\\n let number_ := normal\\n if gt(number_, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF) {\\n number_ := shr(0x80, number_)\\n lastBit_ := 0x80\\n }\\n if gt(number_, 0xFFFFFFFFFFFFFFFF) {\\n number_ := shr(0x40, number_)\\n lastBit_ := add(lastBit_, 0x40)\\n }\\n if gt(number_, 0xFFFFFFFF) {\\n number_ := shr(0x20, number_)\\n lastBit_ := add(lastBit_, 0x20)\\n }\\n if gt(number_, 0xFFFF) {\\n number_ := shr(0x10, number_)\\n lastBit_ := add(lastBit_, 0x10)\\n }\\n if gt(number_, 0xFF) {\\n number_ := shr(0x8, number_)\\n lastBit_ := add(lastBit_, 0x8)\\n }\\n if gt(number_, 0xF) {\\n number_ := shr(0x4, number_)\\n lastBit_ := add(lastBit_, 0x4)\\n }\\n if gt(number_, 0x3) {\\n number_ := shr(0x2, number_)\\n lastBit_ := add(lastBit_, 0x2)\\n }\\n if gt(number_, 0x1) {\\n lastBit_ := add(lastBit_, 1)\\n }\\n if gt(number_, 0) {\\n lastBit_ := add(lastBit_, 1)\\n }\\n if lt(lastBit_, coefficientSize) {\\n // for throw exception\\n lastBit_ := coefficientSize\\n }\\n let exponent := sub(lastBit_, coefficientSize)\\n let coefficient := shr(exponent, normal)\\n if and(roundUp, gt(exponent, 0)) {\\n // rounding up is only needed if exponent is > 0, as otherwise the coefficient fully holds the original number\\n coefficient := add(coefficient, 1)\\n if eq(shl(coefficientSize, 1), coefficient) {\\n // case were coefficient was e.g. 111, with adding 1 it became 1000 (in binary) and coefficientSize 3 bits\\n // final coefficient would exceed it's size. -> reduce coefficent to 100 and increase exponent by 1.\\n coefficient := shl(sub(coefficientSize, 1), 1)\\n exponent := add(exponent, 1)\\n }\\n }\\n if iszero(lt(exponent, shl(exponentSize, 1))) {\\n // if exponent is >= exponentSize, the normal number is too big to fit within\\n // BigNumber with too small sizes for coefficient and exponent\\n revert(0, 0)\\n }\\n bigNumber := shl(exponentSize, coefficient)\\n bigNumber := add(bigNumber, exponent)\\n }\\n }\\n\\n /// @dev get `normal` number from `bigNumber`, `exponentSize` and `exponentMask`\\n function fromBigNumber(\\n uint256 bigNumber,\\n uint256 exponentSize,\\n uint256 exponentMask\\n ) internal pure returns (uint256 normal) {\\n assembly {\\n let coefficient := shr(exponentSize, bigNumber)\\n let exponent := and(bigNumber, exponentMask)\\n normal := shl(exponent, coefficient)\\n }\\n }\\n\\n /// @dev gets the most significant bit `lastBit` of a `normal` number (length of given number of binary format).\\n /// e.g.\\n /// 5035703444687813576399599 = 10000101010010110100000011111011110010100110100000000011100101001101001101011101111\\n /// lastBit = ^--------------------------------- 83 ----------------------------------------^\\n function mostSignificantBit(uint256 normal) internal pure returns (uint lastBit) {\\n assembly {\\n let number_ := normal\\n if gt(normal, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF) {\\n number_ := shr(0x80, number_)\\n lastBit := 0x80\\n }\\n if gt(number_, 0xFFFFFFFFFFFFFFFF) {\\n number_ := shr(0x40, number_)\\n lastBit := add(lastBit, 0x40)\\n }\\n if gt(number_, 0xFFFFFFFF) {\\n number_ := shr(0x20, number_)\\n lastBit := add(lastBit, 0x20)\\n }\\n if gt(number_, 0xFFFF) {\\n number_ := shr(0x10, number_)\\n lastBit := add(lastBit, 0x10)\\n }\\n if gt(number_, 0xFF) {\\n number_ := shr(0x8, number_)\\n lastBit := add(lastBit, 0x8)\\n }\\n if gt(number_, 0xF) {\\n number_ := shr(0x4, number_)\\n lastBit := add(lastBit, 0x4)\\n }\\n if gt(number_, 0x3) {\\n number_ := shr(0x2, number_)\\n lastBit := add(lastBit, 0x2)\\n }\\n if gt(number_, 0x1) {\\n lastBit := add(lastBit, 1)\\n }\\n if gt(number_, 0) {\\n lastBit := add(lastBit, 1)\\n }\\n }\\n }\\n}\",\"versionPragma\":\"0.8.21\"},\"contracts/payloads/IGP12/libraries/liquiditySlotsLink.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\npragma solidity 0.8.21;\\n\\n/// @notice library that helps in reading / working with storage slot data of Fluid Liquidity.\\n/// @dev as all data for Fluid Liquidity is internal, any data must be fetched directly through manual\\n/// slot reading through this library or, if gas usage is less important, through the FluidLiquidityResolver.\\nlibrary LiquiditySlotsLink {\\n /// @dev storage slot for status at Liquidity\\n uint256 internal constant LIQUIDITY_STATUS_SLOT = 1;\\n /// @dev storage slot for auths mapping at Liquidity\\n uint256 internal constant LIQUIDITY_AUTHS_MAPPING_SLOT = 2;\\n /// @dev storage slot for guardians mapping at Liquidity\\n uint256 internal constant LIQUIDITY_GUARDIANS_MAPPING_SLOT = 3;\\n /// @dev storage slot for user class mapping at Liquidity\\n uint256 internal constant LIQUIDITY_USER_CLASS_MAPPING_SLOT = 4;\\n /// @dev storage slot for exchangePricesAndConfig mapping at Liquidity\\n uint256 internal constant LIQUIDITY_EXCHANGE_PRICES_MAPPING_SLOT = 5;\\n /// @dev storage slot for rateData mapping at Liquidity\\n uint256 internal constant LIQUIDITY_RATE_DATA_MAPPING_SLOT = 6;\\n /// @dev storage slot for totalAmounts mapping at Liquidity\\n uint256 internal constant LIQUIDITY_TOTAL_AMOUNTS_MAPPING_SLOT = 7;\\n /// @dev storage slot for user supply double mapping at Liquidity\\n uint256 internal constant LIQUIDITY_USER_SUPPLY_DOUBLE_MAPPING_SLOT = 8;\\n /// @dev storage slot for user borrow double mapping at Liquidity\\n uint256 internal constant LIQUIDITY_USER_BORROW_DOUBLE_MAPPING_SLOT = 9;\\n /// @dev storage slot for listed tokens array at Liquidity\\n uint256 internal constant LIQUIDITY_LISTED_TOKENS_ARRAY_SLOT = 10;\\n\\n // --------------------------------\\n // @dev stacked uint256 storage slots bits position data for each:\\n\\n // ExchangePricesAndConfig\\n uint256 internal constant BITS_EXCHANGE_PRICES_BORROW_RATE = 0;\\n uint256 internal constant BITS_EXCHANGE_PRICES_FEE = 16;\\n uint256 internal constant BITS_EXCHANGE_PRICES_UTILIZATION = 30;\\n uint256 internal constant BITS_EXCHANGE_PRICES_UPDATE_THRESHOLD = 44;\\n uint256 internal constant BITS_EXCHANGE_PRICES_LAST_TIMESTAMP = 58;\\n uint256 internal constant BITS_EXCHANGE_PRICES_SUPPLY_EXCHANGE_PRICE = 91;\\n uint256 internal constant BITS_EXCHANGE_PRICES_BORROW_EXCHANGE_PRICE = 155;\\n uint256 internal constant BITS_EXCHANGE_PRICES_SUPPLY_RATIO = 219;\\n uint256 internal constant BITS_EXCHANGE_PRICES_BORROW_RATIO = 234;\\n\\n // RateData:\\n uint256 internal constant BITS_RATE_DATA_VERSION = 0;\\n // RateData: V1\\n uint256 internal constant BITS_RATE_DATA_V1_RATE_AT_UTILIZATION_ZERO = 4;\\n uint256 internal constant BITS_RATE_DATA_V1_UTILIZATION_AT_KINK = 20;\\n uint256 internal constant BITS_RATE_DATA_V1_RATE_AT_UTILIZATION_KINK = 36;\\n uint256 internal constant BITS_RATE_DATA_V1_RATE_AT_UTILIZATION_MAX = 52;\\n // RateData: V2\\n uint256 internal constant BITS_RATE_DATA_V2_RATE_AT_UTILIZATION_ZERO = 4;\\n uint256 internal constant BITS_RATE_DATA_V2_UTILIZATION_AT_KINK1 = 20;\\n uint256 internal constant BITS_RATE_DATA_V2_RATE_AT_UTILIZATION_KINK1 = 36;\\n uint256 internal constant BITS_RATE_DATA_V2_UTILIZATION_AT_KINK2 = 52;\\n uint256 internal constant BITS_RATE_DATA_V2_RATE_AT_UTILIZATION_KINK2 = 68;\\n uint256 internal constant BITS_RATE_DATA_V2_RATE_AT_UTILIZATION_MAX = 84;\\n\\n // TotalAmounts\\n uint256 internal constant BITS_TOTAL_AMOUNTS_SUPPLY_WITH_INTEREST = 0;\\n uint256 internal constant BITS_TOTAL_AMOUNTS_SUPPLY_INTEREST_FREE = 64;\\n uint256 internal constant BITS_TOTAL_AMOUNTS_BORROW_WITH_INTEREST = 128;\\n uint256 internal constant BITS_TOTAL_AMOUNTS_BORROW_INTEREST_FREE = 192;\\n\\n // UserSupplyData\\n uint256 internal constant BITS_USER_SUPPLY_MODE = 0;\\n uint256 internal constant BITS_USER_SUPPLY_AMOUNT = 1;\\n uint256 internal constant BITS_USER_SUPPLY_PREVIOUS_WITHDRAWAL_LIMIT = 65;\\n uint256 internal constant BITS_USER_SUPPLY_LAST_UPDATE_TIMESTAMP = 129;\\n uint256 internal constant BITS_USER_SUPPLY_EXPAND_PERCENT = 162;\\n uint256 internal constant BITS_USER_SUPPLY_EXPAND_DURATION = 176;\\n uint256 internal constant BITS_USER_SUPPLY_BASE_WITHDRAWAL_LIMIT = 200;\\n uint256 internal constant BITS_USER_SUPPLY_IS_PAUSED = 255;\\n\\n // UserBorrowData\\n uint256 internal constant BITS_USER_BORROW_MODE = 0;\\n uint256 internal constant BITS_USER_BORROW_AMOUNT = 1;\\n uint256 internal constant BITS_USER_BORROW_PREVIOUS_BORROW_LIMIT = 65;\\n uint256 internal constant BITS_USER_BORROW_LAST_UPDATE_TIMESTAMP = 129;\\n uint256 internal constant BITS_USER_BORROW_EXPAND_PERCENT = 162;\\n uint256 internal constant BITS_USER_BORROW_EXPAND_DURATION = 176;\\n uint256 internal constant BITS_USER_BORROW_BASE_BORROW_LIMIT = 200;\\n uint256 internal constant BITS_USER_BORROW_MAX_BORROW_LIMIT = 218;\\n uint256 internal constant BITS_USER_BORROW_IS_PAUSED = 255;\\n\\n // --------------------------------\\n\\n /// @notice Calculating the slot ID for Liquidity contract for single mapping at `slot_` for `key_`\\n function calculateMappingStorageSlot(uint256 slot_, address key_) internal pure returns (bytes32) {\\n return keccak256(abi.encode(key_, slot_));\\n }\\n\\n /// @notice Calculating the slot ID for Liquidity contract for double mapping at `slot_` for `key1_` and `key2_`\\n function calculateDoubleMappingStorageSlot(\\n uint256 slot_,\\n address key1_,\\n address key2_\\n ) internal pure returns (bytes32) {\\n bytes32 intermediateSlot_ = keccak256(abi.encode(key1_, slot_));\\n return keccak256(abi.encode(key2_, intermediateSlot_));\\n }\\n}\\n\",\"versionPragma\":\"0.8.21\"}}}","address":"0x2D281c5A1F662235c9E6dAB3578C63Fa858731F0","bytecode":"0x60a060405234801561001057600080fd5b50306080526080516117fd610037600039600081816103ce015261071101526117fd6000f3fe608060405234801561001057600080fd5b506004361061018e5760003560e01c806383ba27d8116100de578063bb09d9b711610097578063cc025f7c11610071578063cc025f7c146103c9578063d62bce54146103f0578063ecd77d951461040b578063ef81d23b1461042657600080fd5b8063bb09d9b714610378578063bffa7f0f14610393578063c1892058146103ae57600080fd5b806383ba27d8146102de5780638a1c7364146102f9578063a734f06e14610314578063aa98df391461032f578063aae7ae0714610342578063b788f3a11461035d57600080fd5b806353e568201161014b57806369f555921161012557806369f55592146102725780636dc0ae221461028d5780637aadef8b146102a85780637e2f35fa146102c357600080fd5b806353e568201461024d578063614619541461026857806366760d7d1461027057600080fd5b8063040141e5146101935780630bc9136e146101cb5780632861c7d1146101e15780632fca5d4f146101fc57806336e6372f14610217578063474585e214610232575b600080fd5b6101ae73c02aaa39b223fe8d0a0e5c4f27ead9083c756cc281565b6040516001600160a01b0390911681526020015b60405180910390f35b6101d3600c81565b6040519081526020016101c2565b6101ae7352aa899454998be5b000ad077a46bbe360f4e49781565b6101ae73eabbfca72f8a8bf14c4ac59e69ecb2eb69f0811c81565b6101ae737f39c581f595b53c5cb19bd0b3f8da6c935e2ca081565b6101ae7315f6f562ae136240ab9f4905cb50aca54bcbeb5f81565b6101ae73a0f83fc5885cebc0420ce7c7b139adc80c4f4d9181565b610270610441565b005b6101ae73bec491fef7b4f666b270f9d5e5c3f443cbf2099181565b6101ae730204cd037b2ec03605cfdfe482d8e257c765fa1b81565b6101ae732386dc45added673317ef068992f19421b481f4c81565b6101ae73059a94a72951c0ae1cc1ce3bf0db52421bbe821081565b6101ae739fb7b4477576fe5b32be4c1843afb1e55f251b3381565b6101ae73324c5dc1fc42c7a4d43d92df1eba58a54d13bf2d81565b6101ae73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee81565b61027061033d3660046113ba565b6104b6565b6101ae735c20b550819128074fd538edf79791733ccedd1881565b6101ae734f6f977acdd1177dcd81ab83074855ecb9c2d49e81565b6101ae73a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4881565b6101ae73a45f7bd6a5ff45d31aace6bcd3d426d9328cea0181565b6101ae73dac17f958d2ee523a2206206994597c13d831ec781565b6101ae7f000000000000000000000000000000000000000000000000000000000000000081565b6101ae731c2bb46f36561bc4f05a94bd50916496aa50107881565b6101ae7351197586f6a9e2571868b6ffaef308f3bdfed3ae81565b6101ae7390551c1795392094fe6d29b758eccd233cfaa26081565b30732386dc45added673317ef068992f19421b481f4c1461049c5760405162461bcd60e51b815260206004820152601060248201526f3737ba16bb30b634b216b1b0b63632b960811b60448201526064015b60405180910390fd5b6104a461083c565b6104ac610b76565b6104b4610d80565b565b3373a45f7bd6a5ff45d31aace6bcd3d426d9328cea0114806104eb575033734f6f977acdd1177dcd81ab83074855ecb9c2d49e145b8061050957503073059a94a72951c0ae1cc1ce3bf0db52421bbe8210145b61054e5760405162461bcd60e51b81526020600482015260166024820152751b5cd9cb9cd95b99195c8b5b9bdd0b585b1b1bddd95960521b6044820152606401610493565b604080516001808252818301909252600090826020808301908036833701905050905060008267ffffffffffffffff81111561058c5761058c6113a4565b6040519080825280602002602001820160405280156105b5578160200160208202803683370190505b50905060008367ffffffffffffffff8111156105d3576105d36113a4565b60405190808252806020026020018201604052801561060657816020015b60608152602001906001900390816105f15790505b50905060008467ffffffffffffffff811115610624576106246113a4565b60405190808252806020026020018201604052801561065757816020015b60608152602001906001900390816106425790505b509050732386dc45added673317ef068992f19421b481f4c846000815181106106825761068261146b565b60200260200101906001600160a01b031690816001600160a01b0316815250506000836000815181106106b7576106b761146b565b6020026020010181815250506040518060600160405280602481526020016117a460249139826000815181106106ef576106ef61146b565b60209081029190910181019190915260408051600081529182018152610738917f00000000000000000000000000000000000000000000000000000000000000009181016114c7565b6040516020818303038152906040528160008151811061075a5761075a61146b565b6020908102919091010152604051636d4ab48d60e11b8152600090730204cd037b2ec03605cfdfe482d8e257c765fa1b9063da95691a906107a79088908890889088908e906004016115a0565b6020604051808303816000875af11580156107c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107ea919061163f565b9050600c81146108335760405162461bcd60e51b815260206004820152601460248201527350524f504f53414c5f49535f4e4f545f53414d4560601b6044820152606401610493565b50505050505050565b6040805160088082526101208201909252600091816020015b61085d611307565b8152602001906001900390816108555790505090506108a773dac17f958d2ee523a2206206994597c13d831ec7735c20b550819128074fd538edf79791733ccedd186107d0611091565b816000815181106108ba576108ba61146b565b60200260200101819052506108fa73a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48739fb7b4477576fe5b32be4c1843afb1e55f251b336107d0611091565b8160018151811061090d5761090d61146b565b602002602001018190525061094d73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee7390551c1795392094fe6d29b758eccd233cfaa2606107d0611091565b816002815181106109605761096061146b565b60200260200101819052506109a073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee73eabbfca72f8a8bf14c4ac59e69ecb2eb69f0811c6109c4611091565b816003815181106109b3576109b361146b565b60200260200101819052506109f373eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee73bec491fef7b4f666b270f9d5e5c3f443cbf209916109c4611091565b81600481518110610a0657610a0661146b565b6020026020010181905250610a46737f39c581f595b53c5cb19bd0b3f8da6c935e2ca07351197586f6a9e2571868b6ffaef308f3bdfed3ae6109c4611091565b81600581518110610a5957610a5961146b565b6020026020010181905250610a99737f39c581f595b53c5cb19bd0b3f8da6c935e2ca0731c2bb46f36561bc4f05a94bd50916496aa5010786109c4611091565b81600681518110610aac57610aac61146b565b6020026020010181905250610aec737f39c581f595b53c5cb19bd0b3f8da6c935e2ca073a0f83fc5885cebc0420ce7c7b139adc80c4f4d916109c4611091565b81600781518110610aff57610aff61146b565b60209081029190910101526040516301635db560e11b81527352aa899454998be5b000ad077a46bbe360f4e497906302c6bb6a90610b41908490600401611658565b600060405180830381600087803b158015610b5b57600080fd5b505af1158015610b6f573d6000803e3d6000fd5b5050505050565b60408051600580825260c08201909252600091816020015b610b96611352565b815260200190600190039081610b8e579050509050610be073a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4873eabbfca72f8a8bf14c4ac59e69ecb2eb69f0811c6107d0611194565b81600081518110610bf357610bf361146b565b6020026020010181905250610c3373dac17f958d2ee523a2206206994597c13d831ec773bec491fef7b4f666b270f9d5e5c3f443cbf209916107d0611194565b81600181518110610c4657610c4661146b565b6020026020010181905250610c8673a0b86991c6218b36c1d19d4a2e9eb0ce3606eb487351197586f6a9e2571868b6ffaef308f3bdfed3ae6107d0611194565b81600281518110610c9957610c9961146b565b6020026020010181905250610cd973dac17f958d2ee523a2206206994597c13d831ec7731c2bb46f36561bc4f05a94bd50916496aa5010786107d0611194565b81600381518110610cec57610cec61146b565b6020026020010181905250610d2c73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee73a0f83fc5885cebc0420ce7c7b139adc80c4f4d916107d0611194565b81600481518110610d3f57610d3f61146b565b602090810291909101015260405162dc47c360e11b81527352aa899454998be5b000ad077a46bbe360f4e497906301b88f8690610b419084906004016116d2565b6040805160088082526101208201909252600091816020015b6040805180820190915260008082526020820152815260200190600190039081610d9957905050905060405180604001604052807302afbfa971299c2434e7a04565d9f5a1ed6180f16001600160a01b031681526020016000151581525081600081518110610e0a57610e0a61146b565b6020026020010181905250604051806040016040528073f45364ec2230c64b1ab0ce1e4c7e63f0a2078f306001600160a01b031681526020016000151581525081600181518110610e5d57610e5d61146b565b6020026020010181905250604051806040016040528073580f8c04080347f5675cf67c1e90d935463148dc6001600160a01b031681526020016000151581525081600281518110610eb057610eb061146b565b6020026020010181905250604051806040016040528073acdf9c61720a4d97afa7f215dddd56c2d1019fc96001600160a01b031681526020016000151581525081600381518110610f0357610f0361146b565b60200260200101819052506040518060400160405280732274f61847703dba28300bd7a0fb3f1166cb0e7c6001600160a01b031681526020016000151581525081600481518110610f5657610f5661146b565b602002602001018190525060405180604001604052807328d64d5c85e9a0f0a33a481e71842255aeff0fe96001600160a01b031681526020016000151581525081600581518110610fa957610fa961146b565b6020026020010181905250604051806040016040528073a66906140d5d413e40b1ae452b52dd1f162d47ca6001600160a01b031681526020016000151581525081600681518110610ffc57610ffc61146b565b6020026020010181905250604051806040016040528073b7ae8d080c7c26152e43dd6e8dca7451bb33be686001600160a01b03168152602001600015158152508160078151811061104f5761104f61146b565b6020908102919091010152604051633f66feff60e01b81527352aa899454998be5b000ad077a46bbe360f4e49790633f66feff90610b41908490600401611756565b611099611307565b60006110a7600885876112a7565b604051632d71cdb960e21b8152600481018290529091506000907352aa899454998be5b000ad077a46bbe360f4e4979063b5c736e490602401602060405180830381865afa1580156110fd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611121919061163f565b90506040518060c00160405280866001600160a01b03168152602001876001600160a01b031681526020018260011660ff16815260200185815260200162ffffff60b084901c1681526020016111886203ffff60c885901c16600860ff9082901c91161b90565b90529695505050505050565b61119c611352565b60006111aa600985876112a7565b604051632d71cdb960e21b8152600481018290529091506000907352aa899454998be5b000ad077a46bbe360f4e4979063b5c736e490602401602060405180830381865afa158015611200573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611224919061163f565b90506040518060e00160405280866001600160a01b03168152602001876001600160a01b031681526020018260011660ff16815260200185815260200162ffffff60b084901c16815260200161128b6203ffff60c885901c16600860ff9082901c91161b90565b81526020016103ff60e284901c1660ff60da85901c161b611188565b604080516001600160a01b039384166020808301919091528183019590955281518082038301815260608201835280519086012092909316608084015260a0808401929092528051808403909201825260c0909201909152805191012090565b6040518060c0016040528060006001600160a01b0316815260200160006001600160a01b03168152602001600060ff1681526020016000815260200160008152602001600081525090565b6040518060e0016040528060006001600160a01b0316815260200160006001600160a01b03168152602001600060ff168152602001600081526020016000815260200160008152602001600081525090565b634e487b7160e01b600052604160045260246000fd5b6000602082840312156113cc57600080fd5b813567ffffffffffffffff808211156113e457600080fd5b818401915084601f8301126113f857600080fd5b81358181111561140a5761140a6113a4565b604051601f8201601f19908116603f01168101908382118183101715611432576114326113a4565b8160405282815287602084870101111561144b57600080fd5b826020860160208301376000928101602001929092525095945050505050565b634e487b7160e01b600052603260045260246000fd5b6000815180845260005b818110156114a75760208185018101518683018201520161148b565b506000602082860101526020601f19601f83011685010191505092915050565b60018060a01b038316815260606020820152600960608201526865786563757465282960b81b608082015260a06040820152600061150860a0830184611481565b949350505050565b600081518084526020808501945080840160005b8381101561154057815187529582019590820190600101611524565b509495945050505050565b600081518084526020808501808196508360051b8101915082860160005b85811015611593578284038952611581848351611481565b98850198935090840190600101611569565b5091979650505050505050565b60a0808252865190820181905260009060209060c0840190828a01845b828110156115e25781516001600160a01b0316845292840192908401906001016115bd565b505050838103828501526115f68189611510565b915050828103604084015261160b818761154b565b9050828103606084015261161f818661154b565b905082810360808401526116338185611481565b98975050505050505050565b60006020828403121561165157600080fd5b5051919050565b602080825282518282018190526000919060409081850190868401855b8281101561159357815180516001600160a01b0390811686528782015116878601528581015160ff1686860152606080820151908601526080808201519086015260a0908101519085015260c09093019290850190600101611675565b602080825282518282018190526000919060409081850190868401855b8281101561159357815180516001600160a01b0390811686528782015116878601528581015160ff1686860152606080820151908601526080808201519086015260a0808201519086015260c0908101519085015260e090930192908501906001016116ef565b602080825282518282018190526000919060409081850190868401855b8281101561159357815180516001600160a01b03168552860151151586850152928401929085019060010161177356fe657865637574655061796c6f616428616464726573732c737472696e672c627974657329a264697066735822122058d44133535b36a669fb7e36a9017ed0c269a100246ba1cb6279524251083b4e64736f6c63430008150033","deployedBytecode":"0x608060405234801561001057600080fd5b506004361061018e5760003560e01c806383ba27d8116100de578063bb09d9b711610097578063cc025f7c11610071578063cc025f7c146103c9578063d62bce54146103f0578063ecd77d951461040b578063ef81d23b1461042657600080fd5b8063bb09d9b714610378578063bffa7f0f14610393578063c1892058146103ae57600080fd5b806383ba27d8146102de5780638a1c7364146102f9578063a734f06e14610314578063aa98df391461032f578063aae7ae0714610342578063b788f3a11461035d57600080fd5b806353e568201161014b57806369f555921161012557806369f55592146102725780636dc0ae221461028d5780637aadef8b146102a85780637e2f35fa146102c357600080fd5b806353e568201461024d578063614619541461026857806366760d7d1461027057600080fd5b8063040141e5146101935780630bc9136e146101cb5780632861c7d1146101e15780632fca5d4f146101fc57806336e6372f14610217578063474585e214610232575b600080fd5b6101ae73c02aaa39b223fe8d0a0e5c4f27ead9083c756cc281565b6040516001600160a01b0390911681526020015b60405180910390f35b6101d3600c81565b6040519081526020016101c2565b6101ae7352aa899454998be5b000ad077a46bbe360f4e49781565b6101ae73eabbfca72f8a8bf14c4ac59e69ecb2eb69f0811c81565b6101ae737f39c581f595b53c5cb19bd0b3f8da6c935e2ca081565b6101ae7315f6f562ae136240ab9f4905cb50aca54bcbeb5f81565b6101ae73a0f83fc5885cebc0420ce7c7b139adc80c4f4d9181565b610270610441565b005b6101ae73bec491fef7b4f666b270f9d5e5c3f443cbf2099181565b6101ae730204cd037b2ec03605cfdfe482d8e257c765fa1b81565b6101ae732386dc45added673317ef068992f19421b481f4c81565b6101ae73059a94a72951c0ae1cc1ce3bf0db52421bbe821081565b6101ae739fb7b4477576fe5b32be4c1843afb1e55f251b3381565b6101ae73324c5dc1fc42c7a4d43d92df1eba58a54d13bf2d81565b6101ae73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee81565b61027061033d3660046113ba565b6104b6565b6101ae735c20b550819128074fd538edf79791733ccedd1881565b6101ae734f6f977acdd1177dcd81ab83074855ecb9c2d49e81565b6101ae73a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4881565b6101ae73a45f7bd6a5ff45d31aace6bcd3d426d9328cea0181565b6101ae73dac17f958d2ee523a2206206994597c13d831ec781565b6101ae7f000000000000000000000000000000000000000000000000000000000000000081565b6101ae731c2bb46f36561bc4f05a94bd50916496aa50107881565b6101ae7351197586f6a9e2571868b6ffaef308f3bdfed3ae81565b6101ae7390551c1795392094fe6d29b758eccd233cfaa26081565b30732386dc45added673317ef068992f19421b481f4c1461049c5760405162461bcd60e51b815260206004820152601060248201526f3737ba16bb30b634b216b1b0b63632b960811b60448201526064015b60405180910390fd5b6104a461083c565b6104ac610b76565b6104b4610d80565b565b3373a45f7bd6a5ff45d31aace6bcd3d426d9328cea0114806104eb575033734f6f977acdd1177dcd81ab83074855ecb9c2d49e145b8061050957503073059a94a72951c0ae1cc1ce3bf0db52421bbe8210145b61054e5760405162461bcd60e51b81526020600482015260166024820152751b5cd9cb9cd95b99195c8b5b9bdd0b585b1b1bddd95960521b6044820152606401610493565b604080516001808252818301909252600090826020808301908036833701905050905060008267ffffffffffffffff81111561058c5761058c6113a4565b6040519080825280602002602001820160405280156105b5578160200160208202803683370190505b50905060008367ffffffffffffffff8111156105d3576105d36113a4565b60405190808252806020026020018201604052801561060657816020015b60608152602001906001900390816105f15790505b50905060008467ffffffffffffffff811115610624576106246113a4565b60405190808252806020026020018201604052801561065757816020015b60608152602001906001900390816106425790505b509050732386dc45added673317ef068992f19421b481f4c846000815181106106825761068261146b565b60200260200101906001600160a01b031690816001600160a01b0316815250506000836000815181106106b7576106b761146b565b6020026020010181815250506040518060600160405280602481526020016117a460249139826000815181106106ef576106ef61146b565b60209081029190910181019190915260408051600081529182018152610738917f00000000000000000000000000000000000000000000000000000000000000009181016114c7565b6040516020818303038152906040528160008151811061075a5761075a61146b565b6020908102919091010152604051636d4ab48d60e11b8152600090730204cd037b2ec03605cfdfe482d8e257c765fa1b9063da95691a906107a79088908890889088908e906004016115a0565b6020604051808303816000875af11580156107c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107ea919061163f565b9050600c81146108335760405162461bcd60e51b815260206004820152601460248201527350524f504f53414c5f49535f4e4f545f53414d4560601b6044820152606401610493565b50505050505050565b6040805160088082526101208201909252600091816020015b61085d611307565b8152602001906001900390816108555790505090506108a773dac17f958d2ee523a2206206994597c13d831ec7735c20b550819128074fd538edf79791733ccedd186107d0611091565b816000815181106108ba576108ba61146b565b60200260200101819052506108fa73a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48739fb7b4477576fe5b32be4c1843afb1e55f251b336107d0611091565b8160018151811061090d5761090d61146b565b602002602001018190525061094d73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee7390551c1795392094fe6d29b758eccd233cfaa2606107d0611091565b816002815181106109605761096061146b565b60200260200101819052506109a073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee73eabbfca72f8a8bf14c4ac59e69ecb2eb69f0811c6109c4611091565b816003815181106109b3576109b361146b565b60200260200101819052506109f373eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee73bec491fef7b4f666b270f9d5e5c3f443cbf209916109c4611091565b81600481518110610a0657610a0661146b565b6020026020010181905250610a46737f39c581f595b53c5cb19bd0b3f8da6c935e2ca07351197586f6a9e2571868b6ffaef308f3bdfed3ae6109c4611091565b81600581518110610a5957610a5961146b565b6020026020010181905250610a99737f39c581f595b53c5cb19bd0b3f8da6c935e2ca0731c2bb46f36561bc4f05a94bd50916496aa5010786109c4611091565b81600681518110610aac57610aac61146b565b6020026020010181905250610aec737f39c581f595b53c5cb19bd0b3f8da6c935e2ca073a0f83fc5885cebc0420ce7c7b139adc80c4f4d916109c4611091565b81600781518110610aff57610aff61146b565b60209081029190910101526040516301635db560e11b81527352aa899454998be5b000ad077a46bbe360f4e497906302c6bb6a90610b41908490600401611658565b600060405180830381600087803b158015610b5b57600080fd5b505af1158015610b6f573d6000803e3d6000fd5b5050505050565b60408051600580825260c08201909252600091816020015b610b96611352565b815260200190600190039081610b8e579050509050610be073a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4873eabbfca72f8a8bf14c4ac59e69ecb2eb69f0811c6107d0611194565b81600081518110610bf357610bf361146b565b6020026020010181905250610c3373dac17f958d2ee523a2206206994597c13d831ec773bec491fef7b4f666b270f9d5e5c3f443cbf209916107d0611194565b81600181518110610c4657610c4661146b565b6020026020010181905250610c8673a0b86991c6218b36c1d19d4a2e9eb0ce3606eb487351197586f6a9e2571868b6ffaef308f3bdfed3ae6107d0611194565b81600281518110610c9957610c9961146b565b6020026020010181905250610cd973dac17f958d2ee523a2206206994597c13d831ec7731c2bb46f36561bc4f05a94bd50916496aa5010786107d0611194565b81600381518110610cec57610cec61146b565b6020026020010181905250610d2c73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee73a0f83fc5885cebc0420ce7c7b139adc80c4f4d916107d0611194565b81600481518110610d3f57610d3f61146b565b602090810291909101015260405162dc47c360e11b81527352aa899454998be5b000ad077a46bbe360f4e497906301b88f8690610b419084906004016116d2565b6040805160088082526101208201909252600091816020015b6040805180820190915260008082526020820152815260200190600190039081610d9957905050905060405180604001604052807302afbfa971299c2434e7a04565d9f5a1ed6180f16001600160a01b031681526020016000151581525081600081518110610e0a57610e0a61146b565b6020026020010181905250604051806040016040528073f45364ec2230c64b1ab0ce1e4c7e63f0a2078f306001600160a01b031681526020016000151581525081600181518110610e5d57610e5d61146b565b6020026020010181905250604051806040016040528073580f8c04080347f5675cf67c1e90d935463148dc6001600160a01b031681526020016000151581525081600281518110610eb057610eb061146b565b6020026020010181905250604051806040016040528073acdf9c61720a4d97afa7f215dddd56c2d1019fc96001600160a01b031681526020016000151581525081600381518110610f0357610f0361146b565b60200260200101819052506040518060400160405280732274f61847703dba28300bd7a0fb3f1166cb0e7c6001600160a01b031681526020016000151581525081600481518110610f5657610f5661146b565b602002602001018190525060405180604001604052807328d64d5c85e9a0f0a33a481e71842255aeff0fe96001600160a01b031681526020016000151581525081600581518110610fa957610fa961146b565b6020026020010181905250604051806040016040528073a66906140d5d413e40b1ae452b52dd1f162d47ca6001600160a01b031681526020016000151581525081600681518110610ffc57610ffc61146b565b6020026020010181905250604051806040016040528073b7ae8d080c7c26152e43dd6e8dca7451bb33be686001600160a01b03168152602001600015158152508160078151811061104f5761104f61146b565b6020908102919091010152604051633f66feff60e01b81527352aa899454998be5b000ad077a46bbe360f4e49790633f66feff90610b41908490600401611756565b611099611307565b60006110a7600885876112a7565b604051632d71cdb960e21b8152600481018290529091506000907352aa899454998be5b000ad077a46bbe360f4e4979063b5c736e490602401602060405180830381865afa1580156110fd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611121919061163f565b90506040518060c00160405280866001600160a01b03168152602001876001600160a01b031681526020018260011660ff16815260200185815260200162ffffff60b084901c1681526020016111886203ffff60c885901c16600860ff9082901c91161b90565b90529695505050505050565b61119c611352565b60006111aa600985876112a7565b604051632d71cdb960e21b8152600481018290529091506000907352aa899454998be5b000ad077a46bbe360f4e4979063b5c736e490602401602060405180830381865afa158015611200573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611224919061163f565b90506040518060e00160405280866001600160a01b03168152602001876001600160a01b031681526020018260011660ff16815260200185815260200162ffffff60b084901c16815260200161128b6203ffff60c885901c16600860ff9082901c91161b90565b81526020016103ff60e284901c1660ff60da85901c161b611188565b604080516001600160a01b039384166020808301919091528183019590955281518082038301815260608201835280519086012092909316608084015260a0808401929092528051808403909201825260c0909201909152805191012090565b6040518060c0016040528060006001600160a01b0316815260200160006001600160a01b03168152602001600060ff1681526020016000815260200160008152602001600081525090565b6040518060e0016040528060006001600160a01b0316815260200160006001600160a01b03168152602001600060ff168152602001600081526020016000815260200160008152602001600081525090565b634e487b7160e01b600052604160045260246000fd5b6000602082840312156113cc57600080fd5b813567ffffffffffffffff808211156113e457600080fd5b818401915084601f8301126113f857600080fd5b81358181111561140a5761140a6113a4565b604051601f8201601f19908116603f01168101908382118183101715611432576114326113a4565b8160405282815287602084870101111561144b57600080fd5b826020860160208301376000928101602001929092525095945050505050565b634e487b7160e01b600052603260045260246000fd5b6000815180845260005b818110156114a75760208185018101518683018201520161148b565b506000602082860101526020601f19601f83011685010191505092915050565b60018060a01b038316815260606020820152600960608201526865786563757465282960b81b608082015260a06040820152600061150860a0830184611481565b949350505050565b600081518084526020808501945080840160005b8381101561154057815187529582019590820190600101611524565b509495945050505050565b600081518084526020808501808196508360051b8101915082860160005b85811015611593578284038952611581848351611481565b98850198935090840190600101611569565b5091979650505050505050565b60a0808252865190820181905260009060209060c0840190828a01845b828110156115e25781516001600160a01b0316845292840192908401906001016115bd565b505050838103828501526115f68189611510565b915050828103604084015261160b818761154b565b9050828103606084015261161f818661154b565b905082810360808401526116338185611481565b98975050505050505050565b60006020828403121561165157600080fd5b5051919050565b602080825282518282018190526000919060409081850190868401855b8281101561159357815180516001600160a01b0390811686528782015116878601528581015160ff1686860152606080820151908601526080808201519086015260a0908101519085015260c09093019290850190600101611675565b602080825282518282018190526000919060409081850190868401855b8281101561159357815180516001600160a01b0390811686528782015116878601528581015160ff1686860152606080820151908601526080808201519086015260a0808201519086015260c0908101519085015260e090930192908501906001016116ef565b602080825282518282018190526000919060409081850190868401855b8281101561159357815180516001600160a01b03168552860151151586850152928401929085019060010161177356fe657865637574655061796c6f616428616464726573732c737472696e672c627974657329a264697066735822122058d44133535b36a669fb7e36a9017ed0c269a100246ba1cb6279524251083b4e64736f6c63430008150033","abi":[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ADDRESS_THIS","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ETH_ADDRESS","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"F_USDC","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"F_USDT","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"F_WETH","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"GOVERNOR","outputs":[{"internalType":"contract IGovernorBravo","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"LIQUIDITY","outputs":[{"internalType":"contract IFluidLiquidityAdmin","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PROPOSAL_ID","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PROPOSER","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PROPOSER_AVO_MULTISIG","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"TEAM_MULTISIG","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"TIMELOCK","outputs":[{"internalType":"contract ITimelock","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"USDC_ADDRESS","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"USDT_ADDRESS","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"VAULT_ETH_USDC","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"VAULT_ETH_USDT","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"VAULT_T1_DEPLOYMENT_LOGIC","outputs":[{"internalType":"contract IFluidVaultT1DeploymentLogic","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"VAULT_T1_FACTORY","outputs":[{"internalType":"contract IFluidVaultT1Factory","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"VAULT_WSTETH_ETH","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"VAULT_WSTETH_USDC","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"VAULT_WSTETH_USDT","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"WETH_ADDRESS","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"WSTETH_ADDRESS","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"execute","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"description","type":"string"}],"name":"propose","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"verifyProposal","outputs":[],"stateMutability":"view","type":"function"}]} \ No newline at end of file