diff --git a/.openzeppelin/unknown-421614.json b/.openzeppelin/bsc-testnet.json similarity index 76% rename from .openzeppelin/unknown-421614.json rename to .openzeppelin/bsc-testnet.json index cc7e185..a8d11ec 100644 --- a/.openzeppelin/unknown-421614.json +++ b/.openzeppelin/bsc-testnet.json @@ -2,766 +2,60 @@ "manifestVersion": "3.2", "proxies": [ { - "address": "0x050ACf48e82d3688A93180082f7adeA015d78892", - "txHash": "0x88ce2a21356bed6c3c42db72206cbcd8fa642990fae1eb4dfd2786db8ed420b8", + "address": "0x631Bd6834C50f6d2B07035c9253b4a19132E888c", + "txHash": "0x31392dba72e5f6050dd5a304a52d2a5998d6f03a47ee57423b85c42b5b7bc111", "kind": "uups" }, { - "address": "0x916fD79AFE9BdA073A8eF68014026c59292f4bec", - "txHash": "0x80ce485d96f5d3d0672cd212476808ac0198195c6b1e8841c4c4c612f03eab9a", + "address": "0x1b96F219E8aeE557DD8bD905a6c72cc64eA5BD7B", + "txHash": "0xdd4ce2e48b18a75b032de5cc49257f2b3d0fae2d329e4f369a23739c204ab49c", "kind": "uups" }, { - "address": "0x6D12F383d58Fb05f00799dEB5742CC0EF28Cf038", - "txHash": "0x274b6b58b6aaf391968fca65e83ce65088a77fff30ed715fc565874d086a3b15", + "address": "0x0f2d930EE73972132E3a36b7eD6F709Af6E5B879", + "txHash": "0xfefc1e8ca14d81bf63252a69580941d6ba99d2e3c352fd31a79ee2c4e93d0053", "kind": "uups" }, { - "address": "0x664dF9c24b184f8D2533BfFF1E8cbff939978879", - "txHash": "0xa529af0b5a88f48688f880a9b8c36104b9d5a23cc4b21a1e3ba842b94c1285d5", + "address": "0x19982e5145ca5401A1084c0BF916c0E0bB343Af9", + "txHash": "0xdac90d4a1faad38944b4bc1e3ecb817bc2c59971da2d3b2d26319724e23483cc", "kind": "uups" }, { - "address": "0x102e3F25Ef0ad9b0695C8F2daF8A1262437eEfc3", - "txHash": "0xb32895496edc152a1991636b83ab89939d93b683f5393675cfefd70ac314a2b8", + "address": "0x14246886a1E1202cb6b5a2db793eF3359d536302", + "txHash": "0x47e647bce8b16817799357b4e596687250a62f575afffdef107acba3f312848c", "kind": "uups" }, { - "address": "0xdC18de7D5A439cb90F149Eb62bAace55557d20AA", - "txHash": "0x43f070e5e4f1137ca7a4207d21d48acb163855d7ac6099211262d2285e8b5edf", + "address": "0x51eEF57eC57c867AC23945f0ce21aA5A9a2C246c", + "txHash": "0x275efe31833afe66dfc68525d2c0d5faa47e07f10b97b1966e83cb6b483c05a9", "kind": "uups" }, { - "address": "0xc110C84b107126c4E5b1CE598d3602ec0260D98B", - "txHash": "0x8aca4618e47a8e8fb6a8a54af9afdf703a95dc3f722fb9aa488d6f64ea29f995", + "address": "0x6DaB73519DbaFf23F36FEd24110e2ef5Cfc8aAC9", + "txHash": "0x92289fc7a7c1fc0b1c6ac5e077e5fd0c22f8d40e690e257efed2ec0e3cfa3099", "kind": "uups" }, { - "address": "0x691Aa0fF71a330454f50452925A3005Ae8412902", - "txHash": "0x38a51ad21c16e2911d78a423065dac4c6b8d5ee7e2aa35431fbc37c7d410a8e1", + "address": "0x13bD017E5837b5451447508ebd4Fe65A2B1d4f30", + "txHash": "0x56d5c972ab0461ef51443b1c2393bad1a68ea6ed3cfd13218747dea11b0f0c62", "kind": "uups" }, { - "address": "0x15dA695F8ad005c2Ccd0AEC57C902c404E510Aab", - "txHash": "0xa4f8364eea4cc24b25755effa35baa75b347f174aa6cc62991e533f9fc09f251", + "address": "0xB9676f3482D332210C5c630Fa265c92171958F92", + "txHash": "0xbfd053d3f1bc9a444f36f1e0e0ac3efb04655dd4e5fe7ea7338ef64f9030e4cb", "kind": "uups" }, { - "address": "0xb5Ddb2C45874f04aD0d48F3bB6b0748b1D06814C", - "txHash": "0x3754cb115281b8b3d1384e6c9fc5df43dca4875128ef8b34690a24a82b666e5f", - "kind": "uups" - }, - { - "address": "0xDC2b9D97751be177108a9AD2758377EBd4bA7e74", - "txHash": "0x809c1cef770b4d92470d0c32eb3b95fc5f12a09b6a81fc4d74d39bb5ee01ab28", - "kind": "uups" - }, - { - "address": "0xE82c7cB9CfA42D6eb7e443956b78f8290249c316", - "txHash": "0x483864261551c7961d1bd022ed6e3d9a7e2c2ca532645dc119e557c2d4a3a502", - "kind": "uups" - }, - { - "address": "0x488409CE9A3Fcd8EbD373dCb7e025cF8AB96fcdc", - "txHash": "0xaae0de3172940a3e612bcf41a4d619a79dccee78035c84412fde5a421c1e6fdb", - "kind": "uups" - }, - { - "address": "0xCb4E7B1069F6C26A1c27523ce4c8dfD884552d1D", - "txHash": "0xd8e891cd76057f51225dc839e7c4efb22959aad11e952b2b4f6fe2ca6de2bcca", + "address": "0x1E60013A6eb8966a1b59BC31cE0D07054E591eE7", + "txHash": "0xfab5bb7bb47b3c4b233f5eb7123d08be79c25e1f471a83d6f6d2aa3eb23d94d9", "kind": "uups" } ], "impls": { - "0d29172dc4cf27b6f2516e07cdf4850639d3150c256071c0332dc01901c02251": { - "address": "0x12F6b84017E70C85Bf9EF2CEF320BccFd7E7314B", - "txHash": "0x597ee4bd6908d95d23c501171d737fcdabe9a6ebc7e1cf22837f801754e1de04", - "layout": { - "solcVersion": "0.8.28", - "storage": [ - { - "label": "factory", - "offset": 0, - "slot": "0", - "type": "t_mapping(t_address,t_address)", - "contract": "ConfiguratorStorage", - "src": "contracts/ytLending/ConfiguratorStorage.sol:12" - }, - { - "label": "configuratorParams", - "offset": 0, - "slot": "1", - "type": "t_mapping(t_address,t_struct(Configuration)5434_storage)", - "contract": "ConfiguratorStorage", - "src": "contracts/ytLending/ConfiguratorStorage.sol:15" - } - ], - "types": { - "t_address": { - "label": "address", - "numberOfBytes": "20" - }, - "t_bool": { - "label": "bool", - "numberOfBytes": "1" - }, - "t_struct(InitializableStorage)73_storage": { - "label": "struct Initializable.InitializableStorage", - "members": [ - { - "label": "_initialized", - "type": "t_uint64", - "offset": 0, - "slot": "0" - }, - { - "label": "_initializing", - "type": "t_bool", - "offset": 8, - "slot": "0" - } - ], - "numberOfBytes": "32" - }, - "t_struct(OwnableStorage)13_storage": { - "label": "struct OwnableUpgradeable.OwnableStorage", - "members": [ - { - "label": "_owner", - "type": "t_address", - "offset": 0, - "slot": "0" - } - ], - "numberOfBytes": "32" - }, - "t_uint64": { - "label": "uint64", - "numberOfBytes": "8" - }, - "t_array(t_struct(AssetConfig)5401_storage)dyn_storage": { - "label": "struct LendingConfiguration.AssetConfig[]", - "numberOfBytes": "32" - }, - "t_mapping(t_address,t_address)": { - "label": "mapping(address => address)", - "numberOfBytes": "32" - }, - "t_mapping(t_address,t_struct(Configuration)5434_storage)": { - "label": "mapping(address => struct LendingConfiguration.Configuration)", - "numberOfBytes": "32" - }, - "t_struct(AssetConfig)5401_storage": { - "label": "struct LendingConfiguration.AssetConfig", - "members": [ - { - "label": "asset", - "type": "t_address", - "offset": 0, - "slot": "0" - }, - { - "label": "priceFeed", - "type": "t_address", - "offset": 0, - "slot": "1" - }, - { - "label": "decimals", - "type": "t_uint8", - "offset": 20, - "slot": "1" - }, - { - "label": "borrowCollateralFactor", - "type": "t_uint64", - "offset": 21, - "slot": "1" - }, - { - "label": "liquidateCollateralFactor", - "type": "t_uint64", - "offset": 0, - "slot": "2" - }, - { - "label": "liquidationFactor", - "type": "t_uint64", - "offset": 8, - "slot": "2" - }, - { - "label": "supplyCap", - "type": "t_uint128", - "offset": 16, - "slot": "2" - } - ], - "numberOfBytes": "96" - }, - "t_struct(Configuration)5434_storage": { - "label": "struct LendingConfiguration.Configuration", - "members": [ - { - "label": "baseToken", - "type": "t_address", - "offset": 0, - "slot": "0" - }, - { - "label": "baseTokenPriceFeed", - "type": "t_address", - "offset": 0, - "slot": "1" - }, - { - "label": "supplyKink", - "type": "t_uint64", - "offset": 20, - "slot": "1" - }, - { - "label": "supplyPerYearInterestRateSlopeLow", - "type": "t_uint64", - "offset": 0, - "slot": "2" - }, - { - "label": "supplyPerYearInterestRateSlopeHigh", - "type": "t_uint64", - "offset": 8, - "slot": "2" - }, - { - "label": "supplyPerYearInterestRateBase", - "type": "t_uint64", - "offset": 16, - "slot": "2" - }, - { - "label": "borrowKink", - "type": "t_uint64", - "offset": 24, - "slot": "2" - }, - { - "label": "borrowPerYearInterestRateSlopeLow", - "type": "t_uint64", - "offset": 0, - "slot": "3" - }, - { - "label": "borrowPerYearInterestRateSlopeHigh", - "type": "t_uint64", - "offset": 8, - "slot": "3" - }, - { - "label": "borrowPerYearInterestRateBase", - "type": "t_uint64", - "offset": 16, - "slot": "3" - }, - { - "label": "storeFrontPriceFactor", - "type": "t_uint64", - "offset": 24, - "slot": "3" - }, - { - "label": "trackingIndexScale", - "type": "t_uint64", - "offset": 0, - "slot": "4" - }, - { - "label": "baseBorrowMin", - "type": "t_uint104", - "offset": 8, - "slot": "4" - }, - { - "label": "targetReserves", - "type": "t_uint104", - "offset": 0, - "slot": "5" - }, - { - "label": "assetConfigs", - "type": "t_array(t_struct(AssetConfig)5401_storage)dyn_storage", - "offset": 0, - "slot": "6" - } - ], - "numberOfBytes": "224" - }, - "t_uint104": { - "label": "uint104", - "numberOfBytes": "13" - }, - "t_uint128": { - "label": "uint128", - "numberOfBytes": "16" - }, - "t_uint8": { - "label": "uint8", - "numberOfBytes": "1" - } - }, - "namespaces": { - "erc7201:openzeppelin.storage.Ownable": [ - { - "contract": "OwnableUpgradeable", - "label": "_owner", - "type": "t_address", - "src": "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol:24", - "offset": 0, - "slot": "0" - } - ], - "erc7201:openzeppelin.storage.Initializable": [ - { - "contract": "Initializable", - "label": "_initialized", - "type": "t_uint64", - "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:69", - "offset": 0, - "slot": "0" - }, - { - "contract": "Initializable", - "label": "_initializing", - "type": "t_bool", - "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:73", - "offset": 8, - "slot": "0" - } - ] - } - } - }, - "6b202cc33fae20652e97fb9c193b89bcf63d24b3d9c81a0dc6ae547bc6b68239": { - "address": "0xa4FE1e07b99035E4471c13fb30ee9c045b3D6899", - "txHash": "0x4818e0d236efece7b8a5fbacd2391755272a20a660091ffc603da397daa9aa25", - "layout": { - "solcVersion": "0.8.28", - "storage": [ - { - "label": "baseToken", - "offset": 0, - "slot": "0", - "type": "t_address", - "contract": "LendingStorage", - "src": "contracts/ytLending/LendingStorage.sol:14" - }, - { - "label": "baseTokenPriceFeed", - "offset": 0, - "slot": "1", - "type": "t_address", - "contract": "LendingStorage", - "src": "contracts/ytLending/LendingStorage.sol:14" - }, - { - "label": "supplyKink", - "offset": 20, - "slot": "1", - "type": "t_uint64", - "contract": "LendingStorage", - "src": "contracts/ytLending/LendingStorage.sol:18" - }, - { - "label": "supplyPerSecondInterestRateSlopeLow", - "offset": 0, - "slot": "2", - "type": "t_uint64", - "contract": "LendingStorage", - "src": "contracts/ytLending/LendingStorage.sol:19" - }, - { - "label": "supplyPerSecondInterestRateSlopeHigh", - "offset": 8, - "slot": "2", - "type": "t_uint64", - "contract": "LendingStorage", - "src": "contracts/ytLending/LendingStorage.sol:20" - }, - { - "label": "supplyPerSecondInterestRateBase", - "offset": 16, - "slot": "2", - "type": "t_uint64", - "contract": "LendingStorage", - "src": "contracts/ytLending/LendingStorage.sol:22" - }, - { - "label": "borrowKink", - "offset": 24, - "slot": "2", - "type": "t_uint64", - "contract": "LendingStorage", - "src": "contracts/ytLending/LendingStorage.sol:23" - }, - { - "label": "borrowPerSecondInterestRateSlopeLow", - "offset": 0, - "slot": "3", - "type": "t_uint64", - "contract": "LendingStorage", - "src": "contracts/ytLending/LendingStorage.sol:24" - }, - { - "label": "borrowPerSecondInterestRateSlopeHigh", - "offset": 8, - "slot": "3", - "type": "t_uint64", - "contract": "LendingStorage", - "src": "contracts/ytLending/LendingStorage.sol:25" - }, - { - "label": "borrowPerSecondInterestRateBase", - "offset": 16, - "slot": "3", - "type": "t_uint64", - "contract": "LendingStorage", - "src": "contracts/ytLending/LendingStorage.sol:28" - }, - { - "label": "storeFrontPriceFactor", - "offset": 24, - "slot": "3", - "type": "t_uint64", - "contract": "LendingStorage", - "src": "contracts/ytLending/LendingStorage.sol:29" - }, - { - "label": "trackingIndexScale", - "offset": 0, - "slot": "4", - "type": "t_uint64", - "contract": "LendingStorage", - "src": "contracts/ytLending/LendingStorage.sol:31" - }, - { - "label": "baseBorrowMin", - "offset": 8, - "slot": "4", - "type": "t_uint104", - "contract": "LendingStorage", - "src": "contracts/ytLending/LendingStorage.sol:33" - }, - { - "label": "targetReserves", - "offset": 0, - "slot": "5", - "type": "t_uint104", - "contract": "LendingStorage", - "src": "contracts/ytLending/LendingStorage.sol:34" - }, - { - "label": "assetConfigs", - "offset": 0, - "slot": "6", - "type": "t_mapping(t_address,t_struct(AssetConfig)5401_storage)", - "contract": "LendingStorage", - "src": "contracts/ytLending/LendingStorage.sol:35" - }, - { - "label": "assetList", - "offset": 0, - "slot": "7", - "type": "t_array(t_address)dyn_storage", - "contract": "LendingStorage", - "src": "contracts/ytLending/LendingStorage.sol:39" - }, - { - "label": "userBasic", - "offset": 0, - "slot": "8", - "type": "t_mapping(t_address,t_struct(UserBasic)5931_storage)", - "contract": "LendingStorage", - "src": "contracts/ytLending/LendingStorage.sol:44" - }, - { - "label": "userCollateral", - "offset": 0, - "slot": "9", - "type": "t_mapping(t_address,t_mapping(t_address,t_uint256))", - "contract": "LendingStorage", - "src": "contracts/ytLending/LendingStorage.sol:48" - }, - { - "label": "totalSupplyBase", - "offset": 0, - "slot": "10", - "type": "t_uint104", - "contract": "LendingStorage", - "src": "contracts/ytLending/LendingStorage.sol:53" - }, - { - "label": "totalBorrowBase", - "offset": 13, - "slot": "10", - "type": "t_uint104", - "contract": "LendingStorage", - "src": "contracts/ytLending/LendingStorage.sol:55" - }, - { - "label": "supplyIndex", - "offset": 0, - "slot": "11", - "type": "t_uint256", - "contract": "LendingStorage", - "src": "contracts/ytLending/LendingStorage.sol:56" - }, - { - "label": "borrowIndex", - "offset": 0, - "slot": "12", - "type": "t_uint256", - "contract": "LendingStorage", - "src": "contracts/ytLending/LendingStorage.sol:57" - }, - { - "label": "lastAccrualTime", - "offset": 0, - "slot": "13", - "type": "t_uint256", - "contract": "LendingStorage", - "src": "contracts/ytLending/LendingStorage.sol:57" - }, - { - "label": "collateralReserves", - "offset": 0, - "slot": "14", - "type": "t_mapping(t_address,t_uint256)", - "contract": "LendingStorage", - "src": "contracts/ytLending/LendingStorage.sol:60" - } - ], - "types": { - "t_address": { - "label": "address", - "numberOfBytes": "20" - }, - "t_bool": { - "label": "bool", - "numberOfBytes": "1" - }, - "t_struct(InitializableStorage)73_storage": { - "label": "struct Initializable.InitializableStorage", - "members": [ - { - "label": "_initialized", - "type": "t_uint64", - "offset": 0, - "slot": "0" - }, - { - "label": "_initializing", - "type": "t_bool", - "offset": 8, - "slot": "0" - } - ], - "numberOfBytes": "32" - }, - "t_struct(OwnableStorage)13_storage": { - "label": "struct OwnableUpgradeable.OwnableStorage", - "members": [ - { - "label": "_owner", - "type": "t_address", - "offset": 0, - "slot": "0" - } - ], - "numberOfBytes": "32" - }, - "t_struct(PausableStorage)224_storage": { - "label": "struct PausableUpgradeable.PausableStorage", - "members": [ - { - "label": "_paused", - "type": "t_bool", - "offset": 0, - "slot": "0" - } - ], - "numberOfBytes": "32" - }, - "t_struct(ReentrancyGuardStorage)288_storage": { - "label": "struct ReentrancyGuardUpgradeable.ReentrancyGuardStorage", - "members": [ - { - "label": "_status", - "type": "t_uint256", - "offset": 0, - "slot": "0" - } - ], - "numberOfBytes": "32" - }, - "t_uint256": { - "label": "uint256", - "numberOfBytes": "32" - }, - "t_uint64": { - "label": "uint64", - "numberOfBytes": "8" - }, - "t_array(t_address)dyn_storage": { - "label": "address[]", - "numberOfBytes": "32" - }, - "t_int104": { - "label": "int104", - "numberOfBytes": "13" - }, - "t_mapping(t_address,t_mapping(t_address,t_uint256))": { - "label": "mapping(address => mapping(address => uint256))", - "numberOfBytes": "32" - }, - "t_mapping(t_address,t_struct(AssetConfig)5401_storage)": { - "label": "mapping(address => struct LendingConfiguration.AssetConfig)", - "numberOfBytes": "32" - }, - "t_mapping(t_address,t_struct(UserBasic)5931_storage)": { - "label": "mapping(address => struct LendingStorage.UserBasic)", - "numberOfBytes": "32" - }, - "t_mapping(t_address,t_uint256)": { - "label": "mapping(address => uint256)", - "numberOfBytes": "32" - }, - "t_struct(AssetConfig)5401_storage": { - "label": "struct LendingConfiguration.AssetConfig", - "members": [ - { - "label": "asset", - "type": "t_address", - "offset": 0, - "slot": "0" - }, - { - "label": "priceFeed", - "type": "t_address", - "offset": 0, - "slot": "1" - }, - { - "label": "decimals", - "type": "t_uint8", - "offset": 20, - "slot": "1" - }, - { - "label": "borrowCollateralFactor", - "type": "t_uint64", - "offset": 21, - "slot": "1" - }, - { - "label": "liquidateCollateralFactor", - "type": "t_uint64", - "offset": 0, - "slot": "2" - }, - { - "label": "liquidationFactor", - "type": "t_uint64", - "offset": 8, - "slot": "2" - }, - { - "label": "supplyCap", - "type": "t_uint128", - "offset": 16, - "slot": "2" - } - ], - "numberOfBytes": "96" - }, - "t_struct(UserBasic)5931_storage": { - "label": "struct LendingStorage.UserBasic", - "members": [ - { - "label": "principal", - "type": "t_int104", - "offset": 0, - "slot": "0" - } - ], - "numberOfBytes": "32" - }, - "t_uint104": { - "label": "uint104", - "numberOfBytes": "13" - }, - "t_uint128": { - "label": "uint128", - "numberOfBytes": "16" - }, - "t_uint8": { - "label": "uint8", - "numberOfBytes": "1" - } - }, - "namespaces": { - "erc7201:openzeppelin.storage.ReentrancyGuard": [ - { - "contract": "ReentrancyGuardUpgradeable", - "label": "_status", - "type": "t_uint256", - "src": "@openzeppelin/contracts-upgradeable/utils/ReentrancyGuardUpgradeable.sol:43", - "offset": 0, - "slot": "0" - } - ], - "erc7201:openzeppelin.storage.Pausable": [ - { - "contract": "PausableUpgradeable", - "label": "_paused", - "type": "t_bool", - "src": "@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable.sol:21", - "offset": 0, - "slot": "0" - } - ], - "erc7201:openzeppelin.storage.Ownable": [ - { - "contract": "OwnableUpgradeable", - "label": "_owner", - "type": "t_address", - "src": "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol:24", - "offset": 0, - "slot": "0" - } - ], - "erc7201:openzeppelin.storage.Initializable": [ - { - "contract": "Initializable", - "label": "_initialized", - "type": "t_uint64", - "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:69", - "offset": 0, - "slot": "0" - }, - { - "contract": "Initializable", - "label": "_initializing", - "type": "t_bool", - "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:73", - "offset": 8, - "slot": "0" - } - ] - } - } - }, "793e9f7d5e612ca243a1ea11bb5c7f2889b084fb1b51582f2f0888ce7ecc2bd3": { - "address": "0x88b8E9aE3789A2c06C5df536C71e691cD6780a65", - "txHash": "0x7577ca90677ed0b3e7fdb32b0ca0a1eec2f6c19a103c5e5454dbdfc2b9b632b3", + "address": "0xb14d186d4EAcE8131a449126c6208165a3F5FC5b", + "txHash": "0xfc058308f2e59eda8d7c298807badd96e31b5e82856b6a6d3a7e44d9edc9df98", "layout": { "solcVersion": "0.8.28", "storage": [ @@ -961,8 +255,8 @@ } }, "00eb5352f258b6c4c0dda668c2483a3974b576fd954baeba892be62c7a3f1f11": { - "address": "0xE071419995aE63079af74E7f8eB1643B6F6fb2d7", - "txHash": "0x506efb16370d40664ddbb105acd2b7197c51a95f74e8a44989f9e1b4cf192f02", + "address": "0x0C3fa01b2D0596B4190edEF1B77534237231C77e", + "txHash": "0xf8d4cfe642c81b1e11314390a3f0bd32536900cf58b04efe1f3ec1e8388e3176", "layout": { "solcVersion": "0.8.28", "storage": [ @@ -1162,8 +456,8 @@ } }, "9c8e6194388b1d19133e319b43fc8de8a611fb965a68400c283372bd71a45880": { - "address": "0x7088891AeAA1d6795bA49C1871199EbAc3892599", - "txHash": "0x0ec941ec38bbb17315daf1a4e0a8c3ac16741094d1a03b445cca6e5a08e6ee0c", + "address": "0x2201c2B382E1decD933fc8d3503bEcE221B6C46c", + "txHash": "0xdc97aafa04e1bdd5db04175f40e988a8a5f43cf698a0435fa28361a445512d39", "layout": { "solcVersion": "0.8.28", "storage": [ @@ -1307,8 +601,8 @@ } }, "dd936fa1bfbd00e2da0bc221fd431d41d474331996c8544cd34f05a9bbdcd446": { - "address": "0xaF332cd890A394501E191Aa683Fe6aF4227C2623", - "txHash": "0xcdae39e3d82ee947b35aeaa89af757c562e8188e8b9fd6fdc50d738e2995d0d5", + "address": "0x61278a2EBFC07eF0F7f84407291aAD07DA596AB2", + "txHash": "0x8785ae6dc252d43c8f61c22bc856626138b44d286f291de251a273bc0a0aee3b", "layout": { "solcVersion": "0.8.28", "storage": [ @@ -1609,9 +903,9 @@ } } }, - "a3fd3af2e788d38049c5cce117dee132378dbc4082946b860e430d5ad84a501a": { - "address": "0x0D4625A5d3b696684ECf00b49F1B68297A8b3154", - "txHash": "0xf31548673801689dcd682fec843076859a51c079f69d025100f64a97cb1264cb", + "c3884641d5578675e9c669bf4f2c06232fb7da3a2b21b42a792558de383d300e": { + "address": "0x96Fe19188c3c7d0EDA441dafC7976fBB3526d28c", + "txHash": "0xb8f47c5c526c6187afb36dac0c57d08c135942bac2498361741605a3703a6784", "layout": { "solcVersion": "0.8.28", "storage": [ @@ -1788,9 +1082,9 @@ } } }, - "80132ee3ebf65f0a4ca610bae007bc960e9dd3650abc431efb006d4b031d73c3": { - "address": "0xa77E96720924c7CBc70D4B0E3842a962f94931dc", - "txHash": "0xee01e93141036efe5c5155d38fd17066aa7bcd9f70e340ea5d9a26f3044814f2", + "795e825451428b49de56ed54e2559f0164cac37dad0e30b8e15cfda744e0ebf2": { + "address": "0x3688CDd7A25613E7b1E7E0ee1aA46c21F66D27F3", + "txHash": "0xb4a8ea400c3665653d9b48f066a13df8110fe3acaced4d8fd5cfe17442a43aad", "layout": { "solcVersion": "0.8.28", "storage": [ @@ -1949,9 +1243,9 @@ } } }, - "6122b818fb73c72e0e1c30810ed8e540f09a7bbea21900e801041ad09c4730b2": { - "address": "0xcD175992dE5EfF46673dBaAb12979bc4fcC0f0f6", - "txHash": "0x30e5d0a32b41ccad28502a042575c0908a82dc14d9a002491dc6ac66a6948fb0", + "590476e1f3e027b642103f73085ba73ecf9db4a7e570b79bf1ea9d199100e29a": { + "address": "0xc22a07Cf4bbDc323bC3288a82E85d1367a470b75", + "txHash": "0x1e2237b2bbc89d9ea1addad40ae7f4a464bce0db7abc66804eda0b9d21cac8eb", "layout": { "solcVersion": "0.8.28", "storage": [ @@ -2089,8 +1383,8 @@ } }, "1c57a61daa38362f8650a87d125022acfc042841e807681a3ff096fcc0f087f1": { - "address": "0xa51409ad5B8Fa77aB7ab8221a5bD76fdF7077E08", - "txHash": "0xee1f2b05219ea5f953968b70c4b650cd80822f9ee7637631bd2f9f81acfb3f70", + "address": "0xff09A4EBC7F871b8B2CdCfE4c94e30E46DE559d5", + "txHash": "0x14c51e8cb05e38b39060140256e51c09ce07df0a086e56704886c3b3e6971b6f", "layout": { "solcVersion": "0.8.28", "storage": [ @@ -2191,9 +1485,9 @@ } } }, - "9b19ccc45a7019267570af10b3a1c7eec6cbf8cf5eaea36559198953d9fbb4df": { - "address": "0xB6c6A171C63Bd15B42f28C3207eb697F3c4d4606", - "txHash": "0xa78e922e78008ce7ab03fdfdf9eba07411dd5f53fd99fce6766744660323f5e9", + "9a874c5ae80404ee71254240a9dd296c76e6cc0ebf4a68273e9341e65769ce06": { + "address": "0xF553843cb7F35378Fd4020d2DFceb90BfD760552", + "txHash": "0x2f6d9419faf0e67c24e03550851416b64d0a37809c184be41248b0c1af1d05fc", "layout": { "solcVersion": "0.8.28", "storage": [ @@ -2209,7 +1503,7 @@ "label": "configuratorParams", "offset": 0, "slot": "1", - "type": "t_mapping(t_address,t_struct(Configuration)5720_storage)", + "type": "t_mapping(t_address,t_struct(Configuration)5629_storage)", "contract": "ConfiguratorStorage", "src": "contracts/ytLending/ConfiguratorStorage.sol:15" }, @@ -2219,7 +1513,7 @@ "slot": "2", "type": "t_array(t_uint256)50_storage", "contract": "Configurator", - "src": "contracts/ytLending/Configurator.sol:211" + "src": "contracts/ytLending/Configurator.sol:209" } ], "types": { @@ -2231,7 +1525,7 @@ "label": "bool", "numberOfBytes": "1" }, - "t_struct(InitializableStorage)119_storage": { + "t_struct(InitializableStorage)73_storage": { "label": "struct Initializable.InitializableStorage", "members": [ { @@ -2249,7 +1543,7 @@ ], "numberOfBytes": "32" }, - "t_struct(OwnableStorage)59_storage": { + "t_struct(OwnableStorage)13_storage": { "label": "struct OwnableUpgradeable.OwnableStorage", "members": [ { @@ -2265,7 +1559,7 @@ "label": "uint64", "numberOfBytes": "8" }, - "t_array(t_struct(AssetConfig)5687_storage)dyn_storage": { + "t_array(t_struct(AssetConfig)5598_storage)dyn_storage": { "label": "struct LendingConfiguration.AssetConfig[]", "numberOfBytes": "32" }, @@ -2277,11 +1571,11 @@ "label": "mapping(address => address)", "numberOfBytes": "32" }, - "t_mapping(t_address,t_struct(Configuration)5720_storage)": { + "t_mapping(t_address,t_struct(Configuration)5629_storage)": { "label": "mapping(address => struct LendingConfiguration.Configuration)", "numberOfBytes": "32" }, - "t_struct(AssetConfig)5687_storage": { + "t_struct(AssetConfig)5598_storage": { "label": "struct LendingConfiguration.AssetConfig", "members": [ { @@ -2323,7 +1617,7 @@ ], "numberOfBytes": "64" }, - "t_struct(Configuration)5720_storage": { + "t_struct(Configuration)5629_storage": { "label": "struct LendingConfiguration.Configuration", "members": [ { @@ -2392,32 +1686,26 @@ "offset": 24, "slot": "3" }, - { - "label": "trackingIndexScale", - "type": "t_uint64", - "offset": 0, - "slot": "4" - }, { "label": "baseBorrowMin", "type": "t_uint104", - "offset": 8, + "offset": 0, "slot": "4" }, { "label": "targetReserves", "type": "t_uint104", - "offset": 0, - "slot": "5" + "offset": 13, + "slot": "4" }, { "label": "assetConfigs", - "type": "t_array(t_struct(AssetConfig)5687_storage)dyn_storage", + "type": "t_array(t_struct(AssetConfig)5598_storage)dyn_storage", "offset": 0, - "slot": "6" + "slot": "5" } ], - "numberOfBytes": "224" + "numberOfBytes": "192" }, "t_uint104": { "label": "uint104", @@ -2468,9 +1756,9 @@ } } }, - "75f45941512afb9c219db09e2571576c528a5f4b3faa5a64a64d1a988c7ebf8e": { - "address": "0x5beA465c4F8882a09F3F1f258464988b9BbfCDBd", - "txHash": "0xebf1a659f8107a79649ca49267ce1211c1a9b7363328b5b58060c2e1373aead9", + "e33b371d8c32236d57742d3258255b08748886b1549c607309a2afdd13723715": { + "address": "0x5336FE1bC5c7c1dE35CB053f2f649EA9D4dA3E5F", + "txHash": "0x212e27289d8542a68e0e052dedadfa3dcba1079177451b8fc902c2b4dc44f587", "layout": { "solcVersion": "0.8.28", "storage": [ @@ -2560,82 +1848,82 @@ "slot": "3", "type": "t_uint64", "contract": "LendingStorage", - "src": "contracts/ytLending/LendingStorage.sol:29" - }, - { - "label": "trackingIndexScale", - "offset": 0, - "slot": "4", - "type": "t_uint64", - "contract": "LendingStorage", - "src": "contracts/ytLending/LendingStorage.sol:31" + "src": "contracts/ytLending/LendingStorage.sol:30" }, { "label": "baseBorrowMin", - "offset": 8, + "offset": 0, + "slot": "4", + "type": "t_uint104", + "contract": "LendingStorage", + "src": "contracts/ytLending/LendingStorage.sol:32" + }, + { + "label": "targetReserves", + "offset": 13, "slot": "4", "type": "t_uint104", "contract": "LendingStorage", "src": "contracts/ytLending/LendingStorage.sol:33" }, { - "label": "targetReserves", + "label": "assetConfigs", "offset": 0, "slot": "5", - "type": "t_uint104", + "type": "t_mapping(t_address,t_struct(AssetConfig)5598_storage)", "contract": "LendingStorage", "src": "contracts/ytLending/LendingStorage.sol:34" }, - { - "label": "assetConfigs", - "offset": 0, - "slot": "6", - "type": "t_mapping(t_address,t_struct(AssetConfig)5687_storage)", - "contract": "LendingStorage", - "src": "contracts/ytLending/LendingStorage.sol:35" - }, { "label": "assetList", "offset": 0, - "slot": "7", + "slot": "6", "type": "t_array(t_address)dyn_storage", "contract": "LendingStorage", - "src": "contracts/ytLending/LendingStorage.sol:39" + "src": "contracts/ytLending/LendingStorage.sol:38" }, { "label": "userBasic", "offset": 0, - "slot": "8", - "type": "t_mapping(t_address,t_struct(UserBasic)6372_storage)", + "slot": "7", + "type": "t_mapping(t_address,t_struct(UserBasic)6121_storage)", "contract": "LendingStorage", - "src": "contracts/ytLending/LendingStorage.sol:44" + "src": "contracts/ytLending/LendingStorage.sol:43" }, { "label": "userCollateral", "offset": 0, - "slot": "9", + "slot": "8", "type": "t_mapping(t_address,t_mapping(t_address,t_uint256))", "contract": "LendingStorage", - "src": "contracts/ytLending/LendingStorage.sol:48" + "src": "contracts/ytLending/LendingStorage.sol:47" }, { "label": "totalSupplyBase", "offset": 0, - "slot": "10", + "slot": "9", "type": "t_uint104", "contract": "LendingStorage", - "src": "contracts/ytLending/LendingStorage.sol:53" + "src": "contracts/ytLending/LendingStorage.sol:52" }, { "label": "totalBorrowBase", "offset": 13, - "slot": "10", + "slot": "9", "type": "t_uint104", "contract": "LendingStorage", + "src": "contracts/ytLending/LendingStorage.sol:54" + }, + { + "label": "supplyIndex", + "offset": 0, + "slot": "10", + "type": "t_uint256", + "contract": "LendingStorage", "src": "contracts/ytLending/LendingStorage.sol:55" }, { - "label": "supplyIndex", + "label": "borrowIndex", "offset": 0, "slot": "11", "type": "t_uint256", @@ -2643,36 +1931,28 @@ "src": "contracts/ytLending/LendingStorage.sol:56" }, { - "label": "borrowIndex", + "label": "lastAccrualTime", "offset": 0, "slot": "12", "type": "t_uint256", "contract": "LendingStorage", - "src": "contracts/ytLending/LendingStorage.sol:57" - }, - { - "label": "lastAccrualTime", - "offset": 0, - "slot": "13", - "type": "t_uint256", - "contract": "LendingStorage", - "src": "contracts/ytLending/LendingStorage.sol:57" + "src": "contracts/ytLending/LendingStorage.sol:56" }, { "label": "collateralReserves", "offset": 0, - "slot": "14", + "slot": "13", "type": "t_mapping(t_address,t_uint256)", "contract": "LendingStorage", - "src": "contracts/ytLending/LendingStorage.sol:60" + "src": "contracts/ytLending/LendingStorage.sol:59" }, { "label": "__gap", "offset": 0, - "slot": "15", + "slot": "14", "type": "t_array(t_uint256)50_storage", "contract": "Lending", - "src": "contracts/ytLending/Lending.sol:684" + "src": "contracts/ytLending/Lending.sol:681" } ], "types": { @@ -2684,7 +1964,7 @@ "label": "bool", "numberOfBytes": "1" }, - "t_struct(InitializableStorage)119_storage": { + "t_struct(InitializableStorage)73_storage": { "label": "struct Initializable.InitializableStorage", "members": [ { @@ -2702,7 +1982,7 @@ ], "numberOfBytes": "32" }, - "t_struct(OwnableStorage)59_storage": { + "t_struct(OwnableStorage)13_storage": { "label": "struct OwnableUpgradeable.OwnableStorage", "members": [ { @@ -2714,7 +1994,7 @@ ], "numberOfBytes": "32" }, - "t_struct(PausableStorage)270_storage": { + "t_struct(PausableStorage)224_storage": { "label": "struct PausableUpgradeable.PausableStorage", "members": [ { @@ -2726,7 +2006,7 @@ ], "numberOfBytes": "32" }, - "t_struct(ReentrancyGuardStorage)334_storage": { + "t_struct(ReentrancyGuardStorage)288_storage": { "label": "struct ReentrancyGuardUpgradeable.ReentrancyGuardStorage", "members": [ { @@ -2762,11 +2042,11 @@ "label": "mapping(address => mapping(address => uint256))", "numberOfBytes": "32" }, - "t_mapping(t_address,t_struct(AssetConfig)5687_storage)": { + "t_mapping(t_address,t_struct(AssetConfig)5598_storage)": { "label": "mapping(address => struct LendingConfiguration.AssetConfig)", "numberOfBytes": "32" }, - "t_mapping(t_address,t_struct(UserBasic)6372_storage)": { + "t_mapping(t_address,t_struct(UserBasic)6121_storage)": { "label": "mapping(address => struct LendingStorage.UserBasic)", "numberOfBytes": "32" }, @@ -2774,7 +2054,7 @@ "label": "mapping(address => uint256)", "numberOfBytes": "32" }, - "t_struct(AssetConfig)5687_storage": { + "t_struct(AssetConfig)5598_storage": { "label": "struct LendingConfiguration.AssetConfig", "members": [ { @@ -2816,7 +2096,7 @@ ], "numberOfBytes": "64" }, - "t_struct(UserBasic)6372_storage": { + "t_struct(UserBasic)6121_storage": { "label": "struct LendingStorage.UserBasic", "members": [ { @@ -2893,35 +2173,203 @@ } } }, - "9a874c5ae80404ee71254240a9dd296c76e6cc0ebf4a68273e9341e65769ce06": { - "address": "0x2a6975bC619EDC8399B9Cef9ba9554673e56208a", - "txHash": "0xe599b99466f8eb446a9dab93cffd5bfcf366c297fce83dedaafa24d024b8f6d1", + "1bb5768835faba7e8b2f3c313803b45e9d5164ced122d269a03955f55901fb91": { + "address": "0x67aA0230Bb42c5DEAE2f536EC22884c518Cab20C", + "txHash": "0x651822c07d55e17df9020f62a3355668f5c4ef6ad7899c7d9f38590c043c396f", "layout": { "solcVersion": "0.8.28", "storage": [ { - "label": "factory", + "label": "baseToken", "offset": 0, "slot": "0", - "type": "t_mapping(t_address,t_address)", - "contract": "ConfiguratorStorage", - "src": "contracts/ytLending/ConfiguratorStorage.sol:12" + "type": "t_address", + "contract": "LendingStorage", + "src": "contracts/ytLending/LendingStorage.sol:14" }, { - "label": "configuratorParams", + "label": "lendingPriceSource", "offset": 0, "slot": "1", - "type": "t_mapping(t_address,t_struct(Configuration)6548_storage)", - "contract": "ConfiguratorStorage", - "src": "contracts/ytLending/ConfiguratorStorage.sol:15" + "type": "t_address", + "contract": "LendingStorage", + "src": "contracts/ytLending/LendingStorage.sol:14" + }, + { + "label": "supplyKink", + "offset": 20, + "slot": "1", + "type": "t_uint64", + "contract": "LendingStorage", + "src": "contracts/ytLending/LendingStorage.sol:18" + }, + { + "label": "supplyPerSecondInterestRateSlopeLow", + "offset": 0, + "slot": "2", + "type": "t_uint64", + "contract": "LendingStorage", + "src": "contracts/ytLending/LendingStorage.sol:19" + }, + { + "label": "supplyPerSecondInterestRateSlopeHigh", + "offset": 8, + "slot": "2", + "type": "t_uint64", + "contract": "LendingStorage", + "src": "contracts/ytLending/LendingStorage.sol:20" + }, + { + "label": "supplyPerSecondInterestRateBase", + "offset": 16, + "slot": "2", + "type": "t_uint64", + "contract": "LendingStorage", + "src": "contracts/ytLending/LendingStorage.sol:22" + }, + { + "label": "borrowKink", + "offset": 24, + "slot": "2", + "type": "t_uint64", + "contract": "LendingStorage", + "src": "contracts/ytLending/LendingStorage.sol:23" + }, + { + "label": "borrowPerSecondInterestRateSlopeLow", + "offset": 0, + "slot": "3", + "type": "t_uint64", + "contract": "LendingStorage", + "src": "contracts/ytLending/LendingStorage.sol:24" + }, + { + "label": "borrowPerSecondInterestRateSlopeHigh", + "offset": 8, + "slot": "3", + "type": "t_uint64", + "contract": "LendingStorage", + "src": "contracts/ytLending/LendingStorage.sol:25" + }, + { + "label": "borrowPerSecondInterestRateBase", + "offset": 16, + "slot": "3", + "type": "t_uint64", + "contract": "LendingStorage", + "src": "contracts/ytLending/LendingStorage.sol:28" + }, + { + "label": "storeFrontPriceFactor", + "offset": 24, + "slot": "3", + "type": "t_uint64", + "contract": "LendingStorage", + "src": "contracts/ytLending/LendingStorage.sol:30" + }, + { + "label": "baseBorrowMin", + "offset": 0, + "slot": "4", + "type": "t_uint104", + "contract": "LendingStorage", + "src": "contracts/ytLending/LendingStorage.sol:32" + }, + { + "label": "targetReserves", + "offset": 13, + "slot": "4", + "type": "t_uint104", + "contract": "LendingStorage", + "src": "contracts/ytLending/LendingStorage.sol:33" + }, + { + "label": "assetConfigs", + "offset": 0, + "slot": "5", + "type": "t_mapping(t_address,t_struct(AssetConfig)5618_storage)", + "contract": "LendingStorage", + "src": "contracts/ytLending/LendingStorage.sol:34" + }, + { + "label": "assetList", + "offset": 0, + "slot": "6", + "type": "t_array(t_address)dyn_storage", + "contract": "LendingStorage", + "src": "contracts/ytLending/LendingStorage.sol:38" + }, + { + "label": "userBasic", + "offset": 0, + "slot": "7", + "type": "t_mapping(t_address,t_struct(UserBasic)6141_storage)", + "contract": "LendingStorage", + "src": "contracts/ytLending/LendingStorage.sol:43" + }, + { + "label": "userCollateral", + "offset": 0, + "slot": "8", + "type": "t_mapping(t_address,t_mapping(t_address,t_uint256))", + "contract": "LendingStorage", + "src": "contracts/ytLending/LendingStorage.sol:47" + }, + { + "label": "totalSupplyBase", + "offset": 0, + "slot": "9", + "type": "t_uint104", + "contract": "LendingStorage", + "src": "contracts/ytLending/LendingStorage.sol:52" + }, + { + "label": "totalBorrowBase", + "offset": 13, + "slot": "9", + "type": "t_uint104", + "contract": "LendingStorage", + "src": "contracts/ytLending/LendingStorage.sol:54" + }, + { + "label": "supplyIndex", + "offset": 0, + "slot": "10", + "type": "t_uint256", + "contract": "LendingStorage", + "src": "contracts/ytLending/LendingStorage.sol:55" + }, + { + "label": "borrowIndex", + "offset": 0, + "slot": "11", + "type": "t_uint256", + "contract": "LendingStorage", + "src": "contracts/ytLending/LendingStorage.sol:56" + }, + { + "label": "lastAccrualTime", + "offset": 0, + "slot": "12", + "type": "t_uint256", + "contract": "LendingStorage", + "src": "contracts/ytLending/LendingStorage.sol:56" + }, + { + "label": "collateralReserves", + "offset": 0, + "slot": "13", + "type": "t_mapping(t_address,t_uint256)", + "contract": "LendingStorage", + "src": "contracts/ytLending/LendingStorage.sol:59" }, { "label": "__gap", "offset": 0, - "slot": "2", + "slot": "14", "type": "t_array(t_uint256)50_storage", - "contract": "Configurator", - "src": "contracts/ytLending/Configurator.sol:209" + "contract": "Lending", + "src": "contracts/ytLending/Lending.sol:686" } ], "types": { @@ -2933,7 +2381,7 @@ "label": "bool", "numberOfBytes": "1" }, - "t_struct(InitializableStorage)119_storage": { + "t_struct(InitializableStorage)73_storage": { "label": "struct Initializable.InitializableStorage", "members": [ { @@ -2951,7 +2399,7 @@ ], "numberOfBytes": "32" }, - "t_struct(OwnableStorage)59_storage": { + "t_struct(OwnableStorage)13_storage": { "label": "struct OwnableUpgradeable.OwnableStorage", "members": [ { @@ -2963,27 +2411,67 @@ ], "numberOfBytes": "32" }, + "t_struct(PausableStorage)224_storage": { + "label": "struct PausableUpgradeable.PausableStorage", + "members": [ + { + "label": "_paused", + "type": "t_bool", + "offset": 0, + "slot": "0" + } + ], + "numberOfBytes": "32" + }, + "t_struct(ReentrancyGuardStorage)288_storage": { + "label": "struct ReentrancyGuardUpgradeable.ReentrancyGuardStorage", + "members": [ + { + "label": "_status", + "type": "t_uint256", + "offset": 0, + "slot": "0" + } + ], + "numberOfBytes": "32" + }, + "t_uint256": { + "label": "uint256", + "numberOfBytes": "32" + }, "t_uint64": { "label": "uint64", "numberOfBytes": "8" }, - "t_array(t_struct(AssetConfig)6517_storage)dyn_storage": { - "label": "struct LendingConfiguration.AssetConfig[]", + "t_array(t_address)dyn_storage": { + "label": "address[]", "numberOfBytes": "32" }, "t_array(t_uint256)50_storage": { "label": "uint256[50]", "numberOfBytes": "1600" }, - "t_mapping(t_address,t_address)": { - "label": "mapping(address => address)", + "t_int104": { + "label": "int104", + "numberOfBytes": "13" + }, + "t_mapping(t_address,t_mapping(t_address,t_uint256))": { + "label": "mapping(address => mapping(address => uint256))", "numberOfBytes": "32" }, - "t_mapping(t_address,t_struct(Configuration)6548_storage)": { - "label": "mapping(address => struct LendingConfiguration.Configuration)", + "t_mapping(t_address,t_struct(AssetConfig)5618_storage)": { + "label": "mapping(address => struct LendingConfiguration.AssetConfig)", "numberOfBytes": "32" }, - "t_struct(AssetConfig)6517_storage": { + "t_mapping(t_address,t_struct(UserBasic)6141_storage)": { + "label": "mapping(address => struct LendingStorage.UserBasic)", + "numberOfBytes": "32" + }, + "t_mapping(t_address,t_uint256)": { + "label": "mapping(address => uint256)", + "numberOfBytes": "32" + }, + "t_struct(AssetConfig)5618_storage": { "label": "struct LendingConfiguration.AssetConfig", "members": [ { @@ -3025,95 +2513,17 @@ ], "numberOfBytes": "64" }, - "t_struct(Configuration)6548_storage": { - "label": "struct LendingConfiguration.Configuration", + "t_struct(UserBasic)6141_storage": { + "label": "struct LendingStorage.UserBasic", "members": [ { - "label": "baseToken", - "type": "t_address", + "label": "principal", + "type": "t_int104", "offset": 0, "slot": "0" - }, - { - "label": "lendingPriceSource", - "type": "t_address", - "offset": 0, - "slot": "1" - }, - { - "label": "supplyKink", - "type": "t_uint64", - "offset": 20, - "slot": "1" - }, - { - "label": "supplyPerYearInterestRateSlopeLow", - "type": "t_uint64", - "offset": 0, - "slot": "2" - }, - { - "label": "supplyPerYearInterestRateSlopeHigh", - "type": "t_uint64", - "offset": 8, - "slot": "2" - }, - { - "label": "supplyPerYearInterestRateBase", - "type": "t_uint64", - "offset": 16, - "slot": "2" - }, - { - "label": "borrowKink", - "type": "t_uint64", - "offset": 24, - "slot": "2" - }, - { - "label": "borrowPerYearInterestRateSlopeLow", - "type": "t_uint64", - "offset": 0, - "slot": "3" - }, - { - "label": "borrowPerYearInterestRateSlopeHigh", - "type": "t_uint64", - "offset": 8, - "slot": "3" - }, - { - "label": "borrowPerYearInterestRateBase", - "type": "t_uint64", - "offset": 16, - "slot": "3" - }, - { - "label": "storeFrontPriceFactor", - "type": "t_uint64", - "offset": 24, - "slot": "3" - }, - { - "label": "baseBorrowMin", - "type": "t_uint104", - "offset": 0, - "slot": "4" - }, - { - "label": "targetReserves", - "type": "t_uint104", - "offset": 13, - "slot": "4" - }, - { - "label": "assetConfigs", - "type": "t_array(t_struct(AssetConfig)6517_storage)dyn_storage", - "offset": 0, - "slot": "5" } ], - "numberOfBytes": "192" + "numberOfBytes": "32" }, "t_uint104": { "label": "uint104", @@ -3123,16 +2533,32 @@ "label": "uint128", "numberOfBytes": "16" }, - "t_uint256": { - "label": "uint256", - "numberOfBytes": "32" - }, "t_uint8": { "label": "uint8", "numberOfBytes": "1" } }, "namespaces": { + "erc7201:openzeppelin.storage.ReentrancyGuard": [ + { + "contract": "ReentrancyGuardUpgradeable", + "label": "_status", + "type": "t_uint256", + "src": "@openzeppelin/contracts-upgradeable/utils/ReentrancyGuardUpgradeable.sol:43", + "offset": 0, + "slot": "0" + } + ], + "erc7201:openzeppelin.storage.Pausable": [ + { + "contract": "PausableUpgradeable", + "label": "_paused", + "type": "t_bool", + "src": "@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable.sol:21", + "offset": 0, + "slot": "0" + } + ], "erc7201:openzeppelin.storage.Ownable": [ { "contract": "OwnableUpgradeable", diff --git a/abis/ILending.json b/abis/ILending.json index f77810c..0c8553b 100644 --- a/abis/ILending.json +++ b/abis/ILending.json @@ -209,6 +209,19 @@ "name": "SupplyCollateral", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint104", + "name": "targetReserves", + "type": "uint104" + } + ], + "name": "TargetReservesUpdated", + "type": "event" + }, { "anonymous": false, "inputs": [ diff --git a/abis/Lending.json b/abis/Lending.json index 9577ef1..6e2a355 100644 --- a/abis/Lending.json +++ b/abis/Lending.json @@ -365,6 +365,19 @@ "name": "SupplyCollateral", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint104", + "name": "targetReserves", + "type": "uint104" + } + ], + "name": "TargetReservesUpdated", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -1116,6 +1129,19 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [ + { + "internalType": "uint104", + "name": "newTargetReserves", + "type": "uint104" + } + ], + "name": "setTargetReserves", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [], "name": "storeFrontPriceFactor", diff --git a/contracts/interfaces/ILending.sol b/contracts/interfaces/ILending.sol index d9dfcbc..9fcec23 100644 --- a/contracts/interfaces/ILending.sol +++ b/contracts/interfaces/ILending.sol @@ -14,6 +14,7 @@ interface ILending { event AbsorbCollateral(address indexed absorber, address indexed borrower, address indexed asset, uint256 collateralAbsorbed, uint256 usdValue); event BuyCollateral(address indexed buyer, address indexed asset, uint256 baseAmount, uint256 collateralAmount); event WithdrawReserves(address indexed to, uint256 amount); + event TargetReservesUpdated(uint104 targetReserves); error Unauthorized(); error InsufficientBalance(); diff --git a/contracts/ytLending/Lending.sol b/contracts/ytLending/Lending.sol index ff897ba..893db07 100644 --- a/contracts/ytLending/Lending.sol +++ b/contracts/ytLending/Lending.sol @@ -95,6 +95,11 @@ contract Lending is _unpause(); } + function setTargetReserves(uint104 newTargetReserves) external onlyOwner { + targetReserves = newTargetReserves; + emit TargetReservesUpdated(targetReserves); + } + /** * @notice 计算累计利息后的索引(不修改状态) * @param timeElapsed 经过的时间 diff --git a/deployments-lending.json b/deployments-lending.json index d8b8497..3cb8bdf 100644 --- a/deployments-lending.json +++ b/deployments-lending.json @@ -1,33 +1,44 @@ { - "421614": { - "lendingFactory": "0xB69Dcea8F67d166Ad44650A2281f132689E524f2", - "lendingPriceFeedProxy": "0xE82c7cB9CfA42D6eb7e443956b78f8290249c316", - "lendingPriceFeed": "0xE82c7cB9CfA42D6eb7e443956b78f8290249c316", - "lendingPriceFeedImpl": "0xa51409ad5B8Fa77aB7ab8221a5bD76fdF7077E08", - "configuratorProxy": "0x488409CE9A3Fcd8EbD373dCb7e025cF8AB96fcdc", - "configuratorImpl": "0xB6c6A171C63Bd15B42f28C3207eb697F3c4d4606", - "lendingImpl": "0xdE3ddDBB2fee645EEc14f90cbe6890eBaa249b6e", - "usdcAddress": "0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d", - "usdcPriceFeed": "0x0153002d20B96532C639313c2d54c3dA09109309", - "deployTimestamp": "2025-12-26T04:16:38.113Z", + "97": { + "lendingFactory": "0x41857cc92a74fa5FB776e5D7091dD79faaaA973C", + "lendingPriceFeedProxy": "0x13bD017E5837b5451447508ebd4Fe65A2B1d4f30", + "lendingPriceFeed": "0x13bD017E5837b5451447508ebd4Fe65A2B1d4f30", + "lendingPriceFeedImpl": "0xff09A4EBC7F871b8B2CdCfE4c94e30E46DE559d5", + "configuratorProxy": "0xB9676f3482D332210C5c630Fa265c92171958F92", + "configuratorImpl": "0xF553843cb7F35378Fd4020d2DFceb90BfD760552", + "lendingImpl": "0x5336FE1bC5c7c1dE35CB053f2f649EA9D4dA3E5F", + "usdcAddress": "0x939cf46F7A4d05da2a37213E7379a8b04528F590", + "usdcPriceFeed": "0x90c069C4538adAc136E051052E14c1cD799C41B7", + "deployTimestamp": "2026-01-07T03:58:01.816Z", "deployer": "0xa013422A5918CD099C63c8CC35283EACa99a705d", - "lendingProxy": "0xCb4E7B1069F6C26A1c27523ce4c8dfD884552d1D", + "lendingProxy": "0x1E60013A6eb8966a1b59BC31cE0D07054E591eE7", "collateralAssets": [ { "name": "YT Token A", "symbol": "YT-A", - "address": "0x97204190B35D9895a7a47aa7BaC61ac08De3cF05" + "address": "0x0cA35994F033685E7a57ef9bc5d00dd3cf927330" }, { "name": "YT Token B", "symbol": "YT-B", - "address": "0x181ef4011c35C4a2Fda08eBC5Cf509Ef58E553fF" + "address": "0x333805C9EE75f59Aa2Cc79DfDe2499F920c7b408" }, { "name": "YT Token C", "symbol": "YT-C", - "address": "0xE9A5b9f3a2Eda4358f81d4E2eF4f3280A664e5B0" + "address": "0x6DF0ED6f0345F601A206974973dE9fC970598587" } - ] + ], + "configTimestamp": "2026-01-07T03:58:41.420Z", + "upgradeHistory": [ + { + "timestamp": "2026-01-08T03:26:13.317Z", + "contract": "Lending", + "oldImplementation": "0xe443B92e052e72C39a7833cD723276f8e337144A", + "newImplementation": "0x5336FE1bC5c7c1dE35CB053f2f649EA9D4dA3E5F", + "upgrader": "0xa013422A5918CD099C63c8CC35283EACa99a705d" + } + ], + "lendingUpgradeTimestamp": "2026-01-08T03:26:13.317Z" } } \ No newline at end of file diff --git a/deployments-usdc-config.json b/deployments-usdc-config.json index bc08369..0d77eec 100644 --- a/deployments-usdc-config.json +++ b/deployments-usdc-config.json @@ -1,15 +1,15 @@ { - "network": "arbSepolia", - "chainId": "421614", + "network": "bscTestnet", + "chainId": "97", "deployer": "0xa013422A5918CD099C63c8CC35283EACa99a705d", - "timestamp": "2025-12-24T08:07:32.332Z", + "timestamp": "2026-01-07T03:50:12.838Z", "contracts": { "USDC": { - "address": "0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d", + "address": "0x939cf46F7A4d05da2a37213E7379a8b04528F590", "description": "USDC代币地址(已存在的合约)" }, "ChainlinkUSDCPriceFeed": { - "address": "0x0153002d20B96532C639313c2d54c3dA09109309", + "address": "0x90c069C4538adAc136E051052E14c1cD799C41B7", "description": "Chainlink USDC/USD 价格预言机", "precision": "1e8" } diff --git a/deployments-vault-system.json b/deployments-vault-system.json index 6bb5a96..fba0b09 100644 --- a/deployments-vault-system.json +++ b/deployments-vault-system.json @@ -1,51 +1,51 @@ { - "network": "arbSepolia", - "chainId": "421614", + "network": "bscTestnet", + "chainId": "97", "deployer": "0xa013422A5918CD099C63c8CC35283EACa99a705d", - "timestamp": "2025-12-24T08:11:26.455Z", - "usdcAddress": "0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d", - "usdcPriceFeedAddress": "0x0153002d20B96532C639313c2d54c3dA09109309", + "timestamp": "2026-01-07T03:53:55.098Z", + "usdcAddress": "0x939cf46F7A4d05da2a37213E7379a8b04528F590", + "usdcPriceFeedAddress": "0x90c069C4538adAc136E051052E14c1cD799C41B7", "defaultHardCap": "10000000000000000000000000", "contracts": { "YTAssetVault": { - "implementation": "0x8097a7B04989c4D8B155Fd5DaF396d014808D7F7" + "implementation": "0x6cBD32731742004471ce16FcB80a6db0844E8b13" }, "YTAssetFactory": { - "proxy": "0xb5Ddb2C45874f04aD0d48F3bB6b0748b1D06814C", - "implementation": "0xcD175992dE5EfF46673dBaAb12979bc4fcC0f0f6" + "proxy": "0x6DaB73519DbaFf23F36FEd24110e2ef5Cfc8aAC9", + "implementation": "0xc22a07Cf4bbDc323bC3288a82E85d1367a470b75" } }, "vaults": [ { "name": "YT Token A", "symbol": "YT-A", - "address": "0x97204190B35D9895a7a47aa7BaC61ac08De3cF05", + "address": "0x0cA35994F033685E7a57ef9bc5d00dd3cf927330", "index": "0", "manager": "0xa013422A5918CD099C63c8CC35283EACa99a705d", "hardCap": "10000000000000000000000000", - "redemptionTime": 1798099928, + "redemptionTime": 1799294058, "ytPrice": "1000000000000000000000000000000" }, { "name": "YT Token B", "symbol": "YT-B", - "address": "0x181ef4011c35C4a2Fda08eBC5Cf509Ef58E553fF", + "address": "0x333805C9EE75f59Aa2Cc79DfDe2499F920c7b408", "index": "1", "manager": "0xa013422A5918CD099C63c8CC35283EACa99a705d", "hardCap": "10000000000000000000000000", - "redemptionTime": 1798099928, + "redemptionTime": 1799294058, "ytPrice": "1000000000000000000000000000000" }, { "name": "YT Token C", "symbol": "YT-C", - "address": "0xE9A5b9f3a2Eda4358f81d4E2eF4f3280A664e5B0", + "address": "0x6DF0ED6f0345F601A206974973dE9fC970598587", "index": "2", "manager": "0xa013422A5918CD099C63c8CC35283EACa99a705d", "hardCap": "10000000000000000000000000", - "redemptionTime": 1798099928, + "redemptionTime": 1799294058, "ytPrice": "1000000000000000000000000000000" } ], - "lastUpdate": "2025-12-24T08:12:25.131Z" + "lastUpdate": "2026-01-07T03:54:28.113Z" } \ No newline at end of file diff --git a/deployments-whitelist-config.json b/deployments-whitelist-config.json index 030f67a..e28db9d 100644 --- a/deployments-whitelist-config.json +++ b/deployments-whitelist-config.json @@ -1,12 +1,12 @@ { - "timestamp": "2025-12-24T08:20:12.674Z", + "timestamp": "2026-01-07T03:56:07.469Z", "operator": "0xa013422A5918CD099C63c8CC35283EACa99a705d", "whitelistedTokens": { "ytTokens": [ { "name": "YT Token A", "symbol": "YT-A", - "address": "0x97204190B35D9895a7a47aa7BaC61ac08De3cF05", + "address": "0x0cA35994F033685E7a57ef9bc5d00dd3cf927330", "weight": 4000, "maxUsdyAmount": "45000000000000000000000000", "price": "1000000000000000000000000000000", @@ -15,7 +15,7 @@ { "name": "YT Token B", "symbol": "YT-B", - "address": "0x181ef4011c35C4a2Fda08eBC5Cf509Ef58E553fF", + "address": "0x333805C9EE75f59Aa2Cc79DfDe2499F920c7b408", "weight": 3000, "maxUsdyAmount": "35000000000000000000000000", "price": "1000000000000000000000000000000", @@ -24,7 +24,7 @@ { "name": "YT Token C", "symbol": "YT-C", - "address": "0xE9A5b9f3a2Eda4358f81d4E2eF4f3280A664e5B0", + "address": "0x6DF0ED6f0345F601A206974973dE9fC970598587", "weight": 2000, "maxUsdyAmount": "25000000000000000000000000", "price": "1000000000000000000000000000000", @@ -34,7 +34,7 @@ "usdc": { "name": "USDC", "symbol": "USDC", - "address": "0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d", + "address": "0x939cf46F7A4d05da2a37213E7379a8b04528F590", "weight": 1000, "maxUsdyAmount": "30000000000000", "priceSource": "Chainlink (自动)", diff --git a/deployments-ytlp-config.json b/deployments-ytlp-config.json index 90bf81f..61600a9 100644 --- a/deployments-ytlp-config.json +++ b/deployments-ytlp-config.json @@ -1,23 +1,23 @@ { - "network": "arbSepolia", - "chainId": "421614", + "network": "bscTestnet", + "chainId": "97", "configurer": "0xa013422A5918CD099C63c8CC35283EACa99a705d", - "timestamp": "2025-12-24T08:14:12.730Z", + "timestamp": "2026-01-07T03:55:26.868Z", "configuration": { "permissions": { "usdyVaults": [ - "0xc110C84b107126c4E5b1CE598d3602ec0260D98B", - "0x691Aa0fF71a330454f50452925A3005Ae8412902" + "0x19982e5145ca5401A1084c0BF916c0E0bB343Af9", + "0x14246886a1E1202cb6b5a2db793eF3359d536302" ], "ytlpMinters": [ - "0x691Aa0fF71a330454f50452925A3005Ae8412902" + "0x14246886a1E1202cb6b5a2db793eF3359d536302" ], - "vaultPoolManager": "0x691Aa0fF71a330454f50452925A3005Ae8412902", + "vaultPoolManager": "0x14246886a1E1202cb6b5a2db793eF3359d536302", "vaultSwappers": [ - "0x15dA695F8ad005c2Ccd0AEC57C902c404E510Aab" + "0x51eEF57eC57c867AC23945f0ce21aA5A9a2C246c" ], "poolManagerHandlers": [ - "0x15dA695F8ad005c2Ccd0AEC57C902c404E510Aab" + "0x51eEF57eC57c867AC23945f0ce21aA5A9a2C246c" ], "priceFeedKeepers": [ "0xa013422A5918CD099C63c8CC35283EACa99a705d" diff --git a/deployments-ytlp.json b/deployments-ytlp.json index 6a4b71d..dfeb3f4 100644 --- a/deployments-ytlp.json +++ b/deployments-ytlp.json @@ -1,32 +1,32 @@ { - "network": "arbSepolia", - "chainId": "421614", + "network": "bscTestnet", + "chainId": "97", "deployer": "0xa013422A5918CD099C63c8CC35283EACa99a705d", - "timestamp": "2025-12-24T08:10:20.679Z", + "timestamp": "2026-01-07T03:52:50.659Z", "contracts": { "USDY": { - "proxy": "0x664dF9c24b184f8D2533BfFF1E8cbff939978879", - "implementation": "0x88b8E9aE3789A2c06C5df536C71e691cD6780a65" + "proxy": "0x631Bd6834C50f6d2B07035c9253b4a19132E888c", + "implementation": "0xb14d186d4EAcE8131a449126c6208165a3F5FC5b" }, "YTLPToken": { - "proxy": "0x102e3F25Ef0ad9b0695C8F2daF8A1262437eEfc3", - "implementation": "0xE071419995aE63079af74E7f8eB1643B6F6fb2d7" + "proxy": "0x1b96F219E8aeE557DD8bD905a6c72cc64eA5BD7B", + "implementation": "0x0C3fa01b2D0596B4190edEF1B77534237231C77e" }, "YTPriceFeed": { - "proxy": "0xdC18de7D5A439cb90F149Eb62bAace55557d20AA", - "implementation": "0x7088891AeAA1d6795bA49C1871199EbAc3892599" + "proxy": "0x0f2d930EE73972132E3a36b7eD6F709Af6E5B879", + "implementation": "0x2201c2B382E1decD933fc8d3503bEcE221B6C46c" }, "YTVault": { - "proxy": "0xc110C84b107126c4E5b1CE598d3602ec0260D98B", - "implementation": "0xaF332cd890A394501E191Aa683Fe6aF4227C2623" + "proxy": "0x19982e5145ca5401A1084c0BF916c0E0bB343Af9", + "implementation": "0x61278a2EBFC07eF0F7f84407291aAD07DA596AB2" }, "YTPoolManager": { - "proxy": "0x691Aa0fF71a330454f50452925A3005Ae8412902", - "implementation": "0x0D4625A5d3b696684ECf00b49F1B68297A8b3154" + "proxy": "0x14246886a1E1202cb6b5a2db793eF3359d536302", + "implementation": "0x96Fe19188c3c7d0EDA441dafC7976fBB3526d28c" }, "YTRewardRouter": { - "proxy": "0x15dA695F8ad005c2Ccd0AEC57C902c404E510Aab", - "implementation": "0xa77E96720924c7CBc70D4B0E3842a962f94931dc" + "proxy": "0x51eEF57eC57c867AC23945f0ce21aA5A9a2C246c", + "implementation": "0x3688CDd7A25613E7b1E7E0ee1aA46c21F66D27F3" } } } \ No newline at end of file diff --git a/hardhat.config.ts b/hardhat.config.ts index 965e673..0ef6d73 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -145,6 +145,11 @@ const config: HardhatUserConfig = { accounts: accounts, chainId: 421614, }, + bscTestnet: { + url: "https://api.zan.top/node/v1/bsc/testnet/baf84c429d284bb5b676cb8c9ca21c07", + accounts: accounts, + chainId: 97, + }, }, // gas报告配置 diff --git a/scripts/deploy/01-prepareUSDC.ts b/scripts/deploy/01-prepareUSDC.ts index c62ecbc..c8fa0ee 100644 --- a/scripts/deploy/01-prepareUSDC.ts +++ b/scripts/deploy/01-prepareUSDC.ts @@ -37,6 +37,13 @@ async function main() { usdcPriceFeedAddress = "0x0153002d20B96532C639313c2d54c3dA09109309"; console.log("✅ USDC地址 (Arbitrum):", usdcAddress); console.log("✅ Chainlink USDC/USD (Arbitrum):", usdcPriceFeedAddress); + } else if (chainId === 97n) { + // BNB 测试网 + console.log("\n检测到 BNB 测试网"); + usdcAddress = "0x939cf46F7A4d05da2a37213E7379a8b04528F590"; + usdcPriceFeedAddress = "0x90c069C4538adAc136E051052E14c1cD799C41B7"; + console.log("✅ USDC地址 (BSC Testnet):", usdcAddress); + console.log("✅ Chainlink USDC/USD (BSC Testnet):", usdcPriceFeedAddress); } else { throw new Error(`不支持的网络: ${chainId}`); } diff --git a/scripts/deploy/07-deployLending.ts b/scripts/deploy/07-deployLending.ts index 738888a..6223ac3 100644 --- a/scripts/deploy/07-deployLending.ts +++ b/scripts/deploy/07-deployLending.ts @@ -33,6 +33,11 @@ async function main() { // BSC 主网 USDC_ADDRESS = "0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d"; USDC_PRICE_FEED = "0x51597f405303C4377E36123cBc172b13269EA163"; // USDC/USD + } + else if (chainId === "97") { + // BSC 测试网 + USDC_ADDRESS = "0x939cf46F7A4d05da2a37213E7379a8b04528F590"; + USDC_PRICE_FEED = "0x90c069C4538adAc136E051052E14c1cD799C41B7"; // USDC/USD } else { throw new Error(`不支持的网络: ${chainId}`); } diff --git a/scripts/deploy/08-configureLending.ts b/scripts/deploy/08-configureLending.ts index f741e35..e73ed50 100644 --- a/scripts/deploy/08-configureLending.ts +++ b/scripts/deploy/08-configureLending.ts @@ -60,7 +60,7 @@ async function main() { const USDC = { address: deployments.usdcAddress, - decimals: 6 // todo bsc主网是 18 decimal + decimals: 18 }; // 选择要作为抵押品的 YT Vaults(可以选择多个) diff --git a/scripts/deploy/09-upgradeLending.ts b/scripts/deploy/09-upgradeLending.ts deleted file mode 100644 index e013859..0000000 --- a/scripts/deploy/09-upgradeLending.ts +++ /dev/null @@ -1,213 +0,0 @@ -import { ethers, upgrades } from "hardhat"; -import * as fs from "fs"; -import * as path from "path"; - -/** - * 升级 Lending 或 Configurator 合约 - * 使用 upgrades.upgradeProxy() 进行 UUPS 升级 - */ -async function main() { - const [deployer] = await ethers.getSigners(); - console.log("\n=========================================="); - console.log("🔄 升级 Lending 借贷池系统"); - console.log("=========================================="); - console.log("升级账户:", deployer.address); - console.log("账户余额:", ethers.formatEther(await ethers.provider.getBalance(deployer.address)), "ETH\n"); - - // ========== 读取部署信息 ========== - const deploymentsPath = path.join(__dirname, "../../deployments-lending.json"); - if (!fs.existsSync(deploymentsPath)) { - throw new Error("未找到部署信息文件,请先运行部署脚本"); - } - - const network = await ethers.provider.getNetwork(); - const chainId = network.chainId.toString(); - const deployments = JSON.parse(fs.readFileSync(deploymentsPath, "utf-8"))[chainId]; - - if (!deployments) { - throw new Error(`未找到网络 ${chainId} 的部署信息`); - } - - console.log("📋 当前部署的合约:"); - console.log(" LendingPriceFeed Proxy:", deployments.lendingPriceFeed); - if (deployments.lendingPriceFeedImpl) { - console.log(" LendingPriceFeed Impl:", deployments.lendingPriceFeedImpl); - } - console.log(" Configurator Proxy:", deployments.configuratorProxy); - console.log(" Configurator Impl:", deployments.configuratorImpl); - console.log(" Lending Proxy:", deployments.lendingProxy); - console.log(" Lending Impl:", deployments.lendingImpl, "\n"); - - // ========== 选择要升级的合约 ========== - // 修改这里来选择升级哪个合约 - // 1 = LendingPriceFeed, 2 = Configurator, 3 = Lending - const UPGRADE_CONTRACT = 1; // 修改这个数字来选择要升级的合约 - - if (UPGRADE_CONTRACT === 1) { - // ========== 升级 LendingPriceFeed ========== - console.log("🔄 Phase 1: 升级 LendingPriceFeed 合约"); - - if (!deployments.lendingPriceFeed) { - throw new Error("未找到 LendingPriceFeed Proxy 地址,请先运行部署脚本"); - } - - console.log(" 当前 LendingPriceFeed Proxy:", deployments.lendingPriceFeed); - if (deployments.lendingPriceFeedImpl) { - console.log(" 当前 LendingPriceFeed Implementation:", deployments.lendingPriceFeedImpl); - } - - // 获取新的 LendingPriceFeed 合约工厂 - const LendingPriceFeedV2 = await ethers.getContractFactory("LendingPriceFeed"); - - console.log("\n 正在验证新实现合约..."); - const upgradedPriceFeed = await upgrades.upgradeProxy( - deployments.lendingPriceFeed, - LendingPriceFeedV2, - { - kind: "uups" - } - ); - await upgradedPriceFeed.waitForDeployment(); - - console.log(" ✅ LendingPriceFeed 已升级!"); - - // 获取新的实现合约地址 - const upgradedPriceFeedAddress = await upgradedPriceFeed.getAddress(); - const newPriceFeedImplAddress = await upgrades.erc1967.getImplementationAddress(upgradedPriceFeedAddress); - console.log(" 新 LendingPriceFeed Implementation:", newPriceFeedImplAddress); - - // 验证升级 - console.log("\n 验证升级结果:"); - console.log(" LendingPriceFeed Proxy (不变):", upgradedPriceFeedAddress); - console.log(" Owner:", await upgradedPriceFeed.owner()); - console.log(" USDC Address:", await upgradedPriceFeed.usdcAddress()); - - // 保存新的实现地址 - deployments.lendingPriceFeedImpl = newPriceFeedImplAddress; - deployments.lastUpgradeTime = new Date().toISOString(); - - const allDeployments = JSON.parse(fs.readFileSync(deploymentsPath, "utf-8")); - allDeployments[chainId] = deployments; - fs.writeFileSync(deploymentsPath, JSON.stringify(allDeployments, null, 2)); - - console.log("\n✅ LendingPriceFeed 升级完成!"); - console.log("====================================="); - console.log("旧实现:", deployments.lendingPriceFeedImpl || "未记录"); - console.log("新实现:", newPriceFeedImplAddress); - console.log("=====================================\n"); - - } else if (UPGRADE_CONTRACT === 3) { - // ========== 升级 Lending ========== - console.log("🔄 Phase 1: 升级 Lending 合约"); - - if (!deployments.lendingProxy) { - throw new Error("未找到 Lending Proxy 地址,请先运行配置脚本"); - } - - console.log(" 当前 Lending Proxy:", deployments.lendingProxy); - console.log(" 当前 Lending Implementation:", deployments.lendingImpl); - - // 获取新的 Lending 合约工厂 - // 注意:如果你有 LendingV2,请替换为 "LendingV2" - const LendingV2 = await ethers.getContractFactory("Lending"); - - console.log("\n 正在验证新实现合约..."); - // upgrades.upgradeProxy 会自动验证存储布局兼容性 - const upgradedLending = await upgrades.upgradeProxy( - deployments.lendingProxy, - LendingV2, - { - kind: "uups" - } - ); - await upgradedLending.waitForDeployment(); - - console.log(" ✅ Lending 已升级!"); - - // 获取新的实现合约地址 - const upgradedLendingAddress = await upgradedLending.getAddress(); - const newLendingImplAddress = await upgrades.erc1967.getImplementationAddress(upgradedLendingAddress); - console.log(" 新 Lending Implementation:", newLendingImplAddress); - - // 验证升级 - console.log("\n 验证升级结果:"); - console.log(" Lending Proxy (不变):", upgradedLendingAddress); - console.log(" Owner:", await upgradedLending.owner()); - console.log(" Base Token:", await upgradedLending.baseToken()); - - // 保存新的实现地址 - deployments.lendingImpl = newLendingImplAddress; - deployments.lendingUpgradeTimestamp = new Date().toISOString(); - - } else if (UPGRADE_CONTRACT === 2) { - // ========== 升级 Configurator ========== - console.log("🔄 Phase 1: 升级 Configurator 合约"); - - console.log(" 当前 Configurator Proxy:", deployments.configuratorProxy); - console.log(" 当前 Configurator Implementation:", deployments.configuratorImpl); - - // 获取新的 Configurator 合约工厂 - // 注意:如果你有 ConfiguratorV2,请替换为 "ConfiguratorV2" - const ConfiguratorV2 = await ethers.getContractFactory("Configurator"); - - console.log("\n 正在验证新实现合约..."); - const upgradedConfigurator = await upgrades.upgradeProxy( - deployments.configuratorProxy, - ConfiguratorV2, - { - kind: "uups" - } - ); - await upgradedConfigurator.waitForDeployment(); - - console.log(" ✅ Configurator 已升级!"); - - // 获取新的实现合约地址 - const upgradedConfiguratorAddress = await upgradedConfigurator.getAddress(); - const newConfiguratorImplAddress = await upgrades.erc1967.getImplementationAddress(upgradedConfiguratorAddress); - console.log(" 新 Configurator Implementation:", newConfiguratorImplAddress); - - // 验证升级 - console.log("\n 验证升级结果:"); - console.log(" Configurator Proxy (不变):", upgradedConfiguratorAddress); - console.log(" Owner:", await upgradedConfigurator.owner()); - - // 保存新的实现地址 - deployments.configuratorImpl = newConfiguratorImplAddress; - deployments.configuratorUpgradeTimestamp = new Date().toISOString(); - - const allDeployments2 = JSON.parse(fs.readFileSync(deploymentsPath, "utf-8")); - allDeployments2[chainId] = deployments; - fs.writeFileSync(deploymentsPath, JSON.stringify(allDeployments2, null, 2)); - - console.log("\n✅ Configurator 升级完成!"); - console.log("====================================="); - console.log("旧实现:", deployments.configuratorImpl); - console.log("新实现:", newConfiguratorImplAddress); - console.log("=====================================\n"); - } else { - throw new Error(`无效的升级选项: ${UPGRADE_CONTRACT}。请设置 UPGRADE_CONTRACT 为 1 (LendingPriceFeed), 2 (Configurator), 或 3 (Lending)`); - } - - // ========== 保存部署信息(最终)========== - const allDeployments = JSON.parse(fs.readFileSync(deploymentsPath, "utf-8")); - allDeployments[chainId] = deployments; - fs.writeFileSync(deploymentsPath, JSON.stringify(allDeployments, null, 2)); - - console.log("\n💾 升级信息已保存到:", deploymentsPath); - - console.log("\n✅ 升级流程全部完成!"); - console.log("⚠️ 重要提示:"); - console.log(" 1. 代理地址保持不变,用户无需更改合约地址"); - console.log(" 2. 所有状态数据已保留"); - console.log(" 3. 建议在测试网充分测试后再升级主网"); - console.log(" 4. 当前升级的合约:", UPGRADE_CONTRACT === 1 ? "LendingPriceFeed" : (UPGRADE_CONTRACT === 2 ? "Configurator" : "Lending"), "\n"); -} - -main() - .then(() => process.exit(0)) - .catch((error) => { - console.error(error); - process.exit(1); - }); - diff --git a/scripts/liquidation_bot/liquidateUnderwaterBorrowers.ts b/scripts/liquidation_bot/liquidateUnderwaterBorrowers.ts index 7d2a48a..1f08a11 100644 --- a/scripts/liquidation_bot/liquidateUnderwaterBorrowers.ts +++ b/scripts/liquidation_bot/liquidateUnderwaterBorrowers.ts @@ -1,8 +1,8 @@ import hre from 'hardhat'; import { Signer } from 'ethers'; -const LOOKBACK_BLOCKS = 50000; // 查询最近 50000 个区块 -const LIQUIDATION_THRESHOLD = 10; // $10 的最小清算阈值(美元单位) +const LOOKBACK_BLOCKS = 10000; // 查询最近 50000 个区块 +const LIQUIDATION_THRESHOLD = 1; // $10 的最小清算阈值(美元单位) /** * 获取最近活跃的地址(通过多个事件) diff --git a/scripts/upgrade/upgradeLending.ts b/scripts/upgrade/upgradeLending.ts index 42f68ab..adf2f7e 100644 --- a/scripts/upgrade/upgradeLending.ts +++ b/scripts/upgrade/upgradeLending.ts @@ -98,12 +98,6 @@ async function main() { console.log("=====================================\n"); console.log("💾 升级信息已保存到:", deploymentsPath); - console.log(""); - console.log("📌 重要提示:"); - console.log(" 1. 代理地址保持不变,用户无需更改合约地址"); - console.log(" 2. 所有状态数据已保留"); - console.log(" 3. 建议运行验证脚本确认升级成功"); - console.log(" 4. 建议在测试网充分测试后再升级主网\n"); } main() diff --git a/scripts/utils/buyCollateral.ts b/scripts/utils/buyCollateral.ts new file mode 100644 index 0000000..fa68835 --- /dev/null +++ b/scripts/utils/buyCollateral.ts @@ -0,0 +1,212 @@ +import { ethers } from "hardhat"; +import { Lending } from "../../typechain-types"; + +/** + * 购买清算抵押品脚本 + * + * 环境变量: + * - LENDING_ADDRESS: Lending 合约地址 + * - ASSET_ADDRESS: 抵押品资产地址 + * - BASE_AMOUNT (可选): 愿意支付的最大金额,默认 100 + * - SLIPPAGE (可选): 滑点容忍度 (1-5),默认 2 + */ +async function main() { + // ==================== 配置 ==================== + const LENDING_ADDRESS = process.env.LENDING_ADDRESS; + const ASSET_ADDRESS = process.env.ASSET_ADDRESS; + const BASE_AMOUNT_INPUT = process.env.BASE_AMOUNT || "100"; + const SLIPPAGE_PERCENT = parseInt(process.env.SLIPPAGE || "2"); + + // 参数验证 + if (!LENDING_ADDRESS || LENDING_ADDRESS === "0x...") { + throw new Error("❌ 请设置 LENDING_ADDRESS 环境变量"); + } + if (!ASSET_ADDRESS || ASSET_ADDRESS === "0x...") { + throw new Error("❌ 请设置 ASSET_ADDRESS 环境变量"); + } + + const SLIPPAGE = SLIPPAGE_PERCENT / 100; // 转换为小数 + + console.log("==================== 购买清算抵押品 ===================="); + console.log(`Lending 合约: ${LENDING_ADDRESS}`); + console.log(`抵押品地址: ${ASSET_ADDRESS}`); + console.log(`最大支付金额: ${BASE_AMOUNT_INPUT} USDC`); + console.log(`滑点容忍度: ${SLIPPAGE_PERCENT}%\n`); + + // ==================== 初始化 ==================== + const lending = await ethers.getContractAt("Lending", LENDING_ADDRESS) as unknown as Lending; + const [buyer] = await ethers.getSigners(); + const baseToken = await lending.baseToken(); + const base = await ethers.getContractAt("IERC20Metadata", baseToken); + const baseDecimals = await base.decimals(); + + const BASE_AMOUNT = ethers.parseUnits(BASE_AMOUNT_INPUT, baseDecimals); + + console.log(`买家地址: ${buyer.address}\n`); + + // ==================== 前置检查 ==================== + console.log("📊 检查系统状态..."); + + // 1. 检查储备金状态 + const reserves = await lending.getReserves(); + const targetReserves = await lending.targetReserves(); + console.log(`✓ 当前储备金: ${ethers.formatUnits(reserves, baseDecimals)} USDC`); + console.log(`✓ 目标储备金: ${ethers.formatUnits(targetReserves, baseDecimals)} USDC`); + + if (reserves >= targetReserves) { + throw new Error("❌ 储备金充足,当前无法购买抵押品"); + } + + // 2. 检查抵押品储备 + const collateralReserve = await lending.getCollateralReserves(ASSET_ADDRESS); + if (collateralReserve === 0n) { + throw new Error("❌ 该抵押品储备为空,无法购买"); + } + const asset = await ethers.getContractAt("IERC20Metadata", ASSET_ADDRESS); + const assetDecimals = await asset.decimals(); + console.log(`✓ 抵押品储备: ${ethers.formatUnits(collateralReserve, assetDecimals)} 代币\n`); + + // 3. 检查买家余额 + const buyerBalance = await base.balanceOf(buyer.address); + console.log(`💰 买家余额: ${ethers.formatUnits(buyerBalance, baseDecimals)} USDC`); + if (buyerBalance < BASE_AMOUNT) { + throw new Error(`❌ 余额不足。需要: ${ethers.formatUnits(BASE_AMOUNT, baseDecimals)} USDC,当前: ${ethers.formatUnits(buyerBalance, baseDecimals)} USDC`); + } + + // ==================== 获取购买信息 ==================== + console.log("\n📋 计算购买详情..."); + const info = await getBuyCollateralInfo(lending, ASSET_ADDRESS, BASE_AMOUNT, SLIPPAGE); + + console.log(`✓ 预期购买: ${ethers.formatUnits(info.expectedAmount, assetDecimals)} 代币`); + console.log(`✓ 实际购买: ${ethers.formatUnits(info.actualAmount, assetDecimals)} 代币`); + console.log(`✓ 最小接受: ${ethers.formatUnits(info.minAmount, assetDecimals)} 代币`); + + if (info.isLimited) { + console.log(`\n⚠️ 储备不足,购买量已调整:`); + console.log(` 原计划支付: ${ethers.formatUnits(info.baseAmount, baseDecimals)} USDC`); + console.log(` 实际约支付: ${ethers.formatUnits(info.actualBaseAmount, baseDecimals)} USDC`); + console.log(` 节省约: ${ethers.formatUnits(info.baseAmount - info.actualBaseAmount, baseDecimals)} USDC`); + } + + // ==================== 授权检查 ==================== + console.log("\n🔐 检查授权..."); + const allowance = await base.allowance(buyer.address, LENDING_ADDRESS); + + if (allowance < BASE_AMOUNT) { + console.log(`当前授权: ${ethers.formatUnits(allowance, baseDecimals)} USDC (不足)`); + console.log("正在授权..."); + const approveTx = await base.approve(LENDING_ADDRESS, ethers.MaxUint256); + await approveTx.wait(); + console.log("✅ 授权成功"); + } else { + console.log("✓ 授权充足"); + } + + // ==================== 执行购买 ==================== + console.log("\n💸 执行购买交易..."); + const tx = await lending.buyCollateral( + ASSET_ADDRESS, + info.minAmount, + BASE_AMOUNT, + buyer.address + ); + + console.log(`交易已提交: ${tx.hash}`); + console.log("等待确认..."); + + const receipt = await tx.wait(); + console.log(`✅ 交易确认! Gas 消耗: ${receipt?.gasUsed.toString()}\n`); + + // ==================== 解析结果 ==================== + const buyEvent = receipt?.logs.find((log: any) => { + try { + return lending.interface.parseLog(log)?.name === "BuyCollateral"; + } catch { + return false; + } + }); + + if (buyEvent) { + const parsedEvent = lending.interface.parseLog(buyEvent); + const paidAmount = parsedEvent?.args.baseAmount; + const receivedAmount = parsedEvent?.args.collateralAmount; + + console.log("==================== 交易结果 ===================="); + console.log(`✓ 实际支付: ${ethers.formatUnits(paidAmount, baseDecimals)} USDC`); + console.log(`✓ 实际获得: ${ethers.formatUnits(receivedAmount, assetDecimals)} 代币`); + console.log(`✓ 购买者: ${parsedEvent?.args.buyer}`); + console.log(`✓ 接收地址: ${buyer.address}`); + + // 计算实际单价和折扣信息 + // 实际单价 = 支付金额 / 获得数量 + const actualPricePerToken = (paidAmount * ethers.parseUnits("1", assetDecimals)) / receivedAmount; + + // 计算正常市场价(使用 quoteCollateral 反推) + // 如果用相同的 baseAmount 在市场价购买,能买到多少代币 + const marketAmount = await lending.quoteCollateral(ASSET_ADDRESS, paidAmount); + + console.log(`\n💰 折扣购买说明:`); + console.log(`✓ 实际单价: ${ethers.formatUnits(actualPricePerToken, baseDecimals)} USDC/代币`); + + // 只有当实际购买量大于市场价购买量时才显示折扣 + if (receivedAmount > marketAmount) { + const discount = ((receivedAmount - marketAmount) * 10000n) / marketAmount; + const saved = actualPricePerToken * marketAmount / ethers.parseUnits("1", assetDecimals) - paidAmount; + + console.log(`✓ 市场价可购买: ${ethers.formatUnits(marketAmount, assetDecimals)} 代币`); + console.log(`✓ 折扣多得: ${ethers.formatUnits(receivedAmount - marketAmount, assetDecimals)} 代币 (${Number(discount) / 100}%)`); + console.log(`✓ 相当于节省: ${ethers.formatUnits(saved, baseDecimals)} USDC`); + } else { + console.log(`ℹ️ 这是清算抵押品的折扣购买,价格低于市场价`); + } + console.log("==================================================="); + } + + // ==================== 更新后状态 ==================== + console.log("\n📊 购买后状态:"); + const newBalance = await base.balanceOf(buyer.address); + const newAssetBalance = await asset.balanceOf(buyer.address); + console.log(`买家 USDC 余额: ${ethers.formatUnits(newBalance, baseDecimals)} USDC`); + console.log(`买家抵押品余额: ${ethers.formatUnits(newAssetBalance, assetDecimals)} 代币`); + + console.log("\n✅ 购买完成!"); +} + +main() + .then(() => process.exit(0)) + .catch((error) => { + console.error("\n❌ 执行失败:", error.message || error); + process.exit(1); + }); + + /** + * 获取详细的购买信息 + */ +export async function getBuyCollateralInfo( + lendingContract: Lending, + asset: string, + baseAmount: bigint, + slippageTolerance: number = 0.01 +) { + const expectedAmount = await lendingContract.quoteCollateral(asset, baseAmount); + const availableReserve = await lendingContract.getCollateralReserves(asset); + const actualAmount = expectedAmount < availableReserve ? expectedAmount : availableReserve; + + const slippageMultiplier = BigInt(Math.floor((1 - slippageTolerance) * 1e18)); + const minAmount = (actualAmount * slippageMultiplier) / BigInt(1e18); + + // 估算实际支付金额(基于实际购买量) + const actualBaseAmount = actualAmount < expectedAmount + ? (baseAmount * actualAmount) / expectedAmount // 按比例计算 + : baseAmount; + + return { + expectedAmount, // 理想情况下可购买的数量 + availableReserve, // 协议可用储备 + actualAmount, // 实际可购买的数量(限制后) + minAmount, // 应用滑点保护后的最小值 + baseAmount, // 用户愿意支付的最大金额 + actualBaseAmount, // 实际需要支付的金额(可能更少) + isLimited: actualAmount < expectedAmount, // 是否受储备限制 + }; +} \ No newline at end of file