ytLending supports USDC as the base token
This commit is contained in:
@@ -50,6 +50,26 @@
|
||||
"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",
|
||||
"kind": "uups"
|
||||
}
|
||||
],
|
||||
"impls": {
|
||||
@@ -2067,6 +2087,811 @@
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"1c57a61daa38362f8650a87d125022acfc042841e807681a3ff096fcc0f087f1": {
|
||||
"address": "0xa51409ad5B8Fa77aB7ab8221a5bD76fdF7077E08",
|
||||
"txHash": "0xee1f2b05219ea5f953968b70c4b650cd80822f9ee7637631bd2f9f81acfb3f70",
|
||||
"layout": {
|
||||
"solcVersion": "0.8.28",
|
||||
"storage": [
|
||||
{
|
||||
"label": "usdcAddress",
|
||||
"offset": 0,
|
||||
"slot": "0",
|
||||
"type": "t_address",
|
||||
"contract": "LendingPriceFeed",
|
||||
"src": "contracts/ytLending/LendingPriceFeed.sol:10"
|
||||
},
|
||||
{
|
||||
"label": "usdcPriceFeed",
|
||||
"offset": 0,
|
||||
"slot": "1",
|
||||
"type": "t_contract(AggregatorV3Interface)45",
|
||||
"contract": "LendingPriceFeed",
|
||||
"src": "contracts/ytLending/LendingPriceFeed.sol:11"
|
||||
}
|
||||
],
|
||||
"types": {
|
||||
"t_address": {
|
||||
"label": "address",
|
||||
"numberOfBytes": "20"
|
||||
},
|
||||
"t_bool": {
|
||||
"label": "bool",
|
||||
"numberOfBytes": "1"
|
||||
},
|
||||
"t_struct(InitializableStorage)119_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)59_storage": {
|
||||
"label": "struct OwnableUpgradeable.OwnableStorage",
|
||||
"members": [
|
||||
{
|
||||
"label": "_owner",
|
||||
"type": "t_address",
|
||||
"offset": 0,
|
||||
"slot": "0"
|
||||
}
|
||||
],
|
||||
"numberOfBytes": "32"
|
||||
},
|
||||
"t_uint64": {
|
||||
"label": "uint64",
|
||||
"numberOfBytes": "8"
|
||||
},
|
||||
"t_contract(AggregatorV3Interface)45": {
|
||||
"label": "contract AggregatorV3Interface",
|
||||
"numberOfBytes": "20"
|
||||
}
|
||||
},
|
||||
"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"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"9b19ccc45a7019267570af10b3a1c7eec6cbf8cf5eaea36559198953d9fbb4df": {
|
||||
"address": "0xB6c6A171C63Bd15B42f28C3207eb697F3c4d4606",
|
||||
"txHash": "0xa78e922e78008ce7ab03fdfdf9eba07411dd5f53fd99fce6766744660323f5e9",
|
||||
"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)5720_storage)",
|
||||
"contract": "ConfiguratorStorage",
|
||||
"src": "contracts/ytLending/ConfiguratorStorage.sol:15"
|
||||
},
|
||||
{
|
||||
"label": "__gap",
|
||||
"offset": 0,
|
||||
"slot": "2",
|
||||
"type": "t_array(t_uint256)50_storage",
|
||||
"contract": "Configurator",
|
||||
"src": "contracts/ytLending/Configurator.sol:211"
|
||||
}
|
||||
],
|
||||
"types": {
|
||||
"t_address": {
|
||||
"label": "address",
|
||||
"numberOfBytes": "20"
|
||||
},
|
||||
"t_bool": {
|
||||
"label": "bool",
|
||||
"numberOfBytes": "1"
|
||||
},
|
||||
"t_struct(InitializableStorage)119_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)59_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)5687_storage)dyn_storage": {
|
||||
"label": "struct LendingConfiguration.AssetConfig[]",
|
||||
"numberOfBytes": "32"
|
||||
},
|
||||
"t_array(t_uint256)50_storage": {
|
||||
"label": "uint256[50]",
|
||||
"numberOfBytes": "1600"
|
||||
},
|
||||
"t_mapping(t_address,t_address)": {
|
||||
"label": "mapping(address => address)",
|
||||
"numberOfBytes": "32"
|
||||
},
|
||||
"t_mapping(t_address,t_struct(Configuration)5720_storage)": {
|
||||
"label": "mapping(address => struct LendingConfiguration.Configuration)",
|
||||
"numberOfBytes": "32"
|
||||
},
|
||||
"t_struct(AssetConfig)5687_storage": {
|
||||
"label": "struct LendingConfiguration.AssetConfig",
|
||||
"members": [
|
||||
{
|
||||
"label": "asset",
|
||||
"type": "t_address",
|
||||
"offset": 0,
|
||||
"slot": "0"
|
||||
},
|
||||
{
|
||||
"label": "decimals",
|
||||
"type": "t_uint8",
|
||||
"offset": 20,
|
||||
"slot": "0"
|
||||
},
|
||||
{
|
||||
"label": "borrowCollateralFactor",
|
||||
"type": "t_uint64",
|
||||
"offset": 21,
|
||||
"slot": "0"
|
||||
},
|
||||
{
|
||||
"label": "liquidateCollateralFactor",
|
||||
"type": "t_uint64",
|
||||
"offset": 0,
|
||||
"slot": "1"
|
||||
},
|
||||
{
|
||||
"label": "liquidationFactor",
|
||||
"type": "t_uint64",
|
||||
"offset": 8,
|
||||
"slot": "1"
|
||||
},
|
||||
{
|
||||
"label": "supplyCap",
|
||||
"type": "t_uint128",
|
||||
"offset": 16,
|
||||
"slot": "1"
|
||||
}
|
||||
],
|
||||
"numberOfBytes": "64"
|
||||
},
|
||||
"t_struct(Configuration)5720_storage": {
|
||||
"label": "struct LendingConfiguration.Configuration",
|
||||
"members": [
|
||||
{
|
||||
"label": "baseToken",
|
||||
"type": "t_address",
|
||||
"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": "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)5687_storage)dyn_storage",
|
||||
"offset": 0,
|
||||
"slot": "6"
|
||||
}
|
||||
],
|
||||
"numberOfBytes": "224"
|
||||
},
|
||||
"t_uint104": {
|
||||
"label": "uint104",
|
||||
"numberOfBytes": "13"
|
||||
},
|
||||
"t_uint128": {
|
||||
"label": "uint128",
|
||||
"numberOfBytes": "16"
|
||||
},
|
||||
"t_uint256": {
|
||||
"label": "uint256",
|
||||
"numberOfBytes": "32"
|
||||
},
|
||||
"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"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"75f45941512afb9c219db09e2571576c528a5f4b3faa5a64a64d1a988c7ebf8e": {
|
||||
"address": "0x5beA465c4F8882a09F3F1f258464988b9BbfCDBd",
|
||||
"txHash": "0xebf1a659f8107a79649ca49267ce1211c1a9b7363328b5b58060c2e1373aead9",
|
||||
"layout": {
|
||||
"solcVersion": "0.8.28",
|
||||
"storage": [
|
||||
{
|
||||
"label": "baseToken",
|
||||
"offset": 0,
|
||||
"slot": "0",
|
||||
"type": "t_address",
|
||||
"contract": "LendingStorage",
|
||||
"src": "contracts/ytLending/LendingStorage.sol:14"
|
||||
},
|
||||
{
|
||||
"label": "lendingPriceSource",
|
||||
"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)5687_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)6372_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"
|
||||
},
|
||||
{
|
||||
"label": "__gap",
|
||||
"offset": 0,
|
||||
"slot": "15",
|
||||
"type": "t_array(t_uint256)50_storage",
|
||||
"contract": "Lending",
|
||||
"src": "contracts/ytLending/Lending.sol:684"
|
||||
}
|
||||
],
|
||||
"types": {
|
||||
"t_address": {
|
||||
"label": "address",
|
||||
"numberOfBytes": "20"
|
||||
},
|
||||
"t_bool": {
|
||||
"label": "bool",
|
||||
"numberOfBytes": "1"
|
||||
},
|
||||
"t_struct(InitializableStorage)119_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)59_storage": {
|
||||
"label": "struct OwnableUpgradeable.OwnableStorage",
|
||||
"members": [
|
||||
{
|
||||
"label": "_owner",
|
||||
"type": "t_address",
|
||||
"offset": 0,
|
||||
"slot": "0"
|
||||
}
|
||||
],
|
||||
"numberOfBytes": "32"
|
||||
},
|
||||
"t_struct(PausableStorage)270_storage": {
|
||||
"label": "struct PausableUpgradeable.PausableStorage",
|
||||
"members": [
|
||||
{
|
||||
"label": "_paused",
|
||||
"type": "t_bool",
|
||||
"offset": 0,
|
||||
"slot": "0"
|
||||
}
|
||||
],
|
||||
"numberOfBytes": "32"
|
||||
},
|
||||
"t_struct(ReentrancyGuardStorage)334_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_array(t_uint256)50_storage": {
|
||||
"label": "uint256[50]",
|
||||
"numberOfBytes": "1600"
|
||||
},
|
||||
"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)5687_storage)": {
|
||||
"label": "mapping(address => struct LendingConfiguration.AssetConfig)",
|
||||
"numberOfBytes": "32"
|
||||
},
|
||||
"t_mapping(t_address,t_struct(UserBasic)6372_storage)": {
|
||||
"label": "mapping(address => struct LendingStorage.UserBasic)",
|
||||
"numberOfBytes": "32"
|
||||
},
|
||||
"t_mapping(t_address,t_uint256)": {
|
||||
"label": "mapping(address => uint256)",
|
||||
"numberOfBytes": "32"
|
||||
},
|
||||
"t_struct(AssetConfig)5687_storage": {
|
||||
"label": "struct LendingConfiguration.AssetConfig",
|
||||
"members": [
|
||||
{
|
||||
"label": "asset",
|
||||
"type": "t_address",
|
||||
"offset": 0,
|
||||
"slot": "0"
|
||||
},
|
||||
{
|
||||
"label": "decimals",
|
||||
"type": "t_uint8",
|
||||
"offset": 20,
|
||||
"slot": "0"
|
||||
},
|
||||
{
|
||||
"label": "borrowCollateralFactor",
|
||||
"type": "t_uint64",
|
||||
"offset": 21,
|
||||
"slot": "0"
|
||||
},
|
||||
{
|
||||
"label": "liquidateCollateralFactor",
|
||||
"type": "t_uint64",
|
||||
"offset": 0,
|
||||
"slot": "1"
|
||||
},
|
||||
{
|
||||
"label": "liquidationFactor",
|
||||
"type": "t_uint64",
|
||||
"offset": 8,
|
||||
"slot": "1"
|
||||
},
|
||||
{
|
||||
"label": "supplyCap",
|
||||
"type": "t_uint128",
|
||||
"offset": 16,
|
||||
"slot": "1"
|
||||
}
|
||||
],
|
||||
"numberOfBytes": "64"
|
||||
},
|
||||
"t_struct(UserBasic)6372_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"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,28 +1,64 @@
|
||||
[
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_ytVault",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_wusdAddress",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"inputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "constructor"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "InvalidWUSDAddress",
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "target",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "AddressEmptyCode",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "implementation",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "ERC1967InvalidImplementation",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "InvalidYTVaultAddress",
|
||||
"name": "ERC1967NonPayable",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "FailedCall",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "InvalidChainlinkPrice",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "InvalidInitialization",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "InvalidUsdcAddress",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "InvalidUsdcPriceFeedAddress",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "NotInitializing",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
@@ -47,6 +83,35 @@
|
||||
"name": "OwnableUnauthorizedAccount",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "UUPSUnauthorizedCallContext",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "bytes32",
|
||||
"name": "slot",
|
||||
"type": "bytes32"
|
||||
}
|
||||
],
|
||||
"name": "UUPSUnsupportedProxiableUUID",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint64",
|
||||
"name": "version",
|
||||
"type": "uint64"
|
||||
}
|
||||
],
|
||||
"name": "Initialized",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
@@ -66,6 +131,32 @@
|
||||
"name": "OwnershipTransferred",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "implementation",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "Upgraded",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "UPGRADE_INTERFACE_VERSION",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "string",
|
||||
"name": "",
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
@@ -85,6 +176,24 @@
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_usdcAddress",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_usdcPriceFeed",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "initialize",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "owner",
|
||||
@@ -98,6 +207,19 @@
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "proxiableUUID",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "bytes32",
|
||||
"name": "",
|
||||
"type": "bytes32"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "renounceOwnership",
|
||||
@@ -109,24 +231,11 @@
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_wusdAddress",
|
||||
"name": "_usdcAddress",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "setWUSDAddress",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_ytVault",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "setYTVault",
|
||||
"name": "setUsdcAddress",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
@@ -145,21 +254,26 @@
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "wusdAddress",
|
||||
"outputs": [
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "",
|
||||
"name": "newImplementation",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "bytes",
|
||||
"name": "data",
|
||||
"type": "bytes"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"name": "upgradeToAndCall",
|
||||
"outputs": [],
|
||||
"stateMutability": "payable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "ytVault",
|
||||
"name": "usdcAddress",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
|
||||
File diff suppressed because one or more lines are too long
1
comet
1
comet
Submodule comet deleted from 80d38c945a
@@ -200,5 +200,11 @@ contract Configurator is
|
||||
function getConfiguration(address lendingProxy) external view returns (Configuration memory) {
|
||||
return configuratorParams[lendingProxy];
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev 预留存储空间,用于未来升级时添加新的状态变量
|
||||
* 50个slot = 50 * 32 bytes = 1600 bytes
|
||||
*/
|
||||
uint256[50] private __gap;
|
||||
}
|
||||
|
||||
|
||||
@@ -156,7 +156,7 @@ contract Lending is
|
||||
function supply(uint256 amount) external override nonReentrant whenNotPaused {
|
||||
accrueInterest();
|
||||
|
||||
IERC20(baseToken).safeTransferFrom(msg.sender, address(this), amount);
|
||||
IERC20(baseToken).transferFrom(msg.sender, address(this), amount);
|
||||
|
||||
// 获取用户当前本金
|
||||
UserBasic memory user = userBasic[msg.sender];
|
||||
@@ -240,7 +240,7 @@ contract Lending is
|
||||
uint256 newTotal = userCollateral[msg.sender][asset] + amount;
|
||||
if (newTotal > config.supplyCap) revert SupplyCapExceeded();
|
||||
|
||||
IERC20(asset).safeTransferFrom(msg.sender, address(this), amount);
|
||||
IERC20(asset).transferFrom(msg.sender, address(this), amount);
|
||||
|
||||
userCollateral[msg.sender][asset] += amount;
|
||||
|
||||
@@ -440,7 +440,7 @@ contract Lending is
|
||||
if (collateralAmount > collateralReserves[asset]) revert InsufficientBalance();
|
||||
|
||||
// 收取清算人支付的资金
|
||||
IERC20(baseToken).safeTransferFrom(msg.sender, address(this), baseAmount);
|
||||
IERC20(baseToken).transferFrom(msg.sender, address(this), baseAmount);
|
||||
|
||||
// 抵押品出库
|
||||
collateralReserves[asset] -= collateralAmount;
|
||||
@@ -673,5 +673,11 @@ contract Lending is
|
||||
|
||||
emit WithdrawReserves(to, amount);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev 预留存储空间,用于未来升级时添加新的状态变量
|
||||
* 50个slot = 50 * 32 bytes = 1600 bytes
|
||||
*/
|
||||
uint256[50] private __gap;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,39 +1,59 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
pragma solidity ^0.8.0;
|
||||
|
||||
import "../interfaces/IYTVault.sol";
|
||||
import "@openzeppelin/contracts/access/Ownable.sol";
|
||||
import "../interfaces/IYTAssetVault.sol";
|
||||
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
|
||||
import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
|
||||
import {AggregatorV3Interface} from "@chainlink/contracts/src/v0.8/shared/interfaces/AggregatorV3Interface.sol";
|
||||
|
||||
contract LendingPriceFeed is Ownable {
|
||||
address public ytVault;
|
||||
address public wusdAddress;
|
||||
contract LendingPriceFeed is OwnableUpgradeable, UUPSUpgradeable {
|
||||
address public usdcAddress;
|
||||
AggregatorV3Interface internal usdcPriceFeed;
|
||||
|
||||
error InvalidYTVaultAddress();
|
||||
error InvalidWUSDAddress();
|
||||
|
||||
constructor(address _ytVault, address _wusdAddress) Ownable(msg.sender) {
|
||||
if (_ytVault == address(0)) revert InvalidYTVaultAddress();
|
||||
if (_wusdAddress == address(0)) revert InvalidWUSDAddress();
|
||||
ytVault = _ytVault;
|
||||
wusdAddress = _wusdAddress;
|
||||
error InvalidUsdcAddress();
|
||||
error InvalidUsdcPriceFeedAddress();
|
||||
error InvalidChainlinkPrice();
|
||||
|
||||
/// @custom:oz-upgrades-unsafe-allow constructor
|
||||
constructor() {
|
||||
_disableInitializers();
|
||||
}
|
||||
|
||||
function setYTVault(address _ytVault) external onlyOwner {
|
||||
if (_ytVault == address(0)) revert InvalidYTVaultAddress();
|
||||
ytVault = _ytVault;
|
||||
function initialize(address _usdcAddress, address _usdcPriceFeed) external initializer {
|
||||
__UUPSUpgradeable_init();
|
||||
__Ownable_init(msg.sender);
|
||||
if (_usdcAddress == address(0)) revert InvalidUsdcAddress();
|
||||
if (_usdcPriceFeed == address(0)) revert InvalidUsdcPriceFeedAddress();
|
||||
usdcAddress = _usdcAddress;
|
||||
usdcPriceFeed = AggregatorV3Interface(_usdcPriceFeed);
|
||||
}
|
||||
|
||||
function setWUSDAddress(address _wusdAddress) external onlyOwner {
|
||||
if (_wusdAddress == address(0)) revert InvalidWUSDAddress();
|
||||
wusdAddress = _wusdAddress;
|
||||
function _authorizeUpgrade(address newImplementation) internal override onlyOwner {}
|
||||
|
||||
function setUsdcAddress(address _usdcAddress) external onlyOwner {
|
||||
if (_usdcAddress == address(0)) revert InvalidUsdcAddress();
|
||||
usdcAddress = _usdcAddress;
|
||||
}
|
||||
|
||||
function getPrice(address _token) external view returns (uint256) {
|
||||
if (_token == wusdAddress) {
|
||||
return IYTVault(ytVault).wusdPrice();
|
||||
} else {
|
||||
return IYTVault(_token).ytPrice();
|
||||
if (_token == usdcAddress) {
|
||||
return _getUSDCPrice();
|
||||
}
|
||||
return IYTAssetVault(_token).ytPrice();
|
||||
}
|
||||
|
||||
function _getUSDCPrice() internal view returns (uint256) {
|
||||
(
|
||||
/* uint80 roundId */,
|
||||
int256 price,
|
||||
/* uint256 startedAt */,
|
||||
/* uint256 updatedAt */,
|
||||
/* uint80 answeredInRound */
|
||||
) = usdcPriceFeed.latestRoundData();
|
||||
|
||||
if (price <= 0) revert InvalidChainlinkPrice();
|
||||
|
||||
return uint256(price) * 1e22; // 1e22 = 10^(30-8)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -165,7 +165,7 @@ contract YTPoolManager is Initializable, UUPSUpgradeable, ReentrancyGuardUpgrade
|
||||
uint256 aumInUsdy = getAumInUsdy(true);
|
||||
uint256 ytLPSupply = IERC20(ytLP).totalSupply();
|
||||
|
||||
IERC20(_token).safeTransferFrom(_fundingAccount, ytVault, _amount);
|
||||
IERC20(_token).transferFrom(_fundingAccount, ytVault, _amount);
|
||||
uint256 usdyAmount = IYTVault(ytVault).buyUSDY(_token, address(this));
|
||||
if (usdyAmount < _minUsdy) revert InsufficientOutput();
|
||||
|
||||
|
||||
@@ -117,7 +117,7 @@ contract YTRewardRouter is Initializable, UUPSUpgradeable, ReentrancyGuardUpgrad
|
||||
|
||||
address account = msg.sender;
|
||||
|
||||
IERC20(_token).safeTransferFrom(account, address(this), _amount);
|
||||
IERC20(_token).transferFrom(account, address(this), _amount);
|
||||
IERC20(_token).approve(ytPoolManager, _amount);
|
||||
|
||||
uint256 ytLPAmount = IYTPoolManager(ytPoolManager).addLiquidityForAccount(
|
||||
@@ -181,7 +181,7 @@ contract YTRewardRouter is Initializable, UUPSUpgradeable, ReentrancyGuardUpgrad
|
||||
|
||||
address account = msg.sender;
|
||||
|
||||
IERC20(_tokenIn).safeTransferFrom(account, ytVault, _amountIn);
|
||||
IERC20(_tokenIn).transferFrom(account, ytVault, _amountIn);
|
||||
|
||||
uint256 amountOut = IYTVault(ytVault).swap(_tokenIn, _tokenOut, _receiver);
|
||||
|
||||
|
||||
@@ -292,7 +292,7 @@ contract YTAssetVault is
|
||||
}
|
||||
|
||||
// 转入USDC
|
||||
IERC20(usdcAddress).safeTransferFrom(msg.sender, address(this), _usdcAmount);
|
||||
IERC20(usdcAddress).transferFrom(msg.sender, address(this), _usdcAmount);
|
||||
|
||||
// 铸造YT
|
||||
_mint(msg.sender, ytAmount);
|
||||
@@ -551,7 +551,7 @@ contract YTAssetVault is
|
||||
}
|
||||
|
||||
// 从manager转入USDC到合约
|
||||
IERC20(usdcAddress).safeTransferFrom(msg.sender, address(this), _amount);
|
||||
IERC20(usdcAddress).transferFrom(msg.sender, address(this), _amount);
|
||||
|
||||
emit AssetsDeposited(_amount);
|
||||
}
|
||||
|
||||
34
deployments-lending.json
Normal file
34
deployments-lending.json
Normal file
@@ -0,0 +1,34 @@
|
||||
{
|
||||
"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",
|
||||
"deployer": "0xa013422A5918CD099C63c8CC35283EACa99a705d",
|
||||
"lendingProxy": "0xCb4E7B1069F6C26A1c27523ce4c8dfD884552d1D",
|
||||
"collateralAssets": [
|
||||
{
|
||||
"name": "YT Token A",
|
||||
"symbol": "YT-A",
|
||||
"address": "0x97204190B35D9895a7a47aa7BaC61ac08De3cF05"
|
||||
},
|
||||
{
|
||||
"name": "YT Token B",
|
||||
"symbol": "YT-B",
|
||||
"address": "0x181ef4011c35C4a2Fda08eBC5Cf509Ef58E553fF"
|
||||
},
|
||||
{
|
||||
"name": "YT Token C",
|
||||
"symbol": "YT-C",
|
||||
"address": "0xE9A5b9f3a2Eda4358f81d4E2eF4f3280A664e5B0"
|
||||
}
|
||||
],
|
||||
"configTimestamp": "2025-12-26T04:17:01.662Z"
|
||||
}
|
||||
}
|
||||
1952
doc/YT-Lending借贷系统操作流程图.md
Normal file
1952
doc/YT-Lending借贷系统操作流程图.md
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
1
out/YtLending.t.sol/MockChainlinkPriceFeed.json
Normal file
1
out/YtLending.t.sol/MockChainlinkPriceFeed.json
Normal file
File diff suppressed because one or more lines are too long
1
out/YtLending.t.sol/MockERC20.json
Normal file
1
out/YtLending.t.sol/MockERC20.json
Normal file
File diff suppressed because one or more lines are too long
1
out/YtLending.t.sol/YtLendingTest.json
Normal file
1
out/YtLending.t.sol/YtLendingTest.json
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
1
out/build-info/0c1e3adcf62e59a9.json
Normal file
1
out/build-info/0c1e3adcf62e59a9.json
Normal file
@@ -0,0 +1 @@
|
||||
{"id":"0c1e3adcf62e59a9","source_id_to_path":{"0":"contracts/interfaces/ILending.sol","1":"contracts/interfaces/IYTAssetVault.sol","2":"contracts/interfaces/IYTLendingPriceFeed.sol","3":"contracts/ytLending/Configurator.sol","4":"contracts/ytLending/ConfiguratorStorage.sol","5":"contracts/ytLending/Lending.sol","6":"contracts/ytLending/LendingConfiguration.sol","7":"contracts/ytLending/LendingFactory.sol","8":"contracts/ytLending/LendingMath.sol","9":"contracts/ytLending/LendingPriceFeed.sol","10":"contracts/ytLending/LendingStorage.sol","11":"contracts/ytVault/YTAssetFactory.sol","12":"contracts/ytVault/YTAssetVault.sol","13":"lib/forge-std/src/Base.sol","14":"lib/forge-std/src/StdAssertions.sol","15":"lib/forge-std/src/StdChains.sol","16":"lib/forge-std/src/StdCheats.sol","17":"lib/forge-std/src/StdConstants.sol","18":"lib/forge-std/src/StdError.sol","19":"lib/forge-std/src/StdInvariant.sol","20":"lib/forge-std/src/StdJson.sol","21":"lib/forge-std/src/StdMath.sol","22":"lib/forge-std/src/StdStorage.sol","23":"lib/forge-std/src/StdStyle.sol","24":"lib/forge-std/src/StdToml.sol","25":"lib/forge-std/src/StdUtils.sol","26":"lib/forge-std/src/Test.sol","27":"lib/forge-std/src/Vm.sol","28":"lib/forge-std/src/console.sol","29":"lib/forge-std/src/console2.sol","30":"lib/forge-std/src/interfaces/IMulticall3.sol","31":"lib/forge-std/src/safeconsole.sol","32":"node_modules/@chainlink/contracts/src/v0.8/shared/interfaces/AggregatorV3Interface.sol","33":"node_modules/@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol","34":"node_modules/@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol","35":"node_modules/@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol","36":"node_modules/@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol","37":"node_modules/@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol","38":"node_modules/@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable.sol","39":"node_modules/@openzeppelin/contracts-upgradeable/utils/ReentrancyGuardUpgradeable.sol","40":"node_modules/@openzeppelin/contracts/access/Ownable.sol","41":"node_modules/@openzeppelin/contracts/interfaces/IERC1363.sol","42":"node_modules/@openzeppelin/contracts/interfaces/IERC165.sol","43":"node_modules/@openzeppelin/contracts/interfaces/IERC1967.sol","44":"node_modules/@openzeppelin/contracts/interfaces/IERC20.sol","45":"node_modules/@openzeppelin/contracts/interfaces/draft-IERC1822.sol","46":"node_modules/@openzeppelin/contracts/interfaces/draft-IERC6093.sol","47":"node_modules/@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol","48":"node_modules/@openzeppelin/contracts/proxy/ERC1967/ERC1967Utils.sol","49":"node_modules/@openzeppelin/contracts/proxy/Proxy.sol","50":"node_modules/@openzeppelin/contracts/proxy/beacon/IBeacon.sol","51":"node_modules/@openzeppelin/contracts/token/ERC20/ERC20.sol","52":"node_modules/@openzeppelin/contracts/token/ERC20/IERC20.sol","53":"node_modules/@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol","54":"node_modules/@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol","55":"node_modules/@openzeppelin/contracts/utils/Address.sol","56":"node_modules/@openzeppelin/contracts/utils/Context.sol","57":"node_modules/@openzeppelin/contracts/utils/Errors.sol","58":"node_modules/@openzeppelin/contracts/utils/StorageSlot.sol","59":"node_modules/@openzeppelin/contracts/utils/introspection/IERC165.sol","60":"test/YtLending.t.sol"},"language":"Solidity"}
|
||||
1
out/build-info/515ff2f06c470e6a.json
Normal file
1
out/build-info/515ff2f06c470e6a.json
Normal file
@@ -0,0 +1 @@
|
||||
{"id":"515ff2f06c470e6a","source_id_to_path":{"0":"contracts/interfaces/ILending.sol","1":"contracts/interfaces/IUSDY.sol","2":"contracts/interfaces/IYTAssetVault.sol","3":"contracts/interfaces/IYTLPToken.sol","4":"contracts/interfaces/IYTLendingPriceFeed.sol","5":"contracts/interfaces/IYTPoolManager.sol","6":"contracts/interfaces/IYTPriceFeed.sol","7":"contracts/interfaces/IYTVault.sol","8":"contracts/ytLending/Configurator.sol","9":"contracts/ytLending/ConfiguratorStorage.sol","10":"contracts/ytLending/Lending.sol","11":"contracts/ytLending/LendingConfiguration.sol","12":"contracts/ytLending/LendingFactory.sol","13":"contracts/ytLending/LendingMath.sol","14":"contracts/ytLending/LendingPriceFeed.sol","15":"contracts/ytLending/LendingStorage.sol","16":"contracts/ytLp/core/YTPoolManager.sol","17":"contracts/ytLp/core/YTPriceFeed.sol","18":"contracts/ytLp/core/YTRewardRouter.sol","19":"contracts/ytLp/core/YTVault.sol","20":"contracts/ytLp/tokens/USDY.sol","21":"contracts/ytLp/tokens/YTLPToken.sol","22":"contracts/ytVault/YTAssetFactory.sol","23":"contracts/ytVault/YTAssetVault.sol","24":"lib/forge-std/src/Base.sol","25":"lib/forge-std/src/StdAssertions.sol","26":"lib/forge-std/src/StdChains.sol","27":"lib/forge-std/src/StdCheats.sol","28":"lib/forge-std/src/StdConstants.sol","29":"lib/forge-std/src/StdError.sol","30":"lib/forge-std/src/StdInvariant.sol","31":"lib/forge-std/src/StdJson.sol","32":"lib/forge-std/src/StdMath.sol","33":"lib/forge-std/src/StdStorage.sol","34":"lib/forge-std/src/StdStyle.sol","35":"lib/forge-std/src/StdToml.sol","36":"lib/forge-std/src/StdUtils.sol","37":"lib/forge-std/src/Test.sol","38":"lib/forge-std/src/Vm.sol","39":"lib/forge-std/src/console.sol","40":"lib/forge-std/src/console2.sol","41":"lib/forge-std/src/interfaces/IMulticall3.sol","42":"lib/forge-std/src/safeconsole.sol","43":"node_modules/@chainlink/contracts/src/v0.8/shared/interfaces/AggregatorV3Interface.sol","44":"node_modules/@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol","45":"node_modules/@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol","46":"node_modules/@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol","47":"node_modules/@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol","48":"node_modules/@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol","49":"node_modules/@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable.sol","50":"node_modules/@openzeppelin/contracts-upgradeable/utils/ReentrancyGuardUpgradeable.sol","51":"node_modules/@openzeppelin/contracts/access/Ownable.sol","52":"node_modules/@openzeppelin/contracts/interfaces/IERC1363.sol","53":"node_modules/@openzeppelin/contracts/interfaces/IERC165.sol","54":"node_modules/@openzeppelin/contracts/interfaces/IERC1967.sol","55":"node_modules/@openzeppelin/contracts/interfaces/IERC20.sol","56":"node_modules/@openzeppelin/contracts/interfaces/draft-IERC1822.sol","57":"node_modules/@openzeppelin/contracts/interfaces/draft-IERC6093.sol","58":"node_modules/@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol","59":"node_modules/@openzeppelin/contracts/proxy/ERC1967/ERC1967Utils.sol","60":"node_modules/@openzeppelin/contracts/proxy/Proxy.sol","61":"node_modules/@openzeppelin/contracts/proxy/beacon/IBeacon.sol","62":"node_modules/@openzeppelin/contracts/token/ERC20/ERC20.sol","63":"node_modules/@openzeppelin/contracts/token/ERC20/IERC20.sol","64":"node_modules/@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol","65":"node_modules/@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol","66":"node_modules/@openzeppelin/contracts/utils/Address.sol","67":"node_modules/@openzeppelin/contracts/utils/Context.sol","68":"node_modules/@openzeppelin/contracts/utils/Errors.sol","69":"node_modules/@openzeppelin/contracts/utils/StorageSlot.sol","70":"node_modules/@openzeppelin/contracts/utils/introspection/IERC165.sol","71":"test/YtLending.t.sol","72":"test/YtLp.t.sol","73":"test/YtVault.t.sol"},"language":"Solidity"}
|
||||
@@ -1 +0,0 @@
|
||||
{"id":"c1929388b29594e5","source_id_to_path":{"0":"contracts/interfaces/IUSDY.sol","1":"contracts/interfaces/IYTAssetVault.sol","2":"contracts/interfaces/IYTLPToken.sol","3":"contracts/interfaces/IYTPoolManager.sol","4":"contracts/interfaces/IYTPriceFeed.sol","5":"contracts/interfaces/IYTVault.sol","6":"contracts/ytLp/core/YTPoolManager.sol","7":"contracts/ytLp/core/YTPriceFeed.sol","8":"contracts/ytLp/core/YTRewardRouter.sol","9":"contracts/ytLp/core/YTVault.sol","10":"contracts/ytLp/tokens/USDY.sol","11":"contracts/ytLp/tokens/YTLPToken.sol","12":"contracts/ytVault/YTAssetFactory.sol","13":"contracts/ytVault/YTAssetVault.sol","14":"lib/forge-std/src/Base.sol","15":"lib/forge-std/src/StdAssertions.sol","16":"lib/forge-std/src/StdChains.sol","17":"lib/forge-std/src/StdCheats.sol","18":"lib/forge-std/src/StdConstants.sol","19":"lib/forge-std/src/StdError.sol","20":"lib/forge-std/src/StdInvariant.sol","21":"lib/forge-std/src/StdJson.sol","22":"lib/forge-std/src/StdMath.sol","23":"lib/forge-std/src/StdStorage.sol","24":"lib/forge-std/src/StdStyle.sol","25":"lib/forge-std/src/StdToml.sol","26":"lib/forge-std/src/StdUtils.sol","27":"lib/forge-std/src/Test.sol","28":"lib/forge-std/src/Vm.sol","29":"lib/forge-std/src/console.sol","30":"lib/forge-std/src/console2.sol","31":"lib/forge-std/src/interfaces/IMulticall3.sol","32":"lib/forge-std/src/safeconsole.sol","33":"node_modules/@chainlink/contracts/src/v0.8/shared/interfaces/AggregatorV3Interface.sol","34":"node_modules/@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol","35":"node_modules/@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol","36":"node_modules/@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol","37":"node_modules/@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol","38":"node_modules/@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol","39":"node_modules/@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable.sol","40":"node_modules/@openzeppelin/contracts-upgradeable/utils/ReentrancyGuardUpgradeable.sol","41":"node_modules/@openzeppelin/contracts/interfaces/IERC1363.sol","42":"node_modules/@openzeppelin/contracts/interfaces/IERC165.sol","43":"node_modules/@openzeppelin/contracts/interfaces/IERC1967.sol","44":"node_modules/@openzeppelin/contracts/interfaces/IERC20.sol","45":"node_modules/@openzeppelin/contracts/interfaces/draft-IERC1822.sol","46":"node_modules/@openzeppelin/contracts/interfaces/draft-IERC6093.sol","47":"node_modules/@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol","48":"node_modules/@openzeppelin/contracts/proxy/ERC1967/ERC1967Utils.sol","49":"node_modules/@openzeppelin/contracts/proxy/Proxy.sol","50":"node_modules/@openzeppelin/contracts/proxy/beacon/IBeacon.sol","51":"node_modules/@openzeppelin/contracts/token/ERC20/ERC20.sol","52":"node_modules/@openzeppelin/contracts/token/ERC20/IERC20.sol","53":"node_modules/@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol","54":"node_modules/@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol","55":"node_modules/@openzeppelin/contracts/utils/Address.sol","56":"node_modules/@openzeppelin/contracts/utils/Context.sol","57":"node_modules/@openzeppelin/contracts/utils/Errors.sol","58":"node_modules/@openzeppelin/contracts/utils/StorageSlot.sol","59":"node_modules/@openzeppelin/contracts/utils/introspection/IERC165.sol","60":"test/YtLending.t.sol","61":"test/YtLp.t.sol","62":"test/YtVault.t.sol"},"language":"Solidity"}
|
||||
@@ -4,7 +4,7 @@ import * as path from "path";
|
||||
|
||||
/**
|
||||
* 部署 Lending 借贷池系统
|
||||
* 包含:LendingFactory, Configurator, Lending 实现和代理
|
||||
* 包含:LendingFactory, Configurator, LendingPriceFeed, Lending 实现和代理
|
||||
*/
|
||||
async function main() {
|
||||
const [deployer] = await ethers.getSigners();
|
||||
@@ -16,6 +16,30 @@ async function main() {
|
||||
|
||||
const deployments: any = {};
|
||||
|
||||
// ========== 读取配置参数 ==========
|
||||
console.log("📋 读取配置参数...");
|
||||
|
||||
const network = await ethers.provider.getNetwork();
|
||||
const chainId = network.chainId.toString();
|
||||
|
||||
let USDC_ADDRESS: string;
|
||||
let USDC_PRICE_FEED: string;
|
||||
|
||||
if (chainId === "421614") {
|
||||
// Arbitrum 测试网
|
||||
USDC_ADDRESS = "0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d";
|
||||
USDC_PRICE_FEED = "0x0153002d20B96532C639313c2d54c3dA09109309"; // USDC/USD
|
||||
} else if (chainId === "56") {
|
||||
// BSC 主网
|
||||
USDC_ADDRESS = "0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d";
|
||||
USDC_PRICE_FEED = "0x51597f405303C4377E36123cBc172b13269EA163"; // USDC/USD
|
||||
} else {
|
||||
throw new Error(`不支持的网络: ${chainId}`);
|
||||
}
|
||||
|
||||
console.log(" USDC 地址:", USDC_ADDRESS);
|
||||
console.log(" USDC Price Feed:", USDC_PRICE_FEED, "\n");
|
||||
|
||||
// ========== 第一阶段:部署工厂合约 ==========
|
||||
console.log("📦 Phase 1: 部署 LendingFactory...");
|
||||
const LendingFactory = await ethers.getContractFactory("LendingFactory");
|
||||
@@ -25,8 +49,38 @@ async function main() {
|
||||
console.log("✅ LendingFactory 已部署:", lendingFactoryAddress);
|
||||
deployments.lendingFactory = lendingFactoryAddress;
|
||||
|
||||
// ========== 第二阶段:部署 Configurator ==========
|
||||
console.log("\n📦 Phase 2: 部署 Configurator (UUPS 代理)...");
|
||||
// ========== 第二阶段:部署 LendingPriceFeed (UUPS 代理) ==========
|
||||
console.log("\n📦 Phase 2: 部署 LendingPriceFeed (UUPS 代理)...");
|
||||
const LendingPriceFeed = await ethers.getContractFactory("LendingPriceFeed");
|
||||
|
||||
// 使用 upgrades 插件部署 UUPS 代理
|
||||
const lendingPriceFeed = await upgrades.deployProxy(
|
||||
LendingPriceFeed,
|
||||
[USDC_ADDRESS, USDC_PRICE_FEED],
|
||||
{
|
||||
kind: "uups",
|
||||
initializer: "initialize"
|
||||
}
|
||||
);
|
||||
await lendingPriceFeed.waitForDeployment();
|
||||
|
||||
const lendingPriceFeedProxyAddress = await lendingPriceFeed.getAddress();
|
||||
console.log("✅ LendingPriceFeed Proxy:", lendingPriceFeedProxyAddress);
|
||||
deployments.lendingPriceFeedProxy = lendingPriceFeedProxyAddress;
|
||||
deployments.lendingPriceFeed = lendingPriceFeedProxyAddress; // 兼容旧字段
|
||||
|
||||
// 获取实现合约地址
|
||||
const lendingPriceFeedImplAddress = await upgrades.erc1967.getImplementationAddress(lendingPriceFeedProxyAddress);
|
||||
console.log("✅ LendingPriceFeed Implementation:", lendingPriceFeedImplAddress);
|
||||
deployments.lendingPriceFeedImpl = lendingPriceFeedImplAddress;
|
||||
|
||||
// 验证价格获取
|
||||
const usdcPrice = await lendingPriceFeed.getPrice(USDC_ADDRESS);
|
||||
console.log("✅ USDC 价格 (1e30 精度):", usdcPrice.toString());
|
||||
console.log("✅ LendingPriceFeed Owner:", await lendingPriceFeed.owner());
|
||||
|
||||
// ========== 第三阶段:部署 Configurator ==========
|
||||
console.log("\n📦 Phase 3: 部署 Configurator (UUPS 代理)...");
|
||||
const Configurator = await ethers.getContractFactory("Configurator");
|
||||
|
||||
// 使用 upgrades 插件部署 UUPS 代理
|
||||
@@ -51,8 +105,8 @@ async function main() {
|
||||
|
||||
console.log("✅ Configurator Owner:", await configurator.owner());
|
||||
|
||||
// ========== 第三阶段:部署 Lending 实现合约 ==========
|
||||
console.log("\n📦 Phase 3: 通过工厂部署 Lending 实现合约...");
|
||||
// ========== 第四阶段:部署 Lending 实现合约 ==========
|
||||
console.log("\n📦 Phase 4: 通过工厂部署 Lending 实现合约...");
|
||||
const deployTx = await lendingFactory.deploy();
|
||||
const deployReceipt = await deployTx.wait();
|
||||
|
||||
@@ -77,8 +131,8 @@ async function main() {
|
||||
console.log("✅ Lending Implementation:", lendingImplAddress);
|
||||
deployments.lendingImpl = lendingImplAddress;
|
||||
|
||||
// ========== 第四阶段:准备部署 Lending 代理 ==========
|
||||
console.log("\n📦 Phase 4: 准备部署 Lending 代理(需要先配置参数)");
|
||||
// ========== 第五阶段:准备部署 Lending 代理 ==========
|
||||
console.log("\n📦 Phase 5: 准备部署 Lending 代理(需要先配置参数)");
|
||||
console.log("⚠️ 请运行配置脚本 08-configureLending.ts 来完成配置和代理部署");
|
||||
|
||||
// ========== 保存部署信息 ==========
|
||||
@@ -87,11 +141,11 @@ async function main() {
|
||||
? JSON.parse(fs.readFileSync(deploymentsPath, "utf-8"))
|
||||
: {};
|
||||
|
||||
const network = await ethers.provider.getNetwork();
|
||||
const chainId = network.chainId.toString();
|
||||
existingDeployments[chainId] = {
|
||||
...existingDeployments[chainId],
|
||||
...deployments,
|
||||
usdcAddress: USDC_ADDRESS,
|
||||
usdcPriceFeed: USDC_PRICE_FEED,
|
||||
deployTimestamp: new Date().toISOString(),
|
||||
deployer: deployer.address
|
||||
};
|
||||
@@ -102,11 +156,23 @@ async function main() {
|
||||
// ========== 部署总结 ==========
|
||||
console.log("\n🎉 部署总结:");
|
||||
console.log("=====================================");
|
||||
console.log("LendingFactory: ", deployments.lendingFactory);
|
||||
console.log("Configurator (Proxy): ", deployments.configuratorProxy);
|
||||
console.log("Configurator (Impl): ", deployments.configuratorImpl);
|
||||
console.log("Lending (Impl): ", deployments.lendingImpl);
|
||||
console.log("=====================================\n");
|
||||
console.log("📍 外部依赖:");
|
||||
console.log(" USDC Address: ", USDC_ADDRESS);
|
||||
console.log(" USDC Price Feed: ", USDC_PRICE_FEED);
|
||||
console.log("\n📦 已部署合约:");
|
||||
console.log(" LendingFactory: ", deployments.lendingFactory);
|
||||
console.log("\n📊 LendingPriceFeed (UUPS):");
|
||||
console.log(" Proxy: ", deployments.lendingPriceFeedProxy);
|
||||
console.log(" Implementation: ", deployments.lendingPriceFeedImpl);
|
||||
console.log("\n⚙️ Configurator (UUPS):");
|
||||
console.log(" Proxy: ", deployments.configuratorProxy);
|
||||
console.log(" Implementation: ", deployments.configuratorImpl);
|
||||
console.log("\n🏦 Lending:");
|
||||
console.log(" Implementation: ", deployments.lendingImpl);
|
||||
console.log(" Proxy: ", "待配置");
|
||||
console.log("=====================================");
|
||||
console.log("\n💡 下一步:");
|
||||
console.log(" 运行 08-configureLending.ts 来创建 Lending 市场\n");
|
||||
}
|
||||
|
||||
main()
|
||||
|
||||
@@ -4,7 +4,7 @@ import * as path from "path";
|
||||
|
||||
/**
|
||||
* 配置 Lending 借贷池参数并部署代理
|
||||
* 包含:设置工厂、配置市场参数、添加抵押资产、部署 Lending 代理
|
||||
* 包含:配置市场参数、添加 YT 抵押资产、部署 Lending 代理
|
||||
*/
|
||||
async function main() {
|
||||
const [deployer] = await ethers.getSigners();
|
||||
@@ -29,40 +29,66 @@ async function main() {
|
||||
|
||||
console.log("📋 使用已部署的合约:");
|
||||
console.log(" LendingFactory:", deployments.lendingFactory);
|
||||
console.log(" Configurator:", deployments.configuratorProxy);
|
||||
console.log(" Lending Impl:", deployments.lendingImpl, "\n");
|
||||
console.log(" LendingPriceFeed (Proxy):", deployments.lendingPriceFeed);
|
||||
if (deployments.lendingPriceFeedImpl) {
|
||||
console.log(" LendingPriceFeed (Impl):", deployments.lendingPriceFeedImpl);
|
||||
}
|
||||
console.log(" Configurator (Proxy):", deployments.configuratorProxy);
|
||||
console.log(" Lending (Impl):", deployments.lendingImpl);
|
||||
console.log(" USDC Address:", deployments.usdcAddress);
|
||||
console.log(" USDC Price Feed:", deployments.usdcPriceFeed, "\n");
|
||||
|
||||
const configurator = await ethers.getContractAt("Configurator", deployments.configuratorProxy);
|
||||
// ========== 读取 YT Vault 部署信息 ==========
|
||||
const vaultDeploymentsPath = path.join(__dirname, "../../deployments-vault-system.json");
|
||||
if (!fs.existsSync(vaultDeploymentsPath)) {
|
||||
throw new Error("未找到 YT Vault 部署信息文件,请先部署 YT Vault 系统");
|
||||
}
|
||||
|
||||
const vaultDeployments = JSON.parse(fs.readFileSync(vaultDeploymentsPath, "utf-8"));
|
||||
if (!vaultDeployments.vaults || vaultDeployments.vaults.length === 0) {
|
||||
throw new Error("未找到已部署的 YT Vault,请先创建至少一个 YT Vault");
|
||||
}
|
||||
|
||||
console.log("📋 找到 YT Vaults:", vaultDeployments.vaults.length);
|
||||
vaultDeployments.vaults.forEach((vault: any, index: number) => {
|
||||
console.log(` ${index + 1}. ${vault.name} (${vault.symbol}): ${vault.address}`);
|
||||
});
|
||||
console.log();
|
||||
|
||||
// ========== 第一阶段:配置外部代币和价格源 ==========
|
||||
console.log("⚙️ Phase 1: 配置外部代币和价格源");
|
||||
// ========== 第一阶段:配置参数 ==========
|
||||
console.log("⚙️ Phase 1: 准备配置参数");
|
||||
|
||||
const USDC = {
|
||||
address: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
|
||||
decimals: 6
|
||||
address: deployments.usdcAddress,
|
||||
decimals: 6 // todo bsc主网是 18 decimal
|
||||
};
|
||||
|
||||
// 选择要作为抵押品的 YT Vaults(可以选择多个)
|
||||
// todo: 根据需要修改这里,选择哪些 YT Vault 作为抵押品
|
||||
const selectedVaults = vaultDeployments.vaults.slice(0, 3); // 默认选择前3个
|
||||
|
||||
const WETH = {
|
||||
address: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
|
||||
decimals: 18
|
||||
};
|
||||
console.log(" 选择的抵押品 YT Vaults:");
|
||||
selectedVaults.forEach((vault: any, index: number) => {
|
||||
console.log(` ${index + 1}. ${vault.name}: ${vault.address}`);
|
||||
});
|
||||
console.log();
|
||||
|
||||
const usdcPriceFeed = "0x8fFfFfd4AfB6115b954Bd326cbe7B4BA576818f6";
|
||||
const ethPriceFeed = "0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419";
|
||||
|
||||
console.log(" 基础资产 (USDC):", USDC.address);
|
||||
console.log(" 抵押资产 (WETH):", WETH.address);
|
||||
console.log(" USDC 价格源:", usdcPriceFeed);
|
||||
console.log(" ETH 价格源:", ethPriceFeed, "\n");
|
||||
// 准备抵押资产配置
|
||||
const assetConfigs = selectedVaults.map((vault: any) => ({
|
||||
asset: vault.address,
|
||||
decimals: 18, // YT Token 都是 18 decimals
|
||||
borrowCollateralFactor: ethers.parseUnits("0.80", 18), // 80% LTV
|
||||
liquidateCollateralFactor: ethers.parseUnits("0.85", 18), // 85% 清算线
|
||||
liquidationFactor: ethers.parseUnits("0.95", 18), // 95% (配合 storeFrontPriceFactor 产生折扣)
|
||||
supplyCap: ethers.parseUnits("100000", 18) // 最多 10 万 YT
|
||||
}));
|
||||
|
||||
// ========== 第二阶段:准备配置参数 ==========
|
||||
console.log("⚙️ Phase 2: 准备市场配置参数");
|
||||
|
||||
// 使用占位符地址作为 Lending 代理地址
|
||||
const LENDING_PROXY_PLACEHOLDER = ethers.ZeroAddress;
|
||||
|
||||
const configuration = {
|
||||
baseToken: USDC.address,
|
||||
baseTokenPriceFeed: usdcPriceFeed,
|
||||
lendingPriceSource: deployments.lendingPriceFeed,
|
||||
|
||||
// 利率模型参数(年化利率,18位精度)
|
||||
// 注意:这些年化利率会在 initialize 时自动转换为每秒利率
|
||||
@@ -82,47 +108,27 @@ async function main() {
|
||||
baseBorrowMin: ethers.parseUnits("100", USDC.decimals), // 最小借 100 USDC
|
||||
targetReserves: ethers.parseUnits("5000000", USDC.decimals), // 目标储备 500 万
|
||||
|
||||
assetConfigs: [
|
||||
{
|
||||
asset: WETH.address,
|
||||
priceFeed: ethPriceFeed,
|
||||
decimals: WETH.decimals,
|
||||
borrowCollateralFactor: ethers.parseUnits("0.80", 18), // 80% LTV
|
||||
liquidateCollateralFactor: ethers.parseUnits("0.85", 18), // 85% 清算线
|
||||
liquidationFactor: ethers.parseUnits("0.95", 18), // 95% (配合 storeFrontPriceFactor 产生折扣)
|
||||
supplyCap: ethers.parseUnits("100000", WETH.decimals) // 最多 10 万 ETH
|
||||
}
|
||||
]
|
||||
assetConfigs: assetConfigs
|
||||
};
|
||||
|
||||
console.log("✅ 配置参数已准备\n");
|
||||
console.log("✅ 配置参数已准备");
|
||||
console.log(" 基础资产: USDC (6 decimals)");
|
||||
console.log(" 价格源: LendingPriceFeed");
|
||||
console.log(" 抵押资产数量:", assetConfigs.length);
|
||||
console.log(" Supply Kink: 80%");
|
||||
console.log(" Borrow Kink: 80%");
|
||||
console.log(" 最小借款: 100 USDC");
|
||||
console.log(" 目标储备: 5,000,000 USDC\n");
|
||||
|
||||
// ========== 第三阶段:设置工厂和配置 ==========
|
||||
console.log("⚙️ Phase 3: 设置工厂和配置参数");
|
||||
// ========== 第三阶段:部署 Lending 代理 ==========
|
||||
console.log("⚙️ Phase 3: 部署 Lending 代理");
|
||||
|
||||
console.log(" 设置工厂合约...");
|
||||
const setFactoryTx = await configurator.setFactory(LENDING_PROXY_PLACEHOLDER, deployments.lendingFactory);
|
||||
await setFactoryTx.wait();
|
||||
console.log(" ✅ 工厂已设置");
|
||||
|
||||
console.log(" 设置市场配置...");
|
||||
const setConfigTx = await configurator.setConfiguration(LENDING_PROXY_PLACEHOLDER, configuration);
|
||||
await setConfigTx.wait();
|
||||
console.log(" ✅ 配置已设置\n");
|
||||
|
||||
// ========== 第四阶段:部署 Lending 代理 ==========
|
||||
console.log("⚙️ Phase 4: 部署 Lending 代理");
|
||||
|
||||
console.log(" 获取配置信息...");
|
||||
const config = await configurator.getConfiguration(LENDING_PROXY_PLACEHOLDER);
|
||||
|
||||
console.log(" 部署 Lending 代理...");
|
||||
const Lending = await ethers.getContractFactory("Lending");
|
||||
|
||||
// 使用 upgrades 插件部署 UUPS 代理
|
||||
const lending = await upgrades.deployProxy(
|
||||
Lending,
|
||||
[config],
|
||||
[configuration],
|
||||
{
|
||||
kind: "uups",
|
||||
initializer: "initialize"
|
||||
@@ -130,14 +136,32 @@ async function main() {
|
||||
);
|
||||
await lending.waitForDeployment();
|
||||
const lendingProxyAddress = await lending.getAddress();
|
||||
console.log(" ✅ Lending Proxy 已部署:", lendingProxyAddress);
|
||||
console.log("✅ Lending Proxy 已部署:", lendingProxyAddress);
|
||||
|
||||
// 获取实现合约地址(验证)
|
||||
const lendingImplAddress = await upgrades.erc1967.getImplementationAddress(lendingProxyAddress);
|
||||
console.log(" ✅ Lending Implementation (验证):", lendingImplAddress, "\n");
|
||||
console.log("✅ Lending Implementation (验证):", lendingImplAddress);
|
||||
|
||||
// 验证基本信息
|
||||
console.log("\n📊 验证部署信息:");
|
||||
const baseToken = await lending.baseToken();
|
||||
const priceSource = await lending.lendingPriceSource();
|
||||
const totalSupply = await lending.getTotalSupply();
|
||||
const totalBorrow = await lending.getTotalBorrow();
|
||||
|
||||
console.log(" Base Token:", baseToken);
|
||||
console.log(" Price Source:", priceSource);
|
||||
console.log(" Total Supply:", totalSupply.toString());
|
||||
console.log(" Total Borrow:", totalBorrow.toString());
|
||||
console.log();
|
||||
|
||||
// ========== 保存部署信息 ==========
|
||||
deployments.lendingProxy = lendingProxyAddress;
|
||||
deployments.collateralAssets = selectedVaults.map((v: any) => ({
|
||||
name: v.name,
|
||||
symbol: v.symbol,
|
||||
address: v.address
|
||||
}));
|
||||
deployments.configTimestamp = new Date().toISOString();
|
||||
|
||||
const allDeployments = JSON.parse(fs.readFileSync(deploymentsPath, "utf-8"));
|
||||
@@ -147,14 +171,23 @@ async function main() {
|
||||
console.log("💾 配置信息已保存到:", deploymentsPath);
|
||||
|
||||
// ========== 配置总结 ==========
|
||||
console.log("\n🎉 配置总结:");
|
||||
console.log("\n🎉 部署和配置完成!");
|
||||
console.log("=====================================");
|
||||
console.log("Lending Proxy: ", lendingProxyAddress);
|
||||
console.log("Base Token: ", USDC.address);
|
||||
console.log("Base Token (USDC): ", USDC.address);
|
||||
console.log("Price Feed: ", deployments.lendingPriceFeed);
|
||||
console.log("Collateral Assets: ", configuration.assetConfigs.length);
|
||||
console.log("Supply Kink: ", "80%");
|
||||
console.log("Borrow Kink: ", "80%");
|
||||
console.log("Min Borrow: ", "100 USDC");
|
||||
console.log("Target Reserves: ", "5,000,000 USDC");
|
||||
console.log("=====================================");
|
||||
console.log("\n📋 抵押资产列表:");
|
||||
selectedVaults.forEach((vault: any, index: number) => {
|
||||
console.log(` ${index + 1}. ${vault.name} (${vault.symbol})`);
|
||||
console.log(` 地址: ${vault.address}`);
|
||||
console.log(` LTV: 80%, 清算线: 85%`);
|
||||
});
|
||||
console.log("=====================================\n");
|
||||
}
|
||||
|
||||
|
||||
@@ -29,16 +29,74 @@ async function main() {
|
||||
}
|
||||
|
||||
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");
|
||||
|
||||
// ========== 选择要升级的合约 ==========
|
||||
// 修改这里来选择升级 Lending 或 Configurator
|
||||
const UPGRADE_LENDING = true; // true = 升级 Lending, false = 升级 Configurator
|
||||
// 修改这里来选择升级哪个合约
|
||||
// 1 = LendingPriceFeed, 2 = Configurator, 3 = Lending
|
||||
const UPGRADE_CONTRACT = 1; // 修改这个数字来选择要升级的合约
|
||||
|
||||
if (UPGRADE_LENDING) {
|
||||
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 合约");
|
||||
|
||||
@@ -81,7 +139,7 @@ async function main() {
|
||||
deployments.lendingImpl = newLendingImplAddress;
|
||||
deployments.lendingUpgradeTimestamp = new Date().toISOString();
|
||||
|
||||
} else {
|
||||
} else if (UPGRADE_CONTRACT === 2) {
|
||||
// ========== 升级 Configurator ==========
|
||||
console.log("🔄 Phase 1: 升级 Configurator 合约");
|
||||
|
||||
@@ -117,34 +175,33 @@ async function main() {
|
||||
// 保存新的实现地址
|
||||
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("=====================================");
|
||||
if (UPGRADE_LENDING) {
|
||||
console.log("升级合约: Lending");
|
||||
console.log("Lending Proxy: ", deployments.lendingProxy);
|
||||
console.log("新 Lending Implementation:", deployments.lendingImpl);
|
||||
} else {
|
||||
console.log("升级合约: Configurator");
|
||||
console.log("Configurator Proxy: ", deployments.configuratorProxy);
|
||||
console.log("新 Configurator Impl: ", deployments.configuratorImpl);
|
||||
}
|
||||
console.log("=====================================\n");
|
||||
|
||||
console.log("✅ 升级完成!");
|
||||
console.log("\n✅ 升级流程全部完成!");
|
||||
console.log("⚠️ 重要提示:");
|
||||
console.log(" 1. 代理地址保持不变,用户无需更改合约地址");
|
||||
console.log(" 2. 所有状态数据已保留");
|
||||
console.log(" 3. 建议在测试网充分测试后再升级主网\n");
|
||||
console.log(" 3. 建议在测试网充分测试后再升级主网");
|
||||
console.log(" 4. 当前升级的合约:", UPGRADE_CONTRACT === 1 ? "LendingPriceFeed" : (UPGRADE_CONTRACT === 2 ? "Configurator" : "Lending"), "\n");
|
||||
}
|
||||
|
||||
main()
|
||||
|
||||
1936
test/YtLending.t.sol
1936
test/YtLending.t.sol
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user